text:
#ifndef JERRYSCRIPT_CORE_H
#define JERRYSCRIPT_CORE_H

#include "jerryscript-types.h"

JERRY_C_API_BEGIN

/**
 * @defgroup jerry-api JerryScript public API
 * @{
 */

/**
 * @defgroup jerry-api-general General functions
 * @{
 */

/**
 * @defgroup jerry-api-general-conext Context management
 * @{
 */
void jerry_init (jerry_init_flag_t flags);
void jerry_cleanup (void);

jerry_context_t *jerry_context_alloc (jerry_size_t heap_size, jerry_context_alloc_cb_t alloc, void *cb_data_p);
void *jerry_context_data (const jerry_context_data_manager_t *manager_p);

jerry_value_t jerry_current_realm (void);
jerry_value_t jerry_set_realm (jerry_value_t realm);
/**
 * jerry-api-general-conext @}
 */

/**
 * @defgroup jerry-api-general-heap Heap management
 * @{
 */
void *jerry_heap_alloc (jerry_size_t size);
void jerry_heap_free (void *mem_p, jerry_size_t size);

bool jerry_heap_stats (jerry_heap_stats_t *out_stats_p);
void jerry_heap_gc (jerry_gc_mode_t mode);

bool jerry_foreach_live_object (jerry_foreach_live_object_cb_t callback, void *user_data);
bool jerry_foreach_live_object_with_info (const jerry_object_native_info_t *native_info_p,
                                          jerry_foreach_live_object_with_info_cb_t callback,
                                          void *user_data_p);
/**
 * jerry-api-general-heap @}
 */

/**
 * @defgroup jerry-api-general-misc Miscellaneous
 * @{
 */

bool jerry_validate_string (const jerry_char_t *buffer_p, jerry_size_t buffer_size, jerry_encoding_t encoding);
bool jerry_feature_enabled (const jerry_feature_t feature);
void jerry_register_magic_strings (const jerry_char_t *const *ext_strings_p,
                                   uint32_t count,
                                   const jerry_length_t *str_lengths_p);
/**
 * jerry-api-general-misc @}
 */

/**
 * jerry-api-general @}
 */

/**
 * @defgroup jerry-api-code Scripts and Executables
 * @{
 */

/**
 * @defgroup jerry-api-code-parse Parsing
 * @{
 */
jerry_value_t jerry_parse (const jerry_char_t *source_p, size_t source_size, const jerry_parse_options_t *options_p);
jerry_value_t jerry_parse_value (const jerry_value_t source, const jerry_parse_options_t *options_p);
/**
 * jerry-api-code-parse @}
 */

/**
 * @defgroup jerry-api-code-exec Execution
 * @{
 */
jerry_value_t jerry_eval (const jerry_char_t *source_p, size_t source_size, uint32_t flags);
jerry_value_t jerry_run (const jerry_value_t script);
jerry_value_t jerry_run_jobs (void);
/**
 * jerry-api-code-exec @}
 */

/**
 * @defgroup jerry-api-code-sourceinfo Source information
 * @{
 */
jerry_value_t jerry_source_name (const jerry_value_t value);
jerry_value_t jerry_source_user_value (const jerry_value_t value);
jerry_source_info_t *jerry_source_info (const jerry_value_t value);
void jerry_source_info_free (jerry_source_info_t *source_info_p);
/**
 * jerry-api-code-sourceinfo @}
 */

/**
 * @defgroup jerry-api-code-cb Callbacks
 * @{
 */
void jerry_halt_handler (uint32_t interval, jerry_halt_cb_t callback, void *user_p);
/**
 * jerry-api-code-cb @}
 */

/**
 * jerry-api-code @}
 */

/**
 * @defgroup jerry-api-backtrace Backtraces
 * @{
 */

/**
 * @defgroup jerry-api-backtrace-capture Capturing
 * @{
 */
jerry_value_t jerry_backtrace (uint32_t max_depth);
void jerry_backtrace_capture (jerry_backtrace_cb_t callback, void *user_p);
/**
 * jerry-api-backtrace-capture @}
 */

/**
 * @defgroup jerry-api-backtrace-frame Frames
 * @{
 */
jerry_frame_type_t jerry_frame_type (const jerry_frame_t *frame_p);
const jerry_value_t *jerry_frame_callee (jerry_frame_t *frame_p);
const jerry_value_t *jerry_frame_this (jerry_frame_t *frame_p);
const jerry_frame_location_t *jerry_frame_location (jerry_frame_t *frame_p);
bool jerry_frame_is_strict (jerry_frame_t *frame_p);
/**
 * jerry-api-backtrace-frame @}
 */

/**
 * jerry-api-backtrace @}
 */

/**
 * @defgroup jerry-api-value Values
 * @{
 */

/* Reference management */
jerry_value_t jerry_value_copy (const jerry_value_t value);
void jerry_value_free (jerry_value_t value);

/**
 * @defgroup jerry-api-value-checks Type inspection
 * @{
 */
jerry_type_t jerry_value_type (const jerry_value_t value);
bool jerry_value_is_exception (const jerry_value_t value);
bool jerry_value_is_abort (const jerry_value_t value);

bool jerry_value_is_undefined (const jerry_value_t value);
bool jerry_value_is_null (const jerry_value_t value);
bool jerry_value_is_boolean (const jerry_value_t value);
bool jerry_value_is_true (const jerry_value_t value);
bool jerry_value_is_false (const jerry_value_t value);

bool jerry_value_is_number (const jerry_value_t value);
bool jerry_value_is_bigint (const jerry_value_t value);

bool jerry_value_is_string (const jerry_value_t value);
bool jerry_value_is_symbol (const jerry_value_t value);

bool jerry_value_is_object (const jerry_value_t value);
bool jerry_value_is_array (const jerry_value_t value);
bool jerry_value_is_promise (const jerry_value_t value);
bool jerry_value_is_proxy (const jerry_value_t value);
bool jerry_value_is_arraybuffer (const jerry_value_t value);
bool jerry_value_is_shared_arraybuffer (const jerry_value_t value);
bool jerry_value_is_dataview (const jerry_value_t value);
bool jerry_value_is_typedarray (const jerry_value_t value);

bool jerry_value_is_constructor (const jerry_value_t value);
bool jerry_value_is_function (const jerry_value_t value);
bool jerry_value_is_async_function (const jerry_value_t value);

bool jerry_value_is_error (const jerry_value_t value);
/**
 * jerry-api-value-checks @}
 */

/**
 * @defgroup jerry-api-value-coerce Coercion
 * @{
 */
bool jerry_value_to_boolean (const jerry_value_t value);
jerry_value_t jerry_value_to_number (const jerry_value_t value);
jerry_value_t jerry_value_to_object (const jerry_value_t value);
jerry_value_t jerry_value_to_primitive (const jerry_value_t value);
jerry_value_t jerry_value_to_string (const jerry_value_t value);
jerry_value_t jerry_value_to_bigint (const jerry_value_t value);

double jerry_value_as_number (const jerry_value_t value);
double jerry_value_as_integer (const jerry_value_t value);
int32_t jerry_value_as_int32 (const jerry_value_t value);
uint32_t jerry_value_as_uint32 (const jerry_value_t value);
/**
 * jerry-api-value-coerce @}
 */

/**
 * @defgroup jerry-api-value-op Operations
 * @{
 */
jerry_value_t jerry_binary_op (jerry_binary_op_t operation, const jerry_value_t lhs, const jerry_value_t rhs);

/**
 * jerry-api-value-op @}
 */

/**
 * jerry-api-value @}
 */

/**
 * @defgroup jerry-api-exception Exceptions
 * @{
 */

/**
 * @defgroup jerry-api-exception-ctor Constructors
 * @{
 */
jerry_value_t jerry_throw (jerry_error_t type, const jerry_value_t message);
jerry_value_t jerry_throw_sz (jerry_error_t type, const char *message_p);
jerry_value_t jerry_throw_value (const jerry_value_t value, bool take_ownership);
jerry_value_t jerry_throw_abort (const jerry_value_t value, bool take_ownership);
/**
 * jerry-api-exception-ctor @}
 */

/**
 * @defgroup jerry-api-exception-op Operations
 * @{
 */
void jerry_exception_allow_capture (jerry_value_t value, bool allow_capture);
/**
 * jerry-api-exception-op @}
 */

/**
 * @defgroup jerry-api-exception-get Getters
 * @{
 */
jerry_value_t jerry_exception_value (jerry_value_t value, bool free_exception);
bool jerry_exception_is_captured (const jerry_value_t value);
/**
 * jerry-api-exception-get @}
 */

/**
 * @defgroup jerry-api-exception-cb Callbacks
 * @{
 */
void jerry_on_throw (jerry_throw_cb_t callback, void *user_p);
/**
 * jerry-api-exception-cb @}
 */

/**
 * jerry-api-error @}
 */

/**
 * @defgroup jerry-api-primitives Primitive types
 * @{
 */

/**
 * @defgroup jerry-api-undefined Undefined
 * @{
 */

/**
 * @defgroup jerry-api-undefined-ctor Constructors
 * @{
 */

jerry_value_t jerry_undefined (void);

/**
 * jerry-api-undefined-ctor @}
 */

/**
 * jerry-api-undefined @}
 */

/**
 * @defgroup jerry-api-null Null
 * @{
 */

/**
 * @defgroup jerry-api-null-ctor Constructors
 * @{
 */

jerry_value_t jerry_null (void);

/**
 * jerry-api-null-ctor @}
 */

/**
 * jerry-api-null @}
 */

/**
 * @defgroup jerry-api-boolean Boolean
 * @{
 */

/**
 * @defgroup jerry-api-boolean-ctor Constructors
 * @{
 */

jerry_value_t jerry_boolean (bool value);

/**
 * jerry-api-boolean-ctor @}
 */

/**
 * jerry-api-boolean @}
 */

/**
 * @defgroup jerry-api-number Number
 * @{
 */

/**
 * @defgroup jerry-api-number-ctor Number
 * @{
 */

jerry_value_t jerry_number (double value);
jerry_value_t jerry_infinity (bool sign);
jerry_value_t jerry_nan (void);

/**
 * jerry-api-number-ctor @}
 */

/**
 * jerry-api-number @}
 */

/**
 * @defgroup jerry-api-bigint BigInt
 * @{
 */

/**
 * @defgroup jerry-api-bigint-ctor Constructors
 * @{
 */
jerry_value_t jerry_bigint (const uint64_t *digits_p, uint32_t digit_count, bool sign);
/**
 * jerry-api-bigint-ctor @}
 */

/**
 * @defgroup jerry-api-bigint-get Getters
 * @{
 */
uint32_t jerry_bigint_digit_count (const jerry_value_t value);
/**
 * jerry-api-bigint-get @}
 */

/**
 * @defgroup jerry-api-bigint-op Operations
 * @{
 */
void jerry_bigint_to_digits (const jerry_value_t value, uint64_t *digits_p, uint32_t digit_count, bool *sign_p);
/**
 * jerry-api-bigint-get @}
 */

/**
 * jerry-api-bigint @}
 */

/**
 * @defgroup jerry-api-string String
 * @{
 */

/**
 * @defgroup jerry-api-string-ctor Constructors
 * @{
 */
jerry_value_t jerry_string (const jerry_char_t *buffer_p, jerry_size_t buffer_size, jerry_encoding_t encoding);
jerry_value_t jerry_string_sz (const char *str_p);
jerry_value_t jerry_string_external (const jerry_char_t *buffer_p, jerry_size_t buffer_size, void *user_p);
jerry_value_t jerry_string_external_sz (const char *str_p, void *user_p);
/**
 * jerry-api-string-cotr @}
 */

/**
 * @defgroup jerry-api-string-get Getters
 * @{
 */
jerry_size_t jerry_string_size (const jerry_value_t value, jerry_encoding_t encoding);
jerry_length_t jerry_string_length (const jerry_value_t value);
void *jerry_string_user_ptr (const jerry_value_t value, bool *is_external);
/**
 * jerry-api-string-get @}
 */

/**
 * @defgroup jerry-api-string-op Operations
 * @{
 */
jerry_size_t jerry_string_substr (const jerry_value_t value, jerry_length_t start, jerry_length_t end);
jerry_size_t jerry_string_to_buffer (const jerry_value_t value,
                                     jerry_encoding_t encoding,
                                     jerry_char_t *buffer_p,
                                     jerry_size_t buffer_size);
void jerry_string_iterate (const jerry_value_t value,
                           jerry_encoding_t encoding,
                           jerry_string_iterate_cb_t callback,
                           void *user_p);
void jerry_string_print (const jerry_value_t value);
/**
 * jerry-api-string-op @}
 */

/**
 * @defgroup jerry-api-string-cb Callbacks
 * @{
 */
void jerry_string_external_on_free (jerry_external_string_free_cb_t callback);
/**
 * jerry-api-string-cb @}
 */

/**
 * jerry-api-string @}
 */

/**
 * @defgroup jerry-api-symbol Symbol
 * @{
 */

/**
 * @defgroup jerry-api-symbol-ctor Constructors
 * @{
 */
jerry_value_t jerry_symbol (jerry_well_known_symbol_t symbol);
jerry_value_t jerry_symbol_with_description (const jerry_value_t value);
/**
 * jerry-api-symbol-ctor @}
 */

/**
 * @defgroup jerry-api-symbol-get Getters
 * @{
 */
jerry_value_t jerry_symbol_description (const jerry_value_t symbol);
jerry_value_t jerry_symbol_descriptive_string (const jerry_value_t symbol);
/**
 * jerry-api-symbol-get @}
 */

/**
 * jerry-api-symbol @}
 */

/**
 * jerry-api-primitives @}
 */

/**
 * @defgroup jerry-api-objects Objects
 * @{
 */

/**
 * @defgroup jerry-api-object-ctor Constructors
 * @{
 */
jerry_value_t jerry_object (void);
/**
 * jerry-api-object-ctor @}
 */

/**
 * @defgroup jerry-api-object-get Getters
 * @{
 */

jerry_object_type_t jerry_object_type (const jerry_value_t object);
jerry_value_t jerry_object_proto (const jerry_value_t object);
jerry_value_t jerry_object_keys (const jerry_value_t object);
jerry_value_t jerry_object_property_names (const jerry_value_t object, jerry_property_filter_t filter);

/**
 * jerry-api-object-get @}
 */

/**
 * @defgroup jerry-api-object-op Operations
 * @{
 */

jerry_value_t jerry_object_set_proto (jerry_value_t object, const jerry_value_t proto);
bool jerry_object_foreach (const jerry_value_t object, jerry_object_property_foreach_cb_t foreach_p, void *user_data_p);

/**
 * @defgroup jerry-api-object-op-set Set
 * @{
 */
jerry_value_t jerry_object_set (jerry_value_t object, const jerry_value_t key, const jerry_value_t value);
jerry_value_t jerry_object_set_index (jerry_value_t object, uint32_t index, const jerry_value_t value);
jerry_value_t jerry_object_define_own_prop (jerry_value_t object,
                                            const jerry_value_t key,
                                            const jerry_property_descriptor_t *prop_desc_p);
bool jerry_object_set_internal (jerry_value_t object, const jerry_value_t key, const jerry_value_t value);
void jerry_object_set_native_ptr (jerry_value_t object,
                                  const jerry_object_native_info_t *native_info_p,
                                  void *native_pointer_p);
/**
 * jerry-api-object-op-set @}
 */

/**
 * @defgroup jerry-api-object-op-has Has
 * @{
 */
jerry_value_t jerry_object_has (const jerry_value_t object, const jerry_value_t key);
jerry_value_t jerry_object_has_own (const jerry_value_t object, const jerry_value_t key);
bool jerry_object_has_internal (const jerry_value_t object, const jerry_value_t key);
bool jerry_object_has_native_ptr (const jerry_value_t object, const jerry_object_native_info_t *native_info_p);
/**
 * jerry-api-object-op-has @}
 */

/**
 * @defgroup jerry-api-object-op-get Get
 * @{
 */
jerry_value_t jerry_object_get (const jerry_value_t object, const jerry_value_t key);
jerry_value_t jerry_object_get_index (const jerry_value_t object, uint32_t index);
jerry_value_t jerry_object_get_own_prop (const jerry_value_t object,
                                         const jerry_value_t key,
                                         jerry_property_descriptor_t *prop_desc_p);
jerry_value_t jerry_object_get_internal (const jerry_value_t object, const jerry_value_t key);
void *jerry_object_get_native_ptr (const jerry_value_t object, const jerry_object_native_info_t *native_info_p);

jerry_value_t jerry_object_find_own (const jerry_value_t object,
                                     const jerry_value_t key,
                                     const jerry_value_t receiver,
                                     bool *found_p);
/**
 * jerry-api-object-op-get @}
 */

/**
 * @defgroup jerry-api-object-op-del Delete
 * @{
 */
jerry_value_t jerry_object_delete (jerry_value_t object, const jerry_value_t key);
jerry_value_t jerry_object_delete_index (jerry_value_t object, uint32_t index);
bool jerry_object_delete_internal (jerry_value_t object, const jerry_value_t key);
bool jerry_object_delete_native_ptr (jerry_value_t object, const jerry_object_native_info_t *native_info_p);
/**
 * jerry-api-object-op-del @}
 */

/**
 * jerry-api-object-op @}
 */

/**
 * @defgroup jerry-api-object-prop-desc Property descriptors
 * @{
 */

/**
 * @defgroup jerry-api-object-prop-desc-ctor Constructors
 * @{
 */
jerry_property_descriptor_t jerry_property_descriptor (void);
jerry_value_t jerry_property_descriptor_from_object (const jerry_value_t obj_value,
                                                     jerry_property_descriptor_t *out_prop_desc_p);
/**
 * jerry-api-object-prop-desc-ctor @}
 */

/**
 * @defgroup jerry-api-object-prop-desc-op Operations
 * @{
 */
void jerry_property_descriptor_free (jerry_property_descriptor_t *prop_desc_p);
jerry_value_t jerry_property_descriptor_to_object (const jerry_property_descriptor_t *src_prop_desc_p);
/**
 * jerry-api-object-prop-desc-op @}
 */

/**
 * jerry-api-object-prop-desc @}
 */

/**
 * @defgroup jerry-api-object-native-ptr Native pointers
 * @{
 */

/**
 * @defgroup jerry-api-object-native-ptr-op Operations
 * @{
 */
void jerry_native_ptr_init (void *native_pointer_p, const jerry_object_native_info_t *native_info_p);
void jerry_native_ptr_free (void *native_pointer_p, const jerry_object_native_info_t *native_info_p);
void jerry_native_ptr_set (jerry_value_t *reference_p, const jerry_value_t value);
/**
 * jerry-api-object-native-ptr-op @}
 */

/**
 * jerry-api-object-native-ptr @}
 */

/**
 * @defgroup jerry-api-array Array
 * @{
 */

/**
 * @defgroup jerry-api-array-ctor Constructors
 * @{
 */
jerry_value_t jerry_array (jerry_length_t length);
/**
 * jerry-api-array-ctor @}
 */

/**
 * @defgroup jerry-api-array-get Getters
 * @{
 */
jerry_length_t jerry_array_length (const jerry_value_t value);
/**
 * jerry-api-array-get @}
 */

/**
 * jerry-api-array @}
 */

/**
 * @defgroup jerry-api-arraybuffer ArrayBuffer
 * @{
 */

/**
 * @defgroup jerry-api-arraybuffer-ctor Constructors
 * @{
 */
jerry_value_t jerry_arraybuffer (const jerry_length_t size);
jerry_value_t jerry_arraybuffer_external (uint8_t *buffer_p, jerry_length_t size, void *user_p);
/**
 * jerry-api-arraybuffer-ctor @}
 */

/**
 * @defgroup jerry-api-arraybuffer-get Getters
 * @{
 */
jerry_size_t jerry_arraybuffer_size (const jerry_value_t value);
uint8_t *jerry_arraybuffer_data (const jerry_value_t value);
bool jerry_arraybuffer_is_detachable (const jerry_value_t value);
bool jerry_arraybuffer_has_buffer (const jerry_value_t value);
/**
 * jerry-api-arraybuffer-get @}
 */

/**
 * @defgroup jerry-api-arraybuffer-op Operations
 * @{
 */
jerry_size_t
jerry_arraybuffer_read (const jerry_value_t value, jerry_size_t offset, uint8_t *buffer_p, jerry_size_t buffer_size);
jerry_size_t
jerry_arraybuffer_write (jerry_value_t value, jerry_size_t offset, const uint8_t *buffer_p, jerry_size_t buffer_size);
jerry_value_t jerry_arraybuffer_detach (jerry_value_t value);
void jerry_arraybuffer_heap_allocation_limit (jerry_size_t limit);
/**
 * jerry-api-arraybuffer-op @}
 */

/**
 * @defgroup jerry-api-arraybuffer-cb Callbacks
 * @{
 */
void jerry_arraybuffer_allocator (jerry_arraybuffer_allocate_cb_t allocate_callback,
                                  jerry_arraybuffer_free_cb_t free_callback,
                                  void *user_p);
/**
 * jerry-api-arraybuffer-cb @}
 */

/**
 * jerry-api-arraybuffer @}
 */

/**
 * @defgroup jerry-api-sharedarraybuffer SharedArrayBuffer
 * @{
 */

/**
 * @defgroup jerry-api-sharedarraybuffer-ctor Constructors
 * @{
 */
jerry_value_t jerry_shared_arraybuffer (jerry_size_t size);
jerry_value_t jerry_shared_arraybuffer_external (uint8_t *buffer_p, jerry_size_t buffer_size, void *user_p);
/**
 * jerry-api-sharedarraybuffer-ctor @}
 */

/**
 * jerry-api-sharedarraybuffer @}
 */

/**
 * @defgroup jerry-api-dataview DataView
 * @{
 */

/**
 * @defgroup jerry-api-dataview-ctor Constructors
 * @{
 */
jerry_value_t jerry_dataview (const jerry_value_t value, jerry_size_t byte_offset, jerry_size_t byte_length);
/**
 * jerry-api-dataview-ctr @}
 */

/**
 * @defgroup jerry-api-dataview-get Getters
 * @{
 */
jerry_value_t
jerry_dataview_buffer (const jerry_value_t dataview, jerry_size_t *byte_offset, jerry_size_t *byte_length);
/**
 * jerry-api-dataview-get @}
 */

/**
 * jerry-api-dataview @}
 */

/**
 * @defgroup jerry-api-typedarray TypedArray
 * @{
 */

/**
 * @defgroup jerry-api-typedarray-ctor Constructors
 * @{
 */
jerry_value_t jerry_typedarray (jerry_typedarray_type_t type, jerry_length_t length);
jerry_value_t jerry_typedarray_with_buffer (jerry_typedarray_type_t type, const jerry_value_t arraybuffer);
jerry_value_t jerry_typedarray_with_buffer_span (jerry_typedarray_type_t type,
                                                 const jerry_value_t arraybuffer,
                                                 jerry_size_t byte_offset,
                                                 jerry_size_t byte_length);
/**
 * jerry-api-typedarray-ctor @}
 */

/**
 * @defgroup jerry-api-typedarray-get Getters
 * @{
 */
jerry_typedarray_type_t jerry_typedarray_type (const jerry_value_t value);
jerry_length_t jerry_typedarray_length (const jerry_value_t value);
jerry_value_t jerry_typedarray_buffer (const jerry_value_t value, jerry_size_t *byte_offset, jerry_size_t *byte_length);
/**
 * jerry-api-typedarray-get @}
 */

/**
 * jerry-api-typedarray @}
 */

/**
 * @defgroup jerry-api-iterator Iterator
 * @{
 */

/**
 * @defgroup jerry-api-iterator-get Getters
 * @{
 */
jerry_iterator_type_t jerry_iterator_type (const jerry_value_t value);
/**
 * jerry-api-iterator-get @}
 */

/**
 * jerry-api-iterator @}
 */

/**
 * @defgroup jerry-api-function Function
 * @{
 */

/**
 * @defgroup jerry-api-function-ctor Constructors
 * @{
 */
jerry_value_t jerry_function_external (jerry_external_handler_t handler);
/**
 * jerry-api-function-ctor @}
 */

/**
 * @defgroup jerry-api-function-get Getters
 * @{
 */
jerry_function_type_t jerry_function_type (const jerry_value_t value);
bool jerry_function_is_dynamic (const jerry_value_t value);
/**
 * jerry-api-function-get @}
 */

/**
 * @defgroup jerry-api-function-op Operations
 * @{
 */
jerry_value_t jerry_call (const jerry_value_t function,
                          const jerry_value_t this_value,
                          const jerry_value_t *args_p,
                          jerry_size_t args_count);
jerry_value_t jerry_construct (const jerry_value_t function, const jerry_value_t *args_p, jerry_size_t args_count);
/**
 * jerry-api-function-op @}
 */

/**
 * jerry-api-function @}
 */

/**
 * @defgroup jerry-api-proxy Proxy
 * @{
 */

/**
 * @defgroup jerry-api-proxy-ctor Constructors
 * @{
 */
jerry_value_t jerry_proxy (const jerry_value_t target, const jerry_value_t handler);
jerry_value_t jerry_proxy_custom (const jerry_value_t target, const jerry_value_t handler, uint32_t flags);
/**
 * jerry-api-function-proxy-ctor @}
 */

/**
 * @defgroup jerry-api-proxy-get Getters
 * @{
 */
jerry_value_t jerry_proxy_target (const jerry_value_t value);
jerry_value_t jerry_proxy_handler (const jerry_value_t value);
/**
 * jerry-api-function-proxy-get @}
 */

/**
 * jerry-api-proxy @}
 */

/**
 * @defgroup jerry-api-promise Promise
 * @{
 */

/**
 * @defgroup jerry-api-promise-ctor Constructors
 * @{
 */
jerry_value_t jerry_promise (void);
/**
 * jerry-api-promise-ctor @}
 */

/**
 * @defgroup jerry-api-promise-get Getters
 * @{
 */
jerry_value_t jerry_promise_result (const jerry_value_t promise);
jerry_promise_state_t jerry_promise_state (const jerry_value_t promise);
/**
 * jerry-api-promise-get @}
 */

/**
 * @defgroup jerry-api-promise-op Operations
 * @{
 */
jerry_value_t jerry_promise_resolve (jerry_value_t promise, const jerry_value_t argument);
jerry_value_t jerry_promise_reject (jerry_value_t promise, const jerry_value_t argument);
/**
 * jerry-api-promise-op @}
 */

/**
 * @defgroup jerry-api-promise-cb Callbacks
 * @{
 */
void jerry_promise_on_event (jerry_promise_event_filter_t filters, jerry_promise_event_cb_t callback, void *user_p);
/**
 * jerry-api-promise-cb @}
 */

/**
 * jerry-api-promise @}
 */

/**
 * @defgroup jerry-api-container Map, Set, WeakMap, WeakSet
 * @{
 */

/**
 * @defgroup jerry-api-container-ctor Constructors
 * @{
 */
jerry_value_t jerry_container (jerry_container_type_t container_type,
                               const jerry_value_t *arguments_p,
                               jerry_length_t argument_count);
/**
 * jerry-api-promise-ctor @}
 */

/**
 * @defgroup jerry-api-container-get Getters
 * @{
 */
jerry_container_type_t jerry_container_type (const jerry_value_t value);
/**
 * jerry-api-container-get @}
 */

/**
 * @defgroup jerry-api-container-op Operations
 * @{
 */
jerry_value_t jerry_container_to_array (const jerry_value_t value, bool *is_key_value_p);
jerry_value_t jerry_container_op (jerry_container_op_t operation,
                                  jerry_value_t container,
                                  const jerry_value_t *arguments,
                                  uint32_t argument_count);
/**
 * jerry-api-container-op @}
 */

/**
 * jerry-api-container @}
 */

/**
 * @defgroup jerry-api-regexp RegExp
 * @{
 */

/**
 * @defgroup jerry-api-regexp-ctor Constructors
 * @{
 */
jerry_value_t jerry_regexp (const jerry_value_t pattern, uint16_t flags);
jerry_value_t jerry_regexp_sz (const char *pattern_p, uint16_t flags);
/**
 * jerry-api-regexp-ctor @}
 */

/**
 * jerry-api-regexp @}
 */

/**
 * @defgroup jerry-api-error Error
 * @{
 */

/**
 * @defgroup jerry-api-error-ctor Constructors
 * @{
 */
jerry_value_t jerry_error (jerry_error_t type, const jerry_value_t message);
jerry_value_t jerry_error_sz (jerry_error_t type, const char *message_p);
/**
 * jerry-api-error-ctor @}
 */

/**
 * @defgroup jerry-api-error-get Getters
 * @{
 */
jerry_error_t jerry_error_type (jerry_value_t value);
/**
 * jerry-api-error-get @}
 */

/**
 * @defgroup jerry-api-error-cb Callbacks
 * @{
 */
void jerry_error_on_created (jerry_error_object_created_cb_t callback, void *user_p);
/**
 * jerry-api-error-cb @}
 */

/**
 * jerry-api-error @}
 */

/**
 * jerry-api-objects @}
 */

/**
 * @defgroup jerry-api-json JSON
 * @{
 */

/**
 * @defgroup jerry-api-json-op Operations
 * @{
 */
jerry_value_t jerry_json_parse (const jerry_char_t *string_p, jerry_size_t string_size);
jerry_value_t jerry_json_stringify (const jerry_value_t object);
/**
 * jerry-api-json-op @}
 */

/**
 * jerry-api-json @}
 */

/**
 * @defgroup jerry-api-module Modules
 * @{
 */

/**
 * @defgroup jerry-api-module-get Getters
 * @{
 */
jerry_module_state_t jerry_module_state (const jerry_value_t module);
size_t jerry_module_request_count (const jerry_value_t module);
jerry_value_t jerry_module_request (const jerry_value_t module, size_t request_index);
jerry_value_t jerry_module_namespace (const jerry_value_t module);
/**
 * jerry-api-module-get @}
 */

/**
 * @defgroup jerry-api-module-op Operations
 * @{
 */
jerry_value_t jerry_module_link (const jerry_value_t module, jerry_module_resolve_cb_t callback, void *user_p);
jerry_value_t jerry_module_evaluate (const jerry_value_t module);
/**
 * jerry-api-module-op @}
 */

/**
 * @defgroup jerry-api-module-native Native modules
 * @{
 */
jerry_value_t jerry_native_module (jerry_native_module_evaluate_cb_t callback,
                                   const jerry_value_t *const exports_p,
                                   size_t export_count);
jerry_value_t jerry_native_module_get (const jerry_value_t native_module, const jerry_value_t export_name);
jerry_value_t
jerry_native_module_set (const jerry_value_t native_module, const jerry_value_t export_name, const jerry_value_t value);
/**
 * jerry-api-module-native @}
 */

/**
 * @defgroup jerry-api-module-cb Callbacks
 * @{
 */
void jerry_module_on_state_changed (jerry_module_state_changed_cb_t callback, void *user_p);
void jerry_module_on_import_meta (jerry_module_import_meta_cb_t callback, void *user_p);
void jerry_module_on_import (jerry_module_import_cb_t callback, void *user_p);
/**
 * jerry-api-module-cb @}
 */

/**
 * jerry-api-module @}
 */

/**
 * @defgroup jerry-api-realm Realms
 * @{
 */

/**
 * @defgroup jerry-api-realm-ctor Constructors
 * @{
 */
jerry_value_t jerry_realm (void);
/**
 * jerry-api-realm-ctor @}
 */

/**
 * @defgroup jerry-api-realm-get Getters
 * @{
 */
jerry_value_t jerry_realm_this (jerry_value_t realm);
/**
 * jerry-api-realm-ctor @}
 */

/**
 * @defgroup jerry-api-realm-op Operation
 * @{
 */
jerry_value_t jerry_realm_set_this (jerry_value_t realm, jerry_value_t this_value);
/**
 * jerry-api-realm-op @}
 */

/**
 * jerry-api-realm @}
 */

/**
 * jerry-api @}
 */

JERRY_C_API_END

#endif /* !JERRYSCRIPT_CORE_H */

/* vim: set fdm=marker fmr=@{,@}: */


text:
__version__ = '1.0'
__author__ = 'Michael A. Casey'
__copyright__ = "Copyright (C) 2010  Michael Casey, Dartmouth College, All Rights Reserved"
__license__ = "GPL Version 2.0 or Higher"
__email__ = 'mcasey@dartmouth.edu'

from fractions import Fraction
from psychoacoustics import dissonance_fun
from testsignal import default_signal_params, harmonics
import pylab
import pdb

class TuningSystem():
    """
    ::

        A class for generating tuning systems, scales, and intervals.

        Usage examples:
          T = TuningSystem()
          print T.EQ # equal-temperament 12-tet frequency ratios
          print T.PY # Pythagorean frequency ratios
          print T.JI # just intonation frequency ratios
          print T.BP # equal temperament Bohlen-Pierce 13-step tritave ratios
          eq = T.to_scale_freqs(T.JI, f0=220) # realize the scale frequencies starting at 220Hz
          x = T.to_scale_sound(T.EQ, f0=220, num_harmonics=6) # realize scale as sound
          x = T.to_scale_intervals(T.PY, f0=220, interval=7, num_harmonics=6) # realize scale as intervals with p5
          sound(x*0.05, 44100)

        The methods equal_temperament(), Pythagorean(), and just_intonation(), can generate the scales
        with different parameterizatoins, such as the order (number of tuning steps) to use.
    """
    def __init__(self):
        pitch_class_sharp = ['U', 'm2', 'M2', 'm3', 'M3', 'P4', 'TT', 'P5', 'm6', 'M6', 'm7', 'M7', 'P8']
        pitch_class_flat =  ['M7', 'm7', 'M6', 'm6', 'P5', 'TT', 'P4', 'M3', 'm3', 'P2', 'm2', 'U']
        pitch_class_flat.reverse()
        self.pitch_class = pitch_class_sharp
        self.pitch_ratios_sharp = None
        self.pitch_ratios_flat = None
        self.reference_frequency = 440.
        self.EQ = self.equal_temperament()
        self.PY = self.Pythagorean()
        self.JI = self.just_intonation()
        self.BP = self.Bohlen_Pierce()

    def equal_temperament(self, frame_interval=2, num_steps=12):
        """
        ::

            Defines 12-tet pitch classes in Equal Temperament as irrational numbers.
        """

        self.pitch_ratios_eq = self.generalized_equal_temperament(frame_interval, num_steps)
        return self.pitch_ratios_eq

    def Bohlen_Pierce(self, frame_interval=3, num_steps=13):
        """
        ::

            Defines 13-tet pitch classes in Bohlen-Pierce tritave as irrational numbers.
        """
        self.pitch_ratios_bp = self.generalized_equal_temperament(frame_interval, num_steps)
        return self.pitch_ratios_bp

    def generalized_equal_temperament(self, frame_interval=2, num_steps=12):
        """
        ::

            Defines 12-tet pitch classes in Equal Temperament as irrational numbers.
        """
        f = self.reference_frequency
        self.pitch_ratios_sharp = [Fraction(k,num_steps) for k in range(num_steps+1)]
        self.pitch_ratios_flat = [Fraction(-num_steps+k,num_steps) for k in range(num_steps)]
        self.pitch_ratios_get = [frame_interval**k for k in self.pitch_ratios_sharp]
        return self.pitch_ratios_get

    def Pythagorean(self, N=12):
        """
        ::

            Generate 12 steps of Pythagorean tuning as rational numbers
            from N cycles in P5 and P4 directions.
        """
        ratios = []
        self.pitch_ratios_sharp = [0]*N
        self.pitch_ratios_flat = [0]*N
        for k in range(N):
            ratios.append(Fraction(3,2)**k)
            while ratios[k] > 2:
                ratios[k] /= 2
        for r in range(N): self.pitch_ratios_sharp[(r*7)%12] = ratios[r%12]

        ratios = []
        for k in range(1,N+1):
            ratios.append(Fraction(2,3)**k)
            while ratios[k-1] < 1:
                ratios[k-1] *= 2
        for r in range(N): self.pitch_ratios_flat[((r+1)*5)%N]=ratios[r]
        self.pitch_ratios_pythagorean = self.sort_ratios(self.pitch_ratios_flat + self.pitch_ratios_sharp)
        return self.pitch_ratios_pythagorean

    def just_intonation(self, N=25):
        """
        ::

            Generate 12 steps of Just Intonation tuning from N harmonics
        """
        ratios = []
        self.pitch_ratios_sharp = [0]*N
        self.pitch_ratios_flat = [0]*N
        for k in range(N):
            ratios.append(Fraction(k+1,1))
            while ratios[k] > 2:
                ratios[k] /= 2
        self.pitch_ratios_sharp = ratios
        self.pitch_ratios_just = self.sort_ratios(self.pitch_ratios_sharp)
        return self.pitch_ratios_just

    def sort_ratios(self, ratios):
        """
        ::

            Sort and select tuning system ratios in ascending order by
            proximity to equal tempered pitch classes.
        """
        ratios.append(Fraction(2,1))
        res = list(set(ratios)) # eliminate duplicates
        res.sort() # in-place sort
        idx = [pylab.argmin( abs( pylab.array(res) - j) ) for j in self.pitch_ratios_eq]
        res = [res[i] for i in idx]
        return res

    def to_scale_freqs(self, tuning, f0=440.):
        """
        ::

            Convert tuning system list to a scale frequencies at f0 [default=440.Hz]
        """
        rt = [float(r) * f0 for r in tuning]
        return rt

    def to_dissonance(self, tuning, f0=440., num_harmonics=6):
        """
        ::

            Convert scale to dissonance values for num_harmonics harmonics.
            Assume an exponentially decaying harmonic series.
            Returns dissonance scores for each interval in given tuning system.
        """
        harm = pylab.arange(num_harmonics)+1
        h0 = [f0 * k for k in harm]
        a = [pylab.exp(-0.5 * k) for k in harm]
        diss = [dissonance_fun(h0 + [p*k for k in harm]) for p in self.to_scale_freqs(tuning, f0)]
        return diss

    def to_scale_sound(self, tuning, f0=440., num_harmonics=6, dur=0.5, sr = 44100.):
        """
        ::

            Realize given tuning system as a scale, starting at frequency
            f0=440., using num_harmonics=6 complex tones with duration dur=0.5 seconds, and
            default sample rate sr=44100Hz.
        """
        p = default_signal_params()
        p['num_harmonics'] = num_harmonics
        p['sr'] = sr
        p['num_points']=int(round(dur*sr))
        p.pop('f0')
        x = []
        num_samples = p['num_points']
        ramp = pylab.r_[pylab.array(pylab.linspace(0,1,100)), pylab.linspace(1,0,num_samples-100)]
        for rat in tuning:
            x = pylab.r_[x, ramp*harmonics(f0=f0*rat,**p)]
        return x

    def to_scale_intervals(self, tuning, interval=0, f0=440., num_harmonics=6, dur=0.5, sr = 44100.):
        """
        ::

            Realize given tuning system as a series of intervals, with
            scale degree interval=0 (tonic), starting at frequency
            f0=440., using num_harmonics=6 complex tones with duration
            dur=0.5 seconds, and default sample rate sr=44100Hz.
        """
        dummy = [tuning[interval]]*len(tuning)
        x = self.to_scale_sound(dummy, f0=f0, num_harmonics=num_harmonics, dur=dur, sr=sr)
        y = self.to_scale_sound(tuning, f0=f0, num_harmonics=num_harmonics, dur=dur, sr=sr)
        return (x + y)/2

redpajama_set_name: RedPajamaGithub


text:
(function($){
    $(document).on('focus.django-bootstrap-toolkit.data-api click.django-bootstrap-toolkit.data-api', 'input[data-bootstrap-widget=datepicker][data-provide!="datepicker"]', function (e) {
        $(e.target).datepicker("show");
    });
})(jQuery);


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.sap.data.db.pojo;

import java.io.Serializable;

/**
 *
 * @author C5178395
 */
public class BapiFUPARAREFPojo implements Serializable {

	private static final long serialVersionUID = 1L;
    private BapiFUPARAREFId id;
    private String STRUCTURE;
    private String DEFAULTVAL;
    private String REFERENCE;
    private Integer PPOSITION;
    private String OPTIONAL;
    private String TYPE;
    private String CLASS;
    private String REF_CLASS;
    private String LINE_OF;
    private String TABLE_OF;
    private String RESFLAG1;
    private String RESFLAG2;
    private String RESFLAG3;
    private String RESFLAG4;
    private String RESFLAG5;

    public BapiFUPARAREFPojo() {

    }

    public BapiFUPARAREFPojo(BapiFUPARAREFId id) {
        this.id = id;
    }

    public BapiFUPARAREFPojo(BapiFUPARAREFId id, String STRUCTURE, String DEFAULTVAL,
            String REFERENCE, Integer PPOSITION, String OPTIONAL, String TYPE, String CLASS, String REF_CLASS, String LINE_OF,
            String TABLE_OF, String RESFLAG1, String RESFLAG2, String RESFLAG3, String RESFLAG4, String RESFLAG5) {
        this.id = id;
        this.STRUCTURE = STRUCTURE;
        this.DEFAULTVAL = DEFAULTVAL;
        this.REFERENCE = REFERENCE;
        this.PPOSITION = PPOSITION;
        this.OPTIONAL = OPTIONAL;
        this.TYPE = TYPE;
        this.CLASS = CLASS;
        this.REF_CLASS = REF_CLASS;
        this.LINE_OF = LINE_OF;
        this.TABLE_OF = TABLE_OF;
        this.RESFLAG1 = RESFLAG1;
        this.RESFLAG2 = RESFLAG2;
        this.RESFLAG3 = RESFLAG3;
        this.RESFLAG4 = RESFLAG4;
        this.RESFLAG5 = RESFLAG5;
    }

    public BapiFUPARAREFId getId() {
        return id;
    }

    public void setId(BapiFUPARAREFId id) {
        this.id = id;
    }

    public String getSTRUCTURE() {
        return STRUCTURE;
    }

    public void setSTRUCTURE(String STRUCTURE) {
        this.STRUCTURE = STRUCTURE;
    }

    public String getDEFAULTVAL() {
        return DEFAULTVAL;
    }

    public void setDEFAULTVAL(String DEFAULTVAL) {
        this.DEFAULTVAL = DEFAULTVAL;
    }

    public String getREFERENCE() {
        return REFERENCE;
    }

    public void setREFERENCE(String REFERENCE) {
        this.REFERENCE = REFERENCE;
    }

    public Integer getPPOSITION() {
        return PPOSITION;
    }

    public void setPPOSITION(Integer PPOSITION) {
        this.PPOSITION = PPOSITION;
    }

    public String getOPTIONAL() {
        return OPTIONAL;
    }

    public void setOPTIONAL(String OPTIONAL) {
        this.OPTIONAL = OPTIONAL;
    }

    public String getTYPE() {
        return TYPE;
    }

    public void setTYPE(String TYPE) {
        this.TYPE = TYPE;
    }

    public String getCLASS() {
        return CLASS;
    }

    public void setCLASS(String CLASS) {
        this.CLASS = CLASS;
    }

    public String getREF_CLASS() {
        return REF_CLASS;
    }

    public void setREF_CLASS(String REF_CLASS) {
        this.REF_CLASS = REF_CLASS;
    }

    public String getLINE_OF() {
        return LINE_OF;
    }

    public void setLINE_OF(String LINE_OF) {
        this.LINE_OF = LINE_OF;
    }

    public String getTABLE_OF() {
        return TABLE_OF;
    }

    public void setTABLE_OF(String TABLE_OF) {
        this.TABLE_OF = TABLE_OF;
    }

    public String getRESFLAG1() {
        return RESFLAG1;
    }

    public void setRESFLAG1(String RESFLAG1) {
        this.RESFLAG1 = RESFLAG1;
    }

    public String getRESFLAG2() {
        return RESFLAG2;
    }

    public void setRESFLAG2(String RESFLAG2) {
        this.RESFLAG2 = RESFLAG2;
    }

    public String getRESFLAG3() {
        return RESFLAG3;
    }

    public void setRESFLAG3(String RESFLAG3) {
        this.RESFLAG3 = RESFLAG3;
    }

    public String getRESFLAG4() {
        return RESFLAG4;
    }

    public void setRESFLAG4(String RESFLAG4) {
        this.RESFLAG4 = RESFLAG4;
    }

    public String getRESFLAG5() {
        return RESFLAG5;
    }

    public void setRESFLAG5(String RESFLAG5) {
        this.RESFLAG5 = RESFLAG5;
    }

}


text:
var EventEmitter = require('events').EventEmitter;

var defaults = require(__dirname + '/defaults');
var genericPool = require('generic-pool');

var deprecate = require('deprecate');

var pools = {
  //dictionary of all key:pool pairs
  all: {},
  //reference to the client constructor - can override in tests or for require('pg').native
  Client: require(__dirname + '/client'),
  getOrCreate: function(clientConfig) {
    clientConfig = clientConfig || {};
    var name = JSON.stringify(clientConfig);
    var pool = pools.all[name];
    if(pool) {
      return pool;
    }
    pool = genericPool.Pool({
      name: name,
      max: defaults.poolSize,
      idleTimeoutMillis: defaults.poolIdleTimeout,
      reapIntervalMillis: defaults.reapIntervalMillis,
      log: defaults.poolLog,
      create: function(cb) {
        var client = new pools.Client(clientConfig);
        client.connect(function(err) {
          if(err) return cb(err, null);

          //handle connected client background errors by emitting event
          //via the pg object and then removing errored client from the pool
          client.on('error', function(e) {
            pool.emit('error', e, client);
            pool.destroy(client);
          });

          return cb(null, client);
        });
      },
      destroy: function(client) {
        client.end();
      }
    });
    pools.all[name] = pool;
    //mixin EventEmitter to pool
    EventEmitter.call(pool);
    for(var key in EventEmitter.prototype) {
      if(EventEmitter.prototype.hasOwnProperty(key)) {
        pool[key] = EventEmitter.prototype[key];
      }
    }
    //monkey-patch with connect method
    pool.connect = function(cb) {
      pool.acquire(function(err, client) {
        if(err)  return cb(err, null, function() {/*NOOP*/});
        //support both 2 (old) and 3 arguments
        (cb.length > 2 ? newConnect : oldConnect)(pool, client, cb);
      });
    };
    return pool;
  }
};

//the old connect method of the pool
//would automatically subscribe to the 'drain'
//event and automatically return the client to
//the pool once 'drain' fired once.  This caused
//a bunch of problems, but for backwards compatibility
//we're leaving it in
var alarmDuration = 5000;
var errorMessage = [
  'A client has been checked out from the pool for longer than ' + alarmDuration + ' ms.',
  'You might have a leak!',
  'You should use the following new way to check out clients','pg.connect(function(err, client, done)) {',
  '  //do something',
  '  done();  //call done() to signal you are finished with the client',
  '}'
].join(require('os').EOL);

var oldConnect = function(pool, client, cb) {
  deprecate('pg.connect(function(err, client) { ...}) is deprecated and will be removed it v1.0.0 (very soon)',
            'instead, use pg.connect(function(err, client, done) { ... })',
            'automatic releasing of clients back to the pool was a mistake and will be removed',
           'please see the following for more details:',
           'https://github.com/brianc/node-postgres/wiki/pg',
           'https://github.com/brianc/node-postgres/issues/227',
           'https://github.com/brianc/node-postgres/pull/274',
           'feel free to get in touch via github if you have questions');
  var tid = setTimeout(function() {
    console.error(errorMessage);
  }, alarmDuration);
  var onError = function() {
    clearTimeout(tid);
    client.removeListener('drain', release);
  };
  var release = function() {
    clearTimeout(tid);
    pool.release(client);
    client.removeListener('error', onError);
  };
  client.once('drain', release);
  client.once('error', onError);
  cb(null, client);
};

var newConnect = function(pool, client, cb) {
  cb(null, client, function(err) {
    if(err) {
      pool.destroy(client);
    } else {
      pool.release(client);
    }
  });
};

module.exports = pools;


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
using static WpfDataUi.Controls.ToggleButtonOptionDisplay;

namespace Gum.Controls
{
    class XOriginControl : ToggleButtonOptionContainer
    {
        static Option[] cachedOptions;

        protected override Option[] GetOptions()
        {
            if (cachedOptions == null)
            {
                BitmapImage leftBitmap =
                    CreateBitmapFromFile("Content/Icons/Origins/LeftOrigin.png");

                BitmapImage centerBitmap =
                    CreateBitmapFromFile("Content/Icons/Origins/CenterOrigin.png");

                BitmapImage rightBitmap =
                    CreateBitmapFromFile("Content/Icons/Origins/RightOrigin.png");

                cachedOptions = new Option[]
                {
                    new Option
                    {
                        Name = "Left",
                        Value = global::RenderingLibrary.Graphics.HorizontalAlignment.Left,
                        Image = leftBitmap

                    },
                    new Option
                    {
                        Name = "Center",
                        Value = global::RenderingLibrary.Graphics.HorizontalAlignment.Center,
                        Image = centerBitmap
                    },
                    new Option
                    {
                        Name = "Right",
                        Value = global::RenderingLibrary.Graphics.HorizontalAlignment.Right,
                        Image = rightBitmap
                    }
                };
            }

            return cachedOptions;
        }
    }
}


text:
module Sass
  # A namespace for nodes in the Sass parse tree.
  #
  # The Sass parse tree has three states: dynamic, static Sass, and static CSS.
  #
  # When it's first parsed, a Sass document is in the dynamic state.
  # It has nodes for mixin definitions and `@for` loops and so forth,
  # in addition to nodes for CSS rules and properties.
  # Nodes that only appear in this state are called **dynamic nodes**.
  #
  # {Tree::Visitors::Perform} creates a static Sass tree, which is different.
  # It still has nodes for CSS rules and properties
  # but it doesn't have any dynamic-generation-related nodes.
  # The nodes in this state are in the same structure as the Sass document:
  # rules and properties are nested beneath one another.
  # Nodes that can be in this state or in the dynamic state
  # are called **static nodes**; nodes that can only be in this state
  # are called **solely static nodes**.
  #
  # {Tree::Visitors::Cssize} is then used to create a static CSS tree.
  # This is like a static Sass tree,
  # but the structure exactly mirrors that of the generated CSS.
  # Rules and properties can't be nested beneath one another in this state.
  #
  # Finally, {Tree::Visitors::ToCss} can be called on a static CSS tree
  # to get the actual CSS code as a string.
  module Tree
    # The abstract superclass of all parse-tree nodes.
    class Node
      include Enumerable

      # The child nodes of this node.
      #
      # @return [Array<Tree::Node>]
      attr_reader :children

      # Whether or not this node has child nodes.
      # This may be true even when \{#children} is empty,
      # in which case this node has an empty block (e.g. `{}`).
      #
      # @return [Boolean]
      attr_accessor :has_children

      # The line of the document on which this node appeared.
      #
      # @return [Fixnum]
      attr_accessor :line

      # The source range in the document on which this node appeared.
      #
      # @return [Sass::Source::Range]
      attr_accessor :source_range

      # The name of the document on which this node appeared.
      #
      # @return [String]
      attr_writer :filename

      # The options hash for the node.
      # See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.
      #
      # @return [{Symbol => Object}]
      attr_reader :options

      def initialize
        @children = []
      end

      # Sets the options hash for the node and all its children.
      #
      # @param options [{Symbol => Object}] The options
      # @see #options
      def options=(options)
        Sass::Tree::Visitors::SetOptions.visit(self, options)
      end

      # @private
      def children=(children)
        self.has_children ||= !children.empty?
        @children = children
      end

      # The name of the document on which this node appeared.
      #
      # @return [String]
      def filename
        @filename || (@options && @options[:filename])
      end

      # Appends a child to the node.
      #
      # @param child [Tree::Node, Array<Tree::Node>] The child node or nodes
      # @raise [Sass::SyntaxError] if `child` is invalid
      def <<(child)
        return if child.nil?
        if child.is_a?(Array)
          child.each {|c| self << c}
        else
          self.has_children = true
          @children << child
        end
      end

      # Compares this node and another object (only other {Tree::Node}s will be equal).
      # This does a structural comparison;
      # if the contents of the nodes and all the child nodes are equivalent,
      # then the nodes are as well.
      #
      # Only static nodes need to override this.
      #
      # @param other [Object] The object to compare with
      # @return [Boolean] Whether or not this node and the other object
      #   are the same
      # @see Sass::Tree
      def ==(other)
        self.class == other.class && other.children == children
      end

      # True if \{#to\_s} will return `nil`;
      # that is, if the node shouldn't be rendered.
      # Should only be called in a static tree.
      #
      # @return [Boolean]
      def invisible?; false; end

      # The output style. See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.
      #
      # @return [Symbol]
      def style
        @options[:style]
      end

      # Computes the CSS corresponding to this static CSS tree.
      #
      # @return [String] The resulting CSS
      # @see Sass::Tree
      def css
        Sass::Tree::Visitors::ToCss.new.visit(self)
      end

      # Computes the CSS corresponding to this static CSS tree, along with
      # the respective source map.
      #
      # @return [(String, Sass::Source::Map)] The resulting CSS and the source map
      # @see Sass::Tree
      def css_with_sourcemap
        visitor = Sass::Tree::Visitors::ToCss.new(:build_source_mapping)
        result = visitor.visit(self)
        return result, visitor.source_mapping
      end

      # Returns a representation of the node for debugging purposes.
      #
      # @return [String]
      def inspect
        return self.class.to_s unless has_children
        "(#{self.class} #{children.map {|c| c.inspect}.join(' ')})"
      end

      # Iterates through each node in the tree rooted at this node
      # in a pre-order walk.
      #
      # @yield node
      # @yieldparam node [Node] a node in the tree
      def each
        yield self
        children.each {|c| c.each {|n| yield n}}
      end

      # Converts a node to Sass code that will generate it.
      #
      # @param options [{Symbol => Object}] An options hash (see {Sass::CSS#initialize})
      # @return [String] The Sass code corresponding to the node
      def to_sass(options = {})
        Sass::Tree::Visitors::Convert.visit(self, options, :sass)
      end

      # Converts a node to SCSS code that will generate it.
      #
      # @param options [{Symbol => Object}] An options hash (see {Sass::CSS#initialize})
      # @return [String] The Sass code corresponding to the node
      def to_scss(options = {})
        Sass::Tree::Visitors::Convert.visit(self, options, :scss)
      end

      # Return a deep clone of this node.
      # The child nodes are cloned, but options are not.
      #
      # @return [Node]
      def deep_copy
        Sass::Tree::Visitors::DeepCopy.visit(self)
      end

      # Whether or not this node bubbles up through RuleNodes.
      #
      # @return [Boolean]
      def bubbles?
        false
      end

      protected

      # @see Sass::Shared.balance
      # @raise [Sass::SyntaxError] if the brackets aren't balanced
      def balance(*args)
        res = Sass::Shared.balance(*args)
        return res if res
        raise Sass::SyntaxError.new("Unbalanced brackets.", :line => line)
      end
    end
  end
end


text:
using System.Collections.Generic;

namespace Evento.Tests.Fakes
{
    internal class CreateFakeCommand : Command
    {
        public string TestString { get; }
        public IDictionary<string, string> Metadata { get; }

        public CreateFakeCommand(string testString, IDictionary<string, string> metadata)
        {
            TestString = testString;
            Metadata = metadata;
        }
    }
}


text:
package quanlynhansu.controller;

import java.sql.SQLException;
import java.util.ArrayList;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import quanlynhansu.model.dto.CanBoDTO;
import quanlynhansu.model.dto.DonViChucNangDTO;
import quanlynhansu.model.dto.KeKhaiTaiSanDTO;
import quanlynhansu.service.ICanBoService;
import quanlynhansu.service.IDonViChucNangService;
import quanlynhansu.service.IKeKhaiTaiSanService;

@Controller
@RequestMapping("/keKhaiTaiSanController")
public class KeKhaiTaiSanController {
	@Autowired
	private IKeKhaiTaiSanService keKhaiTaiSanService;
	@Autowired
	private IDonViChucNangService donViChucNangService;
	@Autowired
	private ICanBoService canBoService;

	@GetMapping("/show")
	public ModelAndView getdata() {
		ArrayList<DonViChucNangDTO> donViChucNangLists = donViChucNangService.getAll();
		ArrayList<CanBoDTO> canBoLists = canBoService.getAll();
		ModelAndView model = new ModelAndView("kekhaitaisan");
		model.addObject("donViChucNangLists", donViChucNangLists);
		model.addObject("canBoLists", canBoLists);
		return model;
	}

	@RequestMapping(value = "/delete/{pK}", method = RequestMethod.DELETE)
	public String delete(@PathVariable Integer pK, Model model)
			throws SQLException {
		keKhaiTaiSanService.delete(pK);
		return "kekhaitaisan";
	}

	@PostMapping("/update")
	public String update(@RequestBody KeKhaiTaiSanDTO qdkl, Model model)
			throws SQLException {
		keKhaiTaiSanService.update(qdkl);
		return "kekhaitaisan";
	}

	@PostMapping("/add")
	public String insert(@RequestBody KeKhaiTaiSanDTO qdkl, Model model)
			throws SQLException {
		keKhaiTaiSanService.insert(qdkl);
		return "kekhaitaisan";
	}
}


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _remove = require('lodash/remove');

var _remove2 = _interopRequireDefault(_remove);

var _find = require('lodash/find');

var _find2 = _interopRequireDefault(_find);

var _isEmpty = require('lodash/isEmpty');

var _isEmpty2 = _interopRequireDefault(_isEmpty);

var _cloneDeep = require('lodash/cloneDeep');

var _cloneDeep2 = _interopRequireDefault(_cloneDeep);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _InfoDialog = require('../InfoDialog');

var _InfoDialog2 = _interopRequireDefault(_InfoDialog);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint eqeqeq: "off" */

var SelectedList = function (_Component) {
  _inherits(SelectedList, _Component);

  function SelectedList() {
    _classCallCheck(this, SelectedList);

    var _this = _possibleConstructorReturn(this, (SelectedList.__proto__ || Object.getPrototypeOf(SelectedList)).call(this));

    _this.state = {
      showRemoveAll: false
    };

    _this.handleRemove = function (id, parentId) {
      var selectedItems = (0, _cloneDeep2.default)(_this.props.selectedItems);
      if (parentId) {
        var parentItem = (0, _find2.default)(selectedItems, function (i) {
          return i.id == parentId;
        });
        (0, _remove2.default)(parentItem.children, function (i) {
          return i.id == id;
        });
        if ((0, _isEmpty2.default)(parentItem.children)) {
          var isInherited = (0, _find2.default)(_this.props.inheritedItems, function (i) {
            return i.id == parentId;
          });
          if (isInherited) {
            (0, _remove2.default)(selectedItems, function (i) {
              return i.id == parentId;
            });
          }
        }
      } else {
        (0, _remove2.default)(selectedItems, function (i) {
          return i.id == id;
        });
      }
      _this.props.onChange(selectedItems);
    };

    _this.handleRemoveAll = function () {
      _this.setState({ showRemoveAll: true });
    };

    _this.handleClose = function () {
      _this.setState({ showRemoveAll: false });
    };

    _this.handleSubmit = function () {
      _this.props.onChange([]);
      _this.handleClose();
    };
    return _this;
  }

  _createClass(SelectedList, [{
    key: 'renderRemoveBtn',
    value: function renderRemoveBtn(id, parentId) {
      return _react2.default.createElement(
        'button',
        {
          type: 'button',
          className: 'close',
          'aria-label': 'Delete',
          onClick: this.handleRemove.bind(this, id, parentId)
        },
        _react2.default.createElement(
          'span',
          { 'aria-hidden': 'true' },
          '\xD7'
        )
      );
    }
  }, {
    key: 'renderSubItems',
    value: function renderSubItems(item, inheritedItem) {
      var _this2 = this;

      return _react2.default.createElement(
        'div',
        { className: 'callout-child' },
        item.children.map(function (subItem) {
          var isInherited = inheritedItem ? (0, _find2.default)(inheritedItem.children, function (i) {
            return i.id == subItem.id;
          }) : false;
          return _react2.default.createElement(
            'div',
            { className: 'callout text-hidden callout-success text-success', key: subItem.id },
            isInherited ? null : _this2.renderRemoveBtn(subItem.id, item.id),
            subItem.name
          );
        })
      );
    }
  }, {
    key: 'renderItem',
    value: function renderItem(item, inheritedItem) {
      var hasChildren = !(0, _isEmpty2.default)(item.children);
      var inheritLabel = _react2.default.createElement(
        'span',
        { className: (0, _classnames2.default)('label pull-right', { 'label-success': !hasChildren, 'label-default': hasChildren }) },
        this.props.inheritText
      );

      return _react2.default.createElement(
        'div',
        { className: (0, _classnames2.default)('callout text-hidden', { 'callout-success text-success': !hasChildren, 'callout-default': hasChildren }), key: item.id },
        inheritedItem ? inheritLabel : this.renderRemoveBtn(item.id),
        item.name,
        hasChildren && !(inheritedItem && (0, _isEmpty2.default)(inheritedItem.children)) && this.renderSubItems(item, inheritedItem)
      );
    }
  }, {
    key: 'renderItems',
    value: function renderItems(allItems, inheritedItems) {
      var _this3 = this;

      return allItems.map(function (item) {
        var inheritedItem = (0, _find2.default)(inheritedItems, { 'id': item.id });
        return _this3.renderItem(item, inheritedItem);
      });
    }
  }, {
    key: 'render',
    value: function render() {
      return _react2.default.createElement(
        'div',
        { className: 'panel panel-default pick-panel col-xs-6' },
        _react2.default.createElement(
          'div',
          { className: 'panel-heading' },
          (0, _isEmpty2.default)(this.props.selectedItems) ? null : _react2.default.createElement(
            'button',
            { type: 'button', className: 'btn btn-default btn-sm pull-right', onClick: this.handleRemoveAll },
            this.props.removeAllLabel
          ),
          _react2.default.createElement(
            'strong',
            null,
            this.props.title
          )
        ),
        _react2.default.createElement(
          'div',
          { className: 'picked-items picked-items__height-' + (this.props.showBreadCrumb ? 'breadcrumb' : 'default') },
          this.renderItems(this.props.inheritedItems, this.props.inheritedItems),
          this.renderItems(this.props.allSelectedItems, [])
        ),
        _react2.default.createElement(_InfoDialog2.default, {
          show: this.state.showRemoveAll,
          title: _react2.default.createElement(
            'span',
            null,
            _react2.default.createElement('i', { className: 'fa fa-exclamation-triangle' }),
            '\xA0',
            this.props.removeAllWarningTitle
          ),
          message: _react2.default.createElement(
            'span',
            { className: 'text-warning' },
            this.props.removeAllWarningMessage
          ),
          dialogClassName: 'modal-warning',
          onHide: this.handleClose,
          onSubmit: this.handleSubmit,
          submitText: this.props.removeAllWaringSubmitText,
          cancelText: this.props.removeAllWaringCancelText,
          submitStyle: 'default'
        }),
        this.state.showRemoveAll ? _react2.default.createElement('div', { className: 'modal-backdrop in' }) : null
      );
    }
  }]);

  return SelectedList;
}(_react.Component);

SelectedList.propTypes = {
  showBreadCrumb: _react.PropTypes.bool,
  title: _react.PropTypes.string.isRequired,
  removeAllLabel: _react.PropTypes.string.isRequired,
  selectedItems: _react.PropTypes.array.isRequired,
  onChange: _react.PropTypes.func.isRequired,
  removeAllWarningTitle: _react.PropTypes.string,
  removeAllWarningMessage: _react.PropTypes.node,
  removeAllWaringSubmitText: _react.PropTypes.string,
  removeAllWaringCancelText: _react.PropTypes.string,
  inheritedItems: _react.PropTypes.array,
  inheritable: _react.PropTypes.bool,
  inheritText: _react.PropTypes.string,
  allSelectedItems: _react.PropTypes.array
};

SelectedList.defaultProps = {
  inheritedItems: [],
  inheritText: 'Placement Group-Level Setting',
  removeAllWarningTitle: 'Warning!',
  removeAllWarningMessage: 'Are you sure you want to remove all selected items?',
  removeAllWaringSubmitText: 'OK'
};

exports.default = SelectedList;
module.exports = exports['default'];


text:
#pragma once
#include <folly/experimental/wangle/concurrent/ThreadFactory.h>
#include <folly/Conv.h>
#include <folly/ThreadName.h>

namespace folly { namespace wangle {

class NamedThreadFactory : public ThreadFactory {
 public:
  explicit NamedThreadFactory(folly::StringPiece prefix)
    : prefix_(prefix), suffix_(0) {}

  std::thread newThread(Func&& func) override {
    auto thread = std::thread(std::move(func));
    folly::setThreadName(
        thread.native_handle(),
        folly::to<std::string>(prefix_, suffix_++));
    return thread;
  }

 private:
  folly::StringPiece prefix_;
  std::atomic<uint64_t> suffix_;
};

}} // folly::wangle


text:
//
//  UIImage+VT.m
//  VTZhangyu
//
//  Created by 张渝 on 13-4-2.
//  Copyright (c) 2013年 VIEWTOOL. All rights reserved.
//

#import "UIImage+VT.h"

#define SAWTOOTH_COUNT 10
#define SAWTOOTH_WIDTH_FACTOR 20

//rgba或者argb
/* alphaInfo :kCGImageAlphaPremultipliedLast /kCGImageAlphaPremultipliedFirst
 *
 */
CGContextRef vtCreateRGBABitmapContext (CGImageRef inImage,CGImageAlphaInfo alphaInfo)
{
    CGContextRef context = NULL;
    CGColorSpaceRef colorSpace;
    void *bitmapData;
    unsigned long bitmapByteCount;
    unsigned long bitmapBytesPerRow;
    size_t pixelsWide = CGImageGetWidth(inImage);
    size_t pixelsHigh = CGImageGetHeight(inImage);
    bitmapBytesPerRow = (pixelsWide * 4);
    bitmapByteCount = (bitmapBytesPerRow * pixelsHigh);
    colorSpace = CGColorSpaceCreateDeviceRGB();
    if (colorSpace == NULL){
        fprintf(stderr, "Error allocating color space");
        return NULL;
    }
    // allocate the bitmap & create context
    bitmapData = malloc( bitmapByteCount );
    if (bitmapData == NULL){
        CGColorSpaceRelease( colorSpace );
        return NULL;
    }
    context = CGBitmapContextCreate (bitmapData,

                                     pixelsWide,

                                     pixelsHigh,

                                     8,

                                     bitmapBytesPerRow,

                                     colorSpace,

                                     kCGBitmapByteOrderDefault | alphaInfo);

    if (context == NULL){
        fprintf (stderr, "Context not created!");
    }
    free (bitmapData);
    CGColorSpaceRelease( colorSpace );
    return context;
}

/**画图并旋转
 *翻转坐标,旋转图片
 *
 */
void vtDrawImageByAngle(CGContextRef context, CGImageRef image , CGRect rect, CGFloat angle)
{
    //保存状态
    CGContextSaveGState(context);
    //移动
    CGContextTranslateCTM(context, rect.origin.x, rect.origin.y);//4

    //旋转并移回到原处
    CGContextTranslateCTM(context, rect.size.width/2, rect.size.height/2);
    CGContextRotateCTM(context, angle);
    CGContextTranslateCTM(context, -rect.size.width/2, -rect.size.height/2);

    //翻转
    CGContextTranslateCTM(context, 0, rect.size.height);//3
    CGContextScaleCTM(context, 1.0, -1.0);//2
    CGContextTranslateCTM(context, -rect.origin.x, -rect.origin.y);//1
    CGContextDrawImage(context, rect, image);//画图

    CGContextRestoreGState(context);//恢复状态
}
//创建一个渐变图
CGImageRef CreateGradientImage(int pixelsWide, int pixelsHigh)
{
	CGImageRef theCGImage = NULL;

	// gradient is always black-white and the mask must be in the gray colorspace
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();

	// create the bitmap context
	CGContextRef gradientBitmapContext = CGBitmapContextCreate(NULL, pixelsWide, pixelsHigh,
															   8, 0, colorSpace, kCGBitmapByteOrderDefault | kCGImageAlphaNone);

	// define the start and end grayscale values (with the alpha, even though
	// our bitmap context doesn't support alpha the gradient requires it)
	CGFloat colors[] = {0.0, 1.0, 1.0, 1.0};

	// create the CGGradient and then release the gray color space
	CGGradientRef grayScaleGradient = CGGradientCreateWithColorComponents(colorSpace, colors, NULL, 2);
	CGColorSpaceRelease(colorSpace);

	// create the start and end points for the gradient vector (straight down)
	CGPoint gradientStartPoint = CGPointZero;
	CGPoint gradientEndPoint = CGPointMake(0, pixelsHigh);

	// draw the gradient into the gray bitmap context
	CGContextDrawLinearGradient(gradientBitmapContext, grayScaleGradient, gradientStartPoint,
								gradientEndPoint, kCGGradientDrawsAfterEndLocation);
	CGGradientRelease(grayScaleGradient);

	// convert the context into a CGImageRef and release the context
	theCGImage = CGBitmapContextCreateImage(gradientBitmapContext);
	CGContextRelease(gradientBitmapContext);

	// return the imageref containing the gradient
    return theCGImage;
}

//创建一个bitmapContext
CGContextRef MyCreateBitmapContext(int pixelsWide, int pixelsHigh)
{
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();

	// create the bitmap context
	CGContextRef bitmapContext = CGBitmapContextCreate (NULL, pixelsWide, pixelsHigh, 8,
														0, colorSpace,
														// this will give us an optimal BGRA format for the device:
														(kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
	CGColorSpaceRelease(colorSpace);

    return bitmapContext;
}

@implementation UIImage (VT)

//convert 2 argb8
- (NSData *)argb8Data
{
    CGContextRef    context = NULL;
    CGColorSpaceRef colorSpace;
    void *          bitmapData;
    unsigned long             bitmapByteCount;
    unsigned long             bitmapBytesPerRow;

    size_t pixelsWide = CGImageGetWidth(self.CGImage);
    size_t pixelsHigh = CGImageGetHeight(self.CGImage);
    bitmapBytesPerRow   = (pixelsWide * 4);
    bitmapByteCount     = (bitmapBytesPerRow * pixelsHigh);

    colorSpace = CGColorSpaceCreateDeviceRGB();
    if (colorSpace == NULL)
        return nil;
    //malloc不初始化,calloc初始化,解决透明图片不正常问题
    bitmapData = calloc(sizeof(char), bitmapByteCount);
    //    bitmapData = malloc(bitmapByteCount);

    if (bitmapData == NULL)
    {
        CGColorSpaceRelease( colorSpace );
        return nil;
    }
    context = CGBitmapContextCreate (bitmapData,
                                     pixelsWide,
                                     pixelsHigh,
                                     8,
                                     bitmapBytesPerRow,
                                     colorSpace,
                                     kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst);
    if (context == NULL)
    {
        free (bitmapData);
        //        fprintf (stderr, "Context not created!");
    }
    CGColorSpaceRelease( colorSpace );
    CGRect rect = CGRectMake(0, 0,pixelsWide,pixelsHigh);
    CGContextDrawImage(context, rect, self.CGImage);
    void *data = CGBitmapContextGetData (context);
    CGContextRelease(context);
    if (!data)
        return nil;
    size_t dataSize = 4 * pixelsWide * pixelsHigh; // ARGB = 4 8-bit components
    NSData * newData = [NSData dataWithBytes:data length:dataSize];
    free(data);
    return newData;
}

//conver from argb8
+ (id)imageWithArgb8Data:(NSData *)aData imageSize:(CGSize)aSize
{
    void * bitmapData = (void *)[aData bytes];
    CGContextRef    context = NULL;
    CGColorSpaceRef colorSpace;
    unsigned long             bitmapByteCount;
    unsigned long             bitmapBytesPerRow;
    size_t pixelsWide = aSize.width;
    size_t pixelsHigh = aSize.height;
    bitmapBytesPerRow   = (pixelsWide * 4);
    bitmapByteCount     = (bitmapBytesPerRow * pixelsHigh);

    colorSpace = CGColorSpaceCreateDeviceRGB();
    if (colorSpace == NULL)
        return nil;

    if (bitmapData == NULL)
    {
        CGColorSpaceRelease( colorSpace );
        return nil;
    }
    context = CGBitmapContextCreate (bitmapData,
                                     pixelsWide,
                                     pixelsHigh,
                                     8,
                                     bitmapBytesPerRow,
                                     colorSpace,
                                     kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst);
    if (context == NULL)
    {
        free (bitmapData);
    }
    CGColorSpaceRelease( colorSpace );
    CGImageRef newnew = CGBitmapContextCreateImage(context);
    CGContextRelease(context);
    UIImage * newImg = [UIImage imageWithCGImage:newnew];
    CGImageRelease(newnew);
    return newImg;
}

- (UIImage*)imageByScalingAndCroppingForSize:(CGSize)targetSize
{
    UIImage *sourceImage = self;
    UIImage *newImage = nil;
    CGSize imageSize = sourceImage.size;
    CGFloat width = imageSize.width;
    CGFloat height = imageSize.height;
    CGFloat targetWidth = targetSize.width;
    CGFloat targetHeight = targetSize.height;
    CGFloat scaleFactor = 0.0;
    CGFloat scaledWidth = targetWidth;
    CGFloat scaledHeight = targetHeight;
    CGPoint thumbnailPoint = CGPointMake(0.0,0.0);

    if (CGSizeEqualToSize(imageSize, targetSize) == NO)
    {
        CGFloat widthFactor = targetWidth / width;
        CGFloat heightFactor = targetHeight / height;

        if (widthFactor > heightFactor)
            scaleFactor = widthFactor; // scale to fit height
        else
            scaleFactor = heightFactor; // scale to fit width
        scaledWidth  = width * scaleFactor;
        scaledHeight = height * scaleFactor;

        // center the image
        if (widthFactor > heightFactor)
        {
            thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5;
        }
        else
            if (widthFactor < heightFactor)
            {
                thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5;
            }
    }

    UIGraphicsBeginImageContext(targetSize); // this will crop

    CGRect thumbnailRect = CGRectZero;
    thumbnailRect.origin = thumbnailPoint;
    thumbnailRect.size.width  = scaledWidth;
    thumbnailRect.size.height = scaledHeight;

    [sourceImage drawInRect:thumbnailRect];

    newImage = UIGraphicsGetImageFromCurrentImageContext();
    if(newImage == nil)
        NSLog(@"could not scale image");

    //pop the context to get back to the default
    UIGraphicsEndImageContext();
    return newImage;
}

- (UIImage*)imageRotatedByDegrees:(CGFloat)degrees
{
	CGSize rotatedSize = self.size;
	if (NO) {
		rotatedSize.width *= 2;
		rotatedSize.height *= 2;
	}
	UIGraphicsBeginImageContext(rotatedSize);
	CGContextRef bitmap = UIGraphicsGetCurrentContext();
	CGContextTranslateCTM(bitmap, rotatedSize.width/2, rotatedSize.height/2);
	CGContextRotateCTM(bitmap, degrees * M_PI / 180);
	CGContextRotateCTM(bitmap, M_PI);
	CGContextScaleCTM(bitmap, -1.0, 1.0);
	CGContextDrawImage(bitmap, CGRectMake(-rotatedSize.width/2, -rotatedSize.height/2, rotatedSize.width, rotatedSize.height), self.CGImage);
	UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
	UIGraphicsEndImageContext();
	return newImage;
}

+ (UIImage*)imageWith32RGB:(unsigned char *)imgPixel width:(NSInteger)aWidth height:(NSInteger)aHeight
{
#if 0   //rgb 565转555
    for( int y = 0; y < pBmp->usHeight; y++ )
    {
        for( int x = 0; x < pBmp->usWidth; x++ )
        {
            usTmp = pSrc[x];
            usTmp = ((usTmp&0xFFC0)>>1)|(usTmp&0x1F); // 565 to 555
            pDec[x] = usTmp;
        }
        pSrc += pBmp->usWidth;
        pDec += pBmp->usWidth;
    }
#endif
    size_t dataLength = aWidth * aHeight * 4;
    CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, imgPixel, dataLength, NULL);
    // prep the ingredients
    size_t bitsPerComponent = 8;
    size_t bitsPerPixel = 32;
    size_t bytesPerRow = 4 * aWidth;
    CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();
    CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;
    CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault;
    // make the cgimage
    CGImageRef imageRef = CGImageCreate((size_t)aWidth, (size_t)aHeight,
                                        bitsPerComponent,
                                        bitsPerPixel,
                                        bytesPerRow,
                                        colorSpaceRef,
                                        bitmapInfo,
                                        provider,
                                        NULL, NO, renderingIntent);

    UIImage *my_Image = [UIImage imageWithCGImage:imageRef];
    CFRelease(imageRef);
    CGColorSpaceRelease(colorSpaceRef);
    CGDataProviderRelease(provider);
    return my_Image;
}

- (unsigned char *)convertImagePixelData
{
    CGImageRef img = [self CGImage];
    CGSize size = [self size];
    CGContextRef cgctx = vtCreateRGBABitmapContext(img,kCGImageAlphaPremultipliedLast);
    if (cgctx == NULL)
        return NULL;
    CGRect rect = {{0,0},{size.width, size.height}};
    CGContextDrawImage(cgctx, rect, img);
    unsigned char *data = (unsigned char *)CGBitmapContextGetData (cgctx);
    CGContextRelease(cgctx);
    return data;
}

- (UIImage *)transformWidth:(CGFloat)width height:(CGFloat)height
{
    CGFloat destW = width;
    CGFloat destH = height;
    CGFloat sourceW = width;
    CGFloat sourceH = height;

    CGImageRef imageRef = self.CGImage;
    CGContextRef bitmap = CGBitmapContextCreate(NULL, destW, destH,
                                                CGImageGetBitsPerComponent(imageRef),
                                                4 * destW, CGImageGetColorSpace(imageRef),
                                                (kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));

    CGContextDrawImage(bitmap, CGRectMake(0, 0, sourceW, sourceH), imageRef);

    CGImageRef ref = CGBitmapContextCreateImage(bitmap);
    UIImage *result = [UIImage imageWithCGImage:ref];
    CGContextRelease(bitmap);
    CGImageRelease(ref);

    return result;
}

- (NSArray *)splitImageIntoTwoParts
{
    CGFloat scale = [[UIScreen mainScreen] scale];
    NSMutableArray *array = [NSMutableArray arrayWithCapacity:2];
    CGFloat width,height,widthgap,heightgap;
    int piceCount = SAWTOOTH_COUNT;
    width = self.size.width;
    height = self.size.height;
    widthgap = width / SAWTOOTH_WIDTH_FACTOR;
    heightgap = height / piceCount;
    //    CGRect rect = CGRectMake(0, 0, width, height);
    CGContextRef context;
    CGImageRef imageMasked;
    UIImage *leftImage,*rightImage;

    //part one
    UIGraphicsBeginImageContext(CGSizeMake(width*scale, height*scale));
    context = UIGraphicsGetCurrentContext();
    CGContextScaleCTM(context, scale, scale);
    CGContextMoveToPoint(context, 0, 0);
    int a=-1;
    for (int i=0; i<piceCount+1; i++) {
        CGContextAddLineToPoint(context, width/2+(widthgap*a), heightgap*i);
        a= a*-1;
    }
    CGContextAddLineToPoint(context, 0, height);
    CGContextClosePath(context);
    CGContextClip(context);
    [self drawAtPoint:CGPointMake(0, 0)];
    imageMasked = CGBitmapContextCreateImage(context);
    leftImage = [UIImage imageWithCGImage:imageMasked scale:scale orientation:UIImageOrientationUp];
    [array addObject:leftImage];
    UIGraphicsEndImageContext();

    //part two
    UIGraphicsBeginImageContext(CGSizeMake(width*scale, height*scale));
    context = UIGraphicsGetCurrentContext();
    CGContextScaleCTM(context, scale, scale);
    CGContextMoveToPoint(context, width, 0);
    a=-1;
    for (int i=0; i<piceCount+1; i++) {
        CGContextAddLineToPoint(context, width/2+(widthgap*a), heightgap*i);
        a= a*-1;
    }
    CGContextAddLineToPoint(context, width, height);
    CGContextClosePath(context);
    CGContextClip(context);
    [self drawAtPoint:CGPointMake(0, 0)];
    imageMasked = CGBitmapContextCreateImage(context);
    rightImage = [UIImage imageWithCGImage:imageMasked scale:scale orientation:UIImageOrientationUp];
    [array addObject:rightImage];
    UIGraphicsEndImageContext();
    return array;
}

- (UIImage *)reflectedFromBound:(CGRect)fromBounds withHeight:(NSUInteger)height
{
    if(height == 0)
		return nil;

	// create a bitmap graphics context the size of the image
	CGContextRef mainViewContentContext = MyCreateBitmapContext(fromBounds.size.width, (int)height);

	// create a 2 bit CGImage containing a gradient that will be used for masking the
	// main view content to create the 'fade' of the reflection.  The CGImageCreateWithMask
	// function will stretch the bitmap image as required, so we can create a 1 pixel wide gradient
	CGImageRef gradientMaskImage = CreateGradientImage(1, (int)height);

	// create an image by masking the bitmap of the mainView content with the gradient view
	// then release the  pre-masked content bitmap and the gradient bitmap
	CGContextClipToMask(mainViewContentContext, CGRectMake(0.0, 0.0, fromBounds.size.width, height), gradientMaskImage);
	CGImageRelease(gradientMaskImage);

	// In order to grab the part of the image that we want to render, we move the context origin to the
	// height of the image that we want to capture, then we flip the context so that the image draws upside down.
	CGContextTranslateCTM(mainViewContentContext, 0.0, height);
	CGContextScaleCTM(mainViewContentContext, 1.0, -1.0);

	// draw the image into the bitmap context
	CGContextDrawImage(mainViewContentContext, fromBounds, self.CGImage);

	// create CGImageRef of the main view bitmap content, and then release that bitmap context
	CGImageRef reflectionImage = CGBitmapContextCreateImage(mainViewContentContext);
	CGContextRelease(mainViewContentContext);

	// convert the finished reflection image to a UIImage
	UIImage *theImage = [UIImage imageWithCGImage:reflectionImage];

	// image is retained by the property setting above, so we can release the original
	CGImageRelease(reflectionImage);

	return theImage;
}
@end


text:
cask 'outguess' do
  version :latest
  sha256 :no_check

  url 'http://www.rbcafe.com/download/outguess.zip'
  name 'Outguess'
  homepage 'http://www.rbcafe.com/software/outguess/'

  depends_on macos: '>= :mountain_lion'

  app 'Outguess.app'
end


text:
void Usage(char* s)
{
    fprintf(stderr, "Usage: %s [-d debug_level]\n", s);
}

int main(int argc, char **argv) {
    juniper::TestEnv te(argc, argv, TEST_PATH("./testclient.rc").c_str());
    AuxTest pta;
    pta.SetStream(&std::cout);
    pta.Run(argc, argv);
    return pta.Report();
}


text:
using System;
using System.Data.SqlTypes;

namespace ReMi.Common.Utils
{
    public static class DateTimeExtensions
    {
        public static DateTime? ToMssqlRangeDateTime(this DateTime? datetime)
        {
            if (!datetime.HasValue)
                return null;

            if (datetime.Value < SqlDateTime.MinValue.Value || datetime.Value > SqlDateTime.MaxValue.Value)
                return null;

            return datetime.Value;
        }

        public static DateTime ToMssqlRangeDateTime(this DateTime datetime, DateTime defaultValue)
        {
            var fixedDate = ToMssqlRangeDateTime(datetime);

            if (!fixedDate.HasValue)
                return defaultValue;

            return fixedDate.Value;
        }
    }
}


text:
package nxt.http;

import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
import org.junit.Assert;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class APICall {

    private Map<String, String> params = new HashMap<>();

    private APICall(Builder builder) {
        this.params = builder.params;
    }

    public static class Builder {

        protected Map<String, String> params = new HashMap<>();

        public Builder(String requestType) {
            params.put("requestType", requestType);
            params.put("deadline", "1440");
        }

        public Builder param(String key, String value) {
            params.put(key, value);
            return this;
        }

        public Builder param(String key, byte value) {
            params.put(key, "" + value);
            return this;
        }

        public Builder param(String key, int value) {
            params.put(key, "" + value);
            return this;
        }

        public Builder param(String key, long value) {
            params.put(key, "" + value);
            return this;
        }

        public Builder secretPhrase(String value) {
            params.put("secretPhrase", value);
            return this;
        }

        public Builder feeNQT(long value) {
            params.put("feeNQT", "" + value);
            return this;
        }

        public APICall build() {
            return new APICall(this);
        }
    }

    public JSONObject invoke() {
        HttpServletRequest req = mock(HttpServletRequest.class);
        HttpServletResponse resp = mock(HttpServletResponse.class);
        when(req.getRemoteHost()).thenReturn("localhost");
        when(req.getMethod()).thenReturn("POST");
        for (String key : params.keySet()) {
            when(req.getParameter(key)).thenReturn(params.get(key));
        }
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        PrintWriter writer = new PrintWriter(new OutputStreamWriter(out));
        try {
            when(resp.getWriter()).thenReturn(writer);
            APIServlet apiServlet = new APIServlet();
            apiServlet.doPost(req, resp);
        } catch (ServletException | IOException e) {
            Assert.fail();
        }
        return (JSONObject)JSONValue.parse(new InputStreamReader(new ByteArrayInputStream(out.toByteArray())));
    }

}


text:
namespace url_formatter {

namespace common_words {

namespace {

#include "components/url_formatter/spoof_checks/common_words/common_words-inc.cc"

struct DafsaParams {
  const unsigned char* dafsa;
  size_t length;
};

DafsaParams g_dafsa_params{kDafsa, sizeof(kDafsa)};

}  // namespace

bool IsCommonWord(base::StringPiece word) {
  return net::LookupStringInFixedSet(g_dafsa_params.dafsa,
                                     g_dafsa_params.length, word.data(),
                                     word.size()) != net::kDafsaNotFound;
}

void SetCommonWordDAFSAForTesting(const unsigned char* dafsa, size_t length) {
  g_dafsa_params = {dafsa, length};
}

void ResetCommonWordDAFSAForTesting() {
  g_dafsa_params = {kDafsa, sizeof(kDafsa)};
}

}  // namespace common_words

}  // namespace url_formatter


text:
Sign In

Forgot password?

                        <form class="form-horizontal" role="form" (ngSubmit)="f.form.valid && login()" #f="ngForm" novalidate>

                                Username

                                <input type="text" class="form-control" name="username" [(ngModel)]="formData.username" #username="ngModel" placeholder="Enter Username"
                                    required />

Username is required

                                Password

                                <input type="password" class="form-control" name="password" [(ngModel)]="formData.password" #password="ngModel" placeholder="Password"
                                    required />

Password is required

                                <button [disabled]="loading" type="submit" class="btn btn-primary">Login</button>

Don't have an account Sign Up Here

                        </form>


text:
/*
 * videobox.js
 * vodeo texture and shader
 *
 * @author Mitsunori Inaba <m-inaba@phoenixdesign.jp>
 */

import * as PXUtil from '../../libs/tunajp/util.js';
import * as PXShaderLoader from "../../libs/tunajp/shaderloader.js";

/**
 * Videobox class
 */
export class Videobox
{
  /**
   * constructor
   *
   * @param {function} callback_function
   */
  constructor(callback_function)
  {
    PXUtil.Util.trace_func('videobox::constructor');

    this.video = document.createElement('video');
    this.video.loop = true;
    this.video.src = _ASSETS_PATH_ + "small.ogv";
    this.video.load();
    this.video.play();

    this.videoImage = document.createElement('canvas');
    this.videoImage.width = 480;
    this.videoImage.height= 204;

    this.videoImageContext = this.videoImage.getContext('2d');
    this.videoImageContext.fillStyle = "#000000";
    this.videoImageContext.fillRect(0, 0, this.videoImage.width, this.videoImage.height);

    this.videoTexture =new THREE.Texture(this.videoImage);
    this.videoTexture.minFilter = THREE.LinearFilter;
  	this.videoTexture.magFilter = THREE.LinearFilter;

    let vshader = new PXShaderLoader.ShaderLoader();
    let fshader = new PXShaderLoader.ShaderLoader();
    vshader.getXHR2('js/app/assets/shader/vertex.fx', (vshader) => {
      console.log('vshader comp!');
      fshader.getXHR2('js/app/assets/shader/mosaic_fragment.fx', (fshader) => {
        console.log('fshader comp!');

        this.customUniforms ={
          baseTexture: { type: "t", value:this.videoTexture},
          time: { type: "f", value: 1.0 },
          vScreenSize: { type: "v2", value:new THREE.Vector2(480.0, 320.0)},
          fMosaicScale: { type: "f", value:10.0}
        };
        var customMaterial = new THREE.ShaderMaterial({
          uniforms: this.customUniforms,
          vertexShader: vshader,
          fragmentShader: fshader,
        });

        //let movieMaterial = new THREE.MeshBasicMaterial(
        //  {map: this.videoTexture, overdraw: true, side:THREE.DoubleSide}
        //  );

        this.mesh = new THREE.Mesh(
          new THREE.BoxGeometry(100, 100, 100),
          //movieMaterial
          customMaterial
          );

        callback_function(this.mesh);
      });
    });

  }

  /**
   * rendering method
   */
  rendering(delta)
  {
    if (this.mesh == null) {
      return;
    }
    this.mesh.rotation.y += delta;

    if (this.video.readyState === this.video.HAVE_ENOUGH_DATA) {
  		this.videoImageContext.drawImage(this.video, 0, 0);
  		if (this.videoTexture) {
  			this.videoTexture.needsUpdate = true;
      }
  	}
  }
}