code stringlengths 5 1.01M | repo_name stringlengths 5 84 | path stringlengths 4 311 | language stringclasses 30 values | license stringclasses 15 values | size int64 5 1.01M | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
<?php
/**
* @package plugins.metadata
* @subpackage api.enum
*/
class KalturaMetadataProfileCreateMode extends KalturaEnum implements MetadataProfileCreateMode
{
} | ivesbai/server | plugins/metadata/lib/api/KalturaMetadataProfileCreateMode.php | PHP | agpl-3.0 | 168 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
7427,
13354,
7076,
1012,
27425,
1008,
1030,
4942,
23947,
4270,
17928,
1012,
4372,
2819,
1008,
1013,
2465,
10556,
7096,
27618,
12928,
2850,
2696,
21572,
8873,
2571,
16748,
3686,
5302,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <MemoryModule.h>
typedef void (*FooFunc)(const char *name);
unsigned char *ReadAllBytes(const char *filePath, size_t *size) {
assert(filePath != NULL);
assert(size != NULL);
FILE *fp;
fopen_s(&fp, filePath, "rb");
if (fp == NULL) return NULL;
if (fseek(fp, 0, SEEK_END) != 0) {
fclose(fp);
return NULL;
}
*size = (size_t)ftell(fp);
if (*size == EOF) {
fclose(fp);
return NULL;
}
unsigned char *bytes = malloc(*size);
if (bytes == NULL) {
fclose(fp);
return NULL;
}
if (fseek(fp, 0, SEEK_SET) != 0 || fread(bytes, 1, *size, fp) != *size) {
free(bytes);
fclose(fp);
return NULL;
}
fclose(fp);
return bytes;
}
int main(void) {
size_t size;
void *dll = ReadAllBytes("mylib.dll", &size);
if (dll == NULL) {
fprintf(stderr, "Failed to read DLL data into memory.\n");
return EXIT_FAILURE;
}
HMEMORYMODULE hMM = MemoryLoadLibrary(dll, size);
if (hMM == NULL) {
fprintf(stderr, "Failed to load DLL from memory.\n");
free(dll);
return EXIT_FAILURE;
}
FooFunc foo = (FooFunc)MemoryGetProcAddress(hMM, "Foo");
if (foo == NULL) {
fprintf(stderr, "Failed to get procedure address.\n");
MemoryFreeLibrary(hMM);
free(dll);
return EXIT_FAILURE;
}
foo("Sam");
MemoryFreeLibrary(hMM);
free(dll);
return 0;
}
// References:
// https://github.com/fancycode/MemoryModule/blob/master/tests/LoadDll.cpp
| myd7349/Ongoing-Study | cpp/CMake/vcpkg/memorymodule_test/memorymodule_test.c | C | lgpl-3.0 | 1,500 | [
30522,
1001,
2421,
1026,
20865,
1012,
1044,
1028,
1001,
2421,
1026,
2358,
20617,
1012,
1044,
1028,
1001,
2421,
1026,
2358,
19422,
12322,
1012,
1044,
1028,
1001,
2421,
1026,
3638,
5302,
8566,
2571,
1012,
1044,
1028,
21189,
12879,
11675,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html><html><head><meta charset="utf-8" />
<meta http-equiv="refresh" content="0;url=/place/hong-kong/procurement/" />
</head></html> | okfn/opendataindex-2015 | country/overview/Hong%20Kong/procurement/index.html | HTML | mit | 142 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1013,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
25416,
21898,
1000,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* conversations_table.c
* conversations_table 2003 Ronnie Sahlberg
* Helper routines common to all endpoint conversations tap.
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <string.h>
#include "packet_info.h"
#include "proto.h"
#include "conversation_table.h"
#include "addr_resolv.h"
#include "stat_tap_ui.h"
struct register_ct {
gboolean hide_ports; /* hide TCP / UDP port columns */
int proto_id; /* protocol id (0-indexed) */
tap_packet_cb conv_func; /* function to be called for new incoming packets for conversation*/
tap_packet_cb host_func; /* function to be called for new incoming packets for hostlist */
conv_gui_init_cb conv_gui_init; /* GUI specific function to initialize conversation */
host_gui_init_cb host_gui_init; /* GUI specific function to initialize hostlist */
};
gboolean get_conversation_hide_ports(register_ct_t* ct)
{
return ct->hide_ports;
}
int get_conversation_proto_id(register_ct_t* ct)
{
if (!ct) {
return -1;
}
return ct->proto_id;
}
tap_packet_cb get_conversation_packet_func(register_ct_t* ct)
{
return ct->conv_func;
}
tap_packet_cb get_hostlist_packet_func(register_ct_t* ct)
{
return ct->host_func;
}
static GSList *registered_ct_tables = NULL;
void
dissector_conversation_init(const char *opt_arg, void* userdata)
{
register_ct_t *table = (register_ct_t*)userdata;
GString *cmd_str = g_string_new("conv,");
const char *filter=NULL;
g_string_append(cmd_str, proto_get_protocol_filter_name(table->proto_id));
if(!strncmp(opt_arg, cmd_str->str, cmd_str->len)){
if (opt_arg[cmd_str->len] == ',') {
filter = opt_arg + cmd_str->len + 1;
}
}
g_string_free(cmd_str, TRUE);
if (table->conv_gui_init)
table->conv_gui_init(table, filter);
}
void
dissector_hostlist_init(const char *opt_arg, void* userdata)
{
register_ct_t *table = (register_ct_t*)userdata;
GString *cmd_str = g_string_new("");
const char *filter=NULL;
g_string_printf(cmd_str, "%s,%s,", HOSTLIST_TAP_PREFIX, proto_get_protocol_filter_name(table->proto_id));
if(!strncmp(opt_arg, cmd_str->str, cmd_str->len)){
if (opt_arg[cmd_str->len] == ',') {
filter = opt_arg + cmd_str->len + 1;
}
} else {
filter=NULL;
}
g_string_free(cmd_str, TRUE);
if (table->host_gui_init)
table->host_gui_init(table, filter);
}
/** get conversation from protocol ID
*
* @param proto_id protocol ID
* @return tap function handler of conversation
*/
register_ct_t* get_conversation_by_proto_id(int proto_id)
{
GSList *ct;
register_ct_t *table;
for(ct = registered_ct_tables; ct != NULL; ct = g_slist_next(ct)){
table = (register_ct_t*)ct->data;
if ((table) && (table->proto_id == proto_id))
return table;
}
return NULL;
}
static gint
insert_sorted_by_table_name(gconstpointer aparam, gconstpointer bparam)
{
const register_ct_t *a = (register_ct_t *)aparam;
const register_ct_t *b = (register_ct_t *)bparam;
return g_ascii_strcasecmp(proto_get_protocol_short_name(find_protocol_by_id(a->proto_id)), proto_get_protocol_short_name(find_protocol_by_id(b->proto_id)));
}
void
register_conversation_table(const int proto_id, gboolean hide_ports, tap_packet_cb conv_packet_func, tap_packet_cb hostlist_func)
{
register_ct_t *table;
table = g_new(register_ct_t,1);
table->hide_ports = hide_ports;
table->proto_id = proto_id;
table->conv_func = conv_packet_func;
table->host_func = hostlist_func;
table->conv_gui_init = NULL;
table->host_gui_init = NULL;
registered_ct_tables = g_slist_insert_sorted(registered_ct_tables, table, insert_sorted_by_table_name);
}
/* Set GUI fields for register_ct list */
static void
set_conv_gui_data(gpointer data, gpointer user_data)
{
GString *conv_cmd_str = g_string_new("conv,");
stat_tap_ui ui_info;
register_ct_t *table = (register_ct_t*)data;
table->conv_gui_init = (conv_gui_init_cb)user_data;
g_string_append(conv_cmd_str, proto_get_protocol_filter_name(table->proto_id));
ui_info.group = REGISTER_STAT_GROUP_CONVERSATION_LIST;
ui_info.title = NULL; /* construct this from the protocol info? */
ui_info.cli_string = g_string_free(conv_cmd_str, FALSE);
ui_info.tap_init_cb = dissector_conversation_init;
ui_info.nparams = 0;
ui_info.params = NULL;
register_stat_tap_ui(&ui_info, table);
}
void conversation_table_set_gui_info(conv_gui_init_cb init_cb)
{
g_slist_foreach(registered_ct_tables, set_conv_gui_data, init_cb);
}
static void
set_host_gui_data(gpointer data, gpointer user_data)
{
GString *host_cmd_str = g_string_new("");
stat_tap_ui ui_info;
register_ct_t *table = (register_ct_t*)data;
table->host_gui_init = (host_gui_init_cb)user_data;
g_string_printf(host_cmd_str, "%s,%s", HOSTLIST_TAP_PREFIX, proto_get_protocol_filter_name(table->proto_id));
ui_info.group = REGISTER_STAT_GROUP_ENDPOINT_LIST;
ui_info.title = NULL; /* construct this from the protocol info? */
ui_info.cli_string = g_string_free(host_cmd_str, FALSE);
ui_info.tap_init_cb = dissector_hostlist_init;
ui_info.nparams = 0;
ui_info.params = NULL;
register_stat_tap_ui(&ui_info, table);
}
void hostlist_table_set_gui_info(host_gui_init_cb init_cb)
{
g_slist_foreach(registered_ct_tables, set_host_gui_data, init_cb);
}
void conversation_table_iterate_tables(GFunc func, gpointer user_data)
{
g_slist_foreach(registered_ct_tables, func, user_data);
}
guint conversation_table_get_num(void)
{
return g_slist_length(registered_ct_tables);
}
register_ct_t *get_conversation_table_by_num(guint table_num)
{
return (register_ct_t *) g_slist_nth_data(registered_ct_tables, table_num);
}
/** Compute the hash value for two given address/port pairs.
* (Parameter type is gconstpointer for GHashTable compatibility.)
*
* @param v Conversation Key. MUST point to a conv_key_t struct.
* @return Computed key hash.
*/
static guint
conversation_hash(gconstpointer v)
{
const conv_key_t *key = (const conv_key_t *)v;
guint hash_val;
hash_val = 0;
add_address_to_hash(hash_val, &key->addr1);
hash_val += key->port1;
add_address_to_hash(hash_val, &key->addr2);
hash_val += key->port2;
hash_val ^= key->conv_id;
return hash_val;
}
/** Compare two conversation keys for an exact match.
* (Parameter types are gconstpointer for GHashTable compatibility.)
*
* @param key1 First conversation. MUST point to a conv_key_t struct.
* @param key2 Second conversation. MUST point to a conv_key_t struct.
* @return TRUE if conversations are equal, FALSE otherwise.
*/
static gboolean
conversation_equal(gconstpointer key1, gconstpointer key2)
{
const conv_key_t *ck1 = (const conv_key_t *)key1;
const conv_key_t *ck2 = (const conv_key_t *)key2;
if (ck1->conv_id == ck2->conv_id)
{
if (ck1->port1 == ck2->port1 &&
ck1->port2 == ck2->port2 &&
addresses_equal(&ck1->addr1, &ck2->addr1) &&
addresses_equal(&ck1->addr2, &ck2->addr2)) {
return TRUE;
}
if (ck1->port2 == ck2->port1 &&
ck1->port1 == ck2->port2 &&
addresses_equal(&ck1->addr2, &ck2->addr1) &&
addresses_equal(&ck1->addr1, &ck2->addr2)) {
return TRUE;
}
}
/*
* The addresses, ports, or conversation IDs don't match.
*/
return FALSE;
}
void
reset_conversation_table_data(conv_hash_t *ch)
{
if (!ch) {
return;
}
if (ch->conv_array != NULL) {
guint i;
for(i = 0; i < ch->conv_array->len; i++){
conv_item_t *conv = &g_array_index(ch->conv_array, conv_item_t, i);
g_free((gpointer)conv->src_address.data);
g_free((gpointer)conv->dst_address.data);
}
g_array_free(ch->conv_array, TRUE);
}
if (ch->hashtable != NULL) {
g_hash_table_destroy(ch->hashtable);
}
ch->conv_array=NULL;
ch->hashtable=NULL;
}
void reset_hostlist_table_data(conv_hash_t *ch)
{
if (!ch) {
return;
}
if (ch->conv_array != NULL) {
guint i;
for(i = 0; i < ch->conv_array->len; i++){
hostlist_talker_t *host = &g_array_index(ch->conv_array, hostlist_talker_t, i);
g_free((gpointer)host->myaddress.data);
}
g_array_free(ch->conv_array, TRUE);
}
if (ch->hashtable != NULL) {
g_hash_table_destroy(ch->hashtable);
}
ch->conv_array=NULL;
ch->hashtable=NULL;
}
const char *get_conversation_address(wmem_allocator_t *allocator, address *addr, gboolean resolve_names)
{
if (resolve_names) {
return address_to_display(allocator, addr);
} else {
return address_to_str(allocator, addr);
}
}
const char *get_conversation_port(wmem_allocator_t *allocator, guint32 port, port_type ptype, gboolean resolve_names)
{
if(!resolve_names) ptype = PT_NONE;
switch(ptype) {
case(PT_TCP):
return tcp_port_to_display(allocator, port);
case(PT_UDP):
return udp_port_to_display(allocator, port);
case(PT_SCTP):
return sctp_port_to_display(allocator, port);
default:
return wmem_strdup_printf(allocator, "%d", port);
}
}
/* given an address (to distinguish between ipv4 and ipv6 for tcp/udp),
a port_type and a name_type (FN_...)
return a string for the filter name.
Some addresses, like AT_ETHER may actually be any of multiple types
of protocols, either ethernet, tokenring, fddi, wlan etc so we must be
more specific there; that's why we need specific_addr_type.
*/
static const char *
conversation_get_filter_name(conv_item_t *conv_item, conv_filter_type_e filter_type)
{
if ((conv_item == NULL) || (conv_item->dissector_info == NULL) || (conv_item->dissector_info->get_filter_type == NULL)) {
return CONV_FILTER_INVALID;
}
return conv_item->dissector_info->get_filter_type(conv_item, filter_type);
}
static const char *
hostlist_get_filter_name(hostlist_talker_t *host, conv_filter_type_e filter_type)
{
if ((host == NULL) || (host->dissector_info == NULL) || (host->dissector_info->get_filter_type == NULL)) {
return CONV_FILTER_INVALID;
}
return host->dissector_info->get_filter_type(host, filter_type);
}
/* Convert a port number into a string or NULL */
static char *
ct_port_to_str(port_type ptype, guint32 port)
{
switch(ptype){
case PT_TCP:
case PT_UDP:
case PT_SCTP:
case PT_NCP:
return g_strdup_printf("%d", port);
default:
break;
}
return NULL;
}
const char *get_conversation_filter(conv_item_t *conv_item, conv_direction_e direction)
{
char *sport, *dport, *src_addr, *dst_addr;
const char *str = "INVALID";
sport = ct_port_to_str(conv_item->ptype, conv_item->src_port);
dport = ct_port_to_str(conv_item->ptype, conv_item->dst_port);
src_addr = address_to_str(NULL, &conv_item->src_address);
dst_addr = address_to_str(NULL, &conv_item->dst_address);
if (conv_item->src_address.type == AT_STRINGZ || conv_item->src_address.type == AT_USB) {
char *new_addr;
new_addr = wmem_strdup_printf(NULL, "\"%s\"", src_addr);
wmem_free(NULL, src_addr);
src_addr = new_addr;
}
if (conv_item->dst_address.type == AT_STRINGZ || conv_item->dst_address.type == AT_USB) {
char *new_addr;
new_addr = wmem_strdup_printf(NULL, "\"%s\"", dst_addr);
wmem_free(NULL, dst_addr);
dst_addr = new_addr;
}
switch(direction){
case CONV_DIR_A_TO_FROM_B:
/* A <-> B */
str = wmem_strdup_printf(NULL, "%s==%s%s%s%s%s && %s==%s%s%s%s%s",
conversation_get_filter_name(conv_item, CONV_FT_ANY_ADDRESS),
src_addr,
sport?" && ":"",
sport?conversation_get_filter_name(conv_item, CONV_FT_ANY_PORT):"",
sport?"==":"",
sport?sport:"",
conversation_get_filter_name(conv_item, CONV_FT_ANY_ADDRESS),
dst_addr,
dport?" && ":"",
dport?conversation_get_filter_name(conv_item, CONV_FT_ANY_PORT):"",
dport?"==":"",
dport?dport:""
);
break;
case CONV_DIR_A_TO_B:
/* A --> B */
str = wmem_strdup_printf(NULL, "%s==%s%s%s%s%s && %s==%s%s%s%s%s",
conversation_get_filter_name(conv_item, CONV_FT_SRC_ADDRESS),
src_addr,
sport?" && ":"",
sport?conversation_get_filter_name(conv_item, CONV_FT_SRC_PORT):"",
sport?"==":"",
sport?sport:"",
conversation_get_filter_name(conv_item, CONV_FT_DST_ADDRESS),
dst_addr,
dport?" && ":"",
dport?conversation_get_filter_name(conv_item, CONV_FT_DST_PORT):"",
dport?"==":"",
dport?dport:""
);
break;
case CONV_DIR_A_FROM_B:
/* A <-- B */
str = wmem_strdup_printf(NULL, "%s==%s%s%s%s%s && %s==%s%s%s%s%s",
conversation_get_filter_name(conv_item, CONV_FT_DST_ADDRESS),
src_addr,
sport?" && ":"",
sport?conversation_get_filter_name(conv_item, CONV_FT_DST_PORT):"",
sport?"==":"",
sport?sport:"",
conversation_get_filter_name(conv_item, CONV_FT_SRC_ADDRESS),
dst_addr,
dport?" && ":"",
dport?conversation_get_filter_name(conv_item, CONV_FT_SRC_PORT):"",
dport?"==":"",
dport?dport:""
);
break;
case CONV_DIR_A_TO_FROM_ANY:
/* A <-> ANY */
str = wmem_strdup_printf(NULL, "%s==%s%s%s%s%s",
conversation_get_filter_name(conv_item, CONV_FT_ANY_ADDRESS),
src_addr,
sport?" && ":"",
sport?conversation_get_filter_name(conv_item, CONV_FT_ANY_PORT):"",
sport?"==":"",
sport?sport:""
);
break;
case CONV_DIR_A_TO_ANY:
/* A --> ANY */
str = wmem_strdup_printf(NULL, "%s==%s%s%s%s%s",
conversation_get_filter_name(conv_item, CONV_FT_SRC_ADDRESS),
src_addr,
sport?" && ":"",
sport?conversation_get_filter_name(conv_item, CONV_FT_SRC_PORT):"",
sport?"==":"",
sport?sport:""
);
break;
case CONV_DIR_A_FROM_ANY:
/* A <-- ANY */
str = wmem_strdup_printf(NULL, "%s==%s%s%s%s%s",
conversation_get_filter_name(conv_item, CONV_FT_DST_ADDRESS),
src_addr,
sport?" && ":"",
sport?conversation_get_filter_name(conv_item, CONV_FT_DST_PORT):"",
sport?"==":"",
sport?sport:""
);
break;
case CONV_DIR_ANY_TO_FROM_B:
/* ANY <-> B */
str = wmem_strdup_printf(NULL, "%s==%s%s%s%s%s",
conversation_get_filter_name(conv_item, CONV_FT_ANY_ADDRESS),
dst_addr,
dport?" && ":"",
dport?conversation_get_filter_name(conv_item, CONV_FT_ANY_PORT):"",
dport?"==":"",
dport?dport:""
);
break;
case CONV_DIR_ANY_FROM_B:
/* ANY <-- B */
str = wmem_strdup_printf(NULL, "%s==%s%s%s%s%s",
conversation_get_filter_name(conv_item, CONV_FT_SRC_ADDRESS),
dst_addr,
dport?" && ":"",
dport?conversation_get_filter_name(conv_item, CONV_FT_SRC_PORT):"",
dport?"==":"",
dport?dport:""
);
break;
case CONV_DIR_ANY_TO_B:
/* ANY --> B */
str = wmem_strdup_printf(NULL, "%s==%s%s%s%s%s",
conversation_get_filter_name(conv_item, CONV_FT_DST_ADDRESS),
dst_addr,
dport?" && ":"",
dport?conversation_get_filter_name(conv_item, CONV_FT_DST_PORT):"",
dport?"==":"",
dport?dport:""
);
break;
default:
break;
}
g_free(sport);
g_free(dport);
wmem_free(NULL, src_addr);
wmem_free(NULL, dst_addr);
return str;
}
const char *get_hostlist_filter(hostlist_talker_t *host)
{
char *sport, *src_addr;
const char *str;
sport=ct_port_to_str(host->ptype, host->port);
src_addr = address_to_str(NULL, &host->myaddress);
if (host->myaddress.type == AT_STRINGZ || host->myaddress.type == AT_USB) {
char *new_addr;
new_addr = wmem_strdup_printf(NULL, "\"%s\"", src_addr);
wmem_free(NULL, src_addr);
src_addr = new_addr;
}
str = g_strdup_printf("%s==%s%s%s%s%s",
hostlist_get_filter_name(host, CONV_FT_ANY_ADDRESS),
src_addr,
sport?" && ":"",
sport?hostlist_get_filter_name(host, CONV_FT_ANY_PORT):"",
sport?"==":"",
sport?sport:"");
g_free(sport);
wmem_free(NULL, src_addr);
return str;
}
void
add_conversation_table_data(conv_hash_t *ch, const address *src, const address *dst, guint32 src_port, guint32 dst_port, int num_frames, int num_bytes,
nstime_t *ts, nstime_t *abs_ts, ct_dissector_info_t *ct_info, port_type ptype)
{
add_conversation_table_data_with_conv_id(ch, src, dst, src_port, dst_port, CONV_ID_UNSET, num_frames, num_bytes, ts, abs_ts, ct_info, ptype);
}
void
add_conversation_table_data_with_conv_id(
conv_hash_t *ch,
const address *src,
const address *dst,
guint32 src_port,
guint32 dst_port,
conv_id_t conv_id,
int num_frames,
int num_bytes,
nstime_t *ts,
nstime_t *abs_ts,
ct_dissector_info_t *ct_info,
port_type ptype)
{
const address *addr1, *addr2;
guint32 port1, port2;
conv_item_t *conv_item = NULL;
unsigned int conversation_idx = 0;
if (src_port > dst_port) {
addr1 = src;
addr2 = dst;
port1 = src_port;
port2 = dst_port;
} else if (src_port < dst_port) {
addr2 = src;
addr1 = dst;
port2 = src_port;
port1 = dst_port;
} else if (cmp_address(src, dst) < 0) {
addr1 = src;
addr2 = dst;
port1 = src_port;
port2 = dst_port;
} else {
addr2 = src;
addr1 = dst;
port2 = src_port;
port1 = dst_port;
}
/* if we don't have any entries at all yet */
if (ch->conv_array == NULL) {
ch->conv_array = g_array_sized_new(FALSE, FALSE, sizeof(conv_item_t), 10000);
ch->hashtable = g_hash_table_new_full(conversation_hash,
conversation_equal, /* key_equal_func */
g_free, /* key_destroy_func */
NULL); /* value_destroy_func */
} else {
/* try to find it among the existing known conversations */
conv_key_t existing_key;
gpointer conversation_idx_hash_val;
existing_key.addr1 = *addr1;
existing_key.addr2 = *addr2;
existing_key.port1 = port1;
existing_key.port2 = port2;
existing_key.conv_id = conv_id;
if (g_hash_table_lookup_extended(ch->hashtable, &existing_key, NULL, &conversation_idx_hash_val)) {
conv_item = &g_array_index(ch->conv_array, conv_item_t, GPOINTER_TO_UINT(conversation_idx_hash_val));
}
}
/* if we still don't know what conversation this is it has to be a new one
and we have to allocate it and append it to the end of the list */
if (conv_item == NULL) {
conv_key_t *new_key;
conv_item_t new_conv_item;
copy_address(&new_conv_item.src_address, addr1);
copy_address(&new_conv_item.dst_address, addr2);
new_conv_item.dissector_info = ct_info;
new_conv_item.ptype = ptype;
new_conv_item.src_port = port1;
new_conv_item.dst_port = port2;
new_conv_item.conv_id = conv_id;
new_conv_item.rx_frames = 0;
new_conv_item.tx_frames = 0;
new_conv_item.rx_bytes = 0;
new_conv_item.tx_bytes = 0;
new_conv_item.modified = TRUE;
if (ts) {
memcpy(&new_conv_item.start_time, ts, sizeof(new_conv_item.start_time));
memcpy(&new_conv_item.stop_time, ts, sizeof(new_conv_item.stop_time));
memcpy(&new_conv_item.start_abs_time, abs_ts, sizeof(new_conv_item.start_abs_time));
} else {
nstime_set_unset(&new_conv_item.start_abs_time);
nstime_set_unset(&new_conv_item.start_time);
nstime_set_unset(&new_conv_item.stop_time);
}
g_array_append_val(ch->conv_array, new_conv_item);
conversation_idx = ch->conv_array->len - 1;
conv_item = &g_array_index(ch->conv_array, conv_item_t, conversation_idx);
/* ct->conversations address is not a constant but src/dst_address.data are */
new_key = g_new(conv_key_t, 1);
set_address(&new_key->addr1, conv_item->src_address.type, conv_item->src_address.len, conv_item->src_address.data);
set_address(&new_key->addr2, conv_item->dst_address.type, conv_item->dst_address.len, conv_item->dst_address.data);
new_key->port1 = port1;
new_key->port2 = port2;
new_key->conv_id = conv_id;
g_hash_table_insert(ch->hashtable, new_key, GUINT_TO_POINTER(conversation_idx));
}
/* update the conversation struct */
conv_item->modified = TRUE;
if ( (!cmp_address(src, addr1)) && (!cmp_address(dst, addr2)) && (src_port==port1) && (dst_port==port2) ) {
conv_item->tx_frames += num_frames;
conv_item->tx_bytes += num_bytes;
} else {
conv_item->rx_frames += num_frames;
conv_item->rx_bytes += num_bytes;
}
if (ts) {
if (nstime_cmp(ts, &conv_item->stop_time) > 0) {
memcpy(&conv_item->stop_time, ts, sizeof(conv_item->stop_time));
} else if (nstime_cmp(ts, &conv_item->start_time) < 0) {
memcpy(&conv_item->start_time, ts, sizeof(conv_item->start_time));
memcpy(&conv_item->start_abs_time, abs_ts, sizeof(conv_item->start_abs_time));
}
}
}
/*
* Compute the hash value for a given address/port pairs if the match
* is to be exact.
*/
static guint
host_hash(gconstpointer v)
{
const host_key_t *key = (const host_key_t *)v;
guint hash_val;
hash_val = 0;
add_address_to_hash(hash_val, &key->myaddress);
hash_val += key->port;
return hash_val;
}
/*
* Compare two host keys for an exact match.
*/
static gint
host_match(gconstpointer v, gconstpointer w)
{
const host_key_t *v1 = (const host_key_t *)v;
const host_key_t *v2 = (const host_key_t *)w;
if (v1->port == v2->port &&
addresses_equal(&v1->myaddress, &v2->myaddress)) {
return 1;
}
/*
* The addresses or the ports don't match.
*/
return 0;
}
void
add_hostlist_table_data(conv_hash_t *ch, const address *addr, guint32 port, gboolean sender, int num_frames, int num_bytes, hostlist_dissector_info_t *host_info, port_type port_type_val)
{
hostlist_talker_t *talker=NULL;
int talker_idx=0;
/* XXX should be optimized to allocate n extra entries at a time
instead of just one */
/* if we don't have any entries at all yet */
if(ch->conv_array==NULL){
ch->conv_array=g_array_sized_new(FALSE, FALSE, sizeof(hostlist_talker_t), 10000);
ch->hashtable = g_hash_table_new_full(host_hash,
host_match, /* key_equal_func */
g_free, /* key_destroy_func */
NULL); /* value_destroy_func */
}
else {
/* try to find it among the existing known conversations */
host_key_t existing_key;
gpointer talker_idx_hash_val;
existing_key.myaddress = *addr;
existing_key.port = port;
if (g_hash_table_lookup_extended(ch->hashtable, &existing_key, NULL, &talker_idx_hash_val)) {
talker = &g_array_index(ch->conv_array, hostlist_talker_t, GPOINTER_TO_UINT(talker_idx_hash_val));
}
}
/* if we still don't know what talker this is it has to be a new one
and we have to allocate it and append it to the end of the list */
if(talker==NULL){
host_key_t *new_key;
hostlist_talker_t host;
copy_address(&host.myaddress, addr);
host.dissector_info = host_info;
host.ptype=port_type_val;
host.port=port;
host.rx_frames=0;
host.tx_frames=0;
host.rx_bytes=0;
host.tx_bytes=0;
host.modified = TRUE;
g_array_append_val(ch->conv_array, host);
talker_idx= ch->conv_array->len - 1;
talker=&g_array_index(ch->conv_array, hostlist_talker_t, talker_idx);
/* hl->hosts address is not a constant but address.data is */
new_key = g_new(host_key_t,1);
set_address(&new_key->myaddress, talker->myaddress.type, talker->myaddress.len, talker->myaddress.data);
new_key->port = port;
g_hash_table_insert(ch->hashtable, new_key, GUINT_TO_POINTER(talker_idx));
}
/* if this is a new talker we need to initialize the struct */
talker->modified = TRUE;
/* update the talker struct */
if( sender ){
talker->tx_frames+=num_frames;
talker->tx_bytes+=num_bytes;
} else {
talker->rx_frames+=num_frames;
talker->rx_bytes+=num_bytes;
}
}
/*
* Editor modelines
*
* Local Variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
| VladimirTyrin/wireshark | epan/conversation_table.c | C | gpl-2.0 | 28,154 | [
30522,
1013,
1008,
11450,
1035,
2795,
1012,
1039,
1008,
11450,
1035,
2795,
2494,
11688,
7842,
7317,
4059,
1008,
2393,
2121,
23964,
2691,
2000,
2035,
2203,
8400,
11450,
11112,
1012,
1008,
1008,
14666,
8167,
2243,
1011,
2897,
4026,
17908,
209... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require "spec_helper"
describe ProjectWiki, models: true do
let(:project) { create(:empty_project) }
let(:repository) { project.repository }
let(:user) { project.owner }
let(:gitlab_shell) { Gitlab::Shell.new }
let(:project_wiki) { ProjectWiki.new(project, user) }
subject { project_wiki }
before { project_wiki.wiki }
describe "#path_with_namespace" do
it "returns the project path with namespace with the .wiki extension" do
expect(subject.path_with_namespace).to eq(project.path_with_namespace + ".wiki")
end
end
describe '#web_url' do
it 'returns the full web URL to the wiki' do
expect(subject.web_url).to eq("#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/wikis/home")
end
end
describe "#url_to_repo" do
it "returns the correct ssh url to the repo" do
expect(subject.url_to_repo).to eq(gitlab_shell.url_to_repo(subject.path_with_namespace))
end
end
describe "#ssh_url_to_repo" do
it "equals #url_to_repo" do
expect(subject.ssh_url_to_repo).to eq(subject.url_to_repo)
end
end
describe "#http_url_to_repo" do
it "provides the full http url to the repo" do
gitlab_url = Gitlab.config.gitlab.url
repo_http_url = "#{gitlab_url}/#{subject.path_with_namespace}.git"
expect(subject.http_url_to_repo).to eq(repo_http_url)
end
end
describe "#wiki_base_path" do
it "returns the wiki base path" do
wiki_base_path = "#{Gitlab.config.gitlab.relative_url_root}/#{project.path_with_namespace}/wikis"
expect(subject.wiki_base_path).to eq(wiki_base_path)
end
end
describe "#wiki" do
it "contains a Gollum::Wiki instance" do
expect(subject.wiki).to be_a Gollum::Wiki
end
it "creates a new wiki repo if one does not yet exist" do
expect(project_wiki.create_page("index", "test content")).to be_truthy
end
it "raises CouldNotCreateWikiError if it can't create the wiki repository" do
allow(project_wiki).to receive(:init_repo).and_return(false)
expect { project_wiki.send(:create_repo!) }.to raise_exception(ProjectWiki::CouldNotCreateWikiError)
end
end
describe "#empty?" do
context "when the wiki repository is empty" do
before do
allow_any_instance_of(Gitlab::Shell).to receive(:add_repository) do
create_temp_repo("#{Rails.root}/tmp/test-git-base-path/non-existant.wiki.git")
end
allow(project).to receive(:path_with_namespace).and_return("non-existant")
end
describe '#empty?' do
subject { super().empty? }
it { is_expected.to be_truthy }
end
end
context "when the wiki has pages" do
before do
project_wiki.create_page("index", "This is an awesome new Gollum Wiki")
end
describe '#empty?' do
subject { super().empty? }
it { is_expected.to be_falsey }
end
end
end
describe "#pages" do
before do
create_page("index", "This is an awesome new Gollum Wiki")
@pages = subject.pages
end
after do
destroy_page(@pages.first.page)
end
it "returns an array of WikiPage instances" do
expect(@pages.first).to be_a WikiPage
end
it "returns the correct number of pages" do
expect(@pages.count).to eq(1)
end
end
describe "#find_page" do
before do
create_page("index page", "This is an awesome Gollum Wiki")
end
after do
destroy_page(subject.pages.first.page)
end
it "returns the latest version of the page if it exists" do
page = subject.find_page("index page")
expect(page.title).to eq("index page")
end
it "returns nil if the page does not exist" do
expect(subject.find_page("non-existant")).to eq(nil)
end
it "can find a page by slug" do
page = subject.find_page("index-page")
expect(page.title).to eq("index page")
end
it "returns a WikiPage instance" do
page = subject.find_page("index page")
expect(page).to be_a WikiPage
end
end
describe '#find_file' do
before do
file = Gollum::File.new(subject.wiki)
allow_any_instance_of(Gollum::Wiki).
to receive(:file).with('image.jpg', 'master', true).
and_return(file)
allow_any_instance_of(Gollum::File).
to receive(:mime_type).
and_return('image/jpeg')
allow_any_instance_of(Gollum::Wiki).
to receive(:file).with('non-existant', 'master', true).
and_return(nil)
end
after do
allow_any_instance_of(Gollum::Wiki).to receive(:file).and_call_original
allow_any_instance_of(Gollum::File).to receive(:mime_type).and_call_original
end
it 'returns the latest version of the file if it exists' do
file = subject.find_file('image.jpg')
expect(file.mime_type).to eq('image/jpeg')
end
it 'returns nil if the page does not exist' do
expect(subject.find_file('non-existant')).to eq(nil)
end
it 'returns a Gollum::File instance' do
file = subject.find_file('image.jpg')
expect(file).to be_a Gollum::File
end
end
describe "#create_page" do
after do
destroy_page(subject.pages.first.page)
end
it "creates a new wiki page" do
expect(subject.create_page("test page", "this is content")).not_to eq(false)
expect(subject.pages.count).to eq(1)
end
it "returns false when a duplicate page exists" do
subject.create_page("test page", "content")
expect(subject.create_page("test page", "content")).to eq(false)
end
it "stores an error message when a duplicate page exists" do
2.times { subject.create_page("test page", "content") }
expect(subject.error_message).to match(/Duplicate page:/)
end
it "sets the correct commit message" do
subject.create_page("test page", "some content", :markdown, "commit message")
expect(subject.pages.first.page.version.message).to eq("commit message")
end
it 'updates project activity' do
expect(subject).to receive(:update_project_activity)
subject.create_page('Test Page', 'This is content')
end
end
describe "#update_page" do
before do
create_page("update-page", "some content")
@gollum_page = subject.wiki.paged("update-page")
subject.update_page(@gollum_page, "some other content", :markdown, "updated page")
@page = subject.pages.first.page
end
after do
destroy_page(@page)
end
it "updates the content of the page" do
expect(@page.raw_data).to eq("some other content")
end
it "sets the correct commit message" do
expect(@page.version.message).to eq("updated page")
end
it 'updates project activity' do
expect(subject).to receive(:update_project_activity)
subject.update_page(@gollum_page, 'Yet more content', :markdown, 'Updated page again')
end
end
describe "#delete_page" do
before do
create_page("index", "some content")
@page = subject.wiki.paged("index")
end
it "deletes the page" do
subject.delete_page(@page)
expect(subject.pages.count).to eq(0)
end
it 'updates project activity' do
expect(subject).to receive(:update_project_activity)
subject.delete_page(@page)
end
end
describe '#create_repo!' do
it 'creates a repository' do
expect(subject).to receive(:init_repo).
with(subject.path_with_namespace).
and_return(true)
expect(subject.repository).to receive(:after_create)
expect(subject.create_repo!).to be_an_instance_of(Gollum::Wiki)
end
end
describe '#hook_attrs' do
it 'returns a hash with values' do
expect(subject.hook_attrs).to be_a Hash
expect(subject.hook_attrs.keys).to contain_exactly(:web_url, :git_ssh_url, :git_http_url, :path_with_namespace, :default_branch)
end
end
private
def create_temp_repo(path)
FileUtils.mkdir_p path
system(*%W(#{Gitlab.config.git.bin_path} init --quiet --bare -- #{path}))
end
def remove_temp_repo(path)
FileUtils.rm_rf path
end
def commit_details
{ name: user.name, email: user.email, message: "test commit" }
end
def create_page(name, content)
subject.wiki.write_page(name, :markdown, content, commit_details)
end
def destroy_page(page)
subject.wiki.delete_page(page, commit_details)
end
end
| mr-dxdy/gitlabhq | spec/models/project_wiki_spec.rb | Ruby | mit | 8,476 | [
30522,
5478,
1000,
28699,
1035,
2393,
2121,
1000,
6235,
2622,
9148,
3211,
1010,
4275,
1024,
2995,
2079,
2292,
1006,
1024,
2622,
1007,
1063,
3443,
1006,
1024,
4064,
1035,
2622,
1007,
1065,
2292,
1006,
1024,
22409,
1007,
1063,
2622,
1012,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
My blog, thanks for [TaylanTatli/Moon](https://github.com/TaylanTatli/Moon)
<!--
# Moon Jekyll Theme [](https://www.paypal.me/taylantatli/0usd)
## `Sorry guys but there will be no update until I buy a new laptop.`
######(If you like this theme or using it, please give a :star: for motivation.)
**[Moon](https://taylantatli.github.io/Moon)** is a minimal, one column jekyll theme.
## Features
* Minimal, you can focus on your content
* Responsive
* Disqus integration
* Syntax highlighting
* Optional post image
* Social icons
* Page for sharing projects
* Optional background image
* Simple navigation menu
* MathJax support
## Preview


See a [live version of Moon](https://taylantatli.github.io/Moon) hosted on GitHub.
## Getting Started
To learn how to install and use this theme check out the [Setup Guide](https://taylantatli.github.io/Moon/moon-theme/) for more information.
-->
| elevenching/elevenching.github.io | README.md | Markdown | mit | 1,213 | [
30522,
2026,
9927,
1010,
4283,
2005,
1031,
28117,
5802,
29336,
3669,
1013,
4231,
1033,
1006,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28117,
5802,
29336,
3669,
1013,
4231,
1007,
1026,
999,
1011,
1011,
1001,
4231,
15333... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
\file "Object/inst/channel_collection_type_manager.hh"
Template class for instance_collection's type manager.
$Id: channel_collection_type_manager.hh,v 1.3 2007/04/15 05:52:17 fang Exp $
*/
#ifndef __HAC_OBJECT_INST_CHANNEL_COLLECTION_TYPE_MANAGER_H__
#define __HAC_OBJECT_INST_CHANNEL_COLLECTION_TYPE_MANAGER_H__
#include <iosfwd>
#include "Object/type/canonical_type_fwd.hh" // for conditional
#include "util/persistent_fwd.hh"
#include "util/boolean_types.hh"
#include "util/memory/pointer_classes_fwd.hh"
#include "Object/devel_switches.hh"
namespace HAC {
namespace entity {
class const_param_expr_list;
using std::istream;
using std::ostream;
using util::good_bool;
using util::bad_bool;
using util::persistent_object_manager;
using util::memory::count_ptr;
class footprint;
template <class> struct class_traits;
//=============================================================================
/**
Generic instance collection type manager for classes with
full type references as type information.
Not appropriate for built-in types.
*/
template <class Tag>
class channel_collection_type_manager {
private:
typedef channel_collection_type_manager<Tag> this_type;
typedef class_traits<Tag> traits_type;
protected:
typedef typename traits_type::instance_collection_generic_type
instance_collection_generic_type;
typedef typename traits_type::instance_collection_parameter_type
instance_collection_parameter_type;
typedef typename traits_type::type_ref_ptr_type
type_ref_ptr_type;
typedef typename traits_type::resolved_type_ref_type
resolved_type_ref_type;
/**
The type parameter is ONLY a definition.
*/
instance_collection_parameter_type type_parameter;
struct dumper;
void
collect_transient_info_base(persistent_object_manager&) const;
void
write_object_base(const persistent_object_manager&, ostream&) const;
void
load_object_base(const persistent_object_manager&, istream&);
public:
const instance_collection_parameter_type&
__get_raw_type(void) const { return this->type_parameter; }
resolved_type_ref_type
get_resolved_canonical_type(void) const;
/**
No-op, channels don't have process footprints.
*/
good_bool
complete_type_definition_footprint(
const count_ptr<const const_param_expr_list>&) const {
return good_bool(true);
}
bool
is_complete_type(void) const { return this->type_parameter; }
bool
is_relaxed_type(void) const { return false; }
/// built-in channels don't have process footprints
static
good_bool
create_definition_footprint(
const instance_collection_parameter_type&,
const footprint& /* top */) {
return good_bool(true);
}
protected:
/**
NOTE: called during connection checking.
*/
bool
must_be_collectibly_type_equivalent(const this_type&) const;
bad_bool
check_type(const instance_collection_parameter_type&) const;
/**
\param t type must be resolved constant.
\pre first time called for the collection.
*/
good_bool
commit_type_first_time(const instance_collection_parameter_type& t);
}; // end struct channel_collection_type_manager
//=============================================================================
} // end namespace entity
} // end namespace HAC
#endif // __HAC_OBJECT_INST_CHANNEL_COLLECTION_TYPE_MANAGER_H__
| fangism/hackt | src/Object/inst/channel_collection_type_manager.hh | C++ | gpl-2.0 | 3,301 | [
30522,
1013,
1008,
1008,
1032,
5371,
1000,
4874,
1013,
16021,
2102,
1013,
3149,
1035,
3074,
1035,
2828,
1035,
3208,
1012,
1044,
2232,
1000,
23561,
2465,
2005,
6013,
1035,
3074,
1005,
1055,
2828,
3208,
1012,
1002,
8909,
1024,
3149,
1035,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.as.test.integration.management.cli;
import java.io.File;
import java.net.URL;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.jboss.as.test.shared.TestSuiteEnvironment;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import org.junit.Test;
import org.w3c.dom.Document;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/**
*
* @author Dominik Pospisil <dpospisi@redhat.com>
*/
public class JBossCliXmlValidationTestCase {
@Test
public void validateJBossCliXmlTestCase() throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder parser = factory.newDocumentBuilder();
final String jbossDist = TestSuiteEnvironment.getSystemProperty("jboss.dist");
Document document = parser.parse(new File(jbossDist, "bin/jboss-cli.xml"));
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
schemaFactory.setErrorHandler(new ErrorHandlerImpl());
//schemaFactory.setResourceResolver(new XMLResourceResolver());
Schema schema = schemaFactory.newSchema(resourceToURL("schema/wildfly-cli_3_4.xsd"));
Validator validator = schema.newValidator();
validator.validate(new DOMSource(document));
}
protected static final class ErrorHandlerImpl implements ErrorHandler {
@Override
public void error(SAXParseException e) throws SAXException {
fail(formatMessage(e));
}
@Override
public void fatalError(SAXParseException e) throws SAXException {
fail(formatMessage(e));
}
@Override
public void warning(SAXParseException e) throws SAXException {
System.out.println(formatMessage(e));
}
private String formatMessage(SAXParseException e) {
StringBuffer sb = new StringBuffer();
sb.append(e.getLineNumber()).append(':').append(e.getColumnNumber());
if (e.getPublicId() != null)
sb.append(" publicId='").append(e.getPublicId()).append('\'');
if (e.getSystemId() != null)
sb.append(" systemId='").append(e.getSystemId()).append('\'');
sb.append(' ').append(e.getLocalizedMessage());
sb.append(" a possible cause may be that a subsystem is not using the most up to date schema.");
return sb.toString();
}
}
private URL resourceToURL(final String name) {
final ClassLoader classLoader = getClass().getClassLoader();
final URL resource = classLoader.getResource(name);
assertNotNull("Can't locate resource " + name + " on " + classLoader, resource);
return resource;
}
}
| aloubyansky/wildfly-core | testsuite/standalone/src/test/java/org/jboss/as/test/integration/management/cli/JBossCliXmlValidationTestCase.java | Java | lgpl-2.1 | 4,132 | [
30522,
1013,
1008,
1008,
1046,
15853,
2015,
1010,
2188,
1997,
2658,
2330,
3120,
1012,
1008,
9385,
2297,
1010,
2417,
6045,
1010,
4297,
1012,
1010,
1998,
3265,
16884,
1008,
2004,
5393,
2011,
1996,
1030,
3166,
22073,
1012,
2156,
1996,
9385,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace mattatz.ProceduralFlower {
public class PFShapeWindow : EditorWindow {
enum Mode {
None,
Select
};
Texture grid;
Texture knob;
static Vector2 size = new Vector2(512f, 512f);
const float unit = 16f;
Mode mode = Mode.None;
int selected = -1;
List<Vector2> points;
PFShape shape;
const string PACKAGE_PATH = "Assets/Packages/ProceduralFlower/";
[MenuItem("ProceduralFlower/Window")]
public static void Open () {
var window = GetWindow<PFShapeWindow>(typeof(SceneView));
var icon = AssetDatabase.LoadAssetAtPath<Texture>(PACKAGE_PATH + "Textures/PFShapeWindow.png");
window.titleContent = new GUIContent("PF", icon);
window.Focus();
}
void Update () {
Repaint();
}
void CheckInit () {
var obj = Selection.activeObject;
if(obj && obj as PFShape) {
var current = obj as PFShape;
if(current != shape) {
Load(current);
}
shape = current;
}
if(grid == null) {
grid = AssetDatabase.LoadAssetAtPath<Texture>(PACKAGE_PATH + "Textures/Grid.jpg");
}
if(knob == null) {
knob = AssetDatabase.LoadAssetAtPath<Texture>(PACKAGE_PATH + "Textures/Knob.png");
}
if(points == null) {
points = new List<Vector2>();
}
}
Vector2 Translate (Vector2 p) {
return new Vector2(p.x + size.x * 0.5f, p.y);
}
void Load (PFShape shp) {
var controls = shp.controls;
points = controls.Select(c => Convert(c)).ToList();
}
void Apply () {
shape.controls = GetControls(points);
}
void DrawHeader() {
var style = new GUIStyle();
style.fontSize = 15;
if(shape) {
GUI.Label(new Rect(5f, 5f, 80f, 25f), shape.name + ".asset", style);
} else {
GUI.Label(new Rect(5f, 5f, 80f, 25f), "Select Shape asset", style);
}
if(shape && GUI.Button(new Rect(5f, 30f, 80f, 25f), "Apply")) {
Apply();
}
if(GUI.Button(new Rect(5f, 60f, 80f, 25f), "Clear All")) {
points.Clear();
}
}
void DrawShape (List<Vector3> mirror, int count, int resolution = 5) {
// left side
var points = new List<Vector3>();
for(int i = 0; i <= count; i++) {
var edge = PFCatmullRomSpline.GetCatmullRomPositions(
resolution,
PFShape.GetLoopPoint(mirror, i - 1),
PFShape.GetLoopPoint(mirror, i),
PFShape.GetLoopPoint(mirror, i + 1),
PFShape.GetLoopPoint(mirror, i + 2)
);
if(i != 0) edge.RemoveAt(0);
points.AddRange(edge);
}
for(int i = 0, n = points.Count - 1; i < n; i++) {
var from = points[i];
var to = points[i + 1];
Handles.DrawLine(Translate(from), Translate(to));
}
for(int i = 0, n = points.Count - 1; i < n; i++) {
var from = points[i];
var to = points[i + 1];
Handles.DrawLine(Translate(new Vector2(-from.x, from.y)), Translate(new Vector2(-to.x, to.y)));
}
}
Vector2 Convert (PFControlPoint c) {
return new Vector2(0.5f - c.width, c.height);
}
PFControlPoint Convert (Vector2 p) {
return new PFControlPoint(0.5f - p.x, p.y);
}
List<PFControlPoint> GetControls (List<Vector2> points) {
return points.Select(p => {
return Convert(p);
}).ToList();
}
int Pick (Vector2 position) {
float distance = unit / size.x;
return points.FindIndex(p => {
return Vector2.Distance(p, position) <= distance;
});
}
bool Contains (Vector2 position) {
return 0.05f < position.x && position.x < 0.5f && 0.05f < position.y && position.y < 0.95f;
}
void Sort () {
points.Sort((p0, p1) => {
return p0.y.CompareTo(p1.y);
});
}
void CatchEvent () {
var mp = Event.current.mousePosition;
var position = new Vector2(mp.x / size.x, mp.y / size.y);
switch(mode) {
case Mode.None:
switch(Event.current.type) {
case EventType.mouseDown:
selected = Pick(position);
if(selected >= 0) {
mode = Mode.Select;
}
break;
case EventType.mouseUp:
if(Contains(position)) {
points.Add(position);
Sort();
}
break;
case EventType.keyUp:
if(selected >= 0 && Input.GetKeyUp(KeyCode.Delete)) {
points.RemoveAt(selected);
}
break;
}
break;
case Mode.Select:
switch(Event.current.type) {
case EventType.mouseDrag:
if(selected >= 0 && Contains(position)) {
points[selected] = position;
}
break;
case EventType.mouseUp:
Sort();
mode = Mode.None;
break;
}
break;
}
}
void OnGUI () {
CheckInit();
size.x = size.y = Mathf.Min(Screen.width, Screen.height);
GUI.DrawTexture(new Rect(0f, 0f, size.x, size.y), grid);
DrawHeader();
CatchEvent();
for(int i = 0, n = points.Count; i < n; i++) {
if(i == selected) {
GUI.color = new Color(0.6f, 0.75f, 1f);
} else {
GUI.color = Color.white;
}
var p = points[i];
GUI.DrawTexture(new Rect(Vector2.Scale(p, size) - new Vector2(unit, unit) * 0.5f, new Vector2(unit, unit)), knob);
}
GUI.color = Color.white;
// GUI.Box(new Rect(new Vector2((size.x - unit) * 0.5f, 0f), new Vector2(unit, unit)), "top");
// GUI.Box(new Rect(new Vector2((size.x - unit) * 0.5f, size.y - unit), new Vector2(unit, unit)), "bottom");
if(points.Count >= 2) {
var mirror = PFShape.Mirror(GetControls(points), size.x, size.y);
Handles.color = Color.black;
DrawShape(mirror, points.Count);
}
}
}
}
| mattatz/unity-procedural-flower | Assets/Packages/ProceduralFlower/Scripts/Editor/PFShapeWindow.cs | C# | mit | 5,546 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
6407,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
8499,
13159,
3170,
1025,
2478,
8499,
2098,
15660,
1025,
3415,
15327,
4717,
20501,
1012,
24508,
1415... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../../../../favicon.ico" />
<title>BitmapDescriptor | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="http://fonts.googleapis.com/css?family=Roboto+Condensed">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold"
title="roboto">
<link href="../../../../../../../assets/css/default.css?v=5" rel="stylesheet" type="text/css">
<!-- FULLSCREEN STYLESHEET -->
<link href="../../../../../../../assets/css/fullscreen.css" rel="stylesheet" class="fullscreen"
type="text/css">
<!-- JAVASCRIPT -->
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script src="../../../../../../../assets/js/android_3p-bundle.js" type="text/javascript"></script>
<script type="text/javascript">
var toRoot = "../../../../../../../";
var metaTags = [];
var devsite = false;
</script>
<script src="../../../../../../../assets/js/docs.js?v=3" type="text/javascript"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-5831155-1', 'android.com');
ga('create', 'UA-49880327-2', 'android.com', {'name': 'universal'}); // New tracker);
ga('send', 'pageview');
ga('universal.send', 'pageview'); // Send page view for new tracker.
</script>
</head>
<body class="gc-documentation
develop reference" itemscope itemtype="http://schema.org/Article">
<div id="doc-api-level" class="" style="display:none"></div>
<a name="top"></a>
<a name="top"></a>
<!-- dialog to prompt lang pref change when loaded from hardcoded URL
<div id="langMessage" style="display:none">
<div>
<div class="lang en">
<p>You requested a page in English, would you like to proceed with this language setting?</p>
</div>
<div class="lang es">
<p>You requested a page in Spanish (Español), would you like to proceed with this language setting?</p>
</div>
<div class="lang ja">
<p>You requested a page in Japanese (日本語), would you like to proceed with this language setting?</p>
</div>
<div class="lang ko">
<p>You requested a page in Korean (한국어), would you like to proceed with this language setting?</p>
</div>
<div class="lang ru">
<p>You requested a page in Russian (Русский), would you like to proceed with this language setting?</p>
</div>
<div class="lang zh-cn">
<p>You requested a page in Simplified Chinese (简体中文), would you like to proceed with this language setting?</p>
</div>
<div class="lang zh-tw">
<p>You requested a page in Traditional Chinese (繁體中文), would you like to proceed with this language setting?</p>
</div>
<a href="#" class="button yes" onclick="return false;">
<span class="lang en">Yes</span>
<span class="lang es">Sí</span>
<span class="lang ja">Yes</span>
<span class="lang ko">Yes</span>
<span class="lang ru">Yes</span>
<span class="lang zh-cn">是的</span>
<span class="lang zh-tw">没有</span>
</a>
<a href="#" class="button" onclick="$('#langMessage').hide();return false;">
<span class="lang en">No</span>
<span class="lang es">No</span>
<span class="lang ja">No</span>
<span class="lang ko">No</span>
<span class="lang ru">No</span>
<span class="lang zh-cn">没有</span>
<span class="lang zh-tw">没有</span>
</a>
</div>
</div> -->
<!-- Header -->
<div id="header-wrapper">
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo">
<a href="../../../../../../../index.html">
<img src="../../../../../../../assets/images/dac_logo.png"
srcset="../../../../../../../assets/images/dac_logo@2x.png 2x"
width="123" height="25" alt="Android Developers" />
</a>
<div class="btn-quicknav" id="btn-quicknav">
<a href="#" class="arrow-inactive">Quicknav</a>
<a href="#" class="arrow-active">Quicknav</a>
</div>
</div>
<ul class="nav-x col-9">
<li class="design">
<a href="../../../../../../../design/index.html"
zh-tw-lang="設計"
zh-cn-lang="设计"
ru-lang="Проектирование"
ko-lang="디자인"
ja-lang="設計"
es-lang="Diseñar"
>Design</a></li>
<li class="develop"><a href="../../../../../../../develop/index.html"
zh-tw-lang="開發"
zh-cn-lang="开发"
ru-lang="Разработка"
ko-lang="개발"
ja-lang="開発"
es-lang="Desarrollar"
>Develop</a></li>
<li class="distribute last"><a href="../../../../../../../distribute/googleplay/index.html"
zh-tw-lang="發佈"
zh-cn-lang="分发"
ru-lang="Распространение"
ko-lang="배포"
ja-lang="配布"
es-lang="Distribuir"
>Distribute</a></li>
</ul>
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/" target="_googleplay">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="../../../../../../../about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<br class="clearfix" />
</div><!-- end 'mid' -->
<div class="bottom"></div>
</div><!-- end 'moremenu' -->
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '../../../../../../../')"
onkeyup="return search_changed(event, false, '../../../../../../../')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div><!-- end search-inner -->
</div><!-- end search-container -->
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display"> </div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
<div class="child-card samples no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
</div><!-- end menu-container (search and menu widget) -->
<!-- Expanded quicknav -->
<div id="quicknav" class="col-13">
<ul>
<li class="about">
<ul>
<li><a href="../../../../../../../about/index.html">About</a></li>
<li><a href="../../../../../../../wear/index.html">Wear</a></li>
<li><a href="../../../../../../../tv/index.html">TV</a></li>
<li><a href="../../../../../../../auto/index.html">Auto</a></li>
</ul>
</li>
<li class="design">
<ul>
<li><a href="../../../../../../../design/index.html">Get Started</a></li>
<li><a href="../../../../../../../design/devices.html">Devices</a></li>
<li><a href="../../../../../../../design/style/index.html">Style</a></li>
<li><a href="../../../../../../../design/patterns/index.html">Patterns</a></li>
<li><a href="../../../../../../../design/building-blocks/index.html">Building Blocks</a></li>
<li><a href="../../../../../../../design/downloads/index.html">Downloads</a></li>
<li><a href="../../../../../../../design/videos/index.html">Videos</a></li>
</ul>
</li>
<li class="develop">
<ul>
<li><a href="../../../../../../../training/index.html"
zh-tw-lang="訓練課程"
zh-cn-lang="培训"
ru-lang="Курсы"
ko-lang="교육"
ja-lang="トレーニング"
es-lang="Capacitación"
>Training</a></li>
<li><a href="../../../../../../../guide/index.html"
zh-tw-lang="API 指南"
zh-cn-lang="API 指南"
ru-lang="Руководства по API"
ko-lang="API 가이드"
ja-lang="API ガイド"
es-lang="Guías de la API"
>API Guides</a></li>
<li><a href="../../../../../../../reference/packages.html"
zh-tw-lang="參考資源"
zh-cn-lang="参考"
ru-lang="Справочник"
ko-lang="참조문서"
ja-lang="リファレンス"
es-lang="Referencia"
>Reference</a></li>
<li><a href="../../../../../../../sdk/index.html"
zh-tw-lang="相關工具"
zh-cn-lang="工具"
ru-lang="Инструменты"
ko-lang="도구"
ja-lang="ツール"
es-lang="Herramientas"
>Tools</a>
</li>
<li><a href="../../../../../../../google/index.html">Google Services</a>
</li>
</ul>
</li>
<li class="distribute last">
<ul>
<li><a href="../../../../../../../distribute/googleplay/index.html">Google Play</a></li>
<li><a href="../../../../../../../distribute/essentials/index.html">Essentials</a></li>
<li><a href="../../../../../../../distribute/users/index.html">Get Users</a></li>
<li><a href="../../../../../../../distribute/engage/index.html">Engage & Retain</a></li>
<li><a href="../../../../../../../distribute/monetize/index.html">Monetize</a></li>
<li><a href="../../../../../../../distribute/analyze/index.html">Analyze</a></li>
<li><a href="../../../../../../../distribute/tools/index.html">Tools & Reference</a></li>
<li><a href="../../../../../../../distribute/stories/index.html">Developer Stories</a></li>
</ul>
</li>
</ul>
</div><!-- /Expanded quicknav -->
</div><!-- end header-wrap.wrap -->
</div><!-- end header -->
<!-- Secondary x-nav -->
<div id="nav-x">
<div class="wrap" style="position:relative;z-index:1">
<ul class="nav-x col-9 develop" style="width:100%">
<li class="training"><a href="../../../../../../../training/index.html"
zh-tw-lang="訓練課程"
zh-cn-lang="培训"
ru-lang="Курсы"
ko-lang="교육"
ja-lang="トレーニング"
es-lang="Capacitación"
>Training</a></li>
<li class="guide"><a href="../../../../../../../guide/index.html"
zh-tw-lang="API 指南"
zh-cn-lang="API 指南"
ru-lang="Руководства по API"
ko-lang="API 가이드"
ja-lang="API ガイド"
es-lang="Guías de la API"
>API Guides</a></li>
<li class="reference"><a href="../../../../../../../reference/packages.html"
zh-tw-lang="參考資源"
zh-cn-lang="参考"
ru-lang="Справочник"
ko-lang="참조문서"
ja-lang="リファレンス"
es-lang="Referencia"
>Reference</a></li>
<li class="tools"><a href="../../../../../../../sdk/index.html"
zh-tw-lang="相關工具"
zh-cn-lang="工具"
ru-lang="Инструменты"
ko-lang="도구"
ja-lang="ツール"
es-lang="Herramientas"
>Tools</a></li>
<li class="google"><a href="../../../../../../../google/index.html"
>Google Services</a>
</li>
</ul>
</div>
</div>
<!-- /Sendondary x-nav DEVELOP -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
</div> <!--end header-wrapper -->
<div id="sticky-header">
<div>
<a class="logo" href="#top"></a>
<a class="top" href="#top"></a>
<ul class="breadcrumb">
<li class="current">BitmapDescriptor</li>
</ul>
</div>
</div>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav">
<div id="api-nav-header">
<div id="api-level-toggle">
<label for="apiLevelCheckbox" class="disabled"
title="Select your target API level to dim unavailable APIs">API level: </label>
<div class="select-wrapper">
<select id="apiLevelSelector">
<!-- option elements added by buildApiLevelSelector() -->
</select>
</div>
</div><!-- end toggle -->
<div id="api-nav-title">Android APIs</div>
</div><!-- end nav header -->
<script>
var SINCE_DATA = [ ];
buildApiLevelSelector();
</script>
<div id="swapper">
<div id="nav-panels">
<div id="resize-packages-nav">
<div id="packages-nav" class="scroll-pane">
<ul>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/package-summary.html">com.google.android.gms</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/actions/package-summary.html">com.google.android.gms.actions</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/package-summary.html">com.google.android.gms.ads</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/doubleclick/package-summary.html">com.google.android.gms.ads.doubleclick</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/identifier/package-summary.html">com.google.android.gms.ads.identifier</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/mediation/package-summary.html">com.google.android.gms.ads.mediation</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/mediation/admob/package-summary.html">com.google.android.gms.ads.mediation.admob</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/mediation/customevent/package-summary.html">com.google.android.gms.ads.mediation.customevent</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/purchase/package-summary.html">com.google.android.gms.ads.purchase</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/ads/search/package-summary.html">com.google.android.gms.ads.search</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/analytics/package-summary.html">com.google.android.gms.analytics</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/analytics/ecommerce/package-summary.html">com.google.android.gms.analytics.ecommerce</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/appindexing/package-summary.html">com.google.android.gms.appindexing</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/appstate/package-summary.html">com.google.android.gms.appstate</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/auth/package-summary.html">com.google.android.gms.auth</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/cast/package-summary.html">com.google.android.gms.cast</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/common/package-summary.html">com.google.android.gms.common</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/common/annotation/package-summary.html">com.google.android.gms.common.annotation</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/common/api/package-summary.html">com.google.android.gms.common.api</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/common/data/package-summary.html">com.google.android.gms.common.data</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/common/images/package-summary.html">com.google.android.gms.common.images</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/drive/package-summary.html">com.google.android.gms.drive</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/drive/events/package-summary.html">com.google.android.gms.drive.events</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/drive/metadata/package-summary.html">com.google.android.gms.drive.metadata</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/drive/query/package-summary.html">com.google.android.gms.drive.query</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/drive/widget/package-summary.html">com.google.android.gms.drive.widget</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/fitness/package-summary.html">com.google.android.gms.fitness</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/fitness/data/package-summary.html">com.google.android.gms.fitness.data</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/fitness/request/package-summary.html">com.google.android.gms.fitness.request</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/fitness/result/package-summary.html">com.google.android.gms.fitness.result</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/fitness/service/package-summary.html">com.google.android.gms.fitness.service</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/package-summary.html">com.google.android.gms.games</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/achievement/package-summary.html">com.google.android.gms.games.achievement</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/event/package-summary.html">com.google.android.gms.games.event</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/leaderboard/package-summary.html">com.google.android.gms.games.leaderboard</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/multiplayer/package-summary.html">com.google.android.gms.games.multiplayer</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/multiplayer/realtime/package-summary.html">com.google.android.gms.games.multiplayer.realtime</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/multiplayer/turnbased/package-summary.html">com.google.android.gms.games.multiplayer.turnbased</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/quest/package-summary.html">com.google.android.gms.games.quest</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/request/package-summary.html">com.google.android.gms.games.request</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/games/snapshot/package-summary.html">com.google.android.gms.games.snapshot</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/gcm/package-summary.html">com.google.android.gms.gcm</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/identity/intents/package-summary.html">com.google.android.gms.identity.intents</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/identity/intents/model/package-summary.html">com.google.android.gms.identity.intents.model</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/location/package-summary.html">com.google.android.gms.location</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/location/places/package-summary.html">com.google.android.gms.location.places</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/location/places/ui/package-summary.html">com.google.android.gms.location.places.ui</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/maps/package-summary.html">com.google.android.gms.maps</a></li>
<li class="selected api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/maps/model/package-summary.html">com.google.android.gms.maps.model</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/nearby/package-summary.html">com.google.android.gms.nearby</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/nearby/connection/package-summary.html">com.google.android.gms.nearby.connection</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/panorama/package-summary.html">com.google.android.gms.panorama</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/plus/package-summary.html">com.google.android.gms.plus</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/plus/model/moments/package-summary.html">com.google.android.gms.plus.model.moments</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/plus/model/people/package-summary.html">com.google.android.gms.plus.model.people</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/safetynet/package-summary.html">com.google.android.gms.safetynet</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/security/package-summary.html">com.google.android.gms.security</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/tagmanager/package-summary.html">com.google.android.gms.tagmanager</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/wallet/package-summary.html">com.google.android.gms.wallet</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/wallet/fragment/package-summary.html">com.google.android.gms.wallet.fragment</a></li>
<li class="api apilevel-">
<a href="../../../../../../../reference/com/google/android/gms/wearable/package-summary.html">com.google.android.gms.wearable</a></li>
</ul><br/>
</div> <!-- end packages-nav -->
</div> <!-- end resize-packages -->
<div id="classes-nav" class="scroll-pane">
<ul>
<li><h2>Interfaces</h2>
<ul>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/TileProvider.html">TileProvider</a></li>
</ul>
</li>
<li><h2>Classes</h2>
<ul>
<li class="selected api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/BitmapDescriptor.html">BitmapDescriptor</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/BitmapDescriptorFactory.html">BitmapDescriptorFactory</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CameraPosition.html">CameraPosition</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CameraPosition.Builder.html">CameraPosition.Builder</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/Circle.html">Circle</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/CircleOptions.html">CircleOptions</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/GroundOverlay.html">GroundOverlay</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/GroundOverlayOptions.html">GroundOverlayOptions</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/IndoorBuilding.html">IndoorBuilding</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/IndoorLevel.html">IndoorLevel</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLng.html">LatLng</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLngBounds.html">LatLngBounds</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/LatLngBounds.Builder.html">LatLngBounds.Builder</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/Marker.html">Marker</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/MarkerOptions.html">MarkerOptions</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/Polygon.html">Polygon</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/PolygonOptions.html">PolygonOptions</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/Polyline.html">Polyline</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/PolylineOptions.html">PolylineOptions</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/StreetViewPanoramaCamera.html">StreetViewPanoramaCamera</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/StreetViewPanoramaCamera.Builder.html">StreetViewPanoramaCamera.Builder</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/StreetViewPanoramaLink.html">StreetViewPanoramaLink</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/StreetViewPanoramaLocation.html">StreetViewPanoramaLocation</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/StreetViewPanoramaOrientation.html">StreetViewPanoramaOrientation</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/StreetViewPanoramaOrientation.Builder.html">StreetViewPanoramaOrientation.Builder</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/Tile.html">Tile</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/TileOverlay.html">TileOverlay</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/TileOverlayOptions.html">TileOverlayOptions</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/UrlTileProvider.html">UrlTileProvider</a></li>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/VisibleRegion.html">VisibleRegion</a></li>
</ul>
</li>
<li><h2>Exceptions</h2>
<ul>
<li class="api apilevel-"><a href="../../../../../../../reference/com/google/android/gms/maps/model/RuntimeRemoteException.html">RuntimeRemoteException</a></li>
</ul>
</li>
</ul><br/>
</div><!-- end classes -->
</div><!-- end nav-panels -->
<div id="nav-tree" style="display:none" class="scroll-pane">
<div id="tree-list"></div>
</div><!-- end nav-tree -->
</div><!-- end swapper -->
<div id="nav-swap">
<a class="fullscreen">fullscreen</a>
<a href='#' onclick='swapNav();return false;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>
</div>
</div> <!-- end devdoc-nav -->
</div> <!-- end side-nav -->
<script type="text/javascript">
// init fullscreen based on user pref
var fullscreen = readCookie("fullscreen");
if (fullscreen != 0) {
if (fullscreen == "false") {
toggleFullscreen(false);
} else {
toggleFullscreen(true);
}
}
// init nav version for mobile
if (isMobile) {
swapNav(); // tree view should be used on mobile
$('#nav-swap').hide();
} else {
chooseDefaultNav();
if ($("#nav-tree").is(':visible')) {
init_default_navtree("../../../../../../../");
}
}
// scroll the selected page into view
$(document).ready(function() {
scrollIntoView("packages-nav");
scrollIntoView("classes-nav");
});
</script>
<div class="col-12" id="doc-col">
<div id="api-info-block">
<div class="sum-details-links">
Summary:
<a href="#inhmethods">Inherited Methods</a>
| <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a>
</div><!-- end sum-details-links -->
<div class="api-level">
</div>
</div><!-- end api-info-block -->
<!-- ======== START OF CLASS DATA ======== -->
<div id="jd-header">
public
final
class
<h1 itemprop="name">BitmapDescriptor</h1>
extends <a href="http://developer.android.com/reference/java/lang/Object.html">Object</a><br/>
</div><!-- end header -->
<div id="naMessage"></div>
<div id="jd-content" class="api apilevel-">
<table class="jd-inheritance-table">
<tr>
<td colspan="2" class="jd-inheritance-class-cell"><a href="http://developer.android.com/reference/java/lang/Object.html">java.lang.Object</a></td>
</tr>
<tr>
<td class="jd-inheritance-space"> ↳</td>
<td colspan="1" class="jd-inheritance-class-cell">com.google.android.gms.maps.model.BitmapDescriptor</td>
</tr>
</table>
<div class="jd-descr">
<h2>Class Overview</h2>
<p itemprop="articleBody">Defines an image. For a marker, it can be used to set the image of the marker icon. For a ground
overlay, it can be used to set the image to place on the surface of the earth. To obtain a
<code><a href="../../../../../../../reference/com/google/android/gms/maps/model/BitmapDescriptor.html">BitmapDescriptor</a></code> use the factory class <code><a href="../../../../../../../reference/com/google/android/gms/maps/model/BitmapDescriptorFactory.html">BitmapDescriptorFactory</a></code>.
<p>
Example of setting the icon of a marker
<code><a href="../../../../../../../reference/com/google/android/gms/maps/model/BitmapDescriptor.html">BitmapDescriptor</a></code>.
<pre> <code>GoogleMap map = ... // get a map.
// Add a marker at San Francisco with an azure colored marker.
Marker marker = map.add(new MarkerOptions()
.position(new LatLng(37.7750, 122.4183))
.title("San Francisco")
.snippet("Population: 776733"))
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE));</code></pre>
</p>
</div><!-- jd-descr -->
<div class="jd-descr">
<h2>Summary</h2>
<!-- ========== METHOD SUMMARY =========== -->
<table id="inhmethods" class="jd-sumtable"><tr><th>
<a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
<div style="clear:left;">Inherited Methods</div></th></tr>
<tr class="api apilevel-" >
<td colspan="12">
<a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed"
><img id="inherited-methods-java.lang.Object-trigger"
src="../../../../../../../assets/images/triangle-closed.png"
class="jd-expando-trigger-img" /></a>
From class
<a href="http://developer.android.com/reference/java/lang/Object.html">java.lang.Object</a>
<div id="inherited-methods-java.lang.Object">
<div id="inherited-methods-java.lang.Object-list"
class="jd-inheritedlinks">
</div>
<div id="inherited-methods-java.lang.Object-summary" style="display: none;">
<table class="jd-sumtable-expando">
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="http://developer.android.com/reference/java/lang/Object.html">Object</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">clone</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
boolean</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">equals</span>(<a href="http://developer.android.com/reference/java/lang/Object.html">Object</a> arg0)</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">finalize</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
final
<a href="http://developer.android.com/reference/java/lang/Class.html">Class</a><?></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">getClass</span>()</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
int</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">hashCode</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">notify</span>()</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">notifyAll</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
<a href="http://developer.android.com/reference/java/lang/String.html">String</a></nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">toString</span>()</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>()</nobr>
</td></tr>
<tr class=" api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>(long arg0, int arg1)</nobr>
</td></tr>
<tr class="alt-color api apilevel-" >
<td class="jd-typecol"><nobr>
final
void</nobr>
</td>
<td class="jd-linkcol" width="100%"><nobr>
<span class="sympad">wait</span>(long arg0)</nobr>
</td></tr>
</table>
</div>
</div>
</td></tr>
</table>
</div><!-- jd-descr (summary) -->
<!-- Details -->
<!-- XML Attributes -->
<!-- Enum Values -->
<!-- Constants -->
<!-- Fields -->
<!-- Public ctors -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<!-- Protected ctors -->
<!-- ========= METHOD DETAIL ======== -->
<!-- Public methdos -->
<!-- ========= METHOD DETAIL ======== -->
<!-- ========= END OF CLASS DATA ========= -->
<A NAME="navbar_top"></A>
<div id="footer" class="wrap" >
<div id="copyright">
Except as noted, this content is licensed under <a
href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>.
For details and restrictions, see the <a href="../../../../../../../license.html">
Content License</a>.
</div>
<div id="build_info">
Android GmsCore 1784785 r —
<script src="../../../../../../../timestamp.js" type="text/javascript"></script>
<script>document.write(BUILD_TIMESTAMP)</script>
</div>
<div id="footerlinks">
<p>
<a href="../../../../../../../about/index.html">About Android</a> |
<a href="../../../../../../../legal.html">Legal</a> |
<a href="../../../../../../../support.html">Support</a>
</p>
</div>
</div> <!-- end footer -->
</div> <!-- jd-content -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
</body>
</html>
| CMPUT301W15T05/TrackerExpress | google-play-services_lib/docs/reference/com/google/android/gms/maps/model/BitmapDescriptor.html | HTML | mit | 42,263 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
4180,
1011,
2828,
1000,
4180,
1027,
1000,
3793,
1013,
16129,
1025,
25869,
13462,
1027,
21183,
2546,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# reddit-clone
## Description
This app sets out to be like Reddit. The project to separated into two projects api and web.
Reasoning being that I want to work with the new and shiny (rails5 & react+redux).
## Development
See READMEs in the project directory on how to build and use the app.
Run `docker-compose up` to have api, web and storybook running on ports 3111, 3112, and 3113
respectively. NOTE: pretty sure the `bin/rails secrets:edit` thing got messed up for the
rails api. Double check this and most likely can share between host and docker environments.
## Heroku deployment
Use docker compose to orchestrate deployment.
Run the following commands to deploy to Heroku:
- [ ] FIGURE THIS OUT
| jonwho/reddit-clone | README.md | Markdown | mit | 709 | [
30522,
1001,
2417,
23194,
1011,
17598,
1001,
1001,
6412,
2023,
10439,
4520,
2041,
2000,
2022,
2066,
2417,
23194,
1012,
1996,
2622,
2000,
5459,
2046,
2048,
3934,
17928,
1998,
4773,
1012,
13384,
2108,
2008,
1045,
2215,
2000,
2147,
2007,
1996,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package fm.indiecast.rnaudiostreamer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.bridge.JavaScriptModule;
public class RNAudioStreamerPackage implements ReactPackage {
private Class<?> clsActivity;
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new RNAudioStreamerModule(reactContext));
return modules;
}
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Arrays.<ViewManager>asList();
}
} | indiecastfm/react-native-audio-streamer | android/src/main/java/fm/indiecast/rnaudiostreamer/RNAudioStreamerPackage.java | Java | mit | 1,029 | [
30522,
7427,
4718,
1012,
10271,
10526,
1012,
12987,
21041,
14122,
16416,
5017,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
9140,
9863,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
27448,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
6407,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Kata-Skeleton.py
================
This skeleton is inspired from [kata-skeleton.php](https://github.com/kevinlebrun/kata-skeleton.php) repository.
It provide a bootstrap for a kata or simply for a python project.
## Requirements
- make
- virtualenv
## Usage
First clone this repository
```git clone https://github.com/Sliim/kata-skeleton.py.git```
Python virtualenv is used to manage your project dependencies.
You can edit `requirements.txt` file to add or remove dependencies for your project.
This file is read by `pip` for packages installation.
To initialize kata project run:
```make install```
You can specify a name for your kata:
```make install KATA=foobar```
By default, virtual environment is installed in `env` directory, you can override this value with `ENV` variable:
```make install ENV=myenv```
For others variable report to `Makefile`.
To clean virtual environment:
```make clean-env```
To execute your tests:
```make run-tests```
## License
See COPYING file.
| Sliim/kata-skeleton.py | README.md | Markdown | gpl-3.0 | 1,033 | [
30522,
29354,
1011,
13526,
1012,
1052,
2100,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
30524,
6879,
6494,
2361,
2005,
1037,
29354,
2030,
3432,
2005,
1037,
18750,
2622,
1012,
1001,
1001,
5918,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package cn.ezandroid.ezfilter.render;
import android.content.Context;
import android.opengl.GLES20;
import cn.ezandroid.lib.ezfilter.core.util.Path;
import cn.ezandroid.lib.ezfilter.extra.IAdjustable;
import cn.ezandroid.lib.ezfilter.extra.MultiBitmapInputRender;
/**
* 黑白滤镜
*
* @author like
* @date 2017-09-17
*/
public class BWRender extends MultiBitmapInputRender implements IAdjustable {
private static final String[] BITMAP_PATHS = new String[]{
Path.ASSETS.wrap("filter/bw.png"),
// Path.DRAWABLE.wrap("" + R.drawable.bw)
};
private static final String UNIFORM_MIX = "u_mix";
private int mMixHandle;
private float mMix = 1f; // 滤镜强度
public BWRender(Context context) {
super(context, BITMAP_PATHS);
setFragmentShader("precision lowp float;\n" +
" uniform lowp float u_mix;\n" +
" \n" +
" varying highp vec2 textureCoordinate;\n" +
" \n" +
" uniform sampler2D inputImageTexture;\n" +
" uniform sampler2D inputImageTexture2;\n" +
" \n" +
" \n" +
" void main()\n" +
"{\n" +
" lowp vec4 sourceImageColor = texture2D(inputImageTexture, textureCoordinate)" +
";\n" +
" \n" +
" vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n" +
" texel = vec3(dot(vec3(0.3, 0.6, 0.1), texel));\n" +
" texel = vec3(texture2D(inputImageTexture2, vec2(texel.r, .16666)).r);\n" +
" mediump vec4 fragColor = vec4(texel, 1.0);\n" +
" gl_FragColor = mix(sourceImageColor, fragColor, u_mix);\n" +
"}");
}
@Override
protected void initShaderHandles() {
super.initShaderHandles();
mMixHandle = GLES20.glGetUniformLocation(mProgramHandle, UNIFORM_MIX);
}
@Override
protected void bindShaderValues() {
super.bindShaderValues();
GLES20.glUniform1f(mMixHandle, mMix);
}
@Override
public void adjust(float progress) {
mMix = progress;
}
}
| uestccokey/EZFilter | app/src/main/java/cn/ezandroid/ezfilter/render/BWRender.java | Java | mit | 2,224 | [
30522,
7427,
27166,
1012,
1041,
13471,
22196,
3593,
1012,
1041,
2480,
8873,
21928,
1012,
17552,
1025,
12324,
11924,
1012,
4180,
1012,
6123,
1025,
12324,
11924,
1012,
2330,
23296,
1012,
1043,
4244,
11387,
1025,
12324,
27166,
1012,
1041,
13471,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef ALIS_H
#define ALIS_H
#include <string>
using namespace std;
class Alis
{
protected:
int urunKodu;
int alisTarihi;
float alisFiyati;
int alisAdeti;
int alisKodu;
public:
Alis();
int getUrunKodu();
void setUrunKodu(int value);
int getAlisTarihi();
void setAlisTarihi(int value);
float getAlisFiyati();
void setAlisFiyati(float value);
int getAlisAdeti();
void setAlisAdeti(int value);
int getAlisKodu();
void setAlisKodu(int value);
};
#endif // ALIS_H
| ergenekonyigit/okabe | veri/alis.h | C | gpl-3.0 | 496 | [
30522,
1001,
2065,
13629,
2546,
4862,
2015,
1035,
1044,
1001,
9375,
4862,
2015,
1035,
1044,
1001,
2421,
1026,
5164,
1028,
2478,
3415,
15327,
2358,
2094,
1025,
2465,
4862,
2015,
1063,
5123,
1024,
20014,
24471,
16814,
7716,
2226,
1025,
20014,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#
# Cookbook Name:: apache2
# Recipe:: authz_groupfile
#
# Copyright 2008-2013, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
apache_module 'authz_groupfile'
| 3ofcoins/idk-repo | vendor/cookbooks/apache2/recipes/mod_authz_groupfile.rb | Ruby | apache-2.0 | 675 | [
30522,
1001,
1001,
5660,
8654,
2171,
1024,
1024,
15895,
2475,
1001,
17974,
1024,
1024,
8740,
2705,
2480,
1035,
2177,
8873,
2571,
1001,
1001,
9385,
2263,
1011,
2286,
1010,
23092,
16044,
1010,
4297,
1012,
1001,
1001,
7000,
2104,
1996,
15895,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2013 salesforce.com, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
({
/**
* Set up the actions by creating a storage, building the hierarchy, and resetting the buffer for the test.
*/
setUp: function(cmp) {
//
// Initialize storage here, in JS to avoid issues with instantiating the component multiple
// times.
//
$A.storageService.initStorage("actions", false, false, 100000, 50, 0, true, true, 1);
cmp.helper.buildHierarchy(cmp);
var ready = false;
$A.test.callServerAction($A.test.getAction(cmp, "c.execute", {
"commands" : "RESET"
}, function() {
ready = true;
}));
$A.test.addWaitFor(true, function() {
return ready;
});
},
/**
* Get a lock name that will not conflict.
*
* FIXME: there should be a $A.test.getUniqueId()
*/
getSafeLock: function(cmp, name) {
if (!cmp._lock_names) {
cmp._lock_names = {};
cmp._lock_base = ""+new Date().getTime();
}
if (!cmp._lock_names[name]) {
cmp._lock_names[name] = $A.test.getTestName()+"."+cmp._lock_base+"."+name;
}
return cmp._lock_names[name];
},
/**
* Convert an array of command arrays into a simple string.
*
* This allows us to ensure locks are unique, and check the command string.
*/
buildCommands: function(cmp, commands) {
var i;
var commands_out = "";
var name;
var parent = cmp;
for (i = 0; i < commands.length; i++) {
var command_list = commands[i];
var command = command_list[0];
if (command === "WAIT") {
name = this.getSafeLock(cmp, command_list[1]);
commands_out += "WAIT "+name+";";
} else if (command === "RESUME") {
name = this.getSafeLock(cmp, command_list[1]);
commands_out += "RESUME "+name+";";
} else if (command === "APPEND") {
commands_out += "APPEND "+command_list[1]+";";
} else if (command === "COPY") {
commands_out += "COPY;";
} else if (command === "READ") {
commands_out += "READ;";
} else {
throw new Error("Unknown command "+command+" in "+command_list);
}
}
return commands_out;
},
sendAction: function(cmp, path, commands, label, options) {
var i;
var commands_out = "";
var name;
var parent = cmp;
for (i = 0; i < commands.length; i++) {
var command_list = commands[i];
var command = command_list[0];
if (command === "WAIT") {
name = this.getSafeLock(cmp, command_list[1]);
commands_out += "WAIT "+name+";";
} else if (command === "RESUME") {
name = this.getSafeLock(cmp, command_list[1]);
commands_out += "RESUME "+name+";";
} else if (command === "APPEND") {
commands_out += "APPEND "+command_list[1]+";";
} else if (command === "COPY") {
commands_out += "COPY;";
} else if (command === "READ") {
commands_out += "READ;";
}
}
cmp.runAction(path, parent, commands_out, label, options);
},
/**
* Wait for a line to appear at a specific location.
*/
addWaitForLog : function(cmp, index, content, cb, partialMatch) {
var actual;
$A.test.addWaitForWithFailureMessage(false,
function() {
actual = cmp.get("v.log")?cmp.get("v.log")[index]:undefined;
return actual === undefined;
},
"Never received log message '" + content + "' at index " + index,
function() {
if(partialMatch === true) {
$A.test.assertTrue(actual.contains(content), "mismatch on log entry "+index);
} else {
$A.test.assertEquals(content, actual, "mismatch on log entry "+index);
}
if (cb) {
cb();
}
}
);
},
/**
* Wait for a log entry that will fall in a range due to race conditions.
*/
addWaitForLogRace : function(cmp, index1, index2, content, partialMatch) {
var actual;
$A.test.addWaitForWithFailureMessage(true,
function() {
actual = cmp.get("v.log")?cmp.get("v.log")[index2]:undefined;
return actual !== undefined;
},
"Never received log message '" + content + "' between index " + index1 + " and " + index2,
function() {
var i;
var logs = cmp.get("v.log");
var acc = '';
for (i = index1; i <= index2; i++) {
if(partialMatch === true) {
if(logs[i].indexOf(content) >= 0) {
return;
}
} else {
if (logs[i] === content) {
return;
}
}
acc = acc + '\n' + logs[i];
}
$A.test.fail("mismatch in log range "+index1+','+index2+
': did not find '+content+' in:'+acc);
}
);
},
/**
* Wait for a set of log entries that will fall (in order) in a range due to race conditions.
*
* Unlike wait for log race above, this requires a set of log lines to be in order, but allows then to have
* races with other groups of lines. This is useful when you have several sets of actions in paralel, but
* want to ensure that a given set is executed in order.
*/
addWaitForLogRaceOrdered : function(cmp, index1, index2, contentSet, partialMatch) {
var actual;
$A.test.addWaitForWithFailureMessage(true,
function() {
actual = cmp.get("v.log")?cmp.get("v.log")[index2]:undefined;
return actual !== undefined;
},
"Never received log message '" + contentSet + "' between index " + index1 + " and " + index2,
function() {
var i, j;
var logs = cmp.get("v.log");
var acc = '';
for (i = index1, j=0; j < contentSet.length && i <= index2; i++) {
if(partialMatch === true) {
if(logs[i].indexOf(contentSet[j]) >= 0) {
j++;
}
} else {
if (logs[i] === contentSet[j]) {
j++;
}
}
acc = acc + '\n' + logs[i];
}
if (j === contentSet.length) {
return;
}
$A.test.fail("mismatch in log range "+index1+','+index2+
': did not find '+contentSet+' in:'+acc);
}
);
},
/**
* Test that we can enqueue and execute client actions.
*
* Guarantees:
* * client action MUST not run immediately.
* * client action MAY run after a timeout.
* * client action MUST run before render.
*/
testEnqueueClientAction : {
test : [ function(cmp) {
//Action is enqueued but not executed
var action = cmp.get("c.client");
// FIXME: Ensure that the component is not rendered until after the client action runs.
$A.enqueueAction(action);
// logging here should always beat enqueueing.
cmp.helper.log(cmp, cmp, "log1");
this.addWaitForLog(cmp, 0, "log1");
// the only guarantee is that the client actions should
// execute before the render occurs In this case, we should get exactly one rerender.
// FIXME: goliver actions-rewrite
// Don't know how to check for this.
this.addWaitForLog(cmp, 1, "client");
} ]
},
/**
* Test that we can have more than one foreground actions run in parallel on server.
*
* max 4 foreground actions can be run in parallel. here we enqueue 4 foreground actions. ask first 3 to wait on
* server till 4th arrives, then release them all.
*
* if enqueue 4 foreground action without releasing any of them, we will run out of available XHR when we want to
* enqueue another, no error/warning message on anywhere though, we just put actions in the deferred queue.
*
* This is dangerous, so we have to ensure that we don't create races. To avoid races, we explicitely chain
* our actions using resume and wait. Be careful of deadlocks.
*/
testMultipleForegroundInFlight : {
labels: ["flapper"],
test : [
function(cmp) {
this.sendAction(cmp, [],
[ [ "APPEND", "fore1" ],
[ "RESUME", "fore1.chain" ],
[ "WAIT", "fore1" ],
[ "COPY" ] ],
"fore1");
}, function(cmp) {
this.sendAction(cmp, [],
[ [ "WAIT", "fore1.chain"],
[ "APPEND", "fore2" ],
[ "RESUME", "fore2.chain" ],
[ "WAIT", "fore2" ],
[ "COPY" ] ],
"fore2");
}, function(cmp) {
this.sendAction(cmp, [],
[ [ "WAIT", "fore2.chain"],
[ "APPEND", "fore3" ],
[ "RESUME", "fore3.chain" ],
[ "WAIT", "fore3" ],
[ "COPY" ] ],
"fore3");
}, function(cmp) {
this.sendAction(cmp, [],
[ [ "WAIT", "fore3.chain"],
[ "APPEND", "fore4" ],
[ "READ" ],
[ "APPEND", "fore4.after" ],
[ "RESUME", "fore1" ],
[ "RESUME", "fore2" ],
[ "RESUME", "fore3" ] ],
"fore4");
}, function(cmp) {
this.addWaitForLogRace(cmp, 0, 3, "fore1: SUCCESS fore4.after");
this.addWaitForLogRace(cmp, 0, 3, "fore2: SUCCESS fore4.after");
this.addWaitForLogRace(cmp, 0, 3, "fore3: SUCCESS fore4.after");
this.addWaitForLogRace(cmp, 0, 3, "fore4: SUCCESS fore1,fore2,fore3,fore4");
} ]
},
/**
* Test to ensure that caboose actions are not executed until another foreground action is sent.
*
* Guarantees:
* * Caboose action will not be sent until a server side foreground action is enqueued.
* * allAboardCallback will be called before the action is sent, but after the foreground action is enqueued
*
* This test emulates the log+flush pattern that can be used with a combination of caboose actions and allAboard
* callbacks. This pattern lets the user queue a caboose action and use allAboardCallback to set a param (in this
* case fake log data) to be attached to the action right before the XHR is sent to the server.
*/
testCabooseActionsWithAllAboardCallback : {
test : [
function(cmp) {
var that = this;
this.sendAction(cmp, [],
[ [ "APPEND", "back1" ],
[ "READ" ] ],
"back1",
[ "background" ]);
this.sendAction(cmp, [],
[ [ "APPEND", "caboose1" ],
[ "READ" ] ],
"caboose1",
[ "caboose", "allaboard" ]);
// verify only background action ran
this.addWaitForLog(cmp, 0, "back1: SUCCESS back1");
},
function(cmp) {
this.sendAction(cmp, [],
[ [ "APPEND", "back2" ],
[ "READ" ] ],
"back2",
[ "background" ]);
this.addWaitForLog(cmp, 1, "back2: SUCCESS back2");
},
function(cmp) {
// Client actions also should not trigger the caboose.
$A.enqueueAction(cmp.get("c.client"));
this.addWaitForLog(cmp, 2, "client");
},
function(cmp) {
this.sendAction(cmp, [],
[ [ "APPEND", "fore1" ],
[ "READ" ] ],
"fore1");
// new foreground action should flush out all pending caboose actions
this.addWaitForLog(cmp, 3, "caboose1[AllAboard]: NEW");
this.addWaitForLogRace(cmp, 4, 5, "caboose1: SUCCESS caboose1");
this.addWaitForLogRace(cmp, 4, 5, "fore1: SUCCESS fore1");
}
]
},
/**
* run storable action ('c.execute', param:'WAIT;READ') couple times, make sure we read response from storage
* also check storage is updated when new response come from server (we did it by bgAction1/2/etc).
* NOTE: from storage point of view, only action def and parameter matters, foreground or background are the same
*/
testStorableRefresh : {
test : [ function(cmp) {
//enqueue foreground action(a), ask it to wait on server, till another action (bgAction1) release it.
//a is storable, its return 'initial' is stored
var that = this;
// prime storage
this.sendAction(cmp, [],
[ [ "WAIT", "prime" ],
[ "READ" ] ],
"prime",
[ "storable" ]);
this.sendAction(cmp, [],
[ [ "APPEND", "initial" ],
[ "RESUME", "prime" ] ],
"back",
[ "background" ]);
this.addWaitForLogRace(cmp, 0, 1, "prime: SUCCESS initial");
this.addWaitForLogRace(cmp, 0, 1, "back: SUCCESS ");
}, function(cmp) {
//fire foreground action(a), because we already have its response('initial') stored, it will just get that.
//we also fire background action(bgAction2), it update a's return with a new value,
//it will update stored response for a.
this.sendAction(cmp, [],
[ [ "WAIT", "prime" ],
[ "READ" ] ],
"refresh",
[ "storable" ]);
this.addWaitForLog(cmp, 2, "refresh[stored]: SUCCESS initial");
}, function(cmp) {
this.sendAction(cmp, [],
[ [ "APPEND", "round two" ],
[ "RESUME", "prime" ] ],
"back",
[ "background" ]);
this.addWaitForLogRace(cmp, 3, 4, "back: SUCCESS ");
this.addWaitForLogRace(cmp, 3, 4, "refresh: SUCCESS round two");
}, function(cmp) {
//fire background action(a), it will read response from storage, which is updated by bgAction2 above
//fire foreground action, it update response in storage
}, function(cmp) {
//enqueue foreground action(a) again to double check update from foreAction1 is indeed in storage.
//enqueue background action bgAction3 to release a from server,
//also update the storage with new response 'theEnd'
} ]
},
/**
* Make sure that we send only one of two duplicate actions enqueued.
*
* Test this by putting a single value on the buffer, then reading and clearing in both actions. If they
* both go to the server, they will have different values.
*/
testDeDupeStorable : {
test : [ function(cmp) {
// The storable actions should be 'de-duped', and only one should go to the server.
// This is shown by the fact that they will both get the 'initial' that is saved in a buffer.
this.sendAction(cmp, [],
[ [ "APPEND", "initial" ] ],
"setup",
[ "background" ]);
this.sendAction(cmp, [],
[ [ "WAIT", "prime" ],
[ "READ" ] ],
"prime1",
[ "storable" ]);
this.sendAction(cmp, [],
[ [ "WAIT", "prime" ],
[ "READ" ] ],
"prime2",
[ "storable" ]);
this.addWaitForLog(cmp, 0, "setup: SUCCESS ");
}, function(cmp) {
this.sendAction(cmp, [],
[ [ "RESUME", "prime" ] ],
"release",
[ "background" ]);
this.addWaitForLogRace(cmp, 1, 3, "release: SUCCESS ");
this.addWaitForLogRace(cmp, 1, 3, "prime1: SUCCESS initial");
this.addWaitForLogRace(cmp, 1, 3, "prime2: SUCCESS initial");
} ]
},
/**
* enqueue two actions, a1(foreground), a2(background) with same action def and param, they run in parallel
* make sure they read response from storage first, then update the storage with their responses.
*
* Note a1&a2 are not both foreground/background, a2 won't become a dupe of a1
*/
testParallelStorable : {
test : [ function(cmp) {
this.sendAction(cmp, [],
[ [ "APPEND", "initial" ] ],
"setup");
this.addWaitForLog(cmp, 0, "setup: SUCCESS ");
}, function(cmp) {
this.sendAction(cmp, [],
[ [ "READ" ] ],
"prime",
[ "storable" ]);
this.addWaitForLog(cmp, 1, "prime: SUCCESS initial");
}, function(cmp) {
this.sendAction(cmp, [],
[ [ "APPEND", "second" ] ],
"setup2");
this.addWaitForLog(cmp, 2, "setup2: SUCCESS ");
}, function(cmp) {
this.sendAction(cmp, [],
[ [ "READ" ] ],
"retrieve-fore",
[ "storable" ]);
this.sendAction(cmp, [],
[ [ "READ" ] ],
"retrieve-back",
[ "storable", "background" ]);
// both callbacks with stored value executed. These should be executed _before_ any refreshes go out.
this.addWaitForLogRace(cmp, 3, 4, "retrieve-fore[stored]: SUCCESS initial");
this.addWaitForLogRace(cmp, 3, 4, "retrieve-back[stored]: SUCCESS initial");
//last param=true:we only check partial match
this.addWaitForLogRace(cmp, 5, 6, "retrieve-fore: SUCCESS ", true);
this.addWaitForLogRace(cmp, 5, 6, "retrieve-back: SUCCESS ", true);
} ]
},
/**
* Check that an abortable action is aborted prior to send.
*/
testAbortAbortablePriorToSend : {
test : [ function(cmp) {
$A.test.blockForegroundRequests();
this.sendAction(cmp, [ "child1" ],
[ [ "APPEND", "value" ],
[ "READ" ] ],
"aborted",
[ "abortable" ]);
// return to top so that the action gets queued up.
}, function(cmp) {
cmp.helper.deleteChild(cmp, "child1");
}, function(cmp) {
$A.test.releaseForegroundRequests();
this.addWaitForLog(cmp, 0, "aborted: ABORTED undefined");
} ]
},
/**
* Check that an abortable action is aborted after send.
*/
testAbortAbortableAfterSend : {
test : [ function(cmp) {
this.sendAction(cmp, [ "child1" ],
[ [ "WAIT", "release" ],
[ "APPEND", "value" ],
[ "READ" ] ],
"aborted",
[ "abortable" ]);
// make sure we sent the action.
$A.test.addWaitFor(false, function() { return $A.test.isActionQueued(); })
}, function(cmp) {
var old = cmp.find("child1");
cmp.helper.deleteChild(cmp, "child1");
// Make sure that the component is gone before we release.
$A.test.addWaitFor(false, function() { return old.isValid(); })
}, function(cmp) {
this.sendAction(cmp, [ ],
[ [ "RESUME", "release" ] ],
"release");
this.addWaitForLogRace(cmp, 0, 1, "aborted: ABORTED value");
this.addWaitForLogRace(cmp, 0, 1, "release: SUCCESS ");
} ]
},
/**
* Check that a non-abortable action is not aborted prior to send.
*/
testAbortNonAbortableNotPriorToSend : {
test : [ function(cmp) {
$A.test.blockForegroundRequests();
this.sendAction(cmp, [ "child1" ],
[ [ "APPEND", "value" ],
[ "READ" ] ],
"aborted");
// return to top so that the action gets queued up.
}, function(cmp) {
cmp.helper.deleteChild(cmp, "child1");
}, function(cmp) {
$A.test.releaseForegroundRequests();
this.addWaitForLog(cmp, 0, "aborted: ABORTED value");
} ]
},
/**
* Check that an abortable action is aborted prior to send.
*/
testAbortNonAbortableAfterSend : {
test : [ function(cmp) {
this.sendAction(cmp, [ "child1" ],
[ [ "WAIT", "release" ],
[ "APPEND", "value" ],
[ "READ" ] ],
"aborted",
[ "abortable" ]);
}, function(cmp) {
var old = cmp.find("child1");
cmp.helper.deleteChild(cmp, "child1");
// Make sure that the component is gone before we release.
$A.test.addWaitFor(false, function() { return old.isValid(); });
}, function(cmp) {
this.sendAction(cmp, [ ],
[ [ "RESUME", "release" ] ],
"release");
this.addWaitForLogRace(cmp, 0, 1, "aborted: ABORTED value");
this.addWaitForLogRace(cmp, 0, 1, "release: SUCCESS ");
} ]
},
///////////////////////////////////////////////////////////////////////
// runActions
///////////////////////////////////////////////////////////////////////
testSimpleRunActions : {
test : [ function(cmp) {
var helper = cmp.helper;
$A.clientService.runActions([
helper.getAction(cmp, cmp, this.buildCommands(cmp, [ [ "APPEND", "a" ], ["READ"] ]), "first")
], this, function() {
cmp.helper.log(cmp, cmp, "group1");
});
}, function(cmp) {
var helper = cmp.helper;
$A.clientService.runActions([
helper.getAction(cmp, cmp, this.buildCommands(cmp, [ [ "APPEND", "b1" ], ["READ"] ]), "second"),
helper.getAction(cmp, cmp, this.buildCommands(cmp, [ [ "APPEND", "b2" ], ["READ"] ]), "second")
], this, function() {
cmp.helper.log(cmp, cmp, "group2");
});
}, function(cmp) {
var helper = cmp.helper;
$A.clientService.runActions([
helper.getAction(cmp, cmp, this.buildCommands(cmp, [ [ "APPEND", "c1" ], ["READ"] ]), "third"),
helper.getAction(cmp, cmp, this.buildCommands(cmp, [ [ "APPEND", "c2" ], ["READ"] ]), "third")
], this, function() {
cmp.helper.log(cmp, cmp, "group3");
});
}, function(cmp) {
this.addWaitForLogRaceOrdered(cmp, 0, 7, [ "first: SUCCESS a", "group1" ] );
this.addWaitForLogRaceOrdered(cmp, 0, 7, [ "second: SUCCESS b1", "group2" ]);
this.addWaitForLogRaceOrdered(cmp, 0, 7, [ "second: SUCCESS b2", "group2" ]);
this.addWaitForLogRaceOrdered(cmp, 0, 7, [ "third: SUCCESS c1", "group3" ]);
this.addWaitForLogRaceOrdered(cmp, 0, 7, [ "third: SUCCESS c2", "group3" ]);
}]
}
})
| badlogicmanpreet/aura | aura-components/src/test/components/clientServiceTest/enqueueAction/enqueueActionTest.js | JavaScript | apache-2.0 | 25,099 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2286,
4341,
14821,
1012,
4012,
1010,
4297,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
30524,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6105,
1012,
1008,
2017,
2089,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML>
<!--
Strata by HTML5 UP
html5up.net | @n33co
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
<head>
<title>Leticia Wright · Kevin Li</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="author" content="Kevin Li">
<meta name="description" content="Personal Website, Portfolio, and Blog">
<meta http-equiv="content-language" content="en-us" />
<meta name="og:site_name" content="Kevin Li">
<meta name="og:title" content="Leticia Wright">
<meta name="og:url" content="http://kevinwli.com/tags/leticia-wright/">
<meta name="og:image" content="http://kevinwli.com/images/https://res.cloudinary.com/lilingkai/image/upload/s--tB1TDmk3--/c_scale,q_jpegmini:1,w_1600/v1492638792/Kevin_vk8jrp.jpg">
<meta name="generator" content="Hugo 0.54.0" />
<!--[if lte IE 8]><script src='http://kevinwli.com/js/ie/html5shiv.js'></script><![endif]-->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="http://kevinwli.com/css/main.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="http://kevinwli.com//css/ie8.css"><![endif]-->
<link href="http://kevinwli.com/tags/leticia-wright/index.xml" rel="alternate" type="application/rss+xml" title="Kevin Li" />
<link href="http://kevinwli.com/tags/leticia-wright/index.xml" rel="feed" type="application/rss+xml" title="Kevin Li" />
<link rel="favicon" href="http://res.cloudinary.com/lilingkai/image/upload/v1480470082/favicon_v0tkdd.png">
</head>
<body id="top">
<!-- Header -->
<header id="header">
<a href="http://kevinwli.com/" class="image avatar"><img src="https://res.cloudinary.com/lilingkai/image/upload/s--tB1TDmk3--/c_scale,q_jpegmini:1,w_1600/v1492638792/Kevin_vk8jrp.jpg" alt="" /></a>
<h1><strong>Kevin Li</strong> <br> Creator, Developer, Musician</h1>
<nav id="sidebar">
<ul>
<li><a href="http://kevinwli.com/">Home</a></li>
<li><a href="http://kevinwli.com/KevinLiResume.pdf">Resume</a></li>
<li><a href="http://kevinwli.com/post/">Blog</a></li>
</ul>
</nav>
</header>
<!-- Main -->
<div id="main">
<span>
<h1>
<a href="http://kevinwli.com/post/2019-05-08-guava-island-review/">Guava Island</a>
</h1>
<i class="fa fa-calendar"></i>
<time datetime="2019-05-08 00:00:00 +0000 UTC">2019-05-08</time>
<i class="fa fa-folder"></i>
<a class="article-category-link" href="http://kevinwli.com/categories/film-review">Film Review</a>
<i class="fa fa-tags"></i>
<a class="article-category-link" href="http://kevinwli.com/tags/guava-island">Guava Island</a>
·
<a class="article-category-link" href="http://kevinwli.com/tags/hiro-murai">Hiro Murai</a>
·
<a class="article-category-link" href="http://kevinwli.com/tags/donald-glover">Donald Glover</a>
·
<a class="article-category-link" href="http://kevinwli.com/tags/rihanna">Rihanna</a>
·
<a class="article-category-link" href="http://kevinwli.com/tags/leticia-wright">Leticia Wright</a>
·
<a class="article-category-link" href="http://kevinwli.com/tags/nonso-anozie">Nonso Anozie</a>
·
<a class="article-category-link" href="http://kevinwli.com/tags/tv-ma">TV-MA</a>
·
<a class="article-category-link" href="http://kevinwli.com/tags/2019">2019</a>
·
<a class="article-category-link" href="http://kevinwli.com/tags/project-film-52">PROJECT-FILM-52</a>
</span>
<p><p>Donald Glover released his latest artistic endeavor last month on Amazon Prime, and this time it’s a short film by the name of “Guava Island”. Most art that Donald churns out is of high quality, and for the most part, “Guava Island” is no exception. Yet, there is a feeling of squandered opportunities here that make it feel less like a powerful short film and more like a long, self-glorifying music video.</p></p>
<hr>
</div>
<!-- Footer -->
<footer id="footer">
<ul class="icons">
<li><a href="//github.com/lilingkai" target="_blank" class="icon fa-github"><span class="label">GitHub</span></a></li>
<li><a href="https://www.linkedin.com/in/kevin-li-09591474/" target="_blank" class="icon fa-linkedin-square"><span class="label">Linkedin</span></a></li>
<li><a href="https://www.youtube.com/user/lilingkai" target="_blank" class="icon fa-youtube"><span class="label">YouTube</span></a></li>
<li><a href="http://kevinwli.com/#contact-form" class="icon fa-envelope-o"><span class="label">Email</span></a></li>
<li><a href="http://kevinwli.com/tags/leticia-wright/index.xml" class="icon fa-rss" type="application/rss+xml"><span class="label">RSS</span></a></li>
</ul>
<ul class="copyright">
<li>© Kevin Li</li>
<li>Design: <a href="//html5up.net">HTML5 UP</a></li>
</ul>
</footer>
<!-- Scripts -->
<script src="http://kevinwli.com/js/jquery.min.js"></script>
<script src="http://kevinwli.com/js/jquery.poptrox.min.js"></script>
<script src="http://kevinwli.com/js/skel.min.js"></script>
<script src="http://kevinwli.com/js/util.js"></script>
<script src="http://kevinwli.com/js/main.js"></script>
<script type="application/javascript">
var doNotTrack = false;
if (!doNotTrack) {
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-71563316-1', 'auto');
ga('send', 'pageview');
}
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
</body>
</html>
| lilingkai/lilingkai.github.io | tags/leticia-wright/index.html | HTML | mit | 6,017 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
999,
1011,
1011,
22913,
2011,
16129,
2629,
2039,
16129,
2629,
6279,
1012,
5658,
1064,
1030,
1050,
22394,
3597,
2489,
2005,
3167,
1998,
3293,
2224,
2104,
1996,
10507,
2050,
1017,
1012,
1014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
class Post < ActiveRecord::Base
validates :title, presence: true
validates :slug, presence: true, uniqueness: true
acts_as_url :title, :url_attribute => :slug
default_scope order('created_at desc')
def to_param
slug
end
def external?
!url.blank?
end
end
| chanman82/ChandlerCollins.com | app/models/post.rb | Ruby | mit | 280 | [
30522,
2465,
2695,
1026,
3161,
2890,
27108,
2094,
1024,
1024,
2918,
9398,
8520,
1024,
2516,
1010,
3739,
1024,
2995,
9398,
8520,
1024,
23667,
1010,
3739,
1024,
2995,
1010,
4310,
2791,
1024,
2995,
4490,
1035,
2004,
1035,
24471,
2140,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#pragma once
/*
* Copyright (C) 2012 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "FileItem.h"
#include "PVRChannelGroup.h"
#include "threads/CriticalSection.h"
namespace PVR
{
/** A container class for channel groups */
class CPVRChannelGroups
{
public:
/*!
* @brief Create a new group container.
* @param bRadio True if this is a container for radio channels, false if it is for tv channels.
*/
CPVRChannelGroups(bool bRadio);
virtual ~CPVRChannelGroups(void);
/*!
* @brief Remove all channels from this group.
*/
void Clear(void);
/*!
* @brief Load this container's contents from the database or PVR clients.
* @return True if it was loaded successfully, false if not.
*/
bool Load(void);
/*!
* @return Amount of groups in this container
*/
int Size(void) const { CSingleLock lock(m_critSection); return m_groups.size(); }
/*!
* @brief Update a group or add it if it's not in here yet.
* @param group The group to update.
* @param bSaveInDb True to save the changes in the db.
* @return True if the group was added or update successfully, false otherwise.
*/
bool Update(const CPVRChannelGroup &group, bool bSaveInDb = false);
/*!
* @brief Called by the add-on callback to add a new group
* @param group The group to add
* @return True when updated, false otherwise
*/
bool UpdateFromClient(const CPVRChannelGroup &group) { return Update(group, false); }
/*!
* @brief Get a channel given it's path
* @param strPath The path to the channel
* @return The channel, or an empty fileitem when not found
*/
CFileItemPtr GetByPath(const CStdString &strPath) const;
/*!
* @brief Get a pointer to a channel group given it's ID.
* @param iGroupId The ID of the group.
* @return The group or NULL if it wasn't found.
*/
CPVRChannelGroupPtr GetById(int iGroupId) const;
/*!
* @brief Get a group given it's name.
* @param strName The name.
* @return The group or NULL if it wan't found.
*/
CPVRChannelGroupPtr GetByName(const CStdString &strName) const;
/*!
* @brief Get the group that contains all channels.
* @return The group that contains all channels.
*/
CPVRChannelGroupPtr GetGroupAll(void) const;
/*!
* @brief Get the list of groups.
* @param results The file list to store the results in.
* @return The amount of items that were added.
*/
int GetGroupList(CFileItemList* results) const;
/*!
* @brief Get the previous group in this container.
* @param group The current group.
* @return The previous group or the group containing all channels if it wasn't found.
*/
CPVRChannelGroupPtr GetPreviousGroup(const CPVRChannelGroup &group) const;
/*!
* @brief Get the next group in this container.
* @param group The current group.
* @return The next group or the group containing all channels if it wasn't found.
*/
CPVRChannelGroupPtr GetNextGroup(const CPVRChannelGroup &group) const;
/*!
* @brief Get the group that is currently selected in the UI.
* @return The selected group.
*/
CPVRChannelGroupPtr GetSelectedGroup(void) const;
/*!
* @brief Change the selected group.
* @param group The group to select.
*/
void SetSelectedGroup(CPVRChannelGroupPtr group);
/*!
* @brief Add a group to this container.
* @param strName The name of the group.
* @return True if the group was added, false otherwise.
*/
bool AddGroup(const CStdString &strName);
/*!
* @brief Delete a group in this container.
* @param group The group to delete.
* @return True if it was deleted successfully, false if not.
*/
bool DeleteGroup(const CPVRChannelGroup &group);
/*!
* @brief Remove a channel from all non-system groups.
* @param channel The channel to remove.
*/
void RemoveFromAllGroups(const CPVRChannel &channel);
/*!
* @brief Persist all changes in channel groups.
* @return True if everything was persisted, false otherwise.
*/
bool PersistAll(void);
/*!
* @return True when this container contains radio groups, false otherwise
*/
bool IsRadio(void) const { return m_bRadio; }
/*!
* @brief Call by a guiwindow/dialog to add the groups to a control
* @param iWindowId The window to add the groups to.
* @param iControlId The control to add the groups to
*/
void FillGroupsGUI(int iWindowId, int iControlId) const;
/*!
* @brief Update the contents of the groups in this container.
* @param bChannelsOnly Set to true to only update channels, not the groups themselves.
* @return True if the update was successful, false otherwise.
*/
bool Update(bool bChannelsOnly = false);
private:
bool UpdateGroupsEntries(const CPVRChannelGroups &groups);
bool LoadUserDefinedChannelGroups(void);
bool GetGroupsFromClients(void);
bool m_bRadio; /*!< true if this is a container for radio channels, false if it is for tv channels */
CPVRChannelGroupPtr m_selectedGroup; /*!< the group that's currently selected in the UI */
std::vector<CPVRChannelGroupPtr> m_groups; /*!< the groups in this container */
CCriticalSection m_critSection;
};
}
| herrnst/xbmc-opdenkamp | xbmc/pvr/channels/PVRChannelGroups.h | C | gpl-2.0 | 6,251 | [
30522,
1001,
10975,
8490,
2863,
2320,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2262,
2136,
1060,
25526,
2278,
1008,
8299,
1024,
1013,
1013,
7479,
1012,
1060,
25526,
2278,
1012,
8917,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# PAgraph
jQuery Plugin for D3.js graph
## Install and compile
Install Grunt and dependencies with `npm install`
Start watch with `grunt watch`
***
#### • [Docs](https://github.com/pugia/PAgraph/wiki)
#### • [Examples](http://c4wi.pugia.com/components/PAgraph/sample/)
| pugia/PAgraph | README.md | Markdown | mit | 278 | [
30522,
1001,
6643,
14413,
1046,
4226,
2854,
13354,
2378,
2005,
1040,
2509,
1012,
1046,
2015,
10629,
1001,
1001,
16500,
30524,
27937,
2213,
16500,
1036,
2707,
3422,
2007,
1036,
20696,
3422,
1036,
1008,
1008,
1008,
1001,
1001,
1001,
1001,
152... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
########################################################################
#
# filepp is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#
########################################################################
########################################################################
#
# Project : File Pre Processor - cpp module
# Filename : $RCSfile: Makefile.in,v $
# Originator : $Author: darren $
# Maintainer : Darren Miller: darren@cabaret.demon.co.uk
# File version : $Revision: 1.3 $
# Last changed : $Date: 2007/02/13 00:08:09 $
# Description : Makefile for cpp module
# Licence : GNU copyleft
#
########################################################################
##############################################################################
# Paths
##############################################################################
srcdir = .
datarootdir = ${prefix}/share
moduledir = /usr/local/share/filepp/modules
# top level of test build directory
TESTBUILD = ../../testbuild
TESTFILEPP = $(TESTBUILD)/bin/filepp
ECHO=echo
DIFF=diff
RM=rm -fr
INSTALL=/usr/bin/install -c
test:
@$(ECHO) ----------- Testing cpp.pm ----------------
$(TESTFILEPP) -m cpp.pm $(srcdir)/test.in -o test.out
$(DIFF) $(srcdir)/test.good test.out
@$(ECHO) ----------- Done --------------------------
install:
$(INSTALL) -m 644 $(srcdir)/cpp.pm $(moduledir)
clean:
$(RM) test.out
distclean:
$(RM) Makefile
##############################################################################
# End of file
##############################################################################
| timbertson/filepp | modules/cpp/Makefile | Makefile | gpl-2.0 | 2,251 | [
30522,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
CREATE TABLE IF NOT EXISTS `#__formmaker_sessions` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`form_id` int(20) NOT NULL,
`group_id` int(20) NOT NULL,
`ip` varchar(20) NOT NULL,
`ord_date` datetime NOT NULL,
`ord_last_modified` datetime NOT NULL,
`status` varchar(50) NOT NULL,
`full_name` varchar(100) NOT NULL,
`email` varchar(50) NOT NULL,
`phone` varchar(50) NOT NULL,
`mobile_phone` varchar(255) NOT NULL,
`fax` varchar(255) NOT NULL,
`address` varchar(300) NOT NULL,
`paypal_info` text NOT NULL,
`without_paypal_info` text NOT NULL,
`ipn` varchar(20) NOT NULL,
`checkout_method` varchar(20) NOT NULL,
`tax` float NOT NULL,
`shipping` float NOT NULL,
`shipping_type` varchar(200) NOT NULL,
`read` int(11) NOT NULL,
`total` float NOT NULL,
`currency` varchar(24) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
| josepaiva94/CodingBooth | administrator/components/com_formmaker/update.mysql.sql | SQL | gpl-2.0 | 964 | [
30522,
3443,
2795,
2065,
2025,
6526,
1036,
1001,
1035,
1035,
2433,
8571,
1035,
6521,
1036,
1006,
1036,
8909,
1036,
20014,
1006,
2340,
1007,
27121,
2025,
19701,
8285,
1035,
4297,
28578,
4765,
1010,
1036,
2433,
1035,
8909,
1036,
20014,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.megotechnologies.ecommerce_retronight.loading;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.os.Looper;
import com.megotechnologies.ecommerce_retronight.MainActivity;
import com.megotechnologies.ecommerce_retronight.db.DbConnection;
import com.megotechnologies.ecommerce_retronight.utilities.MLog;
public class ThreadStreams extends Thread{
int CONN_TIMEOUT = 2000;
int SOCK_TIMEOUT = 2000;
String myCountryId = null;
String myStateId = null;
String myCityId = null;
DbConnection dbC;
public ThreadStreams(String idCountry, String idState, String idCity, DbConnection conn) {
// TODO Auto-generated constructor stub
myCountryId = idCountry;
myStateId = idState;
myCityId = idCity;
dbC = conn;
}
@Override
public void run() {
// TODO Auto-generated method stub
super.run();
MLog.log("Starting Stream thread.. ");
Looper.prepare();
Thread t = Thread.currentThread();
String tName = t.getName();
String jsonStr = "";
HttpParams httpParameters = new BasicHttpParams();
// Set the timeout in milliseconds until a connection is established.
// The default value is zero, that means the timeout is not used.
int timeoutConnection = CONN_TIMEOUT;
HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
// Set the default socket timeout (SO_TIMEOUT)
// in milliseconds which is the timeout for waiting for data.
int timeoutSocket = SOCK_TIMEOUT;
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
HttpClient httpclient = new DefaultHttpClient(httpParameters);
HttpPost httppost = null;
httppost = new HttpPost(MainActivity.API_STREAMS);
jsonStr = "[{\"idProject\": \"" + MainActivity.PID + "\", \"idCountry\": \"" + myCountryId + "\", \"idState\": \"" + myStateId + "\", \"idCity\": \"" + myCityId + "\"}]";
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
nameValuePairs.add(new BasicNameValuePair("params", jsonStr));
MLog.log("Stream API=" + jsonStr);
String responseString = null;
try {
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
ByteArrayOutputStream out = new ByteArrayOutputStream();
response.getEntity().writeTo(out);
out.close();
responseString = out.toString();
MLog.log(responseString);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
}
if(responseString != null) {
jsonStr = responseString;
try {
JSONObject jsonObj = new JSONObject(jsonStr);
if(jsonObj.getString("result").equals("success")) {
if(dbC.isOpen()) {
dbC.isAvailale();
dbC.clearDynamicRecords();
}
String valueStr = jsonObj.getString("value");
JSONArray jsonArr = new JSONArray(valueStr);
for(int i = 0; i < jsonArr.length(); i++) {
jsonObj = jsonArr.getJSONObject(i);
if(jsonObj.has("productstream")) {
JSONObject jsonObjStream = jsonObj.getJSONObject("productstream");
String idStreamContainer = jsonObjStream.getString("idProductstreamContainer");
String nameStream = jsonObjStream.getString("name");
MLog.log("Namestream " + nameStream);
HashMap<String, String> map = new HashMap<String, String>();
map.put(MainActivity.DB_COL_TYPE, MainActivity.DB_RECORD_TYPE_STREAM);
map.put(MainActivity.DB_COL_NAME, nameStream);
map.put(MainActivity.DB_COL_SRV_ID, idStreamContainer);
String _idStream = null;
if(dbC.isOpen()) {
dbC.isAvailale();
dbC.insertRecord(map);
_idStream = dbC.retrieveId(map);
}
JSONArray jsonArrProductItems = jsonObj.getJSONArray("productitems");
for(int j = 0; j < jsonArrProductItems.length(); j++) {
JSONObject jsonObjItems = jsonArrProductItems.getJSONObject(j).getJSONObject("items");
JSONArray jsonArrPictures = jsonArrProductItems.getJSONObject(j).getJSONArray("pictures");
JSONArray jsonArrUrls = jsonArrProductItems.getJSONObject(j).getJSONArray("urls");
JSONArray jsonArrLocations = jsonArrProductItems.getJSONObject(j).getJSONArray("locations");
JSONArray jsonArrContacts = jsonArrProductItems.getJSONObject(j).getJSONArray("contacts");
JSONArray jsonArrAttachments = jsonArrProductItems.getJSONObject(j).getJSONArray("attachments");
String priceMapped = jsonArrProductItems.getJSONObject(j).getString("price");
String discountMapped = jsonArrProductItems.getJSONObject(j).getString("discount");
String idSrvProductitems = jsonObjItems.getString("idProductitems");
String title = jsonObjItems.getString("title").replace("'", "''");
String subTitle = jsonObjItems.getString("subtitle").replace("'", "''");
String content = jsonObjItems.getString("content").replace("'", "''");
String timestamp = jsonObjItems.getString("timestampPublish");
String stock = jsonObjItems.getString("stockCurrent");
String size = jsonObjItems.getString("size");
String weight = jsonObjItems.getString("weight");
String sku = jsonObjItems.getString("sku");
String price = jsonObjItems.getString("price");
String extra1 = jsonObjItems.getString("extra1").replace("'", "''");
String extra2 = jsonObjItems.getString("extra2").replace("'", "''");
String extra3 = jsonObjItems.getString("extra3").replace("'", "''");
String extra4 = jsonObjItems.getString("extra4").replace("'", "''");
String extra5 = jsonObjItems.getString("extra5").replace("'", "''");
String extra6 = jsonObjItems.getString("extra6").replace("'", "''");
String extra7 = jsonObjItems.getString("extra7").replace("'", "''");
String extra8 = jsonObjItems.getString("extra8").replace("'", "''");
String extra9 = jsonObjItems.getString("extra9").replace("'", "''");
String extra10 = jsonObjItems.getString("extra10").replace("'", "''");
String booking = jsonObjItems.getString("bookingPrice");
String discount = jsonObjItems.getString("Discounts_idDiscounts");
if(!priceMapped.equals("-1")) {
price = priceMapped;
}
if(!discountMapped.equals("-1")) {
discount = discountMapped;
}
map = new HashMap<String, String>();
map.put(MainActivity.DB_COL_TYPE, MainActivity.DB_RECORD_TYPE_ITEM);
map.put(MainActivity.DB_COL_TITLE, title);
map.put(MainActivity.DB_COL_SRV_ID, idSrvProductitems);
map.put(MainActivity.DB_COL_SUB, subTitle);
map.put(MainActivity.DB_COL_CONTENT, content);
map.put(MainActivity.DB_COL_TIMESTAMP, timestamp);
map.put(MainActivity.DB_COL_STOCK, stock);
map.put(MainActivity.DB_COL_SIZE, size);
map.put(MainActivity.DB_COL_WEIGHT, weight);
map.put(MainActivity.DB_COL_SKU, sku);
map.put(MainActivity.DB_COL_PRICE, price);
map.put(MainActivity.DB_COL_FOREIGN_KEY, _idStream);
map.put(MainActivity.DB_COL_EXTRA_1, extra1);
map.put(MainActivity.DB_COL_EXTRA_2, extra2);
map.put(MainActivity.DB_COL_EXTRA_3, extra3);
map.put(MainActivity.DB_COL_EXTRA_4, extra4);
map.put(MainActivity.DB_COL_EXTRA_5, extra5);
map.put(MainActivity.DB_COL_EXTRA_6, extra6);
map.put(MainActivity.DB_COL_EXTRA_7, extra7);
map.put(MainActivity.DB_COL_EXTRA_8, extra8);
map.put(MainActivity.DB_COL_EXTRA_9, extra9);
map.put(MainActivity.DB_COL_EXTRA_10, extra10);
map.put(MainActivity.DB_COL_BOOKING, booking);
map.put(MainActivity.DB_COL_DISCOUNT, discount);
String _idItem = null;
if(dbC.isOpen()) {
dbC.isAvailale();
dbC.insertRecord(map);
map = new HashMap<String, String>();
map.put(MainActivity.DB_COL_TYPE, MainActivity.DB_RECORD_TYPE_ITEM);
map.put(MainActivity.DB_COL_SRV_ID, idSrvProductitems);
map.put(MainActivity.DB_COL_TIMESTAMP, timestamp);
map.put(MainActivity.DB_COL_FOREIGN_KEY, _idStream);
_idItem = dbC.retrieveId(map);
}
MLog.log("Title=" + title + ", Pictures=" + jsonArrPictures.length() + ",_id=" + _idItem);
if(jsonArrPictures.length() > 0) {
for(int k = 0; k < jsonArrPictures.length(); k++) {
JSONObject jsonObjPicture = jsonArrPictures.getJSONObject(k);
String pathOrig = jsonObjPicture.getString("pathOriginal");
String pathProc = jsonObjPicture.getString("pathProcessed");
String pathTh = jsonObjPicture.getString("pathThumbnail");
String[] strArrOrig = pathOrig.split("/");
String[] strArrProc = pathProc.split("/");
String[] strArrTh = pathTh.split("/");
map = new HashMap<String, String>();
map.put(MainActivity.DB_COL_TYPE, MainActivity.DB_RECORD_TYPE_PICTURE);
map.put(MainActivity.DB_COL_PATH_ORIG, strArrOrig[strArrOrig.length - 1]);
map.put(MainActivity.DB_COL_PATH_PROC, strArrProc[strArrProc.length - 1]);
map.put(MainActivity.DB_COL_PATH_TH, strArrTh[strArrTh.length - 1]);
map.put(MainActivity.DB_COL_FOREIGN_KEY, _idItem);
if(dbC.isOpen()) {
dbC.isAvailale();
dbC.insertRecord(map);
}
}
}
if(jsonArrUrls.length() > 0) {
for(int k = 0; k < jsonArrUrls.length(); k++) {
JSONObject jsonObjUrl = jsonArrUrls.getJSONObject(k);
String caption = jsonObjUrl.getString("caption");
String value = jsonObjUrl.getString("value");
map = new HashMap<String, String>();
map.put(MainActivity.DB_COL_TYPE, MainActivity.DB_RECORD_TYPE_URL);
map.put(MainActivity.DB_COL_CAPTION, caption);
map.put(MainActivity.DB_COL_URL, value);
map.put(MainActivity.DB_COL_FOREIGN_KEY, _idItem);
if(dbC.isOpen()) {
dbC.isAvailale();
dbC.insertRecord(map);
}
}
}
if(jsonArrAttachments.length() > 0) {
for(int k = 0; k < jsonArrAttachments.length(); k++) {
JSONObject jsonObjAttachment = jsonArrAttachments.getJSONObject(k);
String caption = jsonObjAttachment.getString("caption");
String value = jsonObjAttachment.getString("path");
map = new HashMap<String, String>();
map.put(MainActivity.DB_COL_TYPE, MainActivity.DB_RECORD_TYPE_ATTACHMENT);
map.put(MainActivity.DB_COL_CAPTION, caption);
map.put(MainActivity.DB_COL_URL, value);
map.put(MainActivity.DB_COL_FOREIGN_KEY, _idItem);
if(dbC.isOpen()) {
dbC.isAvailale();
dbC.insertRecord(map);
}
}
}
if(jsonArrLocations.length() > 0) {
for(int k = 0; k < jsonArrLocations.length(); k++) {
JSONObject jsonObjLocation = jsonArrLocations.getJSONObject(k);
String caption = jsonObjLocation.getString("caption");
String location = jsonObjLocation.getString("location");
map = new HashMap<String, String>();
map.put(MainActivity.DB_COL_TYPE, MainActivity.DB_RECORD_TYPE_LOCATION);
map.put(MainActivity.DB_COL_CAPTION, caption);
map.put(MainActivity.DB_COL_LOCATION, location);
map.put(MainActivity.DB_COL_FOREIGN_KEY, _idItem);
if(dbC.isOpen()) {
dbC.isAvailale();
dbC.insertRecord(map);
}
}
}
if(jsonArrContacts.length() > 0) {
for(int k = 0; k < jsonArrContacts.length(); k++) {
JSONObject jsonObjContact = jsonArrContacts.getJSONObject(k);
String name = jsonObjContact.getString("name");
String email = jsonObjContact.getString("email");
String phone = jsonObjContact.getString("phone");
map = new HashMap<String, String>();
map.put(MainActivity.DB_COL_TYPE, MainActivity.DB_RECORD_TYPE_CONTACT);
map.put(MainActivity.DB_COL_NAME, name);
map.put(MainActivity.DB_COL_EMAIL, email);
map.put(MainActivity.DB_COL_PHONE, phone);
map.put(MainActivity.DB_COL_FOREIGN_KEY, _idItem);
if(dbC.isOpen()) {
dbC.isAvailale();
dbC.insertRecord(map);
}
}
}
}
} else if(jsonObj.has("discounts")) {
JSONArray jsonObjDiscountArr = jsonObj.getJSONArray("discounts");
for(int j = 0; j < jsonObjDiscountArr.length(); j++) {
JSONObject jsonObjDiscount = jsonObjDiscountArr.getJSONObject(j);
String idDiscounts = jsonObjDiscount.getString("idDiscounts");
String code = jsonObjDiscount.getString("code").replace("'", "''");
String type = jsonObjDiscount.getString("type");
String timestamp = jsonObjDiscount.getString("timestamp");
String value = jsonObjDiscount.getString("value");
HashMap<String, String> map = new HashMap<String, String>();
map.put(MainActivity.DB_COL_TYPE, MainActivity.DB_RECORD_TYPE_DISCOUNT);
map.put(MainActivity.DB_COL_NAME, code);
map.put(MainActivity.DB_COL_TITLE, type);
map.put(MainActivity.DB_COL_TIMESTAMP, timestamp);
map.put(MainActivity.DB_COL_PRICE, value);
map.put(MainActivity.DB_COL_SRV_ID, idDiscounts);
if(dbC.isOpen()) {
dbC.isAvailale();
dbC.insertRecord(map);
}
}
} else if(jsonObj.has("coupons")) {
JSONArray jsonObjCouponArr = jsonObj.getJSONArray("coupons");
for(int j = 0; j < jsonObjCouponArr.length(); j++) {
JSONObject jsonObjCoupon = jsonObjCouponArr.getJSONObject(j);
String idCoupons = jsonObjCoupon.getString("idCoupons");
String code = jsonObjCoupon.getString("code").replace("'", "''");
String type = jsonObjCoupon.getString("type");
String timestamp = jsonObjCoupon.getString("timestamp");
String value = jsonObjCoupon.getString("value");
String allowDouble = jsonObjCoupon.getString("allowDoubleDiscounting");
String maxVal = jsonObjCoupon.getString("maxVal");
String minPurchase = jsonObjCoupon.getString("minPurchase");
HashMap<String, String> map = new HashMap<String, String>();
map.put(MainActivity.DB_COL_TYPE, MainActivity.DB_RECORD_TYPE_COUPON);
map.put(MainActivity.DB_COL_NAME, code);
map.put(MainActivity.DB_COL_TITLE, type);
map.put(MainActivity.DB_COL_TIMESTAMP, timestamp);
map.put(MainActivity.DB_COL_PRICE, value);
map.put(MainActivity.DB_COL_CAPTION, allowDouble);
map.put(MainActivity.DB_COL_SRV_ID, idCoupons);
map.put(MainActivity.DB_COL_EXTRA_1, maxVal);
map.put(MainActivity.DB_COL_EXTRA_2, minPurchase);
MLog.log("Coupon Found inserting " + maxVal + " " + minPurchase);
if(dbC.isOpen()) {
dbC.isAvailale();
dbC.insertRecord(map);
}
}
} else if(jsonObj.has("taxes")) {
try {
JSONObject jsonObjCoupon = jsonObj.getJSONObject("taxes");
String taxLabel1 = jsonObjCoupon.getString("taxLabel1").replace("'", "''");
String taxValue1 = jsonObjCoupon.getString("taxValue1");
String taxLabel2 = jsonObjCoupon.getString("taxLabel2").replace("'", "''");
String taxValue2 = jsonObjCoupon.getString("taxValue2");
if(taxValue1.length() > 0 && taxLabel1.length() > 0) {
if(!taxLabel1.equals("null") && !taxValue1.equals("null")) {
double d = Double.parseDouble(taxValue1);
HashMap<String, String> map = new HashMap<String, String>();
map.put(MainActivity.DB_COL_TYPE, MainActivity.DB_RECORD_TYPE_COUPON);
map.put(MainActivity.DB_COL_TYPE, MainActivity.DB_RECORD_TYPE_TAX_1);
map.put(MainActivity.DB_COL_TITLE, taxLabel1);
map.put(MainActivity.DB_COL_SUB, taxValue1);
if(dbC.isOpen()) {
dbC.isAvailale();
dbC.insertRecord(map);
}
}
}
if(taxValue2.length() > 0 && taxLabel2.length() > 0) {
if(!taxLabel2.equals("null") && !taxValue2.equals("null")) {
double d = Double.parseDouble(taxValue1);
HashMap<String, String> map = new HashMap<String, String>();
map.put(MainActivity.DB_COL_TYPE, MainActivity.DB_RECORD_TYPE_COUPON);
map.put(MainActivity.DB_COL_TYPE, MainActivity.DB_RECORD_TYPE_TAX_2);
map.put(MainActivity.DB_COL_TITLE, taxLabel2);
map.put(MainActivity.DB_COL_SUB, taxValue2);
if(dbC.isOpen()) {
dbC.isAvailale();
dbC.insertRecord(map);
}
}
}
} catch (NumberFormatException e) {
e.printStackTrace();
}
}
}
if(dbC.isOpen()) {
dbC.isAvailale();
dbC.printRecords();
}
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
| ZonCon/Ecommerce-Retronight-Android | app/src/main/java/com/megotechnologies/ecommerce_retronight/loading/ThreadStreams.java | Java | cc0-1.0 | 18,119 | [
30522,
7427,
4012,
1012,
12669,
12184,
2818,
3630,
21615,
1012,
17338,
15810,
3401,
1035,
22307,
15864,
1012,
10578,
1025,
12324,
9262,
1012,
22834,
1012,
24880,
2906,
9447,
5833,
18780,
21422,
1025,
12324,
9262,
1012,
22834,
1012,
22834,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*++
Copyright (c) 2012 Microsoft Corporation
Module Name:
FiniteDomainSort.cs
Abstract:
Z3 Managed API: Finite Domain Sorts
Author:
Christoph Wintersteiger (cwinter) 2012-11-23
Notes:
--*/
using System;
using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
/// <summary>
/// Finite domain sorts.
/// </summary>
[ContractVerification(true)]
public class FiniteDomainSort : Sort
{
/// <summary>
/// The size of the finite domain sort.
/// </summary>
public ulong Size
{
get
{
ulong res = 0;
Native.Z3_get_finite_domain_sort_size(Context.nCtx, NativeObject, ref res);
return res;
}
}
#region Internal
internal FiniteDomainSort(Context ctx, IntPtr obj)
: base(ctx, obj)
{
Contract.Requires(ctx != null);
}
internal FiniteDomainSort(Context ctx, Symbol name, ulong size)
: base(ctx, Native.Z3_mk_finite_domain_sort(ctx.nCtx, name.NativeObject, size))
{
Contract.Requires(ctx != null);
Contract.Requires(name != null);
}
#endregion
}
}
| Drup/z3 | src/api/dotnet/FiniteDomainSort.cs | C# | mit | 1,253 | [
30522,
1013,
1008,
1009,
1009,
9385,
1006,
1039,
1007,
2262,
7513,
3840,
11336,
2171,
1024,
10713,
9527,
28247,
11589,
1012,
20116,
10061,
1024,
1062,
2509,
3266,
17928,
1024,
10713,
5884,
11901,
3166,
1024,
21428,
12214,
2618,
17071,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include <stdio.h>
#include "engine/game.c"
int main(int argc, char** argv) {
printf("hello world\n");
return 0;
}
| gluggs/untitledgame | src/main.c | C | mit | 118 | [
30522,
1001,
2421,
1026,
2358,
20617,
1012,
1044,
1028,
1001,
2421,
1000,
3194,
1013,
2208,
1012,
1039,
1000,
20014,
2364,
1006,
20014,
12098,
18195,
1010,
25869,
1008,
1008,
12098,
2290,
2615,
1007,
1063,
6140,
2546,
1006,
1000,
7592,
2088... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.nla.tarotdroid.lib.helpers;
import static com.google.common.base.Preconditions.checkArgument;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* Network and internet connexion helper class.
*/
public class ConnexionHelper {
/**
* Checking for all possible internet providers
* **/
public static boolean isConnectedToInternet(Context context) {
checkArgument(context != null, "context is null");
boolean toReturn = false;
ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity != null)
{
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null)
for (int i = 0; i < info.length; i++)
if (info[i].getState() == NetworkInfo.State.CONNECTED)
{
toReturn = true;
break;
}
}
return toReturn;
}
} | daffycricket/tarotdroid | tarotDroidUiLib/src/main/java/org/nla/tarotdroid/lib/helpers/ConnexionHelper.java | Java | gpl-2.0 | 1,094 | [
30522,
7427,
8917,
1012,
17953,
2050,
1012,
16985,
4140,
22196,
3593,
1012,
5622,
2497,
1012,
2393,
2545,
1025,
12324,
10763,
4012,
1012,
8224,
1012,
2691,
1012,
2918,
1012,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1025,
1232... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Week 5 - Task 7
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.io.*;
public class TCPSerServer
{
private static ServerSocket servSock;
private static final int PORT = 1234;
public static void main(String[] args)
{
System.out.println("!!!Opening port...\n");
try
{
servSock = new ServerSocket(PORT);
}
catch(IOException e)
{
System.out.println("Unable to attach to port!");
System.exit(1);
}
do
{
run();
}while (true);
}
private static void run()
{
Socket link = null;
try{
link = servSock.accept();
PrintWriter out = new PrintWriter(link.getOutputStream(),true);
ObjectInputStream istream = new ObjectInputStream (link.getInputStream());
Person p = null;
while(true){
try{
p = (Person)istream.readObject();
System.out.println("SERVER - Received: New object.\n");
System.out.println("SERVER - Received: Person name=" + p.getName());
System.out.println("SERVER - Received: Person age=" + p.getAge());
System.out.println("SERVER - Received: Person address=" + p.getAddress());
out.println("Person object received.");
}
catch (Exception e) {
System.out.println("Exception in run");
System.out.println("\n* Closing connection... *");
break;
}
}
}
catch(IOException e)
{
e.printStackTrace();
}
finally
{
try
{
System.out.println("\n* Closing connection... *");
link.close();
}
catch(IOException e)
{
System.out.println("Unable to disconnect!");
System.exit(1);
}
}
}
}
| kieranhogan13/Java | Distributed Systems/Labs/Week 7_Lab_Review/Week_3_T7/TCPSerServer.java | Java | mit | 1,769 | [
30522,
1013,
1013,
2733,
1019,
1011,
4708,
1021,
12324,
9262,
1012,
22834,
1012,
6140,
15994,
1025,
12324,
9262,
1012,
22834,
1012,
17698,
2098,
16416,
4063,
1025,
12324,
9262,
1012,
22834,
1012,
20407,
25379,
16416,
4063,
1025,
12324,
9262,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
require 'test/unit'
require 'httpauth/digest'
class DigestConversionsTest < Test::Unit::TestCase
cases = {}
cases[:quote_string] = {
'word' => '"word"',
'word word' => '"word word"'
}
cases[:unquote_string] = cases[:quote_string].invert
cases[:int_to_hex] = {
12 => '0000000c',
1 => '00000001',
65_535 => '0000ffff'
}
cases[:hex_to_int] = cases[:int_to_hex].invert
cases[:str_to_bool] = {
'true' => true,
'false' => false
}
cases[:bool_to_str] = cases[:str_to_bool].invert
cases[:space_quoted_string_to_list] = {
"\"word word word\"" => %w[word word word],
"\"word\"" => ['word']
}
cases[:list_to_space_quoted_string] = cases[:space_quoted_string_to_list].invert
cases[:comma_quoted_string_to_list] = {
"\"word,word,word\"" => %w[word word word],
"\"word\"" => ['word']
}
cases[:list_to_comma_quoted_string] = cases[:comma_quoted_string_to_list].invert
cases.each do |c, expected|
define_method "test_#{c}" do
expected.each do |from, to|
assert_equal to, HTTPAuth::Digest::Conversions.send(c, from)
end
end
end
def test_unquote_string_garbage
assert_equal 'unknown', HTTPAuth::Digest::Conversions.unquote_string('unknown')
assert_equal '', HTTPAuth::Digest::Conversions.unquote_string('')
assert_equal '', HTTPAuth::Digest::Conversions.unquote_string('""')
end
def test_str_to_bool_garbage
assert_equal false, HTTPAuth::Digest::Conversions.str_to_bool('unknown')
end
def test_hex_to_int_garbage
assert_equal 0, HTTPAuth::Digest::Conversions.hex_to_int('unknown')
end
def test_quoted_string_to_list_garbage
assert_equal ['unknown'], HTTPAuth::Digest::Conversions.space_quoted_string_to_list('unknown')
assert_equal ['unknown'], HTTPAuth::Digest::Conversions.comma_quoted_string_to_list('unknown')
end
end
| Manfred/HTTPauth | test/digest_conversions_test.rb | Ruby | mit | 1,918 | [
30522,
1002,
7170,
1035,
4130,
1012,
4895,
6182,
6199,
5371,
1012,
16101,
18442,
1006,
1035,
1035,
5371,
1035,
1035,
1007,
1009,
1005,
1013,
1012,
1012,
1013,
5622,
2497,
1005,
5478,
1005,
3231,
1013,
3131,
1005,
5478,
1005,
8299,
4887,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include "rendertarget.h"
#include <system/engine.h>
#include <renderer/renderer.h>
#include <renderer/forms.h>
using namespace CGE;
RenderTarget* RenderTarget::mCurrTarget = NULL;
void RenderTarget::drawFullscreen(bool transform){
Renderer* rend = Engine::instance()->getRenderer();
if (transform){
rend->ortho(1, 1);
rend->resetModelView();
}
rend->enableDepthTest(false);
CGE::Forms& forms = *CGE::Engine::instance()->getForms();
forms.activateQuad();
rend->enableTexturing(true);
rend->setColor(1, 1, 1, 1);
if (transform){
if (rend->getRenderType() != DirectX){
rend->switchMatrixStack(CGE::MatTexture);
rend->resetModelView();
rend->scale(1, -1, 1);
}
}
for (unsigned i = 0; i < getNumTextures(); ++i){
getTexture(i)->activate(i);
}
forms.drawQuad(Vec2f(), Vec2f(1, 1));
if (transform){
if (rend->getRenderType() != DirectX){
rend->resetModelView();
rend->switchMatrixStack(CGE::Modelview);
}
}
}
| captain-mayhem/captainsengine | Engine/renderer/rendertarget.cpp | C++ | lgpl-2.1 | 994 | [
30522,
1001,
2421,
1000,
17552,
7559,
18150,
1012,
1044,
1000,
1001,
2421,
1026,
2291,
1013,
3194,
1012,
1044,
1028,
1001,
2421,
1026,
17552,
2121,
1013,
17552,
2121,
1012,
1044,
1028,
1001,
2421,
1026,
17552,
2121,
1013,
3596,
1012,
1044,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*************************************************************************/ /*!
@Title Poulsbo linux-specific LVDS functions.
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#include "poulsbo_linux.h"
#if defined(SUPPORT_DRI_DRM)
/******************************************************************************
* Connector functions
******************************************************************************/
static int LVDSConnectorHelperGetModes(struct drm_connector *psConnector)
{
PVRPSB_CONNECTOR *psPVRConnector = to_pvr_connector(psConnector);
struct i2c_adapter *psAdapter = psPVRConnector->psAdapter;
struct edid *psEdid;
psEdid = drm_get_edid(psConnector, psAdapter);
if (psEdid == NULL)
{
return 0;
}
drm_mode_connector_update_edid_property(psConnector, psEdid);
return drm_add_edid_modes(psConnector, psEdid);
}
static int LVDSConnectorHelperModeValid(struct drm_connector *psConnector, struct drm_display_mode *psMode)
{
PVRPSB_DEVINFO *psDevInfo = (PVRPSB_DEVINFO *)psConnector->dev->dev_private;
const PVRPSB_PLL_RANGE *psPllRange = NULL;
int iModeStatus = MODE_BAD;
switch (psDevInfo->eDevice)
{
case PSB_CEDARVIEW:
psPllRange = &sCdvSingleLvdsPllRange;
break;
case PSB_POULSBO:
psPllRange = &sPsbSingleLvdsPllRange;
break;
case PSB_UNKNOWN:
return iModeStatus;
}
if (psMode->flags & DRM_MODE_FLAG_INTERLACE)
{
iModeStatus = MODE_NO_INTERLACE;
}
else if (psMode->flags & DRM_MODE_FLAG_DBLSCAN)
{
iModeStatus = MODE_NO_DBLESCAN;
}
else if (psMode->clock < psPllRange->ui32DotClockMin)
{
iModeStatus = MODE_CLOCK_LOW;
}
else if (psMode->clock > psPllRange->ui32DotClockMax)
{
iModeStatus = MODE_CLOCK_HIGH;
}
#if defined(PVRPSB_WIDTH) && defined(PVRPSB_HEIGHT)
else if (drm_mode_width(psMode) != PVRPSB_WIDTH || drm_mode_height(psMode) != PVRPSB_HEIGHT)
{
iModeStatus = MODE_ONE_SIZE;
}
#endif
#if defined(PVRPSB_VREFRESH)
else if (drm_mode_vrefresh(psMode) != PVRPSB_VREFRESH)
{
iModeStatus = MODE_VSYNC;
}
#endif
else
{
iModeStatus = MODE_OK;
}
return iModeStatus;
}
static struct drm_encoder *LVDSConnectorHelperBestEncoder(struct drm_connector *psConnector)
{
struct drm_mode_object *psObject;
/* Pick the first encoder we find */
if (psConnector->encoder_ids[0] != 0)
{
psObject = drm_mode_object_find(psConnector->dev, psConnector->encoder_ids[0], DRM_MODE_OBJECT_ENCODER);
if (psObject != NULL)
{
return obj_to_encoder(psObject);
}
}
return NULL;
}
static struct drm_connector_helper_funcs sLVDSConnectorHelperFuncs =
{
.get_modes = LVDSConnectorHelperGetModes,
.mode_valid = LVDSConnectorHelperModeValid,
.best_encoder = LVDSConnectorHelperBestEncoder,
};
static void LVDSConnectorSave(struct drm_connector *psConnector)
{
}
static void LVDSConnectorRestore(struct drm_connector *psConnector)
{
}
static enum drm_connector_status LVDSConnectorDetect(struct drm_connector *psConnector, bool force)
{
return connector_status_connected;
}
static int LVDSConnectorSetProperty(struct drm_connector *psConnector, struct drm_property *psProperty, uint64_t ui64Val)
{
return -ENOSYS;
}
static void LVDSConnectorDestroy(struct drm_connector *psConnector)
{
PVRPSB_CONNECTOR *psPVRConnector = to_pvr_connector(psConnector);
drm_mode_connector_update_edid_property(psConnector, NULL);
drm_connector_cleanup(psConnector);
PVRI2CAdapterDestroy(psPVRConnector->psAdapter);
PVROSFreeKernelMem(psPVRConnector);
}
static void LVDSConnectorForce(struct drm_connector *psConnector)
{
/* Not supported */
}
static const struct drm_connector_funcs sLVDSConnectorFuncs =
{
.dpms = drm_helper_connector_dpms,
.save = LVDSConnectorSave,
.restore = LVDSConnectorRestore,
.detect = LVDSConnectorDetect,
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = LVDSConnectorSetProperty,
.destroy = LVDSConnectorDestroy,
.force = LVDSConnectorForce,
};
static PVRPSB_CONNECTOR *LVDSConnectorCreate(PVRPSB_DEVINFO *psDevInfo, struct i2c_adapter *psAdapter)
{
PVRPSB_CONNECTOR *psPVRConnector;
psPVRConnector = (PVRPSB_CONNECTOR *)kzalloc(sizeof(PVRPSB_CONNECTOR), GFP_KERNEL);
if (psPVRConnector)
{
drm_connector_init(psDevInfo->psDrmDev, &psPVRConnector->sConnector, &sLVDSConnectorFuncs, DRM_MODE_CONNECTOR_LVDS);
drm_connector_helper_add(&psPVRConnector->sConnector, &sLVDSConnectorHelperFuncs);
psPVRConnector->psAdapter = psAdapter;
psPVRConnector->ePort = PSB_PORT_LVDS;
}
return psPVRConnector;
}
/******************************************************************************
* Encoder functions
******************************************************************************/
static void LVDSEncoderHelperDpms(struct drm_encoder *psEncoder, int iMode)
{
/* Nothing to do */
}
static bool LVDSEncoderHelperModeFixup(struct drm_encoder *psEncoder, const struct drm_display_mode *psMode, struct drm_display_mode *psAdjustedMode)
{
/* Nothing to do */
return true;
}
static void LVDSEncoderHelperPrepare(struct drm_encoder *psEncoder)
{
PVRPSB_DEVINFO *psDevInfo = (PVRPSB_DEVINFO *)psEncoder->dev->dev_private;
IMG_UINT32 ui32RegVal;
/* Disable port */
ui32RegVal = PVROSReadMMIOReg(psDevInfo, PVRPSB_LVDS_CTL);
ui32RegVal = PVRPSB_LVDS_CTL_ENABLE_SET(ui32RegVal, 0);
PVROSWriteMMIOReg(psDevInfo, PVRPSB_LVDS_CTL, ui32RegVal);
}
static void LVDSEncoderHelperCommit(struct drm_encoder *psEncoder)
{
PVRPSB_DEVINFO *psDevInfo = (PVRPSB_DEVINFO *)psEncoder->dev->dev_private;
IMG_UINT32 ui32RegVal;
/* Enable port */
ui32RegVal = PVROSReadMMIOReg(psDevInfo, PVRPSB_LVDS_CTL);
ui32RegVal = PVRPSB_LVDS_CTL_ENABLE_SET(ui32RegVal, 1);
PVROSWriteMMIOReg(psDevInfo, PVRPSB_LVDS_CTL, ui32RegVal);
}
static void LVDSEncoderHelperModeSet(struct drm_encoder *psEncoder, struct drm_display_mode *psMode, struct drm_display_mode *psAdjustedMode)
{
/* Nothing to do */
}
static const struct drm_encoder_helper_funcs sLVDSEncoderHelperFuncs =
{
.dpms = LVDSEncoderHelperDpms,
.save = NULL,
.restore = NULL,
.mode_fixup = LVDSEncoderHelperModeFixup,
.prepare = LVDSEncoderHelperPrepare,
.commit = LVDSEncoderHelperCommit,
.mode_set = LVDSEncoderHelperModeSet,
.get_crtc = NULL,
.detect = NULL,
.disable = NULL,
};
static void LVDSEncoderDestroy(struct drm_encoder *psEncoder)
{
PVRPSB_ENCODER *psPVREncoder = to_pvr_encoder(psEncoder);
drm_encoder_cleanup(psEncoder);
PVROSFreeKernelMem(psPVREncoder);
}
static const struct drm_encoder_funcs sLVDSEncoderFuncs =
{
.destroy = LVDSEncoderDestroy,
};
static PVRPSB_ENCODER *LVDSEncoderCreate(PVRPSB_DEVINFO *psDevInfo)
{
PVRPSB_ENCODER *psPVREncoder;
psPVREncoder = (PVRPSB_ENCODER *)kzalloc(sizeof(PVRPSB_ENCODER), GFP_KERNEL);
if (psPVREncoder)
{
drm_encoder_init(psDevInfo->psDrmDev, &psPVREncoder->sEncoder, &sLVDSEncoderFuncs, DRM_MODE_ENCODER_LVDS);
drm_encoder_helper_add(&psPVREncoder->sEncoder, &sLVDSEncoderHelperFuncs);
/* This is a bit field that's used to determine by which CRTCs the encoder can be driven.
We have only one CRTC so always set to 0x1 */
psPVREncoder->sEncoder.possible_crtcs = 0x1;
}
return psPVREncoder;
}
/******************************************************************************
* Non-static functions
******************************************************************************/
PSB_ERROR LVDSSetup(PVRPSB_DEVINFO *psDevInfo)
{
if (PVRPSB_LVDS_CTL_ENABLE_GET(PVROSReadMMIOReg(psDevInfo, PVRPSB_LVDS_CTL)) != 0)
{
struct i2c_adapter *psAdapter;
PVRPSB_CONNECTOR *psPVRConnector;
PVRPSB_ENCODER *psPVREncoder;
psAdapter = PVRI2CAdapterCreate(psDevInfo, "PSB I2C Adapter (LVDS)", PVRPSB_GPIO_C, 0);
if (psAdapter == NULL)
{
printk(KERN_ERR DRVNAME " - %s: failed to create an I2C adapter.\n", __FUNCTION__);
return PSB_ERROR_OUT_OF_MEMORY;
}
psPVRConnector = LVDSConnectorCreate(psDevInfo, psAdapter);
if (psPVRConnector == NULL)
{
printk(KERN_ERR DRVNAME " - %s: failed to create an LVDS connector.\n", __FUNCTION__);
PVRI2CAdapterDestroy(psAdapter);
return PSB_ERROR_OUT_OF_MEMORY;
}
psPVREncoder = LVDSEncoderCreate(psDevInfo);
if (psPVREncoder == NULL)
{
printk(KERN_ERR DRVNAME " - %s: failed to create a LVDS encoder.\n", __FUNCTION__);
return PSB_ERROR_OUT_OF_MEMORY;
}
drm_mode_connector_attach_encoder(&psPVRConnector->sConnector, &psPVREncoder->sEncoder);
psDevInfo->sDisplayInfo.ui32PhysicalWidthmm = psPVRConnector->sConnector.display_info.width_mm;
psDevInfo->sDisplayInfo.ui32PhysicalHeightmm = psPVRConnector->sConnector.display_info.height_mm;
}
else
{
printk(KERN_ERR DRVNAME " - %s: no supported output ports found.\n", __FUNCTION__);
return PSB_ERROR_INIT_FAILURE;
}
return PSB_OK;
}
#endif /* #if defined(SUPPORT_DRI_DRM) */
/******************************************************************************
End of file (poulsbo_linux_lvds.c)
******************************************************************************/
| xapp-le/kernel | drivers/gpu/pvr/eurasia_km_linux/services4/3rdparty/dc_poulsbo/poulsbo_linux_lvds.c | C | gpl-2.0 | 11,096 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/******************************************************************************
* Copyright (C) 2006 Jonas Genannt <jonas.genannt@brachium-system.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
******************************************************************************/
if (isset($_POST['autores_submit']))
{
if (empty($_POST['autores_subject']) && $_POST['autores_active'] == 'y')
{
$smarty->assign('error_msg','y');
$smarty->assign('if_error_autores_subject_empty', 'y');
$error=true;
}
else if (empty($_POST['autores_msg']) && $_POST['autores_active'] == 'y')
{
$smarty->assign('error_msg','y');
$smarty->assign('if_error_autores_msg_empty', 'y');
$error=true;
}
else if(strlen($_POST['autores_subject']) > 50 && $_POST['autores_active'] == 'y')
{
$smarty->assign('error_msg','y');
$smarty->assign('if_error_autores_subject_to_long', 'y');
$error=true;
}
else if ( $_POST['autores_sendback_times'] != "n" && ($_POST['autores_sendback_times'] < 1 && $_POST['autores_sendback_times'] > 5 ))
{
$smarty->assign('error_msg','y');
$smarty->assign('if_error_autores_send_times', 'y');
$error=true;
}
else
{
save_autoresponder($_SESSION['uid'],
$_POST['autores_active'],
$_POST['autores_subject'],
$_POST['autores_msg'], $_POST['autores_sendback_times']);
// activate System-Script
run_systemscripts();
}
}
if (isset($_POST['val_tos_active'])&& is_numeric($_POST['val_tos_active'])) {
update_email_options($_SESSION['uid'],"auto_val_tos_active",$_POST['val_tos_active'], 0);
}
if(isset($_POST['val_tos_del'])) {
val_tos_del($_SESSION['uid'],$_POST['val_tos']);
}
if(isset($_POST['val_tos_add'])) {
if (val_tos_add($_SESSION['uid'], $_POST['val_tos_da'])== 1) {
$smarty->assign('error_msg','y');
$smarty->assign('if_submit_email_wrong', 'y');
}
}
//xheader disable feature
if ($_SESSION['p_autores_xheader'] == 1) {
if (isset($_GET['xheader']) && is_numeric($_GET['xheader']) && isset($_GET['do']) && $_GET['do']=='del') {
$sql=sprintf("DELETE FROM autoresponder_xheader WHERE email='%d' AND id='%d'",
$db->escapeSimple($_SESSION['uid']),
$db->escapeSimple($_GET['xheader']));
$db->query($sql);
}
if (isset($_POST['xheader_submit'])) {
if (!empty($_POST['xheader_name']) && !empty($_POST['xheader_value'])) {
$sql=sprintf("INSERT INTO autoresponder_xheader SET email='%d',xheader='%s',value='%s'",
$db->escapeSimple($_SESSION['uid']),
$db->escapeSimple($_POST['xheader_name']),
$db->escapeSimple($_POST['xheader_value']));
$db->query($sql);
}
else {
$smarty->assign('error_msg','y');
$smarty->assign('if_xheader_empty', 'y');
}
}
}
//save automatic autoresponder disable feaure
if (isset($_POST['autores_datedisable_submit'])) {
if ($_POST['autores_datedisable_active'] == 0) {
$sql=sprintf("UPDATE autoresponder_disable SET active='0' WHERE email='%d'",
$db->escapeSimple($_SESSION['uid']));
$result=&$db->query($sql);
}
elseif (! preg_match('/^([0-9]{2}).([0-9]{2}).([0-9]{4})$/', $_POST['autores_datedisable_date'])) {
$smarty->assign('error_msg','y');
$smarty->assign('if_error_autores_date_wrong', 'y');
}
elseif (! preg_match('/^([0-9]{2}):([0-9]{2}):([0-9]{2})$/', $_POST['autores_datedisable_time'])) {
$smarty->assign('error_msg','y');
$smarty->assign('if_error_autores_time_wrong', 'y');
}
elseif (! check_autores_date_disable($_POST['autores_datedisable_date'],$_POST['autores_datedisable_time'])) {
$smarty->assign('error_msg','y');
$smarty->assign('if_error_autores_disable_in_past', 'y');
}
else {
$unix_time=autores_date_format($_POST['autores_datedisable_date'],$_POST['autores_datedisable_time']);
$sql=sprintf("SELECT id FROM autoresponder_disable WHERE email='%d'",
$db->escapeSimple($_SESSION['uid']));
$result=&$db->query($sql);
if ($result->numRows() == 1) {
$data=$result->fetchrow(DB_FETCHMODE_ASSOC);
$sql=sprintf("UPDATE autoresponder_disable SET a_date=FROM_UNIXTIME('%s'), active='1' WHERE email='%d'",
$db->escapeSimple($unix_time),
$db->escapeSimple($_SESSION['uid']));
}
else {
$sql=sprintf("INSERT INTO autoresponder_disable SET a_date=FROM_UNIXTIME('%s'),email='%d',active='1'",
$db->escapeSimple($unix_time),
$db->escapeSimple($_SESSION['uid']));
}
$result=&$db->query($sql);
}
}
$sql=sprintf("SELECT id,email,active,msg,esubject,times FROM autoresponder WHERE email='%d'",
$db->escapeSimple($_SESSION['uid']));
$result=&$db->query($sql);
if ($result->numRows()==1)
{
$data=$result->fetchrow(DB_FETCHMODE_ASSOC);
$active=$data['active'];
$msg=$data['msg'];
$esubject=$data['esubject'];
$id=$data['id'];
$times=$data['times'];
}
elseif(isset($error))
{
$active=$_POST['autores_active'];
$msg=$_POST['autores_msg'];
$esubject=$_POST['autores_subject'];
$times=$_POST['autores_sendback_times'];
}
else
{
$active='n';
}
// outout val_tos
$sql=sprintf("SELECT recip,id FROM autoresponder_recipient WHERE email='%d'",
$db->escapeSimple($_SESSION['uid']));
$result=&$db->query($sql);
$table_val_tos = array();
while($data=$result->fetchrow(DB_FETCHMODE_ASSOC)) {
array_push($table_val_tos,array(
'recip' => $data['recip'],
'id' => $data['id']));
}
//output val_tos_active
$val_tos_active = get_email_options($_SESSION['uid'],"auto_val_tos_active", 0);
$smarty->assign('val_tos_active', $val_tos_active);
//output autoresponder disabled feature
$autores_disable=get_autores_disable($_SESSION['uid']);
//output xheader feature
if ($_SESSION['p_autores_xheader'] == 1) {
$sql=sprintf("SELECT * FROM autoresponder_xheader WHERE email='%d' ORDER BY xheader",
$db->escapeSimple($_SESSION['uid']));
$result=&$db->query($sql);
$table_xheader=array();
while($data=$result->fetchrow(DB_FETCHMODE_ASSOC)) {
array_push($table_xheader,array(
'id' => $data['id'],
'xheader' => $data['xheader'],
'value' => $data['value']));
}
$smarty->assign('table_xheader',$table_xheader);
}
if(isset($autores_disable)) $smarty->assign('autores_disable', $autores_disable);
else $smarty->assign('autores_disable', false);
if(isset($table_val_tos)) $smarty->assign('table_val_tos', $table_val_tos);
else $smarty->assign('table_val_tos', false);
if(isset($esubject)) $smarty->assign('autores_subject', $esubject);
else $smarty->assign('autores_subject', false);
if(isset($active)) $smarty->assign('autores_active', $active);
else $smarty->assign('autores_active', $active);
if(isset($times)) $smarty->assign('autores_sendback_times_value', $times);
else $smarty->assign('autores_sendback_times_value', false);
if(isset($id)) $smarty->assign('id', $id);
else $smarty->assign('id', false);
if(isset($msg)) $smarty->assign('autores_msg', $msg);
else $smarty->assign('autores_msg', false);
if(isset($_SESSION['email'])) $smarty->assign('email', $_SESSION['email']);
else $smarty->assign('email', false);
| hggh/cpves | includes/sites/user_autores.php | PHP | agpl-3.0 | 7,545 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html" />
<meta name="keywords" content="tiny mt" />
<title>TinyMT Jump Function</title>
<style type="text/css">
TABLE.numeric TD {text-align:right}
DD.gray {color:gray}
body {margin-right:10%;margin-left:10%}
</style>
</head>
<body>
<h2>TinyMT Jump Function</h2>
<h2>READ ME FIRST</h2>
<p>
Jump 関数は疑似乱数生成器 TinyMT の内部状態をN個先にジャンプさせます。
Nが大きい場合、このジャンプはN個の疑似乱数を生成するよりもずっと速く実行出来ます。
Jump 関数を使用することによって、疑似乱数の出力の中から重複しない部分列を得ること
ができます。
</p>
<p>Jump 関数はC言語で書かれていて、標準ライブラリ以外のライブラリを使用していません。
ただし、c99 の stdint.h と inttypes.h を使用しています。
</p>
<h2>TinyMTを用いて疑似乱数列を並列に生成する方法の比較</h2>
<ol>
<li>パラメータを一つ使用し、seedを変えることによって複数の疑似乱
数列を得る方法。この方法によって得られた数列は一つの疑似乱数列
の部分数列ですが、それぞれの部分数列が他の部分数列とどれだけ離
れているかを知ることは難しい。最悪の場合、疑似乱数列が重複する
可能性があります。ただし、重複する可能性は通常無視出来るほど小
さいと考えられます。一方、同一のパラメータを使用することから、
マルチスレッドのようなメモリ共有並列モデルでは、パラメータを定
数にすることができます。
</li>
<li>パラメータを一つ使用し、jumpによって、複数の疑似乱数列を得る
方法。この方法によって得られる数列も一つの疑似乱数列の部分数列
ですが、それがお互いにどのくらい離れているかは、分かっています。
つまり、jump で指定した値だけ離れています。<!-- この方法で得られる数
列は、同じパラメータセットから作られるので、特定のビットの間に
線形関係が存在するかも知れません。そのような線形関係はモンテ
カルロ・シミュレーションの結果に影響するかも知れないし、影響し
ないかも知れません。-->マルチスレッドなどのメモリ共有並列モデルで
は、パラメータを定数にすることができます。
</li>
<li>個々の疑似乱数列に異なるパラメータを使用して、複数の疑似乱数列を得る方法。
三つの方法の中で、各疑似乱数列の独立性が最も高いと考えられます。
パラメータを定数にすることが出来ないのでメモリ消費量が増えます。</li>
</ol>
<p>このjump関数は二番目の方法を提供します。ただし、メモリを節約するプログラムは
用意していないので、メモリを節約したければ、ユーザー自身で構造体を書き換え、
パラメータを定数として定義する必要があります。</p>
<h2>使用方法</h2>
<h3>テストプログラムのコンパイル</h3>
<p>
Jump プログラムは単独ではコンパイルできません。TinyMT のソースファイルが
必要です。また、実行にはTinyMTDCの出力パラメータが必要です。</p>
<ol>
<li>アーカイブファイルを解凍します。</li>
<li>出来たディレクトリ(TinyMTJump-src-xxx)の中のjumpディレクトリを
TinyMTのディクレクトリにコピーします。</li>
<pre>
TinyMT-src-xxx
+---dc
+---tinymt
+---jump
</pre>
<li>コピーしたjumpディレクトリにcd します。</li>
<li>make all でテスト用のプログラムがコンパイルされます。</li>
<li><b>./jump_test32 d8524022ed8dff4a8dcc50c798faba43 8f7011ee fc78ff1f 3793fdff 1298</b></li>
<li>OK が表示されていることと、NGが表示されていないことを確認します。</li>
</ol>
<h3>関数の説明</h3>
<pre>
void tinymt32_jump(tinymt32c_t *tiny,
uint64_t lower_step,
uint64_t upper_step,
const char * poly_str);
</pre>
<dl>
<dt>この関数はtinymt32の内部状態をlower_step と upper_step で表される
0から2<sup>128</sup>-1の範囲内の任意のステップ先にジャンプさせます。
</dt>
<dd>tiny は状態をjumpさせるtinymt32_t 型の構造体です。
tiny は初期化をしてある必要があります。jump 後の状態で上書きされます。</dd>
<dd>lower_step と upper_step は何個先の状態にjumpするかを示します。</dd>
<dd>poly_str は tinymt32dc の出力のパラメータセットの中のcharacteristic
カラムを文字列として渡します。</dd>
</dl>
<pre>
void calculate_jump_polynomial(f2_polynomial *jump_poly,
uint64_t lower_step,
uint64_t upper_step,
const char * poly_str);
</pre>
<dt>この関数は、特性多項式とlower_step, upper_stepからジャンプ多項式を計算します。
この関数の実行にはやや時間がかかります。ジャンプ多項式を一度求めたら、それを複数回
使用するとよいでしょう。ただし、特性多項式が異なる場合は、ジャンプ多項式を計算し
なおす必要があります。
</dt>
<dd>jump_poly には計算結果のジャンプ多項式が入ります。</dd>
<dd>lower_step と upper_step は何個先の状態にjumpするかを示します。</dd>
<dd>poly_str は tinymt32dc の出力のパラメータセットの中のcharacteristic
カラムを文字列として渡します。</dd>
</dl>
<pre>
void tinymt32_jump_by_polynomial(tinymt32_t *tiny,
f2_polynomial * jump_poly);
</pre>
<dl>
<dt>この関数は計算済みのジャンプ多項式を使って、tinymt32の内部状態をジャンプさせます。
ジャンプ多項式の計算よりもこの関数によるジャンプの方が速いので、多項式を何度も
計算するよりこの関数を複数回実行した方が速くなります。
</dt>
<dd>tiny は状態をjumpさせるtinymt32_t 型の構造体です。
tiny は初期化をしてある必要があります。jump 後の状態で上書きされます。</dd>
<dd>jump_polyはcalculate_jump_polynomial関数で計算したジャンプ多項式です。
ここで使用するtinyの特性多項式を使って計算したジャンプ多項式でなければなりません。
</dd>
</dl>
<h3>サンプルプログラム</h3>
<p>サンプルプログラム<a href="sample.c">sample.c</a>を挙げておきます。</p>
</body>
</html>
| RobertGBryan/TinyMTCPP | TinyMT-src-1.0.1 Orig C Code/TinyMTJump-src-1.1/readme-jp.html | HTML | bsd-3-clause | 7,381 | [
30522,
1026,
1029,
20950,
2544,
1027,
1000,
1015,
1012,
1014,
1000,
17181,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1029,
1028,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace PlentymarketsAdapter\ServiceBus\QueryHandler\OrderStatus;
use PlentyConnector\Connector\ServiceBus\Query\FetchTransferObjectQuery;
use PlentyConnector\Connector\ServiceBus\Query\QueryInterface;
use PlentyConnector\Connector\ServiceBus\QueryHandler\QueryHandlerInterface;
use PlentyConnector\Connector\ServiceBus\QueryType;
use PlentyConnector\Connector\TransferObject\OrderStatus\OrderStatus;
use PlentymarketsAdapter\Client\ClientInterface;
use PlentymarketsAdapter\PlentymarketsAdapter;
use PlentymarketsAdapter\ResponseParser\OrderStatus\OrderStatusResponseParserInterface;
/**
* Class FetchAllOrderStatusesQueryHandler
*/
class FetchAllOrderStatusesQueryHandler implements QueryHandlerInterface
{
/**
* @var ClientInterface
*/
private $client;
/**
* @var OrderStatusResponseParserInterface
*/
private $responseParser;
/**
* OrderStatusResponseParserInterface constructor.
*
* @param ClientInterface $client
* @param OrderStatusResponseParserInterface $responseParser
*/
public function __construct(
ClientInterface $client,
OrderStatusResponseParserInterface $responseParser
) {
$this->client = $client;
$this->responseParser = $responseParser;
}
/**
* {@inheritdoc}
*/
public function supports(QueryInterface $query)
{
return $query instanceof FetchTransferObjectQuery &&
$query->getAdapterName() === PlentymarketsAdapter::NAME &&
$query->getObjectType() === OrderStatus::TYPE &&
$query->getQueryType() === QueryType::ALL;
}
/**
* {@inheritdoc}
*/
public function handle(QueryInterface $query)
{
$elements = $this->client->getIterator('orders/statuses', ['with' => 'names']);
foreach ($elements as $element) {
$result = $this->responseParser->parse($element);
if (null === $result) {
continue;
}
yield $result;
}
}
}
| Pfabeck/plentymarkets-shopware-connector | Adapter/PlentymarketsAdapter/ServiceBus/QueryHandler/OrderStatus/FetchAllOrderStatusesQueryHandler.php | PHP | mit | 2,062 | [
30522,
1026,
1029,
25718,
3415,
15327,
7564,
20285,
3736,
2850,
13876,
2121,
1032,
2326,
8286,
1032,
23032,
11774,
3917,
1032,
4449,
29336,
2271,
1025,
2224,
7564,
8663,
2638,
16761,
1032,
19400,
1032,
2326,
8286,
1032,
23032,
1032,
18584,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package bamboo.crawl;
import java.util.Date;
import java.util.concurrent.TimeUnit;
public class RecordStats {
private static final Date MAX_TIME = new Date(System.currentTimeMillis() + TimeUnit.DAYS.toMillis(900));
private static final Date MIN_TIME = new Date(631152000000L);
private long records;
private long recordBytes;
private Date startTime = null;
private Date endTime = null;
public void update(long recordLength, Date time) {
records += 1;
recordBytes += recordLength;
if (time.after(MIN_TIME) && time.before(MAX_TIME)) {
if (startTime == null || time.before(startTime)) {
startTime = time;
}
if (endTime == null || time.after(endTime)) {
endTime = time;
}
}
}
public long getRecords() {
return records;
}
public long getRecordBytes() {
return recordBytes;
}
public Date getStartTime() {
return startTime;
}
public Date getEndTime() {
return endTime;
}
@Override
public String toString() {
return "RecordStats{" +
"records=" + records +
", recordBytes=" + recordBytes +
", startTime=" + startTime +
", endTime=" + endTime +
'}';
}
}
| nla/bamboo | ui/src/bamboo/crawl/RecordStats.java | Java | apache-2.0 | 1,362 | [
30522,
7427,
15216,
1012,
13529,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
3058,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
16483,
1012,
2051,
19496,
2102,
1025,
2270,
2465,
2636,
29336,
2015,
1063,
2797,
30524,
7292,
19912,
2483,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//===------ polly/SCEVAffinator.h - Create isl expressions from SCEVs -----===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Create a polyhedral description for a SCEV value.
//
//===----------------------------------------------------------------------===//
#ifndef POLLY_SCEV_AFFINATOR_H
#define POLLY_SCEV_AFFINATOR_H
#include "llvm/ADT/DenseMap.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "isl/ctx.h"
struct isl_ctx;
struct isl_map;
struct isl_basic_map;
struct isl_id;
struct isl_set;
struct isl_union_set;
struct isl_union_map;
struct isl_space;
struct isl_ast_build;
struct isl_constraint;
struct isl_pw_aff;
struct isl_schedule;
namespace llvm {
class Region;
class BasicBlock;
class DataLayout;
class ScalarEvolution;
} // namespace llvm
namespace polly {
class Scop;
class ScopStmt;
/// The result type of the SCEVAffinator.
///
/// The first element of the pair is the isl representation of the SCEV, the
/// second is the domain under which it is __invalid__.
typedef std::pair<isl_pw_aff *, isl_set *> PWACtx;
/// Translate a SCEV to an isl_pw_aff and the domain on which it is invalid.
struct SCEVAffinator : public llvm::SCEVVisitor<SCEVAffinator, PWACtx> {
public:
SCEVAffinator(Scop *S, llvm::LoopInfo &LI);
~SCEVAffinator();
/// Translate a SCEV to an isl_pw_aff.
///
/// @param E he expression that is translated.
/// @param BB The block in which @p E is executed.
///
/// @returns The isl representation of the SCEV @p E in @p Domain.
__isl_give PWACtx getPwAff(const llvm::SCEV *E,
llvm::BasicBlock *BB = nullptr);
/// Take the asumption that @p PWAC is non-negative.
void takeNonNegativeAssumption(PWACtx &PWAC);
/// Interpret the PWA in @p PWAC as an unsigned value.
void interpretAsUnsigned(__isl_keep PWACtx &PWAC, unsigned Width);
/// Check an <nsw> AddRec for the loop @p L is cached.
bool hasNSWAddRecForLoop(llvm::Loop *L) const;
private:
/// Key to identify cached expressions.
using CacheKey = std::pair<const llvm::SCEV *, llvm::BasicBlock *>;
/// Map to remembered cached expressions.
llvm::DenseMap<CacheKey, PWACtx> CachedExpressions;
Scop *S;
isl_ctx *Ctx;
unsigned NumIterators;
llvm::ScalarEvolution &SE;
llvm::LoopInfo &LI;
llvm::BasicBlock *BB;
/// Target data for element size computing.
const llvm::DataLayout &TD;
/// Return the loop for the current block if any.
llvm::Loop *getScope();
/// Return a PWACtx for @p PWA that is always valid.
__isl_give PWACtx getPWACtxFromPWA(__isl_take isl_pw_aff *PWA);
/// Compute the non-wrapping version of @p PWA for type @p ExprType.
///
/// @param PWA The piece-wise affine function that might wrap.
/// @param Type The type of the SCEV that was translated to @p PWA.
///
/// @returns The expr @p PWA modulo the size constraints of @p ExprType.
__isl_give isl_pw_aff *addModuloSemantic(__isl_take isl_pw_aff *PWA,
llvm::Type *ExprType) const;
/// If @p Expr might cause an integer wrap record an assumption.
///
/// @param Expr The SCEV expression that might wrap.
/// @param PWAC The isl representation of @p Expr with the invalid domain.
///
/// @returns The isl representation @p PWAC with a posisbly adjusted domain.
__isl_give PWACtx checkForWrapping(const llvm::SCEV *Expr, PWACtx PWAC) const;
/// Whether to track the value of this expression precisely, rather than
/// assuming it won't wrap.
bool computeModuloForExpr(const llvm::SCEV *Expr);
__isl_give PWACtx visit(const llvm::SCEV *E);
__isl_give PWACtx visitConstant(const llvm::SCEVConstant *E);
__isl_give PWACtx visitTruncateExpr(const llvm::SCEVTruncateExpr *E);
__isl_give PWACtx visitZeroExtendExpr(const llvm::SCEVZeroExtendExpr *E);
__isl_give PWACtx visitSignExtendExpr(const llvm::SCEVSignExtendExpr *E);
__isl_give PWACtx visitAddExpr(const llvm::SCEVAddExpr *E);
__isl_give PWACtx visitMulExpr(const llvm::SCEVMulExpr *E);
__isl_give PWACtx visitUDivExpr(const llvm::SCEVUDivExpr *E);
__isl_give PWACtx visitAddRecExpr(const llvm::SCEVAddRecExpr *E);
__isl_give PWACtx visitSMaxExpr(const llvm::SCEVSMaxExpr *E);
__isl_give PWACtx visitUMaxExpr(const llvm::SCEVUMaxExpr *E);
__isl_give PWACtx visitUnknown(const llvm::SCEVUnknown *E);
__isl_give PWACtx visitSDivInstruction(llvm::Instruction *SDiv);
__isl_give PWACtx visitSRemInstruction(llvm::Instruction *SRem);
friend struct llvm::SCEVVisitor<SCEVAffinator, PWACtx>;
};
} // namespace polly
#endif
| ensemblr/llvm-project-boilerplate | include/llvm/tools/polly/include/polly/Support/SCEVAffinator.h | C | mit | 4,779 | [
30522,
1013,
1013,
1027,
1027,
1027,
1011,
1011,
1011,
1011,
1011,
1011,
17543,
1013,
8040,
13331,
15379,
8844,
1012,
1044,
1011,
3443,
2003,
2140,
11423,
2013,
8040,
6777,
2015,
1011,
1011,
1011,
1011,
1011,
1027,
1027,
1027,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
--------------------------------------------------------------------------------
-- form.lua, v0.3: generates html for forms
-- This file is a part of Sailor project
-- Copyright (c) 2014 Etiene Dalcol <dalcol@etiene.net>
-- License: MIT
-- http://sailorproject.org
--------------------------------------------------------------------------------
local form = {}
local tinsert, tconcat = table.insert, table.concat
local model_name
local meta = {}
meta.__call = function(_,mname)
model_name = mname
return form
end
setmetatable(form,meta)
local function defaults(model,attribute,html_options)
return model[attribute] or '', model['@name']..':'..attribute, html_options or ''
end
function form.text(model,attribute,html_options)
local value, name, html_options = defaults(model,attribute,html_options)
return '<input type="text" value="'..value..'" name="'..name..'" '..html_options..' />'
end
function form.textarea(model,attribute,html_options)
local value, name, html_options = defaults(model,attribute,html_options)
return '<textarea name="'..name..'" '..html_options..'>'..value..'</textarea>'
end
function form.file(model,attribute,html_options)
local value, name, html_options = defaults(model,attribute,html_options)
return '<input type="file" name="'..name..'" '..html_options..'>'..value..'</textarea>'
end
function form.dropdown(model,attribute,list,prompt,html_options)
local value, name, html_options = defaults(model,attribute,html_options)
list = list or {}
local html = {}
tinsert(html,'<select name="'..name..'" '..html_options..'>')
if prompt then
tinsert(html,'<option value="" selected>'..prompt..'</option>')
end
for k,v in pairs(list) do
local selected = ''
if k == value then
selected = ' selected'
end
tinsert(html,'<option value="'..k..'"'..selected..'>'..v..'</option>')
end
tinsert(html,'</select>')
return tconcat(html)
end
function form.password(model,attribute,html_options)
local value, name, html_options = defaults(model,attribute,html_options)
return '<input type="password" value="'..value..'" name="'..name..'" '..html_options..' />'
end
-- layout: horizontal(default) or vertical
function form.radio_list(model,attribute,list,default,layout,html_options)
local value, name, html_options = defaults(model,attribute,html_options)
list = list or {}
local html = {}
for k,v in pairs(list) do
local check = ''
if k == value or (value == '' and k == default) then
check = ' checked'
end
tinsert(html, '<input type="radio" name="'..name..'" '..'value="'..k..'" '..check..html_options..'/> '..v)
end
if layout == 'vertical' then
return tconcat(html,'<br/>')
end
return tconcat(html,' ')
end
-- checked: boolean
function form.checkbox(model,attribute,label,checked,html_options)
local value, name, html_options = defaults(model,attribute,html_options)
label = label or attribute
local check = ''
if (value ~= nil and value ~= '' and value ~= 0 and value ~= '0') or checked == true then
check = ' checked '
end
return '<input type="checkbox" name="'..name..'"'..check..html_options..'/> '..label
end
function form.ify(data)
local new_data = {}
for k,v in pairs(data) do
new_data[model_name .. ':' .. k] = v
end
return new_data
end
return form
| jeary/sailor | src/sailor/form.lua | Lua | mit | 3,256 | [
30522,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
--><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">
<meta name="generator" content="joDoc">
<title>Apache Cordova API Documentation</title>
<link rel="stylesheet" type="text/css" href="index.css">
<link rel="stylesheet" type="text/css" href="mobile.css" media="only screen and (max-device-width: 1024px)">
<link rel="stylesheet" type="text/css" href="prettify/prettify.css">
</head>
<body>
<div id="header">
<h1><a href="index.html">Apache <strong>Cordova</strong> Documentation</a></h1>
<small>
<select><optgroup label="English" value="en">
<option value="edge">edge</option>
<option value="2.9.0rc1">2.9.0rc1</option>
<option selected value="2.9.0">2.9.0</option>
<option value="2.8.0">2.8.0</option>
<option value="2.7.0rc1">2.7.0rc1</option>
<option value="2.7.0">2.7.0</option>
<option value="2.6.0rc1">2.6.0rc1</option>
<option value="2.6.0">2.6.0</option>
<option value="2.5.0rc1">2.5.0rc1</option>
<option value="2.5.0">2.5.0</option>
<option value="2.4.0rc1">2.4.0rc1</option>
<option value="2.4.0">2.4.0</option>
<option value="2.3.0rc2">2.3.0rc2</option>
<option value="2.3.0rc1">2.3.0rc1</option>
<option value="2.3.0">2.3.0</option>
<option value="2.2.0rc2">2.2.0rc2</option>
<option value="2.2.0rc1">2.2.0rc1</option>
<option value="2.2.0">2.2.0</option>
<option value="2.1.0rc2">2.1.0rc2</option>
<option value="2.1.0rc1">2.1.0rc1</option>
<option value="2.1.0">2.1.0</option>
<option value="2.0.0rc1">2.0.0rc1</option>
<option value="2.0.0">2.0.0</option>
<option value="1.9.0rc1">1.9.0rc1</option>
<option value="1.9.0">1.9.0</option>
<option value="1.8.1">1.8.1</option>
<option value="1.8.0rc1">1.8.0rc1</option>
<option value="1.8.0">1.8.0</option>
<option value="1.7.0rc1">1.7.0rc1</option>
<option value="1.7.0">1.7.0</option>
<option value="1.6.1">1.6.1</option>
<option value="1.6.0rc1">1.6.0rc1</option>
<option value="1.6.0">1.6.0</option>
<option value="1.5.0rc1">1.5.0rc1</option>
<option value="1.5.0">1.5.0</option>
</optgroup>
<optgroup label="Japanese" value="jp">
<option value="2.2.0">2.2.0</option>
<option value="2.1.0">2.1.0</option>
<option value="2.0.0">2.0.0</option>
<option value="1.9.0">1.9.0</option>
<option value="1.8.1">1.8.1</option>
<option value="1.7.0">1.7.0</option>
</optgroup>
<optgroup label="Korean" value="kr"><option value="2.0.0">2.0.0</option></optgroup></select></small>
</div>
<div id="subheader">
<h1>Upgrading Guides</h1>
<small></small>
</div>
<div id="sidebar">
<div class="vertical_divider"></div>
<h1>API Reference</h1>
<ul>
<li><a href="cordova_accelerometer_accelerometer.md.html#Accelerometer">Accelerometer</a></li>
<li><a href="cordova_camera_camera.md.html#Camera">Camera</a></li>
<li><a href="cordova_media_capture_capture.md.html#Capture">Capture</a></li>
<li><a href="cordova_compass_compass.md.html#Compass">Compass</a></li>
<li><a href="cordova_connection_connection.md.html#Connection">Connection</a></li>
<li><a href="cordova_contacts_contacts.md.html#Contacts">Contacts</a></li>
<li><a href="cordova_device_device.md.html#Device">Device</a></li>
<li><a href="cordova_events_events.md.html#Events">Events</a></li>
<li><a href="cordova_file_file.md.html#File">File</a></li>
<li><a href="cordova_geolocation_geolocation.md.html#Geolocation">Geolocation</a></li>
<li><a href="cordova_globalization_globalization.md.html#Globalization">Globalization</a></li>
<li><a href="cordova_inappbrowser_inappbrowser.md.html#InAppBrowser">InAppBrowser</a></li>
<li><a href="cordova_media_media.md.html#Media">Media</a></li>
<li><a href="cordova_notification_notification.md.html#Notification">Notification</a></li>
<li><a href="cordova_splashscreen_splashscreen.md.html#Splashscreen">Splashscreen</a></li>
<li><a href="cordova_storage_storage.md.html#Storage">Storage</a></li>
</ul>
<h1>Guides</h1>
<ul>
<li><a href="guide_overview_index.md.html#Overview">Overview</a></li>
<li><a href="guide_getting-started_index.md.html#Platform%20Guides">Platform Guides</a></li>
<li><a href="guide_cli_index.md.html#The%20Cordova%20Command-line%20Interface">The Cordova Command-line Interface</a></li>
<li><a href="guide_command-line_index.md.html#Command-Line%20Usage">Command-Line Usage</a></li>
<li><a href="guide_privacy_index.md.html#Privacy%20Guide">Privacy Guide</a></li>
<li><a href="guide_upgrading_index.md.html#Upgrading%20Guides">Upgrading Guides</a></li>
<li><a href="guide_project-settings_index.md.html#Project%20Settings">Project Settings</a></li>
<li><a href="guide_plugin-development_index.md.html#Plugin%20Development%20Guide">Plugin Development Guide</a></li>
<li><a href="guide_whitelist_index.md.html#Domain%20Whitelist%20Guide">Domain Whitelist Guide</a></li>
<li><a href="guide_cordova-webview_index.md.html#Embedding%20WebView">Embedding WebView</a></li>
<li><a href="_index.html">Keyword Index</a></li>
</ul>
</div>
<div id="scrollable">
<div id="content">
<h1><a name="Upgrading%20Guides">Upgrading Guides</a></h1>
<blockquote>
<p>Learn how to upgrade an application to the latest Apache Cordova release.</p>
</blockquote>
<ul>
<li><a href="guide_upgrading_android_index.md.html#Upgrading%20Cordova%20Android">Upgrading Cordova Android</a></li>
<li><a href="guide_upgrading_blackberry_index.md.html#Upgrading%20Cordova%20BlackBerry">Upgrading Cordova BlackBerry</a></li>
<li><a href="guide_upgrading_ios_index.md.html#Upgrading%20Cordova%20iOS">Upgrading Cordova iOS</a></li>
<li><a href="guide_upgrading_windows-phone_index.md.html#Upgrading%20Cordova%20Windows%20Phone">Upgrading Cordova Windows Phone</a></li>
<li><a href="guide_upgrading_windows-8_index.md.html#Upgrading%20Cordova%20Windows%208">Upgrading Cordova Windows 8</a></li>
</ul>
</div>
</div>
<!-- Functionality and Syntax Highlighting -->
<script type="text/javascript" src="index.js"></script><script type="text/javascript" src="prettify/prettify.js"></script>
</body>
</html>
| csantanapr/cordova-blog | public/docs/en/2.9.0/guide_upgrading_index.md.html | HTML | apache-2.0 | 6,999 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
999,
1011,
1011,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
2023,
2147,
2005,
3176,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# frozen_string_literal: true
require "test_helper"
module GobiertoAdmin
class UserFormTest < ActiveSupport::TestCase
def valid_user_form
@valid_user_form ||= UserForm.new(
id: user.id,
name: user.name,
bio: user.bio,
email: user.email
)
end
def invalid_user_form
@invalid_user_form ||= UserForm.new(
name: nil,
email: nil
)
end
def user
@user ||= users(:reed)
end
def test_save_with_valid_attributes
assert valid_user_form.save
end
def test_save_with_invalid_attributes
refute invalid_user_form.save
end
def test_error_messages_with_invalid_attributes
invalid_user_form.save
assert_equal 1, invalid_user_form.errors.messages[:name].size
assert_equal 1, invalid_user_form.errors.messages[:email].size
end
def test_confirmation_email_delivery_when_changing_email
email_changing_form = UserForm.new(
id: user.id,
email: "wadus@gobierto.dev",
name: "Wadus"
)
assert_difference "ActionMailer::Base.deliveries.size", 1 do
email_changing_form.save
end
end
def test_confirmation_email_delivery_when_not_changing_email
assert_no_difference "ActionMailer::Base.deliveries.size" do
valid_user_form.save
end
end
end
end
| PopulateTools/gobierto-dev | test/forms/gobierto_admin/user_form_test.rb | Ruby | agpl-3.0 | 1,372 | [
30522,
1001,
7708,
1035,
5164,
1035,
18204,
1024,
2995,
5478,
1000,
3231,
1035,
2393,
2121,
1000,
11336,
2175,
11283,
5339,
10441,
22117,
2378,
2465,
5310,
14192,
22199,
1026,
3161,
6342,
9397,
11589,
1024,
1024,
3231,
18382,
13366,
9398,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Copyright (C) 2015 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from django.utils.translation import ngettext_lazy
from horizon import tables
from openstack_dashboard import api
from openstack_dashboard import policy
class AddProtocol(policy.PolicyTargetMixin, tables.LinkAction):
name = "create"
verbose_name = _("Add Protocol")
url = "horizon:identity:identity_providers:protocols:create"
classes = ("ajax-modal",)
icon = "plus"
policy_rules = (("identity", "identity:create_protocol"),)
def get_link_url(self, datum=None):
idp_id = self.table.kwargs['identity_provider_id']
return reverse(self.url, args=(idp_id,))
class RemoveProtocol(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod
def action_present(count):
return ngettext_lazy(
"Delete Protocol",
"Delete Protocols",
count
)
@staticmethod
def action_past(count):
return ngettext_lazy(
"Deleted Protocol",
"Deleted Protocols",
count
)
policy_rules = (("identity", "identity:delete_protocol"),)
def delete(self, request, obj_id):
identity_provider = self.table.kwargs['identity_provider_id']
protocol = obj_id
api.keystone.protocol_delete(request, identity_provider, protocol)
class ProtocolsTable(tables.DataTable):
protocol = tables.Column("id",
verbose_name=_("Protocol ID"))
mapping = tables.Column("mapping_id",
verbose_name=_("Mapping ID"))
def get_object_display(self, datum):
return datum.id
class Meta(object):
name = "idp_protocols"
verbose_name = _("Protocols")
table_actions = (AddProtocol, RemoveProtocol)
row_actions = (RemoveProtocol, )
| openstack/horizon | openstack_dashboard/dashboards/identity/identity_providers/protocols/tables.py | Python | apache-2.0 | 2,469 | [
30522,
1001,
9385,
1006,
1039,
1007,
2325,
20643,
999,
4297,
1012,
2035,
2916,
9235,
1012,
1001,
1001,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
1001,
2025,
2224,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
-- Copyright (C) 2007, 2010 - Bit-Blot
--
-- This file is part of Aquaria.
--
-- Aquaria is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License
-- as published by the Free Software Foundation; either version 2
-- of the License, or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--
-- See the GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
if not v then v = {} end
if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end
-- ================================================================================================
-- G L O B E C R A B
-- ================================================================================================
-- ================================================================================================
-- L O C A L V A R I A B L E S
-- ================================================================================================
v.speed = 150
v.delay = 0.5
v.moveaway = 0
local STATE_ROTATE = 1000
local STATE_WALK = 1001
local STATE_MOVEAWAY = 1002
-- ================================================================================================
-- F U N C T I O N S
-- ================================================================================================
function init(me)
setupEntity(me)
entity_setEntityLayer(me, -3)
entity_setEntityType(me, ET_ENEMY)
entity_initSkeletal(me, "GlobeCrab")
--entity_setAllDamageTargets(me, false)
--entity_generateCollisionMask(me)
entity_setCollideRadius(me, 32)
entity_setState(me, STATE_IDLE)
esetv(me, EV_TYPEID, EVT_GLOBEJELLY)
entity_setHealth(me, 3)
entity_setDropChance(me, 20, 1)
entity_setDeathParticleEffect(me, "TinyRedExplode")
entity_setUpdateCull(me, 4000)
local scale_random = math.random(40) * 0.01
entity_scale(me, 0.6 + scale_random, 0.6 + scale_random)
end
function postInit(me)
v.n = getNaija()
--entity_setTarget(me, v.n)
end
function update(me, dt)
if entity_isState(me, STATE_IDLE) then
if v.delay > 0 then
v.delay = v.delay - dt
--debugLog(string.format("globecrab delay: %d", v.delay))
elseif math.random(100) == 1 then
entity_setState(me, STATE_ROTATE)
v.delay = 0.5
end
elseif entity_isState(me, STATE_ROTATE) then
entity_rotate(me, entity_getRotation(me)+90*dt)
if v.delay > 0 then
v.delay = v.delay - dt
elseif math.random(100) == 1 then
if v.moveaway == 1 then
entity_setState(me, STATE_MOVEAWAY)
v.delay = 0.5
else
entity_setState(me, STATE_WALK)
v.delay = 1
end
end
elseif entity_isState(me, STATE_MOVEAWAY) then
v.vx, v.vy = vector_setLength(v.vx, v.vy, v.speed*dt)
entity_setPosition(me, entity_x(me) + v.vx, entity_y(me) + v.vy)
if v.delay > 0 then
v.delay = v.delay - dt
else
entity_setState(me, STATE_IDLE)
v.moveaway = 0
v.delay = 0.5
end
elseif entity_isState(me, STATE_WALK) then
local coll = 0
-- CRAB COLLISION CHECK
local e = getFirstEntity()
while e ~= 0 do
if e ~= me and eisv(e, EV_TYPEID, EVT_GLOBEJELLY) and entity_isEntityInRange(me, e, 64) then
entity_setState(me, STATE_IDLE)
v.delay = 0.5
coll = 1
v.moveaway = 1 -- so they don't get stuck
end
e = getNextEntity()
end
-- WALL COLLISION CHECK
v.vx, v.vy = entity_getNormal(me)
v.vx, v.vy = vector_setLength(v.vx, v.vy, v.speed*dt)
if isObstructedBlock(entity_x(me) + v.vx, entity_y(me) + v.vy, 2) then
entity_setState(me, STATE_IDLE)
v.delay = 0.5
coll = 1
end
if coll == 0 then
v.vx, v.vy = vector_setLength(v.vx, v.vy, v.speed*dt)
entity_setPosition(me, entity_x(me) + v.vx, entity_y(me) + v.vy)
if v.delay > 0 then
v.delay = v.delay - dt
elseif math.random(100) == 1 then
entity_setState(me, STATE_IDLE)
v.delay = 0.5
end
end
else
entity_setState(me, STATE_IDLE)
end
entity_updateMovement(me, dt)
entity_handleShotCollisions(me)
if entity_touchAvatarDamage(me, entity_getCollideRadius(me), 1, 400) then
entity_moveTowardsTarget(me, 1, -500)
end
end
function enterState(me)
if entity_isState(me, STATE_IDLE) then
entity_animate(me, "idle", -1)
elseif entity_isState(me, STATE_ROTATE) then
entity_animate(me, "walk", -1)
elseif entity_isState(me, STATE_WALK) then
entity_animate(me, "walk", -1)
end
end
function exitState(me)
end
function damage(me, attacker, bone, damageType, dmg)
return true
end
function animationKey(me, key)
end
function hitSurface(me)
--debugLog("HIT")
end
function songNote(me, note)
end
function songNoteDone(me, note)
end
function song(me, song)
end
function activate(me)
end
function dieNormal(me)
if chance(20) then
spawnIngredient("CrabMeat", entity_x(me), entity_y(me))
end
end
| fgenesis/Aquaria_experimental | game_scripts/scripts/entities/globecrab.lua | Lua | gpl-2.0 | 5,134 | [
30522,
1011,
1011,
9385,
1006,
1039,
1007,
2289,
1010,
2230,
1011,
2978,
1011,
1038,
10994,
1011,
1011,
1011,
1011,
2023,
5371,
2003,
2112,
1997,
28319,
4360,
1012,
1011,
1011,
1011,
1011,
28319,
4360,
2003,
2489,
4007,
1025,
2017,
2064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Decompiled with JetBrains decompiler
// Type: System.Xml.Serialization.CaseInsensitiveKeyComparer
// Assembly: System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: 50ABAB51-7DC3-4F0A-A797-0D0C2D124D60
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Xml.dll
using System;
using System.Collections;
using System.Globalization;
namespace System.Xml.Serialization
{
internal class CaseInsensitiveKeyComparer : CaseInsensitiveComparer, IEqualityComparer
{
public CaseInsensitiveKeyComparer()
: base(CultureInfo.CurrentCulture)
{
}
bool IEqualityComparer.Equals(object x, object y)
{
return this.Compare(x, y) == 0;
}
int IEqualityComparer.GetHashCode(object obj)
{
string str = obj as string;
if (str == null)
throw new ArgumentException((string) null, "obj");
return str.ToUpper(CultureInfo.CurrentCulture).GetHashCode();
}
}
}
| mater06/LEGOChimaOnlineReloaded | LoCO Client Files/Decompressed Client/Extracted DLL/System.Xml/System/Xml/Serialization/CaseInsensitiveKeyComparer.cs | C# | gpl-3.0 | 975 | [
30522,
1013,
1013,
21933,
8737,
18450,
2007,
6892,
10024,
7076,
21933,
8737,
9463,
2099,
1013,
1013,
2828,
1024,
2291,
1012,
20950,
1012,
7642,
3989,
1012,
2553,
7076,
6132,
13043,
14839,
9006,
19362,
2121,
1013,
1013,
3320,
1024,
2291,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import json
from tornado import httpclient as hc
from tornado import gen
from graphite_beacon.handlers import LOGGER, AbstractHandler
class HipChatHandler(AbstractHandler):
name = 'hipchat'
# Default options
defaults = {
'url': 'https://api.hipchat.com',
'room': None,
'key': None,
}
colors = {
'critical': 'red',
'warning': 'yellow',
'normal': 'green',
}
def init_handler(self):
self.room = self.options.get('room')
self.key = self.options.get('key')
assert self.room, 'Hipchat room is not defined.'
assert self.key, 'Hipchat key is not defined.'
self.client = hc.AsyncHTTPClient()
@gen.coroutine
def notify(self, level, *args, **kwargs):
LOGGER.debug("Handler (%s) %s", self.name, level)
data = {
'message': self.get_short(level, *args, **kwargs).decode('UTF-8'),
'notify': True,
'color': self.colors.get(level, 'gray'),
'message_format': 'text',
}
yield self.client.fetch('{url}/v2/room/{room}/notification?auth_token={token}'.format(
url=self.options.get('url'), room=self.room, token=self.key), headers={
'Content-Type': 'application/json'}, method='POST', body=json.dumps(data))
| klen/graphite-beacon | graphite_beacon/handlers/hipchat.py | Python | mit | 1,328 | [
30522,
12324,
1046,
3385,
2013,
11352,
12324,
8299,
20464,
11638,
2004,
16731,
2013,
11352,
12324,
8991,
2013,
10629,
4221,
1035,
14400,
1012,
28213,
2015,
12324,
8833,
4590,
1010,
10061,
11774,
3917,
2465,
5099,
7507,
21604,
21222,
1006,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.oozie.action.hadoop;
import com.google.common.annotations.VisibleForTesting;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.commons.lang.StringUtils;
import org.apache.directory.api.util.Strings;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.filecache.DistributedCache;
import org.apache.hadoop.fs.Path;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.StringReader;
import java.io.Writer;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.regex.Pattern;
import static org.apache.oozie.action.hadoop.SparkActionExecutor.SPARK_DEFAULT_OPTS;
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "Properties file should be specified by user")
class SparkArgsExtractor {
private static final Pattern SPARK_DEFAULTS_FILE_PATTERN = Pattern.compile("spark-defaults.conf");
private static final String FILES_OPTION = "--files";
private static final String ARCHIVES_OPTION = "--archives";
private static final String LOG4J_CONFIGURATION_JAVA_OPTION = "-Dlog4j.configuration=";
private static final String SECURITY_TOKENS_HADOOPFS = "spark.yarn.security.tokens.hadoopfs.enabled";
private static final String SECURITY_TOKENS_HIVE = "spark.yarn.security.tokens.hive.enabled";
private static final String SECURITY_TOKENS_HBASE = "spark.yarn.security.tokens.hbase.enabled";
private static final String SECURITY_CREDENTIALS_HADOOPFS = "spark.yarn.security.credentials.hadoopfs.enabled";
private static final String SECURITY_CREDENTIALS_HIVE = "spark.yarn.security.credentials.hive.enabled";
private static final String SECURITY_CREDENTIALS_HBASE = "spark.yarn.security.credentials.hbase.enabled";
private static final String PWD = "$PWD" + File.separator + "*";
private static final String MASTER_OPTION = "--master";
private static final String MODE_OPTION = "--deploy-mode";
private static final String JOB_NAME_OPTION = "--name";
private static final String CLASS_NAME_OPTION = "--class";
private static final String VERBOSE_OPTION = "--verbose";
private static final String DRIVER_CLASSPATH_OPTION = "--driver-class-path";
private static final String EXECUTOR_CLASSPATH = "spark.executor.extraClassPath=";
private static final String DRIVER_CLASSPATH = "spark.driver.extraClassPath=";
private static final String EXECUTOR_EXTRA_JAVA_OPTIONS = "spark.executor.extraJavaOptions=";
private static final String DRIVER_EXTRA_JAVA_OPTIONS = "spark.driver.extraJavaOptions=";
private static final Pattern SPARK_VERSION_1 = Pattern.compile("^1.*");
private static final String SPARK_YARN_JAR = "spark.yarn.jar";
private static final String SPARK_YARN_JARS = "spark.yarn.jars";
private static final String OPT_SEPARATOR = "=";
private static final String OPT_VALUE_SEPARATOR = ",";
private static final String CONF_OPTION = "--conf";
private static final String MASTER_OPTION_YARN_CLUSTER = "yarn-cluster";
private static final String MASTER_OPTION_YARN_CLIENT = "yarn-client";
private static final String MASTER_OPTION_YARN = "yarn";
private static final String DEPLOY_MODE_CLUSTER = "cluster";
private static final String DEPLOY_MODE_CLIENT = "client";
private static final String SPARK_YARN_TAGS = "spark.yarn.tags";
private static final String OPT_PROPERTIES_FILE = "--properties-file";
public static final String SPARK_DEFAULTS_GENERATED_PROPERTIES = "spark-defaults-oozie-generated.properties";
private boolean pySpark = false;
private final Configuration actionConf;
SparkArgsExtractor(final Configuration actionConf) {
this.actionConf = actionConf;
}
boolean isPySpark() {
return pySpark;
}
List<String> extract(final String[] mainArgs) throws OozieActionConfiguratorException, IOException, URISyntaxException {
final List<String> sparkArgs = new ArrayList<>();
sparkArgs.add(MASTER_OPTION);
final String master = actionConf.get(SparkActionExecutor.SPARK_MASTER);
sparkArgs.add(master);
// In local mode, everything runs here in the Launcher Job.
// In yarn-client mode, the driver runs here in the Launcher Job and the
// executor in Yarn.
// In yarn-cluster mode, the driver and executor run in Yarn.
final String sparkDeployMode = actionConf.get(SparkActionExecutor.SPARK_MODE);
if (sparkDeployMode != null) {
sparkArgs.add(MODE_OPTION);
sparkArgs.add(sparkDeployMode);
}
final boolean yarnClusterMode = master.equals(MASTER_OPTION_YARN_CLUSTER)
|| (master.equals(MASTER_OPTION_YARN) && sparkDeployMode != null && sparkDeployMode.equals(DEPLOY_MODE_CLUSTER));
final boolean yarnClientMode = master.equals(MASTER_OPTION_YARN_CLIENT)
|| (master.equals(MASTER_OPTION_YARN) && sparkDeployMode != null && sparkDeployMode.equals(DEPLOY_MODE_CLIENT));
sparkArgs.add(JOB_NAME_OPTION);
sparkArgs.add(actionConf.get(SparkActionExecutor.SPARK_JOB_NAME));
final String className = actionConf.get(SparkActionExecutor.SPARK_CLASS);
if (className != null) {
sparkArgs.add(CLASS_NAME_OPTION);
sparkArgs.add(className);
}
appendOoziePropertiesToSparkConf(sparkArgs);
String jarPath = actionConf.get(SparkActionExecutor.SPARK_JAR);
if (jarPath != null && jarPath.endsWith(".py")) {
pySpark = true;
}
boolean addedSecurityTokensHadoopFS = false;
boolean addedSecurityTokensHive = false;
boolean addedSecurityTokensHBase = false;
boolean addedSecurityCredentialsHadoopFS = false;
boolean addedSecurityCredentialsHive = false;
boolean addedSecurityCredentialsHBase = false;
boolean addedLog4jDriverSettings = false;
boolean addedLog4jExecutorSettings = false;
final StringBuilder driverClassPath = new StringBuilder();
final StringBuilder executorClassPath = new StringBuilder();
final StringBuilder userFiles = new StringBuilder();
final StringBuilder userArchives = new StringBuilder();
final String sparkOpts = actionConf.get(SparkActionExecutor.SPARK_OPTS);
String propertiesFile = null;
if (StringUtils.isNotEmpty(sparkOpts)) {
final List<String> sparkOptions = SparkOptionsSplitter.splitSparkOpts(sparkOpts);
for (int i = 0; i < sparkOptions.size(); i++) {
String opt = sparkOptions.get(i);
boolean addToSparkArgs = true;
if (yarnClusterMode || yarnClientMode) {
if (opt.startsWith(EXECUTOR_CLASSPATH)) {
appendWithPathSeparator(opt.substring(EXECUTOR_CLASSPATH.length()), executorClassPath);
addToSparkArgs = false;
}
if (opt.startsWith(DRIVER_CLASSPATH)) {
appendWithPathSeparator(opt.substring(DRIVER_CLASSPATH.length()), driverClassPath);
addToSparkArgs = false;
}
if (opt.equals(DRIVER_CLASSPATH_OPTION)) {
// we need the next element after this option
appendWithPathSeparator(sparkOptions.get(i + 1), driverClassPath);
// increase i to skip the next element.
i++;
addToSparkArgs = false;
}
}
if (opt.startsWith(SECURITY_TOKENS_HADOOPFS)) {
addedSecurityTokensHadoopFS = true;
}
if (opt.startsWith(SECURITY_TOKENS_HIVE)) {
addedSecurityTokensHive = true;
}
if (opt.startsWith(SECURITY_TOKENS_HBASE)) {
addedSecurityTokensHBase = true;
}
if (opt.startsWith(SECURITY_CREDENTIALS_HADOOPFS)) {
addedSecurityCredentialsHadoopFS = true;
}
if (opt.startsWith(SECURITY_CREDENTIALS_HIVE)) {
addedSecurityCredentialsHive = true;
}
if (opt.startsWith(SECURITY_CREDENTIALS_HBASE)) {
addedSecurityCredentialsHBase = true;
}
if (opt.startsWith(OPT_PROPERTIES_FILE)){
i++;
propertiesFile = sparkOptions.get(i);
addToSparkArgs = false;
}
if (opt.startsWith(EXECUTOR_EXTRA_JAVA_OPTIONS) || opt.startsWith(DRIVER_EXTRA_JAVA_OPTIONS)) {
if (!opt.contains(LOG4J_CONFIGURATION_JAVA_OPTION)) {
opt += " " + LOG4J_CONFIGURATION_JAVA_OPTION + SparkMain.SPARK_LOG4J_PROPS;
} else {
System.out.println("Warning: Spark Log4J settings are overwritten." +
" Child job IDs may not be available");
}
if (opt.startsWith(EXECUTOR_EXTRA_JAVA_OPTIONS)) {
addedLog4jExecutorSettings = true;
} else {
addedLog4jDriverSettings = true;
}
}
if (opt.startsWith(FILES_OPTION)) {
final String userFile;
if (opt.contains(OPT_SEPARATOR)) {
userFile = opt.substring(opt.indexOf(OPT_SEPARATOR) + OPT_SEPARATOR.length());
}
else {
userFile = sparkOptions.get(i + 1);
i++;
}
if (userFiles.length() > 0) {
userFiles.append(OPT_VALUE_SEPARATOR);
}
userFiles.append(userFile);
addToSparkArgs = false;
}
if (opt.startsWith(ARCHIVES_OPTION)) {
final String userArchive;
if (opt.contains(OPT_SEPARATOR)) {
userArchive = opt.substring(opt.indexOf(OPT_SEPARATOR) + OPT_SEPARATOR.length());
}
else {
userArchive = sparkOptions.get(i + 1);
i++;
}
if (userArchives.length() > 0) {
userArchives.append(OPT_VALUE_SEPARATOR);
}
userArchives.append(userArchive);
addToSparkArgs = false;
}
if (addToSparkArgs) {
sparkArgs.add(opt);
}
else if (sparkArgs.get(sparkArgs.size() - 1).equals(CONF_OPTION)) {
sparkArgs.remove(sparkArgs.size() - 1);
}
}
}
if ((yarnClusterMode || yarnClientMode)) {
// Include the current working directory (of executor container)
// in executor classpath, because it will contain localized
// files
appendWithPathSeparator(PWD, executorClassPath);
appendWithPathSeparator(PWD, driverClassPath);
sparkArgs.add(CONF_OPTION);
sparkArgs.add(EXECUTOR_CLASSPATH + executorClassPath.toString());
sparkArgs.add(CONF_OPTION);
sparkArgs.add(DRIVER_CLASSPATH + driverClassPath.toString());
}
if (actionConf.get(LauncherMain.MAPREDUCE_JOB_TAGS) != null) {
sparkArgs.add(CONF_OPTION);
sparkArgs.add(SPARK_YARN_TAGS + OPT_SEPARATOR + actionConf.get(LauncherMain.MAPREDUCE_JOB_TAGS));
}
if (!addedSecurityTokensHadoopFS) {
sparkArgs.add(CONF_OPTION);
sparkArgs.add(SECURITY_TOKENS_HADOOPFS + OPT_SEPARATOR + Boolean.toString(false));
}
if (!addedSecurityTokensHive) {
sparkArgs.add(CONF_OPTION);
sparkArgs.add(SECURITY_TOKENS_HIVE + OPT_SEPARATOR + Boolean.toString(false));
}
if (!addedSecurityTokensHBase) {
sparkArgs.add(CONF_OPTION);
sparkArgs.add(SECURITY_TOKENS_HBASE + OPT_SEPARATOR + Boolean.toString(false));
}
if (!addedSecurityCredentialsHadoopFS) {
sparkArgs.add(CONF_OPTION);
sparkArgs.add(SECURITY_CREDENTIALS_HADOOPFS + OPT_SEPARATOR + Boolean.toString(false));
}
if (!addedSecurityCredentialsHive) {
sparkArgs.add(CONF_OPTION);
sparkArgs.add(SECURITY_CREDENTIALS_HIVE + OPT_SEPARATOR + Boolean.toString(false));
}
if (!addedSecurityCredentialsHBase) {
sparkArgs.add(CONF_OPTION);
sparkArgs.add(SECURITY_CREDENTIALS_HBASE + OPT_SEPARATOR + Boolean.toString(false));
}
if (!addedLog4jExecutorSettings) {
sparkArgs.add(CONF_OPTION);
sparkArgs.add(EXECUTOR_EXTRA_JAVA_OPTIONS + LOG4J_CONFIGURATION_JAVA_OPTION + SparkMain.SPARK_LOG4J_PROPS);
}
if (!addedLog4jDriverSettings) {
sparkArgs.add(CONF_OPTION);
sparkArgs.add(DRIVER_EXTRA_JAVA_OPTIONS + LOG4J_CONFIGURATION_JAVA_OPTION + SparkMain.SPARK_LOG4J_PROPS);
}
mergeAndAddPropertiesFile(sparkArgs, propertiesFile);
if ((yarnClusterMode || yarnClientMode)) {
final Map<String, URI> fixedFileUrisMap =
SparkMain.fixFsDefaultUrisAndFilterDuplicates(DistributedCache.getCacheFiles(actionConf));
fixedFileUrisMap.put(SparkMain.SPARK_LOG4J_PROPS, new Path(SparkMain.SPARK_LOG4J_PROPS).toUri());
fixedFileUrisMap.put(SparkMain.HIVE_SITE_CONF, new Path(SparkMain.HIVE_SITE_CONF).toUri());
addUserDefined(userFiles.toString(), fixedFileUrisMap);
final Collection<URI> fixedFileUris = fixedFileUrisMap.values();
final JarFilter jarFilter = new JarFilter(fixedFileUris, jarPath);
jarFilter.filter();
jarPath = jarFilter.getApplicationJar();
final String cachedFiles = StringUtils.join(fixedFileUris, OPT_VALUE_SEPARATOR);
if (cachedFiles != null && !cachedFiles.isEmpty()) {
sparkArgs.add(FILES_OPTION);
sparkArgs.add(cachedFiles);
}
final Map<String, URI> fixedArchiveUrisMap = SparkMain.fixFsDefaultUrisAndFilterDuplicates(DistributedCache.
getCacheArchives(actionConf));
addUserDefined(userArchives.toString(), fixedArchiveUrisMap);
final String cachedArchives = StringUtils.join(fixedArchiveUrisMap.values(), OPT_VALUE_SEPARATOR);
if (cachedArchives != null && !cachedArchives.isEmpty()) {
sparkArgs.add(ARCHIVES_OPTION);
sparkArgs.add(cachedArchives);
}
setSparkYarnJarsConf(sparkArgs, jarFilter.getSparkYarnJar(), jarFilter.getSparkVersion());
}
if (!sparkArgs.contains(VERBOSE_OPTION)) {
sparkArgs.add(VERBOSE_OPTION);
}
sparkArgs.add(jarPath);
sparkArgs.addAll(Arrays.asList(mainArgs));
return sparkArgs;
}
private void mergeAndAddPropertiesFile(final List<String> sparkArgs, final String userDefinedPropertiesFile)
throws IOException {
final Properties properties = new Properties();
loadServerDefaultProperties(properties);
loadLocalizedDefaultPropertiesFile(properties);
loadUserDefinedPropertiesFile(userDefinedPropertiesFile, properties);
final boolean persisted = persistMergedProperties(properties);
if (persisted) {
sparkArgs.add(OPT_PROPERTIES_FILE);
sparkArgs.add(SPARK_DEFAULTS_GENERATED_PROPERTIES);
}
}
private boolean persistMergedProperties(final Properties properties) throws IOException {
if (!properties.isEmpty()) {
try (final Writer writer = new OutputStreamWriter(
new FileOutputStream(new File(SPARK_DEFAULTS_GENERATED_PROPERTIES)),
StandardCharsets.UTF_8.name())) {
properties.store(writer, "Properties file generated by Oozie");
System.out.println(String.format("Persisted merged Spark configs in file %s. Merged properties are: %s",
SPARK_DEFAULTS_GENERATED_PROPERTIES, Arrays.toString(properties.stringPropertyNames().toArray())));
return true;
} catch (IOException e) {
System.err.println(String.format("Could not persist derived Spark config file. Reason: %s", e.getMessage()));
throw e;
}
}
return false;
}
private void loadUserDefinedPropertiesFile(final String userDefinedPropertiesFile, final Properties properties) {
if (userDefinedPropertiesFile != null) {
System.out.println(String.format("Reading Spark config from %s %s...", OPT_PROPERTIES_FILE, userDefinedPropertiesFile));
loadProperties(new File(userDefinedPropertiesFile), properties);
}
}
private void loadLocalizedDefaultPropertiesFile(final Properties properties) {
final File localizedDefaultConfFile = SparkMain.getMatchingFile(SPARK_DEFAULTS_FILE_PATTERN);
if (localizedDefaultConfFile != null) {
System.out.println(String.format("Reading Spark config from file %s...", localizedDefaultConfFile.getName()));
loadProperties(localizedDefaultConfFile, properties);
}
}
private void loadServerDefaultProperties(final Properties properties) {
final String sparkDefaultsFromServer = actionConf.get(SPARK_DEFAULT_OPTS, "");
if (!sparkDefaultsFromServer.isEmpty()) {
System.out.println("Reading Spark config propagated from Oozie server...");
try (final StringReader reader = new StringReader(sparkDefaultsFromServer)) {
properties.load(reader);
} catch (IOException e) {
System.err.println(String.format("Could not read propagated Spark config! Reason: %s", e.getMessage()));
}
}
}
private void loadProperties(final File file, final Properties target) {
try (final Reader reader = new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8.name())) {
final Properties properties = new Properties();
properties.load(reader);
for(String key :properties.stringPropertyNames()) {
Object prevProperty = target.setProperty(key, properties.getProperty(key));
if(prevProperty != null){
System.out.println(String.format("Value of %s was overwritten from %s", key, file.getName()));
}
}
} catch (IOException e) {
System.err.println(String.format("Could not read Spark configs from file %s. Reason: %s", file.getName(),
e.getMessage()));
}
}
private void appendWithPathSeparator(final String what, final StringBuilder to) {
if (to.length() > 0) {
to.append(File.pathSeparator);
}
to.append(what);
}
private void addUserDefined(final String userList, final Map<String, URI> urisMap) {
if (userList != null) {
for (final String file : userList.split(OPT_VALUE_SEPARATOR)) {
if (!Strings.isEmpty(file)) {
final Path p = new Path(file);
urisMap.put(p.getName(), p.toUri());
}
}
}
}
/*
* Get properties that needs to be passed to Spark as Spark configuration from actionConf.
*/
@VisibleForTesting
void appendOoziePropertiesToSparkConf(final List<String> sparkArgs) {
for (final Map.Entry<String, String> oozieConfig : actionConf
.getValByRegex("^oozie\\.(?!launcher|spark).+").entrySet()) {
sparkArgs.add(CONF_OPTION);
sparkArgs.add(String.format("spark.%s=%s", oozieConfig.getKey(), oozieConfig.getValue()));
}
}
/**
* Sets spark.yarn.jars for Spark 2.X. Sets spark.yarn.jar for Spark 1.X.
*
* @param sparkArgs
* @param sparkYarnJar
* @param sparkVersion
*/
private void setSparkYarnJarsConf(final List<String> sparkArgs, final String sparkYarnJar, final String sparkVersion) {
if (SPARK_VERSION_1.matcher(sparkVersion).find()) {
// In Spark 1.X.X, set spark.yarn.jar to avoid
// multiple distribution
sparkArgs.add(CONF_OPTION);
sparkArgs.add(SPARK_YARN_JAR + OPT_SEPARATOR + sparkYarnJar);
} else {
// In Spark 2.X.X, set spark.yarn.jars
sparkArgs.add(CONF_OPTION);
sparkArgs.add(SPARK_YARN_JARS + OPT_SEPARATOR + sparkYarnJar);
}
}
}
| cbaenziger/oozie | sharelib/spark/src/main/java/org/apache/oozie/action/hadoop/SparkArgsExtractor.java | Java | apache-2.0 | 22,247 | [
30522,
1013,
1008,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
1008,
2030,
2062,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
1008,
5500,
2007,
2023,
2147,
2005,
3176,
2592,
1008,
4953,
9385,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Behat\Mink\Tests\Driver;
use Behat\Mink\Driver\Selenium2Driver;
class Selenium2Config extends AbstractConfig
{
public static function getInstance()
{
return new self();
}
/**
* {@inheritdoc}
*/
public function createDriver()
{
$browser = getenv('WEB_FIXTURES_BROWSER') ?: 'firefox';
$seleniumHost = $_SERVER['DRIVER_URL'];
return new Selenium2Driver($browser, null, $seleniumHost);
}
/**
* {@inheritdoc}
*/
public function skipMessage($testCase, $test)
{
if ('phantomjs' === getenv('WEBDRIVER') && null !== $message = $this->skipPhantomJs($testCase, $test)) {
return $message;
}
if (
'phantomjs' !== getenv('WEBDRIVER')
&& 'Behat\Mink\Tests\Driver\Form\Html5Test' === $testCase
&& 'testHtml5Types' === $test
) {
return 'WebDriver does not support setting value in color inputs. See https://code.google.com/p/selenium/issues/detail?id=7650';
}
if (
'Behat\Mink\Tests\Driver\Js\WindowTest' === $testCase
&& (0 === strpos($test, 'testWindowMaximize'))
&& 'true' === getenv('TRAVIS')
) {
return 'Maximizing the window does not work when running the browser in Xvfb.';
}
return parent::skipMessage($testCase, $test);
}
/**
* {@inheritdoc}
*/
protected function supportsCss()
{
return true;
}
private function skipPhantomJs($testCase, $test)
{
if (
'Behat\Mink\Tests\Driver\Js\WindowTest' === $testCase
&& in_array($test, array('testResizeWindow', 'testWindowMaximize'))
) {
return 'PhantomJS is headless so resizing the window does not make sense.';
}
if (
'Behat\Mink\Tests\Driver\Basic\CookieTest' === $testCase
&& 'testHttpOnlyCookieIsDeleted' === $test
) {
return 'This test does not work for PhantomJS. See https://github.com/detro/ghostdriver/issues/170';
}
return null;
}
}
| eisbear2020/ZI | vendor/behat/mink-selenium2-driver/tests/Selenium2Config.php | PHP | gpl-2.0 | 2,156 | [
30522,
1026,
1029,
25718,
3415,
15327,
2022,
12707,
1032,
8117,
2243,
1032,
5852,
1032,
4062,
1025,
2224,
2022,
12707,
1032,
8117,
2243,
1032,
4062,
1032,
7367,
7770,
5007,
2475,
23663,
2099,
1025,
2465,
7367,
7770,
5007,
2475,
8663,
8873,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2019 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.thoughtworks.go.server.newsecurity.controllers;
import com.thoughtworks.go.server.newsecurity.models.AccessToken;
import com.thoughtworks.go.server.newsecurity.models.AuthenticationToken;
import com.thoughtworks.go.server.newsecurity.models.UsernamePassword;
import com.thoughtworks.go.server.newsecurity.providers.PasswordBasedPluginAuthenticationProvider;
import com.thoughtworks.go.server.newsecurity.providers.WebBasedPluginAuthenticationProvider;
import com.thoughtworks.go.server.newsecurity.utils.SessionUtils;
import com.thoughtworks.go.server.service.SecurityService;
import com.thoughtworks.go.util.Clock;
import com.thoughtworks.go.util.SystemEnvironment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.savedrequest.SavedRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.view.RedirectView;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import static com.thoughtworks.go.server.newsecurity.utils.SessionUtils.isAnonymousAuthenticationToken;
@Controller
public class AuthenticationController {
public static final String BAD_CREDENTIALS_MSG = "Invalid credentials. Either your username and password are incorrect, or there is a problem with your browser cookies. Please check with your administrator.";
private static final Logger LOGGER = LoggerFactory.getLogger(AuthenticationController.class);
private static final RedirectView REDIRECT_TO_LOGIN_PAGE = new RedirectView("/auth/login", true);
private static final String UNKNOWN_ERROR_WHILE_AUTHENTICATION = "There was an unknown error authenticating you. Please try again after some time, and contact the administrator if the problem persists.";
private final SecurityService securityService;
private final SystemEnvironment systemEnvironment;
private final Clock clock;
private final PasswordBasedPluginAuthenticationProvider passwordBasedPluginAuthenticationProvider;
private final WebBasedPluginAuthenticationProvider webBasedPluginAuthenticationProvider;
@Autowired
public AuthenticationController(SecurityService securityService,
SystemEnvironment systemEnvironment,
Clock clock,
PasswordBasedPluginAuthenticationProvider passwordBasedPluginAuthenticationProvider,
WebBasedPluginAuthenticationProvider webBasedPluginAuthenticationProvider) {
this.securityService = securityService;
this.systemEnvironment = systemEnvironment;
this.clock = clock;
this.passwordBasedPluginAuthenticationProvider = passwordBasedPluginAuthenticationProvider;
this.webBasedPluginAuthenticationProvider = webBasedPluginAuthenticationProvider;
}
@RequestMapping(value = "/auth/security_check", method = RequestMethod.POST)
public RedirectView performLogin(@RequestParam("j_username") String username,
@RequestParam("j_password") String password,
HttpServletRequest request) {
if (securityIsDisabledOrAlreadyLoggedIn(request)) {
return new RedirectView("/pipelines", true);
}
LOGGER.debug("Requesting authentication for form auth.");
try {
SavedRequest savedRequest = SessionUtils.savedRequest(request);
final AuthenticationToken<UsernamePassword> authenticationToken = passwordBasedPluginAuthenticationProvider.authenticate(new UsernamePassword(username, password), null);
if (authenticationToken == null) {
return badAuthentication(request, BAD_CREDENTIALS_MSG);
} else {
SessionUtils.setAuthenticationTokenAfterRecreatingSession(authenticationToken, request);
}
String redirectUrl = savedRequest == null ? "/go/pipelines" : savedRequest.getRedirectUrl();
return new RedirectView(redirectUrl, false);
} catch (AuthenticationException e) {
LOGGER.error("Failed to authenticate user: {} ", username, e);
return badAuthentication(request, e.getMessage());
} catch (Exception e) {
return unknownAuthenticationError(request);
}
}
@RequestMapping(value = "/plugin/{pluginId}/login", method = RequestMethod.GET)
public RedirectView redirectToThirdPartyLoginPage(@PathVariable("pluginId") String pluginId,
HttpServletRequest request) {
if (securityIsDisabledOrAlreadyLoggedIn(request)) {
return new RedirectView("/pipelines", true);
}
final StringBuffer requestURL = request.getRequestURL();
requestURL.setLength(requestURL.length() - request.getRequestURI().length());
return new RedirectView(webBasedPluginAuthenticationProvider.getAuthorizationServerUrl(pluginId, requestURL.toString()), false);
}
@RequestMapping(value = "/plugin/{pluginId}/authenticate")
public RedirectView authenticateWithWebBasedPlugin(@PathVariable("pluginId") String pluginId,
HttpServletRequest request) {
if (securityIsDisabledOrAlreadyLoggedIn(request)) {
return new RedirectView("/pipelines", true);
}
LOGGER.debug("Requesting authentication for form auth.");
SavedRequest savedRequest = SessionUtils.savedRequest(request);
try {
final AccessToken accessToken = webBasedPluginAuthenticationProvider.fetchAccessToken(pluginId, getRequestHeaders(request), getParameterMap(request));
AuthenticationToken<AccessToken> authenticationToken = webBasedPluginAuthenticationProvider.authenticate(accessToken, pluginId);
if (authenticationToken == null) {
return unknownAuthenticationError(request);
}
SessionUtils.setAuthenticationTokenAfterRecreatingSession(authenticationToken, request);
} catch (AuthenticationException e) {
LOGGER.error("Failed to authenticate user.", e);
return badAuthentication(request, e.getMessage());
} catch (Exception e) {
return unknownAuthenticationError(request);
}
SessionUtils.removeAuthenticationError(request);
String redirectUrl = savedRequest == null ? "/go/pipelines" : savedRequest.getRedirectUrl();
return new RedirectView(redirectUrl, false);
}
private boolean securityIsDisabledOrAlreadyLoggedIn(HttpServletRequest request) {
return !securityService.isSecurityEnabled() || (!isAnonymousAuthenticationToken(request) && SessionUtils.isAuthenticated(request, clock, systemEnvironment));
}
private RedirectView badAuthentication(HttpServletRequest request, String message) {
SessionUtils.setAuthenticationError(message, request);
return REDIRECT_TO_LOGIN_PAGE;
}
private RedirectView unknownAuthenticationError(HttpServletRequest request) {
return badAuthentication(request, UNKNOWN_ERROR_WHILE_AUTHENTICATION);
}
private HashMap<String, String> getRequestHeaders(HttpServletRequest request) {
HashMap<String, String> headers = new HashMap<>();
Enumeration headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String header = (String) headerNames.nextElement();
String value = request.getHeader(header);
headers.put(header, value);
}
return headers;
}
private Map<String, String> getParameterMap(HttpServletRequest request) {
Map<String, String[]> springParameterMap = request.getParameterMap();
Map<String, String> pluginParameterMap = new HashMap<>();
for (String parameterName : springParameterMap.keySet()) {
String[] values = springParameterMap.get(parameterName);
if (values != null && values.length > 0) {
pluginParameterMap.put(parameterName, values[0]);
} else {
pluginParameterMap.put(parameterName, null);
}
}
return pluginParameterMap;
}
}
| kierarad/gocd | server/src/main/java/com/thoughtworks/go/server/newsecurity/controllers/AuthenticationController.java | Java | apache-2.0 | 9,321 | [
30522,
1013,
1008,
1008,
9385,
10476,
2245,
9316,
1010,
4297,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
import { version } from '../../../../package.json';
export const environment = {
production: false,
interactiveVisualizerUrl: `https://storage.googleapis.com/interactive_visualizer/${version}/index.html`,
models: [
{
displayName: 'Birds V1',
description: 'AIY natural world insects classification model',
type: 'image classification',
metadataUrl: 'https://storage.googleapis.com/tfhub-visualizers/google/aiy/vision/classifier/birds_V1/1/metadata.json',
},
{
displayName: 'Insects V1',
description: 'AIY natural world birds quantized classification model',
type: 'image classification',
metadataUrl: 'https://storage.googleapis.com/tfhub-visualizers/google/aiy/vision/classifier/insects_V1/1/metadata.json',
},
{
displayName: 'Mobile Object Localizer V1',
description: 'Mobile model to localize objects in an image',
type: 'object detection',
metadataUrl: 'https://storage.googleapis.com/tfhub-visualizers/google/object_detection/mobile_object_localizer_v1/1/metadata.json',
},
],
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
| tensorflow/tfjs-examples | interactive-visualizers/projects/playground/src/environments/environment.ts | TypeScript | apache-2.0 | 2,403 | [
30522,
1013,
1008,
1008,
1008,
1030,
6105,
1008,
9385,
12609,
8224,
11775,
1012,
2035,
2916,
9235,
1012,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
30524,
1008,
1008,
4983,
3223,
2011,
12711,
2375,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/* Copyright (C) 2011-2015 Emmanuel DEROME - All rights reserved */
// Prevents any direct access
defined('_JEXEC') or die();
// echo "<h1>\n";
// echo JText::_('COM_EGS_ENTREPRISE');
// echo "</h1>\n";
?>
<form action="index.php" method="post" name="adminForm" id="adminForm">
<?php
$user = JFactory::getUser(); // gets current user object
$isEntreprise = (array_search('11', $user->groups)); // sets flag when user group is '11' that is 'EGS Entreprise'
$isProf = (array_search('9', $user->groups)); // sets flag when user group is '9' that is 'EGS Professeur'
echo $this->getToolbar($isEntreprise, $isProf);
echo "<div class='pagetitle icon-48-article'><h2>\n";
echo JText::_('COM_EGS_ENTREPRISE') . " : " . $this->entreprise->nom;
echo "</h2></div>\n";
?>
<div>
<fieldset class="adminform">
<table class="admintable">
<tr>
<td width="110" class="key">
<label for="nom">
<?php echo JText::_('COM_EGS_ENTREPRISES_NOM'); ?>:
</label>
</td>
<td>
<?php if ($isEntreprise) {
?> <input class="inputbox" type="text" name="nom" id="nom" size="60" value="<?php echo $this->entreprise->nom; ?>" />
<?php } else {
?> <input type="hidden" name="nom" value="<?php echo $this->entreprise->nom; ?>" /> <?php
echo $this->entreprise->nom;
} ?>
</td>
</tr>
<tr>
<td width="110" class="key">
<label for="logo">
<?php echo JText::_('COM_EGS_ENTREPRISES_LOGO'); ?>:
</label>
</td>
<td>
<?php echo "<img src='" . JURI::root() . "images/logos/" . $this->entreprise->logo . "' border='0' />"; ?>
<?php if ($isEntreprise) {
?> <input class="inputbox" type="text" name="logo" id="logo" size="60" value="<?php echo $this->entreprise->logo; ?>" /> <?php
} ?>
</td>
</tr>
<tr>
<td width="110" class="key">
<label for="activite">
<?php echo JText::_('COM_EGS_ENTREPRISES_ACTIVITE'); ?>:
</label>
</td>
<td>
<?php if ($isEntreprise) {
?> <textarea class="inputbox" type="text" name="activite" id="activite" cols='60' rows='4'><?php echo $this->entreprise->activite; ?></textarea>
<?php } else {
?> <input type="hidden" name="activite" value="<?php echo $this->entreprise->activite; ?>" /> <?php
echo $this->entreprise->activite;
} ?>
</td>
</tr>
<tr>
<td width="110" class="key">
<label for="siteWeb">
<?php echo JText::_('COM_EGS_ENTREPRISES_SITEWEB'); ?>:
</label>
</td>
<td>
<?php if ($isEntreprise) {
?> <input class="inputbox" type="text" name="siteWeb" id="siteWeb" size="60" value="<?php echo $this->entreprise->siteWeb; ?>" />
<?php } else {
?> <input type="hidden" name="siteWeb" value="<?php echo $this->entreprise->siteWeb; ?>" /> <?php
echo $this->entreprise->siteWeb;
} ?>
</td>
</tr>
<tr>
<td width="110" class="key">
<label for="adrRue">
<?php echo JText::_('COM_EGS_ENTREPRISES_ADR_RUE'); ?>:
</label>
</td>
<td>
<?php if ($isEntreprise) {
?> <input class="inputbox" type="text" name="adrRue" id="adrRue" size="60" value="<?php echo $this->entreprise->adrRue; ?>" />
<?php } else {
?> <input type="hidden" name="adrRue" value="<?php echo $this->entreprise->adrRue; ?>" /> <?php
echo $this->entreprise->adrRue;
} ?>
</td>
</tr>
<tr>
<td width="110" class="key">
<label for="adrVille">
<?php echo JText::_('COM_EGS_ENTREPRISES_ADR_VILLE'); ?>:
</label>
</td>
<td>
<?php if ($isEntreprise) {
?> <input class="inputbox" type="text" name="adrVille" id="adrVille" size="60" value="<?php echo $this->entreprise->adrVille; ?>" />
<?php } else {
?> <input type="hidden" name="adrVille" value="<?php echo $this->entreprise->adrVille; ?>" /> <?php
echo $this->entreprise->adrVille;
} ?>
</td>
</tr>
<tr>
<td width="110" class="key">
<label for="adrCP">
<?php echo JText::_('COM_EGS_ENTREPRISES_ADR_CP'); ?>:
</label>
</td>
<td>
<?php if ($isEntreprise) {
?> <input class="inputbox" type="text" name="adrCP" id="adrCP" size="60" value="<?php echo $this->entreprise->adrCP; ?>" />
<?php } else {
?> <input type="hidden" name="adrCP" value="<?php echo $this->entreprise->adrCP; ?>" /> <?php
echo $this->entreprise->adrCP;
} ?>
</td>
</tr>
<tr>
<td width="110" class="key">
<label for="pays_id">
<?php echo JText::_('COM_EGS_ENTREPRISES_ADR_PAYS'); ?>:
</label>
</td>
<td>
<?php if ($isEntreprise) {
?> <select class="inputbox" name="pays_id" id="pays_id"> <?php
$db =& JFactory::getDBO();
$query2 = 'SELECT * FROM #__egs_pays ORDER BY pays';
$db->setQuery($query2);
$rows2 = $db->loadObjectList();
foreach ($rows2 as $row2) {
if ($this->entreprise->pays_id == $row2->id){
echo "<option value='$row2->id' selected='selected'>$row2->pays</option>\n";
}else{
echo "<option value='$row2->id'>$row2->pays</option>\n";
}
}
?> </select> <?php
} else {
?> <input type="hidden" name="pays_id" value="<?php echo $this->entreprise->pays_id; ?>" /> <?php
$db = JFactory::getDBO();
$query2 = 'SELECT * FROM #__egs_pays WHERE id = ' . $this->entreprise->pays_id;
$db->setQuery($query2);
$row2 = $db->loadObject();
if ($row2) {echo $row2->pays;}
} ?>
</td>
</tr>
</table>
</fieldset>
</div>
<div class="clr"></div>
<div class="clr"></div>
<input type="hidden" name="option" value="com_egs" />
<input type="hidden" name="id" value="<?php echo $this->entreprise->id; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="controller" value="entreprises" />
</form>
| Mohsan1995/egs.com | components/com_egs/views/entreprise/tmpl/form.php | PHP | gpl-2.0 | 6,237 | [
30522,
1026,
1029,
25718,
1013,
1008,
9385,
1006,
1039,
1007,
2249,
1011,
2325,
14459,
4315,
8462,
1011,
2035,
2916,
9235,
1008,
30524,
1005,
4012,
1035,
1041,
5620,
1035,
4372,
7913,
18098,
5562,
1005,
1007,
1025,
1013,
1013,
9052,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* This file is part of GDB.
Copyright 2004-2013 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "psim.h"
#include "options.h"
#include "registers.h"
#include "ansidecl.h"
#include "sim_callbacks.h"
#include "gdb/callback.h"
#include "gdb/remote-sim.h"
#include "gdb/sim-ppc.h"
/* Return the register name for the supplied SPR if any, or NULL if
none. */
const char *
sim_spr_register_name (int spr)
{
if (spr_is_valid (spr))
return spr_name (spr);
else
return NULL;
}
#define regnum2spr(SPR) sim_spr_register_name (SPR)
/* Return the name of the register whose number is REGNUM, or zero if
REGNUM is an invalid register number. */
static const char *
regnum2name (int regnum)
{
switch (regnum)
{
case sim_ppc_r0_regnum: return "r0";
case sim_ppc_r1_regnum: return "r1";
case sim_ppc_r2_regnum: return "r2";
case sim_ppc_r3_regnum: return "r3";
case sim_ppc_r4_regnum: return "r4";
case sim_ppc_r5_regnum: return "r5";
case sim_ppc_r6_regnum: return "r6";
case sim_ppc_r7_regnum: return "r7";
case sim_ppc_r8_regnum: return "r8";
case sim_ppc_r9_regnum: return "r9";
case sim_ppc_r10_regnum: return "r10";
case sim_ppc_r11_regnum: return "r11";
case sim_ppc_r12_regnum: return "r12";
case sim_ppc_r13_regnum: return "r13";
case sim_ppc_r14_regnum: return "r14";
case sim_ppc_r15_regnum: return "r15";
case sim_ppc_r16_regnum: return "r16";
case sim_ppc_r17_regnum: return "r17";
case sim_ppc_r18_regnum: return "r18";
case sim_ppc_r19_regnum: return "r19";
case sim_ppc_r20_regnum: return "r20";
case sim_ppc_r21_regnum: return "r21";
case sim_ppc_r22_regnum: return "r22";
case sim_ppc_r23_regnum: return "r23";
case sim_ppc_r24_regnum: return "r24";
case sim_ppc_r25_regnum: return "r25";
case sim_ppc_r26_regnum: return "r26";
case sim_ppc_r27_regnum: return "r27";
case sim_ppc_r28_regnum: return "r28";
case sim_ppc_r29_regnum: return "r29";
case sim_ppc_r30_regnum: return "r30";
case sim_ppc_r31_regnum: return "r31";
case sim_ppc_f0_regnum: return "f0";
case sim_ppc_f1_regnum: return "f1";
case sim_ppc_f2_regnum: return "f2";
case sim_ppc_f3_regnum: return "f3";
case sim_ppc_f4_regnum: return "f4";
case sim_ppc_f5_regnum: return "f5";
case sim_ppc_f6_regnum: return "f6";
case sim_ppc_f7_regnum: return "f7";
case sim_ppc_f8_regnum: return "f8";
case sim_ppc_f9_regnum: return "f9";
case sim_ppc_f10_regnum: return "f10";
case sim_ppc_f11_regnum: return "f11";
case sim_ppc_f12_regnum: return "f12";
case sim_ppc_f13_regnum: return "f13";
case sim_ppc_f14_regnum: return "f14";
case sim_ppc_f15_regnum: return "f15";
case sim_ppc_f16_regnum: return "f16";
case sim_ppc_f17_regnum: return "f17";
case sim_ppc_f18_regnum: return "f18";
case sim_ppc_f19_regnum: return "f19";
case sim_ppc_f20_regnum: return "f20";
case sim_ppc_f21_regnum: return "f21";
case sim_ppc_f22_regnum: return "f22";
case sim_ppc_f23_regnum: return "f23";
case sim_ppc_f24_regnum: return "f24";
case sim_ppc_f25_regnum: return "f25";
case sim_ppc_f26_regnum: return "f26";
case sim_ppc_f27_regnum: return "f27";
case sim_ppc_f28_regnum: return "f28";
case sim_ppc_f29_regnum: return "f29";
case sim_ppc_f30_regnum: return "f30";
case sim_ppc_f31_regnum: return "f31";
case sim_ppc_vr0_regnum: return "vr0";
case sim_ppc_vr1_regnum: return "vr1";
case sim_ppc_vr2_regnum: return "vr2";
case sim_ppc_vr3_regnum: return "vr3";
case sim_ppc_vr4_regnum: return "vr4";
case sim_ppc_vr5_regnum: return "vr5";
case sim_ppc_vr6_regnum: return "vr6";
case sim_ppc_vr7_regnum: return "vr7";
case sim_ppc_vr8_regnum: return "vr8";
case sim_ppc_vr9_regnum: return "vr9";
case sim_ppc_vr10_regnum: return "vr10";
case sim_ppc_vr11_regnum: return "vr11";
case sim_ppc_vr12_regnum: return "vr12";
case sim_ppc_vr13_regnum: return "vr13";
case sim_ppc_vr14_regnum: return "vr14";
case sim_ppc_vr15_regnum: return "vr15";
case sim_ppc_vr16_regnum: return "vr16";
case sim_ppc_vr17_regnum: return "vr17";
case sim_ppc_vr18_regnum: return "vr18";
case sim_ppc_vr19_regnum: return "vr19";
case sim_ppc_vr20_regnum: return "vr20";
case sim_ppc_vr21_regnum: return "vr21";
case sim_ppc_vr22_regnum: return "vr22";
case sim_ppc_vr23_regnum: return "vr23";
case sim_ppc_vr24_regnum: return "vr24";
case sim_ppc_vr25_regnum: return "vr25";
case sim_ppc_vr26_regnum: return "vr26";
case sim_ppc_vr27_regnum: return "vr27";
case sim_ppc_vr28_regnum: return "vr28";
case sim_ppc_vr29_regnum: return "vr29";
case sim_ppc_vr30_regnum: return "vr30";
case sim_ppc_vr31_regnum: return "vr31";
case sim_ppc_rh0_regnum: return "rh0";
case sim_ppc_rh1_regnum: return "rh1";
case sim_ppc_rh2_regnum: return "rh2";
case sim_ppc_rh3_regnum: return "rh3";
case sim_ppc_rh4_regnum: return "rh4";
case sim_ppc_rh5_regnum: return "rh5";
case sim_ppc_rh6_regnum: return "rh6";
case sim_ppc_rh7_regnum: return "rh7";
case sim_ppc_rh8_regnum: return "rh8";
case sim_ppc_rh9_regnum: return "rh9";
case sim_ppc_rh10_regnum: return "rh10";
case sim_ppc_rh11_regnum: return "rh11";
case sim_ppc_rh12_regnum: return "rh12";
case sim_ppc_rh13_regnum: return "rh13";
case sim_ppc_rh14_regnum: return "rh14";
case sim_ppc_rh15_regnum: return "rh15";
case sim_ppc_rh16_regnum: return "rh16";
case sim_ppc_rh17_regnum: return "rh17";
case sim_ppc_rh18_regnum: return "rh18";
case sim_ppc_rh19_regnum: return "rh19";
case sim_ppc_rh20_regnum: return "rh20";
case sim_ppc_rh21_regnum: return "rh21";
case sim_ppc_rh22_regnum: return "rh22";
case sim_ppc_rh23_regnum: return "rh23";
case sim_ppc_rh24_regnum: return "rh24";
case sim_ppc_rh25_regnum: return "rh25";
case sim_ppc_rh26_regnum: return "rh26";
case sim_ppc_rh27_regnum: return "rh27";
case sim_ppc_rh28_regnum: return "rh28";
case sim_ppc_rh29_regnum: return "rh29";
case sim_ppc_rh30_regnum: return "rh30";
case sim_ppc_rh31_regnum: return "rh31";
case sim_ppc_ev0_regnum: return "ev0";
case sim_ppc_ev1_regnum: return "ev1";
case sim_ppc_ev2_regnum: return "ev2";
case sim_ppc_ev3_regnum: return "ev3";
case sim_ppc_ev4_regnum: return "ev4";
case sim_ppc_ev5_regnum: return "ev5";
case sim_ppc_ev6_regnum: return "ev6";
case sim_ppc_ev7_regnum: return "ev7";
case sim_ppc_ev8_regnum: return "ev8";
case sim_ppc_ev9_regnum: return "ev9";
case sim_ppc_ev10_regnum: return "ev10";
case sim_ppc_ev11_regnum: return "ev11";
case sim_ppc_ev12_regnum: return "ev12";
case sim_ppc_ev13_regnum: return "ev13";
case sim_ppc_ev14_regnum: return "ev14";
case sim_ppc_ev15_regnum: return "ev15";
case sim_ppc_ev16_regnum: return "ev16";
case sim_ppc_ev17_regnum: return "ev17";
case sim_ppc_ev18_regnum: return "ev18";
case sim_ppc_ev19_regnum: return "ev19";
case sim_ppc_ev20_regnum: return "ev20";
case sim_ppc_ev21_regnum: return "ev21";
case sim_ppc_ev22_regnum: return "ev22";
case sim_ppc_ev23_regnum: return "ev23";
case sim_ppc_ev24_regnum: return "ev24";
case sim_ppc_ev25_regnum: return "ev25";
case sim_ppc_ev26_regnum: return "ev26";
case sim_ppc_ev27_regnum: return "ev27";
case sim_ppc_ev28_regnum: return "ev28";
case sim_ppc_ev29_regnum: return "ev29";
case sim_ppc_ev30_regnum: return "ev30";
case sim_ppc_ev31_regnum: return "ev31";
case sim_ppc_sr0_regnum: return "sr0";
case sim_ppc_sr1_regnum: return "sr1";
case sim_ppc_sr2_regnum: return "sr2";
case sim_ppc_sr3_regnum: return "sr3";
case sim_ppc_sr4_regnum: return "sr4";
case sim_ppc_sr5_regnum: return "sr5";
case sim_ppc_sr6_regnum: return "sr6";
case sim_ppc_sr7_regnum: return "sr7";
case sim_ppc_sr8_regnum: return "sr8";
case sim_ppc_sr9_regnum: return "sr9";
case sim_ppc_sr10_regnum: return "sr10";
case sim_ppc_sr11_regnum: return "sr11";
case sim_ppc_sr12_regnum: return "sr12";
case sim_ppc_sr13_regnum: return "sr13";
case sim_ppc_sr14_regnum: return "sr14";
case sim_ppc_sr15_regnum: return "sr15";
case sim_ppc_pc_regnum: return "pc";
case sim_ppc_ps_regnum: return "ps";
case sim_ppc_cr_regnum: return "cr";
case sim_ppc_fpscr_regnum: return "fpscr";
case sim_ppc_acc_regnum: return "acc";
case sim_ppc_vscr_regnum: return "vscr";
case sim_ppc_spr0_regnum: return regnum2spr (0);
case sim_ppc_spr1_regnum: return regnum2spr (1);
case sim_ppc_spr2_regnum: return regnum2spr (2);
case sim_ppc_spr3_regnum: return regnum2spr (3);
case sim_ppc_spr4_regnum: return regnum2spr (4);
case sim_ppc_spr5_regnum: return regnum2spr (5);
case sim_ppc_spr6_regnum: return regnum2spr (6);
case sim_ppc_spr7_regnum: return regnum2spr (7);
case sim_ppc_spr8_regnum: return regnum2spr (8);
case sim_ppc_spr9_regnum: return regnum2spr (9);
case sim_ppc_spr10_regnum: return regnum2spr (10);
case sim_ppc_spr11_regnum: return regnum2spr (11);
case sim_ppc_spr12_regnum: return regnum2spr (12);
case sim_ppc_spr13_regnum: return regnum2spr (13);
case sim_ppc_spr14_regnum: return regnum2spr (14);
case sim_ppc_spr15_regnum: return regnum2spr (15);
case sim_ppc_spr16_regnum: return regnum2spr (16);
case sim_ppc_spr17_regnum: return regnum2spr (17);
case sim_ppc_spr18_regnum: return regnum2spr (18);
case sim_ppc_spr19_regnum: return regnum2spr (19);
case sim_ppc_spr20_regnum: return regnum2spr (20);
case sim_ppc_spr21_regnum: return regnum2spr (21);
case sim_ppc_spr22_regnum: return regnum2spr (22);
case sim_ppc_spr23_regnum: return regnum2spr (23);
case sim_ppc_spr24_regnum: return regnum2spr (24);
case sim_ppc_spr25_regnum: return regnum2spr (25);
case sim_ppc_spr26_regnum: return regnum2spr (26);
case sim_ppc_spr27_regnum: return regnum2spr (27);
case sim_ppc_spr28_regnum: return regnum2spr (28);
case sim_ppc_spr29_regnum: return regnum2spr (29);
case sim_ppc_spr30_regnum: return regnum2spr (30);
case sim_ppc_spr31_regnum: return regnum2spr (31);
case sim_ppc_spr32_regnum: return regnum2spr (32);
case sim_ppc_spr33_regnum: return regnum2spr (33);
case sim_ppc_spr34_regnum: return regnum2spr (34);
case sim_ppc_spr35_regnum: return regnum2spr (35);
case sim_ppc_spr36_regnum: return regnum2spr (36);
case sim_ppc_spr37_regnum: return regnum2spr (37);
case sim_ppc_spr38_regnum: return regnum2spr (38);
case sim_ppc_spr39_regnum: return regnum2spr (39);
case sim_ppc_spr40_regnum: return regnum2spr (40);
case sim_ppc_spr41_regnum: return regnum2spr (41);
case sim_ppc_spr42_regnum: return regnum2spr (42);
case sim_ppc_spr43_regnum: return regnum2spr (43);
case sim_ppc_spr44_regnum: return regnum2spr (44);
case sim_ppc_spr45_regnum: return regnum2spr (45);
case sim_ppc_spr46_regnum: return regnum2spr (46);
case sim_ppc_spr47_regnum: return regnum2spr (47);
case sim_ppc_spr48_regnum: return regnum2spr (48);
case sim_ppc_spr49_regnum: return regnum2spr (49);
case sim_ppc_spr50_regnum: return regnum2spr (50);
case sim_ppc_spr51_regnum: return regnum2spr (51);
case sim_ppc_spr52_regnum: return regnum2spr (52);
case sim_ppc_spr53_regnum: return regnum2spr (53);
case sim_ppc_spr54_regnum: return regnum2spr (54);
case sim_ppc_spr55_regnum: return regnum2spr (55);
case sim_ppc_spr56_regnum: return regnum2spr (56);
case sim_ppc_spr57_regnum: return regnum2spr (57);
case sim_ppc_spr58_regnum: return regnum2spr (58);
case sim_ppc_spr59_regnum: return regnum2spr (59);
case sim_ppc_spr60_regnum: return regnum2spr (60);
case sim_ppc_spr61_regnum: return regnum2spr (61);
case sim_ppc_spr62_regnum: return regnum2spr (62);
case sim_ppc_spr63_regnum: return regnum2spr (63);
case sim_ppc_spr64_regnum: return regnum2spr (64);
case sim_ppc_spr65_regnum: return regnum2spr (65);
case sim_ppc_spr66_regnum: return regnum2spr (66);
case sim_ppc_spr67_regnum: return regnum2spr (67);
case sim_ppc_spr68_regnum: return regnum2spr (68);
case sim_ppc_spr69_regnum: return regnum2spr (69);
case sim_ppc_spr70_regnum: return regnum2spr (70);
case sim_ppc_spr71_regnum: return regnum2spr (71);
case sim_ppc_spr72_regnum: return regnum2spr (72);
case sim_ppc_spr73_regnum: return regnum2spr (73);
case sim_ppc_spr74_regnum: return regnum2spr (74);
case sim_ppc_spr75_regnum: return regnum2spr (75);
case sim_ppc_spr76_regnum: return regnum2spr (76);
case sim_ppc_spr77_regnum: return regnum2spr (77);
case sim_ppc_spr78_regnum: return regnum2spr (78);
case sim_ppc_spr79_regnum: return regnum2spr (79);
case sim_ppc_spr80_regnum: return regnum2spr (80);
case sim_ppc_spr81_regnum: return regnum2spr (81);
case sim_ppc_spr82_regnum: return regnum2spr (82);
case sim_ppc_spr83_regnum: return regnum2spr (83);
case sim_ppc_spr84_regnum: return regnum2spr (84);
case sim_ppc_spr85_regnum: return regnum2spr (85);
case sim_ppc_spr86_regnum: return regnum2spr (86);
case sim_ppc_spr87_regnum: return regnum2spr (87);
case sim_ppc_spr88_regnum: return regnum2spr (88);
case sim_ppc_spr89_regnum: return regnum2spr (89);
case sim_ppc_spr90_regnum: return regnum2spr (90);
case sim_ppc_spr91_regnum: return regnum2spr (91);
case sim_ppc_spr92_regnum: return regnum2spr (92);
case sim_ppc_spr93_regnum: return regnum2spr (93);
case sim_ppc_spr94_regnum: return regnum2spr (94);
case sim_ppc_spr95_regnum: return regnum2spr (95);
case sim_ppc_spr96_regnum: return regnum2spr (96);
case sim_ppc_spr97_regnum: return regnum2spr (97);
case sim_ppc_spr98_regnum: return regnum2spr (98);
case sim_ppc_spr99_regnum: return regnum2spr (99);
case sim_ppc_spr100_regnum: return regnum2spr (100);
case sim_ppc_spr101_regnum: return regnum2spr (101);
case sim_ppc_spr102_regnum: return regnum2spr (102);
case sim_ppc_spr103_regnum: return regnum2spr (103);
case sim_ppc_spr104_regnum: return regnum2spr (104);
case sim_ppc_spr105_regnum: return regnum2spr (105);
case sim_ppc_spr106_regnum: return regnum2spr (106);
case sim_ppc_spr107_regnum: return regnum2spr (107);
case sim_ppc_spr108_regnum: return regnum2spr (108);
case sim_ppc_spr109_regnum: return regnum2spr (109);
case sim_ppc_spr110_regnum: return regnum2spr (110);
case sim_ppc_spr111_regnum: return regnum2spr (111);
case sim_ppc_spr112_regnum: return regnum2spr (112);
case sim_ppc_spr113_regnum: return regnum2spr (113);
case sim_ppc_spr114_regnum: return regnum2spr (114);
case sim_ppc_spr115_regnum: return regnum2spr (115);
case sim_ppc_spr116_regnum: return regnum2spr (116);
case sim_ppc_spr117_regnum: return regnum2spr (117);
case sim_ppc_spr118_regnum: return regnum2spr (118);
case sim_ppc_spr119_regnum: return regnum2spr (119);
case sim_ppc_spr120_regnum: return regnum2spr (120);
case sim_ppc_spr121_regnum: return regnum2spr (121);
case sim_ppc_spr122_regnum: return regnum2spr (122);
case sim_ppc_spr123_regnum: return regnum2spr (123);
case sim_ppc_spr124_regnum: return regnum2spr (124);
case sim_ppc_spr125_regnum: return regnum2spr (125);
case sim_ppc_spr126_regnum: return regnum2spr (126);
case sim_ppc_spr127_regnum: return regnum2spr (127);
case sim_ppc_spr128_regnum: return regnum2spr (128);
case sim_ppc_spr129_regnum: return regnum2spr (129);
case sim_ppc_spr130_regnum: return regnum2spr (130);
case sim_ppc_spr131_regnum: return regnum2spr (131);
case sim_ppc_spr132_regnum: return regnum2spr (132);
case sim_ppc_spr133_regnum: return regnum2spr (133);
case sim_ppc_spr134_regnum: return regnum2spr (134);
case sim_ppc_spr135_regnum: return regnum2spr (135);
case sim_ppc_spr136_regnum: return regnum2spr (136);
case sim_ppc_spr137_regnum: return regnum2spr (137);
case sim_ppc_spr138_regnum: return regnum2spr (138);
case sim_ppc_spr139_regnum: return regnum2spr (139);
case sim_ppc_spr140_regnum: return regnum2spr (140);
case sim_ppc_spr141_regnum: return regnum2spr (141);
case sim_ppc_spr142_regnum: return regnum2spr (142);
case sim_ppc_spr143_regnum: return regnum2spr (143);
case sim_ppc_spr144_regnum: return regnum2spr (144);
case sim_ppc_spr145_regnum: return regnum2spr (145);
case sim_ppc_spr146_regnum: return regnum2spr (146);
case sim_ppc_spr147_regnum: return regnum2spr (147);
case sim_ppc_spr148_regnum: return regnum2spr (148);
case sim_ppc_spr149_regnum: return regnum2spr (149);
case sim_ppc_spr150_regnum: return regnum2spr (150);
case sim_ppc_spr151_regnum: return regnum2spr (151);
case sim_ppc_spr152_regnum: return regnum2spr (152);
case sim_ppc_spr153_regnum: return regnum2spr (153);
case sim_ppc_spr154_regnum: return regnum2spr (154);
case sim_ppc_spr155_regnum: return regnum2spr (155);
case sim_ppc_spr156_regnum: return regnum2spr (156);
case sim_ppc_spr157_regnum: return regnum2spr (157);
case sim_ppc_spr158_regnum: return regnum2spr (158);
case sim_ppc_spr159_regnum: return regnum2spr (159);
case sim_ppc_spr160_regnum: return regnum2spr (160);
case sim_ppc_spr161_regnum: return regnum2spr (161);
case sim_ppc_spr162_regnum: return regnum2spr (162);
case sim_ppc_spr163_regnum: return regnum2spr (163);
case sim_ppc_spr164_regnum: return regnum2spr (164);
case sim_ppc_spr165_regnum: return regnum2spr (165);
case sim_ppc_spr166_regnum: return regnum2spr (166);
case sim_ppc_spr167_regnum: return regnum2spr (167);
case sim_ppc_spr168_regnum: return regnum2spr (168);
case sim_ppc_spr169_regnum: return regnum2spr (169);
case sim_ppc_spr170_regnum: return regnum2spr (170);
case sim_ppc_spr171_regnum: return regnum2spr (171);
case sim_ppc_spr172_regnum: return regnum2spr (172);
case sim_ppc_spr173_regnum: return regnum2spr (173);
case sim_ppc_spr174_regnum: return regnum2spr (174);
case sim_ppc_spr175_regnum: return regnum2spr (175);
case sim_ppc_spr176_regnum: return regnum2spr (176);
case sim_ppc_spr177_regnum: return regnum2spr (177);
case sim_ppc_spr178_regnum: return regnum2spr (178);
case sim_ppc_spr179_regnum: return regnum2spr (179);
case sim_ppc_spr180_regnum: return regnum2spr (180);
case sim_ppc_spr181_regnum: return regnum2spr (181);
case sim_ppc_spr182_regnum: return regnum2spr (182);
case sim_ppc_spr183_regnum: return regnum2spr (183);
case sim_ppc_spr184_regnum: return regnum2spr (184);
case sim_ppc_spr185_regnum: return regnum2spr (185);
case sim_ppc_spr186_regnum: return regnum2spr (186);
case sim_ppc_spr187_regnum: return regnum2spr (187);
case sim_ppc_spr188_regnum: return regnum2spr (188);
case sim_ppc_spr189_regnum: return regnum2spr (189);
case sim_ppc_spr190_regnum: return regnum2spr (190);
case sim_ppc_spr191_regnum: return regnum2spr (191);
case sim_ppc_spr192_regnum: return regnum2spr (192);
case sim_ppc_spr193_regnum: return regnum2spr (193);
case sim_ppc_spr194_regnum: return regnum2spr (194);
case sim_ppc_spr195_regnum: return regnum2spr (195);
case sim_ppc_spr196_regnum: return regnum2spr (196);
case sim_ppc_spr197_regnum: return regnum2spr (197);
case sim_ppc_spr198_regnum: return regnum2spr (198);
case sim_ppc_spr199_regnum: return regnum2spr (199);
case sim_ppc_spr200_regnum: return regnum2spr (200);
case sim_ppc_spr201_regnum: return regnum2spr (201);
case sim_ppc_spr202_regnum: return regnum2spr (202);
case sim_ppc_spr203_regnum: return regnum2spr (203);
case sim_ppc_spr204_regnum: return regnum2spr (204);
case sim_ppc_spr205_regnum: return regnum2spr (205);
case sim_ppc_spr206_regnum: return regnum2spr (206);
case sim_ppc_spr207_regnum: return regnum2spr (207);
case sim_ppc_spr208_regnum: return regnum2spr (208);
case sim_ppc_spr209_regnum: return regnum2spr (209);
case sim_ppc_spr210_regnum: return regnum2spr (210);
case sim_ppc_spr211_regnum: return regnum2spr (211);
case sim_ppc_spr212_regnum: return regnum2spr (212);
case sim_ppc_spr213_regnum: return regnum2spr (213);
case sim_ppc_spr214_regnum: return regnum2spr (214);
case sim_ppc_spr215_regnum: return regnum2spr (215);
case sim_ppc_spr216_regnum: return regnum2spr (216);
case sim_ppc_spr217_regnum: return regnum2spr (217);
case sim_ppc_spr218_regnum: return regnum2spr (218);
case sim_ppc_spr219_regnum: return regnum2spr (219);
case sim_ppc_spr220_regnum: return regnum2spr (220);
case sim_ppc_spr221_regnum: return regnum2spr (221);
case sim_ppc_spr222_regnum: return regnum2spr (222);
case sim_ppc_spr223_regnum: return regnum2spr (223);
case sim_ppc_spr224_regnum: return regnum2spr (224);
case sim_ppc_spr225_regnum: return regnum2spr (225);
case sim_ppc_spr226_regnum: return regnum2spr (226);
case sim_ppc_spr227_regnum: return regnum2spr (227);
case sim_ppc_spr228_regnum: return regnum2spr (228);
case sim_ppc_spr229_regnum: return regnum2spr (229);
case sim_ppc_spr230_regnum: return regnum2spr (230);
case sim_ppc_spr231_regnum: return regnum2spr (231);
case sim_ppc_spr232_regnum: return regnum2spr (232);
case sim_ppc_spr233_regnum: return regnum2spr (233);
case sim_ppc_spr234_regnum: return regnum2spr (234);
case sim_ppc_spr235_regnum: return regnum2spr (235);
case sim_ppc_spr236_regnum: return regnum2spr (236);
case sim_ppc_spr237_regnum: return regnum2spr (237);
case sim_ppc_spr238_regnum: return regnum2spr (238);
case sim_ppc_spr239_regnum: return regnum2spr (239);
case sim_ppc_spr240_regnum: return regnum2spr (240);
case sim_ppc_spr241_regnum: return regnum2spr (241);
case sim_ppc_spr242_regnum: return regnum2spr (242);
case sim_ppc_spr243_regnum: return regnum2spr (243);
case sim_ppc_spr244_regnum: return regnum2spr (244);
case sim_ppc_spr245_regnum: return regnum2spr (245);
case sim_ppc_spr246_regnum: return regnum2spr (246);
case sim_ppc_spr247_regnum: return regnum2spr (247);
case sim_ppc_spr248_regnum: return regnum2spr (248);
case sim_ppc_spr249_regnum: return regnum2spr (249);
case sim_ppc_spr250_regnum: return regnum2spr (250);
case sim_ppc_spr251_regnum: return regnum2spr (251);
case sim_ppc_spr252_regnum: return regnum2spr (252);
case sim_ppc_spr253_regnum: return regnum2spr (253);
case sim_ppc_spr254_regnum: return regnum2spr (254);
case sim_ppc_spr255_regnum: return regnum2spr (255);
case sim_ppc_spr256_regnum: return regnum2spr (256);
case sim_ppc_spr257_regnum: return regnum2spr (257);
case sim_ppc_spr258_regnum: return regnum2spr (258);
case sim_ppc_spr259_regnum: return regnum2spr (259);
case sim_ppc_spr260_regnum: return regnum2spr (260);
case sim_ppc_spr261_regnum: return regnum2spr (261);
case sim_ppc_spr262_regnum: return regnum2spr (262);
case sim_ppc_spr263_regnum: return regnum2spr (263);
case sim_ppc_spr264_regnum: return regnum2spr (264);
case sim_ppc_spr265_regnum: return regnum2spr (265);
case sim_ppc_spr266_regnum: return regnum2spr (266);
case sim_ppc_spr267_regnum: return regnum2spr (267);
case sim_ppc_spr268_regnum: return regnum2spr (268);
case sim_ppc_spr269_regnum: return regnum2spr (269);
case sim_ppc_spr270_regnum: return regnum2spr (270);
case sim_ppc_spr271_regnum: return regnum2spr (271);
case sim_ppc_spr272_regnum: return regnum2spr (272);
case sim_ppc_spr273_regnum: return regnum2spr (273);
case sim_ppc_spr274_regnum: return regnum2spr (274);
case sim_ppc_spr275_regnum: return regnum2spr (275);
case sim_ppc_spr276_regnum: return regnum2spr (276);
case sim_ppc_spr277_regnum: return regnum2spr (277);
case sim_ppc_spr278_regnum: return regnum2spr (278);
case sim_ppc_spr279_regnum: return regnum2spr (279);
case sim_ppc_spr280_regnum: return regnum2spr (280);
case sim_ppc_spr281_regnum: return regnum2spr (281);
case sim_ppc_spr282_regnum: return regnum2spr (282);
case sim_ppc_spr283_regnum: return regnum2spr (283);
case sim_ppc_spr284_regnum: return regnum2spr (284);
case sim_ppc_spr285_regnum: return regnum2spr (285);
case sim_ppc_spr286_regnum: return regnum2spr (286);
case sim_ppc_spr287_regnum: return regnum2spr (287);
case sim_ppc_spr288_regnum: return regnum2spr (288);
case sim_ppc_spr289_regnum: return regnum2spr (289);
case sim_ppc_spr290_regnum: return regnum2spr (290);
case sim_ppc_spr291_regnum: return regnum2spr (291);
case sim_ppc_spr292_regnum: return regnum2spr (292);
case sim_ppc_spr293_regnum: return regnum2spr (293);
case sim_ppc_spr294_regnum: return regnum2spr (294);
case sim_ppc_spr295_regnum: return regnum2spr (295);
case sim_ppc_spr296_regnum: return regnum2spr (296);
case sim_ppc_spr297_regnum: return regnum2spr (297);
case sim_ppc_spr298_regnum: return regnum2spr (298);
case sim_ppc_spr299_regnum: return regnum2spr (299);
case sim_ppc_spr300_regnum: return regnum2spr (300);
case sim_ppc_spr301_regnum: return regnum2spr (301);
case sim_ppc_spr302_regnum: return regnum2spr (302);
case sim_ppc_spr303_regnum: return regnum2spr (303);
case sim_ppc_spr304_regnum: return regnum2spr (304);
case sim_ppc_spr305_regnum: return regnum2spr (305);
case sim_ppc_spr306_regnum: return regnum2spr (306);
case sim_ppc_spr307_regnum: return regnum2spr (307);
case sim_ppc_spr308_regnum: return regnum2spr (308);
case sim_ppc_spr309_regnum: return regnum2spr (309);
case sim_ppc_spr310_regnum: return regnum2spr (310);
case sim_ppc_spr311_regnum: return regnum2spr (311);
case sim_ppc_spr312_regnum: return regnum2spr (312);
case sim_ppc_spr313_regnum: return regnum2spr (313);
case sim_ppc_spr314_regnum: return regnum2spr (314);
case sim_ppc_spr315_regnum: return regnum2spr (315);
case sim_ppc_spr316_regnum: return regnum2spr (316);
case sim_ppc_spr317_regnum: return regnum2spr (317);
case sim_ppc_spr318_regnum: return regnum2spr (318);
case sim_ppc_spr319_regnum: return regnum2spr (319);
case sim_ppc_spr320_regnum: return regnum2spr (320);
case sim_ppc_spr321_regnum: return regnum2spr (321);
case sim_ppc_spr322_regnum: return regnum2spr (322);
case sim_ppc_spr323_regnum: return regnum2spr (323);
case sim_ppc_spr324_regnum: return regnum2spr (324);
case sim_ppc_spr325_regnum: return regnum2spr (325);
case sim_ppc_spr326_regnum: return regnum2spr (326);
case sim_ppc_spr327_regnum: return regnum2spr (327);
case sim_ppc_spr328_regnum: return regnum2spr (328);
case sim_ppc_spr329_regnum: return regnum2spr (329);
case sim_ppc_spr330_regnum: return regnum2spr (330);
case sim_ppc_spr331_regnum: return regnum2spr (331);
case sim_ppc_spr332_regnum: return regnum2spr (332);
case sim_ppc_spr333_regnum: return regnum2spr (333);
case sim_ppc_spr334_regnum: return regnum2spr (334);
case sim_ppc_spr335_regnum: return regnum2spr (335);
case sim_ppc_spr336_regnum: return regnum2spr (336);
case sim_ppc_spr337_regnum: return regnum2spr (337);
case sim_ppc_spr338_regnum: return regnum2spr (338);
case sim_ppc_spr339_regnum: return regnum2spr (339);
case sim_ppc_spr340_regnum: return regnum2spr (340);
case sim_ppc_spr341_regnum: return regnum2spr (341);
case sim_ppc_spr342_regnum: return regnum2spr (342);
case sim_ppc_spr343_regnum: return regnum2spr (343);
case sim_ppc_spr344_regnum: return regnum2spr (344);
case sim_ppc_spr345_regnum: return regnum2spr (345);
case sim_ppc_spr346_regnum: return regnum2spr (346);
case sim_ppc_spr347_regnum: return regnum2spr (347);
case sim_ppc_spr348_regnum: return regnum2spr (348);
case sim_ppc_spr349_regnum: return regnum2spr (349);
case sim_ppc_spr350_regnum: return regnum2spr (350);
case sim_ppc_spr351_regnum: return regnum2spr (351);
case sim_ppc_spr352_regnum: return regnum2spr (352);
case sim_ppc_spr353_regnum: return regnum2spr (353);
case sim_ppc_spr354_regnum: return regnum2spr (354);
case sim_ppc_spr355_regnum: return regnum2spr (355);
case sim_ppc_spr356_regnum: return regnum2spr (356);
case sim_ppc_spr357_regnum: return regnum2spr (357);
case sim_ppc_spr358_regnum: return regnum2spr (358);
case sim_ppc_spr359_regnum: return regnum2spr (359);
case sim_ppc_spr360_regnum: return regnum2spr (360);
case sim_ppc_spr361_regnum: return regnum2spr (361);
case sim_ppc_spr362_regnum: return regnum2spr (362);
case sim_ppc_spr363_regnum: return regnum2spr (363);
case sim_ppc_spr364_regnum: return regnum2spr (364);
case sim_ppc_spr365_regnum: return regnum2spr (365);
case sim_ppc_spr366_regnum: return regnum2spr (366);
case sim_ppc_spr367_regnum: return regnum2spr (367);
case sim_ppc_spr368_regnum: return regnum2spr (368);
case sim_ppc_spr369_regnum: return regnum2spr (369);
case sim_ppc_spr370_regnum: return regnum2spr (370);
case sim_ppc_spr371_regnum: return regnum2spr (371);
case sim_ppc_spr372_regnum: return regnum2spr (372);
case sim_ppc_spr373_regnum: return regnum2spr (373);
case sim_ppc_spr374_regnum: return regnum2spr (374);
case sim_ppc_spr375_regnum: return regnum2spr (375);
case sim_ppc_spr376_regnum: return regnum2spr (376);
case sim_ppc_spr377_regnum: return regnum2spr (377);
case sim_ppc_spr378_regnum: return regnum2spr (378);
case sim_ppc_spr379_regnum: return regnum2spr (379);
case sim_ppc_spr380_regnum: return regnum2spr (380);
case sim_ppc_spr381_regnum: return regnum2spr (381);
case sim_ppc_spr382_regnum: return regnum2spr (382);
case sim_ppc_spr383_regnum: return regnum2spr (383);
case sim_ppc_spr384_regnum: return regnum2spr (384);
case sim_ppc_spr385_regnum: return regnum2spr (385);
case sim_ppc_spr386_regnum: return regnum2spr (386);
case sim_ppc_spr387_regnum: return regnum2spr (387);
case sim_ppc_spr388_regnum: return regnum2spr (388);
case sim_ppc_spr389_regnum: return regnum2spr (389);
case sim_ppc_spr390_regnum: return regnum2spr (390);
case sim_ppc_spr391_regnum: return regnum2spr (391);
case sim_ppc_spr392_regnum: return regnum2spr (392);
case sim_ppc_spr393_regnum: return regnum2spr (393);
case sim_ppc_spr394_regnum: return regnum2spr (394);
case sim_ppc_spr395_regnum: return regnum2spr (395);
case sim_ppc_spr396_regnum: return regnum2spr (396);
case sim_ppc_spr397_regnum: return regnum2spr (397);
case sim_ppc_spr398_regnum: return regnum2spr (398);
case sim_ppc_spr399_regnum: return regnum2spr (399);
case sim_ppc_spr400_regnum: return regnum2spr (400);
case sim_ppc_spr401_regnum: return regnum2spr (401);
case sim_ppc_spr402_regnum: return regnum2spr (402);
case sim_ppc_spr403_regnum: return regnum2spr (403);
case sim_ppc_spr404_regnum: return regnum2spr (404);
case sim_ppc_spr405_regnum: return regnum2spr (405);
case sim_ppc_spr406_regnum: return regnum2spr (406);
case sim_ppc_spr407_regnum: return regnum2spr (407);
case sim_ppc_spr408_regnum: return regnum2spr (408);
case sim_ppc_spr409_regnum: return regnum2spr (409);
case sim_ppc_spr410_regnum: return regnum2spr (410);
case sim_ppc_spr411_regnum: return regnum2spr (411);
case sim_ppc_spr412_regnum: return regnum2spr (412);
case sim_ppc_spr413_regnum: return regnum2spr (413);
case sim_ppc_spr414_regnum: return regnum2spr (414);
case sim_ppc_spr415_regnum: return regnum2spr (415);
case sim_ppc_spr416_regnum: return regnum2spr (416);
case sim_ppc_spr417_regnum: return regnum2spr (417);
case sim_ppc_spr418_regnum: return regnum2spr (418);
case sim_ppc_spr419_regnum: return regnum2spr (419);
case sim_ppc_spr420_regnum: return regnum2spr (420);
case sim_ppc_spr421_regnum: return regnum2spr (421);
case sim_ppc_spr422_regnum: return regnum2spr (422);
case sim_ppc_spr423_regnum: return regnum2spr (423);
case sim_ppc_spr424_regnum: return regnum2spr (424);
case sim_ppc_spr425_regnum: return regnum2spr (425);
case sim_ppc_spr426_regnum: return regnum2spr (426);
case sim_ppc_spr427_regnum: return regnum2spr (427);
case sim_ppc_spr428_regnum: return regnum2spr (428);
case sim_ppc_spr429_regnum: return regnum2spr (429);
case sim_ppc_spr430_regnum: return regnum2spr (430);
case sim_ppc_spr431_regnum: return regnum2spr (431);
case sim_ppc_spr432_regnum: return regnum2spr (432);
case sim_ppc_spr433_regnum: return regnum2spr (433);
case sim_ppc_spr434_regnum: return regnum2spr (434);
case sim_ppc_spr435_regnum: return regnum2spr (435);
case sim_ppc_spr436_regnum: return regnum2spr (436);
case sim_ppc_spr437_regnum: return regnum2spr (437);
case sim_ppc_spr438_regnum: return regnum2spr (438);
case sim_ppc_spr439_regnum: return regnum2spr (439);
case sim_ppc_spr440_regnum: return regnum2spr (440);
case sim_ppc_spr441_regnum: return regnum2spr (441);
case sim_ppc_spr442_regnum: return regnum2spr (442);
case sim_ppc_spr443_regnum: return regnum2spr (443);
case sim_ppc_spr444_regnum: return regnum2spr (444);
case sim_ppc_spr445_regnum: return regnum2spr (445);
case sim_ppc_spr446_regnum: return regnum2spr (446);
case sim_ppc_spr447_regnum: return regnum2spr (447);
case sim_ppc_spr448_regnum: return regnum2spr (448);
case sim_ppc_spr449_regnum: return regnum2spr (449);
case sim_ppc_spr450_regnum: return regnum2spr (450);
case sim_ppc_spr451_regnum: return regnum2spr (451);
case sim_ppc_spr452_regnum: return regnum2spr (452);
case sim_ppc_spr453_regnum: return regnum2spr (453);
case sim_ppc_spr454_regnum: return regnum2spr (454);
case sim_ppc_spr455_regnum: return regnum2spr (455);
case sim_ppc_spr456_regnum: return regnum2spr (456);
case sim_ppc_spr457_regnum: return regnum2spr (457);
case sim_ppc_spr458_regnum: return regnum2spr (458);
case sim_ppc_spr459_regnum: return regnum2spr (459);
case sim_ppc_spr460_regnum: return regnum2spr (460);
case sim_ppc_spr461_regnum: return regnum2spr (461);
case sim_ppc_spr462_regnum: return regnum2spr (462);
case sim_ppc_spr463_regnum: return regnum2spr (463);
case sim_ppc_spr464_regnum: return regnum2spr (464);
case sim_ppc_spr465_regnum: return regnum2spr (465);
case sim_ppc_spr466_regnum: return regnum2spr (466);
case sim_ppc_spr467_regnum: return regnum2spr (467);
case sim_ppc_spr468_regnum: return regnum2spr (468);
case sim_ppc_spr469_regnum: return regnum2spr (469);
case sim_ppc_spr470_regnum: return regnum2spr (470);
case sim_ppc_spr471_regnum: return regnum2spr (471);
case sim_ppc_spr472_regnum: return regnum2spr (472);
case sim_ppc_spr473_regnum: return regnum2spr (473);
case sim_ppc_spr474_regnum: return regnum2spr (474);
case sim_ppc_spr475_regnum: return regnum2spr (475);
case sim_ppc_spr476_regnum: return regnum2spr (476);
case sim_ppc_spr477_regnum: return regnum2spr (477);
case sim_ppc_spr478_regnum: return regnum2spr (478);
case sim_ppc_spr479_regnum: return regnum2spr (479);
case sim_ppc_spr480_regnum: return regnum2spr (480);
case sim_ppc_spr481_regnum: return regnum2spr (481);
case sim_ppc_spr482_regnum: return regnum2spr (482);
case sim_ppc_spr483_regnum: return regnum2spr (483);
case sim_ppc_spr484_regnum: return regnum2spr (484);
case sim_ppc_spr485_regnum: return regnum2spr (485);
case sim_ppc_spr486_regnum: return regnum2spr (486);
case sim_ppc_spr487_regnum: return regnum2spr (487);
case sim_ppc_spr488_regnum: return regnum2spr (488);
case sim_ppc_spr489_regnum: return regnum2spr (489);
case sim_ppc_spr490_regnum: return regnum2spr (490);
case sim_ppc_spr491_regnum: return regnum2spr (491);
case sim_ppc_spr492_regnum: return regnum2spr (492);
case sim_ppc_spr493_regnum: return regnum2spr (493);
case sim_ppc_spr494_regnum: return regnum2spr (494);
case sim_ppc_spr495_regnum: return regnum2spr (495);
case sim_ppc_spr496_regnum: return regnum2spr (496);
case sim_ppc_spr497_regnum: return regnum2spr (497);
case sim_ppc_spr498_regnum: return regnum2spr (498);
case sim_ppc_spr499_regnum: return regnum2spr (499);
case sim_ppc_spr500_regnum: return regnum2spr (500);
case sim_ppc_spr501_regnum: return regnum2spr (501);
case sim_ppc_spr502_regnum: return regnum2spr (502);
case sim_ppc_spr503_regnum: return regnum2spr (503);
case sim_ppc_spr504_regnum: return regnum2spr (504);
case sim_ppc_spr505_regnum: return regnum2spr (505);
case sim_ppc_spr506_regnum: return regnum2spr (506);
case sim_ppc_spr507_regnum: return regnum2spr (507);
case sim_ppc_spr508_regnum: return regnum2spr (508);
case sim_ppc_spr509_regnum: return regnum2spr (509);
case sim_ppc_spr510_regnum: return regnum2spr (510);
case sim_ppc_spr511_regnum: return regnum2spr (511);
case sim_ppc_spr512_regnum: return regnum2spr (512);
case sim_ppc_spr513_regnum: return regnum2spr (513);
case sim_ppc_spr514_regnum: return regnum2spr (514);
case sim_ppc_spr515_regnum: return regnum2spr (515);
case sim_ppc_spr516_regnum: return regnum2spr (516);
case sim_ppc_spr517_regnum: return regnum2spr (517);
case sim_ppc_spr518_regnum: return regnum2spr (518);
case sim_ppc_spr519_regnum: return regnum2spr (519);
case sim_ppc_spr520_regnum: return regnum2spr (520);
case sim_ppc_spr521_regnum: return regnum2spr (521);
case sim_ppc_spr522_regnum: return regnum2spr (522);
case sim_ppc_spr523_regnum: return regnum2spr (523);
case sim_ppc_spr524_regnum: return regnum2spr (524);
case sim_ppc_spr525_regnum: return regnum2spr (525);
case sim_ppc_spr526_regnum: return regnum2spr (526);
case sim_ppc_spr527_regnum: return regnum2spr (527);
case sim_ppc_spr528_regnum: return regnum2spr (528);
case sim_ppc_spr529_regnum: return regnum2spr (529);
case sim_ppc_spr530_regnum: return regnum2spr (530);
case sim_ppc_spr531_regnum: return regnum2spr (531);
case sim_ppc_spr532_regnum: return regnum2spr (532);
case sim_ppc_spr533_regnum: return regnum2spr (533);
case sim_ppc_spr534_regnum: return regnum2spr (534);
case sim_ppc_spr535_regnum: return regnum2spr (535);
case sim_ppc_spr536_regnum: return regnum2spr (536);
case sim_ppc_spr537_regnum: return regnum2spr (537);
case sim_ppc_spr538_regnum: return regnum2spr (538);
case sim_ppc_spr539_regnum: return regnum2spr (539);
case sim_ppc_spr540_regnum: return regnum2spr (540);
case sim_ppc_spr541_regnum: return regnum2spr (541);
case sim_ppc_spr542_regnum: return regnum2spr (542);
case sim_ppc_spr543_regnum: return regnum2spr (543);
case sim_ppc_spr544_regnum: return regnum2spr (544);
case sim_ppc_spr545_regnum: return regnum2spr (545);
case sim_ppc_spr546_regnum: return regnum2spr (546);
case sim_ppc_spr547_regnum: return regnum2spr (547);
case sim_ppc_spr548_regnum: return regnum2spr (548);
case sim_ppc_spr549_regnum: return regnum2spr (549);
case sim_ppc_spr550_regnum: return regnum2spr (550);
case sim_ppc_spr551_regnum: return regnum2spr (551);
case sim_ppc_spr552_regnum: return regnum2spr (552);
case sim_ppc_spr553_regnum: return regnum2spr (553);
case sim_ppc_spr554_regnum: return regnum2spr (554);
case sim_ppc_spr555_regnum: return regnum2spr (555);
case sim_ppc_spr556_regnum: return regnum2spr (556);
case sim_ppc_spr557_regnum: return regnum2spr (557);
case sim_ppc_spr558_regnum: return regnum2spr (558);
case sim_ppc_spr559_regnum: return regnum2spr (559);
case sim_ppc_spr560_regnum: return regnum2spr (560);
case sim_ppc_spr561_regnum: return regnum2spr (561);
case sim_ppc_spr562_regnum: return regnum2spr (562);
case sim_ppc_spr563_regnum: return regnum2spr (563);
case sim_ppc_spr564_regnum: return regnum2spr (564);
case sim_ppc_spr565_regnum: return regnum2spr (565);
case sim_ppc_spr566_regnum: return regnum2spr (566);
case sim_ppc_spr567_regnum: return regnum2spr (567);
case sim_ppc_spr568_regnum: return regnum2spr (568);
case sim_ppc_spr569_regnum: return regnum2spr (569);
case sim_ppc_spr570_regnum: return regnum2spr (570);
case sim_ppc_spr571_regnum: return regnum2spr (571);
case sim_ppc_spr572_regnum: return regnum2spr (572);
case sim_ppc_spr573_regnum: return regnum2spr (573);
case sim_ppc_spr574_regnum: return regnum2spr (574);
case sim_ppc_spr575_regnum: return regnum2spr (575);
case sim_ppc_spr576_regnum: return regnum2spr (576);
case sim_ppc_spr577_regnum: return regnum2spr (577);
case sim_ppc_spr578_regnum: return regnum2spr (578);
case sim_ppc_spr579_regnum: return regnum2spr (579);
case sim_ppc_spr580_regnum: return regnum2spr (580);
case sim_ppc_spr581_regnum: return regnum2spr (581);
case sim_ppc_spr582_regnum: return regnum2spr (582);
case sim_ppc_spr583_regnum: return regnum2spr (583);
case sim_ppc_spr584_regnum: return regnum2spr (584);
case sim_ppc_spr585_regnum: return regnum2spr (585);
case sim_ppc_spr586_regnum: return regnum2spr (586);
case sim_ppc_spr587_regnum: return regnum2spr (587);
case sim_ppc_spr588_regnum: return regnum2spr (588);
case sim_ppc_spr589_regnum: return regnum2spr (589);
case sim_ppc_spr590_regnum: return regnum2spr (590);
case sim_ppc_spr591_regnum: return regnum2spr (591);
case sim_ppc_spr592_regnum: return regnum2spr (592);
case sim_ppc_spr593_regnum: return regnum2spr (593);
case sim_ppc_spr594_regnum: return regnum2spr (594);
case sim_ppc_spr595_regnum: return regnum2spr (595);
case sim_ppc_spr596_regnum: return regnum2spr (596);
case sim_ppc_spr597_regnum: return regnum2spr (597);
case sim_ppc_spr598_regnum: return regnum2spr (598);
case sim_ppc_spr599_regnum: return regnum2spr (599);
case sim_ppc_spr600_regnum: return regnum2spr (600);
case sim_ppc_spr601_regnum: return regnum2spr (601);
case sim_ppc_spr602_regnum: return regnum2spr (602);
case sim_ppc_spr603_regnum: return regnum2spr (603);
case sim_ppc_spr604_regnum: return regnum2spr (604);
case sim_ppc_spr605_regnum: return regnum2spr (605);
case sim_ppc_spr606_regnum: return regnum2spr (606);
case sim_ppc_spr607_regnum: return regnum2spr (607);
case sim_ppc_spr608_regnum: return regnum2spr (608);
case sim_ppc_spr609_regnum: return regnum2spr (609);
case sim_ppc_spr610_regnum: return regnum2spr (610);
case sim_ppc_spr611_regnum: return regnum2spr (611);
case sim_ppc_spr612_regnum: return regnum2spr (612);
case sim_ppc_spr613_regnum: return regnum2spr (613);
case sim_ppc_spr614_regnum: return regnum2spr (614);
case sim_ppc_spr615_regnum: return regnum2spr (615);
case sim_ppc_spr616_regnum: return regnum2spr (616);
case sim_ppc_spr617_regnum: return regnum2spr (617);
case sim_ppc_spr618_regnum: return regnum2spr (618);
case sim_ppc_spr619_regnum: return regnum2spr (619);
case sim_ppc_spr620_regnum: return regnum2spr (620);
case sim_ppc_spr621_regnum: return regnum2spr (621);
case sim_ppc_spr622_regnum: return regnum2spr (622);
case sim_ppc_spr623_regnum: return regnum2spr (623);
case sim_ppc_spr624_regnum: return regnum2spr (624);
case sim_ppc_spr625_regnum: return regnum2spr (625);
case sim_ppc_spr626_regnum: return regnum2spr (626);
case sim_ppc_spr627_regnum: return regnum2spr (627);
case sim_ppc_spr628_regnum: return regnum2spr (628);
case sim_ppc_spr629_regnum: return regnum2spr (629);
case sim_ppc_spr630_regnum: return regnum2spr (630);
case sim_ppc_spr631_regnum: return regnum2spr (631);
case sim_ppc_spr632_regnum: return regnum2spr (632);
case sim_ppc_spr633_regnum: return regnum2spr (633);
case sim_ppc_spr634_regnum: return regnum2spr (634);
case sim_ppc_spr635_regnum: return regnum2spr (635);
case sim_ppc_spr636_regnum: return regnum2spr (636);
case sim_ppc_spr637_regnum: return regnum2spr (637);
case sim_ppc_spr638_regnum: return regnum2spr (638);
case sim_ppc_spr639_regnum: return regnum2spr (639);
case sim_ppc_spr640_regnum: return regnum2spr (640);
case sim_ppc_spr641_regnum: return regnum2spr (641);
case sim_ppc_spr642_regnum: return regnum2spr (642);
case sim_ppc_spr643_regnum: return regnum2spr (643);
case sim_ppc_spr644_regnum: return regnum2spr (644);
case sim_ppc_spr645_regnum: return regnum2spr (645);
case sim_ppc_spr646_regnum: return regnum2spr (646);
case sim_ppc_spr647_regnum: return regnum2spr (647);
case sim_ppc_spr648_regnum: return regnum2spr (648);
case sim_ppc_spr649_regnum: return regnum2spr (649);
case sim_ppc_spr650_regnum: return regnum2spr (650);
case sim_ppc_spr651_regnum: return regnum2spr (651);
case sim_ppc_spr652_regnum: return regnum2spr (652);
case sim_ppc_spr653_regnum: return regnum2spr (653);
case sim_ppc_spr654_regnum: return regnum2spr (654);
case sim_ppc_spr655_regnum: return regnum2spr (655);
case sim_ppc_spr656_regnum: return regnum2spr (656);
case sim_ppc_spr657_regnum: return regnum2spr (657);
case sim_ppc_spr658_regnum: return regnum2spr (658);
case sim_ppc_spr659_regnum: return regnum2spr (659);
case sim_ppc_spr660_regnum: return regnum2spr (660);
case sim_ppc_spr661_regnum: return regnum2spr (661);
case sim_ppc_spr662_regnum: return regnum2spr (662);
case sim_ppc_spr663_regnum: return regnum2spr (663);
case sim_ppc_spr664_regnum: return regnum2spr (664);
case sim_ppc_spr665_regnum: return regnum2spr (665);
case sim_ppc_spr666_regnum: return regnum2spr (666);
case sim_ppc_spr667_regnum: return regnum2spr (667);
case sim_ppc_spr668_regnum: return regnum2spr (668);
case sim_ppc_spr669_regnum: return regnum2spr (669);
case sim_ppc_spr670_regnum: return regnum2spr (670);
case sim_ppc_spr671_regnum: return regnum2spr (671);
case sim_ppc_spr672_regnum: return regnum2spr (672);
case sim_ppc_spr673_regnum: return regnum2spr (673);
case sim_ppc_spr674_regnum: return regnum2spr (674);
case sim_ppc_spr675_regnum: return regnum2spr (675);
case sim_ppc_spr676_regnum: return regnum2spr (676);
case sim_ppc_spr677_regnum: return regnum2spr (677);
case sim_ppc_spr678_regnum: return regnum2spr (678);
case sim_ppc_spr679_regnum: return regnum2spr (679);
case sim_ppc_spr680_regnum: return regnum2spr (680);
case sim_ppc_spr681_regnum: return regnum2spr (681);
case sim_ppc_spr682_regnum: return regnum2spr (682);
case sim_ppc_spr683_regnum: return regnum2spr (683);
case sim_ppc_spr684_regnum: return regnum2spr (684);
case sim_ppc_spr685_regnum: return regnum2spr (685);
case sim_ppc_spr686_regnum: return regnum2spr (686);
case sim_ppc_spr687_regnum: return regnum2spr (687);
case sim_ppc_spr688_regnum: return regnum2spr (688);
case sim_ppc_spr689_regnum: return regnum2spr (689);
case sim_ppc_spr690_regnum: return regnum2spr (690);
case sim_ppc_spr691_regnum: return regnum2spr (691);
case sim_ppc_spr692_regnum: return regnum2spr (692);
case sim_ppc_spr693_regnum: return regnum2spr (693);
case sim_ppc_spr694_regnum: return regnum2spr (694);
case sim_ppc_spr695_regnum: return regnum2spr (695);
case sim_ppc_spr696_regnum: return regnum2spr (696);
case sim_ppc_spr697_regnum: return regnum2spr (697);
case sim_ppc_spr698_regnum: return regnum2spr (698);
case sim_ppc_spr699_regnum: return regnum2spr (699);
case sim_ppc_spr700_regnum: return regnum2spr (700);
case sim_ppc_spr701_regnum: return regnum2spr (701);
case sim_ppc_spr702_regnum: return regnum2spr (702);
case sim_ppc_spr703_regnum: return regnum2spr (703);
case sim_ppc_spr704_regnum: return regnum2spr (704);
case sim_ppc_spr705_regnum: return regnum2spr (705);
case sim_ppc_spr706_regnum: return regnum2spr (706);
case sim_ppc_spr707_regnum: return regnum2spr (707);
case sim_ppc_spr708_regnum: return regnum2spr (708);
case sim_ppc_spr709_regnum: return regnum2spr (709);
case sim_ppc_spr710_regnum: return regnum2spr (710);
case sim_ppc_spr711_regnum: return regnum2spr (711);
case sim_ppc_spr712_regnum: return regnum2spr (712);
case sim_ppc_spr713_regnum: return regnum2spr (713);
case sim_ppc_spr714_regnum: return regnum2spr (714);
case sim_ppc_spr715_regnum: return regnum2spr (715);
case sim_ppc_spr716_regnum: return regnum2spr (716);
case sim_ppc_spr717_regnum: return regnum2spr (717);
case sim_ppc_spr718_regnum: return regnum2spr (718);
case sim_ppc_spr719_regnum: return regnum2spr (719);
case sim_ppc_spr720_regnum: return regnum2spr (720);
case sim_ppc_spr721_regnum: return regnum2spr (721);
case sim_ppc_spr722_regnum: return regnum2spr (722);
case sim_ppc_spr723_regnum: return regnum2spr (723);
case sim_ppc_spr724_regnum: return regnum2spr (724);
case sim_ppc_spr725_regnum: return regnum2spr (725);
case sim_ppc_spr726_regnum: return regnum2spr (726);
case sim_ppc_spr727_regnum: return regnum2spr (727);
case sim_ppc_spr728_regnum: return regnum2spr (728);
case sim_ppc_spr729_regnum: return regnum2spr (729);
case sim_ppc_spr730_regnum: return regnum2spr (730);
case sim_ppc_spr731_regnum: return regnum2spr (731);
case sim_ppc_spr732_regnum: return regnum2spr (732);
case sim_ppc_spr733_regnum: return regnum2spr (733);
case sim_ppc_spr734_regnum: return regnum2spr (734);
case sim_ppc_spr735_regnum: return regnum2spr (735);
case sim_ppc_spr736_regnum: return regnum2spr (736);
case sim_ppc_spr737_regnum: return regnum2spr (737);
case sim_ppc_spr738_regnum: return regnum2spr (738);
case sim_ppc_spr739_regnum: return regnum2spr (739);
case sim_ppc_spr740_regnum: return regnum2spr (740);
case sim_ppc_spr741_regnum: return regnum2spr (741);
case sim_ppc_spr742_regnum: return regnum2spr (742);
case sim_ppc_spr743_regnum: return regnum2spr (743);
case sim_ppc_spr744_regnum: return regnum2spr (744);
case sim_ppc_spr745_regnum: return regnum2spr (745);
case sim_ppc_spr746_regnum: return regnum2spr (746);
case sim_ppc_spr747_regnum: return regnum2spr (747);
case sim_ppc_spr748_regnum: return regnum2spr (748);
case sim_ppc_spr749_regnum: return regnum2spr (749);
case sim_ppc_spr750_regnum: return regnum2spr (750);
case sim_ppc_spr751_regnum: return regnum2spr (751);
case sim_ppc_spr752_regnum: return regnum2spr (752);
case sim_ppc_spr753_regnum: return regnum2spr (753);
case sim_ppc_spr754_regnum: return regnum2spr (754);
case sim_ppc_spr755_regnum: return regnum2spr (755);
case sim_ppc_spr756_regnum: return regnum2spr (756);
case sim_ppc_spr757_regnum: return regnum2spr (757);
case sim_ppc_spr758_regnum: return regnum2spr (758);
case sim_ppc_spr759_regnum: return regnum2spr (759);
case sim_ppc_spr760_regnum: return regnum2spr (760);
case sim_ppc_spr761_regnum: return regnum2spr (761);
case sim_ppc_spr762_regnum: return regnum2spr (762);
case sim_ppc_spr763_regnum: return regnum2spr (763);
case sim_ppc_spr764_regnum: return regnum2spr (764);
case sim_ppc_spr765_regnum: return regnum2spr (765);
case sim_ppc_spr766_regnum: return regnum2spr (766);
case sim_ppc_spr767_regnum: return regnum2spr (767);
case sim_ppc_spr768_regnum: return regnum2spr (768);
case sim_ppc_spr769_regnum: return regnum2spr (769);
case sim_ppc_spr770_regnum: return regnum2spr (770);
case sim_ppc_spr771_regnum: return regnum2spr (771);
case sim_ppc_spr772_regnum: return regnum2spr (772);
case sim_ppc_spr773_regnum: return regnum2spr (773);
case sim_ppc_spr774_regnum: return regnum2spr (774);
case sim_ppc_spr775_regnum: return regnum2spr (775);
case sim_ppc_spr776_regnum: return regnum2spr (776);
case sim_ppc_spr777_regnum: return regnum2spr (777);
case sim_ppc_spr778_regnum: return regnum2spr (778);
case sim_ppc_spr779_regnum: return regnum2spr (779);
case sim_ppc_spr780_regnum: return regnum2spr (780);
case sim_ppc_spr781_regnum: return regnum2spr (781);
case sim_ppc_spr782_regnum: return regnum2spr (782);
case sim_ppc_spr783_regnum: return regnum2spr (783);
case sim_ppc_spr784_regnum: return regnum2spr (784);
case sim_ppc_spr785_regnum: return regnum2spr (785);
case sim_ppc_spr786_regnum: return regnum2spr (786);
case sim_ppc_spr787_regnum: return regnum2spr (787);
case sim_ppc_spr788_regnum: return regnum2spr (788);
case sim_ppc_spr789_regnum: return regnum2spr (789);
case sim_ppc_spr790_regnum: return regnum2spr (790);
case sim_ppc_spr791_regnum: return regnum2spr (791);
case sim_ppc_spr792_regnum: return regnum2spr (792);
case sim_ppc_spr793_regnum: return regnum2spr (793);
case sim_ppc_spr794_regnum: return regnum2spr (794);
case sim_ppc_spr795_regnum: return regnum2spr (795);
case sim_ppc_spr796_regnum: return regnum2spr (796);
case sim_ppc_spr797_regnum: return regnum2spr (797);
case sim_ppc_spr798_regnum: return regnum2spr (798);
case sim_ppc_spr799_regnum: return regnum2spr (799);
case sim_ppc_spr800_regnum: return regnum2spr (800);
case sim_ppc_spr801_regnum: return regnum2spr (801);
case sim_ppc_spr802_regnum: return regnum2spr (802);
case sim_ppc_spr803_regnum: return regnum2spr (803);
case sim_ppc_spr804_regnum: return regnum2spr (804);
case sim_ppc_spr805_regnum: return regnum2spr (805);
case sim_ppc_spr806_regnum: return regnum2spr (806);
case sim_ppc_spr807_regnum: return regnum2spr (807);
case sim_ppc_spr808_regnum: return regnum2spr (808);
case sim_ppc_spr809_regnum: return regnum2spr (809);
case sim_ppc_spr810_regnum: return regnum2spr (810);
case sim_ppc_spr811_regnum: return regnum2spr (811);
case sim_ppc_spr812_regnum: return regnum2spr (812);
case sim_ppc_spr813_regnum: return regnum2spr (813);
case sim_ppc_spr814_regnum: return regnum2spr (814);
case sim_ppc_spr815_regnum: return regnum2spr (815);
case sim_ppc_spr816_regnum: return regnum2spr (816);
case sim_ppc_spr817_regnum: return regnum2spr (817);
case sim_ppc_spr818_regnum: return regnum2spr (818);
case sim_ppc_spr819_regnum: return regnum2spr (819);
case sim_ppc_spr820_regnum: return regnum2spr (820);
case sim_ppc_spr821_regnum: return regnum2spr (821);
case sim_ppc_spr822_regnum: return regnum2spr (822);
case sim_ppc_spr823_regnum: return regnum2spr (823);
case sim_ppc_spr824_regnum: return regnum2spr (824);
case sim_ppc_spr825_regnum: return regnum2spr (825);
case sim_ppc_spr826_regnum: return regnum2spr (826);
case sim_ppc_spr827_regnum: return regnum2spr (827);
case sim_ppc_spr828_regnum: return regnum2spr (828);
case sim_ppc_spr829_regnum: return regnum2spr (829);
case sim_ppc_spr830_regnum: return regnum2spr (830);
case sim_ppc_spr831_regnum: return regnum2spr (831);
case sim_ppc_spr832_regnum: return regnum2spr (832);
case sim_ppc_spr833_regnum: return regnum2spr (833);
case sim_ppc_spr834_regnum: return regnum2spr (834);
case sim_ppc_spr835_regnum: return regnum2spr (835);
case sim_ppc_spr836_regnum: return regnum2spr (836);
case sim_ppc_spr837_regnum: return regnum2spr (837);
case sim_ppc_spr838_regnum: return regnum2spr (838);
case sim_ppc_spr839_regnum: return regnum2spr (839);
case sim_ppc_spr840_regnum: return regnum2spr (840);
case sim_ppc_spr841_regnum: return regnum2spr (841);
case sim_ppc_spr842_regnum: return regnum2spr (842);
case sim_ppc_spr843_regnum: return regnum2spr (843);
case sim_ppc_spr844_regnum: return regnum2spr (844);
case sim_ppc_spr845_regnum: return regnum2spr (845);
case sim_ppc_spr846_regnum: return regnum2spr (846);
case sim_ppc_spr847_regnum: return regnum2spr (847);
case sim_ppc_spr848_regnum: return regnum2spr (848);
case sim_ppc_spr849_regnum: return regnum2spr (849);
case sim_ppc_spr850_regnum: return regnum2spr (850);
case sim_ppc_spr851_regnum: return regnum2spr (851);
case sim_ppc_spr852_regnum: return regnum2spr (852);
case sim_ppc_spr853_regnum: return regnum2spr (853);
case sim_ppc_spr854_regnum: return regnum2spr (854);
case sim_ppc_spr855_regnum: return regnum2spr (855);
case sim_ppc_spr856_regnum: return regnum2spr (856);
case sim_ppc_spr857_regnum: return regnum2spr (857);
case sim_ppc_spr858_regnum: return regnum2spr (858);
case sim_ppc_spr859_regnum: return regnum2spr (859);
case sim_ppc_spr860_regnum: return regnum2spr (860);
case sim_ppc_spr861_regnum: return regnum2spr (861);
case sim_ppc_spr862_regnum: return regnum2spr (862);
case sim_ppc_spr863_regnum: return regnum2spr (863);
case sim_ppc_spr864_regnum: return regnum2spr (864);
case sim_ppc_spr865_regnum: return regnum2spr (865);
case sim_ppc_spr866_regnum: return regnum2spr (866);
case sim_ppc_spr867_regnum: return regnum2spr (867);
case sim_ppc_spr868_regnum: return regnum2spr (868);
case sim_ppc_spr869_regnum: return regnum2spr (869);
case sim_ppc_spr870_regnum: return regnum2spr (870);
case sim_ppc_spr871_regnum: return regnum2spr (871);
case sim_ppc_spr872_regnum: return regnum2spr (872);
case sim_ppc_spr873_regnum: return regnum2spr (873);
case sim_ppc_spr874_regnum: return regnum2spr (874);
case sim_ppc_spr875_regnum: return regnum2spr (875);
case sim_ppc_spr876_regnum: return regnum2spr (876);
case sim_ppc_spr877_regnum: return regnum2spr (877);
case sim_ppc_spr878_regnum: return regnum2spr (878);
case sim_ppc_spr879_regnum: return regnum2spr (879);
case sim_ppc_spr880_regnum: return regnum2spr (880);
case sim_ppc_spr881_regnum: return regnum2spr (881);
case sim_ppc_spr882_regnum: return regnum2spr (882);
case sim_ppc_spr883_regnum: return regnum2spr (883);
case sim_ppc_spr884_regnum: return regnum2spr (884);
case sim_ppc_spr885_regnum: return regnum2spr (885);
case sim_ppc_spr886_regnum: return regnum2spr (886);
case sim_ppc_spr887_regnum: return regnum2spr (887);
case sim_ppc_spr888_regnum: return regnum2spr (888);
case sim_ppc_spr889_regnum: return regnum2spr (889);
case sim_ppc_spr890_regnum: return regnum2spr (890);
case sim_ppc_spr891_regnum: return regnum2spr (891);
case sim_ppc_spr892_regnum: return regnum2spr (892);
case sim_ppc_spr893_regnum: return regnum2spr (893);
case sim_ppc_spr894_regnum: return regnum2spr (894);
case sim_ppc_spr895_regnum: return regnum2spr (895);
case sim_ppc_spr896_regnum: return regnum2spr (896);
case sim_ppc_spr897_regnum: return regnum2spr (897);
case sim_ppc_spr898_regnum: return regnum2spr (898);
case sim_ppc_spr899_regnum: return regnum2spr (899);
case sim_ppc_spr900_regnum: return regnum2spr (900);
case sim_ppc_spr901_regnum: return regnum2spr (901);
case sim_ppc_spr902_regnum: return regnum2spr (902);
case sim_ppc_spr903_regnum: return regnum2spr (903);
case sim_ppc_spr904_regnum: return regnum2spr (904);
case sim_ppc_spr905_regnum: return regnum2spr (905);
case sim_ppc_spr906_regnum: return regnum2spr (906);
case sim_ppc_spr907_regnum: return regnum2spr (907);
case sim_ppc_spr908_regnum: return regnum2spr (908);
case sim_ppc_spr909_regnum: return regnum2spr (909);
case sim_ppc_spr910_regnum: return regnum2spr (910);
case sim_ppc_spr911_regnum: return regnum2spr (911);
case sim_ppc_spr912_regnum: return regnum2spr (912);
case sim_ppc_spr913_regnum: return regnum2spr (913);
case sim_ppc_spr914_regnum: return regnum2spr (914);
case sim_ppc_spr915_regnum: return regnum2spr (915);
case sim_ppc_spr916_regnum: return regnum2spr (916);
case sim_ppc_spr917_regnum: return regnum2spr (917);
case sim_ppc_spr918_regnum: return regnum2spr (918);
case sim_ppc_spr919_regnum: return regnum2spr (919);
case sim_ppc_spr920_regnum: return regnum2spr (920);
case sim_ppc_spr921_regnum: return regnum2spr (921);
case sim_ppc_spr922_regnum: return regnum2spr (922);
case sim_ppc_spr923_regnum: return regnum2spr (923);
case sim_ppc_spr924_regnum: return regnum2spr (924);
case sim_ppc_spr925_regnum: return regnum2spr (925);
case sim_ppc_spr926_regnum: return regnum2spr (926);
case sim_ppc_spr927_regnum: return regnum2spr (927);
case sim_ppc_spr928_regnum: return regnum2spr (928);
case sim_ppc_spr929_regnum: return regnum2spr (929);
case sim_ppc_spr930_regnum: return regnum2spr (930);
case sim_ppc_spr931_regnum: return regnum2spr (931);
case sim_ppc_spr932_regnum: return regnum2spr (932);
case sim_ppc_spr933_regnum: return regnum2spr (933);
case sim_ppc_spr934_regnum: return regnum2spr (934);
case sim_ppc_spr935_regnum: return regnum2spr (935);
case sim_ppc_spr936_regnum: return regnum2spr (936);
case sim_ppc_spr937_regnum: return regnum2spr (937);
case sim_ppc_spr938_regnum: return regnum2spr (938);
case sim_ppc_spr939_regnum: return regnum2spr (939);
case sim_ppc_spr940_regnum: return regnum2spr (940);
case sim_ppc_spr941_regnum: return regnum2spr (941);
case sim_ppc_spr942_regnum: return regnum2spr (942);
case sim_ppc_spr943_regnum: return regnum2spr (943);
case sim_ppc_spr944_regnum: return regnum2spr (944);
case sim_ppc_spr945_regnum: return regnum2spr (945);
case sim_ppc_spr946_regnum: return regnum2spr (946);
case sim_ppc_spr947_regnum: return regnum2spr (947);
case sim_ppc_spr948_regnum: return regnum2spr (948);
case sim_ppc_spr949_regnum: return regnum2spr (949);
case sim_ppc_spr950_regnum: return regnum2spr (950);
case sim_ppc_spr951_regnum: return regnum2spr (951);
case sim_ppc_spr952_regnum: return regnum2spr (952);
case sim_ppc_spr953_regnum: return regnum2spr (953);
case sim_ppc_spr954_regnum: return regnum2spr (954);
case sim_ppc_spr955_regnum: return regnum2spr (955);
case sim_ppc_spr956_regnum: return regnum2spr (956);
case sim_ppc_spr957_regnum: return regnum2spr (957);
case sim_ppc_spr958_regnum: return regnum2spr (958);
case sim_ppc_spr959_regnum: return regnum2spr (959);
case sim_ppc_spr960_regnum: return regnum2spr (960);
case sim_ppc_spr961_regnum: return regnum2spr (961);
case sim_ppc_spr962_regnum: return regnum2spr (962);
case sim_ppc_spr963_regnum: return regnum2spr (963);
case sim_ppc_spr964_regnum: return regnum2spr (964);
case sim_ppc_spr965_regnum: return regnum2spr (965);
case sim_ppc_spr966_regnum: return regnum2spr (966);
case sim_ppc_spr967_regnum: return regnum2spr (967);
case sim_ppc_spr968_regnum: return regnum2spr (968);
case sim_ppc_spr969_regnum: return regnum2spr (969);
case sim_ppc_spr970_regnum: return regnum2spr (970);
case sim_ppc_spr971_regnum: return regnum2spr (971);
case sim_ppc_spr972_regnum: return regnum2spr (972);
case sim_ppc_spr973_regnum: return regnum2spr (973);
case sim_ppc_spr974_regnum: return regnum2spr (974);
case sim_ppc_spr975_regnum: return regnum2spr (975);
case sim_ppc_spr976_regnum: return regnum2spr (976);
case sim_ppc_spr977_regnum: return regnum2spr (977);
case sim_ppc_spr978_regnum: return regnum2spr (978);
case sim_ppc_spr979_regnum: return regnum2spr (979);
case sim_ppc_spr980_regnum: return regnum2spr (980);
case sim_ppc_spr981_regnum: return regnum2spr (981);
case sim_ppc_spr982_regnum: return regnum2spr (982);
case sim_ppc_spr983_regnum: return regnum2spr (983);
case sim_ppc_spr984_regnum: return regnum2spr (984);
case sim_ppc_spr985_regnum: return regnum2spr (985);
case sim_ppc_spr986_regnum: return regnum2spr (986);
case sim_ppc_spr987_regnum: return regnum2spr (987);
case sim_ppc_spr988_regnum: return regnum2spr (988);
case sim_ppc_spr989_regnum: return regnum2spr (989);
case sim_ppc_spr990_regnum: return regnum2spr (990);
case sim_ppc_spr991_regnum: return regnum2spr (991);
case sim_ppc_spr992_regnum: return regnum2spr (992);
case sim_ppc_spr993_regnum: return regnum2spr (993);
case sim_ppc_spr994_regnum: return regnum2spr (994);
case sim_ppc_spr995_regnum: return regnum2spr (995);
case sim_ppc_spr996_regnum: return regnum2spr (996);
case sim_ppc_spr997_regnum: return regnum2spr (997);
case sim_ppc_spr998_regnum: return regnum2spr (998);
case sim_ppc_spr999_regnum: return regnum2spr (999);
case sim_ppc_spr1000_regnum: return regnum2spr (1000);
case sim_ppc_spr1001_regnum: return regnum2spr (1001);
case sim_ppc_spr1002_regnum: return regnum2spr (1002);
case sim_ppc_spr1003_regnum: return regnum2spr (1003);
case sim_ppc_spr1004_regnum: return regnum2spr (1004);
case sim_ppc_spr1005_regnum: return regnum2spr (1005);
case sim_ppc_spr1006_regnum: return regnum2spr (1006);
case sim_ppc_spr1007_regnum: return regnum2spr (1007);
case sim_ppc_spr1008_regnum: return regnum2spr (1008);
case sim_ppc_spr1009_regnum: return regnum2spr (1009);
case sim_ppc_spr1010_regnum: return regnum2spr (1010);
case sim_ppc_spr1011_regnum: return regnum2spr (1011);
case sim_ppc_spr1012_regnum: return regnum2spr (1012);
case sim_ppc_spr1013_regnum: return regnum2spr (1013);
case sim_ppc_spr1014_regnum: return regnum2spr (1014);
case sim_ppc_spr1015_regnum: return regnum2spr (1015);
case sim_ppc_spr1016_regnum: return regnum2spr (1016);
case sim_ppc_spr1017_regnum: return regnum2spr (1017);
case sim_ppc_spr1018_regnum: return regnum2spr (1018);
case sim_ppc_spr1019_regnum: return regnum2spr (1019);
case sim_ppc_spr1020_regnum: return regnum2spr (1020);
case sim_ppc_spr1021_regnum: return regnum2spr (1021);
case sim_ppc_spr1022_regnum: return regnum2spr (1022);
case sim_ppc_spr1023_regnum: return regnum2spr (1023);
default:
/* Not a valid register number at all. */
return NULL;
}
}
int
sim_fetch_register (SIM_DESC sd, int regno, unsigned char *buf, int length)
{
const char *regname = regnum2name (regno);
if (simulator == NULL || regname == NULL)
return -1;
TRACE(trace_gdb, ("sim_fetch_register(regno=%d(%s), buf=0x%lx)\n",
regno, regname, (long)buf));
return psim_read_register(simulator, MAX_NR_PROCESSORS,
buf, regname, raw_transfer);
}
int
sim_store_register (SIM_DESC sd, int regno, unsigned char *buf, int length)
{
const char *regname = regnum2name (regno);
if (simulator == NULL || regname == NULL)
return 0;
TRACE(trace_gdb, ("sim_store_register(regno=%d(%s), buf=0x%lx)\n",
regno, regname, (long)buf));
return psim_write_register(simulator, MAX_NR_PROCESSORS,
buf, regname, raw_transfer);
}
| bitthunder-toolchain/gdb | sim/ppc/gdb-sim.c | C | gpl-2.0 | 68,392 | [
30522,
1013,
1008,
2023,
5371,
2003,
2112,
1997,
1043,
18939,
1012,
9385,
2432,
1011,
2286,
2489,
4007,
3192,
1010,
4297,
1012,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'page_object_on_demand'
| tomazy/page_object_on_demand | spec/spec_helper.rb | Ruby | mit | 91 | [
30522,
1002,
7170,
1035,
4130,
1012,
4895,
6182,
6199,
5371,
1012,
7818,
1035,
4130,
1006,
1005,
1012,
1012,
1013,
1012,
1012,
1013,
5622,
2497,
1005,
1010,
1035,
1035,
5371,
1035,
1035,
1007,
5478,
1005,
3931,
1035,
4874,
1035,
2006,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Coq bench</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../../..">Unstable</a></li>
<li><a href=".">dev / contrib:param-pi dev</a></li>
<li class="active"><a href="">2014-11-29 12:11:32</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="../../../../../about.html">About</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href=".">« Up</a>
<h1>
contrib:param-pi
<small>
dev
<span class="label label-success">7 s</span>
</small>
</h1>
<p><em><script>document.write(moment("2014-11-29 12:11:32 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2014-11-29 12:11:32 UTC)</em><p>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>ruby lint.rb unstable ../unstable/packages/coq:contrib:param-pi/coq:contrib:param-pi.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
<dt>Output</dt>
<dd><pre>The package is valid.
</pre></dd>
</dl>
<h2>Dry install</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --dry-run coq:contrib:param-pi.dev coq.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>1 s</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is dev).
The following actions will be performed:
- install coq:contrib:param-pi.dev
=== 1 to install ===
=-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Building coq:contrib:param-pi.dev:
coq_makefile -f Make -o Makefile
make -j4
make install
Installing coq:contrib:param-pi.dev.
</pre></dd>
</dl>
<p>Dry install without Coq, to test if the problem was incompatibility with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --deps-only coq:contrib:param-pi.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>1 s</dd>
</dl>
<h2>Install</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --verbose coq:contrib:param-pi.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>7 s</dd>
<dt>Output</dt>
<dd><pre>The following actions will be performed:
- install coq:contrib:param-pi.dev
=== 1 to install ===
=-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[coq:contrib:param-pi] Fetching https://gforge.inria.fr/git/coq-contribs/param-pi.git#trunk
Initialized empty Git repository in /home/bench/.opam/packages.dev/coq:contrib:param-pi.dev/.git/
[master (root-commit) 3a6ed21] opam-git-init
From https://gforge.inria.fr/git/coq-contribs/param-pi
* [new branch] trunk -> opam-ref
* [new branch] trunk -> origin/trunk
LICENSE
Make
Makefile
README
bout_red.v
description
fresh.v
induc.v
inp_red.v
out_red.v
processus.v
substitutions.v
subtyping.v
swaps_proofs.v
tau_red.v
typing_proofs.v
HEAD is now at 8024169 Applying "Unset Standard Proposition Elimination Names" for
=-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Building coq:contrib:param-pi.dev:
coq_makefile -f Make -o Makefile
make -j4
make install
"coqdep" -c -R "." ParamPi "bout_red.v" > "bout_red.v.d" || ( RV=$?; rm -f "bout_red.v.d"; exit ${RV} )
"coqdep" -c -R "." ParamPi "fresh.v" > "fresh.v.d" || ( RV=$?; rm -f "fresh.v.d"; exit ${RV} )
"coqdep" -c -R "." ParamPi "induc.v" > "induc.v.d" || ( RV=$?; rm -f "induc.v.d"; exit ${RV} )
"coqdep" -c -R "." ParamPi "inp_red.v" > "inp_red.v.d" || ( RV=$?; rm -f "inp_red.v.d"; exit ${RV} )
"coqdep" -c -R "." ParamPi "out_red.v" > "out_red.v.d" || ( RV=$?; rm -f "out_red.v.d"; exit ${RV} )
"coqdep" -c -R "." ParamPi "processus.v" > "processus.v.d" || ( RV=$?; rm -f "processus.v.d"; exit ${RV} )
"coqdep" -c -R "." ParamPi "substitutions.v" > "substitutions.v.d" || ( RV=$?; rm -f "substitutions.v.d"; exit ${RV} )
"coqdep" -c -R "." ParamPi "subtyping.v" > "subtyping.v.d" || ( RV=$?; rm -f "subtyping.v.d"; exit ${RV} )
"coqdep" -c -R "." ParamPi "swaps_proofs.v" > "swaps_proofs.v.d" || ( RV=$?; rm -f "swaps_proofs.v.d"; exit ${RV} )
"coqdep" -c -R "." ParamPi "tau_red.v" > "tau_red.v.d" || ( RV=$?; rm -f "tau_red.v.d"; exit ${RV} )
"coqdep" -c -R "." ParamPi "typing_proofs.v" > "typing_proofs.v.d" || ( RV=$?; rm -f "typing_proofs.v.d"; exit ${RV} )
"coqc" -q -R "." ParamPi processus
"coqc" -q -R "." ParamPi induc
"coqc" -q -R "." ParamPi fresh
"coqc" -q -R "." ParamPi typing_proofs
"coqc" -q -R "." ParamPi substitutions
"coqc" -q -R "." ParamPi swaps_proofs
"coqc" -q -R "." ParamPi subtyping
"coqc" -q -R "." ParamPi out_red
"coqc" -q -R "." ParamPi inp_red
"coqc" -q -R "." ParamPi bout_red
"coqc" -q -R "." ParamPi tau_red
cd "." && for i in typing_proofs.vo tau_red.vo swaps_proofs.vo subtyping.vo substitutions.vo processus.vo out_red.vo inp_red.vo induc.vo fresh.vo bout_red.vo ; do \
install -d "`dirname """/home/bench/.opam/system/lib/coq/user-contrib"/ParamPi/$i`"; \
install -m 0644 $i """/home/bench/.opam/system/lib/coq/user-contrib"/ParamPi/$i; \
done
Installing coq:contrib:param-pi.dev.
</pre></dd>
</dl>
<h2>Installation size</h2>
<p>Data not available in this bench.</p>
<h2>Uninstall</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq:contrib:param-pi.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>1 s</dd>
<dt>Output</dt>
<dd><pre>The following actions will be performed:
- remove coq:contrib:param-pi.dev
=== 1 to remove ===
=-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[coq:contrib:param-pi] Fetching https://gforge.inria.fr/git/coq-contribs/param-pi.git#trunk
=-=- Removing Packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Removing coq:contrib:param-pi.dev.
rm -R /home/bench/.opam/system/lib/coq/user-contrib/ParamPi
</pre></dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
<small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small>
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html> | coq-bench/coq-bench.github.io-old | clean/Linux-x86_64-4.02.1-1.2.0/unstable/dev/contrib:param-pi/dev/2014-11-29_12-11-32.html | HTML | mit | 10,379 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
30524,
17850,
12879,
1027,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# CONTEXTS AND DEPENDENCY INJECTION
## CDI 概念
CDI(Contexts and Dependency Injection),即上下文依赖注入,它是众多JEE规范中的一个.
从Java EE6开始CDI正式成为Java EE规范,依赖注入相对成熟,相关的流行框架包括Spring,Google Guice等。
Java EE7 中 CDI 1.1
* https://jcp.org/en/jsr/detail?id=346
### 什么是上下文
如下图为用户登陆应用示例图

用户发送 login request 到服务器 -> 服务器获取 request 中数据(username/password)做验证 -> 服务器存储数据(username/password)到数据库 -> 服务器返回成功消息
当前应用的特点: 客户端服务器端多次交互
如何保存有状态的数据: Java EE服务器通过提供数据结构(Servlet 规范中的 Application,Session,Request)保存有状态的数据
CDI 规范提供四种数据结构(Application,Session,Conversation,Request),它们在应用中生命周期不同,我们将其称之为上下文,如下图

* Application - 应用程序上下文,即数据在应用程序上下文中可用。换句话,数据在应用程序部署到应用程序卸载或删除这段时间可用。这是最高级别的上下文。
* Session - 会话上下文,即数据存储在会话中,数据只有在会话被某一用户创建到会话被移除这段时间内被这个用户可用。
* Conversation - CDI新增加的上下文,它的作用范围是同一个会话中几个请求的总和
* Request - 请求上下文,数据只有在同一个用户的同一个请求中可用,当请求返回,数据不再被服务器维护
### 依赖注入
Dependency Injection, as specified by CDI, is the process by which objects can be inserted into other application objects in a typesafe manner. The decision of which particular implementation of an object will be injected can be delayed until the time of application deployment. In other frameworks injection is based upon string matching. CDI improves upon this through typed injection where the types are checked at compile time. This exposes injection errors earlier in the development lifecycle and makes debugging easier.
One of the major benefits of dependency injection (DI) is loose coupling of application components. The client and server components are loosely coupled because several different versions of the server can be injected into the client. The client works with an interface and is oblivious to which server it is talking to. Taking advantage of the deploy time injection, we can use specific objects for different types of environments such as production and test environments. For example, we can inject a production or test datasource depending upon our deployment environment.
### 其他CDI的特性
除了上下文和依赖注入外,CDI还提供了一些其他特性:
* EL表达式的扩展:CDI中默认支持EL表达式并对其进行了扩展,比如在JSF或JSP中,默认是不支持EL表达式传参的,如果结合CDI,那么就可以在EL表达式中传参数给后台Bean。
* 拦截器:CDI提供了一个十分方便的方法来实现一个或多个拦截器,用来处理 cross-cutting concerns such as logging
* 装饰器:装饰器可以让你动态的扩展或者重写现有的业务接口。这个功能十分方便,在CDI中,你在调用一个接口的实现类的时候,无须关心这个实现类的名称,所以在你更换新的实现的时候无需去修改你的代码,只需要在新的接口上面通过装饰器声明你要替换的之前的接口实现,然后在 bean.xml 中声明一下即可。
* 事件:CDI 提供了一种松耦合性的事件发送和接受机制。
* 注解:CDI中所有的注入都是通过注解来完成的,XML相关的配置非常少
## CDI 的优点
我们可从如下几个方面讨论CDI 的优点
* Dependency Injection
* Interceptors
* Decorators
* Events
## Weld
Weld是的CDI实现。Weld作为CDI的实现框架被Java EE容器,WEB容器,甚至Java SE使用。JBoss 7,WildFly,GlassFish 3 是Java EE容器,他们使用Weld提供CDI支持。新版本的Tomcat 及 Jetty 6.1 是WEB容器,他们也通过Weld提供CDI支持。Weld甚至可以用在Java SE环境。
http://docs.jboss.org/weld/reference/latest/en-US/html/index.html
## 示例 - I
[cdi-injection 示例](cdi-injection/README.md)
| jbosschina/wildfly-dev-cookbook | cdi/README.md | Markdown | gpl-2.0 | 4,456 | [
30522,
1001,
18046,
1998,
24394,
13341,
1001,
1001,
3729,
2072,
100,
100,
3729,
2072,
1006,
18046,
1998,
24394,
13341,
1007,
1989,
100,
1742,
1743,
1861,
100,
100,
100,
100,
1989,
100,
100,
100,
100,
15333,
2063,
100,
100,
1746,
1916,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
@ECHO OFF
SET RepoRoot=%~dp0..\..\..
%RepoRoot%\eng\build.cmd -projects %~dp0**\*.csproj /p:SkipIISNewHandlerTests=true /p:SkipIISNewShimTests=true %*
| aspnet/AspNetCore | src/Servers/IIS/build.cmd | Batchfile | apache-2.0 | 151 | [
30522,
1030,
9052,
2125,
2275,
16360,
14604,
4140,
1027,
1003,
1066,
1040,
2361,
2692,
1012,
1012,
1032,
1012,
1012,
1032,
1012,
1012,
1003,
16360,
14604,
4140,
1003,
1032,
25540,
1032,
3857,
1012,
4642,
2094,
1011,
3934,
1003,
1066,
1040,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
<style type="text/css">
.highlight { display: block; background-color: #ddd; }
</style>
<script type="text/javascript">
function highlight() {
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
}
</script>
</head>
<body onload="prettyPrint(); highlight();">
<pre class="prettyprint lang-js">/*
This file is part of Ext JS 4
Copyright (c) 2011 Sencha Inc
Contact: http://www.sencha.com/contact
GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
*/
<span id='Ext-container-ButtonGroup'>/**
</span> * Provides a container for arranging a group of related Buttons in a tabular manner.
*
* @example
* Ext.create('Ext.panel.Panel', {
* title: 'Panel with ButtonGroup',
* width: 300,
* height:200,
* renderTo: document.body,
* bodyPadding: 10,
* html: 'HTML Panel Content',
* tbar: [{
* xtype: 'buttongroup',
* columns: 3,
* title: 'Clipboard',
* items: [{
* text: 'Paste',
* scale: 'large',
* rowspan: 3,
* iconCls: 'add',
* iconAlign: 'top',
* cls: 'btn-as-arrow'
* },{
* xtype:'splitbutton',
* text: 'Menu Button',
* scale: 'large',
* rowspan: 3,
* iconCls: 'add',
* iconAlign: 'top',
* arrowAlign:'bottom',
* menu: [{ text: 'Menu Item 1' }]
* },{
* xtype:'splitbutton', text: 'Cut', iconCls: 'add16', menu: [{text: 'Cut Menu Item'}]
* },{
* text: 'Copy', iconCls: 'add16'
* },{
* text: 'Format', iconCls: 'add16'
* }]
* }]
* });
*
*/
Ext.define('Ext.container.ButtonGroup', {
extend: 'Ext.panel.Panel',
alias: 'widget.buttongroup',
alternateClassName: 'Ext.ButtonGroup',
<span id='Ext-container-ButtonGroup-cfg-columns'> /**
</span> * @cfg {Number} columns The `columns` configuration property passed to the
* {@link #layout configured layout manager}. See {@link Ext.layout.container.Table#columns}.
*/
<span id='Ext-container-ButtonGroup-cfg-baseCls'> /**
</span> * @cfg {String} baseCls Defaults to <tt>'x-btn-group'</tt>. See {@link Ext.panel.Panel#baseCls}.
*/
baseCls: Ext.baseCSSPrefix + 'btn-group',
<span id='Ext-container-ButtonGroup-cfg-layout'> /**
</span> * @cfg {Object} layout Defaults to <tt>'table'</tt>. See {@link Ext.container.Container#layout}.
*/
layout: {
type: 'table'
},
defaultType: 'button',
<span id='Ext-container-ButtonGroup-cfg-frame'> /**
</span> * @cfg {Boolean} frame Defaults to <tt>true</tt>. See {@link Ext.panel.Panel#frame}.
*/
frame: true,
frameHeader: false,
internalDefaults: {removeMode: 'container', hideParent: true},
initComponent : function(){
// Copy the component's columns config to the layout if specified
var me = this,
cols = me.columns;
me.noTitleCls = me.baseCls + '-notitle';
if (cols) {
me.layout = Ext.apply({}, {columns: cols}, me.layout);
}
if (!me.title) {
me.addCls(me.noTitleCls);
}
me.callParent(arguments);
},
afterLayout: function() {
var me = this;
me.callParent(arguments);
// Pugly hack for a pugly browser:
// If not an explicitly set width, then size the width to match the inner table
if (me.layout.table && (Ext.isIEQuirks || Ext.isIE6) && !me.width) {
var t = me.getTargetEl();
t.setWidth(me.layout.table.offsetWidth + t.getPadding('lr'));
}
// IE7 needs a forced repaint to make the top framing div expand to full width
if (Ext.isIE7) {
me.el.repaint();
}
},
afterRender: function() {
var me = this;
//we need to add an addition item in here so the ButtonGroup title is centered
if (me.header) {
// Header text cannot flex, but must be natural size if it's being centered
delete me.header.items.items[0].flex;
// For Centering, surround the text with two flex:1 spacers.
me.suspendLayout = true;
me.header.insert(1, {
xtype: 'component',
ui : me.ui,
flex : 1
});
me.header.insert(0, {
xtype: 'component',
ui : me.ui,
flex : 1
});
me.suspendLayout = false;
}
me.callParent(arguments);
},
// private
onBeforeAdd: function(component) {
if (component.is('button')) {
component.ui = component.ui + '-toolbar';
}
this.callParent(arguments);
},
//private
applyDefaults: function(c) {
if (!Ext.isString(c)) {
c = this.callParent(arguments);
var d = this.internalDefaults;
if (c.events) {
Ext.applyIf(c.initialConfig, d);
Ext.apply(c, d);
} else {
Ext.applyIf(c, d);
}
}
return c;
}
<span id='Ext-container-ButtonGroup-cfg-tools'> /**
</span> * @cfg {Array} tools @hide
*/
<span id='Ext-container-ButtonGroup-cfg-collapsible'> /**
</span> * @cfg {Boolean} collapsible @hide
*/
<span id='Ext-container-ButtonGroup-cfg-collapseMode'> /**
</span> * @cfg {Boolean} collapseMode @hide
*/
<span id='Ext-container-ButtonGroup-cfg-animCollapse'> /**
</span> * @cfg {Boolean} animCollapse @hide
*/
<span id='Ext-container-ButtonGroup-cfg-closable'> /**
</span> * @cfg {Boolean} closable @hide
*/
});
</pre>
</body>
</html>
| tonybaloney/Cloud-auto-scaling | doc/js/source/ButtonGroup.html | HTML | lgpl-3.0 | 6,834 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
4180,
1011,
2828,
1000,
4180,
1027,
1000,
3793,
1013,
16129,
1025,
25869,
13462,
1027,
21183,
2546,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @file
* Contains \Drupal\shortcut\ShortcutSetStorageControllerInterface.
*/
namespace Drupal\shortcut;
use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\shortcut\ShortcutSetInterface;
/**
* Defines a common interface for shortcut entity controller classes.
*/
interface ShortcutSetStorageControllerInterface extends EntityStorageControllerInterface {
/**
* Assigns a user to a particular shortcut set.
*
* @param \Drupal\shortcut\ShortcutSetInterface $shortcut_set
* An object representing the shortcut set.
* @param $account
* A user account that will be assigned to use the set.
*/
public function assignUser(ShortcutSetInterface $shortcut_set, $account);
/**
* Unassigns a user from any shortcut set they may have been assigned to.
*
* The user will go back to using whatever default set applies.
*
* @param $account
* A user account that will be removed from the shortcut set assignment.
*
* @return bool
* TRUE if the user was previously assigned to a shortcut set and has been
* successfully removed from it. FALSE if the user was already not assigned
* to any set.
*/
public function unassignUser($account);
/**
* Delete shortcut sets assigned to users.
*
* @param \Drupal\shortcut\ShortcutSetInterface $entity
* Delete the user assigned sets belonging to this shortcut.
*/
public function deleteAssignedShortcutSets(ShortcutSetInterface $entity);
/**
* Get the name of the set assigned to this user.
*
* @param \Drupal\user\Plugin\Core\Entity\User
* The user account.
*
* @return string
* The name of the shortcut set assigned to this user.
*/
public function getAssignedToUser($account);
/**
* Get the number of users who have this set assigned to them.
*
* @param \Drupal\shortcut\ShortcutSetInterface $shortcut_set
* The shortcut to count the users assigned to.
*
* @return int
* The number of users who have this set assigned to them.
*/
public function countAssignedUsers(ShortcutSetInterface $shortcut_set);
}
| augustash/d8.dev | core/modules/shortcut/lib/Drupal/shortcut/ShortcutSetStorageControllerInterface.php | PHP | mit | 2,130 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
5371,
1008,
3397,
1032,
2852,
6279,
2389,
1032,
2460,
12690,
1032,
2460,
12690,
13462,
23809,
4270,
8663,
13181,
10820,
18447,
2121,
12172,
1012,
1008,
1013,
3415,
15327,
2852,
6279,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#
# (c) 2016 Red Hat Inc.
#
# (c) 2017 Dell EMC.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import json
from ansible.module_utils._text import to_text, to_bytes
from ansible.plugins.terminal import TerminalBase
from ansible.errors import AnsibleConnectionFailure
class TerminalModule(TerminalBase):
terminal_stdout_re = [
re.compile(br"[\r\n]?[\w+\-\.:\/\[\]]+(?:\([^\)]+\)){,3}(?:>|#) ?$"),
re.compile(br"\[\w+\@[\w\-\.]+(?: [^\]])\] ?[>#\$] ?$")
]
terminal_stderr_re = [
re.compile(br"% ?Bad secret"),
re.compile(br"(\bInterface is part of a port-channel\b)"),
re.compile(br"(\bThe maximum number of users have already been created\b)|(\bUse '-' for range\b)"),
re.compile(br"(?:incomplete|ambiguous) command", re.I),
re.compile(br"connection timed out", re.I),
re.compile(br"'[^']' +returned error code: ?\d+"),
re.compile(br"Invalid|invalid.*$", re.I),
re.compile(br"((\bout of range\b)|(\bnot found\b)|(\bCould not\b)|(\bUnable to\b)|(\bCannot\b)|(\bError\b)).*", re.I),
re.compile(br"((\balready exists\b)|(\bnot exist\b)|(\bnot active\b)|(\bFailed\b)|(\bIncorrect\b)|(\bnot enabled\b)).*", re.I),
]
terminal_initial_prompt = br"\(y/n\)"
terminal_initial_answer = b"y"
terminal_inital_prompt_newline = False
def on_open_shell(self):
try:
self._exec_cli_command(b'terminal length 0')
except AnsibleConnectionFailure:
raise AnsibleConnectionFailure('unable to set terminal parameters')
def on_become(self, passwd=None):
if self._get_prompt().endswith(b'#'):
return
cmd = {u'command': u'enable'}
if passwd:
cmd[u'prompt'] = to_text(r"[\r\n]?password:$", errors='surrogate_or_strict')
cmd[u'answer'] = passwd
try:
self._exec_cli_command(to_bytes(json.dumps(cmd), errors='surrogate_or_strict'))
except AnsibleConnectionFailure:
raise AnsibleConnectionFailure('unable to elevate privilege to enable mode')
# in dellos6 the terminal settings are accepted after the privilege mode
try:
self._exec_cli_command(b'terminal length 0')
except AnsibleConnectionFailure:
raise AnsibleConnectionFailure('unable to set terminal parameters')
def on_unbecome(self):
prompt = self._get_prompt()
if prompt is None:
# if prompt is None most likely the terminal is hung up at a prompt
return
if prompt.strip().endswith(b')#'):
self._exec_cli_command(b'end')
self._exec_cli_command(b'disable')
elif prompt.endswith(b'#'):
self._exec_cli_command(b'disable')
| roadmapper/ansible | lib/ansible/plugins/terminal/dellos6.py | Python | gpl-3.0 | 3,474 | [
30522,
1001,
1001,
1006,
1039,
1007,
2355,
2417,
6045,
4297,
1012,
1001,
1001,
1006,
1039,
1007,
2418,
12418,
7861,
2278,
1012,
1001,
1001,
2023,
5371,
2003,
30524,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
1001,
2009,
2104,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Function.prototype.bind = Function.prototype.bind || function (target) {
var self = this;
return function (args) {
if (!(args instanceof Array)) {
args = [args];
}
self.apply(target, args);
};
};
| ThatSonnyD/brad-pitt-2048 | tile-sets/brad pitt/js/bind_polyfill.js | JavaScript | mit | 229 | [
30522,
3853,
1012,
8773,
1012,
14187,
1027,
3853,
1012,
8773,
1012,
14187,
1064,
1064,
3853,
1006,
4539,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
2709,
3853,
1006,
12098,
5620,
1007,
1063,
2065,
1006,
999,
1006,
12098,
5620,
6013,
11253,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2017 The Lynx Authors. All rights reserved.
#ifndef LYNX_BASE_THREADING_MESSAGE_PUMP_POSIX_H_
#define LYNX_BASE_THREADING_MESSAGE_PUMP_POSIX_H_
#include "base/task/task.h"
#include "base/threading/condition.h"
#include "base/threading/message_pump.h"
#include "base/timer/timer.h"
namespace base {
class MessagePumpPosix : public MessagePump {
public:
MessagePumpPosix();
virtual ~MessagePumpPosix();
virtual void Run(Delegate* delegate);
virtual void ScheduleWork();
virtual void ScheduleDelayedWork(Closure* closure, int delayed_time);
virtual void ScheduleIntervalWork(Closure* closure, int delayed_time);
virtual void Stop();
private:
Condition condition_;
Timer timer_;
bool keep_running_;
};
} // namespace base
#endif // LYNX_BASE_THREADING_MESSAGE_PUMP_POSIX_H_
| hxxft/lynx-native | Core/base/threading/message_pump_posix.h | C | mit | 844 | [
30522,
1013,
1013,
9385,
2418,
1996,
22636,
6048,
1012,
2035,
2916,
9235,
1012,
1001,
2065,
13629,
2546,
22636,
1035,
2918,
1035,
11689,
2075,
1035,
4471,
1035,
10216,
1035,
13433,
5332,
2595,
1035,
1044,
1035,
1001,
9375,
22636,
1035,
2918... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*****************************************************************************
Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/**************************************************//**
@file dict/dict0load.c
Loads to the memory cache database object definitions
from dictionary tables
Created 4/24/1996 Heikki Tuuri
*******************************************************/
#include "dict0load.h"
#include "mysql_version.h"
#ifdef UNIV_NONINL
#include "dict0load.ic"
#endif
#include "btr0pcur.h"
#include "btr0btr.h"
#include "page0page.h"
#include "mach0data.h"
#include "dict0dict.h"
#include "dict0boot.h"
#include "rem0cmp.h"
#include "srv0start.h"
#include "srv0srv.h"
#include "ha_prototypes.h" /* innobase_casedn_str() */
/** Following are six InnoDB system tables */
static const char* SYSTEM_TABLE_NAME[] = {
"SYS_TABLES",
"SYS_INDEXES",
"SYS_COLUMNS",
"SYS_FIELDS",
"SYS_FOREIGN",
"SYS_FOREIGN_COLS"
};
/****************************************************************//**
Compare the name of an index column.
@return TRUE if the i'th column of index is 'name'. */
static
ibool
name_of_col_is(
/*===========*/
const dict_table_t* table, /*!< in: table */
const dict_index_t* index, /*!< in: index */
ulint i, /*!< in: index field offset */
const char* name) /*!< in: name to compare to */
{
ulint tmp = dict_col_get_no(dict_field_get_col(
dict_index_get_nth_field(
index, i)));
return(strcmp(name, dict_table_get_col_name(table, tmp)) == 0);
}
/********************************************************************//**
Finds the first table name in the given database.
@return own: table name, NULL if does not exist; the caller must free
the memory in the string! */
UNIV_INTERN
char*
dict_get_first_table_name_in_db(
/*============================*/
const char* name) /*!< in: database name which ends in '/' */
{
dict_table_t* sys_tables;
btr_pcur_t pcur;
dict_index_t* sys_index;
dtuple_t* tuple;
mem_heap_t* heap;
dfield_t* dfield;
const rec_t* rec;
const byte* field;
ulint len;
mtr_t mtr;
ut_ad(mutex_own(&(dict_sys->mutex)));
heap = mem_heap_create(1000);
mtr_start(&mtr);
sys_tables = dict_table_get_low("SYS_TABLES");
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
ut_a(!dict_table_is_comp(sys_tables));
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
dfield_set_data(dfield, name, ut_strlen(name));
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
loop:
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur)) {
/* Not found */
btr_pcur_close(&pcur);
mtr_commit(&mtr);
mem_heap_free(heap);
return(NULL);
}
field = rec_get_nth_field_old(rec, 0, &len);
if (len < strlen(name)
|| ut_memcmp(name, field, strlen(name)) != 0) {
/* Not found */
btr_pcur_close(&pcur);
mtr_commit(&mtr);
mem_heap_free(heap);
return(NULL);
}
if (!rec_get_deleted_flag(rec, 0)) {
/* We found one */
char* table_name = mem_strdupl((char*) field, len);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
mem_heap_free(heap);
return(table_name);
}
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
goto loop;
}
/********************************************************************//**
Prints to the standard output information on all tables found in the data
dictionary system table. */
UNIV_INTERN
void
dict_print(void)
/*============*/
{
dict_table_t* table;
btr_pcur_t pcur;
const rec_t* rec;
mem_heap_t* heap;
mtr_t mtr;
/* Enlarge the fatal semaphore wait timeout during the InnoDB table
monitor printout */
mutex_enter(&kernel_mutex);
srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
mutex_exit(&kernel_mutex);
heap = mem_heap_create(1000);
mutex_enter(&(dict_sys->mutex));
mtr_start(&mtr);
rec = dict_startscan_system(&pcur, &mtr, SYS_TABLES);
while (rec) {
const char* err_msg;
err_msg = dict_process_sys_tables_rec(
heap, rec, &table, DICT_TABLE_LOAD_FROM_CACHE
| DICT_TABLE_UPDATE_STATS);
mtr_commit(&mtr);
if (!err_msg) {
dict_table_print_low(table);
} else {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: %s\n", err_msg);
}
mem_heap_empty(heap);
mtr_start(&mtr);
rec = dict_getnext_system(&pcur, &mtr);
}
mtr_commit(&mtr);
mutex_exit(&(dict_sys->mutex));
mem_heap_free(heap);
/* Restore the fatal semaphore wait timeout */
mutex_enter(&kernel_mutex);
srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
mutex_exit(&kernel_mutex);
}
/********************************************************************//**
This function gets the next system table record as it scans the table.
@return the next record if found, NULL if end of scan */
static
const rec_t*
dict_getnext_system_low(
/*====================*/
btr_pcur_t* pcur, /*!< in/out: persistent cursor to the
record*/
mtr_t* mtr) /*!< in: the mini-transaction */
{
rec_t* rec = NULL;
while (!rec || rec_get_deleted_flag(rec, 0)) {
btr_pcur_move_to_next_user_rec(pcur, mtr);
rec = btr_pcur_get_rec(pcur);
if (!btr_pcur_is_on_user_rec(pcur)) {
/* end of index */
btr_pcur_close(pcur);
return(NULL);
}
}
/* Get a record, let's save the position */
btr_pcur_store_position(pcur, mtr);
return(rec);
}
/********************************************************************//**
This function opens a system table, and return the first record.
@return first record of the system table */
UNIV_INTERN
const rec_t*
dict_startscan_system(
/*==================*/
btr_pcur_t* pcur, /*!< out: persistent cursor to
the record */
mtr_t* mtr, /*!< in: the mini-transaction */
dict_system_id_t system_id) /*!< in: which system table to open */
{
dict_table_t* system_table;
dict_index_t* clust_index;
const rec_t* rec;
ut_a(system_id < SYS_NUM_SYSTEM_TABLES);
system_table = dict_table_get_low(SYSTEM_TABLE_NAME[system_id]);
clust_index = UT_LIST_GET_FIRST(system_table->indexes);
btr_pcur_open_at_index_side(TRUE, clust_index, BTR_SEARCH_LEAF, pcur,
TRUE, mtr);
rec = dict_getnext_system_low(pcur, mtr);
return(rec);
}
/********************************************************************//**
This function gets the next system table record as it scans the table.
@return the next record if found, NULL if end of scan */
UNIV_INTERN
const rec_t*
dict_getnext_system(
/*================*/
btr_pcur_t* pcur, /*!< in/out: persistent cursor
to the record */
mtr_t* mtr) /*!< in: the mini-transaction */
{
const rec_t* rec;
/* Restore the position */
btr_pcur_restore_position(BTR_SEARCH_LEAF, pcur, mtr);
/* Get the next record */
rec = dict_getnext_system_low(pcur, mtr);
return(rec);
}
/********************************************************************//**
This function processes one SYS_TABLES record and populate the dict_table_t
struct for the table. Extracted out of dict_print() to be used by
both monitor table output and information schema innodb_sys_tables output.
@return error message, or NULL on success */
UNIV_INTERN
const char*
dict_process_sys_tables_rec(
/*========================*/
mem_heap_t* heap, /*!< in/out: temporary memory heap */
const rec_t* rec, /*!< in: SYS_TABLES record */
dict_table_t** table, /*!< out: dict_table_t to fill */
dict_table_info_t status) /*!< in: status bit controls
options such as whether we shall
look for dict_table_t from cache
first */
{
ulint len;
const char* field;
const char* err_msg = NULL;
char* table_name;
field = (const char*) rec_get_nth_field_old(rec, 0, &len);
ut_a(!rec_get_deleted_flag(rec, 0));
/* Get the table name */
table_name = mem_heap_strdupl(heap, field, len);
/* If DICT_TABLE_LOAD_FROM_CACHE is set, first check
whether there is cached dict_table_t struct first */
if (status & DICT_TABLE_LOAD_FROM_CACHE) {
*table = dict_table_get_low(table_name);
if (!(*table)) {
err_msg = "Table not found in cache";
}
} else {
err_msg = dict_load_table_low(table_name, rec, table);
}
if (err_msg) {
return(err_msg);
}
if ((status & DICT_TABLE_UPDATE_STATS)
&& dict_table_get_first_index(*table)) {
/* Update statistics if DICT_TABLE_UPDATE_STATS
is set */
dict_update_statistics(*table, FALSE /* update even if
initialized */);
}
return(NULL);
}
/********************************************************************//**
This function parses a SYS_INDEXES record and populate a dict_index_t
structure with the information from the record. For detail information
about SYS_INDEXES fields, please refer to dict_boot() function.
@return error message, or NULL on success */
UNIV_INTERN
const char*
dict_process_sys_indexes_rec(
/*=========================*/
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_INDEXES rec */
dict_index_t* index, /*!< out: index to be filled */
table_id_t* table_id) /*!< out: index table id */
{
const char* err_msg;
byte* buf;
buf = mem_heap_alloc(heap, 8);
/* Parse the record, and get "dict_index_t" struct filled */
err_msg = dict_load_index_low(buf, NULL,
heap, rec, FALSE, &index);
*table_id = mach_read_from_8(buf);
return(err_msg);
}
/********************************************************************//**
This function parses a SYS_COLUMNS record and populate a dict_column_t
structure with the information from the record.
@return error message, or NULL on success */
UNIV_INTERN
const char*
dict_process_sys_columns_rec(
/*=========================*/
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_COLUMNS rec */
dict_col_t* column, /*!< out: dict_col_t to be filled */
table_id_t* table_id, /*!< out: table id */
const char** col_name) /*!< out: column name */
{
const char* err_msg;
/* Parse the record, and get "dict_col_t" struct filled */
err_msg = dict_load_column_low(NULL, heap, column,
table_id, col_name, rec);
return(err_msg);
}
/********************************************************************//**
This function parses a SYS_FIELDS record and populates a dict_field_t
structure with the information from the record.
@return error message, or NULL on success */
UNIV_INTERN
const char*
dict_process_sys_fields_rec(
/*========================*/
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_FIELDS rec */
dict_field_t* sys_field, /*!< out: dict_field_t to be
filled */
ulint* pos, /*!< out: Field position */
index_id_t* index_id, /*!< out: current index id */
index_id_t last_id) /*!< in: previous index id */
{
byte* buf;
byte* last_index_id;
const char* err_msg;
buf = mem_heap_alloc(heap, 8);
last_index_id = mem_heap_alloc(heap, 8);
mach_write_to_8(last_index_id, last_id);
err_msg = dict_load_field_low(buf, NULL, sys_field,
pos, last_index_id, heap, rec, NULL, 0);
*index_id = mach_read_from_8(buf);
return(err_msg);
}
#ifdef FOREIGN_NOT_USED
/********************************************************************//**
This function parses a SYS_FOREIGN record and populate a dict_foreign_t
structure with the information from the record. For detail information
about SYS_FOREIGN fields, please refer to dict_load_foreign() function.
@return error message, or NULL on success */
UNIV_INTERN
const char*
dict_process_sys_foreign_rec(
/*=========================*/
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_FOREIGN rec */
dict_foreign_t* foreign) /*!< out: dict_foreign_t struct
to be filled */
{
ulint len;
const byte* field;
ulint n_fields_and_type;
if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
return("delete-marked record in SYS_FOREIGN");
}
if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) != 6)) {
return("wrong number of columns in SYS_FOREIGN record");
}
field = rec_get_nth_field_old(rec, 0/*ID*/, &len);
if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
err_len:
return("incorrect column length in SYS_FOREIGN");
}
/* This recieves a dict_foreign_t* that points to a stack variable.
So mem_heap_free(foreign->heap) is not used as elsewhere.
Since the heap used here is freed elsewhere, foreign->heap
is not assigned. */
foreign->id = mem_heap_strdupl(heap, (const char*) field, len);
rec_get_nth_field_offs_old(rec, 1/*DB_TRX_ID*/, &len);
if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
rec_get_nth_field_offs_old(rec, 2/*DB_ROLL_PTR*/, &len);
if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
/* The _lookup versions of the referenced and foreign table names
are not assigned since they are not used in this dict_foreign_t */
field = rec_get_nth_field_old(rec, 3/*FOR_NAME*/, &len);
if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
goto err_len;
}
foreign->foreign_table_name = mem_heap_strdupl(
heap, (const char*) field, len);
field = rec_get_nth_field_old(rec, 4/*REF_NAME*/, &len);
if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
goto err_len;
}
foreign->referenced_table_name = mem_heap_strdupl(
heap, (const char*) field, len);
field = rec_get_nth_field_old(rec, 5/*N_COLS*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
n_fields_and_type = mach_read_from_4(field);
foreign->type = (unsigned int) (n_fields_and_type >> 24);
foreign->n_fields = (unsigned int) (n_fields_and_type & 0x3FFUL);
return(NULL);
}
#endif /* FOREIGN_NOT_USED */
#ifdef FOREIGN_NOT_USED
/********************************************************************//**
This function parses a SYS_FOREIGN_COLS record and extract necessary
information from the record and return to caller.
@return error message, or NULL on success */
UNIV_INTERN
const char*
dict_process_sys_foreign_col_rec(
/*=============================*/
mem_heap_t* heap, /*!< in/out: heap memory */
const rec_t* rec, /*!< in: current SYS_FOREIGN_COLS rec */
const char** name, /*!< out: foreign key constraint name */
const char** for_col_name, /*!< out: referencing column name */
const char** ref_col_name, /*!< out: referenced column name
in referenced table */
ulint* pos) /*!< out: column position */
{
ulint len;
const byte* field;
if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
return("delete-marked record in SYS_FOREIGN_COLS");
}
if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) != 6)) {
return("wrong number of columns in SYS_FOREIGN_COLS record");
}
field = rec_get_nth_field_old(rec, 0/*ID*/, &len);
if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
err_len:
return("incorrect column length in SYS_FOREIGN_COLS");
}
*name = mem_heap_strdupl(heap, (char*) field, len);
field = rec_get_nth_field_old(rec, 1/*POS*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
*pos = mach_read_from_4(field);
rec_get_nth_field_offs_old(rec, 2/*DB_TRX_ID*/, &len);
if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
rec_get_nth_field_offs_old(rec, 3/*DB_ROLL_PTR*/, &len);
if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
field = rec_get_nth_field_old(rec, 4/*FOR_COL_NAME*/, &len);
if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
goto err_len;
}
*for_col_name = mem_heap_strdupl(heap, (char*) field, len);
field = rec_get_nth_field_old(rec, 5/*REF_COL_NAME*/, &len);
if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
goto err_len;
}
*ref_col_name = mem_heap_strdupl(heap, (char*) field, len);
return(NULL);
}
#endif /* FOREIGN_NOT_USED */
/********************************************************************//**
Determine the flags of a table described in SYS_TABLES.
@return compressed page size in kilobytes; or 0 if the tablespace is
uncompressed, ULINT_UNDEFINED on error */
static
ulint
dict_sys_tables_get_flags(
/*======================*/
const rec_t* rec) /*!< in: a record of SYS_TABLES */
{
const byte* field;
ulint len;
ulint n_cols;
ulint flags;
field = rec_get_nth_field_old(rec, 5, &len);
ut_a(len == 4);
flags = mach_read_from_4(field);
if (UNIV_LIKELY(flags == DICT_TABLE_ORDINARY)) {
return(0);
}
field = rec_get_nth_field_old(rec, 4/*N_COLS*/, &len);
n_cols = mach_read_from_4(field);
if (UNIV_UNLIKELY(!(n_cols & 0x80000000UL))) {
/* New file formats require ROW_FORMAT=COMPACT. */
return(ULINT_UNDEFINED);
}
switch (flags & (DICT_TF_FORMAT_MASK | DICT_TF_COMPACT)) {
default:
case DICT_TF_FORMAT_51 << DICT_TF_FORMAT_SHIFT:
case DICT_TF_FORMAT_51 << DICT_TF_FORMAT_SHIFT | DICT_TF_COMPACT:
/* flags should be DICT_TABLE_ORDINARY,
or DICT_TF_FORMAT_MASK should be nonzero. */
return(ULINT_UNDEFINED);
case DICT_TF_FORMAT_ZIP << DICT_TF_FORMAT_SHIFT | DICT_TF_COMPACT:
#if DICT_TF_FORMAT_MAX > DICT_TF_FORMAT_ZIP
# error "missing case labels for DICT_TF_FORMAT_ZIP .. DICT_TF_FORMAT_MAX"
#endif
/* We support this format. */
break;
}
if (UNIV_UNLIKELY((flags & DICT_TF_ZSSIZE_MASK)
> (DICT_TF_ZSSIZE_MAX << DICT_TF_ZSSIZE_SHIFT))) {
/* Unsupported compressed page size. */
return(ULINT_UNDEFINED);
}
if (UNIV_UNLIKELY(flags & (~0 << DICT_TF_BITS))) {
/* Some unused bits are set. */
return(ULINT_UNDEFINED);
}
return(flags);
}
/********************************************************************//**
In a crash recovery we already have all the tablespace objects created.
This function compares the space id information in the InnoDB data dictionary
to what we already read with fil_load_single_table_tablespaces().
In a normal startup, we create the tablespace objects for every table in
InnoDB's data dictionary, if the corresponding .ibd file exists.
We also scan the biggest space id, and store it to fil_system. */
UNIV_INTERN
void
dict_check_tablespaces_and_store_max_id(
/*====================================*/
ibool in_crash_recovery) /*!< in: are we doing a crash recovery */
{
dict_table_t* sys_tables;
dict_index_t* sys_index;
btr_pcur_t pcur;
const rec_t* rec;
ulint max_space_id;
mtr_t mtr;
mutex_enter(&(dict_sys->mutex));
mtr_start(&mtr);
sys_tables = dict_table_get_low("SYS_TABLES");
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
ut_a(!dict_table_is_comp(sys_tables));
max_space_id = mtr_read_ulint(dict_hdr_get(&mtr)
+ DICT_HDR_MAX_SPACE_ID,
MLOG_4BYTES, &mtr);
fil_set_max_space_id_if_bigger(max_space_id);
btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
TRUE, &mtr);
loop:
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur)) {
/* end of index */
btr_pcur_close(&pcur);
mtr_commit(&mtr);
/* We must make the tablespace cache aware of the biggest
known space id */
/* printf("Biggest space id in data dictionary %lu\n",
max_space_id); */
fil_set_max_space_id_if_bigger(max_space_id);
mutex_exit(&(dict_sys->mutex));
return;
}
if (!rec_get_deleted_flag(rec, 0)) {
/* We found one */
const byte* field;
ulint len;
ulint space_id;
ulint flags;
char* name;
field = rec_get_nth_field_old(rec, 0, &len);
name = mem_strdupl((char*) field, len);
flags = dict_sys_tables_get_flags(rec);
if (UNIV_UNLIKELY(flags == ULINT_UNDEFINED)) {
field = rec_get_nth_field_old(rec, 5, &len);
flags = mach_read_from_4(field);
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: table ", stderr);
ut_print_filename(stderr, name);
fprintf(stderr, "\n"
"InnoDB: in InnoDB data dictionary"
" has unknown type %lx.\n",
(ulong) flags);
goto loop;
}
field = rec_get_nth_field_old(rec, 9, &len);
ut_a(len == 4);
space_id = mach_read_from_4(field);
btr_pcur_store_position(&pcur, &mtr);
mtr_commit(&mtr);
if (space_id == 0) {
/* The system tablespace always exists. */
} else if (in_crash_recovery) {
/* Check that the tablespace (the .ibd file) really
exists; print a warning to the .err log if not.
Do not print warnings for temporary tables. */
ibool is_temp;
field = rec_get_nth_field_old(rec, 4, &len);
if (0x80000000UL & mach_read_from_4(field)) {
/* ROW_FORMAT=COMPACT: read the is_temp
flag from SYS_TABLES.MIX_LEN. */
field = rec_get_nth_field_old(rec, 7, &len);
is_temp = mach_read_from_4(field)
& DICT_TF2_TEMPORARY;
} else {
/* For tables created with old versions
of InnoDB, SYS_TABLES.MIX_LEN may contain
garbage. Such tables would always be
in ROW_FORMAT=REDUNDANT. Pretend that
all such tables are non-temporary. That is,
do not suppress error printouts about
temporary tables not being found. */
is_temp = FALSE;
}
fil_space_for_table_exists_in_mem(
space_id, name, is_temp, TRUE, !is_temp);
} else {
/* It is a normal database startup: create the space
object and check that the .ibd file exists. */
fil_open_single_table_tablespace(FALSE, space_id,
flags, name);
}
mem_free(name);
if (space_id > max_space_id) {
max_space_id = space_id;
}
mtr_start(&mtr);
btr_pcur_restore_position(BTR_SEARCH_LEAF, &pcur, &mtr);
}
goto loop;
}
/********************************************************************//**
Loads a table column definition from a SYS_COLUMNS record to
dict_table_t.
@return error message, or NULL on success */
UNIV_INTERN
const char*
dict_load_column_low(
/*=================*/
dict_table_t* table, /*!< in/out: table, could be NULL
if we just populate a dict_column_t
struct with information from
a SYS_COLUMNS record */
mem_heap_t* heap, /*!< in/out: memory heap
for temporary storage */
dict_col_t* column, /*!< out: dict_column_t to fill,
or NULL if table != NULL */
table_id_t* table_id, /*!< out: table id */
const char** col_name, /*!< out: column name */
const rec_t* rec) /*!< in: SYS_COLUMNS record */
{
char* name;
const byte* field;
ulint len;
ulint mtype;
ulint prtype;
ulint col_len;
ulint pos;
ut_ad(table || column);
if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
return("delete-marked record in SYS_COLUMNS");
}
if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) != 9)) {
return("wrong number of columns in SYS_COLUMNS record");
}
field = rec_get_nth_field_old(rec, 0/*TABLE_ID*/, &len);
if (UNIV_UNLIKELY(len != 8)) {
err_len:
return("incorrect column length in SYS_COLUMNS");
}
if (table_id) {
*table_id = mach_read_from_8(field);
} else if (UNIV_UNLIKELY(table->id != mach_read_from_8(field))) {
return("SYS_COLUMNS.TABLE_ID mismatch");
}
field = rec_get_nth_field_old(rec, 1/*POS*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
pos = mach_read_from_4(field);
if (UNIV_UNLIKELY(table && table->n_def != pos)) {
return("SYS_COLUMNS.POS mismatch");
}
rec_get_nth_field_offs_old(rec, 2/*DB_TRX_ID*/, &len);
if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
rec_get_nth_field_offs_old(rec, 3/*DB_ROLL_PTR*/, &len);
if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
field = rec_get_nth_field_old(rec, 4/*NAME*/, &len);
if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
goto err_len;
}
name = mem_heap_strdupl(heap, (const char*) field, len);
if (col_name) {
*col_name = name;
}
field = rec_get_nth_field_old(rec, 5/*MTYPE*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
mtype = mach_read_from_4(field);
field = rec_get_nth_field_old(rec, 6/*PRTYPE*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
prtype = mach_read_from_4(field);
if (dtype_get_charset_coll(prtype) == 0
&& dtype_is_string_type(mtype)) {
/* The table was created with < 4.1.2. */
if (dtype_is_binary_string_type(mtype, prtype)) {
/* Use the binary collation for
string columns of binary type. */
prtype = dtype_form_prtype(
prtype,
DATA_MYSQL_BINARY_CHARSET_COLL);
} else {
/* Use the default charset for
other than binary columns. */
prtype = dtype_form_prtype(
prtype,
data_mysql_default_charset_coll);
}
}
field = rec_get_nth_field_old(rec, 7/*LEN*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
col_len = mach_read_from_4(field);
field = rec_get_nth_field_old(rec, 8/*PREC*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
if (!column) {
dict_mem_table_add_col(table, heap, name, mtype,
prtype, col_len);
} else {
dict_mem_fill_column_struct(column, pos, mtype,
prtype, col_len);
}
return(NULL);
}
/********************************************************************//**
Loads definitions for table columns. */
static
void
dict_load_columns(
/*==============*/
dict_table_t* table, /*!< in/out: table */
mem_heap_t* heap) /*!< in/out: memory heap
for temporary storage */
{
dict_table_t* sys_columns;
dict_index_t* sys_index;
btr_pcur_t pcur;
dtuple_t* tuple;
dfield_t* dfield;
const rec_t* rec;
byte* buf;
ulint i;
mtr_t mtr;
ut_ad(mutex_own(&(dict_sys->mutex)));
mtr_start(&mtr);
sys_columns = dict_table_get_low("SYS_COLUMNS");
sys_index = UT_LIST_GET_FIRST(sys_columns->indexes);
ut_a(!dict_table_is_comp(sys_columns));
ut_a(name_of_col_is(sys_columns, sys_index, 4, "NAME"));
ut_a(name_of_col_is(sys_columns, sys_index, 8, "PREC"));
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
buf = mem_heap_alloc(heap, 8);
mach_write_to_8(buf, table->id);
dfield_set_data(dfield, buf, 8);
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
for (i = 0; i + DATA_N_SYS_COLS < (ulint) table->n_cols; i++) {
const char* err_msg;
rec = btr_pcur_get_rec(&pcur);
ut_a(btr_pcur_is_on_user_rec(&pcur));
err_msg = dict_load_column_low(table, heap, NULL, NULL,
NULL, rec);
if (err_msg) {
fprintf(stderr, "InnoDB: %s\n", err_msg);
ut_error;
}
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
btr_pcur_close(&pcur);
mtr_commit(&mtr);
}
/** Error message for a delete-marked record in dict_load_field_low() */
static const char* dict_load_field_del = "delete-marked record in SYS_FIELDS";
static const char* dict_load_field_too_big = "column prefix exceeds maximum"
" limit";
/********************************************************************//**
Loads an index field definition from a SYS_FIELDS record to
dict_index_t.
@return error message, or NULL on success */
UNIV_INTERN
const char*
dict_load_field_low(
/*================*/
byte* index_id, /*!< in/out: index id (8 bytes)
an "in" value if index != NULL
and "out" if index == NULL */
dict_index_t* index, /*!< in/out: index, could be NULL
if we just populate a dict_field_t
struct with information from
a SYS_FIELDSS record */
dict_field_t* sys_field, /*!< out: dict_field_t to be
filled */
ulint* pos, /*!< out: Field position */
byte* last_index_id, /*!< in: last index id */
mem_heap_t* heap, /*!< in/out: memory heap
for temporary storage */
const rec_t* rec, /*!< in: SYS_FIELDS record */
char* addition_err_str,/*!< out: additional error message
that requires information to be
filled, or NULL */
ulint err_str_len) /*!< in: length of addition_err_str
in bytes */
{
const byte* field;
ulint len;
ulint pos_and_prefix_len;
ulint prefix_len;
ibool first_field;
ulint position;
/* Either index or sys_field is supplied, not both */
ut_a((!index) || (!sys_field));
if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
return(dict_load_field_del);
}
if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) != 5)) {
return("wrong number of columns in SYS_FIELDS record");
}
field = rec_get_nth_field_old(rec, 0/*INDEX_ID*/, &len);
if (UNIV_UNLIKELY(len != 8)) {
err_len:
return("incorrect column length in SYS_FIELDS");
}
if (!index) {
ut_a(last_index_id);
memcpy(index_id, (const char*)field, 8);
first_field = memcmp(index_id, last_index_id, 8);
} else {
first_field = (index->n_def == 0);
if (memcmp(field, index_id, 8)) {
return("SYS_FIELDS.INDEX_ID mismatch");
}
}
field = rec_get_nth_field_old(rec, 1/*POS*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
rec_get_nth_field_offs_old(rec, 2/*DB_TRX_ID*/, &len);
if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
rec_get_nth_field_offs_old(rec, 3/*DB_ROLL_PTR*/, &len);
if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
/* The next field stores the field position in the index and a
possible column prefix length if the index field does not
contain the whole column. The storage format is like this: if
there is at least one prefix field in the index, then the HIGH
2 bytes contain the field number (index->n_def) and the low 2
bytes the prefix length for the field. Otherwise the field
number (index->n_def) is contained in the 2 LOW bytes. */
pos_and_prefix_len = mach_read_from_4(field);
if (index && UNIV_UNLIKELY
((pos_and_prefix_len & 0xFFFFUL) != index->n_def
&& (pos_and_prefix_len >> 16 & 0xFFFF) != index->n_def)) {
return("SYS_FIELDS.POS mismatch");
}
if (first_field || pos_and_prefix_len > 0xFFFFUL) {
prefix_len = pos_and_prefix_len & 0xFFFFUL;
position = (pos_and_prefix_len & 0xFFFF0000UL) >> 16;
} else {
prefix_len = 0;
position = pos_and_prefix_len & 0xFFFFUL;
}
field = rec_get_nth_field_old(rec, 4, &len);
if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
goto err_len;
}
if (prefix_len > REC_VERSION_56_MAX_INDEX_COL_LEN) {
if (addition_err_str) {
ut_snprintf(addition_err_str, err_str_len,
"index field '%s' has a prefix length"
" of %lu bytes",
mem_heap_strdupl(
heap, (const char*) field, len),
(ulong) prefix_len);
}
return(dict_load_field_too_big);
}
if (index) {
dict_mem_index_add_field(
index, mem_heap_strdupl(heap, (const char*) field, len),
prefix_len);
} else {
ut_a(sys_field);
ut_a(pos);
sys_field->name = mem_heap_strdupl(
heap, (const char*) field, len);
sys_field->prefix_len = prefix_len;
*pos = position;
}
return(NULL);
}
/********************************************************************//**
Loads definitions for index fields.
@return DB_SUCCESS if ok, DB_CORRUPTION if corruption */
static
ulint
dict_load_fields(
/*=============*/
dict_index_t* index, /*!< in/out: index whose fields to load */
mem_heap_t* heap) /*!< in: memory heap for temporary storage */
{
dict_table_t* sys_fields;
dict_index_t* sys_index;
btr_pcur_t pcur;
dtuple_t* tuple;
dfield_t* dfield;
const rec_t* rec;
byte* buf;
ulint i;
mtr_t mtr;
ulint error;
ut_ad(mutex_own(&(dict_sys->mutex)));
mtr_start(&mtr);
sys_fields = dict_table_get_low("SYS_FIELDS");
sys_index = UT_LIST_GET_FIRST(sys_fields->indexes);
ut_a(!dict_table_is_comp(sys_fields));
ut_a(name_of_col_is(sys_fields, sys_index, 4, "COL_NAME"));
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
buf = mem_heap_alloc(heap, 8);
mach_write_to_8(buf, index->id);
dfield_set_data(dfield, buf, 8);
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
for (i = 0; i < index->n_fields; i++) {
const char* err_msg;
char addition_err_str[1024];
rec = btr_pcur_get_rec(&pcur);
ut_a(btr_pcur_is_on_user_rec(&pcur));
err_msg = dict_load_field_low(buf, index, NULL, NULL, NULL,
heap, rec, addition_err_str,
sizeof(addition_err_str));
if (err_msg == dict_load_field_del) {
/* There could be delete marked records in
SYS_FIELDS because SYS_FIELDS.INDEX_ID can be
updated by ALTER TABLE ADD INDEX. */
goto next_rec;
} else if (err_msg) {
if (err_msg == dict_load_field_too_big) {
fprintf(stderr, "InnoDB: Error: load index"
" '%s' failed.\n"
"InnoDB: %s,\n"
"InnoDB: which exceeds the"
" maximum limit of %lu bytes.\n"
"InnoDB: Please use server that"
" supports long index prefix\n"
"InnoDB: or turn on"
" innodb_force_recovery to load"
" the table\n",
index->name, addition_err_str,
(ulong) (REC_VERSION_56_MAX_INDEX_COL_LEN));
} else {
fprintf(stderr, "InnoDB: %s\n", err_msg);
}
error = DB_CORRUPTION;
goto func_exit;
}
next_rec:
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
error = DB_SUCCESS;
func_exit:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
return(error);
}
/** Error message for a delete-marked record in dict_load_index_low() */
static const char* dict_load_index_del = "delete-marked record in SYS_INDEXES";
/** Error message for table->id mismatch in dict_load_index_low() */
static const char* dict_load_index_id_err = "SYS_INDEXES.TABLE_ID mismatch";
/********************************************************************//**
Loads an index definition from a SYS_INDEXES record to dict_index_t.
If allocate=TRUE, we will create a dict_index_t structure and fill it
accordingly. If allocated=FALSE, the dict_index_t will be supplied by
the caller and filled with information read from the record. @return
error message, or NULL on success */
UNIV_INTERN
const char*
dict_load_index_low(
/*================*/
byte* table_id, /*!< in/out: table id (8 bytes),
an "in" value if allocate=TRUE
and "out" when allocate=FALSE */
const char* table_name, /*!< in: table name */
mem_heap_t* heap, /*!< in/out: temporary memory heap */
const rec_t* rec, /*!< in: SYS_INDEXES record */
ibool allocate, /*!< in: TRUE=allocate *index,
FALSE=fill in a pre-allocated
*index */
dict_index_t** index) /*!< out,own: index, or NULL */
{
const byte* field;
ulint len;
ulint name_len;
char* name_buf;
index_id_t id;
ulint n_fields;
ulint type;
ulint space;
if (allocate) {
/* If allocate=TRUE, no dict_index_t will
be supplied. Initialize "*index" to NULL */
*index = NULL;
}
if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
return(dict_load_index_del);
}
if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) != 9)) {
return("wrong number of columns in SYS_INDEXES record");
}
field = rec_get_nth_field_old(rec, 0/*TABLE_ID*/, &len);
if (UNIV_UNLIKELY(len != 8)) {
err_len:
return("incorrect column length in SYS_INDEXES");
}
if (!allocate) {
/* We are reading a SYS_INDEXES record. Copy the table_id */
memcpy(table_id, (const char*)field, 8);
} else if (memcmp(field, table_id, 8)) {
/* Caller supplied table_id, verify it is the same
id as on the index record */
return(dict_load_index_id_err);
}
field = rec_get_nth_field_old(rec, 1/*ID*/, &len);
if (UNIV_UNLIKELY(len != 8)) {
goto err_len;
}
id = mach_read_from_8(field);
rec_get_nth_field_offs_old(rec, 2/*DB_TRX_ID*/, &len);
if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
rec_get_nth_field_offs_old(rec, 3/*DB_ROLL_PTR*/, &len);
if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
field = rec_get_nth_field_old(rec, 4/*NAME*/, &name_len);
if (UNIV_UNLIKELY(name_len == UNIV_SQL_NULL)) {
goto err_len;
}
name_buf = mem_heap_strdupl(heap, (const char*) field,
name_len);
field = rec_get_nth_field_old(rec, 5/*N_FIELDS*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
n_fields = mach_read_from_4(field);
field = rec_get_nth_field_old(rec, 6/*TYPE*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
type = mach_read_from_4(field);
field = rec_get_nth_field_old(rec, 7/*SPACE*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
space = mach_read_from_4(field);
field = rec_get_nth_field_old(rec, 8/*PAGE_NO*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
if (allocate) {
*index = dict_mem_index_create(table_name, name_buf,
space, type, n_fields);
} else {
ut_a(*index);
dict_mem_fill_index_struct(*index, NULL, NULL, name_buf,
space, type, n_fields);
}
(*index)->id = id;
(*index)->page = mach_read_from_4(field);
ut_ad((*index)->page);
return(NULL);
}
/********************************************************************//**
Loads definitions for table indexes. Adds them to the data dictionary
cache.
@return DB_SUCCESS if ok, DB_CORRUPTION if corruption of dictionary
table or DB_UNSUPPORTED if table has unknown index type */
static
ulint
dict_load_indexes(
/*==============*/
dict_table_t* table, /*!< in/out: table */
mem_heap_t* heap, /*!< in: memory heap for temporary storage */
dict_err_ignore_t ignore_err)
/*!< in: error to be ignored when
loading the index definition */
{
dict_table_t* sys_indexes;
dict_index_t* sys_index;
btr_pcur_t pcur;
dtuple_t* tuple;
dfield_t* dfield;
const rec_t* rec;
byte* buf;
mtr_t mtr;
ulint error = DB_SUCCESS;
ut_ad(mutex_own(&(dict_sys->mutex)));
mtr_start(&mtr);
sys_indexes = dict_table_get_low("SYS_INDEXES");
sys_index = UT_LIST_GET_FIRST(sys_indexes->indexes);
ut_a(!dict_table_is_comp(sys_indexes));
ut_a(name_of_col_is(sys_indexes, sys_index, 4, "NAME"));
ut_a(name_of_col_is(sys_indexes, sys_index, 8, "PAGE_NO"));
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
buf = mem_heap_alloc(heap, 8);
mach_write_to_8(buf, table->id);
dfield_set_data(dfield, buf, 8);
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
for (;;) {
dict_index_t* index = NULL;
const char* err_msg;
if (!btr_pcur_is_on_user_rec(&pcur)) {
break;
}
rec = btr_pcur_get_rec(&pcur);
err_msg = dict_load_index_low(buf, table->name, heap, rec,
TRUE, &index);
ut_ad((index == NULL) == (err_msg != NULL));
if (err_msg == dict_load_index_id_err) {
/* TABLE_ID mismatch means that we have
run out of index definitions for the table. */
break;
} else if (err_msg == dict_load_index_del) {
/* Skip delete-marked records. */
goto next_rec;
} else if (err_msg) {
fprintf(stderr, "InnoDB: %s\n", err_msg);
error = DB_CORRUPTION;
goto func_exit;
}
ut_ad(index);
/* We check for unsupported types first, so that the
subsequent checks are relevant for the supported types. */
if (index->type & ~(DICT_CLUSTERED | DICT_UNIQUE)) {
fprintf(stderr,
"InnoDB: Error: unknown type %lu"
" of index %s of table %s\n",
(ulong) index->type, index->name, table->name);
error = DB_UNSUPPORTED;
dict_mem_index_free(index);
goto func_exit;
} else if (index->page == FIL_NULL) {
fprintf(stderr,
"InnoDB: Error: trying to load index %s"
" for table %s\n"
"InnoDB: but the index tree has been freed!\n",
index->name, table->name);
if (ignore_err & DICT_ERR_IGNORE_INDEX_ROOT) {
/* If caller can tolerate this error,
we will continue to load the index and
let caller deal with this error. However
mark the index and table corrupted */
index->corrupted = TRUE;
table->corrupted = TRUE;
fprintf(stderr,
"InnoDB: Index is corrupt but forcing"
" load into data dictionary\n");
} else {
corrupted:
dict_mem_index_free(index);
error = DB_CORRUPTION;
goto func_exit;
}
} else if (!dict_index_is_clust(index)
&& NULL == dict_table_get_first_index(table)) {
fputs("InnoDB: Error: trying to load index ",
stderr);
ut_print_name(stderr, NULL, FALSE, index->name);
fputs(" for table ", stderr);
ut_print_name(stderr, NULL, TRUE, table->name);
fputs("\nInnoDB: but the first index"
" is not clustered!\n", stderr);
goto corrupted;
} else if (table->id < DICT_HDR_FIRST_ID
&& (dict_index_is_clust(index)
|| ((table == dict_sys->sys_tables)
&& !strcmp("ID_IND", index->name)))) {
/* The index was created in memory already at booting
of the database server */
dict_mem_index_free(index);
} else {
error = dict_load_fields(index, heap);
if (error != DB_SUCCESS) {
fprintf(stderr, "InnoDB: Error: load index '%s'"
" for table '%s' failed\n",
index->name, table->name);
/* If the force recovery flag is set, and
if the failed index is not the primary index, we
will continue and open other indexes */
if (srv_force_recovery
&& !dict_index_is_clust(index)) {
error = DB_SUCCESS;
goto next_rec;
} else {
goto func_exit;
}
}
error = dict_index_add_to_cache(table, index,
index->page, FALSE);
/* The data dictionary tables should never contain
invalid index definitions. If we ignored this error
and simply did not load this index definition, the
.frm file would disagree with the index definitions
inside InnoDB. */
if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
goto func_exit;
}
}
next_rec:
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
func_exit:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
return(error);
}
/********************************************************************//**
Loads a table definition from a SYS_TABLES record to dict_table_t.
Does not load any columns or indexes.
@return error message, or NULL on success */
UNIV_INTERN
const char*
dict_load_table_low(
/*================*/
const char* name, /*!< in: table name */
const rec_t* rec, /*!< in: SYS_TABLES record */
dict_table_t** table) /*!< out,own: table, or NULL */
{
const byte* field;
ulint len;
ulint space;
ulint n_cols;
ulint flags;
if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
return("delete-marked record in SYS_TABLES");
}
if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) != 10)) {
return("wrong number of columns in SYS_TABLES record");
}
rec_get_nth_field_offs_old(rec, 0/*NAME*/, &len);
if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) {
err_len:
return("incorrect column length in SYS_TABLES");
}
rec_get_nth_field_offs_old(rec, 1/*DB_TRX_ID*/, &len);
if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
rec_get_nth_field_offs_old(rec, 2/*DB_ROLL_PTR*/, &len);
if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
rec_get_nth_field_offs_old(rec, 3/*ID*/, &len);
if (UNIV_UNLIKELY(len != 8)) {
goto err_len;
}
field = rec_get_nth_field_old(rec, 4/*N_COLS*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
n_cols = mach_read_from_4(field);
rec_get_nth_field_offs_old(rec, 5/*TYPE*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
rec_get_nth_field_offs_old(rec, 6/*MIX_ID*/, &len);
if (UNIV_UNLIKELY(len != 8)) {
goto err_len;
}
rec_get_nth_field_offs_old(rec, 7/*MIX_LEN*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
rec_get_nth_field_offs_old(rec, 8/*CLUSTER_ID*/, &len);
if (UNIV_UNLIKELY(len != UNIV_SQL_NULL)) {
goto err_len;
}
field = rec_get_nth_field_old(rec, 9/*SPACE*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
space = mach_read_from_4(field);
/* Check if the tablespace exists and has the right name */
if (space != 0) {
flags = dict_sys_tables_get_flags(rec);
if (UNIV_UNLIKELY(flags == ULINT_UNDEFINED)) {
field = rec_get_nth_field_old(rec, 5/*TYPE*/, &len);
ut_ad(len == 4); /* this was checked earlier */
flags = mach_read_from_4(field);
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: table ", stderr);
ut_print_filename(stderr, name);
fprintf(stderr, "\n"
"InnoDB: in InnoDB data dictionary"
" has unknown type %lx.\n",
(ulong) flags);
return("incorrect flags in SYS_TABLES");
}
} else {
flags = 0;
}
/* The high-order bit of N_COLS is the "compact format" flag.
For tables in that format, MIX_LEN may hold additional flags. */
if (n_cols & 0x80000000UL) {
ulint flags2;
flags |= DICT_TF_COMPACT;
field = rec_get_nth_field_old(rec, 7, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
flags2 = mach_read_from_4(field);
if (flags2 & (~0 << (DICT_TF2_BITS - DICT_TF2_SHIFT))) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Warning: table ", stderr);
ut_print_filename(stderr, name);
fprintf(stderr, "\n"
"InnoDB: in InnoDB data dictionary"
" has unknown flags %lx.\n",
(ulong) flags2);
flags2 &= ~(~0 << (DICT_TF2_BITS - DICT_TF2_SHIFT));
}
flags |= flags2 << DICT_TF2_SHIFT;
}
/* See if the tablespace is available. */
*table = dict_mem_table_create(name, space, n_cols & ~0x80000000UL,
flags);
field = rec_get_nth_field_old(rec, 3/*ID*/, &len);
ut_ad(len == 8); /* this was checked earlier */
(*table)->id = mach_read_from_8(field);
(*table)->ibd_file_missing = FALSE;
return(NULL);
}
/********************************************************************//**
Loads a table definition and also all its index definitions, and also
the cluster definition if the table is a member in a cluster. Also loads
all foreign key constraints where the foreign key is in the table or where
a foreign key references columns in this table. Adds all these to the data
dictionary cache.
@return table, NULL if does not exist; if the table is stored in an
.ibd file, but the file does not exist, then we set the
ibd_file_missing flag TRUE in the table object we return */
UNIV_INTERN
dict_table_t*
dict_load_table(
/*============*/
const char* name, /*!< in: table name in the
databasename/tablename format */
ibool cached, /*!< in: TRUE=add to cache, FALSE=do not */
dict_err_ignore_t ignore_err)
/*!< in: error to be ignored when loading
table and its indexes' definition */
{
dict_table_t* table;
dict_table_t* sys_tables;
btr_pcur_t pcur;
dict_index_t* sys_index;
dtuple_t* tuple;
mem_heap_t* heap;
dfield_t* dfield;
const rec_t* rec;
const byte* field;
ulint len;
ulint err;
const char* err_msg;
mtr_t mtr;
ut_ad(mutex_own(&(dict_sys->mutex)));
heap = mem_heap_create(32000);
mtr_start(&mtr);
sys_tables = dict_table_get_low("SYS_TABLES");
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
ut_a(!dict_table_is_comp(sys_tables));
ut_a(name_of_col_is(sys_tables, sys_index, 3, "ID"));
ut_a(name_of_col_is(sys_tables, sys_index, 4, "N_COLS"));
ut_a(name_of_col_is(sys_tables, sys_index, 5, "TYPE"));
ut_a(name_of_col_is(sys_tables, sys_index, 7, "MIX_LEN"));
ut_a(name_of_col_is(sys_tables, sys_index, 9, "SPACE"));
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
dfield_set_data(dfield, name, ut_strlen(name));
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur)
|| rec_get_deleted_flag(rec, 0)) {
/* Not found */
err_exit:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
mem_heap_free(heap);
return(NULL);
}
field = rec_get_nth_field_old(rec, 0, &len);
/* Check if the table name in record is the searched one */
if (len != ut_strlen(name) || ut_memcmp(name, field, len) != 0) {
goto err_exit;
}
err_msg = dict_load_table_low(name, rec, &table);
if (err_msg) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: %s\n", err_msg);
goto err_exit;
}
if (table->space == 0) {
/* The system tablespace is always available. */
} else if (!fil_space_for_table_exists_in_mem(
table->space, name,
(table->flags >> DICT_TF2_SHIFT)
& DICT_TF2_TEMPORARY,
FALSE, FALSE)) {
if (table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT)) {
/* Do not bother to retry opening temporary tables. */
table->ibd_file_missing = TRUE;
} else {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: error: space object of table ");
ut_print_filename(stderr, name);
fprintf(stderr, ",\n"
"InnoDB: space id %lu did not exist in memory."
" Retrying an open.\n",
(ulong) table->space);
/* Try to open the tablespace */
if (!fil_open_single_table_tablespace(
TRUE, table->space,
table->flags == DICT_TF_COMPACT ? 0 :
table->flags & ~(~0 << DICT_TF_BITS), name)) {
/* We failed to find a sensible
tablespace file */
table->ibd_file_missing = TRUE;
}
}
}
btr_pcur_close(&pcur);
mtr_commit(&mtr);
dict_load_columns(table, heap);
if (cached) {
dict_table_add_to_cache(table, heap);
} else {
dict_table_add_system_columns(table, heap);
}
mem_heap_empty(heap);
err = dict_load_indexes(table, heap, ignore_err);
/* Initialize table foreign_child value. Its value could be
changed when dict_load_foreigns() is called below */
table->fk_max_recusive_level = 0;
/* If the force recovery flag is set, we open the table irrespective
of the error condition, since the user may want to dump data from the
clustered index. However we load the foreign key information only if
all indexes were loaded. */
if (!cached) {
} else if (err == DB_SUCCESS) {
err = dict_load_foreigns(table->name, TRUE, TRUE);
if (err != DB_SUCCESS) {
dict_table_remove_from_cache(table);
table = NULL;
} else {
table->fk_max_recusive_level = 0;
}
} else {
dict_index_t* index;
/* Make sure that at least the clustered index was loaded.
Otherwise refuse to load the table */
index = dict_table_get_first_index(table);
if (!srv_force_recovery || !index
|| !dict_index_is_clust(index)) {
dict_table_remove_from_cache(table);
table = NULL;
}
}
#if 0
if (err != DB_SUCCESS && table != NULL) {
mutex_enter(&dict_foreign_err_mutex);
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: could not make a foreign key"
" definition to match\n"
"InnoDB: the foreign key table"
" or the referenced table!\n"
"InnoDB: The data dictionary of InnoDB is corrupt."
" You may need to drop\n"
"InnoDB: and recreate the foreign key table"
" or the referenced table.\n"
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n"
"InnoDB: Latest foreign key error printout:\n%s\n",
dict_foreign_err_buf);
mutex_exit(&dict_foreign_err_mutex);
}
#endif /* 0 */
mem_heap_free(heap);
return(table);
}
/***********************************************************************//**
Loads a table object based on the table id.
@return table; NULL if table does not exist */
UNIV_INTERN
dict_table_t*
dict_load_table_on_id(
/*==================*/
table_id_t table_id) /*!< in: table id */
{
byte id_buf[8];
btr_pcur_t pcur;
mem_heap_t* heap;
dtuple_t* tuple;
dfield_t* dfield;
dict_index_t* sys_table_ids;
dict_table_t* sys_tables;
const rec_t* rec;
const byte* field;
ulint len;
dict_table_t* table;
mtr_t mtr;
ut_ad(mutex_own(&(dict_sys->mutex)));
table = NULL;
/* NOTE that the operation of this function is protected by
the dictionary mutex, and therefore no deadlocks can occur
with other dictionary operations. */
mtr_start(&mtr);
/*---------------------------------------------------*/
/* Get the secondary index based on ID for table SYS_TABLES */
sys_tables = dict_sys->sys_tables;
sys_table_ids = dict_table_get_next_index(
dict_table_get_first_index(sys_tables));
ut_a(!dict_table_is_comp(sys_tables));
heap = mem_heap_create(256);
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
/* Write the table id in byte format to id_buf */
mach_write_to_8(id_buf, table_id);
dfield_set_data(dfield, id_buf, 8);
dict_index_copy_types(tuple, sys_table_ids, 1);
btr_pcur_open_on_user_rec(sys_table_ids, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur)) {
/* Not found */
goto func_exit;
}
/* Find the first record that is not delete marked */
while (rec_get_deleted_flag(rec, 0)) {
if (!btr_pcur_move_to_next_user_rec(&pcur, &mtr)) {
goto func_exit;
}
rec = btr_pcur_get_rec(&pcur);
}
/*---------------------------------------------------*/
/* Now we have the record in the secondary index containing the
table ID and NAME */
rec = btr_pcur_get_rec(&pcur);
field = rec_get_nth_field_old(rec, 0, &len);
ut_ad(len == 8);
/* Check if the table id in record is the one searched for */
if (table_id != mach_read_from_8(field)) {
goto func_exit;
}
/* Now we get the table name from the record */
field = rec_get_nth_field_old(rec, 1, &len);
/* Load the table definition to memory */
table = dict_load_table(mem_heap_strdupl(heap, (char*) field, len),
TRUE, DICT_ERR_IGNORE_NONE);
func_exit:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
mem_heap_free(heap);
return(table);
}
/********************************************************************//**
This function is called when the database is booted. Loads system table
index definitions except for the clustered index which is added to the
dictionary cache at booting before calling this function. */
UNIV_INTERN
void
dict_load_sys_table(
/*================*/
dict_table_t* table) /*!< in: system table */
{
mem_heap_t* heap;
ut_ad(mutex_own(&(dict_sys->mutex)));
heap = mem_heap_create(1000);
dict_load_indexes(table, heap, DICT_ERR_IGNORE_NONE);
mem_heap_free(heap);
}
/********************************************************************//**
Loads foreign key constraint col names (also for the referenced table). */
static
void
dict_load_foreign_cols(
/*===================*/
const char* id, /*!< in: foreign constraint id as a
null-terminated string */
dict_foreign_t* foreign)/*!< in: foreign constraint object */
{
dict_table_t* sys_foreign_cols;
dict_index_t* sys_index;
btr_pcur_t pcur;
dtuple_t* tuple;
dfield_t* dfield;
const rec_t* rec;
const byte* field;
ulint len;
ulint i;
mtr_t mtr;
ut_ad(mutex_own(&(dict_sys->mutex)));
foreign->foreign_col_names = mem_heap_alloc(
foreign->heap, foreign->n_fields * sizeof(void*));
foreign->referenced_col_names = mem_heap_alloc(
foreign->heap, foreign->n_fields * sizeof(void*));
mtr_start(&mtr);
sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS");
sys_index = UT_LIST_GET_FIRST(sys_foreign_cols->indexes);
ut_a(!dict_table_is_comp(sys_foreign_cols));
tuple = dtuple_create(foreign->heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
dfield_set_data(dfield, id, ut_strlen(id));
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
for (i = 0; i < foreign->n_fields; i++) {
rec = btr_pcur_get_rec(&pcur);
ut_a(btr_pcur_is_on_user_rec(&pcur));
ut_a(!rec_get_deleted_flag(rec, 0));
field = rec_get_nth_field_old(rec, 0, &len);
ut_a(len == ut_strlen(id));
ut_a(ut_memcmp(id, field, len) == 0);
field = rec_get_nth_field_old(rec, 1, &len);
ut_a(len == 4);
ut_a(i == mach_read_from_4(field));
field = rec_get_nth_field_old(rec, 4, &len);
foreign->foreign_col_names[i] = mem_heap_strdupl(
foreign->heap, (char*) field, len);
field = rec_get_nth_field_old(rec, 5, &len);
foreign->referenced_col_names[i] = mem_heap_strdupl(
foreign->heap, (char*) field, len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
btr_pcur_close(&pcur);
mtr_commit(&mtr);
}
/***********************************************************************//**
Loads a foreign key constraint to the dictionary cache.
@return DB_SUCCESS or error code */
static
ulint
dict_load_foreign(
/*==============*/
const char* id, /*!< in: foreign constraint id as a
null-terminated string */
ibool check_charsets,
/*!< in: TRUE=check charset compatibility */
ibool check_recursive)
/*!< in: Whether to record the foreign table
parent count to avoid unlimited recursive
load of chained foreign tables */
{
dict_foreign_t* foreign;
dict_table_t* sys_foreign;
btr_pcur_t pcur;
dict_index_t* sys_index;
dtuple_t* tuple;
mem_heap_t* heap2;
dfield_t* dfield;
const rec_t* rec;
const byte* field;
ulint len;
ulint n_fields_and_type;
mtr_t mtr;
dict_table_t* for_table;
dict_table_t* ref_table;
ut_ad(mutex_own(&(dict_sys->mutex)));
heap2 = mem_heap_create(1000);
mtr_start(&mtr);
sys_foreign = dict_table_get_low("SYS_FOREIGN");
sys_index = UT_LIST_GET_FIRST(sys_foreign->indexes);
ut_a(!dict_table_is_comp(sys_foreign));
tuple = dtuple_create(heap2, 1);
dfield = dtuple_get_nth_field(tuple, 0);
dfield_set_data(dfield, id, ut_strlen(id));
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur)
|| rec_get_deleted_flag(rec, 0)) {
/* Not found */
fprintf(stderr,
"InnoDB: Error A: cannot load foreign constraint %s\n",
id);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
mem_heap_free(heap2);
return(DB_ERROR);
}
field = rec_get_nth_field_old(rec, 0, &len);
/* Check if the id in record is the searched one */
if (len != ut_strlen(id) || ut_memcmp(id, field, len) != 0) {
fprintf(stderr,
"InnoDB: Error B: cannot load foreign constraint %s\n",
id);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
mem_heap_free(heap2);
return(DB_ERROR);
}
/* Read the table names and the number of columns associated
with the constraint */
mem_heap_free(heap2);
foreign = dict_mem_foreign_create();
n_fields_and_type = mach_read_from_4(
rec_get_nth_field_old(rec, 5, &len));
ut_a(len == 4);
/* We store the type in the bits 24..29 of n_fields_and_type. */
foreign->type = (unsigned int) (n_fields_and_type >> 24);
foreign->n_fields = (unsigned int) (n_fields_and_type & 0x3FFUL);
foreign->id = mem_heap_strdup(foreign->heap, id);
field = rec_get_nth_field_old(rec, 3, &len);
foreign->foreign_table_name = mem_heap_strdupl(
foreign->heap, (char*) field, len);
dict_mem_foreign_table_name_lookup_set(foreign, TRUE);
field = rec_get_nth_field_old(rec, 4, &len);
foreign->referenced_table_name = mem_heap_strdupl(
foreign->heap, (char*) field, len);
dict_mem_referenced_table_name_lookup_set(foreign, TRUE);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
dict_load_foreign_cols(id, foreign);
ref_table = dict_table_check_if_in_cache_low(
foreign->referenced_table_name_lookup);
/* We could possibly wind up in a deep recursive calls if
we call dict_table_get_low() again here if there
is a chain of tables concatenated together with
foreign constraints. In such case, each table is
both a parent and child of the other tables, and
act as a "link" in such table chains.
To avoid such scenario, we would need to check the
number of ancesters the current table has. If that
exceeds DICT_FK_MAX_CHAIN_LEN, we will stop loading
the child table.
Foreign constraints are loaded in a Breath First fashion,
that is, the index on FOR_NAME is scanned first, and then
index on REF_NAME. So foreign constrains in which
current table is a child (foreign table) are loaded first,
and then those constraints where current table is a
parent (referenced) table.
Thus we could check the parent (ref_table) table's
reference count (fk_max_recusive_level) to know how deep the
recursive call is. If the parent table (ref_table) is already
loaded, and its fk_max_recusive_level is larger than
DICT_FK_MAX_CHAIN_LEN, we will stop the recursive loading
by skipping loading the child table. It will not affect foreign
constraint check for DMLs since child table will be loaded
at that time for the constraint check. */
if (!ref_table
|| ref_table->fk_max_recusive_level < DICT_FK_MAX_RECURSIVE_LOAD) {
/* If the foreign table is not yet in the dictionary cache, we
have to load it so that we are able to make type comparisons
in the next function call. */
for_table = dict_table_get_low(foreign->foreign_table_name_lookup);
if (for_table && ref_table && check_recursive) {
/* This is to record the longest chain of ancesters
this table has, if the parent has more ancesters
than this table has, record it after add 1 (for this
parent */
if (ref_table->fk_max_recusive_level
>= for_table->fk_max_recusive_level) {
for_table->fk_max_recusive_level =
ref_table->fk_max_recusive_level + 1;
}
}
}
/* Note that there may already be a foreign constraint object in
the dictionary cache for this constraint: then the following
call only sets the pointers in it to point to the appropriate table
and index objects and frees the newly created object foreign.
Adding to the cache should always succeed since we are not creating
a new foreign key constraint but loading one from the data
dictionary. */
return(dict_foreign_add_to_cache(foreign, check_charsets));
}
/***********************************************************************//**
Loads foreign key constraints where the table is either the foreign key
holder or where the table is referenced by a foreign key. Adds these
constraints to the data dictionary. Note that we know that the dictionary
cache already contains all constraints where the other relevant table is
already in the dictionary cache.
@return DB_SUCCESS or error code */
UNIV_INTERN
ulint
dict_load_foreigns(
/*===============*/
const char* table_name, /*!< in: table name */
ibool check_recursive,/*!< in: Whether to check recursive
load of tables chained by FK */
ibool check_charsets) /*!< in: TRUE=check charset
compatibility */
{
btr_pcur_t pcur;
mem_heap_t* heap;
dtuple_t* tuple;
dfield_t* dfield;
dict_index_t* sec_index;
dict_table_t* sys_foreign;
const rec_t* rec;
const byte* field;
ulint len;
char* id ;
ulint err;
mtr_t mtr;
ut_ad(mutex_own(&(dict_sys->mutex)));
sys_foreign = dict_table_get_low("SYS_FOREIGN");
if (sys_foreign == NULL) {
/* No foreign keys defined yet in this database */
fprintf(stderr,
"InnoDB: Error: no foreign key system tables"
" in the database\n");
return(DB_ERROR);
}
ut_a(!dict_table_is_comp(sys_foreign));
mtr_start(&mtr);
/* Get the secondary index based on FOR_NAME from table
SYS_FOREIGN */
sec_index = dict_table_get_next_index(
dict_table_get_first_index(sys_foreign));
start_load:
heap = mem_heap_create(256);
tuple = dtuple_create(heap, 1);
dfield = dtuple_get_nth_field(tuple, 0);
dfield_set_data(dfield, table_name, ut_strlen(table_name));
dict_index_copy_types(tuple, sec_index, 1);
btr_pcur_open_on_user_rec(sec_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
loop:
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur)) {
/* End of index */
goto load_next_index;
}
/* Now we have the record in the secondary index containing a table
name and a foreign constraint ID */
rec = btr_pcur_get_rec(&pcur);
field = rec_get_nth_field_old(rec, 0, &len);
/* Check if the table name in the record is the one searched for; the
following call does the comparison in the latin1_swedish_ci
charset-collation, in a case-insensitive way. */
if (0 != cmp_data_data(dfield_get_type(dfield)->mtype,
dfield_get_type(dfield)->prtype,
dfield_get_data(dfield), dfield_get_len(dfield),
field, len)) {
goto load_next_index;
}
/* Since table names in SYS_FOREIGN are stored in a case-insensitive
order, we have to check that the table name matches also in a binary
string comparison. On Unix, MySQL allows table names that only differ
in character case. If lower_case_table_names=2 then what is stored
may not be the same case, but the previous comparison showed that they
match with no-case. */
if ((innobase_get_lower_case_table_names() != 2)
&& (0 != ut_memcmp(field, table_name, len))) {
goto next_rec;
}
if (rec_get_deleted_flag(rec, 0)) {
goto next_rec;
}
/* Now we get a foreign key constraint id */
field = rec_get_nth_field_old(rec, 1, &len);
id = mem_heap_strdupl(heap, (char*) field, len);
btr_pcur_store_position(&pcur, &mtr);
mtr_commit(&mtr);
/* Load the foreign constraint definition to the dictionary cache */
err = dict_load_foreign(id, check_charsets, check_recursive);
if (err != DB_SUCCESS) {
btr_pcur_close(&pcur);
mem_heap_free(heap);
return(err);
}
mtr_start(&mtr);
btr_pcur_restore_position(BTR_SEARCH_LEAF, &pcur, &mtr);
next_rec:
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
goto loop;
load_next_index:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
mem_heap_free(heap);
sec_index = dict_table_get_next_index(sec_index);
if (sec_index != NULL) {
mtr_start(&mtr);
/* Switch to scan index on REF_NAME, fk_max_recusive_level
already been updated when scanning FOR_NAME index, no need to
update again */
check_recursive = FALSE;
goto start_load;
}
return(DB_SUCCESS);
}
| cryptdb-org/mysql-5-5-14 | storage/innobase/dict/dict0load.c | C | gpl-2.0 | 65,630 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.elliottsj.ftw.sync;
import android.accounts.AbstractAccountAuthenticator;
import android.accounts.Account;
import android.accounts.AccountAuthenticatorResponse;
import android.accounts.NetworkErrorException;
import android.content.Context;
import android.os.Bundle;
public class Authenticator extends AbstractAccountAuthenticator {
public Authenticator(Context context) {
super(context);
}
@Override
public Bundle editProperties(AccountAuthenticatorResponse response, String accountType) {
throw new UnsupportedOperationException();
}
@Override
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException {
return null;
}
@Override
public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) throws NetworkErrorException {
return null;
}
@Override
public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException {
throw new UnsupportedOperationException();
}
@Override
public String getAuthTokenLabel(String authTokenType) {
throw new UnsupportedOperationException();
}
@Override
public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException {
throw new UnsupportedOperationException();
}
@Override
public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) throws NetworkErrorException {
throw new UnsupportedOperationException();
}
}
| elliottsj/ftw-android | mobile/src/main/java/com/elliottsj/ftw/sync/Authenticator.java | Java | mit | 1,799 | [
30522,
7427,
4012,
1012,
9899,
2015,
3501,
1012,
3027,
2860,
1012,
26351,
1025,
12324,
11924,
1012,
6115,
1012,
10061,
6305,
3597,
16671,
4887,
10760,
16778,
11266,
2953,
1025,
12324,
11924,
1012,
6115,
1012,
4070,
1025,
12324,
11924,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<div class="row">
<?= form_open_multipart(base_url() . '#', array('id' => 'form4', 'name' => 'form4', 'role' => 'form', 'novalidate' => '')); ?>
<!-- col -->
<?php $this->load->view('admin/msg') ?>
<div class="col-md-12">
<section class="tile">
<!-- tile header -->
<!-- /tile header -->
<div class="tile-header dvd dvd-btm bg-greensea">
<h1 class="custom-font"><strong>View <?= $pageTitle ?> Setup</strong> </h1>
</div>
<!-- tile body -->
<div class="tile-body">
<?php if(isset($pageroleaccessmap) && $pageroleaccessmap->num_rows()>0){ $v=$pageroleaccessmap->row();?>
<div class="row">
<div class="form-group col-md-4">
<label for="pageID">Form Name <span class="required">*</span></label>
<select name="pageID" id="pageID" tabindex="3" disabled="" class="form-control chosen-select">
<option value=""></option>
<?php
if (isset($pages) && $pages->num_rows() > 0) {
foreach ($pages->result() AS $page) {
?>
<option value="<?= $page->pageID ?>" <?php if($v->pageID==$page->pageID){echo 'selected';}?>><?= ucwords($page->menuCaption); ?></option>
<?php
}
}
?>
</select>
</div>
<div class="form-group col-md-4">
<label for="roleID">Role Name <span class="required">*</span></label>
<select name="roleID" id="roleID" tabindex="3" disabled class="form-control chosen-select">
<option value=""></option>
<?php
if (isset($role) && $role->num_rows() > 0) {
foreach ($role->result() AS $rol) {
?>
<option value="<?= $rol->roleID ?>" <?php if($v->roleID==$rol->roleID){echo 'selected';}?>><?= ucwords($rol->roleName); ?></option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="row">
<hr class="line-dashed line-full"/>
<div class="form-group">
<label class="col-sm-12 control-label">Access Permission</label>
<div class="col-sm-2">
<label class="checkbox checkbox-custom-alt">
<input type="checkbox" name="createEnabled"
data-parsley-trigger="change"
value="1" disabled <?php if($v->createEnabled==1){echo 'checked';}?>><i></i> Create Permission
</label>
</div>
<div class="col-sm-2">
<label class="checkbox checkbox-custom-alt">
<input type="checkbox" name="viewEnabled"
data-parsley-trigger="change"
value="1" disabled <?php if($v->viewEnabled==1){echo 'checked';}?>><i></i> View Permission
</label>
</div>
<div class="col-sm-2">
<label class="checkbox checkbox-custom-alt">
<input type="checkbox" name="modifyEnabled"
data-parsley-trigger="change"
value="1" disabled <?php if($v->modifyEnabled==1){echo 'checked';}?>><i></i> Modify Permission
</label>
</div>
<div class="col-sm-2">
<label class="checkbox checkbox-custom-alt">
<input type="checkbox" name="approveEnabled"
data-parsley-trigger="change"
value="1" disabled="" <?php if($v->approveEnabled==1){echo 'checked';}?>><i></i> Approve Permission
</label>
</div>
<div class="col-sm-2">
<label class="checkbox checkbox-custom-alt">
<input type="checkbox" name="deleteEnabled"
data-parsley-trigger="change"
value="1" disabled="" <?php if($v->deleteEnabled==1){echo 'checked';}?>><i></i> Delete Permission
</label>
</div>
</div>
</div>
<?php }?>
</div>
<!-- /tile body -->
</section>
<!-- /tile -->
</div>
<div class="col-md-12">
<!-- tile -->
<!-- tile -->
<section class="tile">
<!-- tile body -->
<div class="tile-body">
<!-- tile footer -->
<div class="tile-footer text-right bg-tr-black lter dvd dvd-top">
<span id="form4SubmitMsg"></span>
<!-- SUBMIT BUTTON -->
<a href="javascript:void(0);" class="btn btn-warning form4SubmitClose"><i class="fa fa-times-circle"></i> Close</a>
</div>
<!-- /tile footer -->
</div>
<!-- /tile body -->
</section>
<!-- /tile -->
</div>
<?php echo form_close(); ?>
<!-- /col -->
</div>
<!-- /row -->
| anjaneyavadivel/trulms | application/views/admin/form_access/view-form-access.php | PHP | apache-2.0 | 6,111 | [
30522,
1026,
4487,
2615,
2465,
1027,
1000,
5216,
1000,
1028,
1026,
1029,
1027,
2433,
1035,
2330,
1035,
4800,
19362,
2102,
1006,
2918,
1035,
24471,
2140,
1006,
1007,
1012,
1005,
1001,
1005,
1010,
9140,
1006,
1005,
8909,
1005,
1027,
1028,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Pertusaria pertusa f. conglomerans Erichsen FORM
#### Status
ACCEPTED
#### According to
Index Fungorum
#### Published in
null
#### Original name
Pertusaria pertusa f. conglomerans Erichsen
### Remarks
null | mdoering/backbone | life/Fungi/Ascomycota/Lecanoromycetes/Pertusariales/Pertusariaceae/Pertusaria/Pertusaria pertusa/Pertusaria pertusa conglomerans/README.md | Markdown | apache-2.0 | 212 | [
30522,
1001,
2566,
5809,
10980,
2566,
5809,
2050,
1042,
1012,
26478,
21297,
23169,
2015,
17513,
5054,
2433,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
30524,
5809,
10980,
2566,
5809,
2050,
1042,
1012,
26478,
21297,
23169,
2015,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"21331150","logradouro":"Rua Sargento Menezes","bairro":"Bento Ribeiro","cidade":"Rio de Janeiro","uf":"RJ","estado":"Rio de Janeiro"});
| lfreneda/cepdb | api/v1/21331150.jsonp.js | JavaScript | cc0-1.0 | 150 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
19883,
21486,
16068,
2692,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
27599,
2080,
2273,
9351,
2229,
1000,
1010,
1000,
21790,
18933,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* JEDEC Flash Interface.
* This is an older type of interface for self programming flash. It is
* commonly use in older AMD chips and is obsolete compared with CFI.
* It is called JEDEC because the JEDEC association distributes the ID codes
* for the chips.
*
* See the AMD flash databook for information on how to operate the interface.
*
* $Id: jedec.h,v 1.3 2003/05/21 11:51:01 dwmw2 Exp $
*/
#ifndef __LINUX_MTD_JEDEC_H__
#define __LINUX_MTD_JEDEC_H__
#include <linux/types.h>
#define MAX_JEDEC_CHIPS 16
// Listing of all supported chips and their information
struct JEDECTable
{
__u16 jedec;
char *name;
unsigned long size;
unsigned long sectorsize;
__u32 capabilities;
};
// JEDEC being 0 is the end of the chip array
struct jedec_flash_chip
{
__u16 jedec;
unsigned long size;
unsigned long sectorsize;
// *(__u8*)(base + (adder << addrshift)) = data << datashift
// Address size = size << addrshift
unsigned long base; // Byte 0 of the flash, will be unaligned
unsigned int datashift; // Useful for 32bit/16bit accesses
unsigned int addrshift;
unsigned long offset; // linerized start. base==offset for unbanked, uninterleaved flash
__u32 capabilities;
// These markers are filled in by the flash_chip_scan function
unsigned long start;
unsigned long length;
};
struct jedec_private
{
unsigned long size; // Total size of all the devices
/* Bank handling. If sum(bank_fill) == size then this is linear flash.
Otherwise the mapping has holes in it. bank_fill may be used to
find the holes, but in the common symetric case
bank_fill[0] == bank_fill[*], thus addresses may be computed
mathmatically. bank_fill must be powers of two */
unsigned is_banked;
unsigned long bank_fill[MAX_JEDEC_CHIPS];
struct jedec_flash_chip chips[MAX_JEDEC_CHIPS];
};
#endif
| cipibad/openrtd_2012 | toolchain_mipsel/include/linux/mtd/jedec.h | C | gpl-2.0 | 1,927 | [
30522,
1013,
1008,
24401,
8586,
5956,
8278,
1012,
1008,
2023,
2003,
2019,
3080,
2828,
1997,
8278,
2005,
2969,
4730,
5956,
1012,
2009,
2003,
1008,
4141,
2224,
1999,
3080,
2572,
2094,
11772,
1998,
2003,
15832,
4102,
2007,
12935,
2072,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
declare(strict_types = 1);
namespace App\Handlers\Frontend\Auth;
use App\Mail\Auth\Confirmation;
use App\Repository\User\UserRepository;
use App\Services\Auth\Activator;
use App\Services\Auth\Exceptions\AlreadyActivatedException;
use App\Services\Auth\Exceptions\UserDoesNotExistException;
use Illuminate\Contracts\Mail\Mailer;
class RepeatActivationHandler
{
/**
* @var Activator
*/
private $activator;
/**
* @var UserRepository
*/
private $userRepository;
/**
* @var Mailer
*/
private $mailer;
public function __construct(Activator $activator, UserRepository $userRepository, Mailer $mailer)
{
$this->activator = $activator;
$this->userRepository = $userRepository;
$this->mailer = $mailer;
}
public function handle(string $email): void
{
$user = $this->userRepository->findByEmail($email);
if ($user === null) {
throw new UserDoesNotExistException($email);
}
if ($this->activator->isActivated($user)) {
throw new AlreadyActivatedException($user);
}
$activation = $this->activator->makeActivation($user);
$this->mailer
->to($activation->getUser()->getEmail())
->queue(new Confirmation($activation));
}
}
| D3lph1/L-shop | app/Handlers/Frontend/Auth/RepeatActivationHandler.php | PHP | mit | 1,326 | [
30522,
1026,
1029,
25718,
13520,
1006,
9384,
1035,
4127,
1027,
1015,
1007,
1025,
3415,
15327,
10439,
1032,
28213,
2015,
1032,
2392,
10497,
1032,
8740,
2705,
1025,
2224,
10439,
1032,
5653,
1032,
8740,
2705,
1032,
13964,
1025,
2224,
10439,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
__version__ = "1.12.0"
__version_info__ = ( 1, 12, 0 )
| JeffHoogland/bodhi3packages | python3-efl-i386/usr/lib/python3.4/dist-packages/efl/__init__.py | Python | bsd-3-clause | 56 | [
30522,
1035,
1035,
2544,
1035,
1035,
1027,
1000,
1015,
1012,
2260,
1012,
1014,
1000,
1035,
1035,
2544,
1035,
18558,
1035,
1035,
1027,
1006,
1015,
1010,
2260,
1010,
1014,
1007,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
let SyncDisabled = props =>
<SvgIcon {...props}>
<path d="M10 6.35V4.26c-.8.21-1.55.54-2.23.96l1.46 1.46c.25-.12.5-.24.77-.33zm-7.14-.94l2.36 2.36C4.45 8.99 4 10.44 4 12c0 2.21.91 4.2 2.36 5.64L4 20h6v-6l-2.24 2.24C6.68 15.15 6 13.66 6 12c0-1 .25-1.94.68-2.77l8.08 8.08c-.25.13-.5.25-.77.34v2.09c.8-.21 1.55-.54 2.23-.96l2.36 2.36 1.27-1.27L4.14 4.14 2.86 5.41zM20 4h-6v6l2.24-2.24C17.32 8.85 18 10.34 18 12c0 1-.25 1.94-.68 2.77l1.46 1.46C19.55 15.01 20 13.56 20 12c0-2.21-.91-4.2-2.36-5.64L20 4z" />
</SvgIcon>;
SyncDisabled = pure(SyncDisabled);
SyncDisabled.muiName = 'SvgIcon';
export default SyncDisabled;
| AndriusBil/material-ui | packages/material-ui-icons/src/SyncDisabled.js | JavaScript | mit | 728 | [
30522,
12324,
10509,
2013,
1005,
30524,
28667,
25377,
9232,
1013,
5760,
1005,
1025,
12324,
17917,
12863,
2239,
2013,
1005,
3430,
1011,
21318,
1013,
17917,
12863,
2239,
1005,
1025,
2292,
26351,
10521,
3085,
2094,
1027,
24387,
1027,
1028,
1026,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict';
angular.module('mpApp')
.factory(
'preloader',
function($q, $rootScope) {
// I manage the preloading of image objects. Accepts an array of image URLs.
function Preloader(imageLocations) {
// I am the image SRC values to preload.
this.imageLocations = imageLocations;
// As the images load, we'll need to keep track of the load/error
// counts when announing the progress on the loading.
this.imageCount = this.imageLocations.length;
this.loadCount = 0;
this.errorCount = 0;
// I am the possible states that the preloader can be in.
this.states = {
PENDING: 1,
LOADING: 2,
RESOLVED: 3,
REJECTED: 4
};
// I keep track of the current state of the preloader.
this.state = this.states.PENDING;
// When loading the images, a promise will be returned to indicate
// when the loading has completed (and / or progressed).
this.deferred = $q.defer();
this.promise = this.deferred.promise;
}
// ---
// STATIC METHODS.
// ---
// I reload the given images [Array] and return a promise. The promise
// will be resolved with the array of image locations. 111111
Preloader.preloadImages = function(imageLocations) {
var preloader = new Preloader(imageLocations);
return (preloader.load());
};
// ---
// INSTANCE METHODS.
// ---
Preloader.prototype = {
// Best practice for "instnceof" operator.
constructor: Preloader,
// ---
// PUBLIC METHODS.
// ---
// I determine if the preloader has started loading images yet.
isInitiated: function isInitiated() {
return (this.state !== this.states.PENDING);
},
// I determine if the preloader has failed to load all of the images.
isRejected: function isRejected() {
return (this.state === this.states.REJECTED);
},
// I determine if the preloader has successfully loaded all of the images.
isResolved: function isResolved() {
return (this.state === this.states.RESOLVED);
},
// I initiate the preload of the images. Returns a promise. 222
load: function load() {
// If the images are already loading, return the existing promise.
if (this.isInitiated()) {
return (this.promise);
}
this.state = this.states.LOADING;
for (var i = 0; i < this.imageCount; i++) {
this.loadImageLocation(this.imageLocations[i]);
}
// Return the deferred promise for the load event.
return (this.promise);
},
// ---
// PRIVATE METHODS.
// ---
// I handle the load-failure of the given image location.
handleImageError: function handleImageError(imageLocation) {
this.errorCount++;
// If the preload action has already failed, ignore further action.
if (this.isRejected()) {
return;
}
this.state = this.states.REJECTED;
this.deferred.reject(imageLocation);
},
// I handle the load-success of the given image location.
handleImageLoad: function handleImageLoad(imageLocation) {
this.loadCount++;
// If the preload action has already failed, ignore further action.
if (this.isRejected()) {
return;
}
// Notify the progress of the overall deferred. This is different
// than Resolving the deferred - you can call notify many times
// before the ultimate resolution (or rejection) of the deferred.
this.deferred.notify({
percent: Math.ceil(this.loadCount / this.imageCount * 100),
imageLocation: imageLocation
});
// If all of the images have loaded, we can resolve the deferred
// value that we returned to the calling context.
if (this.loadCount === this.imageCount) {
this.state = this.states.RESOLVED;
this.deferred.resolve(this.imageLocations);
}
},
// I load the given image location and then wire the load / error
// events back into the preloader instance.
// --
// NOTE: The load/error events trigger a $digest. 333
loadImageLocation: function loadImageLocation(imageLocation) {
var preloader = this;
// When it comes to creating the image object, it is critical that
// we bind the event handlers BEFORE we actually set the image
// source. Failure to do so will prevent the events from proper
// triggering in some browsers.
var image = angular.element(new Image())
.bind('load', function(event) {
// Since the load event is asynchronous, we have to
// tell AngularJS that something changed.
$rootScope.$apply(
function() {
preloader.handleImageLoad(event.target.src);
// Clean up object reference to help with the
// garbage collection in the closure.
preloader = image = event = null;
}
);
})
.bind('error', function(event) {
// Since the load event is asynchronous, we have to
// tell AngularJS that something changed.
$rootScope.$apply(
function() {
preloader.handleImageError(event.target.src);
// Clean up object reference to help with the
// garbage collection in the closure.
preloader = image = event = null;
}
);
})
.attr('src', imageLocation);
}
};
// Return the factory instance.
return (Preloader);
}
);
| 59023g/mpdotcom | app/scripts/services/preloader.js | JavaScript | mit | 6,121 | [
30522,
1005,
2224,
9384,
1005,
1025,
16108,
1012,
11336,
1006,
1005,
6131,
29098,
1005,
1007,
1012,
4713,
1006,
1005,
3653,
11066,
2121,
1005,
1010,
3853,
1006,
1002,
1053,
1010,
1002,
6147,
16186,
1007,
1063,
1013,
1013,
1045,
6133,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.fakekoji.xmlrpc.server.expensiveobjectscache;
import org.fakekoji.xmlrpc.server.xmlrpcrequestparams.XmlRpcRequestParams;
import java.io.BufferedWriter;
import java.io.IOException;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import edu.umd.cs.findbugs.annotations.*;
public class SingleUrlResponseCache {
private final URL id;
private final Map<XmlRpcRequestParams, ResultWithTimeStamp> cache = Collections.synchronizedMap(new HashMap<>());
public SingleUrlResponseCache(final URL u) {
this.id = u;
}
public ResultWithTimeStamp get(final XmlRpcRequestParams params) {
return cache.get(params);
}
public void put(final Object result, XmlRpcRequestParams params) {
cache.put(params, new ResultWithTimeStamp(result));
}
public void remove(XmlRpcRequestParams key) {
cache.remove(key);
}
public URL getId() {
return id;
}
private static String asMinutes(long l) {
return " (" + (l / 1000 / 600) + "min)";
}
private static final Map<Class<?>, Class<?>> WRAPPER_TYPE_MAP;
static {
WRAPPER_TYPE_MAP = new HashMap<Class<?>, Class<?>>(20);
WRAPPER_TYPE_MAP.put(Integer.class, int.class);
WRAPPER_TYPE_MAP.put(Byte.class, byte.class);
WRAPPER_TYPE_MAP.put(Character.class, char.class);
WRAPPER_TYPE_MAP.put(Boolean.class, boolean.class);
WRAPPER_TYPE_MAP.put(Double.class, double.class);
WRAPPER_TYPE_MAP.put(Float.class, float.class);
WRAPPER_TYPE_MAP.put(Long.class, long.class);
WRAPPER_TYPE_MAP.put(Short.class, short.class);
WRAPPER_TYPE_MAP.put(Void.class, void.class);
WRAPPER_TYPE_MAP.put(String.class, String.class);
}
public synchronized void dump(String preffix, BufferedWriter bw, RemoteRequestsCache validator) throws IOException {
List<Map.Entry<XmlRpcRequestParams, ResultWithTimeStamp>> entries = new ArrayList(cache.entrySet());
entries.sort((o1, o2) -> o1.getKey().getMethodName().compareTo(o2.getKey().getMethodName()));
for (Map.Entry<XmlRpcRequestParams, ResultWithTimeStamp> entry : entries) {
bw.write(preffix + XmlRpcRequestParams.toNiceString(entry.getKey()) + ": ");
bw.newLine();
bw.write(preffix + " dateCreated: " + entry.getValue().dateCreated);
bw.newLine();
bw.write(preffix + " notBeingRepalced: " + entry.getValue().notBeingRepalced);
bw.newLine();
bw.write(preffix + " validity: " + validator.isValid(entry.getValue(), entry.getKey().getMethodName(), id.getHost()));
bw.newLine();
long ttl = validator.getPerMethodValidnesMilis(entry.getKey().getMethodName(), id.getHost());
bw.write(preffix + " original ttl: " + ttl + "ms" + asMinutes(ttl));
bw.newLine();
long cttl = new Date().getTime() - entry.getValue().dateCreated.getTime();
bw.write(preffix + " time alive " + cttl + "ms" + asMinutes(cttl));
bw.newLine();
bw.write(preffix + " => ttl: " + (ttl - cttl) + "ms" + asMinutes(ttl - cttl));
bw.newLine();
if (WRAPPER_TYPE_MAP.containsKey(entry.getValue().result.getClass())) {
bw.write(preffix + " result: " + entry.getValue().result + " (" + entry.getValue().result.getClass().getName() + ")");
bw.newLine();
} else {
bw.write(preffix + " result: ");
bw.newLine();
entry.getValue().dump(preffix + " ", bw);
}
}
bw.write(preffix + "total: " + entries.size());
bw.newLine();
}
@SuppressFBWarnings(value = {"EI_EXPOSE_REP", "EI_EXPOSE_REP2"}, justification = "pure wrapper class")
public static final class ResultWithTimeStamp {
private final Date dateCreated;
private final Object result;
private boolean notBeingRepalced = true;
public ResultWithTimeStamp(final Object result) {
this.dateCreated = new Date();
this.result = result;
}
public Date getDateCreated() {
return dateCreated;
}
public Object getResult() {
return result;
}
public boolean isNotBeingReplaced() {
return notBeingRepalced;
}
public void flagBeingReplaced() {
this.notBeingRepalced = false;
}
public void dump(String preffix, BufferedWriter bw) throws IOException {
dump(preffix, result, bw);
}
private static final String FINAL_INCREMENT = " ";
public static void dump(String preffix, Object o, BufferedWriter bw) throws IOException {
if (o == null) {
bw.write(preffix + "null");
bw.newLine();
return;
}
if (o instanceof Map) {
bw.write(preffix + " map " + o.getClass().getName() + " map (size: " + ((Map) o).size());
bw.newLine();
Set<Map.Entry> entries = ((Map) o).entrySet();
for (Map.Entry e : entries) {
if (e.getKey() == null) {
bw.write(preffix + FINAL_INCREMENT + "null=");
bw.newLine();
dump(preffix + FINAL_INCREMENT + FINAL_INCREMENT, e.getValue(), bw);
} else {
bw.write(preffix + FINAL_INCREMENT + e.getKey() + "=");
bw.newLine();
dump(preffix + FINAL_INCREMENT + FINAL_INCREMENT, e.getValue(), bw);
}
}
} else if (o.getClass().isArray()) {
bw.write(preffix + " ary " + o.getClass().getName() + " ary (size: " + Array.getLength(o));
bw.newLine();
if (o instanceof Object[]) {
for (Object e : (Object[]) o) {
dump(preffix + FINAL_INCREMENT, e, bw);
}
} else if (o instanceof int[]) {
bw.write(preffix + FINAL_INCREMENT);
for (int e : (int[]) o) {
bw.write("" + e + ",");
}
bw.newLine();
} else if (o instanceof byte[]) {
bw.write(preffix + FINAL_INCREMENT);
for (byte e : (byte[]) o) {
bw.write("" + e + ",");
}
bw.newLine();
} else if (o instanceof char[]) {
bw.write(preffix + FINAL_INCREMENT);
for (char e : (char[]) o) {
bw.write("" + e + ",");
}
bw.newLine();
} else if (o instanceof boolean[]) {
bw.write(preffix + FINAL_INCREMENT);
for (boolean e : (boolean[]) o) {
bw.write("" + e + ",");
}
bw.newLine();
} else if (o instanceof double[]) {
bw.write(preffix + FINAL_INCREMENT);
for (double e : (double[]) o) {
bw.write("" + e + ",");
}
bw.newLine();
} else if (o instanceof float[]) {
bw.write(preffix + FINAL_INCREMENT);
for (float e : (float[]) o) {
bw.write("" + e + ",");
}
bw.newLine();
} else if (o instanceof long[]) {
bw.write(preffix + FINAL_INCREMENT);
for (long e : (long[]) o) {
bw.write("" + e + ",");
}
bw.newLine();
} else if (o instanceof short[]) {
bw.write(preffix + FINAL_INCREMENT);
for (short e : (short[]) o) {
bw.write("" + e + ",");
}
bw.newLine();
}
} else if (o instanceof Collection) {
bw.write(preffix + " col " + o.getClass().getName() + " col (size: " + ((Collection) o).size());
bw.newLine();
for (Object e : (Collection) o) {
dump(preffix + FINAL_INCREMENT, e, bw);
}
} else if (o instanceof Iterable) {
bw.write(preffix + " ite " + o.getClass().getName() + " ite");
bw.newLine();
for (Object e : (Iterable) o) {
dump(preffix + FINAL_INCREMENT, e, bw);
}
} else {
bw.write(preffix + o + " (" + o.getClass().getName() + ")");
bw.newLine();
}
}
}
Set<Map.Entry<XmlRpcRequestParams, ResultWithTimeStamp>> getContent() {
return cache.entrySet();
}
}
| judovana/jenkins-scm-koji-plugin | koji-scm-lib/src/main/java/org/fakekoji/xmlrpc/server/expensiveobjectscache/SingleUrlResponseCache.java | Java | mit | 9,352 | [
30522,
7427,
8917,
1012,
8275,
3683,
4478,
1012,
20950,
14536,
2278,
1012,
8241,
1012,
6450,
16429,
20614,
15782,
5403,
1025,
12324,
8917,
1012,
8275,
3683,
4478,
1012,
20950,
14536,
2278,
1012,
8241,
1012,
20950,
14536,
16748,
15500,
28689,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2021 The XLS Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "xls/ir/interval.h"
#include <random>
namespace xls {
void Interval::EnsureValid() const {
XLS_CHECK(is_valid_);
XLS_CHECK_EQ(lower_bound_.bit_count(), upper_bound_.bit_count());
}
int64_t Interval::BitCount() const {
EnsureValid();
return lower_bound_.bit_count();
}
Interval Interval::Maximal(int64_t bit_width) {
return Interval(UBits(0, bit_width), Bits::AllOnes(bit_width));
}
Interval Interval::Precise(const Bits& bits) { return Interval(bits, bits); }
Interval Interval::ZeroExtend(int64_t bit_width) const {
XLS_CHECK_GE(bit_width, BitCount());
return Interval(bits_ops::ZeroExtend(LowerBound(), bit_width),
bits_ops::ZeroExtend(UpperBound(), bit_width));
}
bool Interval::Overlaps(const Interval& lhs, const Interval& rhs) {
XLS_CHECK_EQ(lhs.BitCount(), rhs.BitCount());
XLS_CHECK(!lhs.IsImproper());
XLS_CHECK(!rhs.IsImproper());
if (lhs.BitCount() == 0) {
// The unique zero-width interval overlaps with itself.
return true;
}
if (rhs < lhs) {
return Overlaps(rhs, lhs);
}
return bits_ops::UGreaterThanOrEqual(lhs.upper_bound_, rhs.lower_bound_);
}
bool Interval::Disjoint(const Interval& lhs, const Interval& rhs) {
return !Overlaps(lhs, rhs);
}
bool Interval::Abuts(const Interval& lhs, const Interval& rhs) {
XLS_CHECK_EQ(lhs.BitCount(), rhs.BitCount());
XLS_CHECK(!lhs.IsImproper());
XLS_CHECK(!rhs.IsImproper());
if (lhs.BitCount() == 0) {
// The unique zero-width interval does not abut itself.
return false;
}
if (rhs < lhs) {
return Abuts(rhs, lhs);
}
// If the two intervals overlap, they definitely don't abut.
// This takes care of cases like
// `Interval::Abuts(Interval::Maximal(n), Interval::Maximal(n))`
// and any others I haven't thought of.
if (Interval::Overlaps(lhs, rhs)) {
return false;
}
Bits one = UBits(1, lhs.BitCount());
return bits_ops::UEqual(bits_ops::Add(lhs.upper_bound_, one),
rhs.lower_bound_);
}
Interval Interval::ConvexHull(const Interval& lhs, const Interval& rhs) {
XLS_CHECK_EQ(lhs.BitCount(), rhs.BitCount());
XLS_CHECK(!lhs.IsImproper());
XLS_CHECK(!rhs.IsImproper());
if (lhs.BitCount() == 0) {
// The convex hull of any set of zero-width intervals is of course the
// unique zero-width interval.
return Interval(Bits(), Bits());
}
Interval result = lhs;
if (bits_ops::ULessThan(rhs.lower_bound_, result.lower_bound_)) {
result.lower_bound_ = rhs.lower_bound_;
}
if (bits_ops::UGreaterThan(rhs.upper_bound_, result.upper_bound_)) {
result.upper_bound_ = rhs.upper_bound_;
}
return result;
}
absl::optional<Interval> Interval::Intersect(const Interval& lhs,
const Interval& rhs) {
XLS_CHECK_EQ(lhs.BitCount(), rhs.BitCount());
XLS_CHECK(!lhs.IsImproper());
XLS_CHECK(!rhs.IsImproper());
if (!Interval::Overlaps(lhs, rhs)) {
return absl::nullopt;
}
Bits lower = lhs.LowerBound();
if (bits_ops::UGreaterThan(rhs.LowerBound(), lower)) {
lower = rhs.LowerBound();
}
Bits upper = lhs.UpperBound();
if (bits_ops::ULessThan(rhs.UpperBound(), upper)) {
upper = rhs.UpperBound();
}
return Interval(lower, upper);
}
std::vector<Interval> Interval::Difference(const Interval& lhs,
const Interval& rhs) {
XLS_CHECK_EQ(lhs.BitCount(), rhs.BitCount());
XLS_CHECK(!lhs.IsImproper());
XLS_CHECK(!rhs.IsImproper());
if (!Interval::Overlaps(lhs, rhs)) {
// X - Y = X when X ∩ Y = ø
return {lhs};
}
std::vector<Interval> result;
if (bits_ops::ULessThan(lhs.LowerBound(), rhs.LowerBound())) {
result.push_back(
Interval(lhs.LowerBound(),
bits_ops::Sub(rhs.LowerBound(), UBits(1, rhs.BitCount()))));
}
if (bits_ops::ULessThan(rhs.UpperBound(), lhs.UpperBound())) {
result.push_back(
Interval(bits_ops::Add(rhs.UpperBound(), UBits(1, rhs.BitCount())),
lhs.UpperBound()));
}
return result;
}
std::vector<Interval> Interval::Complement(const Interval& interval) {
return Difference(Maximal(interval.BitCount()), interval);
}
bool Interval::IsSubsetOf(const Interval& lhs, const Interval& rhs) {
XLS_CHECK_EQ(lhs.BitCount(), rhs.BitCount());
XLS_CHECK(!lhs.IsImproper());
XLS_CHECK(!rhs.IsImproper());
return bits_ops::ULessThanOrEqual(rhs.LowerBound(), lhs.LowerBound()) &&
bits_ops::UGreaterThanOrEqual(rhs.UpperBound(), lhs.UpperBound());
}
bool Interval::ForEachElement(std::function<bool(const Bits&)> callback) const {
EnsureValid();
if (bits_ops::UEqual(lower_bound_, upper_bound_)) {
return callback(lower_bound_);
}
Bits value = lower_bound_;
Bits zero = UBits(0, BitCount());
Bits one = UBits(1, BitCount());
Bits max = Bits::AllOnes(BitCount());
if (bits_ops::UGreaterThan(lower_bound_, upper_bound_)) {
while (true) {
if (callback(value)) {
return true;
}
if (bits_ops::UEqual(value, max)) {
break;
}
value = bits_ops::Add(value, one);
}
value = zero;
}
while (true) {
if (callback(value)) {
return true;
}
if (bits_ops::UEqual(value, upper_bound_)) {
break;
}
value = bits_ops::Add(value, one);
}
return false;
}
std::vector<Bits> Interval::Elements() const {
std::vector<Bits> result;
ForEachElement([&result](const Bits& value) {
result.push_back(value);
return false;
});
return result;
}
Bits Interval::SizeBits() const {
EnsureValid();
if (bits_ops::UGreaterThan(lower_bound_, upper_bound_)) {
Bits zero = UBits(0, BitCount());
Bits max = Bits::AllOnes(BitCount());
Bits x = Interval(lower_bound_, max).SizeBits();
Bits y = Interval(zero, upper_bound_).SizeBits();
return bits_ops::Add(x, y);
}
int64_t padded_size = BitCount() + 1;
Bits difference = bits_ops::Sub(upper_bound_, lower_bound_);
return bits_ops::Add(UBits(1, padded_size),
bits_ops::ZeroExtend(difference, padded_size));
}
absl::optional<int64_t> Interval::Size() const {
absl::StatusOr<uint64_t> size_status = SizeBits().ToUint64();
if (size_status.ok()) {
uint64_t size = *size_status;
if (size > static_cast<uint64_t>(std::numeric_limits<int64_t>::max())) {
return absl::nullopt;
}
return static_cast<int64_t>(size);
}
return absl::nullopt;
}
bool Interval::IsImproper() const {
EnsureValid();
if (BitCount() == 0) {
return false;
}
return bits_ops::ULessThan(upper_bound_, lower_bound_);
}
bool Interval::IsPrecise() const {
EnsureValid();
if (BitCount() == 0) {
return true;
}
return lower_bound_ == upper_bound_;
}
absl::optional<Bits> Interval::GetPreciseValue() const {
if (!IsPrecise()) {
return absl::nullopt;
}
return lower_bound_;
}
bool Interval::IsMaximal() const {
EnsureValid();
if (BitCount() == 0) {
return true;
}
// This works because `bits_ops::Add` overflows, and correctly handles
// improper intervals.
Bits upper_plus_one = bits_ops::Add(upper_bound_, UBits(1, BitCount()));
return bits_ops::UEqual(upper_plus_one, lower_bound_);
}
bool Interval::Covers(const Bits& point) const {
EnsureValid();
XLS_CHECK_EQ(BitCount(), point.bit_count());
if (BitCount() == 0) {
return true;
}
if (IsImproper()) {
return bits_ops::ULessThanOrEqual(lower_bound_, point) ||
bits_ops::ULessThanOrEqual(point, upper_bound_);
} else {
return bits_ops::ULessThanOrEqual(lower_bound_, point) &&
bits_ops::ULessThanOrEqual(point, upper_bound_);
}
}
bool Interval::CoversZero() const { return Covers(UBits(0, BitCount())); }
bool Interval::CoversOne() const {
return (BitCount() > 0) && Covers(UBits(1, BitCount()));
}
bool Interval::CoversMax() const { return Covers(Bits::AllOnes(BitCount())); }
std::string Interval::ToString() const {
FormatPreference pref = FormatPreference::kDefault;
return absl::StrFormat("[%s, %s]", lower_bound_.ToString(pref, false),
upper_bound_.ToString(pref, false));
}
Interval Interval::Random(uint32_t seed, int64_t bit_count) {
std::mt19937 gen(seed);
std::uniform_int_distribution<int32_t> distrib(0, 255);
int64_t num_bytes = (bit_count / 8) + ((bit_count % 8 == 0) ? 0 : 1);
std::vector<uint8_t> start_bytes(num_bytes);
for (int64_t i = 0; i < num_bytes; ++i) {
start_bytes[i] = distrib(gen);
}
std::vector<uint8_t> end_bytes(num_bytes);
for (int64_t i = 0; i < num_bytes; ++i) {
end_bytes[i] = distrib(gen);
}
return Interval(Bits::FromBytes(start_bytes, bit_count),
Bits::FromBytes(end_bytes, bit_count));
}
} // namespace xls
| google/xls | xls/ir/interval.cc | C++ | apache-2.0 | 9,322 | [
30522,
1013,
1013,
9385,
25682,
1996,
28712,
2015,
6048,
1013,
1013,
1013,
1013,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1013,
1013,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
@echo off
SETLOCAL
REM http://dev.exiv2.org/projects/exiv2/repository/
SET EXIV2_COMMIT=3364
REM http://sourceforge.net/p/libjpeg-turbo/code/
SET LIBJPEG_COMMIT=1093
rem error 1406
rem https://github.com/madler/zlib/commits
SET ZLIB_COMMIT_LONG=50893291621658f355bc5b4d450a8d06a563053d
rem https://github.com/openexr/openexr
SET OPENEXR_COMMIT_LONG=91015147e5a6a1914bcb16b12886aede9e1ed065
SET OPENEXR_CMAKE_VERSION=2.2
rem http://www.boost.org/
SET BOOST_MINOR=55
REM ftp://ftp.fftw.org/pub/fftw/
SET FFTW_VER=3.3.4
rem https://github.com/mm2/Little-CMS
SET LCMS_COMMIT_LONG=d61231a1efb9eb926cbf0235afe03452302c6009
rem https://github.com/LibRaw/LibRaw
SET LIBRAW_COMMIT_LONG=32e21b28e24b6cecdae8813b5ef9c103b8a8ccf0
SET LIBRAW_DEMOS2_COMMIT_LONG=ffea825e121e92aa780ae587b65f80fc5847637c
SET LIBRAW_DEMOS3_COMMIT_LONG=f0895891fdaa775255af02275fce426a5bf5c9fc
rem ftp://sourceware.org/pub/pthreads-win32/
SET PTHREADS_DIR=prebuilt-dll-2-9-1-release
rem http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c
SET CFITSIO_VER=3360
rem broken 3370
rem Internal version number for http://qtpfsgui.sourceforge.net/win/hugin-*
SET HUGIN_VER=201300
IF EXIST .settings\vsexpress.txt (
SET VSCOMMAND=vcexpress
) ELSE IF EXIST .settings\devent.txt (
SET VSCOMMAND=devenv
) ELSE (
vcexpress XXXXXXXXXXXXX 2>NUL >NUL
IF ERRORLEVEL 1 (
devenv /? 2>NUL >NUL
IF ERRORLEVEL 1 (
echo.
echo.ERROR: This file must be run inside a VS command prompt!
echo.
goto error_end
) ELSE (
SET VSCOMMAND=devenv
)
) ELSE (
SET VSCOMMAND=vcexpress
)
mkdir .settings 2>NUL >NUL
echo x>.settings\%VSCOMMAND%.txt
)
IF EXIST ..\msvc (
echo.
echo.ERROR: This file should NOT be executed within the LuminanceHDR source directory,
echo. but in a new empty folder!
echo.
goto error_end
)
ml64.exe > NUL
IF ERRORLEVEL 1 (
set Platform=Win32
set RawPlatform=x86
set CpuPlatform=ia32
) ELSE (
set Platform=x64
set RawPlatform=x64
set CpuPlatform=intel64
)
SET VISUAL_STUDIO_VC_REDIST=%VCINSTALLDIR%\redist\%RawPlatform%
IF DEFINED VS110COMNTOOLS (
REM Visual Studio 2012
set VS_SHORT=vc11
set VS_CMAKE=Visual Studio 11
set VS_PROG_FILES=Microsoft Visual Studio 11.0
) ELSE IF DEFINED VS100COMNTOOLS (
REM Visual Studio 2010
set VS_SHORT=vc10
set VS_CMAKE=Visual Studio 10
set VS_PROG_FILES=Microsoft Visual Studio 10.0
) ELSE (
REM Visual Studio 2008
set VS_SHORT=vc9
set VS_CMAKE=Visual Studio 9 2008
set VS_PROG_FILES=Microsoft Visual Studio 9.0
)
IF %Platform% EQU x64 (
set VS_CMAKE=%VS_CMAKE% Win64
)
call setenv.cmd
IF NOT EXIST %CMAKE_DIR%\bin\cmake.exe (
echo.
echo.ERROR: CMake not found: %CMAKE_DIR%\bin\cmake.exe
echo.
goto error_end
)
IF NOT EXIST %CYGWIN_DIR%\bin\cp.exe GOTO cygwin_error
IF NOT EXIST %CYGWIN_DIR%\bin\cvs.exe GOTO cygwin_error
IF NOT EXIST %CYGWIN_DIR%\bin\git.exe GOTO cygwin_error
IF NOT EXIST %CYGWIN_DIR%\bin\gzip.exe GOTO cygwin_error
IF NOT EXIST %CYGWIN_DIR%\bin\mv.exe GOTO cygwin_error
IF NOT EXIST %CYGWIN_DIR%\bin\nasm.exe GOTO cygwin_error
IF NOT EXIST %CYGWIN_DIR%\bin\sed.exe GOTO cygwin_error
IF NOT EXIST %CYGWIN_DIR%\bin\ssh.exe GOTO cygwin_error
IF NOT EXIST %CYGWIN_DIR%\bin\svn.exe GOTO cygwin_error
IF NOT EXIST %CYGWIN_DIR%\bin\tar.exe GOTO cygwin_error
IF NOT EXIST %CYGWIN_DIR%\bin\unzip.exe GOTO cygwin_error
IF NOT EXIST %CYGWIN_DIR%\bin\wget.exe GOTO cygwin_error
GOTO cygwin_ok
:cygwin_error
echo ERROR: Cygwin with
echo cp
echo cvs
echo git
echo gzip
echo mv
echo nasm
echo sed
echo ssh
echo svn
echo tar
echo unzip
echo wget
echo is required
GOTO error_end
:cygwin_ok
IF NOT DEFINED Configuration (
set Configuration=Release
)
IF NOT DEFINED ConfigurationLuminance (
set ConfigurationLuminance=RelWithDebInfo
)
cls
echo.
echo.--- %VS_CMAKE% ---
echo.Configuration = %Configuration%
echo.ConfigurationLuminance = %ConfigurationLuminance%
echo.Platform = %Platform% (%RawPlatform%)
echo.
IF NOT EXIST %TEMP_DIR% (
mkdir %TEMP_DIR%
)
IF NOT EXIST vcDlls (
mkdir vcDlls
robocopy "%vcinstalldir%redist\%RawPlatform%" vcDlls /MIR >nul
)
IF NOT EXIST vcDlls\selected (
mkdir vcDlls\selected
%CYGWIN_DIR%\bin\cp.exe vcDlls/**/vcomp* vcDlls/selected
%CYGWIN_DIR%\bin\cp.exe vcDlls/**/msv* vcDlls/selected
)
IF NOT EXIST %TEMP_DIR%\hugin-%HUGIN_VER%-%RawPlatform%.zip (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/hugin-%HUGIN_VER%-%RawPlatform%.zip qtpfsgui.sourceforge.net/win/hugin-%HUGIN_VER%-%RawPlatform%.zip
)
IF NOT EXIST hugin-%HUGIN_VER%-%RawPlatform% (
%CYGWIN_DIR%\bin\unzip.exe -o -q -d hugin-%HUGIN_VER%-%RawPlatform% %TEMP_DIR%\hugin-%HUGIN_VER%-%RawPlatform%.zip
)
SET ZLIB_COMMIT=%ZLIB_COMMIT_LONG:~0,7%
IF NOT EXIST %TEMP_DIR%\zlib-%ZLIB_COMMIT%.zip (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/zlib-%ZLIB_COMMIT%.zip --no-check-certificate http://github.com/madler/zlib/zipball/%ZLIB_COMMIT_LONG%
)
IF NOT EXIST zlib-%ZLIB_COMMIT% (
%CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/zlib-%ZLIB_COMMIT%.zip
%CYGWIN_DIR%\bin\mv.exe madler-zlib-* zlib-%ZLIB_COMMIT%
REM zlib must be compiled in the source folder, else exiv2 compilation
REM fails due to zconf.h rename/compile problems, due to cmake
pushd zlib-%ZLIB_COMMIT%
%CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%"
IF errorlevel 1 goto error_end
%VSCOMMAND% zlib.sln /build "%Configuration%|%Platform%" /Project zlib
IF errorlevel 1 goto error_end
popd
)
IF NOT EXIST %TEMP_DIR%\lpng170b35.zip (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/lpng170b35.zip http://sourceforge.net/projects/libpng/files/libpng17/1.7.0beta35/lp170b35.zip/download
IF errorlevel 1 goto error_end
)
IF NOT EXIST lp170b35 (
%CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/lpng170b35.zip
pushd lp170b35
%CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" . -DZLIB_ROOT=..\zlib-%ZLIB_COMMIT%;..\zlib-%ZLIB_COMMIT%\%Configuration%
IF errorlevel 1 goto error_end
%VSCOMMAND% libpng.sln /build "%Configuration%|%Platform%" /Project png17
IF errorlevel 1 goto error_end
popd
)
IF NOT EXIST %TEMP_DIR%\expat-2.1.0.tar (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/expat-2.1.0.tar.gz http://sourceforge.net/projects/expat/files/expat/2.1.0/expat-2.1.0.tar.gz/download
%CYGWIN_DIR%\bin\gzip.exe -d %TEMP_DIR%/expat-2.1.0.tar.gz
)
IF NOT EXIST expat-2.1.0 (
%CYGWIN_DIR%\bin\tar.exe -xf %TEMP_DIR%/expat-2.1.0.tar
pushd expat-2.1.0
%CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%"
IF errorlevel 1 goto error_end
%VSCOMMAND% expat.sln /build "%Configuration%|%Platform%" /Project expat
IF errorlevel 1 goto error_end
popd
)
IF NOT EXIST exiv2-%EXIV2_COMMIT% (
%CYGWIN_DIR%\bin\svn.exe co -r %EXIV2_COMMIT% svn://dev.exiv2.org/svn/trunk exiv2-%EXIV2_COMMIT%
pushd exiv2-%EXIV2_COMMIT%
%CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" -DZLIB_ROOT=..\zlib-%ZLIB_COMMIT%;..\zlib-%ZLIB_COMMIT%\Release
IF errorlevel 1 goto error_end
%VSCOMMAND% exiv2.sln /build "%Configuration%|%Platform%" /Project exiv2
IF errorlevel 1 goto error_end
copy bin\%Platform%\Dynamic\*.h include
popd
)
IF NOT EXIST libjpeg-turbo-%LIBJPEG_COMMIT% (
%CYGWIN_DIR%\bin\svn.exe co -r %LIBJPEG_COMMIT% svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk libjpeg-turbo-%LIBJPEG_COMMIT%
)
IF NOT EXIST libjpeg-turbo-%LIBJPEG_COMMIT%.build (
mkdir libjpeg-turbo-%LIBJPEG_COMMIT%.build
pushd libjpeg-turbo-%LIBJPEG_COMMIT%.build
%CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" -DCMAKE_BUILD_TYPE=%Configuration% -DNASM="%CYGWIN_DIR%\bin\nasm.exe" -DWITH_JPEG8=TRUE ..\libjpeg-turbo-%LIBJPEG_COMMIT%
IF errorlevel 1 goto error_end
%VSCOMMAND% libjpeg-turbo.sln /build "%Configuration%|%Platform%"
IF errorlevel 1 goto error_end
copy jconfig.h ..\libjpeg-turbo-%LIBJPEG_COMMIT%
popd
)
SET LCMS_COMMIT=%LCMS_COMMIT_LONG:~0,7%
IF NOT EXIST %TEMP_DIR%\lcms2-%LCMS_COMMIT%.zip (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/lcms2-%LCMS_COMMIT%.zip --no-check-certificate https://github.com/mm2/Little-CMS/zipball/%LCMS_COMMIT_LONG%
)
IF NOT EXIST lcms2-%LCMS_COMMIT% (
%CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/lcms2-%LCMS_COMMIT%.zip
%CYGWIN_DIR%\bin\mv.exe mm2-Little-CMS-* lcms2-%LCMS_COMMIT%
pushd lcms2-%LCMS_COMMIT%
%VSCOMMAND% Projects\VC2010\lcms2.sln /Upgrade
%VSCOMMAND% Projects\VC2010\lcms2.sln /build "%Configuration%|%Platform%" /Project lcms2_DLL
IF errorlevel 1 goto error_end
popd
)
IF NOT EXIST %TEMP_DIR%\tiff-4.0.3.zip (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/tiff-4.0.3.zip http://download.osgeo.org/libtiff/tiff-4.0.3.zip
)
IF NOT EXIST tiff-4.0.3 (
%CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/tiff-4.0.3.zip
echo.JPEG_SUPPORT=^1> tiff-4.0.3\qtpfsgui_commands.in
echo.JPEGDIR=%CD%\libjpeg-turbo-%LIBJPEG_COMMIT%>> tiff-4.0.3\qtpfsgui_commands.in
echo.JPEG_INCLUDE=-I%CD%\libjpeg-turbo-%LIBJPEG_COMMIT%>> tiff-4.0.3\qtpfsgui_commands.in
echo.JPEG_LIB=%CD%\libjpeg-turbo-%LIBJPEG_COMMIT%.build\sharedlib\%Configuration%\jpeg.lib>> tiff-4.0.3\qtpfsgui_commands.in
echo.ZIP_SUPPORT=^1>> tiff-4.0.3\qtpfsgui_commands.in
echo.ZLIBDIR=..\..\zlib-%ZLIB_COMMIT%\%Configuration%>> tiff-4.0.3\qtpfsgui_commands.in
echo.ZLIB_INCLUDE=-I..\..\zlib-%ZLIB_COMMIT%>> tiff-4.0.3\qtpfsgui_commands.in
echo.ZLIB_LIB=$^(ZLIBDIR^)\zlib.lib>> tiff-4.0.3\qtpfsgui_commands.in
pushd tiff-4.0.3
nmake /s /c /f Makefile.vc @qtpfsgui_commands.in
IF errorlevel 1 goto error_end
popd
)
SET LIBRAW_COMMIT=%LIBRAW_COMMIT_LONG:~0,7%
SET LIBRAW_DEMOS2_COMMIT=%LIBRAW_DEMOS2_COMMIT_LONG:~0,7%
SET LIBRAW_DEMOS3_COMMIT=%LIBRAW_DEMOS3_COMMIT_LONG:~0,7%
IF NOT EXIST %TEMP_DIR%\LibRaw-%LIBRAW_COMMIT%.zip (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/LibRaw-%LIBRAW_COMMIT%.zip --no-check-certificate https://github.com/LibRaw/LibRaw/zipball/%LIBRAW_COMMIT_LONG%
)
IF NOT EXIST %TEMP_DIR%\LibRaw-demosaic-pack-GPL2-%LIBRAW_DEMOS2_COMMIT%.zip (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/LibRaw-demosaic-pack-GPL2-%LIBRAW_DEMOS2_COMMIT%.zip --no-check-certificate https://github.com/LibRaw/LibRaw-demosaic-pack-GPL2/zipball/%LIBRAW_DEMOS2_COMMIT_LONG%
)
IF NOT EXIST LibRaw-demosaic-pack-GPL2-%LIBRAW_DEMOS2_COMMIT% (
%CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/LibRaw-demosaic-pack-GPL2-%LIBRAW_DEMOS2_COMMIT%.zip
%CYGWIN_DIR%\bin\mv.exe LibRaw-LibRaw-* LibRaw-demosaic-pack-GPL2-%LIBRAW_DEMOS2_COMMIT%
)
IF NOT EXIST %TEMP_DIR%\LibRaw-demosaic-pack-GPL3-%LIBRAW_DEMOS3_COMMIT%.zip (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/LibRaw-demosaic-pack-GPL3-%LIBRAW_DEMOS3_COMMIT%.zip --no-check-certificate https://github.com/LibRaw/LibRaw-demosaic-pack-GPL3/zipball/%LIBRAW_DEMOS3_COMMIT_LONG%
)
IF NOT EXIST LibRaw-demosaic-pack-GPL3-%LIBRAW_DEMOS3_COMMIT% (
%CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/LibRaw-demosaic-pack-GPL3-%LIBRAW_DEMOS3_COMMIT%.zip
%CYGWIN_DIR%\bin\mv.exe LibRaw-LibRaw-* LibRaw-demosaic-pack-GPL3-%LIBRAW_DEMOS3_COMMIT%
)
IF NOT EXIST LibRaw-%LIBRAW_COMMIT% (
%CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/LibRaw-%LIBRAW_COMMIT%.zip
%CYGWIN_DIR%\bin\mv.exe LibRaw-LibRaw-* LibRaw-%LIBRAW_COMMIT%
pushd LibRaw-%LIBRAW_COMMIT%
rem /openmp
echo.COPT_OPT="/arch:SSE2"> qtpfsgui_commands.in
echo.CFLAGS_DP2=/I..\LibRaw-demosaic-pack-GPL2-%LIBRAW_DEMOS2_COMMIT%>> qtpfsgui_commands.in
echo.CFLAGSG2=/DLIBRAW_DEMOSAIC_PACK_GPL2>> qtpfsgui_commands.in
echo.CFLAGS_DP3=/I..\LibRaw-demosaic-pack-GPL3-%LIBRAW_DEMOS3_COMMIT%>> qtpfsgui_commands.in
echo.CFLAGSG3=/DLIBRAW_DEMOSAIC_PACK_GPL3>> qtpfsgui_commands.in
echo.LCMS_DEF="/DUSE_LCMS2 /DCMS_DLL /I..\lcms2-%LCMS_COMMIT%\include">> qtpfsgui_commands.in
echo.LCMS_LIB="..\lcms2-%LCMS_COMMIT%\bin\lcms2.lib">> qtpfsgui_commands.in
echo.JPEG_DEF="/DUSE_JPEG8 /DUSE_JPEG /I..\libjpeg-turbo-%LIBJPEG_COMMIT%">> qtpfsgui_commands.in
echo.JPEG_LIB="..\libjpeg-turbo-%LIBJPEG_COMMIT%.build\sharedlib\%Configuration%\jpeg.lib">> qtpfsgui_commands.in
nmake /f Makefile.msvc @qtpfsgui_commands.in clean > nul
nmake /f Makefile.msvc @qtpfsgui_commands.in bin\libraw.dll
popd
)
SET PTHREADS_CURRENT_DIR=pthreads_%PTHREADS_DIR%_%RawPlatform%
IF NOT EXIST %TEMP_DIR%\%PTHREADS_CURRENT_DIR% (
mkdir %TEMP_DIR%\%PTHREADS_CURRENT_DIR%
pushd %TEMP_DIR%\%PTHREADS_CURRENT_DIR%
%CYGWIN_DIR%\bin\wget.exe -O pthread.h --retry-connrefused --tries=5 ftp://sourceware.org/pub/pthreads-win32/%PTHREADS_DIR%/include/pthread.h
%CYGWIN_DIR%\bin\wget.exe -O sched.h --retry-connrefused --tries=5 ftp://sourceware.org/pub/pthreads-win32/%PTHREADS_DIR%/include/sched.h
%CYGWIN_DIR%\bin\wget.exe -O semaphore.h --retry-connrefused --tries=5 ftp://sourceware.org/pub/pthreads-win32/%PTHREADS_DIR%/include/semaphore.h
%CYGWIN_DIR%\bin\wget.exe -O pthreadVC2.dll --retry-connrefused --tries=5 ftp://sourceware.org/pub/pthreads-win32/%PTHREADS_DIR%/dll/%RawPlatform%/pthreadVC2.dll
%CYGWIN_DIR%\bin\wget.exe -O pthreadVC2.lib --retry-connrefused --tries=5 ftp://sourceware.org/pub/pthreads-win32/%PTHREADS_DIR%/lib/%RawPlatform%/pthreadVC2.lib
popd
)
IF NOT EXIST %PTHREADS_CURRENT_DIR% (
mkdir %PTHREADS_CURRENT_DIR%
robocopy %TEMP_DIR%\%PTHREADS_CURRENT_DIR% %PTHREADS_CURRENT_DIR% >nul
)
IF NOT EXIST %TEMP_DIR%\cfit%CFITSIO_VER%.zip (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/cfit%CFITSIO_VER%.zip ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfit%CFITSIO_VER%.zip
)
IF NOT EXIST cfit%CFITSIO_VER% (
%CYGWIN_DIR%\bin\unzip.exe -o -q -d cfit%CFITSIO_VER% %TEMP_DIR%/cfit%CFITSIO_VER%.zip
)
IF NOT EXIST cfit%CFITSIO_VER%.build (
mkdir cfit%CFITSIO_VER%.build
pushd cfit%CFITSIO_VER%.build
%CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" ..\cfit%CFITSIO_VER% -DUSE_PTHREADS=1 -DCMAKE_INCLUDE_PATH=..\%PTHREADS_CURRENT_DIR% -DCMAKE_LIBRARY_PATH=..\%PTHREADS_CURRENT_DIR%
IF errorlevel 1 goto error_end
%CMAKE_DIR%\bin\cmake.exe --build . --config %Configuration% --target cfitsio
IF errorlevel 1 goto error_end
popd
)
pushd cfit%CFITSIO_VER%
SET CFITSIO=%CD%
popd
pushd cfit%CFITSIO_VER%.build\%Configuration%
SET CFITSIO=%CFITSIO%;%CD%
popd
rem IF NOT EXIST %TEMP_DIR%\CCfits-2.4.tar (
rem %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/CCfits-2.4.tar.gz http://heasarc.gsfc.nasa.gov/docs/software/fitsio/CCfits/CCfits-2.4.tar.gz
rem %CYGWIN_DIR%\bin\gzip.exe -d %TEMP_DIR%/CCfits-2.4.tar.gz
rem %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/CCfits2.4patch.zip http://qtpfsgui.sourceforge.net/win/CCfits2.4patch.zip
rem )
rem IF NOT EXIST CCfits2.4 (
rem %CYGWIN_DIR%\bin\tar.exe -xf %TEMP_DIR%/CCfits-2.4.tar
rem ren CCfits CCfits2.4
rem %CYGWIN_DIR%\bin\unzip.exe -o -q -d CCfits2.4 %TEMP_DIR%/CCfits2.4patch.zip
rem )
rem IF NOT EXIST CCfits2.4.build (
rem mkdir CCfits2.4.build
rem
rem pushd CCfits2.4.build
rem %CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" ..\CCfits2.4 -DCMAKE_INCLUDE_PATH=..\cfit%CFITSIO_VER% -DCMAKE_LIBRARY_PATH=..\cfit%CFITSIO_VER%.build\%Configuration%
rem IF errorlevel 1 goto error_end
rem %CMAKE_DIR%\bin\cmake.exe --build . --config %Configuration% --target CCfits
rem IF errorlevel 1 goto error_end
rem popd
rem )
rem pushd CCfits2.4.build\%Configuration%
rem SET CCFITS_ROOT_DIR=%CD%
rem popd
IF NOT EXIST %TEMP_DIR%\gsl-1.15.tar (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/gsl-1.15.tar.gz ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz
%CYGWIN_DIR%\bin\gzip -d %TEMP_DIR%/gsl-1.15.tar.gz
)
IF NOT EXIST %TEMP_DIR%\gsl-1.15-vc10.zip (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/gsl-1.15-vc10.zip http://gladman.plushost.co.uk/oldsite/computing/gsl-1.15-vc10.zip
)
IF NOT EXIST gsl-1.15 (
%CYGWIN_DIR%\bin\tar.exe -xf %TEMP_DIR%/gsl-1.15.tar
%CYGWIN_DIR%\bin\unzip.exe -o -q -d gsl-1.15 %TEMP_DIR%/gsl-1.15-vc10.zip
pushd gsl-1.15\build.vc10
IF %VS_SHORT% EQU vc9 (
%CYGWIN_DIR%\bin\sed.exe -i 's/Format Version 11.00/Format Version 10.00/g' gsl.lib.sln
)
%VSCOMMAND% gsl.lib.sln /Upgrade
%VSCOMMAND% gsl.lib.sln /build "%Configuration%|%Platform%" /Project gslhdrs
gslhdrs\%Platform%\%Configuration%\gslhdrs.exe
%VSCOMMAND% gsl.lib.sln /build "%Configuration%|%Platform%" /Project gsllib
popd
)
SET OPENEXR_COMMIT=%OPENEXR_COMMIT_LONG:~0,7%
IF NOT EXIST %TEMP_DIR%\OpenEXR-dk-%OPENEXR_COMMIT%.zip (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/OpenEXR-dk-%OPENEXR_COMMIT%.zip --no-check-certificate https://github.com/openexr/openexr/zipball/%OPENEXR_COMMIT_LONG%
)
IF NOT EXIST OpenEXR-dk-%OPENEXR_COMMIT% (
%CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/OpenEXR-dk-%OPENEXR_COMMIT%.zip
%CYGWIN_DIR%\bin\mv.exe openexr-openexr-* OpenEXR-dk-%OPENEXR_COMMIT%
)
IF NOT EXIST OpenEXR-dk-%OPENEXR_COMMIT%\IlmBase.build (
mkdir OpenEXR-dk-%OPENEXR_COMMIT%\IlmBase.build
pushd OpenEXR-dk-%OPENEXR_COMMIT%\IlmBase.build
%CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" -DCMAKE_BUILD_TYPE=%Configuration% -DCMAKE_INSTALL_PREFIX=..\output -DZLIB_ROOT=..\..\zlib-%ZLIB_COMMIT%;..\..\zlib-%ZLIB_COMMIT%\%Configuration% -DBUILD_SHARED_LIBS=OFF ../IlmBase
IF errorlevel 1 goto error_end
%VSCOMMAND% IlmBase.sln /build "%Configuration%|%Platform%"
IF errorlevel 1 goto error_end
%VSCOMMAND% IlmBase.sln /build "%Configuration%|%Platform%" /Project INSTALL
IF errorlevel 1 goto error_end
popd
)
IF NOT EXIST OpenEXR-dk-%OPENEXR_COMMIT%\OpenEXR.build (
mkdir OpenEXR-dk-%OPENEXR_COMMIT%\OpenEXR.build
pushd OpenEXR-dk-%OPENEXR_COMMIT%\OpenEXR.build
%CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" -DCMAKE_BUILD_TYPE=%Configuration% ^
-DZLIB_ROOT=..\..\zlib-%ZLIB_COMMIT%;..\..\zlib-%ZLIB_COMMIT%\%Configuration% ^
-DILMBASE_PACKAGE_PREFIX=%CD%\OpenEXR-dk-%OPENEXR_COMMIT%\output -DBUILD_SHARED_LIBS=OFF ^
-DCMAKE_INSTALL_PREFIX=..\output ^
../OpenEXR
IF errorlevel 1 goto error_end
%VSCOMMAND% OpenEXR.sln /build "%Configuration%|%Platform%" /Project IlmImf
IF errorlevel 1 goto error_end
%VSCOMMAND% OpenEXR.sln /build "%Configuration%|%Platform%" /Project INSTALL
IF errorlevel 1 goto error_end
popd
)
IF %Platform% EQU Win32 (
IF NOT EXIST %TEMP_DIR%\fftw-%FFTW_VER%-dll32.zip (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/fftw-%FFTW_VER%-dll32.zip ftp://ftp.fftw.org/pub/fftw/fftw-%FFTW_VER%-dll32.zip
)
) ELSE (
IF NOT EXIST %TEMP_DIR%\fftw-%FFTW_VER%-dll64.zip (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/fftw-%FFTW_VER%-dll64.zip ftp://ftp.fftw.org/pub/fftw/fftw-%FFTW_VER%-dll64.zip
)
)
IF NOT EXIST fftw-%FFTW_VER%-dll (
IF %Platform% EQU Win32 (
%CYGWIN_DIR%\bin\unzip.exe -q -d fftw-%FFTW_VER%-dll %TEMP_DIR%/fftw-%FFTW_VER%-dll32.zip
) ELSE (
%CYGWIN_DIR%\bin\unzip.exe -q -d fftw-%FFTW_VER%-dll %TEMP_DIR%/fftw-%FFTW_VER%-dll64.zip
)
pushd fftw-%FFTW_VER%-dll
lib /def:libfftw3-3.def
lib /def:libfftw3f-3.def
lib /def:libfftw3l-3.def
popd
)
REM IF NOT EXIST %TEMP_DIR%\tbb40_20120613oss_win.zip (
REM %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/tbb40_20120613oss_win.zip "http://threadingbuildingblocks.org/uploads/77/187/4.0 update 5/tbb40_20120613oss_win.zip"
REM )
REM
REM IF NOT EXIST tbb40_20120613oss (
REM %CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/tbb40_20120613oss_win.zip
REM REM Everthing is already compiled, nothing to do!
REM )
REM IF NOT EXIST %TEMP_DIR%\gtest-1.6.0.zip (
SET GTEST_DIR=gtest-r680
IF NOT EXIST %GTEST_DIR% (
REM %CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/gtest-1.6.0.zip http://googletest.googlecode.com/files/gtest-1.6.0.zip
%CYGWIN_DIR%\bin\svn.exe co -r 680 http://googletest.googlecode.com/svn/trunk/ %GTEST_DIR%
pushd %GTEST_DIR%
%CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" . -DBUILD_SHARED_LIBS=1
%VSCOMMAND% gtest.sln /build "%Configuration%|%Platform%"
REN Release lib
popd
)
SET GTEST_ROOT=%CD%\%GTEST_DIR%
REM IF NOT EXIST %GTEST_DIR%.build (
REM mkdir %GTEST_DIR%.build
REM pushd %GTEST_DIR%.build
REM %CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" ..\%GTEST_DIR% -DBUILD_SHARED_LIBS=1
REM %VSCOMMAND% gtest.sln /build "%Configuration%|%Platform%"
REM popd
REM )
REM IF NOT EXIST gtest-1.6.0 (
REM %CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/gtest-1.6.0.zip
REM )
IF NOT DEFINED L_BOOST_DIR (
set L_BOOST_DIR=.
)
IF NOT EXIST %TEMP_DIR%\boost_1_%BOOST_MINOR%_0.zip (
%CYGWIN_DIR%\bin\wget.exe -O %TEMP_DIR%/boost_1_%BOOST_MINOR%_0.zip http://sourceforge.net/projects/boost/files/boost/1.%BOOST_MINOR%.0/boost_1_%BOOST_MINOR%_0.zip/download
)
IF NOT EXIST %L_BOOST_DIR%\boost_1_%BOOST_MINOR%_0 (
echo.Extracting boost. Be patient!
pushd %L_BOOST_DIR%
%CYGWIN_DIR%\bin\unzip.exe -q %TEMP_DIR%/boost_1_%BOOST_MINOR%_0.zip
popd
pushd %L_BOOST_DIR%\boost_1_%BOOST_MINOR%_0
bootstrap.bat
popd
pushd %L_BOOST_DIR%\boost_1_%BOOST_MINOR%_0
IF %Platform% EQU Win32 (
IF %Configuration% EQU Release (
cmd.exe /C b2.exe toolset=msvc variant=release
) ELSE (
cmd.exe /C b2.exe toolset=msvc variant=debug
)
) ELSE (
IF %Configuration% EQU Release (
cmd.exe /C b2.exe toolset=msvc variant=release address-model=64
) ELSE (
cmd.exe /C b2.exe toolset=msvc variant=debug address-model=64
)
)
popd
)
REM Set Boost-directory as ENV variable (needed for CMake)
pushd %L_BOOST_DIR%\boost_1_%BOOST_MINOR%_0
rem SET Boost_DIR=%CD%
REM SET BOOST_ROOT=%CD%
popd
IF NOT EXIST LuminanceHdrStuff (
mkdir LuminanceHdrStuff
)
IF NOT EXIST LuminanceHdrStuff\qtpfsgui (
pushd LuminanceHdrStuff
%CYGWIN_DIR%\bin\git.exe clone git://git.code.sf.net/p/qtpfsgui/code qtpfsgui
popd
) ELSE (
pushd LuminanceHdrStuff\qtpfsgui
IF %UPDATE_REPO_LUMINANCE% EQU 1 (
%CYGWIN_DIR%\bin\git.exe pull
)
popd
)
IF NOT EXIST LuminanceHdrStuff\DEPs (
pushd LuminanceHdrStuff
mkdir DEPs
cd DEPs
mkdir include
mkdir lib
mkdir bin
popd
for %%v in ("libpng", "libjpeg", "lcms2", "exiv2", "libtiff", "libraw", "fftw3", "gsl", "CCfits") do (
mkdir LuminanceHdrStuff\DEPs\include\%%v
mkdir LuminanceHdrStuff\DEPs\lib\%%v
mkdir LuminanceHdrStuff\DEPs\bin\%%v
)
mkdir LuminanceHdrStuff\DEPs\include\libraw\libraw
mkdir LuminanceHdrStuff\DEPs\include\gsl\gsl
copy gsl-1.15\gsl\*.h LuminanceHdrStuff\DEPs\include\gsl\gsl
copy gsl-1.15\build.vc10\lib\%Platform%\%Configuration%\*.lib LuminanceHdrStuff\DEPs\lib\gsl
rem copy gsl-1.15\build.vc10\dll\*.dll LuminanceHdrStuff\DEPs\bin\gsl
)
robocopy fftw-%FFTW_VER%-dll LuminanceHdrStuff\DEPs\include\fftw3 *.h /MIR >nul
robocopy fftw-%FFTW_VER%-dll LuminanceHdrStuff\DEPs\lib\fftw3 *.lib /MIR /NJS >nul
robocopy fftw-%FFTW_VER%-dll LuminanceHdrStuff\DEPs\bin\fftw3 *.dll /MIR /NJS >nul
robocopy tiff-4.0.3\libtiff LuminanceHdrStuff\DEPs\include\libtiff *.h /MIR >nul
robocopy tiff-4.0.3\libtiff LuminanceHdrStuff\DEPs\lib\libtiff *.lib /MIR /NJS >nul
robocopy tiff-4.0.3\libtiff LuminanceHdrStuff\DEPs\bin\libtiff *.dll /MIR /NJS >nul
rem robocopy expat: included indirectly in in exiv2
rem robocopy zlib: included indirectly in in exiv2
robocopy exiv2-%EXIV2_COMMIT%\include LuminanceHdrStuff\DEPs\include\exiv2 *.h *.hpp /MIR >nul
robocopy exiv2-%EXIV2_COMMIT%\bin\%Platform%\Dynamic\%Configuration% LuminanceHdrStuff\DEPs\lib\exiv2 *.lib /MIR >nul
robocopy exiv2-%EXIV2_COMMIT%\bin\%Platform%\Dynamic\%Configuration% LuminanceHdrStuff\DEPs\bin\exiv2 *.dll /MIR >nul
robocopy lp170b35 LuminanceHdrStuff\DEPs\include\libpng *.h /MIR >nul
robocopy lp170b35\%Configuration% LuminanceHdrStuff\DEPs\lib\libpng *.lib /MIR >nul
robocopy lp170b35\%Configuration% LuminanceHdrStuff\DEPs\bin\libpng *.dll /MIR >nul
robocopy LibRaw-%LIBRAW_COMMIT%\libraw LuminanceHdrStuff\DEPs\include\libraw\libraw /MIR >nul
robocopy LibRaw-%LIBRAW_COMMIT%\lib LuminanceHdrStuff\DEPs\lib\libraw *.lib /MIR >nul
robocopy LibRaw-%LIBRAW_COMMIT%\bin LuminanceHdrStuff\DEPs\bin\libraw *.dll /MIR >nul
robocopy lcms2-%LCMS_COMMIT%\include LuminanceHdrStuff\DEPs\include\lcms2 *.h /MIR >nul
robocopy lcms2-%LCMS_COMMIT%\bin LuminanceHdrStuff\DEPs\lib\lcms2 *.lib /MIR /NJS >nul
rem robocopy lcms2-%LCMS_COMMIT%\bin LuminanceHdrStuff\DEPs\bin\lcms2 *.dll /MIR /NJS >nul
robocopy libjpeg-turbo-%LIBJPEG_COMMIT% LuminanceHdrStuff\DEPs\include\libjpeg *.h /MIR >nul
robocopy libjpeg-turbo-%LIBJPEG_COMMIT%.build\sharedlib\%Configuration% LuminanceHdrStuff\DEPs\lib\libjpeg *.lib /MIR /NJS >nul
robocopy libjpeg-turbo-%LIBJPEG_COMMIT%.build\sharedlib\%Configuration% LuminanceHdrStuff\DEPs\bin\libjpeg *.dll /MIR /NJS >nul
REM robocopy tbb40_20120613oss\include LuminanceHdrStuff\DEPs\include\tbb /MIR >nul
REM robocopy tbb40_20120613oss\lib\%CpuPlatform%\%VS_SHORT% LuminanceHdrStuff\DEPs\lib\tbb /MIR >nul
REM robocopy tbb40_20120613oss\bin\%CpuPlatform%\%VS_SHORT% LuminanceHdrStuff\DEPs\bin\tbb /MIR >nul
robocopy CCfits2.4 LuminanceHdrStuff\DEPs\include\CCfits *.h CCfits /MIR >nul
pushd LuminanceHdrStuff\DEPs\include
SET CCFITS_ROOT_DIR=%CCFITS_ROOT_DIR%;%CD%
popd
IF NOT EXIST LuminanceHdrStuff\qtpfsgui.build (
mkdir LuminanceHdrStuff\qtpfsgui.build
)
pushd LuminanceHdrStuff\qtpfsgui.build
IF %OPTION_LUMINANCE_UPDATE_TRANSLATIONS% EQU 1 (
set CMAKE_OPTIONS=-DUPDATE_TRANSLATIONS=1
) ELSE (
set CMAKE_OPTIONS=-UUPDATE_TRANSLATIONS
)
IF %OPTION_LUPDATE_NOOBSOLETE% EQU 1 (
set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DLUPDATE_NOOBSOLETE=1
) ELSE (
set CMAKE_OPTIONS=%CMAKE_OPTIONS% -ULUPDATE_NOOBSOLETE
)
set L_CMAKE_INCLUDE=..\DEPs\include\libtiff;..\DEPs\include\libpng;..\..\zlib-%ZLIB_COMMIT%;..\..\boost_1_%BOOST_MINOR%_0;..\..\OpenEXR-dk-%OPENEXR_COMMIT%\output\include
set L_CMAKE_LIB=..\DEPs\lib\libtiff;..\DEPs\lib\libpng;..\..\zlib-%ZLIB_COMMIT%\%Configuration%;..\..\boost_1_%BOOST_MINOR%_0\stage\lib;..\..\OpenEXR-dk-%OPENEXR_COMMIT%\output\lib
set L_CMAKE_PROGRAM_PATH=%CYGWIN_DIR%\bin
set L_CMAKE_PREFIX_PATH=%QTDIR%
set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DPC_EXIV2_INCLUDEDIR=..\DEPs\include\exiv2 -DPC_EXIV2_LIBDIR=..\DEPs\lib\exiv2 -DCMAKE_INCLUDE_PATH=%L_CMAKE_INCLUDE% -DCMAKE_LIBRARY_PATH=%L_CMAKE_LIB% -DCMAKE_PROGRAM_PATH=%L_CMAKE_PROGRAM_PATH% -DCMAKE_PREFIX_PATH=%L_CMAKE_PREFIX_PATH% -DPNG_NAMES=libpng16;libpng17 -DOPENEXR_VERSION=%OPENEXR_CMAKE_VERSION%
REM IF EXIST ..\..\gtest-1.6.0 (
REM SET GTEST_ROOT=%CD%\..\..\gtest-1.6.0
REM )
echo CMake command line options ------------------------------------
echo %CMAKE_OPTIONS%
echo ---------------------------------------------------------------
%CMAKE_DIR%\bin\cmake.exe -G "%VS_CMAKE%" ..\qtpfsgui %CMAKE_OPTIONS%
IF errorlevel 1 goto error_end
popd
IF EXIST LuminanceHdrStuff\qtpfsgui.build\Luminance HDR.sln (
pushd LuminanceHdrStuff\qtpfsgui.build
rem %VSCOMMAND% luminance-hdr.sln /Upgrade
%VSCOMMAND% "Luminance HDR.sln" /build "%ConfigurationLuminance%|%Platform%" /Project luminance-hdr
IF errorlevel 1 goto error_end
popd
)
IF EXIST LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance%\luminance-hdr.exe (
IF EXIST LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance% (
robocopy LuminanceHdrStuff\qtpfsgui LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance% LICENSE >nul
IF NOT EXIST LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance%\align_image_stack.exe (
copy vcDlls\selected\* LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance%\
)
pushd LuminanceHdrStuff\DEPs\bin
robocopy libjpeg ..\..\qtpfsgui.build\%ConfigurationLuminance% jpeg8.dll >nul
robocopy exiv2 ..\..\qtpfsgui.build\%ConfigurationLuminance% exiv2.dll >nul
robocopy exiv2 ..\..\qtpfsgui.build\%ConfigurationLuminance% zlib.dll >nul
robocopy exiv2 ..\..\qtpfsgui.build\%ConfigurationLuminance% expat.dll >nul
robocopy libraw ..\..\qtpfsgui.build\%ConfigurationLuminance% libraw.dll >nul
robocopy fftw3 ..\..\qtpfsgui.build\%ConfigurationLuminance% libfftw3f-3.dll >nul
robocopy libpng ..\..\qtpfsgui.build\%ConfigurationLuminance% libpng17.dll >nul
popd
robocopy cfit%CFITSIO_VER%.build\%Configuration% LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance% cfitsio.dll >nul
robocopy %PTHREADS_CURRENT_DIR% LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance% pthreadVC2.dll >nul
robocopy lcms2-%LCMS_COMMIT%\bin LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance% lcms2.dll >nul
IF NOT EXIST LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance%\i18n\ (
mkdir LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance%\i18n
)
IF NOT EXIST LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance%\help\ (
mkdir LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance%\help
)
robocopy LuminanceHdrStuff\qtpfsgui.build LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance%\i18n lang_*.qm >nul
robocopy LuminanceHdrStuff\qtpfsgui\help LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance%\help /MIR >nul
REM ----- QT Stuff (Dlls, translations) --------------------------------------------
pushd LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance%
for %%v in ( "Qt5Concurrent.dll", "Qt5Core.dll", "Qt5Gui.dll", "Qt5Multimedia.dll", "Qt5MultimediaWidgets.dll", "Qt5Network.dll", "Qt5Positioning.dll", "Qt5WinExtras.dll", "Qt5OpenGL.dll", "Qt5PrintSupport.dll", "Qt5Qml.dll", "Qt5Quick.dll", "Qt5Sensors.dll", "Qt5Sql.dll", "Qt5V8.dll", "Qt5WebKit.dll", "Qt5WebKitWidgets.dll", "Qt5Widgets.dll", "Qt5Xml.dll", "icudt51.dll", "icuin51.dll", "icuuc51.dll" ) do (
robocopy %QTDIR%\bin . %%v >nul
)
for %%v in ("imageformats", "sqldrivers", "platforms") do (
IF NOT EXIST %%v (
mkdir %%v
)
)
robocopy %QTDIR%\plugins\imageformats imageformats qjpeg.dll >nul
robocopy %QTDIR%\plugins\sqldrivers sqldrivers qsqlite.dll >nul
robocopy %QTDIR%\plugins\platforms platforms qwindows.dll >nul
robocopy %QTDIR%\translations i18n qt_??.qm >nul
robocopy %QTDIR%\translations i18n qt_??_*.qm >nul
popd
robocopy hugin-%HUGIN_VER%-%RawPlatform% LuminanceHdrStuff\qtpfsgui.build\%ConfigurationLuminance%\hugin /MIR >nul
)
)
goto end
:error_end
pause
:end
endlocal | stoneyang/LuminanceHDR | build/msvc/build.cmd | Batchfile | gpl-2.0 | 30,612 | [
30522,
1030,
9052,
2125,
2275,
4135,
9289,
2128,
2213,
8299,
1024,
1013,
1013,
16475,
1012,
4654,
12848,
2475,
1012,
8917,
1013,
3934,
1013,
4654,
12848,
2475,
1013,
22409,
1013,
2275,
4654,
12848,
2475,
1035,
10797,
1027,
27954,
2549,
2128... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Polemonium confertum var. mellitum A.Gray VARIETY
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Ericales/Polemoniaceae/Polemonium/Polemonium confertum/Polemonium confertum mellitum/README.md | Markdown | apache-2.0 | 191 | [
30522,
1001,
6536,
26387,
9530,
7512,
11667,
13075,
1012,
11463,
15909,
2819,
1037,
1012,
3897,
3528,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
2248,
3269,
3415,
5950,
1001,
1001,
1001,
1001,
2405,
1999,
19701,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace XF_Map.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
}
}
| ytabuchi/Study | XF_Map/XF_Map/XF_Map.iOS/AppDelegate.cs | C# | mit | 1,099 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
3192,
1025,
2478,
21318,
23615,
1025,
3415,
15327,
1060,
2546,
1035,
4949,
1012,
16380,
1063,
1013,
1013,
1996,
21318,
29098,
193... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict';
describe('test search controller', function() {
beforeEach(module('mapTweetInfoApp'));
beforeEach(module('twitterSearchServices'));
beforeEach(module('latLngServices'));
describe('searchCtrl', function(){
var scope, ctrl, $httpBackend, $browser, $location;
beforeEach(inject(function(_$httpBackend_, $rootScope, $controller) {
// $httpBackend = _$httpBackend_;
// $httpBackend.expectGET('phones/phones.json').
// respond([{name: 'Nexus S'}, {name: 'Motorola DROID'}]);
scope = $rootScope.$new();
$location = scope.$service('$location');
$browser = scope.$service('$browser');
ctrl = $controller('searchCtrl', {$scope: scope});
}));
it('should have default variables set', function() {
// expect(scope.phones).toEqualData([]);
// $httpBackend.flush();
expect(scope.counts).toEqualData(
[{label: '25 Tweets', value: '25'},{label: '50 Tweets', value: '50'},{label: '75 Tweets', value: '75'},{label: '150 Tweets', value: '150'}]
);
});
// it('should set the default value of orderProp model', function() {
// expect(scope.orderProp).toBe('age');
// });
});
}); | hartzis/MapTweet.Info | test/app/unit/controllers/searchControllerSpec.js | JavaScript | mit | 1,204 | [
30522,
1005,
2224,
9384,
1005,
1025,
6235,
1006,
1005,
3231,
3945,
11486,
1005,
1010,
3853,
1006,
1007,
1063,
2077,
5243,
2818,
1006,
11336,
1006,
1005,
4949,
2102,
28394,
7629,
14876,
29098,
1005,
1007,
1007,
1025,
2077,
5243,
2818,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
.favorites-container{
margin-top: 16px;
min-height: 350px;
padding-bottom: 30px;
font-family: Helvetica, Verdana;
border-radius: 2px;
background: rgba(255,255,255,0.8);
border: solid 2px rgba(255,255,255,0.3);
-webkit-box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
-moz-box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
}
.favorites-container p {
color: #50737a;
margin-left: 40px;
margin-top: 20px;
}
.cat-small.favorite{
display: inline-block;
margin-left: 10px;
margin-top: 10px;
}
.cat-small.favorite .image img {
}
a.credit {
display:block;
font-size: 11px;
font-family: Arial,Helvetica,sans-serif;
color: #999;
position: absolute;
bottom: 6px;
right: 7px;
}
a.credit:hover{
color: #fff;
} | mdimitrov/oldcrafts | css/favorites.css | CSS | mit | 808 | [
30522,
1012,
20672,
1011,
11661,
1063,
7785,
1011,
2327,
1024,
2385,
2361,
2595,
1025,
8117,
1011,
4578,
1024,
8698,
2361,
2595,
1025,
11687,
4667,
1011,
3953,
1024,
2382,
2361,
2595,
1025,
15489,
1011,
2155,
1024,
2002,
2140,
19510,
5555,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Target-dependent code for GNU/Linux, architecture independent.
Copyright (C) 2009-2015 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef LINUX_TDEP_H
#define LINUX_TDEP_H
#include "bfd.h"
struct regcache;
typedef char *(*linux_collect_thread_registers_ftype) (const struct regcache *,
ptid_t,
bfd *, char *, int *,
enum gdb_signal);
struct type *linux_get_siginfo_type (struct gdbarch *);
extern enum gdb_signal linux_gdb_signal_from_target (struct gdbarch *gdbarch,
int signal);
extern int linux_gdb_signal_to_target (struct gdbarch *gdbarch,
enum gdb_signal signal);
/* Default GNU/Linux implementation of `displaced_step_location', as
defined in gdbarch.h. Determines the entry point from AT_ENTRY in
the target auxiliary vector. */
extern CORE_ADDR linux_displaced_step_location (struct gdbarch *gdbarch);
extern void linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
extern int linux_is_uclinux (void);
#endif /* linux-tdep.h */
| npe9/binutils-gdb | gdb/linux-tdep.h | C | gpl-2.0 | 1,705 | [
30522,
1013,
1008,
4539,
1011,
7790,
3642,
2005,
27004,
1013,
11603,
1010,
4294,
2981,
1012,
9385,
1006,
1039,
1007,
2268,
1011,
2325,
2489,
4007,
3192,
1010,
4297,
1012,
2023,
5371,
2003,
2112,
1997,
1043,
18939,
1012,
2023,
2565,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_22) on Sun Aug 26 15:15:28 EDT 2012 -->
<TITLE>
FadeOutTransition (Slick Util - LWJGL Utilities extracted from Slick)
</TITLE>
<META NAME="date" CONTENT="2012-08-26">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="FadeOutTransition (Slick Util - LWJGL Utilities extracted from Slick)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/FadeOutTransition.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../org/newdawn/slick/state/transition/FadeInTransition.html" title="class in org.newdawn.slick.state.transition"><B>PREV CLASS</B></A>
<A HREF="../../../../../org/newdawn/slick/state/transition/HorizontalSplitTransition.html" title="class in org.newdawn.slick.state.transition"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/newdawn/slick/state/transition/FadeOutTransition.html" target="_top"><B>FRAMES</B></A>
<A HREF="FadeOutTransition.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.newdawn.slick.state.transition</FONT>
<BR>
Class FadeOutTransition</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>org.newdawn.slick.state.transition.FadeOutTransition</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html" title="interface in org.newdawn.slick.state.transition">Transition</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>FadeOutTransition</B><DT>extends java.lang.Object<DT>implements <A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html" title="interface in org.newdawn.slick.state.transition">Transition</A></DL>
</PRE>
<P>
A transition to fade out to a given colour
<P>
<P>
<DL>
<DT><B>Author:</B></DT>
<DD>kevin</DD>
</DL>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/newdawn/slick/state/transition/FadeOutTransition.html#FadeOutTransition()">FadeOutTransition</A></B>()</CODE>
<BR>
Create a new fade out transition</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/newdawn/slick/state/transition/FadeOutTransition.html#FadeOutTransition(org.newdawn.slick.Color)">FadeOutTransition</A></B>(<A HREF="../../../../../org/newdawn/slick/Color.html" title="class in org.newdawn.slick">Color</A> color)</CODE>
<BR>
Create a new fade out transition</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/newdawn/slick/state/transition/FadeOutTransition.html#FadeOutTransition(org.newdawn.slick.Color, int)">FadeOutTransition</A></B>(<A HREF="../../../../../org/newdawn/slick/Color.html" title="class in org.newdawn.slick">Color</A> color,
int fadeTime)</CODE>
<BR>
Create a new fade out transition</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/newdawn/slick/state/transition/FadeOutTransition.html#init(org.newdawn.slick.state.GameState, org.newdawn.slick.state.GameState)">init</A></B>(<A HREF="../../../../../org/newdawn/slick/state/GameState.html" title="interface in org.newdawn.slick.state">GameState</A> firstState,
<A HREF="../../../../../org/newdawn/slick/state/GameState.html" title="interface in org.newdawn.slick.state">GameState</A> secondState)</CODE>
<BR>
Initialise the transition</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/newdawn/slick/state/transition/FadeOutTransition.html#isComplete()">isComplete</A></B>()</CODE>
<BR>
Check if this transtion has been completed</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/newdawn/slick/state/transition/FadeOutTransition.html#postRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)">postRender</A></B>(<A HREF="../../../../../org/newdawn/slick/state/StateBasedGame.html" title="class in org.newdawn.slick.state">StateBasedGame</A> game,
<A HREF="../../../../../org/newdawn/slick/GameContainer.html" title="class in org.newdawn.slick">GameContainer</A> container,
<A HREF="../../../../../org/newdawn/slick/Graphics.html" title="class in org.newdawn.slick">Graphics</A> g)</CODE>
<BR>
Render the transition over the existing state rendering</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/newdawn/slick/state/transition/FadeOutTransition.html#preRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)">preRender</A></B>(<A HREF="../../../../../org/newdawn/slick/state/StateBasedGame.html" title="class in org.newdawn.slick.state">StateBasedGame</A> game,
<A HREF="../../../../../org/newdawn/slick/GameContainer.html" title="class in org.newdawn.slick">GameContainer</A> container,
<A HREF="../../../../../org/newdawn/slick/Graphics.html" title="class in org.newdawn.slick">Graphics</A> g)</CODE>
<BR>
Render the transition before the existing state rendering</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/newdawn/slick/state/transition/FadeOutTransition.html#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)">update</A></B>(<A HREF="../../../../../org/newdawn/slick/state/StateBasedGame.html" title="class in org.newdawn.slick.state">StateBasedGame</A> game,
<A HREF="../../../../../org/newdawn/slick/GameContainer.html" title="class in org.newdawn.slick">GameContainer</A> container,
int delta)</CODE>
<BR>
Update the transition.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="FadeOutTransition()"><!-- --></A><H3>
FadeOutTransition</H3>
<PRE>
public <B>FadeOutTransition</B>()</PRE>
<DL>
<DD>Create a new fade out transition
<P>
</DL>
<HR>
<A NAME="FadeOutTransition(org.newdawn.slick.Color)"><!-- --></A><H3>
FadeOutTransition</H3>
<PRE>
public <B>FadeOutTransition</B>(<A HREF="../../../../../org/newdawn/slick/Color.html" title="class in org.newdawn.slick">Color</A> color)</PRE>
<DL>
<DD>Create a new fade out transition
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>color</CODE> - The color we're going to fade out to</DL>
</DL>
<HR>
<A NAME="FadeOutTransition(org.newdawn.slick.Color, int)"><!-- --></A><H3>
FadeOutTransition</H3>
<PRE>
public <B>FadeOutTransition</B>(<A HREF="../../../../../org/newdawn/slick/Color.html" title="class in org.newdawn.slick">Color</A> color,
int fadeTime)</PRE>
<DL>
<DD>Create a new fade out transition
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>color</CODE> - The color we're going to fade out to<DD><CODE>fadeTime</CODE> - The time it takes the fade to occur</DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="isComplete()"><!-- --></A><H3>
isComplete</H3>
<PRE>
public boolean <B>isComplete</B>()</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html#isComplete()">Transition</A></CODE></B></DD>
<DD>Check if this transtion has been completed
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html#isComplete()">isComplete</A></CODE> in interface <CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html" title="interface in org.newdawn.slick.state.transition">Transition</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>True if the transition has been completed<DT><B>See Also:</B><DD><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html#isComplete()"><CODE>Transition.isComplete()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="postRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)"><!-- --></A><H3>
postRender</H3>
<PRE>
public void <B>postRender</B>(<A HREF="../../../../../org/newdawn/slick/state/StateBasedGame.html" title="class in org.newdawn.slick.state">StateBasedGame</A> game,
<A HREF="../../../../../org/newdawn/slick/GameContainer.html" title="class in org.newdawn.slick">GameContainer</A> container,
<A HREF="../../../../../org/newdawn/slick/Graphics.html" title="class in org.newdawn.slick">Graphics</A> g)</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html#postRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)">Transition</A></CODE></B></DD>
<DD>Render the transition over the existing state rendering
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html#postRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)">postRender</A></CODE> in interface <CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html" title="interface in org.newdawn.slick.state.transition">Transition</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>game</CODE> - The game this transition is being rendered as part of<DD><CODE>container</CODE> - The container holding the game<DD><CODE>g</CODE> - The graphics context to use when rendering the transiton<DT><B>See Also:</B><DD><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html#postRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)"><CODE>Transition.postRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)"><!-- --></A><H3>
update</H3>
<PRE>
public void <B>update</B>(<A HREF="../../../../../org/newdawn/slick/state/StateBasedGame.html" title="class in org.newdawn.slick.state">StateBasedGame</A> game,
<A HREF="../../../../../org/newdawn/slick/GameContainer.html" title="class in org.newdawn.slick">GameContainer</A> container,
int delta)</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)">Transition</A></CODE></B></DD>
<DD>Update the transition. Cause what ever happens in the transition to happen
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)">update</A></CODE> in interface <CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html" title="interface in org.newdawn.slick.state.transition">Transition</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>game</CODE> - The game this transition is being rendered as part of<DD><CODE>container</CODE> - The container holding the game<DD><CODE>delta</CODE> - The amount of time passed since last update<DT><B>See Also:</B><DD><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)"><CODE>Transition.update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="preRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)"><!-- --></A><H3>
preRender</H3>
<PRE>
public void <B>preRender</B>(<A HREF="../../../../../org/newdawn/slick/state/StateBasedGame.html" title="class in org.newdawn.slick.state">StateBasedGame</A> game,
<A HREF="../../../../../org/newdawn/slick/GameContainer.html" title="class in org.newdawn.slick">GameContainer</A> container,
<A HREF="../../../../../org/newdawn/slick/Graphics.html" title="class in org.newdawn.slick">Graphics</A> g)</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html#preRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)">Transition</A></CODE></B></DD>
<DD>Render the transition before the existing state rendering
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html#preRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)">preRender</A></CODE> in interface <CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html" title="interface in org.newdawn.slick.state.transition">Transition</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>game</CODE> - The game this transition is being rendered as part of<DD><CODE>container</CODE> - The container holding the game<DD><CODE>g</CODE> - The graphics context to use when rendering the transiton<DT><B>See Also:</B><DD><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html#preRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)"><CODE>Transition.preRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="init(org.newdawn.slick.state.GameState, org.newdawn.slick.state.GameState)"><!-- --></A><H3>
init</H3>
<PRE>
public void <B>init</B>(<A HREF="../../../../../org/newdawn/slick/state/GameState.html" title="interface in org.newdawn.slick.state">GameState</A> firstState,
<A HREF="../../../../../org/newdawn/slick/state/GameState.html" title="interface in org.newdawn.slick.state">GameState</A> secondState)</PRE>
<DL>
<DD><B>Description copied from interface: <CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html#init(org.newdawn.slick.state.GameState, org.newdawn.slick.state.GameState)">Transition</A></CODE></B></DD>
<DD>Initialise the transition
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html#init(org.newdawn.slick.state.GameState, org.newdawn.slick.state.GameState)">init</A></CODE> in interface <CODE><A HREF="../../../../../org/newdawn/slick/state/transition/Transition.html" title="interface in org.newdawn.slick.state.transition">Transition</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>firstState</CODE> - The first state we're rendering (this will be rendered by the framework)<DD><CODE>secondState</CODE> - The second stat we're transitioning to or from (this one won't be rendered)</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/FadeOutTransition.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../org/newdawn/slick/state/transition/FadeInTransition.html" title="class in org.newdawn.slick.state.transition"><B>PREV CLASS</B></A>
<A HREF="../../../../../org/newdawn/slick/state/transition/HorizontalSplitTransition.html" title="class in org.newdawn.slick.state.transition"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/newdawn/slick/state/transition/FadeOutTransition.html" target="_top"><B>FRAMES</B></A>
<A HREF="FadeOutTransition.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<i>Copyright © 2006 New Dawn Software. All Rights Reserved.</i>
</BODY>
</HTML>
| SenshiSentou/SourceFight | slick_dev/trunk/Slick/javadoc-util/org/newdawn/slick/state/transition/FadeOutTransition.html | HTML | bsd-2-clause | 23,875 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#
# Cookbook Name:: osmosis
# Recipe:: install
#
ark 'osmosis' do
url node[:osmosis][:url]
version node[:osmosis][:version]
owner node[:osmosis][:user]
prefix_root node[:osmosis][:installdir]
has_binaries ['bin/osmosis']
strip_components 0
only_if { node[:osmosis][:install_type] == 'tgz' }
end
package 'osmosis' do
action :install
only_if { node[:osmosis][:install_type] == 'pkg' }
end
| mapzen/chef-osmosis | recipes/install.rb | Ruby | gpl-3.0 | 455 | [
30522,
1001,
1001,
5660,
8654,
2171,
1024,
1024,
9808,
15530,
2483,
1001,
17974,
1024,
1024,
16500,
1001,
15745,
1005,
9808,
15530,
2483,
30524,
24471,
2140,
1033,
2544,
13045,
1031,
1024,
9808,
15530,
2483,
1033,
1031,
1024,
2544,
1033,
39... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// MessageTableItemSocial.h
// Telegram
//
// Created by keepcoder on 03.11.14.
// Copyright (c) 2014 keepcoder. All rights reserved.
//
#import "MessageTableItem.h"
#import "YoutubeServiceDescription.h"
#import "InstagramServiceDescription.h"
@interface MessageTableItemSocial : MessageTableItem
@property (nonatomic,strong,readonly) SocialServiceDescription *social;
-(id)initWithObject:(id)object socialClass:(Class)socialClass;
@end
| overtake/telegram | TelegramTest/MessageTableItemSocial.h | C | gpl-2.0 | 449 | [
30522,
1013,
1013,
1013,
1013,
4471,
10880,
4221,
5244,
10085,
4818,
1012,
1044,
1013,
1013,
23921,
1013,
1013,
1013,
1013,
2580,
2011,
2562,
16044,
2099,
2006,
6021,
1012,
2340,
1012,
2403,
1012,
1013,
1013,
9385,
1006,
1039,
1007,
2297,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
clean "/tmp" do
copy "*.*", to: "/test"
end
| akatakritos/rcleaner | spec/fixtures/rfiles/copyfile.rb | Ruby | mit | 46 | [
30522,
4550,
1000,
1013,
1056,
8737,
1000,
2079,
6100,
1000,
1008,
1012,
1008,
1000,
1010,
2000,
1024,
1000,
1013,
3231,
1000,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//= require "dep3-1-1.js, dep3.js" | marcbaechinger/resolve | specs/samples/dep3-1.js | JavaScript | mit | 34 | [
30522,
1013,
1013,
1027,
5478,
1000,
2139,
2361,
2509,
1011,
1015,
1011,
1015,
1012,
1046,
2015,
1010,
2139,
2361,
2509,
1012,
1046,
2015,
1000,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<g><path d="M12 5.9c1.16 0 2.1.94 2.1 2.1s-.94 2.1-2.1 2.1S9.9 9.16 9.9 8s.94-2.1 2.1-2.1m0 9c2.97 0 6.1 1.46 6.1 2.1v1.1H5.9V17c0-.64 3.13-2.1 6.1-2.1M12 4C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4z" /></g>
, 'PermIdentity');
| cherniavskii/material-ui | packages/material-ui-icons/src/PermIdentity.js | JavaScript | mit | 397 | [
30522,
12324,
10509,
2013,
1005,
10509,
1005,
1025,
12324,
9005,
2615,
12863,
2239,
2013,
1005,
1012,
1013,
21183,
12146,
1013,
9005,
2615,
12863,
2239,
1005,
1025,
9167,
12398,
9005,
2615,
12863,
2239,
1006,
1026,
1043,
1028,
1026,
4130,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'db', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
RQ_QUEUES = {
'default': {
'HOST': 'localhost',
'PORT': 6379,
'DB': 0,
'PASSWORD': '',
}
}
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
| nvbn/deploy_trigger | deploy_trigger/settings/local_nvbn.py | Python | mit | 1,371 | [
30522,
2139,
8569,
2290,
1027,
2995,
23561,
1035,
2139,
8569,
2290,
1027,
2139,
8569,
2290,
4748,
21266,
1027,
1006,
1001,
1006,
1005,
2115,
2171,
1005,
1010,
1005,
2115,
1035,
10373,
1030,
2742,
1012,
4012,
1005,
1007,
1010,
1007,
10489,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2010-2021, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "prediction/dictionary_predictor.h"
#include <algorithm>
#include <cctype>
#include <climits> // INT_MAX
#include <cmath>
#include <cstdint>
#include <list>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/japanese_util.h"
#include "base/logging.h"
#include "base/number_util.h"
#include "base/util.h"
#include "composer/composer.h"
#include "converter/connector.h"
#include "converter/converter_interface.h"
#include "converter/immutable_converter_interface.h"
#include "converter/node_list_builder.h"
#include "converter/segmenter.h"
#include "converter/segments.h"
#include "dictionary/dictionary_interface.h"
#include "dictionary/pos_matcher.h"
#include "prediction/predictor_interface.h"
#include "prediction/suggestion_filter.h"
#include "prediction/zero_query_dict.h"
#include "protocol/commands.pb.h"
#include "protocol/config.pb.h"
#include "request/conversion_request.h"
#include "usage_stats/usage_stats.h"
#include "absl/container/flat_hash_map.h"
#include "absl/flags/flag.h"
#include "absl/strings/match.h"
#include "absl/strings/string_view.h"
#ifndef NDEBUG
#define MOZC_DEBUG
#define MOZC_WORD_LOG_MESSAGE(message) \
absl::StrCat(__FILE__, ":", __LINE__, " ", message, "\n")
#define MOZC_WORD_LOG(result, message) \
(result).log.append(MOZC_WORD_LOG_MESSAGE(message))
#else // NDEBUG
#define MOZC_WORD_LOG(result, message) \
{}
#endif // NDEBUG
namespace mozc {
namespace {
using ::mozc::commands::Request;
using ::mozc::dictionary::DictionaryInterface;
using ::mozc::dictionary::PosMatcher;
using ::mozc::dictionary::Token;
using ::mozc::usage_stats::UsageStats;
// Used to emulate positive infinity for cost. This value is set for those
// candidates that are thought to be aggressive; thus we can eliminate such
// candidates from suggestion or prediction. Note that for this purpose we don't
// want to use INT_MAX because someone might further add penalty after cost is
// set to INT_MAX, which leads to overflow and consequently aggressive
// candidates would appear in the top results.
constexpr int kInfinity = (2 << 20);
// Note that PREDICTION mode is much slower than SUGGESTION.
// Number of prediction calls should be minimized.
constexpr size_t kSuggestionMaxResultsSize = 256;
constexpr size_t kPredictionMaxResultsSize = 100000;
bool IsEnableNewSpatialScoring(const ConversionRequest &request) {
return request.request()
.decoder_experiment_params()
.enable_new_spatial_scoring();
}
// Returns true if the |target| may be reduncant result.
bool MaybeRedundant(const std::string &reference, const std::string &target) {
return absl::StartsWith(target, reference);
}
bool IsLatinInputMode(const ConversionRequest &request) {
return (request.has_composer() &&
(request.composer().GetInputMode() == transliteration::HALF_ASCII ||
request.composer().GetInputMode() == transliteration::FULL_ASCII));
}
bool IsQwertyMobileTable(const ConversionRequest &request) {
const auto table = request.request().special_romanji_table();
return (table == commands::Request::QWERTY_MOBILE_TO_HIRAGANA ||
table == commands::Request::QWERTY_MOBILE_TO_HALFWIDTHASCII);
}
bool IsLanguageAwareInputEnabled(const ConversionRequest &request) {
const auto lang_aware = request.request().language_aware_input();
return lang_aware == commands::Request::LANGUAGE_AWARE_SUGGESTION;
}
// Returns true if |segments| contains number history.
// Normalized number will be set to |number_key|
// Note:
// Now this function supports arabic number candidates only and
// we don't support kanji number candidates for now.
// This is because We have several kanji number styles, for example,
// "一二", "十二", "壱拾弐", etc for 12.
// TODO(toshiyuki): Define the spec and support Kanji.
bool GetNumberHistory(const Segments &segments, std::string *number_key) {
DCHECK(number_key);
const size_t history_size = segments.history_segments_size();
if (history_size <= 0) {
return false;
}
const Segment &last_segment = segments.history_segment(history_size - 1);
DCHECK_GT(last_segment.candidates_size(), 0);
const std::string &history_value = last_segment.candidate(0).value;
if (!NumberUtil::IsArabicNumber(history_value)) {
return false;
}
japanese_util::FullWidthToHalfWidth(history_value, number_key);
return true;
}
bool IsMixedConversionEnabled(const commands::Request &request) {
return request.mixed_conversion();
}
bool IsTypingCorrectionEnabled(const ConversionRequest &request) {
return request.config().use_typing_correction();
}
bool HasHistoryKeyLongerThanOrEqualTo(const Segments &segments,
size_t utf8_len) {
const size_t history_segments_size = segments.history_segments_size();
if (history_segments_size == 0) {
return false;
}
const Segment &history_segment =
segments.history_segment(history_segments_size - 1);
if (history_segment.candidates_size() == 0) {
return false;
}
return Util::CharsLen(history_segment.candidate(0).key) >= utf8_len;
}
bool IsLongKeyForRealtimeCandidates(const Segments &segments) {
constexpr int kFewResultThreshold = 8;
return (segments.segments_size() > 0 &&
Util::CharsLen(segments.segment(0).key()) >= kFewResultThreshold);
}
size_t GetMaxSizeForRealtimeCandidates(const ConversionRequest &request,
const Segments &segments,
bool is_long_key) {
const auto &segment = segments.conversion_segment(0);
const size_t size = (request.max_dictionary_prediction_candidates_size() -
segment.candidates_size());
return is_long_key ? std::min<size_t>(size, 8) : size;
}
size_t GetDefaultSizeForRealtimeCandidates(bool is_long_key) {
return is_long_key ? 5 : 10;
}
ConversionRequest GetConversionRequestForRealtimeCandidates(
const ConversionRequest &request, size_t realtime_candidates_size,
size_t current_candidates_size) {
ConversionRequest ret = request;
ret.set_max_conversion_candidates_size(current_candidates_size +
realtime_candidates_size);
return ret;
}
} // namespace
class DictionaryPredictor::PredictiveLookupCallback
: public DictionaryInterface::Callback {
public:
PredictiveLookupCallback(DictionaryPredictor::PredictionTypes types,
size_t limit, size_t original_key_len,
const std::set<std::string> *subsequent_chars,
Segment::Candidate::SourceInfo source_info,
int unknown_id,
absl::string_view non_expanded_original_key,
const SpatialCostParams &spatial_cost_params,
std::vector<DictionaryPredictor::Result> *results)
: penalty_(0),
types_(types),
limit_(limit),
original_key_len_(original_key_len),
subsequent_chars_(subsequent_chars),
source_info_(source_info),
unknown_id_(unknown_id),
non_expanded_original_key_(non_expanded_original_key),
spatial_cost_params_(spatial_cost_params),
results_(results) {}
PredictiveLookupCallback(const PredictiveLookupCallback &) = delete;
PredictiveLookupCallback &operator=(const PredictiveLookupCallback &) =
delete;
ResultType OnKey(absl::string_view key) override {
if (subsequent_chars_ == nullptr) {
return TRAVERSE_CONTINUE;
}
// If |subsequent_chars_| was provided, check if the substring of |key|
// obtained by removing the original lookup key starts with a string in the
// set. For example, if original key is "he" and "hello" was found,
// continue traversing only when one of "l", "ll", or "llo" is in
// |subsequent_chars_|.
// Implementation note: Although absl::StartsWith is called at most N times
// where N = subsequent_chars_.size(), N is very small in practice, less
// than 10. Thus, this linear order algorithm is fast enough.
// Theoretically, we can construct a trie of strings in |subsequent_chars_|
// to get more performance but it's overkill here.
// TODO(noriyukit): std::vector<string> would be better than set<string>.
// To this end, we need to fix Comopser as well.
const absl::string_view rest = absl::ClippedSubstr(key, original_key_len_);
for (const std::string &chr : *subsequent_chars_) {
if (absl::StartsWith(rest, chr)) {
return TRAVERSE_CONTINUE;
}
}
return TRAVERSE_NEXT_KEY;
}
ResultType OnActualKey(absl::string_view key, absl::string_view actual_key,
int num_expanded) override {
penalty_ = 0;
if (num_expanded > 0 ||
(!non_expanded_original_key_.empty() &&
!absl::StartsWith(actual_key, non_expanded_original_key_))) {
penalty_ = spatial_cost_params_.GetPenalty(key);
}
return TRAVERSE_CONTINUE;
}
ResultType OnToken(absl::string_view key, absl::string_view actual_key,
const Token &token) override {
// If the token is from user dictionary and its POS is unknown, it is
// suggest-only words. Such words are looked up only when their keys
// exactly match |key|. Otherwise, unigram suggestion can be annoying. For
// example, suppose a user registers their email address as める. Then,
// we don't want to show the email address from め but exactly from める.
if ((token.attributes & Token::USER_DICTIONARY) != 0 &&
token.lid == unknown_id_) {
const auto orig_key = absl::ClippedSubstr(key, 0, original_key_len_);
if (token.key != orig_key) {
return TRAVERSE_CONTINUE;
}
}
results_->push_back(Result());
results_->back().InitializeByTokenAndTypes(token, types_);
results_->back().wcost += penalty_;
results_->back().source_info |= source_info_;
return (results_->size() < limit_) ? TRAVERSE_CONTINUE : TRAVERSE_DONE;
}
protected:
int32_t penalty_;
const DictionaryPredictor::PredictionTypes types_;
const size_t limit_;
const size_t original_key_len_;
const std::set<std::string> *subsequent_chars_;
const Segment::Candidate::SourceInfo source_info_;
const int unknown_id_;
absl::string_view non_expanded_original_key_;
const SpatialCostParams spatial_cost_params_;
std::vector<DictionaryPredictor::Result> *results_;
};
class DictionaryPredictor::PredictiveBigramLookupCallback
: public PredictiveLookupCallback {
public:
PredictiveBigramLookupCallback(
DictionaryPredictor::PredictionTypes types, size_t limit,
size_t original_key_len, const std::set<std::string> *subsequent_chars,
absl::string_view history_value,
Segment::Candidate::SourceInfo source_info, int unknown_id,
absl::string_view non_expanded_original_key,
const SpatialCostParams spatial_cost_params,
std::vector<DictionaryPredictor::Result> *results)
: PredictiveLookupCallback(types, limit, original_key_len,
subsequent_chars, source_info, unknown_id,
non_expanded_original_key, spatial_cost_params,
results),
history_value_(history_value) {}
PredictiveBigramLookupCallback(const PredictiveBigramLookupCallback &) =
delete;
PredictiveBigramLookupCallback &operator=(
const PredictiveBigramLookupCallback &) = delete;
ResultType OnToken(absl::string_view key, absl::string_view expanded_key,
const Token &token) override {
// Skip the token if its value doesn't start with the previous user input,
// |history_value_|.
if (!absl::StartsWith(token.value, history_value_) ||
token.value.size() <= history_value_.size()) {
return TRAVERSE_CONTINUE;
}
ResultType result_type =
PredictiveLookupCallback::OnToken(key, expanded_key, token);
return result_type;
}
private:
absl::string_view history_value_;
};
// Comparator for sorting prediction candidates.
// If we have words A and AB, for example "六本木" and "六本木ヒルズ",
// assume that cost(A) < cost(AB).
class DictionaryPredictor::ResultWCostLess {
public:
bool operator()(const DictionaryPredictor::Result &lhs,
const DictionaryPredictor::Result &rhs) const {
return lhs.wcost < rhs.wcost;
}
};
class DictionaryPredictor::ResultCostLess {
public:
bool operator()(const DictionaryPredictor::Result &lhs,
const DictionaryPredictor::Result &rhs) const {
return lhs.cost > rhs.cost;
}
};
DictionaryPredictor::DictionaryPredictor(
const DataManagerInterface &data_manager,
const ConverterInterface *converter,
const ImmutableConverterInterface *immutable_converter,
const DictionaryInterface *dictionary,
const DictionaryInterface *suffix_dictionary, const Connector *connector,
const Segmenter *segmenter, const PosMatcher *pos_matcher,
const SuggestionFilter *suggestion_filter)
: converter_(converter),
immutable_converter_(immutable_converter),
dictionary_(dictionary),
suffix_dictionary_(suffix_dictionary),
connector_(connector),
segmenter_(segmenter),
suggestion_filter_(suggestion_filter),
counter_suffix_word_id_(pos_matcher->GetCounterSuffixWordId()),
general_symbol_id_(pos_matcher->GetGeneralSymbolId()),
unknown_id_(pos_matcher->GetUnknownId()),
predictor_name_("DictionaryPredictor") {
absl::string_view zero_query_token_array_data;
absl::string_view zero_query_string_array_data;
absl::string_view zero_query_number_token_array_data;
absl::string_view zero_query_number_string_array_data;
data_manager.GetZeroQueryData(&zero_query_token_array_data,
&zero_query_string_array_data,
&zero_query_number_token_array_data,
&zero_query_number_string_array_data);
zero_query_dict_.Init(zero_query_token_array_data,
zero_query_string_array_data);
zero_query_number_dict_.Init(zero_query_number_token_array_data,
zero_query_number_string_array_data);
}
DictionaryPredictor::~DictionaryPredictor() {}
void DictionaryPredictor::Finish(const ConversionRequest &request,
Segments *segments) {
if (segments->request_type() == Segments::REVERSE_CONVERSION) {
// Do nothing for REVERSE_CONVERSION.
return;
}
const Segment &segment = segments->conversion_segment(0);
if (segment.candidates_size() < 1) {
VLOG(2) << "candidates size < 1";
return;
}
const Segment::Candidate &candidate = segment.candidate(0);
if (segment.segment_type() != Segment::FIXED_VALUE) {
VLOG(2) << "segment is not FIXED_VALUE" << candidate.value;
return;
}
MaybeRecordUsageStats(candidate);
}
void DictionaryPredictor::MaybeRecordUsageStats(
const Segment::Candidate &candidate) const {
if (candidate.source_info &
Segment::Candidate::DICTIONARY_PREDICTOR_ZERO_QUERY_NONE) {
UsageStats::IncrementCount("CommitDictionaryPredictorZeroQueryTypeNone");
}
if (candidate.source_info &
Segment::Candidate::DICTIONARY_PREDICTOR_ZERO_QUERY_NUMBER_SUFFIX) {
UsageStats::IncrementCount(
"CommitDictionaryPredictorZeroQueryTypeNumberSuffix");
}
if (candidate.source_info &
Segment::Candidate::DICTIONARY_PREDICTOR_ZERO_QUERY_EMOTICON) {
UsageStats::IncrementCount(
"CommitDictionaryPredictorZeroQueryTypeEmoticon");
}
if (candidate.source_info &
Segment::Candidate::DICTIONARY_PREDICTOR_ZERO_QUERY_EMOJI) {
UsageStats::IncrementCount("CommitDictionaryPredictorZeroQueryTypeEmoji");
}
if (candidate.source_info &
Segment::Candidate::DICTIONARY_PREDICTOR_ZERO_QUERY_BIGRAM) {
UsageStats::IncrementCount("CommitDictionaryPredictorZeroQueryTypeBigram");
}
if (candidate.source_info &
Segment::Candidate::DICTIONARY_PREDICTOR_ZERO_QUERY_SUFFIX) {
UsageStats::IncrementCount("CommitDictionaryPredictorZeroQueryTypeSuffix");
}
}
bool DictionaryPredictor::PredictForRequest(const ConversionRequest &request,
Segments *segments) const {
if (segments == nullptr) {
return false;
}
if (segments->request_type() == Segments::CONVERSION) {
VLOG(2) << "request type is CONVERSION";
return false;
}
if (segments->conversion_segments_size() < 1) {
VLOG(2) << "segment size < 1";
return false;
}
std::vector<Result> results;
// Mixed conversion is the feature that mixes prediction and
// conversion, meaning that results may include the candidates whose
// key is exactly the same as the composition. This mode is used in mobile.
const bool is_mixed_conversion = IsMixedConversionEnabled(request.request());
AggregatePredictionForRequest(request, segments, &results);
if (results.empty()) {
return false;
}
if (is_mixed_conversion) {
SetPredictionCostForMixedConversion(*segments, &results);
if (!IsEnableNewSpatialScoring(request)) {
ApplyPenaltyForKeyExpansion(*segments, &results);
}
// Currently, we don't have spelling correction feature when in
// the mixed conversion mode, so RemoveMissSpelledCandidates() is
// not called.
return AddPredictionToCandidates(
request,
true, // Include exact key result even if it's a bad suggestion.
segments, &results);
}
// Normal prediction.
SetPredictionCost(*segments, &results);
if (!IsEnableNewSpatialScoring(request)) {
ApplyPenaltyForKeyExpansion(*segments, &results);
}
const std::string &input_key = segments->conversion_segment(0).key();
const size_t input_key_len = Util::CharsLen(input_key);
RemoveMissSpelledCandidates(input_key_len, &results);
return AddPredictionToCandidates(request, false, // Remove exact key result.
segments, &results);
}
DictionaryPredictor::PredictionTypes
DictionaryPredictor::AggregatePredictionForRequest(
const ConversionRequest &request, Segments *segments,
std::vector<Result> *results) const {
const bool is_mixed_conversion = IsMixedConversionEnabled(request.request());
// In mixed conversion mode, the number of real time candidates is increased.
const size_t realtime_max_size =
GetRealtimeCandidateMaxSize(request, *segments, is_mixed_conversion);
const auto &unigram_config = GetUnigramConfig(request, *segments);
return AggregatePrediction(request, realtime_max_size, unigram_config,
segments, results);
}
DictionaryPredictor::UnigramConfig DictionaryPredictor::GetUnigramConfig(
const ConversionRequest &request, const Segments &segments) const {
const bool is_mixed_conversion = IsMixedConversionEnabled(request.request());
if (IsLatinInputMode(request)) {
// For SUGGESTION request in Desktop, We don't look up English words when
// key length is one.
const size_t min_key_len_for_latin_input =
(is_mixed_conversion || segments.request_type() == Segments::PREDICTION)
? 1
: 2;
return {&DictionaryPredictor::AggregateUnigramCandidateForLatinInput,
min_key_len_for_latin_input};
}
if (is_mixed_conversion) {
// In mixed conversion mode, we want to show unigram candidates even for
// short keys to emulate PREDICTION mode.
constexpr size_t kMinUnigramKeyLen = 1;
return {&DictionaryPredictor::AggregateUnigramCandidateForMixedConversion,
kMinUnigramKeyLen};
}
// Normal prediction.
const size_t min_unigram_key_len =
(segments.request_type() == Segments::PREDICTION) ? 1 : 3;
return {&DictionaryPredictor::AggregateUnigramCandidate, min_unigram_key_len};
}
DictionaryPredictor::PredictionTypes DictionaryPredictor::AggregatePrediction(
const ConversionRequest &request, size_t realtime_max_size,
const UnigramConfig &unigram_config, Segments *segments,
std::vector<Result> *results) const {
DCHECK(segments);
DCHECK(results);
// Zero query prediction.
if (segments->conversion_segment(0).key().empty()) {
return AggregatePredictionForZeroQuery(request, segments, results);
}
const std::string &key = segments->conversion_segment(0).key();
const size_t key_len = Util::CharsLen(key);
// TODO(toshiyuki): Check if we can remove this SUGGESTION check.
// i.e. can we return NO_PREDICTION here for both of SUGGESTION and
// PREDICTION?
if (segments->request_type() == Segments::SUGGESTION) {
if (!request.config().use_dictionary_suggest()) {
VLOG(2) << "no_dictionary_suggest";
return NO_PREDICTION;
}
// Never trigger prediction if the key looks like zip code.
if (DictionaryPredictor::IsZipCodeRequest(key) && key_len < 6) {
return NO_PREDICTION;
}
}
PredictionTypes selected_types = NO_PREDICTION;
if (ShouldAggregateRealTimeConversionResults(request, *segments)) {
AggregateRealtimeConversion(request, realtime_max_size, segments, results);
selected_types |= REALTIME;
}
// In partial suggestion or prediction, only realtime candidates are used.
if (segments->request_type() == Segments::PARTIAL_SUGGESTION ||
segments->request_type() == Segments::PARTIAL_PREDICTION) {
return selected_types;
}
// Add unigram candidates.
const size_t min_unigram_key_len = unigram_config.min_key_len;
if (key_len >= min_unigram_key_len) {
const auto &unigram_fn = unigram_config.unigram_fn;
PredictionType type = (this->*unigram_fn)(request, *segments, results);
selected_types |= type;
}
// Add bigram candidates.
constexpr int kMinHistoryKeyLen = 3;
if (HasHistoryKeyLongerThanOrEqualTo(*segments, kMinHistoryKeyLen)) {
AggregateBigramPrediction(request, *segments,
Segment::Candidate::SOURCE_INFO_NONE, results);
selected_types |= BIGRAM;
}
// Add english candidates.
if (IsLanguageAwareInputEnabled(request) && IsQwertyMobileTable(request) &&
key_len >= min_unigram_key_len) {
AggregateEnglishPredictionUsingRawInput(request, *segments, results);
selected_types |= ENGLISH;
}
// Add typing correction candidates.
constexpr int kMinTypingCorrectionKeyLen = 3;
if (IsTypingCorrectionEnabled(request) &&
key_len >= kMinTypingCorrectionKeyLen) {
AggregateTypeCorrectingPrediction(request, *segments, results);
selected_types |= TYPING_CORRECTION;
}
return selected_types;
}
bool DictionaryPredictor::AddPredictionToCandidates(
const ConversionRequest &request, bool include_exact_key,
Segments *segments, std::vector<Result> *results) const {
DCHECK(segments);
DCHECK(results);
const std::string &input_key = segments->conversion_segment(0).key();
const size_t input_key_len = Util::CharsLen(input_key);
std::string history_key, history_value;
GetHistoryKeyAndValue(*segments, &history_key, &history_value);
// exact_bigram_key does not contain ambiguity expansion, because
// this is used for exact matching for the key.
const std::string exact_bigram_key = history_key + input_key;
Segment *segment = segments->mutable_conversion_segment(0);
DCHECK(segment);
// Instead of sorting all the results, we construct a heap.
// This is done in linear time and
// we can pop as many results as we need efficiently.
std::make_heap(results->begin(), results->end(), ResultCostLess());
const size_t size = std::min(
request.max_dictionary_prediction_candidates_size(), results->size());
int added = 0;
std::set<std::string> seen;
int added_suffix = 0;
bool cursor_at_tail =
request.has_composer() &&
request.composer().GetCursor() == request.composer().GetLength();
absl::flat_hash_map<std::string, int32_t> merged_types;
#ifndef NDEBUG
const bool is_debug = true;
#else // NDEBUG
// TODO(taku): Sets more advanced debug info depending on the verbose_level.
const bool is_debug = request.config().verbose_level() >= 1;
#endif // NDEBUG
if (is_debug) {
for (const auto &result : *results) {
if (!result.removed) {
merged_types[result.value] |= result.types;
}
}
}
auto add_candidate = [&](const Result &result, const std::string &key,
const std::string &value,
Segment::Candidate *candidate) {
DCHECK(candidate);
candidate->Init();
candidate->content_key = key;
candidate->content_value = value;
candidate->key = key;
candidate->value = value;
candidate->lid = result.lid;
candidate->rid = result.rid;
candidate->wcost = result.wcost;
candidate->cost = result.cost;
candidate->attributes = result.candidate_attributes;
if ((!(candidate->attributes & Segment::Candidate::SPELLING_CORRECTION) &&
IsLatinInputMode(request)) ||
(result.types & SUFFIX)) {
candidate->attributes |= Segment::Candidate::NO_VARIANTS_EXPANSION;
candidate->attributes |= Segment::Candidate::NO_EXTRA_DESCRIPTION;
}
if (candidate->attributes & Segment::Candidate::PARTIALLY_KEY_CONSUMED) {
candidate->consumed_key_size = result.consumed_key_size;
// There are two scenarios to reach here.
// 1. Auto partial suggestion.
// e.g. composition わたしのなまえ| -> candidate 私の
// 2. Partial suggestion.
// e.g. composition わたしの|なまえ -> candidate 私の
// To distinguish auto partial suggestion from (non-auto) partial
// suggestion, see the cursor position. If the cursor is at the tail
// of the composition, this is auto partial suggestion.
if (cursor_at_tail) {
candidate->attributes |= Segment::Candidate::AUTO_PARTIAL_SUGGESTION;
}
}
candidate->source_info = result.source_info;
if (result.types & REALTIME) {
candidate->inner_segment_boundary = result.inner_segment_boundary;
}
if (result.types & TYPING_CORRECTION) {
candidate->attributes |= Segment::Candidate::TYPING_CORRECTION;
}
SetDescription(result.types, candidate->attributes,
&candidate->description);
if (is_debug) {
SetDebugDescription(merged_types[result.value], &candidate->description);
}
#ifdef MOZC_DEBUG
candidate->log += "\n" + result.log;
#endif // MOZC_DEBUG
};
#ifdef MOZC_DEBUG
auto add_debug_candidate = [&](Result result, const std::string &log) {
std::string key, value;
if (result.types & BIGRAM) {
// remove the prefix of history key and history value.
key = result.key.substr(history_key.size(),
result.key.size() - history_key.size());
value = result.value.substr(history_value.size(),
result.value.size() - history_value.size());
} else {
key = result.key;
value = result.value;
}
result.log.append(log);
Segment::Candidate candidate;
add_candidate(result, key, value, &candidate);
segment->removed_candidates_for_debug_.push_back(std::move(candidate));
};
#define MOZC_ADD_DEBUG_CANDIDATE(result, log) \
add_debug_candidate(result, MOZC_WORD_LOG_MESSAGE(log))
#else // MOZC_DEBUG
#define MOZC_ADD_DEBUG_CANDIDATE(result, log) \
{}
#endif // MOZC_DEBUG
for (size_t i = 0; i < results->size(); ++i) {
// Pop a result from a heap. Please pay attention not to use results->at(i).
std::pop_heap(results->begin(), results->end() - i, ResultCostLess());
const Result &result = results->at(results->size() - i - 1);
if (added >= size || result.cost >= kInfinity) {
break;
}
if (result.removed) {
MOZC_ADD_DEBUG_CANDIDATE(result, "Removed flag is on");
continue;
}
// When |include_exact_key| is true, we don't filter the results
// which have the exactly same key as the input even if it's a bad
// suggestion.
if (!(include_exact_key && (result.key == input_key)) &&
suggestion_filter_->IsBadSuggestion(result.value)) {
MOZC_ADD_DEBUG_CANDIDATE(result, "Bad suggestion");
continue;
}
// Don't suggest exactly the same candidate as key.
// if |include_exact_key| is true, that's not the case.
if (!include_exact_key && !(result.types & REALTIME) &&
(((result.types & BIGRAM) && exact_bigram_key == result.value) ||
(!(result.types & BIGRAM) && input_key == result.value))) {
MOZC_ADD_DEBUG_CANDIDATE(result, "Key == candidate");
continue;
}
std::string key, value;
if (result.types & BIGRAM) {
// remove the prefix of history key and history value.
key = result.key.substr(history_key.size(),
result.key.size() - history_key.size());
value = result.value.substr(history_value.size(),
result.value.size() - history_value.size());
} else {
key = result.key;
value = result.value;
}
if (!seen.insert(value).second) {
MOZC_ADD_DEBUG_CANDIDATE(result, "Duplicated");
continue;
}
// User input: "おーすとり" (len = 5)
// key/value: "おーすとりら" "オーストラリア" (miss match pos = 4)
if ((result.candidate_attributes &
Segment::Candidate::SPELLING_CORRECTION) &&
key != input_key &&
input_key_len <= GetMissSpelledPosition(key, value) + 1) {
MOZC_ADD_DEBUG_CANDIDATE(result, "Spelling correction");
continue;
}
if (result.types == SUFFIX && added_suffix++ >= 20) {
// TODO(toshiyuki): Need refactoring for controlling suffix
// prediction number after we will fix the appropriate number.
MOZC_ADD_DEBUG_CANDIDATE(result, "Added suffix >= 20");
continue;
}
Segment::Candidate *candidate = segment->push_back_candidate();
add_candidate(result, key, value, candidate);
++added;
}
return added > 0;
#undef MOZC_ADD_DEBUG_CANDIDATE
}
DictionaryPredictor::PredictionTypes
DictionaryPredictor::AggregatePredictionForZeroQuery(
const ConversionRequest &request, Segments *segments,
std::vector<Result> *results) const {
DCHECK(segments);
DCHECK(results);
if (!request.request().zero_query_suggestion()) {
// Zero query is disabled by request.
return NO_PREDICTION;
}
PredictionTypes selected_types = NO_PREDICTION;
constexpr int kMinHistoryKeyLenForZeroQuery = 2;
if (HasHistoryKeyLongerThanOrEqualTo(*segments,
kMinHistoryKeyLenForZeroQuery)) {
AggregateBigramPrediction(
request, *segments,
Segment::Candidate::DICTIONARY_PREDICTOR_ZERO_QUERY_BIGRAM, results);
selected_types |= BIGRAM;
}
if (segments->history_segments_size() > 0) {
AggregateZeroQuerySuffixPrediction(request, *segments, results);
selected_types |= SUFFIX;
}
return selected_types;
}
DictionaryPredictor::PredictionType
DictionaryPredictor::AggregateUnigramCandidateForLatinInput(
const ConversionRequest &request, const Segments &segments,
std::vector<Result> *results) const {
AggregateEnglishPrediction(request, segments, results);
return ENGLISH;
}
void DictionaryPredictor::SetDescription(PredictionTypes types,
uint32_t attributes,
std::string *description) {
if (types & TYPING_CORRECTION) {
Util::AppendStringWithDelimiter(" ", "補正", description);
}
if (attributes & Segment::Candidate::AUTO_PARTIAL_SUGGESTION) {
Util::AppendStringWithDelimiter(" ", "部分", description);
}
}
void DictionaryPredictor::SetDebugDescription(PredictionTypes types,
std::string *description) {
std::string debug_desc;
if (types & UNIGRAM) {
debug_desc.append(1, 'U');
}
if (types & BIGRAM) {
debug_desc.append(1, 'B');
}
if (types & REALTIME_TOP) {
debug_desc.append("R1");
} else if (types & REALTIME) {
debug_desc.append(1, 'R');
}
if (types & SUFFIX) {
debug_desc.append(1, 'S');
}
if (types & ENGLISH) {
debug_desc.append(1, 'E');
}
// Note that description for TYPING_CORRECTION is omitted
// because it is appended by SetDescription.
if (!debug_desc.empty()) {
Util::AppendStringWithDelimiter(" ", debug_desc, description);
}
}
// Returns cost for |result| when it's transitioned from |rid|. Suffix penalty
// is also added for non-realtime results.
int DictionaryPredictor::GetLMCost(const Result &result, int rid) const {
const int cost_with_context = connector_->GetTransitionCost(rid, result.lid);
int lm_cost = 0;
if (result.types & SUFFIX) {
// We always respect the previous context to calculate the cost of SUFFIX.
// Otherwise, the suffix that doesn't match the context will be promoted.
lm_cost = cost_with_context + result.wcost;
} else {
// Sometimes transition cost is too high and causes a bug like b/18112966.
// For example, "接続詞 が" -> "始まる 動詞,五段活用,基本形" has very large
// cost and "始まる" is demoted. To prevent such cases, ImmutableConverter
// computes transition from BOS/EOS too; see
// ImmutableConverterImpl::MakeLatticeNodesForHistorySegments().
// Here, taking the minimum of |cost1| and |cost2| has a similar effect.
const int cost_without_context =
connector_->GetTransitionCost(0, result.lid);
lm_cost = std::min(cost_with_context, cost_without_context) + result.wcost;
}
if (!(result.types & REALTIME)) {
// Relatime conversion already adds perfix/suffix penalties to the result.
// Note that we don't add prefix penalty the role of "bunsetsu" is
// ambiguous on zero-query suggestion.
lm_cost += segmenter_->GetSuffixPenalty(result.rid);
}
return lm_cost;
}
namespace {
class FindValueCallback : public DictionaryInterface::Callback {
public:
explicit FindValueCallback(absl::string_view target_value)
: target_value_(target_value), found_(false) {}
ResultType OnToken(absl::string_view, // key
absl::string_view, // actual_key
const Token &token) override {
if (token.value != target_value_) {
return TRAVERSE_CONTINUE;
}
found_ = true;
token_ = token;
return TRAVERSE_DONE;
}
bool found() const { return found_; }
const Token &token() const { return token_; }
private:
absl::string_view target_value_;
bool found_;
Token token_;
DISALLOW_COPY_AND_ASSIGN(FindValueCallback);
};
} // namespace
void DictionaryPredictor::Result::InitializeByTokenAndTypes(
const Token &token, PredictionTypes types) {
SetTypesAndTokenAttributes(types, token.attributes);
key = token.key;
value = token.value;
wcost = token.cost;
lid = token.lid;
rid = token.rid;
}
void DictionaryPredictor::Result::SetTypesAndTokenAttributes(
PredictionTypes prediction_types, Token::AttributesBitfield token_attr) {
types = prediction_types;
candidate_attributes = 0;
if (types & TYPING_CORRECTION) {
candidate_attributes |= Segment::Candidate::TYPING_CORRECTION;
}
if (types & (REALTIME | REALTIME_TOP)) {
candidate_attributes |= Segment::Candidate::REALTIME_CONVERSION;
}
if (token_attr & Token::SPELLING_CORRECTION) {
candidate_attributes |= Segment::Candidate::SPELLING_CORRECTION;
}
if (token_attr & Token::USER_DICTIONARY) {
candidate_attributes |= (Segment::Candidate::USER_DICTIONARY |
Segment::Candidate::NO_VARIANTS_EXPANSION);
}
}
void DictionaryPredictor::Result::SetSourceInfoForZeroQuery(
ZeroQueryType type) {
switch (type) {
case ZERO_QUERY_NONE:
source_info |= Segment::Candidate::DICTIONARY_PREDICTOR_ZERO_QUERY_NONE;
return;
case ZERO_QUERY_NUMBER_SUFFIX:
source_info |=
Segment::Candidate::DICTIONARY_PREDICTOR_ZERO_QUERY_NUMBER_SUFFIX;
return;
case ZERO_QUERY_EMOTICON:
source_info |=
Segment::Candidate::DICTIONARY_PREDICTOR_ZERO_QUERY_EMOTICON;
return;
case ZERO_QUERY_EMOJI:
source_info |= Segment::Candidate::DICTIONARY_PREDICTOR_ZERO_QUERY_EMOJI;
return;
case ZERO_QUERY_BIGRAM:
source_info |= Segment::Candidate::DICTIONARY_PREDICTOR_ZERO_QUERY_BIGRAM;
return;
case ZERO_QUERY_SUFFIX:
source_info |= Segment::Candidate::DICTIONARY_PREDICTOR_ZERO_QUERY_SUFFIX;
return;
default:
LOG(ERROR) << "Should not come here";
return;
}
}
bool DictionaryPredictor::Result::IsUserDictionaryResult() const {
return (candidate_attributes & Segment::Candidate::USER_DICTIONARY) != 0;
}
// Here, we treat the word as English when its key consists of Latin
// characters.
bool DictionaryPredictor::Result::IsEnglishEntryResult() const {
return Util::IsEnglishTransliteration(key);
}
bool DictionaryPredictor::GetHistoryKeyAndValue(const Segments &segments,
std::string *key,
std::string *value) const {
DCHECK(key);
DCHECK(value);
if (segments.history_segments_size() == 0) {
return false;
}
const Segment &history_segment =
segments.history_segment(segments.history_segments_size() - 1);
if (history_segment.candidates_size() == 0) {
return false;
}
key->assign(history_segment.candidate(0).key);
value->assign(history_segment.candidate(0).value);
return true;
}
void DictionaryPredictor::SetPredictionCost(
const Segments &segments, std::vector<Result> *results) const {
DCHECK(results);
int rid = 0; // 0 (BOS) is default
if (segments.history_segments_size() > 0) {
const Segment &history_segment =
segments.history_segment(segments.history_segments_size() - 1);
if (history_segment.candidates_size() > 0) {
rid = history_segment.candidate(0).rid; // use history segment's id
}
}
const std::string &input_key = segments.conversion_segment(0).key();
std::string history_key, history_value;
GetHistoryKeyAndValue(segments, &history_key, &history_value);
const std::string bigram_key = history_key + input_key;
const bool is_suggestion = (segments.request_type() == Segments::SUGGESTION);
// use the same scoring function for both unigram/bigram.
// Bigram will be boosted because we pass the previous
// key as a context information.
const size_t bigram_key_len = Util::CharsLen(bigram_key);
const size_t unigram_key_len = Util::CharsLen(input_key);
// In the loop below, we track the minimum cost among those REALTIME
// candidates that have the same key length as |input_key| so that we can set
// a slightly smaller cost to REALTIME_TOP than these.
int realtime_cost_min = kInfinity;
Result *realtime_top_result = nullptr;
for (size_t i = 0; i < results->size(); ++i) {
const Result &result = results->at(i);
// The cost of REALTIME_TOP is determined after the loop based on the
// minimum cost for REALTIME. Just remember the pointer of result.
if (result.types & REALTIME_TOP) {
realtime_top_result = &results->at(i);
continue;
}
const int cost = GetLMCost(result, rid);
const size_t query_len =
(result.types & BIGRAM) ? bigram_key_len : unigram_key_len;
const size_t key_len = Util::CharsLen(result.key);
if (IsAggressiveSuggestion(query_len, key_len, cost, is_suggestion,
results->size())) {
results->at(i).cost = kInfinity;
continue;
}
// cost = -500 * log(lang_prob(w) * (1 + remain_length)) -- (1)
// where lang_prob(w) is a language model probability of the word "w", and
// remain_length the length of key user must type to input "w".
//
// Example:
// key/value = "とうきょう/東京"
// user_input = "とう"
// remain_length = len("とうきょう") - len("とう") = 3
//
// By taking the log of (1),
// cost = -500 [log(lang_prob(w)) + log(1 + ramain_length)]
// = -500 * log(lang_prob(w)) + 500 * log(1 + remain_length)
// = cost - 500 * log(1 + remain_length)
// Because 500 * log(lang_prob(w)) = -cost.
//
// lang_prob(w) * (1 + remain_length) represents how user can reduce
// the total types by choosing this candidate.
// Before this simple algorithm, we have been using an SVM-base scoring,
// but we stop usign it with the following reasons.
// 1) Hard to maintain the ranking.
// 2) Hard to control the final results of SVM.
// 3) Hard to debug.
// 4) Since we used the log(remain_length) as a feature,
// the new ranking algorithm and SVM algorithm was essentially
// the same.
// 5) Since we used the length of value as a feature, we find
// inconsistencies between the conversion and the prediction
// -- the results of top prediction and the top conversion
// (the candidate shown after the space key) may differ.
//
// The new function brings consistent results. If two candidate
// have the same reading (key), they should have the same cost bonus
// from the length part. This implies that the result is reranked by
// the language model probability as long as the key part is the same.
// This behavior is baisically the same as the converter.
//
// TODO(team): want find the best parameter instead of kCostFactor.
constexpr int kCostFactor = 500;
results->at(i).cost =
cost - kCostFactor * log(1.0 + std::max<int>(0, key_len - query_len));
// Update the minimum cost for REALTIME candidates that have the same key
// length as input_key.
if (result.types & REALTIME && result.cost < realtime_cost_min &&
result.key.size() == input_key.size()) {
realtime_cost_min = result.cost;
}
}
// Ensure that the REALTIME_TOP candidate has relatively smaller cost than
// those of REALTIME candidates.
if (realtime_top_result != nullptr) {
realtime_top_result->cost = std::max(0, realtime_cost_min - 10);
}
}
void DictionaryPredictor::SetPredictionCostForMixedConversion(
const Segments &segments, std::vector<Result> *results) const {
DCHECK(results);
// ranking for mobile
int rid = 0; // 0 (BOS) is default
int prev_cost = 0; // cost of the last history candidate.
if (segments.history_segments_size() > 0) {
const Segment &history_segment =
segments.history_segment(segments.history_segments_size() - 1);
if (history_segment.candidates_size() > 0) {
rid = history_segment.candidate(0).rid; // use history segment's id
prev_cost = history_segment.candidate(0).cost;
if (prev_cost == 0) {
// if prev_cost is set to be 0 for some reason, use default cost.
prev_cost = 5000;
}
}
}
const size_t input_key_len =
Util::CharsLen(segments.conversion_segment(0).key());
for (Result &result : *results) {
int cost = GetLMCost(result, rid);
MOZC_WORD_LOG(result, absl::StrCat("GetLMCost: ", cost));
// Demote filtered word here, because they are not filtered for exact match.
// Even for exact match, we don't want to show aggressive words with high
// ranking.
if (suggestion_filter_->IsBadSuggestion(result.value)) {
// Cost penalty means for bad suggestion.
// 3453 = 500 * log(1000)
constexpr int kBadSuggestionPenalty = 3453;
cost += kBadSuggestionPenalty;
MOZC_WORD_LOG(result, absl::StrCat("BadSuggestionPenalty: ", cost));
}
// Make exact candidates to have higher ranking.
// Because for mobile, suggestion is the main candidates and
// users expect the candidates for the input key on the candidates.
if (result.types & (UNIGRAM | TYPING_CORRECTION)) {
const size_t key_len = Util::CharsLen(result.key);
if (key_len > input_key_len) {
// Cost penalty means that exact candidates are evaluated
// 50 times bigger in frequency.
// Note that the cost is calculated by cost = -500 * log(prob)
// 1956 = 500 * log(50)
constexpr int kNotExactPenalty = 1956;
cost += kNotExactPenalty;
MOZC_WORD_LOG(result,
absl::StrCat("Unigram | Typing correction: ", cost));
}
}
if (result.types & BIGRAM) {
// When user inputs "六本木" and there is an entry
// "六本木ヒルズ" in the dictionary, we can suggest
// "ヒルズ" as a ZeroQuery suggestion. In this case,
// We can't calcurate the transition cost between "六本木"
// and "ヒルズ". If we ignore the transition cost,
// bigram-based suggestion will be overestimated.
// Here we use kDefaultTransitionCost as an
// transition cost between "六本木" and "ヒルズ". Currently,
// the cost is basically the same as the cost between
// "名詞,一般" and "名詞,一般".
// TODO(taku): Adjust these parameters.
// Seems the bigram is overestimated.
constexpr int kDefaultTransitionCost = 1347;
// Promoting bigram candidates.
constexpr int kBigramBonus = 800; // ~= 500*ln(5)
cost += (kDefaultTransitionCost - kBigramBonus - prev_cost);
MOZC_WORD_LOG(result, absl::StrCat("Bigram: ", cost));
}
if (result.candidate_attributes & Segment::Candidate::USER_DICTIONARY &&
result.lid != general_symbol_id_) {
// Decrease cost for words from user dictionary in order to promote them,
// provided that it is not a general symbol (Note: emoticons are mapped to
// general symbol). Currently user dictionary words are evaluated 5 times
// bigger in frequency, being capped by 1000 (this number is adhoc, so
// feel free to adjust).
constexpr int kUserDictionaryPromotionFactor = 804; // 804 = 500 * log(5)
constexpr int kUserDictionaryCostUpperLimit = 1000;
cost = std::min(cost - kUserDictionaryPromotionFactor,
kUserDictionaryCostUpperLimit);
MOZC_WORD_LOG(result, absl::StrCat("User dictionary: ", cost));
}
// Note that the cost is defined as -500 * log(prob).
// Even after the ad hoc manipulations, cost must remain larger than 0.
result.cost = std::max(1, cost);
MOZC_WORD_LOG(result, absl::StrCat("SetLMCost: ", result.cost));
}
}
// This method should be deprecated, as it is unintentionally adding extra
// spatial penalty to the candidate.
void DictionaryPredictor::ApplyPenaltyForKeyExpansion(
const Segments &segments, std::vector<Result> *results) const {
if (segments.conversion_segments_size() == 0) {
return;
}
// Cost penalty 1151 means that expanded candidates are evaluated
// 10 times smaller in frequency.
// Note that the cost is calcurated by cost = -500 * log(prob)
// 1151 = 500 * log(10)
constexpr int kKeyExpansionPenalty = 1151;
const std::string &conversion_key = segments.conversion_segment(0).key();
for (size_t i = 0; i < results->size(); ++i) {
Result &result = results->at(i);
if (result.types & TYPING_CORRECTION) {
continue;
}
if (!absl::StartsWith(result.key, conversion_key)) {
result.cost += kKeyExpansionPenalty;
MOZC_WORD_LOG(result, absl::StrCat("KeyExpansionPenalty: ", result.cost));
}
}
}
size_t DictionaryPredictor::GetMissSpelledPosition(
const std::string &key, const std::string &value) const {
std::string hiragana_value;
japanese_util::KatakanaToHiragana(value, &hiragana_value);
// value is mixed type. return true if key == request_key.
if (Util::GetScriptType(hiragana_value) != Util::HIRAGANA) {
return Util::CharsLen(key);
}
// Find the first position of character where miss spell occurs.
int position = 0;
ConstChar32Iterator key_iter(key);
for (ConstChar32Iterator hiragana_iter(hiragana_value);
!hiragana_iter.Done() && !key_iter.Done();
hiragana_iter.Next(), key_iter.Next(), ++position) {
if (hiragana_iter.Get() != key_iter.Get()) {
return position;
}
}
// not find. return the length of key.
while (!key_iter.Done()) {
++position;
key_iter.Next();
}
return position;
}
void DictionaryPredictor::RemoveMissSpelledCandidates(
size_t request_key_len, std::vector<Result> *results) const {
DCHECK(results);
if (results->size() <= 1) {
return;
}
int spelling_correction_size = 5;
for (size_t i = 0; i < results->size(); ++i) {
const Result &result = (*results)[i];
if (!(result.candidate_attributes &
Segment::Candidate::SPELLING_CORRECTION)) {
continue;
}
// Only checks at most 5 spelling corrections to avoid the case
// like all candidates have SPELLING_CORRECTION.
if (--spelling_correction_size == 0) {
return;
}
std::vector<size_t> same_key_index, same_value_index;
for (size_t j = 0; j < results->size(); ++j) {
if (i == j) {
continue;
}
const Result &target_result = (*results)[j];
if (target_result.candidate_attributes &
Segment::Candidate::SPELLING_CORRECTION) {
continue;
}
if (target_result.key == result.key) {
same_key_index.push_back(j);
}
if (target_result.value == result.value) {
same_value_index.push_back(j);
}
}
// delete same_key_index and same_value_index
if (!same_key_index.empty() && !same_value_index.empty()) {
results->at(i).removed = true;
MOZC_WORD_LOG(results->at(i), "Removed. same_(key|value)_index.");
for (size_t k = 0; k < same_key_index.size(); ++k) {
results->at(same_key_index[k]).removed = true;
MOZC_WORD_LOG(results->at(i), "Removed. same_(key|value)_index.");
}
} else if (same_key_index.empty() && !same_value_index.empty()) {
results->at(i).removed = true;
MOZC_WORD_LOG(results->at(i), "Removed. same_value_index.");
} else if (!same_key_index.empty() && same_value_index.empty()) {
for (size_t k = 0; k < same_key_index.size(); ++k) {
results->at(same_key_index[k]).removed = true;
MOZC_WORD_LOG(results->at(i), "Removed. same_key_index.");
}
if (request_key_len <= GetMissSpelledPosition(result.key, result.value)) {
results->at(i).removed = true;
MOZC_WORD_LOG(results->at(i), "Removed. Invalid MissSpelledPosition.");
}
}
}
}
bool DictionaryPredictor::IsAggressiveSuggestion(
size_t query_len, size_t key_len, int cost, bool is_suggestion,
size_t total_candidates_size) const {
// Temporal workaround for fixing the problem where longer sentence-like
// suggestions are shown when user input is very short.
// "ただしい" => "ただしいけめんにかぎる"
// "それでもぼ" => "それでもぼくはやっていない".
// If total_candidates_size is small enough, we don't perform
// special filtering. e.g., "せんとち" has only two candidates, so
// showing "千と千尋の神隠し" is OK.
// Also, if the cost is too small (< 5000), we allow to display
// long phrases. Examples include "よろしくおねがいします".
if (is_suggestion && total_candidates_size >= 10 && key_len >= 8 &&
cost >= 5000 && query_len <= static_cast<size_t>(0.4 * key_len)) {
return true;
}
return false;
}
size_t DictionaryPredictor::GetRealtimeCandidateMaxSize(
const ConversionRequest &request, const Segments &segments,
bool mixed_conversion) const {
const Segments::RequestType request_type = segments.request_type();
DCHECK(request_type == Segments::PREDICTION ||
request_type == Segments::SUGGESTION ||
request_type == Segments::PARTIAL_PREDICTION ||
request_type == Segments::PARTIAL_SUGGESTION);
if (segments.conversion_segments_size() == 0) {
return 0;
}
const bool is_long_key = IsLongKeyForRealtimeCandidates(segments);
const size_t max_size =
GetMaxSizeForRealtimeCandidates(request, segments, is_long_key);
const size_t default_size = GetDefaultSizeForRealtimeCandidates(is_long_key);
size_t size = 0;
switch (request_type) {
case Segments::PREDICTION:
size = mixed_conversion ? max_size : default_size;
break;
case Segments::SUGGESTION:
// Fewer candidatats are needed basically.
// But on mixed_conversion mode we should behave like as conversion mode.
size = mixed_conversion ? default_size : 1;
break;
case Segments::PARTIAL_PREDICTION:
// This is kind of prediction so richer result than PARTIAL_SUGGESTION
// is needed.
size = max_size;
break;
case Segments::PARTIAL_SUGGESTION:
// PARTIAL_SUGGESTION works like as conversion mode so returning
// some candidates is needed.
size = default_size;
break;
default:
size = 0; // Never reach here
}
return std::min(max_size, size);
}
bool DictionaryPredictor::PushBackTopConversionResult(
const ConversionRequest &request, const Segments &segments,
std::vector<Result> *results) const {
DCHECK_EQ(1, segments.conversion_segments_size());
Segments tmp_segments = segments;
ConversionRequest tmp_request = request;
tmp_request.set_max_conversion_candidates_size(20);
tmp_request.set_composer_key_selection(ConversionRequest::PREDICTION_KEY);
// Some rewriters cause significant performance loss. So we skip them.
tmp_request.set_skip_slow_rewriters(true);
// This method emulates usual converter's behavior so here disable
// partial candidates.
tmp_request.set_create_partial_candidates(false);
if (!converter_->StartConversionForRequest(tmp_request, &tmp_segments)) {
return false;
}
results->push_back(Result());
Result *result = &results->back();
result->key = segments.conversion_segment(0).key();
result->lid = tmp_segments.conversion_segment(0).candidate(0).lid;
result->rid =
tmp_segments
.conversion_segment(tmp_segments.conversion_segments_size() - 1)
.candidate(0)
.rid;
result->SetTypesAndTokenAttributes(REALTIME | REALTIME_TOP, Token::NONE);
result->candidate_attributes |= Segment::Candidate::NO_VARIANTS_EXPANSION;
// Concatenate the top candidates.
// Note that since StartConversionForRequest() runs in conversion mode, the
// resulting |tmp_segments| doesn't have inner_segment_boundary. We need to
// construct it manually here.
// TODO(noriyukit): This is code duplicate in converter/nbest_generator.cc and
// we should refactor code after finding more good design.
bool inner_segment_boundary_success = true;
for (size_t i = 0; i < tmp_segments.conversion_segments_size(); ++i) {
const Segment &segment = tmp_segments.conversion_segment(i);
const Segment::Candidate &candidate = segment.candidate(0);
result->value.append(candidate.value);
result->wcost += candidate.cost;
uint32_t encoded_lengths;
if (inner_segment_boundary_success &&
Segment::Candidate::EncodeLengths(
candidate.key.size(), candidate.value.size(),
candidate.content_key.size(), candidate.content_value.size(),
&encoded_lengths)) {
result->inner_segment_boundary.push_back(encoded_lengths);
} else {
inner_segment_boundary_success = false;
}
}
if (!inner_segment_boundary_success) {
LOG(WARNING) << "Failed to construct inner segment boundary";
result->inner_segment_boundary.clear();
}
return true;
}
void DictionaryPredictor::AggregateRealtimeConversion(
const ConversionRequest &request, size_t realtime_candidates_size,
Segments *segments, std::vector<Result> *results) const {
DCHECK(converter_);
DCHECK(immutable_converter_);
DCHECK(segments);
DCHECK(results);
// TODO(noriyukit): Currently, |segments| is abused as a temporary output from
// the immutable converter. Therefore, the first segment needs to be mutable.
// Fix this bad abuse.
Segment *segment = segments->mutable_conversion_segment(0);
DCHECK(!segment->key().empty());
// First insert a top conversion result.
if (request.use_actual_converter_for_realtime_conversion()) {
if (!PushBackTopConversionResult(request, *segments, results)) {
LOG(WARNING) << "Realtime conversion with converter failed";
}
}
if (realtime_candidates_size == 0) {
return;
}
// In what follows, add results from immutable converter.
// TODO(noriyukit): The |immutable_converter_| used below can be replaced by
// |converter_| in principle. There's a problem of ranking when we get
// multiple segments, i.e., how to concatenate candidates in each segment.
// Currently, immutable converter handles such ranking in prediction mode to
// generate single segment results. So we want to share that code.
// Preserve the current candidates_size to restore segments at the end of this
// method.
const size_t prev_candidates_size = segment->candidates_size();
const ConversionRequest request_for_realtime =
GetConversionRequestForRealtimeCandidates(
request, realtime_candidates_size, prev_candidates_size);
if (!immutable_converter_->ConvertForRequest(request_for_realtime,
segments) ||
prev_candidates_size >= segment->candidates_size()) {
LOG(WARNING) << "Convert failed";
return;
}
// A little tricky treatment:
// Since ImmutableConverter::Convert creates a set of new candidates,
// copy them into the array of Results.
for (size_t i = prev_candidates_size; i < segment->candidates_size(); ++i) {
const Segment::Candidate &candidate = segment->candidate(i);
results->push_back(Result());
Result *result = &results->back();
result->key = candidate.key;
result->value = candidate.value;
result->wcost = candidate.wcost;
result->lid = candidate.lid;
result->rid = candidate.rid;
result->inner_segment_boundary = candidate.inner_segment_boundary;
result->SetTypesAndTokenAttributes(REALTIME, Token::NONE);
result->candidate_attributes |= candidate.attributes;
result->consumed_key_size = candidate.consumed_key_size;
}
// Remove candidates created by ImmutableConverter.
segment->erase_candidates(prev_candidates_size,
segment->candidates_size() - prev_candidates_size);
}
size_t DictionaryPredictor::GetCandidateCutoffThreshold(
const Segments &segments) const {
DCHECK(segments.request_type() == Segments::PREDICTION ||
segments.request_type() == Segments::SUGGESTION);
if (segments.request_type() == Segments::PREDICTION) {
// If PREDICTION, many candidates are needed than SUGGESTION.
return kPredictionMaxResultsSize;
}
return kSuggestionMaxResultsSize;
}
DictionaryPredictor::PredictionType
DictionaryPredictor::AggregateUnigramCandidate(
const ConversionRequest &request, const Segments &segments,
std::vector<Result> *results) const {
DCHECK(results);
DCHECK(dictionary_);
DCHECK(segments.request_type() == Segments::PREDICTION ||
segments.request_type() == Segments::SUGGESTION);
const size_t cutoff_threshold = GetCandidateCutoffThreshold(segments);
const size_t prev_results_size = results->size();
GetPredictiveResults(*dictionary_, "", request, segments, UNIGRAM,
cutoff_threshold, Segment::Candidate::SOURCE_INFO_NONE,
unknown_id_, results);
const size_t unigram_results_size = results->size() - prev_results_size;
// If size reaches max_results_size (== cutoff_threshold).
// we don't show the candidates, since disambiguation from
// 256 candidates is hard. (It may exceed max_results_size, because this is
// just a limit for each backend, so total number may be larger)
if (unigram_results_size >= cutoff_threshold) {
results->resize(prev_results_size);
}
return UNIGRAM;
}
DictionaryPredictor::PredictionType
DictionaryPredictor::AggregateUnigramCandidateForMixedConversion(
const ConversionRequest &request, const Segments &segments,
std::vector<Result> *results) const {
DCHECK(segments.request_type() == Segments::PREDICTION ||
segments.request_type() == Segments::SUGGESTION);
AggregateUnigramCandidateForMixedConversion(*dictionary_, request, segments,
unknown_id_, results);
return UNIGRAM;
}
void DictionaryPredictor::AggregateUnigramCandidateForMixedConversion(
const dictionary::DictionaryInterface &dictionary,
const ConversionRequest &request, const Segments &segments, int unknown_id,
std::vector<Result> *results) {
const size_t cutoff_threshold = kPredictionMaxResultsSize;
std::vector<Result> raw_result;
// No history key
GetPredictiveResults(dictionary, "", request, segments, UNIGRAM,
cutoff_threshold, Segment::Candidate::SOURCE_INFO_NONE,
unknown_id, &raw_result);
// Hereafter, we split "Needed Results" and "(maybe) Unneeded Results."
// The algorithm is:
// 1) Take the Result with minimum cost.
// 2) Remove results which is "redundant" (defined by MaybeRedundant),
// from remaining results.
// 3) Repeat 1) and 2) five times.
// Note: to reduce the number of memory allocation, we swap out the
// "redundant" results to the end of the |results| vector.
constexpr size_t kDeleteTrialNum = 5;
// min_iter is the beginning of the remaining results (inclusive), and
// max_iter is the end of the remaining results (exclusive).
typedef std::vector<Result>::iterator Iter;
Iter min_iter = raw_result.begin();
Iter max_iter = raw_result.end();
for (size_t i = 0; i < kDeleteTrialNum; ++i) {
if (min_iter == max_iter) {
break;
}
// Find the Result with minimum cost. Swap it with the beginning element.
std::iter_swap(min_iter,
std::min_element(min_iter, max_iter, ResultWCostLess()));
const Result &reference_result = *min_iter;
// Preserve the reference result.
++min_iter;
// Traverse all remaining elements and check if each result is redundant.
for (Iter iter = min_iter; iter != max_iter;) {
// - We do not filter user dictionary word.
const bool should_check_redundant = !iter->IsUserDictionaryResult();
if (should_check_redundant &&
MaybeRedundant(reference_result.value, iter->value)) {
// Swap out the redundant result.
--max_iter;
std::iter_swap(iter, max_iter);
} else {
++iter;
}
}
}
// Then the |raw_result| contains;
// [begin, min_iter): reference results in the above loop.
// [max_iter, end): (maybe) redundant results.
// [min_iter, max_iter): remaining results.
// Here, we revive the redundant results up to five in the result cost order.
constexpr size_t kDoNotDeleteNum = 5;
if (std::distance(max_iter, raw_result.end()) >= kDoNotDeleteNum) {
std::partial_sort(max_iter, max_iter + kDoNotDeleteNum, raw_result.end(),
ResultWCostLess());
max_iter += kDoNotDeleteNum;
} else {
max_iter = raw_result.end();
}
// Finally output the result.
results->insert(results->end(), raw_result.begin(), max_iter);
}
void DictionaryPredictor::AggregateBigramPrediction(
const ConversionRequest &request, const Segments &segments,
Segment::Candidate::SourceInfo source_info,
std::vector<Result> *results) const {
DCHECK(results);
DCHECK(dictionary_);
// TODO(toshiyuki): Support suggestion from the last 2 histories.
// ex) "六本木"+"ヒルズ"->"レジデンス"
std::string history_key, history_value;
if (!GetHistoryKeyAndValue(segments, &history_key, &history_value)) {
return;
}
AddBigramResultsFromHistory(history_key, history_value, request, segments,
source_info, results);
}
void DictionaryPredictor::AddBigramResultsFromHistory(
const std::string &history_key, const std::string &history_value,
const ConversionRequest &request, const Segments &segments,
Segment::Candidate::SourceInfo source_info,
std::vector<Result> *results) const {
// Check that history_key/history_value are in the dictionary.
FindValueCallback find_history_callback(history_value);
dictionary_->LookupPrefix(history_key, request, &find_history_callback);
// History value is not found in the dictionary.
// User may create this the history candidate from T13N or segment
// expand/shrinkg operations.
if (!find_history_callback.found()) {
return;
}
const size_t cutoff_threshold = GetCandidateCutoffThreshold(segments);
const size_t prev_results_size = results->size();
GetPredictiveResultsForBigram(*dictionary_, history_key, history_value,
request, segments, BIGRAM, cutoff_threshold,
source_info, unknown_id_, results);
const size_t bigram_results_size = results->size() - prev_results_size;
// if size reaches max_results_size,
// we don't show the candidates, since disambiguation from
// 256 candidates is hard. (It may exceed max_results_size, because this is
// just a limit for each backend, so total number may be larger)
if (bigram_results_size >= cutoff_threshold) {
results->resize(prev_results_size);
return;
}
// Obtain the character type of the last history value.
const size_t history_value_size = Util::CharsLen(history_value);
if (history_value_size == 0) {
return;
}
const Util::ScriptType history_ctype = Util::GetScriptType(history_value);
const Util::ScriptType last_history_ctype = Util::GetScriptType(
Util::Utf8SubString(history_value, history_value_size - 1, 1));
for (size_t i = prev_results_size; i < results->size(); ++i) {
CheckBigramResult(find_history_callback.token(), history_ctype,
last_history_ctype, request, &(*results)[i]);
}
}
// Filter out irrelevant bigrams. For example, we don't want to
// suggest "リカ" from the history "アメ".
void DictionaryPredictor::CheckBigramResult(
const Token &history_token, const Util::ScriptType history_ctype,
const Util::ScriptType last_history_ctype, const ConversionRequest &request,
Result *result) const {
DCHECK(result);
const std::string &history_key = history_token.key;
const std::string &history_value = history_token.value;
const std::string key(result->key, history_key.size(),
result->key.size() - history_key.size());
const std::string value(result->value, history_value.size(),
result->value.size() - history_value.size());
// Don't suggest 0-length key/value.
if (key.empty() || value.empty()) {
result->removed = true;
MOZC_WORD_LOG(*result, "Removed. key, value or both are empty.");
return;
}
const Util::ScriptType ctype =
Util::GetScriptType(Util::Utf8SubString(value, 0, 1));
if (history_ctype == Util::KANJI && ctype == Util::KATAKANA) {
// Do not filter "六本木ヒルズ"
MOZC_WORD_LOG(*result, "Valid bigram. Kanji + Katakana pattern.");
return;
}
// If freq("アメ") < freq("アメリカ"), we don't
// need to suggest it. As "アメリカ" should already be
// suggested when user type "アメ".
// Note that wcost = -500 * log(prob).
if (ctype != Util::KANJI && history_token.cost > result->wcost) {
result->removed = true;
MOZC_WORD_LOG(*result,
"Removed. The prefix's score is lower than the whole.");
return;
}
// If character type doesn't change, this boundary might NOT
// be a word boundary. Only use iif the entire key is reasonably long.
const size_t key_len = Util::CharsLen(result->key);
if (ctype == last_history_ctype &&
((ctype == Util::HIRAGANA && key_len <= 9) ||
(ctype == Util::KATAKANA && key_len <= 5))) {
result->removed = true;
MOZC_WORD_LOG(*result, "Removed. Short Hiragana (<= 9) or Katakana (<= 5)");
return;
}
// The suggested key/value pair must exist in the dictionary.
// For example, we don't want to suggest "ターネット" from
// the history "イン".
// If character type is Kanji and the suggestion is not a
// zero_query_suggestion, we relax this condition, as there are
// many Kanji-compounds which may not in the dictionary. For example,
// we want to suggest "霊長類研究所" from the history "京都大学".
if (ctype == Util::KANJI && Util::CharsLen(value) >= 2) {
// Do not filter this.
// TODO(toshiyuki): one-length kanji prediciton may be annoying other than
// some exceptions, "駅", "口", etc
MOZC_WORD_LOG(*result, "Valid bigram. Kanji suffix (>= 2).");
return;
}
// Check if the word is in the dictionary or not.
// For Hiragana words, check if that word is in a key of values.
// This is for a situation that
// ありがとうございました is not in the dictionary, but
// ありがとう御座いました is in the dictionary.
if (ctype == Util::HIRAGANA) {
if (!dictionary_->HasKey(key)) {
result->removed = true;
MOZC_WORD_LOG(*result, "Removed. No keys are found.");
return;
}
} else {
FindValueCallback callback(value);
dictionary_->LookupPrefix(key, request, &callback);
if (!callback.found()) {
result->removed = true;
MOZC_WORD_LOG(*result, "Removed. No prefix found.");
return;
}
}
MOZC_WORD_LOG(*result, "Valid bigram.");
}
void DictionaryPredictor::GetPredictiveResults(
const DictionaryInterface &dictionary, const std::string &history_key,
const ConversionRequest &request, const Segments &segments,
PredictionTypes types, size_t lookup_limit,
Segment::Candidate::SourceInfo source_info, int unknown_id_,
std::vector<Result> *results) {
if (!request.has_composer()) {
std::string input_key = history_key;
input_key.append(segments.conversion_segment(0).key());
PredictiveLookupCallback callback(types, lookup_limit, input_key.size(),
nullptr, source_info, unknown_id_, "",
GetSpatialCostParams(request), results);
dictionary.LookupPredictive(input_key, request, &callback);
return;
}
// If we have ambiguity for the input, get expanded key.
// Example1 roman input: for "あk", we will get |base|, "あ" and |expanded|,
// "か", "き", etc
// Example2 kana input: for "あか", we will get |base|, "あ" and |expanded|,
// "か", and "が".
std::string base;
std::set<std::string> expanded;
request.composer().GetQueriesForPrediction(&base, &expanded);
std::string input_key;
if (expanded.empty()) {
input_key.assign(history_key).append(base);
PredictiveLookupCallback callback(types, lookup_limit, input_key.size(),
nullptr, source_info, unknown_id_, "",
GetSpatialCostParams(request), results);
dictionary.LookupPredictive(input_key, request, &callback);
return;
}
// `non_expanded_original_key` keeps the original key request before
// key expansions. This key is passed to the callback so that it can
// identify whether the key is actually expanded or not.
const std::string non_expanded_original_key =
IsEnableNewSpatialScoring(request)
? history_key + segments.conversion_segment(0).key()
: "";
// |expanded| is a very small set, so calling LookupPredictive multiple
// times is not so expensive. Also, the number of lookup results is limited
// by |lookup_limit|.
for (const std::string &expanded_char : expanded) {
input_key.assign(history_key).append(base).append(expanded_char);
PredictiveLookupCallback callback(types, lookup_limit, input_key.size(),
nullptr, source_info, unknown_id_,
non_expanded_original_key,
GetSpatialCostParams(request), results);
dictionary.LookupPredictive(input_key, request, &callback);
}
}
void DictionaryPredictor::GetPredictiveResultsForBigram(
const DictionaryInterface &dictionary, const std::string &history_key,
const std::string &history_value, const ConversionRequest &request,
const Segments &segments, PredictionTypes types, size_t lookup_limit,
Segment::Candidate::SourceInfo source_info, int unknown_id_,
std::vector<Result> *results) const {
if (!request.has_composer()) {
std::string input_key = history_key;
input_key.append(segments.conversion_segment(0).key());
PredictiveBigramLookupCallback callback(
types, lookup_limit, input_key.size(), nullptr, history_value,
source_info, unknown_id_, "", GetSpatialCostParams(request), results);
dictionary.LookupPredictive(input_key, request, &callback);
return;
}
// If we have ambiguity for the input, get expanded key.
// Example1 roman input: for "あk", we will get |base|, "あ" and |expanded|,
// "か", "き", etc
// Example2 kana input: for "あか", we will get |base|, "あ" and |expanded|,
// "か", and "が".
std::string base;
std::set<std::string> expanded;
request.composer().GetQueriesForPrediction(&base, &expanded);
const std::string input_key = history_key + base;
const std::string non_expanded_original_key =
IsEnableNewSpatialScoring(request)
? history_key + segments.conversion_segment(0).key()
: "";
PredictiveBigramLookupCallback callback(
types, lookup_limit, input_key.size(),
expanded.empty() ? nullptr : &expanded, history_value, source_info,
unknown_id_, non_expanded_original_key, GetSpatialCostParams(request),
results);
dictionary.LookupPredictive(input_key, request, &callback);
}
void DictionaryPredictor::GetPredictiveResultsForEnglishKey(
const DictionaryInterface &dictionary, const ConversionRequest &request,
const std::string &input_key, PredictionTypes types, size_t lookup_limit,
std::vector<Result> *results) const {
const size_t prev_results_size = results->size();
if (Util::IsUpperAscii(input_key)) {
// For upper case key, look up its lower case version and then transform
// the results to upper case.
std::string key(input_key);
Util::LowerString(&key);
PredictiveLookupCallback callback(types, lookup_limit, key.size(), nullptr,
Segment::Candidate::SOURCE_INFO_NONE,
unknown_id_, "",
GetSpatialCostParams(request), results);
dictionary.LookupPredictive(key, request, &callback);
for (size_t i = prev_results_size; i < results->size(); ++i) {
Util::UpperString(&(*results)[i].value);
}
} else if (Util::IsCapitalizedAscii(input_key)) {
// For capitalized key, look up its lower case version and then transform
// the results to capital.
std::string key(input_key);
Util::LowerString(&key);
PredictiveLookupCallback callback(types, lookup_limit, key.size(), nullptr,
Segment::Candidate::SOURCE_INFO_NONE,
unknown_id_, "",
GetSpatialCostParams(request), results);
dictionary.LookupPredictive(key, request, &callback);
for (size_t i = prev_results_size; i < results->size(); ++i) {
Util::CapitalizeString(&(*results)[i].value);
}
} else {
// For other cases (lower and as-is), just look up directly.
PredictiveLookupCallback callback(
types, lookup_limit, input_key.size(), nullptr,
Segment::Candidate::SOURCE_INFO_NONE, unknown_id_, "",
GetSpatialCostParams(request), results);
dictionary.LookupPredictive(input_key, request, &callback);
}
// If input mode is FULL_ASCII, then convert the results to full-width.
if (request.has_composer() &&
request.composer().GetInputMode() == transliteration::FULL_ASCII) {
std::string tmp;
for (size_t i = prev_results_size; i < results->size(); ++i) {
tmp.assign((*results)[i].value);
japanese_util::HalfWidthAsciiToFullWidthAscii(tmp, &(*results)[i].value);
}
}
}
void DictionaryPredictor::GetPredictiveResultsUsingTypingCorrection(
const DictionaryInterface &dictionary, const std::string &history_key,
const ConversionRequest &request, const Segments &segments,
PredictionTypes types, size_t lookup_limit,
std::vector<Result> *results) const {
if (!request.has_composer()) {
return;
}
std::vector<composer::TypeCorrectedQuery> queries;
request.composer().GetTypeCorrectedQueriesForPrediction(&queries);
for (size_t query_index = 0; query_index < queries.size(); ++query_index) {
const composer::TypeCorrectedQuery &query = queries[query_index];
const std::string input_key = history_key + query.base;
const size_t previous_results_size = results->size();
PredictiveLookupCallback callback(
types, lookup_limit, input_key.size(),
query.expanded.empty() ? nullptr : &query.expanded,
Segment::Candidate::SOURCE_INFO_NONE, unknown_id_, "",
GetSpatialCostParams(request), results);
dictionary.LookupPredictive(input_key, request, &callback);
for (size_t i = previous_results_size; i < results->size(); ++i) {
(*results)[i].wcost += query.cost;
}
lookup_limit -= results->size() - previous_results_size;
if (lookup_limit <= 0) {
break;
}
}
}
// static
bool DictionaryPredictor::GetZeroQueryCandidatesForKey(
const ConversionRequest &request, const std::string &key,
const ZeroQueryDict &dict, std::vector<ZeroQueryResult> *results) {
const int32_t available_emoji_carrier =
request.request().available_emoji_carrier();
DCHECK(results);
results->clear();
auto range = dict.equal_range(key);
if (range.first == range.second) {
return false;
}
for (; range.first != range.second; ++range.first) {
const auto &entry = range.first;
if (entry.type() != ZERO_QUERY_EMOJI) {
results->push_back(
std::make_pair(std::string(entry.value()), entry.type()));
continue;
}
if (available_emoji_carrier & Request::UNICODE_EMOJI &&
entry.emoji_type() & EMOJI_UNICODE) {
results->push_back(
std::make_pair(std::string(entry.value()), entry.type()));
continue;
}
if ((available_emoji_carrier & Request::DOCOMO_EMOJI &&
entry.emoji_type() & EMOJI_DOCOMO) ||
(available_emoji_carrier & Request::SOFTBANK_EMOJI &&
entry.emoji_type() & EMOJI_SOFTBANK) ||
(available_emoji_carrier & Request::KDDI_EMOJI &&
entry.emoji_type() & EMOJI_KDDI)) {
std::string android_pua;
Util::Ucs4ToUtf8(entry.emoji_android_pua(), &android_pua);
results->push_back(std::make_pair(android_pua, entry.type()));
}
}
return !results->empty();
}
// static
void DictionaryPredictor::AppendZeroQueryToResults(
const std::vector<ZeroQueryResult> &candidates, uint16_t lid, uint16_t rid,
std::vector<Result> *results) {
int cost = 0;
for (size_t i = 0; i < candidates.size(); ++i) {
// Increment cost to show the candidates in order.
constexpr int kSuffixPenalty = 10;
results->push_back(Result());
Result *result = &results->back();
result->SetTypesAndTokenAttributes(SUFFIX, Token::NONE);
result->SetSourceInfoForZeroQuery(candidates[i].second);
result->key = candidates[i].first;
result->value = candidates[i].first;
result->wcost = cost;
result->lid = lid;
result->rid = rid;
cost += kSuffixPenalty;
}
}
// Returns true if we add zero query result.
bool DictionaryPredictor::AggregateNumberZeroQueryPrediction(
const ConversionRequest &request, const Segments &segments,
std::vector<Result> *results) const {
std::string number_key;
if (!GetNumberHistory(segments, &number_key)) {
return false;
}
std::vector<ZeroQueryResult> candidates_for_number_key;
GetZeroQueryCandidatesForKey(request, number_key, zero_query_number_dict_,
&candidates_for_number_key);
std::vector<ZeroQueryResult> default_candidates_for_number;
GetZeroQueryCandidatesForKey(request, "default", zero_query_number_dict_,
&default_candidates_for_number);
DCHECK(!default_candidates_for_number.empty());
AppendZeroQueryToResults(candidates_for_number_key, counter_suffix_word_id_,
counter_suffix_word_id_, results);
AppendZeroQueryToResults(default_candidates_for_number,
counter_suffix_word_id_, counter_suffix_word_id_,
results);
return true;
}
// Returns true if we add zero query result.
bool DictionaryPredictor::AggregateZeroQueryPrediction(
const ConversionRequest &request, const Segments &segments,
std::vector<Result> *results) const {
const size_t history_size = segments.history_segments_size();
if (history_size <= 0) {
return false;
}
const Segment &last_segment = segments.history_segment(history_size - 1);
DCHECK_GT(last_segment.candidates_size(), 0);
const std::string &history_value = last_segment.candidate(0).value;
std::vector<ZeroQueryResult> candidates;
if (!GetZeroQueryCandidatesForKey(request, history_value, zero_query_dict_,
&candidates)) {
return false;
}
const uint16_t kId = 0; // EOS
AppendZeroQueryToResults(candidates, kId, kId, results);
return true;
}
void DictionaryPredictor::AggregateSuffixPrediction(
const ConversionRequest &request, const Segments &segments,
std::vector<Result> *results) const {
DCHECK_GT(segments.conversion_segments_size(), 0);
DCHECK(!segments.conversion_segment(0).key().empty()); // Not zero query
// Uses larger cutoff (kPredictionMaxResultsSize) in order to consider
// all suffix entries.
const size_t cutoff_threshold = kPredictionMaxResultsSize;
const std::string kEmptyHistoryKey = "";
GetPredictiveResults(*suffix_dictionary_, kEmptyHistoryKey, request, segments,
SUFFIX, cutoff_threshold,
Segment::Candidate::SOURCE_INFO_NONE, unknown_id_,
results);
}
void DictionaryPredictor::AggregateZeroQuerySuffixPrediction(
const ConversionRequest &request, const Segments &segments,
std::vector<Result> *results) const {
DCHECK_GT(segments.conversion_segments_size(), 0);
DCHECK(segments.conversion_segment(0).key().empty());
if (AggregateNumberZeroQueryPrediction(request, segments, results)) {
return;
}
AggregateZeroQueryPrediction(request, segments, results);
if (IsLatinInputMode(request)) {
// We do not want zero query results from suffix dictionary for Latin
// input mode. For example, we do not need "です", "。" just after "when".
return;
}
// Uses larger cutoff (kPredictionMaxResultsSize) in order to consider
// all suffix entries.
const size_t cutoff_threshold = kPredictionMaxResultsSize;
const std::string kEmptyHistoryKey = "";
GetPredictiveResults(
*suffix_dictionary_, kEmptyHistoryKey, request, segments, SUFFIX,
cutoff_threshold,
Segment::Candidate::DICTIONARY_PREDICTOR_ZERO_QUERY_SUFFIX, unknown_id_,
results);
}
void DictionaryPredictor::AggregateEnglishPrediction(
const ConversionRequest &request, const Segments &segments,
std::vector<Result> *results) const {
DCHECK(results);
DCHECK(dictionary_);
const size_t cutoff_threshold = GetCandidateCutoffThreshold(segments);
const size_t prev_results_size = results->size();
const std::string &input_key = segments.conversion_segment(0).key();
GetPredictiveResultsForEnglishKey(*dictionary_, request, input_key, ENGLISH,
cutoff_threshold, results);
size_t unigram_results_size = results->size() - prev_results_size;
if (unigram_results_size >= cutoff_threshold) {
results->resize(prev_results_size);
return;
}
}
void DictionaryPredictor::AggregateEnglishPredictionUsingRawInput(
const ConversionRequest &request, const Segments &segments,
std::vector<Result> *results) const {
DCHECK(results);
DCHECK(dictionary_);
if (!request.has_composer()) {
return;
}
const size_t cutoff_threshold = GetCandidateCutoffThreshold(segments);
const size_t prev_results_size = results->size();
std::string input_key;
request.composer().GetRawString(&input_key);
GetPredictiveResultsForEnglishKey(*dictionary_, request, input_key, ENGLISH,
cutoff_threshold, results);
size_t unigram_results_size = results->size() - prev_results_size;
if (unigram_results_size >= cutoff_threshold) {
results->resize(prev_results_size);
return;
}
}
void DictionaryPredictor::AggregateTypeCorrectingPrediction(
const ConversionRequest &request, const Segments &segments,
std::vector<Result> *results) const {
DCHECK(results);
DCHECK(dictionary_);
const size_t prev_results_size = results->size();
if (prev_results_size > 10000) {
return;
}
const size_t cutoff_threshold = GetCandidateCutoffThreshold(segments);
// Currently, history key is never utilized.
const std::string kEmptyHistoryKey = "";
GetPredictiveResultsUsingTypingCorrection(
*dictionary_, kEmptyHistoryKey, request, segments, TYPING_CORRECTION,
cutoff_threshold, results);
if (results->size() - prev_results_size >= cutoff_threshold) {
results->resize(prev_results_size);
return;
}
}
bool DictionaryPredictor::ShouldAggregateRealTimeConversionResults(
const ConversionRequest &request, const Segments &segments) {
constexpr size_t kMaxRealtimeKeySize = 300; // 300 bytes in UTF8
const std::string &key = segments.conversion_segment(0).key();
if (key.empty() || key.size() >= kMaxRealtimeKeySize) {
// 1) If key is empty, realtime conversion doesn't work.
// 2) If the key is too long, we'll hit a performance issue.
return false;
}
return (segments.request_type() == Segments::PARTIAL_SUGGESTION ||
request.config().use_realtime_conversion() ||
IsMixedConversionEnabled(request.request()));
}
bool DictionaryPredictor::IsZipCodeRequest(const std::string &key) {
if (key.empty()) {
return false;
}
for (ConstChar32Iterator iter(key); !iter.Done(); iter.Next()) {
const char32 c = iter.Get();
if (!('0' <= c && c <= '9') && (c != '-')) {
return false;
}
}
return true;
}
} // namespace mozc
#undef MOZC_WORD_LOG_MESSAGE
#undef MOZC_WORD_LOG
| fcitx/mozc | src/prediction/dictionary_predictor.cc | C++ | bsd-3-clause | 88,483 | [
30522,
1013,
1013,
9385,
2230,
1011,
25682,
1010,
8224,
4297,
1012,
1013,
1013,
2035,
2916,
9235,
1012,
1013,
1013,
1013,
1013,
25707,
1998,
2224,
1999,
3120,
1998,
12441,
3596,
1010,
2007,
2030,
2302,
1013,
1013,
14080,
1010,
2024,
7936,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
"""
Workaround for a conda-build bug where failing to compile some Python files
results in a build failure.
See https://github.com/conda/conda-build/issues/1001
"""
import os
import sys
py2_only_files = []
py3_only_files = [
'numba/tests/annotation_usecases.py',
]
def remove_files(basedir):
"""
Remove unwanted files from the current source tree
"""
if sys.version_info >= (3,):
removelist = py2_only_files
msg = "Python 2-only file"
else:
removelist = py3_only_files
msg = "Python 3-only file"
for relpath in removelist:
path = os.path.join(basedir, relpath)
print("Removing %s %r" % (msg, relpath))
os.remove(path)
if __name__ == "__main__":
remove_files('.')
| stefanseefeld/numba | buildscripts/remove_unwanted_files.py | Python | bsd-2-clause | 764 | [
30522,
1000,
1000,
1000,
2147,
24490,
2005,
1037,
9530,
2850,
1011,
3857,
11829,
2073,
7989,
2000,
4012,
22090,
2070,
18750,
6764,
3463,
1999,
1037,
3857,
4945,
1012,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
9530... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
##################################################################
# Karnaf HelpDesk System - Copyright (C) 2001-2015 Kobi Shmueli. #
# See the LICENSE file for more information. #
##################################################################
require_once("karnaf_header.php");
if(isset($_GET['team'])) $team = $_GET['team'];
else $team = "none";
if(!IsKarnafAdminSession() && !IsGroupMember($team)) AccessDenied();
show_title("Karnaf - Team Stats");
make_menus("Karnaf (HelpDesk)");
# 1 week:
#$starttime = time() - 604800;
# 30 days:
#$starttime = time() - (86400*30);
if(isset($_GET['months'])) $months = (int)$_GET['months'];
else $months = 1;
$starttime = time() - (86400*30*$months);
$replies = 0;
$ureplies = 0;
?>
Statistics between <?=showdate($starttime)?> to <?=showdate(time())?><br><br>
<table border="1">
<tr>
<th><?=USER_FIELD?></th>
<th>Replies to unique tickets</th>
<th>Total Replies</th>
</tr>
<?
$query = squery("SELECT u.user FROM group_members AS gm INNER JOIN users AS u ON u.id=gm.user_id WHERE gm.group_id=(SELECT id FROM groups WHERE name='%s')", $team);
while($result = sql_fetch_array($query)) {
echo "<tr>\n";
echo "<td>".$result['user']."</td>\n";
$query2 = squery("SELECT COUNT(DISTINCT(r.tid)) FROM (karnaf_replies AS r INNER JOIN karnaf_tickets AS t ON t.id=r.tid) WHERE r.r_time>%d AND r.r_by='%s' AND t.rep_g='%s'",
$starttime, $result['user'], $team);
if($result2 = sql_fetch_array($query2)) {
$ureplies += (int)$result2[0];
echo "<td align=\"center\">".$result2[0]."</td>\n";
}
sql_free_result($query2);
$query2 = squery("SELECT COUNT(r.tid) FROM (karnaf_replies AS r INNER JOIN karnaf_tickets AS t ON t.id=r.tid) WHERE r.r_time>%d AND r.r_by='%s' AND t.rep_g='%s'",
$starttime, $result['user'], $team);
if($result2 = sql_fetch_array($query2)) {
$replies += (int)$result2[0];
echo "<td align=\"center\">".$result2[0]."</td>\n";
}
sql_free_result($query2);
echo "</tr>\n";
}
sql_free_result($query);
?>
<tr>
<td><b>Total</b></td>
<td align="center"><b><?=$ureplies?></b></td>
<td align="center"><b><?=$replies?></b></td>
</tr>
</table>
<?
require_once("karnaf_footer.php");
?>
| vik0803/karnaf | php/karnaf/teamstats.php | PHP | gpl-3.0 | 2,221 | [
30522,
1026,
1029,
25718,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2012 Dmitri Melikyan
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
var nt;
var filterKeys;
var sampleNum;
exports.init = function() {
nt = global.nodetime;
filterKeys = {};
sampleNum = 0;
nt.on('sample', function(sample) {
if(!nt.headless && nt.sessionId) {
collectKeys(undefined, sample, 0);
sampleNum++;
if(sampleNum == 1 || sampleNum == 10) {
sendKeys();
}
}
});
setInterval(function() {
try {
sendKeys();
}
catch(e) {
nt.error(e);
}
}, 60000);
};
var collectKeys = function(key, obj, depth) {
if(depth > 20) return 0;
var isArray = Array.isArray(obj);
for(var prop in obj) {
if(prop.match(/^\_/)) continue;
if(typeof obj[prop] === 'object') {
collectKeys(prop, obj[prop], depth + 1);
}
else {
if(!isArray) {
filterKeys[prop] = true;
}
else {
filterKeys[key] = true;
}
}
}
};
var sendKeys = function() {
var keys = [];
for(var prop in filterKeys) {
keys.push(prop);
}
keys = keys.sort(function(a, b) {
a = a.toLowerCase();
b = b.toLowerCase();
if(a > b) return 1;
if(a < b) return -1;
return 0;
});
if(keys.length > 0) {
nt.agent.send({cmd: 'updateFilterKeys', args: keys});
}
};
var PredicateFilter = function() {
}
exports.PredicateFilter = PredicateFilter;
PredicateFilter.prototype.preparePredicates = function(preds) {
preds.forEach(function(pred) {
try{
pred.valNum = parseFloat(pred.val)
}
catch(err) {
}
try{
if(pred.op === 'match') pred.valRe = new RegExp(pred.val);
if(typeof pred.val === 'string') pred.valLc = pred.val.toLowerCase();
}
catch(err) {
return nt.error(err);
}
});
this.preds = preds;
return true;
}
PredicateFilter.prototype.filter = function(sample) {
var matched = 0;
this.preds.forEach(function(pred) {
matched += walk(pred, sample, 0);
});
return (matched > 0);
};
function walk(pred, obj, depth) {
if(depth > 20) return 0;
var matched = 0;
for(var prop in obj) {
var val = obj[prop];
if(val === undefined || val === null) {
continue;
}
else if(typeof val === 'object') {
matched += walk(pred, val, depth + 1);
}
else if((pred.key === '*' || pred.key === prop) && test(pred, val)) {
matched++;
}
if(matched) break;
}
return matched;
}
function test(pred, val) {
var ret = false;
if(typeof val === 'number') {
if(pred.valNum !== NaN) {
if (pred.op === '==') {
ret = (val == pred.valNum);
}
else if (pred.op === '!=') {
ret = (val != pred.valNum);
}
else if (pred.op === '<') {
ret = (val < pred.valNum);
}
else if (pred.op === '>') {
ret = (val > pred.valNum);
}
}
}
else if(typeof val === 'string') {
if(pred.op === 'match' && pred.valRe) {
ret = pred.valRe.exec(val);
}
else if (pred.op === '==') {
ret = (val.toLowerCase() == pred.valLc);
}
else if (pred.op === '!=') {
ret = (val.toLowerCase() != pred.valLc);
}
}
return ret;
}
| umaar/nodetime | lib/filter.js | JavaScript | mit | 4,266 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2262,
28316,
11463,
5480,
7054,
1008,
1008,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
1010,
2000,
2151,
2711,
11381,
1037,
1008,
6100,
1997,
2023,
4007,
1998,
3378,
12653,
6764,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
define([
'jquery',
'underscore',
'backbone',
'text!template/login.html',
'models/campus'
], function ($, _, Backbone, LoginTemplate, CampusModel) {
var LoginView = Backbone.View.extend({
tagName: 'section',
className: 'container',
template: _.template(LoginTemplate),
events: {
'submit #frm-login': 'frmLoginOnSubmit',
'click #chk-password': 'chkPasswordOnCheck'
},
render: function () {
this.el.innerHTML = this.template();
return this;
},
frmLoginOnSubmit: function (e) {
e.preventDefault();
var self = this;
var hostName = self.$('#txt-hostname').val().trim();
var username = self.$('#txt-username').val().trim();
var password = self.$('#txt-password').val().trim();
if (!hostName) {
return;
}
if (!username) {
return;
}
if (!password) {
return;
}
self.$('#btn-submit').prop('disabled', true);
var checkingLogin = $.post(hostName + '/main/webservices/rest.php', {
action: 'loginNewMessages',
username: username,
password: password
});
$.when(checkingLogin).done(function (response) {
if (!response.status) {
self.$('#btn-submit').prop('disabled', false);
return;
}
var campusModel = new CampusModel({
url: hostName,
username: username,
apiKey: response.apiKey
});
var savingCampus = campusModel.save();
$.when(savingCampus).done(function () {
window.location.reload();
});
$.when(savingCampus).fail(function () {
self.$('#btn-submit').prop('disabled', false);
});
});
$.when(checkingLogin).fail(function () {
self.$('#btn-submit').prop('disabled', false);
});
},
chkPasswordOnCheck: function (e) {
var inputType = e.target.checked ? 'text' : 'password';
this.$('#txt-password').attr('type', inputType);
}
});
return LoginView;
});
| AngelFQC/fx-dev-edition | app/js/views/login.js | JavaScript | mpl-2.0 | 2,454 | [
30522,
9375,
1006,
1031,
1005,
1046,
4226,
2854,
1005,
1010,
1005,
2104,
9363,
2890,
1005,
1010,
1005,
21505,
1005,
1010,
1005,
3793,
999,
23561,
1013,
8833,
2378,
1012,
16129,
1005,
1010,
1005,
4275,
1013,
3721,
1005,
1033,
1010,
3853,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* drivers/i2c/chips/lis3dh.c - LIS3DH motion sensor driver
*
*
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/irq.h>
#include <linux/miscdevice.h>
#include <asm/uaccess.h>
#include <linux/delay.h>
#include <linux/input.h>
#include <linux/workqueue.h>
#include <linux/kobject.h>
#include <linux/earlysuspend.h>
#include <linux/platform_device.h>
#include <asm/atomic.h>
#include <cust_acc.h>
#include <linux/hwmsensor.h>
#include <linux/hwmsen_dev.h>
#include <linux/sensors_io.h>
#include "lis3dh.h"
#include <linux/hwmsen_helper.h>
#include <mach/mt_devs.h>
#include <mach/mt_typedefs.h>
#include <mach/mt_gpio.h>
#include <mach/mt_pm_ldo.h>
#define POWER_NONE_MACRO MT65XX_POWER_NONE
/*----------------------------------------------------------------------------*/
//#define I2C_DRIVERID_LIS3DH 345
/*----------------------------------------------------------------------------*/
#define DEBUG 1
/*----------------------------------------------------------------------------*/
#define CONFIG_LIS3DH_LOWPASS /*apply low pass filter on output*/
/*----------------------------------------------------------------------------*/
#define LIS3DH_AXIS_X 0
#define LIS3DH_AXIS_Y 1
#define LIS3DH_AXIS_Z 2
#define LIS3DH_AXES_NUM 3
#define LIS3DH_DATA_LEN 6
#define LIS3DH_DEV_NAME "LIS3DH"
/*----------------------------------------------------------------------------*/
static const struct i2c_device_id lis3dh_i2c_id[] = {{LIS3DH_DEV_NAME,0},{}};
/*the adapter id will be available in customization*/
static struct i2c_board_info __initdata i2c_LIS3DH={ I2C_BOARD_INFO("LIS3DH", (0x32>>1))};
//static unsigned short lis3dh_force[] = {0x00, LIS3DH_I2C_SLAVE_ADDR, I2C_CLIENT_END, I2C_CLIENT_END};
//static const unsigned short *const lis3dh_forces[] = { lis3dh_force, NULL };
//static struct i2c_client_address_data lis3dh_addr_data = { .forces = lis3dh_forces,};
/*----------------------------------------------------------------------------*/
static int lis3dh_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id);
static int lis3dh_i2c_remove(struct i2c_client *client);
//static int lis3dh_i2c_detect(struct i2c_client *client, int kind, struct i2c_board_info *info);
static int lis3dh_local_init(void);
static int lis3dh_remove(void);
static int lis3dh_init_flag =0; // 0<==>OK -1 <==> fail
/*----------------------------------------------------------------------------*/
typedef enum {
ADX_TRC_FILTER = 0x01,
ADX_TRC_RAWDATA = 0x02,
ADX_TRC_IOCTL = 0x04,
ADX_TRC_CALI = 0X08,
ADX_TRC_INFO = 0X10,
} ADX_TRC;
/*----------------------------------------------------------------------------*/
struct scale_factor{
u8 whole;
u8 fraction;
};
/*----------------------------------------------------------------------------*/
struct data_resolution {
struct scale_factor scalefactor;
int sensitivity;
};
/*----------------------------------------------------------------------------*/
#define C_MAX_FIR_LENGTH (32)
/*----------------------------------------------------------------------------*/
struct data_filter {
s16 raw[C_MAX_FIR_LENGTH][LIS3DH_AXES_NUM];
int sum[LIS3DH_AXES_NUM];
int num;
int idx;
};
/*----------------------------------------------------------------------------*/
static struct sensor_init_info lis3dh_init_info = {
.name = "lis3dh",
.init = lis3dh_local_init,
.uninit = lis3dh_remove,
};
/*----------------------------------------------------------------------------*/
struct lis3dh_i2c_data {
struct i2c_client *client;
struct acc_hw *hw;
struct hwmsen_convert cvt;
/*misc*/
struct data_resolution *reso;
atomic_t trace;
atomic_t suspend;
atomic_t selftest;
atomic_t filter;
s16 cali_sw[LIS3DH_AXES_NUM+1];
/*data*/
s8 offset[LIS3DH_AXES_NUM+1]; /*+1: for 4-byte alignment*/
s16 data[LIS3DH_AXES_NUM+1];
#if defined(CONFIG_LIS3DH_LOWPASS)
atomic_t firlen;
atomic_t fir_en;
struct data_filter fir;
#endif
/*early suspend*/
#if defined(CONFIG_HAS_EARLYSUSPEND)
struct early_suspend early_drv;
#endif
};
/*----------------------------------------------------------------------------*/
static struct i2c_driver lis3dh_i2c_driver = {
.driver = {
// .owner = THIS_MODULE,
.name = LIS3DH_DEV_NAME,
},
.probe = lis3dh_i2c_probe,
.remove = lis3dh_i2c_remove,
// .detect = lis3dh_i2c_detect,
#if !defined(CONFIG_HAS_EARLYSUSPEND)
.suspend = lis3dh_suspend,
.resume = lis3dh_resume,
#endif
.id_table = lis3dh_i2c_id,
// .address_data = &lis3dh_addr_data,
};
/*----------------------------------------------------------------------------*/
static struct i2c_client *lis3dh_i2c_client = NULL;
//static struct platform_driver lis3dh_gsensor_driver;
static struct lis3dh_i2c_data *obj_i2c_data = NULL;
static bool sensor_power = false;
static GSENSOR_VECTOR3D gsensor_gain, gsensor_offset;
//static char selftestRes[10] = {0};
/*----------------------------------------------------------------------------*/
#define GSE_TAG "[Gsensor] "
#define GSE_FUN(f) printk(KERN_INFO GSE_TAG"%s\n", __FUNCTION__)
#define GSE_ERR(fmt, args...) printk(KERN_ERR GSE_TAG"%s %d : "fmt, __FUNCTION__, __LINE__, ##args)
#define GSE_LOG(fmt, args...) printk(KERN_INFO GSE_TAG fmt, ##args)
/*----------------------------------------------------------------------------*/
static struct data_resolution lis3dh_data_resolution[] = {
/* combination by {FULL_RES,RANGE}*/
{{ 1, 0}, 1024}, // dataformat +/-2g in 12-bit resolution; { 1, 0} = 1.0 = (2*2*1000)/(2^12); 1024 = (2^12)/(2*2)
{{ 1, 9}, 512}, // dataformat +/-4g in 12-bit resolution; { 1, 9} = 1.9 = (2*4*1000)/(2^12); 512 = (2^12)/(2*4)
{{ 3, 9}, 256}, // dataformat +/-8g in 12-bit resolution; { 1, 0} = 1.0 = (2*8*1000)/(2^12); 1024 = (2^12)/(2*8)
};
/*----------------------------------------------------------------------------*/
static struct data_resolution lis3dh_offset_resolution = {{15, 6}, 64};
/*
static int hwmsen_read_byte_sr(struct i2c_client *client, u8 addr, u8 *data)
{
u8 buf;
int ret = 0;
client->addr = client->addr& I2C_MASK_FLAG | I2C_WR_FLAG |I2C_RS_FLAG;
buf = addr;
ret = i2c_master_send(client, (const char*)&buf, 1<<8 | 1);
//ret = i2c_master_send(client, (const char*)&buf, 1);
if (ret < 0) {
GSE_ERR("send command error!!\n");
return -EFAULT;
}
*data = buf;
client->addr = client->addr& I2C_MASK_FLAG;
return 0;
}
*/
static void dumpReg(struct i2c_client *client)
{
int i=0;
u8 addr = 0x20;
u8 regdata=0;
for(i=0; i<3 ; i++)
{
//dump all
hwmsen_read_byte(client,addr,®data);
GSE_LOG("Reg addr=%x regdata=%x\n",addr,regdata);
addr++;
}
}
/*--------------------ADXL power control function----------------------------------*/
static void LIS3DH_power(struct acc_hw *hw, unsigned int on)
{
static unsigned int power_on = 0;
if(hw->power_id != POWER_NONE_MACRO) // have externel LDO
{
GSE_LOG("power %s\n", on ? "on" : "off");
if(power_on == on) // power status not change
{
GSE_LOG("ignore power control: %d\n", on);
}
else if(on) // power on
{
if(!hwPowerOn(hw->power_id, hw->power_vol, "LIS3DH"))
{
GSE_ERR("power on fails!!\n");
}
}
else // power off
{
if (!hwPowerDown(hw->power_id, "LIS3DH"))
{
GSE_ERR("power off fail!!\n");
}
}
}
power_on = on;
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_SetDataResolution(struct lis3dh_i2c_data *obj)
{
int err = 0;
u8 dat, reso;
err = hwmsen_read_byte(obj->client, LIS3DH_REG_CTL_REG4, &dat);
if(err)
{
GSE_ERR("write data format fail!!\n");
return err;
}
/*the data_reso is combined by 3 bits: {FULL_RES, DATA_RANGE}*/
reso = (dat & 0x30)<<4;
if(reso >= 0x3)
reso = 0x2;
if(reso < sizeof(lis3dh_data_resolution)/sizeof(lis3dh_data_resolution[0]))
{
obj->reso = &lis3dh_data_resolution[reso];
return 0;
}
else
{
return -EINVAL;
}
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_ReadData(struct i2c_client *client, s16 data[LIS3DH_AXES_NUM])
{
struct lis3dh_i2c_data *priv = i2c_get_clientdata(client);
// u8 addr = LIS3DH_REG_DATAX0;
u8 buf[LIS3DH_DATA_LEN] = {0};
int err = 0;
if(NULL == client)
{
err = -EINVAL;
}
else
{
if(hwmsen_read_block(client, LIS3DH_REG_OUT_X, buf, 0x01))
{
GSE_ERR("read G sensor data register err!\n");
return -1;
}
if(hwmsen_read_block(client, LIS3DH_REG_OUT_X+1, &buf[1], 0x01))
{
GSE_ERR("read G sensor data register err!\n");
return -1;
}
data[LIS3DH_AXIS_X] = (s16)((buf[0]+(buf[1]<<8))>>4);
if(hwmsen_read_block(client, LIS3DH_REG_OUT_Y, &buf[2], 0x01))
{
GSE_ERR("read G sensor data register err!\n");
return -1;
}
if(hwmsen_read_block(client, LIS3DH_REG_OUT_Y+1, &buf[3], 0x01))
{
GSE_ERR("read G sensor data register err!\n");
return -1;
}
data[LIS3DH_AXIS_Y] = (s16)((s16)(buf[2] +( buf[3]<<8))>>4);
if(hwmsen_read_block(client, LIS3DH_REG_OUT_Z, &buf[4], 0x01))
{
GSE_ERR("read G sensor data register err!\n");
return -1;
}
if(hwmsen_read_block(client, LIS3DH_REG_OUT_Z+1, &buf[5], 0x01))
{
GSE_ERR("read G sensor data register err!\n");
return -1;
}
data[LIS3DH_AXIS_Z] =(s16)((buf[4]+(buf[5]<<8))>>4);
//GSE_LOG("[%08X %08X %08X %08x %08x %08x]\n",buf[0],buf[1],buf[2],buf[3],buf[4],buf[5]);
data[LIS3DH_AXIS_X] &= 0xfff;
data[LIS3DH_AXIS_Y] &= 0xfff;
data[LIS3DH_AXIS_Z] &= 0xfff;
if(atomic_read(&priv->trace) & ADX_TRC_RAWDATA)
{
GSE_LOG("[%08X %08X %08X] => [%5d %5d %5d]\n", data[LIS3DH_AXIS_X], data[LIS3DH_AXIS_Y], data[LIS3DH_AXIS_Z],
data[LIS3DH_AXIS_X], data[LIS3DH_AXIS_Y], data[LIS3DH_AXIS_Z]);
}
if(data[LIS3DH_AXIS_X]&0x800)
{
data[LIS3DH_AXIS_X] = ~data[LIS3DH_AXIS_X];
data[LIS3DH_AXIS_X] &= 0xfff;
data[LIS3DH_AXIS_X]+=1;
data[LIS3DH_AXIS_X] = -data[LIS3DH_AXIS_X];
}
if(data[LIS3DH_AXIS_Y]&0x800)
{
data[LIS3DH_AXIS_Y] = ~data[LIS3DH_AXIS_Y];
data[LIS3DH_AXIS_Y] &= 0xfff;
data[LIS3DH_AXIS_Y]+=1;
data[LIS3DH_AXIS_Y] = -data[LIS3DH_AXIS_Y];
}
if(data[LIS3DH_AXIS_Z]&0x800)
{
data[LIS3DH_AXIS_Z] = ~data[LIS3DH_AXIS_Z];
data[LIS3DH_AXIS_Z] &= 0xfff;
data[LIS3DH_AXIS_Z]+=1;
data[LIS3DH_AXIS_Z] = -data[LIS3DH_AXIS_Z];
}
if(atomic_read(&priv->trace) & ADX_TRC_RAWDATA)
{
GSE_LOG("[%08X %08X %08X] => [%5d %5d %5d] after\n", data[LIS3DH_AXIS_X], data[LIS3DH_AXIS_Y], data[LIS3DH_AXIS_Z],
data[LIS3DH_AXIS_X], data[LIS3DH_AXIS_Y], data[LIS3DH_AXIS_Z]);
}
#ifdef CONFIG_LIS3DH_LOWPASS
if(atomic_read(&priv->filter))
{
if(atomic_read(&priv->fir_en) && !atomic_read(&priv->suspend))
{
int idx, firlen = atomic_read(&priv->firlen);
if(priv->fir.num < firlen)
{
priv->fir.raw[priv->fir.num][LIS3DH_AXIS_X] = data[LIS3DH_AXIS_X];
priv->fir.raw[priv->fir.num][LIS3DH_AXIS_Y] = data[LIS3DH_AXIS_Y];
priv->fir.raw[priv->fir.num][LIS3DH_AXIS_Z] = data[LIS3DH_AXIS_Z];
priv->fir.sum[LIS3DH_AXIS_X] += data[LIS3DH_AXIS_X];
priv->fir.sum[LIS3DH_AXIS_Y] += data[LIS3DH_AXIS_Y];
priv->fir.sum[LIS3DH_AXIS_Z] += data[LIS3DH_AXIS_Z];
if(atomic_read(&priv->trace) & ADX_TRC_FILTER)
{
GSE_LOG("add [%2d] [%5d %5d %5d] => [%5d %5d %5d]\n", priv->fir.num,
priv->fir.raw[priv->fir.num][LIS3DH_AXIS_X], priv->fir.raw[priv->fir.num][LIS3DH_AXIS_Y], priv->fir.raw[priv->fir.num][LIS3DH_AXIS_Z],
priv->fir.sum[LIS3DH_AXIS_X], priv->fir.sum[LIS3DH_AXIS_Y], priv->fir.sum[LIS3DH_AXIS_Z]);
}
priv->fir.num++;
priv->fir.idx++;
}
else
{
idx = priv->fir.idx % firlen;
priv->fir.sum[LIS3DH_AXIS_X] -= priv->fir.raw[idx][LIS3DH_AXIS_X];
priv->fir.sum[LIS3DH_AXIS_Y] -= priv->fir.raw[idx][LIS3DH_AXIS_Y];
priv->fir.sum[LIS3DH_AXIS_Z] -= priv->fir.raw[idx][LIS3DH_AXIS_Z];
priv->fir.raw[idx][LIS3DH_AXIS_X] = data[LIS3DH_AXIS_X];
priv->fir.raw[idx][LIS3DH_AXIS_Y] = data[LIS3DH_AXIS_Y];
priv->fir.raw[idx][LIS3DH_AXIS_Z] = data[LIS3DH_AXIS_Z];
priv->fir.sum[LIS3DH_AXIS_X] += data[LIS3DH_AXIS_X];
priv->fir.sum[LIS3DH_AXIS_Y] += data[LIS3DH_AXIS_Y];
priv->fir.sum[LIS3DH_AXIS_Z] += data[LIS3DH_AXIS_Z];
priv->fir.idx++;
data[LIS3DH_AXIS_X] = priv->fir.sum[LIS3DH_AXIS_X]/firlen;
data[LIS3DH_AXIS_Y] = priv->fir.sum[LIS3DH_AXIS_Y]/firlen;
data[LIS3DH_AXIS_Z] = priv->fir.sum[LIS3DH_AXIS_Z]/firlen;
if(atomic_read(&priv->trace) & ADX_TRC_FILTER)
{
GSE_LOG("add [%2d] [%5d %5d %5d] => [%5d %5d %5d] : [%5d %5d %5d]\n", idx,
priv->fir.raw[idx][LIS3DH_AXIS_X], priv->fir.raw[idx][LIS3DH_AXIS_Y], priv->fir.raw[idx][LIS3DH_AXIS_Z],
priv->fir.sum[LIS3DH_AXIS_X], priv->fir.sum[LIS3DH_AXIS_Y], priv->fir.sum[LIS3DH_AXIS_Z],
data[LIS3DH_AXIS_X], data[LIS3DH_AXIS_Y], data[LIS3DH_AXIS_Z]);
}
}
}
}
#endif
}
return err;
}
/*----------------------------------------------------------------------------*/
/*
static int LIS3DH_ReadOffset(struct i2c_client *client, s8 ofs[LIS3DH_AXES_NUM])
{
int err;
return err;
}
*/
/*----------------------------------------------------------------------------*/
static int LIS3DH_ResetCalibration(struct i2c_client *client)
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
memset(obj->cali_sw, 0x00, sizeof(obj->cali_sw));
return 0;
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_ReadCalibration(struct i2c_client *client, int dat[LIS3DH_AXES_NUM])
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
dat[obj->cvt.map[LIS3DH_AXIS_X]] = obj->cvt.sign[LIS3DH_AXIS_X]*obj->cali_sw[LIS3DH_AXIS_X];
dat[obj->cvt.map[LIS3DH_AXIS_Y]] = obj->cvt.sign[LIS3DH_AXIS_Y]*obj->cali_sw[LIS3DH_AXIS_Y];
dat[obj->cvt.map[LIS3DH_AXIS_Z]] = obj->cvt.sign[LIS3DH_AXIS_Z]*obj->cali_sw[LIS3DH_AXIS_Z];
return 0;
}
/*----------------------------------------------------------------------------*/
/*
static int LIS3DH_ReadCalibrationEx(struct i2c_client *client, int act[LIS3DH_AXES_NUM], int raw[LIS3DH_AXES_NUM])
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
int err;
int mul;
if(err = LIS3DH_ReadOffset(client, obj->offset))
{
GSE_ERR("read offset fail, %d\n", err);
return err;
}
mul = obj->reso->sensitivity/lis3dh_offset_resolution.sensitivity;
raw[LIS3DH_AXIS_X] = obj->offset[LIS3DH_AXIS_X]*mul + obj->cali_sw[LIS3DH_AXIS_X];
raw[LIS3DH_AXIS_Y] = obj->offset[LIS3DH_AXIS_Y]*mul + obj->cali_sw[LIS3DH_AXIS_Y];
raw[LIS3DH_AXIS_Z] = obj->offset[LIS3DH_AXIS_Z]*mul + obj->cali_sw[LIS3DH_AXIS_Z];
act[obj->cvt.map[LIS3DH_AXIS_X]] = obj->cvt.sign[LIS3DH_AXIS_X]*raw[LIS3DH_AXIS_X];
act[obj->cvt.map[LIS3DH_AXIS_Y]] = obj->cvt.sign[LIS3DH_AXIS_Y]*raw[LIS3DH_AXIS_Y];
act[obj->cvt.map[LIS3DH_AXIS_Z]] = obj->cvt.sign[LIS3DH_AXIS_Z]*raw[LIS3DH_AXIS_Z];
return 0;
}
*/
/*----------------------------------------------------------------------------*/
static int LIS3DH_WriteCalibration(struct i2c_client *client, int dat[LIS3DH_AXES_NUM])
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
int err = 0;
// int cali[LIS3DH_AXES_NUM];
GSE_FUN();
if(!obj || ! dat)
{
GSE_ERR("null ptr!!\n");
return -EINVAL;
}
else
{
s16 cali[LIS3DH_AXES_NUM];
cali[obj->cvt.map[LIS3DH_AXIS_X]] = obj->cvt.sign[LIS3DH_AXIS_X]*obj->cali_sw[LIS3DH_AXIS_X];
cali[obj->cvt.map[LIS3DH_AXIS_Y]] = obj->cvt.sign[LIS3DH_AXIS_Y]*obj->cali_sw[LIS3DH_AXIS_Y];
cali[obj->cvt.map[LIS3DH_AXIS_Z]] = obj->cvt.sign[LIS3DH_AXIS_Z]*obj->cali_sw[LIS3DH_AXIS_Z];
cali[LIS3DH_AXIS_X] += dat[LIS3DH_AXIS_X];
cali[LIS3DH_AXIS_Y] += dat[LIS3DH_AXIS_Y];
cali[LIS3DH_AXIS_Z] += dat[LIS3DH_AXIS_Z];
obj->cali_sw[LIS3DH_AXIS_X] += obj->cvt.sign[LIS3DH_AXIS_X]*dat[obj->cvt.map[LIS3DH_AXIS_X]];
obj->cali_sw[LIS3DH_AXIS_Y] += obj->cvt.sign[LIS3DH_AXIS_Y]*dat[obj->cvt.map[LIS3DH_AXIS_Y]];
obj->cali_sw[LIS3DH_AXIS_Z] += obj->cvt.sign[LIS3DH_AXIS_Z]*dat[obj->cvt.map[LIS3DH_AXIS_Z]];
}
return err;
}
/*----------------------------------------------------------------------------*/
#if 0
static int LIS3DH_CheckDeviceID(struct i2c_client *client)
{
u8 databuf[10];
int res = 0;
/*
memset(databuf, 0, sizeof(u8)*10);
databuf[0] = LIS3DH_REG_DEVID;
res = i2c_master_send(client, databuf, 0x1);
if(res <= 0)
{
goto exit_LIS3DH_CheckDeviceID;
}
udelay(500);
databuf[0] = 0x0;
res = i2c_master_recv(client, databuf, 0x01);
if(res <= 0)
{
goto exit_LIS3DH_CheckDeviceID;
}
if(databuf[0]!=LIS3DH_FIXED_DEVID)
{
return LIS3DH_ERR_IDENTIFICATION;
}
exit_LIS3DH_CheckDeviceID:
if (res <= 0)
{
return LIS3DH_ERR_I2C;
}
*/
return LIS3DH_SUCCESS;
}
#endif
/*----------------------------------------------------------------------------*/
static int LIS3DH_SetPowerMode(struct i2c_client *client, bool enable)
{
u8 databuf[2];
int res = 0;
u8 addr = LIS3DH_REG_CTL_REG1;
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
if(enable == sensor_power)
{
GSE_LOG("Sensor power status is newest!\n");
return LIS3DH_SUCCESS;
}
if(hwmsen_read_byte(client, addr, &databuf[0]))
{
GSE_ERR("read power ctl register err!\n");
return LIS3DH_ERR_I2C;
}
databuf[0] &= ~LIS3DH_MEASURE_MODE;
if(enable == TRUE)
{
databuf[0] &= ~LIS3DH_MEASURE_MODE;
}
else
{
databuf[0] |= LIS3DH_MEASURE_MODE;
}
databuf[1] = databuf[0];
databuf[0] = LIS3DH_REG_CTL_REG1;
res = i2c_master_send(client, databuf, 0x2);
if(res <= 0)
{
GSE_LOG("set power mode failed!\n");
return LIS3DH_ERR_I2C;
}
else if(atomic_read(&obj->trace) & ADX_TRC_INFO)
{
GSE_LOG("set power mode ok %d!\n", databuf[1]);
}
sensor_power = enable;
return LIS3DH_SUCCESS;
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_SetDataFormat(struct i2c_client *client, u8 dataformat)
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
u8 databuf[10];
u8 addr = LIS3DH_REG_CTL_REG4;
int res = 0;
memset(databuf, 0, sizeof(u8)*10);
if(hwmsen_read_byte(client, addr, &databuf[0]))
{
GSE_ERR("read reg_ctl_reg1 register err!\n");
return LIS3DH_ERR_I2C;
}
databuf[0] &= ~0x30;
databuf[0] |=dataformat;
databuf[1] = databuf[0];
databuf[0] = LIS3DH_REG_CTL_REG4;
res = i2c_master_send(client, databuf, 0x2);
if(res <= 0)
{
return LIS3DH_ERR_I2C;
}
return LIS3DH_SetDataResolution(obj);
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_SetBWRate(struct i2c_client *client, u8 bwrate)
{
u8 databuf[10];
u8 addr = LIS3DH_REG_CTL_REG1;
int res = 0;
memset(databuf, 0, sizeof(u8)*10);
if(hwmsen_read_byte(client, addr, &databuf[0]))
{
GSE_ERR("read reg_ctl_reg1 register err!\n");
return LIS3DH_ERR_I2C;
}
databuf[0] &= ~0xF0;
databuf[0] |= bwrate;
databuf[1] = databuf[0];
databuf[0] = LIS3DH_REG_CTL_REG1;
res = i2c_master_send(client, databuf, 0x2);
if(res <= 0)
{
return LIS3DH_ERR_I2C;
}
return LIS3DH_SUCCESS;
}
/*----------------------------------------------------------------------------*/
//enalbe data ready interrupt
static int LIS3DH_SetIntEnable(struct i2c_client *client, u8 intenable)
{
u8 databuf[10];
u8 addr = LIS3DH_REG_CTL_REG3;
int res = 0;
memset(databuf, 0, sizeof(u8)*10);
if(hwmsen_read_byte(client, addr, &databuf[0]))
{
GSE_ERR("read reg_ctl_reg1 register err!\n");
return LIS3DH_ERR_I2C;
}
databuf[0] = 0x00;
databuf[1] = databuf[0];
databuf[0] = LIS3DH_REG_CTL_REG3;
res = i2c_master_send(client, databuf, 0x2);
if(res <= 0)
{
return LIS3DH_ERR_I2C;
}
return LIS3DH_SUCCESS;
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_Init(struct i2c_client *client, int reset_cali)
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
int res = 0;
/*
res = LIS3DH_CheckDeviceID(client);
if(res != LIS3DH_SUCCESS)
{
return res;
}
*/
// first clear reg1
res = hwmsen_write_byte(client,LIS3DH_REG_CTL_REG1,0x07);
if(res != LIS3DH_SUCCESS)
{
return res;
}
res = LIS3DH_SetPowerMode(client, false);
if(res != LIS3DH_SUCCESS)
{
return res;
}
res = LIS3DH_SetBWRate(client, LIS3DH_BW_100HZ);//400 or 100 no other choice
if(res != LIS3DH_SUCCESS )
{
return res;
}
res = LIS3DH_SetDataFormat(client, LIS3DH_RANGE_2G);//8g or 2G no oher choise
if(res != LIS3DH_SUCCESS)
{
return res;
}
gsensor_gain.x = gsensor_gain.y = gsensor_gain.z = obj->reso->sensitivity;
res = LIS3DH_SetIntEnable(client, false);
if(res != LIS3DH_SUCCESS)
{
return res;
}
if(0 != reset_cali)
{
//reset calibration only in power on
res = LIS3DH_ResetCalibration(client);
if(res != LIS3DH_SUCCESS)
{
return res;
}
}
#ifdef CONFIG_LIS3DH_LOWPASS
memset(&obj->fir, 0x00, sizeof(obj->fir));
#endif
return LIS3DH_SUCCESS;
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_ReadChipInfo(struct i2c_client *client, char *buf, int bufsize)
{
u8 databuf[10];
memset(databuf, 0, sizeof(u8)*10);
if((NULL == buf)||(bufsize<=30))
{
return -1;
}
if(NULL == client)
{
*buf = 0;
return -2;
}
sprintf(buf, "LIS3DH Chip");
return 0;
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_ReadSensorData(struct i2c_client *client, char *buf, int bufsize)
{
struct lis3dh_i2c_data *obj = (struct lis3dh_i2c_data*)i2c_get_clientdata(client);
u8 databuf[20];
int acc[LIS3DH_AXES_NUM];
int res = 0;
memset(databuf, 0, sizeof(u8)*10);
if(NULL == buf)
{
return -1;
}
if(NULL == client)
{
*buf = 0;
return -2;
}
if(sensor_power == FALSE)
{
res = LIS3DH_SetPowerMode(client, true);
if(res)
{
GSE_ERR("Power on lis3dh error %d!\n", res);
}
msleep(20);
}
if((res = LIS3DH_ReadData(client, obj->data)))
{
GSE_ERR("I2C error: ret value=%d", res);
return -3;
}
else
{
obj->data[LIS3DH_AXIS_X] += obj->cali_sw[LIS3DH_AXIS_X];
obj->data[LIS3DH_AXIS_Y] += obj->cali_sw[LIS3DH_AXIS_Y];
obj->data[LIS3DH_AXIS_Z] += obj->cali_sw[LIS3DH_AXIS_Z];
/*remap coordinate*/
acc[obj->cvt.map[LIS3DH_AXIS_X]] = obj->cvt.sign[LIS3DH_AXIS_X]*obj->data[LIS3DH_AXIS_X];
acc[obj->cvt.map[LIS3DH_AXIS_Y]] = obj->cvt.sign[LIS3DH_AXIS_Y]*obj->data[LIS3DH_AXIS_Y];
acc[obj->cvt.map[LIS3DH_AXIS_Z]] = obj->cvt.sign[LIS3DH_AXIS_Z]*obj->data[LIS3DH_AXIS_Z];
//GSE_LOG("Mapped gsensor data: %d, %d, %d!\n", acc[LIS3DH_AXIS_X], acc[LIS3DH_AXIS_Y], acc[LIS3DH_AXIS_Z]);
//Out put the mg
acc[LIS3DH_AXIS_X] = acc[LIS3DH_AXIS_X] * GRAVITY_EARTH_1000 / obj->reso->sensitivity;
acc[LIS3DH_AXIS_Y] = acc[LIS3DH_AXIS_Y] * GRAVITY_EARTH_1000 / obj->reso->sensitivity;
acc[LIS3DH_AXIS_Z] = acc[LIS3DH_AXIS_Z] * GRAVITY_EARTH_1000 / obj->reso->sensitivity;
sprintf(buf, "%04x %04x %04x", acc[LIS3DH_AXIS_X], acc[LIS3DH_AXIS_Y], acc[LIS3DH_AXIS_Z]);
if(atomic_read(&obj->trace) & ADX_TRC_IOCTL)//atomic_read(&obj->trace) & ADX_TRC_IOCTL
{
GSE_LOG("gsensor data: %s!\n", buf);
dumpReg(client);
}
}
return 0;
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_ReadRawData(struct i2c_client *client, char *buf)
{
struct lis3dh_i2c_data *obj = (struct lis3dh_i2c_data*)i2c_get_clientdata(client);
int res = 0;
if (!buf || !client)
{
return EINVAL;
}
if((res = LIS3DH_ReadData(client, obj->data)))
{
GSE_ERR("I2C error: ret value=%d", res);
return EIO;
}
else
{
sprintf(buf, "%04x %04x %04x", obj->data[LIS3DH_AXIS_X],
obj->data[LIS3DH_AXIS_Y], obj->data[LIS3DH_AXIS_Z]);
}
return 0;
}
/*----------------------------------------------------------------------------*/
static ssize_t show_chipinfo_value(struct device_driver *ddri, char *buf)
{
struct i2c_client *client = lis3dh_i2c_client;
char strbuf[LIS3DH_BUFSIZE];
if(NULL == client)
{
GSE_ERR("i2c client is null!!\n");
return 0;
}
LIS3DH_ReadChipInfo(client, strbuf, LIS3DH_BUFSIZE);
return snprintf(buf, PAGE_SIZE, "%s\n", strbuf);
}
/*----------------------------------------------------------------------------*/
static ssize_t show_sensordata_value(struct device_driver *ddri, char *buf)
{
struct i2c_client *client = lis3dh_i2c_client;
char strbuf[LIS3DH_BUFSIZE];
if(NULL == client)
{
GSE_ERR("i2c client is null!!\n");
return 0;
}
LIS3DH_ReadSensorData(client, strbuf, LIS3DH_BUFSIZE);
return snprintf(buf, PAGE_SIZE, "%s\n", strbuf);
}
/*----------------------------------------------------------------------------*/
static ssize_t show_cali_value(struct device_driver *ddri, char *buf)
{
struct i2c_client *client = lis3dh_i2c_client;
struct lis3dh_i2c_data *obj;
int err, len = 0, mul;
int tmp[LIS3DH_AXES_NUM];
if(NULL == client)
{
GSE_ERR("i2c client is null!!\n");
return 0;
}
obj = i2c_get_clientdata(client);
if((err = LIS3DH_ReadCalibration(client, tmp)))
{
return -EINVAL;
}
else
{
mul = obj->reso->sensitivity/lis3dh_offset_resolution.sensitivity;
len += snprintf(buf+len, PAGE_SIZE-len, "[HW ][%d] (%+3d, %+3d, %+3d) : (0x%02X, 0x%02X, 0x%02X)\n", mul,
obj->offset[LIS3DH_AXIS_X], obj->offset[LIS3DH_AXIS_Y], obj->offset[LIS3DH_AXIS_Z],
obj->offset[LIS3DH_AXIS_X], obj->offset[LIS3DH_AXIS_Y], obj->offset[LIS3DH_AXIS_Z]);
len += snprintf(buf+len, PAGE_SIZE-len, "[SW ][%d] (%+3d, %+3d, %+3d)\n", 1,
obj->cali_sw[LIS3DH_AXIS_X], obj->cali_sw[LIS3DH_AXIS_Y], obj->cali_sw[LIS3DH_AXIS_Z]);
len += snprintf(buf+len, PAGE_SIZE-len, "[ALL] (%+3d, %+3d, %+3d) : (%+3d, %+3d, %+3d)\n",
obj->offset[LIS3DH_AXIS_X]*mul + obj->cali_sw[LIS3DH_AXIS_X],
obj->offset[LIS3DH_AXIS_Y]*mul + obj->cali_sw[LIS3DH_AXIS_Y],
obj->offset[LIS3DH_AXIS_Z]*mul + obj->cali_sw[LIS3DH_AXIS_Z],
tmp[LIS3DH_AXIS_X], tmp[LIS3DH_AXIS_Y], tmp[LIS3DH_AXIS_Z]);
return len;
}
}
/*----------------------------------------------------------------------------*/
static ssize_t store_cali_value(struct device_driver *ddri, const char *buf, size_t count)
{
struct i2c_client *client = lis3dh_i2c_client;
int err, x, y, z;
int dat[LIS3DH_AXES_NUM];
if(!strncmp(buf, "rst", 3))
{
if((err = LIS3DH_ResetCalibration(client)))
{
GSE_ERR("reset offset err = %d\n", err);
}
}
else if(3 == sscanf(buf, "0x%02X 0x%02X 0x%02X", &x, &y, &z))
{
dat[LIS3DH_AXIS_X] = x;
dat[LIS3DH_AXIS_Y] = y;
dat[LIS3DH_AXIS_Z] = z;
if((err = LIS3DH_WriteCalibration(client, dat)))
{
GSE_ERR("write calibration err = %d\n", err);
}
}
else
{
GSE_ERR("invalid format\n");
}
return count;
}
/*----------------------------------------------------------------------------*/
static ssize_t show_power_status(struct device_driver *ddri, char *buf)
{
struct i2c_client *client = lis3dh_i2c_client;
struct lis3dh_i2c_data *obj;
u8 data;
if(NULL == client)
{
GSE_ERR("i2c client is null!!\n");
return 0;
}
obj = i2c_get_clientdata(client);
hwmsen_read_byte(client,LIS3DH_REG_CTL_REG1,&data);
data &= 0x08;
data = data>>3;
return snprintf(buf, PAGE_SIZE, "%x\n", data);
}
/*----------------------------------------------------------------------------*/
static ssize_t show_firlen_value(struct device_driver *ddri, char *buf)
{
#ifdef CONFIG_LIS3DH_LOWPASS
struct i2c_client *client = lis3dh_i2c_client;
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
if(atomic_read(&obj->firlen))
{
int idx, len = atomic_read(&obj->firlen);
GSE_LOG("len = %2d, idx = %2d\n", obj->fir.num, obj->fir.idx);
for(idx = 0; idx < len; idx++)
{
GSE_LOG("[%5d %5d %5d]\n", obj->fir.raw[idx][LIS3DH_AXIS_X], obj->fir.raw[idx][LIS3DH_AXIS_Y], obj->fir.raw[idx][LIS3DH_AXIS_Z]);
}
GSE_LOG("sum = [%5d %5d %5d]\n", obj->fir.sum[LIS3DH_AXIS_X], obj->fir.sum[LIS3DH_AXIS_Y], obj->fir.sum[LIS3DH_AXIS_Z]);
GSE_LOG("avg = [%5d %5d %5d]\n", obj->fir.sum[LIS3DH_AXIS_X]/len, obj->fir.sum[LIS3DH_AXIS_Y]/len, obj->fir.sum[LIS3DH_AXIS_Z]/len);
}
return snprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&obj->firlen));
#else
return snprintf(buf, PAGE_SIZE, "not support\n");
#endif
}
/*----------------------------------------------------------------------------*/
static ssize_t store_firlen_value(struct device_driver *ddri, const char *buf, size_t count)
{
#ifdef CONFIG_LIS3DH_LOWPASS
struct i2c_client *client = lis3dh_i2c_client;
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
int firlen;
if(1 != sscanf(buf, "%d", &firlen))
{
GSE_ERR("invallid format\n");
}
else if(firlen > C_MAX_FIR_LENGTH)
{
GSE_ERR("exceeds maximum filter length\n");
}
else
{
atomic_set(&obj->firlen, firlen);
if(0 == firlen)//yucong fix build warning
{
atomic_set(&obj->fir_en, 0);
}
else
{
memset(&obj->fir, 0x00, sizeof(obj->fir));
atomic_set(&obj->fir_en, 1);
}
}
#endif
return count;
}
/*----------------------------------------------------------------------------*/
static ssize_t show_trace_value(struct device_driver *ddri, char *buf)
{
ssize_t res;
struct lis3dh_i2c_data *obj = obj_i2c_data;
if (obj == NULL)
{
GSE_ERR("i2c_data obj is null!!\n");
return 0;
}
res = snprintf(buf, PAGE_SIZE, "0x%04X\n", atomic_read(&obj->trace));
return res;
}
/*----------------------------------------------------------------------------*/
static ssize_t store_trace_value(struct device_driver *ddri, const char *buf, size_t count)
{
struct lis3dh_i2c_data *obj = obj_i2c_data;
int trace;
if (obj == NULL)
{
GSE_ERR("i2c_data obj is null!!\n");
return 0;
}
if(1 == sscanf(buf, "0x%x", &trace))
{
atomic_set(&obj->trace, trace);
}
else
{
GSE_ERR("invalid content: '%s', length = %d\n", buf, count);
}
return count;
}
/*----------------------------------------------------------------------------*/
static ssize_t show_status_value(struct device_driver *ddri, char *buf)
{
ssize_t len = 0;
struct lis3dh_i2c_data *obj = obj_i2c_data;
if (obj == NULL)
{
GSE_ERR("i2c_data obj is null!!\n");
return 0;
}
if(obj->hw)
{
len += snprintf(buf+len, PAGE_SIZE-len, "CUST: %d %d (%d %d)\n",
obj->hw->i2c_num, obj->hw->direction, obj->hw->power_id, obj->hw->power_vol);
}
else
{
len += snprintf(buf+len, PAGE_SIZE-len, "CUST: NULL\n");
}
return len;
}
/*----------------------------------------------------------------------------*/
static DRIVER_ATTR(chipinfo, S_IRUGO, show_chipinfo_value, NULL);
static DRIVER_ATTR(sensordata, S_IRUGO, show_sensordata_value, NULL);
static DRIVER_ATTR(cali, S_IWUSR | S_IRUGO, show_cali_value, store_cali_value);
static DRIVER_ATTR(power, S_IRUGO, show_power_status, NULL);
static DRIVER_ATTR(firlen, S_IWUSR | S_IRUGO, show_firlen_value, store_firlen_value);
static DRIVER_ATTR(trace, S_IWUSR | S_IRUGO, show_trace_value, store_trace_value);
static DRIVER_ATTR(status, S_IRUGO, show_status_value, NULL);
/*----------------------------------------------------------------------------*/
static struct driver_attribute *lis3dh_attr_list[] = {
&driver_attr_chipinfo, /*chip information*/
&driver_attr_sensordata, /*dump sensor data*/
&driver_attr_cali, /*show calibration data*/
&driver_attr_power, /*show power reg*/
&driver_attr_firlen, /*filter length: 0: disable, others: enable*/
&driver_attr_trace, /*trace log*/
&driver_attr_status,
};
/*----------------------------------------------------------------------------*/
static int lis3dh_create_attr(struct device_driver *driver)
{
int idx, err = 0;
int num = (int)(sizeof(lis3dh_attr_list)/sizeof(lis3dh_attr_list[0]));
if (driver == NULL)
{
return -EINVAL;
}
for(idx = 0; idx < num; idx++)
{
if((err = driver_create_file(driver, lis3dh_attr_list[idx])))
{
GSE_ERR("driver_create_file (%s) = %d\n", lis3dh_attr_list[idx]->attr.name, err);
break;
}
}
return err;
}
/*----------------------------------------------------------------------------*/
static int lis3dh_delete_attr(struct device_driver *driver)
{
int idx ,err = 0;
int num = (int)(sizeof(lis3dh_attr_list)/sizeof(lis3dh_attr_list[0]));
if(driver == NULL)
{
return -EINVAL;
}
for(idx = 0; idx < num; idx++)
{
driver_remove_file(driver, lis3dh_attr_list[idx]);
}
return err;
}
/*----------------------------------------------------------------------------*/
int lis3dh_operate(void* self, uint32_t command, void* buff_in, int size_in,
void* buff_out, int size_out, int* actualout)
{
int err = 0;
int value, sample_delay;
struct lis3dh_i2c_data *priv = (struct lis3dh_i2c_data*)self;
hwm_sensor_data* gsensor_data;
char buff[LIS3DH_BUFSIZE];
//GSE_FUN(f);
switch (command)
{
case SENSOR_DELAY:
if((buff_in == NULL) || (size_in < sizeof(int)))
{
GSE_ERR("Set delay parameter error!\n");
err = -EINVAL;
}
else
{
value = *(int *)buff_in;
if(value <= 5)
{
sample_delay = LIS3DH_BW_200HZ;
}
else if(value <= 10)
{
sample_delay = ~LIS3DH_BW_100HZ;
}
else
{
sample_delay = ~LIS3DH_BW_50HZ;
}
err = LIS3DH_SetBWRate(priv->client, sample_delay);
if(err != LIS3DH_SUCCESS ) //0x2C->BW=100Hz
{
GSE_ERR("Set delay parameter error!\n");
}
if(value >= 50)
{
atomic_set(&priv->filter, 0);
}
else
{
priv->fir.num = 0;
priv->fir.idx = 0;
priv->fir.sum[LIS3DH_AXIS_X] = 0;
priv->fir.sum[LIS3DH_AXIS_Y] = 0;
priv->fir.sum[LIS3DH_AXIS_Z] = 0;
atomic_set(&priv->filter, 1);
}
}
break;
case SENSOR_ENABLE:
if((buff_in == NULL) || (size_in < sizeof(int)))
{
GSE_ERR("Enable sensor parameter error!\n");
err = -EINVAL;
}
else
{
value = *(int *)buff_in;
GSE_LOG("enable value=%d, sensor_power =%d\n",value,sensor_power);
if(((value == 0) && (sensor_power == false)) ||((value == 1) && (sensor_power == true)))
{
GSE_LOG("Gsensor device have updated!\n");
}
else
{
err = LIS3DH_SetPowerMode( priv->client, !sensor_power);
}
}
break;
case SENSOR_GET_DATA:
if((buff_out == NULL) || (size_out< sizeof(hwm_sensor_data)))
{
GSE_ERR("get sensor data parameter error!\n");
err = -EINVAL;
}
else
{
gsensor_data = (hwm_sensor_data *)buff_out;
LIS3DH_ReadSensorData(priv->client, buff, LIS3DH_BUFSIZE);
sscanf(buff, "%x %x %x", &gsensor_data->values[0],
&gsensor_data->values[1], &gsensor_data->values[2]);
gsensor_data->status = SENSOR_STATUS_ACCURACY_MEDIUM;
gsensor_data->value_divide = 1000;
}
break;
default:
GSE_ERR("gsensor operate function no this parameter %d!\n", command);
err = -1;
break;
}
return err;
}
/******************************************************************************
* Function Configuration
******************************************************************************/
static int lis3dh_open(struct inode *inode, struct file *file)
{
file->private_data = lis3dh_i2c_client;
if(file->private_data == NULL)
{
GSE_ERR("null pointer!!\n");
return -EINVAL;
}
return nonseekable_open(inode, file);
}
/*----------------------------------------------------------------------------*/
static int lis3dh_release(struct inode *inode, struct file *file)
{
file->private_data = NULL;
return 0;
}
/*----------------------------------------------------------------------------*/
//static int lis3dh_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
// unsigned long arg)
static long lis3dh_unlocked_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
struct i2c_client *client = (struct i2c_client*)file->private_data;
struct lis3dh_i2c_data *obj = (struct lis3dh_i2c_data*)i2c_get_clientdata(client);
char strbuf[LIS3DH_BUFSIZE];
void __user *data;
SENSOR_DATA sensor_data;
long err = 0;
int cali[3];
//GSE_FUN(f);
if(_IOC_DIR(cmd) & _IOC_READ)
{
err = !access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd));
}
else if(_IOC_DIR(cmd) & _IOC_WRITE)
{
err = !access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd));
}
if(err)
{
GSE_ERR("access error: %08X, (%2d, %2d)\n", cmd, _IOC_DIR(cmd), _IOC_SIZE(cmd));
return -EFAULT;
}
switch(cmd)
{
case GSENSOR_IOCTL_INIT:
LIS3DH_Init(client, 0);
break;
case GSENSOR_IOCTL_READ_CHIPINFO:
data = (void __user *) arg;
if(data == NULL)
{
err = -EINVAL;
break;
}
LIS3DH_ReadChipInfo(client, strbuf, LIS3DH_BUFSIZE);
if(copy_to_user(data, strbuf, strlen(strbuf)+1))
{
err = -EFAULT;
break;
}
break;
case GSENSOR_IOCTL_READ_SENSORDATA:
data = (void __user *) arg;
if(data == NULL)
{
err = -EINVAL;
break;
}
LIS3DH_ReadSensorData(client, strbuf, LIS3DH_BUFSIZE);
if(copy_to_user(data, strbuf, strlen(strbuf)+1))
{
err = -EFAULT;
break;
}
break;
case GSENSOR_IOCTL_READ_GAIN:
data = (void __user *) arg;
if(data == NULL)
{
err = -EINVAL;
break;
}
if(copy_to_user(data, &gsensor_gain, sizeof(GSENSOR_VECTOR3D)))
{
err = -EFAULT;
break;
}
break;
case GSENSOR_IOCTL_READ_OFFSET:
data = (void __user *) arg;
if(data == NULL)
{
err = -EINVAL;
break;
}
if(copy_to_user(data, &gsensor_offset, sizeof(GSENSOR_VECTOR3D)))
{
err = -EFAULT;
break;
}
break;
case GSENSOR_IOCTL_READ_RAW_DATA:
data = (void __user *) arg;
if(data == NULL)
{
err = -EINVAL;
break;
}
LIS3DH_ReadRawData(client, strbuf);
if(copy_to_user(data, &strbuf, strlen(strbuf)+1))
{
err = -EFAULT;
break;
}
break;
case GSENSOR_IOCTL_SET_CALI:
data = (void __user*)arg;
if(data == NULL)
{
err = -EINVAL;
break;
}
if(copy_from_user(&sensor_data, data, sizeof(sensor_data)))
{
err = -EFAULT;
break;
}
if(atomic_read(&obj->suspend))
{
GSE_ERR("Perform calibration in suspend state!!\n");
err = -EINVAL;
}
else
{
cali[LIS3DH_AXIS_X] = sensor_data.x * obj->reso->sensitivity / GRAVITY_EARTH_1000;
cali[LIS3DH_AXIS_Y] = sensor_data.y * obj->reso->sensitivity / GRAVITY_EARTH_1000;
cali[LIS3DH_AXIS_Z] = sensor_data.z * obj->reso->sensitivity / GRAVITY_EARTH_1000;
err = LIS3DH_WriteCalibration(client, cali);
}
break;
case GSENSOR_IOCTL_CLR_CALI:
err = LIS3DH_ResetCalibration(client);
break;
case GSENSOR_IOCTL_GET_CALI:
data = (void __user*)arg;
if(data == NULL)
{
err = -EINVAL;
break;
}
if((err = LIS3DH_ReadCalibration(client, cali)))
{
break;
}
sensor_data.x = cali[LIS3DH_AXIS_X] * GRAVITY_EARTH_1000 / obj->reso->sensitivity;
sensor_data.y = cali[LIS3DH_AXIS_Y] * GRAVITY_EARTH_1000 / obj->reso->sensitivity;
sensor_data.z = cali[LIS3DH_AXIS_Z] * GRAVITY_EARTH_1000 / obj->reso->sensitivity;
if(copy_to_user(data, &sensor_data, sizeof(sensor_data)))
{
err = -EFAULT;
break;
}
break;
default:
GSE_ERR("unknown IOCTL: 0x%08x\n", cmd);
err = -ENOIOCTLCMD;
break;
}
return err;
}
/*----------------------------------------------------------------------------*/
static struct file_operations lis3dh_fops = {
.owner = THIS_MODULE,
.open = lis3dh_open,
.release = lis3dh_release,
//.ioctl = lis3dh_ioctl,
.unlocked_ioctl = lis3dh_unlocked_ioctl,
};
/*----------------------------------------------------------------------------*/
static struct miscdevice lis3dh_device = {
.minor = MISC_DYNAMIC_MINOR,
.name = "gsensor",
.fops = &lis3dh_fops,
};
/*----------------------------------------------------------------------------*/
#ifndef CONFIG_HAS_EARLYSUSPEND
/*----------------------------------------------------------------------------*/
static int lis3dh_suspend(struct i2c_client *client, pm_message_t msg)
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
int err = 0;
u8 dat;
GSE_FUN();
if(msg.event == PM_EVENT_SUSPEND)
{
if(obj == NULL)
{
GSE_ERR("null pointer!!\n");
return -EINVAL;
}
//read old data
if ((err = hwmsen_read_byte(client, LIS3DH_REG_CTL_REG1, &dat)))
{
GSE_ERR("write data format fail!!\n");
return err;
}
dat = dat&0b10111111;
atomic_set(&obj->suspend, 1);
if(err = hwmsen_write_byte(client, LIS3DH_REG_CTL_REG1, dat))
{
GSE_ERR("write power control fail!!\n");
return err;
}
LIS3DH_power(obj->hw, 0);
}
return err;
}
/*----------------------------------------------------------------------------*/
static int lis3dh_resume(struct i2c_client *client)
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
//int err;
GSE_FUN();
if(obj == NULL)
{
GSE_ERR("null pointer!!\n");
return -EINVAL;
}
LIS3DH_power(obj->hw, 1);
#if 0
mdelay(30);//yucong add for fix g sensor resume issue
if(err = LIS3DH_Init(client, 0))
{
GSE_ERR("initialize client fail!!\n");
return err;
}
#endif
atomic_set(&obj->suspend, 0);
return 0;
}
/*----------------------------------------------------------------------------*/
#else /*CONFIG_HAS_EARLY_SUSPEND is defined*/
/*----------------------------------------------------------------------------*/
static void lis3dh_early_suspend(struct early_suspend *h)
{
struct lis3dh_i2c_data *obj = container_of(h, struct lis3dh_i2c_data, early_drv);
int err;
GSE_FUN();
if(obj == NULL)
{
GSE_ERR("null pointer!!\n");
return;
}
atomic_set(&obj->suspend, 1);
/*
if(err = hwmsen_write_byte(obj->client, LIS3DH_REG_POWER_CTL, 0x00))
{
GSE_ERR("write power control fail!!\n");
return;
}
*/
if((err = LIS3DH_SetPowerMode(obj->client, false)))
{
GSE_ERR("write power control fail!!\n");
return;
}
sensor_power = false;
LIS3DH_power(obj->hw, 0);
}
/*----------------------------------------------------------------------------*/
static void lis3dh_late_resume(struct early_suspend *h)
{
struct lis3dh_i2c_data *obj = container_of(h, struct lis3dh_i2c_data, early_drv);
//int err;
GSE_FUN();
if(obj == NULL)
{
GSE_ERR("null pointer!!\n");
return;
}
LIS3DH_power(obj->hw, 1);
#if 0
mdelay(30);//yucong add for fix g sensor resume issue
if((err = LIS3DH_Init(obj->client, 0)))
{
GSE_ERR("initialize client fail!!\n");
return;
}
#endif
atomic_set(&obj->suspend, 0);
}
/*----------------------------------------------------------------------------*/
#endif /*CONFIG_HAS_EARLYSUSPEND*/
/*----------------------------------------------------------------------------*/
/*
static int lis3dh_i2c_detect(struct i2c_client *client, int kind, struct i2c_board_info *info)
{
strcpy(info->type, LIS3DH_DEV_NAME);
return 0;
}
*/
/*----------------------------------------------------------------------------*/
static int lis3dh_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
struct i2c_client *new_client;
struct lis3dh_i2c_data *obj;
struct hwmsen_object sobj;
int err = 0;
GSE_FUN();
if(!(obj = kzalloc(sizeof(*obj), GFP_KERNEL)))
{
err = -ENOMEM;
goto exit;
}
memset(obj, 0, sizeof(struct lis3dh_i2c_data));
obj->hw = lis3dh_get_cust_acc_hw();
if((err = hwmsen_get_convert(obj->hw->direction, &obj->cvt)))
{
GSE_ERR("invalid direction: %d\n", obj->hw->direction);
goto exit;
}
obj_i2c_data = obj;
obj->client = client;
new_client = obj->client;
i2c_set_clientdata(new_client,obj);
atomic_set(&obj->trace, 0);
atomic_set(&obj->suspend, 0);
#ifdef CONFIG_LIS3DH_LOWPASS
if(obj->hw->firlen > C_MAX_FIR_LENGTH)
{
atomic_set(&obj->firlen, C_MAX_FIR_LENGTH);
}
else
{
atomic_set(&obj->firlen, obj->hw->firlen);
}
if(atomic_read(&obj->firlen) > 0)
{
atomic_set(&obj->fir_en, 1);
}
#endif
lis3dh_i2c_client = new_client;
if((err = LIS3DH_Init(new_client, 1)))
{
goto exit_init_failed;
}
if((err = misc_register(&lis3dh_device)))
{
GSE_ERR("lis3dh_device register failed\n");
goto exit_misc_device_register_failed;
}
if((err = lis3dh_create_attr(&(lis3dh_init_info.platform_diver_addr->driver))))
{
GSE_ERR("create attribute err = %d\n", err);
goto exit_create_attr_failed;
}
sobj.self = obj;
sobj.polling = 1;
sobj.sensor_operate = lis3dh_operate;
if((err = hwmsen_attach(ID_ACCELEROMETER, &sobj)))
{
GSE_ERR("attach fail = %d\n", err);
goto exit_kfree;
}
#ifdef CONFIG_HAS_EARLYSUSPEND
obj->early_drv.level = EARLY_SUSPEND_LEVEL_DISABLE_FB - 1,
obj->early_drv.suspend = lis3dh_early_suspend,
obj->early_drv.resume = lis3dh_late_resume,
register_early_suspend(&obj->early_drv);
#endif
GSE_LOG("%s: OK\n", __func__);
lis3dh_init_flag = 0;
return 0;
exit_create_attr_failed:
misc_deregister(&lis3dh_device);
exit_misc_device_register_failed:
exit_init_failed:
//i2c_detach_client(new_client);
exit_kfree:
kfree(obj);
exit:
GSE_ERR("%s: err = %d\n", __func__, err);
lis3dh_init_flag = -1;
return err;
}
/*----------------------------------------------------------------------------*/
static int lis3dh_i2c_remove(struct i2c_client *client)
{
int err = 0;
if((err = lis3dh_delete_attr(&(lis3dh_init_info.platform_diver_addr->driver))))
{
GSE_ERR("lis3dh_delete_attr fail: %d\n", err);
}
if((err = misc_deregister(&lis3dh_device)))
{
GSE_ERR("misc_deregister fail: %d\n", err);
}
if((err = hwmsen_detach(ID_ACCELEROMETER)))
lis3dh_i2c_client = NULL;
i2c_unregister_device(client);
kfree(i2c_get_clientdata(client));
return 0;
}
/*----------------------------------------------------------------------------*/
#if 0
/*----------------------------------------------------------------------------*/
static int lis3dh_probe(struct platform_device *pdev)
{
struct acc_hw *hw = get_cust_acc_hw();
GSE_FUN();
LIS3DH_power(hw, 1);
//lis3dh_force[0] = hw->i2c_num;
if(i2c_add_driver(&lis3dh_i2c_driver))
{
GSE_ERR("add driver error\n");
return -1;
}
return 0;
}
/*----------------------------------------------------------------------------*/
static int lis3dh_remove(struct platform_device *pdev)
{
struct acc_hw *hw = get_cust_acc_hw();
GSE_FUN();
LIS3DH_power(hw, 0);
i2c_del_driver(&lis3dh_i2c_driver);
return 0;
}
/*----------------------------------------------------------------------------*/
static struct platform_driver lis3dh_gsensor_driver = {
.probe = lis3dh_probe,
.remove = lis3dh_remove,
.driver = {
.name = "gsensor",
.owner = THIS_MODULE,
}
};
/*----------------------------------------------------------------------------*/
#endif
/*----------------------------------------------------------------------------*/
static int lis3dh_remove(void)
{
struct acc_hw *hw = lis3dh_get_cust_acc_hw();
GSE_FUN();
LIS3DH_power(hw, 0);
i2c_del_driver(&lis3dh_i2c_driver);
return 0;
}
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
static int lis3dh_local_init(void)
{
struct acc_hw *hw = lis3dh_get_cust_acc_hw();
GSE_FUN();
LIS3DH_power(hw, 1);
if(i2c_add_driver(&lis3dh_i2c_driver))
{
GSE_ERR("add driver error\n");
return -1;
}
if(-1 == lis3dh_init_flag)
{
return -1;
}
return 0;
}
/*----------------------------------------------------------------------------*/
static int __init lis3dh_init(void)
{
GSE_FUN();
i2c_register_board_info(0, &i2c_LIS3DH, 1);
hwmsen_gsensor_add(&lis3dh_init_info);
#if 0
if(platform_driver_register(&lis3dh_gsensor_driver))
{
GSE_ERR("failed to register driver");
return -ENODEV;
}
#endif
return 0;
}
/*----------------------------------------------------------------------------*/
static void __exit lis3dh_exit(void)
{
GSE_FUN();
//platform_driver_unregister(&lis3dh_gsensor_driver);
}
/*----------------------------------------------------------------------------*/
module_init(lis3dh_init);
module_exit(lis3dh_exit);
/*----------------------------------------------------------------------------*/
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("LIS3DH I2C driver");
MODULE_AUTHOR("Chunlei.Wang@mediatek.com");
| yevgeniy-logachev/CATB15Kernel | mediatek/custom/common/kernel/accelerometer/lis3dh_auto/lis3dh.c | C | gpl-2.0 | 49,830 | [
30522,
1013,
1008,
6853,
1013,
1045,
2475,
2278,
1013,
11772,
1013,
5622,
2015,
29097,
2232,
1012,
1039,
1011,
5622,
2015,
29097,
2232,
4367,
13617,
4062,
1008,
1008,
1008,
1008,
2023,
4007,
2003,
7000,
2104,
1996,
3408,
1997,
1996,
27004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Based conceptually on the _.extend() function in underscore.js ( see http://documentcloud.github.com/underscore/#extend for more details )
* Copyright (C) 2012 Kurt Milam - http://xioup.com | Source: https://gist.github.com/1868955
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
**/
var _ = require('underscore');
deepExtend = function(obj) {
var parentRE = /#{\s*?_\s*?}/,
slice = Array.prototype.slice,
hasOwnProperty = Object.prototype.hasOwnProperty;
_.each(slice.call(arguments, 1), function(source) {
for (var prop in source) {
if (hasOwnProperty.call(source, prop)) {
if (_.isUndefined(obj[prop]) || _.isFunction(obj[prop]) || _.isNull(source[prop])) {
obj[prop] = source[prop];
}
else if (_.isString(source[prop]) && parentRE.test(source[prop])) {
if (_.isString(obj[prop])) {
obj[prop] = source[prop].replace(parentRE, obj[prop]);
}
}
else if (_.isArray(obj[prop]) || _.isArray(source[prop])){
if (!_.isArray(obj[prop]) || !_.isArray(source[prop])){
throw 'Error: Trying to combine an array with a non-array (' + prop + ')';
} else {
obj[prop] = _.reject(_.deepExtend(obj[prop], source[prop]), function (item) { return _.isNull(item);});
}
}
else if (_.isObject(obj[prop]) || _.isObject(source[prop])){
if (!_.isObject(obj[prop]) || !_.isObject(source[prop])){
throw 'Error: Trying to combine an object with a non-object (' + prop + ')';
} else {
obj[prop] = _.deepExtend(obj[prop], source[prop]);
}
} else {
obj[prop] = source[prop];
}
}
}
});
return obj;
};
exports.deepExtend = deepExtend;
| 4poc/anpaste | app/lib/deep_extend_underscore_mixin.js | JavaScript | agpl-3.0 | 2,385 | [
30522,
1013,
1008,
1008,
1008,
2241,
17158,
2135,
2006,
1996,
1035,
1012,
7949,
1006,
1007,
3853,
1999,
2104,
9363,
2890,
1012,
1046,
2015,
1006,
2156,
8299,
1024,
1013,
1013,
6254,
20464,
19224,
1012,
21025,
2705,
12083,
1012,
4012,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Copyright 2017 AT&T Corporation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from tempest.lib.services.identity.v3 import endpoint_groups_client
from tempest.tests.lib import fake_auth_provider
from tempest.tests.lib.services import base
class TestEndPointGroupsClient(base.BaseServiceTest):
FAKE_CREATE_ENDPOINT_GROUP = {
"endpoint_group": {
"id": 1,
"name": "FAKE_ENDPOINT_GROUP",
"description": "FAKE SERVICE ENDPOINT GROUP",
"filters": {
"service_id": 1
}
}
}
FAKE_ENDPOINT_GROUP_INFO = {
"endpoint_group": {
"id": 1,
"name": "FAKE_ENDPOINT_GROUP",
"description": "FAKE SERVICE ENDPOINT GROUP",
"links": {
"self": "http://example.com/identity/v3/OS-EP-FILTER/" +
"endpoint_groups/1"
},
"filters": {
"service_id": 1
}
}
}
FAKE_LIST_ENDPOINT_GROUPS = {
"endpoint_groups": [
{
"id": 1,
"name": "SERVICE_GROUP1",
"description": "FAKE SERVICE ENDPOINT GROUP",
"links": {
"self": "http://example.com/identity/v3/OS-EP-FILTER/" +
"endpoint_groups/1"
},
"filters": {
"service_id": 1
}
},
{
"id": 2,
"name": "SERVICE_GROUP2",
"description": "FAKE SERVICE ENDPOINT GROUP",
"links": {
"self": "http://example.com/identity/v3/OS-EP-FILTER/" +
"endpoint_groups/2"
},
"filters": {
"service_id": 2
}
}
]
}
def setUp(self):
super(TestEndPointGroupsClient, self).setUp()
fake_auth = fake_auth_provider.FakeAuthProvider()
self.client = endpoint_groups_client.EndPointGroupsClient(
fake_auth, 'identity', 'regionOne')
def _test_create_endpoint_group(self, bytes_body=False):
self.check_service_client_function(
self.client.create_endpoint_group,
'tempest.lib.common.rest_client.RestClient.post',
self.FAKE_CREATE_ENDPOINT_GROUP,
bytes_body,
status=201,
name="FAKE_ENDPOINT_GROUP",
filters={'service_id': "1"})
def _test_show_endpoint_group(self, bytes_body=False):
self.check_service_client_function(
self.client.show_endpoint_group,
'tempest.lib.common.rest_client.RestClient.get',
self.FAKE_ENDPOINT_GROUP_INFO,
bytes_body,
endpoint_group_id="1")
def _test_check_endpoint_group(self, bytes_body=False):
self.check_service_client_function(
self.client.check_endpoint_group,
'tempest.lib.common.rest_client.RestClient.head',
{},
bytes_body,
status=200,
endpoint_group_id="1")
def _test_update_endpoint_group(self, bytes_body=False):
self.check_service_client_function(
self.client.update_endpoint_group,
'tempest.lib.common.rest_client.RestClient.patch',
self.FAKE_ENDPOINT_GROUP_INFO,
bytes_body,
endpoint_group_id="1",
name="NewName")
def _test_list_endpoint_groups(self, bytes_body=False):
self.check_service_client_function(
self.client.list_endpoint_groups,
'tempest.lib.common.rest_client.RestClient.get',
self.FAKE_LIST_ENDPOINT_GROUPS,
bytes_body)
def test_create_endpoint_group_with_str_body(self):
self._test_create_endpoint_group()
def test_create_endpoint_group_with_bytes_body(self):
self._test_create_endpoint_group(bytes_body=True)
def test_show_endpoint_group_with_str_body(self):
self._test_show_endpoint_group()
def test_show_endpoint_group_with_bytes_body(self):
self._test_show_endpoint_group(bytes_body=True)
def test_check_endpoint_group_with_str_body(self):
self._test_check_endpoint_group()
def test_check_endpoint_group_with_bytes_body(self):
self._test_check_endpoint_group(bytes_body=True)
def test_list_endpoint_groups_with_str_body(self):
self._test_list_endpoint_groups()
def test_list_endpoint_groups_with_bytes_body(self):
self._test_list_endpoint_groups(bytes_body=True)
def test_update_endpoint_group_with_str_body(self):
self._test_update_endpoint_group()
def test_update_endpoint_group_with_bytes_body(self):
self._test_update_endpoint_group(bytes_body=True)
def test_delete_endpoint_group(self):
self.check_service_client_function(
self.client.delete_endpoint_group,
'tempest.lib.common.rest_client.RestClient.delete',
{},
endpoint_group_id="1",
status=204)
| vedujoshi/tempest | tempest/tests/lib/services/identity/v3/test_endpoint_groups_client.py | Python | apache-2.0 | 5,681 | [
30522,
1001,
9385,
2418,
2012,
1004,
1056,
3840,
1012,
1001,
2035,
2916,
9235,
1012,
1001,
1001,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
1001,
2025,
2224,
2023,
53... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//*******************************************************************************************//
// //
// Download Free Evaluation Version From: https://bytescout.com/download/web-installer //
// //
// Also available as Web API! Get Your Free API Key: https://app.pdf.co/signup //
// //
// Copyright © 2017-2020 ByteScout, Inc. All rights reserved. //
// https://www.bytescout.com //
// https://pdf.co //
// //
//*******************************************************************************************//
#include "stdafx.h"
#import "Bytescout.BarCode.tlb" raw_interfaces_only
using namespace Bytescout_BarCode;
int _tmain(int argc, _TCHAR* argv[])
{
// Initialize COM.
HRESULT hr = CoInitialize(NULL);
// Create the interface pointer.
IBarcodePtr pIBarcode(__uuidof(Barcode));
// set the registration name and key
BSTR regname = ::SysAllocString(L"DEMO");
pIBarcode->put_RegistrationName(regname);
::SysFreeString(regname);
BSTR regkey = ::SysAllocString(L"DEMO");
pIBarcode->put_RegistrationKey(regkey);
::SysFreeString(regkey);
// Set barcode type (symbology)
pIBarcode->put_Symbology(SymbologyType_DataMatrix);
// Set monochrome output
pIBarcode->put_ProduceMonochromeImages(VARIANT_TRUE);
// Set barcode value
BSTR value = ::SysAllocString(L"Barcode Value 1234567890");
pIBarcode->put_Value(value);
::SysFreeString(value);
// Save barcode image
BSTR fileName = ::SysAllocString(L"result.png");
pIBarcode->SaveImage(fileName);
::SysFreeString(fileName);
pIBarcode->Release();
// Uninitialize COM.
CoUninitialize();
return 0;
}
| bytescout/ByteScout-SDK-SourceCode | Premium Suite/C++/Generate barcode monochrome bitmap with barcode sdk/BarcodeGenerationExample.cpp | C++ | apache-2.0 | 2,177 | [
30522,
1013,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div class="wf-container wf-clearfix">
*
* @package presscore
* @since presscore 0.1
*/
// File Security Check
if ( ! defined( 'ABSPATH' ) ) { exit; }
?><!DOCTYPE html>
<!--[if IE 6]>
<html id="ie6" class="ancient-ie old-ie no-js" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 7]>
<html id="ie7" class="ancient-ie old-ie no-js" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html id="ie8" class="old-ie no-js" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 9]>
<html id="ie9" class="old-ie9 no-js" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8) ]><!-->
<html class="no-js" <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<?php if ( presscore_responsive() ) : ?>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<?php endif; // is responsive?>
<?php if ( dt_retina_on() ) { dt_core_detect_retina_script(); } ?>
<title><?php echo presscore_blog_title(); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style type="text/css" id="static-stylesheet"></style>
<?php
if ( ! is_preview() ) {
presscore_favicon();
echo of_get_option('general-tracking_code', '');
presscore_icons_for_handhelded_devices();
}
wp_head();
?>
</head>
<body <?php body_class(); ?>>
<?php do_action( 'presscore_body_top' ); ?>
<div id="page"<?php if ( 'boxed' == of_get_option('general-layout', 'wide') ) echo ' class="boxed"'; ?>>
<?php if ( of_get_option('top_bar-show', 1) ) : ?>
<?php get_template_part( 'templates/header/top-bar', of_get_option('top_bar-content_alignment', 'side') ); ?>
<?php endif; // show top bar ?>
<?php if ( apply_filters( 'presscore_show_header', true ) ) : ?>
<?php get_template_part( 'templates/header/header', of_get_option( 'header-layout', 'left' ) ); ?>
<?php endif; // show header ?>
<?php do_action( 'presscore_before_main_container' ); ?>
<div id="main" <?php presscore_main_container_classes(); ?>><!-- class="sidebar-none", class="sidebar-left", class="sidebar-right" -->
<?php if ( presscore_is_content_visible() ): ?>
<div class="main-gradient"></div>
<div class="wf-wrap">
<div class="wf-container-main">
<?php do_action( 'presscore_before_content' ); ?>
<?php endif; ?>
| wiljenum/wordpress-jo | wp-content/themes/dt-the7/header.php | PHP | gpl-2.0 | 2,604 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1996,
20346,
2005,
2256,
4323,
1012,
1008,
1008,
8834,
2035,
1997,
1996,
1026,
2132,
1028,
2930,
1998,
2673,
2039,
6229,
1026,
4487,
2615,
2465,
1027,
1000,
1059,
2546,
1011,
11661,
1059,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.kafka.connect.file;
import org.apache.kafka.common.config.ConfigDef;
import org.apache.kafka.common.config.ConfigDef.Importance;
import org.apache.kafka.common.config.ConfigDef.Type;
import org.apache.kafka.common.utils.AppInfoParser;
import org.apache.kafka.connect.connector.Task;
import org.apache.kafka.connect.sink.SinkConnector;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Very simple connector that works with the console. This connector supports both source and
* sink modes via its 'mode' setting.
*/
public class FileStreamSinkConnector extends SinkConnector {
public static final String FILE_CONFIG = "file";
private static final ConfigDef CONFIG_DEF = new ConfigDef()
.define(FILE_CONFIG, Type.STRING, Importance.HIGH, "Destination filename.");
private String filename;
@Override
public String version() {
return AppInfoParser.getVersion();
}
@Override
public void start(Map<String, String> props) {
filename = props.get(FILE_CONFIG);
}
@Override
public Class<? extends Task> taskClass() {
return FileStreamSinkTask.class;
}
@Override
public List<Map<String, String>> taskConfigs(int maxTasks) {
ArrayList<Map<String, String>> configs = new ArrayList<>();
for (int i = 0; i < maxTasks; i++) {
Map<String, String> config = new HashMap<>();
if (filename != null)
config.put(FILE_CONFIG, filename);
configs.add(config);
}
return configs;
}
@Override
public void stop() {
// Nothing to do since FileStreamSinkConnector has no background monitoring.
}
@Override
public ConfigDef config() {
return CONFIG_DEF;
}
}
| wangcy6/storm_app | frame/kafka-0.11.0/kafka-0.11.0.1-src/connect/file/src/main/java/org/apache/kafka/connect/file/FileStreamSinkConnector.java | Java | apache-2.0 | 2,629 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
1008,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
1008,
2023,
2147,
2005,
3176,
2592,
4953,
9385,
6095,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2016 Development Entropy (deventropy.org) Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.deventropy.junithelper.derby;
import static org.junit.Assert.assertTrue;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.junit.AfterClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.junit.rules.TemporaryFolder;
/**
* @author Bindul Bhowmik
*/
public class SimpleDerbyTest {
private TemporaryFolder tempFolder = new TemporaryFolder();
private EmbeddedDerbyResource embeddedDerbyResource =
new EmbeddedDerbyResource(DerbyResourceConfig.buildDefault()
.useDevNullErrorLogging(),
tempFolder);
@Rule
public RuleChain derbyRuleChain = RuleChain.outerRule(tempFolder).around(embeddedDerbyResource);
/**
* Cleanup stuff.
*/
@AfterClass
public static void cleanupDerbySystem () {
// Cleanup for next test
DerbyUtils.shutdownDerbySystemQuitely(true);
}
@Test
public void test () throws SQLException {
final String jdbcUrl = embeddedDerbyResource.getJdbcUrl();
Connection connection = null;
Statement stmt = null;
ResultSet rs = null;
try {
connection = DriverManager.getConnection(jdbcUrl);
// Check a value
stmt = connection.createStatement();
rs = stmt.executeQuery("SELECT 1 FROM SYSIBM.SYSDUMMY1");
assertTrue(rs.next());
} finally {
DerbyUtils.closeQuietly(rs);
DerbyUtils.closeQuietly(stmt);
DerbyUtils.closeQuietly(connection);
}
}
}
| bindul/junit-helper | junit-helper-derby/src/test/java/org/deventropy/junithelper/derby/SimpleDerbyTest.java | Java | apache-2.0 | 2,114 | [
30522,
1013,
1008,
1008,
9385,
2355,
2458,
23077,
1006,
16475,
4765,
18981,
2100,
1012,
8917,
1007,
16884,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<html>
<head>
<title>主页</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta http-equiv="imagetoolbar" content="no"/>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<link rel="apple-touch-icon" href="data/apple-touch-icon.png" />
<link rel="apple-touch-startup-image" href="data/startup-iphone.png" media="screen and (max-device-width: 320px)"/>
<link href="resources/css/jquery-ui-themes.css" type="text/css" rel="stylesheet">
<link href="resources/css/axure_rp_page.css" type="text/css" rel="stylesheet">
<link href="主页_1_files/axurerp_pagespecificstyles.css" type="text/css" rel="stylesheet">
<!--[if IE 6]>
<link href="主页_1_files/axurerp_pagespecificstyles_ie6.css" type="text/css" rel="stylesheet">
<![endif]-->
<script src="data/sitemap.js"></script>
<script src="resources/scripts/jquery-1.7.1.min.js"></script>
<script src="resources/scripts/axutils.js"></script>
<script src="resources/scripts/jquery-ui-1.8.10.custom.min.js"></script>
<script src="resources/scripts/axurerp_beforepagescript.js"></script>
<script src="resources/scripts/messagecenter.js"></script>
<script src='主页_1_files/data.js'></script>
</head>
<body>
<div id="main_container">
<div id="u0" class="u0_container" >
<div id="u0_img" class="u0_normal detectCanvas"></div>
<div id="u1" class="u1" style="visibility:hidden;" >
<div id="u1_rtf"></div>
</div>
</div>
<div id="u2" class="u2_container" >
<div id="u2_img" class="u2_normal detectCanvas"></div>
<div id="u3" class="u3" style="visibility:hidden;" >
<div id="u3_rtf"></div>
</div>
</div>
<div id="u4" class="u4_container" >
<div id="u4_img" class="u4_normal detectCanvas"></div>
<div id="u5" class="u5" >
<div id="u5_rtf"><p style="text-align:center;"><span style="font-family:Heiti SC;font-size:13px;font-weight:normal;font-style:normal;text-decoration:none;color:#333333;">用户管理</span></p></div>
</div>
</div>
<div id="u6" class="u6_container" >
<div id="u6_img" class="u6_normal detectCanvas"></div>
<div id="u7" class="u7" style="visibility:hidden;" >
<div id="u7_rtf"></div>
</div>
</div>
<div id="u8" class="u8_container" >
<div id="u8_img" class="u8_normal detectCanvas"></div>
<div id="u9" class="u9" >
<div id="u9_rtf"><p style="text-align:center;"><span style="font-family:Arial;font-size:13px;font-weight:normal;font-style:normal;text-decoration:none;color:#333333;">enter text...</span></p></div>
</div>
</div><div id="u10" class="u10" >
<DIV id="u10_line" class="u10_line" ></DIV>
</div>
<div id="u11" class="u11_container" >
<div id="u11_img" class="u11_normal detectCanvas"></div>
<div id="u12" class="u12" style="visibility:hidden;" >
<div id="u12_rtf"></div>
</div>
</div>
<div id="u13" class="u13_container" >
<div id="u13_img" class="u13_normal detectCanvas"></div>
<div id="u14" class="u14" style="visibility:hidden;" >
<div id="u14_rtf"></div>
</div>
</div>
<DIV id="u15container" style="position:absolute; left:219px; top:84px; width:100px; height:13px; ; ; ;" >
<LABEL for="u15">
<div id="u16" class="u16" >
<div id="u16_rtf"><p style="text-align:left;"><span style="font-family:Heiti SC;font-size:13px;font-weight:normal;font-style:normal;text-decoration:none;color:#333333;">全选</span></p></div>
</div>
</LABEL>
<INPUT id="u15" style="position:absolute; left:-3px; top:-2px;" type="checkbox" value="checkbox" >
</DIV>
<div id="u17" class="u17_container" >
<div id="u17_img" class="u17_normal detectCanvas"></div>
<div id="u18" class="u18" >
<div id="u18_rtf"><p style="text-align:center;"><span style="font-family:Heiti SC;font-size:13px;font-weight:normal;font-style:normal;text-decoration:none;color:#333333;">用户名</span></p></div>
</div>
</div>
<div id="u19" class="u19_container" >
<div id="u19_img" class="u19_normal detectCanvas"></div>
<div id="u20" class="u20" >
<div id="u20_rtf"><p style="text-align:center;"><span style="font-family:Heiti SC;font-size:13px;font-weight:normal;font-style:normal;text-decoration:none;color:#333333;">注册时间</span></p></div>
</div>
</div>
<div id="u21" class="u21_container" >
<div id="u21_img" class="u21_normal detectCanvas"></div>
<div id="u22" class="u22" >
<div id="u22_rtf"><p style="text-align:center;"><span style="font-family:Heiti SC;font-size:13px;font-weight:normal;font-style:normal;text-decoration:none;color:#333333;">学员数量</span></p></div>
</div>
</div>
<div id="u23" class="u23_container" >
<div id="u23_img" class="u23_normal detectCanvas"></div>
<div id="u24" class="u24" >
<div id="u24_rtf"><p style="text-align:center;"><span style="font-family:Heiti SC;font-size:13px;font-weight:normal;font-style:normal;text-decoration:none;color:#333333;">学员管理</span></p></div>
</div>
</div>
<div id="u25" class="u25_container" >
<div id="u25_img" class="u25_normal detectCanvas"></div>
<div id="u26" class="u26" >
<div id="u26_rtf"><p style="text-align:center;"><span style="font-family:Heiti SC;font-size:13px;font-weight:normal;font-style:normal;text-decoration:none;color:#333333;">学员数量</span></p></div>
</div>
</div>
</div>
<div class="preload"><img src="主页_1_files/u0_normal.png" width="1" height="1"/><img src="主页_1_files/u2_normal.png" width="1" height="1"/><img src="主页_1_files/u4_normal.png" width="1" height="1"/><img src="主页_1_files/u6_normal.png" width="1" height="1"/><img src="主页_1_files/u10_line.png" width="1" height="1"/><img src="主页_1_files/u11_normal.png" width="1" height="1"/><img src="主页_1_files/u13_normal.png" width="1" height="1"/><img src="主页_1_files/u17_normal.png" width="1" height="1"/><img src="主页_1_files/u19_normal.png" width="1" height="1"/></div>
</body>
<script src="resources/scripts/axurerp_pagescript.js"></script>
<script src="主页_1_files/axurerp_pagespecificscript.js" charset="utf-8"></script> | tiansiyuan/SQA | projects/dd/prototype/主页_1.html | HTML | mit | 6,083 | [
30522,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
2516,
1028,
1747,
100,
1026,
1013,
2516,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
4180,
1011,
2828,
1000,
4180,
1027,
1000,
3793,
1013,
16129,
1025,
25869,
13462,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
class AchievementsController < ApplicationController
before_action :authenticate_admin!
before_action :set_achievement, only: [:show, :edit, :update, :destroy]
# GET /achievements
# GET /achievements.json
def index
@achievements = Achievement.all
end
# GET /achievements/1
# GET /achievements/1.json
def show
end
# GET /achievements/new
def new
@achievement = Achievement.new
end
# GET /achievements/1/edit
def edit
end
# POST /achievements
# POST /achievements.json
def create
@achievement = Achievement.new(achievement_params)
respond_to do |format|
if @achievement.save
format.html { redirect_to @achievement, notice: 'Achievement was successfully created.' }
format.json { render :show, status: :created, location: @achievement }
else
format.html { render :new }
format.json { render json: @achievement.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /achievements/1
# PATCH/PUT /achievements/1.json
def update
respond_to do |format|
if @achievement.update(achievement_params)
format.html { redirect_to @achievement, notice: 'Achievement was successfully updated.' }
format.json { render :show, status: :ok, location: @achievement }
else
format.html { render :edit }
format.json { render json: @achievement.errors, status: :unprocessable_entity }
end
end
end
# DELETE /achievements/1
# DELETE /achievements/1.json
def destroy
@achievement.destroy
respond_to do |format|
format.html { redirect_to achievements_url, notice: 'Achievement was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_achievement
@achievement = Achievement.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def achievement_params
params.require(:achievement).permit(:when, :what)
end
end
| jcfausto/jcfausto-rails-website | app/controllers/achievements_controller.rb | Ruby | mit | 2,096 | [
30522,
2465,
10106,
8663,
13181,
10820,
1026,
4646,
8663,
13181,
10820,
2077,
1035,
2895,
1024,
14469,
3686,
1035,
4748,
10020,
999,
2077,
1035,
2895,
1024,
2275,
1035,
6344,
1010,
2069,
1024,
1031,
1024,
2265,
1010,
1024,
10086,
1010,
1024... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.intermine.modelproduction;
/*
* Copyright (C) 2002-2017 FlyMine
*
* This code may be freely distributed and modified under the
* terms of the GNU Lesser General Public Licence. This should
* be distributed with the code. See the LICENSE file for more
* information or http://www.gnu.org/copyleft/lesser.html.
*
*/
import java.io.InputStream;
import java.io.OutputStream;
import junit.framework.TestCase;
import org.intermine.sql.Database;
import org.intermine.sql.DatabaseFactory;
public class MetadataManagerTest extends TestCase
{
private Database db;
@Override
public void setUp() throws Exception {
db = DatabaseFactory.getDatabase("db.unittest");
}
public void testValue() throws Exception {
MetadataManager.store(db, "test_key", "Hello");
assertEquals("Hello", MetadataManager.retrieve(db, "test_key"));
}
public void testBinaryValue() throws Exception {
byte[] expected = "Hello".getBytes();
MetadataManager.storeBinary(db, "test_key_bin", expected);
InputStream is = MetadataManager.retrieveBLOBInputStream(db, "test_key_bin");
byte[] got = new byte[expected.length + 1];
assertEquals(expected.length, is.read(got));
for (int i = 0; i < expected.length; i++) {
assertEquals(expected[i], got[i]);
}
}
public void testLargeValue() throws Exception {
byte[] expected = "Hello".getBytes();
OutputStream os = MetadataManager.storeLargeBinary(db, "test_key_large");
os.write(expected);
os.close();
InputStream is = MetadataManager.readLargeBinary(db, "test_key_large");
byte[] got = new byte[expected.length + 1];
assertEquals(expected.length, is.read(got));
for (int i = 0; i < expected.length; i++) {
assertEquals(expected[i], got[i]);
}
}
public void testDeleteLargeBinary() throws Exception {
byte[] expected = "Hello".getBytes();
String key = "test_key_large";
OutputStream os = MetadataManager.storeLargeBinary(db, key);
os.write(expected);
os.close();
assertNotNull(MetadataManager.retrieve(db, key));
MetadataManager.deleteLargeBinary(db, key);
assertNull(MetadataManager.retrieve(db, key));
}
}
| elsiklab/intermine | intermine/objectstore/test/src/org/intermine/modelproduction/MetadataManagerTest.java | Java | lgpl-2.1 | 2,328 | [
30522,
7427,
8917,
1012,
6970,
11233,
1012,
2944,
21572,
16256,
1025,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2526,
1011,
2418,
4875,
30524,
8276,
2236,
2270,
11172,
1012,
2023,
2323,
1008,
2022,
5500,
2007,
1996,
3642,
1012,
2156,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\Indicator;
use PhpCsFixer\Tokenizer\Tokens;
/**
* @internal
*/
final class PhpUnitTestCaseIndicator
{
public function isPhpUnitClass(Tokens $tokens, $index)
{
if (!$tokens[$index]->isGivenKind(T_CLASS)) {
throw new \LogicException(sprintf('No T_CLASS at given index %d, got %s.', $index, $tokens[$index]->getName()));
}
$classNameIndex = $tokens->getNextMeaningfulToken($index);
if (0 !== preg_match('/(?:Test|TestCase)$/', $tokens[$classNameIndex]->getContent())) {
return true;
}
$braceIndex = $tokens->getNextTokenOfKind($index, ['{']);
$maybeParentSubNameToken = $tokens[$tokens->getPrevMeaningfulToken($braceIndex)];
if (
$maybeParentSubNameToken->isGivenKind(T_STRING) &&
0 !== preg_match('/(?:Test|TestCase)$/', $maybeParentSubNameToken->getContent())
) {
return true;
}
return false;
}
}
| Soullivaneuh/PHP-CS-Fixer | src/Indicator/PhpUnitTestCaseIndicator.php | PHP | mit | 1,255 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
25718,
20116,
8081,
2121,
1012,
1008,
1008,
1006,
1039,
1007,
6904,
11283,
2078,
8962,
2368,
19562,
1026,
6904,
11283,
2078,
1030,
25353,
2213,
14876,
4890,
1012,
401... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Xml;
using System.Xml.Serialization;
namespace Hydra.DomainModel
{
//
// **********************************************************************
/// <summary>
/// Person Item Gender Type
/// </summary>
// **********************************************************************
//
[Serializable]
[DataContract(Namespace = CommonConstants.DATA_NAMESPACE)]
public enum GenderType
{
//
// **********************************************************************
/// <summary>
/// Unknown Gender
/// </summary>
// **********************************************************************
//
[EnumMember]
[Description("Unknown")]
Unknown = 0,
//
// **********************************************************************
/// <summary>
/// Male
/// </summary>
// **********************************************************************
//
[EnumMember]
[Description("Male")]
Male = 1,
//
// **********************************************************************
/// <summary>
/// Female
/// </summary>
// **********************************************************************
//
[EnumMember]
[Description("Female")]
Female = 2,
//
// **********************************************************************
/// <summary>
/// Other
/// </summary>
// **********************************************************************
//
[EnumMember]
[Description("Other")]
Other = 3
}
}
| andywiddess/Hydra | 5/Hydra.DomainModel/GenderType.cs | C# | mit | 1,892 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
2478,
2291,
1012,
6922,
5302,
9247,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
7642,
3989,
1025,
2478,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.