blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
357
content_id
stringlengths
40
40
detected_licenses
listlengths
0
58
license_type
stringclasses
2 values
repo_name
stringlengths
4
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-14 21:31:45
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-01 00:00:00
2023-09-05 23:26:37
committer_date
timestamp[ns]date
1970-01-01 00:00:00
2023-09-05 23:26:37
github_id
int64
966
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
24 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-02-03 21:17:16
2023-08-24 19:49:39
gha_language
stringclasses
180 values
src_encoding
stringclasses
35 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
6
10.4M
extension
stringclasses
121 values
filename
stringlengths
1
148
content
stringlengths
6
10.4M
5e93ec4a021fc00a8f687043b80cc31480f744f3
328d2b96ad70e360f49c49e7e8399d0c1ad5d96c
/src/components/SensorC.h
e8ade23e1383329e525b83ea6972b7013f949568
[]
no_license
vasylbo/ecs_lemmings
b60096927e4673d2b6852ee7c383aaabc66592fb
15b81f86bf911f466d24f44b550fbd0e2c17196a
refs/heads/master
2021-01-19T03:02:02.391392
2017-04-01T21:51:20
2017-04-01T21:51:20
51,010,782
2
2
null
2017-04-01T21:21:11
2016-02-03T15:55:26
C++
UTF-8
C
false
false
394
h
SensorC.h
// // Created by Vasyl. // #ifndef LEMMINGS_MOVESENSORC_H #define LEMMINGS_MOVESENSORC_H #include "entityx/Entity.h" struct SensorC : entityx::Component<SensorC> { SensorC() {}; SensorC(int pSight, int pVerticalStep): sight(pSight), verticalStep(pVerticalStep) {}; int sight; int verticalStep; bool leftS; bool rightS; }; #endif //LEMMINGS_MOVESENSORC_H
a92596ff40f0ef4f940f45ba37cdcd91793c38b5
ac75558b13b1eb5a220ea7b84739c87ad50f6da5
/OthersAll/con2.c
00a55b0316a2de189df894fe52f63368f28e057e
[]
no_license
Anik-Modak/CompetitiveProgramming
670a53f323292b16484ca28f340e123e8da8fcff
3fa0b9712f6bb4879d53a066fa16274e480b31a4
refs/heads/master
2022-03-22T06:21:30.654964
2019-12-10T12:58:35
2019-12-10T12:58:35
184,308,402
1
0
null
null
null
null
UTF-8
C
false
false
189
c
con2.c
#include<stdio.h> int main() { int n,a,b,i,s,c=0; scanf("%d",&n); for(i=1;i<=n;i++) { s=0; scanf("%d%d",&a,&b); s=a+b; c=c+1; printf("Case %d: %d\n",c,s); } return 0; }
abfc23714933b905b11328ec907e8e081f434502
fe59f0e75f328691e700f109f68d3e06d80241f6
/GLOSAV/Src/mfunc_app.h
831f07c11bfaf80bc08fb73fdcbf0e10f843d4d8
[]
no_license
EmbeddedSystemClass/STM32F4_GLOSAV
0d9b285f3a8b27865d1de774fbf7e23dca2cfda3
2c12aed16ef92dd920390b9816394107bcea0489
refs/heads/master
2021-04-23T09:20:31.176702
2016-04-04T15:47:58
2016-04-04T15:47:58
null
0
0
null
null
null
null
UTF-8
C
false
false
579
h
mfunc_app.h
#ifndef MFUNC_APP_H #define MFUNC_APP_H #include "stm32f4xx_hal.h" #include "FreeRTOS.h" #include "task.h" #include "queue.h" #include "semphr.h" #define MFUNC_CHANNELS_NUM 16 enum enMfuncType { MFUNC_ADC=0, MFUNC_DIN, MFUNC_REDGE, MFUNC_FEDGE, }; typedef struct { GPIO_TypeDef *port; uint32_t pin; ADC_HandleTypeDef *adc; uint32_t adcChn; uint8_t mode; uint8_t discreteState; uint8_t discreteStateOld; }stMfunc; void Mfunc_App_Init(void); void Mfunc_Input_SetMode(uint32_t mode); void Mfunc_TimerInterruptHandler(void); #endif
a660dc3badaf5761348ed27da7a99d2b2c9c57f9
7a9d35f7b4db1f28b9b44d00582d992cb525ff97
/crypto/randUtils.c
7b81879a630c73262cac829f8d460879e9cd8ca1
[]
no_license
nt1124/ThesisCodeSubmission
3ace10f7ec06c96c928b9d1dd9d31441cd9c0bbe
7facf472e6f0ba8895f3654a43360ee371987a10
refs/heads/master
2021-01-19T13:33:12.529315
2015-05-08T08:47:01
2015-05-08T08:47:01
35,235,154
0
0
null
null
null
null
UTF-8
C
false
false
1,826
c
randUtils.c
#ifndef RAND_UTILS #define RAND_UTILS #include <time.h> #include <stdio.h> #include <stdlib.h> #include "ISAAC/rand.c" void initRandGen() { srand(time(NULL)); } unsigned char *generateRandBytes(int randBytes, int outLen) { unsigned char *outputBytes = (unsigned char*) calloc(outLen, sizeof(unsigned char)); int i; for(i = 0; i < randBytes; i ++) { outputBytes[i] = (unsigned char) (rand() & 0xFF); } return outputBytes; } // Generates a uchar array that is outLen long where the first randBytes many are set randomly. unsigned char *generateIsaacRandBytes(randctx *ctx, int randBytes, int outLen) { unsigned char *outputBytes = (unsigned char*) calloc(outLen, sizeof(unsigned char)); int i; isaac(ctx); for(i = 0; i < randBytes; i ++) { outputBytes[i] = (unsigned char) (isacc_rand(ctx) & 0xFF); } return outputBytes; } unsigned int generateRandUint() { unsigned char *asBytes = generateRandBytes(4, 4); unsigned int asUint = 0; memcpy(&asUint, asBytes, sizeof(unsigned int)); return asUint; } unsigned int generateRandUint(randctx *ctx) { unsigned char *asBytes = generateIsaacRandBytes(ctx, 4, 4); unsigned int asUint = 0; memcpy(&asUint, asBytes, sizeof(unsigned int)); return asUint; } unsigned int *generateRandUintList(int numToGen) { unsigned int *toReturn = (unsigned int*) calloc(numToGen, sizeof(unsigned int)); int i; for(i = 0; i < numToGen; i ++) { toReturn[i] = generateRandUint(); } return toReturn; } unsigned char *generateJ_Set_ISAAC(randctx *ctx, int jSetLength) { unsigned char *J_set = (unsigned char *) calloc(jSetLength, sizeof(int)); int i = 0, tempInt; while(i < (jSetLength / 2) ) { tempInt = generateRandUint(ctx) % jSetLength; if(0x00 == J_set[tempInt]) { J_set[tempInt] = 0x01; i ++; } } return J_set; } #endif
5c6813b9e52024ea25a2e0592dff6fb0e7abc670
fcc9b5cb92607deaac4b097776ed0490789d8c3e
/src/runtime/trace-object.inc
cfb36cdb3fb172bcd7962a7b8cb1187ea000e173
[ "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-public-domain-disclaimer", "LicenseRef-scancode-public-domain", "UPL-1.0", "LicenseRef-scancode-other-permissive", "BSD-2-Clause", "BSD-3-Clause", "LicenseRef-scancode-mit-specification-disclaimer", "MIT" ]
permissive
sbcl/sbcl
ef248b5e8614ba7f0a1132c4f2cfcb000a074400
85003adf60ef659082c244972e816ea62240b9cb
refs/heads/master
2023-09-01T05:14:15.225083
2023-08-31T20:09:49
2023-08-31T20:09:49
1,890,957
1,737
408
NOASSERTION
2023-08-28T13:05:04
2011-06-13T20:33:25
Common Lisp
UTF-8
C
false
false
6,826
inc
trace-object.inc
// -*- mode: c -*- #include "weak-hash-pred.inc" /* TRACE_NAME = Base name for generated tracing functions * ACTION = Function name to call with every pointer * STRENGTHEN_WEAK_REFS = Whether to always trace through weak objects as if strong */ #if !defined TRACE_NAME || \ !defined ACTION || \ !defined STRENGTHEN_WEAK_REFS || \ !defined HT_ENTRY_LIVENESS_FUN_ARRAY_NAME #error "Please define all required macros before including trace-object" #endif /* Function name to call with weak pointers that have been deferred */ #ifndef WATCH_DEFERRED #define WATCH_DEFERRED(where, from, to) (void)(0) #endif /* Mutex stuff */ #ifndef LOCK #define LOCK (void)(0) #define UNLOCK (void)(0) #endif /* Generated names */ #define cat2(x, y) x ## y #define cat(x, y) cat2(x, y) #define USING_LAYOUT cat(TRACE_NAME, _using_layout) #define TRACE_PAIR cat(TRACE_NAME, _pair) #define ORDINARY_SLOT(x) ACTION(x, &x, SOURCE_NORMAL) static void TRACE_PAIR(lispobj* where) { ORDINARY_SLOT(where[0]); ORDINARY_SLOT(where[1]); } static void USING_LAYOUT(lispobj layout, lispobj* where, int nslots) { // Apart from the allowance for untagged pointers in lockfree list nodes, // this contains almost none of the special cases that gencgc does. if (!layout) return; ACTION(layout, &layout_of(where), SOURCE_NORMAL); if (lockfree_list_node_layout_p(LAYOUT(layout))) { // allow untagged 'next' struct list_node* node = (void*)where; lispobj next = node->_node_next; // ignore if 0 if (fixnump(next) && next) ACTION(next|INSTANCE_POINTER_LOWTAG, &node->_node_next, SOURCE_ZERO_TAG); } struct bitmap bitmap = get_layout_bitmap(LAYOUT(layout)); int i; lispobj* slots = where+1; for (i=0; i<nslots; ++i) if (bitmap_logbitp(i, bitmap) && is_lisp_pointer(slots[i])) ORDINARY_SLOT(slots[i]); } static void TRACE_NAME(lispobj* where) { lispobj header = *where; int widetag = header_widetag(header); if (instanceoid_widetag_p(widetag)) return USING_LAYOUT(layout_of(where), where, instanceoid_length(header)); sword_t scan_from = 1; sword_t scan_to = sizetab[widetag](where); sword_t i; struct weak_pointer *weakptr; switch (widetag) { case SIMPLE_VECTOR_WIDETAG: #ifdef LISP_FEATURE_UBSAN if (is_lisp_pointer(where[1])) ORDINARY_SLOT(where[1]); #endif /* Would be more precise to only make hash-tables rehash when * some key actually moves, and we don't really trace large and * old tables when scavenging properly. So we _don't_ touch * rehash bits here. */ // non-weak hashtable kv vectors are trivial in fullcgc. Keys don't move // so the table will not need rehash as a result of gc. // Ergo, those may be treated just like ordinary simple vectors. // However, weakness remains as a special case. if (!STRENGTHEN_WEAK_REFS && vector_flagp(header, VectorWeak)) { WATCH_DEFERRED(where, 1, scan_to); if (!vector_flagp(header, VectorHashing)) { LOCK; add_to_weak_vector_list(where, header); UNLOCK; return; } // Ok, we're looking at a weak hash-table. struct vector* v = (struct vector*)where; lispobj *plhash_table = &v->data[vector_len(v)-1]; lispobj lhash_table = *plhash_table; gc_dcheck(instancep(lhash_table)); ACTION(lhash_table, plhash_table, SOURCE_NORMAL); struct hash_table* hash_table = (void*)native_pointer(lhash_table); gc_assert(hashtable_weakp(hash_table)); // An object can only be removed from the queue once. // Therefore the 'next' pointer has got to be nil. gc_assert((lispobj)hash_table->next_weak_hash_table == NIL); int weakness = hashtable_weakness(hash_table); bool defer = 1; LOCK; if (weakness != WEAKNESS_KEY_AND_VALUE) defer = scan_weak_hashtable(hash_table, HT_ENTRY_LIVENESS_FUN_ARRAY_NAME[weakness], TRACE_PAIR); if (defer) { hash_table->next_weak_hash_table = weak_hash_tables; weak_hash_tables = hash_table; } UNLOCK; return; } break; #if defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64) || defined (LISP_FEATURE_ARM64) /* on x86[-64], closure->fun is a fixnum-qua-pointer. Convert it to a lisp * pointer to mark it, but not on platforms where it's already a descriptor */ case CLOSURE_WIDETAG: { lispobj *self = &((struct closure*)where)->fun; ACTION(fun_taggedptr_from_self(*self), self, SOURCE_CLOSURE); scan_from = 2; break; // scan slots normally } #endif case CODE_HEADER_WIDETAG: scan_to = code_header_words((struct code*)where); #ifdef LISP_FEATURE_UNTAGGED_FDEFNS { struct code* code = (struct code*)where; lispobj* where = code->constants + code_n_funs(code) * CODE_SLOTS_PER_SIMPLE_FUN; lispobj* limit = where + code_n_named_calls(code); for ( ; where < limit ; ++where ) ACTION(*where | OTHER_POINTER_LOWTAG, where, SOURCE_ZERO_TAG); // Fall into general case. Untagged fdefns will be ignored as fixnums. } #endif break; case SYMBOL_WIDETAG: { struct symbol* s = (void*)where; ACTION(decode_symbol_name(s->name), &s->name, SOURCE_SYMBOL_NAME); ORDINARY_SLOT(s->value); ORDINARY_SLOT(s->info); ORDINARY_SLOT(s->fdefn); } return; case FDEFN_WIDETAG: { struct fdefn *fdefn = (struct fdefn*)where; ACTION(decode_fdefn_rawfun(fdefn), (lispobj*)&fdefn->raw_addr, SOURCE_FDEFN_RAW); scan_to = 3; break; } case WEAK_POINTER_WIDETAG: weakptr = (struct weak_pointer*)where; if (STRENGTHEN_WEAK_REFS) ORDINARY_SLOT(weakptr->value); else if (weakptr_vectorp(weakptr)) { WATCH_DEFERRED(where, 1, scan_to); LOCK; add_to_weak_vector_list(where, header); UNLOCK; } else if (is_lisp_pointer(weakptr->value) && interesting_pointer_p(weakptr->value)) { /* XXX: This hard-codes the layout of a weak pointer. Make a scalar WATCH_DEFERRED? */ WATCH_DEFERRED(where, 1, 2); LOCK; add_to_weak_pointer_chain(weakptr); UNLOCK; } return; default: if (leaf_obj_widetag_p(widetag)) return; } for(i=scan_from; i<scan_to; ++i) ORDINARY_SLOT(where[i]); } #undef ORDINARY_SLOT
7c5c85d3f3a7208148c84f6f03a1822fb224e1b5
e02516c410aeefc404d7fa951840f774f1036eb8
/Practica/Modulo 2/Sesion6/src/Ejercicio5.c
585b66c8c18ff3abdf31c633e6b72ca57e576c11
[]
no_license
UGR2015IT/SO-Sistemas-Operativos
833a1d0dee55edc1adb631148de6c34ecc5f5793
821fa8f03e2237c0cf61e25350bf7149d8761f11
refs/heads/master
2021-01-10T15:23:43.195475
2016-03-04T18:08:19
2016-03-04T18:08:19
45,644,761
3
3
null
null
null
null
UTF-8
C
false
false
2,815
c
Ejercicio5.c
#include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <string.h> int main(int argc, char *argv[]){ if(argc != 3) { printf("Sintaxi: %s <programa> <origen> <destino>\n\n", argv[0]); return -1; } else { //Declaracion de variables struct stat sb; char* start_file = argv[1]; char* dest_file = argv[2]; int fd_orig, fd_dest; char *start_mem, *dest_mem; int filesize; //Abrimos el fichero de origen fd_orig = open(start_file, O_RDONLY); if (fd_orig == -1) { perror("Fallo al abrir el archivo de origen\n"); return -2; } //Obtenemos su stat, para comprobar si es regular y obtener su tamaño if (fstat (fd_orig, &sb) == -1) { printf("Error al hacer stat en el fichero de origen\n"); return 1; } if (!S_ISREG (sb.st_mode)) { printf ("El fichero de origen no es un archivo regular\n"); return 1; } //Guardamos el tamaño en una variable (por comodidad) filesize = sb.st_size; //Creamos el archivo de destino umask(0); fd_dest = open(dest_file, O_RDWR|O_CREAT|O_EXCL, S_IRWXU); if (fd_dest == -1) { perror("Fallo al crear el archivo de salida"); return -2; } //Asignamos el espacion en el fichero de destino ftruncate(fd_dest, filesize); //Creamos el mapa de memoria del fichero de origen start_mem = (char *) mmap(0, filesize, PROT_READ, MAP_SHARED, fd_orig, 0); if(start_mem == MAP_FAILED) { perror("Fallo mapeando el archivo de entrada"); return -2; } //Creamos el mapa de memoria del fichero de destino dest_mem = (char *) mmap(0, filesize, PROT_WRITE, MAP_SHARED, fd_dest, 0); if(dest_mem == MAP_FAILED) { perror("Fallo mapeando el archivo de salida"); return -2; } //Copiamos un mapa de memoria en otro memcpy(dest_mem, start_mem, filesize); //Liberamos los mapas de memoria munmap(start_mem, filesize); munmap(dest_mem, filesize); //Cerramos los descriptores de fichero close(fd_orig); close(fd_dest); //Terminamos la ejecución del programa return 0; } }
20fdf816b15a14ce2591b3feb6e7286c8e0c3a46
caf081f26fc5d72b0d2749dc7751de32ac8214a7
/chapter1/exercise8.c
1d4ee182f4d21fe5085301e70464aaeec4f3d373
[]
no_license
MDNobu/KRBook
f236797662bf6eb6650af5edd4452cdca9bb372e
e76d5563088a202a85f46ddf26c5d58603a2d0f6
refs/heads/master
2021-12-24T12:27:11.704196
2013-03-03T02:15:54
2013-03-03T02:15:54
null
0
0
null
null
null
null
UTF-8
C
false
false
361
c
exercise8.c
#include "stdio.h" main() { int blankNum, tabNum, newlineNum; blankNum = tabNum = newlineNum = 0; int c; while((c = getchar()) != EOF) { if(c == '\n') { newlineNum++; } else if(c == '\t') { tabNum++; } else if(c == ' ') { blankNum++; } } printf("blanke num = %3d, tab num = %3d, newline num = %3d\n", blankNum, tabNum, newlineNum); }
06701623b0efd944988a4e5b5143e28db43aeb98
a0b64b7beb88eb6b94ff66fa2ec7f093322a8e6b
/includes/vm/struct.h
f8a4fe5973680f7a5361117c5ca5411dcae24ff4
[]
no_license
dmtrnb/corewar
7dac4d1b98c298ba7ff325e63ce067123c13ed26
9174ef1d895aa4fac7baeb8dc2fc76e0fc6dabfc
refs/heads/master
2023-04-26T02:18:54.525961
2021-04-21T15:01:25
2021-04-21T15:01:25
243,287,510
0
0
null
null
null
null
UTF-8
C
false
false
2,296
h
struct.h
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* struct.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: nhamill <nhamill@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/03/07 17:10:58 by nhamill #+# #+# */ /* Updated: 2020/03/15 12:38:57 by nhamill ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef STRUCT_H # define STRUCT_H typedef struct s_visu { unsigned char cond; WINDOW *arena; WINDOW *cycles; WINDOW *lives; WINDOW *procces; unsigned char size; unsigned cursor; unsigned count; unsigned char mem_part; unsigned char mem_parts; } t_visu; typedef struct s_name { char *name; char *comment; unsigned code_size; struct s_name *next; } t_name; typedef struct s_player { char id; char *filename; char *name; char *comment; unsigned code_size; void *code; struct s_player *next; } t_players; typedef struct s_arena { char alive; unsigned nbr_live; unsigned cycles; unsigned cycles_without_check; int cycles_to_die; unsigned nbr_check; void *field; void *par_field; t_visu *visu; } t_arena; typedef struct s_cursor { unsigned id; unsigned pc; unsigned char step; int registrs[REG_NUMBER]; unsigned last_live; unsigned nc; int wait; struct s_cursor *prev; struct s_cursor *next; } t_cursor; typedef struct s_crwr { int nbr_cycles; char opt; t_name *name; t_arena *arena; t_players *players; t_cursor *cursor; } t_crwr; typedef struct s_op { char *name; size_t args; unsigned char mask[3]; size_t num; size_t wait; char *desc; char args_exists; char dir_is_four; void (*func)(t_crwr *crwr, t_cursor *temp); } t_op; #endif
bb80aa98521f86887a9e5fe2c6f839babbaa0ed8
360702adbb02a2ce42e3adb067849a902defd69f
/Modular_exponentiation.c
e49c1783d06266f61c6d10479986cd89df95a58e
[]
no_license
affanrahman0/DSA
19005a49b64c69f3d8a0bae0d3a3c4cceb749834
905b1a5dcd46c95f71c7ff86db1e0a63a171a1e0
refs/heads/main
2023-07-22T13:05:28.001863
2021-09-04T04:49:07
2021-09-04T04:49:07
394,036,617
0
0
null
null
null
null
UTF-8
C
false
false
514
c
Modular_exponentiation.c
#include <stdio.h> #include<math.h> #define mod 1000000007 long long int ME(long long int base,long long int power) { long long int ans=1; while(power>0) { if(power%2) ans=(ans*base)%mod; base=(base*base)%mod; power/=2; } return ans; } int main(void) { long long int t; scanf("%lld",&t); while(t--) { long long int n,m,a,b; scanf("%lld%lld",&n,&m); a=ME(2,n)-1; b=ME(a,m); printf("%lld\n",b); } return 0; }
6b1702c8b10eedd843e10d6c6c4937f00407dd7b
fb31722bf214e80436842a35fcaac94efbb4b186
/try/try-select.c
38714a4a482820204965bd2bef2e840d443558a8
[ "MIT" ]
permissive
d4tocchini/tssx
09af95ddf87135b6f1be7c41b9a35287ac299a4b
fc7ad0a6f916375822a3e5c5ada32df2a4132a51
refs/heads/master
2020-05-20T09:44:28.912177
2019-09-16T05:44:21
2019-09-16T05:44:21
185,509,518
0
0
MIT
2019-05-08T02:04:51
2019-05-08T02:04:50
null
UTF-8
C
false
false
2,134
c
try-select.c
#include <fcntl.h> #include <signal.h> #include "try-common.h" #include "try-select.h" /************************ INTERFACE ************************/ void select_loop(int server_socket) { int highest_fd; fd_set sockets; struct timeval timeout; ; setup_timeout(&timeout); FD_ZERO(&sockets); FD_SET(server_socket, &sockets); highest_fd = server_socket; while (true) { fd_set read_set = sockets; switch (select(highest_fd + 1, &read_set, NULL, NULL, &timeout)) { case ERROR: throw("Error on select"); break; case 0: die("Timeout on select\n"); break; } _accept_select_connections(&read_set, server_socket, &sockets, &highest_fd); _handle_select_requests(&read_set, &sockets, highest_fd, server_socket); } } /************************ PRIVATE ************************/ void _accept_select_connections(const fd_set* read_set, int server_socket, fd_set* sockets, int* highest_fd) { int client_socket; if (!FD_ISSET(server_socket, read_set)) return; if ((client_socket = accept(server_socket, NULL, NULL)) == ERROR) { throw("Error accepting connection on server side"); } set_nonblocking(client_socket); if (client_socket > *highest_fd) { *highest_fd = client_socket; } // Add to master set FD_SET(client_socket, sockets); printf("New connection %d\n", client_socket); } void _handle_select_requests(const fd_set* read_set, fd_set* sockets, int highest_fd, int server_socket) { int amount; char buffer[MESSAGE_SIZE]; memset(buffer, '6', sizeof buffer); for (int fd = 3; fd <= highest_fd; ++fd) { if (fd == server_socket) continue; // printf("fd %i") if (!FD_ISSET(fd, read_set)) continue; // read()/recv() returns zero when the peer disconnects if ((amount = read(fd, buffer, MESSAGE_SIZE)) == 0) { FD_CLR(fd, sockets); close(fd); printf("%d has died ...\n", fd); } else if (amount < MESSAGE_SIZE) { throw("Error reading on server side"); } else { if (write(fd, buffer, MESSAGE_SIZE) < MESSAGE_SIZE) { throw("Error writing on server side"); } } } }
8429e834d50d32a30caae58e35f951071d6b608c
e7c45d18fa1e4285e5227e5984e07c47f8867d1d
/Application/ScDDESrvr/STDAFX.H
c9965f0739a6e2aa9755f16ba834ee023102dc81
[]
no_license
abcweizhuo/Test3
0f3379e528a543c0d43aad09489b2444a2e0f86d
128a4edcf9a93d36a45e5585b70dee75e4502db4
refs/heads/master
2021-01-17T01:59:39.357645
2008-08-20T00:00:29
2008-08-20T00:00:29
null
0
0
null
null
null
null
UTF-8
C
false
false
1,002
h
STDAFX.H
//================== SysCAD - Copyright Kenwalt (Pty) Ltd =================== // $Nokeywords: $ //=========================================================================== // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #include "Scd_SHLB.h" #include <afxwin.h> // MFC core and standard components #include <afxext.h> // MFC extensions #include <afxole.h> // MFC extensions #ifndef _AFX_NO_AFXCMN_SUPPORT #include <afxcmn.h> // MFC support for Windows 95 Common Controls #endif // _AFX_NO_AFXCMN_SUPPORT #include <afxtempl.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <stdarg.h> #include <float.h> #include <malloc.h> #include <memory.h> #include "..\..\..\SMDK\Include\ScdIF.h" #define MDLLIBNAME "ScDdeSrvr"
d4459ed1d88b3b25c819117409a70f41a6cf6350
52f6a049553c3a233e44626460ea7c816bab11be
/information_layout.c
b42566f06fc66832cc96d2f637cd08d9c2dbb056
[]
no_license
ZXM250250/C-Snake-eating
d661468981b7a4e2d2919761ab2d5bd45ccfa492
d8820f3023d21149e7af4d5cdd6259b9bd646367
refs/heads/main
2023-05-22T04:50:26.242293
2021-06-13T12:49:03
2021-06-13T12:49:03
372,677,432
1
0
null
null
null
null
GB18030
C
false
false
3,367
c
information_layout.c
//这里是一个信息的绘制模块 包括游戏过程中的提示 分数 以及游戏结束以后的结算页面绘制 //显示分数和提示信息 int showScoreTips(void) { int highScore = 0; //从文件中读取最高分 highScore = readFile(); //显示最高分 setColor(3); gotoXY(64, 4); printf("☆☆最高分记录☆☆: %d", highScore); //显示当前得分 setColor(14); gotoXY(64, 8); printf("得分: %d", getscore()); //显示温馨提示 setColor(12); gotoXY(72, 11); printf("温 馨 提 示"); //绘制上下边框 setColor(10); gotoXY(60, 13); printf("=================================="); gotoXY(60, 25); printf("=================================="); //输出提示信息 setColor(13); gotoXY(64, 14); printf("※ 吃掉每个食物得分: %d", getadd()); gotoXY(64, 16); printf("※ 不能撞到墙壁,不能咬到自己"); gotoXY(64, 18); printf("※ F1加速前进,F2减速前进"); gotoXY(64, 20); printf("※ 使用空格暂停游戏或者继续游戏"); gotoXY(64, 22); printf("※ 使用↓↑→←控制前进的方向"); gotoXY(64, 24); printf("※ 按下ESC退出游戏"); return 0; } //结束游戏 int endGame(void) { int n = 0; int highScore = 0; while (1) { //显示游戏失败界面 failGameUi(); setColor(12); gotoXY(38, 9); //不同的状态 显示不同失败提示 endStatus switch (getendStatus()) { //撞到墙壁 case 1: printf("您撞到墙了,游戏结束!!!"); break; //咬到自己 case 2: printf("您咬到蛇身了,游戏结束!!!"); break; //用户按下ESC case 3: printf("您已经结束了游戏,游戏结束!!!"); break; default: ; } //显示您的得分 setColor(13); gotoXY(43, 12); printf("您的得分: %d", getscore()); //显示最高分 //从文件中读取最高分 highScore = readFile(); if (getscore() > highScore) { setColor(10); gotoXY(38, 16); printf("恭喜你,您已经破纪录了。"); //将最高分写入文件 writeFile(getscore()); } else { setColor(10); gotoXY(38, 16); printf("加油哦, 离最高分还差%d分", highScore - getscore()); } //输出用户选择的信息 gotoXY(25, 23); setColor(12); printf("再玩一局请输入:1"); gotoXY(52, 23); printf("直接退出请输入:2"); gotoXY(46, 25); setColor(11); printf("请选择: "); scanf("%d", &n); getchar(); if (1 == n) { setscore( 0); setsleepTime (350); setadd( 1); //销毁蛇 destroySnake(); break; } else if (2 == n) { exit(0); } else { gotoXY(30, 27); setColor(12); printf("您的输入有误,请重新输入,按下回车键继续"); getchar(); } } return 0; } //游戏失败界面边框 void failGameUi(void) { int i = 0; //清屏 system("cls"); //显示游戏失败提示 setColor(12); gotoXY(44, 3); printf("游 戏 失 败!!!"); //设置边框的颜色 setColor(11); gotoXY(17, 5); //绘制上边框 printf("+----------------------------------------------------------------+"); //绘制下边框 gotoXY(17, 20); printf("+----------------------------------------------------------------+"); //绘制左右边框 for (i = 6; i < 20; i++) { gotoXY(17, i); printf("|"); gotoXY(82, i); printf("|"); } }
91140fde5d3bb40711f99bf72d71d81411318f9b
acbd5b5df415c07d0c347a1321580ee8f61f6962
/airplay/raop_rtp_mirror.c
a2abda42ab630365bfe338f499686555228191cd
[ "MIT" ]
permissive
amitv87/PiP
6acb1a304a4da36d806062c29e94c73adf175e37
544a014eb000bead480d0715f4ded13f539f75cc
refs/heads/master
2023-07-07T05:27:00.765144
2023-07-03T09:12:16
2023-07-03T09:12:16
113,197,472
353
23
MIT
2022-04-27T13:15:59
2017-12-05T15:11:52
C
UTF-8
C
false
false
29,887
c
raop_rtp_mirror.c
/* * Copyright (c) 2019 dsafa22, All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ #include "raop_rtp_mirror.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #include <assert.h> #include <errno.h> #include <stdbool.h> #include <netinet/tcp.h> #include "raop.h" #include "netutils.h" #include "compat.h" #include "logger.h" #include "byteutils.h" #include "mirror_buffer.h" #include "stream.h" #include "utils.h" #include "plist/plist.h" /* for MacOS, where SOL_TCP and TCP_KEEPIDLE are not defined */ #if !defined(SOL_TCP) && defined(IPPROTO_TCP) #define SOL_TCP IPPROTO_TCP #endif #if !defined(TCP_KEEPIDLE) && defined(TCP_KEEPALIVE) #define TCP_KEEPIDLE TCP_KEEPALIVE #endif //struct h264codec_s { // unsigned char compatibility; // short pps_size; // short sps_size; // unsigned char level; // unsigned char number_of_pps; // unsigned char* picture_parameter_set; // unsigned char profile_high; // unsigned char reserved_3_and_sps; // unsigned char reserved_6_and_nal; // unsigned char* sequence_parameter_set; // unsigned char version; //}; struct raop_rtp_mirror_s { logger_t *logger; raop_callbacks_t callbacks; raop_ntp_t *ntp; /* Buffer to handle all resends */ mirror_buffer_t *buffer; /* Remote address as sockaddr */ struct sockaddr_storage remote_saddr; socklen_t remote_saddr_len; /* MUTEX LOCKED VARIABLES START */ /* These variables only edited mutex locked */ int running; int joined; int flush; thread_handle_t thread_mirror; mutex_handle_t run_mutex; /* MUTEX LOCKED VARIABLES END */ int mirror_data_sock; unsigned short mirror_data_lport; /* switch for displaying client FPS data */ uint8_t show_client_FPS_data; /* SPS and PPS */ int sps_pps_len; unsigned char* sps_pps; bool sps_pps_waiting; raop_connection_t* conn; }; static int raop_rtp_parse_remote(raop_rtp_mirror_t *raop_rtp_mirror, const unsigned char *remote, int remotelen) { char current[25]; int family; int ret; assert(raop_rtp_mirror); if (remotelen == 4) { family = AF_INET; } else if (remotelen == 16) { family = AF_INET6; } else { return -1; } memset(current, 0, sizeof(current)); sprintf(current, "%d.%d.%d.%d", remote[0], remote[1], remote[2], remote[3]); logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror parse remote ip = %s", current); ret = netutils_parse_address(family, current, &raop_rtp_mirror->remote_saddr, sizeof(raop_rtp_mirror->remote_saddr)); if (ret < 0) { return -1; } raop_rtp_mirror->remote_saddr_len = ret; return 0; } #define NO_FLUSH (-42) raop_rtp_mirror_t *raop_rtp_mirror_init(raop_connection_t* conn, logger_t *logger, raop_callbacks_t *callbacks, raop_ntp_t *ntp, const unsigned char *remote, int remotelen, const unsigned char *aeskey) { raop_rtp_mirror_t *raop_rtp_mirror; assert(logger); assert(callbacks); raop_rtp_mirror = calloc(1, sizeof(raop_rtp_mirror_t)); if (!raop_rtp_mirror) { return NULL; } raop_rtp_mirror->conn = conn; raop_rtp_mirror->logger = logger; raop_rtp_mirror->ntp = ntp; raop_rtp_mirror->sps_pps_len = 0; raop_rtp_mirror->sps_pps = NULL; raop_rtp_mirror->sps_pps_waiting = false; memcpy(&raop_rtp_mirror->callbacks, callbacks, sizeof(raop_callbacks_t)); raop_rtp_mirror->buffer = mirror_buffer_init(logger, aeskey); if (!raop_rtp_mirror->buffer) { free(raop_rtp_mirror); return NULL; } if (raop_rtp_parse_remote(raop_rtp_mirror, remote, remotelen) < 0) { free(raop_rtp_mirror); return NULL; } raop_rtp_mirror->running = 0; raop_rtp_mirror->joined = 1; raop_rtp_mirror->flush = NO_FLUSH; MUTEX_CREATE(raop_rtp_mirror->run_mutex); return raop_rtp_mirror; } void raop_rtp_init_mirror_aes(raop_rtp_mirror_t *raop_rtp_mirror, uint64_t *streamConnectionID) { mirror_buffer_init_aes(raop_rtp_mirror->buffer, streamConnectionID); } //#define DUMP_H264 #define RAOP_PACKET_LEN 32768 /** * Mirror */ static THREAD_RETVAL raop_rtp_mirror_thread(void *arg) { raop_rtp_mirror_t *raop_rtp_mirror = arg; assert(raop_rtp_mirror); int stream_fd = -1; unsigned char packet[128]; memset(packet, 0 , 128); unsigned char* payload = NULL; unsigned int readstart = 0; bool conn_reset = false; uint64_t ntp_timestamp_nal = 0; uint64_t ntp_timestamp_raw = 0; bool conn_started = false; unsigned char nal_start_code[4] = { 0x00, 0x00, 0x00, 0x01 }; #ifdef DUMP_H264 // C decrypted FILE* file = fopen("/home/pi/Airplay.h264", "wb"); // Encrypted source file FILE* file_source = fopen("/home/pi/Airplay.source", "wb"); FILE* file_len = fopen("/home/pi/Airplay.len", "wb"); #endif while (1) { fd_set rfds; struct timeval tv; int nfds, ret; MUTEX_LOCK(raop_rtp_mirror->run_mutex); if (!raop_rtp_mirror->running) { MUTEX_UNLOCK(raop_rtp_mirror->run_mutex); logger_log(raop_rtp_mirror->logger, LOGGER_ERR, "raop_rtp_mirror->running is no longer true"); break; } MUTEX_UNLOCK(raop_rtp_mirror->run_mutex); /* Set timeout valu to 5ms */ tv.tv_sec = 0; tv.tv_usec = 5000; /* Get the correct nfds value and set rfds */ FD_ZERO(&rfds); if (stream_fd == -1) { FD_SET(raop_rtp_mirror->mirror_data_sock, &rfds); nfds = raop_rtp_mirror->mirror_data_sock+1; } else { FD_SET(stream_fd, &rfds); nfds = stream_fd+1; } ret = select(nfds, &rfds, NULL, NULL, &tv); if (ret == 0) { /* Timeout happened */ continue; } else if (ret == -1) { logger_log(raop_rtp_mirror->logger, LOGGER_ERR, "raop_rtp_mirror error in select"); break; } if (stream_fd == -1 && FD_ISSET(raop_rtp_mirror->mirror_data_sock, &rfds)) { struct sockaddr_storage saddr; socklen_t saddrlen; logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror accepting client"); saddrlen = sizeof(saddr); stream_fd = accept(raop_rtp_mirror->mirror_data_sock, (struct sockaddr *)&saddr, &saddrlen); if (stream_fd == -1) { logger_log(raop_rtp_mirror->logger, LOGGER_ERR, "raop_rtp_mirror error in accept %d %s", errno, strerror(errno)); break; } // We're calling recv for a certain amount of data, so we need a timeout struct timeval tv; tv.tv_sec = 0; tv.tv_usec = 5000; if (setsockopt(stream_fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) { logger_log(raop_rtp_mirror->logger, LOGGER_ERR, "raop_rtp_mirror could not set stream socket timeout %d %s", errno, strerror(errno)); break; } int option; option = 1; if (setsockopt(stream_fd, SOL_SOCKET, SO_KEEPALIVE, &option, sizeof(option)) < 0) { logger_log(raop_rtp_mirror->logger, LOGGER_WARNING, "raop_rtp_mirror could not set stream socket keepalive %d %s", errno, strerror(errno)); } option = 60; if (setsockopt(stream_fd, SOL_TCP, TCP_KEEPIDLE, &option, sizeof(option)) < 0) { logger_log(raop_rtp_mirror->logger, LOGGER_WARNING, "raop_rtp_mirror could not set stream socket keepalive time %d %s", errno, strerror(errno)); } option = 10; if (setsockopt(stream_fd, SOL_TCP, TCP_KEEPINTVL, &option, sizeof(option)) < 0) { logger_log(raop_rtp_mirror->logger, LOGGER_WARNING, "raop_rtp_mirror could not set stream socket keepalive interval %d %s", errno, strerror(errno)); } option = 6; if (setsockopt(stream_fd, SOL_TCP, TCP_KEEPCNT, &option, sizeof(option)) < 0) { logger_log(raop_rtp_mirror->logger, LOGGER_WARNING, "raop_rtp_mirror could not set stream socket keepalive probes %d %s", errno, strerror(errno)); } readstart = 0; } if (stream_fd != -1 && FD_ISSET(stream_fd, &rfds)) { // The first 128 bytes are some kind of header for the payload that follows while (payload == NULL && readstart < 128) { ret = recv(stream_fd, packet + readstart, 128 - readstart, 0); if (ret <= 0) break; readstart = readstart + ret; } if (payload == NULL && ret == 0) { if (conn_started) { logger_log(raop_rtp_mirror->logger, LOGGER_ERR, "raop_rtp_mirror tcp socket is closed, connection ended"); break; } else { logger_log(raop_rtp_mirror->logger, LOGGER_ERR, "raop_rtp_mirror tcp socket is closed, got %d bytes of 128 byte header",readstart); FD_CLR(stream_fd, &rfds); stream_fd = -1; continue; } } else if (payload == NULL && ret == -1) { if (errno == EAGAIN || errno == EWOULDBLOCK) continue; // Timeouts can happen even if the connection is fine logger_log(raop_rtp_mirror->logger, LOGGER_ERR, "raop_rtp_mirror error in header recv: %d %s", errno, strerror(errno)); if (errno == ECONNRESET) conn_reset = true;; break; } conn_started = true; /*packet[0:3] contains the payload size */ int payload_size = byteutils_get_int(packet, 0); /* packet[4] appears to have one of three possible values: * * 0x00 : encrypted packet * * 0x01 : unencrypted packet with a SPS and a PPS NAL, sent initially, and also when * * a change in video format (e.g., width, height) subsequently occurs * * 0x05 : unencrypted packet with a "streaming report", sent once per second */ /* encrypted packets have packet[5] = 0x00 or 0x10, and packet[6]= packet[7] = 0x00; * * encrypted packets immediately following an unencrypted SPS/PPS packet appear to * * be the only ones with packet[5] = 0x10, and almost always have packet[5] = 0x10, * * but occasionally have packet[5] = 0x00. */ /* unencrypted SPS/PPS packets have packet[4:7] = 0x01 0x00 0x01 0x16 * * they are followed by an encrypted packet with the same timestamp in packet[8:15] */ /* "streaming report" packages have packet[4:7] = 0x05 0x00 0x00 0x00, and have no * * timestamp in packet[8:15] */ //unsigned short payload_type = byteutils_get_short(packet, 4) & 0xff; //unsigned short payload_option = byteutils_get_short(packet, 6); if (payload == NULL) { payload = malloc(payload_size); readstart = 0; } while (readstart < payload_size) { // Payload data ret = recv(stream_fd, payload + readstart, payload_size - readstart, 0); if (ret <= 0) break; readstart = readstart + ret; } if (ret == 0) { logger_log(raop_rtp_mirror->logger, LOGGER_ERR, "raop_rtp_mirror tcp socket is closed"); break; } else if (ret == -1) { if (errno == EAGAIN || errno == EWOULDBLOCK) continue; // Timeouts can happen even if the connection is fine logger_log(raop_rtp_mirror->logger, LOGGER_ERR, "raop_rtp_mirror error in recv: %d %s", errno, strerror(errno)); if (errno == ECONNRESET) conn_reset = true; break; } switch (packet[4]) { case 0x00: // Normal video data (VCL NAL) // Conveniently, the video data is already stamped with the remote wall clock time, // so no additional clock syncing needed. The only thing odd here is that the video // ntp time stamps don't include the SECONDS_FROM_1900_TO_1970, so it's really just // counting micro seconds since last boot. ntp_timestamp_raw = byteutils_get_long(packet, 8); uint64_t ntp_timestamp_remote = raop_ntp_timestamp_to_micro_seconds(ntp_timestamp_raw, false); uint64_t ntp_timestamp = raop_ntp_convert_remote_time(raop_rtp_mirror->ntp, ntp_timestamp_remote); uint64_t ntp_now = raop_ntp_get_local_time(raop_rtp_mirror->ntp); logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror video ntp = %llu, now = %llu, latency = %lld", ntp_timestamp, ntp_now, ((int64_t) ntp_now) - ((int64_t) ntp_timestamp)); #ifdef DUMP_H264 fwrite(payload, payload_size, 1, file_source); fwrite(&readstart, sizeof(readstart), 1, file_len); #endif unsigned char* payload_out; unsigned char* payload_decrypted; if (!raop_rtp_mirror->sps_pps_waiting && packet[5] != 0x00) { logger_log(raop_rtp_mirror->logger, LOGGER_WARNING, "unexpected: packet[5] = %2.2x, but not preceded by SPS+PPS packet", packet[5]); } bool prepend_sps_pps = (raop_rtp_mirror->sps_pps_waiting || packet[5] != 0x00); if (prepend_sps_pps) { assert(raop_rtp_mirror->sps_pps); payload_out = (unsigned char*) malloc(payload_size + raop_rtp_mirror->sps_pps_len); payload_decrypted = payload_out + raop_rtp_mirror->sps_pps_len; memcpy(payload_out, raop_rtp_mirror->sps_pps, raop_rtp_mirror->sps_pps_len); raop_rtp_mirror->sps_pps_waiting = false; } else { if (packet[5] != 0x00) { logger_log(raop_rtp_mirror->logger, LOGGER_WARNING, "Warning: regular NAL unit, but packet[5] = 0x%2.2x is not 0x00", packet[5]); } assert(packet[5] == 0); payload_out = (unsigned char*) malloc(payload_size); payload_decrypted = payload_out; } // Decrypt data mirror_buffer_decrypt(raop_rtp_mirror->buffer, payload, payload_decrypted, payload_size); // It seems the AirPlay protocol prepends NALs with their size, which we're replacing with the 4-byte // start code for the NAL Byte-Stream Format. bool valid_data = true; int nalu_size = 0; int nalus_count = 0; int nalu_type; /* 0x01 non-IDR VCL, 0x05 IDR VCL, 0x06 SEI 0x07 SPS, 0x08 PPS */ while (nalu_size < payload_size) { int nc_len = byteutils_get_int_be(payload_decrypted, nalu_size); if (nc_len < 0 || nalu_size + 4 > payload_size) { valid_data = false; break; } memcpy(payload_decrypted + nalu_size, nal_start_code, 4); nalu_size += 4; nalus_count++; if (payload_decrypted[nalu_size] & 0x80) valid_data = false; /* first bit of h264 nalu MUST be 0 ("forbidden_zero_bit") */ nalu_type = payload_decrypted[nalu_size] & 0x1f; nalu_size += nc_len; logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "nalu_type = %d, nalu_size = %d, processed bytes %d, payloadsize = %d nalus_count = %d", nalu_type, nc_len, nalu_size, payload_size, nalus_count); } if (nalu_size != payload_size) valid_data = false; if(!valid_data) { logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "nalu marked as invalid"); payload_out[0] = 1; /* mark video data as invalid h264 (failed decryption) */ } #ifdef DUMP_H264 fwrite(payload_decrypted, payload_size, 1, file); #endif payload_decrypted = NULL; h264_decode_struct h264_data; h264_data.pts = ntp_timestamp; h264_data.nal_count = nalus_count; /*nal_count will be the number of nal units in the packet */ h264_data.data_len = payload_size; h264_data.data = payload_out; if (prepend_sps_pps) { h264_data.data_len += raop_rtp_mirror->sps_pps_len; h264_data.nal_count += 2; if (ntp_timestamp_raw != ntp_timestamp_nal) { logger_log(raop_rtp_mirror->logger, LOGGER_WARNING, "raop_rtp_mirror: prepended sps_pps timestamp does not match that of video payload"); } } raop_rtp_mirror->callbacks.video_process(raop_rtp_mirror->callbacks.cls, raop_rtp_mirror->ntp, &h264_data, raop_rtp_mirror->conn); free(payload_out); break; case 0x01: // The information in the payload contains an SPS and a PPS NAL // The sps_pps is not encrypted ntp_timestamp_nal = byteutils_get_long(packet, 8); float width = byteutils_get_float(packet, 16); float height = byteutils_get_float(packet, 20); float width_source = byteutils_get_float(packet, 40); float height_source = byteutils_get_float(packet, 44); if (width != width_source || height != height_source) { logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror: Unexpected : data %f, %f != width_source = %f, height_source = %f", width, height, width_source, height_source); } width = byteutils_get_float(packet, 48); height = byteutils_get_float(packet, 52); logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror: unidentified extra header data %f, %f", width, height); width = byteutils_get_float(packet, 56); height = byteutils_get_float(packet, 60); if (raop_rtp_mirror->callbacks.video_report_size) { raop_rtp_mirror->callbacks.video_report_size(raop_rtp_mirror->callbacks.cls, &width_source, &height_source, &width, &height, raop_rtp_mirror->conn); } logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror width_source = %f height_source = %f width = %f height = %f", width_source, height_source, width, height); short sps_size = byteutils_get_short_be(payload,6); unsigned char *sequence_parameter_set = payload + 8; short pps_size = byteutils_get_short_be(payload, sps_size + 9); unsigned char *picture_parameter_set = payload + sps_size + 11; int data_size = 6; char *str = utils_data_to_string(payload, data_size, 16); logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror: sps/pps header size = %d", data_size); logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror h264 sps/pps header:\n%s", str); free(str); str = utils_data_to_string(sequence_parameter_set, sps_size,16); logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror sps size = %d", sps_size); logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror h264 Sequence Parameter Set:\n%s", str); free(str); str = utils_data_to_string(picture_parameter_set, pps_size, 16); logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror pps size = %d", pps_size); logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror h264 Picture Parameter Set:\n%s", str); free(str); data_size = payload_size - sps_size - pps_size - 11; if (data_size > 0) { str = utils_data_to_string (picture_parameter_set + pps_size, data_size, 16); logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "remainder size = %d", data_size); logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "remainder of sps+pps packet:\n%s", str); free(str); } else if (data_size < 0) { logger_log(raop_rtp_mirror->logger, LOGGER_ERR, " pps_sps error: packet remainder size = %d < 0", data_size); } // Copy the sps and pps into a buffer to prepend to the next NAL unit. raop_rtp_mirror->sps_pps_len = sps_size + pps_size + 8; if (raop_rtp_mirror->sps_pps) { free(raop_rtp_mirror->sps_pps); } raop_rtp_mirror->sps_pps = (unsigned char*) malloc(raop_rtp_mirror->sps_pps_len); assert(raop_rtp_mirror->sps_pps); memcpy(raop_rtp_mirror->sps_pps, nal_start_code, 4); memcpy(raop_rtp_mirror->sps_pps + 4, sequence_parameter_set, sps_size); memcpy(raop_rtp_mirror->sps_pps + sps_size + 4, nal_start_code, 4); memcpy(raop_rtp_mirror->sps_pps + sps_size + 8, payload + sps_size + 11, pps_size); raop_rtp_mirror->sps_pps_waiting = true; #ifdef DUMP_H264 fwrite(raop_rtp_mirror->sps_pps, raop_rtp_mirror->sps_pps_len, 1, file); #endif // h264codec_t h264; // h264.version = payload[0]; // h264.profile_high = payload[1]; // h264.compatibility = payload[2]; // h264.level = payload[3]; // h264.reserved_6_and_nal = payload[4]; // h264.reserved_3_and_sps = payload[5]; // h264.sps_size = sps_size; // h264.sequence_parameter_set = malloc(h264.sps_size); // memcpy(h264.sequence_parameter_set, sequence_parameter_set, sps_size); // h264.number_of_pps = payload[h264.sps_size + 8]; // h264.pps_size = pps_size; // h264.picture_parameter_set = malloc(h264.pps_size); // memcpy(h264.picture_parameter_set, picture_parameter_set, pps_size); break; case 0x05: logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "\nReceived video streaming performance info packet from client"); /* payloads with packet[4] = 0x05 have no timestamp, and carry video info from the client as a binary plist * * Sometimes (e.g, when the client has a locked screen), there is a 25kB trailer attached to the packet. * * This 25000 Byte trailer with unidentified content seems to be the same data each time it is sent. */ if (payload_size && raop_rtp_mirror->show_client_FPS_data) { //char *str = utils_data_to_string(packet, 128, 16); //logger_log(raop_rtp_mirror->logger, LOGGER_WARNING, "type 5 video packet header:\n%s", str); //free (str); int plist_size = payload_size; if (payload_size > 25000) { plist_size = payload_size - 25000; char *str = utils_data_to_string(payload + plist_size, 16, 16); logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "video_info packet had 25kB trailer; first 16 bytes are:\n%s", str); free(str); } if (plist_size) { char *plist_xml; uint32_t plist_len; plist_t root_node = NULL; plist_from_bin((char *) payload, plist_size, &root_node); plist_to_xml(root_node, &plist_xml, &plist_len); logger_log(raop_rtp_mirror->logger, LOGGER_INFO, "%s", plist_xml); free(plist_xml); } } break; default: logger_log(raop_rtp_mirror->logger, LOGGER_WARNING, "\nReceived unexpected TCP packet from client, packet[4] = 0x%2.2x", packet[4]); break; } free(payload); payload = NULL; memset(packet, 0, 128); readstart = 0; } } /* Close the stream file descriptor */ if (stream_fd != -1) { closesocket(stream_fd); } #ifdef DUMP_H264 fclose(file); fclose(file_source); fclose(file_len); #endif // Ensure running reflects the actual state MUTEX_LOCK(raop_rtp_mirror->run_mutex); raop_rtp_mirror->running = false; MUTEX_UNLOCK(raop_rtp_mirror->run_mutex); logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror exiting TCP thread"); if (conn_reset && raop_rtp_mirror->callbacks.conn_reset) { const bool video_reset = false; /* leave "frozen video" showing */ raop_rtp_mirror->callbacks.conn_reset(raop_rtp_mirror->callbacks.cls, 0, video_reset, raop_rtp_mirror->conn); } return 0; } static int raop_rtp_init_mirror_sockets(raop_rtp_mirror_t *raop_rtp_mirror, int use_ipv6) { assert(raop_rtp_mirror); unsigned short dport = raop_rtp_mirror->mirror_data_lport; int dsock = netutils_init_socket(&dport, use_ipv6, 0); if (dsock == -1) { goto sockets_cleanup; } /* Listen to the data socket if using TCP */ if (listen(dsock, 1) < 0) { goto sockets_cleanup; } /* Set socket descriptors */ raop_rtp_mirror->mirror_data_sock = dsock; /* Set port values */ raop_rtp_mirror->mirror_data_lport = dport; logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror local data port socket %d port TCP %d", dsock, dport); return 0; sockets_cleanup: if (dsock != -1) closesocket(dsock); return -1; } void raop_rtp_start_mirror(raop_rtp_mirror_t *raop_rtp_mirror, int use_udp, unsigned short *mirror_data_lport, uint8_t show_client_FPS_data) { logger_log(raop_rtp_mirror->logger, LOGGER_INFO, "raop_rtp_mirror starting mirroring"); int use_ipv6 = 0; assert(raop_rtp_mirror); assert(mirror_data_lport); raop_rtp_mirror->show_client_FPS_data = show_client_FPS_data; MUTEX_LOCK(raop_rtp_mirror->run_mutex); if (raop_rtp_mirror->running || !raop_rtp_mirror->joined) { MUTEX_UNLOCK(raop_rtp_mirror->run_mutex); return; } if (raop_rtp_mirror->remote_saddr.ss_family == AF_INET6) { use_ipv6 = 1; } use_ipv6 = 0; raop_rtp_mirror->mirror_data_lport = *mirror_data_lport; if (raop_rtp_init_mirror_sockets(raop_rtp_mirror, use_ipv6) < 0) { logger_log(raop_rtp_mirror->logger, LOGGER_ERR, "raop_rtp_mirror initializing sockets failed"); MUTEX_UNLOCK(raop_rtp_mirror->run_mutex); return; } *mirror_data_lport = raop_rtp_mirror->mirror_data_lport; /* Create the thread and initialize running values */ raop_rtp_mirror->running = 1; raop_rtp_mirror->joined = 0; THREAD_CREATE(raop_rtp_mirror->thread_mirror, raop_rtp_mirror_thread, raop_rtp_mirror); MUTEX_UNLOCK(raop_rtp_mirror->run_mutex); } void raop_rtp_mirror_stop(raop_rtp_mirror_t *raop_rtp_mirror) { assert(raop_rtp_mirror); /* Check that we are running and thread is not * joined (should never be while still running) */ MUTEX_LOCK(raop_rtp_mirror->run_mutex); if (!raop_rtp_mirror->running || raop_rtp_mirror->joined) { MUTEX_UNLOCK(raop_rtp_mirror->run_mutex); return; } raop_rtp_mirror->running = 0; MUTEX_UNLOCK(raop_rtp_mirror->run_mutex); if (raop_rtp_mirror->mirror_data_sock != -1) { closesocket(raop_rtp_mirror->mirror_data_sock); raop_rtp_mirror->mirror_data_sock = -1; } /* Join the thread */ THREAD_JOIN(raop_rtp_mirror->thread_mirror); /* Mark thread as joined */ MUTEX_LOCK(raop_rtp_mirror->run_mutex); raop_rtp_mirror->joined = 1; MUTEX_UNLOCK(raop_rtp_mirror->run_mutex); } void raop_rtp_mirror_destroy(raop_rtp_mirror_t *raop_rtp_mirror) { if (raop_rtp_mirror) { raop_rtp_mirror_stop(raop_rtp_mirror); MUTEX_DESTROY(raop_rtp_mirror->run_mutex); mirror_buffer_destroy(raop_rtp_mirror->buffer); if (raop_rtp_mirror->sps_pps) { free(raop_rtp_mirror->sps_pps); } free(raop_rtp_mirror); } }
8b3460189535ecaeaafcb938049e0e51ca502c61
e24a981d22dc9f08eaead51792f5933d359f003d
/drivers/old/ati2d/accel_2d.h
9fcef4b723e5b038e3eb87f5674aa15819a28db9
[]
no_license
Harmon758/kolibrios
d6001876fefb006ea65e5fe3810b26606e33284e
0d615a7c442e8974f58b7260b094c1212c618bcf
refs/heads/master
2023-08-20T11:47:59.999028
2023-08-20T10:40:03
2023-08-20T10:40:03
66,638,292
32
4
null
null
null
null
UTF-8
C
false
false
2,543
h
accel_2d.h
#define PX_CREATE 1 #define PX_DESTROY 2 #define PX_CLEAR 3 #define PX_DRAW_RECT 4 #define PX_FILL_RECT 5 #define PX_LINE 6 #define PX_BLIT 7 #define PX_BLIT_TRANSPARENT 8 #define PX_BLIT_ALPHA 9 typedef unsigned int color_t; typedef struct { int x; int y; }pt_t; /*********** Clipping **********/ typedef struct { int xmin; int ymin; int xmax; int ymax; }clip_t, *PTRclip; #define CLIP_TOP 1 #define CLIP_BOTTOM 2 #define CLIP_RIGHT 4 #define CLIP_LEFT 8 int LineClip ( clip_t *clip, int *x1, int *y1, int *x2, int *y2 ); int BlockClip( clip_t *clip, int *x1, int *y1, int *x2, int* y2 ); typedef struct { unsigned width; unsigned height; u32_t format; u32_t flags; size_t pitch; void *mapped; u32_t handle; }pixmap_t; typedef struct { unsigned width; unsigned height; u32_t format; u32_t flags; size_t pitch; void *mapped; unsigned pitch_offset; addr_t local; }local_pixmap_t; #define PX_MEM_SYSTEM 0 #define PX_MEM_LOCAL 1 #define PX_MEM_GART 2 #define PX_MEM_MASK 3 #define PX_LOCK 1 typedef struct { local_pixmap_t *dstpix; color_t color; }io_clear_t; typedef struct { local_pixmap_t *dstpix; struct { int x0; int y0; }; union { struct { int x1; int y1; }; struct { int w; int h; }; }; color_t color; color_t border; }io_draw_t; typedef struct { local_pixmap_t *dstpix; int x; int y; int w; int h; color_t bkcolor; color_t fcolor; u32_t bmp0; u32_t bmp1; color_t border; }io_fill_t; typedef struct { local_pixmap_t *dstpix; int dst_x; int dst_y; local_pixmap_t *srcpix; int src_x; int src_y; int w; int h; union { color_t key; color_t alpha; }; }io_blit_t; static addr_t bind_pixmap(local_pixmap_t *pixmap); int CreatePixmap(pixmap_t *io); int DestroyPixmap(pixmap_t *io); int ClearPixmap(io_clear_t *io); int Line(io_draw_t *draw); int DrawRect(io_draw_t * draw); int FillRect(io_fill_t * fill); int Blit(io_blit_t* blit); int BlitTransparent(io_blit_t* blit);
0019009f15e977109ca54b6204c0f061e93add7c
89b4c6fd4eb403b8d5bc6fd899b970ae184f914c
/main.c
363b39c369b9b61c60f676d5845e530da85c415c
[]
no_license
LeandroFonseca02/FP_Desafio1_Ex5
3beb56d11bfeafd5875712461819d55b7474b870
53c30b9727187203bb7262dc926c487e57eda4a6
refs/heads/main
2023-01-27T23:01:53.974984
2020-11-27T13:25:42
2020-11-27T13:25:42
316,500,234
0
0
null
null
null
null
UTF-8
C
false
false
813
c
main.c
/* Ismat - Engenheiria Informática 1º Ano Fundamentos de Programação - Prof. Fracisco Pereira Leandro Fonseca 17/11/2020 - 01:56 Resumo: Converter numero inteiro em caractere Ascii Inputs: int instAsciiValue Outputs: */ #include <stdio.h> int main() { int intAsciiValue=0; char chrAscii='\0'; int intExit=0; while (intExit !=1) { printf("Escolha um numero: "); scanf("%d", &intAsciiValue); if(intAsciiValue != 0) { if((intAsciiValue > 32) && (intAsciiValue < 129)) { chrAscii = intAsciiValue; printf("Caracter: %c\n", chrAscii); }else { printf("Numero invalido!"); } }else { intExit = 1; } } return 0; }
abc47462edb140180b43c6defe97390e7fea782e
68a3685b1097b401a748aaa1efc470b3b811b19f
/shell_training/.#backup.c
c3e0af78445a72f4df00f98c6f91a19a6cf7c282
[]
no_license
iheb1919/shell
473d64672dd0e228dc995fec6514fd088b449293
6637c9d0169a2ae5985b73c0d0e72ab1f1a411ac
refs/heads/master
2020-09-12T17:35:12.293123
2019-11-21T11:34:21
2019-11-21T11:34:21
222,496,614
0
0
null
null
null
null
UTF-8
C
false
false
36
c
.#backup.c
root@iheb-VirtualBox.2368:1574088398
0d8a96601645609814d1c796da29f7d8e321b250
58b251e968dd37298e89f270c2ea5551ff462f82
/aworks_sdk/apollo/interface/include/aw_gnss.h
4968e1223f232831b48ce90b2f0da6769cde0c2e
[]
no_license
yisea123/Awork_proj
2162045686c362e75cec22984e72f1e5cd1eab7e
cb8bb2d5145f47917932a0f8ed0ac83be9c645f2
refs/heads/master
2020-09-02T15:37:50.132477
2019-02-25T07:47:45
2019-02-25T07:47:45
null
0
0
null
null
null
null
GB18030
C
false
false
11,254
h
aw_gnss.h
/******************************************************************************* * AWorks * ---------------------------- * innovating embedded platform * * Copyright (c) 2001-2017 Guangzhou ZHIYUAN Electronics Co., Ltd. * All rights reserved. * * Contact information: * web site: http://www.zlg.cn * e-mail: support@zlg.cn *******************************************************************************/ /** * \file * \brief GNSS(global navigation satellite system)接口 * * \code #include "aw_gnss.h" #include "aw_vdebug.h" aw_local aw_err_t __test_gnss_func(void) { aw_err_t ret = AW_OK; float a[2]; char buf[50]; // 获取定位数据 ret = aw_gnss_dat_get(0, AW_GNSS_RMC_POSITION, a, 8); if (ret != AW_OK) { AW_ERRF(("aw_gnss_get_pos err: %d\n", ret)); return ret; } else { AW_INFOF(("gps local: %f, %f\n", a[0], a[1])); } // 获取速度 ret = aw_gnss_dat_get(0, AW_GNSS_VTG_RATE, a, 4); if (ret != AW_OK) { AW_ERRF(("get vtg rate failed: %d\n", ret)); } else { AW_INFOF(("vtg rate: %f\n", a[0])); } // 获取海拔 ret = aw_gnss_dat_get(0, AW_GNSS_GGA_ALTITUDE, a, 4); if (ret != AW_OK) { AW_ERRF(("get gga altitude failed: %d\n", ret)); } else { AW_INFOF(("altitude: %f\n", a[0])); } return ret; } void test_gnss(void) { aw_err_t ret = AW_OK; int dev_id = 0; // 复位 GPS 模块 ret = aw_gnss_ioctl(dev_id, AW_GNSS_SRESET, (void *)AW_GNSS_HOT_STARTUP); if (ret != AW_OK) { AW_ERRF(("aw_gnss_ioctl AW_GNSS_HOT_STARTUP err: %d\n", ret)); return; } // 启动 GPS 模块 ret = aw_gnss_enable(dev_id); if (ret != AW_OK) { AW_ERRF(("aw_gnss_start err: %d\n", ret)); return; } // 设置双模输出 ret = aw_gnss_ioctl(dev_id, AW_GNSS_SYS_FREQ, (void *)(AW_GNSS_BDS_B1 | AW_GNSS_GPS_L1)); if (ret != AW_OK) { AW_ERRF(("aw_gnss_ioctl err: %d\n", ret)); return; } // 设置解码类型为RMC VTG 和 GGA ret = aw_gnss_ioctl(dev_id, AW_GNSS_NMEA_SELECT, (void *)(AW_GNSS_NMEA_RMC | AW_GNSS_NMEA_VTG | AW_GNSS_NMEA_GGA)); if (ret != AW_OK) { AW_ERRF(("aw_gnss_ioctl AW_GNSS_NMEA_SELECT err: %d\n", ret)); return; } __test_gnss_func(); } * \endcode * * \internal * \par modification history: * - 1.00 16-12-29 vih, first implementation. * \endinternal */ #ifndef __AW_GNSS_H #define __AW_GNSS_H #ifdef __cplusplus extern "C" { #endif /** * \addtogroup grp_aw_if_gnss * \copydoc aw_gnss.h * @{ */ #include "aworks.h" #define AW_GNSS_GPS_L1 (1) /**< \brief 频段1575.42MHZ */ #define AW_GNSS_GPS_L2 (1<<1) /**< \brief 频段1227.6MHZ */ #define AW_GNSS_GPS_L5 (1<<2) /**< \brief 频段1176.45MHZ */ #define AW_GNSS_BDS_B1 (1<<4) /**< \brief 频段1561.098MHZ */ #define AW_GNSS_BDS_B2 (1<<5) /**< \brief 频段1207.14MHZ */ #define AW_GNSS_BDS_B3 (1<<6) /**< \brief 频段1268.52MHZ */ #define AW_GNSS_HOT_STARTUP 0x00 /**< \brief 热启动 */ #define AW_GNSS_WARM_STARTUP 0x01 /**< \brief 常规启动 */ #define AW_GNSS_COLD_STARTUP 0x95 /**< \brief 冷启动 */ #define AW_GNSS_NMEA_RMC (0x01) /**< \brief 解码类型为RMC */ #define AW_GNSS_NMEA_VTG (0x01 << 1) /**< \brief 解码类型为VTG */ #define AW_GNSS_NMEA_GGA (0x01 << 2) /**< \brief 解码类型为GGA */ /** * \brief ioctl的选项 */ typedef enum aw_gnss_ioctl_req { AW_GNSS_SYS_FREQ = 0, /**< \brief 系统的频段 */ AW_GNSS_NMEA_VER, /**< \brief nmea0183 协议版本 */ AW_GNSS_DAT_OUT_RATE, /**< \brief gnss device数据的输出速率(ms) */ AW_GNSS_SRESET, /**< \brief 软件复位 */ AW_GNSS_HRESET, /**< \brief 硬件复位 */ AW_GNSS_NMEA_SELECT, /**< \brief NMEA 解码的类型 */ AW_GNSS_MAX_VALID_TIM, /**< \brief 数据最大的有效时间(ms) */ AW_GNSS_DEV_STATUS /**< \brief 查询设备状态,为AW_OK则设备就绪,否则设备繁忙 */ } aw_gnss_ioctl_req_t; /** * \brief ioctl的选项 */ typedef enum aw_gnss_data_type { /** \brief 获取的数据类型: VTG的速度 , Km/h */ AW_GNSS_VTG_RATE = ((AW_GNSS_NMEA_VTG << 16) + 1), /** \brief 获取的数据类型: GGA的海拔高度, 单位M */ AW_GNSS_GGA_ALTITUDE = ((AW_GNSS_NMEA_GGA << 16) + 1), /** \brief 获取的数据类型: RMC的定位 */ AW_GNSS_RMC_POSITION = ((AW_GNSS_NMEA_RMC << 16) + 1), /** \brief 获取的数据类型: RMC的UTC时间 */ AW_GNSS_RMC_UTC_TIME = ((AW_GNSS_NMEA_RMC << 16) + 2), /** \brief 获取的数据类型: RMC的地磁偏角 */ AW_GNSS_RMC_ANGLE = ((AW_GNSS_NMEA_RMC << 16) + 3), /** \brief 获取的数据类型: RMC的磁偏角方向 */ AW_GNSS_RMC_ANGLE_DIRECT = ((AW_GNSS_NMEA_RMC << 16) + 4), /** \brief 获取的数据类型: RMC的地面航向 */ AW_GNSS_RMC_COURSE = ((AW_GNSS_NMEA_RMC << 16) + 5), /** \brief 获取的数据类型: RMC数据的有效性 */ AW_GNSS_RMC_VALID = ((AW_GNSS_NMEA_RMC << 16) + 6) } aw_gnss_data_type_t; /** * \brief gnss启动函数 * * \param id 设备id * * \return aw_err_t 错误类型 */ aw_err_t aw_gnss_enable (int id); /** * \brief gnss关闭函数 * * \param id 设备id * * \return aw_err_t 错误类型 */ aw_err_t aw_gnss_disable (int id); /** * \brief gnss device control * * \param id 设备id * \param req iotcl命令请求 * 可用的请求及参数如下: * @arg AW_GNSS_SYS_FREQ,选择系统的类型 * AW_GNSS_GPS_L1 * AW_GNSS_GPS_L2 * AW_GNSS_BDS_B1 * AW_GNSS_BDS_B2 * AW_GNSS_BDS_B3 * @arg AW_GNSS_NMEA_VER,选择输出的nmea协议版本 * 0x30 - 在 NMEA 标准 version 3.0 基础上扩展北斗相关的语句 * 0x40 - 卫星定位总站定义的扩展 NMEA * 0x41 - 《车载终端用北斗导航模块数据接口规范》中规定的NMEA 格式 * 0x42 - 输出双模和北斗gsa * * @arg AW_GNSS_DAT_OUT_RATE,数据输出速率,单位ms * @arg AW_GNSS_SRESET,软件复位 * GNSS_HOT_STARTUP - 热启动 * GNSS_CLOD_STARTUP - 冷启动 * GNSS_WARM_STARTUP - 温启动 * @arg AW_GNSS_HRESET,硬件复位 * GNSS_HOT_STARTUP * GNSS_COLD_STARTUP * GNSS_WARM_STARTUP * @arg AW_GNSS_NMEA_SELECT, 设置解码类型 * @arg AW_GNSS_MAX_VALID_TIM, 设置数据的有效时间ms * @arg AW_GNSS_DEV_STATUS, 查询设备状态 * * \param arg ioctl命令请求参数,参数类型和取值取决于对应的请求命令 * * \par 范例 * \code * * * aw_gnss_ioctl(0, AW_GNSS_DAT_OUT_RATE, (void *)500); // 设置数据输出速率,单位ms * aw_gnss_ioctl(0, AW_GNSS_NMEA_VER, (void *)0x30); // 选择输出的nmea协议版本 * aw_gnss_ioctl(0, AW_GNSS_SRESET, (void *)GNSS_HOT_STARTUP); // 软件热启动复位 * aw_gnss_ioctl(0, AW_GNSS_MAX_VALID_TIM, (void *)500); // 有效数据的保持500ms * * // 设置设备的频率为gps和北斗双模 * aw_gnss_ioctl(0, AW_GNSS_SYS_FREQ, (void *)(AW_GNSS_GPS_L1 | AW_GNSS_BDS_B1)); * * // 设置解码类型为RMC VTG 和 GGA * aw_gnss_ioctl(0, * AW_GNSS_NMEA_SELECT, * (void *)(AW_GNSS_NMEA_RMC | AW_GNSS_NMEA_VTG | AW_GNSS_NMEA_GGA)); * * //查询设备状态 * aw_err_t dev_status; * aw_gnss_ioctl(0, AW_GNSS_DEV_STATUS, (void *)(&dev_status)); * if (dev_status == AW_OK) { * // 状态为AW_OK则设备就绪,否则设备繁忙 * } * * \endcode * * \return aw_err_t 错误类型 */ aw_err_t aw_gnss_ioctl (int id, aw_gnss_ioctl_req_t req, void *arg); /** * \brief 获取数据 * * \param id 设备id * \param type 需要获取的数据类型 * \param ptr 数据的存放buf * \param len buf的长度 * * \retval AW_OK 操作成功 * \retval -EBUSY 设备繁忙 * \retval -EINVAL 参数无效 * \retval -ENOMEM 参数 ptr 的长度不足以接收该数据 * \retval -ENOMSG 没有获取到有效数据 * \retval -ETIME 接收数据超时 * \retval -EBADMSG 接收到的数据是不完整的 * \retval -ENOTSUP 不支持获取这种类型的数据, * 请确认是否已通过ioctl命令开启接收该类型的数据 * * \par 范例 * \code * * int ret; * float a[2]; * float lon ,lat, rat, alt; * struct awbl_nmea_0183_utc_time utc_time; * * ret = aw_gnss_dat_get(0, AW_GNSS_RMC_POSITION, a, 8); //获取定位数据 * * if (ret == AW_OK) { * lon = a[0]; // 经度 * lat = a[1]; // 纬度 * } * * ret = aw_gnss_dat_get(0, AW_GNSS_VTG_RATE, a, 4); //获取速度 * * if (ret == AW_OK) { * rate = a[0]; * } * * //获取RMC类型的UTC时间 * ret = aw_gnss_dat_get(0, AW_GNSS_RMC_UTC_TIME, &utc_time, sizeof(utc_time)); * if (ret == AW_OK) { * rate = a[0]; * } * * //获取海拔高度 * ret = aw_gnss_dat_get(0, AW_GNSS_GGA_ALTITUDE, a, 4); * if (ret == AW_OK) { * alt = a[0]; * } * * // 获取地磁偏角 * ret = aw_gnss_dat_get(0, AW_GNSS_RMC_ANGLE, a, 4); * if (ret != AW_OK) { * AW_ERRF(("get angle failed: %d\n", ret)); * } else { * AW_INFOF(("angle: %f\n", a[0])); * } * * // 获取RMC的磁偏角方向 * ret = aw_gnss_dat_get(0, AW_GNSS_RMC_ANGLE_DIRECT, a, 4); * if (ret != AW_OK) { * AW_ERRF(("get angle direct failed: %d\n", ret)); * } else { * AW_INFOF(("angle direct: %f\n", a[0])); * } * * // RMC的地面航向 * ret = aw_gnss_dat_get(0, AW_GNSS_RMC_COURSE, a, 4); * if (ret != AW_OK) { * AW_ERRF(("get course failed: %d\n", ret)); * } else { * AW_INFOF(("course: %f\n", a[0])); * } * * \endcode * */ aw_err_t aw_gnss_dat_get (int id, aw_gnss_data_type_t type, void *ptr, uint8_t len); /** @} grp_aw_if_gnss */ #ifdef __cplusplus } #endif #endif /* __AW_GNSS_H */ /* end of file */
73e9fe66df00254639baac86c8e2f1e8972dff81
198cc1269dfd5ca8e556991afed8e97a0a90ef39
/include/cno_time.h
50e22178151c1981f926fd33d2449ca0fb2912ad
[ "MIT" ]
permissive
Anadian/CNO
5575a5087edb93b7ef54ca74edcd33aeb5047920
02d7d60f6dbc2451bc76134099dca42bc54e8cbb
refs/heads/master
2021-06-27T08:56:20.004542
2019-05-19T18:55:34
2019-05-19T18:55:34
78,236,907
0
0
null
null
null
null
UTF-8
C
false
false
742
h
cno_time.h
//cno_time.h: Time retrieval functions #ifndef CNO_TIME_H #define CNO_TIME_H #ifdef __cplusplus extern "C" { #endif //__cplusplus #include "cno_build.h" #include "cno_string.h" #if CNO_HAVE_TIME #include <time.h> typedef time_t cno_unixtime_type; typedef clock_t cno_clocktime_type; typedef struct tm cno_calendartime_type; #endif //CNO_HAVE_TIME cno_u8_type CNO_Time_Unix(cno_unixtime_type *unix_time); cno_u8_type CNO_Time_Clock(cno_clocktime_type *clock_time); cno_u8_type CNO_Time_CalendarFromUnix(cno_calendartime_type *calendar_time, cno_unixtime_type unix_time); cno_u8_type CNO_Time_StringFromCalendar(cno_string_type *string, cno_calendartime_type calendar_time); #ifdef __cplusplus } #endif //__cplusplus #endif //CNO_TIME_H
7dc8dfbd55eb5278cb6bcb5588a45a683e924602
9d121733df655028f133c08e0d8f040ffd5cb08d
/public_html/2015/secret-2e44fac40ce121fc2afdc4cd9bbfe607/2707/source/source.c
fe754a5957ab1ada7aa3114920c97f2cb8c39c20
[ "MIT" ]
permissive
Ikhsanhaw/tisigram2017
49a7afc131a27f554bcb1936473b1ba9a0100603
5270610826d16089e1387b0cadd32b8d098ef89d
refs/heads/master
2021-01-18T20:29:16.979856
2017-04-03T14:04:11
2017-04-03T14:04:11
86,966,878
0
0
null
null
null
null
UTF-8
C
false
false
182
c
source.c
#include<stdio.h> #include<string.h> int main(){ long int p,k; scanf("%d %d",&p,&k); if(p){ printf("%d\n",k/p); } else{ printf("mustahil\n"); } return 0; }
f86063e2b3aa0556795ca4a0000415b3e5abe6a0
53219683b28edc6510b3970a92aec8f1b4b84ed2
/URI/1012 Area.c
ce1e90e782e569edb05635f06ee8b06c9e811f6c
[]
no_license
tomal123bd/Online-Judge
87f09b3c0301c781e1ce69dfa68041869588be37
e17217bae90fd4cf63abed3a916a2a9f3085943f
refs/heads/master
2021-01-19T21:29:19.086039
2019-02-19T02:27:51
2019-02-19T02:27:51
101,251,717
0
0
null
null
null
null
UTF-8
C
false
false
324
c
1012 Area.c
#include <stdio.h> int main() { float a,b,c; scanf ("%f %f %f",&a,&b,&c); printf ("TRIANGULO: %.3f\n",(a*c)/2); printf ("CIRCULO: %.3f\n",3.14159*(c*c)); printf ("TRAPEZIO: %.3f\n",((a+b)/2)*c); printf ("QUADRADO: %.3f\n",b*b); printf ("RETANGULO: %.3f\n",a*b); return 0; }
b2a64408aa938f0635533462993c08ad4978ffde
47862f302be3e164c4b23ca7c3fcf7f148fb4ce1
/libtor-src/tor-src/src/feature/dirparse/policy_parse.c
8d30410f58f36911e2bfe802289761e0a1e8e1b3
[ "NCSA", "OpenSSL", "BSD-3-Clause", "ISC", "MIT", "BSD-2-Clause", "Autoconf-exception-generic", "GPL-2.0-or-later", "CC-BY-SA-4.0" ]
permissive
MagicalBitcoin/libtor-sys
dab68c353fc359177792af941ffb1bcae1d24ecf
7309e85f8f8281e8454cff3fa34dd1dc5b2f9341
refs/heads/master
2023-02-19T18:53:41.778835
2023-02-10T18:03:54
2023-02-10T21:08:16
239,218,242
36
11
MIT
2023-02-10T21:11:53
2020-02-08T23:18:36
C
UTF-8
C
false
false
7,843
c
policy_parse.c
/* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. * Copyright (c) 2007-2021, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** * \file policy_parse.c * \brief Code to parse address policies. **/ #define ROUTERDESC_TOKEN_TABLE_PRIVATE #include "core/or/or.h" #include "core/or/policies.h" #include "feature/dirparse/parsecommon.h" #include "feature/dirparse/policy_parse.h" #include "feature/dirparse/routerparse.h" #include "feature/dirparse/unparseable.h" #include "lib/memarea/memarea.h" #include "core/or/addr_policy_st.h" static addr_policy_t *router_parse_addr_policy_private(directory_token_t *tok); /** Parse the addr policy in the string <b>s</b> and return it. If * assume_action is nonnegative, then insert its action (ADDR_POLICY_ACCEPT or * ADDR_POLICY_REJECT) for items that specify no action. * * Returns NULL on policy errors. * * Set *<b>malformed_list</b> to true if the entire policy list should be * discarded. Otherwise, set it to false, and only this item should be ignored * on error - the rest of the policy list can continue to be processed and * used. * * The addr_policy_t returned by this function can have its address set to * AF_UNSPEC for '*'. Use policy_expand_unspec() to turn this into a pair * of AF_INET and AF_INET6 items. */ MOCK_IMPL(addr_policy_t *, router_parse_addr_policy_item_from_string,(const char *s, int assume_action, int *malformed_list)) { directory_token_t *tok = NULL; const char *cp, *eos; /* Longest possible policy is * "accept6 [ffff:ffff:..255]/128:10000-65535", * which contains a max-length IPv6 address, plus 26 characters. * But note that there can be an arbitrary amount of space between the * accept and the address:mask/port element. * We don't need to multiply TOR_ADDR_BUF_LEN by 2, as there is only one * IPv6 address. But making the buffer shorter might cause valid long lines, * which parsed in previous versions, to fail to parse in new versions. * (These lines would have to have excessive amounts of whitespace.) */ char line[TOR_ADDR_BUF_LEN*2 + 32]; addr_policy_t *r; memarea_t *area = NULL; tor_assert(malformed_list); *malformed_list = 0; s = eat_whitespace(s); /* We can only do assume_action on []-quoted IPv6, as "a" (accept) * and ":" (port separator) are ambiguous */ if ((*s == '*' || *s == '[' || TOR_ISDIGIT(*s)) && assume_action >= 0) { if (tor_snprintf(line, sizeof(line), "%s %s", assume_action == ADDR_POLICY_ACCEPT?"accept":"reject", s)<0) { log_warn(LD_DIR, "Policy %s is too long.", escaped(s)); return NULL; } cp = line; tor_strlower(line); } else { /* assume an already well-formed address policy line */ cp = s; } eos = cp + strlen(cp); area = memarea_new(); tok = get_next_token(area, &cp, eos, routerdesc_token_table); if (tok->tp == ERR_) { log_warn(LD_DIR, "Error reading address policy: %s", tok->error); goto err; } if (tok->tp != K_ACCEPT && tok->tp != K_ACCEPT6 && tok->tp != K_REJECT && tok->tp != K_REJECT6) { log_warn(LD_DIR, "Expected 'accept' or 'reject'."); goto err; } /* Use the extended interpretation of accept/reject *, * expanding it into an IPv4 wildcard and an IPv6 wildcard. * Also permit *4 and *6 for IPv4 and IPv6 only wildcards. */ r = router_parse_addr_policy(tok, TAPMP_EXTENDED_STAR); if (!r) { goto err; } /* Ensure that accept6/reject6 fields are followed by IPv6 addresses. * AF_UNSPEC addresses are only permitted on the accept/reject field type. * Unlike descriptors, torrcs exit policy accept/reject can be followed by * either an IPv4 or IPv6 address. */ if ((tok->tp == K_ACCEPT6 || tok->tp == K_REJECT6) && tor_addr_family(&r->addr) != AF_INET6) { /* This is a non-fatal error, just ignore this one entry. */ *malformed_list = 0; log_warn(LD_DIR, "IPv4 address '%s' with accept6/reject6 field type in " "exit policy. Ignoring, but continuing to parse rules. (Use " "accept/reject with IPv4 addresses.)", tok->n_args == 1 ? tok->args[0] : ""); addr_policy_free(r); r = NULL; goto done; } goto done; err: *malformed_list = 1; r = NULL; done: token_clear(tok); if (area) { DUMP_AREA(area, "policy item"); memarea_drop_all(area); } return r; } /** Given a K_ACCEPT[6] or K_REJECT[6] token and a router, create and return * a new exit_policy_t corresponding to the token. If TAPMP_EXTENDED_STAR * is set in fmt_flags, K_ACCEPT6 and K_REJECT6 tokens followed by * * expand to IPv6-only policies, otherwise they expand to IPv4 and IPv6 * policies */ addr_policy_t * router_parse_addr_policy(directory_token_t *tok, unsigned fmt_flags) { addr_policy_t newe; char *arg; tor_assert(tok->tp == K_REJECT || tok->tp == K_REJECT6 || tok->tp == K_ACCEPT || tok->tp == K_ACCEPT6); if (tok->n_args != 1) return NULL; arg = tok->args[0]; if (!strcmpstart(arg,"private")) return router_parse_addr_policy_private(tok); memset(&newe, 0, sizeof(newe)); if (tok->tp == K_REJECT || tok->tp == K_REJECT6) newe.policy_type = ADDR_POLICY_REJECT; else newe.policy_type = ADDR_POLICY_ACCEPT; /* accept6/reject6 * produces an IPv6 wildcard address only. * (accept/reject * produces rules for IPv4 and IPv6 wildcard addresses.) */ if ((fmt_flags & TAPMP_EXTENDED_STAR) && (tok->tp == K_ACCEPT6 || tok->tp == K_REJECT6)) { fmt_flags |= TAPMP_STAR_IPV6_ONLY; } if (tor_addr_parse_mask_ports(arg, fmt_flags, &newe.addr, &newe.maskbits, &newe.prt_min, &newe.prt_max) < 0) { log_warn(LD_DIR,"Couldn't parse line %s. Dropping", escaped(arg)); return NULL; } addr_policy_t *result = addr_policy_get_canonical_entry(&newe); /* It would be a nasty error to return 'newe', and sometimes * addr_policy_get_canonical_entry() can return its argument. But in this * case, it won't, since newe is *not* canonical. We assert here to make * sure that the compiler knows it too. */ tor_assert(result != &newe); return result; } /** Parse an exit policy line of the format "accept[6]/reject[6] private:...". * This didn't exist until Tor 0.1.1.15, so nobody should generate it in * router descriptors until earlier versions are obsolete. * * accept/reject and accept6/reject6 private all produce rules for both * IPv4 and IPv6 addresses. */ static addr_policy_t * router_parse_addr_policy_private(directory_token_t *tok) { const char *arg; uint16_t port_min, port_max; addr_policy_t result; /* Safeguard: always flag non canonical because it is a stack allocated * object and thus should not be considered a copy stored in a map. */ result.is_canonical = 0; arg = tok->args[0]; if (strcmpstart(arg, "private")) return NULL; arg += strlen("private"); arg = (char*) eat_whitespace(arg); if (!arg || *arg != ':') return NULL; if (parse_port_range(arg+1, &port_min, &port_max)<0) return NULL; memset(&result, 0, sizeof(result)); if (tok->tp == K_REJECT || tok->tp == K_REJECT6) result.policy_type = ADDR_POLICY_REJECT; else result.policy_type = ADDR_POLICY_ACCEPT; result.is_private = 1; result.prt_min = port_min; result.prt_max = port_max; if (tok->tp == K_ACCEPT6 || tok->tp == K_REJECT6) { log_warn(LD_GENERAL, "'%s' expands into rules which apply to all private IPv4 and " "IPv6 addresses. (Use accept/reject private:* for IPv4 and " "IPv6.)", tok->n_args == 1 ? tok->args[0] : ""); } return addr_policy_get_canonical_entry(&result); }
b338390b28408dcdab7df333112eef6c7fa46599
8045349b3cc91d504e9eb0c7fffc729b67aacf09
/Pods/BuildHeaders/ROADFramework/ROAD/NSJSONSerialization+RFJSONStringHandling.h
19eb9d6ea473b9ca16053ae9563fcc5f95dc2e95
[ "Apache-2.0" ]
permissive
nikita-leonov/vtagra-ios
46cf1609f75cd7cf8ba4bd3587963e14d0fc5109
81a6764ee6abc34e721a9f7ce12ea1f40fcf770a
refs/heads/master
2021-01-10T18:49:36.580456
2014-05-09T16:57:11
2014-05-09T16:57:11
19,425,950
0
1
null
null
null
null
UTF-8
C
false
false
122
h
NSJSONSerialization+RFJSONStringHandling.h
../../../ROADFramework/Framework/ROADSerialization/ROADSerialization/Categories/NSJSONSerialization+RFJSONStringHandling.h
4e7a4fa70556586772dcc757b40250f3caea6aed
e7cb38a15026d156a11e4cf0ea61bed00b837abe
/groundwork-monitor-core/bronx/bronx_config.h
32c719307943cde4dc5487faeb1986472c1704e5
[]
no_license
wang-shun/groundwork-trunk
5e0ce72c739fc07f634aeefc8f4beb1c89f128af
ea1ca766fd690e75c3ee1ebe0ec17411bc651a76
refs/heads/master
2020-04-01T08:50:03.249587
2018-08-20T21:21:57
2018-08-20T21:21:57
null
0
0
null
null
null
null
UTF-8
C
false
false
4,881
h
bronx_config.h
/* * bronx_config.h * * Copyright (C) 2008-2012 Groundwork Open Source * Originally written by Daniel Emmanuel Feinsmith * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301, USA. * * Change Log: * 2007-10-16 DEF; Initial creation. * 2012-12-07 GH; Added more configuration parameters; * dropped obsolete/unused parameters. * 2012-12-10 GH; Implement forcibly closing idle connections. */ #ifndef _BRONX_CONFIG_H #define _BRONX_CONFIG_H #ifdef __cplusplus extern "C" { #endif #define BRONX_CONFIG_PATH_MAX 256 #define BRONX_CONFIG_FN_MAX 32 #define BRONX_CONFIG_TYPE_MAX 8 #define BRONX_CONFIG_ADDR_MAX 32 #define BRONX_CONFIG_NUM_ROUTES 64 #define BRONX_CONFIG_NUM_ALLOWED_HOST_RANGES 128 #define BRONX_MAX_INPUT_BUFFER 1024 #define BRONX_NAGIOS_CMD_DENY 0 #define BRONX_NAGIOS_CMD_ALLOW 1 #define BRONX_NAGIOS_CMD_PASSWD_ALLOW 2 #define BRONX_MAX_KEY_LEN 256 /* * Queue Insertion Method */ #define BRONX_QIM_IMMEDIATE 1 /* * Our configuration structure. */ typedef struct { char config_filename[BRONX_CONFIG_PATH_MAX]; // Full pathname of our bronx configuration file. /* * Configuration file options */ // Global options: int listener; char database_dir[BRONX_CONFIG_PATH_MAX]; int startup_pause_timer; // # of seconds to pause after startup before starting processing. int max_client_connections; int reserved_file_descriptor_count; // # of file descriptors to reserve for non-listener usage within Nagios and Bronx. int idle_connection_timeout; #ifdef INCLUDE_OBSOLETE_OPTIONS int queue_size; // In # of Entries. int soft_state_changes; // bool, are soft state changes processed? int spillover_on_queue_full; // bool, should we spillover if the queue is full? int seconds_between_reconnect_attempts; int consolidation; // bool, send consolidation message? unsigned long tcp_socket_timeout; // tcp socket timeout. int num_aggregators; // # of aggregators. Helpful to know, if 0, can save processing time. #endif // Listener configuration parameters int listener_port; char listener_address[BRONX_CONFIG_ADDR_MAX]; char listener_password[BRONX_MAX_INPUT_BUFFER]; int listener_encryption_method; unsigned long listener_max_packet_age; // limit on past-timestamp delta unsigned long listener_max_packet_imminence; // limit on future-timestamp delta char listener_allowed_hosts[BRONX_CONFIG_NUM_ALLOWED_HOST_RANGES][BRONX_CONFIG_ADDR_MAX]; int listener_num_allowed_hosts; int listener_nagios_cmd_execution; #ifdef INCLUDE_OBSOLETE_OPTIONS int max_plugin_output_len; #endif char log_filename[BRONX_CONFIG_PATH_MAX]; int use_client_timestamp; // bool. Should we use client timestamp for result packet received? /* Command acceptor paramters */ int cmd_acceptor_port; /* Maximum simultaneous connections allowed */ int cmd_acceptor_max_conn; /* Only DES and BLOWFISH are supported. */ int cmd_acceptor_encryption_method; /* Encryption/Decyption key */ char cmd_acceptor_key[BRONX_MAX_KEY_LEN]; /* Optional list of hosts (IP addresses) to be serviced. */ char cmd_acceptor_allowed_hosts[BRONX_CONFIG_NUM_ALLOWED_HOST_RANGES][BRONX_CONFIG_ADDR_MAX]; int cmd_acceptor_num_allowed_hosts; /* Nagios commands audit trail */ int audit_trail; char audit_trail_filename[BRONX_CONFIG_PATH_MAX]; char nagios_cmdpipe_filename[BRONX_CONFIG_PATH_MAX]; } configuration_criteria; extern configuration_criteria *_configuration; /* * Externally defined functions. */ extern void config_dump(configuration_criteria *); extern void config_set_defaults(configuration_criteria *config); extern int parse_args(configuration_criteria *config, char *args); extern int read_config_file(configuration_criteria *config); #ifdef __cplusplus } #endif #endif /* _BRONX_CONFIG_H */
1f32c73359266c4cef7d7a22eee9a4bc194f7eb2
efc4df3b77ac053878b617251676a025b698c99d
/libft/ft_strncat.c
b4adc2a9aa5d2a5826195853626d68a9afd0d011
[]
no_license
jrasoloh/42sh
7a8c61d51b563f6134c72b1d199ea2081e7c0806
e3d4cdc1331072a29e8005e87402a825e85cfaf2
refs/heads/master
2020-03-20T18:07:22.926963
2018-07-09T16:42:43
2018-07-09T16:42:43
137,572,004
0
0
null
null
null
null
UTF-8
C
false
false
1,151
c
ft_strncat.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strncat.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: echojnow <echojnow@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/11/08 12:12:56 by echojnow #+# #+# */ /* Updated: 2018/01/05 12:18:45 by echojnow ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" char *ft_strncat(char *s1, const char *s2, size_t n) { size_t s1_i; size_t s2_i; s1_i = ft_strlen(s1); s2_i = 0; while (s2[s2_i] != '\0' && s2_i < n) { s1[s1_i] = s2[s2_i]; s1_i++; s2_i++; } s1[s1_i] = '\0'; return (s1); }
0aa23ad254ebcc5aaf4dc36587167f25f677799b
220d416c488ca6b1539d84b856b03dba509b56b9
/incompressible/diffusiophoresisFoam/createFields.H
bcda30f2e9c2aa8185698db890d71f7b2804e341
[]
no_license
jtault/OpenFOAM_solvers
e276bc8cece05b26d61b11d1452312066c5d30e3
c26ac2a8530b2b0a006ab6d8f2e25ee5b7860c58
refs/heads/master
2021-01-20T11:10:37.174985
2017-10-17T14:20:59
2017-10-17T14:20:59
101,667,719
0
0
null
null
null
null
UTF-8
C
false
false
3,550
h
createFields.H
Info<< "Reading transportProperties\n" << endl; IOdictionary transportProperties ( IOobject ( "transportProperties", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); dimensionedScalar nu(transportProperties.lookup("nu")); Info<< "Reading field p\n" << endl; volScalarField p ( IOobject ( "p", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field U\n" << endl; volVectorField U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field Csalt\n" << endl; volScalarField Csalt ( IOobject ( "Csalt", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field CsaltGrad\n" << endl; volVectorField CsaltGrad ( IOobject ( "CsaltGrad", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field Cpart1\n" << endl; volScalarField Cpart1 ( IOobject ( "Cpart1", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field Cpart2\n" << endl; volScalarField Cpart2 ( IOobject ( "Cpart2", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field Cpart3\n" << endl; volScalarField Cpart3 ( IOobject ( "Cpart3", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field Cpart4\n" << endl; volScalarField Cpart4 ( IOobject ( "Cpart4", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field Cpart5\n" << endl; volScalarField Cpart5 ( IOobject ( "Cpart5", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); dimensionedScalar Dsalt(transportProperties.lookup("Dsalt")); dimensionedScalar Dpart1(transportProperties.lookup("Dpart1")); dimensionedScalar gammap1(transportProperties.lookup("gammap1")); dimensionedScalar Dpart2(transportProperties.lookup("Dpart2")); dimensionedScalar gammap2(transportProperties.lookup("gammap2")); dimensionedScalar Dpart3(transportProperties.lookup("Dpart3")); dimensionedScalar gammap3(transportProperties.lookup("gammap3")); dimensionedScalar Dpart4(transportProperties.lookup("Dpart4")); dimensionedScalar gammap4(transportProperties.lookup("gammap4")); dimensionedScalar Dpart5(transportProperties.lookup("Dpart5")); dimensionedScalar gammap5(transportProperties.lookup("gammap5")); dimensionedScalar timeFactor(transportProperties.lookup("timeFactor")); dimensionedScalar myTol(transportProperties.lookup("myTol")); dimensionedScalar numSteps(transportProperties.lookup("numSteps")); dimensionedScalar numIters(transportProperties.lookup("numIters")); dimensionedScalar minIters(transportProperties.lookup("minIters")); #include "createPhi.H" label pRefCell = 0; scalar pRefValue = 0.0; setRefCell(p, simple.dict(), pRefCell, pRefValue); mesh.setFluxRequired(p.name()); singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::turbulenceModel> turbulence ( incompressible::turbulenceModel::New(U, phi, laminarTransport) ); #include "createMRF.H"
6bda10d332a0d114c5a9b1aafa257e2338939863
f7a355c1953a456d0159876f7cd0f4c06c4f7fca
/projects/Keil/mb9bf61x/target_inthdr.c
69f47eff2e0036ce2a9ee5baaf32d3f326131bae
[ "BSD-2-Clause" ]
permissive
zhaogh/kos
95255a277637259296f11562f4415b55f2da42db
32e3947f7cd9ce63876b127cfd8da948ef84ee84
refs/heads/master
2022-01-12T23:43:50.442660
2019-07-21T22:50:45
2019-07-21T22:50:45
null
0
0
null
null
null
null
UTF-8
C
false
false
221
c
target_inthdr.c
#include <kos_arch.h> void USB0_Handler(void) { kos_arch_inthdr(); } void USB0F_Handler(void) { kos_arch_inthdr(); } void USB1_Handler(void) { kos_arch_inthdr(); } void USB1F_Handler(void) { kos_arch_inthdr(); }
eec8e92ec41e08710493a23ebc8c96fb8838d8d8
a33aac97878b2cb15677be26e308cbc46e2862d2
/program_data/PKU_raw/59/25.c
bbfa5167d0c5d9ce8c109899bda0600256f9ebde
[]
no_license
GabeOchieng/ggnn.tensorflow
f5d7d0bca52258336fc12c9de6ae38223f28f786
7c62c0e8427bea6c8bec2cebf157b6f1ea70a213
refs/heads/master
2022-05-30T11:17:42.278048
2020-05-02T11:33:31
2020-05-02T11:33:31
null
0
0
null
null
null
null
UTF-8
C
false
false
1,863
c
25.c
int number; char roms[MAXN][MAXN]; void days_go(); int count(); int main() { int renshu; int iter; int days; scanf("%d",&number); for(iter = 0 ; iter != number ;++iter) { scanf("%s",roms[iter]); } scanf("%d",&days); for(iter = 1 ; iter != days ; ++iter) { days_go(); } renshu = count(); printf("%d",renshu); return 0; } void days_go() { int iterout , iterin; int i,j; for(iterout = 0 ; iterout != number ; ++iterout) { for(iterin = 0 ; iterin != number ; ++iterin) { if('@' == roms[iterout][iterin]) { i= iterout-1; if(-1 !=j) { j= iterin; if('.' == roms[i][j]) { roms[i][j] = '!'; } } i = iterout; j= iterin-1; if(-1 != j) { if('.' == roms[i][j]) { roms[i][j] = '!'; } } j= iterin+1; if(number != j) { if('.' == roms[i][j]) { roms[i][j] = '!'; } } i= iterout+1; if(number != i) { j = iterin; if('.' == roms[i][j]) { roms[i][j] = '!'; } } } } } for(iterout = 0 ; iterout != number ; ++iterout) { for(iterin = 0 ; iterin != number ; ++iterin) { if('!' == roms[iterout][iterin]) { roms[iterout][iterin] = '@'; } } } } int count() { int total = 0; int iterout , iterin; for(iterout = 0 ; iterout != number ; ++iterout) { for(iterin = 0 ; iterin != number ; ++iterin) { if('@' == roms[iterout][iterin]) { ++total; } } } return total; }
b40f231cbf3627617b614a078ae7e1bf1ca77230
6b74f732d3c7102580ee3854d39ac062985c86dd
/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Renesas_Code/interrupt_handlers.c
08cb4028d13326c744c43dc5f91740759cbafdc1
[ "GPL-2.0-or-later", "freertos-exception-2.0", "MIT" ]
permissive
lundinc2/FreeRTOS-Labs
c88055958c313fb1c45528f88be5d6bc832fc18d
775033dac12fe9fb3d55ac8cca43b2991fdbef57
refs/heads/master
2022-12-22T23:38:08.564023
2020-09-22T00:00:10
2020-09-22T00:00:10
271,820,118
0
0
MIT
2020-06-12T14:40:25
2020-06-12T14:40:25
null
UTF-8
C
false
false
8,169
c
interrupt_handlers.c
/***************************************************************/ /* */ /* PROJECT NAME : RTOSDemo */ /* FILE : interrupt_handlers.c */ /* DESCRIPTION : Interrupt Handler */ /* CPU SERIES : RX100 */ /* CPU TYPE : RX113 */ /* */ /* This file is generated by e2 studio. */ /* */ /***************************************************************/ /************************************************************************/ /* File Version: V1.1A */ /* History : 1.00 (2013-11-18) [Hardware Manual Revision : 0.40] */ /* : 1.10 (2014-02-26) [Hardware Manual Revision : 0.50] */ /* : 1.1A (2015-04-20) [Hardware Manual Revision : 1.02] */ /* Date Generated: 25/05/2015 */ /************************************************************************/ #include "interrupt_handlers.h" // INT_Exception(Supervisor Instruction) void INT_Excep_SuperVisorInst(void){/* brk(){ } */} // INT_Exception(Undefined Instruction) void INT_Excep_UndefinedInst(void){/* brk(){ } */} // NMI void INT_NonMaskableInterrupt(void){/* brk(){ } */} // Dummy void INT_Dummy(void){/* brk(){ } */} // BRK void INT_Excep_BRK(void){/* wait();*/ } // BSC BUSERR void INT_Excep_BSC_BUSERR(void){ } // FCU FRDYI void INT_Excep_FCU_FRDYI(void){ } // ICU SWINT void INT_Excep_ICU_SWINT(void){ } // CMT0 CMI0 void INT_Excep_CMT0_CMI0(void){ } // CMT1 CMI1 void INT_Excep_CMT1_CMI1(void){ } // CMT2 CMI2 void INT_Excep_CMT2_CMI2(void){ } // CMT3 CMI3 void INT_Excep_CMT3_CMI3(void){ } // CAC FERRF void INT_Excep_CAC_FERRF(void){ } // CAC MENDF void INT_Excep_CAC_MENDF(void){ } // CAC OVFF void INT_Excep_CAC_OVFF(void){ } // USB0 D0FIFO0 void INT_Excep_USB0_D0FIFO0(void){ } // USB0 D1FIFO0 void INT_Excep_USB0_D1FIFO0(void){ } // USB0 USBI0 void INT_Excep_USB0_USBI0(void){ } // RSPI0 SPEI0 void INT_Excep_RSPI0_SPEI0(void){ } // RSPI0 SPRI0 void INT_Excep_RSPI0_SPRI0(void){ } // RSPI0 SPTI0 void INT_Excep_RSPI0_SPTI0(void){ } // RSPI0 SPII0 void INT_Excep_RSPI0_SPII0(void){ } // DOC DOPCF void INT_Excep_DOC_DOPCF(void){ } // CMPB CMPB0 void INT_Excep_CMPB_CMPB0(void){ } // CMPB CMPB1 void INT_Excep_CMPB_CMPB1(void){ } // CTSU CTSUWR void INT_Excep_CTSU_CTSUWR(void){ } // CTSU CTSURD void INT_Excep_CTSU_CTSURD(void){ } // CTSU CTSUFN void INT_Excep_CTSU_CTSUFN(void){ } // RTC CUP void INT_Excep_RTC_CUP(void){ } // ICU IRQ0 void INT_Excep_ICU_IRQ0(void){ } // ICU IRQ1 void INT_Excep_ICU_IRQ1(void){ } // ICU IRQ2 void INT_Excep_ICU_IRQ2(void){ } // ICU IRQ3 void INT_Excep_ICU_IRQ3(void){ } // ICU IRQ4 void INT_Excep_ICU_IRQ4(void){ } // ICU IRQ5 void INT_Excep_ICU_IRQ5(void){ } // ICU IRQ6 void INT_Excep_ICU_IRQ6(void){ } // ICU IRQ7 void INT_Excep_ICU_IRQ7(void){ } // ELC ELSR8I void INT_Excep_ELC_ELSR8I(void){ } // LVD LVD1 void INT_Excep_LVD_LVD1(void){ } // LVD LVD2 void INT_Excep_LVD_LVD2(void){ } // USB0 USBR0 void INT_Excep_USB0_USBR0(void){ } // RTC ALM void INT_Excep_RTC_ALM(void){ } // RTC PRD void INT_Excep_RTC_PRD(void){ } // S12AD S12ADI0 void INT_Excep_S12AD_S12ADI0(void){ } // S12AD GBADI void INT_Excep_S12AD_GBADI(void){ } // ELC ELSR18I void INT_Excep_ELC_ELSR18I(void){ } // SSI0 SSIF0 void INT_Excep_SSI0_SSIF0(void){ } // SSI0 SSIRXI0 void INT_Excep_SSI0_SSIRXI0(void){ } // SSI0 SSITXI0 void INT_Excep_SSI0_SSITXI0(void){ } // MTU0 TGIA0 void INT_Excep_MTU0_TGIA0(void){ } // MTU0 TGIB0 void INT_Excep_MTU0_TGIB0(void){ } // MTU0 TGIC0 void INT_Excep_MTU0_TGIC0(void){ } // MTU0 TGID0 void INT_Excep_MTU0_TGID0(void){ } // MTU0 TCIV0 void INT_Excep_MTU0_TCIV0(void){ } // MTU0 TGIE0 void INT_Excep_MTU0_TGIE0(void){ } // MTU0 TGIF0 void INT_Excep_MTU0_TGIF0(void){ } // MTU1 TGIA1 void INT_Excep_MTU1_TGIA1(void){ } // MTU1 TGIB1 void INT_Excep_MTU1_TGIB1(void){ } // MTU1 TCIV1 void INT_Excep_MTU1_TCIV1(void){ } // MTU1 TCIU1 void INT_Excep_MTU1_TCIU1(void){ } // MTU2 TGIA2 void INT_Excep_MTU2_TGIA2(void){ } // MTU2 TGIB2 void INT_Excep_MTU2_TGIB2(void){ } // MTU2 TCIV2 void INT_Excep_MTU2_TCIV2(void){ } // MTU2 TCIU2 void INT_Excep_MTU2_TCIU2(void){ } // MTU3 TGIA3 void INT_Excep_MTU3_TGIA3(void){ } // MTU3 TGIB3 void INT_Excep_MTU3_TGIB3(void){ } // MTU3 TGIC3 void INT_Excep_MTU3_TGIC3(void){ } // MTU3 TGID3 void INT_Excep_MTU3_TGID3(void){ } // MTU3 TCIV3 void INT_Excep_MTU3_TCIV3(void){ } // MTU4 TGIA4 void INT_Excep_MTU4_TGIA4(void){ } // MTU4 TGIB4 void INT_Excep_MTU4_TGIB4(void){ } // MTU4 TGIC4 void INT_Excep_MTU4_TGIC4(void){ } // MTU4 TGID4 void INT_Excep_MTU4_TGID4(void){ } // MTU4 TCIV4 void INT_Excep_MTU4_TCIV4(void){ } // MTU5 TGIU5 void INT_Excep_MTU5_TGIU5(void){ } // MTU5 TGIV5 void INT_Excep_MTU5_TGIV5(void){ } // MTU5 TGIW5 void INT_Excep_MTU5_TGIW5(void){ } // POE OEI1 void INT_Excep_POE_OEI1(void){ } // POE OEI2 void INT_Excep_POE_OEI2(void){ } // TMR0 CMIA0 void INT_Excep_TMR0_CMIA0(void){ } // TMR0 CMIB0 void INT_Excep_TMR0_CMIB0(void){ } // TMR0 OVI0 void INT_Excep_TMR0_OVI0(void){ } // TMR1 CMIA1 void INT_Excep_TMR1_CMIA1(void){ } // TMR1 CMIB1 void INT_Excep_TMR1_CMIB1(void){ } // TMR1 OVI1 void INT_Excep_TMR1_OVI1(void){ } // TMR2 CMIA2 void INT_Excep_TMR2_CMIA2(void){ } // TMR2 CMIB2 void INT_Excep_TMR2_CMIB2(void){ } // TMR2 OVI2 void INT_Excep_TMR2_OVI2(void){ } // TMR3 CMIA3 void INT_Excep_TMR3_CMIA3(void){ } // TMR3 CMIB3 void INT_Excep_TMR3_CMIB3(void){ } // TMR3 OVI3 void INT_Excep_TMR3_OVI3(void){ } // SCI2 ERI2 void INT_Excep_SCI2_ERI2(void){ } // SCI2 RXI2 void INT_Excep_SCI2_RXI2(void){ } // SCI2 TXI2 void INT_Excep_SCI2_TXI2(void){ } // SCI2 TEI2 void INT_Excep_SCI2_TEI2(void){ } // SCI0 ERI0 void INT_Excep_SCI0_ERI0(void){ } // SCI0 RXI0 void INT_Excep_SCI0_RXI0(void){ } // SCI0 TXI0 void INT_Excep_SCI0_TXI0(void){ } // SCI0 TEI0 void INT_Excep_SCI0_TEI0(void){ } // SCI1 ERI1 void INT_Excep_SCI1_ERI1(void){ } // SCI1 RXI1 void INT_Excep_SCI1_RXI1(void){ } // SCI1 TXI1 void INT_Excep_SCI1_TXI1(void){ } // SCI1 TEI1 void INT_Excep_SCI1_TEI1(void){ } // SCI5 ERI5 void INT_Excep_SCI5_ERI5(void){ } // SCI5 RXI5 void INT_Excep_SCI5_RXI5(void){ } // SCI5 TXI5 void INT_Excep_SCI5_TXI5(void){ } // SCI5 TEI5 void INT_Excep_SCI5_TEI5(void){ } // SCI6 ERI6 void INT_Excep_SCI6_ERI6(void){ } // SCI6 RXI6 void INT_Excep_SCI6_RXI6(void){ } // SCI6 TXI6 void INT_Excep_SCI6_TXI6(void){ } // SCI6 TEI6 void INT_Excep_SCI6_TEI6(void){ } // SCI8 ERI8 void INT_Excep_SCI8_ERI8(void){ } // SCI8 RXI8 void INT_Excep_SCI8_RXI8(void){ } // SCI8 TXI8 void INT_Excep_SCI8_TXI8(void){ } // SCI8 TEI8 void INT_Excep_SCI8_TEI8(void){ } // SCI9 ERI9 void INT_Excep_SCI9_ERI9(void){ } // SCI9 RXI9 void INT_Excep_SCI9_RXI9(void){ } // SCI9 TXI9 void INT_Excep_SCI9_TXI9(void){ } // SCI9 TEI9 void INT_Excep_SCI9_TEI9(void){ } // SCI12 ERI12 void INT_Excep_SCI12_ERI12(void){ } // SCI12 RXI12 void INT_Excep_SCI12_RXI12(void){ } // SCI12 TXI12 void INT_Excep_SCI12_TXI12(void){ } // SCI12 TEI12 void INT_Excep_SCI12_TEI12(void){ } // SCI12 SCIX0 void INT_Excep_SCI12_SCIX0(void){ } // SCI12 SCIX1 void INT_Excep_SCI12_SCIX1(void){ } // SCI12 SCIX2 void INT_Excep_SCI12_SCIX2(void){ } // SCI12 SCIX3 void INT_Excep_SCI12_SCIX3(void){ } // RIIC0 EEI0 void INT_Excep_RIIC0_EEI0(void){ } // RIIC0 RXI0 void INT_Excep_RIIC0_RXI0(void){ } // RIIC0 TXI0 void INT_Excep_RIIC0_TXI0(void){ } // RIIC0 TEI0 void INT_Excep_RIIC0_TEI0(void){ }
5d89bb6da92326680c73dee20939bc04e405a47c
0b352edbf5adb4f32aeae03d05b23c23383b43fc
/src/NDL_directmedia.c
2392a83e3d1123c4983a5133baf7cf9ebe5c5ec3
[]
no_license
webosbrew/libndl
174d7f31dd4b82f8ae7f7901c0b0039814d3aef3
4b1d56b2491a54cbbead9b5012c46fb7104c589d
refs/heads/main
2023-03-31T17:52:27.736953
2021-04-05T02:48:25
2021-04-05T02:48:25
324,393,625
3
0
null
null
null
null
UTF-8
C
false
false
3,934
c
NDL_directmedia.c
#include "NDL_directmedia.h" #include <dlfcn.h> typedef void *(*wrapper_func)(); static void *_NDL_directmedia_so = NULL; static char *_NDL_directmedia_so_dlerr = NULL; static wrapper_func _NDL_DirectMediaInit; static wrapper_func _NDL_DirectMediaGetError; static wrapper_func _NDL_DirectMediaSetAppState; static wrapper_func _NDL_DirectMediaQuit; static wrapper_func _NDL_DirectAudioOpen; static wrapper_func _NDL_DirectAudioClose; static wrapper_func _NDL_DirectAudioPause; static wrapper_func _NDL_DirectAudioPlay; static wrapper_func _NDL_DirectAudioResume; static wrapper_func _NDL_DirectAudioCheckBufferSize; static wrapper_func _NDL_DirectVideoOpen; static wrapper_func _NDL_DirectVideoClose; static wrapper_func _NDL_DirectVideoPlay; static wrapper_func _NDL_DirectVideoStop; static wrapper_func _NDL_DirectVideoSetArea; int NDL_DirectMediaInit(const char *appid, NDLInitCallback cb) { if (!_NDL_directmedia_so) { _NDL_directmedia_so = dlopen("libNDL_directmedia.so.1", RTLD_NOW); if (!_NDL_directmedia_so) { _NDL_directmedia_so_dlerr = dlerror(); return -1; } _NDL_DirectMediaInit = dlsym(_NDL_directmedia_so, "NDL_DirectMediaInit"); _NDL_DirectMediaGetError = dlsym(_NDL_directmedia_so, "NDL_DirectMediaGetError"); _NDL_DirectMediaSetAppState = dlsym(_NDL_directmedia_so, "NDL_DirectMediaSetAppState"); _NDL_DirectMediaQuit = dlsym(_NDL_directmedia_so, "NDL_DirectMediaQuit"); _NDL_DirectAudioOpen = dlsym(_NDL_directmedia_so, "NDL_DirectAudioOpen"); _NDL_DirectAudioClose = dlsym(_NDL_directmedia_so, "NDL_DirectAudioClose"); _NDL_DirectAudioPause = dlsym(_NDL_directmedia_so, "NDL_DirectAudioPause"); _NDL_DirectAudioPlay = dlsym(_NDL_directmedia_so, "NDL_DirectAudioPlay"); _NDL_DirectAudioResume = dlsym(_NDL_directmedia_so, "NDL_DirectAudioResume"); _NDL_DirectAudioCheckBufferSize = dlsym(_NDL_directmedia_so, "NDL_DirectAudioCheckBufferSize"); _NDL_DirectVideoOpen = dlsym(_NDL_directmedia_so, "NDL_DirectVideoOpen"); _NDL_DirectVideoClose = dlsym(_NDL_directmedia_so, "NDL_DirectVideoClose"); _NDL_DirectVideoPlay = dlsym(_NDL_directmedia_so, "NDL_DirectVideoPlay"); _NDL_DirectVideoStop = dlsym(_NDL_directmedia_so, "NDL_DirectVideoStop"); _NDL_DirectVideoSetArea = dlsym(_NDL_directmedia_so, "NDL_DirectVideoSetArea"); } return (int)_NDL_DirectMediaInit(appid, cb); } char *NDL_DirectMediaGetError() { if (!_NDL_directmedia_so) { return _NDL_directmedia_so_dlerr; } return _NDL_DirectMediaGetError(); } int NDL_DirectMediaSetAppState(NDL_DIRECTMEDIA_APP_STATE_T state) { return (int)_NDL_DirectMediaSetAppState(state); } void NDL_DirectMediaQuit() { if (!_NDL_directmedia_so) { return; } _NDL_DirectMediaQuit(); dlclose(_NDL_directmedia_so); } int NDL_DirectAudioOpen(NDL_DIRECTAUDIO_DATA_INFO *info) { return (int)_NDL_DirectAudioOpen(info); } int NDL_DirectAudioClose() { return (int)_NDL_DirectAudioClose(); } int NDL_DirectAudioPause() { return (int)_NDL_DirectAudioPause(); } int NDL_DirectAudioPlay(void *data, size_t size) { return (int)_NDL_DirectAudioPlay(data, size); } int NDL_DirectAudioResume() { return (int)_NDL_DirectAudioResume(); } int NDL_DirectAudioCheckBufferSize(unsigned int *size) { return (int)_NDL_DirectAudioCheckBufferSize(size); } int NDL_DirectVideoOpen(NDL_DIRECTVIDEO_DATA_INFO *info) { return (int)_NDL_DirectVideoOpen(info); } int NDL_DirectVideoClose() { return (int)_NDL_DirectVideoClose(); } int NDL_DirectVideoPlay(void *data, size_t size) { return (int)_NDL_DirectVideoPlay(data, size); } int NDL_DirectVideoStop() { return (int)_NDL_DirectVideoStop(); } int NDL_DirectVideoSetArea(int x, int y, int w, int h) { return (int)_NDL_DirectVideoSetArea(x, y, w, h); }
3a9e7d238920a57b179c7ca6883a5fc0bff94cb9
de8c0ea84980b6d9bb6e3e23b87e6066a65f4995
/3pp/linux/drivers/pinctrl/sh-pfc/pfc-sh7722.c
95295be4e703db9ceab0593102dbe6ccedef784c
[ "MIT", "Linux-syscall-note", "GPL-2.0-only" ]
permissive
eerimoq/monolinux-example-project
7cc19c6fc179a6d1fd3ec60f383f906b727e6715
57c4c2928b11cc04db59fb5ced962762099a9895
refs/heads/master
2021-02-08T10:57:58.215466
2020-07-02T08:04:25
2020-07-02T08:04:25
244,144,570
6
0
MIT
2020-07-02T08:15:50
2020-03-01T12:24:47
C
UTF-8
C
false
false
52,749
c
pfc-sh7722.c
// SPDX-License-Identifier: GPL-2.0 #include <linux/init.h> #include <linux/kernel.h> #include <linux/gpio.h> #include <cpu/sh7722.h> #include "sh_pfc.h" enum { PINMUX_RESERVED = 0, PINMUX_DATA_BEGIN, PTA7_DATA, PTA6_DATA, PTA5_DATA, PTA4_DATA, PTA3_DATA, PTA2_DATA, PTA1_DATA, PTA0_DATA, PTB7_DATA, PTB6_DATA, PTB5_DATA, PTB4_DATA, PTB3_DATA, PTB2_DATA, PTB1_DATA, PTB0_DATA, PTC7_DATA, PTC5_DATA, PTC4_DATA, PTC3_DATA, PTC2_DATA, PTC0_DATA, PTD7_DATA, PTD6_DATA, PTD5_DATA, PTD4_DATA, PTD3_DATA, PTD2_DATA, PTD1_DATA, PTD0_DATA, PTE7_DATA, PTE6_DATA, PTE5_DATA, PTE4_DATA, PTE1_DATA, PTE0_DATA, PTF6_DATA, PTF5_DATA, PTF4_DATA, PTF3_DATA, PTF2_DATA, PTF1_DATA, PTF0_DATA, PTG4_DATA, PTG3_DATA, PTG2_DATA, PTG1_DATA, PTG0_DATA, PTH7_DATA, PTH6_DATA, PTH5_DATA, PTH4_DATA, PTH3_DATA, PTH2_DATA, PTH1_DATA, PTH0_DATA, PTJ7_DATA, PTJ6_DATA, PTJ5_DATA, PTJ1_DATA, PTJ0_DATA, PTK6_DATA, PTK5_DATA, PTK4_DATA, PTK3_DATA, PTK2_DATA, PTK1_DATA, PTK0_DATA, PTL7_DATA, PTL6_DATA, PTL5_DATA, PTL4_DATA, PTL3_DATA, PTL2_DATA, PTL1_DATA, PTL0_DATA, PTM7_DATA, PTM6_DATA, PTM5_DATA, PTM4_DATA, PTM3_DATA, PTM2_DATA, PTM1_DATA, PTM0_DATA, PTN7_DATA, PTN6_DATA, PTN5_DATA, PTN4_DATA, PTN3_DATA, PTN2_DATA, PTN1_DATA, PTN0_DATA, PTQ6_DATA, PTQ5_DATA, PTQ4_DATA, PTQ3_DATA, PTQ2_DATA, PTQ1_DATA, PTQ0_DATA, PTR4_DATA, PTR3_DATA, PTR2_DATA, PTR1_DATA, PTR0_DATA, PTS4_DATA, PTS3_DATA, PTS2_DATA, PTS1_DATA, PTS0_DATA, PTT4_DATA, PTT3_DATA, PTT2_DATA, PTT1_DATA, PTT0_DATA, PTU4_DATA, PTU3_DATA, PTU2_DATA, PTU1_DATA, PTU0_DATA, PTV4_DATA, PTV3_DATA, PTV2_DATA, PTV1_DATA, PTV0_DATA, PTW6_DATA, PTW5_DATA, PTW4_DATA, PTW3_DATA, PTW2_DATA, PTW1_DATA, PTW0_DATA, PTX6_DATA, PTX5_DATA, PTX4_DATA, PTX3_DATA, PTX2_DATA, PTX1_DATA, PTX0_DATA, PTY6_DATA, PTY5_DATA, PTY4_DATA, PTY3_DATA, PTY2_DATA, PTY1_DATA, PTY0_DATA, PTZ5_DATA, PTZ4_DATA, PTZ3_DATA, PTZ2_DATA, PTZ1_DATA, PTZ0_DATA, PINMUX_DATA_END, PINMUX_INPUT_BEGIN, PTA7_IN, PTA6_IN, PTA5_IN, PTA4_IN, PTA3_IN, PTA2_IN, PTA1_IN, PTA0_IN, PTB7_IN, PTB6_IN, PTB5_IN, PTB4_IN, PTB3_IN, PTB2_IN, PTB1_IN, PTB0_IN, PTC7_IN, PTC5_IN, PTC4_IN, PTC3_IN, PTC2_IN, PTC0_IN, PTD7_IN, PTD6_IN, PTD5_IN, PTD4_IN, PTD3_IN, PTD2_IN, PTD1_IN, PTE7_IN, PTE6_IN, PTE5_IN, PTE4_IN, PTE1_IN, PTE0_IN, PTF6_IN, PTF5_IN, PTF4_IN, PTF3_IN, PTF2_IN, PTF1_IN, PTH6_IN, PTH5_IN, PTH1_IN, PTH0_IN, PTJ1_IN, PTJ0_IN, PTK6_IN, PTK5_IN, PTK4_IN, PTK3_IN, PTK2_IN, PTK0_IN, PTL7_IN, PTL6_IN, PTL5_IN, PTL4_IN, PTL3_IN, PTL2_IN, PTL1_IN, PTL0_IN, PTM7_IN, PTM6_IN, PTM5_IN, PTM4_IN, PTM3_IN, PTM2_IN, PTM1_IN, PTM0_IN, PTN7_IN, PTN6_IN, PTN5_IN, PTN4_IN, PTN3_IN, PTN2_IN, PTN1_IN, PTN0_IN, PTQ5_IN, PTQ4_IN, PTQ3_IN, PTQ2_IN, PTQ0_IN, PTR2_IN, PTS4_IN, PTS2_IN, PTS1_IN, PTT4_IN, PTT3_IN, PTT2_IN, PTT1_IN, PTU4_IN, PTU3_IN, PTU2_IN, PTU1_IN, PTU0_IN, PTV4_IN, PTV3_IN, PTV2_IN, PTV1_IN, PTV0_IN, PTW6_IN, PTW4_IN, PTW3_IN, PTW2_IN, PTW1_IN, PTW0_IN, PTX6_IN, PTX5_IN, PTX4_IN, PTX3_IN, PTX2_IN, PTX1_IN, PTX0_IN, PTY5_IN, PTY4_IN, PTY3_IN, PTY2_IN, PTY0_IN, PTZ5_IN, PTZ4_IN, PTZ3_IN, PTZ2_IN, PTZ1_IN, PINMUX_INPUT_END, PINMUX_OUTPUT_BEGIN, PTA7_OUT, PTA5_OUT, PTB7_OUT, PTB6_OUT, PTB5_OUT, PTB4_OUT, PTB3_OUT, PTB2_OUT, PTB1_OUT, PTB0_OUT, PTC4_OUT, PTC3_OUT, PTC2_OUT, PTC0_OUT, PTD6_OUT, PTD5_OUT, PTD4_OUT, PTD3_OUT, PTD2_OUT, PTD1_OUT, PTD0_OUT, PTE7_OUT, PTE6_OUT, PTE5_OUT, PTE4_OUT, PTE1_OUT, PTE0_OUT, PTF6_OUT, PTF5_OUT, PTF4_OUT, PTF3_OUT, PTF2_OUT, PTF0_OUT, PTG4_OUT, PTG3_OUT, PTG2_OUT, PTG1_OUT, PTG0_OUT, PTH7_OUT, PTH6_OUT, PTH5_OUT, PTH4_OUT, PTH3_OUT, PTH2_OUT, PTH1_OUT, PTH0_OUT, PTJ7_OUT, PTJ6_OUT, PTJ5_OUT, PTJ1_OUT, PTJ0_OUT, PTK6_OUT, PTK5_OUT, PTK4_OUT, PTK3_OUT, PTK1_OUT, PTK0_OUT, PTL7_OUT, PTL6_OUT, PTL5_OUT, PTL4_OUT, PTL3_OUT, PTL2_OUT, PTL1_OUT, PTL0_OUT, PTM7_OUT, PTM6_OUT, PTM5_OUT, PTM4_OUT, PTM3_OUT, PTM2_OUT, PTM1_OUT, PTM0_OUT, PTN7_OUT, PTN6_OUT, PTN5_OUT, PTN4_OUT, PTN3_OUT, PTN2_OUT, PTN1_OUT, PTN0_OUT, PTQ6_OUT, PTQ5_OUT, PTQ4_OUT, PTQ3_OUT, PTQ2_OUT, PTQ1_OUT, PTQ0_OUT, PTR4_OUT, PTR3_OUT, PTR1_OUT, PTR0_OUT, PTS3_OUT, PTS2_OUT, PTS0_OUT, PTT4_OUT, PTT3_OUT, PTT2_OUT, PTT0_OUT, PTU4_OUT, PTU3_OUT, PTU2_OUT, PTU0_OUT, PTV4_OUT, PTV3_OUT, PTV2_OUT, PTV1_OUT, PTV0_OUT, PTW5_OUT, PTW4_OUT, PTW3_OUT, PTW2_OUT, PTW1_OUT, PTW0_OUT, PTX6_OUT, PTX5_OUT, PTX4_OUT, PTX3_OUT, PTX2_OUT, PTX1_OUT, PTX0_OUT, PTY5_OUT, PTY4_OUT, PTY3_OUT, PTY2_OUT, PTY1_OUT, PTY0_OUT, PINMUX_OUTPUT_END, PINMUX_MARK_BEGIN, SCIF0_TXD_MARK, SCIF0_RXD_MARK, SCIF0_RTS_MARK, SCIF0_CTS_MARK, SCIF0_SCK_MARK, SCIF1_TXD_MARK, SCIF1_RXD_MARK, SCIF1_RTS_MARK, SCIF1_CTS_MARK, SCIF1_SCK_MARK, SCIF2_TXD_MARK, SCIF2_RXD_MARK, SCIF2_RTS_MARK, SCIF2_CTS_MARK, SCIF2_SCK_MARK, SIOTXD_MARK, SIORXD_MARK, SIOD_MARK, SIOSTRB0_MARK, SIOSTRB1_MARK, SIOSCK_MARK, SIOMCK_MARK, VIO_D15_MARK, VIO_D14_MARK, VIO_D13_MARK, VIO_D12_MARK, VIO_D11_MARK, VIO_D10_MARK, VIO_D9_MARK, VIO_D8_MARK, VIO_D7_MARK, VIO_D6_MARK, VIO_D5_MARK, VIO_D4_MARK, VIO_D3_MARK, VIO_D2_MARK, VIO_D1_MARK, VIO_D0_MARK, VIO_CLK_MARK, VIO_VD_MARK, VIO_HD_MARK, VIO_FLD_MARK, VIO_CKO_MARK, VIO_STEX_MARK, VIO_STEM_MARK, VIO_VD2_MARK, VIO_HD2_MARK, VIO_CLK2_MARK, LCDD23_MARK, LCDD22_MARK, LCDD21_MARK, LCDD20_MARK, LCDD19_MARK, LCDD18_MARK, LCDD17_MARK, LCDD16_MARK, LCDD15_MARK, LCDD14_MARK, LCDD13_MARK, LCDD12_MARK, LCDD11_MARK, LCDD10_MARK, LCDD9_MARK, LCDD8_MARK, LCDD7_MARK, LCDD6_MARK, LCDD5_MARK, LCDD4_MARK, LCDD3_MARK, LCDD2_MARK, LCDD1_MARK, LCDD0_MARK, LCDLCLK_MARK, LCDDON_MARK, LCDVCPWC_MARK, LCDVEPWC_MARK, LCDVSYN_MARK, LCDDCK_MARK, LCDHSYN_MARK, LCDDISP_MARK, LCDRS_MARK, LCDCS_MARK, LCDWR_MARK, LCDRD_MARK, LCDDON2_MARK, LCDVCPWC2_MARK, LCDVEPWC2_MARK, LCDVSYN2_MARK, LCDCS2_MARK, IOIS16_MARK, A25_MARK, A24_MARK, A23_MARK, A22_MARK, BS_MARK, CS6B_CE1B_MARK, WAIT_MARK, CS6A_CE2B_MARK, HPD63_MARK, HPD62_MARK, HPD61_MARK, HPD60_MARK, HPD59_MARK, HPD58_MARK, HPD57_MARK, HPD56_MARK, HPD55_MARK, HPD54_MARK, HPD53_MARK, HPD52_MARK, HPD51_MARK, HPD50_MARK, HPD49_MARK, HPD48_MARK, HPDQM7_MARK, HPDQM6_MARK, HPDQM5_MARK, HPDQM4_MARK, IRQ0_MARK, IRQ1_MARK, IRQ2_MARK, IRQ3_MARK, IRQ4_MARK, IRQ5_MARK, IRQ6_MARK, IRQ7_MARK, SDHICD_MARK, SDHIWP_MARK, SDHID3_MARK, SDHID2_MARK, SDHID1_MARK, SDHID0_MARK, SDHICMD_MARK, SDHICLK_MARK, SIUAOLR_MARK, SIUAOBT_MARK, SIUAISLD_MARK, SIUAILR_MARK, SIUAIBT_MARK, SIUAOSLD_MARK, SIUMCKA_MARK, SIUFCKA_MARK, SIUBOLR_MARK, SIUBOBT_MARK, SIUBISLD_MARK, SIUBILR_MARK, SIUBIBT_MARK, SIUBOSLD_MARK, SIUMCKB_MARK, SIUFCKB_MARK, AUDSYNC_MARK, AUDATA3_MARK, AUDATA2_MARK, AUDATA1_MARK, AUDATA0_MARK, DACK_MARK, DREQ0_MARK, DV_CLKI_MARK, DV_CLK_MARK, DV_HSYNC_MARK, DV_VSYNC_MARK, DV_D15_MARK, DV_D14_MARK, DV_D13_MARK, DV_D12_MARK, DV_D11_MARK, DV_D10_MARK, DV_D9_MARK, DV_D8_MARK, DV_D7_MARK, DV_D6_MARK, DV_D5_MARK, DV_D4_MARK, DV_D3_MARK, DV_D2_MARK, DV_D1_MARK, DV_D0_MARK, STATUS0_MARK, PDSTATUS_MARK, SIOF0_MCK_MARK, SIOF0_SCK_MARK, SIOF0_SYNC_MARK, SIOF0_SS1_MARK, SIOF0_SS2_MARK, SIOF0_TXD_MARK, SIOF0_RXD_MARK, SIOF1_MCK_MARK, SIOF1_SCK_MARK, SIOF1_SYNC_MARK, SIOF1_SS1_MARK, SIOF1_SS2_MARK, SIOF1_TXD_MARK, SIOF1_RXD_MARK, SIM_D_MARK, SIM_CLK_MARK, SIM_RST_MARK, TS_SDAT_MARK, TS_SCK_MARK, TS_SDEN_MARK, TS_SPSYNC_MARK, IRDA_IN_MARK, IRDA_OUT_MARK, TPUTO_MARK, FCE_MARK, NAF7_MARK, NAF6_MARK, NAF5_MARK, NAF4_MARK, NAF3_MARK, NAF2_MARK, NAF1_MARK, NAF0_MARK, FCDE_MARK, FOE_MARK, FSC_MARK, FWE_MARK, FRB_MARK, KEYIN0_MARK, KEYIN1_MARK, KEYIN2_MARK, KEYIN3_MARK, KEYIN4_MARK, KEYOUT0_MARK, KEYOUT1_MARK, KEYOUT2_MARK, KEYOUT3_MARK, KEYOUT4_IN6_MARK, KEYOUT5_IN5_MARK, PINMUX_MARK_END, PINMUX_FUNCTION_BEGIN, VIO_D7_SCIF1_SCK, VIO_D6_SCIF1_RXD, VIO_D5_SCIF1_TXD, VIO_D4, VIO_D3, VIO_D2, VIO_D1, VIO_D0_LCDLCLK, HPD55, HPD54, HPD53, HPD52, HPD51, HPD50, HPD49, HPD48, IOIS16, HPDQM7, HPDQM6, HPDQM5, HPDQM4, SDHICD, SDHIWP, SDHID3, IRQ2_SDHID2, SDHID1, SDHID0, SDHICMD, SDHICLK, A25, A24, A23, A22, IRQ5, IRQ4_BS, PTF6, SIOSCK_SIUBOBT, SIOSTRB1_SIUBOLR, SIOSTRB0_SIUBIBT, SIOD_SIUBILR, SIORXD_SIUBISLD, SIOTXD_SIUBOSLD, AUDSYNC, AUDATA3, AUDATA2, AUDATA1, AUDATA0, LCDVCPWC_LCDVCPWC2, LCDVSYN2_DACK, LCDVSYN, LCDDISP_LCDRS, LCDHSYN_LCDCS, LCDDON_LCDDON2, LCDD17_DV_HSYNC, LCDD16_DV_VSYNC, STATUS0, PDSTATUS, IRQ1, IRQ0, SIUAILR_SIOF1_SS2, SIUAIBT_SIOF1_SS1, SIUAOLR_SIOF1_SYNC, SIUAOBT_SIOF1_SCK, SIUAISLD_SIOF1_RXD, SIUAOSLD_SIOF1_TXD, PTK0, LCDD15_DV_D15, LCDD14_DV_D14, LCDD13_DV_D13, LCDD12_DV_D12, LCDD11_DV_D11, LCDD10_DV_D10, LCDD9_DV_D9, LCDD8_DV_D8, LCDD7_DV_D7, LCDD6_DV_D6, LCDD5_DV_D5, LCDD4_DV_D4, LCDD3_DV_D3, LCDD2_DV_D2, LCDD1_DV_D1, LCDD0_DV_D0, HPD63, HPD62, HPD61, HPD60, HPD59, HPD58, HPD57, HPD56, SIOF0_SS2_SIM_RST, SIOF0_SS1_TS_SPSYNC, SIOF0_SYNC_TS_SDEN, SIOF0_SCK_TS_SCK, PTQ2, PTQ1, PTQ0, LCDRD, CS6B_CE1B_LCDCS2, WAIT, LCDDCK_LCDWR, LCDVEPWC_LCDVEPWC2, SCIF0_CTS_SIUAISPD, SCIF0_RTS_SIUAOSPD, SCIF0_SCK_TPUTO, SCIF0_RXD, SCIF0_TXD, FOE_VIO_VD2, FWE, FSC, DREQ0, FCDE, NAF2_VIO_D10, NAF1_VIO_D9, NAF0_VIO_D8, FRB_VIO_CLK2, FCE_VIO_HD2, NAF7_VIO_D15, NAF6_VIO_D14, NAF5_VIO_D13, NAF4_VIO_D12, NAF3_VIO_D11, VIO_FLD_SCIF2_CTS, VIO_CKO_SCIF2_RTS, VIO_STEX_SCIF2_SCK, VIO_STEM_SCIF2_TXD, VIO_HD_SCIF2_RXD, VIO_VD_SCIF1_CTS, VIO_CLK_SCIF1_RTS, CS6A_CE2B, LCDD23, LCDD22, LCDD21, LCDD20, LCDD19_DV_CLKI, LCDD18_DV_CLK, KEYOUT5_IN5, KEYOUT4_IN6, KEYOUT3, KEYOUT2, KEYOUT1, KEYOUT0, KEYIN4_IRQ7, KEYIN3, KEYIN2, KEYIN1, KEYIN0_IRQ6, PSA15_KEYIN0, PSA15_IRQ6, PSA14_KEYIN4, PSA14_IRQ7, PSA9_IRQ4, PSA9_BS, PSA4_IRQ2, PSA4_SDHID2, PSB15_SIOTXD, PSB15_SIUBOSLD, PSB14_SIORXD, PSB14_SIUBISLD, PSB13_SIOD, PSB13_SIUBILR, PSB12_SIOSTRB0, PSB12_SIUBIBT, PSB11_SIOSTRB1, PSB11_SIUBOLR, PSB10_SIOSCK, PSB10_SIUBOBT, PSB9_SIOMCK, PSB9_SIUMCKB, PSB8_SIOF0_MCK, PSB8_IRQ3, PSB7_SIOF0_TXD, PSB7_IRDA_OUT, PSB6_SIOF0_RXD, PSB6_IRDA_IN, PSB5_SIOF0_SCK, PSB5_TS_SCK, PSB4_SIOF0_SYNC, PSB4_TS_SDEN, PSB3_SIOF0_SS1, PSB3_TS_SPSYNC, PSB2_SIOF0_SS2, PSB2_SIM_RST, PSB1_SIUMCKA, PSB1_SIOF1_MCK, PSB0_SIUAOSLD, PSB0_SIOF1_TXD, PSC15_SIUAISLD, PSC15_SIOF1_RXD, PSC14_SIUAOBT, PSC14_SIOF1_SCK, PSC13_SIUAOLR, PSC13_SIOF1_SYNC, PSC12_SIUAIBT, PSC12_SIOF1_SS1, PSC11_SIUAILR, PSC11_SIOF1_SS2, PSC0_NAF, PSC0_VIO, PSD13_VIO, PSD13_SCIF2, PSD12_VIO, PSD12_SCIF1, PSD11_VIO, PSD11_SCIF1, PSD10_VIO_D0, PSD10_LCDLCLK, PSD9_SIOMCK_SIUMCKB, PSD9_SIUFCKB, PSD8_SCIF0_SCK, PSD8_TPUTO, PSD7_SCIF0_RTS, PSD7_SIUAOSPD, PSD6_SCIF0_CTS, PSD6_SIUAISPD, PSD5_CS6B_CE1B, PSD5_LCDCS2, PSD3_LCDVEPWC_LCDVCPWC, PSD3_LCDVEPWC2_LCDVCPWC2, PSD2_LCDDON, PSD2_LCDDON2, PSD0_LCDD19_LCDD0, PSD0_DV, PSE15_SIOF0_MCK_IRQ3, PSE15_SIM_D, PSE14_SIOF0_TXD_IRDA_OUT, PSE14_SIM_CLK, PSE13_SIOF0_RXD_IRDA_IN, PSE13_TS_SDAT, PSE12_LCDVSYN2, PSE12_DACK, PSE11_SIUMCKA_SIOF1_MCK, PSE11_SIUFCKA, PSE3_FLCTL, PSE3_VIO, PSE2_NAF2, PSE2_VIO_D10, PSE1_NAF1, PSE1_VIO_D9, PSE0_NAF0, PSE0_VIO_D8, HIZA14_KEYSC, HIZA14_HIZ, HIZA10_NAF, HIZA10_HIZ, HIZA9_VIO, HIZA9_HIZ, HIZA8_LCDC, HIZA8_HIZ, HIZA7_LCDC, HIZA7_HIZ, HIZA6_LCDC, HIZA6_HIZ, HIZB4_SIUA, HIZB4_HIZ, HIZB1_VIO, HIZB1_HIZ, HIZB0_VIO, HIZB0_HIZ, HIZC15_IRQ7, HIZC15_HIZ, HIZC14_IRQ6, HIZC14_HIZ, HIZC13_IRQ5, HIZC13_HIZ, HIZC12_IRQ4, HIZC12_HIZ, HIZC11_IRQ3, HIZC11_HIZ, HIZC10_IRQ2, HIZC10_HIZ, HIZC9_IRQ1, HIZC9_HIZ, HIZC8_IRQ0, HIZC8_HIZ, MSELB9_VIO, MSELB9_VIO2, MSELB8_RGB, MSELB8_SYS, PINMUX_FUNCTION_END, }; static const u16 pinmux_data[] = { /* PTA */ PINMUX_DATA(PTA7_DATA, PTA7_IN, PTA7_OUT), PINMUX_DATA(PTA6_DATA, PTA6_IN), PINMUX_DATA(PTA5_DATA, PTA5_IN, PTA5_OUT), PINMUX_DATA(PTA4_DATA, PTA4_IN), PINMUX_DATA(PTA3_DATA, PTA3_IN), PINMUX_DATA(PTA2_DATA, PTA2_IN), PINMUX_DATA(PTA1_DATA, PTA1_IN), PINMUX_DATA(PTA0_DATA, PTA0_IN), /* PTB */ PINMUX_DATA(PTB7_DATA, PTB7_IN, PTB7_OUT), PINMUX_DATA(PTB6_DATA, PTB6_IN, PTB6_OUT), PINMUX_DATA(PTB5_DATA, PTB5_IN, PTB5_OUT), PINMUX_DATA(PTB4_DATA, PTB4_IN, PTB4_OUT), PINMUX_DATA(PTB3_DATA, PTB3_IN, PTB3_OUT), PINMUX_DATA(PTB2_DATA, PTB2_IN, PTB2_OUT), PINMUX_DATA(PTB1_DATA, PTB1_IN, PTB1_OUT), PINMUX_DATA(PTB0_DATA, PTB0_IN, PTB0_OUT), /* PTC */ PINMUX_DATA(PTC7_DATA, PTC7_IN), PINMUX_DATA(PTC5_DATA, PTC5_IN), PINMUX_DATA(PTC4_DATA, PTC4_IN, PTC4_OUT), PINMUX_DATA(PTC3_DATA, PTC3_IN, PTC3_OUT), PINMUX_DATA(PTC2_DATA, PTC2_IN, PTC2_OUT), PINMUX_DATA(PTC0_DATA, PTC0_IN, PTC0_OUT), /* PTD */ PINMUX_DATA(PTD7_DATA, PTD7_IN), PINMUX_DATA(PTD6_DATA, PTD6_OUT, PTD6_IN), PINMUX_DATA(PTD5_DATA, PTD5_OUT, PTD5_IN), PINMUX_DATA(PTD4_DATA, PTD4_OUT, PTD4_IN), PINMUX_DATA(PTD3_DATA, PTD3_OUT, PTD3_IN), PINMUX_DATA(PTD2_DATA, PTD2_OUT, PTD2_IN), PINMUX_DATA(PTD1_DATA, PTD1_OUT, PTD1_IN), PINMUX_DATA(PTD0_DATA, PTD0_OUT), /* PTE */ PINMUX_DATA(PTE7_DATA, PTE7_OUT, PTE7_IN), PINMUX_DATA(PTE6_DATA, PTE6_OUT, PTE6_IN), PINMUX_DATA(PTE5_DATA, PTE5_OUT, PTE5_IN), PINMUX_DATA(PTE4_DATA, PTE4_OUT, PTE4_IN), PINMUX_DATA(PTE1_DATA, PTE1_OUT, PTE1_IN), PINMUX_DATA(PTE0_DATA, PTE0_OUT, PTE0_IN), /* PTF */ PINMUX_DATA(PTF6_DATA, PTF6_OUT, PTF6_IN), PINMUX_DATA(PTF5_DATA, PTF5_OUT, PTF5_IN), PINMUX_DATA(PTF4_DATA, PTF4_OUT, PTF4_IN), PINMUX_DATA(PTF3_DATA, PTF3_OUT, PTF3_IN), PINMUX_DATA(PTF2_DATA, PTF2_OUT, PTF2_IN), PINMUX_DATA(PTF1_DATA, PTF1_IN), PINMUX_DATA(PTF0_DATA, PTF0_OUT), /* PTG */ PINMUX_DATA(PTG4_DATA, PTG4_OUT), PINMUX_DATA(PTG3_DATA, PTG3_OUT), PINMUX_DATA(PTG2_DATA, PTG2_OUT), PINMUX_DATA(PTG1_DATA, PTG1_OUT), PINMUX_DATA(PTG0_DATA, PTG0_OUT), /* PTH */ PINMUX_DATA(PTH7_DATA, PTH7_OUT), PINMUX_DATA(PTH6_DATA, PTH6_OUT, PTH6_IN), PINMUX_DATA(PTH5_DATA, PTH5_OUT, PTH5_IN), PINMUX_DATA(PTH4_DATA, PTH4_OUT), PINMUX_DATA(PTH3_DATA, PTH3_OUT), PINMUX_DATA(PTH2_DATA, PTH2_OUT), PINMUX_DATA(PTH1_DATA, PTH1_OUT, PTH1_IN), PINMUX_DATA(PTH0_DATA, PTH0_OUT, PTH0_IN), /* PTJ */ PINMUX_DATA(PTJ7_DATA, PTJ7_OUT), PINMUX_DATA(PTJ6_DATA, PTJ6_OUT), PINMUX_DATA(PTJ5_DATA, PTJ5_OUT), PINMUX_DATA(PTJ1_DATA, PTJ1_OUT, PTJ1_IN), PINMUX_DATA(PTJ0_DATA, PTJ0_OUT, PTJ0_IN), /* PTK */ PINMUX_DATA(PTK6_DATA, PTK6_OUT, PTK6_IN), PINMUX_DATA(PTK5_DATA, PTK5_OUT, PTK5_IN), PINMUX_DATA(PTK4_DATA, PTK4_OUT, PTK4_IN), PINMUX_DATA(PTK3_DATA, PTK3_OUT, PTK3_IN), PINMUX_DATA(PTK2_DATA, PTK2_IN), PINMUX_DATA(PTK1_DATA, PTK1_OUT), PINMUX_DATA(PTK0_DATA, PTK0_OUT, PTK0_IN), /* PTL */ PINMUX_DATA(PTL7_DATA, PTL7_OUT, PTL7_IN), PINMUX_DATA(PTL6_DATA, PTL6_OUT, PTL6_IN), PINMUX_DATA(PTL5_DATA, PTL5_OUT, PTL5_IN), PINMUX_DATA(PTL4_DATA, PTL4_OUT, PTL4_IN), PINMUX_DATA(PTL3_DATA, PTL3_OUT, PTL3_IN), PINMUX_DATA(PTL2_DATA, PTL2_OUT, PTL2_IN), PINMUX_DATA(PTL1_DATA, PTL1_OUT, PTL1_IN), PINMUX_DATA(PTL0_DATA, PTL0_OUT, PTL0_IN), /* PTM */ PINMUX_DATA(PTM7_DATA, PTM7_OUT, PTM7_IN), PINMUX_DATA(PTM6_DATA, PTM6_OUT, PTM6_IN), PINMUX_DATA(PTM5_DATA, PTM5_OUT, PTM5_IN), PINMUX_DATA(PTM4_DATA, PTM4_OUT, PTM4_IN), PINMUX_DATA(PTM3_DATA, PTM3_OUT, PTM3_IN), PINMUX_DATA(PTM2_DATA, PTM2_OUT, PTM2_IN), PINMUX_DATA(PTM1_DATA, PTM1_OUT, PTM1_IN), PINMUX_DATA(PTM0_DATA, PTM0_OUT, PTM0_IN), /* PTN */ PINMUX_DATA(PTN7_DATA, PTN7_OUT, PTN7_IN), PINMUX_DATA(PTN6_DATA, PTN6_OUT, PTN6_IN), PINMUX_DATA(PTN5_DATA, PTN5_OUT, PTN5_IN), PINMUX_DATA(PTN4_DATA, PTN4_OUT, PTN4_IN), PINMUX_DATA(PTN3_DATA, PTN3_OUT, PTN3_IN), PINMUX_DATA(PTN2_DATA, PTN2_OUT, PTN2_IN), PINMUX_DATA(PTN1_DATA, PTN1_OUT, PTN1_IN), PINMUX_DATA(PTN0_DATA, PTN0_OUT, PTN0_IN), /* PTQ */ PINMUX_DATA(PTQ6_DATA, PTQ6_OUT), PINMUX_DATA(PTQ5_DATA, PTQ5_OUT, PTQ5_IN), PINMUX_DATA(PTQ4_DATA, PTQ4_OUT, PTQ4_IN), PINMUX_DATA(PTQ3_DATA, PTQ3_OUT, PTQ3_IN), PINMUX_DATA(PTQ2_DATA, PTQ2_IN), PINMUX_DATA(PTQ1_DATA, PTQ1_OUT), PINMUX_DATA(PTQ0_DATA, PTQ0_OUT, PTQ0_IN), /* PTR */ PINMUX_DATA(PTR4_DATA, PTR4_OUT), PINMUX_DATA(PTR3_DATA, PTR3_OUT), PINMUX_DATA(PTR2_DATA, PTR2_IN), PINMUX_DATA(PTR1_DATA, PTR1_OUT), PINMUX_DATA(PTR0_DATA, PTR0_OUT), /* PTS */ PINMUX_DATA(PTS4_DATA, PTS4_IN), PINMUX_DATA(PTS3_DATA, PTS3_OUT), PINMUX_DATA(PTS2_DATA, PTS2_OUT, PTS2_IN), PINMUX_DATA(PTS1_DATA, PTS1_IN), PINMUX_DATA(PTS0_DATA, PTS0_OUT), /* PTT */ PINMUX_DATA(PTT4_DATA, PTT4_OUT, PTT4_IN), PINMUX_DATA(PTT3_DATA, PTT3_OUT, PTT3_IN), PINMUX_DATA(PTT2_DATA, PTT2_OUT, PTT2_IN), PINMUX_DATA(PTT1_DATA, PTT1_IN), PINMUX_DATA(PTT0_DATA, PTT0_OUT), /* PTU */ PINMUX_DATA(PTU4_DATA, PTU4_OUT, PTU4_IN), PINMUX_DATA(PTU3_DATA, PTU3_OUT, PTU3_IN), PINMUX_DATA(PTU2_DATA, PTU2_OUT, PTU2_IN), PINMUX_DATA(PTU1_DATA, PTU1_IN), PINMUX_DATA(PTU0_DATA, PTU0_OUT, PTU0_IN), /* PTV */ PINMUX_DATA(PTV4_DATA, PTV4_OUT, PTV4_IN), PINMUX_DATA(PTV3_DATA, PTV3_OUT, PTV3_IN), PINMUX_DATA(PTV2_DATA, PTV2_OUT, PTV2_IN), PINMUX_DATA(PTV1_DATA, PTV1_OUT, PTV1_IN), PINMUX_DATA(PTV0_DATA, PTV0_OUT, PTV0_IN), /* PTW */ PINMUX_DATA(PTW6_DATA, PTW6_IN), PINMUX_DATA(PTW5_DATA, PTW5_OUT), PINMUX_DATA(PTW4_DATA, PTW4_OUT, PTW4_IN), PINMUX_DATA(PTW3_DATA, PTW3_OUT, PTW3_IN), PINMUX_DATA(PTW2_DATA, PTW2_OUT, PTW2_IN), PINMUX_DATA(PTW1_DATA, PTW1_OUT, PTW1_IN), PINMUX_DATA(PTW0_DATA, PTW0_OUT, PTW0_IN), /* PTX */ PINMUX_DATA(PTX6_DATA, PTX6_OUT, PTX6_IN), PINMUX_DATA(PTX5_DATA, PTX5_OUT, PTX5_IN), PINMUX_DATA(PTX4_DATA, PTX4_OUT, PTX4_IN), PINMUX_DATA(PTX3_DATA, PTX3_OUT, PTX3_IN), PINMUX_DATA(PTX2_DATA, PTX2_OUT, PTX2_IN), PINMUX_DATA(PTX1_DATA, PTX1_OUT, PTX1_IN), PINMUX_DATA(PTX0_DATA, PTX0_OUT, PTX0_IN), /* PTY */ PINMUX_DATA(PTY5_DATA, PTY5_OUT, PTY5_IN), PINMUX_DATA(PTY4_DATA, PTY4_OUT, PTY4_IN), PINMUX_DATA(PTY3_DATA, PTY3_OUT, PTY3_IN), PINMUX_DATA(PTY2_DATA, PTY2_OUT, PTY2_IN), PINMUX_DATA(PTY1_DATA, PTY1_OUT), PINMUX_DATA(PTY0_DATA, PTY0_OUT, PTY0_IN), /* PTZ */ PINMUX_DATA(PTZ5_DATA, PTZ5_IN), PINMUX_DATA(PTZ4_DATA, PTZ4_IN), PINMUX_DATA(PTZ3_DATA, PTZ3_IN), PINMUX_DATA(PTZ2_DATA, PTZ2_IN), PINMUX_DATA(PTZ1_DATA, PTZ1_IN), /* SCIF0 */ PINMUX_DATA(SCIF0_TXD_MARK, SCIF0_TXD), PINMUX_DATA(SCIF0_RXD_MARK, SCIF0_RXD), PINMUX_DATA(SCIF0_RTS_MARK, PSD7_SCIF0_RTS, SCIF0_RTS_SIUAOSPD), PINMUX_DATA(SCIF0_CTS_MARK, PSD6_SCIF0_CTS, SCIF0_CTS_SIUAISPD), PINMUX_DATA(SCIF0_SCK_MARK, PSD8_SCIF0_SCK, SCIF0_SCK_TPUTO), /* SCIF1 */ PINMUX_DATA(SCIF1_TXD_MARK, PSD11_SCIF1, VIO_D5_SCIF1_TXD), PINMUX_DATA(SCIF1_RXD_MARK, PSD11_SCIF1, VIO_D6_SCIF1_RXD), PINMUX_DATA(SCIF1_RTS_MARK, PSD12_SCIF1, VIO_CLK_SCIF1_RTS), PINMUX_DATA(SCIF1_CTS_MARK, PSD12_SCIF1, VIO_VD_SCIF1_CTS), PINMUX_DATA(SCIF1_SCK_MARK, PSD11_SCIF1, VIO_D7_SCIF1_SCK), /* SCIF2 */ PINMUX_DATA(SCIF2_TXD_MARK, PSD13_SCIF2, VIO_STEM_SCIF2_TXD), PINMUX_DATA(SCIF2_RXD_MARK, PSD13_SCIF2, VIO_HD_SCIF2_RXD), PINMUX_DATA(SCIF2_RTS_MARK, PSD13_SCIF2, VIO_CKO_SCIF2_RTS), PINMUX_DATA(SCIF2_CTS_MARK, PSD13_SCIF2, VIO_FLD_SCIF2_CTS), PINMUX_DATA(SCIF2_SCK_MARK, PSD13_SCIF2, VIO_STEX_SCIF2_SCK), /* SIO */ PINMUX_DATA(SIOTXD_MARK, PSB15_SIOTXD, SIOTXD_SIUBOSLD), PINMUX_DATA(SIORXD_MARK, PSB14_SIORXD, SIORXD_SIUBISLD), PINMUX_DATA(SIOD_MARK, PSB13_SIOD, SIOD_SIUBILR), PINMUX_DATA(SIOSTRB0_MARK, PSB12_SIOSTRB0, SIOSTRB0_SIUBIBT), PINMUX_DATA(SIOSTRB1_MARK, PSB11_SIOSTRB1, SIOSTRB1_SIUBOLR), PINMUX_DATA(SIOSCK_MARK, PSB10_SIOSCK, SIOSCK_SIUBOBT), PINMUX_DATA(SIOMCK_MARK, PSD9_SIOMCK_SIUMCKB, PSB9_SIOMCK, PTF6), /* CEU */ PINMUX_DATA(VIO_D15_MARK, PSC0_VIO, HIZA10_NAF, NAF7_VIO_D15), PINMUX_DATA(VIO_D14_MARK, PSC0_VIO, HIZA10_NAF, NAF6_VIO_D14), PINMUX_DATA(VIO_D13_MARK, PSC0_VIO, HIZA10_NAF, NAF5_VIO_D13), PINMUX_DATA(VIO_D12_MARK, PSC0_VIO, HIZA10_NAF, NAF4_VIO_D12), PINMUX_DATA(VIO_D11_MARK, PSC0_VIO, HIZA10_NAF, NAF3_VIO_D11), PINMUX_DATA(VIO_D10_MARK, PSE2_VIO_D10, HIZB0_VIO, NAF2_VIO_D10), PINMUX_DATA(VIO_D9_MARK, PSE1_VIO_D9, HIZB0_VIO, NAF1_VIO_D9), PINMUX_DATA(VIO_D8_MARK, PSE0_VIO_D8, HIZB0_VIO, NAF0_VIO_D8), PINMUX_DATA(VIO_D7_MARK, PSD11_VIO, VIO_D7_SCIF1_SCK), PINMUX_DATA(VIO_D6_MARK, PSD11_VIO, VIO_D6_SCIF1_RXD), PINMUX_DATA(VIO_D5_MARK, PSD11_VIO, VIO_D5_SCIF1_TXD), PINMUX_DATA(VIO_D4_MARK, VIO_D4), PINMUX_DATA(VIO_D3_MARK, VIO_D3), PINMUX_DATA(VIO_D2_MARK, VIO_D2), PINMUX_DATA(VIO_D1_MARK, VIO_D1), PINMUX_DATA(VIO_D0_MARK, PSD10_VIO_D0, VIO_D0_LCDLCLK), PINMUX_DATA(VIO_CLK_MARK, PSD12_VIO, MSELB9_VIO, VIO_CLK_SCIF1_RTS), PINMUX_DATA(VIO_VD_MARK, PSD12_VIO, MSELB9_VIO, VIO_VD_SCIF1_CTS), PINMUX_DATA(VIO_HD_MARK, PSD13_VIO, MSELB9_VIO, VIO_HD_SCIF2_RXD), PINMUX_DATA(VIO_FLD_MARK, PSD13_VIO, HIZA9_VIO, VIO_FLD_SCIF2_CTS), PINMUX_DATA(VIO_CKO_MARK, PSD13_VIO, HIZA9_VIO, VIO_CKO_SCIF2_RTS), PINMUX_DATA(VIO_STEX_MARK, PSD13_VIO, HIZA9_VIO, VIO_STEX_SCIF2_SCK), PINMUX_DATA(VIO_STEM_MARK, PSD13_VIO, HIZA9_VIO, VIO_STEM_SCIF2_TXD), PINMUX_DATA(VIO_VD2_MARK, PSE3_VIO, MSELB9_VIO2, HIZB0_VIO, FOE_VIO_VD2), PINMUX_DATA(VIO_HD2_MARK, PSE3_VIO, MSELB9_VIO2, HIZB1_VIO, FCE_VIO_HD2), PINMUX_DATA(VIO_CLK2_MARK, PSE3_VIO, MSELB9_VIO2, HIZB1_VIO, FRB_VIO_CLK2), /* LCDC */ PINMUX_DATA(LCDD23_MARK, HIZA8_LCDC, LCDD23), PINMUX_DATA(LCDD22_MARK, HIZA8_LCDC, LCDD22), PINMUX_DATA(LCDD21_MARK, HIZA8_LCDC, LCDD21), PINMUX_DATA(LCDD20_MARK, HIZA8_LCDC, LCDD20), PINMUX_DATA(LCDD19_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD19_DV_CLKI), PINMUX_DATA(LCDD18_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD18_DV_CLK), PINMUX_DATA(LCDD17_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD17_DV_HSYNC), PINMUX_DATA(LCDD16_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD16_DV_VSYNC), PINMUX_DATA(LCDD15_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD15_DV_D15), PINMUX_DATA(LCDD14_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD14_DV_D14), PINMUX_DATA(LCDD13_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD13_DV_D13), PINMUX_DATA(LCDD12_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD12_DV_D12), PINMUX_DATA(LCDD11_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD11_DV_D11), PINMUX_DATA(LCDD10_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD10_DV_D10), PINMUX_DATA(LCDD9_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD9_DV_D9), PINMUX_DATA(LCDD8_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD8_DV_D8), PINMUX_DATA(LCDD7_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD7_DV_D7), PINMUX_DATA(LCDD6_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD6_DV_D6), PINMUX_DATA(LCDD5_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD5_DV_D5), PINMUX_DATA(LCDD4_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD4_DV_D4), PINMUX_DATA(LCDD3_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD3_DV_D3), PINMUX_DATA(LCDD2_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD2_DV_D2), PINMUX_DATA(LCDD1_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD1_DV_D1), PINMUX_DATA(LCDD0_MARK, PSD0_LCDD19_LCDD0, HIZA8_LCDC, LCDD0_DV_D0), PINMUX_DATA(LCDLCLK_MARK, PSD10_LCDLCLK, VIO_D0_LCDLCLK), /* Main LCD */ PINMUX_DATA(LCDDON_MARK, PSD2_LCDDON, HIZA7_LCDC, LCDDON_LCDDON2), PINMUX_DATA(LCDVCPWC_MARK, PSD3_LCDVEPWC_LCDVCPWC, HIZA6_LCDC, LCDVCPWC_LCDVCPWC2), PINMUX_DATA(LCDVEPWC_MARK, PSD3_LCDVEPWC_LCDVCPWC, HIZA6_LCDC, LCDVEPWC_LCDVEPWC2), PINMUX_DATA(LCDVSYN_MARK, HIZA7_LCDC, LCDVSYN), /* Main LCD - RGB Mode */ PINMUX_DATA(LCDDCK_MARK, MSELB8_RGB, HIZA8_LCDC, LCDDCK_LCDWR), PINMUX_DATA(LCDHSYN_MARK, MSELB8_RGB, HIZA7_LCDC, LCDHSYN_LCDCS), PINMUX_DATA(LCDDISP_MARK, MSELB8_RGB, HIZA7_LCDC, LCDDISP_LCDRS), /* Main LCD - SYS Mode */ PINMUX_DATA(LCDRS_MARK, MSELB8_SYS, HIZA7_LCDC, LCDDISP_LCDRS), PINMUX_DATA(LCDCS_MARK, MSELB8_SYS, HIZA7_LCDC, LCDHSYN_LCDCS), PINMUX_DATA(LCDWR_MARK, MSELB8_SYS, HIZA8_LCDC, LCDDCK_LCDWR), PINMUX_DATA(LCDRD_MARK, HIZA7_LCDC, LCDRD), /* Sub LCD - SYS Mode */ PINMUX_DATA(LCDDON2_MARK, PSD2_LCDDON2, HIZA7_LCDC, LCDDON_LCDDON2), PINMUX_DATA(LCDVCPWC2_MARK, PSD3_LCDVEPWC2_LCDVCPWC2, HIZA6_LCDC, LCDVCPWC_LCDVCPWC2), PINMUX_DATA(LCDVEPWC2_MARK, PSD3_LCDVEPWC2_LCDVCPWC2, HIZA6_LCDC, LCDVEPWC_LCDVEPWC2), PINMUX_DATA(LCDVSYN2_MARK, PSE12_LCDVSYN2, HIZA8_LCDC, LCDVSYN2_DACK), PINMUX_DATA(LCDCS2_MARK, PSD5_LCDCS2, CS6B_CE1B_LCDCS2), /* BSC */ PINMUX_DATA(IOIS16_MARK, IOIS16), PINMUX_DATA(A25_MARK, A25), PINMUX_DATA(A24_MARK, A24), PINMUX_DATA(A23_MARK, A23), PINMUX_DATA(A22_MARK, A22), PINMUX_DATA(BS_MARK, PSA9_BS, IRQ4_BS), PINMUX_DATA(CS6B_CE1B_MARK, PSD5_CS6B_CE1B, CS6B_CE1B_LCDCS2), PINMUX_DATA(WAIT_MARK, WAIT), PINMUX_DATA(CS6A_CE2B_MARK, CS6A_CE2B), /* SBSC */ PINMUX_DATA(HPD63_MARK, HPD63), PINMUX_DATA(HPD62_MARK, HPD62), PINMUX_DATA(HPD61_MARK, HPD61), PINMUX_DATA(HPD60_MARK, HPD60), PINMUX_DATA(HPD59_MARK, HPD59), PINMUX_DATA(HPD58_MARK, HPD58), PINMUX_DATA(HPD57_MARK, HPD57), PINMUX_DATA(HPD56_MARK, HPD56), PINMUX_DATA(HPD55_MARK, HPD55), PINMUX_DATA(HPD54_MARK, HPD54), PINMUX_DATA(HPD53_MARK, HPD53), PINMUX_DATA(HPD52_MARK, HPD52), PINMUX_DATA(HPD51_MARK, HPD51), PINMUX_DATA(HPD50_MARK, HPD50), PINMUX_DATA(HPD49_MARK, HPD49), PINMUX_DATA(HPD48_MARK, HPD48), PINMUX_DATA(HPDQM7_MARK, HPDQM7), PINMUX_DATA(HPDQM6_MARK, HPDQM6), PINMUX_DATA(HPDQM5_MARK, HPDQM5), PINMUX_DATA(HPDQM4_MARK, HPDQM4), /* IRQ */ PINMUX_DATA(IRQ0_MARK, HIZC8_IRQ0, IRQ0), PINMUX_DATA(IRQ1_MARK, HIZC9_IRQ1, IRQ1), PINMUX_DATA(IRQ2_MARK, PSA4_IRQ2, HIZC10_IRQ2, IRQ2_SDHID2), PINMUX_DATA(IRQ3_MARK, PSE15_SIOF0_MCK_IRQ3, PSB8_IRQ3, HIZC11_IRQ3, PTQ0), PINMUX_DATA(IRQ4_MARK, PSA9_IRQ4, HIZC12_IRQ4, IRQ4_BS), PINMUX_DATA(IRQ5_MARK, HIZC13_IRQ5, IRQ5), PINMUX_DATA(IRQ6_MARK, PSA15_IRQ6, HIZC14_IRQ6, KEYIN0_IRQ6), PINMUX_DATA(IRQ7_MARK, PSA14_IRQ7, HIZC15_IRQ7, KEYIN4_IRQ7), /* SDHI */ PINMUX_DATA(SDHICD_MARK, SDHICD), PINMUX_DATA(SDHIWP_MARK, SDHIWP), PINMUX_DATA(SDHID3_MARK, SDHID3), PINMUX_DATA(SDHID2_MARK, PSA4_SDHID2, IRQ2_SDHID2), PINMUX_DATA(SDHID1_MARK, SDHID1), PINMUX_DATA(SDHID0_MARK, SDHID0), PINMUX_DATA(SDHICMD_MARK, SDHICMD), PINMUX_DATA(SDHICLK_MARK, SDHICLK), /* SIU - Port A */ PINMUX_DATA(SIUAOLR_MARK, PSC13_SIUAOLR, HIZB4_SIUA, SIUAOLR_SIOF1_SYNC), PINMUX_DATA(SIUAOBT_MARK, PSC14_SIUAOBT, HIZB4_SIUA, SIUAOBT_SIOF1_SCK), PINMUX_DATA(SIUAISLD_MARK, PSC15_SIUAISLD, HIZB4_SIUA, SIUAISLD_SIOF1_RXD), PINMUX_DATA(SIUAILR_MARK, PSC11_SIUAILR, HIZB4_SIUA, SIUAILR_SIOF1_SS2), PINMUX_DATA(SIUAIBT_MARK, PSC12_SIUAIBT, HIZB4_SIUA, SIUAIBT_SIOF1_SS1), PINMUX_DATA(SIUAOSLD_MARK, PSB0_SIUAOSLD, HIZB4_SIUA, SIUAOSLD_SIOF1_TXD), PINMUX_DATA(SIUMCKA_MARK, PSE11_SIUMCKA_SIOF1_MCK, HIZB4_SIUA, PSB1_SIUMCKA, PTK0), PINMUX_DATA(SIUFCKA_MARK, PSE11_SIUFCKA, HIZB4_SIUA, PTK0), /* SIU - Port B */ PINMUX_DATA(SIUBOLR_MARK, PSB11_SIUBOLR, SIOSTRB1_SIUBOLR), PINMUX_DATA(SIUBOBT_MARK, PSB10_SIUBOBT, SIOSCK_SIUBOBT), PINMUX_DATA(SIUBISLD_MARK, PSB14_SIUBISLD, SIORXD_SIUBISLD), PINMUX_DATA(SIUBILR_MARK, PSB13_SIUBILR, SIOD_SIUBILR), PINMUX_DATA(SIUBIBT_MARK, PSB12_SIUBIBT, SIOSTRB0_SIUBIBT), PINMUX_DATA(SIUBOSLD_MARK, PSB15_SIUBOSLD, SIOTXD_SIUBOSLD), PINMUX_DATA(SIUMCKB_MARK, PSD9_SIOMCK_SIUMCKB, PSB9_SIUMCKB, PTF6), PINMUX_DATA(SIUFCKB_MARK, PSD9_SIUFCKB, PTF6), /* AUD */ PINMUX_DATA(AUDSYNC_MARK, AUDSYNC), PINMUX_DATA(AUDATA3_MARK, AUDATA3), PINMUX_DATA(AUDATA2_MARK, AUDATA2), PINMUX_DATA(AUDATA1_MARK, AUDATA1), PINMUX_DATA(AUDATA0_MARK, AUDATA0), /* DMAC */ PINMUX_DATA(DACK_MARK, PSE12_DACK, LCDVSYN2_DACK), PINMUX_DATA(DREQ0_MARK, DREQ0), /* VOU */ PINMUX_DATA(DV_CLKI_MARK, PSD0_DV, LCDD19_DV_CLKI), PINMUX_DATA(DV_CLK_MARK, PSD0_DV, LCDD18_DV_CLK), PINMUX_DATA(DV_HSYNC_MARK, PSD0_DV, LCDD17_DV_HSYNC), PINMUX_DATA(DV_VSYNC_MARK, PSD0_DV, LCDD16_DV_VSYNC), PINMUX_DATA(DV_D15_MARK, PSD0_DV, LCDD15_DV_D15), PINMUX_DATA(DV_D14_MARK, PSD0_DV, LCDD14_DV_D14), PINMUX_DATA(DV_D13_MARK, PSD0_DV, LCDD13_DV_D13), PINMUX_DATA(DV_D12_MARK, PSD0_DV, LCDD12_DV_D12), PINMUX_DATA(DV_D11_MARK, PSD0_DV, LCDD11_DV_D11), PINMUX_DATA(DV_D10_MARK, PSD0_DV, LCDD10_DV_D10), PINMUX_DATA(DV_D9_MARK, PSD0_DV, LCDD9_DV_D9), PINMUX_DATA(DV_D8_MARK, PSD0_DV, LCDD8_DV_D8), PINMUX_DATA(DV_D7_MARK, PSD0_DV, LCDD7_DV_D7), PINMUX_DATA(DV_D6_MARK, PSD0_DV, LCDD6_DV_D6), PINMUX_DATA(DV_D5_MARK, PSD0_DV, LCDD5_DV_D5), PINMUX_DATA(DV_D4_MARK, PSD0_DV, LCDD4_DV_D4), PINMUX_DATA(DV_D3_MARK, PSD0_DV, LCDD3_DV_D3), PINMUX_DATA(DV_D2_MARK, PSD0_DV, LCDD2_DV_D2), PINMUX_DATA(DV_D1_MARK, PSD0_DV, LCDD1_DV_D1), PINMUX_DATA(DV_D0_MARK, PSD0_DV, LCDD0_DV_D0), /* CPG */ PINMUX_DATA(STATUS0_MARK, STATUS0), PINMUX_DATA(PDSTATUS_MARK, PDSTATUS), /* SIOF0 */ PINMUX_DATA(SIOF0_MCK_MARK, PSE15_SIOF0_MCK_IRQ3, PSB8_SIOF0_MCK, PTQ0), PINMUX_DATA(SIOF0_SCK_MARK, PSB5_SIOF0_SCK, SIOF0_SCK_TS_SCK), PINMUX_DATA(SIOF0_SYNC_MARK, PSB4_SIOF0_SYNC, SIOF0_SYNC_TS_SDEN), PINMUX_DATA(SIOF0_SS1_MARK, PSB3_SIOF0_SS1, SIOF0_SS1_TS_SPSYNC), PINMUX_DATA(SIOF0_SS2_MARK, PSB2_SIOF0_SS2, SIOF0_SS2_SIM_RST), PINMUX_DATA(SIOF0_TXD_MARK, PSE14_SIOF0_TXD_IRDA_OUT, PSB7_SIOF0_TXD, PTQ1), PINMUX_DATA(SIOF0_RXD_MARK, PSE13_SIOF0_RXD_IRDA_IN, PSB6_SIOF0_RXD, PTQ2), /* SIOF1 */ PINMUX_DATA(SIOF1_MCK_MARK, PSE11_SIUMCKA_SIOF1_MCK, PSB1_SIOF1_MCK, PTK0), PINMUX_DATA(SIOF1_SCK_MARK, PSC14_SIOF1_SCK, SIUAOBT_SIOF1_SCK), PINMUX_DATA(SIOF1_SYNC_MARK, PSC13_SIOF1_SYNC, SIUAOLR_SIOF1_SYNC), PINMUX_DATA(SIOF1_SS1_MARK, PSC12_SIOF1_SS1, SIUAIBT_SIOF1_SS1), PINMUX_DATA(SIOF1_SS2_MARK, PSC11_SIOF1_SS2, SIUAILR_SIOF1_SS2), PINMUX_DATA(SIOF1_TXD_MARK, PSB0_SIOF1_TXD, SIUAOSLD_SIOF1_TXD), PINMUX_DATA(SIOF1_RXD_MARK, PSC15_SIOF1_RXD, SIUAISLD_SIOF1_RXD), /* SIM */ PINMUX_DATA(SIM_D_MARK, PSE15_SIM_D, PTQ0), PINMUX_DATA(SIM_CLK_MARK, PSE14_SIM_CLK, PTQ1), PINMUX_DATA(SIM_RST_MARK, PSB2_SIM_RST, SIOF0_SS2_SIM_RST), /* TSIF */ PINMUX_DATA(TS_SDAT_MARK, PSE13_TS_SDAT, PTQ2), PINMUX_DATA(TS_SCK_MARK, PSB5_TS_SCK, SIOF0_SCK_TS_SCK), PINMUX_DATA(TS_SDEN_MARK, PSB4_TS_SDEN, SIOF0_SYNC_TS_SDEN), PINMUX_DATA(TS_SPSYNC_MARK, PSB3_TS_SPSYNC, SIOF0_SS1_TS_SPSYNC), /* IRDA */ PINMUX_DATA(IRDA_IN_MARK, PSE13_SIOF0_RXD_IRDA_IN, PSB6_IRDA_IN, PTQ2), PINMUX_DATA(IRDA_OUT_MARK, PSE14_SIOF0_TXD_IRDA_OUT, PSB7_IRDA_OUT, PTQ1), /* TPU */ PINMUX_DATA(TPUTO_MARK, PSD8_TPUTO, SCIF0_SCK_TPUTO), /* FLCTL */ PINMUX_DATA(FCE_MARK, PSE3_FLCTL, FCE_VIO_HD2), PINMUX_DATA(NAF7_MARK, PSC0_NAF, HIZA10_NAF, NAF7_VIO_D15), PINMUX_DATA(NAF6_MARK, PSC0_NAF, HIZA10_NAF, NAF6_VIO_D14), PINMUX_DATA(NAF5_MARK, PSC0_NAF, HIZA10_NAF, NAF5_VIO_D13), PINMUX_DATA(NAF4_MARK, PSC0_NAF, HIZA10_NAF, NAF4_VIO_D12), PINMUX_DATA(NAF3_MARK, PSC0_NAF, HIZA10_NAF, NAF3_VIO_D11), PINMUX_DATA(NAF2_MARK, PSE2_NAF2, HIZB0_VIO, NAF2_VIO_D10), PINMUX_DATA(NAF1_MARK, PSE1_NAF1, HIZB0_VIO, NAF1_VIO_D9), PINMUX_DATA(NAF0_MARK, PSE0_NAF0, HIZB0_VIO, NAF0_VIO_D8), PINMUX_DATA(FCDE_MARK, FCDE), PINMUX_DATA(FOE_MARK, PSE3_FLCTL, HIZB0_VIO, FOE_VIO_VD2), PINMUX_DATA(FSC_MARK, FSC), PINMUX_DATA(FWE_MARK, FWE), PINMUX_DATA(FRB_MARK, PSE3_FLCTL, FRB_VIO_CLK2), /* KEYSC */ PINMUX_DATA(KEYIN0_MARK, PSA15_KEYIN0, HIZC14_IRQ6, KEYIN0_IRQ6), PINMUX_DATA(KEYIN1_MARK, HIZA14_KEYSC, KEYIN1), PINMUX_DATA(KEYIN2_MARK, HIZA14_KEYSC, KEYIN2), PINMUX_DATA(KEYIN3_MARK, HIZA14_KEYSC, KEYIN3), PINMUX_DATA(KEYIN4_MARK, PSA14_KEYIN4, HIZC15_IRQ7, KEYIN4_IRQ7), PINMUX_DATA(KEYOUT0_MARK, HIZA14_KEYSC, KEYOUT0), PINMUX_DATA(KEYOUT1_MARK, HIZA14_KEYSC, KEYOUT1), PINMUX_DATA(KEYOUT2_MARK, HIZA14_KEYSC, KEYOUT2), PINMUX_DATA(KEYOUT3_MARK, HIZA14_KEYSC, KEYOUT3), PINMUX_DATA(KEYOUT4_IN6_MARK, HIZA14_KEYSC, KEYOUT4_IN6), PINMUX_DATA(KEYOUT5_IN5_MARK, HIZA14_KEYSC, KEYOUT5_IN5), }; static const struct sh_pfc_pin pinmux_pins[] = { /* PTA */ PINMUX_GPIO(PTA7), PINMUX_GPIO(PTA6), PINMUX_GPIO(PTA5), PINMUX_GPIO(PTA4), PINMUX_GPIO(PTA3), PINMUX_GPIO(PTA2), PINMUX_GPIO(PTA1), PINMUX_GPIO(PTA0), /* PTB */ PINMUX_GPIO(PTB7), PINMUX_GPIO(PTB6), PINMUX_GPIO(PTB5), PINMUX_GPIO(PTB4), PINMUX_GPIO(PTB3), PINMUX_GPIO(PTB2), PINMUX_GPIO(PTB1), PINMUX_GPIO(PTB0), /* PTC */ PINMUX_GPIO(PTC7), PINMUX_GPIO(PTC5), PINMUX_GPIO(PTC4), PINMUX_GPIO(PTC3), PINMUX_GPIO(PTC2), PINMUX_GPIO(PTC0), /* PTD */ PINMUX_GPIO(PTD7), PINMUX_GPIO(PTD6), PINMUX_GPIO(PTD5), PINMUX_GPIO(PTD4), PINMUX_GPIO(PTD3), PINMUX_GPIO(PTD2), PINMUX_GPIO(PTD1), PINMUX_GPIO(PTD0), /* PTE */ PINMUX_GPIO(PTE7), PINMUX_GPIO(PTE6), PINMUX_GPIO(PTE5), PINMUX_GPIO(PTE4), PINMUX_GPIO(PTE1), PINMUX_GPIO(PTE0), /* PTF */ PINMUX_GPIO(PTF6), PINMUX_GPIO(PTF5), PINMUX_GPIO(PTF4), PINMUX_GPIO(PTF3), PINMUX_GPIO(PTF2), PINMUX_GPIO(PTF1), PINMUX_GPIO(PTF0), /* PTG */ PINMUX_GPIO(PTG4), PINMUX_GPIO(PTG3), PINMUX_GPIO(PTG2), PINMUX_GPIO(PTG1), PINMUX_GPIO(PTG0), /* PTH */ PINMUX_GPIO(PTH7), PINMUX_GPIO(PTH6), PINMUX_GPIO(PTH5), PINMUX_GPIO(PTH4), PINMUX_GPIO(PTH3), PINMUX_GPIO(PTH2), PINMUX_GPIO(PTH1), PINMUX_GPIO(PTH0), /* PTJ */ PINMUX_GPIO(PTJ7), PINMUX_GPIO(PTJ6), PINMUX_GPIO(PTJ5), PINMUX_GPIO(PTJ1), PINMUX_GPIO(PTJ0), /* PTK */ PINMUX_GPIO(PTK6), PINMUX_GPIO(PTK5), PINMUX_GPIO(PTK4), PINMUX_GPIO(PTK3), PINMUX_GPIO(PTK2), PINMUX_GPIO(PTK1), PINMUX_GPIO(PTK0), /* PTL */ PINMUX_GPIO(PTL7), PINMUX_GPIO(PTL6), PINMUX_GPIO(PTL5), PINMUX_GPIO(PTL4), PINMUX_GPIO(PTL3), PINMUX_GPIO(PTL2), PINMUX_GPIO(PTL1), PINMUX_GPIO(PTL0), /* PTM */ PINMUX_GPIO(PTM7), PINMUX_GPIO(PTM6), PINMUX_GPIO(PTM5), PINMUX_GPIO(PTM4), PINMUX_GPIO(PTM3), PINMUX_GPIO(PTM2), PINMUX_GPIO(PTM1), PINMUX_GPIO(PTM0), /* PTN */ PINMUX_GPIO(PTN7), PINMUX_GPIO(PTN6), PINMUX_GPIO(PTN5), PINMUX_GPIO(PTN4), PINMUX_GPIO(PTN3), PINMUX_GPIO(PTN2), PINMUX_GPIO(PTN1), PINMUX_GPIO(PTN0), /* PTQ */ PINMUX_GPIO(PTQ6), PINMUX_GPIO(PTQ5), PINMUX_GPIO(PTQ4), PINMUX_GPIO(PTQ3), PINMUX_GPIO(PTQ2), PINMUX_GPIO(PTQ1), PINMUX_GPIO(PTQ0), /* PTR */ PINMUX_GPIO(PTR4), PINMUX_GPIO(PTR3), PINMUX_GPIO(PTR2), PINMUX_GPIO(PTR1), PINMUX_GPIO(PTR0), /* PTS */ PINMUX_GPIO(PTS4), PINMUX_GPIO(PTS3), PINMUX_GPIO(PTS2), PINMUX_GPIO(PTS1), PINMUX_GPIO(PTS0), /* PTT */ PINMUX_GPIO(PTT4), PINMUX_GPIO(PTT3), PINMUX_GPIO(PTT2), PINMUX_GPIO(PTT1), PINMUX_GPIO(PTT0), /* PTU */ PINMUX_GPIO(PTU4), PINMUX_GPIO(PTU3), PINMUX_GPIO(PTU2), PINMUX_GPIO(PTU1), PINMUX_GPIO(PTU0), /* PTV */ PINMUX_GPIO(PTV4), PINMUX_GPIO(PTV3), PINMUX_GPIO(PTV2), PINMUX_GPIO(PTV1), PINMUX_GPIO(PTV0), /* PTW */ PINMUX_GPIO(PTW6), PINMUX_GPIO(PTW5), PINMUX_GPIO(PTW4), PINMUX_GPIO(PTW3), PINMUX_GPIO(PTW2), PINMUX_GPIO(PTW1), PINMUX_GPIO(PTW0), /* PTX */ PINMUX_GPIO(PTX6), PINMUX_GPIO(PTX5), PINMUX_GPIO(PTX4), PINMUX_GPIO(PTX3), PINMUX_GPIO(PTX2), PINMUX_GPIO(PTX1), PINMUX_GPIO(PTX0), /* PTY */ PINMUX_GPIO(PTY5), PINMUX_GPIO(PTY4), PINMUX_GPIO(PTY3), PINMUX_GPIO(PTY2), PINMUX_GPIO(PTY1), PINMUX_GPIO(PTY0), /* PTZ */ PINMUX_GPIO(PTZ5), PINMUX_GPIO(PTZ4), PINMUX_GPIO(PTZ3), PINMUX_GPIO(PTZ2), PINMUX_GPIO(PTZ1), }; #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) static const struct pinmux_func pinmux_func_gpios[] = { /* SCIF0 */ GPIO_FN(SCIF0_TXD), GPIO_FN(SCIF0_RXD), GPIO_FN(SCIF0_RTS), GPIO_FN(SCIF0_CTS), GPIO_FN(SCIF0_SCK), /* SCIF1 */ GPIO_FN(SCIF1_TXD), GPIO_FN(SCIF1_RXD), GPIO_FN(SCIF1_RTS), GPIO_FN(SCIF1_CTS), GPIO_FN(SCIF1_SCK), /* SCIF2 */ GPIO_FN(SCIF2_TXD), GPIO_FN(SCIF2_RXD), GPIO_FN(SCIF2_RTS), GPIO_FN(SCIF2_CTS), GPIO_FN(SCIF2_SCK), /* SIO */ GPIO_FN(SIOTXD), GPIO_FN(SIORXD), GPIO_FN(SIOD), GPIO_FN(SIOSTRB0), GPIO_FN(SIOSTRB1), GPIO_FN(SIOSCK), GPIO_FN(SIOMCK), /* CEU */ GPIO_FN(VIO_D15), GPIO_FN(VIO_D14), GPIO_FN(VIO_D13), GPIO_FN(VIO_D12), GPIO_FN(VIO_D11), GPIO_FN(VIO_D10), GPIO_FN(VIO_D9), GPIO_FN(VIO_D8), GPIO_FN(VIO_D7), GPIO_FN(VIO_D6), GPIO_FN(VIO_D5), GPIO_FN(VIO_D4), GPIO_FN(VIO_D3), GPIO_FN(VIO_D2), GPIO_FN(VIO_D1), GPIO_FN(VIO_D0), GPIO_FN(VIO_CLK), GPIO_FN(VIO_VD), GPIO_FN(VIO_HD), GPIO_FN(VIO_FLD), GPIO_FN(VIO_CKO), GPIO_FN(VIO_STEX), GPIO_FN(VIO_STEM), GPIO_FN(VIO_VD2), GPIO_FN(VIO_HD2), GPIO_FN(VIO_CLK2), /* LCDC */ GPIO_FN(LCDD23), GPIO_FN(LCDD22), GPIO_FN(LCDD21), GPIO_FN(LCDD20), GPIO_FN(LCDD19), GPIO_FN(LCDD18), GPIO_FN(LCDD17), GPIO_FN(LCDD16), GPIO_FN(LCDD15), GPIO_FN(LCDD14), GPIO_FN(LCDD13), GPIO_FN(LCDD12), GPIO_FN(LCDD11), GPIO_FN(LCDD10), GPIO_FN(LCDD9), GPIO_FN(LCDD8), GPIO_FN(LCDD7), GPIO_FN(LCDD6), GPIO_FN(LCDD5), GPIO_FN(LCDD4), GPIO_FN(LCDD3), GPIO_FN(LCDD2), GPIO_FN(LCDD1), GPIO_FN(LCDD0), GPIO_FN(LCDLCLK), /* Main LCD */ GPIO_FN(LCDDON), GPIO_FN(LCDVCPWC), GPIO_FN(LCDVEPWC), GPIO_FN(LCDVSYN), /* Main LCD - RGB Mode */ GPIO_FN(LCDDCK), GPIO_FN(LCDHSYN), GPIO_FN(LCDDISP), /* Main LCD - SYS Mode */ GPIO_FN(LCDRS), GPIO_FN(LCDCS), GPIO_FN(LCDWR), GPIO_FN(LCDRD), /* Sub LCD - SYS Mode */ GPIO_FN(LCDDON2), GPIO_FN(LCDVCPWC2), GPIO_FN(LCDVEPWC2), GPIO_FN(LCDVSYN2), GPIO_FN(LCDCS2), /* BSC */ GPIO_FN(IOIS16), GPIO_FN(A25), GPIO_FN(A24), GPIO_FN(A23), GPIO_FN(A22), GPIO_FN(BS), GPIO_FN(CS6B_CE1B), GPIO_FN(WAIT), GPIO_FN(CS6A_CE2B), /* SBSC */ GPIO_FN(HPD63), GPIO_FN(HPD62), GPIO_FN(HPD61), GPIO_FN(HPD60), GPIO_FN(HPD59), GPIO_FN(HPD58), GPIO_FN(HPD57), GPIO_FN(HPD56), GPIO_FN(HPD55), GPIO_FN(HPD54), GPIO_FN(HPD53), GPIO_FN(HPD52), GPIO_FN(HPD51), GPIO_FN(HPD50), GPIO_FN(HPD49), GPIO_FN(HPD48), GPIO_FN(HPDQM7), GPIO_FN(HPDQM6), GPIO_FN(HPDQM5), GPIO_FN(HPDQM4), /* IRQ */ GPIO_FN(IRQ0), GPIO_FN(IRQ1), GPIO_FN(IRQ2), GPIO_FN(IRQ3), GPIO_FN(IRQ4), GPIO_FN(IRQ5), GPIO_FN(IRQ6), GPIO_FN(IRQ7), /* SDHI */ GPIO_FN(SDHICD), GPIO_FN(SDHIWP), GPIO_FN(SDHID3), GPIO_FN(SDHID2), GPIO_FN(SDHID1), GPIO_FN(SDHID0), GPIO_FN(SDHICMD), GPIO_FN(SDHICLK), /* SIU - Port A */ GPIO_FN(SIUAOLR), GPIO_FN(SIUAOBT), GPIO_FN(SIUAISLD), GPIO_FN(SIUAILR), GPIO_FN(SIUAIBT), GPIO_FN(SIUAOSLD), GPIO_FN(SIUMCKA), GPIO_FN(SIUFCKA), /* SIU - Port B */ GPIO_FN(SIUBOLR), GPIO_FN(SIUBOBT), GPIO_FN(SIUBISLD), GPIO_FN(SIUBILR), GPIO_FN(SIUBIBT), GPIO_FN(SIUBOSLD), GPIO_FN(SIUMCKB), GPIO_FN(SIUFCKB), /* AUD */ GPIO_FN(AUDSYNC), GPIO_FN(AUDATA3), GPIO_FN(AUDATA2), GPIO_FN(AUDATA1), GPIO_FN(AUDATA0), /* DMAC */ GPIO_FN(DACK), GPIO_FN(DREQ0), /* VOU */ GPIO_FN(DV_CLKI), GPIO_FN(DV_CLK), GPIO_FN(DV_HSYNC), GPIO_FN(DV_VSYNC), GPIO_FN(DV_D15), GPIO_FN(DV_D14), GPIO_FN(DV_D13), GPIO_FN(DV_D12), GPIO_FN(DV_D11), GPIO_FN(DV_D10), GPIO_FN(DV_D9), GPIO_FN(DV_D8), GPIO_FN(DV_D7), GPIO_FN(DV_D6), GPIO_FN(DV_D5), GPIO_FN(DV_D4), GPIO_FN(DV_D3), GPIO_FN(DV_D2), GPIO_FN(DV_D1), GPIO_FN(DV_D0), /* CPG */ GPIO_FN(STATUS0), GPIO_FN(PDSTATUS), /* SIOF0 */ GPIO_FN(SIOF0_MCK), GPIO_FN(SIOF0_SCK), GPIO_FN(SIOF0_SYNC), GPIO_FN(SIOF0_SS1), GPIO_FN(SIOF0_SS2), GPIO_FN(SIOF0_TXD), GPIO_FN(SIOF0_RXD), /* SIOF1 */ GPIO_FN(SIOF1_MCK), GPIO_FN(SIOF1_SCK), GPIO_FN(SIOF1_SYNC), GPIO_FN(SIOF1_SS1), GPIO_FN(SIOF1_SS2), GPIO_FN(SIOF1_TXD), GPIO_FN(SIOF1_RXD), /* SIM */ GPIO_FN(SIM_D), GPIO_FN(SIM_CLK), GPIO_FN(SIM_RST), /* TSIF */ GPIO_FN(TS_SDAT), GPIO_FN(TS_SCK), GPIO_FN(TS_SDEN), GPIO_FN(TS_SPSYNC), /* IRDA */ GPIO_FN(IRDA_IN), GPIO_FN(IRDA_OUT), /* TPU */ GPIO_FN(TPUTO), /* FLCTL */ GPIO_FN(FCE), GPIO_FN(NAF7), GPIO_FN(NAF6), GPIO_FN(NAF5), GPIO_FN(NAF4), GPIO_FN(NAF3), GPIO_FN(NAF2), GPIO_FN(NAF1), GPIO_FN(NAF0), GPIO_FN(FCDE), GPIO_FN(FOE), GPIO_FN(FSC), GPIO_FN(FWE), GPIO_FN(FRB), /* KEYSC */ GPIO_FN(KEYIN0), GPIO_FN(KEYIN1), GPIO_FN(KEYIN2), GPIO_FN(KEYIN3), GPIO_FN(KEYIN4), GPIO_FN(KEYOUT0), GPIO_FN(KEYOUT1), GPIO_FN(KEYOUT2), GPIO_FN(KEYOUT3), GPIO_FN(KEYOUT4_IN6), GPIO_FN(KEYOUT5_IN5), }; static const struct pinmux_cfg_reg pinmux_config_regs[] = { { PINMUX_CFG_REG("PACR", 0xa4050100, 16, 2, GROUP( VIO_D7_SCIF1_SCK, PTA7_OUT, 0, PTA7_IN, VIO_D6_SCIF1_RXD, 0, 0, PTA6_IN, VIO_D5_SCIF1_TXD, PTA5_OUT, 0, PTA5_IN, VIO_D4, 0, 0, PTA4_IN, VIO_D3, 0, 0, PTA3_IN, VIO_D2, 0, 0, PTA2_IN, VIO_D1, 0, 0, PTA1_IN, VIO_D0_LCDLCLK, 0, 0, PTA0_IN )) }, { PINMUX_CFG_REG("PBCR", 0xa4050102, 16, 2, GROUP( HPD55, PTB7_OUT, 0, PTB7_IN, HPD54, PTB6_OUT, 0, PTB6_IN, HPD53, PTB5_OUT, 0, PTB5_IN, HPD52, PTB4_OUT, 0, PTB4_IN, HPD51, PTB3_OUT, 0, PTB3_IN, HPD50, PTB2_OUT, 0, PTB2_IN, HPD49, PTB1_OUT, 0, PTB1_IN, HPD48, PTB0_OUT, 0, PTB0_IN )) }, { PINMUX_CFG_REG("PCCR", 0xa4050104, 16, 2, GROUP( 0, 0, 0, PTC7_IN, 0, 0, 0, 0, IOIS16, 0, 0, PTC5_IN, HPDQM7, PTC4_OUT, 0, PTC4_IN, HPDQM6, PTC3_OUT, 0, PTC3_IN, HPDQM5, PTC2_OUT, 0, PTC2_IN, 0, 0, 0, 0, HPDQM4, PTC0_OUT, 0, PTC0_IN )) }, { PINMUX_CFG_REG("PDCR", 0xa4050106, 16, 2, GROUP( SDHICD, 0, 0, PTD7_IN, SDHIWP, PTD6_OUT, 0, PTD6_IN, SDHID3, PTD5_OUT, 0, PTD5_IN, IRQ2_SDHID2, PTD4_OUT, 0, PTD4_IN, SDHID1, PTD3_OUT, 0, PTD3_IN, SDHID0, PTD2_OUT, 0, PTD2_IN, SDHICMD, PTD1_OUT, 0, PTD1_IN, SDHICLK, PTD0_OUT, 0, 0 )) }, { PINMUX_CFG_REG("PECR", 0xa4050108, 16, 2, GROUP( A25, PTE7_OUT, 0, PTE7_IN, A24, PTE6_OUT, 0, PTE6_IN, A23, PTE5_OUT, 0, PTE5_IN, A22, PTE4_OUT, 0, PTE4_IN, 0, 0, 0, 0, 0, 0, 0, 0, IRQ5, PTE1_OUT, 0, PTE1_IN, IRQ4_BS, PTE0_OUT, 0, PTE0_IN )) }, { PINMUX_CFG_REG("PFCR", 0xa405010a, 16, 2, GROUP( 0, 0, 0, 0, PTF6, PTF6_OUT, 0, PTF6_IN, SIOSCK_SIUBOBT, PTF5_OUT, 0, PTF5_IN, SIOSTRB1_SIUBOLR, PTF4_OUT, 0, PTF4_IN, SIOSTRB0_SIUBIBT, PTF3_OUT, 0, PTF3_IN, SIOD_SIUBILR, PTF2_OUT, 0, PTF2_IN, SIORXD_SIUBISLD, 0, 0, PTF1_IN, SIOTXD_SIUBOSLD, PTF0_OUT, 0, 0 )) }, { PINMUX_CFG_REG("PGCR", 0xa405010c, 16, 2, GROUP( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, AUDSYNC, PTG4_OUT, 0, 0, AUDATA3, PTG3_OUT, 0, 0, AUDATA2, PTG2_OUT, 0, 0, AUDATA1, PTG1_OUT, 0, 0, AUDATA0, PTG0_OUT, 0, 0 )) }, { PINMUX_CFG_REG("PHCR", 0xa405010e, 16, 2, GROUP( LCDVCPWC_LCDVCPWC2, PTH7_OUT, 0, 0, LCDVSYN2_DACK, PTH6_OUT, 0, PTH6_IN, LCDVSYN, PTH5_OUT, 0, PTH5_IN, LCDDISP_LCDRS, PTH4_OUT, 0, 0, LCDHSYN_LCDCS, PTH3_OUT, 0, 0, LCDDON_LCDDON2, PTH2_OUT, 0, 0, LCDD17_DV_HSYNC, PTH1_OUT, 0, PTH1_IN, LCDD16_DV_VSYNC, PTH0_OUT, 0, PTH0_IN )) }, { PINMUX_CFG_REG("PJCR", 0xa4050110, 16, 2, GROUP( STATUS0, PTJ7_OUT, 0, 0, 0, PTJ6_OUT, 0, 0, PDSTATUS, PTJ5_OUT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IRQ1, PTJ1_OUT, 0, PTJ1_IN, IRQ0, PTJ0_OUT, 0, PTJ0_IN )) }, { PINMUX_CFG_REG("PKCR", 0xa4050112, 16, 2, GROUP( 0, 0, 0, 0, SIUAILR_SIOF1_SS2, PTK6_OUT, 0, PTK6_IN, SIUAIBT_SIOF1_SS1, PTK5_OUT, 0, PTK5_IN, SIUAOLR_SIOF1_SYNC, PTK4_OUT, 0, PTK4_IN, SIUAOBT_SIOF1_SCK, PTK3_OUT, 0, PTK3_IN, SIUAISLD_SIOF1_RXD, 0, 0, PTK2_IN, SIUAOSLD_SIOF1_TXD, PTK1_OUT, 0, 0, PTK0, PTK0_OUT, 0, PTK0_IN )) }, { PINMUX_CFG_REG("PLCR", 0xa4050114, 16, 2, GROUP( LCDD15_DV_D15, PTL7_OUT, 0, PTL7_IN, LCDD14_DV_D14, PTL6_OUT, 0, PTL6_IN, LCDD13_DV_D13, PTL5_OUT, 0, PTL5_IN, LCDD12_DV_D12, PTL4_OUT, 0, PTL4_IN, LCDD11_DV_D11, PTL3_OUT, 0, PTL3_IN, LCDD10_DV_D10, PTL2_OUT, 0, PTL2_IN, LCDD9_DV_D9, PTL1_OUT, 0, PTL1_IN, LCDD8_DV_D8, PTL0_OUT, 0, PTL0_IN )) }, { PINMUX_CFG_REG("PMCR", 0xa4050116, 16, 2, GROUP( LCDD7_DV_D7, PTM7_OUT, 0, PTM7_IN, LCDD6_DV_D6, PTM6_OUT, 0, PTM6_IN, LCDD5_DV_D5, PTM5_OUT, 0, PTM5_IN, LCDD4_DV_D4, PTM4_OUT, 0, PTM4_IN, LCDD3_DV_D3, PTM3_OUT, 0, PTM3_IN, LCDD2_DV_D2, PTM2_OUT, 0, PTM2_IN, LCDD1_DV_D1, PTM1_OUT, 0, PTM1_IN, LCDD0_DV_D0, PTM0_OUT, 0, PTM0_IN )) }, { PINMUX_CFG_REG("PNCR", 0xa4050118, 16, 2, GROUP( HPD63, PTN7_OUT, 0, PTN7_IN, HPD62, PTN6_OUT, 0, PTN6_IN, HPD61, PTN5_OUT, 0, PTN5_IN, HPD60, PTN4_OUT, 0, PTN4_IN, HPD59, PTN3_OUT, 0, PTN3_IN, HPD58, PTN2_OUT, 0, PTN2_IN, HPD57, PTN1_OUT, 0, PTN1_IN, HPD56, PTN0_OUT, 0, PTN0_IN )) }, { PINMUX_CFG_REG("PQCR", 0xa405011a, 16, 2, GROUP( 0, 0, 0, 0, SIOF0_SS2_SIM_RST, PTQ6_OUT, 0, 0, SIOF0_SS1_TS_SPSYNC, PTQ5_OUT, 0, PTQ5_IN, SIOF0_SYNC_TS_SDEN, PTQ4_OUT, 0, PTQ4_IN, SIOF0_SCK_TS_SCK, PTQ3_OUT, 0, PTQ3_IN, PTQ2, 0, 0, PTQ2_IN, PTQ1, PTQ1_OUT, 0, 0, PTQ0, PTQ0_OUT, 0, PTQ0_IN )) }, { PINMUX_CFG_REG("PRCR", 0xa405011c, 16, 2, GROUP( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, LCDRD, PTR4_OUT, 0, 0, CS6B_CE1B_LCDCS2, PTR3_OUT, 0, 0, WAIT, 0, 0, PTR2_IN, LCDDCK_LCDWR, PTR1_OUT, 0, 0, LCDVEPWC_LCDVEPWC2, PTR0_OUT, 0, 0 )) }, { PINMUX_CFG_REG("PSCR", 0xa405011e, 16, 2, GROUP( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, SCIF0_CTS_SIUAISPD, 0, 0, PTS4_IN, SCIF0_RTS_SIUAOSPD, PTS3_OUT, 0, 0, SCIF0_SCK_TPUTO, PTS2_OUT, 0, PTS2_IN, SCIF0_RXD, 0, 0, PTS1_IN, SCIF0_TXD, PTS0_OUT, 0, 0 )) }, { PINMUX_CFG_REG("PTCR", 0xa4050140, 16, 2, GROUP( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FOE_VIO_VD2, PTT4_OUT, 0, PTT4_IN, FWE, PTT3_OUT, 0, PTT3_IN, FSC, PTT2_OUT, 0, PTT2_IN, DREQ0, 0, 0, PTT1_IN, FCDE, PTT0_OUT, 0, 0 )) }, { PINMUX_CFG_REG("PUCR", 0xa4050142, 16, 2, GROUP( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NAF2_VIO_D10, PTU4_OUT, 0, PTU4_IN, NAF1_VIO_D9, PTU3_OUT, 0, PTU3_IN, NAF0_VIO_D8, PTU2_OUT, 0, PTU2_IN, FRB_VIO_CLK2, 0, 0, PTU1_IN, FCE_VIO_HD2, PTU0_OUT, 0, PTU0_IN )) }, { PINMUX_CFG_REG("PVCR", 0xa4050144, 16, 2, GROUP( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NAF7_VIO_D15, PTV4_OUT, 0, PTV4_IN, NAF6_VIO_D14, PTV3_OUT, 0, PTV3_IN, NAF5_VIO_D13, PTV2_OUT, 0, PTV2_IN, NAF4_VIO_D12, PTV1_OUT, 0, PTV1_IN, NAF3_VIO_D11, PTV0_OUT, 0, PTV0_IN )) }, { PINMUX_CFG_REG("PWCR", 0xa4050146, 16, 2, GROUP( 0, 0, 0, 0, VIO_FLD_SCIF2_CTS, 0, 0, PTW6_IN, VIO_CKO_SCIF2_RTS, PTW5_OUT, 0, 0, VIO_STEX_SCIF2_SCK, PTW4_OUT, 0, PTW4_IN, VIO_STEM_SCIF2_TXD, PTW3_OUT, 0, PTW3_IN, VIO_HD_SCIF2_RXD, PTW2_OUT, 0, PTW2_IN, VIO_VD_SCIF1_CTS, PTW1_OUT, 0, PTW1_IN, VIO_CLK_SCIF1_RTS, PTW0_OUT, 0, PTW0_IN )) }, { PINMUX_CFG_REG("PXCR", 0xa4050148, 16, 2, GROUP( 0, 0, 0, 0, CS6A_CE2B, PTX6_OUT, 0, PTX6_IN, LCDD23, PTX5_OUT, 0, PTX5_IN, LCDD22, PTX4_OUT, 0, PTX4_IN, LCDD21, PTX3_OUT, 0, PTX3_IN, LCDD20, PTX2_OUT, 0, PTX2_IN, LCDD19_DV_CLKI, PTX1_OUT, 0, PTX1_IN, LCDD18_DV_CLK, PTX0_OUT, 0, PTX0_IN )) }, { PINMUX_CFG_REG("PYCR", 0xa405014a, 16, 2, GROUP( 0, 0, 0, 0, 0, 0, 0, 0, KEYOUT5_IN5, PTY5_OUT, 0, PTY5_IN, KEYOUT4_IN6, PTY4_OUT, 0, PTY4_IN, KEYOUT3, PTY3_OUT, 0, PTY3_IN, KEYOUT2, PTY2_OUT, 0, PTY2_IN, KEYOUT1, PTY1_OUT, 0, 0, KEYOUT0, PTY0_OUT, 0, PTY0_IN )) }, { PINMUX_CFG_REG("PZCR", 0xa405014c, 16, 2, GROUP( 0, 0, 0, 0, 0, 0, 0, 0, KEYIN4_IRQ7, 0, 0, PTZ5_IN, KEYIN3, 0, 0, PTZ4_IN, KEYIN2, 0, 0, PTZ3_IN, KEYIN1, 0, 0, PTZ2_IN, KEYIN0_IRQ6, 0, 0, PTZ1_IN, 0, 0, 0, 0 )) }, { PINMUX_CFG_REG("PSELA", 0xa405014e, 16, 1, GROUP( PSA15_KEYIN0, PSA15_IRQ6, PSA14_KEYIN4, PSA14_IRQ7, 0, 0, 0, 0, 0, 0, 0, 0, PSA9_IRQ4, PSA9_BS, 0, 0, 0, 0, 0, 0, 0, 0, PSA4_IRQ2, PSA4_SDHID2, 0, 0, 0, 0, 0, 0, 0, 0 )) }, { PINMUX_CFG_REG("PSELB", 0xa4050150, 16, 1, GROUP( PSB15_SIOTXD, PSB15_SIUBOSLD, PSB14_SIORXD, PSB14_SIUBISLD, PSB13_SIOD, PSB13_SIUBILR, PSB12_SIOSTRB0, PSB12_SIUBIBT, PSB11_SIOSTRB1, PSB11_SIUBOLR, PSB10_SIOSCK, PSB10_SIUBOBT, PSB9_SIOMCK, PSB9_SIUMCKB, PSB8_SIOF0_MCK, PSB8_IRQ3, PSB7_SIOF0_TXD, PSB7_IRDA_OUT, PSB6_SIOF0_RXD, PSB6_IRDA_IN, PSB5_SIOF0_SCK, PSB5_TS_SCK, PSB4_SIOF0_SYNC, PSB4_TS_SDEN, PSB3_SIOF0_SS1, PSB3_TS_SPSYNC, PSB2_SIOF0_SS2, PSB2_SIM_RST, PSB1_SIUMCKA, PSB1_SIOF1_MCK, PSB0_SIUAOSLD, PSB0_SIOF1_TXD )) }, { PINMUX_CFG_REG("PSELC", 0xa4050152, 16, 1, GROUP( PSC15_SIUAISLD, PSC15_SIOF1_RXD, PSC14_SIUAOBT, PSC14_SIOF1_SCK, PSC13_SIUAOLR, PSC13_SIOF1_SYNC, PSC12_SIUAIBT, PSC12_SIOF1_SS1, PSC11_SIUAILR, PSC11_SIOF1_SS2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, PSC0_NAF, PSC0_VIO )) }, { PINMUX_CFG_REG("PSELD", 0xa4050154, 16, 1, GROUP( 0, 0, 0, 0, PSD13_VIO, PSD13_SCIF2, PSD12_VIO, PSD12_SCIF1, PSD11_VIO, PSD11_SCIF1, PSD10_VIO_D0, PSD10_LCDLCLK, PSD9_SIOMCK_SIUMCKB, PSD9_SIUFCKB, PSD8_SCIF0_SCK, PSD8_TPUTO, PSD7_SCIF0_RTS, PSD7_SIUAOSPD, PSD6_SCIF0_CTS, PSD6_SIUAISPD, PSD5_CS6B_CE1B, PSD5_LCDCS2, 0, 0, PSD3_LCDVEPWC_LCDVCPWC, PSD3_LCDVEPWC2_LCDVCPWC2, PSD2_LCDDON, PSD2_LCDDON2, 0, 0, PSD0_LCDD19_LCDD0, PSD0_DV )) }, { PINMUX_CFG_REG("PSELE", 0xa4050156, 16, 1, GROUP( PSE15_SIOF0_MCK_IRQ3, PSE15_SIM_D, PSE14_SIOF0_TXD_IRDA_OUT, PSE14_SIM_CLK, PSE13_SIOF0_RXD_IRDA_IN, PSE13_TS_SDAT, PSE12_LCDVSYN2, PSE12_DACK, PSE11_SIUMCKA_SIOF1_MCK, PSE11_SIUFCKA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, PSE3_FLCTL, PSE3_VIO, PSE2_NAF2, PSE2_VIO_D10, PSE1_NAF1, PSE1_VIO_D9, PSE0_NAF0, PSE0_VIO_D8 )) }, { PINMUX_CFG_REG("HIZCRA", 0xa4050158, 16, 1, GROUP( 0, 0, HIZA14_KEYSC, HIZA14_HIZ, 0, 0, 0, 0, 0, 0, HIZA10_NAF, HIZA10_HIZ, HIZA9_VIO, HIZA9_HIZ, HIZA8_LCDC, HIZA8_HIZ, HIZA7_LCDC, HIZA7_HIZ, HIZA6_LCDC, HIZA6_HIZ, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )) }, { PINMUX_CFG_REG("HIZCRB", 0xa405015a, 16, 1, GROUP( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, HIZB4_SIUA, HIZB4_HIZ, 0, 0, 0, 0, HIZB1_VIO, HIZB1_HIZ, HIZB0_VIO, HIZB0_HIZ )) }, { PINMUX_CFG_REG("HIZCRC", 0xa405015c, 16, 1, GROUP( HIZC15_IRQ7, HIZC15_HIZ, HIZC14_IRQ6, HIZC14_HIZ, HIZC13_IRQ5, HIZC13_HIZ, HIZC12_IRQ4, HIZC12_HIZ, HIZC11_IRQ3, HIZC11_HIZ, HIZC10_IRQ2, HIZC10_HIZ, HIZC9_IRQ1, HIZC9_HIZ, HIZC8_IRQ0, HIZC8_HIZ, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )) }, { PINMUX_CFG_REG("MSELCRB", 0xa4050182, 16, 1, GROUP( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MSELB9_VIO, MSELB9_VIO2, MSELB8_RGB, MSELB8_SYS, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )) }, {} }; static const struct pinmux_data_reg pinmux_data_regs[] = { { PINMUX_DATA_REG("PADR", 0xa4050120, 8, GROUP( PTA7_DATA, PTA6_DATA, PTA5_DATA, PTA4_DATA, PTA3_DATA, PTA2_DATA, PTA1_DATA, PTA0_DATA )) }, { PINMUX_DATA_REG("PBDR", 0xa4050122, 8, GROUP( PTB7_DATA, PTB6_DATA, PTB5_DATA, PTB4_DATA, PTB3_DATA, PTB2_DATA, PTB1_DATA, PTB0_DATA )) }, { PINMUX_DATA_REG("PCDR", 0xa4050124, 8, GROUP( PTC7_DATA, 0, PTC5_DATA, PTC4_DATA, PTC3_DATA, PTC2_DATA, 0, PTC0_DATA )) }, { PINMUX_DATA_REG("PDDR", 0xa4050126, 8, GROUP( PTD7_DATA, PTD6_DATA, PTD5_DATA, PTD4_DATA, PTD3_DATA, PTD2_DATA, PTD1_DATA, PTD0_DATA )) }, { PINMUX_DATA_REG("PEDR", 0xa4050128, 8, GROUP( PTE7_DATA, PTE6_DATA, PTE5_DATA, PTE4_DATA, 0, 0, PTE1_DATA, PTE0_DATA )) }, { PINMUX_DATA_REG("PFDR", 0xa405012a, 8, GROUP( 0, PTF6_DATA, PTF5_DATA, PTF4_DATA, PTF3_DATA, PTF2_DATA, PTF1_DATA, PTF0_DATA )) }, { PINMUX_DATA_REG("PGDR", 0xa405012c, 8, GROUP( 0, 0, 0, PTG4_DATA, PTG3_DATA, PTG2_DATA, PTG1_DATA, PTG0_DATA )) }, { PINMUX_DATA_REG("PHDR", 0xa405012e, 8, GROUP( PTH7_DATA, PTH6_DATA, PTH5_DATA, PTH4_DATA, PTH3_DATA, PTH2_DATA, PTH1_DATA, PTH0_DATA )) }, { PINMUX_DATA_REG("PJDR", 0xa4050130, 8, GROUP( PTJ7_DATA, PTJ6_DATA, PTJ5_DATA, 0, 0, 0, PTJ1_DATA, PTJ0_DATA )) }, { PINMUX_DATA_REG("PKDR", 0xa4050132, 8, GROUP( 0, PTK6_DATA, PTK5_DATA, PTK4_DATA, PTK3_DATA, PTK2_DATA, PTK1_DATA, PTK0_DATA )) }, { PINMUX_DATA_REG("PLDR", 0xa4050134, 8, GROUP( PTL7_DATA, PTL6_DATA, PTL5_DATA, PTL4_DATA, PTL3_DATA, PTL2_DATA, PTL1_DATA, PTL0_DATA )) }, { PINMUX_DATA_REG("PMDR", 0xa4050136, 8, GROUP( PTM7_DATA, PTM6_DATA, PTM5_DATA, PTM4_DATA, PTM3_DATA, PTM2_DATA, PTM1_DATA, PTM0_DATA )) }, { PINMUX_DATA_REG("PNDR", 0xa4050138, 8, GROUP( PTN7_DATA, PTN6_DATA, PTN5_DATA, PTN4_DATA, PTN3_DATA, PTN2_DATA, PTN1_DATA, PTN0_DATA )) }, { PINMUX_DATA_REG("PQDR", 0xa405013a, 8, GROUP( 0, PTQ6_DATA, PTQ5_DATA, PTQ4_DATA, PTQ3_DATA, PTQ2_DATA, PTQ1_DATA, PTQ0_DATA )) }, { PINMUX_DATA_REG("PRDR", 0xa405013c, 8, GROUP( 0, 0, 0, PTR4_DATA, PTR3_DATA, PTR2_DATA, PTR1_DATA, PTR0_DATA )) }, { PINMUX_DATA_REG("PSDR", 0xa405013e, 8, GROUP( 0, 0, 0, PTS4_DATA, PTS3_DATA, PTS2_DATA, PTS1_DATA, PTS0_DATA )) }, { PINMUX_DATA_REG("PTDR", 0xa4050160, 8, GROUP( 0, 0, 0, PTT4_DATA, PTT3_DATA, PTT2_DATA, PTT1_DATA, PTT0_DATA )) }, { PINMUX_DATA_REG("PUDR", 0xa4050162, 8, GROUP( 0, 0, 0, PTU4_DATA, PTU3_DATA, PTU2_DATA, PTU1_DATA, PTU0_DATA )) }, { PINMUX_DATA_REG("PVDR", 0xa4050164, 8, GROUP( 0, 0, 0, PTV4_DATA, PTV3_DATA, PTV2_DATA, PTV1_DATA, PTV0_DATA )) }, { PINMUX_DATA_REG("PWDR", 0xa4050166, 8, GROUP( 0, PTW6_DATA, PTW5_DATA, PTW4_DATA, PTW3_DATA, PTW2_DATA, PTW1_DATA, PTW0_DATA )) }, { PINMUX_DATA_REG("PXDR", 0xa4050168, 8, GROUP( 0, PTX6_DATA, PTX5_DATA, PTX4_DATA, PTX3_DATA, PTX2_DATA, PTX1_DATA, PTX0_DATA )) }, { PINMUX_DATA_REG("PYDR", 0xa405016a, 8, GROUP( 0, PTY6_DATA, PTY5_DATA, PTY4_DATA, PTY3_DATA, PTY2_DATA, PTY1_DATA, PTY0_DATA )) }, { PINMUX_DATA_REG("PZDR", 0xa405016c, 8, GROUP( 0, 0, PTZ5_DATA, PTZ4_DATA, PTZ3_DATA, PTZ2_DATA, PTZ1_DATA, PTZ0_DATA )) }, { }, }; const struct sh_pfc_soc_info sh7722_pinmux_info = { .name = "sh7722_pfc", .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, .pins = pinmux_pins, .nr_pins = ARRAY_SIZE(pinmux_pins), .func_gpios = pinmux_func_gpios, .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), .cfg_regs = pinmux_config_regs, .data_regs = pinmux_data_regs, .pinmux_data = pinmux_data, .pinmux_data_size = ARRAY_SIZE(pinmux_data), };
8e14b9835dbf633959a8162d60e7a17b8e6c1587
dd5bf05da67d18bb0282c63b3494b6267ba88ed2
/TI_Launchpad/TIVA C/026_LCD_UART_KEYPAD/main.c
5c1dd67701488db0975d508e92048b9d0289bb1d
[]
no_license
carlosbelmonte2910/Programacion
f21aa0119475e0ec896a0be7ffed12587fa93373
8a1b30b897c076a66afb0ecfde630b036d821f52
refs/heads/master
2021-01-19T04:40:30.984594
2016-09-24T21:07:27
2016-09-24T21:07:27
69,088,557
0
1
null
null
null
null
ISO-8859-2
C
false
false
4,482
c
main.c
#include <stdint.h> #include <stdbool.h> #include <stdio.h> #include "driverlib/debug.h" #include "driverlib/fpu.h" #include "driverlib/rom.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/gpio.h" #include "driverlib/pin_map.h" #include "driverlib/sysctl.h" #include "driverlib/uart.h" #include "inc/hw_ints.h" #include "driverlib/interrupt.h" #include "Lcd.h" #include "KeyPad.h" //unsigned char received_character; //temporal variable where to store the key press number static int num; /* ISR to key-scan, i have been thinking to just raise a flag and then later on check keypad */ void scan_key(void) { int i; int key=0; IntMasterDisable(); //disable interrupts for (i=0;i<4;i++) { GPIOPinWrite(FILAS, GPIO_PIN_2, (i==0)?0:GPIO_PIN_2); GPIOPinWrite(FILAS, GPIO_PIN_3, (i==1)?0:GPIO_PIN_3); GPIOPinWrite(FILAS, GPIO_PIN_4, (i==2)?0:GPIO_PIN_4); GPIOPinWrite(FILAS, GPIO_PIN_5, (i==3)?0:GPIO_PIN_5); if ( GPIOPinRead(COLS,GPIO_PIN_3) == 0) { switch (i) { case 0: key=0x0A;break; case 1: key=0x0B;break; case 2: key=0x0C;break; case 3: key=0x0D;break; default: key=-1; } break; } else if (GPIOPinRead(COLS,GPIO_PIN_2) == 0) { switch (i) { case 0: key=0x03;break; case 1: key=0x06;break; case 2: key=0x09;break; case 3: key=0x0E;break; default: key=-1; } break; } else if (GPIOPinRead(COLS,GPIO_PIN_1) == 0) { switch (i) { case 0: key=0x02;break; case 1: key=0x05;break; case 2: key=0x08;break; case 3: key=0x00;break; default: key=-1; } break; } else if (GPIOPinRead(COLS,GPIO_PIN_0) == 0) { switch (i) { case 0: key=0x01;break; case 1: key=0x04;break; case 2: key=0x07;break; case 3: key=0x0F;break; default: key=-1; } break; } } //get ready for next interruption GPIOPinWrite(FILAS, GPIO_PIN_2, 0); GPIOPinWrite(FILAS, GPIO_PIN_3, 0); GPIOPinWrite(FILAS, GPIO_PIN_4, 0); GPIOPinWrite(FILAS, GPIO_PIN_5, 0); //store the value num = key; GPIOIntClear(COLS,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); IntMasterEnable(); } void UARTIntHandler(void) { uint32_t ui32Status; unsigned char received_character; ui32Status = UARTIntStatus(UART0_BASE, true); //obtener el estado de la interrupción UARTIntClear(UART0_BASE, ui32Status); //borrar las interrupciones afirmadas while(UARTCharsAvail(UART0_BASE)) //bucle mientras que hay caracteres { received_character = UARTCharGetNonBlocking(UART0_BASE); //UARTCharPutNonBlocking(UART0_BASE, received_character); //echo character if (received_character == 0x47){ //UARTCharPutNonBlocking(UART0_BASE, 10); //if CR received,issue LF as well Lcd_Goto(1,1); Lcd_mensajes("Lampara 1: Apagada ");} if (received_character == 0x42){ //UARTCharPutNonBlocking(UART0_BASE, 10); //if CR received,issue LF as well Lcd_Goto(1,1); Lcd_mensajes("Lampara 1: Encendida");} } } void mensaje(){ if (num == 1) { SysCtlDelay(SysCtlClockGet()/4); if (num == 9) { Lcd_Goto(1,1); Lcd_mensajes("Lampara 1: Encendida"); } num = 0; } } void main(void) { /*Configurar el reloj del sistema, en este caso 50Mhz*/ SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); setup(); Lcd_init(); /*Habilitar los periféricos UART2 y GPIOD (los pines UART están en el Puerto D)*/ SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); /*Configurar los pines para el receptor y transmisor utilizando GPIOPinConfigure*/ GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); /*Inicialice los parámetros para UART: 115200, 8-1-N*/ UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 9600, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); UARTFIFOLevelSet(UART0_BASE, UART_FIFO_TX4_8, UART_FIFO_RX4_8); //set FIFO level to 8 characters UARTFIFOEnable(UART0_BASE); //enable FIFOs IntMasterEnable(); IntEnable(INT_UART0); UARTIntEnable(UART0_BASE, UART_INT_TX| UART_INT_RX | UART_INT_RT); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); /*En este bucle infinito, si hay un caracter en el receptor, este se lee, *y luego escrito al transmisor. Esto hace eco de lo que se escribe en la ventana de terminal.*/ while(1) //bucle mientras que hay caracteres { mensaje(); } }
81a45e41678043bab9e24fbb678cb539dd635fde
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/drivers/usb/typec/tcpm/extr_fusb302.c_fusb302_i2c_block_write.c
c12915caa2a2eae60bc6676dfe814b4d354724b7
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
1,059
c
extr_fusb302.c_fusb302_i2c_block_write.c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u8 ; struct fusb302_chip {int /*<<< orphan*/ i2c_client; } ; /* Variables and functions */ int /*<<< orphan*/ fusb302_log (struct fusb302_chip*,char*,scalar_t__,scalar_t__,int) ; int i2c_smbus_write_i2c_block_data (int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__ const*) ; __attribute__((used)) static int fusb302_i2c_block_write(struct fusb302_chip *chip, u8 address, u8 length, const u8 *data) { int ret = 0; if (length <= 0) return ret; ret = i2c_smbus_write_i2c_block_data(chip->i2c_client, address, length, data); if (ret < 0) fusb302_log(chip, "cannot block write 0x%02x, len=%d, ret=%d", address, length, ret); return ret; }
a749ffd7f6af100f0d155770d9212928d2e24002
356549d1e24e22cf1241e792fe1370f8de4a52e9
/singuler linked list.c
55956b482c111da6d297d944193da4d32f574ece
[]
no_license
Kunal2000puchu/DATA-STRUCTURE
2e504ea4c6bca96b57254a8527d1b48a055dece9
d2c6ce0b4840d01f269debe62908a1e9ca7ae6ee
refs/heads/main
2023-05-06T21:09:03.768219
2021-05-25T03:12:08
2021-05-25T03:12:08
358,324,202
0
0
null
null
null
null
UTF-8
C
false
false
4,265
c
singuler linked list.c
#include <stdio.h> #include <stdlib.h> struct node { int data; struct node *link; }; struct node *root; void insertbeg() { int item; struct node *p; p = (struct node *)malloc(sizeof(struct node)); printf("\nEnter the item you want to insert:"); scanf("%d",&item); p->data = item; p->link = NULL; if(root == NULL) root = p; else { p->link = root; root = p; } } void append() { int item; struct node *p; p = (struct node *)malloc(sizeof(struct node)); printf("\nEnter the item you want to insert:"); scanf("%d", &item); p->data = item; p->link = NULL; if (root == NULL) { root = p; } else { struct node *q; q = root; while (q->link != NULL) q = q->link; q->link = p; } } void insertpos() { int item,pos,i; struct node *p,*q; p = (struct node *)malloc(sizeof(struct node)); printf("\nEnter the item you want to insert:"); scanf("%d",&item); printf("\nEnter the Position at which you want to insert:"); scanf("%d",&pos); p->data = item; p->link = NULL; if(root == NULL) root = p; else if(pos == 0) { p->link = root; root = p; } else { q = root; for(i = 0 ; i<pos ; i++) { q=q->link; } p->link = q->link; q->link = p; } } void insertunsorted() { int ch; printf("\n Insert:\n\n\t1.Beginning\n\n\t2.random\n\n\t3.Position\n\n\tEnter Your Choice:"); scanf("%d",&ch); switch(ch) { case 1 : insertbeg(); break; case 2 : append(); break; case 3 : insertpos(); break; default : printf("\nINVALID CHOICE!!!"); } } void display() { struct node *k; if (root == NULL) { printf("\n The list is empty!!"); return; } else { k = root; while (k != NULL) { printf("%d\n", k->data); k = k->link; } } } void deletebeg() { struct node *p; if(root == NULL) { printf("\nThe list is empty!!"); } else { p = root; root = p->link; free(p); printf("\n After deleting the begining....\n"); } } void deleteend() { struct node *p,*q = NULL; if(root == NULL) { printf("\n List is empty!!"); } else if(root->link == NULL) { root = NULL; free(root); printf("\n Only one node is deleted.."); } else { p = root; while(p->link != NULL) { q = p; p = p->link; } q->link = NULL; printf("\nNode is deleted from the last.."); } } void deletepos() { int pos,i; struct node *p = NULL,*q; printf("\nEnter the Position at which you want to insert:"); scanf("%d",&pos); if(root == NULL) printf("\nUNDERFLOW!!!"); q = root; if(pos == 0) root = root->link; else { for(i=0;i<pos;i++) { p = q; q = q->link; } p->link = q->link; } free(q); } void deleteunsorted() { int ch; printf("\n From where would you like to Delete:\n\n\t1.Beginning\n\n\t2.Ending\n\n\t3.Position\n\n\tEnter Your Choice:"); scanf("%d",&ch); switch(ch) { case 1 : deletebeg(); break; case 2 : deleteend(); break; case 3 : deletepos(); break; default : printf("\nINVALID CHOICE!!!"); } } int main() { int ch; while(1) { printf("\n1.Insert into unsorted\n\n2.Delete from unsorted\n\n3.display\n\nEnter your choice :"); scanf("%d",&ch); switch(ch) { case 1 : insertunsorted(); break; case 2 : deleteunsorted(); break; case 3 : display(); break; default: printf("INVALID CHOICE!!!"); } } }
647266407d0afb790da6133773216d456f9f242e
22c3444ca75c879fd504524f1689da271b78913c
/edk2-platforms/Platform/BroxtonPlatformPkg/Common/Features/Eeprom/EepromPlatformLib/EepromAcpiPei.c
308b9230db1db743c206bfd74f64b25e1685ca3d
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
13801733632/APLBIOS
f73f4143f218b346eab45e640182abade44141c6
918e44abff57576a8577223a407d36cc6874e8e3
refs/heads/master
2020-09-30T12:52:32.978296
2019-12-11T08:27:03
2019-12-11T08:27:03
227,290,579
1
1
null
null
null
null
UTF-8
C
false
false
994
c
EepromAcpiPei.c
/** @file Common EEPROM library instance. Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "EepromPlatformLib.h" /** Programs the ACPI SSDT data in $AcpiTbl @param[in] VOID @retval EFI_SUCCESS $AcpiTbl data found @retval EFI_NOT_FOUND $AcpiTbl data not found @retval EFI_NOT_READY $AcpiTbl data not ready to be programmed **/ EFI_STATUS EepromProgramAcpi (VOID) { if (mEepromPlatformLibDebugFlag) DEBUG ((DEBUG_INFO, "%a(#%4d) - Starting...\n", __FUNCTION__, __LINE__)); return EFI_NOT_READY; }
87b6b6bddb91fa724e4c5718ee176381ba3ed209
3d0b66f39b6b869f84ce0094b660707b7859702d
/Temp/il2cppOutput/il2cppOutput/System_System_UriMethodDeclarations.h
e9a79b08be6fe2df55e2eff2e51209fc13f86641
[]
no_license
choirdesign/hack-slash
b12b2e86de09b2eec62685d40eec3856df619077
3754f5af407a783bfaf9d9eedbb61148cc50672c
refs/heads/master
2021-01-10T13:40:37.011080
2015-11-24T09:14:57
2015-11-24T09:14:57
45,164,312
0
0
null
null
null
null
UTF-8
C
false
false
10,284
h
System_System_UriMethodDeclarations.h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include <assert.h> #include <exception> // System.Uri struct Uri_t886; // System.String struct String_t; // System.Runtime.Serialization.SerializationInfo struct SerializationInfo_t647; // System.Object struct Object_t; // System.UriParser struct UriParser_t1040; #include "codegen/il2cpp-codegen.h" #include "mscorlib_System_Runtime_Serialization_StreamingContext.h" #include "System_System_UriHostNameType.h" #include "System_System_UriPartial.h" #include "System_System_UriKind.h" // System.Void System.Uri::.ctor(System.String) extern "C" void Uri__ctor_m5436 (Uri_t886 * __this, String_t* ___uriString, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void System.Uri::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext) extern "C" void Uri__ctor_m5437 (Uri_t886 * __this, SerializationInfo_t647 * ___serializationInfo, StreamingContext_t648 ___streamingContext, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void System.Uri::.ctor(System.String,System.Boolean) extern "C" void Uri__ctor_m5438 (Uri_t886 * __this, String_t* ___uriString, bool ___dontEscape, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void System.Uri::.cctor() extern "C" void Uri__cctor_m5439 (Object_t * __this /* static, unused */, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void System.Uri::System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext) extern "C" void Uri_System_Runtime_Serialization_ISerializable_GetObjectData_m5440 (Uri_t886 * __this, SerializationInfo_t647 * ___info, StreamingContext_t648 ___context, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::get_AbsoluteUri() extern "C" String_t* Uri_get_AbsoluteUri_m5441 (Uri_t886 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::get_Authority() extern "C" String_t* Uri_get_Authority_m5442 (Uri_t886 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::get_Host() extern "C" String_t* Uri_get_Host_m4580 (Uri_t886 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::get_IsFile() extern "C" bool Uri_get_IsFile_m5443 (Uri_t886 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::get_IsLoopback() extern "C" bool Uri_get_IsLoopback_m5444 (Uri_t886 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::get_IsUnc() extern "C" bool Uri_get_IsUnc_m5445 (Uri_t886 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::get_Scheme() extern "C" String_t* Uri_get_Scheme_m5446 (Uri_t886 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::get_IsAbsoluteUri() extern "C" bool Uri_get_IsAbsoluteUri_m5447 (Uri_t886 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.UriHostNameType System.Uri::CheckHostName(System.String) extern "C" int32_t Uri_CheckHostName_m5448 (Object_t * __this /* static, unused */, String_t* ___name, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::IsIPv4Address(System.String) extern "C" bool Uri_IsIPv4Address_m5449 (Object_t * __this /* static, unused */, String_t* ___name, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::IsDomainAddress(System.String) extern "C" bool Uri_IsDomainAddress_m5450 (Object_t * __this /* static, unused */, String_t* ___name, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::CheckSchemeName(System.String) extern "C" bool Uri_CheckSchemeName_m5451 (Object_t * __this /* static, unused */, String_t* ___schemeName, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::IsAlpha(System.Char) extern "C" bool Uri_IsAlpha_m5452 (Object_t * __this /* static, unused */, uint16_t ___c, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::Equals(System.Object) extern "C" bool Uri_Equals_m5453 (Uri_t886 * __this, Object_t * ___comparant, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::InternalEquals(System.Uri) extern "C" bool Uri_InternalEquals_m5454 (Uri_t886 * __this, Uri_t886 * ___uri, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Int32 System.Uri::GetHashCode() extern "C" int32_t Uri_GetHashCode_m5455 (Uri_t886 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::GetLeftPart(System.UriPartial) extern "C" String_t* Uri_GetLeftPart_m5456 (Uri_t886 * __this, int32_t ___part, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Int32 System.Uri::FromHex(System.Char) extern "C" int32_t Uri_FromHex_m5457 (Object_t * __this /* static, unused */, uint16_t ___digit, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::HexEscape(System.Char) extern "C" String_t* Uri_HexEscape_m5458 (Object_t * __this /* static, unused */, uint16_t ___character, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::IsHexDigit(System.Char) extern "C" bool Uri_IsHexDigit_m5459 (Object_t * __this /* static, unused */, uint16_t ___digit, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::IsHexEncoding(System.String,System.Int32) extern "C" bool Uri_IsHexEncoding_m5460 (Object_t * __this /* static, unused */, String_t* ___pattern, int32_t ___index, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void System.Uri::AppendQueryAndFragment(System.String&) extern "C" void Uri_AppendQueryAndFragment_m5461 (Uri_t886 * __this, String_t** ___result, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::ToString() extern "C" String_t* Uri_ToString_m5462 (Uri_t886 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::EscapeString(System.String) extern "C" String_t* Uri_EscapeString_m5463 (Object_t * __this /* static, unused */, String_t* ___str, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::EscapeString(System.String,System.Boolean,System.Boolean,System.Boolean) extern "C" String_t* Uri_EscapeString_m5464 (Object_t * __this /* static, unused */, String_t* ___str, bool ___escapeReserved, bool ___escapeHex, bool ___escapeBrackets, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void System.Uri::ParseUri(System.UriKind) extern "C" void Uri_ParseUri_m5465 (Uri_t886 * __this, int32_t ___kind, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::Unescape(System.String) extern "C" String_t* Uri_Unescape_m5466 (Uri_t886 * __this, String_t* ___str, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::Unescape(System.String,System.Boolean) extern "C" String_t* Uri_Unescape_m5467 (Object_t * __this /* static, unused */, String_t* ___str, bool ___excludeSpecial, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void System.Uri::ParseAsWindowsUNC(System.String) extern "C" void Uri_ParseAsWindowsUNC_m5468 (Uri_t886 * __this, String_t* ___uriString, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::ParseAsWindowsAbsoluteFilePath(System.String) extern "C" String_t* Uri_ParseAsWindowsAbsoluteFilePath_m5469 (Uri_t886 * __this, String_t* ___uriString, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void System.Uri::ParseAsUnixAbsoluteFilePath(System.String) extern "C" void Uri_ParseAsUnixAbsoluteFilePath_m5470 (Uri_t886 * __this, String_t* ___uriString, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void System.Uri::Parse(System.UriKind,System.String) extern "C" void Uri_Parse_m5471 (Uri_t886 * __this, int32_t ___kind, String_t* ___uriString, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::ParseNoExceptions(System.UriKind,System.String) extern "C" String_t* Uri_ParseNoExceptions_m5472 (Uri_t886 * __this, int32_t ___kind, String_t* ___uriString, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::CompactEscaped(System.String) extern "C" bool Uri_CompactEscaped_m5473 (Object_t * __this /* static, unused */, String_t* ___scheme, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::Reduce(System.String,System.Boolean) extern "C" String_t* Uri_Reduce_m5474 (Object_t * __this /* static, unused */, String_t* ___path, bool ___compact_escaped, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Char System.Uri::HexUnescapeMultiByte(System.String,System.Int32&,System.Char&) extern "C" uint16_t Uri_HexUnescapeMultiByte_m5475 (Object_t * __this /* static, unused */, String_t* ___pattern, int32_t* ___index, uint16_t* ___surrogate, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::GetSchemeDelimiter(System.String) extern "C" String_t* Uri_GetSchemeDelimiter_m5476 (Object_t * __this /* static, unused */, String_t* ___scheme, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Int32 System.Uri::GetDefaultPort(System.String) extern "C" int32_t Uri_GetDefaultPort_m5477 (Object_t * __this /* static, unused */, String_t* ___scheme, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.String System.Uri::GetOpaqueWiseSchemeDelimiter() extern "C" String_t* Uri_GetOpaqueWiseSchemeDelimiter_m5478 (Uri_t886 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::IsPredefinedScheme(System.String) extern "C" bool Uri_IsPredefinedScheme_m5479 (Object_t * __this /* static, unused */, String_t* ___scheme, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.UriParser System.Uri::get_Parser() extern "C" UriParser_t1040 * Uri_get_Parser_m5480 (Uri_t886 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void System.Uri::EnsureAbsoluteUri() extern "C" void Uri_EnsureAbsoluteUri_m5481 (Uri_t886 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Uri::op_Equality(System.Uri,System.Uri) extern "C" bool Uri_op_Equality_m5482 (Object_t * __this /* static, unused */, Uri_t886 * ___u1, Uri_t886 * ___u2, const MethodInfo* method) IL2CPP_METHOD_ATTR;
af5ee6abe415f5a00d2448b0951840b5d1f84988
e92d94f2e13a234593093858ab2e9f652584d6bf
/수강생/201602984전승원/lab3/6_4.c
95a9015cbbf478f56d8b5646cb34017070ed9645
[]
no_license
wnsdudSoftkim/Introduction_to_computer_lab
62f2dfc213a189301887cb8041509a43f64b1d20
9bfd0b9963f9ff86670d0f3b04529233f2ad4b70
refs/heads/main
2023-05-14T23:36:29.921562
2021-06-07T13:32:48
2021-06-07T13:32:48
346,976,677
0
0
null
null
null
null
UTF-8
C
false
false
993
c
6_4.c
#include <stdio.h> int main(void) { float amount; while (1) { printf("Enter value of trade: "); scanf_s("%f", &amount); if (amount == 0.00f) { break; } if (amount > 0.00f && amount < 2500.00f) { printf("Commission: $%.2f\n", 30.0f + amount * 0.017); } else if (amount >= 2500.00f && amount < 6250.00f) { printf("Commision: $%.2f\n", 56.0f + amount * 0.0066); } else if (amount >= 6250.00f && amount < 20000.00f) { printf("Commision: $%.2f\n", 76.0f + amount * 0.0034); } else if (amount >= 20000.00f && amount < 50000.00f) { printf("Commision: $%.2f\n", 100.0f + amount * 0.0022); } else if (amount >= 50000.00f && amount < 500000.00f) { printf("Commision: $%.2f\n", 155.0f + amount * 0.0011); } else if (amount >= 500000.00f) { printf("Commision: $%.2f\n", 255.0f + amount * 0.0009); } else { printf("Error. Please enter a valid amount.\n"); } printf("Enter 0 to exit program.\n"); } }
5451f1a12231256976880ccc0c7418000982a38a
48e514aacb2f7f8329c39e05920954d12a91331f
/SDK/Hastlayer_Platform/ps7_cortexa9_0/standalone_ps7_cortexa9_0/bsp/ps7_cortexa9_0/libsrc/ttcps_v3_12/src/xttcps_selftest.c
849f18b38570c3a08e062c943500b17c2074242a
[ "BSD-2-Clause" ]
permissive
gmb77/Hastlayer-Hardware-Framework---Xilinx
befac44c31c46c6b88de3244a3f0849327476604
a0a8ab08362663a41dcd22e45023f03ec45518f7
refs/heads/client
2021-12-03T04:24:21.151759
2021-11-26T19:23:12
2021-11-26T19:23:12
432,205,364
0
0
NOASSERTION
2021-11-26T14:25:56
2021-11-26T14:25:55
null
UTF-8
C
false
false
2,288
c
xttcps_selftest.c
/****************************************************************************** * Copyright (C) 2010 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /*****************************************************************************/ /** * * @file xttcps_selftest.c * @addtogroup ttcps_v3_12 * @{ * * This file contains the implementation of self test function for the * XTtcPs driver. * * <pre> * MODIFICATION HISTORY: * * Ver Who Date Changes * ----- ------ -------- --------------------------------------------- * 1.00a drg/jz 01/21/10 First release * 3.00 kvn 02/13/15 Modified code for MISRA-C:2012 compliance. * </pre> * ******************************************************************************/ /***************************** Include Files *********************************/ #include "xttcps.h" /************************** Constant Definitions *****************************/ /**************************** Type Definitions *******************************/ /***************** Macros (Inline Functions) Definitions *********************/ /************************** Function Prototypes ******************************/ /************************** Variable Definitions *****************************/ /*****************************************************************************/ /** * * Runs a self-test on the driver/device. * * * @param InstancePtr is a pointer to the XTtcPs instance. * * @return * * - XST_SUCCESS if successful * - XST_FAILURE indicates a register did not read or write correctly * * @note This test fails if it is not called right after initialization. * ******************************************************************************/ s32 XTtcPs_SelfTest(XTtcPs *InstancePtr) { s32 Status; u32 TempReg; Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); /* * All the TTC registers should be in their default state right now. */ TempReg = XTtcPs_ReadReg(InstancePtr->Config.BaseAddress, XTTCPS_CNT_CNTRL_OFFSET); if (XTTCPS_CNT_CNTRL_RESET_VALUE != (u32)TempReg) { Status = XST_FAILURE; } else { Status = XST_SUCCESS; } return Status; } /** @} */
7709764c5960c45c7f532666980a58438805a250
5e72f40ca2b8151b221c4d69b058bb789499584e
/DEQUEUE/dequeue.c
c44419cb13cd926764631e08995efaa214fa4cff
[]
no_license
cwei83/NETWORKFLOW
cf0fcdb7f8bb3f7fc2557667e79d7bf249b06421
f3e4552126d88aee66298fc68c4f857062fea1c6
refs/heads/master
2016-09-06T04:56:53.119592
2015-05-26T10:42:18
2015-05-26T10:42:18
32,505,215
0
0
null
null
null
null
UTF-8
C
false
false
2,669
c
dequeue.c
#include <stdlib.h> #include <stdio.h> #include <limits.h> #define num_node 4 typedef struct adlist *adPointer; typedef struct adlist { int vertex; int weight; adPointer link; } adlist; typedef struct queue *queuePointer; typedef struct queue { int vertex; queuePointer link; } queue; void addq(int vertex); void dq(int vertex); int deleteq(void); void addList(int i, int j, int n); void shortestpath(int vertex); void write(int pre[], int dis[], int s[]); adPointer graph[num_node+1]; queuePointer front, rear; int main() { FILE *fin; int x, y, z; for(int x=1;x<num_node+1;x++) graph[x]=NULL; fin = fopen("input.txt", "r"); while(fscanf(fin, "%d %d %d", &x, &y, &z)==3) addList(y, x, z); fclose(fin); shortestpath(1); return 0; } void addList(int i, int j, int n) { adPointer ptr, pre; if(!graph[j]) { graph[j]=malloc(sizeof(adlist)); graph[j]->link=NULL; graph[j]->vertex=i; graph[j]->weight=n; } else { ptr=graph[j]; for(;ptr->link!=NULL;ptr=ptr->link) ; pre=malloc(sizeof(adlist)); pre->link=NULL; pre->vertex=i; pre->weight=n; ptr->link=pre; } } void addq(int vertex) { queuePointer temp; temp = malloc(sizeof(queue)); temp->vertex=vertex; temp->link=NULL; if(front) rear->link=temp; else front=temp; rear=temp; } void dq(int vertex) { queuePointer temp; temp = malloc(sizeof(queue)); temp->vertex=vertex; temp->link=front; front=temp; } int deleteq(void) { queuePointer temp = front; int vertex; front = temp->link; vertex = temp->vertex; free(temp); return vertex; } void shortestpath(int vertex) { int current_vertex; int pre[num_node+1], s[num_node+1], dis[num_node+1]; adPointer ptr; front = rear = NULL; for(int i=1;i<num_node+1;i++) { pre[i]=-1; s[i]=0; dis[i]=INT_MAX; } dis[vertex] = 0; addq(vertex); while(front) { current_vertex = deleteq(); write(pre, dis, s); for(ptr=graph[current_vertex];ptr;ptr=ptr->link) { if(dis[current_vertex]+ptr->weight<dis[ptr->vertex]) { dis[ptr->vertex]=dis[current_vertex]+ptr->weight; pre[ptr->vertex]=current_vertex; } addq(ptr->vertex); if(s[ptr->vertex]==-1) { dq(ptr->vertex); s[ptr->vertex] = 0; } } s[current_vertex] = -1; } } void write(int pre[], int dis[], int s[]) { printf("\nd(i): "); for(int i=1;i<num_node+1;i++) printf("%5d", dis[i]); printf("\np(i): "); for(int i=1;i<num_node+1;i++) printf("%5d", pre[i]); printf("\ns(i): "); for(int i=1;i<num_node+1;i++) printf("%5d", s[i]); printf("\n"); }
aa9c04ea3ede6fddd42b1312b2033b19e74185e7
747f2ff68b76f8a701d5a06d10ab2fea92ec130c
/funcoes-em-c/funcoes-em-c-master/calculadora.c/calculadorafuncoes/main.c
319aeff94bde33e904f724564c01c303b029a49d
[]
no_license
pedroita/Laboratorio_de_programacao_S4
6f22eaf94e4e0f609ec0aafa32831a050084afe6
d4ec8e10ccc7c6a438c357319c02828a39cd34c2
refs/heads/main
2023-07-14T08:57:58.396884
2021-08-19T19:18:59
2021-08-19T19:18:59
327,479,630
1
0
null
2021-01-07T03:12:26
2021-01-07T02:17:38
null
UTF-8
C
false
false
1,706
c
main.c
#include <stdio.h> #include <stdlib.h> #include "funcoes.h" //função principal int main () { // Declaração das variavel int opcao; int valor1, valor2; do { // leitura dos dados do usuario borda(); menu(); borda(); scanf ("%d",&opcao); system ("clear"); // o switch fara o usuario escolher sua e opção , enquanto o 0 zero nao for precionado o codigo nao sae do loop switch (opcao) { case 1 : printf ("Digite o primeiro valor :\n"); scanf ("%d",&valor1); printf ("Digite o segundo valor :\n"); scanf ("%d",&valor2); system ("clear"); soma(valor1,valor2); break; case 2: printf ("Digite o primeiro valor :\n"); scanf ("%d",&valor1); printf ("Digite o segundo valor :\n"); scanf ("%d",&valor2); system ("clear"); subtracao(valor1,valor2); break; case 3: printf ("Digite o primeiro valor :\n"); scanf ("%d",&valor1); printf ("Digite o segundo valor :\n"); scanf ("%d",&valor2); system ("clear"); mutiplicacao(valor1,valor2); break; case 4: printf ("Digite o primeiro valor :\n"); scanf ("%d",&valor1); printf ("Digite o segundo valor :\n"); scanf ("%d",&valor2); system ("clear"); divisao(valor1,valor2); break; case 5: printf ("Digite um valor :\n"); scanf ("%d",&valor1); printf("O fatorial do numero %d é %d\n" ,valor1,fatorial(valor1)); default: //system("clear"); printf("Fim execução\n"); break; } }while (opcao!=0); }
65e7cb68067d85ebd5473db1316d8bff5683c9c5
b72132b2e9ccb8876bd9fb10da75be281cca48ea
/long_unsigned_decimal_print.c
71023b048d2b654394a9ed6a3e6d49e29b67bf4a
[]
no_license
bean710/printf
62c66879aa8556024c34301a07eca12356d078e6
2cfde4fa4a8aa11e762b5c4252ac8244b328221a
refs/heads/master
2020-08-28T04:38:42.400308
2019-10-30T05:30:20
2019-10-30T05:30:20
217,592,680
1
1
null
2019-10-30T05:15:57
2019-10-25T18:26:45
C
UTF-8
C
false
false
456
c
long_unsigned_decimal_print.c
#include "holberton.h" /** * print_unsigned_long_decimal - prints an unsigned long int in base 10. * @ulivp: void pointer to a unsigned long int. * @params: a structure containing info about the argument * Return: the number of characters printed. */ int print_unsigned_long_decimal(void *ulivp, param params) { int uli = *(unsigned long int *)ulivp; int count = 0; (void)(params); return (long_base_converter(uli, 10, "0123456789") + count); }
20dc1d73cf9c15188d8d1cdce51d16a8e01e17be
4d1614ba0104bb2b4528b32fa0a2a1e8caa3bfa3
/code/bess-v1/core/kmod/sn_netdev.c
c3bced74c1f994b9ff6108d0f011e963ec3f0397
[ "BSD-3-Clause", "MIT" ]
permissive
Lossless-Virtual-Switching/Backdraft
c292c87f8d483a5dbd8d28009cb3b5e263e7fb36
4cedd1403c7c9fe5e1afc647e374173c7c5c46f0
refs/heads/master
2023-05-24T03:27:49.553264
2023-03-01T14:59:00
2023-03-01T14:59:00
455,533,889
11
4
MIT
2022-04-20T16:34:22
2022-02-04T12:09:31
C
UTF-8
C
false
false
24,077
c
sn_netdev.c
// Copyright (c) 2014-2016, The Regents of the University of California. // Copyright (c) 2016-2017, Nefeli Networks, Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * Neither the names of the copyright holders nor the names of their // contributors may be used to endorse or promote products derived from this // software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. #include <linux/version.h> #include <linux/etherdevice.h> #include <linux/if_vlan.h> #ifndef UTS_RELEASE #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) #include <linux/utsrelease.h> #else #include <generated/utsrelease.h> #endif #endif /* disable for now, since it is not tested with new vport implementation */ #undef CONFIG_NET_RX_BUSY_POLL #ifdef CONFIG_NET_RX_BUSY_POLL #include <net/busy_poll.h> #endif #ifndef NAPI_POLL_WEIGHT #define NAPI_POLL_WEIGHT 64 #endif #include "sn_common.h" #include "sn_kernel.h" #include "../snbuf_layout.h" static int sn_poll(struct napi_struct *napi, int budget); static void sn_enable_interrupt(struct sn_queue *rx_queue); static void sn_test_cache_alignment(struct sn_device *dev) { int i; for (i = 0; i < dev->num_txq; i++) { struct sn_queue *q = dev->tx_queues[i]; if ((((uintptr_t) q->drv_to_sn) % L1_CACHE_BYTES) || (((uintptr_t) q->sn_to_drv) % L1_CACHE_BYTES)) { pr_err("invalid cache alignment: %p %p\n", q->drv_to_sn, q->sn_to_drv); } } for (i = 0; i < dev->num_rxq; i++) { struct sn_queue *q = dev->rx_queues[i]; if ((((uintptr_t) q->drv_to_sn) % L1_CACHE_BYTES) || (((uintptr_t) q->sn_to_drv) % L1_CACHE_BYTES) || (((uintptr_t) q->rx.rx_regs) % L1_CACHE_BYTES)) { pr_err("invalid cache alignment: %p %p %p\n", q->drv_to_sn, q->sn_to_drv, q->rx.rx_regs); } } } static int sn_alloc_queues(struct sn_device *dev, void *rings, uint64_t rings_size, struct tx_queue_opts *txq_opts, struct rx_queue_opts *rxq_opts) { struct sn_queue *queue; char *p = rings; void *memchunk; int num_queues; int i; int ret; ret = netif_set_real_num_tx_queues(dev->netdev, dev->num_txq); if (ret) { log_err("netif_set_real_num_tx_queues() failed\n"); return ret; } ret = netif_set_real_num_rx_queues(dev->netdev, dev->num_rxq); if (ret) { log_err("netif_set_real_num_rx_queues() failed\n"); return ret; } num_queues = dev->num_txq + dev->num_rxq; memchunk = kzalloc(sizeof(struct sn_queue) * num_queues, GFP_KERNEL); if (!memchunk) return -ENOMEM; queue = memchunk; for (i = 0; i < dev->num_txq; i++) { dev->tx_queues[i] = queue; queue->dev = dev; queue->queue_id = i; queue->tx.opts = *txq_opts; queue->tx.netdev_txq = netdev_get_tx_queue(dev->netdev, i); queue->drv_to_sn = (struct llring *)p; p += llring_bytes(queue->drv_to_sn); queue->sn_to_drv = (struct llring *)p; p += llring_bytes(queue->sn_to_drv); queue++; } for (i = 0; i < dev->num_rxq; i++) { dev->rx_queues[i] = queue; queue->dev = dev; queue->queue_id = i; queue->rx.opts = *rxq_opts; queue->rx.rx_regs = (struct sn_rxq_registers *)p; p += sizeof(struct sn_rxq_registers); queue->drv_to_sn = (struct llring *)p; p += llring_bytes(queue->drv_to_sn); queue->sn_to_drv = (struct llring *)p; p += llring_bytes(queue->sn_to_drv); queue++; } if ((uintptr_t)p != (uintptr_t)rings + rings_size) { log_err("Invalid ring space size: %llu, not %llu, at%p)\n", rings_size, (uint64_t)((uintptr_t)p - (uintptr_t)rings), rings); kfree(memchunk); return -EFAULT; } for (i = 0; i < dev->num_rxq; i++) { netif_napi_add(dev->netdev, &dev->rx_queues[i]->rx.napi, sn_poll, NAPI_POLL_WEIGHT); #ifdef CONFIG_NET_RX_BUSY_POLL napi_hash_add(&dev->rx_queues[i]->rx.napi); #endif spin_lock_init(&dev->rx_queues[i]->rx.lock); } sn_test_cache_alignment(dev); return 0; } static void sn_free_queues(struct sn_device *dev) { int i; for (i = 0; i < dev->num_rxq; i++) { #ifdef CONFIG_NET_RX_BUSY_POLL napi_hash_del(&dev->rx_queues[i]->rx.napi); #endif netif_napi_del(&dev->rx_queues[i]->rx.napi); } } /* Interface up */ static int sn_open(struct net_device *netdev) { struct sn_device *dev = netdev_priv(netdev); int i; for (i = 0; i < dev->num_rxq; i++) napi_enable(&dev->rx_queues[i]->rx.napi); for (i = 0; i < dev->num_rxq; i++) sn_enable_interrupt(dev->rx_queues[i]); return 0; } /* Interface down, but the device itself is still alive */ static int sn_close(struct net_device *netdev) { struct sn_device *dev = netdev_priv(netdev); int i; for (i = 0; i < dev->num_rxq; i++) napi_disable(&dev->rx_queues[i]->rx.napi); return 0; } static void sn_enable_interrupt(struct sn_queue *rx_queue) { __sync_synchronize(); rx_queue->rx.rx_regs->irq_disabled = 0; __sync_synchronize(); /* NOTE: make sure check again if the queue is really empty, * to avoid potential race conditions when you call this function: * * Driver: BESS: * [IRQ is disabled] * [doing polling] * if (no pending packet) * push a packet * if (IRQ enabled) * inject IRQ <- not executed * stop polling * enable IRQ * * [at this point, IRQ is enabled but pending packets are never * polled by the driver. So the driver needs to double check.] */ } static void sn_disable_interrupt(struct sn_queue *rx_queue) { /* the interrupt is usually disabled by BESS, * but in some cases the driver itself may also want to disable IRQ * (e.g., for low latency socket polling) */ rx_queue->rx.rx_regs->irq_disabled = 1; } static void sn_process_rx_metadata(struct sk_buff *skb, struct sn_rx_metadata *rx_meta) { if (rx_meta->gso_mss) { skb_shinfo(skb)->gso_size = rx_meta->gso_mss; skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; } /* By default, skb->ip_summed == CHECKSUM_NONE */ skb_checksum_none_assert(skb); switch (rx_meta->csum_state) { case SN_RX_CSUM_CORRECT_ENCAP: #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0) /* without this the upper layer won't respect skb->ip_summed */ skb->encapsulation = 1; #endif /* fall through */ case SN_RX_CSUM_CORRECT: skb->ip_summed = CHECKSUM_UNNECESSARY; break; case SN_RX_CSUM_INCORRECT: /* Incorrect L4/IP checksum */ /* fall through, so that packets can be still visible */ default: ; /* do nothing */ } } static inline int sn_send_tx_queue(struct sn_queue *queue, struct sn_device* dev, struct sk_buff* skb); DEFINE_PER_CPU(int, in_batched_polling); static void sn_process_loopback(struct sn_device *dev, struct sk_buff *skbs[], int cnt) { struct sn_queue *tx_queue; int qid; int cpu; int i; int lock_required; cpu = raw_smp_processor_id(); qid = dev->cpu_to_txq[cpu]; tx_queue = dev->tx_queues[qid]; lock_required = (tx_queue->tx.netdev_txq->xmit_lock_owner != cpu); if (lock_required) HARD_TX_LOCK(dev->netdev, tx_queue->tx.netdev_txq, cpu); for (i = 0; i < cnt; i++) { if (!skbs[i]) continue; /* Ignoring return value here */ sn_send_tx_queue(tx_queue, dev, skbs[i]); } if (lock_required) HARD_TX_UNLOCK(dev->netdev, tx_queue->tx.netdev_txq); } static int sn_poll_action_batch(struct sn_queue *rx_queue, int budget) { struct napi_struct *napi = &rx_queue->rx.napi; struct sn_device *dev = rx_queue->dev; int poll_cnt = 0; int *polling; polling = this_cpu_ptr(&in_batched_polling); *polling = 1; while (poll_cnt < budget) { struct sk_buff *skbs[MAX_BATCH]; struct sn_rx_metadata rx_meta[MAX_BATCH]; int cnt; int i; cnt = dev->ops->do_rx_batch(rx_queue, rx_meta, skbs, min(MAX_BATCH, budget - poll_cnt)); if (cnt == 0) break; rx_queue->rx.stats.packets += cnt; poll_cnt += cnt; for (i = 0; i < cnt; i++) { struct sk_buff *skb = skbs[i]; if (unlikely(!skb)) continue; rx_queue->rx.stats.bytes += skb->len; sn_process_rx_metadata(skb, &rx_meta[i]); } if (!rx_queue->rx.opts.loopback) { for (i = 0; i < cnt; i++) { struct sk_buff *skb = skbs[i]; if (!skb) continue; skb_record_rx_queue(skb, rx_queue->queue_id); skb->protocol = eth_type_trans(skb, napi->dev); #ifdef CONFIG_NET_RX_BUSY_POLL skb_mark_napi_id(skb, napi); #endif netif_receive_skb(skb); } } else sn_process_loopback(dev, skbs, cnt); } if (dev->ops->flush_tx) dev->ops->flush_tx(); *polling = 0; return poll_cnt; } static int sn_poll_action_single(struct sn_queue *rx_queue, int budget) { struct napi_struct *napi = &rx_queue->rx.napi; int poll_cnt = 0; while (poll_cnt < budget) { struct sk_buff *skb; struct sn_rx_metadata rx_meta; skb = rx_queue->dev->ops->do_rx(rx_queue, &rx_meta); if (!skb) return poll_cnt; rx_queue->rx.stats.packets++; rx_queue->rx.stats.bytes += skb->len; sn_process_rx_metadata(skb, &rx_meta); skb_record_rx_queue(skb, rx_queue->queue_id); skb->protocol = eth_type_trans(skb, napi->dev); #ifdef CONFIG_NET_RX_BUSY_POLL skb_mark_napi_id(skb, napi); #endif netif_receive_skb(skb); poll_cnt++; } return poll_cnt; } static int sn_poll_action(struct sn_queue *rx_queue, int budget) { if (rx_queue->dev->ops->do_rx_batch) return sn_poll_action_batch(rx_queue, budget); else return sn_poll_action_single(rx_queue, budget); } #ifdef CONFIG_NET_RX_BUSY_POLL #define SN_BUSY_POLL_BUDGET 4 /* Low latency socket callback. Called with bh disabled */ static int sn_poll_ll(struct napi_struct *napi) { struct sn_queue *rx_queue; int idle_cnt = 0; int ret; rx_queue = container_of(napi, struct sn_queue, rx.napi); if (!spin_trylock(&rx_queue->lock)) return LL_FLUSH_BUSY; rx_queue->rx.stats.ll_polls++; sn_disable_interrupt(rx_queue); /* Meh... Since there is no notification for busy loop completion, * there is no clean way to avoid race condition w.r.t. interrupts. * Instead, do a roughly 5-us polling in this function. */ do { ret = sn_poll_action(rx_queue, SN_BUSY_POLL_BUDGET); if (ret == 0) cpu_relax(); } while (ret == 0 && idle_cnt++ < 1000); sn_enable_interrupt(rx_queue); if (rx_queue->dev->ops->pending_rx(rx_queue)) { sn_disable_interrupt(rx_queue); napi_schedule(napi); } spin_unlock(&rx_queue->lock); return ret; } #endif /* NAPI callback */ /* The return value says how many packets are actually received */ static int sn_poll(struct napi_struct *napi, int budget) { struct sn_queue *rx_queue; int ret; rx_queue = container_of(napi, struct sn_queue, rx.napi); if (!spin_trylock(&rx_queue->rx.lock)) return 0; rx_queue->rx.stats.polls++; ret = sn_poll_action(rx_queue, budget); if (ret < budget) { napi_complete(napi); sn_enable_interrupt(rx_queue); /* last check for race condition. * see sn_enable_interrupt() */ if (rx_queue->dev->ops->pending_rx(rx_queue)) { napi_reschedule(napi); sn_disable_interrupt(rx_queue); } } spin_unlock(&rx_queue->rx.lock); return ret; } static void sn_set_tx_metadata(struct sk_buff *skb, struct sn_tx_metadata *tx_meta) { if (skb->ip_summed == CHECKSUM_PARTIAL) { tx_meta->csum_start = skb_checksum_start_offset(skb); tx_meta->csum_dest = tx_meta->csum_start + skb->csum_offset; } else { tx_meta->csum_start = SN_TX_CSUM_DONT; tx_meta->csum_dest = SN_TX_CSUM_DONT; } } static inline int sn_send_tx_queue(struct sn_queue *queue, struct sn_device* dev, struct sk_buff* skb) { struct sn_tx_metadata tx_meta; int ret = NET_XMIT_DROP; #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) if (queue->tx.opts.tci) { skb = vlan_insert_tag(skb, queue->tx.opts.tci); if (unlikely(!skb)) goto skip_send; } #else if (queue->tx.opts.tci) { skb = vlan_insert_tag(skb, htons(ETH_P_8021Q), queue->tx.opts.tci); if (unlikely(!skb)) goto skip_send; } if (queue->tx.opts.outer_tci) { skb = vlan_insert_tag(skb, htons(ETH_P_8021AD), queue->tx.opts.outer_tci); if (unlikely(!skb)) goto skip_send; } #endif skb_orphan(skb); sn_set_tx_metadata(skb, &tx_meta); ret = dev->ops->do_tx(queue, skb, &tx_meta); skip_send: switch (ret) { case NET_XMIT_CN: queue->tx.stats.throttled++; /* fall through */ case NET_XMIT_SUCCESS: queue->tx.stats.packets++; queue->tx.stats.bytes += skb->len; break; case NET_XMIT_DROP: queue->tx.stats.dropped++; break; case SN_NET_XMIT_BUFFERED: /* should not free skb */ return NET_XMIT_SUCCESS; } dev_kfree_skb(skb); return ret; } /* As a soft device without qdisc, * this function returns NET_XMIT_* instead of NETDEV_TX_* */ static int sn_start_xmit(struct sk_buff *skb, struct net_device *netdev) { struct sn_device *dev = netdev_priv(netdev); struct sn_queue *queue; u16 txq = skb->queue_mapping; /* log_info("txq=%d cpu=%d\n", txq, raw_smp_processor_id()); */ if (unlikely(skb->len > SNBUF_DATA)) { log_err("too large skb! (%d)\n", skb->len); dev_kfree_skb(skb); return NET_XMIT_DROP; } if (unlikely(txq >= dev->num_txq)) { log_err("invalid txq=%u\n", txq); dev_kfree_skb(skb); return NET_XMIT_DROP; } queue = dev->tx_queues[txq]; return sn_send_tx_queue(queue, dev, skb); } #if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) static u16 sn_select_queue(struct net_device *netdev, struct sk_buff *skb) #elif LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) && \ (!defined(UTS_UBUNTU_RELEASE_ABI) || UTS_UBUNTU_RELEASE_ABI < 24) static u16 sn_select_queue(struct net_device *netdev, struct sk_buff *skb, void *accel_priv) #elif LINUX_VERSION_CODE < KERNEL_VERSION(4,18,0) static u16 sn_select_queue(struct net_device *netdev, struct sk_buff *skb, void *accel_priv, select_queue_fallback_t fallback) #elif LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) static u16 sn_select_queue(struct net_device *netdev, struct sk_buff *skb, struct net_device *sb_dev, select_queue_fallback_t fallback) #else static u16 sn_select_queue(struct net_device *netdev, struct sk_buff *skb, struct net_device *sb_dev) #endif { struct sn_device *dev = netdev_priv(netdev); return dev->cpu_to_txq[raw_smp_processor_id()]; } #if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) static struct rtnl_link_stats64 *sn_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *storage) #else static void sn_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *storage) #endif { struct sn_device *dev = netdev_priv(netdev); int i; for (i = 0; i < dev->num_txq; i++) { storage->tx_packets += dev->tx_queues[i]->tx.stats.packets; storage->tx_bytes += dev->tx_queues[i]->tx.stats.bytes; storage->tx_dropped += dev->tx_queues[i]->tx.stats.dropped; } for (i = 0; i < dev->num_rxq; i++) { dev->rx_queues[i]->rx.stats.dropped = dev->rx_queues[i]->rx.rx_regs->dropped; storage->rx_packets += dev->rx_queues[i]->rx.stats.packets; storage->rx_bytes += dev->rx_queues[i]->rx.stats.bytes; storage->rx_dropped += dev->rx_queues[i]->rx.stats.dropped; } #if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) return storage; #endif } #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) typedef uint32_t netdev_features_t; #endif netdev_features_t sn_fix_features(struct net_device *dev, netdev_features_t features) { return features & ~NETIF_F_NOCACHE_COPY; } static const struct net_device_ops sn_netdev_ops = { .ndo_open = sn_open, .ndo_stop = sn_close, #ifdef CONFIG_NET_RX_BUSY_POLL .ndo_busy_poll = sn_poll_ll, #endif .ndo_start_xmit = sn_start_xmit, .ndo_select_queue = sn_select_queue, .ndo_get_stats64 = sn_get_stats64, .ndo_fix_features = sn_fix_features, .ndo_set_mac_address = eth_mac_addr, .ndo_validate_addr = eth_validate_addr, }; extern const struct ethtool_ops sn_ethtool_ops; static void sn_set_offloads(struct net_device *netdev) { #if 0 netif_set_gso_max_size(netdev, SNBUF_DATA); netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_LRO | NETIF_F_GSO_UDP_TUNNEL; #else /* We can safely enable SG, the rest needs work */ netdev->hw_features = (NETIF_F_SG | NETIF_F_FRAGLIST); #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) netdev->hw_enc_features = netdev->hw_features; #endif /* We prevent this interface from moving around namespaces. * This is to work around race between device unregister and namespace * cleanup. Revise this after adopting rtnl link based design */ netdev->features = netdev->hw_features | NETIF_F_NETNS_LOCAL; } static void sn_set_default_queue_mapping(struct sn_device *dev) { int cpu; int rxq; for_each_possible_cpu(cpu) { dev->cpu_to_txq[cpu] = 0; dev->cpu_to_rxqs[cpu][0] = -1; } for_each_online_cpu(cpu) { dev->cpu_to_txq[cpu] = cpu % dev->num_txq; } for (rxq = 0; rxq < dev->num_rxq; rxq++) { for_each_online_cpu(cpu) { int cnt; for (cnt = 0; dev->cpu_to_rxqs[cpu][cnt] != -1; cnt++) /* do nothing */ ; dev->cpu_to_rxqs[cpu][cnt] = rxq; dev->cpu_to_rxqs[cpu][cnt + 1] = -1; rxq++; if (rxq >= dev->num_rxq) break; } } } /* unregister_netdev(ice) will eventually trigger this function */ static void sn_netdev_destructor(struct net_device *netdev) { struct sn_device *dev = netdev_priv(netdev); sn_free_queues(dev); log_info("%s: releasing netdev...\n", netdev->name); } /* bar must be a virtual address that kernel has direct access */ int sn_create_netdev(void *bar, struct sn_device **dev_ret) { struct sn_conf_space *conf = bar; struct sn_device *dev; struct net_device *netdev; char *name; int ret; *dev_ret = NULL; if (conf->bar_size < sizeof(struct sn_conf_space)) { log_err("invalid BAR size %llu\n", conf->bar_size); return -EINVAL; } if (conf->num_txq < 1 || conf->num_rxq < 1 || conf->num_txq > MAX_QUEUES || conf->num_rxq > MAX_QUEUES) { log_err("invalid ioctl arguments: num_txq=%d, num_rxq=%d\n", conf->num_txq, conf->num_rxq); return -EINVAL; } netdev = alloc_etherdev_mqs(sizeof(struct sn_device), conf->num_txq, conf->num_rxq); if (!netdev) { log_err("alloc_netdev_mqs() failed\n"); return -ENOMEM; } if (strcmp(conf->ifname, "") == 0) name = "sn%d"; else name = conf->ifname; ret = dev_alloc_name(netdev, name); if (ret < 0) { log_err("failed to alloc name %s\n", name); free_netdev(netdev); return ret; } dev = netdev_priv(netdev); dev->netdev = netdev; dev->num_txq = conf->num_txq; dev->num_rxq = conf->num_rxq; sn_set_default_queue_mapping(dev); /* This will disable the default qdisc (mq or pfifo_fast) on the * interface in older kernels. We don't need qdisc since BESS * already has its own. Also see attach_default_qdiscs() in * sch_generic.c */ netdev->tx_queue_len = 0; #ifdef IFF_NO_QUEUE /* The introduction of anti-buffer-bloat and dynamic qdisc queue * length management in newer kernels changes the semantics of * asking for "no qdisc". It is now necessary to ask for it * explicitly by specifying the IFF_NO_QUEUE flag. */ netdev->priv_flags |= IFF_NO_QUEUE; #endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,11,9)) netdev->destructor = sn_netdev_destructor; #else netdev->priv_destructor = sn_netdev_destructor; #endif sn_set_offloads(netdev); netdev->netdev_ops = &sn_netdev_ops; netdev->ethtool_ops = &sn_ethtool_ops; memcpy(netdev->dev_addr, conf->mac_addr, ETH_ALEN); ret = sn_alloc_queues(dev, conf + 1, conf->bar_size - sizeof(struct sn_conf_space), &conf->txq_opts, &conf->rxq_opts); if (ret) { log_err("sn_alloc_queues() failed\n"); free_netdev(netdev); return ret; } *dev_ret = dev; return 0; } int sn_register_netdev(void *bar, struct sn_device *dev) { struct sn_conf_space *conf = bar; int ret; struct net *net = NULL; /* network namespace */ rtnl_lock(); if (conf->netns_fd >= 0) { #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) log_err("'netns' option requires Linux kernel 4.0 or higher\n"); ret = -EINVAL; goto fail_free; #else net = get_net_ns_by_fd(conf->netns_fd); if (IS_ERR(net)) { log_err("invalid or not a net namespace fd %d\n", conf->netns_fd); ret = PTR_ERR(net); goto fail_free; } #endif } else if (conf->container_pid) { net = get_net_ns_by_pid(conf->container_pid); if (IS_ERR(net)) { log_err("cannot find namespace of pid %d\n", conf->container_pid); ret = PTR_ERR(net); goto fail_free; } } if (!IS_ERR_OR_NULL(net)) { dev_net_set(dev->netdev, net); put_net(net); } ret = register_netdevice(dev->netdev); if (ret) { log_err("%s: register_netdev() failed (ret = %d)\n", dev->netdev->name, ret); goto fail_free; } /* interface "UP" by default */ #if (LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0)) dev_open(dev->netdev); #else dev_open(dev->netdev, NULL); #endif strcpy(conf->ifname, dev->netdev->name); log_info("%s: registered - %pM txq %d rxq %d\n", dev->netdev->name, dev->netdev->dev_addr, dev->netdev->real_num_tx_queues, dev->netdev->real_num_rx_queues); rtnl_unlock(); return ret; fail_free: rtnl_unlock(); free_netdev(dev->netdev); return ret; } void sn_release_netdev(struct sn_device *dev) { if (!dev) { log_err("called with a null pointer"); return; } rtnl_lock(); /* it is possible that the netdev has already been unregistered */ if (dev->netdev && dev->netdev->reg_state == NETREG_REGISTERED) unregister_netdevice(dev->netdev); /* sn_netdev_destructor will be called right after unlocking */ rtnl_unlock(); /* Queues are allocated in batch, * and the tx_queues[0] is its address */ kfree(dev->tx_queues[0]); free_netdev(dev->netdev); } /* This function is called in IRQ context on a remote core. * (on the local core, it is in user context) * Interrupts are disabled in both cases, anyway. * * For host mode, this function is invoked by sndrv_ioctl_kick_rx(). * For guest mode, it should be called in the MSIX handler. */ void sn_trigger_softirq(void *info) { struct sn_device *dev = info; int cpu = raw_smp_processor_id(); if (unlikely(dev->cpu_to_rxqs[cpu][0] == -1)) { struct sn_queue *rx_queue = dev->rx_queues[0]; rx_queue->rx.stats.interrupts++; napi_schedule(&rx_queue->rx.napi); } else { /* One core can be mapped to multiple RX queues. Awake them all. */ int i = 0; int rxq; while ((rxq = dev->cpu_to_rxqs[cpu][i]) != -1) { struct sn_queue *rx_queue = dev->rx_queues[rxq]; rx_queue->rx.stats.interrupts++; napi_schedule(&rx_queue->rx.napi); i++; } } } void sn_trigger_softirq_with_qid(void *info, int rxq) { struct sn_device *dev = info; struct sn_queue *rx_queue; if (rxq < 0 || rxq >= dev->num_rxq) { log_err("invalid rxq %d\n", rxq); return; } rx_queue = dev->rx_queues[rxq]; rx_queue->rx.stats.interrupts++; napi_schedule(&rx_queue->rx.napi); }
fde0fae57b463dec4087d2fe38a94b21180218c8
3ee2792127aede33173736376e63bab1e1cdf921
/figure_list2.c
216d3db432d76318b95b9f84e2ba4417d8c7c120
[]
no_license
Anothereno/fillit
b14b3185fdb9450e965731a94e88941f607b1a64
ed897b6356fd4e398dc060c3504fc51ed9bd0530
refs/heads/master
2020-04-25T11:43:21.771726
2019-02-26T17:06:59
2019-02-26T17:06:59
172,754,352
0
0
null
null
null
null
UTF-8
C
false
false
1,284
c
figure_list2.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* figure_list2.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ndremora <ndremora@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/02/14 17:39:23 by ndremora #+# #+# */ /* Updated: 2019/02/14 17:40:17 by ndremora ### ########.fr */ /* */ /* ************************************************************************** */ #include "fillit.h" void clear_tetr(t_figures *tetr) { t_figures *cur; if (tetr && tetr->head) { tetr = tetr->head; while (tetr) { cur = tetr; tetr = tetr->next; free(cur); cur = NULL; } } } void set2default(t_figures *tetr, int size) { t_figures *ptr; ptr = tetr; while (ptr) { shift(ptr, min_x(ptr, size), min_y(ptr, size), size); ptr = ptr->next; } }
445b6740f5fc39c90d12ed837db6e93a14a51988
7af2a78fff83ac9a969b084b5431454a2368d613
/testcase/ddump_multi_thread/ddump_mt.c
8f48a7f29616a8cc893425b432a6b28951422898
[]
no_license
jamescth/notes
a01c80800aa887c275933f8a5c0f5d6a7cfda8ad
7d9eece5ac4e4b4f113c1bdc0251083813923e47
refs/heads/master
2021-01-17T09:16:39.883152
2018-08-16T18:02:14
2018-08-16T18:02:14
41,609,850
0
2
null
null
null
null
UTF-8
C
false
false
9,269
c
ddump_mt.c
/* * This module measure how much time a kernel function takes. * The time is measure in jiffies (/1000 to get sec). * * The result is print in kern.info * * required files: * build.sh * Makefile * ddump_module.c * run_ddump * * run build.sh to build ddump_module.ko. * modify Makefile for wherever the kernel build is. * * run_ddump scan /proc/kallsyms to match up the given * kernel symbol. Pass the obtained address to * ddump_module.ko when the module is inserted. * * cp ddump_module.ko & run_ddump to test machine. * * Check workqueue.c as an exmaple. * * on test machine: * run_ddump <kernel symbol> */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/kthread.h> #include <linux/pid.h> #include <linux/timer.h> #include <linux/mm.h> #include <linux/pagemap.h> #include <linux/completion.h> #include <linux/cpumask.h> #include <asm/atomic.h> #define HELPERS 1 extern unsigned long end_pfn; // 1st probe kernel symbol static pid_t target_pid = -1; module_param(target_pid, int, 0000); // timer static struct timer_list ddump_timer; /* *global variables */ static int ddump_nr_cpus = 0; // artemis: 32 cpus, 3 HU, 128 / 256 GB // kuma: 80 cpus, 4 HU, 128 / 256 GB static int ddump_current_cpu = -1; static int max_helpers = -1; static int ddump_done = 0; static int ddump_exit = 0; static atomic64_t app_zero_pages; static atomic64_t app_non_zero_pages; static atomic64_t app_other_pages; typedef struct { // make sure it's 8 bytes aligned struct task_struct *cp_thread; int cp_cpu; int cp_range; int cp_order; unsigned long cp_app_zero_pages; unsigned long cp_app_non_zero_pages; unsigned long cp_app_other_pages; struct completion cp_buff_io_read; struct completion cp_buff_io_write; } ddump_comp_task_t; static ddump_comp_task_t ddump_thread_helper[HELPERS]; static struct task_struct *ddump_tp; // function prototype static int start_ddump_helper(void); static void ddump_run_helper(long); static struct vm_area_struct *first_vma(struct task_struct *, struct vm_area_struct *); static struct vm_area_struct *next_vma(struct vm_area_struct *, struct vm_area_struct *); static void walk_through_vma(struct task_struct *, ddump_comp_task_t *); static void ddump_timer_callback(unsigned long data) { start_ddump_helper(); } static void ddump_run_helper(long data) { printk("James is here current %p pid %d index %ld target %p pid %d mm %p\n", current, current->pid, data, ddump_tp, ddump_tp->pid, ddump_tp->mm); walk_through_vma(ddump_tp, &ddump_thread_helper[data]); ddump_done = 1; } static struct vm_area_struct *first_vma(struct task_struct *tsk, struct vm_area_struct *gate_vma) { struct vm_area_struct *ret = tsk->mm->mmap; if (ret) return ret; return gate_vma; } static struct vm_area_struct *next_vma(struct vm_area_struct *this_vma, struct vm_area_struct *gate_vma) { struct vm_area_struct *ret; ret = this_vma->vm_next; if (ret) return ret; if (this_vma == gate_vma) return NULL; return gate_vma; } static int ddump_percpu_thread(void* data) { // if someone calls kthread_stop() on this thread, return. // otherwise, keep going. long i = (long) data; set_current_state(TASK_INTERRUPTIBLE); while (!kthread_should_stop()) { schedule(); if (ddump_exit) break; // condition to run helper ddump_run_helper(i); set_current_state(TASK_INTERRUPTIBLE); } __set_current_state(TASK_RUNNING); return 0; } static int start_ddump_helper(void) { int index = 0; for (; index < HELPERS ; index++) { wake_up_process(ddump_thread_helper[index].cp_thread); } return 0; } static void ddump_percpu_thread_create(void) { // struct task_struct *ddump_thread_helper; int index = 0, order = 1; int cpu = 0; // need to figure out how to bind CPU struct task_struct *tmp_thread; for (; index < HELPERS ; index++, cpu++, order++) { // if we have used all cpus, stop if (cpu == ddump_nr_cpus) { break; } // we don't want to assign any helper to the current cpu if (cpu == ddump_current_cpu) { cpu++; } tmp_thread = kthread_create(ddump_percpu_thread, (void *)(long)index, "ddump_helper/%d", cpu); printk("James kthread %p\n", tmp_thread); ddump_thread_helper[index].cp_thread = tmp_thread; ddump_thread_helper[index].cp_order = order; // bind thread to the cpu if (likely(!IS_ERR(ddump_thread_helper[index].cp_thread))) { ddump_thread_helper[index].cp_cpu = cpu; //kthread_bind(tmp_thread, cpu); } else { // cant create thread // in real case, do single thread panic("CANT create ddump helper\n"); } wake_up_process(tmp_thread); } max_helpers = index; } static void read_waiter(ddump_comp_task_t *compt) { int i; init_completion(&compt->cp_buff_io_read); //printk("init r %d\n",compt->cp_order); for ( i = 0 ; i< 1000; i++); complete(&compt->cp_buff_io_read); //printk("wait w %d\n",compt->cp_order); wait_for_completion(&compt->cp_buff_io_write); } static void walk_through_vma(struct task_struct *tp, ddump_comp_task_t *compt) { struct vm_area_struct *vma = NULL; struct vm_area_struct *gate_vma= NULL; //int blk_in_chunk = 0; int ret; int i = 0; init_completion(&compt->cp_buff_io_read); for (vma = first_vma(tp, gate_vma) ; vma != NULL ; vma = next_vma(vma, gate_vma)) { unsigned long addr; //unsigned long pages_in_vma = 0; #if 0 if (!maydump_elf_vma(vma, mm_flags)) { // Dbg("VMA <%lx> startva <%lx> skipped!", // (unsigned long)vma, vma->vm_start); continue; } #endif for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) { struct vm_area_struct *vma_temp; struct page *page; ret = get_user_pages(tp, tp->mm, addr, 1, 0, 1, &page, &vma_temp); if (ret > 0) { if (page == ZERO_PAGE(page)) { compt->cp_app_zero_pages++; atomic64_inc(&app_zero_pages); //memset(primary->scratch + blk_in_chunk * PAGE_SIZE, // 0, PAGE_SIZE); } else { compt->cp_app_non_zero_pages++; atomic64_inc(&app_non_zero_pages); //kaddr = kmap_atomic(page, 0); //memcpy(primary->scratch + (blk_in_chunk * PAGE_SIZE), // kaddr, PAGE_SIZE); //kunmap_atomic(kaddr, 0); } page_cache_release(page); } else { compt->cp_app_other_pages++; atomic64_inc(&app_other_pages); //memset(primary->scratch + blk_in_chunk * PAGE_SIZE, // 0, PAGE_SIZE); } i++; //printk("%d i %d\n", compt->cp_order, i); // take a break here. if ((i%8) == 0) { //read_waiter(compt); //init_completion(&compt->cp_buff_io_read); //printk("init r %d i %d\n",compt->cp_order, i); //for ( i = 0 ; i< 1000; i++); complete(&compt->cp_buff_io_read); printk("wait w %d i %d\n",compt->cp_order, i); wait_for_completion(&compt->cp_buff_io_write); } } // addr } // first_vma if ((i%8) != 0) { complete(&compt->cp_buff_io_read); } } static void run_master_thread(void) { int index; //int i; for ( index = 0 ; index < HELPERS ; index++) { //printk("init w %d\n", ddump_thread_helper[index].cp_order); init_completion(&ddump_thread_helper[index].cp_buff_io_write); } start_ddump_helper(); #if 0 // setup timer setup_timer(&ddump_timer, ddump_timer_callback, 0); ret = mod_timer(&ddump_timer, jiffies+ msecs_to_jiffies(500)); if (ret) { printk("Error in mod_timer\n"); } #endif while (! ddump_done) { for ( index = 0 ; index < HELPERS ; index++) { printk("wait r %d\n", ddump_thread_helper[index].cp_order); wait_for_completion(&ddump_thread_helper[index].cp_buff_io_read); //for(i = 0; i< 1000; i++); complete(&ddump_thread_helper[index].cp_buff_io_write); //printk("init w %d\n", ddump_thread_helper[index].cp_order); } } } static int __init ddump_mt_init(void) { //int ret; //int index; ddump_nr_cpus = num_online_cpus(); printk("James: cpu # is %d\n", ddump_nr_cpus); ddump_current_cpu = smp_processor_id(); printk("James: current_cpu # is %d\n", ddump_current_cpu); printk("James: end_pfn is %lu, mem size is %lu\n", end_pfn, end_pfn * 4096); // init atomic64_set(&app_zero_pages, 0); atomic64_set(&app_non_zero_pages, 0); atomic64_set(&app_other_pages, 0); // create helper ddump_percpu_thread_create(); // set up the target if (target_pid == -1) { printk("No pid addigned\n"); return -1; } ddump_tp = find_task_by_pid_type(PIDTYPE_PID, target_pid); printk("James: panic_thread is %p, pid %d\n", ddump_tp, ddump_tp->pid); run_master_thread(); return 0; } static void __exit ddump_mt_exit(void) { int index = 0; //unsigned long cp_app_zero_pages; //unsigned long cp_app_non_zero_pages; //unsigned long cp_app_other_pages; ddump_exit = 1; for (; index < HELPERS ; index ++) { kthread_stop(ddump_thread_helper[index].cp_thread); printk("order %d cp_app_zero_pages %ld cp_app_non_zero_pages %ld cp_app_other_pages %ld\n", ddump_thread_helper[index].cp_order, ddump_thread_helper[index].cp_app_zero_pages, ddump_thread_helper[index].cp_app_non_zero_pages, ddump_thread_helper[index].cp_app_other_pages); } } module_init(ddump_mt_init); module_exit(ddump_mt_exit); MODULE_DESCRIPTION("diskdump multithread test"); MODULE_LICENSE("GPL v2");
478e6b594ba6269f8b28c6f85fe9718b837590a7
83865b21f52e79d68fa4c27be4a35dad33baead5
/warmup/0018_fourSum/fourSum.c
7d2653b903d08aa6e4d1704b3c0e62c81bad5300
[]
no_license
zwGithubStation/leetcode
9218b5fad1fe3cfd655c36d4302dc3e59cbdccc8
8034064dba397e2ba297950731e6830d626d9415
refs/heads/master
2023-07-07T05:15:37.573670
2023-06-26T23:47:58
2023-06-26T23:47:58
244,769,255
3
0
null
null
null
null
UTF-8
C
false
false
613
c
fourSum.c
/* * Copyright (C) ZWP * Problem: https://leetcode-cn.com/problems/4sum/ solve : compile: gcc -std=c99 -fsanitize=address -fno-omit-frame-pointer -O1 -g fourSum.c */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> /** * Return an array of arrays of size *returnSize. * The sizes of the arrays are returned as *returnColumnSizes array. * Note: Both returned array and *columnSizes array must be malloced, assume caller calls free(). */ int** fourSum(int* nums, int numsSize, int target, int* returnSize, int** returnColumnSizes){ } int main() { return 0; }
4db41dbcff0161e9918203042ca4e9b2fa6c88d5
ce0cfd458de699eceb8c0fb11dbdcc4f254a67f1
/A/112A.c
83485f3e9a98fa04a5bc23c28d2e2cbf2c47b74d
[]
no_license
Sajid576/Codeforces_Problem_solution
3e9e4759f8c8c2625ca012ed0d5cacc04e30b495
6d6883f849f1d9f8dc5475ad58d7a97da9d589b5
refs/heads/master
2020-07-06T01:39:01.256448
2019-08-17T07:09:10
2019-08-17T07:09:10
null
0
0
null
null
null
null
UTF-8
C
false
false
164
c
112A.c
#include<stdio.h> #include<string.h> int main() { char a[100], b[100] ; int n; gets(a) ; gets(b) ; n = stricmp(a,b) ; printf("%d",n) ; }
de5b07499fe3915eb00b37da4c7e5b5de173866a
5b048304d313179fb14bbc19734194601de549f7
/ndirfil/mdir/M_scipy__sparse__lil.c
7f8e03a5d1ca38e235c2dde2325cd2c119c22baa
[]
no_license
codezakh/Movie-Database-Production-SVM
08a4a574624212d354267fa2a65d6a32c7d39bdc
46647074a932e0b300dd194606363c4188aa5b1a
refs/heads/master
2016-09-05T16:21:26.953448
2014-04-04T06:01:33
2014-04-04T06:01:33
null
0
0
null
null
null
null
UTF-8
C
false
false
45,884
c
M_scipy__sparse__lil.c
unsigned char M_scipy__sparse__lil[] = { 99,0,0,0,0,0,0,0,0,3,0,0,0,64,96,1, 0,115,219,0,0,0,100,0,0,90,0,0,100,1,0,100, 2,0,108,1,0,109,2,0,90,2,0,109,3,0,90,3, 0,109,4,0,90,4,0,1,100,3,0,90,5,0,100,4, 0,100,5,0,103,2,0,90,6,0,100,1,0,100,6,0, 108,7,0,109,8,0,90,8,0,1,100,1,0,100,7,0, 108,9,0,90,10,0,100,1,0,100,8,0,108,11,0,109, 12,0,90,12,0,1,100,9,0,100,10,0,108,13,0,109, 14,0,90,14,0,109,15,0,90,15,0,1,100,9,0,100, 11,0,108,16,0,109,17,0,90,17,0,109,18,0,90,18, 0,109,19,0,90,19,0,109,20,0,90,20,0,1,100,1, 0,100,12,0,108,21,0,109,22,0,90,22,0,1,100,9, 0,100,13,0,108,13,0,109,23,0,90,23,0,1,100,4, 0,101,14,0,102,1,0,100,14,0,132,0,0,131,0,0, 89,90,24,0,100,15,0,132,0,0,90,25,0,100,7,0, 83,40,16,0,0,0,115,32,0,0,0,76,73,110,107,101, 100,32,76,105,115,116,32,115,112,97,114,115,101,32,109,97, 116,114,105,120,32,99,108,97,115,115,10,105,0,0,0,0, 40,3,0,0,0,116,8,0,0,0,100,105,118,105,115,105, 111,110,116,14,0,0,0,112,114,105,110,116,95,102,117,110, 99,116,105,111,110,116,15,0,0,0,97,98,115,111,108,117, 116,101,95,105,109,112,111,114,116,115,19,0,0,0,114,101, 115,116,114,117,99,116,117,114,101,100,116,101,120,116,32,101, 110,116,10,0,0,0,108,105,108,95,109,97,116,114,105,120, 116,14,0,0,0,105,115,115,112,109,97,116,114,105,120,95, 108,105,108,40,1,0,0,0,116,11,0,0,0,98,105,115, 101,99,116,95,108,101,102,116,78,40,1,0,0,0,116,6, 0,0,0,120,114,97,110,103,101,105,1,0,0,0,40,2, 0,0,0,116,8,0,0,0,115,112,109,97,116,114,105,120, 116,10,0,0,0,105,115,115,112,109,97,116,114,105,120,40, 4,0,0,0,116,8,0,0,0,103,101,116,100,116,121,112, 101,116,7,0,0,0,105,115,115,104,97,112,101,116,10,0, 0,0,105,115,115,101,113,117,101,110,99,101,116,12,0,0, 0,105,115,115,99,97,108,97,114,108,105,107,101,40,1,0, 0,0,116,4,0,0,0,119,97,114,110,40,1,0,0,0, 116,23,0,0,0,83,112,97,114,115,101,69,102,102,105,99, 105,101,110,99,121,87,97,114,110,105,110,103,99,0,0,0, 0,0,0,0,0,4,0,0,0,66,96,1,0,115,7,1, 0,0,101,0,0,90,1,0,100,0,0,90,2,0,100,26, 0,100,26,0,101,4,0,100,1,0,132,3,0,90,5,0, 100,2,0,132,0,0,90,6,0,100,3,0,132,0,0,90, 7,0,100,4,0,132,0,0,90,8,0,100,5,0,132,0, 0,90,9,0,100,6,0,132,0,0,90,10,0,101,11,0, 100,7,0,101,10,0,131,0,1,90,12,0,100,8,0,132, 0,0,90,13,0,100,9,0,132,0,0,90,14,0,100,10, 0,132,0,0,90,15,0,100,11,0,132,0,0,90,16,0, 100,12,0,132,0,0,90,17,0,100,13,0,132,0,0,90, 18,0,100,14,0,132,0,0,90,19,0,100,15,0,132,0, 0,90,20,0,100,16,0,132,0,0,90,21,0,100,17,0, 132,0,0,90,22,0,100,18,0,132,0,0,90,23,0,100, 19,0,132,0,0,90,24,0,100,20,0,132,0,0,90,25, 0,100,26,0,100,26,0,100,21,0,132,2,0,90,26,0, 100,22,0,132,0,0,90,27,0,101,4,0,100,23,0,132, 1,0,90,28,0,100,24,0,132,0,0,90,29,0,100,25, 0,132,0,0,90,30,0,82,83,40,27,0,0,0,115,104, 7,0,0,82,111,119,45,98,97,115,101,100,32,108,105,110, 107,101,100,32,108,105,115,116,32,115,112,97,114,115,101,32, 109,97,116,114,105,120,10,10,32,32,32,32,84,104,105,115, 32,105,115,32,97,110,32,101,102,102,105,99,105,101,110,116, 32,115,116,114,117,99,116,117,114,101,32,102,111,114,32,99, 111,110,115,116,114,117,99,116,105,110,103,32,115,112,97,114, 115,101,10,32,32,32,32,109,97,116,114,105,99,101,115,32, 105,110,99,114,101,109,101,110,116,97,108,108,121,46,10,10, 32,32,32,32,84,104,105,115,32,99,97,110,32,98,101,32, 105,110,115,116,97,110,116,105,97,116,101,100,32,105,110,32, 115,101,118,101,114,97,108,32,119,97,121,115,58,10,32,32, 32,32,32,32,32,32,108,105,108,95,109,97,116,114,105,120, 40,68,41,10,32,32,32,32,32,32,32,32,32,32,32,32, 119,105,116,104,32,97,32,100,101,110,115,101,32,109,97,116, 114,105,120,32,111,114,32,114,97,110,107,45,50,32,110,100, 97,114,114,97,121,32,68,10,10,32,32,32,32,32,32,32, 32,108,105,108,95,109,97,116,114,105,120,40,83,41,10,32, 32,32,32,32,32,32,32,32,32,32,32,119,105,116,104,32, 97,110,111,116,104,101,114,32,115,112,97,114,115,101,32,109, 97,116,114,105,120,32,83,32,40,101,113,117,105,118,97,108, 101,110,116,32,116,111,32,83,46,116,111,108,105,108,40,41, 41,10,10,32,32,32,32,32,32,32,32,108,105,108,95,109, 97,116,114,105,120,40,40,77,44,32,78,41,44,32,91,100, 116,121,112,101,93,41,10,32,32,32,32,32,32,32,32,32, 32,32,32,116,111,32,99,111,110,115,116,114,117,99,116,32, 97,110,32,101,109,112,116,121,32,109,97,116,114,105,120,32, 119,105,116,104,32,115,104,97,112,101,32,40,77,44,32,78, 41,10,32,32,32,32,32,32,32,32,32,32,32,32,100,116, 121,112,101,32,105,115,32,111,112,116,105,111,110,97,108,44, 32,100,101,102,97,117,108,116,105,110,103,32,116,111,32,100, 116,121,112,101,61,39,100,39,46,10,10,32,32,32,32,65, 116,116,114,105,98,117,116,101,115,10,32,32,32,32,45,45, 45,45,45,45,45,45,45,45,10,32,32,32,32,100,116,121, 112,101,32,58,32,100,116,121,112,101,10,32,32,32,32,32, 32,32,32,68,97,116,97,32,116,121,112,101,32,111,102,32, 116,104,101,32,109,97,116,114,105,120,10,32,32,32,32,115, 104,97,112,101,32,58,32,50,45,116,117,112,108,101,10,32, 32,32,32,32,32,32,32,83,104,97,112,101,32,111,102,32, 116,104,101,32,109,97,116,114,105,120,10,32,32,32,32,110, 100,105,109,32,58,32,105,110,116,10,32,32,32,32,32,32, 32,32,78,117,109,98,101,114,32,111,102,32,100,105,109,101, 110,115,105,111,110,115,32,40,116,104,105,115,32,105,115,32, 97,108,119,97,121,115,32,50,41,10,32,32,32,32,110,110, 122,10,32,32,32,32,32,32,32,32,78,117,109,98,101,114, 32,111,102,32,110,111,110,122,101,114,111,32,101,108,101,109, 101,110,116,115,10,32,32,32,32,100,97,116,97,10,32,32, 32,32,32,32,32,32,76,73,76,32,102,111,114,109,97,116, 32,100,97,116,97,32,97,114,114,97,121,32,111,102,32,116, 104,101,32,109,97,116,114,105,120,10,32,32,32,32,114,111, 119,115,10,32,32,32,32,32,32,32,32,76,73,76,32,102, 111,114,109,97,116,32,114,111,119,32,105,110,100,101,120,32, 97,114,114,97,121,32,111,102,32,116,104,101,32,109,97,116, 114,105,120,10,10,32,32,32,32,78,111,116,101,115,10,32, 32,32,32,45,45,45,45,45,10,10,32,32,32,32,83,112, 97,114,115,101,32,109,97,116,114,105,99,101,115,32,99,97, 110,32,98,101,32,117,115,101,100,32,105,110,32,97,114,105, 116,104,109,101,116,105,99,32,111,112,101,114,97,116,105,111, 110,115,58,32,116,104,101,121,32,115,117,112,112,111,114,116, 10,32,32,32,32,97,100,100,105,116,105,111,110,44,32,115, 117,98,116,114,97,99,116,105,111,110,44,32,109,117,108,116, 105,112,108,105,99,97,116,105,111,110,44,32,100,105,118,105, 115,105,111,110,44,32,97,110,100,32,109,97,116,114,105,120, 32,112,111,119,101,114,46,10,10,32,32,32,32,65,100,118, 97,110,116,97,103,101,115,32,111,102,32,116,104,101,32,76, 73,76,32,102,111,114,109,97,116,10,32,32,32,32,32,32, 32,32,45,32,115,117,112,112,111,114,116,115,32,102,108,101, 120,105,98,108,101,32,115,108,105,99,105,110,103,10,32,32, 32,32,32,32,32,32,45,32,99,104,97,110,103,101,115,32, 116,111,32,116,104,101,32,109,97,116,114,105,120,32,115,112, 97,114,115,105,116,121,32,115,116,114,117,99,116,117,114,101, 32,97,114,101,32,101,102,102,105,99,105,101,110,116,10,10, 32,32,32,32,68,105,115,97,100,118,97,110,116,97,103,101, 115,32,111,102,32,116,104,101,32,76,73,76,32,102,111,114, 109,97,116,10,32,32,32,32,32,32,32,32,45,32,97,114, 105,116,104,109,101,116,105,99,32,111,112,101,114,97,116,105, 111,110,115,32,76,73,76,32,43,32,76,73,76,32,97,114, 101,32,115,108,111,119,32,40,99,111,110,115,105,100,101,114, 32,67,83,82,32,111,114,32,67,83,67,41,10,32,32,32, 32,32,32,32,32,45,32,115,108,111,119,32,99,111,108,117, 109,110,32,115,108,105,99,105,110,103,32,40,99,111,110,115, 105,100,101,114,32,67,83,67,41,10,32,32,32,32,32,32, 32,32,45,32,115,108,111,119,32,109,97,116,114,105,120,32, 118,101,99,116,111,114,32,112,114,111,100,117,99,116,115,32, 40,99,111,110,115,105,100,101,114,32,67,83,82,32,111,114, 32,67,83,67,41,10,10,32,32,32,32,73,110,116,101,110, 100,101,100,32,85,115,97,103,101,10,32,32,32,32,32,32, 32,32,45,32,76,73,76,32,105,115,32,97,32,99,111,110, 118,101,110,105,101,110,116,32,102,111,114,109,97,116,32,102, 111,114,32,99,111,110,115,116,114,117,99,116,105,110,103,32, 115,112,97,114,115,101,32,109,97,116,114,105,99,101,115,10, 32,32,32,32,32,32,32,32,45,32,111,110,99,101,32,97, 32,109,97,116,114,105,120,32,104,97,115,32,98,101,101,110, 32,99,111,110,115,116,114,117,99,116,101,100,44,32,99,111, 110,118,101,114,116,32,116,111,32,67,83,82,32,111,114,10, 32,32,32,32,32,32,32,32,32,32,67,83,67,32,102,111, 114,109,97,116,32,102,111,114,32,102,97,115,116,32,97,114, 105,116,104,109,101,116,105,99,32,97,110,100,32,109,97,116, 114,105,120,32,118,101,99,116,111,114,32,111,112,101,114,97, 116,105,111,110,115,10,32,32,32,32,32,32,32,32,45,32, 99,111,110,115,105,100,101,114,32,117,115,105,110,103,32,116, 104,101,32,67,79,79,32,102,111,114,109,97,116,32,119,104, 101,110,32,99,111,110,115,116,114,117,99,116,105,110,103,32, 108,97,114,103,101,32,109,97,116,114,105,99,101,115,10,10, 32,32,32,32,68,97,116,97,32,83,116,114,117,99,116,117, 114,101,10,32,32,32,32,32,32,32,32,45,32,65,110,32, 97,114,114,97,121,32,40,96,96,115,101,108,102,46,114,111, 119,115,96,96,41,32,111,102,32,114,111,119,115,44,32,101, 97,99,104,32,111,102,32,119,104,105,99,104,32,105,115,32, 97,32,115,111,114,116,101,100,10,32,32,32,32,32,32,32, 32,32,32,108,105,115,116,32,111,102,32,99,111,108,117,109, 110,32,105,110,100,105,99,101,115,32,111,102,32,110,111,110, 45,122,101,114,111,32,101,108,101,109,101,110,116,115,46,10, 32,32,32,32,32,32,32,32,45,32,84,104,101,32,99,111, 114,114,101,115,112,111,110,100,105,110,103,32,110,111,110,122, 101,114,111,32,118,97,108,117,101,115,32,97,114,101,32,115, 116,111,114,101,100,32,105,110,32,115,105,109,105,108,97,114, 10,32,32,32,32,32,32,32,32,32,32,102,97,115,104,105, 111,110,32,105,110,32,96,96,115,101,108,102,46,100,97,116, 97,96,96,46,10,10,10,32,32,32,32,99,5,0,0,0, 10,0,0,0,5,0,0,0,67,96,1,0,115,8,2,0, 0,116,0,0,106,1,0,124,0,0,131,1,0,1,116,2, 0,124,3,0,124,1,0,100,1,0,116,3,0,131,2,1, 124,0,0,95,4,0,116,5,0,124,1,0,131,1,0,114, 175,0,116,6,0,124,1,0,131,1,0,114,82,0,124,4, 0,114,82,0,124,1,0,106,7,0,131,0,0,125,5,0, 110,12,0,124,1,0,106,8,0,131,0,0,125,5,0,124, 3,0,100,0,0,107,9,0,114,124,0,124,5,0,106,10, 0,124,3,0,131,1,0,125,5,0,110,0,0,124,5,0, 106,11,0,124,0,0,95,11,0,124,5,0,106,4,0,124, 0,0,95,4,0,124,5,0,106,12,0,124,0,0,95,12, 0,124,5,0,106,13,0,124,0,0,95,13,0,110,85,1, 116,14,0,124,1,0,116,15,0,131,2,0,114,121,1,116, 16,0,124,1,0,131,1,0,114,106,1,124,2,0,100,0, 0,107,9,0,114,229,0,116,17,0,100,2,0,131,1,0, 130,1,0,110,0,0,124,1,0,92,2,0,125,6,0,125, 7,0,124,6,0,124,7,0,102,2,0,124,0,0,95,11, 0,116,18,0,106,19,0,124,6,0,102,1,0,100,3,0, 116,20,0,131,1,1,124,0,0,95,12,0,116,18,0,106, 19,0,124,6,0,102,1,0,100,3,0,116,20,0,131,1, 1,124,0,0,95,13,0,120,61,0,116,21,0,124,6,0, 131,1,0,68,93,32,0,125,8,0,103,0,0,124,0,0, 106,12,0,124,8,0,60,103,0,0,124,0,0,106,13,0, 124,8,0,60,113,67,1,87,113,4,2,116,22,0,100,4, 0,131,1,0,130,1,0,110,139,0,121,19,0,116,18,0, 106,23,0,124,1,0,131,1,0,125,5,0,87,110,29,0, 4,116,22,0,107,10,0,114,171,1,1,1,1,116,22,0, 100,5,0,131,1,0,130,1,0,110,89,0,88,100,6,0, 100,7,0,108,24,0,109,25,0,125,9,0,1,124,9,0, 124,5,0,100,3,0,124,3,0,131,1,1,106,8,0,131, 0,0,125,5,0,124,5,0,106,11,0,124,0,0,95,11, 0,124,5,0,106,4,0,124,0,0,95,4,0,124,5,0, 106,12,0,124,0,0,95,12,0,124,5,0,106,13,0,124, 0,0,95,13,0,100,0,0,83,40,8,0,0,0,78,116, 7,0,0,0,100,101,102,97,117,108,116,115,30,0,0,0, 105,110,118,97,108,105,100,32,117,115,101,32,111,102,32,115, 104,97,112,101,32,112,97,114,97,109,101,116,101,114,116,5, 0,0,0,100,116,121,112,101,115,41,0,0,0,117,110,114, 101,99,111,103,110,105,122,101,100,32,108,105,108,95,109,97, 116,114,105,120,32,99,111,110,115,116,114,117,99,116,111,114, 32,117,115,97,103,101,115,23,0,0,0,117,110,115,117,112, 112,111,114,116,101,100,32,109,97,116,114,105,120,32,116,121, 112,101,105,1,0,0,0,40,1,0,0,0,116,10,0,0, 0,99,115,114,95,109,97,116,114,105,120,40,26,0,0,0, 82,7,0,0,0,116,8,0,0,0,95,95,105,110,105,116, 95,95,82,9,0,0,0,116,5,0,0,0,102,108,111,97, 116,82,16,0,0,0,82,8,0,0,0,82,4,0,0,0, 116,4,0,0,0,99,111,112,121,116,5,0,0,0,116,111, 108,105,108,116,4,0,0,0,78,111,110,101,116,6,0,0, 0,97,115,116,121,112,101,116,5,0,0,0,115,104,97,112, 101,116,4,0,0,0,114,111,119,115,116,4,0,0,0,100, 97,116,97,116,10,0,0,0,105,115,105,110,115,116,97,110, 99,101,116,5,0,0,0,116,117,112,108,101,82,10,0,0, 0,116,10,0,0,0,86,97,108,117,101,69,114,114,111,114, 116,2,0,0,0,110,112,116,5,0,0,0,101,109,112,116, 121,116,6,0,0,0,111,98,106,101,99,116,116,5,0,0, 0,114,97,110,103,101,116,9,0,0,0,84,121,112,101,69, 114,114,111,114,116,8,0,0,0,97,115,109,97,116,114,105, 120,116,3,0,0,0,99,115,114,82,17,0,0,0,40,10, 0,0,0,116,4,0,0,0,115,101,108,102,116,4,0,0, 0,97,114,103,49,82,24,0,0,0,82,16,0,0,0,82, 20,0,0,0,116,1,0,0,0,65,116,1,0,0,0,77, 116,1,0,0,0,78,116,1,0,0,0,105,82,17,0,0, 0,40,0,0,0,0,40,0,0,0,0,115,52,0,0,0, 47,117,115,114,47,108,105,98,47,112,121,116,104,111,110,50, 46,55,47,100,105,115,116,45,112,97,99,107,97,103,101,115, 47,115,99,105,112,121,47,115,112,97,114,115,101,47,108,105, 108,46,112,121,82,18,0,0,0,84,0,0,0,115,68,0, 0,0,0,1,13,1,24,3,12,1,18,1,15,2,12,2, 12,1,18,2,12,1,12,1,12,1,15,1,15,1,12,1, 12,1,15,1,12,1,15,1,27,1,27,1,19,1,13,1, 20,2,15,3,3,1,19,1,13,1,16,2,16,1,24,2, 12,1,12,1,12,1,99,2,0,0,0,2,0,0,0,5, 0,0,0,67,96,1,0,115,36,0,0,0,124,0,0,124, 1,0,23,124,0,0,100,0,0,100,0,0,133,2,0,100, 0,0,100,0,0,133,2,0,102,2,0,60,124,0,0,83, 40,1,0,0,0,78,40,0,0,0,0,40,2,0,0,0, 82,37,0,0,0,116,5,0,0,0,111,116,104,101,114,40, 0,0,0,0,40,0,0,0,0,115,52,0,0,0,47,117, 115,114,47,108,105,98,47,112,121,116,104,111,110,50,46,55, 47,100,105,115,116,45,112,97,99,107,97,103,101,115,47,115, 99,105,112,121,47,115,112,97,114,115,101,47,108,105,108,46, 112,121,116,8,0,0,0,95,95,105,97,100,100,95,95,130, 0,0,0,115,4,0,0,0,0,1,32,1,99,2,0,0, 0,2,0,0,0,5,0,0,0,67,96,1,0,115,36,0, 0,0,124,0,0,124,1,0,24,124,0,0,100,0,0,100, 0,0,133,2,0,100,0,0,100,0,0,133,2,0,102,2, 0,60,124,0,0,83,40,1,0,0,0,78,40,0,0,0, 0,40,2,0,0,0,82,37,0,0,0,82,43,0,0,0, 40,0,0,0,0,40,0,0,0,0,115,52,0,0,0,47, 117,115,114,47,108,105,98,47,112,121,116,104,111,110,50,46, 55,47,100,105,115,116,45,112,97,99,107,97,103,101,115,47, 115,99,105,112,121,47,115,112,97,114,115,101,47,108,105,108, 46,112,121,116,8,0,0,0,95,95,105,115,117,98,95,95, 134,0,0,0,115,4,0,0,0,0,1,32,1,99,2,0, 0,0,2,0,0,0,5,0,0,0,67,96,1,0,115,58, 0,0,0,116,0,0,124,1,0,131,1,0,114,48,0,124, 0,0,124,1,0,20,124,0,0,100,0,0,100,0,0,133, 2,0,100,0,0,100,0,0,133,2,0,102,2,0,60,124, 0,0,83,116,1,0,130,1,0,100,0,0,83,40,1,0, 0,0,78,40,2,0,0,0,82,12,0,0,0,116,19,0, 0,0,78,111,116,73,109,112,108,101,109,101,110,116,101,100, 69,114,114,111,114,40,2,0,0,0,82,37,0,0,0,82, 43,0,0,0,40,0,0,0,0,40,0,0,0,0,115,52, 0,0,0,47,117,115,114,47,108,105,98,47,112,121,116,104, 111,110,50,46,55,47,100,105,115,116,45,112,97,99,107,97, 103,101,115,47,115,99,105,112,121,47,115,112,97,114,115,101, 47,108,105,108,46,112,121,116,8,0,0,0,95,95,105,109, 117,108,95,95,138,0,0,0,115,8,0,0,0,0,1,12, 1,32,1,4,2,99,2,0,0,0,2,0,0,0,5,0, 0,0,67,96,1,0,115,58,0,0,0,116,0,0,124,1, 0,131,1,0,114,48,0,124,0,0,124,1,0,27,124,0, 0,100,0,0,100,0,0,133,2,0,100,0,0,100,0,0, 133,2,0,102,2,0,60,124,0,0,83,116,1,0,130,1, 0,100,0,0,83,40,1,0,0,0,78,40,2,0,0,0, 82,12,0,0,0,82,46,0,0,0,40,2,0,0,0,82, 37,0,0,0,82,43,0,0,0,40,0,0,0,0,40,0, 0,0,0,115,52,0,0,0,47,117,115,114,47,108,105,98, 47,112,121,116,104,111,110,50,46,55,47,100,105,115,116,45, 112,97,99,107,97,103,101,115,47,115,99,105,112,121,47,115, 112,97,114,115,101,47,108,105,108,46,112,121,116,12,0,0, 0,95,95,105,116,114,117,101,100,105,118,95,95,145,0,0, 0,115,8,0,0,0,0,1,12,1,32,1,4,2,99,1, 0,0,0,2,0,0,0,5,0,0,0,67,96,1,0,115, 38,0,0,0,116,0,0,103,0,0,124,0,0,106,1,0, 68,93,18,0,125,1,0,116,2,0,124,1,0,131,1,0, 94,2,0,113,13,0,131,1,0,83,40,1,0,0,0,78, 40,3,0,0,0,116,3,0,0,0,115,117,109,82,26,0, 0,0,116,3,0,0,0,108,101,110,40,2,0,0,0,82, 37,0,0,0,116,7,0,0,0,114,111,119,118,97,108,115, 40,0,0,0,0,40,0,0,0,0,115,52,0,0,0,47, 117,115,114,47,108,105,98,47,112,121,116,104,111,110,50,46, 55,47,100,105,115,116,45,112,97,99,107,97,103,101,115,47, 115,99,105,112,121,47,115,112,97,114,115,101,47,108,105,108, 46,112,121,116,6,0,0,0,103,101,116,110,110,122,155,0, 0,0,115,2,0,0,0,0,1,116,4,0,0,0,102,103, 101,116,99,1,0,0,0,6,0,0,0,8,0,0,0,67, 96,1,0,115,124,0,0,0,100,1,0,125,1,0,120,107, 0,116,0,0,124,0,0,106,1,0,131,1,0,68,93,90, 0,92,2,0,125,2,0,125,3,0,120,75,0,116,0,0, 124,3,0,131,1,0,68,93,61,0,92,2,0,125,4,0, 125,5,0,124,1,0,100,2,0,116,2,0,124,2,0,124, 5,0,102,2,0,131,1,0,116,2,0,124,0,0,106,3, 0,124,2,0,25,124,4,0,25,131,1,0,102,2,0,22, 55,125,1,0,113,47,0,87,113,22,0,87,124,1,0,100, 3,0,32,83,40,4,0,0,0,78,116,0,0,0,0,115, 8,0,0,0,32,32,37,115,9,37,115,10,105,255,255,255, 255,40,4,0,0,0,116,9,0,0,0,101,110,117,109,101, 114,97,116,101,82,25,0,0,0,116,3,0,0,0,115,116, 114,82,26,0,0,0,40,6,0,0,0,82,37,0,0,0, 116,3,0,0,0,118,97,108,82,42,0,0,0,116,3,0, 0,0,114,111,119,116,3,0,0,0,112,111,115,116,1,0, 0,0,106,40,0,0,0,0,40,0,0,0,0,115,52,0, 0,0,47,117,115,114,47,108,105,98,47,112,121,116,104,111, 110,50,46,55,47,100,105,115,116,45,112,97,99,107,97,103, 101,115,47,115,99,105,112,121,47,115,112,97,114,115,101,47, 108,105,108,46,112,121,116,7,0,0,0,95,95,115,116,114, 95,95,159,0,0,0,115,10,0,0,0,0,1,6,1,28, 1,25,1,57,1,99,2,0,0,0,3,0,0,0,4,0, 0,0,67,96,1,0,115,78,0,0,0,116,0,0,100,1, 0,124,0,0,106,1,0,100,1,0,25,102,2,0,100,2, 0,124,0,0,106,2,0,131,1,1,125,2,0,124,0,0, 106,3,0,124,1,0,25,124,2,0,106,3,0,100,3,0, 60,124,0,0,106,4,0,124,1,0,25,124,2,0,106,4, 0,100,3,0,60,124,2,0,83,40,4,0,0,0,115,59, 0,0,0,82,101,116,117,114,110,115,32,97,32,118,105,101, 119,32,111,102,32,116,104,101,32,39,105,39,116,104,32,114, 111,119,32,40,119,105,116,104,111,117,116,32,99,111,112,121, 105,110,103,41,46,10,32,32,32,32,32,32,32,32,105,1, 0,0,0,82,16,0,0,0,105,0,0,0,0,40,5,0, 0,0,82,3,0,0,0,82,24,0,0,0,82,16,0,0, 0,82,25,0,0,0,82,26,0,0,0,40,3,0,0,0, 82,37,0,0,0,82,42,0,0,0,116,3,0,0,0,110, 101,119,40,0,0,0,0,40,0,0,0,0,115,52,0,0, 0,47,117,115,114,47,108,105,98,47,112,121,116,104,111,110, 50,46,55,47,100,105,115,116,45,112,97,99,107,97,103,101, 115,47,115,99,105,112,121,47,115,112,97,114,115,101,47,108, 105,108,46,112,121,116,10,0,0,0,103,101,116,114,111,119, 118,105,101,119,166,0,0,0,115,8,0,0,0,0,3,34, 1,20,1,20,1,99,2,0,0,0,3,0,0,0,4,0, 0,0,67,96,1,0,115,80,0,0,0,116,0,0,100,1, 0,124,0,0,106,1,0,100,1,0,25,102,2,0,100,2, 0,124,0,0,106,2,0,131,1,1,125,2,0,124,0,0, 106,3,0,124,1,0,25,30,124,2,0,106,3,0,100,3, 0,60,124,0,0,106,4,0,124,1,0,25,30,124,2,0, 106,4,0,100,3,0,60,124,2,0,83,40,4,0,0,0, 115,41,0,0,0,82,101,116,117,114,110,115,32,97,32,99, 111,112,121,32,111,102,32,116,104,101,32,39,105,39,116,104, 32,114,111,119,46,10,32,32,32,32,32,32,32,32,105,1, 0,0,0,82,16,0,0,0,105,0,0,0,0,40,5,0, 0,0,82,3,0,0,0,82,24,0,0,0,82,16,0,0, 0,82,25,0,0,0,82,26,0,0,0,40,3,0,0,0, 82,37,0,0,0,82,42,0,0,0,82,62,0,0,0,40, 0,0,0,0,40,0,0,0,0,115,52,0,0,0,47,117, 115,114,47,108,105,98,47,112,121,116,104,111,110,50,46,55, 47,100,105,115,116,45,112,97,99,107,97,103,101,115,47,115, 99,105,112,121,47,115,112,97,114,115,101,47,108,105,108,46, 112,121,116,6,0,0,0,103,101,116,114,111,119,174,0,0, 0,115,8,0,0,0,0,3,34,1,21,1,21,1,99,3, 0,0,0,6,0,0,0,6,0,0,0,67,96,1,0,115, 15,1,0,0,124,1,0,100,1,0,107,0,0,114,32,0, 124,1,0,124,0,0,106,0,0,100,1,0,25,55,125,1, 0,110,0,0,124,1,0,100,1,0,107,0,0,115,63,0, 124,1,0,124,0,0,106,0,0,100,1,0,25,107,5,0, 114,78,0,116,1,0,100,2,0,131,1,0,130,1,0,110, 0,0,124,2,0,100,1,0,107,0,0,114,110,0,124,2, 0,124,0,0,106,0,0,100,3,0,25,55,125,2,0,110, 0,0,124,2,0,100,1,0,107,0,0,115,141,0,124,2, 0,124,0,0,106,0,0,100,3,0,25,107,5,0,114,156, 0,116,1,0,100,4,0,131,1,0,130,1,0,110,0,0, 124,0,0,106,2,0,124,1,0,25,125,3,0,124,0,0, 106,3,0,124,1,0,25,125,4,0,116,4,0,124,3,0, 124,2,0,131,2,0,125,5,0,124,5,0,116,5,0,124, 4,0,131,1,0,107,3,0,114,251,0,124,3,0,124,5, 0,25,124,2,0,107,2,0,114,251,0,124,0,0,106,6, 0,106,7,0,124,4,0,124,5,0,25,131,1,0,83,124, 0,0,106,6,0,106,7,0,100,1,0,131,1,0,83,100, 0,0,83,40,5,0,0,0,78,105,0,0,0,0,115,23, 0,0,0,114,111,119,32,105,110,100,101,120,32,111,117,116, 32,111,102,32,98,111,117,110,100,115,105,1,0,0,0,115, 26,0,0,0,99,111,108,117,109,110,32,105,110,100,101,120, 32,111,117,116,32,111,102,32,98,111,117,110,100,115,40,8, 0,0,0,82,24,0,0,0,116,10,0,0,0,73,110,100, 101,120,69,114,114,111,114,82,25,0,0,0,82,26,0,0, 0,82,5,0,0,0,82,50,0,0,0,82,16,0,0,0, 116,4,0,0,0,116,121,112,101,40,6,0,0,0,82,37, 0,0,0,82,42,0,0,0,82,60,0,0,0,82,58,0, 0,0,82,26,0,0,0,82,59,0,0,0,40,0,0,0, 0,40,0,0,0,0,115,52,0,0,0,47,117,115,114,47, 108,105,98,47,112,121,116,104,111,110,50,46,55,47,100,105, 115,116,45,112,97,99,107,97,103,101,115,47,115,99,105,112, 121,47,115,112,97,114,115,101,47,108,105,108,46,112,121,116, 5,0,0,0,95,103,101,116,49,182,0,0,0,115,28,0, 0,0,0,2,12,1,20,1,31,1,15,2,12,1,20,1, 31,1,15,2,13,1,13,2,15,1,34,1,20,2,99,3, 0,0,0,5,0,0,0,8,0,0,0,67,96,1,0,115, 195,0,0,0,124,1,0,106,0,0,100,0,0,107,9,0, 114,46,0,124,1,0,106,0,0,100,1,0,107,0,0,114, 46,0,124,2,0,124,1,0,106,0,0,23,125,3,0,110, 33,0,124,1,0,106,0,0,100,0,0,107,8,0,114,70, 0,100,1,0,125,3,0,110,9,0,124,1,0,106,0,0, 125,3,0,124,1,0,106,2,0,100,0,0,107,9,0,114, 125,0,124,1,0,106,2,0,100,1,0,107,0,0,114,125, 0,124,2,0,124,1,0,106,2,0,23,125,4,0,110,33, 0,124,1,0,106,2,0,100,0,0,107,8,0,114,149,0, 124,2,0,125,4,0,110,9,0,124,1,0,106,2,0,125, 4,0,116,3,0,116,4,0,124,3,0,124,4,0,124,1, 0,106,5,0,112,182,0,100,2,0,131,3,0,131,1,0, 125,1,0,124,1,0,83,40,3,0,0,0,78,105,0,0, 0,0,105,1,0,0,0,40,6,0,0,0,116,5,0,0, 0,115,116,97,114,116,82,22,0,0,0,116,4,0,0,0, 115,116,111,112,116,4,0,0,0,108,105,115,116,82,33,0, 0,0,116,4,0,0,0,115,116,101,112,40,5,0,0,0, 82,37,0,0,0,82,60,0,0,0,82,24,0,0,0,82, 68,0,0,0,82,69,0,0,0,40,0,0,0,0,40,0, 0,0,0,115,52,0,0,0,47,117,115,114,47,108,105,98, 47,112,121,116,104,111,110,50,46,55,47,100,105,115,116,45, 112,97,99,107,97,103,101,115,47,115,99,105,112,121,47,115, 112,97,114,115,101,47,108,105,108,46,112,121,116,11,0,0, 0,95,115,108,105,99,101,116,111,115,101,113,203,0,0,0, 115,24,0,0,0,0,1,30,1,16,1,15,1,9,2,9, 1,30,1,16,1,15,1,9,2,9,1,33,1,99,2,0, 0,0,6,0,0,0,11,0,0,0,67,96,1,0,115,89, 2,0,0,121,16,0,124,1,0,92,2,0,125,2,0,125, 3,0,87,110,35,0,4,116,0,0,116,1,0,102,2,0, 107,10,0,114,53,0,1,1,1,116,2,0,100,1,0,131, 1,0,130,1,0,110,1,0,88,116,3,0,106,4,0,124, 2,0,131,1,0,12,114,101,0,116,3,0,106,4,0,124, 3,0,131,1,0,114,101,0,116,5,0,100,2,0,116,6, 0,131,2,0,1,110,0,0,116,3,0,106,4,0,124,2, 0,131,1,0,114,252,0,116,3,0,106,4,0,124,3,0, 131,1,0,114,147,0,124,0,0,106,7,0,124,2,0,124, 3,0,131,2,0,83,116,8,0,124,3,0,116,9,0,131, 2,0,114,190,0,124,0,0,106,10,0,124,3,0,124,0, 0,106,11,0,100,3,0,25,131,2,0,125,3,0,110,0, 0,116,12,0,124,3,0,131,1,0,114,85,2,124,0,0, 106,13,0,103,0,0,124,3,0,68,93,24,0,125,4,0, 124,0,0,106,7,0,124,2,0,124,4,0,131,2,0,94, 2,0,113,215,0,103,1,0,131,1,0,83,110,89,1,116, 12,0,124,2,0,131,1,0,114,82,1,116,12,0,124,3, 0,131,1,0,114,82,1,124,0,0,106,13,0,103,0,0, 116,14,0,124,2,0,124,3,0,131,2,0,68,93,30,0, 92,2,0,125,5,0,125,4,0,124,0,0,106,7,0,124, 5,0,124,4,0,131,2,0,94,2,0,113,42,1,103,1, 0,131,1,0,83,116,12,0,124,2,0,131,1,0,115,109, 1,116,8,0,124,2,0,116,9,0,131,2,0,114,79,2, 116,8,0,124,2,0,116,9,0,131,2,0,114,152,1,124, 0,0,106,10,0,124,2,0,124,0,0,106,11,0,100,4, 0,25,131,2,0,125,2,0,110,0,0,116,3,0,106,4, 0,124,3,0,131,1,0,114,214,1,124,0,0,106,13,0, 103,0,0,124,2,0,68,93,27,0,125,5,0,124,0,0, 106,7,0,124,5,0,124,3,0,131,2,0,103,1,0,94, 2,0,113,180,1,131,1,0,83,116,8,0,124,3,0,116, 9,0,131,2,0,114,1,2,124,0,0,106,10,0,124,3, 0,124,0,0,106,11,0,100,3,0,25,131,2,0,125,3, 0,110,0,0,116,12,0,124,3,0,131,1,0,114,85,2, 124,0,0,106,13,0,103,0,0,124,2,0,68,93,43,0, 125,5,0,103,0,0,124,3,0,68,93,24,0,125,4,0, 124,0,0,106,7,0,124,5,0,124,4,0,131,2,0,94, 2,0,113,39,2,94,2,0,113,26,2,131,1,0,83,110, 6,0,116,2,0,130,1,0,100,5,0,83,40,6,0,0, 0,115,174,0,0,0,82,101,116,117,114,110,32,116,104,101, 32,101,108,101,109,101,110,116,40,115,41,32,105,110,100,101, 120,61,40,105,44,32,106,41,44,32,119,104,101,114,101,32, 106,32,109,97,121,32,98,101,32,97,32,115,108,105,99,101, 46,10,32,32,32,32,32,32,32,32,84,104,105,115,32,97, 108,119,97,121,115,32,114,101,116,117,114,110,115,32,97,32, 99,111,112,121,32,102,111,114,32,99,111,110,115,105,115,116, 101,110,99,121,44,32,115,105,110,99,101,32,115,108,105,99, 101,115,32,105,110,116,111,10,32,32,32,32,32,32,32,32, 80,121,116,104,111,110,32,108,105,115,116,115,32,114,101,116, 117,114,110,32,99,111,112,105,101,115,46,10,32,32,32,32, 32,32,32,32,115,13,0,0,0,105,110,118,97,108,105,100, 32,105,110,100,101,120,115,116,0,0,0,73,110,100,101,120, 105,110,103,32,105,110,116,111,32,97,32,108,105,108,95,109, 97,116,114,105,120,32,119,105,116,104,32,109,117,108,116,105, 112,108,101,32,105,110,100,105,99,101,115,32,105,115,32,115, 108,111,119,46,32,80,114,101,45,99,111,110,118,101,114,116, 105,110,103,32,116,111,32,67,83,67,32,111,114,32,67,83, 82,32,98,101,102,111,114,101,104,97,110,100,32,105,115,32, 109,111,114,101,32,101,102,102,105,99,105,101,110,116,46,105, 1,0,0,0,105,0,0,0,0,78,40,15,0,0,0,116, 14,0,0,0,65,115,115,101,114,116,105,111,110,69,114,114, 111,114,82,34,0,0,0,82,65,0,0,0,82,30,0,0, 0,116,8,0,0,0,105,115,115,99,97,108,97,114,82,13, 0,0,0,82,14,0,0,0,82,67,0,0,0,82,27,0, 0,0,116,5,0,0,0,115,108,105,99,101,82,72,0,0, 0,82,24,0,0,0,82,11,0,0,0,116,9,0,0,0, 95,95,99,108,97,115,115,95,95,116,3,0,0,0,122,105, 112,40,6,0,0,0,82,37,0,0,0,116,5,0,0,0, 105,110,100,101,120,82,42,0,0,0,82,60,0,0,0,116, 2,0,0,0,106,106,116,2,0,0,0,105,105,40,0,0, 0,0,40,0,0,0,0,115,52,0,0,0,47,117,115,114, 47,108,105,98,47,112,121,116,104,111,110,50,46,55,47,100, 105,115,116,45,112,97,99,107,97,103,101,115,47,115,99,105, 112,121,47,115,112,97,114,115,101,47,108,105,108,46,112,121, 116,11,0,0,0,95,95,103,101,116,105,116,101,109,95,95, 220,0,0,0,115,52,0,0,0,0,5,3,1,16,1,19, 1,16,2,31,1,6,2,10,2,15,1,15,1,16,1,15, 1,28,1,12,1,50,1,24,1,62,1,27,1,15,1,28, 1,15,1,47,1,15,1,28,1,12,1,66,2,99,5,0, 0,0,6,0,0,0,5,0,0,0,67,96,1,0,115,105, 1,0,0,124,3,0,100,1,0,107,0,0,114,32,0,124, 3,0,124,0,0,106,0,0,100,2,0,25,55,125,3,0, 110,0,0,124,3,0,100,1,0,107,0,0,115,63,0,124, 3,0,124,0,0,106,0,0,100,2,0,25,107,5,0,114, 78,0,116,1,0,100,3,0,131,1,0,130,1,0,110,0, 0,116,2,0,106,3,0,124,4,0,131,1,0,115,108,0, 116,4,0,100,4,0,131,1,0,130,1,0,110,0,0,121, 22,0,124,0,0,106,5,0,106,6,0,124,4,0,131,1, 0,125,4,0,87,110,35,0,1,1,1,116,7,0,100,5, 0,124,4,0,124,0,0,106,5,0,106,8,0,102,2,0, 22,131,1,0,130,1,0,110,1,0,88,116,9,0,124,1, 0,124,3,0,131,2,0,125,5,0,124,4,0,100,1,0, 107,3,0,114,50,1,124,5,0,116,10,0,124,1,0,131, 1,0,107,2,0,114,242,0,124,1,0,106,11,0,124,3, 0,131,1,0,1,124,2,0,106,11,0,124,4,0,131,1, 0,1,113,101,1,124,1,0,124,5,0,25,124,3,0,107, 3,0,114,37,1,124,1,0,106,12,0,124,5,0,124,3, 0,131,2,0,1,124,2,0,106,12,0,124,5,0,124,4, 0,131,2,0,1,113,101,1,124,4,0,124,2,0,124,5, 0,60,110,51,0,124,5,0,116,10,0,124,1,0,131,1, 0,107,0,0,114,101,1,124,1,0,124,5,0,25,124,3, 0,107,2,0,114,101,1,124,1,0,124,5,0,61,124,2, 0,124,5,0,61,110,0,0,100,6,0,83,40,7,0,0, 0,115,83,0,0,0,32,104,101,108,112,101,114,32,102,111, 114,32,95,95,115,101,116,105,116,101,109,95,95,58,32,105, 110,115,101,114,116,32,97,32,118,97,108,117,101,32,105,110, 32,116,104,101,32,103,105,118,101,110,32,114,111,119,47,100, 97,116,97,32,97,116,10,32,32,32,32,32,32,32,32,99, 111,108,117,109,110,32,106,46,32,105,0,0,0,0,105,1, 0,0,0,115,26,0,0,0,99,111,108,117,109,110,32,105, 110,100,101,120,32,111,117,116,32,111,102,32,98,111,117,110, 100,115,115,40,0,0,0,115,101,116,116,105,110,103,32,97, 110,32,97,114,114,97,121,32,101,108,101,109,101,110,116,32, 119,105,116,104,32,97,32,115,101,113,117,101,110,99,101,115, 42,0,0,0,85,110,97,98,108,101,32,116,111,32,99,111, 110,118,101,114,116,32,118,97,108,117,101,32,40,37,115,41, 32,116,111,32,100,116,121,112,101,32,91,37,115,93,78,40, 13,0,0,0,82,24,0,0,0,82,65,0,0,0,82,30, 0,0,0,82,74,0,0,0,82,29,0,0,0,82,16,0, 0,0,82,66,0,0,0,82,34,0,0,0,116,4,0,0, 0,110,97,109,101,82,5,0,0,0,82,50,0,0,0,116, 6,0,0,0,97,112,112,101,110,100,116,6,0,0,0,105, 110,115,101,114,116,40,6,0,0,0,82,37,0,0,0,82, 58,0,0,0,82,26,0,0,0,82,60,0,0,0,116,1, 0,0,0,120,82,59,0,0,0,40,0,0,0,0,40,0, 0,0,0,115,52,0,0,0,47,117,115,114,47,108,105,98, 47,112,121,116,104,111,110,50,46,55,47,100,105,115,116,45, 112,97,99,107,97,103,101,115,47,115,99,105,112,121,47,115, 112,97,114,115,101,47,108,105,108,46,112,121,116,10,0,0, 0,95,105,110,115,101,114,116,97,116,50,0,1,0,0,115, 44,0,0,0,0,4,12,1,20,2,31,1,15,2,15,1, 15,2,3,1,22,1,3,1,32,2,15,1,12,1,18,1, 13,1,16,1,16,1,16,1,19,2,13,2,34,1,7,1, 99,7,0,0,0,11,0,0,0,8,0,0,0,67,96,1, 0,115,236,1,0,0,116,0,0,124,3,0,116,1,0,131, 2,0,114,43,0,124,0,0,106,2,0,124,3,0,124,0, 0,106,3,0,100,1,0,25,131,2,0,125,3,0,110,0, 0,116,4,0,124,3,0,131,1,0,114,80,1,124,6,0, 116,5,0,124,3,0,131,1,0,107,2,0,114,214,0,120, 1,1,116,6,0,124,3,0,116,7,0,124,6,0,131,1, 0,131,2,0,68,93,112,0,92,2,0,125,7,0,125,8, 0,116,8,0,124,4,0,124,8,0,131,2,0,125,9,0, 124,9,0,116,5,0,124,5,0,131,1,0,107,3,0,114, 185,0,124,4,0,124,9,0,25,124,8,0,107,2,0,114, 185,0,124,0,0,106,9,0,124,1,0,124,2,0,124,7, 0,124,5,0,124,9,0,25,131,4,0,1,113,95,0,124, 0,0,106,9,0,124,1,0,124,2,0,124,7,0,100,2, 0,131,4,0,1,113,95,0,87,113,232,1,124,6,0,100, 1,0,107,2,0,114,65,1,116,5,0,124,5,0,131,1, 0,100,2,0,107,4,0,114,17,1,124,4,0,100,2,0, 25,100,2,0,107,2,0,114,17,1,124,5,0,100,2,0, 25,125,10,0,110,6,0,100,2,0,125,10,0,120,51,0, 124,3,0,68,93,28,0,125,7,0,124,0,0,106,9,0, 124,1,0,124,2,0,124,7,0,124,10,0,131,4,0,1, 113,30,1,87,113,232,1,116,10,0,100,3,0,131,1,0, 130,1,0,110,152,0,116,11,0,106,12,0,124,3,0,131, 1,0,114,210,1,124,6,0,100,1,0,107,2,0,115,122, 1,116,13,0,100,4,0,131,1,0,130,1,0,110,0,0, 116,5,0,124,5,0,131,1,0,100,2,0,107,4,0,114, 185,1,124,4,0,100,2,0,25,100,2,0,107,2,0,114, 185,1,124,0,0,106,9,0,124,1,0,124,2,0,124,3, 0,124,5,0,100,2,0,25,131,4,0,1,113,232,1,124, 0,0,106,9,0,124,1,0,124,2,0,124,3,0,100,2, 0,131,4,0,1,110,22,0,116,13,0,100,5,0,116,14, 0,124,3,0,131,1,0,22,131,1,0,130,1,0,100,0, 0,83,40,6,0,0,0,78,105,1,0,0,0,105,0,0, 0,0,115,13,0,0,0,105,110,118,97,108,105,100,32,105, 110,100,101,120,115,44,0,0,0,97,114,114,97,121,32,100, 105,109,101,110,115,105,111,110,115,32,97,114,101,32,110,111, 116,32,99,111,109,112,97,116,105,98,108,101,32,102,111,114, 32,99,111,112,121,115,24,0,0,0,105,110,118,97,108,105, 100,32,99,111,108,117,109,110,32,118,97,108,117,101,58,32, 37,115,40,15,0,0,0,82,27,0,0,0,82,75,0,0, 0,82,72,0,0,0,82,24,0,0,0,82,11,0,0,0, 82,50,0,0,0,82,77,0,0,0,82,6,0,0,0,82, 5,0,0,0,82,86,0,0,0,82,65,0,0,0,82,30, 0,0,0,82,74,0,0,0,82,29,0,0,0,82,56,0, 0,0,40,11,0,0,0,82,37,0,0,0,82,58,0,0, 0,82,26,0,0,0,82,60,0,0,0,116,4,0,0,0, 120,114,111,119,116,5,0,0,0,120,100,97,116,97,116,5, 0,0,0,120,99,111,108,115,82,79,0,0,0,116,2,0, 0,0,120,105,82,59,0,0,0,82,57,0,0,0,40,0, 0,0,0,40,0,0,0,0,115,52,0,0,0,47,117,115, 114,47,108,105,98,47,112,121,116,104,111,110,50,46,55,47, 100,105,115,116,45,112,97,99,107,97,103,101,115,47,115,99, 105,112,121,47,115,112,97,114,115,101,47,108,105,108,46,112, 121,116,15,0,0,0,95,115,101,116,105,116,101,109,95,115, 101,116,114,111,119,33,1,0,0,115,46,0,0,0,0,1, 15,1,28,1,12,1,18,1,34,1,15,1,34,1,29,2, 29,1,12,1,34,1,13,2,6,1,13,1,29,2,15,1, 15,1,12,1,15,1,34,1,29,2,25,2,99,3,0,0, 0,13,0,0,0,13,0,0,0,67,96,1,0,115,208,2, 0,0,121,16,0,124,1,0,92,2,0,125,3,0,125,4, 0,87,110,35,0,4,116,0,0,116,1,0,102,2,0,107, 10,0,114,53,0,1,1,1,116,2,0,100,1,0,131,1, 0,130,1,0,110,1,0,88,116,3,0,106,4,0,124,2, 0,131,1,0,114,139,0,116,3,0,106,4,0,124,3,0, 131,1,0,114,139,0,116,3,0,106,4,0,124,4,0,131, 1,0,114,139,0,124,0,0,106,5,0,124,0,0,106,6, 0,124,3,0,25,124,0,0,106,7,0,124,3,0,25,124, 4,0,124,2,0,131,4,0,1,100,0,0,83,116,8,0, 124,2,0,131,1,0,114,13,1,116,9,0,124,3,0,116, 10,0,131,2,0,114,13,1,124,3,0,116,10,0,100,0, 0,131,1,0,107,2,0,114,13,1,116,9,0,124,4,0, 116,10,0,131,2,0,114,13,1,124,4,0,116,10,0,100, 0,0,131,1,0,107,2,0,114,13,1,116,12,0,124,2, 0,100,2,0,124,0,0,106,13,0,131,1,1,125,2,0, 124,2,0,106,6,0,124,0,0,95,6,0,124,2,0,106, 7,0,124,0,0,95,7,0,100,0,0,83,110,0,0,116, 9,0,124,3,0,116,14,0,131,2,0,114,43,1,116,15, 0,124,3,0,131,1,0,125,3,0,110,0,0,116,3,0, 106,4,0,124,3,0,131,1,0,114,93,1,124,0,0,106, 6,0,124,3,0,25,103,1,0,125,5,0,124,0,0,106, 7,0,124,3,0,25,103,1,0,125,6,0,110,26,0,124, 0,0,106,6,0,124,3,0,25,125,5,0,124,0,0,106, 7,0,124,3,0,25,125,6,0,116,12,0,124,2,0,100, 3,0,116,16,0,131,1,1,125,2,0,124,2,0,106,17, 0,92,2,0,125,7,0,125,8,0,124,7,0,116,18,0, 124,5,0,131,1,0,107,2,0,114,251,1,120,31,1,116, 19,0,124,5,0,124,6,0,124,2,0,106,6,0,124,2, 0,106,7,0,131,4,0,68,93,46,0,92,4,0,125,9, 0,125,10,0,125,11,0,125,12,0,124,0,0,106,20,0, 124,9,0,124,10,0,124,4,0,124,11,0,124,12,0,124, 8,0,131,6,0,1,113,198,1,87,110,209,0,124,7,0, 100,4,0,107,2,0,114,84,2,120,194,0,116,19,0,124, 5,0,124,6,0,131,2,0,68,93,54,0,92,2,0,125, 9,0,125,10,0,124,0,0,106,20,0,124,9,0,124,10, 0,124,4,0,124,2,0,106,6,0,100,5,0,25,124,2, 0,106,7,0,100,5,0,25,124,8,0,131,6,0,1,113, 23,2,87,110,120,0,124,8,0,116,18,0,124,5,0,131, 1,0,107,2,0,114,192,2,124,2,0,106,21,0,125,2, 0,120,90,0,116,19,0,124,5,0,124,6,0,124,2,0, 106,6,0,124,2,0,106,7,0,131,4,0,68,93,46,0, 92,4,0,125,9,0,125,10,0,125,11,0,125,12,0,124, 0,0,106,20,0,124,9,0,124,10,0,124,4,0,124,11, 0,124,12,0,124,7,0,131,6,0,1,113,139,2,87,110, 12,0,116,2,0,100,1,0,131,1,0,130,1,0,100,0, 0,83,40,6,0,0,0,78,115,13,0,0,0,105,110,118, 97,108,105,100,32,105,110,100,101,120,82,16,0,0,0,82, 20,0,0,0,105,1,0,0,0,105,0,0,0,0,40,22, 0,0,0,82,29,0,0,0,82,34,0,0,0,82,65,0, 0,0,82,30,0,0,0,82,74,0,0,0,82,86,0,0, 0,82,25,0,0,0,82,26,0,0,0,82,8,0,0,0, 82,27,0,0,0,82,75,0,0,0,82,22,0,0,0,82, 3,0,0,0,82,16,0,0,0,82,28,0,0,0,82,70, 0,0,0,116,5,0,0,0,70,97,108,115,101,82,24,0, 0,0,82,50,0,0,0,82,77,0,0,0,82,91,0,0, 0,116,1,0,0,0,84,40,13,0,0,0,82,37,0,0, 0,82,78,0,0,0,82,85,0,0,0,82,42,0,0,0, 82,60,0,0,0,82,25,0,0,0,116,5,0,0,0,100, 97,116,97,115,116,5,0,0,0,120,114,111,119,115,82,89, 0,0,0,82,58,0,0,0,82,26,0,0,0,82,87,0, 0,0,82,88,0,0,0,40,0,0,0,0,40,0,0,0, 0,115,52,0,0,0,47,117,115,114,47,108,105,98,47,112, 121,116,104,111,110,50,46,55,47,100,105,115,116,45,112,97, 99,107,97,103,101,115,47,115,99,105,112,121,47,115,112,97, 114,115,101,47,108,105,108,46,112,121,116,11,0,0,0,95, 95,115,101,116,105,116,101,109,95,95,63,1,0,0,115,68, 0,0,0,0,1,3,1,16,1,19,1,16,3,45,1,36, 1,4,3,12,1,33,1,33,1,21,1,12,1,12,1,7, 2,15,1,15,2,15,1,16,1,19,2,13,1,13,2,18, 1,15,1,18,1,46,1,35,1,12,1,28,1,49,4,18, 1,9,1,46,1,35,2,99,2,0,0,0,5,0,0,0, 6,0,0,0,67,96,1,0,115,110,0,0,0,124,1,0, 100,1,0,107,2,0,114,39,0,116,0,0,124,0,0,106, 1,0,100,2,0,124,0,0,106,2,0,131,1,1,125,2, 0,110,67,0,124,0,0,106,3,0,131,0,0,125,2,0, 103,0,0,124,2,0,106,4,0,68,93,35,0,125,3,0, 103,0,0,124,3,0,68,93,16,0,125,4,0,124,4,0, 124,1,0,20,94,2,0,113,74,0,94,2,0,113,61,0, 124,2,0,106,4,0,40,124,2,0,83,40,3,0,0,0, 78,105,0,0,0,0,82,16,0,0,0,40,5,0,0,0, 82,3,0,0,0,82,24,0,0,0,82,16,0,0,0,82, 20,0,0,0,82,26,0,0,0,40,5,0,0,0,82,37, 0,0,0,82,43,0,0,0,82,62,0,0,0,82,51,0, 0,0,82,57,0,0,0,40,0,0,0,0,40,0,0,0, 0,115,52,0,0,0,47,117,115,114,47,108,105,98,47,112, 121,116,104,111,110,50,46,55,47,100,105,115,116,45,112,97, 99,107,97,103,101,115,47,115,99,105,112,121,47,115,112,97, 114,115,101,47,108,105,108,46,112,121,116,11,0,0,0,95, 109,117,108,95,115,99,97,108,97,114,111,1,0,0,115,12, 0,0,0,0,1,12,2,27,2,12,2,3,1,52,1,99, 2,0,0,0,5,0,0,0,6,0,0,0,67,96,1,0, 115,100,0,0,0,116,0,0,124,1,0,131,1,0,114,82, 0,124,0,0,106,1,0,131,0,0,125,2,0,103,0,0, 124,2,0,106,2,0,68,93,35,0,125,3,0,103,0,0, 124,3,0,68,93,16,0,125,4,0,124,4,0,124,1,0, 27,94,2,0,113,47,0,94,2,0,113,34,0,124,2,0, 95,2,0,124,2,0,83,124,0,0,106,3,0,131,0,0, 124,1,0,27,83,100,0,0,83,40,1,0,0,0,78,40, 4,0,0,0,82,12,0,0,0,82,20,0,0,0,82,26, 0,0,0,116,5,0,0,0,116,111,99,115,114,40,5,0, 0,0,82,37,0,0,0,82,43,0,0,0,82,62,0,0, 0,82,51,0,0,0,82,57,0,0,0,40,0,0,0,0, 40,0,0,0,0,115,52,0,0,0,47,117,115,114,47,108, 105,98,47,112,121,116,104,111,110,50,46,55,47,100,105,115, 116,45,112,97,99,107,97,103,101,115,47,115,99,105,112,121, 47,115,112,97,114,115,101,47,108,105,108,46,112,121,116,11, 0,0,0,95,95,116,114,117,101,100,105,118,95,95,122,1, 0,0,115,12,0,0,0,0,1,12,1,12,2,3,1,51, 1,4,2,99,1,0,0,0,3,0,0,0,4,0,0,0, 67,96,1,0,115,80,0,0,0,100,1,0,100,2,0,108, 0,0,109,1,0,125,1,0,1,116,2,0,124,0,0,106, 3,0,100,3,0,124,0,0,106,4,0,131,1,1,125,2, 0,124,1,0,124,0,0,106,5,0,131,1,0,124,2,0, 95,5,0,124,1,0,124,0,0,106,6,0,131,1,0,124, 2,0,95,6,0,124,2,0,83,40,4,0,0,0,78,105, 0,0,0,0,40,1,0,0,0,116,8,0,0,0,100,101, 101,112,99,111,112,121,82,16,0,0,0,40,7,0,0,0, 82,20,0,0,0,82,100,0,0,0,82,3,0,0,0,82, 24,0,0,0,82,16,0,0,0,82,26,0,0,0,82,25, 0,0,0,40,3,0,0,0,82,37,0,0,0,82,100,0, 0,0,82,62,0,0,0,40,0,0,0,0,40,0,0,0, 0,115,52,0,0,0,47,117,115,114,47,108,105,98,47,112, 121,116,104,111,110,50,46,55,47,100,105,115,116,45,112,97, 99,107,97,103,101,115,47,115,99,105,112,121,47,115,112,97, 114,115,101,47,108,105,108,46,112,121,82,20,0,0,0,165, 1,0,0,115,10,0,0,0,0,1,16,1,24,1,18,1, 18,1,99,2,0,0,0,10,0,0,0,6,0,0,0,67, 96,1,0,115,157,0,0,0,116,0,0,124,1,0,100,1, 0,124,0,0,106,1,0,131,1,1,125,2,0,124,0,0, 106,2,0,100,2,0,25,125,3,0,120,116,0,116,3,0, 124,0,0,106,4,0,131,1,0,68,93,99,0,92,2,0, 125,4,0,125,5,0,120,84,0,116,3,0,124,5,0,131, 1,0,68,93,70,0,92,2,0,125,6,0,125,7,0,116, 5,0,106,6,0,124,4,0,124,3,0,20,124,7,0,23, 124,1,0,131,2,0,92,2,0,125,8,0,125,9,0,124, 0,0,124,4,0,124,7,0,102,2,0,25,124,2,0,124, 8,0,124,9,0,102,2,0,60,113,75,0,87,113,50,0, 87,124,2,0,83,40,3,0,0,0,78,82,16,0,0,0, 105,1,0,0,0,40,7,0,0,0,82,3,0,0,0,82, 16,0,0,0,82,24,0,0,0,82,55,0,0,0,82,25, 0,0,0,82,30,0,0,0,116,13,0,0,0,117,110,114, 97,118,101,108,95,105,110,100,101,120,40,10,0,0,0,82, 37,0,0,0,82,24,0,0,0,82,62,0,0,0,116,5, 0,0,0,106,95,109,97,120,82,42,0,0,0,82,58,0, 0,0,116,3,0,0,0,99,111,108,82,60,0,0,0,116, 5,0,0,0,110,101,119,95,114,116,5,0,0,0,110,101, 119,95,99,40,0,0,0,0,40,0,0,0,0,115,52,0, 0,0,47,117,115,114,47,108,105,98,47,112,121,116,104,111, 110,50,46,55,47,100,105,115,116,45,112,97,99,107,97,103, 101,115,47,115,99,105,112,121,47,115,112,97,114,115,101,47, 108,105,108,46,112,121,116,7,0,0,0,114,101,115,104,97, 112,101,172,1,0,0,115,14,0,0,0,0,1,21,1,13, 1,28,1,25,1,32,1,34,1,99,3,0,0,0,8,0, 0,0,6,0,0,0,67,96,1,0,115,110,0,0,0,124, 0,0,106,0,0,124,1,0,124,2,0,131,2,0,125,3, 0,120,85,0,116,1,0,124,0,0,106,2,0,131,1,0, 68,93,68,0,92,2,0,125,4,0,125,5,0,120,53,0, 116,1,0,124,5,0,131,1,0,68,93,39,0,92,2,0, 125,6,0,125,7,0,124,0,0,106,3,0,124,4,0,25, 124,6,0,25,124,3,0,124,4,0,124,7,0,102,2,0, 60,113,59,0,87,113,34,0,87,124,3,0,83,40,1,0, 0,0,115,41,0,0,0,83,101,101,32,116,104,101,32,100, 111,99,115,116,114,105,110,103,32,102,111,114,32,96,115,112, 109,97,116,114,105,120,46,116,111,97,114,114,97,121,96,46, 40,4,0,0,0,116,21,0,0,0,95,112,114,111,99,101, 115,115,95,116,111,97,114,114,97,121,95,97,114,103,115,82, 55,0,0,0,82,25,0,0,0,82,26,0,0,0,40,8, 0,0,0,82,37,0,0,0,116,5,0,0,0,111,114,100, 101,114,116,3,0,0,0,111,117,116,116,1,0,0,0,100, 82,42,0,0,0,82,58,0,0,0,82,59,0,0,0,82, 60,0,0,0,40,0,0,0,0,40,0,0,0,0,115,52, 0,0,0,47,117,115,114,47,108,105,98,47,112,121,116,104, 111,110,50,46,55,47,100,105,115,116,45,112,97,99,107,97, 103,101,115,47,115,99,105,112,121,47,115,112,97,114,115,101, 47,108,105,108,46,112,121,116,7,0,0,0,116,111,97,114, 114,97,121,181,1,0,0,115,10,0,0,0,0,2,18,1, 28,1,25,1,35,1,99,1,0,0,0,1,0,0,0,1, 0,0,0,67,96,1,0,115,22,0,0,0,124,0,0,106, 0,0,131,0,0,106,1,0,131,0,0,106,2,0,131,0, 0,83,40,1,0,0,0,78,40,3,0,0,0,82,98,0, 0,0,116,9,0,0,0,116,114,97,110,115,112,111,115,101, 82,21,0,0,0,40,1,0,0,0,82,37,0,0,0,40, 0,0,0,0,40,0,0,0,0,115,52,0,0,0,47,117, 115,114,47,108,105,98,47,112,121,116,104,111,110,50,46,55, 47,100,105,115,116,45,112,97,99,107,97,103,101,115,47,115, 99,105,112,121,47,115,112,97,114,115,101,47,108,105,108,46, 112,121,82,112,0,0,0,189,1,0,0,115,2,0,0,0, 0,1,99,2,0,0,0,2,0,0,0,1,0,0,0,67, 96,1,0,115,24,0,0,0,124,1,0,114,16,0,124,0, 0,106,0,0,131,0,0,83,124,0,0,83,100,0,0,83, 40,1,0,0,0,78,40,1,0,0,0,82,20,0,0,0, 40,2,0,0,0,82,37,0,0,0,82,20,0,0,0,40, 0,0,0,0,40,0,0,0,0,115,52,0,0,0,47,117, 115,114,47,108,105,98,47,112,121,116,104,111,110,50,46,55, 47,100,105,115,116,45,112,97,99,107,97,103,101,115,47,115, 99,105,112,121,47,115,112,97,114,115,101,47,108,105,108,46, 112,121,82,21,0,0,0,192,1,0,0,115,6,0,0,0, 0,1,6,1,10,2,99,1,0,0,0,7,0,0,0,5, 0,0,0,67,96,1,0,115,27,1,0,0,116,0,0,106, 1,0,103,0,0,124,0,0,106,2,0,68,93,18,0,125, 1,0,116,3,0,124,1,0,131,1,0,94,2,0,113,16, 0,100,1,0,116,0,0,106,4,0,131,1,1,125,2,0, 116,0,0,106,5,0,116,0,0,106,6,0,100,2,0,103, 1,0,100,1,0,116,0,0,106,4,0,131,1,1,116,0, 0,106,7,0,124,2,0,131,1,0,102,2,0,131,1,0, 125,2,0,124,2,0,100,3,0,25,125,3,0,103,0,0, 125,4,0,120,30,0,124,0,0,106,2,0,68,93,19,0, 125,1,0,124,4,0,106,8,0,124,1,0,131,1,0,1, 113,129,0,87,116,0,0,106,1,0,124,4,0,100,1,0, 116,0,0,106,4,0,131,1,1,125,4,0,103,0,0,125, 5,0,120,30,0,124,0,0,106,9,0,68,93,19,0,125, 1,0,124,5,0,106,8,0,124,1,0,131,1,0,1,113, 192,0,87,116,0,0,106,1,0,124,5,0,100,1,0,124, 0,0,106,10,0,131,1,1,125,5,0,100,4,0,100,5, 0,108,11,0,109,12,0,125,6,0,1,124,6,0,124,5, 0,124,4,0,124,2,0,102,3,0,100,6,0,124,0,0, 106,13,0,131,1,1,83,40,7,0,0,0,115,69,0,0, 0,32,82,101,116,117,114,110,32,67,111,109,112,114,101,115, 115,101,100,32,83,112,97,114,115,101,32,82,111,119,32,102, 111,114,109,97,116,32,97,114,114,97,121,115,32,102,111,114, 32,116,104,105,115,32,109,97,116,114,105,120,46,10,32,32, 32,32,32,32,32,32,82,16,0,0,0,105,0,0,0,0, 105,255,255,255,255,105,1,0,0,0,40,1,0,0,0,82, 17,0,0,0,82,24,0,0,0,40,14,0,0,0,82,30, 0,0,0,116,7,0,0,0,97,115,97,114,114,97,121,82, 25,0,0,0,82,50,0,0,0,116,4,0,0,0,105,110, 116,99,116,11,0,0,0,99,111,110,99,97,116,101,110,97, 116,101,116,5,0,0,0,97,114,114,97,121,116,6,0,0, 0,99,117,109,115,117,109,116,6,0,0,0,101,120,116,101, 110,100,82,26,0,0,0,82,16,0,0,0,82,36,0,0, 0,82,17,0,0,0,82,24,0,0,0,40,7,0,0,0, 82,37,0,0,0,82,85,0,0,0,116,6,0,0,0,105, 110,100,112,116,114,116,3,0,0,0,110,110,122,116,7,0, 0,0,105,110,100,105,99,101,115,82,26,0,0,0,82,17, 0,0,0,40,0,0,0,0,40,0,0,0,0,115,52,0, 0,0,47,117,115,114,47,108,105,98,47,112,121,116,104,111, 110,50,46,55,47,100,105,115,116,45,112,97,99,107,97,103, 101,115,47,115,99,105,112,121,47,115,112,97,114,115,101,47, 108,105,108,46,112,121,82,98,0,0,0,198,1,0,0,115, 26,0,0,0,0,4,52,1,51,2,10,2,6,1,16,1, 17,1,24,2,6,1,16,1,17,1,24,2,16,1,99,1, 0,0,0,1,0,0,0,1,0,0,0,67,96,1,0,115, 16,0,0,0,124,0,0,106,0,0,131,0,0,106,1,0, 131,0,0,83,40,1,0,0,0,115,72,0,0,0,32,82, 101,116,117,114,110,32,67,111,109,112,114,101,115,115,101,100, 32,83,112,97,114,115,101,32,67,111,108,117,109,110,32,102, 111,114,109,97,116,32,97,114,114,97,121,115,32,102,111,114, 32,116,104,105,115,32,109,97,116,114,105,120,46,10,32,32, 32,32,32,32,32,32,40,2,0,0,0,82,98,0,0,0, 116,5,0,0,0,116,111,99,115,99,40,1,0,0,0,82, 37,0,0,0,40,0,0,0,0,40,0,0,0,0,115,52, 0,0,0,47,117,115,114,47,108,105,98,47,112,121,116,104, 111,110,50,46,55,47,100,105,115,116,45,112,97,99,107,97, 103,101,115,47,115,99,105,112,121,47,115,112,97,114,115,101, 47,108,105,108,46,112,121,82,122,0,0,0,220,1,0,0, 115,2,0,0,0,0,3,78,40,31,0,0,0,116,8,0, 0,0,95,95,110,97,109,101,95,95,116,10,0,0,0,95, 95,109,111,100,117,108,101,95,95,116,7,0,0,0,95,95, 100,111,99,95,95,82,22,0,0,0,82,92,0,0,0,82, 18,0,0,0,82,44,0,0,0,82,45,0,0,0,82,47, 0,0,0,82,48,0,0,0,82,52,0,0,0,116,8,0, 0,0,112,114,111,112,101,114,116,121,82,120,0,0,0,82, 61,0,0,0,82,63,0,0,0,82,64,0,0,0,82,67, 0,0,0,82,72,0,0,0,82,81,0,0,0,82,86,0, 0,0,82,91,0,0,0,82,96,0,0,0,82,97,0,0, 0,82,99,0,0,0,82,20,0,0,0,82,106,0,0,0, 82,111,0,0,0,82,112,0,0,0,82,21,0,0,0,82, 98,0,0,0,82,122,0,0,0,40,0,0,0,0,40,0, 0,0,0,40,0,0,0,0,115,52,0,0,0,47,117,115, 114,47,108,105,98,47,112,121,116,104,111,110,50,46,55,47, 100,105,115,116,45,112,97,99,107,97,103,101,115,47,115,99, 105,112,121,47,115,112,97,114,115,101,47,108,105,108,46,112, 121,82,3,0,0,0,22,0,0,0,115,52,0,0,0,6, 60,6,2,18,46,9,4,9,4,9,7,9,10,9,2,15, 2,9,7,9,8,9,8,9,21,9,17,9,36,9,33,9, 30,9,48,9,11,9,43,9,7,9,9,15,8,9,3,12, 6,9,22,99,1,0,0,0,1,0,0,0,3,0,0,0, 67,96,1,0,115,13,0,0,0,116,0,0,124,0,0,116, 1,0,131,2,0,83,40,1,0,0,0,78,40,2,0,0, 0,82,27,0,0,0,82,3,0,0,0,40,1,0,0,0, 82,85,0,0,0,40,0,0,0,0,40,0,0,0,0,115, 52,0,0,0,47,117,115,114,47,108,105,98,47,112,121,116, 104,111,110,50,46,55,47,100,105,115,116,45,112,97,99,107, 97,103,101,115,47,115,99,105,112,121,47,115,112,97,114,115, 101,47,108,105,108,46,112,121,82,4,0,0,0,226,1,0, 0,115,2,0,0,0,0,1,40,26,0,0,0,82,125,0, 0,0,116,10,0,0,0,95,95,102,117,116,117,114,101,95, 95,82,0,0,0,0,82,1,0,0,0,82,2,0,0,0, 116,13,0,0,0,95,95,100,111,99,102,111,114,109,97,116, 95,95,116,7,0,0,0,95,95,97,108,108,95,95,116,6, 0,0,0,98,105,115,101,99,116,82,5,0,0,0,116,5, 0,0,0,110,117,109,112,121,82,30,0,0,0,116,19,0, 0,0,115,99,105,112,121,46,108,105,98,46,115,105,120,46, 109,111,118,101,115,82,6,0,0,0,116,4,0,0,0,98, 97,115,101,82,7,0,0,0,82,8,0,0,0,116,7,0, 0,0,115,112,117,116,105,108,115,82,9,0,0,0,82,10, 0,0,0,82,11,0,0,0,82,12,0,0,0,116,8,0, 0,0,119,97,114,110,105,110,103,115,82,13,0,0,0,82, 14,0,0,0,82,3,0,0,0,82,4,0,0,0,40,0, 0,0,0,40,0,0,0,0,40,0,0,0,0,115,52,0, 0,0,47,117,115,114,47,108,105,98,47,112,121,116,104,111, 110,50,46,55,47,100,105,115,116,45,112,97,99,107,97,103, 101,115,47,115,99,105,112,121,47,115,112,97,114,115,101,47, 108,105,108,46,112,121,116,8,0,0,0,60,109,111,100,117, 108,101,62,2,0,0,0,115,26,0,0,0,6,2,28,2, 6,2,12,2,16,2,12,1,16,2,22,1,34,2,16,1, 16,3,22,255,0,205, };
323ae54cbd55ed5cf4ef48960684d8fc08d1f03b
1c48378b207e4d5b41afd2f29a5db7c8276180fc
/C-Programming/Day 3/A3Q4.c
65cfec6e6a951267e679a6ea82107b26f4413ee9
[]
no_license
Newcomer03/Basic-Programs
b3e365516ae516c6d53fb9b317def00b77dc741e
1fdf6190b35403ea754ca8ccec3813c926b1e289
refs/heads/main
2023-06-18T12:30:08.470642
2021-07-11T14:06:14
2021-07-11T14:06:14
384,951,875
0
0
null
null
null
null
UTF-8
C
false
false
448
c
A3Q4.c
#include<stdio.h> main() { int f1 = 0; int f2 = 1; int f3,res; int n,x; printf("Enter the nth term of the fibonacci\n"); scanf("%d",&n); x=2; if(n>=0) printf("%d,",f1); if(n>=1) printf("%d,",f2); //doing all the main work here while(x<n) { f3 = f2; res = f2 + f1; f2 = res; f1 = f3; if(x<(n-1)) { printf("%d,",res); } else { printf("%d....",res); } x++; } }
eff518baaaf288095cb4c5c1fc6a7b8f722584fc
5150ed0a238533eb2edd41f2ecc94c7f8fdbf2bf
/test/bad.c
f2dde231ecba2581dbf604da94085baa64c74994
[]
no_license
adhoc-dtn/ImageTransmissionOverWSN
8a8288cbaaddd9c541ba9cc0fe76366e0785e371
2abc6f6ced906fb202daa900f0ee220a07a762db
refs/heads/master
2021-01-19T06:35:32.114793
2015-02-12T13:04:25
2015-02-12T13:04:25
16,933,152
0
0
null
null
null
null
UTF-8
C
false
false
1,210
c
bad.c
#include <signal.h> #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include <stdlib.h> unsigned char critical[100]; void sigfunc(int signum) { int i; for ( i=0 ; i < sizeof(critical)/sizeof(critical[0]); ++i ) { printf("%02X ", critical[i]); } printf("\n\n\n"); } int main(int argc, char** arvg) { int i; struct sigaction sigact; struct stat st; memset(&sigact, 0, sizeof(sigact)); sigact.sa_handler = sigfunc; sigemptyset(&sigact.sa_mask); sigaddset(&sigact.sa_mask, SIGINT); sigact.sa_flags = 0; sigact.sa_restorer = NULL; if ( 0 != sigaction(SIGINT, &sigact, NULL) ) { fprintf(stderr, "error\n"); exit(1); } for(;;) { if ( stat("aaa", &st)==0 ) exit(0); for ( i=0 ; i < sizeof(critical)/sizeof(critical[0]); ++i ) { critical[i] = 0; } for ( i=0 ; i < sizeof(critical)/sizeof(critical[0]); ++i ) { critical[i] = 0xff; } } return 0; }
8c82d0532f0ea430a70f28366706b66063ec1c60
c5d87694da98620cdab215bface95a75980e89a7
/lista_escola.c
ba65eeb113f838a5be259da5175c89f9549232ff
[]
no_license
EliasRLima/Lista_Escola
e8d3ba82f1983de177c47abcd695a4d22e3f133a
14813bb8ef76ee94fec154adc17d49aa3cfd605b
refs/heads/master
2023-02-25T01:11:50.344382
2021-01-23T14:30:33
2021-01-23T14:30:33
332,229,896
1
0
null
null
null
null
UTF-8
C
false
false
8,843
c
lista_escola.c
#include <stdio.h> #include <stdlib.h> #include <string.h> int listar_aluno(Aluno a){ printf("\nNome: %s\nSerie: %d\nCodigo %d\n",a.nome_aluno, a.serie, a.cod_aluno); return 1; } Aluno getAluno(int cod) { Aluno a; a.cod_aluno = 0; FILE *arq2; arq2 = fopen("alunos.txt","r"); if (!arq2){ printf("Falha ao abrir arquivo aluno.\n"); fclose(arq2); return a; } int i; char txt[100]; while(fgets(txt, 100, arq2) != (char*)EOF){ if(feof(arq2)){ break; } char *token = strtok(txt," "); a.cod_aluno = (int)atof(token); token = strtok(NULL, " "); a.serie = (int)atof(token); //printf("indo pegar nome!\n"); token = strtok(NULL, "@"); //printf("pegou por @\n"); strcpy(a.nome_aluno, token); if(cod==a.cod_aluno) { //listar_aluno(a); fclose(arq2); return a; } }fclose(arq2); Aluno b; b.cod_aluno = 0; return b; } Disciplina getDisciplina(int cod_disciplina) { Disciplina b; FILE *arq3; //printf("indo buscar a %d!\n",cod_disciplina); arq3 = fopen("disciplinas.txt","r"); if (!arq3){ printf("Falha ao abrir arquivo disciplinas.\n"); fclose(arq3); return b; } int i; char txt[100]; while(fgets(txt, 100, arq3) != (char*)EOF){ if(feof(arq3)){ break; } char *token = strtok(txt," "); b.cod_disciplina = (int)atof(token); token = strtok(NULL, " "); strcpy(b.nome_disciplina, token); //printf("verificar se %d = %d!\n",cod_disciplina, b.cod_disciplina); if(cod_disciplina==b.cod_disciplina) { fclose(arq3); return b; } }fclose(arq3); Disciplina c; return c; } int carregar_lista(tipo_lista *lista){ FILE *arq; arq = fopen("notas.txt","r"); elemento p; int cod_aluno; int cod_disciplina; if (!arq){ printf("Falha ao abrir arquivo notas.\n"); return 0; } int i; //printf("inicializa\n"); inicializa_lista(lista); //reiniciar a lista char txt[100]; char *token; const char s[2] = " "; while(fgets(txt, 100, arq) != (char*)EOF){ if(feof(arq)){ break; } char a[3]; a[0] = txt[0]; a[1] = txt[1]; a[2] = txt[2]; cod_aluno = (int)atof(a); p.aluno=getAluno(cod_aluno); a[0] = txt[4]; a[1] = '\0'; cod_disciplina = (int)atof(a); //printf("Pegando disciplina %d!\n",cod_disciplina); p.disciplina=getDisciplina(cod_disciplina); //printf("pegou d\n"); //token = strtok(NULL, s); a[0] = txt[6]; a[1] = txt[7]; a[2] = txt[8]; p.nota1=(float)atof(a); //token = strtok(NULL, s); a[0] = txt[10]; a[1] = txt[11]; a[2] = txt[12]; p.nota2= (float)atof(a); //token = strtok(NULL, s); a[0] = txt[14]; a[1] = txt[15]; a[2] = txt[16]; p.nota3= (float)atof(a); //token = strtok(NULL, s); a[0] = txt[18]; a[1] = txt[19]; a[2] = txt[20]; p.nota_recuperacao=(int)atof(a); incluir_elemento(lista,tamanho_quantidade_nodos(*lista)+1,p); }; fclose(arq); return 1; } char getConceito(float n1,float n2,float n3,float rec) { float media=0; float media2=0; media=(n1+n2+n3)/3; media2=(n1+n2+n3+rec)/3; char rt; if(media>=7) { rt = 'A'; } else { if(media2>=6) { rt = 'A'; } else { rt = 'R'; } } return rt; } int listar(tipo_lista l){ if(l.tamanho == 0){ printf("Lista vazia!\n"); return 1; } int i; elemento e; for(i=1;i<=l.tamanho;i++){ int j = obter_elemento(l, i, &e); if(j){ //printf("%d\t%d\t%s\t%d\t%d\t%.2f\t%.2f\t%.2f\t%.2f\t%c\t%s\n",e.aluno.cod_aluno, e.aluno.serie, e.disciplina.nome_disciplina, e.disciplina.cod_disciplina,e.nota1,e.nota2,e.nota3,e.nota_recuperacao,getConceito(e.nota1, e.nota2, e.nota3, e.nota_recuperacao),e.aluno.nome_aluno); printf("\n\nAluno:\nCodigo\tSerie\tNome\n"); printf("%d\t",e.aluno.cod_aluno); printf("%d\t",e.aluno.serie); printf("%s",e.aluno.nome_aluno); printf("Disciplina:\nCodigo\tNome\n"); printf("%d\t",e.disciplina.cod_disciplina); printf("%s",e.disciplina.nome_disciplina); printf("Notas:\nN1\tN2\tN3\tNR\tSituacao\n"); printf("%.2f\t",e.nota1); printf("%.2f\t",e.nota2); printf("%.2f\t",e.nota3); printf("%.2f\t",e.nota_recuperacao); printf("%c\n",getConceito(e.nota1,e.nota2,e.nota3, e.nota_recuperacao)); } } return 1; } int max_serie(){ int max = 0; Aluno a; FILE *arq2; arq2 = fopen("alunos.txt","r"); if (!arq2){ printf("Falha ao abrir arquivo aluno para buscar series.\n"); fclose(arq2); return 0; } int i; char txt[100]; while(fgets(txt, 100, arq2) != (char*)EOF){ if(feof(arq2)){ break; } char *token = strtok(txt," "); a.cod_aluno = (int)atof(token); token = strtok(NULL, " "); a.serie = (int)atof(token); token = strtok(NULL, "@"); strcpy(a.nome_aluno, token); if(a.serie > max) { max = a.serie; } }fclose(arq2); return max; } int listar_serie(tipo_lista l,int disc){ Disciplina d = getDisciplina(disc); if(d.cod_disciplina == 0){ printf("Nao foi localizada disciplina com o codigo %d!\n",disc); return; } int i, k;elemento e; for(i=1;i<=max_serie();i++){ printf("Serie %d: \n",i); for(k=0;k<=tamanho_quantidade_nodos(l);k++){ int j = obter_elemento(l, k, &e); if(j){ if(e.disciplina.cod_disciplina == disc && e.aluno.serie == i){ printf("%s%.2f\t%.2f\t%.2f\t%.2f\t%c\n",e.aluno.nome_aluno, e.nota1, e.nota2, e.nota3, e.nota_recuperacao, getConceito(e.nota1,e.nota2,e.nota3, e.nota_recuperacao)); } } } } } int max_Disciplina() { int max = 0; Disciplina b; FILE *arq3; arq3 = fopen("disciplinas.txt","r"); if (!arq3){ printf("Falha ao abrir arquivo disciplinas para verificar tamanho.\n"); fclose(arq3); return 0; } int i; char txt[100]; while(fgets(txt, 100, arq3) != (char*)EOF){ if(feof(arq3)){ break; } char *token = strtok(txt," "); b.cod_disciplina = (int)atof(token); token = strtok(NULL, " "); strcpy(b.nome_disciplina, token); if(max < b.cod_disciplina) { max = b.cod_disciplina; } } fclose(arq3); return max; } int gravarAluno(Aluno a){ FILE *arq2; arq2 = fopen("alunos.txt","a"); if (!arq2){ printf("Falha ao abrir arquivo aluno para salvar novo registro.\n"); fclose(arq2); return 0; } fprintf(arq2,"%d %d %s\n",a.cod_aluno, a.serie, a.nome_aluno); fclose(arq2); return 1; } int gravarNota(elemento e){ FILE *arq; arq = fopen("notas.txt","a"); if (!arq){ printf("Falha ao abrir arquivo notas para salvar novo registro.\n"); return 0; } fprintf(arq, "%d %d %.1f %.1f %.1f %.1f\n",e.aluno.cod_aluno, e.disciplina.cod_disciplina, e.nota1, e.nota2, e.nota3, e.nota_recuperacao); fclose(arq); } int cadAluno(){ elemento e; Aluno a,b; b.cod_aluno = 1; while(b.cod_aluno != 0){ printf("\nQual o codigo do aluno? "); fflush(stdin); scanf("%d", &a.cod_aluno); b = getAluno(a.cod_aluno); if(b.cod_aluno != 0){ printf("codigo ja cadastrado!\n"); } } printf("\nQual o nome do aluno? "); fflush(stdin); gets(a.nome_aluno); printf("\nQual a serie do aluno? "); fflush(stdin); scanf("%d", &a.serie); e.aluno = a; int m = gravarAluno(a); if(m == 0){ return 0; } int i; for(i=1;i<=max_Disciplina();i++){ Disciplina b = getDisciplina(i); printf("Diga se o aluno faz %s1 - sim\n2 - nao\nEscolha: ",b.nome_disciplina); int boo; scanf("%d",&boo); if(boo == 1){ e.disciplina = b; printf("Digite a nota1: "); scanf("%f",&e.nota1); printf("Digite a nota2: "); scanf("%f",&e.nota2); printf("Digite a nota3: "); scanf("%f",&e.nota3); printf("Digite a nota de recuperacao: "); scanf("%f",&e.nota_recuperacao); gravarNota(e); } } return 0; }
1984cecf6b1eafc53969f8f222d1221285feeeaa
4e0639b83e9f5fb2ff10fcd96383f41f46e94964
/easy/compare_points.c
651232e64f052d1b7fc7aaaf866769a92659dfa4
[ "BSD-3-Clause" ]
permissive
oorja/ce-challenges
e85a507d6481de507b2bd2180cd9d7f9c1d7ee28
a7fab871c5794d14c091192eed3d6057abeebc08
refs/heads/master
2021-01-18T13:41:46.083385
2015-09-22T20:02:43
2015-09-22T20:02:43
null
0
0
null
null
null
null
UTF-8
C
false
false
399
c
compare_points.c
#include <stdio.h> int main(int argc, char *argv[]) { FILE *fp; int x1, y1, x2, y2; fp = fopen(*++argv, "r"); while (fscanf(fp, "%d %d %d %d", &x1, &y1, &x2, &y2) != EOF) { puts((x1 == x2) ? ((y1 == y2) ? "here" : (y1 < y2) ? "N" : "S") : (y1 == y2) ? ((x1 < x2) ? "E" : "W") : ((x1 < x2) ? ((y1 < y2) ? "NE" : "SE") : ((y1 < y2) ? "NW" : "SW"))); } return 0; }
d4119a4e77d4de4fb5e8db073b2ca6fb33881136
e48ea9e6c1a634d574f06ceb2f618cb75d338c88
/asn1/v2x_gb2020_day2_dll/asn/ParkingLotInfo.c
c2bee3010f31e4c72a3fe6334a0aa427885a8ece
[]
no_license
jhc80/StringToolsV2-v2x_tci_dll
b9b29f6b3644f881227803c3dec9ca0a74364892
947e1ca8c1a374a18ec9285a2037880601a07366
refs/heads/master
2023-06-30T20:15:05.538953
2021-08-05T00:58:15
2021-08-05T00:58:15
null
0
0
null
null
null
null
UTF-8
C
false
false
5,698
c
ParkingLotInfo.c
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "PAM" * found in "asn/PAM.asn" * `asn1c -fcompound-names -fnative-types -Werror -gen-PER -pdu=all` */ #include "ParkingLotInfo.h" static int memb_id_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 0 && value <= 65535)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_number_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 0 && value <= 65535)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_buildingLayerNum_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 0 && value <= 256)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static asn_oer_constraints_t asn_OER_memb_id_constr_2 CC_NOTUSED = { { 2, 1 } /* (0..65535) */, -1}; static asn_per_constraints_t asn_PER_memb_id_constr_2 CC_NOTUSED = { { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_oer_constraints_t asn_OER_memb_number_constr_4 CC_NOTUSED = { { 2, 1 } /* (0..65535) */, -1}; static asn_per_constraints_t asn_PER_memb_number_constr_4 CC_NOTUSED = { { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_oer_constraints_t asn_OER_memb_buildingLayerNum_constr_5 CC_NOTUSED = { { 2, 1 } /* (0..256) */, -1}; static asn_per_constraints_t asn_PER_memb_buildingLayerNum_constr_5 CC_NOTUSED = { { APC_CONSTRAINED, 9, 9, 0, 256 } /* (0..256) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; asn_TYPE_member_t asn_MBR_ParkingLotInfo_1[] = { { ATF_POINTER, 5, offsetof(struct ParkingLotInfo, id), (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_NativeInteger, 0, { &asn_OER_memb_id_constr_2, &asn_PER_memb_id_constr_2, memb_id_constraint_1 }, 0, 0, /* No default value */ "id" }, { ATF_POINTER, 4, offsetof(struct ParkingLotInfo, name), (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_DescriptiveName, 0, { 0, 0, 0 }, 0, 0, /* No default value */ "name" }, { ATF_POINTER, 3, offsetof(struct ParkingLotInfo, number), (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_NativeInteger, 0, { &asn_OER_memb_number_constr_4, &asn_PER_memb_number_constr_4, memb_number_constraint_1 }, 0, 0, /* No default value */ "number" }, { ATF_POINTER, 2, offsetof(struct ParkingLotInfo, buildingLayerNum), (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_NativeInteger, 0, { &asn_OER_memb_buildingLayerNum_constr_5, &asn_PER_memb_buildingLayerNum_constr_5, memb_buildingLayerNum_constraint_1 }, 0, 0, /* No default value */ "buildingLayerNum" }, { ATF_POINTER, 1, offsetof(struct ParkingLotInfo, avpType), (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_AVPType, 0, { 0, 0, 0 }, 0, 0, /* No default value */ "avpType" }, }; static const int asn_MAP_ParkingLotInfo_oms_1[] = { 0, 1, 2, 3, 4 }; static const ber_tlv_tag_t asn_DEF_ParkingLotInfo_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_ParkingLotInfo_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* id */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* name */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* number */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* buildingLayerNum */ { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* avpType */ }; asn_SEQUENCE_specifics_t asn_SPC_ParkingLotInfo_specs_1 = { sizeof(struct ParkingLotInfo), offsetof(struct ParkingLotInfo, _asn_ctx), asn_MAP_ParkingLotInfo_tag2el_1, 5, /* Count of tags in the map */ asn_MAP_ParkingLotInfo_oms_1, /* Optional members */ 5, 0, /* Root/Additions */ 5, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_ParkingLotInfo = { "ParkingLotInfo", "ParkingLotInfo", &asn_OP_SEQUENCE, asn_DEF_ParkingLotInfo_tags_1, sizeof(asn_DEF_ParkingLotInfo_tags_1) /sizeof(asn_DEF_ParkingLotInfo_tags_1[0]), /* 1 */ asn_DEF_ParkingLotInfo_tags_1, /* Same as above */ sizeof(asn_DEF_ParkingLotInfo_tags_1) /sizeof(asn_DEF_ParkingLotInfo_tags_1[0]), /* 1 */ { 0, 0, SEQUENCE_constraint }, asn_MBR_ParkingLotInfo_1, 5, /* Elements count */ &asn_SPC_ParkingLotInfo_specs_1 /* Additional specs */ };
b73d4aeed0982913e550caaf0774e01eb3166979
2271038dc60f40742940615b64973ce44db33073
/Pods/Headers/Private/JingGe_Common/UIButton+JingGeButton.h
43daaf48d3679ac27cc87df38623f3da21d7fbf9
[]
no_license
feifeizhai/FFZEpubReader
a92142544d4adae901d60537909703388bf164c7
f1148b9eb2fff467e3b9dba3a738aab2d788e597
refs/heads/master
2021-07-10T21:28:41.725046
2017-10-12T09:51:00
2017-10-12T09:51:00
106,671,482
0
0
null
null
null
null
UTF-8
C
false
false
97
h
UIButton+JingGeButton.h
../../../JingGe_Common/JingGe_Common/JingGeUIFundation/JingGeViewCategory/UIButton+JingGeButton.h
61c1dc110e187153698523874fe7db317ac7f18c
ab21cb6c18804e82d873c26df90544241560ce92
/libft/ft_memchr.c
5c5d1c759e9bfcad7747cb8ecfe22e6dc8edef9c
[]
no_license
JockerOk/21school
b17c64be06941e7a6be0c98901fb8dcb98e773e8
9277b036aa853370550d4e5f0e938588ef47f21b
refs/heads/master
2023-01-20T20:05:07.397759
2020-11-27T07:36:19
2020-11-27T07:36:19
310,852,211
0
0
null
null
null
null
UTF-8
C
false
false
234
c
ft_memchr.c
#include "libft.h" void *ft_memchr(const void *src, int val, size_t n) { const char *str; size_t i; i = 0; str = (const char*)src; while (n > i) { if (str[i] == val) return ((char *)src + i); i++; } return (NULL); }
7c0a7c4e6d89120c4a2e291fe2c90bfd4f19276a
7dfef3b197861816e25e78db3976f398a8439481
/cmdline.c
3f1e85405a37411eea821aba46c240f40d3e7739
[ "MIT" ]
permissive
sjinks/ssh-honeypotd
effb1e833e2a8ddf9680301a04efeba4d9f2ca67
a1033f7c74e3cfcee56ffe913104201eeba41dce
refs/heads/master
2023-08-30T23:54:36.820534
2023-08-28T20:14:29
2023-08-28T23:10:11
25,611,622
15
4
MIT
2023-09-14T21:11:26
2014-10-23T00:44:58
C
UTF-8
C
false
false
8,334
c
cmdline.c
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <getopt.h> #include <unistd.h> #include <pwd.h> #include <grp.h> #include <limits.h> #include "globals.h" #include "cmdline.h" static struct option long_options[] = { { "rsa-key", required_argument, 0, 'r' }, { "dsa-key", required_argument, 0, 'd' }, #if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0, 6, 4) { "ecdsa-key", required_argument, 0, 'e' }, #endif { "host-key", required_argument, 0, 'k' }, { "address", required_argument, 0, 'b' }, { "port", required_argument, 0, 'p' }, #ifndef MINIMALISTIC_BUILD { "pid", required_argument, 0, 'P' }, { "name", required_argument, 0, 'n' }, { "user", required_argument, 0, 'u' }, { "group", required_argument, 0, 'g' }, { "no-syslog", no_argument, 0, 'x' }, { "foreground", no_argument, 0, 'f' }, #endif { "help", no_argument, 0, 'h' }, { "version", no_argument, 0, 'v' }, { 0, 0, 0, 0 } }; #if defined(__GNUC__) || defined(__clang__) __attribute__((noreturn)) #endif static void usage(struct globals_t* g) { printf( "Usage: ssh-honeypotd [options]...\n" "Low-interaction SSH honeypot\n\n" "Mandatory arguments to long options are mandatory for short options too.\n" " -k, --host-key FILE the file containing the private host key (RSA, DSA, ECDSA, ED25519)\n" " -b, --address ADDRESS the IP address to bind to (default: 0.0.0.0)\n" " -p, --port PORT the port to bind to (default: 22)\n" #ifndef MINIMALISTIC_BUILD " -P, --pid FILE the PID file\n" " (if not specified, the daemon will run in the foreground)\n" " -n, --name NAME the name of the daemon for syslog\n" " (default: ssh-honeypotd)\n" " -u, --user USER drop privileges and switch to this USER\n" " (default: daemon or nobody)\n" " -g, --group GROUP drop privileges and switch to this GROUP\n" " (default: daemon or nogroup)\n" " -x, --no-syslog log messages only to stderr\n" " (only works with --foreground)\n" " -f, --foreground do not daemonize\n" #endif " -h, --help display this help and exit\n" " -v, --version output version information and exit\n\n" #if LIBSSH_VERSION_INT < SSH_VERSION_INT(0, 7, 90) "-k option must be specified at least once.\n\n" #endif "Please note:\n" " - ECDSA keys are supported if ssh-honeypotd is compiled against and run with libssh 0.6.4+\n" " - ED25519 keys are supported if ssh-honeypotd is compiled against and run with libssh 0.7.0+\n\n" "ssh-honeypotd was compiled against libssh " SSH_STRINGIFY(LIBSSH_VERSION) "\n" "libssh used: %s\n\n" "Please report bugs here: <https://github.com/sjinks/ssh-honeypotd/issues>\n", ssh_version(0) ); exit(0); } #if defined(__GNUC__) || defined(__clang__) __attribute__((noreturn)) #endif static void version(struct globals_t* g) { printf( "ssh-honeypotd 2.1.2\n" "Copyright (c) 2014-2021, Volodymyr Kolesnykov <volodymyr@wildwolf.name>\n" "License: MIT <http://opensource.org/licenses/MIT>\n" ); exit(0); } static void check_alloc(void* p, const char* api) { if (!p) { perror(api); exit(EXIT_FAILURE); } } #if defined(__GNUC__) || defined(__clang__) __attribute__((malloc, returns_nonnull)) #endif static char* my_strdup(const char *s) { char* retval = strdup(s); check_alloc(retval, "strdup"); return retval; } static void resolve_pid_file(struct globals_t* g) { #ifndef MINIMALISTIC_BUILD if (g->pid_file) { if (g->pid_file[0] != '/') { char buf[PATH_MAX+1]; char* cwd = getcwd(buf, PATH_MAX + 1); char* newbuf = NULL; /* If the current directory is not below the root directory of * the current process (e.g., because the process set a new * filesystem root using chroot(2) without changing its current * directory into the new root), then, since Linux 2.6.36, * the returned path will be prefixed with the string * "(unreachable)". Such behavior can also be caused by * an unprivileged user by changing the current directory into * another mount namespace. When dealing with paths from * untrusted sources, callers of these functions should consider * checking whether the returned path starts with '/' or '(' * to avoid misinterpreting an unreachable path as a relative path. */ if (cwd && cwd[0] == '/') { size_t cwd_len = strlen(cwd); size_t pid_len = strlen(g->pid_file); newbuf = calloc(cwd_len + pid_len + 2, 1); check_alloc(newbuf, "calloc"); memcpy(newbuf, cwd, cwd_len); newbuf[cwd_len] = '/'; memcpy(newbuf + cwd_len + 1, g->pid_file, pid_len); free(g->pid_file); g->pid_file = newbuf; } else { fprintf(stderr, "ERROR: Failed to get the current directory: %s\n", strerror(errno)); free(g->pid_file); exit(EXIT_FAILURE); } } } #endif } static void set_defaults(struct globals_t* g) { if (!g->bind_address) { g->bind_address = my_strdup("0.0.0.0"); } if (!g->bind_port) { g->bind_port = my_strdup("22"); } #ifndef MINIMALISTIC_BUILD if (!g->daemon_name) { g->daemon_name = my_strdup("ssh-honeypotd"); } #endif } void parse_options(int argc, char** argv, struct globals_t* g) { assert(g != NULL); while (1) { int option_index = 0; int c = getopt_long( argc, argv, #ifndef MINIMALISTIC_BUILD "r:d:e:k:b:p:P:n:u:g:xfvh", #else "r:d:e:k:b:p:vh", #endif long_options, &option_index ); if (-1 == c) { break; } switch (c) { case 'r': case 'd': case 'e': case 'k': { ssh_key key; int rc = ssh_pki_import_privkey_file(optarg, NULL, NULL, NULL, &key); if (-1 == rc) { fprintf(stderr, "WARNING: failed to import the key from %s\n", optarg); break; } enum ssh_keytypes_e key_type = ssh_key_type(key); ssh_key_free(key); char** loc = NULL; switch ((int)key_type) { case SSH_KEYTYPE_DSS: loc = &g->dsa_key; break; case SSH_KEYTYPE_RSA: loc = &g->rsa_key; break; #if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0, 6, 4) case SSH_KEYTYPE_ECDSA: #if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0, 9, 0) case SSH_KEYTYPE_ECDSA_P256: case SSH_KEYTYPE_ECDSA_P384: case SSH_KEYTYPE_ECDSA_P521: #endif loc = &g->ecdsa_key; break; #endif #if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0, 7, 0) case SSH_KEYTYPE_ED25519: loc = &g->ed25519_key; break; #endif default: fprintf(stderr, "WARNING: unsupported key type in %s (%d)\n", optarg, (int)key_type); loc = NULL; break; } if (loc) { free(*loc); *loc = my_strdup(optarg); } break; } case 'b': free(g->bind_address); g->bind_address = strdup(optarg); break; case 'p': free(g->bind_port); g->bind_port = strdup(optarg); break; #ifndef MINIMALISTIC_BUILD case 'P': free(g->pid_file); g->pid_file = strdup(optarg); break; case 'n': free(g->daemon_name); g->daemon_name = strdup(optarg); break; case 'f': g->foreground = 1; break; case 'x': g->no_syslog = 1; break; case 'u': { struct passwd* pwd = getpwnam(optarg); if (!pwd) { fprintf(stderr, "WARNING: unknown user %s\n", optarg); } else { g->uid = pwd->pw_uid; g->uid_set = 1; if (!g->gid_set) { g->gid = pwd->pw_gid; g->gid_set = 1; } } break; } case 'g': { struct group* grp = getgrnam(optarg); if (!grp) { fprintf(stderr, "WARNING: unknown group %s\n", optarg); } else { g->gid = grp->gr_gid; g->gid_set = 1; } break; } #endif case 'h': usage(g); /* unreachable */ /* no break */ case 'v': version(g); /* unreachable */ /* no break */ case '?': default: break; } } while (optind < argc) { fprintf(stderr, "WARNING: unrecognized option: %s\n", argv[optind]); ++optind; } set_defaults(g); resolve_pid_file(g); #ifndef MINIMALISTIC_BUILD if (!g->pid_file) { g->foreground = 1; } if (!g->foreground) { g->no_syslog = 0; } #endif }
d5143dcf5e582cae3531c149e177c93edcce7727
02a4b5e0c1c5d4c98b682542a266744dce04ed6a
/src/delete.c
0077a563c3a0aadd385c7c27144cca60f406de1f
[]
no_license
SAIRAJL/IMPLEMENTATION_SMS
95e03d71748ddad90c8a217c756e3292eaa545d3
2e26232528b38fbf15e27f4364bc9d5360019a4a
refs/heads/master
2023-07-11T04:54:18.548513
2021-08-24T09:43:26
2021-08-24T09:43:26
398,492,853
0
1
null
null
null
null
UTF-8
C
false
false
5,087
c
delete.c
#include"delete.h" /** *@brief structure containing details required to keep a record of student */ struct main { char regn[10],name[50],f_name[50],address[100],course[10],doa[10]; }; struct result { int m1,m2,m3,m4,total; char regn[10],grade[2]; }; struct link_main { char lmregn[10],lmname[50],lmf_name[50],lmaddress[100],lmcourse[10],lmdoa[10]; struct link_main *next; }; /** *@brief structure about define link list Structure for deleting or editing */ struct link_result { int lrm1,lrm2,lrm3,lrm4,lrtotal; // student members// char lrregn[10],lrgrade[2]; struct link_result *next; }; /** *@declare typedef of structure */ typedef struct main m; typedef struct result r; typedef struct link_main lm; typedef struct link_result lr; long int size1=sizeof(m); long int size2=sizeof(r); FILE *f1,*f2; void delet() { m a,b; r c,d; lm *s,*p,*n; lr *m,*t,*k; char reg[10],op; char newe[100]; int flag,flag1; s=p=n=NULL; m=t=k=NULL; flag=flag1=0; clrscr(); gotoxy(25,1);printf("-----------------------------------"); gotoxy(24,2);printf("| Deleting Of A Student Profile |"); gotoxy(25,3);printf("-----------------------------------"); f1=fopen("c:\\student/main.dat","rb"); if (f1==NULL){printf("Databse not exist");getch();exit(0);} gotoxy(5,6);printf("| Enter Reg No Of Student :-");fflush(stdin);scanf("%s",&reg); while(fread(&a,size1,1,f1)==1) { n=(lm*)malloc(sizeof(lm)); strcpy(n->lmregn,a.regn); strcpy(n->lmname,a.name); strcpy(n->lmf_name,a.f_name); strcpy(n->lmaddress,a.address); strcpy(n->lmcourse,a.course); strcpy(n->lmdoa,a.doa); n->next=NULL; if (s==NULL) { s=n; } else { for(p=s;p->next!=NULL;p=p->next);p->next=n; } } fclose(f1); f2=fopen("c:\\student/result.dat","rb"); while(fread(&c,size2,1,f2)==1) { k=(lr*)malloc(sizeof(lr)); strcpy(k->lrregn,c.regn); k->lrm1=c.m1; k->lrm2=c.m2; k->lrm3=c.m3; k->lrm4=c.m4; k->lrtotal=c.total; strcpy(k->lrgrade,c.grade); k->next=NULL; if (m==NULL) { m=k; } else { for(t=m;t->next!=NULL;t=t->next);t->next=k; } } fclose(f2); f1=fopen("c:\\student/main.dat","rb"); while(fread(&a,size1,1,f1)==1) { if(strcmp(a.regn,reg)==0) { flag=0; gotoxy(5,5);printf("| |"); gotoxy(5,7);printf("| |"); gotoxy(5,8);printf("| |"); gotoxy(5,9);printf("| |"); gotoxy(5,10);printf("| |"); gotoxy(5,11);printf("| |"); gotoxy(5,4);printf("|-----------------------------Details-----------------------------|"); gotoxy(5,7);printf("| Student Name :- %s",a.name); gotoxy(5,8);printf("| Student Father`s Name :- %s",a.f_name); gotoxy(5,9);printf("| Student Address :- %s",a.address); gotoxy(5,10);printf("| Course :- %s",a.course); gotoxy(5,11);printf("| Date of Addmission :- %s",a.doa); gotoxy(5,12);printf("|-----------------------------------------------------------------|"); break; } else { flag=2; } } fclose(f1); f2=fopen("c:\\student/result.dat","rb"); while (fread(&c,size2,1,f2)==1) { if(strcmp(c.regn,reg)==0) { flag1=0; gotoxy(5,17);printf("|----------------------------------------------------------|"); gotoxy(5,16);printf(" M1 Marks M2 Marks M3 Marks M4 Marks "); gotoxy(5,18);printf("| %d",c.m1); gotoxy(21,18);printf("| %d",c.m2); gotoxy(37,18);printf("| %d",c.m3); gotoxy(53,18);printf("| %d |",c.m4); gotoxy(5,19);printf("|----------------------------------------------------------|"); gotoxy(5,21);printf("TOTAL MARKS:-%d",c.total); fflush(stdin); gotoxy(25,21);printf("GRADE:-%s",c.grade); fclose(f2); break; } else { flag1=2; } } fclose(f2); if (flag==2){gotoxy(10,30);printf("This Ren No Not Found Press Any Key To Continue");getch();goto end;} if (flag1==1){gotoxy(5,21);printf("The Marks Of This Student Not Exist");} gotoxy(5,23);printf("Are You Sure Delete This Record?(Y/N)");fflush(stdin);op=getch(); if (op=='Y'||op=='y') { if(strcmp(s->lmregn,reg)==0) { flag=1; n=s->next; free(s); s=n; } else { for (p=s;p->next!=NULL;p=p->next) { if(strcmp(p->lmregn,reg)==0) { flag=1; n=p->next->next; free(p->next); p->next=n; } } } if(strcmp(m->lrregn,reg)==0) { flag1=1; k=m->next; free(m); m=k; } else { for (t=m;t->next!=NULL;t=t->next) { if(strcmp(t->lrregn,reg)==0) { flag1=1; k=t->next->next; free(t->next); t->next=k; } } } } else { gotoxy(10,30);printf("Record Was Not Deleted");getch(); } if (flag==1) { f2=fopen("c:\\student/main.dat","wb"); for(p=s;p!=NULL;p=p->next) { strcpy(b.regn,p->lmregn); strcpy(b.name,p->lmname); strcpy(b.f_name,p->lmf_name); strcpy(b.address,p->lmaddress); strcpy(b.course,p->lmcourse); strcpy(b.doa,p->lmdoa); fwrite(&b,size1,1,f2); free(p); } fclose(f2); } else { for(p=s;p!=NULL;p=p->next) { free(p); } } if (flag1==1) { fclose(f2); f2=fopen("c:\\student/result.dat","wb"); for(t=m;t!=NULL;t=t->next) { strcpy(d.regn,t->lrregn); d.m1=t->lrm1; d.m2=t->lrm2; d.m3=t->lrm3; d.m4=t->lrm4; d.total=t->lrtotal; strcpy(d.grade,t->lrgrade); fwrite(&d,size2,1,f2); free(t); } fclose(f2); } else { for(t=m;t!=NULL;t=t->next) { free(t); } } end: form1(); }
e86f96bc42650e55293f06bee63644d582bda6bb
7ba6f90a49683a6dde40b37407cc0f4a53019e6e
/src/file_writer/file_writer.c
6e9328e7e34e8565872c907dd1ad7e2e1e219dbf
[]
no_license
kylegibson15/system-logger
fb0d3f4f27d218aa96c85a779328ccb12760215f
5644e9f7f3c6fca172f7fb34cc664b6928f2a201
refs/heads/main
2023-01-24T12:14:13.209586
2020-12-09T06:53:13
2020-12-09T06:53:13
319,830,188
0
0
null
null
null
null
UTF-8
C
false
false
334
c
file_writer.c
#include "file_writer.h" FILE *open_log_file(char *file_path) { FILE *fp fopen(file_path, "a"); return fp; } void write_log_to_file(FILE *file, unsigned long long free_memory) { if (file) { fprintf(file, "free_memory=%llu\n", free_memory); } } void close_log_file(FILE *file) { if (file) { fclose(file); } }
905c2c6a0ce5d233e75a594c90b8b69c84a594be
9d364070c646239b2efad7abbab58f4ad602ef7b
/platform/external/chromium_org/base/format_macros.h
b7e8e678cb427770c086b0982526438874368739
[ "BSD-3-Clause" ]
permissive
denix123/a32_ul
4ffe304b13c1266b6c7409d790979eb8e3b0379c
b2fd25640704f37d5248da9cc147ed267d4771c2
refs/heads/master
2021-01-17T20:21:17.196296
2016-08-16T04:30:53
2016-08-16T04:30:53
65,786,970
0
2
null
2020-03-06T22:00:52
2016-08-16T04:15:54
null
UTF-8
C
false
false
1,384
h
format_macros.h
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BASE_FORMAT_MACROS_H_ #define BASE_FORMAT_MACROS_H_ #include "build/build_config.h" #if defined(OS_POSIX) #if (defined(_INTTYPES_H) || defined(_INTTYPES_H_)) && !defined(PRId64) #error "inttypes.h has already been included before this header file, but " #error "without __STDC_FORMAT_MACROS defined." #endif #if !defined(__STDC_FORMAT_MACROS) #define __STDC_FORMAT_MACROS #endif #include <inttypes.h> #define WidePRId64 PRId64 #define WidePRIu64 PRIu64 #define WidePRIx64 PRIx64 #if !defined(PRIuS) #define PRIuS "zu" #endif #if defined(OS_MACOSX) #if defined(ARCH_CPU_64_BITS) #if !defined(PRIdNS) #define PRIdNS "ld" #endif #if !defined(PRIuNS) #define PRIuNS "lu" #endif #if !defined(PRIxNS) #define PRIxNS "lx" #endif #else #if !defined(PRIdNS) #define PRIdNS "d" #endif #if !defined(PRIuNS) #define PRIuNS "u" #endif #if !defined(PRIxNS) #define PRIxNS "x" #endif #endif #endif #else #if !defined(PRId64) #define PRId64 "I64d" #endif #if !defined(PRIu64) #define PRIu64 "I64u" #endif #if !defined(PRIx64) #define PRIx64 "I64x" #endif #define WidePRId64 L"I64d" #define WidePRIu64 L"I64u" #define WidePRIx64 L"I64x" #if !defined(PRIuS) #define PRIuS "Iu" #endif #endif #endif
4a438f54d104819d30a2b79c84512e565f28aeee
0ed9cf11bad81157126e08e2ee8c241234604b9d
/csrc/dyHcapNumericalDerivative.c
5571d0e5192189d8dae07b56bbfbf4e59f5a6c35
[]
no_license
Shallyn/pyEOBCal
555b583055e7a2476eaaa60f1b2e0440e9eec999
4b3f66d53ecbb46c8d26c1e138a78006a1eb6f0a
refs/heads/master
2020-09-12T13:25:11.885331
2020-05-18T04:55:05
2020-05-18T04:55:05
222,439,869
0
0
null
null
null
null
UTF-8
C
false
false
17,125
c
dyHcapNumericalDerivative.c
/** * Writer: Xiaolin.liu * xiaolin.liu@mail.bnu.edu.cn * * This module contains basic functions for calculation. * Functions list: * Kernel: * 20xx.xx.xx, LOC **/ #include "dyHcapNumericalDerivative.h" #include "dyFactorizedFlux.h" #include "dyHamiltonian.h" #include <gsl/gsl_deriv.h> #define STEP_SIZE 1.0e-3 /** * Calculate the derivative of the Hamiltonian w.r.t. a specific parameter * Used by generic spin EOB model, including initial conditions solver. */ REAL8 XLALSpinHcapNumDerivWRTParam( const INT paramIdx, /**<< Index of the parameters */ const REAL8 values[], /**<< Dynamical variables */ SpinEOBParams *funcParams /**<< EOB Parameters */ ) { HcapDerivParams params; REAL8 result; gsl_function F; INT gslStatus; REAL8 mass1, mass2; /* The error in a derivative as measured by GSL */ REAL8 absErr; /* Set up pointers for GSL */ params.values = values; params.params = funcParams; F.function = &GSLSpinHamiltonianWrapper; F.params = &params; params.varyParam = paramIdx; mass1 = params.params->eobParams->m1; mass2 = params.params->eobParams->m2; /* Now calculate derivatives w.r.t. the required parameter */ if ( paramIdx >=6 && paramIdx < 9 ) { gslStatus = gsl_deriv_central( &F, values[paramIdx], STEP_SIZE*mass1*mass1, &result, &absErr ); } else if ( paramIdx >= 9 ) { gslStatus = gsl_deriv_central( &F, values[paramIdx], STEP_SIZE*mass2*mass2, &result, &absErr ); } else { gslStatus = gsl_deriv_central( &F, values[paramIdx], STEP_SIZE, &result, &absErr ); } if ( gslStatus != GSL_SUCCESS ) { return REAL8_FAIL_NAN; } //printf( "Abserr = %e\n", absErr ); return result; } /** * Wrapper for GSL to call the Hamiltonian function */ REAL8 GSLSpinHamiltonianWrapper( double x, void *params ) { HcapDerivParams *dParams = (HcapDerivParams *)params; EOBParams *eobParams = dParams->params->eobParams; REAL8 tmpVec[12]; REAL8 s1normData[3], s2normData[3], sKerrData[3], sStarData[3]; /* These are the vectors which will be used in the call to the Hamiltonian */ REAL8Vector r, p, spin1, spin2, spin1norm, spin2norm; REAL8Vector sigmaKerr, sigmaStar; int i; REAL8 a; REAL8 m1 = eobParams->m1; REAL8 m2 = eobParams->m2; REAL8 mT2 = (m1+m2)*(m1+m2); /* Use a temporary vector to avoid corrupting the main function */ memcpy( tmpVec, dParams->values, sizeof(tmpVec) ); /* Set the relevant entry in the vector to the correct value */ tmpVec[dParams->varyParam] = x; /* Set the LAL-style vectors to point to the appropriate things */ r.length = p.length = spin1.length = spin2.length = spin1norm.length = spin2norm.length = 3; sigmaKerr.length = sigmaStar.length = 3; r.data = tmpVec; p.data = tmpVec+3; spin1.data = tmpVec+6; spin2.data = tmpVec+9; spin1norm.data = s1normData; spin2norm.data = s2normData; sigmaKerr.data = sKerrData; sigmaStar.data = sStarData; memcpy( s1normData, tmpVec+6, 3*sizeof(REAL8) ); memcpy( s2normData, tmpVec+9, 3*sizeof(REAL8) ); for ( i = 0; i < 3; i++ ) { s1normData[i] /= mT2; s2normData[i] /= mT2; } /* Calculate various spin parameters */ CalculateSigmaKerr( &sigmaKerr, eobParams->m1, eobParams->m2, &spin1, &spin2 ); CalculateSigmaStar( &sigmaStar, eobParams->m1, eobParams->m2, &spin1, &spin2 ); a = sqrt( sigmaKerr.data[0]*sigmaKerr.data[0] + sigmaKerr.data[1]*sigmaKerr.data[1] + sigmaKerr.data[2]*sigmaKerr.data[2] ); //printf( "a = %e\n", a ); //printf( "aStar = %e\n", sqrt( sigmaStar.data[0]*sigmaStar.data[0] + sigmaStar.data[1]*sigmaStar.data[1] + sigmaStar.data[2]*sigmaStar.data[2]) ); if ( isnan( a ) ) { print_warning( "a is nan!!\n"); } //XLALSimIMRCalculateSpinEOBHCoeffs( dParams->params->seobCoeffs, eobParams->eta, a ); //printf( "Hamiltonian = %e\n", XLALSimIMRSpinEOBHamiltonian( eobParams->eta, &r, &p, &sigmaKerr, &sigmaStar, dParams->params->seobCoeffs ) ); return SpinEOBHamiltonian( eobParams->eta, &r, &p, &spin1norm, &spin2norm, &sigmaKerr, &sigmaStar, dParams->params->tortoise, dParams->params->seobCoeffs ) / eobParams->eta; } #define lMax 8 int XLALSpinAlignedHcapDerivative( double t, /**< UNUSED */ const REAL8 values[], /**< dynamical varables */ REAL8 dvalues[], /**< time derivative of dynamical variables */ void *funcParams /**< EOB parameters */ ) { HcapDerivParams params; /* Since we take numerical derivatives wrt dynamical variables */ /* but we want them wrt time, we use this temporary vector in */ /* the conversion */ REAL8 tmpDValues[6]; /* Cartesian values for calculating the Hamiltonian */ REAL8 cartValues[6]; REAL8 H; //Hamiltonian REAL8 flux; gsl_function F; INT4 gslStatus; UINT i; REAL8Vector rVec, pVec; REAL8 rData[3], pData[3]; /* We need r, phi, pr, pPhi to calculate the flux */ REAL8 r; REAL8Vector polarDynamics; REAL8 polData[4]; REAL8 Mtotal, eta; /* Spins */ REAL8Vector *s1Vec = NULL; REAL8Vector *s2Vec = NULL; REAL8Vector *sKerr = NULL; REAL8Vector *sStar = NULL; REAL8 a; REAL8 omega; /* EOB potential functions */ REAL8 DeltaT, DeltaR; REAL8 csi; /* The error in a derivative as measured by GSL */ REAL8 absErr; /* Declare NQC coefficients */ EOBNonQCCoeffs *nqcCoeffs = NULL; /* Set up pointers for GSL */ params.values = cartValues; params.params = (SpinEOBParams *)funcParams; nqcCoeffs = params.params->nqcCoeffs; s1Vec = params.params->s1VecOverMtMt; s2Vec = params.params->s2VecOverMtMt; sKerr = params.params->sigmaKerr; sStar = params.params->sigmaStar; F.function = &GSLSpinAlignedHamiltonianWrapper; F.params = &params; Mtotal = params.params->eobParams->Mtotal; eta = params.params->eobParams->eta; r = values[0]; /* Since this is spin aligned, I make the assumption */ /* that the spin vector is along the z-axis. */ a = sKerr->data[2]; /* Calculate the potential functions and the tortoise coordinate factor csi, given by Eq. 28 of Pan et al. PRD 81, 084041 (2010) */ DeltaT = XLALSimIMRSpinEOBHamiltonianDeltaT( params.params->seobCoeffs, r, eta, a ); DeltaR = XLALSimIMRSpinEOBHamiltonianDeltaR( params.params->seobCoeffs, r, eta, a ); csi = sqrt( DeltaT * DeltaR ) / (r*r + a*a); //printf("DeltaT = %.16e, DeltaR = %.16e, a = %.16e\n",DeltaT,DeltaR,a); //print_debug( "csi in derivatives function = %.16e\n", csi ); /* Populate the Cartesian values vector, using polar coordinate values */ /* We can assume phi is zero wlog */ memset( cartValues, 0, sizeof( cartValues ) ); cartValues[0] = values[0]; cartValues[3] = values[2]; cartValues[4] = values[3] / values[0]; /* Now calculate derivatives w.r.t. each Cartesian variable */ for ( i = 0; i < 6; i++ ) { params.varyParam = i; gslStatus = gsl_deriv_central( &F, cartValues[i], STEP_SIZE, &tmpDValues[i], &absErr ); if ( gslStatus != GSL_SUCCESS ) { print_warning( "XLAL Error - %s: Failure in GSL function\n", __func__ ); return CEV_FAILURE; } } /* Calculate the Cartesian vectors rVec and pVec */ polarDynamics.length = 4; polarDynamics.data = polData; memcpy( polData, values, sizeof( polData ) ); rVec.length = pVec.length = 3; rVec.data = rData; pVec.data = pData; memset( rData, 0, sizeof(rData) ); memset( pData, 0, sizeof(pData) ); rData[0] = values[0]; pData[0] = values[2]; pData[1] = values[3] / values[0]; /* Calculate Hamiltonian using Cartesian vectors rVec and pVec */ H = SpinEOBHamiltonian( eta, &rVec, &pVec, s1Vec, s2Vec, sKerr, sStar, params.params->tortoise, params.params->seobCoeffs ); //printf( "csi = %.16e, ham = %.16e ( tortoise = %d)\n", csi, H, params.params->tortoise ); //exit(1); //if ( values[0] > 1.3 && values[0] < 3.9 ) printf( "r = %e\n", values[0] ); //if ( values[0] > 1.3 && values[0] < 3.9 ) printf( "Hamiltonian = %e\n", H ); H = H * Mtotal; /*if ( values[0] > 1.3 && values[0] < 3.9 ) printf( "Cartesian derivatives:\n%f %f %f %f %f %f\n", tmpDValues[3], tmpDValues[4], tmpDValues[5], -tmpDValues[0], -tmpDValues[1], -tmpDValues[2] );*/ /* Now calculate omega, and hence the flux */ omega = tmpDValues[4] / r; dvalues[0] = csi * tmpDValues[3]; dvalues[1] = omega; dvalues[2] = -tmpDValues[0] + tmpDValues[4] * values[3] / (r*r); dvalues[2] = dvalues[2] * csi; dvalues[3] = 0; //flux = XLALInspiralSpinFactorizedFlux( &polarDynamics, nqcCoeffs, omega, params.params, H/Mtotal, lMax ,1); flux = InspiralSpinFactorizedFlux_elip( &polarDynamics, values, dvalues, nqcCoeffs, omega, params.params, H/Mtotal, lMax); if (IS_REAL8_FAIL_NAN(flux) || isnan(flux) ) { print_warning("Failed to calculate flux.\n"); //print_err("\tdvalues = [%f, %f, %f]\n", dvalues[0], dvalues[1], dvalues[2]); return CEV_FAILURE; } /* Looking at the non-spinning model, I think we need to divide the flux by eta */ flux = flux / eta; //printf( "Flux in derivatives function = %.16e\n", flux ); /* Now we can calculate the final (spherical) derivatives */ /* csi is needed because we use the tortoise co-ordinate */ /* Right hand side of Eqs. 10a - 10d of Pan et al. PRD 84, 124052 (2011) */ //dvalues[0] = csi * tmpDValues[3]; //dvalues[1] = omega; /* Note: in this special coordinate setting, namely y = z = 0, dpr/dt = dpx/dt + dy/dt * py/r, where py = pphi/r */ dvalues[2] = - tmpDValues[0] + tmpDValues[4] * values[3] / (r*r); dvalues[2] = dvalues[2] * csi - ( values[2] / values[3] ) * flux / omega; dvalues[3] = - flux / omega; //if ( values[0] > 1.3 && values[0] < 3.9 ) printf("Values:\n%f %f %f %f\n", values[0], values[1], values[2], values[3] ); //if ( values[0] > 1.3 && values[0] < 3.9 ) printf("Derivatives:\n%f %f %f %f\n", dvalues[0], r*dvalues[1], dvalues[2], dvalues[3] ); if ( isnan( dvalues[0] ) || isnan( dvalues[1] ) || isnan( dvalues[2] ) || isnan( dvalues[3] ) ) { print_warning( "Deriv is nan: %e %e %e %e\n", dvalues[0], dvalues[1], dvalues[2], dvalues[3] ); return CEV_FAILURE; } return CEV_SUCCESS; } int XLALSpinAlignedHcapDerivativeWithForce( double t, /**< UNUSED */ const REAL8 values[], /**< dynamical varables */ REAL8 dvalues[], /**< time derivative of dynamical variables */ void *funcParams /**< EOB parameters */ ) { HcapDerivParams params; /* Since we take numerical derivatives wrt dynamical variables */ /* but we want them wrt time, we use this temporary vector in */ /* the conversion */ REAL8 tmpDValues[6]; /* Cartesian values for calculating the Hamiltonian */ REAL8 cartValues[6]; REAL8 H; //Hamiltonian REAL8 flux; gsl_function F; INT4 gslStatus; UINT i; REAL8Vector rVec, pVec; REAL8 rData[3], pData[3]; /* We need r, phi, pr, pPhi to calculate the flux */ REAL8 r; REAL8Vector polarDynamics; REAL8 polData[4]; REAL8 Mtotal, eta; /* Spins */ REAL8Vector *s1Vec = NULL; REAL8Vector *s2Vec = NULL; REAL8Vector *sKerr = NULL; REAL8Vector *sStar = NULL; REAL8 a; REAL8 omega; /* EOB potential functions */ REAL8 DeltaT, DeltaR; REAL8 csi; /* The error in a derivative as measured by GSL */ REAL8 absErr; /* Declare NQC coefficients */ EOBNonQCCoeffs *nqcCoeffs = NULL; /* Set up pointers for GSL */ params.values = cartValues; params.params = (SpinEOBParams *)funcParams; nqcCoeffs = params.params->nqcCoeffs; s1Vec = params.params->s1VecOverMtMt; s2Vec = params.params->s2VecOverMtMt; sKerr = params.params->sigmaKerr; sStar = params.params->sigmaStar; F.function = &GSLSpinAlignedHamiltonianWrapper; F.params = &params; Mtotal = params.params->eobParams->Mtotal; eta = params.params->eobParams->eta; r = values[0]; /* Since this is spin aligned, I make the assumption */ /* that the spin vector is along the z-axis. */ a = sKerr->data[2]; /* Calculate the potential functions and the tortoise coordinate factor csi, given by Eq. 28 of Pan et al. PRD 81, 084041 (2010) */ DeltaT = XLALSimIMRSpinEOBHamiltonianDeltaT( params.params->seobCoeffs, r, eta, a ); DeltaR = XLALSimIMRSpinEOBHamiltonianDeltaR( params.params->seobCoeffs, r, eta, a ); csi = sqrt( DeltaT * DeltaR ) / (r*r + a*a); //printf("DeltaT = %.16e, DeltaR = %.16e, a = %.16e\n",DeltaT,DeltaR,a); //print_debug( "csi in derivatives function = %.16e\n", csi ); /* Populate the Cartesian values vector, using polar coordinate values */ /* We can assume phi is zero wlog */ memset( cartValues, 0, sizeof( cartValues ) ); cartValues[0] = values[0]; cartValues[3] = values[2]; cartValues[4] = values[3] / values[0]; /* Now calculate derivatives w.r.t. each Cartesian variable */ for ( i = 0; i < 6; i++ ) { params.varyParam = i; gslStatus = gsl_deriv_central( &F, cartValues[i], STEP_SIZE, &tmpDValues[i], &absErr ); if ( gslStatus != GSL_SUCCESS ) { print_warning( "XLAL Error - %s: Failure in GSL function\n", __func__ ); return CEV_FAILURE; } } /* Calculate the Cartesian vectors rVec and pVec */ polarDynamics.length = 4; polarDynamics.data = polData; memcpy( polData, values, sizeof( polData ) ); rVec.length = pVec.length = 3; rVec.data = rData; pVec.data = pData; memset( rData, 0, sizeof(rData) ); memset( pData, 0, sizeof(pData) ); rData[0] = values[0]; pData[0] = values[2]; pData[1] = values[3] / values[0]; /* Calculate Hamiltonian using Cartesian vectors rVec and pVec */ H = SpinEOBHamiltonian( eta, &rVec, &pVec, s1Vec, s2Vec, sKerr, sStar, params.params->tortoise, params.params->seobCoeffs ); //printf( "csi = %.16e, ham = %.16e ( tortoise = %d)\n", csi, H, params.params->tortoise ); //exit(1); //if ( values[0] > 1.3 && values[0] < 3.9 ) printf( "r = %e\n", values[0] ); //if ( values[0] > 1.3 && values[0] < 3.9 ) printf( "Hamiltonian = %e\n", H ); H = H * Mtotal; /*if ( values[0] > 1.3 && values[0] < 3.9 ) printf( "Cartesian derivatives:\n%f %f %f %f %f %f\n", tmpDValues[3], tmpDValues[4], tmpDValues[5], -tmpDValues[0], -tmpDValues[1], -tmpDValues[2] );*/ /* Now calculate omega, and hence the flux */ omega = tmpDValues[4] / r; #if RRSEOBNR #endif dvalues[0] = csi * tmpDValues[3]; dvalues[1] = omega; //dvalues[2] = -tmpDValues[0] + tmpDValues[4] * values[3] / (r*r); dvalues[2] = dvalues[2] * csi; dvalues[3] = 0; //flux = XLALInspiralSpinFactorizedFlux( &polarDynamics, nqcCoeffs, omega, params.params, H/Mtotal, lMax ,1); flux = InspiralSpinFactorizedFlux_elip( &polarDynamics, values, dvalues, nqcCoeffs, omega, params.params, H/Mtotal, lMax); if (IS_REAL8_FAIL_NAN(flux) || isnan(flux) ) { print_warning("Failed to calculate flux.\n"); //print_err("\tdvalues = [%f, %f, %f]\n", dvalues[0], dvalues[1], dvalues[2]); return CEV_FAILURE; } /* Looking at the non-spinning model, I think we need to divide the flux by eta */ flux = flux / eta; //printf( "Flux in derivatives function = %.16e\n", flux ); /* Now we can calculate the final (spherical) derivatives */ /* csi is needed because we use the tortoise co-ordinate */ /* Right hand side of Eqs. 10a - 10d of Pan et al. PRD 84, 124052 (2011) */ //dvalues[0] = csi * tmpDValues[3]; //dvalues[1] = omega; /* Note: in this special coordinate setting, namely y = z = 0, dpr/dt = dpx/dt + dy/dt * py/r, where py = pphi/r */ dvalues[2] = - tmpDValues[0] + tmpDValues[4] * values[3] / (r*r); dvalues[2] = dvalues[2] * csi - ( values[2] / values[3] ) * flux / omega; dvalues[3] = - flux / omega; //if ( values[0] > 1.3 && values[0] < 3.9 ) printf("Values:\n%f %f %f %f\n", values[0], values[1], values[2], values[3] ); //if ( values[0] > 1.3 && values[0] < 3.9 ) printf("Derivatives:\n%f %f %f %f\n", dvalues[0], r*dvalues[1], dvalues[2], dvalues[3] ); if ( isnan( dvalues[0] ) || isnan( dvalues[1] ) || isnan( dvalues[2] ) || isnan( dvalues[3] ) ) { print_warning( "Deriv is nan: %e %e %e %e\n", dvalues[0], dvalues[1], dvalues[2], dvalues[3] ); return CEV_FAILURE; } return CEV_SUCCESS; } #undef lMax
ee034953eac200d56090edfdc4dfc36e2a24f39c
5861b091083c3be20a7aad84459088cbb9b21900
/src/shim.c
6e951743aa6c25420a92bc974979d3e1a36c0359
[]
no_license
bastl-instruments/teensy-RTOS-template
ea49bca508b7b8ff3820e293c9983326bc44d1e7
4fcba9b110cad13d58212418f03aa463740bb944
refs/heads/master
2021-01-10T13:25:13.732016
2016-03-25T18:25:11
2016-03-25T18:25:11
45,992,649
3
0
null
null
null
null
UTF-8
C
false
false
374
c
shim.c
/** * Shim file to take care of undefined init functions if we don't use them * * The point of this is so that we can cut stuff that we don't really need out * of the stuff that comes with teensyduino. */ void unused_void(void) { } void analog_init(void) __attribute__ ((weak, alias("unused_void"))); void usb_init(void) __attribute__ ((weak, alias("unused_void")));
0f3c600336836d6330b45d79605c850041d9f6c5
847ea63820ab49d5b8ef2d4d2922ee156ce35d39
/ding.c
901eef45dcdcc55161841fd9fab315ce9e445cc4
[]
no_license
larsbrinkhoff/ding
d85283085a478575b5e0cd59c2a5828a073e56f1
b36bd3de876a631a35799a7478bd00ce6869f916
refs/heads/master
2022-12-24T05:35:55.810332
2020-10-07T16:26:37
2020-10-08T10:51:38
302,094,505
1
0
null
null
null
null
UTF-8
C
false
false
2,362
c
ding.c
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <hidapi/hidapi.h> #define MICROCHIP_VID 0x04d8 #define MCP2200_PID 0x00dd /* Complain and exit. */ static void die (hid_device *device, const char *message) { fprintf (stderr, "Error: %s", message); if (device) fprintf (stderr, " (%ls)", hid_error (device)); fputc ('\n', stderr); exit (1); } /* Do the HID command/responce dance, with error checking. */ static void hid (hid_device *device, unsigned char *buf) { unsigned char cmd = buf[0]; int n; /* Write data to device. */ n = hid_write (device, buf, 64); if (n != 64) die (device, "hid: write"); /* Get response from device. */ memset (buf, 0, 64); n = hid_read (device, buf, 64); if (n == -1) die (device, "hid: read error"); if (n != 64) die (device, "hid: read size"); if (buf[0] != cmd) die (NULL, "hid: wrong response"); if (buf[1] != 0x00) die (NULL, "hid: error code"); } /* Set GPIO configuration. Writes to flash. */ static void configure (hid_device *device, int pin) { unsigned char settings[64]; memset (settings, 0, 64); settings[0] = 0xB1; //Write flash data. settings[1] = 0x01; //Write GP settings. settings[2 + pin] = 0x00; //GP<pin> = GPIO, output, low. hid (device, settings); memset (settings, 0, 64); settings[0] = 0x60; //Set SRAM settings. settings[7] = 0x01; //Alter GP designation. settings[8 + pin] = 0x00; //GP<pin> = GPIO, output, low. hid (device, settings); } /* Set GPIO output value. */ static void frob (hid_device *device, int pin, int value) { unsigned char data[64]; memset (data, 0, 64); data[0] = 0x50; //Set GPIO output values. data[4 * pin + 2] = 0x01; data[4 * pin + 3] = value; hid (device, data); } /* Make GPIO go high for a specified time. */ static void ding (hid_device *device, int microseconds) { frob (device, 0, 1); usleep (microseconds); frob (device, 0, 0); usleep (100000); } int main (void) { hid_device *device; int us = 5000; if (hid_init () == -1) die (NULL, "init"); device = hid_open (MICROCHIP_VID, MCP2200_PID, NULL); if (device == NULL) die (NULL, "open"); configure (device, 0); frob (device, 0, 0); for (;;) { int c = getchar (); if (c == EOF) exit (0); if (c != 0) ding (device, us); } }
17f644f22338e513439b910cbdb1966dd993f7a0
d9433e063b12ecd795889a1cba3058e5f7b692a0
/c_program/斐波拉契数列/数组做,简单/Untitled2.c
23b8b30e32c7a2b83426cc14ec39adfa63822777
[]
no_license
yebanxinghui/c_program
0e940d0465d12d855d0a37cbad2a1db712189170
bdc67f3de8137510ed9ee3ac2e196c28182eb87f
refs/heads/master
2020-08-29T08:48:46.642530
2019-10-28T08:16:11
2019-10-28T08:16:11
217,985,282
0
0
null
null
null
null
UTF-8
C
false
false
271
c
Untitled2.c
#include<stdio.h> void main() { int i,a[20]={1,1}; for(i=2;i<20;i++) { a[i]=a[i-1]+a[i-2]; } for(i=0;i<20;i++) { if(i%6==0&&i!=0) { printf("\n"); } printf("%12d",a[i]); } printf("\n"); }
5ab1b19d7b5e2a29f8dcf9f4b4dd70ef7f0cef0e
75a560d2e34fdab819cc134b7631e24fb6503d5d
/Zplot/file_handling.h
c04dca18bf9ff9fb3956b155f0639f05c8be457e
[]
no_license
Michael-Manning/Zaber-Plotter
2613010e6d882da0c0e63ec2ac6755527e76c535
fc624ae54bf162b92780a10b2013ce2275a8bfcb
refs/heads/master
2020-12-11T00:15:02.900793
2020-01-14T03:41:57
2020-01-14T03:41:57
233,750,112
0
0
null
null
null
null
UTF-8
C
false
false
432
h
file_handling.h
#pragma once #include <glm/glm.hpp> #include "line_graph.h" enum class TimeUnits{ SECONDS }; enum class DataUnits{ RAW, SCIENTIFIC }; // Exports channel data to a file. Returns success bool writeChannelData(const char * filename, dataChannel &channel, TimeUnits timeUnits, DataUnits dataUnits); // Imports channel data from a file. Returns success bool readChannelData(const char * filename, dataChannel * channel);
2f1c2783fb5542e320046c2fce20ea8af03c5e77
e86254d96236d6531748783f6679a6c6beecdbe2
/vm_options.c
089e89d5a3ef6aec0da3a1f74c5ee7447221a347
[]
no_license
wejrox/VendingMachine
ac5de0cb29d41cd724d1789b95d5b8b47f6b8ef4
45d6c490d9e060c62becb2305d8ea4bf93ea5403
refs/heads/master
2021-07-10T06:36:41.264158
2017-10-12T01:29:51
2017-10-12T01:29:51
104,977,712
0
0
null
null
null
null
UTF-8
C
false
false
20,236
c
vm_options.c
/*********************************************************************** * COSC1076 - Advanced Programming Techniques * Semester 2 2017 Assignment #2 * Full Name : JAMES MCDOWELL * Student Number : S3540510 * Course Code : COSC1076 * Program Code : BP094 * Start up code provided by Xiaodong Li **********************************************************************/ #include "vm_options.h" /** * vm_options.c this is where you need to implement the system handling * functions (e.g., init, free, load, save) and the main options for * your program. You may however have some of the actual work done * in functions defined elsewhere. **/ /** * Initialise the system to a known safe state. Look at the structure * defined in vm_system.h. **/ Boolean systemInit(VmSystem * system) { /** Stock init (must free current pointer) **/ initStockList(system); return FALSE; } /** * Free all memory that has been allocated. If you are struggling to * find all your memory leaks, compile your program with the -g flag * and run it through valgrind. **/ void systemFree(VmSystem * system) { /** Free stock **/ freeList(system->itemList); /** Free system **/ free(system); } /** * Loads the stock and coin data into the system. You will also need to assign * the char pointers to the stock and coin file names in the system here so * that the same files will be used for saving. A key part of this function is * validation. A substantial number of marks are allocated to this function. **/ Boolean loadData( VmSystem * system, const char * stockFileName, const char * coinsFileName) { system->stockFileName = stockFileName; system->coinFileName = coinsFileName; if(!loadStock(system, system->stockFileName)) return FALSE; else if(!loadCoins(system, system->coinFileName)) return FALSE; return TRUE; } /** * Loads the stock file data into the system. **/ Boolean loadStock(VmSystem * system, const char * fileName) { /** Data to process **/ char ** fileContents = GetFileContents(fileName); /** After tokenisation of each line **/ char ** tokenisedData; /** Counting **/ int i,y,x = 0; int stockCount = 0; /** The amount of elements needed to split **/ int arrElements = 6; int delCount = 0; int delReq = 4; /** Validation **/ int eolCount = 0; char *tmp; /** Data entry **/ Node *newNode = NULL; /** Count elements **/ while(fileContents[stockCount] != '\0') { ++stockCount; } /** Set array size **/ tokenisedData = malloc((arrElements + NULL_SPACE) * sizeof(char*)); /** Exit if no stock or too much on one line **/ if(stockCount == 0 || strlen(fileContents[0]) > DESC_LEN) { freeStringArray(fileContents); free(tokenisedData); free(newNode); return FALSE; } /** Perform validity tests on each line **/ for(y = 0; y < stockCount; ++y, delCount = 0, eolCount = 0) { /** Check delimiters **/ for(i = 0; i < strlen(fileContents[y]); ++i) if (fileContents[y][i] == STOCK_DELIM[0]) ++delCount; /** Wrong number of entries **/ if(delCount != delReq) { freeStringArray(fileContents); free(tokenisedData); free(newNode); return FALSE; } /** Malloc **/ tokenisedData[0] = malloc(sizeof(char) * (strlen(fileContents[y]) + \ NULL_SPACE)); /** Split line **/ tmp = strtok(fileContents[y], STOCK_DELIM_COMB); strcpy(tokenisedData[0], tmp); for(i = 1; i < arrElements; ++i) { tmp = strtok(NULL, STOCK_DELIM_COMB); tokenisedData[i] = malloc(sizeof(char) * (strlen(tmp) + \ NULL_SPACE)); strcpy(tokenisedData[i], tmp); } /** Sentinel ('i' was incremented at the final for loop) **/ tokenisedData[i] = malloc(sizeof(char) * (NULL_SPACE)); strcpy(tokenisedData[i], ""); /** Count each of the new line characters in each string **/ for(i = 0; i < arrElements; ++i) { for(x = 0; x < strlen(tokenisedData[i]) + NULL_SPACE; ++x) { if(tokenisedData[i][x] == '\0') ++eolCount; } } /** Overflow **/ if(eolCount != arrElements) { freeStringArray(fileContents); free(tokenisedData); free(newNode); return FALSE; } /** Ensure strings not too large for the struct **/ if(strlen(tokenisedData[0]) > ID_LEN || \ strlen(tokenisedData[1]) > NAME_LEN || \ strlen(tokenisedData[2]) > DESC_LEN || \ strlen(tokenisedData[3]) > 9 || \ strlen(tokenisedData[4]) > 9 || \ strlen(tokenisedData[5]) > 9) { freeStringArray(fileContents); free(tokenisedData); free(newNode); return FALSE; } /** Create node **/ newNode = createNode(tokenisedData); /** Add to the list **/ pushNode(system->itemList, newNode); /** Free part of array for next loop **/ for(i = 0; i < arrElements + 1; ++i) { free(tokenisedData[i]); tokenisedData[i] = NULL; } } /** Free temp memory **/ freeStringArray(fileContents); free(tokenisedData); /** Sort the list **/ getListLength(system->itemList); sortStock(system->itemList); return TRUE; } /** * Loads the coin file data into the system. **/ Boolean loadCoins(VmSystem * system, const char * fileName) { /** Count Variables **/ int i,y; int lineCount = 0; /** Contents of file **/ char ** fileContents = GetFileContents(fileName); /** Denomination Check **/ char *denomSize; char *denomAmt; unsigned int denomSizeParsed; while(fileContents[lineCount] != '\0') { ++lineCount; } if(lineCount != NUM_DENOMS) { freeStringArray(fileContents); return FALSE; } /** Perform validity tests on each line **/ for(y = 0; y < lineCount; ++y) { /** Check dilimeters **/ for(i = 0; i < strlen(fileContents[y]); ++i) { if(fileContents[y][i] == COIN_DELIM[0]) break; if(fileContents[y][i] == '\0') { freeStringArray(fileContents); return FALSE; } } /** Ensure valid denomination **/ denomSize = strtok(fileContents[y], COIN_DELIM); denomAmt = strtok(NULL, COIN_DELIM); /** Check that there isn't more data than intended **/ if(strtok(NULL, COIN_DELIM) != NULL) { freeStringArray(fileContents); return FALSE; } /** Format doesn't match **/ if(strcmp(denomSize, "1000") != 0 && strcmp(denomSize, "500") != 0 && \ strcmp(denomSize, "200") != 0 && strcmp(denomSize, "100") != 0 && \ strcmp(denomSize, "50") != 0 && strcmp(denomSize, "20") != 0 && \ strcmp(denomSize, "10") != 0 && strcmp(denomSize, "5") != 0) { freeStringArray(fileContents); return FALSE; } /** Validate Denomination **/ if(!parseUInt(denomSize, &denomSizeParsed)) { freeStringArray(fileContents); return FALSE; } switch(denomSizeParsed) { case 1000: system->cashRegister[y].denom = TEN_DOLLARS; break; case 500: system->cashRegister[y].denom = FIVE_DOLLARS; break; case 200: system->cashRegister[y].denom = TWO_DOLLARS; break; case 100: system->cashRegister[y].denom = ONE_DOLLAR; break; case 50: system->cashRegister[y].denom = FIFTY_CENTS; break; case 20: system->cashRegister[y].denom = TWENTY_CENTS; break; case 10: system->cashRegister[y].denom = TEN_CENTS; break; case 5: system->cashRegister[y].denom = FIVE_CENTS; break; default: freeStringArray(fileContents); return FALSE; break; } /** Validate Coin count **/ if(!parseUInt(denomAmt, &system->cashRegister[y].count)) { freeStringArray(fileContents); return FALSE; } } freeStringArray(fileContents); return TRUE; } /** * Saves all the stock back to the stock file. **/ Boolean saveStock(VmSystem * system) { /** Counters **/ int i; Node * node; FILE *fp; /** Overwrite file **/ fp = fopen(system->stockFileName, "w"); if (fp == NULL) return FALSE; /** Get each node from the system, and print to the file **/ for(i = 0; i < system->itemList->size; ++i) { node = getNodeByPos(system->itemList, i); fprintf(fp, "%s|%s|%s|%d.%d|%d\n", \ node->data->id, \ node->data->name, \ node->data->desc, \ node->data->price.dollars, \ node->data->price.cents, \ node->data->onHand); } /** Close the file **/ fclose(fp); return TRUE; } /** * Saves all the coins back to the coins file. **/ Boolean saveCoins(VmSystem * system) { /** Counters **/ int i, coinVal; FILE *fp; /** Overwrite file **/ fp = fopen(system->coinFileName, "w"); if (fp == NULL) return FALSE; coinVal = -1; /** Print each coin denom and amount **/ for(i = 0; i <= NUM_DENOMS; ++i) { switch(system->cashRegister[i].denom) { case FIVE_CENTS: coinVal = 5; break; case TEN_CENTS: coinVal = 10; break; case TWENTY_CENTS: coinVal = 20; break; case FIFTY_CENTS: coinVal = 50; break; case ONE_DOLLAR: coinVal = 100; break; case TWO_DOLLARS: coinVal = 200; break; case FIVE_DOLLARS: coinVal = 500; break; case TEN_DOLLARS: coinVal = 1000; break; default: return FALSE; } fprintf(fp, "%d,%d\n", \ coinVal, \ system->cashRegister[i].count); } /** Close the file **/ fclose(fp); return TRUE; } /** * This option allows the user to display the items in the system. * This is the data loaded into the linked list in the requirement 2. **/ void displayItems(VmSystem * system) { int i, tableWidth; char price[10]; /** Holds the width of the columns **/ int colSizes[4]; Node * stock; /** Get max sizes **/ colSizes[0] = getMaxWidth(system->itemList, 0); colSizes[1] = getMaxWidth(system->itemList, 1); colSizes[2] = getMaxWidth(system->itemList, 3); colSizes[3] = getMaxWidth(system->itemList, 2); tableWidth = 10; for(i = 0; i < 4; ++i) { tableWidth += colSizes[i]; tableWidth += 2; } printf("Items Menu\n\n"); printf("%-*s | %-*s | %-*s | %-*s\n", \ colSizes[0], "ID", \ colSizes[1], "Name", \ colSizes[2], "Available", \ colSizes[3], "Price"); /** Dashes **/ for(i = 0; i < tableWidth; ++i) { printf("-"); } printf("\n"); /** Print all of the items **/ for(i = 0; i < system->itemList->size; ++i) { stock = getNodeByPos(system->itemList, i); textFormatPrice(price, stock->data->price.dollars, \ stock->data->price.cents); /** Print the line **/ printf("%-*s | %-*s | %-*d | %-*s\n", \ colSizes[0], stock->data->id, \ colSizes[1], stock->data->name, \ 9, stock->data->onHand, \ colSizes[3], price); } } /** * This option allows the user to purchase an item. * This function implements requirement 5 of the assignment specification. **/ void purchaseItem(VmSystem * system) { int i, iVal; char op[5 + NULL_SPACE]; char price[10]; Node * item; Coin coinsGiven[NUM_DENOMS]; int dollars, cents, remaining, payment, change; change = -1; /** Initialise the coins **/ for(i = 0; i < NUM_DENOMS; ++i) { coinsGiven[i].denom = system->cashRegister[i].denom; coinsGiven[i].count = 0; } printf("Purchase Item\n"); printf("--------------\n"); printf("Please enter the id of the item you wish to purchase: "); iVal = getInput(op, sizeof(op)); if(iVal == 0) { printf("Input entered is invalid, cancelling transaction.\n"); return; } else if (iVal == -1) { printf("Cancelling purchase\n"); printf("Returning to main menu..\n"); return; } /** Get the item with that id (if any) **/ item = getNodeByID(system->itemList, op); if(!item) { printf("No item exists with the ID '%s', cancelling transaction.\n", \ op); return; } else if(item->data->onHand < 1) { printf("Item with ID '%s' is out of stock, cancelling transaction.\n",\ op); return; } /** Temporary holders for calculations **/ dollars = item->data->price.dollars; cents = item->data->price.cents; remaining = (dollars * 100); remaining += cents; textFormatPrice(price, dollars, cents); /** Print description **/ printf("You have selected \"%s %s\". This will cost you %s.\n", \ item->data->name, item->data->desc, price); printf("Please hand over the money - type in the value of each "); printf("note/coin in cents.\n"); printf("Press enter on a new and empty line to cancel this purchase:\n"); while(change < 0) { /** Reset change for check **/ change = -1; printf("You still need to give us %s:", price); /** User input **/ iVal = getInput(op, sizeof(op)); if(iVal == 0) printf("Error: '%s' is not a valid denomination of money.\n", op); else if (iVal == -1) { printf("Cancelling purchase\n"); printf("Returning to main menu...\n"); return; } payment = atoi(op); if(!isPaymentValid(payment)) { printf("Error: '%s' is not a valid denomination of money.\n", \ op); continue; } /** Calculate change **/ if(payment > remaining) change = (remaining - payment) * -1; else if(payment == remaining) change = 0; handlePartPayment(&remaining, payment, price); coinsGiven[getDenomPos(system->cashRegister, \ convertCoinToDenom(payment))].count += 1; /** Finish transaction, give change **/ if(change >= 0) { if(!calculateChange(change, coinsGiven, system, item)) { printf("Not enough change to process your request.\n"); printf("Returning you to the main menu.\n"); return; } /** Reduce amount available **/ item->data->onHand -= 1; printf("Please come back soon.\n"); } } } /** * You must save all data to the data files that were provided on the command * line when the program loaded up, display goodbye and free the system. * This function implements requirement 6 of the assignment specification. **/ void saveAndExit(VmSystem * system) { saveStock(system); saveCoins(system); printf("Goodbye\n"); systemFree(system); exit(EXIT_SUCCESS); } /** * This option adds an item to the system. This function implements * requirement 7 of of assignment specification. **/ void addItem(VmSystem * system) { int i, iVal; Node *newItem; Boolean priceValid = FALSE, dolExist = FALSE; char price[10], tmp[10]; newItem = malloc(sizeof(Node)); newItem->data = malloc(sizeof(Stock)); getNewID(system->itemList, newItem->data->id); printf("This new meal item will have the Item id of %s.\n", newItem->data->id); printf("Enter the item name: "); while(TRUE) { iVal = getInput(newItem->data->name, NAME_LEN); if(iVal == 0) printf("Name is invalid, must be less than %d characters.\n", \ NAME_LEN); else if (iVal == -1) { printf("Cancelling new item\n"); free(newItem->data); free(newItem); printf("Returning to main menu..\n"); return; } else break; } printf("Enter the item description: "); while(TRUE) { iVal = getInput(newItem->data->desc, DESC_LEN); if(iVal == 0) printf("Description is invalid, must be less than %d characters.\n", \ DESC_LEN); else if (iVal == -1) { printf("Cancelling new item\n"); free(newItem->data); free(newItem); printf("Returning to main menu..\n"); return; } else break; } printf("Enter the price for this item: "); while(!priceValid) { while(TRUE) { iVal = getInput(price, sizeof(price)); if(iVal == 0) printf("\nPrice entered is invalid, must be less than 10 characters: "); else if (iVal == -1) { printf("Cancelling new item\n"); free(newItem->data); free(newItem); printf("Returning to main menu..\n"); return; } else break; } if(price[strlen(price) - 3] != '.') { printf("\nPrice entered is invalid, must be in form DOLLAR.CENTS: "); continue; } /** Validate cents **/ tmp[0] = price[strlen(price) - 2]; tmp[1] = price[strlen(price) - 1]; tmp[2] = '\0'; if(atoi(tmp) == 0 && tmp[0] != '0' && tmp[1] != '0') { printf("\nPrice entered is invalid, must be in form DOLLAR.CENTS: "); continue; } /** Validate dollars (remove cents then try atoi) **/ price[strlen(price) - 3] = '\0'; for(i = 0; i < strlen(price); ++i) { if(price[i] != '0') dolExist = TRUE; } if(atoi(price) == 0 && dolExist) { printf("\nPrice entered is invalid, must be in form DOLLAR.CENTS: "); continue; } /** Set price **/ newItem->data->price.dollars = atoi(price); newItem->data->price.cents = atoi(tmp); priceValid = TRUE; } /** Add default amount **/ newItem->data->onHand = DEFAULT_STOCK_LEVEL; /** Print details **/ printf("This item \"%s - %s\" has now been added to the menu.\n", \ newItem->data->name, \ newItem->data->desc); /** Add stock to system **/ pushNode(system->itemList, newItem); /** Re-sort the stock **/ sortStock(system->itemList); } /** * Remove an item from the system, including free'ing its memory. * This function implements requirement 8 of the assignment specification. **/ void removeItem(VmSystem * system) { int iVal; char itemId[ID_LEN + NULL_SPACE]; Node * remove; Boolean success = FALSE; while(!success) { printf("Enter the item id of the item to remove from the menu: "); while(TRUE) { iVal = getInput(itemId, ID_LEN); if(iVal == 0) printf("Id length invalid, try again: "); else if (iVal == -1) { printf("Cancelling item removal\n"); remove = NULL; printf("Returning to main menu..\n"); return; } else break; } remove = getNodeByID(system->itemList, itemId); if(!remove) { printf("\nId entered does not exist.\n"); continue; } printf("\"%s - %s %s\" has been removed from the system.\n", \ remove->data->id, \ remove->data->name, \ remove->data->desc); success = TRUE; } freeNode(system->itemList, remove); printf("Returning to main menu...\n"); } /** * This option will require you to display the coins from lowest to highest * value and the counts of coins should be correctly aligned. * This function implements part 4 of requirement 18 in the assignment * specifications. **/ void displayCoins(VmSystem * system) { int i, titleLength = 12; char denomTitle[] = "Denomination"; char countTitle[] = "Count"; printf("Coins Summary\n"); printf("---------\n"); printf("%-*s | %s\n", titleLength, denomTitle, \ countTitle); for(i = NUM_DENOMS; i >= 0; --i) { switch(system->cashRegister[i].denom) { case 0: printf("%-*s | %d", titleLength, "5 cents",\ system->cashRegister[i].count); break; case 1: printf("%-*s | %d", titleLength, "10 cents",\ system->cashRegister[i].count); break; case 2: printf("%-*s | %d", titleLength, "20 cents",\ system->cashRegister[i].count); break; case 3: printf("%-*s | %d", titleLength, "50 cents",\ system->cashRegister[i].count); break; case 4: printf("%-*s | %d", titleLength, "1 dollar",\ system->cashRegister[i].count); break; case 5: printf("%-*s | %d", titleLength, "2 dollars",\ system->cashRegister[i].count); break; case 6: printf("%-*s | %d", titleLength, "5 dollars",\ system->cashRegister[i].count); break; case 7: printf("%-*s | %d", titleLength, "10 dollars",\ system->cashRegister[i].count); break; } printf("\n"); } } /** * This option will require you to iterate over every stock in the * list and set its onHand count to the default value specified in * the startup code. * This function implements requirement 9 of the assignment specification. **/ void resetStock(VmSystem * system) { int i; Node * tmp; for(i = 0; i < system->itemList->size; ++i) { tmp = getNodeByPos(system->itemList, i); tmp->data->onHand = DEFAULT_STOCK_LEVEL; } printf("All stock has been reset to their default levels of '%d'\n", \ DEFAULT_STOCK_LEVEL); } /** * This option will require you to iterate over every coin in the coin * list and set its 'count' to the default value specified in the * startup code. * This requirement implements part 3 of requirement 18 in the * assignment specifications. **/ void resetCoins(VmSystem * system) { int i; for (i = 0; i < NUM_DENOMS; ++i) changeCoinCount(&system->cashRegister[i], DEFAULT_COIN_COUNT); printf("All coins have been reset to their default levels of '%d'\n", \ DEFAULT_COIN_COUNT); } /** * This option will require you to display goodbye and free the system. * This function implements requirement 10 of the assignment specification. **/ void abortProgram(VmSystem * system) { systemFree(system); printf("Goodbye.\n"); exit(EXIT_FAILURE); }
ad576fa1c41653dc28a723fb14a1aa563aff3965
8fddb4b4ac050324fc70990dddfa447861022a38
/src/methods.c
a214489ed6d21a3926acf5fc8209eae9b5971218
[]
no_license
ernestoriv7/APU-performance-evaluation
b4709cb0ded7a1cbc0dcd198f3fe426b0a9b9e74
1c0568abcc8fab284c293d5142d088226eec07b1
refs/heads/master
2020-04-24T04:51:54.868206
2019-02-20T17:25:15
2019-02-20T17:25:15
null
0
0
null
null
null
null
UTF-8
C
false
false
20,999
c
methods.c
#include"methods.h" int verifyShadow(Vector *intersect, Scene *scene, ElementNode *light); Vector recoverIntersectionColor(Float tvalue, Ray *ray, GenericShape *object, Scene *scene, int levels, int transparencies); Interinfo intersectionBrute(Ray *rayscene, GenericShape *shape); Interinfo intersectionBruteBox(Ray *rayscene, GenericShape *shape); int shadowIntersectBrute(Ray *shadray, Float lightdist); int shadowIntersectBrute(Ray *shadray, Float lightdist) { Float tintersect = 0; for(int i=0; i < scene->sizeScene; i++){ GenericShape primitive = scene->prim[i]; tintersect = getIntersection(shadray, &primitive); if(tintersect > epsilom && tintersect < lightdist){ return 1; } } return 0; } int intersectionBVHShadow(Ray *shadray, Float lightdist) { Float boxintersect = 0; int toVisitOffset = 0; int currentNodeIndex = 0; int nodesToVisit[128]; while (true) { LinearBVHNode *node = &scene->bvhNodes[currentNodeIndex]; // Check ray against BVH node boxintersect = intersectsBox(shadray, &node->bounds); if (boxintersect > epsilom) { if (node->nPrimitives > 0) { // Intersect ray with primitives in leaf BVH node Float tintersect = getIntersection(shadray, &scene->orderedPrims[node->primitivesOffset]); if (tintersect > epsilom && tintersect < lightdist){ return 1; } if (toVisitOffset == 0) break; currentNodeIndex = nodesToVisit[--toVisitOffset]; } else { // Put far BVH node on _nodesToVisit_ stack, advance to near // node Float t1 = intersectsBox(shadray, &scene->bvhNodes[currentNodeIndex+1].bounds); Float t2 = intersectsBox(shadray, &scene->bvhNodes[node->secondChildOffset].bounds); if(t1 == -1) t1 = 9999999; if(t2 == -1) t2 = 9999999; if (t2 < t1) { nodesToVisit[toVisitOffset++] = currentNodeIndex + 1; currentNodeIndex = node->secondChildOffset; } else { nodesToVisit[toVisitOffset++] = node->secondChildOffset; currentNodeIndex = currentNodeIndex + 1; } } } else { if (toVisitOffset == 0) break; currentNodeIndex = nodesToVisit[--toVisitOffset]; } } return 0; } Interinfo intersectionBrute(Ray *rayscene, GenericShape *shape) { Interinfo finalintersection = {9999999,0}; Float tintersect = 0; for(int i=0; i < scene->sizeScene; i++){ GenericShape primitive = scene->prim[i]; tintersect = getIntersection(rayscene, &primitive); if(tintersect > epsilom && tintersect < finalintersection.t){ finalintersection.t = tintersect; finalintersection.position = i; } } return finalintersection; } Interinfo intersectionBruteBox(Ray *rayscene, GenericShape *notused) { int sizeScene = scene->sizeScene; Interinfo finalintersection = {9999999,0}; Float tintersect = 0; for(int i=0; i < sizeScene; i++){ GenericShape shape = scene->prim[i]; if(shape.shapetype == SPHERE){ Bbox prueba = sphereBox(shape); tintersect = intersectsBox(rayscene, &prueba); } else if(shape.shapetype == CYL){ Bbox prueba = cylinderBox(shape); tintersect = intersectsBox(rayscene, &prueba); } else if(shape.shapetype == CONE){ Bbox prueba = coneBox(shape); tintersect = intersectsBox(rayscene, &prueba); } else if(shape.shapetype == DISC){ Bbox prueba = discBox(shape); tintersect = intersectsBox(rayscene, &prueba); } else if(shape.shapetype == TRIANGLE){ Bbox prueba = triangleBox(shape); tintersect = intersectsBox(rayscene, &prueba); } if(tintersect > 0 && tintersect < finalintersection.t){ finalintersection.t = tintersect; finalintersection.position = i; } } return finalintersection; } Interinfo intersectionBVH(Ray *rayscene, GenericShape *primitives, LinearBVHNode *nodes, int sizeScene) { Interinfo finalint = {9999999,0}; Float boxintersect = 0; int toVisitOffset = 0; int currentNodeIndex = 0; int nodesToVisit[128]; while (true) { LinearBVHNode *node = &nodes[currentNodeIndex]; // Check ray against BVH node boxintersect = intersectsBox(rayscene, &node->bounds); if (boxintersect > epsilom && boxintersect < finalint.t ) { if (node->nPrimitives > 0) { // Intersect ray with primitives in leaf BVH node Float tintersect = getIntersection(rayscene, &primitives[node->primitivesOffset]); if (tintersect > epsilom && tintersect < finalint.t){ finalint.t = tintersect; finalint.position = node->primitivesOffset; } if (toVisitOffset == 0) break; currentNodeIndex = nodesToVisit[--toVisitOffset]; } else { // Put far BVH node on _nodesToVisit_ stack, advance to near // node Float t1 = intersectsBox(rayscene, &nodes[currentNodeIndex+1].bounds); Float t2 = intersectsBox(rayscene, &nodes[node->secondChildOffset].bounds); if(t1 == -1) t1 = 9999999; if(t2 == -1) t2 = 9999999; if (t2 < t1) { nodesToVisit[toVisitOffset++] = currentNodeIndex + 1; currentNodeIndex = node->secondChildOffset; } else { nodesToVisit[toVisitOffset++] = node->secondChildOffset; currentNodeIndex = currentNodeIndex + 1; } } } else { if (toVisitOffset == 0) break; currentNodeIndex = nodesToVisit[--toVisitOffset]; } } return finalint; } //Acceleration type will be used here Vector whichColorIsIt(Ray *ray, int x, int y) { Vector background = {0.5, 0.5, 0.5}; Vector refraction = {0.1, 0.1, 0.1}; int toVisitOffset = 0; int currentNodeIndex = 0; nodesTree dfsNodes[128]; nodesTree raysToVisit[128]; int levels = scene->levels; int transparencies = scene->transparencies; int parentpos = 0; Ray iray = *ray; Float intensitydif; Float intensityspe; int colortype = 1; Vector color = {0,0,0}; SceneLights *lights = initSceneLights(); int sizeLights = size(scene->lights); GenericShape *primitives; if(scene->acceleration == ON) primitives = scene->orderedPrims; else primitives = scene->prim; while(true){ Interinfo inter; if(scene->acceleration == ON) inter = intersectionBVH(&iray, primitives, scene->bvhNodes, scene->sizeScene); else inter = intersectionBrute(&iray, primitives); if(inter.t == 9999999){ dfsNodes[currentNodeIndex].inter = inter; dfsNodes[currentNodeIndex].color = background; dfsNodes[currentNodeIndex].parentpos = parentpos; dfsNodes[currentNodeIndex].colortype = colortype; currentNodeIndex++; } else{ //Aca tenemos interseccion // Guardamos este rayo con su respectiva interseccion Float o1= primitives[inter.position].o1; Float o2= primitives[inter.position].o2; Float o3= primitives[inter.position].o3; intensitydif = lights[0].val; intensityspe = 0; Vector intersection = intersectionPoint(&iray, inter.t); Vector N = objectNormal(intersection, primitives[inter.position]); Vector V = inverseVector(&iray.origin, &intersection); for(int i=1; i <= sizeLights; i++){ Vector L = lightVectorL(intersection, lights[i].par); Vector R = reflexVector(&L, &N); Ray raythread = {intersection, R}; if(levels > 0 && o2 != 0){ toVisitOffset++; raysToVisit[toVisitOffset].ray = raythread; raysToVisit[toVisitOffset].parentpos = currentNodeIndex; raysToVisit[toVisitOffset].colortype = 2; raysToVisit[toVisitOffset].levels = levels-1; raysToVisit[toVisitOffset].transparencies = transparencies; rayscounter[matrixOffset(x, y, scene->dimx)] += 1; } if(transparencies > 0 && o3 != 0){ toVisitOffset++; raythread.direction = addVector(&iray.direction, &refraction); raythread.direction = normalizedVector(&raythread.direction); raysToVisit[toVisitOffset].ray = raythread; raysToVisit[toVisitOffset].parentpos = currentNodeIndex; raysToVisit[toVisitOffset].colortype = 3; raysToVisit[toVisitOffset].levels = levels; raysToVisit[toVisitOffset].transparencies = transparencies-1; rayscounter[matrixOffset(x, y, scene->dimx)] += 1; } Ray shadow; shadow.origin = intersection; Vector dir = lights[i].par; dir = substractVector(&dir, &shadow.origin); shadow.direction = normalizedVector(&dir); Float lightdst = vectorNorm(&dir); rayscounter[matrixOffset(x, y, scene->dimx)] += 1; int shadowcheck; if(scene->acceleration == ON) shadowcheck = intersectionBVHShadow(&shadow, lightdst); else shadowcheck = shadowIntersectBrute(&shadow, lightdst); if(shadowcheck){ } else{ Float difuse = difuseLight(&L, &N, &intersection, lights[i].val, primitives[inter.position].kd); Float specular= specularLight(&V, &R, &intersection, lights[i].val, primitives[inter.position].kn, primitives[inter.position].ks); intensitydif += difuse; intensityspe += specular; } } dfsNodes[currentNodeIndex].ray = iray; dfsNodes[currentNodeIndex].inter = inter; dfsNodes[currentNodeIndex].color = multiplyConstantVector(o1, primitives[inter.position].color); dfsNodes[currentNodeIndex].parentpos = parentpos; dfsNodes[currentNodeIndex].intensitydif = intensitydif; dfsNodes[currentNodeIndex].intensityspe = intensityspe; dfsNodes[currentNodeIndex].colortype = colortype; currentNodeIndex++; } if(toVisitOffset == 0){ break; } else{ iray = raysToVisit[toVisitOffset].ray; levels = raysToVisit[toVisitOffset].levels; transparencies = raysToVisit[toVisitOffset].transparencies; parentpos = raysToVisit[toVisitOffset].parentpos; colortype = raysToVisit[toVisitOffset].colortype; toVisitOffset--; } } for(int i = currentNodeIndex - 1; i >= 0; i--){ if(i == 0 && dfsNodes[i].inter.t == 9999999){ return dfsNodes[i].color; } else if(i == 0){ color = dfsNodes[i].color; color = difuseColor(&color, fmin(1, dfsNodes[i].intensitydif)); color = specularColor(&color, fmin(1, dfsNodes[i].intensityspe)); } else if(dfsNodes[i].colortype == 2){ int parentprim = dfsNodes[dfsNodes[i].parentpos].inter.position; Float o2 = primitives[parentprim].o2; Vector thiscol = dfsNodes[i].color; if(dfsNodes[i].inter.t == 9999999){ thiscol = multiplyConstantVector(o2, thiscol); Vector parentcolor = dfsNodes[dfsNodes[i].parentpos].color; dfsNodes[dfsNodes[i].parentpos].color = addVector(&parentcolor, &thiscol); } else{ thiscol = difuseColor(&thiscol, fmin(1, dfsNodes[i].intensitydif)); thiscol = specularColor(&thiscol, fmin(1, dfsNodes[i].intensityspe)); thiscol = multiplyConstantVector(o2, thiscol); Vector parentcolor = dfsNodes[dfsNodes[i].parentpos].color; dfsNodes[dfsNodes[i].parentpos].color = addVector(&parentcolor, &thiscol); } } else if(dfsNodes[i].colortype == 3){ int parentprim = dfsNodes[dfsNodes[i].parentpos].inter.position; Float o3 = primitives[parentprim].o3; Vector thiscol = dfsNodes[i].color; if(dfsNodes[i].inter.t == 9999999){ thiscol = multiplyConstantVector(o3, thiscol); Vector parentcolor = dfsNodes[dfsNodes[i].parentpos].color; dfsNodes[dfsNodes[i].parentpos].color = addVector(&parentcolor, &thiscol); } else{ thiscol = difuseColor(&thiscol, fmin(1, dfsNodes[i].intensitydif)); thiscol = specularColor(&thiscol, fmin(1, dfsNodes[i].intensityspe)); thiscol = multiplyConstantVector(o3, thiscol); Vector parentcolor = dfsNodes[dfsNodes[i].parentpos].color; dfsNodes[dfsNodes[i].parentpos].color = addVector(&parentcolor, &thiscol); } } } return color; } Vector antialiasColor(int x, int y){ Ray raythread; initrayscene( &raythread, scene); Vector finalcolor; Vector intermediate; Float average = (Float)1/5; Float offset= (Float)1/2; raythread.direction = obtainNormalizedDirection(x, y); rayscounter[matrixOffset(x, y, scene->dimx)] += 1; finalcolor = whichColorIsIt(&raythread, x, y); raythread.direction = obtainNormalizedDirection(x-offset, y); rayscounter[matrixOffset(x, y, scene->dimx)] += 1; intermediate = whichColorIsIt(&raythread, x, y); finalcolor = addVector(&finalcolor, &intermediate); raythread.direction = obtainNormalizedDirection(x+offset, y); rayscounter[matrixOffset(x, y, scene->dimx)] += 1; intermediate = whichColorIsIt(&raythread, x, y); finalcolor = addVector(&finalcolor, &intermediate); raythread.direction = obtainNormalizedDirection(x, y-offset); rayscounter[matrixOffset(x, y, scene->dimx)] += 1; intermediate = whichColorIsIt(&raythread, x, y); finalcolor = addVector(&finalcolor, &intermediate); raythread.direction = obtainNormalizedDirection(x, y+offset); rayscounter[matrixOffset(x, y, scene->dimx)] += 1; intermediate = whichColorIsIt(&raythread, x, y); finalcolor = addVector(&finalcolor, &intermediate); finalcolor.x = finalcolor.x * average; finalcolor.y = finalcolor.y * average; finalcolor.z = finalcolor.z * average; return finalcolor; } /* Vector whichColorIsIt(Ray *rayscene, Scene *scene, int levels, int transparencies){ Vector color; Interinfo intersection; if(scene->acceleration == ON){ intersection = intersectionBVH(rayscene, scene->orderedPrims, scene->bvhNodes, scene->sizeScene); if (intersection.t != 9999999){ GenericShape primitive= scene->orderedPrims[intersection.position]; color = recoverIntersectionColor(intersection.t, rayscene, &primitive, scene, levels, transparencies); return color; } else return background; } else{ intersection = intersectionBrute(rayscene, scene->prim); if (intersection.t != 9999999){ GenericShape primitive= scene->prim[intersection.position]; color = recoverIntersectionColor(intersection.t, rayscene, &primitive, scene, levels, transparencies); return color; }else return background; } return background; } int verifyShadow(Vector *intersect, Scene *scene, ElementNode *light){ Ray shadow; shadow.origin = *intersect; Vector dir = substractVector(light->data->position, &shadow.origin); shadow.direction = normalizedVector(&dir); Float distanceLight = vectorNorm(&dir); if(scene->acceleration == ON) return shadowIntersectBVH(&shadow, distanceLight); else return shadowIntersectBrute(&shadow, distanceLight); } Vector recoverIntersectionColor(Float tvalue, Ray *ray, GenericShape *object, Scene *scene, int levels, int transparencies) { LightAmbient *lightAmbient = scene->ambientLight; ElementNode *lights = scene->lights; Float intensitydif= lightAmbient->value*object->ka; Float intensityspe= 0; Vector intersection = intersectionPoint(ray, tvalue); Vector N; if(object->shapetype == SPHERE){ Float radius = object->rad; N = normalVectorSphere(intersection, object->position, radius); } else if(object->shapetype == CYL){ Float radius = object->rad; Vector direction = object->vec0; N = normalVectorCylinder(intersection, object->position, direction, radius); } else if(object->shapetype == CONE){ Vector direction = object->vec0; N = normalVectorCone(intersection, object->position, direction); } else if(object->shapetype == DISC){ N.x = object->cnst.A; N.y = object->cnst.B; N.z = object->cnst.C; } else if(object->shapetype == TRIANGLE){ N.x = object->cnst.A; N.y = object->cnst.B; N.z = object->cnst.C; N = negateVector(&N); } Vector color = object->color; Vector V = inverseVector(&ray->origin, &intersection); Float o1= object->o1; Float o2= object->o2; Float o3= object->o3; color = multiplyConstantVector(o1, color); int sizeLights = size(lights), i; for(i=0; i < sizeLights; i++){ ElementNode *currentLight = getAt(&lights,i); Vector L = lightVectorL(intersection, *currentLight->data->position); //N = obtainPositiveNormal(object->type, N, L); Vector R = reflexVector(&L, &N); Ray raythread = {intersection, R}; if((levels > 0 && o2 != 0)){ Vector colorreflected = multiplyConstantVector(o2, whichColorIsIt(&raythread, scene, levels-1, transparencies)); color = addVector(&color, &colorreflected); } if(transparencies > 0 && o3 != 0){ raythread.direction = ray->direction; Vector colortransparencies = multiplyConstantVector(o3, whichColorIsIt(&raythread, scene, levels, transparencies -1)); color = addVector(&color, &colortransparencies); } if(verifyShadow(&intersection, scene, currentLight)){ } else{ Float difuse = difuseLight(&L, &N, &intersection, currentLight->data, object->kd); Float specular= specularLight(&V, &R, &intersection, currentLight->data, object->kn, object->ks); intensitydif += difuse; intensityspe += specular; } } color = difuseColor(&color, fmin(1, intensitydif)); color = specularColor(&color, fmin(1, intensityspe)); return color; } */
fbb1efbd2e98b11f8e89ab4b21487524cdfe16d6
c0396795de81276ca51ff390715b6a11cfee17c8
/PhotoelectricSystemDesign/PESD_Device/wf/HardwareProfile.h
4dded2ba30b78078f0953da8d9bdf380396cb29d
[]
no_license
wangf0228GitHub/ZXJ
d98e5d5a74c4c843402521088340203d2990e1e2
a0cfe7ac10efaa65295e68a6e90459288cb5e06b
refs/heads/master
2022-03-08T19:53:24.419825
2022-03-07T02:08:42
2022-03-07T02:08:42
117,209,951
0
2
null
null
null
null
UTF-8
C
false
false
614
h
HardwareProfile.h
#ifndef __HardwareProfile_H__ #define __HardwareProfile_H__ #include "gpio.h" #include "wfSys.h" #include "wfDefine.h" #define Verify_Sum #include "Verify.h" #define CP1616_Client_AddrLen 0 #define CP1616_Client_DataBufLen 2 #define SetRx_CP1616_Client() #define SetTx_CP1616_Client() #define CP1616_Client_NeedCheckVerify #include "usart.h" #define CP1616_Client_TxProc(List,Index) HAL_UART_Transmit(&huart1,List,Index,1000) #define CP1616_Client_VerifyProc(pBuf,len) GetVerify_Sum(pBuf,len) #define CP1616_Client_RxList_LenMax 100 #define CP1616_Client_TxList_LenMax 100 #include "CP1616_Client.h" #endif
025a1692c1b927c1afbdd2b27fada10014c48b57
bca2abf07c7dbb885899c257e6c8ad9d75717eec
/ClmbsImg_Util.h
22befb31ffa9eea883dd741cbbaa8cb098ec23af
[]
no_license
ColumbusUtrigas/ColumbusImage
233231ed973376d3c5680c316b871c78118b6418
00bae4223cf55abedae8a088dfbb297f25d9c563
refs/heads/master
2021-09-06T14:28:23.877836
2018-02-07T14:33:22
2018-02-07T14:33:22
112,632,844
1
1
null
null
null
null
UTF-8
C
false
false
1,012
h
ClmbsImg_Util.h
#include "ColumbusImage.h" #include <stdio.h> #include <stdint.h> #ifdef __cplusplus extern "C" { #endif int ReadBytes(void* data, size_t size, FILE* fp); int WriteBytes(const void* data, size_t size, FILE* fp); int ReadUint8(uint8_t* data, FILE* fp); int WriteUint8(const uint8_t* data, FILE* fp); int ReadUint16(uint16_t* data, FILE* fp); int WriteUint16(const uint16_t* data, FILE* fp); int ReadUint32(uint32_t* data, FILE* fp); int WriteUint32(const uint32_t* data, FILE* fp); int ReadInt32(int32_t* data, FILE* fp); int WriteInt32(const int32_t* data, FILE* fp); int bgr2rgb(uint8_t* data, size_t size); int bgra2rgba(uint8_t* data, size_t size); int rgb2bgr(uint8_t* data, size_t size); int rgba2bgra(uint8_t* data, size_t size); int flipX(uint8_t* aData, size_t aWidth, size_t aHeight, size_t aBPP); int flipY(uint8_t* aData, size_t aWidth, size_t aHeight, size_t aBPP); int flipXY(uint8_t* aData, size_t aWidth, size_t aHeight, size_t aBPP); #ifdef __cplusplus } #endif
efaf4e138e5ccd926471cb0e4e3fd95432e3c0ef
9a0c470a4871e38ffdf94f1f3665edbb20541561
/rush02/ex00/srcs/ft_putchar.c
3e84c6bc45b4246809357e8130b48693ee7929a2
[]
no_license
artacone/piscine21
aa6b272bcea136d157e97eaf1b7ba86e0f1e4580
1631c4b4a50ec27bbc1d1d9c92818c0693930b41
refs/heads/main
2023-03-28T03:38:30.204398
2021-03-21T19:15:20
2021-03-21T19:15:20
330,486,444
0
0
null
null
null
null
UTF-8
C
false
false
968
c
ft_putchar.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putchar.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rvertie <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/02/06 22:10:17 by rvertie #+# #+# */ /* Updated: 2021/02/06 22:11:11 by rvertie ### ########.fr */ /* */ /* ************************************************************************** */ #include "../includes/ft.h" void ft_putchar(char c) { write(1, &c, 1); }
d2d52e89ffa518a4844224a4246c693f025587b9
40f80bc4c2967d99efd93024522c8e33b977cbb2
/00.c
0d43fc4fa8047ff1c914d50f851f2841b64d1f67
[ "MIT" ]
permissive
higorcos/Laboratorio_de_programacao
d37b249df646735508b01901c7851b6c698b31cb
639db64401121aeae533b4ccec02628feed9bfd6
refs/heads/main
2023-07-06T18:06:08.784625
2021-08-18T21:19:39
2021-08-18T21:19:39
374,670,709
0
0
null
null
null
null
UTF-8
C
false
false
79
c
00.c
/* gcc 00.c -o app ./app */ #include <stdio.h> int main() { }
173de63a2a9b35e6b7318fbbf415ad9b72972c92
72963b0304a5b29addb00ba0129588dce784518e
/tarea2/src/graph.h
f570702dc250b83685818bf752175f30e7da8980
[]
no_license
AngheloAlf/ELO320
129e6a369f4d421c57c2f0a7362343be300d76bc
bb4d797757ee35f57d8f61b6dea64bb709f30fbc
refs/heads/master
2022-04-09T20:15:54.197334
2020-04-01T16:13:05
2020-04-01T16:13:05
252,224,496
0
0
null
null
null
null
UTF-8
C
false
false
1,178
h
graph.h
#pragma once #ifndef GRAPH_H #define GRAPH_H #include <stdbool.h> #include "intmap.h" #include "edge.h" /// Estructura que representa el grafo bidireccional typedef struct{ IntMap *nodes; EdgeArr *edges; } Graph; /// Construye un grafo vacio. /// Los parametros son la cantidad de nodos y la cantidad de arcos. Graph *Graph_new(int nodes_amount, int edges_amount); /// Destruye el grafo y sus contenidos. void Graph_free(Graph *graph); /// Asigna la id `id` al nodo `pos`. /// Retorna `true` si se asignó satisfactoriamente. /// Retorna `false` si el id ya ha sido utilizado o si el nodo `pos` ya tiene una id asignada. bool Graph_set_id(Graph *graph, int pos, int id); /// Entrega el id del nodo `pos`, o -1 si dicho nodo no tiene una id asignada. int Graph_get_id(Graph *graph, int pos); /// Llena el grafo con arcos. /// Los arcos son leidos de un archivo con formato matriz, donde un cero indica que no hay arco /// y un número distinto de cero indica el Gbps de ese arco. void Graph_fill(Graph *graph, const char *filename); /// Algoritmo de kruskal para general un arbol recubridor minimo. EdgeArr *Graph_kruskal(Graph *graph); #endif /* GRAPH_H */
a7e1e11bc7888c9fc808b986c4b383353189073a
65d9620fa6038645cdddb1254bd6e52be4257c60
/HARDWARE/LED/led.c
692201ba84f3e602592f9d23526b5e5cde8da46d
[]
no_license
puu1111/407-0.01
601385da3d2ca85920f549dda415afa4d1072849
ec2cf51a053014d658724a801e717c67cf8a8d9a
refs/heads/master
2020-03-31T07:27:15.738090
2018-10-07T12:14:45
2018-10-07T12:14:45
152,021,893
0
0
null
null
null
null
GB18030
C
false
false
2,389
c
led.c
/********************************************************************* * 文件名 :led.c * 描述 :led 应用函数库 * * 实验平台:基于STM32F407VET6 开发板 * 硬件连接:----------------- * | PE13 - LED1 | * | PE14 - LED2 | * | PE15 - LED3 | * ----------------- * 库版本 :V1.0.0 ***********************************************************************/ #include "sys.h" /*************** 配置LED用到的I/O口 *******************/ void LED_Configuration(void) { GPIO_InitTypeDef GPIO_InitStructure; /* Enable the GPIO_LED Clock */ RCC_AHB1PeriphClockCmd( RCC_LED_POWER|RCC_LED_COM1|RCC_LED_COM2|RCC_LED_STRLENTH|RCC_LED_ERR, ENABLE); GPIO_InitStructure.GPIO_Pin = LED_POWER_PIN ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//GPIO_Mode_IN // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; // GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_Init(LED_POWER_PORT, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = LED_COM1_PIN ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_Init(LED_COM1_PORT, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = LED_COM2_PIN ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_Init(LED_COM2_PORT, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = LED_STRLENTH_PIN ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_Init(LED_STRLENTH_PORT, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = LED_ERR_PIN ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_Init(LED_ERR_PORT, &GPIO_InitStructure); /*初始化完后,关闭3个LED*/ LED_POWER_ON; LED_COM1_OFF; LED_COM2_OFF; LED_STRLENTH_OFF; LED_ERR_OFF; } /** * @brief Toggles the specified GPIO pins. * @param GPIOx Where x can be (A..K) to select the GPIO peripheral for STM32F429X device or * x can be (A..I) to select the GPIO peripheral for STM32F40XX and STM32F427X devices. * @param GPIO_Pin Specifies the pins to be toggled. * @retval None */ void LED_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) { GPIOx->ODR ^= GPIO_Pin; }
bee9679c5e4963788d89a0e31b53c8ba3b1e2ecf
a280aa9ac69d3834dc00219e9a4ba07996dfb4dd
/regularexpress/home/weilaidb/work/kernel/linux-3.0.8/include/linux/quotaops.h
d42a7d160f93c6b4205aad4dae3930e195a2a54e
[]
no_license
weilaidb/PythonExample
b2cc6c514816a0e1bfb7c0cbd5045cf87bd28466
798bf1bdfdf7594f528788c4df02f79f0f7827ce
refs/heads/master
2021-01-12T13:56:19.346041
2017-07-22T16:30:33
2017-07-22T16:30:33
68,925,741
4
2
null
null
null
null
UTF-8
C
false
false
5,894
h
quotaops.h
#define _LINUX_QUOTAOPS_ #define DQUOT_SPACE_WARN 0x1 #define DQUOT_SPACE_RESERVE 0x2 #define DQUOT_SPACE_NOFAIL 0x4 static inline struct quota_info *sb_dqopt(struct super_block *sb) static inline bool is_quota_modification(struct inode *inode, struct iattr *ia) #if defined(CONFIG_QUOTA) #define quota_error(sb, fmt, args...) \ __quota_error((sb), __func__, fmt , ## args) extern __attribute__((format (printf, 3, 4))) void __quota_error(struct super_block *sb, const char *func, const char *fmt, ...); void inode_add_rsv_space(struct inode *inode, qsize_t number); void inode_claim_rsv_space(struct inode *inode, qsize_t number); void inode_sub_rsv_space(struct inode *inode, qsize_t number); void dquot_initialize(struct inode *inode); void dquot_drop(struct inode *inode); struct dquot *dqget(struct super_block *sb, unsigned int id, int type); void dqput(struct dquot *dquot); int dquot_scan_active(struct super_block *sb, int (*fn)(struct dquot *dquot, unsigned long priv), unsigned long priv); struct dquot *dquot_alloc(struct super_block *sb, int type); void dquot_destroy(struct dquot *dquot); int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags); void __dquot_free_space(struct inode *inode, qsize_t number, int flags); int dquot_alloc_inode(const struct inode *inode); int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); void dquot_free_inode(const struct inode *inode); int dquot_disable(struct super_block *sb, int type, unsigned int flags); static inline int dquot_suspend(struct super_block *sb, int type) int dquot_resume(struct super_block *sb, int type); int dquot_commit(struct dquot *dquot); int dquot_acquire(struct dquot *dquot); int dquot_release(struct dquot *dquot); int dquot_commit_info(struct super_block *sb, int type); int dquot_mark_dquot_dirty(struct dquot *dquot); int dquot_file_open(struct inode *inode, struct file *file); int dquot_enable(struct inode *inode, int type, int format_id, unsigned int flags); int dquot_quota_on(struct super_block *sb, int type, int format_id, struct path *path); int dquot_quota_on_mount(struct super_block *sb, char *qf_name, int format_id, int type); int dquot_quota_off(struct super_block *sb, int type); int dquot_quota_sync(struct super_block *sb, int type, int wait); int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); int dquot_get_dqblk(struct super_block *sb, int type, qid_t id, struct fs_disk_quota *di); int dquot_set_dqblk(struct super_block *sb, int type, qid_t id, struct fs_disk_quota *di); int __dquot_transfer(struct inode *inode, struct dquot **transfer_to); int dquot_transfer(struct inode *inode, struct iattr *iattr); static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) static inline bool sb_has_quota_usage_enabled(struct super_block *sb, int type) static inline bool sb_has_quota_limits_enabled(struct super_block *sb, int type) static inline bool sb_has_quota_suspended(struct super_block *sb, int type) static inline unsigned sb_any_quota_suspended(struct super_block *sb) static inline bool sb_has_quota_loaded(struct super_block *sb, int type) static inline unsigned sb_any_quota_loaded(struct super_block *sb) static inline bool sb_has_quota_active(struct super_block *sb, int type) extern const struct dquot_operations dquot_operations; extern const struct quotactl_ops dquot_quotactl_ops; static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type) static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type) static inline int sb_has_quota_suspended(struct super_block *sb, int type) static inline int sb_any_quota_suspended(struct super_block *sb) static inline int sb_has_quota_loaded(struct super_block *sb, int type) static inline int sb_any_quota_loaded(struct super_block *sb) static inline int sb_has_quota_active(struct super_block *sb, int type) static inline void dquot_initialize(struct inode *inode) static inline void dquot_drop(struct inode *inode) static inline int dquot_alloc_inode(const struct inode *inode) static inline void dquot_free_inode(const struct inode *inode) static inline int dquot_transfer(struct inode *inode, struct iattr *iattr) static inline int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags) static inline void __dquot_free_space(struct inode *inode, qsize_t number, int flags) static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) static inline int dquot_disable(struct super_block *sb, int type, unsigned int flags) static inline int dquot_suspend(struct super_block *sb, int type) static inline int dquot_resume(struct super_block *sb, int type) #define dquot_file_open generic_file_open static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr) static inline void dquot_alloc_space_nofail(struct inode *inode, qsize_t nr) static inline int dquot_alloc_space(struct inode *inode, qsize_t nr) static inline int dquot_alloc_block_nodirty(struct inode *inode, qsize_t nr) static inline void dquot_alloc_block_nofail(struct inode *inode, qsize_t nr) static inline int dquot_alloc_block(struct inode *inode, qsize_t nr) static inline int dquot_prealloc_block_nodirty(struct inode *inode, qsize_t nr) static inline int dquot_prealloc_block(struct inode *inode, qsize_t nr) static inline int dquot_reserve_block(struct inode *inode, qsize_t nr) static inline int dquot_claim_block(struct inode *inode, qsize_t nr) static inline void dquot_free_space_nodirty(struct inode *inode, qsize_t nr) static inline void dquot_free_space(struct inode *inode, qsize_t nr) static inline void dquot_free_block_nodirty(struct inode *inode, qsize_t nr) static inline void dquot_free_block(struct inode *inode, qsize_t nr) static inline void dquot_release_reservation_block(struct inode *inode, qsize_t nr)
7084d3805d4165ad0fa6f4588c7cf906ce13e76b
f48861cac5b754c68339133e92dd61d524d2d1cd
/Chapter1/palsquare.c
92fc02e804efd8a13a577774ccadacc74fd20339
[]
no_license
asanyal902/USACO
23c144837d0fe983b17b4bd9d4e655b36e0bef90
eabe1c3f674d30fbb4784eb6091e4239e13d45dc
refs/heads/master
2016-09-06T16:38:16.644343
2013-02-18T21:14:05
2013-02-18T21:14:05
null
0
0
null
null
null
null
UTF-8
C
false
false
1,159
c
palsquare.c
/* ID: a.sanya1 LANG: C TASK: palsquare */ #include<stdio.h> #include<string.h> #define N 300 char *convert(int n,int base,char *temp){ int j=0; int k=n; while(k) {k/=base; j++;} j--; temp[j+1] = '\0'; while(n) { switch(n%base){ case 10: temp[j--] = 'A'; break; case 11: temp[j--] = 'B'; break; case 12: temp[j--] = 'C'; break; case 13: temp[j--] = 'D'; break; case 14: temp[j--] = 'E'; break; case 15: temp[j--] = 'F'; break; case 16: temp[j--] = 'G'; break; case 17: temp[j--] = 'H'; break; case 18: temp[j--] = 'I'; break; case 19: temp[j--] = 'J'; break; default: temp[j--] = n%base + '0'; break; } n /= base; } return temp; } int palin(char *temp) { int n = strlen(temp); int i,j; i=0;j=n-1; while(i<j) if(temp[i++]!=temp[j--]) return 0; return 1; } int main() { FILE *fin = fopen("palsquare.in","r"); FILE *fout = fopen("palsquare.out","w"); if(fin==NULL||fout==NULL) { fprintf(stderr,"File fuck up!"); return -1; } int base,n,i,j=0; fscanf(fin,"%d",&base); fclose(fin); char temp[30]; char temp2[10]; for(i=1;i<=N;i++) { n = i; convert(i*i,base,temp); if(palin(temp)) { convert(i,base,temp2); fprintf(fout,"%s %s\n",temp2,temp); } } fclose(fout); }
84791bc2cbd3de66af20e764ff5636aa098b33a6
a9b8423513abc9c6f1e5708d435bd99a1f0a5201
/libft/srcs/ft_convert_s.c
1eec1eec2f2bcf7aa2ec4d5133b60d5429c29050
[]
no_license
flhember/ft_nm
07e5f6ef2ae3d88e4025b1897c88c49058d22ec6
908757ee74820e9a5d961ae57cab210947dbfae7
refs/heads/master
2023-07-09T20:29:20.112464
2023-06-23T14:00:13
2023-06-23T14:00:13
358,331,852
0
0
null
null
null
null
UTF-8
C
false
false
2,774
c
ft_convert_s.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_convert_s.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: flhember <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/02/04 16:49:07 by flhember #+# #+# */ /* Updated: 2019/05/01 16:35:48 by flhember ### ########.fr */ /* */ /* ************************************************************************** */ #include "../includes/ft_printf.h" static char *ft_filling(char *var, t_option **list, char *str) { size_t i; int j; j = 0; i = 0; if ((*list)->minus) { while (var[j]) str[i++] = var[j++]; return (str); } i = ft_strlen(str) - ft_strlen(var); while (str[i]) str[i++] = var[j++]; if ((*list)->zero) { i = 0; while (str[i] == ' ') str[i++] = '0'; } return (str); } static char *ft_filling_prec(char *var, t_option **list, char *str) { int j; int i; j = 0; i = 0; if ((*list)->minus) { while (j < (*list)->prec) str[i++] = var[j++]; return (str); } i = ft_strlen(str) - (*list)->prec; while (str[i]) str[i++] = var[j++]; return (str); } static char *ft_width_min(char *var, t_option **list) { char *tmp; tmp = NULL; if ((*list)->prec == -1) return (tmp = ft_strdup("")); else if ((*list)->min > ft_strlen(var)) tmp = ft_strnewspace((*list)->min); else if ((*list)->prec != 0 && (*list)->prec < (int)ft_strlen(var) && (int)(*list)->min < (*list)->prec) tmp = ft_strnewspace((*list)->prec); else if ((*list)->prec != 0 && (*list)->prec < (int)ft_strlen(var) && (int)(*list)->min >= (*list)->prec) tmp = ft_strnewspace((*list)->min); else tmp = ft_strnewspace(ft_strlen(var)); if ((*list)->prec != 0 && (*list)->prec < (int)ft_strlen(var)) return (ft_filling_prec(var, list, tmp)); return (ft_filling(var, list, tmp)); } char *ft_convert_s(va_list ap, char *str) { t_option *list; char *tmp; int flag; flag = 1; tmp = va_arg(ap, char*); list = NULL; if (tmp == NULL) { tmp = ft_strdup("(null)"); flag = 0; } if (str[1] == 's') { ft_strdel(&str); str = ft_strdup(tmp); flag == 0 ? ft_strdel(&tmp) : tmp; return (str); } list = ft_get_option(str); ft_strdel(&str); str = ft_width_min(tmp, &list); ft_free_option(&list); flag == 0 ? ft_strdel(&tmp) : tmp; return (str); }
8d658cf29528d7d654f214c8a5b7d5c693c92159
76c1613d59ab081994b12a1468dbfcea46926110
/9cc.h
479671652e5e010ed377759aa0e6c9e5002539ea
[]
no_license
honteng/9cc
36f6e1088409d51264b0fdcd82a681ee09137329
19fc8b8e4e36e533a97475c24b2ca907eb226cee
refs/heads/master
2020-04-13T03:59:59.973708
2018-12-24T06:28:15
2018-12-24T06:28:15
162,947,962
1
0
null
null
null
null
UTF-8
C
false
false
1,432
h
9cc.h
enum { TK_NUM = 256, TK_IDENT, TK_EQ, TK_NEQ, TK_ST, // Smaller Then TK_STE, // Smaller Then or Equal to TK_GT, // Greater Then TK_GTE, // Greater Then or Equal to TK_IF, TK_ELSE, TK_RETURN, TK_FOR, TK_WHILE, TK_INT, TK_CHAR, TK_EOF, }; // For now, matching to TK_ enum { ND_NUM = 256, ND_IDENT, ND_EQ, ND_NEQ, ND_ST, // Smaller Then ND_STE, // Smaller Then or Equal to ND_GT, // Greater Then ND_GTE, // Greater Then or Equal to ND_IF, ND_ELSE, // Should not be used ND_RETURN, ND_FOR, ND_WHILE, ND_INT, ND_CHAR, ND_EOF, ND_BLOCK = 512, ND_FUNC, ND_CALL_FUNC, ND_DECL_VAR, }; typedef struct { int ty; int val; char *input; } Token; void tokenize(char *p); void program(); void error(char *str); typedef struct { void **data; int capacity; int len; } Vector; typedef struct Node { int ty; char *long_name; Vector *params; // *Node used when ND_FUNC Vector *code; // *Node struct Node *lhs; struct Node *rhs; int val; // used when ty == ND_NUM } Node; void gen(Node *node); typedef struct { Vector *keys; Vector *vals; } Map; extern Vector *tokens; // *Token extern Vector *code; // *Node extern Vector *env; // *Map Vector *new_vector(); void vec_push(Vector *vec, void *elem); void* vec_pop(Vector *vec); Map *new_map(); void map_put(Map *map, char *key, void *val); void *map_get(Map *map, char *key); void runtest();
5777f248e1d9224f0a10f9367de1157d647439bb
fd20df84056096acef94c5ee6256dde00d1817d8
/asn1cpp/general_tests/tests/SeqT1+SequenceT2seq+SetT2seq+ChoiceT2seq+SetOfT2seq+SequenceOfT2seq+SeqT1seqRef/ChoiceT2seq.h
34a9c87ed488c15949ec86516c3aab13321b730b
[ "BSD-2-Clause" ]
permissive
sidsag1/asn1cpp
6ff659223c4ef73123815ba1e4cf5979cd4676a1
da215c5d180cbcc9074f90cf397c45de6c843c69
refs/heads/master
2023-03-15T17:46:42.134590
2016-01-07T19:21:39
2016-01-07T19:21:39
null
0
0
null
null
null
null
UTF-8
C
false
false
989
h
ChoiceT2seq.h
/* * Generated by asn1c-0.9.24 (http://lionet.info/asn1c) * From ASN.1 module "ModuleTest2" * found in "SeqT1+SequenceT2Seq+SetT2seq+ChoiceT2seq+SetOfT2seq+SequenceOfT2seq+ChoiceT1seqRef.asn" */ #ifndef _ChoiceT2seq_H_ #define _ChoiceT2seq_H_ #include <asn_application.h> /* Including external dependencies */ #include "SeqT1.h" #include <IA5String.h> #include <constr_CHOICE.h> #ifdef __cplusplus extern "C" { #endif /* Dependencies */ typedef enum ChoiceT2seq_PR { ChoiceT2seq_PR_NOTHING, /* No components present */ ChoiceT2seq_PR_one, ChoiceT2seq_PR_two } ChoiceT2seq_PR; /* ChoiceT2seq */ typedef struct ChoiceT2seq { ChoiceT2seq_PR present; union ChoiceT2seq_u { SeqT1_t one; IA5String_t two; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ChoiceT2seq_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_ChoiceT2seq; #ifdef __cplusplus } #endif #endif /* _ChoiceT2seq_H_ */ #include <asn_internal.h>
cdd7f068f03412d20222b06b4293f9bba977a9bd
22212b6400346c5ec3f5927703ad912566d3474f
/cmake/Dependencies/python/Modified/config.c
b19f4128f3d17420c71a061bb8817f0c5c814510
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
irov/Mengine
673a9f35ab10ac93d42301bc34514a852c0f150d
8118e4a4a066ffba82bda1f668c1e7a528b6b717
refs/heads/master
2023-09-04T03:19:23.686213
2023-09-03T16:05:24
2023-09-03T16:05:24
41,422,567
46
17
MIT
2022-09-26T18:41:33
2015-08-26T11:44:35
C++
UTF-8
C
false
false
1,568
c
config.c
#include "Python.h" #ifdef __cplusplus extern "C" { #endif extern void initimp( void ); extern void initgc( void ); extern void initunicodedata( void ); extern void initmath( void ); extern void init_sre( void ); extern void init_struct( void ); extern void init_weakref( void ); extern void init_codecs( void ); extern void init_json( void ); extern void initbinascii( void ); extern void initzlib( void ); extern void PyMarshal_Init( void ); extern void initcStringIO( void ); #if defined(WIN32) && !defined(NDEBUG) && !defined(__MINGW32__) extern void init_lsprof( void ); extern void initerrno( void ); extern void init_functools( void ); extern void inittime( void ); #endif struct _inittab _PyImport_Inittab[] = { {"__main__", NULL}, {"__builtin__", NULL}, {"sys", NULL}, {"exceptions", NULL}, {"imp", initimp}, {"math", initmath}, {"_sre", init_sre}, {"_struct", init_struct}, {"_codecs", init_codecs}, {"_json", init_json}, {"binascii", initbinascii}, {"zlib", initzlib}, {"gc", initgc}, {"_weakref", init_weakref}, {"cStringIO", initcStringIO}, {"marshal", PyMarshal_Init}, #if defined(WIN32) && !defined(NDEBUG) && !defined(__MINGW32__) {"_lsprof", init_lsprof}, {"errno", initerrno}, {"_functools", init_functools}, {"time", inittime}, #endif /* Sentinel */ {0, 0} }; #ifdef __cplusplus } #endif
c753857b9dee8158a98c887e295e7177f2df229b
e3559f228d434002e3080994696e577aeff98ef8
/WebPage.h
2a90d0f35142d0af2681fe771044509a101a9d9c
[]
no_license
jakaisna/JWS-ESP8266-P10-NTP
3f33ab295eafa42c91274e691405e9dd121bb5cc
88bd24064b5a4a3caf31b774d43c4d5b6fbd5816
refs/heads/master
2022-04-24T03:57:20.157856
2020-04-21T11:52:40
2020-04-21T11:52:40
257,516,956
2
0
null
null
null
null
UTF-8
C
false
false
14,568
h
WebPage.h
String message, XML; char setwaktu[] PROGMEM = R"=====( <!DOCTYPE HTML> <html> <meta name='viewport' content='width=device-width, initial-scale=1'> <head> <title>Car Display</title> <style> body { width: 97% ; text-align: center; } input, select, button, textarea { max-width: 100% ; margin: 5px; padding: 5px; border-radius: 7px; } meter, progress, output { max-width: 100% ; } h1 { color: grey; } .note { color: #555; font-size:1em;} .info { background-color: #eee; border-radius: 3px; padding-top: 17px; margin: 5px;} .tombol { background-color: #ccc; margin: 20px; padding: 10px; border-radius: 10px; text-decoration: none;}</style> </head> <body onload='process()'> <h1>Ubah Waktu</h1> <div class='info'> <span id='day'></span>/<span id='month'></span>/<span id='year'></span><span> </span> <span id='hour'></span>:<span id='minute'></span>:<span id='second'></span><span> </span> <span id='temp'></span><span>C</span><br><br> </div> <table width='100%'> <tr> <td> <form > <h4>Tanggal</h4> <input type='date' name='date' min='2017-03-20'><br><br> <input type='submit' value='Ubah Tanggal'> </form> </td> <td> <form > <h4>Jam</h4> <input type='TIME' name='time'><br><br> <input type='submit' value='Ubah Jam'> </form> </td> </tr> </table> <br><br> <h5><a class ='tombol' href="/setjws">Jam Sholat</a></h5> <h5><a class ='tombol' href="/setwifi">Wifi</a></h5> <h5><a class ='tombol' href="/setdisplay">Display</a></h5> <br><br><br> </body> </html> <script> var xmlHttp=createXmlHttpObject(); function createXmlHttpObject(){ if(window.XMLHttpRequest){ xmlHttp=new XMLHttpRequest(); }else{ xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');// code for IE6, IE5 } return xmlHttp; } function process(){ if(xmlHttp.readyState==0 || xmlHttp.readyState==4){ xmlHttp.open('PUT','xml',true); xmlHttp.onreadystatechange=handleServerResponse; xmlHttp.send(null); } setTimeout('process()',1000); } function handleServerResponse(){ if(xmlHttp.readyState==4 && xmlHttp.status==200){ xmlResponse=xmlHttp.responseXML; xmldoc = xmlResponse.getElementsByTagName('rYear'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('year').innerHTML=message; xmldoc = xmlResponse.getElementsByTagName('rMonth'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('month').innerHTML=message; xmldoc = xmlResponse.getElementsByTagName('rDay'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('day').innerHTML=message; xmldoc = xmlResponse.getElementsByTagName('rHour'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('hour').innerHTML=message; xmldoc = xmlResponse.getElementsByTagName('rMinute'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('minute').innerHTML=message; xmldoc = xmlResponse.getElementsByTagName('rSecond'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('second').innerHTML=message; xmldoc = xmlResponse.getElementsByTagName('rTemp'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('temp').innerHTML=message; } } </script> </html> )====="; char setjws[] PROGMEM = R"=====( <html> <meta name="viewport" content="width=device-width, initial-scale=1"> <head> <title>Car Display</title> <style> body { width: 97% ; text-align: center; } td {text-align: center;} input, select, button, textarea { max-width: 100% ; margin: 5px; padding: 5px; border-radius: 7px; } meter, progress, output { max-width: 100% ; } h1,h2,h3,h4 { color: grey; } .note { color: #555; font-size:1em;} .info { background-color: #eee; border-radius: 3px; padding-top: 17px; margin: 5px;} .tombol { background-color: #ccc; margin: 20px; padding: 10px; border-radius: 10px; text-decoration: none;}</style> </head> <body onload='process()'> <h1>Waktu Sholat</h1> <h4>Iqomah</h4> <form> <table width='100%'> <tr> <td> <label for="iqmhs">Subuh</label><br> <input id="iqmhs" placeholder="12" maxlength="2" size="3"/> </td> <td> <label for="iqmhd">Dzuhur</label><br> <input id="iqmhd" placeholder="8" maxlength="2" size="3"/> </td> <td> <label for="iqmha">Ashar</label><br> <input id="iqmha" placeholder="6" maxlength="2" size="3"/> </td> </tr> <tr> <td> <label for="iqmhm">Maghrib</label><br> <input id="iqmhm" placeholder="5" maxlength="2" size="3"/> </td> <td> <label for="iqmhi">Isya</label><br> <input id="iqmhi" placeholder="5" maxlength="2" size="3"/> </td> <td> <label for="durasiadzan">Adzan</label><br> <input id="durasiadzan" placeholder="2" maxlength="2" size="3"/> </td> </tr> </table> <table width='100%'> <tr> <td> <label for="latitude">Latitude</label><br> <input id="latitude" placeholder="-6.165010" size="9"/> </td> <td> <label for="longitude">Longitude</label><br> <input id="longitude" placeholder="106.608892" size="9"/> </td> </tr> <tr> <td> <label for="zonawaktu">Zona Waktu</label><br> <input id="zonawaktu" placeholder="7" size="3"/> </td> <td> <label for="ihti">Ihtiyati</label><br> <input id="ihti" placeholder="2" maxlength="2" size="3"/> </td> </tr> </table> <br> <div> <label for="nama">Nama</label> <input id="nama" placeholder="Nama"/> </div> <div> <label for="info1">Info Satu</label> <input id="info1" placeholder="Ini adalah isi dari Info Satu"/> </div> <div> <label for="info2">Info Dua</label> <input id="info2" placeholder="Ini adalah isi dari Info Dua"/> </div> <br> <div> <button onClick="setJws()"> Simpan </button> </div> </form> <br><br> <h5><a class ='tombol' href="/">Kembali</a></h5> <h5><a class ='tombol' href="/setwifi">Wifi</a></h5> <h5><a class ='tombol' href="/setdisplay">Display</a></h5> <br><br><br> </body> <script> var xmlHttp=createXmlHttpObject(); function createXmlHttpObject(){ if(window.XMLHttpRequest){ xmlHttp=new XMLHttpRequest(); }else{ xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');// code for IE6, IE5 } return xmlHttp; } function process(){ if(xmlHttp.readyState==0 || xmlHttp.readyState==4){ xmlHttp.open('PUT','xml',true); xmlHttp.onreadystatechange=handleServerResponse; xmlHttp.send(null); } } function handleServerResponse(){ if(xmlHttp.readyState==4 && xmlHttp.status==200){ xmlResponse=xmlHttp.responseXML; xmldoc = xmlResponse.getElementsByTagName('rIqmhs'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('iqmhs').value=message; xmldoc = xmlResponse.getElementsByTagName('rIqmhd'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('iqmhd').value=message; xmldoc = xmlResponse.getElementsByTagName('rIqmha'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('iqmha').value=message; xmldoc = xmlResponse.getElementsByTagName('rIqmhm'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('iqmhm').value=message; xmldoc = xmlResponse.getElementsByTagName('rIqmhi'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('iqmhi').value=message; xmldoc = xmlResponse.getElementsByTagName('rDurasiAdzan'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('durasiadzan').value=message; xmldoc = xmlResponse.getElementsByTagName('rIhti'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('ihti').value=message; xmldoc = xmlResponse.getElementsByTagName('rLatitude'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('latitude').value=message; xmldoc = xmlResponse.getElementsByTagName('rLongitude'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('longitude').value=message; xmldoc = xmlResponse.getElementsByTagName('rZonaWaktu'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('zonawaktu').value=message; xmldoc = xmlResponse.getElementsByTagName('rNama'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('nama').value=message; xmldoc = xmlResponse.getElementsByTagName('rInfo1'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('info1').value=message; xmldoc = xmlResponse.getElementsByTagName('rInfo2'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('info2').value=message; } } function setJws() { console.log("tombol telah ditekan!"); var iqmhs = document.getElementById("iqmhs").value; var iqmhd = document.getElementById("iqmhd").value; var iqmha = document.getElementById("iqmha").value; var iqmhm = document.getElementById("iqmhm").value; var iqmhi = document.getElementById("iqmhi").value; var durasiadzan = document.getElementById("durasiadzan").value; var ihti = document.getElementById("ihti").value; var latitude = document.getElementById("latitude").value; var longitude = document.getElementById("longitude").value; var zonawaktu = document.getElementById("zonawaktu").value; var nama = document.getElementById("nama").value; var info1 = document.getElementById("info1").value; var info2 = document.getElementById("info2").value; var datajws = {iqmhs:iqmhs, iqmhd:iqmhd, iqmha:iqmha, iqmhm:iqmhm, iqmhi:iqmhi, durasiadzan:durasiadzan, ihti:ihti, latitude:latitude, longitude:longitude, zonawaktu:zonawaktu, nama:nama, info1:info1, info2:info2}; var xhr = new XMLHttpRequest(); var url = "/settingjws"; xhr.onreadystatechange = function() { if(this.onreadyState == 4 && this.status == 200) { console.log(xhr.responseText); } }; xhr.open("POST", url, true); xhr.send(JSON.stringify(datajws)); }; </script> </html> )====="; char setwifi[] PROGMEM = R"=====( <html> <meta name="viewport" content="width=device-width, initial-scale=1"> <head> <title>Car Display</title> <style> body { width: 97% ; text-align: center; } input, select, button, textarea { max-width: 100% ; margin: 5px; padding: 5px; border-radius: 7px; } meter, progress, output { max-width: 100% ; } h1 { color: grey; } .note { color: #555; font-size:1em;} .info { background-color: #eee; border-radius: 3px; padding-top: 17px; margin: 5px;} .tombol { background-color: #ccc; margin: 20px; padding: 10px; border-radius: 10px; text-decoration: none;}</style> </head> <body onload='process()'> <h1>Ubah Wifi</h1> <form> <div> <label for="wifissid">Wifi SSID</label> <input id="wifissid"/> </div> <div> <label for="wifipassword">Wifi Password</label> <input type="wifipassword" id="wifipassword"/> </div> <div> <button onClick="setWifi()"> Simpan & Restart </button> </div> </form> <br><br> <h5><a class ='tombol' href="/">Kembali</a></h5> <h5><a class ='tombol' href="/setjws">Jam Sholat</a></h5> <h5><a class ='tombol' href="/setdisplay">Display</a></h5> <br><br><br> </body> <script> var xmlHttp=createXmlHttpObject(); function createXmlHttpObject(){ if(window.XMLHttpRequest){ xmlHttp=new XMLHttpRequest(); }else{ xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');// code for IE6, IE5 } return xmlHttp; } function process(){ if(xmlHttp.readyState==0 || xmlHttp.readyState==4){ xmlHttp.open('PUT','xml',true); xmlHttp.onreadystatechange=handleServerResponse; xmlHttp.send(null); } } function handleServerResponse(){ if(xmlHttp.readyState==4 && xmlHttp.status==200){ xmlResponse=xmlHttp.responseXML; xmldoc = xmlResponse.getElementsByTagName('rWifissid'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('wifissid').value=message; } } function setWifi() { console.log("tombol telah ditekan!"); var wifissid = document.getElementById("wifissid").value; var wifipassword = document.getElementById("wifipassword").value; var data = {wifissid:wifissid, wifipassword:wifipassword}; var xhr = new XMLHttpRequest(); var url = "/settingwifi"; xhr.onreadystatechange = function() { if(this.onreadyState == 4 && this.status == 200) { console.log(xhr.responseText); } }; xhr.open("POST", url, true); xhr.send(JSON.stringify(data)); }; </script> </html> )====="; char setdisplay[] PROGMEM = R"=====( <!DOCTYPE HTML> <html> <meta name='viewport' content='width=device-width, initial-scale=1'> <head> <title>Display</title> <style> body { width: 97% ; text-align: center; } input, select, button, textarea { max-width: 100% ; margin: 5px; padding: 5px; border-radius: 7px; } meter, progress, output { max-width: 100% ; } h1 { color: grey; } .note { color: #555; font-size:1em;} .info { background-color: #eee; border-radius: 3px; padding-top: 17px; margin: 5px;} .tombol { background-color: #ccc; margin: 20px; padding: 10px; border-radius: 10px; text-decoration: none;}</style> </head> <body onload='process()'> <h1>Display</h1> <form id='data_form' name='frmText'> <label>Redup<input id="cerah" type='range' name='Cerah' min='18' max='255'>Cerah <br> </form> <br> <button onClick="setDisp()"> Simpan </button><span> </span> <br><br> <h5><a class ='tombol' href="/">Kembali</a></h5> <h5><a class ='tombol' href="/setjws">Jam Sholat</a></h5> <h5><a class ='tombol' href="/setwifi">Wifi</a></h5> <br><br> </body> <script> function setDisp() { console.log("tombol telah ditekan!"); var cerah = document.getElementById("cerah").value; var datadisp = {cerah:cerah}; var xhr = new XMLHttpRequest(); var url = "/settingdisp"; xhr.onreadystatechange = function() { if(this.onreadyState == 4 && this.status == 200) { console.log(xhr.responseText); } }; xhr.open("POST", url, true); xhr.send(JSON.stringify(datadisp)); } var xmlHttp=createXmlHttpObject(); function createXmlHttpObject(){ if(window.XMLHttpRequest){ xmlHttp=new XMLHttpRequest(); }else{ xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');// code for IE6, IE5 } return xmlHttp; } function process(){ if(xmlHttp.readyState==0 || xmlHttp.readyState==4){ xmlHttp.open('PUT','xml',true); xmlHttp.onreadystatechange=handleServerResponse; xmlHttp.send(null); } } function handleServerResponse(){ if(xmlHttp.readyState==4 && xmlHttp.status==200){ xmlResponse=xmlHttp.responseXML; xmldoc = xmlResponse.getElementsByTagName('rCerah'); message = xmldoc[0].firstChild.nodeValue; document.getElementById('cerah').value=message; } } </script> </html> )=====";
8908256c0daaf2673fcc1fda8e29544bd44ecaf3
3208dbb9dca38adbb9e1653b4a5126b16c0a247b
/srcs/ft_iscolor.c
c6219f98f8e5b08b398626a9b7d917d8bb63c793
[]
no_license
flcarre/ft_printf
cb921cb21da9aac598e9378a316b4b81b1e920c0
4585ee50b8b4056882e18ff852342b239ca48927
refs/heads/master
2020-04-09T12:21:37.308279
2019-02-08T02:39:22
2019-02-08T02:39:22
160,346,084
0
1
null
null
null
null
UTF-8
C
false
false
1,186
c
ft_iscolor.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_iscolor.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: flcarre <flcarre@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/01/03 14:57:49 by flcarre #+# #+# */ /* Updated: 2019/01/03 21:30:37 by flcarre ### ########.fr */ /* */ /* ************************************************************************** */ #include "ft_printf.h" void ft_iscolor(unsigned long *i, char *s, t_id *e) { int j; j = 0; if (!ft_strchr(s + i[0], (int)'}')) return ; while(s[i[0]] && s[i[0]] != '}') { e->id[j] = s[i[0]]; j++; i[0]++; } e->id[j] = s[i[0]]; i[0] += (s[i[0]] == '}') ? 1 : 0; i[1] = i[0]; }
43685db17baf7fa0be93021ac85a843b635b50bc
81233ddc555f5f70cd2e41fa2a9a168d27494036
/System/05_APP/HELLO/system/src/S_T_P_PROG.c
8592d5efe021be6dd90a9b120f54f75887ab5135
[]
no_license
gladiopeace/ARM
fee5ddbcf7dadea6d6ffa80b67b455cd16cd5089
0ebe26603ba3c36def30f5a8cc62d103631614eb
refs/heads/master
2023-03-29T18:26:04.043193
2021-04-05T14:22:25
2021-04-05T14:22:25
null
0
0
null
null
null
null
UTF-8
C
false
false
2,242
c
S_T_P_PROG.c
/***************************************************************************************/ /**************************** IMT School Training Center ******************************/ /***************************************************************************************/ /** This file is developed by IMT School training center, All copyrights are reserved **/ /***************************************************************************************/ #include "TYPES.h" #include "MACROS.h" #include "GPIO_INTERFACE.h" #include "DELAY_INTERFACE.h" #include "S_T_P_INTERFACE.h" #include "S_T_P_CONFIGI.h" void STP_VidInit( void ){ MGPIO_VidSetPinDirection( STP_DATA_PORT , STP_DATA_PIN , OUTPUT_SPEED_2MHZ_PP ); MGPIO_VidSetPinDirection( STP_BIT_LATCH_PORT , STP_BIT_LATCH_PIN , OUTPUT_SPEED_2MHZ_PP ); MGPIO_VidSetPinDirection( STP_BYTE_LATCH_PORT , STP_BYTE_LATCH_PIN , OUTPUT_SPEED_2MHZ_PP ); } void STP_VidByteOutput ( u8 Copy_u8Data ){ u8 LOC_u8Iterator ; MGPIO_VidSetPinValue( STP_BYTE_LATCH_PORT , STP_BYTE_LATCH_PIN , LOW ); for( LOC_u8Iterator = 8 ; LOC_u8Iterator > 0 ; LOC_u8Iterator-- ){ MGPIO_VidSetPinValue( STP_DATA_PORT , STP_DATA_PIN , ( GET_BIT( Copy_u8Data , ( LOC_u8Iterator - 1 ) ) ) ); MGPIO_VidSetPinValue( STP_BIT_LATCH_PORT , STP_BIT_LATCH_PIN , HIGH ); _delay_us( 5 ); MGPIO_VidSetPinValue( STP_BIT_LATCH_PORT , STP_BIT_LATCH_PIN , LOW ); } MGPIO_VidSetPinValue( STP_BYTE_LATCH_PORT , STP_BYTE_LATCH_PIN , HIGH ); _delay_us( 5 ); MGPIO_VidSetPinValue( STP_BYTE_LATCH_PORT , STP_BYTE_LATCH_PIN , LOW ); } void STP_VidHalfWordOutput ( u16 Copy_u8Data ){ u8 LOC_u8Iterator ; MGPIO_VidSetPinValue( STP_BYTE_LATCH_PORT , STP_BYTE_LATCH_PIN , LOW ); for( LOC_u8Iterator = 16 ; LOC_u8Iterator > 0 ; LOC_u8Iterator-- ){ MGPIO_VidSetPinValue( STP_DATA_PORT , STP_DATA_PIN , ( GET_BIT( Copy_u8Data , ( LOC_u8Iterator - 1 ) ) ) ); MGPIO_VidSetPinValue( STP_BIT_LATCH_PORT , STP_BIT_LATCH_PIN , HIGH ); _delay_us( 5 ); MGPIO_VidSetPinValue( STP_BIT_LATCH_PORT , STP_BIT_LATCH_PIN , LOW ); } MGPIO_VidSetPinValue( STP_BYTE_LATCH_PORT , STP_BYTE_LATCH_PIN , HIGH ); _delay_us( 5 ); MGPIO_VidSetPinValue( STP_BYTE_LATCH_PORT , STP_BYTE_LATCH_PIN , LOW ); }
1018382afa04b6567cb783513b6e9065bf14e33b
a9c6d841553f277722e0493db127f79eaa704cd0
/noesis/plugin/pluginbasetypes.h
4d4e5a94579d8420493329b7fb78ae4af769358b
[]
no_license
Jayveer/MGS-MDP-Noesis
02808f126b3c2b757c28ed0aeb48bb07a003f004
9c484af0a2534b0d2127c355f42c0884c4da6a0c
refs/heads/master
2023-03-20T20:31:56.583071
2021-03-13T14:23:30
2021-03-13T14:23:30
338,621,960
13
0
null
2021-03-03T16:50:29
2021-02-13T16:53:13
C++
UTF-8
C
false
false
480
h
pluginbasetypes.h
#pragma once #ifndef _NOESIS_PLUGIN_BASE_TYPES_H #define _NOESIS_PLUGIN_BASE_TYPES_H //common types, which aren't actually used by most of the api! typedef __int64 TNoeInt64; typedef unsigned __int64 TNoeUInt64; typedef int TNoeInt32; typedef unsigned int TNoeUInt32; typedef short TNoeInt16; typedef unsigned short TNoeUInt16; typedef char TNoeInt8; typedef unsigned char TNoeUInt8; typedef float TNoeReal32; typedef double TNoeReal64; #endif _NOESIS_PLUGIN_BASE_TYPES_H
cbca5b2e2b42ed781f154dcd2e9db13bda0e400f
91a882547e393d4c4946a6c2c99186b5f72122dd
/Source/XPSP1/NT/inetsrv/iis/iisrearc/core/wp/ulsim/httptypes.h
c97d74a7b960e6a2b30c428b046ac9bd3fd894ef
[]
no_license
IAmAnubhavSaini/cryptoAlgorithm-nt5src
94f9b46f101b983954ac6e453d0cf8d02aa76fc7
d9e1cdeec650b9d6d3ce63f9f0abe50dabfaf9e2
refs/heads/master
2023-09-02T10:14:14.795579
2021-11-20T13:47:06
2021-11-20T13:47:06
null
0
0
null
null
null
null
UTF-8
C
false
false
6,369
h
httptypes.h
/*++ Copyright (c) 1998-1999 Microsoft Corporation Module Name: httptypes.h Abstract: The definition of HTTP specific types Author: Revision History: --*/ #ifndef _HTTPTYPES_H_ #define _HTTPTYPES_H_ #define CR 0x0D #define LF 0x0A #define SP 0x20 #define HT 0x09 #define CRLF_SIZE 2 #define CRLF 0x0A0D // Reversed for endian switch #define LFLF 0x0A0A #define UPCASE_CHAR(c) ((c) & 0xdf) // // The enum type for our parse state. // typedef enum _PARSE_STATE { ParseVerbState, ParseURLState, ParseVersionState, ParseHeadersState, ParseDoneState } PARSE_STATE, *PPARSE_STATE; // The enum type for the HTTP connection state. // typedef enum _HTTP_STATE { HttpInitialState, HttpReadRequestState, HttpReadBodyState, HttpClosingState } HTTP_STATE, *PHTTP_STATE; // // Structure we use for tracking headers from incoming requests. The pointer // points into a buffer we received from the transport, unless the OurBuffer // flag is set, which indicates we had to allocate a buffer and copy the header // due to multiple occurences of the header or a continuation line. // typedef struct _HTTP_HEADER { ULONG HeaderLength; PUCHAR pHeader; ULONG OurBuffer:1; ULONG Valid:1; } HTTP_HEADER, *PHTTP_HEADER; // // Structure we use for tracking unknown headers. These structures are // dyanmically allocated when we see an unknown header. // typedef struct _HTTP_UNKNOWN_HEADER { LIST_ENTRY List; ULONG HeaderNameLength; PUCHAR pHeaderName; HTTP_HEADER HeaderValue; } HTTP_UNKNOWN_HEADER, *PHTTP_UNKNOWN_HEADER; // // Structure we use for a local copy of the data from the transport's // buffer . // typedef struct _UL_REQUEST_BUFFER { LIST_ENTRY ListEntry; /* UCHAR pBuffer[0]; */ } UL_REQUEST_BUFFER, *PUL_REQUEST_BUFFER; // // Structure used for tracking an HTTP connection, which may represent // either a real TCP connection or a virtual MUX connection. // typedef struct _HTTP_CONNECTION // HttpConn { UL_HTTP_CONNECTION_ID ConnectionID; // Opaque ID for this // connection. /* UL_SPIN_LOCK SpinLock; // Spinlock protecting this // connection. union { UL_WORK_ITEM WorkItem; // A work item, used for queuing LIST_ENTRY ListEntry; // or simply queue it with this }; */ ULONG RefCount; // Reference count of this // connection. ULONG NextRecvNumber; // Receive sequence number. ULONG NextSendNumber; // Send sequence number. HTTP_STATE HttpState; // Current state of the // HTTP connection. PARSE_STATE ParseState; // Current state of our parsing // effort. ULONG TotalRequestSize; // Total bytes needed for this // request. ULONG KnownHeaderCount; // Number of 'known' headers we // have. ULONG UnknownHeaderCount; // Number of 'unknown' headers // we have. UL_HTTP_VERB Verb; // Verb of this request. PUCHAR pRawVerb; // Pointer to raw verb, valid // if Verb == UnknownVerb. ULONG RawVerbLength; // Length of raw verb. struct { PUCHAR pUrl; // The raw URL. // all of the below ptrs point // into pUrl // ========================== PUCHAR pHost; // host part, if any PUCHAR pAbsPath; // points to the abs_path part // ========================== // ULONG Length; // The length of the raw URL. } RawUrl; struct { PWSTR pUrl; // The canonicalized, fully // qualified URL. // all of the below ptrs point // into pUrl // ========================== PWSTR pHost; // points to the host part PWSTR pAbsPath; // points to the abs_path part PWSTR pQueryString; // points to the query string // ========================== // ULONG Length; // the entire length (Bytes) ULONG Hash; // the entire 32-bit hash } CookedUrl; // mmm... tasty UL_HTTP_VERSION Version; // Version of current request. ULONG HeaderBufferOwnedCount; // Count of header buffers we own. HTTP_HEADER Headers[UlHeaderMaximum]; // Array of headers. LIST_ENTRY UnknownHeaderList; // List of headers we don't // know about. UL_URL_CONTEXT UrlContext; // The context for the url. /* PUL_CONNECTION pConnection; // Associated TDI/MUX connection */ LIST_ENTRY BufferHead; // A list of buffers that we use to // store the protocol part of the // request (non-body) } HTTP_CONNECTION, *PHTTP_CONNECTION; #endif // _HTTPTYPES_H_
8c56141ac130f078de5cc17653f1bb76107fedee
5d4d21ed94635abab9c81e561c7ab432285f71ab
/ILI9341/ILI9341.c
917e3a845ab900576e42c90b259badfbb75df339
[]
no_license
tandarit/TankTaviranyito
ebde61f5a244b04e1149919528356e033cf5fa35
845d3676c3ee511e1bdb930a320a3406ace5a6fc
refs/heads/main
2023-02-09T09:26:16.750099
2021-01-02T18:20:53
2021-01-02T18:20:53
326,245,882
0
0
null
null
null
null
UTF-8
C
false
false
51,778
c
ILI9341.c
#include "ILI9341.h" void ILI9341_SendData(uint8_t data); void ILI9341_SendCommand(uint8_t data); void ILI9341_Delay(volatile unsigned int delay); void ILI9341_SetCursorPosition(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); void ILI9341_INT_Fill(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color); uint16_t image_data_ILI9341_Battery100[720] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; uint16_t image_data_ILI9341_Battery80[720] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; uint16_t image_data_ILI9341_Battery60[720] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; uint16_t image_data_ILI9341_Battery40[720] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; uint16_t image_data_ILI9341_Battery20[720] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; uint16_t image_data_ILI9341_NRFConnect[504] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000 }; uint16_t image_data_ILI9341_NRFNotConnected[504] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; tImage ILI9341_Battery100 = { image_data_ILI9341_Battery100, 40, 18}; tImage ILI9341_Battery80 = { image_data_ILI9341_Battery80, 40, 18}; tImage ILI9341_Battery60 = { image_data_ILI9341_Battery60, 40, 18}; tImage ILI9341_Battery40 = { image_data_ILI9341_Battery40, 40, 18}; tImage ILI9341_Battery20 = { image_data_ILI9341_Battery20, 40, 18}; tImage ILI9341_NRFConnect = { image_data_ILI9341_NRFConnect, 28, 18}; tImage ILI9341_NRFNotConnected = { image_data_ILI9341_NRFNotConnected, 28, 18}; void ILI9341_InitLCD() { ILI9341_HWInit(); /* Force reset */ ILI9341_RST_RESET; Delay(20000); ILI9341_RST_SET; /* Delay for RST response */ Delay(20000); /* Software reset */ ILI9341_SendCommand(ILI9341_RESET); Delay(50000); ILI9341_SendCommand(ILI9341_POWERA); ILI9341_SendData(0x39); ILI9341_SendData(0x2C); ILI9341_SendData(0x00); ILI9341_SendData(0x34); ILI9341_SendData(0x02); ILI9341_SendCommand(ILI9341_POWERB); ILI9341_SendData(0x00); ILI9341_SendData(0xC1); ILI9341_SendData(0x30); ILI9341_SendCommand(ILI9341_DTCA); ILI9341_SendData(0x85); ILI9341_SendData(0x00); ILI9341_SendData(0x78); ILI9341_SendCommand(ILI9341_DTCB); ILI9341_SendData(0x00); ILI9341_SendData(0x00); ILI9341_SendCommand(ILI9341_POWER_SEQ); ILI9341_SendData(0x64); ILI9341_SendData(0x03); ILI9341_SendData(0x12); ILI9341_SendData(0x81); ILI9341_SendCommand(ILI9341_PRC); ILI9341_SendData(0x20); ILI9341_SendCommand(ILI9341_POWER1); ILI9341_SendData(0x23); ILI9341_SendCommand(ILI9341_POWER2); ILI9341_SendData(0x10); ILI9341_SendCommand(ILI9341_VCOM1); ILI9341_SendData(0x3E); ILI9341_SendData(0x28); ILI9341_SendCommand(ILI9341_VCOM2); ILI9341_SendData(0x86); ILI9341_SendCommand(ILI9341_MAC); ILI9341_SendData(0x48); ILI9341_SendCommand(ILI9341_PIXEL_FORMAT); ILI9341_SendData(0x55); ILI9341_SendCommand(ILI9341_FRC); ILI9341_SendData(0x00); ILI9341_SendData(0x18); ILI9341_SendCommand(ILI9341_DFC); ILI9341_SendData(0x08); ILI9341_SendData(0x82); ILI9341_SendData(0x27); ILI9341_SendCommand(ILI9341_3GAMMA_EN); ILI9341_SendData(0x00); ILI9341_SendCommand(ILI9341_COLUMN_ADDR); ILI9341_SendData(0x00); ILI9341_SendData(0x00); ILI9341_SendData(0x00); ILI9341_SendData(0xEF); ILI9341_SendCommand(ILI9341_PAGE_ADDR); ILI9341_SendData(0x00); ILI9341_SendData(0x00); ILI9341_SendData(0x01); ILI9341_SendData(0x3F); ILI9341_SendCommand(ILI9341_GAMMA); ILI9341_SendData(0x01); ILI9341_SendCommand(ILI9341_PGAMMA); ILI9341_SendData(0x0F); ILI9341_SendData(0x31); ILI9341_SendData(0x2B); ILI9341_SendData(0x0C); ILI9341_SendData(0x0E); ILI9341_SendData(0x08); ILI9341_SendData(0x4E); ILI9341_SendData(0xF1); ILI9341_SendData(0x37); ILI9341_SendData(0x07); ILI9341_SendData(0x10); ILI9341_SendData(0x03); ILI9341_SendData(0x0E); ILI9341_SendData(0x09); ILI9341_SendData(0x00); ILI9341_SendCommand(ILI9341_NGAMMA); ILI9341_SendData(0x00); ILI9341_SendData(0x0E); ILI9341_SendData(0x14); ILI9341_SendData(0x03); ILI9341_SendData(0x11); ILI9341_SendData(0x07); ILI9341_SendData(0x31); ILI9341_SendData(0xC1); ILI9341_SendData(0x48); ILI9341_SendData(0x08); ILI9341_SendData(0x0F); ILI9341_SendData(0x0C); ILI9341_SendData(0x31); ILI9341_SendData(0x36); ILI9341_SendData(0x0F); ILI9341_SendCommand(ILI9341_SLEEP_OUT); Delay(50000); ILI9341_SendCommand(ILI9341_DISPLAY_ON); ILI9341_SendCommand(ILI9341_GRAM); /* Set default settings */ ILI9341_x = ILI9341_y = 0; ILI9341_Opts.width = ILI9341_WIDTH; ILI9341_Opts.height = ILI9341_HEIGHT; ILI9341_Opts.orientation = ILI9341_Portrait; } void ILI9341_DisplayOn(void) { ILI9341_SendCommand(ILI9341_DISPLAY_ON); } void ILI9341_DisplayOff(void) { ILI9341_SendCommand(ILI9341_DISPLAY_OFF); } void ILI9341_SendCommand(uint8_t data) { ILI9341_RS_RESET; ILI9341_CS_RESET; SPI_Send(data); ILI9341_CS_SET; } void ILI9341_SendData(uint8_t data) { ILI9341_RS_SET; ILI9341_CS_RESET; SPI_Send(data); ILI9341_CS_SET; } void ILI9341_DrawPixel(uint16_t x, uint16_t y, uint32_t color) { ILI9341_SetCursorPosition(x, y, x, y); ILI9341_SendCommand(ILI9341_GRAM); ILI9341_SendData(color >> 8); ILI9341_SendData(color & 0xFF); } void ILI9341_SetCursorPosition(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { ILI9341_SendCommand(ILI9341_COLUMN_ADDR); ILI9341_SendData(x1 >> 8); ILI9341_SendData(x1 & 0xFF); ILI9341_SendData(x2 >> 8); ILI9341_SendData(x2 & 0xFF); ILI9341_SendCommand(ILI9341_PAGE_ADDR); ILI9341_SendData(y1 >> 8); ILI9341_SendData(y1 & 0xFF); ILI9341_SendData(y2 >> 8); ILI9341_SendData(y2 & 0xFF); } void ILI9341_Fill(uint32_t color) { /* Fill entire screen */ ILI9341_INT_Fill(0, 0, ILI9341_Opts.width - 1, ILI9341_Opts.height, color); } void ILI9341_INT_Fill(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color) { uint32_t pixels_count; /* Set cursor position */ ILI9341_SetCursorPosition(x0, y0, x1, y1); /* Set command for GRAM data */ ILI9341_SendCommand(ILI9341_GRAM); /* Calculate pixels count */ pixels_count = (x1 - x0 + 1) * (y1 - y0 + 1); /* Send everything */ ILI9341_CS_RESET; ILI9341_RS_SET; /* Go to 16-bit SPI mode */ SPI_SetDataSize(ILI9341_SPI, SPI_DataSize_16bit); /* Send first 65535 bytes, SPI MUST BE IN 16-bit MODE */ SPI_DMA_SendHalfWord(color, (pixels_count > 0xFFFF) ? 0xFFFF : pixels_count); /* Wait till done */ while (SPI_DMA_Working()); /* Check again */ if (pixels_count > 0xFFFF) { /* Send remaining data */ SPI_DMA_SendHalfWord(color, pixels_count - 0xFFFF); /* Wait till done */ while (SPI_DMA_Working()); } ILI9341_CS_SET; /* Go back to 8-bit SPI mode */ SPI_SetDataSize(ILI9341_SPI, SPI_DataSize_8bit); } void ILI9341_Delay(volatile unsigned int delay) { for (; delay != 0; delay--); } void ILI9341_Rotate(ILI9341_Orientation_t orientation) { ILI9341_SendCommand(ILI9341_MAC); if (orientation == ILI9341_Orientation_Portrait_1) { ILI9341_SendData(0x58); } else if (orientation == ILI9341_Orientation_Portrait_2) { ILI9341_SendData(0x88); } else if (orientation == ILI9341_Orientation_Landscape_1) { ILI9341_SendData(0x28); } else if (orientation == ILI9341_Orientation_Landscape_2) { ILI9341_SendData(0xE8); } if (orientation == ILI9341_Orientation_Portrait_1 || orientation == ILI9341_Orientation_Portrait_2) { ILI9341_Opts.width = ILI9341_WIDTH; ILI9341_Opts.height = ILI9341_HEIGHT; ILI9341_Opts.orientation = ILI9341_Portrait; } else { ILI9341_Opts.width = ILI9341_HEIGHT; ILI9341_Opts.height = ILI9341_WIDTH; ILI9341_Opts.orientation = ILI9341_Landscape; } } void ILI9341_Puts(uint16_t x, uint16_t y, char *str, FontDef_t *font, uint32_t foreground, uint32_t background) { uint16_t startX = x; /* Set X and Y coordinates */ ILI9341_x = x; ILI9341_y = y; while (*str) { /* New line */ if (*str == '\n') { ILI9341_y += font->FontHeight + 1; /* if after \n is also \r, than go to the left of the screen */ if (*(str + 1) == '\r') { ILI9341_x = 0; str++; } else { ILI9341_x = startX; } str++; continue; } else if (*str == '\r') { str++; continue; } /* Put character to LCD */ ILI9341_Putc(ILI9341_x, ILI9341_y, *str++, font, foreground, background); } } void ILI9341_GetStringSize(char *str, FontDef_t *font, uint16_t *width, uint16_t *height) { uint16_t w = 0; *height = font->FontHeight; while (*str++) { w += font->FontWidth; } *width = w; } void ILI9341_Putc(uint16_t x, uint16_t y, char c, FontDef_t *font, uint32_t foreground, uint32_t background) { uint32_t i, b, j; /* Set coordinates */ ILI9341_x = x; ILI9341_y = y; if ((ILI9341_x + font->FontWidth) > ILI9341_Opts.width) { /* If at the end of a line of display, go to new line and set x to 0 position */ ILI9341_y += font->FontHeight; ILI9341_x = 0; } /* Draw rectangle for background */ ILI9341_INT_Fill(ILI9341_x, ILI9341_y, ILI9341_x + font->FontWidth, ILI9341_y + font->FontHeight, background); /* Draw font data */ for (i = 0; i < font->FontHeight; i++) { b = font->data[(c - 32) * font->FontHeight + i]; for (j = 0; j < font->FontWidth; j++) { if ((b << j) & 0x8000) { ILI9341_DrawPixel(ILI9341_x + j, (ILI9341_y + i), foreground); } } } /* Set new pointer */ ILI9341_x += font->FontWidth; } void ILI9341_DrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t color) { /* Code by dewoller: https://github.com/dewoller */ int16_t dx, dy, sx, sy, err, e2; uint16_t tmp; /* Check for overflow */ if (x0 >= ILI9341_Opts.width) { x0 = ILI9341_Opts.width - 1; } if (x1 >= ILI9341_Opts.width) { x1 = ILI9341_Opts.width - 1; } if (y0 >= ILI9341_Opts.height) { y0 = ILI9341_Opts.height - 1; } if (y1 >= ILI9341_Opts.height) { y1 = ILI9341_Opts.height - 1; } /* Check correction */ if (x0 > x1) { tmp = x0; x0 = x1; x1 = tmp; } if (y0 > y1) { tmp = y0; y0 = y1; y1 = tmp; } dx = x1 - x0; dy = y1 - y0; /* Vertical or horizontal line */ if (dx == 0 || dy == 0) { ILI9341_INT_Fill(x0, y0, x1, y1, color); return; } sx = (x0 < x1) ? 1 : -1; sy = (y0 < y1) ? 1 : -1; err = ((dx > dy) ? dx : -dy) / 2; while (1) { ILI9341_DrawPixel(x0, y0, color); if (x0 == x1 && y0 == y1) { break; } e2 = err; if (e2 > -dx) { err -= dy; x0 += sx; } if (e2 < dy) { err += dx; y0 += sy; } } } void ILI9341_DrawRectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t color) { ILI9341_DrawLine(x0, y0, x1, y0, color); //Top ILI9341_DrawLine(x0, y0, x0, y1, color); //Left ILI9341_DrawLine(x1, y0, x1, y1, color); //Right ILI9341_DrawLine(x0, y1, x1, y1, color); //Bottom } void ILI9341_DrawFilledRectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t color) { uint16_t tmp; /* Check correction */ if (x0 > x1) { tmp = x0; x0 = x1; x1 = tmp; } if (y0 > y1) { tmp = y0; y0 = y1; y1 = tmp; } /* Fill rectangle */ ILI9341_INT_Fill(x0, y0, x1, y1, color); /* CS HIGH back */ ILI9341_CS_SET; } void ILI9341_DrawCircle(int16_t x0, int16_t y0, int16_t r, uint32_t color) { int16_t f = 1 - r; int16_t ddF_x = 1; int16_t ddF_y = -2 * r; int16_t x = 0; int16_t y = r; ILI9341_DrawPixel(x0, y0 + r, color); ILI9341_DrawPixel(x0, y0 - r, color); ILI9341_DrawPixel(x0 + r, y0, color); ILI9341_DrawPixel(x0 - r, y0, color); while (x < y) { if (f >= 0) { y--; ddF_y += 2; f += ddF_y; } x++; ddF_x += 2; f += ddF_x; ILI9341_DrawPixel(x0 + x, y0 + y, color); ILI9341_DrawPixel(x0 - x, y0 + y, color); ILI9341_DrawPixel(x0 + x, y0 - y, color); ILI9341_DrawPixel(x0 - x, y0 - y, color); ILI9341_DrawPixel(x0 + y, y0 + x, color); ILI9341_DrawPixel(x0 - y, y0 + x, color); ILI9341_DrawPixel(x0 + y, y0 - x, color); ILI9341_DrawPixel(x0 - y, y0 - x, color); } } void ILI9341_DrawFilledCircle(int16_t x0, int16_t y0, int16_t r, uint32_t color) { int16_t f = 1 - r; int16_t ddF_x = 1; int16_t ddF_y = -2 * r; int16_t x = 0; int16_t y = r; ILI9341_DrawPixel(x0, y0 + r, color); ILI9341_DrawPixel(x0, y0 - r, color); ILI9341_DrawPixel(x0 + r, y0, color); ILI9341_DrawPixel(x0 - r, y0, color); ILI9341_DrawLine(x0 - r, y0, x0 + r, y0, color); while (x < y) { if (f >= 0) { y--; ddF_y += 2; f += ddF_y; } x++; ddF_x += 2; f += ddF_x; ILI9341_DrawLine(x0 - x, y0 + y, x0 + x, y0 + y, color); ILI9341_DrawLine(x0 + x, y0 - y, x0 - x, y0 - y, color); ILI9341_DrawLine(x0 + y, y0 + x, x0 - y, y0 + x, color); ILI9341_DrawLine(x0 + y, y0 - x, x0 - y, y0 - x, color); } } void ILI9341_Blacklight_Init(void) { RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE); GPIO_InitTypeDef gpioStructure; gpioStructure.GPIO_Pin = GPIO_Pin_1; gpioStructure.GPIO_Mode = GPIO_Mode_AF; gpioStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOB, &gpioStructure); RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); TIM_TimeBaseInitTypeDef timerInitStructure; timerInitStructure.TIM_Prescaler = 999; timerInitStructure.TIM_CounterMode = TIM_CounterMode_Up; timerInitStructure.TIM_Period = 500; timerInitStructure.TIM_ClockDivision = TIM_CKD_DIV1; timerInitStructure.TIM_RepetitionCounter = 0; TIM_TimeBaseInit(TIM3, &timerInitStructure); TIM_Cmd(TIM3, ENABLE); } void ILI9341_SetBlacklight(uint8_t dutycycle) { TIM_OCInitTypeDef outputChannelInit; uint16_t pulseValue; pulseValue=((100-dutycycle)*500)/100; outputChannelInit.TIM_OCMode = TIM_OCMode_PWM1; outputChannelInit.TIM_Pulse = pulseValue; outputChannelInit.TIM_OutputState = TIM_OutputState_Enable; outputChannelInit.TIM_OCPolarity = TIM_OCPolarity_High; TIM_OC4Init(TIM3, &outputChannelInit); TIM_OC4PreloadConfig(TIM3, TIM_OCPreload_Enable); GPIO_PinAFConfig(GPIOB, GPIO_PinSource1, GPIO_AF_TIM3); } void ILI9341_DrawImage(uint16_t x, uint16_t y, tImage img) { uint32_t pixels_count; ILI9341_SetCursorPosition(x, y, img.width+x-1, img.height+y-1); ILI9341_SendCommand(ILI9341_GRAM); pixels_count=img.width*img.height; /* Send everything */ ILI9341_CS_RESET; ILI9341_RS_SET; /* Go to 16-bit SPI mode */ SPI_SetDataSize(ILI9341_SPI, SPI_DataSize_16b); SPI_DMA_TransmitHalfWord(img.data, NULL, pixels_count); /* Wait till done */ while (SPI_DMA_Working(ILI9341_SPI)); ILI9341_CS_SET; /* Go back to 8-bit SPI mode */ SPI_SetDataSize(ILI9341_SPI, SPI_DataSize_8b); }
021e412dec7642374b143ab260590ad909bf48f1
324a1c017043dc8bada9e4c7da845d557de14892
/src/ft_strclr.c
e29ef22d5aa2b89082f4fc85d5436456f6fb6c72
[]
no_license
Odie8683/libft
a3087e9947e7056dab1ad6f6ce6877880277e3fa
9a0d9f7148ff40c1c475841a55188745c91676ac
refs/heads/main
2023-08-02T04:32:22.009869
2021-10-03T13:58:22
2021-10-03T13:58:22
null
0
0
null
null
null
null
UTF-8
C
false
false
118
c
ft_strclr.c
#include "../include/libft.h" void ft_strclr(char *s) { size_t i; i = 0; while(s[i]) { s[i] = '\0'; i++; } }
7b4898fcb0cba36a01a0f84fc293c2662b6b26ec
8ed5befd23162a619252003ed0e7d2131f0b0b4e
/parameter.h
4f7da7bcfd9b7f2f072ab991e8b08bd2a83768e8
[]
no_license
happyLcj/ls-command
9bfc1a9c3d5587be5e2c886dc252ff2e2ddd0f93
40809fcdb279bda352634df6ac7787c4e6b1b6b7
refs/heads/master
2021-01-18T20:17:51.142040
2016-10-07T09:29:25
2016-10-07T09:29:25
70,057,967
0
0
null
null
null
null
UTF-8
C
false
false
209
h
parameter.h
#define ALL_FILE 1 //-a #define LONG_FORMAT 2 //-l #define INODE 4 //-i #define IS_ALL(pamter) (pamter&ALL_FILE) #define IS_LONG(pamter) (pamter&LONG_FORMAT) #define IS_INODE(pamter) (pamter&INODE)
7d09886fb2a322ebedaef361e3395c8720a813c7
74be1bb3eec4243e42570a5fa728e10dd487cb01
/model.c
75c42978ffe573b925ba05a353ed9e0458955477
[]
no_license
jg2562/CS599-FinalProject
3492349cbe3dc64320ecb393eb2b0623d90c8e90
91342803a767c9fdaa9d14c38474a508e2051a9a
refs/heads/master
2022-07-02T05:55:52.394074
2020-05-11T00:21:03
2020-05-11T00:31:44
255,527,632
0
0
null
null
null
null
UTF-8
C
false
false
1,782
c
model.c
#include "model.h" #include <stdlib.h> #include <stdio.h> #include "population.h" Model* createModel(){ Model* model = malloc(sizeof(*model)); if (model == NULL){ fprintf(stderr, "Failed to allocate new model.\n"); exit(1); } model->map = NULL; model->parameters = NULL; model->population = createPopulation(); return model; } Model* createFilledModel(Parameters* parameters, CellMap* cell_map){ if (parameters == NULL || cell_map == NULL){ return NULL; } Model* model = createModel(); model->map = cell_map; model->parameters = parameters; return model; } void freeModel(Model* model){ if (model == NULL){ return; } int height = getParameters(model)->model_height; freeCellMap(getCellMap(model), height); freeParameters(getParameters(model)); freePopulation(getPopulation(model)); free(model); } void pollPopulation(Model* model){ Population* population = getPopulation(model); Parameters* parameters = getParameters(model); int width = parameters->model_width; int height = parameters->model_height; CellMap* map = getCellMap(model); initializePopulation(population); for (int row = 0; row < height; row++) { for (int col = 0; col < width; col++) { Cell* current = getCell(map, col, row); pollCell(population, current); } } } Population* getPopulation(Model* model){ return model->population; } Parameters* getParameters(Model* model){ return model->parameters; } CellMap* getCellMap(Model* model){ return model->map; } void printModel(Model* model){ int width = getParameters(model)->model_width; int height = getParameters(model)->model_height; printParameters(getParameters(model)); printf("\n"); printCellMap(getCellMap(model), width, height); printf("\n"); printPopulation(getPopulation(model)); }
813a6058563c7d89ff7a5414046bdfbd0665f1b8
c153885b49bef21a599baaef5db5f922415e46c7
/libft/srcs/ft_itoa.c
778a456ed61e1539a8b2eaf4be9aa964eca7fd32
[]
no_license
Tinkotsu/corewar
3170251c1194964164efec8a719f64b0e4eb405f
4a853d8004107f2e45efcaf832519cacd69537a7
refs/heads/master
2022-12-21T10:47:02.077641
2020-09-29T09:04:36
2020-09-29T09:04:36
295,983,748
0
0
null
null
null
null
UTF-8
C
false
false
1,741
c
ft_itoa.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_itoa.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ifran <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/09/09 16:57:47 by ifran #+# #+# */ /* Updated: 2019/09/10 18:13:20 by ifran ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" static int num_len(int n) { int len; len = 1; if (n < 0) { ++len; n *= -1; } while (n >= 10) { ++len; n /= 10; } return (len); } static char *swap_num(char *str) { int i; char temp; int len; char *start; start = str; len = ft_strlen(str) - 1; i = ((*str == '-') ? 1 : 0); while (i < len) { temp = str[i]; str[i] = str[len]; str[len] = temp; ++i; --len; } return (start); } char *ft_itoa(int n) { char *start; char *arr; int len; len = num_len(n); arr = (char *)malloc(sizeof(char) * (len + 1)); if (!arr) return (NULL); start = arr; if (n == -2147483648) return (ft_strcpy(start, "-2147483648")); if (n < 0) { n *= -1; *arr++ = '-'; --len; } while (len--) { *arr++ = '0' + n % 10; n /= 10; } *arr = '\0'; start = swap_num(start); return (start); }
396e9a72bb2433dd75e50ca8a16a8cbfb96338c7
e2f1388f289816fd1e2d9aff641be7cdfa08d7d3
/IMX6ULL/Board_Drivers/6_beep/bsp/beep/beep.h
e6206af4a22bd6f020ff55e06370e1e24408673f
[]
no_license
mazhongguang/ALPHA
babf07b248091cc1d022ea27c76aa838e7ca10f8
a39bf5c64656cc88b64c310f8d185953dc05607c
refs/heads/master
2021-06-27T00:54:49.720972
2021-04-06T03:45:14
2021-04-06T03:45:14
219,764,986
0
0
null
null
null
null
UTF-8
C
false
false
193
h
beep.h
#ifndef __BSP_BEEP_H #define __BSP_BEEP_H #include "fsl_common.h" #include "fsl_iomuxc.h" #include "MCIMX6Y2.h" /* 函数声明 */ void Beep_Init(void); void beep_switch(int status); #endif
977445a0a244031b53134c343d7b5485e4010298
b29ac3cbafe077f22684536e8dc76a4a62cb9e6d
/functions/built-in.c
fa9491ce13e9e7d95651f0b6855daeabb49b4a47
[]
no_license
sheldonjuncker/coal
da25bc2402f481a2ef03813bc4a5ba5a4c86dec6
bb60c8df4d480639d17a761f83976faec7e0a75b
refs/heads/master
2016-09-05T12:13:21.710604
2014-06-24T13:48:20
2014-06-24T13:48:20
null
0
0
null
null
null
null
UTF-8
C
false
false
57,616
c
built-in.c
//Standard Functions //Sum Function (list, string, arguments) if(!strcmp(name, "sum")) { //One Argument if(args == NULL) { fe("Error: The sum() function requires at least one argument.\n"); } xvar *first = evaluate(args); //String if(first->type == 's') { char *s = first->val->s; int i = 0; while(*s) { i += (int) *s++; } free_xvar(first); return integer_xvar(i); } //List else if(first->type == 'l') { double d = 0; List *l = first->val->l; while(l != NULL) { d += dubVal(l->var); l = l->next; } free_xvar(first); return double_xvar(d); } //Arguments else { double d = dubVal(first); free_xvar(first); args = args->next; while(args != NULL) { xvar *v = evaluate(args); d += dubVal(v); free_xvar(v); args = args->next; } return double_xvar(d); } } //Avg Function (list, string, arguments) else if(!strcmp(name, "avg")) { //One Argument if(args == NULL) { fe("Error: The avg() function requires at least one argument.\n"); } xvar *first = evaluate(args); //String if(first->type == 's') { int total = 0; char *s = first->val->s; int i = 0; while(*s) { i += (int) *s++; total++; } free_xvar(first); double di = (double) i; double dtotal = (double) total; return double_xvar(di / dtotal); } //List else if(first->type == 'l') { double d = 0; double total = 0; List *l = first->val->l; while(l != NULL) { d += dubVal(l->var); l = l->next; total += 1; } free_xvar(first); if(total == 0) return integer_xvar(0); return double_xvar(d / total); } //Arguments else { double total = 1; double d = dubVal(first); free_xvar(first); args = args->next; while(args != NULL) { xvar *v = evaluate(args); d += dubVal(v); free_xvar(v); args = args->next; total += 1; } return double_xvar(d / total); } } //Max Function (list, string, arguments) else if(!strcmp(name, "max")) { //One Argument if(args == NULL) { fe("Error: The max() function requires at least one argument.\n"); } xvar *first = evaluate(args); //String if(first->type == 's') { char *s = first->val->s; char cmax = *s; while(*s) { if(*s > cmax) cmax = *s; s++; } free_xvar(first); char *m = coal_alloc(2); m[0] = cmax; m[1] = '\0'; return string_xvar(m); } //List else if(first->type == 'l') { List *l = first->val->l; if(l == NULL) return first; xvar *xmax = l->var; l = l->next; while(l != NULL) { xvar *gt = gt_xvar(l->var, xmax); if(if_xvar(gt)) { xmax = l->var; } l = l->next; } xvar *return_val = dup_xvar(xmax); free_xvar(first); return return_val; } //Arguments else { xvar *xmax = first; args = args->next; while(args != NULL) { xvar *v = evaluate(args); xvar *gt = gt_xvar(v, xmax); if(if_xvar(gt)) { free_xvar(xmax); xmax = v; } else { free_xvar(v); } args = args->next; } return xmax; } } //Min Function (list, string, arguments) else if(!strcmp(name, "min")) { //One Argument if(args == NULL) { fe("Error: The min() function requires at least one argument.\n"); } xvar *first = evaluate(args); //String if(first->type == 's') { char *s = first->val->s; char cmax = *s; while(*s) { if(*s < cmax) cmax = *s; s++; } free_xvar(first); char *m = coal_alloc(2); m[0] = cmax; m[1] = '\0'; return string_xvar(m); } //List else if(first->type == 'l') { List *l = first->val->l; if(l == NULL) return first; xvar *xmax = l->var; l = l->next; while(l != NULL) { xvar *gt = lt_xvar(l->var, xmax); if(if_xvar(gt)) { xmax = l->var; } l = l->next; } xvar *return_val = dup_xvar(xmax); free_xvar(first); return return_val; } //Arguments else { xvar *xmax = first; args = args->next; while(args != NULL) { xvar *v = evaluate(args); xvar *gt = lt_xvar(v, xmax); if(if_xvar(gt)) { free_xvar(xmax); xmax = v; } else { free_xvar(v); } args = args->next; } return xmax; } } //Pow Function else if(!strcmp(name, "pow")) { //Two Arguments if(!(args != NULL && args->next != NULL)) { fe("Error: The pow() function requires two arguments.\n"); } //Number and Power xvar *n = evaluate(args); xvar *p = evaluate(args->next); double num = dubVal(n); double power = dubVal(p); free_xvar(n); free_xvar(p); double raise = pow(num, power); return double_xvar(raise); } //Sqrt Function else if(!strcmp(name, "sqrt")) { //Two Arguments if(args == NULL) { fe("Error: The sqrt() function requires one argument.\n"); } //Number xvar *n = evaluate(args); double num = dubVal(n); free_xvar(n); double root = sqrt(num); return double_xvar(root); } //Substring Function (it'll work for lists too later) else if(!strcmp(name, "sub")) { //At Least One Argument if(args == NULL) { fe("Error: The sub() function requires at least one argument.\n"); } //The String xvar *string = evaluate(args); char *s = strVal(string); free_xvar(string); args = args->next; //The Starting Position if(args == NULL) return string_xvar(s); xvar *start = evaluate(args); int p = intVal(start); free_xvar(start); args = args->next; //Number of Characters int n; if(args == NULL) n = -1; else { xvar *num = evaluate(args); n = intVal(num); free_xvar(num); } char *sub = substr(s, p, n); return string_xvar(sub); } //String Replace else if(!strcmp(name, "replace")) { //Two Arguments if(!(args != NULL && args->next != NULL)) { fe("Error: The replace() function requires at least two arguments.\n"); } //The String xvar *string = evaluate(args); char *s = strVal(string); free_xvar(string); args = args = args->next; //The Substring to Replace xvar *substr = evaluate(args); char *sub = strVal(substr); free_xvar(substr); args = args->next; //The Replacement Text (Defaults to "") char *rep = ""; if(args != NULL) { xvar *replace = evaluate(args); rep = strVal(replace); free_xvar(replace); args = args->next; } //Number of Occurrences to Replace (Defaults to Unlimited) int num = 0; if(args != NULL) { xvar *number = evaluate(args); num = intVal(number); free_xvar(number); } //Replace, Free, Return! char *replaced = str_replace(s, sub, rep, num); free(s); return string_xvar(replaced); } //String to Uppercase else if(!strcmp(name, "upper")) { //One Argument if(args == NULL) { fe("Error: The upper() function requires at least one argument.\n"); } xvar *string = evaluate(args); char *s = strVal(string); free_xvar(string); char *copy = s; while(*s) { if(*s >= 'a' && *s <= 'z') *s -= 32; s++; } return string_xvar(copy); } /* Case Conversion Functions upper() -- upper case lower() -- lower case upperw() -- upper case words lowerw() -- lower case words upperf() -- upper case first lowerf() -- lower case first */ //String to Lowercase else if(!strcmp(name, "lower")) { //One Argument if(args == NULL) { fe("Error: The lower() function requires at least one argument.\n"); } xvar *string = evaluate(args); char *s = strVal(string); free_xvar(string); char *copy = s; while(*s) { if(*s >= 'A' && *s <= 'Z') *s += 32; s++; } return string_xvar(copy); } //Upper Case Words else if(!strcmp(name, "upperw")) { //One Argument if(args == NULL) { fe("Error: The upperw() function requires at least one argument.\n"); } xvar *string = evaluate(args); char *s = strVal(string); free_xvar(string); char *copy = s; if(*s >= 'a' && *s <= 'z') *s++ -= 32; while(*s) { if(*s >= 'a' && *s <= 'z' && (*(s-1)) == ' ') *s -= 32; s++; } return string_xvar(copy); } //Lower Case Words else if(!strcmp(name, "lowerw")) { //One Argument if(args == NULL) { fe("Error: The lowerw() function requires at least one argument.\n"); } xvar *string = evaluate(args); char *s = strVal(string); free_xvar(string); char *copy = s; if(*s >= 'A' && *s <= 'Z') *s++ += 32; while(*s) { if(*s >= 'A' && *s <= 'Z' && (*(s-1)) == ' ') *s += 32; s++; } return string_xvar(copy); } //Upper Case First else if(!strcmp(name, "upperf")) { //One Argument if(args == NULL) { fe("Error: The upperf() function requires at least one argument.\n"); } xvar *string = evaluate(args); char *s = strVal(string); free_xvar(string); char *copy = s; if(*s >= 'a' && *s <= 'z') *s -= 32; return string_xvar(copy); } //Lower Case First else if(!strcmp(name, "lowerf")) { //One Argument if(args == NULL) { fe("Error: The lowerf() function requires at least one argument.\n"); } xvar *string = evaluate(args); char *s = strVal(string); free_xvar(string); char *copy = s; if(*s >= 'A' && *s <= 'Z') *s += 32; return string_xvar(copy); } //String Split (Explode) else if(!strcmp(name, "split")) { //One Argument if(args == NULL) { fe("Error: The split() function requires at least one argument.\n"); } //The String xvar *string = evaluate(args); char *s = strVal(string); free_xvar(string); args = args->next; //Split On char *on = " "; if(args != NULL) { xvar *spliton = evaluate(args); on = strVal(spliton); free_xvar(spliton); } //Create the List link_str *ls = str_split(s, on); List *l = coal_alloc(sizeof(List)); List *lc = l; List *lp = l; int i = 0; while(ls != NULL) { lc->next = coal_alloc(sizeof(List)); lc->var = string_xvar(ls->str); lp = lc; lc = lc->next; ls = ls->next; i++; } if(i) { free(lp->next); lp->next = NULL; } else { free(l); l = NULL; } return list_xvar(l); } //Join Lists else if(!strcmp(name, "join")) { //One Argument if(args == NULL) { fe("Error: The join() function requires at least one argument.\n"); } xvar *list = evaluate(args); if(list->type != 'l') return list; List *l = list->val->l; if(l == NULL) return list; args = args->next; //Join On char *j = strdup(""); if(args != NULL) { xvar *join = evaluate(args); j = strVal(join); free_xvar(join); } char *joined = join_list(l, j); free_xvar(list); free(j); return string_xvar(joined); } //String Position else if(!strcmp(name, "pos")) { //One Argument if(args == NULL) { fe("Error: The pos() function requires at least one argument.\n"); } //Haystack xvar *string = evaluate(args); char *h = strVal(string); free_xvar(string); args = args->next; if(args == NULL) return integer_xvar(0); //Needle xvar *needle = evaluate(args); char *n = strVal(needle); free_xvar(needle); //Position char *pos = strstr(h, n); if(pos == NULL) return integer_xvar(-1); return integer_xvar(pos - h); } /* Regular Expression Functions list match(string, regex); list match_all(string, regex); list reg_split(string, regex, [splits : unlimited]); string reg_replace(string, regex, [replacement : "", replacements : unlimited]); */ //Regex Match else if(!strcmp(name, "match")) { if(args == NULL || args->next == NULL) { fe("Error: The match() function requires two arguments.\n"); } //The String xvar *string = evaluate(args); char *s = strVal(string); char *sptr = s; free_xvar(string); //The Regular Expression xvar *regex = evaluate(args->next); char *r = strVal(regex); free_xvar(regex); //The RE Object pcre *re; //Number of Matches int re_matches; //Error Stuff const char *re_error; int re_error_offset; //Compile the Regular Expression re = pcre_compile(r, 0, &re_error, &re_error_offset, NULL); //Did it compile? if(re == NULL) { printf("Error: The regular expressio n (%s) failed to compile at offset %i.\n Message: %s\n", r, re_error_offset, re_error); exit(1); } //Number of Matches int ovector_size; pcre_fullinfo(re, NULL, PCRE_INFO_CAPTURECOUNT , &ovector_size); ovector_size = (ovector_size + 1) * 3; int ovector[ovector_size]; //Execute the Match re_matches = pcre_exec(re, NULL, s, strlen(s), 0, 0, ovector, ovector_size); //No Matches if(re_matches == PCRE_ERROR_NOMATCH) { pcre_free(re); free(s); free(r); return list_xvar(NULL); } //An Error Occurred else if(re_matches < 0) { printf("Error: An unknown error occurred while executing the regular expression\n"); exit(1); } //All Good if(re_matches == 0) re_matches = ovector_size / 3; //The List List *l = coal_alloc(sizeof(List)); List *lc = l; List *lp = NULL; //Add all Matches to the List int i; const char *match; for(i=0; i < re_matches; i++) { pcre_get_substring(s, ovector, re_matches, i, &match); lc->var = string_xvar(strdup(match)); lc->next = coal_alloc(sizeof(List)); lp = lc; lc = lc->next; //Free Substring pcre_free_substring(match); } //Free Everything pcre_free(re); free(s); free(r); free(lp->next); lp->next = NULL; return list_xvar(l); } //Match All else if(!strcmp(name, "match_all")) { if(args == NULL || args->next == NULL) { fe("Error: The match_all() function requires two arguments.\n"); } //The String xvar *string = evaluate(args); char *s = strVal(string); char *sptr = s; free_xvar(string); //The Regular Expression xvar *regex = evaluate(args->next); char *r = strVal(regex); free_xvar(regex); //The RE Object pcre *re; //The Studied Extra pcre_extra *extra; //Number of Matches int re_matches; //Error Stuff const char *re_error; int re_error_offset; //Compile the Regular Expression re = pcre_compile(r, 0, &re_error, &re_error_offset, NULL); //Did it compile? if(re == NULL) { printf("Error: The regular expressio n (%s) failed to compile at offset %i.\n Message: %s\n", r, re_error_offset, re_error); exit(1); } //Since we're matching multiple times, optimize the regex extra = pcre_study(re, 0, &re_error); //Did it optimize the regex? if(re_error != NULL) { printf("Error: The regular expression (%s) failed to optimize.\n Message: %s\n", r, re_error); exit(1); } //Number of Matches int ovector_size; pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT , &ovector_size); ovector_size = (ovector_size + 1) * 3; int ovector[ovector_size]; //The Entire List List *l1 = coal_alloc(sizeof(List)); List *l1c = l1; List *l1p = NULL; //Execute All Matches while((re_matches = pcre_exec(re, extra, s, strlen(s), 0, 0, ovector, ovector_size)) >= 0) { l1c->next = coal_alloc(sizeof(List)); //Too many matches if(re_matches == 0) re_matches = ovector_size / 3; //All Good //The Second List List *l2 = coal_alloc(sizeof(List)); List *l2c = l2; List *l2p = NULL; //Add all Matches to the List int i; const char *match; for(i=0; i < re_matches; i++) { pcre_get_substring(s, ovector, re_matches, i, &match); l2c->var = string_xvar(strdup(match)); l2c->next = coal_alloc(sizeof(List)); l2p = l2c; l2c = l2c->next; //Free Substring pcre_free_substring(match); } //Update Source String s = s + ovector[1]; //Free the Match pcre_free_substring(match); //Free Extra List Stuff free(l2p->next); l2p->next = NULL; //Add sublist to the main list l1c->var = list_xvar(l2); l1p = l1c; l1c = l1c->next; } //Free Extra List Stuff free(l1p->next); l1p->next = NULL; //Free the String and Regex free(sptr); free(r); //Free the Regex and the Extra pcre_free(re); if(extra != NULL) pcre_free(extra); return list_xvar(l1); } //Match All else if(!strcmp(name, "reg_split")) { if(args == NULL || args->next == NULL) { fe("Error: The match_all() function requires two arguments.\n"); } //The String xvar *string = evaluate(args); char *s = strVal(string); char *sptr = s; free_xvar(string); //The Regular Expression xvar *regex = evaluate(args->next); char *r = strVal(regex); free_xvar(regex); //Optional Number of Splits int num = -1; if(args->next->next != NULL) { xvar *number = evaluate(args->next->next); num = intVal(number); if(num == 0) num = -1; free_xvar(number); } //The RE Object pcre *re; //The Studied Extra pcre_extra *extra; //Number of Matches int re_matches; //Error Stuff const char *re_error; int re_error_offset; //Compile the Regular Expression re = pcre_compile(r, 0, &re_error, &re_error_offset, NULL); //Did it compile? if(re == NULL) { printf("Error: The regular expressio n (%s) failed to compile at offset %i.\n Message: %s\n", r, re_error_offset, re_error); exit(1); } //Since we're matching multiple times, optimize the regex extra = pcre_study(re, 0, &re_error); //Did it optimize the regex? if(re_error != NULL) { printf("Error: The regular expression (%s) failed to optimize.\n Message: %s\n", r, re_error); exit(1); } //Number of Matches int ovector_size; pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT , &ovector_size); ovector_size = (ovector_size + 1) * 3; int ovector[ovector_size]; //The Entire List List *l = coal_alloc(sizeof(List)); List *lc = l; List *lp = NULL; //Execute All Matches while((re_matches = pcre_exec(re, extra, s, strlen(s), 0, 0, ovector, ovector_size)) >= 0 && num != 0) { lc->next = coal_alloc(sizeof(List)); //Too many matches if(re_matches == 0) re_matches = ovector_size / 3; //Update Source String s[ovector[0]] = '\0'; //The String char *part = strdup(s); s = s + ovector[1]; //Add substring to list lc->var = string_xvar(part); lp = lc; lc = lc->next; num--; } //Free Extra List Stuff lc->next = NULL; lc->var = string_xvar(strdup(s)); //Free the String and Regex free(sptr); free(r); //Free the Regex and the Extra pcre_free(re); if(extra != NULL) pcre_free(extra); return list_xvar(l); } //Match All else if(!strcmp(name, "reg_replace")) { if(args == NULL || args->next == NULL) { fe("Error: The reg_replace() function requires two arguments.\n"); } //The String xvar *string = evaluate(args); char *s = strVal(string); char *sptr = s; free_xvar(string); args = args->next; //The Regular Expression xvar *regex = evaluate(args); char *r = strVal(regex); free_xvar(regex); args = args->next; //The Replacement Text char *rep = strdup(""); if(args != NULL) { xvar *replace = evaluate(args); rep = strVal(replace); free_xvar(replace); args = args->next; } //Optional Number of Replacements int num = -1; if(args != NULL) { xvar *number = evaluate(args); num = intVal(number); if(num == 0) num = -1; free_xvar(number); } //The RE Object pcre *re; //The Studied Extra pcre_extra *extra; //Number of Matches int re_matches; //Error Stuff const char *re_error; int re_error_offset; //Compile the Regular Expression re = pcre_compile(r, 0, &re_error, &re_error_offset, NULL); //Did it compile? if(re == NULL) { printf("Error: The regular expressio n (%s) failed to compile at offset %i.\n Message: %s\n", r, re_error_offset, re_error); exit(1); } //Since we're matching multiple times, optimize the regex extra = pcre_study(re, 0, &re_error); //Did it optimize the regex? if(re_error != NULL) { printf("Error: The regular expression (%s) failed to optimize.\n Message: %s\n", r, re_error); exit(1); } //Number of Matches int ovector_size; pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT , &ovector_size); ovector_size = (ovector_size + 1) * 3; int ovector[ovector_size]; //Result char *result = strdup(""); //Execute All Matches while((re_matches = pcre_exec(re, extra, s, strlen(s), 0, 0, ovector, ovector_size)) >= 0 && num != 0) { char *p1 = substr(s, 0, ovector[0]); char *result_ptr = result; result = concat(result, p1); free(result_ptr); result_ptr = result; result = concat(result, rep); free(result_ptr); free(p1); s = s + ovector[1]; num--; } //Free the String and Regex free(r); free(rep); //Free the Regex and the Extra pcre_free(re); if(extra != NULL) pcre_free(extra); char *result_ptr = result; result = concat(result, s); free(result_ptr); free(sptr); return string_xvar(result); } else if(!strcmp(name, "delete")) { while(args != NULL) { if(args->p == VAR_NODE) { var_node *vn = (var_node *) args->sn; char *name = vn->name; char scope = vn->scope; SET_SCOPE(); unset(name); } else if(args->s == ELEMENT_NODE) { element_node *en = ( element_node *) args->sn; node_t *value = en->value; if(value->p != VAR_NODE) { fe("Error The delete() function annot unset a value.\n"); } var_node *vn = (var_node *) value->sn; char *name = vn->name; char scope = vn->scope; xvar *element = evaluate(en->el); int el = intVal(element); free_xvar(element); SET_SCOPE(); delete_element(lookup(name, 1), el); } else { fe("Error: The delete() function cannot unset anything other than variables and elements.\n"); } args = args->next; } return NULL; } else if(!strcmp(name, "length")) { if(args == NULL) { return integer_xvar(0); } xvar *arg = evaluate(args); int length = xvar_length(arg); free_xvar(arg); return integer_xvar(length); } else if(!strcmp(name, "include")) { node_t *save = root; xvar *file = evaluate(args); char *file_name = strVal(file); free_xvar(file); mmgr_node *save_b = mmgr_b; mmgr_node *save_c = mmgr_c; coal_parse(file_name); mmgr_b = save_b; mmgr_c = save_c; free(file_name); root = save; return NULL; } else if(!strcmp(name, "exit")) { print_xvar(evaluate(args)); exit(1); } //Random Integer else if(!strcmp(name, "rand")) { srand(time(NULL)); return integer_xvar(rand()); } //Special Function for Chad //Returns a Random Element from an Array or String else if(!strcmp(name, "chad")) { xvar *v = evaluate(args); srand(time(NULL)); int i, length; if(v->type == 's') length = strlen(v->val->s); else if(v->type == 'l') { List *l = v->val->l; i = 0; for(l;l != NULL;l = l->next) i++; length = i; } else return integer_xvar(0); int random = rand() % (length); if(v->type == 's') { char *n = malloc(2); n[0] = (v->val->s)[random]; n[1] = '\0'; return string_xvar(n); } else if(v->type == 'l') { List *l = v->val->l; i = 0; for(l;l != NULL;l = l->next,i++) if(i == random) return dup_xvar(l->var); } else return integer_xvar(0); return NULL; } //Css Function else if(!strcmp(name, "css")) { int flag = 0; char *file = strVal(evaluate(args)); if(args->next != NULL) flag = intVal(evaluate(args->next)); if(flag) { char *open_style = "<style type=\"text/css\">\n"; char *contents = file_get_contents(file); char *close_style = "\n</style>"; char *step_one = concat(open_style, contents); char *style = concat(step_one, close_style); free(step_one); free(contents); free(file); return string_xvar(style); } else { char *link_open = "<link rel=\"stylesheet\" type=\"text/css\" href=\""; char *link_close = "\" />"; char *step_one = concat(link_open, file); char *link = concat(step_one, link_close); free(step_one); free(file); return string_xvar(link); } } //JS Function else if(!strcmp(name, "js")) { int flag = 0; char *file = strVal(evaluate(args)); if(args->next != NULL) flag = intVal(evaluate(args->next)); if(flag) { char *open_style = "<script type=\"text/javascript\">\n"; char *contents = file_get_contents(file); char *close_style = "\n</script>"; char *step_one = concat(open_style, contents); char *style = concat(step_one, close_style); free(step_one); free(contents); free(file); return string_xvar(style); } else { char *link_open = "<srcipt type=\"text/javascript\" src=\""; char *link_close = "\"></script>"; char *step_one = concat(link_open, file); char *link = concat(step_one, link_close); free(step_one); free(file); return string_xvar(link); } } /* MySQL Functions -- Being Implemented Now mysql_connect(); mysql_query(); mysql_close(); mysql_free_result(); mysql_affected(); mysql_data_seek(); mysql_fetch_row(); mysql_select_db(); mysql_insert_id(); mysql_errno(); mysql_error(); */ //MySQL Connect (Memory Leaks!!!) else if(!strcmp(name, "mysql_connect")) { MYSQL *con = mysql_init(NULL); if(con == NULL) { fe("Error: The mysql_connect() function could not initialize a MySQL connection!\n"); } char *host; char *user; char *pass; char *db; int port; char *socket; int flag; if(args != NULL) { xvar *tmp = evaluate(args); host = strVal(tmp); free_xvar(tmp); args = args->next; } else host = NULL; if(args != NULL) { xvar *tmp = evaluate(args); user = strVal(tmp); free_xvar(tmp); args = args->next; } else user = NULL; if(args != NULL) { xvar *tmp = evaluate(args); pass = strVal(tmp); free_xvar(tmp); args = args->next; } else pass = NULL; if(args != NULL) { xvar *tmp = evaluate(args); db = strVal(tmp); free_xvar(tmp); args = args->next; } else db = NULL; if(args != NULL) { xvar *tmp = evaluate(args); port = intVal(tmp); free_xvar(tmp); args = args->next; } else port = 0; if(args != NULL) { xvar *tmp = evaluate(args); socket = strVal(tmp); free_xvar(tmp); args = args->next; } else socket = NULL; if(args != NULL) { xvar *tmp = evaluate(args); flag = intVal(tmp); free_xvar(tmp); args = args->next; } else flag = 0; //Connect xvar *return_val; //This is probably redundant MYSQL *connection; if((connection = mysql_real_connect(con, host, user, pass, db, port, socket, flag)) == NULL) return_val = integer_xvar(0); else return_val = mysql_con_xvar(connection); free(host); free(user); free(pass); free(db); free(socket); return return_val; } //Query the Database else if(!strcmp(name, "mysql_query")) { if(args == NULL || args->next == NULL) { fe("Error: The mysql_query() function requires at least two parameters.\n"); } xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_query() function requires a valid MySQL connection\n"); } MYSQL *con = mysql->val->m->con; free_xvar(mysql); args = args->next; //The Query xvar *query = evaluate(args); char *q = strVal(query); free_xvar(query); args = args->next; //Optional: Store or Use Result? int store = 1; if(args != NULL) { xvar *store_tmp = evaluate(args); store = intVal(store_tmp); free_xvar(store_tmp); } //Run the Query int return_val = mysql_query(con, q); free(q); //Error if(return_val) return integer_xvar(0); //Use Result MYSQL_RES *res; if(store) res = mysql_store_result(con); else res = mysql_use_result(con); //Error if(res == NULL) return integer_xvar(0); //Success return mysql_res_xvar(res); } //MySQL Data Seek else if(!strcmp(name, "mysql_data_seek")) { if(args == NULL || args->next == NULL) { fe("Error: The mysql_data_seek function requires two arguments."); } xvar *result = evaluate(args); if(result->type != 'r') { fe("Error: The mysql_data_seek() function requires a valid MySQL result set.\n"); } //The Offset xvar *offset = evaluate(args->next); int o = intVal(offset); free_xvar(offset); //The Connection MYSQL_RES *r = result->val->m->res; free_xvar(result); //Number of Rows int rows = mysql_num_rows(r); if(o >= rows) o = rows - 1; //Seek mysql_data_seek(r, o); //Return return integer_xvar(o); } //MySQL Field Seek else if(!strcmp(name, "mysql_field_seek")) { if(args == NULL || args->next == NULL) { fe("Error: The mysql_field_seek function requires two arguments."); } xvar *result = evaluate(args); if(result->type != 'r') { fe("Error: The mysql_field_seek() function requires a valid MySQL result set.\n"); } //The Offset xvar *offset = evaluate(args->next); int o = intVal(offset); free_xvar(offset); //The Connection MYSQL_RES *r = result->val->m->res; free_xvar(result); //Out of Bounds int fields = mysql_num_fields(r); if(o >= fields) o = fields - 1; //Return return integer_xvar(mysql_field_seek(r, o)); } //MySQL Field Lengths else if(!strcmp(name, "mysql_fetch_lengths")) { if(args == NULL) { fe("Error: The mysql_fetch_lengths function requires one arguments."); } xvar *result = evaluate(args); if(result->type != 'r') { fe("Error: The mysql_fetch_lengths function requires a valid MySQL result set.\n"); } //The Connection MYSQL_RES *r = result->val->m->res; free_xvar(result); //Number of Rows unsigned long *lengths; lengths = mysql_fetch_lengths(r); int fields = mysql_num_fields(r); //No Fields if(fields == 0) return list_xvar(NULL); List *l = coal_alloc(sizeof(List)); List *lc = l; List *lp = NULL; int i; for(i = 0; i < fields; i++) { lc->next = coal_alloc(sizeof(List)); int length = lengths[i]; lc->var = integer_xvar(length); lp = lc; lc = lc->next; } free(lp->next); lp->next = NULL; return list_xvar(l); } //MySQL Fetch Field else if(!strcmp(name, "mysql_fetch_field")) { if(args == NULL) { fe("Error: The mysql_fetch_field function requires one arguments."); } xvar *result = evaluate(args); if(result->type != 'r') { fe("Error: The mysql_fetch_field function requires a valid MySQL result set.\n"); } //The Connection MYSQL_RES *r = result->val->m->res; free_xvar(result); args = args->next; MYSQL_FIELD *field; //Optional Offset if(args != NULL) { xvar *offset = evaluate(args); int o = intVal(offset); free_xvar(offset); int fields = mysql_num_fields(r); if(o >= fields) o = fields - 1; field = mysql_fetch_field_direct(r, o); } else { field = mysql_fetch_field(r); } //No Fields Left if(field == NULL) return integer_xvar(0); //All Good Hash **h = coal_alloc(sizeof(Hash) * HASHSIZE); Hash **hash_save = hash_ptr; hash_ptr = h; hash_init(); //Add Everything to the Dictionary add("name", string_xvar(strdup(field->name))); add("org_name", string_xvar(strdup(field->org_name))); add("table", string_xvar(strdup(field->table))); add("org_table", string_xvar(strdup(field->org_table))); add("db", string_xvar(strdup(field->db))); add("catalog", string_xvar(strdup(field->catalog))); add("length", integer_xvar(field->length)); add("max_length", integer_xvar(field->max_length)); add("charsetnr", integer_xvar(field->charsetnr)); unsigned int flags = field->flags; enum enum_field_types type = field->type; //Not Null add("nn", integer_xvar(IS_NOT_NULL(flags))); //Primary Key add("pk", integer_xvar(IS_PRI_KEY(flags))); //Auto Increment add("ai", integer_xvar(flags & AUTO_INCREMENT_FLAG)); //Unique Key add("uk", integer_xvar(flags & UNIQUE_KEY_FLAG)); //Multiple Key add("mk", integer_xvar(flags & MULTIPLE_KEY_FLAG)); //Unsigned add("us", integer_xvar(flags & UNSIGNED_FLAG)); //Zero Fill add("zf", integer_xvar(flags & ZEROFILL_FLAG)); //Binary add("bin", integer_xvar(flags & BINARY_FLAG)); //Numeric add("num", integer_xvar(flags & NUM_FLAG)); //No Default Value add("ndv", integer_xvar(flags & NO_DEFAULT_VALUE_FLAG)); //Data Type char *d; switch(type) { case MYSQL_TYPE_TINY: d = "tiny"; break; case MYSQL_TYPE_SHORT: d = "smallint"; break; case MYSQL_TYPE_LONG: d = "int"; break; case MYSQL_TYPE_INT24: d = "mediumint"; break; case MYSQL_TYPE_LONGLONG: d = "bigint"; break; case MYSQL_TYPE_DECIMAL: d = "decimal"; break; case MYSQL_TYPE_NEWDECIMAL: d = "ndecimal"; break; case MYSQL_TYPE_FLOAT: d = "float"; break; case MYSQL_TYPE_DOUBLE: d = "double"; break; case MYSQL_TYPE_BIT: d = "bit"; break; case MYSQL_TYPE_TIMESTAMP: d = "timestamp"; break; case MYSQL_TYPE_DATE: d = "date"; break; case MYSQL_TYPE_TIME: d = "time"; break; case MYSQL_TYPE_DATETIME: d = "datetime"; break; case MYSQL_TYPE_YEAR: d = "year"; break; case MYSQL_TYPE_STRING: d = "char"; break; case MYSQL_TYPE_VAR_STRING: d = "varchar"; break; case MYSQL_TYPE_BLOB: d = "blob"; break; case MYSQL_TYPE_SET: d = "set"; break; case MYSQL_TYPE_ENUM: d = "enum"; break; case MYSQL_TYPE_GEOMETRY: d = "geometry"; break; case MYSQL_TYPE_NULL: d = "null"; break; default: d = ""; } add("type", string_xvar(strdup(d))); hash_ptr = hash_save; return hash_xvar(h); } //MySQL Num Rows else if(!strcmp(name, "mysql_num_rows")) { if(args == NULL) { fe("Error: The mysql_num_rows function requires one arguments."); } xvar *result = evaluate(args); if(result->type != 'r') { fe("Error: The mysql_num_rows function requires a valid MySQL result set.\n"); } //The Connection MYSQL_RES *r = result->val->m->res; free_xvar(result); //Number of Rows int rows = mysql_num_rows(r); return integer_xvar(rows); } //MySQL Num Fields else if(!strcmp(name, "mysql_num_fields")) { if(args == NULL) { fe("Error: The mysql_num_fields function requires one arguments."); } xvar *result = evaluate(args); if(result->type != 'r') { fe("Error: The mysql_num_fields function requires a valid MySQL result set.\n"); } //The Connection MYSQL_RES *r = result->val->m->res; free_xvar(result); //Number of Rows int rows = mysql_num_fields(r); return integer_xvar(rows); } //MySQL Field Count else if(!strcmp(name, "mysql_field_count")) { if(args == NULL) { fe("Error: The mysql_field_count function requires one arguments."); } xvar *result = evaluate(args); if(result->type != 'm') { fe("Error: The mysql_field_count function requires a valid MySQL connection.\n"); } //The Connection MYSQL *m = result->val->m->con; free_xvar(result); //Number of Rows int count = mysql_field_count(m); return integer_xvar(count); } //MySQL Charset Name else if(!strcmp(name, "mysql_character_set_name")) { if(args == NULL) { fe("Error: The mysql_character_set_name function requires one argument.\n"); } xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_character_set_name function requires a valid MySQL connection.\n"); } MYSQL *m = mysql->val->m->con; free_xvar(mysql); return string_xvar(strdup(mysql_character_set_name(m))); } //MySQL Escape String else if(!strcmp(name, "mysql_escape_string")) { if(args == NULL && args->next != NULL) { fe("Error: The mysql_escape_string function requires two argument.\n"); } xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_escape_string function requires a valid MySQL connection.\n"); } MYSQL *m = mysql->val->m->con; free_xvar(mysql); //The String to Escape xvar *string = evaluate(args->next); char *s = strVal(string); free_xvar(string); //Result String char *result = coal_alloc(strlen(s) * 2 + 1); mysql_real_escape_string(m, result, s, strlen(s)); free(s); return string_xvar(result); } //MySQL Set Charset else if(!strcmp(name, "mysql_set_charset")) { if(args == NULL && args->next != NULL) { fe("Error: The mysql_set_charset function requires two argument.\n"); } xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_set_charset function requires a valid MySQL connection.\n"); } MYSQL *m = mysql->val->m->con; free_xvar(mysql); //Character Set xvar *string = evaluate(args->next); char *s = strVal(string); free_xvar(string); int result = mysql_set_character_set(m, s); free(s); return integer_xvar(result == 0); } //MySQL Server Status else if(!strcmp(name, "mysql_stat")) { if(args == NULL) { fe("Error: The mysql_stat function requires one argument.\n"); } xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_stat function requires a valid MySQL connection.\n"); } MYSQL *m = mysql->val->m->con; free_xvar(mysql); const char *result = mysql_stat(m); if(result != NULL && *result) return string_xvar(strdup(result)); else return string_xvar(strdup("")); } //MySQL Info else if(!strcmp(name, "mysql_info")) { if(args == NULL) { fe("Error: The mysql_info function requires one argument.\n"); } xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_info function requires a valid MySQL connection.\n"); } MYSQL *m = mysql->val->m->con; free_xvar(mysql); const char *result = mysql_info(m); if(result != NULL) return string_xvar(strdup(result)); else return string_xvar(strdup("")); } //MySQL Client Info else if(!strcmp(name, "mysql_get_client_info")) { return string_xvar(strdup(mysql_get_client_info())); } //MySQL Client Version else if(!strcmp(name, "mysql_get_client_version")) { return integer_xvar(mysql_get_client_version()); } //MySQL Host Info else if(!strcmp(name, "mysql_get_host_info")) { if(args == NULL) { fe("Error: The mysql_get_host_info function requires one argument.\n"); } xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_get_host_info function requires a valid MySQL connection.\n"); } MYSQL *m = mysql->val->m->con; free_xvar(mysql); const char *result = mysql_get_host_info(m); return string_xvar(strdup(result)); } //MySQL Protocol Info else if(!strcmp(name, "mysql_get_proto_info")) { if(args == NULL) { fe("Error: The mysql_get_proto_info function requires one argument.\n"); } xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_get_proto_info function requires a valid MySQL connection.\n"); } MYSQL *m = mysql->val->m->con; free_xvar(mysql); return integer_xvar(mysql_get_proto_info(m)); } //MySQL Server Info else if(!strcmp(name, "mysql_get_server_info")) { if(args == NULL) { fe("Error: The mysql_get_server_info function requires one argument.\n"); } xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_get_server_info function requires a valid MySQL connection.\n"); } MYSQL *m = mysql->val->m->con; free_xvar(mysql); return string_xvar(strdup(mysql_get_server_info(m))); } //MySQL Server Version else if(!strcmp(name, "mysql_get_server_version")) { if(args == NULL) { fe("Error: The mysql_get_server_version function requires one argument.\n"); } xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_get_server_version function requires a valid MySQL connection.\n"); } MYSQL *m = mysql->val->m->con; free_xvar(mysql); return integer_xvar(mysql_get_server_version(m)); } //MySQL Ping else if(!strcmp(name, "mysql_ping")) { if(args == NULL) { fe("Error: The mysql_ping function requires one argument.\n"); } xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_ping function requires a valid MySQL connection.\n"); } MYSQL *m = mysql->val->m->con; free_xvar(mysql); return integer_xvar(mysql_ping(m) == 0); } //MySQL Thread ID else if(!strcmp(name, "mysql_thread")) { if(args == NULL) { fe("Error: The mysql_thread function requires one argument.\n"); } xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_thread function requires a valid MySQL connection.\n"); } MYSQL *m = mysql->val->m->con; free_xvar(mysql); return integer_xvar(mysql_thread_id(m)); } //MySQL Error Number else if(!strcmp(name, "mysql_errno")) { if(args == NULL) { fe("Error: The mysql_errno function requires one argument.\n"); } xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_errno function requires a valid MySQL connection.\n"); } MYSQL *m = mysql->val->m->con; free_xvar(mysql); return integer_xvar(mysql_errno(m)); } //MySQL Error Message else if(!strcmp(name, "mysql_error")) { if(args == NULL) { fe("Error: The mysql_error function requires one argument.\n"); } xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_error function requires a valid MySQL connection.\n"); } MYSQL *m = mysql->val->m->con; free_xvar(mysql); return string_xvar(strdup(mysql_error(m))); } //MySQL Fetch Row else if(!strcmp(name, "mysql_fetch_row")) { xvar *mysql = evaluate(args); return mysql_row_to_list(mysql); } //MySQL Affected Rows else if(!strcmp(name, "mysql_affected")) { xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_affected() function requires a valid MySQL connection.\n"); } int affected = mysql_affected_rows(mysql->val->m->con); free_xvar(mysql); return integer_xvar(affected); } //Select a Database else if(!strcmp(name, "mysql_select_db")) { //If this function is not passed a valid MySQL object, it doesn't hurt anything just to ignore the error and move on. if(args == NULL || args->next == NULL) return integer_xvar(0); //Get the MySQL object and Database Name xvar *mysql = evaluate(args); xvar *database = evaluate(args->next); char *db = strVal(database); free_xvar(database); if(mysql->type != 'm') { free_xvar(mysql); return integer_xvar(0); } //Can I free db? int result = mysql_select_db(mysql->val->m->con, db); free(db); free_xvar(mysql); return integer_xvar(result == 0); } //MySQL Insert ID else if(!strcmp(name, "mysql_insert_id")) { //Stupid Programmer if(args == NULL) { fe("Error: The mysql_insert_id() function requires a valid MySQL connection.\n"); } //Get the MySQL object and Database Name xvar *mysql = evaluate(args); if(mysql->type != 'm') { fe("Error: The mysql_insert_id() function requires a valid MySQL connection.\n"); } int result = mysql_insert_id(mysql->val->m->con); free_xvar(mysql); return integer_xvar(result); } //Free a Result else if(!strcmp(name, "mysql_free_result")) { //If this function is not passed a valid MySQL object, it doesn't hurt anything just to ignore the error and move on. if(args == NULL) return integer_xvar(0); xvar *mysql = evaluate(args); if(mysql->type != 'r') { free_xvar(mysql); return integer_xvar(0); } mysql_free_result(mysql->val->m->res); free_xvar(mysql); return integer_xvar(1); } //Close a Connection else if(!strcmp(name, "mysql_close")) { //If this function is not passed a valid MySQL object, it doesn't hurt anything just to ignore the error and move on. if(args == NULL) return integer_xvar(0); xvar *mysql = evaluate(args); if(mysql->type != 'm') { free_xvar(mysql); return integer_xvar(0); } mysql_close(mysql->val->m->con); free_xvar(mysql); return integer_xvar(1); } //Does a variable, list element, string element, or dictionary element exist? else if(!strcmp(name, "set")) { while(args != NULL) { //Variables if(args->p == VAR_NODE && args->s != HASH_LOOKUP_NODE) { //Look Up Variable var_node *vn = (var_node *) args->sn; char *name = vn->name; char scope = vn->scope; SET_SCOPE(); xvar *v = lookup(name, 0); //If NULL, the variable doesn't exist if(v == NULL) return integer_xvar(0); } //String and Lists else if(args->s == ELEMENT_NODE) { //Get the List and Element element_node *en = (element_node *) args->sn; xvar *list = evaluate(en->value); xvar *element = evaluate(en->el); int el = intVal(element); free_xvar(element); //Get Length int length = xvar_length(list); free_xvar(list); if(el >= length) return integer_xvar(0); } //Dictionary Element else if(args->s == HASH_LOOKUP_NODE) { //Get the Key hash_lookup_node *hn = (hash_lookup_node *) args->sn; xvar *k = evaluate(hn->key); char *key = strVal(k); free_xvar(k); //And the Variable xvar *d = evaluate(hn->var); Hash **hash_save = hash_ptr; hash_ptr = d->val->h; xvar *val = lookup(key, 0); hash_ptr = hash_save; //Doesn't exist! if(val == NULL) return integer_xvar(0); } args = args->next; } return integer_xvar(1); } //Typeof Value else if(!strcmp(name, "typeof")) { extern int line_number; xvar *t = evaluate(args); char *type = malloc(2); type[0] = t->type; type[1] = '\0'; free_xvar(t); return string_xvar(type); } //Set a Session Cookie else if(!strcmp(name, "cookie")) { char *format = "Set-Cookie: %s=%s; %s %s %s %s %s\n"; if(args != NULL && args->next != NULL) { xvar *tmp; tmp = evaluate(args); char *name = strVal(tmp); free_xvar(tmp); args = args->next; tmp = evaluate(args); char *value = strVal(tmp); free_xvar(tmp); args = args->next; char *max_age = strdup(""); if(args != NULL) { tmp = evaluate(args); max_age = strVal(tmp); char *ptr = max_age; max_age = concat(max_age, ";"); free(ptr); ptr = max_age; max_age = concat("Max-Age=", max_age); free(ptr); free_xvar(tmp); args = args->next; } char *path = strdup(""); if(args != NULL) { tmp = evaluate(args); path = strVal(tmp); char *ptr = path; path = concat(path, ";"); free(ptr); ptr = path; path = concat("Path=", path); free(ptr); free_xvar(tmp); args = args->next; } char *domain = strdup(""); if(args != NULL) { tmp = evaluate(args); domain = strVal(tmp); char *ptr = domain; domain = concat(domain, ";"); free(ptr); ptr = domain; domain = concat("Domain=", domain); free(ptr); free_xvar(tmp); args = args->next; } char *secure = strdup(""); if(args != NULL) { tmp = evaluate(args); if(if_xvar(tmp)) secure = strdup("Secure;"); args = args->next; } char *http_only = strdup(""); if(args != NULL) { tmp = evaluate(args); if(if_xvar(tmp)) http_only = strdup("HttpOnly"); args = args->next; } //Print the Cookie printf(format, name, value, max_age, path, domain, secure, http_only); free(name); free(value); free(max_age); free(path); free(domain); free(secure); free(http_only); } else { fe("Error: The cookie() function requires at least two arguments.\n"); } return integer_xvar(1); } //File Handling Functions //Open File else if(!strcmp(name, "fo")) { //Two Arguments if(args == NULL) { fe("Error: The fo() requires requires at least arguments.\n"); } xvar *filename = evaluate(args); char *f = strVal(filename); free_xvar(filename); args = args->next; char *m = "r+"; if(args != NULL) { xvar *mode = evaluate(args->next); m = strVal(mode); free_xvar(mode); } FILE *fp = fopen(f, m); if(fp == NULL) return integer_xvar(0); return file_xvar(fp); } //Read From File else if(!strcmp(name, "fr")) { //One Arguments if(args == NULL) { fe("Error: The fr() function requires at least one argument.\n"); } //File and length xvar *file = evaluate(args); xvar *length = NULL; if(args->next != NULL) { length = evaluate(args->next); } //Valid file object if(file->type != 'f') { fe("Error: The fr() function requries a valid file object.\n"); } //The File FILE *fp = file->val->f; //Read the whole file int size; if(length == NULL) { int before = ftell(fp); fseek(fp, 0, SEEK_END); size = ftell(fp) - before; fseek(fp, before, SEEK_SET); } //Only part of the file else { size = intVal(length); } free_xvar(length); free_xvar(file); //The Return String char *s = malloc(size + 1); char *copy = s; char c; int i = 0; while(i < size && (c = fgetc(fp)) != EOF) { *copy++ = c; i++; } *copy = '\0'; return string_xvar(s); } //Write to File else if(!strcmp(name, "fw")) { //Two Arguments if(!(args != NULL && args->next != NULL)) { fe("Error: The fw() function requires two arguments.\n"); } //File and Characters to be Writen xvar *file = evaluate(args); xvar *string = evaluate(args->next); char *str = strVal(string); free_xvar(string); FILE *fp = file->val->f; free_xvar(file); //Write Each Character int i = 0; while(*str) { //Return Error if(fputc(*str++, fp) == EOF) return integer_xvar(0); i++; } //Return Number of Characters Written return integer_xvar(i); } //Close a File else if(!strcmp(name, "fc")) { //We don't really care what we're given if(args == NULL) { return integer_xvar(0); } xvar *file = evaluate(args); if(file->type != 'f') return integer_xvar(0); fclose(file->val->f); return integer_xvar(1); } //Remove a File else if(!strcmp(name, "fd")) { //One Argument if(args == NULL) { fe("Error: The fd() function requires at least one argument.\n"); } //Evaluate, Get String Value, and Remove xvar *f = evaluate(args); char *fn = strVal(f); int i = remove(fn); //Free, Free, and Return free(fn); free_xvar(f); return integer_xvar(i == 0); } //Environment Variables ($_SERVER in PHP) else if(!strcmp(name, "getenv")) { if(args == NULL) { printf("Error: The getenv() function requires one argument.\n"); exit(1); } xvar *string = evaluate(args); char *s = strVal(string); free_xvar(string); char *ge = getenv(s); free(s); if(ge == NULL) return string_xvar(strdup("")); return string_xvar(strdup(ge)); } //Add a Property to an Object else if(!strcmp(name, "add_prop")) { //Two Arguments if(args == NULL || args->next == NULL) { fe("Error: The add_prop() function requires two arguments."); } //Object xvar *object = evaluate(args); if(object->type != 'o') return integer_xvar(0); Object *o = object->val->o; free_xvar(object); args = args->next; //Property Name xvar *name = evaluate(args); char *n = strVal(name); free_xvar(name); args = args->next; //Optional Value xvar *value = NULL; if(args != NULL) value = evaluate(args); //The Attribute to Add Attributes *a = coal_alloc(sizeof(Attributes)); a->name = n; a->value = value; a->protect = 'x'; a->strong = 'a'; a->next = NULL; //No Properties if(o->attrs == NULL) { o->attrs = a; return integer_xvar(1); } Attributes *an = o->attrs; while(an->next != NULL) an = an->next; an->next = a; return integer_xvar(1); } //Copy (Objects, Dictionaries (Works with other stuff as well)) else if(!strcmp(name, "copy")) { if(args == NULL) { fe("Error: The copy() function requires at least one argument.\n"); } xvar *arg = evaluate(args); //Non Objects and Dictionaries if(arg->type != 'h' && arg->type != 'o') { xvar *dup = dup_xvar(arg); free_xvar(arg); return dup; } //Dictionary else if(arg->type == 'h') { Hash **h = arg->val->h; Hash **copy = coal_alloc(sizeof(Hash *) * HASHSIZE); int i; for(i=0;i<HASHSIZE;i++) { copy[i] = coal_alloc(sizeof(Hash)); Hash *h2; Hash *c2 = copy[i]; Hash *c2_copy = c2; Hash *p = c2; int j = 0; for(h2 = h[i];h2 != NULL; h2 = h2->next, p = c2_copy, c2_copy = c2_copy->next, j++) { c2_copy->next = coal_alloc(sizeof(Hash)); c2_copy->key = strdup(h2->key); c2_copy->value = dup_xvar(h2->value); } if(j) { free(c2_copy); p->next = NULL; } else { free(c2); c2 = NULL; } } free_xvar(arg); return hash_xvar(copy); } //Object else { Object *x = arg->val->o; Object *o = coal_alloc(sizeof(Object)); o->name = strdup(x->name); o->attrs = coal_alloc(sizeof(Attributes)); o->methods = x->methods; int i = 0; Attributes *oa = o->attrs; Attributes *oa_copy = oa; Attributes *xa = x->attrs; while(xa != NULL) { oa->next = coal_alloc(sizeof(Attributes)); oa->name = strdup(xa->name); oa->value = NULL; oa->protect = xa->protect; oa->strong = xa->strong; oa_copy = oa; oa = oa->next; xa = xa->next; i++; } if(i) { free(oa_copy->next); oa_copy->next = NULL; } else { free(o->attrs); o->attrs = NULL; } free_xvar(arg); return object_xvar(o); } }
d4d04801f916c4618c8b978b6a7cd846666c1438
80d57414c3c6734997d5001a0b406bd403e11e96
/src/fhapi/graphics_shader.h
d71deebb186682753741d2864633f12b1cbc07ee
[ "MIT" ]
permissive
libretro-mirrors/clove
d55a9a43e465999db8799c88dcf94472d7550151
070706761faaae8c12be0dca8df98f4d128cc903
refs/heads/master
2021-03-25T11:12:50.148963
2020-03-06T19:32:56
2020-03-06T19:32:56
247,612,671
1
0
null
null
null
null
UTF-8
C
false
false
463
h
graphics_shader.h
/* # clove # # Copyright (C) 2019 Muresan Vlad # # This project is free software; you can redistribute it and/or modify it # under the terms of the MIT license. See LICENSE.md for details. */ #pragma once #include "../3rdparty/FH/src/fh.h" #include "../include/shader.h" #define FH_GRAPHICS_SHADER 8 typedef struct { graphics_Shader shader; int referencedTextures; } fh_graphics_Shader; void fh_graphics_shader_register(struct fh_program *prog);
548830dd03a4189d4da2b47c5e75781518f6bf6c
0e7b0976321a366436e94515bc570aa99b74e7ff
/src/integralmgr.c
fd21cd31676fc09e7c52a0c73694229c9e831833
[]
no_license
ManDay/quicksolve
a05de5c7220b1789a5399f8aef45ee59b34f4f42
460691d9c06381fbc2ce6fe930f2a415e1007e91
refs/heads/master
2020-12-21T03:58:47.840052
2017-08-17T12:34:08
2017-08-17T12:34:08
58,954,648
0
0
null
null
null
null
UTF-8
C
false
false
10,765
c
integralmgr.c
#define _GNU_SOURCE #include "integralmgr.h" #include <stdlib.h> #include <string.h> #include <assert.h> #include <stdio.h> #include <pthread.h> #include "db.h" struct Target { QsIntegral integral; bool master; }; struct Databases { QsDb read; QsDb readwrite; }; struct Substitution { char* name; char* value; }; struct QsIntegralMgr { unsigned n_integrals; unsigned allocated; struct Target* integrals; char* ro_prefix; char* ro_suffix; char* rw_prefix; char* rw_suffix; unsigned n_dbs; struct Databases** dbs; unsigned n_substitutions; struct Substitution* substitutions; }; static struct Databases open_db( QsIntegralMgr m,QsPrototype p,bool create_rw ) { if( !( p<m->n_dbs ) ) { m->dbs = realloc( m->dbs,( p + 1 )*sizeof (struct Databases*) ); int j; for( j = m->n_dbs; j<p + 1; j++ ) m->dbs[ j ]= NULL; m->n_dbs = p + 1; } bool new; if( ( new = !m->dbs[ p ] ) ) { m->dbs[ p ]= malloc( sizeof (struct Databases) ); char* filename; asprintf( &filename,"%s%i%s",m->ro_prefix,p,m->ro_suffix ); m->dbs[ p ]->read = qs_db_new( filename,QS_DB_READ ); free( filename ); } if( new || ( !m->dbs[ p ]->readwrite && create_rw ) ) { char* filename; asprintf( &filename,"%s%i%s",m->rw_prefix,p,m->rw_suffix ); m->dbs[ p ]->readwrite = qs_db_new( filename,QS_DB_WRITE|( create_rw?QS_DB_CREATE:0 ) ); free( filename ); } return *( m->dbs[ p ] ); } void qs_integral_mgr_add_substitution( QsIntegralMgr m,char* symbol,char* value ) { m->substitutions = realloc( m->substitutions,++( m->n_substitutions )*sizeof (struct Substitution) ); m->substitutions[ m->n_substitutions - 1 ]= (struct Substitution){ strdup( symbol ),strdup( value ) }; } /** Load and save * * QsIntegralMgr loads and saves data in a downwards compatible manner * to IdSolver. In particular, this refers to different formats of the * identity entries in the databases. * * Identity Database, generated by IdSolver, "idPR#.dat" * - Expression with order * - Empty expression with order * * Solution Database, generated and modified by possibly both, "PR#.dat": * - Expression * - Empty expression * - Expression with metadata * * The structure of an Expression is * * <Expression> := <Term>* * <Term> := <Int Size:int> <Integral> <Coeff Size:int> <Coeff:char[]> * <Integral> := <Prototype:char[]> '\0' <Powers> * <Powers> := <Power:char>* * * whereas an empty expression is just a 0 byte * * <Empty Expression> := '\0' * * With those definitions, we further have * * <Expression with order> := <Expression> <Order:int> * <Empty expression with order> := <Empty expression> <Order:int> * * Since every <Term> is at least 2 time the size of an int, we have the * option to enhance any <Expression> by 2 integers less a single byte * (7 bytes). * This additional data constitutes the <Metadata>, used by Quicksolve. * Contrary to IdSolver then, which only stores expression for assigned * integrals in the solution database and may therefore omit that * integral's order (because it will not be relevant once an integral * has been solved), Quicksolve may store identities at any intermediate * stage of the solution, storing transient data alongside. * * When loading an identity, we can then distinguish between the two * formats by parsing the expression, which will detect that it can't * extend beyond the current point if only 3 bytes are left. When this * happens (i.e. 7 bytes are left after the end of the expression), we * know that we're dealing with an <Expression with metadata>. * * Currently, the seven bytes metadata are assigned as * * <Metadata> = <Order:int> <Solved:char> '\0' '\0' * * Expressions with metadata are interpreted as identities as-is, as are * Expressions with order. Empty expressions with and without order as * well as Expressions without metadata in the solution database are * interpreted as the given expression -1 times the integral to which is * is associated. * */ void qs_integral_mgr_save_expression( QsIntegralMgr m,QsComponent i,struct QsReflist l,struct QsMetadata meta ) { QsExpression e = qs_expression_new_with_size( meta.solved?l.n_references - 1:l.n_references ); int j; for( j = 0; j<l.n_references; j++ ) if( !meta.solved || l.references[ j ].head!=i ) qs_expression_add( e,l.references[ j ].coefficient,qs_integral_mgr_peek( m,l.references[ j ].head ) ); QsIntegral in = qs_integral_mgr_peek( m,i ); struct Databases dbs = open_db( m,qs_integral_prototype( in ),true ); struct QsDbEntry* entry = malloc( sizeof (struct QsDbEntry) ); entry->keylen = qs_integral_n_powers( in )*sizeof (QsPower); entry->key = malloc( entry->keylen ); memcpy( entry->key,qs_integral_powers( in ),entry->keylen ); size_t expression_size = qs_expression_to_binary( e,&entry->val ); if( meta.solved ) entry->vallen = expression_size; else { assert( QS_METADATA_USAGE<=QS_METADATA_SIZE ); entry->vallen = expression_size + QS_METADATA_SIZE; entry->val = realloc( entry->val,entry->vallen ); char flags =( meta.solved?1:0 )|( meta.touched?2:0 ); *( (int*)( entry->val + expression_size ) )= meta.order; *( (short*)( entry->val + expression_size + sizeof (int) ) )= meta.consideration; *( (char*)( entry->val + expression_size + sizeof (int) + sizeof (short) ) )= flags; } qs_db_set( dbs.readwrite,entry ); qs_db_entry_destroy( entry ); qs_expression_disband( e ); } QsExpression qs_integral_mgr_load_raw( QsIntegralMgr m,QsIntegral in,struct QsMetadata* meta ) { QsExpression result = NULL; bool sub_self = false; struct Databases dbs = open_db( m,qs_integral_prototype( in ),false ); unsigned n_powers = qs_integral_n_powers( in ); const QsPower* pwrs = qs_integral_powers( in ); unsigned keylen = n_powers*sizeof (QsPower); struct QsDbEntry* data; if( dbs.readwrite &&( data = qs_db_get( dbs.readwrite,(char*)pwrs,keylen ) ) ) { /* Obtain identity from solution database */ unsigned n; result = qs_expression_new_from_binary( data->val,data->vallen,&n ); if( data->vallen>=n+QS_METADATA_SIZE ) { meta->order = *( (int*)( data->val + n ) ); meta->consideration = *( (short*)( data->val + n + sizeof (int) ) ); char flags = *( (char*)( data->val + n + sizeof (int) + sizeof (short) ) ); meta->solved = flags&1; meta->touched = flags&2; } else { meta->order = 0; meta->consideration = 0; meta->solved = true; meta->touched = false; sub_self = true; } qs_db_entry_destroy( data ); } else if( dbs.read &&( data = qs_db_get( dbs.read,(char*)pwrs,keylen ) ) ) { /* Obtain identity from identity database */ result = qs_expression_new_from_binary( data->val,data->vallen,NULL ); meta->order = *( (int*)( data->val + data->vallen - sizeof (int) ) ); meta->consideration = 0; meta->solved = false; meta->touched = false; if( result ) if( qs_expression_n_terms( result )==1 && qs_coefficient_is_one( qs_expression_coefficient( result,0 ) ) ) sub_self = true; qs_db_entry_destroy( data ); } else return result; /* TODO: Discarding the number of considerations on write back * operations for memory reduction has side effects when we are in a * desperate back substitutions. */ meta->consideration = 0; if( qs_expression_n_terms( result )==0 || sub_self ) qs_expression_add( result,qs_coefficient_one( true ),qs_integral_cpy( in ) ); return result; } struct QsReflist qs_integral_mgr_load_expression( QsIntegralMgr m,QsComponent i,struct QsMetadata* meta ) { struct QsReflist result ={ 0,NULL }; if( m->integrals[ i ].master ) return result; QsExpression e = qs_integral_mgr_load_raw( m,m->integrals[ i ].integral,meta ); if( !e ) { m->integrals[ i ].master = true; return result; } result.n_references = qs_expression_n_terms( e ); result.references = malloc( result.n_references*sizeof (struct QsReference) ); int j; for( j = 0; j<result.n_references; j++ ) { QsIntegral integral = qs_expression_integral( e,j ); QsCoefficient coefficient = qs_expression_coefficient( e,j ); int k; for( k = 0; k<m->n_substitutions; k++ ) qs_coefficient_substitute( coefficient,m->substitutions[ k ].name,m->substitutions[ k ].value ); result.references[ j ].coefficient = coefficient; result.references[ j ].head = qs_integral_mgr_manage( m,integral ); } qs_expression_disband( e ); return result; } QsIntegral qs_integral_mgr_peek( QsIntegralMgr m,QsComponent i ) { if( !( i<m->n_integrals ) ) return NULL; return m->integrals[ i ].integral; } QsIntegralMgr qs_integral_mgr_new_with_size( const char* ro_prefix,const char* ro_suffix,const char* rw_prefix,const char* rw_suffix,unsigned prealloc ) { QsIntegralMgr result = malloc( sizeof (struct QsIntegralMgr) ); result->n_integrals = 0; result->allocated = prealloc; result->integrals = malloc( prealloc*sizeof (struct Target) ); result->ro_prefix = strdup( ro_prefix ); result->ro_suffix = strdup( ro_suffix ); result->rw_prefix = strdup( rw_prefix ); result->rw_suffix = strdup( rw_suffix ); result->n_dbs = 0; result->dbs = malloc( 0 ); result->n_substitutions = 0; result->substitutions = malloc( 0 ); return result; } /** Take responsibility of the integral * * Takes ownership of the integral and will return a unique pointer to * that integral. * * @param This * @param[transfer full] The integral to manage * @return The uniquely assigned Id of the Integral */ QsComponent qs_integral_mgr_manage( QsIntegralMgr g,QsIntegral i ) { int j = 0; while( j<g->n_integrals && qs_integral_cmp( g->integrals[ j ].integral,i ) ) j++; if( j==g->n_integrals ) { if( g->allocated==g->n_integrals ) g->integrals = realloc( g->integrals,++( g->allocated )*sizeof (struct Target) ); g->integrals[ j ].integral = i; g->integrals[ j ].master = false; g->n_integrals++; } else { /* If we're told to manage the very integral that we gave to you or * that you previously told us to manage, you're doing something * ugly */ assert( g->integrals[ j ].integral!=i ); qs_integral_destroy( i ); } return j; } void qs_integral_mgr_destroy( QsIntegralMgr m ) { int j; for( j = 0; j<m->n_integrals; j++ ) qs_integral_destroy( m->integrals[ j ].integral ); for( j = 0; j<m->n_dbs; j++ ) { struct Databases* dbs = m->dbs[ j ]; if( dbs ) { if( dbs->read ) qs_db_destroy( dbs->read ); if( dbs->readwrite ) qs_db_destroy( dbs->readwrite ); free( dbs ); } } for( j = 0; j<m->n_substitutions; j++ ) { free( m->substitutions[ j ].name ); free( m->substitutions[ j ].value ); } free( m->substitutions ); free( m->integrals ); free( m->ro_prefix ); free( m->ro_suffix ); free( m->rw_prefix ); free( m->rw_suffix ); free( m->dbs ); free( m ); }
934129186780b31d0f0b3c9b3e9c641543f12c12
a3c604effcb34c7a9594a7a37e2ec618aab4c74f
/reference/cvs/inc/vmbejj.h
ecc6529a0cdacf8d25178d1d97c38767c8374113
[]
no_license
jvonwimm/aleph64bit
09d9d48db51ed8c5f868b5409c6b7a78bfff8e6f
a779f00fd147a2fd3b1f81e0d65ca09509045c88
refs/heads/main
2023-02-04T06:10:49.338430
2020-12-16T00:59:48
2020-12-16T00:59:48
301,156,974
0
2
null
null
null
null
UTF-8
C
false
false
90
h
vmbejj.h
*CD vmbejj INTEGER JVMBAD,JVMBFC,LVMBEA PARAMETER(JVMBAD=1,JVMBFC=2,LVMBEA=2)
ceca39a298bb29c0bae371ab2d10c6770497dd28
9b8b80cc2f20afaa2f2d2de5289e562cbe88e234
/ex20/ft_strdup.c
7a07e439a61a11baa279fcbda6c92c57067896ac
[]
no_license
cyril-lemaire/42_piscine_reloaded
0759694e271e095ac8becd97bf34d98be08d3880
0f8141e96207e25092ccd961e44b4ab431051d01
refs/heads/master
2021-08-19T04:01:34.172400
2017-11-24T16:56:55
2017-11-24T16:56:55
111,123,563
0
0
null
null
null
null
UTF-8
C
false
false
1,211
c
ft_strdup.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strdup.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: clemaire <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/11/07 12:20:15 by clemaire #+# #+# */ /* Updated: 2017/11/10 12:14:46 by clemaire ### ########.fr */ /* */ /* ************************************************************************** */ #include <stdlib.h> int ft_strlen(char *s) { int i; i = 0; while (s[i] != '\0') { i++; } return (i); } char *ft_strdup(char *s) { char *res; int size; int i; size = ft_strlen(s) + 1; res = (char*)malloc(size * sizeof(char)); i = 0; while (i < size) { res[i] = s[i]; ++i; } return (res); }
d1b2eba4f0a43ae1ddba7cd54131b27975816cb0
09983c6483eb2a6234aa7765f0b64702e3fd1af5
/浙大版《C语言程序设计(第3版)》题目集/习题5-1 符号函数.c
7b1b558647949e73eca2997bf413a9e433504a9e
[]
no_license
sby5388/pat
bf6fb19178577040ff445d27b475345637deccfc
7b9583f6cef31636ee23f4904c7de6d6d196aabf
refs/heads/master
2022-03-19T20:12:56.354079
2019-12-09T06:42:22
2019-12-09T06:42:22
152,557,370
0
0
null
null
null
null
GB18030
C
false
false
636
c
习题5-1 符号函数.c
/* 习题5-1 符号函数 (10 分) 本题要求实现符号函数sign(x)。 函数接口定义: int sign( int x ); 其中x是用户传入的整型参数。符号函数的定义为:若x大于0,sign(x) = 1;若x等于0,sign(x) = 0;否则,sign(x) = -1 输入样例: 10 输出样例: sign(10) = 1 */ #include <stdio.h> int sign( int x ); int main() { int x; scanf("%d", &x); printf("sign(%d) = %d\n", x, sign(x)); return 0; } /* 你的代码将被嵌在这里 */ int sign( int x ){ int result; if(x>0){ result = 1; }else if(x==0){ result = 0; }else{ result = -1; } return result; }
62cdf08d86e491c22822c8796bdfab02735b4fbc
5020ed68d0b7f2273a677c9855b0c18cae789f4d
/src/scene_parser/ast/ast_parse.c
109907f13295d364d1ef26bef3c3373bf5453971
[]
no_license
paperrin/raytracer
6c99c55953a191325fe301e372124faf8ce1f4fc
ddc7a168a3f69f0a6b67576cee21c73474c6060f
refs/heads/master
2021-09-13T23:40:13.740183
2018-05-01T18:14:07
2018-05-01T18:14:07
113,599,274
2
0
null
null
null
null
UTF-8
C
false
false
2,621
c
ast_parse.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ast_parse.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: paperrin <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/03/05 16:21:37 by paperrin #+# #+# */ /* Updated: 2018/04/11 20:03:10 by paperrin ### ########.fr */ /* */ /* ************************************************************************** */ #include "scene_parser/ast.h" static int parse_program(t_ast *const ast, t_token_stream *const tkstream) { t_token *tk_new; t_token **token; ast->v_tokens = ft_vector_create(sizeof(t_token*), NULL, NULL); while (cstream_peek(tkstream->cstream) > -1) { if (!(tk_new = ast_parse_expr(tkstream)) || tkstream->did_error) { if (cstream_peek(tkstream->cstream) < -1) return (tkstream_ferror(tkstream, "read error")); return (!tkstream->did_error); } if (tk_new->type != token_type_op && tk_new->type != token_type_call) return (tkstream_error(tkstream, "unexpected instruction")); if (!(token = (t_token**)ft_vector_push_back(&ast->v_tokens, NULL))) return (tkstream_error(tkstream, ERR_MEMORY)); *token = tk_new; } return (1); } t_ast *ast_parse(char const *const file_path) { t_token_stream *tkstream; t_ast *ast; if (!(tkstream = tkstream_open(file_path))) return (NULL); if ((ast = (t_ast*)malloc(sizeof(*ast)))) { if (!parse_program(ast, tkstream)) { ast_destroy(&ast); return (perror_string("AST parsing failed")); } } else error_string(ERR_MEMORY); tkstream_close(&tkstream); return (ast); } void ast_print(t_ast const *const ast) { int i; int size; ft_putendl("{"); size = (int)ft_vector_size(&ast->v_tokens); i = -1; while (++i < size) { token_print(((t_token**)ast->v_tokens.begin)[i], 1); ft_putendl((i < size - 1) ? "," : ""); } ft_putendl("}"); } void ast_destroy(t_ast **ast) { int i; if (!ast) return ; if (*ast) { i = -1; while (++i < (int)ft_vector_size(&(*ast)->v_tokens)) token_destroy(&((t_token**)(*ast)->v_tokens.begin)[i]); ft_vector_destroy(&(*ast)->v_tokens); ft_memdel((void**)ast); } }
412c6ef0277f89036868d03e5f83b8cea6a68a0a
a78fb83be8e2fc90b3a185daff8b2778e0530a3e
/bucket_CD/libdrm/patches/patch-xf86drm.c
03513b71041d6453a051faeb483ea240b26fd9e3
[ "ISC" ]
permissive
kraileth/ravensource
f8cd02edd422922b6f632e4ba4e4a74bb5d560b8
bd1150741139f5cd9fc5894aa10ee9c64861ecc3
refs/heads/master
2023-03-15T01:39:59.773861
2023-02-07T18:39:44
2023-02-07T18:39:44
106,436,199
0
0
null
2017-10-10T15:32:09
2017-10-10T15:31:56
C
UTF-8
C
false
false
7,504
c
patch-xf86drm.c
--- xf86drm.c.orig 2022-11-03 08:33:36 UTC +++ xf86drm.c @@ -63,7 +63,17 @@ #include <math.h> #include <inttypes.h> -#if defined(__FreeBSD__) +#ifndef O_CLOEXEC +#define O_CLOEXEC 0 +#endif + +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +#define FREEDFLY 1 +#else +#define FREEDFLY 0 +#endif + +#if FREEDFLY #include <sys/param.h> #include <sys/pciio.h> #endif @@ -86,7 +96,10 @@ #endif #ifdef __NetBSD__ -#define DRM_MAJOR 34 +#define DRM_MAJOR 180 +#include <sys/param.h> +#include <dev/pci/pcireg.h> +#include <pci.h> #endif #ifdef __OpenBSD__ @@ -313,8 +326,10 @@ drmGetFormatModifierNameFromArm(uint64_t char *modifier_name = NULL; bool result = false; +#ifndef __sun fp = open_memstream(&modifier_name, &size); if (!fp) +#endif return NULL; switch (type) { @@ -459,8 +474,10 @@ drmGetFormatModifierNameFromAmd(uint64_t tile_version = AMD_FMT_MOD_GET(TILE_VERSION, modifier); dcc = AMD_FMT_MOD_GET(DCC, modifier); +#ifndef __sun fp = open_memstream(&mod_amd, &size); if (!fp) +#endif return NULL; /* add tile */ @@ -963,7 +980,7 @@ static int drmGetMinorBase(int type) static int drmGetMinorType(int major, int minor) { -#ifdef __FreeBSD__ +#if FREEDFLY char name[SPECNAMELEN]; int id; @@ -3219,7 +3236,7 @@ drm_public int drmIsMaster(int fd) drm_public char *drmGetDeviceNameFromFd(int fd) { -#ifdef __FreeBSD__ +#if FREEDFLY struct stat sbuf; int maj, min; int nodetype; @@ -3266,7 +3283,7 @@ static bool drmNodeIsDRM(int maj, int mi snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device/drm", maj, min); return stat(path, &sbuf) == 0; -#elif defined(__FreeBSD__) +#elif FREEDFLY char name[SPECNAMELEN]; if (!devname_r(makedev(maj, min), S_IFCHR, name, sizeof(name))) @@ -3389,7 +3406,7 @@ static char *drmGetMinorNameForFD(int fd closedir(sysdir); return NULL; -#elif defined(__FreeBSD__) +#elif FREEDFLY struct stat sbuf; char dname[SPECNAMELEN]; const char *mname; @@ -3574,6 +3591,65 @@ static int drmParseSubsystemType(int maj return DRM_BUS_VIRTIO; } return subsystem_type; +#elif defined(__NetBSD__) + int type, fd; + drmSetVersion sv; + char *buf; + unsigned domain, bus, dev; + int func; + int ret; + + /* Get the type of device we're looking for to pick the right pathname. */ + type = drmGetMinorType(maj, min); + if (type == -1) + return -ENODEV; + + /* Open the device. Don't try to create it if it's not there. */ + fd = drmOpenMinor(min, 0, type); + if (fd < 0) + return -errno; + + /* + * Set the interface version to 1.4 or 1.1, which has the effect of + * populating the bus id for us. + */ + sv.drm_di_major = 1; + sv.drm_di_minor = 4; + sv.drm_dd_major = -1; + sv.drm_dd_minor = -1; + if (drmSetInterfaceVersion(fd, &sv)) { + sv.drm_di_major = 1; + sv.drm_di_minor = 1; + sv.drm_dd_major = -1; + sv.drm_dd_minor = -1; + if (drmSetInterfaceVersion(fd, &sv)) { + /* + * We're probably not the master. Hope the master already + * set the version to >=1.1 so that we can get the busid. + */ + } + } + + /* Get the bus id. */ + buf = drmGetBusid(fd); + + /* We're done with the device now. */ + (void)close(fd); + + /* If there is no bus id, fail. */ + if (buf == NULL) + return -ENODEV; + + /* Find a string we know about; otherwise -EINVAL. */ + ret = -EINVAL; + if (strncmp(buf, "pci:", 4) == 0) + ret = DRM_BUS_PCI; + + /* We're done with the bus id. */ + free(buf); + + /* Success or not, we're done. */ + return ret; #elif defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__) return DRM_BUS_PCI; #else @@ -3600,7 +3676,7 @@ get_pci_path(int maj, int min, char *pci } #endif -#ifdef __FreeBSD__ +#if FREEDFLY static int get_sysctl_pci_bus_info(int maj, int min, drmPciBusInfoPtr info) { char dname[SPECNAMELEN]; @@ -3685,6 +3761,73 @@ static int drmParsePciBusInfo(int maj, i info->func = func; return 0; +#elif defined(__NetBSD__) + int type, fd; + drmSetVersion sv; + char *buf; + unsigned domain, bus, dev; + int func; + int ret; + + /* Get the type of device we're looking for to pick the right pathname. */ + type = drmGetMinorType(maj, min); + if (type == -1) + return -ENODEV; + + /* Open the device. Don't try to create it if it's not there. */ + fd = drmOpenMinor(min, 0, type); + if (fd < 0) + return -errno; + + /* + * Set the interface version to 1.4 or 1.1, which has the effect of + * populating the bus id for us. + */ + sv.drm_di_major = 1; + sv.drm_di_minor = 4; + sv.drm_dd_major = -1; + sv.drm_dd_minor = -1; + if (drmSetInterfaceVersion(fd, &sv)) { + sv.drm_di_major = 1; + sv.drm_di_minor = 1; + sv.drm_dd_major = -1; + sv.drm_dd_minor = -1; + if (drmSetInterfaceVersion(fd, &sv)) { + /* + * We're probably not the master. Hope the master already + * set the version to >=1.1 so that we can get the busid. + */ + } + } + + /* Get the bus id. */ + buf = drmGetBusid(fd); + + /* We're done with the device now. */ + (void)close(fd); + + /* If there is no bus id, fail. */ + if (buf == NULL) + return -ENODEV; + + /* Parse the bus id. */ + ret = sscanf(buf, "pci:%04x:%02x:%02x.%d", &domain, &bus, &dev, &func); + + /* We're done with the bus id. */ + free(buf); + + /* If scanf didn't return 4 -- domain, bus, dev, func -- then fail. */ + if (ret != 4) + return -ENODEV; + + /* Populate the results. */ + info->domain = domain; + info->bus = bus; + info->dev = dev; + info->func = func; + + /* Success! */ + return 0; #elif defined(__OpenBSD__) || defined(__DragonFly__) struct drm_pciinfo pinfo; int fd, type; @@ -3857,6 +4000,48 @@ static int drmParsePciDeviceInfo(int maj return parse_config_sysfs_file(maj, min, device); return 0; +#elif defined(__NetBSD__) + drmPciBusInfo businfo; + char fname[PATH_MAX]; + int pcifd; + pcireg_t id, class, subsys; + int ret; + + /* Find where on the bus the device lives. */ + ret = drmParsePciBusInfo(maj, min, &businfo); + if (ret) + return ret; + + /* Open the pciN device node to get at its config registers. */ + if (snprintf(fname, sizeof fname, "/dev/pci%u", businfo.domain) + >= sizeof fname) + return -ENODEV; + if ((pcifd = open(fname, O_RDONLY)) == -1) + return -errno; + + ret = -1; + /* Read the id and class pci config registers. */ + if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func, + PCI_ID_REG, &id) == -1) + goto out; + if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func, + PCI_CLASS_REG, &class) == -1) + goto out; + if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func, + PCI_SUBSYS_ID_REG, &subsys) == -1) + goto out; + + ret = 0; + device->vendor_id = PCI_VENDOR(id); + device->device_id = PCI_PRODUCT(id); + device->subvendor_id = PCI_SUBSYS_VENDOR(subsys); + device->subdevice_id = PCI_SUBSYS_ID(subsys); + device->revision_id = PCI_REVISION(class); +out: + if (ret == -1) + ret = -errno; + close(pcifd); + return ret; #elif defined(__OpenBSD__) || defined(__DragonFly__) struct drm_pciinfo pinfo; int fd, type;
bc13071da0bdaf55b2eefa050425f9b7f77d8960
377d2d43a4b23c2a46c8b2a5c4b1fe74fa31ed7b
/unix/control.c
258e6a86ab197bc6b01a7d339c3b675a3901a2f2
[ "MIT" ]
permissive
hajimehoshi/libui
6285fa9fe7b461c14d82f0b5fb82178452a986de
09458c794a43d31d00c1a23a1241766054d09c87
refs/heads/master
2021-01-17T07:05:13.939998
2016-01-12T23:14:48
2016-01-12T23:14:48
49,583,651
1
0
null
2016-01-13T15:47:20
2016-01-13T15:47:20
null
UTF-8
C
false
false
927
c
control.c
// 16 august 2015 #include "uipriv_unix.h" static uintmax_t type_uiUnixControl = 0; uintmax_t uiUnixControlType(void) { if (type_uiUnixControl == 0) type_uiUnixControl = uiRegisterType("uiUnixControl", uiControlType(), sizeof (uiUnixControl)); return type_uiUnixControl; } static void defaultCommitShow(uiControl *c) { gtk_widget_show(GTK_WIDGET(uiControlHandle(c))); } static void defaultCommitHide(uiControl *c) { gtk_widget_hide(GTK_WIDGET(uiControlHandle(c))); } void osCommitEnable(uiControl *c) { gtk_widget_set_sensitive(GTK_WIDGET(uiControlHandle(c)), TRUE); } void osCommitDisable(uiControl *c) { gtk_widget_set_sensitive(GTK_WIDGET(uiControlHandle(c)), FALSE); } void uiUnixFinishControl(uiControl *c) { g_object_ref_sink(GTK_WIDGET(uiControlHandle(c))); if (!isToplevel(c)) gtk_widget_show(GTK_WIDGET(uiControlHandle(c))); c->CommitShow = defaultCommitShow; c->CommitHide = defaultCommitHide; }
89844d49925c44100d877abfcdfbc18ce8c7cb2d
73c71311c08cb8d58b75dcd06c7a31f8b097b956
/ewk/efl_webview_app/elm_cycle_app.c
ffdc0923f8dae95f2b911f489005ff8da21b5963
[ "BSD-3-Clause" ]
permissive
crosswalk-project/chromium-efl
47927f6e17c0553d3756d9b9ca5c3e783b3641b8
3c1af10d16e2df57e8584378b79f0ff3335eb99d
refs/heads/efl/crosswalk-10/39.0.2171.19
2023-03-23T12:34:43.754226
2014-12-15T23:47:39
2014-12-15T23:47:39
27,436,290
9
14
null
2015-01-21T08:10:49
2014-12-02T14:33:10
C++
UTF-8
C
false
false
4,905
c
elm_cycle_app.c
// Copyright 2014 Samsung Electronics. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <Elementary.h> #include <string.h> #include <stdio.h> #include <Evas.h> #include <Eina.h> #include <Ecore.h> #include <Ecore_X.h> #include "efl_integration/public/ewk_context.h" #include "efl_integration/public/ewk_main.h" #include "efl_integration/public/ewk_view.h" static Evas_Object* g_win; static Evas_Object* g_testObject; static Ecore_Timer* g_timer; static int g_updateTime = 10; static int g_repeatCount = 25; static const char* g_urls[4] = {"http://www.google.com", "http://www.yahoo.com", "http://msn.com", "http://naver.com"}; static int g_urlCount = 4; //back forward not working yet #define BACK_FORWARD_TEST 0 void render_init(int argc, char** argv); void render_start(); void render_stop(); void render_deinit(); //close button handler static void on_done(void *data, Evas_Object *obj, void *event_info); static Eina_Bool update_timer_callback(void* data) { printf("%s\n", __FUNCTION__); render_stop(); render_start(); g_timer = NULL; return ECORE_CALLBACK_CANCEL; } int in_back_test() { #if BACK_FORWARD_TEST if(g_repeatCount <= 16 && g_repeatCount > 13) return 1; else return 0; #else return 0; #endif } int in_forward_test() { #if BACK_FORWARD_TEST if(g_repeatCount <= 13 && g_repeatCount > 8) return 1; else return 0; #else return 0; #endif } void render_init(int argc, char** argv) { const char* env; if ((env = getenv("WEBVIEW_TEST_INTERVAL"))) g_updateTime = atoi(env); if ((env = getenv("WEBVIEW_TEST_COUNT"))) g_repeatCount = atoi(env); printf("### WebView test (%d)\n", g_repeatCount); elm_init(argc, argv); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); g_win = elm_win_add(NULL, "webview-profiling", ELM_WIN_BASIC); evas_object_smart_callback_add(g_win, "delete,request", on_done, NULL); evas_object_size_hint_weight_set(g_win, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); int w, h; ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); evas_object_move(g_win, 0, 0); evas_object_resize(g_win, w, h); evas_object_color_set(g_win, 255, 255, 255, 255); evas_object_show(g_win); ewk_init(); } void render_deinit() { printf("%s\n", __FUNCTION__); if (g_win) { evas_object_del(g_win); g_win = NULL; } } void render_start() { if(g_repeatCount <= 0) { evas_object_del(g_win); g_win = NULL; return; } if(in_back_test()) { if(ewk_view_back_possible(g_testObject)) { printf("Test #%d Back possible, going back \n", 26 - g_repeatCount); ewk_view_back(g_testObject); } else { printf("back not possible #%d URL: %s \n", 26 - g_repeatCount, g_urls[g_repeatCount%g_urlCount]); ewk_view_url_set(g_testObject, g_urls[g_repeatCount%g_urlCount]); } g_timer = ecore_timer_add(g_updateTime, update_timer_callback, NULL); return; } if(in_forward_test()) { if(ewk_view_forward_possible(g_testObject)) { printf("Test #%d forward possible, going forward \n", 26 - g_repeatCount ); ewk_view_forward(g_testObject); } else { printf("forward not possible Test #%d URL: %s \n", 26 - g_repeatCount, g_urls[g_repeatCount%g_urlCount]); ewk_view_url_set(g_testObject, g_urls[g_repeatCount%g_urlCount]); } g_timer = ecore_timer_add(g_updateTime, update_timer_callback, NULL); return; } if (g_testObject) { evas_object_del(g_testObject); g_testObject = NULL; } Evas* e = evas_object_evas_get (g_win); // create webview Ewk_Context* context = ewk_context_default_get(); g_testObject = ewk_view_add_with_context(e, context); int w, h; ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); evas_object_resize(g_testObject, w, h); // load start printf("Test #%d URL: %s \n", 26 - g_repeatCount, g_urls[g_repeatCount%g_urlCount]); ewk_view_url_set(g_testObject, g_urls[g_repeatCount%g_urlCount]); evas_object_focus_set(g_testObject, EINA_TRUE); evas_object_show(g_testObject); g_timer = ecore_timer_add(g_updateTime, update_timer_callback, NULL); } void render_stop() { g_repeatCount--; printf("render stop\n"); if (!g_testObject) { return; } if (g_timer) { ecore_timer_del(g_timer); g_timer = NULL; } if(!(in_back_test() || in_forward_test())) { printf("delete evas objects\n"); //we dont delete g_win object because that terminates ecore main loop evas_object_del(g_testObject); g_testObject = NULL; } } static void on_done(void *data, Evas_Object *obj, void *event_info) { render_stop(); elm_exit(); } int main(int argc, char **argv) { render_init(argc, argv); render_start(); elm_run(); elm_shutdown(); return 0; }
5f65b631697414c48c84e0f1142cf796c01b3ff4
30e2573bb639f15550ea0a828656bba1a7946f96
/PlayfairCipher/playfair.h
f1f52e40d9a61c3994dd0cd441d4ba160b4c917c
[]
no_license
StanciuAlin/DataSecurityEncryptionDecryptionAlgo
478518c1f51608bd2639e7b662576ccf54a6f76f
d63e6fd4e3ab3e6fbb873539e4b1bd227b64f223
refs/heads/main
2023-01-14T05:02:46.594088
2020-11-23T07:11:52
2020-11-23T07:11:52
313,008,538
0
0
null
null
null
null
UTF-8
C
false
false
1,861
h
playfair.h
#pragma once #define SIZE_FILENAME 30 #define SIZE_BUFFER 3000 #define ALPHABET_CHARS 26 #define ASCII_UPPER_A 65 #define ASCII_UPPER_Z 90 #define UPPER_LOWER_CHAR_DIFF 32 #define ASCII_LOWER_A 97 #define WHITESPACE ' ' #define END_STRING '\0' #define POLYBIUS_TABLE_SIZE 5 #define KEY_CHAR_APPEAR 2 #define ALPHABET_CHAR_APPEAR 1 #define LINE_CHAR_POS_CH1 0 #define COLUMN_CHAR_POS_CH1 1 #define LINE_CHAR_POS_CH2 2 #define COLUMN_CHAR_POS_CH2 3 #define TIME_TO_WAIT_PROCESSING 0 #define TIMES_ITERATION_PRINT_DOT_IN_CONSOLE 3 #ifndef ENCRYPT #define ENCRYPT 1 #endif // !ENCRYPT #ifndef DECRYPT #define DECRYPT 1 #endif // !DECRYPT FILE* inFile; FILE* outFile; const char* outFilename = "output.txt"; const char* inFilename = "input.txt"; int* whitespacesPos; int counterWhiteSpaces = 0; void OpenFileToRead(); void OpenFileToWrite(); int RemoveWhitespaces(char* text); void ToLowerCase(char* text); void ParseText(char* text); void GeneratePolybiusSquare(char* key, char polySquare[POLYBIUS_TABLE_SIZE][POLYBIUS_TABLE_SIZE]); void Search(char polySquare[POLYBIUS_TABLE_SIZE][POLYBIUS_TABLE_SIZE], char ch1, char ch2, int* arrPosChars); int Modulo5(int x); void Encrypt(char* text, char polySquare[POLYBIUS_TABLE_SIZE][POLYBIUS_TABLE_SIZE]); void Decrypt(char* text, char polySquare[POLYBIUS_TABLE_SIZE][POLYBIUS_TABLE_SIZE]); void EncryptByPlayfairCipher(char* text, char* key); void DecryptByPlayfairCipher(char* text, char* key); void ReadTextStd(char* text, const char* message); void CountWhitespaces(char* text); void UndoDoubleChars(char* text); void UndoWhitespaces(char* text); void PostProcessText(char* text);
5d970b369d674c572c37e2c86ef6334e6feeeb60
fc09446f4714524001b15f5b96322ddf1d1be7c8
/Kamek/include/course.h
f18ad2bce1e7bc8858690cb5b911ad6f2c43f39b
[]
no_license
Zement/NewerGEM
8ac23857597a9be6c704be8cf07768f2151f1bd9
7bfd9ccb96ca0b73c76306e4a1c3ec9ad72fbbeb
refs/heads/master
2022-12-14T23:03:45.719984
2022-11-27T22:19:30
2022-11-27T22:19:30
198,833,922
11
3
null
2021-07-22T17:42:27
2019-07-25T13:10:43
C++
UTF-8
C
false
false
2,086
h
course.h
#ifndef __KAMEK_COURSE_H #define __KAMEK_COURSE_H #include <common.h> struct BGDatObject_t { s16 objType; s16 x; s16 y; s16 width; s16 height; }; struct Block1 { char tileset0[32]; char tileset1[32]; char tileset2[32]; char tileset3[32]; }; #define COURSE_FLAG_WRAP 1 struct Block2 { u64 defaultEvents; s16 courseFlags; s16 timeLimit; u8 unk1; u8 unk2; u8 unk3; u8 unk4; u8 startEntrance; u8 unk5; u8 unk6; u8 unk7; }; struct Block3 { s32 yBoundNormalTop; s32 yBoundNormalBottom; s32 yBoundSpecialTop; s32 yBoundSpecialBottom; u16 entryID; u16 lockToBottom; u32 unknown; }; struct Block4 { u16 unk1; u16 unk2; u16 unk3; u16 unk4; }; struct BGSettings { u16 entryID; u16 xScrollRate; u16 yScrollRate; u16 yPosOffset; u16 xPosOffset; u16 fileID1; u16 fileID2; u16 fileID3; u16 unk1; u16 scale; u32 unk2; }; #define ENTRANCE_FLAG_NO_ENTRY 0x80 #define ENTRANCE_FLAG_CONNECTED_PIPE 8 #define ENTRANCE_FLAG_LINK_TO_FORWARD 4 #define ENTRANCE_FLAG_CONNECTED_REVERSE 1 struct Block7 { s16 xPos; s16 yPos; s16 cameraXPos; s16 cameraYPos; u8 entryID; u8 destArea; u8 destEntrance; u8 type; u8 unk1; u8 zoneID; u8 layerID; u8 pathID; u16 flags; u16 unk2; }; struct Block8 { u16 type; s16 xPos; s16 yPos; u16 eventIDs; u32 settings; u8 zoneID; u8 layerID; u16 unused; }; struct Block9 { u16 type; u16 unused; }; struct Block10 { s16 xPos; s16 yPos; s16 xSize; s16 ySize; s16 objShading; s16 bgShading; u8 zoneID; u8 boundingID; u8 scrollMode; u8 zoomMode; u8 unk1; u8 lightMode; u8 fgID; u8 bgID; u8 unk2; u8 unk3; u8 music; u8 audioModifier; }; struct Block11 { s16 xPos; s16 yPos; s16 xSize; s16 ySize; u8 entryID; u8 unused[3]; }; struct Block12 { u32 unk1; u32 unk2; u32 unk3; u8 unk4; u8 scrollMode; u8 zoomMode; u8 unk5; u16 unk6; u8 eventID; u8 unk7; }; #define PATH_FLAG_LOOP 2 struct Block13 { u8 pathID; u8 unknown; u16 startNode; u16 nodeCount; u16 flags; }; struct Block14 { u16 xPos; u16 yPos; float speed; float accel; short unk1; short unk2; }; #endif
e641ff8d9647b7719c38fe4de274d68ef6b625b5
7388ccfcf5e586cc62a2e837f92a0c744002b153
/BERT/RegistryConstants.h
96f5dd9464585fe4b7d124302298299b453975de
[]
no_license
hungryducks/Basic-Excel-R-Toolkit
a9607a1c0837ae8432516b75b1676e3135e732fd
96d73d491ae6a52227c59c0373f29089e52b93b8
refs/heads/master
2021-01-18T12:46:02.013494
2016-05-19T16:10:40
2016-05-19T16:10:40
60,756,529
1
0
null
2016-06-09T07:17:09
2016-06-09T07:17:09
null
UTF-8
C
false
false
2,298
h
RegistryConstants.h
/* * Basic Excel R Toolkit (BERT) * Copyright (C) 2014-2016 Structured Data, LLC * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef __REGISTRY_CONSTANTS_H #define __REGISTRY_CONSTANTS_H #define REGISTRY_KEY "Software\\BERT" #define REGISTRY_VALUE_ENVIRONMENT "Environment" #define REGISTRY_VALUE_R_USER "R_USER" #define REGISTRY_VALUE_R_HOME "R_HOME" #define REGISTRY_VALUE_STARTUP "StartupFile" #define REGISTRY_VALUE_HIDE_MENU "HideMenu" #define REGISTRY_VALUE_INSTALL_DIR "InstallDir" #define REGISTRY_VALUE_PRESERVE_ENV "PreserveEnvironment" #define REGISTRY_VALUE_CONSOLE_FONT "ConsoleFont" #define REGISTRY_VALUE_CONSOLE_SIZE "ConsoleFontSize" #define REGISTRY_VALUE_CONSOLE_USER "ConsoleUserTextColor" #define REGISTRY_VALUE_CONSOLE_MESSAGE "ConsoleMessageTextColor" #define REGISTRY_VALUE_CONSOLE_BACK "ConsoleBackgroundColor" #define REGISTRY_VALUE_CONSOLE_SAVE_HISTORY "ConsoleSaveHistory" #define REGISTRY_VALUE_CONSOLE_WIDTH "ConsoleWidth" #define REGISTRY_VALUE_CONSOLE_AUTO_WIDTH "ConsoleAutoWidth" #define REGISTRY_VALUE_CONSOLE_ON_TOP "ConsoleOnTop" #define DEFAULT_ENVIRONMENT "" #define DEFAULT_R_USER "%APPDATA%\\BERT" #define DEFAULT_R_HOME "%APPDATA%\\BERT\\R-3.2.1" #define DEFAULT_R_STARTUP "Functions.R" #define DEFAULT_R_PRESERVE_ENV 0 #define DEFAULT_CONSOLE_WIDTH 80 #define DEFAULT_CONSOLE_AUTO_WIDTH 1 // registry cache for update check -- use if-modified-since header #define REGISTRY_VALUE_UPDATE_LAST_MODIFIED "UpdateLastModified" #define REGISTRY_VALUE_UPDATE_LAST_TAG "UpdateLastTag" #endif // #ifndef __REGISTRY_CONSTANTS_H