type
stringclasses
5 values
content
stringlengths
9
163k
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <stdint.h>
includes
#include <string.h>
defines
#define ICC_HEADER_LEN 128
defines
#define TAG_COUNT_OFF ICC_HEADER_LEN
defines
#define ICC_HEADER_LEN 128
defines
#define TAG_COUNT_OFF ICC_HEADER_LEN
functions
int load_u8 (const char *icc, int length, int offset) { /* all reading functions take both the char *pointer and the length of the * buffer, and all reads thus gets protected by this condition. */ if (offset < 0 || offset > length) return 0; return *(uint8_t*) (&icc[offse...
functions
int load_s8 (const char *icc, int length, int offset) { if (offset < 0 || offset > length) return 0; return *(int8_t*) (&icc[offset]); }
functions
int16_t load_u1f15 (const char *icc, int length, int offset) { return load_u8 (icc, length, offset + 1) + (load_s8 (icc, length, offset + 0) << 8); }
functions
uint16_t load_u16 (const char *icc, int length, int offset) { return load_u8 (icc, length, offset + 1) + (load_u8 (icc, length, offset + 0) << 8); }
functions
u8f8_t load_u8f8_ (const char *icc, int length, int offset) { u8f8_t ret ={load_u8 (icc, length, offset), load_u8 (icc, length, offset + 1)}
functions
s15f16_t load_s15f16_ (const char *icc, int length, int offset) { s15f16_t ret ={load_u1f15 (icc, length, offset), load_u16 (icc, length, offset + 2)}
functions
double s15f16_to_d (s15f16_t fix) { return fix.integer + fix.fraction / 65535.0; }
functions
double u8f8_to_d (u8f8_t fix) { return fix.integer + fix.fraction / 255.0; }
functions
double load_s15f16 (const char *icc, int length, int offset) { return s15f16_to_d (load_s15f16_ (icc, length, offset)); }
functions
double load_u8f8 (const char *icc, int length, int offset) { return u8f8_to_d (load_u8f8_ (icc, length, offset)); }
functions
void print_u8f8 (u8f8_t fix) { int i; uint32_t foo; foo = fix.fraction; fprintf (stdout, "%i.", fix.integer); for (i = 0; i < 18; i++) { foo *= 10; fprintf (stdout, "%i", (foo / 256) % 10); foo = foo & 0xff; }
functions
void print_s15f16 (s15f16_t fix) { int i; uint32_t foo; foo = fix.fraction; if (fix.integer < 0) { if (fix.integer == -1) fprintf (stdout, "-"); fprintf (stdout, "%i.", fix.integer + 1); foo = 65535-fix.fraction; for (i = 0; i < 18; i++) { foo *= 10; fprintf (stdout, "%i...
functions
uint32_t load_u32 (const char *icc, int length, int offset) { return load_u8 (icc, length, offset + 3) + (load_u8 (icc, length, offset + 2) << 8) + (load_u8 (icc, length, offset + 1) << 16) + (load_u8 (icc, length, offset + 0) << 24); }
functions
void load_sign (const char *icc, int length, int offset, char *sign) { sign[0]=load_u8(icc, length, offset); sign[1]=load_u8(icc, length, offset + 1); sign[2]=load_u8(icc, length, offset + 2); sign[3]=load_u8(icc, length, offset + 3); sign[4]=0; }
functions
int icc_tag (const char *icc, int length, const char *tag, int *offset, int *el_length) { int tag_count = load_u32 (icc, length, TAG_COUNT_OFF); int t; for (t = 0; t < tag_count; t++) { char tag_signature[5]; load_sign (icc, length, TAG_C...
functions
int load_u8 (const char *icc, int offset) { return *(uint8_t*) (&icc[offset]); }
functions
int16_t load_u1Fixed15 (const char *icc, int offset) { return load_u8 (icc, offset + 1) + (load_u8 (icc, offset + 0) << 8); }
functions
uint16_t load_u16 (const char *icc, int offset) { return load_u8 (icc, offset + 1) + (load_u8 (icc, offset + 0) << 8); }
functions
double load_s15f16 (const char *icc, int offset) { return load_u1Fixed15 (icc, offset) + load_u16 (icc, offset + 2) / 65535.0f; }
functions
double load_u16f16 (const char *icc, int offset) { return load_u16 (icc, offset) + load_u16 (icc, offset + 2) / 65535.0; }
functions
uint32_t load_u32 (const char *icc, int offset) { return load_u8 (icc, offset + 3) + (load_u8 (icc, offset + 2) << 8) + (load_u8 (icc, offset + 1) << 16) + (load_u8 (icc, offset + 0) << 24); }
functions
float load_float32 (const char *icc, int offset) { char buf[4]={load_u8 (icc, offset + 3), load_u8 (icc, offset + 2), load_u8 (icc, offset + 1), load_u8 (icc, offset + 0)}
functions
uint64_t load_uint64 (const char *icc, int offset) { return ((uint64_t)load_u8 (icc, offset + 7) << (8*0)) + ((uint64_t)load_u8 (icc, offset + 6) << (8*1)) + ((uint64_t)load_u8 (icc, offset + 5) << (8*2)) + ((uint64_t)load_u8 (icc, offset + 4) << (8*3)) + ((uint64_t)load_u8 (icc, o...
functions
void load_sign (const char *icc, int offset, char *sign) { sign[0]=load_u8(icc, offset); sign[1]=load_u8(icc, offset + 1); sign[2]=load_u8(icc, offset + 2); sign[3]=load_u8(icc, offset + 3); sign[4]=0; }
functions
int icc_tag (const char *icc, const char *tag, int *offset, int *length) { int tag_count = load_u32 (icc, TAG_COUNT_OFF); int profile_size = load_u32 (icc, 0); int t; for (t = 0; t < tag_count; t++) { char tag_signature[5]; load_sign (icc, TAG_COUNT_OFF + 4 + 12 * t, tag_signature); if (!strc...
functions
int load_icc_from_memory (const char *icc, long length, char **error) { int tag_count = load_u32 (icc, length, TAG_COUNT_OFF); int profile_size = load_u32 (icc, length, 0); int profile_version_major = load_u8 (icc, length, 8); int pr...
functions
0 if (profile_version_major > 2) { *error = "only ICC v2 profiles supported"; return -1; }
functions
else if (count == 1) { fprintf (stdout, "gamma TRC of: %.6f\n", load_u8f8 (icc,length, offset + 12)); if (exact) { fprintf (stdout, " exact: "); print_u8f8 (load_u8f8_ (icc,length, offset + 12)); fprintf (stdout, "\n"); }
functions
else for (i = 0; i < count && i < 10; i ++) { fprintf (stdout, "%i=%i ", i, load_u16 (icc, length, offset + 12 + i * 2)); if (i % 7 == 0) fprintf (stdout, "\n"); }
functions
int load_icc (const char *path, char **error) { char *icc = NULL; long length = 0; int ret = 0; file_get_contents (path, &icc, &length, NULL); if (icc) { ret = load_icc_from_memory (icc, length, error); free (icc); }
functions
int file_get_contents (const char *path, char **contents, long *length, void *error) { FILE *file; long size; char *buffer; file = fopen (path,"rb"); if (!file) return -1; fseek (file, 0, SEEK_END); *length = size = ftel...
main
int main (int argc, char **argv) { int i = 1; if (argc < 2) { fprintf (stdout, "usage: babl-icc-dump [options] <file1.icc [file2.icc ...]>\n"); return -1; }
includes
#include <r_print.h>
functions
0 for(i=0; i<len; i++) { packing_7bit_character(config.block+i, buffer); cons_printf("%c", buffer[0]); }
functions
int r_print_pack7bit (const char *src, char *dest) { int len, i, j = 0, shift = 0; ut8 ch1, ch2; char tmp[2]; *dest = '\0'; len = strlen (src); for (i=0; i<len; i++ ) { ch1 = src[i] & 0x7F; ch1 = ch1 >> shift; ch2 = src[(i+1)] & ...
functions
int r_print_unpack7bit (const char *src, char *dest) { int i, j, shift = 0, len = strlen (src); ut8 ch1, ch2 = '\0'; char buf[8]; *dest = '\0'; for (i=0; i<len; i+=2) { sprintf (buf, "%c%c", src[i], src[i+1]); ch1 = strtol (buf, NULL, 16); ...
functions
RogueInteger RogueIntrinsicFn_default( RogueIntrinsicFnType fn_type, RogueObject* context, void* parameter ) { switch (fn_type) { case ROGUE_INTRINSIC_FN_TRACE: if (context && context->allocation.size >= 0) { context->allocation.size ^= -1; }
functions
void RogueType_trace( RogueType* THIS ) { if (THIS && THIS->allocation.size >= 0) { THIS->allocation.size ^= -1; RogueVMList_trace( THIS->methods ); if (THIS->origin) RogueCmd_trace( THIS->origin ); }
functions
void Cy_Crypto_SetReg1Instr(CRYPTO_Type *base, uint32_t data0) { /* Check whether FIFO has enough space for 1 instruction */ while(Cy_Crypto_Core_GetFIFOUsed(base) >= (CY_CRYPTO_INSTR_FIFODEPTH - 1u)) { }
functions
void Cy_Crypto_SetReg2Instr(CRYPTO_Type *base, uint32_t data0, uint32_t data1) { /* Check whether FIFO has enough space for 2 instructions */ while(Cy_Crypto_Core_GetFIFOUsed(base) >= (CY_CRYPTO_INSTR_FIFODEPTH - 2u)) { }
functions
void Cy_Crypto_SetReg3Instr(CRYPTO_Type *base, uint32_t data0, uint32_t data1, uint32_t data2) { /* Check whether FIFO has enough space for 3 instructions */ while(Cy_Crypto_Core_GetFIFOUsed(base) >= (CY_CRYPTO_INSTR_FIFODEPTH - 3u)) { }
functions
void Cy_Crypto_SetReg4Instr(CRYPTO_Type *base, uint32_t data0, uint32_t data1, uint32_t data2, uint32_t data3) { /* Check whether FIFO has enough space for 4 instructions */ while(Cy_Crypto_Core_GetFIFOUsed(base) >= (CY_CRYPTO_INSTR_FIFODEPTH - 4u)) { }
functions
void Cy_Crypto_Run0ParamInstr(CRYPTO_Type *base, uint8_t instr) { /* Check whether FIFO has enough space for 1 instruction */ while(Cy_Crypto_Core_GetFIFOUsed(base) >= CY_CRYPTO_INSTR_FIFODEPTH) { }
functions
void Cy_Crypto_Run1ParamInstr(CRYPTO_Type *base, uint8_t instr, uint32_t rdst0Shift) { /* Check whether FIFO has enough space for 1 instruction */ while(Cy_Crypto_Core_GetFIFOUsed(base) >= CY_CRYPTO_INSTR_FIFODEPTH) { }
functions
void Cy_Crypto_Run2ParamInstr(CRYPTO_Type *base, uint8_t instr, uint32_t rdst0Shift, uint32_t rdst1Shift) { /* Check whether FIFO has enough space for 1 instruction */ while(Cy_Crypto_Core_GetFIFOUsed(base) >= CY_CRYPTO_INSTR_FIFOD...
functions
void Cy_Crypto_Run3ParamInstr(CRYPTO_Type *base, uint8_t instr, uint8_t rdst0Shift, uint8_t rdst1Shift, uint8_t rdst2Shift) { /* Check whether FIFO has enough space for 1 instruction */ while(Cy_Crypto_Co...
functions
void Cy_Crypto_Run4ParamInstr(CRYPTO_Type *base, uint8_t instr, uint32_t rdst0Shift, uint32_t rdst1Shift, uint32_t rdst2Shift, uint32_t rdst3Shift) { /* Check whether FIFO has enoug...
functions
status_code system_peripheral_lock( const uint32_t peripheral_id, const uint32_t key) { /* Bit to be set in desired register is given by bit 5:0 */ uint8_t register_bit_pos = peripheral_id % 32; UNUSED(register_bit_pos); /* Value of which PAC register to use is given by bit 31:6 */ uint8_t register_pos = peri...
functions
status_code system_peripheral_unlock( const uint32_t peripheral_id, const uint32_t key) { /* Bit to be set in desired register is given by bit 5:0 */ uint8_t register_bit_pos = peripheral_id % 32; UNUSED(register_bit_pos); /* Value of which PAC register to use is given by bit 31:6 */ uint8_t register_pos = pe...
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <string.h>
includes
#include <openssl/objects.h>
includes
#include <openssl/err.h>
structs
struct zlib_state { z_stream istream; z_stream ostream; };
functions
void zlib_zfree(void *opaque, void *address) { OPENSSL_free(address); }
functions
int zlib_stateful_init(COMP_CTX *ctx) { int err; struct zlib_state *state = OPENSSL_zalloc(sizeof(*state)); if (state == NULL) goto err; state->istream.zalloc = zlib_zalloc; state->istream.zfree = zlib_zfree; state->istream.opaque = Z_NULL; state->istream.next_in = Z_NULL; stat...
functions
void zlib_stateful_finish(COMP_CTX *ctx) { struct zlib_state *state = ctx->data; inflateEnd(&state->istream); deflateEnd(&state->ostream); OPENSSL_free(state); }
functions
int zlib_stateful_compress_block(COMP_CTX *ctx, unsigned char *out, unsigned int olen, unsigned char *in, unsigned int ilen) { int err = Z_OK; struct zlib_state *state = ctx->data; if (state == NULL) return -1; sta...
functions
int zlib_stateful_expand_block(COMP_CTX *ctx, unsigned char *out, unsigned int olen, unsigned char *in, unsigned int ilen) { int err = Z_OK; struct zlib_state *state = ctx->data; if (state == NULL) return 0; state->ist...
functions
void ossl_comp_zlib_cleanup(void) { #ifdef ZLIB_SHARED DSO_free(zlib_dso); zlib_dso = NULL; #endif }
functions
int bio_zlib_new(BIO *bi) { BIO_ZLIB_CTX *ctx; # ifdef ZLIB_SHARED if (!RUN_ONCE(&zlib_once, ossl_comp_zlib_init)) { ERR_raise(ERR_LIB_COMP, COMP_R_ZLIB_NOT_SUPPORTED); return 0; }
functions
int bio_zlib_free(BIO *bi) { BIO_ZLIB_CTX *ctx; if (!bi) return 0; ctx = BIO_get_data(bi); if (ctx->ibuf) { /* Destroy decompress context */ inflateEnd(&ctx->zin); OPENSSL_free(ctx->ibuf); }
functions
int bio_zlib_read(BIO *b, char *out, int outl) { BIO_ZLIB_CTX *ctx; int ret; z_stream *zin; BIO *next = BIO_next(b); if (!out || !outl) return 0; ctx = BIO_get_data(b); zin = &ctx->zin; BIO_clear_retry_flags(b); if (!ctx->ibuf) { ctx->ibuf = OPENSSL_malloc(ctx->ibufs...
functions
int bio_zlib_write(BIO *b, const char *in, int inl) { BIO_ZLIB_CTX *ctx; int ret; z_stream *zout; BIO *next = BIO_next(b); if (!in || !inl) return 0; ctx = BIO_get_data(b); if (ctx->odone) return 0; zout = &ctx->zout; BIO_clear_retry_flags(b); if (!ctx->obuf) { ...
functions
int bio_zlib_flush(BIO *b) { BIO_ZLIB_CTX *ctx; int ret; z_stream *zout; BIO *next = BIO_next(b); ctx = BIO_get_data(b); /* If no data written or already flush show success */ if (!ctx->obuf || (ctx->odone && !ctx->ocount)) return 1; zout = &ctx->zout; BIO_clear_retry_flags(...
functions
else if (ret != Z_OK) { ERR_raise_data(ERR_LIB_COMP, COMP_R_ZLIB_DEFLATE_ERROR, "zlib error: %s", zError(ret)); return 0; }
functions
long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr) { BIO_ZLIB_CTX *ctx; int ret, *ip; int ibs, obs; BIO *next = BIO_next(b); if (next == NULL) return 0; ctx = BIO_get_data(b); switch (cmd) { case BIO_CTRL_RESET: ctx->ocount = 0; ctx->odone = 0; ret...
functions
long bio_zlib_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) { BIO *next = BIO_next(b); if (next == NULL) return 0; return BIO_callback_ctrl(next, cmd, fp); }
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <ida/ida_dense.h>
includes
#include <sundials/sundials_math.h>
defines
#define ZERO RCONST(0.0)
defines
#define ONE RCONST(1.0)
defines
#define TWO RCONST(2.0)
defines
#define res (IDA_mem->ida_res)
defines
#define tn (IDA_mem->ida_tn)
defines
#define hh (IDA_mem->ida_hh)
defines
#define cj (IDA_mem->ida_cj)
defines
#define cjratio (IDA_mem->ida_cjratio)
defines
#define ewt (IDA_mem->ida_ewt)
defines
#define constraints (IDA_mem->ida_constraints)
defines
#define linit (IDA_mem->ida_linit)
defines
#define lsetup (IDA_mem->ida_lsetup)
defines
#define lsolve (IDA_mem->ida_lsolve)
defines
#define lperf (IDA_mem->ida_lperf)
defines
#define lfree (IDA_mem->ida_lfree)
defines
#define lmem (IDA_mem->ida_lmem)
defines
#define setupNonNull (IDA_mem->ida_setupNonNull)
defines
#define vec_tmpl (IDA_mem->ida_tempv1)
defines
#define mtype (idadls_mem->d_type)