blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
333
content_id
stringlengths
40
40
detected_licenses
listlengths
0
58
license_type
stringclasses
2 values
repo_name
stringlengths
5
113
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
604 values
visit_date
timestamp[us]date
2016-08-02 21:20:34
2023-09-06 10:17:08
revision_date
timestamp[us]date
1970-01-01 00:00:00
2023-09-05 20:12:54
committer_date
timestamp[us]date
1970-01-01 00:00:00
2023-09-05 20:12:54
github_id
int64
966
664M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[us]date
2012-06-18 16:43:44
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-02-03 21:17:16
2023-07-07 15:57:14
gha_language
stringclasses
121 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
128
17.8k
extension
stringclasses
134 values
content
stringlengths
128
8.19k
authors
listlengths
1
1
author_id
stringlengths
1
143
b19ca988c287fe85b27946212a39384fa43dae36
12a42054b156383ebbe3ccc5de4150633c66da5d
/problems/house-robber-iii/solution.c
5e1a9202579a2a9ac11885590dec90e6025bc1a3
[]
no_license
cfoust/leetcode-problems
93c33029f74f32c64caf8294292226d199d6e272
f5ad7866906d0a2cf2250e5972ce910bf35ce526
refs/heads/master
2020-03-16T23:05:45.123781
2018-05-11T16:41:09
2018-05-11T16:41:09
133,064,772
1
1
null
null
null
null
UTF-8
C
false
false
199
c
/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ int rob(struct TreeNode* root) { }
0fd739ba319eb6c3ed211a25bf6b6c5975228183
317b2a4277ba3c8ef26eea8b49b7bfc98fde5a49
/uspace/config.c
0901672a8050a922d34e75fd99a6c71a4619aa25
[ "BSD-3-Clause" ]
permissive
antonycourtney/anp
2f1268cd570d59b857783b91040adb78ada5d315
ffacfca0942d3b3a37eae29ac5e0fefca1a56631
refs/heads/master
2021-01-20T23:26:50.373449
2015-07-17T05:33:47
2015-07-17T05:33:47
39,236,615
3
2
null
null
null
null
UTF-8
C
false
false
3,771
c
/* * config.c -- takes the place of "ifconfig" usually run at boot time * * Antony Courtney, 4/19/96 * * (must be compiled w/ BSD headers) */ #include <sys/types.h> #include <sys/socket.h> #include <sys/sockio.h> #include <sys/errno.h> #include <net/if.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdlib.h> #include <string.h> #define size_t __frob #include "host/stdio.h" #include "anp_wrappers.h" #include "anp_test.h" /* sl_ifconfig() -- configure SLIP interface */ void sl_ifconfig(char *local_addr,char *remote_addr) { const char *netmask="255.255.255.0"; struct ifreq ifr; struct sockaddr_in sin; int s; if ((s=socket(AF_INET,SOCK_DGRAM,0)) < 0) { err_sys("ifconfig socket"); } memset(&ifr,0,sizeof(ifr)); strncpy(ifr.ifr_name,"sl0",sizeof(ifr.ifr_name)); /* let's try deleting an interface address and then adding one: */ if (ioctl(s,SIOCDIFADDR,&ifr) < 0) { if (anp_errno==EADDRNOTAVAIL) { /* means there was no previous address for this interface */ } else { err_sys("ioctl (SIOCDIFADDR)"); } } /* set local IP address: */ memset(&sin,0,sizeof(sin)); sin.sin_family=AF_INET; sin.sin_len=sizeof(sin); sin.sin_addr.s_addr=inet_addr(local_addr); memcpy(&ifr.ifr_addr,&sin,sizeof(sin)); if (ioctl(s,SIOCAIFADDR,&ifr) < 0) { err_sys("ioctl (SIOCAIFADDR)"); } /* now let's try and set the destination IP address and netmask */ memset(&sin,0,sizeof(sin)); sin.sin_family=AF_INET; sin.sin_len=sizeof(sin); sin.sin_addr.s_addr=inet_addr(remote_addr); memcpy(&ifr.ifr_addr,&sin,sizeof(sin)); if (ioctl(s,SIOCSIFDSTADDR,&ifr) < 0) { err_sys("ioctl (SIOCSIFDSTADDR"); } memset(&sin,0,sizeof(sin)); sin.sin_family=AF_INET; sin.sin_len=sizeof(sin); sin.sin_addr.s_addr=inet_addr(netmask); memcpy(&ifr.ifr_addr,&sin,sizeof(sin)); if (ioctl(s,SIOCSIFNETMASK,&ifr) < 0) { err_sys("ioctl (SIOCSIFNETMASK"); } /* now we do a SIOCSIFADDR ioctl, just to force an update to routing * table entry */ memset(&sin,0,sizeof(sin)); sin.sin_family=AF_INET; sin.sin_len=sizeof(sin); sin.sin_addr.s_addr=inet_addr(local_addr); memcpy(&ifr.ifr_addr,&sin,sizeof(sin)); if (ioctl(s,SIOCSIFADDR,&ifr) < 0) { err_sys("ioctl (SIOCSIFADDR)"); } close(s); printf("ifconfig sl0: local: %s, remote: %s, netmask: %s\n", local_addr,remote_addr,netmask); } void do_ifconfig(void) { struct ifreq ifr; struct sockaddr_in sin; int s; if ((s=socket(AF_INET,SOCK_DGRAM,0)) < 0) { err_sys("ifconfig socket"); } memset(&sin,0,sizeof(sin)); sin.sin_family=AF_INET; sin.sin_len=sizeof(sin); sin.sin_addr.s_addr=inet_addr(LO_IP_ADDR); memset(&ifr,0,sizeof(ifr)); strncpy(ifr.ifr_name,"lo0",sizeof(ifr.ifr_name)); /* let's try deleting an interface address and then adding one: */ if (ioctl(s,SIOCDIFADDR,&ifr) < 0) { if (anp_errno==EADDRNOTAVAIL) { /* means there was no previous address for this interface */ } else { err_sys("ioctl (SIOCDIFADDR)"); } } memcpy(&ifr.ifr_addr,&sin,sizeof(sin)); if (ioctl(s,SIOCAIFADDR,&ifr) < 0) { err_sys("ioctl (SIOCAIFADDR)"); } close(s); printf("ifconfig lo0: IP address: %s\n", LO_IP_ADDR); /* now configure sl0 interface, if appropriate */ if (cliflag) { sl_ifconfig(CLI_IP_ADDR,SERV_IP_ADDR); } if (servflag) { sl_ifconfig(SERV_IP_ADDR,CLI_IP_ADDR); } }
8e26fe8e58eae68ef0431a27c653e88325873fd2
8aef3cf7217c41676db60e66d5067e7b16930880
/tags/libpkg-0.1.20051109/src/pkg_util.c
6b9fca09b85b9f2498dfd453af1a30313c91cd95
[]
no_license
BackupTheBerlios/libpkg-svn
7fb273450443e768e7fc47e086239f423a9af4f4
6d69abe88a8d1b02367d6d885a635ba06a9563a4
refs/heads/master
2021-01-01T19:34:55.976927
2009-01-05T07:38:08
2009-01-05T07:38:08
40,772,935
0
0
null
null
null
null
UTF-8
C
false
false
3,586
c
/*- * Copyright (c) 1983, 1992, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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 <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include <sys/stat.h> #include <err.h> #include <errno.h> #include <md5.h> #include <stdlib.h> #include <string.h> #include "pkg.h" #include "pkg_private.h" /* * This is a simplified version of `mkdir -p path' * Is has been simplified to just take in a path to create */ /* Based off src/bin/mkdir/mkdir.c 1.32 */ int pkg_dir_build(const char *path) { struct stat sb; int last, retval; char *str, *p; str = strdup(path); if (!str) { pkg_error_set(&pkg_null, "Out of Memory"); return PKG_FAIL; } p = str; retval = PKG_OK; if (p[0] == '/') /* Skip leading '/'. */ ++p; for (last = 0; !last ; ++p) { if (p[0] == '\0') last = 1; else if (p[0] != '/') continue; *p = '\0'; if (!last && p[1] == '\0') last = 1; if (mkdir(str, S_IRWXU | S_IRWXG | S_IRWXO) < 0) { if (errno == EEXIST || errno == EISDIR) { if (stat(str, &sb) < 0) { retval = PKG_FAIL; pkg_error_set(&pkg_null, "Could not stat %s", str); break; } else if (!S_ISDIR(sb.st_mode)) { if (last) errno = EEXIST; else errno = ENOTDIR; retval = PKG_FAIL; pkg_error_set(&pkg_null, "%s is not a directory", str); break; } } else { retval = PKG_FAIL; pkg_error_set(&pkg_null, "Could not create %s", str); break; } } if (!last) *p = '/'; } free(str); return (retval); } /* Checks a file against a given md5 checksum */ int pkg_checksum_md5(struct pkg_file *file, char *chk_sum) { char sum[33]; if (!file) { pkg_error_set(&pkg_null, "No file specified"); return PKG_FAIL; } if (!sum) { pkg_error_set((struct pkg_object *)file, "No checksum specified"); return PKG_FAIL; } /* Perform a checksum on the file to install */ MD5Data(file->contents, file->len, sum); if (strcmp(sum, chk_sum)) { pkg_error_set((struct pkg_object *)file, "File checksum incorrect"); return PKG_FAIL; } return PKG_OK; }
[ "zxombie@94f56f15-1805-0410-9063-998f45cfa32b" ]
zxombie@94f56f15-1805-0410-9063-998f45cfa32b
fcb91e85f7e2d89245cac2b4eb8fe2752542ea33
cc48100291ae8d4c142ee205e985bf3714945612
/include/crc.h
db6ae5d4a04cf9286470f173a5ded9636f16baa2
[]
no_license
cortoproject/crc
af7c910ee9e839341c716d8d6a9c874d739b4945
677327da9b3408ac0aca90759e1b45547fc6577f
refs/heads/master
2021-01-11T20:52:14.373820
2018-01-30T08:38:51
2018-01-30T08:38:51
79,201,531
1
0
null
null
null
null
UTF-8
C
false
false
1,819
h
/********************************************************************** * * Filename: crc.h * * Description: A header file describing the various CRC standards. * * Notes: * * * Copyright (c) 2000 by Michael Barr. This software is placed into * the public domain and may be used for any purpose. However, this * notice must not be changed or removed and no warranty is either * expressed or implied by its publication or distribution. **********************************************************************/ /* * Note that changes have been made to original filenames to prevent * name clashes. */ #ifndef _CRC_h #define _CRC_h /* * Select the CRC standard from the list that follows. */ #define CRC16 #if defined(CRC_CCITT) typedef unsigned short corto_crc; #define CRC_NAME "CRC-CCITT" #define POLYNOMIAL 0x1021 #define INITIAL_REMAINDER 0xFFFF #define FINAL_XOR_VALUE 0x0000 #define REFLECT_DATA FALSE #define REFLECT_REMAINDER FALSE #define CHECK_VALUE 0x29B1 #elif defined(CRC16) typedef unsigned short corto_crc; #define CRC_NAME "CRC-16" #define POLYNOMIAL 0x8005 #define INITIAL_REMAINDER 0x0000 #define FINAL_XOR_VALUE 0x0000 #define REFLECT_DATA TRUE #define REFLECT_REMAINDER TRUE #define CHECK_VALUE 0xBB3D #elif defined(CRC32) typedef unsigned long corto_crc; #define CRC_NAME "CRC-32" #define POLYNOMIAL 0x04C11DB7 #define INITIAL_REMAINDER 0xFFFFFFFF #define FINAL_XOR_VALUE 0xFFFFFFFF #define REFLECT_DATA TRUE #define REFLECT_REMAINDER TRUE #define CHECK_VALUE 0xCBF43926 #else #error "One of CRC_CCITT, CRC16, or CRC32 must be #define'd." #endif void corto_crcInit(void); corto_crc corto_crcSlow(unsigned char const message[], int nBytes); corto_crc corto_crcast(unsigned char const message[], int nBytes); #endif /* _crc_h */
a66bf367656b3097e64077ab27f1c83b3d582cda
f9da3129b655882fd98f05a33d3c8fe8747980fc
/src/gtk/include/win32/glib-2.0/gio/gpollableoutputstream.h
05ef2db07e899ebc6ed1d4e317da7901b32e8e1b
[ "MIT" ]
permissive
neohung/smallgame
ff1913682d2e818da9f42f12ebb716944d287a74
e15654da10310032e1db009ad66bee17ce86f8d1
refs/heads/master
2020-04-19T04:54:26.259553
2015-04-20T11:48:47
2015-04-20T11:48:47
29,723,475
0
0
null
null
null
null
UTF-8
C
false
false
3,962
h
/* GIO - GLib Input, Output and Streaming Library * * Copyright (C) 2010 Red Hat, Inc. * * 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 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. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. */ #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) #error "Only <gio/gio.h> can be included directly." #endif #ifndef __G_POLLABLE_OUTPUT_STREAM_H__ #define __G_POLLABLE_OUTPUT_STREAM_H__ #include <gio/gio.h> G_BEGIN_DECLS #define G_TYPE_POLLABLE_OUTPUT_STREAM (g_pollable_output_stream_get_type ()) #define G_POLLABLE_OUTPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_POLLABLE_OUTPUT_STREAM, GPollableOutputStream)) #define G_IS_POLLABLE_OUTPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_POLLABLE_OUTPUT_STREAM)) #define G_POLLABLE_OUTPUT_STREAM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_POLLABLE_OUTPUT_STREAM, GPollableOutputStreamInterface)) /** * GPollableOutputStream: * * An interface for a #GOutputStream that can be polled for readability. * * Since: 2.28 */ typedef struct _GPollableOutputStreamInterface GPollableOutputStreamInterface; /** * GPollableOutputStreamInterface: * @g_iface: The parent interface. * @can_poll: Checks if the #GPollableOutputStream instance is actually pollable * @is_writable: Checks if the stream is writable * @create_source: Creates a #GSource to poll the stream * @write_nonblocking: Does a non-blocking write or returns * %G_IO_ERROR_WOULD_BLOCK * * The interface for pollable output streams. * * The default implementation of @can_poll always returns %TRUE. * * The default implementation of @write_nonblocking calls * g_pollable_output_stream_is_writable(), and then calls * g_output_stream_write() if it returns %TRUE. This means you only * need to override it if it is possible that your @is_writable * implementation may return %TRUE when the stream is not actually * writable. * * Since: 2.28 */ struct _GPollableOutputStreamInterface { GTypeInterface g_iface; /* Virtual Table */ gboolean (*can_poll) (GPollableOutputStream *stream); gboolean (*is_writable) (GPollableOutputStream *stream); GSource * (*create_source) (GPollableOutputStream *stream, GCancellable *cancellable); gssize (*write_nonblocking) (GPollableOutputStream *stream, const void *buffer, gsize count, GError **error); }; GType g_pollable_output_stream_get_type (void) G_GNUC_CONST; gboolean g_pollable_output_stream_can_poll (GPollableOutputStream *stream); gboolean g_pollable_output_stream_is_writable (GPollableOutputStream *stream); GSource *g_pollable_output_stream_create_source (GPollableOutputStream *stream, GCancellable *cancellable); gssize g_pollable_output_stream_write_nonblocking (GPollableOutputStream *stream, const void *buffer, gsize count, GCancellable *cancellable, GError **error); G_END_DECLS #endif /* __G_POLLABLE_OUTPUT_STREAM_H__ */
711d0c337ef04c2e301a690205053ad975c274d7
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/net/iucv/extr_iucv.c___iucv_message_receive.c
02b2cdd36a05fadf03f9636bdd8ef50e4790d220
[]
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
2,249
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 */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {size_t ipbfln1f; int ipflags1; int /*<<< orphan*/ iptrgcls; int /*<<< orphan*/ ippathid; int /*<<< orphan*/ ipmsgid; void* ipbfadr1; } ; union iucv_param {TYPE_1__ db; } ; typedef int u8 ; typedef void* u32 ; struct iucv_path {int /*<<< orphan*/ pathid; } ; struct iucv_message {int flags; int /*<<< orphan*/ class; int /*<<< orphan*/ id; } ; typedef scalar_t__ addr_t ; /* Variables and functions */ int EIO ; int IUCV_IPFGMID ; int IUCV_IPFGPID ; int IUCV_IPRMDATA ; int IUCV_IPTRGCLS ; int /*<<< orphan*/ IUCV_RECEIVE ; scalar_t__ cpumask_empty (int /*<<< orphan*/ *) ; int /*<<< orphan*/ iucv_buffer_cpumask ; int iucv_call_b2f0 (int /*<<< orphan*/ ,union iucv_param*) ; int iucv_message_receive_iprmdata (struct iucv_path*,struct iucv_message*,int,void*,size_t,size_t*) ; union iucv_param** iucv_param ; int /*<<< orphan*/ memset (union iucv_param*,int /*<<< orphan*/ ,int) ; size_t smp_processor_id () ; int __iucv_message_receive(struct iucv_path *path, struct iucv_message *msg, u8 flags, void *buffer, size_t size, size_t *residual) { union iucv_param *parm; int rc; if (msg->flags & IUCV_IPRMDATA) return iucv_message_receive_iprmdata(path, msg, flags, buffer, size, residual); if (cpumask_empty(&iucv_buffer_cpumask)) { rc = -EIO; goto out; } parm = iucv_param[smp_processor_id()]; memset(parm, 0, sizeof(union iucv_param)); parm->db.ipbfadr1 = (u32)(addr_t) buffer; parm->db.ipbfln1f = (u32) size; parm->db.ipmsgid = msg->id; parm->db.ippathid = path->pathid; parm->db.iptrgcls = msg->class; parm->db.ipflags1 = (flags | IUCV_IPFGPID | IUCV_IPFGMID | IUCV_IPTRGCLS); rc = iucv_call_b2f0(IUCV_RECEIVE, parm); if (!rc || rc == 5) { msg->flags = parm->db.ipflags1; if (residual) *residual = parm->db.ipbfln1f; } out: return rc; }
8ec07ecfeecd80a59f5764c9fa5d4d392ae21063
890eb8e28dab8463138d6ae80359c80c4cf03ddd
/VARIANT/HIUVar/COMMON/HID/PPP/Code/Source/uip_ppplink.c
de1b36b982e38d3dbb16bf9facc846f3eb3b5591
[]
no_license
grant-h/shannon_S5123
d8c8dd1a2b49a9fe08268487b0af70ec3a19a5b2
8f7acbfdcf198779ed2734635990b36974657b7b
refs/heads/master
2022-06-17T05:43:03.224087
2020-05-06T15:39:39
2020-05-06T15:39:39
261,804,799
7
1
null
null
null
null
UTF-8
C
false
false
1,137
c
Line 96: link_cleanup() Line 111: link_down : GPRS stack Line 119: Read from UART %d, Asked %d Line 140: GLINK->itsFlags 0x%02X GLINK->itsReadStart 0x%08X GLINK->itsReadEnd 0x%08X Length %d Line 155: link_write(): Nothing to write Line 172: link_write(): pal_MemAlloc failed; %d requested Line 189: hostifSendDataPacket(), %d bytes written Line 197: pal_MemFree(0x%X) failure Line 200: link_write(): pal_DrvSocketRequest failed; %d requested Line 214: link_write(): %d = pal_serial_xfer_block_ex ( %08X, %08X, %d, %d) Failed Line 221: link_write(): %d = pal_serial_xfer_block_ex ( %08X, %08X, %d, %d) OK Line 237: link_write(): pal_serial_putbuff_ex wrote %d bytes; %d requested Line 242: pal_serial_putbuff_ex(), %d bytes written, %d bytes available Line 252: link_write(): LINK_MODE_PPP Line 256: link_write(): Unknown Link Mode %d Line 267: ppp_notify_link_read_available Line 273: ppp_notify_link_write_available Line 286: os_link_up(): Forced Link mode set to LINK_MODE_CHARACTER Line 288: os_link_up(): Using LINK_MODE_CHARACTER Line 404: os_log_warn (Module: %c, Code: %d) Line 409: os_log_state: Module: %c, Old %02X, New %02X)
c975546b926d2a24e15ddcabe981d5bf753ce2ea
3db023edb0af1dcf8a1da83434d219c3a96362ba
/windows_nt_3_5_source_code/NT-782/PRIVATE/NET/SFM/SETUP/UTIL/TEST/UAMCP/UAMCP.C
96fe3fdbc290dce006315acc6853ecc1746ec625
[]
no_license
xiaoqgao/windows_nt_3_5_source_code
de30e9b95856bc09469d4008d76191f94379c884
d2894c9125ff1c14028435ed1b21164f6b2b871a
refs/heads/master
2022-12-23T17:58:33.768209
2020-09-28T20:20:18
2020-09-28T20:20:18
null
0
0
null
null
null
null
UTF-8
C
false
false
565
c
#define DOSWIN32 #include <windows.h> #include <stdio.h> #include <stdlib.h> #include <lmerr.h> extern BOOL FAR PASCAL CopyUamFiles ( DWORD nArgs, LPSTR apszArgs[], LPSTR *ppszResult ); extern int CDECL main(int argc, char *argv[]); int CDECL main (int argc, char *argv[]) { TCHAR ResultBuffer[1024]; // go past the file name argument argc--; ++argv; if(CopyUamFiles(argc, argv , &ResultBuffer)) printf("Copy %s\n", ResultBuffer); else printf("CopyUAM Files %s\n", ResultBuffer); return(0); }
6d8ebc8f9f0d06a8ef39633d832bf7b809c38a71
fe2383535a052724124d9b164005705837c13d09
/2019/程序讲解/第8章/c8-8-2.c
44dd3783450af295eaeaa1d59cc162c2041f7dca
[]
no_license
jtrfid/C-Program
cff5783bccb80bb2cf7d2eb60a235e4caf737cc7
d52520ecaf12bbcf1cb56b42ab4e6cddb02d5c71
refs/heads/master
2023-04-18T13:23:03.214405
2023-03-23T09:11:35
2023-03-23T09:11:35
207,085,158
0
0
null
null
null
null
GB18030
C
false
false
508
c
#include <stdio.h> int main() {void inv(int *x,int n); int i,a[10]={3,7,9,11,0,6,7,5,4,2}; printf("The original array:\n"); for(i=0;i<10;i++) printf("%d ",a[i]); printf("\n"); inv(a,10); printf("The array has been inverted:\n"); for(i=0;i<10;i++) printf("%d ",a[i]); printf("\n"); return 0; } void inv(int *x,int n) //形参x是指针变量 {int temp,*i,*j; i=x;j=x+n-1; for(;i<=j;i++,j--) {temp=*i;*i=*j;*j=temp;} //*i与*j交换 return; }
83e9f490588661b8a991296bac29bc6ce3ad3946
7145debc74a5fcbff42b8dc18a90ade19e9f7b5b
/node/vuo.scene/vuo.scene.render.image2.c
4a1df8aa8c443bd26e9c52996a7331a6756706ac
[]
no_license
tarakhanall/vuo
fe613d4729ec3a11e1a555c7e38344074b55b96e
d2eca0e2a31d4db4c261a9f0d5addfa42cc14dbe
refs/heads/main
2023-02-10T18:34:22.622508
2020-12-31T15:17:51
2020-12-31T15:17:51
null
0
0
null
null
null
null
UTF-8
C
false
false
2,298
c
/** * @file * vuo.scene.render.image node implementation. * * @copyright Copyright © 2012–2020 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see https://vuo.org/license. */ #include "node.h" #include "VuoSceneRenderer.h" #include "VuoMultisample.h" #include <stdio.h> #include <string.h> #include <math.h> VuoModuleMetadata({ "title" : "Render Scene to Image", "keywords" : [ "draw", "graphics", "3D", "object", "opengl", "scenegraph", "convert", ], "version" : "2.0.0", "dependencies" : [ "VuoSceneRenderer" ], "node": { "exampleCompositions" : [ "RippleImageOfSphere.vuo" ] } }); struct nodeInstanceData { VuoSceneRenderer *sceneRenderer; }; struct nodeInstanceData *nodeInstanceInit(void) { struct nodeInstanceData *context = (struct nodeInstanceData *)malloc(sizeof(struct nodeInstanceData)); context->sceneRenderer = VuoSceneRenderer_make(1); VuoRetain(context->sceneRenderer); VuoRegister(context, free); return context; } void nodeInstanceEvent ( VuoInstanceData(struct nodeInstanceData *) context, VuoInputData(VuoList_VuoSceneObject) objects, VuoInputData(VuoInteger, {"default":1024, "suggestedMin":1, "suggestedMax":4096, "suggestedStep":256}) width, VuoInputData(VuoInteger, {"default":768, "suggestedMin":1, "suggestedMax":4096, "suggestedStep":256}) height, VuoInputData(VuoImageColorDepth, {"default":"8bpc"}) colorDepth, VuoInputData(VuoMultisample, {"default":"4"}) multisampling, VuoInputData(VuoText) cameraName, VuoOutputData(VuoImage) image, VuoOutputData(VuoImage) depthImage ) { VuoSceneObject rootSceneObject = VuoSceneObject_makeGroup(objects, VuoTransform_makeIdentity()); VuoSceneRenderer_setRootSceneObject((*context)->sceneRenderer, rootSceneObject); VuoSceneRenderer_setCameraName((*context)->sceneRenderer, cameraName, true); VuoSceneRenderer_regenerateProjectionMatrix((*context)->sceneRenderer, width, height); VuoSceneRenderer_renderToImage((*context)->sceneRenderer, image, colorDepth, multisampling, depthImage, true); } void nodeInstanceFini ( VuoInstanceData(struct nodeInstanceData *) context ) { VuoRelease((*context)->sceneRenderer); }
0666d3b6fdc69c1c0c6f476ab6872f723ecb3a5a
3a7322640a619ffe793e88de4807c58f2a645fb6
/ds/ordered_binary_tree/ordered_binary_tree_test_Evgeny.c
1d8f3cfc740ae5b92fb8a483319c1ca708ae6fc0
[]
no_license
MiritHadar/Practice
d0e60fce8c9346212fd3e1071cb7395e63bec69a
471e75393e02d61601a235fe65f0121ae1121b5c
refs/heads/master
2020-09-08T01:30:03.102784
2020-04-30T14:03:51
2020-04-30T14:03:51
220,971,061
0
0
null
null
null
null
UTF-8
C
false
false
4,070
c
#include <stdio.h> /* puts */ #include "ordered_binary_tree.h" /* header file */ #define UNUSED(X) (void)X int is_smaller(const void *before, const void *after, void *param); void PrintBinaryTree(const bt_t *tree); void TestBTEasy(); void TestBTMiddle(); void TestBTHard(); int Plus17(void *data, void *param); int main() { TestBTEasy(); TestBTMiddle(); TestBTHard(); return 0; } int is_smaller(const void *before, const void *after, void *param) { UNUSED(param); return *(int *)before < *(int *)after; } void PrintBinaryTree(const bt_t *tree) { bt_itr_t itr_begin = BTBegin(tree); bt_itr_t itr_end = BTEnd(tree); bt_itr_t itr = {NULL}; for (itr = itr_begin; !BTIsSame(itr, itr_end); itr = BTNext(itr)) { printf("%d ", *(int *)BTGetData(itr)); } printf("\n"); for (itr = BTPrev(itr_end); !BTIsSame(itr, itr_begin); itr = BTPrev(itr)) { printf("%d ", *(int *)BTGetData(itr)); } printf("%d ", *(int *)BTGetData(itr)); printf("\n"); } void TestBTEasy() { bt_t *tree = BTCreate(is_smaller, NULL); bt_itr_t itr_begin = {NULL}; bt_itr_t itr_end = {NULL}; bt_itr_t itr = {NULL}; bt_itr_t itr_temp = {NULL}; size_t a = 5, b = 3, c = 7, d = 8, e = 1, f = 2, g = 4, i = 9, k = 6, j = 0; size_t index = 0; if(0 == BTIsEmpty(tree)) { puts("Error in BTIsEmpty"); } if(0 != BTCount(tree)) { puts("Error in BTCount"); } BTInsert(tree, &a); if(1 == BTIsEmpty(tree)) { puts("Error in BTIsEmpty"); } if(1 != BTCount(tree)) { puts("Error in BTCount"); } BTInsert(tree, &b); BTInsert(tree, &c); BTInsert(tree, &d); BTInsert(tree, &e); BTInsert(tree, &f); BTInsert(tree, &g); BTInsert(tree, &i); BTInsert(tree, &k); BTInsert(tree, &j); itr_begin = BTBegin(tree); itr_end = BTEnd(tree); if(10 != BTCount(tree)) { puts("Error in BTCount"); } for (index = 0, itr = itr_begin; index < 10 && !BTIsSame(itr, itr_end); ++index, itr = BTNext(itr)) { if (index != *(size_t *)BTGetData(itr)) { puts("Error in BTInsert"); } } for (index = 0, itr = BTPrev(itr_end); index < 10 && !BTIsSame(itr, itr_begin); ++index, itr = BTPrev(itr)) { if (9 - index != *(size_t *)BTGetData(itr)) { puts("Error in BTInsert"); } } /* remove all odd numbers */ for (itr = itr_begin; !BTIsSame(itr, itr_end); itr = BTNext(itr)) { itr_temp = BTNext(itr); BTRemove(itr); itr = itr_temp; } itr_begin = BTBegin(tree); itr_end = BTEnd(tree); for (index = 0, itr = itr_begin; index < 10 && !BTIsSame(itr, itr_end); ++index, itr = BTNext(itr)) { if (2 * index + 1 != *(size_t *)BTGetData(itr)) { puts("Error in BTRemove"); } } BTDestroy(tree); } void TestBTMiddle() { bt_t *tree = BTCreate(is_smaller, NULL); bt_itr_t itr_begin = {NULL}; bt_itr_t itr_end = {NULL}; bt_itr_t itr = {NULL}; size_t a = 5, b = 3, c = 7, d = 8, e = 1, f = 2, g = 4, i = 9, k = 6, j = 0; size_t index = 0; size_t x = 5; size_t y = 9; size_t z = 11; BTInsert(tree, &a); BTInsert(tree, &b); BTInsert(tree, &c); BTInsert(tree, &d); BTInsert(tree, &e); BTInsert(tree, &f); BTInsert(tree, &g); BTInsert(tree, &i); BTInsert(tree, &k); BTInsert(tree, &j); itr_begin = BTBegin(tree); itr_end = BTEnd(tree); if(5 != *(size_t *)BTGetData(BTFind(tree, &x))) { puts("Error in BTFind"); } if(9 != *(size_t *)BTGetData(BTFind(tree, &y))) { puts("Error in BTFind"); } if(!BTIsSame(itr_end, BTFind(tree, &z))) { puts("Error in BTFind"); } BTForEach(Plus17, NULL, itr_begin, itr_end); for (index = 0, itr = itr_begin; index < 10 && !BTIsSame(itr, itr_end); ++index, itr = BTNext(itr)) { if (index + 17 != *(size_t *)BTGetData(itr)) { puts("Error in BTForEach"); } } BTDestroy(tree); } int Plus17(void *data, void *param) { UNUSED(param); (*(size_t *)data) += 17; return 0; } void TestBTHard() { bt_t *tree = BTCreate(is_smaller, NULL); bt_itr_t itr = {NULL}; size_t a = 5; BTInsert(tree, &a); itr = BTBegin(tree); BTRemove(itr); if(1 != BTIsEmpty(tree)) { puts("Error in Hard Test"); } BTDestroy(tree); }
188cd983913cebe6c3e17ed991bf845132f7aaed
20965ad00f94bab92a9d18c6e0990eb2a9a83e75
/src/lib/common/inc/c_tricks.h
7e59908dc22c197f983a1aac8d8e83d4a567c8f8
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
plume-design/opensync
22fe8d0779df5e35057a8dd5fb779e6b088eee58
907da96a2a5cc78d308f095323ebc992d524630e
refs/heads/master
2023-08-16T11:40:56.389400
2023-07-21T03:41:00
2023-07-21T03:41:00
113,587,683
80
91
BSD-3-Clause
2023-08-18T15:20:42
2017-12-08T15:20:41
C
UTF-8
C
false
false
3,335
h
/* Copyright (c) 2015, Plume Design 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: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the Plume Design Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Plume Design Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef C_TRICKS_H_INCLUDED #define C_TRICKS_H_INCLUDED /* * =========================================================================== * Macros for counting __VA_ARGS__ arguments and returning the last argument * of a list * * VA_LAST(a, b, c, d, e, f) expands to f * VA_COUNT(a, b, c, d, e, f) expands to 6 * * At most 16 arguments are supported. If you wish to increase this number * you must extend the list in the VA_COUNT and __VA_COUNT macros and implement * the corresponding VA_IDX_NN functions. * * =========================================================================== */ #define __VA_COUNT(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, N, ...) N #define VA_COUNT(...) __VA_COUNT(dummy, ##__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) #define CONCAT(a, b) a ## b #define VA_IDX(N, ...) CONCAT(VA_IDX_, N)(__VA_ARGS__) #define VA_IDX_0(x) #define VA_IDX_1(_1, ...) _1 #define VA_IDX_2(_1, ...) VA_IDX_1(__VA_ARGS__) #define VA_IDX_3(_1, ...) VA_IDX_2(__VA_ARGS__) #define VA_IDX_4(_1, ...) VA_IDX_3(__VA_ARGS__) #define VA_IDX_5(_1, ...) VA_IDX_4(__VA_ARGS__) #define VA_IDX_6(_1, ...) VA_IDX_5(__VA_ARGS__) #define VA_IDX_7(_1, ...) VA_IDX_6(__VA_ARGS__) #define VA_IDX_8(_1, ...) VA_IDX_7(__VA_ARGS__) #define VA_IDX_9(_1, ...) VA_IDX_8(__VA_ARGS__) #define VA_IDX_10(_1, ...) VA_IDX_9(__VA_ARGS__) #define VA_IDX_11(_1, ...) VA_IDX_10(__VA_ARGS__) #define VA_IDX_12(_1, ...) VA_IDX_11(__VA_ARGS__) #define VA_IDX_13(_1, ...) VA_IDX_12(__VA_ARGS__) #define VA_IDX_14(_1, ...) VA_IDX_13(__VA_ARGS__) #define VA_IDX_15(_1, ...) VA_IDX_14(__VA_ARGS__) #define VA_IDX_16(_1, ...) VA_IDX_15(__VA_ARGS__) #define VA_LAST(...) VA_IDX(VA_COUNT(__VA_ARGS__), __VA_ARGS__) #endif /* C_TRICKS_H_INCLUDED */
06437997f3a410173fc23f1513f380e9f792d29b
4bb8dc6471d9322fb58f9511ae5e507a2483a3d0
/srcs/builtin_cd.c
ed240d41fb1d0dc303fe56d4c29479051d2a4bed
[]
no_license
Gamouche/minishell
bec527e9084a251db857f55c51c5899da504fb7d
d56d177be7efccd237d412456cdce04aa91ae731
refs/heads/master
2021-04-12T11:45:29.394417
2018-04-10T12:47:22
2018-04-10T12:47:22
126,493,400
0
0
null
null
null
null
UTF-8
C
false
false
2,799
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* builtin_cd.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: cyfermie <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/04/04 18:17:20 by cyfermie #+# #+# */ /* Updated: 2018/04/04 18:17:42 by cyfermie ### ########.fr */ /* */ /* ************************************************************************** */ #include <sys/stat.h> #include <unistd.h> #include <stdbool.h> #include "../includes/minishell.h" static bool home_is_valid(char **env) { size_t i; i = 0; while (env[i] != NULL) { if (ft_strncmp(env[i], "HOME", 4) == 0) { if (ft_strlen(env[i] + 6) > 0) return (true); return (false); } ++i; } return (false); } int go_to_dir(const char *path, char **env) { int ret_value; int ret_chdir; size_t i; struct stat s_stat; if ((!(ret_value = BUILTIN_SUCCESS)) && path != NULL) ret_chdir = chdir(path); else { i = 0; while (ft_strncmp(env[i], "HOME", 4) != 0) ++i; ret_chdir = chdir(env[i] + 5); } if (ret_chdir != 0) { if ((stat(path, &s_stat) == 0) && (!(S_ISDIR(s_stat.st_mode))) && ft_write_n_strings_fd(STDERR_FILENO, 3, "cd: not a directory: ", path, "\n")) return (BUILTIN_ERROR); ft_write_n_strings_fd(STDERR_FILENO, 3, "cd: No such file or directory or permission denied: ", path, "\n"); ret_value = BUILTIN_ERROR; } return (ret_value); } static void builtin_cd_2_norme_lol(char **args, char last_dir[], int *ret_value, char ***env) { if (ft_strcmp(args[0], "-") == 0) { if (last_dir[0] == '\0') *ret_value = BUILTIN_SUCCESS; else *ret_value = go_to_dir(last_dir, *env); } else *ret_value = go_to_dir(args[0], *env); } int builtin_cd(char **args, char ***env) { static char last_dir[1024] = {0}; char *cwd; int ret_value; if (ft_get_nb_entities_2d_array(args) > 1) { write(STDERR_FILENO, "cd: Too many arguments\n", 23); return (BUILTIN_ERROR); } cwd = getcwd(NULL, 0); if (args == NULL) { if (home_is_valid(*env) == true) ret_value = go_to_dir(NULL, *env); else ret_value = BUILTIN_SUCCESS; } else builtin_cd_2_norme_lol(args, last_dir, &ret_value, env); if (ret_value == BUILTIN_SUCCESS && cwd != NULL) ft_strcpy(last_dir, cwd); free(cwd); return (ret_value); }
49822f19c4f2450347d4c85c636b60bdd86af26a
df026896f9579c0c9cb899e2312151605ce0809a
/newbie/sum-of-array.c
b57d49926ab000944ef07cb726f668af3bdc284c
[]
no_license
tannghe07/c-programming-examples
02f8d8ba48f31d4169fd91afdfa89b287e0d4fc7
8c114b42fd3c429a01f6eb8582d11361eccfb2fb
refs/heads/master
2021-07-11T13:12:56.653716
2020-09-29T16:09:34
2020-09-29T16:09:34
201,755,738
0
0
null
null
null
null
UTF-8
C
false
false
330
c
#include<stdio.h> #define L 10 int* nhap(){ static int arr[L]; int i; for(i=0; i<L; i++){ scanf("%d", &arr[i]); } return arr; } void tong( int arr[]){ int i; int j=0; for(i=0;i<L;i++){ j+=arr[i]; }printf("%d", j); } int main(){ int *arr; arr=nhap(); printf("Tong cua cac so vua nhap: "); tong(arr); return 0; }
738a5dda5da3711f04e2d3c1a2f7a4950933ed3d
50e7f29b07531bf3db585e420fb7a4209bacf102
/unity-samples/iOS/Roll-A-Ball-Ios/Classes/Native/mscorlib_System_MarshalByRefObject.h
e1d40d92d11b0a4ac43329f83909104d99f4a60e
[]
no_license
golergka/appboy-unity-sdk
0d7a8732c6dfd66ffbf30c9214c932a04f2b6d59
deeeba3849bd3a8e6a1166e95a6a5be6f5038646
refs/heads/master
2021-01-18T11:53:22.096992
2016-03-17T12:24:52
2016-03-17T12:24:52
54,115,484
0
0
null
2016-03-17T12:18:57
2016-03-17T12:18:56
null
UTF-8
C
false
false
454
h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> // System.Runtime.Remoting.ServerIdentity struct ServerIdentity_t1428; #include "mscorlib_System_Object.h" // System.MarshalByRefObject struct MarshalByRefObject_t1068 : public Object_t { // System.Runtime.Remoting.ServerIdentity System.MarshalByRefObject::_identity ServerIdentity_t1428 * ____identity_0; };
45c1a690fac17eb2c3535a7df4bf15cb496a5bd4
e66fceee9d201962b0668e1f58c46859854fceb4
/d/hangzhou/shanlu5.c
2b53e097419b8fd9ab98fea7692b1a1d16453f18
[]
no_license
cao777/mudHYLib
a8a6e28d097afb87ef68ee0a3fae13a1c50fe822
dd7832cc0abad1a21c797692c3f5fafd98702fb6
refs/heads/master
2023-03-15T16:26:34.697435
2018-12-03T15:35:34
2018-12-03T15:35:34
null
0
0
null
null
null
null
GB18030
C
false
false
790
c
// shanlu5.c // Date: Nov.1997 by Venus #include <room.h> inherit ROOM; void create() { set("short", "山路"); set("long", @LONG 走在小路上,只见漫山遍野都是绿油油的茶蓬。农家少女们在欢 笑声中采茶。山路延伸向东西两边,北边就是龙井,东北边有一条土 路。 LONG); set("exits", ([ "westup" : __DIR__"shanlu4", "northeast": __DIR__"tulu1", "north" : __DIR__"longjing", "east" : __DIR__"yanxiadong", ])); set("objects", ([ __DIR__"npc/caichanu" :2, ])); set("outdoors", "hangzhou"); // set("no_clean_up", 0); setup(); replace_program(ROOM); }
69ca85d1b8c89830c8b59a0aefd55edff8e81837
fe9b1cbe76e2a335a670f101bad8a07b2336da59
/ref_gl/r_cull.c
28dfd38a942c8d21dbd9658ac130e0e24c04e4fb
[]
no_license
vogonsorg/quake2xp
826bd4e794f94fee8de9f076a1db87bbbfbdaadf
c6f84a5172aa9364445644c3e666a5d14d026c20
refs/heads/master
2022-01-10T12:44:56.443259
2019-06-10T06:22:50
2019-06-10T06:22:50
null
0
0
null
null
null
null
UTF-8
C
false
false
7,697
c
/* * This is an open source non-commercial project. Dear PVS-Studio, please check it. * PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com */ /* Copyright (C) 1997-2001 Id Software, Inc., 2004-2013 Quake2xp Team. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "r_local.h" // this is the slow, general version int BoxOnPlaneSide22 (vec3_t emins, vec3_t emaxs, struct cplane_s *p) { int i; float dist1, dist2; int sides; vec3_t corners[2]; for (i = 0; i < 3; i++) { if (p->normal[i] < 0) { corners[0][i] = emins[i]; corners[1][i] = emaxs[i]; } else { corners[1][i] = emins[i]; corners[0][i] = emaxs[i]; } } dist1 = DotProduct (p->normal, corners[0]) - p->dist; dist2 = DotProduct (p->normal, corners[1]) - p->dist; sides = 0; if (dist1 >= 0) sides = 1; if (dist2 < 0) sides |= 2; return sides; } /* ================= BoundsAndSphereIntersect ================= */ qboolean BoundsAndSphereIntersect (const vec3_t mins, const vec3_t maxs, const vec3_t origin, float radius) { if (r_noCull->integer) return qfalse; if (mins[0] > origin[0] + radius || mins[1] > origin[1] + radius || mins[2] > origin[2] + radius) return qfalse; if (maxs[0] < origin[0] - radius || maxs[1] < origin[1] - radius || maxs[2] < origin[2] - radius) return qfalse; return qtrue; } /* =========== BoundsIntersect =========== */ qboolean BoundsIntersect (const vec3_t mins1, const vec3_t maxs1, const vec3_t mins2, const vec3_t maxs2) { if (r_noCull->integer) return qfalse; if (mins1[0] > maxs2[0] || mins1[1] > maxs2[1] || mins1[2] > maxs2[2]) return qfalse; if (maxs1[0] < mins2[0] || maxs1[1] < mins2[1] || maxs1[2] < mins2[2]) return qfalse; return qtrue; } /* ================= R_CullBox Returns qtrue if the box is completely outside the frustom ================= */ qboolean R_CullBox (vec3_t mins, vec3_t maxs) { int i; if (r_noCull->integer) return qfalse; for (i = 0; i < 6; i++) if (BOX_ON_PLANE_SIDE (mins, maxs, &frustum[i]) == 2) return qtrue; return qfalse; } qboolean R_CullConeLight (vec3_t mins, vec3_t maxs, cplane_t *frust) { int i; if (r_noCull->integer) return qfalse; for (i = 0; i < 4; i++) { if (BoxOnPlaneSide22(mins, maxs, &frust[i]) == 2) return qtrue; } return qfalse; } /* ================= R_CullOrigin Returns qtrue if the origin is completely outside the frustom ================= */ qboolean R_CullOrigin (vec3_t origin) { int i; if (r_noCull->integer) return qfalse; for (i = 0; i < 6; i++) if (BOX_ON_PLANE_SIDE (origin, origin, &frustum[i]) == 2) return qtrue; return qfalse; } qboolean R_CullPoint (vec3_t org) { int i; if (r_noCull->integer) return qfalse; for (i = 0; i < 6; i++) if (DotProduct (org, frustum[i].normal) > frustum[i].dist) return qtrue; return qfalse; } qboolean R_CullSphere (const vec3_t centre, const float radius) { int i; cplane_t *p; if (r_noCull->integer) return qfalse; for (i = 0, p = frustum; i < 6; i++, p++) { if (DotProduct (centre, p->normal) - p->dist <= -radius) return qtrue; } return qfalse; } qboolean BoundsIntersectsPoint (vec3_t mins, vec3_t maxs, vec3_t p) { if (r_noCull->integer) return qfalse; if (p[0] > maxs[0]) return qfalse; if (p[1] > maxs[1]) return qfalse; if (p[2] > maxs[2]) return qfalse; if (p[0] < mins[0]) return qfalse; if (p[1] < mins[1]) return qfalse; if (p[2] < mins[2]) return qfalse; return qtrue; } /* ========================= Frustum_CullHexProjection ========================= */ qboolean Frustum_CullHexProjection(const vec3_t points[8], const vec3_t projOrigin, const int planeBits) { const cplane_t *plane; vec3_t projPoints[8]; uint side; int i, j; if (!planeBits) return qfalse; for (i = 0; i < 8; i++) VectorSubtract(points[i], projOrigin, projPoints[i]); for (i = 0, plane = frustum; i < 6; i++, plane++) { if (!(planeBits & BIT(i))) continue; side = 0; for (j = 0; j < 8; j++) { if (DotProduct(points[j], plane->normal) > plane->dist) side |= PLANE_FRONT; else side |= PLANE_BACK; if (side == PLANE_CLIP) break; if (DotProduct(projPoints[j], plane->normal) > 0.f) side |= PLANE_FRONT; else side |= PLANE_BACK; if (side == PLANE_CLIP) break; } if (side == PLANE_BACK) return qtrue; } return qfalse; } /* ============================ Frustum_CullBoundsProjection ============================ */ qboolean Frustum_CullBoundsProjection(const vec3_t mins, const vec3_t maxs, const vec3_t projOrigin, const int planeBits) { vec3_t points[8]; int i; for (i = 0; i < 8; i++) { points[i][0] = (i & 1) ? mins[0] : maxs[0]; points[i][1] = (i & 2) ? mins[1] : maxs[1]; points[i][2] = (i & 4) ? mins[2] : maxs[2]; } return Frustum_CullHexProjection(points, projOrigin, planeBits); } /* ================================= Frustum_CullLocalBoundsProjection ================================= */ qboolean Frustum_CullLocalBoundsProjection(const vec3_t mins, const vec3_t maxs, const vec3_t origin, const mat3_t axis, const vec3_t projOrigin, const int planeBits) { vec3_t tMins, tMaxs; vec3_t tmp; vec3_t points[8]; int i; if (Mat3_IsIdentity(axis)) { VectorAdd(origin, mins, tMins); VectorAdd(origin, maxs, tMaxs); return Frustum_CullBoundsProjection(tMins, tMaxs, projOrigin, planeBits); } for (i = 0; i < 8; i++) { tmp[0] = (i & 1) ? mins[0] : maxs[0]; tmp[1] = (i & 2) ? mins[1] : maxs[1]; tmp[2] = (i & 4) ? mins[2] : maxs[2]; Mat3_MultiplyVector(axis, tmp, points[i]); VectorAdd(points[i], origin, points[i]); } return Frustum_CullHexProjection(points, projOrigin, planeBits); } int SignbitsForPlane (cplane_t * out) { int bits, j; // for fast box on planeside test bits = 0; for (j = 0; j < 3; j++) { if (out->normal[j] < 0) bits |= 1 << j; } return bits; } void R_SetFrustum (void) { int i; RotatePointAroundVector (frustum[0].normal, vup, vpn, -(90 - r_newrefdef.fov_x * 0.5)); RotatePointAroundVector (frustum[1].normal, vup, vpn, 90 - r_newrefdef.fov_x * 0.5); RotatePointAroundVector (frustum[2].normal, vright, vpn, 90 - r_newrefdef.fov_y * 0.5); RotatePointAroundVector (frustum[3].normal, vright, vpn, -(90 - r_newrefdef.fov_y * 0.5)); VectorCopy (vpn, frustum[4].normal); VectorNegate(vpn, frustum[5].normal); for (i = 0; i < 6; i++) { VectorNormalize(frustum[i].normal); frustum[i].type = PLANE_ANYZ; frustum[i].dist = DotProduct (r_origin, frustum[i].normal); frustum[i].signbits = SignbitsForPlane (&frustum[i]); } frustum[4].dist += r_zNear->value; if (r_newrefdef.rdflags & RDF_NOWORLDMODEL) frustum[5].dist -= 128.0; else frustum[5].dist -= r_zFar->value; }
48b37db5407483a4a4e954b9b03202d0afa2afb7
488d85e816fbb15bbcf20664f2817d5920079ab6
/sources/ORB/topics/sensors/battery_status.h
16d57c45d8aca218276c046a7df48b49c02d412d
[]
no_license
wanglehui/Unmanned_aerial_vehicle
faf960a1175acc48092196b1ec612efc1618c0c2
fd3e6940ed250d6775d03ea90be166d87d0fa036
refs/heads/master
2020-12-25T20:42:17.453670
2014-06-03T13:05:54
2014-06-03T13:05:54
null
0
0
null
null
null
null
UTF-8
C
false
false
667
h
/** * @file battery_status.h * * Definition of the battery status ORB topic. */ #ifndef TOPIC_BATTERY_STATUS_H_ #define TOPIC_BATTERY_STATUS_H_ #include <stdint.h> #include "../../ORB.h" /** * @addtogroup topics * @{ */ /** * Battery voltages and status */ struct battery_status_s { float voltage_v; /**< Battery voltage in volts, filtered */ float current_a; /**< Battery current in amperes, filtered, -1 if unknown */ float discharged_mah; /**< Discharged amount in mAh, filtered, -1 if unknown */ }; /** * @} */ /* register this as object request broker structure */ ORB_DECLARE(battery_status); #endif
5198da5e5246de78bfadce93e85834ea37e32df4
5c255f911786e984286b1f7a4e6091a68419d049
/vulnerable_code/a7366812-68e5-40c9-bdc8-3ea5455f3734.c
ba5e78dc6914dcfff9b36ae36fd2612a6ec9fe6b
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944740
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
565
c
#include <string.h> #include <stdio.h> int main() { int i=0; int j=14; int k; int l; k = 53; l = 64; k = i/j; l = i/j; l = i/j; l = l%j; l = l%j; k = k-j*k; //variables //random /* START VULNERABILITY */ int a; int b[7]; int c[85]; a = 0; while (a < strlen(b)) { //random /* START BUFFER SET */ *((int *)c + a) = *((int *)b + a); /* END BUFFER SET */ a++; } /* END VULNERABILITY */ printf("%d%d\n",k,l); return 0; }
fe728453a3cb1f0fff2af8d61ea5123f9e7d8673
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/libgit2/tests/submodule/extr_nosubs.c_test_submodule_nosubs__bad_gitmodules.c
1d330e09338a40093852ab000fd0e4773c6d7ae1
[]
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,363
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 int /*<<< orphan*/ git_repository ; /* Variables and functions */ int /*<<< orphan*/ GIT_ENOTFOUND ; int /*<<< orphan*/ cl_assert_equal_i (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ cl_git_mkfile (char*,char*) ; int /*<<< orphan*/ cl_git_pass (int /*<<< orphan*/ ) ; int /*<<< orphan*/ cl_git_rewritefile (char*,char*) ; int /*<<< orphan*/ * cl_git_sandbox_init (char*) ; int /*<<< orphan*/ git_submodule_lookup (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*) ; void test_submodule_nosubs__bad_gitmodules(void) { git_repository *repo = cl_git_sandbox_init("status"); cl_git_mkfile("status/.gitmodules", "[submodule \"foobar\"]\tpath=blargle\n\turl=\n\tbranch=\n\tupdate=flooble\n\n"); cl_git_rewritefile("status/.gitmodules", "[submodule \"foobar\"]\tpath=blargle\n\turl=\n\tbranch=\n\tupdate=rebase\n\n"); cl_git_pass(git_submodule_lookup(NULL, repo, "foobar")); cl_assert_equal_i(GIT_ENOTFOUND, git_submodule_lookup(NULL, repo, "subdir")); }
fb26f04b3a0cf876773b5868bd9906402c76d3de
20d86ed4ace5e79058fff9d0c6a920b160ed5a6a
/Source code/Chapter04/Ch4PR12.C
078f2db45d0df3ea5a72783d94b7aa21aefcd560
[]
no_license
amitks/Data-stucture-c
6dea10fe9518b316186cc1e8cbd0ff1c39cc5b14
828c6dcfd6a4b691e51618894cb46e5e021f772a
refs/heads/master
2021-01-19T14:58:38.671025
2013-08-27T10:36:54
2013-08-27T10:36:54
9,750,092
0
1
null
null
null
null
UTF-8
C
false
false
1,049
c
/* CH4PR12.C: Program to add a new node at the end of linked list using recursion*/ #include <stdio.h> #include <conio.h> #include <alloc.h> struct node { int data ; struct node *link ; } ; void addatend ( struct node **, int ) ; void display ( struct node * ) ; void main( ) { struct node *p ; p = NULL ; addatend ( &p, 1 ) ; addatend ( &p, 2 ) ; addatend ( &p, 3 ) ; addatend ( &p, 4 ) ; addatend ( &p, 5 ) ; addatend ( &p, 6 ) ; addatend ( &p, 10 ) ; clrscr( ) ; display ( p ) ; } /* adds a new node at the end of the linked list */ void addatend ( struct node **s, int num ) { if ( *s == NULL ) { *s = malloc ( sizeof ( struct node ) ) ; ( *s ) -> data = num ; ( *s ) -> link = NULL ; } else addatend ( &( ( *s ) -> link ), num ) ; } /* displays the contents of the linked list */ void display ( struct node *q ) { printf ( "\n" ) ; /* traverse the entire linked list */ while ( q != NULL ) { printf ( "%d ", q -> data ) ; q = q -> link ; } }
3bde3a036645b867333630e50d8259190c9b3f52
686b214d7246b740338fbd92f1df473106c551a7
/firmware/src/commands/startProgramCommand.c
685fa8179d4b8fec39dfc5a1cf5fad6bafca4c44
[]
no_license
olegkyka/OpenWasher-V2
7f1ee00ca5bb7b7609aadccb1e1c079ee7ede6c5
48f3a971af30fbeba052f44a32b58e1cc9ce8b18
refs/heads/master
2023-04-06T18:16:17.534206
2020-07-01T08:56:05
2020-07-01T08:56:05
null
0
0
null
null
null
null
WINDOWS-1251
C
false
false
2,321
c
/* * startprogram.c * * Created on: 20 нояб. 2019 г. * Author: Shironeko */ #include <stdio.h> #include "stm32f10x.h" #include "limits.h" #include "status.h" #include "action.h" #include "commandsRoutine.h" #include "programOptions.h" program programFromCommand; programOptions optionsFromCommand; extern Status currentStatus; extern uint8_t action; extern const programOptions defaultProgramOptions[PROGRAM_COUNT]; void processStartProgramCommand(uint8_t* buffer, uint8_t count) { if(currentStatus.program != NoProgram){ send_answer(startProgramPacketType, NOTREADY); printf("Another program started\n"); return; } if(count < 1){ send_answer(startProgramPacketType, BADARGS); printf("C %u\n", count); return; } //copy params programFromCommand = buffer[0]; optionsFromCommand = defaultProgramOptions[programFromCommand]; for(uint8_t i = 0; i < count - 1;i++) { if(buffer[i+1] != 0xFF) ((uint8_t* )&optionsFromCommand)[i] = buffer[i+1]; } //validation if (programFromCommand >= PROGRAM_COUNT) { send_answer(startProgramPacketType, BADARGS); printf("select program %u, but program count%u\n", programFromCommand, PROGRAM_COUNT); return; } if (optionsFromCommand.washingSpeed != 0xFF && optionsFromCommand.washingSpeed > MAX_WASHING_SPEED) { send_answer(startProgramPacketType, BADARGS); printf("select washing speed %u, but max %u\n", optionsFromCommand.washingSpeed, MAX_WASHING_SPEED); return; } if (optionsFromCommand.spinningSpeed != 0xFF && optionsFromCommand.spinningSpeed > MAX_SPINNING_SPEED) { send_answer(startProgramPacketType, BADARGS); printf("select spinning speed %u, but max %u\n", optionsFromCommand.spinningSpeed, MAX_SPINNING_SPEED); return; } if (optionsFromCommand.temperature != 0xFF && optionsFromCommand.temperature > MAX_TEMPERATURE) { send_answer(startProgramPacketType, BADARGS); printf("select temperature %u, but max %u\n", optionsFromCommand.temperature, MAX_TEMPERATURE); return; } if (optionsFromCommand.waterLevel != 0xFF && optionsFromCommand.waterLevel > 100) { send_answer(startProgramPacketType, BADARGS); printf("select water level %u, but max 100\n", optionsFromCommand.waterLevel); return; } action |= ACTION_STARTPROGRAM; send_answer(startProgramPacketType, NOEEROR); }
a643fc2cf53b1ffb409c5102c0500a6a57d768ad
66d339399671f9520e88d79b7118b6670f6a40a2
/code/927.c
8017cb89d3464cb531527494f75a61247fbed688
[ "MIT" ]
permissive
Tarpelite/OJ_research
038ba1b3a5d8add01642cddd45b59722144ac110
5c23591a50e755dac800dfaedb561290ce35fc5b
refs/heads/master
2020-06-07T10:52:17.059468
2019-06-21T10:47:56
2019-06-21T10:47:56
193,003,111
0
0
null
null
null
null
UTF-8
C
false
false
249
c
#include<stdio.h> int f(int); int main() { int a,b,c; scanf("%d",&a); for(b=a+1;f(b)!=1;b++){} printf("%d",b); return 0; } int f(int a) { int i,n; for(i=1,n=0;i<=a;i++) { if(a%i==0) n++; } if(n==2) return 1; else return 0; }
bc5abca81d1adfe7303b6cf01792a3d9f068902f
0668bf74167ec645da3153c4be9d2f529ca62005
/STM32F103C8T6-Blue-Pill/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/Lib_DEBUG/RunTime_Check/stm32f10x_conf.h
655633266d2d82d11a68c5567269ee5b5b4b5c9e
[]
no_license
remotemcu/remcu_examples
eb401b343ae479d01f3be625c190d06df23ba4f9
b18752669af243770f67484e8801e5b16bfc8d87
refs/heads/master
2023-08-09T00:26:42.086987
2023-08-07T22:04:13
2023-08-07T22:04:13
198,629,084
426
12
null
2023-08-07T22:04:15
2019-07-24T12:13:21
C
UTF-8
C
false
false
3,241
h
/** ****************************************************************************** * @file Lib_DEBUG/RunTime_Check/stm32f10x_conf.h * @author MCD Application Team * @version V3.5.0 * @date 08-April-2011 * @brief Library configuration file. ****************************************************************************** * @attention * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2> ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_CONF_H #define __STM32F10x_CONF_H /* Includes ------------------------------------------------------------------*/ /* Uncomment/Comment the line below to enable/disable peripheral header file inclusion */ #include "stm32f10x_adc.h" #include "stm32f10x_bkp.h" #include "stm32f10x_can.h" #include "stm32f10x_cec.h" #include "stm32f10x_crc.h" #include "stm32f10x_dac.h" #include "stm32f10x_dbgmcu.h" #include "stm32f10x_dma.h" #include "stm32f10x_exti.h" #include "stm32f10x_flash.h" #include "stm32f10x_fsmc.h" #include "stm32f10x_gpio.h" #include "stm32f10x_i2c.h" #include "stm32f10x_iwdg.h" #include "stm32f10x_pwr.h" #include "stm32f10x_rcc.h" #include "stm32f10x_rtc.h" #include "stm32f10x_sdio.h" #include "stm32f10x_spi.h" #include "stm32f10x_tim.h" #include "stm32f10x_usart.h" #include "stm32f10x_wwdg.h" #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Uncomment the line below to expanse the "assert_param" macro in the Standard Peripheral Library drivers code */ #define USE_FULL_ASSERT 1 /* Exported macro ------------------------------------------------------------*/ #ifdef USE_FULL_ASSERT /** * @brief The assert_param macro is used for function's parameters check. * @param expr: If expr is false, it calls assert_failed function which reports * the name of the source file and the source line number of the call * that failed. If expr is true, it returns no value. * @retval None */ #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) /* Exported functions ------------------------------------------------------- */ void assert_failed(uint8_t* file, uint32_t line); #else #define assert_param(expr) ((void)0) #endif /* USE_FULL_ASSERT */ #endif /* __STM32F10x_CONF_H */ /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
3e9e57bfdc5f2184092cc316a013e67290094851
3d0e2d4bf865833c5304792a126801d98f000f40
/include/msgdata/msg_r209r0105.h
ec97e94c86fd884926cce8c01ea11fbd5247304e
[]
no_license
XLuma/retsam_00jupc
86311fa2927798e45070f9922046ba5e5a9539ae
9859bc2f4b5bedcadc791f39ce1e7c77172194e7
refs/heads/main
2023-07-25T04:24:49.694267
2021-07-30T23:08:09
2021-07-30T23:08:09
393,130,605
0
0
null
2021-08-05T17:56:40
2021-08-05T17:56:39
null
SHIFT_JIS
C
false
false
648
h
//============================================================================== /** * @file msg_r209r0105.h * @brief メッセージID参照用ヘッダファイル * * このファイルはコンバータにより自動生成されています */ //============================================================================== #ifndef __MSG_R209R0105_H__ #define __MSG_R209R0105_H__ #define msg_r209r0105_oldwoman2a_01 (0) #define msg_r209r0105_oldwoman2a_02 (1) #define msg_r209r0105_oldwoman2a_03 (2) #define msg_r209r0105_oldwoman2b_01 (3) #define msg_r209r0105_oldwoman2b_02 (4) #define msg_r209r0105_oldwoman2b_03 (5) #endif
3348fc8052e3ae6276510067aa1ad15c70992c83
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/net/bridge/extr_br_fdb.c_fdb_delete.c
4f931ef90ef587da963623d863dda2d726507aa0
[]
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,830
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 */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ addr; } ; struct TYPE_4__ {TYPE_1__ addr; } ; struct net_bridge_fdb_entry {int /*<<< orphan*/ rcu; int /*<<< orphan*/ rhnode; int /*<<< orphan*/ fdb_node; TYPE_2__ key; scalar_t__ is_static; } ; struct net_bridge {int /*<<< orphan*/ fdb_hash_tbl; } ; /* Variables and functions */ int /*<<< orphan*/ RTM_DELNEIGH ; int /*<<< orphan*/ br_fdb_rht_params ; int /*<<< orphan*/ call_rcu (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ fdb_del_hw_addr (struct net_bridge*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ fdb_notify (struct net_bridge*,struct net_bridge_fdb_entry*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ fdb_rcu_free ; int /*<<< orphan*/ hlist_del_init_rcu (int /*<<< orphan*/ *) ; int /*<<< orphan*/ rhashtable_remove_fast (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ trace_fdb_delete (struct net_bridge*,struct net_bridge_fdb_entry*) ; __attribute__((used)) static void fdb_delete(struct net_bridge *br, struct net_bridge_fdb_entry *f, bool swdev_notify) { trace_fdb_delete(br, f); if (f->is_static) fdb_del_hw_addr(br, f->key.addr.addr); hlist_del_init_rcu(&f->fdb_node); rhashtable_remove_fast(&br->fdb_hash_tbl, &f->rhnode, br_fdb_rht_params); fdb_notify(br, f, RTM_DELNEIGH, swdev_notify); call_rcu(&f->rcu, fdb_rcu_free); }
25896e79726d519f0f1bc6f6460d8b08addb5f11
b5b61f3f0d54da1754de6c75ab7be261164cb0bc
/samplecode/file/app/app.c
5abf3bb9d00e7062e6353816f751c5a2c8cc3264
[ "BSD-3-Clause", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
apache/incubator-teaclave-sgx-sdk
4b2077a287d338637cee8be624e86709d50cecc5
3c903bdac4e503dd27b9b1f761c4abfc55f2464c
refs/heads/master
2023-08-17T21:47:08.884261
2023-07-25T10:17:46
2023-07-26T01:32:18
89,560,048
459
171
Apache-2.0
2023-07-26T01:32:19
2017-04-27T05:43:24
Rust
UTF-8
C
false
false
4,628
c
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License.. #include <stdio.h> #include <string.h> #include <assert.h> #include <unistd.h> #include <pwd.h> #define MAX_PATH FILENAME_MAX #include "sgx_urts.h" #include "app.h" #include "Enclave_u.h" sgx_enclave_id_t global_eid = 0; typedef struct _sgx_errlist_t { sgx_status_t err; const char *msg; const char *sug; /* Suggestion */ } sgx_errlist_t; /* Error code returned by sgx_create_enclave */ static sgx_errlist_t sgx_errlist[] = { { SGX_ERROR_UNEXPECTED, "Unexpected error occurred.", NULL }, { SGX_ERROR_INVALID_PARAMETER, "Invalid parameter.", NULL }, { SGX_ERROR_OUT_OF_MEMORY, "Out of memory.", NULL }, { SGX_ERROR_ENCLAVE_LOST, "Power transition occurred.", "Please refer to the sample \"PowerTransition\" for details." }, { SGX_ERROR_INVALID_ENCLAVE, "Invalid enclave image.", NULL }, { SGX_ERROR_INVALID_ENCLAVE_ID, "Invalid enclave identification.", NULL }, { SGX_ERROR_INVALID_SIGNATURE, "Invalid enclave signature.", NULL }, { SGX_ERROR_OUT_OF_EPC, "Out of EPC memory.", NULL }, { SGX_ERROR_NO_DEVICE, "Invalid SGX device.", "Please make sure SGX module is enabled in the BIOS, and install SGX driver afterwards." }, { SGX_ERROR_MEMORY_MAP_CONFLICT, "Memory map conflicted.", NULL }, { SGX_ERROR_INVALID_METADATA, "Invalid enclave metadata.", NULL }, { SGX_ERROR_DEVICE_BUSY, "SGX device was busy.", NULL }, { SGX_ERROR_INVALID_VERSION, "Enclave version was invalid.", NULL }, { SGX_ERROR_INVALID_ATTRIBUTE, "Enclave was not authorized.", NULL }, { SGX_ERROR_ENCLAVE_FILE_ACCESS, "Can't open enclave file.", NULL }, }; /* Check error conditions for loading enclave */ void print_error_message(sgx_status_t ret) { size_t idx = 0; size_t ttl = sizeof sgx_errlist/sizeof sgx_errlist[0]; for (idx = 0; idx < ttl; idx++) { if(ret == sgx_errlist[idx].err) { if(NULL != sgx_errlist[idx].sug) printf("Info: %s\n", sgx_errlist[idx].sug); printf("Error: %s\n", sgx_errlist[idx].msg); break; } } if (idx == ttl) printf("Error: Unexpected error occurred.\n"); } int initialize_enclave(void) { sgx_launch_token_t token = {0}; sgx_status_t ret = SGX_ERROR_UNEXPECTED; int updated = 0; /* call sgx_create_enclave to initialize an enclave instance */ /* Debug Support: set 2nd parameter to 1 */ ret = sgx_create_enclave(ENCLAVE_FILENAME, SGX_DEBUG_FLAG, &token, &updated, &global_eid, NULL); if (ret != SGX_SUCCESS) { print_error_message(ret); return -1; } printf("[+] global_eid: %ld\n", global_eid); return 0; } /* Application entry */ int SGX_CDECL main(int argc, char *argv[]) { sgx_status_t sgx_ret = SGX_SUCCESS; int ret = 0; (void)(argc); (void)(argv); /* Initialize the enclave */ if(initialize_enclave() < 0){ printf("Enter a character before exit ...\n"); getchar(); return -1; } sgx_ret = write_file(global_eid, &ret); if(sgx_ret != SGX_SUCCESS) { print_error_message(sgx_ret); return -1; } printf("write_file success ...\n"); sgx_ret = read_file(global_eid, &ret); if(sgx_ret != SGX_SUCCESS) { print_error_message(sgx_ret); return -1; } printf("read_file success ...\n"); /* Destroy the enclave */ sgx_destroy_enclave(global_eid); return 0; }
2b3dcb398b01627420e4114a58331a8e8a17d5bf
ea173136dc0bbba919a14f645af7b97ce949ede2
/ce_main_app/floppy/floppysetup_commands.h
cc0b4c068b900ec1877d19f36061bce3be86e065
[ "BSD-2-Clause" ]
permissive
beki007/ce-atari
cc5c35b5faaf6c1b48980f13b99c505350790a9c
b6b2c492954cd75519de3ed18b404b07f634904f
refs/heads/master
2020-04-03T06:19:45.881063
2018-11-24T11:26:06
2018-11-24T11:26:06
155,071,788
0
0
null
2018-10-28T13:03:13
2018-10-28T13:03:13
null
UTF-8
C
false
false
1,803
h
#ifndef FLOPPYSETUP_COMMANDS_H #define FLOPPYSETUP_COMMANDS_H // commands for HOSTMOD_FDD_SETUP #define FDD_CMD_IDENTIFY 0 #define FDD_CMD_GETSILOCONTENT 1 #define FDD_CMD_UPLOADIMGBLOCK_START 10 #define FDD_CMD_UPLOADIMGBLOCK_FULL 11 #define FDD_CMD_UPLOADIMGBLOCK_PART 12 #define FDD_CMD_UPLOADIMGBLOCK_DONE_OK 13 #define FDD_CMD_UPLOADIMGBLOCK_DONE_FAIL 14 #define FDD_CMD_SWAPSLOTS 20 #define FDD_CMD_REMOVESLOT 21 #define FDD_CMD_NEW_EMPTYIMAGE 22 #define FDD_CMD_GET_CURRENT_SLOT 25 #define FDD_CMD_SET_CURRENT_SLOT 26 #define FDD_CMD_GET_IMAGE_ENCODING_RUNNING 28 #define FDD_CMD_DOWNLOADIMG_START 30 #define FDD_CMD_DOWNLOADIMG_GETBLOCK 31 #define FDD_CMD_DOWNLOADIMG_DONE 32 #define FDD_CMD_DOWNLOADIMG_ONDEVICE 35 #define FDD_CMD_SEARCH_INIT 40 // call this to init the image search #define FDD_CMD_SEARCH_STRING 41 // search for a string, create vector of results #define FDD_CMD_SEARCH_RESULTS 42 // retrieve one page of results #define FDD_CMD_SEARCH_MARK 43 // mark one image for download #define FDD_CMD_SEARCH_DOWNLOAD 45 // start / check the download process #define FDD_CMD_SEARCH_REFRESHLIST 48 // delete old image list, download a new one #define FDD_OK 0 #define FDD_ERROR 2 #define FDD_DN_LIST 4 #define FDD_DN_WORKING 5 #define FDD_DN_DONE 6 #define FDD_DN_NOTHING_MORE 7 #define FDD_RES_ONDEVICECOPY 0xDC #endif // FLOPPYSETUP_COMMANDS_H
26d4b244b69b1aeafd8af974576ee788c7e1585f
2a021667eb79a7813c1a8e0a3fae395a1b5c2b40
/common/include/prop/prop_array.h
945468316f4699af24d0527e87c7ef5e907953c3
[]
no_license
ghsecuritylab/tombibsd-src
b686fa412cbaabd1734338e0832dfa815802b4be
3f3345b36e1db466da0c12aeb4f46ff3797147ff
refs/heads/master
2021-02-28T23:37:07.840661
2015-04-25T03:39:53
2015-04-25T03:39:53
245,740,289
0
0
null
2020-03-08T02:39:51
2020-03-08T02:39:50
null
UTF-8
C
false
false
5,916
h
/* $NetBSD$ */ /*- * Copyright (c) 2006, 2009 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Jason R. Thorpe. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _PROPLIB_PROP_ARRAY_H_ #define _PROPLIB_PROP_ARRAY_H_ #include <prop/prop_object.h> typedef struct _prop_array *prop_array_t; __BEGIN_DECLS prop_array_t prop_array_create(void); prop_array_t prop_array_create_with_capacity(unsigned int); prop_array_t prop_array_copy(prop_array_t); prop_array_t prop_array_copy_mutable(prop_array_t); unsigned int prop_array_capacity(prop_array_t); unsigned int prop_array_count(prop_array_t); bool prop_array_ensure_capacity(prop_array_t, unsigned int); void prop_array_make_immutable(prop_array_t); bool prop_array_mutable(prop_array_t); prop_object_iterator_t prop_array_iterator(prop_array_t); prop_object_t prop_array_get(prop_array_t, unsigned int); bool prop_array_set(prop_array_t, unsigned int, prop_object_t); bool prop_array_add(prop_array_t, prop_object_t); void prop_array_remove(prop_array_t, unsigned int); bool prop_array_equals(prop_array_t, prop_array_t); char * prop_array_externalize(prop_array_t); prop_array_t prop_array_internalize(const char *); bool prop_array_externalize_to_file(prop_array_t, const char *); prop_array_t prop_array_internalize_from_file(const char *); #if defined(__NetBSD__) struct plistref; #if !defined(_KERNEL) && !defined(_STANDALONE) bool prop_array_externalize_to_pref(prop_array_t, struct plistref *); bool prop_array_internalize_from_pref(const struct plistref *, prop_array_t *); int prop_array_send_ioctl(prop_array_t, int, unsigned long); int prop_array_recv_ioctl(int, unsigned long, prop_array_t *); int prop_array_send_syscall(prop_array_t, struct plistref *); int prop_array_recv_syscall(const struct plistref *, prop_array_t *); #elif defined(_KERNEL) int prop_array_copyin(const struct plistref *, prop_array_t *); int prop_array_copyout(struct plistref *, prop_array_t); int prop_array_copyin_ioctl(const struct plistref *, const u_long, prop_array_t *); int prop_array_copyout_ioctl(struct plistref *, const u_long, prop_array_t); #endif #endif /* __NetBSD__ */ /* * Utility routines to make it more convenient to work with values * stored in dictionaries. */ bool prop_array_get_bool(prop_array_t, unsigned int, bool *); bool prop_array_set_bool(prop_array_t, unsigned int, bool); bool prop_array_get_int8(prop_array_t, unsigned int, int8_t *); bool prop_array_get_uint8(prop_array_t, unsigned int, uint8_t *); bool prop_array_set_int8(prop_array_t, unsigned int, int8_t); bool prop_array_set_uint8(prop_array_t, unsigned int, uint8_t); bool prop_array_get_int16(prop_array_t, unsigned int, int16_t *); bool prop_array_get_uint16(prop_array_t, unsigned int, uint16_t *); bool prop_array_set_int16(prop_array_t, unsigned int, int16_t); bool prop_array_set_uint16(prop_array_t, unsigned int, uint16_t); bool prop_array_get_int32(prop_array_t, unsigned int, int32_t *); bool prop_array_get_uint32(prop_array_t, unsigned int, uint32_t *); bool prop_array_set_int32(prop_array_t, unsigned int, int32_t); bool prop_array_set_uint32(prop_array_t, unsigned int, uint32_t); bool prop_array_get_int64(prop_array_t, unsigned int, int64_t *); bool prop_array_get_uint64(prop_array_t, unsigned int, uint64_t *); bool prop_array_set_int64(prop_array_t, unsigned int, int64_t); bool prop_array_set_uint64(prop_array_t, unsigned int, uint64_t); bool prop_array_add_int8(prop_array_t, int8_t); bool prop_array_add_uint8(prop_array_t, uint8_t); bool prop_array_add_int16(prop_array_t, int16_t); bool prop_array_add_uint16(prop_array_t, uint16_t); bool prop_array_add_int32(prop_array_t, int32_t); bool prop_array_add_uint32(prop_array_t, uint32_t); bool prop_array_add_int64(prop_array_t, int64_t); bool prop_array_add_uint64(prop_array_t, uint64_t); bool prop_array_get_cstring(prop_array_t, unsigned int, char **); bool prop_array_set_cstring(prop_array_t, unsigned int, const char *); bool prop_array_get_cstring_nocopy(prop_array_t, unsigned int, const char **); bool prop_array_set_cstring_nocopy(prop_array_t, unsigned int, const char *); bool prop_array_add_and_rel(prop_array_t, prop_object_t); __END_DECLS #endif /* _PROPLIB_PROP_ARRAY_H_ */
ef6b5537223b956ffac39c14a578fa3d3d545c4b
d0a4f7fb530d31aa5e1c2a89fe18a1b1d71e5860
/src/util/mercury_queue.h
74b1a93a8c546dc85d46247b0b82cf920ad92817
[ "LicenseRef-scancode-generic-cla", "BSD-3-Clause" ]
permissive
srini009/mercury
9d710920c760df1670cbddadecc2f2cb2a33c133
3f6b5484afd102694ee106d5f3e33746bf6ccf9a
refs/heads/master
2022-02-25T05:48:07.275256
2022-01-14T19:49:19
2022-01-14T20:42:15
245,015,393
0
0
NOASSERTION
2020-03-04T22:16:32
2020-03-04T22:16:31
null
UTF-8
C
false
false
6,209
h
/** * Copyright (c) 2013-2021 UChicago Argonne, LLC and The HDF Group. * * SPDX-License-Identifier: BSD-3-Clause */ /* Code below is derived from sys/queue.h which follows the below notice: * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * * @(#)queue.h 8.5 (Berkeley) 8/20/94 */ #ifndef MERCURY_QUEUE_H #define MERCURY_QUEUE_H #define HG_QUEUE_HEAD_INITIALIZER(name) \ { \ NULL, &(name).head \ } #define HG_QUEUE_HEAD_INIT(struct_head_name, var_name) \ struct struct_head_name var_name = HG_QUEUE_HEAD_INITIALIZER(var_name) #define HG_QUEUE_HEAD_DECL(struct_head_name, struct_entry_name) \ struct struct_head_name { \ struct struct_entry_name *head; \ struct struct_entry_name **tail; \ } #define HG_QUEUE_HEAD(struct_entry_name) \ struct { \ struct struct_entry_name *head; \ struct struct_entry_name **tail; \ } #define HG_QUEUE_ENTRY(struct_entry_name) \ struct { \ struct struct_entry_name *next; \ } #define HG_QUEUE_INIT(head_ptr) \ do { \ (head_ptr)->head = NULL; \ (head_ptr)->tail = &(head_ptr)->head; \ } while (/*CONSTCOND*/ 0) #define HG_QUEUE_IS_EMPTY(head_ptr) ((head_ptr)->head == NULL) #define HG_QUEUE_FIRST(head_ptr) ((head_ptr)->head) #define HG_QUEUE_NEXT(entry_ptr, entry_field_name) \ ((entry_ptr)->entry_field_name.next) #define HG_QUEUE_PUSH_TAIL(head_ptr, entry_ptr, entry_field_name) \ do { \ (entry_ptr)->entry_field_name.next = NULL; \ *(head_ptr)->tail = (entry_ptr); \ (head_ptr)->tail = &(entry_ptr)->entry_field_name.next; \ } while (/*CONSTCOND*/ 0) /* TODO would be nice to not have any condition */ #define HG_QUEUE_POP_HEAD(head_ptr, entry_field_name) \ do { \ if ((head_ptr)->head && \ ((head_ptr)->head = (head_ptr)->head->entry_field_name.next) == \ NULL) \ (head_ptr)->tail = &(head_ptr)->head; \ } while (/*CONSTCOND*/ 0) #define HG_QUEUE_FOREACH(var, head_ptr, entry_field_name) \ for ((var) = ((head_ptr)->head); (var); \ (var) = ((var)->entry_field_name.next)) /** * Avoid using those for performance reasons or use mercury_list.h instead */ #define HG_QUEUE_REMOVE(head_ptr, entry_ptr, type, entry_field_name) \ do { \ if ((head_ptr)->head == (entry_ptr)) { \ HG_QUEUE_POP_HEAD((head_ptr), entry_field_name); \ } else { \ struct type *curelm = (head_ptr)->head; \ while (curelm->entry_field_name.next != (entry_ptr)) \ curelm = curelm->entry_field_name.next; \ if ((curelm->entry_field_name.next = \ curelm->entry_field_name.next->entry_field_name \ .next) == NULL) \ (head_ptr)->tail = &(curelm)->entry_field_name.next; \ } \ } while (/*CONSTCOND*/ 0) #endif /* MERCURY_QUEUE_H */
2cf6f5ca3a256c4912132f5a1c456d1212e0821a
3cc59a92b32997af11b82b78b3577289d62a681d
/pthread/hw1.c
ff54f89e9ec55c3d5884db1700b2bb3ea25e6662
[]
no_license
zzy0119/emb20200210
a5d40658382142d0743c6aaf401eb28dc9f96ea8
a12ef895933dd392066ce064b4accd115610b8d9
refs/heads/master
2022-11-04T05:48:45.136308
2020-06-24T02:30:22
2020-06-24T02:30:22
261,624,651
0
0
null
null
null
null
UTF-8
C
false
false
1,014
c
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <string.h> #include <unistd.h> #define THRNR 5 static int curid = 0; static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; static void *thr_job(void *arg) { int myid = (int)arg; while (1) { pthread_mutex_lock(&mut); while (curid != myid) { pthread_cond_wait(&cond, &mut); } printf("%c", 'a'+curid); fflush(NULL); curid = (curid + 1) % THRNR; pthread_cond_broadcast(&cond); pthread_mutex_unlock(&mut); } } int main(void) { pthread_t tids[THRNR]; int err; pthread_attr_t attr; // 线程属性---》分离 // pthread_detach pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); for (int i = 0; i < THRNR; i++) { err = pthread_create(tids+i, &attr, thr_job, (void *)i); if (err) { fprintf(stderr, "pthread_create():%s\n", strerror(err)); exit(0); } } for (int i = 0; i < 5; i++) sleep(1); exit(0); }
aeaa7ff8f81b96dd0a5c62be01a0233d3a5e40da
968f4fd21d9354f615a3cd98b52a2e04b3051238
/Projects/nm-otool/srcs/nm/get_syms_64.c
0727b2903be8886f30a65946216bc1a52a76c073
[]
no_license
svelhinh/Projects
e6f08bb8a8e173b69ff9c3997f69f6dd4344a7ff
2dcd35934078f731cbe6e75150338523c06f41ad
refs/heads/master
2023-08-07T20:33:29.793393
2023-07-28T14:38:31
2023-07-28T14:38:31
60,209,430
0
1
null
null
null
null
UTF-8
C
false
false
1,999
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_syms_64.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: svelhinh <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/08/01 17:39:33 by svelhinh #+# #+# */ /* Updated: 2017/08/09 16:56:05 by svelhinh ### ########.fr */ /* */ /* ************************************************************************** */ #include "nm.h" static void set_sym_values(t_nlist_64 array_elem, char *stringtable, t_sym **current) { char *hex_value; size_t hex_len; size_t i; hex_value = ft_value_to_hex_64(array_elem.n_value); hex_len = ft_strlen(hex_value); i = 0; while (i < 16 - hex_len) { hex_value = ft_strjoin("0", hex_value); i++; } (*current)->addr = hex_value; (*current)->name = stringtable + array_elem.n_un.n_strx; (*current)->type_flag = array_elem.n_type; (*current)->sect_nb = array_elem.n_sect; } t_sym **get_syms_64(int nsyms, int stroff, char *ptr, t_nlist_64 *array) { int i; char *stringtable; t_sym **first; t_sym *current; i = 0; if ((first = (t_sym **)malloc(sizeof(t_sym *))) == NULL || (current = (t_sym *)malloc(sizeof(t_sym))) == NULL) return (NULL); *first = current; stringtable = (void *)ptr + stroff; while (current) { if (array[i++].n_type & N_STAB) continue; i--; set_sym_values(array[i], stringtable, &current); current->next = (++i < nsyms) ? ((t_sym *)ft_memalloc(sizeof(t_sym))) : (NULL); current = current->next; } return (first); }
1cca754bc260c21f201ba12ced3a9c3fef17799b
53170056ca2a6cfaf465ec852767a4336a287ea5
/C/13.read_line.c
db72329f868a4fb467c97e5433655eec3a59021e
[]
no_license
zoffixznet/c-practice
c0f5248404beb2df48aacf47e4568e3ab768cf92
f9b0083a930d88269aba564cdfa233c74615ada1
refs/heads/master
2021-05-23T05:44:54.736772
2018-04-16T01:25:18
2018-04-16T01:25:18
94,892,781
1
0
null
null
null
null
UTF-8
C
false
false
615
c
#include <stdio.h> #define MAX 100 int read_line(char *str, int n); int main(void) { char str[MAX]; printf("Enter a fucking string: "); printf("You entered fucking %d-char string: %s\n", read_line(str, MAX), str); return 0; } int read_line(char *str, int n) { int ch; int count = 0; n--; while ((ch = getchar()) != '\n') if (count < n) str[count++] = ch; str[count] = '\0'; return count; } // void read_line (char *str, int max) { // while (--max && (*str = getchar()) != '\n' && *str != EOF) // str++; // *str = '\0'; // }
5cc3e9e43f4b6e9b783cdf4f7876976d5144a5eb
af4829ed94f4fbbecd79a7b80ddc88fec5f66b40
/0x0D-structures_typedef/dog.h
7012452636d3f9518a194108b24dbc94fe50511b
[]
no_license
HermesBoots/holbertonschool-low_level_programming
c9c9eee5685ef65e83957e9fb15be537bbd37567
9dcd6221728609673891a7e6553820629eaccb85
refs/heads/master
2020-04-21T08:24:09.132105
2019-08-29T23:46:42
2019-08-29T23:46:42
169,418,287
1
2
null
null
null
null
UTF-8
C
false
false
421
h
#ifndef _DOG_H_ #define _DOG_H_ /** * struct dog - represents a dog * @name: dog name * @age: dog age * @owner: dog owner */ struct dog { char *name; float age; char *owner; }; typedef struct dog dog_t; void init_dog(struct dog *d, char *name, float age, char *owner); void print_dog(struct dog *d); char *_strdup(char *str); dog_t *new_dog(char *name, float age, char *owner); void free_dog(dog_t *d); #endif
40854ef950cc80ae875719c94d8326c59113e7ce
7a440ed4cbbbfaeff9cad15ba809d14d3a3af79a
/0x06-pointers_arrays_strings/103-main.c
8a866aa163222459f9f054885cde4ae50b3cc6d1
[]
no_license
ermiast/alx-low_level_programming
accdd6a555d782101d34bdbf754cc57103728240
206d43644cee3f062f8e757ce8d0b1a49eb1e628
refs/heads/main
2023-05-05T03:18:28.271288
2021-04-26T17:10:18
2021-04-26T17:10:18
335,729,662
0
0
null
null
null
null
UTF-8
C
false
false
458
c
#include "holberton.h" #include <stdio.h> /** * main - check the code for Holberton School students. * * Return: Always 0. */ int main(void) { char buffer[] = "This is a string!\0And this is the rest of the #buffer :)\1\2\3\4\5\6\7#cisfun\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x20\x21\x34\x56#pointersarefun #infernumisfun\n"; printf("%s\n", buffer); printf("---------------------------------\n"); print_buffer(buffer, sizeof(buffer)); return (0); }
9da86b20522d2f67781cb787b219081f525d1087
c5ee390344aa72c730ca27eff709edc046081061
/nitan4/d/beijing/npc/dan/danM_2.c
b7eb9a713b2263caf1f77cbd1408c86ca742c745
[]
no_license
DoubleIce/Mud_NitanVersions
fb58143f4840c7a887b756215229ed4e0a5e62d9
2ab430649b29a611008b7cc765b4500b2702841a
refs/heads/master
2021-05-14T10:05:48.157950
2018-01-23T01:40:38
2018-01-23T01:40:38
116,339,674
0
0
null
null
null
null
GB18030
C
false
false
1,670
c
#include <ansi.h> inherit COMBINED_ITEM; void create() { set_name(WHT "龟苓丹" NOR, ({"guiling dan", "dan"})); if (clonep()) set_default_object(__FILE__); else { set("base_unit", "粒"); set("no_drop", "这样东西不能离开你。\n"); set("no_sell", "这样东西不能离开你。\n"); set("no_put", "这样东西不能放在那儿。\n"); set("no_get", "这样东西不能离开那儿。\n"); set("no_steal", "这样东西不能离开那儿。\n"); set("no_beg", "这样东西不能离开那儿。\n"); set("base_value", 0); set("only_do_effect", 2); } setup(); set_amount(1); } int do_effect(object me) { mapping my; if (time() - me->query_temp("last_eat/dan(M)") < 400) { write("你刚服用过药,需药性发挥完效用以后才能继续服用。\n"); return 1; } my = me->query_entire_dbase(); // me->set_temp("last_eat/dan(M)", time()); if (me->improve_neili(2)) message_vision(WHT "$N" WHT "吃下一粒龟苓丹,感到内力又雄厚了一些。\n" NOR, me); else message_vision(WHT "$N" WHT "吃下一粒龟苓丹,感觉好象没什么效果。\n" NOR, me); // me->start_busy(6); me->start_busy(1); add_amount(-1); if (query_amount() < 1) destruct(this_object()); return 1; } void owner_is_killed() { destruct(this_object()); }
8e623362913a991922e7bed0de5b3c109525dc02
16387a9f6a3bebd13ff1008510f06e6d6d3e631d
/release_number/01.20.03/lib/libutil/memblock.c
0026ec3205afb28a09c454e1a6eef07417d5dc6e
[]
no_license
joelnb/xmlrpc-c
2f54d5b417f8567863fd0778cb858c77fd94237c
742687b2d131fed7a2901d9b4981a9944017c80f
refs/heads/master
2022-09-25T22:28:19.886435
2022-08-22T18:39:39
2022-08-22T18:39:39
125,525,941
1
0
null
null
null
null
UTF-8
C
false
false
5,966
c
/* Copyright information is at end of file */ #include "xmlrpc_config.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include "mallocvar.h" #include "xmlrpc-c/util_int.h" #include "xmlrpc-c/util.h" #ifdef EFENCE /* when looking for corruption don't allocate extra slop */ #define BLOCK_ALLOC_MIN (1) #else #define BLOCK_ALLOC_MIN (16) #endif #define BLOCK_ALLOC_MAX (128 * 1024 * 1024) xmlrpc_mem_block * xmlrpc_mem_block_new(xmlrpc_env * const envP, size_t const size) { xmlrpc_mem_block * block; XMLRPC_ASSERT_ENV_OK(envP); MALLOCVAR(block); if (block == NULL) xmlrpc_faultf(envP, "Can't allocate memory block"); else { xmlrpc_mem_block_init(envP, block, size); if (envP->fault_occurred) { free(block); block = NULL; } } return block; } /* Destroy an existing xmlrpc_mem_block, and everything it contains. */ void xmlrpc_mem_block_free(xmlrpc_mem_block * const blockP) { XMLRPC_ASSERT(blockP != NULL); XMLRPC_ASSERT(blockP->_block != NULL); xmlrpc_mem_block_clean(blockP); free(blockP); } /* Initialize the contents of the provided xmlrpc_mem_block. */ void xmlrpc_mem_block_init(xmlrpc_env * const envP, xmlrpc_mem_block * const blockP, size_t const size) { XMLRPC_ASSERT_ENV_OK(envP); XMLRPC_ASSERT(blockP != NULL); blockP->_size = size; if (size < BLOCK_ALLOC_MIN) blockP->_allocated = BLOCK_ALLOC_MIN; else blockP->_allocated = size; blockP->_block = (void*) malloc(blockP->_allocated); if (!blockP->_block) xmlrpc_faultf(envP, "Can't allocate %u-byte memory block", blockP->_allocated); } /* Deallocate the contents of the provided xmlrpc_mem_block, but not the block itself. */ void xmlrpc_mem_block_clean(xmlrpc_mem_block * const blockP) { XMLRPC_ASSERT(blockP != NULL); XMLRPC_ASSERT(blockP->_block != NULL); free(blockP->_block); blockP->_block = XMLRPC_BAD_POINTER; } /* Get the size of the xmlrpc_mem_block. */ size_t xmlrpc_mem_block_size(const xmlrpc_mem_block * const blockP) { XMLRPC_ASSERT(blockP != NULL); return blockP->_size; } /* Get the contents of the xmlrpc_mem_block. */ void * xmlrpc_mem_block_contents(const xmlrpc_mem_block * const blockP) { XMLRPC_ASSERT(blockP != NULL); return blockP->_block; } /* Resize an xmlrpc_mem_block, preserving as much of the contents as possible. */ void xmlrpc_mem_block_resize (xmlrpc_env * const envP, xmlrpc_mem_block * const blockP, size_t const size) { size_t proposed_alloc; void* new_block; XMLRPC_ASSERT_ENV_OK(envP); XMLRPC_ASSERT(blockP != NULL); /* Check to see if we already have enough space. Maybe we'll get lucky. */ if (size <= blockP->_allocated) { blockP->_size = size; return; } /* Calculate a new allocation size. */ #ifdef EFENCE proposed_alloc = size; #else proposed_alloc = blockP->_allocated; while (proposed_alloc < size && proposed_alloc <= BLOCK_ALLOC_MAX) proposed_alloc *= 2; #endif /* DEBUG_MEM_ERRORS */ if (proposed_alloc > BLOCK_ALLOC_MAX) XMLRPC_FAIL(envP, XMLRPC_INTERNAL_ERROR, "Memory block too large"); /* Allocate our new memory block. */ new_block = (void*) malloc(proposed_alloc); XMLRPC_FAIL_IF_NULL(new_block, envP, XMLRPC_INTERNAL_ERROR, "Can't resize memory block"); /* Copy over our data and update the xmlrpc_mem_block struct. */ memcpy(new_block, blockP->_block, blockP->_size); free(blockP->_block); blockP->_block = new_block; blockP->_size = size; blockP->_allocated = proposed_alloc; cleanup: return; } void xmlrpc_mem_block_append(xmlrpc_env * const envP, xmlrpc_mem_block * const blockP, const void * const data, size_t const len) { int size; XMLRPC_ASSERT_ENV_OK(envP); XMLRPC_ASSERT(blockP != NULL); size = blockP->_size; xmlrpc_mem_block_resize(envP, blockP, size + len); XMLRPC_FAIL_IF_FAULT(envP); memcpy(((unsigned char*) blockP->_block) + size, data, len); cleanup: return; } /* Copyright (C) 2001 by First Peer, 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: ** 1. Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** 2. Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** 3. The name of the author may not be used to endorse or promote products ** derived from this software without specific prior written permission. ** ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */
[ "giraffedata@98333e67-4a24-44d7-a75c-e53540dd3050" ]
giraffedata@98333e67-4a24-44d7-a75c-e53540dd3050
ab98b833ac77cf7f86c95941a034190922505a61
24d856d98c85a319d53be2768ccc176a50873fa3
/eglibc-2.15/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
bc8a0b0e3aef0fcde88b5328eedafe685c690960
[ "LGPL-2.1-only", "GPL-2.0-only", "LicenseRef-scancode-inner-net-2.0", "BSD-3-Clause", "LGPL-2.1-or-later", "HPND", "LicenseRef-scancode-other-copyleft", "CMU-Mach", "LicenseRef-scancode-other-permissive", "BSD-2-Clause" ]
permissive
dozenow/shortcut
a4803b59c95e72a01d73bb30acaae45cf76b0367
b140082a44c58f05af3495259c1beaaa9a63560b
refs/heads/jumpstart-php
2020-06-29T11:41:05.842760
2019-03-28T17:28:56
2019-03-28T17:28:56
200,405,626
2
2
BSD-2-Clause
2019-08-03T19:45:44
2019-08-03T17:57:58
C
UTF-8
C
false
false
5,136
h
/* Copyright (C) 1997, 2000, 2002, 2003, 2004, 2006, 2008, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson <[email protected]>, 1997. The GNU C 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. The GNU C 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. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _LINUX_SPARC64_SYSDEP_H #define _LINUX_SPARC64_SYSDEP_H 1 #include <sysdeps/unix/sparc/sysdep.h> #ifdef IS_IN_rtld # include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */ #endif #include <tls.h> #undef SYS_ify #define SYS_ify(syscall_name) __NR_##syscall_name /* This is a kludge to make syscalls.list find these under the names pread and pwrite, since some kernel headers define those names and some define the *64 names for the same system calls. */ #if !defined __NR_pread && defined __NR_pread64 # define __NR_pread __NR_pread64 #endif #if !defined __NR_pwrite && defined __NR_pwrite64 # define __NR_pwrite __NR_pwrite64 #endif #ifdef __ASSEMBLER__ #define LOADSYSCALL(x) mov __NR_##x, %g1 /* Linux/SPARC uses a different trap number */ #undef PSEUDO #undef PSEUDO_NOERRNO #undef PSEUDO_ERRVAL #undef PSEUDO_END #undef ENTRY #undef END #define ENTRY(name) \ .align 4; \ .global C_SYMBOL_NAME(name); \ .type name, @function; \ C_LABEL(name) \ cfi_startproc; #define END(name) \ cfi_endproc; \ .size name, . - name #define PSEUDO(name, syscall_name, args) \ .text; \ ENTRY(name); \ LOADSYSCALL(syscall_name); \ ta 0x6d; \ bcc,pt %xcc, 1f; \ nop; \ SYSCALL_ERROR_HANDLER \ 1: #define PSEUDO_NOERRNO(name, syscall_name, args)\ .text; \ ENTRY(name); \ LOADSYSCALL(syscall_name); \ ta 0x6d; #define PSEUDO_ERRVAL(name, syscall_name, args) \ .text; \ ENTRY(name); \ LOADSYSCALL(syscall_name); \ ta 0x6d; #define PSEUDO_END(name) \ END(name) #ifndef PIC # define SYSCALL_ERROR_HANDLER \ mov %o7, %g1; \ call __syscall_error; \ mov %g1, %o7; #else # if RTLD_PRIVATE_ERRNO # define SYSCALL_ERROR_HANDLER \ 0: SETUP_PIC_REG(o2,g1) \ sethi %hi(rtld_errno), %g1; \ or %g1, %lo(rtld_errno), %g1; \ ldx [%o2 + %g1], %g1; \ st %o0, [%g1]; \ jmp %o7 + 8; \ mov -1, %o0; # elif defined _LIBC_REENTRANT # ifndef NOT_IN_libc # define SYSCALL_ERROR_ERRNO __libc_errno # else # define SYSCALL_ERROR_ERRNO errno # endif # define SYSCALL_ERROR_HANDLER \ 0: SETUP_PIC_REG(o2,g1) \ sethi %tie_hi22(SYSCALL_ERROR_ERRNO), %g1; \ add %g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1; \ ldx [%o2 + %g1], %g1, %tie_ldx(SYSCALL_ERROR_ERRNO);\ st %o0, [%g7 + %g1]; \ jmp %o7 + 8; \ mov -1, %o0; # else # define SYSCALL_ERROR_HANDLER \ 0: SETUP_PIC_REG(o2,g1) \ sethi %hi(errno), %g1; \ or %g1, %lo(errno), %g1; \ ldx [%o2 + %g1], %g1; \ st %o0, [%g1]; \ jmp %o7 + 8; \ mov -1, %o0; # endif /* _LIBC_REENTRANT */ #endif /* PIC */ #else /* __ASSEMBLER__ */ #define __SYSCALL_STRING \ "ta 0x6d;" \ "bcc,pt %%xcc, 1f;" \ " mov 0, %%g1;" \ "sub %%g0, %%o0, %%o0;" \ "mov 1, %%g1;" \ "1:" #define __SYSCALL_CLOBBERS \ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \ "f32", "f34", "f36", "f38", "f40", "f42", "f44", "f46", \ "f48", "f50", "f52", "f54", "f56", "f58", "f60", "f62", \ "cc", "memory" #include <sysdeps/unix/sysv/linux/sparc/sysdep.h> #endif /* __ASSEMBLER__ */ /* This is the offset from the %sp to the backing store above the register windows. So if you poke stack memory directly you add this. */ #define STACK_BIAS 2047 /* Pointer mangling support. */ #if defined NOT_IN_libc && defined IS_IN_rtld /* We cannot use the thread descriptor because in ld.so we use setjmp earlier than the descriptor is initialized. */ #else # ifdef __ASSEMBLER__ # define PTR_MANGLE(dreg, reg, tmpreg) \ ldx [%g7 + POINTER_GUARD], tmpreg; \ xor reg, tmpreg, dreg # define PTR_DEMANGLE(dreg, reg, tmpreg) PTR_MANGLE (dreg, reg, tmpreg) # define PTR_MANGLE2(dreg, reg, tmpreg) \ xor reg, tmpreg, dreg # define PTR_DEMANGLE2(dreg, reg, tmpreg) PTR_MANGLE2 (dreg, reg, tmpreg) # else # define PTR_MANGLE(var) \ (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) # define PTR_DEMANGLE(var) PTR_MANGLE (var) # endif #endif #endif /* linux/sparc64/sysdep.h */
[ "jflinn" ]
jflinn
29faedb175d30cd93ace52587ab2cdb415ef740c
932cdeaf7316ea9b287532c825fca0d69abe1a2b
/cfs/cfe/modules/msg/fsw/src/cfe_msg_msgid_v1.c
fe8ef8156160389d9183ccfe7e05d9c63541f7f2
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Epictetusminimus/pi-sat
52bf82545e9bdc97f805ba3f65966e24496f1fe6
d9b38caa75a8ae53576cfd8c38a62678a22d0875
refs/heads/main
2023-07-02T05:53:45.420316
2021-08-09T16:53:07
2021-08-09T16:53:07
null
0
0
null
null
null
null
UTF-8
C
false
false
2,403
c
/* ** GSC-18128-1, "Core Flight Executive Version 6.7" ** ** Copyright (c) 2006-2019 United States Government as represented by ** the Administrator of the National Aeronautics and Space Administration. ** All Rights Reserved. ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ /****************************************************************************** * Message id access functions, cFS version 1 implementation */ #include "cfe_msg.h" #include "cfe_msg_priv.h" #include "cfe_error.h" #include "cfe_platform_cfg.h" #include "cfe_sb.h" /****************************************************************************** * Get message id - See API and header file for details * cFS default version 1 implementation using CCSDS headers * * Message Id = CCSDS Stream ID (in local endian) */ int32 CFE_MSG_GetMsgId(const CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t *MsgId) { CFE_SB_MsgId_Atom_t msgidval; if (MsgPtr == NULL || MsgId == NULL) { return CFE_MSG_BAD_ARGUMENT; } msgidval = (MsgPtr->CCSDS.Pri.StreamId[0] << 8) + MsgPtr->CCSDS.Pri.StreamId[1]; *MsgId = CFE_SB_ValueToMsgId(msgidval); return CFE_SUCCESS; } /****************************************************************************** * Set message id - See API and header file for details * cFS default version 1 implementations using CCSDS headers * * CCSDS Stream ID = Message Id converted to big endian */ int32 CFE_MSG_SetMsgId(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId) { CFE_SB_MsgId_Atom_t msgidval = CFE_SB_MsgIdToValue(MsgId); if (MsgPtr == NULL || msgidval > CFE_PLATFORM_SB_HIGHEST_VALID_MSGID) { return CFE_MSG_BAD_ARGUMENT; } /* Shift and mask bytes to be endian agnostic */ MsgPtr->CCSDS.Pri.StreamId[0] = (msgidval >> 8) & 0xFF; MsgPtr->CCSDS.Pri.StreamId[1] = msgidval & 0xFF; return CFE_SUCCESS; }
a9c045d2a3d3ba35190f4eb57da0d60d087675b0
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/drivers/net/ethernet/mellanox/mlx5/core/extr_en_fs.c_mlx5e_create_inner_ttc_table.c
7dcf73b9509262c077fac06b12ace09f5d33fee2
[]
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,807
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 */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct ttc_params {int /*<<< orphan*/ ft_attr; } ; struct mlx5e_flow_table {int /*<<< orphan*/ * t; } ; struct mlx5e_ttc_table {struct mlx5e_flow_table ft; } ; struct TYPE_2__ {int /*<<< orphan*/ ns; } ; struct mlx5e_priv {TYPE_1__ fs; int /*<<< orphan*/ mdev; } ; /* Variables and functions */ scalar_t__ IS_ERR (int /*<<< orphan*/ *) ; int PTR_ERR (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * mlx5_create_flow_table (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int mlx5e_create_inner_ttc_table_groups (struct mlx5e_ttc_table*) ; int /*<<< orphan*/ mlx5e_destroy_flow_table (struct mlx5e_flow_table*) ; int mlx5e_generate_inner_ttc_table_rules (struct mlx5e_priv*,struct ttc_params*,struct mlx5e_ttc_table*) ; int /*<<< orphan*/ mlx5e_tunnel_inner_ft_supported (int /*<<< orphan*/ ) ; int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params, struct mlx5e_ttc_table *ttc) { struct mlx5e_flow_table *ft = &ttc->ft; int err; if (!mlx5e_tunnel_inner_ft_supported(priv->mdev)) return 0; ft->t = mlx5_create_flow_table(priv->fs.ns, &params->ft_attr); if (IS_ERR(ft->t)) { err = PTR_ERR(ft->t); ft->t = NULL; return err; } err = mlx5e_create_inner_ttc_table_groups(ttc); if (err) goto err; err = mlx5e_generate_inner_ttc_table_rules(priv, params, ttc); if (err) goto err; return 0; err: mlx5e_destroy_flow_table(ft); return err; }
ad6195e05ec589f7531450392b44d0e9b7647d18
65ae9292365c4f220e7fa3e08377d08353a19f0d
/pong/source/gfx/shapes.h
493b127bd8b924669ad7b2bcdfb9d88eafb68695
[]
no_license
nonameentername/gba-games
6e2fdf121beb01371f7a6e96a9f7713e1e97cac2
91e68cae6acac42d939c963ee7379403aef6bfd8
refs/heads/master
2021-01-10T22:00:00.330076
2017-02-23T06:57:13
2017-02-23T07:28:50
8,000,764
3
0
null
null
null
null
UTF-8
C
false
false
5,514
h
/**********************************************\ * shapes.h * * by dovotos pcx->gba program * /**********************************************/ #define shapes_WIDTH 8 #define shapes_HEIGHT 64 const u16 shapesData[] = { 0x0000, 0x9393, 0x9393, 0x0000, 0x9300, 0x0606, 0x0606, 0x0093, 0x0693, 0x4040, 0x4040, 0x9306, 0x0693, 0x2D40, 0x4040, 0x9306, 0x0693, 0x4040, 0x4040, 0x9306, 0x0693, 0x4040, 0x4040, 0x9306, 0x9300, 0x0606, 0x0606, 0x0093, 0x0000, 0x9393, 0x9393, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0xFFFF, 0xFFFF, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0x0000, 0x0000, 0x0000, 0x0000, 0xFF00, 0xFFFF, 0xFFFF, 0x0000, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0xFFFF, 0xFFFF, 0x0000, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFF00, 0xFFFF, 0x00FF, 0x0000, 0xFFFF, 0x0000, 0x0000, 0xFF00, 0x00FF, 0x0000, 0x0000, 0xFF00, 0x00FF, 0x0000, 0x0000, 0xFF00, 0x00FF, 0x0000, 0x0000, 0x0000, 0xFFFF, 0x0000, 0x0000, 0x0000, 0xFF00, 0xFFFF, 0x00FF, 0x0000, 0x0000, 0x0000, 0x0000, 0xFF00, 0xFFFF, 0x00FF, 0x0000, 0xFF00, 0x00FF, 0xFFFF, 0x0000, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFFFF, 0x0000, 0xFF00, 0xFFFF, 0x00FF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFF00, 0xFFFF, 0xFFFF, 0x00FF, 0xFF00, 0x00FF, 0x0000, 0x0000, 0xFF00, 0x00FF, 0x0000, 0x0000, 0xFF00, 0xFFFF, 0x00FF, 0x0000, 0xFF00, 0x00FF, 0x0000, 0x0000, 0xFF00, 0x00FF, 0x0000, 0x0000, 0xFF00, 0xFFFF, 0xFFFF, 0x00FF, 0x0000, 0x0000, 0x0000, 0x0000, 0xFF00, 0xFFFF, 0xFFFF, 0x00FF, 0xFF00, 0x00FF, 0x0000, 0x0000, 0xFF00, 0x00FF, 0x0000, 0x0000, 0xFF00, 0xFFFF, 0x00FF, 0x0000, 0xFF00, 0x00FF, 0x0000, 0x0000, 0xFF00, 0x00FF, 0x0000, 0x0000, 0xFF00, 0x00FF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0x0000, 0x0000, 0xFF00, 0x00FF, 0xFFFF, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0xFF00, 0x00FF, 0x0000, 0xFFFF, 0xFFFF, 0x00FF, 0x0000, 0x0000, 0x0000, 0x0000,}; const u16 shapesPalette[] = { 0x0000, 0x7FE0, 0x7C1F, 0x7C00, 0x03FF, 0x03E0, 0x001F, 0x4210, 0x5294, 0x7BFF, 0x28E5, 0x00E5, 0x7C65, 0x5465, 0x2865, 0x0065, 0x7C05, 0x5405, 0x2805, 0x0005, 0x57E0, 0x2BE0, 0x7F60, 0x5760, 0x2B60, 0x0360, 0x7EE0, 0x56E0, 0x2AE0, 0x02E0, 0x7E60, 0x5660, 0x2A60, 0x0260, 0x7DE0, 0x55E0, 0x29E0, 0x01E0, 0x7FF9, 0x7FF3, 0x7FEC, 0x7FE6, 0x7F3F, 0x7F39, 0x57FF, 0x2BFF, 0x7F7F, 0x577F, 0x2B7F, 0x037F, 0x7EFF, 0x56FF, 0x2AFF, 0x02FF, 0x7E7F, 0x567F, 0x2A7F, 0x027F, 0x7DFF, 0x55FF, 0x29FF, 0x01FF, 0x7D7F, 0x557F, 0x297F, 0x017F, 0x7CFF, 0x54FF, 0x28FF, 0x00FF, 0x7C7F, 0x547F, 0x287F, 0x007F, 0x541F, 0x281F, 0x7FFA, 0x57FA, 0x2BFA, 0x03FA, 0x7F7A, 0x577A, 0x2B7A, 0x037A, 0x7EFA, 0x56FA, 0x2AFA, 0x02FA, 0x7E7A, 0x567A, 0x2A7A, 0x027A, 0x7DFA, 0x55FA, 0x29FA, 0x01FA, 0x7D7A, 0x557A, 0x297A, 0x017A, 0x7CFA, 0x54FA, 0x28FA, 0x00FA, 0x7C7A, 0x547A, 0x287A, 0x007A, 0x7C1A, 0x541A, 0x281A, 0x001A, 0x7FF5, 0x57F5, 0x2BF5, 0x03F5, 0x7F75, 0x5775, 0x2B75, 0x0375, 0x7EF5, 0x56F5, 0x2AF5, 0x02F5, 0x7E75, 0x5675, 0x2A75, 0x0275, 0x7DF5, 0x55F5, 0x29F5, 0x01F5, 0x7D75, 0x5575, 0x2975, 0x0175, 0x7CF5, 0x54F5, 0x28F5, 0x00F5, 0x7C75, 0x5475, 0x2875, 0x0075, 0x7C15, 0x5415, 0x2815, 0x0015, 0x7FEF, 0x57EF, 0x2BEF, 0x03EF, 0x7F6F, 0x576F, 0x2B6F, 0x036F, 0x7EEF, 0x56EF, 0x2AEF, 0x02EF, 0x7E6F, 0x566F, 0x2A6F, 0x026F, 0x7DEF, 0x55EF, 0x29EF, 0x01EF, 0x7D6F, 0x556F, 0x296F, 0x016F, 0x7CEF, 0x54EF, 0x28EF, 0x00EF, 0x7C6F, 0x546F, 0x286F, 0x006F, 0x7C0F, 0x540F, 0x280F, 0x000F, 0x7FEA, 0x57EA, 0x2BEA, 0x03EA, 0x7F6A, 0x576A, 0x2B6A, 0x036A, 0x7EEA, 0x56EA, 0x2AEA, 0x02EA, 0x7E6A, 0x566A, 0x2A6A, 0x026A, 0x7DEA, 0x55EA, 0x29EA, 0x01EA, 0x7D6A, 0x556A, 0x296A, 0x016A, 0x7CEA, 0x54EA, 0x28EA, 0x00EA, 0x7C6A, 0x546A, 0x286A, 0x006A, 0x7C0A, 0x540A, 0x280A, 0x000A, 0x7FE5, 0x57E5, 0x2BE5, 0x03E5, 0x7F65, 0x5765, 0x2B65, 0x0365, 0x7EE5, 0x56E5, 0x2AE5, 0x02E5, 0x7E65, 0x5665, 0x2A65, 0x0265, 0x7DE5, 0x55E5, 0x29E5, 0x01E5, 0x7D65, 0x5565, 0x2965, 0x0165, 0x7CE5, 0x54E5, 0x7B34, 0x6378, 0x4210, 0x4200, 0x4010, 0x4000, 0x0210, 0x0200, 0x0010, 0x7FFF,};
10f1adfcd73a897a6f62fbc0bc5db1424c816d82
c776476e9d06b3779d744641e758ac3a2c15cddc
/examples/litmus/c/c-litmus-HMC-Nidhugg/MP+dmb.sypl+po.c
dcfc434aca1289b8d0eadcf38d0ab07304f7a911
[]
no_license
ashutosh0gupta/llvm_bmc
aaac7961c723ba6f7ffd77a39559e0e52432eade
0287c4fb180244e6b3c599a9902507f05c8a7234
refs/heads/master
2023-08-02T17:14:06.178723
2023-07-31T10:46:53
2023-07-31T10:46:53
143,100,825
3
4
null
2023-05-25T05:50:55
2018-08-01T03:47:00
C++
UTF-8
C
false
false
1,116
c
/* Copyright (C) 2023 ARM-CBMC * This benchmark is part of ARM-CBMC */ #include <assert.h> #include <pthread.h> #include <stdatomic.h> atomic_int vars[2]; int atom_1_X0_1; int atom_1_X2_0; void *t0(void *arg){ label_1:; atomic_store_explicit(&vars[0], 1, memory_order_relaxed); atomic_thread_fence(memory_order_seq_cst); atomic_store_explicit(&vars[1], 1, memory_order_release); return NULL; } void *t1(void *arg){ label_2:; int v3_W0 = atomic_load_explicit(&vars[1], memory_order_relaxed); int v6_W2 = atomic_load_explicit(&vars[0], memory_order_relaxed); int v10 = (v3_W0 == 1); atom_1_X0_1 = v10; int v11 = (v6_W2 == 0); atom_1_X2_0 = v11; return NULL; } int main(int argc, char *argv[]){ pthread_t thr0; pthread_t thr1; atomic_init(&vars[1], 0); atomic_init(&vars[0], 0); atom_1_X0_1 = 0; atom_1_X2_0 = 0; pthread_create(&thr0, NULL, t0, NULL); pthread_create(&thr1, NULL, t1, NULL); pthread_join(thr0, NULL); pthread_join(thr1, NULL); int v7 = atom_1_X0_1; int v8 = atom_1_X2_0; int v9_conj = v7 & v8; if (v9_conj == 1) assert(0); return 0; }
fdf7e4feadf536b1e62533c0f5c76c4c91bc681c
0c5d3b088080577388f5766431487534f93a2c40
/Github-Projects-Origin/linux-master/arch/arm/mm/nommu.c.bak.c
257efcd98d6bbd8a367c8a71cd6831e6aeadbe9d
[]
no_license
zhiyuanjia/WoBench
878255ce45e76ef57f88743c7f43acdfa59e93e7
6b337780cbd598de98fc0eabd19efaf1a01b6012
refs/heads/master
2021-09-23T03:12:08.091319
2018-06-14T10:17:59
2018-06-14T10:17:59
null
0
0
null
null
null
null
UTF-8
C
false
false
5,452
c
#include <assert.h> #include <string.h> #define INCLUDEMAIN /* * linux/arch/arm/mm/nommu.c * * ARM uCLinux supporting functions. */ #include <linux/module.h> #include <linux/mm.h> #include <linux/pagemap.h> #include <linux/io.h> #include <linux/memblock.h> #include <linux/kernel.h> #include <asm/cacheflush.h> #include <asm/cp15.h> #include <asm/sections.h> #include <asm/page.h> #include <asm/setup.h> #include <asm/traps.h> #include <asm/mach/arch.h> #include <asm/cputype.h> #include <asm/mpu.h> #include <asm/procinfo.h> #include "mm.h" unsigned long vectors_base; #ifdef CONFIG_ARM_MPU struct mpu_rgn_info mpu_rgn_info; #endif #ifdef CONFIG_CPU_CP15 #ifdef CONFIG_CPU_HIGH_VECTOR unsigned long setup_vectors_base(void) { unsigned long reg = get_cr(); set_cr(reg | CR_V); return 0xffff0000; } #else /* CONFIG_CPU_HIGH_VECTOR */ /* Write exception base address to VBAR */ static inline void set_vbar(unsigned long val) { asm("mcr p15, 0, %0, c12, c0, 0" : : "r" (val) : "cc"); } /* * Security extensions, bits[7:4], permitted values, * 0b0000 - not implemented, 0b0001/0b0010 - implemented */ static inline bool security_extensions_enabled(void) { /* Check CPUID Identification Scheme before ID_PFR1 read */ if ((read_cpuid_id() & 0x000f0000) == 0x000f0000) return !!cpuid_feature_extract(CPUID_EXT_PFR1, 4); return 0; } unsigned long setup_vectors_base(void) { unsigned long base = 0, reg = get_cr(); set_cr(reg & ~CR_V); if (security_extensions_enabled()) { if (IS_ENABLED(CONFIG_REMAP_VECTORS_TO_RAM)) base = CONFIG_DRAM_BASE; set_vbar(base); } else if (IS_ENABLED(CONFIG_REMAP_VECTORS_TO_RAM)) { if (CONFIG_DRAM_BASE != 0) pr_err("Security extensions not enabled, vectors cannot be remapped to RAM, vectors base will be 0x00000000\n"); } return base; } #endif /* CONFIG_CPU_HIGH_VECTOR */ #endif /* CONFIG_CPU_CP15 */ void __init arm_mm_memblock_reserve(void) { #ifndef CONFIG_CPU_V7M vectors_base = IS_ENABLED(CONFIG_CPU_CP15) ? setup_vectors_base() : 0; /* * Register the exception vector page. * some architectures which the DRAM is the exception vector to trap, * alloc_page breaks with error, although it is not NULL, but "0." */ memblock_reserve(vectors_base, 2 * PAGE_SIZE); #else /* ifndef CONFIG_CPU_V7M */ /* * There is no dedicated vector page on V7-M. So nothing needs to be * reserved here. */ #endif /* * In any case, always ensure address 0 is never used as many things * get very confused if 0 is returned as a legitimate address. */ memblock_reserve(0, 1); } void __init adjust_lowmem_bounds(void) { phys_addr_t end; adjust_lowmem_bounds_mpu(); end = memblock_end_of_DRAM(); high_memory = __va(end - 1) + 1; memblock_set_current_limit(end); } /* * paging_init() sets up the page tables, initialises the zone memory * maps, and sets up the zero page, bad page and bad page tables. */ void __init paging_init(const struct machine_desc *mdesc) { early_trap_init((void *)vectors_base); mpu_setup(); bootmem_init(); } /* * We don't need to do anything here for nommu machines. */ void setup_mm_for_reboot(void) { } void flush_dcache_page(struct page *page) { __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE); } EXPORT_SYMBOL(flush_dcache_page); void flush_kernel_dcache_page(struct page *page) { __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE); } EXPORT_SYMBOL(flush_kernel_dcache_page); void copy_to_user_page(struct vm_area_struct *vma, struct page *page, unsigned long uaddr, void *dst, const void *src, unsigned long len) { memcpy(dst, src, len); if (vma->vm_flags & VM_EXEC) __cpuc_coherent_user_range(uaddr, uaddr + len); } void __iomem *__arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size, unsigned int mtype) { if (pfn >= (0x100000000ULL >> PAGE_SHIFT)) return NULL; return (void __iomem *) (offset + (pfn << PAGE_SHIFT)); } EXPORT_SYMBOL(__arm_ioremap_pfn); void __iomem *__arm_ioremap_caller(phys_addr_t phys_addr, size_t size, unsigned int mtype, void *caller) { return (void __iomem *)phys_addr; } void __iomem * (*arch_ioremap_caller)(phys_addr_t, size_t, unsigned int, void *); void __iomem *ioremap(resource_size_t res_cookie, size_t size) { return __arm_ioremap_caller(res_cookie, size, MT_DEVICE, __builtin_return_address(0)); } EXPORT_SYMBOL(ioremap); void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size) __alias(ioremap_cached); void __iomem *ioremap_cached(resource_size_t res_cookie, size_t size) { return __arm_ioremap_caller(res_cookie, size, MT_DEVICE_CACHED, __builtin_return_address(0)); } EXPORT_SYMBOL(ioremap_cache); EXPORT_SYMBOL(ioremap_cached); void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size) { return __arm_ioremap_caller(res_cookie, size, MT_DEVICE_WC, __builtin_return_address(0)); } EXPORT_SYMBOL(ioremap_wc); #ifdef CONFIG_PCI #include <asm/mach/map.h> void __iomem *pci_remap_cfgspace(resource_size_t res_cookie, size_t size) { return arch_ioremap_caller(res_cookie, size, MT_UNCACHED, __builtin_return_address(0)); } EXPORT_SYMBOL_GPL(pci_remap_cfgspace); #endif void *arch_memremap_wb(phys_addr_t phys_addr, size_t size) { return (void *)phys_addr; } void __iounmap(volatile void __iomem *addr) { } EXPORT_SYMBOL(__iounmap); void (*arch_iounmap)(volatile void __iomem *); void iounmap(volatile void __iomem *addr) { } EXPORT_SYMBOL(iounmap);
f22b2dfc8f52b7083f32e7094de2694386f1d379
a7d700d33d537f45bab2edcf11c3306784eb37fc
/framework_1209/test/ccs_amrb/decoder_homing_frame_test.c
52376b01a963139683b17ef2d82dd3607f671c94
[]
no_license
sunjiangbo/3730
bf1ceee1865a3ac35efff410b83de82973d5f2ab
f19c3b8f41367da36b52cd4303b9c4f100573206
refs/heads/master
2021-01-11T20:21:28.593933
2015-01-04T02:00:30
2015-01-04T02:00:30
null
0
0
null
null
null
null
UTF-8
C
false
false
1,545
c
/* ***************************************************************************** * * GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 * R99 Version 3.2.0 * REL-4 Version 4.0.0 * ***************************************************************************** */ #include "dhf_test.h" #include "table.h" /* ******************************************************************************** * * Function : decoder_homing_frame_test * In : input_frame[] one frame of encoded serial bits * mode mode type * Out : none * Calls : dhf_test * Tables : d_homing.tab * Compile Defines : none * Return : 0 input frame does not match the decoder homing frame * pattern * 1 input frame matches the decoder homing frame pattern * Information : The encoded serial bits are converted to all parameters * of the corresponding mode. These parameters are compared * with all parameters of the corresponding decoder homing frame. * ******************************************************************************** */ Word16 decoder_homing_frame_test (Word16 input_frame[], enum Mode mode) { /* perform test for COMPLETE parameter frame */ return dhf_test(input_frame, mode, prmno[mode]); }
[ "server@G520" ]
server@G520
a4c0803f1d60f9bd78f295ab7f9e5b6c0268ccee
901c2b012091810c6cb63e6afb92c7f3b3150996
/Classes/Native/mscorlib_System_Collections_Generic_Dictionary_2_ValueCollec_19.h
3f120fb5da92ed2f8b336f66b5c306af621acc10
[]
no_license
8BitRain/photoshphereSwift
83f4fce894b91d07ba95060d4e3b194cfc74b5aa
57ef01c804757d38bda5258f1d188db05ab1d563
refs/heads/master
2021-01-13T00:40:51.272582
2015-11-14T06:39:29
2015-11-14T06:39:29
46,164,639
0
1
null
null
null
null
UTF-8
C
false
false
614
h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> // System.Collections.Generic.Dictionary`2<System.Object,System.Boolean> struct Dictionary_2_t2283; #include "mscorlib_System_Object.h" // System.Collections.Generic.Dictionary`2/ValueCollection<System.Object,System.Boolean> struct ValueCollection_t2288 : public Object_t { // System.Collections.Generic.Dictionary`2<TKey,TValue> System.Collections.Generic.Dictionary`2/ValueCollection<System.Object,System.Boolean>::dictionary Dictionary_2_t2283 * ___dictionary_0; };
85049460c18c296014b5ebcf96701f50ec00c091
231028fd9a63e337f08773729654d0a54056f437
/pads/host/trace.c
333b82b7707c7471c6812420b1f43782aa5b3b55
[]
no_license
noelhunt/libblit
8a4f8ee18836473dfc0ad68a78372cdde0858866
59c0754a81b61e6547ec2860aba6fc9558a27476
refs/heads/master
2022-11-13T02:05:51.232802
2020-07-04T23:59:07
2020-07-04T23:59:07
272,360,025
0
0
null
null
null
null
UTF-8
C
false
false
4,131
c
#include <stdio.h> #include <string.h> #include <stdarg.h> #ifdef __linux__ #include <time.h> #endif #include <sys/types.h> #include <sys/stat.h> #define INTERVAL 60 #define STRSIZE 64 #define TABLESIZE 128 #define IDLECYCLE 1000 typedef int (*PFI)(const char*,...); static const char *ControlFile = "TRACE"; struct TraceRange { char srcfile[STRSIZE]; int from; int to; }; static int TableSize; static struct TraceRange RangeTable[TABLESIZE]; static struct TraceRange Context[16]; static int ContextIndex; static int Calls; static FILE *Tty = 0; static char Device[STRSIZE]; static void ifprintf( const char *fmt, ... ){ va_list ap; if( Tty ){ va_start(ap, fmt); vfprintf( Tty, fmt, ap ); fflush( Tty ); } } #define SEMANTICS(text) { ifprintf( "Error: %s\n", text ); return 1; } static int RangeCmd( char *cmd ){ struct TraceRange r, x; switch( sscanf( cmd, "range %s %d %d", r.srcfile, &r.from, &r.to ) ){ case 2: r.to = r.from; break; case 3: break; default: return 0; } if( r.to < r.from ) { x = r; x.from = r.to; x.to = r.from; r = x; } if( TableSize >= TABLESIZE ) SEMANTICS( "table overflow" ); RangeTable[TableSize++] = r; return 1; } static int DeviceCmd( char *cmd ){ if( sscanf( cmd, "device %s", Device ) != 1 ) return 0; return 1; } static void Commands(FILE *f){ char cmd[STRSIZE]; TableSize = 0; (void)strcpy( Device, "/dev/null" ); while( fgets( cmd, STRSIZE, f ) ){ ifprintf( "%s", cmd ); if( !RangeCmd(cmd) && !DeviceCmd(cmd) ) ifprintf( "Syntax Error\n" ); } } static void Update(){ static time_t modified; FILE *f; struct stat buf; char shcmd[STRSIZE]; ifprintf( "trace 831120\n" ); if( !(f = fopen( ControlFile, "r" ))) return; fstat( fileno(f), &buf ); if( buf.st_mtime == modified ){ fclose(f); return; } modified = buf.st_mtime; Commands(f); fclose(f); if( !strcmp( Device, "/dev/null") ){ if( Tty ) fclose( Tty ); Tty = 0; return; } if( !strcmp( Device, "stderr") ){ if( Tty && Tty != stderr ) fclose( Tty ); Tty = stderr; }else if( f = fopen( Device, "w" ) ){ if( Tty && Tty != stderr ) fclose( Tty ); Tty = f; }else ifprintf( "Cannot open: %s\n", Device ); } static void CheckTime(time_t t){ static time_t timestamp = 0; if( t > timestamp+INTERVAL ){ Update(); timestamp = t; } } static int ContextSelected(){ int i, line, from, to; for( i = 0; i < TableSize; ++i ) if( !strcmp(Context[ContextIndex].srcfile, RangeTable[i].srcfile) ){ line = Context[ContextIndex].from; from = RangeTable[i].from; to = RangeTable[i].to; if( line>=from && line<=to ) return 1; if( -line>=from && -line<=to ) return 0; } return 0; } int TraceArgs( const char *fmt, ... ){ va_list ap; char mmss[32]; time_t t = time(0L); --ContextIndex; CheckTime(t); if( !Tty || !ContextSelected() ) return 0; strcpy( mmss, &ctime(&t)[14] ); /* "Sun Sep 16 01:03:52 1973\n\0" */ mmss[5] = '\0'; fprintf(Tty, "%d %s %s:%d ", Calls, mmss, Context[ContextIndex].srcfile, Context[ContextIndex].from); va_start(ap, fmt); vfprintf( Tty, fmt, ap ); va_end(ap); fputc( '\n', Tty ); fflush( Tty ); return 1; } static int *watchloc = 0, watchval; PFI trace_ptr; PFI trace_fcn( const char *srcfile, int line ){ static int idle = 0; ++Calls; if( !Tty && idle ){ idle = (idle+1)%IDLECYCLE; return 0; } if( watchloc && watchval!=*watchloc ){ ifprintf("!!!!!!! %s:%d *%d: %d -> %d\n", srcfile, line, watchloc, watchval, *watchloc ); watchval = *watchloc; } strncpy( Context[ContextIndex].srcfile, srcfile, STRSIZE ); Context[ContextIndex].to = Context[ContextIndex].from = line; ++ContextIndex; return TraceArgs; } void watch(int *loc){ if( watchloc = loc ){ watchval = *watchloc; ifprintf("watching *%d = %d\n", watchloc, watchval ); } } #ifdef TRACEN static FILE *Tfp = stderr; void trace( const char *fmt, ... ){ va_list ap; char buf[256]; #undef TRACEBODY #ifdef TRACEBODY strcpy(buf, fmt); if( !Tfp ) Tfp = fopen("/tmp/pads.host", "w"); va_start(ap, fmt); vfprintf( Tfp, buf, ap ); va_end(ap); fputc( '\n', Tfp ); fflush( Tfp ); #endif } #endif
478aa2b2d5cee946a56f77199da4d2c185957a40
cbfbf9a2b0113763308a4cd579dffb4b6add0eb7
/ProjetsC42/Wolf3D/libft/ft_isdigit.c
18bd9ecdaf6483948cf4809b8e54fa4a03ddb808
[]
no_license
Derzouli/42
30550eaf3a48b4e46454f4a4fb4d8584a846eaab
f7ef25412bb5aa6c65b2c66578c7f98e4c4fc36e
refs/heads/master
2021-01-15T10:52:00.240238
2015-01-30T16:38:11
2015-01-30T16:38:11
null
0
0
null
null
null
null
UTF-8
C
false
false
978
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_isdigit.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: makoudad <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2013/11/20 14:40:30 by makoudad #+# #+# */ /* Updated: 2013/11/26 10:32:06 by makoudad ### ########.fr */ /* */ /* ************************************************************************** */ int ft_isdigit(int c) { if (c >= 48 && c <= 57) return (1); else return (0); }
f9fa3e77eb0d749e3a5f4c8daf9f41a3f99e09b3
99209e2a06ff8bd48528f885f57fe8eacc0665d4
/Legacy/1_AdvancedLinuxProgramming/2.1_Interaction-With-The-Execution-Environment/c.Using_getopt_long/src/main.c
2fdb060a109b6377618329ff3eb2a8ff8cc0c0c6
[]
no_license
pbraga88/study
6fac30990059b481c97e558b143b068eca92bc42
fcc1fb7e0d11e264dadb7296ab201fad9a9b0140
refs/heads/master
2023-08-17T04:25:40.506116
2023-08-15T10:53:37
2023-08-15T10:53:37
155,830,216
0
0
null
null
null
null
UTF-8
C
false
false
2,619
c
#include <getopt.h> #include <stdio.h> #include <stdlib.h> /* Program Name */ const char* program_name; /* Prints usage information for this program to STREAM (typically stdout or stderr), and exit the program with EXIT_CODE. Does not return. */ void print_usage(FILE* stream, int exit_code) { fprintf(stream, "Usage: %s options [ inputfile .... ]\n", program_name); fprintf(stream, " -h --help Display this usage information.\n" " -o --output filename Write output to file.\n" " -v --verbose Print verbose messages.\n"); exit(exit_code); } int main(int argc, char** argv) { int next_option; /* Uma string listando as opções short válidas */ /*const char* const short_options = "ho:v";*/ const char* short_options = "ho:v"; /* Uma matriz descrevendo as opções do tipo long válidas */ const struct option long_options[] ={ { "help", 0, NULL, 'h' }, { "output", 1, NULL, 'o' }, { "verbose", 0, NULL, 'v' }, { NULL, 0, NULL, 0 } /* Required at end of array. */ }; /* O nome do arquivo para receber o output. Ou NULL para standard ouput */ const char* output_filename = NULL; /* Mostrar verbose ou não */ int verbose = 0; /* Lembrar o nome do programa para incorporar nas mensagens. O nome do programa é guardado em argv[0] */ program_name = argv[0]; do{ next_option = getopt_long(argc, argv, short_options, long_options, NULL); switch(next_option) { case 'h': /* -h or --help */ /* User has requested usage information. Print it to standard output, and exit with exit code zero (normal termination).*/ print_usage(stdout, 0); case 'o': /* -o or --output */ /* This option takes an argument, the name of the output file. */ output_filename = optarg; break; case 'v': /* -v or --verbose */ verbose = 1; break; case '?': /*The user specified an invalid option. */ /* Print usage information to standard error, and exit with exit code one (indicating abnormal termination). */ print_usage(stderr, 1); case -1: /* Acabaram as opções */ break; default: /* Algo inesperado aconteceu */ abort(); } } while(next_option != -1); /* Done with options. OPTIND points to first nonoption argument. For demonstration purposes, print them if the verbose option was specified. */ if(verbose){ int i; printf("optind: %i\n",optind); printf("argc: %i\n", argc); for(i = optind; i <= argc; i++) printf("Argument: %s\n", argv[i-1]); printf("optarg: %s\n", output_filename); /* Also gives the argument. Seems to be more assertive */ } /* Implementar main program */ return 0; }
6d463e78ec62b95d8bb5548ffef23c97591a934c
5c255f911786e984286b1f7a4e6091a68419d049
/vulnerable_code/1e3123d7-04b7-44a4-abd3-501946cba648.c
e9b188923ec7d0083d9a58dacbd38b059b17873b
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944740
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
567
c
#include <string.h> #include <stdio.h> int main() { int i=4; int j=42; int k; int l; k = 53; l = 64; k = i/j; l = i/j; l = i-j; l = i-j; l = l-j; k = k-k*i; //variables /* START VULNERABILITY */ int a; int b[41]; int c[96]; a = 0; do { a--; /* START BUFFER SET */ *((int *)c + ( a - 1 )) = *((int *)b + ( a - 1 )); /* END BUFFER SET */ } while(( a - 1 ) > -1); /* END VULNERABILITY */ //random printf("%d%d\n",k,l); return 0; }
f2f266ea564948ec38cf876d938383dea749b4b8
24ae6d51b0a12d0671771a21fff35109f5f45148
/app/BCM53101 sdk-all-6.5.7/libs/phymod/chip/eagle_dpll/tier1/eagle2_cfg_seq.h
152cc0c7b607a7c23148d580a48dfcb0341eff46
[]
no_license
jiaotilizi/cross
e3b7d37856353a20c55f0ddf4c49aaf3c36c79fc
aa3c064fc0fe0494129ddd57114a6f538175b205
refs/heads/master
2020-04-08T14:47:57.798814
2018-11-03T09:16:17
2018-11-03T09:16:17
null
0
0
null
null
null
null
UTF-8
C
false
false
7,746
h
/*---------------------------------------------------------------------- * $Id: eagle_cfg_seq.h,v 1.1.2.2 Broadcom SDK $ * $Copyright: (c) 2016 Broadcom. * Broadcom Proprietary and Confidential. All rights reserved.$ * * Broadcom Corporation * Proprietary and Confidential information * All rights reserved * This source file is the property of Broadcom Corporation, and * may not be copied or distributed in any isomorphic form without the * prior written consent of Broadcom Corporation. *--------------------------------------------------------------------- * File : eagle_cfg_seq.h * Description: c functions implementing Tier1s for TEMod Serdes Driver *---------------------------------------------------------------------*/ /* * $Copyright: (c) 2014 Broadcom Corporation All Rights Reserved.$ * $Id$ */ #ifndef EAGLE_CFG_SEQ_H #define EAGLE_CFG_SEQ_H #include "common/srds_api_err_code.h" #include "eagle2_tsc2pll_enum.h" typedef struct { int8_t pll_pwrdn; int8_t tx_s_pwrdn; int8_t rx_s_pwrdn; } power_status_t; typedef struct { int8_t revid_model; int8_t revid_process; int8_t revid_bonding; int8_t revid_rev_number; int8_t revid_rev_letter; } eagle_rev_id0_t; typedef enum { TX = 0, Rx } tx_rx_t; typedef struct { int8_t revid_eee; int8_t revid_llp; int8_t revid_pir; int8_t revid_cl72; int8_t revid_micro; int8_t revid_mdio; int8_t revid_multiplicity; } eagle_rev_id1_t; typedef enum { EAGLE_PRBS_POLYNOMIAL_7 = 0, EAGLE_PRBS_POLYNOMIAL_9, EAGLE_PRBS_POLYNOMIAL_11, EAGLE_PRBS_POLYNOMIAL_15, EAGLE_PRBS_POLYNOMIAL_23, EAGLE_PRBS_POLYNOMIAL_31, EAGLE_PRBS_POLYNOMIAL_58, EAGLE_PRBS_POLYNOMIAL_TYPE_COUNT }eagle_prbs_polynomial_type_t; #define PATTERN_MAX_SIZE 8 err_code_t eagle2_tsc2pll_identify(const phymod_access_t *pa, eagle_rev_id0_t *rev_id0, eagle_rev_id1_t *rev_id1); err_code_t eagle2_tsc2pll_uc_active_set(const phymod_access_t *pa, uint32_t enable); /* set microcontroller active or not */ err_code_t eagle2_tsc2pll_uc_active_get(const phymod_access_t *pa, uint32_t *enable); /* get microcontroller active or not */ err_code_t eagle2_uc_reset(const phymod_access_t *pa, uint32_t enable); /* set dw8501 reset */ err_code_t eagle2_tsc2pll_prbs_tx_inv_data_get(const phymod_access_t *pa, uint32_t *inv_data); err_code_t eagle2_tsc2pll_prbs_rx_inv_data_get(const phymod_access_t *pa, uint32_t *inv_data); err_code_t eagle2_tsc2pll_prbs_tx_poly_get(const phymod_access_t *pa, eagle_prbs_polynomial_type_t *prbs_poly); err_code_t eagle2_tsc2pll_prbs_rx_poly_get(const phymod_access_t *pa, eagle_prbs_polynomial_type_t *prbs_poly); err_code_t eagle2_tsc2pll_prbs_tx_enable_get(const phymod_access_t *pa, uint32_t *enable); err_code_t eagle2_tsc2pll_prbs_rx_enable_get(const phymod_access_t *pa, uint32_t *enable); err_code_t eagle2_tsc2pll_pll_mode_set(const phymod_access_t *pa, int pll_mode); /* PLL divider set */ err_code_t eagle2_tsc2pll_core_soft_reset_release(const phymod_access_t *pa, uint32_t enable); /* release the pmd core soft reset */ err_code_t eagle2_tsc2pll_lane_soft_reset_release(const phymod_access_t *pa, uint32_t enable); /* release the pmd core soft reset */ err_code_t eagle2_tsc2pll_pram_firmware_enable(const phymod_access_t *pa, int enable); /* release the pmd core soft reset */ err_code_t eagle2_tsc2pll_pmd_force_signal_detect(const phymod_access_t *pa, int enable); /*force the signal detect */ err_code_t eagle2_tsc2pll_pmd_loopback_get(const phymod_access_t *pa, uint32_t *enable); err_code_t eagle2_tsc2pll_uc_init(const phymod_access_t *pa); err_code_t eagle2_tsc2pll_pram_flop_set(const phymod_access_t *pa, int value); err_code_t eagle2_tsc2pll_ucode_init( const phymod_access_t *pa ); err_code_t eagle2_tsc2pll_pmd_ln_h_rstb_pkill_override( const phymod_access_t *pa, uint16_t val); err_code_t eagle2_tsc2pll_pmd_cl72_enable_get(const phymod_access_t *pa, uint32_t *enable); err_code_t eagle2_tsc2pll_pmd_cl72_receiver_status(const phymod_access_t *pa, uint32_t *status); err_code_t eagle2_tsc2pll_tx_pi_control_get( const phymod_access_t *pa, int16_t *value); err_code_t eagle2_tsc2pll_tx_rx_polarity_set(const phymod_access_t *pa, uint32_t tx_pol, uint32_t rx_pol); err_code_t eagle2_tsc2pll_tx_rx_polarity_get(const phymod_access_t *pa, uint32_t *tx_pol, uint32_t *rx_pol); err_code_t eagle2_tsc2pll_force_tx_set_rst (const phymod_access_t *pa, uint32_t rst); err_code_t eagle2_tsc2pll_force_tx_get_rst (const phymod_access_t *pa, uint32_t *rst); err_code_t eagle2_tsc2pll_force_rx_set_rst (const phymod_access_t *pa, uint32_t rst); err_code_t eagle2_tsc2pll_force_rx_get_rst (const phymod_access_t *pa, uint32_t *rst); err_code_t eagle2_tsc2pll_pll_mode_get(const phymod_access_t *pa, uint32_t *pll_mode); err_code_t eagle2_tsc2pll_osr_mode_set(const phymod_access_t *pa, int osr_mode); err_code_t eagle2_tsc2pll_osr_mode_get(const phymod_access_t *pa, int *osr_mode); err_code_t eagle2_tsc2pll_dig_lpbk_get(const phymod_access_t *pa, uint32_t *lpbk); err_code_t eagle2_tsc2pll_rmt_lpbk_get(const phymod_access_t *pa, uint32_t *lpbk); err_code_t eagle2_tsc2pll_core_soft_reset(const phymod_access_t *pa); err_code_t eagle2_tsc2pll_pwrdn_set(const phymod_access_t *pa, int tx_rx, int pwrdn); err_code_t eagle2_tsc2pll_pwrdn_get(const phymod_access_t *pa, power_status_t *pwrdn); err_code_t eagle2_tsc2pll_pcs_lane_swap_tx(const phymod_access_t *pa, uint32_t tx_lane_map); err_code_t eagle2_tsc2pll_pmd_lane_swap (const phymod_access_t *pa, uint32_t lane_map); err_code_t eagle2_tsc2pll_pmd_lane_swap_tx_get (const phymod_access_t *pa, uint32_t *lane_map); err_code_t eagle2_tsc2pll_lane_hard_soft_reset_release(const phymod_access_t *pa, uint32_t enable); err_code_t eagle2_tsc2pll_clause72_control(const phymod_access_t *pa, uint32_t cl_72_en); err_code_t eagle2_tsc2pll_clause72_control_get(const phymod_access_t *pa, uint32_t *cl_72_en); err_code_t eagle2_tsc2pll_pmd_reset_seq(const phymod_access_t *pa, int pmd_touched); err_code_t eagle2_tsc2pll_pll_reset_enable_set (const phymod_access_t *pa, int enable); err_code_t eagle2_tsc2pll_read_pll_range (const phymod_access_t *pa, uint32_t *pll_range); err_code_t eagle2_tsc2pll_signal_detect (const phymod_access_t *pa, uint32_t *signal_detect); err_code_t eagle2_tsc2pll_ladder_setting_to_mV(const phymod_access_t *pa, int8_t y, int16_t* level); err_code_t eagle2_tsc2pll_pll_config_get(const phymod_access_t *pa, enum eagle2_tsc2pll_pll_enum *pll_mode); err_code_t eagle2_tsc2pll_tx_lane_control_set(const phymod_access_t *pa, uint32_t en); err_code_t eagle2_tsc2pll_tx_lane_control_get(const phymod_access_t *pa, uint32_t* en); err_code_t eagle2_tsc2pll_rx_lane_control_set(const phymod_access_t *pa, uint32_t en); err_code_t eagle2_tsc2pll_rx_lane_control_get(const phymod_access_t *pa, uint32_t* en); err_code_t eagle2_tsc2pll_get_vco (const phymod_phy_inf_config_t* config, uint32_t *vco_rate, uint32_t *new_pll_div, int16_t *new_os_mode); err_code_t eagle2_tsc2pll_pmd_tx_disable_pin_dis_set(const phymod_access_t *pa, uint32_t enable); err_code_t eagle2_tsc2pll_pmd_tx_disable_pin_dis_get(const phymod_access_t *pa, uint32_t *enable); err_code_t eagle2_tsc2pll_tx_shared_patt_gen_en_get( const phymod_access_t *pa, uint8_t *enable); err_code_t eagle2_tsc2pll_config_shared_tx_pattern_idx_set( const phymod_access_t *pa, const uint32_t *pattern_len); err_code_t eagle2_tsc2pll_config_shared_tx_pattern_idx_get( const phymod_access_t *pa, uint32_t *pattern_len, uint32_t *pattern); err_code_t eagle2_tsc2pll_osr_mode_to_enum(int osr_mode, phymod_osr_mode_t* osr_mode_en); err_code_t eagle2_tsc2pll_select_pll(const phymod_access_t *pa, uint8_t pll_index); #endif /* PHY_TSC_IBLK_H */
7cb78221752c096a607e981d6961f77bd6f0dd85
a2974e4f3bc9e0a548c82d4f0841fd1aede003dd
/Ch06/power.c
01d2743d39613f54937ca6aba55f86628e380940
[]
no_license
markf152/C_Saw
5b1ed5e21e41f62a5a9b541f7f9f64dd998a0f73
729bec5a6a5db66429462d3e7dc7884179d289e3
refs/heads/master
2021-01-10T07:18:05.822972
2016-02-20T13:42:37
2016-02-20T13:42:37
52,131,745
0
0
null
null
null
null
UTF-8
C
false
false
875
c
/* power.c -- rasies numbers to integer powers */ #include <stdio.h> double power(double n, int p); /* ANSI function prototype */ int main(void) { double x; double xpow; int exp; printf("\n\n"); /* Blank lines for readability */ printf("Enter a number and the positive integer power"); printf(" to which\nthe number will be raised. Enter q"); printf(" to quit.\n"); while (scanf("%lf%d", &x, &exp) == 2) { xpow = power(x, exp); printf("%.3g to the power %d is %.5g\n", x, exp, xpow); printf("Enter the next pair of numbers or q to quit.\n"); } printf("Hope you enjoyed this power trip -- bye!\n"); printf("\n\n"); /* Blank lines for readability */ return ; } double power(double n, int p) { double pow = 1; int i; for (i = 1; i <= p; i++) pow *= n; return pow; }
9753b995fa1161c2dbe290194fa339fb4205ad83
d2c82245525562e94cc8658c42d2e0a8305b3979
/week3/1.c
1980b2dea64dfa58852ab66c2edbdc29bf4ea9e3
[]
no_license
sak-18/DSA-assignments
3b06e7886cbfaf2ed25bbf9fc6903932964dee9a
bcb3b2d5d74bf351d89445ee0b7eb28a31d1e9cf
refs/heads/master
2020-06-12T21:46:31.314588
2019-06-29T18:30:24
2019-06-29T18:30:24
null
0
0
null
null
null
null
UTF-8
C
false
false
493
c
#include<stdio.h> #include<string.h> int n; int array[100]; int lena; char a[100]={}; char b[100]={}; int check(int num) { a[num]='\0'; for(int i=0,j=0;i<lena;i++) { if(a[i]==b[j]) j++; if(j==strlen(b)) return 1; } return 0; } int main() { scanf("%s",a); scanf("%s",b); scanf("%d",&n); lena=strlen(a); for(int i=0;i<n;i++) { scanf("%d",&array[i]); } int i; for(i=0;i<n;i++) { if(!check(array[i]-1)) { break; } } printf("%d",i); }
28b7de3875f5d88a947bd79e10b13ea086c93651
5959f3c293d232a67805ef93568d3e38941f7681
/libft/ft_toupper.c
2a96246916b1c83e996d7a9b3631222d1b55a4c9
[]
no_license
elmehdi/Fractol
fc3668a7626ce93ca9f61d95973391e0fd4e5592
f5f96aa04fe5bfb1820b8fed548c93b4b1c5c51e
refs/heads/master
2022-04-12T01:15:12.078720
2020-03-09T17:00:27
2020-03-09T17:00:27
null
0
0
null
null
null
null
UTF-8
C
false
false
972
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_toupper.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: elfetoua <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/04/14 20:44:25 by elfetoua #+# #+# */ /* Updated: 2019/04/14 20:44:27 by elfetoua ### ########.fr */ /* */ /* ************************************************************************** */ int ft_toupper(int c) { if (c >= 'a' && c <= 'z') c = c - 32; return (c); }
f8c192b4f7ffd34e1039e418c4c2b03a20dae4b0
953b75b377a31413742658ed8554eea9623af901
/Projects/Peripheral_Examples/Examples_HAL/HAL/HAL_TimeBase_RTC_WKUP/Src/bluenrg_lp_hal_msp.c
9e8011f6413b7746046dd6c8ea2b570aae507205
[]
no_license
ybcai/bluenrg_lp_sdk
3e830d88c178c1a6806a138ffe168660a02f99b4
15201a7e21e04963cdb314d5cda6094303c7a394
refs/heads/main
2023-03-30T20:38:12.621968
2021-04-06T14:31:42
2021-04-06T14:31:42
355,220,005
0
0
null
null
null
null
UTF-8
C
false
false
1,710
c
/** ****************************************************************************** * File Name : bluenrg_lp_hal_msp.c * Description : This file provides code for the MSP Initialization * and de-Initialization codes. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2018 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "HAL_TimeBase_RTC_WKUP_main.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* External functions --------------------------------------------------------*/ /** * Initializes the Global MSP. */ void HAL_MspInit(void) { /* System interrupt init*/ /* SysTick_IRQn interrupt configuration */ HAL_NVIC_SetPriority(SysTick_IRQn, 0); } /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
0fc3e24083b612e7f274d3d5b393e4ce48936c8e
c5cb98ad5c3fa37ce761cb9b430b69e29a33141f
/quest/skills2/wakuang/skills2.c
a5e6952d73fc93f2473c00c2445c5f210fa3f873
[]
no_license
cao777/mudylfy
92669b53216a520a48cf2cca49ea08d4df4999c5
266685aa486ecf0e3616db87b5bf7ad5ea4e57e4
refs/heads/master
2023-03-16T20:58:21.877729
2019-12-13T07:39:24
2019-12-13T07:39:24
null
0
0
null
null
null
null
GB18030
C
false
false
3,282
c
//海洋 //星星(lywin)2000/8/29 #include <ansi.h> inherit F_CLEAN_UP; int main(object me, string arg) { object ob; string rep; seteuid(getuid(me)); if(!arg) ob = me; else if (wizardp(me)) { ob = present(arg, environment(me)); if (!ob) ob = find_player(arg); if (!ob) ob = find_living(arg); if (!ob) return notify_fail("你要察看谁的状态?\n"); } else return notify_fail("只有巫师能察看别人的状态。\n"); rep = "\n"; rep+= "┌──────────────────────┬─────────┐\n"; rep+= sprintf("│生产技能总表 │相应技能经验值 │\n"); rep+= "├──────────────────────┴─────────┤\n"; rep+= sprintf("│矿石挖掘技术 │" + ob->query("work/wakuang") + "\n"); rep+= "├──────────────────────┴─────────┤\n"; rep+= sprintf("│务农技术 │" + ob->query("work/wunon") + "\n"); rep+= "├──────────────────────┴─────────┤\n"; rep+= sprintf("│烹饪技术 │" + ob->query("work/penlen") + "\n"); rep+= "├──────────────────────┴─────────┤\n"; rep+= sprintf("│造剑技术 │" + ob->query("work/zhujian") + "\n"); rep+= "├──────────────────────┴─────────┤\n"; rep+= sprintf("│造刀技术 │" + ob->query("work/zhudao") + "\n"); rep+= "├──────────────────────┴─────────┤\n"; rep+= sprintf("│造板指技术 │" + ob->query("work/zhubanzi") + "\n"); rep+= "├──────────────────────┴─────────┤\n"; rep+= sprintf("│捕鱼技术 │" + ob->query("work/buyu") + "\n"); rep+= "├──────────────────────┴─────────┤\n"; rep+= sprintf("│打猎技术 │" + ob->query("work/dalie") + "\n"); rep+= "├──────────────────────┴─────────┤\n"; rep+= sprintf("│造酒技术 │" + ob->query("work/zhaojiu") + "\n"); rep+= "├──────────────────────┴─────────┤\n"; rep+= sprintf("│盔甲铸造技术 │" + ob->query("work/zhujia") + "\n"); rep+= "└────────────────────────────────┘\n\n"; write(rep); return 1; } int help(object me) { write(@HELP 指令格式 : skills2 skills2 <对象名称> (巫师专用) 这个指令用来查看你在海洋上的生产技能列表 HELP ); return 1; }
b57094745e4dd504efe4905c0d5691feaffc1acc
298effa5a0d92e73ab51009920f1b12d969d0397
/0x07-pointers_arrays_strings/9-set_string.c
6856fd6afd73b46fb167fa536ccbabdda7a0117e
[]
no_license
geshimore/alx-low_level_programming
1b44ae4605e052e1937d9cbc8e4bd765befaf1a1
6a84cbe8cefc0ed0f09a303dd81219dfc508c55a
refs/heads/master
2023-08-03T17:49:37.113244
2021-09-15T18:51:10
2021-09-15T18:51:10
335,575,230
0
0
null
null
null
null
UTF-8
C
false
false
204
c
#include "holberton.h" /** * set_string - a function that sets the value of a pointer to a char. * @s: input * @to: input * Return: Always 0 */ void set_string(char **s, char *to) { *s = to; }
f33ffc6c709bb2245916367c1cabbefc8de92970
3103b772444594ff8ab5a1394bd1934dbc7691f3
/DE2-115-EP4CE115F29C7N/DE2_115_demonstrations/DE2_115_USB_DEVICE/HW/software/usb_device_bsp/linker.h
ac693f4e2ef9c3c2df6dd72c24820c04a6803358
[]
no_license
dumpinfo/DE2115backup
01eb4e2d06d9d3407142192db0ca344b356c61b5
15c9048919437a7e401628ad862554e13140c18b
refs/heads/master
2023-02-12T00:28:56.815984
2020-12-22T14:41:02
2020-12-22T14:41:02
321,918,290
0
0
null
null
null
null
UTF-8
C
false
false
2,739
h
/* * linker.h - Linker script mapping information * * Machine generated for CPU 'cpu_0' in SOPC Builder design 'DE2_115_Qsys' * SOPC Builder design path: ../../DE2_115_Qsys.sopcinfo * * Generated: Mon Oct 22 13:50:32 CST 2012 */ /* * DO NOT MODIFY THIS FILE * * Changing this file will have subtle consequences * which will almost certainly lead to a nonfunctioning * system. If you do modify this file, be aware that your * changes will be overwritten and lost when this file * is generated again. * * DO NOT MODIFY THIS FILE */ /* * License Agreement * * Copyright (c) 2008 * Altera Corporation, San Jose, California, USA. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * This agreement shall be governed in all respects by the laws of the State * of California and by the laws of the United States of America. */ #ifndef __LINKER_H_ #define __LINKER_H_ /* * BSP controls alt_load() behavior in crt0. * */ #define ALT_LOAD_EXPLICITLY_CONTROLLED /* * Base address and span (size in bytes) of each linker region * */ #define RESET_REGION_BASE 0x0 #define RESET_REGION_SPAN 32 #define SDRAM_0_REGION_BASE 0x20 #define SDRAM_0_REGION_SPAN 134217696 /* * Devices associated with code sections * */ #define ALT_EXCEPTIONS_DEVICE SDRAM_0 #define ALT_RESET_DEVICE SDRAM_0 #define ALT_RODATA_DEVICE SDRAM_0 #define ALT_RWDATA_DEVICE SDRAM_0 #define ALT_TEXT_DEVICE SDRAM_0 /* * Initialization code at the reset address is allowed (e.g. no external bootloader). * */ #define ALT_ALLOW_CODE_AT_RESET /* * The alt_load() facility is called from crt0 to copy sections into RAM. * */ #define ALT_LOAD_COPY_RWDATA #endif /* __LINKER_H_ */
1e2c14c8f6aa25a779872554efa430234efb8590
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/freebsd/sys/dev/aic7xxx/extr_aic7xxx_pci.c_ahc_aha494X_setup.c
814ca45c3231bf32693dfc5359af302c9f972f0c
[]
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
709
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 */ struct ahc_softc {int dummy; } ; /* Variables and functions */ int ahc_aha494XX_setup (struct ahc_softc*) ; int ahc_aic7870_setup (struct ahc_softc*) ; __attribute__((used)) static int ahc_aha494X_setup(struct ahc_softc *ahc) { int error; error = ahc_aic7870_setup(ahc); if (error == 0) error = ahc_aha494XX_setup(ahc); return (error); }
8c41c79eedadfab5a853579afcccd6e0977aa6bc
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/net/sched/extr_sch_hfsc.c_rtsc_x2y.c
75492ed3589cbed7439c7d53698256f32402fcd4
[]
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
976
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__ u64 ; struct runtime_sc {scalar_t__ x; scalar_t__ y; scalar_t__ dx; scalar_t__ dy; int /*<<< orphan*/ sm2; int /*<<< orphan*/ sm1; } ; /* Variables and functions */ scalar_t__ seg_x2y (scalar_t__,int /*<<< orphan*/ ) ; __attribute__((used)) static u64 rtsc_x2y(struct runtime_sc *rtsc, u64 x) { u64 y; if (x <= rtsc->x) y = rtsc->y; else if (x <= rtsc->x + rtsc->dx) /* y belongs to the 1st segment */ y = rtsc->y + seg_x2y(x - rtsc->x, rtsc->sm1); else /* y belongs to the 2nd segment */ y = rtsc->y + rtsc->dy + seg_x2y(x - rtsc->x - rtsc->dx, rtsc->sm2); return y; }
38d96f8309ec568cd514e0d2509bacb31e21ea8d
8d1725e2bedd244d7bc865df75317a85d2468e93
/qt_core/c_lib/include/qt_core_c_QStandardPaths.h
aa6eb808379875a334969312865acd3d1d118662
[]
no_license
aristotle9/qt_generator-output
04100597f923b117314afcc80f0ea85417d342be
be98dd92de8d2e2c43cf8e9e20ebd1316fd4b101
refs/heads/master
2021-07-23T12:20:15.277052
2017-10-24T08:20:03
2017-10-24T08:20:03
108,097,475
2
0
null
null
null
null
UTF-8
C
false
false
1,810
h
#ifndef QT_CORE_C_QSTANDARDPATHS_H #define QT_CORE_C_QSTANDARDPATHS_H #include "qt_core_c_global.h" extern "C" { QT_CORE_C_EXPORT void qt_core_c_QStandardPaths_displayName_to_output(QStandardPaths::StandardLocation type, QString* output); QT_CORE_C_EXPORT void qt_core_c_QStandardPaths_enableTestMode(bool testMode); QT_CORE_C_EXPORT void qt_core_c_QStandardPaths_findExecutable_to_output_executableName(const QString* executableName, QString* output); QT_CORE_C_EXPORT void qt_core_c_QStandardPaths_findExecutable_to_output_executableName_paths(const QString* executableName, const QStringList* paths, QString* output); QT_CORE_C_EXPORT bool qt_core_c_QStandardPaths_isTestModeEnabled(); QT_CORE_C_EXPORT void qt_core_c_QStandardPaths_locateAll_to_output_type_fileName(QStandardPaths::StandardLocation type, const QString* fileName, QStringList* output); QT_CORE_C_EXPORT void qt_core_c_QStandardPaths_locateAll_to_output_type_fileName_options(QStandardPaths::StandardLocation type, const QString* fileName, unsigned int options, QStringList* output); QT_CORE_C_EXPORT void qt_core_c_QStandardPaths_locate_to_output_type_fileName(QStandardPaths::StandardLocation type, const QString* fileName, QString* output); QT_CORE_C_EXPORT void qt_core_c_QStandardPaths_locate_to_output_type_fileName_options(QStandardPaths::StandardLocation type, const QString* fileName, unsigned int options, QString* output); QT_CORE_C_EXPORT void qt_core_c_QStandardPaths_setTestModeEnabled(bool testMode); QT_CORE_C_EXPORT void qt_core_c_QStandardPaths_standardLocations_to_output(QStandardPaths::StandardLocation type, QStringList* output); QT_CORE_C_EXPORT void qt_core_c_QStandardPaths_writableLocation_to_output(QStandardPaths::StandardLocation type, QString* output); } // extern "C" #endif // QT_CORE_C_QSTANDARDPATHS_H
f39166734819af5045ad86bc4e2149cec7d3eac3
a10a3972f62c1d9711c2654d7b3b6ca8ee003300
/src/kernel/rpc/rpcHistogram.h
216381e051f2622b9c3502280eab05de903a4495
[]
no_license
takeharukato/sprite
5913f74a08ce6c76e5107ede92bf4f44806f5b7d
e96c03abb319964e69cd21577d724ee83a950a9c
refs/heads/master
2020-08-04T02:40:31.702805
2015-10-05T03:49:13
2015-10-05T03:49:13
null
0
0
null
null
null
null
UTF-8
C
false
false
3,030
h
/* * rpcHistogram.h -- * * Definitions for the histograms of event durations. * * Copyright (C) 1985 Regents of the University of California * All rights reserved. * * * $Header: /cdrom/src/kernel/Cvsroot/kernel/rpc/rpcHistogram.h,v 9.3 92/07/09 21:46:42 kupfer Exp $ SPRITE (Berkeley) */ #ifndef _RPCHISTOGRAM #define _RPCHISTOGRAM #include <spriteTime.h> #ifdef KERNEL #include <sync.h> #else #include <kernel/sync.h> #endif /* KERNEL */ /* * An empirical time distribution is kept in the following structure. * This includes the average, plus an array of calls vs. microseconds * with some granularity on the time for each bucket. We explicitly * specify a kernel lock, so that we can copyout this struct to a user * program and have the user program understand what it's getting. */ typedef struct Rpc_Histogram { Sync_KernelLock lock; /* Used to monitor access to histogram */ int numCalls; /* The total number of calls */ Time aveTimePerCall; /* The average interval duration */ Time totalTime; /* The total time spent in the calls */ Time overheadTime; /* Overhead cost per call */ int usecPerBucket; /* The granularity of the histogram */ int numHighValues; /* Count of out-of-bounds values */ int bucketShift; /* Used to map from time to bucket */ int numBuckets; /* The number of slots in the histogram */ int *bucket; /* The array of counters */ } Rpc_Histogram; /* * This is the size of all the histograms kept by the system. * Although they could vary in size, one size is used in order to * simplify the interface to the user program that prints out * the histograms. */ #define RPC_NUM_HIST_BUCKETS 50 /* * The service time is measured on both the client and the server. * These flags enable/disable this measurement. The macros are used * to invoke the tracing procedures, subject to the flags. */ extern Boolean rpcServiceTiming; extern Boolean rpcCallTiming; #define RPC_CALL_TIMING_START(command, timePtr) \ if (rpcCallTiming) { \ Rpc_HistStart(rpcCallTime[command], timePtr); \ } #define RPC_CALL_TIMING_END(command, timePtr) \ if (rpcCallTiming) { \ Rpc_HistEnd(rpcCallTime[command], timePtr); \ } #define RPC_SERVICE_TIMING_START(command, timePtr) \ if (rpcServiceTiming) { \ Rpc_HistStart(rpcServiceTime[command], timePtr); \ } #define RPC_SERVICE_TIMING_END(command, timePtr) \ if (rpcServiceTiming) { \ Rpc_HistEnd(rpcServiceTime[command], timePtr); \ } extern Rpc_Histogram *Rpc_HistInit _ARGS_((int numBuckets, int usecPerBucket)); extern void Rpc_HistReset _ARGS_((register Rpc_Histogram *histPtr)); extern void Rpc_HistStart _ARGS_((register Rpc_Histogram *histPtr, register Time *timePtr)); extern void Rpc_HistEnd _ARGS_((register Rpc_Histogram *histPtr, register Time * timePtr)); extern ReturnStatus Rpc_HistDump _ARGS_((register Rpc_Histogram *histPtr, register Address buffer)); extern void Rpc_HistPrint _ARGS_((register Rpc_Histogram *histPtr)); #endif /* _RPCHISTOGRAM */
92be52ad8ff33a8a4c13af780600f295b0dd3734
f815693a8f74b6113ef8ef06c480c408069679a2
/libft/ft_strnstr.c
fda378dd431cd3acfa299216e4ff0bb661e8611e
[]
no_license
thefullarcticfox/minishell
e67f1888fe861b23b6036c8b616f2d3f9ba78e4c
ffa44280cf13938b6eb2cfc024cb69a19162e781
refs/heads/master
2023-03-21T23:39:30.186933
2021-03-12T01:29:06
2021-03-12T01:29:06
346,838,096
1
1
null
null
null
null
UTF-8
C
false
false
394
c
#include "libft.h" char *ft_strnstr(const char *haystack, const char *needle, size_t len) { size_t i; size_t j; i = 0; if (*needle == '\0') return ((char *)haystack); while (len > 0 && *(haystack + i) != '\0') { j = 0; while (*(haystack + i + j) == *(needle + j) && i + j < len) { if (needle[++j] == '\0') return ((char *)(haystack + i)); } i++; } return (NULL); }
dab64efd10124b8c7fa8642d04ed33675d4673a1
387168ad894a81e418d4a80f2fea89a5a53715e8
/bsp/nrf52832/nRF5_SDK_13.0.0_04a0bfd/components/libraries/log/nrf_log_backend.h
05e5b0a34fd5025946e6137301fe7312e638dcdf
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
XBurst/RT-Thread-XBurst
697eb85130e38af92d717836cc34ee5d1d4f2f77
47fe0fce16f562a0c9b1c9c32803419a87286002
refs/heads/master
2020-04-20T12:23:37.510908
2019-07-20T16:16:45
2019-07-20T17:31:13
168,842,151
5
10
Apache-2.0
2020-03-08T12:14:27
2019-02-02T14:51:42
C
UTF-8
C
false
false
3,278
h
/** * Copyright (c) 2016 - 2017, Nordic Semiconductor ASA * * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistributions in binary form, except as embedded into a Nordic * Semiconductor ASA integrated circuit in a product or a software update for * such product, must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other * materials provided with the distribution. * * 3. Neither the name of Nordic Semiconductor ASA nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * 4. This software, with or without modification, must only be used with a * Nordic Semiconductor ASA integrated circuit. * * 5. Any software provided in binary form under this license must not be reverse * engineered, decompiled, modified and/or disassembled. * * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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. * */ /**@file * @addtogroup nrf_log Logger module * @ingroup app_common * * @defgroup nrf_log_backend Backend of nrf_log * @{ * @ingroup nrf_log * @brief The nrf_log backend interface. */ #ifndef NRF_LOG_BACKEND_H__ #define NRF_LOG_BACKEND_H__ #include "nrf_log_ctrl.h" #include "sdk_errors.h" #include <stdbool.h> /** * @brief Function for initializing the logger backend. * * param blocking Set true if handler functions should block until completion. * * @return NRF_SUCCESS after successful initialization, error code otherwise. */ ret_code_t nrf_log_backend_init(bool blocking); /** * @brief Function for returning a pointer to a function for handling standard * log entries (@ref NRF_LOG_ERROR, etc.). * * @return Pointer to a handler. */ nrf_log_std_handler_t nrf_log_backend_std_handler_get(void); /** * @brief Function for returning a pointer to a function for handling * hexdumps (@ref NRF_LOG_HEXDUMP_ERROR, etc.). * * @return Pointer to a handler. */ nrf_log_hexdump_handler_t nrf_log_backend_hexdump_handler_get(void); /** * @brief Function for blocking reading of a byte from the backend. * * @return Byte. */ uint8_t nrf_log_backend_getchar(void); #endif // NRF_LOG_BACKEND_H__ /** @} */
215584358f06a61a59b5fbd98c84ef9d25360a72
9c7c58220a546d583e22f8737a59e7cc8bb206e6
/Project/MyProject/MyProject/Source/MyProject/Private/BaseFrame/Libs/NetWork/NetCmdDispatch/ProtoCV.h
8f957052eeb59651fb7ed4bfcf6c0c4b58cbb02e
[]
no_license
SiCoYu/UE
7176f9ece890e226f21cf972e5da4c3c4c4bfe41
31722c056d40ad362e5c4a0cba53b05f51a19324
refs/heads/master
2021-03-08T05:00:32.137142
2019-07-03T12:20:25
2019-07-03T12:20:25
null
0
0
null
null
null
null
UTF-8
C
false
false
1,420
h
#ifndef __ProtoCV_H_ #define __ProtoCV_H_ #include "PlatformDefine.h" MY_BEGIN_NAMESPACE(MyNS) enum class ProtoCV { GAME_VERSION = 1999, MAX_IP_LENGTH = 16, MAX_ACCNAMESIZE = 48, MAX_PASSWORD = 16, MAX_CHARINFO = 3, MAX_NAMESIZE = 32, MAX_CHATINFO = 256, }; enum class ERetResult { LOGIN_RETURN_UNKNOWN, /// 未知错误 LOGIN_RETURN_VERSIONERROR, /// 版本错误 LOGIN_RETURN_UUID, /// UUID登陆方式没有实现 LOGIN_RETURN_DB, /// 数据库出错 LOGIN_RETURN_PASSWORDERROR,/// 帐号密码错误 LOGIN_RETURN_CHANGEPASSWORD,/// 修改密码成功 LOGIN_RETURN_IDINUSE, /// ID正在被使用中 LOGIN_RETURN_IDINCLOSE, /// ID被封 LOGIN_RETURN_GATEWAYNOTAVAILABLE,/// 网关服务器未开 LOGIN_RETURN_USERMAX, /// 用户满 LOGIN_RETURN_ACCOUNTEXIST, /// 账号已经存在 LOGON_RETURN_ACCOUNTSUCCESS,/// 注册账号成功 LOGIN_RETURN_CHARNAMEREPEAT,/// 角色名称重复 LOGIN_RETURN_USERDATANOEXIST,/// 用户档案不存在 LOGIN_RETURN_USERNAMEREPEAT,/// 用户名重复 LOGIN_RETURN_TIMEOUT, /// 连接超时 LOGIN_RETURN_PAYFAILED, /// 计费失败 LOGIN_RETURN_JPEG_PASSPORT, /// 图形验证码输入错误 LOGIN_RETURN_LOCK, /// 帐号被锁定 LOGIN_RETURN_WAITACTIVE, /// 帐号待激活 LOGIN_RETURN_NEWUSER_OLDZONE, ///新账号不允许登入旧的游戏区 LOGIN_RETURN_CHARNAME_FORBID = 36, }; MY_END_NAMESPACE #endif
62a03ddd4362c87d8ad62b0c887eb73c071e4af3
120c23225d35b1c1d86945757c16e6d251605051
/workspace/studycode/read_map.c
6bdf602f409fab92262e0efa77a7b44b219da450
[]
no_license
AlanenR/random_files
ae33243e00f73fffa81d5503c83b8c66656a6c08
48ae3f11a90e8392d9e12c6cd5611753f3a87a9d
refs/heads/main
2023-06-02T16:46:40.022285
2021-06-17T16:25:15
2021-06-17T16:25:15
377,837,770
0
0
null
null
null
null
UTF-8
C
false
false
2,048
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* read_map.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ralanen <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/06/14 20:45:30 by ralanen #+# #+# */ /* Updated: 2021/06/16 06:21:08 by ralanen ### ########.fr */ /* */ /* ************************************************************************** */ #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #define BUF_SIZE 400 char *ft_read_map(char *file) { int fd; int ret; char *buf; buf = ((char*)malloc(sizeof(char) * BUF_SIZE)); fd = open(file, O_RDONLY); if (fd == -1) { } while ((ret = read(fd, buf, BUF_SIZE))) { buf[ret] = '\0'; } close(fd); return (buf); } int ft_strlen(char *row1) { int i; i = 0; while (row1[i] != '\0') { i++; } return (i); } int ft_strlen_line(char *row1) { int i; i = 0; while (row1[i] != '\n') { i++; } return (i); } void nextfunction(char *str) { int row1; int strmap; char fill; char obs; char empt; row1 = ft_strlen_line(str); fill = str[(row1 - 1)]; obs = str[(row1 - 2)]; empt = str[(row1 - 3)]; strmap = ft_strlen(str); strmap = strmap - row1; printf("%d row1\n", row1); printf("%c fill\n", fill); printf("%c obs\n", obs); printf("%c empt\n", empt); printf("%d strmap\n", strmap); } int main(int argc, char **argv) { char *data; if (argc < 0) return (0); data = ft_read_map(argv[1]); nextfunction(data); return (0); }
d7a1ae006bafbad7c57848490041081d429553b7
5792b184e71a9de7779e0bd21b6833f8ddfdb4b5
/sysv-pdp11_usr/src/uts/pdp11/io/ht.c
2dd8d1b90853aa6276835c6490fe1e47a56bce2f
[]
no_license
ryanwoodsmall/oldsysv
1637a3e62bb1b9426a224e832f44a46f1e1a31d4
e68293af91e2dc39f5f29c20d7e429f9e0cabc75
refs/heads/master
2020-03-30T06:06:30.495611
2018-09-29T09:04:59
2018-09-29T09:04:59
150,839,670
7
0
null
null
null
null
UTF-8
C
false
false
7,792
c
/* @(#)ht.c 1.1 */ /* * TJU16, TWU16 driver * Handles one TM02 controller, up to 4 TU16 slave transports * minor device classes: * bits 0,1: slave select * bit 2 off: rewind on close; on: position after first TM * bit 3 off: 800 bpi; on: 1600 bpi */ #include "sys/param.h" #include "sys/types.h" #include "sys/sysmacros.h" #include "sys/systm.h" #include "sys/buf.h" #include "sys/dir.h" #include "sys/signal.h" #include "sys/user.h" #include "sys/errno.h" #include "sys/file.h" #include "sys/elog.h" #include "sys/iobuf.h" struct device { int htcs1, htwc, htba, htfc; int htcs2, htds, hter, htas; int htck, htdb, htmr, htdt; int htsn, httc, htbae, htcs3; }; #define NUNIT 4 struct iotime htstat[NUNIT]; struct iobuf httab = tabinit(HT0,0); struct buf chtbuf; #define INF 1000000 char h_openf[NUNIT]; int h_den[NUNIT]; int h_eot[NUNIT]; daddr_t h_blkno[NUNIT]; daddr_t h_nxrec[NUNIT]; struct device *ht_addr; #define GO 01 #define NOP 0 #define WEOF 026 #define SFORW 030 #define SREV 032 #define ERASE 024 #define REW 06 #define DCLR 010 #define WCOM 060 #define RCOM 070 #define P800 01300 /* 800 + pdp11 mode */ #define P1600 02300 /* 1600 + pdp11 mode */ #define IENABLE 0100 #define RDY 0200 #define TM 04 #define DRY 0200 #define EOT 02000 #define CS 02000 #define COR 0100000 #define PES 040 #define WRL 04000 #define MOL 010000 #define ERR 040000 #define FCE 01000 #define TRE 040000 #define HARD 064027 /* UNS|OPI|NEF|FMT|RMR|ILR|ILF */ #define SIO 1 #define SSFOR 2 #define SSREV 3 #define SRETRY 4 #define SCOM 5 #define SOK 6 #define rh70 (cputype == 70) htopen(dev, flag) { register unit, ds; unit = dev&03; if (unit >= NUNIT || h_openf[unit]) { u.u_error = ENXIO; return; } httab.io_addr = (physadr)ht_addr; httab.io_nreg = rh70?NDEVREG:NDEVREG-2; h_openf[unit]++; h_den[unit] = (dev&010 ? P1600 : P800)|unit; h_blkno[unit] = 0; h_nxrec[unit] = INF; ds = hcommand(unit, NOP); if ((ds&MOL)==0 || ((flag&FWRITE) && (ds&WRL))) { u.u_error = ENXIO; h_openf[unit] = 0; return; } if (flag&FAPPEND) { hcommand(unit, SFORW); hcommand(unit, SREV); } } htclose(dev, flag) { register unit; unit = dev&03; if (flag&FWRITE) { hcommand(unit, WEOF); hcommand(unit, WEOF); } if (dev&04) { if (flag&FWRITE) hcommand(unit, SREV); else { hcommand(unit, NOP); if (h_blkno[unit] <= h_nxrec[unit]) hcommand(unit, SFORW); } } else hcommand(unit, REW); h_openf[unit] = 0; } hcommand(unit, com) { register struct buf *bp; bp = &chtbuf; spl5(); while(bp->b_flags&B_BUSY) { bp->b_flags |= B_WANTED; sleep(bp, PRIBIO); } spl0(); bp->b_dev = unit; bp->b_resid = com; bp->b_blkno = 0; bp->b_flags = B_BUSY|B_READ; htstrategy(bp); iowait(bp); if (bp->b_flags&B_WANTED) wakeup(bp); bp->b_flags = 0; return(bp->b_resid); } htstrategy(bp) register struct buf *bp; { register daddr_t *p; register unit; if (bp != &chtbuf) { unit = bp->b_dev&03; p = &h_nxrec[unit]; if (bp->b_blkno > *p) { bp->b_flags |= B_ERROR; bp->b_error = ENXIO; iodone(bp); return; } if (bp->b_blkno == *p && bp->b_flags&B_READ) { clear(paddr(bp), BSIZE); bp->b_resid = bp->b_bcount; iodone(bp); return; } if ((bp->b_flags&B_READ)==0) *p = bp->b_blkno + 1; bp->b_start = lbolt; htstat[unit].io_bcnt += btoc(bp->b_bcount); } bp->av_forw = NULL; spl5(); if (httab.b_actf == NULL) httab.b_actf = bp; else httab.b_actl->av_forw = bp; httab.b_actl = bp; if (httab.b_active==0) htstart(); spl0(); } htstart() { register struct buf *bp; register unit; register struct device *rp; daddr_t blkno; int com; rp = ht_addr; loop: if ((bp = httab.b_actf) == NULL) return; unit = bp->b_dev&03; rp->htcs2 = 0; rp->htas = 1<<0; if ((rp->httc&03777) != h_den[unit]) rp->httc = h_den[unit]; if ((rp->htds&(MOL|DRY)) != (MOL|DRY)) goto abort; blkno = h_blkno[unit]; if (bp == &chtbuf) { if (bp->b_resid==NOP) { bp->b_resid = rp->htds; goto next; } htstat[unit].ios.io_misc++; httab.b_active = SCOM; rp->htfc = 0; rp->htcs1 = bp->b_resid|IENABLE|GO; return; } if (h_openf[unit] < 0 || bp->b_blkno > h_nxrec[unit]) goto abort; if (httab.io_start == 0) httab.io_start = lbolt; if (blkno == bp->b_blkno) { if (h_eot[unit] > 8) goto abort; if ((bp->b_flags&B_READ)==0 && h_eot[unit] && blkno > h_eot[unit]) { bp->b_error = ENOSPC; goto abort; } httab.b_active = SIO; rp->htba = loword(bp->b_paddr); if (rh70) rp->htbae = hiword(bp->b_paddr); rp->htfc = -bp->b_bcount; rp->htwc = -(bp->b_bcount>>1); com = ((hiword(bp->b_paddr)&3) << 8) | IENABLE | GO; htstat[unit].io_cnt++; blkacty |= (1<<HT0); if (bp->b_flags & B_READ) com |= RCOM; else com |= WCOM; if (pwr_act >= 0) rp->htcs1 = com; } else { htstat[unit].ios.io_misc++; if (blkno < bp->b_blkno) { httab.b_active = SSFOR; rp->htfc = blkno - bp->b_blkno; rp->htcs1 = SFORW|IENABLE|GO; } else { httab.b_active = SSREV; rp->htfc = bp->b_blkno - blkno; rp->htcs1 = SREV|IENABLE|GO; } } return; abort: bp->b_flags |= B_ERROR; next: httab.b_actf = bp->av_forw; iodone(bp); goto loop; } htintr(dev) { register struct buf *bp; register int unit; register struct device *rp; int err, state; extern htprint(); rp = ht_addr; if ((bp = httab.b_actf)==NULL) { logstray(rp); return; } blkacty &= ~(1<<HT0); unit = bp->b_dev&03; state = httab.b_active; httab.b_active = 0; if (rp->htcs1&TRE) { err = rp->hter; if (rp->htcs2&077400 || err&HARD) state = 0; if (bp->b_flags&B_PHYS) err &= ~FCE; if ((bp->b_flags&B_READ) && (rp->htds&PES)) err &= ~(CS|COR); if ((rp->htds&MOL)==0) h_openf[unit] = -1; else if (rp->htds&TM) { rp->htwc = -(bp->b_bcount>>1); h_nxrec[unit] = bp->b_blkno; state = SOK; } else if (state && err == 0) state = SOK; if (state != SOK) { httab.io_stp = &htstat[unit].ios; fmtberr(&httab,0); } if (httab.b_errcnt > 4) prcom(htprint, bp, rp->hter, rp->htcs2); rp->htcs1 = TRE|DCLR|GO; if (state==SIO && ++httab.b_errcnt < 10) { httab.b_active = SRETRY; h_blkno[unit]++; rp->htfc = -1; htstat[unit].ios.io_misc++; rp->htcs1 = SREV|IENABLE|GO; return; } if (state!=SOK) { bp->b_flags |= B_ERROR; state = SIO; } } else if (rp->htds & ERR) { /* SC */ if ((rp->htds & TM) == 0) { httab.io_stp = &htstat[unit].ios; fmtberr(&httab,0); } rp->htcs1 = DCLR|GO; } switch(state) { case SIO: case SOK: h_blkno[unit]++; case SCOM: if (rp->htds&EOT) h_eot[unit]++; else h_eot[unit] = 0; if (httab.io_erec) logberr(&httab,bp->b_flags&B_ERROR); httab.b_errcnt = 0; httab.b_actf = bp->av_forw; iodone(bp); bp->b_resid = (-rp->htwc)<<1; if (bp != &chtbuf) { htstat[unit].io_resp += lbolt - bp->b_start; htstat[unit].io_act += lbolt - httab.io_start; httab.io_start = 0; } break; case SRETRY: if ((bp->b_flags&B_READ)==0) { htstat[unit].ios.io_misc++; httab.b_active = SSFOR; rp->htcs1 = ERASE|IENABLE|GO; return; } case SSFOR: case SSREV: if (rp->htds & TM) { if (state == SSREV) { h_blkno[unit] = bp->b_blkno - (rp->htfc&0xffff); h_nxrec[unit] = h_blkno[unit]; } else { h_blkno[unit] = bp->b_blkno + (rp->htfc&0xffff); h_nxrec[unit] = h_blkno[unit] - 1; } } else h_blkno[unit] = bp->b_blkno; break; default: return; } htstart(); } htread(dev) { htphys(dev); physio(htstrategy, 0, dev, B_READ); } htwrite(dev) { htphys(dev); physio(htstrategy, 0, dev, B_WRITE); } htphys(dev) { register unit; daddr_t a; unit = dev&03; a = u.u_offset >> BSHIFT; h_blkno[unit] = a; h_nxrec[unit] = a+1; } htprint(dev, str) char *str; { printf("%s on TU16 drive %d\n", str, dev&03); }
9f26827645d6afaf20e960e41f97b21b36779ffa
c425afb8bb6b182168fd4c3a46c9b334f4740e60
/clone/book/xuemai-book.c
4088accfabc65c97e9302dc50cf1b1d133281960
[]
no_license
fluffos/nt7
ceef82b2465cf322549c7ece6ce757eaa8ec31ff
52727f5a4266b14f1796c2aa297ca645ca07282a
refs/heads/main
2023-06-17T10:07:33.000534
2021-07-15T11:15:05
2021-07-15T11:15:05
308,148,401
9
9
null
2021-06-28T14:11:57
2020-10-28T21:45:40
C
UTF-8
C
false
false
1,402
c
// xuemai.c #include <ansi.h> #include <medical.h> inherit MEDICAL_BOOK; void create() { set_name(HIR "血脉丹方" NOR, ({ "xuemai danfang", "miben", "xuemai", "danfang" })); set_weight(500); /*if (clonep()) set_default_object(__FILE__); else*/ { set("unit", "本"); set("long", "这是一本泛黄的书籍,上面用小篆书" "写着“血脉丹方”几个字。\n", ); set("material", "paper"); set("skill", ([ "name": "liandan-shu", "jing_cost": 90, "difficulty": 200, "max_skill": 600, "min_skill": 30, ])); set("can_make", ([ "xuemai1" : 2700, "xuemai2" : 2700, "xuemai3" : 2700, "xuemai4" : 3000, "xuemai5" : 3000, "xuemai6" : 3000, "xuemai7" : 3300, "xuemai8" : 3300, "xuemai9" : 3600, "xuemai10" : 3900, ])); } setup(); }
9a4637e38bae31a4d7e3c727f7c425723023399c
4d3293373b76d0223a2572d6acf0fb986c48eb79
/lib/hpsc/hpsc-msg.c
3ed31e50a97814a074774da91d181f39f471b676
[ "BSD-3-Clause" ]
permissive
ISI-apex/hpsc-rtems
5e8434b61ad1b8ddbc3394e8ea2baa9d12d23db4
a8c8bece8c2cdda7910c74e245dff7b83037667b
refs/heads/hpsc
2020-05-02T08:56:57.450944
2020-03-21T02:18:59
2020-03-21T02:18:59
177,856,178
0
2
NOASSERTION
2019-12-17T21:38:14
2019-03-26T19:33:29
C
UTF-8
C
false
false
1,632
c
#include <assert.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "hpsc-msg.h" // info is for debugging, use real data types if we need more detail #define LIFECYCLE_INFO_SIZE (HPSC_MSG_PAYLOAD_SIZE - sizeof(uint32_t)) struct hpsc_msg_lifeycle_payload { uint32_t status; char info[LIFECYCLE_INFO_SIZE]; }; static void msg_fill(uint8_t *buf, enum hpsc_msg_type t, const void *payload, size_t psz) { assert(buf); assert(psz <= HPSC_MSG_PAYLOAD_SIZE); buf[0] = t; if (payload) memcpy(&buf[HPSC_MSG_PAYLOAD_OFFSET], payload, psz); } void hpsc_msg_wdt_timeout(void *buf, size_t sz, unsigned int cpu) { assert(sz == HPSC_MSG_SIZE); msg_fill(buf, WATCHDOG_TIMEOUT, &cpu, sizeof(cpu)); } void hpsc_msg_lifecycle(void *buf, size_t sz, enum hpsc_msg_lifecycle_status status, const char *fmt, ...) { // payload is the status enumeration and a string of debug data va_list args; struct hpsc_msg_lifeycle_payload p = { .status = status, .info = {0} }; assert(sz == HPSC_MSG_SIZE); if (fmt) { va_start(args, fmt); vsnprintf(p.info, LIFECYCLE_INFO_SIZE - 1, fmt, args); va_end(args); } msg_fill(buf, LIFECYCLE, &p, sizeof(p)); } void hpsc_msg_ping(void *buf, size_t sz, void *payload, size_t psz) { assert(sz == HPSC_MSG_SIZE); msg_fill(buf, PING, payload, psz); } void hpsc_msg_pong(void *buf, size_t sz, void *payload, size_t psz) { assert(sz == HPSC_MSG_SIZE); msg_fill(buf, PONG, payload, psz); }
da70dc3b1b2ce81e262c962b846617a8cedf01b6
abdeadd195533ff1aafa0c1ff85236bfd0e48c0b
/Mario/mario.c
1c5bf66d1f62e7f72c978df5412b64a8a7af3673
[]
no_license
tomasp92/Proyectos-porfolio
fde26b1543bc6024e3a36f3191203176ba8c0dd1
d57a0cdaddfd8de8e1de6e68f4bb309558e6ff58
refs/heads/master
2023-08-22T12:10:33.880449
2021-10-18T12:30:36
2021-10-18T12:30:36
345,207,484
0
0
null
null
null
null
UTF-8
C
false
false
804
c
#include <cs50.h> #include <stdio.h> int main(void) { // Ask the user the height int between 1 and 8 int H; do { H = get_int("Heigh between 1 and 8: "); } while (H < 1 || H > 8); // Print space bars and count them in a inverse way than hashs for (int i = 1; i <= H; i++) { for (int j = 0; j < 1 * H - i ; j++) { printf(" "); } //Print the hashs from the left for (int j = 0; j < 1 * i ; j++) { printf("#"); } //Print the spaces between left and right side printf(" "); { //Print the hashs from the right for (int j = 0; j < 1 * i ; j++) { printf("#"); } printf("\n"); } } }
544ea6a2d499824f9ca9a47cfe9ae71becdd66f5
c425afb8bb6b182168fd4c3a46c9b334f4740e60
/d/luoyang/baiyuan.c
78c80427249923d96c1d2d802797577109dc0a04
[]
no_license
fluffos/nt7
ceef82b2465cf322549c7ece6ce757eaa8ec31ff
52727f5a4266b14f1796c2aa297ca645ca07282a
refs/heads/main
2023-06-17T10:07:33.000534
2021-07-15T11:15:05
2021-07-15T11:15:05
308,148,401
9
9
null
2021-06-28T14:11:57
2020-10-28T21:45:40
C
UTF-8
C
false
false
636
c
// Room: /d/luoyang/baiyuan.c // Last modified by Lonely 2002.11.11 #include <ansi.h>; inherit ROOM; void create () { set("short", "白园"); set("long", @LONG 白园或称白冢,在东香山北端琵琶峰上。墓前石碑刻“唐少傅白公 墓”六字。白居易晚年寓居香山,自号“香山居士”。 LONG); set("exits", ([ /* sizeof() == 2 */ "westdown" : __DIR__"longmen", ])); set("outdoors", "luoyang"); set("no_clean_up", 0); set("coor/x", -6970); set("coor/y", 2060); set("coor/z", 20); setup(); replace_program(ROOM); }
8d3e68f5cc2ce7afa3399c7647f168d2fe080ea5
92db8ebef11da60f8172ab99622e202ade40ae8e
/INF1018-Software-Basico/Labs/aula9/mainFoo.c
b1e542f82c9f4d6550ee29e184e86303afeb5004
[]
no_license
marcelopaulon/PUC-Rio
337bce5b9a8e0a8bea820afe7dfe0a0593751bde
c9d12b797b4ded22949b387f6b73b2c3de832878
refs/heads/main
2023-07-28T05:16:56.433345
2021-08-05T22:41:59
2021-08-05T22:41:59
393,164,185
0
0
null
null
null
null
UTF-8
C
false
false
288
c
#include <stdio.h> void foo (int a[], int n); void dumpVetor(int a[], int n) { int i; for(i = 0; i < n; i++) { printf("%d ", a[i]); } printf("\n"); } int main(void) { int vet[8] = {6,2,0,1,2,0,50,0}; dumpVetor(vet, 8); foo(vet, 8); dumpVetor(vet, 8); return 0; }
b0dbc7900124a3e8f4a91c9cd3c106e6bed048f0
4fd543a6660cbf608e01af39bd39b1e4e7ceb344
/src/topdown.c
4501fbdb5be08f5e1d602f0fa52aa1d8d2e0c584
[ "Apache-2.0" ]
permissive
wenhuizhang/regalloc
f1e2bfba005cdeb03bae90f78acd016d0d638aef
4e2c8ba5e1fc0b0b3ae5b8134384b146a9ac5611
refs/heads/master
2020-04-07T06:18:11.115238
2018-11-25T02:54:09
2018-11-25T02:54:09
158,129,778
1
0
null
null
null
null
UTF-8
C
false
false
620
c
#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> int topdown(char *file, char *k_file){ printf ("This is topdown register allocation with graph coloring:\n"); FILE* fp; char buffer[255]; fp = fopen(file, "r"); printf("rewritted functions\n"); while(fgets(buffer, 255, (FILE*) fp)){ printf("%s\n", buffer); } fclose(fp); fp = fopen("alloc_var.txt", "r"); printf("allocated registers\n"); while(fgets(buffer, 255, (FILE*) fp)){ printf("%s\n", buffer); } fclose(fp); return 0; };
0d5ab060809554e72002fd74316587fe29ee9707
ffa402b321ad11b79ba977149b563c73f5c141a9
/nistar/user/bin/syscall-bench.c
19ed534006549d62a10eda0c8c84e9dfa1ed9772
[]
no_license
uw-unsat/nickel
151bfa76ba0e75fbc710eed68cbed830f9dbad85
8439aedd75b48ebf9b5344eebfc2a0c70b4eb73d
refs/heads/master
2021-07-23T11:08:50.663555
2020-03-16T23:53:14
2020-03-17T05:29:51
247,836,078
2
0
null
2021-04-20T19:26:43
2020-03-16T23:24:37
C
UTF-8
C
false
false
1,504
c
#include <stdio.h> #include <nistar/env.h> #include <nistar/ulib.h> #define NR_ITER 50000 static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { asm volatile("cpuid" : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) : "0" (*eax), "2" (*ecx) : "memory"); } static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { *eax = op; *ecx = 0; native_cpuid(eax, ebx, ecx, edx); } static inline unsigned int cpuid_eax(unsigned int op) { unsigned int eax, ebx, ecx, edx; cpuid(op, &eax, &ebx, &ecx, &edx); return eax; } static inline uint64_t rdtsc(void) { uint64_t low, high; asm volatile("rdtscp" : "=a" (low), "=d" (high)); cpuid_eax(0); return low | (high << 32); } int main(void) { uint64_t begin, end; upage_id_t root; begin = rdtsc(); for (unsigned long i = 0; i < NR_ITER; ++i) sys_container_get_root(&root); end = rdtsc(); printf("BEGIN: %lu\nEND: %lu\nCYCLES: %lu\nITERATIONS: %lu\nAVG: %lu cycles/iter\n", begin, end, end - begin, NR_ITER, (end - begin) / NR_ITER); return 0; }
9694c91a33d94246c859f87ebabefca807664b8b
44e7d239c7b528574bb6965d0b74ca48040bd46d
/xnet/ztest/xvendor.c
efd62d9a1d27a2c727050c942a25a9f3955bd314
[]
no_license
auneso/xfire
8062cffb28ce73e1dec7a246e50ff52f751da0a0
9afa8d7d75568c368aefbb23c39773f0334bf1fc
refs/heads/master
2021-01-01T16:43:18.582534
2017-10-16T10:05:21
2017-10-16T10:05:21
97,901,092
1
1
null
null
null
null
UTF-8
C
false
false
367
c
#include "format.h" #include "xvendor.h" int main (int argc, char *argv[]) { if (argc != 2) { printf("Usage : %s mac(11:22:33:44:55:66)\n", argv[0]); return 1; } create_oui_table(); char *mac = string_etheraddr((unsigned char *)argv[1]); printf("\nMac Vendor = [%s]\n", get_oui_info((unsigned char *)mac)); destroy_oui_table(); return 0; }
9b79c59b17a32eae5d86bc2fc1acfe518ff5022e
93713f46f16f1e29b725f263da164fed24ebf8a8
/Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/wcs/include/wcslib/wcsprintf.h
ccf6bae829ed11db8657e402d59a995863e495fb
[ "BSD-3-Clause" ]
permissive
holzschu/Carnets
b83d15136d25db640cea023abb5c280b26a9620e
1ad7ec05fb1e3676ac879585296c513c3ee50ef9
refs/heads/master
2023-02-20T12:05:14.980685
2023-02-13T15:59:23
2023-02-13T15:59:23
167,671,526
541
36
BSD-3-Clause
2022-11-29T03:08:22
2019-01-26T09:26:46
Python
UTF-8
C
false
false
6,099
h
/*============================================================================ WCSLIB 6.4 - an implementation of the FITS WCS standard. Copyright (C) 1995-2019, Mark Calabretta This file is part of WCSLIB. WCSLIB 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 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to [email protected] Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsprintf.h,v 6.4 2019/08/15 09:30:18 mcalabre Exp $ *============================================================================= * * WCSLIB 6.4 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * * * Summary of the wcsprintf routines * --------------------------------- * Routines in this suite allow diagnostic output from celprt(), linprt(), * prjprt(), spcprt(), tabprt(), wcsprt(), and wcserr_prt() to be redirected to * a file or captured in a string buffer. Those routines all use wcsprintf() * for output. Likewise wcsfprintf() is used by wcsbth() and wcspih(). Both * functions may be used by application programmers to have other output go to * the same place. * * * wcsprintf() - Print function used by WCSLIB diagnostic routines * --------------------------------------------------------------- * wcsprintf() is used by celprt(), linprt(), prjprt(), spcprt(), tabprt(), * wcsprt(), and wcserr_prt() for diagnostic output which by default goes to * stdout. However, it may be redirected to a file or string buffer via * wcsprintf_set(). * * Given: * format char* Format string, passed to one of the printf(3) family * of stdio library functions. * * ... mixed Argument list matching format, as per printf(3). * * Function return value: * int Number of bytes written. * * * wcsfprintf() - Print function used by WCSLIB diagnostic routines * ---------------------------------------------------------------- * wcsfprintf() is used by wcsbth(), and wcspih() for diagnostic output which * they send to stderr. However, it may be redirected to a file or string * buffer via wcsprintf_set(). * * Given: * stream FILE* The output stream if not overridden by a call to * wcsprintf_set(). * * format char* Format string, passed to one of the printf(3) family * of stdio library functions. * * ... mixed Argument list matching format, as per printf(3). * * Function return value: * int Number of bytes written. * * * wcsprintf_set() - Set output disposition for wcsprintf() and wcsfprintf() * ------------------------------------------------------------------------- * wcsprintf_set() sets the output disposition for wcsprintf() which is used by * the celprt(), linprt(), prjprt(), spcprt(), tabprt(), wcsprt(), and * wcserr_prt() routines, and for wcsfprintf() which is used by wcsbth() and * wcspih(). * * Given: * wcsout FILE* Pointer to an output stream that has been opened for * writing, e.g. by the fopen() stdio library function, * or one of the predefined stdio output streams - stdout * and stderr. If zero (NULL), output is written to an * internally-allocated string buffer, the address of * which may be obtained by wcsprintf_buf(). * * Function return value: * int Status return value: * 0: Success. * * * wcsprintf_buf() - Get the address of the internal string buffer * --------------------------------------------------------------- * wcsprintf_buf() returns the address of the internal string buffer created * when wcsprintf_set() is invoked with its FILE* argument set to zero. * * Function return value: * const char * * Address of the internal string buffer. The user may * free this buffer by calling wcsprintf_set() with a * valid FILE*, e.g. stdout. The free() stdlib library * function must NOT be invoked on this const pointer. * * * WCSPRINTF_PTR() macro - Print addresses in a consistent way * ----------------------------------------------------------- * WCSPRINTF_PTR() is a preprocessor macro used to print addresses in a * consistent way. * * On some systems the "%p" format descriptor renders a NULL pointer as the * string "0x0". On others, however, it produces "0" or even "(nil)". On * some systems a non-zero address is prefixed with "0x", on others, not. * * The WCSPRINTF_PTR() macro ensures that a NULL pointer is always rendered as * "0x0" and that non-zero addresses are prefixed with "0x" thus providing * consistency, for example, for comparing the output of test programs. * *===========================================================================*/ #ifndef WCSLIB_WCSPRINTF #define WCSLIB_WCSPRINTF #include <stdio.h> #ifdef __cplusplus extern "C" { #endif #define WCSPRINTF_PTR(str1, ptr, str2) \ if (ptr) { \ wcsprintf("%s%#lx%s", (str1), (unsigned long)(ptr), (str2)); \ } else { \ wcsprintf("%s0x0%s", (str1), (str2)); \ } int wcsprintf_set(FILE *wcsout); int wcsprintf(const char *format, ...); int wcsfprintf(FILE *stream, const char *format, ...); const char *wcsprintf_buf(void); #ifdef __cplusplus } #endif #endif /* WCSLIB_WCSPRINTF */
935413c8ac80ddebb0997deab775c1db6749d0eb
5c255f911786e984286b1f7a4e6091a68419d049
/vulnerable_code/c0b3bc32-e489-4d54-abfe-55437968ad69.c
1ec3d791b8e8f5e98eedcbf168f0dd15347b1356
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944740
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
579
c
#include <string.h> #include <stdio.h> int main() { int i=0; int j=12; int k; int l; k = 53; l = 64; k = i/j; l = i/j; l = j%j; l = l%j; j = i-j*i; //variables //random /* START VULNERABILITY */ int a; char b[70]; char c[31]; a = 0; do { a++; //random /* START BUFFER SET */ *((char *)c + ( a - 1 )) = *((char *)b + ( a - 1 )); /* END BUFFER SET */ } while(( a - 1 ) < strlen(b)); /* END VULNERABILITY */ printf("%d\n",k); return 0; }
8c41b840b2f963842f602dc50ac9e2dc09ced2d6
e4688989869642d17ccc4ce8a78d540e462a812d
/amns_for_our_tests/p256_7__6_-4__42/amns_init.c
bce38bc01a0dde47cae515e944d49cf5bc2a2b7c
[]
no_license
eacElliptic/AMNS
5753ba9f6e088a9408a4d3853cdb57025c942034
bd549f293e43775507b6e3166ad388a984099f11
refs/heads/master
2021-06-24T20:03:38.250394
2020-10-08T20:26:43
2020-10-08T20:26:43
133,142,425
0
0
null
null
null
null
UTF-8
C
false
false
1,284
c
#include "amns_init.h" void init_data(){ int i; for(i=0; i<POLY_DEG; i++) mpz_init (gama_pow[i]); mpz_init (modul_p); mpz_set_str (modul_p, "58351847096601252464431099275810630564646636886236875566733696467311664128609", 10); mpz_set_str (gama_pow[0], "33031941354565069883264269391629587677046832282913714965255217594279308485730", 10); for(i=1; i<POLY_DEG; i++){ mpz_mul (gama_pow[i], gama_pow[i-1], gama_pow[0]); mpz_mod (gama_pow[i], gama_pow[i], modul_p); } //~ Note : lambda = -4 (see : modular multiplication in 'add_mult_poly.c'). amns_rho = 1L << RHO_LOG2; //~ IMPORTANT : initialisations above must be done before those below. compute_rho_pows(); } //~ computes representatives of powers of 'phi' in the AMNS. void compute_rho_pows(){ int i, l; int64_t tmp_rho[NB_COEFF]; for(i=0; i<NB_COEFF; i++) tmp_rho[i] = rho_rep[i]; //~ computation of a representative of 'rho' from_mont_domain(rho_rep, rho_rep); //~ computation of representatives of (rho)^i (for i=2,3,...) l = NB_COEFF - 2; if (l > 0){ mult_mod_poly(RHO_POWS[0], rho_rep, tmp_rho); for(i=1; i<l; i++) mult_mod_poly(RHO_POWS[i], RHO_POWS[i-1], tmp_rho); } } void free_data(){ int i; for(i=0; i<POLY_DEG; i++) mpz_clear (gama_pow[i]); mpz_clear (modul_p); }
593eec4fecba25460ef5b249decae8325b40c248
5d3e75e78b2bab6a1e93fd791bae16f282fa55f3
/src/compositor/shell/xdg-shell.c
d8c16f6175c13b5e07a099f45535519fb15997d0
[ "MIT" ]
permissive
ljrk0/wlc
6361134f0574ecd3452dca04b4badf6dfc2a9272
61dbcf2c98b931a4920d5abca6c7b3e677f68253
refs/heads/master
2021-09-12T11:52:52.073762
2017-01-04T19:15:03
2017-01-04T19:15:03
null
0
0
null
null
null
null
UTF-8
C
false
false
7,271
c
#include <stdlib.h> #include <assert.h> #include <wayland-server.h> #include "internal.h" #include "macros.h" #include "xdg-shell.h" #include "compositor/compositor.h" #include "compositor/output.h" #include "compositor/view.h" #include "resources/types/xdg-toplevel.h" struct xdg_surface { wlc_resource surface; }; static struct wlc_surface* xdg_surface_get_surface(struct xdg_surface *xdg_surface) { return (xdg_surface ? convert_from_wlc_resource(xdg_surface->surface, "surface") : NULL); } static void xdg_cb_popup_grab(struct wl_client *client, struct wl_resource *resource, struct wl_resource *seat, uint32_t serial) { (void)client, (void)seat, (void)serial; STUB(resource); } static const struct zxdg_popup_v6_interface zxdg_popup_v6_implementation = { .destroy = wlc_cb_resource_destructor, .grab = xdg_cb_popup_grab, }; static void xdg_cb_surface_get_popup(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *parent, struct wl_resource *positioner) { (void)positioner; struct wlc_xdg_shell *xdg_shell; struct wlc_surface *surface, *psurface; if (!(xdg_shell = wl_resource_get_user_data(resource)) || !(surface = xdg_surface_get_surface(convert_from_wl_resource(resource, "xdg-surface"))) || !(psurface = xdg_surface_get_surface(convert_from_wl_resource(parent, "xdg-surface")))) return; wlc_resource r; if (!(r = wlc_resource_create(&xdg_shell->popups, client, &zxdg_popup_v6_interface, wl_resource_get_version(resource), 1, id))) return; wlc_resource_implement(r, &zxdg_popup_v6_implementation, NULL); { struct wlc_surface_event ev = { .attach = { .type = WLC_XDG_SURFACE, .role = wlc_resource_from_wl_resource(resource) }, .surface = surface, .type = WLC_SURFACE_EVENT_REQUEST_VIEW_ATTACH }; wl_signal_emit(&wlc_system_signals()->surface, &ev); } { struct wlc_surface_event ev = { .popup = { .parent = psurface, .role = r }, .surface = surface, .type = WLC_SURFACE_EVENT_REQUEST_VIEW_POPUP }; wl_signal_emit(&wlc_system_signals()->surface, &ev); } zxdg_surface_v6_send_configure(resource, wl_display_next_serial(wlc_display())); } static void xdg_cb_surface_get_toplevel(struct wl_client *client, struct wl_resource *resource, uint32_t id) { struct wlc_surface *surface; struct wlc_xdg_shell *xdg_shell; if (!(xdg_shell = wl_resource_get_user_data(resource)) || !(surface = xdg_surface_get_surface(convert_from_wl_resource(resource, "xdg-surface")))) return; wlc_resource r; if (!(r = wlc_resource_create(&xdg_shell->toplevels, client, &zxdg_toplevel_v6_interface, wl_resource_get_version(resource), 1, id))) return; wlc_resource_implement(r, wlc_xdg_toplevel_implementation(), NULL); { struct wlc_surface_event ev = { .attach = { .type = WLC_XDG_SURFACE, .role = wlc_resource_from_wl_resource(resource) }, .surface = surface, .type = WLC_SURFACE_EVENT_REQUEST_VIEW_ATTACH }; wl_signal_emit(&wlc_system_signals()->surface, &ev); } { struct wlc_surface_event ev = { .attach = { .type = WLC_XDG_TOPLEVEL_SURFACE, .role = r }, .surface = surface, .type = WLC_SURFACE_EVENT_REQUEST_VIEW_ATTACH }; wl_signal_emit(&wlc_system_signals()->surface, &ev); } zxdg_surface_v6_send_configure(resource, wl_display_next_serial(wlc_display())); } static void xdg_cb_surface_ack_configure(struct wl_client *client, struct wl_resource *resource, uint32_t serial) { (void)client, (void)serial, (void)resource; } static void xdg_cb_surface_set_window_geometry(struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) { (void)client; struct wlc_view *view; if (!(view = convert_from_wlc_handle((wlc_handle)wl_resource_get_user_data(resource), "view"))) return; view->surface_pending.visible = (struct wlc_geometry){ { x, y }, { width, height } }; wlc_view_update(view); } static const struct zxdg_surface_v6_interface zxdg_surface_v6_implementation = { .destroy = wlc_cb_resource_destructor, .get_toplevel = xdg_cb_surface_get_toplevel, .get_popup = xdg_cb_surface_get_popup, .ack_configure = xdg_cb_surface_ack_configure, .set_window_geometry = xdg_cb_surface_set_window_geometry, }; static void xdg_cb_shell_get_surface(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface_resource) { struct wlc_surface *surface; struct wlc_xdg_shell *xdg_shell; if (!(xdg_shell = wl_resource_get_user_data(resource)) || !(surface = convert_from_wl_resource(surface_resource, "surface"))) return; wlc_resource r; if (!(r = wlc_resource_create(&xdg_shell->surfaces, client, &zxdg_surface_v6_interface, wl_resource_get_version(resource), 1, id))) return; struct xdg_surface *xdg_surface = convert_from_wlc_resource(r, "xdg-surface"); assert(xdg_surface); xdg_surface->surface = wlc_resource_from_wl_resource(surface_resource); wlc_resource_implement(r, &zxdg_surface_v6_implementation, xdg_shell); } static void xdg_cb_create_positioner(struct wl_client *client, struct wl_resource *resource, uint32_t id) { (void)client, (void)id; STUB(resource); } static void xdg_cb_shell_pong(struct wl_client *client, struct wl_resource *resource, uint32_t serial) { (void)client, (void)resource, (void)serial; STUBL(resource); } static void xdg_cb_destroy(struct wl_client *client, struct wl_resource *resource) { (void)client, (void)resource; } static const struct zxdg_shell_v6_interface zxdg_shell_v6_implementation = { .destroy = xdg_cb_destroy, .create_positioner = xdg_cb_create_positioner, .get_xdg_surface = xdg_cb_shell_get_surface, .pong = xdg_cb_shell_pong, }; static void xdg_shell_bind(struct wl_client *client, void *data, unsigned int version, unsigned int id) { struct wl_resource *resource; if (!(resource = wl_resource_create_checked(client, &zxdg_shell_v6_interface, version, 1, id))) return; wl_resource_set_implementation(resource, &zxdg_shell_v6_implementation, data, NULL); } void wlc_xdg_shell_release(struct wlc_xdg_shell *xdg_shell) { if (!xdg_shell) return; if (xdg_shell->wl.xdg_shell) wl_global_destroy(xdg_shell->wl.xdg_shell); wlc_source_release(&xdg_shell->surfaces); wlc_source_release(&xdg_shell->toplevels); wlc_source_release(&xdg_shell->popups); memset(xdg_shell, 0, sizeof(struct wlc_xdg_shell)); } bool wlc_xdg_shell(struct wlc_xdg_shell *xdg_shell) { assert(xdg_shell); memset(xdg_shell, 0, sizeof(struct wlc_xdg_shell)); if (!(xdg_shell->wl.xdg_shell = wl_global_create(wlc_display(), &zxdg_shell_v6_interface, 1, xdg_shell, xdg_shell_bind))) goto xdg_shell_interface_fail; if (!wlc_source(&xdg_shell->surfaces, "xdg-surface", NULL, NULL, 32, sizeof(struct xdg_surface)) || !wlc_source(&xdg_shell->toplevels, "xdg-toplevel", NULL, NULL, 32, sizeof(struct wlc_resource)) || !wlc_source(&xdg_shell->popups, "xdg-popup", NULL, NULL, 32, sizeof(struct wlc_resource))) goto fail; return xdg_shell; xdg_shell_interface_fail: wlc_log(WLC_LOG_WARN, "Failed to bind xdg_shell interface"); fail: wlc_xdg_shell_release(xdg_shell); return NULL; }
646a1feec00581dda17fc57a330774e1a6831f94
aced0b0b4b73ecb9837500a9b65eb039033e94d3
/Win10_1809_RS5_17754/x86/System32/ntoskrnl.exe/Standalone/_OBJECT_SYMBOLIC_LINK.h
552f291acadfe2391166fc7bd117f31135e52090
[]
no_license
Qazwar/headers
a16193b7343f8497c4dde1f0eb6fee52a0ed91e1
049e8a564a1f82a8316f187f8a8bbcdb29be5e01
refs/heads/master
2020-04-05T15:36:20.462296
2018-11-08T18:53:40
2018-11-08T20:37:03
null
0
0
null
null
null
null
UTF-8
C
false
false
1,162
h
typedef union _LARGE_INTEGER { union { struct { /* 0x0000 */ unsigned long LowPart; /* 0x0004 */ long HighPart; }; /* size: 0x0008 */ struct // _TAG_UNNAMED_10 { /* 0x0000 */ unsigned long LowPart; /* 0x0004 */ long HighPart; } /* size: 0x0008 */ u; /* 0x0000 */ __int64 QuadPart; }; /* size: 0x0008 */ } LARGE_INTEGER, *PLARGE_INTEGER; /* size: 0x0008 */ typedef struct _UNICODE_STRING { /* 0x0000 */ unsigned short Length; /* 0x0002 */ unsigned short MaximumLength; /* 0x0004 */ wchar_t* Buffer; } UNICODE_STRING, *PUNICODE_STRING; /* size: 0x0008 */ typedef struct _OBJECT_SYMBOLIC_LINK { /* 0x0000 */ union _LARGE_INTEGER CreationTime; union { /* 0x0008 */ struct _UNICODE_STRING LinkTarget; struct { /* 0x0008 */ void* Callback /* function */; /* 0x000c */ void* CallbackContext; }; /* size: 0x0008 */ }; /* size: 0x0008 */ /* 0x0010 */ unsigned long DosDeviceDriveIndex; /* 0x0014 */ unsigned long Flags; /* 0x0018 */ unsigned long AccessMask; /* 0x001c */ long __PADDING__[1]; } OBJECT_SYMBOLIC_LINK, *POBJECT_SYMBOLIC_LINK; /* size: 0x0020 */
abef98d66ba15c9881e02eb6e1a179c76db67787
582ec5645c5de30ed8fc815fcbc5d76626171f74
/Sample codes/Sample Code PICDevBugger/PIC18_Board_Test/BoardTest_DB4.X/I2C.h
88215ed696c49741935a0562ae3ee7282763f4a5
[]
no_license
wangy319/can_sorting_machine
9af11c4c4c5cd1fa1c5faed9bc04347b9887fe72
a3d46bf512bcedd1c0e60f6498ec8466468fb34a
refs/heads/master
2021-07-19T16:36:56.636794
2017-10-24T16:11:29
2017-10-24T16:11:29
108,149,353
0
0
null
null
null
null
UTF-8
C
false
false
186
h
void I2C_Master_Init(const unsigned long c); void I2C_Master_Write(unsigned d); unsigned char I2C_Master_Read(unsigned char a); void I2C_Master_Stop(); void delay_10ms(unsigned char n);
8a7fa9987c788d6602305ba364d94fe0fad96b46
5b7d43971eae9f06b81d4c2ae37a12d667b696b3
/mudlib/d/fy/npc/shangguan.c
51cbc710146bfa62408e292efb9c83bd10ba3795
[]
no_license
lostsailboard/fy4
cb6ad743fa0e6dec045e4d5c419b358888fc6a36
b79d809c6e13d49e8bc878302512ad0d18a3e151
refs/heads/master
2021-12-08T06:03:29.100438
2016-02-21T09:03:58
2016-02-21T09:03:58
null
0
0
null
null
null
null
GB18030
C
false
false
4,690
c
// Copyright (C) 1995, by Tie Yu and Daniel Yu. All rights reserved. // This software can not be used, copied, or modified in any form without // the written permission from authors. inherit NPC; inherit F_MASTER; #include <ansi.h> void create() { set_name("上官金虹", ({ "master shangguan", "master", "master shang" }) ); set("nickname", RED"龙凤双环"NOR); set("gender", "男性" ); set("class", "assassin"); set("age", 44); set("cor", 40); set("cps", 30); set("int", 30); set("per", 30); set("ill_boss",5); set("reward_npc", 1); set("difficulty", 30); set("attitude","friendly"); set("max_force", 5000); set("force", 5000); set("force_factor",80+random(50)); set("max_mana",2000); set("mana",2000); set("long", " 一个人正站在桌子前翻阅着,不时用朱笔在卷宗上勾划,批改,嘴里偶而会露出一丝 得意的笑容。他是站着的。他认为一个人只要坐下来,就会令自己的精神松弛,一个 人的精神若松弛,就容易造成错误。 \n" ); create_family("金钱帮 ", 1, "帮主"); set("rank_nogen",0); set("combat_exp", 8000000); set("score", 200+random(200000)); set("agi",25); set("int",30); set("chat_chance_combat", 50); set("chat_msg_combat", ({ (: perform_action, "hammer.longfengshuangfei" :), }) ); set("skill_public",1); set_skill("move", 120); set_skill("parry", 160); set_skill("dodge", 150); set_skill("force", 200); set_skill("literate", 140); set_skill("jingxing",200); set_skill("hammer", 220); set_skill("flame-strike",200); set_skill("unarmed",200); set_skill("jinhong-steps",100); set_skill("longfenghuan",200); map_skill("dodge", "jinhong-steps"); map_skill("hammer", "longfenghuan"); map_skill("parry", "longfenghuan"); map_skill("force", "jingxing"); map_skill("unarmed", "flame-strike"); set("ranks",({"帮众","副香主","香主","副堂主","堂主", "副坛主","坛主","副舵主","舵主", "护法","大护法","副帮主"})); set("rank_levels",({ 32000,64000,128000,256000,512000, 1024000,1536000,2304000,3456000, 5187000,26244000 })); setup(); carry_object(__DIR__"obj/whitecloth")->wear(); carry_object(__DIR__"obj/longfenghuan")->wield(); } void attempt_apprentice(object me) { if ( me->query("class")!="assassin") { message_vision("$N摇了摇头:本帮主要考虑的事很多,要拜师你还是去找荆无命吧。\n",this_object(),me); message_vision("$N淡淡地说:若你对本帮忠心耿耿,我以后自然会指点你一二。\n",this_object()); return 0; } if ((int)me->query("combat_exp") < 3456000 ) { message_vision("$N对$n说道:等你当了本帮的长老再说吧?\n", this_object(),me); return 0; } command ("say 拜师却也免了,想学什么就说吧,我会抽空传你几招的."); } /*void recruit_apprentice(object ob) { if( ::recruit_apprentice(ob) ) ob->set("class", "assassin"); }*/ int recognize_apprentice(object ob){ if(ob->query("class")=="assassin") { if( (int)ob->query("combat_exp") > 1024000 ) return 1; else message_vision("$N对$n说道:等你当了本帮的舵主再说吧?\n", this_object(),ob); } return 0; } void init() { ::init(); add_action("do_killing", "kill"); } int do_killing(string arg) { object player, victim; string id,id_class; player = this_player(); if(!arg || arg == "") return 0; victim = present(arg, environment(player)); if(!objectp(victim)) return notify_fail("这里没有这个人。\n"); if(living(victim)) { id_class=victim->query("class"); id=victim->query("id"); if(id_class == "assassin"&& userp(victim)&& player!=victim) { message_vision(HIW "$N喝道:在我面前杀我帮的弟子,不想活了!\n"NOR, this_object()); this_object()->kill_ob(player); player->kill_ob(this_object()); if (!player->is_busy()) player->start_busy(2); return 0; } } return 0; }
35500524cb2db5e7b345e143b3b012f94aaa5c10
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/drivers/gpu/drm/tegra/extr_fb.c_tegra_fb_is_bottom_up.c
864afee92ae8619142e15955b7516f0a59380de3
[]
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
770
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 */ struct tegra_bo {int flags; } ; struct drm_framebuffer {int dummy; } ; /* Variables and functions */ int TEGRA_BO_BOTTOM_UP ; struct tegra_bo* tegra_fb_get_plane (struct drm_framebuffer*,int /*<<< orphan*/ ) ; bool tegra_fb_is_bottom_up(struct drm_framebuffer *framebuffer) { struct tegra_bo *bo = tegra_fb_get_plane(framebuffer, 0); if (bo->flags & TEGRA_BO_BOTTOM_UP) return true; return false; }
59ec0373903de03297bf72f407a67ef77b217ed9
2c7b01c6f4c64d14c12aa3bcac5c8372ad69a181
/minishell/libft/srcs/ft_memset.c
33e6247904aebd147a39c0a2990e71e4ae40d748
[]
no_license
Mr-Perfection/42
8cbb7a87965fcb69c9cac633f65bb1ff05e36f9e
1f9ff0d8dbb5ea39254c9c8f8d1e9d0020380ce6
refs/heads/master
2021-01-18T22:22:15.250327
2017-06-26T17:37:40
2017-06-26T17:37:40
72,453,777
0
0
null
null
null
null
UTF-8
C
false
false
1,138
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memset.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: slee <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/06/13 09:58:43 by slee #+# #+# */ /* Updated: 2017/06/16 06:49:51 by slee ### ########.fr */ /* */ /* ************************************************************************** */ #include <string.h> void *ft_memset(void *s, int c, size_t n) { unsigned char *uc; size_t i; i = 0; uc = NULL; if (s) { uc = (unsigned char *)s; while (i < n) { uc[i] = (unsigned char)c; i++; } } return (void *)uc; }
e935dfb16210d7d1fa129bcef7349584b5f40e41
a280aa9ac69d3834dc00219e9a4ba07996dfb4dd
/regularexpress/home/weilaidb/work/kernel/linux-3.0.8/arch/x86/include/asm/fixmap.h
b95af1c28fdaa19edfc2170ce35759f1f3e43db6
[]
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
1,919
h
#define _ASM_X86_FIXMAP_H extern unsigned long __FIXADDR_TOP; #define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP) #define FIXADDR_USER_START __fix_to_virt(FIX_VDSO) #define FIXADDR_USER_END __fix_to_virt(FIX_VDSO - 1) #define FIXADDR_TOP (VSYSCALL_END-PAGE_SIZE) #define FIXADDR_USER_START ((unsigned long)VSYSCALL32_VSYSCALL) #define FIXADDR_USER_END (FIXADDR_USER_START + PAGE_SIZE) enum fixed_addresses ; extern void reserve_top_address(unsigned long reserve); #define FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT) #define FIXADDR_BOOT_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) #define FIXADDR_BOOT_START (FIXADDR_TOP - FIXADDR_BOOT_SIZE) extern int fixmaps_set; extern pte_t *kmap_pte; extern pgprot_t kmap_prot; extern pte_t *pkmap_page_table; void __native_set_fixmap(enum fixed_addresses idx, pte_t pte); void native_set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags); static inline void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags) #define set_fixmap(idx, phys) \ __set_fixmap(idx, phys, PAGE_KERNEL) #define set_fixmap_nocache(idx, phys) \ __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) #define clear_fixmap(idx) \ __set_fixmap(idx, 0, __pgprot(0)) #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) extern void __this_fixmap_does_not_exist(void); static __always_inline unsigned long fix_to_virt(const unsigned int idx) static inline unsigned long virt_to_fix(const unsigned long vaddr) static __always_inline unsigned long __set_fixmap_offset(enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags) #define set_fixmap_offset(idx, phys) \ __set_fixmap_offset(idx, phys, PAGE_KERNEL) #define set_fixmap_offset_nocache(idx, phys) \ __set_fixmap_offset(idx, phys, PAGE_KERNEL_NOCACHE)
52dc57ea3c84567d4322338895a9d873410196e4
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/obs-studio/libobs/extr_obs-properties.c_obs_property_frame_rate_options_count.c
81bd8815c6c704cb3fd68df75474170db7357637
[]
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
881
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 */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {size_t num; } ; struct frame_rate_data {TYPE_1__ extra_options; } ; typedef int /*<<< orphan*/ obs_property_t ; /* Variables and functions */ int /*<<< orphan*/ OBS_PROPERTY_FRAME_RATE ; struct frame_rate_data* get_type_data (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; size_t obs_property_frame_rate_options_count(obs_property_t *p) { struct frame_rate_data *data = get_type_data(p, OBS_PROPERTY_FRAME_RATE); return data ? data->extra_options.num : 0; }
3281b4f2354d9cad0370113506c50f37f813f621
4e298b59e91f9088f36e9c488eb8c062b8a16c07
/open/death/room/npc/king-1.c
7ad6c7a99e7c2e45cf9c209e6c7355d32687c907
[]
no_license
HexColors60/fs2
07714b1dbd27d666febf7ccc5e8d3476edaf0146
c1bc56122142ac741d2432551508d04c9be4694e
refs/heads/master
2021-05-27T11:06:07.272106
2012-08-03T04:15:15
2012-08-03T04:15:15
null
0
0
null
null
null
null
GB18030
C
false
false
4,943
c
#include <ansi.h> inherit NPC; void do_special(); void use_poison(object me, object viction); mapping *action = ({ ([ "action" : "$N怒吼一声,用庞大的身躯向$n直扑而来", "dodge" : -20, "parry" : -20, "damage" : 25, "damage_type": "骨折" ]), ([ "action" : "$N抽身一跃,双手抱膝成球状撞向$n,威力万钧,正是一招‘火龙金魔体’", "dodge" : -30, "parry" : 25, "damage" : 40, "damage_type": "骨折", ]), ([ "action" : "$N身法忽变,一招‘魔风鬼爪’身体随风而动,飘乎不定,巨爪出手诡异,抓向$n", "dodge" : -35, "parry" : 15, "damage" : 65, "damage_type": "抓伤", "post_action" : (: use_poison :) ]), ([ "action" : "$N高声长啸,一招‘魔音穿脑’,震得$n七孔渗血", "dodge" : -20, "parry" : 25, "damage" : 90, "damage_type": "内伤" ]), ([ "action" : "$N双膝微屈,做跪拜投降之势,却趁机双爪猛攻$n下盘,正是一招‘鬼魅拜月’", "dodge" : 30, "parry" : -30, "damage" : 160, "force" : 160, "damage_type": "抓伤", "post_action" : (: use_poison :) ]), ([ "action" : "$N身形一转使出‘恶鬼招魂’,霎时风声鹤唳,爪影重重,忽的一爪成弧状划向$n的喉咙", "dodge" : -50, "parry" : 15, "damage" : 130, "force" : 60, "damage_type": "割伤", "weapon" : "毒爪", "post_action" : (: use_poison :) ]), ([ "action" : "$N狂啸一声,使出‘灭天绝地暴风掌’,刹那间掌影已拢罩$n的全身", "dodge" : -35, "parry" : -35, "damage" : 230, "force" : 200, "damage_type": "内伤", ]), ([ "action" : "$N脸色一沈,集全灵之力,使出必杀招‘魔极之源’", "dodge" : 40, "parry" : -50, "damage" : 200, "force" : 180, "damage_type": "割伤", "weapon" : "毒爪", "post_action" : (: use_poison :) ]), }); void create() { set_name("秦广明王",({"king chin kuang","king","chin","kuang"})); set("race", "妖魔"); set("age",1000); set("long","你看的一个威严的老者,正手捻胡须,双目精光逼视着你,仿佛要看进你内心深处\n"); set("str",30); set("cps",30); set("kar",20); set("spe",20); set("int",20); set("cor",30); set("limbs", ({"头部", "胸部", "腿部", "手臂"}) ); set("verbs", ({ "bite"})); set("attitude","herosim"); set("combat_exp",100000); set_skill("dodge",260); set_skill("unarmed",200); set("chat_chance",10); set("chat_msg",({ "有心为善,虽善不赏;无心为恶,虽恶不罚。\n", "既然来到地狱,就该有接受酷刑的准备。\n", })); set("chat_chance_combat",200); set("chat_msg_combat",({ (: do_special :) })); set_temp("apply/defend",100000); set_temp("apply/armor",100000); setup(); set("default_actions", (: call_other, __FILE__,"query_action" :)); reset_action(); } mapping query_action() { return action[random(sizeof(action))]; } void use_poison(object me, object viction) { // here can write many thing u want viction->apply_condition("dark_poison",100+viction->query_condition("dark_poi son") ); } void do_special() { object *enemy,target; int i; enemy=this_object()->query_enemy(); i=sizeof(enemy); target=enemy[random(i)]; message_vision( HIY "\n夜叉大喝一声,看我的‘夜叉独门绝技’~~~毒 龙 钻\n",target); message_vision( HIB "\n夜叉手上的双爪突然快速旋转由意想不到的位置攻击!!\n"NOR,target); target->receive_wound("kee",random(50+100)); COMBAT_D->report_status(target); }
ed1c0bb622b03474d53db7c5516220da97d02239
f3afcc93f79444d3c6925bc95c4c1e45f514da07
/lib/mongoose/test/index_cgi.c
86caa6610f2eaef9f205b7305455facf7bcb1f9c
[ "GPL-2.0-only", "LicenseRef-scancode-commercial-license", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license", "BSD-3-Clause" ]
permissive
aliustaoglu/bitty
6b5c2a038e471744c8393de33ff9afec9baa0bbc
6289eed94ab3504204ce82e06a1ef9940dd6283b
refs/heads/main
2023-06-03T04:12:51.330088
2021-06-15T08:20:32
2021-06-15T08:20:32
345,917,473
0
0
BSD-3-Clause
2021-03-09T07:20:53
2021-03-09T07:20:53
null
UTF-8
C
false
false
1,873
c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ccgi.h> extern char **environ; #ifdef _WIN32 #define EOL "\n" #else #define EOL "\r\n" #endif int alpha_cmp(const void *a, const void *b) { return strcmp(*(const char **) a, *(const char **) b); } int main(void) { puts("Content-Type: text/html" EOL "Status: 201 Created" EOL EOL); puts("<pre>" EOL "<h1>Environment</h1>" EOL); { const char *sorted_env[500]; size_t i, num_env; for (num_env = 0; environ[num_env] != 0; num_env++) { sorted_env[num_env] = environ[num_env]; } qsort(sorted_env, num_env, sizeof(const char *), alpha_cmp); for (i = 0; i < num_env; i++) { printf("E: %s" EOL, sorted_env[i]); } } puts(EOL "<h1>Query string</h1>" EOL); { const char *k; CGI_varlist *vl = CGI_get_query(NULL); for (k = CGI_first_name(vl); k != NULL; k = CGI_next_name(vl)) { printf("Q: %s=%s" EOL, k, CGI_lookup(vl, k)); } CGI_free_varlist(vl); } puts(EOL "<h1>Form variables</h1>" EOL); { const char *k; CGI_varlist *vl = CGI_get_post(NULL, NULL); for (k = CGI_first_name(vl); k != NULL; k = CGI_next_name(vl)) { printf("P: %s=%s" EOL, k, CGI_lookup(vl, k)); } CGI_free_varlist(vl); } puts(EOL "</pre>" EOL); return 0; } /* Some functions for libccgi that are missing on Windows (VC6). */ #ifdef _WIN32 static int lowercase(const char *s) { return tolower(*(const unsigned char *) s); } int strncasecmp(const char *s1, const char *s2, size_t len) { int diff = 0; if (len > 0) do { diff = lowercase(s1++) - lowercase(s2++); } while (diff == 0 && s1[-1] != '\0' && --len > 0); return diff; } int strcasecmp(const char *s1, const char *s2) { return strncasecmp(s1, s2, (size_t) ~0); } int mkstemp(char *template) { return -1; /* Not used by us. */ } #endif
5538070ee38e2aa067c104803b2886b95d283c0a
dd00d69c0c8c7e09c060930e383a30874e7c4b8f
/Earth/test/DNAsymmetry.C
2d939447ccf78f37640d877882cff087a864ed9b
[]
no_license
thuxwr/SolarNu
035b92ecaaa1999886b44ba1ca94095b9dbc8feb
aca1cd5349914ac203caacea8b489386d4b27a42
refs/heads/master
2020-04-09T03:26:24.546474
2018-12-01T20:47:32
2018-12-01T20:47:32
159,982,516
0
0
null
null
null
null
UTF-8
C
false
false
2,046
c
/* See the effect of earth MSW. Only B8 is calculated. Draw 2*(Flux_night - Flux_day)/(Flux_night + Flux_day) as function of theta and mass. Use GS98 for flux info. Weiran, Mar. 15, 2018. */ #include "../../SurvProb/SurvProb.h" #include "../../Solar/SolarNu.h" #include "TGraph.h" #include "TH1D.h" #include "TH2D.h" #include <iostream> #include "TMath.h" SurvProb surv(3); SolarNu solar; using namespace std; double nueflux(double sin_2_t12, double ms12, int daynight); /* Drawing 100 points costs about 1 sec. So only 1 core for this work. */ int main() { int nbinstheta = 300; int nbinsmass = 300; TH2D* earth = new TH2D("earth", "", nbinstheta, 0.1, 0.9, nbinsmass, 1e-5, 15e-5); for(int binx=1; binx<=nbinstheta; binx++) for(int biny=1; biny<=nbinsmass; biny++) { double tan_2_t12 = earth->GetXaxis()->GetBinCenter(binx); double sin_2_t12 = tan_2_t12 / (1 + tan_2_t12); double ms12 = earth->GetYaxis()->GetBinCenter(biny); double fluxday = nueflux(sin_2_t12, ms12, 0); double fluxnight = nueflux(sin_2_t12, ms12, 1); double dif = 2 * (fluxnight-fluxday)/(fluxday+fluxnight); if(dif<=1e-4) dif = 1e-4; //Since I want to set logz, dif should not be zero. earth->SetBinContent(binx, biny, dif); } earth->GetXaxis()->SetTitle("tan^{2}#theta_{12}"); earth->GetYaxis()->SetTitle("#Delta m^{2}_{12} [eV^{2}]"); earth->SetStats(kFALSE); earth->SaveAs("./result/SKEarthAffectRegion.root"); return 0; } double nueflux(double sin_2_t12, double ms12, int daynight) { double flux = 0; int model = 1; for(int comp=6; comp<=6; comp++) { TGraph* survprob = surv.GetProb(sin_2_t12, ms12, comp, daynight, "e", "SK"); TH1D* spec = solar.GetSpec(model, comp); int nbins = spec->GetNbinsX(); double binwidth = spec->GetBinWidth(1); for(int bin=1; bin<=nbins; bin++) { double energy = spec->GetBinCenter(bin); double dflux = spec->GetBinContent(bin); double prob = survprob->Eval(energy); flux += dflux * binwidth * prob; } delete survprob; delete spec; } return flux; }
7232a1ef2e7007cab9d8eb2cb1476ba6f2ea54cf
971c5ae1d87cdfbb97723485c3d76c17395b82b0
/x86-semantics/tests/gcc.c-torture/job_601_1465/src/980223.c
56d7212da86372375600fd7b09f6a55e8c3d4c52
[ "NCSA" ]
permissive
mewbak/binary-decompilation
7d0bf64d6cd01bfa5f5fc912d74a85ce81124959
f58da4c53cd823edc4bbbad6b647dbcefd7e64f8
refs/heads/master
2020-04-16T06:08:14.983946
2019-01-06T17:21:50
2019-01-06T17:21:50
165,334,058
1
0
NOASSERTION
2019-01-12T01:42:16
2019-01-12T01:42:16
null
UTF-8
C
false
false
629
c
#include "mini_string.h" #include "mini_stdlib.h" typedef struct { char *addr; long type; } object; object bar (object blah) { abort(); } object foo (object x, object y) { object z = *(object*)(x.addr); if (z.type & 64) { y = *(object*)(z.addr+sizeof(object)); z = *(object*)(z.addr); if (z.type & 64) y = bar(y); } return y; } int nil; object cons1[2] = { {(char *) &nil, 0}, {(char *) &nil, 0} }; object cons2[2] = { {(char *) &cons1, 64}, {(char *) &nil, 0} }; main() { object x = {(char *) &cons2, 64}; object y = {(char *) &nil, 0}; object three = foo(x,y); return 0; }
a8ee83f61004a0865ac02ebb0f0635ab54db255a
75859787b3eb1fc054b5df82c26bc261421d47e0
/3rdparty/genFiles/IRAT-ParametersGERAN-v920.c
7a0eb26737f25e181794c201be40c6bf8e2c8903
[]
no_license
aa7133/RRC
e118b3d769abff4b0b42d7511530f7b1cc29d09e
955c1ceadebf97d21306f3c083b5f38a24838da4
refs/heads/master
2020-12-10T10:45:56.892861
2020-01-26T13:02:20
2020-01-26T13:02:20
233,563,734
0
1
null
null
null
null
UTF-8
C
false
false
5,513
c
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "EUTRA-RRC-Definitions" * found in "../asnFiles/36331-f60-ASNfunctions.asn" * `asn1c -fcompound-names -findirect-choice -fincludes-quoted -fno-include-deps -gen-PER -no-gen-OER -D.` */ #include "IRAT-ParametersGERAN-v920.h" /* * This type is implemented using NativeEnumerated, * so here we adjust the DEF accordingly. */ /* * This type is implemented using NativeEnumerated, * so here we adjust the DEF accordingly. */ static asn_per_constraints_t asn_PER_type_dtm_r9_constr_2 CC_NOTUSED = { { APC_CONSTRAINED, 0, 0, 0, 0 } /* (0..0) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_type_e_RedirectionGERAN_r9_constr_4 CC_NOTUSED = { { APC_CONSTRAINED, 0, 0, 0, 0 } /* (0..0) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static const asn_INTEGER_enum_map_t asn_MAP_dtm_r9_value2enum_2[] = { { 0, 9, "supported" } }; static const unsigned int asn_MAP_dtm_r9_enum2value_2[] = { 0 /* supported(0) */ }; static const asn_INTEGER_specifics_t asn_SPC_dtm_r9_specs_2 = { asn_MAP_dtm_r9_value2enum_2, /* "tag" => N; sorted by tag */ asn_MAP_dtm_r9_enum2value_2, /* N => "tag"; sorted by N */ 1, /* Number of elements in the maps */ 0, /* Enumeration is not extensible */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_dtm_r9_tags_2[] = { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_dtm_r9_2 = { "dtm-r9", "dtm-r9", &asn_OP_NativeEnumerated, asn_DEF_dtm_r9_tags_2, sizeof(asn_DEF_dtm_r9_tags_2) /sizeof(asn_DEF_dtm_r9_tags_2[0]) - 1, /* 1 */ asn_DEF_dtm_r9_tags_2, /* Same as above */ sizeof(asn_DEF_dtm_r9_tags_2) /sizeof(asn_DEF_dtm_r9_tags_2[0]), /* 2 */ { 0, &asn_PER_type_dtm_r9_constr_2, NativeEnumerated_constraint }, 0, 0, /* Defined elsewhere */ &asn_SPC_dtm_r9_specs_2 /* Additional specs */ }; static const asn_INTEGER_enum_map_t asn_MAP_e_RedirectionGERAN_r9_value2enum_4[] = { { 0, 9, "supported" } }; static const unsigned int asn_MAP_e_RedirectionGERAN_r9_enum2value_4[] = { 0 /* supported(0) */ }; static const asn_INTEGER_specifics_t asn_SPC_e_RedirectionGERAN_r9_specs_4 = { asn_MAP_e_RedirectionGERAN_r9_value2enum_4, /* "tag" => N; sorted by tag */ asn_MAP_e_RedirectionGERAN_r9_enum2value_4, /* N => "tag"; sorted by N */ 1, /* Number of elements in the maps */ 0, /* Enumeration is not extensible */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_e_RedirectionGERAN_r9_tags_4[] = { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_e_RedirectionGERAN_r9_4 = { "e-RedirectionGERAN-r9", "e-RedirectionGERAN-r9", &asn_OP_NativeEnumerated, asn_DEF_e_RedirectionGERAN_r9_tags_4, sizeof(asn_DEF_e_RedirectionGERAN_r9_tags_4) /sizeof(asn_DEF_e_RedirectionGERAN_r9_tags_4[0]) - 1, /* 1 */ asn_DEF_e_RedirectionGERAN_r9_tags_4, /* Same as above */ sizeof(asn_DEF_e_RedirectionGERAN_r9_tags_4) /sizeof(asn_DEF_e_RedirectionGERAN_r9_tags_4[0]), /* 2 */ { 0, &asn_PER_type_e_RedirectionGERAN_r9_constr_4, NativeEnumerated_constraint }, 0, 0, /* Defined elsewhere */ &asn_SPC_e_RedirectionGERAN_r9_specs_4 /* Additional specs */ }; asn_TYPE_member_t asn_MBR_IRAT_ParametersGERAN_v920_1[] = { { ATF_POINTER, 2, offsetof(struct IRAT_ParametersGERAN_v920, dtm_r9), (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_dtm_r9_2, 0, { 0, 0, 0 }, 0, 0, /* No default value */ "dtm-r9" }, { ATF_POINTER, 1, offsetof(struct IRAT_ParametersGERAN_v920, e_RedirectionGERAN_r9), (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_e_RedirectionGERAN_r9_4, 0, { 0, 0, 0 }, 0, 0, /* No default value */ "e-RedirectionGERAN-r9" }, }; static const int asn_MAP_IRAT_ParametersGERAN_v920_oms_1[] = { 0, 1 }; static const ber_tlv_tag_t asn_DEF_IRAT_ParametersGERAN_v920_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_IRAT_ParametersGERAN_v920_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* dtm-r9 */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* e-RedirectionGERAN-r9 */ }; asn_SEQUENCE_specifics_t asn_SPC_IRAT_ParametersGERAN_v920_specs_1 = { sizeof(struct IRAT_ParametersGERAN_v920), offsetof(struct IRAT_ParametersGERAN_v920, _asn_ctx), asn_MAP_IRAT_ParametersGERAN_v920_tag2el_1, 2, /* Count of tags in the map */ asn_MAP_IRAT_ParametersGERAN_v920_oms_1, /* Optional members */ 2, 0, /* Root/Additions */ -1, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_IRAT_ParametersGERAN_v920 = { "IRAT-ParametersGERAN-v920", "IRAT-ParametersGERAN-v920", &asn_OP_SEQUENCE, asn_DEF_IRAT_ParametersGERAN_v920_tags_1, sizeof(asn_DEF_IRAT_ParametersGERAN_v920_tags_1) /sizeof(asn_DEF_IRAT_ParametersGERAN_v920_tags_1[0]), /* 1 */ asn_DEF_IRAT_ParametersGERAN_v920_tags_1, /* Same as above */ sizeof(asn_DEF_IRAT_ParametersGERAN_v920_tags_1) /sizeof(asn_DEF_IRAT_ParametersGERAN_v920_tags_1[0]), /* 1 */ { 0, 0, SEQUENCE_constraint }, asn_MBR_IRAT_ParametersGERAN_v920_1, 2, /* Elements count */ &asn_SPC_IRAT_ParametersGERAN_v920_specs_1 /* Additional specs */ };
4bf4bc2b761d4aa2a3b09e10188d6a3c77a8a076
26922ce0f33589caea1bdaae0aacc972d4bbb167
/microchip library/apps/usb/device/hid_keyboard/firmware/low_pin_count_usb_development_kit_pic16f1459.x/system.c
cceaf194ec7df634e4b8d94904b766ae9964f0b4
[]
no_license
alexandrequ/scalar4
d3afe3b09faf6731009593b71bf971d9d862d44d
deda54a12a635720f79fee3b7ce710b124fda087
refs/heads/main
2023-03-04T09:03:20.256507
2021-02-15T20:05:24
2021-02-15T20:05:24
339,189,700
0
0
null
null
null
null
UTF-8
C
false
false
6,597
c
/******************************************************************************* Copyright 2016 Microchip Technology Inc. (www.microchip.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. To request to license the code under the MLA license (www.microchip.com/mla_license), please contact [email protected] *******************************************************************************/ #include "system.h" #include "usb.h" #include "usb_device.h" #include "leds.h" /** CONFIGURATION Bits **********************************************/ // PIC16F1459 configuration bit settings: #if defined (USE_INTERNAL_OSC) // Define this in system.h if using the HFINTOSC for USB operation // CONFIG1 #pragma config FOSC = INTOSC // Oscillator Selection Bits (INTOSC oscillator: I/O function on CLKIN pin) #pragma config WDTE = OFF // Watchdog Timer Enable (WDT disabled) #pragma config PWRTE = OFF // Power-up Timer Enable (PWRT disabled) #pragma config MCLRE = OFF // MCLR Pin Function Select (MCLR/VPP pin function is digital input) #pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled) #pragma config BOREN = ON // Brown-out Reset Enable (Brown-out Reset enabled) #pragma config CLKOUTEN = OFF // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin) #pragma config IESO = OFF // Internal/External Switchover Mode (Internal/External Switchover Mode is disabled) #pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is disabled) // CONFIG2 #pragma config WRT = OFF // Flash Memory Self-Write Protection (Write protection off) #pragma config CPUDIV = NOCLKDIV// CPU System Clock Selection Bit (NO CPU system divide) #pragma config USBLSCLK = 48MHz // USB Low SPeed Clock Selection bit (System clock expects 48 MHz, FS/LS USB CLKENs divide-by is set to 8.) #pragma config PLLMULT = 3x // PLL Multipler Selection Bit (3x Output Frequency Selected) #pragma config PLLEN = ENABLED // PLL Enable Bit (3x or 4x PLL Enabled) #pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable (Stack Overflow or Underflow will cause a Reset) #pragma config BORV = LO // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.) #pragma config LPBOR = OFF // Low-Power Brown Out Reset (Low-Power BOR is disabled) #pragma config LVP = OFF // Low-Voltage Programming Enable (High-voltage on MCLR/VPP must be used for programming) #else // CONFIG1 #pragma config FOSC = HS // Oscillator Selection Bits (HS Oscillator, High-speed crystal/resonator connected between OSC1 and OSC2 pins) #pragma config WDTE = OFF // Watchdog Timer Enable (WDT disabled) #pragma config PWRTE = OFF // Power-up Timer Enable (PWRT disabled) #pragma config MCLRE = OFF // MCLR Pin Function Select (MCLR/VPP pin function is digital input) #pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled) #pragma config BOREN = ON // Brown-out Reset Enable (Brown-out Reset enabled) #pragma config CLKOUTEN = OFF // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin) #pragma config IESO = OFF // Internal/External Switchover Mode (Internal/External Switchover Mode is disabled) #pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is disabled) // CONFIG2 #pragma config WRT = OFF // Flash Memory Self-Write Protection (Write protection off) #pragma config CPUDIV = NOCLKDIV// CPU System Clock Selection Bit (NO CPU system divide) #pragma config USBLSCLK = 48MHz // USB Low SPeed Clock Selection bit (System clock expects 48 MHz, FS/LS USB CLKENs divide-by is set to 8.) #pragma config PLLMULT = 4x // PLL Multipler Selection Bit (4x Output Frequency Selected) #pragma config PLLEN = ENABLED // PLL Enable Bit (3x or 4x PLL Enabled) #pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable (Stack Overflow or Underflow will cause a Reset) #pragma config BORV = LO // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.) #pragma config LPBOR = OFF // Low-Power Brown Out Reset (Low-Power BOR is disabled) #pragma config LVP = OFF // Low-Voltage Programming Enable (High-voltage on MCLR/VPP must be used for programming) #endif /********************************************************************* * Function: void SYSTEM_Initialize( SYSTEM_STATE state ) * * Overview: Initializes the system. * * PreCondition: None * * Input: SYSTEM_STATE - the state to initialize the system into * * Output: None * ********************************************************************/ void SYSTEM_Initialize( SYSTEM_STATE state ) { switch(state) { case SYSTEM_STATE_USB_START: #if defined(USE_INTERNAL_OSC) //Make sure to turn on active clock tuning for USB full speed //operation from the INTOSC OSCCON = 0xFC; //HFINTOSC @ 16MHz, 3X PLL, PLL enabled ACTCON = 0x90; //Active clock tuning enabled for USB #endif LED_Enable(LED_USB_DEVICE_STATE); LED_Enable(LED_USB_DEVICE_HID_KEYBOARD_CAPS_LOCK); BUTTON_Enable(BUTTON_USB_DEVICE_HID_KEYBOARD_KEY); break; case SYSTEM_STATE_USB_SUSPEND: break; case SYSTEM_STATE_USB_RESUME: break; } } #if(__XC8_VERSION < 2000) #define INTERRUPT interrupt #else #define INTERRUPT __interrupt() #endif void INTERRUPT SYS_InterruptHigh(void) { #if defined(USB_INTERRUPT) USBDeviceTasks(); #endif }
6722b86d6f8a7a744ca13f1d9728768c97d3db53
c5ee390344aa72c730ca27eff709edc046081061
/nitan4/d/taohua/songlin.c
3fbfa8622f57748134a2cfad092ab41fbcb433f0
[]
no_license
DoubleIce/Mud_NitanVersions
fb58143f4840c7a887b756215229ed4e0a5e62d9
2ab430649b29a611008b7cc765b4500b2702841a
refs/heads/master
2021-05-14T10:05:48.157950
2018-01-23T01:40:38
2018-01-23T01:40:38
116,339,674
0
0
null
null
null
null
GB18030
C
false
false
742
c
// Copyright (C) 2003, by Lonely. All rights reserved. // This software can not be used, copied, or modified // in any form without the written permission from authors. inherit ROOM; void create() { set("short", "松柏林"); set("long", @LONG 这座松柏林每株树木之间错落有致,枝条交互掩映,抬头望去,松针 柏叶密密重重,遮云蔽日,但林中却光线充足,纤毫毕现。真不知是天然 生就,还是妙手偶得。林中一条小径斗折蛇行,指向北方。东北面似乎有 一排竹林。 LONG ); set("exits", ([ "south" : __DIR__"caodi", "west" : __DIR__"songlin2", ])); set("outdoors", "taohua"); setup(); replace_program(ROOM); }
a2e5f8529a3d86968da266242edfc8efbed9a50f
9e4f169360290b4dc4835a36201b2c14205f1701
/server/net/az_xkernel/protocols/blast/blast_stack.h
8876752cfb372b5267a4fcbbb032277a99f712cd
[ "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-unknown-license-reference" ]
permissive
mmdriley/mach_us
a4495df68e2c623b2ac32346b4633ad9769dec7c
2bb26850b73ad9a71ed085a3bed68dc6e8c1e849
refs/heads/master
2020-04-09T11:45:26.955346
2018-12-04T08:17:33
2018-12-04T08:17:33
160,322,802
0
0
null
null
null
null
UTF-8
C
false
false
519
h
/* * blast_stack.h * * x-kernel v3.2 * * Copyright (c) 1993,1991,1990 Arizona Board of Regents * * * $Revision: 1.2 $ * $Date: 1993/02/01 22:21:34 $ */ typedef struct stack { VOID **a; int max; int top; /* First available entry. 0 => empty stack */ } *Stack; #ifdef __STDC__ Stack stackCreate( int size ); VOID * stackPop( Stack ); int stackPush( Stack, VOID *); void stackDestroy( Stack ); #else Stack stackCreate(); VOID * stackPop(); int stackPush(); void stackDestroy(); #endif
99dc2f307c1a129ac26c7227dad8f11632740971
406bbdacd14000771f17457312909bdb3823e7d2
/2-api/va_list/va_list1.c
adcd0aab7da1daabe108648ab200b42c0c692918
[]
no_license
shi-hao/c_language_study
f1c9212eeb68fcec408b1bed27032431a4682e1f
ffeee77ddd820fc3e7732cd442cda3b90c8ad0ff
refs/heads/master
2022-09-16T10:29:42.571224
2022-09-16T07:21:09
2022-09-16T07:21:09
158,184,807
2
0
null
null
null
null
UTF-8
C
false
false
2,508
c
/* ************************************************************************ * 实现一个可变参数函数,功能类似printf()函数,支持%s,%d,%f打印参数。 * * 此函数的实现适合在嵌入式平台下,通过一些物理接口打印数据,比如串口, * 将输出函数替换为对应的物理接口的输出函数即可实现格式化打印的功能。 * * 要求:对应的编译环境支持C库函数va_list,sprintf函数。 * 输入整形和浮点数据长度不能超过19 * * va_list() va_start() va_arg() va_end() * sprintf() * putchar() ************************************************************************* */ #include<stdarg.h> #include<stdio.h> void my_printf(const char* fmt,...) { /*定义一个va_list量*/ va_list ap; int tmp; double tmpDouble; char *p; char buff[20]={0}; int cnt=0; va_start(ap, fmt); /*根据fmt的内容获取可变参数*/ for(;*fmt;fmt++){ /*第一步,判断是否是格式符,不是直接输出*/ if(*fmt != '%'){ #if 1 /*根据不同平台,调用对应的输出接口*/ putchar(*fmt); #endif continue; } /*第二步,如果是格式符,则判断下一个字符*/ fmt++; /*第三步,如果是结束符,则直接退出*/ if(*fmt == '\0'){ break; } /*根据不同的格式,执行不同的操作*/ switch(*fmt){ case 'd': //按照十进制输出 tmp = va_arg(ap, int);//取出下一个参数 sprintf(buff,"%d",tmp);//将int数据转化为字符串 #if 1 /*根据不同平台,调用对应的输出接口*/ for(cnt=0;buff[cnt];cnt++){ putchar(buff[cnt]); } #endif break; case 's': //按照字符串输出 p = (char *)va_arg(ap, char *); #if 1 /*根据不同平台,调用对应的输出接口*/ for(;*p;p++){ putchar(*p); } #endif break; case 'f': //输出浮点数 tmpDouble = va_arg(ap, double);//取出下一个参数 sprintf(buff,"%f",tmpDouble);//将浮点数据转化为字符串 #if 1 /*根据不同平台,调用对应的输出接口*/ for(cnt=0;buff[cnt];cnt++){ putchar(buff[cnt]); } #endif break; case '%'://输出百分%% #if 1 putchar('%'); #endif break; default: //默认处理 break; } } va_end(ap); } /*测试函数*/ void main(){ my_printf("%d\n",123); my_printf("str1=%s,str2=%s,str3=%s\n","123","45","7890"); my_printf("%f\n",123.123); my_printf("%%\n"); my_printf("%x\n"); }
e4548a05a7f831d6580cb60a87a2f4dfe8bb713f
83214753e9183327e98af0e6768e9be5385e5282
/kungfu/class/wudang/yan.c
ea5cf194659a91dca9f990f63ca5e78ace3ef6bc
[]
no_license
MudRen/hymud
f5b3bb0e0232f23a48cb5f1db2e34f08be99614e
b9433df6cf48e936b07252b15b60806ff55bb2f3
refs/heads/main
2023-04-04T22:44:23.880558
2021-04-07T15:45:16
2021-04-07T15:45:16
318,484,633
1
5
null
null
null
null
GB18030
C
false
false
5,379
c
// yan.c 俞岱岩 #include <ansi.h> inherit NPC; inherit F_MASTER; void create() { set_name("俞岱岩", ({ "yu daiyan", "yu" })); set("nickname", "武当三侠"); set("long", "他就是张三丰的最不幸的弟子、武当七侠之三的俞岱岩。\n" "身穿一件干干净净的青布长衫。\n" "他不过三十出头年纪,双腿残废,张真人命他主持真武剑阵。\n"); set("gender", "男性"); set("age", 31); set("attitude", "peaceful"); set("class", "swordsman"); set("shen_type", 1); set("str", 28); set("int", 30); set("con", 28); set("dex", 28); set("max_qi", 8000); set("max_jing", 8000); set("neili", 3500); set("max_neili", 12500); set("jingli", 1000); set("max_jingli", 1000); set("jiali", 50); set("combat_exp", 1550000); set("score", 60000); set_skill("force", 200); set_skill("taiji-shengong", 200); set_skill("dodge", 150); set_skill("tiyunzong", 250); set_skill("unarmed",200); set_skill("taiji-quan", 200); set_skill("parry", 200); set_skill("sword", 200); set_skill("claw", 150); set_skill("strike", 150); set_skill("hand", 180); set_skill("paiyun-shou", 180); set_skill("shenmen-jian", 180); set_skill("yitian-zhang", 180); set_temp("apply/attack",150); set_temp("apply/defense",150); set_temp("apply/armor",500); set_temp("apply/damage",400); map_skill("force", "taiji-shengong"); map_skill("dodge", "tiyunzong"); map_skill("unarmed", "taiji-quan"); map_skill("parry", "paiyun-shou"); map_skill("sword", "taiji-jian"); map_skill("hand", "paiyun-shou"); map_skill("strike", "yitian-zhang"); //prepare_skill("hand", "paiyun-shou"); //prepare_skill("strike", "yitian-zhang"); set("chat_chance_combat", 90); set("chat_msg_combat", ({ (: perform_action, "dodge.zong" :), (: perform_action, "unarmed.zhenup" :), (: perform_action, "unarmed.zhan" :), (: perform_action, "unarmed.ji" :), (: perform_action, "unarmed.jielidali" :), (: perform_action, "sword.lian" :), (: perform_action, "sword.chan" :), (: perform_action, "sword.chanup" :), (: perform_action, "sword.sui" :), (: perform_action, "sword.lian" :), (: perform_action, "sword.lian" :), (: perform_action, "sword.lian" :), }) ); set("chat_chance", 1); set("chat_msg", ({ "俞岱岩说道:真武剑阵是恩师的心血。", "俞岱岩仰天叹道:哪位巫师能治好我的腿,我也请鸭庄一顿。" })); create_family("武当派", 2, "弟子"); setup(); carry_object("/clone/weapon/changjian")->wield(); carry_object("/d/wudang/obj/bluecloth")->wear(); } void init() { object ob; ::init(); if( interactive(ob = this_player()) && !is_fighting() ) { remove_call_out("greeting"); call_out("greeting",3 , ob); } } void greeting(object ob) { int i; if (environment(ob)->query("short")=="南岩宫高台"){ if (!ob) return; if (((int)ob->query_skill("taiji-shengong", 1) == 0)) { message_vision(CYN"十三弟子对$N齐声喝道:你这个邪魔外道,敢来真武剑阵?\n\n"NOR,ob); ob->set("qi",30); // if ((int)ob->query("combat_exp") <2000) ob->set("combat_exp",1); // else ob->add("combat_exp",-1000); message_vision(CYN"真武剑阵顿时启动,高台上剑气纵横,把$N围在中央。\n"NOR,ob); message_vision(CYN"十三口长剑齐出,在$N身上划出了十三道口子,鲜血淋漓。\n"NOR,ob); say(CYN"\n\n俞岱岩脸现怒容:“邪魔外道,也敢闯真武剑阵!”\n"); message_vision("俞岱岩居高临下,起手一掌把$N劈落高台。\n\n\n"NOR,ob); ob->unconcious(); ob->move("/d/wudang/nanyangong"); CHANNEL_D->do_channel(this_object(),"chat",sprintf("%s 私闯真武剑阵,念其成长不易,暂免一死!",ob->name(1))); } } } void attempt_apprentice(object me) { if ((int)me->query("guarded") < 3) { command("say " + RANK_D->query_respect(me) + "你对我武当派尽了多少心力,有几分忠心呢?"); return; } if ((int)me->query_skill("taiji-shengong", 1) < 30) { command("say 我武当派乃内家武功,最重视内功心法。"); command("say " + RANK_D->query_respect(me) + "是否还应该在太极神功上多下点功夫?"); return; } if ((int)me->query("shen") < 1000) { command("say 我武当乃是堂堂名门正派,对弟子要求极严。"); command("say 在德行方面," + RANK_D->query_respect(me) + "是否还做得不够?"); return; } command("say 好吧,我就收下你了。"); command("recruit " + me->query("id")); }
c8cb434904f452c41eb710da5bc2042a20d9c6a3
c4c62caff67517a608102a97577e9cd01ebd6624
/growhouse/end-devices/gecko_sdk_suite/v2.3/protocol/zigbee/app/ezsp-host/ezsp-host-queues.h
1a8ed831983f06148d6a164535cd7c9d8409e83f
[]
no_license
ArrowElectronics/Growhouse
30ab3b6990206490b12188e7cc9a2982fc47f711
0d2eb763947be25704eb23f58da09a27319c7427
refs/heads/master
2023-02-17T15:07:34.363647
2021-01-19T17:02:44
2021-01-19T17:02:44
265,281,716
5
2
null
2020-06-03T10:14:03
2020-05-19T15:10:20
C
UTF-8
C
false
false
6,175
h
/******************************************************************************/ /** * @file ezsp-host-queues.h * @brief Header for EZSP host queue functions * * See @ref ezsp_util for documentation. * ******************************************************************************* * @section License * <b>(C) Copyright 2015 Silicon Labs, www.silabs.com</b> ******************************************************************************* * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no * obligation to support this Software. Silicon Labs is providing the * Software "AS IS", with no express or implied warranties of any kind, * including, but not limited to, any implied warranties of merchantability * or fitness for any particular purpose or warranties against infringement * of any proprietary rights of a third party. * * Silicon Labs will not be liable for any consequential, incidental, or * special damages, or any other relief, or for any claim by any third party, * arising from your use of this Software. * ******************************************************************************/ /** @addtogroup ezsp_util * * See ezsp-host-queues.h. * *@{ */ #ifndef SILABS_EZSP_HOST_QUEUE_H #define SILABS_EZSP_HOST_QUEUE_H /** @brief The number of transmit buffers must be set to the number of receive buffers * -- to hold the immediate ACKs sent for each callabck frame received -- * plus 3 buffers for the retransmit queue and one each for an automatic ACK * (due to data flow control) and a command. */ #define TX_POOL_BUFFERS (EZSP_HOST_RX_POOL_SIZE + 5) /** @brief Define the limits used to decide if the host will hold off the ncp from * sending normal priority frames. */ #define RX_FREE_LWM 8 #define RX_FREE_HWM 12 /** @brief Buffer to hold a DATA frame. */ typedef struct ezspBuffer { struct ezspBuffer *link; uint8_t len; uint8_t data[EZSP_MAX_FRAME_LENGTH]; } EzspBuffer; /** @brief Simple queue (singly-linked list) */ typedef struct { EzspBuffer *tail; } EzspQueue; /** @brief Simple free list (singly-linked list) */ typedef struct { EzspBuffer *link; } EzspFreeList; /** @brief Initializes all queues and free lists. * All receive buffers are put into rxFree, and rxQueue is empty. * All transmit buffers are put into txFree, and txQueue and reTxQueue are * empty. */ void ezspInitQueues(void); /** @brief Add a buffer to the free list. * * @param list pointer to the free list * @param buffer pointer to the buffer */ void ezspFreeBuffer(EzspFreeList *list, EzspBuffer *buffer); /** @brief Get a buffer from the free list. * * @param list pointer to the free list * * @return pointer to the buffer allocated, NULL if free list was empty */ EzspBuffer *ezspAllocBuffer(EzspFreeList *list); /** @brief Remove the buffer at the head of a queue. The queue must not * be empty. * * @param queue pointer to the queue * * @return pointer to the buffer that had been the head of the queue */ EzspBuffer *ezspRemoveQueueHead(EzspQueue *queue); /** @brief Get a pointer to the buffer at the head of the queue. The * queue must not be empty. * * @param queue pointer to the queue * * @return pointer to the buffer at the nead of the queue */ EzspBuffer *ezspQueueHead(EzspQueue *queue); /** @brief Get a pointer to the Nth entry in a queue. The tail is entry * number 1, and if the queue has N entries, the head is entry number N. * The queue must not be empty. * * @param queue pointer to the queue * @param n number of the entry to which a pointer will be returned * * @return pointer to the Nth queue entry */ EzspBuffer *ezspQueueNthEntry(EzspQueue *queue, uint8_t n); /** @brief Get a pointer to the queue entry before (closer to the tail) * than the specified entry. * If the entry specified is the tail, NULL is returned. * If the entry specifed is NULL, a pointer to the head is returned. * * @param queue pointer to the queue * @param buffer pointer to the buffer whose predecessor is wanted * * @return pointer to the buffer before that specifed, or NULL if none */ EzspBuffer *ezspQueuePrecedingEntry(EzspQueue *queue, EzspBuffer *buffer); /** @brief Removes the buffer from the queue, and returns a pointer to * its predecssor, if there is one, otherwise it returns NULL. * * @param queue pointer to the queue * @param buffer pointer to the buffer to be removed * * @return pointer to the buffer before that removed, or NULL if none */ EzspBuffer *ezspRemoveQueueEntry(EzspQueue *queue, EzspBuffer *buffer); /** @brief Returns the number of entries in the queue. * * @param queue pointer to the queue * * @return number of entries in the queue */ uint8_t ezspQueueLength(EzspQueue *queue); /** @brief Returns the number of entries in the free list. * * @param list pointer to the free list * * @return number of entries in the free list */ uint8_t ezspFreeListLength(EzspFreeList *list); /** @brief Add a buffer to the tail of the queue. * * @param queue pointer to the queue * @param buffer pointer to the buffer */ void ezspAddQueueTail(EzspQueue *queue, EzspBuffer *buffer); /** @brief Returns true if the queue is empty. * * @param queue pointer to the queue * * @return true if the queue is empty */ bool ezspQueueIsEmpty(EzspQueue *queue); extern EzspQueue txQueue; extern EzspQueue reTxQueue; extern EzspQueue rxQueue; extern EzspFreeList txFree; extern EzspFreeList rxFree; #endif //__EZSP_HOST_QUEUE_H__ /** @} END addtogroup */
ded5cfe69ae76a578be898ed7c9fd209775503ca
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/drivers/usb/usbip/extr_vudc_dev.c_alloc_urbp.c
30275fbbd48533cd20cfe541af5a74de6b69e84a
[]
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
859
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 */ struct urbp {int /*<<< orphan*/ urb_entry; int /*<<< orphan*/ * ep; int /*<<< orphan*/ * urb; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ INIT_LIST_HEAD (int /*<<< orphan*/ *) ; struct urbp* kzalloc (int,int /*<<< orphan*/ ) ; struct urbp *alloc_urbp(void) { struct urbp *urb_p; urb_p = kzalloc(sizeof(*urb_p), GFP_KERNEL); if (!urb_p) return urb_p; urb_p->urb = NULL; urb_p->ep = NULL; INIT_LIST_HEAD(&urb_p->urb_entry); return urb_p; }
19f0939acb83576358dcb9cefe9ed4dd283e1e44
4686334707ee50d0b07f32297f1010e44cf353f5
/src/icons/load_png.h
09c25135d4dac58811cba6e50d0c240a34a400c1
[ "MIT" ]
permissive
colinw7/CQPaint
8c26116f176d42623b2299c6de23316e5d558ef2
72e29ee38f6dc319c180c3f633670c5912cf7f79
refs/heads/master
2023-01-23T06:15:16.222341
2023-01-16T14:43:56
2023-01-16T14:43:56
55,852,583
3
3
null
null
null
null
UTF-8
C
false
false
5,013
h
#define LOAD_DATA_LEN 977 uchar load_data[LOAD_DATA_LEN] = { 0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48,0x44,0x52, 0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x08,0x06,0x00,0x00,0x00,0x73,0x7a,0x7a, 0xf4,0x00,0x00,0x00,0x04,0x67,0x41,0x4d,0x41,0x00,0x00,0xd6,0xd8,0xd4,0x4f,0x58, 0x32,0x00,0x00,0x00,0x19,0x74,0x45,0x58,0x74,0x53,0x6f,0x66,0x74,0x77,0x61,0x72, 0x65,0x00,0x41,0x64,0x6f,0x62,0x65,0x20,0x49,0x6d,0x61,0x67,0x65,0x52,0x65,0x61, 0x64,0x79,0x71,0xc9,0x65,0x3c,0x00,0x00,0x03,0x63,0x49,0x44,0x41,0x54,0x58,0xc3, 0xc5,0x97,0xcd,0x6f,0x1b,0x55,0x14,0xc5,0x7f,0x77,0x66,0x92,0x89,0xd3,0x7c,0xd4, 0xad,0x17,0x09,0x20,0xd2,0x4d,0x55,0x51,0x10,0x08,0x51,0x84,0xca,0x0a,0x09,0xd8, 0x20,0xc4,0xa2,0x52,0x17,0x2c,0x2a,0x24,0x28,0x6b,0x36,0x2c,0x90,0xfa,0x1f,0xc0, 0x82,0x0d,0xa8,0x3b,0x04,0x2c,0xd8,0x82,0x10,0xaa,0xda,0x45,0x05,0x64,0x07,0x08, 0x04,0xa1,0x34,0x40,0x85,0x11,0x6e,0x21,0xb5,0x13,0x9c,0xe6,0xc3,0xb5,0xd3,0x79, 0xef,0x5d,0x16,0xf3,0xec,0x8c,0x9d,0xc4,0xa6,0xf5,0x54,0x1d,0xe9,0x4a,0x1e,0x69, 0x3c,0xe7,0xdc,0x73,0xce,0xbb,0xef,0x8d,0xa8,0x2a,0xf7,0xf2,0x0a,0xb8,0xc7,0x57, 0xf4,0x7f,0x1e,0x7a,0xff,0x35,0x79,0xf2,0xe6,0x16,0x91,0x55,0xa4,0x30,0xca,0x13, 0xc6,0x12,0xaa,0x22,0x00,0x51,0xc0,0x4c,0x18,0x30,0xeb,0x94,0xc0,0x3a,0x1a,0xd5, 0x35,0x3e,0x7b,0xfb,0x73,0xe6,0x81,0xa6,0xaa,0xba,0x41,0xef,0x96,0x41,0x16,0x9c, 0x7d,0x5d,0xce,0x3c,0xf8,0xc8,0x0b,0xaf,0x3a,0xa7,0xa1,0xaa,0x06,0x0f,0x1c,0x7d, 0x76,0xdc,0x39,0x15,0x54,0x05,0x60,0xaa,0x34,0x17,0x8d,0x17,0xef,0x1f,0x09,0xc2, 0x82,0x98,0xad,0x86,0x7e,0xf1,0xde,0x89,0xea,0x77,0x8b,0xff,0xbe,0xfb,0xe1,0x57, 0x7c,0x02,0xd4,0x55,0xd5,0xf6,0x05,0x50,0xd5,0xbe,0x75,0xf6,0x34,0x3f,0xaa,0xaa, 0xaa,0x3a,0x5f,0xb6,0xab,0x9c,0x5a,0x6d,0xb5,0x6e,0x6a,0xb5,0xba,0xa4,0xc6,0x18, 0xbd,0xb2,0xf0,0x75,0xf2,0xe6,0x8b,0x7c,0xfb,0xfc,0xa3,0xbc,0x02,0x14,0xdb,0x4d, 0xee,0x55,0x03,0x33,0xe0,0x94,0x10,0x2c,0x60,0x7c,0x39,0xd2,0xfb,0xb4,0x04,0x8b, 0x31,0xb7,0x58,0x5e,0xae,0x11,0x86,0x21,0x87,0x1e,0x7a,0x3a,0x3a,0xf9,0xc6,0x07, 0x8f,0x1d,0x9e,0xe1,0xe5,0x97,0x8e,0xf1,0x1c,0x30,0x21,0x22,0x72,0xc7,0x21,0x4c, 0xbd,0xd6,0x2e,0xd0,0xb4,0x1c,0xe0,0x50,0x2c,0xaa,0x09,0xcd,0x66,0x23,0x0d,0x55, 0x14,0xf1,0xf0,0xf1,0x93,0xa3,0xa7,0xdf,0xfa,0xf8,0x99,0xb9,0x12,0xa7,0x80,0x43, 0x40,0x61,0xc8,0x55,0x90,0x02,0x81,0x45,0x31,0x9e,0x40,0x02,0x18,0xc4,0x93,0xc9, 0xe6,0x6d,0xdf,0xbe,0x09,0x8e,0x3c,0x75,0x22,0x2e,0x4d,0x72,0x1c,0x38,0x0a,0x4c, 0x0e,0xb5,0x0a,0x14,0x87,0x60,0xd2,0xd4,0x6e,0xe7,0x97,0x54,0x19,0x08,0x02,0xc5, 0x98,0x16,0x17,0x2f,0x5e,0x60,0x6d,0x6d,0x83,0x20,0x80,0xfd,0xfb,0x8b,0x68,0x54, 0x8c,0x61,0x75,0x0e,0x98,0x00,0xaa,0x77,0xac,0x80,0x64,0x2c,0xd0,0x4e,0x1e,0x12, 0xda,0xd9,0x18,0x1d,0x15,0x66,0x66,0x0f,0xd2,0x6c,0xd6,0xd9,0xdc,0xac,0x61,0xcc, 0x26,0x85,0xc2,0x08,0xad,0xe6,0x2a,0x5e,0xfe,0x68,0x48,0x05,0xac,0x57,0x40,0x3b, 0x7d,0x4b,0x46,0x85,0x20,0x54,0xee,0x9b,0x2d,0x31,0x35,0xf9,0x38,0xc6,0x18,0xa2, 0x28,0x22,0x8e,0x0f,0x70,0x7e,0x04,0xcd,0x65,0x10,0x09,0xce,0x77,0x4c,0xc6,0x06, 0x45,0x11,0x04,0x25,0x10,0x21,0x8e,0x85,0x38,0xce,0x5a,0x3d,0x46,0x18,0x74,0xa4, 0xd3,0x1c,0x32,0x90,0xf8,0xb7,0xa4,0xa0,0xda,0x87,0x6e,0x4a,0xce,0xe5,0x37,0x8a, 0xdb,0x5e,0xb7,0x3b,0x6f,0x83,0x48,0x4f,0x2c,0xb7,0x1b,0x15,0xff,0x9f,0x9c,0x08, 0x08,0x0e,0xcd,0x58,0xd0,0x26,0xa1,0x3b,0xd6,0xc3,0x36,0x1d,0xc9,0x57,0x81,0xd4, 0x82,0xfe,0x24,0x7b,0xe9,0xe5,0x48,0x40,0xfd,0xe0,0x91,0x2e,0x03,0xba,0x41,0xe9, 0x49,0x9a,0xe6,0x69,0x41,0x56,0x01,0xd9,0xa5,0x63,0x7a,0x08,0xe5,0xae,0x40,0x9a, 0x01,0xd3,0xe9,0x51,0x76,0x89,0x1c,0x3e,0x96,0xd2,0x09,0xa7,0xcd,0xdf,0x82,0xde, 0x5e,0xa5,0x13,0xc6,0x14,0x7a,0xfb,0x79,0xbd,0x1b,0x0a,0x24,0x3b,0xe4,0xee,0xf6, 0x5c,0xbb,0x16,0x67,0xce,0x0a,0xec,0x9c,0x84,0xba,0xeb,0x73,0xd9,0xdd,0x43,0xf3, 0x1f,0x44,0x83,0x62,0xd7,0xfd,0xfb,0x2e,0x0c,0xa2,0xac,0xf3,0xfd,0x94,0x68,0x0f, 0xec,0x5c,0x97,0x61,0xba,0x15,0x0f,0x3a,0xe1,0xc7,0xc0,0x38,0x50,0x64,0x6d,0x25, 0x70,0x1b,0x4d,0x5a,0xb9,0x6d,0x46,0x3b,0x2d,0x80,0xf4,0x48,0x39,0x86,0x30,0x8d, 0x52,0xa4,0x56,0x59,0xb1,0x95,0xc5,0xcb,0xf6,0xa7,0x2f,0x3f,0x4a,0xae,0x2c,0xfe, 0xd0,0xb8,0x74,0x95,0x3f,0x80,0x55,0x60,0x6b,0x48,0x05,0xd4,0x1f,0x40,0x15,0x25, 0x04,0x0a,0x08,0x53,0x28,0x07,0xa8,0x55,0x56,0xed,0xc2,0xfc,0xb9,0xe4,0xd7,0x6f, 0x3e,0x35,0xe5,0x72,0x79,0xfd,0xef,0x3a,0xcb,0xdf,0xff,0xc9,0x6f,0xe5,0x2a,0x65, 0xe0,0x1a,0x70,0x19,0x58,0x1f,0x32,0x03,0xa0,0x8c,0xa1,0x4c,0x03,0x07,0x3d,0xe8, 0x85,0x0e,0xe8,0x2f,0xd7,0xa8,0x5c,0xaa,0xf0,0xfb,0xd2,0x0d,0xfe,0x02,0x6a,0xc0, 0x12,0xf0,0x8f,0x3f,0x86,0xd5,0x81,0xcd,0x21,0x15,0x38,0x42,0xad,0xb2,0x6c,0x17, 0xe6,0xcf,0xef,0x05,0x7a,0x1d,0xb8,0xea,0x41,0xeb,0xc0,0x86,0x07,0xdd,0xd2,0x01, 0x5f,0x3e,0x03,0x09,0xac,0x37,0x39,0xf7,0xce,0xa9,0xc2,0xf4,0xf5,0x1b,0xd8,0x9f, 0x2b,0x2c,0xed,0x01,0xba,0xe2,0x65,0x6e,0x00,0x89,0xde,0xc6,0x17,0xef,0xc0,0x4f, 0x33,0x11,0x29,0x01,0xc7,0x80,0xc3,0xc0,0x2d,0x0f,0x38,0x14,0xe8,0xed,0x12,0x18, 0x01,0xa6,0xfd,0xd1,0xda,0x7a,0x69,0x87,0x02,0xcd,0x5e,0xff,0x01,0xf9,0x68,0x10, 0x8e,0x11,0x57,0x76,0x24,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60, 0x82, };
c1b39f57d0b390a7d598546c29cad9074ea5a0c7
fbeeede0dad4b6a7ff843f0210522a8252ee7490
/modules/lpc1769/chip/src/spi_17xx_40xx.c
399a589275ab8201142b801b98c7c34194647336
[ "GPL-2.0-or-later", "freertos-exception-2.0" ]
permissive
Martin-N-Menendez/ciaa_firmwarev2
4e315dfadca775df8d89cf2dcce28d15874a59a2
2a1970d85345ea533beb9d02b4856d353d09986d
refs/heads/master
2023-01-10T23:02:20.207968
2020-11-18T15:39:01
2020-11-18T15:39:01
125,138,100
0
0
BSD-3-Clause
2020-11-18T15:38:17
2018-03-14T01:37:54
C
UTF-8
C
false
false
6,611
c
/* * @brief LPC17xx/40xx SPI driver * * @note * Copyright(C) NXP Semiconductors, 2014 * All rights reserved. * * @par * Software that is described herein is for illustrative purposes only * which provides customers with programming information regarding the * LPC products. This software is supplied "AS IS" without any warranties of * any kind, and NXP Semiconductors and its licensor disclaim any and * all warranties, express or implied, including all implied warranties of * merchantability, fitness for a particular purpose and non-infringement of * intellectual property rights. NXP Semiconductors assumes no responsibility * or liability for the use of the software, conveys no license or rights under any * patent, copyright, mask work right, or any other intellectual property rights in * or to any products. NXP Semiconductors reserves the right to make changes * in the software without notification. NXP Semiconductors also makes no * representation or warranty that such application will be suitable for the * specified use without further testing or modification. * * @par * Permission to use, copy, modify, and distribute this software and its * documentation is hereby granted, under NXP Semiconductors' and its * licensor's relevant copyrights in the software, without fee, provided that it * is used in conjunction with NXP Semiconductors microcontrollers. This * copyright, permission, and disclaimer notice must appear in all copies of * this code. */ #include "chip.h" #if defined(CHIP_LPC175X_6X) /***************************************************************************** * Private types/enumerations/variables ****************************************************************************/ /***************************************************************************** * Public types/enumerations/variables ****************************************************************************/ /***************************************************************************** * Private functions ****************************************************************************/ /* Execute callback function */ STATIC void executeCallback(LPC_SPI_T *pSPI, SPI_CALLBACK_T pfunc) { if (pfunc) { (pfunc) (); } } /* Write byte(s) to FIFO buffer */ STATIC void writeData(LPC_SPI_T *pSPI, SPI_DATA_SETUP_T *pXfSetup, uint32_t num_bytes) { uint16_t data2write = 0xFFFF; if ( pXfSetup->pTxData) { data2write = pXfSetup->pTxData[pXfSetup->cnt]; if (num_bytes == 2) { data2write |= pXfSetup->pTxData[pXfSetup->cnt + 1] << 8; } } Chip_SPI_SendFrame(pSPI, data2write); } /* Read byte(s) from FIFO buffer */ STATIC void readData(LPC_SPI_T *pSPI, SPI_DATA_SETUP_T *pXfSetup, uint16_t rDat, uint32_t num_bytes) { rDat = Chip_SPI_ReceiveFrame(pSPI); if (pXfSetup->pRxData) { pXfSetup->pRxData[pXfSetup->cnt] = rDat; if (num_bytes == 2) { pXfSetup->pRxData[pXfSetup->cnt + 1] = rDat >> 8; } } } /***************************************************************************** * Public functions ****************************************************************************/ /* SPI Polling Read/Write in blocking mode */ uint32_t Chip_SPI_RWFrames_Blocking(LPC_SPI_T *pSPI, SPI_DATA_SETUP_T *pXfSetup) { uint32_t status; uint16_t rDat = 0x0000; uint8_t bytes = 1; /* Clear status */ Chip_SPI_Int_FlushData(pSPI); if (Chip_SPI_GetDataSize(pSPI) != SPI_BITS_8) { bytes = 2; } executeCallback(pSPI, pXfSetup->fnBefTransfer); while (pXfSetup->cnt < pXfSetup->length) { executeCallback(pSPI, pXfSetup->fnBefFrame); /* write data to buffer */ writeData(pSPI, pXfSetup, bytes); /* Wait for transfer completes */ while (1) { status = Chip_SPI_GetStatus(pSPI); /* Check error */ if (status & SPI_SR_ERROR) { goto rw_end; } if (status & SPI_SR_SPIF) { break; } } executeCallback(pSPI, pXfSetup->fnAftFrame); /* Read data*/ readData(pSPI, pXfSetup, rDat, bytes); pXfSetup->cnt += bytes; } rw_end: executeCallback(pSPI, pXfSetup->fnAftTransfer); return pXfSetup->cnt; } /* Clean all data in RX FIFO of SPI */ void Chip_SPI_Int_FlushData(LPC_SPI_T *pSPI) { volatile uint32_t tmp; Chip_SPI_GetStatus(pSPI); tmp = Chip_SPI_ReceiveFrame(pSPI); Chip_SPI_Int_ClearStatus(pSPI, SPI_INT_SPIF); } /* SPI Interrupt Read/Write with 8-bit frame width */ Status Chip_SPI_Int_RWFrames(LPC_SPI_T *pSPI, SPI_DATA_SETUP_T *pXfSetup, uint8_t bytes) { uint32_t status; uint16_t rDat = 0x0000; status = Chip_SPI_GetStatus(pSPI); /* Check error status */ if (status & SPI_SR_ERROR) { return ERROR; } Chip_SPI_Int_ClearStatus(pSPI, SPI_INT_SPIF); if (status & SPI_SR_SPIF) { executeCallback(pSPI, pXfSetup->fnAftFrame); if (pXfSetup->cnt < pXfSetup->length) { /* read data */ readData(pSPI, pXfSetup, rDat, bytes); pXfSetup->cnt += bytes; } } if (pXfSetup->cnt < pXfSetup->length) { executeCallback(pSPI, pXfSetup->fnBefFrame); /* Write data */ writeData(pSPI, pXfSetup, bytes); } else { executeCallback(pSPI, pXfSetup->fnAftTransfer); } return SUCCESS; } /* SPI Interrupt Read/Write with 8-bit frame width */ Status Chip_SPI_Int_RWFrames8Bits(LPC_SPI_T *pSPI, SPI_DATA_SETUP_T *pXfSetup) { return Chip_SPI_Int_RWFrames(pSPI, pXfSetup, 1); } /* SPI Interrupt Read/Write with 16-bit frame width */ Status Chip_SPI_Int_RWFrames16Bits(LPC_SPI_T *pSPI, SPI_DATA_SETUP_T *pXfSetup) { return Chip_SPI_Int_RWFrames(pSPI, pXfSetup, 2); } /* Set the clock frequency for SPI interface */ void Chip_SPI_SetBitRate(LPC_SPI_T *pSPI, uint32_t bitRate) { uint32_t spiClk, counter; /* Get SPI clock rate */ spiClk = Chip_Clock_GetPeripheralClockRate(SYSCTL_PCLK_SPI); counter = spiClk / bitRate; if (counter < 8) { counter = 8; } counter = ((counter + 1) / 2) * 2; if (counter > 254) { counter = 254; } Chip_SPI_SetClockCounter(pSPI, counter); } /* Initialize the SPI */ void Chip_SPI_Init(LPC_SPI_T *pSPI) { Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SPI); Chip_SPI_SetMode(pSPI, SPI_MODE_MASTER); pSPI->CR = (pSPI->CR & (~0xF1C)) | SPI_CR_BIT_EN | SPI_BITS_8 | SPI_CLOCK_CPHA0_CPOL0 | SPI_DATA_MSB_FIRST; Chip_SPI_SetBitRate(pSPI, 400000); } /* De-initializes the SPI peripheral */ void Chip_SPI_DeInit(LPC_SPI_T *pSPI) { Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SPI); } #endif /* defined(CHIP_LPC175X_6X) */
33ef64431257af6359dfd63343175744d339828c
c3665ff6c2dc0bacb6e88ae02fc60b1a904fc30b
/old_project/appClick/appServer/include/lg_network.h
272a4f9326e9cee4aeb11c72d95e746c005a56c8
[]
no_license
lcglcglcg/code
875254eacc6d69461c5cfdd07071fa46020e2189
d43868276f8af575a26506e0ea93b31776d2dd74
refs/heads/master
2021-01-17T21:00:36.409929
2016-06-12T08:58:45
2016-06-12T08:58:45
60,957,307
0
0
null
null
null
null
UTF-8
C
false
false
2,748
h
#ifndef __LG_NETWORK_H__ #define __LG_NETWORK_H__ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <net/if.h> #include <arpa/inet.h> #include <netinet/in.h> #include <sys/socket.h> #include <sys/types.h> #include <sys/ioctl.h> #include <sys/wait.h> #include <sys/epoll.h> #include <semaphore.h> #include <pthread.h> #include "lg_queue.h" #define NETWORK_SUCCESS 0 #define NETWORK_ERROR -1 #define NETWORK_TIMEOUT -2 #define NETWORK_SIGNALEINTR -3 #ifdef __cplusplus extern "C" { #endif extern int lg_network_fdmax(int fdmax); extern int lg_network_noblocking(int sockfd); extern int lg_network_check(int sockfd); extern int lg_network_not_time_wait(int sockfd); extern int lg_network_set_kernel_buffer(int sockfd, int send_size, int recv_size); extern int lg_network_get_kernel_buffer(int sockfd, int *send_size, int *recv_size); extern int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags); extern int lg_network_bind(char *address, int port); extern int lg_network_accept(int listenfd); extern int lg_network_connect(char *address, int port); extern size_t lg_network_send(int sockfd, void *buffer, size_t buffer_size); extern size_t lg_network_recv(int sockfd, void *buffer, size_t buffer_size); typedef struct lg_network_epoll_t lg_network_epoll_t; typedef void(lg_network_epoll_in)(int sockfd, lg_network_epoll_t* ep); typedef void(lg_network_epoll_out)(int sockfd, lg_network_epoll_t* ep); typedef void(lg_network_epoll_err)(int sockfd, lg_network_epoll_t* ep); typedef void(lg_network_epoll_hup)(int sockfd, lg_network_epoll_t* ep); typedef void(lg_network_epoll_pri)(int sockfd, lg_network_epoll_t* ep); struct lg_network_epoll_t { lg_network_epoll_in *in; lg_network_epoll_out *out; lg_network_epoll_err *err; lg_network_epoll_hup *hup; lg_network_epoll_pri *pri; int epfd; int timer; int event_max; struct epoll_event *event_pool; struct sockaddr_in *addr_pool; struct epoll_event event_ctl; int listenfd; void *arg; sem_t *sem; lg_queue_t *queue; pthread_mutex_t *mutex; }; extern int lg_network_epoll(lg_network_epoll_t *ep); extern int lg_network_epoll_event_add(lg_network_epoll_t *ep, int sockfd, struct sockaddr_in addr, int mask); extern int lg_network_epoll_event_mod(lg_network_epoll_t *ep, int sockfd, int mask); extern int lg_network_epoll_event_del(lg_network_epoll_t *ep, int sockfd, int mask); extern int lg_network_epoll_external(lg_network_epoll_t *ep); extern lg_network_epoll_t *lg_network_epoll_init(int event_max, int timer); #ifdef __cplusplus } #endif #endif// __NETWORK_H__