blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
721
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
57
| license_type
stringclasses 2
values | repo_name
stringlengths 5
91
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 321
values | visit_date
timestamp[ns]date 2016-08-12 09:31:09
2023-09-06 10:45:07
| revision_date
timestamp[ns]date 2010-09-28 14:01:40
2023-09-06 06:22:19
| committer_date
timestamp[ns]date 2010-09-28 14:01:40
2023-09-06 06:22:19
| github_id
int64 426
681M
| star_events_count
int64 101
243k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 23
values | gha_event_created_at
timestamp[ns]date 2012-06-28 18:51:49
2023-09-14 21:59:16
⌀ | gha_created_at
timestamp[ns]date 2008-02-11 22:55:26
2023-08-10 11:14:58
⌀ | gha_language
stringclasses 147
values | src_encoding
stringclasses 26
values | language
stringclasses 2
values | is_vendor
bool 2
classes | is_generated
bool 2
classes | length_bytes
int64 6
10.2M
| extension
stringclasses 115
values | filename
stringlengths 3
113
| content
stringlengths 6
10.2M
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
738807588cc95a7b4f0e7469889d4560ad04423e
|
eb266f888155c0fa59c923d7496e875c7259f1de
|
/src/lib/lib_tag.c
|
a3330369030e3f31fc19abc447d98c57bd53feb9
|
[
"BSD-2-Clause"
] |
permissive
|
werererer/japokwm
|
e7f46b210e7daf6a7d3a6bb8c61d912c40a2cb58
|
9cdc208ed70d4b58a805431992e4078171403edd
|
refs/heads/master
| 2023-05-25T18:46:40.826666
| 2023-01-15T22:26:59
| 2023-01-15T22:26:59
| 297,172,042
| 121
| 4
|
BSD-2-Clause
| 2023-01-15T22:27:00
| 2020-09-20T22:06:29
|
C
|
UTF-8
|
C
| false
| false
| 7,926
|
c
|
lib_tag.c
|
#include "lib/lib_tag.h"
#include "client.h"
#include "container.h"
#include "list_sets/container_stack_set.h"
#include "monitor.h"
#include "root.h"
#include "server.h"
#include "tagset.h"
#include "tile/tileUtils.h"
#include "translationLayer.h"
#include "tag.h"
#include "list_sets/focus_stack_set.h"
#include "lib/lib_container.h"
#include "list_sets/list_set.h"
#include "lib/lib_container_list.h"
#include "lib/lib_list2D.h"
#include "lib/lib_layout.h"
#include "lib/lib_bitset.h"
#include "lib/lib_focus_set.h"
#include "lib/lib_direction.h"
#include "ipc-server.h"
#include "root.h"
static const struct luaL_Reg tag_meta[] =
{
{NULL, NULL},
};
static const struct luaL_Reg tag_static_getter[] =
{
{"focused", lib_tag_get_focused},
{NULL, NULL},
};
static const struct luaL_Reg tag_static_setter[] =
{
{NULL, NULL},
};
static const struct luaL_Reg tag_static_methods[] =
{
{"get", lib_tag_get},
{"get_next_empty", lib_tag_get_next_empty},
{NULL, NULL},
};
static const struct luaL_Reg tag_methods[] =
{
{"get_id", lib_tag_get_id},
{"swap", lib_tag_swap},
{"swap_smart", lib_tag_swap_smart},
{"toggle_bars", lib_tag_toggle_bars},
{NULL, NULL},
};
static const struct luaL_Reg tag_setter[] =
{
{"bars", lib_tag_set_bars_visibility},
{"tags", lib_set_tags},
{NULL, NULL},
};
static const struct luaL_Reg tag_getter[] =
{
{"bars", lib_tag_get_bars_visibility},
{"focus_set", lib_tag_get_focus_set},
{"focus_stack", lib_tag_get_focus_stack},
{"layout", lib_tag_get_layout},
{"prev_layout", lib_tag_get_previous_layout},
{"stack", lib_tag_get_stack},
{"tags", lib_tag_get_tags},
{"visible_focus_set", lib_tag_get_visible_focus_set},
{"visible_focus_stack", lib_tag_get_visible_focus_stack},
{"visible_stack", lib_tag_get_visible_stack},
{NULL, NULL},
};
void create_lua_tag(lua_State *L, struct tag *tag)
{
if (!tag)
return;
struct tag **user_con = lua_newuserdata(L, sizeof(struct tag*));
*user_con = tag;
luaL_setmetatable(L, CONFIG_tag);
}
void lua_load_tag(lua_State *L)
{
create_class(L,
tag_meta,
tag_static_methods,
tag_methods,
tag_setter,
tag_getter,
CONFIG_tag);
create_static_accessor(L,
"Tag",
tag_static_methods,
tag_static_setter,
tag_static_getter);
}
struct tag *check_tag(lua_State *L, int narg) {
void **ud = luaL_checkudata(L, narg, CONFIG_tag);
luaL_argcheck(L, ud != NULL, 1, "`container' expected");
return (struct tag *)*ud;
}
// static methods
int lib_tag_get_next_empty(lua_State *L)
{
enum wlr_direction dir = luaL_checkinteger(L, -1);
lua_pop(L, 1);
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
int tag_id = tag->id;
switch (dir) {
case WLR_DIRECTION_LEFT:
tag = get_prev_empty_tag(server_get_tags(), tag_id);
break;
case WLR_DIRECTION_RIGHT:
tag = get_next_empty_tag(server_get_tags(), tag_id);
break;
default:
if (dir & WLR_DIRECTION_LEFT && dir & WLR_DIRECTION_RIGHT) {
tag = get_nearest_empty_tag(server_get_tags(), tag_id);
} else {
tag = get_tag(tag_id);
}
}
create_lua_tag(L, tag);
return 1;
}
int lib_tag_get(lua_State *L)
{
int tag_id = lua_idx_to_c_idx(luaL_checkinteger(L, -1));
lua_pop(L, 1);
struct tag *tag = get_tag(tag_id);
create_lua_tag(L, tag);
return 1;
}
// methods
int lib_tag_swap(lua_State *L)
{
struct tag *tag2 = check_tag(L, 2);
lua_pop(L, 1);
struct tag *tag1 = check_tag(L, 1);
lua_pop(L, 1);
tag_swap(tag1, tag2);
struct monitor *m = server_get_selected_monitor();
struct tag *tag = monitor_get_active_tag(m);
tagset_reload(tag);
arrange();
update_reduced_focus_stack(tag1);
update_reduced_focus_stack(tag2);
tag_focus_most_recent_container(tag1);
tag_focus_most_recent_container(tag2);
tag_update_names(server_get_tags());
tag_focus_most_recent_container(tag);
root_damage_whole(m->root);
ipc_event_tag();
return 0;
}
int lib_tag_swap_smart(lua_State *L)
{
struct tag *tag2 = check_tag(L, 2);
lua_pop(L, 1);
struct tag *tag1 = check_tag(L, 1);
lua_pop(L, 1);
tag_swap_smart(tag1, tag2);
struct monitor *m = server_get_selected_monitor();
struct tag *tag = monitor_get_active_tag(m);
tagset_reload(tag);
arrange();
update_reduced_focus_stack(tag1);
update_reduced_focus_stack(tag2);
tag_focus_most_recent_container(tag1);
tag_focus_most_recent_container(tag2);
tag_update_names(server_get_tags());
tag_this_focus_most_recent_container();
root_damage_whole(m->root);
ipc_event_tag();
return 0;
}
int lib_tag_get_id(lua_State *L)
{
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
lua_pushinteger(L, tag->id);
return 1;
}
int lib_tag_toggle_bars(lua_State *L)
{
enum wlr_edges visible_edges =
WLR_EDGE_BOTTOM |
WLR_EDGE_RIGHT |
WLR_EDGE_LEFT |
WLR_EDGE_TOP;
if (lua_gettop(L) >= 2) {
visible_edges = luaL_checkinteger(L, 2);
lua_pop(L, 1);
}
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
toggle_bars_visible(tag, visible_edges);
return 0;
}
// setter
int lib_set_tags(lua_State *L)
{
BitSet *bitset = check_bitset(L, 2);
lua_pop(L, 1);
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
tagset_set_tags(tag, bitset);
return 0;
}
int lib_tag_set_bars_visibility(lua_State *L)
{
enum wlr_edges dir = luaL_checkinteger(L, 2);
lua_pop(L, 1);
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
set_bars_visible(tag, dir);
return 0;
}
// getter
int lib_tag_get_focused(lua_State *L)
{
struct tag *tag = server_get_selected_tag();
create_lua_tag(L, tag);
return 1;
}
int lib_tag_get_bars_visibility(lua_State *L)
{
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
lua_pushinteger(L, tag->visible_bar_edges);
return 1;
}
int lib_tag_get_focus_set(lua_State *L)
{
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
create_lua_focus_set(L, tag->focus_set);
return 1;
}
int lib_tag_get_focus_stack(lua_State *L)
{
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
create_lua_container_list(L, tag->focus_set->focus_stack_normal);
return 1;
}
int lib_tag_get_layout(lua_State *L)
{
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
struct layout *lt = tag_get_layout(tag);
create_lua_layout(L, lt);
return 1;
}
int lib_tag_get_previous_layout(lua_State *L)
{
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
struct layout *prev_layout = tag_get_previous_layout(tag);
create_lua_layout(L, prev_layout);
return 1;
}
int lib_tag_get_stack(lua_State *L)
{
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
create_lua_container_list(L, tag->con_set->tiled_containers);
return 1;
}
int lib_tag_get_tags(lua_State *L)
{
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
BitSet *tags = tag->tags;
create_lua_bitset_with_tag(L, tags);
return 1;
}
int lib_tag_get_visible_focus_set(lua_State *L)
{
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
create_lua_focus_set(L, tag->visible_focus_set);
return 1;
}
int lib_tag_get_visible_focus_stack(lua_State *L)
{
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
create_lua_container_list(L, tag->visible_focus_set->focus_stack_normal);
return 1;
}
int lib_tag_get_visible_stack(lua_State *L)
{
struct tag *tag = check_tag(L, 1);
lua_pop(L, 1);
create_lua_container_list(L, tag->visible_con_set->tiled_containers);
return 1;
}
|
6163f68bbc82fff32ab0fad82394c20b8a167304
|
83f6b6623dccad62ca373034505275c6203333dd
|
/core/os/device/deviceinfo/cc/vk_lite.h
|
363e7aaa4728cdce6a13c25f3912d5d2dc9a358b
|
[
"Apache-2.0"
] |
permissive
|
google/gapid
|
318be6c1e551d52d6a3d186ea432111d7c0166a0
|
15b44454df3a2469ee9ba42cb116d9b50786c7a4
|
refs/heads/master
| 2023-08-25T10:56:05.609259
| 2022-06-06T13:49:01
| 2022-06-06T13:49:01
| 81,937,787
| 2,268
| 377
|
Apache-2.0
| 2023-04-22T20:06:17
| 2017-02-14T11:18:43
|
Go
|
UTF-8
|
C
| false
| false
| 13,397
|
h
|
vk_lite.h
|
/*
* Copyright (C) 2017 Google 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.
*/
#ifndef GAPID_CORE_OS_DEVICEINFO_VK_LITE
#define GAPID_CORE_OS_DEVICEINFO_VK_LITE
#include "core/cc/static_array.h"
#include "core/cc/vulkan_ptr_types.h"
// Enums
typedef enum VkStructureType {
VK_STRUCTURE_TYPE_APPLICATION_INFO = 0,
VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1,
VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2,
VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3,
} VkStructureType;
typedef enum VkResult {
VK_SUCCESS = 0,
VK_NOT_READY = 1,
VK_TIMEOUT = 2,
VK_EVENT_SET = 3,
VK_EVENT_RESET = 4,
VK_INCOMPLETE = 5,
VK_ERROR_OUT_OF_HOST_MEMORY = 4294967295,
VK_ERROR_OUT_OF_DEVICE_MEMORY = 4294967294,
VK_ERROR_INITIALIZATION_FAILED = 4294967293,
VK_ERROR_DEVICE_LOST = 4294967292,
VK_ERROR_MEMORY_MAP_FAILED = 4294967291,
VK_ERROR_LAYER_NOT_PRESENT = 4294967290,
VK_ERROR_EXTENSION_NOT_PRESENT = 4294967289,
VK_ERROR_FEATURE_NOT_PRESENT = 4294967288,
VK_ERROR_INCOMPATIBLE_DRIVER = 4294967287,
VK_ERROR_TOO_MANY_OBJECTS = 4294967286,
VK_ERROR_FORMAT_NOT_SUPPORTED = 4294967285,
VK_ERROR_SURFACE_LOST_KHR = 3294967296,
VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = 3294967295,
VK_SUBOPTIMAL_KHR = 1000001003,
VK_ERROR_OUT_OF_DATE_KHR = 3294966292,
VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = 3294964295,
VK_ERROR_VALIDATION_FAILED_EXT = 3294956295,
VK_ERROR_INVALID_SHADER_NV = 1000012000,
} VkResult;
typedef enum {
VK_QUEUE_GRAPHICS_BIT = 0x00000001,
VK_QUEUE_COMPUTE_BIT = 0x00000002,
VK_QUEUE_TRANSFER_BIT = 0x00000004,
VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008,
VK_QUEUE_PROTECTED_BIT = 0x00000010,
VK_QUEUE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF,
} VkQueueFlagBits;
enum class VkPhysicalDeviceType : uint32_t {
VK_PHYSICAL_DEVICE_TYPE_OTHER = 0,
VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1,
VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2,
VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3,
VK_PHYSICAL_DEVICE_TYPE_CPU = 4,
};
// Type alias
typedef uint32_t VkBool32;
typedef uint32_t VkFlags;
typedef uint64_t VkDeviceSize;
typedef size_t VkInstance;
typedef size_t VkPhysicalDevice;
typedef size_t VkDevice;
typedef VkFlags VkDeviceCreateFlags;
typedef VkFlags VkDeviceQueueCreateFlags;
typedef VkFlags VkInstanceCreateFlags;
typedef VkFlags VkQueueFlags;
typedef VkFlags VkSampleCountFlags;
typedef void* PFN_vkAllocationFunction;
typedef void* PFN_vkReallocationFunction;
typedef void* PFN_vkFreeFunction;
typedef void* PFN_vkInternalAllocationNotification;
typedef void* PFN_vkInternalFreeNotification;
typedef void* PFN_vkVoidFunction;
// Structs
typedef struct {
core::StaticArray<char, 256> layerName;
uint32_t specVersion;
uint32_t implementationVersion;
core::StaticArray<char, 256> description;
} VkLayerProperties;
typedef struct {
core::StaticArray<char, 256> extensionName;
uint32_t specVersion;
} VkExtensionProperties;
typedef struct {
VkBool32 robustBufferAccess;
VkBool32 fullDrawIndexUint32;
VkBool32 imageCubeArray;
VkBool32 independentBlend;
VkBool32 geometryShader;
VkBool32 tessellationShader;
VkBool32 sampleRateShading;
VkBool32 dualSrcBlend;
VkBool32 logicOp;
VkBool32 multiDrawIndirect;
VkBool32 drawIndirectFirstInstance;
VkBool32 depthClamp;
VkBool32 depthBiasClamp;
VkBool32 fillModeNonSolid;
VkBool32 depthBounds;
VkBool32 wideLines;
VkBool32 largePoints;
VkBool32 alphaToOne;
VkBool32 multiViewport;
VkBool32 samplerAnisotropy;
VkBool32 textureCompressionETC2;
VkBool32 textureCompressionASTC_LDR;
VkBool32 textureCompressionBC;
VkBool32 occlusionQueryPrecise;
VkBool32 pipelineStatisticsQuery;
VkBool32 vertexPipelineStoresAndAtomics;
VkBool32 fragmentStoresAndAtomics;
VkBool32 shaderTessellationAndGeometryPointSize;
VkBool32 shaderImageGatherExtended;
VkBool32 shaderStorageImageExtendedFormats;
VkBool32 shaderStorageImageMultisample;
VkBool32 shaderStorageImageReadWithoutFormat;
VkBool32 shaderStorageImageWriteWithoutFormat;
VkBool32 shaderUniformBufferArrayDynamicIndexing;
VkBool32 shaderSampledImageArrayDynamicIndexing;
VkBool32 shaderStorageBufferArrayDynamicIndexing;
VkBool32 shaderStorageImageArrayDynamicIndexing;
VkBool32 shaderClipDistance;
VkBool32 shaderCullDistance;
VkBool32 shaderFloat64;
VkBool32 shaderInt64;
VkBool32 shaderInt16;
VkBool32 shaderResourceResidency;
VkBool32 shaderResourceMinLod;
VkBool32 sparseBinding;
VkBool32 sparseResidencyBuffer;
VkBool32 sparseResidencyImage2D;
VkBool32 sparseResidencyImage3D;
VkBool32 sparseResidency2Samples;
VkBool32 sparseResidency4Samples;
VkBool32 sparseResidency8Samples;
VkBool32 sparseResidency16Samples;
VkBool32 sparseResidencyAliased;
VkBool32 variableMultisampleRate;
VkBool32 inheritedQueries;
} VkPhysicalDeviceFeatures;
typedef struct {
VkStructureType sType;
void* pNext;
char* pApplicationName;
uint32_t applicationVersion;
char* pEngineName;
uint32_t engineVersion;
uint32_t apiVersion;
} VkApplicationInfo;
typedef struct {
VkStructureType sType;
void* pNext;
VkInstanceCreateFlags flags;
VkApplicationInfo* pApplicationInfo;
uint32_t enabledLayerCount;
char** ppEnabledLayerNames;
uint32_t enabledExtensionCount;
char** ppEnabledExtensionNames;
} VkInstanceCreateInfo;
typedef struct {
VkStructureType sType;
const void* pNext;
VkDeviceQueueCreateFlags flags;
uint32_t queueFamilyIndex;
uint32_t qeueCount;
const float* pQueuePriorities;
} VkDeviceQueueCreateInfo;
typedef struct {
VkStructureType sType;
const void* pNext;
VkDeviceCreateFlags flags;
uint32_t queueCreateInfoCount;
const VkDeviceQueueCreateInfo* pQueueCreateInfos;
uint32_t enabledLayerCount;
const char* const* ppEnabledLayerNames;
uint32_t enabledExtensionCount;
const char* const* ppEnabledExtensionNames;
const VkPhysicalDeviceFeatures* pEnabledFeatures;
} VkDeviceCreateInfo;
typedef struct {
uint32_t maxImageDimension1D;
uint32_t maxImageDimension2D;
uint32_t maxImageDimension3D;
uint32_t maxImageDimensionCube;
uint32_t maxImageArrayLayers;
uint32_t maxTexelBufferElements;
uint32_t maxUniformBufferRange;
uint32_t maxStorageBufferRange;
uint32_t maxPushConstantsSize;
uint32_t maxMemoryAllocationCount;
uint32_t maxSamplerAllocationCount;
VkDeviceSize bufferImageGranularity;
VkDeviceSize sparseAddressSpaceSize;
uint32_t maxBoundDescriptorSets;
uint32_t maxPerStageDescriptorSamplers;
uint32_t maxPerStageDescriptorUniformBuffers;
uint32_t maxPerStageDescriptorStorageBuffers;
uint32_t maxPerStageDescriptorSampledImages;
uint32_t maxPerStageDescriptorStorageImages;
uint32_t maxPerStageDescriptorInputAttachments;
uint32_t maxPerStageResources;
uint32_t maxDescriptorSetSamplers;
uint32_t maxDescriptorSetUniformBuffers;
uint32_t maxDescriptorSetUniformBuffersDynamic;
uint32_t maxDescriptorSetStorageBuffers;
uint32_t maxDescriptorSetStorageBuffersDynamic;
uint32_t maxDescriptorSetSampledImages;
uint32_t maxDescriptorSetStorageImages;
uint32_t maxDescriptorSetInputAttachments;
uint32_t maxVertexInputAttributes;
uint32_t maxVertexInputBindings;
uint32_t maxVertexInputAttributeOffset;
uint32_t maxVertexInputBindingStride;
uint32_t maxVertexOutputComponents;
uint32_t maxTessellationGenerationLevel;
uint32_t maxTessellationPatchSize;
uint32_t maxTessellationControlPerVertexInputComponents;
uint32_t maxTessellationControlPerVertexOutputComponents;
uint32_t maxTessellationControlPerPatchOutputComponents;
uint32_t maxTessellationControlTotalOutputComponents;
uint32_t maxTessellationEvaluationInputComponents;
uint32_t maxTessellationEvaluationOutputComponents;
uint32_t maxGeometryShaderInvocations;
uint32_t maxGeometryInputComponents;
uint32_t maxGeometryOutputComponents;
uint32_t maxGeometryOutputVertices;
uint32_t maxGeometryTotalOutputComponents;
uint32_t maxFragmentInputComponents;
uint32_t maxFragmentOutputAttachments;
uint32_t maxFragmentDualSrcAttachments;
uint32_t maxFragmentCombinedOutputResources;
uint32_t maxComputeSharedMemorySize;
core::StaticArray<uint32_t, 3> maxComputeWorkGroupCount;
uint32_t maxComputeWorkGroupInvocations;
core::StaticArray<uint32_t, 3> maxComputeWorkGroupSize;
uint32_t subPixelPrecisionBits;
uint32_t subTexelPrecisionBits;
uint32_t mipmapPrecisionBits;
uint32_t maxDrawIndexedIndexValue;
uint32_t maxDrawIndirectCount;
float maxSamplerLodBias;
float maxSamplerAnisotropy;
uint32_t maxViewports;
core::StaticArray<uint32_t, 2> maxViewportDimensions;
core::StaticArray<float, 2> viewportBoundsRange;
uint32_t viewportSubPixelBits;
size_t minMemoryMapAlignment;
VkDeviceSize minTexelBufferOffsetAlignment;
VkDeviceSize minUniformBufferOffsetAlignment;
VkDeviceSize minStorageBufferOffsetAlignment;
int32_t minTexelOffset;
uint32_t maxTexelOffset;
int32_t minTexelGatherOffset;
uint32_t maxTexelGatherOffset;
float minInterpolationOffset;
float maxInterpolationOffset;
uint32_t subPixelInterpolationOffsetBits;
uint32_t maxFramebufferWidth;
uint32_t maxFramebufferHeight;
uint32_t maxFramebufferLayers;
VkSampleCountFlags framebufferColorSampleCounts;
VkSampleCountFlags framebufferDepthSampleCounts;
VkSampleCountFlags framebufferStencilSampleCounts;
VkSampleCountFlags framebufferNoAttachmentSampleCounts;
uint32_t maxColorAttachments;
VkSampleCountFlags sampledImageColorSampleCounts;
VkSampleCountFlags sampledImageIntegerSampleCounts;
VkSampleCountFlags sampledImageDepthSampleCounts;
VkSampleCountFlags sampledImageStencilSampleCounts;
VkSampleCountFlags storageImageSampleCounts;
uint32_t maxSampleMaskWords;
VkBool32 timestampComputeAndGraphics;
float timestampPeriod;
uint32_t maxClipDistances;
uint32_t maxCullDistances;
uint32_t maxCombinedClipAndCullDistances;
uint32_t discreteQueuePriorities;
core::StaticArray<float, 2> pointSizeRange;
core::StaticArray<float, 2> lineWidthRange;
float pointSizeGranularity;
float lineWidthGranularity;
VkBool32 strictLines;
VkBool32 standardSampleLocations;
VkDeviceSize optimalBufferCopyOffsetAlignment;
VkDeviceSize optimalBufferCopyRowPitchAlignment;
VkDeviceSize nonCoherentAtomSize;
} VkPhysicalDeviceLimits;
typedef struct {
VkBool32 residencyStandard2DBlockShape;
VkBool32 residencyStandard2DMultisampleBlockShape;
VkBool32 residencyStandard3DBlockShape;
VkBool32 residencyAlignedMipSize;
VkBool32 residencyNonResidentStrict;
} VkPhysicalDeviceSparseProperties;
typedef struct {
uint32_t apiVersion;
uint32_t driverVersion;
uint32_t vendorID;
uint32_t deviceID;
VkPhysicalDeviceType deviceType;
core::StaticArray<char, 256> deviceName;
core::StaticArray<uint8_t, 16> pipelineCacheUUID;
VkPhysicalDeviceLimits limits;
VkPhysicalDeviceSparseProperties sparseProperties;
} VkPhysicalDeviceProperties;
typedef struct {
uint32_t width;
uint32_t height;
uint32_t depth;
} VkExtent3D;
typedef struct {
VkQueueFlags queueFlags;
uint32_t queueCount;
uint32_t timestampValidBits;
VkExtent3D minImageTransferGranularity;
} VkQueueFamilyProperties;
typedef struct {
void* pUserData;
PFN_vkAllocationFunction pfnAllocation;
PFN_vkReallocationFunction pfnReallocation;
PFN_vkFreeFunction pfnFree;
PFN_vkInternalAllocationNotification pfnInternalAllocation;
PFN_vkInternalFreeNotification pfnInternalFree;
} VkAllocationCallbacks;
// Function types
typedef PFN_vkVoidFunction(VULKAN_API_PTR* PFNVKGETINSTANCEPROCADDR)(
VkInstance instance, const char* pName);
typedef VkResult(VULKAN_API_PTR* PFNVKENUMERATEINSTANCELAYERPROPERTIES)(
uint32_t* pPropertyCount, VkLayerProperties* pProperties);
typedef VkResult(VULKAN_API_PTR* PFNVKENUMERATEINSTANCEEXTENSIONPROPERTIES)(
const char* pLayerName, uint32_t* pPropertyCount,
VkExtensionProperties* pProperties);
typedef VkResult(VULKAN_API_PTR* PFNVKCREATEINSTANCE)(
VkInstanceCreateInfo* pCreateInfo, VkAllocationCallbacks* pAllocator,
VkInstance* pInstance);
typedef void(VULKAN_API_PTR* PFNVKDESTROYINSTANCE)(
VkInstance instance, VkAllocationCallbacks* pAllocator);
typedef VkResult(VULKAN_API_PTR* PFNVKENUMERATEPHYSICALDEVICES)(
VkInstance instance, uint32_t* pPhysicalDeviceCount,
VkPhysicalDevice* pPhysicalDevices);
typedef void(VULKAN_API_PTR* PFNVKGETPHYSICALDEVICEPROPERTIES)(
VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties);
typedef void(VULKAN_API_PTR* PFNVKGETPHYSICALDEVICEQUEUEFAMILYPROPERTIES)(
VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount,
VkQueueFamilyProperties* pQueueFamilyProperties);
typedef VkResult(VULKAN_API_PTR* PFNVKCREATEDEVICE)(
VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator, VkDevice* pDevice);
#endif // GAPID_CORE_OS_DEVICEINFO_VK_LITE
|
7921a59dedee0fe404d6b629adc1995f02e6d964
|
aa3befea459382dc5c01c925653d54f435b3fb0f
|
/include/stdint.h
|
a6d8654970f69fe24452dd941abbd6d3c62c1c99
|
[
"MIT-open-group",
"BSD-3-Clause",
"HPND-sell-variant",
"BSD-4-Clause-UC",
"LicenseRef-scancode-warranty-disclaimer",
"MIT-0",
"LicenseRef-scancode-bsd-atmel",
"LicenseRef-scancode-gary-s-brown",
"LicenseRef-scancode-proprietary-license",
"SunPro",
"MIT",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-other-permissive",
"HPND",
"ISC",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"GPL-1.0-or-later",
"CC-BY-2.0",
"CC-BY-4.0"
] |
permissive
|
apache/nuttx
|
14519a7bff4a87935d94fb8fb2b19edb501c7cec
|
606b6d9310fb25c7d92c6f95bf61737e3c79fa0f
|
refs/heads/master
| 2023-08-25T06:55:45.822534
| 2023-08-23T16:03:31
| 2023-08-24T21:25:47
| 228,103,273
| 407
| 241
|
Apache-2.0
| 2023-09-14T18:26:05
| 2019-12-14T23:27:55
|
C
|
UTF-8
|
C
| false
| false
| 7,622
|
h
|
stdint.h
|
/****************************************************************************
* include/stdint.h
*
* 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.
*
****************************************************************************/
#ifndef __INCLUDE_STDINT_H
#define __INCLUDE_STDINT_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifdef CONFIG_ARCH_STDINT_H
# include <arch/stdint.h>
#else
# include <nuttx/compiler.h>
# include <arch/types.h>
# include <arch/inttypes.h>
# include <limits.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Limits of exact-width integer types */
#define INT8_MIN (-INT8_MAX - 1)
#define INT8_MAX INT8_C(127)
#define UINT8_MAX UINT8_C(255)
#define INT16_MIN (-INT16_MAX - 1)
#define INT16_MAX INT16_C(32767)
#define UINT16_MAX UINT16_C(65535)
#ifdef __INT24_DEFINED
# define INT24_MIN (-INT24_MAX - 1)
# define INT24_MAX INT24_C(8388607)
# define UINT24_MAX UINT24_C(16777215)
#endif
#define INT32_MIN (-INT32_MAX - 1)
#define INT32_MAX INT32_C(2147483647)
#define UINT32_MAX UINT32_C(4294967295)
#ifdef __INT64_DEFINED
# define INT64_MIN (-INT64_MAX - 1)
# define INT64_MAX INT64_C(9223372036854775807)
# define UINT64_MAX UINT64_C(18446744073709551615)
#endif
/* Limits of minimum-width integer types */
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST16_MAX INT16_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#ifdef __INT24_DEFINED
# define INT_LEAST24_MIN INT24_MIN
# define INT_LEAST24_MAX INT24_MAX
# define UINT_LEAST24_MAX UINT24_MAX
#endif
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#ifdef __INT64_DEFINED
# define INT_LEAST64_MIN INT64_MIN
# define INT_LEAST64_MAX INT64_MAX
# define UINT_LEAST64_MAX UINT64_MAX
#endif
/* Limits of fastest minimum-width integer types */
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST8_MAX INT8_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define INT_FAST16_MIN INT16_MIN
#define INT_FAST16_MAX INT16_MAX
#define UINT_FAST16_MAX UINT16_MAX
#ifdef __INT24_DEFINED
# define INT_FAST24_MIN INT24_MIN
# define INT_FAST24_MAX INT24_MAX
# define UINT_FAST24_MAX UINT24_MAX
#endif
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST32_MAX INT32_MAX
#define UINT_FAST32_MAX UINT32_MAX
#ifdef __INT64_DEFINED
# define INT_FAST64_MIN INT64_MIN
# define INT_FAST64_MAX INT64_MAX
# define UINT_FAST64_MAX UINT64_MAX
#endif
/* Limits of integer types capable of holding object pointers */
#define INTPTR_MIN PTR_MIN
#define INTPTR_MAX PTR_MAX
#define UINTPTR_MAX UPTR_MAX
/* Limits of sig_atomic_t type */
#define SIG_ATOMIC_MIN INT32_MIN
#define SIG_ATOMIC_MAX INT32_MAX
/* Limits of greatest-width integer types */
#ifdef __INT64_DEFINED
# define INTMAX_MIN INT64_MIN
# define INTMAX_MAX INT64_MAX
# define UINTMAX_MIN UINT64_MIN
# define UINTMAX_MAX UINT64_MAX
# define INTMAX_C(x) INT64_C(x)
# define UINTMAX_C(x) UINT64_C(x)
#else
# define INTMAX_MIN INT32_MIN
# define INTMAX_MAX INT32_MAX
# define UINTMAX_MIN UINT32_MIN
# define UINTMAX_MAX UINT32_MAX
# define INTMAX_C(x) INT32_C(x)
# define UINTMAX_C(x) UINT32_C(x)
#endif
/****************************************************************************
* Public Types
****************************************************************************/
/* Exact-width integer types. NOTE that these types are defined in
* architecture-specific logic with leading underscore character. This file
* typedef's these to the final name without the underscore character. This
* roundabout way of doings things allows the stdint.h to be removed from the
* include/ directory in the event that the user prefers to use the
* definitions provided by their toolchain header files.
*/
typedef _int8_t int8_t;
typedef _uint8_t uint8_t;
typedef _int16_t int16_t;
typedef _uint16_t uint16_t;
#ifdef __INT24_DEFINED
typedef _int24_t int24_t;
typedef _uint24_t uint24_t;
#endif
typedef _int32_t int32_t;
typedef _uint32_t uint32_t;
#ifdef __INT64_DEFINED
typedef _int64_t int64_t;
typedef _uint64_t uint64_t;
#endif
/* Minimum-width integer types */
typedef _int8_t int_least8_t;
typedef _uint8_t uint_least8_t;
typedef _int16_t int_least16_t;
typedef _uint16_t uint_least16_t;
#ifdef __INT24_DEFINED
typedef _int24_t int_least24_t;
typedef _uint24_t uint_least24_t;
#else
typedef _int32_t int_least24_t;
typedef _uint32_t uint_least24_t;
#endif
typedef _int32_t int_least32_t;
typedef _uint32_t uint_least32_t;
#ifdef __INT64_DEFINED
typedef _int64_t int_least64_t;
typedef _uint64_t uint_least64_t;
#endif
/* Fastest minimum-width integer types */
typedef _int8_t int_fast8_t;
typedef _uint8_t uint_fast8_t;
typedef int int_fast16_t;
typedef unsigned int uint_fast16_t;
#ifdef __INT24_DEFINED
typedef _int24_t int_fast24_t;
typedef _uint24_t uint_fast24_t;
#else
typedef _int32_t int_fast24_t;
typedef _uint32_t uint_fast24_t;
#endif
typedef _int32_t int_fast32_t;
typedef _uint32_t uint_fast32_t;
#ifdef __INT64_DEFINED
typedef _int64_t int_fast64_t;
typedef _uint64_t uint_fast64_t;
#endif
/* Integer types capable of holding object pointers
* As a general rule, the size of size_t should be the same as the size of
* uintptr_t: 32-bits on a machine with 32-bit addressing but 64-bits on a
* machine with 64-bit addressing.
*/
typedef _ssize_t intptr_t;
typedef _size_t uintptr_t;
/* Some architectures support a FAR pointer which is larger then the normal
* (near) pointer
*/
#ifdef CONFIG_HAVE_FARPOINTER
typedef _int_farptr_t int_farptr_t;
typedef _uint_farptr_t uint_farptr_t;
#endif
/* Greatest-width integer types */
typedef _intmax_t intmax_t;
typedef _uintmax_t uintmax_t;
#endif /* CONFIG_ARCH_STDINT_H */
#endif /* __INCLUDE_STDINT_H */
|
8f2693b91cde7187ebd7f77fbb1bb216005c0a9c
|
da1500e0d3040497614d5327d2461a22e934b4d8
|
/third_party/llvm-project/compiler-rt/test/builtins/Unit/divdf3_test.c
|
1b8f2b398a91ff3d549e1e31c72b6f6cd35ae450
|
[
"NCSA",
"MIT",
"LLVM-exception",
"Apache-2.0",
"BSD-3-Clause",
"GPL-1.0-or-later",
"LGPL-2.0-or-later"
] |
permissive
|
youtube/cobalt
|
34085fc93972ebe05b988b15410e99845efd1968
|
acefdaaadd3ef46f10f63d1acae2259e4024d383
|
refs/heads/main
| 2023-09-01T13:09:47.225174
| 2023-09-01T08:54:54
| 2023-09-01T08:54:54
| 50,049,789
| 169
| 80
|
BSD-3-Clause
| 2023-09-14T21:50:50
| 2016-01-20T18:11:34
| null |
UTF-8
|
C
| false
| false
| 3,895
|
c
|
divdf3_test.c
|
// RUN: %clang_builtins %s %librt -o %t && %run %t
// REQUIRES: librt_has_divdf3
#include "int_lib.h"
#include <stdio.h>
#include "fp_test.h"
// Returns: a / b
COMPILER_RT_ABI double __divdf3(double a, double b);
int test__divdf3(double a, double b, uint64_t expected)
{
double x = __divdf3(a, b);
int ret = compareResultD(x, expected);
if (ret){
printf("error in test__divdf3(%.20e, %.20e) = %.20e, "
"expected %.20e\n", a, b, x,
fromRep64(expected));
}
return ret;
}
int main()
{
// Returned NaNs are assumed to be qNaN by default
// qNaN / any = qNaN
if (test__divdf3(makeQNaN64(), 3., UINT64_C(0x7ff8000000000000)))
return 1;
// NaN / any = NaN
if (test__divdf3(makeNaN64(UINT64_C(0x123)), 3., UINT64_C(0x7ff8000000000000)))
return 1;
// any / qNaN = qNaN
if (test__divdf3(3., makeQNaN64(), UINT64_C(0x7ff8000000000000)))
return 1;
// any / NaN = NaN
if (test__divdf3(3., makeNaN64(UINT64_C(0x123)), UINT64_C(0x7ff8000000000000)))
return 1;
// +Inf / positive = +Inf
if (test__divdf3(makeInf64(), 3., UINT64_C(0x7ff0000000000000)))
return 1;
// +Inf / negative = -Inf
if (test__divdf3(makeInf64(), -3., UINT64_C(0xfff0000000000000)))
return 1;
// -Inf / positive = -Inf
if (test__divdf3(makeNegativeInf64(), 3., UINT64_C(0xfff0000000000000)))
return 1;
// -Inf / negative = +Inf
if (test__divdf3(makeNegativeInf64(), -3., UINT64_C(0x7ff0000000000000)))
return 1;
// Inf / Inf = NaN
if (test__divdf3(makeInf64(), makeInf64(), UINT64_C(0x7ff8000000000000)))
return 1;
// 0.0 / 0.0 = NaN
if (test__divdf3(+0x0.0p+0, +0x0.0p+0, UINT64_C(0x7ff8000000000000)))
return 1;
// +0.0 / +Inf = +0.0
if (test__divdf3(+0x0.0p+0, makeInf64(), UINT64_C(0x0)))
return 1;
// +Inf / +0.0 = +Inf
if (test__divdf3(makeInf64(), +0x0.0p+0, UINT64_C(0x7ff0000000000000)))
return 1;
// positive / +0.0 = +Inf
if (test__divdf3(+1.0, +0x0.0p+0, UINT64_C(0x7ff0000000000000)))
return 1;
// positive / -0.0 = -Inf
if (test__divdf3(+1.0, -0x0.0p+0, UINT64_C(0xfff0000000000000)))
return 1;
// negative / +0.0 = -Inf
if (test__divdf3(-1.0, +0x0.0p+0, UINT64_C(0xfff0000000000000)))
return 1;
// negative / -0.0 = +Inf
if (test__divdf3(-1.0, -0x0.0p+0, UINT64_C(0x7ff0000000000000)))
return 1;
// 1/3
if (test__divdf3(1., 3., UINT64_C(0x3fd5555555555555)))
return 1;
// smallest normal result
if (test__divdf3(0x1.0p-1021, 2., UINT64_C(0x10000000000000)))
return 1;
// divisor is exactly 1.0
if (test__divdf3(0x1.0p+0, 0x1.0p+0, UINT64_C(0x3ff0000000000000)))
return 1;
// divisor is truncated to exactly 1.0 in UQ1.31
if (test__divdf3(0x1.0p+0, 0x1.00000001p+0, UINT64_C(0x3fefffffffe00000)))
return 1;
// smallest normal value divided by 2.0
if (test__divdf3(0x1.0p-1022, 2., UINT64_C(0x0008000000000000)))
return 1;
// smallest subnormal result
if (test__divdf3(0x1.0p-1022, 0x1.0p+52, UINT64_C(0x0000000000000001)))
return 1;
// some misc test cases obtained by fuzzing against h/w implementation
if (test__divdf3(0x1.fdc239dd64735p-658, -0x1.fff9364c0843fp-948, UINT64_C(0xd20fdc8fc0ceffb1)))
return 1;
if (test__divdf3(-0x1.78abb261d47c8p+794, 0x1.fb01d537cc5aep+266, UINT64_C(0xe0e7c6148ffc23e3)))
return 1;
if (test__divdf3(-0x1.da7dfe6048b8bp-875, 0x1.ffc7ea3ff60a4p-610, UINT64_C(0xaf5dab1fe0269e2a)))
return 1;
if (test__divdf3(0x1.0p-1022, 0x1.9p+5, UINT64_C(0x000051eb851eb852)))
return 1;
if (test__divdf3(0x1.0p-1022, 0x1.0028p+41, UINT64_C(0x00000000000007ff)))
return 1;
if (test__divdf3(0x1.0p-1022, 0x1.0028p+52, UINT64_C(0x1)))
return 1;
return 0;
}
|
2110b505ac9b2d0965105d74753995412cb63157
|
bed3ac926beac0f4e0293303d7b2a6031ee476c9
|
/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/lapack/complex16/zunmqr.h
|
9b50ddc940201b3280bb77f3a4b36a56c240a432
|
[
"IJG",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"SMLNJ",
"BSD-3-Clause",
"BSD-4.3TAHOE",
"LicenseRef-scancode-free-unknown",
"Spencer-86",
"LicenseRef-scancode-llnl",
"FSFUL",
"Libpng",
"libtiff",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-hdf5",
"MIT",
"NTP",
"LicenseRef-scancode-mit-old-style",
"GPL-1.0-or-later",
"LicenseRef-scancode-unknown-license-reference",
"MPL-2.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] |
permissive
|
InsightSoftwareConsortium/ITK
|
ed9dbbc5b8b3f7511f007c0fc0eebb3ad37b88eb
|
3eb8fd7cdfbc5ac2d0c2e5e776848a4cbab3d7e1
|
refs/heads/master
| 2023-08-31T17:21:47.754304
| 2023-08-31T00:58:51
| 2023-08-31T14:12:21
| 800,928
| 1,229
| 656
|
Apache-2.0
| 2023-09-14T17:54:00
| 2010-07-27T15:48:04
|
C++
|
UTF-8
|
C
| false
| false
| 442
|
h
|
zunmqr.h
|
extern int v3p_netlib_zunmqr_(
char *side,
char *trans,
v3p_netlib_integer *m,
v3p_netlib_integer *n,
v3p_netlib_integer *k,
v3p_netlib_doublecomplex *a,
v3p_netlib_integer *lda,
v3p_netlib_doublecomplex *tau,
v3p_netlib_doublecomplex *c__,
v3p_netlib_integer *ldc,
v3p_netlib_doublecomplex *work,
v3p_netlib_integer *lwork,
v3p_netlib_integer *info,
v3p_netlib_ftnlen side_len,
v3p_netlib_ftnlen trans_len
);
|
f6f15aa88003ba2d1607a0f5314c3df53a762090
|
e73547787354afd9b717ea57fe8dd0695d161821
|
/src/world/area_dgb/dgb_06/dgb_06_0_header.c
|
20c86d5e3b9209be4f4ddbb5d24ebd7e91745274
|
[] |
no_license
|
pmret/papermario
|
8b514b19653cef8d6145e47499b3636b8c474a37
|
9774b26d93f1045dd2a67e502b6efc9599fb6c31
|
refs/heads/main
| 2023-08-31T07:09:48.951514
| 2023-08-21T18:07:08
| 2023-08-21T18:07:08
| 287,151,133
| 904
| 139
| null | 2023-09-14T02:44:23
| 2020-08-13T01:22:57
|
C
|
UTF-8
|
C
| false
| false
| 346
|
c
|
dgb_06_0_header.c
|
#include "dgb_06.h"
EntryList N(Entrances) = {
[dgb_06_ENTRY_0] { -575.0, 0.0, 175.0, 90.0 },
[dgb_06_ENTRY_1] { -150.0, 100.0, -250.0, 0.0 },
};
MapSettings N(settings) = {
.main = &N(EVS_Main),
.entryList = &N(Entrances),
.entryCount = ENTRY_COUNT(N(Entrances)),
.tattle = { MSG_MapTattle_dgb_06 },
};
|
7f2bc1f8b5277a20ae0b89e7ba81ce448d105903
|
83b8b30ebb633eecd29ca0a7a20cc43a293c9333
|
/ports/cxd56/common-hal/analogio/AnalogIn.c
|
bb19d02c25217f0b41a2592f1a5a3780d028cb68
|
[
"MIT",
"GPL-1.0-or-later",
"LicenseRef-scancode-proprietary-license"
] |
permissive
|
adafruit/circuitpython
|
430ec895149d1eb814b505db39b4977a35ee88a7
|
506dca71b0cbb7af749bb51f86b01021db5483b3
|
refs/heads/main
| 2023-08-21T16:30:46.781068
| 2023-08-20T00:39:44
| 2023-08-20T00:39:44
| 66,166,069
| 3,806
| 1,560
|
MIT
| 2023-09-14T19:23:51
| 2016-08-20T20:10:40
|
C
|
UTF-8
|
C
| false
| false
| 4,311
|
c
|
AnalogIn.c
|
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright 2019 Sony Semiconductor Solutions Corporation
*
* 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.
*/
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <arch/chip/scu.h>
#include <arch/chip/adc.h>
#include "py/runtime.h"
#include "shared-bindings/analogio/AnalogIn.h"
#include "shared-bindings/microcontroller/Pin.h"
typedef struct {
const char *devpath;
const mcu_pin_obj_t *pin;
int fd;
} analogin_dev_t;
STATIC analogin_dev_t analogin_dev[] = {
{"/dev/lpadc0", &pin_LPADC0, -1},
{"/dev/lpadc1", &pin_LPADC1, -1},
{"/dev/lpadc2", &pin_LPADC2, -1},
{"/dev/lpadc3", &pin_LPADC3, -1},
{"/dev/hpadc0", &pin_HPADC0, -1},
{"/dev/hpadc1", &pin_HPADC1, -1},
};
void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, const mcu_pin_obj_t *pin) {
if (!pin->analog) {
raise_ValueError_invalid_pin();
}
self->number = -1;
for (int i = 0; i < MP_ARRAY_SIZE(analogin_dev); i++) {
if (pin->number == analogin_dev[i].pin->number) {
self->number = i;
break;
}
}
if (self->number < 0) {
raise_ValueError_invalid_pin();
}
if (analogin_dev[self->number].fd < 0) {
analogin_dev[self->number].fd = open(analogin_dev[self->number].devpath, O_RDONLY);
if (analogin_dev[self->number].fd < 0) {
raise_ValueError_invalid_pin();
}
}
// SCU FIFO overwrite
ioctl(analogin_dev[self->number].fd, SCUIOC_SETFIFOMODE, 1);
// ADC FIFO size
ioctl(analogin_dev[self->number].fd, ANIOC_CXD56_FIFOSIZE, 2);
// start ADC
ioctl(analogin_dev[self->number].fd, ANIOC_CXD56_START, 0);
self->pin = pin;
}
void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) {
if (common_hal_analogio_analogin_deinited(self)) {
return;
}
// stop ADC
ioctl(analogin_dev[self->number].fd, ANIOC_CXD56_STOP, 0);
close(analogin_dev[self->number].fd);
analogin_dev[self->number].fd = -1;
self->pin = NULL;
}
bool common_hal_analogio_analogin_deinited(analogio_analogin_obj_t *self) {
return analogin_dev[self->number].fd < 0;
}
uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
int16_t value = 0;
read(analogin_dev[self->number].fd, &value, sizeof(value));
return (uint16_t)32768 + (uint16_t)value;
}
// Reference voltage is a fixed value which is depending on the board.
// e.g.)
// - Reference Voltage of A2 and A3 pins on Main Board is 0.7V.
// - Reference Voltage of A0 ~ A5 pins on External Interface board is 5.0V
float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) {
float voltage;
if (self->number == 2 || self->number == 3) {
voltage = 0.0f;
} else {
voltage = 5.0f;
}
return voltage;
}
void analogin_reset(void) {
for (int i = 0; i < MP_ARRAY_SIZE(analogin_dev); i++) {
if (analogin_dev[i].fd >= 0) {
// stop ADC
ioctl(analogin_dev[i].fd, ANIOC_CXD56_STOP, 0);
close(analogin_dev[i].fd);
analogin_dev[i].fd = -1;
}
}
}
|
4fc0f80cc36e1f930e48cee22ca1e1ea9501b743
|
011e552512f45ca313615e428924d001a427e8e6
|
/lib/rand.h
|
82b3d892dd681af8d729cd2e12858f5bbb86bdbd
|
[
"BSD-2-Clause",
"BSD-3-Clause"
] |
permissive
|
phoenix-rtos/phoenix-rtos-kernel
|
3d4c1d0e7703ea5ce50c2642d35fbb79c1f2afd6
|
e15898bac82e168f7e6aaea60d413790a282f389
|
refs/heads/master
| 2023-09-01T15:04:26.226958
| 2023-09-01T09:21:17
| 2023-09-01T09:45:00
| 125,823,596
| 115
| 39
|
BSD-3-Clause
| 2023-09-14T13:34:22
| 2018-03-19T08:14:43
|
C
|
UTF-8
|
C
| false
| false
| 300
|
h
|
rand.h
|
/*
* Phoenix-RTOS
*
* Operating system kernel
*
* Standard routines
*
* Copyright 2012, 2016 Phoenix Systems
* Author: Pawel Kolodziej
*
* This file is part of Phoenix-RTOS.
*
* %LICENSE%
*/
#ifndef _LIB_RAND_H_
#define _LIB_RAND_H_
extern int lib_rand(unsigned int *seedp);
#endif
|
1410876738ac7d58cba700ef309b2e2eb40e8178
|
58fe7cb3949dd1930e709696659a0296500b64a6
|
/tests/unit/s2n_ktls_mode_test.c
|
04bad8526e237e66a5ded919b5a1553d748fb8ec
|
[
"Apache-2.0",
"MIT"
] |
permissive
|
aws/s2n-tls
|
3344638a6a69c6f20665cf6847e1bc4b85f2e558
|
62dc7a6d4876e5eee0dea3690d528a4c7080a1d5
|
refs/heads/main
| 2023-08-31T23:26:33.780048
| 2023-08-31T05:17:33
| 2023-08-31T05:17:33
| 21,287,076
| 513
| 213
|
Apache-2.0
| 2023-09-13T23:52:29
| 2014-06-27T19:37:59
|
C
|
UTF-8
|
C
| false
| false
| 1,250
|
c
|
s2n_ktls_mode_test.c
|
/*
* Copyright Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 "s2n_test.h"
#include "testlib/s2n_testlib.h"
#include "tls/s2n_ktls.h"
int main(int argc, char **argv)
{
BEGIN_TEST();
/* Default connection kTLS mode */
{
DEFER_CLEANUP(struct s2n_connection *conn = s2n_connection_new(S2N_CLIENT),
s2n_connection_ptr_free);
EXPECT_NOT_NULL(conn);
DEFER_CLEANUP(struct s2n_test_io_pair io_pair = { 0 }, s2n_io_pair_close);
EXPECT_SUCCESS(s2n_io_pair_init_non_blocking(&io_pair));
EXPECT_SUCCESS(s2n_connection_set_io_pair(conn, &io_pair));
EXPECT_FALSE(conn->ktls_recv_enabled);
EXPECT_FALSE(conn->ktls_send_enabled);
};
END_TEST();
}
|
9207fe3c2e17c511b32a6e75eb8d3741062cfaf2
|
88aca3340574f733b9ecd6f76708ecd2d57cb07e
|
/vendor/bundle/ruby/2.6.0/gems/commonmarker-0.23.4/ext/commonmarker/syntax_extension.h
|
a5fe11e57b83f5aab1ec42e5d7f0e83167c749ed
|
[
"MIT",
"Apache-2.0"
] |
permissive
|
collabnix/dockerlabs
|
65c63a8424d34120bddc0fc8d6fd54a688953491
|
0f2a6b906a8ca0ebc28561236d4d6516f93b184c
|
refs/heads/master
| 2023-09-05T07:30:30.601797
| 2023-09-05T07:25:53
| 2023-09-05T07:25:53
| 153,069,455
| 5,239
| 1,854
|
Apache-2.0
| 2023-09-03T05:51:41
| 2018-10-15T07:19:18
|
PHP
|
UTF-8
|
C
| false
| false
| 1,387
|
h
|
syntax_extension.h
|
#ifndef CMARK_SYNTAX_EXTENSION_H
#define CMARK_SYNTAX_EXTENSION_H
#include "cmark-gfm.h"
#include "cmark-gfm-extension_api.h"
#include "config.h"
struct cmark_syntax_extension {
cmark_match_block_func last_block_matches;
cmark_open_block_func try_opening_block;
cmark_match_inline_func match_inline;
cmark_inline_from_delim_func insert_inline_from_delim;
cmark_llist * special_inline_chars;
char * name;
void * priv;
bool emphasis;
cmark_free_func free_function;
cmark_get_type_string_func get_type_string_func;
cmark_can_contain_func can_contain_func;
cmark_contains_inlines_func contains_inlines_func;
cmark_common_render_func commonmark_render_func;
cmark_common_render_func plaintext_render_func;
cmark_common_render_func latex_render_func;
cmark_xml_attr_func xml_attr_func;
cmark_common_render_func man_render_func;
cmark_html_render_func html_render_func;
cmark_html_filter_func html_filter_func;
cmark_postprocess_func postprocess_func;
cmark_opaque_alloc_func opaque_alloc_func;
cmark_opaque_free_func opaque_free_func;
cmark_commonmark_escape_func commonmark_escape_func;
};
#endif
|
899c9f6c6a7d619b1a4484960e862799feb23b65
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/pinctrl/pinconf.h
|
a4a5417e1413d738b1151865a1b70d8b5fdb2957
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 3,326
|
h
|
pinconf.h
|
/*
* Internal interface between the core pin control system and the
* pin config portions
*
* Copyright (C) 2011 ST-Ericsson SA
* Written on behalf of Linaro for ST-Ericsson
* Based on bits of regulator core, gpio core and clk core
*
* Author: Linus Walleij <linus.walleij@linaro.org>
*
* License terms: GNU General Public License (GPL) version 2
*/
#ifdef CONFIG_PINCONF
int pinconf_check_ops(struct pinctrl_dev *pctldev);
int pinconf_validate_map(struct pinctrl_map const *map, int i);
int pinconf_map_to_setting(struct pinctrl_map const *map,
struct pinctrl_setting *setting);
void pinconf_free_setting(struct pinctrl_setting const *setting);
int pinconf_apply_setting(struct pinctrl_setting const *setting);
/*
* You will only be interested in these if you're using PINCONF
* so don't supply any stubs for these.
*/
int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
unsigned long *config);
int pin_config_group_get(const char *dev_name, const char *pin_group,
unsigned long *config);
#else
static inline int pinconf_check_ops(struct pinctrl_dev *pctldev)
{
return 0;
}
static inline int pinconf_validate_map(struct pinctrl_map const *map, int i)
{
return 0;
}
static inline int pinconf_map_to_setting(struct pinctrl_map const *map,
struct pinctrl_setting *setting)
{
return 0;
}
static inline void pinconf_free_setting(struct pinctrl_setting const *setting)
{
}
static inline int pinconf_apply_setting(struct pinctrl_setting const *setting)
{
return 0;
}
#endif
#if defined(CONFIG_PINCONF) && defined(CONFIG_DEBUG_FS)
void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map);
void pinconf_show_setting(struct seq_file *s,
struct pinctrl_setting const *setting);
void pinconf_init_device_debugfs(struct dentry *devroot,
struct pinctrl_dev *pctldev);
#else
static inline void pinconf_show_map(struct seq_file *s,
struct pinctrl_map const *map)
{
}
static inline void pinconf_show_setting(struct seq_file *s,
struct pinctrl_setting const *setting)
{
}
static inline void pinconf_init_device_debugfs(struct dentry *devroot,
struct pinctrl_dev *pctldev)
{
}
#endif
/*
* The following functions are available if the driver uses the generic
* pin config.
*/
#if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_DEBUG_FS)
void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
struct seq_file *s, unsigned pin);
void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
struct seq_file *s, const char *gname);
void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
struct seq_file *s, unsigned long config);
#else
static inline void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
struct seq_file *s,
unsigned pin)
{
return;
}
static inline void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
struct seq_file *s,
const char *gname)
{
return;
}
static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
struct seq_file *s,
unsigned long config)
{
return;
}
#endif
#if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_OF)
int pinconf_generic_parse_dt_config(struct device_node *np,
unsigned long **configs,
unsigned int *nconfigs);
#endif
|
8c6b56360ee863d62f6874224f2511e0914b10ec
|
e73547787354afd9b717ea57fe8dd0695d161821
|
/src/world/area_arn/arn_02/arn_02_2_main.c
|
2777fd21af53ff1350793a4af0731a2c92c219ed
|
[] |
no_license
|
pmret/papermario
|
8b514b19653cef8d6145e47499b3636b8c474a37
|
9774b26d93f1045dd2a67e502b6efc9599fb6c31
|
refs/heads/main
| 2023-08-31T07:09:48.951514
| 2023-08-21T18:07:08
| 2023-08-21T18:07:08
| 287,151,133
| 904
| 139
| null | 2023-09-14T02:44:23
| 2020-08-13T01:22:57
|
C
|
UTF-8
|
C
| false
| false
| 890
|
c
|
arn_02_2_main.c
|
#include "arn_02.h"
EvtScript N(EVS_ExitWalk_arn_05_1) = EVT_EXIT_WALK(60, arn_02_ENTRY_0, "arn_05", arn_05_ENTRY_1);
EvtScript N(EVS_ExitWalk_arn_04_0) = EVT_EXIT_WALK(60, arn_02_ENTRY_1, "arn_04", arn_04_ENTRY_0);
EvtScript N(EVS_BindExitTriggers) = {
EVT_BIND_TRIGGER(EVT_PTR(N(EVS_ExitWalk_arn_05_1)), TRIGGER_FLOOR_ABOVE, COLLIDER_deiliw, 1, 0)
EVT_BIND_TRIGGER(EVT_PTR(N(EVS_ExitWalk_arn_04_0)), TRIGGER_FLOOR_ABOVE, COLLIDER_deilie, 1, 0)
EVT_RETURN
EVT_END
};
EvtScript N(EVS_Main) = {
EVT_SET(GB_WorldLocation, LOCATION_GUSTY_GULCH)
EVT_CALL(SetSpriteShading, SHADING_NONE)
EVT_SETUP_CAMERA_DEFAULT()
EVT_CALL(MakeNpcs, FALSE, EVT_PTR(N(DefaultNPCs)))
EVT_EXEC_WAIT(N(EVS_MakeEntities))
EVT_EXEC(N(EVS_SetupMusic))
EVT_SET(LVar0, EVT_PTR(N(EVS_BindExitTriggers)))
EVT_EXEC(EnterWalk)
EVT_WAIT(1)
EVT_RETURN
EVT_END
};
|
ef16355c5021a7c89fe72defa62adc9d1fc5ccdd
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/Infineon/libraries/IFX_PSOC6_HAL/mtb-pdl-cat1/devices/COMPONENT_CAT1C/include/ip/cyip_fault.h
|
c97fba8883a7c3b75ef3f75a8d08b92a3b19ad91
|
[
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 15,419
|
h
|
cyip_fault.h
|
/***************************************************************************//**
* \file cyip_fault.h
*
* \brief
* FAULT IP definitions
*
********************************************************************************
* \copyright
* (c) (2016-2022), Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*******************************************************************************/
#ifndef _CYIP_FAULT_H_
#define _CYIP_FAULT_H_
#include "cyip_headers.h"
/*******************************************************************************
* FAULT
*******************************************************************************/
#define FAULT_STRUCT_SECTION_SIZE 0x00000100UL
#define FAULT_SECTION_SIZE 0x00010000UL
/**
* \brief Fault structure (FAULT_STRUCT)
*/
typedef struct {
__IOM uint32_t CTL; /*!< 0x00000000 Fault control */
__IM uint32_t RESERVED[2];
__IOM uint32_t STATUS; /*!< 0x0000000C Fault status */
__IOM uint32_t DATA[4]; /*!< 0x00000010 Fault data */
__IM uint32_t RESERVED1[8];
__IM uint32_t PENDING0; /*!< 0x00000040 Fault pending 0 */
__IM uint32_t PENDING1; /*!< 0x00000044 Fault pending 1 */
__IM uint32_t PENDING2; /*!< 0x00000048 Fault pending 2 */
__IM uint32_t RESERVED2;
__IOM uint32_t MASK0; /*!< 0x00000050 Fault mask 0 */
__IOM uint32_t MASK1; /*!< 0x00000054 Fault mask 1 */
__IOM uint32_t MASK2; /*!< 0x00000058 Fault mask 2 */
__IM uint32_t RESERVED3[25];
__IOM uint32_t INTR; /*!< 0x000000C0 Interrupt */
__IOM uint32_t INTR_SET; /*!< 0x000000C4 Interrupt set */
__IOM uint32_t INTR_MASK; /*!< 0x000000C8 Interrupt mask */
__IM uint32_t INTR_MASKED; /*!< 0x000000CC Interrupt masked */
__IM uint32_t RESERVED4[12];
} FAULT_STRUCT_Type; /*!< Size = 256 (0x100) */
/**
* \brief Fault structures (FAULT)
*/
typedef struct {
FAULT_STRUCT_Type STRUCT[4]; /*!< 0x00000000 Fault structure */
} FAULT_Type; /*!< Size = 1024 (0x400) */
/* FAULT_STRUCT.CTL */
#define FAULT_STRUCT_CTL_TR_EN_Pos 0UL
#define FAULT_STRUCT_CTL_TR_EN_Msk 0x1UL
#define FAULT_STRUCT_CTL_OUT_EN_Pos 1UL
#define FAULT_STRUCT_CTL_OUT_EN_Msk 0x2UL
#define FAULT_STRUCT_CTL_RESET_REQ_EN_Pos 2UL
#define FAULT_STRUCT_CTL_RESET_REQ_EN_Msk 0x4UL
/* FAULT_STRUCT.STATUS */
#define FAULT_STRUCT_STATUS_IDX_Pos 0UL
#define FAULT_STRUCT_STATUS_IDX_Msk 0x7FUL
#define FAULT_STRUCT_STATUS_VALID_Pos 31UL
#define FAULT_STRUCT_STATUS_VALID_Msk 0x80000000UL
/* FAULT_STRUCT.DATA */
#define FAULT_STRUCT_DATA_DATA_Pos 0UL
#define FAULT_STRUCT_DATA_DATA_Msk 0xFFFFFFFFUL
/* FAULT_STRUCT.PENDING0 */
#define FAULT_STRUCT_PENDING0_SOURCE_Pos 0UL
#define FAULT_STRUCT_PENDING0_SOURCE_Msk 0xFFFFFFFFUL
/* FAULT_STRUCT.PENDING1 */
#define FAULT_STRUCT_PENDING1_SOURCE_Pos 0UL
#define FAULT_STRUCT_PENDING1_SOURCE_Msk 0xFFFFFFFFUL
/* FAULT_STRUCT.PENDING2 */
#define FAULT_STRUCT_PENDING2_SOURCE_Pos 0UL
#define FAULT_STRUCT_PENDING2_SOURCE_Msk 0xFFFFFFFFUL
/* FAULT_STRUCT.MASK0 */
#define FAULT_STRUCT_MASK0_SOURCE_Pos 0UL
#define FAULT_STRUCT_MASK0_SOURCE_Msk 0xFFFFFFFFUL
/* FAULT_STRUCT.MASK1 */
#define FAULT_STRUCT_MASK1_SOURCE_Pos 0UL
#define FAULT_STRUCT_MASK1_SOURCE_Msk 0xFFFFFFFFUL
/* FAULT_STRUCT.MASK2 */
#define FAULT_STRUCT_MASK2_SOURCE_Pos 0UL
#define FAULT_STRUCT_MASK2_SOURCE_Msk 0xFFFFFFFFUL
/* FAULT_STRUCT.INTR */
#define FAULT_STRUCT_INTR_FAULT_Pos 0UL
#define FAULT_STRUCT_INTR_FAULT_Msk 0x1UL
/* FAULT_STRUCT.INTR_SET */
#define FAULT_STRUCT_INTR_SET_FAULT_Pos 0UL
#define FAULT_STRUCT_INTR_SET_FAULT_Msk 0x1UL
/* FAULT_STRUCT.INTR_MASK */
#define FAULT_STRUCT_INTR_MASK_FAULT_Pos 0UL
#define FAULT_STRUCT_INTR_MASK_FAULT_Msk 0x1UL
/* FAULT_STRUCT.INTR_MASKED */
#define FAULT_STRUCT_INTR_MASKED_FAULT_Pos 0UL
#define FAULT_STRUCT_INTR_MASKED_FAULT_Msk 0x1UL
/**
* \brief Instances of Fault data register.
*/
typedef enum
{
CY_SYSFAULT_MPU_0 = 0, /* Bus master 0 MPU/SMPU. */
CY_SYSFAULT_MPU_1 = 1, /* Bus master 1 MPU. See MPU_0 description. */
CY_SYSFAULT_MPU_2 = 2, /* Bus master 2 MPU. See MPU_0 description. */
CY_SYSFAULT_MPU_3 = 3, /* Bus master 3 MPU. See MPU_0 description. */
CY_SYSFAULT_MPU_4 = 4, /* Bus master 4 MPU. See MPU_0 description. */
CY_SYSFAULT_MPU_5 = 5, /* Bus master 5 MPU. See MPU_0 description. */
CY_SYSFAULT_MPU_6 = 6, /* Bus master 6 MPU. See MPU_0 description. */
CY_SYSFAULT_MPU_7 = 7, /* Bus master 7 MPU. See MPU_0 description. */
CY_SYSFAULT_MPU_8 = 8, /* Bus master 8 MPU. See MPU_0 description. */
CY_SYSFAULT_MPU_9 = 9, /* Bus master 9 MPU. See MPU_0 description. */
CY_SYSFAULT_MPU_10 = 10, /* Bus master 10 MPU. See MPU_0 description. */
CY_SYSFAULT_MPU_11 = 11, /* Bus master 11 MPU. See MPU_0 description. */
CY_SYSFAULT_MPU_12 = 12, /* Bus master 12 MPU. See MPU_0 description. */
CY_SYSFAULT_MPU_13 = 13, /* Bus master 13 MPU. See MPU_0 description. */
CY_SYSFAULT_MPU_14 = 14, /* Bus master 14 MPU. See MPU_0 description. */
CY_SYSFAULT_MPU_15 = 15, /* Bus master 15 MPU. See MPU_0 description. */
CY_SYSFAULT_CM7_1_TCM_C_ECC = 16, /* Correctable ECC error in CM7_1 TCM memory. See CM7_0_TCM_C_ECC description. */
CY_SYSFAULT_CM7_1_TCM_NC_ECC = 17, /* Non Correctable ECC error in CM7_1 TCM memory. See CM7_0_TCM_C_ECC description. */
CY_SYSFAULT_CM7_0_CACHE_C_ECC = 18, /* Correctable ECC error in CM7_0 Cache memories */
CY_SYSFAULT_CM7_0_CACHE_NC_ECC = 19, /* Non Correctable ECC error in CM7_0 Cache memories. See CM7_0_CACHE_C_ECC description */
CY_SYSFAULT_CM7_1_CACHE_C_ECC = 20, /* Correctable ECC error in CM7_1 Cache memories. See CM7_0_CACHE_C_ECC description. */
CY_SYSFAULT_CM7_1_CACHE_NC_ECC = 21, /* Non Correctable ECC error in CM7_1 Cache memories. See CM7_0_CACHE_C_ECC description. */
CY_SYSFAULT_MS_PPU_4 = 25, /* Peripheral interconnect, master interface 4 PPU. See MS_PPU_0 description. */
CY_SYSFAULT_PERI_ECC = 26, /* Peripheral interconnect, protection structures SRAM, correctable ECC error: */
CY_SYSFAULT_PERI_NC_ECC = 27, /* Peripheral interconnect, protection structures SRAM, non-correctable ECC error. */
CY_SYSFAULT_MS_PPU_0 = 28, /* Peripheral interconnect, master interface 0 PPU. */
CY_SYSFAULT_MS_PPU_1 = 29, /* Peripheral interconnect, master interface 1 PPU. See MS_PPU_0 description. */
CY_SYSFAULT_MS_PPU_2 = 30, /* Peripheral interconnect, master interface 2 PPU. See MS_PPU_0 description. */
CY_SYSFAULT_MS_PPU_3 = 31, /* Peripheral interconnect, master interface 3 PPU. See MS_PPU_0 description. */
CY_SYSFAULT_GROUP_FAULT_0 = 32, /* Peripheral group 0 fault detection. */
CY_SYSFAULT_GROUP_FAULT_1 = 33, /* Peripheral group 1 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_GROUP_FAULT_2 = 34, /* Peripheral group 2 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_GROUP_FAULT_3 = 35, /* Peripheral group 3 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_GROUP_FAULT_4 = 36, /* Peripheral group 4 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_GROUP_FAULT_5 = 37, /* Peripheral group 5 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_GROUP_FAULT_6 = 38, /* Peripheral group 6 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_GROUP_FAULT_7 = 39, /* Peripheral group 7 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_GROUP_FAULT_8 = 40, /* Peripheral group 8 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_GROUP_FAULT_9 = 41, /* Peripheral group 9 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_GROUP_FAULT_10 = 42, /* Peripheral group 10 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_GROUP_FAULT_11 = 43, /* Peripheral group 11 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_GROUP_FAULT_12 = 44, /* Peripheral group 12 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_GROUP_FAULT_13 = 45, /* Peripheral group 13 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_GROUP_FAULT_14 = 46, /* Peripheral group 14 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_GROUP_FAULT_15 = 47, /* Peripheral group 15 fault detection. See GROUP_FAULT_0 description. */
CY_SYSFAULT_FLASHC_MAIN_BUS_ERROR = 48, /* Flash controller, main interface, bus error: */
CY_SYSFAULT_FLASHC_MAIN_C_ECC = 49, /* Flash controller, main interface, correctable ECC error: */
CY_SYSFAULT_FLASHC_MAIN_NC_ECC = 50, /* Flash controller, main interface, non-correctable ECC error. See FLASHC_MAIN_C_ECC description. */
CY_SYSFAULT_FLASHC_WORK_BUS_ERROR = 51, /* Flash controller, work interface, bus error. See FLASHC_MAIN_BUS_ERROR description. */
CY_SYSFAULT_FLASHC_WORK_C_ECC = 52, /* Flash controller, work interface, correctable ECC error: */
CY_SYSFAULT_FLASHC_WORK_NC_ECC = 53, /* Flash controller, work interface, non-correctable ECC error. See FLASHC_WORK_C_ECC description. */
CY_SYSFAULT_FLASHC_CM0_CA_C_ECC = 54, /* Flash controller, CM0+ cache, correctable ECC error: */
CY_SYSFAULT_FLASHC_CM0_CA_NC_ECC = 55, /* Flash controller, CM0+ cache, non-correctable ECC error. See FLASHC_CM0_CA_C_ECC description. */
CY_SYSFAULT_CM7_0_TCM_C_ECC = 56, /* Correctable ECC error in CM7_0 TCM memory */
CY_SYSFAULT_CM7_0_TCM_NC_ECC = 57, /* Non Correctable ECC error in CM7_0 TCM memory. See CM7_0_TCM_C_ECC description. */
CY_SYSFAULT_RAMC0_C_ECC = 58, /* System SRAM 0 correctable ECC error: */
CY_SYSFAULT_RAMC0_NC_ECC = 59, /* System SRAM 0 non-correctable ECC error. See RAMC0_C_ECC description. */
CY_SYSFAULT_RAMC1_C_ECC = 60, /* System SRAM 1 correctable ECC error. See RAMC0_C_ECC description. */
CY_SYSFAULT_RAMC1_NC_ECC = 61, /* System SRAM 1 non-correctable ECC error. See RAMC0_C_ECC description. */
CY_SYSFAULT_RAMC2_C_ECC = 62, /* System SRAM 2 correctable ECC error. See RAMC0_C_ECC description. */
CY_SYSFAULT_RAMC2_NC_ECC = 63, /* System SRAM 2 non-correctable ECC error. See RAMC0_C_ECC description. */
CY_SYSFAULT_CRYPTO_C_ECC = 64, /* Cryptography SRAM correctable ECC error. */
CY_SYSFAULT_CRYPTO_NC_ECC = 65, /* Cryptography SRAM non-correctable ECC error. See CRYPTO_C_ECC description. */
CY_SYSFAULT_DW0_C_ECC = 70, /* DataWire 0 SRAM 1 correctable ECC error: */
CY_SYSFAULT_DW0_NC_ECC = 71, /* DataWire 0 SRAM 1 non-correctable ECC error. See DW0_C_ECC description. */
CY_SYSFAULT_DW1_C_ECC = 72, /* DataWire 1 SRAM 1 correctable ECC error. See DW0_C_ECC description. */
CY_SYSFAULT_DW1_NC_ECC = 73, /* DataWire 1 SRAM 1 non-correctable ECC error. See DW0_C_ECC description. */
CY_SYSFAULT_FM_SRAM_C_ECC = 74, /* eCT Flash SRAM (for embedded operations) correctable ECC error: */
CY_SYSFAULT_FM_SRAM_NC_ECC = 75, /* eCT Flash SRAM non-correctable ECC error: See FM_SRAM_C_ECC description. */
CY_SYSFAULT_CAN0_C_ECC = 80, /* CAN controller 0 MRAM correctable ECC error: */
CY_SYSFAULT_CAN0_NC_ECC = 81, /* CAN controller 0 MRAM non-correctable ECC error: */
CY_SYSFAULT_CAN1_C_ECC = 82, /* CAN controller 1 MRAM correctable ECC error. See CAN0_C_ECC description. */
CY_SYSFAULT_CAN1_NC_ECC = 83, /* CAN controller 1 MRAM non-correctable ECC error. See CAN0_NC_ECC description. */
CY_SYSFAULT_VIDEOSS_VRPU0 = 84, /* Video Ram Protection Unit 0 fault detection. */
CY_SYSFAULT_VIDEOSS_VRPU1 = 85, /* Video Ram Protection Unit 1 fault detection. See VIDEOSS_VRPU0 description. */
CY_SYSFAULT_VIDEOSS_VRPU2 = 86, /* Video Ram Protection Unit 2 fault detection. See VIDEOSS_VRPU0 description. */
CY_SYSFAULT_VIDEOSS_VRPU3 = 87, /* Video Ram Protection Unit 3 fault detection. See VIDEOSS_VRPU0 description. */
CY_SYSFAULT_VIDEOSS_VRPU4 = 88, /* Video Ram Protection Unit 4 fault detection. See VIDEOSS_VRPU0 description. */
CY_SYSFAULT_VIDEOSS_VRPU5 = 89, /* Video Ram Protection Unit 5 fault detection. See VIDEOSS_VRPU0 description. */
CY_SYSFAULT_SRSS_CSV = 90, /* SRSS Clock SuperVisor (CSV) violation detected. Multiple CSV can detect a violation at the same time. */
CY_SYSFAULT_SRSS_SSV = 91, /* SRSS Clock SuperVisor (CSV) violation detected. Multiple CSV can detect a violation at the same time. */
CY_SYSFAULT_SRSS_MCWDT0 = 92, /* SRSS Multi-Counter Watch Dog Timer (MCWDT) #0 violation detected. Multiple counters can detect a violation at the same time. */
CY_SYSFAULT_SRSS_MCWDT1 = 93, /* SRSS Multi-Counter Watch Dog Timer (MCWDT) #1 violation detected. See SRSS_MCWDT0 description. */
CY_SYSFAULT_SRSS_MCWDT2 = 94, /* SRSS Multi-Counter Watch Dog Timer (MCWDT) #2 violation detected. See SRSS_MCWDT0 description. */
CY_SYSFAULT_SRSS_MCWDT3 = 95, /* SRSS Multi-Counter Watch Dog Timer (MCWDT) #3 violation detected. See SRSS_MCWDT0 description. */
CY_SYSFAULT_NO_FAULT = 96
} cy_en_SysFault_source_t;
#endif /* _CYIP_FAULT_H_ */
/* [] END OF FILE */
|
f154245ba12651c5de2a73be205339c9eb61d573
|
9de18ef120a8ae68483b866c1d4c7b9c2fbef46e
|
/third_party/libcutils/include/cutils/str_parms.h
|
aa1435a080e2efe4cc8fbeeb33efe14779933617
|
[
"Apache-2.0",
"BSD-2-Clause",
"LicenseRef-scancode-free-unknown"
] |
permissive
|
google/orbit
|
02a5b4556cd2f979f377b87c24dd2b0a90dff1e2
|
68c4ae85a6fe7b91047d020259234f7e4961361c
|
refs/heads/main
| 2023-09-03T13:14:49.830576
| 2023-08-25T06:28:36
| 2023-08-25T06:28:36
| 104,358,587
| 2,680
| 325
|
BSD-2-Clause
| 2023-08-25T06:28:37
| 2017-09-21T14:28:35
|
C++
|
UTF-8
|
C
| false
| false
| 2,178
|
h
|
str_parms.h
|
/*
* Copyright (C) 2011 The Android Open Source Project
*
* 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.
*/
#ifndef __CUTILS_STR_PARMS_H
#define __CUTILS_STR_PARMS_H
#include <stdint.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
struct str_parms;
struct str_parms *str_parms_create(void);
struct str_parms *str_parms_create_str(const char *_string);
void str_parms_destroy(struct str_parms *str_parms);
void str_parms_del(struct str_parms *str_parms, const char *key);
int str_parms_add_str(struct str_parms *str_parms, const char *key,
const char *value);
int str_parms_add_int(struct str_parms *str_parms, const char *key, int value);
int str_parms_add_float(struct str_parms *str_parms, const char *key,
float value);
// Returns non-zero if the str_parms contains the specified key.
int str_parms_has_key(struct str_parms *str_parms, const char *key);
// Gets value associated with the specified key (if present), placing it in the buffer
// pointed to by the out_val parameter. Returns the length of the returned string value.
// If 'key' isn't in the parms, then return -ENOENT (-2) and leave 'out_val' untouched.
int str_parms_get_str(struct str_parms *str_parms, const char *key,
char *out_val, int len);
int str_parms_get_int(struct str_parms *str_parms, const char *key,
int *out_val);
int str_parms_get_float(struct str_parms *str_parms, const char *key,
float *out_val);
char *str_parms_to_str(struct str_parms *str_parms);
/* debug */
void str_parms_dump(struct str_parms *str_parms);
__END_DECLS
#endif /* __CUTILS_STR_PARMS_H */
|
645f1fc48a50ccf39d672eb201e32f114450909a
|
7538f30404c0eb74c17d5b982eae689b754e227e
|
/12.4/PrivateFrameworks/Celestial.framework/CDStructures.h
|
e7d035f95ecf190c7237133ec9df378e5265da23
|
[] |
no_license
|
xybp888/iOS-Header
|
cdb31acaa22236818917245619fe4f4b90d62d30
|
0c23e5a9242f1d8fd04d376c22e88d2ec74c3374
|
refs/heads/master
| 2022-11-18T22:35:35.676837
| 2022-10-29T23:47:18
| 2022-10-29T23:47:18
| 204,074,346
| 156
| 63
| null | null | null | null |
UTF-8
|
C
| false
| false
| 2,919
|
h
|
CDStructures.h
|
//
// Generated by class-dump 3.5 (64 bit).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#pragma mark Blocks
typedef void (^CDUnknownBlockType)(void); // return type and parameters are unknown
#pragma mark Named Structures
struct AVControllerPrivate {
id _field1;
id _field2;
id _field3;
id _field4;
id _field5;
Class _field6;
id _field7;
long long _field8;
long long _field9;
float _field10;
float _field11;
long long _field12;
_Bool _field13;
id _field14;
float _field15;
struct __CFString *_field16;
id _field17;
_Bool _field18;
_Bool _field19;
_Bool _field20;
id _field21;
struct OpaqueFigVisualContext *_field22;
id _field23;
struct __CFRunLoop *_field24;
unsigned long long _field25;
int _field26;
int _field27;
int _field28;
_Bool _field29;
_Bool _field30;
_Bool _field31;
_Bool _field32;
id _field33;
struct OpaqueFigPlayer *_field34;
id _field35;
id _field36;
id _field37;
_Bool _field38;
_Bool _field39;
id _field40;
id _field41;
_Bool _field42;
_Bool _field43;
_Bool _field44;
int _field45;
_Bool _field46;
};
struct AVFileValidatorPrivate {
id _field1;
id _field2;
struct FigOpaqueMediaValidator *_field3;
struct FigMediaValidatorDataLocation _field4;
struct OpaqueCMByteStream *_field5;
_Bool _field6;
_Bool _field7;
id _field8;
};
struct AVItemPrivate {
id _field1;
id _field2;
double _field3;
float _field4;
float _field5;
float _field6;
unsigned long long _field7;
_Bool _field8;
_Bool _field9;
id _field10;
long long _field11;
long long _field12;
long long _field13;
_Bool _field14;
id _field15;
id _field16;
_Bool _field17;
_Bool _field18;
id _field19;
id _field20;
struct OpaqueFigThread *_field21;
struct OpaqueCMByteStream *_field22;
int _field23;
id _field24;
id _field25;
};
struct AVSystemControllerPrivate {
_Bool _field1;
_Bool _field2;
float _field3;
id _field4;
struct OpaqueFigPlayer *_field5;
};
struct CGPoint {
double x;
double y;
};
struct CGRect {
struct CGPoint origin;
struct CGSize size;
};
struct CGSize {
double width;
double height;
};
struct FigMediaValidatorDataLocation {
unsigned long long _field1;
unsigned long long _field2;
};
struct FigOpaqueMediaValidator;
struct OpaqueCMByteStream;
struct OpaqueFigPlayer;
struct OpaqueFigThread;
struct OpaqueFigVisualContext;
struct _NSRange {
unsigned long long _field1;
unsigned long long _field2;
};
#pragma mark Typedef'd Structures
typedef struct {
int width;
int height;
} CDStruct_79c71658;
typedef struct {
long long value;
int timescale;
unsigned int flags;
long long epoch;
} CDStruct_1b6d18a9;
|
630250488cd3af15d5e60432aa8ee45bce18f99e
|
d61b532db0d3e08818338cfaac530a1ced1ffe3b
|
/util/topgen/LLlex.c
|
64d9cb352ad310b1eabd3e29ecbb397f7b60af20
|
[
"LicenseRef-scancode-other-permissive"
] |
permissive
|
davidgiven/ack
|
61049c7a8e95ff61a77b1edd3c22bb290720e276
|
db5a32c68c4a60ca26a3927a799ea662b5b2b0e5
|
refs/heads/default
| 2023-08-29T07:33:12.771205
| 2023-07-08T20:17:27
| 2023-07-08T20:17:27
| 37,686,316
| 376
| 74
|
NOASSERTION
| 2023-07-08T20:17:28
| 2015-06-18T21:33:42
|
C
|
UTF-8
|
C
| false
| false
| 3,066
|
c
|
LLlex.c
|
/* $Id$ */
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* L L l e x . c
*
* Very simple lexical analyzer.
* Also contains LLmessage().
*/
# include <ctype.h>
# include <stdio.h>
# include "tunable.h"
# include "token.h"
# include "Lpars.h"
struct token dot; /* current token */
static struct token aside; /* to put currrent token aside, when a token
* is inserted
*/
int newline, lineno; /* To keep track of linenumbers */
extern FILE *input; /* file descriptor of machine table */
extern void error(char *s, char* s1);
int LLlex(void) {
register int c;
if (aside.t_tokno) { /* A token was pushed aside, return it now */
dot = aside;
aside.t_tokno = 0;
return dot.t_tokno;
}
if (newline) { /* delayed increment of lineno, needed to give
* correct line numbers in error messages
*/
lineno++;
newline = 0;
}
c = getc(input);
while (c == '/') { /* Could be a comment */
if ((c = getc(input)) == '*') {
/* Yes, it is a comment */
int l;
l = lineno;
do {
do {
if (c == '\n') lineno++;
c = getc(input);
} while (c != '*' && c != EOF);
if (c != EOF) c = getc(input);
} while (c != '/' && c != EOF);
if (c == EOF) {
c = lineno;
lineno = l;
error("Unterminated comment", "");
lineno = c;
c = EOF;
}
else c = getc(input);
}
else {
ungetc(c, input);
c = '/';
break;
}
}
dot.t_tokno = c;
dot.t_attrib = c;
if (isupper(c) || islower(c) || c == '_') {
dot.t_tokno = LETTER;
return LETTER;
}
if (isdigit(c)) {
dot.t_tokno = DIGIT;
return DIGIT;
}
switch(c) {
case line_term :
dot.t_tokno = LINE_TERMINATOR;
return LINE_TERMINATOR;
case operand_sep :
dot.t_tokno = OPERAND_SEPARATOR;
return OPERAND_SEPARATOR;
case instruction_sep :
dot.t_tokno = INSTRUCTION_SEPARATOR;
return INSTRUCTION_SEPARATOR;
case '-' :
c = getc(input);
if (c == '>') {
dot.t_tokno = PATTERN_SEPARATOR;
return PATTERN_SEPARATOR;
}
ungetc(c,input);
dot.t_tokno = OTHER;
return OTHER;
case open_bracket :
dot.t_tokno = OPEN_BRACKET;
return OPEN_BRACKET;
case close_bracket :
dot.t_tokno = CLOSE_BRACKET;
return CLOSE_BRACKET;
case '\n' :
newline = 1;
/* Fall through */
case ' ' :
case '\t' :
dot.t_tokno = SPACE;
return SPACE;
case '%' :
case EOF :
return c;
default :
/* Let the C-compiler find out what is illegal! */
dot.t_tokno = OTHER;
return OTHER;
}
}
void LLmessage(int d)
{
static int savlineno;
if (savlineno != lineno) {
/* Only an error message if on another line number */
savlineno = lineno;
error("Syntax error","");
}
if (d > 0) {
/* "d" is the token to be inserted.
* This is the place to put the current token aside and
* give the inserted token an attribute ... but who cares
*/
aside = dot;
}
}
|
9ebbc4c38827b6820ad3f4e7ec99b550b4cc1fe0
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/hid/hid-thingm.c
|
99342cfa0ea2f82591831aaa21fcd9b4e11915c3
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 6,598
|
c
|
hid-thingm.c
|
/*
* ThingM blink(1) USB RGB LED driver
*
* Copyright 2013 Savoir-faire Linux Inc.
* Vivien Didelot <vivien.didelot@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, version 2.
*/
#include <linux/hid.h>
#include <linux/leds.h>
#include <linux/module.h>
#include "hid-ids.h"
#define BLINK1_CMD_SIZE 9
#define blink1_rgb_to_r(rgb) ((rgb & 0xFF0000) >> 16)
#define blink1_rgb_to_g(rgb) ((rgb & 0x00FF00) >> 8)
#define blink1_rgb_to_b(rgb) ((rgb & 0x0000FF) >> 0)
/**
* struct blink1_data - blink(1) device specific data
* @hdev: HID device.
* @led_cdev: LED class instance.
* @rgb: 8-bit per channel RGB notation.
* @fade: fade time in hundredths of a second.
* @brightness: brightness coefficient.
* @play: play/pause in-memory patterns.
*/
struct blink1_data {
struct hid_device *hdev;
struct led_classdev led_cdev;
u32 rgb;
u16 fade;
u8 brightness;
bool play;
};
static int blink1_send_command(struct blink1_data *data,
u8 buf[BLINK1_CMD_SIZE])
{
int ret;
hid_dbg(data->hdev, "command: %d%c%.2x%.2x%.2x%.2x%.2x%.2x%.2x\n",
buf[0], buf[1], buf[2], buf[3], buf[4],
buf[5], buf[6], buf[7], buf[8]);
ret = data->hdev->hid_output_raw_report(data->hdev, buf,
BLINK1_CMD_SIZE, HID_FEATURE_REPORT);
return ret < 0 ? ret : 0;
}
static int blink1_update_color(struct blink1_data *data)
{
u8 buf[BLINK1_CMD_SIZE] = { 1, 'n', 0, 0, 0, 0, 0, 0, 0 };
if (data->brightness) {
unsigned int coef = DIV_ROUND_CLOSEST(255, data->brightness);
buf[2] = DIV_ROUND_CLOSEST(blink1_rgb_to_r(data->rgb), coef);
buf[3] = DIV_ROUND_CLOSEST(blink1_rgb_to_g(data->rgb), coef);
buf[4] = DIV_ROUND_CLOSEST(blink1_rgb_to_b(data->rgb), coef);
}
if (data->fade) {
buf[1] = 'c';
buf[5] = (data->fade & 0xFF00) >> 8;
buf[6] = (data->fade & 0x00FF);
}
return blink1_send_command(data, buf);
}
static void blink1_led_set(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
struct blink1_data *data = dev_get_drvdata(led_cdev->dev->parent);
data->brightness = brightness;
if (blink1_update_color(data))
hid_err(data->hdev, "failed to update color\n");
}
static enum led_brightness blink1_led_get(struct led_classdev *led_cdev)
{
struct blink1_data *data = dev_get_drvdata(led_cdev->dev->parent);
return data->brightness;
}
static ssize_t blink1_show_rgb(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct blink1_data *data = dev_get_drvdata(dev->parent);
return sprintf(buf, "%.6X\n", data->rgb);
}
static ssize_t blink1_store_rgb(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct blink1_data *data = dev_get_drvdata(dev->parent);
long unsigned int rgb;
int ret;
ret = kstrtoul(buf, 16, &rgb);
if (ret)
return ret;
/* RGB triplet notation is 24-bit hexadecimal */
if (rgb > 0xFFFFFF)
return -EINVAL;
data->rgb = rgb;
ret = blink1_update_color(data);
return ret ? ret : count;
}
static DEVICE_ATTR(rgb, S_IRUGO | S_IWUSR, blink1_show_rgb, blink1_store_rgb);
static ssize_t blink1_show_fade(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct blink1_data *data = dev_get_drvdata(dev->parent);
return sprintf(buf, "%d\n", data->fade * 10);
}
static ssize_t blink1_store_fade(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct blink1_data *data = dev_get_drvdata(dev->parent);
long unsigned int fade;
int ret;
ret = kstrtoul(buf, 10, &fade);
if (ret)
return ret;
/* blink(1) accepts 16-bit fade time, number of 10ms ticks */
fade = DIV_ROUND_CLOSEST(fade, 10);
if (fade > 65535)
return -EINVAL;
data->fade = fade;
return count;
}
static DEVICE_ATTR(fade, S_IRUGO | S_IWUSR,
blink1_show_fade, blink1_store_fade);
static ssize_t blink1_show_play(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct blink1_data *data = dev_get_drvdata(dev->parent);
return sprintf(buf, "%d\n", data->play);
}
static ssize_t blink1_store_play(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct blink1_data *data = dev_get_drvdata(dev->parent);
u8 cmd[BLINK1_CMD_SIZE] = { 1, 'p', 0, 0, 0, 0, 0, 0, 0 };
long unsigned int play;
int ret;
ret = kstrtoul(buf, 10, &play);
if (ret)
return ret;
data->play = !!play;
cmd[2] = data->play;
ret = blink1_send_command(data, cmd);
return ret ? ret : count;
}
static DEVICE_ATTR(play, S_IRUGO | S_IWUSR,
blink1_show_play, blink1_store_play);
static const struct attribute_group blink1_sysfs_group = {
.attrs = (struct attribute *[]) {
&dev_attr_rgb.attr,
&dev_attr_fade.attr,
&dev_attr_play.attr,
NULL
},
};
static int thingm_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
struct blink1_data *data;
struct led_classdev *led;
char led_name[13];
int ret;
data = devm_kzalloc(&hdev->dev, sizeof(struct blink1_data), GFP_KERNEL);
if (!data)
return -ENOMEM;
hid_set_drvdata(hdev, data);
data->hdev = hdev;
data->rgb = 0xFFFFFF; /* set a default white color */
ret = hid_parse(hdev);
if (ret)
goto error;
ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW);
if (ret)
goto error;
/* blink(1) serial numbers range is 0x1A001000 to 0x1A002FFF */
led = &data->led_cdev;
snprintf(led_name, sizeof(led_name), "blink1::%s", hdev->uniq + 4);
led->name = led_name;
led->brightness_set = blink1_led_set;
led->brightness_get = blink1_led_get;
ret = led_classdev_register(&hdev->dev, led);
if (ret)
goto stop;
ret = sysfs_create_group(&led->dev->kobj, &blink1_sysfs_group);
if (ret)
goto remove_led;
return 0;
remove_led:
led_classdev_unregister(led);
stop:
hid_hw_stop(hdev);
error:
return ret;
}
static void thingm_remove(struct hid_device *hdev)
{
struct blink1_data *data = hid_get_drvdata(hdev);
struct led_classdev *led = &data->led_cdev;
sysfs_remove_group(&led->dev->kobj, &blink1_sysfs_group);
led_classdev_unregister(led);
hid_hw_stop(hdev);
}
static const struct hid_device_id thingm_table[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) },
{ }
};
MODULE_DEVICE_TABLE(hid, thingm_table);
static struct hid_driver thingm_driver = {
.name = "thingm",
.probe = thingm_probe,
.remove = thingm_remove,
.id_table = thingm_table,
};
module_hid_driver(thingm_driver);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Vivien Didelot <vivien.didelot@savoirfairelinux.com>");
MODULE_DESCRIPTION("ThingM blink(1) USB RGB LED driver");
|
9d16c60d73b635427a54110731eb7fa6b0ab157c
|
fb163f40559d19d2791ad657b1a1e737f03aaed1
|
/include/nds/debug.h
|
3111f7e29099a9397d83ef50cd68ce45cab7caed
|
[
"Zlib"
] |
permissive
|
devkitPro/libnds
|
0fbc567493b61c6336d3df6dd9ffd4110c0b51d2
|
6cfbd4494d94a16982b8e7cefb7c63155a3d894b
|
refs/heads/master
| 2023-07-25T12:35:51.616995
| 2023-07-09T16:14:18
| 2023-07-09T16:14:18
| 28,190,585
| 288
| 90
|
NOASSERTION
| 2023-09-14T21:07:56
| 2014-12-18T16:07:36
|
C
|
UTF-8
|
C
| false
| false
| 1,593
|
h
|
debug.h
|
/*---------------------------------------------------------------------------------
Copyright (C) 2005
Jason Rogers (dovoto)
Dave Murphy (WinterMute)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
---------------------------------------------------------------------------------*/
/*! \file debug.h
\brief Currently only used to send debug messages to NO$GBA debug window
<div class="fileHeader">
On the ARM 9 this functionality is best accessed via the console studio integration.
- \ref console.h "Debug Messages via stdio"
</div>
*/
#ifndef NDS_DEBUG_INCLUDE
#define NDS_DEBUG_INCLUDE
void nocashWrite(const char *message, int len);
/*! \brief Send a message to the no$gba debug window
\param message The message to send
*/
void nocashMessage(const char *message);
#endif // NDS_DEBUG_INCLUDE
|
3d3eec8c9a184d6423e67e988d288f050aeea942
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/staging/wlags49_h2/dhf.h
|
1299b8256468fd78ccb2242141c169d16160727b
|
[
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 8,403
|
h
|
dhf.h
|
#ifndef DHF_H
#define DHF_H
/**************************************************************************************************************
*
* FILE : DHF.H
*
* DATE : $Date: 2004/07/19 08:16:14 $ $Revision: 1.2 $
* Original : 2004/05/17 07:33:13 Revision: 1.25 Tag: hcf7_t20040602_01
* Original : 2004/05/11 06:03:14 Revision: 1.24 Tag: hcf7_t7_20040513_01
* Original : 2004/04/15 09:24:42 Revision: 1.22 Tag: hcf7_t7_20040415_01
* Original : 2004/04/09 14:35:52 Revision: 1.21 Tag: t7_20040413_01
* Original : 2004/04/01 15:32:55 Revision: 1.18 Tag: t7_20040401_01
* Original : 2004/03/10 15:39:28 Revision: 1.15 Tag: t20040310_01
* Original : 2004/03/04 11:03:38 Revision: 1.13 Tag: t20040304_01
* Original : 2004/02/25 14:14:37 Revision: 1.11 Tag: t20040302_03
* Original : 2004/02/24 13:00:28 Revision: 1.10 Tag: t20040224_01
* Original : 2004/02/19 10:57:28 Revision: 1.8 Tag: t20040219_01
*
* AUTHOR : John Meertens
* Nico Valster
*
* SPECIFICATION: .........
*
* DESC : structure definitions and function prototypes for unit DHF.
*
* Customizable via HCFCFG.H, which is included indirectly via HCF.H
*
***************************************************************************************************************
*
*
* SOFTWARE LICENSE
*
* This software is provided subject to the following terms and conditions,
* which you should read carefully before using the software. Using this
* software indicates your acceptance of these terms and conditions. If you do
* not agree with these terms and conditions, do not use the software.
*
* COPYRIGHT (C) 1994 - 1995 by AT&T. All Rights Reserved
* COPYRIGHT (C) 1999 - 2000 by Lucent Technologies. All Rights Reserved
* COPYRIGHT (C) 2001 - 2004 by Agere Systems Inc. All Rights Reserved
* All rights reserved.
*
* Redistribution and use in source or binary forms, with or without
* modifications, 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 as comments in the code as
* well as in the documentation and/or other materials provided with the
* distribution.
*
* . 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 Agere Systems Inc. nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* Disclaimer
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. 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, INCLUDING, BUT NOT LIMITED TO, 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.
*
*
**************************************************************************************************************/
#ifdef _WIN32_WCE
#include <windef.h>
#endif
#include "hcf.h" /* includes HCFCFG.H too */
#ifdef DHF_UIL
#define GET_INFO(pp) uil_get_info((LTVP)pp)
#define PUT_INFO(pp) uil_put_info((LTVP)pp)
#else
#define GET_INFO(pp) hcf_get_info(ifbp, (LTVP)pp)
#define PUT_INFO(pp) hcf_put_info(ifbp, (LTVP)pp)
#endif
/*---- Defines --------------------------------------------------------------*/
#define CODEMASK 0x0000FFFFL /* Codemask for plug records */
/*---- Error numbers --------------------------------------------------------*/
#define DHF_ERR_INCOMP_FW 0x40 /* Image not compatible with NIC */
/*---- Type definitions -----------------------------------------------------*/
/* needed by dhf_wrap.c */
typedef struct {
LTVP ltvp;
hcf_16 len;
} LTV_INFO_STRUCT , *LTV_INFO_STRUCT_PTR;
/*
* Type: plugrecord
*
* Abstract: This structure represents a Plug Data Record.
*
* Description:
* This structure is used to overlay the plug records in the firmware memory image.
*/
typedef struct {
hcf_32 code; /* Code to plug */
hcf_32 addr; /* Address within the memory image to plug it in */
hcf_32 len; /* The # of bytes which are available to store it */
} plugrecord;
/*
* Type: stringrecord
*
* Abstract: This structure represents a Firmware debug/assert string
*
* Description:
* This structure is used to get assert and debug outputs in the driver and/or utility to be
* able to get more visability of the FW.
*/
#define MAX_DEBUGSTRINGS 1024
#define MAX_DEBUGSTRING_LEN 82
typedef struct {
hcf_32 id;
char str[MAX_DEBUGSTRING_LEN];
} stringrecord;
/*
* Type: exportrecord
*
* Abstract: This structure represents a Firmware export of a variable
*
* Description:
* This structure is used to get the address and name of a FW variable.
*/
#define MAX_DEBUGEXPORTS 2048
#define MAX_DEBUGEXPORT_LEN 12
typedef struct {
hcf_32 id;
char str[MAX_DEBUGEXPORT_LEN];
} exportrecord;
/* Offsets in memimage array p[] */
#define FWSTRINGS_FUNCTION 0
#define FWEXPORTS_FUNCTION 1
/*
* Type: memimage
*
* Abstract: The "root" description of a complete memory image
*
* Description:
* This type represents an entire memory image. The image is built up of several
* segments. These segments need not be contiguous areas in memory, in other words
* the image may contain 'holes'.
*
* The 'codep' field points to an array of segment_descriptor structures.
* The end of the array is indicated by a segment_descriptor of which all fields are zero.
* The 'execution' field is a 32-bit address representing the execution address
* of the firmware within the memory image. This address is zero in case of non-volatile
* memory download.
* The 'compat' field points to an array of TODO
* The end of the array is indicated by a plug record of which all fields are zero.
* The 'identity' field points to an array of TODO
* The end of the array is indicated by a plug record of which all fields are zero.
* The Hermes-I specific 'pdaplug' field points to an array of Production Data Plug record structures.
* The end of the array is indicated by a plug record of which all fields are zero.
* The Hermes-I specific 'priplug' field points to an array of Primary Information Plug record structures.
* The end of the array is indicated by a plug record of which all fields are zero.
*/
typedef struct {
char signature[14+1+1]; /* signature (see DHF.C) + C/LE-Bin/BE-Bin-flag + format version */
CFG_PROG_STRCT FAR *codep; /* */
hcf_32 execution; /* Execution address of the firmware */
void FAR *place_holder_1;
void FAR *place_holder_2;
CFG_RANGE20_STRCT FAR *compat; /* Pointer to the compatibility info records */
CFG_IDENTITY_STRCT FAR *identity; /* Pointer to the identity info records */
void FAR *p[2]; /* (Up to 9) pointers for (future) expansion
* currently in use:
* - F/W printf information
*/
} memimage;
/*-----------------------------------------------------------------------------
*
* DHF function prototypes
*
*---------------------------------------------------------------------------*/
EXTERN_C int dhf_download_fw(void *ifbp, memimage *fw); /* ifbp, ignored when using the UIL */
EXTERN_C int dhf_download_binary(memimage *fw);
/*-----------------------------------------------------------------------------
*
* Functions to be provided by the user of the DHF module.
*
*---------------------------------------------------------------------------*/
/* defined in DHF.C; see there for comments */
EXTERN_C hcf_16 *find_record_in_pda(hcf_16 *pdap, hcf_16 code);
#endif /* DHF_H */
|
686290c9c7bd0bd995590506956a2f6c80978b3f
|
41eb0837713f297134529591b66f3d4d82bcf98e
|
/src/Raine/source/games/ainferno.c
|
e20cf89ecac09dd6d7947c5b15e6802340712e9b
|
[] |
no_license
|
AlexxandreFS/Batocera.PLUS
|
27b196b3cbb781b6fc99e62cad855396d1d5f8f2
|
997ee763ae7135fdf0c34a081e789918bd2eb169
|
refs/heads/master
| 2023-08-17T21:52:39.083687
| 2023-08-17T15:03:44
| 2023-08-17T15:03:44
| 215,869,486
| 135
| 57
| null | 2023-08-14T14:46:14
| 2019-10-17T19:23:42
|
C
|
UTF-8
|
C
| false
| false
| 12,608
|
c
|
ainferno.c
|
#define DRV_DEF_SOUND taito_ym2610_sound
/******************************************************************************/
/* */
/* AIR INFERNO (C) 1990 TAITO CORPORATION */
/* */
/******************************************************************************/
#include "gameinc.h"
#include "tc004vcu.h"
#include "tc220ioc.h"
#include "taitosnd.h"
#include "sasound.h" // sample support routines
static struct ROM_INFO rom_ainferno[] =
{
LOAD8_16( REGION_ROM1, 0x000000, 0x00020000,
"c45-22", 0x50300926, "c45-20", 0x39b189d9),
LOAD8_16( REGION_ROM1, 0x040000, 0x00020000,
"c45-21", 0x1b687241, "c45-28", 0xc7cd2567),
{ "c45-01", 0x00020000, 0x6c59a808, 0, 0, 0, },
{ "c45-02", 0x00020000, 0x6d081044, 0, 0, 0, },
{ "c45-03", 0x00020000, 0x0e1e5b5f, 0, 0, 0, },
{ "c45-04", 0x00020000, 0x2fc0a88e, 0, 0, 0, },
{ "c45-05", 0x00020000, 0x052997b2, 0, 0, 0, },
{ "c45-06", 0x00020000, 0x6a7976d4, 0, 0, 0, },
{ "c45-25", 0x00002000, 0xc0d39f95, 0, 0, 0, },
{ "c45-24", 0x00002000, 0x1013d937, 0, 0, 0, },
{ "c45-23", 0x00010000, 0xd0750c78, 0, 0, 0, },
{ "c45-18", 0x00020000, 0xba7ecf3b, 0, 0, 0, },
{ "c45-16", 0x00020000, 0xc6eb93b0, 0, 0, 0, },
{ "c45-15", 0x00020000, 0xd4610698, 0, 0, 0, },
{ "c45-14", 0x00020000, 0x481b6f29, 0, 0, 0, },
{ "c45-13", 0x00020000, 0x69b82af6, 0, 0, 0, },
{ "c45-12", 0x00020000, 0x4ae305b8, 0, 0, 0, },
{ "c45-11", 0x00020000, 0xd9b4b77c, 0, 0, 0, },
{ "c45-17", 0x00020000, 0x0dbee000, 0, 0, 0, },
{ NULL, 0, 0, 0, 0, 0, },
};
static struct INPUT_INFO input_ainferno[] =
{
INP1( COIN1, 0x055204, 0x04 ),
INP1( COIN2, 0x055204, 0x08 ),
INP0( TILT, 0x055204, 0x20 ),
INP0( SERVICE, 0x055204, 0x10 ),
INP0( P1_START, 0x055204, 0x40 ),
INP0( P1_B1, 0x055206, 0x08 ),
{ KB_DEF_P1_B2, "Lever", 0x055206, 0x01, BIT_ACTIVE_0 },
{ KB_DEF_P1_B3, "Handle X", 0x055206, 0x02, BIT_ACTIVE_0 },
{ KB_DEF_P1_B4, "Handle Y", 0x055206, 0x04, BIT_ACTIVE_0 },
{ KB_DEF_P1_B5, "Pedal L", 0x055206, 0x20, BIT_ACTIVE_0 },
{ KB_DEF_P1_B6, "Pedal R", 0x055206, 0x10, BIT_ACTIVE_0 },
END_INPUT
};
static struct DSW_DATA dsw_data_air_inferno_0[] =
{
{ MSG_DSWA_BIT1, 0x01, 0x02 },
{ MSG_OFF, 0x01},
{ MSG_ON, 0x00},
{ MSG_DSWA_BIT2, 0x02, 0x02 },
{ MSG_OFF, 0x02},
{ MSG_ON, 0x00},
{ MSG_TEST_MODE, 0x04, 0x02 },
{ MSG_OFF, 0x04},
{ MSG_ON, 0x00},
{ MSG_DEMO_SOUND, 0x08, 0x02 },
{ MSG_ON, 0x08},
{ MSG_OFF, 0x00},
{ MSG_DSWA_BIT5, 0x10, 0x02 },
{ MSG_OFF, 0x10},
{ MSG_ON, 0x00},
{ MSG_DSWA_BIT6, 0x20, 0x02 },
{ MSG_OFF, 0x20},
{ MSG_ON, 0x00},
{ MSG_DSWA_BIT7, 0x40, 0x02 },
{ MSG_OFF, 0x40},
{ MSG_ON, 0x00},
{ MSG_DSWA_BIT8, 0x80, 0x02 },
{ MSG_OFF, 0x80},
{ MSG_ON, 0x00},
{ NULL, 0, },
};
static struct DSW_INFO dsw_ainferno[] =
{
{ 0x055200, 0xFF, dsw_data_air_inferno_0 },
{ 0x055202, 0xFF, dsw_data_default_1 },
{ 0, 0, NULL, },
};
static struct ROMSW_DATA romsw_data_air_inferno_0[] =
{
{ "Taito Japan (Notice)", 0x00 },
{ "Taito America", 0x01 },
{ "Taito Japan", 0x02 },
{ NULL, 0 },
};
static struct ROMSW_INFO romsw_ainferno[] =
{
{ 0x03FFFF, 0x00, romsw_data_air_inferno_0 },
{ 0, 0, NULL },
};
static UINT8 *RAM_VIDEO;
static UINT8 *RAM_COLOUR;
static UINT8 *RAM_INPUT;
static UINT8 *GFX_BG0;
static UINT8 *GFX_BG0_SOLID;
static UINT8 *GFX_FG0;
static int BadReadWord(UINT32 address)
{
print_debug("Rw(%06x) [%06x]\n",address,s68000_pc);
return(0xFFFF);
}
static void BadWriteByte(UINT32 address, UINT8 data)
{
#ifdef RAINE_DEBUG
if(address!=0xA00200) print_debug("Wb(%06x,%02x) [%06x]\n",address,data,s68000_pc);
#endif
}
static void BadWriteWord(UINT32 address, UINT16 data)
{
print_debug("Ww(%06x,%04x) [%06x]\n",address,data,s68000_pc);
}
static void load_ainferno(void)
{
int ta,tb,tc;
if(!(RAM=AllocateMem(0x80000))) return;
if(!(GFX=AllocateMem(0x200000))) return;
GFX_BG0 = GFX+0x000000;
if(!load_rom("c45-11", RAM, 0x20000)) return; // GFX
tb=0;
for(ta=0;ta<0x20000;ta+=16){
for(tc=0;tc<16;tc++){
GFX[tb+(tc<<4)]=RAM[ta+tc]&15;
GFX[tb+(tc<<4)+1]=RAM[ta+tc]>>4;
}
tb+=256;
}
if(!load_rom("c45-15", RAM, 0x20000)) return; // GFX
tb=2;
for(ta=0;ta<0x20000;ta+=16){
for(tc=0;tc<16;tc++){
GFX[tb+(tc<<4)]=RAM[ta+tc]&15;
GFX[tb+(tc<<4)+1]=RAM[ta+tc]>>4;
}
tb+=256;
}
if(!load_rom("c45-12", RAM, 0x20000)) return; // GFX
tb=4;
for(ta=0;ta<0x20000;ta+=16){
for(tc=0;tc<16;tc++){
GFX[tb+(tc<<4)]=RAM[ta+tc]&15;
GFX[tb+(tc<<4)+1]=RAM[ta+tc]>>4;
}
tb+=256;
}
if(!load_rom("c45-16", RAM, 0x20000)) return; // GFX
tb=6;
for(ta=0;ta<0x20000;ta+=16){
for(tc=0;tc<16;tc++){
GFX[tb+(tc<<4)]=RAM[ta+tc]&15;
GFX[tb+(tc<<4)+1]=RAM[ta+tc]>>4;
}
tb+=256;
}
if(!load_rom("c45-13", RAM, 0x20000)) return; // GFX
tb=8;
for(ta=0;ta<0x20000;ta+=16){
for(tc=0;tc<16;tc++){
GFX[tb+(tc<<4)]=RAM[ta+tc]&15;
GFX[tb+(tc<<4)+1]=RAM[ta+tc]>>4;
}
tb+=256;
}
if(!load_rom("c45-17", RAM, 0x20000)) return; // GFX
tb=10;
for(ta=0;ta<0x20000;ta+=16){
for(tc=0;tc<16;tc++){
GFX[tb+(tc<<4)]=RAM[ta+tc]&15;
GFX[tb+(tc<<4)+1]=RAM[ta+tc]>>4;
}
tb+=256;
}
if(!load_rom("c45-14", RAM, 0x20000)) return; // GFX
tb=12;
for(ta=0;ta<0x20000;ta+=16){
for(tc=0;tc<16;tc++){
GFX[tb+(tc<<4)]=RAM[ta+tc]&15;
GFX[tb+(tc<<4)+1]=RAM[ta+tc]>>4;
}
tb+=256;
}
if(!load_rom("c45-18", RAM, 0x20000)) return; // GFX
tb=14;
for(ta=0;ta<0x20000;ta+=16){
for(tc=0;tc<16;tc++){
GFX[tb+(tc<<4)]=RAM[ta+tc]&15;
GFX[tb+(tc<<4)+1]=RAM[ta+tc]>>4;
}
tb+=256;
}
RAMSize=0x60000+0x10000;
/*-----[Sound Setup]-----*/
Z80ROM=RAM+0x60000;
if(!load_rom("c45-23", Z80ROM, 0x10000)) return; // Z80 SOUND ROM
if(!(PCMROM=AllocateMem(0xC0000))) return;
memset(PCMROM,0x80,0xC0000);
if(!load_rom("c45-01",PCMROM+0x00000,0x20000)) return; // ADPCM A rom
if(!load_rom("c45-02",PCMROM+0x20000,0x20000)) return; // ADPCM A rom
if(!load_rom("c45-03",PCMROM+0x40000,0x20000)) return; // ADPCM A rom
if(!load_rom("c45-04",PCMROM+0x60000,0x20000)) return; // ADPCM A rom
if(!load_rom("c45-05",PCMROM+0x80000,0x20000)) return; // ADPCM A rom
if(!load_rom("c45-06",PCMROM+0xA0000,0x20000)) return; // ADPCM A rom
YM2610SetBuffers(PCMROM, PCMROM, 0x0C0000, 0x0C0000);
AddTaitoYM2610(0x023A, 0x01BA, 0x10000);
/*-----------------------*/
memset(RAM+0x00000,0x00,0x60000);
memset(RAM+0x55000,0xFF,0x00400);
GFX_FG0 = RAM+0x56000;
RAM_VIDEO = RAM+0x10000;
RAM_COLOUR= RAM+0x39000;
RAM_INPUT = RAM+0x55200;
GFX_BG0_SOLID = make_solid_mask_16x16(GFX_BG0, 0x2000);
InitPaletteMap(RAM_COLOUR, 0x40, 0x10, 0x8000);
set_colour_mapper(&col_map_xxbb_bbxg_gggx_rrrr);
// Fix Freeze
// ----------
WriteByte68k(&ROM[0x07D6],0x60);
WriteWord68k(&ROM[0x56D8],0x4E71);
// Fix SOUND CPU ERROR
// -------------------
WriteByte68k(&ROM[0x206E],0x60);
WriteByte68k(&ROM[0x20EE],0x60);
// Fix TMS320C25 ERROR
// -------------------
WriteByte68k(&ROM[0x56A0],0x60);
/*
// Fix DMA ERROR
// -------------
WriteByte68k(&ROM[0x09C4],0x60);
// Fix SOUND CPU ERROR
// -------------------
WriteByte68k(&ROM[0x0B22],0x60);
WriteByte68k(&ROM[0xE8A6],0x60);
WriteByte68k(&ROM[0xE93E],0x60);
// 68000 Speed hack
// ----------------
//WriteLong68k(&ROM[0x072E],0x13FC0000); // move.b #$00,$AA0000
//WriteLong68k(&ROM[0x0732],0x00AA0000); //
// Fix ROM Checksum
// ----------------
WriteLong68k(&ROM[0x04A0],0x4E714E71); // nop; nop
WriteLong68k(&ROM[0x04C2],0x4E714E71); // nop; nop
*/
// Init tc0004vcu emulation
// ------------------------
tc0004vcu.RAM = RAM_VIDEO;
tc0004vcu.GFX_BG0 = GFX_BG0;
tc0004vcu.GFX_BG0_MSK= GFX_BG0_SOLID;
tc0004vcu.GFX_FG0 = GFX_FG0;
tc0004vcu.tile_mask = 0x1FFF;
tc0004vcu.bmp_x = 64;
tc0004vcu.bmp_y = 64;
tc0004vcu.bmp_w = 512;
tc0004vcu.bmp_h = 400;
tc0004vcu.scr_x = 0;
tc0004vcu.scr_y = 48;
tc0004vcu_init();
// Init tc0220ioc emulation
// ------------------------
tc0220ioc.RAM = RAM_INPUT;
tc0220ioc.ctrl = 0; //TC0220_STOPCPU;
reset_tc0220ioc();
/*
* StarScream Stuff follows
*/
ByteSwap(ROM,0x80000);
ByteSwap(RAM,0x60000);
AddMemFetch(0x000000, 0x07FFFF, ROM+0x000000-0x000000); // 68000 ROM
AddMemFetch(-1, -1, NULL);
AddReadByte(0x000000, 0x07FFFF, NULL, ROM+0x000000); // 68000 ROM
AddReadByte(0x0C0000, 0x0CFFFF, NULL, RAM+0x000000); // 68000 RAM
AddReadByte(0x800000, 0x820FFF, NULL, RAM_VIDEO); // VIDEO RAM
AddReadByte(0x180000, 0x18BFFF, NULL, RAM+0x031000); // ??? RAM/COLOUR RAM
AddReadByte(0x908000, 0x91FFFF, NULL, RAM+0x03D000); // ??? RAM
AddReadByte(0xA00000, 0xA003FF, NULL, RAM+0x055000); // I/O RAM
AddReadByte(0xA80000, 0xA80003, tc0140syt_read_main_68k, NULL); // SOUND COMM
AddReadByte(0x000000, 0xFFFFFF, DefBadReadByte, NULL); // <Bad Reads>
AddReadByte(-1, -1, NULL, NULL);
AddReadWord(0x000000, 0x07FFFF, NULL, ROM+0x000000); // 68000 ROM
AddReadWord(0x0C0000, 0x0CFFFF, NULL, RAM+0x000000); // 68000 RAM
AddReadWord(0x800000, 0x820FFF, NULL, RAM_VIDEO); // VIDEO RAM
AddReadWord(0x180000, 0x18BFFF, NULL, RAM+0x031000); // ??? RAM/COLOUR RAM
AddReadWord(0x908000, 0x91FFFF, NULL, RAM+0x03D000); // ??? RAM
AddReadWord(0xA00000, 0xA003FF, NULL, RAM+0x055000); // I/O RAM
AddReadWord(0x000000, 0xFFFFFF, BadReadWord, NULL); // <Bad Reads>
AddReadWord(-1, -1, NULL, NULL);
AddWriteByte(0x0C0000, 0x0CFFFF, NULL, RAM+0x000000); // 68000 RAM
AddWriteByte(0x800000, 0x820FFF, NULL, RAM_VIDEO); // VIDEO RAM
AddWriteByte(0x180000, 0x18BFFF, NULL, RAM+0x031000); // ??? RAM/COLOUR RAM
AddWriteByte(0x908000, 0x91FFFF, NULL, RAM+0x03D000); // ??? RAM
AddWriteByte(0xA80000, 0xA80003, tc0140syt_write_main_68k, NULL); // SOUND COMM
AddWriteByte(0xAA0000, 0xAA0001, Stop68000, NULL); // Trap Idle 68000
AddWriteByte(0x000000, 0xFFFFFF, BadWriteByte, NULL); // <Bad Writes>
AddWriteByte(-1, -1, NULL, NULL);
AddWriteWord(0x0C0000, 0x0CFFFF, NULL, RAM+0x000000); // 68000 RAM
AddWriteWord(0x800000, 0x820FFF, NULL, RAM_VIDEO); // VIDEO RAM
AddWriteWord(0x180000, 0x18BFFF, NULL, RAM+0x031000); // ??? RAM/COLOUR RAM
AddWriteWord(0x908000, 0x91FFFF, NULL, RAM+0x03D000); // ??? RAM
AddWriteWord(0x000000, 0xFFFFFF, BadWriteWord, NULL); // <Bad Writes>
AddWriteWord(-1, -1, NULL, NULL);
AddInitMemory(); // Set Starscream mem pointers...
}
static void execute_ainferno(void)
{
cpu_execute_cycles(CPU_68K_0, CPU_FRAME_MHz(12,60)); // M68000 12MHz (60fps)
cpu_interrupt(CPU_68K_0, 5);
Taito2610_Frame(); // Z80 and YM2610
}
static void draw_air_inferno(void)
{
ClearPaletteMap();
// Init tc0180vcu emulation
// ------------------------
// BG0
// ---
tc0004vcu_render_bg0();
// BG1
// ---
tc0004vcu_render_bg1();
// OBJECT
// ------
tc0004vcu_render_obj();
// FG0
// ---
//tc0004vcu_render_fg0();
}
static struct VIDEO_INFO video_ainferno =
{
draw_air_inferno,
512,
400,
64,
VIDEO_ROTATE_NORMAL,
};
static struct DIR_INFO dir_ainferno[] =
{
{ "air_inferno", },
{ "ainferno", },
{ NULL, },
};
GME( ainferno, "Air Inferno", TAITO, 1990, GAME_MISC | GAME_NOT_WORKING,
.romsw = romsw_ainferno,
.board = "C45",
);
|
9d74cda78f0d2c9964cec0aee5b473d6dae934c4
|
984bc4181baec6e5a4b05a657e666b0e9f89f3f3
|
/3rdparty/mongo-c-driver-1.21.2/src/libmongoc/src/mongoc/mongoc-matcher.c
|
cd475a018c5701c51405dfa8ef2f865d57c171bb
|
[
"BSD-3-Clause",
"Apache-2.0"
] |
permissive
|
treefrogframework/treefrog-framework
|
0173245ff92162d2107af79861505981980d1eca
|
a1df97793e8cc628779378e5adae9af6987460c1
|
refs/heads/master
| 2023-08-22T03:57:58.891846
| 2023-05-18T14:00:42
| 2023-05-18T14:00:42
| 7,067,532
| 1,152
| 263
|
BSD-3-Clause
| 2023-08-08T20:25:03
| 2012-12-08T13:17:01
|
C++
|
UTF-8
|
C
| false
| false
| 12,429
|
c
|
mongoc-matcher.c
|
/*
* Copyright 2014 MongoDB, 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.
*/
#include <stdlib.h>
#include "mongoc-error.h"
#include "mongoc-matcher.h"
#include "mongoc-matcher-private.h"
#include "mongoc-matcher-op-private.h"
static mongoc_matcher_op_t *
_mongoc_matcher_parse_logical (mongoc_matcher_opcode_t opcode,
bson_iter_t *iter,
bool is_root,
bson_error_t *error);
/*
*--------------------------------------------------------------------------
*
* _mongoc_matcher_parse_compare --
*
* Parse a compare spec such as $gt or $in.
*
* See the following link for more information.
*
* http://docs.mongodb.org/manual/reference/operator/query/
*
* Returns:
* A newly allocated mongoc_matcher_op_t if successful; otherwise
* NULL and @error is set.
*
* Side effects:
* @error may be set.
*
*--------------------------------------------------------------------------
*/
static mongoc_matcher_op_t *
_mongoc_matcher_parse_compare (bson_iter_t *iter, /* IN */
const char *path, /* IN */
bson_error_t *error) /* OUT */
{
const char *key;
mongoc_matcher_op_t *op = NULL, *op_child;
bson_iter_t child;
BSON_ASSERT (iter);
BSON_ASSERT (path);
if (bson_iter_type (iter) == BSON_TYPE_DOCUMENT) {
if (!bson_iter_recurse (iter, &child) || !bson_iter_next (&child)) {
bson_set_error (error,
MONGOC_ERROR_MATCHER,
MONGOC_ERROR_MATCHER_INVALID,
"Document contains no operations.");
return NULL;
}
key = bson_iter_key (&child);
if (key[0] != '$') {
op = _mongoc_matcher_op_compare_new (
MONGOC_MATCHER_OPCODE_EQ, path, iter);
} else if (strcmp (key, "$not") == 0) {
if (!(op_child =
_mongoc_matcher_parse_compare (&child, path, error))) {
return NULL;
}
op = _mongoc_matcher_op_not_new (path, op_child);
} else if (strcmp (key, "$gt") == 0) {
op = _mongoc_matcher_op_compare_new (
MONGOC_MATCHER_OPCODE_GT, path, &child);
} else if (strcmp (key, "$gte") == 0) {
op = _mongoc_matcher_op_compare_new (
MONGOC_MATCHER_OPCODE_GTE, path, &child);
} else if (strcmp (key, "$in") == 0) {
op = _mongoc_matcher_op_compare_new (
MONGOC_MATCHER_OPCODE_IN, path, &child);
} else if (strcmp (key, "$lt") == 0) {
op = _mongoc_matcher_op_compare_new (
MONGOC_MATCHER_OPCODE_LT, path, &child);
} else if (strcmp (key, "$lte") == 0) {
op = _mongoc_matcher_op_compare_new (
MONGOC_MATCHER_OPCODE_LTE, path, &child);
} else if (strcmp (key, "$ne") == 0) {
op = _mongoc_matcher_op_compare_new (
MONGOC_MATCHER_OPCODE_NE, path, &child);
} else if (strcmp (key, "$nin") == 0) {
op = _mongoc_matcher_op_compare_new (
MONGOC_MATCHER_OPCODE_NIN, path, &child);
} else if (strcmp (key, "$exists") == 0) {
op = _mongoc_matcher_op_exists_new (path, bson_iter_bool (&child));
} else if (strcmp (key, "$type") == 0) {
op = _mongoc_matcher_op_type_new (path, bson_iter_type (&child));
} else {
bson_set_error (error,
MONGOC_ERROR_MATCHER,
MONGOC_ERROR_MATCHER_INVALID,
"Invalid operator \"%s\"",
key);
return NULL;
}
} else {
op =
_mongoc_matcher_op_compare_new (MONGOC_MATCHER_OPCODE_EQ, path, iter);
}
BSON_ASSERT (op);
return op;
}
/*
*--------------------------------------------------------------------------
*
* _mongoc_matcher_parse --
*
* Parse a query spec observed by the current key of @iter.
*
* Returns:
* A newly allocated mongoc_matcher_op_t if successful; otherwise
* NULL an @error is set.
*
* Side effects:
* @error may be set.
*
*--------------------------------------------------------------------------
*/
static mongoc_matcher_op_t *
_mongoc_matcher_parse (bson_iter_t *iter, /* IN */
bson_error_t *error) /* OUT */
{
bson_iter_t child;
const char *key;
BSON_ASSERT (iter);
key = bson_iter_key (iter);
if (*key != '$') {
return _mongoc_matcher_parse_compare (iter, key, error);
} else {
BSON_ASSERT (bson_iter_type (iter) == BSON_TYPE_ARRAY);
if (!bson_iter_recurse (iter, &child)) {
bson_set_error (error,
MONGOC_ERROR_MATCHER,
MONGOC_ERROR_MATCHER_INVALID,
"Invalid value for operator \"%s\"",
key);
return NULL;
}
if (strcmp (key, "$or") == 0) {
return _mongoc_matcher_parse_logical (
MONGOC_MATCHER_OPCODE_OR, &child, false, error);
} else if (strcmp (key, "$and") == 0) {
return _mongoc_matcher_parse_logical (
MONGOC_MATCHER_OPCODE_AND, &child, false, error);
} else if (strcmp (key, "$nor") == 0) {
return _mongoc_matcher_parse_logical (
MONGOC_MATCHER_OPCODE_NOR, &child, false, error);
}
}
bson_set_error (error,
MONGOC_ERROR_MATCHER,
MONGOC_ERROR_MATCHER_INVALID,
"Invalid operator \"%s\"",
key);
return NULL;
}
/*
*--------------------------------------------------------------------------
*
* _mongoc_matcher_parse_logical --
*
* Parse a query spec containing a logical operator such as
* $or, $and, $not, and $nor.
*
* See the following link for more information.
*
* http://docs.mongodb.org/manual/reference/operator/query/
*
* Returns:
* A newly allocated mongoc_matcher_op_t if successful; otherwise
* NULL and @error is set.
*
* Side effects:
* @error may be set.
*
*--------------------------------------------------------------------------
*/
static mongoc_matcher_op_t *
_mongoc_matcher_parse_logical (mongoc_matcher_opcode_t opcode, /* IN */
bson_iter_t *iter, /* IN */
bool is_root, /* IN */
bson_error_t *error) /* OUT */
{
mongoc_matcher_op_t *left;
mongoc_matcher_op_t *right;
mongoc_matcher_op_t *more;
mongoc_matcher_op_t *more_wrap;
bson_iter_t child;
BSON_ASSERT (opcode);
BSON_ASSERT (iter);
BSON_ASSERT (iter);
if (!bson_iter_next (iter)) {
bson_set_error (error,
MONGOC_ERROR_MATCHER,
MONGOC_ERROR_MATCHER_INVALID,
"Invalid logical operator.");
return NULL;
}
if (is_root) {
if (!(left = _mongoc_matcher_parse (iter, error))) {
return NULL;
}
} else {
if (!BSON_ITER_HOLDS_DOCUMENT (iter)) {
bson_set_error (error,
MONGOC_ERROR_MATCHER,
MONGOC_ERROR_MATCHER_INVALID,
"Expected document in value.");
return NULL;
}
if (!bson_iter_recurse (iter, &child)) {
bson_set_error (error,
MONGOC_ERROR_BSON,
MONGOC_ERROR_BSON_INVALID,
"corrupt BSON");
return NULL;
}
if (!bson_iter_next (&child)) {
bson_set_error (error,
MONGOC_ERROR_BSON,
MONGOC_ERROR_BSON_INVALID,
"corrupt BSON");
return NULL;
}
if (!(left = _mongoc_matcher_parse (&child, error))) {
return NULL;
}
}
if (!bson_iter_next (iter)) {
return left;
}
if (is_root) {
if (!(right = _mongoc_matcher_parse (iter, error))) {
return NULL;
}
} else {
if (!BSON_ITER_HOLDS_DOCUMENT (iter)) {
bson_set_error (error,
MONGOC_ERROR_MATCHER,
MONGOC_ERROR_MATCHER_INVALID,
"Expected document in value.");
return NULL;
}
if (!bson_iter_recurse (iter, &child)) {
bson_set_error (error,
MONGOC_ERROR_BSON,
MONGOC_ERROR_BSON_INVALID,
"bson_iter_recurse failed.");
return NULL;
}
if (!bson_iter_next (&child)) {
bson_set_error (error,
MONGOC_ERROR_BSON,
MONGOC_ERROR_BSON_INVALID,
"corrupt BSON");
return NULL;
}
if (!(right = _mongoc_matcher_parse (&child, error))) {
return NULL;
}
}
more = _mongoc_matcher_parse_logical (opcode, iter, is_root, error);
if (more) {
more_wrap = _mongoc_matcher_op_logical_new (opcode, right, more);
return _mongoc_matcher_op_logical_new (opcode, left, more_wrap);
}
return _mongoc_matcher_op_logical_new (opcode, left, right);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_matcher_new --
*
* Create a new mongoc_matcher_t using the query specification
* provided in @query.
*
* This will build an operation tree that can be applied to arbitrary
* bson documents using mongoc_matcher_match().
*
* Returns:
* A newly allocated mongoc_matcher_t if successful; otherwise NULL
* and @error is set.
*
* The mongoc_matcher_t should be freed with
* mongoc_matcher_destroy().
*
* Side effects:
* @error may be set.
*
*--------------------------------------------------------------------------
*/
mongoc_matcher_t *
mongoc_matcher_new (const bson_t *query, /* IN */
bson_error_t *error) /* OUT */
{
mongoc_matcher_op_t *op;
mongoc_matcher_t *matcher;
bson_iter_t iter;
BSON_ASSERT (query);
matcher = (mongoc_matcher_t *) bson_malloc0 (sizeof *matcher);
bson_copy_to (query, &matcher->query);
if (!bson_iter_init (&iter, &matcher->query)) {
goto failure;
}
if (!(op = _mongoc_matcher_parse_logical (
MONGOC_MATCHER_OPCODE_AND, &iter, true, error))) {
goto failure;
}
matcher->optree = op;
return matcher;
failure:
bson_destroy (&matcher->query);
bson_free (matcher);
return NULL;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_matcher_match --
*
* Checks to see if @bson matches the query specified when creating
* @matcher.
*
* Returns:
* TRUE if @bson matched the query, otherwise FALSE.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_matcher_match (const mongoc_matcher_t *matcher, /* IN */
const bson_t *document) /* IN */
{
BSON_ASSERT (matcher);
BSON_ASSERT (matcher->optree);
BSON_ASSERT (document);
return _mongoc_matcher_op_match (matcher->optree, document);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_matcher_destroy --
*
* Release all resources associated with @matcher.
*
* Returns:
* None.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
void
mongoc_matcher_destroy (mongoc_matcher_t *matcher) /* IN */
{
BSON_ASSERT (matcher);
_mongoc_matcher_op_destroy (matcher->optree);
bson_destroy (&matcher->query);
bson_free (matcher);
}
|
236a4894b620fb11d2b92dc69c9393bb7cc264ff
|
b8cc7f50628eb2f6b4fdbd66eae5a1aa502cc309
|
/src/Styles.h
|
d6ba1cb8129eba8a6fb431dc432de9ce230ba522
|
[
"BSD-3-Clause",
"LicenseRef-scancode-scintilla",
"MIT",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
zufuliu/notepad2
|
ad82f2baaf60cd9efcbf3af57d2e2f381f961f0b
|
6296f4a8567d2c22690be0cafcdf91a0fea60cc7
|
refs/heads/main
| 2023-08-29T03:45:42.292846
| 2023-08-28T10:33:46
| 2023-08-28T10:33:46
| 79,987,996
| 2,154
| 227
|
NOASSERTION
| 2023-08-11T23:59:02
| 2017-01-25T06:07:49
|
C++
|
UTF-8
|
C
| false
| false
| 5,287
|
h
|
Styles.h
|
/******************************************************************************
*
*
* Notepad2
*
* Styles.h
* Scintilla Style Management
*
* See Readme.txt for more information about this source code.
* Please send me your comments to this work.
*
* See License.txt for details about distribution and modification.
*
* (c) Florian Balmer 1996-2011
* florian.balmer@gmail.com
* https://www.flos-freeware.ch
*
*
******************************************************************************/
#pragma once
#include "EditLexer.h"
// maximum favorite schemes count, DON'T change.
#define MAX_FAVORITE_SCHEMES_COUNT 31
// All Files, current scheme, Text File, 2nd Text File and favorite schemes
// see Style_GetOpenDlgFilterStr() for actually count.
#define OPENDLG_MAX_LEXER_COUNT (MAX_FAVORITE_SCHEMES_COUNT + 2 + 2)
#define INI_SECTION_NAME_STYLES L"Styles"
#define INI_SECTION_NAME_FILE_EXTENSIONS L"File Extensions"
#define INI_SECTION_NAME_CUSTOM_COLORS L"Custom Colors"
#define MAX_INI_SECTION_SIZE_STYLES (8 * 1024)
typedef enum LineHighlightMode {
LineHighlightMode_None = 0,
LineHighlightMode_BackgroundColor,
LineHighlightMode_OutlineFrame,
} LineHighlightMode;
typedef enum CaretStyle {
CaretStyle_Block = 0,
CaretStyle_LineWidth1,
CaretStyle_LineWidth2,
CaretStyle_LineWidth3,
} CaretStyle;
typedef enum StyleDefinitionMask {
StyleDefinitionMask_None = 0,
StyleDefinitionMask_FontFace = 1 << 0,
StyleDefinitionMask_FontSize = 1 << 1,
StyleDefinitionMask_ForeColor = 1 << 2,
StyleDefinitionMask_BackColor = 1 << 3,
StyleDefinitionMask_FontWeight = 1 << 4,
StyleDefinitionMask_Charset = 1 << 5,
} StyleDefinitionMask;
typedef struct StyleDefinition {
UINT mask;
int fontSize;
COLORREF foreColor;
COLORREF backColor;
int weight;
bool italic;
bool underline;
bool strike;
bool overline;
bool eolFilled;
uint8_t unused;
uint16_t backIndex;
int charset;
WCHAR fontWide[LF_FACESIZE];
char fontFace[LF_FACESIZE * kMaxMultiByteCount];
} StyleDefinition;
extern PEDITLEXER pLexCurrent;
extern int np2LexLangIndex;
extern bool bUse2ndGlobalStyle;
extern int np2StyleTheme;
void Style_ReleaseResources(void);
void Style_Load(void);
void Style_Save(void);
bool Style_Import(HWND hwnd);
bool Style_Export(HWND hwnd);
void Style_LoadTabSettings(PEDITLEXER pLex);
void Style_SaveTabSettings(PEDITLEXER pLex);
void EditApplyDefaultEncoding(PEDITLEXER pLex, BOOL bLexerChanged);
void InitAutoCompletionCache(LPCEDITLEXER pLex);
void Style_DetectBaseFontSize(HMONITOR hMonitor);
HFONT Style_CreateCodeFont(UINT dpi);
void Style_OnDPIChanged(PEDITLEXER pLex);
void Style_OnStyleThemeChanged(int theme);
void Style_InitDefaultColor(void);
void Style_SetLexer(PEDITLEXER pLexNew, BOOL bLexerChanged);
bool Style_SetLexerFromFile(LPCWSTR lpszFile);
void Style_SetLexerFromName(LPCWSTR lpszFile, LPCWSTR lpszName);
bool Style_CanOpenFile(LPCWSTR lpszFile);
void Style_SetLexerFromID(int rid);
int Style_GetMatchLexerIndex(int rid);
int Style_GetDocTypeLanguage(void);
LPCWSTR Style_GetCurrentLexerName(LPWSTR lpszName, int cchName);
void Style_SetLexerByLangIndex(int lang);
void Style_UpdateSchemeMenu(HMENU hmenu);
void Style_SetDefaultFont(HWND hwnd, bool bCode);
void Style_SetIndentGuides(bool bShow);
void Style_SetBookmark(void);
void Style_UpdateCaret(void);
void Style_SetLongLineColors(void);
void Style_HighlightCurrentLine(void);
void Style_ToggleUse2ndGlobalStyle(void);
void Style_ToggleUseDefaultCodeStyle(void);
LPWSTR Style_GetOpenDlgFilterStr(bool open, LPCWSTR lpszFile, int lexers[]);
bool Style_StrGetFontEx(LPCWSTR lpszStyle, LPWSTR lpszFont, int cchFont, bool bDefaultStyle);
bool Style_StrGetCharSet(LPCWSTR lpszStyle, int *charset);
BOOL Style_StrGetLocale(LPCWSTR lpszStyle, LPWSTR lpszLocale, int cchLocale);
bool Style_StrGetFontSize(LPCWSTR lpszStyle, int *size);
bool Style_StrGetSize(LPCWSTR lpszStyle, int *size);
bool Style_StrGetFontWeight(LPCWSTR lpszStyle, int *weight);
bool Style_StrGetColor(bool bFore, LPCWSTR lpszStyle, COLORREF *rgb);
NP2_inline bool Style_StrGetForeColor(LPCWSTR lpszStyle, COLORREF *rgb) {
return Style_StrGetColor(true, lpszStyle, rgb);
}
NP2_inline bool Style_StrGetBackColor(LPCWSTR lpszStyle, COLORREF *rgb) {
return Style_StrGetColor(false, lpszStyle, rgb);
}
bool Style_StrGetAlphaEx(bool outline, LPCWSTR lpszStyle, int *alpha);
NP2_inline bool Style_StrGetAlpha(LPCWSTR lpszStyle, int *alpha) {
return Style_StrGetAlphaEx(false, lpszStyle, alpha);
}
NP2_inline bool Style_StrGetOutlineAlpha(LPCWSTR lpszStyle, int *alpha) {
return Style_StrGetAlphaEx(true, lpszStyle, alpha);
}
bool Style_SelectFont(HWND hwnd, LPWSTR lpszStyle, int cchStyle, bool bDefaultStyle);
bool Style_SelectColor(HWND hwnd, LPWSTR lpszStyle, int cchStyle, bool bFore);
void Style_SetStyles(int iStyle, LPCWSTR lpszStyle);
int Style_GetLexerIconId(LPCEDITLEXER pLex, DWORD iconFlags);
void Style_ConfigDlg(HWND hwnd);
void Style_SelectLexerDlg(HWND hwnd, bool favorite);
bool SelectCSVOptionsDlg(void);
|
68cf23086c160b525824ec72cb9211f4fe360034
|
db229415713a206a848429321e19006b212d20d5
|
/simde/x86/ssse3.h
|
6c4c12d5f831f8cfc93f4f9d06a498051616fc4d
|
[
"MIT",
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] |
permissive
|
simd-everywhere/simde
|
66dd029cbd0b3814b0377c72d953f223d38e7e53
|
4d55fc25bcfddc0e2f0c744448557a070dd310c9
|
refs/heads/master
| 2023-09-04T12:55:25.455223
| 2023-08-18T12:46:56
| 2023-08-18T14:53:06
| 86,497,800
| 1,570
| 173
|
MIT
| 2023-09-07T13:41:28
| 2017-03-28T19:14:32
|
C
|
UTF-8
|
C
| false
| false
| 37,052
|
h
|
ssse3.h
|
/* SPDX-License-Identifier: MIT
*
* 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.
*
* Copyright:
* 2017-2020 Evan Nemerson <evan@nemerson.com>
*/
#if !defined(SIMDE_X86_SSSE3_H)
#define SIMDE_X86_SSSE3_H
#include "sse3.h"
HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_abs_epi8 (simde__m128i a) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_abs_epi8(a);
#elif defined(SIMDE_X86_SSE2_NATIVE)
return _mm_min_epu8(a, _mm_sub_epi8(_mm_setzero_si128(), a));
#else
simde__m128i_private
r_,
a_ = simde__m128i_to_private(a);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
r_.neon_i8 = vabsq_s8(a_.neon_i8);
#elif defined(SIMDE_POWER_ALTIVEC_P6_NATIVE) || defined(SIMDE_ZARCH_ZVECTOR_13_NATIVE)
r_.altivec_i8 = vec_abs(a_.altivec_i8);
#elif defined(SIMDE_WASM_SIMD128_NATIVE)
r_.wasm_v128 = wasm_i8x16_abs(a_.wasm_v128);
#else
SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.i8) / sizeof(r_.i8[0])) ; i++) {
r_.u8[i] = HEDLEY_STATIC_CAST(uint8_t, (a_.i8[i] < 0) ? (- a_.i8[i]) : a_.i8[i]);
}
#endif
return simde__m128i_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_abs_epi8(a) simde_mm_abs_epi8(a)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_abs_epi16 (simde__m128i a) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_abs_epi16(a);
#elif defined(SIMDE_X86_SSE2_NATIVE)
return _mm_max_epi16(a, _mm_sub_epi16(_mm_setzero_si128(), a));
#else
simde__m128i_private
r_,
a_ = simde__m128i_to_private(a);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
r_.neon_i16 = vabsq_s16(a_.neon_i16);
#elif defined(SIMDE_POWER_ALTIVEC_P6_NATIVE) || defined(SIMDE_ZARCH_ZVECTOR_13_NATIVE)
r_.altivec_i16 = vec_abs(a_.altivec_i16);
#elif defined(SIMDE_WASM_SIMD128_NATIVE)
r_.wasm_v128 = wasm_i16x8_abs(a_.wasm_v128);
#else
SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.i16) / sizeof(r_.i16[0])) ; i++) {
r_.u16[i] = HEDLEY_STATIC_CAST(uint16_t, (a_.i16[i] < 0) ? (- a_.i16[i]) : a_.i16[i]);
}
#endif
return simde__m128i_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_abs_epi16(a) simde_mm_abs_epi16(a)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_abs_epi32 (simde__m128i a) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_abs_epi32(a);
#elif defined(SIMDE_X86_SSE2_NATIVE)
const __m128i m = _mm_cmpgt_epi32(_mm_setzero_si128(), a);
return _mm_sub_epi32(_mm_xor_si128(a, m), m);
#else
simde__m128i_private
r_,
a_ = simde__m128i_to_private(a);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
r_.neon_i32 = vabsq_s32(a_.neon_i32);
#elif defined(SIMDE_POWER_ALTIVEC_P6_NATIVE) || defined(SIMDE_ZARCH_ZVECTOR_13_NATIVE)
r_.altivec_i32 = vec_abs(a_.altivec_i32);
#elif defined(SIMDE_WASM_SIMD128_NATIVE)
r_.wasm_v128 = wasm_i32x4_abs(a_.wasm_v128);
#else
SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.i32) / sizeof(r_.i32[0])) ; i++) {
#if defined(_MSC_VER)
HEDLEY_DIAGNOSTIC_PUSH
#pragma warning(disable:4146)
#endif
r_.u32[i] = (a_.i32[i] < 0) ? (- HEDLEY_STATIC_CAST(uint32_t, a_.i32[i])) : HEDLEY_STATIC_CAST(uint32_t, a_.i32[i]);
#if defined(_MSC_VER)
HEDLEY_DIAGNOSTIC_POP
#endif
}
#endif
return simde__m128i_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_abs_epi32(a) simde_mm_abs_epi32(a)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_abs_pi8 (simde__m64 a) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_abs_pi8(a);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
r_.neon_i8 = vabs_s8(a_.neon_i8);
#else
SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.i8) / sizeof(r_.i8[0])) ; i++) {
r_.u8[i] = HEDLEY_STATIC_CAST(uint8_t, (a_.i8[i] < 0) ? (- a_.i8[i]) : a_.i8[i]);
}
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_abs_pi8(a) simde_mm_abs_pi8(a)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_abs_pi16 (simde__m64 a) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_abs_pi16(a);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
r_.neon_i16 = vabs_s16(a_.neon_i16);
#else
SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.i16) / sizeof(r_.i16[0])) ; i++) {
r_.u16[i] = HEDLEY_STATIC_CAST(uint16_t, (a_.i16[i] < 0) ? (- a_.i16[i]) : a_.i16[i]);
}
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_abs_pi16(a) simde_mm_abs_pi16(a)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_abs_pi32 (simde__m64 a) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_abs_pi32(a);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
r_.neon_i32 = vabs_s32(a_.neon_i32);
#else
SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.i32) / sizeof(r_.i32[0])) ; i++) {
r_.u32[i] = HEDLEY_STATIC_CAST(uint32_t, (a_.i32[i] < 0) ? (- a_.i32[i]) : a_.i32[i]);
}
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_abs_pi32(a) simde_mm_abs_pi32(a)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_alignr_epi8 (simde__m128i a, simde__m128i b, int count)
SIMDE_REQUIRE_CONSTANT_RANGE(count, 0, 255) {
simde__m128i_private
r_,
a_ = simde__m128i_to_private(a),
b_ = simde__m128i_to_private(b);
if (HEDLEY_UNLIKELY(count > 31))
return simde_mm_setzero_si128();
for (size_t i = 0 ; i < (sizeof(r_.i8) / sizeof(r_.i8[0])) ; i++) {
const int srcpos = count + HEDLEY_STATIC_CAST(int, i);
if (srcpos > 31) {
r_.i8[i] = 0;
} else if (srcpos > 15) {
r_.i8[i] = a_.i8[(srcpos) & 15];
} else {
r_.i8[i] = b_.i8[srcpos];
}
}
return simde__m128i_from_private(r_);
}
#if defined(SIMDE_X86_SSSE3_NATIVE)
#define simde_mm_alignr_epi8(a, b, count) _mm_alignr_epi8(a, b, count)
#elif defined(SIMDE_ARM_NEON_A32V7_NATIVE)
#define simde_mm_alignr_epi8(a, b, count) \
( \
((count) > 31) \
? simde__m128i_from_neon_i8(vdupq_n_s8(0)) \
: ( \
((count) > 15) \
? (simde__m128i_from_neon_i8(vextq_s8(simde__m128i_to_neon_i8(a), vdupq_n_s8(0), (count) & 15))) \
: (simde__m128i_from_neon_i8(vextq_s8(simde__m128i_to_neon_i8(b), simde__m128i_to_neon_i8(a), ((count) & 15))))))
#endif
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
#define _mm_alignr_epi8(a, b, count) simde_mm_alignr_epi8(a, b, count)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_alignr_pi8 (simde__m64 a, simde__m64 b, const int count)
SIMDE_REQUIRE_CONSTANT(count) {
simde__m64_private
r_,
a_ = simde__m64_to_private(a),
b_ = simde__m64_to_private(b);
if (HEDLEY_UNLIKELY(count > 15))
return simde_mm_setzero_si64();
for (size_t i = 0 ; i < (sizeof(r_.i8) / sizeof(r_.i8[0])) ; i++) {
const int srcpos = count + HEDLEY_STATIC_CAST(int, i);
if (srcpos > 15) {
r_.i8[i] = 0;
} else if (srcpos > 7) {
r_.i8[i] = a_.i8[(srcpos) & 7];
} else {
r_.i8[i] = b_.i8[srcpos];
}
}
return simde__m64_from_private(r_);
}
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
# define simde_mm_alignr_pi8(a, b, count) _mm_alignr_pi8(a, b, count)
#elif defined(SIMDE_ARM_NEON_A32V7_NATIVE)
#define simde_mm_alignr_pi8(a, b, count) \
( \
((count) > 15) \
? simde__m64_from_neon_i8(vdup_n_s8(0)) \
: ( \
((count) > 7) \
? (simde__m64_from_neon_i8(vext_s8(simde__m64_to_neon_i8(a), vdup_n_s8(0), (count) & 7))) \
: (simde__m64_from_neon_i8(vext_s8(simde__m64_to_neon_i8(b), simde__m64_to_neon_i8(a), ((count) & 7))))))
#endif
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_alignr_pi8(a, b, count) simde_mm_alignr_pi8(a, b, count)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_shuffle_epi8 (simde__m128i a, simde__m128i b) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_shuffle_epi8(a, b);
#else
simde__m128i_private
r_,
a_ = simde__m128i_to_private(a),
b_ = simde__m128i_to_private(b);
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
r_.neon_i8 = vqtbl1q_s8(a_.neon_i8, vandq_u8(b_.neon_u8, vdupq_n_u8(0x8F)));
#elif defined(SIMDE_ARM_NEON_A32V7_NATIVE)
/* Mask out the bits we're not interested in. vtbl will result in 0
* for any values outside of [0, 15], so if the high bit is set it
* will return 0, just like in SSSE3. */
b_.neon_i8 = vandq_s8(b_.neon_i8, vdupq_n_s8(HEDLEY_STATIC_CAST(int8_t, (1 << 7) | 15)));
/* Convert a from an int8x16_t to an int8x8x2_t */
int8x8x2_t i;
i.val[0] = vget_low_s8(a_.neon_i8);
i.val[1] = vget_high_s8(a_.neon_i8);
/* Table lookups */
int8x8_t l = vtbl2_s8(i, vget_low_s8(b_.neon_i8));
int8x8_t h = vtbl2_s8(i, vget_high_s8(b_.neon_i8));
r_.neon_i8 = vcombine_s8(l, h);
#elif defined(SIMDE_POWER_ALTIVEC_P6_NATIVE)
/* This is a bit ugly because of the casts and the awful type
* macros (SIMDE_POWER_ALTIVEC_VECTOR), but it's really just
* vec_sel(vec_perm(a, a, b), 0, vec_cmplt(b, 0)) */
SIMDE_POWER_ALTIVEC_VECTOR(signed char) z = { 0, };
SIMDE_POWER_ALTIVEC_VECTOR(signed char) msb_mask = HEDLEY_REINTERPRET_CAST(SIMDE_POWER_ALTIVEC_VECTOR(signed char), vec_cmplt(b_.altivec_i8, z));
SIMDE_POWER_ALTIVEC_VECTOR(signed char) c = vec_perm(a_.altivec_i8, a_.altivec_i8, HEDLEY_REINTERPRET_CAST(SIMDE_POWER_ALTIVEC_VECTOR(unsigned char), b_.altivec_i8));
r_.altivec_i8 = vec_sel(c, z, HEDLEY_REINTERPRET_CAST(SIMDE_POWER_ALTIVEC_VECTOR(unsigned char), msb_mask));
#elif defined(SIMDE_WASM_SIMD128_NATIVE)
r_.wasm_v128 = wasm_i8x16_swizzle(
a_.wasm_v128, wasm_v128_and(b_.wasm_v128, wasm_i8x16_splat(0x8F)));
#else
for (size_t i = 0 ; i < (sizeof(r_.i8) / sizeof(r_.i8[0])) ; i++) {
r_.i8[i] = a_.i8[b_.i8[i] & 15] & (~(b_.i8[i]) >> 7);
}
#endif
return simde__m128i_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_shuffle_epi8(a, b) simde_mm_shuffle_epi8(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_shuffle_pi8 (simde__m64 a, simde__m64 b) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_shuffle_pi8(a, b);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a),
b_ = simde__m64_to_private(b);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
b_.neon_i8 = vand_s8(b_.neon_i8, vdup_n_s8(HEDLEY_STATIC_CAST(int8_t, (1 << 7) | 7)));
r_.neon_i8 = vtbl1_s8(a_.neon_i8, b_.neon_i8);
#else
for (size_t i = 0 ; i < (sizeof(r_.u8) / sizeof(r_.u8[0])) ; i++) {
r_.i8[i] = a_.i8[b_.i8[i] & 7] & (~(b_.i8[i]) >> 7);
}
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_shuffle_pi8(a, b) simde_mm_shuffle_pi8(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_hadd_epi16 (simde__m128i a, simde__m128i b) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_hadd_epi16(a, b);
#elif defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return simde__m128i_from_neon_i16(vpaddq_s16(simde__m128i_to_neon_i16(a), simde__m128i_to_neon_i16(b)));
#elif defined(SIMDE_ARM_NEON_A32V7_NATIVE)
int16x8x2_t t = vuzpq_s16(simde__m128i_to_neon_i16(a), simde__m128i_to_neon_i16(b));
return simde__m128i_from_neon_i16(vaddq_s16(t.val[0], t.val[1]));
#else
return simde_mm_add_epi16(simde_x_mm_deinterleaveeven_epi16(a, b), simde_x_mm_deinterleaveodd_epi16(a, b));
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_hadd_epi16(a, b) simde_mm_hadd_epi16(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_hadd_epi32 (simde__m128i a, simde__m128i b) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_hadd_epi32(a, b);
#elif defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return simde__m128i_from_neon_i32(vpaddq_s32(simde__m128i_to_neon_i32(a), simde__m128i_to_neon_i32(b)));
#elif defined(SIMDE_ARM_NEON_A32V7_NATIVE)
int32x4x2_t t = vuzpq_s32(simde__m128i_to_neon_i32(a), simde__m128i_to_neon_i32(b));
return simde__m128i_from_neon_i32(vaddq_s32(t.val[0], t.val[1]));
#else
return simde_mm_add_epi32(simde_x_mm_deinterleaveeven_epi32(a, b), simde_x_mm_deinterleaveodd_epi32(a, b));
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_hadd_epi32(a, b) simde_mm_hadd_epi32(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_hadd_pi16 (simde__m64 a, simde__m64 b) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_hadd_pi16(a, b);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a),
b_ = simde__m64_to_private(b);
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
r_.neon_i16 = vpadd_s16(a_.neon_i16, b_.neon_i16);
#elif defined(SIMDE_ARM_NEON_A32V7_NATIVE)
int16x4x2_t t = vuzp_s16(a_.neon_i16, b_.neon_i16);
r_.neon_i16 = vadd_s16(t.val[0], t.val[1]);
#elif (SIMDE_NATURAL_VECTOR_SIZE > 0) && defined(SIMDE_SHUFFLE_VECTOR_)
r_.i16 =
SIMDE_SHUFFLE_VECTOR_(16, 8, a_.i16, b_.i16, 0, 2, 4, 6) +
SIMDE_SHUFFLE_VECTOR_(16, 8, a_.i16, b_.i16, 1, 3, 5, 7);
#else
r_.i16[0] = a_.i16[0] + a_.i16[1];
r_.i16[1] = a_.i16[2] + a_.i16[3];
r_.i16[2] = b_.i16[0] + b_.i16[1];
r_.i16[3] = b_.i16[2] + b_.i16[3];
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_hadd_pi16(a, b) simde_mm_hadd_pi16(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_hadd_pi32 (simde__m64 a, simde__m64 b) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_hadd_pi32(a, b);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a),
b_ = simde__m64_to_private(b);
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
r_.neon_i32 = vpadd_s32(a_.neon_i32, b_.neon_i32);
#elif defined(SIMDE_ARM_NEON_A32V7_NATIVE)
int32x2x2_t t = vuzp_s32(a_.neon_i32, b_.neon_i32);
r_.neon_i32 = vadd_s32(t.val[0], t.val[1]);
#elif (SIMDE_NATURAL_VECTOR_SIZE > 0) && defined(SIMDE_SHUFFLE_VECTOR_)
r_.i32 =
SIMDE_SHUFFLE_VECTOR_(32, 8, a_.i32, b_.i32, 0, 2) +
SIMDE_SHUFFLE_VECTOR_(32, 8, a_.i32, b_.i32, 1, 3);
#else
r_.i32[0] = a_.i32[0] + a_.i32[1];
r_.i32[1] = b_.i32[0] + b_.i32[1];
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_hadd_pi32(a, b) simde_mm_hadd_pi32(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_hadds_epi16 (simde__m128i a, simde__m128i b) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_hadds_epi16(a, b);
#elif defined(SIMDE_ARM_NEON_A32V7_NATIVE)
int16x8x2_t t = vuzpq_s16(simde__m128i_to_neon_i16(a), simde__m128i_to_neon_i16(b));
return simde__m128i_from_neon_i16(vqaddq_s16(t.val[0], t.val[1]));
#else
return simde_mm_adds_epi16(simde_x_mm_deinterleaveeven_epi16(a, b), simde_x_mm_deinterleaveodd_epi16(a, b));
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_hadds_epi16(a, b) simde_mm_hadds_epi16(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_hadds_pi16 (simde__m64 a, simde__m64 b) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_hadds_pi16(a, b);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a),
b_ = simde__m64_to_private(b);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
int16x4x2_t t = vuzp_s16(a_.neon_i16, b_.neon_i16);
r_.neon_i16 = vqadd_s16(t.val[0], t.val[1]);
#else
for (size_t i = 0 ; i < ((sizeof(r_.i16) / sizeof(r_.i16[0])) / 2) ; i++) {
int32_t ta = HEDLEY_STATIC_CAST(int32_t, a_.i16[i * 2]) + HEDLEY_STATIC_CAST(int32_t, a_.i16[(i * 2) + 1]);
r_.i16[ i ] = HEDLEY_LIKELY(ta > INT16_MIN) ? (HEDLEY_LIKELY(ta < INT16_MAX) ? HEDLEY_STATIC_CAST(int16_t, ta) : INT16_MAX) : INT16_MIN;
int32_t tb = HEDLEY_STATIC_CAST(int32_t, b_.i16[i * 2]) + HEDLEY_STATIC_CAST(int32_t, b_.i16[(i * 2) + 1]);
r_.i16[i + 2] = HEDLEY_LIKELY(tb > INT16_MIN) ? (HEDLEY_LIKELY(tb < INT16_MAX) ? HEDLEY_STATIC_CAST(int16_t, tb) : INT16_MAX) : INT16_MIN;
}
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_hadds_pi16(a, b) simde_mm_hadds_pi16(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_hsub_epi16 (simde__m128i a, simde__m128i b) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_hsub_epi16(a, b);
#elif defined(SIMDE_ARM_NEON_A32V7_NATIVE)
int16x8x2_t t = vuzpq_s16(simde__m128i_to_neon_i16(a), simde__m128i_to_neon_i16(b));
return simde__m128i_from_neon_i16(vsubq_s16(t.val[0], t.val[1]));
#else
return simde_mm_sub_epi16(simde_x_mm_deinterleaveeven_epi16(a, b), simde_x_mm_deinterleaveodd_epi16(a, b));
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_hsub_epi16(a, b) simde_mm_hsub_epi16(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_hsub_epi32 (simde__m128i a, simde__m128i b) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_hsub_epi32(a, b);
#elif defined(SIMDE_ARM_NEON_A32V7_NATIVE)
int32x4x2_t t = vuzpq_s32(simde__m128i_to_neon_i32(a), simde__m128i_to_neon_i32(b));
return simde__m128i_from_neon_i32(vsubq_s32(t.val[0], t.val[1]));
#else
return simde_mm_sub_epi32(simde_x_mm_deinterleaveeven_epi32(a, b), simde_x_mm_deinterleaveodd_epi32(a, b));
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_hsub_epi32(a, b) simde_mm_hsub_epi32(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_hsub_pi16 (simde__m64 a, simde__m64 b) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_hsub_pi16(a, b);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a),
b_ = simde__m64_to_private(b);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
int16x4x2_t t = vuzp_s16(a_.neon_i16, b_.neon_i16);
r_.neon_i16 = vsub_s16(t.val[0], t.val[1]);
#elif (SIMDE_NATURAL_VECTOR_SIZE > 0) && defined(SIMDE_SHUFFLE_VECTOR_)
r_.i16 =
SIMDE_SHUFFLE_VECTOR_(16, 8, a_.i16, b_.i16, 0, 2, 4, 6) -
SIMDE_SHUFFLE_VECTOR_(16, 8, a_.i16, b_.i16, 1, 3, 5, 7);
#else
r_.i16[0] = a_.i16[0] - a_.i16[1];
r_.i16[1] = a_.i16[2] - a_.i16[3];
r_.i16[2] = b_.i16[0] - b_.i16[1];
r_.i16[3] = b_.i16[2] - b_.i16[3];
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_hsub_pi16(a, b) simde_mm_hsub_pi16(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_hsub_pi32 (simde__m64 a, simde__m64 b) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_hsub_pi32(a, b);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a),
b_ = simde__m64_to_private(b);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
int32x2x2_t t = vuzp_s32(a_.neon_i32, b_.neon_i32);
r_.neon_i32 = vsub_s32(t.val[0], t.val[1]);
#elif (SIMDE_NATURAL_VECTOR_SIZE > 0) && defined(SIMDE_SHUFFLE_VECTOR_)
r_.i32 =
SIMDE_SHUFFLE_VECTOR_(32, 8, a_.i32, b_.i32, 0, 2) -
SIMDE_SHUFFLE_VECTOR_(32, 8, a_.i32, b_.i32, 1, 3);
#else
r_.i32[0] = a_.i32[0] - a_.i32[1];
r_.i32[1] = b_.i32[0] - b_.i32[1];
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_hsub_pi32(a, b) simde_mm_hsub_pi32(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_hsubs_epi16 (simde__m128i a, simde__m128i b) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_hsubs_epi16(a, b);
#elif defined(SIMDE_ARM_NEON_A32V7_NATIVE)
int16x8x2_t t = vuzpq_s16(simde__m128i_to_neon_i16(a), simde__m128i_to_neon_i16(b));
return simde__m128i_from_neon_i16(vqsubq_s16(t.val[0], t.val[1]));
#else
return simde_mm_subs_epi16(simde_x_mm_deinterleaveeven_epi16(a, b), simde_x_mm_deinterleaveodd_epi16(a, b));
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_hsubs_epi16(a, b) simde_mm_hsubs_epi16(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_hsubs_pi16 (simde__m64 a, simde__m64 b) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_hsubs_pi16(a, b);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a),
b_ = simde__m64_to_private(b);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
int16x4x2_t t = vuzp_s16(a_.neon_i16, b_.neon_i16);
r_.neon_i16 = vqsub_s16(t.val[0], t.val[1]);
#else
for (size_t i = 0 ; i < ((sizeof(r_.i16) / sizeof(r_.i16[0])) / 2) ; i++) {
r_.i16[ i ] = simde_math_subs_i16(a_.i16[i * 2], a_.i16[(i * 2) + 1]);
r_.i16[i + 2] = simde_math_subs_i16(b_.i16[i * 2], b_.i16[(i * 2) + 1]);
}
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_hsubs_pi16(a, b) simde_mm_hsubs_pi16(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_maddubs_epi16 (simde__m128i a, simde__m128i b) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_maddubs_epi16(a, b);
#else
simde__m128i_private
r_,
a_ = simde__m128i_to_private(a),
b_ = simde__m128i_to_private(b);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
/* Zero extend a */
int16x8_t a_odd = vreinterpretq_s16_u16(vshrq_n_u16(a_.neon_u16, 8));
int16x8_t a_even = vreinterpretq_s16_u16(vbicq_u16(a_.neon_u16, vdupq_n_u16(0xff00)));
/* Sign extend by shifting left then shifting right. */
int16x8_t b_even = vshrq_n_s16(vshlq_n_s16(b_.neon_i16, 8), 8);
int16x8_t b_odd = vshrq_n_s16(b_.neon_i16, 8);
/* multiply */
int16x8_t prod1 = vmulq_s16(a_even, b_even);
int16x8_t prod2 = vmulq_s16(a_odd, b_odd);
/* saturated add */
r_.neon_i16 = vqaddq_s16(prod1, prod2);
#else
for (size_t i = 0 ; i < (sizeof(r_.i16) / sizeof(r_.i16[0])) ; i++) {
const int idx = HEDLEY_STATIC_CAST(int, i) << 1;
int32_t ts =
(HEDLEY_STATIC_CAST(int16_t, a_.u8[ idx ]) * HEDLEY_STATIC_CAST(int16_t, b_.i8[ idx ])) +
(HEDLEY_STATIC_CAST(int16_t, a_.u8[idx + 1]) * HEDLEY_STATIC_CAST(int16_t, b_.i8[idx + 1]));
r_.i16[i] = (ts > INT16_MIN) ? ((ts < INT16_MAX) ? HEDLEY_STATIC_CAST(int16_t, ts) : INT16_MAX) : INT16_MIN;
}
#endif
return simde__m128i_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_maddubs_epi16(a, b) simde_mm_maddubs_epi16(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_maddubs_pi16 (simde__m64 a, simde__m64 b) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_maddubs_pi16(a, b);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a),
b_ = simde__m64_to_private(b);
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
int16x8_t ai = vreinterpretq_s16_u16(vmovl_u8(a_.neon_u8));
int16x8_t bi = vmovl_s8(b_.neon_i8);
int16x8_t p = vmulq_s16(ai, bi);
int16x4_t l = vget_low_s16(p);
int16x4_t h = vget_high_s16(p);
r_.neon_i16 = vqadd_s16(vuzp1_s16(l, h), vuzp2_s16(l, h));
#else
for (size_t i = 0 ; i < (sizeof(r_.i16) / sizeof(r_.i16[0])) ; i++) {
const int idx = HEDLEY_STATIC_CAST(int, i) << 1;
int32_t ts =
(HEDLEY_STATIC_CAST(int16_t, a_.u8[ idx ]) * HEDLEY_STATIC_CAST(int16_t, b_.i8[ idx ])) +
(HEDLEY_STATIC_CAST(int16_t, a_.u8[idx + 1]) * HEDLEY_STATIC_CAST(int16_t, b_.i8[idx + 1]));
r_.i16[i] = (ts > INT16_MIN) ? ((ts < INT16_MAX) ? HEDLEY_STATIC_CAST(int16_t, ts) : INT16_MAX) : INT16_MIN;
}
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_maddubs_pi16(a, b) simde_mm_maddubs_pi16(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_mulhrs_epi16 (simde__m128i a, simde__m128i b) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_mulhrs_epi16(a, b);
#else
simde__m128i_private
r_,
a_ = simde__m128i_to_private(a),
b_ = simde__m128i_to_private(b);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
/* Multiply */
int32x4_t mul_lo = vmull_s16(vget_low_s16(a_.neon_i16),
vget_low_s16(b_.neon_i16));
int32x4_t mul_hi = vmull_s16(vget_high_s16(a_.neon_i16),
vget_high_s16(b_.neon_i16));
/* Rounding narrowing shift right
* narrow = (int16_t)((mul + 16384) >> 15); */
int16x4_t narrow_lo = vrshrn_n_s32(mul_lo, 15);
int16x4_t narrow_hi = vrshrn_n_s32(mul_hi, 15);
/* Join together */
r_.neon_i16 = vcombine_s16(narrow_lo, narrow_hi);
#elif defined(SIMDE_WASM_SIMD128_NATIVE)
v128_t __lo = wasm_i32x4_mul(wasm_i32x4_extend_low_i16x8(a_.wasm_v128), wasm_i32x4_extend_low_i16x8(b_.wasm_v128));
v128_t __hi = wasm_i32x4_mul(wasm_i32x4_extend_high_i16x8(a_.wasm_v128), wasm_i32x4_extend_high_i16x8(b_.wasm_v128));
const v128_t __inc = wasm_i32x4_splat(0x4000);
__lo = wasm_i32x4_add(__lo, __inc);
__hi = wasm_i32x4_add(__hi, __inc);
__lo = wasm_i32x4_add(__lo, __lo);
__hi = wasm_i32x4_add(__hi, __hi);
r_.wasm_v128 = wasm_i16x8_shuffle(__lo, __hi, 1, 3, 5, 7, 9, 11, 13, 15);
#else
SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.i16) / sizeof(r_.i16[0])) ; i++) {
r_.i16[i] = HEDLEY_STATIC_CAST(int16_t, (((HEDLEY_STATIC_CAST(int32_t, a_.i16[i]) * HEDLEY_STATIC_CAST(int32_t, b_.i16[i])) + 0x4000) >> 15));
}
#endif
return simde__m128i_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_mulhrs_epi16(a, b) simde_mm_mulhrs_epi16(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_mulhrs_pi16 (simde__m64 a, simde__m64 b) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_mulhrs_pi16(a, b);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a),
b_ = simde__m64_to_private(b);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
/* Multiply */
int32x4_t mul = vmull_s16(a_.neon_i16, b_.neon_i16);
/* Rounding narrowing shift right
* narrow = (int16_t)((mul + 16384) >> 15); */
int16x4_t narrow = vrshrn_n_s32(mul, 15);
/* Join together */
r_.neon_i16 = narrow;
#else
SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.i16) / sizeof(r_.i16[0])) ; i++) {
r_.i16[i] = HEDLEY_STATIC_CAST(int16_t, (((HEDLEY_STATIC_CAST(int32_t, a_.i16[i]) * HEDLEY_STATIC_CAST(int32_t, b_.i16[i])) + 0x4000) >> 15));
}
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_mulhrs_pi16(a, b) simde_mm_mulhrs_pi16(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_sign_epi8 (simde__m128i a, simde__m128i b) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_sign_epi8(a, b);
#else
simde__m128i_private
r_,
a_ = simde__m128i_to_private(a),
b_ = simde__m128i_to_private(b);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
uint8x16_t aneg_mask = vreinterpretq_u8_s8(vshrq_n_s8(b_.neon_i8, 7));
uint8x16_t bnz_mask;
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
bnz_mask = vceqzq_s8(b_.neon_i8);
#else
bnz_mask = vceqq_s8(b_.neon_i8, vdupq_n_s8(0));
#endif
bnz_mask = vmvnq_u8(bnz_mask);
r_.neon_i8 = vbslq_s8(aneg_mask, vnegq_s8(a_.neon_i8), vandq_s8(a_.neon_i8, vreinterpretq_s8_u8(bnz_mask)));
#elif defined(SIMDE_WASM_SIMD128_NATIVE)
simde__m128i mask = wasm_i8x16_shr(b_.wasm_v128, 7);
simde__m128i zeromask = simde_mm_cmpeq_epi8(b_.wasm_v128, simde_mm_setzero_si128());
r_.wasm_v128 = simde_mm_andnot_si128(zeromask, simde_mm_xor_si128(simde_mm_add_epi8(a_.wasm_v128, mask), mask));
#else
SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.i8) / sizeof(r_.i8[0])) ; i++) {
r_.i8[i] = (b_.i8[i] < 0) ? (- a_.i8[i]) : ((b_.i8[i] != 0) ? (a_.i8[i]) : INT8_C(0));
}
#endif
return simde__m128i_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_sign_epi8(a, b) simde_mm_sign_epi8(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_sign_epi16 (simde__m128i a, simde__m128i b) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_sign_epi16(a, b);
#else
simde__m128i_private
r_,
a_ = simde__m128i_to_private(a),
b_ = simde__m128i_to_private(b);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
uint16x8_t aneg_mask = vreinterpretq_u16_s16(vshrq_n_s16(b_.neon_i16, 15));
uint16x8_t bnz_mask;
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
bnz_mask = vceqzq_s16(b_.neon_i16);
#else
bnz_mask = vceqq_s16(b_.neon_i16, vdupq_n_s16(0));
#endif
bnz_mask = vmvnq_u16(bnz_mask);
r_.neon_i16 = vbslq_s16(aneg_mask, vnegq_s16(a_.neon_i16), vandq_s16(a_.neon_i16, vreinterpretq_s16_u16(bnz_mask)));
#elif defined(SIMDE_WASM_SIMD128_NATIVE)
simde__m128i mask = simde_mm_srai_epi16(b_.wasm_v128, 15);
simde__m128i zeromask = simde_mm_cmpeq_epi16(b_.wasm_v128, simde_mm_setzero_si128());
r_.wasm_v128 = simde_mm_andnot_si128(zeromask, simde_mm_xor_si128(simde_mm_add_epi16(a_.wasm_v128, mask), mask));
#else
SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.i16) / sizeof(r_.i16[0])) ; i++) {
r_.i16[i] = (b_.i16[i] < 0) ? (- a_.i16[i]) : ((b_.i16[i] != 0) ? (a_.i16[i]) : INT16_C(0));
}
#endif
return simde__m128i_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_sign_epi16(a, b) simde_mm_sign_epi16(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m128i
simde_mm_sign_epi32 (simde__m128i a, simde__m128i b) {
#if defined(SIMDE_X86_SSSE3_NATIVE)
return _mm_sign_epi32(a, b);
#else
simde__m128i_private
r_,
a_ = simde__m128i_to_private(a),
b_ = simde__m128i_to_private(b);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
uint32x4_t aneg_mask = vreinterpretq_u32_s32(vshrq_n_s32(b_.neon_i32, 31));
uint32x4_t bnz_mask;
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
bnz_mask = vceqzq_s32(b_.neon_i32);
#else
bnz_mask = vceqq_s32(b_.neon_i32, vdupq_n_s32(0));
#endif
bnz_mask = vmvnq_u32(bnz_mask);
r_.neon_i32 = vbslq_s32(aneg_mask, vnegq_s32(a_.neon_i32), vandq_s32(a_.neon_i32, vreinterpretq_s32_u32(bnz_mask)));
#elif defined(SIMDE_WASM_SIMD128_NATIVE)
simde__m128i mask = simde_mm_srai_epi32(b_.wasm_v128, 31);
simde__m128i zeromask = simde_mm_cmpeq_epi32(b_.wasm_v128, simde_mm_setzero_si128());
r_.wasm_v128 = simde_mm_andnot_si128(zeromask, simde_mm_xor_si128(simde_mm_add_epi32(a_.wasm_v128, mask), mask));
#else
for (size_t i = 0 ; i < (sizeof(r_.i32) / sizeof(r_.i32[0])) ; i++) {
r_.i32[i] = (b_.i32[i] < 0) ? (- a_.i32[i]) : ((b_.i32[i] != 0) ? (a_.i32[i]) : INT32_C(0));
}
#endif
return simde__m128i_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_sign_epi32(a, b) simde_mm_sign_epi32(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_sign_pi8 (simde__m64 a, simde__m64 b) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_sign_pi8(a, b);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a),
b_ = simde__m64_to_private(b);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
uint8x8_t aneg_mask = vreinterpret_u8_s8(vshr_n_s8(b_.neon_i8, 7));
uint8x8_t bnz_mask;
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
bnz_mask = vceqz_s8(b_.neon_i8);
#else
bnz_mask = vceq_s8(b_.neon_i8, vdup_n_s8(0));
#endif
bnz_mask = vmvn_u8(bnz_mask);
r_.neon_i8 = vbsl_s8(aneg_mask, vneg_s8(a_.neon_i8), vand_s8(a_.neon_i8, vreinterpret_s8_u8(bnz_mask)));
#else
SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.i8) / sizeof(r_.i8[0])) ; i++) {
r_.i8[i] = (b_.i8[i] < 0) ? (- a_.i8[i]) : ((b_.i8[i] != 0) ? (a_.i8[i]) : INT8_C(0));
}
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_sign_pi8(a, b) simde_mm_sign_pi8(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_sign_pi16 (simde__m64 a, simde__m64 b) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_sign_pi16(a, b);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a),
b_ = simde__m64_to_private(b);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
uint16x4_t aneg_mask = vreinterpret_u16_s16(vshr_n_s16(b_.neon_i16, 15));
uint16x4_t bnz_mask;
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
bnz_mask = vceqz_s16(b_.neon_i16);
#else
bnz_mask = vceq_s16(b_.neon_i16, vdup_n_s16(0));
#endif
bnz_mask = vmvn_u16(bnz_mask);
r_.neon_i16 = vbsl_s16(aneg_mask, vneg_s16(a_.neon_i16), vand_s16(a_.neon_i16, vreinterpret_s16_u16(bnz_mask)));
#else
SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.i16) / sizeof(r_.i16[0])) ; i++) {
r_.i16[i] = (b_.i16[i] < 0) ? (- a_.i16[i]) : ((b_.i16[i] > 0) ? (a_.i16[i]) : INT16_C(0));
}
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_sign_pi16(a, b) simde_mm_sign_pi16(a, b)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde__m64
simde_mm_sign_pi32 (simde__m64 a, simde__m64 b) {
#if defined(SIMDE_X86_SSSE3_NATIVE) && defined(SIMDE_X86_MMX_NATIVE)
return _mm_sign_pi32(a, b);
#else
simde__m64_private
r_,
a_ = simde__m64_to_private(a),
b_ = simde__m64_to_private(b);
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
uint32x2_t aneg_mask = vreinterpret_u32_s32(vshr_n_s32(b_.neon_i32, 31));
uint32x2_t bnz_mask;
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
bnz_mask = vceqz_s32(b_.neon_i32);
#else
bnz_mask = vceq_s32(b_.neon_i32, vdup_n_s32(0));
#endif
bnz_mask = vmvn_u32(bnz_mask);
r_.neon_i32 = vbsl_s32(aneg_mask, vneg_s32(a_.neon_i32), vand_s32(a_.neon_i32, vreinterpret_s32_u32(bnz_mask)));
#else
for (size_t i = 0 ; i < (sizeof(r_.i32) / sizeof(r_.i32[0])) ; i++) {
r_.i32[i] = (b_.i32[i] < 0) ? (- a_.i32[i]) : ((b_.i32[i] > 0) ? (a_.i32[i]) : INT32_C(0));
}
#endif
return simde__m64_from_private(r_);
#endif
}
#if defined(SIMDE_X86_SSSE3_ENABLE_NATIVE_ALIASES)
# define _mm_sign_pi32(a, b) simde_mm_sign_pi32(a, b)
#endif
SIMDE_END_DECLS_
HEDLEY_DIAGNOSTIC_POP
#endif /* !defined(SIMDE_X86_SSE2_H) */
|
b79d9a343d9b16cd7cea23edc8e0fde53a0c78c7
|
1231379e557a3094413045721b4c65ce9bae568b
|
/src/generated/linux/selfsign_openssl.c.clog.h.lttng.h
|
8f0fee77e6165e4cd829c78ac7d0a99aa813b05f
|
[
"MIT"
] |
permissive
|
microsoft/msquic
|
a63982f1b7d017fb0497e2dce56f1ef527bd6eaa
|
f91ccc2f975225a278bc68238555ed0923e676ba
|
refs/heads/main
| 2023-09-04T01:25:39.133074
| 2023-08-28T18:04:51
| 2023-08-28T18:04:51
| 217,654,199
| 3,641
| 521
|
MIT
| 2023-09-14T14:36:09
| 2019-10-26T04:10:24
|
C
|
UTF-8
|
C
| false
| false
| 492
|
h
|
selfsign_openssl.c.clog.h.lttng.h
|
/*----------------------------------------------------------
// Decoder Ring for LibraryError
// [ lib] ERROR, %s.
// QuicTraceEvent(
LibraryError,
"[ lib] ERROR, %s.",
"EVP_PKEY_new failed");
// arg2 = arg2 = "EVP_PKEY_new failed" = arg2
----------------------------------------------------------*/
TRACEPOINT_EVENT(CLOG_SELFSIGN_OPENSSL_C, LibraryError,
TP_ARGS(
const char *, arg2),
TP_FIELDS(
ctf_string(arg2, arg2)
)
)
|
4a71cbc490e13f64478588a50dc9af95d148200d
|
0744dcc5394cebf57ebcba343747af6871b67017
|
/os/board/rtl8720e/src/component/soc/amebalite/fwlib/ram_common/ameba_comparator.c
|
b1083af9ac40d7dc2844cf1c2ab8be3ac8d8cce0
|
[
"GPL-1.0-or-later",
"BSD-3-Clause",
"ISC",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-permissive",
"Apache-2.0"
] |
permissive
|
Samsung/TizenRT
|
96abf62f1853f61fcf91ff14671a5e0c6ca48fdb
|
1a5c2e00a4b1bbf4c505bbf5cc6a8259e926f686
|
refs/heads/master
| 2023-08-31T08:59:33.327998
| 2023-08-08T06:09:20
| 2023-08-31T04:38:20
| 82,517,252
| 590
| 719
|
Apache-2.0
| 2023-09-14T06:54:49
| 2017-02-20T04:38:30
|
C
|
UTF-8
|
C
| false
| false
| 15,523
|
c
|
ameba_comparator.c
|
/**
******************************************************************************
* @file ameba_comparator.c
* @author
* @version V1.0.0
* @date 2016-05-17
* @brief This file provides firmware functions to manage the following
* functionalities of the Comparator peripheral:
* - Initialization and Configuration
* - Analog configuration
* - Mode configuration
* - Interrupts and flags management
*
******************************************************************************
* @attention
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*
* Copyright(c) 2016, Realtek Semiconductor Corporation. All rights reserved.
******************************************************************************
*/
#include "ameba_soc.h"
/**
* @brief Initializes the parameters in the CMP_InitStruct with default value.
* @param CMP_InitStruct: pointer to a CMP_InitTypeDef structure that contains
* the configuration information for the Comparator peripheral.
* @retval None
*/
void CMP_StructInit(CMP_InitTypeDef *CMP_InitStruct)
{
u8 i;
for (i = 0; i < COMP_CH_NUM; i++) {
CMP_InitStruct->CMP_ChanCtrl[i].CMP_ChIndex = i;
CMP_InitStruct->CMP_ChanCtrl[i].CMP_Ref0 = 0; // Vref0 = 0.1*0=0v
CMP_InitStruct->CMP_ChanCtrl[i].CMP_Ref1 = 0x1F; // Vref1 = 0.1*31=3.1v
CMP_InitStruct->CMP_ChanCtrl[i].CMP_WakeType = COMP_WK_NONE;
CMP_InitStruct->CMP_ChanCtrl[i].CMP_WakeSysCtrl = COMP_WITHIN_REF0_AND_REF1;
CMP_InitStruct->CMP_ChanCtrl[i].CMP_WakeADCCtrl = COMP_WITHIN_REF0_AND_REF1;
}
}
/**
* @brief Initializes the Comparator according to the specified parameters in CMP_InitStruct.
* @param CMP_InitStruct: pointer to a CMP_InitTypeDef structure that contains
* the configuration for the Comparator peripheral.
* @retval None
*/
void CMP_Init(CMP_InitTypeDef *CMP_InitStruct)
{
u8 i, index;
u32 tmp, val_ch = 0;
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
CMP_CHTypeDef *compChan = CMP_InitStruct->CMP_ChanCtrl;
CMP_Cmd(DISABLE);
tmp = comparator->COMP_INTR_CTRL;
for (i = 0; i < COMP_CH_NUM; i++) {
index = compChan[i].CMP_ChIndex;
val_ch |= (u32)(index << COMP_SHIFT_CHSW(i));
comparator->COMP_REF_CHx[index] = (u32)(COMP_REF0_CHx(compChan[i].CMP_Ref0) | COMP_REF1_CHx(compChan[i].CMP_Ref1));
if (compChan[i].CMP_WakeType & COMP_WK_ADC) {
tmp &= ~ COMP_MASK_WK_ADC_CTRL(index);
tmp |= (compChan[i].CMP_WakeADCCtrl << COMP_SHIFT_WK_ADC_CTRL(index)) | \
COMP_WK_ADC_EN(index);
}
if (compChan[i].CMP_WakeType & COMP_WK_SYS) {
tmp &= ~ COMP_MASK_WK_SYS_CTRL(index);
tmp |= (compChan[i].CMP_WakeSysCtrl << COMP_SHIFT_WK_SYS_CTRL(index)) | \
COMP_WK_SYS_EN(index);
}
}
comparator->COMP_INTR_CTRL = tmp;
comparator->COMP_CHSW_LIST = val_ch;
comparator->COMP_LPSD |= COMP_BIT_LPSD_1;
comparator->COMP_AUTO_SHUT = COMP_BIT_AUTO_SHUT;
}
/**
* @brief Enable or Disable the Comparator peripheral.
* @param NewState: new state of the Comparator peripheral.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void CMP_Cmd(u32 NewState)
{
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
if (NewState != DISABLE) {
comparator->COMP_EN_TRIG |= COMP_BIT_ENABLE;
} else {
comparator->COMP_EN_TRIG &= ~COMP_BIT_ENABLE;
}
}
/**
* @brief Indicate the Comparator is busy or not .
* @param None
* @retval busy status value:
* - 1: Busy
* - 0: Not Busy.
*/
u32 CMP_Busy(void)
{
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
if (comparator->COMP_BUSY_STS & COMP_BIT_BUSY_STS) {
return 1;
} else {
return 0;
}
}
/**
* @brief ENABLE/DISABLE the comparator's interrupt bits.
* @param Cmp_IT: specifies the interrupt bits to be configured.
* This parameter can be one or combinations of the following values:
* @arg COMP_IT_CTN_VS: Rising edge interrupt of hysteresis cmp result at continuous mode.
* @arg COMP_IT_CTN_VH: Rising edge interrupt of vref1 cmp result at continuous mode.
* @arg COMP_IT_CTN_VL: Rising edge interrupt of vref0 cmp result at continuous mode.
* @param NewState: ENABLE or DISABLE
* @note None
* @retval None
*/
void CMP_INTConfig(u32 Cmp_IT, u32 NewState)
{
/* Check the parameters */
assert_param(IS_COMP_IT(Cmp_IT));
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
if (NewState != DISABLE) {
/* Enable the Interrupt sources */
comparator->COMP_INTR_CTRL |= COMP_IT_CONFIG(Cmp_IT);
} else {
/* Disable the Interrupt sources */
comparator->COMP_INTR_CTRL &= ~COMP_IT_CONFIG(Cmp_IT);
}
}
/**
* @brief Get value of Comparator Wakeup ADC/SYS Status Register .
* @param None
* @retval Current Comparator Wakeup ADC/SYS and cmp result's rising edge interrupt status
*/
u32 CMP_GetISR(void)
{
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
return comparator->COMP_WK_STS;
}
/**
* @brief Clear pending bit in Comparator Wakeup ADC/SYS Status Register.
* @param Cmp_IT: specifies the interrupt bits to be cleared.
* This parameter can be one or combinations of the following values:
* @arg COMP_IT_CTN_VS: Rising edge interrupt of hysteresis cmp result at continuous mode.
* @arg COMP_IT_CTN_VH: Rising edge interrupt of vref1 cmp result at continuous mode.
* @arg COMP_IT_CTN_VL: Rising edge interrupt of vref0 cmp result at continuous mode.
* @arg COMP_WK_SYS_EN(3): Channel3 wakeup system
* @arg COMP_WK_SYS_EN(2): Channel2 wakeup system
* @arg COMP_WK_SYS_EN(1): Channel1 wakeup system
* @arg COMP_WK_SYS_EN(0): Channel0 wakeup system
* @arg COMP_WK_ADC_EN(3): Channel3 wakeup ADC
* @arg COMP_WK_ADC_EN(2): Channel2 wakeup ADC
* @arg COMP_WK_ADC_EN(1): Channel1 wakeup ADC
* @arg COMP_WK_ADC_EN(0): Channel0 wakeup ADC
* @retval None
*/
void CMP_INTClearPendingBit(u32 Cmp_IT)
{
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
comparator->COMP_WK_STS = Cmp_IT;
}
/**
* @brief Get the comparison result .
* @param channel : the Comparator channel index
* @retval The comparison result of specified channel index. The return value can be:
* -0: when Vin < Vref0
* -2: when Vin > Vref0 & Vin < Vref1
* -3: when Vin > Vref1
*/
u32 CMP_GetCompStatus(u8 channel)
{
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
u32 value = (comparator->COMP_CH_STS & COMP_MASK_CH_STS(channel)) >> \
COMP_SHIFT_CH_STS(channel);
return value;
}
/**
* @brief Get the channel list index of the last used channel.
* @param None.
* @retval The channel list index of the last used channel. Not channel ID.
*/
u32 CMP_GetLastChan(void)
{
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
return comparator->COMP_LAST_CH;
}
/**
* @brief Reset the channel switch to default state.
* @param None
* @retval None
*/
void CMP_ResetCSwList(void)
{
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
comparator->COMP_RST_LIST = COMP_BIT_RST_LIST;
comparator->COMP_RST_LIST = 0;
}
/**
* @brief Enable or disable automatic shut after the analog conversion is done.
* @param NewState: can be one of the following value:
* @arg ENABLE: The analog module and mux will be disabled automatically after the analog conversion is done.
* @arg DISABLE: The analog module and mux will not be disabled.
* @retval None.
*/
void CMP_AutoShutCmd(u32 NewState)
{
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
if (NewState != DISABLE) {
comparator->COMP_AUTO_SHUT |= COMP_BIT_AUTO_SHUT;
} else {
comparator->COMP_AUTO_SHUT &= ~COMP_BIT_AUTO_SHUT;
}
}
/**
* @brief Controls the automatic channel swtich enabled or disabled in Comparator Automatic Mode.
* @param NewState: can be one of the following value:
* @arg ENABLE: Enable the automatic channel switch.
* When setting this bit, an automatic channel switch starts from the first channel in the channel switch list.
* @arg DISABLE: Disable the automatic channel switch.
* If an automatic channel switch is in progess, writing 0 will terminate the automatic channel switch.
* @retval None.
*/
void CMP_AutoCSwCmd(u32 NewState)
{
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
if (NewState != DISABLE) {
comparator->COMP_AUTOSW_EN = COMP_BIT_AUTOSW_EN;
comparator->COMP_EN_TRIG |= COMP_BIT_EN_TRIG;
} else {
comparator->COMP_AUTOSW_EN = 0;
comparator->COMP_EN_TRIG &= ~COMP_BIT_EN_TRIG;
}
}
/**
* @brief Enabled or disabled software-trigger channel switch in Comparator Software-Trigger Mode.
* @param NewState: can be one of the following value:
* @arg ENABLE: Enable the software-trigger channel switch.
* When setting this bit, do one channel switch in the channel switch list.
* @arg DISABLE: Disable the software-trigger channel switch.
* @retval None.
*/
void CMP_SwTrigCmd(u32 NewState)
{
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
if (NewState != DISABLE) {
comparator->COMP_EN_TRIG |= COMP_BIT_EN_TRIG;
} else {
comparator->COMP_EN_TRIG &= ~COMP_BIT_EN_TRIG;
}
}
/**
* @brief Initialize the trigger timer when in Comparator Timer-Trigger Mode.
* @param Tim_Idx: The timer index would be used to make the Comparator module do a comparison.
* @param PeriodMs: Indicate the period of trigger timer.
* @param NewState: can be one of the following value:
* @arg ENABLE: Enable the Comparator timer trigger mode.
* @arg DISABLE: Disable the Comparator timer trigger mode.
* @retval None.
* @note Used in Comparator Timer-Trigger Mode
*/
void CMP_TimerTrigCmd(u8 Tim_Idx, u32 PeriodMs, u32 NewState)
{
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
RTIM_TimeBaseInitTypeDef TIM_InitStruct;
comparator->COMP_EXT_TRIG_TIMER_SEL = Tim_Idx;
if (NewState != DISABLE) {
RTIM_TimeBaseStructInit(&TIM_InitStruct);
TIM_InitStruct.TIM_Idx = Tim_Idx;
TIM_InitStruct.TIM_Period = (PeriodMs * 32768) / 1000 / 2; //ms to tick
RTIM_TimeBaseInit(TIMx[Tim_Idx], &TIM_InitStruct, TIMx_irq[Tim_Idx], (IRQ_FUN)NULL, (u32)NULL);
RTIM_Cmd(TIMx[Tim_Idx], ENABLE);
comparator->COMP_EXT_TRIG_CTRL = COMP_BIT_EXT_WK_TIMER;
} else {
RTIM_Cmd(TIMx[Tim_Idx], DISABLE);
comparator->COMP_EXT_TRIG_CTRL = 0;
}
}
/**
* @brief Enable or disable continuous sample function in autoswitch mode.
* @param NewState: can be one of the following value:
* @arg ENABLE: Enable continuous sample function.
* @arg DISABLE: Disable continuous sample function.
* @note Continuous sample function can only take effect in autoswitch mode with autoshut disabled meanwhile.
* @retval None.
*/
void CMP_ContinousCmd(u32 NewState)
{
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
if (NewState != DISABLE) {
comparator->COMP_CONTINUOUS_CTRL_0 |= COMP_BIT_CONTINUOUS_EN;
} else {
comparator->COMP_CONTINUOUS_CTRL_0 &= ~COMP_BIT_CONTINUOUS_EN;
}
}
/**
* @brief Enable or disable hysteresis circuit function in continuous function.
* @param NewState: can be one of the following value:
* @arg ENABLE: Enable hysteresis circuit function.
* @arg DISABLE: Disable hysteresis circuit function.
* @note Hysteresis circuit function can only take effect in continuous function.
* @retval None.
*/
void CMP_HystCmd(u32 NewState)
{
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
u32 reg_chsw = comparator->COMP_CHSW_LIST;
if (NewState != DISABLE) {
/* check whether in continuous mode */
assert_param(comparator->COMP_CONTINUOUS_CTRL_0 & COMP_BIT_CONTINUOUS_EN);
assert_param(comparator->COMP_AUTOSW_EN & COMP_BIT_AUTOSW_EN);
assert_param((comparator->COMP_AUTO_SHUT & COMP_BIT_AUTO_SHUT) == 0);
assert_param(COMP_GET_CHSW_0(reg_chsw) == COMP_GET_CHSW_1(reg_chsw));
assert_param(COMP_GET_CHSW_1(reg_chsw) == COMP_GET_CHSW_2(reg_chsw));
assert_param(COMP_GET_CHSW_2(reg_chsw) == COMP_GET_CHSW_3(reg_chsw));
comparator->COMP_CONTINUOUS_CTRL_0 |= COMP_BIT_HYST_EN;
} else {
comparator->COMP_CONTINUOUS_CTRL_0 &= ~COMP_BIT_HYST_EN;
}
}
/**
* @brief Select specified comparison result as ZCD output.
* @param Src_Type: Comparison result type.
* This parameter can be one of the following values:
* @arg COMP_ZCD_SRC_NONE: None.
* @arg COMP_ZCD_SRC_VHOUT: ZCD out is from high level Vref1 cmp.
* @arg COMP_ZCD_SRC_VLOUT: ZCD out is from low level Vref0 cmp.
* @arg COMP_ZCD_SRC_VSOUT: ZCD out is from Hysteresis cmp.
* @note Make sure hysteresis function is enabled when select COMP_ZCD_SRC_VSOUT.
* @retval None.
*/
void CMP_SetZcdSrc(u32 Src_Type)
{
/* Check the parameters */
assert_param(IS_COMP_ZCD_SRC_TYPE(Src_Type));
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
u32 temp = comparator->COMP_CONTINUOUS_CTRL_0;
temp &= ~ COMP_MASK_ZCD_SEL;
temp |= COMP_ZCD_SEL(Src_Type);
comparator->COMP_CONTINUOUS_CTRL_0 = temp;
}
/**
* @brief Set debounce counter for comparison output of different types.
* @param Dbc_Type: Indicate the comparison type.
* This parameter can be one of the following values:
* @arg COMP_DBC_VS: Debounce result of hysteresis cmp.
* @arg COMP_DBC_VH: Debounce result of high level Vref1 cmp.
* @arg COMP_DBC_VL: Debounce result of lov level Vref0 cmp.
* @param Dbc_Cnt: Debounce counter to be set.
* @note Dbc_Cnt = 0 means debounce function is disabled.
* @retval None.
*/
void CMP_SetDbcCnt(u8 Dbc_Type, u32 Dbc_Cnt)
{
/* Check the parameters */
assert_param(IS_COMP_DBC_TYPE(Dbc_Type));
CMP_TypeDef *comparator = CMP_DEV;
if (TrustZone_IsSecure()) {
comparator = CMP_DEV_S;
}
/* Set debounce counter for Hysterisis comparison result S_out */
if (COMP_DBC_VS == Dbc_Type) {
/* Check the parameters */
assert_param(IS_COMP_VS_BC_CNT(Dbc_Cnt));
u32 temp = comparator->COMP_CONTINUOUS_CTRL_0;
temp &= ~ COMP_MASK_VS_DBC_CNT;
temp |= COMP_VS_DBC_CNT(Dbc_Cnt);
comparator->COMP_CONTINUOUS_CTRL_0 = temp;
/* Set debounce counter for Vref1 comparison result H_out */
} else if (COMP_DBC_VH == Dbc_Type) {
/* Check the parameters */
assert_param(IS_COMP_VH_BC_CNT(Dbc_Cnt));
u32 temp = comparator->COMP_CONTINUOUS_CTRL_1;
temp &= ~ COMP_MASK_VH_DBC_CNT;
temp |= COMP_VH_DBC_CNT(Dbc_Cnt);
comparator->COMP_CONTINUOUS_CTRL_1 = temp;
/* Set debounce counter for Vref0 comparison result L_out */
} else if (COMP_DBC_VL == Dbc_Type) {
/* Check the parameters */
assert_param(IS_COMP_VL_BC_CNT(Dbc_Cnt));
u32 temp = comparator->COMP_CONTINUOUS_CTRL_1;
temp &= ~ COMP_MASK_VL_DBC_CNT;
temp |= COMP_VL_DBC_CNT(Dbc_Cnt);
comparator->COMP_CONTINUOUS_CTRL_1 = temp;
}
}
/******************* (C) COPYRIGHT 2016 Realtek Semiconductor *****END OF FILE****/
|
dca5aedd6b892b824a7268591e292a574906df47
|
a97894ae5ecd1a31a137349dc4155130c58d4947
|
/MIP/third-party/substitute/lib/arm64/jump-patch.h
|
fe36d1406462621f6cb6b25dc8efca4211a2d9f5
|
[
"LicenseRef-scancode-other-copyleft",
"LGPL-2.1-only",
"LGPL-3.0-only",
"LicenseRef-scancode-public-domain",
"GPL-3.0-only",
"LGPL-2.1-or-later",
"MIT"
] |
permissive
|
LIJI32/MIP
|
a8cf1d2cce0ca9a5e2478445ced3610423f76970
|
526e8467665850effd847fb4cd02fdbc934b179f
|
refs/heads/master
| 2022-10-24T13:32:42.502028
| 2022-10-15T15:14:54
| 2022-10-15T15:14:54
| 84,120,291
| 171
| 24
|
MIT
| 2022-10-22T12:36:26
| 2017-03-06T21:00:09
|
C
|
UTF-8
|
C
| false
| false
| 952
|
h
|
jump-patch.h
|
#pragma once
#include "arm64/assemble.h"
#define MAX_JUMP_PATCH_SIZE 20
#define MAX_EXTENDED_PATCH_SIZE MAX_JUMP_PATCH_SIZE
static inline int jump_patch_size(uint_tptr pc, uint_tptr dpc,
UNUSED struct arch_dis_ctx arch,
bool force) {
intptr_t diff = (dpc & ~0xfff) - (pc & ~0xfff);
if (!(diff >= -0x100000000 && diff < 0x100000000))
return force ? (size_of_MOVi64(dpc) + 4) : -1;
else if (!(dpc & 0xfff))
return 8;
else
return 12;
}
static inline void make_jump_patch(void **codep, uint_tptr pc, uint_tptr dpc,
struct arch_dis_ctx arch) {
int reg = arm64_get_unwritten_temp_reg(&arch);
intptr_t diff = (dpc & ~0xfff) - (pc & ~0xfff);
if (!(diff >= -0x100000000 && diff < 0x100000000))
MOVi64(codep, reg, dpc);
else
ADRP_ADD(codep, reg, pc, dpc);
BR(codep, reg, false);
}
|
962934179c147aa7e57a021398d2fb4e53861616
|
b0d917e5f5df080c9377a93045ffcda553319ae9
|
/src/lmic/lmic_compliance.c
|
8d767b26056dd51d24aa8b28d0df1719655378ae
|
[
"MIT"
] |
permissive
|
mcci-catena/arduino-lmic
|
d46943bba58776d197c605eaa8771a32b5487657
|
4ceb2b049b59bb2390491f2db63e4951b986d277
|
refs/heads/master
| 2023-08-17T15:20:22.246976
| 2022-11-21T06:21:10
| 2022-11-21T06:21:10
| 67,839,795
| 610
| 247
|
MIT
| 2023-08-09T02:54:25
| 2016-09-09T23:49:49
|
C
|
UTF-8
|
C
| false
| false
| 22,230
|
c
|
lmic_compliance.c
|
/*
Module: lmic_compliance.c
Function:
Implementation of the compliance engine.
Copyright notice and license info:
See LICENSE file accompanying this project.
Author:
Terry Moore, MCCI Corporation March 2019
Description:
See function descriptions.
*/
#include "lmic.h"
#include "lmic_compliance.h"
#include "lorawan_spec_compliance.h"
#include <stdbool.h>
#include <string.h>
#if defined(LMIC_PRINTF_TO)
# include <stdio.h>
# define LMIC_COMPLIANCE_PRINTF(f, ...) printf(f, ## __VA_ARGS__)
#else
# define LMIC_COMPLIANCE_PRINTF(f, ...) do { ; } while (0)
#endif
/****************************************************************************\
|
| Manifest constants and local declarations.
|
\****************************************************************************/
static void acEnterActiveMode(void);
static void acExitActiveMode(void);
static void acSendUplink(void);
static void acSetTimer(ostime_t);
static void acSendUplinkBuffer(void);
static void evActivate(void);
static void evDeactivate(void);
static void evJoinCommand(void);
static void evMessage(const uint8_t *pMessage, size_t nMessage);
static lmic_compliance_fsmstate_t fsmDispatch(lmic_compliance_fsmstate_t, bool);
static void fsmEval(void);
static void fsmEvalDeferred(void);
static osjobcbfn_t fsmJobCb;
static bool isActivateMessage(const uint8_t *pMessage, size_t nMessage);
static void evEchoCommand(const uint8_t *pMessage, size_t nMessage);
static lmic_event_cb_t lmicEventCb;
static lmic_txmessage_cb_t sendUplinkCompleteCb;
static osjobcbfn_t timerExpiredCb;
/* these are declared global so the optimizer can chuck them without warnings */
const char *LMICcompliance_txSuccessToString(int fSuccess);
const char * LMICcompliance_fsmstate_getName(lmic_compliance_fsmstate_t state);
/****************************************************************************\
|
| Read-only data.
|
\****************************************************************************/
/****************************************************************************\
|
| Variables.
|
\****************************************************************************/
lmic_compliance_t LMIC_Compliance;
/*
Name: LMIC_complianceRxMessage()
Function:
Add compliance-awareness to LMIC applications by filtering messages.
Definition:
lmic_compliance_rx_action_t LMIC_complianceRxMessage(
u1_t port,
const u1_t *pMessage,
size_t nMessage
);
Description:
Clients who want to handle the LoRaWAN compliance protocol on
port 224 should call this routine each time a downlink message is
received. This function will update the internal compliance state,
and return an appropriate action to the user.
If the result is `LMIC_COMPLIANCE_RX_ACTION_PROCESS`, then the client should
process the message as usual. Otherwise, the client should discard the
message. The other values further allow the client to track entry into,
and exit from, compliance state. `LMIC_COMPLIANCE_RX_ACTION_START` signals
entry into compliance state; `LMIC_COMPLIANCE_RX_ACTION_END` signals exit
from compliance state; and `LMIC_COMPLIANCE_RX_ACTION_IGNORE` indicates
a mesage that should be discarded while already in compliance
state.
Returns:
See description.
*/
lmic_compliance_rx_action_t
LMIC_complianceRxMessage(
uint8_t port,
const uint8_t *pMessage,
size_t nMessage
) {
lmic_compliance_state_t const complianceState = LMIC_Compliance.state;
// update the counter used by the status message.
++LMIC_Compliance.downlinkCount;
// filter normal messages.
if (port != LORAWAN_PORT_COMPLIANCE) {
return lmic_compliance_state_IsActive(complianceState)
? LMIC_COMPLIANCE_RX_ACTION_PROCESS
: LMIC_COMPLIANCE_RX_ACTION_IGNORE
;
}
// it's a message to port 224.
// if we're not active, ignore everything but activation messages
if (! lmic_compliance_state_IsActive(complianceState)) {
if (isActivateMessage(pMessage, nMessage)) {
evActivate();
} // else ignore.
} else {
evMessage(pMessage, nMessage);
}
if (lmic_compliance_state_IsActive(complianceState) == lmic_compliance_state_IsActive(LMIC_Compliance.state))
return LMIC_COMPLIANCE_RX_ACTION_IGNORE;
else if (! lmic_compliance_state_IsActive(complianceState))
return LMIC_COMPLIANCE_RX_ACTION_START;
else
return LMIC_COMPLIANCE_RX_ACTION_END;
}
/*
Name: isActivateMessage()
Function:
See whether a message is a LoRaWAN activate test mode message.
Definition:
static bool isActivateMessage(
const uint8_t *pMessage,
size_t nMessage
);
Description:
The message body is compared to an activate message (per the
LoRa Alliance End Device Certification spec).
Returns:
The result is `true` if the message is an activation message;
it's `false` otherwise.
*/
static bool
isActivateMessage(
const uint8_t *pMessage,
size_t nMessage
) {
const uint8_t body[LORAWAN_COMPLIANCE_CMD_ACTIVATE_LEN] = {
LORAWAN_COMPLIANCE_CMD_ACTIVATE,
LORAWAN_COMPLIANCE_CMD_ACTIVATE_MAGIC,
LORAWAN_COMPLIANCE_CMD_ACTIVATE_MAGIC,
LORAWAN_COMPLIANCE_CMD_ACTIVATE_MAGIC,
};
if (nMessage != sizeof(body))
return false;
if (memcmp(pMessage, body, sizeof(body)) == 0)
return true;
else
return false;
}
/*
Name: evActivate()
Function:
Report an activation event to the finite state machine.
Definition:
void evActivate(void);
Description:
We report an activation event, and re-evaluate the FSM.
Returns:
No explicit result.
*/
static void evActivate(void) {
if (! lmic_compliance_state_IsActive(LMIC_Compliance.state)) {
LMIC_Compliance.downlinkCount = 0;
LMIC_Compliance.eventflags |= LMIC_COMPLIANCE_EVENT_ACTIVATE;
LMIC_Compliance.state = LMIC_COMPLIANCE_STATE_ACTIVATING;
LMIC_Compliance.saveEvent.pEventCb = LMIC.client.eventCb;
LMIC_Compliance.saveEvent.pUserData = LMIC.client.eventUserData;
#if CFG_LMIC_EU_like
band_t *b = LMIC.bands;
lmic_compliance_band_t *b_save = LMIC_Compliance.saveBands;
for (; b < &LMIC.bands[MAX_BANDS]; ++b, ++b_save) {
b_save->txcap = b->txcap;
b->txcap = 1;
b->avail = os_getTime();
}
#endif // CFG_LMIC_EU_like
LMIC_registerEventCb(lmicEventCb, NULL);
fsmEvalDeferred();
} else {
LMIC_COMPLIANCE_PRINTF("Redundant ActivateTM message ignored.\n");
}
}
/*
Name: evMessage()
Function:
Process an inbound message while active.
Definition:
void evMessage(const uint8_t *pMessage, size_t nMessage);
Description:
The event is parsed, and the appropriate event(s) are sent into
the finite state machine. Note that because of the way the LMIC
works, we can assume that no uplink event is pending; so it's safe
to launch a send from here.
Returns:
No explicit result.
*/
static void evMessage(
const uint8_t *pMessage,
size_t nMessage
) {
if (nMessage == 0)
return;
const uint8_t cmd = pMessage[0];
switch (cmd) {
case LORAWAN_COMPLIANCE_CMD_DEACTIVATE: {
evDeactivate();
break;
}
case LORAWAN_COMPLIANCE_CMD_ACTIVATE: {
if (isActivateMessage(pMessage, nMessage))
evActivate();
break;
}
case LORAWAN_COMPLIANCE_CMD_SET_CONFIRM: {
LMIC_Compliance.fsmFlags |= LMIC_COMPLIANCE_FSM_CONFIRM;
break;
}
case LORAWAN_COMPLIANCE_CMD_SET_UNCONFIRM: {
LMIC_Compliance.fsmFlags &= ~LMIC_COMPLIANCE_FSM_CONFIRM;
break;
}
case LORAWAN_COMPLIANCE_CMD_ECHO: {
evEchoCommand(pMessage, nMessage);
break;
}
case LORAWAN_COMPLIANCE_CMD_LINK: {
// we are required to initiate a Link
break;
}
case LORAWAN_COMPLIANCE_CMD_JOIN: {
evJoinCommand();
break;
}
default:
break;
}
}
/*
Name: evDeactivate()
Function:
Report an deactivation event to the finite state machine.
Definition:
void evDectivate(void);
Description:
We report a deactivation event, and re-evaluate the FSM.
We also set a flag so that we're return the appropriate
status from the compliance entry point to the real
application.
Returns:
No explicit result.
*/
static void evDeactivate(void) {
LMIC_Compliance.eventflags |= LMIC_COMPLIANCE_EVENT_DEACTIVATE;
LMIC_Compliance.state = LMIC_COMPLIANCE_STATE_STOPPING;
// restore user's event handler.
LMIC_registerEventCb(LMIC_Compliance.saveEvent.pEventCb, LMIC_Compliance.saveEvent.pUserData);
// restore band settings
#if CFG_LMIC_EU_like
band_t *b = LMIC.bands;
lmic_compliance_band_t const *b_save = LMIC_Compliance.saveBands;
for (; b < &LMIC.bands[MAX_BANDS]; ++b, ++b_save) {
b->txcap = b_save->txcap;
}
#endif // CFG_LMIC_EU_like
fsmEvalDeferred();
}
/*
Name: evJoinCommand()
Function:
Report that a join has been commanded.
Definition:
void evJoinCommand(void);
Description:
We unjoin from the network, and then report a deactivation
of test mode. That will get us out of test mode and back
to the compliance app. The next message send will trigger
a join.
Returns:
No explicit result.
*/
static void evJoinCommand(
void
) {
LMIC_unjoin();
evDeactivate();
}
/*
Name: evEchoCommand()
Function:
Format and transmit the response to an echo downlink (aka echo request).
Definition:
void evEchoCommand(
const uint8_t *pMessage,
size_t nMessage
);
Description:
The echo response is formatted and transmitted. Since we just received
a downlink, it's always safe to do this.
Returns:
No explicit result.
*/
static void evEchoCommand(
const uint8_t *pMessage,
size_t nMessage
) {
uint8_t *pResponse;
if (nMessage > sizeof(LMIC_Compliance.uplinkMessage))
return;
// create the echo message.
pResponse = LMIC_Compliance.uplinkMessage;
// copy the command byte unchanged.
*pResponse++ = *pMessage++;
--nMessage;
// each byte in the body has to be incremented by one.
for (; nMessage > 0; --nMessage) {
*pResponse++ = (uint8_t)(*pMessage++ + 1);
}
// now that the message is formatted, tell the fsm to send it;
// need to use a separate job.
LMIC_Compliance.uplinkSize = (uint8_t) (pResponse - LMIC_Compliance.uplinkMessage);
LMIC_Compliance.eventflags |= LMIC_COMPLIANCE_EVENT_ECHO_REQUEST;
fsmEvalDeferred();
}
/*
Name: fsmEval()
Function:
Evaluate the FSM, preventing recursion.
Definition:
void fsmEval(void);
Description:
We check for a nested call to evaluate the FSM;
if detected, the processing is deferred until the
current evaluation completes. Otherwise, we start
a new FSM evaluation, which proceeds until the FSM
returns a "no-change" result.
Returns:
No explicit result.
*/
const char * LMICcompliance_fsmstate_getName(lmic_compliance_fsmstate_t state) {
const char * const names[] = { LMIC_COMPLIANCE_FSMSTATE__NAMES };
if ((unsigned) state >= sizeof(names)/sizeof(names[0]))
return "<<unknown>>";
else
return names[state];
}
static void fsmEvalDeferred(void) {
os_setCallback(&LMIC_Compliance.fsmJob, fsmJobCb);
}
static void fsmJobCb(osjob_t *j) {
LMIC_API_PARAMETER(j);
fsmEval();
}
static void fsmEval(void) {
bool fNewState;
// check for reentry.
do {
lmic_compliance_fsmflags_t const fsmFlags = LMIC_Compliance.fsmFlags;
if (fsmFlags & LMIC_COMPLIANCE_FSM_ACTIVE) {
LMIC_Compliance.fsmFlags = fsmFlags | LMIC_COMPLIANCE_FSM_REENTERED;
return;
}
// record that we're active
LMIC_Compliance.fsmFlags = fsmFlags | LMIC_COMPLIANCE_FSM_ACTIVE;
} while (0);
// evaluate and change state
fNewState = false;
for (;;) {
lmic_compliance_fsmstate_t const oldState = LMIC_Compliance.fsmState;
lmic_compliance_fsmstate_t newState;
newState = fsmDispatch(oldState, fNewState);
if (newState == LMIC_COMPLIANCE_FSMSTATE_NOCHANGE) {
lmic_compliance_fsmflags_t const fsmFlags = LMIC_Compliance.fsmFlags;
if ((fsmFlags & LMIC_COMPLIANCE_FSM_REENTERED) == 0) {
// not reentered, no change: get out.
LMIC_Compliance.fsmFlags = fsmFlags & ~LMIC_COMPLIANCE_FSM_ACTIVE;
return;
} else {
// reentered. reset reentered flag and keep going.
LMIC_Compliance.fsmFlags = fsmFlags & ~LMIC_COMPLIANCE_FSM_REENTERED;
fNewState = false;
}
} else {
// state change!
LMIC_COMPLIANCE_PRINTF("%s: change state %s(%u) => %s(%u)\n",
__func__,
LMICcompliance_fsmstate_getName(oldState), (unsigned) oldState,
LMICcompliance_fsmstate_getName(newState), (unsigned) newState
);
fNewState = true;
LMIC_Compliance.fsmState = newState;
}
}
}
/*
Name: fsmDispatch()
Function:
Dispatch to the appropriate event handler.
Definition:
lmic_compliance_fsmstate_t fsmDispatch(
lmic_compliance_fsmstate_t state,
bool fEntry
);
Description:
This function is called by the evalutator as needed. `state`
is set to the current state of the FSM, and `fEntry` is
true if and only if this state has just been entered via a
transition arrow. (Might be a transition to self.)
Returns:
This function returns LMIC_COMPLIANCE_FSMSTATE_NOCHANGE if
the FSM is to remain in this state until an event occurs.
Otherwise it returns the new state.
*/
static inline lmic_compliance_eventflags_t
eventflags_TestAndClear(lmic_compliance_eventflags_t flag) {
const lmic_compliance_eventflags_t old = LMIC_Compliance.eventflags;
const lmic_compliance_eventflags_t result = old & flag;
if (result != 0)
LMIC_Compliance.eventflags = old ^ result;
return result;
}
static lmic_compliance_fsmstate_t
fsmDispatch(
lmic_compliance_fsmstate_t state,
bool fEntry
) {
lmic_compliance_fsmstate_t newState;
// currently, this is a stub.
newState = LMIC_COMPLIANCE_FSMSTATE_NOCHANGE;
switch (state) {
case LMIC_COMPLIANCE_FSMSTATE_INITIAL: {
newState = LMIC_COMPLIANCE_FSMSTATE_INACTIVE;
break;
}
case LMIC_COMPLIANCE_FSMSTATE_INACTIVE: {
if (fEntry) {
acExitActiveMode();
}
if (eventflags_TestAndClear(LMIC_COMPLIANCE_EVENT_ACTIVATE)) {
newState = LMIC_COMPLIANCE_FSMSTATE_ACTIVE;
}
break;
}
case LMIC_COMPLIANCE_FSMSTATE_ACTIVE: {
if (fEntry) {
acEnterActiveMode();
acSetTimer(sec2osticks(1));
}
if (eventflags_TestAndClear(LMIC_COMPLIANCE_EVENT_TIMER_EXPIRED)) {
newState = LMIC_COMPLIANCE_FSMSTATE_TESTMODE;
}
break;
}
case LMIC_COMPLIANCE_FSMSTATE_TXBUSY: {
if (fEntry) {
acSetTimer(sec2osticks(1));
}
if (eventflags_TestAndClear(LMIC_COMPLIANCE_EVENT_TIMER_EXPIRED)) {
newState = LMIC_COMPLIANCE_FSMSTATE_TESTMODE;
}
break;
}
case LMIC_COMPLIANCE_FSMSTATE_TESTMODE: {
if (LMIC.opmode & OP_TXDATA) {
// go back and wait some more.
newState = LMIC_COMPLIANCE_FSMSTATE_TXBUSY;
}
if (eventflags_TestAndClear(LMIC_COMPLIANCE_EVENT_DEACTIVATE)) {
newState = LMIC_COMPLIANCE_FSMSTATE_INACTIVE;
} else if (eventflags_TestAndClear(LMIC_COMPLIANCE_EVENT_ECHO_REQUEST)) {
newState = LMIC_COMPLIANCE_FSMSTATE_ECHOING;
} else {
newState = LMIC_COMPLIANCE_FSMSTATE_REPORTING;
}
break;
}
case LMIC_COMPLIANCE_FSMSTATE_ECHOING: {
if (fEntry)
acSendUplinkBuffer();
if (eventflags_TestAndClear(LMIC_COMPLIANCE_EVENT_UPLINK_COMPLETE)) {
newState = LMIC_COMPLIANCE_FSMSTATE_RECOVERY;
}
break;
}
case LMIC_COMPLIANCE_FSMSTATE_REPORTING: {
if (fEntry)
acSendUplink();
if (eventflags_TestAndClear(LMIC_COMPLIANCE_EVENT_UPLINK_COMPLETE)) {
newState = LMIC_COMPLIANCE_FSMSTATE_RECOVERY;
}
break;
}
case LMIC_COMPLIANCE_FSMSTATE_RECOVERY: {
if (fEntry) {
if (LMIC_Compliance.eventflags & (LMIC_COMPLIANCE_EVENT_DEACTIVATE |
LMIC_COMPLIANCE_EVENT_ECHO_REQUEST)) {
acSetTimer(sec2osticks(1));
} else {
acSetTimer(sec2osticks(5));
}
}
if (eventflags_TestAndClear(LMIC_COMPLIANCE_EVENT_TIMER_EXPIRED)) {
newState = LMIC_COMPLIANCE_FSMSTATE_TESTMODE;
}
break;
}
default: {
break;
}
}
return newState;
}
static void acEnterActiveMode(void) {
// indicate to the outer world that we're active.
LMIC_Compliance.state = LMIC_COMPLIANCE_STATE_ACTIVE;
}
void acSetTimer(ostime_t delay) {
os_setTimedCallback(&LMIC_Compliance.timerJob, os_getTime() + delay, timerExpiredCb);
}
static void timerExpiredCb(osjob_t *j) {
LMIC_API_PARAMETER(j);
LMIC_Compliance.eventflags |= LMIC_COMPLIANCE_EVENT_TIMER_EXPIRED;
fsmEval();
}
static void lmicEventCb(
void *pUserData,
ev_t ev
) {
LMIC_API_PARAMETER(pUserData);
// pass to user handler
if (LMIC_Compliance.saveEvent.pEventCb) {
LMIC_Compliance.saveEvent.pEventCb(
LMIC_Compliance.saveEvent.pUserData, ev
);
}
// if it's a EV_JOINED, or a TXCMOMPLETE, we should tell the FSM.
if ((UINT32_C(1) << ev) & (EV_JOINED | EV_TXCOMPLETE)) {
fsmEvalDeferred();
}
}
static void acExitActiveMode(void) {
LMIC_Compliance.state = LMIC_COMPLIANCE_STATE_IDLE;
os_clearCallback(&LMIC_Compliance.timerJob);
LMIC_clrTxData();
}
static void acSendUplink(void) {
uint8_t payload[2];
uint32_t const downlink = LMIC_Compliance.downlinkCount;
// build the uplink message
payload[0] = (uint8_t) (downlink >> 8);
payload[1] = (uint8_t) downlink;
// reset the flags
LMIC_Compliance.eventflags &= ~LMIC_COMPLIANCE_EVENT_UPLINK_COMPLETE;
// don't try to send if busy; might be sending echo message.
lmic_tx_error_t const eSend =
LMIC_sendWithCallback_strict(
LORAWAN_PORT_COMPLIANCE,
payload, sizeof(payload),
/* confirmed? */
!! (LMIC_Compliance.fsmFlags & LMIC_COMPLIANCE_FSM_CONFIRM),
sendUplinkCompleteCb, NULL
);
if (eSend == LMIC_ERROR_SUCCESS) {
// queued successfully
LMIC_COMPLIANCE_PRINTF(
"lmic_compliance.%s: queued uplink message(%u, %p)\n",
__func__,
(unsigned) downlink & 0xFFFF,
LMIC.client.txMessageCb
);
} else {
// failed to queue; just skip this cycle.
LMIC_COMPLIANCE_PRINTF(
"lmic_compliance.%s: error(%d) sending uplink message(%u), %u bytes\n",
__func__,
eSend,
(unsigned) downlink & 0xFFFF,
(unsigned) sizeof(payload)
);
LMIC_Compliance.eventflags |= LMIC_COMPLIANCE_EVENT_UPLINK_COMPLETE;
fsmEval();
}
}
static void sendUplinkCompleteCb(void *pUserData, int fSuccess) {
LMIC_API_PARAMETER(pUserData);
LMIC_API_PARAMETER(fSuccess);
LMIC_Compliance.eventflags |= LMIC_COMPLIANCE_EVENT_UPLINK_COMPLETE;
LMIC_COMPLIANCE_PRINTF("%s(%s)\n", __func__, LMICcompliance_txSuccessToString(fSuccess));
fsmEvalDeferred();
}
static void acSendUplinkBuffer(void) {
// send uplink data.
lmic_tx_error_t const eSend =
LMIC_sendWithCallback_strict(
LORAWAN_PORT_COMPLIANCE,
LMIC_Compliance.uplinkMessage, LMIC_Compliance.uplinkSize,
/* confirmed? */ (LMIC_Compliance.fsmFlags & LMIC_COMPLIANCE_FSM_CONFIRM) != 0,
sendUplinkCompleteCb,
NULL);
if (eSend == LMIC_ERROR_SUCCESS) {
LMIC_COMPLIANCE_PRINTF("%s: queued %u bytes\n", __func__, LMIC_Compliance.uplinkSize);
} else {
LMIC_COMPLIANCE_PRINTF("%s: uplink %u bytes failed (error %d)\n", __func__, LMIC_Compliance.uplinkSize, eSend);
if (eSend == LMIC_ERROR_TX_NOT_FEASIBLE) {
// Reverse the increment of the downlink count. Needed for US compliance.
if (CFG_region == LMIC_REGION_us915)
--LMIC_Compliance.downlinkCount;
}
LMIC_Compliance.eventflags |= LMIC_COMPLIANCE_EVENT_UPLINK_COMPLETE;
fsmEval();
}
}
const char *LMICcompliance_txSuccessToString(int fSuccess) {
return fSuccess ? "ok" : "failed";
}
|
9cce2549ba384750410ed2f5015030112129179f
|
76f9898ff7a555f4a729d725056a317af818375d
|
/assets/scenes/misc/unk_0x16/unk_0x16_scene.c
|
ef6f13a30c24f1e762a58c20e45efb982ca3beb7
|
[] |
no_license
|
z64proto/sw97
|
0b65837ab2f2a4073faca5670761d7fe0e74d29d
|
f571505ade2cefd4a5b5d19da06d33e7c6b02c60
|
refs/heads/master
| 2023-08-01T02:47:42.895871
| 2022-05-15T20:29:08
| 2022-05-15T20:29:08
| 430,216,978
| 208
| 29
| null | 2021-11-22T12:23:50
| 2021-11-20T21:52:59
|
C
|
UTF-8
|
C
| false
| false
| 20,937
|
c
|
unk_0x16_scene.c
|
#include "ultra64.h"
#include "z64.h"
#include "macros.h"
#include "unk_0x16_scene.h"
#include "segment_symbols.h"
#include "command_macros_base.h"
#include "z64cutscene_commands.h"
#include "variables.h"
#include "unk_0x16_scene.h"
static SCmdRoomList unk_0x16_sceneSet0000Cmd00;
static SCmdColHeader unk_0x16_sceneSet0000Cmd01;
static SCmdEntranceList unk_0x16_sceneSet0000Cmd02;
static SCmdSpecialFiles unk_0x16_sceneSet0000Cmd03;
static SCmdSpawnList unk_0x16_sceneSet0000Cmd04;
static SCmdSkyboxSettings unk_0x16_sceneSet0000Cmd05;
static SCmdExitList unk_0x16_sceneSet0000Cmd06;
static SCmdLightSettingList unk_0x16_sceneSet0000Cmd07;
static SCmdEndMarker unk_0x16_sceneSet0000Cmd08;
static SCmdRoomList unk_0x16_sceneSet0000Cmd00 = { 0x04, 0x01, (u32)&unk_0x16_sceneRoomList0x000068 }; // 0x0000
static SCmdColHeader unk_0x16_sceneSet0000Cmd01 = { 0x03, 0x00, (u32)&unk_0x16_sceneCollisionHeader0x000D14 }; // 0x0008
static SCmdEntranceList unk_0x16_sceneSet0000Cmd02 = { 0x06, 0x00, (u32)&unk_0x16_sceneEntranceList0x000070 }; // 0x0010
static SCmdSpecialFiles unk_0x16_sceneSet0000Cmd03 = { 0x07, 0x00, 0x0002 }; // 0x0018
static SCmdSpawnList unk_0x16_sceneSet0000Cmd04 = { 0x00, 0x02, (u32)&unk_0x16_sceneStartPositionList0x000048 }; // 0x0020
static SCmdSkyboxSettings unk_0x16_sceneSet0000Cmd05 = { 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; // 0x0028
static SCmdExitList unk_0x16_sceneSet0000Cmd06 = { 0x13, 0x00, (u32)&unk_0x16_sceneExitList0x000074 }; // 0x0030
static SCmdLightSettingList unk_0x16_sceneSet0000Cmd07 = { 0x0F, 1, (u32)&unk_0x16_sceneLightSettings0x000078 }; // 0x0038
static SCmdEndMarker unk_0x16_sceneSet0000Cmd08 = { 0x14, 0x00, 0x00 }; // 0x0040
ActorEntry unk_0x16_sceneStartPositionList0x000048[] = {
{ ACTOR_PLAYER, 1501, 32, 2312, 0, 32767, 0, 0x0FFF }, // 0x00FF },
{ ACTOR_PLAYER, -2484, 963, -28, 0, 16384, 0, 0x0FFF }, // 0x01FF },
};
RomFile unk_0x16_sceneRoomList0x000068[] = {
{ (u32)_unk_0x16_room_00SegmentRomStart, (u32)_unk_0x16_room_00SegmentRomEnd },
};
EntranceEntry unk_0x16_sceneEntranceList0x000070[2] = {
{ 0x00, 0x00 }, //0x000070
{ 0x01, 0x00 }, //0x000072
};
u16 unk_0x16_sceneExitList0x000074[2] = {
ENTRANCE(SCENE_OLD_KAKARIKO_VILLAGE, 2, 3, false, true), // 0x0056, // this is seemingly a bug in the original data that it points at graveyard entrace!
ENTRANCE(SCENE_DEATH_MOUNTAIN_TRAIL, 0, 3, false, true), // 0x0042,
};
LightSettings unk_0x16_sceneLightSettings0x000078[1] = {
{ 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0xC8, 0xC8, 0xC8, 0xB0, 0xB0, 0xB0, 0x64, 0x64, 0x64, 0x32, 0x32, 0x32, 0x03E4, 0x3200 }, // 0x000078
};
CamData unk_0x16_sceneCollisionHeader0x000D14_camDataList_00000090[1] = {
{ 0x0000, 0, 0x00000000 },
};
u32 unk_0x16_sceneCollisionHeader0x000D14_polygonTypes_00000098[] = {
0x00000000, 0x00000000,
0x00000200, 0x00000000,
0x00000100, 0x00000000,
};
CollisionPoly unk_0x16_sceneCollisionHeader0x000D14_polygons_000000B0[] = {
{ 0x0000, 0x0000, 0x0001, 0x0002, 0x7FFF, 0x0000, 0x0000, 0x0D42 }, // 0x000000B0
{ 0x0000, 0x0000, 0x0002, 0x0003, 0x7FFF, 0x0000, 0x0000, 0x0D42 }, // 0x000000C0
{ 0x0000, 0x0004, 0x0005, 0x0006, 0x2A1D, 0x0000, 0x78DF, 0x03B8 }, // 0x000000D0
{ 0x0000, 0x0004, 0x0006, 0x0007, 0x2A1D, 0x0000, 0x78DF, 0x03B8 }, // 0x000000E0
{ 0x0000, 0x0008, 0x0006, 0x0009, 0x2D7E, 0x77A4, 0x0000, 0xFFDA }, // 0x000000F0
{ 0x0000, 0x0007, 0x0006, 0x0008, 0x385E, 0x0000, 0x72EB, 0x0488 }, // 0x00000100
{ 0x0000, 0x0007, 0x0008, 0x000A, 0x385E, 0x0000, 0x72EB, 0x0488 }, // 0x00000110
{ 0x0000, 0x0006, 0x000B, 0x0009, 0x2CFF, 0x77D0, 0x01CB, 0xFFD6 }, // 0x00000120
{ 0x0000, 0x0006, 0x0005, 0x000C, 0x28A9, 0x795E, 0x0000, 0xFF84 }, // 0x00000130
{ 0x0000, 0x0006, 0x000C, 0x000B, 0x2992, 0x790C, 0x01A8, 0xFF98 }, // 0x00000140
{ 0x0000, 0x000D, 0x000E, 0x000B, 0x238D, 0x0000, 0x850A, 0x029E }, // 0x00000150
{ 0x0000, 0x000D, 0x000B, 0x000F, 0x238D, 0x0000, 0x850A, 0x029E }, // 0x00000160
{ 0x0000, 0x000F, 0x000B, 0x000C, 0x0D2C, 0x0000, 0x80AF, 0x0142 }, // 0x00000170
{ 0x0000, 0x000F, 0x000C, 0x0010, 0x0D2C, 0x0000, 0x80AF, 0x0142 }, // 0x00000180
{ 0x0000, 0x000B, 0x000E, 0x0009, 0x2C3D, 0x781C, 0x0000, 0xFFC9 }, // 0x00000190
{ 0x0000, 0x0003, 0x0002, 0x0005, 0x0000, 0x0000, 0x7FFF, 0x0068 }, // 0x000001A0
{ 0x0000, 0x0003, 0x0005, 0x0004, 0x0000, 0x0000, 0x7FFF, 0x0068 }, // 0x000001B0
{ 0x0001, 0x0005, 0x0002, 0x0001, 0x1F0B, 0x7C2D, 0x0000, 0xFEAB }, // 0x000001C0
{ 0x0001, 0x0005, 0x0001, 0x000C, 0x1F0B, 0x7C2D, 0x0000, 0xFEAB }, // 0x000001D0
{ 0x0000, 0x000D, 0x000F, 0x0007, 0xF6B4, 0x8058, 0xFFA1, 0x0353 }, // 0x000001E0
{ 0x0000, 0x000D, 0x0007, 0x000A, 0xF64B, 0x805F, 0x0000, 0x034E }, // 0x000001F0
{ 0x0000, 0x000F, 0x0010, 0x0004, 0xD646, 0x86FF, 0x0000, 0x0121 }, // 0x00000200
{ 0x0000, 0x000F, 0x0004, 0x0007, 0xD6D5, 0x86D1, 0xFE5C, 0x012C }, // 0x00000210
{ 0x0000, 0x0010, 0x000C, 0x0001, 0x0000, 0x0000, 0x8001, 0x0037 }, // 0x00000220
{ 0x0000, 0x0010, 0x0001, 0x0000, 0x0000, 0x0000, 0x8001, 0x0037 }, // 0x00000230
{ 0x0000, 0x0010, 0x0000, 0x0003, 0xE0F5, 0x83D3, 0x0000, 0x0217 }, // 0x00000240
{ 0x0000, 0x0010, 0x0003, 0x0004, 0xE0F5, 0x83D3, 0x0000, 0x0217 }, // 0x00000250
{ 0x0000, 0x0011, 0x0008, 0x0009, 0x224D, 0x7B50, 0x0000, 0xFF48 }, // 0x00000260
{ 0x0000, 0x0011, 0x0009, 0x0012, 0x192C, 0x7D1E, 0xF63F, 0xFECC }, // 0x00000270
{ 0x0000, 0x0009, 0x000E, 0x0013, 0x37AD, 0x7341, 0x0000, 0x0064 }, // 0x00000280
{ 0x0000, 0x0009, 0x0013, 0x0014, 0x2BC9, 0x77D1, 0x0A7F, 0xFFD2 }, // 0x00000290
{ 0x0000, 0x0009, 0x0015, 0x0012, 0x2CC0, 0x752C, 0x1984, 0xFFFB }, // 0x000002A0
{ 0x0000, 0x0009, 0x0014, 0x0015, 0x2BB3, 0x77D4, 0x0AAF, 0xFFD1 }, // 0x000002B0
{ 0x0000, 0x0016, 0x0013, 0x000E, 0x27F2, 0x0000, 0x8666, 0x02CE }, // 0x000002C0
{ 0x0000, 0x0017, 0x0016, 0x000E, 0x27F2, 0x0000, 0x8666, 0x02CE }, // 0x000002D0
{ 0x0000, 0x0017, 0x000E, 0x000D, 0x27F2, 0x0000, 0x8666, 0x02CE }, // 0x000002E0
{ 0x0000, 0x0017, 0x000D, 0x000A, 0x0C4F, 0x8099, 0x0000, 0x0449 }, // 0x000002F0
{ 0x0000, 0x0017, 0x000A, 0x0018, 0x07DE, 0x8043, 0x01E5, 0x0421 }, // 0x00000300
{ 0x0000, 0x000A, 0x0008, 0x0019, 0x2F98, 0x0000, 0x76D2, 0x0434 }, // 0x00000310
{ 0x0000, 0x000A, 0x0019, 0x0018, 0x2F98, 0x0000, 0x76D2, 0x0434 }, // 0x00000320
{ 0x0000, 0x0008, 0x0011, 0x0019, 0x2F98, 0x0000, 0x76D2, 0x0434 }, // 0x00000330
{ 0x0000, 0x0018, 0x0019, 0x001A, 0x0774, 0x0000, 0x7FC7, 0x0384 }, // 0x00000340
{ 0x0000, 0x0018, 0x001A, 0x001C, 0x0774, 0x0000, 0x7FC7, 0x0384 }, // 0x00000350
{ 0x0000, 0x0019, 0x0011, 0x001B, 0x0774, 0x0000, 0x7FC7, 0x0384 }, // 0x00000360
{ 0x0000, 0x0019, 0x001B, 0x001A, 0x0774, 0x0000, 0x7FC7, 0x0384 }, // 0x00000370
{ 0x0000, 0x001C, 0x001A, 0x001E, 0xCD01, 0x0000, 0x7566, 0x035B }, // 0x00000380
{ 0x0000, 0x001C, 0x001E, 0x0020, 0xCD01, 0x0000, 0x7566, 0x035B }, // 0x00000390
{ 0x0000, 0x001A, 0x001B, 0x001F, 0xCD01, 0x0000, 0x7566, 0x035B }, // 0x000003A0
{ 0x0000, 0x001A, 0x001F, 0x001E, 0xCD01, 0x0000, 0x7566, 0x035B }, // 0x000003B0
{ 0x0000, 0x001B, 0x0011, 0x0012, 0xFF0D, 0x7EF5, 0xEFC1, 0xFE01 }, // 0x000003C0
{ 0x0000, 0x001B, 0x0012, 0x0030, 0x070E, 0x7FC2, 0x035F, 0xFE85 }, // 0x000003D0
{ 0x0000, 0x001D, 0x001F, 0x001B, 0x0494, 0x7F7B, 0xF577, 0xFE24 }, // 0x000003E0
{ 0x0000, 0x001D, 0x001B, 0x0030, 0xFA18, 0x7FD4, 0xFD2D, 0xFE60 }, // 0x000003F0
{ 0x0000, 0x001E, 0x001F, 0x0031, 0x9533, 0x0000, 0x468B, 0x03F4 }, // 0x00000400
{ 0x0000, 0x001E, 0x0031, 0x0025, 0x9533, 0x0000, 0x468B, 0x03F4 }, // 0x00000410
{ 0x0000, 0x001F, 0x001D, 0x0032, 0x0F7B, 0x7F01, 0xFC4C, 0xFDFE }, // 0x00000420
{ 0x0000, 0x001F, 0x0032, 0x0031, 0x0000, 0x7FFF, 0x0000, 0xFE70 }, // 0x00000430
{ 0x0000, 0x0020, 0x001E, 0x0025, 0x9533, 0x0000, 0x468B, 0x03F4 }, // 0x00000440
{ 0x0000, 0x0020, 0x0025, 0x0024, 0x9533, 0x0000, 0x468B, 0x03F4 }, // 0x00000450
{ 0x0000, 0x0021, 0x0022, 0x0020, 0x0000, 0x8001, 0x0000, 0x03E8 }, // 0x00000460
{ 0x0000, 0x0022, 0x001C, 0x0020, 0x0000, 0x8001, 0x0000, 0x03E8 }, // 0x00000470
{ 0x0000, 0x0023, 0x0020, 0x0024, 0x0000, 0x8001, 0x0000, 0x03E8 }, // 0x00000480
{ 0x0000, 0x0023, 0x0021, 0x0020, 0x0000, 0x8001, 0x0000, 0x03E8 }, // 0x00000490
{ 0x0000, 0x0024, 0x0025, 0x0033, 0x81B1, 0x0000, 0x14B7, 0x04D2 }, // 0x000004A0
{ 0x0000, 0x0024, 0x0033, 0x0034, 0x81B1, 0x0000, 0x14B7, 0x04D2 }, // 0x000004B0
{ 0x0000, 0x0025, 0x0031, 0x0033, 0x81B1, 0x0000, 0x14B7, 0x04D2 }, // 0x000004C0
{ 0x0000, 0x0023, 0x0024, 0x0034, 0xDD49, 0x8860, 0xE28D, 0x050F }, // 0x000004D0
{ 0x0000, 0x0026, 0x0033, 0x0031, 0x0000, 0x7FFF, 0x0000, 0xFE70 }, // 0x000004E0
{ 0x0000, 0x0026, 0x0031, 0x0032, 0x0000, 0x7FFF, 0x0000, 0xFE70 }, // 0x000004F0
{ 0x0000, 0x0027, 0x0023, 0x0034, 0xDA4B, 0x9885, 0xBEC9, 0x05C9 }, // 0x00000500
{ 0x0000, 0x0022, 0x0017, 0x0018, 0x0000, 0x8001, 0x0000, 0x03E8 }, // 0x00000510
{ 0x0000, 0x0022, 0x0018, 0x001C, 0x0000, 0x8001, 0x0000, 0x03E8 }, // 0x00000520
{ 0x0000, 0x0022, 0x0028, 0x0016, 0x44AE, 0x0000, 0x93FE, 0x038F }, // 0x00000530
{ 0x0000, 0x0022, 0x0016, 0x0017, 0x44AE, 0x0000, 0x93FE, 0x038F }, // 0x00000540
{ 0x0000, 0x0028, 0x002A, 0x0013, 0x44AE, 0x0000, 0x93FE, 0x038F }, // 0x00000550
{ 0x0000, 0x0028, 0x0013, 0x0016, 0x44AE, 0x0000, 0x93FE, 0x038F }, // 0x00000560
{ 0x0000, 0x0014, 0x0013, 0x002A, 0x0000, 0x7FFF, 0x0000, 0xFE70 }, // 0x00000570
{ 0x0000, 0x0014, 0x002A, 0x0036, 0xF342, 0x7F2C, 0x06EB, 0xFE0C }, // 0x00000580
{ 0x0000, 0x0029, 0x0037, 0x002A, 0x3C09, 0x0000, 0x8EF5, 0x037B }, // 0x00000590
{ 0x0000, 0x0029, 0x002A, 0x0028, 0x3C09, 0x0000, 0x8EF5, 0x037B }, // 0x000005A0
{ 0x0000, 0x002A, 0x0037, 0x002C, 0x0559, 0x7F7D, 0xF5EE, 0xFEC1 }, // 0x000005B0
{ 0x0000, 0x002A, 0x002C, 0x0036, 0x0813, 0x7E9E, 0x10EC, 0xFE49 }, // 0x000005C0
{ 0x0000, 0x002B, 0x002F, 0x0037, 0x2036, 0x0000, 0x8420, 0x03B2 }, // 0x000005D0
{ 0x0000, 0x002B, 0x0037, 0x0029, 0x2036, 0x0000, 0x8420, 0x03B2 }, // 0x000005E0
{ 0x0000, 0x002C, 0x0037, 0x002F, 0x02FF, 0x7F71, 0xF47A, 0xFECA }, // 0x000005F0
{ 0x0000, 0x002C, 0x002F, 0x0038, 0xF8F7, 0x7FAA, 0xFA07, 0xFEBA }, // 0x00000600
{ 0x0000, 0x002C, 0x002D, 0x0039, 0xF52C, 0x7F5E, 0x069B, 0xFE87 }, // 0x00000610
{ 0x0000, 0x002C, 0x0039, 0x0036, 0x1799, 0x7CFA, 0xF19B, 0xFECA }, // 0x00000620
{ 0x0000, 0x002D, 0x002C, 0x0038, 0xF30E, 0x7F3B, 0x0545, 0xFE8F }, // 0x00000630
{ 0x0000, 0x002D, 0x0038, 0x0035, 0x0000, 0x7FFF, 0x0000, 0xFE70 }, // 0x00000640
{ 0x0000, 0x002E, 0x002F, 0x002B, 0x3349, 0x0000, 0x8ABA, 0x033E }, // 0x00000650
{ 0x0000, 0x002F, 0x002E, 0x0026, 0x0000, 0x7FFF, 0x0000, 0xFE70 }, // 0x00000660
{ 0x0000, 0x002F, 0x0026, 0x0038, 0x0000, 0x7FFF, 0x0000, 0xFE70 }, // 0x00000670
{ 0x0000, 0x0027, 0x002E, 0x002B, 0x3349, 0x0000, 0x8ABA, 0x033E }, // 0x00000680
{ 0x0000, 0x0027, 0x002B, 0x0023, 0x3349, 0x0000, 0x8ABA, 0x033E }, // 0x00000690
{ 0x0000, 0x0026, 0x0035, 0x0038, 0x0000, 0x7FFF, 0x0000, 0xFE70 }, // 0x000006A0
{ 0x0000, 0x0026, 0x0032, 0x0035, 0x0000, 0x7FFF, 0x0000, 0xFE70 }, // 0x000006B0
{ 0x0000, 0x002D, 0x001D, 0x0030, 0xF5AB, 0x7F63, 0x06F7, 0xFE85 }, // 0x000006C0
{ 0x0000, 0x002D, 0x0030, 0x0039, 0xF4B2, 0x7F45, 0x079F, 0xFE87 }, // 0x000006D0
{ 0x0000, 0x001D, 0x002D, 0x0035, 0xF8AD, 0x7F7B, 0x08DA, 0xFE79 }, // 0x000006E0
{ 0x0000, 0x001D, 0x0035, 0x0032, 0x05B4, 0x7FC7, 0x04D8, 0xFE36 }, // 0x000006F0
{ 0x0000, 0x0021, 0x0029, 0x0028, 0x3C09, 0x0000, 0x8EF5, 0x037B }, // 0x00000700
{ 0x0000, 0x0021, 0x0028, 0x0022, 0x3C09, 0x0000, 0x8EF5, 0x037B }, // 0x00000710
{ 0x0000, 0x0012, 0x0015, 0x0039, 0x05A9, 0x7EB0, 0x1158, 0xFEBA }, // 0x00000720
{ 0x0000, 0x0012, 0x0039, 0x0030, 0x0691, 0x7ECC, 0x1036, 0xFEBB }, // 0x00000730
{ 0x0000, 0x0015, 0x0014, 0x0036, 0xF669, 0x7F9D, 0xFDA8, 0xFE29 }, // 0x00000740
{ 0x0000, 0x0015, 0x0036, 0x0039, 0x0BA0, 0x7DD5, 0xEBA8, 0xFEA5 }, // 0x00000750
{ 0x0000, 0x0023, 0x002B, 0x0029, 0x2036, 0x0000, 0x8420, 0x03B2 }, // 0x00000760
{ 0x0000, 0x0023, 0x0029, 0x0021, 0x2036, 0x0000, 0x8420, 0x03B2 }, // 0x00000770
{ 0x0000, 0x003A, 0x003B, 0x003C, 0x6DDC, 0xF012, 0xC048, 0xFF75 }, // 0x00000780
{ 0x0000, 0x003C, 0x003D, 0x003A, 0x917A, 0xF058, 0xC15F, 0xFFF1 }, // 0x00000790
{ 0x0000, 0x003B, 0x003D, 0x003C, 0x0000, 0xF020, 0x7F02, 0x017A }, // 0x000007A0
{ 0x0000, 0x003E, 0x003F, 0x0040, 0x6DAF, 0xF026, 0xBFF5, 0x023D }, // 0x000007B0
{ 0x0000, 0x0040, 0x0041, 0x003E, 0x91FC, 0xF049, 0xC080, 0xFEB2 }, // 0x000007C0
{ 0x0000, 0x003F, 0x0041, 0x0040, 0x0000, 0xF020, 0x7F02, 0xFFEE }, // 0x000007D0
{ 0x0000, 0x0042, 0x0043, 0x0044, 0x6DDC, 0xF012, 0xC048, 0x0167 }, // 0x000007E0
{ 0x0000, 0x0044, 0x0045, 0x0042, 0x917A, 0xF058, 0xC15F, 0x01DA }, // 0x000007F0
{ 0x0000, 0x0043, 0x0045, 0x0044, 0x0000, 0xF020, 0x7F02, 0xFD9B }, // 0x00000800
{ 0x0000, 0x0046, 0x0047, 0x0048, 0x6DAF, 0xF026, 0xBFF5, 0xFEE5 }, // 0x00000810
{ 0x0000, 0x0048, 0x0049, 0x0046, 0x91FC, 0xF049, 0xC080, 0x020D }, // 0x00000820
{ 0x0000, 0x0047, 0x0049, 0x0048, 0x0000, 0xF020, 0x7F02, 0xFFEE }, // 0x00000830
{ 0x0000, 0x004A, 0x004B, 0x004C, 0x6DDC, 0xEFFB, 0xC04E, 0x0115 }, // 0x00000840
{ 0x0000, 0x004C, 0x004D, 0x004A, 0x91E0, 0xF017, 0xC0BD, 0xFD8B }, // 0x00000850
{ 0x0000, 0x004B, 0x004D, 0x004C, 0x0000, 0xF048, 0x7F07, 0x021A }, // 0x00000860
{ 0x0000, 0x004E, 0x004F, 0x0050, 0x6DFD, 0xF017, 0xC07F, 0xFD2A }, // 0x00000870
{ 0x0000, 0x0050, 0x0051, 0x004E, 0x91B8, 0xF036, 0xC0FB, 0x0304 }, // 0x00000880
{ 0x0000, 0x004F, 0x0051, 0x0050, 0x0000, 0xF017, 0x7F01, 0x00A2 }, // 0x00000890
{ 0x0000, 0x0052, 0x0053, 0x0054, 0x6DBB, 0xEFED, 0xC018, 0x014C }, // 0x000008A0
{ 0x0000, 0x0054, 0x0055, 0x0052, 0x91FF, 0xF009, 0xC089, 0x006E }, // 0x000008B0
{ 0x0000, 0x0053, 0x0055, 0x0054, 0x0000, 0xF049, 0x7F07, 0xFF07 }, // 0x000008C0
{ 0x0000, 0x0056, 0x0057, 0x0058, 0x6E01, 0xF009, 0xC089, 0x03DA }, // 0x000008D0
{ 0x0000, 0x0058, 0x0059, 0x0056, 0x91FF, 0xF009, 0xC089, 0xFDBF }, // 0x000008E0
{ 0x0000, 0x0057, 0x0059, 0x0058, 0x0000, 0xF049, 0x7F07, 0xFF26 }, // 0x000008F0
{ 0x0000, 0x005A, 0x005B, 0x005C, 0x0000, 0x0000, 0x8001, 0x0D48 }, // 0x00000900
{ 0x0000, 0x005A, 0x005C, 0x005D, 0x0000, 0x0000, 0x8001, 0x0D48 }, // 0x00000910
{ 0x0000, 0x005E, 0x0033, 0x0026, 0x1171, 0x7B2E, 0x1E16, 0xFCEF }, // 0x00000920
{ 0x0000, 0x0034, 0x0033, 0x005E, 0x825A, 0x0000, 0x186A, 0x04B1 }, // 0x00000930
{ 0x0000, 0x0034, 0x005E, 0x005F, 0x825A, 0x0000, 0x186A, 0x04B1 }, // 0x00000940
{ 0x0000, 0x0060, 0x0027, 0x0034, 0xE604, 0x8B01, 0xD30F, 0x050C }, // 0x00000950
{ 0x0000, 0x0060, 0x0034, 0x005F, 0xF310, 0x882B, 0xD4ED, 0x0481 }, // 0x00000960
{ 0x0000, 0x0026, 0x002E, 0x0061, 0x1352, 0x7A03, 0x2182, 0xFCC6 }, // 0x00000970
{ 0x0000, 0x0060, 0x0061, 0x002E, 0x5EC3, 0x0000, 0xA9F6, 0x0103 }, // 0x00000980
{ 0x0000, 0x0060, 0x002E, 0x0027, 0x5EC3, 0x0000, 0xA9F6, 0x0103 }, // 0x00000990
{ 0x0000, 0x005E, 0x0026, 0x0061, 0x0A9F, 0x7A8E, 0x235D, 0xFCFF }, // 0x000009A0
{ 0x0000, 0x0062, 0x0063, 0x005E, 0x0000, 0x7C46, 0x1EA6, 0xFDB8 }, // 0x000009B0
{ 0x0000, 0x0062, 0x005E, 0x0061, 0x098D, 0x7B9D, 0x1FCE, 0xFD37 }, // 0x000009C0
{ 0x0000, 0x005F, 0x005E, 0x0063, 0x803A, 0x0000, 0x0790, 0x05A1 }, // 0x000009D0
{ 0x0000, 0x005F, 0x0063, 0x0064, 0x803A, 0x0000, 0x0790, 0x05A1 }, // 0x000009E0
{ 0x0000, 0x0060, 0x005F, 0x0064, 0xF3B5, 0x8759, 0xD712, 0x0461 }, // 0x000009F0
{ 0x0000, 0x0060, 0x0064, 0x0065, 0x0000, 0x88D7, 0xD145, 0x0435 }, // 0x00000A00
{ 0x0002, 0x005C, 0x005B, 0x0063, 0x0000, 0x7FFF, 0x0000, 0x0000 }, // 0x00000A10
{ 0x0002, 0x005C, 0x0063, 0x0062, 0x0000, 0x7FFF, 0x0000, 0x0000 }, // 0x00000A20
{ 0x0000, 0x0064, 0x0063, 0x005B, 0x8001, 0x0000, 0x0000, 0x0634 }, // 0x00000A30
{ 0x0000, 0x0064, 0x005B, 0x005A, 0x8001, 0x0000, 0x0000, 0x0634 }, // 0x00000A40
{ 0x0000, 0x0065, 0x0062, 0x0061, 0x7AC0, 0x0000, 0xDBBA, 0xFD5A }, // 0x00000A50
{ 0x0000, 0x0065, 0x0061, 0x0060, 0x7AC0, 0x0000, 0xDBBA, 0xFD5A }, // 0x00000A60
{ 0x0000, 0x0065, 0x0064, 0x005A, 0x0000, 0x8001, 0x0000, 0x00C8 }, // 0x00000A70
{ 0x0000, 0x0065, 0x005A, 0x005D, 0x0000, 0x8001, 0x0000, 0x00C8 }, // 0x00000A80
{ 0x0000, 0x005D, 0x005C, 0x0062, 0x7FFF, 0x0000, 0x0000, 0xFA6C }, // 0x00000A90
{ 0x0000, 0x005D, 0x0062, 0x0065, 0x7FFF, 0x0000, 0x0000, 0xFA6C }, // 0x00000AA0
};
Vec3s unk_0x16_sceneCollisionHeader0x000D14_vtx_00000AB0[] = {
{ -3394, 1400, 55 }, // 0x00000AB0
{ -3394, 1200, 55 }, // 0x00000AB6
{ -3394, 1200, -104 }, // 0x00000ABC
{ -3394, 1400, -104 }, // 0x00000AC2
{ -2594, 1200, -104 }, // 0x00000AC8
{ -2594, 1000, -104 }, // 0x00000ACE
{ -1997, 800, -312 }, // 0x00000AD4
{ -1997, 1000, -312 }, // 0x00000ADA
{ -1471, 600, -570 }, // 0x00000AE0
{ -1471, 600, -148 }, // 0x00000AE6
{ -1471, 960, -570 }, // 0x00000AEC
{ -2014, 800, 115 }, // 0x00000AF2
{ -2594, 1000, 55 }, // 0x00000AF8
{ -1471, 960, 272 }, // 0x00000AFE
{ -1471, 600, 272 }, // 0x00000B04
{ -2014, 1000, 115 }, // 0x00000B0A
{ -2594, 1200, 55 }, // 0x00000B10
{ -752, 400, -858 }, // 0x00000B16
{ -828, 440, -541 }, // 0x00000B1C
{ -1057, 400, 408 }, // 0x00000B22
{ -981, 400, 91 }, // 0x00000B28
{ -904, 400, -224 }, // 0x00000B2E
{ -1057, 520, 408 }, // 0x00000B34
{ -1057, 1000, 408 }, // 0x00000B3A
{ -752, 1000, -858 }, // 0x00000B40
{ -752, 520, -858 }, // 0x00000B46
{ 71, 520, -906 }, // 0x00000B4C
{ 71, 400, -906 }, // 0x00000B52
{ 71, 1000, -906 }, // 0x00000B58
{ 596, 440, -194 }, // 0x00000B5E
{ 833, 520, -575 }, // 0x00000B64
{ 833, 400, -575 }, // 0x00000B6A
{ 833, 1000, -575 }, // 0x00000B70
{ -115, 1000, 948 }, // 0x00000B76
{ -678, 1000, 649 }, // 0x00000B7C
{ 408, 1000, 1084 }, // 0x00000B82
{ 1263, 1000, 76 }, // 0x00000B88
{ 1263, 520, 76 }, // 0x00000B8E
{ 1090, 400, 1071 }, // 0x00000B94
{ 783, 760, 1248 }, // 0x00000B9A
{ -678, 520, 649 }, // 0x00000BA0
{ -115, 520, 948 }, // 0x00000BA6
{ -678, 400, 649 }, // 0x00000BAC
{ 408, 520, 1084 }, // 0x00000BB2
{ 121, 360, 567 }, // 0x00000BB8
{ 359, 400, 186 }, // 0x00000BBE
{ 783, 400, 1248 }, // 0x00000BC4
{ 408, 400, 1084 }, // 0x00000BCA
{ -115, 400, -517 }, // 0x00000BD0
{ 1263, 400, 76 }, // 0x00000BD6
{ 1049, 400, 328 }, // 0x00000BDC
{ 1397, 400, 893 }, // 0x00000BE2
{ 1397, 760, 893 }, // 0x00000BE8
{ 835, 400, 580 }, // 0x00000BEE
{ -490, 440, 260 }, // 0x00000BF4
{ -115, 400, 948 }, // 0x00000BFA
{ 622, 400, 832 }, // 0x00000C00
{ -303, 360, -128 }, // 0x00000C06
{ 71, 1000, -406 }, // 0x00000C0C
{ 158, 1000, -256 }, // 0x00000C12
{ 71, 600, -306 }, // 0x00000C18
{ -14, 1000, -256 }, // 0x00000C1E
{ -528, 1000, -6 }, // 0x00000C24
{ -441, 1000, 143 }, // 0x00000C2A
{ -528, 600, 93 }, // 0x00000C30
{ -614, 1000, 143 }, // 0x00000C36
{ 71, 1000, 593 }, // 0x00000C3C
{ 158, 1000, 743 }, // 0x00000C42
{ 71, 600, 693 }, // 0x00000C48
{ -14, 1000, 743 }, // 0x00000C4E
{ 471, 1000, -6 }, // 0x00000C54
{ 558, 1000, 143 }, // 0x00000C5A
{ 471, 600, 93 }, // 0x00000C60
{ 385, 1000, 143 }, // 0x00000C66
{ -528, 1000, -606 }, // 0x00000C6C
{ -419, 1000, -418 }, // 0x00000C72
{ -528, 499, -480 }, // 0x00000C78
{ -636, 1000, -418 }, // 0x00000C7E
{ 871, 1000, -206 }, // 0x00000C84
{ 968, 1000, -38 }, // 0x00000C8A
{ 871, 553, -94 }, // 0x00000C90
{ 775, 1000, -38 }, // 0x00000C96
{ -128, 1000, 193 }, // 0x00000C9C
{ -22, 1000, 375 }, // 0x00000CA2
{ -128, 515, 315 }, // 0x00000CA8
{ -233, 1000, 375 }, // 0x00000CAE
{ -909, 1000, 161 }, // 0x00000CB4
{ -804, 1000, 343 }, // 0x00000CBA
{ -909, 515, 283 }, // 0x00000CC0
{ -1014, 1000, 343 }, // 0x00000CC6
{ 1588, 200, 3400 }, // 0x00000CCC
{ 1588, 0, 3400 }, // 0x00000CD2
{ 1428, 0, 3400 }, // 0x00000CD8
{ 1428, 200, 3400 }, // 0x00000CDE
{ 1540, 200, 1629 }, // 0x00000CE4
{ 1540, 480, 1629 }, // 0x00000CEA
{ 1217, 480, 1726 }, // 0x00000CF0
{ 1217, 200, 1726 }, // 0x00000CF6
{ 1428, 0, 2440 }, // 0x00000CFC
{ 1588, 0, 2440 }, // 0x00000D02
{ 1588, 200, 2440 }, // 0x00000D08
{ 1428, 200, 2440 }, // 0x00000D0E
};
CollisionHeader unk_0x16_sceneCollisionHeader0x000D14 = { -3394, 0, -906, 1588, 1400, 3400, 102, unk_0x16_sceneCollisionHeader0x000D14_vtx_00000AB0, 160, unk_0x16_sceneCollisionHeader0x000D14_polygons_000000B0, unk_0x16_sceneCollisionHeader0x000D14_polygonTypes_00000098, &unk_0x16_sceneCollisionHeader0x000D14_camDataList_00000090, 0, 0 };
u64 unk_0x16_sceneTex_000D40[] = {
#include "assets/scenes/misc/unk_0x16//unk_0x16_sceneTex_000D40.rgb5a1.inc.c"
};
|
bc95874112077e4202fee9b236b3a0a3e472a2f9
|
be18b365cf5b56bf76d81e60858775061638278e
|
/cbmc-gc/source/xtabs/main.c
|
460acfbeee5557840f12da23093b1bc8f1b55345
|
[
"MIT"
] |
permissive
|
MPC-SoK/frameworks
|
7224ce12f189b05fae5761941ee29a77b58858ba
|
5a2be01cc74aa4f31e860b4d852c232ff7ef76c3
|
refs/heads/master
| 2023-08-15T03:29:04.128293
| 2023-08-07T08:47:36
| 2023-08-07T08:47:36
| 137,266,237
| 461
| 127
|
NOASSERTION
| 2023-09-14T07:43:08
| 2018-06-13T20:19:59
|
C++
|
UTF-8
|
C
| false
| false
| 1,509
|
c
|
main.c
|
/*
Compute a simple crosstabulation
Party A has a two column array:
Column 0 is a unique identifier (e.g. SSN as an int)
Column 1 is a value (e.g. salary)
Party B has a two column array:
Column 0 is a unique identifier (e.g. SSN as an int)
Column 1 is a class (e.g. age group) -- This is assumed to be a small number in the range 0 ... BINS-1
This script computes the sum of salaries by age group, i.e., it computes the sum of A column 1 grouped by B column 1.
The result is a vector of length BINS
This is the brute-force O(n^2) solution
*/
#include <inttypes.h>
#define S 50 //Number of entries in the database
#define BINS 5 //Number of bins (e.g. number of distinct age groups)
typedef struct
{
uint8_t d[2][S];
} DB;
typedef struct
{
uint8_t d[BINS];
} HB;
typedef DB InputA;
typedef DB InputB;
typedef HB Output;
Output mpc_main(InputA INPUT_A, InputB INPUT_B)
{
Output out;
uint8_t CT[BINS];
int i,j;
//Brute force solution
//Initialize all the bin counts to 0
//I think unitialized variables default to zero anyway, but I'd like to make sure
for( i=0; i<BINS; i++ ) {
CT[i] = 0;
}
for( i=0; i<S; i++ ) {
for( j=0; j<S; j++ ) {
if( INPUT_A.d[0][i] == INPUT_B.d[0][j] ) {
CT[INPUT_B.d[1][j]%BINS] += INPUT_A.d[1][i];
}
}
}
for( i=0; i<BINS; i++ ) {
out.d[i] = CT[i];
}
return out;
}
|
ce847a584a534e3fe000cd257cf5744e6902977d
|
9c4ec01e04f7b0a1d213e1060c6b0a008dde7cbd
|
/series2/rtcc/rtcc_interrupt/src/main_xg21.c
|
5172a5fc452168d87ac1a6413e2d864cbcc29904
|
[
"Zlib"
] |
permissive
|
SiliconLabs/peripheral_examples
|
edf5ee87cd0bcb2e7ad5066e278fa1ad3b92bd35
|
87b252e5a1bf5b36a548c121e8ffda085d3bcbc4
|
refs/heads/master
| 2023-07-26T22:20:57.916375
| 2023-07-07T18:18:01
| 2023-07-07T18:20:16
| 116,865,771
| 326
| 212
|
NOASSERTION
| 2021-06-17T20:12:04
| 2018-01-09T20:13:39
|
C
|
UTF-8
|
C
| false
| false
| 4,860
|
c
|
main_xg21.c
|
/***************************************************************************//**
* @file main_xg21.c
* @brief This project demonstrates the functions of RTCC. See readme.txt for
* details.
*******************************************************************************
* # License
* <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b>
*******************************************************************************
*
* SPDX-License-Identifier: Zlib
*
* The licensor of this software is Silicon Laboratories Inc.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
*******************************************************************************
* # Evaluation Quality
* This code has been minimally tested to ensure that it builds and is suitable
* as a demonstration for evaluation purposes only. This code will be maintained
* at the sole discretion of Silicon Labs.
******************************************************************************/
#include "em_chip.h"
#include "em_cmu.h"
#include "em_device.h"
#include "em_emu.h"
#include "em_prs.h"
#include "em_rtcc.h"
#include "bsp.h"
// Defines
#define RTCC_CLOCK cmuSelect_LFXO // RTCC clock source
#define RTCC_PRS_CH 0 // RTCC PRS output channel
#define WAKEUP_INTERVAL_MS 500 // Wake up interval in ms
/**************************************************************************//**
* @brief
* RTCC Interrupt Handler, clears the flag.
*****************************************************************************/
void RTCC_IRQHandler(void)
{
// Clear interrupt source CC1
RTCC_IntClear(RTCC_IF_CC1);
}
/**************************************************************************//**
* @brief
* Setup RTCC with selected clock source
* @param[in] rtccClock
* Select clock source, valid values are cmuSelect_LFRCO, cmuSelect_LFXO, and
* cmuSelect_ULFRCO.
*****************************************************************************/
void setupRtcc(CMU_Select_TypeDef rtccClock)
{
RTCC_Init_TypeDef rtccInit = RTCC_INIT_DEFAULT;
RTCC_CCChConf_TypeDef rtccInitCompareChannel = RTCC_CH_INIT_COMPARE_DEFAULT;
if (rtccClock == cmuSelect_LFXO) {
// Initialize LFXO with specific parameters
CMU_LFXOInit_TypeDef lfxoInit = CMU_LFXOINIT_DEFAULT;
CMU_LFXOInit(&lfxoInit);
}
// Setting RTCC clock source
CMU_ClockSelectSet(cmuClock_RTCCCLK, rtccClock);
// Initialize CC1 to toggle PRS output on compare match
rtccInitCompareChannel.compMatchOutAction = rtccCompMatchOutActionToggle;
RTCC_ChannelInit(1, &rtccInitCompareChannel);
// Setting the CC1 compare value of the RTCC
if (rtccClock == cmuSelect_ULFRCO) {
RTCC_ChannelCCVSet(1, (1000 * WAKEUP_INTERVAL_MS) / 1000 - 1);
} else {
RTCC_ChannelCCVSet(1, (32768 * WAKEUP_INTERVAL_MS) / 1000 - 1);
}
// Initialize the RTCC
rtccInit.cntWrapOnCCV1 = true; // Clear counter on CC1 compare match
rtccInit.presc = rtccCntPresc_1; // Prescaler 1
RTCC_Init(&rtccInit);
// Enabling Interrupt from RTCC CC1
RTCC_IntEnable(RTCC_IEN_CC1);
NVIC_ClearPendingIRQ(RTCC_IRQn);
NVIC_EnableIRQ(RTCC_IRQn);
}
/**************************************************************************//**
* @brief
* Main function
*****************************************************************************/
int main(void)
{
// Chip errata
CHIP_Init();
// Setting up RTCC
setupRtcc(RTCC_CLOCK);
// RTCC CC1 PRS output on LED1 (PA or PB to work on EM2 or EM3)
GPIO_PinModeSet(BSP_GPIO_LED1_PORT, BSP_GPIO_LED1_PIN, gpioModePushPull, 1);
PRS_SourceAsyncSignalSet(RTCC_PRS_CH, PRS_ASYNC_CH_CTRL_SOURCESEL_RTCC,
PRS_ASYNC_CH_CTRL_SIGSEL_RTCCCCV1);
PRS_PinOutput(RTCC_PRS_CH, prsTypeAsync, BSP_GPIO_LED1_PORT,
BSP_GPIO_LED1_PIN);
while (1) {
// Forever enter EM2 or EM3
if (CMU_ClockSelectGet(cmuClock_RTCCCLK) == cmuSelect_ULFRCO) {
EMU_EnterEM3(false);
} else {
EMU_EnterEM2(false);
}
}
}
|
d7d18cd7b8ed0d864fd8bce18d84c6f7e204e944
|
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
|
/sys/arch/cesfic/include/limits.h
|
1bb996bdf943916dd25ffaba774f77cec5a68818
|
[] |
no_license
|
NetBSD/src
|
1a9cbc22ed778be638b37869ed4fb5c8dd616166
|
23ee83f7c0aea0777bd89d8ebd7f0cde9880d13c
|
refs/heads/trunk
| 2023-08-31T13:24:58.105962
| 2023-08-27T15:50:47
| 2023-08-27T15:50:47
| 88,439,547
| 656
| 348
| null | 2023-07-20T20:07:24
| 2017-04-16T20:03:43
| null |
UTF-8
|
C
| false
| false
| 91
|
h
|
limits.h
|
/* $NetBSD: limits.h,v 1.1 2001/05/14 18:23:12 drochner Exp $ */
#include <m68k/limits.h>
|
a3ff43e84be0636d2a928f70a24e701ec5737a68
|
b452bbb87214f174122f425f6f98f4c3890c3cca
|
/internal/ccall/twopigen/circle.h
|
870b322529410c0bfc84cf73be8f8b932d451973
|
[
"MIT"
] |
permissive
|
goccy/go-graphviz
|
bea9bc86b42734aff7ffae283aeae71702ca588a
|
865af036ddbb745c4424bbd2fdaa9a75668cf0d4
|
refs/heads/master
| 2023-07-20T08:05:39.868377
| 2023-03-21T23:49:44
| 2023-03-21T23:49:44
| 236,740,615
| 511
| 66
|
MIT
| 2023-07-07T13:53:28
| 2020-01-28T13:24:09
|
Go
|
UTF-8
|
C
| false
| false
| 1,402
|
h
|
circle.h
|
/* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */
/*************************************************************************
* Copyright (c) 2011 AT&T Intellectual Property
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: See CVS logs. Details at http://www.graphviz.org/
*************************************************************************/
#ifndef CIRCLE_H
#define CIRCLE_H
#include "render.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
uint64_t nStepsToLeaf;
uint64_t subtreeSize;
uint64_t nChildren;
uint64_t nStepsToCenter;
node_t *parent;
double span;
double theta;
} rdata;
#define RDATA(n) ((rdata*)(ND_alg(n)))
#define SLEAF(n) (RDATA(n)->nStepsToLeaf)
#define STSIZE(n) (RDATA(n)->subtreeSize)
#define NCHILD(n) (RDATA(n)->nChildren)
#define SCENTER(n) (RDATA(n)->nStepsToCenter)
#define SPARENT(n) (RDATA(n)->parent)
#define SPAN(n) (RDATA(n)->span)
#define THETA(n) (RDATA(n)->theta)
extern Agnode_t* circleLayout(Agraph_t * sg, Agnode_t * center);
extern void twopi_layout(Agraph_t * g);
extern void twopi_cleanup(Agraph_t * g);
extern void twopi_init_graph(graph_t * g);
#ifdef __cplusplus
}
#endif
#endif
|
a7c9e27e47c78c4bb20714e41620584ae251feba
|
a7856278e39f6030eacbb0680ca66b57e30ca06b
|
/generation/WinRT/um/windows.graphics.imaging.interop/um-windows.graphics.imaging.interop.h
|
2a810e8b4d99e59daed3e2a9d08db82333d91400
|
[
"MIT"
] |
permissive
|
terrafx/terrafx.interop.windows
|
07f1ac52cbaea6c0f5f8f6147df7a8dd50345f49
|
fadce5a41fa5e6f0282e80e96f033d0a2c130991
|
refs/heads/main
| 2023-07-09T03:56:06.057946
| 2023-06-23T16:01:17
| 2023-06-23T16:01:17
| 192,857,891
| 208
| 46
|
MIT
| 2023-07-07T17:25:55
| 2019-06-20T05:58:46
|
C#
|
UTF-8
|
C
| false
| false
| 76
|
h
|
um-windows.graphics.imaging.interop.h
|
#include "..\..\..\TerraFX.h"
#include <windows.graphics.imaging.interop.h>
|
f902e6e0d669c6fb0ff52f389bba06f28a09d32a
|
2dfc2beac0ad497f8fc59201921097a412f0df7f
|
/trunk/3rdparty/libsrtp-2-fit/crypto/test/cipher_driver.c
|
8219a0618063006a922fc1b4febae3e770e7ad3c
|
[
"OpenSSL",
"JSON",
"Apache-2.0",
"LicenseRef-scancode-mulanpsl-2.0-en",
"MIT",
"MulanPSL-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
ossrs/srs
|
cf9442478fedcd32ef2817f8d53f405a6fa2c7d1
|
7138edd318d30b545e73e80500adda771817f8d1
|
refs/heads/develop
| 2023-09-01T03:38:35.057515
| 2023-08-31T01:45:25
| 2023-08-31T01:49:36
| 34,777,562
| 23,557
| 5,046
|
MIT
| 2023-09-09T00:57:42
| 2015-04-29T06:59:32
|
C++
|
UTF-8
|
C
| false
| false
| 18,988
|
c
|
cipher_driver.c
|
/*
* cipher_driver.c
*
* A driver for the generic cipher type
*
* David A. McGrew
* Cisco Systems, Inc.
*/
/*
*
* Copyright (c) 2001-2017 Cisco Systems, 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 the Cisco Systems, 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 HOLDERS 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.
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h> /* for printf() */
#include "getopt_s.h"
#include "cipher.h"
#include "cipher_priv.h"
#ifdef GCM
#include "aes_icm_ext.h"
#include "aes_gcm.h"
#else
#include "aes_icm.h"
#endif
#define PRINT_DEBUG 0
void cipher_driver_test_throughput(srtp_cipher_t *c);
srtp_err_status_t cipher_driver_self_test(srtp_cipher_type_t *ct);
/*
* cipher_driver_test_buffering(ct) tests the cipher's output
* buffering for correctness by checking the consistency of succesive
* calls
*/
srtp_err_status_t cipher_driver_test_buffering(srtp_cipher_t *c);
/*
* functions for testing cipher cache thrash
*/
srtp_err_status_t cipher_driver_test_array_throughput(srtp_cipher_type_t *ct,
int klen,
int num_cipher);
void cipher_array_test_throughput(srtp_cipher_t *ca[], int num_cipher);
uint64_t cipher_array_bits_per_second(srtp_cipher_t *cipher_array[],
int num_cipher,
unsigned octets_in_buffer,
int num_trials);
srtp_err_status_t cipher_array_delete(srtp_cipher_t *cipher_array[],
int num_cipher);
srtp_err_status_t cipher_array_alloc_init(srtp_cipher_t ***cipher_array,
int num_ciphers,
srtp_cipher_type_t *ctype,
int klen);
void usage(char *prog_name)
{
printf("usage: %s [ -t | -v | -a ]\n", prog_name);
exit(255);
}
void check_status(srtp_err_status_t s)
{
if (s) {
printf("error (code %d)\n", s);
exit(s);
}
return;
}
/*
* null_cipher and srtp_aes_icm are the cipher meta-objects
* defined in the files in crypto/cipher subdirectory. these are
* declared external so that we can use these cipher types here
*/
extern srtp_cipher_type_t srtp_null_cipher;
extern srtp_cipher_type_t srtp_aes_icm_128;
extern srtp_cipher_type_t srtp_aes_icm_256;
#ifdef GCM
extern srtp_cipher_type_t srtp_aes_icm_192;
extern srtp_cipher_type_t srtp_aes_gcm_128;
extern srtp_cipher_type_t srtp_aes_gcm_256;
#endif
int main(int argc, char *argv[])
{
srtp_cipher_t *c = NULL;
srtp_err_status_t status;
/* clang-format off */
unsigned char test_key[48] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
};
/* clang-format on */
int q;
unsigned do_timing_test = 0;
unsigned do_validation = 0;
unsigned do_array_timing_test = 0;
/* process input arguments */
while (1) {
q = getopt_s(argc, argv, "tva");
if (q == -1)
break;
switch (q) {
case 't':
do_timing_test = 1;
break;
case 'v':
do_validation = 1;
break;
case 'a':
do_array_timing_test = 1;
break;
default:
usage(argv[0]);
}
}
printf("cipher test driver\n"
"David A. McGrew\n"
"Cisco Systems, Inc.\n");
if (!do_validation && !do_timing_test && !do_array_timing_test)
usage(argv[0]);
/* arry timing (cache thrash) test */
if (do_array_timing_test) {
int max_num_cipher = 1 << 16; /* number of ciphers in cipher_array */
int num_cipher;
for (num_cipher = 1; num_cipher < max_num_cipher; num_cipher *= 8)
cipher_driver_test_array_throughput(&srtp_null_cipher, 0,
num_cipher);
for (num_cipher = 1; num_cipher < max_num_cipher; num_cipher *= 8)
cipher_driver_test_array_throughput(
&srtp_aes_icm_128, SRTP_AES_ICM_128_KEY_LEN_WSALT, num_cipher);
for (num_cipher = 1; num_cipher < max_num_cipher; num_cipher *= 8)
cipher_driver_test_array_throughput(
&srtp_aes_icm_256, SRTP_AES_ICM_256_KEY_LEN_WSALT, num_cipher);
#ifdef GCM
for (num_cipher = 1; num_cipher < max_num_cipher; num_cipher *= 8)
cipher_driver_test_array_throughput(
&srtp_aes_icm_192, SRTP_AES_ICM_192_KEY_LEN_WSALT, num_cipher);
for (num_cipher = 1; num_cipher < max_num_cipher; num_cipher *= 8) {
cipher_driver_test_array_throughput(
&srtp_aes_gcm_128, SRTP_AES_GCM_128_KEY_LEN_WSALT, num_cipher);
}
for (num_cipher = 1; num_cipher < max_num_cipher; num_cipher *= 8) {
cipher_driver_test_array_throughput(
&srtp_aes_gcm_256, SRTP_AES_GCM_256_KEY_LEN_WSALT, num_cipher);
}
#endif
}
if (do_validation) {
cipher_driver_self_test(&srtp_null_cipher);
cipher_driver_self_test(&srtp_aes_icm_128);
cipher_driver_self_test(&srtp_aes_icm_256);
#ifdef GCM
cipher_driver_self_test(&srtp_aes_icm_192);
cipher_driver_self_test(&srtp_aes_gcm_128);
cipher_driver_self_test(&srtp_aes_gcm_256);
#endif
}
/* do timing and/or buffer_test on srtp_null_cipher */
status = srtp_cipher_type_alloc(&srtp_null_cipher, &c, 0, 0);
check_status(status);
status = srtp_cipher_init(c, NULL);
check_status(status);
if (do_timing_test)
cipher_driver_test_throughput(c);
if (do_validation) {
status = cipher_driver_test_buffering(c);
check_status(status);
}
status = srtp_cipher_dealloc(c);
check_status(status);
/* run the throughput test on the aes_icm cipher (128-bit key) */
status = srtp_cipher_type_alloc(&srtp_aes_icm_128, &c,
SRTP_AES_ICM_128_KEY_LEN_WSALT, 0);
if (status) {
fprintf(stderr, "error: can't allocate cipher\n");
exit(status);
}
status = srtp_cipher_init(c, test_key);
check_status(status);
if (do_timing_test)
cipher_driver_test_throughput(c);
if (do_validation) {
status = cipher_driver_test_buffering(c);
check_status(status);
}
status = srtp_cipher_dealloc(c);
check_status(status);
/* repeat the tests with 256-bit keys */
status = srtp_cipher_type_alloc(&srtp_aes_icm_256, &c,
SRTP_AES_ICM_256_KEY_LEN_WSALT, 0);
if (status) {
fprintf(stderr, "error: can't allocate cipher\n");
exit(status);
}
status = srtp_cipher_init(c, test_key);
check_status(status);
if (do_timing_test)
cipher_driver_test_throughput(c);
if (do_validation) {
status = cipher_driver_test_buffering(c);
check_status(status);
}
status = srtp_cipher_dealloc(c);
check_status(status);
#ifdef GCM
/* run the throughput test on the aes_gcm_128 cipher */
status = srtp_cipher_type_alloc(&srtp_aes_gcm_128, &c,
SRTP_AES_GCM_128_KEY_LEN_WSALT, 8);
if (status) {
fprintf(stderr, "error: can't allocate GCM 128 cipher\n");
exit(status);
}
status = srtp_cipher_init(c, test_key);
check_status(status);
if (do_timing_test) {
cipher_driver_test_throughput(c);
}
// GCM ciphers don't do buffering; they're "one shot"
status = srtp_cipher_dealloc(c);
check_status(status);
/* run the throughput test on the aes_gcm_256 cipher */
status = srtp_cipher_type_alloc(&srtp_aes_gcm_256, &c,
SRTP_AES_GCM_256_KEY_LEN_WSALT, 16);
if (status) {
fprintf(stderr, "error: can't allocate GCM 256 cipher\n");
exit(status);
}
status = srtp_cipher_init(c, test_key);
check_status(status);
if (do_timing_test) {
cipher_driver_test_throughput(c);
}
// GCM ciphers don't do buffering; they're "one shot"
status = srtp_cipher_dealloc(c);
check_status(status);
#endif
return 0;
}
void cipher_driver_test_throughput(srtp_cipher_t *c)
{
int i;
int min_enc_len = 32;
int max_enc_len = 2048; /* should be a power of two */
int num_trials = 1000000;
printf("timing %s throughput, key length %d:\n", c->type->description,
c->key_len);
fflush(stdout);
for (i = min_enc_len; i <= max_enc_len; i = i * 2)
printf("msg len: %d\tgigabits per second: %f\n", i,
srtp_cipher_bits_per_second(c, i, num_trials) / 1e9);
}
srtp_err_status_t cipher_driver_self_test(srtp_cipher_type_t *ct)
{
srtp_err_status_t status;
printf("running cipher self-test for %s...", ct->description);
status = srtp_cipher_type_self_test(ct);
if (status) {
printf("failed with error code %d\n", status);
exit(status);
}
printf("passed\n");
return srtp_err_status_ok;
}
/*
* cipher_driver_test_buffering(ct) tests the cipher's output
* buffering for correctness by checking the consistency of succesive
* calls
*/
#define INITIAL_BUFLEN 1024
srtp_err_status_t cipher_driver_test_buffering(srtp_cipher_t *c)
{
int i, j, num_trials = 1000;
unsigned len, buflen = INITIAL_BUFLEN;
uint8_t buffer0[INITIAL_BUFLEN], buffer1[INITIAL_BUFLEN], *current, *end;
uint8_t idx[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x34 };
srtp_err_status_t status;
printf("testing output buffering for cipher %s...", c->type->description);
for (i = 0; i < num_trials; i++) {
/* set buffers to zero */
for (j = 0; j < (int)buflen; j++) {
buffer0[j] = buffer1[j] = 0;
}
/* initialize cipher */
status = srtp_cipher_set_iv(c, (uint8_t *)idx, srtp_direction_encrypt);
if (status)
return status;
/* generate 'reference' value by encrypting all at once */
status = srtp_cipher_encrypt(c, buffer0, &buflen);
if (status)
return status;
/* re-initialize cipher */
status = srtp_cipher_set_iv(c, (uint8_t *)idx, srtp_direction_encrypt);
if (status)
return status;
/* now loop over short lengths until buffer1 is encrypted */
current = buffer1;
end = buffer1 + buflen;
while (current < end) {
/* choose a short length */
len = srtp_cipher_rand_u32_for_tests() & 0x01f;
/* make sure that len doesn't cause us to overreach the buffer */
if (current + len > end)
len = end - current;
status = srtp_cipher_encrypt(c, current, &len);
if (status)
return status;
/* advance pointer into buffer1 to reflect encryption */
current += len;
/* if buffer1 is all encrypted, break out of loop */
if (current == end)
break;
}
/* compare buffers */
for (j = 0; j < (int)buflen; j++) {
if (buffer0[j] != buffer1[j]) {
#if PRINT_DEBUG
printf("test case %d failed at byte %d\n", i, j);
printf("computed: %s\n",
octet_string_hex_string(buffer1, buflen));
printf("expected: %s\n",
octet_string_hex_string(buffer0, buflen));
#endif
return srtp_err_status_algo_fail;
}
}
}
printf("passed\n");
return srtp_err_status_ok;
}
/*
* The function cipher_test_throughput_array() tests the effect of CPU
* cache thrash on cipher throughput.
*
* cipher_array_alloc_init(ctype, array, num_ciphers) creates an array
* of srtp_cipher_t of type ctype
*/
srtp_err_status_t cipher_array_alloc_init(srtp_cipher_t ***ca,
int num_ciphers,
srtp_cipher_type_t *ctype,
int klen)
{
int i, j;
srtp_err_status_t status;
uint8_t *key;
srtp_cipher_t **cipher_array;
/* pad klen allocation, to handle aes_icm reading 16 bytes for the
14-byte salt */
int klen_pad = ((klen + 15) >> 4) << 4;
/* allocate array of pointers to ciphers */
cipher_array = (srtp_cipher_t **)srtp_crypto_alloc(sizeof(srtp_cipher_t *) *
num_ciphers);
if (cipher_array == NULL)
return srtp_err_status_alloc_fail;
/* set ca to location of cipher_array */
*ca = cipher_array;
/* allocate key */
key = srtp_crypto_alloc(klen_pad);
if (key == NULL) {
srtp_crypto_free(cipher_array);
return srtp_err_status_alloc_fail;
}
/* allocate and initialize an array of ciphers */
for (i = 0; i < num_ciphers; i++) {
/* allocate cipher */
status = srtp_cipher_type_alloc(ctype, cipher_array, klen, 16);
if (status)
return status;
/* generate random key and initialize cipher */
srtp_cipher_rand_for_tests(key, klen);
for (j = klen; j < klen_pad; j++)
key[j] = 0;
status = srtp_cipher_init(*cipher_array, key);
if (status)
return status;
/* printf("%dth cipher is at %p\n", i, *cipher_array); */
/* printf("%dth cipher description: %s\n", i, */
/* (*cipher_array)->type->description); */
/* advance cipher array pointer */
cipher_array++;
}
srtp_crypto_free(key);
return srtp_err_status_ok;
}
srtp_err_status_t cipher_array_delete(srtp_cipher_t *cipher_array[],
int num_cipher)
{
int i;
for (i = 0; i < num_cipher; i++) {
srtp_cipher_dealloc(cipher_array[i]);
}
srtp_crypto_free(cipher_array);
return srtp_err_status_ok;
}
/*
* cipher_array_bits_per_second(c, l, t) computes (an estimate of) the
* number of bits that a cipher implementation can encrypt in a second
* when distinct keys are used to encrypt distinct messages
*
* c is a cipher (which MUST be allocated an initialized already), l
* is the length in octets of the test data to be encrypted, and t is
* the number of trials
*
* if an error is encountered, the value 0 is returned
*/
uint64_t cipher_array_bits_per_second(srtp_cipher_t *cipher_array[],
int num_cipher,
unsigned octets_in_buffer,
int num_trials)
{
int i;
v128_t nonce;
clock_t timer;
unsigned char *enc_buf;
int cipher_index = srtp_cipher_rand_u32_for_tests() % num_cipher;
/* Over-alloc, for NIST CBC padding */
enc_buf = srtp_crypto_alloc(octets_in_buffer + 17);
if (enc_buf == NULL)
return 0; /* indicate bad parameters by returning null */
/* time repeated trials */
v128_set_to_zero(&nonce);
timer = clock();
for (i = 0; i < num_trials; i++, nonce.v32[3] = i) {
/* length parameter to srtp_cipher_encrypt is in/out -- out is total,
* padded
* length -- so reset it each time. */
unsigned octets_to_encrypt = octets_in_buffer;
/* encrypt buffer with cipher */
srtp_cipher_set_iv(cipher_array[cipher_index], (uint8_t *)&nonce,
srtp_direction_encrypt);
srtp_cipher_encrypt(cipher_array[cipher_index], enc_buf,
&octets_to_encrypt);
/* choose a cipher at random from the array*/
cipher_index = (*((uint32_t *)enc_buf)) % num_cipher;
}
timer = clock() - timer;
srtp_crypto_free(enc_buf);
if (timer == 0) {
/* Too fast! */
return 0;
}
return (uint64_t)CLOCKS_PER_SEC * num_trials * 8 * octets_in_buffer / timer;
}
void cipher_array_test_throughput(srtp_cipher_t *ca[], int num_cipher)
{
int i;
int min_enc_len = 16;
int max_enc_len = 2048; /* should be a power of two */
int num_trials = 1000000;
printf("timing %s throughput with key length %d, array size %d:\n",
(ca[0])->type->description, (ca[0])->key_len, num_cipher);
fflush(stdout);
for (i = min_enc_len; i <= max_enc_len; i = i * 4)
printf("msg len: %d\tgigabits per second: %f\n", i,
cipher_array_bits_per_second(ca, num_cipher, i, num_trials) /
1e9);
}
srtp_err_status_t cipher_driver_test_array_throughput(srtp_cipher_type_t *ct,
int klen,
int num_cipher)
{
srtp_cipher_t **ca = NULL;
srtp_err_status_t status;
status = cipher_array_alloc_init(&ca, num_cipher, ct, klen);
if (status) {
printf("error: cipher_array_alloc_init() failed with error code %d\n",
status);
return status;
}
cipher_array_test_throughput(ca, num_cipher);
cipher_array_delete(ca, num_cipher);
return srtp_err_status_ok;
}
|
30311d9a76b0dd5cbaa662e6748cd1e17d67dd40
|
59864cbd213b5da6f50d6255b0a021564b3d5bd4
|
/challenges/Recipe_and_Pantry_Manager/src/service.c
|
a91142b1c1591d8a169e7c0686eb525f098f2848
|
[
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-unknown",
"BSD-2-Clause"
] |
permissive
|
trailofbits/cb-multios
|
8af96a4fbc3b34644367faa135347f88e0e0d0a3
|
810d7b24b1f62f56ef49b148fe155b0d0629cad2
|
refs/heads/master
| 2023-09-05T03:56:20.229403
| 2022-12-27T15:47:54
| 2022-12-27T15:47:54
| 41,688,943
| 522
| 133
|
MIT
| 2023-06-29T02:47:13
| 2015-08-31T17:04:31
|
C
|
UTF-8
|
C
| false
| false
| 23,444
|
c
|
service.c
|
#include "libcgc.h"
#include "cgc_stdlib.h"
#include "cgc_stdio.h"
#include "cgc_string.h"
#include "cgc_malloc.h"
#include "cgc_ctype.h"
#define OUNCES 1
#define GRAMS 2
#define PANTRY_COUNT 128
#define RECIPE_COUNT 512
typedef struct instruction {
char text[128];
/// 4 byte cookie from magic page
cgc_size_t cookie;
struct instruction *next;
} instruction, *pinstruction;
typedef struct ingredient {
double amount;
double cost_per_unit;
// Ounces or grams
int type;
char name[16];
/// 4 byte cookie from magic page
cgc_size_t cookie;
struct ingredient *next;
} ingredient, *pingredient;
typedef struct pantry {
char name[16];
cgc_size_t cookie;
pingredient grocery_list;
} pantry, *ppantry;
typedef struct recipe {
char name[16];
/// 4 byte cookie from magic page
cgc_size_t cookie;
pingredient ing_list;
pinstruction ins_list;
} recipe, *precipe;
/// This is done to force ordering
typedef struct global {
pantry pantry_g[PANTRY_COUNT];
recipe recipe_list_g[RECIPE_COUNT];
} global, *pglobal;
global g;
cgc_size_t magic_index_g;
char *magic_page_g;
int cgc_read_selection( void )
{
int value = 2;
char data[2];
cgc_size_t bytes = 0;
cgc_size_t index = 0;
while ( value ) {
if ( cgc_receive( STDIN, data + index, value, &bytes) != 0 ) {
cgc_printf("[ERROR] Failed to read data\n");
cgc__terminate(-1);
}
if ( bytes == 0 ) {
cgc_printf("[ERROR] Error with reading selection\n");
cgc__terminate(-2);
}
index += bytes;
value -= bytes;
}
if ( !cgc_isdigit(data[0]) ) {
cgc_printf("[ERROR] Selection must be a digit\n");
return 0;
}
if ( data[1] != '\n') {
cgc_printf("[ERROR] Only single digits allowed in the selection\n");
return 0;
}
value = cgc_atoi( data );
return value;
}
int cgc_read_string( char *dest, cgc_size_t maxlen )
{
cgc_size_t index = 0;
cgc_size_t bytes_read = 0;
char c = 0;
if ( dest == NULL ) {
return index;
}
while ( index < maxlen ) {
if ( cgc_receive( STDIN, &c, 1, &bytes_read) != 0 ) {
cgc_printf("[ERROR] Failed to read string\n");
cgc__terminate(-3);
}
if ( bytes_read == 0 ) {
cgc_printf("[ERROR] String read failure\n");
cgc__terminate(-4);
}
if ( c == '\n') {
return index;
}
dest[index] = c;
index++;
}
return index;
}
cgc_size_t cgc_read_cookie( )
{
cgc_size_t cookie;
cookie = ((int *)magic_page_g)[magic_index_g/4];
magic_index_g += 4;
return cookie;
}
void cgc_display_banner( void )
{
cgc_size_t month = 0;
cgc_size_t year = 0;
cgc_size_t day = 0;
cgc_size_t hour = 0;
cgc_size_t minute = 0;
cgc_size_t second = 0;
month = ((unsigned char*)magic_page_g)[0] % 12;
year = 2016;
switch (month) {
case 1:
day = ((unsigned char*)magic_page_g)[10] %29;
break;
case 3:
case 6:
case 9:
case 11:
day = ((unsigned char*)magic_page_g)[10] %30;
break;
default:
day = ((unsigned char*)magic_page_g)[10] % 31;
break;
};
hour = ((unsigned char*)magic_page_g)[20] % 24;
minute = ((unsigned char*)magic_page_g)[30] % 60;
second = ((unsigned char*)magic_page_g)[40] % 60;
cgc_printf("Today: ");
switch ( ((unsigned char*)magic_page_g)[50] %7 ) {
case 0:
cgc_printf("Sun ");
break;
case 1:
cgc_printf("Mon ");
break;
case 2:
cgc_printf("Tue ");
break;
case 3:
cgc_printf("Wed ");
break;
case 4:
cgc_printf("Thu ");
break;
case 5:
cgc_printf("Fri ");
break;
case 6:
cgc_printf("Sat ");
break;
}
switch (month) {
case 0:
cgc_printf("Jan ");
break;
case 1:
cgc_printf("Feb ");
break;
case 2:
cgc_printf("Mar ");
break;
case 3:
cgc_printf("Apr ");
break;
case 4:
cgc_printf("May ");
break;
case 5:
cgc_printf("Jun ");
break;
case 6:
cgc_printf("Jul ");
break;
case 7:
cgc_printf("Aug ");
break;
case 8:
cgc_printf("Sep ");
break;
case 9:
cgc_printf("Oct ");
break;
case 10:
cgc_printf("Nov ");
break;
case 11:
cgc_printf("Dec ");
break;
}
cgc_printf("$.2d:$.2d:$.2d $d\n\n", hour, minute, second, year);
return;
}
pinstruction cgc_instruction_prompt()
{
pinstruction pins = NULL;
pins = (pinstruction)cgc_malloc( sizeof( instruction) );
if ( pins == NULL ) {
return pins;
}
cgc_bzero( pins, sizeof(instruction));
cgc_printf("Enter Instruction: ");
if ( cgc_read_string( pins->text, 127) == 0 ) {
cgc_free(pins);
return NULL;
}
if ( cgc_strcmp( pins->text, "done") == 0 ) {
cgc_free(pins);
return NULL;
}
pins->cookie = cgc_read_cookie();
return pins;
}
void cgc_recipe_menu( )
{
cgc_printf("1) Add Recipe\n");
cgc_printf("2) Remove Recipe\n");
cgc_printf("3) List Recipe\n");
cgc_printf("4) List All\n");
cgc_printf("5) Print Name\n");
cgc_printf("6) Recipe Costs\n");
cgc_printf("7) Leave Menu\n");
cgc_printf("-> ");
return;
}
pingredient cgc_ingredient_prompt( )
{
pingredient ping = NULL;
char data[6];
ping = ( pingredient )cgc_malloc( sizeof( ingredient) );
if ( ping == NULL ) {
return ping;
}
cgc_bzero( ping, sizeof(ingredient) );
cgc_printf("Enter ingredient name or a \"done\" to quit.\n");
cgc_printf(": ");
if ( cgc_read_string( ping->name, 15) == 0 ) {
cgc_free( ping );
return NULL;
}
if ( cgc_strcmp( ping->name, "done") == 0 ) {
cgc_free(ping);
return NULL;
}
cgc_bzero( data, 6);
cgc_printf("Enter the amount: ");
if ( cgc_read_string( data, 5) == 0 ) {
cgc_printf("[ERROR] Invalid amount\n");
cgc_free(ping);
return NULL;
}
ping->amount = cgc_atof( data );
cgc_bzero( data, 6);
cgc_printf("Enter the cost per unit: ");
if ( cgc_read_string( data, 5) == 0 ) {
cgc_printf("[ERROR] Invalid cost\n");
cgc_free(ping);
return NULL;
}
ping->cost_per_unit = cgc_atof( data );
cgc_printf("Enter the type (oz/gram): ");
cgc_bzero( data, 6 );
if ( cgc_read_string( data, 5 ) == 0 ) {
cgc_printf("[ERROR] Failed to read the measurement type.\n");
cgc_free(ping);
return NULL;
}
if ( cgc_strcmp( data, "oz" ) == 0 ) {
ping->type = OUNCES;
} else if ( cgc_strcmp( data, "gram") == 0 ) {
ping->type = GRAMS;
} else {
cgc_printf("[ERROR] Invalid type\n");
cgc_free(ping);
return NULL;
}
return ping;
}
void cgc_link_recipe_ingredient( precipe pr, pingredient ping )
{
if ( ping == NULL || pr == NULL ) {
return;
}
ping->next = pr->ing_list;
pr->ing_list = ping;
return;
}
int cgc_check_ingredient_exists( pingredient head, pingredient new)
{
pingredient walker = NULL;
if ( head == NULL || new == NULL ) {
return 0;
}
walker = head;
while ( walker ) {
if ( cgc_strcmp( walker->name, new->name) == 0) {
cgc_printf("Ingredient already exists. Adding the additional amount.");
walker->amount += new->amount;
return 1;
}
walker = walker->next;
}
return 0;
}
void cgc_link_recipe_instruction( precipe pr, pinstruction pins )
{
pinstruction walker = NULL;
if ( pins == NULL || pr == NULL ) {
return;
}
/// Base case
if ( pr->ins_list == NULL ) {
pr->ins_list = pins;
return;
}
walker = pr->ins_list;
while ( walker->next ) {
walker = walker->next;
}
walker->next = pins;
return;
}
void cgc_add_recipe( void )
{
int index = 0;
precipe pr = NULL;
pingredient ping = NULL;
pinstruction pins = NULL;
cgc_size_t t;
while ( g.recipe_list_g[index].cookie != 0 && index < RECIPE_COUNT) {
index++;
}
if ( index == RECIPE_COUNT ) {
cgc_printf("[ERROR] Recipe List is full\n");
return;
}
pr = &g.recipe_list_g[index];
cgc_bzero( pr, sizeof(recipe) );
cgc_printf("Enter recipe name: ");
if ( cgc_read_string( pr->name, 15 ) == 0 ) {
cgc_printf("[ERROR] Invalid recipe name\n");
return;
}
t = index;
/// Ensure that the recipe name does not already exist
for ( index = 0; index < RECIPE_COUNT; index++) {
if ( index == t ) {
continue;
}
if ( g.recipe_list_g[index].cookie == 0 ) {
continue;
}
if ( cgc_strcmp( g.recipe_list_g[index].name, g.recipe_list_g[t].name) == 0 ) {
cgc_printf("[ERROR] Recipe already exists with that name.\n");
cgc_bzero(pr->name, 16);
return;
}
}
pr->cookie = cgc_read_cookie();
do {
ping = cgc_ingredient_prompt();
if ( cgc_check_ingredient_exists( pr->ing_list, ping ) ) {
cgc_free( ping );
} else {
cgc_link_recipe_ingredient( pr, ping );
}
} while ( ping != NULL );
do {
pins = cgc_instruction_prompt();
cgc_link_recipe_instruction(pr, pins);
} while ( pins != NULL );
return;
}
void cgc_print_recipe( int index )
{
pingredient ing_walker = NULL;
pinstruction ins_walker = NULL;
cgc_size_t item = 1;
if ( RECIPE_COUNT <= index ) {
cgc_printf("[ERROR] Invalid index: $d\n", index);
return;
}
if ( g.recipe_list_g[index].cookie == 0 ) {
cgc_printf("[ERROR] Empty recipe: $d\n", index+1);
return;
}
cgc_printf("Name: $s\n", g.recipe_list_g[index].name);
cgc_printf("Ingredients:\n");
ing_walker = g.recipe_list_g[index].ing_list;
while ( ing_walker ) {
cgc_printf("\t$f ", ing_walker->amount);
if ( ing_walker->type == OUNCES ) {
cgc_printf("oz\t");
} else {
cgc_printf("g\t");
}
cgc_printf("$s\n", ing_walker->name);
ing_walker = ing_walker->next;
}
ins_walker = g.recipe_list_g[index].ins_list;
cgc_printf("\nInstructions:\n");
while ( ins_walker ) {
cgc_printf("\t$d) $s\n", item, ins_walker->text);
item++;
ins_walker = ins_walker->next;
}
cgc_printf("\n\n");
return;
}
void cgc_list_recipe( void )
{
char data[5];
int choice = 0;
cgc_bzero(data, 5 );
cgc_printf("Recipe Index [1..512]: ");
if ( cgc_read_string( data, 5 ) == 0 ) {
return;
}
choice = cgc_atoi( data );
if ( choice <= 0 || RECIPE_COUNT < choice)
{
cgc_printf( "[ERROR] Must be between 1 and 512\n");
return;
}
cgc_print_recipe( choice-1 );
return;
}
void cgc_list_all( void )
{
int i = 0;
for ( i = 0; i < RECIPE_COUNT; i++) {
if ( g.recipe_list_g[i].cookie != 0 ) {
cgc_printf("Index: $d\n", i+1);
cgc_print_recipe( i );
}
}
return;
}
void cgc_remove_recipe( )
{
char data[4];
int choice = 0;
cgc_bzero(data, 4 );
cgc_list_all();
cgc_printf("Recipe Index [1..512]: ");
if ( cgc_read_string( data, 4 ) == 0 ) {
return;
}
choice = cgc_atoi( data );
if ( choice <= 0 || RECIPE_COUNT < choice ) {
cgc_printf( "[ERROR] Must be between 1 and 512\n");
return;
}
if ( g.recipe_list_g[choice-1].cookie == 0 ) {
cgc_printf("[ERROR] Empty recipe\n");
return;
}
cgc_bzero( &(g.recipe_list_g[choice-1]), sizeof(recipe) );
return;
}
void cgc_print_recipe_costs( void )
{
double total = 0.0;
cgc_size_t index = 0;
pingredient walker = NULL;
cgc_printf("Recipe Costs:\n");
for ( index = 0; index < RECIPE_COUNT; index++) {
total = 0.0;
if ( g.recipe_list_g[index].cookie == 0 ) {
continue;
}
for ( walker = g.recipe_list_g[index].ing_list; walker != NULL; walker = walker->next) {
total += walker->cost_per_unit * walker->amount;
}
cgc_printf("\t$d) $s - $$.5f\n", index+1, g.recipe_list_g[index].name, total);
}
return;
}
void cgc_print_recipe_name( void )
{
char data[5];
int choice = 0;
cgc_bzero(data, 5 );
cgc_printf("Recipe Index [1..512]: ");
if ( cgc_read_string( data, 5 ) == 0 ) {
return;
}
choice = cgc_atoi( data );
#ifdef PATCHED_1
if ( choice <= 0 || RECIPE_COUNT < choice)
#else
if ( RECIPE_COUNT < choice )
#endif
{
cgc_printf("[ERROR] Invalid index: $d\n", choice);
return;
}
if ( g.recipe_list_g[choice-1].cookie == 0 ) {
cgc_printf("[ERROR] Empty recipe: $d\n", choice);
return;
}
cgc_printf("Single Name: $s\n", g.recipe_list_g[choice-1].name);
return;
}
void cgc_handle_recipe( )
{
int choice = 0;
while ( 1 ) {
cgc_recipe_menu();
choice = cgc_read_selection();
switch ( choice ) {
case 1:
cgc_add_recipe();
break;
case 2:
cgc_remove_recipe();
break;
case 3:
cgc_list_recipe();
break;
case 4:
cgc_list_all();
break;
case 5:
cgc_print_recipe_name();
break;
case 6:
cgc_print_recipe_costs();
break;
case 7:
cgc_printf("Leave\n");
return;
break;
default:
cgc_printf("Invalid selection.\n");
};
}
}
void cgc_pantry_menu( )
{
cgc_printf( "1) Create Pantry\n");
cgc_printf( "2) Delete Pantry\n");
cgc_printf( "3) Print Pantry\n");
cgc_printf( "4) Print All Pantries\n");
cgc_printf( "5) Update Pantry\n");
cgc_printf( "6) Leave Menu\n");
cgc_printf("-> ");
return;
}
void cgc_init_globals( char *secret_page )
{
cgc_bzero( &g.pantry_g, sizeof(pantry) * PANTRY_COUNT);
cgc_bzero( &g.recipe_list_g, sizeof(recipe) * RECIPE_COUNT);
magic_index_g = 0;
magic_page_g = secret_page;
return;
}
void cgc_link_pantry_ingredient( ppantry pp, pingredient ping )
{
if ( ping == NULL || pp == NULL ) {
return;
}
ping->next = pp->grocery_list;
pp->grocery_list = ping;
return;
}
void cgc_print_single_pantry( cgc_size_t index )
{
pingredient pw = NULL;
cgc_size_t item = 1;
if ( PANTRY_COUNT <= index ) {
cgc_printf("[ERROR] Invalid index: $d\n", index);
return;
}
if ( g.pantry_g[index].cookie == 0 ) {
cgc_printf("[ERROR] Empty pantry: $d\n", index+1);
return;
}
cgc_printf("Name: $s\n", g.pantry_g[index].name);
cgc_printf("Item:\n");
pw = g.pantry_g[index].grocery_list;
while ( pw ) {
cgc_printf("\t$f ", pw->amount);
if ( pw->type == OUNCES ) {
cgc_printf("oz\t");
} else {
cgc_printf("g\t");
}
cgc_printf("$s\n", pw->name);
pw = pw->next;
}
cgc_printf("\n\n");
return;
}
void cgc_print_pantry( void )
{
char data[4];
int choice = 0;
cgc_bzero(data, 4 );
cgc_printf("Pantry Index [1..128]: ");
if ( cgc_read_string( data, 4 ) == 0 ) {
return;
}
choice = cgc_atoi( data );
if ( choice <= 0 || PANTRY_COUNT < choice ) {
cgc_printf( "[ERROR] Must be between 1 and 128\n");
return;
}
cgc_print_single_pantry( choice-1 );
return;
}
void cgc_create_pantry( void )
{
int index = 0;
ppantry pp = NULL;
pingredient ping = NULL;
int t = 0;
while ( g.pantry_g[index].cookie != 0 && index < PANTRY_COUNT) {
index++;
}
if ( index == PANTRY_COUNT ) {
cgc_printf("[ERROR] Pantry List is full\n");
return;
}
pp = &g.pantry_g[index];
cgc_bzero( pp, sizeof(pantry) );
cgc_printf("Enter pantry name: ");
if ( cgc_read_string( pp->name, 15 ) == 0 ) {
cgc_printf("[ERROR] Invalid pantry name\n");
return;
}
t = index;
/// Ensure that the pantry name does not already exist
for ( index = 0; index < PANTRY_COUNT; index++) {
if ( index == t ) {
continue;
}
if ( g.pantry_g[index].cookie == 0 ) {
continue;
}
if ( cgc_strcmp( g.pantry_g[index].name, g.pantry_g[t].name) == 0 ) {
cgc_printf("[ERROR] Pantry already exists with that name.\n");
cgc_bzero(pp->name, 16);
return;
}
}
pp->cookie = cgc_read_cookie();
do {
ping = cgc_ingredient_prompt();
if ( cgc_check_ingredient_exists( pp->grocery_list, ping ) ) {
cgc_free(ping);
} else {
cgc_link_pantry_ingredient( pp, ping );
}
} while ( ping != NULL );
return;
}
void cgc_list_all_pantries( void )
{
int i = 0;
for ( i = 0; i < PANTRY_COUNT; i++) {
if ( g.pantry_g[i].cookie != 0 ) {
cgc_printf("Index: $d\n", i+1);
cgc_print_single_pantry( i );
}
}
return;
}
void cgc_delete_pantry( void )
{
char data[4];
int choice = 0;
cgc_bzero(data, 4 );
cgc_list_all_pantries();
cgc_printf("Pantry Index [1..128]: ");
if ( cgc_read_string( data, 4 ) == 0 ) {
return;
}
choice = cgc_atoi( data );
if ( choice <= 0 || PANTRY_COUNT < choice ) {
cgc_printf( "[ERROR] Must be between 1 and 128\n");
return;
}
if ( g.pantry_g[choice-1].cookie == 0 ) {
cgc_printf("[ERROR] Empty pantry\n");
return;
}
cgc_bzero( &(g.pantry_g[choice-1]), sizeof(pantry) );
return;
}
void cgc_update_pantry( void )
{
char data[16];
int choice = 0;
ppantry pp = NULL;
pingredient ing_walker = NULL;
cgc_bzero(data, 16 );
cgc_list_all_pantries();
cgc_printf("Pantry Index [1..128]: ");
if ( cgc_read_string( data, 4 ) == 0 ) {
return;
}
choice = cgc_atoi( data );
if ( choice <= 0 || PANTRY_COUNT < choice ) {
cgc_printf( "[ERROR] Must be between 1 and 128\n");
return;
}
if ( g.pantry_g[choice-1].cookie == 0 ) {
cgc_printf("[ERROR] Empty pantry\n");
return;
}
pp = &g.pantry_g[choice-1];
cgc_print_single_pantry( choice-1 );
cgc_printf("Which item to update: ");
cgc_bzero( data, 16 );
if ( cgc_read_string( data, 15) == 0 ) {
return;
}
ing_walker = pp->grocery_list;
while ( ing_walker ) {
if ( cgc_strcmp( ing_walker->name, data ) != 0 ) {
ing_walker = ing_walker->next;
} else {
break;
}
}
if ( ing_walker == NULL ) {
cgc_printf("This pantry does not have $s\n", data );
return;
}
cgc_bzero( data, 16);
cgc_printf("Enter the amount: ");
if ( cgc_read_string( data, 5) == 0 ) {
cgc_printf("[ERROR] Invalid amount\n");
return;
}
ing_walker->amount = cgc_atof( data );
cgc_printf("Enter the type (oz/gram): ");
cgc_bzero( data, 16 );
if ( cgc_read_string( data, 5 ) == 0 ) {
cgc_printf("[ERROR] Failed to read the measurement type.\n");
return;
}
if ( cgc_strcmp( data, "oz" ) == 0 ) {
ing_walker->type = OUNCES;
} else if ( cgc_strcmp( data, "gram") == 0 ) {
ing_walker->type = GRAMS;
} else {
cgc_printf("[ERROR] Invalid type\n");
}
return;
}
void cgc_handle_pantry( void )
{
int choice = 0;
while ( 1 ) {
cgc_pantry_menu();
choice = cgc_read_selection();
switch (choice) {
case 1:
cgc_create_pantry();
break;
case 2:
cgc_delete_pantry();
break;
case 3:
cgc_print_pantry();
break;
case 4:
cgc_list_all_pantries();
break;
case 5:
cgc_update_pantry();
break;
case 6:
cgc_printf("Leave.\n");
return;
break;
default:
cgc_printf("Invalid selection\n");
break;
};
}
return;
}
void cgc_query_recipes( void )
{
cgc_size_t index;
char data[16];
cgc_size_t selection;
int found;
/// Recipe ingredient walker
pingredient riw = NULL;
/// Pantry ingredient walker
pingredient piw = NULL;
cgc_printf("Select a pantry:\n");
for ( index = 0; index < PANTRY_COUNT; index++) {
if ( g.pantry_g[index].cookie != 0 ) {
cgc_printf("$d) $s\n", index+1, g.pantry_g[index].name);
}
}
cgc_printf("-> ");
if ( cgc_read_string( data, 4 ) == 0 ) {
return;
}
selection = cgc_atoi( data );
if ( selection <= 0 || PANTRY_COUNT < selection) {
cgc_printf("[ERROR] Invalid selection\n");
return;
}
if ( g.pantry_g[selection-1].cookie == 0 ) {
cgc_printf("[ERROR] Empty pantry\n");
return;
}
/// Loop through each recipe.
/// For each ingredient loop through the grocery list of the pantry
/// If the ingredient is found, check the amount.
/// If there is enough then check the next ingredient
/// If not then move on to the next recipe.
for ( index = 0; index < RECIPE_COUNT; index ++ ) {
if ( g.recipe_list_g[index].cookie == 0 ) {
continue;
}
found = 0;
for ( riw = g.recipe_list_g[index].ing_list; riw != NULL; riw = riw->next ) {
found = 0;
for ( piw = g.pantry_g[selection-1].grocery_list; piw != NULL && found == 0; piw = piw->next ) {
if ( cgc_strcmp( piw->name, riw->name) != 0 ) {
continue;
}
if ( piw->amount < riw->amount) {
continue;
}
found = 1;
}
if ( found == 0 ) {
break;
}
}
if ( found != 0 ) {
cgc_printf("You can make: $s\n", g.recipe_list_g[index].name);
}
}
return;
}
void cgc_query_by_price( void )
{
char data[10];
double max = 0.0;
cgc_size_t index = 0;
pingredient walker = NULL;
double total = 0.0;
cgc_bzero( data, 10);
cgc_printf("How much can you spend: ");
if ( cgc_read_string( data, 9 ) == 0 ) {
return;
}
max = cgc_atof( data );
cgc_printf("You can make: \n");
for ( index = 0; index < RECIPE_COUNT; index++) {
total = 0.0;
if ( g.recipe_list_g[index].cookie == 0 ) {
continue;
}
for ( walker = g.recipe_list_g[index].ing_list; walker != NULL; walker = walker->next) {
total += walker->cost_per_unit * walker->amount;
}
if ( total <= max ) {
cgc_printf("\t$d) $s\n", index+1, g.recipe_list_g[index].name);
}
}
return;
}
void cgc_print_cheapest( void )
{
double cheapest_value = 0.0;
cgc_size_t cheapest_index = 0;
cgc_size_t index = 0;
pingredient walker = NULL;
double total = 0.0;
for ( index = 0; index < RECIPE_COUNT; index++) {
total = 0.0;
if ( g.recipe_list_g[index].cookie == 0 ) {
continue;
}
for ( walker = g.recipe_list_g[index].ing_list; walker != NULL; walker = walker->next) {
total += walker->cost_per_unit * walker->amount;
}
/// If this is the first one then it is automatically the cheapest
if ( cheapest_index == 0 ) {
cheapest_index = index+1;
cheapest_value = total;
} else if ( total < cheapest_value ) {
cheapest_value = total;
cheapest_index = index+1;
}
}
if ( cheapest_index == 0 ) {
cgc_printf("No cheapest recipe found\n");
} else {
cgc_printf("Cheapest: $d at $f\n", cheapest_index, cheapest_value);
}
return;
}
void cgc_print_expensivest( void )
{
double expensivest_value = 0.0;
cgc_size_t expensivest_index = 0;
cgc_size_t index = 0;
pingredient walker = NULL;
double total = 0.0;
for ( index = 0; index < RECIPE_COUNT; index++) {
total = 0.0;
if ( g.recipe_list_g[index].cookie == 0 ) {
continue;
}
for ( walker = g.recipe_list_g[index].ing_list; walker != NULL; walker = walker->next) {
total += walker->cost_per_unit * walker->amount;
}
/// If this is the first one then it is automatically the most expensive
if ( expensivest_index == 0 ) {
expensivest_index = index + 1;
expensivest_value = total;
} else if ( expensivest_value < total ) {
expensivest_value = total;
expensivest_index = index+1;
}
}
if ( expensivest_index == 0 ) {
cgc_printf("The most expensive recipe was not found\n");
} else {
cgc_printf("Most expensive: $d at $f\n", expensivest_index, expensivest_value);
}
return;
}
void cgc_query_menu( void )
{
int value = 0;
while ( 1 ) {
cgc_printf("1) List Doable Recipes by Pantry\n");
cgc_printf("2) List Doable Recipes by Cost\n");
cgc_printf("3) Print Cheapest Recipe\n");
cgc_printf("4) Print Most Expensive Recipe\n");
cgc_printf("5) Leave Menu\n");
cgc_printf("-> ");
value = cgc_read_selection();
switch(value) {
case 1:
cgc_query_recipes();
break;
case 2:
cgc_query_by_price();
break;
case 3:
cgc_print_cheapest();
break;
case 4:
cgc_print_expensivest();
break;
case 5:
cgc_printf("Leaving..\n");
return;
break;
default:
cgc_printf("[ERROR] Invalid selection\n");
break;
};
}
return;
}
int main(int secret_page_i, char *unused[]) {
secret_page_i = CGC_FLAG_PAGE_ADDRESS;
int value = 0;
cgc_size_t eax;
cgc_size_t eip;
cgc_init_globals( (char*)secret_page_i);
cgc_display_banner();
while ( 1 ) {
cgc_printf( "1) Recipe Menu\n");
cgc_printf( "2) Pantry Menu\n");
cgc_printf( "3) Query Recipe\n");
cgc_printf( "4) Quit\n");
cgc_printf( "-> ");
value = cgc_read_selection( );
switch (value) {
case 1:
cgc_handle_recipe();
break;
case 2:
cgc_handle_pantry();
break;
case 3:
cgc_query_menu();
break;
case 4:
cgc_printf("Quit\n");
cgc__terminate(0);
break;
default:
cgc_printf("unknown\n");
break;
};
}
return 0;
}
|
73151236247875db45536037cf99b4034877c29d
|
64c15184fc010a59b023d5accd0320d8e3bbdc26
|
/src/libsphinxad/ad_win32.c
|
42432608f1f5878f6ef359db131d6d4e338411fe
|
[
"BSD-2-Clause"
] |
permissive
|
cmusphinx/sphinxbase
|
eb8e5396e167ffae4a459259ce61906ecc0b0995
|
617e53691889336a482631380f75b453445d0dae
|
refs/heads/master
| 2023-09-04T07:07:21.475689
| 2022-06-09T11:34:54
| 2022-06-09T11:34:54
| 18,513,481
| 575
| 358
|
NOASSERTION
| 2022-02-21T16:37:19
| 2014-04-07T10:29:59
|
C
|
UTF-8
|
C
| false
| false
| 13,650
|
c
|
ad_win32.c
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* ====================================================================
* Copyright (c) 1999-2001 Carnegie Mellon University. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* This work was supported in part by funding from the Defense Advanced
* Research Projects Agency and the National Science Foundation of the
* United States of America, and the CMU Sphinx Speech Consortium.
*
* THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
* ANY EXPRESSED 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 CARNEGIE MELLON UNIVERSITY
* NOR ITS EMPLOYEES 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.
*
* ====================================================================
*
*/
/*
* rec.c -- low level audio recording for Windows NT/95.
*
* HISTORY
*
* 19-Jan-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
* Added AD_ return codes. Added ad_open_sps_bufsize(), and
* ad_rec_t.n_buf.
*
* 07-Mar-98 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
* Added ad_open_sps(), and made ad_open() call it.
*
* 10-Jun-96 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
* Added ad_rec_t type to all calls.
*
* 03-Jun-96 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
* Created.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sphinxbase/prim_type.h"
#include "sphinxbase/ad.h"
#if defined (__CYGWIN__)
#include <w32api/windows.h>
#include <w32api/mmsystem.h>
#elif (defined(_WIN32) && !defined(GNUWINCE)) || defined(_WIN32_WCE)
#include <windows.h>
#include <mmsystem.h>
#endif
typedef struct {
HGLOBAL h_whdr;
LPWAVEHDR p_whdr;
HGLOBAL h_buf;
LPSTR p_buf;
} ad_wbuf_t;
/**
* Audio recording structure.
*/
struct ad_rec_s {
HWAVEIN h_wavein; /* "HANDLE" to the audio input device */
ad_wbuf_t *wi_buf; /* Recording buffers provided to system */
int32 n_buf; /* #Recording buffers provided to system */
int32 opened; /* Flag; A/D opened for recording */
int32 recording;
int32 curbuf; /* Current buffer with data for application */
int32 curoff; /* Start of data for application in curbuf */
int32 curlen; /* #samples of data from curoff in curbuf */
int32 lastbuf; /* Last buffer containing data after recording stopped */
int32 sps; /* Samples/sec */
int32 bps; /* Bytes/sample */
};
#define DEFAULT_N_WI_BUF 32 /* #Recording bufs */
#define WI_BUFSIZE 2500 /* Samples/buf (Why this specific value??
So that at reasonable sampling rates
data is returned frequently enough.) */
#ifdef _WIN32_WCE
#include "sphinxbase/ckd_alloc.h"
static void
wavein_error(char *src, int32 ret)
{
TCHAR errbuf[512];
wchar_t* werrbuf;
size_t len;
waveOutGetErrorText(ret, errbuf, sizeof(errbuf));
len = mbstowcs(NULL, errbuf, 0) + 1;
werrbuf = ckd_calloc(len, sizeof(*werrbuf));
mbstowcs(werrbuf, errbuf, len);
OutputDebugStringW(werrbuf);
}
#else
static void
wavein_error(char *src, int32 ret)
{
char errbuf[1024];
waveInGetErrorText(ret, errbuf, sizeof(errbuf));
fprintf(stderr, "%s error %d: %s\n", src, ret, errbuf);
}
#endif
static void
wavein_free_buf(ad_wbuf_t * b)
{
GlobalUnlock(b->h_whdr);
GlobalFree(b->h_whdr);
GlobalUnlock(b->h_buf);
GlobalFree(b->h_buf);
}
static int32
wavein_alloc_buf(ad_wbuf_t * b, int32 samples_per_buf)
{
HGLOBAL h_buf; /* handle to data buffer */
LPSTR p_buf; /* pointer to data buffer */
HGLOBAL h_whdr; /* handle to header */
LPWAVEHDR p_whdr; /* pointer to header */
/* Allocate data buffer */
h_buf =
GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE,
samples_per_buf * sizeof(int16));
if (!h_buf) {
fprintf(stderr, "GlobalAlloc failed\n");
return -1;
}
if ((p_buf = GlobalLock(h_buf)) == NULL) {
GlobalFree(h_buf);
fprintf(stderr, "GlobalLock failed\n");
return -1;
}
/* Allocate WAVEHDR structure */
h_whdr = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, sizeof(WAVEHDR));
if (h_whdr == NULL) {
GlobalUnlock(h_buf);
GlobalFree(h_buf);
fprintf(stderr, "GlobalAlloc failed\n");
return -1;
}
if ((p_whdr = GlobalLock(h_whdr)) == NULL) {
GlobalUnlock(h_buf);
GlobalFree(h_buf);
GlobalFree(h_whdr);
fprintf(stderr, "GlobalLock failed\n");
return -1;
}
b->h_buf = h_buf;
b->p_buf = p_buf;
b->h_whdr = h_whdr;
b->p_whdr = p_whdr;
p_whdr->lpData = p_buf;
p_whdr->dwBufferLength = samples_per_buf * sizeof(int16);
p_whdr->dwUser = 0L;
p_whdr->dwFlags = 0L;
p_whdr->dwLoops = 0L;
return 0;
}
static int32
wavein_enqueue_buf(HWAVEIN h, LPWAVEHDR whdr)
{
int32 st;
if ((st = waveInPrepareHeader(h, whdr, sizeof(WAVEHDR))) != 0) {
wavein_error("waveInPrepareHeader", st);
return -1;
}
if ((st = waveInAddBuffer(h, whdr, sizeof(WAVEHDR))) != 0) {
wavein_error("waveInAddBuffer", st);
return -1;
}
return 0;
}
static HWAVEIN
wavein_open(int32 samples_per_sec, int32 bytes_per_sample, unsigned int device_id)
{
WAVEFORMATEX wfmt;
int32 st;
HWAVEIN h;
if (bytes_per_sample != sizeof(int16)) {
fprintf(stderr, "bytes/sample != %d\n", sizeof(int16));
return NULL;
}
wfmt.wFormatTag = WAVE_FORMAT_PCM;
wfmt.nChannels = 1;
wfmt.nSamplesPerSec = samples_per_sec;
wfmt.nAvgBytesPerSec = samples_per_sec * bytes_per_sample;
wfmt.nBlockAlign = bytes_per_sample;
wfmt.wBitsPerSample = 8 * bytes_per_sample;
/* There should be a check here for a device of the desired type; later... */
st = waveInOpen((LPHWAVEIN) & h, device_id,
(LPWAVEFORMATEX) & wfmt, (DWORD) 0L, 0L,
(DWORD) CALLBACK_NULL);
if (st != 0) {
wavein_error("waveInOpen", st);
return NULL;
}
return h;
}
static int32
wavein_close(ad_rec_t * r)
{
int32 i, st;
/* Unprepare all buffers; multiple unprepares of the same buffer are benign */
for (i = 0; i < r->n_buf; i++) {
/* Unpreparing an unprepared buffer, on the other hand, fails
on Win98/WinME, though this is not documented - dhuggins@cs,
2004-07-14 */
if (!(r->wi_buf[i].p_whdr->dwFlags & WHDR_PREPARED))
continue;
st = waveInUnprepareHeader(r->h_wavein,
r->wi_buf[i].p_whdr, sizeof(WAVEHDR));
if (st != 0) {
wavein_error("waveInUnprepareHeader", st);
return -1;
}
}
/* Free buffers */
for (i = 0; i < r->n_buf; i++)
wavein_free_buf(&(r->wi_buf[i]));
free(r->wi_buf);
if ((st = waveInClose(r->h_wavein)) != 0) {
wavein_error("waveInClose", st);
return -1;
}
free(r);
return 0;
}
ad_rec_t *
ad_open_sps_bufsize(int32 sps, int32 bufsize_msec, unsigned int device_id)
{
ad_rec_t *r;
int32 i, j;
HWAVEIN h;
if ((h = wavein_open(sps, sizeof(int16), device_id)) == NULL)
return NULL;
if ((r = (ad_rec_t *) malloc(sizeof(ad_rec_t))) == NULL) {
fprintf(stderr, "malloc(%d) failed\n", sizeof(ad_rec_t));
waveInClose(h);
return NULL;
}
r->n_buf = ((sps * bufsize_msec) / 1000) / WI_BUFSIZE;
if (r->n_buf < DEFAULT_N_WI_BUF)
r->n_buf = DEFAULT_N_WI_BUF;
if ((r->wi_buf =
(ad_wbuf_t *) calloc(r->n_buf, sizeof(ad_wbuf_t))) == NULL) {
fprintf(stderr, "calloc(%d,%d) failed\n", r->n_buf,
sizeof(ad_wbuf_t));
free(r);
waveInClose(h);
return NULL;
}
for (i = 0; i < r->n_buf; i++) {
if (wavein_alloc_buf(&(r->wi_buf[i]), WI_BUFSIZE) < 0) {
for (j = 0; j < i; j++)
wavein_free_buf(&(r->wi_buf[j]));
free(r->wi_buf);
free(r);
waveInClose(h);
return NULL;
}
}
r->h_wavein = h;
r->opened = 1;
r->recording = 0;
r->curbuf = r->n_buf - 1; /* current buffer with data for application */
r->curlen = 0; /* #samples in curbuf remaining to be consumed */
r->lastbuf = r->curbuf;
r->sps = sps;
r->bps = sizeof(int16); /* HACK!! Hardwired value for bytes/sec */
return r;
}
ad_rec_t *
ad_open_dev(const char *dev, int32 sps)
{
unsigned int device_num = WAVE_MAPPER;
/* Convert given deviceId parameter to int */
if (dev != NULL && sscanf(dev, "%d", &device_num) != EOF) {
if (device_num >= waveInGetNumDevs()) {
device_num = WAVE_MAPPER;
}
}
return (ad_open_sps_bufsize
(sps, WI_BUFSIZE * DEFAULT_N_WI_BUF * 1000 / sps, device_num));
}
ad_rec_t *
ad_open_sps(int32 sps)
{
return (ad_open_sps_bufsize
(sps, WI_BUFSIZE * DEFAULT_N_WI_BUF * 1000 / sps, WAVE_MAPPER));
}
ad_rec_t *
ad_open(void)
{
return (ad_open_sps(DEFAULT_SAMPLES_PER_SEC)); /* HACK!! Rename this constant */
}
int32
ad_close(ad_rec_t * r)
{
if (!r->opened)
return AD_ERR_NOT_OPEN;
if (r->recording)
if (ad_stop_rec(r) < 0)
return AD_ERR_WAVE;
if (wavein_close(r) < 0)
return AD_ERR_WAVE;
return 0;
}
int32
ad_start_rec(ad_rec_t * r)
{
int32 i;
if ((!r->opened) || r->recording)
return -1;
for (i = 0; i < r->n_buf; i++)
if (wavein_enqueue_buf(r->h_wavein, r->wi_buf[i].p_whdr) < 0)
return AD_ERR_WAVE;
r->curbuf = r->n_buf - 1; /* current buffer with data for application */
r->curlen = 0; /* #samples in curbuf remaining to be consumed */
if (waveInStart(r->h_wavein) != 0)
return AD_ERR_WAVE;
r->recording = 1;
return 0;
}
int32
ad_stop_rec(ad_rec_t * r)
{
int32 i, st;
if ((!r->opened) || (!r->recording))
return -1;
if (waveInStop(r->h_wavein) != 0)
return AD_ERR_WAVE;
if ((st = waveInReset(r->h_wavein)) != 0) {
wavein_error("waveInReset", st);
return AD_ERR_WAVE;
}
/* Wait until all buffers marked done */
for (i = 0; i < r->n_buf; i++)
while (!(r->wi_buf[i].p_whdr->dwFlags & WHDR_DONE));
if ((r->lastbuf = r->curbuf - 1) < 0)
r->lastbuf = r->n_buf - 1;
r->recording = 0;
return 0;
}
int32
ad_read(ad_rec_t * r, int16 * buf, int32 max)
{
int32 t, st, len;
LPWAVEHDR whdr;
int16 *sysbufp;
if (!r->opened)
return AD_ERR_NOT_OPEN;
/* Check if all recorded data exhausted */
if ((!r->recording) && (r->curbuf == r->lastbuf)
&& (r->curlen == 0))
return AD_EOF;
len = 0;
while (max > 0) {
/* Look for next buffer with recording data */
if (r->curlen == 0) {
/* No current buffer with data; get next buffer in sequence if available */
t = r->curbuf + 1;
if (t >= r->n_buf)
t = 0;
if (!(r->wi_buf[t].p_whdr->dwFlags & WHDR_DONE))
return len;
r->curbuf = t;
r->curlen = r->wi_buf[t].p_whdr->dwBytesRecorded >> 1;
r->curoff = 0;
}
/* Copy data from curbuf to buf */
whdr = r->wi_buf[r->curbuf].p_whdr;
t = (max < r->curlen) ? max : r->curlen; /* #Samples to copy */
if (t > 0) {
sysbufp = (int16 *) (whdr->lpData);
memcpy(buf, sysbufp + r->curoff, t * sizeof(int16));
buf += t;
max -= t;
r->curoff += t;
r->curlen -= t;
len += t;
}
/* If curbuf empty recycle it to system if still recording */
if (r->curlen == 0) {
if (r->recording) {
/* Return empty buffer to system */
st = waveInUnprepareHeader(r->h_wavein,
whdr, sizeof(WAVEHDR));
if (st != 0) {
wavein_error("waveInUnprepareHeader", st);
return AD_ERR_WAVE;
}
if (wavein_enqueue_buf(r->h_wavein, whdr) < 0)
return AD_ERR_WAVE;
}
else if (r->curbuf == r->lastbuf) {
return len;
}
}
}
return len;
}
|
fe1987cd9c3af1a2eae1c8fadd00935a08f4fa86
|
909095842af0bbf2e769aff361b5af344abc7433
|
/engine/source/console/taggedStrings_ScriptBinding.h
|
91a685f274787f024c3128eeae00019ad5760215
|
[
"MIT"
] |
permissive
|
TorqueGameEngines/Torque2D
|
316105e8b91cebf8660ff43871440e1c4d0b1c5e
|
2c555d6dd0172a05ddb6a14f014d22f335b4ccad
|
refs/heads/master
| 2023-09-01T02:22:53.663431
| 2023-05-02T20:45:37
| 2023-05-02T20:45:37
| 268,352,960
| 1,001
| 117
|
MIT
| 2023-05-02T20:19:19
| 2020-05-31T19:51:55
|
C
|
UTF-8
|
C
| false
| false
| 3,198
|
h
|
taggedStrings_ScriptBinding.h
|
//-----------------------------------------------------------------------------
// Copyright (c) 2013 GarageGames, LLC
//
// 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.
//-----------------------------------------------------------------------------
#include "string/stringUnit.h"
ConsoleFunctionGroupBegin( TaggedStrings, "Functions dealing with tagging/detagging strings.");
/*! @defgroup TaggedStrings Tagged Strings
@ingroup TorqueScriptFunctions
@{
*/
/*! Use the detag function to convert a tag to a string. This can only be used in the proper context, i.e. to parse values passed to a client command or to a server command. See 'Remote Procedure Call Samples' below.
@param tagID A numeric tag ID corresponding to a previously tagged string.
@return Returns the string associated with the tag ID.
@sa commandToClient, commandToServer
*/
ConsoleFunctionWithDocs(detag, ConsoleString, 2, 2, ( tagID ))
{
TORQUE_UNUSED( argc );
if(argv[1][0] == StringTagPrefixByte)
{
const char *word = dStrchr(argv[1], ' ');
if(word == NULL)
return "";
char *ret = Con::getReturnBuffer(dStrlen(word + 1) + 1);
dStrcpy(ret, word + 1);
return ret;
}
else
return argv[1];
}
/*! Use the getTag function to retrieve the tag ID associated with a previously tagged string.
@param taggedString A previously tagged string.
@return Returns the tag ID of the string. If the string was not previously tagged, it gets tagged and the new tag ID is returned
*/
ConsoleFunctionWithDocs(getTag, ConsoleString, 2, 2, ( taggedString ))
{
TORQUE_UNUSED( argc );
if(argv[1][0] == StringTagPrefixByte)
{
const char * space = dStrchr(argv[1], ' ');
U32 len;
if(space)
len = (U32)(space - argv[1]);
else
len = dStrlen(argv[1]) + 1;
char * ret = Con::getReturnBuffer(len);
dStrncpy(ret, argv[1] + 1, len - 1);
ret[len - 1] = 0;
return(ret);
}
else
return(argv[1]);
}
ConsoleFunctionGroupEnd( TaggedStrings );
/*! @} */ // group TaggedStrings
|
2de87fc91e504dbe72fa0426bfab835ecbea4bc2
|
f6f6d13ecabee843ad4b41aae301e1bad1a07bdb
|
/generators/fe_defines.c
|
6aae50c72014ee86cebde76e24febaf59387c681
|
[
"Apache-2.0"
] |
permissive
|
p4lang/PI
|
ec6a912f77f3ed73516a844ea5ca9fdb74c0e774
|
6d0f3d6c08d595f65c7d96fd852d9e0c308a6f30
|
refs/heads/main
| 2023-08-30T02:44:12.127320
| 2023-08-21T16:45:07
| 2023-08-21T16:45:07
| 51,870,280
| 170
| 128
|
Apache-2.0
| 2023-09-11T09:52:09
| 2016-02-16T21:07:15
|
C++
|
UTF-8
|
C
| false
| false
| 7,774
|
c
|
fe_defines.c
|
/* Copyright 2013-present Barefoot Networks, 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.
*/
/*
* Antonin Bas (antonin@barefootnetworks.com)
*
*/
#include "PI/p4info.h"
#include "read_file.h"
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
static void print_help() {
fprintf(stderr,
"Usage: pi_gen_fe_defines [OPTIONS]...\n"
"Generate preprocessor #define's from P4 config\n\n"
"-c path to P4 config\n"
"-d path to destination dir (where .h will be generated)\n"
"-n P4 name to use (for generated fname and prefix)\n");
}
static char *config_path = NULL;
static char *dest_dir = NULL;
static char *p4_name = NULL;
static int parse_opts(int argc, char *const argv[]) {
int c;
opterr = 0;
while ((c = getopt(argc, argv, "c:d:n:h")) != -1) {
switch (c) {
case 'c':
config_path = optarg;
break;
case 'd':
dest_dir = optarg;
break;
case 'h':
print_help();
exit(0);
case 'n':
p4_name = optarg;
break;
case '?':
if (optopt == 'c' || optopt == 'd' || optopt == 'n') {
fprintf(stderr, "Option -%c requires an argument.\n\n", optopt);
print_help();
} else if (isprint(optopt)) {
fprintf(stderr, "Unknown option `-%c'.\n\n", optopt);
print_help();
} else {
fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
print_help();
}
return 1;
default:
abort();
}
}
if (!config_path || !dest_dir || !p4_name) {
fprintf(stderr, "Options -c, -d and -n are ALL required.\n\n");
print_help();
return 1;
}
return 0;
}
static void to_upper(char *s) {
for (; *s != '\0'; s++) *s = toupper(*s);
}
static void sanitize_name(char *s) {
char *valid_before = "$valid$";
char *valid_after = "valid";
char *valid_found = NULL;
while ((valid_found = strstr(s, valid_before)) != NULL) {
// overwrite $valid$ with valid, leave out '/0'
memcpy(valid_found, valid_after, strlen(valid_after));
// move over rest of string
char *src = &valid_found[strlen(valid_before)];
char *dest = &valid_found[strlen(valid_after)];
memmove(dest, src, strlen(src) + 1);
}
for (; *s != '\0'; s++) {
*s = toupper(*s);
if (*s == '.' || *s == ']' || *s == '[') *s = '_';
}
}
static const char prelude[] =
"/* This file was auto-generated, do not edit !!!\n"
" */\n\n";
int main(int argc, char *const argv[]) {
int rc;
if ((rc = parse_opts(argc, argv)) != 0) return rc;
char *config = read_file(config_path);
if (!config) {
fprintf(stderr, "File '%s' does not exist or cannot be accessed.\n",
config_path);
return 1;
}
struct stat info;
if (stat(dest_dir, &info) != 0) {
fprintf(stderr, "Cannot access '%s'.\n", dest_dir);
return 1;
} else if (!(info.st_mode & S_IFDIR)) {
// S_ISDIR() may not exist on windows
fprintf(stderr, "'%s' is not a directory.\n", dest_dir);
return 1;
}
char fname[256];
if (strnlen(p4_name, sizeof(fname)) + strlen("pi_fe_defines_") +
strlen(".h") >=
sizeof(fname)) {
fprintf(stderr, "Provided P4 name (with -n) is too long.\n");
return 1;
}
sprintf(fname, "pi_fe_defines_%s.h", p4_name);
char gen_path[512];
if (strnlen(dest_dir, sizeof(gen_path)) + strlen("/") + strlen(fname) >=
sizeof(gen_path)) {
fprintf(stderr, "Full path of generated file is too long.\n");
return 1;
}
sprintf(gen_path, "%s/%s", dest_dir, fname);
printf("Generating header file '%s' ...\n", gen_path);
FILE *gen_fptr = fopen(gen_path, "w");
if (!gen_fptr) {
fprintf(stderr, "Unexpected error when opening file.\n");
return 1;
}
pi_status_t status;
pi_p4info_t *p4info;
status = pi_add_config(config, PI_CONFIG_TYPE_BMV2_JSON, &p4info);
if (status != PI_STATUS_SUCCESS) {
fprintf(stderr, "Error while loading config.\n");
return 1;
}
fprintf(gen_fptr, prelude);
char inc_guard[384];
// static assert
assert(sizeof(inc_guard) >= sizeof(fname) + 128);
sprintf(inc_guard, "__AUTOGEN_PI_FE_DEFINES_%s_H_", p4_name);
to_upper(inc_guard);
fprintf(gen_fptr, "#ifndef %s\n", inc_guard);
fprintf(gen_fptr, "#define %s\n\n", inc_guard);
char prefix[384];
// static assert
assert(sizeof(prefix) >= sizeof(fname) + 128);
sprintf(prefix, "PI_%s", p4_name);
to_upper(prefix);
fprintf(gen_fptr, "// ACTIONS AND ACTION PARAMETERS\n\n");
for (pi_p4_id_t id = pi_p4info_action_begin(p4info);
id != pi_p4info_action_end(p4info);
id = pi_p4info_action_next(p4info, id)) {
const char *name = pi_p4info_action_name_from_id(p4info, id);
// quick and dirty
char *name_ = strdup(name);
sanitize_name(name_);
fprintf(gen_fptr, "#define %s_ACTION_%s %#x\n", prefix, name_, id);
size_t num_params = 0;
const pi_p4_id_t *params =
pi_p4info_action_get_params(p4info, id, &num_params);
for (size_t i = 0; i < num_params; i++) {
pi_p4_id_t p_id = params[i];
const char *p_name =
pi_p4info_action_param_name_from_id(p4info, id, p_id);
char *p_name_ = strdup(p_name);
sanitize_name(p_name_);
fprintf(gen_fptr, "#define %s_ACTIONP_%s_%s %#x\n", prefix, name_,
p_name_, p_id);
free(p_name_);
}
free(name_);
fprintf(gen_fptr, "\n");
}
fprintf(gen_fptr, "\n");
fprintf(gen_fptr, "// ACTIONS PROFILES\n\n");
for (pi_p4_id_t id = pi_p4info_act_prof_begin(p4info);
id != pi_p4info_act_prof_end(p4info);
id = pi_p4info_act_prof_next(p4info, id)) {
const char *name = pi_p4info_act_prof_name_from_id(p4info, id);
// quick and dirty
char *name_ = strdup(name);
sanitize_name(name_);
fprintf(gen_fptr, "#define %s_ACT_PROF_%s %#x\n", prefix, name_, id);
free(name_);
fprintf(gen_fptr, "\n");
}
fprintf(gen_fptr, "\n");
fprintf(gen_fptr, "// TABLES AND MATCH FIELDS\n\n");
for (pi_p4_id_t id = pi_p4info_table_begin(p4info);
id != pi_p4info_table_end(p4info);
id = pi_p4info_table_next(p4info, id)) {
const char *name = pi_p4info_table_name_from_id(p4info, id);
// quick and dirty
char *name_ = strdup(name);
sanitize_name(name_);
fprintf(gen_fptr, "#define %s_TABLE_%s %#x\n", prefix, name_, id);
size_t num_match_fields = 0;
const pi_p4_id_t *match_fields =
pi_p4info_table_get_match_fields(p4info, id, &num_match_fields);
for (size_t i = 0; i < num_match_fields; i++) {
pi_p4_id_t mf_id = match_fields[i];
const char *mf_name =
pi_p4info_table_match_field_name_from_id(p4info, id, mf_id);
char *mf_name_ = strdup(mf_name);
sanitize_name(mf_name_);
fprintf(gen_fptr, "#define %s_MF_%s_%s %#x\n", prefix, name_, mf_name_,
mf_id);
free(mf_name_);
}
free(name_);
fprintf(gen_fptr, "\n");
}
fprintf(gen_fptr, "\n");
fprintf(gen_fptr, "#endif // %s\n", inc_guard);
free(config);
pi_destroy_config(p4info);
fclose(gen_fptr);
}
|
7c2586488fdca0b65ca232dcb82ead43a5bab6ee
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/hc32/libraries/hc32f4a0_ddl/midwares/hc32/usb/usb_host_lib/host_class/msc/usb_host_msc_class.h
|
d37111ce7ef6e470e46b21b95e0365d0eee37115
|
[
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 3,274
|
h
|
usb_host_msc_class.h
|
/**
*******************************************************************************
* @file usb_host_msc_class.h
* @brief Head file for usb_host_msc_class.c
@verbatim
Change Logs:
Date Author Notes
2022-03-31 CDT First version
@endverbatim
*******************************************************************************
* Copyright (C) 2022, Xiaohua Semiconductor Co., Ltd. All rights reserved.
*
* This software component is licensed by XHSC under BSD 3-Clause license
* (the "License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
*******************************************************************************
*/
#ifndef __USB_HOST_MSC_CLASS_H__
#define __USB_HOST_MSC_CLASS_H__
/* C binding of definitions if building with C++ compiler */
#ifdef __cplusplus
extern "C"
{
#endif
/*******************************************************************************
* Include files
******************************************************************************/
#include "usb_host_core.h"
#include "usb_host_stdreq.h"
#include "usb_bsp.h"
#include "usb_host_ctrltrans.h"
#include "usb_host_cfgch.h"
#include "usb_host_msc_class.h"
#include "usb_host_msc_scsi.h"
#include "usb_host_msc_bot.h"
/**
* @addtogroup LL_USB_LIB
* @{
*/
/**
* @addtogroup LL_USB_HOST_CLASS
* @{
*/
/**
* @addtogroup LL_USB_HOST_MSC
* @{
*/
/*******************************************************************************
* Global type definitions ('typedef')
******************************************************************************/
/* Structure for MSC process */
typedef struct {
uint8_t hc_num_in;
uint8_t hc_num_out;
uint8_t MSC_BulkOutEp;
uint8_t MSC_BulkInEp;
uint16_t MSC_BulkInEpSize;
uint16_t MSC_BulkOutEpSize;
uint8_t buff[USBH_MSC_MPS_SIZE];
uint8_t maxLun;
} MSC_Machine_TypeDef;
/*******************************************************************************
* Global pre-processor symbols/macros ('#define')
******************************************************************************/
#define USB_REQ_BOT_RESET (0xFFU)
#define USB_REQ_GET_MAX_LUN (0xFEU)
/*******************************************************************************
* Global variable definitions ('extern')
******************************************************************************/
extern usb_host_class_callback_func USBH_MSC_cb;
extern MSC_Machine_TypeDef MSC_Machine;
extern uint8_t MSCErrorCount;
/*******************************************************************************
Global function prototypes (definition in C source)
******************************************************************************/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __USB_HOST_MSC_CLASS_H__ */
/*******************************************************************************
* EOF (not truncated)
******************************************************************************/
|
377622e870e5350bf9ac00809633728764489ac6
|
2898fa4f2ad766afa0495a837f59fe95daa081a7
|
/tests/unit-pass/j022.c
|
12412a93bdeebfb9aa0a9158ba678aae61cf7888
|
[
"NCSA"
] |
permissive
|
kframework/c-semantics
|
12fcc1b1bf1f7792636d1c37f6f7bb1b89a392b5
|
e6879d14455771aa0cb3e3d201131d4d763a73a2
|
refs/heads/master
| 2023-07-31T23:57:03.316456
| 2022-02-01T17:50:31
| 2022-02-01T17:50:31
| 11,747,541
| 312
| 52
|
NOASSERTION
| 2022-02-01T17:50:33
| 2013-07-29T19:13:25
|
C
|
UTF-8
|
C
| false
| false
| 119
|
c
|
j022.c
|
int main(void){
register int a[5] = {0};
sizeof(a);
int b[10] = {0};
b[5];
return 0;
}
|
1aa16b2696ca6e7f6bf0a9880b19139fbef1603b
|
d490cce62a5b14bfb11b3597365fa98cb2d1611f
|
/clang/test/CAS/cached-diagnostics.c
|
4acfd43c5a264c686955c07921398c1506d7dbf7
|
[
"Apache-2.0",
"LLVM-exception",
"NCSA"
] |
permissive
|
apple/llvm-project
|
bbaf327ccd73f830f91a3519e16c21ac10f5d245
|
8e19e2fe15202bad879471d45976b53db132a10b
|
refs/heads/next
| 2023-08-31T13:34:15.321709
| 2023-08-31T12:02:09
| 2023-08-30T23:39:33
| 215,875,945
| 938
| 380
|
NOASSERTION
| 2023-09-14T21:52:14
| 2019-10-17T20:03:10
| null |
UTF-8
|
C
| false
| false
| 3,610
|
c
|
cached-diagnostics.c
|
// RUN: rm -rf %t
// RUN: split-file %s %t/src
// RUN: mkdir %t/out
// RUN: %clang_cc1 -triple x86_64-apple-macos12 -fsyntax-only %t/src/main.c -I %t/src/inc -Wunknown-pragmas 2> %t/regular-diags1.txt
// RUN: %clang -cc1depscan -fdepscan=inline -fdepscan-include-tree -o %t/t1.rsp -cc1-args \
// RUN: -cc1 -triple x86_64-apple-macos12 -fcas-path %t/cas -fdepscan-prefix-map=%t/src=/^src \
// RUN: -emit-obj %t/src/main.c -o %t/out/output.o -I %t/src/inc -Wunknown-pragmas
// Compare diagnostics after a miss.
// RUN: %clang @%t/t1.rsp 2> %t/diags1.txt
// RUN: diff -u %t/regular-diags1.txt %t/diags1.txt
// RUN: %clang -cc1depscan -fdepscan=inline -fdepscan-include-tree -o %t/t1.noprefix.rsp -cc1-args \
// RUN: -cc1 -triple x86_64-apple-macos12 -fcas-path %t/cas \
// RUN: -emit-obj %t/src/main.c -o %t/out/output.o -I %t/src/inc -Wunknown-pragmas
// Compare diagnostics without prefix mappings.
// RUN: %clang @%t/t1.noprefix.rsp 2> %t/diags1.noprefix.txt
// RUN: diff -u %t/regular-diags1.txt %t/diags1.noprefix.txt
// Check that we have both the remark and source diagnostics.
// RUN: %clang @%t/t1.rsp -Rcompile-job-cache 2> %t/diags-hit1.txt
// RUN: FileCheck %s -input-file %t/diags-hit1.txt
// CHECK: remark: compile job cache hit for
// CHECK: warning: some warning
// CHECK: warning: unknown pragma ignored
// CHECK: warning: using the result of an assignment as a condition without parentheses
// RUN: cat %t/diags-hit1.txt | grep remark: | sed \
// RUN: -e "s/^.*hit for '//" \
// RUN: -e "s/' .*$//" > %t/cache-key1
// Compare diagnostics after a hit.
// RUN: %clang @%t/t1.rsp 2> %t/cached-diags1.txt
// RUN: diff -u %t/regular-diags1.txt %t/cached-diags1.txt
// RUN: split-file %s %t/src2
// RUN: mkdir %t/out2
// RUN: %clang_cc1 -triple x86_64-apple-macos12 -fsyntax-only %t/src2/main.c -I %t/src2/inc -Wunknown-pragmas 2> %t/regular-diags2.txt
// RUN: %clang -cc1depscan -fdepscan=inline -fdepscan-include-tree -o %t/t2.rsp -cc1-args \
// RUN: -cc1 -triple x86_64-apple-macos12 -fcas-path %t/cas -fdepscan-prefix-map=%t/src2=/^src \
// RUN: -emit-obj %t/src2/main.c -o %t/out2/output.o -I %t/src2/inc -Wunknown-pragmas
// RUN: %clang @%t/t2.rsp -Rcompile-job-cache 2> %t/diags-hit2.txt
// RUN: cat %t/diags-hit2.txt | grep remark: | sed \
// RUN: -e "s/^.*hit for '//" \
// RUN: -e "s/' .*$//" > %t/cache-key2
// RUN: diff -u %t/cache-key1 %t/cache-key2
// RUN: %clang @%t/t2.rsp 2> %t/cached-diags2.txt
// RUN: diff -u %t/regular-diags2.txt %t/cached-diags2.txt
// RUN: %clang -cc1depscan -fdepscan=inline -fdepscan-include-tree -o %t/terr.rsp -cc1-args \
// RUN: -cc1 -triple x86_64-apple-macos12 -fcas-path %t/cas -fdepscan-prefix-map=%t/src=/^src \
// RUN: -emit-obj %t/src/main.c -o %t/out/output.o -I %t/src/inc -Rcompile-job-cache -DERROR
// RUN: not %clang @%t/terr.rsp -ferror-limit 1 2> %t/diags_error1.txt
// RUN: FileCheck %s -check-prefix=ERROR1 -input-file %t/diags_error1.txt
// ERROR1: error: E1
// ERROR1-NOT: error:
// ERROR1: fatal error: too many errors emitted
// RUN: not %clang @%t/terr.rsp -ferror-limit 2 2> %t/diags_error2.txt
// RUN: FileCheck %s -check-prefix=ERROR2 -input-file %t/diags_error2.txt
// ERROR2: error: E1
// ERROR2: error: E2
// ERROR2-NOT: error:
//--- main.c
#include "t1.h"
#ifdef ERROR
#error E1
#error E2
#endif
//--- inc/t1.h
#warning some warning
_Pragma("unknown1")
#define PRAG(x) _Pragma(x)
PRAG("unknown2")
void test(int x) {
if (x=0) {}
}
#define DEPR _Pragma("GCC warning \"name is deprecated\"")
#define PARAM "A" DEPR
#define MAC(x) x
void test2() {
(void)MAC(PARAM);
}
|
fa8d062c4f25ecbad4f26c27e9c6820b4d11db40
|
060c02561085a494df306deb2f3a8fddb984c73a
|
/src/vmemsave.c
|
00c371bbe9cb2fda3be8639d47b47c8dfd0c7e49
|
[
"MIT"
] |
permissive
|
Interlisp/maiko
|
48631ae6abc9d98d5c3eeb5f5eb736adf400ea8f
|
7fce08f92c221bcb98e5f6d560aa50cb942e95b3
|
refs/heads/master
| 2023-09-03T12:23:43.081470
| 2023-08-09T21:04:51
| 2023-08-09T21:04:51
| 279,184,900
| 110
| 33
|
MIT
| 2023-09-13T14:49:28
| 2020-07-13T02:00:09
|
C
|
UTF-8
|
C
| false
| false
| 15,750
|
c
|
vmemsave.c
|
/* $Id: vmemsave.c,v 1.2 1999/01/03 02:07:45 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
*/
/************************************************************************/
/* */
/* (C) Copyright 1989-1995 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
#include "version.h"
/*
* vmemsave.c
*
*
*/
#include <errno.h>
#include <fcntl.h>
#include <setjmp.h>
#include <signal.h>
#include <stddef.h> // for ptrdiff_t
#include <stdio.h>
#include <stdlib.h>
#ifndef DOS
#include <dirent.h>
#include <string.h>
#include <sys/param.h>
#include <pwd.h>
#include <unistd.h>
#else
#include <direct.h>
#include <stdlib.h>
#define MAXPATHLEN _MAX_PATH
#define MAXNAMLEN _MAX_PATH
#define alarm(x) 1
#endif /* DOS */
#include "lispemul.h"
#include "lispmap.h"
#include "lspglob.h"
#include "vmemsave.h"
#include "timeout.h"
#include "adr68k.h"
#include "lsptypes.h"
#include "locfile.h"
#include "dbprint.h"
#include "devif.h"
#include "ifpage.h" // for MACHINETYPE_MAIKO
#include "vmemsavedefs.h"
#include "byteswapdefs.h"
#include "commondefs.h"
#include "dskdefs.h"
#include "initkbddefs.h"
#include "perrnodefs.h"
#include "ufsdefs.h"
/* Error return values from VMEMSAVE */
#define COMPLETESYSOUT NIL
#define BADFILENAME (S_POSITIVE | 1)
#define NOFILESPACE (S_POSITIVE | 2)
#define FILECANNOTOPEN (S_POSITIVE | 3)
#define FILECANNOTSEEK (S_POSITIVE | 4)
#define FILECANNOTWRITE (S_POSITIVE | 5)
#define FILETIMEOUT (S_POSITIVE | 6)
extern struct pixrect *CursorBitMap, *InvisibleCursorBitMap;
extern struct cursor CurrentCursor, InvisibleCursor;
#ifdef DOS
extern DspInterface currentdsp;
#endif /* DOS */
extern int *Lisp_errno;
extern int Dummy_errno; /* Used if errno cell isn't provided by Lisp.*/
extern int please_fork;
/************************************************************************/
/* */
/* l i s p s t r i n g p */
/* */
/* Predicate: Is the argument (which must be a Lisp 1-d array) */
/* a lisp string? i.e., are its elements char's? */
/* */
/************************************************************************/
int lispstringP(LispPTR Lisp)
{
switch (((OneDArray *)(NativeAligned4FromLAddr(Lisp)))->typenumber) {
case THIN_CHAR_TYPENUMBER:
case FAT_CHAR_TYPENUMBER: return (1);
default: return (0);
}
}
/************************************************************************/
/* */
/* v m e m _ s a v e 0 */
/* */
/* Implements the VMEMSAVE subr. Write out the current lisp */
/* lisp image to the specified file. If the sysout file-name */
/* is explicitly specified, the directory on which the file */
/* resides is exactly (?) an existing directory. This is */
/* guaranteed by the Lisp code, \MAIKO.CHECKFREEPAGE in LLFAULT. */
/* */
/* If the file argument is nill, the default sysout-file name, */
/* "~/lisp.virtualmem", is used, subject to override by the */
/* LDEDESTSYSOUT UNIX-environment variable. */
/* */
/* */
/* */
/* */
/* Argument: LispPTR *args args[0] */
/* The file name in Lisp format specifying a */
/* file to which the current Lisp image should */
/* be flushed or Lisp NIL. */
/* */
/* Value: If succeed, returns NIL, otherwise one of the */
/* following Lisp integers, indicating the reason. */
/* */
/* 1 BADFILENAME */
/* 2 NOFILESPACE */
/* 3 FILECANNOTOPEN */
/* 4 FILECANNOTSEEK */
/* 5 FILECANNOTWRITE */
/* 6 FILETIMEOUT */
/* */
/* Side Effect: None. */
/* */
/************************************************************************/
LispPTR vmem_save0(LispPTR *args)
{
char *def;
char pathname[MAXPATHLEN], sysout[MAXPATHLEN], host[MAXNAMLEN];
#ifdef DOS
char pwd[MAXNAMLEN];
char drive[1];
#else
struct passwd *pwd;
#endif /* DOS */
Lisp_errno = &Dummy_errno;
if ((args[0] != NIL) && lispstringP(args[0])) {
/* Check of lispstringP is safer for LispStringToCString */
LispStringToCString(args[0], pathname, MAXPATHLEN);
separate_host(pathname, host);
#ifdef DOS
if (!unixpathname(pathname, sysout, 0, 0, drive, 0, 0)) return (BADFILENAME);
#else
if (!unixpathname(pathname, sysout, 0, 0)) return (BADFILENAME);
#endif /* DOS */
return (vmem_save(sysout));
} else {
if ((def = getenv("LDEDESTSYSOUT")) == 0) {
#ifdef DOS
if (getcwd(pwd, MAXNAMLEN) == NULL) return (FILETIMEOUT);
strcpy(sysout, pwd);
strcat(sysout, "/lisp.vm");
#else
pwd = getpwuid(getuid()); /* NEED TIMEOUT */
if (pwd == (struct passwd *)NULL) return (FILETIMEOUT);
strcpy(sysout, pwd->pw_dir);
strcat(sysout, "/lisp.virtualmem");
#endif /* DOS */
} else {
if (*def == '~' && (*(def + 1) == '/' || *(def + 1) == '\0')) {
#ifdef DOS
if (getcwd(pwd, MAXNAMLEN) == NULL) return (FILETIMEOUT);
strcpy(sysout, pwd);
#else
pwd = getpwuid(getuid()); /* NEED TIMEOUT */
if (pwd == (struct passwd *)NULL) return (FILETIMEOUT);
strcpy(sysout, pwd->pw_dir);
#endif /* DOS */
strcat(sysout, def + 1);
} else {
strcpy(sysout, def);
}
}
return (vmem_save(sysout));
}
}
/************************************************************************/
/* */
/* s o r t _ f p t o v p */
/* */
/* Sort the entries in the file-page-to-virtual-page table, */
/* to try to make a sysout file that has contiguous runs of */
/* virtual pages in it, for speed. */
/* */
/************************************************************************/
#ifndef BIGVM
#ifndef BYTESWAP
static int twowords(const void *i, const void *j) /* the difference between two DLwords. */
{ return (*(const DLword *)i - *(const DLword *)j); }
#define FPTOVP_ENTRY (FPTOVP_OFFSET >> 8)
static void sort_fptovp(DLword *fptovp, size_t size)
{
size_t oldsize, i;
ptrdiff_t oldloc, newloc;
DLword *fptr;
for (fptr = fptovp, i = 0; GETWORD(fptr) != FPTOVP_ENTRY && i < size; fptr++, i++)
;
if (GETWORD(fptr) != FPTOVP_ENTRY) {
DBPRINT(("Couldn't find FPTOVP_ENTRY; not munging\n"));
return;
}
oldloc = fptr - fptovp;
/* Found old fptovp table location, now sort the table */
qsort(fptovp, size, sizeof(DLword), twowords);
ONE_MORE_TIME: /* Tacky, but why repeat code? */
/* Look up FPTOVP_ENTRY again; if it's moved, need to shuffle stuff */
for (fptr = fptovp, i = 0; GETWORD(fptr) != FPTOVP_ENTRY && i < size; fptr++, i++)
;
if (GETWORD(fptr) != FPTOVP_ENTRY) error("Couldn't find FPTOVP_ENTRY second time!\n");
newloc = fptr - fptovp;
/* Supposedly all we have to do is adjust the fptovpstart and nactivepages
the ifpage */
InterfacePage->fptovpstart += (newloc - oldloc);
oldsize = size;
for (fptr = fptovp + (size - 1); GETWORD(fptr) == 0xffff;
fptr--, InterfacePage->nactivepages--, size--)
;
if (size != oldsize) {
DBPRINT(("Found %d holes in fptovp table\n", oldsize - size));
}
/* Sanity check; it's just possible there are duplicate entries... */
{
int dupcount = 0;
for (fptr = fptovp, i = 1; i < size; i++, fptr++)
if (GETWORD(fptr) == GETWORD(fptr + 1)) {
dupcount++;
GETWORD(fptr) = 0xffff;
}
/* if duplicates were found, resort to squeeze them out, then mung the
size and fptovpstart again (spaghetti-code, HO!) */
if (dupcount) {
qsort(fptovp, size, sizeof(DLword), twowords);
oldloc = newloc;
DBPRINT(("%d duplicates found\n", dupcount));
goto ONE_MORE_TIME;
}
}
}
#endif
#endif
/************************************************************************/
/* */
/* v m e m _ s a v e */
/* */
/* */
/* */
/************************************************************************/
/*
* Argument: char *sysout_file_name
* The file name in UNIX format specifying a file to which
* the current Lisp image should be flushed.
*
* Value: If succeed, returns Lisp NIL, otherwise one of the following Lisp integer
* indicating the reason of failure.
*
* 1 BADFILENAME
* 2 NOFILESPACE
* 3 FILECANNOTOPEN
* 4 FILECANNOTSEEK
* 5 FILECANNOTWRITE
* 6 FILETIMEOUT
*
* Side Effect: None.
*
* Description:
*
* Flush out the current Lisp image to the specified file.
*/
/* diagnostic flag value to limit the size of write() s */
extern unsigned maxpages;
unsigned maxpages = 65536;
LispPTR vmem_save(char *sysout_file_name)
{
int sysout; /* SysoutFile descriptor */
#ifdef BIGVM
unsigned int *fptovp;
#else
DLword *fptovp; /* FPTOVP */
#endif /* BIGVM */
int vmemsize; /* VMEMSIZE */
int i;
char tempname[MAXPATHLEN];
ssize_t rsize;
off_t roff;
int rval;
#ifndef DOS
extern int ScreenLocked;
extern DLword *EmCursorX68K;
extern DLword *EmCursorY68K;
extern DLword NullCursor[];
extern DLword *EmCursorBitMap68K;
#endif /* DOS */
/* remove cursor image from screen */
#ifdef DOS
/* For DOS, must also take the mouse cursor away (it's */
/* written into the display-region bitmap). */
currentdsp->device.locked++;
(currentdsp->mouse_invisible)(currentdsp, IOPage);
#endif /* SUNDISPLAY || DOS */
/* set FPTOVP */
fptovp = FPtoVP + 1;
/* set VMEMSIZE */
vmemsize = InterfacePage->nactivepages;
/* [HH:6-Jan-89]
Sequence of save image
(1) Sysout image is saved to a temporary file, tempname.
(2) if a specified file, sysout_file_name, is exist, the file is removed.
(3) the temporary file is renamed to the specified file.
*/
SETJMP(FILETIMEOUT);
#ifdef DOS
/* Bloddy 8 char filenames in dos ... /jarl */
make_old_version(tempname, sysout_file_name);
#else /* DOS */
sprintf(tempname, "%s-temp", sysout_file_name);
#endif /* DOS */
/* Confirm protection of specified file by open/close */
TIMEOUT(sysout = open(sysout_file_name, O_WRONLY, 0666));
if (sysout == -1) {
/* No file error skip return. */
if (errno != 2) return (FILECANNOTOPEN); /* No such file error.*/
} else
TIMEOUT(rval = close(sysout));
/* open temp file */
TIMEOUT(sysout = open(tempname, O_WRONLY | O_CREAT | O_TRUNC, 0666));
if (sysout == -1) {
err_mess("open", errno);
return (FILECANNOTOPEN);
}
InterfacePage->machinetype = MACHINETYPE_MAIKO;
/* Restore storagefull state */
if (((*STORAGEFULLSTATE_word) & 0xffff) == SFS_NOTSWITCHABLE) {
/* This sysout uses only 8 Mbyte lisp space.
It may be able to use this SYSOUT which has more than
8 Mbyte lisp space.
To enable to expand lisp space, \\STORAGEFULLSTATE
should be NIL.
*/
*STORAGEFULLSTATE_word = NIL;
InterfacePage->storagefullstate = NIL;
} else {
/* Otherwise, just restore storagefullstate in IFPAGE */
InterfacePage->storagefullstate = (*STORAGEFULLSTATE_word) & 0xffff;
}
/* First, sort fptovp table, trying to get pages contiguous */
#ifndef BIGVM
#ifndef BYTESWAP
/* Byte-swapped machines don't sort the table right. */
sort_fptovp(fptovp, vmemsize);
#endif
#endif
/* store vmem to sysoutfile */
for (i = 0; i < vmemsize; i++) {
if (GETPAGEOK(fptovp, i) != 0177777) {
unsigned int oldfptovp = GETFPTOVP(fptovp, i);
unsigned int saveoldfptovp = oldfptovp;
unsigned int contig_pages = 0;
DLword *base_addr;
TIMEOUT(roff = lseek(sysout, i * BYTESPER_PAGE, SEEK_SET));
if (roff == -1) {
err_mess("lseek", errno);
return (FILECANNOTSEEK);
}
base_addr = Lisp_world + (GETFPTOVP(fptovp, i) * DLWORDSPER_PAGE);
/* Now, let's see how many pages we can dump */
while (GETFPTOVP(fptovp, i) == oldfptovp && i < vmemsize) {
contig_pages++; oldfptovp++; i++;
}
i--; /* Previous loop always overbumps i */
DBPRINT(("%4d: writing %d pages from %tx (%d)\n", i, contig_pages, (char *)base_addr - (char *)Lisp_world, saveoldfptovp));
#ifdef BYTESWAP
word_swap_page(base_addr, contig_pages * CELLSPER_PAGE);
#endif /* BYTESWAP */
if (contig_pages > maxpages) {
DLword *ba = base_addr;
unsigned int pc = contig_pages;
while (pc > maxpages) {
TIMEOUT(rsize = write(sysout, ba, (size_t)maxpages * BYTESPER_PAGE));
if (rsize == -1) {
err_mess("write", errno);
return ((errno == ENOSPC) || (errno == EDQUOT)) ? NOFILESPACE : FILECANNOTWRITE;
}
ba += maxpages * DLWORDSPER_PAGE;
pc -= maxpages;
}
if (pc > 0) TIMEOUT(rsize = write(sysout, ba, pc * BYTESPER_PAGE));
} else {
unsigned int oldTT = TIMEOUT_TIME;
/* As we can spend longer than TIMEOUT_TIME doing a big
write, we adjust the timeout temporarily here */
TIMEOUT_TIME += contig_pages >> 3;
TIMEOUT(rsize = write(sysout, base_addr, contig_pages * BYTESPER_PAGE));
TIMEOUT_TIME = oldTT;
}
#ifdef BYTESWAP
word_swap_page(base_addr, contig_pages * CELLSPER_PAGE);
#endif /* BYTESWAP */
if (rsize == -1) {
err_mess("write", errno);
return ((errno == ENOSPC) || (errno == EDQUOT)) ? NOFILESPACE : FILECANNOTWRITE;
}
}
}
/* seek to IFPAGE */
TIMEOUT(roff = lseek(sysout, (long)FP_IFPAGE, SEEK_SET));
if (roff == -1) {
err_mess("lseek", errno);
return (FILECANNOTSEEK);
}
#ifdef BYTESWAP
word_swap_page(InterfacePage, CELLSPER_PAGE);
#endif /* BYTESWAP */
TIMEOUT(rsize = write(sysout, (char *)InterfacePage, BYTESPER_PAGE));
#ifdef BYTESWAP
word_swap_page(InterfacePage, CELLSPER_PAGE);
#endif /* BYTESWAP */
if (rsize == -1) {
err_mess("write", errno);
return ((errno == ENOSPC) || (errno == EDQUOT)) ? NOFILESPACE : FILECANNOTWRITE;
}
#ifdef OS5
/* Seems to write all pages at close, so timeout
is WAY to short, no matter how big. JDS 960925 */
rval = close(sysout);
#else
TIMEOUT(rval = close(sysout));
#endif /* OS5 */
if (rval == -1) { return (FILECANNOTWRITE); }
TIMEOUT(rval = unlink(sysout_file_name));
if (rval == -1) {
/* No file error skip return. */
if (errno != 2) /* No such file error.*/
return (FILECANNOTOPEN);
}
TIMEOUT(rval = rename(tempname, sysout_file_name));
if (rval == -1) {
fprintf(stderr, "sysout is saved to temp file, %s.", tempname);
return (FILECANNOTWRITE);
}
/* restore cursor image to screen */
#ifdef DOS
/* Must also put the mouse back. */
(currentdsp->mouse_visible)(IOPage->dlmousex, IOPage->dlmousey);
currentdsp->device.locked--;
#endif /* SUNDISPLAY */
/*printf("vmem is saved completely.\n");*/
return (COMPLETESYSOUT);
}
/************************************************************************/
/* */
/* l i s p _ f i n i s h */
/* */
/* Kill all forked sub-processes before exiting. */
/* */
/************************************************************************/
/* Make sure that we kill off any Unix subprocesses before we go away */
void lisp_finish(void) {
char d[4];
DBPRINT(("finish lisp_finish\n"));
if (please_fork) { /* if lde runs with -NF(No fork), */
/* following 5 lines don't work well. */
d[0] = 'E';
d[3] = 1;
/* These only happen if the fork really succeeded: */
/* if (UnixPipeOut >= 0) write(UnixPipeOut, d, 4); */
/* if (UnixPipeIn >= 0 read(UnixPipeIn, d, 4);*/ /* Make sure it's finished */
/* if (UnixPID >= 0) kill(UnixPID, SIGKILL);*/ /* Then kill fork_Unix itself */
}
device_before_exit();
#ifdef DOS
exit_host_filesystem();
#endif /* DOS */
exit(0);
}
|
10627d250ce7f4249182529e83e6fd4fb1fd452f
|
3c76f1d8d548863f4a92209da9758c3f86ac5b72
|
/bench/bench-liblfds.c
|
832bfb21face93d8950f6ef53bcac35baa8f86a5
|
[
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
P-p-H-d/mlib
|
57ba169f11dbaf425b6b87c24b654df1e67a5af0
|
469239adcd1c37f09e208b7c09fe7f749de84892
|
refs/heads/master
| 2023-09-04T11:07:23.155619
| 2023-08-24T21:32:47
| 2023-08-24T21:32:47
| 82,404,078
| 749
| 67
|
BSD-2-Clause
| 2023-06-13T21:46:59
| 2017-02-18T17:35:25
|
C
|
UTF-8
|
C
| false
| false
| 3,206
|
c
|
bench-liblfds.c
|
#define NDEBUG
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include "liblfds711.h"
#include "common.h"
/********************************************************************************************/
struct lfds711_queue_bmm_state g_buff;
struct lfds711_queue_bmm_state g_final;
static void final(void *arg)
{
size_t *p_n = arg;
size_t n = *p_n;
unsigned long long j, s = 0;
LFDS711_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE;
for(int i = 0; i < n;i++) {
void *p;
while (0 == lfds711_queue_bmm_dequeue(&g_final, &p, NULL)) { m_thread_yield(); }
j = (uintptr_t)p;
s += j;
}
g_result = s;
}
static void conso(void *arg)
{
unsigned int j;
size_t *p_n = arg;
size_t n = *p_n;
unsigned long long s = 0;
LFDS711_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE;
for(int i = 0; i < n;i++) {
void *p;
while (0 == lfds711_queue_bmm_dequeue(&g_buff, &p, NULL)) { m_thread_yield(); }
j = (uintptr_t) p;
s += j;
}
while (0 == lfds711_queue_bmm_enqueue(&g_final, (void*)(uintptr_t)s, NULL)) { m_thread_yield(); }
}
static void prod(void *arg)
{
size_t *p_n = arg;
size_t n = *p_n;
size_t r = n;
LFDS711_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE;
for(unsigned int i = 0; i < n;i++) {
while (0 == lfds711_queue_bmm_enqueue(&g_buff, (void*)(uintptr_t)r, NULL)) { m_thread_yield(); }
r = r * 31421U + 6927U;
}
}
static void test_queue(size_t n)
{
const int cpu_count = get_cpu_count();
const int prod_count = cpu_count/2;
const int conso_count = cpu_count - prod_count;
if (cpu_count < 2) {
fprintf(stderr, "WARNING: Can not measure Buffer performance.\n");
return;
}
rand_get();
// Init
const size_t size = m_core_roundpow2(64*cpu_count);
struct lfds711_queue_bmm_element g_buff_elements[size];
struct lfds711_queue_bmm_element g_final_elements[size];
lfds711_queue_bmm_init_valid_on_current_logical_core(&g_buff, g_buff_elements,
size, NULL);
lfds711_queue_bmm_init_valid_on_current_logical_core(&g_final, g_final_elements,
size, NULL);
// Create thread
m_thread_t idx_p[prod_count];
m_thread_t idx_c[conso_count];
m_thread_t idx_final;
for(int i = 0; i < prod_count; i++) {
m_thread_create (idx_p[i], prod, &n);
}
for(int i = 0; i < conso_count; i++) {
m_thread_create (idx_c[i], conso, &n);
}
size_t n2 = conso_count;
m_thread_create(idx_final, final, &n2);
// Wait for jobs to be done.
for(int i = 0; i < prod_count; i++) {
m_thread_join(idx_p[i]);
}
for(int i = 0; i < conso_count; i++) {
m_thread_join(idx_c[i]);
}
m_thread_join(idx_final);
// Clear & quit
lfds711_queue_bmm_cleanup(&g_final, NULL);
lfds711_queue_bmm_cleanup(&g_buff, NULL);
}
/********************************************************************************************/
const config_func_t table[] = {
{ 60, "Queue MPMC", 1000000, 0, test_queue, 0}
};
int main(int argc, const char *argv[])
{
test("LIBLFDS", numberof(table), table, argc, argv);
exit(0);
}
|
44fec7850c229cdf29fecd73f46e21c4bb420b82
|
a3d6556180e74af7b555f8d47d3fea55b94bcbda
|
/third_party/opus/src/silk/PLC.h
|
6438f516330e6e9fbc3eef2fb19ba2399bd88232
|
[
"GPL-1.0-or-later",
"MIT",
"LGPL-2.0-or-later",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license",
"BSD-3-Clause-Clear"
] |
permissive
|
chromium/chromium
|
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
|
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
|
refs/heads/main
| 2023-08-24T00:35:12.585945
| 2023-08-23T22:01:11
| 2023-08-23T22:01:11
| 120,360,765
| 17,408
| 7,102
|
BSD-3-Clause
| 2023-09-10T23:44:27
| 2018-02-05T20:55:32
| null |
UTF-8
|
C
| false
| false
| 3,261
|
h
|
PLC.h
|
/***********************************************************************
Copyright (c) 2006-2011, Skype Limited. 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 Internet Society, IETF or IETF Trust, nor the
names of specific 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.
***********************************************************************/
#ifndef SILK_PLC_H
#define SILK_PLC_H
#include "main.h"
#define BWE_COEF 0.99
#define V_PITCH_GAIN_START_MIN_Q14 11469 /* 0.7 in Q14 */
#define V_PITCH_GAIN_START_MAX_Q14 15565 /* 0.95 in Q14 */
#define MAX_PITCH_LAG_MS 18
#define RAND_BUF_SIZE 128
#define RAND_BUF_MASK ( RAND_BUF_SIZE - 1 )
#define LOG2_INV_LPC_GAIN_HIGH_THRES 3 /* 2^3 = 8 dB LPC gain */
#define LOG2_INV_LPC_GAIN_LOW_THRES 8 /* 2^8 = 24 dB LPC gain */
#define PITCH_DRIFT_FAC_Q16 655 /* 0.01 in Q16 */
void silk_PLC_Reset(
silk_decoder_state *psDec /* I/O Decoder state */
);
void silk_PLC(
silk_decoder_state *psDec, /* I/O Decoder state */
silk_decoder_control *psDecCtrl, /* I/O Decoder control */
opus_int16 frame[], /* I/O signal */
opus_int lost, /* I Loss flag */
int arch /* I Run-time architecture */
);
void silk_PLC_glue_frames(
silk_decoder_state *psDec, /* I/O decoder state */
opus_int16 frame[], /* I/O signal */
opus_int length /* I length of signal */
);
#endif
|
443efced600aee2ac310707b8888964154e15c9b
|
e73547787354afd9b717ea57fe8dd0695d161821
|
/src/hud_element.c
|
dcc1c700088f5ed1e23a457d267c6457443b53dd
|
[] |
no_license
|
pmret/papermario
|
8b514b19653cef8d6145e47499b3636b8c474a37
|
9774b26d93f1045dd2a67e502b6efc9599fb6c31
|
refs/heads/main
| 2023-08-31T07:09:48.951514
| 2023-08-21T18:07:08
| 2023-08-21T18:07:08
| 287,151,133
| 904
| 139
| null | 2023-09-14T02:44:23
| 2020-08-13T01:22:57
|
C
|
UTF-8
|
C
| false
| false
| 90,213
|
c
|
hud_element.c
|
#include "common.h"
#include "hud_element.h"
#include "nu/nusys.h"
#include "ld_addrs.h"
#if VERSION_IQUE
// TODO: remove if section is split in iQue release
extern Addr icon_ROM_START;
#endif
#define MAX_HUD_CACHE_ENTRIES 192
typedef struct HudElementSize {
s16 width;
s16 height;
s16 size;
} HudElementSize;
u8* gHudElementAuxCache = NULL;
s32 gHudElementCacheCapacity = 0x11000;
HudScript HES_Empty = {
hs_End
};
HudElementSize gHudElementSizes[] = {
{ 8, 8, 32 },
{ 16, 16, 128 },
{ 24, 24, 288 },
{ 32, 32, 512 },
{ 48, 48, 1152 },
{ 64, 64, 2048 },
{ 8, 16, 64 },
{ 16, 8, 64 },
{ 16, 24, 192 },
{ 16, 32, 256 },
{ 64, 32, 1024 },
{ 32, 16, 256 },
{ 12, 12, 72 },
{ 48, 24, 576 },
{ 32, 8, 128 },
{ 24, 8, 96 },
{ 64, 16, 512 },
{ 16, 64, 512 },
{ 192, 32, 3072 },
{ 40, 40, 800 },
{ 24, 16, 192 },
{ 32, 40, 640 },
{ 40, 16, 320 },
{ 40, 24, 480 },
{ 32, 24, 384 },
{ 20, 32, 0 }
};
s16 D_8014F068[] = { 34, 32, 0, 40, 40, 968, 0, 0 };
Gfx gHudElementsDLBackUI[] = {
gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT),
gsDPPipeSync(),
gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_ALPHADITHER, 18, G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE),
gsDPSetAlphaCompare(G_AC_NONE),
gsSPEndDisplayList()
};
Gfx gHudElementsDLFrontUI[] = {
gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT),
gsDPPipeSync(),
gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_ALPHADITHER, 18, G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE),
gsDPSetAlphaCompare(G_AC_NONE),
gsSPEndDisplayList()
};
Vtx D_8014F0C8[] = {
{
.v = {
.ob = { -12, 0, 0},
.flag = 0,
.tc = { 0x800, 0x800 },
.cn = { 0, 0, 0, 255}
}
},
{
.v = {
.ob = { 51, 0, 0},
.flag = 0,
.tc = { 0, 0x800 },
.cn = { 0, 0, 0, 255}
}
},
{
.v = {
.ob = { 51, 63, 0},
.flag = 0,
.tc = { 0, 0 },
.cn = { 0, 0, 0, 255}
}
},
{
.v = {
.ob = { -12, 63, 0},
.flag = 0,
.tc = { 0x800, 0 },
.cn = { 0, 0, 0, 255}
}
}
};
Lights1 D_8014F108 = gdSPDefLights1(255, 255, 255, 0, 0, 0, 0, 0, 0);
SHIFT_BSS s32 gHudElementsNumber;
SHIFT_BSS s32 D_80159180;
SHIFT_BSS HudElementList* gHudElements;
SHIFT_BSS HudElementList gHudElementsWorld;
SHIFT_BSS HudElementList gHudElementsBattle;
SHIFT_BSS s32* gHudElementCacheSize;
SHIFT_BSS s32 gHudElementCacheSizeWorld;
SHIFT_BSS s32 gHudElementCacheSizeBattle;
SHIFT_BSS HudCacheEntry* gHudElementCacheTableRaster;
SHIFT_BSS HudCacheEntry* gHudElementCacheTablePalette;
SHIFT_BSS HudCacheEntry gHudElementCacheTableRasterWorld[192];
SHIFT_BSS HudCacheEntry gHudElementCacheTablePaletteWorld[192];
SHIFT_BSS HudCacheEntry gHudElementCacheTableRasterBattle[192];
SHIFT_BSS HudCacheEntry gHudElementCacheTablePaletteBattle[192];
SHIFT_BSS u8* gHudElementCacheBufferWorld;
SHIFT_BSS u8* gHudElementCacheBufferBattle;
SHIFT_BSS u8* gHudElementCacheBuffer;
void func_801413F8(void);
void hud_element_load_script(HudElement* hudElement, HudScript* anim) {
s32* pos = (s32*)anim;
s32 raster;
s32 palette;
s32 preset;
Vec3s* size;
HudCacheEntry* entry;
s32 i;
s32 capacity;
if (pos == NULL) {
return;
}
preset = 0;
while (TRUE) {
switch (*pos++) {
case HUD_ELEMENT_OP_End:
return;
case HUD_ELEMENT_OP_SetCI:
pos += 3;
break;
case HUD_ELEMENT_OP_SetTileSize:
preset = *pos++;
hudElement->drawSizePreset = hudElement->tileSizePreset = preset;
break;
case HUD_ELEMENT_OP_SetSizesAutoScale:
case HUD_ELEMENT_OP_SetSizesFixedScale:
preset = *pos;
pos += 2;
hudElement->drawSizePreset = hudElement->tileSizePreset = preset;
break;
case HUD_ELEMENT_OP_SetCustomSize:
hudElement->customDrawSize.x = hudElement->customImageSize.x = *pos++;
hudElement->customDrawSize.y = hudElement->customImageSize.y = *pos++;
hudElement->flags |= HUD_ELEMENT_FLAG_CUSTOM_SIZE;
break;
case HUD_ELEMENT_OP_AddTexelOffsetX:
case HUD_ELEMENT_OP_AddTexelOffsetY:
case HUD_ELEMENT_OP_SetScale:
case HUD_ELEMENT_OP_SetAlpha:
case HUD_ELEMENT_OP_op_15:
case HUD_ELEMENT_OP_RandomBranch:
case HUD_ELEMENT_OP_SetFlags:
case HUD_ELEMENT_OP_ClearFlags:
case HUD_ELEMENT_OP_PlaySound:
pos++;
break;
case HUD_ELEMENT_OP_SetRGBA:
case HUD_ELEMENT_OP_SetTexelOffset:
case HUD_ELEMENT_OP_RandomDelay:
case HUD_ELEMENT_OP_RandomRestart:
case HUD_ELEMENT_OP_SetPivot:
pos += 2;
break;
case HUD_ELEMENT_OP_SetImage:
pos++;
raster = *pos++;
palette = *pos++;
i = 0;
entry = gHudElementCacheTableRaster;
while (TRUE) {
if (entry->id == -1) {
entry->id = raster;
entry->data = &gHudElementCacheBuffer[*gHudElementCacheSize];
if (!gGameStatusPtr->isBattle) {
capacity = gHudElementCacheCapacity;
} else {
capacity = gHudElementCacheCapacity / 2;
}
ASSERT(capacity > *gHudElementCacheSize + gHudElementSizes[preset].size);
nuPiReadRom((s32)icon_ROM_START + raster, entry->data, gHudElementSizes[preset].size);
*gHudElementCacheSize += gHudElementSizes[preset].size;
if (!gGameStatusPtr->isBattle) {
*pos = i;
} else {
*pos = (u16)(*pos) | (i << 16);
}
i++;
break;
} else if (entry->id == raster) {
if (!gGameStatusPtr->isBattle) {
*pos = i;
} else {
*pos = (u16)(*pos) | (i << 16);
}
break;
}
entry++;
i++;
}
pos++;
ASSERT(i < MAX_HUD_CACHE_ENTRIES);
entry = gHudElementCacheTablePalette;
i = 0;
while (TRUE) {
if (entry->id == -1) {
entry->id = palette;
entry->data = &gHudElementCacheBuffer[*gHudElementCacheSize];
if (!gGameStatusPtr->isBattle) {
capacity = gHudElementCacheCapacity;
} else {
capacity = gHudElementCacheCapacity / 2;
}
ASSERT(capacity > *gHudElementCacheSize + 32);
nuPiReadRom((s32)icon_ROM_START + palette, entry->data, 32);
*gHudElementCacheSize += 32;
if (!gGameStatusPtr->isBattle) {
*pos = i;
} else {
*pos = (u16)(*pos) | (i << 16);
}
i++;
break;
} else if (entry->id == palette) {
if (!gGameStatusPtr->isBattle) {
*pos = i;
} else {
*pos = (u16)(*pos) | (i << 16);
}
break;
}
entry++;
i++;
}
pos++;
ASSERT(i < MAX_HUD_CACHE_ENTRIES);
break;
}
}
}
void hud_element_draw_rect(HudElement* hudElement, s16 texSizeX, s16 texSizeY, s16 drawSizeX, s16 drawSizeY,
s16 offsetX, s16 offsetY, s32 clamp, s32 dropShadow) {
u32 isFmtCI4;
u32 isFmtIA8;
s32 flipX, flipY;
s32 fmt;
s32 widthScale, heightScale;
s32 texStartX, texStartY;
u32 isLastTileX, isLastTileY;
s32 uls, ult, lrs, lrt;
s32 uly, lry, ulx, lrx;
s32 masks, maskt;
s32 screenPosOffsetScaledX, screenPosOffsetScaledY;
IMG_PTR imageAddr;
PAL_PTR paletteAddr;
s16 baseX, baseY;
s32 tileMode;
u32 flags1, flags2;
u16 renderPosX, renderPosY;
s16 tempX, tempY;
imageAddr = hudElement->imageAddr;
paletteAddr = (u16*) hudElement->paletteAddr;
screenPosOffsetScaledX = hudElement->screenPosOffset.x * 1024;
screenPosOffsetScaledY = hudElement->screenPosOffset.y * 1024;
widthScale = hudElement->widthScale;
screenPosOffsetScaledX /= widthScale;
heightScale = hudElement->heightScale;
screenPosOffsetScaledY /= heightScale;
renderPosX = hudElement->worldPosOffset.x;
renderPosY = hudElement->worldPosOffset.y;
renderPosX += hudElement->renderPosX + screenPosOffsetScaledX;
renderPosY += hudElement->renderPosY + screenPosOffsetScaledY;
tempX = offsetX;
tempY = offsetY;
tempX += renderPosX;
tempY += renderPosY;
baseX = tempX;
baseY = tempY;
if (dropShadow) {
baseX = tempX + 2;
baseY = tempY + 2;
}
flags1 = (hudElement->flags & HUD_ELEMENT_FLAG_FMT_CI4);
isFmtCI4 = flags1 != 0;
flags1 = (hudElement->flags & HUD_ELEMENT_FLAG_FMT_IA8);
isFmtIA8 = flags1 != 0;
flags1 = (hudElement->flags & HUD_ELEMENT_FLAG_FLIPX);
flipX = flags1 != 0;
flags2 = (hudElement->flags & HUD_ELEMENT_FLAG_FLIPY);
flipY = flags2 != 0;
fmt = 0;
if (isFmtCI4 == FALSE && isFmtIA8 == FALSE) {
fmt = 0; // RGBA
}
if (isFmtCI4 == TRUE && isFmtIA8 == FALSE) {
fmt = 1; // CI
}
if (isFmtCI4 == FALSE && isFmtIA8 == TRUE) {
fmt = 2; // IA
}
if (isFmtCI4 == TRUE && isFmtIA8 == TRUE) {
fmt = 2; // IA
}
masks = 6;
maskt = 5;
if (!(hudElement->flags & HUD_ELEMENT_FLAG_SCALED)) {
switch (drawSizeX) {
case 8:
masks = 3;
break;
case 16:
masks = 4;
break;
case 32:
masks = 5;
break;
}
switch (drawSizeY) {
case 8:
maskt = 3;
break;
case 16:
maskt = 4;
break;
case 32:
maskt = 5;
break;
}
}
switch (fmt) {
case 0:
gDPSetRenderMode(gMainGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetTextureLUT(gMainGfxPos++, G_TT_NONE);
break;
case 1:
if (!(hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT)) {
if (!(hudElement->flags & HUD_ELEMENT_FLAG_ANTIALIASING)) {
gDPSetRenderMode(gMainGfxPos++, G_RM_TEX_EDGE, G_RM_TEX_EDGE2);
} else {
gDPSetRenderMode(gMainGfxPos++, G_RM_AA_TEX_EDGE, G_RM_AA_TEX_EDGE2);
}
} else {
if (!(hudElement->flags & HUD_ELEMENT_FLAG_ANTIALIASING)) {
gDPSetRenderMode(gMainGfxPos++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
} else {
gDPSetRenderMode(gMainGfxPos++, G_RM_CLD_SURF | AA_EN, G_RM_CLD_SURF2 | AA_EN);
}
}
gDPSetTextureLUT(gMainGfxPos++, G_TT_RGBA16);
gDPLoadTLUT_pal16(gMainGfxPos++, 0, paletteAddr);
break;
case 2:
gDPSetRenderMode(gMainGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetTextureLUT(gMainGfxPos++, G_TT_NONE);
break;
}
if (hudElement->flags & HUD_ELEMENT_FLAG_FILTER_TEX) {
gDPSetTextureFilter(gMainGfxPos++, G_TF_AVERAGE);
} else {
gDPSetTextureFilter(gMainGfxPos++, G_TF_POINT);
}
ult = 0;
isLastTileY = FALSE;
uly = baseY;
while (TRUE) {
lry = uly + 1024.0 / heightScale * 32.0;
lrt = ult + 31;
if (flipY) {
texStartY = texSizeY;
} else {
texStartY = 0;
}
if (lry < 0 || uly > SCREEN_HEIGHT) {
break;
}
if (lry >= SCREEN_HEIGHT) {
s32 temp = ult + SCREEN_HEIGHT + 31;
temp -= baseY + lrt;
lrt = temp - 1;
lry = SCREEN_HEIGHT;
isLastTileY = TRUE;
}
if (lrt + 1 >= texSizeY) {
lrt = texSizeY - 1;
if (texSizeY > 16) {
lry = baseY + drawSizeY - 1;
} else {
lry = baseY + drawSizeY;
}
isLastTileY = TRUE;
}
isLastTileX = FALSE;
uls = 0;
ulx = baseX;
while (TRUE) {
lrx = ulx + 1024.0 / widthScale * 64.0;
lrs = uls + 63;
if (flipX) {
texStartX = texSizeX;
} else {
texStartX = 0;
}
if (lrx < 0 || ulx > SCREEN_WIDTH) {
break;
}
if (lrx >= SCREEN_WIDTH) {
s32 temp = uls + SCREEN_WIDTH + 63;
temp -= baseX + lrs;
lrs = temp - 1;
lrx = SCREEN_WIDTH;
isLastTileX = TRUE;
}
if (lrs + 1 >= texSizeX) {
lrs = texSizeX - 1;
if (texSizeX > 16) {
lrx = baseX + drawSizeX - 1;
} else {
lrx = baseX + drawSizeX;
}
isLastTileX = TRUE;
}
gDPPipeSync(gMainGfxPos++);
if (isLastTileX ) {
tileMode = !isLastTileY;
}
if (!isLastTileX && !isLastTileY) {
tileMode = 0;
}
if (!isLastTileX && isLastTileY) {
tileMode = 2;
}
if (isLastTileX && isLastTileY) {
tileMode = 3;
}
switch (fmt) {
case 0:
gDPSetCombineMode(gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
if (!(hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT)) {
gDPSetCombineMode(gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
} else {
gDPSetCombineMode(gMainGfxPos++, PM_CC_01, PM_CC_02);
}
if (hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT) {
gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, hudElement->opacity);
}
if (!flipX && !flipY) {
gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_RGBA, G_IM_SIZ_32b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
} else {
gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_RGBA, G_IM_SIZ_32b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
G_TX_MIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
}
break;
case 1:
if (!dropShadow) {
if (hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT) {
gDPSetCombineLERP(gMainGfxPos++, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, TEXEL0, 0, PRIMITIVE, 0);
} else {
gDPSetCombineLERP(gMainGfxPos++, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, TEXEL0, 0, PRIMITIVE, 0);
}
if (hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT) {
gDPSetPrimColor(gMainGfxPos++, 0, 0, hudElement->tint.r, hudElement->tint.g, hudElement->tint.b, hudElement->opacity);
} else {
gDPSetPrimColor(gMainGfxPos++, 0, 0, hudElement->tint.r, hudElement->tint.g, hudElement->tint.b, 255);
}
} else {
gDPSetRenderMode(gMainGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetCombineMode(gMainGfxPos++, PM_CC_07, PM_CC_07);
gDPSetPrimColor(gMainGfxPos++, 0, 0, 40, 40, 40, 72);
}
if (!flipX && !flipY) {
if (!clamp) {
gDPLoadTextureTile_4b(gMainGfxPos++, imageAddr, G_IM_FMT_CI, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
} else {
switch (tileMode) {
case 0:
gDPLoadTextureTile_4b(gMainGfxPos++, imageAddr, G_IM_FMT_CI, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
break;
case 1:
gDPLoadTextureTile_4b(gMainGfxPos++, imageAddr, G_IM_FMT_CI, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
break;
case 2:
gDPLoadTextureTile_4b(gMainGfxPos++, imageAddr, G_IM_FMT_CI, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
break;
case 3:
gDPLoadTextureTile_4b(gMainGfxPos++, imageAddr, G_IM_FMT_CI, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
break;
}
}
} else {
gDPLoadTextureTile_4b(gMainGfxPos++, imageAddr, G_IM_FMT_CI, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
G_TX_MIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
}
break;
case 2:
gDPSetCombineLERP(gMainGfxPos++, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, 0, TEXEL0, 0, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, 0, TEXEL0, 0);
gDPSetPrimColor(gMainGfxPos++, 0, 0, hudElement->tint.r, hudElement->tint.g, hudElement->tint.b, hudElement->opacity);
if (!flipX && !flipY) {
if (!clamp) {
switch (tileMode) {
case 0:
gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_IA, G_IM_SIZ_8b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
break;
case 1:
gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_IA, G_IM_SIZ_8b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
break;
case 2:
gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_IA, G_IM_SIZ_8b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
break;
case 3:
gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_IA, G_IM_SIZ_8b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
break;
}
} else {
gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_IA, G_IM_SIZ_8b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
}
} else {
gDPLoadTextureTile(gMainGfxPos++, imageAddr, G_IM_FMT_IA, G_IM_SIZ_8b, texSizeX, texSizeY, uls, ult, lrs, lrt, 0,
G_TX_MIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
}
break;
}
if (hudElement->flags & HUD_ELEMENT_FLAG_FILTER_TEX) {
gSPScisTextureRectangle(gMainGfxPos++, ulx * 4, uly * 4, lrx * 4, lry * 4, 0, texStartX * 32 + 16, texStartY * 32 + 16, widthScale, heightScale);
} else {
gSPScisTextureRectangle(gMainGfxPos++, ulx * 4, uly * 4, lrx * 4, lry * 4, 0, texStartX * 32, texStartY * 32, widthScale, heightScale);
}
if (isLastTileX) {
break;
}
ulx += 1024.0 / widthScale * 64.0;
uls += 64;
}
if (isLastTileY) {
break;
}
ult += 32;
uly += 1024.0 / heightScale * 32.0;
}
gDPPipeSync(gMainGfxPos++);
}
void hud_element_clear_cache(void) {
s32 i;
HudCacheEntry* entryRaster;
HudCacheEntry* entryPalette;
if (!gGameStatusPtr->isBattle) {
gHudElements = &gHudElementsWorld;
gHudElementCacheSize = &gHudElementCacheSizeWorld;
gHudElementCacheTableRaster = gHudElementCacheTableRasterWorld;
gHudElementCacheTablePalette = gHudElementCacheTablePaletteWorld;
} else {
gHudElements = &gHudElementsBattle;
gHudElementCacheSize = &gHudElementCacheSizeBattle;
gHudElementCacheTableRaster = gHudElementCacheTableRasterBattle;
gHudElementCacheTablePalette = gHudElementCacheTablePaletteBattle;
}
if (!gGameStatusPtr->isBattle) {
gHudElementCacheBuffer = general_heap_malloc(gHudElementCacheCapacity);
ASSERT(gHudElementCacheBuffer);
gHudElementCacheBufferWorld = gHudElementCacheBuffer;
*gHudElementCacheSize = 0;
entryRaster = gHudElementCacheTableRaster;
entryPalette = gHudElementCacheTablePalette;
for (i = 0; i < MAX_HUD_CACHE_ENTRIES; i++) {
entryRaster[i].id = -1;
entryPalette[i].id = -1;
}
} else {
if (gHudElementAuxCache == NULL) {
gHudElementCacheBuffer = general_heap_malloc(gHudElementCacheCapacity / 2);
ASSERT(gHudElementCacheBuffer);
} else {
gHudElementCacheBuffer = gHudElementAuxCache;
}
gHudElementCacheBufferBattle = gHudElementCacheBuffer;
*gHudElementCacheSize = 0;
entryRaster = gHudElementCacheTableRaster;
entryPalette = gHudElementCacheTablePalette;
for (i = 0; i < MAX_HUD_CACHE_ENTRIES; i++) {
entryRaster[i].id = -1;
entryPalette[i].id = -1;
}
}
for (i = 0; i < ARRAY_COUNT(*gHudElements); i++) {
(*gHudElements)[i] = NULL;
}
gHudElementsNumber = 0;
D_80159180 = 0;
func_801413F8();
}
#if VERSION_PAL
extern Addr D_80200000;
#endif
void init_hud_element_list(void) {
if (!gGameStatusPtr->isBattle) {
if (gHudElementCacheBufferBattle != NULL) {
#if VERSION_PAL
if (gHudElementCacheBufferBattle != D_80200000) {
general_heap_free(gHudElementCacheBufferBattle);
}
#else
general_heap_free(gHudElementCacheBufferBattle);
#endif
gHudElementCacheBufferBattle = NULL;
}
gHudElements = &gHudElementsWorld;
gHudElementCacheSize = &gHudElementCacheSizeWorld;
gHudElementCacheTableRaster = gHudElementCacheTableRasterWorld;
gHudElementCacheTablePalette = gHudElementCacheTablePaletteWorld;
gHudElementCacheBuffer = gHudElementCacheBufferWorld;
} else {
gHudElements = &gHudElementsBattle;
gHudElementCacheSize = &gHudElementCacheSizeBattle;
gHudElementCacheTableRaster = gHudElementCacheTableRasterBattle;
gHudElementCacheTablePalette = gHudElementCacheTablePaletteBattle;
gHudElementCacheBuffer = gHudElementCacheBufferBattle;
}
gHudElementsNumber = 0;
D_80159180 = 0;
}
void func_801413F8(void) {
set_cam_viewport(CAM_3, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
gCameras[CAM_3].updateMode = CAM_UPDATE_MODE_2;
gCameras[CAM_3].needsInit = TRUE;
gCameras[CAM_3].lookAt_dist = 15551;
gCameras[CAM_3].nearClip = CAM_NEAR_CLIP;
gCameras[CAM_3].auxPitch = 0;
gCameras[CAM_3].auxBoomLength = 0;
gCameras[CAM_3].auxBoomPitch = 0;
gCameras[CAM_3].lookAt_obj_target.z = 0;
gCameras[CAM_3].farClip = 0x4000;
gCameras[CAM_3].bgColor[0] = 0;
gCameras[CAM_3].bgColor[1] = 0;
gCameras[CAM_3].bgColor[2] = 0;
gCameras[CAM_3].lookAt_obj_target.x = 160.0f;
gCameras[CAM_3].lookAt_obj_target.y = -120.0f;
gCameras[CAM_3].vfov = 1.0f;
gCameras[CAM_3].flags &= ~0x6;
}
s32 hud_element_create(HudScript* anim) {
HudElement* hudElement;
s32 id;
for (id = 0; id < ARRAY_COUNT(*gHudElements); id++) {
if ((*gHudElements)[id] == NULL) {
break;
}
}
ASSERT(id < ARRAY_COUNT(*gHudElements));
(*gHudElements)[id] = hudElement = heap_malloc(sizeof(*hudElement));
gHudElementsNumber += 1;
ASSERT(hudElement != NULL);
hudElement->flags = HUD_ELEMENT_FLAG_INITIALIZED;
hudElement->readPos = anim;
if (anim == NULL) {
hudElement->readPos = &HES_Empty;
}
hudElement->updateTimer = 1;
hudElement->drawSizePreset = -1;
hudElement->tileSizePreset = -1;
hudElement->renderPosX = 0;
hudElement->renderPosY = 0;
hudElement->loopStartPos = anim;
hudElement->widthScale = X10(1.0f);
hudElement->heightScale = X10(1.0f);
hudElement->anim = hudElement->readPos;
hudElement->uniformScale = 1.0f;
hudElement->screenPosOffset.x = 0;
hudElement->screenPosOffset.y = 0;
hudElement->worldPosOffset.x = 0;
hudElement->worldPosOffset.y = 0;
hudElement->worldPosOffset.z = 0;
hudElement->opacity = 255;
hudElement->tint.r = 255;
hudElement->tint.g = 255;
hudElement->tint.b = 255;
if (gGameStatusPtr->isBattle) {
hudElement->flags |= HUD_ELEMENT_FLAG_BATTLE;
id |= HUD_ELEMENT_BATTLE_ID_MASK;
}
hud_element_load_script(hudElement, hudElement->readPos);
while (hud_element_update(hudElement) != 0);
return id;
}
// TODO not ideal match - should be able to put loop iterator in the loop def, but can't
void update_hud_elements(void) {
s32 i;
for (i = 0; i < ARRAY_COUNT(*gHudElements);) {
HudElement* elem = (*gHudElements)[i];
if (elem != NULL && elem->flags && !(elem->flags & HUD_ELEMENT_FLAG_DISABLED)) {
if (elem->flags & HUD_ELEMENT_FLAG_DELETE) {
hud_element_free(i);
i++;
} else if (elem->readPos != NULL) {
elem->updateTimer--;
if (elem->updateTimer == 0) {
while (hud_element_update(elem) != 0);
}
if (elem->flags & HUD_ELEMENT_FLAG_FIXEDSCALE) {
elem->unkImgScale[0] += elem->deltaSizeX;
elem->unkImgScale[1] += elem->deltaSizeY;
}
i++;
} else {
break;
}
} else {
i++;
}
}
}
s32 hud_element_update(HudElement* hudElement) {
HudCacheEntry* entryRaster;
HudCacheEntry* entryPalette;
s32 i;
s32 drawSizePreset;
s32 tileSizePreset;
u8 sizePreset;
f32 xScaled, yScaled;
s32 imageWidth, imageHeight, drawWidth, drawHeight;
u32 min, max;
u32 flags;
s32 raster, palette;
s32 s1, s2;
s32 arg1, arg2;
f32 uniformScale;
HudScript* newReadPos;
HudTransform* hudTransform = hudElement->hudTransform;
s32* nextPos = (s32*)hudElement->readPos;
switch (*nextPos++) {
case HUD_ELEMENT_OP_End:
hudElement->updateTimer = 60;
flags = hudElement->flags;
hudElement->flags = flags | HUD_ELEMENT_FLAG_ANIMATION_FINISHED;
break;
case HUD_ELEMENT_OP_Delete:
hudElement->updateTimer = 60;
hudElement->flags |= HUD_ELEMENT_FLAG_DELETE;
break;
case HUD_ELEMENT_OP_UseIA8:
hudElement->readPos = (HudScript*)nextPos;
hudElement->flags |= HUD_ELEMENT_FLAG_FMT_IA8;
return TRUE;
case HUD_ELEMENT_OP_SetVisible:
hudElement->readPos = (HudScript*)nextPos;
hudElement->flags |= HUD_ELEMENT_FLAG_FMT_CI4;
return TRUE;
case HUD_ELEMENT_OP_SetHidden:
hudElement->readPos = (HudScript*)nextPos;
hudElement->flags &= ~HUD_ELEMENT_FLAG_FMT_CI4;
return TRUE;
case HUD_ELEMENT_OP_SetFlags:
s1 = *nextPos++;
hudElement->readPos = (HudScript*)nextPos;
hudElement->flags |= s1;
return TRUE;
case HUD_ELEMENT_OP_ClearFlags:
s1 = *nextPos++;
hudElement->readPos = (HudScript*)nextPos;
hudElement->flags &= ~s1;
return TRUE;
case HUD_ELEMENT_OP_SetRGBA:
hudElement->updateTimer = *nextPos++;
hudElement->imageAddr = (u8*)*nextPos++;
hudElement->readPos = (HudScript*)nextPos;
if (hudElement->flags & HUD_ELEMENT_FLAG_MEMOFFSET) {
hudElement->imageAddr += hudElement->memOffset;
}
if (hudElement->flags & HUD_ELEMENT_FLAG_FIXEDSCALE) {
if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
tileSizePreset = hudElement->tileSizePreset;
drawSizePreset = hudElement->drawSizePreset;
imageWidth = gHudElementSizes[tileSizePreset].width;
imageHeight = gHudElementSizes[tileSizePreset].height;
drawWidth = gHudElementSizes[drawSizePreset].width;
drawHeight = gHudElementSizes[drawSizePreset].height;
} else {
imageWidth = hudElement->customImageSize.x;
imageHeight = hudElement->customImageSize.y;
drawWidth = hudElement->customDrawSize.x;
drawHeight = hudElement->customDrawSize.y;
}
if (!(hudElement->flags & HUD_ELEMENT_FLAG_200)) {
hudElement->flags |= HUD_ELEMENT_FLAG_200;
hudElement->unkImgScale[0] = imageWidth;
hudElement->unkImgScale[1] = imageHeight;
hudElement->deltaSizeX = ((f32)drawWidth - (f32)imageWidth) / (f32)hudElement->updateTimer;
hudElement->deltaSizeY = ((f32)drawHeight - (f32)imageHeight) / (f32)hudElement->updateTimer;
} else {
hudElement->flags &= ~HUD_ELEMENT_FLAG_200;
hudElement->unkImgScale[0] = drawWidth;
hudElement->unkImgScale[1] = drawHeight;
hudElement->deltaSizeX = ((f32)imageWidth - (f32)drawWidth) / (f32)hudElement->updateTimer;
hudElement->deltaSizeY = ((f32)imageHeight - (f32)drawHeight) / (f32)hudElement->updateTimer;
}
}
break;
case HUD_ELEMENT_OP_SetCI:
hudElement->updateTimer = *nextPos++;
hudElement->imageAddr = (u8*)*nextPos++;
hudElement->paletteAddr = (u8*)*nextPos++;
hudElement->readPos = (HudScript*)nextPos;
if (hudElement->flags & HUD_ELEMENT_FLAG_MEMOFFSET) {
hudElement->imageAddr += hudElement->memOffset;
hudElement->paletteAddr += hudElement->memOffset;
}
if (hudElement->flags & HUD_ELEMENT_FLAG_FIXEDSCALE) {
if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
tileSizePreset = hudElement->tileSizePreset;
drawSizePreset = hudElement->drawSizePreset;
imageWidth = gHudElementSizes[tileSizePreset].width;
imageHeight = gHudElementSizes[tileSizePreset].height;
drawWidth = gHudElementSizes[drawSizePreset].width;
drawHeight = gHudElementSizes[drawSizePreset].height;
} else {
imageWidth = hudElement->customImageSize.x;
imageHeight = hudElement->customImageSize.y;
drawWidth = hudElement->customDrawSize.x;
drawHeight = hudElement->customDrawSize.y;
}
if (!(hudElement->flags & HUD_ELEMENT_FLAG_200)) {
hudElement->flags |= HUD_ELEMENT_FLAG_200;
hudElement->unkImgScale[0] = imageWidth;
hudElement->unkImgScale[1] = imageHeight;
hudElement->deltaSizeX = ((f32)drawWidth - (f32)imageWidth) / (f32)hudElement->updateTimer;
hudElement->deltaSizeY = ((f32)drawHeight - (f32)imageHeight) / (f32)hudElement->updateTimer;
} else {
hudElement->flags &= ~HUD_ELEMENT_FLAG_200;
hudElement->unkImgScale[0] = drawWidth;
hudElement->unkImgScale[1] = drawHeight;
hudElement->deltaSizeX = ((f32)imageWidth - (f32)drawWidth) / (f32)hudElement->updateTimer;
hudElement->deltaSizeY = ((f32)imageHeight - (f32)drawHeight) / (f32)hudElement->updateTimer;
}
}
break;
case HUD_ELEMENT_OP_SetImage:
hudElement->updateTimer = *nextPos++;
if (!(hudElement->flags & HUD_ELEMENT_FLAG_BATTLE)) {
entryRaster = gHudElementCacheTableRasterWorld;
entryPalette = gHudElementCacheTablePaletteWorld;
} else {
entryRaster = gHudElementCacheTableRasterBattle;
entryPalette = gHudElementCacheTablePaletteBattle;
}
i = 0;
while (TRUE) {
if (entryRaster[i].id == *nextPos) {
break;
}
ASSERT(++i < MAX_HUD_CACHE_ENTRIES);
}
nextPos++;
hudElement->imageAddr = entryRaster[i].data;
i = 0;
while (TRUE) {
if (entryPalette[i].id == *nextPos) {
break;
}
ASSERT(++i < MAX_HUD_CACHE_ENTRIES);
}
hudElement->paletteAddr = entryPalette[i].data;
nextPos += 3;
hudElement->readPos = (HudScript*)nextPos;
if (hudElement->flags & HUD_ELEMENT_FLAG_FIXEDSCALE) {
if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
tileSizePreset = hudElement->tileSizePreset;
drawSizePreset = hudElement->drawSizePreset;
imageWidth = gHudElementSizes[tileSizePreset].width;
imageHeight = gHudElementSizes[tileSizePreset].height;
drawWidth = gHudElementSizes[drawSizePreset].width;
drawHeight = gHudElementSizes[drawSizePreset].height;
} else {
imageWidth = hudElement->customImageSize.x;
imageHeight = hudElement->customImageSize.y;
drawWidth = hudElement->customDrawSize.x;
drawHeight = hudElement->customDrawSize.y;
}
if (!(hudElement->flags & HUD_ELEMENT_FLAG_200)) {
hudElement->flags |= HUD_ELEMENT_FLAG_200;
hudElement->unkImgScale[0] = imageWidth;
hudElement->unkImgScale[1] = imageHeight;
hudElement->deltaSizeX = ((f32)drawWidth - (f32)imageWidth) / (f32)hudElement->updateTimer;
hudElement->deltaSizeY = ((f32)drawHeight - (f32)imageHeight) / (f32)hudElement->updateTimer;
} else {
hudElement->flags &= ~HUD_ELEMENT_FLAG_200;
hudElement->unkImgScale[0] = drawWidth;
hudElement->unkImgScale[1] = drawHeight;
hudElement->deltaSizeX = ((f32)imageWidth - (f32)drawWidth) / (f32)hudElement->updateTimer;
hudElement->deltaSizeY = ((f32)imageHeight - (f32)drawHeight) / (f32)hudElement->updateTimer;
}
}
break;
case HUD_ELEMENT_OP_Restart:
hudElement->readPos = hudElement->loopStartPos;
return TRUE;
case HUD_ELEMENT_OP_Loop:
hudElement->loopStartPos = (HudScript*)nextPos;
hudElement->readPos = (HudScript*)nextPos;
return TRUE;
case HUD_ELEMENT_OP_RandomRestart:
s1 = *nextPos++;
s2 = *nextPos++;
if (rand_int(s1) < s2) {
hudElement->readPos = hudElement->loopStartPos;
} else {
hudElement->readPos = (HudScript*)nextPos;
}
return TRUE;
case HUD_ELEMENT_OP_SetTileSize:
sizePreset = *nextPos++;
hudElement->widthScale = X10(1);
hudElement->heightScale = X10(1);
hudElement->readPos = (HudScript*)nextPos;
hudElement->drawSizePreset = sizePreset;
hudElement->tileSizePreset = sizePreset;
hudElement->flags &= ~HUD_ELEMENT_FLAG_FIXEDSCALE;
hudElement->flags &= ~HUD_ELEMENT_FLAG_REPEATED;
return TRUE;
case HUD_ELEMENT_OP_SetSizesAutoScale:
tileSizePreset = *nextPos++;
arg2 = *nextPos++;
hudElement->readPos = (HudScript*)nextPos;
hudElement->tileSizePreset = tileSizePreset;
hudElement->drawSizePreset = arg2;
imageWidth = gHudElementSizes[tileSizePreset].width;
imageHeight = gHudElementSizes[tileSizePreset].height;
drawWidth = gHudElementSizes[arg2].width;
drawHeight = gHudElementSizes[arg2].height;
xScaled = (f32) drawWidth / (f32) imageWidth;
yScaled = (f32) drawHeight / (f32) imageHeight;
xScaled = 1.0f / xScaled;
yScaled = 1.0f / yScaled;
hudElement->widthScale = X10(xScaled);
hudElement->heightScale = X10(yScaled);
hudElement->flags &= ~HUD_ELEMENT_FLAG_FIXEDSCALE;
hudElement->flags |= HUD_ELEMENT_FLAG_REPEATED;
return TRUE;
case HUD_ELEMENT_OP_SetSizesFixedScale:
tileSizePreset = *nextPos++;
drawSizePreset = *nextPos++;
hudElement->widthScale = X10(1);
hudElement->heightScale = X10(1);
hudElement->readPos = (HudScript*)nextPos;
hudElement->tileSizePreset = tileSizePreset;
hudElement->drawSizePreset = drawSizePreset;
hudElement->flags |= HUD_ELEMENT_FLAG_FIXEDSCALE;
hudElement->flags &= ~HUD_ELEMENT_FLAG_REPEATED;
hudElement->flags &= ~HUD_ELEMENT_FLAG_200;
return TRUE;
case HUD_ELEMENT_OP_AddTexelOffsetX:
s1 = *nextPos++;
hudElement->readPos = (HudScript*)nextPos;
hudElement->screenPosOffset.x += s1;
return TRUE;
case HUD_ELEMENT_OP_AddTexelOffsetY:
s2 = *nextPos++;
if (!(hudElement->flags & HUD_ELEMENT_FLAG_FLIPY)) {
hudElement->screenPosOffset.y += s2;
} else {
hudElement->screenPosOffset.y -= s2;
}
hudElement->readPos = (HudScript*)nextPos;
return TRUE;
case HUD_ELEMENT_OP_SetTexelOffset:
s1 = *nextPos++;
s2 = *nextPos++;
hudElement->screenPosOffset.x = s1;
if (!(hudElement->flags & HUD_ELEMENT_FLAG_FLIPY)) {
hudElement->screenPosOffset.y = s2;
} else {
hudElement->screenPosOffset.y = -s2;
}
hudElement->readPos = (HudScript*)nextPos;
return TRUE;
case HUD_ELEMENT_OP_SetScale:
uniformScale = (f32)*nextPos++;
uniformScale /= 65536;
hudElement->uniformScale = uniformScale;
if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
imageWidth = gHudElementSizes[hudElement->tileSizePreset].width;
imageHeight = gHudElementSizes[hudElement->tileSizePreset].height;
drawWidth = gHudElementSizes[hudElement->drawSizePreset].width;
drawHeight = gHudElementSizes[hudElement->drawSizePreset].height;
} else {
imageWidth = hudElement->customImageSize.x;
imageHeight = hudElement->customImageSize.y;
drawWidth = hudElement->customDrawSize.x;
drawHeight = hudElement->customDrawSize.y;
}
hudElement->sizeX = drawWidth * uniformScale;
hudElement->sizeY = drawHeight * uniformScale;
xScaled = (f32) drawWidth / (f32) imageWidth * uniformScale;
yScaled = (f32) drawHeight / (f32) imageHeight * uniformScale;
xScaled = 1.0f / xScaled;
yScaled = 1.0f / yScaled;
hudElement->widthScale = X10(xScaled);
hudElement->heightScale = X10(yScaled);
hudElement->readPos = (HudScript*)nextPos;
hudElement->flags &= ~HUD_ELEMENT_FLAG_FIXEDSCALE;
hudElement->flags |= HUD_ELEMENT_FLAG_REPEATED | HUD_ELEMENT_FLAG_SCALED;
return TRUE;
case HUD_ELEMENT_OP_SetAlpha:
s1 = *nextPos++;
hudElement->opacity = s1;
hudElement->flags |= HUD_ELEMENT_FLAG_TRANSPARENT;
if (hudElement->opacity == 255) {
hudElement->flags &= ~HUD_ELEMENT_FLAG_TRANSPARENT;
}
hudElement->readPos = (HudScript*)nextPos;
return TRUE;
case HUD_ELEMENT_OP_RandomDelay:
s1 = *nextPos++;
s2 = *nextPos++;
hudElement->updateTimer = rand_int(s2 - s1) + s1;
hudElement->readPos = (HudScript*)nextPos;
break;
case HUD_ELEMENT_OP_SetCustomSize:
hudElement->customDrawSize.x = hudElement->customImageSize.x = *nextPos++;
hudElement->customDrawSize.y = hudElement->customImageSize.y = *nextPos++;
hudElement->readPos = (HudScript*)nextPos;
hudElement->widthScale = X10(1);
hudElement->heightScale = X10(1);
hudElement->drawSizePreset = 0;
hudElement->tileSizePreset = 0;
hudElement->flags &= ~HUD_ELEMENT_FLAG_FIXEDSCALE;
hudElement->flags &= ~HUD_ELEMENT_FLAG_REPEATED;
hudElement->flags |= HUD_ELEMENT_FLAG_CUSTOM_SIZE;
return TRUE;
case HUD_ELEMENT_OP_op_15:
s1 = *nextPos++;
hudElement->readPos = (HudScript*)nextPos;
hudElement->flags &= ~(HUD_ELEMENT_FLAG_1000000 | HUD_ELEMENT_FLAG_2000000 | HUD_ELEMENT_FLAG_4000000 | HUD_ELEMENT_FLAG_8000000);
hudElement->flags |= s1 << 24;
return TRUE;
case HUD_ELEMENT_OP_RandomBranch:
s1 = *nextPos++;
newReadPos = (HudScript*)nextPos[rand_int(s1 - 1)];
hudElement->readPos = newReadPos;
hud_element_load_script(hudElement, newReadPos);
return TRUE;
case HUD_ELEMENT_OP_PlaySound:
arg2 = *nextPos++;
sfx_play_sound(arg2);
hudElement->readPos = (HudScript*)nextPos;
return TRUE;
case HUD_ELEMENT_OP_SetPivot:
arg1 = *nextPos++;
arg2 = *nextPos++;
hudElement->readPos = (HudScript*)nextPos;
if (hudElement->flags & HUD_ELEMENT_FLAG_TRANSFORM) {
hudTransform->pivot.x = arg1;
// TODO find better match
do {
hudTransform->pivot.y = arg2;
} while (0);
}
return TRUE;
case HUD_ELEMENT_OP_op_16:
break;
}
return FALSE;
}
void render_hud_elements_backUI(void) {
s32 i, count, j;
s32 sortedElements[ARRAY_COUNT(*gHudElements)];
s32 el1, el2;
s32 texSizeX, texSizeY;
s32 drawSizeX, drawSizeY, offsetX, offsetY;
HudElement* hudElement;
D_80159180++;
if (D_80159180 > 2) {
D_80159180 = 0;
}
gSPDisplayList(gMainGfxPos++, VIRTUAL_TO_PHYSICAL(gHudElementsDLBackUI));
count = 0;
for (i = 0; i < ARRAY_COUNT(*gHudElements); i++) {
hudElement = (*gHudElements)[i];
if (hudElement != NULL) {
s32 flags = hudElement->flags;
if (flags && !(flags & HUD_ELEMENT_FLAG_DISABLED)) {
if (!(flags & (HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_TRANSFORM | HUD_ELEMENT_FLAG_200000 | HUD_ELEMENT_FLAG_10000000 | HUD_ELEMENT_FLAG_40000000))) {
if (!(flags & HUD_ELEMENT_FLAG_FRONTUI) && hudElement->drawSizePreset >= 0) {
sortedElements[count++] = i;
}
}
}
}
}
for (i = 0; i < count - 1; i++) {
for (j = i + 1; j < count; j++) {
el1 = sortedElements[i];
el2 = sortedElements[j];
if ((*gHudElements)[el1]->worldPosOffset.z < (*gHudElements)[el2]->worldPosOffset.z) {
sortedElements[i] = el2;
sortedElements[j] = el1;
}
}
}
for (i = 0; i < count; i++) {
hudElement = (*gHudElements)[sortedElements[i]];
if (hudElement->readPos == NULL) {
break;
}
if (!(hudElement->flags & HUD_ELEMENT_FLAG_FIXEDSCALE)) {
if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
texSizeX = gHudElementSizes[hudElement->tileSizePreset].width;
texSizeY = gHudElementSizes[hudElement->tileSizePreset].height;
} else {
texSizeX = hudElement->customImageSize.x;
texSizeY = hudElement->customImageSize.y;
}
if (!(hudElement->flags & HUD_ELEMENT_FLAG_SCALED)) {
if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
drawSizeX = gHudElementSizes[hudElement->drawSizePreset].width;
drawSizeY = gHudElementSizes[hudElement->drawSizePreset].height;
offsetX = -drawSizeX / 2;
offsetY = -drawSizeY / 2;
} else {
// TODO find better match
do {
drawSizeX = hudElement->customDrawSize.x;
drawSizeY = hudElement->customDrawSize.y;
offsetX = -drawSizeX / 2;
} while (0);
offsetY = -drawSizeY / 2;
}
} else {
drawSizeX = hudElement->sizeX;
drawSizeY = hudElement->sizeY;
offsetX = -drawSizeX / 2;
offsetY = -drawSizeY / 2;
}
if (!(hudElement->flags & HUD_ELEMENT_FLAG_REPEATED)) {
if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, TRUE);
}
hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, FALSE);
} else {
if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
}
hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
}
} else {
f32 xScaled, yScaled;
if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
texSizeX = gHudElementSizes[hudElement->tileSizePreset].width;
texSizeY = gHudElementSizes[hudElement->tileSizePreset].height;
} else {
texSizeX = hudElement->customImageSize.x;
texSizeY = hudElement->customImageSize.y;
}
drawSizeX = hudElement->unkImgScale[0];
drawSizeY = hudElement->unkImgScale[1];
offsetX = -hudElement->unkImgScale[0] / 2;
offsetY = -hudElement->unkImgScale[1] / 2;
xScaled = (f32) drawSizeX / (f32) texSizeX;
yScaled = (f32) drawSizeY / (f32) texSizeY;
xScaled = 1.0f / xScaled;
yScaled = 1.0f / yScaled;
hudElement->widthScale = X10(xScaled);
hudElement->heightScale = X10(yScaled);
if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
}
hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
}
}
}
void render_hud_elements_frontUI(void) {
s32 i, count, j;
s32 sortedElements[ARRAY_COUNT(*gHudElements)];
s32 el1, el2;
s32 texSizeX, texSizeY;
s32 drawSizeX, drawSizeY, offsetX, offsetY;
HudElement* hudElement;
gSPDisplayList(gMainGfxPos++, VIRTUAL_TO_PHYSICAL(gHudElementsDLFrontUI));
count = 0;
for (i = 0; i < ARRAY_COUNT(*gHudElements); i++) {
hudElement = (*gHudElements)[i];
if (hudElement != NULL) {
s32 flags = hudElement->flags;
if (flags && !(flags & HUD_ELEMENT_FLAG_DISABLED)) {
if (!(flags & (HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_TRANSFORM | HUD_ELEMENT_FLAG_200000 | HUD_ELEMENT_FLAG_10000000))) {
if ((flags & HUD_ELEMENT_FLAG_FRONTUI) && hudElement->drawSizePreset >= 0) {
sortedElements[count++] = i;
}
}
}
}
}
for (i = 0; i < count - 1; i++) {
for (j = i + 1; j < count; j++) {
el1 = sortedElements[i];
el2 = sortedElements[j];
if ((*gHudElements)[el1]->worldPosOffset.z < (*gHudElements)[el2]->worldPosOffset.z) {
sortedElements[i] = el2;
sortedElements[j] = el1;
}
}
}
for (i = 0; i < count; i++) {
hudElement = (*gHudElements)[sortedElements[i]];
if (!(hudElement->flags & HUD_ELEMENT_FLAG_FIXEDSCALE)) {
if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
texSizeX = gHudElementSizes[hudElement->tileSizePreset].width;
texSizeY = gHudElementSizes[hudElement->tileSizePreset].height;
} else {
texSizeX = hudElement->customImageSize.x;
texSizeY = hudElement->customImageSize.y;
}
if (!(hudElement->flags & HUD_ELEMENT_FLAG_SCALED)) {
if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
drawSizeX = gHudElementSizes[hudElement->drawSizePreset].width;
drawSizeY = gHudElementSizes[hudElement->drawSizePreset].height;
offsetX = -drawSizeX / 2;
offsetY = -drawSizeY / 2;
} else {
// TODO find better match
do {
drawSizeX = hudElement->customDrawSize.x;
drawSizeY = hudElement->customDrawSize.y;
offsetX = -drawSizeX / 2;
} while (0);
offsetY = -drawSizeY / 2;
}
} else {
drawSizeX = hudElement->sizeX;
drawSizeY = hudElement->sizeY;
offsetX = -drawSizeX / 2;
offsetY = -drawSizeY / 2;
}
if (!(hudElement->flags & HUD_ELEMENT_FLAG_REPEATED)) {
if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, TRUE);
}
hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, FALSE);
} else {
if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
}
hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
}
} else {
f32 xScaled, yScaled;
if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
texSizeX = gHudElementSizes[hudElement->drawSizePreset].width;
texSizeY = gHudElementSizes[hudElement->drawSizePreset].height;
} else {
texSizeX = hudElement->customImageSize.x;
texSizeY = hudElement->customImageSize.y;
}
drawSizeX = hudElement->unkImgScale[0];
drawSizeY = hudElement->unkImgScale[1];
offsetX = -hudElement->unkImgScale[0] / 2;
offsetY = -hudElement->unkImgScale[1] / 2;
xScaled = (f32) drawSizeX / (f32) texSizeX;
yScaled = (f32) drawSizeY / (f32) texSizeY;
xScaled = 1.0f / xScaled;
yScaled = 1.0f / yScaled;
hudElement->widthScale = X10(xScaled);
hudElement->heightScale = X10(yScaled);
if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
}
hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
}
}
}
void render_hud_element(HudElement* hudElement) {
Matrix4f sp20;
Matrix4f sp60;
Matrix4f spA0;
Matrix4f spE0;
Matrix4f sp120;
Matrix4f sp160;
Matrix4f sp1A0;
Matrix4f sp1E0;
Matrix4f sp220;
Matrix4f sp260;
ImgFXTexture ifxImg;
f32 xScaleFactor, yScaleFactor;
s32 height, width;
HudTransform* transform;
s32 mode;
u32 flags;
IMG_PTR raster;
PAL_PTR palette;
u32 a0, v1;
s32 ulx, uly, lrx, lry;
Vtx* vtx;
Vtx* vtx2;
if (hudElement->flags & HUD_ELEMENT_FLAG_FILTER_TEX) {
gDPSetTextureFilter(gMainGfxPos++, G_TF_AVERAGE);
} else {
gDPSetTextureFilter(gMainGfxPos++, G_TF_POINT);
}
if (!(hudElement->flags & HUD_ELEMENT_FLAG_FIXEDSCALE)) {
xScaleFactor = 1.0f;
yScaleFactor = 1.0f;
} else {
if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
xScaleFactor = gHudElementSizes[hudElement->tileSizePreset].width;
yScaleFactor = gHudElementSizes[hudElement->tileSizePreset].height;
} else {
xScaleFactor = hudElement->customImageSize.x;
yScaleFactor = hudElement->customImageSize.y;
}
xScaleFactor /= hudElement->unkImgScale[0];
xScaleFactor = 1.0f / xScaleFactor;
yScaleFactor /= hudElement->unkImgScale[1];
yScaleFactor = 1.0f / yScaleFactor;
}
if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
width = gHudElementSizes[hudElement->tileSizePreset].width;
height = gHudElementSizes[hudElement->tileSizePreset].height;
} else {
width = hudElement->customImageSize.x;
height = hudElement->customImageSize.y;
}
transform = hudElement->hudTransform;
guTranslateF(sp1E0, transform->pivot.x, -transform->pivot.y, 0.0f);
guTranslateF(sp220, -transform->pivot.x, transform->pivot.y, 0.0f);
guTranslateF(
sp1A0,
hudElement->renderPosX + hudElement->screenPosOffset.x + hudElement->worldPosOffset.x + transform->pos.x,
-hudElement->renderPosY - hudElement->screenPosOffset.y + hudElement->worldPosOffset.y + transform->pos.y,
- (hudElement->worldPosOffset.z / 10.0) + transform->pos.z
);
guScaleF(sp260, hudElement->uniformScale * xScaleFactor * transform->scale.x,
hudElement->uniformScale * yScaleFactor * transform->scale.y,
transform->scale.z);
guRotateF(sp120, transform->rot.y, 0.0f, 1.0f, 0.0f);
guRotateF(sp160, transform->rot.z, 0.0f, 0.0f, 1.0f);
guRotateF(spE0, transform->rot.x, 1.0f, 0.0f, 0.0f);
guMtxCatF(sp160, spE0, sp20);
guMtxCatF(sp20, sp120, spA0);
guMtxCatF(sp260, sp1E0, sp20);
guMtxCatF(sp20, spA0, sp60);
guMtxCatF(sp60, sp220, sp20);
guMtxCatF(sp20, sp1A0, sp60);
guMtxF2L(sp60, &gDisplayContext->matrixStack[gMatrixListPos]);
gSPMatrix(gMainGfxPos++, VIRTUAL_TO_PHYSICAL(&gDisplayContext->matrixStack[gMatrixListPos++]),
G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
mode = 0;
a0 = mode;
a0 = (hudElement->flags & HUD_ELEMENT_FLAG_FMT_CI4) > a0;
v1 = mode < (hudElement->flags & HUD_ELEMENT_FLAG_FMT_IA8);
if (a0 == TRUE) {
mode = (v1 < 1);
}
if (a0 == FALSE) {
if (v1 == TRUE) {
mode = 2;
}
}
if (a0 == TRUE) {
if (v1 == a0) {
mode = 2;
}
}
switch (mode) {
case 1:
if (hudElement->flags & HUD_ELEMENT_FLAG_NO_FOLD) {
if (hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT) {
imgfx_update(0, IMGFX_SET_ALPHA, 255, 255, 255, hudElement->opacity, 0);
} else {
imgfx_update(0, IMGFX_CLEAR, 0, 0, 0, 0, 0);
}
} else {
if (hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT) {
imgfx_update(transform->imgfxIdx, IMGFX_SET_ALPHA, 255, 255, 255, hudElement->opacity, 0);
} else {
imgfx_update(transform->imgfxIdx, IMGFX_CLEAR, 0, 0, 0, 0, 0);
}
}
ifxImg.raster = hudElement->imageAddr;
palette = (u16*) hudElement->paletteAddr;
ifxImg.width = width;
ifxImg.height = height;
ifxImg.xOffset = -width / 2;
ifxImg.yOffset = height / 2;
ifxImg.alpha = 255;
ifxImg.palette = palette;
if (hudElement->flags & HUD_ELEMENT_FLAG_NO_FOLD) {
if (hudElement->flags & HUD_ELEMENT_FLAG_ANTIALIASING) {
imgfx_appendGfx_component(0, &ifxImg, IMGFX_FLAG_40, sp60);
} else {
imgfx_appendGfx_component(0, &ifxImg, IMGFX_FLAG_40, sp60);
}
} else {
imgfx_appendGfx_component(transform->imgfxIdx, &ifxImg, IMGFX_FLAG_40, sp60);
}
break;
case 2:
transform->unk_30[D_80159180].vtx[0] = D_8014F0C8[0];
transform->unk_30[D_80159180].vtx[1] = D_8014F0C8[1];
transform->unk_30[D_80159180].vtx[2] = D_8014F0C8[2];
transform->unk_30[D_80159180].vtx[3] = D_8014F0C8[3];
vtx2 = transform->unk_30[D_80159180].vtx;
vtx = vtx2;
vtx2->v.ob[0] = -width / 2;
vtx2->v.ob[1] = -height / 2;
vtx2->v.ob[2] = 0;
vtx2->v.tc[0] = 0;
vtx2->v.tc[1] = height * 32;
vtx2 = vtx2 + 1;
vtx2[0].v.ob[0] = (width / 2) - 1;
vtx2[0].v.ob[1] = -height / 2;
vtx2[0].v.ob[2] = 0;
vtx2[0].v.tc[0] = width * 32;
vtx2[0].v.tc[1] = height * 32;
vtx[2].v.ob[0] = (width / 2) - 1;
vtx[2].v.ob[1] = (height / 2) - 1;
vtx[2].v.ob[2] = 0;
vtx[2].v.tc[0] = width * 32;
vtx[2].v.tc[1] = 0;
vtx[3].v.ob[0] = -width / 2;
vtx[3].v.ob[1] = (height / 2) - 1;
vtx[3].v.ob[2] = 0;
vtx[3].v.tc[0] = 0;
vtx[3].v.tc[1] = 0;
gDPPipeSync(gMainGfxPos++);
gDPSetCombineLERP(gMainGfxPos++, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, 0, TEXEL0, 0, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, 0, TEXEL0, 0);
gDPSetPrimColor(gMainGfxPos++, 0, 0,
hudElement->tint.r, hudElement->tint.g, hudElement->tint.b, hudElement->opacity);
if (!(hudElement->flags & HUD_ELEMENT_FLAG_TRANSPARENT)) {
if (!(hudElement->flags & HUD_ELEMENT_FLAG_ANTIALIASING)) {
gDPSetRenderMode(gMainGfxPos++, G_RM_TEX_EDGE, G_RM_TEX_EDGE2);
} else {
gDPSetRenderMode(gMainGfxPos++, G_RM_AA_TEX_EDGE, G_RM_AA_TEX_EDGE2);
}
} else {
if (!(hudElement->flags & HUD_ELEMENT_FLAG_ANTIALIASING)) {
gDPSetRenderMode(gMainGfxPos++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
} else {
gDPSetRenderMode(gMainGfxPos++, AA_EN | G_RM_CLD_SURF, AA_EN | G_RM_CLD_SURF2);
}
}
gDPLoadTextureBlock(gMainGfxPos++, hudElement->imageAddr, G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gDPSetTextureLUT(gMainGfxPos++, G_TT_NONE);
gSPVertex(gMainGfxPos++, &transform->unk_30[D_80159180], 4, 0);
gSP1Triangle(gMainGfxPos++, 0, 1, 2, 0);
gSP1Triangle(gMainGfxPos++, 0, 2, 3, 0);
break;
}
gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
gDPPipeSync(gMainGfxPos++);
}
void render_hud_elements_world(void) {
s32 i, count, j;
s32 sortedElements[ARRAY_COUNT(*gHudElements)];
s32 el1, el2;
HudElement* hudElement;
s16 tempOffsetZ;
// TODO fix this terrible match
do {
do {
count = 0;
if (gCurrentCamID == CAM_3) {
for (i = 0; i < ARRAY_COUNT(*gHudElements); i++) {
hudElement = (*gHudElements)[i];
if (hudElement != NULL) {
s32 flags = hudElement->flags;
if (flags && !(flags & HUD_ELEMENT_FLAG_DISABLED)) {
if (!(flags & (HUD_ELEMENT_FLAG_200000 | HUD_ELEMENT_FLAG_10000000))) {
if (flags & HUD_ELEMENT_FLAG_TRANSFORM) {
if (!(flags & HUD_ELEMENT_FLAG_40000000)) {
if (!(flags & HUD_ELEMENT_FLAG_FRONTUI) && hudElement->drawSizePreset >= 0 && !(flags & HUD_ELEMENT_FLAG_80)) {
sortedElements[count++] = i;
}
}
}
}
}
}
}
if (count != 0) {
for (i = 0; i < count - 1; i++) {
for (j = i + 1; j < count; j++) {
el1 = sortedElements[i];
el2 = sortedElements[j];
tempOffsetZ = (*gHudElements)[el1]->worldPosOffset.z;
do {} while (0);
if (tempOffsetZ < (*gHudElements)[el2]->worldPosOffset.z) {
sortedElements[i] = el2;
sortedElements[j] = el1;
}
}
}
gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 12, 20, 308, 220);
gDPPipeSync(gMainGfxPos++);
gSPClearGeometryMode(gMainGfxPos++, G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH);
gSPSetGeometryMode(gMainGfxPos++, G_ZBUFFER | G_SHADE | G_LIGHTING | G_SHADING_SMOOTH);
gSPSetLights1(gMainGfxPos++, D_8014F108);
gSPTexture(gMainGfxPos++, -1, -1, 0, G_TX_RENDERTILE, G_ON);
gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE);
gSPSetOtherMode(gMainGfxPos++, G_SETOTHERMODE_H, G_MDSFT_ALPHADITHER, 18, G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_PERSP | G_CYC_1CYCLE);
for (i = 0; i < count; i++) {
render_hud_element((*gHudElements)[sortedElements[i]]);
}
}
}
count = 0;
if (gCurrentCamID == CAM_BATTLE) {
for (i = 0; i < ARRAY_COUNT(*gHudElements); i++) {
hudElement = (*gHudElements)[i];
if (hudElement != NULL) {
s32 flags = hudElement->flags;
if (flags && !(flags & HUD_ELEMENT_FLAG_DISABLED)) {
if (!(flags & (HUD_ELEMENT_FLAG_200000 | HUD_ELEMENT_FLAG_10000000))) {
if (flags & HUD_ELEMENT_FLAG_TRANSFORM) {
if (flags & HUD_ELEMENT_FLAG_40000000) {
if (!(flags & HUD_ELEMENT_FLAG_FRONTUI) && hudElement->drawSizePreset >= 0 && !(flags & HUD_ELEMENT_FLAG_80)) {
sortedElements[count++] = i;
}
}
}
}
}
}
}
if (count != 0) {
for (i = 0; i < count - 1; i++) {
for (j = i + 1; j < count; j++) {
el1 = sortedElements[i];
el2 = sortedElements[j];
tempOffsetZ = (*gHudElements)[el1]->worldPosOffset.z;
do {} while (0);
if ((*gHudElements)[el1]->worldPosOffset.z < (*gHudElements)[el2]->worldPosOffset.z) {
sortedElements[i] = el2;
sortedElements[j] = el1;
}
}
}
gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 12, 20, 308, 220);
gDPPipeSync(gMainGfxPos++);
gSPClearGeometryMode(gMainGfxPos++, G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH);
gSPSetGeometryMode(gMainGfxPos++, G_ZBUFFER | G_SHADE | G_LIGHTING | G_SHADING_SMOOTH);
gSPSetLights1(gMainGfxPos++, D_8014F108);
gSPTexture(gMainGfxPos++, -1, -1, 0, G_TX_RENDERTILE, G_ON);
gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE);
gSPSetOtherMode(gMainGfxPos++, G_SETOTHERMODE_H, G_MDSFT_ALPHADITHER, 18, G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_PERSP | G_CYC_1CYCLE);
for (i = 0; i < count; i++) {
render_hud_element((*gHudElements)[sortedElements[i]]);
}
}
}
} while (0);
} while (0);
}
void func_80143C48(s32 elemID, s32 arg1, s32 camID) {
Camera* camera = &gCameras[camID];
if (arg1 > 0) {
if (camera->flags == 0 || (camera->flags & CAMERA_FLAG_DISABLED)) {
return;
}
gCurrentCamID = camID;
gSPViewport(gMainGfxPos++, &camera->vp);
gSPClearGeometryMode(gMainGfxPos++, G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN |
G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH);
gSPTexture(gMainGfxPos++, 0, 0, 0, G_TX_RENDERTILE, G_OFF);
gDPPipelineMode(gMainGfxPos++, G_PM_NPRIMITIVE);
gDPSetTextureLUT(gMainGfxPos++, G_TT_NONE);
gDPSetTextureFilter(gMainGfxPos++, G_TF_BILERP);
gDPSetCombineMode(gMainGfxPos++, G_CC_SHADE, G_CC_SHADE);
gDPSetRenderMode(gMainGfxPos++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
gSPClipRatio(gMainGfxPos++, FRUSTRATIO_2);
gDPPipeSync(gMainGfxPos++);
//clear Z buffer inside camera viewport
gDPSetCycleType(gMainGfxPos++, G_CYC_FILL);
gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, osVirtualToPhysical(nuGfxZBuffer));
gDPSetFillColor(gMainGfxPos++, GPACK_ZDZ(G_MAXFBZ, 0)<<16 | GPACK_ZDZ(G_MAXFBZ, 0));
gDPFillRectangle(gMainGfxPos++, camera->viewportStartX, camera->viewportStartY,
camera->viewportStartX + camera->viewportW - 1,
camera->viewportStartY + camera->viewportH - 1);
gDPPipeSync(gMainGfxPos++);
gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, osVirtualToPhysical(nuGfxCfb_ptr));
gDPPipeSync(gMainGfxPos++);
guOrthoF(camera->perspectiveMatrix, 0.0f, 320.0f, -240.0f, 0.0f, -1000.0f, 1000.0f, 1.0f);
guMtxF2L(camera->perspectiveMatrix, &gDisplayContext->camPerspMatrix[gCurrentCamID]);
gSPMatrix(gMainGfxPos++, &gDisplayContext->camPerspMatrix[gCurrentCamID], G_MTX_NOPUSH | G_MTX_LOAD |
G_MTX_PROJECTION);
gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 12, 20, 308, 220);
gDPPipeSync(gMainGfxPos++);
gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE);
gSPClearGeometryMode(gMainGfxPos++, G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING |
G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH);
gSPSetGeometryMode(gMainGfxPos++, G_ZBUFFER | G_SHADE | G_LIGHTING | G_SHADING_SMOOTH);
gSPSetLights1(gMainGfxPos++, D_8014F108);
gSPTexture(gMainGfxPos++, -1, -1, 0, G_TX_RENDERTILE, G_ON);
gDPSetTextureLOD(gMainGfxPos++, G_TL_TILE);
gDPSetTexturePersp(gMainGfxPos++, G_TP_PERSP);
gDPSetColorDither(gMainGfxPos++, G_CD_DISABLE);
gDPSetTextureDetail(gMainGfxPos++, G_TD_CLAMP);
gDPSetTextureConvert(gMainGfxPos++, G_TC_FILT);
gDPSetCombineKey(gMainGfxPos++, G_CK_NONE);
gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE);
}
if (elemID >= 0) {
HudElement* elem;
elemID &= ~HUD_ELEMENT_BATTLE_ID_MASK;
elem = (*gHudElements)[elemID];
if (elem != NULL) {
if (elem->flags && !(elem->flags & HUD_ELEMENT_FLAG_DISABLED)) {
if (!(elem->flags & (HUD_ELEMENT_FLAG_200000 | HUD_ELEMENT_FLAG_10000000))) {
if (elem->flags & HUD_ELEMENT_FLAG_TRANSFORM) {
if (!(elem->flags & HUD_ELEMENT_FLAG_FRONTUI) && (elem->drawSizePreset >= 0) && (elem->flags & HUD_ELEMENT_FLAG_80)) {
render_hud_element(elem);
}
}
}
}
}
}
}
void func_80144218(s32 arg0) {
func_80143C48(arg0, 1, CAM_3);
}
void func_80144238(s32 arg0) {
func_80143C48(arg0, 0, CAM_3);
}
void func_80144258(s32 arg0) {
func_80143C48(arg0, 1, CAM_BATTLE);
}
void func_80144278(s32 arg0) {
func_80143C48(arg0, 0, CAM_BATTLE);
}
void draw_hud_element_internal(s32 id, s32 clipMode) {
HudElement* elem = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
s32 texSizeX, texSizeY;
s32 drawSizeX, drawSizeY;
s32 offsetX, offsetY;
s32 preset;
if (elem->flags && !(elem->flags & HUD_ELEMENT_FLAG_DISABLED)) {
if (!(elem->flags & (HUD_ELEMENT_FLAG_200000 | HUD_ELEMENT_FLAG_10000000)) && (elem->drawSizePreset >= 0)) {
if (clipMode != HUD_ELEMENT_DRAW_NEXT) {
if (clipMode == HUD_ELEMENT_DRAW_FIRST_WITH_CLIPPING) {
gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 12, 20, SCREEN_WIDTH - 12, SCREEN_HEIGHT - 20);
}
gDPPipeSync(gMainGfxPos++);
gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE);
gDPSetTexturePersp(gMainGfxPos++, G_TP_NONE);
gDPSetTextureLOD(gMainGfxPos++, G_TL_TILE);
gDPSetTextureDetail(gMainGfxPos++, G_TD_CLAMP);
gDPSetTextureConvert(gMainGfxPos++, G_TC_FILT);
gDPSetCombineKey(gMainGfxPos++, G_CK_NONE);
gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE);
gDPNoOp(gMainGfxPos++);
gDPSetColorDither(gMainGfxPos++, G_CD_DISABLE);
gDPSetAlphaDither(gMainGfxPos++, G_AD_DISABLE);
gSPTexture(gMainGfxPos++, -1, -1, 0, G_TX_RENDERTILE, G_ON);
}
if (!(elem->flags & HUD_ELEMENT_FLAG_FIXEDSCALE)) {
if (!(elem->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
preset = elem->tileSizePreset;
texSizeX = gHudElementSizes[preset].width;
texSizeY = gHudElementSizes[preset].height;
} else {
texSizeX = elem->customImageSize.x;
texSizeY = elem->customImageSize.y;
}
if (!(elem->flags & HUD_ELEMENT_FLAG_SCALED)) {
if (!(elem->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
drawSizeX = gHudElementSizes[elem->drawSizePreset].width;
drawSizeY = gHudElementSizes[elem->drawSizePreset].height;
} else {
drawSizeX = elem->customDrawSize.x;
drawSizeY = elem->customDrawSize.y;
}
} else {
drawSizeX = elem->sizeX;
drawSizeY = elem->sizeY;
}
do {
offsetX = -drawSizeX / 2;
offsetY = -drawSizeY / 2;
} while (0); // required to match
if (!(elem->flags & HUD_ELEMENT_FLAG_REPEATED)) {
if (elem->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, TRUE);
}
hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, FALSE);
} else {
if (elem->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
}
hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
}
} else {
f32 xScaled, yScaled;
if (!(elem->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
preset = elem->tileSizePreset;
texSizeX = gHudElementSizes[preset].width;
texSizeY = gHudElementSizes[preset].height;
} else {
texSizeX = elem->customImageSize.x;
texSizeY = elem->customImageSize.y;
}
drawSizeX = elem->unkImgScale[0];
drawSizeY = elem->unkImgScale[1];
offsetX = -elem->unkImgScale[0] / 2;
offsetY = -elem->unkImgScale[1] / 2;
xScaled = (f32) drawSizeX / (f32) texSizeX;
yScaled = (f32) drawSizeY / (f32) texSizeY;
xScaled = 1.0f / xScaled;
yScaled = 1.0f / yScaled;
elem->widthScale = X10(xScaled);
elem->heightScale = X10(yScaled);
if (elem->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
}
hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
}
}
}
}
void hud_element_draw_clipped(s32 id) {
draw_hud_element_internal(id, HUD_ELEMENT_DRAW_FIRST_WITH_CLIPPING);
}
void hud_element_draw_next(s32 id) {
draw_hud_element_internal(id, HUD_ELEMENT_DRAW_NEXT);
}
void hud_element_draw_without_clipping(s32 id) {
draw_hud_element_internal(id, HUD_ELEMENT_DRAW_FIRST_WITHOUT_CLIPPING);
}
void hud_element_set_script(s32 id, HudScript* anim) {
HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
if (anim == NULL) {
anim = &HES_Empty;
}
hudElement->updateTimer = 1;
hudElement->widthScale = X10(1.0f);
hudElement->heightScale = X10(1.0f);
hudElement->readPos = anim;
hudElement->anim = anim;
hudElement->loopStartPos = anim;
hudElement->screenPosOffset.x = 0;
hudElement->screenPosOffset.y = 0;
hudElement->worldPosOffset.x = 0;
hudElement->worldPosOffset.y = 0;
hudElement->flags &= ~HUD_ELEMENT_FLAG_ANIMATION_FINISHED;
hudElement->uniformScale = 1.0f;
hudElement->flags &= ~(HUD_ELEMENT_FLAG_SCALED | HUD_ELEMENT_FLAG_TRANSPARENT | HUD_ELEMENT_FLAG_FIXEDSCALE | HUD_ELEMENT_FLAG_REPEATED);
hud_element_load_script(hudElement, anim);
while (hud_element_update(hudElement) != 0) {}
}
HudScript* hud_element_get_script(s32 id) {
return (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK]->anim;
}
HudElement* get_hud_element(s32 id) {
return (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
}
void hud_element_free(s32 id) {
if ((*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK]->flags & HUD_ELEMENT_FLAG_TRANSFORM) {
hud_element_free_transform(id & ~HUD_ELEMENT_BATTLE_ID_MASK);
}
heap_free((*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK]);
(*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK] = NULL;
gHudElementsNumber--;
}
void hud_element_set_render_pos(s32 id, s32 x, s32 y) {
HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
hudElement->renderPosX = x;
hudElement->renderPosY = y;
}
void hud_element_get_render_pos(s32 id, s32* x, s32* y) {
HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
*x = hudElement->renderPosX;
*y = hudElement->renderPosY;
}
void hud_element_set_render_depth(s32 id, s32 z) {
(*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK]->worldPosOffset.z = z;
}
void hud_element_set_flags(s32 id, s32 flags) {
(*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK]->flags |= flags;
}
void hud_element_clear_flags(s32 id, s32 flags) {
(*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK]->flags &= ~flags;
}
void ALT_clear_hud_element_cache(void) {
s32 i;
if (!gGameStatusPtr->isBattle) {
heap_free(gHudElementCacheBuffer);
gHudElementCacheBuffer = heap_malloc(gHudElementCacheCapacity);
ASSERT(gHudElementCacheBuffer);
gHudElementCacheBufferWorld = gHudElementCacheBuffer;
*gHudElementCacheSize = 0;
gHudElementCacheSize = &gHudElementCacheSizeWorld;
gHudElementCacheTableRaster = gHudElementCacheTableRasterWorld;
gHudElementCacheTablePalette = gHudElementCacheTablePaletteWorld;
gHudElementCacheBuffer = gHudElementCacheBufferWorld;
for (i = 0; i < MAX_HUD_CACHE_ENTRIES; i++) {
gHudElementCacheTableRasterWorld[i].id = -1;
gHudElementCacheTablePaletteWorld[i].id = -1;
}
} else {
if (gHudElementAuxCache == NULL) {
heap_free(gHudElementCacheBuffer);
gHudElementCacheBuffer = heap_malloc(gHudElementCacheCapacity / 2);
ASSERT(gHudElementCacheBuffer);
} else {
gHudElementCacheBuffer = gHudElementAuxCache;
}
gHudElementCacheBufferBattle = gHudElementCacheBuffer;
*gHudElementCacheSize = 0;
gHudElementCacheSize = &gHudElementCacheSizeBattle;
gHudElementCacheTableRaster = gHudElementCacheTableRasterBattle;
gHudElementCacheTablePalette = gHudElementCacheTablePaletteBattle;
gHudElementCacheBuffer = gHudElementCacheBufferBattle;
for (i = 0; i < MAX_HUD_CACHE_ENTRIES; i++) {
gHudElementCacheTableRasterBattle[i].id = -1;
gHudElementCacheTablePaletteBattle[i].id = -1;
}
}
}
void hud_element_set_scale(s32 index, f32 scale) {
HudElement* elem = (*gHudElements)[index & ~HUD_ELEMENT_BATTLE_ID_MASK];
s32 drawSizeX;
s32 drawSizeY;
s32 imgSizeX;
s32 imgSizeY;
f32 xScaled, yScaled;
elem->uniformScale = scale;
if (!(elem->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
imgSizeX = gHudElementSizes[elem->tileSizePreset].width;
imgSizeY = gHudElementSizes[elem->tileSizePreset].height;
drawSizeX = gHudElementSizes[elem->drawSizePreset].width;
drawSizeY = gHudElementSizes[elem->drawSizePreset].height;
} else {
imgSizeX = elem->customImageSize.x;
imgSizeY = elem->customImageSize.y;
drawSizeX = elem->customDrawSize.x;
drawSizeY = elem->customDrawSize.y;
}
elem->sizeX = drawSizeX * scale;
elem->sizeY = drawSizeY * scale;
elem->flags &= ~HUD_ELEMENT_FLAG_FIXEDSCALE;
elem->flags |= HUD_ELEMENT_FLAG_REPEATED | HUD_ELEMENT_FLAG_SCALED;
xScaled = ((f32) drawSizeX / (f32) imgSizeX) * scale;
yScaled = ((f32) drawSizeY / (f32) imgSizeY) * scale;
xScaled = 1.0f / xScaled;
yScaled = 1.0f / yScaled;
elem->widthScale = X10(xScaled);
elem->heightScale = X10(yScaled);
}
void hud_element_use_preset_size(s32 id, s8 sizePreset) {
HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
hudElement->widthScale = X10(1.0f);
hudElement->heightScale = X10(1.0f);
hudElement->tileSizePreset = sizePreset;
hudElement->drawSizePreset = sizePreset;
hudElement->uniformScale = 1.0f;
hudElement->flags &= ~HUD_ELEMENT_FLAG_FIXEDSCALE;
hudElement->flags &= ~(HUD_ELEMENT_FLAG_SCALED | HUD_ELEMENT_FLAG_REPEATED);
}
s32 func_80144E4C(s32 id) {
return ((*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK]->flags >> 24) & 0xF;
}
void func_80144E74(s32 id, s32 arg1) {
HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
hudElement->flags &= ~(HUD_ELEMENT_FLAG_1000000 | HUD_ELEMENT_FLAG_2000000 | HUD_ELEMENT_FLAG_4000000 | HUD_ELEMENT_FLAG_8000000);
hudElement->flags |= arg1 << 24;
}
void hud_element_set_alpha(s32 id, s32 opacity) {
HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
hudElement->flags |= HUD_ELEMENT_FLAG_TRANSPARENT;
hudElement->opacity = opacity;
if (opacity == 255) {
hudElement->flags &= ~HUD_ELEMENT_FLAG_TRANSPARENT;
}
}
void hud_element_set_tint(s32 id, s32 r, s32 g, s32 b) {
HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
hudElement->tint.r = r;
hudElement->tint.g = g;
hudElement->tint.b = b;
}
void hud_element_create_transform_A(s32 id) {
HudElement* element = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
HudTransform* transform = general_heap_malloc(sizeof(*transform));
element->hudTransform = transform;
ASSERT(transform != NULL);
element->flags |= HUD_ELEMENT_FLAG_TRANSFORM;
transform->imgfxIdx = imgfx_get_free_instances(1);
transform->pos.x = 0.0f;
transform->pos.y = 0.0f;
transform->pos.z = 0.0f;
transform->rot.x = 0.0f;
transform->rot.y = 0.0f;
transform->rot.z = 0.0f;
transform->scale.x = 1.0f;
transform->scale.y = 1.0f;
transform->scale.z = 1.0f;
transform->pivot.x = 0;
transform->pivot.y = 0;
func_801413F8();
}
void hud_element_create_transform_B(s32 id) {
HudElement* element = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
HudTransform* transform = general_heap_malloc(sizeof(*transform));
element->hudTransform = transform;
ASSERT(transform != NULL);
element->flags |= HUD_ELEMENT_FLAG_TRANSFORM | HUD_ELEMENT_FLAG_NO_FOLD;
transform->imgfxIdx = 0;
transform->pos.x = 0.0f;
transform->pos.y = 0.0f;
transform->pos.z = 0.0f;
transform->rot.x = 0.0f;
transform->rot.y = 0.0f;
transform->rot.z = 0.0f;
transform->scale.x = 1.0f;
transform->scale.y = 1.0f;
transform->scale.z = 1.0f;
func_801413F8();
}
void hud_element_create_transform_C(s32 id) {
HudElement* element = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
HudTransform* transform = general_heap_malloc(sizeof(*transform));
element->hudTransform = transform;
ASSERT(transform != NULL);
element->flags |= HUD_ELEMENT_FLAG_40000000 | HUD_ELEMENT_FLAG_NO_FOLD | HUD_ELEMENT_FLAG_TRANSFORM;
transform->imgfxIdx = 0;
transform->pos.x = 0.0f;
transform->pos.y = 0.0f;
transform->pos.z = 0.0f;
transform->rot.x = 0.0f;
transform->rot.y = 0.0f;
transform->rot.z = 0.0f;
transform->scale.x = 1.0f;
transform->scale.y = 1.0f;
transform->scale.z = 1.0f;
func_801413F8();
}
void hud_element_free_transform(s32 id) {
HudElement* hudElement = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
HudTransform* hudTransform = hudElement->hudTransform;
if (!(hudElement->flags & HUD_ELEMENT_FLAG_NO_FOLD)) {
imgfx_release_instance(hudTransform->imgfxIdx);
}
heap_free(hudElement->hudTransform);
hudElement->hudTransform = NULL;
hudElement->flags &= ~(HUD_ELEMENT_FLAG_40000000 | HUD_ELEMENT_FLAG_NO_FOLD | HUD_ELEMENT_FLAG_TRANSFORM);
}
void hud_element_set_transform_pos(s32 id, f32 x, f32 y, f32 z) {
HudElement* element = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
HudTransform* transform = element->hudTransform;
if (element->flags & HUD_ELEMENT_FLAG_TRANSFORM) {
transform->pos.x = x;
transform->pos.y = y;
transform->pos.z = z;
}
}
void hud_element_set_transform_scale(s32 id, f32 x, f32 y, f32 z) {
HudElement* element = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
HudTransform* transform = element->hudTransform;
if (element->flags & HUD_ELEMENT_FLAG_TRANSFORM) {
transform->scale.x = x;
transform->scale.y = y;
transform->scale.z = z;
}
}
void hud_element_set_transform_rotation(s32 id, f32 x, f32 y, f32 z) {
HudElement* element = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
HudTransform* transform = element->hudTransform;
if (element->flags & HUD_ELEMENT_FLAG_TRANSFORM) {
transform->rot.x = x;
transform->rot.y = y;
transform->rot.z = z;
}
}
void hud_element_set_transform_rotation_pivot(s32 id, s32 dx, s32 dy) {
HudElement* element = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
HudTransform* transform = element->hudTransform;
if (element->flags & HUD_ELEMENT_FLAG_TRANSFORM) {
transform->pivot.x = dx;
transform->pivot.y = dy;
}
}
void copy_world_hud_element_ref_to_battle(s32 worldID, s32 battleID) {
gHudElementsBattle[battleID & ~HUD_ELEMENT_BATTLE_ID_MASK] = gHudElementsWorld[worldID & ~HUD_ELEMENT_BATTLE_ID_MASK];
}
void hud_element_set_aux_cache(void* base, s32 size) {
gHudElementAuxCache = (u8*)base;
if (base == NULL) {
gHudElementCacheCapacity = 0x11000;
} else {
gHudElementCacheCapacity = size;
}
}
|
b83457e9c411a4fb8748eb0b06a3166f11577264
|
dd4cc30a2e4368c0d350ced7218295819e102fba
|
/vendored_parsers/tree-sitter-cpp/bindings/swift/TreeSitterCPP/cpp.h
|
7b9e586c62bc8cc06a26db974c6b643b151ac7b3
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"Apache-2.0"
] |
permissive
|
Wilfred/difftastic
|
49c87b4feea6ef1b5ab97abdfa823aff6aa7f354
|
a4ee2cf99e760562c3ffbd016a996ff50ef99442
|
refs/heads/master
| 2023-08-28T17:28:55.097192
| 2023-08-27T04:41:41
| 2023-08-27T04:41:41
| 162,276,894
| 14,748
| 287
|
MIT
| 2023-08-26T15:44:44
| 2018-12-18T11:19:45
|
Rust
|
UTF-8
|
C
| false
| false
| 230
|
h
|
cpp.h
|
#ifndef TREE_SITTER_CPP_H_
#define TREE_SITTER_CPP_H_
typedef struct TSLanguage TSLanguage;
#ifdef __cplusplus
extern "C" {
#endif
extern TSLanguage *tree_sitter_cpp();
#ifdef __cplusplus
}
#endif
#endif // TREE_SITTER_CPP_H_
|
df49f3e84652b79976efb89bd943d325e33a4417
|
dedae7f284ca271834d4289c3b03b5615cb9527a
|
/src/sas/ieee.h
|
fad17c9f1d87791fb345a0f089daa5a85647cbcd
|
[
"MIT"
] |
permissive
|
WizardMac/ReadStat
|
d6bd3b971c461e442c5e6bd4f7a147a434ca6539
|
f6a54c24db613e81d7fd06e049a7ef4f21176fda
|
refs/heads/dev
| 2023-08-08T22:24:19.292128
| 2023-03-26T15:40:23
| 2023-03-26T15:40:23
| 5,128,518
| 239
| 84
|
MIT
| 2023-08-18T09:20:31
| 2012-07-20T21:17:40
|
C
|
UTF-8
|
C
| false
| false
| 178
|
h
|
ieee.h
|
#define CN_TYPE_NATIVE 0
#define CN_TYPE_XPORT 1
#define CN_TYPE_IEEEB 2
#define CN_TYPE_IEEEL 3
int cnxptiee(const void *from_bytes, int fromtype, void *to_bytes, int totype);
|
0935fc84b994032bbb2c4f892fa4b4ba989e167c
|
9907672fcd81ab73ac63b2a83422a82bf31eadde
|
/tyama_imos0015(TLE).c
|
420d59c4e4325e711009877e2fc4960ea2b70ff6
|
[
"0BSD"
] |
permissive
|
cielavenir/procon
|
bbe1974b9bddb51b76d58722a0686a5b477c4456
|
746e1a91f574f20647e8aaaac0d9e6173f741176
|
refs/heads/master
| 2023-06-21T23:11:24.562546
| 2023-06-11T13:15:15
| 2023-06-11T13:15:15
| 7,557,464
| 137
| 136
| null | 2020-10-20T09:35:52
| 2013-01-11T09:40:26
|
C++
|
UTF-8
|
C
| false
| false
| 441
|
c
|
tyama_imos0015(TLE).c
|
#define IN_MAX 31622777
#define PRIME 1952000
char table[IN_MAX+1];
int prime[PRIME];
createtable(){ //0->prime 1->not prime
int i=3,j,k=1;
prime[0]=2;
for(;i<=IN_MAX;i+=2)
if(!table[i]){
prime[k++]=i;
for(j=i*2;j<=IN_MAX;j+=i)
table[j]=1;
}
}
main(i){
long long x;
createtable();
for(;scanf("%lld",&x),x;printf("%d\n",prime[i]))
for(i=0;i<PRIME;i++)
if(!(x%prime[i]))break;
return 0;
}
|
6a3b282e1738d75f55e0692ca4a3066df6337ddb
|
5eff7a36d9a9917dce9111f0c3074375fe6f7656
|
/lib/mesa/src/gallium/drivers/freedreno/a3xx/fd3_resource.c
|
81c0c9704cc6f675b5a4aef40295cbb6c0e27364
|
[] |
no_license
|
openbsd/xenocara
|
cb392d02ebba06f6ff7d826fd8a89aa3b8401779
|
a012b5de33ea0b977095d77316a521195b26cc6b
|
refs/heads/master
| 2023-08-25T12:16:58.862008
| 2023-08-12T16:16:25
| 2023-08-12T16:16:25
| 66,967,384
| 177
| 66
| null | 2023-07-22T18:12:37
| 2016-08-30T18:36:01
|
C
|
UTF-8
|
C
| false
| false
| 3,736
|
c
|
fd3_resource.c
|
/*
* Copyright (C) 2012 Rob Clark <robclark@freedesktop.org>
* Copyright (C) 2019 Khaled Emara <ekhaled1836@gmail.com>
*
* 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 (including the next
* paragraph) 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.
*/
#include "fd3_resource.h"
#include "fd3_format.h"
static uint32_t
setup_slices(struct fd_resource *rsc, uint32_t alignment,
enum pipe_format format)
{
struct pipe_resource *prsc = &rsc->b.b;
uint32_t level, size = 0;
/* 32 pixel alignment */
fdl_set_pitchalign(&rsc->layout, fdl_cpp_shift(&rsc->layout) + 5);
for (level = 0; level <= prsc->last_level; level++) {
struct fdl_slice *slice = fd_resource_slice(rsc, level);
uint32_t pitch = fdl_pitch(&rsc->layout, level);
uint32_t height = u_minify(prsc->height0, level);
if (rsc->layout.tile_mode) {
height = align(height, 4);
if (prsc->target != PIPE_TEXTURE_CUBE)
height = util_next_power_of_two(height);
}
uint32_t nblocksy = util_format_get_nblocksy(format, height);
slice->offset = size;
/* 1d array and 2d array textures must all have the same layer size
* for each miplevel on a3xx. 3d textures can have different layer
* sizes for high levels, but the hw auto-sizer is buggy (or at least
* different than what this code does), so as soon as the layer size
* range gets into range, we stop reducing it.
*/
if (prsc->target == PIPE_TEXTURE_3D &&
(level == 1 ||
(level > 1 && fd_resource_slice(rsc, level - 1)->size0 > 0xf000)))
slice->size0 = align(nblocksy * pitch, alignment);
else if (level == 0 || alignment == 1)
slice->size0 = align(nblocksy * pitch, alignment);
else
slice->size0 = fd_resource_slice(rsc, level - 1)->size0;
size += slice->size0 * u_minify(prsc->depth0, level) * prsc->array_size;
}
return size;
}
uint32_t
fd3_setup_slices(struct fd_resource *rsc)
{
uint32_t alignment;
switch (rsc->b.b.target) {
case PIPE_TEXTURE_3D:
case PIPE_TEXTURE_1D_ARRAY:
case PIPE_TEXTURE_2D_ARRAY:
alignment = 4096;
break;
default:
alignment = 1;
break;
}
return setup_slices(rsc, alignment, rsc->b.b.format);
}
static bool
ok_format(enum pipe_format pfmt)
{
enum a3xx_color_fmt fmt = fd3_pipe2color(pfmt);
if (fmt == RB_NONE)
return false;
switch (pfmt) {
case PIPE_FORMAT_R8_UINT:
case PIPE_FORMAT_R8_SINT:
case PIPE_FORMAT_Z32_FLOAT:
return false;
default:
break;
}
return true;
}
unsigned
fd3_tile_mode(const struct pipe_resource *tmpl)
{
if (ok_format(tmpl->format))
return TILE_4X4;
return LINEAR;
}
|
038113b115c3197435e133b4a7f524a0fbaf0022
|
9ceacf33fd96913cac7ef15492c126d96cae6911
|
/sys/arch/sh/include/rtcreg.h
|
7ebd9274e38f7c9afb3bd8f2dbd34c0ecd026e85
|
[] |
no_license
|
openbsd/src
|
ab97ef834fd2d5a7f6729814665e9782b586c130
|
9e79f3a0ebd11a25b4bff61e900cb6de9e7795e9
|
refs/heads/master
| 2023-09-02T18:54:56.624627
| 2023-09-02T15:16:12
| 2023-09-02T15:16:12
| 66,966,208
| 3,394
| 1,235
| null | 2023-08-08T02:42:25
| 2016-08-30T18:18:25
|
C
|
UTF-8
|
C
| false
| false
| 3,882
|
h
|
rtcreg.h
|
/* $OpenBSD: rtcreg.h,v 1.1.1.1 2006/10/06 21:02:55 miod Exp $ */
/* $NetBSD: rtcreg.h,v 1.10 2006/09/03 12:38:34 uwe Exp $ */
/*-
* Copyright (C) 1999 SAITOH Masanobu. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SH_RTCREG_H_
#define _SH_RTCREG_H_
#include <sh/devreg.h>
/*
* RTC
*/
#define SH3_R64CNT 0xfffffec0
#define SH3_RSECCNT 0xfffffec2
#define SH3_RMINCNT 0xfffffec4
#define SH3_RHRCNT 0xfffffec6
#define SH3_RWKCNT 0xfffffec8
#define SH3_RDAYCNT 0xfffffeca
#define SH3_RMONCNT 0xfffffecc
#define SH3_RYRCNT 0xfffffece
#define SH3_RSECAR 0xfffffed0
#define SH3_RMINAR 0xfffffed2
#define SH3_RHRAR 0xfffffed4
#define SH3_RWKAR 0xfffffed6
#define SH3_RDAYAR 0xfffffed8
#define SH3_RMONAR 0xfffffeda
#define SH3_RCR1 0xfffffedc
#define SH3_RCR2 0xfffffede
#define SH4_R64CNT 0xffc80000
#define SH4_RSECCNT 0xffc80004
#define SH4_RMINCNT 0xffc80008
#define SH4_RHRCNT 0xffc8000c
#define SH4_RWKCNT 0xffc80010
#define SH4_RDAYCNT 0xffc80014
#define SH4_RMONCNT 0xffc80018
#define SH4_RYRCNT 0xffc8001c /* 16 bit */
#define SH4_RSECAR 0xffc80020
#define SH4_RMINAR 0xffc80024
#define SH4_RHRAR 0xffc80028
#define SH4_RWKAR 0xffc8002c
#define SH4_RDAYAR 0xffc80030
#define SH4_RMONAR 0xffc80034
#define SH4_RCR1 0xffc80038
#define SH4_RCR2 0xffc8003c
#define SH_RCR1_CF 0x80 /* carry flag */
#define SH_RCR1_CIE 0x10 /* carry interrupt enable */
#define SH_RCR1_AIE 0x08 /* alarm interrupt enable */
#define SH_RCR1_AF 0x01 /* alarm flag */
#define SH_RCR2_PEF 0x80 /* periodic interrupt flag */
#define SH_RCR2_PES2 0x40 /* periodic interrupt freq */
#define SH_RCR2_PES1 0x20 /* -//- */
#define SH_RCR2_PES0 0x10 /* -//- */
#define SH_RCR2_ENABLE 0x08
#define SH_RCR2_ADJ 0x04 /* second adjustment */
#define SH_RCR2_RESET 0x02
#define SH_RCR2_START 0x01
#ifndef _LOCORE
#if defined(SH3) && defined(SH4)
extern uint32_t __sh_R64CNT;
extern uint32_t __sh_RSECCNT;
extern uint32_t __sh_RMINCNT;
extern uint32_t __sh_RHRCNT;
extern uint32_t __sh_RWKCNT;
extern uint32_t __sh_RDAYCNT;
extern uint32_t __sh_RMONCNT;
extern uint32_t __sh_RYRCNT;
extern uint32_t __sh_RSECAR;
extern uint32_t __sh_RMINAR;
extern uint32_t __sh_RHRAR;
extern uint32_t __sh_RWKAR;
extern uint32_t __sh_RDAYAR;
extern uint32_t __sh_RMONAR;
extern uint32_t __sh_RCR1;
extern uint32_t __sh_RCR2;
#endif /* SH3 && SH4 */
#endif /* !_LOCORE */
#endif /* !_SH_RTCREG_H_ */
|
dfe466e10bb54e04da981f87678b9abe4933ece0
|
badb70a0b235c98ac034cfe5b4bfafda36647831
|
/Library/OcRtcLib/OcRtcLibInternal.h
|
c399c4b2c3c478f2899c875cbd89a350705c85aa
|
[
"BSD-3-Clause"
] |
permissive
|
acidanthera/OpenCorePkg
|
f34a7d67b22c74fb5ab559e48519e5f5855b6751
|
1d5b1736fe5a5ef7662b5c076c6d11aac96fd5d6
|
refs/heads/master
| 2023-08-30T21:03:02.993659
| 2023-08-28T23:30:43
| 2023-08-28T23:30:43
| 179,354,282
| 13,212
| 2,999
|
BSD-3-Clause
| 2023-09-10T18:29:53
| 2019-04-03T19:14:29
|
C
|
UTF-8
|
C
| false
| false
| 2,190
|
h
|
OcRtcLibInternal.h
|
/** @file
OcRtcLib - library with RTC I/O functions
Copyright (c) 2020, vit9696
All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef OC_RTC_LIB_INTERNAL_H
#define OC_RTC_LIB_INTERNAL_H
//
// Available on all platforms, requires NMI bit handling.
//
#define R_PCH_RTC_INDEX 0x70
#define R_PCH_RTC_TARGET 0x71
#define R_PCH_RTC_EXT_INDEX 0x72
#define R_PCH_RTC_EXT_TARGET 0x73
//
// Available on Ivy Bridge and newer. Ignores NMI bit.
//
#define R_PCH_RTC_INDEX_ALT 0x74
#define R_PCH_RTC_TARGET_ALT 0x75
#define R_PCH_RTC_EXT_INDEX_ALT 0x76
#define R_PCH_RTC_EXT_TARGET_ALT 0x77
//
// RTC Memory bank size
//
#define RTC_BANK_SIZE 0x80
//
// RTC INDEX bit mask
//
#define RTC_DATA_MASK 0x7F
#define RTC_NMI_MASK 0x80
//
// Standard register addresses.
//
#define RTC_ADDRESS_SECONDS 0 // R/W Range 0..59
#define RTC_ADDRESS_SECONDS_ALARM 1 // R/W Range 0..59
#define RTC_ADDRESS_MINUTES 2 // R/W Range 0..59
#define RTC_ADDRESS_MINUTES_ALARM 3 // R/W Range 0..59
#define RTC_ADDRESS_HOURS 4 // R/W Range 1..12 or 0..23 Bit 7 is AM/PM
#define RTC_ADDRESS_HOURS_ALARM 5 // R/W Range 1..12 or 0..23 Bit 7 is AM/PM
#define RTC_ADDRESS_DAY_OF_THE_WEEK 6 // R/W Range 1..7
#define RTC_ADDRESS_DAY_OF_THE_MONTH 7 // R/W Range 1..31
#define RTC_ADDRESS_MONTH 8 // R/W Range 1..12
#define RTC_ADDRESS_YEAR 9 // R/W Range 0..99
#define RTC_ADDRESS_REGISTER_A 10 // R/W[0..6] R0[7]
#define RTC_ADDRESS_REGISTER_B 11 // R/W
#define RTC_ADDRESS_REGISTER_C 12 // RO
#define RTC_ADDRESS_REGISTER_D 13 // RO
//
// Register A update in progress bit.
//
#define RTC_UPDATE_IN_PROGRESS 0x80U
#endif // OC_RTC_LIB_INTERNAL_H
|
1ef512417c8a2560bc79d981c1e150f7edb40c5f
|
167c6226bc77c5daaedab007dfdad4377f588ef4
|
/cpp/ql/test/library-tests/preprocessor/pragma/test.c
|
33f08b97ed2c7b3e7444b42255ba999e5c315abc
|
[
"LicenseRef-scancode-public-domain",
"MIT"
] |
permissive
|
github/codeql
|
1eebb449a34f774db9e881b52cb8f7a1b1a53612
|
d109637e2d7ab3b819812eb960c05cb31d9d2168
|
refs/heads/main
| 2023-08-20T11:32:39.162059
| 2023-08-18T14:33:32
| 2023-08-18T14:33:32
| 143,040,428
| 5,987
| 1,363
|
MIT
| 2023-09-14T19:36:50
| 2018-07-31T16:35:51
|
CodeQL
|
UTF-8
|
C
| false
| false
| 141
|
c
|
test.c
|
#pragma once
#pragma GCC warning "My warning"
#pragma My strange pragma. ("foo" : bar !!)
#pragma prefast(suppress: 26014, "qwerty uiop")
|
fab83f2068d6786f66f781e0837ad98bcb854a05
|
aa3befea459382dc5c01c925653d54f435b3fb0f
|
/arch/arm/src/s32k1xx/s32k14x/s32k14x_periphfeatures.c
|
08f6a3890a4106370fb0d6e338ff085e45dab53f
|
[
"MIT-open-group",
"BSD-3-Clause",
"HPND-sell-variant",
"BSD-4-Clause-UC",
"LicenseRef-scancode-warranty-disclaimer",
"MIT-0",
"LicenseRef-scancode-bsd-atmel",
"LicenseRef-scancode-gary-s-brown",
"LicenseRef-scancode-proprietary-license",
"SunPro",
"MIT",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-other-permissive",
"HPND",
"ISC",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"GPL-1.0-or-later",
"CC-BY-2.0",
"CC-BY-4.0"
] |
permissive
|
apache/nuttx
|
14519a7bff4a87935d94fb8fb2b19edb501c7cec
|
606b6d9310fb25c7d92c6f95bf61737e3c79fa0f
|
refs/heads/master
| 2023-08-25T06:55:45.822534
| 2023-08-23T16:03:31
| 2023-08-24T21:25:47
| 228,103,273
| 407
| 241
|
Apache-2.0
| 2023-09-14T18:26:05
| 2019-12-14T23:27:55
|
C
|
UTF-8
|
C
| false
| false
| 15,014
|
c
|
s32k14x_periphfeatures.c
|
/****************************************************************************
* arch/arm/src/s32k1xx/s32k14x/s32k14x_periphfeatures.c
*
* 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "s32k1xx_periphclocks.h"
/****************************************************************************
* Public Data
****************************************************************************/
/* Peripheral Features.
*
* Each S32K1xx architecture must provide this array. This is an array of
* bit-encoded peripheral clocking features. See the peripheral instance
* feature definitions above
*/
const uint8_t g_periph_features[] =
{
(NO_PERIPHERAL_FEATURE), /* Core clock 0 */
(NO_PERIPHERAL_FEATURE), /* Bus clock 1 */
(NO_PERIPHERAL_FEATURE), /* Slow clock 2 */
(NO_PERIPHERAL_FEATURE), /* CLKOUT clock 3 */
(NO_PERIPHERAL_FEATURE), /* SIRC clock 4 */
(NO_PERIPHERAL_FEATURE), /* FIRC clock 5 */
(NO_PERIPHERAL_FEATURE), /* SOSC clock 6 */
(NO_PERIPHERAL_FEATURE), /* SPLL clock 7 */
(NO_PERIPHERAL_FEATURE), /* RTC_CLKIN clock 8 */
(NO_PERIPHERAL_FEATURE), /* SCG CLK_OUT clock 9 */
(NO_PERIPHERAL_FEATURE), /* End of SCG clocks 10 */
(NO_PERIPHERAL_FEATURE), /* No clock entry in clock_names_t 11 */
(NO_PERIPHERAL_FEATURE), /* No clock entry in clock_names_t 12 */
(NO_PERIPHERAL_FEATURE), /* No clock entry in clock_names_t 13 */
(NO_PERIPHERAL_FEATURE), /* No clock entry in clock_names_t 14 */
(NO_PERIPHERAL_FEATURE), /* No clock entry in clock_names_t 15 */
(NO_PERIPHERAL_FEATURE), /* No clock entry in clock_names_t 16 */
(NO_PERIPHERAL_FEATURE), /* No clock entry in clock_names_t 17 */
(NO_PERIPHERAL_FEATURE), /* No clock entry in clock_names_t 18 */
(NO_PERIPHERAL_FEATURE), /* No clock entry in clock_names_t 19 */
(NO_PERIPHERAL_FEATURE), /* No clock entry in clock_names_t 20 */
(NO_PERIPHERAL_FEATURE), /* FTM0 External Clock Pin Select 21 */
(NO_PERIPHERAL_FEATURE), /* FTM1 External Clock Pin Select 22 */
(NO_PERIPHERAL_FEATURE), /* FTM2 External Clock Pin Select 23 */
(NO_PERIPHERAL_FEATURE), /* FTM3 External Clock Pin Select 24 */
(NO_PERIPHERAL_FEATURE), /* FTM4 External Clock Pin Select 25 */
(NO_PERIPHERAL_FEATURE), /* FTM5 External Clock Pin Select 26 */
(NO_PERIPHERAL_FEATURE), /* FTM6 External Clock Pin Select 27 */
(NO_PERIPHERAL_FEATURE), /* FTM7 External Clock Pin Select 28 */
(NO_PERIPHERAL_FEATURE), /* CLKOUT Select 29 */
(NO_PERIPHERAL_FEATURE), /* CLK32K clock 30 */
(NO_PERIPHERAL_FEATURE), /* LPO clock 31 */
(NO_PERIPHERAL_FEATURE), /* LPO 1KHz clock 32 */
(NO_PERIPHERAL_FEATURE), /* LPO 32KHz clock 33 */
(NO_PERIPHERAL_FEATURE), /* LPO 128KHz clock 34 */
(HAS_CLOCK_GATING_IN_SIM | HAS_INT_CLOCK_FROM_SYS_CLOCK), /* EIM clock source 35 */
(HAS_CLOCK_GATING_IN_SIM | HAS_INT_CLOCK_FROM_SYS_CLOCK), /* ERM clock source 36 */
(HAS_CLOCK_GATING_IN_SIM | HAS_INT_CLOCK_FROM_SYS_CLOCK), /* DMA clock source 37 */
(HAS_CLOCK_GATING_IN_SIM | HAS_INT_CLOCK_FROM_SYS_CLOCK), /* MPU clock source 38 */
(HAS_CLOCK_GATING_IN_SIM | HAS_INT_CLOCK_FROM_SYS_CLOCK), /* MSCM clock source 39 */
(NO_PERIPHERAL_FEATURE), /* QSPI module SFIF clock source 40 */
(NO_PERIPHERAL_FEATURE), /* QSPI module clock source 41 */
(NO_PERIPHERAL_FEATURE), /* QSPI module clock source SFIF 42 */
(NO_PERIPHERAL_FEATURE), /* QSPI module clock source 2XSFIF 43 */
(NO_PERIPHERAL_FEATURE), /* No clock entry in clock_names_t 44 */
(HAS_INT_CLOCK_FROM_BUS_CLOCK), /* CMP0 clock source 45 */
(HAS_INT_CLOCK_FROM_BUS_CLOCK), /* CRC clock source 46 */
(HAS_INT_CLOCK_FROM_BUS_CLOCK), /* DMAMUX clock source 47 */
(HAS_INT_CLOCK_FROM_BUS_CLOCK), /* EWM clock source 48 */
(HAS_INT_CLOCK_FROM_BUS_CLOCK), /* PORTA clock source 49 */
(HAS_INT_CLOCK_FROM_BUS_CLOCK), /* PORTB clock source 50 */
(HAS_INT_CLOCK_FROM_BUS_CLOCK), /* PORTC clock source 51 */
(HAS_INT_CLOCK_FROM_BUS_CLOCK), /* PORTD clock source 52 */
(HAS_INT_CLOCK_FROM_BUS_CLOCK), /* PORTE clock source 53 */
(HAS_INT_CLOCK_FROM_BUS_CLOCK), /* RTC clock source 54 */
(HAS_INT_CLOCK_FROM_BUS_CLOCK), /* SAI0 clock source 55 */
(HAS_INT_CLOCK_FROM_BUS_CLOCK), /* SAI1 clock source 56 */
(NO_PERIPHERAL_FEATURE), /* End of BUS clocks 57 */
(HAS_INT_CLOCK_FROM_SYS_CLOCK), /* FlexCAN0 clock source 58 */
(HAS_INT_CLOCK_FROM_SYS_CLOCK), /* FlexCAN1 clock source 59 */
(HAS_INT_CLOCK_FROM_SYS_CLOCK), /* FlexCAN2 clock source 60 */
(HAS_INT_CLOCK_FROM_SYS_CLOCK), /* PDB0 clock source 61 */
(HAS_INT_CLOCK_FROM_SYS_CLOCK), /* PDB1 clock source 62 */
(NO_PERIPHERAL_FEATURE), /* End of SYS clocks 63 */
(HAS_INT_CLOCK_FROM_SLOW_CLOCK), /* FTFC clock source 64 */
(NO_PERIPHERAL_FEATURE), /* End of SLOW clocks 65 */
(HAS_MULTIPLIER | HAS_DIVIDER | HAS_PROTOCOL_CLOCK_FROM_ASYNC2 | HAS_INT_CLOCK_FROM_SYS_CLOCK), /* ENET clock source 66 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC1 | HAS_INT_CLOCK_FROM_SYS_CLOCK), /* FTM0 clock source 67 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC1 | HAS_INT_CLOCK_FROM_SYS_CLOCK), /* FTM1 clock source 68 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC1 | HAS_INT_CLOCK_FROM_SYS_CLOCK), /* FTM2 clock source 69 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC1 | HAS_INT_CLOCK_FROM_SYS_CLOCK), /* FTM3 clock source 70 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC1 | HAS_INT_CLOCK_FROM_SYS_CLOCK), /* FTM4 clock source 71 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC1 | HAS_INT_CLOCK_FROM_SYS_CLOCK), /* FTM5 clock source 72 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC1 | HAS_INT_CLOCK_FROM_SYS_CLOCK), /* FTM6 clock source 73 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC1 | HAS_INT_CLOCK_FROM_SYS_CLOCK), /* FTM7 clock source 74 */
(NO_PERIPHERAL_FEATURE), /* End of ASYNCH DIV1 clocks 75 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC2 | HAS_INT_CLOCK_FROM_BUS_CLOCK), /* ADC0 clock source 76 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC2 | HAS_INT_CLOCK_FROM_BUS_CLOCK), /* ADC1 clock source 77 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC2 | HAS_INT_CLOCK_FROM_BUS_CLOCK), /* FLEXIO clock source 78 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC2 | HAS_INT_CLOCK_FROM_BUS_CLOCK), /* LPI2C0 clock source 79 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC2 | HAS_INT_CLOCK_FROM_BUS_CLOCK), /* LPI2C1 clock source 80 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC2 | HAS_INT_CLOCK_FROM_BUS_CLOCK), /* LPIT clock source 81 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC2 | HAS_INT_CLOCK_FROM_BUS_CLOCK), /* LPSPI0 clock source 82 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC2 | HAS_INT_CLOCK_FROM_BUS_CLOCK), /* LPSPI1 clock source 83 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC2 | HAS_INT_CLOCK_FROM_BUS_CLOCK), /* LPSPI2 clock source 84 */
(HAS_MULTIPLIER | HAS_DIVIDER | HAS_PROTOCOL_CLOCK_FROM_ASYNC2 | HAS_INT_CLOCK_FROM_BUS_CLOCK), /* LPTMR0 clock source 85 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC2 | HAS_INT_CLOCK_FROM_BUS_CLOCK), /* LPUART0 clock source 86 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC2 | HAS_INT_CLOCK_FROM_BUS_CLOCK), /* LPUART1 clock source 87 */
(HAS_PROTOCOL_CLOCK_FROM_ASYNC2 | HAS_INT_CLOCK_FROM_BUS_CLOCK), /* LPUART2 clock source 88 */
(HAS_INT_CLOCK_FROM_BUS_CLOCK), /* QSPI clock source 89 */
(NO_PERIPHERAL_FEATURE), /* End of ASYNCH DIV2 clocks 90 */
(NO_PERIPHERAL_FEATURE), /* End of PCC clocks 91 */
};
/****************************************************************************
* Public Functions
****************************************************************************/
|
267a924fcb2554c2d59935fa8cb5d2d06de1c1ee
|
9907672fcd81ab73ac63b2a83422a82bf31eadde
|
/tyama_icpc2016dp1B(aizu2739).c
|
77fde425a5c8362ef69bb177340f6d37de93d9c2
|
[
"0BSD"
] |
permissive
|
cielavenir/procon
|
bbe1974b9bddb51b76d58722a0686a5b477c4456
|
746e1a91f574f20647e8aaaac0d9e6173f741176
|
refs/heads/master
| 2023-06-21T23:11:24.562546
| 2023-06-11T13:15:15
| 2023-06-11T13:15:15
| 7,557,464
| 137
| 136
| null | 2020-10-20T09:35:52
| 2013-01-11T09:40:26
|
C++
|
UTF-8
|
C
| false
| false
| 114
|
c
|
tyama_icpc2016dp1B(aizu2739).c
|
m,t,r,s;main(x){for(scanf("%*d%d%d",&m,&t);~scanf("%d",&x);s=x+m)r+=s<x-m?x-m-s:0;r=!printf("%d\n",r+=s<t?t-s:0);}
|
e6d1a362352e9f41e95a6c9ef024e8769c1d6821
|
bece8b97cdb15988562c8c8dc27a5b58cd3acb90
|
/fin7/Resources/Step5/samcats-source/modules/rpc/kull_m_rpc_drsr.h
|
f5afcada16b55a6a153d19bf23f8b01520305005
|
[
"Apache-2.0",
"CC-BY-4.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
center-for-threat-informed-defense/adversary_emulation_library
|
4382e78f56faa635d5a6cc89bce5b36f3b74476c
|
4b1d1327ebfbd550ba7e5f1b5562c1f3db61311e
|
refs/heads/master
| 2023-08-12T20:08:57.078612
| 2023-07-17T16:54:16
| 2023-07-17T16:54:16
| 259,753,257
| 1,220
| 243
|
Apache-2.0
| 2023-09-06T16:23:00
| 2020-04-28T21:16:54
|
C
|
UTF-8
|
C
| false
| false
| 12,049
|
h
|
kull_m_rpc_drsr.h
|
/* Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com / http://blog.gentilkiwi.com )
Vincent LE TOUX ( vincent.letoux@gmail.com / http://www.mysmartlogon.com )
Licence : https://creativecommons.org/licenses/by/4.0/
*/
#pragma once
#include "globals.h"
#include "../kull_m_crypto_system.h"
#include "../kull_m_crypto.h"
#include "../kull_m_string.h"
#include "../kull_m_asn1.h"
#include "../kull_m_token.h"
#include "kull_m_rpc_ms-drsr.h"
typedef struct _DRS_EXTENSIONS_INT {
DWORD cb;
DWORD dwFlags;
GUID SiteObjGuid;
DWORD Pid;
DWORD dwReplEpoch;
DWORD dwFlagsExt;
GUID ConfigObjGUID;
DWORD dwExtCaps;
} DRS_EXTENSIONS_INT, *PDRS_EXTENSIONS_INT;
typedef struct _ENCRYPTED_PAYLOAD {
UCHAR Salt[16];
ULONG CheckSum;
UCHAR EncryptedData[ANYSIZE_ARRAY];
} ENCRYPTED_PAYLOAD, *PENCRYPTED_PAYLOAD;
#define DRS_EXT_BASE 0x00000001
#define DRS_EXT_ASYNCREPL 0x00000002
#define DRS_EXT_REMOVEAPI 0x00000004
#define DRS_EXT_MOVEREQ_V2 0x00000008
#define DRS_EXT_GETCHG_DEFLATE 0x00000010
#define DRS_EXT_DCINFO_V1 0x00000020
#define DRS_EXT_RESTORE_USN_OPTIMIZATION 0x00000040
#define DRS_EXT_ADDENTRY 0x00000080
#define DRS_EXT_KCC_EXECUTE 0x00000100
#define DRS_EXT_ADDENTRY_V2 0x00000200
#define DRS_EXT_LINKED_VALUE_REPLICATION 0x00000400
#define DRS_EXT_DCINFO_V2 0x00000800
#define DRS_EXT_INSTANCE_TYPE_NOT_REQ_ON_MOD 0x00001000
#define DRS_EXT_CRYPTO_BIND 0x00002000
#define DRS_EXT_GET_REPL_INFO 0x00004000
#define DRS_EXT_STRONG_ENCRYPTION 0x00008000
#define DRS_EXT_DCINFO_VFFFFFFFF 0x00010000
#define DRS_EXT_TRANSITIVE_MEMBERSHIP 0x00020000
#define DRS_EXT_ADD_SID_HISTORY 0x00040000
#define DRS_EXT_POST_BETA3 0x00080000
#define DRS_EXT_GETCHGREQ_V5 0x00100000
#define DRS_EXT_GETMEMBERSHIPS2 0x00200000
#define DRS_EXT_GETCHGREQ_V6 0x00400000
#define DRS_EXT_NONDOMAIN_NCS 0x00800000
#define DRS_EXT_GETCHGREQ_V8 0x01000000
#define DRS_EXT_GETCHGREPLY_V5 0x02000000
#define DRS_EXT_GETCHGREPLY_V6 0x04000000
#define DRS_EXT_WHISTLER_BETA3 0x08000000
#define DRS_EXT_W2K3_DEFLATE 0x10000000
#define DRS_EXT_GETCHGREQ_V10 0x20000000
#define DRS_EXT_RESERVED_FOR_WIN2K_OR_DOTNET_PART2 0x40000000
#define DRS_EXT_RESERVED_FOR_WIN2K_OR_DOTNET_PART3 0x80000000
#define DRS_EXT_ADAM 0x00000001
#define DRS_EXT_LH_BETA2 0x00000002
#define DRS_EXT_RECYCLE_BIN 0x00000004
#define DRS_EXT_GETCHGREPLY_V9 0x00000100
#define DRS_EXT_PAM 0x00000200
#define DRS_ASYNC_OP 0x00000001
#define DRS_GETCHG_CHECK 0x00000002
#define DRS_UPDATE_NOTIFICATION 0x00000002
#define DRS_ADD_REF 0x00000004
#define DRS_SYNC_ALL 0x00000008
#define DRS_DEL_REF 0x00000008
#define DRS_WRIT_REP 0x00000010
#define DRS_INIT_SYNC 0x00000020
#define DRS_PER_SYNC 0x00000040
#define DRS_MAIL_REP 0x00000080
#define DRS_ASYNC_REP 0x00000100
#define DRS_IGNORE_ERROR 0x00000100
#define DRS_TWOWAY_SYNC 0x00000200
#define DRS_CRITICAL_ONLY 0x00000400
#define DRS_GET_ANC 0x00000800
#define DRS_GET_NC_SIZE 0x00001000
#define DRS_LOCAL_ONLY 0x00001000
#define DRS_NONGC_RO_REP 0x00002000
#define DRS_SYNC_BYNAME 0x00004000
#define DRS_REF_OK 0x00004000
#define DRS_FULL_SYNC_NOW 0x00008000
#define DRS_NO_SOURCE 0x00008000
#define DRS_FULL_SYNC_IN_PROGRESS 0x00010000
#define DRS_FULL_SYNC_PACKET 0x00020000
#define DRS_SYNC_REQUEUE 0x00040000
#define DRS_SYNC_URGENT 0x00080000
#define DRS_REF_GCSPN 0x00100000
#define DRS_NO_DISCARD 0x00100000
#define DRS_NEVER_SYNCED 0x00200000
#define DRS_SPECIAL_SECRET_PROCESSING 0x00400000
#define DRS_INIT_SYNC_NOW 0x00800000
#define DRS_PREEMPTED 0x01000000
#define DRS_SYNC_FORCED 0x02000000
#define DRS_DISABLE_AUTO_SYNC 0x04000000
#define DRS_DISABLE_PERIODIC_SYNC 0x08000000
#define DRS_USE_COMPRESSION 0x10000000
#define DRS_NEVER_NOTIFY 0x20000000
#define DRS_SYNC_PAS 0x40000000
#define DRS_GET_ALL_GROUP_MEMBERSHIP 0x80000000
#define ENTINF_FROM_MASTER 0x00000001
#define ENTINF_DYNAMIC_OBJECT 0x00000002
#define ENTINF_REMOTE_MODIFY 0x00010000
typedef enum {
DS_UNKNOWN_NAME = 0,
DS_FQDN_1779_NAME = 1,
DS_NT4_ACCOUNT_NAME = 2,
DS_DISPLAY_NAME = 3,
DS_UNIQUE_ID_NAME = 6,
DS_CANONICAL_NAME = 7,
DS_USER_PRINCIPAL_NAME = 8,
DS_CANONICAL_NAME_EX = 9,
DS_SERVICE_PRINCIPAL_NAME = 10,
DS_SID_OR_SID_HISTORY_NAME = 11,
DS_DNS_DOMAIN_NAME = 12,
DS_LIST_SITES = -1,
DS_LIST_SERVERS_IN_SITE = -2,
DS_LIST_DOMAINS_IN_SITE = -3,
DS_LIST_SERVERS_FOR_DOMAIN_IN_SITE = -4,
DS_LIST_INFO_FOR_SERVER = -5,
DS_LIST_ROLES = -6,
DS_NT4_ACCOUNT_NAME_SANS_DOMAIN = -7,
DS_MAP_SCHEMA_GUID = -8,
DS_LIST_DOMAINS = -9,
DS_LIST_NCS = -10,
DS_ALT_SECURITY_IDENTITIES_NAME = -11,
DS_STRING_SID_NAME = -12,
DS_LIST_SERVERS_WITH_DCS_IN_SITE = -13,
DS_USER_PRINCIPAL_NAME_FOR_LOGON = -14,
DS_LIST_GLOBAL_CATALOG_SERVERS = -15,
DS_NT4_ACCOUNT_NAME_SANS_DOMAIN_EX = -16,
DS_USER_PRINCIPAL_NAME_AND_ALTSECID = -17,
} DS_NAME_FORMAT;
typedef enum {
DS_NAME_NO_ERROR = 0,
DS_NAME_ERROR_RESOLVING = 1,
DS_NAME_ERROR_NOT_FOUND = 2,
DS_NAME_ERROR_NOT_UNIQUE = 3,
DS_NAME_ERROR_NO_MAPPING = 4,
DS_NAME_ERROR_DOMAIN_ONLY = 5,
DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING = 6,
DS_NAME_ERROR_TRUST_REFERRAL = 7
} DS_NAME_ERROR;
typedef enum {
EXOP_FSMO_REQ_ROLE = 1,
EXOP_FSMO_REQ_RID_ALLOC = 2,
EXOP_FSMO_RID_REQ_ROLE = 3,
EXOP_FSMO_REQ_PDC = 4,
EXOP_FSMO_ABANDON_ROLE = 5,
EXOP_REPL_OBJ = 6,
EXOP_REPL_SECRETS = 7
} EXOP_REQ;
#define szOID_objectclass "2.5.4.0"
#define szOID_hasMasterNCs "1.2.840.113556.1.2.14"
#define szOID_dMDLocation "1.2.840.113556.1.2.36"
#define szOID_isDeleted "1.2.840.113556.1.2.48"
#define szOID_invocationId "1.2.840.113556.1.2.115"
#define szOID_ANSI_name "1.2.840.113556.1.4.1"
#define szOID_objectGUID "1.2.840.113556.1.4.2"
#define szOID_ANSI_sAMAccountName "1.2.840.113556.1.4.221"
#define szOID_ANSI_userPrincipalName "1.2.840.113556.1.4.656"
#define szOID_ANSI_servicePrincipalName "1.2.840.113556.1.4.771"
#define szOID_ANSI_sAMAccountType "1.2.840.113556.1.4.302"
#define szOID_ANSI_userAccountControl "1.2.840.113556.1.4.8"
#define szOID_ANSI_accountExpires "1.2.840.113556.1.4.159"
#define szOID_ANSI_pwdLastSet "1.2.840.113556.1.4.96"
#define szOID_ANSI_objectSid "1.2.840.113556.1.4.146"
#define szOID_ANSI_sIDHistory "1.2.840.113556.1.4.609"
#define szOID_ANSI_unicodePwd "1.2.840.113556.1.4.90"
#define szOID_ANSI_ntPwdHistory "1.2.840.113556.1.4.94"
#define szOID_ANSI_dBCSPwd "1.2.840.113556.1.4.55"
#define szOID_ANSI_lmPwdHistory "1.2.840.113556.1.4.160"
#define szOID_ANSI_supplementalCredentials "1.2.840.113556.1.4.125"
#define szOID_ANSI_trustPartner "1.2.840.113556.1.4.133"
#define szOID_ANSI_trustAuthIncoming "1.2.840.113556.1.4.129"
#define szOID_ANSI_trustAuthOutgoing "1.2.840.113556.1.4.135"
#define szOID_ANSI_currentValue "1.2.840.113556.1.4.27"
#define szOID_options "1.2.840.113556.1.4.307"
#define szOID_systemFlags "1.2.840.113556.1.4.375"
#define szOID_ldapServer_show_deleted "1.2.840.113556.1.4.417"
#define szOID_serverReference "1.2.840.113556.1.4.515"
#define szOID_msDS_Behavior_Version "1.2.840.113556.1.4.1459"
#define szOID_msDS_ReplicationEpoch "1.2.840.113556.1.4.1720"
#define szOID_msDS_HasDomainNCs "1.2.840.113556.1.4.1820"
#define szOID_msDS_hasMasterNCs "1.2.840.113556.1.4.1836"
#define szOID_isRecycled "1.2.840.113556.1.4.2058"
#define szOID_ANSI_nTDSDSA "1.2.840.113556.1.5.7000.47"
#define ATT_WHEN_CREATED MAKELONG( 2, 2)
#define ATT_WHEN_CHANGED MAKELONG( 3, 2)
#define ATT_RDN MAKELONG( 1, 9)
#define ATT_OBJECT_SID MAKELONG(146, 9)
#define ATT_SAM_ACCOUNT_NAME MAKELONG(221, 9)
#define ATT_USER_PRINCIPAL_NAME MAKELONG(656, 9)
#define ATT_SERVICE_PRINCIPAL_NAME MAKELONG(771, 9)
#define ATT_SID_HISTORY MAKELONG(609, 9)
#define ATT_USER_ACCOUNT_CONTROL MAKELONG( 8, 9)
#define ATT_SAM_ACCOUNT_TYPE MAKELONG(302, 9)
#define ATT_LOGON_HOURS MAKELONG( 64, 9)
#define ATT_LOGON_WORKSTATION MAKELONG( 65, 9)
#define ATT_LAST_LOGON MAKELONG( 52, 9)
#define ATT_PWD_LAST_SET MAKELONG( 96, 9)
#define ATT_ACCOUNT_EXPIRES MAKELONG(159, 9)
#define ATT_LOCKOUT_TIME MAKELONG(662, 9)
#define ATT_UNICODE_PWD MAKELONG( 90, 9)
#define ATT_NT_PWD_HISTORY MAKELONG( 94, 9)
#define ATT_DBCS_PWD MAKELONG( 55, 9)
#define ATT_LM_PWD_HISTORY MAKELONG(160, 9)
#define ATT_SUPPLEMENTAL_CREDENTIALS MAKELONG(125, 9)
#define ATT_CURRENT_VALUE MAKELONG( 27, 9)
#define ATT_TRUST_ATTRIBUTES MAKELONG(470, 9)
#define ATT_TRUST_AUTH_INCOMING MAKELONG(129, 9)
#define ATT_TRUST_AUTH_OUTGOING MAKELONG(135, 9)
#define ATT_TRUST_DIRECTION MAKELONG(132, 9)
#define ATT_TRUST_PARENT MAKELONG(471, 9)
#define ATT_TRUST_PARTNER MAKELONG(133, 9)
#define ATT_TRUST_TYPE MAKELONG(136, 9)
void RPC_ENTRY kull_m_rpc_drsr_RpcSecurityCallback(void *Context);
BOOL kull_m_rpc_drsr_getDomainAndUserInfos(RPC_BINDING_HANDLE *hBinding, LPCWSTR ServerName, LPCWSTR Domain, GUID *DomainGUID, LPCWSTR User, LPCWSTR Guid, GUID *UserGuid, DRS_EXTENSIONS_INT *pDrsExtensionsInt);
BOOL kull_m_rpc_drsr_getDCBind(RPC_BINDING_HANDLE *hBinding, GUID *NtdsDsaObjectGuid, DRS_HANDLE *hDrs, DRS_EXTENSIONS_INT *pDrsExtensionsInt);
BOOL kull_m_rpc_drsr_CrackName(DRS_HANDLE hDrs, DS_NAME_FORMAT NameFormat, LPCWSTR Name, DS_NAME_FORMAT FormatWanted, LPWSTR *CrackedName, LPWSTR *CrackedDomain);
BOOL kull_m_rpc_drsr_ProcessGetNCChangesReply(SCHEMA_PREFIX_TABLE *prefixTable, REPLENTINFLIST *objects);
BOOL kull_m_rpc_drsr_ProcessGetNCChangesReply_decrypt(ATTRVAL *val, SecPkgContext_SessionKey *SessionKey);
BOOL kull_m_rpc_drsr_CreateGetNCChangesReply_encrypt(ATTRVAL *val, SecPkgContext_SessionKey *SessionKey);
void kull_m_rpc_drsr_free_DRS_MSG_DCINFOREPLY_data(DWORD dcOutVersion, DRS_MSG_DCINFOREPLY * reply);
void kull_m_rpc_drsr_free_DRS_MSG_CRACKREPLY_data(DWORD nameCrackOutVersion, DRS_MSG_CRACKREPLY * reply);
void kull_m_rpc_drsr_free_DRS_MSG_GETCHGREPLY_data(DWORD dwOutVersion, DRS_MSG_GETCHGREPLY * reply);
void kull_m_rpc_drsr_free_SCHEMA_PREFIX_TABLE_data(SCHEMA_PREFIX_TABLE *prefixTable);
LPSTR kull_m_rpc_drsr_OidFromAttid(SCHEMA_PREFIX_TABLE *prefixTable, ATTRTYP type);
BOOL kull_m_rpc_drsr_MakeAttid(SCHEMA_PREFIX_TABLE *prefixTable, LPCSTR szOid, ATTRTYP *att, BOOL toAdd);
ATTRVALBLOCK * kull_m_rpc_drsr_findAttr(SCHEMA_PREFIX_TABLE *prefixTable, ATTRBLOCK *attributes, LPCSTR szOid);
PVOID kull_m_rpc_drsr_findMonoAttr(SCHEMA_PREFIX_TABLE *prefixTable, ATTRBLOCK *attributes, LPCSTR szOid, PVOID data, DWORD *size);
void kull_m_rpc_drsr_findPrintMonoAttr(LPCWSTR prefix, SCHEMA_PREFIX_TABLE *prefixTable, ATTRBLOCK *attributes, LPCSTR szOid, BOOL newLine);
LPWSTR kull_m_rpc_drsr_MakeSpnWithGUID(LPCGUID ServClass, LPCWSTR ServName, LPCGUID InstName);
NTSTATUS kull_m_rpc_drsr_start_server(LPCWSTR ServName, LPCGUID InstName);
NTSTATUS kull_m_rpc_drsr_stop_server();
// cf https://technet.microsoft.com/en-us/library/cc961740.aspx
#define SYNTAX_UNDEFINED 0x550500
#define SYNTAX_DN 0x550501
#define SYNTAX_OID 0x550502
#define SYNTAX_CASE_SENSITIVE_STRING 0x550503
#define SYNTAX_CASE_IGNORE_STRING 0x550504
#define SYNTAX_STRING_IA5 0x550505
#define SYNTAX_STRING_NUMERIC 0x550506
#define SYNTAX_OBJECT_DN_BINARY 0x550507
#define SYNTAX_BOOLEAN 0x550508
#define SYNTAX_INTEGER 0x550509
#define SYNTAX_OCTET_STRING 0x55050a
#define SYNTAX_GENERALIZED_TIME 0x55050b
#define SYNTAX_UNICODE_STRING 0x55050c
#define SYNTAX_OBJECT_PRESENTATION_ADDR 0x55050d
#define SYNTAX_OBJECT_DN 0x55050e
#define SYNTAX_NTSECURITYDESCRIPTOR 0x55050f
#define SYNTAX_LARGE_INTEGER 0x550510
#define SYNTAX_SID 0x550511
const SCHEMA_PREFIX_TABLE SCHEMA_DEFAULT_PREFIX_TABLE;
|
f89dd0146b5ed4f97f1dd6cdad90e87d77e64456
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/devel/libtai/files/patch-leadsecs_read.c
|
4705cda0fe542cf61b74322fd76da72f084e883b
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 353
|
c
|
patch-leadsecs_read.c
|
--- leapsecs_read.c.orig Fri Jun 16 22:44:31 2000
+++ leapsecs_read.c Fri Jun 16 22:45:17 2000
@@ -18,7 +18,7 @@
int i;
struct tai u;
- fd = open("/etc/leapsecs.dat",O_RDONLY | O_NDELAY);
+ fd = open("%%PREFIX%%/etc/leapsecs.dat",O_RDONLY | O_NDELAY);
if (fd == -1) {
if (errno != ENOENT) return -1;
if (leapsecs) free(leapsecs);
|
90b6963fba28e49de1ae61e4b35060544413abd1
|
af8dace2ab2ee908d7f418a7867b247167265de7
|
/app/src/main/cpp/grc-aesgcm/grcjni.h
|
a70f4388e9c73f1744887963d157ea33db009cc8
|
[
"MIT"
] |
permissive
|
kalaspuffar/secure-quick-reliable-login
|
d083a63916f82f4ca7607ac9173f27ee2a63377a
|
8dd26188ab35f5ed92e68a5c40765f0df9e86b9f
|
refs/heads/master
| 2022-05-12T07:33:55.705068
| 2022-03-26T12:38:50
| 2022-03-26T12:38:50
| 118,322,403
| 117
| 41
|
MIT
| 2022-03-26T12:38:51
| 2018-01-21T09:47:02
|
Java
|
UTF-8
|
C
| false
| false
| 1,371
|
h
|
grcjni.h
|
#ifndef SECURE_QUICK_RESPONSE_LOGIN_JNI_H
#define SECURE_QUICK_RESPONSE_LOGIN_JNI_H
#include <jni.h>
#include <android/log.h>
JNIEXPORT jint JNICALL
Java_org_ea_sqrl_jni_Grc_aesgcm_gcm_initialize(JNIEnv* env, jclass type);
JNIEXPORT jint JNICALL
Java_org_ea_sqrl_jni_Grc_1aesgcm_gcm_1setkey(JNIEnv *env, jclass type, jbyteArray key_, jint keysize);
JNIEXPORT jint JNICALL
Java_org_ea_sqrl_jni_Grc_1aesgcm_gcm_1auth_1decrypt(JNIEnv *env, jclass type, jbyteArray iv_,
jint iv_len, jbyteArray add_, jint add_len,
jbyteArray input_, jbyteArray output_,
jint length, jbyteArray tag_, jint tag_len);
JNIEXPORT jint JNICALL
Java_org_ea_sqrl_jni_Grc_1aesgcm_gcm_1encrypt_1and_1tag(JNIEnv *env, jclass type, jbyteArray iv_,
jint iv_len, jbyteArray add_, jint add_len,
jbyteArray input_, jbyteArray output_,
jint length, jbyteArray tag_,
jint tag_len);
JNIEXPORT void JNICALL
Java_org_ea_sqrl_jni_Grc_1aesgcm_gcm_1zero_1ctx(JNIEnv *env, jclass type);
#endif //SECURE_QUICK_RESPONSE_LOGIN_JNI_H
|
652c63b9de7da26dcfe9346adbd41172e9c844aa
|
6fc66dfe9c818e0295df74e11d132cdc400243ca
|
/lib/freertos/conf/FreeRTOSConfig.h
|
dac0af62d9095740eb11abd44d32773983bb50c7
|
[
"Apache-2.0"
] |
permissive
|
kendryte/kendryte-freertos-sdk
|
600d8acc5900f532bf44823ad758e602dbac8d38
|
b9dd7678f4c6549b0458a8ba9d80198691a2504d
|
refs/heads/develop
| 2022-07-15T22:45:47.458472
| 2021-02-01T02:23:27
| 2021-02-01T02:23:27
| 147,630,962
| 206
| 75
|
Apache-2.0
| 2020-09-26T14:44:26
| 2018-09-06T06:56:36
|
C
|
UTF-8
|
C
| false
| false
| 5,167
|
h
|
FreeRTOSConfig.h
|
/* Copyright 2018 Canaan 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.
*/
/*
* FreeRTOS Kernel V10.0.1
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* 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.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
#include <stdint.h>
/* clock */
#define configCPU_CLOCK_HZ uxPortGetCPUClock()
#define configTICK_CLOCK_HZ ( configCPU_CLOCK_HZ / 50 )
#define configTICK_RATE_HZ ( ( TickType_t ) 100 )
/* multithreading */
#define configUSE_NEWLIB_REENTRANT 1
#define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
#define configMAX_PRIORITIES ( 5 )
#define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0
#define configQUEUE_REGISTRY_SIZE 8
/* TLS */
enum
{
PTHREAD_TLS_INDEX = 0
};
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 1
/* mutex */
#define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1
/* hooks */
#define configUSE_MALLOC_FAILED_HOOK 0
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 0
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
/* memory */
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 1024 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 1024 * 1024 ) )
#define configSUPPORT_STATIC_ALLOCATION 1
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configUSE_APPLICATION_TASK_TAG 1
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_TICKLESS_IDLE 1
#define configGENERATE_RUN_TIME_STATS 0
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
#define configUSE_TIMERS 0
#define configTIMER_TASK_PRIORITY ( 0 )
#define configTIMER_QUEUE_LENGTH 2
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
/* Main task */
#define configMAIN_TASK_PRIORITY 1
#define configMAIN_TASK_STACK_SIZE (4096)
/* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_xTaskAbortDelay 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_xTimerPendFunctionCall 0
#define INCLUDE_xSemaphoreGetMutexHolder 1
/* Diagnostics */
#define configCHECK_FOR_STACK_OVERFLOW 1
/* configASSERT behaviour */
extern void vPortFatal(const char* file, int line, const char* message);
/* Normal assert() semantics without relying on the provision of an assert.h header file. */
#define configASSERT( x ) if( ( x ) == 0 ) { \
vPortFatal(__FILE__, __LINE__, #x); \
}
#endif /* FREERTOS_CONFIG_H */
|
d4aa52756d4a6d1a21a018b2fff3e2c62b9d4b38
|
6f75c727e7b359efac7b1d46d8962c405ab85b0b
|
/resources/tests/c-testsuite/00219.c
|
4804f6595d97eed724174281c138a3367e6c9d13
|
[
"MIT"
] |
permissive
|
SwadicalRag/wasm2lua
|
67e9ccac579747e39940d56d822a74913a9d956c
|
00f26cce8880ec993d591951d2e9fb06f9c52f8a
|
refs/heads/master
| 2022-01-02T02:37:47.559463
| 2021-12-14T11:41:58
| 2021-12-14T11:41:58
| 183,629,989
| 169
| 11
|
MIT
| 2021-12-14T20:25:24
| 2019-04-26T13:05:18
|
WebAssembly
|
UTF-8
|
C
| false
| false
| 1,404
|
c
|
00219.c
|
#include <stdio.h>
const int a = 0;
struct a {
int a;
};
struct b {
int a;
};
int a_f()
{
return 20;
}
int b_f()
{
return 10;
}
typedef int (*fptr)(int);
int foo(int i)
{
return i;
}
typedef int int_type1;
#define gen_sw(a) _Generic(a, const char *: 1, default: 8, int: 123);
int main()
{
int i = 0;
signed long int l = 2;
struct b titi;
const int * const ptr;
const char *ti;
int_type1 i2;
i = _Generic(a, int: a_f, const int: b_f)();
printf("%d\n", i);
i = _Generic(a, int: a_f() / 2, const int: b_f() / 2);
printf("%d\n", i);
i = _Generic(ptr, int *:1, int * const:2, default:20);
printf("%d\n", i);
i = gen_sw(a);
printf("%d\n", i);
i = _Generic(titi, struct a:1, struct b:2, default:20);
printf("%d\n", i);
i = _Generic(i2, char: 1, int : 0);
printf("%d\n", i);
i = _Generic(a, char:1, int[4]:2, default:5);
printf("%d\n", i);
i = _Generic(17, int :1, int **:2);
printf("%d\n", i);
i = _Generic(17L, int :1, long :2, long long : 3);
printf("%d\n", i);
i = _Generic("17, io", char *: 3, const char *: 1);
printf("%d\n", i);
i = _Generic(ti, const unsigned char *:1, const char *:4, char *:3,
const signed char *:2);
printf("%d\n", i);
printf("%s\n", _Generic(i + 2L, long: "long", int: "int",
long long: "long long"));
i = _Generic(l, long: 1, int: 2);
printf("%d\n", i);
i = _Generic(foo, fptr: 3, int: 4);
printf("%d\n", i);
return 0;
}
|
5fc67c77c9372f152e5233ca52f2133363ce6c65
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/at32/libraries/usbd_library/src/usbd_core.c
|
0c19b2c031eee0816665538a6a7fbe0ee3f88c81
|
[
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 17,273
|
c
|
usbd_core.c
|
/**
**************************************************************************
* @file usbd_core.c
* @brief usb driver
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
#include "usbd_core.h"
#include "usbd_sdr.h"
#include "usbd_int.h"
/** @defgroup USBD_drivers_core
* @brief usb device drivers core
* @{
*/
/** @defgroup USBD_core_private_functions
* @{
*/
#ifdef BSP_USING_USBD
/**
* @brief usb core in transfer complete handler
* @param udev: to the structure of usbd_core_type
* @param ept_addr: endpoint number
* @retval none
*/
void usbd_core_in_handler(usbd_core_type *udev, uint8_t ept_addr)
{
/* get endpoint info*/
usb_ept_info *ept_info = &udev->ept_in[ept_addr & 0x7F];
if(ept_addr == 0)
{
if(udev->ept0_sts == USB_EPT0_DATA_IN)
{
if(ept_info->rem0_len > ept_info->maxpacket)
{
ept_info->rem0_len -= ept_info->maxpacket;
usbd_ept_send(udev, 0, ept_info->trans_buf,
MIN(ept_info->rem0_len, ept_info->maxpacket));
}
/* endpoint 0 */
else if(ept_info->last_len == ept_info->maxpacket
&& ept_info->ept0_slen >= ept_info->maxpacket
&& ept_info->ept0_slen < udev->ept0_wlength)
{
ept_info->last_len = 0;
usbd_ept_send(udev, 0, 0, 0);
usbd_ept_recv(udev, ept_addr, 0, 0);
}
else
{
usbd_ctrl_recv_status(udev);
}
usbd_data_in_stage_callback(udev,0);
}
}
else if(udev->class_handler->in_handler != 0 &&
udev->conn_state == USB_CONN_STATE_CONFIGURED)
{
/* other user define endpoint */
usbd_data_in_stage_callback(udev,ept_addr);
}
}
/**
* @brief usb core out transfer complete handler
* @param udev: to the structure of usbd_core_type
* @param ept_addr: endpoint number
* @retval none
*/
void usbd_core_out_handler(usbd_core_type *udev, uint8_t ept_addr)
{
/* get endpoint info*/
usb_ept_info *ept_info = &udev->ept_out[ept_addr & 0x7F];
if(ept_addr == 0)
{
/* endpoint 0 */
if(udev->ept0_sts == USB_EPT0_DATA_OUT)
{
if(ept_info->rem0_len > ept_info->maxpacket)
{
ept_info->rem0_len -= ept_info->maxpacket;
usbd_ept_recv(udev, ept_addr, ept_info->trans_buf,
MIN(ept_info->rem0_len, ept_info->maxpacket));
}
else
{
usbd_ctrl_send_status(udev);
}
usbd_data_out_stage_callback(udev, 0);
}
}
else if(udev->class_handler->out_handler != 0 &&
udev->conn_state == USB_CONN_STATE_CONFIGURED)
{
/* other user define endpoint */
usbd_data_out_stage_callback(udev, ept_addr);
}
}
/**
* @brief usb core setup transfer complete handler
* @param udev: to the structure of usbd_core_type
* @param ept_addr: endpoint number
* @retval none
*/
void usbd_core_setup_handler(usbd_core_type *udev, uint8_t ept_num)
{
/* setup parse */
usbd_setup_request_parse(&udev->setup, udev->setup_buffer);
/* set ept0 status */
udev->ept0_sts = USB_EPT0_SETUP;
udev->ept0_wlength = udev->setup.wLength;
switch(udev->setup.bmRequestType & USB_REQ_RECIPIENT_MASK)
{
case USB_REQ_RECIPIENT_DEVICE:
/* recipient device request */
usbd_device_request(udev);
break;
case USB_REQ_RECIPIENT_INTERFACE:
/* recipient interface request */
usbd_interface_request(udev);
break;
case USB_REQ_RECIPIENT_ENDPOINT:
/* recipient endpoint request */
usbd_endpoint_request(udev);
break;
default:
break;
}
}
/**
* @brief usb control endpoint send data
* @param udev: to the structure of usbd_core_type
* @param ept_addr: endpoint number
* @param buffer: send data buffer
* @param len: send data length
* @retval none
*/
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
{
usb_ept_info *ept_info = &udev->ept_in[0];
ept_info->ept0_slen = len;
ept_info->rem0_len = len;
udev->ept0_sts = USB_EPT0_DATA_IN;
}
/**
* @brief usb control endpoint receive data
* @param udev: to the structure of usbd_core_type
* @param ept_addr: endpoint number
* @param buffer: recv data buffer
* @param len: recv data length
* @retval none
*/
void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
{
usb_ept_info *ept_info = &udev->ept_out[0];
ept_info->ept0_slen = len;
ept_info->rem0_len = len;
udev->ept0_sts = USB_EPT0_DATA_OUT;
usbd_ept_recv(udev, 0, buffer, len);
}
/**
* @brief usb control endpoint send in status
* @param udev: to the structure of usbd_core_type
* @retval none
*/
void usbd_ctrl_send_status(usbd_core_type *udev)
{
udev->ept0_sts = USB_EPT0_STATUS_IN;
usbd_ept_send(udev, 0, 0, 0);
}
/**
* @brief usb control endpoint send out status
* @param udev: usb device core handler type
* @retval none
*/
void usbd_ctrl_recv_status(usbd_core_type *udev)
{
udev->ept0_sts = USB_EPT0_STATUS_OUT;
usbd_ept_recv(udev, 0, 0, 0);
}
/**
* @brief clear endpoint stall
* @param udev: to the structure of usbd_core_type
* @param ept_addr: endpoint number
* @retval none
*/
void usbd_clear_stall(usbd_core_type *udev, uint8_t ept_addr)
{
usb_ept_info *ept_info;
if(ept_addr & 0x80)
{
/* in endpoint */
ept_info = &udev->ept_in[ept_addr & 0x7F];
USB_SET_TXSTS(ept_info->eptn, USB_TX_VALID);
}
else
{
/* out endpoint */
ept_info = &udev->ept_out[ept_addr & 0x7F];
USB_SET_RXSTS(ept_info->eptn, USB_RX_VALID);
}
ept_info->stall = 0;
}
/**
* @brief usb set endpoint to stall.
* @param udev: to the structure of usbd_core_type
* @param ept_addr: endpoint number
* @retval none
*/
void usbd_set_stall(usbd_core_type *udev, uint8_t ept_addr)
{
usb_ept_info *ept_info;
if(ept_addr & 0x80)
{
/* in endpoint */
ept_info = &udev->ept_in[ept_addr & 0x7F];
USB_SET_TXSTS(ept_info->eptn, USB_TX_STALL);
}
else
{
/* out endpoint */
ept_info = &udev->ept_out[ept_addr & 0x7F];
USB_SET_RXSTS(ept_info->eptn, USB_RX_STALL)
}
ept_info->stall = 1;
}
/**
* @brief un-support device request
* @param udev: usb device core handler type
* @retval none
*/
void usbd_ctrl_unsupport(usbd_core_type *udev)
{
/* return stall status */
usbd_set_stall(udev, 0x00);
usbd_set_stall(udev, 0x80);
}
/**
* @brief usb endpoint send data
* @param udev: to the structure of usbd_core_type
* @param ept_addr: endpoint number
* @param buffer: send data buffer
* @param len: send data length
* @retval none
*/
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_addr, uint8_t *buffer, uint16_t len)
{
/* get endpoint info struct and register */
usb_ept_info *ept_info = &udev->ept_in[ept_addr & 0x7F];
uint16_t trs_len = 0;
usbd_type *usbx = udev->usb_reg;
/* set send data buffer and length */
ept_info->trans_buf = buffer;
ept_info->total_len = len;
ept_info->trans_len = 0;
if(ept_info->total_len > ept_info->maxpacket)
{
trs_len = ept_info->maxpacket;
ept_info->total_len -= trs_len;
}
else
{
trs_len = len;
ept_info->total_len = 0;
}
ept_info->last_len = trs_len;
if(ept_info->is_double_buffer == 0)
{
/* write data to endpoint buffer */
usb_write_packet(ept_info->trans_buf, ept_info->tx_addr, trs_len);
/* set send data length */
USB_SET_TXLEN((ept_addr & 0x7F), trs_len);
}
else
{
if(usbx->ept_bit[ept_addr & 0x7F].txdts)
{
USB_SET_EPT_DOUBLE_BUF1_LEN((ept_addr & 0x7F), trs_len, DATA_TRANS_IN);
usb_write_packet(ept_info->trans_buf, ept_info->rx_addr, trs_len);
}
else
{
USB_SET_EPT_DOUBLE_BUF0_LEN((ept_addr & 0x7F), trs_len, DATA_TRANS_IN);
usb_write_packet(ept_info->trans_buf, ept_info->tx_addr, trs_len);
}
USB_FREE_DB_USER_BUFFER((ept_addr & 0x7F), DATA_TRANS_IN);
}
/* set tx status valid */
USB_SET_TXSTS((ept_addr & 0x7F), USB_TX_VALID);
}
/**
* @brief usb endpoint receive data
* @param udev: to the structure of usbd_core_type
* @param ept_addr: endpoint number
* @param buffer: receive data buffer
* @param len: receive data length
* @retval none
*/
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_addr, uint8_t *buffer, uint16_t len)
{
/* get endpoint info struct and register */
usb_ept_info *ept_info = &udev->ept_out[ept_addr & 0x7F];
uint32_t trs_len = 0;
/* set receive data buffer and length */
ept_info->trans_buf = buffer;
ept_info->total_len = len;
ept_info->trans_len = 0;
if(ept_info->total_len > ept_info->maxpacket)
{
trs_len = ept_info->maxpacket;
ept_info->total_len -= trs_len;
}
else
{
trs_len = len;
ept_info->total_len = 0;
}
/* set rx status valid */
USB_SET_RXSTS((ept_addr & 0x7F), USB_RX_VALID);
}
/**
* @brief usb endpoint get receive data length
* @param udev: to the structure of usbd_core_type
* @param ept_addr: endpoint number
* @retval none
*/
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
{
usb_ept_info *ept = &udev->ept_out[ept_addr & 0x7F];
return ept->trans_len;
}
/**
* @brief enable endpoint double buffer.
* @param udev: to the structure of usbd_core_type
* @param ept_addr: endpoint number
* @retval none
*/
void usbd_ept_dbuffer_enable(usbd_core_type *udev, uint8_t ept_addr)
{
usb_ept_info *ept_info;
if((ept_addr & 0x80) == 0)
{
/* out endpoint info */
ept_info = &udev->ept_out[ept_addr & 0x7F];
}
else
{
/* in endpoint info */
ept_info = &udev->ept_in[ept_addr & 0x7F];
}
ept_info->is_double_buffer = TRUE;
}
/**
* @brief usb auto define endpoint buffer
* @param usb_ept_info: endpoint information
* @retval none
*/
void usbd_ept_buf_auto_define(usb_ept_info *ept_info)
{
if(ept_info->is_double_buffer == 0)
{
if( ept_info->inout == DATA_TRANS_IN )
{
if(ept_info->tx_addr == 0)
ept_info->tx_addr = usb_buffer_malloc(ept_info->maxpacket);
}
else
{
if(ept_info->rx_addr == 0)
ept_info->rx_addr = usb_buffer_malloc(ept_info->maxpacket);
}
}
else
{
/* double buffer auto define */
if(ept_info->tx_addr == 0)
ept_info->tx_addr = usb_buffer_malloc(ept_info->maxpacket);
if(ept_info->rx_addr == 0)
ept_info->rx_addr = usb_buffer_malloc(ept_info->maxpacket);
}
}
/**
* @brief usb custom define endpoint buffer
* @param udev: to the structure of usbd_core_type
* @param ept_addr: endpoint number
* @param addr: usb fifo offset address
* @retval none
*/
void usbd_ept_buf_custom_define(usbd_core_type *udev, uint8_t ept_addr,
uint32_t addr)
{
usb_ept_info *ept_info;
if((ept_addr & 0x80) == 0)
{
/* out endpoint info */
ept_info = &udev->ept_out[ept_addr & 0x7F];
}
else
{
/* in endpoint info */
ept_info = &udev->ept_in[ept_addr & 0x7F];
}
if(ept_info->is_double_buffer == 0)
{
if( ept_info->inout == DATA_TRANS_IN )
{
ept_info->tx_addr = addr;
}
else
{
ept_info->rx_addr = addr;
}
}
else
{
/* double buffer malloc */
ept_info->tx_addr = addr & 0xFFFF;
ept_info->rx_addr = (addr >> 16) & 0xFFFF;
}
}
/**
* @brief usb open endpoint
* @param udev: to the structure of usbd_core_type
* @param ept_addr: endpoint number
* @param ept_type: endpoint type
* @param maxpacket: endpoint support max buffer size
* @retval none
*/
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
{
usbd_type *usbx = udev->usb_reg;
usb_ept_info *ept_info;
if((ept_addr & 0x80) == 0)
{
/* out endpoint info */
ept_info = &udev->ept_out[ept_addr & 0x7F];
ept_info->inout = DATA_TRANS_OUT;
}
else
{
/* in endpoint info */
ept_info = &udev->ept_in[ept_addr & 0x7F];
ept_info->inout = DATA_TRANS_IN;
}
/* set endpoint maxpacket and type */
ept_info->maxpacket = (maxpacket + 1) & 0xFFFE;
ept_info->trans_type = ept_type;
#ifdef USB_EPT_AUTO_MALLOC_BUFFER
usbd_ept_buf_auto_define(ept_info);
#endif
/* open endpoint */
usb_ept_open(usbx, ept_info);
}
/**
* @brief usb close endpoint
* @param udev: to the structure of usbd_core_type
* @param ept_addr: endpoint number
* @retval none
*/
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
{
usb_ept_info *ept_info;
if(ept_addr & 0x80)
{
/* in endpoint */
ept_info = &udev->ept_in[ept_addr & 0x7F];
}
else
{
/* out endpoint */
ept_info = &udev->ept_out[ept_addr & 0x7F];
}
/* close endpoint */
usb_ept_close(udev->usb_reg, ept_info);
}
/**
* @brief usb device connect to host
* @param udev: to the structure of usbd_core_type
* @retval none
*/
void usbd_connect(usbd_core_type *udev)
{
usb_connect(udev->usb_reg);
}
/**
* @brief usb device disconnect to host
* @param udev: to the structure of usbd_core_type
* @retval none
*/
void usbd_disconnect(usbd_core_type *udev)
{
usb_disconnect(udev->usb_reg);
}
/**
* @brief usb device set device address.
* @param udev: to the structure of usbd_core_type
* @param address: host assignment address
* @retval none
*/
void usbd_set_device_addr(usbd_core_type *udev, uint8_t address)
{
if(address == 0)
usb_set_address(udev->usb_reg, address);
}
/**
* @brief get usb connect state
* @param udev: to the structure of usbd_core_type
* @retval usb connect state
*/
usbd_conn_state usbd_connect_state_get(usbd_core_type *udev)
{
return udev->conn_state;
}
/**
* @brief usb device remote wakeup
* @param udev: to the structure of usbd_core_type
* @retval none
*/
void usbd_remote_wakeup(usbd_core_type *udev)
{
/* set connect state */
udev->conn_state = udev->old_conn_state;
usb_exit_suspend(udev->usb_reg);
usb_remote_wkup_set(udev->usb_reg);
rt_thread_mdelay(10);
usb_remote_wkup_clear(udev->usb_reg);
}
/**
* @brief usb device enter suspend mode
* @param udev: to the structure of usbd_core_type
* @retval none
*/
void usbd_enter_suspend(usbd_core_type *udev)
{
usb_enter_suspend(udev->usb_reg);
}
/**
* @brief usb endpoint structure initialization
* @param udev: to the structure of usbd_core_type
* @retval none
*/
void usbd_ept_defaut_init(usbd_core_type *udev)
{
uint8_t i_index = 0;
/* init in endpoint info structure */
for(i_index = 0; i_index < USB_EPT_MAX_NUM; i_index ++)
{
udev->ept_in[i_index].eptn = i_index;
udev->ept_in[i_index].ept_address = i_index;
udev->ept_in[i_index].inout = DATA_TRANS_IN;
udev->ept_in[i_index].maxpacket = 0;
udev->ept_in[i_index].trans_buf = 0;
udev->ept_in[i_index].total_len = 0;
udev->ept_in[i_index].tx_addr = 0;
udev->ept_in[i_index].rx_addr = 0;
}
/* init out endpoint info structure */
for(i_index = 0; i_index < USB_EPT_MAX_NUM; i_index ++)
{
udev->ept_out[i_index].eptn = i_index;
udev->ept_out[i_index].ept_address = i_index;
udev->ept_out[i_index].inout = DATA_TRANS_OUT;
udev->ept_out[i_index].maxpacket = 0;
udev->ept_out[i_index].trans_buf = 0;
udev->ept_out[i_index].total_len = 0;
udev->ept_out[i_index].rx_addr = 0;
udev->ept_out[i_index].tx_addr = 0;
}
return;
}
/**
* @brief initializes the usb core
* @param udev: to the structure of usbd_core_type
* @param usb_reg: usb register pointer (USB)
* @param class_handler: usb class handler
* @param desc_handler: device config handler
* @param core_id: usb core id number
* @retval none
*/
void usbd_core_init(usbd_core_type *udev,
usb_reg_type *usb_reg,
uint8_t core_id)
{
/* set usb register type */
udev->usb_reg = usb_reg;
/* set usb connect state to default */
udev->conn_state = USB_CONN_STATE_DEFAULT;
/* init in endpoint info structure */
usbd_ept_defaut_init(udev);
#ifdef USB_BUFFER_SIZE_EX
/* usb buffer size extend 768-1280 byte */
usb_usbbufs_enable(usb_reg, TRUE);
#endif
/*usb register config */
usb_dev_init(udev->usb_reg);
}
#endif
/**
* @}
*/
/**
* @}
*/
|
9272fb7761409f614ee7fc127eb6a511ad1a7eb2
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/security/otpw/files/patch-otpw.c
|
85e6e77dc40266f4460e63a34e50c7045e920c0f
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 433
|
c
|
patch-otpw.c
|
--- otpw.c.orig 2014-08-07 19:21:15 UTC
+++ otpw.c
@@ -68,7 +68,7 @@ static struct otpw_pwdbuf *otpw_malloc_p
buflen = sysconf(_SC_GETPW_R_SIZE_MAX); /* typical value: 1024 */
/* fprintf(stderr, "_SC_GETPW_R_SIZE_MAX = %ld\n", buflen); */
- if (buflen < 0) return NULL;
+ if (buflen < 0) buflen = 1024;
p = (struct otpw_pwdbuf *) malloc(sizeof(struct otpw_pwdbuf) + buflen);
if (p) p->buflen = buflen;
return p;
|
52d18beaf2a0f88b036a4cc94ceb0254abfb2685
|
e1ba6e7d2c51c2527158664ae4d8fbed2cb5572f
|
/recc-implementation/templates/generic_type_memory_pool.h
|
ad7c24f3f4cca7b8847ebd8b21c6b4c1ee815a58
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
RobertElderSoftware/recc
|
1bc30b975bb736e7733da78653aa2b0efb2d80eb
|
a3e773d35f1ceda81f1e5ed2d1dfef5b10fd3848
|
refs/heads/master
| 2023-07-30T21:35:31.956235
| 2020-01-24T20:03:46
| 2020-01-24T20:03:46
| 28,613,742
| 264
| 22
|
Apache-2.0
| 2017-12-04T01:39:56
| 2014-12-30T01:57:05
|
C
|
UTF-8
|
C
| false
| false
| 1,629
|
h
|
generic_type_memory_pool.h
|
/*
Copyright 2016 Robert Elder Software 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.
*/
#ifndef TYPES_DATA_STRUCTURES_struct_void_ptr_list_H_
#include "struct_void_ptr_list.h"
#endif
/*GETS_REPLACED_WITH_INCLUDES*/
struct T0_IDENTIFIER_memory_pool{
void ** freed_pointers; /* Pointers that we can just hand out next time we get a memory request */
struct void_ptr_list block_pointers; /* An array of pointers to blocks of object_size * 2^n */
unsigned int object_size; /* The size of the object (in bytes) for which we're providing this service. */
unsigned int objects_allocated; /* The total number of outstanding non-freed objects */
unsigned int next_preallocation; /* If we're asked to allocate more memory, and we find that objects_allocated is next_allocation, allocate another block */
unsigned int objects_to_preallocate; /* The number of objects we'll allocate next time we allocate another block */
unsigned int num_freed_pointers; /* The number of pointers in freed_pointers that we can just hand out for a malloc */
unsigned int pooling_active;
};
|
b0ad7205ea54978bed67acfb73796e3c9789b21b
|
e3e7da042dcef56cd654d6599898eee34e7f1a08
|
/include/apr_inherit.h
|
5239d7c5fec9fe8a9a1822080d6d87078b4fbbaa
|
[
"BSD-4-Clause-UC",
"LicenseRef-scancode-rsa-md4",
"Zlib",
"Beerware",
"RSA-MD",
"LicenseRef-scancode-rsa-1990",
"BSD-4-Clause",
"ISC",
"LicenseRef-scancode-other-permissive",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-generic-export-compliance"
] |
permissive
|
apache/apr
|
1c202827c91de87043d342968be4c74d7d0ccd37
|
59341af138dd2c6fe9444ee9c865b769c0053bdd
|
refs/heads/trunk
| 2023-08-16T19:06:37.213299
| 2023-06-27T14:06:09
| 2023-06-27T14:06:09
| 160,997
| 419
| 215
|
Apache-2.0
| 2023-06-27T14:06:18
| 2009-03-27T15:41:55
|
C
|
UTF-8
|
C
| false
| false
| 2,129
|
h
|
apr_inherit.h
|
/* 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.
*/
#ifndef APR_INHERIT_H
#define APR_INHERIT_H
/**
* @file apr_inherit.h
* @brief APR File Handle Inheritance Helpers
* @remark This internal header includes internal declaration helpers
* for other headers to declare apr_foo_inherit_[un]set functions.
*/
/**
* Prototype for type-specific declarations of apr_foo_inherit_set
* functions.
* @remark Doxygen unwraps this macro (via doxygen.conf) to provide
* actual help for each specific occurrence of apr_foo_inherit_set.
* @remark the linkage is specified for APR. It would be possible to expand
* the macros to support other linkages.
*/
#define APR_DECLARE_INHERIT_SET(type) \
APR_DECLARE(apr_status_t) apr_##type##_inherit_set( \
apr_##type##_t *the##type)
/**
* Prototype for type-specific declarations of apr_foo_inherit_unset
* functions.
* @remark Doxygen unwraps this macro (via doxygen.conf) to provide
* actual help for each specific occurrence of apr_foo_inherit_unset.
* @remark the linkage is specified for APR. It would be possible to expand
* the macros to support other linkages.
*/
#define APR_DECLARE_INHERIT_UNSET(type) \
APR_DECLARE(apr_status_t) apr_##type##_inherit_unset( \
apr_##type##_t *the##type)
#endif /* ! APR_INHERIT_H */
|
b17c962b0aac16606c1493d1f11607a0a73392c7
|
342d6b2af33df758608eea4291fc62898d8d124e
|
/include/lua.h
|
fa6440f7ec5a7946a58c77f3a82845cc335df331
|
[] |
no_license
|
mischief/efivim
|
88fa2c1b5a095f192eb7644629cbc80fe89b203f
|
08d28b2497fe24d986626095f0198e847ab0690a
|
refs/heads/master
| 2023-02-25T09:22:08.632583
| 2023-02-08T20:25:29
| 2023-02-08T21:32:11
| 52,757,514
| 128
| 8
| null | null | null | null |
UTF-8
|
C
| false
| false
| 22
|
h
|
lua.h
|
#include <Lua/lua.h>
|
4017b198b23cb194b3b439cb4e24d4da63af0225
|
6d54a7b26d0eb82152a549a6a9dfde656687752c
|
/src/platform/silabs/SiWx917/siwx917-chip-mbedtls-config.h
|
1fb5fde59341af4be402bda20c209ccb89fa4445
|
[
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
project-chip/connectedhomeip
|
81a123d675cf527773f70047d1ed1c43be5ffe6d
|
ea3970a7f11cd227ac55917edaa835a2a9bc4fc8
|
refs/heads/master
| 2023-09-01T11:43:37.546040
| 2023-09-01T08:01:32
| 2023-09-01T08:01:32
| 244,694,174
| 6,409
| 1,789
|
Apache-2.0
| 2023-09-14T20:56:31
| 2020-03-03T17:05:10
|
C++
|
UTF-8
|
C
| false
| false
| 5,310
|
h
|
siwx917-chip-mbedtls-config.h
|
/*
* Copyright (c) 2021, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder 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 HOLDER 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.
*/
#pragma once
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
/**
* Enable FreeRTOS threading support
*/
#define MBEDTLS_FREERTOS
/**
* Enable H Crypto and Entropy modules
*/
#define MBEDTLS_AES_C
#define MBEDTLS_ECP_C
#define MBEDTLS_ECDH_C
#define MBEDTLS_ENTROPY_C
#define MBEDTLS_SHA256_C
#define MBEDTLS_CIPHER_MODE_CTR
#define MBEDTLS_TRNG_C
#define MBEDTLS_NO_PLATFORM_ENTROPY
#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
#if defined(MBEDTLS_ECP_ALT) && !defined(MBEDTLS_ECP_RESTARTABLE)
typedef void mbedtls_ecp_restart_ctx;
#endif
#ifdef DIC_ENABLE
#define MBEDTLS_PKCS1_V15
#define MBEDTLS_RSA_NO_CRT
#define MBEDTLS_CIPHER_MODE_CBC
#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
#define MBEDTLS_RSA_C
#define MBEDTLS_SHA1_C
#define MBEDTLS_SSL_IN_CONTENT_LEN 5120
#define MBEDTLS_SSL_OUT_CONTENT_LEN 1560
#define MBEDTLS_DEBUG_C
#define MBEDTLS_CIPHER_MODE_WITH_PADDING
#endif
#define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf
#define MBEDTLS_AES_ROM_TABLES
#define MBEDTLS_ASN1_PARSE_C
#define MBEDTLS_ASN1_WRITE_C
#define MBEDTLS_BASE64_C
#define MBEDTLS_BIGNUM_C
#define MBEDTLS_CCM_C
#define MBEDTLS_CIPHER_C
#define MBEDTLS_CIPHER_MODE_CBC
#define MBEDTLS_CIPHER_MODE_CFB
#define MBEDTLS_CMAC_C
#define MBEDTLS_CTR_DRBG_C
#define MBEDTLS_ECDH_LEGACY_CONTEXT
#define MBEDTLS_ECDSA_C
#define MBEDTLS_ECDSA_DETERMINISTIC
#define MBEDTLS_ECJPAKE_C
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
#define MBEDTLS_ECP_NIST_OPTIM
#define MBEDTLS_ENTROPY_FORCE_SHA256
// TODO: 3R
// #define MBEDTLS_ENTROPY_HARDWARE_ALT
#define MBEDTLS_ERROR_STRERROR_DUMMY
#define MBEDTLS_HAVE_ASM
#define MBEDTLS_HKDF_C
#define MBEDTLS_HMAC_DRBG_C
#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
#define MBEDTLS_MD_C
#define MBEDTLS_OID_C
#define MBEDTLS_PEM_PARSE_C
#define MBEDTLS_PEM_WRITE_C
#define MBEDTLS_PK_C
#define MBEDTLS_PK_PARSE_C
#define MBEDTLS_PK_WRITE_C
#define MBEDTLS_PKCS5_C
#define MBEDTLS_PLATFORM_C
#define MBEDTLS_PLATFORM_MEMORY
#define MBEDTLS_SHA256_SMALLER
#define MBEDTLS_SHA512_C
#define MBEDTLS_SSL_CLI_C
#define MBEDTLS_SSL_COOKIE_C
#define MBEDTLS_SSL_DTLS_ANTI_REPLAY
#define MBEDTLS_SSL_DTLS_HELLO_VERIFY
#define MBEDTLS_SSL_EXPORT_KEYS
#define MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
#define MBEDTLS_SSL_PROTO_TLS1_2
#define MBEDTLS_SSL_PROTO_DTLS
#define MBEDTLS_SSL_SRV_C
#define MBEDTLS_SSL_TLS_C
#define MBEDTLS_X509_CREATE_C
#define MBEDTLS_X509_CSR_WRITE_C
#define MBEDTLS_X509_CRL_PARSE_C
#define MBEDTLS_X509_CRT_PARSE_C
#define MBEDTLS_X509_CSR_PARSE_C
#define MBEDTLS_X509_USE_C
#define MBEDTLS_MPI_WINDOW_SIZE 1 /**< Maximum windows size used. */
#ifdef DIC_ENABLE
#define MBEDTLS_MPI_MAX_SIZE 512 /**< Maximum number of bytes for usable MPIs. */
#else
#define MBEDTLS_MPI_MAX_SIZE 32 /**< Maximum number of bytes for usable MPIs. */
#endif
#define MBEDTLS_ECP_MAX_BITS 256 /**< Maximum bit size of groups */
#define MBEDTLS_ECP_WINDOW_SIZE 2 /**< Maximum window size used */
#define MBEDTLS_ECP_FIXED_POINT_OPTIM 0 /**< Enable fixed-point speed-up */
#define MBEDTLS_ENTROPY_MAX_SOURCES 2 /**< Maximum number of sources supported */
#if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE
#define MBEDTLS_SSL_MAX_CONTENT_LEN 900 /**< Maxium fragment length in bytes */
#else
#ifdef DIC_ENABLE
#define MBEDTLS_SSL_MAX_CONTENT_LEN 5120 /**< Maxium fragment length in bytes */
#else
#define MBEDTLS_SSL_MAX_CONTENT_LEN 768 /**< Maxium fragment length in bytes */
#endif // DIC
#endif
#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8
#include "mbedtls/check_config.h"
|
cf5af9ac0ec1919a33d6fcd7d752ff33e34ec919
|
eecd5e4c50d8b78a769bcc2675250576bed34066
|
/include/petscis.h
|
f8aceaca6af75bda6997e01da6b5bfdc4cda41d8
|
[
"BSD-2-Clause"
] |
permissive
|
petsc/petsc
|
3b1a04fea71858e0292f9fd4d04ea11618c50969
|
9c5460f9064ca60dd71a234a1f6faf93e7a6b0c9
|
refs/heads/main
| 2023-08-17T20:51:16.507070
| 2023-08-17T16:08:06
| 2023-08-17T16:08:06
| 8,691,401
| 341
| 169
|
NOASSERTION
| 2023-03-29T11:02:58
| 2013-03-10T20:55:21
|
C
|
UTF-8
|
C
| false
| false
| 20,052
|
h
|
petscis.h
|
/*
An index set is a generalization of a subset of integers. Index sets
are used for defining scatters and gathers.
*/
#ifndef PETSCIS_H
#define PETSCIS_H
#include <petscsys.h>
#include <petscsftypes.h>
#include <petscsectiontypes.h>
#include <petscistypes.h> /*I "petscis.h" I*/
/* SUBMANSEC = IS */
#define IS_FILE_CLASSID 1211218
PETSC_EXTERN PetscClassId IS_CLASSID;
PETSC_EXTERN PetscErrorCode ISInitializePackage(void);
PETSC_EXTERN PetscErrorCode ISFinalizePackage(void);
/*J
ISType - String with the name of a PETSc index set type
Values:
+ `ISGENERAL` - the values are stored with an array of indices and generally have no structure
. `ISSTRIDE` - the values have a simple structure of an initial offset and then a step size between values
- `ISBLOCK` - values are an array of indices, each representing a block of values
Level: beginner
.seealso: `ISSetType()`, `IS`, `ISCreateGeneral()`, `ISCreateStride()`, `ISCreateBlock()`, `ISCreate()`, `ISRegister()`,
`VecScatterCreate()`, `MatGetSubMatrices()`
J*/
typedef const char *ISType;
#define ISGENERAL "general"
#define ISSTRIDE "stride"
#define ISBLOCK "block"
/* Dynamic creation and loading functions */
PETSC_EXTERN PetscFunctionList ISList;
PETSC_EXTERN PetscErrorCode ISSetType(IS, ISType);
PETSC_EXTERN PetscErrorCode ISGetType(IS, ISType *);
PETSC_EXTERN PetscErrorCode ISRegister(const char[], PetscErrorCode (*)(IS));
PETSC_EXTERN PetscErrorCode ISRegisterAll(void);
PETSC_EXTERN PetscErrorCode ISCreate(MPI_Comm, IS *);
PETSC_EXTERN PetscErrorCode ISDestroy(IS *);
PETSC_EXTERN PetscErrorCode ISSetPermutation(IS);
PETSC_EXTERN PetscErrorCode ISPermutation(IS, PetscBool *);
PETSC_EXTERN PetscErrorCode ISSetIdentity(IS);
PETSC_EXTERN PetscErrorCode ISIdentity(IS, PetscBool *);
PETSC_EXTERN PetscErrorCode ISContiguousLocal(IS, PetscInt, PetscInt, PetscInt *, PetscBool *);
/*E
ISInfo - Info that may either be computed or set as known for an index set
Level: intermediate
Developer Notes:
Entries that are negative need not be called collectively by all processes.
Any additions/changes here MUST also be made in include/petsc/finclude/petscis.h
Any additions/changes here must also be made in src/vec/vec/interface/dlregisvec.c in ISInfos[]
.seealso: `IS`, `ISType`, `ISSetInfo()`
E*/
typedef enum {
IS_INFO_MIN = -1,
IS_SORTED = 0,
IS_UNIQUE = 1,
IS_PERMUTATION = 2,
IS_INTERVAL = 3,
IS_IDENTITY = 4,
IS_INFO_MAX = 5
} ISInfo;
typedef enum {
IS_LOCAL,
IS_GLOBAL
} ISInfoType;
PETSC_EXTERN PetscErrorCode ISSetInfo(IS, ISInfo, ISInfoType, PetscBool, PetscBool);
PETSC_EXTERN PetscErrorCode ISGetInfo(IS, ISInfo, ISInfoType, PetscBool, PetscBool *);
PETSC_EXTERN PetscErrorCode ISClearInfoCache(IS, PetscBool);
PETSC_EXTERN PetscErrorCode ISGetIndices(IS, const PetscInt *[]);
PETSC_EXTERN PetscErrorCode ISRestoreIndices(IS, const PetscInt *[]);
PETSC_EXTERN PetscErrorCode ISGetTotalIndices(IS, const PetscInt *[]);
PETSC_EXTERN PetscErrorCode ISRestoreTotalIndices(IS, const PetscInt *[]);
PETSC_EXTERN PetscErrorCode ISGetNonlocalIndices(IS, const PetscInt *[]);
PETSC_EXTERN PetscErrorCode ISRestoreNonlocalIndices(IS, const PetscInt *[]);
PETSC_EXTERN PetscErrorCode ISGetNonlocalIS(IS, IS *);
PETSC_EXTERN PetscErrorCode ISRestoreNonlocalIS(IS, IS *);
PETSC_EXTERN PetscErrorCode ISGetSize(IS, PetscInt *);
PETSC_EXTERN PetscErrorCode ISGetLocalSize(IS, PetscInt *);
PETSC_EXTERN PetscErrorCode ISInvertPermutation(IS, PetscInt, IS *);
PETSC_EXTERN PetscErrorCode ISView(IS, PetscViewer);
PETSC_EXTERN PetscErrorCode ISViewFromOptions(IS, PetscObject, const char[]);
PETSC_EXTERN PetscErrorCode ISLoad(IS, PetscViewer);
PETSC_EXTERN PetscErrorCode ISEqual(IS, IS, PetscBool *);
PETSC_EXTERN PetscErrorCode ISEqualUnsorted(IS, IS, PetscBool *);
PETSC_EXTERN PetscErrorCode ISSort(IS);
PETSC_EXTERN PetscErrorCode ISSortRemoveDups(IS);
PETSC_EXTERN PetscErrorCode ISSorted(IS, PetscBool *);
PETSC_EXTERN PetscErrorCode ISDifference(IS, IS, IS *);
PETSC_EXTERN PetscErrorCode ISSum(IS, IS, IS *);
PETSC_EXTERN PetscErrorCode ISExpand(IS, IS, IS *);
PETSC_EXTERN PetscErrorCode ISIntersect(IS, IS, IS *);
PETSC_EXTERN PetscErrorCode ISGetMinMax(IS, PetscInt *, PetscInt *);
PETSC_EXTERN PetscErrorCode ISLocate(IS, PetscInt, PetscInt *);
PETSC_EXTERN PetscErrorCode ISGetPointRange(IS, PetscInt *, PetscInt *, const PetscInt **);
PETSC_EXTERN PetscErrorCode ISRestorePointRange(IS, PetscInt *, PetscInt *, const PetscInt **);
PETSC_EXTERN PetscErrorCode ISGetPointSubrange(IS, PetscInt, PetscInt, const PetscInt *);
PETSC_EXTERN PetscErrorCode ISGetBlockSize(IS, PetscInt *);
PETSC_EXTERN PetscErrorCode ISSetBlockSize(IS, PetscInt);
PETSC_EXTERN PetscErrorCode ISToGeneral(IS);
PETSC_EXTERN PetscErrorCode ISDuplicate(IS, IS *);
PETSC_EXTERN PetscErrorCode ISCopy(IS, IS);
PETSC_EXTERN PetscErrorCode ISShift(IS, PetscInt, IS);
PETSC_EXTERN PetscErrorCode ISAllGather(IS, IS *);
PETSC_EXTERN PetscErrorCode ISComplement(IS, PetscInt, PetscInt, IS *);
PETSC_EXTERN PetscErrorCode ISConcatenate(MPI_Comm, PetscInt, const IS[], IS *);
PETSC_EXTERN PetscErrorCode ISListToPair(MPI_Comm, PetscInt, IS[], IS *, IS *);
PETSC_EXTERN PetscErrorCode ISPairToList(IS, IS, PetscInt *, IS *[]);
PETSC_EXTERN PetscErrorCode ISEmbed(IS, IS, PetscBool, IS *);
PETSC_EXTERN PetscErrorCode ISSortPermutation(IS, PetscBool, IS *);
PETSC_EXTERN PetscErrorCode ISOnComm(IS, MPI_Comm, PetscCopyMode, IS *);
PETSC_EXTERN PetscErrorCode ISRenumber(IS, IS, PetscInt *, IS *);
PETSC_EXTERN PetscErrorCode ISCreateSubIS(IS, IS, IS *);
/* ISGENERAL specific */
PETSC_EXTERN PetscErrorCode ISCreateGeneral(MPI_Comm, PetscInt, const PetscInt[], PetscCopyMode, IS *);
PETSC_EXTERN PetscErrorCode ISGeneralSetIndices(IS, PetscInt, const PetscInt[], PetscCopyMode);
PETSC_EXTERN PetscErrorCode ISGeneralSetIndicesFromMask(IS, PetscInt, PetscInt, const PetscBool[]);
PETSC_EXTERN PetscErrorCode ISGeneralFilter(IS, PetscInt, PetscInt);
/* ISBLOCK specific */
PETSC_EXTERN PetscErrorCode ISCreateBlock(MPI_Comm, PetscInt, PetscInt, const PetscInt[], PetscCopyMode, IS *);
PETSC_EXTERN PetscErrorCode ISBlockSetIndices(IS, PetscInt, PetscInt, const PetscInt[], PetscCopyMode);
PETSC_EXTERN PetscErrorCode ISBlockGetIndices(IS, const PetscInt *[]);
PETSC_EXTERN PetscErrorCode ISBlockRestoreIndices(IS, const PetscInt *[]);
PETSC_EXTERN PetscErrorCode ISBlockGetLocalSize(IS, PetscInt *);
PETSC_EXTERN PetscErrorCode ISBlockGetSize(IS, PetscInt *);
/* ISSTRIDE specific */
PETSC_EXTERN PetscErrorCode ISCreateStride(MPI_Comm, PetscInt, PetscInt, PetscInt, IS *);
PETSC_EXTERN PetscErrorCode ISStrideSetStride(IS, PetscInt, PetscInt, PetscInt);
PETSC_EXTERN PetscErrorCode ISStrideGetInfo(IS, PetscInt *, PetscInt *);
PETSC_EXTERN PetscClassId IS_LTOGM_CLASSID;
/*E
ISGlobalToLocalMappingMode - Indicates mapping behavior if global indices are missing
Values:
+ `IS_GTOLM_MASK` - missing global indices are masked by mapping them to a local index of -1
- `IS_GTOLM_DROP` - missing global indices are dropped
Level: beginner
.seealso: `ISGlobalToLocalMappingApplyBlock()`, `ISGlobalToLocalMappingApply()`
E*/
typedef enum {
IS_GTOLM_MASK,
IS_GTOLM_DROP
} ISGlobalToLocalMappingMode;
/*J
ISLocalToGlobalMappingType - String with the name of a mapping method
Values:
+ `ISLOCALTOGLOBALMAPPINGBASIC` - a non-memory scalable way of storing `ISLocalToGlobalMapping` that allows applying `ISGlobalToLocalMappingApply()` efficiently
- `ISLOCALTOGLOBALMAPPINGHASH` - a memory scalable way of storing `ISLocalToGlobalMapping` that allows applying `ISGlobalToLocalMappingApply()` reasonably efficiently
Level: beginner
.seealso: `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingSetType()`, `ISLocalToGlobalSetFromOptions()`, `ISGlobalToLocalMappingMode`
J*/
typedef const char *ISLocalToGlobalMappingType;
#define ISLOCALTOGLOBALMAPPINGBASIC "basic"
#define ISLOCALTOGLOBALMAPPINGHASH "hash"
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingSetType(ISLocalToGlobalMapping, ISLocalToGlobalMappingType);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetType(ISLocalToGlobalMapping, ISLocalToGlobalMappingType *);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingRegister(const char[], PetscErrorCode (*)(ISLocalToGlobalMapping));
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingRegisterAll(void);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingCreate(MPI_Comm, PetscInt, PetscInt, const PetscInt[], PetscCopyMode, ISLocalToGlobalMapping *);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingCreateIS(IS, ISLocalToGlobalMapping *);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingCreateSF(PetscSF, PetscInt, ISLocalToGlobalMapping *);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingSetFromOptions(ISLocalToGlobalMapping);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingSetUp(ISLocalToGlobalMapping);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingView(ISLocalToGlobalMapping, PetscViewer);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingViewFromOptions(ISLocalToGlobalMapping, PetscObject, const char[]);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingDestroy(ISLocalToGlobalMapping *);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingApply(ISLocalToGlobalMapping, PetscInt, const PetscInt[], PetscInt[]);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingApplyBlock(ISLocalToGlobalMapping, PetscInt, const PetscInt[], PetscInt[]);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingApplyIS(ISLocalToGlobalMapping, IS, IS *);
PETSC_EXTERN PetscErrorCode ISGlobalToLocalMappingApply(ISLocalToGlobalMapping, ISGlobalToLocalMappingMode, PetscInt, const PetscInt[], PetscInt *, PetscInt[]);
PETSC_EXTERN PetscErrorCode ISGlobalToLocalMappingApplyBlock(ISLocalToGlobalMapping, ISGlobalToLocalMappingMode, PetscInt, const PetscInt[], PetscInt *, PetscInt[]);
PETSC_EXTERN PetscErrorCode ISGlobalToLocalMappingApplyIS(ISLocalToGlobalMapping, ISGlobalToLocalMappingMode, IS, IS *);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetSize(ISLocalToGlobalMapping, PetscInt *);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetNodeInfo(ISLocalToGlobalMapping, PetscInt *, PetscInt *[], PetscInt **[]);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingRestoreNodeInfo(ISLocalToGlobalMapping, PetscInt *, PetscInt *[], PetscInt **[]);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetInfo(ISLocalToGlobalMapping, PetscInt *, PetscInt *[], PetscInt *[], PetscInt **[]);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingRestoreInfo(ISLocalToGlobalMapping, PetscInt *, PetscInt *[], PetscInt *[], PetscInt **[]);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetBlockInfo(ISLocalToGlobalMapping, PetscInt *, PetscInt *[], PetscInt *[], PetscInt **[]);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingRestoreBlockInfo(ISLocalToGlobalMapping, PetscInt *, PetscInt *[], PetscInt *[], PetscInt **[]);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetIndices(ISLocalToGlobalMapping, const PetscInt **);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingRestoreIndices(ISLocalToGlobalMapping, const PetscInt **);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetBlockIndices(ISLocalToGlobalMapping, const PetscInt **);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingRestoreBlockIndices(ISLocalToGlobalMapping, const PetscInt **);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingConcatenate(MPI_Comm, PetscInt, const ISLocalToGlobalMapping[], ISLocalToGlobalMapping *);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetBlockSize(ISLocalToGlobalMapping, PetscInt *);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingSetBlockSize(ISLocalToGlobalMapping, PetscInt);
PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingDuplicate(ISLocalToGlobalMapping, ISLocalToGlobalMapping *);
/*E
ISColoringType - determines if the coloring is for the entire parallel grid/graph/matrix
or for just the local ghosted portion
Values:
+ `IS_COLORING_GLOBAL` - does not include the colors for ghost points, this is used when the function
is called synchronously in parallel. This requires generating a "parallel coloring".
- `IS_COLORING_LOCAL` - includes colors for ghost points, this is used when the function can be called
separately on individual processes with the ghost points already filled in. Does not
require a "parallel coloring", rather each process colors its local + ghost part.
Using this can result in much less parallel communication. Currently only works
with `DMDA` and if you call `MatFDColoringSetFunction()` with the local function.
Level: beginner
.seealso: `ISColoring`, `ISColoringSetType()`, `ISColoringGetType()`, `DMCreateColoring()`
E*/
typedef enum {
IS_COLORING_GLOBAL,
IS_COLORING_LOCAL
} ISColoringType;
PETSC_EXTERN const char *const ISColoringTypes[];
typedef unsigned PETSC_IS_COLORING_VALUE_TYPE ISColoringValue;
#define IS_COLORING_MAX PETSC_IS_COLORING_MAX
#define MPIU_COLORING_VALUE PETSC_MPIU_IS_COLORING_VALUE_TYPE
PETSC_EXTERN PetscErrorCode ISAllGatherColors(MPI_Comm, PetscInt, ISColoringValue *, PetscInt *, ISColoringValue *[]);
PETSC_EXTERN PetscErrorCode ISColoringCreate(MPI_Comm, PetscInt, PetscInt, const ISColoringValue[], PetscCopyMode, ISColoring *);
PETSC_EXTERN PetscErrorCode ISColoringDestroy(ISColoring *);
PETSC_EXTERN PetscErrorCode ISColoringView(ISColoring, PetscViewer);
PETSC_EXTERN PetscErrorCode ISColoringViewFromOptions(ISColoring, PetscObject, const char[]);
PETSC_EXTERN PetscErrorCode ISColoringGetIS(ISColoring, PetscCopyMode, PetscInt *, IS *[]);
PETSC_EXTERN PetscErrorCode ISColoringRestoreIS(ISColoring, PetscCopyMode, IS *[]);
PETSC_EXTERN PetscErrorCode ISColoringReference(ISColoring);
PETSC_EXTERN PetscErrorCode ISColoringSetType(ISColoring, ISColoringType);
PETSC_EXTERN PetscErrorCode ISColoringGetType(ISColoring, ISColoringType *);
PETSC_EXTERN PetscErrorCode ISColoringGetColors(ISColoring, PetscInt *, PetscInt *, const ISColoringValue **);
PETSC_EXTERN PetscErrorCode ISBuildTwoSided(IS, IS, IS *);
PETSC_EXTERN PetscErrorCode ISPartitioningToNumbering(IS, IS *);
PETSC_EXTERN PetscErrorCode ISPartitioningCount(IS, PetscInt, PetscInt[]);
PETSC_EXTERN PetscErrorCode ISCompressIndicesGeneral(PetscInt, PetscInt, PetscInt, PetscInt, const IS[], IS[]);
PETSC_DEPRECATED_FUNCTION(3, 19, 0, "ISCompressIndicesGeneral()", ) static inline PetscErrorCode ISCompressIndicesSorted(PetscInt n, PetscInt bs, PetscInt imax, const IS is_in[], IS is_out[])
{
return ISCompressIndicesGeneral(n, bs, n, imax, is_in, is_out);
}
PETSC_EXTERN PetscErrorCode ISExpandIndicesGeneral(PetscInt, PetscInt, PetscInt, PetscInt, const IS[], IS[]);
struct _n_PetscLayout {
MPI_Comm comm;
PetscMPIInt size;
PetscInt n, N; /* local, global vector size */
PetscInt rstart, rend; /* local start, local end + 1 */
PetscInt *range; /* the offset of each processor */
PetscBool range_alloc; /* should range be freed in Destroy? */
PetscInt bs; /* number of elements in each block (generally for multi-component
* problems). Defaults to -1 and can be arbitrarily lazy so always use
* PetscAbs(map->bs) when accessing directly and expecting result to be
* positive. Do NOT multiply above numbers by bs */
PetscInt refcnt; /* MPI Vecs obtained with VecDuplicate() and from MatCreateVecs() reuse map of input object */
ISLocalToGlobalMapping mapping; /* mapping used in Vec/MatSetValuesLocal() */
PetscBool setupcalled; /* Forbid setup more than once */
PetscInt oldn, oldN; /* Checking if setup is allowed */
PetscInt oldbs; /* And again */
};
/*@C
PetscLayoutFindOwner - Find the owning rank for a global index
Not Collective; No Fortran Support
Input Parameters:
+ map - the layout
- idx - global index to find the owner of
Output Parameter:
. owner - the owning rank
Level: developer
.seealso: `PetscLayout`, `PetscLayoutFindOwnerIndex()`
@*/
static inline PetscErrorCode PetscLayoutFindOwner(PetscLayout map, PetscInt idx, PetscMPIInt *owner)
{
PetscMPIInt lo = 0, hi, t;
PetscFunctionBegin;
*owner = -1; /* GCC erroneously issues warning about possibly uninitialized use when error condition */
#if defined(PETSC_USE_DEBUG)
PetscCheck((map->n >= 0) && (map->N >= 0) && (map->range), PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "PetscLayoutSetUp() must be called first");
PetscCheck(idx >= 0 && idx <= map->N, PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Index %" PetscInt_FMT " is out of range", idx);
#endif
hi = map->size;
while (hi - lo > 1) {
t = lo + (hi - lo) / 2;
if (idx < map->range[t]) hi = t;
else lo = t;
}
*owner = lo;
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PetscLayoutFindOwnerIndex - Find the owning MPI rank and the local index on that rank for a global index
Not Collective; No Fortran Support
Input Parameters:
+ map - the layout
- idx - global index to find the owner of
Output Parameters:
+ owner - the owning rank
- lidx - local index used by the owner for `idx`
Level: developer
.seealso: `PetscLayout`, `PetscLayoutFindOwner()`
@*/
static inline PetscErrorCode PetscLayoutFindOwnerIndex(PetscLayout map, PetscInt idx, PetscMPIInt *owner, PetscInt *lidx)
{
PetscMPIInt lo = 0, hi, t;
PetscFunctionBegin;
#if defined(PETSC_USE_DEBUG)
PetscCheck((map->n >= 0) && (map->N >= 0) && (map->range), PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "PetscLayoutSetUp() must be called first");
PetscCheck(idx >= 0 && idx <= map->N, PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Index %" PetscInt_FMT " is out of range", idx);
#endif
hi = map->size;
while (hi - lo > 1) {
t = lo + (hi - lo) / 2;
if (idx < map->range[t]) hi = t;
else lo = t;
}
if (owner) *owner = lo;
if (lidx) *lidx = idx - map->range[lo];
PetscFunctionReturn(PETSC_SUCCESS);
}
PETSC_EXTERN PetscErrorCode PetscLayoutCreate(MPI_Comm, PetscLayout *);
PETSC_EXTERN PetscErrorCode PetscLayoutCreateFromSizes(MPI_Comm, PetscInt, PetscInt, PetscInt, PetscLayout *);
PETSC_EXTERN PetscErrorCode PetscLayoutCreateFromRanges(MPI_Comm, const PetscInt[], PetscCopyMode, PetscInt, PetscLayout *);
PETSC_EXTERN PetscErrorCode PetscLayoutSetUp(PetscLayout);
PETSC_EXTERN PetscErrorCode PetscLayoutDestroy(PetscLayout *);
PETSC_EXTERN PetscErrorCode PetscLayoutDuplicate(PetscLayout, PetscLayout *);
PETSC_EXTERN PetscErrorCode PetscLayoutReference(PetscLayout, PetscLayout *);
PETSC_EXTERN PetscErrorCode PetscLayoutSetLocalSize(PetscLayout, PetscInt);
PETSC_EXTERN PetscErrorCode PetscLayoutGetLocalSize(PetscLayout, PetscInt *);
PETSC_EXTERN PetscErrorCode PetscLayoutSetSize(PetscLayout, PetscInt);
PETSC_EXTERN PetscErrorCode PetscLayoutGetSize(PetscLayout, PetscInt *);
PETSC_EXTERN PetscErrorCode PetscLayoutSetBlockSize(PetscLayout, PetscInt);
PETSC_EXTERN PetscErrorCode PetscLayoutGetBlockSize(PetscLayout, PetscInt *);
PETSC_EXTERN PetscErrorCode PetscLayoutGetRange(PetscLayout, PetscInt *, PetscInt *);
PETSC_EXTERN PetscErrorCode PetscLayoutGetRanges(PetscLayout, const PetscInt *[]);
PETSC_EXTERN PetscErrorCode PetscLayoutCompare(PetscLayout, PetscLayout, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscLayoutSetISLocalToGlobalMapping(PetscLayout, ISLocalToGlobalMapping);
PETSC_EXTERN PetscErrorCode PetscLayoutMapLocal(PetscLayout, PetscInt, const PetscInt[], PetscInt *, PetscInt **, PetscInt **);
PETSC_EXTERN PetscErrorCode PetscParallelSortInt(PetscLayout, PetscLayout, PetscInt *, PetscInt *);
PETSC_EXTERN PetscErrorCode ISGetLayout(IS, PetscLayout *);
PETSC_EXTERN PetscErrorCode ISSetLayout(IS, PetscLayout);
#endif
|
6b497d64700a6f7552bd6ff63da3e70b65f5fd83
|
2b4867ce106d3068b67f2244019247df9cf6f341
|
/tests/runner-tests/decls/multiple_initializers.c
|
136726cf26e4286b567b26df4bff651c6d9b0c38
|
[
"BSD-3-Clause"
] |
permissive
|
jyn514/saltwater
|
d22b29ac40a4e3deb6128d904759d9183f081ab4
|
097c72d30e325de57fbed8a506431754a0560374
|
refs/heads/master
| 2023-05-09T05:44:43.147928
| 2021-06-03T02:53:32
| 2021-06-03T02:53:32
| 190,940,981
| 131
| 25
|
BSD-3-Clause
| 2021-04-07T22:58:39
| 2019-06-08T22:26:45
|
Rust
|
UTF-8
|
C
| false
| false
| 73
|
c
|
multiple_initializers.c
|
// code: 1
int main() {
int i = 1, *p = &i;
return *p;
}
|
64d08510081a49db73aa9e1cd62cfebf4e01e5f3
|
7e41167bfae6d2c38689b7e0993b308e045cbd05
|
/libarchive/libarchive/libarchive/test/test_read_disk.c
|
d52659bb73b099b10bfc9252a5871b2e9b389d16
|
[
"BSD-3-Clause",
"curl",
"GPL-1.0-or-later",
"MIT",
"Python-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-bsd-unchanged"
] |
permissive
|
holzschu/ios_system
|
7b18993dbcb33331c353e0257ca54847a5d1b1bb
|
6a83eb1c6c383a562fbe33a7e97677e88d305b51
|
refs/heads/master
| 2023-08-14T09:11:40.627903
| 2023-04-18T15:12:29
| 2023-04-18T15:12:29
| 113,187,304
| 882
| 155
|
BSD-3-Clause
| 2023-08-19T19:15:35
| 2017-12-05T13:42:50
|
C
|
UTF-8
|
C
| false
| false
| 5,812
|
c
|
test_read_disk.c
|
/*-
* Copyright (c) 2003-2009 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) 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 "test.h"
__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_disk.c 201247 2009-12-30 05:59:21Z kientzle $");
static void
gname_cleanup(void *d)
{
int *mp = d;
assertEqualInt(*mp, 0x13579);
*mp = 0x2468;
}
static const char *
gname_lookup(void *d, gid_t g)
{
int *mp = d;
assertEqualInt(*mp, 0x13579);
if (g == 1)
return ("FOOGROUP");
return ("NOTFOOGROUP");
}
static void
uname_cleanup(void *d)
{
int *mp = d;
assertEqualInt(*mp, 0x1234);
*mp = 0x2345;
}
static const char *
uname_lookup(void *d, uid_t u)
{
int *mp = d;
assertEqualInt(*mp, 0x1234);
if (u == 1)
return ("FOO");
return ("NOTFOO");
}
/* We test GID lookup by looking up the name of group number zero and
* checking it against the following list. If your system uses a
* different conventional name for group number zero, please extend
* this array and send us a patch. As always, please keep this list
* sorted alphabetically.
*/
static const char *zero_groups[] = {
"root", /* Linux */
"wheel" /* BSD */
};
DEFINE_TEST(test_read_disk)
{
struct archive *a;
int gmagic = 0x13579, umagic = 0x1234;
const char *p;
size_t i;
assert((a = archive_read_disk_new()) != NULL);
/* Default uname/gname lookups always return NULL. */
assert(archive_read_disk_gname(a, 0) == NULL);
assert(archive_read_disk_uname(a, 0) == NULL);
/* Register some weird lookup functions. */
assertEqualInt(ARCHIVE_OK, archive_read_disk_set_gname_lookup(a,
&gmagic, &gname_lookup, &gname_cleanup));
/* Verify that our new function got called. */
assertEqualString(archive_read_disk_gname(a, 0), "NOTFOOGROUP");
assertEqualString(archive_read_disk_gname(a, 1), "FOOGROUP");
/* De-register. */
assertEqualInt(ARCHIVE_OK,
archive_read_disk_set_gname_lookup(a, NULL, NULL, NULL));
/* Ensure our cleanup function got called. */
assertEqualInt(gmagic, 0x2468);
/* Same thing with uname lookup.... */
assertEqualInt(ARCHIVE_OK, archive_read_disk_set_uname_lookup(a,
&umagic, &uname_lookup, &uname_cleanup));
assertEqualString(archive_read_disk_uname(a, 0), "NOTFOO");
assertEqualString(archive_read_disk_uname(a, 1), "FOO");
assertEqualInt(ARCHIVE_OK,
archive_read_disk_set_uname_lookup(a, NULL, NULL, NULL));
assertEqualInt(umagic, 0x2345);
/* Try the standard lookup functions. */
if (archive_read_disk_set_standard_lookup(a) != ARCHIVE_OK) {
skipping("standard uname/gname lookup");
} else {
#if defined(__CYGWIN__) || defined(__HAIKU__)
/* Some platforms don't have predictable names for
* uid=0, so we skip this part of the test. */
skipping("standard uname/gname lookup");
i = 0;
p = zero_groups[0]; /* avoid unused warnings */
#else
/* XXX Someday, we may need to generalize this the
* same way we generalized the group name check below.
* That's needed only if we encounter a system where
* uid 0 is not "root". XXX */
assertEqualString(archive_read_disk_uname(a, 0), "root");
/* Get the group name for group 0 and see if it makes sense. */
p = archive_read_disk_gname(a, 0);
if (assert(p != NULL)) {
i = 0;
while (i < sizeof(zero_groups)/sizeof(zero_groups[0])) {
if (strcmp(zero_groups[i], p) == 0)
break;
++i;
}
if (i == sizeof(zero_groups)/sizeof(zero_groups[0])) {
/* If you get a failure here, either
* archive_read_disk_gname() isn't working or
* your system uses a different name for group
* number zero. If the latter, please add a
* new entry to the zero_groups[] array above.
*/
failure("group 0 didn't have any of the expected names");
assertEqualString(p, zero_groups[0]);
}
}
#endif
}
/* Deregister again and verify the default lookups again. */
assertEqualInt(ARCHIVE_OK,
archive_read_disk_set_gname_lookup(a, NULL, NULL, NULL));
assertEqualInt(ARCHIVE_OK,
archive_read_disk_set_uname_lookup(a, NULL, NULL, NULL));
assert(archive_read_disk_gname(a, 0) == NULL);
assert(archive_read_disk_uname(a, 0) == NULL);
/* Re-register our custom handlers. */
gmagic = 0x13579;
umagic = 0x1234;
assertEqualInt(ARCHIVE_OK, archive_read_disk_set_gname_lookup(a,
&gmagic, &gname_lookup, &gname_cleanup));
assertEqualInt(ARCHIVE_OK, archive_read_disk_set_uname_lookup(a,
&umagic, &uname_lookup, &uname_cleanup));
/* Destroy the archive. */
assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
/* Verify our cleanup functions got called. */
assertEqualInt(gmagic, 0x2468);
assertEqualInt(umagic, 0x2345);
}
|
ed9e63844425de5f66c89c1a13189cf9f2089461
|
6601ed1b6c24e8b7e78312aeaadf816262c4bee3
|
/c/libcorethread/corethread.h
|
b7f2894fe6a125a84e30af672fb5afe383666044
|
[
"BSD-2-Clause"
] |
permissive
|
t-crest/patmos
|
bb9764c5897ee8bbac2a336cb09d7bb77d54916a
|
c63dadffa3db2ad241c31ae6e952d6fe2298986a
|
refs/heads/master
| 2023-04-11T12:18:37.795018
| 2023-03-25T17:57:33
| 2023-03-25T17:57:33
| 1,500,522
| 108
| 90
|
BSD-2-Clause
| 2023-03-25T17:57:35
| 2011-03-19T17:01:39
|
VHDL
|
UTF-8
|
C
| false
| false
| 5,269
|
h
|
corethread.h
|
/*
Copyright 2014 Technical University of Denmark, DTU Compute.
All rights reserved.
This file is part of the time-predictable VLIW processor Patmos.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``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 HOLDER 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.
The views and conclusions contained in the software and documentation are
those of the authors and should not be interpreted as representing official
policies, either expressed or implied, of the copyright holder.
*/
/** \addtogroup libcorethread
* @{
*/
/**
* \file corethread.h Definitions for libcorethread.
*
* \author Rasmus Bo Soerensen <rasmus@rbscloud.dk>
*
* \brief Corethread library for the T-CREST platform
*/
#ifndef _CORETHREAD_H_
#define _CORETHREAD_H_
#include <machine/patmos.h>
#include <machine/spm.h>
#include <stdlib.h>
#include <machine/rtc.h>
#include <machine/boot.h>
/// \brief Resource unavailable.
#define EAGAIN 1
/// \brief Invalid argument.
#define EINVAL 2
/// \brief Operation not permitted.
#define EPERM 3
/// \brief No such resource.
#define ESRCH 4
/// \brief Resource deadlock avoided.
#define EDEADLK 5
/// \brief Resource is already in use.
#define EBUSY 6
/// \brief The master core, which governs booting and startup synchronization.
extern const int NOC_MASTER;
////////////////////////////////////////////////////////////////////////////
// Data structures for storing state information
// of the corethreads
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Functions for initializing the corethreads
////////////////////////////////////////////////////////////////////////////
/// \cond PRIVATE
/// \brief A contructor that makes the slave cores wait for a corethread to
/// be created on that core and the master core continue to execute #main().
//void corethread_worker(void) __attribute__ ((constructor(110),used));
//#ifdef CORETHREAD_INIT
// Pull in initializer, even if nothing else from the library is used
//static const void * volatile __corethread_include __attribute__((used)) = &corethread_worker;
//#endif
/// \endcond
////////////////////////////////////////////////////////////////////////////
// Functions for creating and destroying corethreads
////////////////////////////////////////////////////////////////////////////
/// \brief Creates a corethread on the core with the COREID equal to the
/// id specified by thread
///
/// \param thread A pointer to the corethread_t specifying the thread to
/// start
/// \param start_routine A function pointer to the function that the created
/// thread should start executing
/// \param arg A pointer to the argument to pass to the start_routine
/// function
///
/// \retval 0 The thread was created
/// \retval EAGAIN The corethread is already allocated
/// \retval EINVAL The attribute value is invalid
/// \retval EPERM The caller does not have appropriate permissions the set
/// the required scheduling parameters or scheduling policy
int corethread_create(int core_id, void (*start_routine)(void*), void *arg);
/// \brief The last function to be called by a terminating thread
///
/// The running corethread terminates with the given returnvalue
/// \param retval A pointer to the return value that the calling
/// thread shall return.
void corethread_exit(void *retval);
/// \brief The caller waits for the corethread, specified by thread, to
/// write a return value and terminate exection.
/// \param thread The thread struct belonging to the terminating corethread.
/// \param retval A pointer to the pointer that is to point to the return
/// value of the terminating thread.
///
/// \retval 0 The specified thread was joined.
/// \retval EINVAL The given corethread can not be joined.
/// \retval ESRCH No corethread exist with the specified corethread ID.
/// \retval EDEADLK A deadlock was detected or the specified corethread is
/// the calling thread
int corethread_join(int core_id, void **retval);
#endif /* _CORETHREAD_H_ */
/** @}*/
|
eda2f9255cac0cdb3de43d5de8f81ef1fe8a8672
|
64d56bac24e169958ae028d2c3dad038634f7cf6
|
/include/rizz/imgui-extra.h
|
d7ec56a403c7dbe932a9a15b894dd5c4b72e8cdd
|
[
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] |
permissive
|
septag/rizz
|
485b5a70dbbcaf429efb300c19b24b021d9c19e4
|
b52a7f8e1ccc4371a641ab67d5ca69df9d18fce7
|
refs/heads/master
| 2023-08-23T20:23:02.473579
| 2022-10-24T11:04:04
| 2022-10-24T11:04:04
| 178,582,437
| 820
| 45
|
BSD-2-Clause
| 2022-10-20T15:53:44
| 2019-03-30T16:19:41
|
C
|
UTF-8
|
C
| false
| false
| 3,339
|
h
|
imgui-extra.h
|
#pragma once
#include "sx/math-types.h"
#include "imgui.h"
typedef struct rizz_mem_info rizz_mem_info;
typedef struct rizz_gfx_trace_info rizz_gfx_trace_info;
typedef struct ImDrawList ImDrawList;
typedef enum { GIZMO_MODE_LOCAL, GIZMO_MODE_WORLD } imgui_gizmo_mode;
// Gizmo
typedef struct rizz_api_imguizmo {
bool (*hover)(void);
bool (*is_using)(void);
void (*set_current_window)(void);
void (*set_rect)(const sx_rect rc);
void (*set_ortho)(bool ortho);
void (*enable)(bool enable);
void (*decompose_mat4)(const sx_mat4* mat, sx_vec3* translation, sx_vec3* rotation, sx_vec3* scale);
void (*compose_mat4)(sx_mat4* mat, sx_vec3 translation, sx_vec3 rotation, sx_vec3 scale);
void (*translate)(sx_mat4* mat, const sx_mat4* view, const sx_mat4* proj, imgui_gizmo_mode mode,
sx_mat4* delta_mat, sx_vec3* snap);
void (*rotation)(sx_mat4* mat, const sx_mat4* view, const sx_mat4* proj, imgui_gizmo_mode mode,
sx_mat4* delta_mat, float* snap);
void (*scale)(sx_mat4* mat, const sx_mat4* view, const sx_mat4* proj, imgui_gizmo_mode mode,
sx_mat4* delta_mat, float* snap);
} rizz_api_imguizmo;
typedef struct rizz_api_imgui_extra {
rizz_api_imguizmo gizmo;
// these ebuggers are used to monitor inner workings of the engine
// recommended usage is to use `the_core` API equivalants instead
void (*graphics_debugger)(const rizz_gfx_trace_info* info, bool* p_open);
void (*show_log)(bool* p_open);
void (*dual_progress_bar)(float fraction1, float fraction2, const sx_vec2 ctrl_size,
const char* overlay1, const char* overlay2);
// Full screen 2D drawing
// You can begin by calling `begin_fullscreen_draw`, fetch and keep the ImDrawList
// then you can issue ImDrawList_ calls to draw primitives
ImDrawList* (*begin_fullscreen_draw)(const char* id);
void (*draw_cursor)(ImDrawList* drawlist, ImGuiMouseCursor cursor, sx_vec2 pos, float scale);
// use `project_to_screen` and provide mvp matrix to it for to convert from world coords to
// screen.
// `viewport` param is optional, if you want to provide a custom vp instead of fullscreen
sx_vec2 (*project_to_screen)(const sx_vec3 pt, const sx_mat4* mvp, const sx_rect* viewport);
bool (*is_capturing_mouse)(void);
bool (*is_capturing_keyboard)(void);
// returns dock space id (or zero if docking is disabled),
// which can be used inside the program to get different docking views
// particularly useful for drawing inside viewports
// example:
// ImGuiDockNode* cnode = the_imgui->DockBuilderGetCentralNode(the_imguix->dock_space_id());
// SetRenderViewport(cnode->Pos.x, cnode->Pos.y, cnode->Size.x, cnode->Size.y);
ImGuiID (*dock_space_id)(void);
void (*label)(const char* name, const char* fmt, ...);
void (*label_colored)(const ImVec4* name_color, const ImVec4* text_color, const char* name, const char* fmt, ...);
void (*label_spacing)(float offset, float spacing, const char* name, const char* fmt, ...);
void (*label_colored_spacing)(const ImVec4* name_color, const ImVec4* text_color, float offset, float spacing,
const char* name, const char* fmt, ...);
} rizz_api_imgui_extra;
|
585f2de426a0fb006eca29ab4b6a569db1088040
|
30c2631ed046d7662476b94fb7f5286c47377f60
|
/test/addons/src/Snapshot.c
|
05a720a7ee39e213b941a3343bae3adfd0532d74
|
[
"MIT"
] |
permissive
|
SanderMertens/flecs
|
a840093340f0d1eb2bd30ec1585296f81f2aab39
|
41fb856c4e1162f44b59d7881ef508d64d56bf10
|
refs/heads/master
| 2023-08-24T16:21:41.790084
| 2023-08-24T08:38:57
| 2023-08-24T08:49:52
| 146,155,284
| 4,731
| 456
|
MIT
| 2023-09-05T16:01:58
| 2018-08-26T05:53:05
|
C
|
UTF-8
|
C
| false
| false
| 21,451
|
c
|
Snapshot.c
|
#include <addons.h>
void Snapshot_simple_snapshot(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ecs_entity_t e = ecs_set(world, 0, Position, {10, 20});
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ecs_snapshot_t *s = ecs_snapshot_take(world);
Position *p = ecs_get_mut(world, e, Position);
test_int(p->x, 10);
test_int(p->y, 20);
p->x ++;
p->y ++;
ecs_snapshot_restore(world, s);
test_assert(ecs_has(world, e, Position));
p = ecs_get_mut(world, e, Position);
test_int(p->x, 10);
test_int(p->y, 20);
ecs_fini(world);
}
void Snapshot_snapshot_after_new(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ecs_entity_t e = ecs_new(world, Position);
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ecs_snapshot_t *s = ecs_snapshot_take(world);
ecs_entity_t e2 = ecs_new(world, Position);
test_assert(e2 != 0);
test_assert(ecs_has(world, e2, Position));
ecs_snapshot_restore(world, s);
test_assert(ecs_is_alive(world, e));
test_assert(!ecs_is_alive(world, e2));
test_assert(ecs_has(world, e, Position));
test_assert(ecs_new(world, 0) == e2);
ecs_fini(world);
}
void Snapshot_snapshot_after_delete(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ecs_entity_t e = ecs_set(world, 0, Position, {10, 20});
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ecs_snapshot_t *s = ecs_snapshot_take(world);
ecs_delete(world, e);
test_assert(!ecs_is_alive(world, e));
ecs_snapshot_restore(world, s);
test_assert(ecs_is_alive(world, e));
test_assert(ecs_has(world, e, Position));
const Position *p = ecs_get(world, e, Position);
test_int(p->x, 10);
test_int(p->y, 20);
ecs_fini(world);
}
void Snapshot_snapshot_after_new_type(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ecs_entity_t e = ecs_set(world, 0, Position, {10, 20});
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ecs_snapshot_t *s = ecs_snapshot_take(world);
ecs_entity_t e2 = ecs_new(world, Position);
ecs_add(world, e2, Velocity);
ecs_snapshot_restore(world, s);
test_assert(ecs_is_alive(world, e));
test_assert(!ecs_is_alive(world, e2));
test_assert(ecs_has(world, e, Position));
ecs_fini(world);
}
void Snapshot_snapshot_after_add(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ecs_entity_t e = ecs_set(world, 0, Position, {10, 20});
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ecs_snapshot_t *s = ecs_snapshot_take(world);
ecs_add(world, e, Velocity);
test_assert(ecs_has(world, e, Velocity));
ecs_snapshot_restore(world, s);
test_assert(ecs_has(world, e, Position));
test_assert(!ecs_has(world, e, Velocity));
ecs_fini(world);
}
void Snapshot_snapshot_after_remove(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ecs_entity_t e = ecs_new(world, Position);
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ecs_add(world, e, Velocity);
test_assert(ecs_has(world, e, Velocity));
ecs_snapshot_t *s = ecs_snapshot_take(world);
ecs_remove(world, e, Velocity);
test_assert(!ecs_has(world, e, Velocity));
ecs_snapshot_restore(world, s);
test_assert(ecs_has(world, e, Position));
ecs_fini(world);
}
void Snapshot_snapshot_w_include_filter(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ecs_entity_t e1 = ecs_set(world, 0, Position, {10, 20});
test_assert(e1 != 0);
test_assert(ecs_has(world, e1, Position));
ecs_entity_t e2 = ecs_set(world, 0, Position, {15, 25});
test_assert(e2 != 0);
ecs_add(world, e2, Velocity);
test_assert(ecs_has(world, e2, Position));
test_assert(ecs_has(world, e2, Velocity));
ecs_entity_t e3 = ecs_set(world, 0, Velocity, {25, 35});
test_assert(e3 != 0);
test_assert(ecs_has(world, e3, Velocity));
ecs_filter_t f = ECS_FILTER_INIT;
ecs_filter_init(world, &(ecs_filter_desc_t){
.storage = &f,
.terms = {{ ecs_id(Position) }}
});
ecs_iter_t it = ecs_filter_iter(world, &f);
ecs_snapshot_t *s = ecs_snapshot_take_w_iter(&it);
Position *p = ecs_get_mut(world, e1, Position);
test_assert(p != NULL);
test_int(p->x, 10);
test_int(p->y, 20);
p->x ++;
p->y ++;
p = ecs_get_mut(world, e2, Position);
test_assert(p != NULL);
test_int(p->x, 15);
test_int(p->y, 25);
p->x ++;
p->y ++;
Velocity *v = ecs_get_mut(world, e3, Velocity);
test_assert(v != NULL);
test_int(v->x, 25);
test_int(v->y, 35);
v->x ++;
v->y ++;
ecs_snapshot_restore(world, s);
/* Restored */
p = ecs_get_mut(world, e1, Position);
test_assert(p != NULL);
test_int(p->x, 10);
test_int(p->y, 20);
/* Restored */
p = ecs_get_mut(world, e2, Position);
test_assert(p != NULL);
test_int(p->x, 15);
test_int(p->y, 25);
/* Not restored */
v = ecs_get_mut(world, e3, Velocity);
test_assert(v != NULL);
test_int(v->x, 26);
test_int(v->y, 36);
test_assert(ecs_new(world, 0) > e3);
ecs_filter_fini(&f);
ecs_fini(world);
}
void Snapshot_snapshot_w_exclude_filter(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ecs_entity_t e1 = ecs_set(world, 0, Position, {10, 20});
test_assert(e1 != 0);
test_assert(ecs_has(world, e1, Position));
ecs_entity_t e2 = ecs_set(world, 0, Position, {15, 25});
test_assert(e2 != 0);
ecs_add(world, e2, Velocity);
test_assert(ecs_has(world, e2, Position));
test_assert(ecs_has(world, e2, Velocity));
ecs_entity_t e3 = ecs_set(world, 0, Velocity, {25, 35});
test_assert(e3 != 0);
test_assert(ecs_has(world, e3, Velocity));
ecs_filter_t f = ECS_FILTER_INIT;
ecs_filter_init(world, &(ecs_filter_desc_t){
.storage = &f,
.terms = {{ ecs_id(Position), .oper = EcsNot }}
});
ecs_iter_t it = ecs_filter_iter(world, &f);
ecs_snapshot_t *s = ecs_snapshot_take_w_iter(&it);
Position *p = ecs_get_mut(world, e1, Position);
test_assert(p != NULL);
test_int(p->x, 10);
test_int(p->y, 20);
p->x ++;
p->y ++;
p = ecs_get_mut(world, e2, Position);
test_assert(p != NULL);
test_int(p->x, 15);
test_int(p->y, 25);
p->x ++;
p->y ++;
Velocity *v = ecs_get_mut(world, e3, Velocity);
test_assert(v != NULL);
test_int(v->x, 25);
test_int(v->y, 35);
v->x ++;
v->y ++;
ecs_snapshot_restore(world, s);
/* Not restored */
p = ecs_get_mut(world, e1, Position);
test_assert(p != NULL);
test_int(p->x, 11);
test_int(p->y, 21);
/* Not restored */
p = ecs_get_mut(world, e2, Position);
test_assert(p != NULL);
test_int(p->x, 16);
test_int(p->y, 26);
/* Restored */
v = ecs_get_mut(world, e3, Velocity);
test_assert(v != NULL);
test_int(v->x, 25);
test_int(v->y, 35);
test_assert(ecs_new(world, 0) > e3);
ecs_filter_fini(&f);
ecs_fini(world);
}
void Snapshot_snapshot_w_filter_after_new(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ecs_entity_t e1 = ecs_set(world, 0, Position, {1, 2});
test_assert(e1 != 0);
test_assert(ecs_has(world, e1, Position));
ecs_entity_t e2 = ecs_set(world, 0, Velocity, {3, 4});
test_assert(e2 != 0);
test_assert(ecs_has(world, e2, Velocity));
ecs_filter_t f = ECS_FILTER_INIT;
ecs_filter_init(world, &(ecs_filter_desc_t){
.storage = &f,
.terms = {{ ecs_id(Position) }}
});
ecs_iter_t it = ecs_filter_iter(world, &f);
ecs_snapshot_t *s = ecs_snapshot_take_w_iter(&it);
ecs_set(world, e1, Position, {5, 6});
ecs_set(world, e2, Velocity, {7, 8});
ecs_entity_t e3 = ecs_set(world, 0, Position, {33, 44});
test_assert(e3 != 0);
test_assert(ecs_has(world, e3, Position));
ecs_entity_t e4 = ecs_set(world, 0, Velocity, {34, 45});
test_assert(e4 != 0);
test_assert(ecs_has(world, e4, Velocity));
ecs_snapshot_restore(world, s);
test_assert(ecs_has(world, e1, Position));
const Position *p = ecs_get(world, e1, Position);
test_assert(p != NULL);
test_int(p->x, 1);
test_int(p->y, 2);
test_assert(ecs_has(world, e2, Velocity));
const Velocity *v = ecs_get(world, e2, Velocity);
test_assert(v != NULL);
test_int(v->x, 7);
test_int(v->y, 8);
test_assert(ecs_has(world, e3, Position));
p = ecs_get(world, e3, Position);
test_assert(p != NULL);
test_int(p->x, 33);
test_int(p->y, 44);
test_assert(ecs_has(world, e4, Velocity));
v = ecs_get(world, e4, Velocity);
test_assert(p != NULL);
test_int(v->x, 34);
test_int(v->y, 45);
ecs_filter_fini(&f);
ecs_fini(world);
}
void Snapshot_snapshot_w_filter_after_delete(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ecs_entity_t e1 = ecs_set(world, 0, Position, {1, 2});
test_assert(e1 != 0);
test_assert(ecs_has(world, e1, Position));
ecs_entity_t e2 = ecs_set(world, 0, Velocity, {3, 4});
test_assert(e2 != 0);
test_assert(ecs_has(world, e2, Velocity));
ecs_entity_t e3 = ecs_set(world, 0, Position, {1, 2});
test_assert(e3 != 0);
test_assert(ecs_has(world, e3, Position));
ecs_entity_t e4 = ecs_set(world, 0, Velocity, {3, 4});
test_assert(e4 != 0);
test_assert(ecs_has(world, e4, Velocity));
ecs_filter_t f = ECS_FILTER_INIT;
ecs_filter_init(world, &(ecs_filter_desc_t){
.storage = &f,
.terms = {{ ecs_id(Position) }}
});
ecs_iter_t it = ecs_filter_iter(world, &f);
ecs_snapshot_t *s = ecs_snapshot_take_w_iter(&it);
ecs_delete(world, e3);
ecs_delete(world, e4);
test_assert(!ecs_is_alive(world, e3));
test_assert(!ecs_is_alive(world, e4));
ecs_snapshot_restore(world, s);
test_assert(ecs_is_alive(world, e1));
test_assert(ecs_is_alive(world, e2));
test_assert(ecs_is_alive(world, e3));
test_assert(!ecs_is_alive(world, e4));
test_assert(ecs_has(world, e1, Position));
test_assert(ecs_has(world, e2, Velocity));
test_assert(ecs_has(world, e3, Position));
ecs_filter_fini(&f);
ecs_fini(world);
}
void Snapshot_snapshot_free_empty(void) {
ecs_world_t *world = ecs_init();
ecs_snapshot_t *s = ecs_snapshot_take(world);
test_assert(s != NULL);
ecs_snapshot_free(s);
ecs_fini(world);
}
void Snapshot_snapshot_free(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
test_assert( ecs_new(world, Position) != 0);
test_assert( ecs_new(world, Velocity) != 0);
ecs_snapshot_t *s = ecs_snapshot_take(world);
test_assert(s != NULL);
ecs_snapshot_free(s);
ecs_fini(world);
}
void Snapshot_snapshot_free_filtered(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
test_assert( ecs_new(world, Position) != 0);
test_assert( ecs_new(world, Velocity) != 0);
ecs_filter_t f = ECS_FILTER_INIT;
ecs_filter_init(world, &(ecs_filter_desc_t){
.storage = &f,
.terms = {{ ecs_id(Position) }}
});
ecs_iter_t it = ecs_filter_iter(world, &f);
ecs_snapshot_t *s = ecs_snapshot_take_w_iter(&it);
test_assert(s != NULL);
ecs_snapshot_free(s);
ecs_filter_fini(&f);
ecs_fini(world);
}
void Snapshot_snapshot_free_filtered_w_dtor(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ECS_COMPONENT(world, Mass);
ecs_entity_t e1 = ecs_entity_init(world, &(ecs_entity_desc_t){
.name = "e1"
});
ecs_entity_t e2 = ecs_entity_init(world, &(ecs_entity_desc_t){
.name = "e2"
});
ecs_entity_t e3 = ecs_entity_init(world, &(ecs_entity_desc_t){
.name = "e3"
});
ecs_add(world, e1, Position);
ecs_add(world, e2, Position);
ecs_add(world, e3, Position);
ecs_add(world, e1, Velocity);
ecs_add(world, e2, Velocity);
ecs_add(world, e3, Velocity);
ecs_add(world, e3, Mass);
ecs_filter_t f = ECS_FILTER_INIT;
ecs_filter_init(world, &(ecs_filter_desc_t){
.storage = &f,
.terms = {{ ecs_id(Position) }, { ecs_id(Velocity) }}
});
ecs_iter_t it = ecs_filter_iter(world, &f);
ecs_snapshot_t *s = ecs_snapshot_take_w_iter(&it);
test_assert(s != NULL);
ecs_snapshot_free(s);
ecs_filter_fini(&f);
ecs_fini(world);
}
static bool invoked = false;
static
void Dummy(ecs_iter_t *it) {
invoked = true;
}
void Snapshot_snapshot_activate_table_w_filter(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_SYSTEM(world, Dummy, EcsOnUpdate, Position);
ecs_entity_t e = ecs_set(world, 0, Position, {0, 0});
test_assert(e != 0);
ecs_filter_t f = ECS_FILTER_INIT;
ecs_filter_init(world, &(ecs_filter_desc_t){
.storage = &f,
.terms = {{ ecs_id(Position) }}
});
ecs_iter_t it = ecs_filter_iter(world, &f);
ecs_snapshot_t *s = ecs_snapshot_take_w_iter(&it);
ecs_snapshot_restore(world, s);
test_assert(ecs_has(world, e, Position));
ecs_progress(world, 0);
test_bool(invoked, true);
ecs_filter_fini(&f);
ecs_fini(world);
}
void Snapshot_snapshot_copy(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ecs_entity_t e = ecs_set(world, 0, Position, {10, 20});
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ecs_snapshot_t *s = ecs_snapshot_take(world);
ecs_iter_t it = ecs_snapshot_iter(s);
ecs_snapshot_t *s_copy = ecs_snapshot_take_w_iter(&it);
ecs_snapshot_free(s);
Position *p = ecs_get_mut(world, e, Position);
test_int(p->x, 10);
test_int(p->y, 20);
p->x ++;
p->y ++;
ecs_snapshot_restore(world, s_copy);
test_assert(ecs_has(world, e, Position));
p = ecs_get_mut(world, e, Position);
test_int(p->x, 10);
test_int(p->y, 20);
ecs_fini(world);
}
void Snapshot_snapshot_get_ref_after_restore(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ecs_entity_t e = ecs_set(world, 0, Position, {10, 20});
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ecs_ref_t ref = ecs_ref_init(world, e, Position);
const Position *p = ecs_ref_get(world, &ref, Position);
test_assert(p != NULL);
test_int(p->x, 10);
test_int(p->y, 20);
ecs_snapshot_t *s = ecs_snapshot_take(world);
Position *p_mut = ecs_get_mut(world, e, Position);
test_int(p_mut->x, 10);
test_int(p_mut->y, 20);
p_mut->x ++;
p_mut->y ++;
ecs_snapshot_restore(world, s);
test_assert(ecs_has(world, e, Position));
p = ecs_ref_get(world, &ref, Position);
test_assert(p != NULL);
test_int(p->x, 10);
test_int(p->y, 20);
ecs_fini(world);
}
void Snapshot_new_after_snapshot(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ecs_entity_t e = ecs_set(world, 0, Position, {10, 20});
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ecs_snapshot_t *s = ecs_snapshot_take(world);
ecs_snapshot_restore(world, s);
ecs_entity_t e2 = ecs_new(world, Position);
test_assert(e2 != 0);
test_assert(ecs_has(world, e2, Position));
ecs_add(world, e2, Velocity);
test_assert(ecs_has(world, e2, Velocity));
ecs_fini(world);
}
void Snapshot_add_after_snapshot(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ecs_entity_t e = ecs_set(world, 0, Position, {10, 20});
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ecs_snapshot_t *s = ecs_snapshot_take(world);
ecs_snapshot_restore(world, s);
ecs_add(world, e, Velocity);
test_assert(ecs_has(world, e, Velocity));
ecs_fini(world);
}
void Snapshot_delete_after_snapshot(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ecs_entity_t e = ecs_set(world, 0, Position, {10, 20});
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ecs_snapshot_t *s = ecs_snapshot_take(world);
ecs_snapshot_restore(world, s);
ecs_delete(world, e);
test_assert(!ecs_is_alive(world, e));
ecs_fini(world);
}
void Snapshot_new_empty_after_snapshot(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ecs_entity_t e = ecs_set(world, 0, Position, {10, 20});
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ecs_snapshot_t *s = ecs_snapshot_take(world);
ecs_snapshot_restore(world, s);
ecs_entity_t e2 = ecs_new(world, 0);
test_assert(e2 != 0);
ecs_fini(world);
}
void Snapshot_set_after_snapshot(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ecs_entity_t e = ecs_set(world, 0, Position, {10, 20});
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ecs_snapshot_t *s = ecs_snapshot_take(world);
ecs_snapshot_restore(world, s);
ecs_entity_t e2 = ecs_new(world, 0);
test_assert(e2 != 0);
ecs_set_name(world, e2, "e2");
test_assert(ecs_has_pair(world, e2, ecs_id(EcsIdentifier), EcsName));
test_str(ecs_get_name(world, e2), "e2");
ecs_fini(world);
}
void Snapshot_restore_recycled(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ecs_entity_t e = ecs_set(world, 0, Position, {10, 20});
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ecs_snapshot_t *s = ecs_snapshot_take(world);
ecs_delete(world, e);
ecs_snapshot_restore(world, s);
ecs_entity_t e2 = ecs_new(world, 0);
test_assert(e2 != 0);
test_assert(e != e2);
ecs_fini(world);
}
static
void SetP(ecs_iter_t *it) {
int i;
for (i = 0; i < it->count; i ++) {
ecs_set_name(it->world, 0, "e2");
}
}
void Snapshot_snapshot_w_new_in_onset(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ecs_entity_t e = ecs_set(world, 0, Position, {10, 20});
test_assert(e != 0);
test_assert(ecs_has(world, e, Position));
ECS_OBSERVER(world, SetP, EcsOnSet, Position);
ecs_snapshot_t *s = ecs_snapshot_take(world);
ecs_snapshot_restore(world, s);
ecs_entity_t e2 = ecs_lookup(world, "e2");
test_assert(e2 != 0);
ecs_entity_t e3 = ecs_set_name(world, 0, "e3");
test_assert(e3 != 0);
test_assert(e3 > e2);
test_str(ecs_get_name(world, e3), "e3");
ecs_fini(world);
}
static ecs_entity_t v_entity = 0;
static
void CreateV(ecs_iter_t *it) {
ecs_entity_t ecs_id(Velocity) = ecs_field_id(it, 2);
int i;
for (i = 0; i < it->count; i ++) {
v_entity = ecs_set(it->world, 0, Velocity, {3, 4});
}
}
void Snapshot_snapshot_w_new_in_onset_in_snapshot_table(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ecs_set(world, 0, Position, {10, 20});
ecs_entity_t e2 = ecs_set(world, 0, Velocity, {1, 2});
ECS_OBSERVER(world, CreateV, EcsOnSet, Position, Velocity());
ecs_snapshot_t *s = ecs_snapshot_take(world);
ecs_snapshot_restore(world, s);
const Velocity *v = ecs_get(world, e2, Velocity);
test_assert(v != NULL);
test_int(v->x, 1);
test_int(v->y, 2);
v = ecs_get(world, v_entity, Velocity);
test_assert(v != NULL);
test_int(v->x, 3);
test_int(v->y, 4);
ecs_fini(world);
}
void Snapshot_snapshot_from_stage(void) {
ecs_world_t *world = ecs_init();
ECS_COMPONENT(world, Position);
ECS_COMPONENT(world, Velocity);
ecs_entity_t e1 = ecs_set(world, 0, Position, {1, 2});
ecs_entity_t e2 = ecs_set(world, 0, Position, {3, 4});
ecs_readonly_begin(world);
ecs_world_t *stage = ecs_get_stage(world, 0);
ecs_snapshot_t *s = ecs_snapshot_take(stage);
ecs_delete(stage, e1);
ecs_delete(stage, e2);
ecs_readonly_end(world);
test_assert(!ecs_is_alive(world, e1));
test_assert(!ecs_is_alive(world, e2));
ecs_snapshot_restore(world, s);
const Position *p = ecs_get(world, e1, Position);
test_assert(p != NULL);
test_int(p->x, 1);
test_int(p->y, 2);
p = ecs_get(world, e2, Position);
test_assert(p != NULL);
test_int(p->x, 3);
test_int(p->y, 4);
ecs_fini(world);
}
|
6a428ad5449dfc233c6a2a127b8dc74aa79a0b17
|
853e65ae18800638c7246cee93d6d45c187aeb6a
|
/config.h
|
6f6577c41d72d56ad6fb7a8a94df4b3846c1f37f
|
[
"Apache-2.0"
] |
permissive
|
dmitrystu/sboot_stm32
|
77d348ee77b59db12db416137e01f15ca275dca6
|
89812e504c197bf127acaa19c4c71ca88abff47c
|
refs/heads/master
| 2022-12-22T03:06:39.715403
| 2022-12-09T10:37:37
| 2022-12-09T10:37:37
| 72,232,751
| 298
| 72
|
Apache-2.0
| 2022-12-09T10:37:38
| 2016-10-28T18:37:12
|
Assembly
|
UTF-8
|
C
| false
| false
| 8,228
|
h
|
config.h
|
/* This file is the part of the STM32 secure bootloader
*
* Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
*
* 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.
*/
#ifndef _DFU_BOOTLOADER_H_
#define _DFU_BOOTLOADER_H_
/* Internal variables. Do not touch this section */
#define _AUTO -1 /* set automatically */
#define _DISABLE 0 /* disable feature */
#define _ENABLE 1 /* enable feature */
#define _LOW 2
#define _HIGH 3
/** DFU cipher definitions. */
#define DFU_CIPHER_ARC4 10 /* ARCFOUR (Rivest RC-4) stream cipher */
#define DFU_CIPHER_CHACHA 11 /* RFC7539-CHACHA20 stream cipher */
#define DFU_CIPHER_CHACHA_A 12 /* RFC7539-CHACHA20 stream cipher (ASM) */
#define DFU_CIPHER_GOST 13 /* GOST R 34.12-2015 "MAGMA" block cipher */
#define DFU_CIPHER_RAIDEN 14 /* RAIDEN block cipher */
#define DFU_CIPHER_RC5 15 /* Rivest RC5-32/12/128 clock cipher */
#define DFU_CIPHER_RC5_A 16 /* Rivest RC5-32/12/128 clock cipher (ASM) */
#define DFU_CIPHER_SPECK 17 /* SPECK 64/128 block cipher */
#define DFU_CIPHER_XTEA 18 /* XTEA block cipher */
#define DFU_CIPHER_XTEA1 19 /* XTEA-1 block cipher */
#define DFU_CIPHER_BLOWFISH 20 /* Blowfish block cipher */
#define DFU_CIPHER_RTEA 21 /* Ruptor's TEA or Repaired TEA */
#define DFU_CIPHER_RC6 22 /* Rivest RC6-32/20/128 block cipher */
#define DFU_CIPHER_RC6_A 23 /* Rivest RC6-32/20/128 block cipher (ASM)*/
#define DFU_CIPHER_RIJNDAEL 24 /* Rinjdael AES-128 block cipher */
#define DFU_CIPHER_MAGMA 25 /* GOST R 34.12-2015 "MAGMA" (Endianess fixed) block cipher */
/** Modes for using with block cipher */
#define DFU_CIPHER_ECB 0 /* Electronic Codebook (ECB) */
#define DFU_CIPHER_CBC 1 /* Cipher Block Chaining (CBC) */
#define DFU_CIPHER_PCBC 2 /* Propagating Cipher Block Chaining (PCBC) */
#define DFU_CIPHER_CFB 3 /* Cipher Feedback (CFB) */
#define DFU_CIPHER_OFB 4 /* Output Feedback (OFB) */
#define DFU_CIPHER_CTR 5 /* Counter (CTR) */
/** Checksum definitions. */
#define CRC32FAST 1 /* Lookup table based crc32 algorithm, consumes 1Kb of RAM for the table */
#define CRC32SMALL 2 /* Permutation based crc32 algorithm, no lookup table required but slower */
#define FNV1A32 3 /* Fowler–Noll–Vo 32 bit Hash */
#define FNV1A64 4 /* Fowler–Noll–Vo 64 bit Hash */
#define CRC64FAST 5 /* Lookup table based crc64 algorithm, consumes 2Kb of RAM for the table */
#define CRC64SMALL 6 /* Permutation based crc32 algorithm, no lookup table required but extremly slow */
#define __STR(x) #x
#define STR(x) __STR(x)
#ifdef DFU_USER_CONFIG
#include STR(DFU_USER_CONFIG)
#endif
/* DEFAULT CONFIG STARTS HERE */
/* Skip unwanted dfuDNLOAD_SYNC phase. Slightly improve speed, but don't meets DFU1.1 state diagram */
#ifndef DFU_DNLOAD_NOSYNC
#define DFU_DNLOAD_NOSYNC _ENABLE
#endif
/** Add extra DFU interface for EEPROM */
#ifndef DFU_INTF_EEPROM
#define DFU_INTF_EEPROM _AUTO
#endif
/** Firmware can be uploaded from device */
#ifndef DFU_CAN_UPLOAD
#define DFU_CAN_UPLOAD _ENABLE
#endif
/** Handle DFU_DETACH request in DFU mode. System reset will be issued. */
#ifndef DFU_DETACH
#define DFU_DETACH _ENABLE
#endif
/** Whether application image is verified by a checksum algorithm */
#ifndef DFU_VERIFY_CHECKSUM
#define DFU_VERIFY_CHECKSUM _DISABLE
#endif
/** Memory Readout Protection level **/
#ifndef DFU_SEAL_LEVEL
#define DFU_SEAL_LEVEL 0
#endif
/* USB VID */
#ifndef DFU_VENDOR_ID
#define DFU_VENDOR_ID 0x0483
#endif
/* USB PID */
#ifndef DFU_DEVICE_ID
#define DFU_DEVICE_ID 0xDF11
#endif
/* USB manufacturer string */
#ifndef DFU_STR_MANUF
#define DFU_STR_MANUF "Your company name"
#endif
/* USB product sting */
#ifndef DFU_STR_PRODUCT
#define DFU_STR_PRODUCT "Secure bootloader"
#endif
/* USB string for DFU configureation string descriptor. */
#ifndef DFU_DSC_CONFIG
#define DFU_DSC_CONFIG _ENABLE
#endif
#ifndef DFU_STR_CONFIG
#define DFU_STR_CONFIG "DFU"
#endif
/* USB string for DFU flash interface string descriptor. */
#ifndef DFU_DSC_FLASH
#define DFU_DSC_FLASH _ENABLE
#endif
#ifndef DFU_STR_FLASH
#define DFU_STR_FLASH "Internal flash"
#endif
/* USB string for DFU EEPROM interface sreing descriptor */
#ifndef DFU_DSC_EEPROM
#define DFU_DSC_EEPROM _ENABLE
#endif
#ifndef DFU_STR_EEPROM
#define DFU_STR_EEPROM "Internal EEPROM"
#endif
/* USB EP0 size. Must be 8 for USB FS */
#define DFU_EP0_SIZE 8
/* DFU properties */
#ifndef DFU_POLL_TIMEOUT
#define DFU_POLL_TIMEOUT 20
#endif
#ifndef DFU_DETACH_TIMEOUT
#define DFU_DETACH_TIMEOUT 200
#endif
#ifndef DFU_BLOCKSZ
#define DFU_BLOCKSZ 0x80
#endif
/* 32 bit DFU bootkey value */
#ifndef DFU_BOOTKEY
#define DFU_BOOTKEY 0x157F32D4
#endif
/* DFU bootkey address. Top of the ram by default. _AUTO, _DISABLE or set address.
* May be enabled internally. */
#ifndef DFU_BOOTKEY_ADDR
#define DFU_BOOTKEY_ADDR _AUTO
#endif
/* DFU bootstrap port/pin settings. Set GPIOx or _DISABLE */
#ifndef DFU_BOOTSTRAP_GPIO
#define DFU_BOOTSTRAP_GPIO GPIOA
#endif
#ifndef DFU_BOOTSTRAP_PIN
#define DFU_BOOTSTRAP_PIN 1
#endif
/* Active bootstrap pin logic level. _HIGH, _LOW */
#ifndef DFU_BOOTSTRAP_LEVEL
#define DFU_BOOTSTRAP_LEVEL _LOW
#endif
/* Pullup or pulldown settings for the bootstrap pin _AUTO, _DISABLE, _HIGH, _LOW */
#ifndef DFU_BOOTSTRAP_PULL
#define DFU_BOOTSTRAP_PULL _AUTO
#endif
/* Double reset waiting time in mS. _DISABLE or time in mS */
#ifndef DFU_DBLRESET_MS
#define DFU_DBLRESET_MS 300
#endif
/* User application address. _AUTO or page aligned address.
* for _AUTO check __app_start address in output linker map file*/
#ifndef DFU_APP_START
#define DFU_APP_START _AUTO
#endif
/* User application size. _AUTO or required size in bytes. */
#ifndef DFU_APP_SIZE
#define DFU_APP_SIZE _AUTO
#endif
/* Microsoft WCID allows automatic driver (WinUSB) installation on device
* connection. Use _ENABLE to make your device likeable by Windows. */
#ifndef DFU_WCID
#define DFU_WCID _DISABLE
#endif
/* Cipher to use. set _DISABLE or choose from implemented ciphers */
#ifndef DFU_CIPHER
#define DFU_CIPHER DFU_CIPHER_RC5
#endif
#ifndef DFU_CIPHER_MODE
#define DFU_CIPHER_MODE DFU_CIPHER_CBC
#endif
/** DFU secure key. */
#define DFU_AES_KEY_A 0x2D, 0x4D, 0x61, 0x6B, 0x65, 0x4C, 0x6F, 0x76, \
0x65, 0x4E, 0x6F, 0x74, 0x57, 0x61, 0x72, 0x2D
#define DFU_AES_KEY_B 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, \
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
#ifndef DFU_AES_KEY_128
#define DFU_AES_KEY_128 DFU_AES_KEY_A
#endif
#ifndef DFU_AES_KEY_192
#define DFU_AES_KEY_192 0x2D, 0x4D, 0x61, 0x6B, 0x65, 0x4C, 0x6F, 0x76, \
0x65, 0x4E, 0x6F, 0x74, 0x57, 0x61, 0x72, 0x2D, \
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
#endif
#ifndef DFU_AES_KEY_256
#define DFU_AES_KEY_256 DFU_AES_KEY_A, DFU_AES_KEY_B
#endif
/** cipher initialization vector for block cipher and CHACHA */
#ifndef DFU_AES_IV_64
#define DFU_AES_IV_64 0x44, 0x33, 0x22, 0x11, 0x88, 0x77, 0x66, 0x55
#endif
#ifndef DFU_AES_IV_96
#define DFU_AES_IV_96 0x44, 0x33, 0x22, 0x11, 0x88, 0x77, 0x66, 0x55, \
0xCC, 0xBB, 0xAA, 0x99
#endif
#ifndef DFU_AES_IV_128
#define DFU_AES_IV_128 0x44, 0x33, 0x22, 0x11, 0x88, 0x77, 0x66, 0x55,\
0xCC, 0xBB, 0xAA, 0x99, 0x44, 0x33, 0x22, 0x11
#endif
#endif // _DFU_BOOTLOADER_H_
|
ce23d9e042c4d4250d9bf207f86d54521dd51cb3
|
057a475216e9beed41983481aafcaf109bbf58da
|
/base/poco/Foundation/src/pcre_ucd.c
|
c7e8aab48050e3260fba4c8b5d7b21bae2991e60
|
[
"BSL-1.0",
"Apache-2.0"
] |
permissive
|
ClickHouse/ClickHouse
|
fece5204263a5b4d693854b6039699265f1bb27f
|
6649328db809d51a694c358571539bc5820464be
|
refs/heads/master
| 2023-08-31T18:48:36.615225
| 2023-08-31T17:51:24
| 2023-08-31T17:51:24
| 60,246,359
| 23,878
| 5,449
|
Apache-2.0
| 2023-09-14T20:10:52
| 2016-06-02T08:28:18
|
C++
|
UTF-8
|
C
| false
| false
| 208,542
|
c
|
pcre_ucd.c
|
/* This module is generated by the maint/MultiStage2.py script.
Do not modify it by hand. Instead modify the script and run it
to regenerate this code.
As well as being part of the PCRE library, this module is #included
by the pcretest program, which redefines the PRIV macro to change
table names from _pcre_xxx to xxxx, thereby avoiding name clashes
with the library. At present, just one of these tables is actually
needed. */
#ifndef PCRE_INCLUDED
#include "pcre_config.h"
#include "pcre_internal.h"
#endif /* PCRE_INCLUDED */
/* Unicode character database. */
/* This file was autogenerated by the MultiStage2.py script. */
/* Total size: 72576 bytes, block size: 128. */
/* The tables herein are needed only when UCP support is built
into PCRE. This module should not be referenced otherwise, so
it should not matter whether it is compiled or not. However
a comment was received about space saving - maybe the guy linked
all the modules rather than using a library - so we include a
condition to cut out the tables when not needed. But don't leave
a totally empty module because some compilers barf at that.
Instead, just supply small dummy tables. */
#ifndef SUPPORT_UCP
const ucd_record PRIV(ucd_records)[] = {{0,0,0,0,0 }};
const pcre_uint8 PRIV(ucd_stage1)[] = {0};
const pcre_uint16 PRIV(ucd_stage2)[] = {0};
const pcre_uint32 PRIV(ucd_caseless_sets)[] = {0};
#else
/* If the 32-bit library is run in non-32-bit mode, character values
greater than 0x10ffff may be encountered. For these we set up a
special record. */
#ifdef COMPILE_PCRE32
const ucd_record PRIV(dummy_ucd_record)[] = {{
ucp_Common, /* script */
ucp_Cn, /* type unassigned */
ucp_gbOther, /* grapheme break property */
0, /* case set */
0, /* other case */
}};
#endif
/* When recompiling tables with a new Unicode version, please check the
types in this structure definition from pcre_internal.h (the actual
field names will be different):
typedef struct {
pcre_uint8 property_0;
pcre_uint8 property_1;
pcre_uint8 property_2;
pcre_uint8 property_3;
pcre_int32 property_4;
} ucd_record;
*/
const pcre_uint32 PRIV(ucd_caseless_sets)[] = {
NOTACHAR,
0x0053, 0x0073, 0x017f, NOTACHAR,
0x01c4, 0x01c5, 0x01c6, NOTACHAR,
0x01c7, 0x01c8, 0x01c9, NOTACHAR,
0x01ca, 0x01cb, 0x01cc, NOTACHAR,
0x01f1, 0x01f2, 0x01f3, NOTACHAR,
0x0345, 0x0399, 0x03b9, 0x1fbe, NOTACHAR,
0x00b5, 0x039c, 0x03bc, NOTACHAR,
0x03a3, 0x03c2, 0x03c3, NOTACHAR,
0x0392, 0x03b2, 0x03d0, NOTACHAR,
0x0398, 0x03b8, 0x03d1, 0x03f4, NOTACHAR,
0x03a6, 0x03c6, 0x03d5, NOTACHAR,
0x03a0, 0x03c0, 0x03d6, NOTACHAR,
0x039a, 0x03ba, 0x03f0, NOTACHAR,
0x03a1, 0x03c1, 0x03f1, NOTACHAR,
0x0395, 0x03b5, 0x03f5, NOTACHAR,
0x1e60, 0x1e61, 0x1e9b, NOTACHAR,
0x03a9, 0x03c9, 0x2126, NOTACHAR,
0x004b, 0x006b, 0x212a, NOTACHAR,
0x00c5, 0x00e5, 0x212b, NOTACHAR,
};
/* When #included in pcretest, we don't need this large table. */
#ifndef PCRE_INCLUDED
const ucd_record PRIV(ucd_records)[] = { /* 5760 bytes, record size 8 */
{ 9, 0, 2, 0, 0, }, /* 0 */
{ 9, 0, 1, 0, 0, }, /* 1 */
{ 9, 0, 0, 0, 0, }, /* 2 */
{ 9, 29, 12, 0, 0, }, /* 3 */
{ 9, 21, 12, 0, 0, }, /* 4 */
{ 9, 23, 12, 0, 0, }, /* 5 */
{ 9, 22, 12, 0, 0, }, /* 6 */
{ 9, 18, 12, 0, 0, }, /* 7 */
{ 9, 25, 12, 0, 0, }, /* 8 */
{ 9, 17, 12, 0, 0, }, /* 9 */
{ 9, 13, 12, 0, 0, }, /* 10 */
{ 33, 9, 12, 0, 32, }, /* 11 */
{ 33, 9, 12, 71, 32, }, /* 12 */
{ 33, 9, 12, 1, 32, }, /* 13 */
{ 9, 24, 12, 0, 0, }, /* 14 */
{ 9, 16, 12, 0, 0, }, /* 15 */
{ 33, 5, 12, 0, -32, }, /* 16 */
{ 33, 5, 12, 71, -32, }, /* 17 */
{ 33, 5, 12, 1, -32, }, /* 18 */
{ 9, 26, 12, 0, 0, }, /* 19 */
{ 33, 7, 12, 0, 0, }, /* 20 */
{ 9, 20, 12, 0, 0, }, /* 21 */
{ 9, 1, 2, 0, 0, }, /* 22 */
{ 9, 15, 12, 0, 0, }, /* 23 */
{ 9, 5, 12, 26, 775, }, /* 24 */
{ 9, 19, 12, 0, 0, }, /* 25 */
{ 33, 9, 12, 75, 32, }, /* 26 */
{ 33, 5, 12, 0, 7615, }, /* 27 */
{ 33, 5, 12, 75, -32, }, /* 28 */
{ 33, 5, 12, 0, 121, }, /* 29 */
{ 33, 9, 12, 0, 1, }, /* 30 */
{ 33, 5, 12, 0, -1, }, /* 31 */
{ 33, 9, 12, 0, 0, }, /* 32 */
{ 33, 5, 12, 0, 0, }, /* 33 */
{ 33, 9, 12, 0, -121, }, /* 34 */
{ 33, 5, 12, 1, -268, }, /* 35 */
{ 33, 5, 12, 0, 195, }, /* 36 */
{ 33, 9, 12, 0, 210, }, /* 37 */
{ 33, 9, 12, 0, 206, }, /* 38 */
{ 33, 9, 12, 0, 205, }, /* 39 */
{ 33, 9, 12, 0, 79, }, /* 40 */
{ 33, 9, 12, 0, 202, }, /* 41 */
{ 33, 9, 12, 0, 203, }, /* 42 */
{ 33, 9, 12, 0, 207, }, /* 43 */
{ 33, 5, 12, 0, 97, }, /* 44 */
{ 33, 9, 12, 0, 211, }, /* 45 */
{ 33, 9, 12, 0, 209, }, /* 46 */
{ 33, 5, 12, 0, 163, }, /* 47 */
{ 33, 9, 12, 0, 213, }, /* 48 */
{ 33, 5, 12, 0, 130, }, /* 49 */
{ 33, 9, 12, 0, 214, }, /* 50 */
{ 33, 9, 12, 0, 218, }, /* 51 */
{ 33, 9, 12, 0, 217, }, /* 52 */
{ 33, 9, 12, 0, 219, }, /* 53 */
{ 33, 5, 12, 0, 56, }, /* 54 */
{ 33, 9, 12, 5, 2, }, /* 55 */
{ 33, 8, 12, 5, 1, }, /* 56 */
{ 33, 5, 12, 5, -2, }, /* 57 */
{ 33, 9, 12, 9, 2, }, /* 58 */
{ 33, 8, 12, 9, 1, }, /* 59 */
{ 33, 5, 12, 9, -2, }, /* 60 */
{ 33, 9, 12, 13, 2, }, /* 61 */
{ 33, 8, 12, 13, 1, }, /* 62 */
{ 33, 5, 12, 13, -2, }, /* 63 */
{ 33, 5, 12, 0, -79, }, /* 64 */
{ 33, 9, 12, 17, 2, }, /* 65 */
{ 33, 8, 12, 17, 1, }, /* 66 */
{ 33, 5, 12, 17, -2, }, /* 67 */
{ 33, 9, 12, 0, -97, }, /* 68 */
{ 33, 9, 12, 0, -56, }, /* 69 */
{ 33, 9, 12, 0, -130, }, /* 70 */
{ 33, 9, 12, 0, 10795, }, /* 71 */
{ 33, 9, 12, 0, -163, }, /* 72 */
{ 33, 9, 12, 0, 10792, }, /* 73 */
{ 33, 5, 12, 0, 10815, }, /* 74 */
{ 33, 9, 12, 0, -195, }, /* 75 */
{ 33, 9, 12, 0, 69, }, /* 76 */
{ 33, 9, 12, 0, 71, }, /* 77 */
{ 33, 5, 12, 0, 10783, }, /* 78 */
{ 33, 5, 12, 0, 10780, }, /* 79 */
{ 33, 5, 12, 0, 10782, }, /* 80 */
{ 33, 5, 12, 0, -210, }, /* 81 */
{ 33, 5, 12, 0, -206, }, /* 82 */
{ 33, 5, 12, 0, -205, }, /* 83 */
{ 33, 5, 12, 0, -202, }, /* 84 */
{ 33, 5, 12, 0, -203, }, /* 85 */
{ 33, 5, 12, 0, 42319, }, /* 86 */
{ 33, 5, 12, 0, 42315, }, /* 87 */
{ 33, 5, 12, 0, -207, }, /* 88 */
{ 33, 5, 12, 0, 42280, }, /* 89 */
{ 33, 5, 12, 0, 42308, }, /* 90 */
{ 33, 5, 12, 0, -209, }, /* 91 */
{ 33, 5, 12, 0, -211, }, /* 92 */
{ 33, 5, 12, 0, 10743, }, /* 93 */
{ 33, 5, 12, 0, 42305, }, /* 94 */
{ 33, 5, 12, 0, 10749, }, /* 95 */
{ 33, 5, 12, 0, -213, }, /* 96 */
{ 33, 5, 12, 0, -214, }, /* 97 */
{ 33, 5, 12, 0, 10727, }, /* 98 */
{ 33, 5, 12, 0, -218, }, /* 99 */
{ 33, 5, 12, 0, 42282, }, /* 100 */
{ 33, 5, 12, 0, -69, }, /* 101 */
{ 33, 5, 12, 0, -217, }, /* 102 */
{ 33, 5, 12, 0, -71, }, /* 103 */
{ 33, 5, 12, 0, -219, }, /* 104 */
{ 33, 5, 12, 0, 42258, }, /* 105 */
{ 33, 6, 12, 0, 0, }, /* 106 */
{ 9, 6, 12, 0, 0, }, /* 107 */
{ 3, 24, 12, 0, 0, }, /* 108 */
{ 27, 12, 3, 0, 0, }, /* 109 */
{ 27, 12, 3, 21, 116, }, /* 110 */
{ 19, 9, 12, 0, 1, }, /* 111 */
{ 19, 5, 12, 0, -1, }, /* 112 */
{ 19, 24, 12, 0, 0, }, /* 113 */
{ 9, 2, 12, 0, 0, }, /* 114 */
{ 19, 6, 12, 0, 0, }, /* 115 */
{ 19, 5, 12, 0, 130, }, /* 116 */
{ 19, 9, 12, 0, 116, }, /* 117 */
{ 19, 9, 12, 0, 38, }, /* 118 */
{ 19, 9, 12, 0, 37, }, /* 119 */
{ 19, 9, 12, 0, 64, }, /* 120 */
{ 19, 9, 12, 0, 63, }, /* 121 */
{ 19, 5, 12, 0, 0, }, /* 122 */
{ 19, 9, 12, 0, 32, }, /* 123 */
{ 19, 9, 12, 34, 32, }, /* 124 */
{ 19, 9, 12, 59, 32, }, /* 125 */
{ 19, 9, 12, 38, 32, }, /* 126 */
{ 19, 9, 12, 21, 32, }, /* 127 */
{ 19, 9, 12, 51, 32, }, /* 128 */
{ 19, 9, 12, 26, 32, }, /* 129 */
{ 19, 9, 12, 47, 32, }, /* 130 */
{ 19, 9, 12, 55, 32, }, /* 131 */
{ 19, 9, 12, 30, 32, }, /* 132 */
{ 19, 9, 12, 43, 32, }, /* 133 */
{ 19, 9, 12, 67, 32, }, /* 134 */
{ 19, 5, 12, 0, -38, }, /* 135 */
{ 19, 5, 12, 0, -37, }, /* 136 */
{ 19, 5, 12, 0, -32, }, /* 137 */
{ 19, 5, 12, 34, -32, }, /* 138 */
{ 19, 5, 12, 59, -32, }, /* 139 */
{ 19, 5, 12, 38, -32, }, /* 140 */
{ 19, 5, 12, 21, -116, }, /* 141 */
{ 19, 5, 12, 51, -32, }, /* 142 */
{ 19, 5, 12, 26, -775, }, /* 143 */
{ 19, 5, 12, 47, -32, }, /* 144 */
{ 19, 5, 12, 55, -32, }, /* 145 */
{ 19, 5, 12, 30, 1, }, /* 146 */
{ 19, 5, 12, 30, -32, }, /* 147 */
{ 19, 5, 12, 43, -32, }, /* 148 */
{ 19, 5, 12, 67, -32, }, /* 149 */
{ 19, 5, 12, 0, -64, }, /* 150 */
{ 19, 5, 12, 0, -63, }, /* 151 */
{ 19, 9, 12, 0, 8, }, /* 152 */
{ 19, 5, 12, 34, -30, }, /* 153 */
{ 19, 5, 12, 38, -25, }, /* 154 */
{ 19, 9, 12, 0, 0, }, /* 155 */
{ 19, 5, 12, 43, -15, }, /* 156 */
{ 19, 5, 12, 47, -22, }, /* 157 */
{ 19, 5, 12, 0, -8, }, /* 158 */
{ 10, 9, 12, 0, 1, }, /* 159 */
{ 10, 5, 12, 0, -1, }, /* 160 */
{ 19, 5, 12, 51, -54, }, /* 161 */
{ 19, 5, 12, 55, -48, }, /* 162 */
{ 19, 5, 12, 0, 7, }, /* 163 */
{ 19, 5, 12, 0, -116, }, /* 164 */
{ 19, 9, 12, 38, -60, }, /* 165 */
{ 19, 5, 12, 59, -64, }, /* 166 */
{ 19, 25, 12, 0, 0, }, /* 167 */
{ 19, 9, 12, 0, -7, }, /* 168 */
{ 19, 9, 12, 0, -130, }, /* 169 */
{ 12, 9, 12, 0, 80, }, /* 170 */
{ 12, 9, 12, 0, 32, }, /* 171 */
{ 12, 5, 12, 0, -32, }, /* 172 */
{ 12, 5, 12, 0, -80, }, /* 173 */
{ 12, 9, 12, 0, 1, }, /* 174 */
{ 12, 5, 12, 0, -1, }, /* 175 */
{ 12, 26, 12, 0, 0, }, /* 176 */
{ 12, 12, 3, 0, 0, }, /* 177 */
{ 12, 11, 3, 0, 0, }, /* 178 */
{ 12, 9, 12, 0, 15, }, /* 179 */
{ 12, 5, 12, 0, -15, }, /* 180 */
{ 1, 9, 12, 0, 48, }, /* 181 */
{ 1, 6, 12, 0, 0, }, /* 182 */
{ 1, 21, 12, 0, 0, }, /* 183 */
{ 1, 5, 12, 0, -48, }, /* 184 */
{ 1, 5, 12, 0, 0, }, /* 185 */
{ 1, 17, 12, 0, 0, }, /* 186 */
{ 1, 26, 12, 0, 0, }, /* 187 */
{ 1, 23, 12, 0, 0, }, /* 188 */
{ 25, 12, 3, 0, 0, }, /* 189 */
{ 25, 17, 12, 0, 0, }, /* 190 */
{ 25, 21, 12, 0, 0, }, /* 191 */
{ 25, 7, 12, 0, 0, }, /* 192 */
{ 0, 1, 2, 0, 0, }, /* 193 */
{ 0, 25, 12, 0, 0, }, /* 194 */
{ 0, 21, 12, 0, 0, }, /* 195 */
{ 0, 23, 12, 0, 0, }, /* 196 */
{ 0, 26, 12, 0, 0, }, /* 197 */
{ 0, 12, 3, 0, 0, }, /* 198 */
{ 0, 7, 12, 0, 0, }, /* 199 */
{ 0, 6, 12, 0, 0, }, /* 200 */
{ 0, 13, 12, 0, 0, }, /* 201 */
{ 49, 21, 12, 0, 0, }, /* 202 */
{ 49, 1, 2, 0, 0, }, /* 203 */
{ 49, 7, 12, 0, 0, }, /* 204 */
{ 49, 12, 3, 0, 0, }, /* 205 */
{ 55, 7, 12, 0, 0, }, /* 206 */
{ 55, 12, 3, 0, 0, }, /* 207 */
{ 63, 13, 12, 0, 0, }, /* 208 */
{ 63, 7, 12, 0, 0, }, /* 209 */
{ 63, 12, 3, 0, 0, }, /* 210 */
{ 63, 6, 12, 0, 0, }, /* 211 */
{ 63, 26, 12, 0, 0, }, /* 212 */
{ 63, 21, 12, 0, 0, }, /* 213 */
{ 89, 7, 12, 0, 0, }, /* 214 */
{ 89, 12, 3, 0, 0, }, /* 215 */
{ 89, 6, 12, 0, 0, }, /* 216 */
{ 89, 21, 12, 0, 0, }, /* 217 */
{ 94, 7, 12, 0, 0, }, /* 218 */
{ 94, 12, 3, 0, 0, }, /* 219 */
{ 94, 21, 12, 0, 0, }, /* 220 */
{ 14, 12, 3, 0, 0, }, /* 221 */
{ 14, 10, 5, 0, 0, }, /* 222 */
{ 14, 7, 12, 0, 0, }, /* 223 */
{ 14, 13, 12, 0, 0, }, /* 224 */
{ 14, 21, 12, 0, 0, }, /* 225 */
{ 14, 6, 12, 0, 0, }, /* 226 */
{ 2, 7, 12, 0, 0, }, /* 227 */
{ 2, 12, 3, 0, 0, }, /* 228 */
{ 2, 10, 5, 0, 0, }, /* 229 */
{ 2, 10, 3, 0, 0, }, /* 230 */
{ 2, 13, 12, 0, 0, }, /* 231 */
{ 2, 23, 12, 0, 0, }, /* 232 */
{ 2, 15, 12, 0, 0, }, /* 233 */
{ 2, 26, 12, 0, 0, }, /* 234 */
{ 21, 12, 3, 0, 0, }, /* 235 */
{ 21, 10, 5, 0, 0, }, /* 236 */
{ 21, 7, 12, 0, 0, }, /* 237 */
{ 21, 13, 12, 0, 0, }, /* 238 */
{ 20, 12, 3, 0, 0, }, /* 239 */
{ 20, 10, 5, 0, 0, }, /* 240 */
{ 20, 7, 12, 0, 0, }, /* 241 */
{ 20, 13, 12, 0, 0, }, /* 242 */
{ 20, 21, 12, 0, 0, }, /* 243 */
{ 20, 23, 12, 0, 0, }, /* 244 */
{ 43, 12, 3, 0, 0, }, /* 245 */
{ 43, 10, 5, 0, 0, }, /* 246 */
{ 43, 7, 12, 0, 0, }, /* 247 */
{ 43, 10, 3, 0, 0, }, /* 248 */
{ 43, 13, 12, 0, 0, }, /* 249 */
{ 43, 26, 12, 0, 0, }, /* 250 */
{ 43, 15, 12, 0, 0, }, /* 251 */
{ 53, 12, 3, 0, 0, }, /* 252 */
{ 53, 7, 12, 0, 0, }, /* 253 */
{ 53, 10, 3, 0, 0, }, /* 254 */
{ 53, 10, 5, 0, 0, }, /* 255 */
{ 53, 13, 12, 0, 0, }, /* 256 */
{ 53, 15, 12, 0, 0, }, /* 257 */
{ 53, 26, 12, 0, 0, }, /* 258 */
{ 53, 23, 12, 0, 0, }, /* 259 */
{ 54, 12, 3, 0, 0, }, /* 260 */
{ 54, 10, 5, 0, 0, }, /* 261 */
{ 54, 7, 12, 0, 0, }, /* 262 */
{ 54, 13, 12, 0, 0, }, /* 263 */
{ 54, 15, 12, 0, 0, }, /* 264 */
{ 54, 26, 12, 0, 0, }, /* 265 */
{ 28, 12, 3, 0, 0, }, /* 266 */
{ 28, 10, 5, 0, 0, }, /* 267 */
{ 28, 7, 12, 0, 0, }, /* 268 */
{ 28, 10, 3, 0, 0, }, /* 269 */
{ 28, 13, 12, 0, 0, }, /* 270 */
{ 36, 12, 3, 0, 0, }, /* 271 */
{ 36, 10, 5, 0, 0, }, /* 272 */
{ 36, 7, 12, 0, 0, }, /* 273 */
{ 36, 10, 3, 0, 0, }, /* 274 */
{ 36, 13, 12, 0, 0, }, /* 275 */
{ 36, 15, 12, 0, 0, }, /* 276 */
{ 36, 26, 12, 0, 0, }, /* 277 */
{ 47, 10, 5, 0, 0, }, /* 278 */
{ 47, 7, 12, 0, 0, }, /* 279 */
{ 47, 12, 3, 0, 0, }, /* 280 */
{ 47, 10, 3, 0, 0, }, /* 281 */
{ 47, 13, 12, 0, 0, }, /* 282 */
{ 47, 21, 12, 0, 0, }, /* 283 */
{ 56, 7, 12, 0, 0, }, /* 284 */
{ 56, 12, 3, 0, 0, }, /* 285 */
{ 56, 7, 5, 0, 0, }, /* 286 */
{ 56, 6, 12, 0, 0, }, /* 287 */
{ 56, 21, 12, 0, 0, }, /* 288 */
{ 56, 13, 12, 0, 0, }, /* 289 */
{ 32, 7, 12, 0, 0, }, /* 290 */
{ 32, 12, 3, 0, 0, }, /* 291 */
{ 32, 7, 5, 0, 0, }, /* 292 */
{ 32, 6, 12, 0, 0, }, /* 293 */
{ 32, 13, 12, 0, 0, }, /* 294 */
{ 57, 7, 12, 0, 0, }, /* 295 */
{ 57, 26, 12, 0, 0, }, /* 296 */
{ 57, 21, 12, 0, 0, }, /* 297 */
{ 57, 12, 3, 0, 0, }, /* 298 */
{ 57, 13, 12, 0, 0, }, /* 299 */
{ 57, 15, 12, 0, 0, }, /* 300 */
{ 57, 22, 12, 0, 0, }, /* 301 */
{ 57, 18, 12, 0, 0, }, /* 302 */
{ 57, 10, 5, 0, 0, }, /* 303 */
{ 38, 7, 12, 0, 0, }, /* 304 */
{ 38, 10, 12, 0, 0, }, /* 305 */
{ 38, 12, 3, 0, 0, }, /* 306 */
{ 38, 10, 5, 0, 0, }, /* 307 */
{ 38, 13, 12, 0, 0, }, /* 308 */
{ 38, 21, 12, 0, 0, }, /* 309 */
{ 38, 26, 12, 0, 0, }, /* 310 */
{ 16, 9, 12, 0, 7264, }, /* 311 */
{ 16, 7, 12, 0, 0, }, /* 312 */
{ 16, 6, 12, 0, 0, }, /* 313 */
{ 23, 7, 6, 0, 0, }, /* 314 */
{ 23, 7, 7, 0, 0, }, /* 315 */
{ 23, 7, 8, 0, 0, }, /* 316 */
{ 15, 7, 12, 0, 0, }, /* 317 */
{ 15, 12, 3, 0, 0, }, /* 318 */
{ 15, 21, 12, 0, 0, }, /* 319 */
{ 15, 15, 12, 0, 0, }, /* 320 */
{ 15, 26, 12, 0, 0, }, /* 321 */
{ 8, 7, 12, 0, 0, }, /* 322 */
{ 7, 17, 12, 0, 0, }, /* 323 */
{ 7, 7, 12, 0, 0, }, /* 324 */
{ 7, 21, 12, 0, 0, }, /* 325 */
{ 40, 29, 12, 0, 0, }, /* 326 */
{ 40, 7, 12, 0, 0, }, /* 327 */
{ 40, 22, 12, 0, 0, }, /* 328 */
{ 40, 18, 12, 0, 0, }, /* 329 */
{ 45, 7, 12, 0, 0, }, /* 330 */
{ 45, 14, 12, 0, 0, }, /* 331 */
{ 50, 7, 12, 0, 0, }, /* 332 */
{ 50, 12, 3, 0, 0, }, /* 333 */
{ 24, 7, 12, 0, 0, }, /* 334 */
{ 24, 12, 3, 0, 0, }, /* 335 */
{ 6, 7, 12, 0, 0, }, /* 336 */
{ 6, 12, 3, 0, 0, }, /* 337 */
{ 51, 7, 12, 0, 0, }, /* 338 */
{ 51, 12, 3, 0, 0, }, /* 339 */
{ 31, 7, 12, 0, 0, }, /* 340 */
{ 31, 12, 3, 0, 0, }, /* 341 */
{ 31, 10, 5, 0, 0, }, /* 342 */
{ 31, 21, 12, 0, 0, }, /* 343 */
{ 31, 6, 12, 0, 0, }, /* 344 */
{ 31, 23, 12, 0, 0, }, /* 345 */
{ 31, 13, 12, 0, 0, }, /* 346 */
{ 31, 15, 12, 0, 0, }, /* 347 */
{ 37, 21, 12, 0, 0, }, /* 348 */
{ 37, 17, 12, 0, 0, }, /* 349 */
{ 37, 12, 3, 0, 0, }, /* 350 */
{ 37, 1, 2, 0, 0, }, /* 351 */
{ 37, 13, 12, 0, 0, }, /* 352 */
{ 37, 7, 12, 0, 0, }, /* 353 */
{ 37, 6, 12, 0, 0, }, /* 354 */
{ 34, 7, 12, 0, 0, }, /* 355 */
{ 34, 12, 3, 0, 0, }, /* 356 */
{ 34, 10, 5, 0, 0, }, /* 357 */
{ 34, 26, 12, 0, 0, }, /* 358 */
{ 34, 21, 12, 0, 0, }, /* 359 */
{ 34, 13, 12, 0, 0, }, /* 360 */
{ 52, 7, 12, 0, 0, }, /* 361 */
{ 39, 7, 12, 0, 0, }, /* 362 */
{ 39, 10, 12, 0, 0, }, /* 363 */
{ 39, 10, 5, 0, 0, }, /* 364 */
{ 39, 13, 12, 0, 0, }, /* 365 */
{ 39, 15, 12, 0, 0, }, /* 366 */
{ 39, 26, 12, 0, 0, }, /* 367 */
{ 31, 26, 12, 0, 0, }, /* 368 */
{ 5, 7, 12, 0, 0, }, /* 369 */
{ 5, 12, 3, 0, 0, }, /* 370 */
{ 5, 10, 5, 0, 0, }, /* 371 */
{ 5, 21, 12, 0, 0, }, /* 372 */
{ 90, 7, 12, 0, 0, }, /* 373 */
{ 90, 10, 5, 0, 0, }, /* 374 */
{ 90, 12, 3, 0, 0, }, /* 375 */
{ 90, 10, 12, 0, 0, }, /* 376 */
{ 90, 13, 12, 0, 0, }, /* 377 */
{ 90, 21, 12, 0, 0, }, /* 378 */
{ 90, 6, 12, 0, 0, }, /* 379 */
{ 27, 11, 3, 0, 0, }, /* 380 */
{ 61, 12, 3, 0, 0, }, /* 381 */
{ 61, 10, 5, 0, 0, }, /* 382 */
{ 61, 7, 12, 0, 0, }, /* 383 */
{ 61, 13, 12, 0, 0, }, /* 384 */
{ 61, 21, 12, 0, 0, }, /* 385 */
{ 61, 26, 12, 0, 0, }, /* 386 */
{ 75, 12, 3, 0, 0, }, /* 387 */
{ 75, 10, 5, 0, 0, }, /* 388 */
{ 75, 7, 12, 0, 0, }, /* 389 */
{ 75, 13, 12, 0, 0, }, /* 390 */
{ 92, 7, 12, 0, 0, }, /* 391 */
{ 92, 12, 3, 0, 0, }, /* 392 */
{ 92, 10, 5, 0, 0, }, /* 393 */
{ 92, 21, 12, 0, 0, }, /* 394 */
{ 69, 7, 12, 0, 0, }, /* 395 */
{ 69, 10, 5, 0, 0, }, /* 396 */
{ 69, 12, 3, 0, 0, }, /* 397 */
{ 69, 21, 12, 0, 0, }, /* 398 */
{ 69, 13, 12, 0, 0, }, /* 399 */
{ 72, 13, 12, 0, 0, }, /* 400 */
{ 72, 7, 12, 0, 0, }, /* 401 */
{ 72, 6, 12, 0, 0, }, /* 402 */
{ 72, 21, 12, 0, 0, }, /* 403 */
{ 75, 21, 12, 0, 0, }, /* 404 */
{ 9, 10, 5, 0, 0, }, /* 405 */
{ 9, 7, 12, 0, 0, }, /* 406 */
{ 12, 5, 12, 0, 0, }, /* 407 */
{ 12, 6, 12, 0, 0, }, /* 408 */
{ 33, 5, 12, 0, 35332, }, /* 409 */
{ 33, 5, 12, 0, 3814, }, /* 410 */
{ 33, 9, 12, 63, 1, }, /* 411 */
{ 33, 5, 12, 63, -1, }, /* 412 */
{ 33, 5, 12, 63, -58, }, /* 413 */
{ 33, 9, 12, 0, -7615, }, /* 414 */
{ 19, 5, 12, 0, 8, }, /* 415 */
{ 19, 9, 12, 0, -8, }, /* 416 */
{ 19, 5, 12, 0, 74, }, /* 417 */
{ 19, 5, 12, 0, 86, }, /* 418 */
{ 19, 5, 12, 0, 100, }, /* 419 */
{ 19, 5, 12, 0, 128, }, /* 420 */
{ 19, 5, 12, 0, 112, }, /* 421 */
{ 19, 5, 12, 0, 126, }, /* 422 */
{ 19, 8, 12, 0, -8, }, /* 423 */
{ 19, 5, 12, 0, 9, }, /* 424 */
{ 19, 9, 12, 0, -74, }, /* 425 */
{ 19, 8, 12, 0, -9, }, /* 426 */
{ 19, 5, 12, 21, -7173, }, /* 427 */
{ 19, 9, 12, 0, -86, }, /* 428 */
{ 19, 9, 12, 0, -100, }, /* 429 */
{ 19, 9, 12, 0, -112, }, /* 430 */
{ 19, 9, 12, 0, -128, }, /* 431 */
{ 19, 9, 12, 0, -126, }, /* 432 */
{ 27, 1, 3, 0, 0, }, /* 433 */
{ 9, 27, 2, 0, 0, }, /* 434 */
{ 9, 28, 2, 0, 0, }, /* 435 */
{ 9, 2, 2, 0, 0, }, /* 436 */
{ 9, 9, 12, 0, 0, }, /* 437 */
{ 9, 5, 12, 0, 0, }, /* 438 */
{ 19, 9, 12, 67, -7517, }, /* 439 */
{ 33, 9, 12, 71, -8383, }, /* 440 */
{ 33, 9, 12, 75, -8262, }, /* 441 */
{ 33, 9, 12, 0, 28, }, /* 442 */
{ 33, 5, 12, 0, -28, }, /* 443 */
{ 33, 14, 12, 0, 16, }, /* 444 */
{ 33, 14, 12, 0, -16, }, /* 445 */
{ 33, 14, 12, 0, 0, }, /* 446 */
{ 9, 26, 12, 0, 26, }, /* 447 */
{ 9, 26, 12, 0, -26, }, /* 448 */
{ 4, 26, 12, 0, 0, }, /* 449 */
{ 17, 9, 12, 0, 48, }, /* 450 */
{ 17, 5, 12, 0, -48, }, /* 451 */
{ 33, 9, 12, 0, -10743, }, /* 452 */
{ 33, 9, 12, 0, -3814, }, /* 453 */
{ 33, 9, 12, 0, -10727, }, /* 454 */
{ 33, 5, 12, 0, -10795, }, /* 455 */
{ 33, 5, 12, 0, -10792, }, /* 456 */
{ 33, 9, 12, 0, -10780, }, /* 457 */
{ 33, 9, 12, 0, -10749, }, /* 458 */
{ 33, 9, 12, 0, -10783, }, /* 459 */
{ 33, 9, 12, 0, -10782, }, /* 460 */
{ 33, 9, 12, 0, -10815, }, /* 461 */
{ 10, 5, 12, 0, 0, }, /* 462 */
{ 10, 26, 12, 0, 0, }, /* 463 */
{ 10, 12, 3, 0, 0, }, /* 464 */
{ 10, 21, 12, 0, 0, }, /* 465 */
{ 10, 15, 12, 0, 0, }, /* 466 */
{ 16, 5, 12, 0, -7264, }, /* 467 */
{ 58, 7, 12, 0, 0, }, /* 468 */
{ 58, 6, 12, 0, 0, }, /* 469 */
{ 58, 21, 12, 0, 0, }, /* 470 */
{ 58, 12, 3, 0, 0, }, /* 471 */
{ 22, 26, 12, 0, 0, }, /* 472 */
{ 22, 6, 12, 0, 0, }, /* 473 */
{ 22, 14, 12, 0, 0, }, /* 474 */
{ 23, 10, 3, 0, 0, }, /* 475 */
{ 26, 7, 12, 0, 0, }, /* 476 */
{ 26, 6, 12, 0, 0, }, /* 477 */
{ 29, 7, 12, 0, 0, }, /* 478 */
{ 29, 6, 12, 0, 0, }, /* 479 */
{ 3, 7, 12, 0, 0, }, /* 480 */
{ 23, 7, 12, 0, 0, }, /* 481 */
{ 23, 26, 12, 0, 0, }, /* 482 */
{ 29, 26, 12, 0, 0, }, /* 483 */
{ 22, 7, 12, 0, 0, }, /* 484 */
{ 60, 7, 12, 0, 0, }, /* 485 */
{ 60, 6, 12, 0, 0, }, /* 486 */
{ 60, 26, 12, 0, 0, }, /* 487 */
{ 85, 7, 12, 0, 0, }, /* 488 */
{ 85, 6, 12, 0, 0, }, /* 489 */
{ 85, 21, 12, 0, 0, }, /* 490 */
{ 76, 7, 12, 0, 0, }, /* 491 */
{ 76, 6, 12, 0, 0, }, /* 492 */
{ 76, 21, 12, 0, 0, }, /* 493 */
{ 76, 13, 12, 0, 0, }, /* 494 */
{ 12, 7, 12, 0, 0, }, /* 495 */
{ 12, 21, 12, 0, 0, }, /* 496 */
{ 78, 7, 12, 0, 0, }, /* 497 */
{ 78, 14, 12, 0, 0, }, /* 498 */
{ 78, 12, 3, 0, 0, }, /* 499 */
{ 78, 21, 12, 0, 0, }, /* 500 */
{ 33, 9, 12, 0, -35332, }, /* 501 */
{ 33, 9, 12, 0, -42280, }, /* 502 */
{ 33, 9, 12, 0, -42308, }, /* 503 */
{ 33, 9, 12, 0, -42319, }, /* 504 */
{ 33, 9, 12, 0, -42315, }, /* 505 */
{ 33, 9, 12, 0, -42305, }, /* 506 */
{ 33, 9, 12, 0, -42258, }, /* 507 */
{ 33, 9, 12, 0, -42282, }, /* 508 */
{ 48, 7, 12, 0, 0, }, /* 509 */
{ 48, 12, 3, 0, 0, }, /* 510 */
{ 48, 10, 5, 0, 0, }, /* 511 */
{ 48, 26, 12, 0, 0, }, /* 512 */
{ 64, 7, 12, 0, 0, }, /* 513 */
{ 64, 21, 12, 0, 0, }, /* 514 */
{ 74, 10, 5, 0, 0, }, /* 515 */
{ 74, 7, 12, 0, 0, }, /* 516 */
{ 74, 12, 3, 0, 0, }, /* 517 */
{ 74, 21, 12, 0, 0, }, /* 518 */
{ 74, 13, 12, 0, 0, }, /* 519 */
{ 68, 13, 12, 0, 0, }, /* 520 */
{ 68, 7, 12, 0, 0, }, /* 521 */
{ 68, 12, 3, 0, 0, }, /* 522 */
{ 68, 21, 12, 0, 0, }, /* 523 */
{ 73, 7, 12, 0, 0, }, /* 524 */
{ 73, 12, 3, 0, 0, }, /* 525 */
{ 73, 10, 5, 0, 0, }, /* 526 */
{ 73, 21, 12, 0, 0, }, /* 527 */
{ 83, 12, 3, 0, 0, }, /* 528 */
{ 83, 10, 5, 0, 0, }, /* 529 */
{ 83, 7, 12, 0, 0, }, /* 530 */
{ 83, 21, 12, 0, 0, }, /* 531 */
{ 83, 13, 12, 0, 0, }, /* 532 */
{ 38, 6, 12, 0, 0, }, /* 533 */
{ 67, 7, 12, 0, 0, }, /* 534 */
{ 67, 12, 3, 0, 0, }, /* 535 */
{ 67, 10, 5, 0, 0, }, /* 536 */
{ 67, 13, 12, 0, 0, }, /* 537 */
{ 67, 21, 12, 0, 0, }, /* 538 */
{ 91, 7, 12, 0, 0, }, /* 539 */
{ 91, 12, 3, 0, 0, }, /* 540 */
{ 91, 6, 12, 0, 0, }, /* 541 */
{ 91, 21, 12, 0, 0, }, /* 542 */
{ 86, 7, 12, 0, 0, }, /* 543 */
{ 86, 10, 5, 0, 0, }, /* 544 */
{ 86, 12, 3, 0, 0, }, /* 545 */
{ 86, 21, 12, 0, 0, }, /* 546 */
{ 86, 6, 12, 0, 0, }, /* 547 */
{ 86, 13, 12, 0, 0, }, /* 548 */
{ 23, 7, 9, 0, 0, }, /* 549 */
{ 23, 7, 10, 0, 0, }, /* 550 */
{ 9, 4, 2, 0, 0, }, /* 551 */
{ 9, 3, 12, 0, 0, }, /* 552 */
{ 25, 25, 12, 0, 0, }, /* 553 */
{ 0, 24, 12, 0, 0, }, /* 554 */
{ 9, 6, 3, 0, 0, }, /* 555 */
{ 35, 7, 12, 0, 0, }, /* 556 */
{ 19, 14, 12, 0, 0, }, /* 557 */
{ 19, 15, 12, 0, 0, }, /* 558 */
{ 19, 26, 12, 0, 0, }, /* 559 */
{ 70, 7, 12, 0, 0, }, /* 560 */
{ 66, 7, 12, 0, 0, }, /* 561 */
{ 41, 7, 12, 0, 0, }, /* 562 */
{ 41, 15, 12, 0, 0, }, /* 563 */
{ 18, 7, 12, 0, 0, }, /* 564 */
{ 18, 14, 12, 0, 0, }, /* 565 */
{ 117, 7, 12, 0, 0, }, /* 566 */
{ 117, 12, 3, 0, 0, }, /* 567 */
{ 59, 7, 12, 0, 0, }, /* 568 */
{ 59, 21, 12, 0, 0, }, /* 569 */
{ 42, 7, 12, 0, 0, }, /* 570 */
{ 42, 21, 12, 0, 0, }, /* 571 */
{ 42, 14, 12, 0, 0, }, /* 572 */
{ 13, 9, 12, 0, 40, }, /* 573 */
{ 13, 5, 12, 0, -40, }, /* 574 */
{ 46, 7, 12, 0, 0, }, /* 575 */
{ 44, 7, 12, 0, 0, }, /* 576 */
{ 44, 13, 12, 0, 0, }, /* 577 */
{ 105, 7, 12, 0, 0, }, /* 578 */
{ 103, 7, 12, 0, 0, }, /* 579 */
{ 103, 21, 12, 0, 0, }, /* 580 */
{ 109, 7, 12, 0, 0, }, /* 581 */
{ 11, 7, 12, 0, 0, }, /* 582 */
{ 80, 7, 12, 0, 0, }, /* 583 */
{ 80, 21, 12, 0, 0, }, /* 584 */
{ 80, 15, 12, 0, 0, }, /* 585 */
{ 119, 7, 12, 0, 0, }, /* 586 */
{ 119, 26, 12, 0, 0, }, /* 587 */
{ 119, 15, 12, 0, 0, }, /* 588 */
{ 115, 7, 12, 0, 0, }, /* 589 */
{ 115, 15, 12, 0, 0, }, /* 590 */
{ 65, 7, 12, 0, 0, }, /* 591 */
{ 65, 15, 12, 0, 0, }, /* 592 */
{ 65, 21, 12, 0, 0, }, /* 593 */
{ 71, 7, 12, 0, 0, }, /* 594 */
{ 71, 21, 12, 0, 0, }, /* 595 */
{ 97, 7, 12, 0, 0, }, /* 596 */
{ 96, 7, 12, 0, 0, }, /* 597 */
{ 30, 7, 12, 0, 0, }, /* 598 */
{ 30, 12, 3, 0, 0, }, /* 599 */
{ 30, 15, 12, 0, 0, }, /* 600 */
{ 30, 21, 12, 0, 0, }, /* 601 */
{ 87, 7, 12, 0, 0, }, /* 602 */
{ 87, 15, 12, 0, 0, }, /* 603 */
{ 87, 21, 12, 0, 0, }, /* 604 */
{ 116, 7, 12, 0, 0, }, /* 605 */
{ 116, 15, 12, 0, 0, }, /* 606 */
{ 111, 7, 12, 0, 0, }, /* 607 */
{ 111, 26, 12, 0, 0, }, /* 608 */
{ 111, 12, 3, 0, 0, }, /* 609 */
{ 111, 15, 12, 0, 0, }, /* 610 */
{ 111, 21, 12, 0, 0, }, /* 611 */
{ 77, 7, 12, 0, 0, }, /* 612 */
{ 77, 21, 12, 0, 0, }, /* 613 */
{ 82, 7, 12, 0, 0, }, /* 614 */
{ 82, 15, 12, 0, 0, }, /* 615 */
{ 81, 7, 12, 0, 0, }, /* 616 */
{ 81, 15, 12, 0, 0, }, /* 617 */
{ 120, 7, 12, 0, 0, }, /* 618 */
{ 120, 21, 12, 0, 0, }, /* 619 */
{ 120, 15, 12, 0, 0, }, /* 620 */
{ 88, 7, 12, 0, 0, }, /* 621 */
{ 0, 15, 12, 0, 0, }, /* 622 */
{ 93, 10, 5, 0, 0, }, /* 623 */
{ 93, 12, 3, 0, 0, }, /* 624 */
{ 93, 7, 12, 0, 0, }, /* 625 */
{ 93, 21, 12, 0, 0, }, /* 626 */
{ 93, 15, 12, 0, 0, }, /* 627 */
{ 93, 13, 12, 0, 0, }, /* 628 */
{ 84, 12, 3, 0, 0, }, /* 629 */
{ 84, 10, 5, 0, 0, }, /* 630 */
{ 84, 7, 12, 0, 0, }, /* 631 */
{ 84, 21, 12, 0, 0, }, /* 632 */
{ 84, 1, 2, 0, 0, }, /* 633 */
{ 100, 7, 12, 0, 0, }, /* 634 */
{ 100, 13, 12, 0, 0, }, /* 635 */
{ 95, 12, 3, 0, 0, }, /* 636 */
{ 95, 7, 12, 0, 0, }, /* 637 */
{ 95, 10, 5, 0, 0, }, /* 638 */
{ 95, 13, 12, 0, 0, }, /* 639 */
{ 95, 21, 12, 0, 0, }, /* 640 */
{ 110, 7, 12, 0, 0, }, /* 641 */
{ 110, 12, 3, 0, 0, }, /* 642 */
{ 110, 21, 12, 0, 0, }, /* 643 */
{ 99, 12, 3, 0, 0, }, /* 644 */
{ 99, 10, 5, 0, 0, }, /* 645 */
{ 99, 7, 12, 0, 0, }, /* 646 */
{ 99, 21, 12, 0, 0, }, /* 647 */
{ 99, 13, 12, 0, 0, }, /* 648 */
{ 47, 15, 12, 0, 0, }, /* 649 */
{ 107, 7, 12, 0, 0, }, /* 650 */
{ 107, 10, 5, 0, 0, }, /* 651 */
{ 107, 12, 3, 0, 0, }, /* 652 */
{ 107, 21, 12, 0, 0, }, /* 653 */
{ 108, 7, 12, 0, 0, }, /* 654 */
{ 108, 12, 3, 0, 0, }, /* 655 */
{ 108, 10, 5, 0, 0, }, /* 656 */
{ 108, 13, 12, 0, 0, }, /* 657 */
{ 106, 12, 3, 0, 0, }, /* 658 */
{ 106, 10, 5, 0, 0, }, /* 659 */
{ 106, 7, 12, 0, 0, }, /* 660 */
{ 106, 10, 3, 0, 0, }, /* 661 */
{ 123, 7, 12, 0, 0, }, /* 662 */
{ 123, 10, 3, 0, 0, }, /* 663 */
{ 123, 10, 5, 0, 0, }, /* 664 */
{ 123, 12, 3, 0, 0, }, /* 665 */
{ 123, 21, 12, 0, 0, }, /* 666 */
{ 123, 13, 12, 0, 0, }, /* 667 */
{ 122, 7, 12, 0, 0, }, /* 668 */
{ 122, 10, 3, 0, 0, }, /* 669 */
{ 122, 10, 5, 0, 0, }, /* 670 */
{ 122, 12, 3, 0, 0, }, /* 671 */
{ 122, 21, 12, 0, 0, }, /* 672 */
{ 113, 7, 12, 0, 0, }, /* 673 */
{ 113, 10, 5, 0, 0, }, /* 674 */
{ 113, 12, 3, 0, 0, }, /* 675 */
{ 113, 21, 12, 0, 0, }, /* 676 */
{ 113, 13, 12, 0, 0, }, /* 677 */
{ 101, 7, 12, 0, 0, }, /* 678 */
{ 101, 12, 3, 0, 0, }, /* 679 */
{ 101, 10, 5, 0, 0, }, /* 680 */
{ 101, 13, 12, 0, 0, }, /* 681 */
{ 124, 9, 12, 0, 32, }, /* 682 */
{ 124, 5, 12, 0, -32, }, /* 683 */
{ 124, 13, 12, 0, 0, }, /* 684 */
{ 124, 15, 12, 0, 0, }, /* 685 */
{ 124, 7, 12, 0, 0, }, /* 686 */
{ 121, 7, 12, 0, 0, }, /* 687 */
{ 62, 7, 12, 0, 0, }, /* 688 */
{ 62, 14, 12, 0, 0, }, /* 689 */
{ 62, 21, 12, 0, 0, }, /* 690 */
{ 79, 7, 12, 0, 0, }, /* 691 */
{ 114, 7, 12, 0, 0, }, /* 692 */
{ 114, 13, 12, 0, 0, }, /* 693 */
{ 114, 21, 12, 0, 0, }, /* 694 */
{ 102, 7, 12, 0, 0, }, /* 695 */
{ 102, 12, 3, 0, 0, }, /* 696 */
{ 102, 21, 12, 0, 0, }, /* 697 */
{ 118, 7, 12, 0, 0, }, /* 698 */
{ 118, 12, 3, 0, 0, }, /* 699 */
{ 118, 21, 12, 0, 0, }, /* 700 */
{ 118, 26, 12, 0, 0, }, /* 701 */
{ 118, 6, 12, 0, 0, }, /* 702 */
{ 118, 13, 12, 0, 0, }, /* 703 */
{ 118, 15, 12, 0, 0, }, /* 704 */
{ 98, 7, 12, 0, 0, }, /* 705 */
{ 98, 10, 5, 0, 0, }, /* 706 */
{ 98, 12, 3, 0, 0, }, /* 707 */
{ 98, 6, 12, 0, 0, }, /* 708 */
{ 104, 7, 12, 0, 0, }, /* 709 */
{ 104, 26, 12, 0, 0, }, /* 710 */
{ 104, 12, 3, 0, 0, }, /* 711 */
{ 104, 21, 12, 0, 0, }, /* 712 */
{ 9, 10, 3, 0, 0, }, /* 713 */
{ 19, 12, 3, 0, 0, }, /* 714 */
{ 112, 7, 12, 0, 0, }, /* 715 */
{ 112, 15, 12, 0, 0, }, /* 716 */
{ 112, 12, 3, 0, 0, }, /* 717 */
{ 9, 26, 11, 0, 0, }, /* 718 */
{ 26, 26, 12, 0, 0, }, /* 719 */
};
const pcre_uint8 PRIV(ucd_stage1)[] = { /* 8704 bytes */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* U+0000 */
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, /* U+0800 */
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 41, 41, 42, 43, 44, 45, /* U+1000 */
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, /* U+1800 */
62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 71, 72, 73, 71, 74, 75, /* U+2000 */
76, 76, 66, 77, 66, 66, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, /* U+2800 */
88, 89, 90, 91, 92, 93, 94, 71, 95, 95, 95, 95, 95, 95, 95, 95, /* U+3000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+3800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+4000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 96, 95, 95, 95, 95, /* U+4800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+5000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+5800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+6000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+6800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+7000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+7800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+8000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+8800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+9000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 97, /* U+9800 */
98, 99, 99, 99, 99, 99, 99, 99, 99,100,101,101,102,103,104,105, /* U+A000 */
106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,114, /* U+A800 */
115,116,117,118,119,120,114,115,116,117,118,119,120,114,115,116, /* U+B000 */
117,118,119,120,114,115,116,117,118,119,120,114,115,116,117,118, /* U+B800 */
119,120,114,115,116,117,118,119,120,114,115,116,117,118,119,120, /* U+C000 */
114,115,116,117,118,119,120,114,115,116,117,118,119,120,114,115, /* U+C800 */
116,117,118,119,120,114,115,116,117,118,119,120,114,115,116,121, /* U+D000 */
122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* U+D800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+E000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+E800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F000 */
123,123, 95, 95,124,125,126,127,128,128,129,130,131,132,133,134, /* U+F800 */
135,136,137,138,139,140,141,142,143,144,145,139,146,146,147,139, /* U+10000 */
148,149,150,151,152,153,154,155,156,139,139,139,157,139,139,139, /* U+10800 */
158,159,160,161,162,163,164,139,139,165,139,166,167,168,139,139, /* U+11000 */
139,169,139,139,139,170,139,139,139,139,139,139,139,139,139,139, /* U+11800 */
171,171,171,171,171,171,171,172,173,139,139,139,139,139,139,139, /* U+12000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+12800 */
174,174,174,174,174,174,174,174,175,139,139,139,139,139,139,139, /* U+13000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+13800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+14000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+14800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+15000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+15800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+16000 */
176,176,176,176,177,178,179,180,139,139,139,139,139,139,181,182, /* U+16800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+17000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+17800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+18000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+18800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+19000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+19800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1A000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1A800 */
183,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1B000 */
139,139,139,139,139,139,139,139,184,185,139,139,139,139,139,139, /* U+1B800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1C000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1C800 */
71,186,187,188,189,139,190,139,191,192,193,194,195,196,197,198, /* U+1D000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1D800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1E000 */
199,200,139,139,139,139,139,139,139,139,139,139,201,202,139,139, /* U+1E800 */
203,204,205,206,207,139,208,209, 71,210,211,212,213,214,215,216, /* U+1F000 */
217,218,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1F800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+20000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+20800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+21000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+21800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+22000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+22800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+23000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+23800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+24000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+24800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+25000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+25800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+26000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+26800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+27000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+27800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+28000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+28800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+29000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+29800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,219, 95, 95, /* U+2A000 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+2A800 */
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,220, 95, /* U+2B000 */
221,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2B800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2C000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2C800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2D000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2D800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2E000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2E800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2F000 */
95, 95, 95, 95,221,139,139,139,139,139,139,139,139,139,139,139, /* U+2F800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+30000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+30800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+31000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+31800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+32000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+32800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+33000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+33800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+34000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+34800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+35000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+35800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+36000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+36800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+37000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+37800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+38000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+38800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+39000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+39800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3A000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3A800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3B000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3B800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3C000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3C800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3D000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3D800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3E000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3E800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3F000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3F800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+40000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+40800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+41000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+41800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+42000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+42800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+43000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+43800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+44000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+44800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+45000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+45800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+46000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+46800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+47000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+47800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+48000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+48800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+49000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+49800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4A000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4A800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4B000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4B800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4C000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4C800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4D000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4D800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4E000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4E800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4F000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4F800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+50000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+50800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+51000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+51800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+52000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+52800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+53000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+53800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+54000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+54800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+55000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+55800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+56000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+56800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+57000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+57800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+58000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+58800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+59000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+59800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5A000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5A800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5B000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5B800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5C000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5C800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5D000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5D800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5E000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5E800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5F000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5F800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+60000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+60800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+61000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+61800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+62000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+62800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+63000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+63800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+64000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+64800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+65000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+65800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+66000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+66800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+67000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+67800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+68000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+68800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+69000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+69800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6A000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6A800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6B000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6B800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6C000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6C800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6D000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6D800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6E000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6E800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6F000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6F800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+70000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+70800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+71000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+71800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+72000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+72800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+73000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+73800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+74000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+74800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+75000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+75800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+76000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+76800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+77000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+77800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+78000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+78800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+79000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+79800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7A000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7A800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7B000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7B800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7C000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7C800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7D000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7D800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7E000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7E800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7F000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7F800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+80000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+80800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+81000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+81800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+82000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+82800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+83000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+83800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+84000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+84800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+85000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+85800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+86000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+86800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+87000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+87800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+88000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+88800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+89000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+89800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8A000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8A800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8B000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8B800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8C000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8C800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8D000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8D800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8E000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8E800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8F000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8F800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+90000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+90800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+91000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+91800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+92000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+92800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+93000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+93800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+94000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+94800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+95000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+95800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+96000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+96800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+97000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+97800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+98000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+98800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+99000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+99800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9A000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9A800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9B000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9B800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9C000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9C800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9D000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9D800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9E000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9E800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9F000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9F800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A0000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A0800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A1000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A1800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A2000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A2800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A3000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A3800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A4000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A4800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A5000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A5800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A6000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A6800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A7000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A7800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A8000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A8800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A9000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A9800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AA000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AA800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AB000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AB800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AC000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AC800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AD000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AD800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AE000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AE800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AF000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AF800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B0000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B0800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B1000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B1800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B2000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B2800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B3000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B3800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B4000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B4800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B5000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B5800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B6000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B6800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B7000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B7800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B8000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B8800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B9000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B9800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BA000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BA800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BB000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BB800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BC000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BC800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BD000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BD800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BE000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BE800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BF000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BF800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C0000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C0800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C1000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C1800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C2000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C2800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C3000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C3800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C4000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C4800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C5000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C5800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C6000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C6800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C7000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C7800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C8000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C8800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C9000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C9800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CA000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CA800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CB000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CB800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CC000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CC800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CD000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CD800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CE000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CE800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CF000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CF800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D0000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D0800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D1000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D1800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D2000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D2800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D3000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D3800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D4000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D4800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D5000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D5800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D6000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D6800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D7000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D7800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D8000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D8800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D9000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D9800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DA000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DA800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DB000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DB800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DC000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DC800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DD000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DD800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DE000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DE800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DF000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DF800 */
222,223,224,225,223,223,223,223,223,223,223,223,223,223,223,223, /* U+E0000 */
223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223, /* U+E0800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E1000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E1800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E2000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E2800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E3000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E3800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E4000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E4800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E5000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E5800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E6000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E6800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E7000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E7800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E8000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E8800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E9000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E9800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EA000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EA800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EB000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EB800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EC000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EC800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+ED000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+ED800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EE000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EE800 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EF000 */
139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EF800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F0000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F0800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F1000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F1800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F2000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F2800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F3000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F3800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F4000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F4800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F5000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F5800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F6000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F6800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F7000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F7800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F8000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F8800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F9000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F9800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FA000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FA800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FB000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FB800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FC000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FC800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FD000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FD800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FE000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FE800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FF000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,226, /* U+FF800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+100000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+100800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+101000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+101800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+102000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+102800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+103000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+103800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+104000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+104800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+105000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+105800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+106000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+106800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+107000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+107800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+108000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+108800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+109000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+109800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10A000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10A800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10B000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10B800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10C000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10C800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10D000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10D800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10E000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10E800 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10F000 */
123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,226, /* U+10F800 */
};
const pcre_uint16 PRIV(ucd_stage2)[] = { /* 58112 bytes, block = 128 */
/* block 0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3, 4, 4, 4, 5, 4, 4, 4, 6, 7, 4, 8, 4, 9, 4, 4,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 4, 4, 8, 8, 8, 4,
4, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 11, 11, 11, 11,
11, 11, 11, 13, 11, 11, 11, 11, 11, 11, 11, 6, 4, 7, 14, 15,
14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 16, 16, 16, 16,
16, 16, 16, 18, 16, 16, 16, 16, 16, 16, 16, 6, 8, 7, 8, 0,
/* block 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,
3, 4, 5, 5, 5, 5, 19, 4, 14, 19, 20, 21, 8, 22, 19, 14,
19, 8, 23, 23, 14, 24, 4, 4, 14, 23, 20, 25, 23, 23, 23, 4,
11, 11, 11, 11, 11, 26, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 8, 11, 11, 11, 11, 11, 11, 11, 27,
16, 16, 16, 16, 16, 28, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 8, 16, 16, 16, 16, 16, 16, 16, 29,
/* block 2 */
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
32, 33, 30, 31, 30, 31, 30, 31, 33, 30, 31, 30, 31, 30, 31, 30,
31, 30, 31, 30, 31, 30, 31, 30, 31, 33, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 34, 30, 31, 30, 31, 30, 31, 35,
/* block 3 */
36, 37, 30, 31, 30, 31, 38, 30, 31, 39, 39, 30, 31, 33, 40, 41,
42, 30, 31, 39, 43, 44, 45, 46, 30, 31, 47, 33, 45, 48, 49, 50,
30, 31, 30, 31, 30, 31, 51, 30, 31, 51, 33, 33, 30, 31, 51, 30,
31, 52, 52, 30, 31, 30, 31, 53, 30, 31, 33, 20, 30, 31, 33, 54,
20, 20, 20, 20, 55, 56, 57, 58, 59, 60, 61, 62, 63, 30, 31, 30,
31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 64, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
33, 65, 66, 67, 30, 31, 68, 69, 30, 31, 30, 31, 30, 31, 30, 31,
/* block 4 */
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
70, 33, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 33, 33, 33, 33, 33, 33, 71, 30, 31, 72, 73, 74,
74, 30, 31, 75, 76, 77, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
78, 79, 80, 81, 82, 33, 83, 83, 33, 84, 33, 85, 86, 33, 33, 33,
83, 87, 33, 88, 33, 89, 90, 33, 91, 92, 33, 93, 94, 33, 33, 92,
33, 95, 96, 33, 33, 97, 33, 33, 33, 33, 33, 33, 33, 98, 33, 33,
/* block 5 */
99, 33, 33, 99, 33, 33, 33,100, 99,101,102,102,103, 33, 33, 33,
33, 33,104, 33, 20, 33, 33, 33, 33, 33, 33, 33, 33, 33,105, 33,
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
106,106,106,106,106,106,106,106,106,107,107,107,107,107,107,107,
107,107, 14, 14, 14, 14,107,107,107,107,107,107,107,107,107,107,
107,107, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
106,106,106,106,106, 14, 14, 14, 14, 14,108,108,107, 14,107, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
/* block 6 */
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,110,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
111,112,111,112,107,113,111,112,114,114,115,116,116,116, 4,117,
/* block 7 */
114,114,114,114,113, 14,118, 4,119,119,119,114,120,114,121,121,
122,123,124,123,123,125,123,123,126,127,128,123,129,123,123,123,
130,131,114,132,123,123,133,123,123,134,123,123,135,136,136,136,
122,137,138,137,137,139,137,137,140,141,142,137,143,137,137,137,
144,145,146,147,137,137,148,137,137,149,137,137,150,151,151,152,
153,154,155,155,155,156,157,158,111,112,111,112,111,112,111,112,
111,112,159,160,159,160,159,160,159,160,159,160,159,160,159,160,
161,162,163,164,165,166,167,111,112,168,111,112,122,169,169,169,
/* block 8 */
170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175,
174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175,
/* block 9 */
174,175,176,177,177,109,109,177,178,178,174,175,174,175,174,175,
174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175,
174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175,
174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175,
179,174,175,174,175,174,175,174,175,174,175,174,175,174,175,180,
174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175,
174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175,
174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175,
/* block 10 */
174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175,
174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175,
174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175,
114,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,
181,181,181,181,181,181,181,114,114,182,183,183,183,183,183,183,
114,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,
/* block 11 */
184,184,184,184,184,184,184,185,114, 4,186,114,114,187,187,188,
114,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,
189,189,189,189,189,189,189,189,189,189,189,189,189,189,190,189,
191,189,189,191,189,189,191,189,114,114,114,114,114,114,114,114,
192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
192,192,192,192,192,192,192,192,192,192,192,114,114,114,114,114,
192,192,192,191,191,114,114,114,114,114,114,114,114,114,114,114,
/* block 12 */
193,193,193,193,193, 22,194,194,194,195,195,196, 4,195,197,197,
198,198,198,198,198,198,198,198,198,198,198, 4, 22,114,195, 4,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
107,199,199,199,199,199,199,199,199,199,199,109,109,109,109,109,
109,109,109,109,109,109,198,198,198,198,198,198,198,198,198,198,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,195,195,195,195,199,199,
109,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
/* block 13 */
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,195,199,198,198,198,198,198,198,198, 22,197,198,
198,198,198,198,198,200,200,198,198,197,198,198,198,198,199,199,
201,201,201,201,201,201,201,201,201,201,199,199,199,197,197,199,
/* block 14 */
202,202,202,202,202,202,202,202,202,202,202,202,202,202,114,203,
204,205,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,
205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
205,205,205,205,205,205,205,205,205,205,205,114,114,204,204,204,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
/* block 15 */
206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
206,206,206,206,206,206,207,207,207,207,207,207,207,207,207,207,
207,206,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
208,208,208,208,208,208,208,208,208,208,209,209,209,209,209,209,
209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,
209,209,209,209,209,209,209,209,209,209,209,210,210,210,210,210,
210,210,210,210,211,211,212,213,213,213,211,114,114,114,114,114,
/* block 16 */
214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
214,214,214,214,214,214,215,215,215,215,216,215,215,215,215,215,
215,215,215,215,216,215,215,215,216,215,215,215,215,215,114,114,
217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,114,
218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,
218,218,218,218,218,218,218,218,218,219,219,219,114,114,220,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 17 */
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,198,198,198,198,198,198,198,198,198,198,198,198,
198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
/* block 18 */
221,221,221,222,223,223,223,223,223,223,223,223,223,223,223,223,
223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
223,223,223,223,223,223,223,223,223,223,221,222,221,223,222,222,
222,221,221,221,221,221,221,221,221,222,222,222,222,221,222,222,
223,109,109,221,221,221,221,221,223,223,223,223,223,223,223,223,
223,223,221,221, 4, 4,224,224,224,224,224,224,224,224,224,224,
225,226,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
/* block 19 */
227,228,229,229,114,227,227,227,227,227,227,227,227,114,114,227,
227,114,114,227,227,227,227,227,227,227,227,227,227,227,227,227,
227,227,227,227,227,227,227,227,227,114,227,227,227,227,227,227,
227,114,227,114,114,114,227,227,227,227,114,114,228,227,230,229,
229,228,228,228,228,114,114,229,229,114,114,229,229,228,227,114,
114,114,114,114,114,114,114,230,114,114,114,114,227,227,114,227,
227,227,228,228,114,114,231,231,231,231,231,231,231,231,231,231,
227,227,232,232,233,233,233,233,233,233,234,232,114,114,114,114,
/* block 20 */
114,235,235,236,114,237,237,237,237,237,237,114,114,114,114,237,
237,114,114,237,237,237,237,237,237,237,237,237,237,237,237,237,
237,237,237,237,237,237,237,237,237,114,237,237,237,237,237,237,
237,114,237,237,114,237,237,114,237,237,114,114,235,114,236,236,
236,235,235,114,114,114,114,235,235,114,114,235,235,235,114,114,
114,235,114,114,114,114,114,114,114,237,237,237,237,114,237,114,
114,114,114,114,114,114,238,238,238,238,238,238,238,238,238,238,
235,235,237,237,237,235,114,114,114,114,114,114,114,114,114,114,
/* block 21 */
114,239,239,240,114,241,241,241,241,241,241,241,241,241,114,241,
241,241,114,241,241,241,241,241,241,241,241,241,241,241,241,241,
241,241,241,241,241,241,241,241,241,114,241,241,241,241,241,241,
241,114,241,241,114,241,241,241,241,241,114,114,239,241,240,240,
240,239,239,239,239,239,114,239,239,240,114,240,240,239,114,114,
241,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
241,241,239,239,114,114,242,242,242,242,242,242,242,242,242,242,
243,244,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 22 */
114,245,246,246,114,247,247,247,247,247,247,247,247,114,114,247,
247,114,114,247,247,247,247,247,247,247,247,247,247,247,247,247,
247,247,247,247,247,247,247,247,247,114,247,247,247,247,247,247,
247,114,247,247,114,247,247,247,247,247,114,114,245,247,248,245,
246,245,245,245,245,114,114,246,246,114,114,246,246,245,114,114,
114,114,114,114,114,114,245,248,114,114,114,114,247,247,114,247,
247,247,245,245,114,114,249,249,249,249,249,249,249,249,249,249,
250,247,251,251,251,251,251,251,114,114,114,114,114,114,114,114,
/* block 23 */
114,114,252,253,114,253,253,253,253,253,253,114,114,114,253,253,
253,114,253,253,253,253,114,114,114,253,253,114,253,114,253,253,
114,114,114,253,253,114,114,114,253,253,253,114,114,114,253,253,
253,253,253,253,253,253,253,253,253,253,114,114,114,114,254,255,
252,255,255,114,114,114,255,255,255,114,255,255,255,252,114,114,
253,114,114,114,114,114,114,254,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,256,256,256,256,256,256,256,256,256,256,
257,257,257,258,258,258,258,258,258,259,258,114,114,114,114,114,
/* block 24 */
260,261,261,261,114,262,262,262,262,262,262,262,262,114,262,262,
262,114,262,262,262,262,262,262,262,262,262,262,262,262,262,262,
262,262,262,262,262,262,262,262,262,114,262,262,262,262,262,262,
262,262,262,262,262,262,262,262,262,262,114,114,114,262,260,260,
260,261,261,261,261,114,260,260,260,114,260,260,260,260,114,114,
114,114,114,114,114,260,260,114,262,262,114,114,114,114,114,114,
262,262,260,260,114,114,263,263,263,263,263,263,263,263,263,263,
114,114,114,114,114,114,114,114,264,264,264,264,264,264,264,265,
/* block 25 */
114,266,267,267,114,268,268,268,268,268,268,268,268,114,268,268,
268,114,268,268,268,268,268,268,268,268,268,268,268,268,268,268,
268,268,268,268,268,268,268,268,268,114,268,268,268,268,268,268,
268,268,268,268,114,268,268,268,268,268,114,114,266,268,267,266,
267,267,269,267,267,114,266,267,267,114,267,267,266,266,114,114,
114,114,114,114,114,269,269,114,114,114,114,114,114,114,268,114,
268,268,266,266,114,114,270,270,270,270,270,270,270,270,270,270,
114,268,268,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 26 */
114,271,272,272,114,273,273,273,273,273,273,273,273,114,273,273,
273,114,273,273,273,273,273,273,273,273,273,273,273,273,273,273,
273,273,273,273,273,273,273,273,273,273,273,273,273,273,273,273,
273,273,273,273,273,273,273,273,273,273,273,114,114,273,274,272,
272,271,271,271,271,114,272,272,272,114,272,272,272,271,273,114,
114,114,114,114,114,114,114,274,114,114,114,114,114,114,114,114,
273,273,271,271,114,114,275,275,275,275,275,275,275,275,275,275,
276,276,276,276,276,276,114,114,114,277,273,273,273,273,273,273,
/* block 27 */
114,114,278,278,114,279,279,279,279,279,279,279,279,279,279,279,
279,279,279,279,279,279,279,114,114,114,279,279,279,279,279,279,
279,279,279,279,279,279,279,279,279,279,279,279,279,279,279,279,
279,279,114,279,279,279,279,279,279,279,279,279,114,279,114,114,
279,279,279,279,279,279,279,114,114,114,280,114,114,114,114,281,
278,278,280,280,280,114,280,114,278,278,278,278,278,278,278,281,
114,114,114,114,114,114,282,282,282,282,282,282,282,282,282,282,
114,114,278,278,283,114,114,114,114,114,114,114,114,114,114,114,
/* block 28 */
114,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,
284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,
284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,
284,285,284,286,285,285,285,285,285,285,285,114,114,114,114, 5,
284,284,284,284,284,284,287,285,285,285,285,285,285,285,285,288,
289,289,289,289,289,289,289,289,289,289,288,288,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 29 */
114,290,290,114,290,114,114,290,290,114,290,114,114,290,114,114,
114,114,114,114,290,290,290,290,114,290,290,290,290,290,290,290,
114,290,290,290,114,290,114,290,114,114,290,290,114,290,290,290,
290,291,290,292,291,291,291,291,291,291,114,291,291,290,114,114,
290,290,290,290,290,114,293,114,291,291,291,291,291,291,114,114,
294,294,294,294,294,294,294,294,294,294,114,114,290,290,290,290,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 30 */
295,296,296,296,297,297,297,297,297,297,297,297,297,297,297,297,
297,297,297,296,297,296,296,296,298,298,296,296,296,296,296,296,
299,299,299,299,299,299,299,299,299,299,300,300,300,300,300,300,
300,300,300,300,296,298,296,298,296,298,301,302,301,302,303,303,
295,295,295,295,295,295,295,295,114,295,295,295,295,295,295,295,
295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,
295,295,295,295,295,295,295,295,295,295,295,295,295,114,114,114,
114,298,298,298,298,298,298,298,298,298,298,298,298,298,298,303,
/* block 31 */
298,298,298,298,298,297,298,298,295,295,295,295,295,298,298,298,
298,298,298,298,298,298,298,298,114,298,298,298,298,298,298,298,
298,298,298,298,298,298,298,298,298,298,298,298,298,298,298,298,
298,298,298,298,298,298,298,298,298,298,298,298,298,114,296,296,
296,296,296,296,296,296,298,296,296,296,296,296,296,114,296,296,
297,297,297,297,297, 19, 19, 19, 19,297,297,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 32 */
304,304,304,304,304,304,304,304,304,304,304,304,304,304,304,304,
304,304,304,304,304,304,304,304,304,304,304,304,304,304,304,304,
304,304,304,304,304,304,304,304,304,304,304,305,305,306,306,306,
306,307,306,306,306,306,306,306,305,306,306,307,307,306,306,304,
308,308,308,308,308,308,308,308,308,308,309,309,309,309,309,309,
304,304,304,304,304,304,307,307,306,306,304,304,304,304,306,306,
306,304,305,305,305,304,304,305,305,305,305,305,305,305,304,304,
304,306,306,306,306,304,304,304,304,304,304,304,304,304,304,304,
/* block 33 */
304,304,306,305,307,306,306,305,305,305,305,305,305,306,304,305,
308,308,308,308,308,308,308,308,308,308,305,305,305,306,310,310,
311,311,311,311,311,311,311,311,311,311,311,311,311,311,311,311,
311,311,311,311,311,311,311,311,311,311,311,311,311,311,311,311,
311,311,311,311,311,311,114,311,114,114,114,114,114,311,114,114,
312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,
312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,
312,312,312,312,312,312,312,312,312,312,312, 4,313,312,312,312,
/* block 34 */
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,
315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,
/* block 35 */
315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,
315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,
315,315,315,315,315,315,315,315,316,316,316,316,316,316,316,316,
316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,
316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,
316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,
316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,
316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,
/* block 36 */
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
317,317,317,317,317,317,317,317,317,114,317,317,317,317,114,114,
317,317,317,317,317,317,317,114,317,114,317,317,317,317,114,114,
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
/* block 37 */
317,317,317,317,317,317,317,317,317,114,317,317,317,317,114,114,
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
317,114,317,317,317,317,114,114,317,317,317,317,317,317,317,114,
317,114,317,317,317,317,114,114,317,317,317,317,317,317,317,317,
317,317,317,317,317,317,317,114,317,317,317,317,317,317,317,317,
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
/* block 38 */
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
317,114,317,317,317,317,114,114,317,317,317,317,317,317,317,317,
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
317,317,317,317,317,317,317,317,317,317,317,114,114,318,318,318,
319,319,319,319,319,319,319,319,319,320,320,320,320,320,320,320,
320,320,320,320,320,320,320,320,320,320,320,320,320,114,114,114,
/* block 39 */
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
321,321,321,321,321,321,321,321,321,321,114,114,114,114,114,114,
322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,
322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,
322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,
322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,
322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,
322,322,322,322,322,114,114,114,114,114,114,114,114,114,114,114,
/* block 40 */
323,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
/* block 41 */
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
/* block 42 */
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,325,325,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
/* block 43 */
326,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
327,327,327,327,327,327,327,327,327,327,327,328,329,114,114,114,
330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,
330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,
330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,
330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,
330,330,330,330,330,330,330,330,330,330,330, 4, 4, 4,331,331,
331,330,330,330,330,330,330,330,330,114,114,114,114,114,114,114,
/* block 44 */
332,332,332,332,332,332,332,332,332,332,332,332,332,114,332,332,
332,332,333,333,333,114,114,114,114,114,114,114,114,114,114,114,
334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,
334,334,335,335,335, 4, 4,114,114,114,114,114,114,114,114,114,
336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
336,336,337,337,114,114,114,114,114,114,114,114,114,114,114,114,
338,338,338,338,338,338,338,338,338,338,338,338,338,114,338,338,
338,114,339,339,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 45 */
340,340,340,340,340,340,340,340,340,340,340,340,340,340,340,340,
340,340,340,340,340,340,340,340,340,340,340,340,340,340,340,340,
340,340,340,340,340,340,340,340,340,340,340,340,340,340,340,340,
340,340,340,340,341,341,342,341,341,341,341,341,341,341,342,342,
342,342,342,342,342,342,341,342,342,341,341,341,341,341,341,341,
341,341,341,341,343,343,343,344,343,343,343,345,340,341,114,114,
346,346,346,346,346,346,346,346,346,346,114,114,114,114,114,114,
347,347,347,347,347,347,347,347,347,347,114,114,114,114,114,114,
/* block 46 */
348,348, 4, 4,348, 4,349,348,348,348,348,350,350,350,351,114,
352,352,352,352,352,352,352,352,352,352,114,114,114,114,114,114,
353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,
353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,
353,353,353,354,353,353,353,353,353,353,353,353,353,353,353,353,
353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,
353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,
353,353,353,353,353,353,353,353,114,114,114,114,114,114,114,114,
/* block 47 */
353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,
353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,
353,353,353,353,353,353,353,353,353,350,353,114,114,114,114,114,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,
324,324,324,324,324,324,114,114,114,114,114,114,114,114,114,114,
/* block 48 */
355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,
355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,114,
356,356,356,357,357,357,357,356,356,357,357,357,114,114,114,114,
357,357,356,357,357,357,357,357,357,356,356,356,114,114,114,114,
358,114,114,114,359,359,360,360,360,360,360,360,360,360,360,360,
361,361,361,361,361,361,361,361,361,361,361,361,361,361,361,361,
361,361,361,361,361,361,361,361,361,361,361,361,361,361,114,114,
361,361,361,361,361,114,114,114,114,114,114,114,114,114,114,114,
/* block 49 */
362,362,362,362,362,362,362,362,362,362,362,362,362,362,362,362,
362,362,362,362,362,362,362,362,362,362,362,362,362,362,362,362,
362,362,362,362,362,362,362,362,362,362,362,362,114,114,114,114,
363,363,363,363,363,364,364,364,363,363,364,363,363,363,363,363,
363,362,362,362,362,362,362,362,363,363,114,114,114,114,114,114,
365,365,365,365,365,365,365,365,365,365,366,114,114,114,367,367,
368,368,368,368,368,368,368,368,368,368,368,368,368,368,368,368,
368,368,368,368,368,368,368,368,368,368,368,368,368,368,368,368,
/* block 50 */
369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
369,369,369,369,369,369,369,370,370,371,371,370,114,114,372,372,
373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,
373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,
373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,
373,373,373,373,373,374,375,374,375,375,375,375,375,375,375,114,
375,376,375,376,376,375,375,375,375,375,375,375,375,374,374,374,
374,374,374,375,375,375,375,375,375,375,375,375,375,114,114,375,
/* block 51 */
377,377,377,377,377,377,377,377,377,377,114,114,114,114,114,114,
377,377,377,377,377,377,377,377,377,377,114,114,114,114,114,114,
378,378,378,378,378,378,378,379,378,378,378,378,378,378,114,114,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,380,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 52 */
381,381,381,381,382,383,383,383,383,383,383,383,383,383,383,383,
383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,
383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,
383,383,383,383,381,382,381,381,381,381,381,382,381,382,382,382,
382,382,381,382,382,383,383,383,383,383,383,383,114,114,114,114,
384,384,384,384,384,384,384,384,384,384,385,385,385,385,385,385,
385,386,386,386,386,386,386,386,386,386,386,381,381,381,381,381,
381,381,381,381,386,386,386,386,386,386,386,386,386,114,114,114,
/* block 53 */
387,387,388,389,389,389,389,389,389,389,389,389,389,389,389,389,
389,389,389,389,389,389,389,389,389,389,389,389,389,389,389,389,
389,388,387,387,387,387,388,388,387,387,388,387,387,387,389,389,
390,390,390,390,390,390,390,390,390,390,389,389,389,389,389,389,
391,391,391,391,391,391,391,391,391,391,391,391,391,391,391,391,
391,391,391,391,391,391,391,391,391,391,391,391,391,391,391,391,
391,391,391,391,391,391,392,393,392,392,393,393,393,392,393,392,
392,392,393,393,114,114,114,114,114,114,114,114,394,394,394,394,
/* block 54 */
395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,
395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,
395,395,395,395,396,396,396,396,396,396,396,396,397,397,397,397,
397,397,397,397,396,396,397,397,114,114,114,398,398,398,398,398,
399,399,399,399,399,399,399,399,399,399,114,114,114,395,395,395,
400,400,400,400,400,400,400,400,400,400,401,401,401,401,401,401,
401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,
401,401,401,401,401,401,401,401,402,402,402,402,402,402,403,403,
/* block 55 */
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
404,404,404,404,404,404,404,404,114,114,114,114,114,114,114,114,
109,109,109, 4,109,109,109,109,109,109,109,109,109,109,109,109,
109,405,109,109,109,109,109,109,109,406,406,406,406,109,406,406,
406,406,405,405,109,406,406,114,109,109,114,114,114,114,114,114,
/* block 56 */
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33,122,122,122,122,122,407,106,106,106,106,
106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
106,106,106,106,106,106,106,106,106,106,106,106,106,115,115,115,
115,115,106,106,106,106,115,115,115,115,115, 33, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33,408,409, 33, 33, 33,410, 33, 33,
/* block 57 */
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,106,106,106,106,106,
106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,115,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,114,114,114,114,114,114,109,109,109,109,
/* block 58 */
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
411,412, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
/* block 59 */
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 33, 33, 33, 33, 33,413, 33, 33,414, 33,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
/* block 60 */
415,415,415,415,415,415,415,415,416,416,416,416,416,416,416,416,
415,415,415,415,415,415,114,114,416,416,416,416,416,416,114,114,
415,415,415,415,415,415,415,415,416,416,416,416,416,416,416,416,
415,415,415,415,415,415,415,415,416,416,416,416,416,416,416,416,
415,415,415,415,415,415,114,114,416,416,416,416,416,416,114,114,
122,415,122,415,122,415,122,415,114,416,114,416,114,416,114,416,
415,415,415,415,415,415,415,415,416,416,416,416,416,416,416,416,
417,417,418,418,418,418,419,419,420,420,421,421,422,422,114,114,
/* block 61 */
415,415,415,415,415,415,415,415,423,423,423,423,423,423,423,423,
415,415,415,415,415,415,415,415,423,423,423,423,423,423,423,423,
415,415,415,415,415,415,415,415,423,423,423,423,423,423,423,423,
415,415,122,424,122,114,122,122,416,416,425,425,426,113,427,113,
113,113,122,424,122,114,122,122,428,428,428,428,426,113,113,113,
415,415,122,122,114,114,122,122,416,416,429,429,114,113,113,113,
415,415,122,122,122,163,122,122,416,416,430,430,168,113,113,113,
114,114,122,424,122,114,122,122,431,431,432,432,426,113,113,114,
/* block 62 */
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 22,433,433, 22, 22,
9, 9, 9, 9, 9, 9, 4, 4, 21, 25, 6, 21, 21, 25, 6, 21,
4, 4, 4, 4, 4, 4, 4, 4,434,435, 22, 22, 22, 22, 22, 3,
4, 4, 4, 4, 4, 4, 4, 4, 4, 21, 25, 4, 4, 4, 4, 15,
15, 4, 4, 4, 8, 6, 7, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 8, 4, 15, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3,
22, 22, 22, 22, 22,436, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
23,106,114,114, 23, 23, 23, 23, 23, 23, 8, 8, 8, 6, 7,106,
/* block 63 */
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 8, 8, 8, 6, 7,114,
106,106,106,106,106,106,106,106,106,106,106,106,106,114,114,114,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
109,109,109,109,109,109,109,109,109,109,109,109,109,380,380,380,
380,109,380,380,380,109,109,109,109,109,109,109,109,109,109,109,
109,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 64 */
19, 19,437, 19, 19, 19, 19,437, 19, 19,438,437,437,437,438,438,
437,437,437,438, 19,437, 19, 19, 8,437,437,437,437,437, 19, 19,
19, 19, 19, 19,437, 19,439, 19,437, 19,440,441,437,437, 19,438,
437,437,442,437,438,406,406,406,406,438, 19, 19,438,438,437,437,
8, 8, 8, 8, 8,437,438,438,438,438, 19, 8, 19, 19,443, 19,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
444,444,444,444,444,444,444,444,444,444,444,444,444,444,444,444,
445,445,445,445,445,445,445,445,445,445,445,445,445,445,445,445,
/* block 65 */
446,446,446, 30, 31,446,446,446,446, 23,114,114,114,114,114,114,
8, 8, 8, 8, 8, 19, 19, 19, 19, 19, 8, 8, 19, 19, 19, 19,
8, 19, 19, 8, 19, 19, 8, 19, 19, 19, 19, 19, 19, 19, 8, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 8, 8,
19, 19, 8, 19, 8, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
/* block 66 */
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
/* block 67 */
19, 19, 19, 19, 19, 19, 19, 19, 6, 7, 6, 7, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
8, 8, 19, 19, 19, 19, 19, 19, 19, 6, 7, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 8, 19, 19, 19,
/* block 68 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 8, 8, 8, 8,
8, 8, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,
/* block 69 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
/* block 70 */
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19,447,447,447,447,447,447,447,447,447,447,
447,447,447,447,447,447,447,447,447,447,447,447,447,447,447,447,
448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,
448,448,448,448,448,448,448,448,448,448, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
/* block 71 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
/* block 72 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 8, 19, 19, 19, 19, 19, 19, 19, 19,
19, 8, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 8, 8, 8, 8, 8, 8, 8, 8,
/* block 73 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 8,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
/* block 74 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 6, 7, 6, 7, 6, 7, 6, 7,
6, 7, 6, 7, 6, 7, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
/* block 75 */
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
8, 8, 8, 8, 8, 6, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
/* block 76 */
449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,
449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,
449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,
449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,
449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,
449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,
449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,
449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,
/* block 77 */
8, 8, 8, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6,
7, 6, 7, 6, 7, 6, 7, 6, 7, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 6, 7, 6, 7, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 6, 7, 8, 8,
/* block 78 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 19, 19, 8, 8, 8, 8, 8, 8, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19,114,114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
/* block 79 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19,114,114, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19,114, 19, 19, 19, 19, 19, 19,
19, 19,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 80 */
450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,
450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,
450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,114,
451,451,451,451,451,451,451,451,451,451,451,451,451,451,451,451,
451,451,451,451,451,451,451,451,451,451,451,451,451,451,451,451,
451,451,451,451,451,451,451,451,451,451,451,451,451,451,451,114,
30, 31,452,453,454,455,456, 30, 31, 30, 31, 30, 31,457,458,459,
460, 33, 30, 31, 33, 30, 31, 33, 33, 33, 33, 33,106,106,461,461,
/* block 81 */
159,160,159,160,159,160,159,160,159,160,159,160,159,160,159,160,
159,160,159,160,159,160,159,160,159,160,159,160,159,160,159,160,
159,160,159,160,159,160,159,160,159,160,159,160,159,160,159,160,
159,160,159,160,159,160,159,160,159,160,159,160,159,160,159,160,
159,160,159,160,159,160,159,160,159,160,159,160,159,160,159,160,
159,160,159,160,159,160,159,160,159,160,159,160,159,160,159,160,
159,160,159,160,462,463,463,463,463,463,463,159,160,159,160,464,
464,464,159,160,114,114,114,114,114,465,465,465,465,466,465,465,
/* block 82 */
467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
467,467,467,467,467,467,114,467,114,114,114,114,114,467,114,114,
468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,
468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,
468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,
468,468,468,468,468,468,468,468,114,114,114,114,114,114,114,469,
470,114,114,114,114,114,114,114,114,114,114,114,114,114,114,471,
/* block 83 */
317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
317,317,317,317,317,317,317,114,114,114,114,114,114,114,114,114,
317,317,317,317,317,317,317,114,317,317,317,317,317,317,317,114,
317,317,317,317,317,317,317,114,317,317,317,317,317,317,317,114,
317,317,317,317,317,317,317,114,317,317,317,317,317,317,317,114,
317,317,317,317,317,317,317,114,317,317,317,317,317,317,317,114,
177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,
/* block 84 */
4, 4, 21, 25, 21, 25, 4, 4, 4, 21, 25, 4, 21, 25, 4, 4,
4, 4, 4, 4, 4, 4, 4, 9, 4, 4, 9, 4, 21, 25, 4, 4,
21, 25, 6, 7, 6, 7, 6, 7, 6, 7, 4, 4, 4, 4, 4,107,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 9, 9, 4, 4, 4, 4,
9, 4, 6,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 85 */
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,114,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 86 */
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
/* block 87 */
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,
/* block 88 */
3, 4, 4, 4, 19,473,406,474, 6, 7, 6, 7, 6, 7, 6, 7,
6, 7, 19, 19, 6, 7, 6, 7, 6, 7, 6, 7, 9, 6, 7, 7,
19,474,474,474,474,474,474,474,474,474,109,109,109,109,475,475,
9,107,107,107,107,107, 19, 19,474,474,474,473,406, 4, 19, 19,
114,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,
476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,
476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,
476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,
/* block 89 */
476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,
476,476,476,476,476,476,476,114,114,109,109, 14, 14,477,477,476,
9,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,
478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,
478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,
478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,
478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,
478,478,478,478,478,478,478,478,478,478,478, 4,107,479,479,478,
/* block 90 */
114,114,114,114,114,480,480,480,480,480,480,480,480,480,480,480,
480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,
480,480,480,480,480,480,480,480,480,480,480,480,480,480,114,114,
114,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,
481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,
481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,
481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,
481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,
/* block 91 */
481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,114,
19, 19, 23, 23, 23, 23, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,
480,480,480,480,480,480,480,480,480,480,480,114,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19,114,114,114,114,114,114,114,114,114,114,114,114,
478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,
/* block 92 */
482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,
482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,114,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 23, 23, 23, 23, 23, 23, 23, 23,
19, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,
482,482,482,482,482,482,482,482,482,482,482,482,482,482,482, 19,
/* block 93 */
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,
483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,
483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,114,
/* block 94 */
483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,
483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,
483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,
483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,
483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,
483,483,483,483,483,483,483,483, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
/* block 95 */
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
/* block 96 */
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,114,114,114,114,114,114,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
/* block 97 */
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 98 */
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,486,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
/* block 99 */
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
/* block 100 */
485,485,485,485,485,485,485,485,485,485,485,485,485,114,114,114,
487,487,487,487,487,487,487,487,487,487,487,487,487,487,487,487,
487,487,487,487,487,487,487,487,487,487,487,487,487,487,487,487,
487,487,487,487,487,487,487,487,487,487,487,487,487,487,487,487,
487,487,487,487,487,487,487,114,114,114,114,114,114,114,114,114,
488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,
488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,
488,488,488,488,488,488,488,488,489,489,489,489,489,489,490,490,
/* block 101 */
491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,
491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,
491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,
491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,
491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,
491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,
491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,
491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,
/* block 102 */
491,491,491,491,491,491,491,491,491,491,491,491,492,493,493,493,
491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,
494,494,494,494,494,494,494,494,494,494,491,491,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175,
174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175,
174,175,174,175,174,175,174,175,174,175,174,175,174,175,495,177,
178,178,178,496,177,177,177,177,177,177,177,177,177,177,496,408,
/* block 103 */
174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175,
174,175,174,175,174,175,174,175,174,175,174,175,408,408,114,177,
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
497,497,497,497,497,497,498,498,498,498,498,498,498,498,498,498,
499,499,500,500,500,500,500,500,114,114,114,114,114,114,114,114,
/* block 104 */
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14,107,107,107,107,107,107,107,107,107,
14, 14, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
33, 33, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
106, 33, 33, 33, 33, 33, 33, 33, 33, 30, 31, 30, 31,501, 30, 31,
/* block 105 */
30, 31, 30, 31, 30, 31, 30, 31,107, 14, 14, 30, 31,502, 33,114,
30, 31, 30, 31, 33, 33, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31,503,504,505,506,114,114,
507,508,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114, 20,106,106, 33, 20, 20, 20, 20, 20,
/* block 106 */
509,509,510,509,509,509,510,509,509,509,509,510,509,509,509,509,
509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,
509,509,509,511,511,510,510,511,512,512,512,512,114,114,114,114,
23, 23, 23, 23, 23, 23, 19, 19, 5, 19,114,114,114,114,114,114,
513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
513,513,513,513,514,514,514,514,114,114,114,114,114,114,114,114,
/* block 107 */
515,515,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
516,516,516,516,515,515,515,515,515,515,515,515,515,515,515,515,
515,515,515,515,517,114,114,114,114,114,114,114,114,114,518,518,
519,519,519,519,519,519,519,519,519,519,114,114,114,114,114,114,
221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
221,221,223,223,223,223,223,223,225,225,225,223,114,114,114,114,
/* block 108 */
520,520,520,520,520,520,520,520,520,520,521,521,521,521,521,521,
521,521,521,521,521,521,521,521,521,521,521,521,521,521,521,521,
521,521,521,521,521,521,522,522,522,522,522,522,522,522, 4,523,
524,524,524,524,524,524,524,524,524,524,524,524,524,524,524,524,
524,524,524,524,524,524,524,525,525,525,525,525,525,525,525,525,
525,525,526,526,114,114,114,114,114,114,114,114,114,114,114,527,
314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
314,314,314,314,314,314,314,314,314,314,314,314,314,114,114,114,
/* block 109 */
528,528,528,529,530,530,530,530,530,530,530,530,530,530,530,530,
530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
530,530,530,528,529,529,528,528,528,528,529,529,528,529,529,529,
529,531,531,531,531,531,531,531,531,531,531,531,531,531,114,107,
532,532,532,532,532,532,532,532,532,532,114,114,114,114,531,531,
304,304,304,304,304,306,533,304,304,304,304,304,304,304,304,304,
308,308,308,308,308,308,308,308,308,308,304,304,304,304,304,114,
/* block 110 */
534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,
534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,
534,534,534,534,534,534,534,534,534,535,535,535,535,535,535,536,
536,535,535,536,536,535,535,114,114,114,114,114,114,114,114,114,
534,534,534,535,534,534,534,534,534,534,534,534,535,536,114,114,
537,537,537,537,537,537,537,537,537,537,114,114,538,538,538,538,
304,304,304,304,304,304,304,304,304,304,304,304,304,304,304,304,
533,304,304,304,304,304,304,310,310,310,304,305,306,305,304,304,
/* block 111 */
539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
540,539,540,540,540,539,539,540,540,539,539,539,539,539,540,540,
539,540,539,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,539,539,541,542,542,
543,543,543,543,543,543,543,543,543,543,543,544,545,545,544,544,
546,546,543,547,547,544,545,114,114,114,114,114,114,114,114,114,
/* block 112 */
114,317,317,317,317,317,317,114,114,317,317,317,317,317,317,114,
114,317,317,317,317,317,317,114,114,114,114,114,114,114,114,114,
317,317,317,317,317,317,317,114,317,317,317,317,317,317,317,114,
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 14,106,106,106,106,
114,114,114,114, 33,122,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 113 */
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
543,543,543,544,544,545,544,544,545,544,544,546,544,545,114,114,
548,548,548,548,548,548,548,548,548,548,114,114,114,114,114,114,
/* block 114 */
549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
/* block 115 */
550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550,
/* block 116 */
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
/* block 117 */
550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550,
/* block 118 */
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
/* block 119 */
550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550,
/* block 120 */
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
/* block 121 */
550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550,
550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
550,550,550,550,114,114,114,114,114,114,114,114,114,114,114,114,
315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,
315,315,315,315,315,315,315,114,114,114,114,316,316,316,316,316,
316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,
316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,
316,316,316,316,316,316,316,316,316,316,316,316,114,114,114,114,
/* block 122 */
551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,
551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,
551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,
551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,
551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,
551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,
551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,
551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,
/* block 123 */
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
/* block 124 */
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,114,114,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
/* block 125 */
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 126 */
33, 33, 33, 33, 33, 33, 33,114,114,114,114,114,114,114,114,114,
114,114,114,185,185,185,185,185,114,114,114,114,114,192,189,192,
192,192,192,192,192,192,192,192,192,553,192,192,192,192,192,192,
192,192,192,192,192,192,192,114,192,192,192,192,192,114,192,114,
192,192,114,192,192,114,192,192,192,192,192,192,192,192,192,192,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
/* block 127 */
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
554,554,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
/* block 128 */
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
/* block 129 */
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199, 7, 6,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
/* block 130 */
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
114,114,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
199,199,199,199,199,199,199,199,199,199,199,199,196,197,114,114,
/* block 131 */
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
4, 4, 4, 4, 4, 4, 4, 6, 7, 4,114,114,114,114,114,114,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,114,114,
4, 9, 9, 15, 15, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6,
7, 6, 7, 6, 7, 4, 4, 6, 7, 4, 4, 4, 4, 15, 15, 15,
4, 4, 4,114, 4, 4, 4, 4, 9, 6, 7, 6, 7, 6, 7, 4,
4, 4, 8, 9, 8, 8, 8,114, 4, 5, 4, 4,114,114,114,114,
199,199,199,199,199,114,199,199,199,199,199,199,199,199,199,199,
/* block 132 */
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,114,114, 22,
/* block 133 */
114, 4, 4, 4, 5, 4, 4, 4, 6, 7, 4, 8, 4, 9, 4, 4,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 4, 4, 8, 8, 8, 4,
4, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 6, 4, 7, 14, 15,
14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 6, 8, 7, 8, 6,
7, 4, 6, 7, 4, 4,478,478,478,478,478,478,478,478,478,478,
107,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,
/* block 134 */
478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,
478,478,478,478,478,478,478,478,478,478,478,478,478,478,555,555,
481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,
481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,114,
114,114,481,481,481,481,481,481,114,114,481,481,481,481,481,481,
114,114,481,481,481,481,481,481,114,114,481,481,481,114,114,114,
5, 5, 8, 14, 19, 5, 5,114, 19, 8, 8, 8, 8, 19, 19,114,
436,436,436,436,436,436,436,436,436, 22, 22, 22, 19, 19,114,114,
/* block 135 */
556,556,556,556,556,556,556,556,556,556,556,556,114,556,556,556,
556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
556,556,556,556,556,556,556,114,556,556,556,556,556,556,556,556,
556,556,556,556,556,556,556,556,556,556,556,114,556,556,114,556,
556,556,556,556,556,556,556,556,556,556,556,556,556,556,114,114,
556,556,556,556,556,556,556,556,556,556,556,556,556,556,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 136 */
556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
556,556,556,556,556,556,556,556,556,556,556,114,114,114,114,114,
/* block 137 */
4, 4, 4,114,114,114,114, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23,114,114,114, 19, 19, 19, 19, 19, 19, 19, 19, 19,
557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
557,557,557,557,557,558,558,558,558,559,559,559,559,559,559,559,
/* block 138 */
559,559,559,559,559,559,559,559,559,559,558,558,559,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,
559,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,114,114,
/* block 139 */
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 140 */
560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,
560,560,560,560,560,560,560,560,560,560,560,560,560,114,114,114,
561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,
561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,
561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,
561,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
109, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,114,114,114,114,
/* block 141 */
562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,
562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,
563,563,563,563,114,114,114,114,114,114,114,114,114,114,114,114,
564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
564,565,564,564,564,564,564,564,564,564,565,114,114,114,114,114,
566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,
566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,
566,566,566,566,566,566,567,567,567,567,567,114,114,114,114,114,
/* block 142 */
568,568,568,568,568,568,568,568,568,568,568,568,568,568,568,568,
568,568,568,568,568,568,568,568,568,568,568,568,568,568,114,569,
570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,
570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,
570,570,570,570,114,114,114,114,570,570,570,570,570,570,570,570,
571,572,572,572,572,572,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 143 */
573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
573,573,573,573,573,573,573,573,574,574,574,574,574,574,574,574,
574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,
574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,
575,575,575,575,575,575,575,575,575,575,575,575,575,575,575,575,
575,575,575,575,575,575,575,575,575,575,575,575,575,575,575,575,
575,575,575,575,575,575,575,575,575,575,575,575,575,575,575,575,
/* block 144 */
576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,
576,576,576,576,576,576,576,576,576,576,576,576,576,576,114,114,
577,577,577,577,577,577,577,577,577,577,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 145 */
578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
578,578,578,578,578,578,578,578,114,114,114,114,114,114,114,114,
579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,
579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,
579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,
579,579,579,579,114,114,114,114,114,114,114,114,114,114,114,580,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 146 */
581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
/* block 147 */
581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
581,581,581,581,581,581,581,114,114,114,114,114,114,114,114,114,
581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
581,581,581,581,581,581,114,114,114,114,114,114,114,114,114,114,
581,581,581,581,581,581,581,581,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 148 */
582,582,582,582,582,582,114,114,582,114,582,582,582,582,582,582,
582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,
582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,
582,582,582,582,582,582,114,582,582,114,114,114,582,114,114,582,
583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,
583,583,583,583,583,583,114,584,585,585,585,585,585,585,585,585,
586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
586,586,586,586,586,586,586,587,587,588,588,588,588,588,588,588,
/* block 149 */
589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,114,
114,114,114,114,114,114,114,590,590,590,590,590,590,590,590,590,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 150 */
591,591,591,591,591,591,591,591,591,591,591,591,591,591,591,591,
591,591,591,591,591,591,592,592,592,592,592,592,114,114,114,593,
594,594,594,594,594,594,594,594,594,594,594,594,594,594,594,594,
594,594,594,594,594,594,594,594,594,594,114,114,114,114,114,595,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 151 */
596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,
596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,
597,597,597,597,597,597,597,597,597,597,597,597,597,597,597,597,
597,597,597,597,597,597,597,597,114,114,114,114,114,114,597,597,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 152 */
598,599,599,599,114,599,599,114,114,114,114,114,599,599,599,599,
598,598,598,598,114,598,598,598,114,598,598,598,598,598,598,598,
598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,
598,598,598,598,114,114,114,114,599,599,599,114,114,114,114,599,
600,600,600,600,600,600,600,600,114,114,114,114,114,114,114,114,
601,601,601,601,601,601,601,601,601,114,114,114,114,114,114,114,
602,602,602,602,602,602,602,602,602,602,602,602,602,602,602,602,
602,602,602,602,602,602,602,602,602,602,602,602,602,603,603,604,
/* block 153 */
605,605,605,605,605,605,605,605,605,605,605,605,605,605,605,605,
605,605,605,605,605,605,605,605,605,605,605,605,605,606,606,606,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
607,607,607,607,607,607,607,607,608,607,607,607,607,607,607,607,
607,607,607,607,607,607,607,607,607,607,607,607,607,607,607,607,
607,607,607,607,607,609,609,114,114,114,114,610,610,610,610,610,
611,611,611,611,611,611,611,114,114,114,114,114,114,114,114,114,
/* block 154 */
612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,
612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,
612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,
612,612,612,612,612,612,114,114,114,613,613,613,613,613,613,613,
614,614,614,614,614,614,614,614,614,614,614,614,614,614,614,614,
614,614,614,614,614,614,114,114,615,615,615,615,615,615,615,615,
616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
616,616,616,114,114,114,114,114,617,617,617,617,617,617,617,617,
/* block 155 */
618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,
618,618,114,114,114,114,114,114,114,619,619,619,619,114,114,114,
114,114,114,114,114,114,114,114,114,620,620,620,620,620,620,620,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 156 */
621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,
621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,
621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,
621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,
621,621,621,621,621,621,621,621,621,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 157 */
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
622,622,622,622,622,622,622,622,622,622,622,622,622,622,622,622,
622,622,622,622,622,622,622,622,622,622,622,622,622,622,622,114,
/* block 158 */
623,624,623,625,625,625,625,625,625,625,625,625,625,625,625,625,
625,625,625,625,625,625,625,625,625,625,625,625,625,625,625,625,
625,625,625,625,625,625,625,625,625,625,625,625,625,625,625,625,
625,625,625,625,625,625,625,625,624,624,624,624,624,624,624,624,
624,624,624,624,624,624,624,626,626,626,626,626,626,626,114,114,
114,114,627,627,627,627,627,627,627,627,627,627,627,627,627,627,
627,627,627,627,627,627,628,628,628,628,628,628,628,628,628,628,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,624,
/* block 159 */
629,629,630,631,631,631,631,631,631,631,631,631,631,631,631,631,
631,631,631,631,631,631,631,631,631,631,631,631,631,631,631,631,
631,631,631,631,631,631,631,631,631,631,631,631,631,631,631,631,
630,630,630,629,629,629,629,630,630,629,629,632,632,633,632,632,
632,632,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
634,634,634,634,634,634,634,634,634,634,634,634,634,634,634,634,
634,634,634,634,634,634,634,634,634,114,114,114,114,114,114,114,
635,635,635,635,635,635,635,635,635,635,114,114,114,114,114,114,
/* block 160 */
636,636,636,637,637,637,637,637,637,637,637,637,637,637,637,637,
637,637,637,637,637,637,637,637,637,637,637,637,637,637,637,637,
637,637,637,637,637,637,637,636,636,636,636,636,638,636,636,636,
636,636,636,636,636,114,639,639,639,639,639,639,639,639,639,639,
640,640,640,640,114,114,114,114,114,114,114,114,114,114,114,114,
641,641,641,641,641,641,641,641,641,641,641,641,641,641,641,641,
641,641,641,641,641,641,641,641,641,641,641,641,641,641,641,641,
641,641,641,642,643,643,641,114,114,114,114,114,114,114,114,114,
/* block 161 */
644,644,645,646,646,646,646,646,646,646,646,646,646,646,646,646,
646,646,646,646,646,646,646,646,646,646,646,646,646,646,646,646,
646,646,646,646,646,646,646,646,646,646,646,646,646,646,646,646,
646,646,646,645,645,645,644,644,644,644,644,644,644,644,644,645,
645,646,646,646,646,647,647,647,647,114,114,114,114,647,114,114,
648,648,648,648,648,648,648,648,648,648,646,114,114,114,114,114,
114,649,649,649,649,649,649,649,649,649,649,649,649,649,649,649,
649,649,649,649,649,114,114,114,114,114,114,114,114,114,114,114,
/* block 162 */
650,650,650,650,650,650,650,650,650,650,650,650,650,650,650,650,
650,650,114,650,650,650,650,650,650,650,650,650,650,650,650,650,
650,650,650,650,650,650,650,650,650,650,650,650,651,651,651,652,
652,652,651,651,652,651,652,652,653,653,653,653,653,653,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 163 */
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,
654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,
654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,655,
656,656,656,655,655,655,655,655,655,655,655,114,114,114,114,114,
657,657,657,657,657,657,657,657,657,657,114,114,114,114,114,114,
/* block 164 */
114,658,659,659,114,660,660,660,660,660,660,660,660,114,114,660,
660,114,114,660,660,660,660,660,660,660,660,660,660,660,660,660,
660,660,660,660,660,660,660,660,660,114,660,660,660,660,660,660,
660,114,660,660,114,660,660,660,660,660,114,114,658,660,661,659,
658,659,659,659,659,114,114,659,659,114,114,659,659,659,114,114,
114,114,114,114,114,114,114,661,114,114,114,114,114,660,660,660,
660,660,659,659,114,114,658,658,658,658,658,658,658,114,114,114,
658,658,658,658,658,114,114,114,114,114,114,114,114,114,114,114,
/* block 165 */
662,662,662,662,662,662,662,662,662,662,662,662,662,662,662,662,
662,662,662,662,662,662,662,662,662,662,662,662,662,662,662,662,
662,662,662,662,662,662,662,662,662,662,662,662,662,662,662,662,
663,664,664,665,665,665,665,665,665,664,665,664,664,663,664,665,
665,664,665,665,662,662,666,662,114,114,114,114,114,114,114,114,
667,667,667,667,667,667,667,667,667,667,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 166 */
668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,
668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,
668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,669,
670,670,671,671,671,671,114,114,670,670,670,670,671,671,670,671,
671,672,672,672,672,672,672,672,672,672,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 167 */
673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,
673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,
673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,
674,674,674,675,675,675,675,675,675,675,675,674,674,675,674,675,
675,676,676,676,673,114,114,114,114,114,114,114,114,114,114,114,
677,677,677,677,677,677,677,677,677,677,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 168 */
678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,
678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,
678,678,678,678,678,678,678,678,678,678,678,679,680,679,680,680,
679,679,679,679,679,679,680,679,114,114,114,114,114,114,114,114,
681,681,681,681,681,681,681,681,681,681,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 169 */
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,
682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,
683,683,683,683,683,683,683,683,683,683,683,683,683,683,683,683,
683,683,683,683,683,683,683,683,683,683,683,683,683,683,683,683,
684,684,684,684,684,684,684,684,684,684,685,685,685,685,685,685,
685,685,685,114,114,114,114,114,114,114,114,114,114,114,114,686,
/* block 170 */
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,
687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,
687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,
687,687,687,687,687,687,687,687,687,114,114,114,114,114,114,114,
/* block 171 */
688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,
688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,
688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,
688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,
688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,
688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,
688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,
688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,
/* block 172 */
688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,
688,688,688,688,688,688,688,688,688,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 173 */
689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,
689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,
689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,
689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,
689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,
689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,
689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,114,
690,690,690,690,690,114,114,114,114,114,114,114,114,114,114,114,
/* block 174 */
691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
/* block 175 */
691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 176 */
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
/* block 177 */
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,
497,497,497,497,497,497,497,497,497,114,114,114,114,114,114,114,
692,692,692,692,692,692,692,692,692,692,692,692,692,692,692,692,
692,692,692,692,692,692,692,692,692,692,692,692,692,692,692,114,
693,693,693,693,693,693,693,693,693,693,114,114,114,114,694,694,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 178 */
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,
695,695,695,695,695,695,695,695,695,695,695,695,695,695,114,114,
696,696,696,696,696,697,114,114,114,114,114,114,114,114,114,114,
/* block 179 */
698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,
698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,
698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,
699,699,699,699,699,699,699,700,700,700,700,700,701,701,701,701,
702,702,702,702,700,701,114,114,114,114,114,114,114,114,114,114,
703,703,703,703,703,703,703,703,703,703,114,704,704,704,704,704,
704,704,114,698,698,698,698,698,698,698,698,698,698,698,698,698,
698,698,698,698,698,698,698,698,114,114,114,114,114,698,698,698,
/* block 180 */
698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 181 */
705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,
705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,
705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,
705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,
705,705,705,705,705,114,114,114,114,114,114,114,114,114,114,114,
705,706,706,706,706,706,706,706,706,706,706,706,706,706,706,706,
706,706,706,706,706,706,706,706,706,706,706,706,706,706,706,706,
706,706,706,706,706,706,706,706,706,706,706,706,706,706,706,114,
/* block 182 */
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,707,
707,707,707,708,708,708,708,708,708,708,708,708,708,708,708,708,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 183 */
478,476,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 184 */
709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,
709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,
709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,
709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,
709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,
709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,
709,709,709,709,709,709,709,709,709,709,709,114,114,114,114,114,
709,709,709,709,709,709,709,709,709,709,709,709,709,114,114,114,
/* block 185 */
709,709,709,709,709,709,709,709,709,114,114,114,114,114,114,114,
709,709,709,709,709,709,709,709,709,709,114,114,710,711,711,712,
22, 22, 22, 22,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 186 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114,114,114,
/* block 187 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19,114,114, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19,713,405,109,109,109, 19, 19, 19,405,713,713,
713,713,713, 22, 22, 22, 22, 22, 22, 22, 22,109,109,109,109,109,
/* block 188 */
109,109,109, 19, 19,109,109,109,109,109,109,109, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109,109,109, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 189 */
559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,
559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,
559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,
559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,
559,559,714,714,714,559,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 190 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114,114,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 191 */
437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
437,437,437,437,437,437,437,437,437,437,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
438,438,438,438,437,437,437,437,437,437,437,437,437,437,437,437,
437,437,437,437,437,437,437,437,437,437,437,437,437,437,438,438,
438,438,438,438,438,114,438,438,438,438,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,437,437,437,437,437,437,437,437,
437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
/* block 192 */
437,437,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,438,438,438,438,437,114,437,437,
114,114,437,114,114,437,437,114,114,437,437,437,437,114,437,437,
437,437,437,437,437,437,438,438,438,438,114,438,114,438,438,438,
438,438,438,438,114,438,438,438,438,438,438,438,438,438,438,438,
437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
437,437,437,437,437,437,437,437,437,437,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
/* block 193 */
438,438,438,438,437,437,114,437,437,437,437,114,114,437,437,437,
437,437,437,437,437,114,437,437,437,437,437,437,437,114,438,438,
438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,437,437,114,437,437,437,437,114,
437,437,437,437,437,114,437,114,114,114,437,437,437,437,437,437,
437,114,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,438,438,438,438,437,437,437,437,
437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
/* block 194 */
437,437,437,437,437,437,438,438,438,438,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
437,437,437,437,437,437,437,437,437,437,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
438,438,438,438,437,437,437,437,437,437,437,437,437,437,437,437,
437,437,437,437,437,437,437,437,437,437,437,437,437,437,438,438,
438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
/* block 195 */
438,438,438,438,438,438,438,438,437,437,437,437,437,437,437,437,
437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
437,437,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,438,438,438,438,437,437,437,437,
437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
437,437,437,437,437,437,438,438,438,438,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
/* block 196 */
437,437,437,437,437,437,437,437,437,437,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
438,438,438,438,438,438,114,114,437,437,437,437,437,437,437,437,
437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
437, 8,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,438,438,438, 8,438,438,438,438,
438,438,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
437,437,437,437,437,437,437,437,437,437,437, 8,438,438,438,438,
/* block 197 */
438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
438,438,438,438,438, 8,438,438,438,438,438,438,437,437,437,437,
437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
437,437,437,437,437, 8,438,438,438,438,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, 8,
438,438,438,438,438,438,437,437,437,437,437,437,437,437,437,437,
437,437,437,437,437,437,437,437,437,437,437,437,437,437,437, 8,
438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
/* block 198 */
438,438,438,438,438,438,438,438,438, 8,438,438,438,438,438,438,
437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
437,437,437,437,437,437,437,437,437, 8,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
438,438,438, 8,438,438,438,438,438,438,437,438,114,114, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
/* block 199 */
715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
/* block 200 */
715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
715,715,715,715,715,114,114,716,716,716,716,716,716,716,716,716,
717,717,717,717,717,717,717,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 201 */
199,199,199,199,114,199,199,199,199,199,199,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,
114,199,199,114,199,114,114,199,114,199,199,199,199,199,199,199,
199,199,199,114,199,199,199,199,114,199,114,199,114,114,114,114,
114,114,199,114,114,114,114,199,114,199,114,199,114,199,199,199,
114,199,199,114,199,114,114,199,114,199,114,199,114,199,114,199,
114,199,199,114,199,114,114,199,199,199,199,114,199,199,199,199,
199,199,199,114,199,199,199,199,114,199,199,199,199,114,199,114,
/* block 202 */
199,199,199,199,199,199,199,199,199,199,114,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,114,114,114,114,
114,199,199,199,114,199,199,199,199,199,114,199,199,199,199,199,
199,199,199,199,199,199,199,199,199,199,199,199,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
194,194,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 203 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
/* block 204 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19,114,114,114,114,114,114,114,114,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,
114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114,114,114,
/* block 205 */
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
/* block 206 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,718,718,718,718,718,718,718,718,718,718,
718,718,718,718,718,718,718,718,718,718,718,718,718,718,718,718,
/* block 207 */
719, 19, 19,114,114,114,114,114,114,114,114,114,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,
19, 19,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 208 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,
/* block 209 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,
114,114,114,114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114,
/* block 210 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,
/* block 211 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114, 19, 19, 19, 19, 19,
/* block 212 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19,114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
/* block 213 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19,114,114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
/* block 214 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,
19, 19, 19, 19,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 215 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 216 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 217 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
/* block 218 */
19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 219 */
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 220 */
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,114,114,114,114,114,114,114,114,114,114,114,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
/* block 221 */
484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
484,484,484,484,484,484,484,484,484,484,484,484,484,484,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,
/* block 222 */
436, 22,436,436,436,436,436,436,436,436,436,436,436,436,436,436,
436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
/* block 223 */
436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,
436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,
436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,
436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,
436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,
436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,
436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,
436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,
/* block 224 */
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 225 */
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,
/* block 226 */
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
552,552,552,552,552,552,552,552,552,552,552,552,552,552,114,114,
};
#if UCD_BLOCK_SIZE != 128
#error Please correct UCD_BLOCK_SIZE in pcre_internal.h
#endif
#endif /* SUPPORT_UCP */
#endif /* PCRE_INCLUDED */
|
d9eb3b87dfb473ae557d35ff06e7b6dd9c86e9a5
|
db229415713a206a848429321e19006b212d20d5
|
/test/x86/avx512/packs.c
|
897bc56c9e498f873ea7ced7d03a8a8abd2edf48
|
[
"MIT",
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] |
permissive
|
simd-everywhere/simde
|
66dd029cbd0b3814b0377c72d953f223d38e7e53
|
4d55fc25bcfddc0e2f0c744448557a070dd310c9
|
refs/heads/master
| 2023-09-04T12:55:25.455223
| 2023-08-18T12:46:56
| 2023-08-18T14:53:06
| 86,497,800
| 1,570
| 173
|
MIT
| 2023-09-07T13:41:28
| 2017-03-28T19:14:32
|
C
|
UTF-8
|
C
| false
| false
| 31,746
|
c
|
packs.c
|
/* SPDX-License-Identifier: MIT
*
* 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.
*
* Copyright:
* 2020 Evan Nemerson <evan@nemerson.com>
* 2020 Hidayat Khan <huk2209@gmail.com>
*/
#define SIMDE_TEST_X86_AVX512_INSN packs
#include <test/x86/avx512/test-avx512.h>
#include <simde/x86/avx512/packs.h>
static int
test_simde_mm512_packs_epi16 (SIMDE_MUNIT_TEST_ARGS) {
static const struct {
const int16_t a[32];
const int16_t b[32];
const int8_t r[64];
} test_vec[] = {
{ { INT16_C( 148), INT16_C( 89), INT16_C( 44), INT16_C( 120), INT16_C( 172), INT16_C( 95), INT16_C( 152), INT16_C( 63),
INT16_C( 158), INT16_C( 87), INT16_C( 102), INT16_C( 236), INT16_C( 153), INT16_C( 222), INT16_C( 143), INT16_C( 196),
INT16_C( 171), INT16_C( 232), INT16_C( 34), INT16_C( 217), INT16_C( 125), INT16_C( 165), INT16_C( 230), INT16_C( 5),
INT16_C( 46), INT16_C( 252), INT16_C( 228), INT16_C( 53), INT16_C( 41), INT16_C( 126), INT16_C( 57), INT16_C( 220) },
{ INT16_C( 25061), -INT16_C( 16956), INT16_C( 9603), INT16_C( 21142), -INT16_C( 12382), -INT16_C( 18441), -INT16_C( 9035), INT16_C( 14780),
INT16_C( 6155), -INT16_C( 24779), INT16_C( 7677), INT16_C( 31444), -INT16_C( 6074), -INT16_C( 7), INT16_C( 15393), INT16_C( 1755),
-INT16_C( 24419), INT16_C( 8387), INT16_C( 23237), INT16_C( 26482), INT16_C( 27177), -INT16_C( 8674), -INT16_C( 9658), INT16_C( 20759),
INT16_C( 19954), -INT16_C( 4111), -INT16_C( 14998), -INT16_C( 20118), INT16_C( 25517), -INT16_C( 12368), -INT16_C( 29793), INT16_C( 15573) },
{ INT8_MAX, INT8_C( 89), INT8_C( 44), INT8_C( 120), INT8_MAX, INT8_C( 95), INT8_MAX, INT8_C( 63),
INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MAX,
INT8_MAX, INT8_C( 87), INT8_C( 102), INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX,
INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN, -INT8_C( 7), INT8_MAX, INT8_MAX,
INT8_MAX, INT8_MAX, INT8_C( 34), INT8_MAX, INT8_C( 125), INT8_MAX, INT8_MAX, INT8_C( 5),
INT8_MIN, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MAX,
INT8_C( 46), INT8_MAX, INT8_MAX, INT8_C( 53), INT8_C( 41), INT8_C( 126), INT8_C( 57), INT8_MAX,
INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MAX } },
{ { INT16_C( 153), INT16_C( 240), INT16_C( 207), INT16_C( 28), INT16_C( 117), INT16_C( 127), INT16_C( 17), INT16_C( 66),
INT16_C( 194), INT16_C( 201), INT16_C( 155), INT16_C( 53), INT16_C( 42), INT16_C( 157), INT16_C( 217), INT16_C( 225),
INT16_C( 54), INT16_C( 101), INT16_C( 41), INT16_C( 62), INT16_C( 123), INT16_C( 238), INT16_C( 142), INT16_C( 235),
INT16_C( 97), INT16_C( 216), INT16_C( 46), INT16_C( 251), INT16_C( 17), INT16_C( 14), INT16_C( 114), INT16_C( 93) },
{ -INT16_C( 16216), -INT16_C( 21054), INT16_C( 17641), -INT16_C( 30485), -INT16_C( 22081), INT16_C( 19574), -INT16_C( 22985), -INT16_C( 30664),
-INT16_C( 5113), INT16_C( 1120), INT16_C( 27931), INT16_C( 29440), -INT16_C( 26242), INT16_C( 26753), INT16_C( 28683), -INT16_C( 19259),
-INT16_C( 30671), INT16_C( 6753), INT16_C( 19916), -INT16_C( 29790), INT16_C( 6390), INT16_C( 11736), INT16_C( 4286), -INT16_C( 14667),
INT16_C( 5628), INT16_C( 6090), -INT16_C( 13694), INT16_C( 139), INT16_C( 3171), INT16_C( 28521), INT16_C( 11901), -INT16_C( 20957) },
{ INT8_MAX, INT8_MAX, INT8_MAX, INT8_C( 28), INT8_C( 117), INT8_MAX, INT8_C( 17), INT8_C( 66),
INT8_MIN, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MIN,
INT8_MAX, INT8_MAX, INT8_MAX, INT8_C( 53), INT8_C( 42), INT8_MAX, INT8_MAX, INT8_MAX,
INT8_MIN, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN,
INT8_C( 54), INT8_C( 101), INT8_C( 41), INT8_C( 62), INT8_C( 123), INT8_MAX, INT8_MAX, INT8_MAX,
INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MIN,
INT8_C( 97), INT8_MAX, INT8_C( 46), INT8_MAX, INT8_C( 17), INT8_C( 14), INT8_C( 114), INT8_C( 93),
INT8_MAX, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MIN } },
{ { INT16_C( 132), INT16_C( 130), INT16_C( 107), INT16_C( 199), INT16_C( 230), INT16_C( 66), INT16_C( 170), INT16_C( 242),
INT16_C( 210), INT16_C( 66), INT16_C( 149), INT16_C( 0), INT16_C( 172), INT16_C( 30), INT16_C( 146), INT16_C( 145),
INT16_C( 149), INT16_C( 232), INT16_C( 33), INT16_C( 131), INT16_C( 165), INT16_C( 253), INT16_C( 205), INT16_C( 15),
INT16_C( 250), INT16_C( 61), INT16_C( 149), INT16_C( 48), INT16_C( 173), INT16_C( 27), INT16_C( 27), INT16_C( 86) },
{ -INT16_C( 16208), -INT16_C( 20417), -INT16_C( 4127), -INT16_C( 5836), -INT16_C( 1644), -INT16_C( 7194), -INT16_C( 10553), INT16_C( 26611),
INT16_C( 17872), INT16_C( 24484), -INT16_C( 7718), INT16_C( 7056), -INT16_C( 8306), -INT16_C( 12746), -INT16_C( 7174), -INT16_C( 21724),
INT16_C( 25507), -INT16_C( 31653), -INT16_C( 28846), -INT16_C( 6547), INT16_C( 21641), INT16_C( 20682), -INT16_C( 17110), -INT16_C( 1097),
INT16_C( 23298), -INT16_C( 9126), -INT16_C( 5572), -INT16_C( 13321), INT16_C( 11721), -INT16_C( 15207), -INT16_C( 17136), -INT16_C( 19601) },
{ INT8_MAX, INT8_MAX, INT8_C( 107), INT8_MAX, INT8_MAX, INT8_C( 66), INT8_MAX, INT8_MAX,
INT8_MIN, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MAX,
INT8_MAX, INT8_C( 66), INT8_MAX, INT8_C( 0), INT8_MAX, INT8_C( 30), INT8_MAX, INT8_MAX,
INT8_MAX, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MIN,
INT8_MAX, INT8_MAX, INT8_C( 33), INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_C( 15),
INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MIN,
INT8_MAX, INT8_C( 61), INT8_MAX, INT8_C( 48), INT8_MAX, INT8_C( 27), INT8_C( 27), INT8_C( 86),
INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN } },
{ { INT16_C( 202), INT16_C( 115), INT16_C( 165), INT16_C( 227), INT16_C( 36), INT16_C( 36), INT16_C( 234), INT16_C( 227),
INT16_C( 121), INT16_C( 129), INT16_C( 182), INT16_C( 45), INT16_C( 229), INT16_C( 244), INT16_C( 96), INT16_C( 196),
INT16_C( 223), INT16_C( 133), INT16_C( 145), INT16_C( 126), INT16_C( 155), INT16_C( 150), INT16_C( 193), INT16_C( 202),
INT16_C( 56), INT16_C( 159), INT16_C( 152), INT16_C( 210), INT16_C( 190), INT16_C( 32), INT16_C( 109), INT16_C( 73) },
{ INT16_C( 7245), -INT16_C( 11570), INT16_C( 13997), INT16_C( 25424), -INT16_C( 3119), INT16_C( 22265), INT16_C( 29620), -INT16_C( 4320),
INT16_C( 27819), -INT16_C( 25970), INT16_C( 23300), -INT16_C( 32404), INT16_C( 12825), INT16_C( 14242), -INT16_C( 31073), -INT16_C( 4991),
INT16_C( 20386), INT16_C( 20670), INT16_C( 3974), INT16_C( 22451), -INT16_C( 21502), -INT16_C( 18770), -INT16_C( 12769), -INT16_C( 13402),
INT16_C( 13370), INT16_C( 15973), -INT16_C( 11889), -INT16_C( 22336), INT16_C( 25091), -INT16_C( 23840), INT16_C( 25064), -INT16_C( 29809) },
{ INT8_MAX, INT8_C( 115), INT8_MAX, INT8_MAX, INT8_C( 36), INT8_C( 36), INT8_MAX, INT8_MAX,
INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN,
INT8_C( 121), INT8_MAX, INT8_MAX, INT8_C( 45), INT8_MAX, INT8_MAX, INT8_C( 96), INT8_MAX,
INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MIN,
INT8_MAX, INT8_MAX, INT8_MAX, INT8_C( 126), INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX,
INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MIN,
INT8_C( 56), INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_C( 32), INT8_C( 109), INT8_C( 73),
INT8_MAX, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN } },
{ { INT16_C( 77), INT16_C( 54), INT16_C( 142), INT16_C( 94), INT16_C( 60), INT16_C( 90), INT16_C( 187), INT16_C( 69),
INT16_C( 138), INT16_C( 127), INT16_C( 67), INT16_C( 94), INT16_C( 7), INT16_C( 142), INT16_C( 143), INT16_C( 25),
INT16_C( 244), INT16_C( 57), INT16_C( 221), INT16_C( 188), INT16_C( 173), INT16_C( 36), INT16_C( 59), INT16_C( 87),
INT16_C( 236), INT16_C( 32), INT16_C( 254), INT16_C( 213), INT16_C( 127), INT16_C( 110), INT16_C( 124), INT16_C( 235) },
{ -INT16_C( 10640), -INT16_C( 3547), -INT16_C( 16972), -INT16_C( 12881), -INT16_C( 14998), -INT16_C( 11535), INT16_C( 23041), -INT16_C( 14807),
INT16_C( 71), INT16_C( 30695), INT16_C( 26110), INT16_C( 844), -INT16_C( 20252), -INT16_C( 3215), -INT16_C( 2004), -INT16_C( 25122),
INT16_C( 975), -INT16_C( 31857), INT16_C( 16064), INT16_C( 10832), INT16_C( 16900), INT16_C( 1532), INT16_C( 9884), -INT16_C( 7221),
-INT16_C( 19930), INT16_C( 9306), -INT16_C( 22760), -INT16_C( 985), -INT16_C( 26281), -INT16_C( 31761), -INT16_C( 12655), INT16_C( 24608) },
{ INT8_C( 77), INT8_C( 54), INT8_MAX, INT8_C( 94), INT8_C( 60), INT8_C( 90), INT8_MAX, INT8_C( 69),
INT8_MIN, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MAX, INT8_MIN,
INT8_MAX, INT8_MAX, INT8_C( 67), INT8_C( 94), INT8_C( 7), INT8_MAX, INT8_MAX, INT8_C( 25),
INT8_C( 71), INT8_MAX, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MIN,
INT8_MAX, INT8_C( 57), INT8_MAX, INT8_MAX, INT8_MAX, INT8_C( 36), INT8_C( 59), INT8_C( 87),
INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MIN,
INT8_MAX, INT8_C( 32), INT8_MAX, INT8_MAX, INT8_MAX, INT8_C( 110), INT8_C( 124), INT8_MAX,
INT8_MIN, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MAX } },
{ { INT16_C( 176), INT16_C( 146), INT16_C( 52), INT16_C( 242), INT16_C( 185), INT16_C( 18), INT16_C( 195), INT16_C( 5),
INT16_C( 80), INT16_C( 141), INT16_C( 80), INT16_C( 78), INT16_C( 121), INT16_C( 123), INT16_C( 242), INT16_C( 25),
INT16_C( 191), INT16_C( 145), INT16_C( 103), INT16_C( 105), INT16_C( 123), INT16_C( 255), INT16_C( 113), INT16_C( 179),
INT16_C( 45), INT16_C( 185), INT16_C( 203), INT16_C( 103), INT16_C( 218), INT16_C( 140), INT16_C( 190), INT16_C( 111) },
{ INT16_C( 20605), INT16_C( 28672), -INT16_C( 31817), -INT16_C( 10023), INT16_C( 21758), INT16_C( 15575), -INT16_C( 9018), -INT16_C( 30480),
INT16_C( 12553), -INT16_C( 30911), INT16_C( 18940), INT16_C( 16623), -INT16_C( 11997), -INT16_C( 3892), INT16_C( 29071), INT16_C( 3167),
INT16_C( 24513), INT16_C( 31100), INT16_C( 21986), -INT16_C( 7855), INT16_C( 10410), INT16_C( 28701), INT16_C( 3332), INT16_C( 3832),
INT16_C( 14654), INT16_C( 14997), -INT16_C( 31613), -INT16_C( 22917), INT16_C( 18262), -INT16_C( 6762), -INT16_C( 2631), INT16_C( 31474) },
{ INT8_MAX, INT8_MAX, INT8_C( 52), INT8_MAX, INT8_MAX, INT8_C( 18), INT8_MAX, INT8_C( 5),
INT8_MAX, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MIN,
INT8_C( 80), INT8_MAX, INT8_C( 80), INT8_C( 78), INT8_C( 121), INT8_C( 123), INT8_MAX, INT8_C( 25),
INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MAX, INT8_MAX,
INT8_MAX, INT8_MAX, INT8_C( 103), INT8_C( 105), INT8_C( 123), INT8_MAX, INT8_C( 113), INT8_MAX,
INT8_MAX, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX,
INT8_C( 45), INT8_MAX, INT8_MAX, INT8_C( 103), INT8_MAX, INT8_MAX, INT8_MAX, INT8_C( 111),
INT8_MAX, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MAX } },
{ { INT16_C( 110), INT16_C( 55), INT16_C( 68), INT16_C( 110), INT16_C( 53), INT16_C( 113), INT16_C( 214), INT16_C( 129),
INT16_C( 21), INT16_C( 146), INT16_C( 55), INT16_C( 239), INT16_C( 207), INT16_C( 55), INT16_C( 199), INT16_C( 25),
INT16_C( 165), INT16_C( 249), INT16_C( 104), INT16_C( 87), INT16_C( 69), INT16_C( 225), INT16_C( 72), INT16_C( 43),
INT16_C( 30), INT16_C( 246), INT16_C( 246), INT16_C( 212), INT16_C( 187), INT16_C( 139), INT16_C( 189), INT16_C( 183) },
{ -INT16_C( 2717), INT16_C( 19889), INT16_C( 6237), -INT16_C( 1116), INT16_C( 27742), INT16_C( 31196), INT16_C( 16308), INT16_C( 4516),
INT16_C( 25181), -INT16_C( 19704), -INT16_C( 4520), INT16_C( 7815), -INT16_C( 27991), INT16_C( 11177), INT16_C( 20048), -INT16_C( 19486),
-INT16_C( 27837), -INT16_C( 24576), -INT16_C( 23380), INT16_C( 2716), INT16_C( 30736), -INT16_C( 14973), INT16_C( 10423), INT16_C( 5590),
-INT16_C( 8566), -INT16_C( 7480), INT16_C( 20428), INT16_C( 29953), -INT16_C( 21791), INT16_C( 12704), -INT16_C( 31752), INT16_C( 15332) },
{ INT8_C( 110), INT8_C( 55), INT8_C( 68), INT8_C( 110), INT8_C( 53), INT8_C( 113), INT8_MAX, INT8_MAX,
INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX,
INT8_C( 21), INT8_MAX, INT8_C( 55), INT8_MAX, INT8_MAX, INT8_C( 55), INT8_MAX, INT8_C( 25),
INT8_MAX, INT8_MIN, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN,
INT8_MAX, INT8_MAX, INT8_C( 104), INT8_C( 87), INT8_C( 69), INT8_MAX, INT8_C( 72), INT8_C( 43),
INT8_MIN, INT8_MIN, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX,
INT8_C( 30), INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX,
INT8_MIN, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX } },
{ { INT16_C( 228), INT16_C( 194), INT16_C( 120), INT16_C( 153), INT16_C( 80), INT16_C( 168), INT16_C( 52), INT16_C( 2),
INT16_C( 133), INT16_C( 223), INT16_C( 229), INT16_C( 181), INT16_C( 245), INT16_C( 136), INT16_C( 203), INT16_C( 143),
INT16_C( 160), INT16_C( 56), INT16_C( 30), INT16_C( 8), INT16_C( 47), INT16_C( 230), INT16_C( 109), INT16_C( 119),
INT16_C( 204), INT16_C( 198), INT16_C( 171), INT16_C( 66), INT16_C( 99), INT16_C( 25), INT16_C( 142), INT16_C( 222) },
{ -INT16_C( 1490), INT16_C( 17943), -INT16_C( 6120), -INT16_C( 31153), -INT16_C( 232), INT16_C( 31852), INT16_C( 21613), INT16_C( 24563),
INT16_C( 18720), -INT16_C( 11738), -INT16_C( 23819), -INT16_C( 27116), -INT16_C( 8443), INT16_C( 13231), INT16_C( 22637), -INT16_C( 25582),
INT16_C( 10578), INT16_C( 27362), INT16_C( 12561), INT16_C( 10736), INT16_C( 23601), -INT16_C( 24923), -INT16_C( 26448), -INT16_C( 12035),
INT16_C( 9186), -INT16_C( 10333), -INT16_C( 18491), -INT16_C( 13715), INT16_C( 7318), INT16_C( 1278), INT16_C( 4212), -INT16_C( 14688) },
{ INT8_MAX, INT8_MAX, INT8_C( 120), INT8_MAX, INT8_C( 80), INT8_MAX, INT8_C( 52), INT8_C( 2),
INT8_MIN, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MAX,
INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX,
INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN,
INT8_MAX, INT8_C( 56), INT8_C( 30), INT8_C( 8), INT8_C( 47), INT8_MAX, INT8_C( 109), INT8_C( 119),
INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN,
INT8_MAX, INT8_MAX, INT8_MAX, INT8_C( 66), INT8_C( 99), INT8_C( 25), INT8_MAX, INT8_MAX,
INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MAX, INT8_MIN } }
};
for (size_t i = 0 ; i < (sizeof(test_vec) / sizeof(test_vec[0])) ; i++) {
simde__m512i a = simde_mm512_loadu_epi16(test_vec[i].a);
simde__m512i b = simde_mm512_loadu_epi16(test_vec[i].b);
simde__m512i r = simde_mm512_packs_epi16(a, b);
simde_test_x86_assert_equal_i8x64(r, simde_mm512_loadu_epi16(test_vec[i].r));
}
return 0;
}
static int
test_simde_mm512_packs_epi32 (SIMDE_MUNIT_TEST_ARGS) {
static const struct {
const int32_t a[16];
const int32_t b[16];
const int16_t r[32];
} test_vec[] = {
{ { INT32_C( 1800617241), -INT32_C( 686819306), INT32_C( 140214962), INT32_C( 1970280150), -INT32_C( 1837652367), -INT32_C( 601751898), -INT32_C( 689735000), -INT32_C( 924571217),
INT32_C( 2083731302), -INT32_C( 497859792), -INT32_C( 1679118651), INT32_C( 907041733), -INT32_C( 1463253247), INT32_C( 780462469), INT32_C( 319055716), -INT32_C( 153359984) },
{ INT32_C( 20594), INT32_C( 5683), INT32_C( 14769), INT32_C( 31344), INT32_C( 53026), INT32_C( 34557), INT32_C( 40345), INT32_C( 2963),
INT32_C( 54363), INT32_C( 16618), INT32_C( 9337), INT32_C( 42910), INT32_C( 17526), INT32_C( 29642), INT32_C( 24336), INT32_C( 22890) },
{ INT16_MAX, INT16_MIN, INT16_MAX, INT16_MAX, INT16_C( 20594), INT16_C( 5683), INT16_C( 14769), INT16_C( 31344),
INT16_MIN, INT16_MIN, INT16_MIN, INT16_MIN, INT16_MAX, INT16_MAX, INT16_MAX, INT16_C( 2963),
INT16_MAX, INT16_MIN, INT16_MIN, INT16_MAX, INT16_MAX, INT16_C( 16618), INT16_C( 9337), INT16_MAX,
INT16_MIN, INT16_MAX, INT16_MAX, INT16_MIN, INT16_C( 17526), INT16_C( 29642), INT16_C( 24336), INT16_C( 22890) } },
{ { INT32_C( 1949157033), INT32_C( 11802708), INT32_C( 304426676), INT32_C( 968475415), -INT32_C( 360894332), INT32_C( 408831907), -INT32_C( 2122813782), -INT32_C( 1143217646),
-INT32_C( 47249240), -INT32_C( 721558496), INT32_C( 702947858), INT32_C( 1784914150), INT32_C( 1934942416), -INT32_C( 762531288), INT32_C( 861144097), -INT32_C( 1880215578) },
{ INT32_C( 22668), INT32_C( 4908), INT32_C( 37437), INT32_C( 33788), INT32_C( 43254), INT32_C( 9339), INT32_C( 27991), INT32_C( 13820),
INT32_C( 25741), INT32_C( 48503), INT32_C( 32847), INT32_C( 54531), INT32_C( 40829), INT32_C( 707), INT32_C( 50543), INT32_C( 49659) },
{ INT16_MAX, INT16_MAX, INT16_MAX, INT16_MAX, INT16_C( 22668), INT16_C( 4908), INT16_MAX, INT16_MAX,
INT16_MIN, INT16_MAX, INT16_MIN, INT16_MIN, INT16_MAX, INT16_C( 9339), INT16_C( 27991), INT16_C( 13820),
INT16_MIN, INT16_MIN, INT16_MAX, INT16_MAX, INT16_C( 25741), INT16_MAX, INT16_MAX, INT16_MAX,
INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX, INT16_C( 707), INT16_MAX, INT16_MAX } },
{ { INT32_C( 86345971), INT32_C( 264412482), -INT32_C( 1500573103), -INT32_C( 109342115), INT32_C( 144242828), -INT32_C( 1207280655), -INT32_C( 729908619), -INT32_C( 644449819),
INT32_C( 1155447553), -INT32_C( 1437360040), INT32_C( 273736626), INT32_C( 17419125), -INT32_C( 1274436925), INT32_C( 1936528637), INT32_C( 1934093198), INT32_C( 1699536228) },
{ INT32_C( 61865), INT32_C( 32155), INT32_C( 21901), INT32_C( 31319), INT32_C( 13870), INT32_C( 681), INT32_C( 60022), INT32_C( 26448),
INT32_C( 47193), INT32_C( 54837), INT32_C( 38444), INT32_C( 37648), INT32_C( 22729), INT32_C( 24922), INT32_C( 12875), INT32_C( 32922) },
{ INT16_MAX, INT16_MAX, INT16_MIN, INT16_MIN, INT16_MAX, INT16_C( 32155), INT16_C( 21901), INT16_C( 31319),
INT16_MAX, INT16_MIN, INT16_MIN, INT16_MIN, INT16_C( 13870), INT16_C( 681), INT16_MAX, INT16_C( 26448),
INT16_MAX, INT16_MIN, INT16_MAX, INT16_MAX, INT16_MAX, INT16_MAX, INT16_MAX, INT16_MAX,
INT16_MIN, INT16_MAX, INT16_MAX, INT16_MAX, INT16_C( 22729), INT16_C( 24922), INT16_C( 12875), INT16_MAX } },
{ { -INT32_C( 1959201899), -INT32_C( 949850649), -INT32_C( 1973514704), -INT32_C( 199397871), -INT32_C( 2008225875), -INT32_C( 1091983526), INT32_C( 183514231), INT32_C( 1703578320),
INT32_C( 1710277245), INT32_C( 1613517360), -INT32_C( 236221728), -INT32_C( 1494873863), INT32_C( 1227764463), INT32_C( 1359419353), INT32_C( 475789388), INT32_C( 8513154) },
{ INT32_C( 55397), INT32_C( 42041), INT32_C( 5526), INT32_C( 7355), INT32_C( 34917), INT32_C( 19929), INT32_C( 59241), INT32_C( 50151),
INT32_C( 8347), INT32_C( 64196), INT32_C( 9487), INT32_C( 34113), INT32_C( 46605), INT32_C( 30723), INT32_C( 13664), INT32_C( 46072) },
{ INT16_MIN, INT16_MIN, INT16_MIN, INT16_MIN, INT16_MAX, INT16_MAX, INT16_C( 5526), INT16_C( 7355),
INT16_MIN, INT16_MIN, INT16_MAX, INT16_MAX, INT16_MAX, INT16_C( 19929), INT16_MAX, INT16_MAX,
INT16_MAX, INT16_MAX, INT16_MIN, INT16_MIN, INT16_C( 8347), INT16_MAX, INT16_C( 9487), INT16_MAX,
INT16_MAX, INT16_MAX, INT16_MAX, INT16_MAX, INT16_MAX, INT16_C( 30723), INT16_C( 13664), INT16_MAX } },
{ { INT32_C( 1926468500), INT32_C( 1617729640), -INT32_C( 913998862), -INT32_C( 95500731), -INT32_C( 2135925907), INT32_C( 1543091009), INT32_C( 2022725920), INT32_C( 875268256),
-INT32_C( 2069430500), -INT32_C( 1981541737), -INT32_C( 749573491), -INT32_C( 1647468496), INT32_C( 1008631291), INT32_C( 1368921904), INT32_C( 281618544), -INT32_C( 851053391) },
{ INT32_C( 35409), INT32_C( 35604), INT32_C( 53342), INT32_C( 621), INT32_C( 55615), INT32_C( 4650), INT32_C( 45091), INT32_C( 56189),
INT32_C( 20837), INT32_C( 41949), INT32_C( 59251), INT32_C( 4073), INT32_C( 4072), INT32_C( 65313), INT32_C( 60847), INT32_C( 200) },
{ INT16_MAX, INT16_MAX, INT16_MIN, INT16_MIN, INT16_MAX, INT16_MAX, INT16_MAX, INT16_C( 621),
INT16_MIN, INT16_MAX, INT16_MAX, INT16_MAX, INT16_MAX, INT16_C( 4650), INT16_MAX, INT16_MAX,
INT16_MIN, INT16_MIN, INT16_MIN, INT16_MIN, INT16_C( 20837), INT16_MAX, INT16_MAX, INT16_C( 4073),
INT16_MAX, INT16_MAX, INT16_MAX, INT16_MIN, INT16_C( 4072), INT16_MAX, INT16_MAX, INT16_C( 200) } },
{ { -INT32_C( 11457029), -INT32_C( 2019348825), -INT32_C( 781314454), INT32_C( 1692424183), INT32_C( 2138294656), -INT32_C( 511798053), -INT32_C( 2050085159), INT32_C( 1451595355),
INT32_C( 1784076227), INT32_C( 1878128901), INT32_C( 121659151), INT32_C( 929767863), -INT32_C( 977871126), INT32_C( 1269183858), -INT32_C( 1093569437), -INT32_C( 837528054) },
{ INT32_C( 13112), INT32_C( 29602), INT32_C( 16506), INT32_C( 61047), INT32_C( 13747), INT32_C( 50817), INT32_C( 55684), INT32_C( 54951),
INT32_C( 26121), INT32_C( 37849), INT32_C( 37587), INT32_C( 64384), INT32_C( 56369), INT32_C( 23714), INT32_C( 44085), INT32_C( 49538) },
{ INT16_MIN, INT16_MIN, INT16_MIN, INT16_MAX, INT16_C( 13112), INT16_C( 29602), INT16_C( 16506), INT16_MAX,
INT16_MAX, INT16_MIN, INT16_MIN, INT16_MAX, INT16_C( 13747), INT16_MAX, INT16_MAX, INT16_MAX,
INT16_MAX, INT16_MAX, INT16_MAX, INT16_MAX, INT16_C( 26121), INT16_MAX, INT16_MAX, INT16_MAX,
INT16_MIN, INT16_MAX, INT16_MIN, INT16_MIN, INT16_MAX, INT16_C( 23714), INT16_MAX, INT16_MAX } },
{ { -INT32_C( 987198532), -INT32_C( 984088265), -INT32_C( 1923601323), -INT32_C( 259401609), -INT32_C( 1697859060), INT32_C( 1895263852), INT32_C( 1377578132), -INT32_C( 988504311),
INT32_C( 1636449322), -INT32_C( 1842879683), -INT32_C( 2044690673), INT32_C( 1685498199), -INT32_C( 805420445), INT32_C( 1145042352), INT32_C( 731274018), INT32_C( 636529402) },
{ INT32_C( 9350), INT32_C( 27830), INT32_C( 34034), INT32_C( 58088), INT32_C( 23217), INT32_C( 65182), INT32_C( 17961), INT32_C( 50795),
INT32_C( 61930), INT32_C( 52317), INT32_C( 63056), INT32_C( 25561), INT32_C( 64189), INT32_C( 51192), INT32_C( 28685), INT32_C( 52790) },
{ INT16_MIN, INT16_MIN, INT16_MIN, INT16_MIN, INT16_C( 9350), INT16_C( 27830), INT16_MAX, INT16_MAX,
INT16_MIN, INT16_MAX, INT16_MAX, INT16_MIN, INT16_C( 23217), INT16_MAX, INT16_C( 17961), INT16_MAX,
INT16_MAX, INT16_MIN, INT16_MIN, INT16_MAX, INT16_MAX, INT16_MAX, INT16_MAX, INT16_C( 25561),
INT16_MIN, INT16_MAX, INT16_MAX, INT16_MAX, INT16_MAX, INT16_MAX, INT16_C( 28685), INT16_MAX } },
{ { INT32_C( 180297835), INT32_C( 953556161), INT32_C( 623781484), INT32_C( 2106066782), INT32_C( 225920402), INT32_C( 852783265), -INT32_C( 861675119), -INT32_C( 979707558),
-INT32_C( 1143973382), -INT32_C( 487348619), INT32_C( 721887693), -INT32_C( 1146581207), INT32_C( 1992827092), INT32_C( 564698256), -INT32_C( 655537283), INT32_C( 530417445) },
{ INT32_C( 22234), INT32_C( 57656), INT32_C( 5900), INT32_C( 41682), INT32_C( 25880), INT32_C( 46214), INT32_C( 12684), INT32_C( 56400),
INT32_C( 43826), INT32_C( 59020), INT32_C( 30717), INT32_C( 8729), INT32_C( 41351), INT32_C( 65365), INT32_C( 32049), INT32_C( 41305) },
{ INT16_MAX, INT16_MAX, INT16_MAX, INT16_MAX, INT16_C( 22234), INT16_MAX, INT16_C( 5900), INT16_MAX,
INT16_MAX, INT16_MAX, INT16_MIN, INT16_MIN, INT16_C( 25880), INT16_MAX, INT16_C( 12684), INT16_MAX,
INT16_MIN, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX, INT16_MAX, INT16_C( 30717), INT16_C( 8729),
INT16_MAX, INT16_MAX, INT16_MIN, INT16_MAX, INT16_MAX, INT16_MAX, INT16_C( 32049), INT16_MAX } }
};
for (size_t i = 0 ; i < (sizeof(test_vec) / sizeof(test_vec[0])) ; i++) {
simde__m512i a = simde_mm512_loadu_epi32(test_vec[i].a);
simde__m512i b = simde_mm512_loadu_epi32(test_vec[i].b);
simde__m512i r = simde_mm512_packs_epi32(a, b);
simde_test_x86_assert_equal_i16x32(r, simde_mm512_loadu_epi32(test_vec[i].r));
}
return 0;
}
SIMDE_TEST_FUNC_LIST_BEGIN
SIMDE_TEST_FUNC_LIST_ENTRY(mm512_packs_epi16)
SIMDE_TEST_FUNC_LIST_ENTRY(mm512_packs_epi32)
SIMDE_TEST_FUNC_LIST_END
#include <test/x86/avx512/test-avx512-footer.h>
|
5a25eb94f5e204a47131d00f9a592c1507cbbe09
|
1fe37d571b240274fd3aee724f57d8cd3a2aa34e
|
/detools/suffix_array.c
|
bafa58c7de04b43645857f3db9245cdc0ac8ea73
|
[
"BSD-2-Clause",
"MIT"
] |
permissive
|
eerimoq/detools
|
e199bd84e97f82d72dcf0394d72bc646c5ec6369
|
d3cdb185e45f7a997aae9b8cc73a2170c58ee5e9
|
refs/heads/master
| 2023-08-25T01:45:05.427528
| 2023-07-20T08:04:07
| 2023-07-20T08:04:07
| 171,528,674
| 151
| 13
|
NOASSERTION
| 2022-12-28T18:22:17
| 2019-02-19T18:38:43
|
Python
|
UTF-8
|
C
| false
| false
| 3,731
|
c
|
suffix_array.c
|
/*
* sais.c for sais-lite
* Copyright (c) 2008-2010 Yuta Mori All Rights Reserved.
* Copyright (c) 2019, Erik Moqvist (Python wrapper).
*
* 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.
*/
#include <stdint.h>
#include <Python.h>
#include "sais/sais.h"
#include "libdivsufsort/divsufsort.h"
typedef int32_t (*create_t)(const uint8_t *buf_p,
int32_t *suffix_array_p,
int32_t length);
static PyObject *create(PyObject *self_p,
PyObject* args_p,
create_t create_callback)
{
int res;
Py_buffer from_view;
Py_buffer suffix_array_view;
PyObject *from_p;
PyObject *suffix_array_buffer_p;
int32_t *suffix_array_p;
res = PyArg_ParseTuple(args_p,
"OO",
&from_p,
&suffix_array_buffer_p);
if (res == 0) {
return (NULL);
}
/* Input argument conversion. */
res = PyObject_GetBuffer(from_p, &from_view, PyBUF_CONTIG_RO);
if (res == -1) {
return (NULL);
}
res = PyObject_GetBuffer(suffix_array_buffer_p,
&suffix_array_view,
PyBUF_CONTIG);
if (res == -1) {
goto err1;
}
suffix_array_p = (int32_t *)suffix_array_view.buf;
suffix_array_p[0] = (int32_t)from_view.len;
/* Execute the SA-IS algorithm. */
res = create_callback((uint8_t *)from_view.buf,
&suffix_array_p[1],
(int32_t)from_view.len);
if (res != 0) {
goto err2;
}
PyBuffer_Release(&from_view);
PyBuffer_Release(&suffix_array_view);
Py_INCREF(Py_None);
return (Py_None);
err2:
PyBuffer_Release(&suffix_array_view);
err1:
PyBuffer_Release(&from_view);
return (NULL);
}
/**
* def sais(data) -> suffix array
*/
static PyObject *m_sais(PyObject *self_p, PyObject* args_p)
{
return (create(self_p, args_p, sais));
}
/**
* def divsufsort(data) -> suffix array
*/
static PyObject *m_divsufsort(PyObject *self_p, PyObject* args_p)
{
return (create(self_p, args_p, divsufsort));
}
static PyMethodDef module_methods[] = {
{ "sais", m_sais, METH_VARARGS },
{ "divsufsort", m_divsufsort, METH_VARARGS },
{ NULL }
};
static PyModuleDef module = {
PyModuleDef_HEAD_INIT,
.m_name = "suffix_array",
.m_doc = NULL,
.m_size = -1,
.m_methods = module_methods
};
PyMODINIT_FUNC PyInit_suffix_array(void)
{
PyObject *m_p;
/* Module creation. */
m_p = PyModule_Create(&module);
if (m_p == NULL) {
return (NULL);
}
return (m_p);
}
|
7c4d3e4b0112a04f60ff0a25877a1fc0f397e42c
|
8838eb997879add5759b6dfb23f9a646464e53ca
|
/src/compat/cxx/core/cxx_invoke_destructors.h
|
d74587a553d9f40fcc9d371f8bed976c89d65e49
|
[
"BSD-2-Clause"
] |
permissive
|
embox/embox
|
d6aacec876978522f01cdc4b8de37a668c6f4c80
|
98e3c06e33f3fdac10a29c069c20775568e0a6d1
|
refs/heads/master
| 2023-09-04T03:02:20.165042
| 2023-09-02T14:55:31
| 2023-09-02T14:55:31
| 33,078,138
| 1,087
| 325
|
BSD-2-Clause
| 2023-09-14T16:58:34
| 2015-03-29T15:27:48
|
C
|
UTF-8
|
C
| false
| false
| 237
|
h
|
cxx_invoke_destructors.h
|
/*
* cxx_invoke_destructors.h
*
* Created on: 30 janv. 2013
* Author: fsulima
*/
#ifndef CXX_INVOKE_DESTRUCTORS_H_
#define CXX_INVOKE_DESTRUCTORS_H_
void cxx_invoke_destructors(void);
#endif /* CXX_INVOKE_DESTRUCTORS_H_ */
|
f9a1ecc5e35f5d6f0a577cd05d213a9c770160da
|
e1055e6a4117c7e0785ad0dee9f7911492d2298c
|
/src/smsplus/system.c
|
b5d54cc903526085c1e419ea9fd1646ba334862c
|
[] |
no_license
|
rossumur/esp_8_bit
|
f45fba3ca791ecf37a6a311c7fcfd523a63532cd
|
55eb7b86eda290d96b02c38c3e787efb8ae6a8c0
|
refs/heads/master
| 2023-08-22T19:07:41.899291
| 2022-03-19T19:21:25
| 2022-03-19T19:21:25
| 262,904,229
| 906
| 130
| null | 2023-02-17T17:15:22
| 2020-05-11T00:50:54
|
C
|
UTF-8
|
C
| false
| false
| 6,520
|
c
|
system.c
|
/*
Copyright (C) 1998, 1999, 2000 Charles Mac Donald
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "shared.h"
t_bitmap bitmap;
t_cart cart;
t_snd snd;
t_input input;
//OPLL *opll;
struct
{
char reg[64];
}ym2413;
void emu_system_init(int rate)
{
/* Initialize the VDP emulation */
vdp_init();
/* Initialize the SMS emulation */
sms_init();
/* Initialize the look-up tables and related data */
render_init();
/* Enable sound emulation if the sample rate was specified */
audio_init(rate);
/* Don't save SRAM by default */
sms.save = 0;
/* Clear emulated button state */
memset(&input, 0, sizeof(t_input));
}
void audio_init(int rate)
{
/* Clear sound context */
memset(&snd, 0, sizeof(t_snd));
/* Reset logging data */
snd.log = 0;
snd.callback = NULL;
/* Oops.. sound is disabled */
if(!rate) return;
/* Calculate buffer size in samples */
snd.bufsize = rate == 15720 ? 262 : 312; // EWWWW
/* Sound output */
snd.buffer[0] = (signed short int *)malloc(snd.bufsize * 2);
snd.buffer[1] = (signed short int *)malloc(snd.bufsize * 2);
if(!snd.buffer[0] || !snd.buffer[1]) return;
memset(snd.buffer[0], 0, snd.bufsize * 2);
memset(snd.buffer[1], 0, snd.bufsize * 2);
/* YM2413 sound stream */
// snd.fm_buffer = (signed short int *)malloc(snd.bufsize * 2);
// if(!snd.fm_buffer) return;
// memset(snd.fm_buffer, 0, snd.bufsize * 2);
/* SN76489 sound stream */
// snd.psg_buffer[0] = (signed short int *)malloc(snd.bufsize * 2);
// snd.psg_buffer[1] = (signed short int *)malloc(snd.bufsize * 2);
// if(!snd.psg_buffer[0] || !snd.psg_buffer[1]) return;
// memset(snd.psg_buffer[0], 0, snd.bufsize * 2);
// memset(snd.psg_buffer[1], 0, snd.bufsize * 2);
/* Set up SN76489 emulation */
SN76496_init(0, MASTER_CLOCK, 255, rate);
/* Set up YM2413 emulation */
// OPLL_init(3579545, rate) ;
// opll = OPLL_new() ;
// OPLL_reset(opll) ;
// OPLL_reset_patch(opll,0) ; /* if use default voice data. */
/* Inform other functions that we can use sound */
snd.enabled = 1;
}
void system_shutdown(void)
{
if(snd.enabled)
{
// OPLL_delete(opll);
// OPLL_close();
}
}
void system_reset(void)
{
cpu_reset();
vdp_reset();
sms_reset();
render_reset();
// system_load_sram();
if(snd.enabled)
{
// OPLL_reset(opll) ;
// OPLL_reset_patch(opll,0) ; /* if use default voice data. */
}
}
void system_save_state(void *fd)
{
/* Save VDP context */
fwrite(&vdp, sizeof(t_vdp), 1, fd);
/* Save SMS context */
fwrite(&sms, sizeof(t_sms), 1, fd);
/* Save Z80 context */
fwrite(Z80_Context, sizeof(Z80_Regs), 1, fd);
fwrite(&after_EI, sizeof(int), 1, fd);
/* Save YM2413 registers */
fwrite(&ym2413.reg[0], 0x40, 1, fd);
/* Save SN76489 context */
// fwrite(&sn[0], sizeof(t_SN76496), 1, fd);
}
void system_load_state(void *fd)
{
int i;
uint8 reg[0x40];
/* Initialize everything */
cpu_reset();
system_reset();
/* Load VDP context */
fread(&vdp, sizeof(t_vdp), 1, fd);
/* Load SMS context */
fread(&sms, sizeof(t_sms), 1, fd);
/* Load Z80 context */
fread(Z80_Context, sizeof(Z80_Regs), 1, fd);
fread(&after_EI, sizeof(int), 1, fd);
/* Load YM2413 registers */
fread(reg, 0x40, 1, fd);
/* Load SN76489 context */
//fread(&sn[0], sizeof(t_SN76496), 1, fd);
/* Restore callbacks */
z80_set_irq_callback(sms_irq_callback);
cpu_readmap[0] = cart.rom + 0x0000; /* 0000-3FFF */
cpu_readmap[1] = cart.rom + 0x2000;
cpu_readmap[2] = cart.rom + 0x4000; /* 4000-7FFF */
cpu_readmap[3] = cart.rom + 0x6000;
cpu_readmap[4] = cart.rom + 0x0000; /* 0000-3FFF */
cpu_readmap[5] = cart.rom + 0x2000;
cpu_readmap[6] = sms.ram;
cpu_readmap[7] = sms.ram;
cpu_writemap[0] = sms.dummy;
cpu_writemap[1] = sms.dummy;
cpu_writemap[2] = sms.dummy;
cpu_writemap[3] = sms.dummy;
cpu_writemap[4] = sms.dummy;
cpu_writemap[5] = sms.dummy;
cpu_writemap[6] = sms.ram;
cpu_writemap[7] = sms.ram;
sms_mapper_w(3, sms.fcr[3]);
sms_mapper_w(2, sms.fcr[2]);
sms_mapper_w(1, sms.fcr[1]);
sms_mapper_w(0, sms.fcr[0]);
/* Force full pattern cache update */
// is_vram_dirty = 1;
// memset(vram_dirty, 1, 0x200);
/* Restore palette */
for(i = 0; i < PALETTE_SIZE; i += 1)
palette_sync(i);
/* Restore sound state */
if(snd.enabled)
{
#if 0
/* Clear YM2413 context */
OPLL_reset(opll) ;
OPLL_reset_patch(opll,0) ; /* if use default voice data. */
/* Restore rhythm enable first */
ym2413_write(0, 0, 0x0E);
ym2413_write(0, 1, reg[0x0E]);
/* User instrument settings */
for(i = 0x00; i <= 0x07; i += 1)
{
ym2413_write(0, 0, i);
ym2413_write(0, 1, reg[i]);
}
/* Channel frequency */
for(i = 0x10; i <= 0x18; i += 1)
{
ym2413_write(0, 0, i);
ym2413_write(0, 1, reg[i]);
}
/* Channel frequency + ctrl. */
for(i = 0x20; i <= 0x28; i += 1)
{
ym2413_write(0, 0, i);
ym2413_write(0, 1, reg[i]);
}
/* Instrument and volume settings */
for(i = 0x30; i <= 0x38; i += 1)
{
ym2413_write(0, 0, i);
ym2413_write(0, 1, reg[i]);
}
#endif
}
}
void ym2413_write(int chip, int offset, int data)
{
// static uint8 latch = 0;
// if(offset & 1)
// OPLL_writeReg(opll, latch, data);
// else
// latch = data;
}
|
59b34e38cf4f5d9434d210d8021459da4291751e
|
ed98b77f3f09b392e68a0d59c48eec299e883bb9
|
/tests/src/cons/nonlinear/check.c
|
ac937fda67ab6830b61aba9027301c1a249850a8
|
[
"Apache-2.0"
] |
permissive
|
scipopt/scip
|
c8ddbe7cdec0a3af5a230c04b74b76ffacbdcc33
|
dc856a4c966ea50bd5f52c58d7be4fea33706f4c
|
refs/heads/master
| 2023-08-19T11:39:12.578790
| 2023-08-15T20:05:58
| 2023-08-15T20:05:58
| 342,522,859
| 262
| 46
|
NOASSERTION
| 2023-08-03T07:37:45
| 2021-02-26T09:16:17
|
C
|
UTF-8
|
C
| false
| false
| 20,233
|
c
|
check.c
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* This file is part of the program and library */
/* SCIP --- Solving Constraint Integer Programs */
/* */
/* Copyright (c) 2002-2023 Zuse Institute Berlin (ZIB) */
/* */
/* 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. */
/* */
/* You should have received a copy of the Apache-2.0 license */
/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**@file check.c
* @brief tests check callback
*/
/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
#include "scip/scip.h"
#include "scip/scipdefplugins.h"
#include "include/scip_test.h"
static SCIP* scip;
static SCIP_VAR* x;
static SCIP_VAR* y;
static SCIP_VAR* z;
static SCIP_SOL* sol;
/* creates scip, problem, includes nonlinear constraint handler, creates and adds variables */
static
void setup(void)
{
SCIP_CALL( SCIPcreate(&scip) );
SCIP_CALL( SCIPincludeDefaultPlugins(scip) );
/* create problem */
SCIP_CALL( SCIPcreateProbBasic(scip, "test_problem") );
SCIP_CALL( SCIPcreateVarBasic(scip, &x, "x", 0.0, 5.0, 1.0, SCIP_VARTYPE_CONTINUOUS) );
SCIP_CALL( SCIPcreateVarBasic(scip, &y, "y", 0.0, 5.0, 2.0, SCIP_VARTYPE_CONTINUOUS) );
SCIP_CALL( SCIPcreateVarBasic(scip, &z, "z", 0.0, 5.0, 0.0, SCIP_VARTYPE_INTEGER) );
SCIP_CALL( SCIPaddVar(scip, x) );
SCIP_CALL( SCIPaddVar(scip, y) );
SCIP_CALL( SCIPaddVar(scip, z) );
/* create solution */
SCIP_CALL( SCIPcreateSol(scip, &sol, NULL) );
}
/* releases variables, frees scip */
static
void teardown(void)
{
/* release solution */
SCIP_CALL( SCIPfreeSol(scip, &sol) );
SCIP_CALL( SCIPreleaseVar(scip, &x) );
SCIP_CALL( SCIPreleaseVar(scip, &y) );
SCIP_CALL( SCIPreleaseVar(scip, &z) );
SCIP_CALL( SCIPfree(&scip) );
cr_assert_eq(BMSgetMemoryUsed(), 0, "Memory is leaking!!");
}
TestSuite(conshdlr, .init = setup, .fini = teardown);
Test(conshdlr, check,
.description = "test feasibility check of the nonlinear constraint handler.")
{
SCIP_CONS* cons;
SCIP_Bool success;
const char* input = "[nonlinear] <test>: 1.1*<x>*<y>/<z> + 3.2*<x>^2*<y>^(-5)*<z> + 0.5*<z>^3 <= 2;";
/* parse constraint */
success = FALSE;
SCIP_CALL( SCIPparseCons(scip, &cons, input,
TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, &success) );
cr_assert(success);
SCIP_CALL( SCIPaddCons(scip, cons) );
/* create an infeasible solution */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 2) );
SCIP_CALL( SCIPsetSolVal(scip, sol, z, 3) );
SCIP_CALL( SCIPcheckSol(scip, sol, TRUE, TRUE, FALSE, FALSE, FALSE, &success) );
cr_expect_not(success, "an infeasible solution has been accepted");
/* create a feasible solution */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 0) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, z, 1) );
SCIP_CALL( SCIPcheckSol(scip, sol, TRUE, TRUE, FALSE, FALSE, FALSE, &success) );
cr_expect(success, "a feasible solution has been declined");
/* create an undefined solution */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, z, 0) );
SCIP_CALL( SCIPcheckSol(scip, sol, TRUE, TRUE, FALSE, FALSE, FALSE, &success) );
cr_expect_not(success, "undefined solution has been accepted");
/* release constraints */
SCIP_CALL( SCIPreleaseCons(scip, &cons) );
}
static
SCIP_Real getActivity(void)
{
SCIP_Real xval;
SCIP_Real yval;
SCIP_Real zval;
xval = SCIPgetSolVal(scip, sol, x);
yval = SCIPgetSolVal(scip, sol, y);
zval = SCIPgetSolVal(scip, sol, z);
if( zval == 0.0 )
return SCIP_INVALID;
return 1.1*xval*yval/zval + 3.2*xval*xval*pow(yval,-5)*zval + 0.5*pow(zval,3);
}
static
SCIP_Real getGradNorm(void)
{
SCIP_Real xval;
SCIP_Real yval;
SCIP_Real zval;
xval = SCIPgetSolVal(scip, sol, x);
yval = SCIPgetSolVal(scip, sol, y);
zval = SCIPgetSolVal(scip, sol, z);
if( zval == 0.0 )
return SCIP_INVALID;
/* Gradient:
* dx: 1.1*y/z + 3.2*2*x*<y>^(-5)*<z>
* dy: 1.1*x/z + 3.2*(-5)*x^2*y^(-6)*z
* dz: -1.1*x*y/z^2 + 3.2*x^2*y^(-5) + 1.5*z^2
*/
return sqrt(
SQR(1.1*yval/zval + 6.4*xval*pow(yval,-5)*zval) +
SQR(1.1*xval/zval - 5*3.2*xval*xval*pow(yval,-6)*zval) +
SQR(-1.1*xval*yval/(zval*zval) + 3.2*xval*xval*pow(yval,-5) + 1.5*zval*zval) );
}
Test(conshdlr, relviol_n,
.description = "test relative constraint violation of the nonlinear constraint handler for violscale=n."
)
{
SCIP_CONS* cons;
SCIP_Bool success;
SCIP_Real activity;
SCIP_Real absviol;
SCIP_Real relviol;
const char* input = "[nonlinear] <test>: 1.1*<x>*<y>/<z> + 3.2*<x>^2*<y>^(-5)*<z> + 0.5*<z>^3 <= 2;";
/* no scaling, relative should be equal to absolute violation */
SCIP_CALL( SCIPsetCharParam(scip, "constraints/nonlinear/violscale", 'n') );
/* parse constraint */
success = FALSE;
SCIP_CALL( SCIPparseCons(scip, &cons, input,
TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, &success) );
cr_assert(success);
SCIP_CALL( SCIPaddCons(scip, cons) );
/* create an infeasible solution */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 2) );
SCIP_CALL( SCIPsetSolVal(scip, sol, z, 3) );
SCIP_CALL( SCIPcheckSol(scip, sol, FALSE, TRUE, FALSE, FALSE, FALSE, &success) );
cr_expect_not(success, "an infeasible solution has been accepted");
activity = getActivity();
SCIP_CALL( SCIPgetAbsViolationNonlinear(scip, cons, sol, &absviol) );
cr_expect_float_eq(absviol, activity-2.0, SCIPepsilon(scip), "activity: %g, rhs: 2.0, but absviol: %g", activity, absviol);
SCIP_CALL( SCIPgetRelViolationNonlinear(scip, cons, sol, &relviol) );
cr_expect_eq(relviol, absviol);
/* create a feasible solution */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 0) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, z, 1) );
SCIP_CALL( SCIPcheckSol(scip, sol, FALSE, TRUE, FALSE, FALSE, FALSE, &success) );
cr_expect(success, "a feasible solution has been declined");
activity = getActivity();
SCIP_CALL( SCIPgetAbsViolationNonlinear(scip, cons, sol, &absviol) );
cr_expect_eq(absviol, 0.0);
SCIP_CALL( SCIPgetRelViolationNonlinear(scip, cons, sol, &relviol) );
cr_expect_eq(relviol, absviol);
/* create an undefined solution */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, z, 0) );
SCIP_CALL( SCIPcheckSol(scip, sol, FALSE, TRUE, FALSE, FALSE, FALSE, &success) );
cr_expect_not(success, "undefined solution has been accepted");
activity = getActivity();
cr_expect_eq(activity, SCIP_INVALID);
SCIP_CALL( SCIPgetAbsViolationNonlinear(scip, cons, sol, &absviol) );
cr_expect_eq(absviol, SCIPinfinity(scip));
SCIP_CALL( SCIPgetRelViolationNonlinear(scip, cons, sol, &relviol) );
cr_expect_eq(relviol, absviol);
/* release constraints */
SCIP_CALL( SCIPreleaseCons(scip, &cons) );
}
Test(conshdlr, relviol_a,
.description = "test relative constraint violation of the nonlinear constraint handler for violscale=a."
)
{
SCIP_CONS* cons;
SCIP_Bool success;
SCIP_Real activity;
SCIP_Real absviol;
SCIP_Real relviol;
const char* input = "[nonlinear] <test>: 1.1*<x>*<y>/<z> + 3.2*<x>^2*<y>^(-5)*<z> + 0.5*<z>^3 <= 2;";
/* scale by max(activity, rhs) */
SCIP_CALL( SCIPsetCharParam(scip, "constraints/nonlinear/violscale", 'a') );
/* parse constraint */
success = FALSE;
SCIP_CALL( SCIPparseCons(scip, &cons, input,
TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, &success) );
cr_assert(success);
SCIP_CALL( SCIPaddCons(scip, cons) );
/* create an infeasible solution */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 2) );
SCIP_CALL( SCIPsetSolVal(scip, sol, z, 3) );
SCIP_CALL( SCIPcheckSol(scip, sol, FALSE, TRUE, FALSE, FALSE, FALSE, &success) );
cr_expect_not(success, "an infeasible solution has been accepted");
activity = getActivity();
SCIP_CALL( SCIPgetAbsViolationNonlinear(scip, cons, sol, &absviol) );
cr_expect_float_eq(absviol, activity-2.0, SCIPepsilon(scip), "activity: %g, rhs: 2.0, but absviol: %g", activity, absviol);
SCIP_CALL( SCIPgetRelViolationNonlinear(scip, cons, sol, &relviol) );
cr_expect_float_eq(relviol, absviol / MAX(activity, 2.0), SCIPepsilon(scip));
/* create a feasible solution */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 0) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, z, 1) );
SCIP_CALL( SCIPcheckSol(scip, sol, FALSE, TRUE, FALSE, FALSE, FALSE, &success) );
cr_expect(success, "a feasible solution has been declined");
activity = getActivity();
SCIP_CALL( SCIPgetAbsViolationNonlinear(scip, cons, sol, &absviol) );
cr_expect_eq(absviol, 0.0);
SCIP_CALL( SCIPgetRelViolationNonlinear(scip, cons, sol, &relviol) );
cr_expect_float_eq(relviol, absviol / MAX(activity, 2.0), SCIPepsilon(scip));
/* create an undefined solution */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, z, 0) );
SCIP_CALL( SCIPcheckSol(scip, sol, FALSE, TRUE, FALSE, FALSE, FALSE, &success) );
cr_expect_not(success, "undefined solution has been accepted");
activity = getActivity();
cr_expect_eq(activity, SCIP_INVALID);
SCIP_CALL( SCIPgetAbsViolationNonlinear(scip, cons, sol, &absviol) );
cr_expect_eq(absviol, SCIPinfinity(scip));
SCIP_CALL( SCIPgetRelViolationNonlinear(scip, cons, sol, &relviol) );
cr_expect_eq(relviol, absviol);
/* release constraints */
SCIP_CALL( SCIPreleaseCons(scip, &cons) );
}
Test(conshdlr, relviol_g,
.description = "test relative constraint violation of the nonlinear constraint handler for violscale=g."
)
{
SCIP_CONS* cons;
SCIP_Bool success;
SCIP_Real activity;
SCIP_Real gradnorm;
SCIP_Real absviol;
SCIP_Real relviol;
const char* input = "[nonlinear] <test>: 1.1*<x>*<y>/<z> + 3.2*<x>^2*<y>^(-5)*<z> + 0.5*<z>^3 <= 2;";
/* scale by norm of gradient */
SCIP_CALL( SCIPsetCharParam(scip, "constraints/nonlinear/violscale", 'g') );
/* parse constraint */
success = FALSE;
SCIP_CALL( SCIPparseCons(scip, &cons, input,
TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, &success) );
cr_assert(success);
SCIP_CALL( SCIPaddCons(scip, cons) );
/* create an infeasible solution */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 2) );
SCIP_CALL( SCIPsetSolVal(scip, sol, z, 3) );
SCIP_CALL( SCIPcheckSol(scip, sol, FALSE, TRUE, FALSE, FALSE, FALSE, &success) );
cr_expect_not(success, "an infeasible solution has been accepted");
activity = getActivity();
gradnorm = getGradNorm();
SCIP_CALL( SCIPgetAbsViolationNonlinear(scip, cons, sol, &absviol) );
cr_expect_float_eq(absviol, activity-2.0, SCIPepsilon(scip), "activity: %g, rhs: 2.0, but absviol: %g", activity, absviol);
SCIP_CALL( SCIPgetRelViolationNonlinear(scip, cons, sol, &relviol) );
cr_expect_float_eq(relviol, absviol / MAX(gradnorm, 1.0), SCIPepsilon(scip));
/* create a feasible solution */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 0) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, z, 1) );
SCIP_CALL( SCIPcheckSol(scip, sol, FALSE, TRUE, FALSE, FALSE, FALSE, &success) );
cr_expect(success, "a feasible solution has been declined");
activity = getActivity();
gradnorm = getGradNorm();
SCIP_CALL( SCIPgetAbsViolationNonlinear(scip, cons, sol, &absviol) );
cr_expect_eq(absviol, 0.0);
SCIP_CALL( SCIPgetRelViolationNonlinear(scip, cons, sol, &relviol) );
cr_expect_float_eq(relviol, absviol / MAX(gradnorm, 1.0), SCIPepsilon(scip));
/* create an undefined solution */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, z, 0) );
SCIP_CALL( SCIPcheckSol(scip, sol, FALSE, TRUE, FALSE, FALSE, FALSE, &success) );
cr_expect_not(success, "undefined solution has been accepted");
activity = getActivity();
cr_expect_eq(activity, SCIP_INVALID);
SCIP_CALL( SCIPgetAbsViolationNonlinear(scip, cons, sol, &absviol) );
cr_expect_eq(absviol, SCIPinfinity(scip));
SCIP_CALL( SCIPgetRelViolationNonlinear(scip, cons, sol, &relviol) );
cr_expect_eq(relviol, absviol);
/* release constraints */
SCIP_CALL( SCIPreleaseCons(scip, &cons) );
}
Test(conshdlr, relviol_g2,
.description = "test relative constraint violation of the nonlinear constraint handler for violscale=g."
)
{
SCIP_CONS* cons;
SCIP_Bool success;
SCIP_Real activity;
SCIP_Real gradnorm;
SCIP_Real absviol;
SCIP_Real relviol;
const char* input = "[nonlinear] <test>: <x>^0.5*<y>^0.5 >= 1;";
/* dx: 0.5*sqrt(y/x) dy: 0.5*sqrt(x/y) */
/* scale by norm of gradient */
SCIP_CALL( SCIPsetCharParam(scip, "constraints/nonlinear/violscale", 'g') );
/* parse constraint */
success = FALSE;
SCIP_CALL( SCIPparseCons(scip, &cons, input,
TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, &success) );
cr_assert(success);
SCIP_CALL( SCIPaddCons(scip, cons) );
/* create an infeasible solution that can be evaluated and scaled */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 0.5) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 0.5) );
SCIP_CALL( SCIPcheckSol(scip, sol, FALSE, TRUE, FALSE, FALSE, FALSE, &success) );
cr_expect_not(success, "an infeasible solution has been accepted");
activity = sqrt(0.25);
gradnorm = sqrt(SQR(0.5)+SQR(0.5));
SCIP_CALL( SCIPgetAbsViolationNonlinear(scip, cons, sol, &absviol) );
cr_expect_float_eq(absviol, 1.0-activity, SCIPepsilon(scip), "activity: %g, lhs: 1.0, but absviol: %g", activity, absviol);
SCIP_CALL( SCIPgetRelViolationNonlinear(scip, cons, sol, &relviol) );
cr_expect_float_eq(relviol, absviol / MAX(gradnorm, 1.0), SCIPepsilon(scip));
/* create an infeasible solution that can be evaluated but gradient doesn't exist */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 0.0) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 0.5) );
SCIP_CALL( SCIPcheckSol(scip, sol, FALSE, TRUE, FALSE, FALSE, FALSE, &success) );
cr_expect_not(success, "an infeasible solution has been accepted");
SCIP_CALL( SCIPgetAbsViolationNonlinear(scip, cons, sol, &absviol) );
cr_expect_eq(absviol, 1.0);
SCIP_CALL( SCIPgetRelViolationNonlinear(scip, cons, sol, &relviol) );
/* if gradient cannot be evaluated, then no scaling should happen */
cr_expect_eq(relviol, absviol);
/* release constraints */
SCIP_CALL( SCIPreleaseCons(scip, &cons) );
}
/* test violation in expression in nonlinear constraint */
Test(conshdlr, exprviol,
.description = "Tests expression violation.")
{
SCIP_EXPR* mainexpr;
SCIP_VAR* auxvar;
SCIP_Real viol;
SCIP_Bool violunder;
SCIP_Bool violover;
SCIP_Bool success;
SCIP_Bool cutoff;
SCIP_CONS* cons;
SCIPsetHeuristics(scip, SCIP_PARAMSETTING_OFF, TRUE);
SCIPsetPresolving(scip, SCIP_PARAMSETTING_OFF, TRUE);
/* dualfix will fix y to its lower bound, but 0 isn't in the domain of y^1, so propagation would declare the problem to be infeasible
* (this indicates that the locks in cons_nonlinear miss to take domain-restrictions into account)
*/
SCIP_CALL( SCIPchgVarLbGlobal(scip, y, 0.1) );
SCIP_CALL( SCIPparseCons(scip, &cons, "[nonlinear] <test>: 0.5 * (<x>^2*<y>^(-1)*5^(-4))^2 * (2*<x> + 1)^(-1) >= 0", TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, &success) );
cr_assert(success);
SCIP_CALL( SCIPaddCons(scip, cons) );
SCIP_CALL( SCIPreleaseCons(scip, &cons) );
SCIP_CALL( SCIPfreeSol(scip, &sol) ); /* we need a sol in transformed space */
SCIP_CALL( TESTscipSetStage(scip, SCIP_STAGE_SOLVING, FALSE) );
SCIP_CALL( SCIPcreateSol(scip, &sol, NULL) );
/* initialize solution values */
SCIP_CALL( SCIPsetSolVal(scip, sol, x, 2.0) );
SCIP_CALL( SCIPsetSolVal(scip, sol, y, 4.0) );
cr_assert_eq(SCIPgetNConss(scip), 1);
mainexpr = SCIPgetExprNonlinear(SCIPgetConss(scip)[0]);
SCIP_CALL( SCIPdismantleExpr(scip, NULL, mainexpr) );
/* construct LP to get auxvar */
SCIP_CALL( SCIPconstructLP(scip, &cutoff) );
cr_expect_not(cutoff);
auxvar = SCIPgetExprAuxVarNonlinear(mainexpr);
cr_assert_not_null(auxvar);
SCIP_CALL( SCIPevalExpr(scip, mainexpr, sol, 1) );
SCIP_CALL( SCIPsetSolVal(scip, sol, auxvar, SCIPexprGetEvalValue(mainexpr) + 5.0) );
SCIP_CALL( SCIPgetExprAbsOrigViolationNonlinear(scip, mainexpr, sol, 1, &viol, &violunder, &violover) );
cr_expect(!violunder);
cr_expect(violover);
cr_expect_float_eq(viol, 5.0, 1e-12, "got violation %g, but expected 5", viol);
/* because we don't have a positive lock, there should be no violation "on the other side" */
SCIP_CALL( SCIPsetSolVal(scip, sol, auxvar, SCIPexprGetEvalValue(mainexpr) - 5.0) );
SCIP_CALL( SCIPgetExprAbsOrigViolationNonlinear(scip, mainexpr, sol, 1, &viol, &violunder, &violover) );
cr_expect(!violunder);
cr_expect(!violover);
cr_expect_eq(viol, 0.0, "got violation %g, but none was expected", viol);
SCIP_CALL( SCIPsetSolVal(scip, sol, auxvar, SCIPexprGetEvalValue(mainexpr) + 5.0) );
SCIP_CALL( SCIPgetExprAbsAuxViolationNonlinear(scip, mainexpr, SCIPexprGetEvalValue(mainexpr)-3.0, sol, &viol, &violunder, &violover) );
cr_expect(!violunder);
cr_expect(violover);
cr_expect_float_eq(viol, 8.0, 1e-12, "got violation %g, but expected 8", viol);
SCIP_CALL( SCIPgetExprRelAuxViolationNonlinear(scip, mainexpr, SCIPexprGetEvalValue(mainexpr)-3.0, sol, &viol, &violunder, &violover) );
cr_expect(!violunder);
cr_expect(violover);
cr_expect_float_eq(viol, 8.0 / REALABS(SCIPexprGetEvalValue(mainexpr)-3.0), 1e-12, "got violation %g, but expected %g", viol, viol / REALABS(SCIPexprGetEvalValue(mainexpr)-3.0));
/* because we don't have a positive lock, there should be no violation "on the other side" */
SCIP_CALL( SCIPsetSolVal(scip, sol, auxvar, SCIPexprGetEvalValue(mainexpr) - 5.0) );
SCIP_CALL( SCIPgetExprAbsAuxViolationNonlinear(scip, mainexpr, SCIPexprGetEvalValue(mainexpr)-3.0, sol, &viol, &violunder, &violover) );
cr_expect(!violunder);
cr_expect(!violover);
cr_expect_eq(viol, 0.0, "got violation %g, but none was expected", viol);
}
|
ec844a910c116fa65b87697e8930ab806e22978e
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/news/ifmail/files/patch-directory.h
|
37d2b0f42012497e3919fc419c6b0f612faac3c1
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 226
|
h
|
patch-directory.h
|
--- iflib/directory.h.orig 1994-11-11 21:44:05 UTC
+++ iflib/directory.h
@@ -8,6 +8,7 @@
* Written by stefan@space.s-link.de (Stefan Westerfeld)
*/
+#include <sys/types.h>
#include <dirent.h>
#ifdef DONT_HAVE_DIRENT
|
229992bdd58f13c982291402b5ce0d2bd7584552
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/include/asm-generic/siginfo.h
|
b685d3bd32e29c7aa3644331cfb37ab23eff4b06
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 911
|
h
|
siginfo.h
|
#ifndef _ASM_GENERIC_SIGINFO_H
#define _ASM_GENERIC_SIGINFO_H
#include <uapi/asm-generic/siginfo.h>
#define __SI_MASK 0xffff0000u
#define __SI_KILL (0 << 16)
#define __SI_TIMER (1 << 16)
#define __SI_POLL (2 << 16)
#define __SI_FAULT (3 << 16)
#define __SI_CHLD (4 << 16)
#define __SI_RT (5 << 16)
#define __SI_MESGQ (6 << 16)
#define __SI_SYS (7 << 16)
#define __SI_CODE(T,N) ((T) | ((N) & 0xffff))
struct siginfo;
void do_schedule_next_timer(struct siginfo *info);
#ifndef HAVE_ARCH_COPY_SIGINFO
#include <linux/string.h>
static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
{
if (from->si_code < 0)
memcpy(to, from, sizeof(*to));
else
/* _sigchld is currently the largest know union member */
memcpy(to, from, __ARCH_SI_PREAMBLE_SIZE + sizeof(from->_sifields._sigchld));
}
#endif
extern int copy_siginfo_to_user(struct siginfo __user *to, struct siginfo *from);
#endif
|
36baedbb39dfd62402abe34a5513221cccbb984b
|
aa5c1a530f95d629e686ac9124caf1a49a9f23e9
|
/runtime/src/iree/hal/local/elf/arch/x86_64.c
|
1a9a94c151c578f27f63c907dd02567a9b611074
|
[
"Apache-2.0",
"LLVM-exception",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
openxla/iree
|
eacf5b239559e1d3b40c38039ac4c26315b523f7
|
13ef677e556d0a1d154e45b052fe016256057f65
|
refs/heads/main
| 2023-09-06T01:19:49.598662
| 2023-09-04T07:01:30
| 2023-09-04T07:01:30
| 208,145,128
| 387
| 110
|
Apache-2.0
| 2023-09-14T20:48:00
| 2019-09-12T20:57:39
|
C++
|
UTF-8
|
C
| false
| false
| 8,039
|
c
|
x86_64.c
|
// Copyright 2021 The IREE Authors
//
// Licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "iree/base/api.h"
#include "iree/hal/local/elf/arch.h"
#include "iree/hal/local/elf/elf_types.h"
#if defined(IREE_ARCH_X86_64)
// Documentation:
// https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf
//==============================================================================
// ELF machine type/ABI
//==============================================================================
bool iree_elf_machine_is_valid(iree_elf_half_t machine) {
return machine == 0x3E; // EM_X86_64 / 62
}
//==============================================================================
// ELF relocations
//==============================================================================
enum {
IREE_ELF_R_X86_64_NONE = 0, // No reloc
IREE_ELF_R_X86_64_64 = 1, // Direct 64 bit
IREE_ELF_R_X86_64_PC32 = 2, // PC relative 32 bit signed
IREE_ELF_R_X86_64_GOT32 = 3, // 32 bit GOT entry
IREE_ELF_R_X86_64_PLT32 = 4, // 32 bit PLT address
IREE_ELF_R_X86_64_COPY = 5, // Copy symbol at runtime
IREE_ELF_R_X86_64_GLOB_DAT = 6, // Create GOT entry
IREE_ELF_R_X86_64_JUMP_SLOT = 7, // Create PLT entry
IREE_ELF_R_X86_64_RELATIVE = 8, // Adjust by program base
IREE_ELF_R_X86_64_GOTPCREL = 9, // 32 bit signed pc relative offset to GOT
IREE_ELF_R_X86_64_32 = 10, // Direct 32 bit zero extended
IREE_ELF_R_X86_64_32S = 11, // Direct 32 bit sign extended
IREE_ELF_R_X86_64_16 = 12, // Direct 16 bit zero extended
IREE_ELF_R_X86_64_PC16 = 13, // 16 bit sign extended pc relative
IREE_ELF_R_X86_64_8 = 14, // Direct 8 bit sign extended
IREE_ELF_R_X86_64_PC8 = 15, // 8 bit sign extended pc relative
IREE_ELF_R_X86_64_PC64 = 24, // Place relative 64-bit signed
};
static iree_status_t iree_elf_arch_x86_64_apply_rela(
iree_elf_relocation_state_t* state, iree_host_size_t rela_count,
const iree_elf_rela_t* rela_table) {
for (iree_host_size_t i = 0; i < rela_count; ++i) {
const iree_elf_rela_t* rela = &rela_table[i];
uint32_t type = IREE_ELF_R_TYPE(rela->r_info);
if (type == IREE_ELF_R_X86_64_NONE) continue;
iree_elf_addr_t sym_addr = 0;
uint32_t sym_ordinal = (uint32_t)IREE_ELF_R_SYM(rela->r_info);
if (sym_ordinal != 0) {
if (sym_ordinal >= state->dynsym_count) {
return iree_make_status(IREE_STATUS_OUT_OF_RANGE,
"invalid symbol in relocation: %u",
sym_ordinal);
}
sym_addr = (iree_elf_addr_t)state->vaddr_bias +
state->dynsym[sym_ordinal].st_value;
}
iree_elf_addr_t instr_ptr =
(iree_elf_addr_t)state->vaddr_bias + rela->r_offset;
switch (type) {
// case IREE_ELF_R_X86_64_NONE: early-exit above
case IREE_ELF_R_X86_64_RELATIVE:
*(uint64_t*)instr_ptr = (uint64_t)(state->vaddr_bias + rela->r_addend);
break;
case IREE_ELF_R_X86_64_JUMP_SLOT:
*(uint64_t*)instr_ptr = (uint64_t)sym_addr;
break;
case IREE_ELF_R_X86_64_GLOB_DAT:
*(uint64_t*)instr_ptr = (uint64_t)sym_addr;
break;
case IREE_ELF_R_X86_64_COPY:
*(uint64_t*)instr_ptr = (uint64_t)sym_addr;
break;
case IREE_ELF_R_X86_64_64:
*(uint64_t*)instr_ptr = (uint64_t)(sym_addr + rela->r_addend);
break;
case IREE_ELF_R_X86_64_32:
*(uint32_t*)instr_ptr = (uint32_t)(sym_addr + rela->r_addend);
break;
case IREE_ELF_R_X86_64_32S:
*(int32_t*)instr_ptr = (int32_t)(sym_addr + rela->r_addend);
break;
case IREE_ELF_R_X86_64_PC32:
*(uint32_t*)instr_ptr =
(uint32_t)(sym_addr + rela->r_addend - instr_ptr);
break;
default:
return iree_make_status(IREE_STATUS_UNIMPLEMENTED,
"unimplemented x86_64 relocation type %08X",
type);
}
}
return iree_ok_status();
}
iree_status_t iree_elf_arch_apply_relocations(
iree_elf_relocation_state_t* state) {
// Gather the relevant relocation tables.
iree_host_size_t rela_count = 0;
const iree_elf_rela_t* rela_table = NULL;
iree_host_size_t plt_rela_count = 0;
const iree_elf_rela_t* plt_rela_table = NULL;
for (iree_host_size_t i = 0; i < state->dyn_table_count; ++i) {
const iree_elf_dyn_t* dyn = &state->dyn_table[i];
switch (dyn->d_tag) {
case IREE_ELF_DT_RELA:
rela_table =
(const iree_elf_rela_t*)(state->vaddr_bias + dyn->d_un.d_ptr);
break;
case IREE_ELF_DT_RELASZ:
rela_count = dyn->d_un.d_val / sizeof(iree_elf_rela_t);
break;
case IREE_ELF_DT_PLTREL:
// Type of reloc in PLT; we expect DT_RELA right now.
if (dyn->d_un.d_val != IREE_ELF_DT_RELA) {
return iree_make_status(IREE_STATUS_FAILED_PRECONDITION,
"unsupported DT_PLTREL != DT_RELA");
}
break;
case IREE_ELF_DT_JMPREL:
plt_rela_table =
(const iree_elf_rela_t*)(state->vaddr_bias + dyn->d_un.d_ptr);
break;
case IREE_ELF_DT_PLTRELSZ:
plt_rela_count = dyn->d_un.d_val / sizeof(iree_elf_rela_t);
break;
case IREE_ELF_DT_REL:
case IREE_ELF_DT_RELSZ:
return iree_make_status(IREE_STATUS_FAILED_PRECONDITION,
"unsupported DT_REL relocations");
default:
// Ignored.
break;
}
}
if (!rela_table) rela_count = 0;
if (!plt_rela_table) plt_rela_count = 0;
if (rela_count > 0) {
IREE_RETURN_IF_ERROR(
iree_elf_arch_x86_64_apply_rela(state, rela_count, rela_table));
}
if (plt_rela_count > 0) {
IREE_RETURN_IF_ERROR(
iree_elf_arch_x86_64_apply_rela(state, plt_rela_count, plt_rela_table));
}
return iree_ok_status();
}
//==============================================================================
// Cross-ABI function calls
//==============================================================================
// System V AMD64 ABI (used in IREE):
// https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf
// Arguments:
// RDI, RSI, RDX, RCX, R8, R9, [stack]...
// Results:
// RAX, RDX
//
// Everything but Windows uses this convention (linux/bsd/mac/etc) and as such
// we can just use nice little C thunks.
#if defined(IREE_PLATFORM_WINDOWS)
// Host is using the Microsoft x64 calling convention and we need to translate
// to the System V AMD64 ABI conventions. Unfortunately MSVC does not support
// inline assembly and we have to outline the calls in x86_64_msvc.asm.
#else
void iree_elf_call_v_v(const void* symbol_ptr) {
typedef void (*ptr_t)(void);
((ptr_t)symbol_ptr)();
}
void* iree_elf_call_p_i(const void* symbol_ptr, int a0) {
typedef void* (*ptr_t)(int);
return ((ptr_t)symbol_ptr)(a0);
}
void* iree_elf_call_p_ip(const void* symbol_ptr, int a0, void* a1) {
typedef void* (*ptr_t)(int, void*);
return ((ptr_t)symbol_ptr)(a0, a1);
}
int iree_elf_call_i_p(const void* symbol_ptr, void* a0) {
typedef int (*ptr_t)(void*);
return ((ptr_t)symbol_ptr)(a0);
}
int iree_elf_call_i_ppp(const void* symbol_ptr, void* a0, void* a1, void* a2) {
typedef int (*ptr_t)(void*, void*, void*);
return ((ptr_t)symbol_ptr)(a0, a1, a2);
}
void* iree_elf_call_p_ppp(const void* symbol_ptr, void* a0, void* a1,
void* a2) {
typedef void* (*ptr_t)(void*, void*, void*);
return ((ptr_t)symbol_ptr)(a0, a1, a2);
}
int iree_elf_thunk_i_ppp(const void* symbol_ptr, void* a0, void* a1, void* a2) {
typedef int (*ptr_t)(void*, void*, void*);
return ((ptr_t)symbol_ptr)(a0, a1, a2);
}
#endif // IREE_PLATFORM_WINDOWS
#endif // IREE_ARCH_X86_64
|
8d38560f152be021ed2d47de746db0c1e8735883
|
7c857119fe1505b1d80d6e62969661c06dc1a2f4
|
/MemoryFix/AptioMemoryFix/AsmFuncs.h
|
2367f506a28f1262280e9e37e2a5c46d386191a4
|
[
"BSD-2-Clause"
] |
permissive
|
CloverHackyColor/CloverBootloader
|
7042ca7dd6b513d22be591a295e49071ae1482ee
|
2711170df4f60b2ae5aa20add3e00f35cf57b7e5
|
refs/heads/master
| 2023-08-30T22:14:34.590134
| 2023-08-27T19:14:02
| 2023-08-27T19:14:02
| 205,810,121
| 4,734
| 770
|
BSD-2-Clause
| 2023-09-03T12:41:33
| 2019-09-02T08:22:14
|
C
|
UTF-8
|
C
| false
| false
| 1,169
|
h
|
AsmFuncs.h
|
/**
Some assembler helper functions plus boot.efi kernel jump callback
by dmazar
**/
#ifndef APTIOFIX_ASM_FUNCS_H
#define APTIOFIX_ASM_FUNCS_H
#include <Library/BaseLib.h>
/** Save 64 bit state that will be restored on callback. */
VOID
EFIAPI
AsmPrepareJumpFromKernel (
VOID
);
/** Start and end address of the 32 and 64 bit code
that is copied to kernel entry address to jump back
to our code, to AsmJumpFromKernel().
*/
extern UINT8 EntryPatchCode;
extern UINT8 EntryPatchCodeEnd;
/** Callback function, 32 and 64 bit, that is called when boot.efi jumps to kernel address. */
VOID
EFIAPI
AsmJumpFromKernel (
VOID
);
/** 32 bit function start and end that copies kernel to proper mem and jumps to kernel. */
extern UINT8 JumpToKernel;
extern UINT8 JumpToKernel32;
extern UINT8 JumpToKernel64;
extern UINT8 JumpToKernelEnd;
extern UINTN SavedCR3;
extern IA32_DESCRIPTOR SavedGDTR;
extern IA32_DESCRIPTOR SavedIDTR;
extern UINT64 AsmKernelEntry;
extern UINT64 JumpToKernel32Addr;
extern UINT64 JumpToKernel64Addr;
#endif // APTIOFIX_ASM_FUNCS_H
|
d768eeae07e2563517b91063d7ce05e3827144b0
|
03b2c80dbc41e904b167d504666e27d798da5447
|
/src/info.h
|
adfa7b04c025e6b54907c2212eeca70373df044d
|
[
"Unlicense"
] |
permissive
|
nptcl/npt
|
7c1570b497cdce0b8971cb445fbc04cb500232d3
|
aa714a2370ac9fa5348c2fc96159b40b9de3de07
|
refs/heads/master
| 2023-03-20T09:13:54.669118
| 2022-07-02T11:17:44
| 2022-07-02T11:17:44
| 171,985,905
| 160
| 12
|
Unlicense
| 2023-03-11T01:36:37
| 2019-02-22T03:11:34
|
C
|
UTF-8
|
C
| false
| false
| 908
|
h
|
info.h
|
#ifndef __INFO_HEADER__
#define __INFO_HEADER__
/*
* Print object for debug.
* Similary to print-object function but info don't use stream object.
*/
#include "define.h"
#include "typedef.h"
#define info _n(info)
#define info_noeol _n(info_noeol)
#define infobit _n(infobit)
#define infoprint _n(infoprint)
#define infoprint_depth _n(infoprint_depth)
#define infoprint_noeol _n(infoprint_noeol)
#define infoprint_once _n(infoprint_once)
#define infoerror _n(infoerror)
#define infosystem _n(infosystem)
#define infotype _n(infotype)
void info(const char *, ...);
void info_noeol(const char *, ...);
void infobit(addr pos);
void infoprint(addr pos);
void infoprint_depth(addr pos, int depth);
void infoprint_noeol(addr pos);
void infoprint_once(addr pos, const char *name);
void infoerror(const char *, int, const char *, const char *, ...);
void infosystem(void);
void infotype(addr pos);
#endif
|
377b4932c93159eb55f05a5386478ee9c0828c9b
|
5ff4b6986e6799bc0e143e060bafc14369030d8b
|
/software/omp/omp_test/main.c
|
6cde22a88c6b1f4f92fc5d5b73cceb11462889c7
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"GPL-1.0-or-later",
"LLVM-exception",
"Apache-2.0",
"BSD-3-Clause"
] |
permissive
|
pulp-platform/mempool
|
7583204b2436cfc12ed95599463e51ad4df51557
|
c98fb3ada4f255623eaf9b09861f397a60c3d96b
|
refs/heads/main
| 2023-08-08T09:07:56.696580
| 2023-07-27T17:24:38
| 2023-07-27T17:24:38
| 223,218,149
| 178
| 28
|
Apache-2.0
| 2023-07-27T17:24:39
| 2019-11-21T16:34:37
|
C
|
UTF-8
|
C
| false
| false
| 2,488
|
c
|
main.c
|
// Copyright 2022 ETH Zurich and University of Bologna.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
#include <stdint.h>
#include <string.h>
#include "encoding.h"
#include "libgomp.h"
#include "printf.h"
#include "runtime.h"
#include "synchronization.h"
#define REPETITIONS 1 /* Number of times to run each test */
void work1() {
int sum = 0;
for (int i = 0; i < 100; i++) {
sum++;
}
}
int test_omp_parallel_for() {
int sum = 0;
#pragma omp parallel shared(sum)
{
#pragma omp for reduction(+ : sum)
for (int i = 0; i <= 100; i++) {
sum += i;
}
}
return sum;
}
int test_omp_parallel_for_dynamic() {
int sum = 0;
#pragma omp parallel shared(sum)
{
#pragma omp for schedule(dynamic, 16) reduction(+ : sum)
for (int i = 0; i <= 100; i++) {
sum += i;
}
}
return sum;
}
int test_omp_parallel_for_dynamic_static() {
int sum = 0;
#pragma omp parallel shared(sum)
{
#pragma omp for schedule(dynamic, 16) reduction(+ : sum)
for (int i = 0; i <= 100; i++) {
sum += i;
}
sum = 0;
#pragma omp for schedule(static) reduction(+ : sum)
for (int i = -100; i <= 0; i++) {
sum += i;
}
}
return sum;
}
int test_omp_many() {
int sum = 0;
#pragma omp parallel shared(sum)
{
#pragma omp for schedule(dynamic, 16) reduction(+ : sum)
for (int i = 0; i <= 100; i++) {
sum += i;
}
#pragma omp barrier
#pragma omp master
{
printf("first sum: %d\n", sum);
sum = 0;
}
#pragma omp barrier
#pragma omp for schedule(static) reduction(+ : sum)
for (int i = -10; i <= 0; i++) {
sum += i;
}
#pragma omp barrier
#pragma omp single
{ printf("second sum: %d\n", sum); }
}
return sum;
}
int main() {
uint32_t core_id = mempool_get_core_id();
uint32_t i;
if (core_id == 0) {
printf("Master Thread start\n");
for (i = 0; i < REPETITIONS; i++) {
printf("Test: %d\n", i);
printf("For loop-sum is: %d\n", test_omp_parallel_for());
printf("For loop dynamic-sum is: %d\n", test_omp_parallel_for_dynamic());
printf("For loop dynamic-static-sum is: %d\n",
test_omp_parallel_for_dynamic_static());
printf("Test many omp-sum is: %d\n", test_omp_many());
printf("Test finished: %d\n", i);
}
printf("Master Thread end\n\n\n");
} else {
while (1) {
mempool_wfi();
run_task(core_id);
}
}
return 0;
}
|
5e1968e23cef5fd022bc1f0f1a836395be5c649a
|
f7dc806f341ef5dbb0e11252a4693003a66853d5
|
/thirdparty/freetype/src/otvalid/otvcommn.c
|
b94d8a065108ca0c04253b6a0081cc1fef59198e
|
[
"LicenseRef-scancode-free-unknown",
"MIT",
"CC-BY-4.0",
"OFL-1.1",
"Bison-exception-2.2",
"CC0-1.0",
"LicenseRef-scancode-nvidia-2002",
"LicenseRef-scancode-other-permissive",
"GPL-3.0-only",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense",
"BSL-1.0",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unicode",
"BSD-2-Clause",
"FTL",
"GPL-3.0-or-later",
"Bitstream-Vera",
"Zlib",
"MPL-2.0",
"MIT-Modern-Variant",
"JSON",
"Libpng",
"GPL-2.0-only",
"LicenseRef-scancode-unknown",
"GPL-1.0-or-later",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
godotengine/godot
|
8a2419750f4851d1426a8f3bcb52cac5c86f23c2
|
970be7afdc111ccc7459d7ef3560de70e6d08c80
|
refs/heads/master
| 2023-08-21T14:37:00.262883
| 2023-08-21T06:26:15
| 2023-08-21T06:26:15
| 15,634,981
| 68,852
| 18,388
|
MIT
| 2023-09-14T21:42:16
| 2014-01-04T16:05:36
|
C++
|
UTF-8
|
C
| false
| false
| 27,533
|
c
|
otvcommn.c
|
/****************************************************************************
*
* otvcommn.c
*
* OpenType common tables validation (body).
*
* Copyright (C) 2004-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#include "otvcommn.h"
/**************************************************************************
*
* The macro FT_COMPONENT is used in trace mode. It is an implicit
* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
* messages during execution.
*/
#undef FT_COMPONENT
#define FT_COMPONENT otvcommon
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** COVERAGE TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
FT_LOCAL_DEF( void )
otv_Coverage_validate( FT_Bytes table,
OTV_Validator otvalid,
FT_Int expected_count )
{
FT_Bytes p = table;
FT_UInt CoverageFormat;
FT_UInt total = 0;
OTV_NAME_ENTER( "Coverage" );
OTV_LIMIT_CHECK( 4 );
CoverageFormat = FT_NEXT_USHORT( p );
OTV_TRACE(( " (format %d)\n", CoverageFormat ));
switch ( CoverageFormat )
{
case 1: /* CoverageFormat1 */
{
FT_UInt GlyphCount;
FT_UInt i;
GlyphCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount ));
OTV_LIMIT_CHECK( GlyphCount * 2 ); /* GlyphArray */
for ( i = 0; i < GlyphCount; i++ )
{
FT_UInt gid;
gid = FT_NEXT_USHORT( p );
if ( gid >= otvalid->glyph_count )
FT_INVALID_GLYPH_ID;
}
total = GlyphCount;
}
break;
case 2: /* CoverageFormat2 */
{
FT_UInt n, RangeCount;
FT_UInt Start, End, StartCoverageIndex, last = 0;
RangeCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (RangeCount = %d)\n", RangeCount ));
OTV_LIMIT_CHECK( RangeCount * 6 );
/* RangeRecord */
for ( n = 0; n < RangeCount; n++ )
{
Start = FT_NEXT_USHORT( p );
End = FT_NEXT_USHORT( p );
StartCoverageIndex = FT_NEXT_USHORT( p );
if ( Start > End || StartCoverageIndex != total )
FT_INVALID_DATA;
if ( End >= otvalid->glyph_count )
FT_INVALID_GLYPH_ID;
if ( n > 0 && Start <= last )
FT_INVALID_DATA;
total += End - Start + 1;
last = End;
}
}
break;
default:
FT_INVALID_FORMAT;
}
/* Generally, a coverage table offset has an associated count field. */
/* The number of glyphs in the table should match this field. If */
/* there is no associated count, a value of -1 tells us not to check. */
if ( expected_count != -1 && (FT_UInt)expected_count != total )
FT_INVALID_DATA;
OTV_EXIT;
}
FT_LOCAL_DEF( FT_UInt )
otv_Coverage_get_first( FT_Bytes table )
{
FT_Bytes p = table;
p += 4; /* skip CoverageFormat and Glyph/RangeCount */
return FT_NEXT_USHORT( p );
}
FT_LOCAL_DEF( FT_UInt )
otv_Coverage_get_last( FT_Bytes table )
{
FT_Bytes p = table;
FT_UInt CoverageFormat = FT_NEXT_USHORT( p );
FT_UInt count = FT_NEXT_USHORT( p ); /* Glyph/RangeCount */
FT_UInt result = 0;
if ( !count )
return result;
switch ( CoverageFormat )
{
case 1:
p += ( count - 1 ) * 2;
result = FT_NEXT_USHORT( p );
break;
case 2:
p += ( count - 1 ) * 6 + 2;
result = FT_NEXT_USHORT( p );
break;
default:
;
}
return result;
}
FT_LOCAL_DEF( FT_UInt )
otv_Coverage_get_count( FT_Bytes table )
{
FT_Bytes p = table;
FT_UInt CoverageFormat = FT_NEXT_USHORT( p );
FT_UInt count = FT_NEXT_USHORT( p ); /* Glyph/RangeCount */
FT_UInt result = 0;
switch ( CoverageFormat )
{
case 1:
return count;
case 2:
{
FT_UInt Start, End;
for ( ; count > 0; count-- )
{
Start = FT_NEXT_USHORT( p );
End = FT_NEXT_USHORT( p );
p += 2; /* skip StartCoverageIndex */
result += End - Start + 1;
}
}
break;
default:
;
}
return result;
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** CLASS DEFINITION TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
FT_LOCAL_DEF( void )
otv_ClassDef_validate( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt ClassFormat;
OTV_NAME_ENTER( "ClassDef" );
OTV_LIMIT_CHECK( 4 );
ClassFormat = FT_NEXT_USHORT( p );
OTV_TRACE(( " (format %d)\n", ClassFormat ));
switch ( ClassFormat )
{
case 1: /* ClassDefFormat1 */
{
FT_UInt StartGlyph;
FT_UInt GlyphCount;
OTV_LIMIT_CHECK( 4 );
StartGlyph = FT_NEXT_USHORT( p );
GlyphCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount ));
OTV_LIMIT_CHECK( GlyphCount * 2 ); /* ClassValueArray */
if ( StartGlyph + GlyphCount - 1 >= otvalid->glyph_count )
FT_INVALID_GLYPH_ID;
}
break;
case 2: /* ClassDefFormat2 */
{
FT_UInt n, ClassRangeCount;
FT_UInt Start, End, last = 0;
ClassRangeCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (ClassRangeCount = %d)\n", ClassRangeCount ));
OTV_LIMIT_CHECK( ClassRangeCount * 6 );
/* ClassRangeRecord */
for ( n = 0; n < ClassRangeCount; n++ )
{
Start = FT_NEXT_USHORT( p );
End = FT_NEXT_USHORT( p );
p += 2; /* skip Class */
if ( Start > End || ( n > 0 && Start <= last ) )
FT_INVALID_DATA;
if ( End >= otvalid->glyph_count )
FT_INVALID_GLYPH_ID;
last = End;
}
}
break;
default:
FT_INVALID_FORMAT;
}
/* no need to check glyph indices used as input to class definition */
/* tables since even invalid glyph indices return a meaningful result */
OTV_EXIT;
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** DEVICE TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
FT_LOCAL_DEF( void )
otv_Device_validate( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt StartSize, EndSize, DeltaFormat, count;
OTV_NAME_ENTER( "Device" );
OTV_LIMIT_CHECK( 6 );
StartSize = FT_NEXT_USHORT( p );
EndSize = FT_NEXT_USHORT( p );
DeltaFormat = FT_NEXT_USHORT( p );
if ( DeltaFormat == 0x8000U )
{
/* VariationIndex, nothing to do */
}
else
{
if ( DeltaFormat < 1 || DeltaFormat > 3 )
FT_INVALID_FORMAT;
if ( EndSize < StartSize )
FT_INVALID_DATA;
count = EndSize - StartSize + 1;
OTV_LIMIT_CHECK( ( 1 << DeltaFormat ) * count / 8 ); /* DeltaValue */
}
OTV_EXIT;
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** LOOKUPS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* uses otvalid->type_count */
/* uses otvalid->type_funcs */
FT_LOCAL_DEF( void )
otv_Lookup_validate( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt LookupType, LookupFlag, SubTableCount;
OTV_Validate_Func validate;
OTV_NAME_ENTER( "Lookup" );
OTV_LIMIT_CHECK( 6 );
LookupType = FT_NEXT_USHORT( p );
LookupFlag = FT_NEXT_USHORT( p );
SubTableCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (type %d)\n", LookupType ));
if ( LookupType == 0 || LookupType > otvalid->type_count )
FT_INVALID_DATA;
validate = otvalid->type_funcs[LookupType - 1];
OTV_TRACE(( " (SubTableCount = %d)\n", SubTableCount ));
OTV_LIMIT_CHECK( SubTableCount * 2 );
/* SubTable */
for ( ; SubTableCount > 0; SubTableCount-- )
validate( table + FT_NEXT_USHORT( p ), otvalid );
if ( LookupFlag & 0x10 )
OTV_LIMIT_CHECK( 2 ); /* MarkFilteringSet */
OTV_EXIT;
}
/* uses valid->lookup_count */
FT_LOCAL_DEF( void )
otv_LookupList_validate( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt LookupCount;
OTV_NAME_ENTER( "LookupList" );
OTV_LIMIT_CHECK( 2 );
LookupCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (LookupCount = %d)\n", LookupCount ));
OTV_LIMIT_CHECK( LookupCount * 2 );
otvalid->lookup_count = LookupCount;
/* Lookup */
for ( ; LookupCount > 0; LookupCount-- )
otv_Lookup_validate( table + FT_NEXT_USHORT( p ), otvalid );
OTV_EXIT;
}
static FT_UInt
otv_LookupList_get_count( FT_Bytes table )
{
return FT_NEXT_USHORT( table );
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** FEATURES *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* uses otvalid->lookup_count */
FT_LOCAL_DEF( void )
otv_Feature_validate( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt LookupCount;
OTV_NAME_ENTER( "Feature" );
OTV_LIMIT_CHECK( 4 );
p += 2; /* skip FeatureParams (unused) */
LookupCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (LookupCount = %d)\n", LookupCount ));
OTV_LIMIT_CHECK( LookupCount * 2 );
/* LookupListIndex */
for ( ; LookupCount > 0; LookupCount-- )
if ( FT_NEXT_USHORT( p ) >= otvalid->lookup_count )
FT_INVALID_DATA;
OTV_EXIT;
}
static FT_UInt
otv_Feature_get_count( FT_Bytes table )
{
return FT_NEXT_USHORT( table );
}
/* sets otvalid->lookup_count */
FT_LOCAL_DEF( void )
otv_FeatureList_validate( FT_Bytes table,
FT_Bytes lookups,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt FeatureCount;
OTV_NAME_ENTER( "FeatureList" );
OTV_LIMIT_CHECK( 2 );
FeatureCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (FeatureCount = %d)\n", FeatureCount ));
OTV_LIMIT_CHECK( FeatureCount * 2 );
otvalid->lookup_count = otv_LookupList_get_count( lookups );
/* FeatureRecord */
for ( ; FeatureCount > 0; FeatureCount-- )
{
p += 4; /* skip FeatureTag */
/* Feature */
otv_Feature_validate( table + FT_NEXT_USHORT( p ), otvalid );
}
OTV_EXIT;
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** LANGUAGE SYSTEM *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* uses otvalid->extra1 (number of features) */
FT_LOCAL_DEF( void )
otv_LangSys_validate( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt ReqFeatureIndex;
FT_UInt FeatureCount;
OTV_NAME_ENTER( "LangSys" );
OTV_LIMIT_CHECK( 6 );
p += 2; /* skip LookupOrder (unused) */
ReqFeatureIndex = FT_NEXT_USHORT( p );
FeatureCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (ReqFeatureIndex = %d)\n", ReqFeatureIndex ));
OTV_TRACE(( " (FeatureCount = %d)\n", FeatureCount ));
if ( ReqFeatureIndex != 0xFFFFU && ReqFeatureIndex >= otvalid->extra1 )
FT_INVALID_DATA;
OTV_LIMIT_CHECK( FeatureCount * 2 );
/* FeatureIndex */
for ( ; FeatureCount > 0; FeatureCount-- )
if ( FT_NEXT_USHORT( p ) >= otvalid->extra1 )
FT_INVALID_DATA;
OTV_EXIT;
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** SCRIPTS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
FT_LOCAL_DEF( void )
otv_Script_validate( FT_Bytes table,
OTV_Validator otvalid )
{
FT_UInt DefaultLangSys, LangSysCount;
FT_Bytes p = table;
OTV_NAME_ENTER( "Script" );
OTV_LIMIT_CHECK( 4 );
DefaultLangSys = FT_NEXT_USHORT( p );
LangSysCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (LangSysCount = %d)\n", LangSysCount ));
if ( DefaultLangSys != 0 )
otv_LangSys_validate( table + DefaultLangSys, otvalid );
OTV_LIMIT_CHECK( LangSysCount * 6 );
/* LangSysRecord */
for ( ; LangSysCount > 0; LangSysCount-- )
{
p += 4; /* skip LangSysTag */
/* LangSys */
otv_LangSys_validate( table + FT_NEXT_USHORT( p ), otvalid );
}
OTV_EXIT;
}
/* sets otvalid->extra1 (number of features) */
FT_LOCAL_DEF( void )
otv_ScriptList_validate( FT_Bytes table,
FT_Bytes features,
OTV_Validator otvalid )
{
FT_UInt ScriptCount;
FT_Bytes p = table;
OTV_NAME_ENTER( "ScriptList" );
OTV_LIMIT_CHECK( 2 );
ScriptCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (ScriptCount = %d)\n", ScriptCount ));
OTV_LIMIT_CHECK( ScriptCount * 6 );
otvalid->extra1 = otv_Feature_get_count( features );
/* ScriptRecord */
for ( ; ScriptCount > 0; ScriptCount-- )
{
p += 4; /* skip ScriptTag */
otv_Script_validate( table + FT_NEXT_USHORT( p ), otvalid ); /* Script */
}
OTV_EXIT;
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** UTILITY FUNCTIONS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*
u: uint16
ux: unit16 [x]
s: struct
sx: struct [x]
sxy: struct [x], using external y count
x: uint16 x
C: Coverage
O: Offset
On: Offset (NULL)
Ox: Offset [x]
Onx: Offset (NULL) [x]
*/
FT_LOCAL_DEF( void )
otv_x_Ox( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt Count;
OTV_Validate_Func func;
OTV_ENTER;
OTV_LIMIT_CHECK( 2 );
Count = FT_NEXT_USHORT( p );
OTV_TRACE(( " (Count = %d)\n", Count ));
OTV_LIMIT_CHECK( Count * 2 );
otvalid->nesting_level++;
func = otvalid->func[otvalid->nesting_level];
for ( ; Count > 0; Count-- )
func( table + FT_NEXT_USHORT( p ), otvalid );
otvalid->nesting_level--;
OTV_EXIT;
}
FT_LOCAL_DEF( void )
otv_u_C_x_Ox( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt Count, Coverage;
OTV_Validate_Func func;
OTV_ENTER;
p += 2; /* skip Format */
OTV_LIMIT_CHECK( 4 );
Coverage = FT_NEXT_USHORT( p );
Count = FT_NEXT_USHORT( p );
OTV_TRACE(( " (Count = %d)\n", Count ));
otv_Coverage_validate( table + Coverage, otvalid, (FT_Int)Count );
OTV_LIMIT_CHECK( Count * 2 );
otvalid->nesting_level++;
func = otvalid->func[otvalid->nesting_level];
for ( ; Count > 0; Count-- )
func( table + FT_NEXT_USHORT( p ), otvalid );
otvalid->nesting_level--;
OTV_EXIT;
}
/* uses otvalid->extra1 (if > 0: array value limit) */
FT_LOCAL_DEF( void )
otv_x_ux( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt Count;
OTV_ENTER;
OTV_LIMIT_CHECK( 2 );
Count = FT_NEXT_USHORT( p );
OTV_TRACE(( " (Count = %d)\n", Count ));
OTV_LIMIT_CHECK( Count * 2 );
if ( otvalid->extra1 )
{
for ( ; Count > 0; Count-- )
if ( FT_NEXT_USHORT( p ) >= otvalid->extra1 )
FT_INVALID_DATA;
}
OTV_EXIT;
}
/* `ux' in the function's name is not really correct since only x-1 */
/* elements are tested */
/* uses otvalid->extra1 (array value limit) */
FT_LOCAL_DEF( void )
otv_x_y_ux_sy( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt Count1, Count2;
OTV_ENTER;
OTV_LIMIT_CHECK( 4 );
Count1 = FT_NEXT_USHORT( p );
Count2 = FT_NEXT_USHORT( p );
OTV_TRACE(( " (Count1 = %d)\n", Count1 ));
OTV_TRACE(( " (Count2 = %d)\n", Count2 ));
if ( Count1 == 0 )
FT_INVALID_DATA;
OTV_LIMIT_CHECK( ( Count1 - 1 ) * 2 + Count2 * 4 );
p += ( Count1 - 1 ) * 2;
for ( ; Count2 > 0; Count2-- )
{
if ( FT_NEXT_USHORT( p ) >= Count1 )
FT_INVALID_DATA;
if ( FT_NEXT_USHORT( p ) >= otvalid->extra1 )
FT_INVALID_DATA;
}
OTV_EXIT;
}
/* `uy' in the function's name is not really correct since only y-1 */
/* elements are tested */
/* uses otvalid->extra1 (array value limit) */
FT_LOCAL_DEF( void )
otv_x_ux_y_uy_z_uz_p_sp( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt BacktrackCount, InputCount, LookaheadCount;
FT_UInt Count;
OTV_ENTER;
OTV_LIMIT_CHECK( 2 );
BacktrackCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (BacktrackCount = %d)\n", BacktrackCount ));
OTV_LIMIT_CHECK( BacktrackCount * 2 + 2 );
p += BacktrackCount * 2;
InputCount = FT_NEXT_USHORT( p );
if ( InputCount == 0 )
FT_INVALID_DATA;
OTV_TRACE(( " (InputCount = %d)\n", InputCount ));
OTV_LIMIT_CHECK( InputCount * 2 );
p += ( InputCount - 1 ) * 2;
LookaheadCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (LookaheadCount = %d)\n", LookaheadCount ));
OTV_LIMIT_CHECK( LookaheadCount * 2 + 2 );
p += LookaheadCount * 2;
Count = FT_NEXT_USHORT( p );
OTV_TRACE(( " (Count = %d)\n", Count ));
OTV_LIMIT_CHECK( Count * 4 );
for ( ; Count > 0; Count-- )
{
if ( FT_NEXT_USHORT( p ) >= InputCount )
FT_INVALID_DATA;
if ( FT_NEXT_USHORT( p ) >= otvalid->extra1 )
FT_INVALID_DATA;
}
OTV_EXIT;
}
/* sets otvalid->extra1 (valid->lookup_count) */
FT_LOCAL_DEF( void )
otv_u_O_O_x_Onx( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt Coverage, ClassDef, ClassSetCount;
OTV_Validate_Func func;
OTV_ENTER;
p += 2; /* skip Format */
OTV_LIMIT_CHECK( 6 );
Coverage = FT_NEXT_USHORT( p );
ClassDef = FT_NEXT_USHORT( p );
ClassSetCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (ClassSetCount = %d)\n", ClassSetCount ));
otv_Coverage_validate( table + Coverage, otvalid, -1 );
otv_ClassDef_validate( table + ClassDef, otvalid );
OTV_LIMIT_CHECK( ClassSetCount * 2 );
otvalid->nesting_level++;
func = otvalid->func[otvalid->nesting_level];
otvalid->extra1 = otvalid->lookup_count;
for ( ; ClassSetCount > 0; ClassSetCount-- )
{
FT_UInt offset = FT_NEXT_USHORT( p );
if ( offset )
func( table + offset, otvalid );
}
otvalid->nesting_level--;
OTV_EXIT;
}
/* uses otvalid->lookup_count */
FT_LOCAL_DEF( void )
otv_u_x_y_Ox_sy( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt GlyphCount, Count, count1;
OTV_ENTER;
p += 2; /* skip Format */
OTV_LIMIT_CHECK( 4 );
GlyphCount = FT_NEXT_USHORT( p );
Count = FT_NEXT_USHORT( p );
OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount ));
OTV_TRACE(( " (Count = %d)\n", Count ));
OTV_LIMIT_CHECK( GlyphCount * 2 + Count * 4 );
for ( count1 = GlyphCount; count1 > 0; count1-- )
otv_Coverage_validate( table + FT_NEXT_USHORT( p ), otvalid, -1 );
for ( ; Count > 0; Count-- )
{
if ( FT_NEXT_USHORT( p ) >= GlyphCount )
FT_INVALID_DATA;
if ( FT_NEXT_USHORT( p ) >= otvalid->lookup_count )
FT_INVALID_DATA;
}
OTV_EXIT;
}
/* sets otvalid->extra1 (valid->lookup_count) */
FT_LOCAL_DEF( void )
otv_u_O_O_O_O_x_Onx( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt Coverage;
FT_UInt BacktrackClassDef, InputClassDef, LookaheadClassDef;
FT_UInt ChainClassSetCount;
OTV_Validate_Func func;
OTV_ENTER;
p += 2; /* skip Format */
OTV_LIMIT_CHECK( 10 );
Coverage = FT_NEXT_USHORT( p );
BacktrackClassDef = FT_NEXT_USHORT( p );
InputClassDef = FT_NEXT_USHORT( p );
LookaheadClassDef = FT_NEXT_USHORT( p );
ChainClassSetCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (ChainClassSetCount = %d)\n", ChainClassSetCount ));
otv_Coverage_validate( table + Coverage, otvalid, -1 );
otv_ClassDef_validate( table + BacktrackClassDef, otvalid );
otv_ClassDef_validate( table + InputClassDef, otvalid );
otv_ClassDef_validate( table + LookaheadClassDef, otvalid );
OTV_LIMIT_CHECK( ChainClassSetCount * 2 );
otvalid->nesting_level++;
func = otvalid->func[otvalid->nesting_level];
otvalid->extra1 = otvalid->lookup_count;
for ( ; ChainClassSetCount > 0; ChainClassSetCount-- )
{
FT_UInt offset = FT_NEXT_USHORT( p );
if ( offset )
func( table + offset, otvalid );
}
otvalid->nesting_level--;
OTV_EXIT;
}
/* uses otvalid->lookup_count */
FT_LOCAL_DEF( void )
otv_u_x_Ox_y_Oy_z_Oz_p_sp( FT_Bytes table,
OTV_Validator otvalid )
{
FT_Bytes p = table;
FT_UInt BacktrackGlyphCount, InputGlyphCount, LookaheadGlyphCount;
FT_UInt count1, count2;
OTV_ENTER;
p += 2; /* skip Format */
OTV_LIMIT_CHECK( 2 );
BacktrackGlyphCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (BacktrackGlyphCount = %d)\n", BacktrackGlyphCount ));
OTV_LIMIT_CHECK( BacktrackGlyphCount * 2 + 2 );
for ( ; BacktrackGlyphCount > 0; BacktrackGlyphCount-- )
otv_Coverage_validate( table + FT_NEXT_USHORT( p ), otvalid, -1 );
InputGlyphCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (InputGlyphCount = %d)\n", InputGlyphCount ));
OTV_LIMIT_CHECK( InputGlyphCount * 2 + 2 );
for ( count1 = InputGlyphCount; count1 > 0; count1-- )
otv_Coverage_validate( table + FT_NEXT_USHORT( p ), otvalid, -1 );
LookaheadGlyphCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (LookaheadGlyphCount = %d)\n", LookaheadGlyphCount ));
OTV_LIMIT_CHECK( LookaheadGlyphCount * 2 + 2 );
for ( ; LookaheadGlyphCount > 0; LookaheadGlyphCount-- )
otv_Coverage_validate( table + FT_NEXT_USHORT( p ), otvalid, -1 );
count2 = FT_NEXT_USHORT( p );
OTV_TRACE(( " (Count = %d)\n", count2 ));
OTV_LIMIT_CHECK( count2 * 4 );
for ( ; count2 > 0; count2-- )
{
if ( FT_NEXT_USHORT( p ) >= InputGlyphCount )
FT_INVALID_DATA;
if ( FT_NEXT_USHORT( p ) >= otvalid->lookup_count )
FT_INVALID_DATA;
}
OTV_EXIT;
}
FT_LOCAL_DEF( FT_UInt )
otv_GSUBGPOS_get_Lookup_count( FT_Bytes table )
{
FT_Bytes p = table + 8;
return otv_LookupList_get_count( table + FT_NEXT_USHORT( p ) );
}
FT_LOCAL_DEF( FT_UInt )
otv_GSUBGPOS_have_MarkAttachmentType_flag( FT_Bytes table )
{
FT_Bytes p, lookup;
FT_UInt count;
if ( !table )
return 0;
/* LookupList */
p = table + 8;
table += FT_NEXT_USHORT( p );
/* LookupCount */
p = table;
count = FT_NEXT_USHORT( p );
for ( ; count > 0; count-- )
{
FT_Bytes oldp;
/* Lookup */
lookup = table + FT_NEXT_USHORT( p );
oldp = p;
/* LookupFlag */
p = lookup + 2;
if ( FT_NEXT_USHORT( p ) & 0xFF00U )
return 1;
p = oldp;
}
return 0;
}
/* END */
|
19c2363caf8c19f1e70606beabd668c500c640db
|
e5f4f37d941ceb8145d65f92028cc54658b1ac01
|
/Code/Engine/Foundation/Basics/Platform/CheckDefinitions.h
|
3d2892c230f2118f9284c01f6d6a94bf3678e335
|
[
"MIT"
] |
permissive
|
ezEngine/ezEngine
|
19983d2733a5409fb2665c6c3a0a575dadcefb50
|
c46e3b4b2cd46798e4abb4938fbca281c054b039
|
refs/heads/dev
| 2023-09-06T02:17:28.152665
| 2023-09-05T18:25:43
| 2023-09-05T18:25:43
| 18,179,848
| 1,050
| 165
|
MIT
| 2023-09-14T21:44:39
| 2014-03-27T15:02:16
|
C++
|
UTF-8
|
C
| false
| false
| 1,208
|
h
|
CheckDefinitions.h
|
#pragma once
#ifndef NULL
# error "NULL is not defined."
#endif
#ifndef EZ_FORCE_INLINE
# error "EZ_FORCE_INLINE is not defined."
#endif
#ifndef EZ_ALWAYS_INLINE
# error "EZ_ALWAYS_INLINE is not defined."
#endif
#ifndef EZ_ALIGNMENT_OF
# error "EZ_ALIGNMENT_OF is not defined."
#endif
#if EZ_IS_NOT_EXCLUSIVE(EZ_PLATFORM_32BIT, EZ_PLATFORM_64BIT)
# error "Platform is not defined as 32 Bit or 64 Bit"
#endif
#ifndef EZ_DEBUG_BREAK
# error "EZ_DEBUG_BREAK is not defined."
#endif
#ifndef EZ_SOURCE_FUNCTION
# error "EZ_SOURCE_FUNCTION is not defined."
#endif
#ifndef EZ_SOURCE_FILE
# error "EZ_SOURCE_FILE is not defined."
#endif
#ifndef EZ_SOURCE_LINE
# error "EZ_SOURCE_LINE is not defined."
#endif
#if EZ_IS_NOT_EXCLUSIVE(EZ_PLATFORM_LITTLE_ENDIAN, EZ_PLATFORM_BIG_ENDIAN)
# error "Endianess is not correctly defined."
#endif
#ifndef EZ_MATH_CHECK_FOR_NAN
# error "EZ_MATH_CHECK_FOR_NAN is not defined."
#endif
#if EZ_IS_NOT_EXCLUSIVE(EZ_PLATFORM_ARCH_X86, EZ_PLATFORM_ARCH_ARM)
# error "Platform architecture is not correctly defined."
#endif
#if !defined(EZ_SIMD_IMPLEMENTATION) || (EZ_SIMD_IMPLEMENTATION == 0)
# error "EZ_SIMD_IMPLEMENTATION is not correctly defined."
#endif
|
1579b538d1a1944ad5f4114f901aa1e3bba6c306
|
20deb0c7caa426a65ffc2b37cb57fa222d14288c
|
/src/ngx_http_vhost_traffic_status_set.h
|
ad08b0cbe3f9683984383f60596add1968a49747
|
[
"BSD-3-Clause",
"BSD-2-Clause"
] |
permissive
|
vozlt/nginx-module-vts
|
73e97cd022f16dedb366ceada12d1386cbac8d84
|
bd338835463811fe0221db858d865269952aaed9
|
refs/heads/master
| 2023-08-29T22:13:14.336819
| 2023-05-26T10:18:33
| 2023-05-26T10:18:33
| 30,759,499
| 3,117
| 492
|
BSD-2-Clause
| 2023-09-02T07:50:03
| 2015-02-13T14:22:24
|
C
|
UTF-8
|
C
| false
| false
| 584
|
h
|
ngx_http_vhost_traffic_status_set.h
|
/*
* Copyright (C) YoungJoo Kim (vozlt)
*/
#ifndef _NGX_HTTP_VTS_SET_H_INCLUDED_
#define _NGX_HTTP_VTS_SET_H_INCLUDED_
typedef struct {
ngx_int_t index;
ngx_http_complex_value_t value;
ngx_http_set_variable_pt set_handler;
} ngx_http_vhost_traffic_status_filter_variable_t;
ngx_int_t ngx_http_vhost_traffic_status_set_handler(ngx_http_request_t *r);
char *ngx_http_vhost_traffic_status_set_by_filter(ngx_conf_t *cf,
ngx_command_t *cmd, void *conf);
#endif /* _NGX_HTTP_VTS_SET_H_INCLUDED_ */
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */
|
bd3fa5afc52f17611534a6b6a93e1bc0239c9e29
|
085242ce442d9d4ad0cf6df9464b3b35e54bbe4c
|
/src/libponyc/type/assemble.c
|
5ee99f3a1655e5c7499a42cec13d3a0887d4769a
|
[
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] |
permissive
|
ponylang/ponyc
|
4c0a0b4a138b4213b4d67424ed313f322d17a87a
|
c393500e8f8222d648f803f78a705baf452bce05
|
refs/heads/main
| 2023-08-19T03:26:37.611328
| 2023-08-18T13:22:12
| 2023-08-18T14:27:49
| 6,667,084
| 4,901
| 572
|
BSD-2-Clause
| 2023-09-12T18:17:34
| 2012-11-13T07:38:25
|
C
|
UTF-8
|
C
| false
| false
| 10,811
|
c
|
assemble.c
|
#include "assemble.h"
#include "subtype.h"
#include "cap.h"
#include "../ast/token.h"
#include "../ast/astbuild.h"
#include "../expr/literal.h"
#include "../pass/names.h"
#include "../pass/flatten.h"
#include "../pass/expr.h"
#include "ponyassert.h"
static void append_one_to_union(pass_opt_t* opt, ast_t* ast, ast_t* append)
{
ast_t* child = ast_child(ast);
while(child != NULL)
{
ast_t* next = ast_sibling(child);
if(is_subtype(append, child, NULL, opt))
{
// If the incoming type is a subtype of a type that is already in the
// union, then do not bother to append it.
return;
} else if(is_subtype(child, append, NULL, opt)) {
// If a type in the union is a subtype of the incoming type, then remove
// it from the union.
ast_remove(child);
}
child = next;
}
ast_append(ast, append);
}
static void append_one_to_isect(pass_opt_t* opt, ast_t* ast, ast_t* append)
{
ast_t* child = ast_child(ast);
while(child != NULL)
{
ast_t* next = ast_sibling(child);
if(is_subtype(child, append, NULL, opt))
{
// If the incoming type is a supertype of a type that is already in the
// intersection, then do not bother to append it.
return;
} else if(is_subtype(append, child, NULL, opt)) {
// If a type in the intersection is a supertype of the incoming type,
// then remove it from the intersection.
ast_remove(child);
}
child = next;
}
ast_append(ast, append);
}
static void append_one_to_typeexpr(pass_opt_t* opt, ast_t* ast, ast_t* append,
bool is_union)
{
if(is_union)
append_one_to_union(opt, ast, append);
else
append_one_to_isect(opt, ast, append);
}
static void append_to_typeexpr(pass_opt_t* opt, ast_t* ast, ast_t* append,
bool is_union)
{
if(ast_id(ast) == ast_id(append))
{
// Add each element of the typeexpr to the new typeexpr.
ast_t* child = ast_child(append);
while(child != NULL)
{
append_one_to_typeexpr(opt, ast, child, is_union);
child = ast_sibling(child);
}
} else {
append_one_to_typeexpr(opt, ast, append, is_union);
}
}
static ast_t* type_typeexpr(pass_opt_t* opt, token_id t, ast_t* l_type,
ast_t* r_type)
{
bool is_union = t == TK_UNIONTYPE;
if(l_type == NULL)
return r_type;
if(r_type == NULL)
return l_type;
if(is_subtype(l_type, r_type, NULL, opt))
{
if(is_union)
return r_type;
else
return l_type;
}
if(is_subtype(r_type, l_type, NULL, opt))
{
if(is_union)
return l_type;
else
return r_type;
}
ast_t* type = ast_from(l_type, t);
append_to_typeexpr(opt, type, l_type, is_union);
append_to_typeexpr(opt, type, r_type, is_union);
// If there's only one element, remove the type expression node.
ast_t* child = ast_child(type);
if(ast_sibling(child) == NULL)
{
child = ast_dup(child);
ast_free_unattached(type);
type = child;
}
return type;
}
static ast_t* type_base(ast_t* from, const char* package, const char* name,
ast_t* typeargs)
{
if(typeargs == NULL)
typeargs = ast_from(from, TK_NONE);
BUILD(ast, from,
NODE(TK_NOMINAL,
ID(package)
ID(name)
TREE(typeargs)
NONE
NONE));
return ast;
}
ast_t* type_builtin(pass_opt_t* opt, ast_t* from, const char* name)
{
return type_builtin_args(opt, from, name, NULL);
}
ast_t* type_builtin_args(pass_opt_t* opt, ast_t* from, const char* name,
ast_t* typeargs)
{
ast_t* ast = type_base(from, NULL, name, typeargs);
if(!names_nominal(opt, from, &ast, false))
{
ast_error(opt->check.errors, from, "unable to validate '%s'", name);
ast_free(ast);
return NULL;
}
return ast;
}
ast_t* type_pointer_to(pass_opt_t* opt, ast_t* to)
{
BUILD(pointer, to,
NODE(TK_NOMINAL,
NONE // Package
ID("Pointer")
NODE(TK_TYPEARGS,
TREE(to)
)
NONE // Capability
NONE // Ephemeral
));
if(!names_nominal(opt, to, &pointer, false))
{
ast_error(opt->check.errors, to, "unable to create Pointer[%s]",
ast_print_type(to));
ast_free(pointer);
return NULL;
}
return pointer;
}
ast_t* type_sugar(ast_t* from, const char* package, const char* name)
{
return type_base(from, package, name, NULL);
}
ast_t* type_sugar_args(ast_t* from, const char* package, const char* name,
ast_t* typeargs)
{
return type_base(from, package, name, typeargs);
}
ast_t* control_type_add_branch(pass_opt_t* opt, ast_t* control_type,
ast_t* branch)
{
pony_assert(branch != NULL);
ast_t* branch_type = ast_type(branch);
if(is_typecheck_error(branch_type))
return branch_type;
if(is_type_literal(branch_type))
{
// The new branch is a literal
if(control_type == NULL)
control_type = ast_from(branch, TK_LITERAL);
if(ast_id(control_type) != TK_LITERAL)
{
// The current control type is not a literal, fix that
ast_t* old_control = control_type;
control_type = ast_from(branch, TK_LITERAL);
ast_settype(control_type, old_control);
}
pony_assert(ast_id(control_type) == TK_LITERAL);
// Add a literal branch reference to the new branch
ast_t* member = ast_from(branch, TK_LITERALBRANCH);
ast_setdata(member, (void*)branch);
ast_append(control_type, member);
ast_t* branch_non_lit = ast_type(branch_type);
if(branch_non_lit != NULL)
{
// The branch's literal type has a non-literal component
ast_t* non_literal_type = ast_type(control_type);
ast_settype(control_type, type_union(opt, non_literal_type,
branch_non_lit));
}
return control_type;
}
if(control_type != NULL && ast_id(control_type) == TK_LITERAL)
{
// New branch is not literal, but the control structure is
// Add new branch type to the control structure's non-literal aspect
ast_t* non_literal_type = ast_type(control_type);
non_literal_type = type_union(opt, non_literal_type, branch_type);
ast_settype(control_type, non_literal_type);
return control_type;
}
// No literals here, just union the types
return type_union(opt, control_type, branch_type);
}
ast_t* type_union(pass_opt_t* opt, ast_t* l_type, ast_t* r_type)
{
return type_typeexpr(opt, TK_UNIONTYPE, l_type, r_type);
}
ast_t* type_isect(pass_opt_t* opt, ast_t* l_type, ast_t* r_type)
{
return type_typeexpr(opt, TK_ISECTTYPE, l_type, r_type);
}
ast_t* type_for_class(pass_opt_t* opt, ast_t* def, ast_t* ast,
token_id cap, token_id ephemeral, bool expr)
{
AST_GET_CHILDREN(def, id, typeparams);
BUILD(typeargs, ast, NODE(TK_NONE));
BUILD(type, ast,
NODE(TK_NOMINAL,
NODE(TK_NONE)
TREE(id)
TREE(typeargs)
NODE(cap)
NODE(ephemeral)));
if(ast_id(typeparams) == TK_TYPEPARAMS)
{
ast_setid(typeargs, TK_TYPEARGS);
ast_t* typeparam = ast_child(typeparams);
while(typeparam != NULL)
{
ast_t* typeparam_id = ast_child(typeparam);
ast_t* typearg = type_sugar(ast, NULL, ast_name(typeparam_id));
ast_append(typeargs, typearg);
if(expr)
{
names_nominal(opt, ast, &typearg, false);
if(ast_id(typearg) == TK_TYPEPARAMREF)
flatten_typeparamref(opt, typearg);
}
typeparam = ast_sibling(typeparam);
}
}
if(expr)
names_nominal(opt, ast, &type, false);
return type;
}
ast_t* type_for_this(pass_opt_t* opt, ast_t* ast, token_id cap,
token_id ephemeral)
{
typecheck_t* t = &opt->check;
return type_for_class(opt, t->frame->type, ast, cap, ephemeral, false);
}
ast_t* type_for_fun(ast_t* ast)
{
AST_GET_CHILDREN(ast, cap, name, typeparams, params, result);
token_id fcap = ast_id(cap);
if(fcap == TK_NONE)
fcap = TK_TAG;
// The params may already have types attached. If we build the function type
// directly from those we'll get nested types which can mess things up. To
// avoid this make a clean version of the params without types.
ast_t* clean_params = ast_dup(params);
for(ast_t* p = ast_child(clean_params); p != NULL; p = ast_sibling(p))
ast_settype(p, NULL);
BUILD(fun, ast,
NODE(TK_FUNTYPE,
NODE(fcap) TREE(typeparams) TREE(clean_params) TREE(result)));
return fun;
}
ast_t* type_isect_fun(pass_opt_t* opt, ast_t* a, ast_t* b)
{
token_id ta = ast_id(a);
token_id tb = ast_id(b);
if(((ta == TK_NEW) || (tb == TK_NEW)) && (ta != tb))
return NULL;
AST_GET_CHILDREN(a, a_cap, a_id, a_typeparams, a_params, a_result, a_throw);
AST_GET_CHILDREN(b, b_cap, b_id, b_typeparams, b_params, b_result, b_throw);
// Must have the same name.
if(ast_name(a_id) != ast_name(b_id))
return NULL;
// Must have the same number of type parameters and parameters.
if((ast_childcount(a_typeparams) != ast_childcount(b_typeparams)) ||
(ast_childcount(a_params) != ast_childcount(b_params)))
return NULL;
// Contravariant receiver cap.
token_id tcap;
token_id a_tcap = ast_id(a_cap);
token_id b_tcap = ast_id(b_cap);
if(is_cap_sub_cap(b_tcap, TK_NONE, a_tcap, TK_NONE))
tcap = a_tcap;
else if(is_cap_sub_cap(a_tcap, TK_NONE, b_tcap, TK_NONE))
tcap = b_tcap;
else
tcap = TK_BOX;
// Result is the intersection of the results.
ast_t* result = type_isect(opt, a_result, b_result);
// Covariant throws.
token_id throws;
if((ast_id(a_throw) == TK_NONE) || (ast_id(b_throw) == TK_NONE))
throws = TK_NONE;
else
throws = TK_QUESTION;
BUILD(fun, a,
NODE(tcap)
TREE(a_id)
NODE(TK_TYPEPARAMS)
NODE(TK_PARAMS)
TREE(result)
NODE(throws)
);
// TODO: union typeparams and params
// handling typeparam names is tricky
return fun;
}
ast_t* set_cap_and_ephemeral(ast_t* type, token_id cap, token_id ephemeral)
{
switch(ast_id(type))
{
case TK_UNIONTYPE:
case TK_ISECTTYPE:
case TK_TUPLETYPE:
{
ast_t* child = ast_child(type);
type = ast_from(type, ast_id(type));
while(child != NULL)
{
ast_append(type, set_cap_and_ephemeral(child, cap, ephemeral));
child = ast_sibling(child);
}
return type;
}
case TK_NOMINAL:
{
type = ast_dup(type);
AST_GET_CHILDREN(type, package, id, typeargs, tcap, eph);
if(cap != TK_NONE)
ast_setid(tcap, cap);
ast_setid(eph, ephemeral);
return type;
}
case TK_TYPEPARAMREF:
{
type = ast_dup(type);
AST_GET_CHILDREN(type, id, tcap, eph);
if(cap != TK_NONE)
ast_setid(tcap, cap);
ast_setid(eph, ephemeral);
return type;
}
case TK_ARROW:
// Just use the lhs of the viewpoint type.
return set_cap_and_ephemeral(ast_childidx(type, 1), cap, ephemeral);
default: {}
}
pony_assert(0);
return NULL;
}
|
ce7c3315b7bc8f1f2a09b060e5d4d08878188e1f
|
e73547787354afd9b717ea57fe8dd0695d161821
|
/src/os/lookathil.c
|
8e5cc8a1a5db8e133d7d057b09c489cd836b99c4
|
[] |
no_license
|
pmret/papermario
|
8b514b19653cef8d6145e47499b3636b8c474a37
|
9774b26d93f1045dd2a67e502b6efc9599fb6c31
|
refs/heads/main
| 2023-08-31T07:09:48.951514
| 2023-08-21T18:07:08
| 2023-08-21T18:07:08
| 287,151,133
| 904
| 139
| null | 2023-09-14T02:44:23
| 2020-08-13T01:22:57
|
C
|
UTF-8
|
C
| false
| false
| 4,566
|
c
|
lookathil.c
|
#include "PR/guint.h"
void guLookAtHiliteF(f32 mf[4][4], LookAt *l, Hilite *h,
f32 xEye, f32 yEye, f32 zEye,
f32 xAt, f32 yAt, f32 zAt,
f32 xUp, f32 yUp, f32 zUp,
f32 xl1, f32 yl1, f32 zl1, /* light 1 direction */
f32 xl2, f32 yl2, f32 zl2, /* light 2 direction */
int twidth, int theight) { /* highlight txtr size*/
f32 len, xLook, yLook, zLook, xRight, yRight, zRight;
f32 xHilite, yHilite, zHilite;
guMtxIdentF(mf);
xLook = xAt - xEye;
yLook = yAt - yEye;
zLook = zAt - zEye;
/* Negate because positive Z is behind us: */
len = -1.0 / sqrtf (xLook * xLook + yLook * yLook + zLook * zLook);
xLook *= len;
yLook *= len;
zLook *= len;
/* Right = Up x Look */
xRight = yUp * zLook - zUp * yLook;
yRight = zUp * xLook - xUp * zLook;
zRight = xUp * yLook - yUp * xLook;
len = 1.0 / sqrtf (xRight * xRight + yRight * yRight + zRight * zRight);
xRight *= len;
yRight *= len;
zRight *= len;
/* Up = Look x Right */
xUp = yLook * zRight - zLook * yRight;
yUp = zLook * xRight - xLook * zRight;
zUp = xLook * yRight - yLook * xRight;
len = 1.0 / sqrtf (xUp * xUp + yUp * yUp + zUp * zUp);
xUp *= len;
yUp *= len;
zUp *= len;
/* hilite vectors */
len = 1.0 / sqrtf (xl1 * xl1 + yl1 * yl1 + zl1 * zl1);
xl1 *= len;
yl1 *= len;
zl1 *= len;
#define THRESH2 0.1
xHilite = xl1 + xLook;
yHilite = yl1 + yLook;
zHilite = zl1 + zLook;
len = sqrtf (xHilite * xHilite + yHilite * yHilite + zHilite * zHilite);
if (len>THRESH2) {
len = 1.0 / len;
xHilite *= len;
yHilite *= len;
zHilite *= len;
h->h.x1 = twidth * 4 + (xHilite * xRight + yHilite * yRight + zHilite * zRight) * twidth * 2;
h->h.y1 = theight * 4 + (xHilite * xUp + yHilite * yUp + zHilite * zUp) * theight * 2;
} else {
h->h.x1 = twidth * 2;
h->h.y1 = theight * 2;
}
len = 1.0 / sqrtf (xl2 * xl2 + yl2 * yl2 + zl2 * zl2);
xl2 *= len;
yl2 *= len;
zl2 *= len;
xHilite = xl2 + xLook;
yHilite = yl2 + yLook;
zHilite = zl2 + zLook;
len = sqrtf (xHilite * xHilite + yHilite * yHilite + zHilite * zHilite);
if (len>THRESH2) {
len = 1.0 / len;
xHilite *= len;
yHilite *= len;
zHilite *= len;
h->h.x2 = twidth * 4 + (xHilite * xRight + yHilite * yRight + zHilite * zRight) * twidth * 2;
h->h.y2 = theight * 4 + (xHilite * xUp + yHilite * yUp + zHilite * zUp) * theight * 2;
} else {
h->h.x2 = twidth * 2;
h->h.y2 = theight * 2;
}
/* reflectance vectors = Up and Right */
l->l[0].l.dir[0] = FTOFRAC8(xRight);
l->l[0].l.dir[1] = FTOFRAC8(yRight);
l->l[0].l.dir[2] = FTOFRAC8(zRight);
l->l[1].l.dir[0] = FTOFRAC8(xUp);
l->l[1].l.dir[1] = FTOFRAC8(yUp);
l->l[1].l.dir[2] = FTOFRAC8(zUp);
l->l[0].l.col[0] = 0x00;
l->l[0].l.col[1] = 0x00;
l->l[0].l.col[2] = 0x00;
l->l[0].l.pad1 = 0x00;
l->l[0].l.colc[0] = 0x00;
l->l[0].l.colc[1] = 0x00;
l->l[0].l.colc[2] = 0x00;
l->l[0].l.pad2 = 0x00;
l->l[1].l.col[0] = 0x00;
l->l[1].l.col[1] = 0x80;
l->l[1].l.col[2] = 0x00;
l->l[1].l.pad1 = 0x00;
l->l[1].l.colc[0] = 0x00;
l->l[1].l.colc[1] = 0x80;
l->l[1].l.colc[2] = 0x00;
l->l[1].l.pad2 = 0x00;
mf[0][0] = xRight;
mf[1][0] = yRight;
mf[2][0] = zRight;
mf[3][0] = -(xEye * xRight + yEye * yRight + zEye * zRight);
mf[0][1] = xUp;
mf[1][1] = yUp;
mf[2][1] = zUp;
mf[3][1] = -(xEye * xUp + yEye * yUp + zEye * zUp);
mf[0][2] = xLook;
mf[1][2] = yLook;
mf[2][2] = zLook;
mf[3][2] = -(xEye * xLook + yEye * yLook + zEye * zLook);
mf[0][3] = 0;
mf[1][3] = 0;
mf[2][3] = 0;
mf[3][3] = 1;
}
void guLookAtHilite (Mtx *m, LookAt *l, Hilite *h,
f32 xEye, f32 yEye, f32 zEye,
f32 xAt, f32 yAt, f32 zAt,
f32 xUp, f32 yUp, f32 zUp,
f32 xl1, f32 yl1, f32 zl1, /* light 1 direction */
f32 xl2, f32 yl2, f32 zl2, /* light 2 direction */
int twidth, int theight) { /* highlight txtr size*/
f32 mf[4][4];
guLookAtHiliteF(mf, l, h, xEye, yEye, zEye, xAt, yAt, zAt,
xUp, yUp, zUp, xl1, yl1, zl1, xl2, yl2, zl2,
twidth, theight);
guMtxF2L(mf, m);
}
|
b16de8d97c7d75320e23b53680c9e5e1934a75fa
|
152a953fbc1c7a5844b99f3c3e440fc7280d8de1
|
/testing/closure.c
|
0025dee945c827f41edcefa98956e8f606da8f31
|
[
"Apache-2.0"
] |
permissive
|
google/nsync
|
4bc7ab3b62be9b9561d3aed0d82f6aea7656e86f
|
a2ce3874a98e9be4b5bf19b7322743e73b906c54
|
refs/heads/master
| 2023-08-30T15:25:59.114957
| 2023-08-24T22:57:27
| 2023-08-24T22:57:27
| 84,618,897
| 273
| 74
|
Apache-2.0
| 2023-08-24T22:57:29
| 2017-03-11T02:51:04
|
C
|
UTF-8
|
C
| false
| false
| 1,092
|
c
|
closure.c
|
/* Copyright 2016 Google 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. */
#include "nsync_cpp.h"
#include "platform.h"
#include "compiler.h"
#include "cputype.h"
#include "closure.h"
NSYNC_CPP_START_
void nsync_start_thread_ (void (*f) (void *), void *arg);
NSYNC_CPP_END_
NSYNC_CPP_USING_
/* Run the closure *cl. */
void closure_run (closure *cl) {
(*cl->f0) (cl);
}
/* Run the closure (closure *), but wrapped to fix the type. */
static void closure_run_body (void *v) {
closure_run ((closure *)v);
}
void closure_fork (closure *cl) {
nsync_start_thread_ (&closure_run_body, cl);
}
|
582e04e5dcc2c6b9fa70d612db3dfc27d7a34e4f
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/phytium/libraries/standalone/drivers/dma/fddma/fddma.c
|
dbb79935c628a5781e5372290059c2d1169c5fa1
|
[
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"BSD-2-Clause"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 12,588
|
c
|
fddma.c
|
/*
* Copyright : (C) 2022 Phytium Information Technology, Inc.
* All Rights Reserved.
*
* This program is OPEN SOURCE software: you can redistribute it and/or modify it
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
* either version 1.0 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 Phytium Public License for more details.
*
*
* FilePath: fddma.c
* Date: 2022-02-10 14:53:42
* LastEditTime: 2022-02-18 08:24:47
* Description: This file is for ddma interface implementation
*
* Modify History:
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------
* 1.0 zhugengyu 2022/5/13 init commit
*/
/***************************** Include Files *********************************/
#include <string.h>
#include "fkernel.h"
#include "fparameters.h"
#include "fassert.h"
#include "fdebug.h"
#include "fddma_hw.h"
#include "fddma.h"
/************************** Constant Definitions *****************************/
/**************************** Type Definitions *******************************/
/************************** Variable Definitions *****************************/
/***************** Macros (Inline Functions) Definitions *********************/
#define FDDMA_DEBUG_TAG "DDMA"
#define FDDMA_ERROR(format, ...) FT_DEBUG_PRINT_E(FDDMA_DEBUG_TAG, format, ##__VA_ARGS__)
#define FDDMA_WARN(format, ...) FT_DEBUG_PRINT_W(FDDMA_DEBUG_TAG, format, ##__VA_ARGS__)
#define FDDMA_INFO(format, ...) FT_DEBUG_PRINT_I(FDDMA_DEBUG_TAG, format, ##__VA_ARGS__)
#define FDDMA_DEBUG(format, ...) FT_DEBUG_PRINT_D(FDDMA_DEBUG_TAG, format, ##__VA_ARGS__)
/************************** Function Prototypes ******************************/
static FError FDdmaReset(FDdma *const instance);
/****************************************************************************/
/**
* @name: FDdmaCfgInitialization
* @msg: 初始化DDMA控制器
* @return {FError} FDDMA_SUCCESS表示初始化成功,其它返回值表示初始化失败
* @param {FDdma} *instance, DDMA控制器实例
* @param {FDdmaConfig} *input_config, DDMA控制器配置
*/
FError FDdmaCfgInitialization(FDdma *const instance, const FDdmaConfig *input_config)
{
FASSERT(instance && input_config);
uintptr base_addr = input_config->base_addr;
FError ret = FDDMA_SUCCESS;
if (FT_COMPONENT_IS_READY == instance->is_ready)
{
FDDMA_WARN("The device has been initialized !!!");
}
FDdmaDeInitialization(instance);
instance->config = *input_config;
ret = FDdmaReset(instance);
if (FDDMA_SUCCESS == ret)
{
instance->is_ready = FT_COMPONENT_IS_READY;
FDDMA_INFO("ddma@0x%x initialized successfully !!!", base_addr);
}
return ret;
}
/**
* @name: FDdmaStart
* @msg: 启动DDMA控制器,开始传输
* @return {FError} FDDMA_SUCCESS表示启动成功,其它返回值表示启动失败
* @param {FDdma} *instance, DDMA控制器实例
*/
FError FDdmaStart(FDdma *const instance)
{
FASSERT(instance);
FError ret = FDDMA_SUCCESS;
uintptr base_addr = instance->config.base_addr;
if (FT_COMPONENT_IS_READY != instance->is_ready)
{
FDDMA_ERROR("The Dma instance is not initialized !!!");
return FDDMA_ERR_NOT_INIT;
}
FDdmaEnableGlobalIrq(base_addr); /* enable ddma irq */
FDdmaEnable(base_addr);
return FDDMA_SUCCESS;
}
/**
* @name: FDdmaStop
* @msg: 停止DDMA控制器
* @return {FError} FDDMA_SUCCESS表示停止成功,其它返回值表示停止失败
* @param {FDdma} *instance, DDMA控制器实例
*/
FError FDdmaStop(FDdma *const instance)
{
FASSERT(instance);
FError ret = FDDMA_SUCCESS;
uintptr base_addr = instance->config.base_addr;
if (FT_COMPONENT_IS_READY != instance->is_ready)
{
FDDMA_ERROR("The Dma instance is not initialized !!!");
return FDDMA_ERR_NOT_INIT;
}
FDdmaDisableGlobalIrq(base_addr); /* enable ddma irq */
FDdmaDisable(base_addr);
return FDDMA_SUCCESS;
}
/**
* @name: FDdmaDeInitialization
* @msg: 去初始化DDMA控制器
* @return {无}
* @param {FDdma} *instance, DDMA控制器实例
*/
void FDdmaDeInitialization(FDdma *const instance)
{
FASSERT(instance);
u32 chan;
for (chan = 0; chan < FDDMA_NUM_OF_CHAN; chan++)
{
if (instance->bind_status & BIT(chan))
{
FDDMA_WARN("Channel %d is not yet unbound", chan);
}
}
memset(instance, 0, sizeof(*instance));
return;
}
/**
* @name: FDdmaAllocateChan
* @msg: 按照配置分配DDMA通道
* @return {FError} FDDMA_SUCCESS表示分配成功,其它返回值表示分配失败
* @param {FDdma} *instance, DDMA控制器实例
* @param {FDdmaChan} *dma_chan, DDMA通道实例
* @param {FDdmaChanConfig} *dma_chan_config, DDMA通道配置
*/
FError FDdmaAllocateChan(FDdma *const instance, FDdmaChan *const dma_chan, const FDdmaChanConfig *dma_chan_config)
{
FASSERT(instance && dma_chan && dma_chan_config);
FError ret = FDDMA_SUCCESS;
const FDdmaChanIndex chan_idx = dma_chan_config->id;
u32 reg_val;
uintptr base_addr = instance->config.base_addr;
if (FT_COMPONENT_IS_READY != instance->is_ready)
{
FDDMA_ERROR("The Dma instance is not initialized !!!");
return FDDMA_ERR_NOT_INIT;
}
if ((TRUE == dma_chan->is_used) || (BIT(chan_idx) & instance->bind_status))
{
FDDMA_ERROR("Channel -%d has already been used !!!", chan_idx);
return FDDMA_ERR_CHAN_BINDED;
}
if (FDdmaIsChanRunning(base_addr, chan_idx))
{
FDDMA_ERROR("Channel -%d is running !!!", chan_idx);
return FDDMA_ERR_CHAN_BINDED;
}
if (dma_chan_config->ddr_addr % FDDMA_DDR_ADDR_ALIGMENT)
{
FDDMA_ERROR("DDR addr 0x%x must be aligned with %d bytes",
dma_chan_config->ddr_addr, FDDMA_DDR_ADDR_ALIGMENT);
return FDDMA_ERR_INVALID_DDR_ADDR;
}
if ((FDDMA_MIN_TRANSFER_LEN > dma_chan_config->trans_len) ||
(0 != dma_chan_config->trans_len % FDDMA_MIN_TRANSFER_LEN))
{
FDDMA_ERROR("Invalid transfer size %d bytes !!!", dma_chan_config->trans_len);
return FDDMA_ERR_INVALID_TRANS_SIZE;
}
dma_chan->dma = instance;
instance->chan[chan_idx] = dma_chan;
if (&(dma_chan->config) != dma_chan_config)
{
dma_chan->config = *dma_chan_config;
}
FDdmaStop(instance); /* disable irq */
if (FDDMA_SUCCESS != FDdmaDisableChan(base_addr, chan_idx))
{
FDDMA_ERROR("Failed to disable DDMA@0x%x channel %d !!!", base_addr, chan_idx);
return FDDMA_ERR_WAIT_TIMEOUT;
}
FDdmaResetChan(base_addr, chan_idx); /* reset channel */
FDdmaSetChanSelection(base_addr, chan_idx, dma_chan->config.slave_id); /* select channel */
FDdmaSetChanBind(base_addr, chan_idx, TRUE); /* bind channel */
/* setup transfer src and dst */
/* dma_tx_req: ddr --> dev 从内存中读取数据,写入外设 */
/* dma_rx_req: dev --> ddr 从外设读取数据到内存 */
#ifdef __aarch64___
FDdmaWriteReg(base_addr, FDDMA_CHAN_DDR_LOW_ADDR_OFFSET(chan_idx), LOWER_32_BITS(dma_chan_config->ddr_addr));
FDdmaWriteReg(base_addr, FDDMA_CHAN_DDR_UP_ADDR_OFFSET(chan_idx), UPPER_32_BITS(dma_chan_config->ddr_addr));
#else
FDdmaWriteReg(base_addr, FDDMA_CHAN_DDR_LOW_ADDR_OFFSET(chan_idx), (u32)(dma_chan_config->ddr_addr));
FDdmaWriteReg(base_addr, FDDMA_CHAN_DDR_UP_ADDR_OFFSET(chan_idx), 0);
#endif
FDdmaWriteReg(base_addr, FDDMA_CHAN_DEV_ADDR_OFFSET(chan_idx), dma_chan_config->dev_addr);
FDdmaWriteReg(base_addr, FDDMA_CHAN_TS_OFFSET(chan_idx), dma_chan_config->trans_len); /* block size */
/* set channel request direction */
FDdmaSetChanDirection(base_addr, chan_idx,
(FDDMA_CHAN_REQ_RX == dma_chan->config.req_mode) ? TRUE : FALSE);
FDDMA_INFO("channel-%d ddr @0x%x", chan_idx, FDDMA_CHAN_DDR_LOW_ADDR_OFFSET(chan_idx));
FDDMA_INFO("ddr addr: 0x%x", FDdmaReadReg(base_addr, FDDMA_CHAN_DDR_LOW_ADDR_OFFSET(chan_idx)));
FDDMA_INFO("dev addr: 0x%x", FDdmaReadReg(base_addr, FDDMA_CHAN_DEV_ADDR_OFFSET(chan_idx)));
FDDMA_INFO("transfer len: %d", FDdmaReadReg(base_addr, FDDMA_CHAN_TS_OFFSET(chan_idx)));
FDdmaSetChanTimeout(base_addr, chan_idx, 0xffff);
FDdmaEnableChanIrq(base_addr, chan_idx);
if (FDDMA_SUCCESS == ret)
{
instance->bind_status |= BIT(chan_idx);
dma_chan->is_used = TRUE;
FDDMA_INFO("Allocate channel %d", chan_idx);
}
return ret;
}
/**
* @name: FDdmaDellocateChan
* @msg: 释放之前分配的DDMA通道
* @return {FError} FDDMA_SUCCESS表示释放成功,其它返回值表示释放失败
* @param {FDdmaChan} *dma_chan, DDMA控制器实例
*/
FError FDdmaDellocateChan(FDdmaChan *const dma_chan)
{
FASSERT(dma_chan && dma_chan->dma);
FDdma *const instance = dma_chan->dma;
const FDdmaChanIndex chan_idx = dma_chan->config.id;
uintptr base_addr = instance->config.base_addr;
FError ret = FDDMA_SUCCESS;
if (FT_COMPONENT_IS_READY != instance->is_ready)
{
FDDMA_ERROR("The Dma instance is not initialized !!!");
return FDDMA_ERR_NOT_INIT;
}
if (FDDMA_SUCCESS != FDdmaDisableChan(base_addr, chan_idx))
{
FDDMA_ERROR("Failed to disable DDMA@0x%x channel %d !!!", base_addr, chan_idx);
return FDDMA_ERR_WAIT_TIMEOUT;
}
FDdmaResetChan(base_addr, chan_idx);
FDdmaSetChanBind(base_addr, chan_idx, FALSE); /* unbind channel */
ret = FDdmaDisableChan(base_addr, chan_idx);
if (FDDMA_SUCCESS != ret) /* disable channel */
{
FDDMA_ERROR("Failure to disable ddma@%p channel %d !!!", base_addr, chan_idx);
return ret;
}
FDdmaDisableChanIrq(base_addr, chan_idx); /* disable channel irq */
instance->bind_status &= ~BIT(chan_idx); /* set bind status */
instance->chan[chan_idx] = NULL;
FDDMA_INFO("DeAllocate channels %d", chan_idx);
memset(dma_chan, 0, sizeof(*dma_chan));
return ret;
}
/**
* @name: FDdmaActiveChan
* @msg: 使能指定的DDMA通道
* @note: 调用FDdmaAllocateChan后无需调用此函数
* @return {FError} 返回FDDMA_SUCCESS表示成功,返回其它表示失败
* @param FDdmaChan *const dma_chan, DDMA通道实例
*/
FError FDdmaActiveChan(FDdmaChan *const dma_chan)
{
FASSERT(dma_chan && dma_chan->dma);
FDdma *const instance = dma_chan->dma;
uintptr base_addr = instance->config.base_addr;
if (FT_COMPONENT_IS_READY != instance->is_ready)
{
FDDMA_ERROR("The Dma instance is not initialized !!!");
return FDDMA_ERR_NOT_INIT;
}
FDdmaEnableChan(base_addr, dma_chan->config.id);
FDdmaClearChanIrq(base_addr, dma_chan->config.id); /* clear interrupt status */
return FDDMA_SUCCESS;
}
FError FDdmaDeactiveChan(FDdmaChan *const dma_chan)
{
FASSERT(dma_chan && dma_chan->dma);
FDdma *const instance = dma_chan->dma;
uintptr base_addr = instance->config.base_addr;
if (FT_COMPONENT_IS_READY != instance->is_ready)
{
FDDMA_ERROR("The Dma instance is not initialized !!!");
return FDDMA_ERR_NOT_INIT;
}
return FDdmaDisableChan(base_addr, dma_chan->config.id);
}
/**
* @name: FDdmaReset
* @msg: 重置DDMA控制器
* @return {FError} FDDMA_SUCCESS表示重置成功,其它返回值表示失败
* @param {FDdma} *instance, DDMA控制器实例
*/
static FError FDdmaReset(FDdma *const instance)
{
FASSERT(instance);
uintptr base_addr = instance->config.base_addr;
FError ret = FDDMA_SUCCESS;
u32 reg_val;
u32 chan;
if (0 != instance->bind_status)
{
FDDMA_WARN("Some channels are not yet unbound !!!");
}
FDdmaDisable(base_addr); /* disable ddma */
FDdmaSoftwareReset(base_addr); /* do software reset */
FDdmaDisableGlobalIrq(base_addr);
/* disable channel and its irq */
for (u32 chan = FDDMA_CHAN_0; chan < FDDMA_NUM_OF_CHAN; chan++)
{
/* disable channel */
ret = FDdmaDisableChan(base_addr, chan);
if (FDDMA_SUCCESS != ret)
{
FDDMA_ERROR("Failure to disable ddma@%p channel %d !!!", base_addr, chan);
break;
}
}
FDdmaDumpRegisters(base_addr);
return ret;
}
|
c454d807bc030985f9a13da5548a5382f025e285
|
65649af293ac6e1b87ac11d61726886ba07ecc72
|
/src/def_config_parser.h
|
317e61304dbca49737ff26b74abfe1836511311f
|
[] |
no_license
|
pellepl/arcadehid
|
d01118bb0e2328393190336e3971945cdbbd0cfb
|
3c75a634c90fff6dbc90fe6bc70aa8a3eae9631f
|
refs/heads/master
| 2023-06-11T15:07:34.023559
| 2018-04-08T18:35:58
| 2018-04-08T18:35:58
| 28,608,779
| 105
| 38
| null | null | null | null |
UTF-8
|
C
| false
| false
| 418
|
h
|
def_config_parser.h
|
/*
* def_config_parser.h
*
* Created on: Jan 20, 2015
* Author: petera
*/
#ifndef SRC_DEF_CONFIG_PARSER_H_
#define SRC_DEF_CONFIG_PARSER_H_
#include "system.h"
#include "def_config.h"
#include "miniutils.h"
#define KEYPARSERR(...) print(__VA_ARGS__)
bool def_config_parse(def_config *pindef, const char *str, u16_t len);
void def_config_print(def_config *pindef);
#endif /* SRC_DEF_CONFIG_PARSER_H_ */
|
7795d80c330245a510d829b01ab07ebbaa1be3de
|
b75aed5b06c00bd1435239da8bd72696829631b0
|
/include/qpdf/DLL.h
|
cb96331644587534e6b0212b4755e71c9711550a
|
[
"Artistic-1.0",
"Artistic-2.0",
"Apache-2.0",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain",
"MIT",
"AGPL-3.0-or-later"
] |
permissive
|
qpdf/qpdf
|
e233c2d09b4fc4586a6af44ea8350873d5ff95e7
|
3372615e5bc22ed3d4f0f5990ce2e6e41dc06c4f
|
refs/heads/main
| 2023-09-03T17:54:14.006027
| 2023-09-03T14:13:02
| 2023-09-03T14:13:17
| 4,539,167
| 2,583
| 261
|
Apache-2.0
| 2023-09-05T17:37:12
| 2012-06-03T17:40:19
|
C++
|
UTF-8
|
C
| false
| false
| 4,615
|
h
|
DLL.h
|
/* Copyright (c) 2005-2023 Jay Berkenbilt
*
* This file is part of qpdf.
*
* 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.
*
* Versions of qpdf prior to version 7 were released under the terms
* of version 2.0 of the Artistic License. At your option, you may
* continue to consider qpdf to be licensed under those terms. Please
* see the manual for additional information.
*/
#ifndef QPDF_DLL_HH
#define QPDF_DLL_HH
/* The first version of qpdf to include the version constants is 10.6.0. */
#define QPDF_MAJOR_VERSION 11
#define QPDF_MINOR_VERSION 6
#define QPDF_PATCH_VERSION 0
#define QPDF_VERSION "11.6.0"
/*
* This file defines symbols that control the which functions,
* classes, and methods are exposed to the public ABI (application
* binary interface). See below for a detailed explanation.
*/
#if defined _WIN32 || defined __CYGWIN__
# ifdef libqpdf_EXPORTS
# define QPDF_DLL __declspec(dllexport)
# else
# define QPDF_DLL
# endif
# define QPDF_DLL_PRIVATE
#elif defined __GNUC__
# define QPDF_DLL __attribute__((visibility("default")))
# define QPDF_DLL_PRIVATE __attribute__((visibility("hidden")))
#else
# define QPDF_DLL
# define QPDF_DLL_PRIVATE
#endif
#ifdef __GNUC__
# define QPDF_DLL_CLASS QPDF_DLL
#else
# define QPDF_DLL_CLASS
#endif
/*
Here's what's happening. See also https://gcc.gnu.org/wiki/Visibility
for a more in-depth discussion.
* Everything in the public ABI must be exported. Things not in the
public ABI should not be exported.
* A class's runtime type information is need if the class is going to
be used as an exception, inherited from, or tested with
dynamic_class. To do these things across a shared object boundary,
runtime type information must be exported.
* On Windows:
* For a symbol (function, method, etc.) to be exported into the
public ABI, it must be explicitly marked for export.
* If you mark a class for export, all symbols in the class,
including private methods, are exported into the DLL, and there is
no way to exclude something from export.
* A class's run-time type information is made available based on the
presence of a compiler flag (with MSVC), which is always on for
qpdf builds.
* Marking classes for export should be done only when *building* the
DLL, not when *using* the DLL.
* It is possible to mark symbols for import for DLL users, but it is
not necessary, and doing it right is complex in our case of being
multi-platform and building both static and shared libraries that
use the same headers, so we don't bother.
* If we don't export base classes with mingw, the vtables don't end
up in the DLL.
* On Linux (and other similar systems):
* Common compilers such as gcc and clang export all symbols into the
public ABI by default. The qpdf build overrides this by using
"visibility=hidden", which makes it behave more like Windows in
that things have to be explicitly exported to appear in the public
ABI.
* As with Windows, marking a class for export causes everything in
the class, including private methods, the be exported. However,
unlike in Windows:
* It is possible to explicitly mark symbols as private
* The only way to get the runtime type and vtable information into
the ABI is to mark the class as exported.
* It is harmless and sometimes necessary to include the visibility
marks when using the library as well as when building it. In
particular, clang on MacOS requires the visibility marks to
match in both cases.
What does this mean:
* On Windows, we never have to export a class, and while there is no
way to "unexport" something, we also have no need to do it.
* On non-Windows, we have to export some classes, and when we do, we
have to "unexport" some of their parts.
* We only use the libqpdf_EXPORTS as a conditional for defining the
symbols for Windows builds.
To achieve this, we use QPDF_DLL_CLASS to export classes, QPDF_DLL to
export methods, and QPDF_DLL_PRIVATE to unexport private methods in
exported classes.
*/
#endif /* QPDF_DLL_HH */
|
08fde2041214f1400eed924e719122b22b8e0655
|
248f9d022d678a8e12e84b9ed004d1f544b1962d
|
/lib_stusb/STM32_USB_Device_Library/Class/CCID/src/usbd_ccid_cmd.c
|
31e4759a459e628e60dfa1c9f913e37361f71f75
|
[
"Apache-2.0"
] |
permissive
|
LedgerHQ/nanos-secure-sdk
|
09893a7ed38adb1d814bec75216f6dc137e212e8
|
12e5f6f875bf5deb9464b944f50079aaca1a3b98
|
refs/heads/master
| 2023-09-04T10:38:06.237940
| 2023-09-01T11:37:06
| 2023-09-01T11:37:06
| 64,407,069
| 102
| 69
|
Apache-2.0
| 2023-06-28T07:13:03
| 2016-07-28T15:30:40
|
C
|
UTF-8
|
C
| false
| false
| 33,641
|
c
|
usbd_ccid_cmd.c
|
/**
******************************************************************************
* @file usbd_ccid_cmd.c
* @author MCD Application Team
* @version V1.0.1
* @date 31-January-2014
* @brief CCID Commands handling
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2
*
* 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.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "usbd_ccid_cmd.h"
#ifdef HAVE_USB_CLASS_CCID
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
#define CCID_UpdateCommandStatus(cmd_status,icc_status)\
G_io_ccid.bulk_header.bulkin.bStatus=(cmd_status|icc_status)
/*
The Above Macro can take any of following Values
#define BM_ICC_PRESENT_ACTIVE 0x00
#define BM_ICC_PRESENT_INACTIVE 0x01
#define BM_ICC_NO_ICC_PRESENT 0x02
#define BM_COMMAND_STATUS_OFFSET 0x06
#define BM_COMMAND_STATUS_NO_ERROR 0x00
#define BM_COMMAND_STATUS_FAILED (0x01 << BM_COMMAND_STATUS_OFFSET)
#define BM_COMMAND_STATUS_TIME_EXTN (0x02 << BM_COMMAND_STATUS_OFFSET)
*/
/* Private function prototypes -----------------------------------------------*/
static uint8_t CCID_CheckCommandParams (uint32_t param_type);
/* Private functions ---------------------------------------------------------*/
/**
* @brief PC_to_RDR_IccPowerOn
* PC_TO_RDR_ICCPOWERON message execution, apply voltage and get ATR
* @param None
* @retval uint8_t status of the command execution
*/
uint8_t PC_to_RDR_IccPowerOn(void)
{
/* Apply the ICC VCC
Fills the Response buffer with ICC ATR
This Command is returned with RDR_to_PC_DataBlock();
*/
uint8_t voltage;
uint8_t sc_voltage = 0;
uint8_t error;
G_io_ccid.bulk_header.bulkin.dwLength = 0; /* Reset Number of Bytes in abData */
error = CCID_CheckCommandParams(CHK_PARAM_SLOT |\
CHK_PARAM_DWLENGTH | \
CHK_PARAM_abRFU2 |\
CHK_PARAM_CARD_PRESENT |\
CHK_PARAM_ABORT );
if (error != 0)
{
return error;
}
/* Voltage that is applied to the ICC
00h � Automatic Voltage Selection
01h � 5.0 volts
02h � 3.0 volts
03h � 1.8 volts
*/
/* G_io_ccid.bulk_header.bulkout.bSpecific_0 Contains bPowerSelect */
voltage = G_io_ccid.bulk_header.bulkout.bSpecific_0;
if (voltage >= VOLTAGE_SELECTION_1V8)
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
return SLOTERROR_BAD_POWERSELECT; /* The Voltage specified is out of Spec */
}
/* Correct Voltage Requested by the Host */
if ((voltage == VOLTAGE_SELECTION_AUTOMATIC) ||
(voltage == VOLTAGE_SELECTION_3V))
{
/* voltage == 00 Voltage Automatic
voltage == 01 Voltage Automatic = 5.0V
voltage == 02 Voltage Automatic = 3V
voltage == 03 Voltage Automatic = 1.8V
*/
sc_voltage = SC_VOLTAGE_3V;
}
else if (voltage == VOLTAGE_SELECTION_5V)
{
sc_voltage = SC_VOLTAGE_5V;
}
G_io_ccid.bulk_header.bulkin.dwLength = SC_AnswerToReset(sc_voltage, G_io_ccid_data_buffer);
/* Check if the Card has come to Active State*/
error = CCID_CheckCommandParams(CHK_ACTIVE_STATE);
if (error != 0)
{
/* Check if Voltage is not Automatic */
if (voltage != 0)
{ /* If Specific Voltage requested by Host i.e 3V or 5V*/
return error;
}
else
{/* Automatic Voltage selection requested by Host */
if (sc_voltage != SC_VOLTAGE_5V)
{ /* If voltage selected was Automatic and 5V is not yet tried */
sc_voltage = SC_VOLTAGE_5V;
G_io_ccid.bulk_header.bulkin.dwLength = SC_AnswerToReset(sc_voltage, G_io_ccid_data_buffer);
/* Check again the State */
error = CCID_CheckCommandParams(CHK_ACTIVE_STATE);
if (error != 0)
return error;
}
else
{ /* Voltage requested from Host was 5V already*/
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_INACTIVE);
return error;
}
} /* Voltage Selection was automatic */
} /* If Active State */
/* ATR is received, No Error Condition Found */
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR, BM_ICC_PRESENT_ACTIVE);
return SLOT_NO_ERROR;
}
/**
* @brief PC_to_RDR_IccPowerOff
* Icc VCC is switched Off
* @param None
* @retval uint8_t error: status of the command execution
*/
uint8_t PC_to_RDR_IccPowerOff(void)
{
/* The response to this command message is the RDR_to_PC_SlotStatus
response message. */
uint8_t error;
error = CCID_CheckCommandParams(CHK_PARAM_SLOT |\
CHK_PARAM_abRFU3 |\
CHK_PARAM_DWLENGTH );
if (error != 0)
{
return error;
}
/* Command is ok, Check for Card Presence */
if (SC_Detect())
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR,BM_ICC_PRESENT_INACTIVE);
}
else
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR,BM_ICC_NO_ICC_PRESENT);
}
/* Power OFF the card */
SC_Poweroff();
return SLOT_NO_ERROR;
}
/**
* @brief PC_to_RDR_GetSlotStatus
* Provides the Slot status to the host
* @param None
* @retval uint8_t status of the command execution
*/
uint8_t PC_to_RDR_GetSlotStatus(void)
{
uint8_t error;
error = CCID_CheckCommandParams(CHK_PARAM_SLOT |\
CHK_PARAM_DWLENGTH |\
CHK_PARAM_CARD_PRESENT |\
CHK_PARAM_abRFU3 );
if (error != 0)
{
return error;
}
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR,BM_ICC_PRESENT_ACTIVE);
return SLOT_NO_ERROR;
}
/**
* @brief PC_to_RDR_XfrBlock
* Handles the Block transfer from Host.
* Response to this command message is the RDR_to_PC_DataBlock
* @param None
* @retval uint8_t status of the command execution
*/
uint8_t PC_to_RDR_XfrBlock(void)
{
uint16_t expectedLength, reqlen;
uint8_t error;
error = CCID_CheckCommandParams(CHK_PARAM_SLOT |\
CHK_PARAM_CARD_PRESENT |\
CHK_PARAM_abRFU3 |\
CHK_PARAM_ABORT |\
CHK_ACTIVE_STATE );
if (error != 0)
return error;
if (G_io_ccid.bulk_header.bulkout.dwLength > IO_CCID_DATA_BUFFER_SIZE)
{ /* Check amount of Data Sent by Host is > than memory allocated ? */
return SLOTERROR_BAD_DWLENGTH;
}
/* wLevelParameter = Size of expected data to be returned by the
bulk-IN endpoint */
expectedLength = (G_io_ccid.bulk_header.bulkout.bSpecific_2 << 8) |
G_io_ccid.bulk_header.bulkout.bSpecific_1;
reqlen = G_io_ccid.bulk_header.bulkout.dwLength;
G_io_ccid.bulk_header.bulkin.dwLength = (uint16_t)expectedLength;
error = SC_XferBlock(&G_io_ccid_data_buffer[0],
reqlen,
&expectedLength);
if (error != SLOT_NO_ERROR)
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
}
else
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR, BM_ICC_PRESENT_ACTIVE);
error = SLOT_NO_ERROR;
}
return error;
}
/**
* @brief PC_to_RDR_GetParameters
* Provides the ICC parameters to the host
* Response to this command message is the RDR_to_PC_Parameters
* @param None
* @retval uint8_t status of the command execution
*/
uint8_t PC_to_RDR_GetParameters(void)
{
uint8_t error;
error = CCID_CheckCommandParams(CHK_PARAM_SLOT |\
CHK_PARAM_DWLENGTH |\
CHK_PARAM_CARD_PRESENT |\
CHK_PARAM_abRFU3 );
if (error != 0)
return error;
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR, BM_ICC_PRESENT_ACTIVE);
return SLOT_NO_ERROR;
}
/**
* @brief PC_to_RDR_ResetParameters
* Set the ICC parameters to the default
* Response to this command message is the RDR_to_PC_Parameters
* @param None
* @retval uint8_t status of the command execution
*/
uint8_t PC_to_RDR_ResetParameters(void)
{
uint8_t error;
error = CCID_CheckCommandParams(CHK_PARAM_SLOT |\
CHK_PARAM_DWLENGTH |\
CHK_PARAM_CARD_PRESENT |\
CHK_PARAM_abRFU3 |\
CHK_ACTIVE_STATE);
if (error != 0)
return error;
/* This command resets the slot parameters to their default values */
G_io_ccid.Protocol0_DataStructure.bmFindexDindex = DEFAULT_FIDI;
G_io_ccid.Protocol0_DataStructure.bmTCCKST0 = DEFAULT_T01CONVCHECKSUM;
G_io_ccid.Protocol0_DataStructure.bGuardTimeT0 = DEFAULT_EXTRA_GUARDTIME;
G_io_ccid.Protocol0_DataStructure.bWaitingIntegerT0 = DEFAULT_WAITINGINTEGER;
G_io_ccid.Protocol0_DataStructure.bClockStop = DEFAULT_CLOCKSTOP;
error = SC_SetParams(&G_io_ccid.Protocol0_DataStructure);
if (error != SLOT_NO_ERROR)
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
}
else
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR, BM_ICC_PRESENT_ACTIVE);
error = SLOT_NO_ERROR;
}
return error;
}
/**
* @brief PC_to_RDR_SetParameters
* Set the ICC parameters to the host defined parameters
* Response to this command message is the RDR_to_PC_Parameters
* @param None
* @retval uint8_t status of the command execution
*/
uint8_t PC_to_RDR_SetParameters(void)
{
uint8_t error;
error = CCID_CheckCommandParams(CHK_PARAM_SLOT |\
CHK_PARAM_CARD_PRESENT |\
CHK_PARAM_abRFU2 |\
CHK_ACTIVE_STATE);
if (error != 0)
return error;
error = SLOT_NO_ERROR;
/* for Protocol T=0 (bProtocolNum=0) (dwLength=00000005h) */
if ( (G_io_ccid.bulk_header.bulkout.dwLength == 5) &&
(G_io_ccid.bulk_header.bulkout.bSpecific_0 != 0))
error = SLOTERROR_BAD_PROTOCOLNUM;
/* for Protocol T=1 (bProtocolNum=1) (dwLength=00000007h) */
if ( (G_io_ccid.bulk_header.bulkout.dwLength == 7) &&
(G_io_ccid.bulk_header.bulkout.bSpecific_0 != 1))
error = SLOTERROR_CMD_NOT_SUPPORTED;
/* For T0, Waiting Integer 0 supported */
if (G_io_ccid_data_buffer[3] != 0)
error = SLOTERROR_BAD_WAITINGINTEGER;
if (G_io_ccid_data_buffer[4] != DEFAULT_CLOCKSTOP)
error = SLOTERROR_BAD_CLOCKSTOP;
if (error != SLOT_NO_ERROR)
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
}
memcpy(&G_io_ccid.Protocol0_DataStructure, (Protocol0_DataStructure_t*)(&(G_io_ccid_data_buffer[0])), sizeof(Protocol0_DataStructure_t));
error = SC_SetParams(&G_io_ccid.Protocol0_DataStructure);
if (error != SLOT_NO_ERROR)
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
}
else
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR, BM_ICC_PRESENT_ACTIVE);
error = SLOT_NO_ERROR;
}
return error;
}
/**
* @brief PC_to_RDR_Escape
* Execute the Escape command. This is user specific Implementation
* Response to this command message is the RDR_to_PC_Escape
* @param None
* @retval uint8_t status of the command execution
*/
uint8_t PC_to_RDR_Escape(void)
{
uint8_t error;
uint16_t size;
error = CCID_CheckCommandParams(CHK_PARAM_SLOT |\
CHK_PARAM_CARD_PRESENT |\
CHK_PARAM_abRFU3 |\
CHK_PARAM_ABORT |\
CHK_ACTIVE_STATE);
if (error != 0)
return error;
error = SC_ExecuteEscape(&G_io_ccid_data_buffer[0],
G_io_ccid.bulk_header.bulkout.dwLength,
&G_io_ccid_data_buffer[0],
&size);
G_io_ccid.bulk_header.bulkin.dwLength = size;
if (error != SLOT_NO_ERROR)
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
}
else
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR, BM_ICC_PRESENT_ACTIVE);
}
return error;
}
/**
* @brief PC_to_RDR_IccClock
* Execute the Clock specific command from host
* Response to this command message is the RDR_to_PC_SlotStatus
* @param None
* @retval uint8_t status of the command execution
*/
uint8_t PC_to_RDR_IccClock(void)
{
uint8_t error;
error = CCID_CheckCommandParams(CHK_PARAM_SLOT |\
CHK_PARAM_CARD_PRESENT |\
CHK_PARAM_abRFU2 |\
CHK_PARAM_DWLENGTH|\
CHK_ACTIVE_STATE);
if (error != 0)
return error;
/* bClockCommand � 00h restarts Clock
� 01h Stops Clock in the state shown in the bClockStop
field of the PC_to_RDR_SetParameters command
and RDR_to_PC_Parameters message.*/
if (G_io_ccid.bulk_header.bulkout.bSpecific_0 > 1)
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
return SLOTERROR_BAD_CLOCKCOMMAND;
}
error = SC_SetClock(G_io_ccid.bulk_header.bulkout.bSpecific_0);
if (error != SLOT_NO_ERROR)
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
}
else
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR, BM_ICC_PRESENT_ACTIVE);
}
return error;
}
/**
* @brief PC_to_RDR_Abort
* Execute the Abort command from host, This stops all Bulk transfers
* from host and ICC
* Response to this command message is the RDR_to_PC_SlotStatus
* @param None
* @retval uint8_t status of the command execution
*/
uint8_t PC_to_RDR_Abort(void)
{
uint8_t error;
error = CCID_CheckCommandParams(CHK_PARAM_SLOT |\
CHK_PARAM_abRFU3 |\
CHK_PARAM_DWLENGTH);
if (error != 0)
return error;
CCID_CmdAbort (G_io_ccid.bulk_header.bulkout.bSlot, G_io_ccid.bulk_header.bulkout.bSeq);
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR,BM_ICC_PRESENT_ACTIVE);
return SLOT_NO_ERROR;
}
/**
* @brief CCID_CmdAbort
* Execute the Abort command from Bulk EP or from Control EP,
* This stops all Bulk transfers from host and ICC
* @param uint8_t slot: slot number that host wants to abort
* @param uint8_t seq : Seq number for PC_to_RDR_Abort
* @retval uint8_t status of the command execution
*/
uint8_t CCID_CmdAbort(uint8_t slot, uint8_t seq)
{
/* This function is called for REQUEST_ABORT & PC_to_RDR_Abort */
if (slot >= CCID_NUMBER_OF_SLOTS)
{ /* This error condition is possible only from CLASS_REQUEST, otherwise
Slot is already checked in parameters from PC_to_RDR_Abort request */
/* Slot requested is more than supported by Firmware */
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED,BM_ICC_NO_ICC_PRESENT);
return SLOTERROR_BAD_SLOT;
}
if ( G_io_ccid.usb_ccid_param.bAbortRequestFlag == 1)
{ /* Abort Command was already received from ClassReq or PC_to_RDR */
if (( G_io_ccid.usb_ccid_param.bSeq == seq) && (G_io_ccid.usb_ccid_param.bSlot == slot))
{
/* CLASS Specific request is already Received, Reset the abort flag */
G_io_ccid.usb_ccid_param.bAbortRequestFlag = 0;
}
}
else
{
/* Abort Command was NOT received from ClassReq or PC_to_RDR,
so save them for next ABORT command to verify */
G_io_ccid.usb_ccid_param.bAbortRequestFlag = 1;
G_io_ccid.usb_ccid_param.bSeq = seq ;
G_io_ccid.usb_ccid_param.bSlot = slot;
}
return 0;
}
/**
* @brief PC_TO_RDR_T0Apdu
* Execute the PC_TO_RDR_T0APDU command from host
* Response to this command message is the RDR_to_PC_SlotStatus
* @param None
* @retval uint8_t status of the command execution
*/
uint8_t PC_TO_RDR_T0Apdu(void)
{
uint8_t error;
error = CCID_CheckCommandParams(CHK_PARAM_SLOT |\
CHK_PARAM_CARD_PRESENT |\
CHK_PARAM_DWLENGTH |
CHK_PARAM_ABORT );
if (error != 0)
return error;
if (G_io_ccid.bulk_header.bulkout.bSpecific_0 > 0x03)
{/* Bit 0 is associated with field bClassGetResponse
Bit 1 is associated with field bClassEnvelope
Other bits are RFU.*/
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
return SLOTERROR_BAD_BMCHANGES;
}
error = SC_T0Apdu(G_io_ccid.bulk_header.bulkout.bSpecific_0,
G_io_ccid.bulk_header.bulkout.bSpecific_1,
G_io_ccid.bulk_header.bulkout.bSpecific_2);
if (error != SLOT_NO_ERROR)
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
}
else
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR, BM_ICC_PRESENT_ACTIVE);
}
return error;
}
/**
* @brief PC_TO_RDR_Mechanical
* Execute the PC_TO_RDR_MECHANICAL command from host
* Response to this command message is the RDR_to_PC_SlotStatus
* @param None
* @retval uint8_t status of the command execution
*/
uint8_t PC_TO_RDR_Mechanical(void)
{
uint8_t error;
error = CCID_CheckCommandParams(CHK_PARAM_SLOT |\
CHK_PARAM_CARD_PRESENT |\
CHK_PARAM_abRFU2 |\
CHK_PARAM_DWLENGTH
);
if (error != 0)
return error;
if (G_io_ccid.bulk_header.bulkout.bSpecific_0 > 0x05)
{/* 01h � Accept Card
02h � Eject Card
03h � Capture Card
04h � Lock Card
05h � Unlock Card*/
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
return SLOTERROR_BAD_BFUNCTION_MECHANICAL;
}
error = SC_Mechanical(G_io_ccid.bulk_header.bulkout.bSpecific_0);
if (error != SLOT_NO_ERROR)
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
}
else
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR, BM_ICC_PRESENT_ACTIVE);
}
return error;
}
/**
* @brief PC_TO_RDR_SetDataRateAndClockFrequency
* Set the required Card Frequency and Data rate from the host.
* Response to this command message is the
* RDR_to_PC_DataRateAndClockFrequency
* @param None
* @retval uint8_t status of the command execution
*/
uint8_t PC_TO_RDR_SetDataRateAndClockFrequency(void)
{
uint8_t error;
uint32_t clockFrequency;
uint32_t dataRate;
uint32_t temp =0;
error = CCID_CheckCommandParams(CHK_PARAM_SLOT |\
CHK_PARAM_CARD_PRESENT |\
CHK_PARAM_abRFU3);
if (error != 0)
return error;
if (G_io_ccid.bulk_header.bulkout.dwLength != 0x08)
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED,BM_ICC_PRESENT_ACTIVE);
return SLOTERROR_BAD_LENTGH;
}
/* HERE we avoiding to an unaligned memory access*/
clockFrequency = U4LE(G_io_ccid_data_buffer, 0);
dataRate = U4LE(G_io_ccid_data_buffer, 4);
error = SC_SetDataRateAndClockFrequency(clockFrequency, dataRate);
G_io_ccid.bulk_header.bulkin.bError = error;
if (error != SLOT_NO_ERROR)
{
G_io_ccid.bulk_header.bulkin.dwLength = 0;
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
}
else
{
G_io_ccid.bulk_header.bulkin.dwLength = 8;
(G_io_ccid_data_buffer[0]) = clockFrequency & 0x000000FF ;
(G_io_ccid_data_buffer[1]) = (clockFrequency & 0x0000FF00) >> 8;
(G_io_ccid_data_buffer[2]) = (clockFrequency & 0x00FF0000) >> 16;
(G_io_ccid_data_buffer[3]) = (clockFrequency & 0xFF000000) >> 24;
(G_io_ccid_data_buffer[4]) = dataRate & 0x000000FF ;
(G_io_ccid_data_buffer[5]) = (dataRate & 0x0000FF00) >> 8;
(G_io_ccid_data_buffer[6]) = (dataRate & 0x00FF0000) >> 16;
(G_io_ccid_data_buffer[7]) = (dataRate & 0xFF000000) >> 24;
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR, BM_ICC_PRESENT_ACTIVE);
}
return error;
}
/**
* @brief PC_TO_RDR_Secure
* Execute the Secure Command from the host.
* Response to this command message is the RDR_to_PC_DataBlock
* @param None
* @retval uint8_t status of the command execution
*/
uint8_t PC_TO_RDR_Secure(void)
{
uint8_t error;
uint8_t bBWI;
uint16_t wLevelParameter;
uint32_t responseLen;
error = CCID_CheckCommandParams(CHK_PARAM_SLOT |\
CHK_PARAM_CARD_PRESENT |\
CHK_PARAM_ABORT );
if (error != 0) {
G_io_ccid.bulk_header.bulkin.dwLength = 0;
return error;
}
bBWI = G_io_ccid.bulk_header.bulkout.bSpecific_0;
wLevelParameter = (G_io_ccid.bulk_header.bulkout.bSpecific_1 + ((uint16_t)G_io_ccid.bulk_header.bulkout.bSpecific_2<<8));
if ((EXCHANGE_LEVEL_FEATURE == TPDU_EXCHANGE) ||
(EXCHANGE_LEVEL_FEATURE == SHORT_APDU_EXCHANGE))
{
/* TPDU level & short APDU level, wLevelParameter is RFU, = 0000h */
if (wLevelParameter != 0 )
{
G_io_ccid.bulk_header.bulkin.dwLength = 0;
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
error = SLOTERROR_BAD_LEVELPARAMETER;
return error;
}
}
error = SC_Secure(G_io_ccid.bulk_header.bulkout.dwLength - CCID_HEADER_SIZE, bBWI, wLevelParameter,
&G_io_ccid_data_buffer[0], &responseLen);
G_io_ccid.bulk_header.bulkin.dwLength = responseLen;
if (error != SLOT_NO_ERROR)
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED, BM_ICC_PRESENT_ACTIVE);
}
else
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_NO_ERROR, BM_ICC_PRESENT_ACTIVE);
}
return error;
}
/******************************************************************************/
/* BULK IN ROUTINES */
/******************************************************************************/
/**
* @brief RDR_to_PC_DataBlock
* Provide the data block response to the host
* Response for PC_to_RDR_IccPowerOn, PC_to_RDR_XfrBlock
* @param uint8_t errorCode: code to be returned to the host
* @retval None
*/
void RDR_to_PC_DataBlock(uint8_t errorCode)
{
G_io_ccid.bulk_header.bulkin.bMessageType = RDR_TO_PC_DATABLOCK;
G_io_ccid.bulk_header.bulkin.bError = errorCode;
G_io_ccid.bulk_header.bulkin.bSpecific=0; /* bChainParameter */
/* void the Length Specified in Command */
if(errorCode != SLOT_NO_ERROR)
{
G_io_ccid.bulk_header.bulkin.dwLength = 0;
}
Transfer_Data_Request();
}
/**
* @brief RDR_to_PC_SlotStatus
* Provide the Slot status response to the host
* Response for PC_to_RDR_IccPowerOff
* PC_to_RDR_GetSlotStatus
* PC_to_RDR_IccClock
* PC_to_RDR_T0APDU
* PC_to_RDR_Mechanical
* Also the device sends this response message when it has completed
* aborting a slot after receiving both the Class Specific ABORT request
* and PC_to_RDR_Abort command message.
* @param uint8_t errorCode: code to be returned to the host
* @retval None
*/
void RDR_to_PC_SlotStatus(uint8_t errorCode)
{
G_io_ccid.bulk_header.bulkin.bMessageType = RDR_TO_PC_SLOTSTATUS;
G_io_ccid.bulk_header.bulkin.dwLength =0;
G_io_ccid.bulk_header.bulkin.bError = errorCode;
G_io_ccid.bulk_header.bulkin.bSpecific=0; /* bClockStatus = 00h Clock running
01h Clock stopped in state L
02h Clock stopped in state H
03h Clock stopped in an unknown state
All other values are RFU. */
Transfer_Data_Request();
}
/**
* @brief RDR_to_PC_Parameters
* Provide the data block response to the host
* Response for PC_to_RDR_GetParameters, PC_to_RDR_ResetParameters
* PC_to_RDR_SetParameters
* @param uint8_t errorCode: code to be returned to the host
* @retval None
*/
void RDR_to_PC_Parameters(uint8_t errorCode)
{
G_io_ccid.bulk_header.bulkin.bMessageType = RDR_TO_PC_PARAMETERS;
G_io_ccid.bulk_header.bulkin.bError = errorCode;
if(errorCode == SLOT_NO_ERROR)
{
G_io_ccid.bulk_header.bulkin.dwLength = LEN_PROTOCOL_STRUCT_T0;
}
else
{
G_io_ccid.bulk_header.bulkin.dwLength = 0;
}
memcpy(G_io_ccid_data_buffer, &G_io_ccid.Protocol0_DataStructure, sizeof(G_io_ccid.Protocol0_DataStructure));
/* bProtocolNum */
G_io_ccid.bulk_header.bulkin.bSpecific = BPROTOCOL_NUM_T0;
Transfer_Data_Request();
}
/**
* @brief RDR_to_PC_Escape
* Provide the Escaped data block response to the host
* Response for PC_to_RDR_Escape
* @param uint8_t errorCode: code to be returned to the host
* @retval None
*/
void RDR_to_PC_Escape(uint8_t errorCode)
{
G_io_ccid.bulk_header.bulkin.bMessageType = RDR_TO_PC_ESCAPE;
G_io_ccid.bulk_header.bulkin.bSpecific=0; /* Reserved for Future Use */
G_io_ccid.bulk_header.bulkin.bError = errorCode;
/* void the Length Specified in Command */
if(errorCode != SLOT_NO_ERROR)
{
G_io_ccid.bulk_header.bulkin.dwLength = 0;
}
Transfer_Data_Request();
}
/**
* @brief RDR_to_PC_DataRateAndClockFrequency
* Provide the Clock and Data Rate information to host
* Response for PC_TO_RDR_SetDataRateAndClockFrequency
* @param uint8_t errorCode: code to be returned to the host
* @retval None
*/
void RDR_to_PC_DataRateAndClockFrequency(uint8_t errorCode)
{
/*
uint16_t length = CCID_RESPONSE_HEADER_SIZE;
*/
G_io_ccid.bulk_header.bulkin.bMessageType = RDR_TO_PC_DATARATEANDCLOCKFREQUENCY;
G_io_ccid.bulk_header.bulkin.bError = errorCode;
G_io_ccid.bulk_header.bulkin.bSpecific=0; /* Reserved for Future Use */
/* void the Length Specified in Command */
if(errorCode != SLOT_NO_ERROR)
{
G_io_ccid.bulk_header.bulkin.dwLength = 0;
}
Transfer_Data_Request();
}
#ifdef HAVE_CCID_INTERRUPT
/**
* @brief RDR_to_PC_NotifySlotChange
* Interrupt message to be sent to the host, Checks the card presence
* status and update the buffer accordingly
* @param None
* @retval None
*/
void RDR_to_PC_NotifySlotChange(void)
{
G_io_ccid.UsbIntMessageBuffer[OFFSET_INT_BMESSAGETYPE] = RDR_TO_PC_NOTIFYSLOTCHANGE;
if (SC_Detect() )
{
/*
SLOT_ICC_PRESENT 0x01 : LSb : (0b = no ICC present, 1b = ICC present)
SLOT_ICC_CHANGE 0x02 : MSb : (0b = no change, 1b = change).
*/
G_io_ccid.UsbIntMessageBuffer[OFFSET_INT_BMSLOTICCSTATE] = SLOT_ICC_PRESENT |
SLOT_ICC_CHANGE;
}
else
{
G_io_ccid.UsbIntMessageBuffer[OFFSET_INT_BMSLOTICCSTATE] = SLOT_ICC_CHANGE;
/* Power OFF the card */
SC_Poweroff();
}
}
#endif // HAVE_CCID_INTERRUPT
/**
* @brief CCID_UpdSlotStatus
* Updates the variable for the slot status
* @param uint8_t slotStatus : slot status from the calling function
* @retval None
*/
void CCID_UpdSlotStatus (uint8_t slotStatus)
{
G_io_ccid.Ccid_SlotStatus.SlotStatus = slotStatus;
}
/**
* @brief CCID_UpdSlotChange
* Updates the variable for the slot change status
* @param uint8_t changeStatus : slot change status from the calling function
* @retval None
*/
void CCID_UpdSlotChange (uint8_t changeStatus)
{
G_io_ccid.Ccid_SlotStatus.SlotStatusChange = changeStatus;
}
/**
* @brief CCID_IsSlotStatusChange
* Provides the value of the variable for the slot change status
* @param None
* @retval uint8_t slot change status
*/
uint8_t CCID_IsSlotStatusChange (void)
{
return G_io_ccid.Ccid_SlotStatus.SlotStatusChange;
}
/**
* @brief CCID_CheckCommandParams
* Checks the specific parameters requested by the function and update
* status accordingly. This function is called from all
* PC_to_RDR functions
* @param uint32_t param_type : Parameter enum to be checked by calling function
* @retval uint8_t status
*/
static uint8_t CCID_CheckCommandParams (uint32_t param_type)
{
uint32_t parameter;
G_io_ccid.bulk_header.bulkin.bStatus = BM_ICC_PRESENT_ACTIVE | BM_COMMAND_STATUS_NO_ERROR ;
parameter = (uint32_t)param_type;
if (parameter & CHK_PARAM_SLOT)
{
/*
The slot number (bSlot) identifies which ICC slot is being addressed
by the message, if the CCID supports multiple slots.
The slot number is zero-relative, and is in the range of zero to FFh.
*/
/* SLOT Number is 0 onwards, so always < CCID_NUMBER_OF_SLOTs */
/* Error Condition !!! */
if (G_io_ccid.bulk_header.bulkout.bSlot >= CCID_NUMBER_OF_SLOTS)
{ /* Slot requested is more than supported by Firmware */
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED,BM_ICC_NO_ICC_PRESENT);
return SLOTERROR_BAD_SLOT;
}
}
if (parameter & CHK_PARAM_CARD_PRESENT)
{
/* Commands Parameters ok, Check the Card Status */
if (SC_Detect() == 0)
{ /* Card is Not detected */
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED,BM_ICC_NO_ICC_PRESENT);
return SLOTERROR_ICC_MUTE;
}
}
/* Check that DwLength is 0 */
if (parameter & CHK_PARAM_DWLENGTH)
{
if (G_io_ccid.bulk_header.bulkout.dwLength != 0)
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED,BM_ICC_PRESENT_ACTIVE);
return SLOTERROR_BAD_LENTGH;
}
}
/* abRFU 2 : Reserved for Future Use*/
if (parameter & CHK_PARAM_abRFU2)
{
if ((G_io_ccid.bulk_header.bulkout.bSpecific_1 != 0) ||
(G_io_ccid.bulk_header.bulkout.bSpecific_2 != 0))
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED,BM_ICC_PRESENT_ACTIVE);
return SLOTERROR_BAD_ABRFU_2B; /* bSpecific_1 */
}
}
if (parameter & CHK_PARAM_abRFU3)
{
/* abRFU 3 : Reserved for Future Use*/
if ((G_io_ccid.bulk_header.bulkout.bSpecific_0 != 0) ||
(G_io_ccid.bulk_header.bulkout.bSpecific_1 != 0) ||
(G_io_ccid.bulk_header.bulkout.bSpecific_2 != 0))
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED,BM_ICC_PRESENT_ACTIVE);
return SLOTERROR_BAD_ABRFU_3B;
}
}
if (parameter & CHK_PARAM_ABORT)
{
if( G_io_ccid.usb_ccid_param.bAbortRequestFlag )
{
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED,BM_ICC_PRESENT_INACTIVE);
return SLOTERROR_CMD_ABORTED;
}
}
if (parameter & CHK_ACTIVE_STATE)
{
/* Commands Parameters ok, Check the Card Status */
/* Card is detected */
if (! SC_Detect())
{
/* Check that from Lower Layers, the SmartCard come to known state */
CCID_UpdateCommandStatus(BM_COMMAND_STATUS_FAILED,BM_ICC_PRESENT_INACTIVE);
return SLOTERROR_HW_ERROR;
}
}
return 0;
}
#endif // HAVE_USB_CLASS_CCID
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
4c63b01fc7dd89921665c2ed5ffc9715e689b2a6
|
24f96097667640b0a6ba9cabbcd159bfb0939b1c
|
/src/rifiuti.c
|
a1a1eafd6dd59f4ca6c845e01697abb9b658ebfe
|
[
"BSD-3-Clause"
] |
permissive
|
abelcheung/rifiuti2
|
9ec2ff288b978e86c46e16a65da6ab00d89adb8b
|
71de5431da39f39f2051d7a9ad2090f9092bccc4
|
refs/heads/master
| 2021-01-20T05:31:27.546378
| 2019-05-23T08:18:19
| 2019-05-23T08:18:48
| 32,100,044
| 143
| 32
| null | null | null | null |
UTF-8
|
C
| false
| false
| 13,479
|
c
|
rifiuti.c
|
/* vim: set sw=4 ts=4 noexpandtab : */
/*
* Copyright (C) 2003, by Keith J. Jones.
* Copyright (C) 2007-2019 Abel Cheung.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project 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 PROJECT 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 PROJECT 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 "config.h"
#include <errno.h>
#include <stdlib.h>
#include "utils.h"
#ifdef G_OS_WIN32
# include "utils-win.h"
#endif
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include "rifiuti.h"
static r2status exit_status = EXIT_SUCCESS;
static metarecord meta;
extern char *legacy_encoding;
/* 0-25 => A-Z, 26 => '\', 27 or above is erraneous */
unsigned char driveletters[28] =
{
'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U',
'V', 'W', 'X', 'Y', 'Z', '\\', '?'
};
/*!
* Check if index file has sufficient amount of data for reading
* 0 = success, all other return status = error
* If success, infile will be set to file pointer and other args
* will be filled, otherwise file pointer = NULL
*/
static r2status
validate_index_file (const char *filename,
FILE **infile)
{
void *buf;
FILE *fp = NULL;
uint32_t ver;
int e, ret;
g_debug ("Start file validation...");
g_return_val_if_fail ( infile != NULL, R2_ERR_INTERNAL );
*infile = NULL;
if ( !(fp = g_fopen (filename, "rb")) )
{
e = errno;
g_printerr (_("Error opening file '%s' for reading: %s"),
filename, g_strerror (e));
g_printerr ("\n");
return R2_ERR_OPEN_FILE;
}
buf = g_malloc (RECORD_START_OFFSET);
if ( 1 > fread (buf, RECORD_START_OFFSET, 1, fp) )
{
/* TRANSLATOR COMMENT: file size must be at least 20 bytes */
g_critical (_("File size less than minimum allowed (%d bytes)"), RECORD_START_OFFSET);
ret = R2_ERR_BROKEN_FILE;
goto validation_broken;
}
copy_field (&ver, VERSION, KEPT_ENTRY);
ver = GUINT32_FROM_LE (ver);
/* total_entry only meaningful for 95 and NT4, on other versions
* it's junk memory data, don't bother copying */
if ( ( ver == VERSION_NT4 ) || ( ver == VERSION_WIN95 ) ) {
copy_field (&meta.total_entry, TOTAL_ENTRY, RECORD_SIZE);
meta.total_entry = GUINT32_FROM_LE (meta.total_entry);
}
copy_field (&meta.recordsize, RECORD_SIZE, FILESIZE_SUM);
meta.recordsize = GUINT32_FROM_LE (meta.recordsize);
g_free (buf);
/* Turns out version is not reliable indicator. Use size instead */
switch (meta.recordsize)
{
case LEGACY_RECORD_SIZE:
meta.has_unicode_path = FALSE;
if ( ( ver != VERSION_ME_03 ) && /* ME still use 280 byte record */
( ver != VERSION_WIN98 ) &&
( ver != VERSION_WIN95 ) )
{
g_printerr (_("Unsupported file version, or probably not an INFO2 file at all."));
g_printerr ("\n");
ret = R2_ERR_BROKEN_FILE;
goto validation_broken;
}
if (!legacy_encoding)
{
g_printerr (_("This INFO2 file was produced on a legacy system "
"without Unicode file name (Windows ME or earlier). "
"Please specify codepage of concerned system with "
"'-l' or '--legacy-filename' option."));
g_printerr ("\n\n");
/* TRANSLATOR COMMENT: can choose example from YOUR language & code page */
g_printerr (_("For example, if recycle bin is expected to come from West "
"European versions of Windows, use '-l CP1252' option; "
"or in case of Japanese Windows, use '-l CP932'."));
g_printerr ("\n");
ret = R2_ERR_ARG;
goto validation_broken;
}
break;
case UNICODE_RECORD_SIZE:
meta.has_unicode_path = TRUE;
if ( ( ver != VERSION_ME_03 ) && ( ver != VERSION_NT4 ) )
{
g_printerr (_("Unsupported file version, or probably not an INFO2 file at all."));
g_printerr ("\n");
ret = R2_ERR_BROKEN_FILE;
goto validation_broken;
}
break;
default:
ret = R2_ERR_BROKEN_FILE;
goto validation_broken;
}
rewind (fp);
*infile = fp;
meta.version = (int64_t) ver;
return EXIT_SUCCESS;
validation_broken:
fclose (fp);
return ret;
}
static rbin_struct *
populate_record_data (void *buf)
{
rbin_struct *record;
uint32_t drivenum;
size_t read;
char *legacy_fname;
record = g_malloc0 (sizeof (rbin_struct));
/* Guarantees null-termination by allocating extra byte; same goes with
* unicode filename */
legacy_fname = g_malloc0 (RECORD_INDEX_OFFSET - LEGACY_FILENAME_OFFSET + 1);
copy_field (legacy_fname, LEGACY_FILENAME, RECORD_INDEX);
/* Index number associated with the record */
copy_field (&record->index_n, RECORD_INDEX, DRIVE_LETTER);
record->index_n = GUINT32_FROM_LE (record->index_n);
g_debug ("index=%u", record->index_n);
/* Number representing drive letter */
copy_field (&drivenum, DRIVE_LETTER, FILETIME);
drivenum = GUINT32_FROM_LE (drivenum);
g_debug ("drive=%u", drivenum);
if (drivenum >= sizeof (driveletters) - 1)
g_warning (_("Invalid drive number (0x%X) for record %u."),
drivenum, record->index_n);
record->drive = driveletters[MIN (drivenum, sizeof (driveletters) - 1)];
record->emptied = FALSE;
/* first byte will be removed from filename if file is not in recycle bin */
if (!*legacy_fname)
{
record->emptied = TRUE;
*legacy_fname = record->drive;
}
/* File deletion time */
copy_field (&record->winfiletime, FILETIME, FILESIZE);
record->winfiletime = GINT64_FROM_LE (record->winfiletime);
record->deltime = win_filetime_to_gdatetime (record->winfiletime);
/* File size or occupied cluster size */
/* BEWARE! This is 32bit data casted to 64bit struct member */
copy_field (&record->filesize, FILESIZE, UNICODE_FILENAME);
record->filesize = GUINT64_FROM_LE (record->filesize);
g_debug ("filesize=%" G_GUINT64_FORMAT, record->filesize);
/*
* 1. Only bother populating legacy path if users need it,
* because otherwise we don't know which encoding to use
* 2. Enclose with angle brackets because they are not allowed
* in Windows file name, therefore stands out better that
* the escaped hex sequences are not part of real file name
*/
if (legacy_encoding)
{
record->legacy_path = conv_path_to_utf8_with_tmpl (
legacy_fname, legacy_encoding, "<\\%02X>", &read, &exit_status);
if (record->legacy_path == NULL) {
g_warning (_("(Record %u) Error converting legacy path to UTF-8."),
record->index_n);
record->legacy_path = "";
}
}
g_free (legacy_fname);
if (! meta.has_unicode_path)
return record;
/*******************************************
* Part below deals with unicode path only *
*******************************************/
record->uni_path = conv_path_to_utf8_with_tmpl (
(char *) (buf + UNICODE_FILENAME_OFFSET), NULL,
"<\\u%04X>", &read, &exit_status);
if (record->uni_path == NULL) {
g_warning (_("(Record %u) Error converting unicode path to UTF-8."),
record->index_n);
record->uni_path = "";
}
/*
* We check for junk memory filling the padding area after
* unicode path, using it as the indicator of OS generating this
* INFO2 file. (server 2000 / 2003)
*
* The padding area after legacy path is no good; experiment
* shows that legacy path *always* contain non-zero bytes after
* null terminator if path contains double-byte character,
* regardless of OS.
*
* Those non-zero bytes resemble partial end of full path.
* Looks like an ANSI codepage full path is filled in
* legacy path field, then overwritten in place by a 8.3
* version of path whenever applicable (which was always shorter).
*/
if (! meta.fill_junk)
{
void *ptr;
for (ptr = buf + UNICODE_FILENAME_OFFSET + read;
ptr < buf + UNICODE_RECORD_SIZE; ptr++)
{
if ( *(char *) ptr != '\0' )
{
g_debug ("Junk detected at offset 0x%tx of unicode path",
ptr - buf - UNICODE_FILENAME_OFFSET);
meta.fill_junk = TRUE;
break;
}
}
}
return record;
}
static void
parse_record_cb (char *index_file,
GSList **recordlist)
{
rbin_struct *record;
FILE *infile;
size_t size;
void *buf = NULL;
exit_status = validate_index_file (index_file, &infile);
if ( exit_status != EXIT_SUCCESS )
{
g_printerr (_("File '%s' fails validation."), index_file);
g_printerr ("\n");
return;
}
g_debug ("Start populating record for '%s'...", index_file);
/*
* Add padding bytes as null-termination of unicode file name.
* Normally Windows should have done the null termination within
* WIN_PATH_MAX limit, but on 98/ME/2000 programmers were sloppy
* and use junk memory as padding, so just play safe.
*/
buf = g_malloc0 (meta.recordsize + sizeof(gunichar2));
fseek (infile, RECORD_START_OFFSET, SEEK_SET);
meta.is_empty = TRUE;
while (meta.recordsize == (size = fread (buf, 1, meta.recordsize, infile)))
{
record = populate_record_data (buf);
record->meta = &meta;
/* INFO2 already sort entries by time */
*recordlist = g_slist_append (*recordlist, record);
meta.is_empty = FALSE;
}
g_free (buf);
if ( ferror (infile) )
{
g_critical (_("Failed to read record at position %li: %s"),
ftell (infile), strerror (errno));
exit_status = R2_ERR_OPEN_FILE;
}
if ( feof (infile) && size && ( size < meta.recordsize ) )
{
g_warning (_("Premature end of file, last record (%zu bytes) discarded"), size);
exit_status = R2_ERR_BROKEN_FILE;
}
fclose (infile);
}
int
main (int argc,
char **argv)
{
GSList *filelist = NULL;
GSList *recordlist = NULL;
GOptionContext *context;
extern char **fileargs;
rifiuti_init (argv[0]);
/* TRANSLATOR: appears in help text short summary */
context = g_option_context_new (N_("INFO2"));
g_option_context_set_summary (context, N_(
"Parse INFO2 file and dump recycle bin data."));
rifiuti_setup_opt_ctx (&context, RECYCLE_BIN_TYPE_FILE);
exit_status = rifiuti_parse_opt_ctx (&context, &argc, &argv);
if (exit_status != EXIT_SUCCESS)
goto cleanup;
exit_status = check_file_args (fileargs[0], &filelist, RECYCLE_BIN_TYPE_FILE);
if (exit_status != EXIT_SUCCESS)
goto cleanup;
/*
* TODO May be silly for single file, but would be useful in future
* when reading multiple files from live system
*/
g_slist_foreach (filelist, (GFunc) parse_record_cb, &recordlist);
meta.type = RECYCLE_BIN_TYPE_FILE;
meta.filename = fileargs[0];
/*
* Keeping deleted entry is only available since 98
* Note: always set this variable after parse_record_cb() because
* meta.version is not set beforehand
*/
meta.keep_deleted_entry = ( meta.version >= VERSION_WIN98 );
if ( !meta.is_empty && (recordlist == NULL) )
{
g_printerr ("%s", _("Recycle bin file has no valid record.\n"));
exit_status = R2_ERR_BROKEN_FILE;
goto cleanup;
}
/* Print everything */
{
r2status s = prepare_output_handle ();
if (s != EXIT_SUCCESS) {
exit_status = s;
goto cleanup;
}
}
print_header (meta);
g_slist_foreach (recordlist, (GFunc) print_record_cb, NULL);
print_footer ();
close_output_handle ();
/* file descriptor should have been closed at this point */
{
r2status s = move_temp_file ();
if ( s != EXIT_SUCCESS )
exit_status = s;
}
cleanup:
/* Last minute error messages for accumulated non-fatal errors */
switch (exit_status)
{
case R2_ERR_USER_ENCODING:
if (legacy_encoding) {
g_printerr (_("Some entries could not be interpreted in %s encoding."
" The concerned characters are displayed in hex value instead."
" Very likely the (localised) Windows generating the recycle bin "
"artifact does not use specified codepage."), legacy_encoding);
} else {
g_printerr (_("Some entries could not be presented as correct "
"unicode path. The concerned characters are displayed "
"in escaped unicode sequences."));
}
g_printerr ("\n");
break;
default:
break;
}
g_debug ("Cleaning up...");
g_slist_free_full (recordlist, (GDestroyNotify) free_record_cb);
g_slist_free_full (filelist , (GDestroyNotify) g_free );
free_vars ();
close_error_handle ();
return exit_status;
}
|
4e7164ea37afc7560914e4dbbf54332a34e09bf6
|
d3ef2463f556d6cd166eb29d3a5f5b210a6402e7
|
/cupyx/scipy/ndimage/cuda/pba_kernels_2d.h
|
4156340abd34ea4de329915f5aee5731b99ee19d
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
cupy/cupy
|
ce7a010a57504dbfe4fb5af10d354a22e79f4907
|
96105afb78aa3f8380834d2516184b8365e23fcb
|
refs/heads/main
| 2023-08-31T00:36:47.967611
| 2023-08-30T09:19:27
| 2023-08-30T09:19:27
| 72,523,920
| 7,505
| 1,072
|
MIT
| 2023-09-14T01:04:42
| 2016-11-01T09:54:45
|
Python
|
UTF-8
|
C
| false
| false
| 20,621
|
h
|
pba_kernels_2d.h
|
// Euclidean Distance Transform
//
// Kernels for the 2D version of the Parallel Banding Algorithm (PBA+).
//
// MIT license: see LICENSE in this folder
// Copyright: (c) 2019 School of Computing, National University of Singapore
//
// Modifications by Gregory Lee (2022) (NVIDIA)
// - add user-defined pixel_int2_t to enable
// - replace __mul24 operations with standard multiplication operator
// - Add variant kernels with support for non-isotropic pixel dimensions. These
// kernels differ from the originals in that they also take sx and sy values
// indicating the pixel size along the x and y axes. The kernels are identical
// except that the `dominate` function is replaced by `dominate_sp` and the
// physical spacings are used when computing distances.
//
// START OF DEFINITIONS OVERRIDDEN BY THE PYTHON SCRIPT
// The values included in this header file are those defined in the original
// PBA+ implementation
// However, the Python code generation can potentially generate a different
// ENCODE/DECODE that use 20 bits per coordinates instead of 10 bits per
// coordinate with ENCODED_INT_TYPE as `long long`.
#ifndef MARKER
#define MARKER -32768
#endif
#ifndef BLOCKSIZE
#define BLOCKSIZE 32
#endif
#ifndef pixel_int2_t
#define pixel_int2_t short2
#define make_pixel(x, y) make_short2(x, y)
#endif
// END OF DEFINITIONS OVERRIDDEN BY THE PYTHON SCRIPT
#define TOID(x, y, size) ((y) * (size) + (x))
#define LL long long
__device__ bool dominate(LL x1, LL y1, LL x2, LL y2, LL x3, LL y3, LL x0)
{
LL k1 = y2 - y1, k2 = y3 - y2;
return (k1 * (y1 + y2) + (x2 - x1) * ((x1 + x2) - (x0 << 1))) * k2 > \
(k2 * (y2 + y3) + (x3 - x2) * ((x2 + x3) - (x0 << 1))) * k1;
}
#undef LL
// version of dominate, but with per-axis floating-point spacing
__device__ bool dominate_sp(int _x1, int _y1, int _x2, int _y2, int _x3, int _y3, int _x0, float sx, float sy)
{
float x1 = static_cast<float>(_x1) * sx;
float x2 = static_cast<float>(_x2) * sx;
float x3 = static_cast<float>(_x3) * sx;
float y1 = static_cast<float>(_y1) * sy;
float y2 = static_cast<float>(_y2) * sy;
float y3 = static_cast<float>(_y3) * sy;
float x0_2 = static_cast<float>(_x0 << 1) * sx;
float k1 = (y2 - y1);
float k2 = (y3 - y2);
return (k1 * (y1 + y2) + (x2 - x1) * ((x1 + x2) - x0_2)) * k2 > \
(k2 * (y2 + y3) + (x3 - x2) * ((x2 + x3) - x0_2)) * k1;
}
extern "C"{
__global__ void kernelFloodDown(pixel_int2_t *input, pixel_int2_t *output, int size, int bandSize)
{
int tx = blockIdx.x * blockDim.x + threadIdx.x;
int ty = blockIdx.y * bandSize;
int id = TOID(tx, ty, size);
pixel_int2_t pixel1, pixel2;
pixel1 = make_pixel(MARKER, MARKER);
for (int i = 0; i < bandSize; i++, id += size) {
pixel2 = input[id];
if (pixel2.x != MARKER)
pixel1 = pixel2;
output[id] = pixel1;
}
}
__global__ void kernelFloodUp(pixel_int2_t *input, pixel_int2_t *output, int size, int bandSize)
{
int tx = blockIdx.x * blockDim.x + threadIdx.x;
int ty = (blockIdx.y+1) * bandSize - 1;
int id = TOID(tx, ty, size);
pixel_int2_t pixel1, pixel2;
int dist1, dist2;
pixel1 = make_pixel(MARKER, MARKER);
for (int i = 0; i < bandSize; i++, id -= size) {
dist1 = abs(pixel1.y - ty + i);
pixel2 = input[id];
dist2 = abs(pixel2.y - ty + i);
if (dist2 < dist1)
pixel1 = pixel2;
output[id] = pixel1;
}
}
__global__ void kernelPropagateInterband(pixel_int2_t *input, pixel_int2_t *margin_out, int size, int bandSize)
{
int tx = blockIdx.x * blockDim.x + threadIdx.x;
int inc = bandSize * size;
int ny, nid, nDist;
pixel_int2_t pixel;
// Top row, look backward
int ty = blockIdx.y * bandSize;
int topId = TOID(tx, ty, size);
int bottomId = TOID(tx, ty + bandSize - 1, size);
int tid = blockIdx.y * size + tx;
int bid = tid + (size * size / bandSize);
pixel = input[topId];
int myDist = abs(pixel.y - ty);
margin_out[tid] = pixel;
for (nid = bottomId - inc; nid >= 0; nid -= inc) {
pixel = input[nid];
if (pixel.x != MARKER) {
nDist = abs(pixel.y - ty);
if (nDist < myDist)
margin_out[tid] = pixel;
break;
}
}
// Last row, look downward
ty = ty + bandSize - 1;
pixel = input[bottomId];
myDist = abs(pixel.y - ty);
margin_out[bid] = pixel;
for (ny = ty + 1, nid = topId + inc; ny < size; ny += bandSize, nid += inc) {
pixel = input[nid];
if (pixel.x != MARKER) {
nDist = abs(pixel.y - ty);
if (nDist < myDist)
margin_out[bid] = pixel;
break;
}
}
}
__global__ void kernelUpdateVertical(pixel_int2_t *color, pixel_int2_t *margin, pixel_int2_t *output, int size, int bandSize)
{
__shared__ pixel_int2_t block[BLOCKSIZE][BLOCKSIZE];
int tx = blockIdx.x * blockDim.x + threadIdx.x;
int ty = blockIdx.y * bandSize;
pixel_int2_t top = margin[blockIdx.y * size + tx];
pixel_int2_t bottom = margin[(blockIdx.y + size / bandSize) * size + tx];
pixel_int2_t pixel;
int dist, myDist;
int id = TOID(tx, ty, size);
int n_step = bandSize / blockDim.x;
for(int step = 0; step < n_step; ++step) {
int y_start = blockIdx.y * bandSize + step * blockDim.x;
int y_end = y_start + blockDim.x;
for (ty = y_start; ty < y_end; ++ty, id += size) {
pixel = color[id];
myDist = abs(pixel.y - ty);
dist = abs(top.y - ty);
if (dist < myDist) { myDist = dist; pixel = top; }
dist = abs(bottom.y - ty);
if (dist < myDist) pixel = bottom;
// temporary result is stored in block
block[threadIdx.x][ty - y_start] = make_pixel(pixel.y, pixel.x);
}
__syncthreads();
// block is written to a transposed location in the output
int tid = TOID(blockIdx.y * bandSize + step * blockDim.x + threadIdx.x, \
blockIdx.x * blockDim.x, size);
for(int i = 0; i < blockDim.x; ++i, tid += size) {
output[tid] = block[i][threadIdx.x];
}
__syncthreads();
}
}
__global__ void kernelProximatePoints(pixel_int2_t *input, pixel_int2_t *stack, int size, int bandSize)
{
int tx = blockIdx.x * blockDim.x + threadIdx.x;
int ty = blockIdx.y * bandSize;
int id = TOID(tx, ty, size);
int lasty = -1;
pixel_int2_t last1, last2, current;
last1.y = -1; last2.y = -1;
for (int i = 0; i < bandSize; i++, id += size) {
current = input[id];
if (current.x != MARKER) {
while (last2.y >= 0) {
if (!dominate(last1.x, last2.y, last2.x, \
lasty, current.x, current.y, tx))
break;
lasty = last2.y; last2 = last1;
if (last1.y >= 0)
last1 = stack[TOID(tx, last1.y, size)];
}
last1 = last2; last2 = make_pixel(current.x, lasty); lasty = current.y;
stack[id] = last2;
}
}
// Store the pointer to the tail at the last pixel of this band
if (lasty != ty + bandSize - 1)
stack[TOID(tx, ty + bandSize - 1, size)] = make_pixel(MARKER, lasty);
}
__global__ void kernelProximatePointsWithSpacing(pixel_int2_t *input, pixel_int2_t *stack, int size, int bandSize, double sx, double sy)
{
int tx = blockIdx.x * blockDim.x + threadIdx.x;
int ty = blockIdx.y * bandSize;
int id = TOID(tx, ty, size);
int lasty = -1;
pixel_int2_t last1, last2, current;
last1.y = -1; last2.y = -1;
for (int i = 0; i < bandSize; i++, id += size) {
current = input[id];
if (current.x != MARKER) {
while (last2.y >= 0) {
if (!dominate_sp(last1.x, last2.y, last2.x, \
lasty, current.x, current.y, tx, sx, sy))
break;
lasty = last2.y; last2 = last1;
if (last1.y >= 0)
last1 = stack[TOID(tx, last1.y, size)];
}
last1 = last2; last2 = make_pixel(current.x, lasty); lasty = current.y;
stack[id] = last2;
}
}
// Store the pointer to the tail at the last pixel of this band
if (lasty != ty + bandSize - 1)
stack[TOID(tx, ty + bandSize - 1, size)] = make_pixel(MARKER, lasty);
}
__global__ void kernelCreateForwardPointers(pixel_int2_t *input, pixel_int2_t *output, int size, int bandSize)
{
int tx = blockIdx.x * blockDim.x + threadIdx.x;
int ty = (blockIdx.y+1) * bandSize - 1;
int id = TOID(tx, ty, size);
int lasty = -1, nexty;
pixel_int2_t current;
// Get the tail pointer
current = input[id];
if (current.x == MARKER)
nexty = current.y;
else
nexty = ty;
for (int i = 0; i < bandSize; i++, id -= size)
if (ty - i == nexty) {
current = make_pixel(lasty, input[id].y);
output[id] = current;
lasty = nexty;
nexty = current.y;
}
// Store the pointer to the head at the first pixel of this band
if (lasty != ty - bandSize + 1)
output[id + size] = make_pixel(lasty, MARKER);
}
__global__ void kernelMergeBands(pixel_int2_t *color, pixel_int2_t *link, pixel_int2_t *output, int size, int bandSize)
{
int tx = blockIdx.x * blockDim.x + threadIdx.x;
int band1 = blockIdx.y * 2;
int band2 = band1 + 1;
int firsty, lasty;
pixel_int2_t last1, last2, current;
// last1 and last2: x component store the x coordinate of the site,
// y component store the backward pointer
// current: y component store the x coordinate of the site,
// x component store the forward pointer
// Get the two last items of the first list
lasty = band2 * bandSize - 1;
last2 = make_pixel(color[TOID(tx, lasty, size)].x,
link[TOID(tx, lasty, size)].y);
if (last2.x == MARKER) {
lasty = last2.y;
if (lasty >= 0)
last2 = make_pixel(color[TOID(tx, lasty, size)].x,
link[TOID(tx, lasty, size)].y);
else
last2 = make_pixel(MARKER, MARKER);
}
if (last2.y >= 0) {
// Second item at the top of the stack
last1 = make_pixel(color[TOID(tx, last2.y, size)].x,
link[TOID(tx, last2.y, size)].y);
}
// Get the first item of the second band
firsty = band2 * bandSize;
current = make_pixel(link[TOID(tx, firsty, size)].x,
color[TOID(tx, firsty, size)].x);
if (current.y == MARKER) {
firsty = current.x;
if (firsty >= 0)
current = make_pixel(link[TOID(tx, firsty, size)].x,
color[TOID(tx, firsty, size)].x);
else
current = make_pixel(MARKER, MARKER);
}
// Count the number of item in the second band that survive so far.
// Once it reaches 2, we can stop.
int top = 0;
while (top < 2 && current.y >= 0) {
// While there's still something on the left
while (last2.y >= 0) {
if (!dominate(last1.x, last2.y, last2.x, \
lasty, current.y, firsty, tx))
break;
lasty = last2.y; last2 = last1;
top--;
if (last1.y >= 0)
last1 = make_pixel(color[TOID(tx, last1.y, size)].x,
link[TOID(tx, last1.y, size)].y);
}
// Update the current pointer
output[TOID(tx, firsty, size)] = make_pixel(current.x, lasty);
if (lasty >= 0)
output[TOID(tx, lasty, size)] = make_pixel(firsty, last2.y);
last1 = last2; last2 = make_pixel(current.y, lasty); lasty = firsty;
firsty = current.x;
top = max(1, top + 1);
// Advance the current pointer to the next one
if (firsty >= 0)
current = make_pixel(link[TOID(tx, firsty, size)].x,
color[TOID(tx, firsty, size)].x);
else
current = make_pixel(MARKER, MARKER);
}
// Update the head and tail pointer.
firsty = band1 * bandSize;
lasty = band2 * bandSize;
current = link[TOID(tx, firsty, size)];
if (current.y == MARKER && current.x < 0) { // No head?
last1 = link[TOID(tx, lasty, size)];
if (last1.y == MARKER)
current.x = last1.x;
else
current.x = lasty;
output[TOID(tx, firsty, size)] = current;
}
firsty = band1 * bandSize + bandSize - 1;
lasty = band2 * bandSize + bandSize - 1;
current = link[TOID(tx, lasty, size)];
if (current.x == MARKER && current.y < 0) { // No tail?
last1 = link[TOID(tx, firsty, size)];
if (last1.x == MARKER)
current.y = last1.y;
else
current.y = firsty;
output[TOID(tx, lasty, size)] = current;
}
}
__global__ void kernelMergeBandsWithSpacing(pixel_int2_t *color, pixel_int2_t *link, pixel_int2_t *output, int size, int bandSize, double sx, double sy)
{
int tx = blockIdx.x * blockDim.x + threadIdx.x;
int band1 = blockIdx.y * 2;
int band2 = band1 + 1;
int firsty, lasty;
pixel_int2_t last1, last2, current;
// last1 and last2: x component store the x coordinate of the site,
// y component store the backward pointer
// current: y component store the x coordinate of the site,
// x component store the forward pointer
// Get the two last items of the first list
lasty = band2 * bandSize - 1;
last2 = make_pixel(color[TOID(tx, lasty, size)].x,
link[TOID(tx, lasty, size)].y);
if (last2.x == MARKER) {
lasty = last2.y;
if (lasty >= 0)
last2 = make_pixel(color[TOID(tx, lasty, size)].x,
link[TOID(tx, lasty, size)].y);
else
last2 = make_pixel(MARKER, MARKER);
}
if (last2.y >= 0) {
// Second item at the top of the stack
last1 = make_pixel(color[TOID(tx, last2.y, size)].x,
link[TOID(tx, last2.y, size)].y);
}
// Get the first item of the second band
firsty = band2 * bandSize;
current = make_pixel(link[TOID(tx, firsty, size)].x,
color[TOID(tx, firsty, size)].x);
if (current.y == MARKER) {
firsty = current.x;
if (firsty >= 0)
current = make_pixel(link[TOID(tx, firsty, size)].x,
color[TOID(tx, firsty, size)].x);
else
current = make_pixel(MARKER, MARKER);
}
// Count the number of item in the second band that survive so far.
// Once it reaches 2, we can stop.
int top = 0;
while (top < 2 && current.y >= 0) {
// While there's still something on the left
while (last2.y >= 0) {
if (!dominate_sp(last1.x, last2.y, last2.x, \
lasty, current.y, firsty, tx, sx, sy))
break;
lasty = last2.y; last2 = last1;
top--;
if (last1.y >= 0)
last1 = make_pixel(color[TOID(tx, last1.y, size)].x,
link[TOID(tx, last1.y, size)].y);
}
// Update the current pointer
output[TOID(tx, firsty, size)] = make_pixel(current.x, lasty);
if (lasty >= 0)
output[TOID(tx, lasty, size)] = make_pixel(firsty, last2.y);
last1 = last2; last2 = make_pixel(current.y, lasty); lasty = firsty;
firsty = current.x;
top = max(1, top + 1);
// Advance the current pointer to the next one
if (firsty >= 0)
current = make_pixel(link[TOID(tx, firsty, size)].x,
color[TOID(tx, firsty, size)].x);
else
current = make_pixel(MARKER, MARKER);
}
// Update the head and tail pointer.
firsty = band1 * bandSize;
lasty = band2 * bandSize;
current = link[TOID(tx, firsty, size)];
if (current.y == MARKER && current.x < 0) { // No head?
last1 = link[TOID(tx, lasty, size)];
if (last1.y == MARKER)
current.x = last1.x;
else
current.x = lasty;
output[TOID(tx, firsty, size)] = current;
}
firsty = band1 * bandSize + bandSize - 1;
lasty = band2 * bandSize + bandSize - 1;
current = link[TOID(tx, lasty, size)];
if (current.x == MARKER && current.y < 0) { // No tail?
last1 = link[TOID(tx, firsty, size)];
if (last1.x == MARKER)
current.y = last1.y;
else
current.y = firsty;
output[TOID(tx, lasty, size)] = current;
}
}
__global__ void kernelDoubleToSingleList(pixel_int2_t *color, pixel_int2_t *link, pixel_int2_t *output, int size)
{
int tx = blockIdx.x * blockDim.x + threadIdx.x;
int ty = blockIdx.y;
int id = TOID(tx, ty, size);
output[id] = make_pixel(color[id].x, link[id].y);
}
__global__ void kernelColor(pixel_int2_t *input, pixel_int2_t *output, int size)
{
__shared__ pixel_int2_t block[BLOCKSIZE][BLOCKSIZE];
int col = threadIdx.x;
int tid = threadIdx.y;
int tx = blockIdx.x * blockDim.x + col;
int dx, dy, lasty;
unsigned int best, dist;
pixel_int2_t last1, last2;
lasty = size - 1;
last2 = input[TOID(tx, lasty, size)];
if (last2.x == MARKER) {
lasty = max(last2.y, 0);
last2 = input[TOID(tx, lasty, size)];
}
if (last2.y >= 0)
last1 = input[TOID(tx, last2.y, size)];
int y_start, y_end, n_step = size / blockDim.x;
for(int step = 0; step < n_step; ++step) {
y_start = size - step * blockDim.x - 1;
y_end = size - (step + 1) * blockDim.x;
for (int ty = y_start - tid; ty >= y_end; ty -= blockDim.y) {
dx = last2.x - tx; dy = lasty - ty;
best = dist = dx * dx + dy * dy;
while (last2.y >= 0) {
dx = last1.x - tx; dy = last2.y - ty;
dist = dx * dx + dy * dy;
if (dist > best)
break;
best = dist; lasty = last2.y; last2 = last1;
if (last2.y >= 0)
last1 = input[TOID(tx, last2.y, size)];
}
block[threadIdx.x][ty - y_end] = make_pixel(lasty, last2.x);
}
__syncthreads();
// note: transposes back to original shape here
if(!threadIdx.y) {
int id = TOID(y_end + threadIdx.x, blockIdx.x * blockDim.x, size);
for(int i = 0; i < blockDim.x; ++i, id+=size) {
output[id] = block[i][threadIdx.x];
}
}
__syncthreads();
}
}
__global__ void kernelColorWithSpacing(pixel_int2_t *input, pixel_int2_t *output, int size, double sx, double sy)
{
__shared__ pixel_int2_t block[BLOCKSIZE][BLOCKSIZE];
int col = threadIdx.x;
int tid = threadIdx.y;
int tx = blockIdx.x * blockDim.x + col;
int lasty;
double dx, dy, best, dist;
pixel_int2_t last1, last2;
lasty = size - 1;
last2 = input[TOID(tx, lasty, size)];
if (last2.x == MARKER) {
lasty = max(last2.y, 0);
last2 = input[TOID(tx, lasty, size)];
}
if (last2.y >= 0)
last1 = input[TOID(tx, last2.y, size)];
int y_start, y_end, n_step = size / blockDim.x;
for(int step = 0; step < n_step; ++step) {
y_start = size - step * blockDim.x - 1;
y_end = size - (step + 1) * blockDim.x;
for (int ty = y_start - tid; ty >= y_end; ty -= blockDim.y) {
dx = static_cast<double>(last2.x - tx) * sx;
dy = static_cast<double>(lasty - ty) * sy;
best = dist = dx * dx + dy * dy;
while (last2.y >= 0) {
dx = static_cast<double>(last1.x - tx) * sx;
dy = static_cast<double>(last2.y - ty) * sy;
dist = dx * dx + dy * dy;
if (dist > best)
break;
best = dist; lasty = last2.y; last2 = last1;
if (last2.y >= 0)
last1 = input[TOID(tx, last2.y, size)];
}
block[threadIdx.x][ty - y_end] = make_pixel(lasty, last2.x);
}
__syncthreads();
// note: transposes back to original shape here
if(!threadIdx.y) {
int id = TOID(y_end + threadIdx.x, blockIdx.x * blockDim.x, size);
for(int i = 0; i < blockDim.x; ++i, id+=size) {
output[id] = block[i][threadIdx.x];
}
}
__syncthreads();
}
}
} // extern C
|
3b1acf448c1858ed25084f1c73d445b5676d6e42
|
7c857119fe1505b1d80d6e62969661c06dc1a2f4
|
/Trash/BiosVideoAuto/AutoResolution/libsaio/nvidia_resolution.h
|
ed1b7d09f7ad3933424f296071d1f36ab8e06b99
|
[
"BSD-2-Clause"
] |
permissive
|
CloverHackyColor/CloverBootloader
|
7042ca7dd6b513d22be591a295e49071ae1482ee
|
2711170df4f60b2ae5aa20add3e00f35cf57b7e5
|
refs/heads/master
| 2023-08-30T22:14:34.590134
| 2023-08-27T19:14:02
| 2023-08-27T19:14:02
| 205,810,121
| 4,734
| 770
|
BSD-2-Clause
| 2023-09-03T12:41:33
| 2019-09-02T08:22:14
|
C
|
UTF-8
|
C
| false
| false
| 2,054
|
h
|
nvidia_resolution.h
|
/*
* nviviaresolution.h
*
*
* Created by Le Bidou on 19/03/10.
* Copyright 2010 ---. All rights reserved.
*
*/
#ifndef _NVDA_RESOLUTION_HEADER_
#define _NVDA_RESOLUTION_HEADER_
#include "libsaio.h"
#include "autoresolution.h"
#define NVIDIA_SIGNATURE "NVIDIA Corp"
#define OFFSET_TO_VESA_TABLE_INDEX 2
#define MAIN_VESA_TABLE 0
#define SECOND_VESA_TABLE 1
typedef struct {
unsigned char ucTable_Major; //These names are probably wrong
unsigned char ucTable_Minor;
unsigned char ucTable_Rev;
unsigned short usTable_Size;
} NV_COMMON_TABLE_HEADER;
typedef struct {
unsigned short usPixel_Clock;
unsigned short usH_Active;
unsigned short usH_Active_minus_One;
unsigned short reserved1;
unsigned short usH_Active_minus_One_;
unsigned short usH_SyncStart;
unsigned short usH_SyncEnd;
unsigned short usH_Total;
unsigned short usV_Active;
unsigned short usV_Active_minus_One;
unsigned short reserved2;
unsigned short usV_Active_minus_One_;
unsigned short usV_SyncStart;
unsigned short usV_SyncEnd;
unsigned short usV_Total;
unsigned short reserved3;
} NV_MODELINE;
typedef struct {
unsigned short h_disp;
unsigned short v_disp;
unsigned char h_blank;
unsigned char h_syncoffset;
unsigned char h_syncwidth;
unsigned char v_blank;
//unsigned char v_syncwidth;
unsigned char flags; //looks like flags & 1 means "Graphics Mode", to oppose to "Console Mode"
//on 7xxx the high four bits look like a mode id number.
//on 8xxx only the low four bits are used, standard graphics mode are always 5.
// it can be 1 (1400x1050 and 2048x1536) (HSync High, VSync High ?)
// 3 (1440x900, 1680x1050 and 1920x1200) (Hsync High, VSync Low ?)
// 3 (Standard Timings) (Hsync Low, VSync High ?)
// or 7 (1280x800 and 768x340) (Hync Low, VSync Low ?)
} NV_MODELINE_2;
typedef struct {
NV_COMMON_TABLE_HEADER sHeader;
NV_MODELINE * sModelines;
} NV_VESA_TABLE;
vbios_map * open_nvidia_vbios(vbios_map *map);
bool nvidia_set_mode(vbios_map* map, UInt8 idx, UInt32* x, UInt32* y, char Type);
#endif
|
35a79d53ef0c6e36e5f4dbaa72a5cdd31a61d804
|
aa3befea459382dc5c01c925653d54f435b3fb0f
|
/boards/arm/str71x/olimex-strp711/src/str71_enc28j60.c
|
faf1dcc498f4fb78be4a2760fdb366a06700a2f8
|
[
"MIT-open-group",
"BSD-3-Clause",
"HPND-sell-variant",
"BSD-4-Clause-UC",
"LicenseRef-scancode-warranty-disclaimer",
"MIT-0",
"LicenseRef-scancode-bsd-atmel",
"LicenseRef-scancode-gary-s-brown",
"LicenseRef-scancode-proprietary-license",
"SunPro",
"MIT",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-other-permissive",
"HPND",
"ISC",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"GPL-1.0-or-later",
"CC-BY-2.0",
"CC-BY-4.0"
] |
permissive
|
apache/nuttx
|
14519a7bff4a87935d94fb8fb2b19edb501c7cec
|
606b6d9310fb25c7d92c6f95bf61737e3c79fa0f
|
refs/heads/master
| 2023-08-25T06:55:45.822534
| 2023-08-23T16:03:31
| 2023-08-24T21:25:47
| 228,103,273
| 407
| 241
|
Apache-2.0
| 2023-09-14T18:26:05
| 2019-12-14T23:27:55
|
C
|
UTF-8
|
C
| false
| false
| 8,347
|
c
|
str71_enc28j60.c
|
/****************************************************************************
* boards/arm/str71x/olimex-strp711/src/str71_enc28j60.c
*
* 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.
*
****************************************************************************/
/* ENC28J60 Module
*
* The ENC28J60 module does not come on the Olimex-STR-P711, but this
* describes how I have connected it. NOTE that the ENC28J60 requires an
* external interrupt (XTI) pin. The only easily accessible XTI pins are on
* SPI0/1 so you can't have both SPI0 and 1 together with this configuration.
*
* Module CON5 QFN ENC2860 Description
* --------------- -------------------------------------------------------
* 1 J8-1 NET CS 5 ~CS Chip select input pin for SPI interface
* (active low)
* 2 2 SCK 4 SCK Clock in pin for SPI interface
* 3 3 MOSI 3 SI Data in pin for SPI interface
* 4 4 MISO 2 SO Data out pin for SPI interface
* 5 5 GND -- --- ---
* 10 J9-1 3V3 -- --- ---
* 9 2 WOL 1 ~WOL Unicast WOL filter
* 8 3 NET INT 28 ~INT Interrupt output pin (active low)
* 7 4 CLKOUT 27 CLKOUT Programmable clock output pin
* 6 5 NET RST 6 ~RESET Active-low device Reset input
*
* For the Olimex STR-P711, the ENC28J60 module is placed on SPI0 and uses
* P0.3 for CS, P0.6 for an interrupt, and P0.4 as a reset:
*
* Module CON5 Olimex STR-P711 Connection
* --------------- -------------------------------------------------------
* 1 J8-1 NET CS SPI0-2 P0.3 output P0.3/S0.SS/I1.SDA
* 2 2 SCK SPI0-5 SCLK0 P0.2/S0.SCLK/I1.SCL
* 3 3 MOSI SPI0-3 MOSI0 P0.0/S0.MOSI/U3.RX
* 4 4 MISO SPI0-4 MISO0 P0.1/S0.MISO/U3.TX
* 5 5 GND SPI0-1 GND
* 10 J9-1 3V3 SPI0-6 3.3V
* 9 2 WOL NC
* 8 3 NET INT SPI1-5 P0.6 XTI 11 P0.6/S1.SCLK
* 7 4 CLKOUT NC
* 6 5 NET RST SPI1-4 P0.4 output P0.4/S1.MISO
*
* UART3, I2C cannot be used with SPI0. The GPIOs selected for the ENC28J60
* interrupt conflict with TMR1.
*/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdio.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/spi/spi.h>
#include <nuttx/net/enc28j60.h>
#include <arch/board/board.h>
#include "chip.h"
#include "arm_internal.h"
#include "str71x.h"
#ifdef CONFIG_ENC28J60
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* We assume that the ENC28J60 is on SPI0 */
#ifndef CONFIG_STR71X_BSPI0
# error "Need CONFIG_STR71X_BSPI0 in the configuration"
#endif
#ifndef CONFIG_STR71X_XTI
# error "Need CONFIG_STR71X_XTI in the configuration"
#endif
/* UART3, I2C cannot be used with SPI0. The GPIOs selected for the ENC28J60
* interrupt conflict with BSPI1.
*/
#ifdef CONFIG_STR71X_UART3
# error "CONFIG_STR71X_UART3 cannot be used in this configuration"
#endif
#ifdef CONFIG_STR71X_I2C1
# error "CONFIG_STR71X_I2C1 cannot be used in this configuration"
#endif
#ifdef CONFIG_STR71X_BSP1
# error "CONFIG_STR71X_BSP1 cannot be used in this configuration"
#endif
/* SPI Assumptions **********************************************************/
#define ENC28J60_SPI_PORTNO 0 /* On SPI0 */
#define ENC28J60_DEVNO 0 /* Only one ENC28J60 */
#define ENC28J60_IRQ STR71X_IRQ_PORT0p6 /* XTI Line 11: P0.6 */
/* ENC28J60 additional pins *************************************************
*
* NOTE: The ENC28J60 is a 3.3V part; however, it was designed to be
* easily integrated into 5V systems. The SPI CS, SCK and SI inputs,
* as well as the RESET pin, are all 5V tolerant. On the other hand,
* if the host controller is operated at 5V, it quite likely will
* not be within specifications when its SPI and interrupt inputs
* are driven by the 3.3V CMOS outputs on the ENC28J60. A
* unidirectional level translator would be necessary.
*/
# define ENC_GPIO0_CS (1 << 3) /* Chip select (P0.3) */
# define ENC_GPIO0_NETRST (1 << 4) /* Reset (P0.4) */
# define ENC_GPIO0_NETINT (1 << 6) /* Interrupt (P0.6) */
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static int up_attach(const struct enc_lower_s *lower, xcpt_t handler,
void *arg);
static void up_enable(const struct enc_lower_s *lower);
static void up_disable(const struct enc_lower_s *lower);
/****************************************************************************
* Private Data
****************************************************************************/
/* The ENC28J60 normal provides interrupts to the MCU via a GPIO pin. The
* following structure provides an MCU-independent mechanism for controlling
* the ENC28J60 GPIO interrupt.
*/
static const struct enc_lower_s g_enclower =
{
.attach = up_attach,
.enable = up_enable,
.disable = up_disable
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: struct enc_lower_s methods
****************************************************************************/
static int up_attach(const struct enc_lower_s *lower, xcpt_t handler,
void *arg)
{
return irq_attach(ENC28J60_IRQ, handler, arg);
}
static void up_enable(const struct enc_lower_s *lower)
{
up_enable_irq(ENC28J60_IRQ);
}
static void up_disable(const struct enc_lower_s *lower)
{
up_disable_irq(ENC28J60_IRQ);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: arm_netinitialize
****************************************************************************/
void arm_netinitialize(void)
{
struct spi_dev_s *spi;
uint16_t reg16;
int ret;
/* Get the SPI port */
spi = str71_spibus_initialize(ENC28J60_SPI_PORTNO);
if (!spi)
{
nerr("ERROR: Failed to initialize SPI port %d\n", ENC28J60_SPI_PORTNO);
return;
}
/* Configure the XTI for the ENC28J60 interrupt. */
ret = str71x_xticonfig(ENC28J60_IRQ, false);
if (ret < 0)
{
nerr("ERROR: Failed configure interrupt for IRQ %d: %d\n",
ENC28J60_IRQ, ret);
return;
}
/* Take ENC28J60 out of reset (active low) */
reg16 = getreg16(STR71X_GPIO0_PD);
reg16 &= ~ENC_GPIO0_NETRST;
putreg16(reg16, STR71X_GPIO0_PD);
/* Bind the SPI port to the ENC28J60 driver */
ret = enc_initialize(spi, &g_enclower, ENC28J60_DEVNO);
if (ret < 0)
{
nerr("ERROR: Failed to bind SPI port %d ENC28J60 device %d: %d\n",
ENC28J60_SPI_PORTNO, ENC28J60_DEVNO, ret);
return;
}
ninfo("Bound SPI port %d to ENC28J60 device %d\n",
ENC28J60_SPI_PORTNO, ENC28J60_DEVNO);
}
#endif /* CONFIG_ENC28J60 */
|
ec90175b6ee5ef2f293fa4b8eddf6f8cb36db592
|
c013cf150a7ae728caa1468125f0d42f7a5a52eb
|
/src/chiabls/contrib/relic/include/low/relic_bn_low.h
|
d8b4226e730b3aef2fa410d92b58ebc4c2c0c165
|
[
"Apache-2.0",
"ISC",
"LGPL-3.0-only",
"MIT",
"LGPL-2.1-only",
"LGPL-2.0-or-later",
"LGPL-2.1-or-later",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
PIVX-Project/PIVX
|
c9d209ea7b8cee627f5ccc1cb63d334b68c454de
|
7488a2721da8a4defc08d145dadd3c3065e2735d
|
refs/heads/master
| 2023-08-19T10:18:31.494805
| 2023-08-17T03:38:56
| 2023-08-17T03:40:09
| 50,740,659
| 663
| 1,520
|
MIT
| 2023-09-13T06:26:34
| 2016-01-30T19:20:24
|
C++
|
UTF-8
|
C
| false
| false
| 9,555
|
h
|
relic_bn_low.h
|
/*
* RELIC is an Efficient LIbrary for Cryptography
* Copyright (c) 2009 RELIC Authors
*
* This file is part of RELIC. RELIC is legal property of its developers,
* whose names are not listed here. Please refer to the COPYRIGHT file
* for contact information.
*
* RELIC is free software; you can redistribute it and/or modify it under the
* terms of the version 2.1 (or later) of the GNU Lesser General Public License
* as published by the Free Software Foundation; or version 2.0 of the Apache
* License as published by the Apache Software Foundation. See the LICENSE files
* for more details.
*
* RELIC 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 LICENSE files for more details.
*
* You should have received a copy of the GNU Lesser General Public or the
* Apache License along with RELIC. If not, see <https://www.gnu.org/licenses/>
* or <https://www.apache.org/licenses/>.
*/
/**
* @file
*
* Interface of the low-level multiple precision integer arithmetic module.
*
* All functions assume that the destination has enough capacity to store
* the result of the computation.
*
* @ingroup bn
*/
#ifndef RLC_BN_LOW_H
#define RLC_BN_LOW_H
/*============================================================================*/
/* Constant definitions */
/*============================================================================*/
#ifdef ASM
#include "relic_conf.h"
#if (BN_PRECI % WSIZE) > 0
#define RLC_BN_DIGS (BN_PRECI/WSIZE + 1)
#else
#define RLC_BN_DIGS (BN_PRECI/WSIZE)
#endif
#if BN_MAGNI == DOUBLE
#define RLC_BN_SIZE (2 * RLC_BN_DIGS + 2)
#elif BN_MAGNI == CARRY
#define RLC_BN_SIZE ((RLC_BN_DIGS + 1)
#elif BN_MAGNI == SINGLE
#define RLC_BN_SIZE (RLC_BN_DIGS)
#endif
#else
#include "relic_types.h"
/*============================================================================*/
/* Function prototypes */
/*============================================================================*/
/**
* Adds a digit to a digit vector. Computes c = a + digit.
*
* @param[out] c - the result.
* @param[in] a - the first digit vector to add.
* @param[in] digit - the digit to add.
* @param[in] size - the number of digits in the first operand.
* @return the carry of the last digit addition.
*/
dig_t bn_add1_low(dig_t *c, const dig_t *a, const dig_t digit, const int size);
/**
* Adds two digit vectors of the same size. Computes c = a + b.
*
* @param[out] c - the result.
* @param[in] a - the first digit vector to add.
* @param[in] b - the second digit vector to add.
* @param[in] size - the number of digits to add.
* @return the carry of the last digit addition.
*/
dig_t bn_addn_low(dig_t *c, const dig_t *a, const dig_t *b, int size);
/**
* Subtracts a digit from a digit vector. Computes c = a - digit.
*
* @param[out] c - the result.
* @param[in] a - the digit vector.
* @param[in] digit - the digit to subtract.
* @param[in] size - the number of digits in a.
* @return the carry of the last digit subtraction.
*/
dig_t bn_sub1_low(dig_t *c, const dig_t *a, dig_t digit, int size);
/**
* Subtracts a digit vector from another digit vector. Computes c = a - b.
*
* @param[out] c - the result.
* @param[in] a - the digit vector.
* @param[in] b - the digit vector to subtract.
* @param[in] size - the number of digits to subtract.
* @return the carry of the last digit subtraction.
*/
dig_t bn_subn_low(dig_t *c, const dig_t *a, const dig_t *b, int size);
/**
* Compares two digits.
*
* @param[in] a - the first digit to compare.
* @param[in] b - the second digit to compare.
* @return BN_LT if a < b, BN_EQ if a == b and BN_GT if a > b.
*/
int bn_cmp1_low(dig_t a, dig_t b);
/**
* Compares two digit vectors of the same size.
*
* @param[in] a - the first digit vector to compare.
* @param[in] b - the second digit vector to compare.
* @param[in] size - the number of digits to compare.
* @return BN_LT if a < b, BN_EQ if a == b and BN_GT if a > b.
*/
int bn_cmpn_low(const dig_t *a, const dig_t *b, int size);
/**
* Shifts a digit vector to the left by 1 bit. Computes c = a << 1.
*
* @param[out] c - the result
* @param[in] a - the digit vector to shift.
* @param[in] size - the number of digits to shift.
* @return the carry of the last digit shift.
*/
dig_t bn_lsh1_low(dig_t *c, const dig_t *a, int size);
/**
* Shifts a digit vector to the left by an amount smaller than a digit. Computes
* c = a << bits.
*
* @param[out] c - the result
* @param[in] a - the digit vector to shift.
* @param[in] size - the number of digits to shift.
* @param[in] bits - the shift amount.
* @return the carry of the last digit shift.
*/
dig_t bn_lshb_low(dig_t *c, const dig_t *a, int size, int bits);
/**
* Shifts a digit vector to the right by 1 bit. Computes c = a >> 1.
*
* @param[out] c - the result
* @param[in] a - the digit vector to shift.
* @param[in] size - the number of digits to shift.
* @return the carry of the last digit shift.
*/
dig_t bn_rsh1_low(dig_t *c, const dig_t *a, int size);
/**
* Shifts a digit vector to the right by an amount smaller than a digit.
* Computes c = a >> bits.
*
* @param[out] c - the result
* @param[in] a - the digit vector to shift.
* @param[in] size - the number of digits to shift.
* @param[in] bits - the shift amount.
* @return the carry of the last digit shift.
*/
dig_t bn_rshb_low(dig_t *c, const dig_t *a, int size, int bits);
/**
* Multiplies a digit vector by a digit and adds this result to another digit
* vector. Computes c = c + a * digit.
*
* @param[out] c - the result.
* @param[in] a - the digit vector to multiply.
* @param[in] digit - the digit to multiply.
* @param[in] size - the number of digits to multiply.
* @return the carry of the last addition.
*/
dig_t bn_mula_low(dig_t *c, const dig_t *a, dig_t digit, int size);
/**
* Multiplies a digit vector by a digit and stores this result in another digit
* vector. Computes c = a * digit.
*
* @param[out] c - the result.
* @param[in] a - the first digit vector to multiply.
* @param[in] digit - the digit to multiply.
* @param[in] size - the number of digits to multiply.
* @return the most significant digit.
*/
dig_t bn_mul1_low(dig_t *c, const dig_t *a, dig_t digit, int size);
/**
* Multiplies two digit vectors of the same size. Computes c = a * b.
*
* @param[out] c - the result.
* @param[in] a - the first digit vector to multiply.
* @param[in] b - the second digit vector to multiply.
* @param[in] size - the number of digits to multiply.
*/
void bn_muln_low(dig_t *c, const dig_t *a, const dig_t *b, int size);
/**
* Multiplies two digit vectors of different sizes, with sa > sb. Computes
* c = a * b. This function outputs as result only the digits between low and
* high, inclusive, with high > sa and low < sb.
*
* @param[out] c - the result.
* @param[in] a - the first digit vector to multiply.
* @param[in] b - the second digit vector to multiply.
* @param[in] sa - the number of digits in the first operand.
* @param[in] sb - the number of digits in the second operand.
* @param[in] low - the first digit to compute.
* @param[in] high - the last digit to compute.
*/
void bn_muld_low(dig_t *c, const dig_t *a, int sa, const dig_t *b, int sb,
int low, int high);
/**
* Squares a digit vector and adds this result to another digit vector.
* Computes c = c + a * a.
*
* @param[out] c - the result.
* @param[in] a - the digit vector to square.
* @param[in] size - the number of digits to square.
* @return the carry of the last addition.
*/
dig_t bn_sqra_low(dig_t *c, const dig_t *a, int size);
/**
* Squares a digit vector. Computes c = a * a.
*
* @param[out] c - the result.
* @param[in] a - the digit vector to square.
* @param[in] size - the number of digits to square.
*/
void bn_sqrn_low(dig_t *c, const dig_t *a, int size);
/**
* Divides a digit vector by another digit vector. Computes c = floor(a / b) and
* d = a mod b. The dividend and divisor may be destroyed inside the function.
*
* @param[out] c - the quotient.
* @param[out] d - the remainder.
* @param[in,out] a - the dividend.
* @param[in] sa - the size of the dividend.
* @param[in,out] b - the divisor.
* @param[in] sb - the size of the divisor.
*/
void bn_divn_low(dig_t *c, dig_t *d, dig_t *a, int sa, dig_t *b, int sb);
/**
* Divides a digit vector by a digit. Computes c = floor(a / digit) and
* d = a mod digit.
*
* @param[out] c - the quotient.
* @param[out] d - the remainder.
* @param[in] a - the dividend.
* @param[in] size - the size of the dividend.
* @param[in] digit - the divisor.
*/
void bn_div1_low(dig_t *c, dig_t *d, const dig_t *a, int size, dig_t digit);
/**
* Reduces a digit vector modulo m by Montgomery's algorithm.
*
* @param[out] c - the result.
* @param[in] a - the digit vector to reduce.
* @param[in] sa - the number of digits to reduce
* @param[in] m - the modulus.
* @param[in] sm - the size of the modulus.
* @param[in] u - the reciprocal of the modulus.
*/
void bn_modn_low(dig_t *c, const dig_t *a, int sa, const dig_t *m, int sm,
dig_t u);
#endif /* !ASM */
#endif /* !RLC_BN_LOW_H */
|
9d704a3a308dbf725b7dcedaca24b7eb28af56c0
|
6fe58026fe3612bf18387650fcc5aa75e3f75fa8
|
/mqtt/mosquitto_client_select.c
|
e86d9dd5558a8aa979ef29a469eadd09fa7ed843
|
[] |
no_license
|
GBert/misc
|
8a4ef2410464b1f1f4595d75789e7b575458d87e
|
00c38748880753a853c937439375112ac2839a45
|
refs/heads/master
| 2023-05-01T16:53:01.965634
| 2023-04-20T10:08:23
| 2023-04-20T10:08:23
| 12,459,444
| 103
| 37
| null | 2021-07-20T10:02:02
| 2013-08-29T12:21:57
|
C
|
UTF-8
|
C
| false
| false
| 4,366
|
c
|
mosquitto_client_select.c
|
/* file mosquitto_client_select.c
* author: Zoltan Gyarmati <mr.zoltan.gyarmati@gmail.com>
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#include <signal.h>
#include <getopt.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <math.h>
#include <assert.h>
#include <sys/select.h>
#include <mosquitto.h>
/* compile:
* cc -o mosquitto-selecttest mosquitto_client_select.c -lmosquitto
*
* small example code to experiment with poll-based external loop and
* libmosquitto
*
* send event with:
* mosquitto_pub -t topic/subtopic -m "ahoi" -q 1
*/
/*
* change this if you need remote broker
*/
const char *mqtt_broker_host = "localhost";
const int mqtt_broker_port = 1883;
// forward declarations
void mqtt_cb_msg(struct mosquitto *mosq, void *userdata, const struct mosquitto_message *msg);
void mqtt_cb_connect(struct mosquitto *mosq, void *userdata, int result);
void mqtt_cb_subscribe(struct mosquitto *mosq, void *userdata, int mid, int qos_count, const int *granted_qos);
void mqtt_cb_disconnect(struct mosquitto *mosq, void *userdat, int rc);
int main(int argc, char *argv[]) {
//set up mosquitto
int keepalive = 10;
bool clean_session = true;
struct mosquitto *mosq = NULL;
int running = 1;
mosquitto_lib_init();
mosq = mosquitto_new(NULL, clean_session, NULL);
if (!mosq) {
fprintf(stderr, "Error: Out of memory.\n");
return -1;
}
mosquitto_connect_callback_set(mosq, mqtt_cb_connect);
mosquitto_message_callback_set(mosq, mqtt_cb_msg);
mosquitto_subscribe_callback_set(mosq, mqtt_cb_subscribe);
mosquitto_disconnect_callback_set(mosq, mqtt_cb_disconnect);
while (running) { //we try until we succeed, or we killed
if (mosquitto_connect(mosq, mqtt_broker_host, mqtt_broker_port, keepalive)) {
printf("Unable to connect, host: %s, port: %d\n", mqtt_broker_host, mqtt_broker_port);
sleep(2);
continue;
}
break;
}
// if (running){
// mosquitto_loop_forever(mosq, -1, 1);
// }
int mosq_fd = mosquitto_socket(mosq);
printf("Connected, socketfd: %d\n", mosq_fd);
fd_set fd_set;
struct timeval tv;
while (1) {
tv.tv_sec = 5;
tv.tv_usec = 0;
FD_ZERO(&fd_set);
FD_SET(mosq_fd, &fd_set);
// printf("-\n");
//with this select() always returns immediately:
// int rc = select (mosq_fd+1, &fd_set,&fd_set, NULL, &tv);
//with this most likely the client won't have a chance to write, so
//it gets into disconnected status at the first PINGREQ
int rc = select(mosq_fd + 1, &fd_set, NULL, NULL, &tv);
if (rc < 0) {
perror("select");
exit(EXIT_FAILURE);
} else if (rc == 0) {
printf("timeout\n");
continue;
} else if (FD_ISSET(mosq_fd, &fd_set)) {
// printf("mosquitto event\n");
int ret = mosquitto_loop_read(mosq, 1);
if (ret == MOSQ_ERR_CONN_LOST) {
/* We've been disconnected from the server */
printf("Reconnect...\n");
mosquitto_reconnect(mosq);
}
if (mosquitto_want_write(mosq)) {
mosquitto_loop_write(mosq, 8);
}
mosquitto_loop_misc(mosq);
mosq_fd = mosquitto_socket(mosq);
// printf("socketfd: %d\n",mosq_fd);
} else {
printf("FD wasn't set!\n");
}
}
mosquitto_destroy(mosq);
mosquitto_lib_cleanup();
printf("bye\n");
return EXIT_SUCCESS;
}
/* Called when a message arrives to the subscribed topic,
*/
void mqtt_cb_msg(struct mosquitto *mosq, void *userdata, const struct mosquitto_message *msg) {
printf("Received msg on topic: %s\n", msg->topic);
//calling the URL with the payload
if (msg->payload != NULL) {
printf("Payload: %s\n", (char *)msg->payload);
}
}
void mqtt_cb_connect(struct mosquitto *mosq, void *userdata, int result) {
if (!result) {
mosquitto_subscribe(mosq, NULL, "topic/#", 2);
} else {
printf("MQTT subscribe failed\n");
}
}
void mqtt_cb_subscribe(struct mosquitto *mosq, void *userdata, int mid, int qos_count, const int *granted_qos) {
printf("Subscribed (mid: %d): %d\n", mid, granted_qos[0]);
for (int i = 1; i < qos_count; i++) {
printf("\t %d", granted_qos[i]);
}
}
void mqtt_cb_disconnect(struct mosquitto *mosq, void *userdat, int rc) {
printf("MQTT disconnect, error: %d: %s\n", rc, mosquitto_strerror(rc));
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.