hexsha
stringlengths
40
40
size
int64
5
2.72M
ext
stringclasses
5 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
976
max_stars_repo_name
stringlengths
5
113
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringdate
2015-01-01 00:01:43
2022-03-31 23:59:48
max_stars_repo_stars_event_max_datetime
stringdate
2015-01-01 00:06:24
2022-03-31 23:59:53
max_issues_repo_path
stringlengths
3
976
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
float64
1
134k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
976
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringdate
2015-01-01 00:01:19
2022-03-31 23:59:49
max_forks_repo_forks_event_max_datetime
stringdate
2015-01-03 12:00:57
2022-03-31 23:59:49
content
stringlengths
5
2.72M
avg_line_length
float64
1.38
573k
max_line_length
int64
2
1.01M
alphanum_fraction
float64
0
1
d9a4b0752404c5a8020777a3817024051279d8df
442
h
C
tinyunit.h
mbizov/tinyunit-c
fb841f6d2b0db4fc9f3fe7b9360abafb8deeced3
[ "Unlicense" ]
1
2019-03-20T08:06:19.000Z
2019-03-20T08:06:19.000Z
tinyunit.h
mbizov/tinyunit-c
fb841f6d2b0db4fc9f3fe7b9360abafb8deeced3
[ "Unlicense" ]
null
null
null
tinyunit.h
mbizov/tinyunit-c
fb841f6d2b0db4fc9f3fe7b9360abafb8deeced3
[ "Unlicense" ]
null
null
null
#ifndef _TINYUNIT_H_ #define _TINYUNIT_H_ #endif extern int tu_tests_run; extern int tu_tests_passed; #define tu_assert(test, msg) do { if (!(test)) return msg; } while (0) #define tu_run_test(test) do { \ char *msg = test(); \ tu_tests_run++; \ if (msg) return msg; \ tu_tests_passed++; \ } while (0)
29.466667
70
0.479638
d9a5f3233f033bc251024b274fc4b7c98d509e43
1,077
h
C
include/my_runner/enemy.h
Heliferepo/my_runner
99803ae9062e0bbc88ffa52557246a0dd22a8dc0
[ "Apache-2.0" ]
1
2021-04-01T15:10:08.000Z
2021-04-01T15:10:08.000Z
include/my_runner/enemy.h
Heliferepo/my_runner
99803ae9062e0bbc88ffa52557246a0dd22a8dc0
[ "Apache-2.0" ]
null
null
null
include/my_runner/enemy.h
Heliferepo/my_runner
99803ae9062e0bbc88ffa52557246a0dd22a8dc0
[ "Apache-2.0" ]
null
null
null
/* ** EPITECH PROJECT, 2020 ** B-MUL-100-RUN-1-1-myrunner-mattis.dalleau ** File description: ** enemy */ #pragma once #ifndef __RUNNER__ENEMY__H__ #define __RUNNER__ENEMY__H__ enum { PHANTOM, NINJA, MUSHROOM, SLIME }; enum { IDLE, ACTION, }; typedef struct enemy_info { int id; int index; } enemy_info_t; typedef struct enemy_st { frame_t frame; sfSprite *sprite; int8_t enemy_id; u_int8_t state; entity_t info; } enemy_t; #define NB_ENEMY 4 #define INF_ARR_ENEMY_SIZE 5 #define PHANTOM_SPRITE_SHEET "asset/phantom.png" #define MUSHROOM_SPRITE_SHEET "asset/vania/enemy/mushroom/sheet.png" #define NINJA_SPRITE_SHEET "asset/ninja_sheet.png" #define SLIME_SPRITE_SHEET "asset/vania/enemy/slime/sheet.png" #define GROUND_HEIGHT_MUSHROOM 677 #define GROUND_HEIGHT_NINJA 650 #define GROUND_HEIGHT_SLIME 691 #define GROUND_HEIGHT_PHANTOM 570 #endif
21.979592
74
0.624884
d9a7227ca3688a373c644d8aa1fa8557a906fac8
149
h
C
emulador/includes/ppu.h
vmartinv/nek
04260400ed4ee52e70106b32c0569c3416df6acb
[ "MIT" ]
30
2018-11-26T08:44:12.000Z
2022-01-05T08:20:14.000Z
emulador/includes/ppu.h
mvpossum/nek
04260400ed4ee52e70106b32c0569c3416df6acb
[ "MIT" ]
null
null
null
emulador/includes/ppu.h
mvpossum/nek
04260400ed4ee52e70106b32c0569c3416df6acb
[ "MIT" ]
2
2018-10-23T15:17:25.000Z
2018-12-19T17:34:15.000Z
#ifndef PPU_H #define PPU_H #include <nestypes.h> namespace PPU { void Init(); void tick(); u8 Access(u16 index, u8 v, bool write); } #endif
12.416667
43
0.66443
d9a7331fe27b50f0d18690b41d60bb4894ff0d1c
3,046
c
C
BootloaderCommonPkg/Library/MemoryDeviceBlockIoLib/MemoryDeviceBlockIoLib.c
smnarayanan/slimbootloader
9f146afd47e0ca204521826a583d55388850b216
[ "BSD-2-Clause-NetBSD", "PSF-2.0", "BSD-2-Clause", "Apache-2.0", "MIT", "BSD-2-Clause-Patent" ]
299
2018-09-13T23:17:25.000Z
2022-03-19T14:25:54.000Z
BootloaderCommonPkg/Library/MemoryDeviceBlockIoLib/MemoryDeviceBlockIoLib.c
smnarayanan/slimbootloader
9f146afd47e0ca204521826a583d55388850b216
[ "BSD-2-Clause-NetBSD", "PSF-2.0", "BSD-2-Clause", "Apache-2.0", "MIT", "BSD-2-Clause-Patent" ]
494
2018-09-18T19:31:55.000Z
2022-03-30T16:52:52.000Z
BootloaderCommonPkg/Library/MemoryDeviceBlockIoLib/MemoryDeviceBlockIoLib.c
smnarayanan/slimbootloader
9f146afd47e0ca204521826a583d55388850b216
[ "BSD-2-Clause-NetBSD", "PSF-2.0", "BSD-2-Clause", "Apache-2.0", "MIT", "BSD-2-Clause-Patent" ]
142
2018-09-13T23:43:17.000Z
2022-03-25T03:40:13.000Z
/** @file This file provides some helper functions via run time service support specific to Memory device. Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include <Library/BaseLib.h> #include <Library/BaseMemoryLib.h> #include <Library/MemoryDeviceBlockIoLib.h> /** Initialize a Memory instance. @param[in] MemoryDevicePciBase The PCI base of the Memory flash device. @param[in] DevInitPhase The initialization phase to prepare the device. @retval EFI_SUCCESS The driver is successfully initialized. @retval EFI_UNSUPPORTED The call is unsupported. @retval Others Can't initialize the Memory device. **/ EFI_STATUS EFIAPI InitializeMemoryDevice ( IN UINTN MemoryDevicePciBase, IN DEVICE_INIT_PHASE DevInitPhase ) { if (DevInitPhase == DevDeinit) { // Handle Deinit if required. return EFI_SUCCESS; } return EFI_SUCCESS; } /** This function reads blocks from the Memory slave device. @param[in] RegionType The region type of the Memory area to read from. @param[in] Address The block address in the RegionType to read from on the Memory. @param[in] BufferSize Size of the Buffer in bytes. @param[out] Buffer Pointer to caller-allocated buffer containing the data received during the Memory cycle. @retval EFI_SUCCESS Memory command completes successfully. **/ EFI_STATUS EFIAPI MemoryDeviceReadBlocks ( IN UINTN RegionType, IN EFI_PEI_LBA Address, IN UINTN BufferSize, OUT VOID *Buffer ) { if ((Buffer == NULL) || (BufferSize == 0)) { return EFI_INVALID_PARAMETER; } CopyMem (Buffer, (VOID *) (UINTN)Address, BufferSize); return EFI_SUCCESS; } /** Gets a Memory device's media information. This function will provide the caller with the specified Memory device's media information. If the media changes, calling this function will update the media information accordingly. @param[in] RegionType The region type of the Memory area to access. @param[out] DevBlockInfo The Block Io information of the Memory device. @retval EFI_SUCCESS The Block Io information about the specified block device was obtained successfully. @retval EFI_UNSUPPORTED The call is unsupported. @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware error. **/ EFI_STATUS EFIAPI MemoryDeviceGetMediaInfo ( UINTN RegionType, DEVICE_BLOCK_INFO *DevBlockInfo ) { if (DevBlockInfo == NULL) { return EFI_INVALID_PARAMETER; } DevBlockInfo->BlockNum = 0x100000000; DevBlockInfo->BlockSize = RAM_BLOCK_SIZE; return EFI_SUCCESS; }
30.46
123
0.647735
d9a75aff34409a59237a92fde9752c88f3afd3d5
521
h
C
RyWebChat/MAEliteChat/MAMessageUtils/MAMessageUtils.h
jinpujin/EliteCRMWeChat
0180bc5f34c4e5d78b58017530db88f5121e38f2
[ "MIT" ]
null
null
null
RyWebChat/MAEliteChat/MAMessageUtils/MAMessageUtils.h
jinpujin/EliteCRMWeChat
0180bc5f34c4e5d78b58017530db88f5121e38f2
[ "MIT" ]
null
null
null
RyWebChat/MAEliteChat/MAMessageUtils/MAMessageUtils.h
jinpujin/EliteCRMWeChat
0180bc5f34c4e5d78b58017530db88f5121e38f2
[ "MIT" ]
null
null
null
// // MAMessageUtils.h // RyWebChat // // Created by nwk on 2017/2/15. // Copyright © 2017年 nwkcom.sh.n22. All rights reserved. // #import <Foundation/Foundation.h> @interface MAMessageUtils : NSObject /** * 发送排队请求 * * @param queueId 队列号 * @param from 请求来源 */ + (void)sendChatRequest:(int)queueId from:(NSString *)from; /** * 发送文本消息 * * @param msg 消息对象 */ + (NSString *)getTextMessageJsonStr; /** * 发送语音消息 * * @param msg 消息对象 */ + (NSString *)getVoiceMessageJsonStr:(long long)duration; @end
16.28125
59
0.648752
d9a7999b43a991958d1d2d03f59731538bb870b9
424
c
C
test/test_python.c
tollesonpdx/Last_Minute_Camping_With_C
29942c8ce6840d42b6f1cad1ea97ecfd9826a083
[ "MIT" ]
null
null
null
test/test_python.c
tollesonpdx/Last_Minute_Camping_With_C
29942c8ce6840d42b6f1cad1ea97ecfd9826a083
[ "MIT" ]
null
null
null
test/test_python.c
tollesonpdx/Last_Minute_Camping_With_C
29942c8ce6840d42b6f1cad1ea97ecfd9826a083
[ "MIT" ]
null
null
null
// Chad Tolleson Copyright (c) 2018 // Python test file // attribution: https://docs.python.org/2/extending/embedding.html #include <Python.h> int main(int argc, char *argv[]) { Py_SetProgramName(argv[0]); /* optional but recommended */ Py_Initialize(); PyRun_SimpleString("from time import time,ctime\n" "print 'Today is',ctime(time())\n"); Py_Finalize(); return 0; }
24.941176
66
0.629717
d9ace596704e8e92c9f3cfb2499e546e2bdce2a9
444
h
C
jfruntime/include/array.h
dstep/old_jf_compiler
3e179d91584308d9e7a69e76a78542e83ec2d50b
[ "MIT" ]
null
null
null
jfruntime/include/array.h
dstep/old_jf_compiler
3e179d91584308d9e7a69e76a78542e83ec2d50b
[ "MIT" ]
null
null
null
jfruntime/include/array.h
dstep/old_jf_compiler
3e179d91584308d9e7a69e76a78542e83ec2d50b
[ "MIT" ]
null
null
null
#include "runtime.h" struct JFArray{ void* objheader; void* valueInfo; jfint valueSize; jfint capacity; jfint size; uint8_t* data; }; JFAPI JFArray* __jf_empty_array(jfint valueSize, void* valueInfo); JFAPI void* __jf_array_ref(JFArray* array, jfint index); JFAPI jfint __jf_array_size(JFArray* array); JFAPI void* __jf_array_push(JFArray* array); JFAPI void __jf_array_pop(JFArray* array); JFAPI void __jf_array_clear(JFArray* array);
24.666667
66
0.779279
d9ad20b36dafd1524ab7de84e90e8494c0ed94f1
8,184
c
C
src/ilPSP/layer_0/3rd_party/WinHypre/hypre/parcsr_ls/HYPRE_parcsr_flexgmres.c
leyel/BoSSS
39f58a1a64a55e44f51384022aada20a5b425230
[ "Apache-2.0" ]
1
2018-12-20T10:55:58.000Z
2018-12-20T10:55:58.000Z
src/ilPSP/layer_0/3rd_party/WinHypre/hypre/parcsr_ls/HYPRE_parcsr_flexgmres.c
leyel/BoSSS
39f58a1a64a55e44f51384022aada20a5b425230
[ "Apache-2.0" ]
null
null
null
src/ilPSP/layer_0/3rd_party/WinHypre/hypre/parcsr_ls/HYPRE_parcsr_flexgmres.c
leyel/BoSSS
39f58a1a64a55e44f51384022aada20a5b425230
[ "Apache-2.0" ]
null
null
null
/*BHEADER********************************************************************** * Copyright (c) 2008, Lawrence Livermore National Security, LLC. * Produced at the Lawrence Livermore National Laboratory. * This file is part of HYPRE. See file COPYRIGHT for details. * * HYPRE 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) version 2.1 dated February 1999. * * $Revision: 2.2 $ ***********************************************************************EHEADER*/ /****************************************************************************** * * HYPRE_ParCSRFlexGMRES interface * *****************************************************************************/ #include "headers.h" /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESCreate *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESCreate( MPI_Comm comm, HYPRE_Solver *solver ) { hypre_FlexGMRESFunctions * fgmres_functions = hypre_FlexGMRESFunctionsCreate( hypre_CAlloc, hypre_ParKrylovFree, hypre_ParKrylovCommInfo, hypre_ParKrylovCreateVector, hypre_ParKrylovCreateVectorArray, hypre_ParKrylovDestroyVector, hypre_ParKrylovMatvecCreate, hypre_ParKrylovMatvec, hypre_ParKrylovMatvecDestroy, hypre_ParKrylovInnerProd, hypre_ParKrylovCopyVector, hypre_ParKrylovClearVector, hypre_ParKrylovScaleVector, hypre_ParKrylovAxpy, hypre_ParKrylovIdentitySetup, hypre_ParKrylovIdentity ); *solver = ( (HYPRE_Solver) hypre_FlexGMRESCreate( fgmres_functions ) ); if (!solver) hypre_error_in_arg(2); return hypre_error_flag; } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESDestroy *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESDestroy( HYPRE_Solver solver ) { return( hypre_FlexGMRESDestroy( (void *) solver ) ); } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESSetup *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESSetup( HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector b, HYPRE_ParVector x ) { return( HYPRE_FlexGMRESSetup( solver, (HYPRE_Matrix) A, (HYPRE_Vector) b, (HYPRE_Vector) x ) ); } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESSolve *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESSolve( HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector b, HYPRE_ParVector x ) { return( HYPRE_FlexGMRESSolve( solver, (HYPRE_Matrix) A, (HYPRE_Vector) b, (HYPRE_Vector) x ) ); } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESSetKDim *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESSetKDim( HYPRE_Solver solver, int k_dim ) { return( HYPRE_FlexGMRESSetKDim( solver, k_dim ) ); } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESSetTol *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESSetTol( HYPRE_Solver solver, double tol ) { return( HYPRE_FlexGMRESSetTol( solver, tol ) ); } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESSetAbsoluteTol *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESSetAbsoluteTol( HYPRE_Solver solver, double a_tol ) { return( HYPRE_FlexGMRESSetAbsoluteTol( solver, a_tol ) ); } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESSetMinIter *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESSetMinIter( HYPRE_Solver solver, int min_iter ) { return( HYPRE_FlexGMRESSetMinIter( solver, min_iter ) ); } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESSetMaxIter *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESSetMaxIter( HYPRE_Solver solver, int max_iter ) { return( HYPRE_FlexGMRESSetMaxIter( solver, max_iter ) ); } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESSetPrecond *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESSetPrecond( HYPRE_Solver solver, HYPRE_PtrToParSolverFcn precond, HYPRE_PtrToParSolverFcn precond_setup, HYPRE_Solver precond_solver ) { return( HYPRE_FlexGMRESSetPrecond( solver, (HYPRE_PtrToSolverFcn) precond, (HYPRE_PtrToSolverFcn) precond_setup, precond_solver ) ); } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESGetPrecond *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESGetPrecond( HYPRE_Solver solver, HYPRE_Solver *precond_data_ptr ) { return( HYPRE_FlexGMRESGetPrecond( solver, precond_data_ptr ) ); } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESSetLogging *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESSetLogging( HYPRE_Solver solver, int logging) { return( HYPRE_FlexGMRESSetLogging( solver, logging ) ); } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESSetPrintLevel *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESSetPrintLevel( HYPRE_Solver solver, int print_level) { return( HYPRE_FlexGMRESSetPrintLevel( solver, print_level ) ); } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESGetNumIterations *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESGetNumIterations( HYPRE_Solver solver, int *num_iterations ) { return( HYPRE_FlexGMRESGetNumIterations( solver, num_iterations ) ); } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESGetFinalRelativeResidualNorm *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESGetFinalRelativeResidualNorm( HYPRE_Solver solver, double *norm ) { return( HYPRE_FlexGMRESGetFinalRelativeResidualNorm( solver, norm ) ); } /*-------------------------------------------------------------------------- * HYPRE_ParCSRFlexGMRESSetModifyPC *--------------------------------------------------------------------------*/ int HYPRE_ParCSRFlexGMRESSetModifyPC( HYPRE_Solver solver, HYPRE_PtrToModifyPCFcn modify_pc) { return ( HYPRE_FlexGMRESSetModifyPC( solver, (HYPRE_PtrToModifyPCFcn) modify_pc)); }
34.825532
86
0.425709
d9ad31ad866ec2018b0cb77395ed148b870daf91
7,182
h
C
webview_linux.h
polevpn/webview
7b6a7bb7e1a3e454efafcbb87b3c8512b7e7f8b5
[ "MIT" ]
10
2021-10-02T06:20:41.000Z
2022-03-23T08:26:13.000Z
webview_linux.h
polevpn/webview
7b6a7bb7e1a3e454efafcbb87b3c8512b7e7f8b5
[ "MIT" ]
6
2021-10-02T06:24:25.000Z
2022-03-05T09:12:08.000Z
webview_linux.h
polevpn/webview
7b6a7bb7e1a3e454efafcbb87b3c8512b7e7f8b5
[ "MIT" ]
8
2021-10-15T04:48:48.000Z
2022-01-29T13:09:01.000Z
// // ==================================================================== // // This implementation uses webkit2gtk backend. It requires gtk+3.0 and // webkit2gtk-4.0 libraries. Proper compiler flags can be retrieved via: // // pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0 // // ==================================================================== // #include <JavaScriptCore/JavaScript.h> #include <gtk/gtk.h> #include <webkit2/webkit2.h> namespace webview { class gtk_webkit_engine { public: gtk_webkit_engine(int width,int height,bool hide,bool debug) { m_hide = hide; gtk_init_check(0, NULL); m_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_resize(GTK_WINDOW(m_window), width, height); g_signal_connect(G_OBJECT(m_window), "destroy", G_CALLBACK(+[](GtkWidget *, gpointer arg) { static_cast<gtk_webkit_engine *>(arg)->terminate(); }), this); if(m_hide){ g_signal_connect(G_OBJECT(m_window), "delete-event", G_CALLBACK(gtk_webkit_engine::hideWindow), this); } // Initialize webview widget m_webview = webkit_web_view_new(); WebKitUserContentManager *manager = webkit_web_view_get_user_content_manager(WEBKIT_WEB_VIEW(m_webview)); g_signal_connect(manager, "script-message-received::external", G_CALLBACK(+[](WebKitUserContentManager *, WebKitJavascriptResult *r, gpointer arg) { auto *w = static_cast<gtk_webkit_engine *>(arg); #if WEBKIT_MAJOR_VERSION >= 2 && WEBKIT_MINOR_VERSION >= 22 JSCValue *value = webkit_javascript_result_get_js_value(r); char *s = jsc_value_to_string(value); #else JSGlobalContextRef ctx = webkit_javascript_result_get_global_context(r); JSValueRef value = webkit_javascript_result_get_value(r); JSStringRef js = JSValueToStringCopy(ctx, value, NULL); size_t n = JSStringGetMaximumUTF8CStringSize(js); char *s = g_new(char, n); JSStringGetUTF8CString(js, s, n); JSStringRelease(js); #endif w->on_message(s); g_free(s); }), this); webkit_user_content_manager_register_script_message_handler(manager, "external"); init("window.external={invoke:function(s){window.webkit.messageHandlers." "external.postMessage(s);}}"); gtk_container_add(GTK_CONTAINER(m_window), GTK_WIDGET(m_webview)); gtk_widget_grab_focus(GTK_WIDGET(m_webview)); WebKitSettings *settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(m_webview)); webkit_settings_set_javascript_can_access_clipboard(settings, true); if (debug) { webkit_settings_set_enable_write_console_messages_to_stdout(settings, true); webkit_settings_set_enable_developer_extras(settings, true); } gtk_window_set_position( GTK_WINDOW(m_window), GTK_WIN_POS_CENTER_ALWAYS ); gtk_widget_show_all(m_window); } GdkPixbuf * create_pixbuf(const gchar *filename) { GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = gdk_pixbuf_new_from_file(filename, &error); if(!pixbuf) { fprintf(stderr,"%s\n",error->message); g_error_free(error); } return pixbuf; } void set_icon(const std::string icon) { std::string temp_file_name ="/tmp/icon_xxxxxxxxxx";; FILE *fd = fopen((char*)temp_file_name.c_str(),"w+"); if (fd == NULL) { printf("failed to create icon file %s: %s\n", temp_file_name.c_str(), strerror(errno)); return; } printf("size=%d\n",(int)icon.size()); ssize_t written = fwrite(icon.data(), icon.size(),icon.size(),fd); fclose(fd); gtk_window_set_icon(GTK_WINDOW(m_window),create_pixbuf(temp_file_name.c_str())); } void *window() { return (void *)m_window; } void run() { gtk_main(); } void terminate() { gtk_main_quit(); } void hide(){ g_idle_add(GSourceFunc(hideWindowMain),this); } static gboolean hideWindowMain(gpointer arg){ auto *engine = static_cast<gtk_webkit_engine *>(arg); gtk_widget_hide(engine->m_window); return false; } static gboolean hideWindow(GtkWidget *window, GdkEvent *event,gpointer arg){ gtk_widget_hide(window); return true; } static gboolean showWindowMain(gpointer arg){ auto *engine = static_cast<gtk_webkit_engine *>(arg); gtk_window_set_position( GTK_WINDOW(engine->m_window), GTK_WIN_POS_CENTER_ALWAYS ); gtk_widget_show_all(engine->m_window); gtk_window_present(GTK_WINDOW(engine->m_window)); return false; } void show(){ g_idle_add(GSourceFunc(showWindowMain),this); } void dispatch(std::function<void()> f) { g_idle_add_full(G_PRIORITY_HIGH_IDLE, (GSourceFunc)([](void *f) -> int { (*static_cast<dispatch_fn_t *>(f))(); return G_SOURCE_REMOVE; }), new std::function<void()>(f), [](void *f) { delete static_cast<dispatch_fn_t *>(f); }); } void set_title(const std::string title) { gtk_window_set_title(GTK_WINDOW(m_window), title.c_str()); } void set_size(int width, int height, int hints) { gtk_window_set_resizable(GTK_WINDOW(m_window), hints != WEBVIEW_HINT_FIXED); if (hints == WEBVIEW_HINT_NONE) { gtk_window_resize(GTK_WINDOW(m_window), width, height); } else if (hints == WEBVIEW_HINT_FIXED) { gtk_widget_set_size_request(m_window, width, height); } else { GdkGeometry g; g.min_width = g.max_width = width; g.min_height = g.max_height = height; GdkWindowHints h = (hints == WEBVIEW_HINT_MIN ? GDK_HINT_MIN_SIZE : GDK_HINT_MAX_SIZE); // This defines either MIN_SIZE, or MAX_SIZE, but not both: gtk_window_set_geometry_hints(GTK_WINDOW(m_window), nullptr, &g, h); } } void navigate(const std::string url) { webkit_web_view_load_uri(WEBKIT_WEB_VIEW(m_webview), url.c_str()); } void init(const std::string js) { WebKitUserContentManager *manager = webkit_web_view_get_user_content_manager(WEBKIT_WEB_VIEW(m_webview)); webkit_user_content_manager_add_script( manager, webkit_user_script_new( js.c_str(), WEBKIT_USER_CONTENT_INJECT_TOP_FRAME, WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_START, NULL, NULL)); } void eval(const std::string js) { webkit_web_view_run_javascript(WEBKIT_WEB_VIEW(m_webview), js.c_str(), NULL, NULL, NULL); } private: virtual void on_message(const std::string msg) = 0; GtkWidget *m_window; GtkWidget *m_webview; bool m_hide; }; using browser_engine = gtk_webkit_engine; } // namespace webview
35.731343
109
0.618491
d9af4ec64ea2d4de529288ec66bbe2e12fe3a3fe
2,445
c
C
example/socket/suite_framework.c
ybbh/ofp
1d6f0f92fd6c7e3da2fc9b221766b5717d760d74
[ "BSD-3-Clause" ]
null
null
null
example/socket/suite_framework.c
ybbh/ofp
1d6f0f92fd6c7e3da2fc9b221766b5717d760d74
[ "BSD-3-Clause" ]
null
null
null
example/socket/suite_framework.c
ybbh/ofp
1d6f0f92fd6c7e3da2fc9b221766b5717d760d74
[ "BSD-3-Clause" ]
null
null
null
/* Copyright (c) 2014, ENEA Software AB * Copyright (c) 2014, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include "ofp.h" #include "suite_framework.h" static int suite_thread1(void *arg); static int suite_thread2(void *arg); int fd_thread1 = -1; int fd_thread2 = -1; int core_id = -1; int config_suite_framework(uint16_t linux_core_id) { core_id = linux_core_id; return 0; } int init_suite(init_function init_func) { fd_thread1 = -1; fd_thread2 = -1; if (init_func) return init_func(&fd_thread1, &fd_thread2); else return 0; } void run_suite(odp_instance_t instance, run_function run_func1, run_function run_func2) { odph_thread_t sock_pthread1; odph_thread_t sock_pthread2; odp_cpumask_t sock_cpumask; odph_thread_param_t thr_params; odph_thread_common_param_t thr_common_params; odp_cpumask_zero(&sock_cpumask); odp_cpumask_set(&sock_cpumask, core_id); odph_thread_common_param_init(&thr_common_params); odph_thread_param_init(&thr_params); thr_common_params.cpumask = &sock_cpumask; thr_params.start = suite_thread1; thr_params.arg = run_func1; thr_params.thr_type = ODP_THREAD_CONTROL; thr_params._deprecated_instance = instance; odph_thread_create(&sock_pthread1, &thr_common_params, &thr_params, 1); odph_thread_common_param_init(&thr_common_params); odph_thread_param_init(&thr_params); thr_params.start = suite_thread2; thr_params.arg = run_func2; thr_params.thr_type = ODP_THREAD_CONTROL; odph_thread_create(&sock_pthread2, &thr_common_params, &thr_params, 1); odph_thread_join(&sock_pthread1, 1); odph_thread_join(&sock_pthread2, 1); } void end_suite(void) { if (fd_thread1 != -1) { if (ofp_close(fd_thread1) == -1) OFP_ERR("Faild to close socket 1 (errno = %d)\n", ofp_errno); fd_thread1 = -1; } if (fd_thread2 != -1) { if (ofp_close(fd_thread2) == -1) OFP_ERR("Faild to close socket 1 (errno = %d)\n", ofp_errno); fd_thread2 = -1; } } static int suite_thread1(void *arg) { run_function run_func = (run_function)arg; if (ofp_init_local()) { OFP_ERR("Error: OFP local init failed.\n"); return -1; } (void)run_func(fd_thread1); return 0; } static int suite_thread2(void *arg) { run_function run_func = (run_function)arg; if (ofp_init_local()) { OFP_ERR("Error: OFP local init failed.\n"); return -1; } (void)run_func(fd_thread2); return 0; }
20.375
52
0.723108
d9b000bcf45834611273956c30c6f6289d77b72e
3,864
h
C
inc/clingo/time/cDaytime.h
aiq/clingo
3ccdec52894f35230c4a42f89c108bf084ab8e1d
[ "MIT" ]
2
2022-01-09T21:43:33.000Z
2022-01-12T19:16:06.000Z
inc/clingo/time/cDaytime.h
aiq/clingo
3ccdec52894f35230c4a42f89c108bf084ab8e1d
[ "MIT" ]
null
null
null
inc/clingo/time/cDaytime.h
aiq/clingo
3ccdec52894f35230c4a42f89c108bf084ab8e1d
[ "MIT" ]
null
null
null
#ifndef CLINGO_TIME_CDAYTIME_H #define CLINGO_TIME_CDAYTIME_H #include <time.h> #include "clingo/apidecl.h" #include "clingo/time/cDate.h" #include "clingo/time/cDuration.h" #include "clingo/time/cTzOffset.h" /******************************************************************************* ********************************************************* Types and Definitions ******************************************************************************** type *******************************************************************************/ struct cDaytime { int64_t _v; }; typedef struct cDaytime cDaytime; /******************************************************************************* generated *******************************************************************************/ SLICE_DEF_C_( cDaytime, // Type cDaytimeSlice, // SliceType daytime_slice_c, // FuncSuffix cVarDaytimeSlice, // VarSliceType var_daytime_slice_c // VarFuncName ) /******************************************************************************* ********************************************************************* Functions ******************************************************************************** init *******************************************************************************/ #define daytime_c_( H, M, S ) \ daytime_c( (H), (M), (S), 0 ) CLINGO_API cDaytime daytime_c( int64_t h, int64_t m, int64_t s, int64_t n ); CLINGO_API cDaytime local_daytime_c( void ); CLINGO_API cDaytime null_daytime_c( void ); CLINGO_API cDaytime utc_daytime_c( void ); /******************************************************************************* from *******************************************************************************/ CLINGO_API cDaytime from_duration_c( cDuration dur ); CLINGO_API cDaytime from_hmsn_c( cHmsn hmsn ); /******************************************************************************* as *******************************************************************************/ CLINGO_API cDuration as_duration_c( cDaytime dt ); CLINGO_API cHmsn as_hmsn_c( cDaytime dt ); /******************************************************************************* add *******************************************************************************/ CLINGO_API cDaytime add_to_daytime_c( cDaytime dt, cDuration dur ); /******************************************************************************* diff *******************************************************************************/ CLINGO_API cDuration between_daytimes_c( cDaytime a, cDaytime b ); /******************************************************************************* cmp *******************************************************************************/ CLINGO_API int cmp_daytime_c( cDaytime a, cDaytime b ); CLINGO_API bool daytime_is_valid_c( cDaytime dt ); CLINGO_API cDaytime early_daytime_c( cDaytime a, cDaytime b ); CLINGO_API inline bool eq_daytime_c( cDaytime a, cDaytime b ) { return ( a._v == b._v ); } CLINGO_API cDaytime late_daytime_c( cDaytime a, cDaytime b ); /******************************************************************************* io *******************************************************************************/ #define read_daytime_c_( Sca, Daytime ) \ read_daytime_c( (Sca), (Daytime), "" ) CLINGO_API bool read_daytime_c( cScanner sca[static 1], cDaytime dt[static 1], char const fmt[static 1] ); #define write_daytime_c_( Rec, Daytime ) \ write_daytime_c( (Rec), (Daytime), "" ) CLINGO_API bool write_daytime_c( cRecorder rec[static 1], cDaytime dt, char const fmt[static 1] ); #endif
36.11215
80
0.363354
d9b0c7b3ea3cd9130bf73b37e2ccbb7b8ddb2f76
17,912
c
C
sdk-6.5.20/libs/sdklt/bcmlrd/chip/bcm56996_a0/bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_em_map.c
copslock/broadcom_cpri
8e2767676e26faae270cf485591902a4c50cf0c5
[ "Spencer-94" ]
null
null
null
sdk-6.5.20/libs/sdklt/bcmlrd/chip/bcm56996_a0/bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_em_map.c
copslock/broadcom_cpri
8e2767676e26faae270cf485591902a4c50cf0c5
[ "Spencer-94" ]
null
null
null
sdk-6.5.20/libs/sdklt/bcmlrd/chip/bcm56996_a0/bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_em_map.c
copslock/broadcom_cpri
8e2767676e26faae270cf485591902a4c50cf0c5
[ "Spencer-94" ]
null
null
null
/******************************************************************************* * * DO NOT EDIT THIS FILE! * This file is auto-generated by fltg from * INTERNAL/fltg/xgs/tnl/bcm56996_a0/bcm56996_a0_TNL_L2_VXLAN_DECAP_OVID_IPV4_EM.map.ltl for * bcm56996_a0 * * Tool: $SDK/INTERNAL/fltg/bin/fltg * * Edits to this file will be lost when it is regenerated. * * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. * * Copyright 2007-2020 Broadcom Inc. All rights reserved. */ #include <bcmlrd/bcmlrd_internal.h> #include <bcmlrd/chip/bcmlrd_id.h> #include <bcmlrd/chip/bcm56996_a0/bcm56996_a0_lrd_field_data.h> #include <bcmlrd/chip/bcm56996_a0/bcm56996_a0_lrd_ltm_intf.h> #include <bcmlrd/chip/bcm56996_a0/bcm56996_a0_lrd_xfrm_field_desc.h> #include <bcmdrd/chip/bcm56996_a0_enum.h> #include "bcmltd/chip/bcmltd_common_enumpool.h" #include "bcm56996_a0_lrd_enumpool.h" /* TNL_L2_VXLAN_DECAP_OVID_IPV4_EM field init */ static const bcmlrd_field_data_t bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_em_map_field_data_mmd[] = { { /* 0 OVID */ .flags = BCMLTD_FIELD_F_KEY, .min = &bcm56996_a0_lrd_ifd_u16_0x0, .def = &bcm56996_a0_lrd_ifd_u16_0x0, .max = &bcm56996_a0_lrd_ifd_u16_0xfff, .depth = 0, .width = 12, .edata = NULL, }, { /* 1 OUTER_DST_IPV4 */ .flags = BCMLTD_FIELD_F_KEY, .min = &bcm56996_a0_lrd_ifd_u32_0x0, .def = &bcm56996_a0_lrd_ifd_u32_0x0, .max = &bcm56996_a0_lrd_ifd_u32_0xffffffff, .depth = 0, .width = 32, .edata = NULL, }, { /* 2 OUTER_SRC_IPV4 */ .flags = BCMLTD_FIELD_F_KEY, .min = &bcm56996_a0_lrd_ifd_u32_0x0, .def = &bcm56996_a0_lrd_ifd_u32_0x0, .max = &bcm56996_a0_lrd_ifd_u32_0xffffffff, .depth = 0, .width = 32, .edata = NULL, }, { /* 3 IPV6_PAYLOAD */ .flags = 0, .min = &bcm56996_a0_lrd_ifd_is_true_0x0, .def = &bcm56996_a0_lrd_ifd_is_true_0x0, .max = &bcm56996_a0_lrd_ifd_is_true_0x1, .depth = 0, .width = 1, .edata = NULL, }, { /* 4 IPV4_PAYLOAD */ .flags = 0, .min = &bcm56996_a0_lrd_ifd_is_true_0x0, .def = &bcm56996_a0_lrd_ifd_is_true_0x0, .max = &bcm56996_a0_lrd_ifd_is_true_0x1, .depth = 0, .width = 1, .edata = NULL, }, { /* 5 USE_TNL_HDR_TTL */ .flags = 0, .min = &bcm56996_a0_lrd_ifd_is_true_0x0, .def = &bcm56996_a0_lrd_ifd_is_true_0x0, .max = &bcm56996_a0_lrd_ifd_is_true_0x1, .depth = 0, .width = 1, .edata = NULL, }, { /* 6 KEEP_PAYLOAD_DSCP */ .flags = 0, .min = &bcm56996_a0_lrd_ifd_is_true_0x0, .def = &bcm56996_a0_lrd_ifd_is_true_0x0, .max = &bcm56996_a0_lrd_ifd_is_true_0x1, .depth = 0, .width = 1, .edata = NULL, }, { /* 7 L3_IIF_ID */ .flags = 0, .min = &bcm56996_a0_lrd_ifd_u32_0x0, .def = &bcm56996_a0_lrd_ifd_u32_0x0, .max = &bcm56996_a0_lrd_ifd_u32_0x1fff, .depth = 0, .width = 13, .edata = NULL, }, { /* 8 CLASS_ID */ .flags = 0, .min = &bcm56996_a0_lrd_ifd_u16_0x0, .def = &bcm56996_a0_lrd_ifd_u16_0x0, .max = &bcm56996_a0_lrd_ifd_u16_0xfff, .depth = 0, .width = 12, .edata = NULL, }, { /* 9 BFD */ .flags = 0, .min = &bcm56996_a0_lrd_ifd_is_true_0x0, .def = &bcm56996_a0_lrd_ifd_is_true_0x0, .max = &bcm56996_a0_lrd_ifd_is_true_0x1, .depth = 0, .width = 1, .edata = NULL, }, { /* 10 TNL_DECAP_PORT_PROFILE_ID */ .flags = 0, .min = &bcm56996_a0_lrd_ifd_u16_0x0, .def = &bcm56996_a0_lrd_ifd_u16_0x0, .max = &bcm56996_a0_lrd_ifd_u16_0xf, .depth = 0, .width = 4, .edata = NULL, }, { /* 11 CTR_ING_EFLEX_OBJECT */ .flags = 0, .min = &bcm56996_a0_lrd_ifd_u16_0x0, .def = &bcm56996_a0_lrd_ifd_u16_0x0, .max = &bcm56996_a0_lrd_ifd_u16_0x1fff, .depth = 0, .width = 13, .edata = NULL, }, { /* 12 CTR_ING_EFLEX_ACTION */ .flags = 0, .min = &bcm56996_a0_lrd_ifd_u8_0x0, .def = &bcm56996_a0_lrd_ifd_u8_0x0, .max = &bcm56996_a0_lrd_ifd_u8_0x1f, .depth = 0, .width = 5, .edata = NULL, }, { /* 13 IGNORE_UDP_CHKSUM */ .flags = 0, .min = &bcm56996_a0_lrd_ifd_is_true_0x0, .def = &bcm56996_a0_lrd_ifd_is_true_0x0, .max = &bcm56996_a0_lrd_ifd_is_true_0x1, .depth = 0, .width = 1, .edata = NULL, }, { /* 14 TNL_HDR_FOR_PHB */ .flags = BCMLTD_FIELD_F_ENUM, .min = &bcm56996_a0_lrd_ifd_u32_0x0, .def = &bcm56996_a0_lrd_ifd_u32_0x0, .max = &bcm56996_a0_lrd_ifd_u32_0x2, .depth = 0, .width = 2, .edata = BCM56996_A0_LRD_VXLAN_TNL_HDR_FOR_PHB_T_DATA, }, }; const bcmlrd_map_field_data_t bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_em_map_field_data = { .fields = 15, .field = bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_em_map_field_data_mmd }; static const bcmlrd_map_table_attr_t bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_emt_attr_entry[] = { { /* 0 */ .key = BCMLRD_MAP_TABLE_ATTRIBUTE_INTERACTIVE, .value = FALSE, }, { /* 1 */ .key = BCMLRD_MAP_TABLE_ATTRIBUTE_TABLE_SIZE, .value = 8192, }, }; static const bcmlrd_map_attr_t bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_emt_attr_group = { .attributes = 2, .attr = bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_emt_attr_entry, }; static const bcmlrd_map_entry_t bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_emt_l3_tunnel_double_map_entry[] = { { /* 0 */ .entry_type = BCMLRD_MAP_ENTRY_FIXED_KEY, .desc = { .field_id = BASE_VALID_0f, .field_idx = 0, .minbit = 0, .maxbit = 2, .entry_idx = 0, .reserved = 0 }, .u = { .fixed = { .value = 1, } }, }, { /* 1 */ .entry_type = BCMLRD_MAP_ENTRY_FIXED_KEY, .desc = { .field_id = BASE_VALID_1f, .field_idx = 0, .minbit = 120, .maxbit = 122, .entry_idx = 0, .reserved = 0 }, .u = { .fixed = { .value = 7, } }, }, { /* 2 */ .entry_type = BCMLRD_MAP_ENTRY_FIXED_KEY, .desc = { .field_id = KEY_TYPEf, .field_idx = 0, .minbit = 3, .maxbit = 5, .entry_idx = 0, .reserved = 0 }, .u = { .fixed = { .value = 4, } }, }, { /* 3 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_KEY, .desc = { .field_id = VXLAN_SIP_DIP_V4v_O_DIPf, .field_idx = 0, .minbit = 18, .maxbit = 49, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_OUTER_DST_IPV4f, .field_idx = 0, .minbit = 0, .maxbit = 31, .entry_idx = 0, .reserved = 0 } } }, }, { /* 4 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_KEY, .desc = { .field_id = VXLAN_SIP_DIP_V4v_O_SIPf, .field_idx = 0, .minbit = 50, .maxbit = 81, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_OUTER_SRC_IPV4f, .field_idx = 0, .minbit = 0, .maxbit = 31, .entry_idx = 0, .reserved = 0 } } }, }, { /* 5 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_KEY, .desc = { .field_id = VXLAN_SIP_DIP_V4v_OVIDf, .field_idx = 0, .minbit = 6, .maxbit = 17, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_OVIDf, .field_idx = 0, .minbit = 0, .maxbit = 11, .entry_idx = 0, .reserved = 0 } } }, }, { /* 6 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_VALUE, .desc = { .field_id = VXLAN_SIP_DIP_V4v_PAYLOAD_IPV6f, .field_idx = 0, .minbit = 204, .maxbit = 204, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_IPV6_PAYLOADf, .field_idx = 0, .minbit = 0, .maxbit = 0, .entry_idx = 0, .reserved = 0 } } }, }, { /* 7 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_VALUE, .desc = { .field_id = VXLAN_SIP_DIP_V4v_PAYLOAD_IPV4f, .field_idx = 0, .minbit = 205, .maxbit = 205, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_IPV4_PAYLOADf, .field_idx = 0, .minbit = 0, .maxbit = 0, .entry_idx = 0, .reserved = 0 } } }, }, { /* 8 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_VALUE, .desc = { .field_id = VXLAN_SIP_DIP_V4v_USE_OUTER_HDR_PHBf, .field_idx = 0, .minbit = 206, .maxbit = 207, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_TNL_HDR_FOR_PHBf, .field_idx = 0, .minbit = 0, .maxbit = 1, .entry_idx = 0, .reserved = 0 } } }, }, { /* 9 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_VALUE, .desc = { .field_id = VXLAN_SIP_DIP_V4v_USE_OUTER_HDR_TTLf, .field_idx = 0, .minbit = 208, .maxbit = 208, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_USE_TNL_HDR_TTLf, .field_idx = 0, .minbit = 0, .maxbit = 0, .entry_idx = 0, .reserved = 0 } } }, }, { /* 10 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_VALUE, .desc = { .field_id = VXLAN_SIP_DIP_V4v_DONOT_CHANGE_INNER_HDR_DSCPf, .field_idx = 0, .minbit = 209, .maxbit = 209, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_KEEP_PAYLOAD_DSCPf, .field_idx = 0, .minbit = 0, .maxbit = 0, .entry_idx = 0, .reserved = 0 } } }, }, { /* 11 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_VALUE, .desc = { .field_id = VXLAN_SIP_DIP_V4v_L3_IIFf, .field_idx = 0, .minbit = 210, .maxbit = 222, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_L3_IIF_IDf, .field_idx = 0, .minbit = 0, .maxbit = 12, .entry_idx = 0, .reserved = 0 } } }, }, { /* 12 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_VALUE, .desc = { .field_id = VXLAN_SIP_DIP_V4v_TUNNEL_CLASS_IDf, .field_idx = 0, .minbit = 223, .maxbit = 234, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_CLASS_IDf, .field_idx = 0, .minbit = 0, .maxbit = 11, .entry_idx = 0, .reserved = 0 } } }, }, { /* 13 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_VALUE, .desc = { .field_id = VXLAN_SIP_DIP_V4v_BFD_ENABLEf, .field_idx = 0, .minbit = 235, .maxbit = 235, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_BFDf, .field_idx = 0, .minbit = 0, .maxbit = 0, .entry_idx = 0, .reserved = 0 } } }, }, { /* 14 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_VALUE, .desc = { .field_id = VXLAN_SIP_DIP_V4v_ALLOWED_PORT_BITMAP_PROFILE_PTRf, .field_idx = 0, .minbit = 236, .maxbit = 239, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_TNL_DECAP_PORT_PROFILE_IDf, .field_idx = 0, .minbit = 0, .maxbit = 3, .entry_idx = 0, .reserved = 0 } } }, }, { /* 15 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_VALUE, .desc = { .field_id = VXLAN_SIP_DIP_V4v_FLEX_CTR_OBJECTf, .field_idx = 0, .minbit = 186, .maxbit = 198, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_CTR_ING_EFLEX_OBJECTf, .field_idx = 0, .minbit = 0, .maxbit = 12, .entry_idx = 0, .reserved = 0 } } }, }, { /* 16 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_VALUE, .desc = { .field_id = VXLAN_SIP_DIP_V4v_FLEX_CTR_ACTIONf, .field_idx = 0, .minbit = 199, .maxbit = 203, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_CTR_ING_EFLEX_ACTIONf, .field_idx = 0, .minbit = 0, .maxbit = 4, .entry_idx = 0, .reserved = 0 } } }, }, { /* 17 */ .entry_type = BCMLRD_MAP_ENTRY_MAPPED_VALUE, .desc = { .field_id = VXLAN_SIP_DIP_V4v_IGNORE_UDP_CHECKSUMf, .field_idx = 0, .minbit = 185, .maxbit = 185, .entry_idx = 0, .reserved = 0 }, .u = { .mapped = { .src = { .field_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt_IGNORE_UDP_CHKSUMf, .field_idx = 0, .minbit = 0, .maxbit = 0, .entry_idx = 0, .reserved = 0 } } }, }, }; static const bcmlrd_map_group_t bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_em_map_group[] = { { .dest = { .kind = BCMLRD_MAP_PHYSICAL, .id = L3_TUNNEL_DOUBLEm, }, .entries = 18, .entry = bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_emt_l3_tunnel_double_map_entry }, }; const bcmlrd_map_t bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_em_map = { .src_id = TNL_L2_VXLAN_DECAP_OVID_IPV4_EMt, .field_data = &bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_em_map_field_data, .groups = 1, .group = bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_em_map_group, .table_attr = &bcm56996_a0_lrd_tnl_l2_vxlan_decap_ovid_ipv4_emt_attr_group, .entry_ops = BCMLRD_MAP_TABLE_ENTRY_OPERATION_LOOKUP | BCMLRD_MAP_TABLE_ENTRY_OPERATION_TRAVERSE | BCMLRD_MAP_TABLE_ENTRY_OPERATION_INSERT | BCMLRD_MAP_TABLE_ENTRY_OPERATION_UPDATE | BCMLRD_MAP_TABLE_ENTRY_OPERATION_DELETE };
30.053691
226
0.466503
d9b1bb28fb2a238db1a40627adbbeb211a67dc5e
2,720
h
C
library/stdlib/stdlib_constructor.h
sodero/clib2-1
f1f328909735c88ec2e1d4059d1b941ba859ba91
[ "Unlicense", "BSD-3-Clause" ]
null
null
null
library/stdlib/stdlib_constructor.h
sodero/clib2-1
f1f328909735c88ec2e1d4059d1b941ba859ba91
[ "Unlicense", "BSD-3-Clause" ]
null
null
null
library/stdlib/stdlib_constructor.h
sodero/clib2-1
f1f328909735c88ec2e1d4059d1b941ba859ba91
[ "Unlicense", "BSD-3-Clause" ]
null
null
null
/* * $Id: stdlib_constructor.h,v 1.3 2006-01-08 12:04:25 clib2devs Exp $ */ #ifndef _STDLIB_CONSTRUCTOR_H #define _STDLIB_CONSTRUCTOR_H /****************************************************************************/ /* Constructor and destructor functions, as used by the library for data initialization and cleanup. These particular functions are invoked by the startup code before and after the main() function is/was called. How this works is very compiler specific. We support three flavours below. */ /****************************************************************************/ #define CONSTRUCTOR(name,pri) \ STATIC VOID __attribute__((used)) name##_ctor(VOID); \ STATIC VOID (*__##name##_ctor)(VOID) __attribute__((used,section(".ctors._" #pri))) = name##_ctor; \ STATIC VOID name##_ctor(VOID) #define DESTRUCTOR(name,pri) \ STATIC VOID __attribute__((used)) name##_dtor(VOID); \ STATIC VOID (*__##name##_dtor)(VOID) __attribute__((used,section(".dtors._" #pri))) = name##_dtor; \ STATIC VOID name##_dtor(VOID) #define CONSTRUCTOR_SUCCEED() \ return #define CONSTRUCTOR_FAIL() \ exit(RETURN_FAIL) /****************************************************************************/ /* These macros are for declaring functions to serve as constructors or destructors. In which order these should be invoked is defined by the priority, which is a number in the range 0-999. User-supplied constructor/destructor functions should have priority 0. That way, the user-supplied constructors will be invoked after the library constructors and the user-supplied destructors before the library destructors. */ #define STDLIB_CONSTRUCTOR(name) CONSTRUCTOR(name, 9) #define STDLIB_DESTRUCTOR(name) DESTRUCTOR(name, 9) #define STK_CONSTRUCTOR(name) CONSTRUCTOR(name, 8) #define STK_DESTRUCTOR(name) DESTRUCTOR(name, 8) #define STDIO_CONSTRUCTOR(name) CONSTRUCTOR(name, 7) #define STDIO_DESTRUCTOR(name) DESTRUCTOR(name, 7) #define FILE_CONSTRUCTOR(name) CONSTRUCTOR(name, 6) #define FILE_DESTRUCTOR(name) DESTRUCTOR(name, 6) #define MATH_CONSTRUCTOR(name) CONSTRUCTOR(name, 5) #define MATH_DESTRUCTOR(name) DESTRUCTOR(name, 5) #define SOCKET_CONSTRUCTOR(name) CONSTRUCTOR(name, 4) #define SOCKET_DESTRUCTOR(name) DESTRUCTOR(name, 4) #define ARG_CONSTRUCTOR(name) CONSTRUCTOR(name, 3) #define ARG_DESTRUCTOR(name) DESTRUCTOR(name, 3) #define CLIB_CONSTRUCTOR(name) CONSTRUCTOR(name, 2) #define CLIB_DESTRUCTOR(name) DESTRUCTOR(name, 2) #define PROFILE_CONSTRUCTOR(name) CONSTRUCTOR(name, 1) #define PROFILE_DESTRUCTOR(name) DESTRUCTOR(name, 1) /****************************************************************************/ #endif /* _STDLIB_CONSTRUCTOR_H */
36.756757
101
0.672794
d9b2de13bd918d565ea5fe9d608da5ba3c6135c0
1,712
h
C
lib/extras/codec_jpg.h
krinfels/jpeg-xl
c8b827fdffaacfd2dd6fab9a34659d3b415350b6
[ "Apache-2.0" ]
1
2021-04-26T19:19:08.000Z
2021-04-26T19:19:08.000Z
lib/extras/codec_jpg.h
krinfels/jpeg-xl
c8b827fdffaacfd2dd6fab9a34659d3b415350b6
[ "Apache-2.0" ]
null
null
null
lib/extras/codec_jpg.h
krinfels/jpeg-xl
c8b827fdffaacfd2dd6fab9a34659d3b415350b6
[ "Apache-2.0" ]
1
2021-06-17T15:55:20.000Z
2021-06-17T15:55:20.000Z
// Copyright (c) the JPEG XL Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef LIB_EXTRAS_CODEC_JPG_H_ #define LIB_EXTRAS_CODEC_JPG_H_ // Encodes JPG pixels and metadata in memory. #include <stdint.h> #include "lib/extras/codec.h" #include "lib/jxl/base/data_parallel.h" #include "lib/jxl/base/padded_bytes.h" #include "lib/jxl/base/span.h" #include "lib/jxl/base/status.h" #include "lib/jxl/codec_in_out.h" namespace jxl { enum class JpegEncoder { kLibJpeg, kSJpeg, }; static inline bool IsJPG(const Span<const uint8_t> bytes) { if (bytes.size() < 2) return false; if (bytes[0] != 0xFF || bytes[1] != 0xD8) return false; return true; } // Decodes `bytes` into `io`. io->dec_hints are ignored. Status DecodeImageJPG(const Span<const uint8_t> bytes, ThreadPool* pool, CodecInOut* io); // Encodes into `bytes`. Status EncodeImageJPG(const CodecInOut* io, JpegEncoder encoder, size_t quality, YCbCrChromaSubsampling chroma_subsampling, ThreadPool* pool, PaddedBytes* bytes, const DecodeTarget target = DecodeTarget::kPixels); } // namespace jxl #endif // LIB_EXTRAS_CODEC_JPG_H_
31.127273
80
0.706776
d9b4e1c09b4196b0d6059fe998b409da4a95cbd7
509
h
C
PrivateFrameworks/Transparency/GPBFieldMask.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
17
2018-11-13T04:02:58.000Z
2022-01-20T09:27:13.000Z
PrivateFrameworks/Transparency/GPBFieldMask.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
3
2018-04-06T02:02:27.000Z
2018-10-02T01:12:10.000Z
PrivateFrameworks/Transparency/GPBFieldMask.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
1
2018-09-28T13:54:23.000Z
2018-09-28T13:54:23.000Z
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import <Transparency/GPBMessage.h> @class NSMutableArray; __attribute__((visibility("hidden"))) @interface GPBFieldMask : GPBMessage { } + (id)descriptor; // Remaining properties @property(retain, nonatomic) NSMutableArray *pathsArray; // @dynamic pathsArray; @property(readonly, nonatomic) unsigned long long pathsArray_Count; // @dynamic pathsArray_Count; @end
21.208333
97
0.72888
d9b60f0fe7c4c6e3bdc44b9cebc91c6acb3622fd
2,768
h
C
Graphics/HLSL2GLSLConverterLib/interface/HLSL2GLSLConverter.h
IngoChou/DiligentCore
df6a316b684e2f2214e0b987f735c3e20a1d3418
[ "Apache-2.0" ]
1
2020-01-22T01:38:42.000Z
2020-01-22T01:38:42.000Z
Graphics/HLSL2GLSLConverterLib/interface/HLSL2GLSLConverter.h
IngoChou/DiligentCore
df6a316b684e2f2214e0b987f735c3e20a1d3418
[ "Apache-2.0" ]
null
null
null
Graphics/HLSL2GLSLConverterLib/interface/HLSL2GLSLConverter.h
IngoChou/DiligentCore
df6a316b684e2f2214e0b987f735c3e20a1d3418
[ "Apache-2.0" ]
null
null
null
/* Copyright 2019 Diligent Graphics LLC * * 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 * * 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 OF ANY PROPRIETARY RIGHTS. * * In no event and under no legal theory, whether in tort (including negligence), * contract, or otherwise, unless required by applicable law (such as deliberate * and grossly negligent acts) or agreed to in writing, shall any Contributor be * liable for any damages, including any direct, indirect, special, incidental, * or consequential damages of any character arising as a result of this License or * out of the use or inability to use the software (including but not limited to damages * for loss of goodwill, work stoppage, computer failure or malfunction, or any and * all other commercial damages or losses), even if such Contributor has been advised * of the possibility of such damages. */ #pragma once /// \file /// Definition of the Diligent::IHLSL2GLSLConverter interface #include "../../GraphicsEngine/interface/Shader.h" #include "../../../Primitives/interface/DataBlob.h" namespace Diligent { // {1FDE020A-9C73-4A76-8AEF-C2C6C2CF0EA5} static constexpr INTERFACE_ID IID_HLSL2GLSLConversionStream = {0x1fde020a, 0x9c73, 0x4a76, {0x8a, 0xef, 0xc2, 0xc6, 0xc2, 0xcf, 0xe, 0xa5}}; class IHLSL2GLSLConversionStream : public IObject { public: virtual void Convert(const Char* EntryPoint, SHADER_TYPE ShaderType, bool IncludeDefintions, const char* SamplerSuffix, bool UseInOutLocationQualifiers, IDataBlob** ppGLSLSource) = 0; }; // {44A21160-77E0-4DDC-A57E-B8B8B65B5342} static constexpr INTERFACE_ID IID_HLSL2GLSLConverter = {0x44a21160, 0x77e0, 0x4ddc, {0xa5, 0x7e, 0xb8, 0xb8, 0xb6, 0x5b, 0x53, 0x42}}; /// Interface to the buffer object implemented in OpenGL class IHLSL2GLSLConverter : public IObject { public: virtual void CreateStream(const Char* InputFileName, IShaderSourceInputStreamFactory* pSourceStreamFactory, const Char* HLSLSource, size_t NumSymbols, IHLSL2GLSLConversionStream** ppStream) const = 0; }; } // namespace Diligent
41.313433
90
0.665101
d9b8f751e5829f08d51d2b49eeaeb6e412842574
11,184
h
C
aws-cpp-sdk-redshift/include/aws/redshift/model/UpdatePartnerStatusRequest.h
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-02-12T08:09:30.000Z
2022-02-12T08:09:30.000Z
aws-cpp-sdk-redshift/include/aws/redshift/model/UpdatePartnerStatusRequest.h
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-01-03T23:59:37.000Z
2022-01-03T23:59:37.000Z
aws-cpp-sdk-redshift/include/aws/redshift/model/UpdatePartnerStatusRequest.h
ravindra-wagh/aws-sdk-cpp
7d5ff01b3c3b872f31ca98fb4ce868cd01e97696
[ "Apache-2.0" ]
1
2021-12-30T04:25:33.000Z
2021-12-30T04:25:33.000Z
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/redshift/Redshift_EXPORTS.h> #include <aws/redshift/RedshiftRequest.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/redshift/model/PartnerIntegrationStatus.h> #include <utility> namespace Aws { namespace Redshift { namespace Model { /** */ class AWS_REDSHIFT_API UpdatePartnerStatusRequest : public RedshiftRequest { public: UpdatePartnerStatusRequest(); // Service request name is the Operation name which will send this request out, // each operation should has unique request name, so that we can get operation's name from this request. // Note: this is not true for response, multiple operations may have the same response name, // so we can not get operation's name from response. inline virtual const char* GetServiceRequestName() const override { return "UpdatePartnerStatus"; } Aws::String SerializePayload() const override; protected: void DumpBodyToUrl(Aws::Http::URI& uri ) const override; public: /** * <p>The Amazon Web Services account ID that owns the cluster.</p> */ inline const Aws::String& GetAccountId() const{ return m_accountId; } /** * <p>The Amazon Web Services account ID that owns the cluster.</p> */ inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; } /** * <p>The Amazon Web Services account ID that owns the cluster.</p> */ inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; } /** * <p>The Amazon Web Services account ID that owns the cluster.</p> */ inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); } /** * <p>The Amazon Web Services account ID that owns the cluster.</p> */ inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); } /** * <p>The Amazon Web Services account ID that owns the cluster.</p> */ inline UpdatePartnerStatusRequest& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;} /** * <p>The Amazon Web Services account ID that owns the cluster.</p> */ inline UpdatePartnerStatusRequest& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;} /** * <p>The Amazon Web Services account ID that owns the cluster.</p> */ inline UpdatePartnerStatusRequest& WithAccountId(const char* value) { SetAccountId(value); return *this;} /** * <p>The cluster identifier of the cluster whose partner integration status is * being updated.</p> */ inline const Aws::String& GetClusterIdentifier() const{ return m_clusterIdentifier; } /** * <p>The cluster identifier of the cluster whose partner integration status is * being updated.</p> */ inline bool ClusterIdentifierHasBeenSet() const { return m_clusterIdentifierHasBeenSet; } /** * <p>The cluster identifier of the cluster whose partner integration status is * being updated.</p> */ inline void SetClusterIdentifier(const Aws::String& value) { m_clusterIdentifierHasBeenSet = true; m_clusterIdentifier = value; } /** * <p>The cluster identifier of the cluster whose partner integration status is * being updated.</p> */ inline void SetClusterIdentifier(Aws::String&& value) { m_clusterIdentifierHasBeenSet = true; m_clusterIdentifier = std::move(value); } /** * <p>The cluster identifier of the cluster whose partner integration status is * being updated.</p> */ inline void SetClusterIdentifier(const char* value) { m_clusterIdentifierHasBeenSet = true; m_clusterIdentifier.assign(value); } /** * <p>The cluster identifier of the cluster whose partner integration status is * being updated.</p> */ inline UpdatePartnerStatusRequest& WithClusterIdentifier(const Aws::String& value) { SetClusterIdentifier(value); return *this;} /** * <p>The cluster identifier of the cluster whose partner integration status is * being updated.</p> */ inline UpdatePartnerStatusRequest& WithClusterIdentifier(Aws::String&& value) { SetClusterIdentifier(std::move(value)); return *this;} /** * <p>The cluster identifier of the cluster whose partner integration status is * being updated.</p> */ inline UpdatePartnerStatusRequest& WithClusterIdentifier(const char* value) { SetClusterIdentifier(value); return *this;} /** * <p>The name of the database whose partner integration status is being * updated.</p> */ inline const Aws::String& GetDatabaseName() const{ return m_databaseName; } /** * <p>The name of the database whose partner integration status is being * updated.</p> */ inline bool DatabaseNameHasBeenSet() const { return m_databaseNameHasBeenSet; } /** * <p>The name of the database whose partner integration status is being * updated.</p> */ inline void SetDatabaseName(const Aws::String& value) { m_databaseNameHasBeenSet = true; m_databaseName = value; } /** * <p>The name of the database whose partner integration status is being * updated.</p> */ inline void SetDatabaseName(Aws::String&& value) { m_databaseNameHasBeenSet = true; m_databaseName = std::move(value); } /** * <p>The name of the database whose partner integration status is being * updated.</p> */ inline void SetDatabaseName(const char* value) { m_databaseNameHasBeenSet = true; m_databaseName.assign(value); } /** * <p>The name of the database whose partner integration status is being * updated.</p> */ inline UpdatePartnerStatusRequest& WithDatabaseName(const Aws::String& value) { SetDatabaseName(value); return *this;} /** * <p>The name of the database whose partner integration status is being * updated.</p> */ inline UpdatePartnerStatusRequest& WithDatabaseName(Aws::String&& value) { SetDatabaseName(std::move(value)); return *this;} /** * <p>The name of the database whose partner integration status is being * updated.</p> */ inline UpdatePartnerStatusRequest& WithDatabaseName(const char* value) { SetDatabaseName(value); return *this;} /** * <p>The name of the partner whose integration status is being updated.</p> */ inline const Aws::String& GetPartnerName() const{ return m_partnerName; } /** * <p>The name of the partner whose integration status is being updated.</p> */ inline bool PartnerNameHasBeenSet() const { return m_partnerNameHasBeenSet; } /** * <p>The name of the partner whose integration status is being updated.</p> */ inline void SetPartnerName(const Aws::String& value) { m_partnerNameHasBeenSet = true; m_partnerName = value; } /** * <p>The name of the partner whose integration status is being updated.</p> */ inline void SetPartnerName(Aws::String&& value) { m_partnerNameHasBeenSet = true; m_partnerName = std::move(value); } /** * <p>The name of the partner whose integration status is being updated.</p> */ inline void SetPartnerName(const char* value) { m_partnerNameHasBeenSet = true; m_partnerName.assign(value); } /** * <p>The name of the partner whose integration status is being updated.</p> */ inline UpdatePartnerStatusRequest& WithPartnerName(const Aws::String& value) { SetPartnerName(value); return *this;} /** * <p>The name of the partner whose integration status is being updated.</p> */ inline UpdatePartnerStatusRequest& WithPartnerName(Aws::String&& value) { SetPartnerName(std::move(value)); return *this;} /** * <p>The name of the partner whose integration status is being updated.</p> */ inline UpdatePartnerStatusRequest& WithPartnerName(const char* value) { SetPartnerName(value); return *this;} /** * <p>The value of the updated status.</p> */ inline const PartnerIntegrationStatus& GetStatus() const{ return m_status; } /** * <p>The value of the updated status.</p> */ inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; } /** * <p>The value of the updated status.</p> */ inline void SetStatus(const PartnerIntegrationStatus& value) { m_statusHasBeenSet = true; m_status = value; } /** * <p>The value of the updated status.</p> */ inline void SetStatus(PartnerIntegrationStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); } /** * <p>The value of the updated status.</p> */ inline UpdatePartnerStatusRequest& WithStatus(const PartnerIntegrationStatus& value) { SetStatus(value); return *this;} /** * <p>The value of the updated status.</p> */ inline UpdatePartnerStatusRequest& WithStatus(PartnerIntegrationStatus&& value) { SetStatus(std::move(value)); return *this;} /** * <p>The status message provided by the partner.</p> */ inline const Aws::String& GetStatusMessage() const{ return m_statusMessage; } /** * <p>The status message provided by the partner.</p> */ inline bool StatusMessageHasBeenSet() const { return m_statusMessageHasBeenSet; } /** * <p>The status message provided by the partner.</p> */ inline void SetStatusMessage(const Aws::String& value) { m_statusMessageHasBeenSet = true; m_statusMessage = value; } /** * <p>The status message provided by the partner.</p> */ inline void SetStatusMessage(Aws::String&& value) { m_statusMessageHasBeenSet = true; m_statusMessage = std::move(value); } /** * <p>The status message provided by the partner.</p> */ inline void SetStatusMessage(const char* value) { m_statusMessageHasBeenSet = true; m_statusMessage.assign(value); } /** * <p>The status message provided by the partner.</p> */ inline UpdatePartnerStatusRequest& WithStatusMessage(const Aws::String& value) { SetStatusMessage(value); return *this;} /** * <p>The status message provided by the partner.</p> */ inline UpdatePartnerStatusRequest& WithStatusMessage(Aws::String&& value) { SetStatusMessage(std::move(value)); return *this;} /** * <p>The status message provided by the partner.</p> */ inline UpdatePartnerStatusRequest& WithStatusMessage(const char* value) { SetStatusMessage(value); return *this;} private: Aws::String m_accountId; bool m_accountIdHasBeenSet; Aws::String m_clusterIdentifier; bool m_clusterIdentifierHasBeenSet; Aws::String m_databaseName; bool m_databaseNameHasBeenSet; Aws::String m_partnerName; bool m_partnerNameHasBeenSet; PartnerIntegrationStatus m_status; bool m_statusHasBeenSet; Aws::String m_statusMessage; bool m_statusMessageHasBeenSet; }; } // namespace Model } // namespace Redshift } // namespace Aws
35.504762
139
0.683745
d9b9ec823261212adb4f0f765d8000b8b04aa4ab
4,513
h
C
src/Pegasus/Common/Formatter.h
ncultra/Pegasus-2.5
4a0b9a1b37e2eae5c8105fdea631582dc2333f9a
[ "MIT" ]
null
null
null
src/Pegasus/Common/Formatter.h
ncultra/Pegasus-2.5
4a0b9a1b37e2eae5c8105fdea631582dc2333f9a
[ "MIT" ]
null
null
null
src/Pegasus/Common/Formatter.h
ncultra/Pegasus-2.5
4a0b9a1b37e2eae5c8105fdea631582dc2333f9a
[ "MIT" ]
1
2022-03-07T22:54:02.000Z
2022-03-07T22:54:02.000Z
//%2005//////////////////////////////////////////////////////////////////////// // // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; // IBM Corp.; EMC Corporation, The Open Group. // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; // EMC Corporation; VERITAS Software Corporation; The Open Group. // // 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. // //============================================================================== // //%///////////////////////////////////////////////////////////////////////////// #ifndef Pegasus_Formatter_h #define Pegasus_Formatter_h #include <Pegasus/Common/Config.h> #include <Pegasus/Common/String.h> #include <Pegasus/Common/Linkage.h> #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES PEGASUS_NAMESPACE_BEGIN /** <I><B>Experimental Interface</B></I><BR> Formatter is a class to build formatted strings from strings that contain variable defintions. The variable definitions in the strings are of the form $<int> where <int> is a single digit integer (0 - 9). The variable subsituted may be String, Boolean Integer, Unsigned Integer or real. The format subsitution may be escaped by preceding the $ with a \ usage: Formatter::format (FormatString, variable0,.., variable9) Example: <pre> int total = 4; int count = 2; String name = "Output" String output = Formatter::format( "total $0 average $1 on $2", total, total/count, name); produces the string "total 4 average 2 on Output" </pre> */ class PEGASUS_COMMON_LINKAGE Formatter { public: class Arg { public: enum Type { VOIDT, STRING, BOOLEAN, INTEGER, UINTEGER, LINTEGER, ULINTEGER, REAL }; Arg() : _type(VOIDT) { } Arg(const String& x) : _string(x), _type(STRING) { } Arg(const char* x) : _string(x), _type(STRING) { } Arg(Boolean x) : _boolean(x), _type(BOOLEAN) { } Arg(Sint32 x) : _integer(x), _type(INTEGER) { } Arg(Uint32 x) : _uinteger(x), _type(UINTEGER) { } Arg(Sint64 x) : _lInteger(x), _type(LINTEGER) { } Arg(Uint64 x) : _lUInteger(x), _type(ULINTEGER) { } Arg(Real64 x) : _real(x), _type(REAL) { } String toString() const; friend class MessageLoader; //l10n private: String _string; union { Sint32 _integer; Uint32 _uinteger; Real64 _real; int _boolean; Sint64 _lInteger; Uint64 _lUInteger; }; Type _type; }; /** Format function for the formatter */ static String format( const String& formatString, const Arg& arg0 = Formatter::DEFAULT_ARG, const Arg& arg1 = Formatter::DEFAULT_ARG, const Arg& arg2 = Formatter::DEFAULT_ARG, const Arg& arg3 = Formatter::DEFAULT_ARG, const Arg& arg4 = Formatter::DEFAULT_ARG, const Arg& arg5 = Formatter::DEFAULT_ARG, const Arg& arg6 = Formatter::DEFAULT_ARG, const Arg& arg7 = Formatter::DEFAULT_ARG, const Arg& arg8 = Formatter::DEFAULT_ARG, const Arg& arg9 = Formatter::DEFAULT_ARG); static const Formatter::Arg DEFAULT_ARG; }; PEGASUS_NAMESPACE_END #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */ #endif /* Pegasus_Formatter_h */
27.186747
80
0.665411
d9b9f354bff0769fd006518da0197ff0ea4716fa
2,786
h
C
Plugins/AdvKitPlugin/Source/AdvKitRuntime/Classes/Player/AdvKitGravityCharacter.h
crimsonstrife/velorum-defunct
1a6e1eab9057293da2aa045eff021d069df54c5e
[ "CC0-1.0" ]
null
null
null
Plugins/AdvKitPlugin/Source/AdvKitRuntime/Classes/Player/AdvKitGravityCharacter.h
crimsonstrife/velorum-defunct
1a6e1eab9057293da2aa045eff021d069df54c5e
[ "CC0-1.0" ]
null
null
null
Plugins/AdvKitPlugin/Source/AdvKitRuntime/Classes/Player/AdvKitGravityCharacter.h
crimsonstrife/velorum-defunct
1a6e1eab9057293da2aa045eff021d069df54c5e
[ "CC0-1.0" ]
null
null
null
// Copyright 2015 Pascal Krabbe #pragma once #include "AdvKitCharacter.h" #include "AdvKitGravityCharacter.generated.h" class UAdvKitGravityCharacterMovementComponent; /** * @brief Character class that supports arbitrary gravity provided by an orientation component. */ UCLASS(Blueprintable, abstract) class ADVKITRUNTIME_API AAdvKitGravityCharacter : public AAdvKitCharacter { GENERATED_BODY() public: /** Orientation component that provides gravity methods */ UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "AdvKit", Replicated) class UAdvKitOrientationComponent* WorldOrientationComponent; /** Component that traces down when orientation should be updated by trace */ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "AdvKit") class UAdvKitTraceUtilityComponent* TraceWorldOrientation; public: /** * Constructor */ AAdvKitGravityCharacter(const FObjectInitializer& ObjectInitializer); /** * Checks if a hit result is a valid floor for wall walking * @param NewFloor The floor to test * @return True if it is valid for wall walking */ UFUNCTION(BlueprintNativeEvent, Category = "AdvKit") bool CanWallWalkOn(FFindFloorResult NewFloor); virtual bool CanWallWalkOn_Implementation(FFindFloorResult NewFloor); /** * Set a new gravity orientation on the orientation component * @param GravityUpVector New Up vector for the gravity * @param Origin Origin of the gravitational pull * @param bForce Hard set new gravity instead of interpolating */ UFUNCTION(BlueprintCallable, Category = "AdvKit") virtual void SetNewOrientation(FVector GravityUpVector, FVector Origin = FVector::ZeroVector, bool bForce = false); /** * Server callback to set a new gravity orientation on the orientation component * @param GravityUpVector New Up vector for the gravity * @param Origin Origin of the gravitational pull * @param bForce Hard set new gravity instead of interpolating */ UFUNCTION(Server, Unreliable, WithValidation) void SetNewOrientationServer(FVector GravityUpVector, FVector Origin = FVector::ZeroVector, bool bForce = false); virtual void SetNewOrientationServer_Implementation(FVector GravityUpVector, FVector Origin = FVector::ZeroVector, bool bForce = false); /** * Get the gravity movement component of the character. * @return The gravity movement component of the character. */ UFUNCTION(BlueprintCallable, Category = "AdvKit") UAdvKitGravityCharacterMovementComponent* GetAdvGravityMovementComponent() const; protected: //Begin ACharacter Interface virtual void FaceRotation(FRotator NewControlRotation, float DeltaSeconds) override; //End ACharacter Interface public: // Begin AActor Interface virtual void PostInitializeComponents() override; // End AActor Interface };
34.395062
137
0.788945
d9bbb664dd9063dc4ebb683fa8ed558c8c6ab01e
2,975
h
C
include/fast_io_device.h
EwoutH/fast_io
1393ef01b82dffa87f3008ec0898431865870a1f
[ "MIT" ]
2
2020-07-20T06:07:20.000Z
2020-10-21T08:53:49.000Z
include/fast_io_device.h
EwoutH/fast_io
1393ef01b82dffa87f3008ec0898431865870a1f
[ "MIT" ]
null
null
null
include/fast_io_device.h
EwoutH/fast_io
1393ef01b82dffa87f3008ec0898431865870a1f
[ "MIT" ]
null
null
null
#pragma once //fast_io_devices.h defines commonly used io devices and their correlated mutex verisons. #include"fast_io_hosted.h" namespace fast_io { using ibuf_pipe = basic_ibuf<native_pipe>; using inative_file = input_file_wrapper<native_file>; using onative_file = output_file_wrapper<native_file>; using ionative_file = io_file_wrapper<native_file>; using sync_file = basic_sync<basic_file_wrapper<native_file,open_mode::app|open_mode::binary>,basic_ostring<std::string>>; using fsync_file = basic_fsync<basic_file_wrapper<native_file,open_mode::app|open_mode::binary>,basic_ostring<std::string>>; using omap_file = basic_omap<basic_file_wrapper<native_file,open_mode::trunc|open_mode::out|open_mode::binary>,native_file_map>; using sync_file_mutex = basic_iomutex<sync_file>; using fsync_file_mutex = basic_iomutex<fsync_file>; using ibuf_file = basic_ibuf<inative_file>; using obuf_file = basic_obuf<onative_file>; using iobuf_file = basic_iobuf<ionative_file>; using ibuf_file_mutex = basic_iomutex<ibuf_file>; using obuf_file_mutex = basic_iomutex<obuf_file>; using iobuf_file_mutex = basic_iomutex<iobuf_file>; using u8pipe = io_wrapper<u8native_pipe>; using u8inative_file = input_file_wrapper<u8native_file>; using u8onative_file = output_file_wrapper<u8native_file>; using u8ionative_file = io_file_wrapper<u8native_file>; using u8sync_file = basic_sync<basic_file_wrapper<u8native_file,open_mode::app|open_mode::binary>,basic_ostring<std::u8string>>; using u8fsync_file = basic_fsync<basic_file_wrapper<u8native_file,open_mode::app|open_mode::binary>,basic_ostring<std::u8string>>; using u8sync_file_mutex = basic_iomutex<u8sync_file>; using u8fsync_file_mutex = basic_iomutex<u8fsync_file>; using u8ibuf_file = basic_ibuf<u8inative_file>; using u8obuf_file = basic_obuf<u8onative_file>; using u8iobuf_file = basic_iobuf<u8ionative_file>; using u8ibuf_file_mutex = basic_iomutex<u8ibuf_file>; using u8obuf_file_mutex = basic_iomutex<u8obuf_file>; using u8iobuf_file_mutex = basic_iomutex<u8iobuf_file>; using wpipe = io_wrapper<wnative_pipe>; using winative_file = input_file_wrapper<wnative_file>; using wonative_file = output_file_wrapper<wnative_file>; using wionative_file = io_file_wrapper<wnative_file>; using wsync_file = basic_sync<basic_file_wrapper<wnative_file,open_mode::app|open_mode::binary>,basic_ostring<std::wstring>>; using wfsync_file = basic_fsync<basic_file_wrapper<wnative_file,open_mode::app|open_mode::binary>,basic_ostring<std::wstring>>; using wsync_file_mutex = basic_iomutex<wsync_file>; using wfsync_file_mutex = basic_iomutex<wfsync_file>; using wibuf_file = basic_ibuf<winative_file>; using wobuf_file = basic_obuf<wonative_file>; using wiobuf_file = basic_iobuf<wionative_file>; using wibuf_file_mutex = basic_iomutex<wibuf_file>; using wobuf_file_mutex = basic_iomutex<wobuf_file>; using wiobuf_file_mutex = basic_iomutex<wiobuf_file>; }
41.901408
131
0.813782
d9bc6d1087b8e4f9f2c46928ea17dfed59459acb
38,887
c
C
test/consumer/valueAPI.c
lgirdk/rbus
f6273d2ddb985878b192275e573e72b43df467af
[ "Apache-2.0" ]
null
null
null
test/consumer/valueAPI.c
lgirdk/rbus
f6273d2ddb985878b192275e573e72b43df467af
[ "Apache-2.0" ]
null
null
null
test/consumer/valueAPI.c
lgirdk/rbus
f6273d2ddb985878b192275e573e72b43df467af
[ "Apache-2.0" ]
null
null
null
#include <stdio.h> #include <ctype.h> #include <assert.h> #include <stdbool.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include <sys/time.h> #include <time.h> #include <errno.h> #include <endian.h> #include <float.h> #include <unistd.h> #include <rbus.h> #include "../../src/rbus_buffer.h" #include <math.h> #include "../common/test_macros.h" int getDurationValueAPI() { return 1; } void testValue_Type() { rbusValue_t val; rbusDateTime_t tv; printf("%s\n",__FUNCTION__); rbusValue_Init(&val); rbusValue_SetBoolean(val,true); TEST(rbusValue_GetType(val)==RBUS_BOOLEAN); rbusValue_SetChar(val,0); TEST(rbusValue_GetType(val)==RBUS_CHAR); rbusValue_SetByte(val,0); TEST(rbusValue_GetType(val)==RBUS_BYTE); /* rbusValue_SetInt8(val,0); TEST(rbusValue_GetType(val)==RBUS_INT8); rbusValue_SetUInt8(val,0); TEST(rbusValue_GetType(val)==RBUS_UINT8); */ rbusValue_SetInt16(val,0); TEST(rbusValue_GetType(val)==RBUS_INT16); rbusValue_SetUInt16(val,0); TEST(rbusValue_GetType(val)==RBUS_UINT16); rbusValue_SetInt32(val,0); TEST(rbusValue_GetType(val)==RBUS_INT32); rbusValue_SetUInt32(val,0); TEST(rbusValue_GetType(val)==RBUS_UINT32); rbusValue_SetInt64(val,0); TEST(rbusValue_GetType(val)==RBUS_INT64); rbusValue_SetUInt64(val,0); TEST(rbusValue_GetType(val)==RBUS_UINT64); rbusValue_SetSingle(val,0); TEST(rbusValue_GetType(val)==RBUS_SINGLE); rbusValue_SetDouble(val,0); TEST(rbusValue_GetType(val)==RBUS_DOUBLE); rbusValue_SetTime(val,&tv); TEST(rbusValue_GetType(val)==RBUS_DATETIME); rbusValue_SetString(val,""); TEST(rbusValue_GetType(val)==RBUS_STRING); rbusValue_SetBytes(val,(uint8_t*)"", 0); TEST(rbusValue_GetType(val)==RBUS_BYTES); /*set from buffer back type to integer*/ rbusValue_SetInt32(val,0); TEST(rbusValue_GetType(val)==RBUS_INT32); /*test NULL buffers and swithing to and from integer*/ rbusValue_SetString(val,NULL); TEST(rbusValue_GetType(val)==RBUS_STRING); rbusValue_SetBytes(val,NULL,0); TEST(rbusValue_GetType(val)==RBUS_BYTES); rbusValue_SetInt32(val,0); TEST(rbusValue_GetType(val)==RBUS_INT32); rbusValue_SetBytes(val,NULL,0); TEST(rbusValue_GetType(val)==RBUS_BYTES); rbusValue_SetString(val,NULL); TEST(rbusValue_GetType(val)==RBUS_STRING); rbusValue_SetString(val,NULL); TEST(rbusValue_GetType(val)==RBUS_STRING); rbusValue_SetInt32(val,0); TEST(rbusValue_GetType(val)==RBUS_INT32); rbusValue_Release(val); } void testValue_Bool() { rbusValue_t val; printf("%s\n",__FUNCTION__); rbusValue_Init(&val); rbusValue_SetBoolean(val, true); TEST(rbusValue_GetType(val)==RBUS_BOOLEAN); TEST(rbusValue_GetBoolean(val) == true); rbusValue_SetBoolean(val, false); TEST(rbusValue_GetBoolean(val) == false); rbusValue_SetBoolean(val, true); TEST(rbusValue_GetBoolean(val) == true); rbusValue_SetBoolean(val, true); TEST(rbusValue_GetBoolean(val) == true); rbusValue_SetBoolean(val, false); TEST(rbusValue_GetBoolean(val) == false); rbusValue_SetBoolean(val, false); TEST(rbusValue_GetBoolean(val) == false); /*set it to another type then set it back*/ rbusValue_SetInt32(val, 1); TEST(rbusValue_GetType(val)!=RBUS_BOOLEAN); rbusValue_SetBoolean(val, false); TEST(rbusValue_GetType(val)==RBUS_BOOLEAN); TEST(rbusValue_GetBoolean(val) == false); rbusValue_SetInt32(val, 1); TEST(rbusValue_GetType(val)!=RBUS_BOOLEAN); rbusValue_SetBoolean(val, true); TEST(rbusValue_GetType(val)==RBUS_BOOLEAN); TEST(rbusValue_GetBoolean(val) == true); rbusValue_SetString(val, "Test"); TEST(rbusValue_GetType(val)!=RBUS_BOOLEAN); rbusValue_SetBoolean(val, true); TEST(rbusValue_GetType(val)==RBUS_BOOLEAN); TEST(rbusValue_GetBoolean(val) == true); rbusValue_SetString(val, "Test"); TEST(rbusValue_GetType(val)!=RBUS_BOOLEAN); rbusValue_SetBoolean(val, false); TEST(rbusValue_GetType(val)==RBUS_BOOLEAN); TEST(rbusValue_GetBoolean(val) == false); rbusValue_Release(val); } void testValue_Char() { rbusValue_t val; printf("%s\n",__FUNCTION__); rbusValue_Init(&val); rbusValue_SetChar(val, 'a'); TEST(rbusValue_GetType(val)==RBUS_CHAR); TEST(rbusValue_GetChar(val)=='a'); rbusValue_SetByte(val, 0x0a); TEST(rbusValue_GetType(val)==RBUS_BYTE); TEST(rbusValue_GetByte(val)==0x0a); rbusValue_SetByte(val, 0xff); TEST(rbusValue_GetByte(val)==0xff); rbusValue_SetByte(val, 0xff+1); TEST(rbusValue_GetByte(val)==0x00); rbusValue_Release(val); } void testValue_Ints() { rbusValue_t val, val1, val2; printf("%s\n",__FUNCTION__); rbusValue_Init(&val); /* * Test min/max and GetType */ #if 0 /*INT8*/ rbusValue_SetInt8(val, INT8_MIN); TEST(rbusValue_GetInt8(val) == INT8_MIN); rbusValue_SetInt8(val, INT8_MAX); TEST(rbusValue_GetInt8(val) == INT8_MAX); rbusValue_SetInt8(val, INT8_MIN-1); TEST(rbusValue_GetInt8(val) == INT8_MAX); rbusValue_SetInt8(val, INT8_MAX+1); TEST(rbusValue_GetInt8(val) == INT8_MIN); /*UINT8*/ rbusValue_SetUInt8(val, 0); TEST(rbusValue_GetUInt8(val) == 0); rbusValue_SetUInt8(val, UINT8_MAX); TEST(rbusValue_GetUInt8(val) == UINT8_MAX); rbusValue_SetUInt8(val, -1); TEST(rbusValue_GetUInt8(val) == UINT8_MAX); rbusValue_SetUInt8(val, UINT8_MAX+1); TEST(rbusValue_GetUInt8(val) == 0); #endif /*INT16*/ rbusValue_SetInt16(val, INT16_MIN); TEST(rbusValue_GetInt16(val) == INT16_MIN); rbusValue_SetInt16(val, INT16_MAX); TEST(rbusValue_GetInt16(val) == INT16_MAX); rbusValue_SetInt16(val, INT16_MIN-1); TEST(rbusValue_GetInt16(val) == INT16_MAX); rbusValue_SetInt16(val, INT16_MAX+1); TEST(rbusValue_GetInt16(val) == INT16_MIN); /*UINT16*/ rbusValue_SetUInt16(val, 0); TEST(rbusValue_GetUInt16(val) == 0); rbusValue_SetUInt16(val, UINT16_MAX); TEST(rbusValue_GetUInt16(val) == UINT16_MAX); rbusValue_SetUInt16(val, -1); TEST(rbusValue_GetUInt16(val) == UINT16_MAX); rbusValue_SetUInt16(val, UINT16_MAX+1); TEST(rbusValue_GetUInt16(val) == 0); /*INT32*/ rbusValue_SetInt32(val, INT32_MIN); TEST(rbusValue_GetInt32(val) == INT32_MIN); rbusValue_SetInt32(val, INT32_MAX); TEST(rbusValue_GetInt32(val) == INT32_MAX); rbusValue_SetInt32(val, INT32_MIN-1); TEST(rbusValue_GetInt32(val) == INT32_MAX); rbusValue_SetInt32(val, INT32_MAX+1); TEST(rbusValue_GetInt32(val) == INT32_MIN); /*UINT16*/ rbusValue_SetUInt32(val, 0); TEST(rbusValue_GetUInt32(val) == 0); rbusValue_SetUInt32(val, UINT32_MAX); TEST(rbusValue_GetUInt32(val) == UINT32_MAX); rbusValue_SetUInt32(val, -1); TEST(rbusValue_GetUInt32(val) == UINT32_MAX); rbusValue_SetUInt32(val, UINT32_MAX+1); TEST(rbusValue_GetUInt32(val) == 0); /*INT64*/ rbusValue_SetInt64(val, INT64_MIN); TEST(rbusValue_GetInt64(val) == INT64_MIN); rbusValue_SetInt64(val, INT64_MAX); TEST(rbusValue_GetInt64(val) == INT64_MAX); rbusValue_SetInt64(val, INT64_MIN-1); TEST(rbusValue_GetInt64(val) == INT64_MAX); rbusValue_SetInt64(val, INT64_MAX+1); TEST(rbusValue_GetInt64(val) == INT64_MIN); /*UINT64*/ rbusValue_SetUInt64(val, 0); TEST(rbusValue_GetUInt64(val) == 0); rbusValue_SetUInt64(val, UINT64_MAX); TEST(rbusValue_GetUInt64(val) == UINT64_MAX); rbusValue_SetUInt64(val, -1); TEST(rbusValue_GetUInt64(val) == UINT64_MAX); rbusValue_SetUInt64(val, UINT64_MAX+1); TEST(rbusValue_GetUInt64(val) == 0); rbusValue_Release(val); /* * Compare values between types of different bits */ rbusValue_Init(&val1); rbusValue_Init(&val2); rbusValue_SetInt16(val1, 25000); rbusValue_SetInt32(val2, 25000); TEST(rbusValue_GetInt16(val1) == 25000); TEST(rbusValue_GetInt32(val2) == 25000); TEST(rbusValue_GetInt16(val1) == rbusValue_GetInt32(val2)); rbusValue_SetInt32(val1, 1500250); rbusValue_SetInt64(val2, 1500250); TEST(rbusValue_GetInt32(val1) == 1500250); TEST(rbusValue_GetInt64(val2) == 1500250); TEST(rbusValue_GetInt32(val1) == rbusValue_GetInt64(val2)); rbusValue_SetInt16(val1, -9022); rbusValue_SetInt64(val2, -9022); TEST(rbusValue_GetInt16(val1) == -9022); TEST(rbusValue_GetInt64(val2) == -9022); TEST(rbusValue_GetInt16(val1) == rbusValue_GetInt64(val2)); rbusValue_SetUInt16(val1, 60247); rbusValue_SetUInt32(val2, 60247); TEST(rbusValue_GetUInt16(val1) == 60247); TEST(rbusValue_GetUInt32(val2) == 60247); TEST(rbusValue_GetUInt16(val1) == rbusValue_GetUInt32(val2)); rbusValue_SetUInt32(val1, 4100200300); rbusValue_SetUInt64(val2, 4100200300); TEST(rbusValue_GetUInt32(val1) == 4100200300); TEST(rbusValue_GetUInt64(val2) == 4100200300); TEST(rbusValue_GetUInt32(val1) == rbusValue_GetUInt64(val2)); rbusValue_SetUInt16(val1, 12); rbusValue_SetUInt64(val2, 12); TEST(rbusValue_GetUInt16(val1) == 12); TEST(rbusValue_GetUInt64(val2) == 12); TEST(rbusValue_GetUInt16(val1) == rbusValue_GetUInt64(val2)); rbusValue_Release(val1); rbusValue_Release(val2); } void testValue_Floats() { int i; rbusValue_t val; rbusValue_Init(&val); printf("%s\n",__FUNCTION__); /*some very very basic tests*/ float singleValues[4] = { -0.000001f, 0.000001f, 12345.6789f, -9876.54321f }; for(i=0; i < 4; ++i) { rbusValue_SetSingle(val, singleValues[i]); TEST(rbusValue_GetType(val)==RBUS_SINGLE); //printf("test %.*f = %.*f\n", FLT_DIG, rbusValue_GetSingle(val), FLT_DIG, singleValues[i]); TEST(rbusValue_GetSingle(val) == singleValues[i]); } float doubleValues[4] = { -0.000000000000001, 0.000000000000001, 999999999999999.1, -999999999999999.1 }; for(i=0; i < 4; ++i) { rbusValue_SetDouble(val, doubleValues[i]); TEST(rbusValue_GetType(val)==RBUS_DOUBLE); //printf("test %.*f = %.*f\n", FLT_DIG, rbusValue_GetDouble(val), FLT_DIG, doubleValues[i]); TEST(rbusValue_GetDouble(val) == doubleValues[i]); } rbusValue_Release(val); } void testValue_Time() { rbusDateTime_t tv1; rbusDateTime_t const* tv2; time_t nowtime = 0; rbusValue_t val; rbusValue_Init(&val); printf("%s\n",__FUNCTION__); memcpy(&(tv1.m_time), localtime(&nowtime),sizeof(struct tm)); rbusValue_SetTime(val, &tv1); TEST(rbusValue_GetType(val)==RBUS_DATETIME); tv2 = rbusValue_GetTime(val); TEST(memcmp(&tv1, tv2, sizeof(rbusDateTime_t)) == 0); sleep(1); /*test replacing time works*/ memcpy(&(tv1.m_time), localtime(&nowtime),sizeof(struct tm)); rbusValue_SetTime(val, &tv1); tv2 = rbusValue_GetTime(val); TEST(memcmp(&tv1, tv2, sizeof(rbusDateTime_t)) == 0); rbusValue_Release(val); } void testValue_String() { int i; rbusValue_t val; rbusValue_Init(&val); printf("%s\n",__FUNCTION__); /*running through strings of various lengths*/ char const* strTest; int strTestLen; rbusValue_SetString(val, NULL); strTest = rbusValue_GetString(val, &strTestLen); TEST(rbusValue_GetType(val) == RBUS_STRING); TEST(strTestLen == 0); TEST(strTest == NULL); rbusValue_SetString(val, ""); strTest = rbusValue_GetString(val, &strTestLen); TEST(strTestLen == 0); TEST(strcmp(strTest,"")==0); int minChar=32; int maxChar=126; int charRange=maxChar-minChar+1; int numStrings = 1000; //printf("testing strings of size 1 to %d\n", numStrings); for(i=1; i<=numStrings; ++i) { int len; char const* str; int j; char* data; /*in the final loop, do a huge string*/ if(i == numStrings) { i = 1000000; //printf("testing huge string of size %d\n", i); } data = malloc(i+1); for(j=0; j<i; ++j) { data[j] = minChar + rand() % charRange; } data[i] = 0; rbusValue_SetString(val, data); TEST(rbusValue_GetType(val)==RBUS_STRING); str = rbusValue_GetString(val, &len); TEST(i == len); TEST(strcmp(data, str)==0); free(data); } rbusValue_Release(val); } void testValue_Bytes() { int i; uint8_t const* byteTest; int byteTestLen; /*test rbusValue_SetBytes works correctly for various buffer sizes, especially around the 64 byte buffer block size*/ int byteLength[18] = {0, 1, 62, 63, 64, 65, 127, 128, 129, 1023, 1024, 1025, 1026, 10000, 65534, 65535, 65536, 65537}; rbusValue_t val; printf("%s\n",__FUNCTION__); rbusValue_Init(&val); rbusValue_SetBytes(val, NULL, 0); byteTest = rbusValue_GetBytes(val, &byteTestLen); TEST(rbusValue_GetType(val) == RBUS_BYTES); TEST(byteTestLen == 0); TEST(byteTest == NULL); rbusValue_SetBytes(val, (uint8_t*)"", 0); byteTest = rbusValue_GetBytes(val, &byteTestLen); TEST(byteTestLen == 0); for(i=0; i < 18; ++i) { int j; int len = byteLength[i]; int len2; uint8_t* bytes = malloc(len); uint8_t const* bytes2; rbusValue_t bval; //printf("test bytes of length %d\n", len); rbusValue_Init(&bval); for(j=0; j<len; ++j) { bytes[j] = rand() % 8; } rbusValue_SetBytes(bval, bytes, len); TEST(rbusValue_GetType(bval)==RBUS_BYTES); bytes2 = rbusValue_GetBytes(bval, &len2); TEST(len == len2); if(len > 0) { TEST(memcmp(bytes, bytes2, len) == 0); } /*test repeated call to rbusValue_SetBytes replaces value correctly */ len = 100; uint8_t overwrite[100]; for(j=0; j<len; ++j) { overwrite[j] = rand() % 256; } rbusValue_SetBytes(bval, overwrite, len); bytes2 = rbusValue_GetBytes(bval, &len2); TEST(len == len2); TEST(memcmp(overwrite, bytes2, len) == 0); rbusValue_Release(bval); free(bytes); } rbusValue_Release(val); } #define TEST_VALUE_COERCE(F1,V1,F2,V2,RES)\ {\ rbusValue_t v1;\ rbusValue_t v2;\ rbusValue_Init(&v1);\ rbusValue_Init(&v2);\ rbusValue_Set##F1(v1, V1);\ rbusValue_Set##F2(v2, V2);\ TEST(rbusValue_Compare(v1, v2)==RES);\ rbusValue_Release(v1);\ rbusValue_Release(v2);\ } void testValue_Compare() { rbusValue_t v1; rbusValue_t v2; uint8_t bytes[1000]; int i; time_t tnow; struct tm* tlocal; rbusDateTime_t rbus_time; printf("%s\n",__FUNCTION__); time(&tnow); tlocal = localtime(&tnow); rbus_time.m_time = *tlocal; rbus_time.m_tz.m_tzhour = 5; rbus_time.m_tz.m_tzmin = 0; rbus_time.m_tz.m_isWest = true; for(i=0; i < 1000; ++i) bytes[i] = rand() % 256; rbusValue_Init(&v1); rbusValue_Init(&v2); TEST(rbusValue_Compare(v1, v2)==0); rbusValue_SetString(v1, "s1"); TEST(rbusValue_Compare(v1, v2)!=0); rbusValue_SetString(v2, "s1"); TEST(rbusValue_Compare(v1, v2)==0); rbusValue_SetInt32(v1, 1000); TEST(rbusValue_Compare(v1, v2)!=0); rbusValue_SetInt32(v2, 1000); TEST(rbusValue_Compare(v1, v2)==0); rbusValue_SetTime(v1, &rbus_time); TEST(rbusValue_Compare(v1, v2)!=0); rbusValue_SetTime(v2, &rbus_time); TEST(rbusValue_Compare(v1, v2)==0); rbusValue_SetBytes(v1, bytes, 1000); TEST(rbusValue_Compare(v1, v2)!=0); rbusValue_SetBytes(v2, bytes, 1000); TEST(rbusValue_Compare(v1, v2)==0); bytes[900] = bytes[900]+1; rbusValue_SetBytes(v2, bytes, 1000); TEST(rbusValue_Compare(v1, v2)!=0); TEST_VALUE_COERCE(Int32,0,UInt32,0,0); TEST_VALUE_COERCE(UInt32,0,Int32,0,0); TEST_VALUE_COERCE(Int32,-1,UInt32,0,-1); TEST_VALUE_COERCE(UInt32,0,Int32,-1,1); TEST_VALUE_COERCE(Int32,1,UInt32,2,-1); TEST_VALUE_COERCE(Int32,1,UInt32,1,0); TEST_VALUE_COERCE(Int32,1,UInt32,0,1); TEST_VALUE_COERCE(UInt32,100,Int32,101,-1); TEST_VALUE_COERCE(UInt32,100,Int32,100,0); TEST_VALUE_COERCE(UInt32,100,Int32,99,1); TEST_VALUE_COERCE(Boolean,true,Int32,-1,1); TEST_VALUE_COERCE(Boolean,true,Int32,0,1); TEST_VALUE_COERCE(Boolean,true,Int32,1,0); TEST_VALUE_COERCE(Boolean,true,Int32,2,-1); TEST_VALUE_COERCE(Boolean,false,Int32,-1,1); TEST_VALUE_COERCE(Boolean,false,Int32,0,0); TEST_VALUE_COERCE(Boolean,false,Int32,1,-1); TEST_VALUE_COERCE(Boolean,false,Int32,2,-1); TEST_VALUE_COERCE(Int32,-1,Boolean,true,-1); TEST_VALUE_COERCE(Int32,0,Boolean,true,-1); TEST_VALUE_COERCE(Int32,1,Boolean,true,0); TEST_VALUE_COERCE(Int32,2,Boolean,true,1); TEST_VALUE_COERCE(Int32,-1,Boolean,false,-1); TEST_VALUE_COERCE(Int32,0,Boolean,false,0); TEST_VALUE_COERCE(Int32,1,Boolean,false,1); TEST_VALUE_COERCE(Int32,2,Boolean,false,1); TEST_VALUE_COERCE(Int32,1,Single,0.999f,1); TEST_VALUE_COERCE(Int32,1,Single,1.0f,0); TEST_VALUE_COERCE(Int32,1,Single,1.001f,-1); TEST_VALUE_COERCE(Double,1000.0001,UInt32,999,1); TEST_VALUE_COERCE(Double,1000.0001,UInt32,1000,1); TEST_VALUE_COERCE(Double,1000.0001,UInt32,1001,-1); TEST_VALUE_COERCE(Double,1000.0001,UInt32,1000,1); TEST_VALUE_COERCE(Double,1000.0001,UInt32,1001,-1); rbusValue_Release(v1); rbusValue_Release(v2); } #if 0 void testValue_Copy() { rbusValue_t src; rbusValue_t dest; rbusValue_Init(&src); rbusValue_Init(&dest); rbusValue_SetString(src, "s1"); rbusValue_Copy(dest, src); TEST(rbusValue_GetType(dest) == RBUS_STRING); TEST(strcmp(rbusValue_GetString(dest,NULL), "s1")==0); TEST(rbusValue_Compare(dest, src)==0); rbusValue_SetInt32(src, -1234567); rbusValue_Copy(dest, src); TEST(rbusValue_GetType(dest) == RBUS_INT32); TEST(rbusValue_GetInt32(dest) == -1234567); TEST(rbusValue_Compare(dest, src)==0); rbusValue_SetBoolean(src, false); rbusValue_Copy(dest, src); TEST(rbusValue_GetType(dest) == RBUS_BOOLEAN); TEST(rbusValue_GetBoolean(dest) == false); TEST(rbusValue_Compare(dest, src)==0); rbusValue_Release(src); rbusValue_Release(dest); } #endif void testValue_Copy() { rbusValue_t src; rbusValue_t dest; printf("%s\n",__FUNCTION__); rbusValue_Init(&src); rbusValue_Init(&dest); rbusValue_SetString(src, "s1"); rbusValue_Copy(dest, src); TEST(rbusValue_GetType(dest) == RBUS_STRING); TEST(strcmp(rbusValue_GetString(dest,NULL), "s1")==0); TEST(rbusValue_GetType(src) == RBUS_STRING); rbusValue_SetInt32(src, -1234567); rbusValue_Copy(dest, src); TEST(rbusValue_GetType(dest) == RBUS_INT32); TEST(rbusValue_GetInt32(dest) == -1234567); TEST(rbusValue_GetType(src) == RBUS_INT32); rbusValue_SetBoolean(src, false); rbusValue_Copy(dest, src); TEST(rbusValue_GetType(dest) == RBUS_BOOLEAN); TEST(rbusValue_GetBoolean(dest) == false); rbusValue_Release(src); rbusValue_Release(dest); } int compareDateTime(const rbusDateTime_t* l, const rbusDateTime_t* r) { #if 0 printf("%d %d %d %d %d %d %d %d %d %d %d %d\n", l->m_time.tm_sec, l->m_time.tm_min, l->m_time.tm_hour, l->m_time.tm_mday, l->m_time.tm_mon, l->m_time.tm_year, l->m_time.tm_wday, l->m_time.tm_yday, l->m_time.tm_isdst, l->m_tz.m_tzhour, l->m_tz.m_tzmin, l->m_tz.m_isWest); printf("%d %d %d %d %d %d %d %d %d %d %d %d\n", r->m_time.tm_sec, r->m_time.tm_min, r->m_time.tm_hour, r->m_time.tm_mday, r->m_time.tm_mon, r->m_time.tm_year, r->m_time.tm_wday, r->m_time.tm_yday, r->m_time.tm_isdst, r->m_tz.m_tzhour, r->m_tz.m_tzmin, r->m_tz.m_isWest); #endif if( l->m_time.tm_sec == r->m_time.tm_sec || l->m_time.tm_min == r->m_time.tm_min || l->m_time.tm_hour == r->m_time.tm_hour || l->m_time.tm_mday == r->m_time.tm_mday || l->m_time.tm_mon == r->m_time.tm_mon || l->m_time.tm_year == r->m_time.tm_year || l->m_time.tm_wday == r->m_time.tm_wday || l->m_time.tm_yday == r->m_time.tm_yday || l->m_time.tm_isdst == r->m_time.tm_isdst || l->m_tz.m_tzhour == r->m_tz.m_tzhour || l->m_tz.m_tzmin == r->m_tz.m_tzmin || l->m_tz.m_isWest == r->m_tz.m_isWest) return 0; else return -1; } void testValue_Buffer() { int i; int len; uint8_t bytes[10000]; rbusDateTime_t rbus_time = {{0},{0}}; printf("%s\n",__FUNCTION__); for(i=0; i < 10000; ++i) bytes[i] = rand() % 256; for(i=RBUS_BOOLEAN; i<RBUS_NONE; ++i) { rbusValue_t valIn; rbusValue_t valOut; rbusBuffer_t buff; bool set = true; rbusValue_Init(&valIn); switch(i) { case RBUS_BOOLEAN: rbusValue_SetBoolean(valIn, true); break; case RBUS_CHAR: rbusValue_SetChar(valIn, 'a'); break; case RBUS_BYTE: rbusValue_SetByte(valIn, 0xa); break; //case RBUS_INT8: rbusValue_SetInt8(valIn, -127); break; //case RBUS_UINT8: rbusValue_SetUInt8(valIn, 255); break; case RBUS_INT16: rbusValue_SetInt16(valIn, 1232); break; case RBUS_UINT16: rbusValue_SetUInt16(valIn, 54325); break; case RBUS_INT32: rbusValue_SetInt32(valIn, -2009256); break; case RBUS_UINT32: rbusValue_SetUInt32(valIn, 112231); break; case RBUS_INT64: rbusValue_SetInt64(valIn, 500341898123); break; case RBUS_UINT64: rbusValue_SetUInt64(valIn, 12231412313); break; case RBUS_SINGLE: rbusValue_SetSingle(valIn, 3.141592653589793f); break; case RBUS_DOUBLE: rbusValue_SetDouble(valIn, 3.141592653589793); break; case RBUS_DATETIME:{ time_t tnow; time(&tnow); struct tm* tlocal = localtime(&tnow); rbus_time.m_time = *tlocal; rbus_time.m_tz.m_tzhour = 5; rbus_time.m_tz.m_tzmin = 0; rbus_time.m_tz.m_isWest = true; rbusValue_SetTime(valIn, &rbus_time); break; } case RBUS_STRING: rbusValue_SetString(valIn, "This is a string"); break; case RBUS_BYTES: rbusValue_SetBytes(valIn, bytes, 10000); break; default: set = false; break; } if(!set) { rbusValue_Release(valIn); continue; } rbusBuffer_Create(&buff); rbusValue_Encode(valIn, buff); rbusValue_Decode(&valOut, buff); TEST(rbusValue_GetType(valIn) == rbusValue_GetType(valOut)); switch(i) { case RBUS_BOOLEAN: TEST(rbusValue_GetBoolean(valOut)==true); break; case RBUS_CHAR: TEST(rbusValue_GetChar(valOut)=='a'); break; case RBUS_BYTE: TEST(rbusValue_GetByte(valOut)==0xa); break; //case RBUS_INT8: TEST(rbusValue_GetInt8(valOut)==-127); break; //case RBUS_UINT8: TEST(rbusValue_GetUInt8(valOut)==255); break; case RBUS_INT16: TEST(rbusValue_GetInt16(valOut)==1232); break; case RBUS_UINT16: TEST(rbusValue_GetUInt16(valOut)==54325); break; case RBUS_INT32: TEST(rbusValue_GetInt32(valOut)==-2009256); break; case RBUS_UINT32: TEST(rbusValue_GetUInt32(valOut)==112231); break; case RBUS_INT64: TEST(rbusValue_GetInt64(valOut)==500341898123); break; case RBUS_UINT64: TEST(rbusValue_GetUInt64(valOut)==12231412313); break; case RBUS_SINGLE: TEST(rbusValue_GetSingle(valOut)==rbusValue_GetSingle(valIn) && fabs(rbusValue_GetSingle(valOut))-3.14<0.01); break; case RBUS_DOUBLE: TEST(rbusValue_GetDouble(valOut)==rbusValue_GetDouble(valIn) && fabs(rbusValue_GetDouble(valOut))-3.14<0.01); break; case RBUS_DATETIME:TEST(compareDateTime(rbusValue_GetTime(valOut), &rbus_time)==0); break; case RBUS_STRING: TEST(strcmp(rbusValue_GetString(valOut, &len), "This is a string")==0 && len==strlen("This is a string")); break; case RBUS_BYTES: TEST(memcmp(rbusValue_GetBytes(valOut, &len), bytes, 10000)==0 && len==10000); break; default: break; } rbusBuffer_Destroy(buff); rbusValue_Release(valOut); rbusValue_Release(valIn); } } void testValue_TLV() { int i; int len; time_t nowtime = 0; uint8_t bytes[10000]; rbusDateTime_t rbus_time = {{0},{0}}; printf("%s\n",__FUNCTION__); for(i=0; i < 10000; ++i) bytes[i] = rand() % 256; for(i=RBUS_BOOLEAN; i<RBUS_NONE; ++i) { rbusValue_t valIn; rbusValue_t valOut; bool set = true; rbusValue_Init(&valIn); switch(i) { case RBUS_BOOLEAN: rbusValue_SetBoolean(valIn, true); break; case RBUS_CHAR: rbusValue_SetChar(valIn, 'a'); break; case RBUS_BYTE: rbusValue_SetByte(valIn, 0xa); break; //case RBUS_INT8: rbusValue_SetInt8(valIn, -127); break; //case RBUS_UINT8: rbusValue_SetUInt8(valIn, 255); break; case RBUS_INT16: rbusValue_SetInt16(valIn, 1232); break; case RBUS_UINT16: rbusValue_SetUInt16(valIn, 54325); break; case RBUS_INT32: rbusValue_SetInt32(valIn, -2009256); break; case RBUS_UINT32: rbusValue_SetUInt32(valIn, 112231); break; case RBUS_INT64: rbusValue_SetInt64(valIn, 500341898123); break; case RBUS_UINT64: rbusValue_SetUInt64(valIn, 12231412313); break; case RBUS_SINGLE: rbusValue_SetSingle(valIn, 3.141592653589793f); break; case RBUS_DOUBLE: rbusValue_SetDouble(valIn, 3.141592653589793); break; case RBUS_DATETIME: memcpy(&(rbus_time.m_time), localtime(&nowtime),sizeof(struct tm)); rbusValue_SetTime(valIn, &rbus_time); break; case RBUS_STRING: rbusValue_SetString(valIn, "This is a string"); break; case RBUS_BYTES: rbusValue_SetBytes(valIn, bytes, 10000); break; default: set = false; break; } if(!set) { rbusValue_Release(valIn); continue; } rbusValue_Init(&valOut); rbusValue_SetTLV(valOut, rbusValue_GetType(valIn),rbusValue_GetL(valIn),rbusValue_GetV(valIn)); switch(i) { case RBUS_BOOLEAN: TEST(rbusValue_GetBoolean(valOut)==true); break; case RBUS_CHAR: TEST(rbusValue_GetChar(valOut)=='a'); break; case RBUS_BYTE: TEST(rbusValue_GetByte(valOut)==0xa); break; //case RBUS_INT8: TEST(rbusValue_GetInt8(valOut)==-127); break; //case RBUS_UINT8: TEST(rbusValue_GetUInt8(valOut)==255); break; case RBUS_INT16: TEST(rbusValue_GetInt16(valOut)==1232); break; case RBUS_UINT16: TEST(rbusValue_GetUInt16(valOut)==54325); break; case RBUS_INT32: TEST(rbusValue_GetInt32(valOut)==-2009256); break; case RBUS_UINT32: TEST(rbusValue_GetUInt32(valOut)==112231); break; case RBUS_INT64: TEST(rbusValue_GetInt64(valOut)==500341898123); break; case RBUS_UINT64: TEST(rbusValue_GetUInt64(valOut)==12231412313); break; case RBUS_SINGLE: TEST(rbusValue_GetSingle(valOut)==rbusValue_GetSingle(valIn) && fabs(rbusValue_GetSingle(valOut))-3.14<0.01); break; case RBUS_DOUBLE: TEST(rbusValue_GetDouble(valOut)==rbusValue_GetDouble(valIn) && fabs(rbusValue_GetDouble(valOut))-3.14<0.01); break; case RBUS_DATETIME: TEST(memcmp(rbusValue_GetTime(valOut), &rbus_time, sizeof(rbus_time))==0); break; case RBUS_STRING: TEST(strcmp(rbusValue_GetString(valOut, &len), "This is a string")==0 && len==strlen("This is a string")); break; case RBUS_BYTES: TEST(memcmp(rbusValue_GetBytes(valOut, &len), bytes, 10000)==0 && len==10000); break; default: break; } rbusValue_Release(valOut); rbusValue_Release(valIn); } } void testValue_ToString() { rbusValue_t v; char* s; char buff[1000]; time_t nowtime = 0; rbusDateTime_t rbus_time = {{0},{0}}; uint8_t bytes[256] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " "Sed condimentum nibh vel justo mattis, ac blandit ex egestas. " "Integer eu ex vel mi ullamcorper rhoncus. Integer auctor venenatis " "neque, a sodales velit auctor id. Duis massa justo, consequat acet."; char bytesHex[513]; int i; printf("%s\n",__FUNCTION__); bytes[255]=0; for(i = 0; i < 256; ++i) { sprintf(&bytesHex[i*2], "%02X", bytes[i]); } bytesHex[512]=0; rbusValue_Init(&v); rbusValue_SetBoolean(v, true); s = rbusValue_ToString(v,0,0); TEST(!strcmp(s, "1")); free(s); rbusValue_SetChar(v, 'a'); s = rbusValue_ToString(v,0,0); TEST(!strcmp(s, "a")); free(s); rbusValue_SetByte(v, 0xc); s = rbusValue_ToString(v,0,0); TEST(!strcmp(s, "c")); free(s); rbusValue_SetInt16(v, -16); s = rbusValue_ToString(v,0,0); TEST(!strcmp(s, "-16")); free(s); rbusValue_SetUInt16(v, 16); s = rbusValue_ToString(v,0,0); TEST(!strcmp(s, "16")); free(s); rbusValue_SetInt32(v, -32); s = rbusValue_ToString(v,0,0); TEST(!strcmp(s, "-32")); free(s); rbusValue_SetUInt32(v, 32); s = rbusValue_ToString(v,0,0); TEST(!strcmp(s, "32")); free(s); rbusValue_SetInt64(v, -64); s = rbusValue_ToString(v,0,0); TEST(!strcmp(s, "-64")); free(s); rbusValue_SetUInt64(v, 64); s = rbusValue_ToString(v,0,0); TEST(!strcmp(s, "64")); free(s); rbusValue_SetSingle(v, 3.141592653589793); s = rbusValue_ToString(v,0,0); TEST(!strncmp(s, "3.14159", 6)); free(s); rbusValue_SetDouble(v, 3.141592653589793); s = rbusValue_ToString(v,0,0); TEST(!strncmp(s, "3.14159265358979", 15)); free(s); (void)rbus_time; (void)nowtime; #if 0 //TODO FIXME memcpy(&(rbus_time.m_time), localtime(&nowtime),sizeof(struct tm)); snprintf(buff, 1000, "%s", asctime(&rbus_time.m_time)); if(buff[strlen(buff)-1]=='\n')/*asctime adds a '\n', so remove it*/ buff[strlen(buff)-1] = 0; rbusValue_SetTime(v, &rbus_time); s = rbusValue_ToString(v,0,0); TEST(!strcmp(buff, s)); printf("buff=[%s] s=[%s]\n", buff, s); free(s); #endif rbusValue_SetString(v, "This Is A String"); s = rbusValue_ToString(v,0,0); TEST(!strcmp(s, "This Is A String")); free(s); rbusValue_SetBytes(v, bytes, 256); s = rbusValue_ToString(v,0,0); TEST(!strcmp(s, bytesHex)); free(s); /*test passing in a buff with sufficient length*/ rbusValue_SetString(v, "0123456789"); rbusValue_ToString(v,buff,1000); TEST(!strcmp(buff, "0123456789")); memset(buff, 0, 11); /*test passing in a buff without sufficient length*/ rbusValue_SetString(v, "0123456789"); rbusValue_ToString(v,buff,6);/*get 5 chars plus null terminator*/ TEST(!strcmp(buff, "012345")); rbusValue_Release(v); } void testValue_ToDebugString() { rbusValue_t v; char* s; char buff[1000]; time_t nowtime = 0; rbusDateTime_t rbus_time = {{0},{0}}; uint8_t bytes[256] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " "Sed condimentum nibh vel justo mattis, ac blandit ex egestas. " "Integer eu ex vel mi ullamcorper rhoncus. Integer auctor venenatis " "neque, a sodales velit auctor id. Duis massa justo, consequat acet."; char bytesHex[513]; int i; printf("%s\n",__FUNCTION__); rbusValue_Init(&v); bytes[255]=0; for(i = 0; i < 256; ++i) { sprintf(&bytesHex[i*2], "%02X", bytes[i]); } bytesHex[512]=0; rbusValue_SetBoolean(v, true); s = rbusValue_ToDebugString(v,0,0); TEST(!strcmp(s, "rbusValue type:RBUS_BOOLEAN value:1")); free(s); rbusValue_SetChar(v, 'a'); s = rbusValue_ToDebugString(v,0,0); TEST(!strcmp(s, "rbusValue type:RBUS_CHAR value:a")); free(s); rbusValue_SetByte(v, 0xc); s = rbusValue_ToDebugString(v,0,0); TEST(!strcmp(s, "rbusValue type:RBUS_BYTE value:c")); free(s); rbusValue_SetInt16(v, -16); s = rbusValue_ToDebugString(v,0,0); TEST(!strcmp(s, "rbusValue type:RBUS_INT16 value:-16")); free(s); rbusValue_SetUInt16(v, 16); s = rbusValue_ToDebugString(v,0,0); TEST(!strcmp(s, "rbusValue type:RBUS_UINT16 value:16")); free(s); rbusValue_SetInt32(v, -32); s = rbusValue_ToDebugString(v,0,0); TEST(!strcmp(s, "rbusValue type:RBUS_INT32 value:-32")); free(s); rbusValue_SetUInt32(v, 32); s = rbusValue_ToDebugString(v,0,0); TEST(!strcmp(s, "rbusValue type:RBUS_UINT32 value:32")); free(s); rbusValue_SetInt64(v, -64); s = rbusValue_ToDebugString(v,0,0); TEST(!strcmp(s, "rbusValue type:RBUS_INT64 value:-64")); free(s); rbusValue_SetUInt64(v, 64); s = rbusValue_ToDebugString(v,0,0); TEST(!strcmp(s, "rbusValue type:RBUS_UINT64 value:64")); free(s); rbusValue_SetSingle(v, 3.141592653589793); s = rbusValue_ToDebugString(v,0,0); TEST(!strncmp(s, "rbusValue type:RBUS_SINGLE value:3.14159", strlen("rbusValue type:RBUS_SINGLE value:3.14159"))); free(s); rbusValue_SetDouble(v, 3.141592653589793); s = rbusValue_ToDebugString(v,0,0); TEST(!strncmp(s, "rbusValue type:RBUS_DOUBLE value:3.14159265358979", strlen("rbusValue type:RBUS_DOUBLE value:3.14159265358979"))); free(s); (void)rbus_time; (void)nowtime; #if 0 //TODO FIXME memcpy(&(rbus_time.m_time), localtime(&nowtime),sizeof(struct tm)); snprintf(buff, 1000, "rbusValue type:RBUS_DATETIME value:%s", asctime(&rbus_time.m_time)); if(buff[strlen(buff)-1]=='\n')/*asctime adds a '\n', so remove it*/ buff[strlen(buff)-1] = 0; rbusValue_SetTime(v, &rbus_time); s = rbusValue_ToDebugString(v,0,0); TEST(!strcmp(buff, s)); free(s); #endif rbusValue_SetString(v, "This Is A String"); s = rbusValue_ToDebugString(v,0,0); TEST(!strcmp(s, "rbusValue type:RBUS_STRING value:This Is A String")); free(s); rbusValue_SetBytes(v, bytes, 256); s = rbusValue_ToDebugString(v,0,0); sprintf(buff, "rbusValue type:RBUS_BYTES value:%s", (char*)bytesHex); TEST(!strcmp(s, buff)); free(s); /*test passing in a buff with sufficient length*/ rbusValue_SetString(v, "0123456789"); rbusValue_ToDebugString(v,buff,1000); TEST(!strcmp(buff, "rbusValue type:RBUS_STRING value:0123456789")); memset(buff, 0, 100); /*test passing in a buff without sufficient length*/ rbusValue_SetString(v, "0123456789"); rbusValue_ToDebugString(v,buff, strlen("rbusValue type:RBUS_STRING value:012345")+1);/*get 5 chars from value plus null terminator*/ TEST(!strcmp(buff, "rbusValue type:RBUS_STRING value:012345")); rbusValue_Release(v); } void testValue_Print() { int i; printf("%s\n",__FUNCTION__); for(i=RBUS_BOOLEAN; i<RBUS_NONE; ++i) { rbusValue_t v; rbusValue_Init(&v); time_t nowtime = 0; rbusDateTime_t rbus_time = {{0},{0}}; uint8_t bytes[256] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " "Sed condimentum nibh vel justo mattis, ac blandit ex egestas. " "Integer eu ex vel mi ullamcorper rhoncus. Integer auctor venenatis " "neque, a sodales velit auctor id. Duis massa justo, consequat acet."; bytes[255]=0; switch(i) { case RBUS_BOOLEAN: rbusValue_SetBoolean(v, true); break; case RBUS_CHAR: rbusValue_SetChar(v, 'a'); break; case RBUS_BYTE: rbusValue_SetByte(v, 0xa); break; /* case RBUS_INT8: rbusValue_SetInt8(v, -127); break; case RBUS_UINT8: rbusValue_SetUInt8(v, 255); break; */ case RBUS_INT16: rbusValue_SetInt16(v, -16); break; case RBUS_UINT16: rbusValue_SetUInt16(v, -16); break; case RBUS_INT32: rbusValue_SetInt32(v, -32); break; case RBUS_UINT32: rbusValue_SetUInt32(v, -32); break; case RBUS_INT64: rbusValue_SetInt64(v, -64); break; case RBUS_UINT64: rbusValue_SetUInt64(v, -64); break; case RBUS_SINGLE: rbusValue_SetSingle(v, 3.141592653589793); break; case RBUS_DOUBLE: rbusValue_SetDouble(v, 3.141592653589793); break; case RBUS_DATETIME: memcpy(&(rbus_time.m_time), localtime(&nowtime),sizeof(struct tm)); rbusValue_SetTime(v, &rbus_time); break; case RBUS_STRING: rbusValue_SetString(v, "The Is A String"); break; case RBUS_BYTES: rbusValue_SetBytes(v, bytes, 256); break; default: break; } if(rbusValue_GetType(v) != RBUS_NONE) { char* sDebug = rbusValue_ToDebugString(v, NULL, 0); char* sValue = rbusValue_ToString(v, NULL, 0); printf("ToDebugString=[%s] ToString=[%s]\n", sDebug, sValue); free(sValue); free(sDebug); } rbusValue_Release(v); } } void testValueAPI(rbusHandle_t handle, int* countPass, int* countFail) { (void)handle; testValue_Type(); testValue_Bool(); testValue_Char(); testValue_Ints(); testValue_Floats(); testValue_Time(); testValue_String(); testValue_Bytes(); testValue_Compare(); testValue_Copy(); testValue_Buffer(); testValue_ToString(); testValue_ToDebugString(); testValue_TLV(); testValue_Print(); *countPass = gCountPass; *countFail = gCountFail; PRINT_TEST_RESULTS("test_ValueAPI"); }
29.844206
146
0.633374
8abce921ac986b8ba0a5c259115dcee3cf62db84
3,378
c
C
keyvi/3rdparty/msgpack-c/example/c/lib_buffer_unpack.c
remusao/keyvi
7ea51e4ae94d355c677cce349a1c17290f24252c
[ "Apache-2.0" ]
147
2015-10-06T19:10:01.000Z
2021-08-19T07:52:02.000Z
keyvi/3rdparty/msgpack-c/example/c/lib_buffer_unpack.c
remusao/keyvi
7ea51e4ae94d355c677cce349a1c17290f24252c
[ "Apache-2.0" ]
148
2015-10-06T09:24:56.000Z
2018-12-08T08:42:54.000Z
keyvi/3rdparty/msgpack-c/example/c/lib_buffer_unpack.c
remusao/keyvi
7ea51e4ae94d355c677cce349a1c17290f24252c
[ "Apache-2.0" ]
34
2015-10-09T06:55:52.000Z
2021-01-05T18:43:57.000Z
#include <msgpack.h> #include <stdio.h> #include <assert.h> typedef struct receiver { msgpack_sbuffer sbuf; size_t rest; } receiver; void receiver_init(receiver *r) { msgpack_packer pk; msgpack_sbuffer_init(&r->sbuf); msgpack_packer_init(&pk, &r->sbuf, msgpack_sbuffer_write); /* 1st object */ msgpack_pack_array(&pk, 3); msgpack_pack_int(&pk, 1); msgpack_pack_true(&pk); msgpack_pack_str(&pk, 7); msgpack_pack_str_body(&pk, "example", 7); /* 2nd object */ msgpack_pack_str(&pk, 6); msgpack_pack_str_body(&pk, "second", 6); /* 3rd object */ msgpack_pack_array(&pk, 2); msgpack_pack_int(&pk, 42); msgpack_pack_false(&pk); r->rest = r->sbuf.size; } size_t receiver_recv(receiver *r, char* buf, size_t try_size) { size_t off = r->sbuf.size - r->rest; size_t actual_size = try_size; if (actual_size > r->rest) actual_size = r->rest; memcpy(buf, r->sbuf.data + off, actual_size); r->rest -= actual_size; return actual_size; } size_t receiver_to_unpacker(receiver* r, size_t request_size, msgpack_unpacker *unpacker) { // make sure there's enough room, or expand the unpacker accordingly if (msgpack_unpacker_buffer_capacity(unpacker) < request_size) { msgpack_unpacker_reserve_buffer(unpacker, request_size); assert(msgpack_unpacker_buffer_capacity(unpacker) >= request_size); } size_t recv_len = receiver_recv(r, msgpack_unpacker_buffer(unpacker), request_size); msgpack_unpacker_buffer_consumed(unpacker, recv_len); return recv_len; } #define EACH_RECV_SIZE 4 void unpack(receiver* r) { /* buf is allocated by unpacker. */ msgpack_unpacker* unp = msgpack_unpacker_new(100); msgpack_unpacked result; msgpack_unpack_return ret; size_t recv_len; int recv_count = 0; int i = 0; msgpack_unpacked_init(&result); while (true) { recv_len = receiver_to_unpacker(r, EACH_RECV_SIZE, unp); if (recv_len == 0) break; // (reached end of input) printf("receive count: %d %zd bytes received.\n", recv_count++, recv_len); ret = msgpack_unpacker_next(unp, &result); while (ret == MSGPACK_UNPACK_SUCCESS) { msgpack_object obj = result.data; /* Use obj. */ printf("Object no %d:\n", ++i); msgpack_object_print(stdout, obj); printf("\n"); /* If you want to allocate something on the zone, you can use zone. */ /* msgpack_zone* zone = result.zone; */ /* The lifetime of the obj and the zone, */ ret = msgpack_unpacker_next(unp, &result); } if (ret == MSGPACK_UNPACK_PARSE_ERROR) { printf("The data in the buf is invalid format.\n"); msgpack_unpacked_destroy(&result); return; } } msgpack_unpacked_destroy(&result); msgpack_unpacker_free(unp); } int main(void) { receiver r; receiver_init(&r); unpack(&r); return 0; } /* Output */ /* receive count: 0 4 bytes received. receive count: 1 4 bytes received. receive count: 2 4 bytes received. Object no 1: [1, true, "example"] receive count: 3 4 bytes received. receive count: 4 4 bytes received. Object no 2: "second" receive count: 5 1 bytes received. Object no 3: [42, false] */
27.463415
82
0.64032
8abe8e42e045cd5828139d4ea2d011c42e200e79
11,130
h
C
arch/powerpc/include/asm/mmu.h
jainsakshi2395/linux
7ccb860232bb83fb60cd6bcf5aaf0c008d903acb
[ "Linux-OpenIB" ]
null
null
null
arch/powerpc/include/asm/mmu.h
jainsakshi2395/linux
7ccb860232bb83fb60cd6bcf5aaf0c008d903acb
[ "Linux-OpenIB" ]
1
2021-01-27T01:29:47.000Z
2021-01-27T01:29:47.000Z
arch/powerpc/include/asm/mmu.h
jainsakshi2395/linux
7ccb860232bb83fb60cd6bcf5aaf0c008d903acb
[ "Linux-OpenIB" ]
null
null
null
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_POWERPC_MMU_H_ #define _ASM_POWERPC_MMU_H_ #ifdef __KERNEL__ #include <linux/types.h> #include <asm/asm-const.h> /* * MMU features bit definitions */ /* * MMU families */ #define MMU_FTR_HPTE_TABLE ASM_CONST(0x00000001) #define MMU_FTR_TYPE_8xx ASM_CONST(0x00000002) #define MMU_FTR_TYPE_40x ASM_CONST(0x00000004) #define MMU_FTR_TYPE_44x ASM_CONST(0x00000008) #define MMU_FTR_TYPE_FSL_E ASM_CONST(0x00000010) #define MMU_FTR_TYPE_47x ASM_CONST(0x00000020) /* Radix page table supported and enabled */ #define MMU_FTR_TYPE_RADIX ASM_CONST(0x00000040) /* * Individual features below. */ /* * Supports KUAP feature * key 0 controlling userspace addresses on radix * Key 3 on hash */ #define MMU_FTR_BOOK3S_KUAP ASM_CONST(0x00000200) /* * Supports KUEP feature * key 0 controlling userspace addresses on radix * Key 3 on hash */ #define MMU_FTR_BOOK3S_KUEP ASM_CONST(0x00000400) /* * Support for memory protection keys. */ #define MMU_FTR_PKEY ASM_CONST(0x00000800) /* Guest Translation Shootdown Enable */ #define MMU_FTR_GTSE ASM_CONST(0x00001000) /* * Support for 68 bit VA space. We added that from ISA 2.05 */ #define MMU_FTR_68_BIT_VA ASM_CONST(0x00002000) /* * Kernel read only support. * We added the ppp value 0b110 in ISA 2.04. */ #define MMU_FTR_KERNEL_RO ASM_CONST(0x00004000) /* * We need to clear top 16bits of va (from the remaining 64 bits )in * tlbie* instructions */ #define MMU_FTR_TLBIE_CROP_VA ASM_CONST(0x00008000) /* Enable use of high BAT registers */ #define MMU_FTR_USE_HIGH_BATS ASM_CONST(0x00010000) /* Enable >32-bit physical addresses on 32-bit processor, only used * by CONFIG_PPC_BOOK3S_32 currently as BookE supports that from day 1 */ #define MMU_FTR_BIG_PHYS ASM_CONST(0x00020000) /* Enable use of broadcast TLB invalidations. We don't always set it * on processors that support it due to other constraints with the * use of such invalidations */ #define MMU_FTR_USE_TLBIVAX_BCAST ASM_CONST(0x00040000) /* Enable use of tlbilx invalidate instructions. */ #define MMU_FTR_USE_TLBILX ASM_CONST(0x00080000) /* This indicates that the processor cannot handle multiple outstanding * broadcast tlbivax or tlbsync. This makes the code use a spinlock * around such invalidate forms. */ #define MMU_FTR_LOCK_BCAST_INVAL ASM_CONST(0x00100000) /* This indicates that the processor doesn't handle way selection * properly and needs SW to track and update the LRU state. This * is specific to an errata on e300c2/c3/c4 class parts */ #define MMU_FTR_NEED_DTLB_SW_LRU ASM_CONST(0x00200000) /* Enable use of TLB reservation. Processor should support tlbsrx. * instruction and MAS0[WQ]. */ #define MMU_FTR_USE_TLBRSRV ASM_CONST(0x00800000) /* Use paired MAS registers (MAS7||MAS3, etc.) */ #define MMU_FTR_USE_PAIRED_MAS ASM_CONST(0x01000000) /* Doesn't support the B bit (1T segment) in SLBIE */ #define MMU_FTR_NO_SLBIE_B ASM_CONST(0x02000000) /* Support 16M large pages */ #define MMU_FTR_16M_PAGE ASM_CONST(0x04000000) /* Supports TLBIEL variant */ #define MMU_FTR_TLBIEL ASM_CONST(0x08000000) /* Supports tlbies w/o locking */ #define MMU_FTR_LOCKLESS_TLBIE ASM_CONST(0x10000000) /* Large pages can be marked CI */ #define MMU_FTR_CI_LARGE_PAGE ASM_CONST(0x20000000) /* 1T segments available */ #define MMU_FTR_1T_SEGMENT ASM_CONST(0x40000000) /* MMU feature bit sets for various CPUs */ #define MMU_FTRS_DEFAULT_HPTE_ARCH_V2 (MMU_FTR_HPTE_TABLE | MMU_FTR_TLBIEL | MMU_FTR_16M_PAGE) #define MMU_FTRS_POWER MMU_FTRS_DEFAULT_HPTE_ARCH_V2 #define MMU_FTRS_PPC970 MMU_FTRS_POWER | MMU_FTR_TLBIE_CROP_VA #define MMU_FTRS_POWER5 MMU_FTRS_POWER | MMU_FTR_LOCKLESS_TLBIE #define MMU_FTRS_POWER6 MMU_FTRS_POWER5 | MMU_FTR_KERNEL_RO | MMU_FTR_68_BIT_VA #define MMU_FTRS_POWER7 MMU_FTRS_POWER6 #define MMU_FTRS_POWER8 MMU_FTRS_POWER6 #define MMU_FTRS_POWER9 MMU_FTRS_POWER6 #define MMU_FTRS_POWER10 MMU_FTRS_POWER6 #define MMU_FTRS_CELL MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ MMU_FTR_CI_LARGE_PAGE #define MMU_FTRS_PA6T MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ MMU_FTR_CI_LARGE_PAGE | MMU_FTR_NO_SLBIE_B #ifndef __ASSEMBLY__ #include <linux/bug.h> #include <asm/cputable.h> #include <asm/page.h> typedef pte_t *pgtable_t; #ifdef CONFIG_PPC_FSL_BOOK3E #include <asm/percpu.h> DECLARE_PER_CPU(int, next_tlbcam_idx); #endif enum { MMU_FTRS_POSSIBLE = #if defined(CONFIG_PPC_BOOK3S_64) || defined(CONFIG_PPC_BOOK3S_604) MMU_FTR_HPTE_TABLE | #endif #ifdef CONFIG_PPC_8xx MMU_FTR_TYPE_8xx | #endif #ifdef CONFIG_40x MMU_FTR_TYPE_40x | #endif #ifdef CONFIG_PPC_47x MMU_FTR_TYPE_47x | MMU_FTR_USE_TLBIVAX_BCAST | MMU_FTR_LOCK_BCAST_INVAL | #elif defined(CONFIG_44x) MMU_FTR_TYPE_44x | #endif #ifdef CONFIG_E500 MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS | MMU_FTR_USE_TLBILX | #endif #ifdef CONFIG_PPC_BOOK3S_32 MMU_FTR_USE_HIGH_BATS | #endif #ifdef CONFIG_PPC_83xx MMU_FTR_NEED_DTLB_SW_LRU | #endif #ifdef CONFIG_PPC_BOOK3E_64 MMU_FTR_USE_TLBRSRV | MMU_FTR_USE_PAIRED_MAS | #endif #ifdef CONFIG_PPC_BOOK3S_64 MMU_FTR_NO_SLBIE_B | MMU_FTR_16M_PAGE | MMU_FTR_TLBIEL | MMU_FTR_LOCKLESS_TLBIE | MMU_FTR_CI_LARGE_PAGE | MMU_FTR_1T_SEGMENT | MMU_FTR_TLBIE_CROP_VA | MMU_FTR_KERNEL_RO | MMU_FTR_68_BIT_VA | #endif #ifdef CONFIG_PPC_RADIX_MMU MMU_FTR_TYPE_RADIX | MMU_FTR_GTSE | #endif /* CONFIG_PPC_RADIX_MMU */ #ifdef CONFIG_PPC_KUAP MMU_FTR_BOOK3S_KUAP | #endif /* CONFIG_PPC_KUAP */ #ifdef CONFIG_PPC_MEM_KEYS MMU_FTR_PKEY | #endif #ifdef CONFIG_PPC_KUEP MMU_FTR_BOOK3S_KUEP | #endif /* CONFIG_PPC_KUAP */ 0, }; #if defined(CONFIG_PPC_BOOK3S_604) && !defined(CONFIG_PPC_BOOK3S_603) #define MMU_FTRS_ALWAYS MMU_FTR_HPTE_TABLE #endif #ifdef CONFIG_PPC_8xx #define MMU_FTRS_ALWAYS MMU_FTR_TYPE_8xx #endif #ifdef CONFIG_40x #define MMU_FTRS_ALWAYS MMU_FTR_TYPE_40x #endif #ifdef CONFIG_PPC_47x #define MMU_FTRS_ALWAYS MMU_FTR_TYPE_47x #elif defined(CONFIG_44x) #define MMU_FTRS_ALWAYS MMU_FTR_TYPE_44x #endif #ifdef CONFIG_E500 #define MMU_FTRS_ALWAYS MMU_FTR_TYPE_FSL_E #endif #ifndef MMU_FTRS_ALWAYS #define MMU_FTRS_ALWAYS 0 #endif static __always_inline bool early_mmu_has_feature(unsigned long feature) { if (MMU_FTRS_ALWAYS & feature) return true; return !!(MMU_FTRS_POSSIBLE & cur_cpu_spec->mmu_features & feature); } #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECKS #include <linux/jump_label.h> #define NUM_MMU_FTR_KEYS 32 extern struct static_key_true mmu_feature_keys[NUM_MMU_FTR_KEYS]; extern void mmu_feature_keys_init(void); static __always_inline bool mmu_has_feature(unsigned long feature) { int i; #ifndef __clang__ /* clang can't cope with this */ BUILD_BUG_ON(!__builtin_constant_p(feature)); #endif #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG if (!static_key_initialized) { printk("Warning! mmu_has_feature() used prior to jump label init!\n"); dump_stack(); return early_mmu_has_feature(feature); } #endif if (MMU_FTRS_ALWAYS & feature) return true; if (!(MMU_FTRS_POSSIBLE & feature)) return false; i = __builtin_ctzl(feature); return static_branch_likely(&mmu_feature_keys[i]); } static inline void mmu_clear_feature(unsigned long feature) { int i; i = __builtin_ctzl(feature); cur_cpu_spec->mmu_features &= ~feature; static_branch_disable(&mmu_feature_keys[i]); } #else static inline void mmu_feature_keys_init(void) { } static __always_inline bool mmu_has_feature(unsigned long feature) { return early_mmu_has_feature(feature); } static inline void mmu_clear_feature(unsigned long feature) { cur_cpu_spec->mmu_features &= ~feature; } #endif /* CONFIG_JUMP_LABEL */ extern unsigned int __start___mmu_ftr_fixup, __stop___mmu_ftr_fixup; #ifdef CONFIG_PPC64 /* This is our real memory area size on ppc64 server, on embedded, we * make it match the size our of bolted TLB area */ extern u64 ppc64_rma_size; /* Cleanup function used by kexec */ extern void mmu_cleanup_all(void); extern void radix__mmu_cleanup_all(void); /* Functions for creating and updating partition table on POWER9 */ extern void mmu_partition_table_init(void); extern void mmu_partition_table_set_entry(unsigned int lpid, unsigned long dw0, unsigned long dw1, bool flush); #endif /* CONFIG_PPC64 */ struct mm_struct; #ifdef CONFIG_DEBUG_VM extern void assert_pte_locked(struct mm_struct *mm, unsigned long addr); #else /* CONFIG_DEBUG_VM */ static inline void assert_pte_locked(struct mm_struct *mm, unsigned long addr) { } #endif /* !CONFIG_DEBUG_VM */ static __always_inline bool radix_enabled(void) { return mmu_has_feature(MMU_FTR_TYPE_RADIX); } static inline bool early_radix_enabled(void) { return early_mmu_has_feature(MMU_FTR_TYPE_RADIX); } #ifdef CONFIG_STRICT_KERNEL_RWX static inline bool strict_kernel_rwx_enabled(void) { return rodata_enabled; } #else static inline bool strict_kernel_rwx_enabled(void) { return false; } #endif static inline bool strict_module_rwx_enabled(void) { return IS_ENABLED(CONFIG_STRICT_MODULE_RWX) && strict_kernel_rwx_enabled(); } #endif /* !__ASSEMBLY__ */ /* The kernel use the constants below to index in the page sizes array. * The use of fixed constants for this purpose is better for performances * of the low level hash refill handlers. * * A non supported page size has a "shift" field set to 0 * * Any new page size being implemented can get a new entry in here. Whether * the kernel will use it or not is a different matter though. The actual page * size used by hugetlbfs is not defined here and may be made variable * * Note: This array ended up being a false good idea as it's growing to the * point where I wonder if we should replace it with something different, * to think about, feedback welcome. --BenH. */ /* These are #defines as they have to be used in assembly */ #define MMU_PAGE_4K 0 #define MMU_PAGE_16K 1 #define MMU_PAGE_64K 2 #define MMU_PAGE_64K_AP 3 /* "Admixed pages" (hash64 only) */ #define MMU_PAGE_256K 4 #define MMU_PAGE_512K 5 #define MMU_PAGE_1M 6 #define MMU_PAGE_2M 7 #define MMU_PAGE_4M 8 #define MMU_PAGE_8M 9 #define MMU_PAGE_16M 10 #define MMU_PAGE_64M 11 #define MMU_PAGE_256M 12 #define MMU_PAGE_1G 13 #define MMU_PAGE_16G 14 #define MMU_PAGE_64G 15 /* * N.B. we need to change the type of hpte_page_sizes if this gets to be > 16 * Also we need to change he type of mm_context.low/high_slices_psize. */ #define MMU_PAGE_COUNT 16 #ifdef CONFIG_PPC_BOOK3S_64 #include <asm/book3s/64/mmu.h> #else /* CONFIG_PPC_BOOK3S_64 */ #ifndef __ASSEMBLY__ /* MMU initialization */ extern void early_init_mmu(void); extern void early_init_mmu_secondary(void); extern void setup_initial_memory_limit(phys_addr_t first_memblock_base, phys_addr_t first_memblock_size); static inline void mmu_early_init_devtree(void) { } static inline void pkey_early_init_devtree(void) {} extern void *abatron_pteptrs[2]; #endif /* __ASSEMBLY__ */ #endif #if defined(CONFIG_PPC_BOOK3S_32) /* 32-bit classic hash table MMU */ #include <asm/book3s/32/mmu-hash.h> #elif defined(CONFIG_PPC_MMU_NOHASH) #include <asm/nohash/mmu.h> #endif #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_MMU_H_ */
26.437055
94
0.787242
8abf24adfbc8e6d01b448b389c756e0c8c8b7d7d
10,522
c
C
toggle.c
srrobicheaux/RaspberryPi-GPIO-OPCUA
e65bceb6a1a6c545e6ced24d1102ee0fd37eeeb2
[ "MIT" ]
1
2022-03-27T18:19:51.000Z
2022-03-27T18:19:51.000Z
toggle.c
srrobicheaux/RaspberryPi-GPIO-OPCUA
e65bceb6a1a6c545e6ced24d1102ee0fd37eeeb2
[ "MIT" ]
6
2020-06-22T02:29:43.000Z
2020-06-28T13:14:26.000Z
toggle.c
srrobicheaux/RaspberryPi-GPIO-OPCUA
e65bceb6a1a6c545e6ced24d1102ee0fd37eeeb2
[ "MIT" ]
null
null
null
/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ #include <open62541/client_config_default.h> #include <open62541/client_highlevel.h> #include <open62541/client_subscriptions.h> #include <open62541/plugin/log_stdout.h> #include "../common.h" static void usage(void) { printf("Usage: client [-username name] [-password password] "); #ifdef UA_ENABLE_ENCRYPTION printf("[-cert certfile.der] [-key keyfile.der] " "[-securityMode <0-3>] [-securityPolicy policyUri] "); #endif printf("opc.tcp://<host>:<port> -node_str # [-value #####]\n"); } int HandleArguments( int argc, char *argv[], char **serverurl, char **username, char **password, char **certfile, char **keyfile, char **securityPolicy, char **node_str, char **namespace, char **value, bool *IsBrowse) { /* At least one argument is required for the server uri */ if(argc <= 1) { usage(); return EXIT_FAILURE; } /* Parse the arguments */ for(int argpos = 1; argpos < argc; argpos++) { if(strcmp(argv[argpos], "--help") == 0 || strcmp(argv[argpos], "-h") == 0) { usage(); return EXIT_FAILURE; } if(argpos + 1 == argc) { *serverurl = argv[argpos]; continue; } if(strcmp(argv[argpos], "-node") == 0) { argpos++; *node_str = argv[argpos]; continue; } if(strcmp(argv[argpos], "-namespace") == 0) { argpos++; *namespace = argv[argpos]; continue; } if(strcmp(argv[argpos], "-value") == 0) { argpos++; *value = argv[argpos]; continue; } if(strcmp(argv[argpos], "-browse") == 0) { *IsBrowse = true; continue; } if(strcmp(argv[argpos], "-username") == 0) { argpos++; *username = argv[argpos]; continue; } if(strcmp(argv[argpos], "-password") == 0) { argpos++; *password = argv[argpos]; continue; } #ifdef UA_ENABLE_ENCRYPTION if(strcmp(argv[argpos], "-cert") == 0) { argpos++; *certfile = argv[argpos]; continue; } if(strcmp(argv[argpos], "-key") == 0) { argpos++; *keyfile = argv[argpos]; continue; } if(strcmp(argv[argpos], "-securityMode") == 0) { argpos++; if(sscanf(argv[argpos], "%i", (int*)&securityMode) != 1) { usage(); return EXIT_FAILURE; } continue; } if(strcmp(argv[argpos], "-securityPolicy") == 0) { argpos++; *securityPolicyUri = UA_String_fromChars(argv[argpos]); continue; } #endif usage(); return EXIT_FAILURE; } return EXIT_SUCCESS; } UA_StatusCode ConnectClient(char *serverurl, char *username, char *password, char *certfile, char *keyfile, char *securityPolicy, UA_Client *client){ UA_String securityPolicyUri = UA_STRING_NULL; //we need to map the char to the var UA_MessageSecurityMode securityMode = UA_MESSAGESECURITYMODE_INVALID; /* allow everything */ /* Create the server and set its config */ UA_ClientConfig *cc = UA_Client_getConfig(client); #ifdef UA_ENABLE_ENCRYPTION if(certfile) { UA_ByteString certificate = loadFile(certfile); UA_ByteString privateKey = loadFile(keyfile); UA_ClientConfig_setDefaultEncryption(cc, certificate, privateKey, NULL, 0, NULL, 0); UA_ByteString_clear(&certificate); UA_ByteString_clear(&privateKey); } else { UA_ClientConfig_setDefault(cc); } #else UA_ClientConfig_setDefault(cc); #endif cc->securityMode = securityMode; cc->securityPolicyUri = securityPolicyUri; /* Connect to the server */ UA_StatusCode retval = UA_STATUSCODE_GOOD; if(username) retval = UA_Client_connectUsername(client, serverurl, username, password); else retval = UA_Client_connect(client, serverurl); if(retval != UA_STATUSCODE_GOOD) UA_Client_delete(client); else UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, "Connected!"); return retval; } UA_NodeId *FindNode(char *namespace, char *Node_Str){ UA_NodeId *Node = UA_NodeId_new(); if (atoi(Node_Str) == 0 ) *Node = UA_NODEID_STRING_ALLOC(atoi(namespace), Node_Str); else *Node = UA_NODEID_NUMERIC(atoi(namespace), atoi(Node_Str)); return Node; }; static UA_StatusCode nodeIter(UA_NodeId childId, UA_Boolean isInverse, UA_NodeId referenceTypeId, void *handle) { if(isInverse || (referenceTypeId.identifier.numeric == 40)) return UA_STATUSCODE_GOOD; UA_NodeId *parent = (UA_NodeId *)handle; printf("UA_NODEID{\"Id\":%d,\"NameSpace\":%i,\"Type\":%d,\"Parent\":%d,\"Parent_NameSpace\":%i}UA_NODEID\n", childId.identifier.numeric, childId.namespaceIndex, referenceTypeId.identifier.numeric, parent->namespaceIndex, parent->identifier.numeric); return UA_STATUSCODE_GOOD; }; UA_StatusCode Handle_Values(UA_Client *client, UA_NodeId *Node, char *value) { UA_LocalizedText *display = UA_LocalizedText_new(); UA_QualifiedName *qualified= UA_QualifiedName_new(); UA_NodeClass *class = UA_NodeClass_new(); UA_StatusCode retval; UA_Variant val; UA_Variant_init(&val); char Response[1000]; retval = UA_Client_readDisplayNameAttribute(client, *Node, display); if(retval == UA_STATUSCODE_GOOD){ sprintf(Response,"%s\"DisplayName\":\"%s\",", Response,display->text.data); retval = UA_Client_readDescriptionAttribute(client, *Node, display); sprintf(Response,"%s\"Description\":\"%s\",", Response,display->text.data); retval = UA_Client_readBrowseNameAttribute(client, *Node, qualified); sprintf(Response,"%s\"BrowseName\":\"%s\",",Response,qualified->name.data); retval = UA_Client_readNodeClassAttribute(client, *Node, class); sprintf(Response,"%s\"NodeClass\":\"%s\"",Response,display->text.data); retval = UA_Client_readValueAttribute(client, *Node, &val); if(retval == UA_STATUSCODE_GOOD && UA_Variant_isScalar(&val)) { switch(val.type->typeIndex) { case UA_TYPES_BOOLEAN: if (value != NULL) { sprintf(Response,"%s,\"Initial\":%s",Response, *(UA_Boolean*)val.data ? "true" : "false"); UA_Boolean BValue = (strcmp(value,"true") == 0); sprintf(Response,"%s,\"Desired\":%s",Response, ( BValue ? "true" : "false")); UA_Variant_setScalarCopy(&val, &BValue, &UA_TYPES[UA_TYPES_BOOLEAN]); retval = UA_Client_writeValueAttribute(client, *Node, &val); UA_StatusCode retval = UA_Client_readValueAttribute(client, *Node, &val); }; sprintf(Response,"%s,\"Current\":%s",Response, (*(UA_Boolean*)val.data) ? "true" : "false"); break; /* optional */ case UA_TYPES_DOUBLE: if (value != NULL) { char *ptr; UA_Double DValue = strtod(value, &ptr); sprintf(Response,"%s\"Initial\":%f,",Response, *(UA_Double*)val.data); sprintf(Response,"%s\"Desired\":%f,",Response, DValue); UA_Variant_setScalar(&val, &DValue, &UA_TYPES[UA_TYPES_DOUBLE]); retval = UA_Client_writeValueAttribute(client, *Node, &val); UA_StatusCode retval = UA_Client_readValueAttribute(client, *Node, &val); }; sprintf(Response,"%s\"Current\":%f", Response, *(UA_Double*)val.data); break; /* optional */ /* you can have any number of case statements */ default : /* Optional */ sprintf(Response,"%s\"Error No Result}", Response); }; if (value != NULL){ retval = UA_Client_writeValueAttribute(client, *Node, &val); if(retval == UA_STATUSCODE_GOOD) { printf("Successfully written.\n"); } else { printf("Error: writing value!\n"); } } } else { printf("Unknown NodeId!\n\n\n"); }; }; UA_Variant_clear(&val); printf("UA_Response{%s}UA_Response",Response); return retval; }; int main(int argc, char *argv[]) { UA_Client *client = UA_Client_new(); UA_NodeId *Node = UA_NodeId_new(); char *serverurl = NULL; char *username = NULL; char *password = NULL; char *node_str = NULL; char *namespace = NULL; char *value = NULL; bool IsBrowse = false; char *certfile = NULL; char *keyfile = NULL; char *securityPolicy = NULL; if( HandleArguments(argc, argv, &serverurl, &username, &password, &certfile, &keyfile, &securityPolicy, &node_str, &namespace, &value, &IsBrowse) != EXIT_SUCCESS) return EXIT_FAILURE; if (ConnectClient(serverurl, username, password, certfile, keyfile, securityPolicy, client) != UA_STATUSCODE_GOOD) return EXIT_FAILURE; Node = FindNode(namespace, node_str); if (UA_NodeId_equal(Node, &UA_NODEID_NULL)) return EXIT_FAILURE; if (IsBrowse){ UA_Client_forEachChildNodeCall(client, *Node, nodeIter, (void *) Node); } else if (Handle_Values(client, Node, value) != UA_STATUSCODE_GOOD) return EXIT_FAILURE; UA_NodeId_clear(Node); UA_Client_disconnect(client); UA_Client_delete(client); return EXIT_SUCCESS; } // htpasswd -c /var/opt/apache/passwd/passwords shawn // //vcgencmd measure_clock /* arm: frequency(45)=700000000 core: frequency(1)=250000000 h264: frequency(28)=0 isp: frequency(42)=250000000 v3d: frequency(43)=250000000 uart: frequency(22)=3000000 pwm: frequency(25)=0 emmc: frequency(47)=100000000 pixel: frequency(29)=154000000 vec: frequency(10)=0 hdmi: frequency(9)=163682000 dpi: frequency(4)=0 */
35.190635
114
0.587151
8ac0ada25f05276b84b0dae0c1d36a8b0d927d88
825
h
C
src/debug/CameraDebugDrawer.h
slopee/Solaris
3822e76d7d22b0a64543d93c9a6f0ec989b8690a
[ "MIT" ]
null
null
null
src/debug/CameraDebugDrawer.h
slopee/Solaris
3822e76d7d22b0a64543d93c9a6f0ec989b8690a
[ "MIT" ]
null
null
null
src/debug/CameraDebugDrawer.h
slopee/Solaris
3822e76d7d22b0a64543d93c9a6f0ec989b8690a
[ "MIT" ]
null
null
null
#pragma once #include <glm/mat4x3.hpp> #include <glm/gtc/quaternion.hpp> #include <GL/glew.h> #include "graphic/ShaderProgram.h" #include <vector> #include "graphic/Camera.h" class Transform; class CameraDebugDrawer { public: CameraDebugDrawer( const Camera::LookAtVectors& cameraLookAtVector, float fov, float nearDist, float farDist, float ratio); void Update( const Camera::LookAtVectors& cameraLookAtVector, float fov, float nearDist, float farDist, float ratio); void Draw(float time, const glm::mat4& projection, const glm::mat4& view); private: std::vector<glm::vec3> CalculateVerticesPositions( const Camera::LookAtVectors& cameraLookAtVector, float fov, float nearDist, float farDist, float ratio); private: GLuint m_Vao; GLuint m_Vbo; ShaderProgram m_ShaderProgram; };
18.75
75
0.746667
8ac3932e88e5e01ae47886372337183f3a87db0c
5,525
c
C
src/gen8_encoder_vp8.c
me176c-dev/android_hardware_intel-vaapi-driver
0f2dca8d604220405e4678c0b6c4faa578d994ec
[ "MIT" ]
192
2018-01-26T11:51:55.000Z
2022-03-25T20:04:19.000Z
src/gen8_encoder_vp8.c
me176c-dev/android_hardware_intel-vaapi-driver
0f2dca8d604220405e4678c0b6c4faa578d994ec
[ "MIT" ]
256
2017-01-23T02:10:27.000Z
2018-01-23T10:00:05.000Z
src/gen8_encoder_vp8.c
me176c-dev/android_hardware_intel-vaapi-driver
0f2dca8d604220405e4678c0b6c4faa578d994ec
[ "MIT" ]
64
2018-01-30T19:51:53.000Z
2021-11-24T01:26:14.000Z
/* * Copyright © 2017 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. * * Authors: * Xiang, Haihao <haihao.xiang@intel.com> * */ #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include <math.h> #include <assert.h> #include "intel_batchbuffer.h" #include "intel_driver.h" #include "i965_defines.h" #include "i965_drv_video.h" #include "i965_encoder.h" #include "i965_encoder_vp8.h" extern struct i965_kernel vp8_kernels_brc_init_reset[NUM_VP8_BRC_RESET]; extern struct i965_kernel vp8_kernels_scaling[NUM_VP8_SCALING]; extern struct i965_kernel vp8_kernels_me[NUM_VP8_ME]; extern struct i965_kernel vp8_kernels_mbenc[NUM_VP8_MBENC]; extern struct i965_kernel vp8_kernels_mpu[NUM_VP8_MPU]; extern struct i965_kernel vp8_kernels_tpu[NUM_VP8_TPU]; extern struct i965_kernel vp8_kernels_brc_update[NUM_VP8_BRC_UPDATE]; static const uint32_t gen8_brc_init_bin_vp8[][4] = { #include "shaders/brc/bsw/vp8_brc_init_genx_0.g8b" }; static const uint32_t gen8_brc_reset_bin_vp8[][4] = { #include "shaders/brc/bsw/vp8_brc_reset_genx_0.g8b" }; static const uint32_t gen8_scaling_bin_vp8[][4] = { #include "shaders/brc/bsw/hme_downscale_genx_0.g8b" }; static const uint32_t gen8_me_bin_vp8[][4] = { #include "shaders/brc/bsw/hme_genx_0.g8b" }; static const uint32_t gen8_mbenc_i_frame_dist_bin_vp8[][4] = { #include "shaders/brc/bsw/vp8_intra_distortion_genx_0.g8b" }; static const uint32_t gen8_mbenc_i_frame_luma_bin_vp8[][4] = { #include "shaders/brc/bsw/vp8_enc_genx_0.g8b" }; static const uint32_t gen8_mbenc_i_frame_chroma_bin_vp8[][4] = { #include "shaders/brc/bsw/vp8_enc_genx_1.g8b" }; static const uint32_t gen8_mbenc_p_frame_bin_vp8[][4] = { #include "shaders/brc/bsw/vp8_enc_genx_2.g8b" }; static const uint32_t gen8_mpu_bin_vp8[][4] = { #include "shaders/brc/bsw/vp8_mpu_genx_0.g8b" }; static const uint32_t gen8_tpu_bin_vp8[][4] = { #include "shaders/brc/bsw/vp8_tpu_genx_0.g8b" }; static const uint32_t gen8_brc_update_bin_vp8[][4] = { #include "shaders/brc/bsw/vp8_brc_update_genx_0.g8b" }; Bool gen8_encoder_vp8_context_init(VADriverContextP ctx, struct intel_encoder_context *encoder_context, struct i965_encoder_vp8_context *vp8_context) { vp8_kernels_brc_init_reset[VP8_BRC_INIT].bin = gen8_brc_init_bin_vp8; vp8_kernels_brc_init_reset[VP8_BRC_INIT].size = sizeof(gen8_brc_init_bin_vp8); vp8_kernels_brc_init_reset[VP8_BRC_RESET].bin = gen8_brc_reset_bin_vp8; vp8_kernels_brc_init_reset[VP8_BRC_RESET].size = sizeof(gen8_brc_reset_bin_vp8); /* scaling 4x and 16x use the same kernel */ vp8_kernels_scaling[VP8_SCALING_4X].bin = gen8_scaling_bin_vp8; vp8_kernels_scaling[VP8_SCALING_4X].size = sizeof(gen8_scaling_bin_vp8); vp8_kernels_scaling[VP8_SCALING_16X].bin = gen8_scaling_bin_vp8; vp8_kernels_scaling[VP8_SCALING_16X].size = sizeof(gen8_scaling_bin_vp8); /* me 4x and 16x use the same kernel */ vp8_kernels_me[VP8_ME_4X].bin = gen8_me_bin_vp8; vp8_kernels_me[VP8_ME_4X].size = sizeof(gen8_me_bin_vp8); vp8_kernels_me[VP8_ME_16X].bin = gen8_me_bin_vp8; vp8_kernels_me[VP8_ME_16X].size = sizeof(gen8_me_bin_vp8); vp8_kernels_mbenc[VP8_MBENC_I_FRAME_DIST].bin = gen8_mbenc_i_frame_dist_bin_vp8; vp8_kernels_mbenc[VP8_MBENC_I_FRAME_DIST].size = sizeof(gen8_mbenc_i_frame_dist_bin_vp8); vp8_kernels_mbenc[VP8_MBENC_I_FRAME_LUMA].bin = gen8_mbenc_i_frame_luma_bin_vp8; vp8_kernels_mbenc[VP8_MBENC_I_FRAME_LUMA].size = sizeof(gen8_mbenc_i_frame_luma_bin_vp8); vp8_kernels_mbenc[VP8_MBENC_I_FRAME_CHROMA].bin = gen8_mbenc_i_frame_chroma_bin_vp8; vp8_kernels_mbenc[VP8_MBENC_I_FRAME_CHROMA].size = sizeof(gen8_mbenc_i_frame_chroma_bin_vp8); vp8_kernels_mbenc[VP8_MBENC_P_FRAME].bin = gen8_mbenc_p_frame_bin_vp8; vp8_kernels_mbenc[VP8_MBENC_P_FRAME].size = sizeof(gen8_mbenc_p_frame_bin_vp8); vp8_kernels_mpu[VP8_MPU].bin = gen8_mpu_bin_vp8; vp8_kernels_mpu[VP8_MPU].size = sizeof(gen8_mpu_bin_vp8); vp8_kernels_brc_update[VP8_BRC_UPDATE].bin = gen8_brc_update_bin_vp8; vp8_kernels_brc_update[VP8_BRC_UPDATE].size = sizeof(gen8_brc_update_bin_vp8); vp8_kernels_tpu[VP8_TPU].bin = gen8_tpu_bin_vp8; vp8_kernels_tpu[VP8_TPU].size = sizeof(gen8_tpu_bin_vp8); vp8_context->idrt_entry_size = ALIGN(sizeof(struct gen8_interface_descriptor_data), 64); vp8_context->mocs = 0; return True; }
39.184397
97
0.782081
8ac485ff237386570bc0294cf109f5c503cbd005
2,104
h
C
Engine/Logic/gkCursorNode.h
gamekit-developers/gamekit
74c896af5826ebe8fb72f2911015738f38ab7bb2
[ "Zlib", "MIT" ]
241
2015-01-04T00:36:58.000Z
2022-01-06T19:19:23.000Z
Engine/Logic/gkCursorNode.h
slagusev/gamekit
a6e97fcf2a9c3b9b9799bc12c3643818503ffc7d
[ "MIT" ]
10
2015-07-10T18:27:17.000Z
2019-06-26T20:59:59.000Z
Engine/Logic/gkCursorNode.h
slagusev/gamekit
a6e97fcf2a9c3b9b9799bc12c3643818503ffc7d
[ "MIT" ]
82
2015-01-25T18:02:35.000Z
2022-03-05T12:28:17.000Z
/* ------------------------------------------------------------------------------- This file is part of OgreKit. http://gamekit.googlecode.com/ Copyright (c) 2006-2013 Nestor Silveira. Contributor(s): none yet. ------------------------------------------------------------------------------- This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. ------------------------------------------------------------------------------- */ #ifndef _gkCursorNode_h_ #define _gkCursorNode_h_ #include "gkLogicNode.h" #include "OgreOverlay.h" #include "OgreOverlayContainer.h" #include "OgreOverlayElement.h" class gkCursorNode : public gkLogicNode { public: enum { ENABLE, UPDATE, MATERIAL_NAME, X, Y, WIDTH, HEIGHT }; DECLARE_SOCKET_TYPE(ENABLE, bool); DECLARE_SOCKET_TYPE(UPDATE, bool); DECLARE_SOCKET_TYPE(MATERIAL_NAME, gkString); DECLARE_SOCKET_TYPE(X, gkScalar); DECLARE_SOCKET_TYPE(Y, gkScalar); DECLARE_SOCKET_TYPE(WIDTH, gkScalar); DECLARE_SOCKET_TYPE(HEIGHT, gkScalar); gkCursorNode(gkLogicTree* parent, size_t id); ~gkCursorNode(); void initialize(); void update(Ogre::Real tick); bool evaluate(Ogre::Real tick); private: Ogre::Overlay* m_overlay; Ogre::OverlayContainer* m_panelContainer; Ogre::OverlayElement* m_panelElement; }; #endif//_gkCursorNode_h_
28.053333
79
0.671103
8ac5d013b2c17b972e35d06cb8d827af6159a6d8
5,972
h
C
cpp/cndpnetworkdatamessage.h
norlab-ulaval/navtechradar
4d3ccd2558e79142d656a6c12cd826d9397b0f2d
[ "MIT" ]
2
2020-11-18T17:48:40.000Z
2021-01-12T14:15:17.000Z
cpp/cndpnetworkdatamessage.h
norlab-ulaval/navtechradar
4d3ccd2558e79142d656a6c12cd826d9397b0f2d
[ "MIT" ]
null
null
null
cpp/cndpnetworkdatamessage.h
norlab-ulaval/navtechradar
4d3ccd2558e79142d656a6c12cd826d9397b0f2d
[ "MIT" ]
1
2022-03-22T16:09:51.000Z
2022-03-22T16:09:51.000Z
/* Copyright 2016 Navtech Radar Limited This file is part of iasdk which is released under The MIT License (MIT). See file LICENSE.txt in project root or go to https://opensource.org/licenses/MIT for full license details. */ #pragma once #include "common.h" #include <cstring> #include <cstdint> #include <vector> #include <memory> #ifdef __BSDSOCKETS__ #include <netinet/in.h> #elif _WIN32 #include <winsock2.h> #endif namespace Navtech { const uint8_t NDMSYNC_HEADER_LENGTH = 16; const uint8_t NDMSIGNATURELENGTH = NDMSYNC_HEADER_LENGTH * sizeof(uint8_t); namespace { const uint32_t MAXPAYLOADSIZE = 1048576; const uint8_t NDMSIGNATUREOFFSET = 0; const uint8_t NDMVERSIONOFFSET = NDMSIGNATUREOFFSET + NDMSIGNATURELENGTH; const uint8_t NDMVERSIONLENGTH = sizeof(uint8_t); const uint8_t NDMMESSAGEIDOFFSET = NDMVERSIONOFFSET + NDMVERSIONLENGTH; const uint8_t NDMMESSAGEIDLENGTH = sizeof(uint8_t); const uint8_t NDMPAYLOADSIZEOFFSET = NDMMESSAGEIDOFFSET + NDMMESSAGEIDLENGTH; const uint8_t NDMPAYLOADSIZELENGTH = sizeof(uint32_t); const uint8_t NDMHEADERLENGTH = NDMSIGNATURELENGTH + NDMVERSIONLENGTH + NDMMESSAGEIDLENGTH + NDMPAYLOADSIZELENGTH; const uint8_t NDMPROTOCOLMINVERSION = 1; const uint8_t NDMPROTOCOLVERSION = 1; } const uint8_t NDMSIGNATUREBYTES[NDMSIGNATURELENGTH] = { 0x00, 0x01, 0x03, 0x03, 0x07, 0x07, 0x0f, 0x0f, 0x1f, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f, 0xfe, 0xfe }; enum class CNDPNetworkDataMessageType : uint8_t { Invalid = 0, KeepAlive = 1, Configuration = 10, ConfigurationRequest = 20, StartFFTData = 21, StopFFTData = 22, StartHealthMsgs = 23, StopHealthMsgs = 24, ReCalibrateRfHealth = 25, StartTracks = 26, StopTracks = 27, TransmitOn = 28, TransmitOff = 29, FFTData = 30, HighPrecisionFFTData = 31, Health = 40, ContourUpdate = 50, TrackUpdate = 60, TrackerConfiguration = 70, TrackerPlaybackCommand = 71, TrackerSaveClutterMap = 72, TrackerLegacyHealthUnits = 73, TrackerDataSourceUpdate = 74, TrackerDistributionUpdate = 75, SystemRestart = 76, LoggingLevels = 90, LoggingLevelsRequest = 100, SetAutoTune = 110, StartNavData = 120, StopNavData = 121, SetNavThreshold = 122, NavigationData = 123, SetNavRangeOffsetAndGain = 124, CalibrateAccelerometer = 125, StartAccelerometer = 126, StopAccelerometer = 127, AccelerometerData = 128, StartNonContourFFTData = 140, SetNavBufferModeAndLength = 141, SetNavBinOperation = 142, NavigationAlarmData = 143, SetNavAreaRules = 144, NavRadarReset = 145, NavRadarHalt = 146, KeyExchange = 200, ContentEncryptionKey = 201, EncryptedData = 202 }; #pragma pack(push) #pragma pack(1) struct NetworkDataHeader { uint8_t signature[NDMSYNC_HEADER_LENGTH]; uint8_t version; uint8_t messageid; uint32_t payloadsize; void Init() { std::memcpy(&signature, &NDMSIGNATUREBYTES, sizeof(signature)); version = NDMPROTOCOLVERSION; messageid = static_cast<uint8_t>(CNDPNetworkDataMessageType::Invalid); payloadsize = 0; } void SetMessageId(CNDPNetworkDataMessageType messageType) { messageid = static_cast<uint8_t>(messageType); } void SetPayloadLength(uint32_t length) { payloadsize = htonl(length); } const uint32_t PayloadLength() const { return ntohl(payloadsize); } const uint32_t HeaderLength() const { return NDMHEADERLENGTH; } const bool HeaderIsValid() const { auto result = true; // Ensure signature is valid for (auto i = 0u; i < NDMSIGNATURELENGTH; i++) { result &= NDMSIGNATUREBYTES[i] == signature[i]; } // Ensure version number is in valid range result &= (version >= NDMPROTOCOLMINVERSION && version <= NDMPROTOCOLVERSION); // Ensure Payload Length is not too large result &= (PayloadLength() <= MAXPAYLOADSIZE); return result; } const std::vector<uint8_t> ToData() const { std::vector<uint8_t> headerData(NDMHEADERLENGTH); std::memcpy(&headerData[0], &signature, sizeof(signature)); std::memcpy(&headerData[NDMVERSIONOFFSET], &version, sizeof(version)); std::memcpy(&headerData[NDMMESSAGEIDOFFSET], &messageid, sizeof(messageid)); std::memcpy(&headerData[NDMPAYLOADSIZEOFFSET], &payloadsize, sizeof(payloadsize)); return headerData; } }; #pragma pack(pop) class NetworkDataMessage { public: explicit NetworkDataMessage(const NetworkDataHeader header) : NetworkDataMessage(header, std::vector<uint8_t>()) {} explicit NetworkDataMessage(const NetworkDataHeader header, const uint8_t* payload, const std::size_t size) : NetworkDataMessage(header, std::vector<uint8_t>(payload, payload + size)) {} explicit NetworkDataMessage(const NetworkDataHeader header, const std::vector<uint8_t>& data) : _header(header), _payload(data) {} ~NetworkDataMessage() { _payload.clear(); std::vector<uint8_t>(_payload).swap(_payload); } explicit NetworkDataMessage(const NetworkDataMessage&) = delete; NetworkDataMessage& operator= (const NetworkDataMessage&) = delete; const std::vector<uint8_t> Payload() const { return _payload; } const CNDPNetworkDataMessageType MessageId() const { return static_cast<CNDPNetworkDataMessageType>(_header.messageid); } const uint32_t PayloadSize() const { return _header.PayloadLength(); } const uint8_t Version() const { return _header.version; } const bool MessageValid() const { return _header.HeaderIsValid(); } std::vector<uint8_t> MessageData() { auto header = _header.ToData(); if (_payload.size() > 0) header.insert(header.end(), _payload.begin(), _payload.end()); return header; } protected: const NetworkDataHeader _header; std::vector<uint8_t> _payload; }; typedef std::shared_ptr<NetworkDataMessage> CNDPDataMessagePtr_t; #pragma pack(push) #pragma pack(1) typedef struct CNDPNetworkDataHeader : public NetworkDataHeader {} CNDPNetworkDataHeaderStruct; #pragma pack(pop) }
27.776744
154
0.732753
8ac6a795c3f49f8012228dfdce093fd21ded7c88
113
c
C
C/Hello World.c
vermayash7980/Hacktoberfest2021
66e190608c5e3f9ad983ba8f707e499ca5bc6da0
[ "MIT" ]
39
2021-10-03T05:40:26.000Z
2021-10-31T18:09:23.000Z
C/Hello World.c
vermayash7980/Hacktoberfest2021
66e190608c5e3f9ad983ba8f707e499ca5bc6da0
[ "MIT" ]
26
2021-10-03T04:50:47.000Z
2021-10-16T07:39:22.000Z
C/Hello World.c
vermayash7980/Hacktoberfest2021
66e190608c5e3f9ad983ba8f707e499ca5bc6da0
[ "MIT" ]
215
2021-10-03T04:35:47.000Z
2021-10-31T17:37:42.000Z
#include <stdio.h> int main() { char string[] = "Hello World"; printf("%s\n", string); return 0; }
9.416667
32
0.539823
8ac8b633a4caf89dcdd7a62b4ad67454b8556036
22,780
h
C
dlk/python/dlk/templates/include/de10_nano.h
serihiro/blueoil
e538a08cb149c6f630263905819cc8c53a0a6081
[ "Apache-2.0" ]
null
null
null
dlk/python/dlk/templates/include/de10_nano.h
serihiro/blueoil
e538a08cb149c6f630263905819cc8c53a0a6081
[ "Apache-2.0" ]
null
null
null
dlk/python/dlk/templates/include/de10_nano.h
serihiro/blueoil
e538a08cb149c6f630263905819cc8c53a0a6081
[ "Apache-2.0" ]
null
null
null
/* Copyright 2018 The Blueoil Authors. 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. ==============================================================================*/ #pragma once #include "global.h" #include "memdriver.h" #include "time_measurement.h" #include <cassert> namespace de10_nano { class QconvWithKn2row { public: QconvWithKn2row() : start(IP_CSR_ADDR + 0x08, 1, sizeof(T_UINT)), done(IP_CSR_ADDR + 0x18, 1, sizeof(T_UINT)), in_data_reg(IP_CSR_ADDR + 0x20, 1, sizeof(T_UINT)), out_data_reg(IP_CSR_ADDR + 0x28, 1, sizeof(T_UINT)), k_data_reg(IP_CSR_ADDR + 0x30, 1, sizeof(T_UINT)), out_data_partial_reg(IP_CSR_ADDR + 0x38, 1, sizeof(T_UINT)), in_w_reg(IP_CSR_ADDR + 0x40, 1, sizeof(T_UINT)), in_h_reg(IP_CSR_ADDR + 0x48, 1, sizeof(T_UINT)), in_c_reg(IP_CSR_ADDR + 0x50, 1, sizeof(T_UINT)), out_w_reg(IP_CSR_ADDR + 0x58, 1, sizeof(T_UINT)), out_h_reg(IP_CSR_ADDR + 0x60, 1, sizeof(T_UINT)), out_c_reg(IP_CSR_ADDR + 0x68, 1, sizeof(T_UINT)), k_w_reg(IP_CSR_ADDR + 0x70, 1, sizeof(T_UINT)), k_h_reg(IP_CSR_ADDR + 0x78, 1, sizeof(T_UINT)), pad_reg(IP_CSR_ADDR + 0x80, 1, sizeof(T_UINT)), th_start(TH_IP_CSR_ADDR + 0x08, 1, sizeof(T_UINT)), th_done(TH_IP_CSR_ADDR + 0x18, 1, sizeof(T_UINT)), th_in_data_reg(TH_IP_CSR_ADDR + 0x20, 1, sizeof(T_UINT)), th_out_data_reg(TH_IP_CSR_ADDR + 0x28, 1, sizeof(T_UINT)), th_data_reg(TH_IP_CSR_ADDR + 0x30, 1, sizeof(T_UINT)), th_out_w_reg(TH_IP_CSR_ADDR + 0x38, 1, sizeof(T_UINT)), th_out_h_reg(TH_IP_CSR_ADDR + 0x40, 1, sizeof(T_UINT)), th_out_c_reg(TH_IP_CSR_ADDR + 0x48, 1, sizeof(T_UINT)) {} void run_qconv_with_kn2row(unsigned long in_data_addr, unsigned long out_data_addr, unsigned long k_data_addr, unsigned in_w, unsigned in_h, unsigned in_c, unsigned out_w, unsigned out_h, unsigned out_c, unsigned k_w, unsigned k_h, unsigned pad) { in_data_reg.Write(in_data_addr); out_data_reg.Write(out_data_addr); k_data_reg.Write(k_data_addr); out_data_partial_reg.Write(out_data_addr); in_w_reg.Write(in_w); in_h_reg.Write(in_h); in_c_reg.Write(in_c); out_w_reg.Write(out_w); out_h_reg.Write(out_h); out_c_reg.Write(out_c); k_h_reg.Write(k_h); k_w_reg.Write(k_w); pad_reg.Write(pad); start.Write(0x1); volatile T_UINT done_flag = 0; while (!(done_flag & 0x2)) { done.Read(done_flag); } } void run_apply_thresholds(unsigned long in_data_addr, unsigned long out_data_addr, unsigned long th_data_addr, unsigned out_w, unsigned out_h, unsigned out_c) { th_in_data_reg.Write(in_data_addr); th_out_data_reg.Write(out_data_addr); th_data_reg.Write(th_data_addr); th_out_w_reg.Write(out_w); th_out_h_reg.Write(out_h); th_out_c_reg.Write(out_c); th_start.Write(0x1); volatile T_UINT done_flag = 0; while (!(done_flag & 0x2)) { th_done.Read(done_flag); } } private: MappedMem start; MappedMem done; MappedMem in_data_reg; MappedMem out_data_reg; MappedMem k_data_reg; MappedMem out_data_partial_reg; MappedMem in_w_reg; MappedMem in_h_reg; MappedMem in_c_reg; MappedMem out_w_reg; MappedMem out_h_reg; MappedMem out_c_reg; MappedMem k_w_reg; MappedMem k_h_reg; MappedMem pad_reg; MappedMem th_start; MappedMem th_done; MappedMem th_in_data_reg; MappedMem th_out_data_reg; MappedMem th_data_reg; MappedMem th_out_w_reg; MappedMem th_out_h_reg; MappedMem th_out_c_reg; }; void qconv_with_kn2row(unsigned long input_addr, unsigned long output_addr, const QUANTIZED_PACKED_KERNEL k_data_packed[], BIN_CONV_OUTPUT th_data[], unsigned in_w, unsigned in_h, unsigned in_c_by_word, unsigned nbits_in_data, unsigned out_w, unsigned out_h, unsigned out_c, unsigned k_w, unsigned k_h, unsigned pad, unsigned stride) { assert((k_h == 1 && k_w == 1) || (k_h == 3 && k_w == 3)); const unsigned k_size = k_h * k_w * in_c_by_word * out_c; static QconvWithKn2row qwq; MappedMem k_data_mem(KERNEL_ADDR, k_size, sizeof(T_UINT)); k_data_mem.Write(k_data_packed, k_size); if (th_data == nullptr) { qwq.run_qconv_with_kn2row(input_addr, output_addr, KERNEL_ADDR, in_w, in_h, in_c_by_word, out_w, out_h, out_c, k_w, k_h, pad); } else { // with threshold skipping const unsigned num_th = NUM_OF_A2W1_THRESHOLD; const unsigned th_size = out_c * num_th; MappedMem th_data_mem(THRESHOLD_ADDR, th_size, sizeof(BIN_CONV_OUTPUT)); th_data_mem.Write(th_data, th_size); qwq.run_qconv_with_kn2row(input_addr, OUTPUT1_ADDR, KERNEL_ADDR, in_w, in_h, in_c_by_word, out_w, out_h, out_c, k_w, k_h, pad); qwq.run_apply_thresholds(OUTPUT1_ADDR, output_addr, THRESHOLD_ADDR, out_w, out_h, out_c); } } class QconvKn2rowTiling { public: QconvKn2rowTiling() : start(IP_CSR_ADDR + 0x08, 1, sizeof(T_UINT)), done(IP_CSR_ADDR + 0x18, 1, sizeof(T_UINT)), in_data_reg(IP_CSR_ADDR + 0x20, 1, sizeof(T_UINT)), out_data_reg(IP_CSR_ADDR + 0x28, 1, sizeof(T_UINT)), k_data_reg(IP_CSR_ADDR + 0x30, 1, sizeof(T_UINT)), th_data_reg(IP_CSR_ADDR + 0x38, 1, sizeof(T_UINT)), in_w_reg(IP_CSR_ADDR + 0x40, 1, sizeof(T_UINT)), in_h_reg(IP_CSR_ADDR + 0x48, 1, sizeof(T_UINT)), in_c_reg(IP_CSR_ADDR + 0x50, 1, sizeof(T_UINT)), out_w_reg(IP_CSR_ADDR + 0x58, 1, sizeof(T_UINT)), out_h_reg(IP_CSR_ADDR + 0x60, 1, sizeof(T_UINT)), out_c_reg(IP_CSR_ADDR + 0x68, 1, sizeof(T_UINT)), k_w_reg(IP_CSR_ADDR + 0x70, 1, sizeof(T_UINT)), k_h_reg(IP_CSR_ADDR + 0x78, 1, sizeof(T_UINT)), pad_reg(IP_CSR_ADDR + 0x80, 1, sizeof(T_UINT)), use_threshold_reg(IP_CSR_ADDR + 0x88, 1, sizeof(T_UINT)) {} void run(unsigned long in_data_addr, unsigned long out_data_addr, unsigned long k_data_addr, unsigned long th_data_addr, unsigned in_w, unsigned in_h, unsigned in_c, unsigned out_w, unsigned out_h, unsigned out_c, unsigned k_w, unsigned k_h, unsigned pad, unsigned use_threshold) { in_data_reg.Write(in_data_addr); out_data_reg.Write(out_data_addr); k_data_reg.Write(k_data_addr); th_data_reg.Write(th_data_addr); in_w_reg.Write(in_w); in_h_reg.Write(in_h); in_c_reg.Write(in_c); out_w_reg.Write(out_w); out_h_reg.Write(out_h); out_c_reg.Write(out_c); k_h_reg.Write(k_h); k_w_reg.Write(k_w); pad_reg.Write(pad); use_threshold_reg.Write(use_threshold); start.Write(0x1); volatile T_UINT done_flag = 0; while (!(done_flag & 0x2)) { done.Read(done_flag); } } private: MappedMem start; MappedMem done; MappedMem in_data_reg; MappedMem out_data_reg; MappedMem k_data_reg; MappedMem th_data_reg; MappedMem in_w_reg; MappedMem in_h_reg; MappedMem in_c_reg; MappedMem out_w_reg; MappedMem out_h_reg; MappedMem out_c_reg; MappedMem k_w_reg; MappedMem k_h_reg; MappedMem pad_reg; MappedMem use_threshold_reg; }; void qconv_kn2row_tiling(unsigned long input_addr, unsigned long output_addr, const QUANTIZED_PACKED_KERNEL k_data_packed[], BIN_CONV_OUTPUT th_data[], unsigned in_w, unsigned in_h, unsigned in_c_by_word, unsigned nbits_in_data, unsigned out_w, unsigned out_h, unsigned out_c, unsigned k_w, unsigned k_h, unsigned pad, unsigned stride) { assert((k_h == 1 && k_w == 1) || (k_h == 3 && k_w == 3)); const unsigned in_size = in_h * in_w * in_c_by_word * nbits_in_data; const unsigned out_size = out_h * out_w * out_c; const unsigned k_size = k_h * k_w * in_c_by_word * out_c; static QconvKn2rowTiling qkt; MappedMem k_data_mem(KERNEL_ADDR, k_size, sizeof(QUANTIZED_PACKED_KERNEL)); k_data_mem.Write(k_data_packed, k_size); unsigned use_threshold = (th_data != NULL) ? 1 : 0; if (use_threshold == 1) { const unsigned th_size = out_c * NUM_OF_A2W1_THRESHOLD; MappedMem th_data_mem(THRESHOLD_ADDR, th_size, sizeof(BIN_CONV_OUTPUT)); th_data_mem.Write(th_data, th_size); qkt.run(input_addr, output_addr, KERNEL_ADDR, THRESHOLD_ADDR, in_w, in_h, in_c_by_word, out_w, out_h, out_c, k_w, k_h, pad, use_threshold); } else { qkt.run(input_addr, output_addr, KERNEL_ADDR, THRESHOLD_ADDR, in_w, in_h, in_c_by_word, out_w, out_h, out_c, k_w, k_h, pad, use_threshold); } } // // TCA // uint8_t* mapPhysicalMemory(size_t base, size_t size) { int fd = open("/dev/mem", O_RDWR | O_SYNC, 0); if (fd == -1) throw std::system_error(errno, std::generic_category()); int rw = PROT_READ | PROT_WRITE; auto* mapped_base = reinterpret_cast<uint8_t*>(mmap(nullptr, size, rw, MAP_SHARED, fd, base)); if (mapped_base == MAP_FAILED) throw std::system_error(errno, std::generic_category()); return mapped_base; } struct Csr { static constexpr uint32_t start = 0; static constexpr uint32_t admaInputAddress = 1; static constexpr uint32_t admaInputHCount = 2; static constexpr uint32_t admaInputWCount = 3; static constexpr uint32_t admaInputCCount = 4; static constexpr uint32_t admaTopTileH = 5; static constexpr uint32_t admaMiddleTileH = 6; static constexpr uint32_t admaBottomTileH = 7; static constexpr uint32_t admaLeftTileW = 8; static constexpr uint32_t admaMiddleTileW = 9; static constexpr uint32_t admaRightTileW = 10; static constexpr uint32_t admaLeftRowToRowDistance = 11; static constexpr uint32_t admaMiddleRowToRowDistance = 12; static constexpr uint32_t admaRightRowToRowDistance = 13; static constexpr uint32_t admaLeftStep = 14; static constexpr uint32_t admaMiddleStep = 15; static constexpr uint32_t admaTopRowDistance = 16; static constexpr uint32_t admaMidRowDistance = 17; static constexpr uint32_t admaInputSpace = 18; static constexpr uint32_t admaTopBottomLeftPad = 19; static constexpr uint32_t admaTopBottomMiddlePad = 20; static constexpr uint32_t admaTopBottomRightPad = 21; static constexpr uint32_t admaSidePad = 22; static constexpr uint32_t wdmaStartAddress = 23; static constexpr uint32_t wdmaOutputHCount = 24; static constexpr uint32_t wdmaOutputWCount = 25; static constexpr uint32_t wdmaKernelBlockCount = 26; static constexpr uint32_t fdmaOutputAddress = 27; static constexpr uint32_t fdmaOutputHCount = 28; static constexpr uint32_t fdmaOutputWCount = 29; static constexpr uint32_t fdmaOutputCCount = 30; static constexpr uint32_t fdmaRegularTileH = 31; static constexpr uint32_t fdmaLastTileH = 32; static constexpr uint32_t fdmaRegularTileW = 33; static constexpr uint32_t fdmaLastTileW = 34; static constexpr uint32_t fdmaRegularRowToRowDistance = 35; static constexpr uint32_t fdmaLastRowToRowDistance = 36; static constexpr uint32_t fdmaOutputSpace = 37; static constexpr uint32_t fdmaRowDistance = 38; static constexpr uint32_t a2fInputCCount = 39; static constexpr uint32_t a2fKernelVCount = 40; static constexpr uint32_t a2fKernelHCount = 41; static constexpr uint32_t a2fTileStep = 42; static constexpr uint32_t a2fTileGap = 43; static constexpr uint32_t a2fOutputHCount = 44; static constexpr uint32_t a2fOutputWCount = 45; static constexpr uint32_t a2fRegularTileH = 46; static constexpr uint32_t a2fLastTileH = 47; static constexpr uint32_t a2fRegularTileW = 48; static constexpr uint32_t a2fLastTileW = 49; static constexpr uint32_t qdmaStartAddress = 50; static constexpr uint32_t bnqEnable = 51; static constexpr uint32_t statusRegister = 52; }; struct Parameters { uint32_t admaInputAddress; uint32_t admaInputHCount; uint32_t admaInputWCount; uint32_t admaInputCCount; uint32_t admaTopTileH; uint32_t admaMiddleTileH; uint32_t admaBottomTileH; uint32_t admaLeftTileW; uint32_t admaMiddleTileW; uint32_t admaRightTileW; uint32_t admaLeftRowToRowDistance; uint32_t admaMiddleRowToRowDistance; uint32_t admaRightRowToRowDistance; uint32_t admaLeftStep; uint32_t admaMiddleStep; uint32_t admaTopRowDistance; uint32_t admaMidRowDistance; uint32_t admaInputSpace; uint32_t admaTopBottomLeftPad; uint32_t admaTopBottomMiddlePad; uint32_t admaTopBottomRightPad; uint32_t admaSidePad; uint32_t wdmaStartAddress; uint32_t wdmaOutputHCount; uint32_t wdmaOutputWCount; uint32_t wdmaKernelBlockCount; uint32_t fdmaOutputAddress; uint32_t fdmaOutputHCount; uint32_t fdmaOutputWCount; uint32_t fdmaOutputCCount; uint32_t fdmaRegularTileH; uint32_t fdmaLastTileH; uint32_t fdmaRegularTileW; uint32_t fdmaLastTileW; uint32_t fdmaRegularRowToRowDistance; uint32_t fdmaLastRowToRowDistance; uint32_t fdmaOutputSpace; uint32_t fdmaRowDistance; uint32_t a2fInputCCount; uint32_t a2fKernelVCount; uint32_t a2fKernelHCount; uint32_t a2fTileStep; uint32_t a2fTileGap; uint32_t a2fOutputHCount; uint32_t a2fOutputWCount; uint32_t a2fRegularTileH; uint32_t a2fLastTileH; uint32_t a2fRegularTileW; uint32_t a2fLastTileW; uint32_t qdmaStartAddress; uint32_t bnqEnable; }; Parameters calcParameters(uint32_t inputHeight, uint32_t inputWidth, uint32_t inputChannels, uint32_t inputTileWidth, uint32_t inputTileHeight, uint32_t outputChannels, uint32_t kernelHeight, uint32_t kernelWidth, uint32_t inputAddress, uint32_t kernelAddress, uint32_t thresholdAddress, uint32_t outputAddress, bool enable_bnq) { auto divRoundUp = [](uint32_t x, uint32_t y) { return (x + y - 1) / y; }; constexpr uint32_t maxBurst = 32; constexpr uint32_t b = 32; assert((kernelHeight == 3 && kernelWidth == 3) || (kernelHeight == 1 && kernelWidth == 1)); uint32_t pad = (kernelHeight == 1) ? 0 : 1; uint32_t dep = kernelHeight - 1; auto outputHeight = inputHeight + 2 * pad - dep; auto outputWidth = inputWidth + 2 * pad - dep; auto outputTileHeight = inputTileHeight - dep; auto outputTileWidth = inputTileWidth - dep; assert(inputTileHeight > dep && inputTileWidth > dep); auto hCount = divRoundUp(outputHeight, outputTileHeight); auto wCount = divRoundUp(outputWidth, outputTileWidth); // ADMA Parameters Parameters p; p.admaInputAddress = inputAddress; p.admaInputHCount = hCount; p.admaInputWCount = wCount; p.admaInputCCount = divRoundUp(inputChannels, b); p.admaTopTileH = (hCount == 1) ? inputHeight : (inputTileHeight - pad); p.admaMiddleTileH = inputTileHeight; p.admaBottomTileH = inputHeight + pad - (hCount - 1) * (inputTileHeight - dep); p.admaLeftTileW = (wCount == 1) ? inputWidth : (inputTileWidth - pad); p.admaMiddleTileW = inputTileWidth; p.admaRightTileW = (wCount == 1) ? inputWidth : inputWidth + pad - (wCount - 1) * (inputTileWidth - dep); p.admaLeftRowToRowDistance = inputWidth - p.admaLeftTileW + ((p.admaLeftTileW % maxBurst == 0) ? maxBurst : p.admaLeftTileW % maxBurst); p.admaMiddleRowToRowDistance = inputWidth - p.admaMiddleTileW + ((p.admaMiddleTileW % maxBurst == 0) ? maxBurst : p.admaMiddleTileW % maxBurst); p.admaRightRowToRowDistance = inputWidth - p.admaRightTileW + ((p.admaRightTileW % maxBurst == 0) ? maxBurst : p.admaRightTileW % maxBurst); p.admaLeftStep = p.admaLeftTileW - dep; p.admaMiddleStep = p.admaMiddleTileW - dep; p.admaTopRowDistance = inputWidth * (p.admaTopTileH - dep) - inputWidth + p.admaRightTileW; p.admaMidRowDistance = inputWidth * (p.admaMiddleTileH - dep) - inputWidth + p.admaRightTileW; p.admaInputSpace = inputHeight * inputWidth; p.admaTopBottomLeftPad = (p.admaLeftTileW + pad) * pad; p.admaTopBottomMiddlePad = p.admaMiddleTileW * pad; p.admaTopBottomRightPad = (p.admaRightTileW + pad) * pad; p.admaSidePad = (wCount == 1) ? (2 * pad) : pad; // WDMA Parameters p.wdmaStartAddress = kernelAddress; p.wdmaOutputHCount = hCount; p.wdmaOutputWCount = wCount; p.wdmaKernelBlockCount = divRoundUp(outputChannels, b) * divRoundUp(inputChannels, b) * kernelHeight * kernelWidth; // FDMA Parameters //bool enableBnq = true; const uint32_t dataWidth = (enable_bnq) ? b * 2 : b * 16; const uint32_t avalonDataWidth = (enable_bnq) ? b * 2 : 128; auto bytesPerElement = dataWidth / 8; auto wordsPerElement = dataWidth / avalonDataWidth; auto fdmaRowToRowDistance = [&](uint32_t outputWidth, uint32_t tileWidth) { return (outputWidth - tileWidth) * wordsPerElement + 1; }; p.fdmaOutputAddress = outputAddress; p.fdmaOutputHCount = hCount; p.fdmaOutputWCount = wCount; p.fdmaOutputCCount = divRoundUp(outputChannels, b); p.fdmaRegularTileH = outputTileHeight; p.fdmaLastTileH = outputHeight - (hCount - 1) * outputTileHeight; p.fdmaRegularTileW = outputTileWidth; p.fdmaLastTileW = outputWidth - (wCount - 1) * outputTileWidth; p.fdmaRegularRowToRowDistance = fdmaRowToRowDistance(outputWidth, p.fdmaRegularTileW); p.fdmaLastRowToRowDistance = fdmaRowToRowDistance(outputWidth, p.fdmaLastTileW); p.fdmaOutputSpace = outputHeight * outputWidth; p.fdmaRowDistance = outputWidth * p.fdmaRegularTileH - outputWidth + p.fdmaLastTileW; // A2F Parameters p.a2fInputCCount = p.admaInputCCount; p.a2fKernelVCount = kernelHeight; p.a2fKernelHCount = kernelWidth; if (kernelHeight == 1) { p.a2fTileStep = 1u; p.a2fTileGap = 1u; } else { // TODO: 3x3 stride one assumed here p.a2fTileStep = 1u; p.a2fTileGap = 3u; } p.a2fOutputHCount = hCount; p.a2fOutputWCount = wCount; p.a2fRegularTileH = outputTileHeight; p.a2fLastTileH = outputHeight - (hCount - 1) * p.a2fRegularTileH; p.a2fRegularTileW = outputTileWidth; p.a2fLastTileW = outputWidth - (wCount - 1) * p.a2fRegularTileW; p.qdmaStartAddress = thresholdAddress; p.bnqEnable = enable_bnq ? 1 : 0; return p; } void RunTCA(unsigned long input_addr, unsigned long output_addr, unsigned long kernel_addr, unsigned long thresholds_addr, unsigned in_w, unsigned in_h, unsigned in_c, unsigned nbits_in_data, unsigned out_w, unsigned out_h, unsigned out_c, unsigned k_w, unsigned k_h, unsigned pad, unsigned stride) { unsigned use_threshold = (thresholds_addr != 0) ? 1 : 0; static volatile uint32_t* csr = nullptr; if (csr == nullptr) { csr = reinterpret_cast<uint32_t*>(mapPhysicalMemory(HPS_TO_FPGA_LW_BASE, 0xFF)); } auto tileWidth = 32u; auto tileHeight = 32u; auto p = calcParameters(in_h, in_w, in_c, tileWidth, tileHeight, out_c, k_h, k_w, input_addr, kernel_addr, thresholds_addr, output_addr, use_threshold == 1); csr[Csr::admaInputAddress] = p.admaInputAddress; csr[Csr::admaInputHCount] = p.admaInputHCount; csr[Csr::admaInputWCount] = p.admaInputWCount; csr[Csr::admaInputCCount] = p.admaInputCCount; csr[Csr::admaTopTileH] = p.admaTopTileH; csr[Csr::admaMiddleTileH] = p.admaMiddleTileH; csr[Csr::admaBottomTileH] = p.admaBottomTileH; csr[Csr::admaLeftTileW] = p.admaLeftTileW; csr[Csr::admaMiddleTileW] = p.admaMiddleTileW; csr[Csr::admaRightTileW] = p.admaRightTileW; csr[Csr::admaLeftRowToRowDistance] = p.admaLeftRowToRowDistance; csr[Csr::admaMiddleRowToRowDistance] = p.admaMiddleRowToRowDistance; csr[Csr::admaRightRowToRowDistance] = p.admaRightRowToRowDistance; csr[Csr::admaLeftStep] = p.admaLeftStep; csr[Csr::admaMiddleStep] = p.admaMiddleStep; csr[Csr::admaTopRowDistance] = p.admaTopRowDistance; csr[Csr::admaMidRowDistance] = p.admaMidRowDistance; csr[Csr::admaInputSpace] = p.admaInputSpace; csr[Csr::admaTopBottomLeftPad] = p.admaTopBottomLeftPad; csr[Csr::admaTopBottomMiddlePad] = p.admaTopBottomMiddlePad; csr[Csr::admaTopBottomRightPad] = p.admaTopBottomRightPad; csr[Csr::admaSidePad] = p.admaSidePad; csr[Csr::wdmaStartAddress] = p.wdmaStartAddress; csr[Csr::wdmaOutputHCount] = p.wdmaOutputHCount; csr[Csr::wdmaOutputWCount] = p.wdmaOutputWCount; csr[Csr::wdmaKernelBlockCount] = p.wdmaKernelBlockCount; csr[Csr::fdmaOutputAddress] = p.fdmaOutputAddress; csr[Csr::fdmaOutputHCount] = p.fdmaOutputHCount; csr[Csr::fdmaOutputWCount] = p.fdmaOutputWCount; csr[Csr::fdmaOutputCCount] = p.fdmaOutputCCount; csr[Csr::fdmaRegularTileH] = p.fdmaRegularTileH; csr[Csr::fdmaLastTileH] = p.fdmaLastTileH; csr[Csr::fdmaRegularTileW] = p.fdmaRegularTileW; csr[Csr::fdmaLastTileW] = p.fdmaLastTileW; csr[Csr::fdmaRegularRowToRowDistance] = p.fdmaRegularRowToRowDistance; csr[Csr::fdmaLastRowToRowDistance] = p.fdmaLastRowToRowDistance; csr[Csr::fdmaOutputSpace] = p.fdmaOutputSpace; csr[Csr::fdmaRowDistance] = p.fdmaRowDistance; csr[Csr::a2fInputCCount] = p.a2fInputCCount; csr[Csr::a2fKernelVCount] = p.a2fKernelVCount; csr[Csr::a2fKernelHCount] = p.a2fKernelHCount; csr[Csr::a2fTileStep] = p.a2fTileStep; csr[Csr::a2fTileGap] = p.a2fTileGap; csr[Csr::a2fOutputHCount] = p.a2fOutputHCount; csr[Csr::a2fOutputWCount] = p.a2fOutputWCount; csr[Csr::a2fRegularTileH] = p.a2fRegularTileH; csr[Csr::a2fLastTileH] = p.a2fLastTileH; csr[Csr::a2fRegularTileW] = p.a2fRegularTileW; csr[Csr::a2fLastTileW] = p.a2fLastTileW; csr[Csr::qdmaStartAddress] = p.qdmaStartAddress; csr[Csr::bnqEnable] = p.bnqEnable; // std::cout << "Status " << csr[Csr::statusRegister] << std::endl; csr[Csr::start] = 1; // std::cout << "Status " << csr[Csr::statusRegister] << std::endl; while (csr[Csr::statusRegister] != 127) { // std::cout << "Status " << csr[Csr::statusRegister] << std::endl; continue; } } } // namespace de10_nano
39.006849
190
0.705531
8ac986bfe5397e23d2ea18de8fcecef9b93f9606
1,824
c
C
servers/nodejs/node_modules/restify/node_modules/dtrace-provider/libusdt/usdt_probe.c
HyperNexus/crashdumper
aeace29a899c5a69a67cfc18b35d74ed60768f66
[ "MIT" ]
191
2015-01-21T18:13:01.000Z
2022-02-19T20:59:34.000Z
node_modules/dtrace-provider/libusdt/usdt_probe.c
Vahegian/GianPlay_server
0d75e42660f9c01eadb6c8fd6981573206a1dd1e
[ "MIT" ]
23
2015-02-16T06:51:33.000Z
2021-11-29T04:51:13.000Z
node_modules/dtrace-provider/libusdt/usdt_probe.c
Vahegian/GianPlay_server
0d75e42660f9c01eadb6c8fd6981573206a1dd1e
[ "MIT" ]
123
2015-01-02T16:45:07.000Z
2022-03-02T21:23:03.000Z
/* * Copyright (c) 2012, Chris Andrews. All rights reserved. */ #include "usdt_internal.h" #ifdef __APPLE__ uint32_t usdt_probe_offset(usdt_probe_t *probe, char *dof, uint8_t argc) { uint32_t offset; #ifdef __x86_64__ offset = ((uint64_t) probe->probe_addr - (uint64_t) dof + 2); #elif __i386__ offset = ((uint32_t) probe->probe_addr - (uint32_t) dof + 2); #else #error "only x86_64 and i386 supported" #endif return (offset); } uint32_t usdt_is_enabled_offset(usdt_probe_t *probe, char *dof) { uint32_t offset; #ifdef __x86_64__ offset = ((uint64_t) probe->isenabled_addr - (uint64_t) dof + 6); #elif __i386__ offset = ((uint32_t) probe->isenabled_addr - (uint32_t) dof + 6); #else #error "only x86_64 and i386 supported" #endif return (offset); } #else /* solaris and freebsd */ uint32_t usdt_probe_offset(usdt_probe_t *probe, char *dof, uint8_t argc) { return (16); } uint32_t usdt_is_enabled_offset(usdt_probe_t *probe, char *dof) { return (8); } #endif int usdt_create_tracepoints(usdt_probe_t *probe) { size_t size; /* ensure that the tracepoints will fit the heap we're allocating */ size = ((char *)usdt_tracepoint_end - (char *)usdt_tracepoint_isenabled); assert(size < FUNC_SIZE); if ((probe->isenabled_addr = (int (*)())valloc(FUNC_SIZE)) == NULL) return (-1); size = ((char *)usdt_tracepoint_probe - (char *)usdt_tracepoint_isenabled); probe->probe_addr = (char *)probe->isenabled_addr + size; memcpy((void *)probe->isenabled_addr, (const void *)usdt_tracepoint_isenabled, FUNC_SIZE); mprotect((void *)probe->isenabled_addr, FUNC_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC); return (0); }
24.32
83
0.648026
8ac9b69e9336e18d4cb4ff349c497c300a4238b0
1,499
h
C
libraries/entities/src/SimpleEntitySimulation.h
kevinhouyang/hifi
cfb0d0aeb6d8961ec802909d4439d58383252e59
[ "Apache-2.0" ]
3
2019-01-27T14:49:35.000Z
2020-01-15T18:49:11.000Z
libraries/entities/src/SimpleEntitySimulation.h
kevinhouyang/hifi
cfb0d0aeb6d8961ec802909d4439d58383252e59
[ "Apache-2.0" ]
null
null
null
libraries/entities/src/SimpleEntitySimulation.h
kevinhouyang/hifi
cfb0d0aeb6d8961ec802909d4439d58383252e59
[ "Apache-2.0" ]
2
2019-06-13T22:25:13.000Z
2022-01-31T15:17:55.000Z
// // SimpleEntitySimulation.h // libraries/entities/src // // Created by Andrew Meadows on 2014.11.24 // Copyright 2014 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #ifndef hifi_SimpleEntitySimulation_h #define hifi_SimpleEntitySimulation_h #include "EntitySimulation.h" class SimpleEntitySimulation; using SimpleEntitySimulationPointer = std::shared_ptr<SimpleEntitySimulation>; /// provides simple velocity + gravity extrapolation of EntityItem's class SimpleEntitySimulation : public EntitySimulation { public: SimpleEntitySimulation() : EntitySimulation() { } ~SimpleEntitySimulation() { clearEntitiesInternal(); } void clearOwnership(const QUuid& ownerID); protected: void updateEntitiesInternal(uint64_t now) override; void addEntityInternal(EntityItemPointer entity) override; void removeEntityInternal(EntityItemPointer entity) override; void changeEntityInternal(EntityItemPointer entity) override; void clearEntitiesInternal() override; void sortEntitiesThatMoved() override; void expireStaleOwnerships(uint64_t now); void stopOwnerlessEntities(uint64_t now); SetOfEntities _entitiesWithSimulationOwner; SetOfEntities _entitiesThatNeedSimulationOwner; uint64_t _nextOwnerlessExpiry { 0 }; uint64_t _nextStaleOwnershipExpiry { (uint64_t)(-1) }; }; #endif // hifi_SimpleEntitySimulation_h
30.591837
88
0.782522
8ac9f8fc331eb5d55c1dda07b3be6a136a90d080
4,925
c
C
soccer_embedded/Development/Motor_ID/Src/MX28.c
ghsecuritylab/soccer_ws
60600fb826c06362182ebff00f3031e87ac45f7c
[ "BSD-3-Clause" ]
56
2016-12-25T22:29:00.000Z
2022-01-06T04:42:00.000Z
soccer_embedded/Development/Motor_ID/Src/MX28.c
ghsecuritylab/soccer_ws
60600fb826c06362182ebff00f3031e87ac45f7c
[ "BSD-3-Clause" ]
244
2021-04-05T03:22:25.000Z
2022-03-31T16:47:36.000Z
soccer_embedded/Development/Motor_ID/Src/MX28.c
ghsecuritylab/soccer_ws
60600fb826c06362182ebff00f3031e87ac45f7c
[ "BSD-3-Clause" ]
7
2017-01-24T23:38:07.000Z
2022-01-19T16:58:08.000Z
/* This file implements MX28-specific functions. * * Author: Tyler */ /********************************* Includes ************************************/ #include "MX28.h" /********************************** Externs ************************************/ extern void Dynamixel_DataWriter(Dynamixel_HandleTypeDef* hdynamixel, uint8_t* args, uint8_t numArgs); extern void Dynamixel_SetCWAngleLimit(Dynamixel_HandleTypeDef* hdynamixel, float minAngle); // (EEPROM) extern void Dynamixel_SetCCWAngleLimit(Dynamixel_HandleTypeDef* hdynamixel, float maxAngle); // (EEPROM) /******************************** Functions ************************************/ /*******************************************************************************/ /* Setter helper functions */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /*******************************************************************************/ void MX28_SetMultiTurnOffset(Dynamixel_HandleTypeDef* hdynamixel, int16_t offset){ /* For an actuator not in multi-turn mode, this has no effect. * * For an actuator in multi-turn mode, this applies a tunable offset to all positions. * That is, it allows you to change where the actuator considers position 0 to be. * * Arguments: hdynamixel, the motor handle * offset, the signed offset argument indicating the offset to program * * Returns: none */ if(offset > 28672){ offset = 28672; } else if(offset < -28672){ offset = -28672; } uint8_t args[3] = {MX28_REG_MULTI_TURN_OFFSET, offset & 0xFF, (offset >> 16) & 0xFF}; Dynamixel_DataWriter(hdynamixel, args, sizeof(args)); } // TODO. Challenge with this is it means we need to track resolution divider in the // handle so that we can compute position properly in the position functions void MX28_SetResolutionDivider(Dynamixel_HandleTypeDef* hdynamixel, uint8_t divider){ } void MX28_SetDGain(Dynamixel_HandleTypeDef* hdynamixel, uint8_t DGain){ /* Sets the value of the derivative gain used in the motor's PID controller. * kD = DGain / 250 * * Arguments: hdynamixel, the motor handle * DGain, the derivative gain parameter * * Returns: none */ if(hdynamixel -> _motorType == MX28TYPE){ uint8_t args[2] = {MX28_REG_D_GAIN, DGain}; Dynamixel_DataWriter(hdynamixel, args, sizeof(args)); } } void MX28_SetIGain(Dynamixel_HandleTypeDef* hdynamixel, uint8_t IGain){ /* Sets the value of the integral gain used in the motor's PID controller. * kI = IGain * 125/256 * * Arguments: hdynamixel, the motor handle * IGain, the integral gain parameter * * Returns: none */ if(hdynamixel -> _motorType == MX28TYPE){ uint8_t args[2] = {MX28_REG_I_GAIN, IGain}; Dynamixel_DataWriter(hdynamixel, args, sizeof(args)); } } void MX28_SetPGain(Dynamixel_HandleTypeDef* hdynamixel, uint8_t PGain){ /* Sets the value of the proportional gain used in the motor's PID controller. * kP = PGain / 8 * * Arguments: hdynamixel, the motor handle * PGain, the proportional gain parameter * * Returns: none */ if(hdynamixel -> _motorType == MX28TYPE){ uint8_t args[2] = {MX28_REG_P_GAIN, PGain}; Dynamixel_DataWriter(hdynamixel, args, sizeof(args)); } } void MX28_SetGoalAcceleration(Dynamixel_HandleTypeDef* hdynamixel, float goalAcceleration){ /* Sets the goal acceleration. The argument should be in units of degree/s^2 * * Special: goalAcceleration of 0 means no control over accel (uses max accel of motor) * * Arguments: hdynamixel, the motor handle * goalAcceleration, the target acceleration in degree/s^2 */ if(hdynamixel -> _motorType == MX28TYPE){ if(goalAcceleration > 2180){ goalAcceleration = 2180; } if(goalAcceleration < 0){ goalAcceleration = 0; } uint8_t accelArg = (uint8_t)(goalAcceleration / 8.583); uint8_t args[2] = {MX28_REG_GOAL_ACCELERATION, accelArg}; Dynamixel_DataWriter(hdynamixel, args, sizeof(args)); } } /*******************************************************************************/ /* Interfaces for previously-defined functions */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /*******************************************************************************/ void MX28_EnterMultiTurnMode(Dynamixel_HandleTypeDef* hdynamixel){ /* Activates multi-turn mode, which allows the actuator to have a range of * controllable position values from -28672 to 28672. * * Arguments: hdynamixel, the motor handle * * Returns: none */ if(hdynamixel -> _motorType == MX28TYPE){ Dynamixel_SetCWAngleLimit(hdynamixel, 4095); Dynamixel_SetCCWAngleLimit(hdynamixel, 4095); } }
32.189542
104
0.588223
8aca61db9a6903b69cfe138ae49335d645444324
1,117
h
C
usr/lib/libnetwork.dylib/nw_interpose_flow.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
2
2021-11-02T09:23:27.000Z
2022-03-28T08:21:57.000Z
usr/lib/libnetwork.dylib/nw_interpose_flow.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
null
null
null
usr/lib/libnetwork.dylib/nw_interpose_flow.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
1
2022-03-28T08:21:59.000Z
2022-03-28T08:21:59.000Z
/* * This header is generated by classdump-dyld 1.5 * on Friday, April 30, 2021 at 11:34:23 AM Mountain Standard Time * Operating System: Version 13.5.1 (Build 17F80) * Image Source: /usr/lib/libnetwork.dylib * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley. */ @protocol OS_nw_interface, OS_nw_path_flow_registration, OS_nw_path_flow; @class NSObject; @interface nw_interpose_flow : NSObject { NSObject*<OS_nw_interface> _interface; NSObject*<OS_nw_path_flow_registration> _registration; NSObject*<OS_nw_path_flow> _flow; /*^block*/id _eventHandler; } -(void)dealloc; -(void)close; -(void)resetFlow:(id)arg1 ; -(id)initWithInterface:(id)arg1 registration:(id)arg2 eventHandler:(/*^block*/id)arg3 ; -(void)notifyFlowEvent:(int)arg1 ; -(void)closeFlow; -(void)clearFlowEventHandler; -(BOOL)matchNexusAgent:(unsigned char)arg1 ; -(BOOL)matchNexusAgentWithFlow:(id)arg1 ; -(BOOL)matchNexusInstance:(id)arg1 ; @end
33.848485
130
0.672337
8acadbae75495c5c2eafd5cc5e5a207c72382e43
35,276
h
C
study/start_tf_serving/apis/session_service.pb.h
taozhijiang/serving
dda80c25cb0bb203bef77757327bc000f249c06a
[ "Apache-2.0" ]
null
null
null
study/start_tf_serving/apis/session_service.pb.h
taozhijiang/serving
dda80c25cb0bb203bef77757327bc000f249c06a
[ "Apache-2.0" ]
null
null
null
study/start_tf_serving/apis/session_service.pb.h
taozhijiang/serving
dda80c25cb0bb203bef77757327bc000f249c06a
[ "Apache-2.0" ]
null
null
null
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow_serving/apis/session_service.proto #ifndef PROTOBUF_INCLUDED_tensorflow_5fserving_2fapis_2fsession_5fservice_2eproto #define PROTOBUF_INCLUDED_tensorflow_5fserving_2fapis_2fsession_5fservice_2eproto #include <string> #include <google/protobuf/stubs/common.h> #if GOOGLE_PROTOBUF_VERSION < 3006001 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif #if 3006001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. #endif #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/arena.h> #include <google/protobuf/arenastring.h> #include <google/protobuf/generated_message_table_driven.h> #include <google/protobuf/generated_message_util.h> #include <google/protobuf/inlined_string_field.h> #include <google/protobuf/metadata.h> #include <google/protobuf/message.h> #include <google/protobuf/repeated_field.h> // IWYU pragma: export #include <google/protobuf/extension_set.h> // IWYU pragma: export #include <google/protobuf/unknown_field_set.h> #include "tensorflow_serving/apis/model.pb.h" #include "tensorflow/core/protobuf/config.pb.h" #include "tensorflow/core/protobuf/named_tensor.pb.h" // @@protoc_insertion_point(includes) #define PROTOBUF_INTERNAL_EXPORT_protobuf_tensorflow_5fserving_2fapis_2fsession_5fservice_2eproto namespace protobuf_tensorflow_5fserving_2fapis_2fsession_5fservice_2eproto { // Internal implementation detail -- do not use these members. struct TableStruct { static const ::google::protobuf::internal::ParseTableField entries[]; static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; static const ::google::protobuf::internal::ParseTable schema[2]; static const ::google::protobuf::internal::FieldMetadata field_metadata[]; static const ::google::protobuf::internal::SerializationTable serialization_table[]; static const ::google::protobuf::uint32 offsets[]; }; void AddDescriptors(); } // namespace protobuf_tensorflow_5fserving_2fapis_2fsession_5fservice_2eproto namespace tensorflow { namespace serving { class SessionRunRequest; class SessionRunRequestDefaultTypeInternal; extern SessionRunRequestDefaultTypeInternal _SessionRunRequest_default_instance_; class SessionRunResponse; class SessionRunResponseDefaultTypeInternal; extern SessionRunResponseDefaultTypeInternal _SessionRunResponse_default_instance_; } // namespace serving } // namespace tensorflow namespace google { namespace protobuf { template<> ::tensorflow::serving::SessionRunRequest* Arena::CreateMaybeMessage<::tensorflow::serving::SessionRunRequest>(Arena*); template<> ::tensorflow::serving::SessionRunResponse* Arena::CreateMaybeMessage<::tensorflow::serving::SessionRunResponse>(Arena*); } // namespace protobuf } // namespace google namespace tensorflow { namespace serving { // =================================================================== class SessionRunRequest : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:tensorflow.serving.SessionRunRequest) */ { public: SessionRunRequest(); virtual ~SessionRunRequest(); SessionRunRequest(const SessionRunRequest& from); inline SessionRunRequest& operator=(const SessionRunRequest& from) { CopyFrom(from); return *this; } #if LANG_CXX11 SessionRunRequest(SessionRunRequest&& from) noexcept : SessionRunRequest() { *this = ::std::move(from); } inline SessionRunRequest& operator=(SessionRunRequest&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif inline ::google::protobuf::Arena* GetArena() const final { return GetArenaNoVirtual(); } inline void* GetMaybeArenaPointer() const final { return MaybeArenaPtr(); } static const ::google::protobuf::Descriptor* descriptor(); static const SessionRunRequest& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const SessionRunRequest* internal_default_instance() { return reinterpret_cast<const SessionRunRequest*>( &_SessionRunRequest_default_instance_); } static constexpr int kIndexInFileMessages = 0; void UnsafeArenaSwap(SessionRunRequest* other); void Swap(SessionRunRequest* other); friend void swap(SessionRunRequest& a, SessionRunRequest& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline SessionRunRequest* New() const final { return CreateMaybeMessage<SessionRunRequest>(NULL); } SessionRunRequest* New(::google::protobuf::Arena* arena) const final { return CreateMaybeMessage<SessionRunRequest>(arena); } void CopyFrom(const ::google::protobuf::Message& from) final; void MergeFrom(const ::google::protobuf::Message& from) final; void CopyFrom(const SessionRunRequest& from); void MergeFrom(const SessionRunRequest& from); void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) final; void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const final; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(SessionRunRequest* other); protected: explicit SessionRunRequest(::google::protobuf::Arena* arena); private: static void ArenaDtor(void* object); inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } public: ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // repeated .tensorflow.NamedTensorProto feed = 2; int feed_size() const; void clear_feed(); static const int kFeedFieldNumber = 2; ::tensorflow::NamedTensorProto* mutable_feed(int index); ::google::protobuf::RepeatedPtrField< ::tensorflow::NamedTensorProto >* mutable_feed(); const ::tensorflow::NamedTensorProto& feed(int index) const; ::tensorflow::NamedTensorProto* add_feed(); const ::google::protobuf::RepeatedPtrField< ::tensorflow::NamedTensorProto >& feed() const; // repeated string fetch = 3; int fetch_size() const; void clear_fetch(); static const int kFetchFieldNumber = 3; const ::std::string& fetch(int index) const; ::std::string* mutable_fetch(int index); void set_fetch(int index, const ::std::string& value); #if LANG_CXX11 void set_fetch(int index, ::std::string&& value); #endif void set_fetch(int index, const char* value); void set_fetch(int index, const char* value, size_t size); ::std::string* add_fetch(); void add_fetch(const ::std::string& value); #if LANG_CXX11 void add_fetch(::std::string&& value); #endif void add_fetch(const char* value); void add_fetch(const char* value, size_t size); const ::google::protobuf::RepeatedPtrField< ::std::string>& fetch() const; ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_fetch(); // repeated string target = 4; int target_size() const; void clear_target(); static const int kTargetFieldNumber = 4; const ::std::string& target(int index) const; ::std::string* mutable_target(int index); void set_target(int index, const ::std::string& value); #if LANG_CXX11 void set_target(int index, ::std::string&& value); #endif void set_target(int index, const char* value); void set_target(int index, const char* value, size_t size); ::std::string* add_target(); void add_target(const ::std::string& value); #if LANG_CXX11 void add_target(::std::string&& value); #endif void add_target(const char* value); void add_target(const char* value, size_t size); const ::google::protobuf::RepeatedPtrField< ::std::string>& target() const; ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_target(); // .tensorflow.serving.ModelSpec model_spec = 1; bool has_model_spec() const; void clear_model_spec(); static const int kModelSpecFieldNumber = 1; private: const ::tensorflow::serving::ModelSpec& _internal_model_spec() const; public: const ::tensorflow::serving::ModelSpec& model_spec() const; ::tensorflow::serving::ModelSpec* release_model_spec(); ::tensorflow::serving::ModelSpec* mutable_model_spec(); void set_allocated_model_spec(::tensorflow::serving::ModelSpec* model_spec); void unsafe_arena_set_allocated_model_spec( ::tensorflow::serving::ModelSpec* model_spec); ::tensorflow::serving::ModelSpec* unsafe_arena_release_model_spec(); // .tensorflow.RunOptions options = 5; bool has_options() const; void clear_options(); static const int kOptionsFieldNumber = 5; private: const ::tensorflow::RunOptions& _internal_options() const; public: const ::tensorflow::RunOptions& options() const; ::tensorflow::RunOptions* release_options(); ::tensorflow::RunOptions* mutable_options(); void set_allocated_options(::tensorflow::RunOptions* options); void unsafe_arena_set_allocated_options( ::tensorflow::RunOptions* options); ::tensorflow::RunOptions* unsafe_arena_release_options(); // @@protoc_insertion_point(class_scope:tensorflow.serving.SessionRunRequest) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; template <typename T> friend class ::google::protobuf::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; ::google::protobuf::RepeatedPtrField< ::tensorflow::NamedTensorProto > feed_; ::google::protobuf::RepeatedPtrField< ::std::string> fetch_; ::google::protobuf::RepeatedPtrField< ::std::string> target_; ::tensorflow::serving::ModelSpec* model_spec_; ::tensorflow::RunOptions* options_; mutable ::google::protobuf::internal::CachedSize _cached_size_; friend struct ::protobuf_tensorflow_5fserving_2fapis_2fsession_5fservice_2eproto::TableStruct; }; // ------------------------------------------------------------------- class SessionRunResponse : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:tensorflow.serving.SessionRunResponse) */ { public: SessionRunResponse(); virtual ~SessionRunResponse(); SessionRunResponse(const SessionRunResponse& from); inline SessionRunResponse& operator=(const SessionRunResponse& from) { CopyFrom(from); return *this; } #if LANG_CXX11 SessionRunResponse(SessionRunResponse&& from) noexcept : SessionRunResponse() { *this = ::std::move(from); } inline SessionRunResponse& operator=(SessionRunResponse&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif inline ::google::protobuf::Arena* GetArena() const final { return GetArenaNoVirtual(); } inline void* GetMaybeArenaPointer() const final { return MaybeArenaPtr(); } static const ::google::protobuf::Descriptor* descriptor(); static const SessionRunResponse& default_instance(); static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const SessionRunResponse* internal_default_instance() { return reinterpret_cast<const SessionRunResponse*>( &_SessionRunResponse_default_instance_); } static constexpr int kIndexInFileMessages = 1; void UnsafeArenaSwap(SessionRunResponse* other); void Swap(SessionRunResponse* other); friend void swap(SessionRunResponse& a, SessionRunResponse& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline SessionRunResponse* New() const final { return CreateMaybeMessage<SessionRunResponse>(NULL); } SessionRunResponse* New(::google::protobuf::Arena* arena) const final { return CreateMaybeMessage<SessionRunResponse>(arena); } void CopyFrom(const ::google::protobuf::Message& from) final; void MergeFrom(const ::google::protobuf::Message& from) final; void CopyFrom(const SessionRunResponse& from); void MergeFrom(const SessionRunResponse& from); void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) final; void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const final; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(SessionRunResponse* other); protected: explicit SessionRunResponse(::google::protobuf::Arena* arena); private: static void ArenaDtor(void* object); inline void RegisterArenaDtor(::google::protobuf::Arena* arena); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } public: ::google::protobuf::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // repeated .tensorflow.NamedTensorProto tensor = 1; int tensor_size() const; void clear_tensor(); static const int kTensorFieldNumber = 1; ::tensorflow::NamedTensorProto* mutable_tensor(int index); ::google::protobuf::RepeatedPtrField< ::tensorflow::NamedTensorProto >* mutable_tensor(); const ::tensorflow::NamedTensorProto& tensor(int index) const; ::tensorflow::NamedTensorProto* add_tensor(); const ::google::protobuf::RepeatedPtrField< ::tensorflow::NamedTensorProto >& tensor() const; // .tensorflow.RunMetadata metadata = 2; bool has_metadata() const; void clear_metadata(); static const int kMetadataFieldNumber = 2; private: const ::tensorflow::RunMetadata& _internal_metadata() const; public: const ::tensorflow::RunMetadata& metadata() const; ::tensorflow::RunMetadata* release_metadata(); ::tensorflow::RunMetadata* mutable_metadata(); void set_allocated_metadata(::tensorflow::RunMetadata* metadata); void unsafe_arena_set_allocated_metadata( ::tensorflow::RunMetadata* metadata); ::tensorflow::RunMetadata* unsafe_arena_release_metadata(); // .tensorflow.serving.ModelSpec model_spec = 3; bool has_model_spec() const; void clear_model_spec(); static const int kModelSpecFieldNumber = 3; private: const ::tensorflow::serving::ModelSpec& _internal_model_spec() const; public: const ::tensorflow::serving::ModelSpec& model_spec() const; ::tensorflow::serving::ModelSpec* release_model_spec(); ::tensorflow::serving::ModelSpec* mutable_model_spec(); void set_allocated_model_spec(::tensorflow::serving::ModelSpec* model_spec); void unsafe_arena_set_allocated_model_spec( ::tensorflow::serving::ModelSpec* model_spec); ::tensorflow::serving::ModelSpec* unsafe_arena_release_model_spec(); // @@protoc_insertion_point(class_scope:tensorflow.serving.SessionRunResponse) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; template <typename T> friend class ::google::protobuf::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; ::google::protobuf::RepeatedPtrField< ::tensorflow::NamedTensorProto > tensor_; ::tensorflow::RunMetadata* metadata_; ::tensorflow::serving::ModelSpec* model_spec_; mutable ::google::protobuf::internal::CachedSize _cached_size_; friend struct ::protobuf_tensorflow_5fserving_2fapis_2fsession_5fservice_2eproto::TableStruct; }; // =================================================================== // =================================================================== #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // __GNUC__ // SessionRunRequest // .tensorflow.serving.ModelSpec model_spec = 1; inline bool SessionRunRequest::has_model_spec() const { return this != internal_default_instance() && model_spec_ != NULL; } inline const ::tensorflow::serving::ModelSpec& SessionRunRequest::_internal_model_spec() const { return *model_spec_; } inline const ::tensorflow::serving::ModelSpec& SessionRunRequest::model_spec() const { const ::tensorflow::serving::ModelSpec* p = model_spec_; // @@protoc_insertion_point(field_get:tensorflow.serving.SessionRunRequest.model_spec) return p != NULL ? *p : *reinterpret_cast<const ::tensorflow::serving::ModelSpec*>( &::tensorflow::serving::_ModelSpec_default_instance_); } inline ::tensorflow::serving::ModelSpec* SessionRunRequest::release_model_spec() { // @@protoc_insertion_point(field_release:tensorflow.serving.SessionRunRequest.model_spec) ::tensorflow::serving::ModelSpec* temp = model_spec_; if (GetArenaNoVirtual() != NULL) { temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); } model_spec_ = NULL; return temp; } inline ::tensorflow::serving::ModelSpec* SessionRunRequest::unsafe_arena_release_model_spec() { // @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.serving.SessionRunRequest.model_spec) ::tensorflow::serving::ModelSpec* temp = model_spec_; model_spec_ = NULL; return temp; } inline ::tensorflow::serving::ModelSpec* SessionRunRequest::mutable_model_spec() { if (model_spec_ == NULL) { auto* p = CreateMaybeMessage<::tensorflow::serving::ModelSpec>(GetArenaNoVirtual()); model_spec_ = p; } // @@protoc_insertion_point(field_mutable:tensorflow.serving.SessionRunRequest.model_spec) return model_spec_; } inline void SessionRunRequest::set_allocated_model_spec(::tensorflow::serving::ModelSpec* model_spec) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(model_spec_); } if (model_spec) { ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(model_spec)->GetArena(); if (message_arena != submessage_arena) { model_spec = ::google::protobuf::internal::GetOwnedMessage( message_arena, model_spec, submessage_arena); } } else { } model_spec_ = model_spec; // @@protoc_insertion_point(field_set_allocated:tensorflow.serving.SessionRunRequest.model_spec) } // repeated .tensorflow.NamedTensorProto feed = 2; inline int SessionRunRequest::feed_size() const { return feed_.size(); } inline ::tensorflow::NamedTensorProto* SessionRunRequest::mutable_feed(int index) { // @@protoc_insertion_point(field_mutable:tensorflow.serving.SessionRunRequest.feed) return feed_.Mutable(index); } inline ::google::protobuf::RepeatedPtrField< ::tensorflow::NamedTensorProto >* SessionRunRequest::mutable_feed() { // @@protoc_insertion_point(field_mutable_list:tensorflow.serving.SessionRunRequest.feed) return &feed_; } inline const ::tensorflow::NamedTensorProto& SessionRunRequest::feed(int index) const { // @@protoc_insertion_point(field_get:tensorflow.serving.SessionRunRequest.feed) return feed_.Get(index); } inline ::tensorflow::NamedTensorProto* SessionRunRequest::add_feed() { // @@protoc_insertion_point(field_add:tensorflow.serving.SessionRunRequest.feed) return feed_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::tensorflow::NamedTensorProto >& SessionRunRequest::feed() const { // @@protoc_insertion_point(field_list:tensorflow.serving.SessionRunRequest.feed) return feed_; } // repeated string fetch = 3; inline int SessionRunRequest::fetch_size() const { return fetch_.size(); } inline void SessionRunRequest::clear_fetch() { fetch_.Clear(); } inline const ::std::string& SessionRunRequest::fetch(int index) const { // @@protoc_insertion_point(field_get:tensorflow.serving.SessionRunRequest.fetch) return fetch_.Get(index); } inline ::std::string* SessionRunRequest::mutable_fetch(int index) { // @@protoc_insertion_point(field_mutable:tensorflow.serving.SessionRunRequest.fetch) return fetch_.Mutable(index); } inline void SessionRunRequest::set_fetch(int index, const ::std::string& value) { // @@protoc_insertion_point(field_set:tensorflow.serving.SessionRunRequest.fetch) fetch_.Mutable(index)->assign(value); } #if LANG_CXX11 inline void SessionRunRequest::set_fetch(int index, ::std::string&& value) { // @@protoc_insertion_point(field_set:tensorflow.serving.SessionRunRequest.fetch) fetch_.Mutable(index)->assign(std::move(value)); } #endif inline void SessionRunRequest::set_fetch(int index, const char* value) { GOOGLE_DCHECK(value != NULL); fetch_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set_char:tensorflow.serving.SessionRunRequest.fetch) } inline void SessionRunRequest::set_fetch(int index, const char* value, size_t size) { fetch_.Mutable(index)->assign( reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_set_pointer:tensorflow.serving.SessionRunRequest.fetch) } inline ::std::string* SessionRunRequest::add_fetch() { // @@protoc_insertion_point(field_add_mutable:tensorflow.serving.SessionRunRequest.fetch) return fetch_.Add(); } inline void SessionRunRequest::add_fetch(const ::std::string& value) { fetch_.Add()->assign(value); // @@protoc_insertion_point(field_add:tensorflow.serving.SessionRunRequest.fetch) } #if LANG_CXX11 inline void SessionRunRequest::add_fetch(::std::string&& value) { fetch_.Add(std::move(value)); // @@protoc_insertion_point(field_add:tensorflow.serving.SessionRunRequest.fetch) } #endif inline void SessionRunRequest::add_fetch(const char* value) { GOOGLE_DCHECK(value != NULL); fetch_.Add()->assign(value); // @@protoc_insertion_point(field_add_char:tensorflow.serving.SessionRunRequest.fetch) } inline void SessionRunRequest::add_fetch(const char* value, size_t size) { fetch_.Add()->assign(reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_add_pointer:tensorflow.serving.SessionRunRequest.fetch) } inline const ::google::protobuf::RepeatedPtrField< ::std::string>& SessionRunRequest::fetch() const { // @@protoc_insertion_point(field_list:tensorflow.serving.SessionRunRequest.fetch) return fetch_; } inline ::google::protobuf::RepeatedPtrField< ::std::string>* SessionRunRequest::mutable_fetch() { // @@protoc_insertion_point(field_mutable_list:tensorflow.serving.SessionRunRequest.fetch) return &fetch_; } // repeated string target = 4; inline int SessionRunRequest::target_size() const { return target_.size(); } inline void SessionRunRequest::clear_target() { target_.Clear(); } inline const ::std::string& SessionRunRequest::target(int index) const { // @@protoc_insertion_point(field_get:tensorflow.serving.SessionRunRequest.target) return target_.Get(index); } inline ::std::string* SessionRunRequest::mutable_target(int index) { // @@protoc_insertion_point(field_mutable:tensorflow.serving.SessionRunRequest.target) return target_.Mutable(index); } inline void SessionRunRequest::set_target(int index, const ::std::string& value) { // @@protoc_insertion_point(field_set:tensorflow.serving.SessionRunRequest.target) target_.Mutable(index)->assign(value); } #if LANG_CXX11 inline void SessionRunRequest::set_target(int index, ::std::string&& value) { // @@protoc_insertion_point(field_set:tensorflow.serving.SessionRunRequest.target) target_.Mutable(index)->assign(std::move(value)); } #endif inline void SessionRunRequest::set_target(int index, const char* value) { GOOGLE_DCHECK(value != NULL); target_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set_char:tensorflow.serving.SessionRunRequest.target) } inline void SessionRunRequest::set_target(int index, const char* value, size_t size) { target_.Mutable(index)->assign( reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_set_pointer:tensorflow.serving.SessionRunRequest.target) } inline ::std::string* SessionRunRequest::add_target() { // @@protoc_insertion_point(field_add_mutable:tensorflow.serving.SessionRunRequest.target) return target_.Add(); } inline void SessionRunRequest::add_target(const ::std::string& value) { target_.Add()->assign(value); // @@protoc_insertion_point(field_add:tensorflow.serving.SessionRunRequest.target) } #if LANG_CXX11 inline void SessionRunRequest::add_target(::std::string&& value) { target_.Add(std::move(value)); // @@protoc_insertion_point(field_add:tensorflow.serving.SessionRunRequest.target) } #endif inline void SessionRunRequest::add_target(const char* value) { GOOGLE_DCHECK(value != NULL); target_.Add()->assign(value); // @@protoc_insertion_point(field_add_char:tensorflow.serving.SessionRunRequest.target) } inline void SessionRunRequest::add_target(const char* value, size_t size) { target_.Add()->assign(reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_add_pointer:tensorflow.serving.SessionRunRequest.target) } inline const ::google::protobuf::RepeatedPtrField< ::std::string>& SessionRunRequest::target() const { // @@protoc_insertion_point(field_list:tensorflow.serving.SessionRunRequest.target) return target_; } inline ::google::protobuf::RepeatedPtrField< ::std::string>* SessionRunRequest::mutable_target() { // @@protoc_insertion_point(field_mutable_list:tensorflow.serving.SessionRunRequest.target) return &target_; } // .tensorflow.RunOptions options = 5; inline bool SessionRunRequest::has_options() const { return this != internal_default_instance() && options_ != NULL; } inline const ::tensorflow::RunOptions& SessionRunRequest::_internal_options() const { return *options_; } inline const ::tensorflow::RunOptions& SessionRunRequest::options() const { const ::tensorflow::RunOptions* p = options_; // @@protoc_insertion_point(field_get:tensorflow.serving.SessionRunRequest.options) return p != NULL ? *p : *reinterpret_cast<const ::tensorflow::RunOptions*>( &::tensorflow::_RunOptions_default_instance_); } inline ::tensorflow::RunOptions* SessionRunRequest::release_options() { // @@protoc_insertion_point(field_release:tensorflow.serving.SessionRunRequest.options) ::tensorflow::RunOptions* temp = options_; if (GetArenaNoVirtual() != NULL) { temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); } options_ = NULL; return temp; } inline ::tensorflow::RunOptions* SessionRunRequest::unsafe_arena_release_options() { // @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.serving.SessionRunRequest.options) ::tensorflow::RunOptions* temp = options_; options_ = NULL; return temp; } inline ::tensorflow::RunOptions* SessionRunRequest::mutable_options() { if (options_ == NULL) { auto* p = CreateMaybeMessage<::tensorflow::RunOptions>(GetArenaNoVirtual()); options_ = p; } // @@protoc_insertion_point(field_mutable:tensorflow.serving.SessionRunRequest.options) return options_; } inline void SessionRunRequest::set_allocated_options(::tensorflow::RunOptions* options) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(options_); } if (options) { ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(options)->GetArena(); if (message_arena != submessage_arena) { options = ::google::protobuf::internal::GetOwnedMessage( message_arena, options, submessage_arena); } } else { } options_ = options; // @@protoc_insertion_point(field_set_allocated:tensorflow.serving.SessionRunRequest.options) } // ------------------------------------------------------------------- // SessionRunResponse // .tensorflow.serving.ModelSpec model_spec = 3; inline bool SessionRunResponse::has_model_spec() const { return this != internal_default_instance() && model_spec_ != NULL; } inline const ::tensorflow::serving::ModelSpec& SessionRunResponse::_internal_model_spec() const { return *model_spec_; } inline const ::tensorflow::serving::ModelSpec& SessionRunResponse::model_spec() const { const ::tensorflow::serving::ModelSpec* p = model_spec_; // @@protoc_insertion_point(field_get:tensorflow.serving.SessionRunResponse.model_spec) return p != NULL ? *p : *reinterpret_cast<const ::tensorflow::serving::ModelSpec*>( &::tensorflow::serving::_ModelSpec_default_instance_); } inline ::tensorflow::serving::ModelSpec* SessionRunResponse::release_model_spec() { // @@protoc_insertion_point(field_release:tensorflow.serving.SessionRunResponse.model_spec) ::tensorflow::serving::ModelSpec* temp = model_spec_; if (GetArenaNoVirtual() != NULL) { temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); } model_spec_ = NULL; return temp; } inline ::tensorflow::serving::ModelSpec* SessionRunResponse::unsafe_arena_release_model_spec() { // @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.serving.SessionRunResponse.model_spec) ::tensorflow::serving::ModelSpec* temp = model_spec_; model_spec_ = NULL; return temp; } inline ::tensorflow::serving::ModelSpec* SessionRunResponse::mutable_model_spec() { if (model_spec_ == NULL) { auto* p = CreateMaybeMessage<::tensorflow::serving::ModelSpec>(GetArenaNoVirtual()); model_spec_ = p; } // @@protoc_insertion_point(field_mutable:tensorflow.serving.SessionRunResponse.model_spec) return model_spec_; } inline void SessionRunResponse::set_allocated_model_spec(::tensorflow::serving::ModelSpec* model_spec) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(model_spec_); } if (model_spec) { ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(model_spec)->GetArena(); if (message_arena != submessage_arena) { model_spec = ::google::protobuf::internal::GetOwnedMessage( message_arena, model_spec, submessage_arena); } } else { } model_spec_ = model_spec; // @@protoc_insertion_point(field_set_allocated:tensorflow.serving.SessionRunResponse.model_spec) } // repeated .tensorflow.NamedTensorProto tensor = 1; inline int SessionRunResponse::tensor_size() const { return tensor_.size(); } inline ::tensorflow::NamedTensorProto* SessionRunResponse::mutable_tensor(int index) { // @@protoc_insertion_point(field_mutable:tensorflow.serving.SessionRunResponse.tensor) return tensor_.Mutable(index); } inline ::google::protobuf::RepeatedPtrField< ::tensorflow::NamedTensorProto >* SessionRunResponse::mutable_tensor() { // @@protoc_insertion_point(field_mutable_list:tensorflow.serving.SessionRunResponse.tensor) return &tensor_; } inline const ::tensorflow::NamedTensorProto& SessionRunResponse::tensor(int index) const { // @@protoc_insertion_point(field_get:tensorflow.serving.SessionRunResponse.tensor) return tensor_.Get(index); } inline ::tensorflow::NamedTensorProto* SessionRunResponse::add_tensor() { // @@protoc_insertion_point(field_add:tensorflow.serving.SessionRunResponse.tensor) return tensor_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::tensorflow::NamedTensorProto >& SessionRunResponse::tensor() const { // @@protoc_insertion_point(field_list:tensorflow.serving.SessionRunResponse.tensor) return tensor_; } // .tensorflow.RunMetadata metadata = 2; inline bool SessionRunResponse::has_metadata() const { return this != internal_default_instance() && metadata_ != NULL; } inline const ::tensorflow::RunMetadata& SessionRunResponse::_internal_metadata() const { return *metadata_; } inline const ::tensorflow::RunMetadata& SessionRunResponse::metadata() const { const ::tensorflow::RunMetadata* p = metadata_; // @@protoc_insertion_point(field_get:tensorflow.serving.SessionRunResponse.metadata) return p != NULL ? *p : *reinterpret_cast<const ::tensorflow::RunMetadata*>( &::tensorflow::_RunMetadata_default_instance_); } inline ::tensorflow::RunMetadata* SessionRunResponse::release_metadata() { // @@protoc_insertion_point(field_release:tensorflow.serving.SessionRunResponse.metadata) ::tensorflow::RunMetadata* temp = metadata_; if (GetArenaNoVirtual() != NULL) { temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); } metadata_ = NULL; return temp; } inline ::tensorflow::RunMetadata* SessionRunResponse::unsafe_arena_release_metadata() { // @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.serving.SessionRunResponse.metadata) ::tensorflow::RunMetadata* temp = metadata_; metadata_ = NULL; return temp; } inline ::tensorflow::RunMetadata* SessionRunResponse::mutable_metadata() { if (metadata_ == NULL) { auto* p = CreateMaybeMessage<::tensorflow::RunMetadata>(GetArenaNoVirtual()); metadata_ = p; } // @@protoc_insertion_point(field_mutable:tensorflow.serving.SessionRunResponse.metadata) return metadata_; } inline void SessionRunResponse::set_allocated_metadata(::tensorflow::RunMetadata* metadata) { ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); if (message_arena == NULL) { delete reinterpret_cast< ::google::protobuf::MessageLite*>(metadata_); } if (metadata) { ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(metadata)->GetArena(); if (message_arena != submessage_arena) { metadata = ::google::protobuf::internal::GetOwnedMessage( message_arena, metadata, submessage_arena); } } else { } metadata_ = metadata; // @@protoc_insertion_point(field_set_allocated:tensorflow.serving.SessionRunResponse.metadata) } #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ // ------------------------------------------------------------------- // @@protoc_insertion_point(namespace_scope) } // namespace serving } // namespace tensorflow // @@protoc_insertion_point(global_scope) #endif // PROTOBUF_INCLUDED_tensorflow_5fserving_2fapis_2fsession_5fservice_2eproto
39.859887
150
0.742261
8acbcb8b465012d94f01ac7f9e5739dfecce45e6
647
h
C
projects/Project_1/record.h
gviloria/gviloria.github.io
e4b7d2cf6b270fd8648a11acc8082faf993943dc
[ "MIT" ]
null
null
null
projects/Project_1/record.h
gviloria/gviloria.github.io
e4b7d2cf6b270fd8648a11acc8082faf993943dc
[ "MIT" ]
null
null
null
projects/Project_1/record.h
gviloria/gviloria.github.io
e4b7d2cf6b270fd8648a11acc8082faf993943dc
[ "MIT" ]
null
null
null
/************************************************************************************************** * * NAME: Gabriel Viloria * * FILE: record.h * * DESCRIPTION: This file contains the record structure which contains information about * a users account number, name, address, year of birth, and a pointer to the * next record. * *************************************************************************************************/ extern int debugmode; struct record { int accountno; char name[25]; char address[80]; int yearofbirth; struct record* next; };
28.130435
99
0.409583
8ad4077249cdfad7e5e1599eee1111b5f416ba38
302
c
C
C-examples/intro/static.c
BigCheeze45/CS253-resources
9ef8151d30055e68055af6ee738b256b1e12f953
[ "MIT" ]
null
null
null
C-examples/intro/static.c
BigCheeze45/CS253-resources
9ef8151d30055e68055af6ee738b256b1e12f953
[ "MIT" ]
null
null
null
C-examples/intro/static.c
BigCheeze45/CS253-resources
9ef8151d30055e68055af6ee738b256b1e12f953
[ "MIT" ]
1
2020-09-23T09:30:59.000Z
2020-09-23T09:30:59.000Z
#include <stdio.h> int keepItStatic(int x) { static int y = 0; y = x + y; return y; } int main(int argc, char **argv) { int i; for(i = 0; i < 5; i++) { int result = keepItStatic(i); printf("[%d] result: %d\n", i, result); } return 0; }
15.1
48
0.456954
8ad4ffba284d138d8f9931fe17d9591a39d08b76
1,227
h
C
include/elf/KVReader.h
elf0/elf.c
112e8d873c3942e86c32a43b67b00181cc37a07a
[ "Unlicense" ]
null
null
null
include/elf/KVReader.h
elf0/elf.c
112e8d873c3942e86c32a43b67b00181cc37a07a
[ "Unlicense" ]
null
null
null
include/elf/KVReader.h
elf0/elf.c
112e8d873c3942e86c32a43b67b00181cc37a07a
[ "Unlicense" ]
null
null
null
#ifndef KVREADER_H #define KVREADER_H //License: Public Domain //Author: elf //EMail: elf@iamelf.com //Structure: "Key0:Value0\nKey1:Value1\nKey2:Value2\n:\n" //Buffer must ends with ":\n" #include "String.h" #ifndef KVReader_FILE_END #define KVReader_FILE_END ":\n" #endif #ifndef KVReader_KEY_END_CHAR #define KVReader_KEY_END_CHAR ':' #endif #ifndef KVReader_VALUE_END_CHAR #define KVReader_VALUE_END_CHAR '\n' #endif typedef E8 (*KVReader_Handler)(void *pContext, const C *pKey, const C *pKeyEnd, const C *pValue, const C *pValueEnd); static inline E8 KVReader_Parse(void *pContext, const C *pBegin, const C *pEnd, KVReader_Handler onKV){ if((pEnd - pBegin) < 2 || *(U16*)(pEnd - 2) != *(U16*)KVReader_FILE_END) return 1; --pEnd; E8 e; const C *pKey, *pKeyEnd, *pValue; const C *p = pBegin; while(1){ #ifndef KVReader_FORBID_EMPTY_RECORD p = String_Skip(p, (C)KVReader_VALUE_END_CHAR); #endif p = String_SkipUntil(pKey = p, (C)KVReader_KEY_END_CHAR); pKeyEnd = p++; p = String_SkipUntil(pValue = p, (C)KVReader_VALUE_END_CHAR); if(p == pEnd) break; e = onKV(pContext, pKey, pKeyEnd, pValue, p++); if(e) return e; } return 0; } #endif // KVREADER_H
21.526316
117
0.688672
8ad8fefcdc629a8ae2396ad419bc5eed2c82220d
1,786
h
C
UTEngine/Audio/AudioSubsystem.h
dpjudas/UTEngine
df9c7104c7d22c5b45eddc1515ddeab66b9c945e
[ "Apache-2.0", "CC0-1.0" ]
50
2020-12-02T17:41:17.000Z
2022-03-18T05:08:21.000Z
UTEngine/Audio/AudioSubsystem.h
dpjudas/UTEngine
df9c7104c7d22c5b45eddc1515ddeab66b9c945e
[ "Apache-2.0", "CC0-1.0" ]
11
2021-07-14T13:41:12.000Z
2021-09-30T10:32:58.000Z
UTEngine/Audio/AudioSubsystem.h
dpjudas/UTEngine
df9c7104c7d22c5b45eddc1515ddeab66b9c945e
[ "Apache-2.0", "CC0-1.0" ]
4
2021-07-20T20:22:36.000Z
2022-01-06T15:30:26.000Z
#pragma once #include "AudioMixer.h" #include "Math/vec.h" #include "Math/mat.h" class UActor; class USound; class UViewport; class UMusic; struct PlayingSound { PlayingSound() = default; PlayingSound(UActor* Actor, int Id, USound* Sound, vec3 Location, float Volume, float Radius, float Pitch, float Priority) : Actor(Actor), Id(Id), Sound(Sound), Location(Location), Volume(Volume), Radius(Radius), Pitch(Pitch), Priority(Priority) { } int Id = 0; int Channel = 0; float Priority = 0.0f; UActor* Actor = nullptr; USound* Sound = nullptr; vec3 Location = { 0.0f, 0.0f, 0.0f }; float Volume = 1.0f; float Radius = 1.0f; float Pitch = 1.0f; float CurrentVolume = 0.0f; }; class AudioSubsystem { public: AudioSubsystem(); void SetViewport(UViewport* Viewport); UViewport* GetViewport(); void Update(const mat4& listener); bool PlaySound(UActor* Actor, int Id, USound* Sound, vec3 Location, float Volume, float Radius, float Pitch); void NoteDestroy(UActor* Actor); void BreakpointTriggered(); void AddStats(std::vector<std::string>& lines); AudioMixer* GetMixer() { return Mixer.get(); } private: void StartAmbience(); void UpdateAmbience(); void UpdateSounds(const mat4& listener); void UpdateMusic(); void StopSound(size_t index); static float SoundPriority(UViewport* Viewport, vec3 Location, float Volume, float Radius); UViewport* Viewport = nullptr; bool UseDigitalMusic = true; bool ReverseStereo = false; int Channels = 32; uint8_t MusicVolume = 200; uint8_t SoundVolume = 255; float AmbientFactor = 0.7f; float DopplerSpeed = 9000.0f; std::unique_ptr<AudioMixer> Mixer; std::vector<PlayingSound> PlayingSounds; UMusic* CurrentSong = nullptr; int CurrentSection = 255; int FreeSlot = 0x07ffffff; bool AudioStats = false; };
24.465753
250
0.728443
8ada67038be2113cdd1de9813670748ebcf41559
695
h
C
chrome/browser/task_profiler/task_profiler_data_serializer.h
gavinp/chromium
681563ea0f892a051f4ef3d5e53438e0bb7d2261
[ "BSD-3-Clause" ]
1
2016-03-10T09:13:57.000Z
2016-03-10T09:13:57.000Z
chrome/browser/task_profiler/task_profiler_data_serializer.h
gavinp/chromium
681563ea0f892a051f4ef3d5e53438e0bb7d2261
[ "BSD-3-Clause" ]
1
2022-03-13T08:39:05.000Z
2022-03-13T08:39:05.000Z
chrome/browser/task_profiler/task_profiler_data_serializer.h
gavinp/chromium
681563ea0f892a051f4ef3d5e53438e0bb7d2261
[ "BSD-3-Clause" ]
null
null
null
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_TASK_PROFILER_TASK_PROFILER_DATA_SERIALIZER_H_ #define CHROME_BROWSER_TASK_PROFILER_TASK_PROFILER_DATA_SERIALIZER_H_ #pragma once class FilePath; namespace task_profiler { // This class collects task profiler data and serializes it to a file. The file // format is compatible with the about:profiler UI. class TaskProfilerDataSerializer { public: bool WriteToFile(const FilePath &path); }; } // namespace task_profiler #endif // CHROME_BROWSER_TASK_PROFILER_TASK_PROFILER_DATA_SERIALIZER_H_
30.217391
80
0.811511
8adae57471913cc2a572fe5e95a91b923f15114e
990
c
C
libft/libft/ft_putchar_fd.c
fbertoia/42sh
5dc12587c58b26814c55a50b8c83b198796ca91a
[ "MIT" ]
1
2018-05-05T13:58:26.000Z
2018-05-05T13:58:26.000Z
libft/libft/ft_putchar_fd.c
fbertoia/42sh
5dc12587c58b26814c55a50b8c83b198796ca91a
[ "MIT" ]
null
null
null
libft/libft/ft_putchar_fd.c
fbertoia/42sh
5dc12587c58b26814c55a50b8c83b198796ca91a
[ "MIT" ]
null
null
null
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putchar_fd.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: bluff <bluff@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/10/22 23:39:26 by bluff #+# #+# */ /* Updated: 2017/11/06 11:45:22 by fle-roy ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" #include <unistd.h> void ft_putchar_fd(char c, int fd) { write(fd, &c, 1); }
49.5
80
0.160606
8adf93b7b6b540874cf68f409ca92955225a657d
1,183
h
C
idenLib/utils.h
acv147258369/idenLib
10508a9a080adf419e78dde717e4f8024515d9b2
[ "MIT" ]
null
null
null
idenLib/utils.h
acv147258369/idenLib
10508a9a080adf419e78dde717e4f8024515d9b2
[ "MIT" ]
null
null
null
idenLib/utils.h
acv147258369/idenLib
10508a9a080adf419e78dde717e4f8024515d9b2
[ "MIT" ]
1
2020-10-19T18:48:02.000Z
2020-10-19T18:48:02.000Z
#pragma once #include <Windows.h> #include <cstdio> #include <string> #include <fstream> #include <algorithm> #include <sstream> #include <iterator> #include <unordered_map> #include <vector> #include <filesystem> #include "disassamble.h" #include "parseArchive.h" #include "compression.h" #include "Zydis/Zydis.h" #define ZSTD_STATIC_LINKING_ONLY #include "zstd.h" namespace fs = std::filesystem; #define NT_SUCCESS(_) (((NTSTATUS)(_)) >= 0) #define STATUS_SUCCESS ((NTSTATUS)0x00000000L) #define STATUS_UNSUCCESSFUL ((NTSTATUS)0xC0000001L) #define MIN_FUNC_SIZE 0x20 #define MAX_FUNC_SIZE 0x100 #ifdef _WIN64 #define ZYDIS_ADDRESS_WIDTH ZYDIS_ADDRESS_WIDTH_64 #define ZYDIS_MODE ZYDIS_MACHINE_MODE_LONG_64 #define SIG_EXT L".sig64" #else #define ZYDIS_ADDRESS_WIDTH ZYDIS_ADDRESS_WIDTH_32 #define ZYDIS_MODE ZYDIS_MACHINE_MODE_LEGACY_32 #define SIG_EXT L".sig" #endif inline fs::path symExPath{"SymEx"}; inline fs::path pdbDirName{"symbols"}; void Split(__in const std::string& str, __out std::vector<std::string>& cont); typedef struct _USER_CONTEXT { std::unordered_map<std::string, std::string> funcSignature; bool Dirty; } USER_CONTEXT, *PUSER_CONTEXT;
21.509091
78
0.772612
8adfb4f6f9e3267bf7670e42611971d0239c0f15
33,014
c
C
usr/src/uts/common/io/pciex/hotplug/pcie_hp.c
AsahiOS/gate
283d47da4e17a5871d9d575e7ffb81e8f6c52e51
[ "MIT" ]
null
null
null
usr/src/uts/common/io/pciex/hotplug/pcie_hp.c
AsahiOS/gate
283d47da4e17a5871d9d575e7ffb81e8f6c52e51
[ "MIT" ]
null
null
null
usr/src/uts/common/io/pciex/hotplug/pcie_hp.c
AsahiOS/gate
283d47da4e17a5871d9d575e7ffb81e8f6c52e51
[ "MIT" ]
1
2020-12-30T00:04:16.000Z
2020-12-30T00:04:16.000Z
/* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright 2019 Joyent, Inc. */ /* * This file contains the common hotplug code that is used by Standard * PCIe and PCI HotPlug Controller code. * * NOTE: This file is compiled and delivered through misc/pcie module. */ #include <sys/types.h> #include <sys/conf.h> #include <sys/kmem.h> #include <sys/debug.h> #include <sys/vtrace.h> #include <sys/autoconf.h> #include <sys/varargs.h> #include <sys/ddi_impldefs.h> #include <sys/time.h> #include <sys/note.h> #include <sys/callb.h> #include <sys/ddi.h> #include <sys/sunddi.h> #include <sys/sunndi.h> #include <sys/sysevent.h> #include <sys/sysevent/eventdefs.h> #include <sys/sysevent/dr.h> #include <sys/pci_impl.h> #include <sys/pci_cap.h> #include <sys/hotplug/pci/pcicfg.h> #include <sys/hotplug/pci/pcie_hp.h> #include <sys/hotplug/pci/pciehpc.h> #include <sys/hotplug/pci/pcishpc.h> #include <io/pciex/pcieb.h> /* Local functions prototype */ static int pcie_hp_list_occupants(dev_info_t *dip, void *arg); static int pcie_hp_register_port(dev_info_t *dip, dev_info_t *pdip, char *cn_name); static int pcie_hp_register_ports_for_dev(dev_info_t *dip, int device_num); static int pcie_hp_unregister_ports_cb(ddi_hp_cn_info_t *info, void *arg); static int pcie_hp_get_port_state(ddi_hp_cn_info_t *info, void *arg); static int pcie_hp_match_dev_func(dev_info_t *dip, void *hdl); static boolean_t pcie_hp_match_dev(dev_info_t *dip, int dev_num); static int pcie_hp_get_df_from_port_name(char *cn_name, int *dev_num, int *func_num); static int pcie_hp_create_port_name_num(dev_info_t *dip, ddi_hp_cn_info_t *cn_info); static int pcie_hp_check_hardware_existence(dev_info_t *dip, int dev_num, int func_num); /* * Global functions (called by other drivers/modules) */ /* * return description text for led state */ char * pcie_led_state_text(pcie_hp_led_state_t state) { switch (state) { case PCIE_HP_LED_ON: return (PCIEHPC_PROP_VALUE_ON); case PCIE_HP_LED_OFF: return (PCIEHPC_PROP_VALUE_OFF); case PCIE_HP_LED_BLINK: default: return (PCIEHPC_PROP_VALUE_BLINK); } } /* * return description text for slot condition */ char * pcie_slot_condition_text(ap_condition_t condition) { switch (condition) { case AP_COND_UNKNOWN: return (PCIEHPC_PROP_VALUE_UNKNOWN); case AP_COND_OK: return (PCIEHPC_PROP_VALUE_OK); case AP_COND_FAILING: return (PCIEHPC_PROP_VALUE_FAILING); case AP_COND_FAILED: return (PCIEHPC_PROP_VALUE_FAILED); case AP_COND_UNUSABLE: return (PCIEHPC_PROP_VALUE_UNUSABLE); default: return (PCIEHPC_PROP_VALUE_UNKNOWN); } } /* * routine to copy in a nvlist from userland */ int pcie_copyin_nvlist(char *packed_buf, size_t packed_sz, nvlist_t **nvlp) { int ret = DDI_SUCCESS; char *packed; nvlist_t *dest = NULL; if (packed_buf == NULL || packed_sz == 0) return (DDI_EINVAL); /* copyin packed nvlist */ if ((packed = kmem_alloc(packed_sz, KM_SLEEP)) == NULL) return (DDI_ENOMEM); if (copyin(packed_buf, packed, packed_sz) != 0) { cmn_err(CE_WARN, "pcie_copyin_nvlist: copyin failed.\n"); ret = DDI_FAILURE; goto copyin_cleanup; } /* unpack packed nvlist */ if ((ret = nvlist_unpack(packed, packed_sz, &dest, KM_SLEEP)) != 0) { cmn_err(CE_WARN, "pcie_copyin_nvlist: nvlist_unpack " "failed with err %d\n", ret); switch (ret) { case EINVAL: case ENOTSUP: ret = DDI_EINVAL; goto copyin_cleanup; case ENOMEM: ret = DDI_ENOMEM; goto copyin_cleanup; default: ret = DDI_FAILURE; goto copyin_cleanup; } } *nvlp = dest; copyin_cleanup: kmem_free(packed, packed_sz); return (ret); } /* * routine to copy out a nvlist to userland */ int pcie_copyout_nvlist(nvlist_t *nvl, char *packed_buf, size_t *buf_sz) { int err = 0; char *buf = NULL; size_t packed_sz; if (nvl == NULL || packed_buf == NULL || buf_sz == NULL) return (DDI_EINVAL); /* pack nvlist, the library will allocate memory */ if ((err = nvlist_pack(nvl, &buf, &packed_sz, NV_ENCODE_NATIVE, 0)) != 0) { cmn_err(CE_WARN, "pcie_copyout_nvlist: nvlist_pack " "failed with err %d\n", err); switch (err) { case EINVAL: case ENOTSUP: return (DDI_EINVAL); case ENOMEM: return (DDI_ENOMEM); default: return (DDI_FAILURE); } } if (packed_sz > *buf_sz) { return (DDI_EINVAL); } /* copyout packed nvlist */ if (copyout(buf, packed_buf, packed_sz) != 0) { cmn_err(CE_WARN, "pcie_copyout_nvlist: copyout " "failed.\n"); kmem_free(buf, packed_sz); return (DDI_FAILURE); } *buf_sz = packed_sz; kmem_free(buf, packed_sz); return (DDI_SUCCESS); } /* * init bus_hp_op entry and init hotpluggable slots & virtual ports */ int pcie_hp_init(dev_info_t *dip, caddr_t arg) { pcie_bus_t *bus_p = PCIE_DIP2BUS(dip); int ret = DDI_SUCCESS, count; dev_info_t *cdip; if (PCIE_IS_PCIE_HOTPLUG_CAPABLE(bus_p)) { /* Init hotplug controller */ ret = pciehpc_init(dip, arg); } else if (PCIE_IS_PCI_HOTPLUG_CAPABLE(bus_p)) { ret = pcishpc_init(dip); } if (ret != DDI_SUCCESS) { PCIE_DBG("pcie_hp_init: initialize hotplug " "controller failed with %d\n", ret); return (ret); } ndi_devi_enter(dip, &count); /* Create port for the first level children */ cdip = ddi_get_child(dip); while (cdip != NULL) { if ((ret = pcie_hp_register_port(cdip, dip, NULL)) != DDI_SUCCESS) { /* stop and cleanup */ break; } cdip = ddi_get_next_sibling(cdip); } ndi_devi_exit(dip, count); if (ret != DDI_SUCCESS) { cmn_err(CE_WARN, "pcie_hp_init: initialize virtual " "hotplug port failed with %d\n", ret); (void) pcie_hp_uninit(dip); return (ret); } return (DDI_SUCCESS); } /* * uninit the hotpluggable slots and virtual ports */ int pcie_hp_uninit(dev_info_t *dip) { pcie_bus_t *bus_p = PCIE_DIP2BUS(dip); pcie_hp_unreg_port_t arg; /* * Must set arg.rv to NDI_SUCCESS so that if there's no port * under this dip, we still return success thus the bridge * driver can be successfully detached. * * Note that during the probe PCI configurator calls * ndi_devi_offline() to detach driver for a new probed bridge, * so that it can reprogram the resources for the bridge, * ndi_devi_offline() calls into pcieb_detach() which in turn * calls into this function. In this case there are no ports * created under a new probe bridge dip, as ports are only * created after the configurator finishing probing, thus the * ndi_hp_walk_cn() will see no ports when this is called * from the PCI configurtor. */ arg.nexus_dip = dip; arg.connector_num = DDI_HP_CN_NUM_NONE; arg.rv = NDI_SUCCESS; /* tear down all virtual hotplug handles */ ndi_hp_walk_cn(dip, pcie_hp_unregister_ports_cb, &arg); if (arg.rv != NDI_SUCCESS) return (DDI_FAILURE); if (PCIE_IS_PCIE_HOTPLUG_ENABLED(bus_p)) (void) pciehpc_uninit(dip); else if (PCIE_IS_PCI_HOTPLUG_ENABLED(bus_p)) (void) pcishpc_uninit(dip); return (DDI_SUCCESS); } /* * interrupt handler */ int pcie_hp_intr(dev_info_t *dip) { pcie_bus_t *bus_p = PCIE_DIP2BUS(dip); int ret = DDI_INTR_UNCLAIMED; if (PCIE_IS_PCIE_HOTPLUG_ENABLED(bus_p)) ret = pciehpc_intr(dip); else if (PCIE_IS_PCI_HOTPLUG_ENABLED(bus_p)) ret = pcishpc_intr(dip); return (ret); } /* * Probe the given PCIe/PCI Hotplug Connection (CN). */ /*ARGSUSED*/ int pcie_hp_probe(pcie_hp_slot_t *slot_p) { pcie_hp_ctrl_t *ctrl_p = slot_p->hs_ctrl; dev_info_t *dip = ctrl_p->hc_dip; /* * Call the configurator to probe a given PCI hotplug * Hotplug Connection (CN). */ if (pcicfg_configure(dip, slot_p->hs_device_num, PCICFG_ALL_FUNC, 0) != PCICFG_SUCCESS) { PCIE_DBG("pcie_hp_probe() failed\n"); return (DDI_FAILURE); } slot_p->hs_condition = AP_COND_OK; pcie_hp_create_occupant_props(dip, makedevice(ddi_driver_major(dip), slot_p->hs_minor), slot_p->hs_device_num); /* * Create ports for the newly probed devices. * Note, this is only for the first level children because the * descendants' ports will be created during bridge driver attach. */ return (pcie_hp_register_ports_for_dev(dip, slot_p->hs_device_num)); } /* * Unprobe the given PCIe/PCI Hotplug Connection (CN): * 1. remove all child device nodes * 2. unregister all dependent ports */ /*ARGSUSED*/ int pcie_hp_unprobe(pcie_hp_slot_t *slot_p) { pcie_hp_ctrl_t *ctrl_p = slot_p->hs_ctrl; dev_info_t *dip = ctrl_p->hc_dip; pcie_hp_unreg_port_t arg; /* * Call the configurator to unprobe a given PCI hotplug * Hotplug Connection (CN). */ if (pcicfg_unconfigure(dip, slot_p->hs_device_num, PCICFG_ALL_FUNC, 0) != PCICFG_SUCCESS) { PCIE_DBG("pcie_hp_unprobe() failed\n"); return (DDI_FAILURE); } slot_p->hs_condition = AP_COND_UNKNOWN; pcie_hp_delete_occupant_props(dip, makedevice(ddi_driver_major(dip), slot_p->hs_minor)); /* * Remove ports for the unprobed devices. * Note, this is only for the first level children because the * descendants' ports were already removed during bridge driver dettach. */ arg.nexus_dip = dip; arg.connector_num = slot_p->hs_info.cn_num; arg.rv = NDI_SUCCESS; ndi_hp_walk_cn(dip, pcie_hp_unregister_ports_cb, &arg); return (arg.rv == NDI_SUCCESS) ? (DDI_SUCCESS) : (DDI_FAILURE); } /* Read-only probe: no hardware register programming. */ int pcie_read_only_probe(dev_info_t *dip, char *cn_name, dev_info_t **pcdip) { long dev, func; int ret; char *sp; dev_info_t *cdip; *pcdip = NULL; /* * Parse the string of a pci Port name and get the device number * and function number. */ if (ddi_strtol(cn_name + 4, &sp, 10, &dev) != 0) return (DDI_EINVAL); if (ddi_strtol(sp + 1, NULL, 10, &func) != 0) return (DDI_EINVAL); ret = pcicfg_configure(dip, (int)dev, (int)func, PCICFG_FLAG_READ_ONLY); if (ret == PCICFG_SUCCESS) { cdip = pcie_hp_devi_find(dip, (int)dev, (int)func); *pcdip = cdip; } return (ret); } /* Read-only unprobe: no hardware register programming. */ int pcie_read_only_unprobe(dev_info_t *dip, char *cn_name) { long dev, func; int ret; char *sp; /* * Parse the string of a pci Port name and get the device number * and function number. */ if (ddi_strtol(cn_name + 4, &sp, 10, &dev) != 0) return (DDI_EINVAL); if (ddi_strtol(sp + 1, NULL, 10, &func) != 0) return (DDI_EINVAL); ret = pcicfg_unconfigure(dip, (int)dev, (int)func, PCICFG_FLAG_READ_ONLY); return (ret); } /* Control structure used to find a device in the devinfo tree */ struct pcie_hp_find_ctrl { uint_t device; uint_t function; dev_info_t *dip; }; /* * find a devinfo node with specified device and function number * in the device tree under 'dip' */ dev_info_t * pcie_hp_devi_find(dev_info_t *dip, uint_t device, uint_t function) { struct pcie_hp_find_ctrl ctrl; int count; ctrl.device = device; ctrl.function = function; ctrl.dip = NULL; ndi_devi_enter(dip, &count); ddi_walk_devs(ddi_get_child(dip), pcie_hp_match_dev_func, (void *)&ctrl); ndi_devi_exit(dip, count); return (ctrl.dip); } /* * routine to create 'pci-occupant' property for a hotplug slot */ void pcie_hp_create_occupant_props(dev_info_t *dip, dev_t dev, int pci_dev) { pcie_bus_t *bus_p = PCIE_DIP2BUS(dip); pcie_hp_ctrl_t *ctrl_p = (pcie_hp_ctrl_t *)bus_p->bus_hp_ctrl; pcie_hp_slot_t *slotp = NULL; pcie_hp_cn_cfg_t cn_cfg; pcie_hp_occupant_info_t *occupant; int circular, i; ndi_devi_enter(dip, &circular); if (PCIE_IS_PCIE_HOTPLUG_ENABLED(bus_p)) { slotp = (ctrl_p && (pci_dev == 0)) ? ctrl_p->hc_slots[pci_dev] : NULL; } else if (PCIE_IS_PCI_HOTPLUG_ENABLED(bus_p)) { if (ctrl_p) { int slot_num; slot_num = (ctrl_p->hc_device_increases) ? (pci_dev - ctrl_p->hc_device_start) : (pci_dev + ctrl_p->hc_device_start); slotp = ctrl_p->hc_slots[slot_num]; } else { slotp = NULL; } } if (slotp == NULL) return; occupant = kmem_alloc(sizeof (pcie_hp_occupant_info_t), KM_SLEEP); occupant->i = 0; cn_cfg.flag = B_FALSE; cn_cfg.rv = NDI_SUCCESS; cn_cfg.dip = NULL; cn_cfg.slotp = (void *)slotp; cn_cfg.cn_private = (void *)occupant; ddi_walk_devs(ddi_get_child(dip), pcie_hp_list_occupants, (void *)&cn_cfg); if (occupant->i == 0) { /* no occupants right now, need to create stub property */ char *c[] = { "" }; (void) ddi_prop_update_string_array(dev, dip, "pci-occupant", c, 1); } else { (void) ddi_prop_update_string_array(dev, dip, "pci-occupant", occupant->id, occupant->i); } for (i = 0; i < occupant->i; i++) kmem_free(occupant->id[i], sizeof (char[MAXPATHLEN])); kmem_free(occupant, sizeof (pcie_hp_occupant_info_t)); ndi_devi_exit(dip, circular); } /* * routine to remove 'pci-occupant' property for a hotplug slot */ void pcie_hp_delete_occupant_props(dev_info_t *dip, dev_t dev) { (void) ddi_prop_remove(dev, dip, "pci-occupant"); } /* * general code to create a minor node, called from hotplug controller * drivers. */ int pcie_create_minor_node(pcie_hp_ctrl_t *ctrl_p, int slot) { dev_info_t *dip = ctrl_p->hc_dip; pcie_hp_slot_t *slot_p = ctrl_p->hc_slots[slot]; ddi_hp_cn_info_t *info_p = &slot_p->hs_info; if (ddi_create_minor_node(dip, info_p->cn_name, S_IFCHR, slot_p->hs_minor, DDI_NT_PCI_ATTACHMENT_POINT, 0) != DDI_SUCCESS) { return (DDI_FAILURE); } (void) ddi_prop_update_int(DDI_DEV_T_NONE, dip, "ap-names", 1 << slot_p->hs_device_num); return (DDI_SUCCESS); } /* * general code to remove a minor node, called from hotplug controller * drivers. */ void pcie_remove_minor_node(pcie_hp_ctrl_t *ctrl_p, int slot) { ddi_remove_minor_node(ctrl_p->hc_dip, ctrl_p->hc_slots[slot]->hs_info.cn_name); } /* * Local functions (called within this file) */ /* * Register ports for all the children with device number device_num */ static int pcie_hp_register_ports_for_dev(dev_info_t *dip, int device_num) { dev_info_t *cdip; int rv; for (cdip = ddi_get_child(dip); cdip; cdip = ddi_get_next_sibling(cdip)) { if (pcie_hp_match_dev(cdip, device_num)) { /* * Found the newly probed device under the * current slot. Register a port for it. */ if ((rv = pcie_hp_register_port(cdip, dip, NULL)) != DDI_SUCCESS) return (rv); } else { continue; } } return (DDI_SUCCESS); } /* * Unregister ports of a pci bridge dip, get called from ndi_hp_walk_cn() * * If connector_num is specified, then unregister the slot's dependent ports * only; Otherwise, unregister all ports of a pci bridge dip. */ static int pcie_hp_unregister_ports_cb(ddi_hp_cn_info_t *info, void *arg) { pcie_hp_unreg_port_t *unreg_arg = (pcie_hp_unreg_port_t *)arg; dev_info_t *dip = unreg_arg->nexus_dip; int rv = NDI_SUCCESS; if (info->cn_type != DDI_HP_CN_TYPE_VIRTUAL_PORT) { unreg_arg->rv = rv; return (DDI_WALK_CONTINUE); } if (unreg_arg->connector_num != DDI_HP_CN_NUM_NONE) { /* Unregister ports for all unprobed devices under a slot. */ if (unreg_arg->connector_num == info->cn_num_dpd_on) { rv = ndi_hp_unregister(dip, info->cn_name); } } else { /* Unregister all ports of a pci bridge dip. */ rv = ndi_hp_unregister(dip, info->cn_name); } unreg_arg->rv = rv; if (rv == NDI_SUCCESS) return (DDI_WALK_CONTINUE); else return (DDI_WALK_TERMINATE); } /* * Find a port according to cn_name and get the port's state. */ static int pcie_hp_get_port_state(ddi_hp_cn_info_t *info, void *arg) { pcie_hp_port_state_t *port = (pcie_hp_port_state_t *)arg; if (info->cn_type != DDI_HP_CN_TYPE_VIRTUAL_PORT) return (DDI_WALK_CONTINUE); if (strcmp(info->cn_name, port->cn_name) == 0) { /* Matched. */ port->cn_state = info->cn_state; port->rv = DDI_SUCCESS; return (DDI_WALK_TERMINATE); } return (DDI_WALK_CONTINUE); } /* * Find the physical slot with the given device number; * return the slot if found. */ static pcie_hp_slot_t * pcie_find_physical_slot(dev_info_t *dip, int dev_num) { pcie_bus_t *bus_p = PCIE_DIP2BUS(dip); pcie_hp_ctrl_t *ctrl = PCIE_GET_HP_CTRL(dip); if (PCIE_IS_PCIE_HOTPLUG_CAPABLE(bus_p)) { /* PCIe has only one slot */ return (dev_num == 0) ? (ctrl->hc_slots[0]) : (NULL); } else if (PCIE_IS_PCI_HOTPLUG_CAPABLE(bus_p)) { for (int slot = 0; slot < ctrl->hc_num_slots_impl; slot++) { if (ctrl->hc_slots[slot]->hs_device_num == dev_num) { /* found */ return (ctrl->hc_slots[slot]); } } } return (NULL); } /* * setup slot name/slot-number info for the port which is being registered. */ static int pcie_hp_create_port_name_num(dev_info_t *dip, ddi_hp_cn_info_t *cn_info) { int ret, dev_num, func_num, name_len; dev_info_t *pdip = ddi_get_parent(dip); pcie_bus_t *bus_p = PCIE_DIP2BUS(pdip); pcie_hp_slot_t *slot; pcie_req_id_t bdf; char tmp[PCIE_HP_DEV_FUNC_NUM_STRING_LEN]; ret = pcie_get_bdf_from_dip(dip, &bdf); if (ret != DDI_SUCCESS) { return (ret); } if (PCIE_IS_RP(bus_p) || PCIE_IS_SWD(bus_p) || PCIE_IS_PCI2PCIE(bus_p)) { /* * It is under a PCIe device, devcie number is always 0; * function number might > 8 in ARI supported case. */ dev_num = 0; func_num = (bdf & ((~PCI_REG_BUS_M) >> 8)); } else { dev_num = (bdf & (PCI_REG_DEV_M >> 8)) >> 3; func_num = bdf & (PCI_REG_FUNC_M >> 8); } /* * The string length of dev_num and func_num must be no longer than 4 * including the string end mark. (With ARI case considered, e.g., * dev_num=0x0, func_num=0xff.) */ (void) snprintf(tmp, PCIE_HP_DEV_FUNC_NUM_STRING_LEN, "%x%x", dev_num, func_num); /* * Calculate the length of cn_name. * The format of pci port name is: pci.d,f * d stands for dev_num, f stands for func_num. So the length of the * name string can be calculated as following. */ name_len = strlen(tmp) + PCIE_HP_PORT_NAME_STRING_LEN + 1; cn_info->cn_name = (char *)kmem_zalloc(name_len, KM_SLEEP); (void) snprintf(cn_info->cn_name, name_len, "pci.%x,%x", dev_num, func_num); cn_info->cn_num = (dev_num << 8) | func_num; slot = pcie_find_physical_slot(pdip, dev_num); cn_info->cn_num_dpd_on = slot ? slot->hs_info.cn_num : DDI_HP_CN_NUM_NONE; return (DDI_SUCCESS); } /* * Extract device and function number from port name, whose format is * something like 'pci.1,0' */ static int pcie_hp_get_df_from_port_name(char *cn_name, int *dev_num, int *func_num) { int name_len, ret; long d, f; char *sp; /* some checks for the input name */ name_len = strlen(cn_name); if ((name_len <= PCIE_HP_PORT_NAME_STRING_LEN) || (name_len > (PCIE_HP_PORT_NAME_STRING_LEN + PCIE_HP_DEV_FUNC_NUM_STRING_LEN - 1)) || (strncmp("pci.", cn_name, 4) != 0)) { return (DDI_EINVAL); } ret = ddi_strtol(cn_name + 4, &sp, 10, &d); if (ret != DDI_SUCCESS) return (ret); if (strncmp(",", sp, 1) != 0) return (DDI_EINVAL); ret = ddi_strtol(sp + 1, NULL, 10, &f); if (ret != DDI_SUCCESS) return (ret); *dev_num = (int)d; *func_num = (int)f; return (ret); } /* * Check/copy cn_name and set connection numbers. * If it is a valid name, then setup cn_info for the newly created port. */ static int pcie_hp_setup_port_name_num(dev_info_t *pdip, char *cn_name, ddi_hp_cn_info_t *cn_info) { int dev_num, func_num, ret; pcie_hp_slot_t *slot; if ((ret = pcie_hp_get_df_from_port_name(cn_name, &dev_num, &func_num)) != DDI_SUCCESS) return (ret); if (pcie_hp_check_hardware_existence(pdip, dev_num, func_num) == DDI_SUCCESS) { cn_info->cn_state = DDI_HP_CN_STATE_PRESENT; } else { cn_info->cn_state = DDI_HP_CN_STATE_EMPTY; } cn_info->cn_name = ddi_strdup(cn_name, KM_SLEEP); cn_info->cn_num = (dev_num << 8) | func_num; slot = pcie_find_physical_slot(pdip, dev_num); if (slot) { cn_info->cn_num_dpd_on = slot->hs_info.cn_num; } else { cn_info->cn_num_dpd_on = DDI_HP_CN_NUM_NONE; } return (DDI_SUCCESS); } static int ndi2ddi(int n) { int ret; switch (n) { case NDI_SUCCESS: ret = DDI_SUCCESS; break; case NDI_NOMEM: ret = DDI_ENOMEM; break; case NDI_BUSY: ret = DDI_EBUSY; break; case NDI_EINVAL: ret = DDI_EINVAL; break; case NDI_ENOTSUP: ret = DDI_ENOTSUP; break; case NDI_FAILURE: default: ret = DDI_FAILURE; break; } return (ret); } /* * Common routine to create and register a new port * * Create an empty port if dip is NULL, and cn_name needs to be specified in * this case. Otherwise, create a port mapping to the specified dip, and cn_name * is not needed in this case. */ static int pcie_hp_register_port(dev_info_t *dip, dev_info_t *pdip, char *cn_name) { ddi_hp_cn_info_t *cn_info; int ret; ASSERT((dip == NULL) != (cn_name == NULL)); cn_info = kmem_zalloc(sizeof (ddi_hp_cn_info_t), KM_SLEEP); if (dip != NULL) ret = pcie_hp_create_port_name_num(dip, cn_info); else ret = pcie_hp_setup_port_name_num(pdip, cn_name, cn_info); if (ret != DDI_SUCCESS) { kmem_free(cn_info, sizeof (ddi_hp_cn_info_t)); return (ret); } cn_info->cn_child = dip; cn_info->cn_type = DDI_HP_CN_TYPE_VIRTUAL_PORT; cn_info->cn_type_str = DDI_HP_CN_TYPE_STR_PORT; ret = ndi_hp_register(pdip, cn_info); kmem_free(cn_info->cn_name, strlen(cn_info->cn_name) + 1); kmem_free(cn_info, sizeof (ddi_hp_cn_info_t)); return (ndi2ddi(ret)); } /* Check if there is a piece of hardware exist corresponding to the cn_name */ static int pcie_hp_check_hardware_existence(dev_info_t *dip, int dev_num, int func_num) { /* * VHPTODO: * According to device and function number, check if there is a hardware * device exists. Currently, this function can not be reached before * we enable state transition to or from "Port-Empty" or "Port-Present" * states. When the pci device type project is integrated, we are going * to call the pci config space access interfaces introduced by it. */ _NOTE(ARGUNUSED(dip, dev_num, func_num)); return (DDI_SUCCESS); } /* * Dispatch hotplug commands to different hotplug controller drivers, including * physical and virtual hotplug operations. */ /* ARGSUSED */ int pcie_hp_common_ops(dev_info_t *dip, char *cn_name, ddi_hp_op_t op, void *arg, void *result) { pcie_bus_t *bus_p = PCIE_DIP2BUS(dip); int ret = DDI_SUCCESS; PCIE_DBG("pcie_hp_common_ops: dip=%p cn_name=%s op=%x arg=%p\n", dip, cn_name, op, arg); switch (op) { case DDI_HPOP_CN_CREATE_PORT: { /* create an empty port */ return (pcie_hp_register_port(NULL, dip, cn_name)); } case DDI_HPOP_CN_CHANGE_STATE: { ddi_hp_cn_state_t curr_state; ddi_hp_cn_state_t target_state = *(ddi_hp_cn_state_t *)arg; pcie_hp_port_state_t state_arg; if (target_state < DDI_HP_CN_STATE_PORT_EMPTY) { /* this is for physical slot state change */ break; } PCIE_DBG("pcie_hp_common_ops: change port state" " dip=%p cn_name=%s" " op=%x arg=%p\n", (void *)dip, cn_name, op, arg); state_arg.rv = DDI_FAILURE; state_arg.cn_name = cn_name; ndi_hp_walk_cn(dip, pcie_hp_get_port_state, &state_arg); if (state_arg.rv != DDI_SUCCESS) { /* can not find the port */ return (DDI_EINVAL); } curr_state = state_arg.cn_state; /* * Check if this is for changing port's state: change to/from * PORT_EMPTY/PRESENT states. */ if (curr_state < target_state) { /* Upgrade state */ switch (curr_state) { case DDI_HP_CN_STATE_PORT_EMPTY: if (target_state == DDI_HP_CN_STATE_PORT_PRESENT) { int dev_num, func_num; ret = pcie_hp_get_df_from_port_name( cn_name, &dev_num, &func_num); if (ret != DDI_SUCCESS) goto port_state_done; ret = pcie_hp_check_hardware_existence( dip, dev_num, func_num); } else if (target_state == DDI_HP_CN_STATE_OFFLINE) { ret = pcie_read_only_probe(dip, cn_name, (dev_info_t **)result); } else ret = DDI_EINVAL; goto port_state_done; case DDI_HP_CN_STATE_PORT_PRESENT: if (target_state == DDI_HP_CN_STATE_OFFLINE) ret = pcie_read_only_probe(dip, cn_name, (dev_info_t **)result); else ret = DDI_EINVAL; goto port_state_done; default: ASSERT("unexpected state"); } } else { /* Downgrade state */ switch (curr_state) { case DDI_HP_CN_STATE_PORT_PRESENT: { int dev_num, func_num; ret = pcie_hp_get_df_from_port_name(cn_name, &dev_num, &func_num); if (ret != DDI_SUCCESS) goto port_state_done; ret = pcie_hp_check_hardware_existence(dip, dev_num, func_num); goto port_state_done; } case DDI_HP_CN_STATE_OFFLINE: ret = pcie_read_only_unprobe(dip, cn_name); goto port_state_done; default: ASSERT("unexpected state"); } } port_state_done: *(ddi_hp_cn_state_t *)result = curr_state; return (ret); } default: break; } if (PCIE_IS_PCIE_HOTPLUG_CAPABLE(bus_p)) { /* PCIe hotplug */ ret = pciehpc_hp_ops(dip, cn_name, op, arg, result); } else if (PCIE_IS_PCI_HOTPLUG_CAPABLE(bus_p)) { /* PCI SHPC hotplug */ ret = pcishpc_hp_ops(dip, cn_name, op, arg, result); } else { cmn_err(CE_WARN, "pcie_hp_common_ops: op is not supported." " dip=%p cn_name=%s" " op=%x arg=%p\n", (void *)dip, cn_name, op, arg); ret = DDI_ENOTSUP; } #if defined(__i386) || defined(__amd64) /* * like in attach, since hotplugging can change error registers, * we need to ensure that the proper bits are set on this port * after a configure operation */ if ((ret == DDI_SUCCESS) && (op == DDI_HPOP_CN_CHANGE_STATE) && (*(ddi_hp_cn_state_t *)arg == DDI_HP_CN_STATE_ENABLED)) pcieb_intel_error_workaround(dip); #endif return (ret); } /* * pcie_hp_match_dev_func: * Match dip's PCI device number and function number with input ones. */ static int pcie_hp_match_dev_func(dev_info_t *dip, void *hdl) { struct pcie_hp_find_ctrl *ctrl = (struct pcie_hp_find_ctrl *)hdl; pci_regspec_t *pci_rp; int length; int pci_dev, pci_func; if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, "reg", (int **)&pci_rp, (uint_t *)&length) != DDI_PROP_SUCCESS) { ctrl->dip = NULL; return (DDI_WALK_TERMINATE); } /* get the PCI device address info */ pci_dev = PCI_REG_DEV_G(pci_rp->pci_phys_hi); pci_func = PCI_REG_FUNC_G(pci_rp->pci_phys_hi); /* * free the memory allocated by ddi_prop_lookup_int_array */ ddi_prop_free(pci_rp); if ((pci_dev == ctrl->device) && (pci_func == ctrl->function)) { /* found the match for the specified device address */ ctrl->dip = dip; return (DDI_WALK_TERMINATE); } /* * continue the walk to the next sibling to look for a match. */ return (DDI_WALK_PRUNECHILD); } /* * pcie_hp_match_dev: * Match the dip's pci device number with the input dev_num */ static boolean_t pcie_hp_match_dev(dev_info_t *dip, int dev_num) { pci_regspec_t *pci_rp; int length; int pci_dev; if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, "reg", (int **)&pci_rp, (uint_t *)&length) != DDI_PROP_SUCCESS) { return (B_FALSE); } /* get the PCI device address info */ pci_dev = PCI_REG_DEV_G(pci_rp->pci_phys_hi); /* * free the memory allocated by ddi_prop_lookup_int_array */ ddi_prop_free(pci_rp); if (pci_dev == dev_num) { /* found the match for the specified device address */ return (B_TRUE); } return (B_FALSE); } /* * Callback function to match with device number in order to list * occupants under a specific slot */ static int pcie_hp_list_occupants(dev_info_t *dip, void *arg) { pcie_hp_cn_cfg_t *cn_cfg_p = (pcie_hp_cn_cfg_t *)arg; pcie_hp_occupant_info_t *occupant = (pcie_hp_occupant_info_t *)cn_cfg_p->cn_private; pcie_hp_slot_t *slot_p = (pcie_hp_slot_t *)cn_cfg_p->slotp; int pci_dev; pci_regspec_t *pci_rp; int length; major_t major; /* * Get the PCI device number information from the devinfo * node. Since the node may not have the address field * setup (this is done in the DDI_INITCHILD of the parent) * we look up the 'reg' property to decode that information. */ if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS, "reg", (int **)&pci_rp, (uint_t *)&length) != DDI_PROP_SUCCESS) { cn_cfg_p->rv = DDI_FAILURE; cn_cfg_p->dip = dip; return (DDI_WALK_TERMINATE); } /* get the pci device id information */ pci_dev = PCI_REG_DEV_G(pci_rp->pci_phys_hi); /* * free the memory allocated by ddi_prop_lookup_int_array */ ddi_prop_free(pci_rp); /* * Match the node for the device number of the slot. */ if (pci_dev == slot_p->hs_device_num) { major = ddi_driver_major(dip); /* * If the node is not yet attached, then don't list it * as an occupant. This is valid, since nothing can be * consuming it until it is attached, and cfgadm will * ask for the property explicitly which will cause it * to be re-freshed right before checking with rcm. */ if ((major == DDI_MAJOR_T_NONE) || !i_ddi_devi_attached(dip)) return (DDI_WALK_PRUNECHILD); /* * If we have used all our occupants then print mesage * and terminate walk. */ if (occupant->i >= PCIE_HP_MAX_OCCUPANTS) { cmn_err(CE_WARN, "pcie (%s%d): unable to list all occupants", ddi_driver_name(ddi_get_parent(dip)), ddi_get_instance(ddi_get_parent(dip))); return (DDI_WALK_TERMINATE); } /* * No need to hold the dip as ddi_walk_devs * has already arranged that for us. */ occupant->id[occupant->i] = kmem_alloc(sizeof (char[MAXPATHLEN]), KM_SLEEP); (void) ddi_pathname(dip, (char *)occupant->id[occupant->i]); occupant->i++; } /* * continue the walk to the next sibling to look for a match * or to find other nodes if this card is a multi-function card. */ return (DDI_WALK_PRUNECHILD); } /* * Generate the System Event for ESC_DR_REQ. * One of the consumers is pcidr, it calls to libcfgadm to perform a * configure or unconfigure operation to the AP. */ void pcie_hp_gen_sysevent_req(char *slot_name, int hint, dev_info_t *self, int kmflag) { sysevent_id_t eid; nvlist_t *ev_attr_list = NULL; char cn_path[MAXPATHLEN]; char *ap_id; int err, ap_id_len; /* * Minor device name (AP) will be bus path * concatenated with slot name */ (void) strcpy(cn_path, "/devices"); (void) ddi_pathname(self, cn_path + strlen("/devices")); ap_id_len = strlen(cn_path) + strlen(":") + strlen(slot_name) + 1; ap_id = kmem_zalloc(ap_id_len, kmflag); if (ap_id == NULL) { cmn_err(CE_WARN, "%s%d: Failed to allocate memory for AP ID: %s:%s", ddi_driver_name(self), ddi_get_instance(self), cn_path, slot_name); return; } (void) strcpy(ap_id, cn_path); (void) strcat(ap_id, ":"); (void) strcat(ap_id, slot_name); err = nvlist_alloc(&ev_attr_list, NV_UNIQUE_NAME_TYPE, kmflag); if (err != 0) { cmn_err(CE_WARN, "%s%d: Failed to allocate memory " "for event attributes%s", ddi_driver_name(self), ddi_get_instance(self), ESC_DR_REQ); kmem_free(ap_id, ap_id_len); return; } switch (hint) { case SE_INVESTIGATE_RES: /* fall through */ case SE_INCOMING_RES: /* fall through */ case SE_OUTGOING_RES: /* fall through */ err = nvlist_add_string(ev_attr_list, DR_REQ_TYPE, SE_REQ2STR(hint)); if (err != 0) { cmn_err(CE_WARN, "%s%d: Failed to add attr [%s] " "for %s event", ddi_driver_name(self), ddi_get_instance(self), DR_REQ_TYPE, ESC_DR_REQ); goto done; } break; default: cmn_err(CE_WARN, "%s%d: Unknown hint on sysevent", ddi_driver_name(self), ddi_get_instance(self)); goto done; } /* * Add attachment point as attribute (common attribute) */ err = nvlist_add_string(ev_attr_list, DR_AP_ID, ap_id); if (err != 0) { cmn_err(CE_WARN, "%s%d: Failed to add attr [%s] for %s event", ddi_driver_name(self), ddi_get_instance(self), DR_AP_ID, EC_DR); goto done; } /* * Log this event with sysevent framework. */ err = ddi_log_sysevent(self, DDI_VENDOR_SUNW, EC_DR, ESC_DR_REQ, ev_attr_list, &eid, ((kmflag == KM_SLEEP) ? DDI_SLEEP : DDI_NOSLEEP)); if (err != 0) { cmn_err(CE_WARN, "%s%d: Failed to log %s event", ddi_driver_name(self), ddi_get_instance(self), EC_DR); } done: nvlist_free(ev_attr_list); kmem_free(ap_id, ap_id_len); }
25.356375
80
0.699915
8ae14ab03127d8fb100cd5065fad1530a44f118d
7,711
c
C
sources/nb/container_bot/stack/stack_dst.c
vecn/nbots
bda4f5a2c607c8e6d26567bb0865ccbb953418ac
[ "MIT" ]
7
2016-02-09T17:53:25.000Z
2019-09-19T02:02:14.000Z
sources/nb/container_bot/stack/stack_dst.c
vecn/nbots
bda4f5a2c607c8e6d26567bb0865ccbb953418ac
[ "MIT" ]
1
2017-06-22T06:20:24.000Z
2017-06-22T06:20:24.000Z
sources/nb/container_bot/stack/stack_dst.c
vecn/nbots
bda4f5a2c607c8e6d26567bb0865ccbb953418ac
[ "MIT" ]
2
2018-02-08T12:09:50.000Z
2019-09-19T02:02:23.000Z
/****************************************************************************** * List DST: Circular Linked List * ******************************************************************************/ #include <stdlib.h> #include <string.h> #include "nb/memory_bot.h" #include "stack_node.h" #include "stack_struct.h" #include "stack_dst.h" static bool is_not_empty(const nb_stack_t *const list); static stack_node_t* get_first(const nb_stack_t *const list); static void* allocate_stack(void); static void destroy_values(nb_stack_t *stack, void (*destroy)(void*)); static void insert_stack_node_as_starting(nb_stack_t *list, const void *const val); static void add_node(nb_stack_t *list, stack_node_t *node); static void add_first_node(nb_stack_t *list, stack_node_t *node); static void link_node(nb_stack_t *stack, stack_node_t *node); static stack_node_t* exist_node(const nb_stack_t *const stack, const void *val, int8_t (*compare)(const void*, const void*)); static void unlink_node(nb_stack_t *stack, const stack_node_t *const node); uint16_t stack_get_memsize(void) { return sizeof(nb_stack_t) + nb_membank_get_memsize(); } void stack_init(void *stack_ptr) { char *memblock = stack_ptr; nb_stack_t *stack = (void*) memblock; memset(stack_ptr, 0, stack_get_memsize()); stack->length = 0; stack->end = NULL; stack->membank = (void*) (memblock + sizeof(nb_stack_t)); nb_membank_init(stack->membank, stack_node_get_memsize()); } void stack_copy(void *stack_ptr, const void *src_stack_ptr, void* (*clone)(const void*)) { nb_stack_t *stack = stack_ptr; const nb_stack_t *src_stack = src_stack_ptr; stack_init(stack); stack->length = src_stack->length; if (is_not_empty(src_stack)) { stack_node_t *end = stack_node_clone(stack->membank, src_stack->end, clone); stack->end = end; stack_node_t *iter = get_first(src_stack); do { stack_node_t *node = stack_node_clone(stack->membank, iter, clone); end->next = node; end = node; iter = iter->next; } while (iter != src_stack->end); end->next = stack->end; } else { stack->end = NULL; } } static inline bool is_not_empty(const nb_stack_t *const restrict stack) { return (stack->end != NULL); } static inline stack_node_t* get_first(const nb_stack_t *const restrict stack) { return stack->end->next; } void stack_finish(void *stack_ptr, void (*destroy)(void*)) { nb_stack_t *stack = stack_ptr; destroy_values(stack, destroy); nb_membank_finish(stack->membank); } void* stack_create(void) { void *stack = allocate_stack(); stack_init(stack); return stack; } static inline void* allocate_stack(void) { uint16_t size = stack_get_memsize(); return nb_allocate_mem(size); } void* stack_clone(const void *const stack_ptr, void* (*clone)(const void*)) { void *stack = allocate_stack(); stack_copy(stack, stack_ptr, clone); return stack; } void stack_destroy(void *stack_ptr, void (*destroy)(void*)) { stack_finish(stack_ptr, destroy); nb_free_mem(stack_ptr); } void stack_clear(void *stack_ptr, void (*destroy)(void*)) { nb_stack_t *stack = stack_ptr; destroy_values(stack, destroy); nb_membank_clear(stack->membank); stack->length = 0; stack->end = NULL; } static void destroy_values(nb_stack_t *stack, void (*destroy)(void*)) { if (NULL != destroy) { if (is_not_empty(stack)) { stack_node_t* iter = get_first(stack); stack->end->next = NULL; while (NULL != iter) { destroy(iter->val); iter = iter->next; } } } } void stack_merge(void *stack1_ptr, void *stack2_ptr, uint32_t (*key)(const void*), int8_t (*compare)(const void*, const void*)) { nb_stack_t *stack1 = stack1_ptr; nb_stack_t *stack2 = stack2_ptr; if (is_not_empty(stack2)) { stack1->length += stack2->length; if (is_not_empty(stack1)) { stack_node_t *first_node = get_first(stack1); stack1->end->next = get_first(stack2); stack2->end->next = first_node; } stack1->end = stack2->end; stack2->length = 0; stack2->end = NULL; nb_membank_merge(stack1->membank, stack2->membank); } } bool stack_insert(void *stack_ptr, const void *val, uint32_t (*key)(const void*), int8_t (*compare)(const void*, const void*)) { nb_stack_t *stack = stack_ptr; insert_stack_node_as_starting(stack, val); return true; } static inline void insert_stack_node_as_starting(nb_stack_t * stack, const void *const val) { stack_node_t *const restrict node = stack_node_create(stack->membank); node->val = (void*) val; add_node(stack, node); stack->length += 1; } static inline void add_node(nb_stack_t *restrict stack, stack_node_t *restrict node) { if (stack_is_empty(stack)) add_first_node(stack, node); else link_node(stack, node); } static inline void add_first_node(nb_stack_t *restrict stack, stack_node_t *restrict node) { stack->end = node; node->next = node; } static inline void link_node(nb_stack_t *restrict stack, stack_node_t *restrict node) { node->next = get_first(stack); stack->end->next = node; } void* stack_get_first(const void *const stack_ptr) { const nb_stack_t *const stack = stack_ptr; void *val = NULL; if (is_not_empty(stack)) { stack_node_t *first = get_first(stack); val = first->val; } return val; } void* stack_delete_first(void *stack_ptr, uint32_t (*key)(const void*)) { nb_stack_t *stack = stack_ptr; void *val = NULL; if (is_not_empty(stack)) { stack_node_t *first = get_first(stack); val = first->val; if (stack->end != first) stack->end->next = first->next; else stack->end = NULL; stack_node_destroy(stack->membank, first); stack->length -= 1; } return val; } void* stack_exist(const void *const stack_ptr, const void *val, uint32_t (*key)(const void*), int8_t (*compare)(const void*, const void*)) { const nb_stack_t *const stack = stack_ptr; void *existing_val = NULL; if (is_not_empty(stack)) { stack_node_t *node = exist_node(stack, val, compare); if (NULL != node) existing_val = node->val; } return existing_val; } static stack_node_t* exist_node(const nb_stack_t *const stack, const void *val, int8_t (*compare)(const void*, const void*)) { stack_node_t *first = get_first(stack); stack_node_t *existing_node = NULL; if (0 == compare(first->val, val)) { existing_node = first; } else { stack_node_t *iter = first->next; while (iter != first) { if (0 == compare(iter->val, val)) { existing_node = iter; break; } iter = iter->next; } } return existing_node; } void* stack_delete(void *stack_ptr, const void *val, uint32_t (*key)(const void*), int8_t (*compare)(const void*, const void*)) { nb_stack_t *stack = stack_ptr; void *deleted_val = NULL; if (is_not_empty(stack)) { stack_node_t *node = exist_node(stack, val, compare); if (NULL != node) { unlink_node(stack, node); deleted_val = node->val; stack_node_destroy(stack->membank, node); stack->length -= 1; } } return deleted_val; } static void unlink_node(nb_stack_t *stack, const stack_node_t *const node) { stack_node_t *prev = stack_node_get_prev(node); if (node == prev /* implies node is equal to stack->end */) stack->end = NULL; else if (node == stack->end /* implies node is different to prev */) stack->end = prev; prev->next = node->next; } inline uint32_t stack_get_length(const void *const stack_ptr) { const nb_stack_t *const stack = stack_ptr; return stack->length; } inline bool stack_is_empty(const void *const stack_ptr) { const nb_stack_t *const stack = stack_ptr; return (NULL == stack->end); } inline bool stack_is_not_empty(const void *const stack_ptr) { return is_not_empty(stack_ptr); }
24.954693
80
0.682142
8ae5f9a989d0b9292b2cac910bc00d5051a35b8e
124
h
C
src/DataTypes/Marker.h
AlexeyMerzlyakov/lpslam
e473de4f53c49d2fc3cc123758d0ac987afdabbd
[ "Apache-2.0" ]
4
2021-05-27T21:42:46.000Z
2022-03-07T04:47:13.000Z
src/DataTypes/Marker.h
AlexeyMerzlyakov/lpslam
e473de4f53c49d2fc3cc123758d0ac987afdabbd
[ "Apache-2.0" ]
1
2021-11-17T08:42:43.000Z
2021-12-07T03:11:11.000Z
src/DataTypes/Marker.h
AlexeyMerzlyakov/lpslam
e473de4f53c49d2fc3cc123758d0ac987afdabbd
[ "Apache-2.0" ]
2
2021-09-05T11:02:12.000Z
2021-11-16T01:17:23.000Z
#pragma once #include <cstddef> namespace LpSlam { // can be the result of std::hash using MarkerId = std::size_t; }
15.5
37
0.677419
8ae6ff673683b0fecfc445fd192c67d743567f45
461
h
C
Leetcode_practise/Q24.h
dogefun/Leetcode_practise
41ddf5274ae887a212d1c35977e9cd3ce3142f3d
[ "Apache-2.0" ]
null
null
null
Leetcode_practise/Q24.h
dogefun/Leetcode_practise
41ddf5274ae887a212d1c35977e9cd3ce3142f3d
[ "Apache-2.0" ]
null
null
null
Leetcode_practise/Q24.h
dogefun/Leetcode_practise
41ddf5274ae887a212d1c35977e9cd3ce3142f3d
[ "Apache-2.0" ]
null
null
null
#include "stl.h" struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; class Solution { public: ListNode* swapPairs(ListNode* head) { ListNode *res = new ListNode(1); res->next = head; ListNode *p = res; while (head != NULL && head->next != NULL) { ListNode *tmp = head->next; head->next = tmp->next; tmp->next = head; p->next = tmp; head = head->next; p = tmp->next; } return res->next; } };
18.44
46
0.590022
8ae89e22a95bbd0b845bf5d691e53226dda26a32
2,667
h
C
runtime/windows/include/omniORB4/internal/shutdownIdentity.h
t-b/igorpro-binding
9b9d3568d37bc0db5a107d019854e529e19008df
[ "BSD-3-Clause" ]
null
null
null
runtime/windows/include/omniORB4/internal/shutdownIdentity.h
t-b/igorpro-binding
9b9d3568d37bc0db5a107d019854e529e19008df
[ "BSD-3-Clause" ]
null
null
null
runtime/windows/include/omniORB4/internal/shutdownIdentity.h
t-b/igorpro-binding
9b9d3568d37bc0db5a107d019854e529e19008df
[ "BSD-3-Clause" ]
null
null
null
// -*- Mode: C++; -*- // Package : omniORB // shutdownIdentity.h Created on: 2001/09/17 // Author : Duncan Grisby (dpg1) // // Copyright (C) 2007 Apasphere Ltd // Copyright (C) 2001 AT&T Research Cambridge // // This file is part of the omniORB library. // // The omniORB library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library 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 // Library General Public License for more details. // // You should have received a copy of the GNU Library 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 // // // Description: // Dummy singleton identity placed into object references when the // ORB is shutting down. // #ifndef __OMNIORB_SHUTDOWNIDENTITY_H__ #define __OMNIORB_SHUTDOWNIDENTITY_H__ #include <omniIdentity.h> #ifdef _core_attr # error "A local CPP macro _core_attr has already been defined." #endif #if defined(_OMNIORB_LIBRARY) # define _core_attr #else # define _core_attr _OMNIORB_NTDLL_IMPORT #endif class omniShutdownIdentity : public omniIdentity { public: ~omniShutdownIdentity() { } virtual void dispatch(omniCallDescriptor&); // Always throws BAD_INV_ORDER. virtual void gainRef(omniObjRef* obj = 0); virtual void loseRef(omniObjRef* obj = 0); virtual omniIdentity::equivalent_fn get_real_is_equivalent() const; // Override omniIdentity. virtual void locateRequest(omniCallDescriptor&); // Always indicates that the object is here. virtual _CORBA_Boolean inThisAddressSpace(); // Returns false. virtual void* ptrToClass(int* cptr); static inline omniShutdownIdentity* downcast(omniIdentity* i) { return (omniShutdownIdentity*)i->ptrToClass(&_classid); } static _core_attr int _classid; // Dynamic casting mechanism. static omniShutdownIdentity* singleton(); // Must hold <omni::internalLock>. private: int pd_refCount; static _CORBA_Boolean real_is_equivalent(const omniIdentity*, const omniIdentity*); inline omniShutdownIdentity() : omniIdentity(), pd_refCount(0) {} }; #undef _core_attr #endif // __OMNIORB_SHUTDOWNIDENTITY_H__
28.677419
74
0.710161
8ae9611bbb7030175d130ac802c4c6003639d9ff
663
h
C
macOS/10.13/AppKit.framework/NSAccessibilityMockStatusBarItem.h
onmyway133/Runtime-Headers
e9b80e7ab9103f37ad421ad6b8b58ee06369d21f
[ "MIT" ]
30
2016-10-09T20:13:00.000Z
2022-01-24T04:14:57.000Z
macOS/10.12/AppKit.framework/NSAccessibilityMockStatusBarItem.h
onmyway133/Runtime-Headers
e9b80e7ab9103f37ad421ad6b8b58ee06369d21f
[ "MIT" ]
null
null
null
macOS/10.12/AppKit.framework/NSAccessibilityMockStatusBarItem.h
onmyway133/Runtime-Headers
e9b80e7ab9103f37ad421ad6b8b58ee06369d21f
[ "MIT" ]
7
2017-08-29T14:41:25.000Z
2022-01-19T17:14:54.000Z
/* Generated by RuntimeBrowser Image: /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit */ @interface NSAccessibilityMockStatusBarItem : NSAccessibilityMockUIElement { NSStatusItem * _statusItem; } @property (nonatomic, readwrite) NSStatusItem *statusItem; - (id)_accessibilitySourceCell; - (id)_accessibilitySourceView; - (id)accessibilityActionDescription:(id)arg1; - (id)accessibilityActionNames; - (id)accessibilityAttributeNames; - (id)accessibilityAttributeValue:(id)arg1; - (BOOL)accessibilityIsIgnored; - (void)accessibilityPerformAction:(id)arg1; - (unsigned long long)hash; - (void)setStatusItem:(id)arg1; - (id)statusItem; @end
27.625
76
0.788839
8aea4ad1bf35252ec8855ca1809c17db3bdc783e
11,670
c
C
addons/SecureSocket/source/IoSecureServer.c
achoy/io
788119a91041d10d98c910d61280b666fd77f8c1
[ "BSD-3-Clause" ]
2
2015-12-24T09:53:28.000Z
2016-05-08T21:17:31.000Z
addons/SecureSocket/source/IoSecureServer.c
mistydemeo/io
ebc0c53a89fe720c6cf77f2ef7a72767d799c057
[ "BSD-3-Clause" ]
null
null
null
addons/SecureSocket/source/IoSecureServer.c
mistydemeo/io
ebc0c53a89fe720c6cf77f2ef7a72767d799c057
[ "BSD-3-Clause" ]
null
null
null
//metadoc SecureServer copyright Joe Osborn, 2007 //metadoc SecureServer license BSD revised //metadoc SecureServer category Networking //metadoc SecureServer dependsOn Server /*metadoc SecureServer description Interface to secure network communication. A SecureServer is a wrapper on an OpenSSL SSL_CTX object and supports both TLSv1 and DTLSv1. Example: <pre> //... </pre> */ #include "IoSecureServer.h" #include "IoMessage.h" #include "common.h" #include "IPAddress.h" #include "IoSocket.h" #include "IoNumber.h" IoSecureServer *IoMessage_locals_secureServerArgAt_(IoMessage *self, IoObject *locals, int n) { IoObject *v = IoMessage_locals_valueArgAt_(self, locals, n); if (!ISSECURESERVER(v)) { IoMessage_locals_numberArgAt_errorForType_(self, locals, n, "SecureServer"); } return v; } typedef struct { SSL_CTX *ssl_ctx; } SecureServerData; #define DATA(self) ((SecureServerData *)IoObject_dataPointer(self)) #define OCTX(self) (DATA(self)->ssl_ctx) IoTag *IoSecureServer_newTag(void *state) { IoTag *tag = IoTag_newWithName_("SecureServer"); IoTag_state_(tag, state); IoTag_freeFunc_(tag, (IoTagFreeFunc *)IoSecureServer_free); IoTag_cloneFunc_(tag, (IoTagCloneFunc *)IoSecureServer_rawClone); return tag; } IoSecureServer *IoSecureServer_proto(void *state) { initSSL(); IoObject *self = IoObject_new(state); IoObject_tag_(self, IoSecureServer_newTag(state)); IoObject_setDataPointer_(self, (SecureServerData *)calloc(1, sizeof(SecureServerData))); SSL_CTX *ctx = SSL_CTX_new(TLSv1_server_method()); DATA(self)->ssl_ctx = ctx; SSL_CTX_set_default_passwd_cb(ctx, IoSecureSockets_Password_Callback); SSL_CTX_set_default_passwd_cb_userdata(ctx, self); SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, IoSecureSockets_Verify_Callback); #ifdef DTLS_IMPLEMENTED IoObject_setSlot_to_(self, IOSYMBOL("supportsDTLS"), IOTRUE(self)); #else IoObject_setSlot_to_(self, IOSYMBOL("supportsDTLS"), IOFALSE(self)); #endif //doc SecureServer supportsDTLS Returns true if server supports DTLS, false otherwise. IoState_registerProtoWithFunc_((IoState *)state, self, IoSecureServer_proto); { IoMethodTable methodTable[] = { {"setKeyFile", IoSecureServer_setKeyFile}, //doc SecureServer setKeyFile(path) Sets the key file. Returns self. {"setCertFile", IoSecureServer_setCertFile}, //doc SecureServer setCertFile(path) Sets the certificate file. Returns self. {"setCAFile", IoSecureServer_setCAFile}, //doc SecureServer setCAFile(path) Sets the CA file. Returns self. {"setCRLFile", IoSecureServer_setCRLFile}, //doc SecureServer setCRLFile(path) Sets the CRL file. Returns self. {"useTLS", IoSecureServer_useTLS}, //doc SecureServer useTLS Returns useTLS value. {"useDTLS", IoSecureServer_useDTLS}, //doc SecureServer useDTLS Returns useDTLS value. {"setRequiresClientCertificate", IoSecureServer_setRequiresClientCertificate}, //doc SecureServer setRequiresClientCertificate(aBool) Sets the requires client certificate attribute. Returns self. {"tlsWrap", IoSecureServer_tlsWrap}, //doc SecureServer tlsWrap Returns tlsWrap value. #ifdef DTLS_IMPLEMENTED {"dtlsWrap", IoSecureServer_dtlsWrap}, //doc SecureServer dtlsWrap Returns dtlsWrap value. {"udpRecvIP", IoSecureServer_udpRecvIP}, //doc SecureServer udpRecvIP Returns udpRecvIP value. {"dispatchUdp", IoSecureServer_dispatchUDP}, //doc SecureServer dispatchUdp Returns dispatchUdp value. #endif {NULL, NULL} }; IoObject_addMethodTable_(self, methodTable); } return self; } IoSecureServer *IoSecureServer_rawClone(IoSecureServer *proto) { IoObject *self = IoObject_rawClonePrimitive(proto); IoObject_setDataPointer_(self, (SecureServerData *)calloc(1, sizeof(SecureServerData))); SSL_CTX *ctx = SSL_CTX_new(TLSv1_server_method()); DATA(self)->ssl_ctx = ctx; SSL_CTX_set_default_passwd_cb(ctx, IoSecureSockets_Password_Callback); SSL_CTX_set_default_passwd_cb_userdata(ctx, self); SSL_CTX_set_verify(ctx, SSL_CTX_get_verify_mode(OCTX(proto)), SSL_CTX_get_verify_callback(OCTX(proto))); //need to do more work for the copy to be correct, also need to copy SSL method and certs. return self; } void IoSecureServer_free(IoSecureServer *self) { SSL_CTX_free(OCTX(self)); free(DATA(self)); } IoSecureServer *IoSecureServer_setKeyFile(IoSecureServer *self, IoObject *locals, IoMessage *msg) { SSL_CTX *ctx = OCTX(self); IoSeq *pathSeq = IoMessage_locals_seqArgAt_(msg, locals, 0); char *path = IoSeq_asCString(pathSeq); if(ctx == NULL) { IoState_error_(IOSTATE, msg, "SecureServer has no SSL_CTX"); return IONIL(self); } if(SSL_CTX_use_PrivateKey_file(ctx, path, SSL_FILETYPE_PEM) != 1) { ERR_print_errors_fp(stderr); IoState_error_(IOSTATE, msg, "Error loading private key from file %s\n", path); return IONIL(self); } return self; } IoSecureServer *IoSecureServer_setCertFile(IoSecureServer *self, IoObject *locals, IoMessage *msg) { SSL_CTX *ctx = OCTX(self); IoSeq *pathSeq = IoMessage_locals_seqArgAt_(msg, locals, 0); char *path = IoSeq_asCString(pathSeq); if(ctx == NULL) { IoState_error_(IOSTATE, msg, "SecureServer has no SSL_CTX"); return IONIL(self); } if(SSL_CTX_use_certificate_chain_file(ctx, path) != 1) { ERR_print_errors_fp(stderr); IoState_error_(IOSTATE, msg, "Error loading certificate from file %s\n", path); return IONIL(self); } return self; } IoSecureServer *IoSecureServer_setCAFile(IoSecureServer *self, IoObject *locals, IoMessage *msg) { SSL_CTX *ctx = OCTX(self); IoSeq *pathSeq = IoMessage_locals_seqArgAt_(msg, locals, 0); char *path = IoSeq_asCString(pathSeq); if(ctx == NULL) { IoState_error_(IOSTATE, msg, "SecureServer has no SSL_CTX"); return IONIL(self); } if(SSL_CTX_load_verify_locations(ctx, path, NULL) != 1) { ERR_print_errors_fp(stderr); IoState_error_(IOSTATE, msg, "Error loading CA certificate from file %s\n", path); return IONIL(self); } return self; } IoSecureServer *IoSecureServer_setCRLFile(IoSecureServer *self, IoObject *locals, IoMessage *msg) { SSL_CTX *ctx = OCTX(self); IoSeq *pathSeq = IoMessage_locals_seqArgAt_(msg, locals, 0); char *path = IoSeq_asCString(pathSeq); if(ctx == NULL) { IoState_error_(IOSTATE, msg, "SecureServer has no SSL_CTX"); return IONIL(self); } X509_STORE *store = SSL_CTX_get_cert_store(ctx); X509_STORE_set_verify_cb_func(store, IoSecureSockets_Verify_CRL_Callback); X509_STORE_set_flags (store, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL); X509_LOOKUP *lookup; if (!(lookup = X509_STORE_add_lookup (store, X509_LOOKUP_file ()))) { ERR_print_errors_fp(stderr); IoState_error_(IOSTATE, msg, "Error creating X509_LOOKUP object."); return IONIL(self); } if (X509_load_crl_file(lookup, path, X509_FILETYPE_PEM) != 1) { ERR_print_errors_fp(stderr); IoState_error_(IOSTATE, msg, "Error loading CRL from file %s\n", path); return IONIL(self); } return self; } IoSecureServer *IoSecureServer_setRequiresClientCertificate(IoSecureServer *self, IoObject *locals, IoMessage *msg) { SSL_CTX *ctx = OCTX(self); if(IoMessage_locals_valueArgAt_(msg, locals, 0) == IOTRUE(self)) { SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, IoSecureSockets_Verify_Callback); } else { SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, IoSecureSockets_Verify_Callback); } return self; } IoSecureServer *IoSecureServer_useTLS(IoSecureServer *self, IoObject *locals, IoMessage *msg) { SSL_CTX *ctx = OCTX(self); if(SSL_CTX_set_ssl_version(ctx, TLSv1_server_method()) != 1) { ERR_print_errors_fp(stderr); IoState_error_(IOSTATE, msg, "Error using TLS"); return IONIL(self); } return self; } IoSecureServer *IoSecureServer_useDTLS(IoSecureServer *self, IoObject *locals, IoMessage *msg) { #ifdef DTLS_IMPLEMENTED SSL_CTX *ctx = OCTX(self); if(SSL_CTX_set_ssl_version(ctx, DTLSv1_server_method()) != 1) { ERR_print_errors_fp(stderr); IoState_error_(IOSTATE, msg, "Error using DTLS"); return IONIL(self); } SSL_CTX_set_read_ahead(ctx, 1); return self; #else IoState_error_(IOSTATE, msg, "Addon built against OpenSSL older than 0.9.8; DTLS is not supported."); return IONIL(self); #endif } IoSecureSocket *IoSecureServer_tlsWrap(IoSecureServer *self, IoObject *locals, IoMessage *msg) { SSL_CTX *ctx = OCTX(self); IoSocket *sock = IoMessage_locals_socketArgAt_(msg, locals, 0); IoNumber *port = IoObject_getSlot_(sock, IOSYMBOL("port")); SSL *ssl = SSL_new(ctx); SSL_set_fd(ssl, IoSocket_rawDescriptor(sock)); set_nonblocking(SSL_get_rbio(ssl)); set_nonblocking(SSL_get_wbio(ssl)); SSL_set_accept_state(ssl); SSL_set_mode(ssl, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); IoIPAddress *ioaddr = IoIPAddress_new(IoObject_state(self)); IPAddress *iaddr = IoIPAddress_rawIPAddress(ioaddr); IPAddress_setIp_(iaddr, "0.0.0.0"); IPAddress_setPort_(iaddr, IoNumber_asLong(port)); IoSecureSocket *ssock = IoSecureSocket_newWithSSL_IP_(IoObject_state(self), ssl, ioaddr); return ssock; } #ifdef DTLS_IMPLEMENTED IoIPAddress *IoSecureServer_udpRecvIP(IoSecureServer *self, IoObject *locals, IoMessage *msg) { SSL_CTX *ctx = OCTX(self); IoSocket *sock = IoObject_getSlot_(self, IOSYMBOL("socket")); IoIPAddress *ioaddress = IoObject_getSlot_(sock, IOSYMBOL("ipAddress")); IPAddress *address = IoIPAddress_rawIPAddress(ioaddress); socklen_t addressSize = IPAddress_size(address); int fd = IoSocket_rawDescriptor(sock); int bytesPerRead = 1; char *buffer = calloc(1, sizeof(char)); int bytesRead = recvfrom(fd, buffer, bytesPerRead, MSG_PEEK, IPAddress_sockaddr(address), &addressSize); if (bytesRead > 0) { IPAddress_setSize_(address, addressSize); } free(buffer); return ioaddress; } IoSecureSocket *IoSecureServer_dtlsWrap(IoSecureServer *self, IoObject *locals, IoMessage *msg) { SSL_CTX *ctx = OCTX(self); IoSocket *sock = IoObject_getSlot_(self, IOSYMBOL("socket")); IoIPAddress *ioip = IoMessage_locals_addressArgAt_(msg, locals, 0); IPAddress *ip = IoIPAddress_rawIPAddress(ioip); struct sockaddr *addr = IPAddress_sockaddr(ip); IoNumber *port = IoObject_getSlot_(sock, IOSYMBOL("port")); int fd = IoSocket_rawDescriptor(sock); SSL *ssl = SSL_new(ctx); BIO *rbio = BIO_new(BIO_s_mem()); BIO_set_mem_eof_return(rbio, -1); BIO *wbio = BIO_new_dgram(fd, BIO_NOCLOSE); BIO_dgram_set_peer(wbio, addr); SSL_set_bio(ssl, rbio, wbio); SSL_set_accept_state(ssl); set_nonblocking(wbio); SSL_set_mode(ssl, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); IoSecureSocket *ssock = IoSecureSocket_newWithSSL_IP_(IoObject_state(self), ssl, ioip); return ssock; } IoSecureServer *IoSecureServer_dispatchUDP(IoSecureServer *self, IoObject *locals, IoMessage *msg) { SSL_CTX *ctx = OCTX(self); IoSocket *sock = IoObject_getSlot_(self, IOSYMBOL("socket")); IoIPAddress *ioaddress = IoObject_getSlot_(sock, IOSYMBOL("ipAddress")); IPAddress *address = IoIPAddress_rawIPAddress(ioaddress); socklen_t addressSize = IPAddress_size(address); IoSecureSocket *ssock = IoMessage_locals_secureSocketArgAt_(msg, locals, 0); SSL *ssl = IoSecureSocket_SSL(ssock); int fd = IoSocket_rawDescriptor(sock); int bytesPerRead = IoNumber_asLong(IoObject_getSlot_(sock, IOSYMBOL("bytesPerRead"))); char *buffer = calloc(bytesPerRead, sizeof(char)); //debugPrintf("errno going in: %i\n", errno); int bytesRead = recvfrom(fd, buffer, bytesPerRead, 0, IPAddress_sockaddr(address), &addressSize); //debugPrintf("Read %i/%i : %i\n", bytesRead, bytesPerRead, errno); if(bytesRead > 0) { BIO_write(ssl->rbio, buffer, bytesRead); } free(buffer); return IOBOOL(self, bytesRead > 0); } #endif
33.05949
118
0.76581
8aeafbc010895daf36b28aeafe288aede6b68345
538
h
C
client/lib/ltracer/ltracer.h
Coestaris/Zomboid2.0
5632b3fafdb90afb48fb6bd0ee3bc3625aa5e39b
[ "MIT" ]
4
2019-05-01T01:07:09.000Z
2020-06-21T17:16:59.000Z
client/lib/ltracer/ltracer.h
Coestaris/Zomboid2.0
5632b3fafdb90afb48fb6bd0ee3bc3625aa5e39b
[ "MIT" ]
null
null
null
client/lib/ltracer/ltracer.h
Coestaris/Zomboid2.0
5632b3fafdb90afb48fb6bd0ee3bc3625aa5e39b
[ "MIT" ]
null
null
null
// // Created by maxim on 2/17/19. // #ifndef ZOMBOID2_LTRACER_H #define ZOMBOID2_LTRACER_H #include "../graphics/drawer.h" #include "../structs.h" #include "ltracer_structs.h" #include "ltracer_math.h" #define LT_AREA 1 #define LT_SPOT 2 void ltracerPushLight(ltracer_data_t* ld); void ltracerRemoveLight(ltracer_data_t* ld); ltracer_edge_t* ltracerPushEdge(vec_t a, vec_t b, vec_t c, vec_t d); void ltracerRemoveEdge(int edgeId); void ltracerReset(); void ltracerUpdate(); void ltracerDraw(int depth); #endif //ZOMBOID2_LTRACER_H
20.692308
68
0.767658
8aeb278896f375831a929183734812bf9cde2617
410
h
C
CameraView/CameraView/CameraViewController.h
nacker/wordEdit
7acbb489945be5d286e1d31e0b4ac3774d792dae
[ "Apache-2.0" ]
null
null
null
CameraView/CameraView/CameraViewController.h
nacker/wordEdit
7acbb489945be5d286e1d31e0b4ac3774d792dae
[ "Apache-2.0" ]
null
null
null
CameraView/CameraView/CameraViewController.h
nacker/wordEdit
7acbb489945be5d286e1d31e0b4ac3774d792dae
[ "Apache-2.0" ]
null
null
null
// // CameraViewController.h // CameraView // // Created by Zippo on 2017/7/19. // Copyright © 2017年 Zippo. All rights reserved. // #import <UIKit/UIKit.h> @protocol CameraViewControllerDelegate <NSObject> -(void)didFinishTakePhotoWithClipedImage:(UIImage*)clipedImage; @end @interface CameraViewController : UIViewController @property(nonatomic,weak)id<CameraViewControllerDelegate> delegate; @end
18.636364
67
0.770732
8aed5082f5dc4c0a812544a6d669f7bd34458e98
712
h
C
usr/lib/libnfshared.dylib/NFCurrency.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
2
2021-11-02T09:23:27.000Z
2022-03-28T08:21:57.000Z
usr/lib/libnfshared.dylib/NFCurrency.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
null
null
null
usr/lib/libnfshared.dylib/NFCurrency.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
1
2022-03-28T08:21:59.000Z
2022-03-28T08:21:59.000Z
/* * This header is generated by classdump-dyld 1.5 * on Friday, April 30, 2021 at 11:37:25 AM Mountain Standard Time * Operating System: Version 13.5.1 (Build 17F80) * Image Source: /usr/lib/libnfshared.dylib * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley. */ @interface NFCurrency : NSObject +(unsigned long long)decodeBCDAmount:(id)arg1 ; +(id)encodeBCDAmount:(unsigned long long)arg1 ; +(id)getCurrencyStringCodeFromNumericCode:(unsigned)arg1 ; +(int)getFractionDigitsFromCurrencyStringCode:(id)arg1 ; @end
41.882353
130
0.622191
8aedef2c1b415c1f56dac52f63b978080876d721
4,122
h
C
tf2_src/game/shared/tf/tf_weapon_flaregun.h
d3fc0n6/TeamFortress2
1b81dded673d49adebf4d0958e52236ecc28a956
[ "MIT" ]
4
2021-10-03T05:16:55.000Z
2021-12-28T16:49:27.000Z
tf2_src/game/shared/tf/tf_weapon_flaregun.h
Counter2828/TeamFortress2
1b81dded673d49adebf4d0958e52236ecc28a956
[ "MIT" ]
null
null
null
tf2_src/game/shared/tf/tf_weapon_flaregun.h
Counter2828/TeamFortress2
1b81dded673d49adebf4d0958e52236ecc28a956
[ "MIT" ]
3
2022-02-02T18:09:58.000Z
2022-03-06T18:54:39.000Z
//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: // //============================================================================= #ifndef TF_WEAPON_FLAREGUN_H #define TF_WEAPON_FLAREGUN_H #ifdef _WIN32 #pragma once #endif #include "tf_weaponbase_gun.h" #ifdef GAME_DLL #include "tf_projectile_flare.h" #endif // Client specific. #ifdef CLIENT_DLL #define CTFFlareGun C_TFFlareGun #define CTFFlareGun_Revenge C_TFFlareGun_Revenge #endif enum FlareGunTypes_t { FLAREGUN_NORMAL = 0, FLAREGUN_DETONATE, FLAREGUN_GRORDBORT, FLAREGUN_SCORCHSHOT }; //============================================================================= // // TF Weapon Flare gun. // class CTFFlareGun : public CTFWeaponBaseGun { public: DECLARE_CLASS( CTFFlareGun, CTFWeaponBaseGun ); DECLARE_NETWORKCLASS(); DECLARE_PREDICTABLE(); // Server specific. #ifdef GAME_DLL DECLARE_DATADESC(); #endif CTFFlareGun(); ~CTFFlareGun(); virtual void Precache(); virtual void DestroySounds( void ); virtual int GetWeaponID( void ) const { return TF_WEAPON_FLAREGUN; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual bool Holster( CBaseCombatWeapon *pSwitchingTo ); virtual bool Deploy( void ); virtual void ItemPostFrame( void ); virtual void WeaponReset( void ); int GetFlareGunType( void ) const { int iMode = 0; CALL_ATTRIB_HOOK_INT( iMode, set_weapon_mode ); return iMode; } #ifdef GAME_DLL void AddFlare( CTFProjectile_Flare *pFlare ); void DeathNotice( CBaseEntity *pVictim ); void DetonateFlare( void ); #endif virtual void StartCharge( void ); virtual void StopCharge( void ); virtual void ChargePostFrame( void ) {} // Derived weapons can figure out what to do with this virtual const char* GetChargeEffect( void ) const { return "drg_cowmangler_muzzleflash_chargeup"; } float GetChargeBeginTime( void ) const { return m_flChargeBeginTime; } protected: #ifdef GAME_DLL typedef CHandle<CTFProjectile_Flare> FlareHandle; CUtlVector <FlareHandle> m_Flares; int m_iFlareCount; #endif protected: void StartChargeStartTime() { m_flChargeBeginTime = gpGlobals->curtime; } #ifdef CLIENT_DLL virtual void DispatchMuzzleFlash( const char* effectName, C_BaseEntity* pAttachEnt ); void ClientEffectsThink( void ); void StartChargeEffects(); void StopChargeEffects(); virtual bool ShouldPlayClientReloadSound() { return true; } #endif private: CNetworkVar( float, m_flChargeBeginTime ); bool m_bEffectsThinking; float m_flLastDenySoundTime; #if defined( CLIENT_DLL ) CSoundPatch *m_pChargeLoop; bool m_bReadyToFire; #endif CTFFlareGun( const CTFFlareGun & ) {} }; //--------------------------------------------------------- class CTFFlareGun_Revenge : public CTFFlareGun { public: DECLARE_CLASS( CTFFlareGun_Revenge, CTFFlareGun ); DECLARE_NETWORKCLASS(); DECLARE_PREDICTABLE(); CTFFlareGun_Revenge(); virtual void Precache(); virtual int GetWeaponID( void ) const { return TF_WEAPON_FLAREGUN_REVENGE; } virtual bool IsEnergyWeapon( void ) const { return true; } virtual int GetCustomDamageType() const; virtual bool Holster( CBaseCombatWeapon *pSwitchingTo = NULL ); virtual bool Deploy( void ); #ifdef GAME_DLL virtual void Detach(); #endif int GetCount( void ); float GetProgress( void ) { return 0.0f; } const char* GetEffectLabelText( void ) { return "#TF_CRITS"; } const char* GetMuzzleFlashParticleEffect( void ) { return "drg_manmelter_muzzleflash"; } virtual void PrimaryAttack(); virtual void SecondaryAttack( void ); virtual void ChargePostFrame( void ); virtual const char* GetChargeEffect( void ) const { return "drg_manmelter_vacuum"; } virtual const char* ReadyToFireSound( void ) const { return "Weapon_SniperRailgun.NonScoped"; } #ifdef CLIENT_DLL virtual void OnDataChanged( DataUpdateType_t type ); void DoAbsorbEffect( void ); #endif private: bool ExtinguishPlayerInternal( CTFPlayer *pTarget, CTFPlayer *pOwner ); CNetworkVar( float, m_fLastExtinguishTime ); #ifdef CLIENT_DLL int m_nOldRevengeCrits; #endif }; #endif // TF_WEAPON_FLAREGUN_H
24.831325
118
0.719068
8aeec6bc07460b266c7b7cb053f7e047459ef9b5
2,115
c
C
mm_math.c
zpreisler/patchy2d
f610b08382cef77e8e93ea0659ff02fef057e0da
[ "MIT" ]
null
null
null
mm_math.c
zpreisler/patchy2d
f610b08382cef77e8e93ea0659ff02fef057e0da
[ "MIT" ]
null
null
null
mm_math.c
zpreisler/patchy2d
f610b08382cef77e8e93ea0659ff02fef057e0da
[ "MIT" ]
2
2019-02-24T19:33:49.000Z
2021-08-17T23:32:41.000Z
#include <stdlib.h> #include <stdio.h> #include <math.h> #include <immintrin.h> #include <utils.h> #include "dSFMT.h" #include "mm_math.h" extern dsfmt_t dsfmt; void boundary(__m128d *r,__m128d box){ __m128d t=_mm_div_pd(*r,box); t=_mm_round_pd(t,0x1); t=_mm_mul_pd(t,box); *r=_mm_sub_pd(*r,t); } __m128d _mm_dist(__m128d p,__m128d q,__m128d b){ __m128d x,y; y=_mm_sub_pd(p,q); x=_mm_div_pd(y,b); x=_mm_round_pd(x,0x0); x=_mm_mul_pd(x,b); x=_mm_sub_pd(x,y); return x; } double dist(__m128d p,__m128d q,__m128d b){ __m128d x,y; y=_mm_sub_pd(p,q); x=_mm_div_pd(y,b); x=_mm_round_pd(x,0x0); x=_mm_mul_pd(x,b); x=_mm_sub_pd(x,y); x=_mm_dp_pd(x,x,0xFF); return _mm_cvtsd_f64(x); } __m128d _mm_dist_uy(__m128d p,__m128d q,__m128d b,double uy){ __m128d x,y; y=_mm_sub_pd(p,q); x=_mm_div_pd(y,b); x=_mm_round_pd(x,0x0); x=_mm_mul_pd(x,b); x=_mm_sub_pd(x,y); x[0]+=x[1]*uy; return x; } double dist_uy(__m128d p,__m128d q,__m128d b,double uy){ __m128d x,y; y=_mm_sub_pd(p,q); x=_mm_div_pd(y,b); x=_mm_round_pd(x,0x0); x=_mm_mul_pd(x,b); x=_mm_sub_pd(x,y); x=_mm_dp_pd(x,x,0xFF); x[0]+=x[1]*uy; return _mm_cvtsd_f64(x); } double length2(__m128d x){ x=_mm_dp_pd(x,x,0xFF); return _mm_cvtsd_f64(x); } double length(__m128d x){ x=_mm_dp_pd(x,x,0xFF); return sqrt(_mm_cvtsd_f64(x)); } double dot(__m128d a,__m128d b){ __m128d c=_mm_dp_pd(a,b,0x31); return _mm_cvtsd_f64(c); } __m128d normalize(__m128d a){ double n=length(a); return a/n; } double *init_dexp(double e){ int i,j; double *dexp=alloc(2*NDEXP*sizeof(double)); for(i=-NDEXP,j=0;i<NDEXP;i++,j++)*(dexp+j)=exp(i*e); return dexp; } __m128d rnd11(){ __m128d b={dsfmt_genrand_open_open(&dsfmt),dsfmt_genrand_open_open(&dsfmt)}; return b; } __m128d sincosa(double a){ __m128d b={sin(a),cos(a)}; return b; } __m128d rot22(__m128d a,__m128d b01){ __m128d b10={-b01[1],b01[0]}; return _mm_set1_pd(a[1])*b01-_mm_set1_pd(a[0])*b10; } __m128d rot2w(__m128d a,double w){ __m128d b={-sin(w),cos(w)}; return normalize(rot22(a,b)); } unsigned int rndn(unsigned int n){ return (unsigned)(dsfmt_genrand_open_open(&dsfmt)*n); }
22.03125
77
0.69409
8af0f63d929dac730ad1738b8bb5684e9b341e82
1,838
h
C
3rdParty/MemPlumber/MemPlumber/Tests/test-macros.h
maruu/PcapPlusPlus
e314a3cc7f545d53555aa74c43205a48756ccfac
[ "Unlicense" ]
1,856
2015-01-08T21:43:04.000Z
2022-03-30T05:36:25.000Z
3rdParty/MemPlumber/MemPlumber/Tests/test-macros.h
maruu/PcapPlusPlus
e314a3cc7f545d53555aa74c43205a48756ccfac
[ "Unlicense" ]
604
2015-01-05T22:31:11.000Z
2022-03-31T16:22:39.000Z
3rdParty/MemPlumber/MemPlumber/Tests/test-macros.h
maruu/PcapPlusPlus
e314a3cc7f545d53555aa74c43205a48756ccfac
[ "Unlicense" ]
537
2015-06-27T09:14:39.000Z
2022-03-25T15:35:30.000Z
// general test macros #include <stdio.h> #define TEST_CASE(TestName) void TestName(bool& result) #define TEST_ASSERT_EQUAL(actual, expected) \ if (actual != expected) { \ printf("%s:%d: FAILED. assert equal failed: actual: %d != expected: %d\n", __FUNCTION__, __LINE__, (int)(actual), (int)(expected)); \ result = false; \ return; \ } #define START_RUNNING_TESTS bool allTestsPassed = true #define RUN_TEST(TestName) \ bool TestName##_result = true; \ TestName(TestName##_result); \ if (TestName##_result) { \ printf("%-30s: PASSED\n", #TestName ""); \ } \ allTestsPassed &= TestName##_result #define SKIP_TEST(TestName, why) \ printf("%-30s: SKIPPED (%s)\n", #TestName "", why); \ #define END_RUNNING_TESTS \ if (allTestsPassed) \ { \ printf("ALL TESTS PASSED!!\n\n\n"); \ return 0; \ } \ else \ { \ printf("NOT ALL TESTS PASSED!!\n\n\n"); \ return 1; \ } // memplumber specific macros #ifdef TEST_VERBOSE #define TEST_VERBOSE_INNER true #else #define TEST_VERBOSE_INNER false #endif //TEST_VERBOSE #ifdef MEM_CHECK_VERBOSE #define MEM_CHECK_VERBOSE_INNER true #else #define MEM_CHECK_VERBOSE_INNER false #endif //MEM_CHECK_VERBOSE #define START_TEST \ size_t memLeakCount; \ uint64_t memLeakSize; \ MemPlumber::start(TEST_VERBOSE_INNER) #define START_TEST_DUMP_TO_FILE(fileName, append) \ size_t memLeakCount; \ uint64_t memLeakSize; \ MemPlumber::start(true, fileName, append) #define STOP_TEST MemPlumber::stopAndFreeAllMemory() #define CHECK_MEM_LEAK(expectedLeakCount, expectedLeakSize) \ MemPlumber::memLeakCheck(memLeakCount, memLeakSize, MEM_CHECK_VERBOSE_INNER); \ TEST_ASSERT_EQUAL(memLeakCount, expectedLeakCount); \ TEST_ASSERT_EQUAL(memLeakSize, expectedLeakSize)
26.257143
135
0.68988
8af1aac6aaf13a511d1fff83629ddbdd60f00ce2
4,472
c
C
Platform_F103/src/Platform_EVTIM.c
PaulBurkeIV/BluePill_MiniLib
0d2d42790b598164602df38d3b41baa341ac7635
[ "MIT" ]
null
null
null
Platform_F103/src/Platform_EVTIM.c
PaulBurkeIV/BluePill_MiniLib
0d2d42790b598164602df38d3b41baa341ac7635
[ "MIT" ]
null
null
null
Platform_F103/src/Platform_EVTIM.c
PaulBurkeIV/BluePill_MiniLib
0d2d42790b598164602df38d3b41baa341ac7635
[ "MIT" ]
null
null
null
/* * Platform_EVTIM.c * */ #ifdef USE_EVTIM #include <stdint.h> #include <stdbool.h> #include "Platform.h" #include "Globals.h" #include "print.h" #include "Platform_EVTIM.h" #define RCC_AHBPeriph_DMA1 Bit(0) #define CHAN(x) ((x)-1) // Because numbers start from 1, array from 0 #define TIM1_CH1_DMA CHAN(2) #define TIM1_CH3_DMA CHAN(6) #define TIM1_CH4_DMA CHAN(4) #define TIM2_CH1_DMA CHAN(5) #define TIM2_CH2_DMA CHAN(7) #define TIM2_CH3_DMA CHAN(1) #define TIM2_CH4_DMA CHAN(7) #define TIM3_CH1_DMA CHAN(6) #define TIM3_CH3_DMA CHAN(2) #define TIM3_CH4_DMA CHAN(3) #define TIM4_CH1_DMA CHAN(1) #define TIM4_CH2_DMA CHAN(4) #define TIM4_CH3_DMA CHAN(5) #define TIM1CH1 ((uint32_t)TIM1 + 1) #define TIM1CH3 ((uint32_t)TIM1 + 3) #define TIM1CH4 ((uint32_t)TIM1 + 4) #define TIM2CH1 ((uint32_t)TIM2 + 1) #define TIM2CH2 ((uint32_t)TIM2 + 2) #define TIM2CH3 ((uint32_t)TIM2 + 3) #define TIM2CH4 ((uint32_t)TIM2 + 4) #define TIM3CH1 ((uint32_t)TIM3 + 1) #define TIM3CH3 ((uint32_t)TIM3 + 3) #define TIM3CH4 ((uint32_t)TIM3 + 4) #define TIM4CH1 ((uint32_t)TIM4 + 1) #define TIM4CH2 ((uint32_t)TIM4 + 2) #define TIM4CH3 ((uint32_t)TIM4 + 3) #define DMA_16BIT (0x05<<8) #define DMA_MemoryInc_Enable Bit(7) #define DMA_Mode_Circular Bit(5) #define DMA_Priority_Medium Bit(12) void SetupEventTimer(TIM_TypeDef *TIM, uint16_t Chann, uint16_t Div) { uint32_t ClockSpeed; if( !(ClockSpeed = InitTimerClock(TIM))) return; RCC->AHBENR |= RCC_AHBPeriph_DMA1; TIM->CR1 &= ~ENABLE; switch(Chann) { case 1: TIM->CCMR1 = (3<<12) | 1; TIM->DIER = Bit(9); TIM->CCER = Bit(0); break; case 2: TIM->CCMR1 = (3<<12) | (1<<8); TIM->DIER = Bit(10); TIM->CCER = Bit(4); break; case 3: TIM->CCMR2 = (3<<4) | 1; TIM->DIER = Bit(11); TIM->CCER = Bit(8); break; case 4: TIM->CCMR2 = (3<<12) | (1<<8); TIM->DIER = Bit(12); TIM->CCER = Bit(12); break; } TIM->CR1 = 0; TIM->ARR = 0xffff; TIM->PSC = (Div-1); TIM->RCR = 0; TIM->EGR = Bit(1); TIM->CR1 |= 1; } void InitEventTimer(t_EventTimer *EventTimer ) { t_DMA_Channel *DMA1Channel = (t_DMA_Channel *)DMA1_Channel1; t_DMA_Channel *DMA_Channel = 0; uint16_t Chann = 0; uint32_t TimChann = (uint32_t)EventTimer->TIM + EventTimer->Channel; switch( TimChann) { case TIM1CH1: DMA_Channel = &DMA1Channel[TIM1_CH1_DMA]; Chann = 1; break; case TIM1CH3: DMA_Channel = &DMA1Channel[TIM1_CH3_DMA]; Chann = 3; break; case TIM1CH4: DMA_Channel = &DMA1Channel[TIM1_CH4_DMA]; Chann = 4; break; case TIM2CH1: DMA_Channel = &DMA1Channel[TIM2_CH1_DMA]; Chann = 1; break; case TIM2CH2: DMA_Channel = &DMA1Channel[TIM2_CH2_DMA]; Chann = 2; break; case TIM2CH3: DMA_Channel = &DMA1Channel[TIM2_CH3_DMA]; Chann = 3; break; case TIM2CH4: DMA_Channel = &DMA1Channel[TIM2_CH4_DMA]; Chann = 4; break; case TIM3CH1: DMA_Channel = &DMA1Channel[TIM3_CH1_DMA]; Chann = 1; break; case TIM3CH3: DMA_Channel = &DMA1Channel[TIM3_CH3_DMA]; Chann = 3; break; case TIM3CH4: DMA_Channel = &DMA1Channel[TIM3_CH4_DMA]; Chann = 4; break; case TIM4CH1: DMA_Channel = &DMA1Channel[TIM4_CH1_DMA]; Chann = 1; break; case TIM4CH2: DMA_Channel = &DMA1Channel[TIM4_CH2_DMA]; Chann = 2; break; case TIM4CH3: DMA_Channel = &DMA1Channel[TIM4_CH3_DMA]; Chann = 3; break; default: return; } EventTimer->Channel = Chann; EventTimer->DMA = DMA_Channel; SetupEventTimer( EventTimer->TIM, Chann, EventTimer->Div); EventTimer->OutCnt = 0; DMA_Channel->CCR = DMA_MemoryInc_Enable | DMA_16BIT | DMA_Mode_Circular | DMA_Priority_Medium; DMA_Channel->CNDTR = EventTimer->BufSz; DMA_Channel->CPAR = (uint32_t)&EventTimer->TIM->CCR1; DMA_Channel->CMAR = (uint32_t)EventTimer->Buff; DMA_Channel->CCR |= 1; // Enable the DMA } void InvertEventTimer( t_EventTimer *EventTimer ) { TIM_TypeDef *TIM = EventTimer->TIM; uint8_t Chann = EventTimer->Channel; switch(Chann) { case 1: TIM->CCER ^= Bit(1); break; case 2: TIM->CCER ^= Bit(5); break; case 3: TIM->CCER ^= Bit(9); break; case 4: TIM->CCER ^= Bit(12); break; } } uint16_t EventTimerDataRdy(t_EventTimer *EventTimer) { return ((EventTimer->BufSz - EventTimer->DMA->CNDTR) - EventTimer->OutCnt ) & ((EventTimer->BufSz)-1); } uint16_t ReadEventTimer(t_EventTimer *EventTimer) { uint16_t t = EventTimer->Buff[EventTimer->OutCnt]; EventTimer->OutCnt = (EventTimer->OutCnt+1) & ((EventTimer->BufSz)-1); return t; } #endif //USE_EVTIM
19.443478
102
0.684928
8af288c93f88b8afc504b29a5022c367e979472a
2,154
h
C
plugins/mission/mission_item_impl.h
lbegani/DronecodeSDK
0797c1b9fad7ce75fc667ed46a925861f4adef56
[ "BSD-3-Clause" ]
null
null
null
plugins/mission/mission_item_impl.h
lbegani/DronecodeSDK
0797c1b9fad7ce75fc667ed46a925861f4adef56
[ "BSD-3-Clause" ]
null
null
null
plugins/mission/mission_item_impl.h
lbegani/DronecodeSDK
0797c1b9fad7ce75fc667ed46a925861f4adef56
[ "BSD-3-Clause" ]
null
null
null
#pragma once #include "mission_item.h" #include "mavlink_include.h" namespace dronecode_sdk { class MissionItemImpl { public: MissionItemImpl(); ~MissionItemImpl(); void set_position(double latitude_deg, double longitude_deg); void set_relative_altitude(float relative_altitude_m); void set_speed(float speed_m_s); void set_fly_through(bool fly_through); void set_gimbal_pitch_and_yaw(float pitch_deg, float yaw_deg); void set_loiter_time(float loiter_time_s); void set_camera_action(MissionItem::CameraAction action); void set_camera_photo_interval(double interval_s); double get_latitude_deg() const { return _latitude_deg; } double get_longitude_deg() const { return _longitude_deg; } float get_relative_altitude_m() const { return _relative_altitude_m; } float get_speed_m_s() const { return _speed_m_s; } bool get_fly_through() const { return _fly_through; }; float get_gimbal_pitch_deg() const { return _gimbal_pitch_deg; } float get_gimbal_yaw_deg() const { return _gimbal_yaw_deg; } float get_loiter_time_s() const { return _loiter_time_s; } MissionItem::CameraAction get_camera_action() const { return _camera_action; } double get_camera_photo_interval_s() const { return _camera_photo_interval_s; } MAV_FRAME get_mavlink_frame() const; MAV_CMD get_mavlink_cmd() const; uint8_t get_mavlink_autocontinue() const; float get_mavlink_param1() const; float get_mavlink_param2() const; float get_mavlink_param3() const; float get_mavlink_param4() const; int32_t get_mavlink_x() const; int32_t get_mavlink_y() const; float get_mavlink_z() const; bool is_position_finite() const; private: double _latitude_deg = double(NAN); double _longitude_deg = double(NAN); float _relative_altitude_m = NAN; float _speed_m_s = NAN; bool _fly_through = false; float _gimbal_pitch_deg = NAN; float _gimbal_yaw_deg = NAN; float _loiter_time_s = NAN; MissionItem::CameraAction _camera_action{MissionItem::CameraAction::NONE}; double _camera_photo_interval_s = 1.0; }; } // namespace dronecode_sdk
36.508475
83
0.752553
8af48dc6be99a9f5aa2dac3f59219241ef82440a
2,323
h
C
tools/vsimporter/include/PBX/XCScheme.h
crossmob/WinObjC
7bec24671c4c18b81aaf85eff2887438f18a697c
[ "MIT" ]
6,717
2015-08-06T18:04:37.000Z
2019-05-04T12:38:51.000Z
tools/vsimporter/include/PBX/XCScheme.h
Michael-Young48/WinObjC
7bec24671c4c18b81aaf85eff2887438f18a697c
[ "MIT" ]
2,711
2015-08-06T18:41:09.000Z
2019-04-29T12:14:23.000Z
tools/vsimporter/include/PBX/XCScheme.h
Michael-Young48/WinObjC
7bec24671c4c18b81aaf85eff2887438f18a697c
[ "MIT" ]
1,021
2015-08-06T18:08:56.000Z
2019-04-14T06:50:57.000Z
//****************************************************************************** // // Copyright (c) 2015 Microsoft Corporation. All rights reserved. // // This code is licensed under the MIT License (MIT). // // 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. // //****************************************************************************** #ifndef _XCSCHEME_H_ #define _XCSCHEME_H_ #include "types.h" namespace pugi { class xml_document; class xml_node; }; class PBXProject; class ErrorReporter; struct BuildRef { String id; String targetName; String productName; String container; }; typedef std::list<BuildRef> BuildRefList; class XCScheme { public: static XCScheme* createFromFile(const String& schemePath, const String& containerAbsPath); const String& getPath() const { return m_absPath; } const String& getName() const { return m_name; } const StringSet& getConfig() const { return m_configName; } const BuildRefList& getTargets() const { return m_targets; } // Returns the parent directory of the container which has the scheme file. const String getContainerParentDir() const { return sb_dirname(m_containerAbsPath); }; private: XCScheme(const String& absSchemePath, const String& containerAbsPath); bool initFromXML(const pugi::xml_document& doc); void parseBuildAction(const pugi::xml_node& node, const ErrorReporter& report); void parseLaunchAction(const pugi::xml_node& node, const ErrorReporter& report); // Scheme path String m_absPath; // Scheme name String m_name; // List of targets to build BuildRefList m_targets; // Build configuration name StringSet m_configName; // Workspace or project abosolute path where this scheme is present. const String m_containerAbsPath; }; #endif /* _XCSCHEME_H_ */
29.405063
94
0.667671
8af6c4b996061a850960587f580d0d5765c36464
455
h
C
effect-master/delay.h
DevLaika/raspberry-effects-pedal
240a13e7ca794aead2075dd61d1d7eba2fe0e2dc
[ "MIT" ]
null
null
null
effect-master/delay.h
DevLaika/raspberry-effects-pedal
240a13e7ca794aead2075dd61d1d7eba2fe0e2dc
[ "MIT" ]
null
null
null
effect-master/delay.h
DevLaika/raspberry-effects-pedal
240a13e7ca794aead2075dd61d1d7eba2fe0e2dc
[ "MIT" ]
null
null
null
#ifndef DELAY_H #define DELAY_H #include "effect.h" #define MAX_RECORD_LENGTH 100000 class Delay : public Effect { public: int delay_depth = 0; Delay(int delay_depth); int eval(int input_signal); int *getPointerTo(std::string target); private: int buffer[MAX_RECORD_LENGTH]; int counter = 0; int length = 0; }; class DelayFactory : Factory { public: DelayFactory(); Delay *create(std::string config, std::string address); }; #endif
15.689655
57
0.716484
8af894df3515181b32db68e4127470160361a1c8
1,424
h
C
chromecast/browser/extensions/cast_extension_system_factory.h
zipated/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
2,151
2020-04-18T07:31:17.000Z
2022-03-31T08:39:18.000Z
chromecast/browser/extensions/cast_extension_system_factory.h
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
395
2020-04-18T08:22:18.000Z
2021-12-08T13:04:49.000Z
chromecast/browser/extensions/cast_extension_system_factory.h
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
338
2020-04-18T08:03:10.000Z
2022-03-29T12:33:22.000Z
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROMECAST_BROWSER_EXTENSIONS_CAST_EXTENSION_SYSTEM_FACTORY_H_ #define CHROMECAST_BROWSER_EXTENSIONS_CAST_EXTENSION_SYSTEM_FACTORY_H_ #include "base/macros.h" #include "base/memory/singleton.h" #include "extensions/browser/extension_system_provider.h" namespace extensions { // A factory that provides CastExtensionSystem for cast_shell. class CastExtensionSystemFactory : public ExtensionSystemProvider { public: // ExtensionSystemProvider implementation: ExtensionSystem* GetForBrowserContext( content::BrowserContext* context) override; static CastExtensionSystemFactory* GetInstance(); private: friend struct base::DefaultSingletonTraits<CastExtensionSystemFactory>; CastExtensionSystemFactory(); ~CastExtensionSystemFactory() override; // BrowserContextKeyedServiceFactory implementation: KeyedService* BuildServiceInstanceFor( content::BrowserContext* context) const override; content::BrowserContext* GetBrowserContextToUse( content::BrowserContext* context) const override; bool ServiceIsCreatedWithBrowserContext() const override; DISALLOW_COPY_AND_ASSIGN(CastExtensionSystemFactory); }; } // namespace extensions #endif // CHROMECAST_BROWSER_EXTENSIONS_CAST_EXTENSION_SYSTEM_FACTORY_H_
33.904762
73
0.820927
8af8d0bf50f48ee179c4e0ee6b57c9e173273ac4
1,877
h
C
Sources/Elastos/Frameworks/Droid/Base/Core/inc/elastos/droid/widget/DoubleDigitManager.h
jingcao80/Elastos
d0f39852356bdaf3a1234743b86364493a0441bc
[ "Apache-2.0" ]
7
2017-07-13T10:34:54.000Z
2021-04-16T05:40:35.000Z
Sources/Elastos/Frameworks/Droid/Base/Core/inc/elastos/droid/widget/DoubleDigitManager.h
jingcao80/Elastos
d0f39852356bdaf3a1234743b86364493a0441bc
[ "Apache-2.0" ]
null
null
null
Sources/Elastos/Frameworks/Droid/Base/Core/inc/elastos/droid/widget/DoubleDigitManager.h
jingcao80/Elastos
d0f39852356bdaf3a1234743b86364493a0441bc
[ "Apache-2.0" ]
9
2017-07-13T12:33:20.000Z
2021-06-19T02:46:48.000Z
//========================================================================= // Copyright (C) 2012 The Elastos Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. //========================================================================= #ifndef __ELASTOS_DROID_WIDGET_DOUBLEDIGITMANAGER_H__ #define __ELASTOS_DROID_WIDGET_DOUBLEDIGITMANAGER_H__ #include "elastos/droid/ext/frameworkext.h" #include <elastos/core/Runnable.h> using Elastos::Core::IInteger32; using Elastos::Core::Runnable; namespace Elastos { namespace Droid { namespace Widget { class DoubleDigitManager : public Object , public IDoubleDigitManager { private: class DoubleDigitManagerRunnable : public Runnable { public: DoubleDigitManagerRunnable( /* [in] */ DoubleDigitManager* host); CARAPI Run(); private: DoubleDigitManager* mHost; }; public: CAR_INTERFACE_DECL() DoubleDigitManager(); CARAPI constructor( /* [in] */ Int64 timeoutInMillis, /* [in] */ IDoubleDigitManagerCallBack* callBack); CARAPI ReportDigit( /* [in] */ Int32 digit); private: Int64 mTimeoutInMillins; AutoPtr<IDoubleDigitManagerCallBack> mCallBack; AutoPtr<IInteger32> mIntermediateDigit; }; } // namespace Widget } // namespace Droid } // namespace Elastos #endif
25.712329
75
0.653703
8af930e23a85b0bdc77b3ac1c1443813d1660b12
480
c
C
Fatec/Primeiro_Semestre/Algoritmo_e_logica_pgma/Professor_Antonio/DadosAluno.c
talessantos49/Primeiros_Passos
7eac781fb3663c8cf71629611981d0ebd9f0216f
[ "MIT" ]
null
null
null
Fatec/Primeiro_Semestre/Algoritmo_e_logica_pgma/Professor_Antonio/DadosAluno.c
talessantos49/Primeiros_Passos
7eac781fb3663c8cf71629611981d0ebd9f0216f
[ "MIT" ]
null
null
null
Fatec/Primeiro_Semestre/Algoritmo_e_logica_pgma/Professor_Antonio/DadosAluno.c
talessantos49/Primeiros_Passos
7eac781fb3663c8cf71629611981d0ebd9f0216f
[ "MIT" ]
null
null
null
#include <stdio.h> #include <stdlib.h> void main() { int idade, ra;] float altura; char nome[50]; printf("\nOla!"); printf("\nPara prosseguirmos por favor digite: "); printf("\nSeu Nome: "); gets(nome); printf("\nSua Idade: "); scanf("%d", &idade); printf("\nSeu RA: "); scanf("%d",&ra); printf("\nSua Altura: "); scanf("%f",&altura); printf("\n\n\n Seja bem vindo %s, seu RA eh %d na nossa faculdade, voce esta matriculado com sucesso.\n\n\n\n", &nome, ra); }
21.818182
124
0.614583
8afba4a992737c13c8b43c4b46a7bd94ff5dc22d
21,342
h
C
include/xf_cmd_parser.h
xf-bnb/CommandLineParser
4c08c82815beb8dbc9b5253d7c6d1624f2c41e4e
[ "MIT" ]
null
null
null
include/xf_cmd_parser.h
xf-bnb/CommandLineParser
4c08c82815beb8dbc9b5253d7c6d1624f2c41e4e
[ "MIT" ]
2
2019-09-29T02:56:01.000Z
2019-10-10T08:30:12.000Z
include/xf_cmd_parser.h
xf-bnb/CommandLineParser
4c08c82815beb8dbc9b5253d7c6d1624f2c41e4e
[ "MIT" ]
null
null
null
/* command line parameter parsing library for Modern C++ version 1.0.3 https://github.com/xf-bnb/CommandLineParser Licensed under the MIT License <http://opensource.org/licenses/MIT>. SPDX - License - Identifier : MIT Copyright(c) 2019 Frank Xiong <https://github.com/xf-bnb>. */ #pragma once #include <functional> #include <regex> #include <variant> #include <string> #include <vector> #include <set> #include <map> namespace xf::cmd { inline const char* version() { return "1.0.3"; } using string_t = std::string; using size_type = std::size_t; template<typename _Type> using set_t = std::set<_Type>; template<typename _Type> using list_t = std::vector<_Type>; template<typename _KeyType, typename _ValueType> using pair_t = std::pair<_KeyType, _ValueType>; template<typename _KeyType, typename _ValueType> using map_t = std::map<_KeyType, _ValueType>; enum class value_t : unsigned char { vt_nothing, vt_boolean, vt_integer, vt_unsigned, vt_float, vt_string }; // enum value_t template<typename _ValueType> struct _type_mapper; template<> struct _type_mapper<bool> { static constexpr value_t _value = value_t::vt_boolean; }; template<> struct _type_mapper<int> { static constexpr value_t _value = value_t::vt_integer; }; template<> struct _type_mapper<unsigned int> { static constexpr value_t _value = value_t::vt_unsigned; }; template<> struct _type_mapper<double> { static constexpr value_t _value = value_t::vt_float; }; template<> struct _type_mapper<string_t> { static constexpr value_t _value = value_t::vt_string; }; template<> struct _type_mapper<std::nullptr_t> { static constexpr value_t _value = value_t::vt_nothing; }; class option_t { public: static inline bool is_string(const string_t& v) { return !v.empty(); } static inline bool is_boolean(const string_t& v) { return std::regex_match(v, std::regex("[Tt]rue|[Ff]alse|TRUE|FALSE")); } static inline bool is_integer(const string_t& v) { return std::regex_match(v, std::regex("[+-]?(0|[1-9][0-9]*)")); } static inline bool is_unsigned(const string_t& v) { return std::regex_match(v, std::regex("0|[1-9][0-9]*")); } static inline bool is_float(const string_t& v) { return std::regex_match(v, std::regex("[+-]?(0|[1-9][1-9]*)([.][0-9]+)?")); } private: using _CallType = std::function<bool (const string_t&)>; value_t _vt; bool _is_unique; bool _k_required; bool _v_required; _CallType _check; static constexpr bool (*_func_list[])(const string_t&){ nullptr, is_boolean, is_integer, is_unsigned, is_float, is_string }; public: option_t() = default; option_t(const value_t& vt, bool u, bool k, bool v, _CallType _func) : _vt(vt), _is_unique(u), _k_required(k), _v_required(v), _check(_func) { } option_t(const value_t& vt, bool u, bool k, bool v, const string_t& expr) : option_t(vt, u, k, v, [expr](const string_t& value) { return std::regex_match(value, std::regex(expr)); }) { } option_t(const value_t& vt, bool u, bool k, bool v) : option_t(vt, u, k, v, _func_list[static_cast<size_type>(vt)]) { } option_t(bool u, bool k) : option_t(value_t::vt_nothing, u, k, false, _CallType()) { } const value_t& value_type() const { return _vt; } bool is_unique() const { return _is_unique; } bool is_key_required() const { return _k_required; } bool is_value_required() const { return _v_required; } bool check(const string_t& value) const { return (_check && (_check(value))); } template<typename _ValueType, typename _CheckType> static option_t make(bool u, bool k, bool v, _CheckType checker) { return option_t(_type_mapper<_ValueType>::_value, u, k, v, checker); } template<typename _ValueType> static option_t make(bool u, bool k, bool v) { return option_t(_type_mapper<_ValueType>::_value, u, k, v); } template<typename _ValueType> static option_t make(bool, bool); }; // class option_t template<> option_t option_t::make<std::nullptr_t>(bool u, bool k) { return option_t(u, k); } enum state_t { s_ok, // ok s_nothing, // 没有任何参数 s_k_unrecognized, // 参数不能识别 s_k_duplicated, // 参数重复 s_k_conflict, // 参数唯一性冲突 s_k_missing, // 缺少必需的参数 s_v_missing, // 参数值缺失 s_v_redundant, // 参数值多余 s_v_error // 参数值错误 }; // enum state_t template<typename _Type> string_t _to_string(const _Type& v) { return std::to_string(v); } template<> string_t _to_string(const std::nullptr_t& v) { return ""; } template<> string_t _to_string(const bool& v) { return (v ? "true" : "false"); } template<> string_t _to_string(const string_t& v) { return v; } class result_t { friend class Parser; using variant_t = std::variant<std::nullptr_t, bool, int, unsigned int, double, string_t>; static string_t _to_string(const variant_t& v) { string_t x; std::visit([&](auto&& t) mutable { x = xf::cmd::_to_string(t); }, v); return x; } state_t _state; string_t _info; pair_t<string_t, string_t> _extra; map_t<string_t, string_t> _k_map; map_t<string_t, variant_t> _v_map; bool _is_unique{ false }; result_t(state_t code, const string_t& text) : _state(code), _info(text) { } public: state_t code() const { return _state; } const string_t& info() const { return _info; } const pair_t<string_t, string_t>& hint() const { return _extra; } bool is_valid() const { return (state_t::s_ok == code()); } bool is_existing(const string_t& key) const { return _k_map.find(key) != _k_map.end(); } operator bool() const { return is_valid(); } operator const string_t& () const { return info(); } bool has_value(const string_t& key) const { auto k_iter = _k_map.find(key); if (k_iter == _k_map.end()) return false; auto v_iter = _v_map.find(k_iter->second); if (v_iter == _v_map.end()) return false; return (static_cast<size_type>(value_t::vt_nothing) != v_iter->second.index()); } template<typename _Type> _Type get(const string_t& key) const { return std::get<_Type>(_v_map.at(_k_map.at(key))); } template<typename _Type> _Type get(const string_t& key, const _Type& value) const { try { return get<_Type>(key); } catch (const std::exception& /* e */) { // std::cout << e.what() << std::endl; return value; } } const map_t<string_t, variant_t>& get() const { return _v_map; } map_t<string_t, string_t> args() const { map_t<string_t, string_t> mss; for (auto v : _v_map) mss.emplace(v.first, _to_string(v.second)); return mss; } private: static string_t _make_info(state_t s, const string_t& a, const string_t& b) { switch (s) { case state_t::s_ok: return "ok"; case state_t::s_nothing: return R"(error: don't get any parameter.)"; case state_t::s_k_unrecognized: return R"(error: unrecognized parameter ")" + a + R"(".)"; case state_t::s_k_duplicated: return R"(error: repeat paramter ")" + a + R"(" and ")" + b + R"(".)"; case state_t::s_k_missing: return R"(error: the parameter ")" + a + R"(" must be specified but not found.)"; case state_t::s_v_missing: return R"(error: parameter ")" + a + R"(" must specify a value.)"; case state_t::s_v_redundant: return R"(error: the parameter ")" + a + R"(" doesn't require value.)"; case state_t::s_v_error: return R"(error: the ")" + b + R"(" can't be treated as the value of parameter ")" + a + R"(".)"; case state_t::s_k_conflict: return R"(error: parameter ")" + a + R"(" can't be specified with other parameters.)"; default: return string_t(); } } void _set_error(state_t s, const string_t& a = string_t(), const string_t& b = string_t()) { _state = s; _extra.first = a; _extra.second = b; _info = _make_info(_state, _extra.first, _extra.second); } bool _check_key(const string_t& key, const option_t& opt) { if (_k_map.empty()) { if (opt.is_unique()) _is_unique = true; return true; } if (_is_unique) { _set_error(state_t::s_k_conflict, _v_map.begin()->first); return false; } if (opt.is_unique()) { _set_error(state_t::s_k_conflict, key); return false; } auto iter = _k_map.find(key); if (iter != _k_map.end()) { _set_error(state_t::s_k_duplicated, iter->second, key); return false; } return true; } template<typename _Type> void _add_value(const string_t& key, const _Type& value, const set_t<string_t>& keys) { _v_map.emplace(key, variant_t(value)); for (auto k : keys) _k_map.emplace(k, key); } void _add_value(const string_t& key, const string_t& value, const set_t<string_t>& keys, const option_t& opt) { switch (opt.value_type()) { case value_t::vt_string: _add_value(key, value, keys); break; case value_t::vt_boolean: _add_value(key, ('t' == value[0] || 'T' == value[0]), keys); break; case value_t::vt_float: _add_value(key, std::stod(value), keys); break; case value_t::vt_integer: _add_value(key, std::stoi(value), keys); break; case value_t::vt_unsigned: _add_value(key, (unsigned int)(std::stoul(value)), keys); break; case value_t::vt_nothing: _add_value(key, nullptr, keys); break; default: break; } } void _add_value(const string_t& key, const set_t<string_t>& keys) { _add_value(key, nullptr, keys); } }; // class result_t class Parser { public: Parser() = default; Parser(const list_t<pair_t<set_t<string_t>, option_t>>& options) { for (auto opt : options) AddOption(opt); } Parser& AddOption(const pair_t<set_t<string_t>, option_t>& option) { if (!option.first.empty()) { _update_option_id(); opt_map.emplace(option_id, option); for (auto key : option.first) { auto iter = key_map.find(key); if (iter != key_map.end()) { _RemoveOption(iter->second, key); iter->second = option_id; } else { key_map.emplace(key, option_id); } } } return *this; } size_type RemoveOption(const set_t<string_t>& keys) { size_type n = 0; for (auto key : keys) { auto iter = key_map.find(key); if (iter != key_map.end()) { _RemoveOption(iter->second, key); key_map.erase(iter); ++n; } } return n; } bool IsValid(const string_t& key) const { return (key_map.find(key) != key_map.end()); } bool IsSame(const string_t& k1, const string_t& k2) const { auto iter1 = key_map.find(k1); if (iter1 == key_map.end()) return false; auto iter2 = key_map.find(k2); if (iter2 == key_map.end()) return false; return (iter1->second == iter2->second); } const option_t* GetOption(const string_t& key) const { auto iter = key_map.find(key); if (iter != key_map.end()) return &opt_map.at(iter->second).second; return nullptr; } set_t<string_t> GetKeys(const string_t& key) const { set_t<string_t> keys; auto iter = key_map.find(key); if (iter != key_map.end()) keys = opt_map.at(iter->second).first; return keys; } set_t<string_t> GetKeys() const { set_t<string_t> keys; for (auto v : key_map) keys.emplace(v.first); return keys; } using const_char_ptr = const string_t::value_type*; result_t Parse(const const_char_ptr* argv, size_type from, unsigned int to) const { return Parse(list_t<string_t>(argv + from, argv + to)); } template<size_type n> result_t Parse(const const_char_ptr(&argv)[n], unsigned int from) const { return Parse(argv, from, n); } template<size_type n> result_t Parse(const const_char_ptr(&argv)[n]) const { return Parse(argv, 0, n); } result_t Parse(const list_t<string_t>& args) const { if (args.empty()) return result_t(state_t::s_nothing, R"(error: don't get any parameter.)"); return _Parse(args, { &Parser::_OnKey, &Parser::_OnValue, &Parser::_OnOptional }); } private: using id_type = unsigned int; using _parse_func_type = size_type(Parser::*)(result_t&, const string_t&, const list_t<string_t>&, string_t&, option_t&) const; id_type option_id{ 0 }; map_t<string_t, id_type> key_map; map_t<id_type, pair_t<set_t<string_t>, option_t>> opt_map; enum { on_key, on_value, on_opt, parse_error }; void _update_option_id() { ++option_id; } const option_t& _Option(const string_t& key) const { return opt_map.at(key_map.at(key)).second; } const set_t<string_t>& _Keys(const string_t& key) const { return opt_map.at(key_map.at(key)).first; } template<size_type n> result_t _Parse(const list_t<string_t>& args, const _parse_func_type(&_parse_functions)[n]) const { string_t key; option_t opt; size_type index(on_key); list_t<string_t> keys; for (auto v : key_map) keys.emplace_back(v.first); std::sort(keys.begin(), keys.end(), [](const string_t& a, const string_t& b) { return (b.size() < a.size()); }); result_t result(state_t::s_ok, "ok"); for (auto arg : args) { if (index < n) index = (this->*_parse_functions[index])(result, arg, keys, key, opt); else break; } switch (index) { case on_opt: result._add_value(key, _Keys(key)); case on_key: _CheckResult(result); break; case on_value: result._set_error(state_t::s_v_missing, key); break; default: break; } return result; } size_type _OnKey(result_t& result, const string_t& arg, const list_t<string_t>& keys, string_t& k, option_t& opt) const { for (auto key : keys) { if (_start_with(arg, key)) { if (_is_perfect_match(arg, key)) return _OnPerfectMatch(result, key, k, opt); if (_is_equation(arg, key)) return _OnEquation(result, key, arg.substr(key.size() + 1), _Option(key)); break; } } result._set_error(state_t::s_k_unrecognized, arg); return parse_error; } size_type _OnValue(result_t& result, const string_t& arg, const list_t<string_t>& keys, string_t& k, option_t& opt) const { return _OnValueEx(result, k, arg, opt); } size_type _OnOptional(result_t& result, const string_t& arg, const list_t<string_t>& keys, string_t& k, option_t& opt) const { if (opt.is_unique()) return _OnValueEx(result, k, arg, opt); for (auto key : keys) { if (_start_with(arg, key)) { if (_is_perfect_match(arg, key)) { result._add_value(k, _Keys(k)); return _OnPerfectMatch(result, key, k, opt); } if (_is_equation(arg, key)) { result._add_value(k, _Keys(k)); return _OnEquation(result, key, arg.substr(key.size() + 1), _Option(key)); } break; } } return _OnValue(result, arg, keys, k, opt); } size_type _OnPerfectMatch(result_t& result, const string_t& key, string_t& k, option_t& opt) const { opt = _Option(key); if (!result._check_key(key, opt)) return parse_error; k = key; if (value_t::vt_nothing == opt.value_type()) { result._add_value(key, nullptr, _Keys(key)); return on_key; } return (opt.is_value_required() ? on_value : on_opt); } size_type _OnEquation(result_t& result, const string_t& key, const string_t& value, const option_t& opt) const { if (!result._check_key(key, opt)) return parse_error; if (value_t::vt_nothing == opt.value_type()) { result._set_error(state_t::s_v_redundant, key); return parse_error; } return _OnValueEx(result, key, value, opt); } size_type _OnValueEx(result_t& result, const string_t& key, const string_t& value, const option_t& opt) const { if (opt.check(value)) { result._add_value(key, value, _Keys(key), opt); return on_key; } result._set_error(state_t::s_v_error, key, value); return parse_error; } bool _RemoveOption(id_type id, const string_t& key) { auto iter = opt_map.find(id); if (iter != opt_map.end()) { iter->second.first.erase(key); if (iter->second.first.empty()) opt_map.erase(iter); return true; } return false; } bool _CheckResult(result_t& result) const { if (state_t::s_ok == result.code()) { if (_Option(result._k_map.cbegin()->first).is_unique()) return true; for (auto opt : opt_map) { if (opt.second.second.is_key_required()) { const string_t& key(*opt.second.first.cbegin()); if (!result.is_existing(key)) { result._set_error(state_t::s_k_missing, key); return false; } } } return true; } return false; } static bool _is_perfect_match(const string_t& text, const string_t& key) { return (text.size() == key.size()); } static bool _is_equation(const string_t& text, const string_t& key) { return ((key.size() + 1) < text.size() && '=' == text[key.size()]); } static bool _start_with(const string_t& a, const string_t& b) { return 0 == a.compare(0, b.size(), b); } }; // class Parser } // namespace xf::cmd
32.533537
135
0.518274
8afbfaa588dbd88095513774f0c07865707f3435
148
h
C
Example/Pods/Target Support Files/SwiftyPopover/SwiftyPopover-umbrella.h
pine613/SwiftyPopover
7fa85fdb34d52b5d2c9ebb682477bc9b19680f11
[ "MIT" ]
null
null
null
Example/Pods/Target Support Files/SwiftyPopover/SwiftyPopover-umbrella.h
pine613/SwiftyPopover
7fa85fdb34d52b5d2c9ebb682477bc9b19680f11
[ "MIT" ]
null
null
null
Example/Pods/Target Support Files/SwiftyPopover/SwiftyPopover-umbrella.h
pine613/SwiftyPopover
7fa85fdb34d52b5d2c9ebb682477bc9b19680f11
[ "MIT" ]
null
null
null
#import <UIKit/UIKit.h> FOUNDATION_EXPORT double SwiftyPopoverVersionNumber; FOUNDATION_EXPORT const unsigned char SwiftyPopoverVersionString[];
21.142857
67
0.851351
8afcdff5e4651ad5ec8d559bb8536a15169a6cf9
1,080
h
C
include/script/initializerlist.h
RugessNome/libscript
e27b1dfeb5cd9eb7e59a6d16e182758a56fc0e4f
[ "MIT" ]
3
2020-12-28T01:40:45.000Z
2021-05-18T01:47:07.000Z
include/script/initializerlist.h
strandfield/libscript
5d413762ad8ce88ff887642f6947032017dd284c
[ "MIT" ]
4
2019-06-29T12:23:11.000Z
2020-07-25T15:38:46.000Z
include/script/initializerlist.h
RugessNome/libscript
e27b1dfeb5cd9eb7e59a6d16e182758a56fc0e4f
[ "MIT" ]
1
2021-11-17T01:49:42.000Z
2021-11-17T01:49:42.000Z
// Copyright (C) 2018 Vincent Chambrin // This file is part of the libscript library // For conditions of distribution and use, see copyright notice in LICENSE #ifndef LIBSCRIPT_INITIALIZER_LIST_H #define LIBSCRIPT_INITIALIZER_LIST_H #include "libscriptdefs.h" #include "script/classtemplatenativebackend.h" namespace script { class Value; class LIBSCRIPT_API InitializerList { private: Value *begin_; Value *end_; public: InitializerList() : begin_(nullptr), end_(nullptr) { } InitializerList(Value *b, Value *e) : begin_(b), end_(e) { } InitializerList(const InitializerList &) = default; ~InitializerList() = default; typedef Value* iterator; inline iterator begin() const { return begin_; } inline iterator end() const { return end_; } size_t size() const; InitializerList & operator=(const InitializerList &) = default; }; class LIBSCRIPT_API InitializerListTemplate : public ClassTemplateNativeBackend { Class instantiate(ClassTemplateInstanceBuilder& builder) override; }; } // namespace script #endif // LIBSCRIPT_INITIALIZER_LIST_H
22.978723
79
0.758333
8afd0f9b44a20fa41876d93eb8277b2185c7463e
5,556
h
C
DS/sorting/sort.h
afatom/core-program
7886acf67f6b81bd06edef41f6ddab83cc993927
[ "MIT" ]
null
null
null
DS/sorting/sort.h
afatom/core-program
7886acf67f6b81bd06edef41f6ddab83cc993927
[ "MIT" ]
null
null
null
DS/sorting/sort.h
afatom/core-program
7886acf67f6b81bd06edef41f6ddab83cc993927
[ "MIT" ]
null
null
null
#ifndef _SORT_H_ #define _SORT_H_ #include <stddef.h> /*size_t*/ #include "ADTDefs.h" struct Person { char m_name[32]; int m_age; }; typedef struct Person Person; /******************************************************************************* *[Description]:Quick Sort Recorsion Sort function. *[Input]:integer array *[Return]:sorted array (smaller first). ERR_OK will returned in success case. *[Errors]:ERR_NOT_INITIALIZED will returned in null array and ERR_GENERAL in *array with size = 0 case. *******************************************************************************/ ADTErr QuickSortRecorsion(int *_arr, size_t _size); /******************************************************************************* *[Description]:Bubble Sort Persons Array. *[Input]:Person array to sort by age. *[Return]:Void-Sorted array by age (younger first) *[Errors]:NONE *******************************************************************************/ void bublePersons(Person *arr, size_t size); /******************************************************************************* *[Description]:Selection Sort Persons Array. *[Input]:Person array to sort by age in selection Sort Algoritm. *[Return]:Sorted array by age (younger first) *[Errors]:ERR_NOT_INITIALIZED will returned in null array and ERR_GENERAL in *array with size = 0 case. *******************************************************************************/ ADTErr SelectionSort(Person *arr, size_t size); /******************************************************************************* *[Description]:Merge Sort Integers Array. *[Input]:Int array to be sorted by merge Sort Algoritm (smaller elements first). *[Return]:Sorted array. *[Errors]:ERR_NOT_INITIALIZED will returned in null array and ERR_GENERAL in *array with size = 0 case. *******************************************************************************/ ADTErr MergeSort(int* _arr, size_t _size); /******************************************************************************* *[Description]:Radix Sort Integers Array. *[Input]:Int array to be sorted by Radix Sort Algoritm (smaller elements first). *[Return]:Sorted array. *[Errors]:ERR_NOT_INITIALIZED will returned in null array and ERR_GENERAL in *array with size = 0 case. *******************************************************************************/ ADTErr RadixSort(int* _arr, size_t _size); /******************************************************************************* *[Description]:Counting Sort Integers Array. *[Input]:Int array to be sorted by Counting Sort Algoritm (smaller elements first). *[Return]:Sorted array. *[Errors]:ERR_NOT_INITIALIZED will returned in null array and ERR_GENERAL in *array with size = 0 case. *******************************************************************************/ ADTErr CountingSort(int* _arr, size_t _size); /******************************************************************************* *[Description]:Modified Counting Sort Integers Array with respect to digit value *[Input]:Int array to be sorted by Counting Sort Algoritm (smaller *elements first). *[Return]:Sorted array. *[Errors]:ERR_NOT_INITIALIZED will returned in null array and ERR_GENERAL in *array with size = 0 case. *******************************************************************************/ ADTErr ModifiedCountingSort(int* _arr, size_t _size, size_t _digit); /******************************************************************************* *[Description]:Merge Sort Integers Array (Iterative Algo) *[Input]:Int array to be sorted by merge Sort Algoritm (smaller elements first). *[Return]:Sorted array. *[Errors]:ERR_NOT_INITIALIZED will returned in null array and ERR_GENERAL in *array with size = 0 case. *******************************************************************************/ ADTErr MergeSortIterativeAlgo(int* _arr, size_t _size); /******************************************************************************* *[Description]:Bubble Sort Strings Array. *[Input]:strings array to sort be sorted, smaller first (sorting with strcmp * function). *[Return]:Void-Sorted array of strings *[Errors]:NONE *******************************************************************************/ void BubbleSortStringsArr(char** arr, size_t size); /******************************************************************************* *[Description]:Shake Sort Strings Array. *[Input]:strings array to sort be sorted, smaller first (sorting with strcmp * function). *[Return]:Void - Sorted array of strings *[Errors]:NONE *******************************************************************************/ void ShakeSortStringsArr(char** arr, size_t size); /******************************************************************************* *[Description]:Insertion Sort integer Array. *[Input]:Int array to be sorted, smaller elements first *[Return]:Void - Sorted array of ints *[Errors]:NONE *******************************************************************************/ void InsertionSort(int* arr, size_t size); /******************************************************************************/ /* Printing Functions */ /* */ /******************************************************************************/ /*Printing integer array elements*/ void print(int* arr, size_t size); /*Printing strings array elements*/ void PrintStrings(char** names, size_t size); #endif /*_SORT_H_*/
47.084746
85
0.473722
8afd1845f0fb7abfce2bd860bf958fed6e296c7d
11,702
c
C
apps/riscv-tests/isa/rv64uv/vwmaccu.c
PolyMTL-Gr2m/ara
da92dee72b615c95e561b3836012cb27036203a1
[ "Apache-2.0" ]
112
2021-03-12T06:16:53.000Z
2022-03-30T07:56:05.000Z
apps/riscv-tests/isa/rv64uv/vwmaccu.c
PolyMTL-Gr2m/ara
da92dee72b615c95e561b3836012cb27036203a1
[ "Apache-2.0" ]
82
2021-03-12T10:07:07.000Z
2022-03-27T15:51:50.000Z
apps/riscv-tests/isa/rv64uv/vwmaccu.c
PolyMTL-Gr2m/ara
da92dee72b615c95e561b3836012cb27036203a1
[ "Apache-2.0" ]
36
2021-03-13T03:39:47.000Z
2022-03-28T07:09:11.000Z
// Copyright 2021 ETH Zurich and University of Bologna. // Solderpad Hardware License, Version 0.51, see LICENSE for details. // SPDX-License-Identifier: SHL-0.51 // // Author: Matheus Cavalcante <matheusd@iis.ee.ethz.ch> // Basile Bougenot <bbougenot@student.ethz.ch> #include "vector_macros.h" void TEST_CASE1() { VSET(16, e16, m1); VLOAD_16(v6, 0x519d, 0x7122, 0x672c, 0x4d97, 0x436e, 0x3f1f, 0x423d, 0x44e8, 0x3d7b, 0x5570, 0x1e90, 0x79f4, 0x456b, 0x0283, 0x02b5, 0x6865); VSET(16, e8, m1); VLOAD_8(v2, 0xce, 0x96, 0x33, 0x88, 0xf8, 0x3f, 0x0c, 0xde, 0x1e, 0x9d, 0x5a, 0x75, 0x73, 0x43, 0xd9, 0x43); VLOAD_8(v4, 0x51, 0x88, 0x16, 0xf6, 0x57, 0xab, 0xd8, 0x26, 0x2e, 0x35, 0x94, 0xd1, 0xf0, 0xb9, 0x09, 0x8a); asm volatile("vwmaccu.vv v6, v2, v4"); VSET(16, e16, m1); VCMP_U16(1, v6, 0x92cb, 0xc0d2, 0x6b8e, 0xd047, 0x97b6, 0x6934, 0x4c5d, 0x65dc, 0x42df, 0x75f1, 0x5298, 0xd979, 0xb13b, 0x32ee, 0x0a56, 0x8c83); VSET(16, e32, m1); VLOAD_32(v6, 0x1f50b763, 0x6d1a7f46, 0x17b8b2b5, 0x6b69c966, 0x25d945cb, 0x3e6c375b, 0x314db8d3, 0x35ade27d, 0x74fa2d58, 0x735f513d, 0x3cad4e4d, 0x628eb81a, 0x1c48c2f9, 0x14f08921, 0x77de05bf, 0x528c354b); VSET(16, e16, m1); VLOAD_16(v2, 0x4ed5, 0xcf74, 0x3442, 0x280f, 0x795e, 0x3007, 0xdf3e, 0xb348, 0x3865, 0xcb59, 0x1291, 0xa04b, 0xc5bd, 0x957f, 0xefe4, 0xe75d); VLOAD_16(v4, 0x7d39, 0xddd8, 0x17d7, 0x0574, 0x251a, 0x4ce4, 0x4817, 0x9de1, 0xd773, 0xdcc8, 0xeb92, 0x8fa8, 0x9382, 0x4369, 0xb1c7, 0x9185); asm volatile("vwmaccu.vv v6, v2, v4"); VSET(16, e32, m1); VCMP_U32(2, v6, 0x45e045d0, 0x20e0ad26, 0x1c968423, 0x6c443b32, 0x37702f57, 0x4cd91197, 0x702b3765, 0xa43e9cc5, 0xa47055b7, 0x22beaac5, 0x4dc2ffff, 0xbc81ce52, 0x8e38b3f3, 0x3c4e1738, 0x1e7523fb, 0xd610159c); VSET(16, e64, m1); VLOAD_64(v6, 0x5118504f9237ea08, 0x6b71d4ee88073dde, 0x4420559f61e6927c, 0x24eea54c6530475c, 0x289211cb16ebbbc9, 0x1a0b2b7644ecd474, 0x159c16af3e71f736, 0x12dda0d2ca288012, 0x790fab107c1346b6, 0x589cc8132c869645, 0x323623bba87568ce, 0x5ce2e94d5e335c5d, 0x6e6b3c19c0d78ca0, 0x0502bed40a0600bc, 0x5ff6f4b3610e009c, 0x40d6eb0605052915); VSET(16, e32, m1); VLOAD_32(v2, 0xd1247b78, 0xfd5d326b, 0x7fe40cf5, 0xfd802d90, 0x9ec23b7e, 0x67219fe8, 0x9dc7f026, 0x257d8b7f, 0x782bc512, 0x42fa808b, 0x48d3273d, 0x7ca0371d, 0x06409254, 0xb77ce3ba, 0x28aac174, 0xd2e4cdbf); VLOAD_32(v4, 0xab3b5969, 0xe91aa966, 0x336c2f4c, 0xfcc75a99, 0x1854180c, 0xeec0354b, 0x8b4595bf, 0x9200fb5c, 0x0d627fcf, 0xdf0a8280, 0x4b5733be, 0x4f3bd496, 0x10f5d788, 0x3499c99d, 0xdeee29dd, 0x7e8643a4); asm volatile("vwmaccu.vv v6, v2, v4"); VSET(16, e64, m1); VCMP_U64(3, v6, 0xdcfc2b3ca5c34640, 0x52260af0834ff780, 0x5dd0d00a7e576638, 0x1f3e3a8021c0226c, 0x37a86e0412f255b1, 0x7a39dcd00fe1b56c, 0x6b728942b1a24190, 0x283f5f30c90c26b6, 0x7f5820d2b91f8e44, 0x92f7bdf9f97b71c5, 0x47a4ceb4fab8af14, 0x83757ab9b866ab5b, 0x6ed5464e986dd540, 0x2ab6573b8294b3ce, 0x8360dddc474a95c0, 0xa91223c6b56bf471); } void TEST_CASE2() { VSET(16, e16, m1); VLOAD_16(v6, 0x519d, 0x7122, 0x672c, 0x4d97, 0x436e, 0x3f1f, 0x423d, 0x44e8, 0x3d7b, 0x5570, 0x1e90, 0x79f4, 0x456b, 0x0283, 0x02b5, 0x6865); VSET(16, e8, m1); VLOAD_8(v2, 0xce, 0x96, 0x33, 0x88, 0xf8, 0x3f, 0x0c, 0xde, 0x1e, 0x9d, 0x5a, 0x75, 0x73, 0x43, 0xd9, 0x43); VLOAD_8(v4, 0x51, 0x88, 0x16, 0xf6, 0x57, 0xab, 0xd8, 0x26, 0x2e, 0x35, 0x94, 0xd1, 0xf0, 0xb9, 0x09, 0x8a); VLOAD_8(v0, 0xAA, 0xAA); asm volatile("vwmaccu.vv v6, v2, v4, v0.t"); VSET(16, e16, m1); VCMP_U16(4, v6, 0x519d, 0xc0d2, 0x672c, 0xd047, 0x436e, 0x6934, 0x423d, 0x65dc, 0x3d7b, 0x75f1, 0x1e90, 0xd979, 0x456b, 0x32ee, 0x02b5, 0x8c83); VSET(16, e32, m1); VLOAD_32(v6, 0x1f50b763, 0x6d1a7f46, 0x17b8b2b5, 0x6b69c966, 0x25d945cb, 0x3e6c375b, 0x314db8d3, 0x35ade27d, 0x74fa2d58, 0x735f513d, 0x3cad4e4d, 0x628eb81a, 0x1c48c2f9, 0x14f08921, 0x77de05bf, 0x528c354b); VSET(16, e16, m1); VLOAD_16(v2, 0x4ed5, 0xcf74, 0x3442, 0x280f, 0x795e, 0x3007, 0xdf3e, 0xb348, 0x3865, 0xcb59, 0x1291, 0xa04b, 0xc5bd, 0x957f, 0xefe4, 0xe75d); VLOAD_16(v4, 0x7d39, 0xddd8, 0x17d7, 0x0574, 0x251a, 0x4ce4, 0x4817, 0x9de1, 0xd773, 0xdcc8, 0xeb92, 0x8fa8, 0x9382, 0x4369, 0xb1c7, 0x9185); VLOAD_8(v0, 0xAA, 0xAA); asm volatile("vwmaccu.vv v6, v2, v4, v0.t"); VSET(16, e32, m1); VCMP_U32(5, v6, 0x1f50b763, 0x20e0ad26, 0x17b8b2b5, 0x6c443b32, 0x25d945cb, 0x4cd91197, 0x314db8d3, 0xa43e9cc5, 0x74fa2d58, 0x22beaac5, 0x3cad4e4d, 0xbc81ce52, 0x1c48c2f9, 0x3c4e1738, 0x77de05bf, 0xd610159c); VSET(16, e64, m1); VLOAD_64(v6, 0x5118504f9237ea08, 0x6b71d4ee88073dde, 0x4420559f61e6927c, 0x24eea54c6530475c, 0x289211cb16ebbbc9, 0x1a0b2b7644ecd474, 0x159c16af3e71f736, 0x12dda0d2ca288012, 0x790fab107c1346b6, 0x589cc8132c869645, 0x323623bba87568ce, 0x5ce2e94d5e335c5d, 0x6e6b3c19c0d78ca0, 0x0502bed40a0600bc, 0x5ff6f4b3610e009c, 0x40d6eb0605052915); VSET(16, e32, m1); VLOAD_32(v2, 0xd1247b78, 0xfd5d326b, 0x7fe40cf5, 0xfd802d90, 0x9ec23b7e, 0x67219fe8, 0x9dc7f026, 0x257d8b7f, 0x782bc512, 0x42fa808b, 0x48d3273d, 0x7ca0371d, 0x06409254, 0xb77ce3ba, 0x28aac174, 0xd2e4cdbf); VLOAD_32(v4, 0xab3b5969, 0xe91aa966, 0x336c2f4c, 0xfcc75a99, 0x1854180c, 0xeec0354b, 0x8b4595bf, 0x9200fb5c, 0x0d627fcf, 0xdf0a8280, 0x4b5733be, 0x4f3bd496, 0x10f5d788, 0x3499c99d, 0xdeee29dd, 0x7e8643a4); VLOAD_8(v0, 0xAA, 0xAA); asm volatile("vwmaccu.vv v6, v2, v4, v0.t"); VSET(16, e64, m1); VCMP_U64(6, v6, 0x5118504f9237ea08, 0x52260af0834ff780, 0x4420559f61e6927c, 0x1f3e3a8021c0226c, 0x289211cb16ebbbc9, 0x7a39dcd00fe1b56c, 0x159c16af3e71f736, 0x283f5f30c90c26b6, 0x790fab107c1346b6, 0x92f7bdf9f97b71c5, 0x323623bba87568ce, 0x83757ab9b866ab5b, 0x6e6b3c19c0d78ca0, 0x2ab6573b8294b3ce, 0x5ff6f4b3610e009c, 0xa91223c6b56bf471); } void TEST_CASE3() { VSET(16, e16, m1); VLOAD_16(v6, 0x6f50, 0x0299, 0x3578, 0x0e45, 0x752b, 0x60c7, 0x7d0c, 0x0943, 0x3f2d, 0x47bc, 0x4468, 0x616d, 0x5844, 0x3a7d, 0x32fe, 0x7813); VSET(16, e8, m1); uint64_t scalar = 5; VLOAD_8(v4, 0x01, 0xd6, 0x1e, 0x57, 0xcc, 0x31, 0x29, 0x06, 0x5a, 0xab, 0x1e, 0x0a, 0x97, 0x6f, 0xe0, 0xfc); asm volatile("vwmaccu.vx v6, %[A], v4" ::[A] "r"(scalar)); VSET(16, e16, m1); VCMP_U16(7, v6, 0x6f55, 0x06c7, 0x360e, 0x0ff8, 0x7927, 0x61bc, 0x7dd9, 0x0961, 0x40ef, 0x4b13, 0x44fe, 0x619f, 0x5b37, 0x3ca8, 0x375e, 0x7cff); VSET(16, e32, m1); VLOAD_32(v6, 0x681721c9, 0x5c07924a, 0x5147143e, 0x14da5785, 0x30a43e20, 0x3498177e, 0x551df71d, 0x29656468, 0x12550807, 0x7dc95cbd, 0x2167ff36, 0x194b0d6c, 0x79119a1d, 0x6d77fab6, 0x3e32c755, 0x6e479bf4); VSET(16, e16, m1); scalar = 5383; VLOAD_16(v4, 0x9752, 0x45a4, 0xfde9, 0xa659, 0x957b, 0x1a3f, 0x2212, 0x5d43, 0xdc08, 0x1fb8, 0x5e15, 0x08da, 0x0468, 0x4458, 0xe1e2, 0x4ef7); asm volatile("vwmaccu.vx v6, %[A], v4" ::[A] "r"(scalar)); VSET(16, e32, m1); VCMP_U32(8, v6, 0x7484ff07, 0x61bfedc6, 0x6622229d, 0x228430f4, 0x3ceb6b7d, 0x36bffa37, 0x57ea5f9b, 0x310e703d, 0x2467b43f, 0x806452c5, 0x29224ac9, 0x1a052d62, 0x796e40f5, 0x7315111e, 0x50c07e83, 0x74c407b5); VSET(16, e64, m1); VLOAD_64(v6, 0x27a0a02f7e9757d4, 0x7ff7bb4d394926a0, 0x09d25e3173571efd, 0x11661c8ece6711ac, 0x1e5ffff32ed851dd, 0x0698334d63d206a9, 0x79598c88fd85995f, 0x2fa78b4b7d90a222, 0x7d65cbfdfc7f2e1d, 0x6c0101ef46924df6, 0x59ff3d4e018b50f4, 0x2c8ec8409f219401, 0x20b183b4bb89c200, 0x28bee831261ca372, 0x5b9d142326bcef0a, 0x1c2ad051e4e7281e); VSET(16, e32, m1); scalar = 6474219; VLOAD_32(v4, 0x307dc235, 0x92187481, 0xa69319d1, 0x682b9abe, 0x8bdce4be, 0x95ec65ce, 0x46915d6f, 0xd59243e6, 0x1d0943e5, 0x3ae27787, 0x33c32e03, 0x8be66da2, 0x0fc78147, 0x2ce8d421, 0x9c9bc2fb, 0x10c8c9f7); asm volatile("vwmaccu.vx v6, %[A], v4" ::[A] "r"(scalar)); VSET(16, e64, m1); VCMP_U64(9, v6, 0x27b3569317ce3b7b, 0x80301be52297620b, 0x0a12a5e3bda6ead8, 0x118e4f69e7a94c16, 0x1e95f8d392f37a47, 0x06d20e0c989e38c3, 0x7974c7d7abd08544, 0x2ff9f5bd60308c44, 0x7d710070e7f94e54, 0x6c17bb12e5fd05e3, 0x5a1336d961fce8b5, 0x2cc4c4ceefc069b7, 0x20b79a86595c2d2d, 0x28d03cbe630746bd, 0x5bd98349d9e5fe73, 0x1c314a6c44597cdb); } void TEST_CASE4() { VSET(16, e16, m1); VLOAD_16(v6, 0x6f50, 0x0299, 0x3578, 0x0e45, 0x752b, 0x60c7, 0x7d0c, 0x0943, 0x3f2d, 0x47bc, 0x4468, 0x616d, 0x5844, 0x3a7d, 0x32fe, 0x7813); VSET(16, e8, m1); uint64_t scalar = 5; VLOAD_8(v4, 0x01, 0xd6, 0x1e, 0x57, 0xcc, 0x31, 0x29, 0x06, 0x5a, 0xab, 0x1e, 0x0a, 0x97, 0x6f, 0xe0, 0xfc); VLOAD_8(v0, 0xAA, 0xAA); asm volatile("vwmaccu.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); VSET(16, e16, m1); VCMP_U16(10, v6, 0x6f50, 0x06c7, 0x3578, 0x0ff8, 0x752b, 0x61bc, 0x7d0c, 0x0961, 0x3f2d, 0x4b13, 0x4468, 0x619f, 0x5844, 0x3ca8, 0x32fe, 0x7cff); VSET(16, e32, m1); VLOAD_32(v6, 0x681721c9, 0x5c07924a, 0x5147143e, 0x14da5785, 0x30a43e20, 0x3498177e, 0x551df71d, 0x29656468, 0x12550807, 0x7dc95cbd, 0x2167ff36, 0x194b0d6c, 0x79119a1d, 0x6d77fab6, 0x3e32c755, 0x6e479bf4); VSET(16, e16, m1); scalar = 5383; VLOAD_16(v4, 0x9752, 0x45a4, 0xfde9, 0xa659, 0x957b, 0x1a3f, 0x2212, 0x5d43, 0xdc08, 0x1fb8, 0x5e15, 0x08da, 0x0468, 0x4458, 0xe1e2, 0x4ef7); VLOAD_8(v0, 0xAA, 0xAA); asm volatile("vwmaccu.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); VSET(16, e32, m1); VCMP_U32(11, v6, 0x681721c9, 0x61bfedc6, 0x5147143e, 0x228430f4, 0x30a43e20, 0x36bffa37, 0x551df71d, 0x310e703d, 0x12550807, 0x806452c5, 0x2167ff36, 0x1a052d62, 0x79119a1d, 0x7315111e, 0x3e32c755, 0x74c407b5); VSET(16, e64, m1); VLOAD_64(v6, 0x27a0a02f7e9757d4, 0x7ff7bb4d394926a0, 0x09d25e3173571efd, 0x11661c8ece6711ac, 0x1e5ffff32ed851dd, 0x0698334d63d206a9, 0x79598c88fd85995f, 0x2fa78b4b7d90a222, 0x7d65cbfdfc7f2e1d, 0x6c0101ef46924df6, 0x59ff3d4e018b50f4, 0x2c8ec8409f219401, 0x20b183b4bb89c200, 0x28bee831261ca372, 0x5b9d142326bcef0a, 0x1c2ad051e4e7281e); VSET(16, e32, m1); scalar = 6474219; VLOAD_32(v4, 0x307dc235, 0x92187481, 0xa69319d1, 0x682b9abe, 0x8bdce4be, 0x95ec65ce, 0x46915d6f, 0xd59243e6, 0x1d0943e5, 0x3ae27787, 0x33c32e03, 0x8be66da2, 0x0fc78147, 0x2ce8d421, 0x9c9bc2fb, 0x10c8c9f7); VLOAD_8(v0, 0xAA, 0xAA); asm volatile("vwmaccu.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); VSET(16, e64, m1); VCMP_U64(12, v6, 0x27a0a02f7e9757d4, 0x80301be52297620b, 0x09d25e3173571efd, 0x118e4f69e7a94c16, 0x1e5ffff32ed851dd, 0x06d20e0c989e38c3, 0x79598c88fd85995f, 0x2ff9f5bd60308c44, 0x7d65cbfdfc7f2e1d, 0x6c17bb12e5fd05e3, 0x59ff3d4e018b50f4, 0x2cc4c4ceefc069b7, 0x20b183b4bb89c200, 0x28d03cbe630746bd, 0x5b9d142326bcef0a, 0x1c314a6c44597cdb); } int main(void) { INIT_CHECK(); enable_vec(); TEST_CASE1(); TEST_CASE2(); TEST_CASE3(); TEST_CASE4(); EXIT_CHECK(); }
46.995984
79
0.683986
8affd693c8d712777830ee3776e31269e5392c0e
3,098
h
C
lib/NoesisGUI-2.2.0/Include/NsGui/Brush.h
guillaume-haerinck/imac-tower-defense
365a32642ea0d3ad8b2b7d63347d585c44d9f670
[ "MIT" ]
44
2019-06-06T21:33:30.000Z
2022-03-26T06:18:23.000Z
Dependencies/NoesisGUI/Include/NsGui/Brush.h
IbexOmega/LambdaEngine
f60f01aaf9c988e4da8990dc1ef3caac20cecf7e
[ "MIT" ]
32
2020-09-12T19:24:50.000Z
2020-12-11T14:29:44.000Z
Dependencies/NoesisGUI/Include/NsGui/Brush.h
IbexOmega/LambdaEngine
f60f01aaf9c988e4da8990dc1ef3caac20cecf7e
[ "MIT" ]
8
2019-07-26T16:44:26.000Z
2020-11-24T17:56:18.000Z
//////////////////////////////////////////////////////////////////////////////////////////////////// // NoesisGUI - http://www.noesisengine.com // Copyright (c) 2013 Noesis Technologies S.L. All Rights Reserved. //////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef __GUI_BRUSH_H__ #define __GUI_BRUSH_H__ #include <NsCore/Noesis.h> #include <NsGui/CoreApi.h> #include <NsGui/Animatable.h> #include <NsGui/IRenderProxyCreator.h> namespace Noesis { class Transform; struct BrushProxy; NS_WARNING_PUSH NS_MSVC_WARNING_DISABLE(4251 4275) //////////////////////////////////////////////////////////////////////////////////////////////////// /// Defines objects used to paint graphical objects. Classes that derive from Brush describe how /// the area is painted. /// /// http://msdn.microsoft.com/en-us/library/system.windows.media.brush.aspx //////////////////////////////////////////////////////////////////////////////////////////////////// class NS_GUI_CORE_API Brush: public Animatable, public IRenderProxyCreator { public: NS_DISABLE_COPY(Brush) Brush(); virtual ~Brush() = 0; /// Use this method to convert a Color string into a SolidColorBrush static bool TryParse(const char* str, Ptr<Brush>& brush); /// Get/Set Opacity //@{ float GetOpacity() const; void SetOpacity(float opacity); //@} /// Gets or sets the transformation that is applied to the brush using relative coordinates //@{ Transform* GetRelativeTransform() const; void SetRelativeTransform(Transform* transform); //@} /// Gets or sets the transformation that is applied to the brush. This transformation is /// applied after the brush's output has been mapped and positioned //@{ Transform* GetTransform() const; void SetTransform(Transform* transform); //@} /// Indicates if this brush is transparent bool IsTransparent() const; /// From Freezable //@{ Ptr<Brush> Clone() const; Ptr<Brush> CloneCurrentValue() const; //@} /// From IRenderProxyCreator //@{ void UpdateRenderProxy(RenderTreeUpdater& updater, uint32_t proxyIndex) override; void UnregisterRenderer(ViewId viewId) override; //@} NS_IMPLEMENT_INTERFACE_FIXUP public: /// Dependency properties //@{ static const DependencyProperty* OpacityProperty; static const DependencyProperty* RelativeTransformProperty; static const DependencyProperty* TransformProperty; //@} protected: virtual bool IsTransparentOverride() const; /// From DependencyObject //@{ bool OnPropertyChanged(const DependencyPropertyChangedEventArgs& args) override; bool OnSubPropertyChanged(const DependencyProperty* dp) override; //@} protected: RenderProxyCreatorFlags mUpdateFlags; enum UpdateFlags { UpdateFlags_Opacity, UpdateFlags_RelativeTransform, UpdateFlags_Transform, UpdateFlags_Sentinel }; private: NS_DECLARE_REFLECTION(Brush, Animatable) }; NS_WARNING_POP } #endif
26.478632
100
0.618464
c100055c035ca699bf23bde5c7ba5c95867e32a3
29,018
h
C
aws-cpp-sdk-imagebuilder/include/aws/imagebuilder/model/InfrastructureConfiguration.h
fboranek/aws-sdk-cpp
2aa01e7d5c5431d9702caf9bf21f4e07b6ef15ae
[ "Apache-2.0" ]
null
null
null
aws-cpp-sdk-imagebuilder/include/aws/imagebuilder/model/InfrastructureConfiguration.h
fboranek/aws-sdk-cpp
2aa01e7d5c5431d9702caf9bf21f4e07b6ef15ae
[ "Apache-2.0" ]
null
null
null
aws-cpp-sdk-imagebuilder/include/aws/imagebuilder/model/InfrastructureConfiguration.h
fboranek/aws-sdk-cpp
2aa01e7d5c5431d9702caf9bf21f4e07b6ef15ae
[ "Apache-2.0" ]
null
null
null
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/imagebuilder/Imagebuilder_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <aws/imagebuilder/model/Logging.h> #include <aws/core/utils/memory/stl/AWSMap.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace imagebuilder { namespace Model { /** * <p>Details of the infrastructure configuration.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/imagebuilder-2019-12-02/InfrastructureConfiguration">AWS * API Reference</a></p> */ class AWS_IMAGEBUILDER_API InfrastructureConfiguration { public: InfrastructureConfiguration(); InfrastructureConfiguration(Aws::Utils::Json::JsonView jsonValue); InfrastructureConfiguration& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>The Amazon Resource Name (ARN) of the infrastructure configuration.</p> */ inline const Aws::String& GetArn() const{ return m_arn; } /** * <p>The Amazon Resource Name (ARN) of the infrastructure configuration.</p> */ inline bool ArnHasBeenSet() const { return m_arnHasBeenSet; } /** * <p>The Amazon Resource Name (ARN) of the infrastructure configuration.</p> */ inline void SetArn(const Aws::String& value) { m_arnHasBeenSet = true; m_arn = value; } /** * <p>The Amazon Resource Name (ARN) of the infrastructure configuration.</p> */ inline void SetArn(Aws::String&& value) { m_arnHasBeenSet = true; m_arn = std::move(value); } /** * <p>The Amazon Resource Name (ARN) of the infrastructure configuration.</p> */ inline void SetArn(const char* value) { m_arnHasBeenSet = true; m_arn.assign(value); } /** * <p>The Amazon Resource Name (ARN) of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithArn(const Aws::String& value) { SetArn(value); return *this;} /** * <p>The Amazon Resource Name (ARN) of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;} /** * <p>The Amazon Resource Name (ARN) of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithArn(const char* value) { SetArn(value); return *this;} /** * <p>The name of the infrastructure configuration.</p> */ inline const Aws::String& GetName() const{ return m_name; } /** * <p>The name of the infrastructure configuration.</p> */ inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } /** * <p>The name of the infrastructure configuration.</p> */ inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } /** * <p>The name of the infrastructure configuration.</p> */ inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } /** * <p>The name of the infrastructure configuration.</p> */ inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } /** * <p>The name of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithName(const Aws::String& value) { SetName(value); return *this;} /** * <p>The name of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} /** * <p>The name of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithName(const char* value) { SetName(value); return *this;} /** * <p>The description of the infrastructure configuration.</p> */ inline const Aws::String& GetDescription() const{ return m_description; } /** * <p>The description of the infrastructure configuration.</p> */ inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; } /** * <p>The description of the infrastructure configuration.</p> */ inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; } /** * <p>The description of the infrastructure configuration.</p> */ inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); } /** * <p>The description of the infrastructure configuration.</p> */ inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); } /** * <p>The description of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithDescription(const Aws::String& value) { SetDescription(value); return *this;} /** * <p>The description of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;} /** * <p>The description of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithDescription(const char* value) { SetDescription(value); return *this;} /** * <p>The instance types of the infrastructure configuration.</p> */ inline const Aws::Vector<Aws::String>& GetInstanceTypes() const{ return m_instanceTypes; } /** * <p>The instance types of the infrastructure configuration.</p> */ inline bool InstanceTypesHasBeenSet() const { return m_instanceTypesHasBeenSet; } /** * <p>The instance types of the infrastructure configuration.</p> */ inline void SetInstanceTypes(const Aws::Vector<Aws::String>& value) { m_instanceTypesHasBeenSet = true; m_instanceTypes = value; } /** * <p>The instance types of the infrastructure configuration.</p> */ inline void SetInstanceTypes(Aws::Vector<Aws::String>&& value) { m_instanceTypesHasBeenSet = true; m_instanceTypes = std::move(value); } /** * <p>The instance types of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithInstanceTypes(const Aws::Vector<Aws::String>& value) { SetInstanceTypes(value); return *this;} /** * <p>The instance types of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithInstanceTypes(Aws::Vector<Aws::String>&& value) { SetInstanceTypes(std::move(value)); return *this;} /** * <p>The instance types of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& AddInstanceTypes(const Aws::String& value) { m_instanceTypesHasBeenSet = true; m_instanceTypes.push_back(value); return *this; } /** * <p>The instance types of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& AddInstanceTypes(Aws::String&& value) { m_instanceTypesHasBeenSet = true; m_instanceTypes.push_back(std::move(value)); return *this; } /** * <p>The instance types of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& AddInstanceTypes(const char* value) { m_instanceTypesHasBeenSet = true; m_instanceTypes.push_back(value); return *this; } /** * <p>The instance profile of the infrastructure configuration.</p> */ inline const Aws::String& GetInstanceProfileName() const{ return m_instanceProfileName; } /** * <p>The instance profile of the infrastructure configuration.</p> */ inline bool InstanceProfileNameHasBeenSet() const { return m_instanceProfileNameHasBeenSet; } /** * <p>The instance profile of the infrastructure configuration.</p> */ inline void SetInstanceProfileName(const Aws::String& value) { m_instanceProfileNameHasBeenSet = true; m_instanceProfileName = value; } /** * <p>The instance profile of the infrastructure configuration.</p> */ inline void SetInstanceProfileName(Aws::String&& value) { m_instanceProfileNameHasBeenSet = true; m_instanceProfileName = std::move(value); } /** * <p>The instance profile of the infrastructure configuration.</p> */ inline void SetInstanceProfileName(const char* value) { m_instanceProfileNameHasBeenSet = true; m_instanceProfileName.assign(value); } /** * <p>The instance profile of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithInstanceProfileName(const Aws::String& value) { SetInstanceProfileName(value); return *this;} /** * <p>The instance profile of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithInstanceProfileName(Aws::String&& value) { SetInstanceProfileName(std::move(value)); return *this;} /** * <p>The instance profile of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithInstanceProfileName(const char* value) { SetInstanceProfileName(value); return *this;} /** * <p>The security group IDs of the infrastructure configuration.</p> */ inline const Aws::Vector<Aws::String>& GetSecurityGroupIds() const{ return m_securityGroupIds; } /** * <p>The security group IDs of the infrastructure configuration.</p> */ inline bool SecurityGroupIdsHasBeenSet() const { return m_securityGroupIdsHasBeenSet; } /** * <p>The security group IDs of the infrastructure configuration.</p> */ inline void SetSecurityGroupIds(const Aws::Vector<Aws::String>& value) { m_securityGroupIdsHasBeenSet = true; m_securityGroupIds = value; } /** * <p>The security group IDs of the infrastructure configuration.</p> */ inline void SetSecurityGroupIds(Aws::Vector<Aws::String>&& value) { m_securityGroupIdsHasBeenSet = true; m_securityGroupIds = std::move(value); } /** * <p>The security group IDs of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithSecurityGroupIds(const Aws::Vector<Aws::String>& value) { SetSecurityGroupIds(value); return *this;} /** * <p>The security group IDs of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithSecurityGroupIds(Aws::Vector<Aws::String>&& value) { SetSecurityGroupIds(std::move(value)); return *this;} /** * <p>The security group IDs of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& AddSecurityGroupIds(const Aws::String& value) { m_securityGroupIdsHasBeenSet = true; m_securityGroupIds.push_back(value); return *this; } /** * <p>The security group IDs of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& AddSecurityGroupIds(Aws::String&& value) { m_securityGroupIdsHasBeenSet = true; m_securityGroupIds.push_back(std::move(value)); return *this; } /** * <p>The security group IDs of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& AddSecurityGroupIds(const char* value) { m_securityGroupIdsHasBeenSet = true; m_securityGroupIds.push_back(value); return *this; } /** * <p>The subnet ID of the infrastructure configuration.</p> */ inline const Aws::String& GetSubnetId() const{ return m_subnetId; } /** * <p>The subnet ID of the infrastructure configuration.</p> */ inline bool SubnetIdHasBeenSet() const { return m_subnetIdHasBeenSet; } /** * <p>The subnet ID of the infrastructure configuration.</p> */ inline void SetSubnetId(const Aws::String& value) { m_subnetIdHasBeenSet = true; m_subnetId = value; } /** * <p>The subnet ID of the infrastructure configuration.</p> */ inline void SetSubnetId(Aws::String&& value) { m_subnetIdHasBeenSet = true; m_subnetId = std::move(value); } /** * <p>The subnet ID of the infrastructure configuration.</p> */ inline void SetSubnetId(const char* value) { m_subnetIdHasBeenSet = true; m_subnetId.assign(value); } /** * <p>The subnet ID of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithSubnetId(const Aws::String& value) { SetSubnetId(value); return *this;} /** * <p>The subnet ID of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithSubnetId(Aws::String&& value) { SetSubnetId(std::move(value)); return *this;} /** * <p>The subnet ID of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithSubnetId(const char* value) { SetSubnetId(value); return *this;} /** * <p>The logging configuration of the infrastructure configuration.</p> */ inline const Logging& GetLogging() const{ return m_logging; } /** * <p>The logging configuration of the infrastructure configuration.</p> */ inline bool LoggingHasBeenSet() const { return m_loggingHasBeenSet; } /** * <p>The logging configuration of the infrastructure configuration.</p> */ inline void SetLogging(const Logging& value) { m_loggingHasBeenSet = true; m_logging = value; } /** * <p>The logging configuration of the infrastructure configuration.</p> */ inline void SetLogging(Logging&& value) { m_loggingHasBeenSet = true; m_logging = std::move(value); } /** * <p>The logging configuration of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithLogging(const Logging& value) { SetLogging(value); return *this;} /** * <p>The logging configuration of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithLogging(Logging&& value) { SetLogging(std::move(value)); return *this;} /** * <p>The Amazon EC2 key pair of the infrastructure configuration.</p> */ inline const Aws::String& GetKeyPair() const{ return m_keyPair; } /** * <p>The Amazon EC2 key pair of the infrastructure configuration.</p> */ inline bool KeyPairHasBeenSet() const { return m_keyPairHasBeenSet; } /** * <p>The Amazon EC2 key pair of the infrastructure configuration.</p> */ inline void SetKeyPair(const Aws::String& value) { m_keyPairHasBeenSet = true; m_keyPair = value; } /** * <p>The Amazon EC2 key pair of the infrastructure configuration.</p> */ inline void SetKeyPair(Aws::String&& value) { m_keyPairHasBeenSet = true; m_keyPair = std::move(value); } /** * <p>The Amazon EC2 key pair of the infrastructure configuration.</p> */ inline void SetKeyPair(const char* value) { m_keyPairHasBeenSet = true; m_keyPair.assign(value); } /** * <p>The Amazon EC2 key pair of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithKeyPair(const Aws::String& value) { SetKeyPair(value); return *this;} /** * <p>The Amazon EC2 key pair of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithKeyPair(Aws::String&& value) { SetKeyPair(std::move(value)); return *this;} /** * <p>The Amazon EC2 key pair of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithKeyPair(const char* value) { SetKeyPair(value); return *this;} /** * <p>The terminate instance on failure configuration of the infrastructure * configuration.</p> */ inline bool GetTerminateInstanceOnFailure() const{ return m_terminateInstanceOnFailure; } /** * <p>The terminate instance on failure configuration of the infrastructure * configuration.</p> */ inline bool TerminateInstanceOnFailureHasBeenSet() const { return m_terminateInstanceOnFailureHasBeenSet; } /** * <p>The terminate instance on failure configuration of the infrastructure * configuration.</p> */ inline void SetTerminateInstanceOnFailure(bool value) { m_terminateInstanceOnFailureHasBeenSet = true; m_terminateInstanceOnFailure = value; } /** * <p>The terminate instance on failure configuration of the infrastructure * configuration.</p> */ inline InfrastructureConfiguration& WithTerminateInstanceOnFailure(bool value) { SetTerminateInstanceOnFailure(value); return *this;} /** * <p>The SNS topic Amazon Resource Name (ARN) of the infrastructure * configuration.</p> */ inline const Aws::String& GetSnsTopicArn() const{ return m_snsTopicArn; } /** * <p>The SNS topic Amazon Resource Name (ARN) of the infrastructure * configuration.</p> */ inline bool SnsTopicArnHasBeenSet() const { return m_snsTopicArnHasBeenSet; } /** * <p>The SNS topic Amazon Resource Name (ARN) of the infrastructure * configuration.</p> */ inline void SetSnsTopicArn(const Aws::String& value) { m_snsTopicArnHasBeenSet = true; m_snsTopicArn = value; } /** * <p>The SNS topic Amazon Resource Name (ARN) of the infrastructure * configuration.</p> */ inline void SetSnsTopicArn(Aws::String&& value) { m_snsTopicArnHasBeenSet = true; m_snsTopicArn = std::move(value); } /** * <p>The SNS topic Amazon Resource Name (ARN) of the infrastructure * configuration.</p> */ inline void SetSnsTopicArn(const char* value) { m_snsTopicArnHasBeenSet = true; m_snsTopicArn.assign(value); } /** * <p>The SNS topic Amazon Resource Name (ARN) of the infrastructure * configuration.</p> */ inline InfrastructureConfiguration& WithSnsTopicArn(const Aws::String& value) { SetSnsTopicArn(value); return *this;} /** * <p>The SNS topic Amazon Resource Name (ARN) of the infrastructure * configuration.</p> */ inline InfrastructureConfiguration& WithSnsTopicArn(Aws::String&& value) { SetSnsTopicArn(std::move(value)); return *this;} /** * <p>The SNS topic Amazon Resource Name (ARN) of the infrastructure * configuration.</p> */ inline InfrastructureConfiguration& WithSnsTopicArn(const char* value) { SetSnsTopicArn(value); return *this;} /** * <p>The date on which the infrastructure configuration was created.</p> */ inline const Aws::String& GetDateCreated() const{ return m_dateCreated; } /** * <p>The date on which the infrastructure configuration was created.</p> */ inline bool DateCreatedHasBeenSet() const { return m_dateCreatedHasBeenSet; } /** * <p>The date on which the infrastructure configuration was created.</p> */ inline void SetDateCreated(const Aws::String& value) { m_dateCreatedHasBeenSet = true; m_dateCreated = value; } /** * <p>The date on which the infrastructure configuration was created.</p> */ inline void SetDateCreated(Aws::String&& value) { m_dateCreatedHasBeenSet = true; m_dateCreated = std::move(value); } /** * <p>The date on which the infrastructure configuration was created.</p> */ inline void SetDateCreated(const char* value) { m_dateCreatedHasBeenSet = true; m_dateCreated.assign(value); } /** * <p>The date on which the infrastructure configuration was created.</p> */ inline InfrastructureConfiguration& WithDateCreated(const Aws::String& value) { SetDateCreated(value); return *this;} /** * <p>The date on which the infrastructure configuration was created.</p> */ inline InfrastructureConfiguration& WithDateCreated(Aws::String&& value) { SetDateCreated(std::move(value)); return *this;} /** * <p>The date on which the infrastructure configuration was created.</p> */ inline InfrastructureConfiguration& WithDateCreated(const char* value) { SetDateCreated(value); return *this;} /** * <p>The date on which the infrastructure configuration was last updated.</p> */ inline const Aws::String& GetDateUpdated() const{ return m_dateUpdated; } /** * <p>The date on which the infrastructure configuration was last updated.</p> */ inline bool DateUpdatedHasBeenSet() const { return m_dateUpdatedHasBeenSet; } /** * <p>The date on which the infrastructure configuration was last updated.</p> */ inline void SetDateUpdated(const Aws::String& value) { m_dateUpdatedHasBeenSet = true; m_dateUpdated = value; } /** * <p>The date on which the infrastructure configuration was last updated.</p> */ inline void SetDateUpdated(Aws::String&& value) { m_dateUpdatedHasBeenSet = true; m_dateUpdated = std::move(value); } /** * <p>The date on which the infrastructure configuration was last updated.</p> */ inline void SetDateUpdated(const char* value) { m_dateUpdatedHasBeenSet = true; m_dateUpdated.assign(value); } /** * <p>The date on which the infrastructure configuration was last updated.</p> */ inline InfrastructureConfiguration& WithDateUpdated(const Aws::String& value) { SetDateUpdated(value); return *this;} /** * <p>The date on which the infrastructure configuration was last updated.</p> */ inline InfrastructureConfiguration& WithDateUpdated(Aws::String&& value) { SetDateUpdated(std::move(value)); return *this;} /** * <p>The date on which the infrastructure configuration was last updated.</p> */ inline InfrastructureConfiguration& WithDateUpdated(const char* value) { SetDateUpdated(value); return *this;} /** * <p>The tags attached to the resource created by Image Builder.</p> */ inline const Aws::Map<Aws::String, Aws::String>& GetResourceTags() const{ return m_resourceTags; } /** * <p>The tags attached to the resource created by Image Builder.</p> */ inline bool ResourceTagsHasBeenSet() const { return m_resourceTagsHasBeenSet; } /** * <p>The tags attached to the resource created by Image Builder.</p> */ inline void SetResourceTags(const Aws::Map<Aws::String, Aws::String>& value) { m_resourceTagsHasBeenSet = true; m_resourceTags = value; } /** * <p>The tags attached to the resource created by Image Builder.</p> */ inline void SetResourceTags(Aws::Map<Aws::String, Aws::String>&& value) { m_resourceTagsHasBeenSet = true; m_resourceTags = std::move(value); } /** * <p>The tags attached to the resource created by Image Builder.</p> */ inline InfrastructureConfiguration& WithResourceTags(const Aws::Map<Aws::String, Aws::String>& value) { SetResourceTags(value); return *this;} /** * <p>The tags attached to the resource created by Image Builder.</p> */ inline InfrastructureConfiguration& WithResourceTags(Aws::Map<Aws::String, Aws::String>&& value) { SetResourceTags(std::move(value)); return *this;} /** * <p>The tags attached to the resource created by Image Builder.</p> */ inline InfrastructureConfiguration& AddResourceTags(const Aws::String& key, const Aws::String& value) { m_resourceTagsHasBeenSet = true; m_resourceTags.emplace(key, value); return *this; } /** * <p>The tags attached to the resource created by Image Builder.</p> */ inline InfrastructureConfiguration& AddResourceTags(Aws::String&& key, const Aws::String& value) { m_resourceTagsHasBeenSet = true; m_resourceTags.emplace(std::move(key), value); return *this; } /** * <p>The tags attached to the resource created by Image Builder.</p> */ inline InfrastructureConfiguration& AddResourceTags(const Aws::String& key, Aws::String&& value) { m_resourceTagsHasBeenSet = true; m_resourceTags.emplace(key, std::move(value)); return *this; } /** * <p>The tags attached to the resource created by Image Builder.</p> */ inline InfrastructureConfiguration& AddResourceTags(Aws::String&& key, Aws::String&& value) { m_resourceTagsHasBeenSet = true; m_resourceTags.emplace(std::move(key), std::move(value)); return *this; } /** * <p>The tags attached to the resource created by Image Builder.</p> */ inline InfrastructureConfiguration& AddResourceTags(const char* key, Aws::String&& value) { m_resourceTagsHasBeenSet = true; m_resourceTags.emplace(key, std::move(value)); return *this; } /** * <p>The tags attached to the resource created by Image Builder.</p> */ inline InfrastructureConfiguration& AddResourceTags(Aws::String&& key, const char* value) { m_resourceTagsHasBeenSet = true; m_resourceTags.emplace(std::move(key), value); return *this; } /** * <p>The tags attached to the resource created by Image Builder.</p> */ inline InfrastructureConfiguration& AddResourceTags(const char* key, const char* value) { m_resourceTagsHasBeenSet = true; m_resourceTags.emplace(key, value); return *this; } /** * <p>The tags of the infrastructure configuration.</p> */ inline const Aws::Map<Aws::String, Aws::String>& GetTags() const{ return m_tags; } /** * <p>The tags of the infrastructure configuration.</p> */ inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } /** * <p>The tags of the infrastructure configuration.</p> */ inline void SetTags(const Aws::Map<Aws::String, Aws::String>& value) { m_tagsHasBeenSet = true; m_tags = value; } /** * <p>The tags of the infrastructure configuration.</p> */ inline void SetTags(Aws::Map<Aws::String, Aws::String>&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } /** * <p>The tags of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithTags(const Aws::Map<Aws::String, Aws::String>& value) { SetTags(value); return *this;} /** * <p>The tags of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& WithTags(Aws::Map<Aws::String, Aws::String>&& value) { SetTags(std::move(value)); return *this;} /** * <p>The tags of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& AddTags(const Aws::String& key, const Aws::String& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, value); return *this; } /** * <p>The tags of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& AddTags(Aws::String&& key, const Aws::String& value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), value); return *this; } /** * <p>The tags of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& AddTags(const Aws::String& key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, std::move(value)); return *this; } /** * <p>The tags of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& AddTags(Aws::String&& key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), std::move(value)); return *this; } /** * <p>The tags of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& AddTags(const char* key, Aws::String&& value) { m_tagsHasBeenSet = true; m_tags.emplace(key, std::move(value)); return *this; } /** * <p>The tags of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& AddTags(Aws::String&& key, const char* value) { m_tagsHasBeenSet = true; m_tags.emplace(std::move(key), value); return *this; } /** * <p>The tags of the infrastructure configuration.</p> */ inline InfrastructureConfiguration& AddTags(const char* key, const char* value) { m_tagsHasBeenSet = true; m_tags.emplace(key, value); return *this; } private: Aws::String m_arn; bool m_arnHasBeenSet; Aws::String m_name; bool m_nameHasBeenSet; Aws::String m_description; bool m_descriptionHasBeenSet; Aws::Vector<Aws::String> m_instanceTypes; bool m_instanceTypesHasBeenSet; Aws::String m_instanceProfileName; bool m_instanceProfileNameHasBeenSet; Aws::Vector<Aws::String> m_securityGroupIds; bool m_securityGroupIdsHasBeenSet; Aws::String m_subnetId; bool m_subnetIdHasBeenSet; Logging m_logging; bool m_loggingHasBeenSet; Aws::String m_keyPair; bool m_keyPairHasBeenSet; bool m_terminateInstanceOnFailure; bool m_terminateInstanceOnFailureHasBeenSet; Aws::String m_snsTopicArn; bool m_snsTopicArnHasBeenSet; Aws::String m_dateCreated; bool m_dateCreatedHasBeenSet; Aws::String m_dateUpdated; bool m_dateUpdatedHasBeenSet; Aws::Map<Aws::String, Aws::String> m_resourceTags; bool m_resourceTagsHasBeenSet; Aws::Map<Aws::String, Aws::String> m_tags; bool m_tagsHasBeenSet; }; } // namespace Model } // namespace imagebuilder } // namespace Aws
38.690667
204
0.685471
c106928980cbaa979ddd03fc5c0dd6cadba3efd5
896
c
C
examples/c/nullptr/nullptr7.c
tunz/chow
66a78e231ffe1afcaf7bad8abcc981b97dd1e9d2
[ "MIT" ]
11
2018-03-10T15:23:12.000Z
2020-03-22T19:12:13.000Z
examples/c/nullptr/nullptr7.c
tunz/chow
66a78e231ffe1afcaf7bad8abcc981b97dd1e9d2
[ "MIT" ]
null
null
null
examples/c/nullptr/nullptr7.c
tunz/chow
66a78e231ffe1afcaf7bad8abcc981b97dd1e9d2
[ "MIT" ]
1
2019-01-28T21:23:20.000Z
2019-01-28T21:23:20.000Z
#include <stdio.h> #include <stdlib.h> struct some_struct { int elem1; int elem2; int *ptrelem; struct some_struct *next; }; typedef struct some_struct MyStruct; void case7(MyStruct *ptr) { struct some_struct *p; // False positive case MyStruct *a, *p2 = NULL, *p3 = NULL; // False positive case a = NULL; if (a != 0) return; p = ptr; p = p->next; // False positive case printf("%d\n", p->elem1); // False positive case printf("%d\n", p2 && p2->elem1); // False positive case printf("%d\n", !p2 || p2->elem1); // False positive case printf("%d\n", (p3 || p2) && p2->elem1); // XXX: null-pointer-dereference p = malloc(p->elem1); if (!p) { printf("nono\n"); } if (!p2) { printf("nono\n"); } } int main() { int val = 10; MyStruct* ptr = malloc(sizeof(MyStruct)); ptr->elem1 = 1; ptr->elem2 = 1; ptr->ptrelem = &val; case7(NULL); }
20.837209
75
0.590402
c107b06726236bbca72956b6dc3de99235be8bc4
2,693
h
C
src/ps.h
xcgoner/parameter_server
ce317bc2c657909270fc740f7dcdf9a5f45c3d1a
[ "Apache-2.0" ]
435
2015-03-17T19:32:35.000Z
2022-02-20T13:18:01.000Z
src/ps.h
xcgoner/parameter_server
ce317bc2c657909270fc740f7dcdf9a5f45c3d1a
[ "Apache-2.0" ]
19
2015-03-18T01:22:36.000Z
2021-03-16T21:34:55.000Z
src/ps.h
xcgoner/parameter_server
ce317bc2c657909270fc740f7dcdf9a5f45c3d1a
[ "Apache-2.0" ]
182
2015-03-17T17:49:09.000Z
2021-12-09T20:09:33.000Z
#pragma once #include "system/customer.h" // A simple interface for writing parameter server (PS) programs. see example in // src/app/hello_world // A typical PS program should define the following two functions: // This is the main entrance for a work node. All flags and their arguments // (e.g. -name value) has been removed from argv, and argc has been changed // properly. However, commandline arguments are remained. // // In example "head -n 100 file", -n is a flag and 100 is this flag's argument, // but file is a commandline argument int WorkerNodeMain(int argc, char *argv[]); namespace PS { // Return an instance of a server node. This node is started with "-app_file // app.conf -app_conf 'key: value'", then conf has both the content of file "app.conf" // and 'key:value' App* CreateServerNode(const std::string& conf); // Utility functions: // The app this node runs inline App* MyApp() { return Postoffice::instance().manager().app(); } // My node information inline Node MyNode() { return Postoffice::instance().manager().van().my_node(); } // Each unique string id of my node inline std::string MyNodeID() { return MyNode().id(); } // Query the role of this node inline int IsWorker() { return MyNode().role() == Node::WORKER; } inline int IsServer() { return MyNode().role() == Node::SERVER; } inline int IsScheduler() { return MyNode().role() == Node::SCHEDULER; } inline Range<Key> MyKeyRange() { return Range<Key>(MyNode().key()); } inline std::string SchedulerID() { return Postoffice::instance().manager().van().scheduler().id(); } inline int NextCustomerID() { return Postoffice::instance().manager().NextCustomerID(); } // The rank ID of this node in its group. Assume this a worker node in a worker // group with N workers. Then this node will be assigned an unique ID from 0, // ..., N. Similarly for server and scheduler. inline int MyRank() { return MyNode().rank(); } // Total nodes in this node group. inline int RankSize() { auto& mng = Postoffice::instance().manager(); return IsWorker() ? mng.num_workers() : (IsServer() ? mng.num_servers() : 1); } // Wait until all FLAGS_num_servers servers are ready. inline void WaitServersReady() { PS::Postoffice::instance().manager().WaitServersReady(); } // Wait until all FLAGS_num_workers workers are ready. inline void WaitWorkersReady() { PS::Postoffice::instance().manager().WaitWorkersReady(); } inline void StartSystem(int argc, char *argv[]) { PS::Postoffice::instance().Run(&argc, &argv); } inline void StopSystem() { PS::Postoffice::instance().Stop(); } inline int RunSystem(int argc, char *argv[]) { StartSystem(argc, argv); StopSystem(); return 0; } } // namespace PS
33.246914
86
0.705162
c109226147a68cdb374a6e9e6d0d8ca73c3f8e3e
292
h
C
src/event_trigger.h
elgranmontoya/criptodatabase
cf009cc584ba7368b0f1a9d205e40937958b52da
[ "Apache-2.0" ]
1
2020-10-25T08:41:19.000Z
2020-10-25T08:41:19.000Z
src/event_trigger.h
elgranmontoya/criptodatabase
cf009cc584ba7368b0f1a9d205e40937958b52da
[ "Apache-2.0" ]
null
null
null
src/event_trigger.h
elgranmontoya/criptodatabase
cf009cc584ba7368b0f1a9d205e40937958b52da
[ "Apache-2.0" ]
null
null
null
#ifndef TIMESCALEDB_EVENT_TRIGGER_H #define TIMESCALEDB_EVENT_TRIGGER_H #include <postgres.h> #include <nodes/pg_list.h> extern List *event_trigger_ddl_commands(void); extern void _event_trigger_init(void); extern void _event_trigger_fini(void); #endif /* TIMESCALEDB_EVENT_TRIGGER_H */
24.333333
46
0.821918
c10a6477435d9473d970d2e7bea2fd79ee31e2ed
1,041
h
C
src/unique_identifier_msgs/msg/detail/uuid__struct.h
kajMork/micro_ros_arduino
c7531a5d87e5a42a94879c936f3e25508869cab9
[ "Apache-2.0" ]
178
2020-10-28T17:42:00.000Z
2022-03-27T16:14:15.000Z
src/unique_identifier_msgs/msg/detail/uuid__struct.h
kajMork/micro_ros_arduino
c7531a5d87e5a42a94879c936f3e25508869cab9
[ "Apache-2.0" ]
176
2020-10-23T12:26:12.000Z
2022-03-31T19:08:11.000Z
src/unique_identifier_msgs/msg/detail/uuid__struct.h
kajMork/micro_ros_arduino
c7531a5d87e5a42a94879c936f3e25508869cab9
[ "Apache-2.0" ]
54
2020-11-03T06:25:59.000Z
2022-03-18T22:59:29.000Z
// generated from rosidl_generator_c/resource/idl__struct.h.em // with input from unique_identifier_msgs:msg/UUID.idl // generated code does not contain a copyright notice #ifndef UNIQUE_IDENTIFIER_MSGS__MSG__DETAIL__UUID__STRUCT_H_ #define UNIQUE_IDENTIFIER_MSGS__MSG__DETAIL__UUID__STRUCT_H_ #ifdef __cplusplus extern "C" { #endif #include <stdbool.h> #include <stddef.h> #include <stdint.h> // Constants defined in the message // Struct defined in msg/UUID in the package unique_identifier_msgs. typedef struct unique_identifier_msgs__msg__UUID { uint8_t uuid[16]; } unique_identifier_msgs__msg__UUID; // Struct for a sequence of unique_identifier_msgs__msg__UUID. typedef struct unique_identifier_msgs__msg__UUID__Sequence { unique_identifier_msgs__msg__UUID * data; /// The number of valid items in data size_t size; /// The number of allocated items in data size_t capacity; } unique_identifier_msgs__msg__UUID__Sequence; #ifdef __cplusplus } #endif #endif // UNIQUE_IDENTIFIER_MSGS__MSG__DETAIL__UUID__STRUCT_H_
25.390244
68
0.819404
c10ca9e1c5112dbc794e74faa5f4ad58a502d800
619
h
C
core/mp/_fround.h
SatisKia/clip
458f677b7829636cd77069e2272e0e61b4ef63bd
[ "MIT" ]
null
null
null
core/mp/_fround.h
SatisKia/clip
458f677b7829636cd77069e2272e0e61b4ef63bd
[ "MIT" ]
null
null
null
core/mp/_fround.h
SatisKia/clip
458f677b7829636cd77069e2272e0e61b4ef63bd
[ "MIT" ]
null
null
null
/* * CLIP * Copyright (C) SatisKia. All rights reserved. */ #ifndef _MP_FROUND_H #define _MP_FROUND_H #define _MP_FROUND_UP 0 // ゼロから離れるように丸める #define _MP_FROUND_DOWN 1 // ゼロに近づくように丸める #define _MP_FROUND_CEILING 2 // 正の無限大に近づくように丸める #define _MP_FROUND_FLOOR 3 // 負の無限大に近づくように丸める #define _MP_FROUND_HALF_UP 4 // 四捨五入する #define _MP_FROUND_HALF_DOWN 5 // 五捨六入する #define _MP_FROUND_HALF_EVEN 6 // n桁で丸める場合のn桁目の数値が奇数の場合はHALF_UP、偶数の場合はHALF_DOWN #define _MP_FROUND_HALF_DOWN2 7 // 五捨五超入する #define _MP_FROUND_HALF_EVEN2 8 // n桁で丸める場合のn桁目の数値が奇数の場合はHALF_UP、偶数の場合はHALF_DOWN2 #endif // _MP_FROUND_H
30.95
82
0.775444
c10e8a80ec46c032a6d33c95802e4689ded56fe5
693
h
C
src/ipcsharedbuffer.h
41nyaa/buflog
e6043900173471cfc9ba0570bed9713179a8a46e
[ "MIT" ]
null
null
null
src/ipcsharedbuffer.h
41nyaa/buflog
e6043900173471cfc9ba0570bed9713179a8a46e
[ "MIT" ]
null
null
null
src/ipcsharedbuffer.h
41nyaa/buflog
e6043900173471cfc9ba0570bed9713179a8a46e
[ "MIT" ]
null
null
null
/* * Copyright (c) 2021 41nya * All rights reserved. */ #ifndef SRC_IPCSHAREDBUFFER_H_ #define SRC_IPCSHAREDBUFFER_H_ #include "isharedbuffer.h" namespace buflogtest { class IPCSharedBufferTest; } // buflogtest namespace buflog { class IPCSharedBuffer final : public ISharedBuffer{ public: IPCSharedBuffer(const std::string name, const int size); ~IPCSharedBuffer(); void Write(std::string& msg) override; void Copy(std::vector<char>& buf) override; private: int shmid; void* shmaddr; int bufsize; void* writeaddr; //for unittest friend class buflogtest::IPCSharedBufferTest; }; } // namespace buflog #endif // SRC_IPCSHAREDBUFFER_H_
19.8
60
0.712843
c10f47ed4e7caa723e712347725591b074f3e70b
5,903
h
C
opal/mca/shmem/shmem.h
j-xiong/ompi
859dd8a742af56b9e16af5c584bb25ce5ca55dae
[ "BSD-3-Clause-Open-MPI" ]
20
2020-04-20T15:50:19.000Z
2021-09-03T09:17:23.000Z
opal/mca/shmem/shmem.h
j-xiong/ompi
859dd8a742af56b9e16af5c584bb25ce5ca55dae
[ "BSD-3-Clause-Open-MPI" ]
16
2019-07-05T13:33:51.000Z
2021-01-21T13:14:05.000Z
opal/mca/shmem/shmem.h
j-xiong/ompi
859dd8a742af56b9e16af5c584bb25ce5ca55dae
[ "BSD-3-Clause-Open-MPI" ]
29
2020-05-12T02:12:11.000Z
2021-08-30T02:04:39.000Z
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. * Copyright (c) 2004-2005 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2010 IBM Corporation. All rights reserved. * Copyright (c) 2010-2015 Los Alamos National Security, LLC. * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ /** * @file * * shmem (shared memory backing facility) framework component interface * definitions. * * usage example: see ompi/mca/common/sm * * The module has the following functions: * * - module_init * - segment_create * - ds_copy * - segment_attach * - segment_detach * - unlink * - module_finalize */ #ifndef OPAL_SHMEM_H #define OPAL_SHMEM_H #include "opal_config.h" #include "opal/mca/mca.h" #include "opal/mca/base/base.h" #include "opal/mca/shmem/shmem_types.h" BEGIN_C_DECLS /* ////////////////////////////////////////////////////////////////////////// */ typedef int (*mca_shmem_base_component_runtime_query_fn_t)(mca_base_module_t **module, int *priority, const char *hint); /* structure for shmem components. */ struct opal_shmem_base_component_2_0_0_t { /* base MCA component */ mca_base_component_t base_version; /* base MCA data */ mca_base_component_data_t base_data; /* component runtime query */ mca_shmem_base_component_runtime_query_fn_t runtime_query; }; /* convenience typedefs */ typedef struct opal_shmem_base_component_2_0_0_t opal_shmem_base_component_2_0_0_t; typedef struct opal_shmem_base_component_2_0_0_t opal_shmem_base_component_t; /* ////////////////////////////////////////////////////////////////////////// */ /* shmem API function pointers */ /** * module initialization function. * @return OPAL_SUCCESS on success. */ typedef int (*opal_shmem_base_module_init_fn_t)(void); /** * copy shmem data structure information pointed to by from to the structure * pointed to by to. * * @param from source pointer (IN). * * @param to destination pointer (OUT). * * @return OPAL_SUCCESS on success. */ typedef int (*opal_shmem_base_ds_copy_fn_t)(const opal_shmem_ds_t *from, opal_shmem_ds_t *to); /** * create a new shared memory segment and initialize members in structure * pointed to by ds_buf. * * @param ds_buf pointer to opal_shmem_ds_t typedef'd structure * defined in shmem_types.h (OUT). * * @param file_name file_name unique string identifier that must be a valid, * writable path (IN). * * @param size size of the shared memory segment. * * @return OPAL_SUCCESS on success. */ typedef int (*opal_shmem_base_module_segment_create_fn_t)(opal_shmem_ds_t *ds_buf, const char *file_name, size_t size); /** * attach to an existing shared memory segment initialized by segment_create. * * @param ds_buf pointer to initialized opal_shmem_ds_t typedef'd * structure (IN/OUT). * * @return base address of shared memory segment on success. returns * NULL otherwise. */ typedef void * (*opal_shmem_base_module_segment_attach_fn_t)(opal_shmem_ds_t *ds_buf); /** * detach from an existing shared memory segment. * * @param ds_buf pointer to initialized opal_shmem_ds_t typedef'd structure * (IN/OUT). * * @return OPAL_SUCCESS on success. */ typedef int (*opal_shmem_base_module_segment_detach_fn_t)(opal_shmem_ds_t *ds_buf); /** * unlink an existing shared memory segment. * * @param ds_buf pointer to initialized opal_shmem_ds_t typedef'd structure * (IN/OUT). * * @return OPAL_SUCCESS on success. */ typedef int (*opal_shmem_base_module_unlink_fn_t)(opal_shmem_ds_t *ds_buf); /** * module finalize function. invoked by the base on the selected * module when the shmem framework is being shut down. */ typedef int (*opal_shmem_base_module_finalize_fn_t)(void); /** * structure for shmem modules */ struct opal_shmem_base_module_2_0_0_t { mca_base_module_t base; opal_shmem_base_module_init_fn_t module_init; opal_shmem_base_module_segment_create_fn_t segment_create; opal_shmem_base_ds_copy_fn_t ds_copy; opal_shmem_base_module_segment_attach_fn_t segment_attach; opal_shmem_base_module_segment_detach_fn_t segment_detach; opal_shmem_base_module_unlink_fn_t unlink; opal_shmem_base_module_finalize_fn_t module_finalize; }; /** * convenience typedefs */ typedef struct opal_shmem_base_module_2_0_0_t opal_shmem_base_module_2_0_0_t; typedef struct opal_shmem_base_module_2_0_0_t opal_shmem_base_module_t; /** * macro for use in components that are of type shmem * see: opal/mca/mca.h for more information */ #define OPAL_SHMEM_BASE_VERSION_2_0_0 \ OPAL_MCA_BASE_VERSION_2_1_0("shmem", 2, 0, 0) END_C_DECLS #endif /* OPAL_SHMEM_H */
30.905759
80
0.653227
c11149a0ecfe305c06d0dedcedbc4f0d2ad9ce89
786
c
C
C/OD/bubbleSort.c
MxBromelia/Miscelanea
5ed09cf0be28fddc29f6f1a6f3f2105226fbc11d
[ "MIT" ]
null
null
null
C/OD/bubbleSort.c
MxBromelia/Miscelanea
5ed09cf0be28fddc29f6f1a6f3f2105226fbc11d
[ "MIT" ]
null
null
null
C/OD/bubbleSort.c
MxBromelia/Miscelanea
5ed09cf0be28fddc29f6f1a6f3f2105226fbc11d
[ "MIT" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #define MAX 1000 #define NUM 10 #define SWAP(a,b) int x = a; a = b; b = x void create_vector(int **v, int n) { srand((unsigned)time(NULL)); *v = (int*) malloc(sizeof(int)*n); for(int i = 0; i < n; i++) *v[i] = rand() % MAX; } void print_vector(int* v, int n) { for(int i = 0; i < n; i++) printf("%4d\t", v[i]); printf("\n"); } void bubbleSort(int* ord, int n) { int i, j; int aux; for(i = 0; i < n; i++) { for(j=i+1; j< n; j++) { if(ord[i] > ord[j]) { SWAP(ord[i], ord[j]); } } } } int main() { int* vec; int num = NUM; printf("Hello World!\n"); /*create_vector(&vec, num); print_vector(vec, num); bubbleSort(vec, num); print_vector(vec, num);*/ return 0; }
13.789474
41
0.544529
c11326da6a849799ccf2d5d86f86188fc0e12ad1
475
c
C
tests/gcc-torture/breakdown/success/pr68185.c
talsewell/cerberus
c8c6d25f0cb8d4cd2672ffd0790fb0de3f2a51e3
[ "BSD-2-Clause" ]
12
2020-09-03T09:57:26.000Z
2022-01-28T04:28:00.000Z
tests/gcc-torture/breakdown/success/pr68185.c
talsewell/cerberus
c8c6d25f0cb8d4cd2672ffd0790fb0de3f2a51e3
[ "BSD-2-Clause" ]
182
2021-02-26T23:07:40.000Z
2022-02-10T12:33:45.000Z
tests/gcc-torture/breakdown/success/pr68185.c
talsewell/cerberus
c8c6d25f0cb8d4cd2672ffd0790fb0de3f2a51e3
[ "BSD-2-Clause" ]
4
2020-09-02T11:54:39.000Z
2022-03-16T23:23:11.000Z
#include "cerberus.h" /* { dg-skip-if "ptxas crashes or executes incorrectly" { nvptx-*-* } { "-O0" "-Os" } { "" } } Reported 2015-11-20 */ int a, b, d = 1, e, f, o, u, w = 1, z; short c, q, t; int main (void) { char g; for (; d; d--) { while (o) for (; e;) { c = b; int h = o = z; for (; u;) for (; a;) ; } if (t < 1) g = w; f = g; g && (q = 1); } if (q != 1) __builtin_abort (); return 0; }
14.393939
118
0.395789
c114d6793517adfb6d33d3c10bf32f46f1ca7c57
3,657
h
C
ork.tool/src/filter/aud/aiff.h
tweakoz/orkid
e3f78dfb3375853fd512a9d0828b009075a18345
[ "BSL-1.0" ]
25
2015-02-21T04:21:21.000Z
2022-01-20T05:19:27.000Z
ork.tool/src/filter/aud/aiff.h
tweakoz/orkid
e3f78dfb3375853fd512a9d0828b009075a18345
[ "BSL-1.0" ]
113
2019-08-23T04:52:14.000Z
2021-09-13T04:04:11.000Z
ork.tool/src/filter/aud/aiff.h
tweakoz/orkid
e3f78dfb3375853fd512a9d0828b009075a18345
[ "BSL-1.0" ]
4
2017-02-20T18:17:55.000Z
2020-06-28T03:47:55.000Z
//////////////////////////////////////////////////////////////// // Orkid Media Engine // Copyright 1996-2020, Michael T. Mayers. // Distributed under the Boost Software License - Version 1.0 - August 17, 2003 // see http://www.boost.org/LICENSE_1_0.txt //////////////////////////////////////////////////////////////// #ifndef _AUDIO_DATAFILTER_AIFF_H #define _AUDIO_DATAFILTER_AIFF_H namespace ork { namespace tool { /////////////////////////////////////////////////////////////////////////////// typedef class aiff_exp { public: // const S16 *sounddata; U32 len; U32 loop_start; U32 loop_end; int isamplerate; bool mbLoopEnable; aiff_exp() { sounddata = 0; len = 0; loop_start = 0; loop_end = 0; isamplerate = 44100; mbLoopEnable = false; } } Taiff_exp; /////////////////////////////////////////////////////////////////////////////// typedef class Cpstring { public: // U8 count; U8 tsize; U8 pad; STRING string; void set_string( STRING newstring ); void write_to_file( FILE *fout ); } TCpstring; /////////////////////////////////////////////////////////////////////////////// typedef class iff_chunk iff_chunk_t; typedef class iff_chunk { public: // U32 chunkID; // #define RIFFChunk::ChunkName() U32 size; void *data; orkvector< iff_chunk_t * > children_vect; virtual U32 calcsize( void ); virtual void write_to_file( FILE *fout ); } iff_chunk_t; /////////////////////////////////////////////////////////////////////////////// typedef class aiff_comm : public iff_chunk_t { public: // S16 num_channels; U32 num_frames; S16 num_bits; double samplerate; virtual U32 calcsize( void ); virtual void write_to_file( FILE *fout ); aiff_comm() { num_channels = 1; num_bits = 16; samplerate = 0.0; num_frames = 0; } } Taiff_comm; /////////////////////////////////////////////////////////////////////////////// typedef class aiff_ssnd : public iff_chunk_t { public: // U32 offset; U32 blocksize; // sample[numsamps]; virtual U32 calcsize( void ); virtual void write_to_file( FILE *fout ); Taiff_exp *export_sample; aiff_ssnd() { offset = 0; blocksize = 0; export_sample = 0; } } Taiff_ssnd; /////////////////////////////////////////////////////////////////////////////// typedef class aiff_marker { public: // U16 mkrID; U32 pos; TCpstring name; U32 calcsize( void ); } Taiff_marker; typedef class aiff_mark : public iff_chunk_t { public: // //U16 num_markers; orkvector< Taiff_marker * > marker_vect; aiff_mark() { } virtual U32 calcsize( void ); virtual void write_to_file( FILE *fout ); } Taiff_mark; /////////////////////////////////////////////////////////////////////////////// #define NoLooping 0 #define ForwardLooping 1 #define ForwardBackwardLooping 2 typedef struct Saiff_loop { U16 loop_mode; U16 mkrID_start; U16 mkrID_end; } TSaiff_loop; typedef class aiff_inst : public iff_chunk_t { public: // U8 basenote; U8 detune; U8 lonote; U8 hinote; U8 lovel; U8 hivel; S16 gain; TSaiff_loop susloop; TSaiff_loop relloop; //int isamplerate; virtual U32 calcsize( void ); virtual void write_to_file( FILE *fout ); aiff_inst() { basenote = 60; detune = 0; lonote = 0; hinote = 127; lovel = 0; hivel = 127; gain = 0; susloop.loop_mode = NoLooping; susloop.mkrID_start = 0xffff; susloop.mkrID_end = 0xffff; relloop.loop_mode = NoLooping; relloop.mkrID_start = 0xffff; relloop.mkrID_end = 0xffff; } } Taiff_inst; void write_sample_aiff( const char * fname, Taiff_exp *exp ); /////////////////////////////////////////////////////////////////////////////// } } #endif
17.331754
79
0.550178
c115cd67bd20fcd65b143441535768e1449a7fbb
536
h
C
targets/CMSIS-OS/ChibiOS/ST_STM32F769I_DISCOVERY/target_lwip_sntp_opts.h
skyflashde/nf-interpreter
664db50bce6990c39591fb736ecac7e6aa70a927
[ "Apache-2.0" ]
3
2019-07-11T15:03:52.000Z
2019-07-12T00:35:51.000Z
targets/CMSIS-OS/ChibiOS/ST_STM32F769I_DISCOVERY/target_lwip_sntp_opts.h
skyflashde/nf-interpreter
664db50bce6990c39591fb736ecac7e6aa70a927
[ "Apache-2.0" ]
127
2019-06-20T22:18:44.000Z
2022-03-14T13:11:12.000Z
targets/CMSIS-OS/ChibiOS/ST_STM32F769I_DISCOVERY/target_lwip_sntp_opts.h
skyflashde/nf-interpreter
664db50bce6990c39591fb736ecac7e6aa70a927
[ "Apache-2.0" ]
8
2020-02-21T13:33:46.000Z
2021-05-17T23:36:46.000Z
// // Copyright (c) 2017 The nanoFramework project contributors // See LICENSE file in the project root for full license information. // #define SNTP_SERVER_DEFAULT_ADDRESS "0.pool.ntp.org" // update delay (default 1 hour) // (value in milliseconds) #define SNTP_UPDATE_DELAY 3600000 // better have a startup delay because we can have DHCP enabled (default 30 seconds) // value in milliseconds #define SNTP_STARTUP_DELAY 30000 // retry timeout (15 minutes) // value in milliseconds #define SNTP_RETRY_TIMEOUT 900000
28.210526
84
0.753731
c116c0536e041dbb95cd7d09f20829d3b51df4cc
273
h
C
test/test/Classes/Public/Base/FCNavigationController.h
lisazff/test
d80a9c60b37ef69987fbc762b459c2c0a630908f
[ "MIT" ]
null
null
null
test/test/Classes/Public/Base/FCNavigationController.h
lisazff/test
d80a9c60b37ef69987fbc762b459c2c0a630908f
[ "MIT" ]
null
null
null
test/test/Classes/Public/Base/FCNavigationController.h
lisazff/test
d80a9c60b37ef69987fbc762b459c2c0a630908f
[ "MIT" ]
null
null
null
// // FCNavigationController.h // test // // Created by fccoder on 2020/7/7. // Copyright © 2020 fccoder. All rights reserved. // #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface FCNavigationController : UINavigationController @end NS_ASSUME_NONNULL_END
15.166667
58
0.750916
c116c370ea51fd4fb2a769c3bb21e3273cdd498b
11,726
c
C
Implementation/iOSIlluminati/lib/SRC/AR2/template.c
samssonart/gmtThesisAR
14813a2efb2e7fcf0aaf753ca68ab3ed7edcbd2e
[ "MIT" ]
null
null
null
Implementation/iOSIlluminati/lib/SRC/AR2/template.c
samssonart/gmtThesisAR
14813a2efb2e7fcf0aaf753ca68ab3ed7edcbd2e
[ "MIT" ]
null
null
null
Implementation/iOSIlluminati/lib/SRC/AR2/template.c
samssonart/gmtThesisAR
14813a2efb2e7fcf0aaf753ca68ab3ed7edcbd2e
[ "MIT" ]
null
null
null
/* * AR2/template.c * ARToolKit5 * * This file is part of ARToolKit. * * ARToolKit 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. * * ARToolKit 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 ARToolKit. If not, see <http://www.gnu.org/licenses/>. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent modules, and to * copy and distribute the resulting executable under terms of your choice, * provided that you also meet, for each linked independent module, the terms and * conditions of the license of that module. An independent module is a module * which is neither derived from nor based on this library. If you modify this * library, you may extend this exception to your version of the library, but you * are not obligated to do so. If you do not wish to do so, delete this exception * statement from your version. * * Copyright 2015 Daqri, LLC. * Copyright 2006-2015 ARToolworks, Inc. * * Author(s): Hirokazu Kato, Philip Lamb * */ #include <AR/ar.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <AR2/config.h> #include <AR2/coord.h> #include <AR2/featureSet.h> #include <AR2/template.h> #include <AR2/tracking.h> #if AR2_CAPABLE_ADAPTIVE_TEMPLATE AR2TemplateT *ar2GenTemplate( int ts1, int ts2 ) #else AR2TemplateT *ar2GenTemplate( int ts1, int ts2 ) #endif { AR2TemplateT *templ; int xsize, ysize; arMalloc( templ, AR2TemplateT, 1 ); templ->xts1 = templ->yts1 = ts1; templ->xts2 = templ->yts2 = ts2; templ->xsize = xsize = templ->xts1 + templ->xts2 + 1; templ->ysize = ysize = templ->yts1 + templ->yts2 + 1; arMalloc( templ->img1, ARUint16, xsize*ysize ); return templ; } #if AR2_CAPABLE_ADAPTIVE_TEMPLATE AR2Template2T *ar2GenTemplate2( int ts1, int ts2 ) { AR2Template2T *templ2; int xsize, ysize; arMalloc( templ2, AR2Template2T, 1 ); templ2->xts1 = templ2->yts1 = ts1; templ2->xts2 = templ2->yts2 = ts2; templ2->xsize = xsize = templ2->xts1 + templ2->xts2 + 1; templ2->ysize = ysize = templ2->yts1 + templ2->yts2 + 1; arMalloc( templ2->img1[0], ARUint16, xsize*ysize ); arMalloc( templ2->img1[1], ARUint16, xsize*ysize ); arMalloc( templ2->img1[2], ARUint16, xsize*ysize ); return templ2; } #endif int ar2FreeTemplate( AR2TemplateT *templ ) { free( templ->img1 ); free( templ ); return 0; } #if AR2_CAPABLE_ADAPTIVE_TEMPLATE int ar2FreeTemplate2( AR2Template2T *templ2 ) { free( templ2->img1[0] ); free( templ2->img1[1] ); free( templ2->img1[2] ); free( templ2 ); return 0; } #endif #if AR2_CAPABLE_ADAPTIVE_TEMPLATE int ar2SetTemplateSub( const ARParamLT *cparamLT, const float trans[3][4], AR2ImageSetT *imageSet, AR2FeaturePointsT *featurePoints, int num, int blurLevel, AR2TemplateT *templ ) #else int ar2SetTemplateSub( const ARParamLT *cparamLT, const float trans[3][4], AR2ImageSetT *imageSet, AR2FeaturePointsT *featurePoints, int num, AR2TemplateT *templ ) #endif { float mx, my; float sx, sy; float wtrans[3][4]; ARUint16 *img1; int sum, sum2; int vlen; ARUint8 pixel; int ix, iy; int ix2, iy2; int ret; int i, j, k; if( cparamLT != NULL ) { #ifdef ARDOUBLE_IS_FLOAT arUtilMatMul( cparamLT->param.mat, trans, wtrans ); #else arUtilMatMuldff( cparamLT->param.mat, trans, wtrans ); #endif mx = featurePoints->coord[num].mx; my = featurePoints->coord[num].my; if( ar2MarkerCoord2ScreenCoord( NULL, (const float (*)[4])wtrans, mx, my, &mx, &my ) < 0 ) return -1; if( arParamIdeal2ObservLTf( &cparamLT->paramLTf, mx, my, &sx, &sy ) < 0 ) return -1; ix = (int)(sx + 0.5F); iy = (int)(sy + 0.5F); img1 = templ->img1; sum = sum2 = 0; k = 0; iy2 = iy - (templ->yts1)*AR2_TEMP_SCALE; for( j = -(templ->yts1); j <= templ->yts2; j++, iy2+=AR2_TEMP_SCALE ) { ix2 = ix - (templ->xts1)*AR2_TEMP_SCALE; for( i = -(templ->xts1); i <= templ->xts2; i++, ix2+=AR2_TEMP_SCALE ) { if( arParamObserv2IdealLTf( &cparamLT->paramLTf, (float)ix2, (float)iy2, &sx, &sy) < 0 ) { *(img1++) = AR2_TEMPLATE_NULL_PIXEL; continue; } ret = ar2GetImageValue( NULL, (const float (*)[4])wtrans, imageSet->scale[featurePoints->scale], #if AR2_CAPABLE_ADAPTIVE_TEMPLATE sx, sy, blurLevel, &pixel ); #else sx, sy, &pixel ); #endif if( ret < 0 ) { *(img1++) = AR2_TEMPLATE_NULL_PIXEL; } else { *(img1++) = pixel; sum += pixel; sum2 += pixel*pixel; k++; } } } } else { mx = featurePoints->coord[num].mx; my = featurePoints->coord[num].my; if( ar2MarkerCoord2ScreenCoord( NULL, trans, mx, my, &sx, &sy ) < 0 ) return -1; ix = (int)(sx + 0.5F); iy = (int)(sy + 0.5F); img1 = templ->img1; sum = sum2 = 0; k = 0; iy2 = iy - (templ->yts1)*AR2_TEMP_SCALE; for( j = -(templ->yts1); j <= templ->yts2; j++, iy2+=AR2_TEMP_SCALE ) { ix2 = ix - (templ->xts1)*AR2_TEMP_SCALE; for( i = -(templ->xts1); i <= templ->xts2; i++, ix2+=AR2_TEMP_SCALE ) { ret = ar2GetImageValue( NULL, trans, imageSet->scale[featurePoints->scale], #if AR2_CAPABLE_ADAPTIVE_TEMPLATE (float)ix2, (float)iy2, blurLevel, &pixel ); #else (float)ix2, (float)iy2, &pixel ); #endif if( ret < 0 ) { *(img1++) = AR2_TEMPLATE_NULL_PIXEL; } else { *(img1++) = pixel; sum += pixel; sum2 += pixel*pixel; k++; } } } } if( k == 0 ) return -1; vlen = sum2 - sum*sum/k; templ->vlen = (int)sqrtf((float)vlen); templ->sum = sum; templ->validNum = k; return 0; } #if AR2_CAPABLE_ADAPTIVE_TEMPLATE int ar2SetTemplate2Sub( const ARParamLT *cparamLT, const float trans[3][4], AR2ImageSetT *imageSet, AR2FeaturePointsT *featurePoints, int num, int blurLevel, AR2Template2T *templ2 ) { float mx, my; float sx, sy; float wtrans[3][4]; ARUint16 *img1, *img2, *img3; int sum11, sum21, sum31; int sum12, sum22, sum32; int vlen1, vlen2, vlen3; ARUint8 pixel1, pixel2, pixel3; int ix, iy; int ix2, iy2; int ret; int i, j, k; if( cparamLT != NULL ) { arUtilMatMul( cparamLT->param.mat, trans, wtrans ); mx = featurePoints->coord[num].mx; my = featurePoints->coord[num].my; if( ar2MarkerCoord2ScreenCoord( NULL, wtrans, mx, my, &mx, &my ) < 0 ) return -1; if( arParamIdeal2ObservLTf( &cparamLT->paramLTf, mx, my, &sx, &sy ) < 0 ) return -1; ix = (int)(sx + 0.5F); iy = (int)(sy + 0.5F); img1 = templ2->img1[0]; img2 = templ2->img1[1]; img3 = templ2->img1[2]; sum11 = sum21 = sum31 = 0; sum12 = sum22 = sum32 = 0; k = 0; iy2 = iy - (templ2->yts1)*AR2_TEMP_SCALE; for( j = -(templ2->yts1); j <= templ2->yts2; j++, iy2+=AR2_TEMP_SCALE ) { ix2 = ix - (templ2->xts1)*AR2_TEMP_SCALE; for( i = -(templ2->xts1); i <= templ2->xts2; i++, ix2+=AR2_TEMP_SCALE ) { if( arParamObserv2IdealLTf( &cparamLT->paramLTf, ix2, iy2, &sx, &sy) < 0 ) { *(img1++) = AR2_TEMPLATE_NULL_PIXEL; *(img2++) = AR2_TEMPLATE_NULL_PIXEL; *(img3++) = AR2_TEMPLATE_NULL_PIXEL; continue; } ret = ar2GetImageValue2( NULL, wtrans, imageSet->scale[featurePoints->scale], sx, sy, blurLevel, &pixel1, &pixel2, &pixel3 ); if( ret < 0 ) { *(img1++) = AR2_TEMPLATE_NULL_PIXEL; *(img2++) = AR2_TEMPLATE_NULL_PIXEL; *(img3++) = AR2_TEMPLATE_NULL_PIXEL; } else { *(img1++) = pixel1; sum11 += pixel1; sum12 += pixel1*pixel1; *(img2++) = pixel2; sum21 += pixel2; sum22 += pixel2*pixel2; *(img3++) = pixel3; sum31 += pixel3; sum32 += pixel3*pixel3; k++; } } } } else { mx = featurePoints->coord[num].mx; my = featurePoints->coord[num].my; if( ar2MarkerCoord2ScreenCoord( NULL, trans, mx, my, &sx, &sy ) < 0 ) return -1; ix = (int)(sx + 0.5F); iy = (int)(sy + 0.5F); img1 = templ2->img1[0]; img2 = templ2->img1[1]; img3 = templ2->img1[2]; sum11 = sum21 = sum31 = 0; sum12 = sum22 = sum32 = 0; k = 0; iy2 = iy - (templ2->yts1)*AR2_TEMP_SCALE; for( j = -(templ2->yts1); j <= templ2->yts2; j++, iy2+=AR2_TEMP_SCALE ) { ix2 = ix - (templ2->xts1)*AR2_TEMP_SCALE; for( i = -(templ2->xts1); i <= templ2->xts2; i++, ix2+=AR2_TEMP_SCALE ) { ret = ar2GetImageValue2( NULL, trans, imageSet->scale[featurePoints->scale], ix2, iy2, blurLevel, &pixel1, &pixel2, &pixel3 ); if( ret < 0 ) { *(img1++) = AR2_TEMPLATE_NULL_PIXEL; *(img2++) = AR2_TEMPLATE_NULL_PIXEL; *(img3++) = AR2_TEMPLATE_NULL_PIXEL; } else { *(img1++) = pixel1; sum11 += pixel1; sum12 += pixel1*pixel1; *(img2++) = pixel2; sum21 += pixel2; sum22 += pixel2*pixel2; *(img3++) = pixel3; sum31 += pixel3; sum32 += pixel3*pixel3; k++; } } } } if( k == 0 ) return -1; vlen1 = sum12 - sum11*sum11/k; vlen2 = sum22 - sum21*sum21/k; vlen3 = sum32 - sum31*sum31/k; templ2->vlen[0] = (int)sqrtf((float)vlen1); templ2->vlen[1] = (int)sqrtf((float)vlen2); templ2->vlen[2] = (int)sqrtf((float)vlen3); templ2->sum[0] = sum11; templ2->sum[0] = sum21; templ2->sum[0] = sum31; templ2->validNum = k; return 0; } #endif
34.186589
112
0.524987
c117585271114358a0ab25ab106abe7fdae4aa68
234
h
C
CoconutKit-test/Sources/Core/NSArray+HLSExtensionsTestCase.h
Akylas/CoconutKit
fe4cd2c001583124723d6e740d06cead3e24985c
[ "MIT" ]
null
null
null
CoconutKit-test/Sources/Core/NSArray+HLSExtensionsTestCase.h
Akylas/CoconutKit
fe4cd2c001583124723d6e740d06cead3e24985c
[ "MIT" ]
null
null
null
CoconutKit-test/Sources/Core/NSArray+HLSExtensionsTestCase.h
Akylas/CoconutKit
fe4cd2c001583124723d6e740d06cead3e24985c
[ "MIT" ]
null
null
null
// // NSArray+HLSExtensionsTestCase.h // CoconutKit-test // // Created by Samuel Défago on 23.08.11. // Copyright 2011 Hortis. All rights reserved. // @interface NSArray_HLSExtensionsTestCase : GHTestCase { @private } @end
15.6
55
0.709402
c11b12748182d0b1df9978208e9486da089e49e7
604
h
C
src/openloco/openloco.h
Gymnasiast/OpenLoco
1bef36f96bcce0d6095d1b804a8d9f9df9651d07
[ "MIT" ]
null
null
null
src/openloco/openloco.h
Gymnasiast/OpenLoco
1bef36f96bcce0d6095d1b804a8d9f9df9651d07
[ "MIT" ]
null
null
null
src/openloco/openloco.h
Gymnasiast/OpenLoco
1bef36f96bcce0d6095d1b804a8d9f9df9651d07
[ "MIT" ]
null
null
null
#pragma once #include "utility/prng.hpp" #include <cstdint> #include <functional> namespace openloco { namespace screen_flags { constexpr uint8_t title = 1 << 0; constexpr uint8_t editor = 1 << 1; constexpr uint8_t unknown_2 = 1 << 2; } void* hInstance(); const char* lpCmdLine(); void lpCmdLine(const char* path); bool is_editor_mode(); bool is_title_mode(); bool is_paused(); uint32_t scenario_ticks(); utility::prng& gprng(); void main(); void prompt_tick_loop(std::function<bool()> tickAction); void sub_48A18C(); }
20.827586
60
0.635762
c11bc9bf23b42a053b264a0838fabd4295b7faf8
7,390
h
C
include/lpd_termcolor.h
LynnKirby/lpd
fc25facdef9021acdf7cd32f6070996f73af5997
[ "CC0-1.0" ]
null
null
null
include/lpd_termcolor.h
LynnKirby/lpd
fc25facdef9021acdf7cd32f6070996f73af5997
[ "CC0-1.0" ]
null
null
null
include/lpd_termcolor.h
LynnKirby/lpd
fc25facdef9021acdf7cd32f6070996f73af5997
[ "CC0-1.0" ]
null
null
null
/* # lpd_termcolor.h > portable terminal colors Written in 2018 by Lynn Kirby <lynn@arrak.is> To the extent possible under law, the author has dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. ## Usage This file can be included multiple times as a header. To get the implementation, define `LPD_TERMCOLOR_IMPLEMENTATION` then include this file. For example: #define LPD_TERMCOLOR_IMPLEMENTATION #include <lpd/termcolor.h> On Windows, define macros for a version greater than or equal to Vista. For example: #define WINVER 0x0600 #define _WIN32_WINNT 0x0600 #define NTDDI_VERSION 0x06000000 On POSIX-compatible systems, define a POSIX feature test macro for POSIX.1 or greater. For example: #define _POSIX_C_SOURCE 1 */ #ifdef __cplusplus extern "C" { #endif #ifndef LPD_TERMCOLOR_H #define LPD_TERMCOLOR_H // Compiling with MSVC and /Wall shows a bunch of errors in the Windows includes // so just disable the errors temporarily. #ifdef _MSC_VER #pragma warning(push, 0) #endif #include <assert.h> #include <stdio.h> #ifdef _MSC_VER #pragma warning(pop) #endif enum lpd_tc_color { LPD_TC_UNSET_COLOR = ~1, LPD_TC_DEFAULT_COLOR = ~0, LPD_TC_BLACK = 0, LPD_TC_BLUE = 1 << 0, LPD_TC_GREEN = 1 << 1, LPD_TC_RED = 1 << 2, LPD_TC_CYAN = LPD_TC_GREEN | LPD_TC_BLUE, LPD_TC_MAGENTA = LPD_TC_RED | LPD_TC_BLUE, LPD_TC_YELLOW = LPD_TC_RED | LPD_TC_GREEN, LPD_TC_WHITE = LPD_TC_RED | LPD_TC_GREEN | LPD_TC_BLUE }; enum lpd_tc_result { LPD_TC_OK = 0, LPD_TC_EFILE = 1, LPD_TC_EERRNO = 2, LPD_TC_EWIN = 3 }; typedef enum lpd_tc_color lpd_tc_color; typedef enum lpd_tc_result lpd_tc_result; extern lpd_tc_result lpd_termcolor(FILE* stream, lpd_tc_color fg, lpd_tc_color bg); extern lpd_tc_result lpd_termcolor_fg(FILE* stream, lpd_tc_color color); extern lpd_tc_result lpd_termcolor_bg(FILE* stream, lpd_tc_color color); extern lpd_tc_result lpd_termcolor_reset(FILE* stream); #endif #ifdef LPD_TERMCOLOR_IMPLEMENTATION /******************************************************************************* * Implementation of simple functions. Just pass off to `lpd_termcolor()`. */ lpd_tc_result lpd_termcolor_fg(FILE* stream, lpd_tc_color color) { return lpd_termcolor( stream, color, LPD_TC_UNSET_COLOR); } lpd_tc_result lpd_termcolor_bg(FILE* stream, lpd_tc_color color) { return lpd_termcolor( stream, LPD_TC_UNSET_COLOR, color); } lpd_tc_result lpd_termcolor_reset(FILE* stream) { return lpd_termcolor( stream, LPD_TC_DEFAULT_COLOR, LPD_TC_DEFAULT_COLOR); } /******************************************************************************* * Generic ANSI escape code implementation. */ static lpd_tc_result lpd_tc__ansi(FILE* stream, lpd_tc_color fg, lpd_tc_color bg) { int retval = 0; switch (fg) { case LPD_TC_BLACK: retval = fputs("\x1b[30m", stream); break; case LPD_TC_RED: retval = fputs("\x1b[31m", stream); break; case LPD_TC_GREEN: retval = fputs("\x1b[32m", stream); break; case LPD_TC_YELLOW: retval = fputs("\x1b[33m", stream); break; case LPD_TC_BLUE: retval = fputs("\x1b[34m", stream); break; case LPD_TC_MAGENTA: retval = fputs("\x1b[35m", stream); break; case LPD_TC_CYAN: retval = fputs("\x1b[36m", stream); break; case LPD_TC_WHITE: retval = fputs("\x1b[37m", stream); break; case LPD_TC_DEFAULT_COLOR: retval = fputs("\x1b[39m", stream); break; case LPD_TC_UNSET_COLOR: /* do nothing */ break; } if (retval == EOF) return LPD_TC_EFILE; switch (bg) { case LPD_TC_BLACK: retval = fputs("\x1b[40m", stream); break; case LPD_TC_RED: retval = fputs("\x1b[41m", stream); break; case LPD_TC_GREEN: retval = fputs("\x1b[42m", stream); break; case LPD_TC_YELLOW: retval = fputs("\x1b[43m", stream); break; case LPD_TC_BLUE: retval = fputs("\x1b[44m", stream); break; case LPD_TC_MAGENTA: retval = fputs("\x1b[45m", stream); break; case LPD_TC_CYAN: retval = fputs("\x1b[46m", stream); break; case LPD_TC_WHITE: retval = fputs("\x1b[47m", stream); break; case LPD_TC_DEFAULT_COLOR: retval = fputs("\x1b[49m", stream); break; case LPD_TC_UNSET_COLOR: /* do nothing */ break; } if (retval == EOF) return LPD_TC_EFILE; return LPD_TC_OK; } /******************************************************************************* * POSIX implementatation. */ #ifndef _WIN32 #include <errno.h> #include <unistd.h> lpd_tc_result lpd_termcolor(FILE* stream, lpd_tc_color fg, lpd_tc_color bg) { int fd = fileno(stream); if (fd < 0) return LPD_TC_EERRNO; if (!isatty(fd)) { if (errno == ENOTTY) return LPD_TC_OK; return LPD_TC_EERRNO; } return lpd_tc__ansi(stream, fg, bg); } #endif /******************************************************************************* * Windows implementation. */ #ifdef _WIN32 #ifdef _MSC_VER #pragma warning(push, 0) #endif #include <stdlib.h> #include <string.h> #include <io.h> #include <Windows.h> #ifdef _MSC_VER #pragma warning(pop) #endif #define LPD_TERMKIND_STATIC #define LPD_TERMKIND_IMPLEMENTATION #include "lpd_termkind.h" lpd_tc_result lpd_tc__winapi(FILE* stream, lpd_tc_color fg, lpd_tc_color bg) { HANDLE handle = (HANDLE) _get_osfhandle(_fileno(stream)); if (handle == INVALID_HANDLE_VALUE) { return LPD_TC_EERRNO; } // If we want to retain any colors then we need to query for them. if (fg == LPD_TC_UNSET_COLOR || bg == LPD_TC_UNSET_COLOR) { CONSOLE_SCREEN_BUFFER_INFO info; if (!GetConsoleScreenBufferInfo(handle, &info)) return LPD_TC_EWIN; if (fg == LPD_TC_UNSET_COLOR) { fg = (lpd_tc_color) (info.wAttributes & LPD_TC_WHITE); } if (bg == LPD_TC_UNSET_COLOR) { bg = (lpd_tc_color) ((info.wAttributes >> 4) & LPD_TC_WHITE); } } // There is no default color on Windows, so just use white text on black. if (fg == LPD_TC_DEFAULT_COLOR) fg = LPD_TC_WHITE; if (bg == LPD_TC_DEFAULT_COLOR) bg = LPD_TC_BLACK; WORD attributes = (WORD) ((fg) | (bg << 4)); // Blue foreground is unreadable so use increased intensity. // (Even with intense blue it's hard to read...) if (fg == LPD_TC_BLUE) { attributes |= FOREGROUND_INTENSITY; } if (SetConsoleTextAttribute(handle, attributes)) return LPD_TC_OK; return LPD_TC_EWIN; } lpd_tc_result lpd_termcolor(FILE* stream, lpd_tc_color fg, lpd_tc_color bg) { switch (lpd_termkind_stream(stream)) { case LPD_TK_ERROR: return LPD_TC_EERRNO; case LPD_TK_NOTTY: return LPD_TC_OK; case LPD_TK_TTY: case LPD_TK_WIN_PTY: return lpd_tc__ansi(stream, fg, bg); case LPD_TK_WIN_CONSOLE: return lpd_tc__winapi(stream, fg, bg); } assert(0 && "unreachable"); return LPD_TC_OK; } #endif #endif #ifdef __cplusplus } #endif
28.314176
83
0.652909
c11f69dd42a321e057bf54e31bafe58a484185b8
2,381
h
C
Geometry/GEMGeometry/interface/ME0Chamber.h
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
852
2015-01-11T21:03:51.000Z
2022-03-25T21:14:00.000Z
Geometry/GEMGeometry/interface/ME0Chamber.h
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
30,371
2015-01-02T00:14:40.000Z
2022-03-31T23:26:05.000Z
Geometry/GEMGeometry/interface/ME0Chamber.h
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
3,240
2015-01-02T05:53:18.000Z
2022-03-31T17:24:21.000Z
#ifndef Geometry_GEMGeometry_ME0Chamber_h #define Geometry_GEMGeometry_ME0Chamber_h #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "DataFormats/MuonDetId/interface/ME0DetId.h" class ME0Layer; class ME0EtaPartition; class ME0Chamber : public GeomDet { public: /// Constructor ME0Chamber(ME0DetId id, const ReferenceCountingPointer<BoundPlane>& plane); /// Destructor ~ME0Chamber() override; /// Return the ME0DetId of this chamber ME0DetId id() const; // Which subdetector SubDetector subDetector() const override { return GeomDetEnumerators::ME0; } /// equal if the id is the same bool operator==(const ME0Chamber& ch) const; /// Add Layer to the chamber which takes ownership void add(ME0Layer* layer); /// Return the rolls in the chamber std::vector<const GeomDet*> components() const override; /// Return the sub-component (roll) with a given id in this chamber const GeomDet* component(DetId id) const override; /// Return the layer corresponding to the given id const ME0Layer* layer(ME0DetId id) const; const ME0Layer* layer(int isl) const; /// Return the layers const std::vector<const ME0Layer*>& layers() const; /// Retunr numbers of layers int nLayers() const; /// To support the old ME0 Geometry (with 1 eta partition) /// Add EtaPartition to the chamber which takes ownership void add(ME0EtaPartition* roll); /// To support the old ME0 Geometry (with 1 eta partition) /// Return the eta partition corresponding to the given id const ME0EtaPartition* etaPartition(ME0DetId id) const; const ME0EtaPartition* etaPartition(int isl) const; /// To support the old ME0 Geometry (with 1 eta partition) /// Return the eta partitions const std::vector<const ME0EtaPartition*>& etaPartitions() const; /// To support the old ME0 Geometry (with 1 eta partition) /// Retunr numbers of eta partitions int nEtaPartitions() const; //For a line fit in the chamber frame, compute: global phi position extrapolated //to the last layer - that extrapolated to the inner layer float computeDeltaPhi(const LocalPoint& position, const LocalVector& direction) const; private: ME0DetId detId_; // vector of layers for a chamber std::vector<const ME0Layer*> layers_; // vector of eta partitions for a chamber std::vector<const ME0EtaPartition*> etaPartitions_; }; #endif
30.525641
88
0.742125
c11f7d2a292271390f6b2bc0d93a0eb7bce3c736
99
h
C
WindowsImgProcess/Resource.h
vuminhquang/CppWindowsImgProcess
e932fc68af67a1377cda9320d933c1e379592fda
[ "MIT" ]
149
2015-11-04T14:28:07.000Z
2022-03-24T17:15:50.000Z
WindowsImgProcess/Resource.h
vuminhquang/CppWindowsImgProcess
e932fc68af67a1377cda9320d933c1e379592fda
[ "MIT" ]
328
2015-11-08T12:47:52.000Z
2022-03-23T22:32:18.000Z
WindowsImgProcess/Resource.h
vuminhquang/CppWindowsImgProcess
e932fc68af67a1377cda9320d933c1e379592fda
[ "MIT" ]
67
2016-03-22T19:17:28.000Z
2022-03-22T01:15:22.000Z
//{{NO_DEPENDENCIES}} // Von Microsoft Visual C++ generierte Includedatei. // Verwendet von app.rc
24.75
52
0.737374
c1211dac27012edd8ebfd22d3b63c9a7bda3b477
639
c
C
lib/wizards/grathlek/area4/mroom4.c
vlehtola/questmud
8bc3099b5ad00a9e0261faeb6637c76b521b6dbe
[ "MIT" ]
null
null
null
lib/wizards/grathlek/area4/mroom4.c
vlehtola/questmud
8bc3099b5ad00a9e0261faeb6637c76b521b6dbe
[ "MIT" ]
null
null
null
lib/wizards/grathlek/area4/mroom4.c
vlehtola/questmud
8bc3099b5ad00a9e0261faeb6637c76b521b6dbe
[ "MIT" ]
null
null
null
inherit "room/room"; object monster; reset(arg) { if(!monster) { monster = clone_object("/wizards/grathlek/area4/monsies/famu.c"); move_object(monster, this_object()); } add_exit("east","/wizards/grathlek/area4/mroom3.c"); add_exit("west","/wizards/grathlek/area4/mroom5.c"); add_exit("northwest","/wizards/grathlek/area4/croom5.c"); set_light(2); short_desc = "A filthy red junction."; long_desc = "This is the main corridor of this cave.\n"+ "The ground looks somewhat muddy and the\n"+ "red light shines from the west. Walls\n"+ "are covered by some stones.\n"; }
31.95
69
0.647887
c12135c06970ea3ce139dc254e29e193f2bb36dd
908
h
C
ALLocalLife/ALLocalLife/UI/ShopDetail/View/ALShopDetailHeader.h
alanwangke213/ALLocalLife
d41967814bcf66015396ae223b6430bc762d5ce1
[ "MIT" ]
null
null
null
ALLocalLife/ALLocalLife/UI/ShopDetail/View/ALShopDetailHeader.h
alanwangke213/ALLocalLife
d41967814bcf66015396ae223b6430bc762d5ce1
[ "MIT" ]
null
null
null
ALLocalLife/ALLocalLife/UI/ShopDetail/View/ALShopDetailHeader.h
alanwangke213/ALLocalLife
d41967814bcf66015396ae223b6430bc762d5ce1
[ "MIT" ]
null
null
null
// // ALShopDetail.h // ALLocalLife // // Created by 王可成 on 15/11/28. // Copyright © 2015年 AL. All rights reserved. // #import <UIKit/UIKit.h> @class ALShopModel; @protocol ALShopDetailDelegate <NSObject> @optional -(void)presentVc:(UIViewController *)vc; @end @interface ALShopDetailHeader : UIView @property (weak, nonatomic) IBOutlet UIImageView *imageView; @property (weak, nonatomic) IBOutlet UILabel *starLabel; @property (weak, nonatomic) IBOutlet UIImageView *starView; @property (weak, nonatomic) IBOutlet UILabel *shopNameLabel; @property (weak, nonatomic) IBOutlet UILabel *subTitleLabel; @property (weak, nonatomic) IBOutlet UIButton *shareBtn; @property (weak, nonatomic) IBOutlet UILabel *locationLabel; @property (weak, nonatomic) IBOutlet UIButton *phoneBtn; @property (nonatomic ,strong) ALShopModel *shopModel; @property (nonatomic ,strong)id<ALShopDetailDelegate>delegate; @end
27.515152
62
0.769824
c12383a95490ab8b6ab7fe03712475ea32c282b3
933
h
C
libs/libc/src/findmsg/conf/memcmp.h
Kamilcuk/kamillibc
f28299045bf7c497dc25f8fbeae8eacfe8a46dcb
[ "MIT" ]
null
null
null
libs/libc/src/findmsg/conf/memcmp.h
Kamilcuk/kamillibc
f28299045bf7c497dc25f8fbeae8eacfe8a46dcb
[ "MIT" ]
null
null
null
libs/libc/src/findmsg/conf/memcmp.h
Kamilcuk/kamillibc
f28299045bf7c497dc25f8fbeae8eacfe8a46dcb
[ "MIT" ]
null
null
null
/* * memcmp.h * * Created on: 17 mar 2018 * Author: kamil */ #ifndef SRC_FINDMSG_MEMCMP_H_ #define SRC_FINDMSG_MEMCMP_H_ #include <findmsg/findmsg.h> #include <assert.h> ssize_t findmsg_conf_memcmp_checkBeginning(const char buf[], size_t bufsize, void *arg); int findmsg_conf_memcmp_checkEnding(const char buf[], size_t bufsize, void *arg); static inline struct findmsg_conf_s findmsg_conf_memcmp(size_t memsize) { struct findmsg_conf_s ret = { .minlength = 1, .maxlength = memsize, .checkBeginning = &findmsg_conf_memcmp_checkBeginning, .checkEnding = &findmsg_conf_memcmp_checkEnding }; return ret; } static inline ssize_t findmsg_memcmp(struct findmsg_s *t, const char mem[], size_t memsize, struct timespec *timeout) { assert(memsize); const struct findmsg_conf_s conf = findmsg_conf_memcmp(memsize); return findmsg_findmsg(t, &conf, (void*)mem, timeout); } #endif /* SRC_FINDMSG_MEMCMP_H_ */
25.216216
117
0.756699
c1263885e804a5baa0c773e43f763de62ed45492
3,668
h
C
mpich-3.3/src/mpid/ch4/shm/stubshm/stubshm_recv.h
ucd-plse/mpi-error-prop
4367df88bcdc4d82c9a65b181d0e639d04962503
[ "BSD-3-Clause" ]
3
2020-05-22T04:17:23.000Z
2020-07-17T04:14:25.000Z
mpich-3.3/src/mpid/ch4/shm/stubshm/stubshm_recv.h
ucd-plse/mpi-error-prop
4367df88bcdc4d82c9a65b181d0e639d04962503
[ "BSD-3-Clause" ]
null
null
null
mpich-3.3/src/mpid/ch4/shm/stubshm/stubshm_recv.h
ucd-plse/mpi-error-prop
4367df88bcdc4d82c9a65b181d0e639d04962503
[ "BSD-3-Clause" ]
null
null
null
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* * (C) 2006 by Argonne National Laboratory. * See COPYRIGHT in top-level directory. * * Portions of this code were written by Intel Corporation. * Copyright (C) 2011-2016 Intel Corporation. Intel provides this material * to Argonne National Laboratory subject to Software Grant and Corporate * Contributor License Agreement dated February 8, 2012. */ #ifndef STUBSHM_RECV_H_INCLUDED #define STUBSHM_RECV_H_INCLUDED #include "stubshm_impl.h" #undef FCNAME #define FCNAME MPL_QUOTE(MPIDI_STUBSHM_mpi_recv) static inline int MPIDI_STUBSHM_mpi_recv(void *buf, MPI_Aint count, MPI_Datatype datatype, int rank, int tag, MPIR_Comm * comm, int context_offset, MPI_Status * status, MPIR_Request ** request) { MPIR_FUNC_VERBOSE_STATE_DECL(MPID_STATE_MPIDI_STUBSHM_MPI_RECV); MPIR_FUNC_VERBOSE_ENTER(MPID_STATE_MPIDI_STUBSHM_MPI_RECV); MPIR_Assert(0); MPIR_FUNC_VERBOSE_EXIT(MPID_STATE_MPIDI_STUBSHM_MPI_RECV); return MPI_SUCCESS; } static inline int MPIDI_STUBSHM_mpi_recv_init(void *buf, int count, MPI_Datatype datatype, int rank, int tag, MPIR_Comm * comm, int context_offset, MPIR_Request ** request) { MPIR_FUNC_VERBOSE_STATE_DECL(MPID_STATE_MPIDI_STUBSHM_MPI_RECV_INIT); MPIR_FUNC_VERBOSE_ENTER(MPID_STATE_MPIDI_STUBSHM_MPI_RECV_INIT); MPIR_Assert(0); MPIR_FUNC_VERBOSE_EXIT(MPID_STATE_MPIDI_STUBSHM_MPI_RECV_INIT); return MPI_SUCCESS; } static inline int MPIDI_STUBSHM_mpi_imrecv(void *buf, MPI_Aint count, MPI_Datatype datatype, MPIR_Request * message, MPIR_Request ** rreqp) { MPIR_FUNC_VERBOSE_STATE_DECL(MPID_STATE_MPIDI_STUBSHM_MPI_IMRECV); MPIR_FUNC_VERBOSE_ENTER(MPID_STATE_MPIDI_STUBSHM_MPI_IMRECV); MPIR_Assert(0); MPIR_FUNC_VERBOSE_EXIT(MPID_STATE_MPIDI_STUBSHM_MPI_IMRECV); return MPI_SUCCESS; } #undef FCNAME #define FCNAME MPL_QUOTE(MPIDI_STUBSHM_mpi_irecv) static inline int MPIDI_STUBSHM_mpi_irecv(void *buf, MPI_Aint count, MPI_Datatype datatype, int rank, int tag, MPIR_Comm * comm, int context_offset, MPIR_Request ** request) { MPIR_FUNC_VERBOSE_STATE_DECL(MPID_STATE_MPIDI_STUBSHM_MPI_IRECV); MPIR_FUNC_VERBOSE_ENTER(MPID_STATE_MPIDI_STUBSHM_MPI_IRECV); MPIR_Assert(0); MPIR_FUNC_VERBOSE_EXIT(MPID_STATE_MPIDI_STUBSHM_MPI_IRECV); return MPI_SUCCESS; } static inline int MPIDI_STUBSHM_mpi_cancel_recv(MPIR_Request * rreq) { MPIR_FUNC_VERBOSE_STATE_DECL(MPID_STATE_MPIDI_STUBSHM_MPI_CANCEL_RECV); MPIR_FUNC_VERBOSE_ENTER(MPID_STATE_MPIDI_STUBSHM_MPI_CANCEL_RECV); MPIR_Assert(0); MPIR_FUNC_VERBOSE_EXIT(MPID_STATE_MPIDI_STUBSHM_MPI_CANCEL_RECV); return MPI_SUCCESS; } #endif /* STUBSHM_RECV_H_INCLUDED */
37.050505
89
0.59542
c1266f158b3f02450395ee3bbddcfac25bb139ca
4,108
c
C
common/crypto/iss/v1/tests/test_iss.c
jkrvivian/iota_common
c8e65ea4d6e03e2a9973c11f2596f5376a0e5de9
[ "Apache-2.0" ]
9
2019-12-20T03:27:20.000Z
2021-02-08T11:07:56.000Z
common/crypto/iss/v1/tests/test_iss.c
jkrvivian/iota_common
c8e65ea4d6e03e2a9973c11f2596f5376a0e5de9
[ "Apache-2.0" ]
14
2020-01-14T08:37:02.000Z
2020-07-09T15:00:31.000Z
common/crypto/iss/v1/tests/test_iss.c
jkrvivian/iota_common
c8e65ea4d6e03e2a9973c11f2596f5376a0e5de9
[ "Apache-2.0" ]
13
2019-12-20T01:51:39.000Z
2020-07-08T13:22:53.000Z
/* * Copyright (c) 2018 IOTA Stiftung * https://github.com/iotaledger/iota_common * * Refer to the LICENSE file for licensing information */ #include <stdio.h> #include <unity/unity.h> #include "common/crypto/iss/normalize.h" #include "common/crypto/iss/v1/iss.h" #include "common/crypto/kerl/kerl.h" static tryte_t *seed = (tryte_t *)"NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN"; static tryte_t *message = (tryte_t *) "JCRNMXX9DIEVJJG9VW9QDUMVDGDVHANQDTCPPOPHLTBUBXULSIALRBVUINDPNGUFZLKDPOK9WBJMYCXF9" "MFQN9ZKMROOXHULIDDXRNWMDENBWJWVVA9XPNHQUVDFSMQ9ETWKWGLOLYPWW9GQPVNDYJIRDBWVCBUHUE" "GELSTLEXGAMMQAHSUEABKUSFOVGYRQBXJMORXIDTIPENPAFIUV9DOGZCAEPRJQOISRZDZBWWQQJVQDS9Y" "GCMNADNVSUTXXAONPHBFCMWSVFYYXXWDZXFP9SZGLRCHHGKLNAQPMAXHFUUSQEKDAPH9GFVHMYDITCTFS" "IJEZFADOJVDOEXOTDDPZYLKKDHCGPXYMGRKAGOEQYHTCTGKMZOKMZJLCQOYE9KFVRQLXDPBALUSEQSQDF" "PPUYALCDYWSHANNQYKIMAZMKQQ9XVCSJHAWXLY9IIREZTSOFRMRGKDQPIEMDXTBDTY9DKOAIUEGNLUSRF" "ZYPRNUOHFGDYIWFVKIUNYBGBHICRQTLDQQUTJX9DDSQANVKMCDZ9VEQBCHHSATVFIDYR9XUSDJHQDRBVK" "9JUUZVWGCCWVXAC9ZIOKBWOKCTCJVXIJFBSTLNZCPJMAKDPYLTHMOKLFDNONJLLDBDXNFKPKUBKDU9QFS" "XGVXS9PEDBDDBGFESSKCWUWMTOGHDLOPRILYYPSAQVTSQYLIPK9ATVMMYSTASHEZEFWBUNR9XKGCHR9MB"; void signature_resolves_to_address_test(void) { int index = 10; int nof = 1; trit_t seed_trits[HASH_LENGTH_TRIT]; trit_t subseed_trits[HASH_LENGTH_TRIT]; trit_t key[nof * ISS_KEY_LENGTH]; trit_t signature[nof * ISS_KEY_LENGTH]; trit_t key_digest[nof * HASH_LENGTH_TRIT]; trit_t sig_digest[HASH_LENGTH_TRIT]; size_t message_length = strlen((char *)message); trit_t message_trits[3 * message_length]; trit_t message_hash[HASH_LENGTH_TRIT]; sponge_type_t sponge_types[2] = {SPONGE_CURLP81, SPONGE_KERL}; trytes_to_trits(seed, seed_trits, HASH_LENGTH_TRYTE); for (int i = 0; i < 2; i++) { sponge_t sponge; Kerl kerl; kerl_init(&kerl); sponge_init(&sponge, sponge_types[i]); iss_subseed(&sponge, seed_trits, subseed_trits, index); iss_key(&sponge, subseed_trits, key, nof * ISS_KEY_LENGTH); trytes_to_trits(message, message_trits, message_length); kerl_absorb(&kerl, message_trits, 3 * message_length); kerl_squeeze(&kerl, message_hash, HASH_LENGTH_TRIT); normalize_hash_to_trits(message_hash, message_hash); iss_signature(&sponge, signature, message_hash, key, nof * ISS_KEY_LENGTH); iss_sig_digest(&sponge, sig_digest, message_hash, signature, nof * ISS_KEY_LENGTH); iss_address(&sponge, sig_digest, sig_digest, HASH_LENGTH_TRIT); iss_key_digest(&sponge, key, key_digest, nof * ISS_KEY_LENGTH); iss_address(&sponge, key_digest, key_digest, nof * HASH_LENGTH_TRIT); TEST_ASSERT_EQUAL_MEMORY(key_digest, sig_digest, HASH_LENGTH_TRIT); sponge_destroy(&sponge); } } void address_generation_test(void) { int index = 0; int nof = 2; trit_t seed_trits[HASH_LENGTH_TRIT]; trit_t subseed_trits[HASH_LENGTH_TRIT]; trit_t key[nof * ISS_KEY_LENGTH]; trit_t digest[nof * HASH_LENGTH_TRIT]; tryte_t address[HASH_LENGTH_TRYTE]; sponge_type_t sponge_types[2] = {SPONGE_CURLP81, SPONGE_KERL}; tryte_t *hashes[2] = {(tryte_t *)"D9XCNSCCAJGLWSQOQAQNFWANPYKYMCQ9VCOMROLDVLONPPLDFVPIZNAPVZLQMPFYJPAHUKIAEKNCQIYJZ", (tryte_t *)"MDWYEJJHJDIUVPKDY9EACGDJUOP9TLYDWETUBOYCBLYXYYYJYUXYUTCTPTDGJYFKMQMCNZDQPTBE9AFIW"}; trytes_to_trits(seed, seed_trits, HASH_LENGTH_TRYTE); for (int i = 0; i < 2; i++) { sponge_t sponge; sponge_init(&sponge, sponge_types[i]); iss_subseed(&sponge, seed_trits, subseed_trits, index); iss_key(&sponge, subseed_trits, key, nof * ISS_KEY_LENGTH); iss_key_digest(&sponge, key, digest, nof * ISS_KEY_LENGTH); iss_address(&sponge, digest, digest, nof * HASH_LENGTH_TRIT); trits_to_trytes(digest, address, HASH_LENGTH_TRIT); TEST_ASSERT_EQUAL_MEMORY(hashes[i], address, HASH_LENGTH_TRYTE); sponge_destroy(&sponge); } } int main(void) { UNITY_BEGIN(); RUN_TEST(signature_resolves_to_address_test); RUN_TEST(address_generation_test); return UNITY_END(); }
40.27451
120
0.782132
c128334c586c3be20e5ec82e515d49ae3d205f93
1,757
h
C
dovecot-2.2.33.2/src/lib-master/service-settings.h
NicoleRobin/dovecot
f971413537673e781c00808bc039fde5749fcc95
[ "MIT" ]
null
null
null
dovecot-2.2.33.2/src/lib-master/service-settings.h
NicoleRobin/dovecot
f971413537673e781c00808bc039fde5749fcc95
[ "MIT" ]
null
null
null
dovecot-2.2.33.2/src/lib-master/service-settings.h
NicoleRobin/dovecot
f971413537673e781c00808bc039fde5749fcc95
[ "MIT" ]
null
null
null
#ifndef SERVICE_SETTINGS_H #define SERVICE_SETTINGS_H #include "net.h" /* <settings checks> */ enum service_user_default { SERVICE_USER_DEFAULT_NONE = 0, SERVICE_USER_DEFAULT_INTERNAL, SERVICE_USER_DEFAULT_LOGIN }; enum service_type { SERVICE_TYPE_UNKNOWN, SERVICE_TYPE_LOG, SERVICE_TYPE_ANVIL, SERVICE_TYPE_CONFIG, SERVICE_TYPE_LOGIN, SERVICE_TYPE_STARTUP }; /* </settings checks> */ struct file_listener_settings { const char *path; unsigned int mode; const char *user; const char *group; }; ARRAY_DEFINE_TYPE(file_listener_settings, struct file_listener_settings *); struct inet_listener_settings { const char *name; const char *address; in_port_t port; bool ssl; bool reuse_port; bool haproxy; }; ARRAY_DEFINE_TYPE(inet_listener_settings, struct inet_listener_settings *); struct service_settings { const char *name; const char *protocol; const char *type; const char *executable; const char *user; const char *group; const char *privileged_group; const char *extra_groups; const char *chroot; bool drop_priv_before_exec; unsigned int process_min_avail; unsigned int process_limit; unsigned int client_limit; unsigned int service_count; unsigned int idle_kill; uoff_t vsz_limit; ARRAY_TYPE(file_listener_settings) unix_listeners; ARRAY_TYPE(file_listener_settings) fifo_listeners; ARRAY_TYPE(inet_listener_settings) inet_listeners; /* internal to master: */ struct master_settings *master_set; enum service_type parsed_type; enum service_user_default user_default; unsigned int login_dump_core:1; /* -- flags that can be set internally -- */ /* process_limit must not be higher than 1 */ unsigned int process_limit_1:1; }; ARRAY_DEFINE_TYPE(service_settings, struct service_settings *); #endif
22.240506
75
0.79169
c1290fbe6b01f3dea45fccec31fb56de94f401e5
2,872
c
C
c_program/TheGame/main.c
jassjagga/C-FreeRTOS
4444cd8a758c14529ef50fcebd7b3448e18166ed
[ "MIT" ]
null
null
null
c_program/TheGame/main.c
jassjagga/C-FreeRTOS
4444cd8a758c14529ef50fcebd7b3448e18166ed
[ "MIT" ]
null
null
null
c_program/TheGame/main.c
jassjagga/C-FreeRTOS
4444cd8a758c14529ef50fcebd7b3448e18166ed
[ "MIT" ]
null
null
null
#include<stdio.h> #include<stdlib.h> #include<pthread.h> #include<math.h> #include<unistd.h> #include<stdbool.h> pthread_t tm1, tm2, tm3; //player01 is Using Binary search Method to guess the number. void* player01(void *arg) { int minNum = 1; int maxNum = 100; int *Num = (int*) arg; int turns = 1; int pguess; tm1 = pthread_self(); while (1) { usleep(1000); int guess = maxNum + minNum - 1; pguess = (int) ceil(guess / 2.0); //possible guess by dividing the maximum range by 2 printf("Guess by Player-01 = %d in %d turns \n", pguess, turns); if (pguess < *Num) minNum = pguess + 1; else if (pguess > *Num) maxNum = pguess - 1; else if (pguess == *Num) { pthread_cancel(tm2); pthread_cancel(tm3); printf("Congratulation! PLAYER-01 WON the GAME!:)"); break; } turns++; } return NULL; } //Here Player02 is Using Liner Search Method to Guess the Number void* player02(void *arg) { int *Num1 = (int*) arg; int i = 1; tm2 = pthread_self(); while (1) { usleep(1000); if (i != *Num1) printf("Guess by Player-02 = %d in %d turns \n ", i, i); else if (i == *Num1) { printf("Guess by Player-02 = %d in %d turns \n ", i, i); pthread_cancel(tm1); pthread_cancel(tm3); printf("Congratulation! PLAYER-02 WON the GAME!:)"); break; } i++; } return NULL; } //Here Player03 Using Random Number to Guess the Number. void* player03(void *arg) { int *Num2 = (int*) arg; int turns = 1; int random_x; tm3 = pthread_self(); srand(time(NULL)); while (1) { usleep(1000); random_x = rand() % 100; printf("Guess by Player-03 = %d in %d turns \n ", random_x, turns); if (random_x == *Num2) { pthread_cancel(tm1); pthread_cancel(tm2); printf("Congratulation! PLAYER-03 WON the GAME!:)"); break; } turns++; } return NULL; } int main() { int UsrNum; printf( "*********************************************************************** \n"); printf( "** Welcome To Guessing Game ** \n"); printf( "*********************************************************************** \n \n"); printf("PLEASE, Enter any NUMBER between 1 to 100 : - "); scanf("%d", &UsrNum); //pthread for Binary Search pthread_t mythread; //second pthread to Linear Search Method pthread_t secondthread; //third thread to Jump search Method pthread_t thirdthread; if (pthread_create(&mythread, NULL, player01, &UsrNum) != 0) { printf("Failed to create the thread\n"); return 1; } if (pthread_create(&secondthread, NULL, player02, &UsrNum) != 0) { printf("Failed to create the thread\n"); return 1; } if (pthread_create(&thirdthread, NULL, player03, &UsrNum) != 0) { printf("Failed to create the thread\n"); return 1; } pthread_join(mythread, NULL); pthread_join(secondthread, NULL); pthread_join(thirdthread, NULL); return 0; }
22.614173
87
0.598189
c12943424921e72844063fb7664a958d0f485d45
8,994
h
C
extern/PhysX/v3.2.0_win/Include/extensions/PxSimpleFactory.h
nmovshov/ARSS_win
0d9c7930452dbadbeb0f1aafafa53cdca8e65fdc
[ "BSD-2-Clause" ]
1
2021-01-27T11:57:27.000Z
2021-01-27T11:57:27.000Z
extern/PhysX/v3.2.0_win/Include/extensions/PxSimpleFactory.h
nmovshov/ARSS_win
0d9c7930452dbadbeb0f1aafafa53cdca8e65fdc
[ "BSD-2-Clause" ]
null
null
null
extern/PhysX/v3.2.0_win/Include/extensions/PxSimpleFactory.h
nmovshov/ARSS_win
0d9c7930452dbadbeb0f1aafafa53cdca8e65fdc
[ "BSD-2-Clause" ]
null
null
null
// This code contains NVIDIA Confidential Information and is disclosed to you // under a form of NVIDIA software license agreement provided separately to you. // // Notice // NVIDIA Corporation and its licensors retain all intellectual property and // proprietary rights in and to this software and related documentation and // any modifications thereto. Any use, reproduction, disclosure, or // distribution of this software and related documentation without an express // license agreement from NVIDIA Corporation is strictly prohibited. // // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. // // Information and code furnished is believed to be accurate and reliable. // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such // information or for any infringement of patents or other rights of third parties that may // result from its use. No license is granted by implication or otherwise under any patent // or patent rights of NVIDIA Corporation. Details are subject to change without notice. // This code supersedes and replaces all information previously supplied. // NVIDIA Corporation products are not authorized for use as critical // components in life support devices or systems without express written approval of // NVIDIA Corporation. // // Copyright (c) 2008-2012 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. #ifndef PX_PHYSICS_EXTENSIONS_SIMPLE_FACTORY_H #define PX_PHYSICS_EXTENSIONS_SIMPLE_FACTORY_H /** \addtogroup extensions @{ */ #include "common/PxPhysXCommon.h" #include "foundation/PxTransform.h" #include "foundation/PxPlane.h" #ifndef PX_DOXYGEN namespace physx { #endif class PxPhysics; class PxMaterial; class PxRigidActor; class PxRigidDynamic; class PxRigidStatic; class PxGeometry; #ifndef PX_DOXYGEN } // namespace physx #endif /** \brief simple method to create a PxRigidDynamic actor with a single PxShape. \param[in] sdk the PxPhysics object \param[in] transform the global pose of the new object \param[in] geometry the geometry of the new object's shape, which must be a sphere, capsule, box or convex \param[in] material the material for the new object's shape \param[in] density the density of the new object. Must be greater than zero. \param[in] shapeOffset an optional offset for the new shape, defaults to identity \return a new dynamic actor with the PxRigidDynamicFlag, or NULL if it could not be constructed @see PxRigidDynamic PxShapeFlag */ PX_C_EXPORT physx::PxRigidDynamic* PX_CALL_CONV PxCreateDynamic(physx::PxPhysics& sdk, const physx::PxTransform& transform, const physx::PxGeometry& geometry, physx::PxMaterial& material, physx::PxReal density, const physx::PxTransform& shapeOffset = physx::PxTransform::createIdentity()); /** \brief simple method to create a kinematic PxRigidDynamic actor with a single PxShape. \param[in] sdk the PxPhysics object \param[in] transform the global pose of the new object \param[in] geometry the geometry of the new object's shape \param[in] material the material for the new object's shape \param[in] density the density of the new object. Must be greater than zero if the object is to participate in simulation. \param[in] shapeOffset an optional offset for the new shape, defaults to identity \note unlike PxCreateDynamic, the geometry is not restricted to box, capsule, sphere or convex. However, kinematics of other geometry types may not participate in simulation collision and may be used only for triggers or scene queries of moving objects under animation control. In this case the density parameter will be ignored and the created shape will be set up as a scene query only shape (see #PxShapeFlag::eSCENE_QUERY_SHAPE) \return a new dynamic actor with the PxRigidDynamicFlag::eKINEMATIC set, or NULL if it could not be constructed @see PxRigidDynamic PxShapeFlag */ PX_C_EXPORT physx::PxRigidDynamic* PX_CALL_CONV PxCreateKinematic(physx::PxPhysics& sdk, const physx::PxTransform& transform, const physx::PxGeometry& geometry, physx::PxMaterial& material, physx::PxReal density, const physx::PxTransform& shapeOffset = physx::PxTransform::createIdentity()); /** \brief simple method to create a PxRigidStatic actor with a single PxShape. \param[in] sdk the PxPhysics object \param[in] transform the global pose of the new object \param[in] geometry the geometry of the new object's shape \param[in] material the material for the new object's shape \param[in] shapeOffset an optional offset for the new shape, defaults to identity \return a new static actor, or NULL if it could not be constructed @see PxRigidStatic */ PX_C_EXPORT physx::PxRigidStatic* PX_CALL_CONV PxCreateStatic(physx::PxPhysics& sdk, const physx::PxTransform& transform, const physx::PxGeometry& geometry, physx::PxMaterial& material, const physx::PxTransform& shapeOffset = physx::PxTransform::createIdentity()); /** \brief create a static body by copying attributes from another rigid actor The function clones a PxRigidDynamic as a PxRigidStatic. A uniform scale is applied. The following properties are copied: - shapes - actor flags - owner client and client behavior bits The following are not copied and retain their default values: - name - joints or observers - aggregate or scene membership - user data \note Transforms are not copied with bit-exact accuracy. \param[in] physicsSDK - the physics SDK used to allocate the rigid static \param[in] actor the rigid actor from which to take the attributes. \param[in] transform the transform of the new static. \return returns the newly-created rigid static */ PX_C_EXPORT physx::PxRigidStatic* PX_CALL_CONV PxCloneStatic(physx::PxPhysics& physicsSDK, const physx::PxTransform& transform, const physx::PxRigidActor& actor); /** \brief create a dynamic body by copying attributes from an existing body The following properties are copied: - shapes - actor flags and rigidDynamic flags - mass, moment of inertia, and center of mass frame - linear and angular velocity - linear and angular damping - maximum angular velocity - position and velocity solver iterations - sleep threshold - contact report threshold - dominance group - owner client and client behavior bits The following are not copied and retain their default values: - name - joints or observers - aggregate or scene membership - sleep timer - user data \note Transforms are not copied with bit-exact accuracy. \param[in] physicsSDK PxPhysics - the physics SDK used to allocate the rigid static \param[in] body the rigid dynamic to clone. \param[in] transform the transform of the new dynamic \return returns the newly-created rigid static */ PX_C_EXPORT physx::PxRigidDynamic* PX_CALL_CONV PxCloneDynamic(physx::PxPhysics& physicsSDK, const physx::PxTransform& transform, const physx::PxRigidDynamic& body); /** \brief create a plane actor. The plane equation is n.x + d = 0 \param[in] sdk the PxPhysics object \param[in] plane a plane of the form n.x + d = 0 \param[in] material the material for the new object's shape \return a new static actor, or NULL if it could not be constructed @see PxRigidStatic */ PX_C_EXPORT physx::PxRigidStatic* PX_CALL_CONV PxCreatePlane(physx::PxPhysics& sdk, const physx::PxPlane& plane, physx::PxMaterial& material); /** \brief scale a rigid actor by a uniform scale The geometry and relative positions of the actor are multiplied by the given scale value. If the actor is a rigid body or an articulation link and the scaleMassProps value is true, the mass properties are scaled assuming the density is constant: the center of mass is linearly scaled, the mass is multiplied by the cube of the scale, and the inertia tensor by the fifth power of the scale. \param[in] actor a rigid actor \param[in] scale the scale by which to multiply the actor \param[in] scaleMassProps whether to scale the mass properties */ PX_C_EXPORT void PX_CALL_CONV PxScaleRigidActor(physx::PxRigidActor& actor, physx::PxReal scale, bool scaleMassProps = true); /** @} */ #endif
39.447368
141
0.732488
c1295f63a0d33cf6b795481fa7edc81470cabc71
4,570
h
C
Engine/inc/DependencyTracker.h
jpvanoosten/VolumeTiledForwardShading
daf27632cb173c05faace6db0b72a74ae0fe216c
[ "MIT" ]
70
2017-11-12T08:25:47.000Z
2022-03-10T03:16:06.000Z
Engine/inc/DependencyTracker.h
jpvanoosten/VolumeTiledForwardShading
daf27632cb173c05faace6db0b72a74ae0fe216c
[ "MIT" ]
null
null
null
Engine/inc/DependencyTracker.h
jpvanoosten/VolumeTiledForwardShading
daf27632cb173c05faace6db0b72a74ae0fe216c
[ "MIT" ]
11
2017-12-18T12:42:32.000Z
2022-02-04T08:19:53.000Z
#pragma once #include <filesystem> namespace fs = std::filesystem; #include "Object.h" #include "Events.h" #include "ReadDirectoryChanges.h" class DependencyTracker { public: DependencyTracker(); /** * Parameterized constructor. * @param fileName The main asset file that is to be tracked. Other assets * that the base file has dependencies on should be expressed relative to the * base file. */ explicit DependencyTracker( const std::wstring& baseFile ); virtual ~DependencyTracker(); const DependencyTracker& operator=( const DependencyTracker& other ); /** * Set the base file that this dependency tracker tracks. */ void SetBaseFile( const std::wstring& baseFile ); /** * Add a dependency that should be tracked by this dependency tracker. */ void AddDependency( const std::wstring& dependencyFile ); /** * Check to see if the base file or any of the dependencies have changed * on disk. * Using this function is expensive and should only be checked during load * if the optimized asset needs to be reexported because the original * asset or one of its dependencies have changed. * The asset should register for the FileChanged event and only reload the * asset if that event is fired. * @returns true if the base file or any of the dependencies have been * modified since the last load time. */ bool IsStale(); /** * Update the last load time to this value. * @param lastLoadTime Update the last load time by this time. By default, it * will use the default time of the system clock. */ void SetLastLoadTime( fs::file_time_type lastLoadTime = fs::file_time_type::clock::now() ); fs::file_time_type GetLastLoadTime() const; /** * This function will not save the assets that the dependency tracks. * * Save the dependency file to disk. * The dependency file will be saved in the same folder as the base file * with the extension of the base file replaced with ".dep". * * @returns true if the dependency file was successfully saved to disk. */ bool Save(); /** * This function will not load the assets that the dependency tracks. * * Load the dependencies from the dependency file. * The dependency file will be loaded from the same folder as the base file * with the extension of the base file replaced with ".dep". * * @returns true if the dependencies were successfully loaded. */ bool Load(); /** * This event will be fired if the base file or any of its * dependencies have changed on disk. This event only fires * if the file has changed at runtime. To check if a file * that has been previously exported needs to be re-exported, use the * Dependency::IsStale method during loading of the optimized asset. */ Core::FileChangeEvent FileChanged; protected: // Callback function that gets invoked when a file modification has been detected. virtual void OnFileChanged( Core::FileChangeEventArgs& e ); private: friend class boost::serialization::access; template<class Archive> void serialize( Archive& ar, const unsigned int version ); // The base file. std::wstring m_BaseFile; // The dependency file is used to serialize an asset's dependencies // For some assets it is possible to automatically determine their dependencies, // but in most cases, we just want to manually describe an asset's // dependencies (for example, for various model formats). fs::path m_DependencyPath; // The parent path stores the parent folder of the dependency file. // This is needed so that dependencies can be expressed relative // to the dependency file. fs::path m_ParentPath; typedef std::vector< std::wstring > DependencyList; DependencyList m_Dependencies; // The last time the base file and it's dependencies were loaded. // If the base file or it's dependencies are modified since they were // last loaded, the dependency tracker will be marked "stale" and the // assets should be reloaded. fs::file_time_type m_LastLoadtime; // Mutex to protect modifications to dependency tracker typedef std::recursive_mutex Mutex; typedef std::unique_lock<Mutex> MutexLock; Mutex m_Mutex; Core::Event::ScopedConnections m_EventConnections; }; #include "DependencyTracker.inl" BOOST_CLASS_VERSION( DependencyTracker, 0 );
33.851852
95
0.69256
c1298a92e0002d7d9e6609faab29d3a8a8167753
905
h
C
AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/TFRBaseRPCCell.h
ceekay1991/AliPayForDebug
5795e5db31e5b649d4758469b752585e63e84d94
[ "MIT" ]
5
2020-03-29T12:08:37.000Z
2021-05-26T05:20:11.000Z
AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/TFRBaseRPCCell.h
ceekay1991/AliPayForDebug
5795e5db31e5b649d4758469b752585e63e84d94
[ "MIT" ]
null
null
null
AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/TFRBaseRPCCell.h
ceekay1991/AliPayForDebug
5795e5db31e5b649d4758469b752585e63e84d94
[ "MIT" ]
5
2020-04-17T03:24:04.000Z
2022-03-30T05:42:17.000Z
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 17 2017 16:24:48). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import "TFRBaseCell.h" @class DTRpcAsyncCaller, DTRpcException; @interface TFRBaseRPCCell : TFRBaseCell { _Bool _needCache; DTRpcException *_rpcException; DTRpcAsyncCaller *_rpcCaller; } @property(retain, nonatomic) DTRpcAsyncCaller *rpcCaller; // @synthesize rpcCaller=_rpcCaller; @property(retain, nonatomic) DTRpcException *rpcException; // @synthesize rpcException=_rpcException; @property(nonatomic) _Bool needCache; // @synthesize needCache=_needCache; - (void).cxx_destruct; - (id)cacheBusiness; - (id)cacheKey; - (id)loadCache; - (void)loadBegin; - (void)loadError:(id)arg1; - (void)loadSuccess:(id)arg1; - (void)handleModel:(id)arg1; - (id)loadOnline; - (void)queryData; - (void)dealloc; @end
25.857143
101
0.730387
c129afda205e93c73be53d4501ebc1683fc1695b
1,716
h
C
Sources/config.h
John-Titor/MRS_Microplex_7_Core
8796181c799802959900dc35f22dd31022113de7
[ "CC0-1.0" ]
null
null
null
Sources/config.h
John-Titor/MRS_Microplex_7_Core
8796181c799802959900dc35f22dd31022113de7
[ "CC0-1.0" ]
null
null
null
Sources/config.h
John-Titor/MRS_Microplex_7_Core
8796181c799802959900dc35f22dd31022113de7
[ "CC0-1.0" ]
null
null
null
/* * Configuration parameters. */ #ifndef _CONFIG_H #define _CONFIG_H /* * Timeout (ms) before deciding that CAN has been disconnected. */ #define CAN_IDLE_TIMEOUT 2000 /* * Size of the CAN receive FIFO. */ #define CAN_RX_FIFO_SIZE 8 /* * Minimum load current (mA): below this, output is considered open. */ #define SENSE_OPEN_CURRENT 50 /* * Maximum load current (mA): over this, output is considered overloaded. */ #define SENSE_OVERLOAD_CURRENT 2500 /* * Maximum off voltage (mV): over this, output is considered stuck/shorted to +12. */ #define SENSE_STUCK_VOLTAGE 2000 /* * Inrush current settling time (ms) */ #define SENSE_INRUSH_DELAY 50 /* * Turn-off current settling time (ms) */ #define SENSE_SETTLE_DELAY 500 /* * Delay between retries for an overloaded output (ms). */ #define SENSE_OVERLOAD_RETRY_INTERVAL 1000 /* * Blink Marine keypad configuration */ //#define BK_FIXED_KEYPAD_ID 0x15 // assume keypad ID #define BK_MAX_KEYS 12 // largest keypad supported #define BK_IDLE_TIMEOUT_MS 1000 // timeout before assuming keypad gone #define BK_UPDATE_PERIOD_MS 25 // expected keypad update interval #define BK_BLINK_PERIOD_MS 250 // time per pattern bit #define BK_TICK_PERIOD_MS 25 // interval between ticks #define BK_SHORT_PRESS_TICKS 2 // delay before registering a short press #define BK_LONG_PRESS_1_TICKS 20 // delay before registering first long press #define BK_LONG_PRESS_2_TICKS 60 // delay before registering a long press #define BK_LONG_PRESS_3_TICKS 120 // delay before registering a long press #endif // _CONFIG_H
27.238095
84
0.69697
c12ac87f7782c114c39233e699c6e2dbd99ac999
1,281
h
C
UIView-Qqc/UIView+Qqc.h
xukiki/UIView-Qqc
219c166825f54d12c393d4e3941257d4e3426d09
[ "MIT" ]
null
null
null
UIView-Qqc/UIView+Qqc.h
xukiki/UIView-Qqc
219c166825f54d12c393d4e3941257d4e3426d09
[ "MIT" ]
null
null
null
UIView-Qqc/UIView+Qqc.h
xukiki/UIView-Qqc
219c166825f54d12c393d4e3941257d4e3426d09
[ "MIT" ]
null
null
null
// // UIView+Qqc.h // QqcFramework // // Created by mahailin on 15/8/7. // Copyright (c) 2015年 admin. All rights reserved. // #import <UIKit/UIKit.h> @interface UIView (Qqc) /** * 控件的大小 */ @property (nonatomic, assign) CGSize size; /** * 左边距 */ @property (nonatomic, assign) CGFloat left; /** * 左边距+宽度 */ @property (nonatomic, assign) CGFloat right; /** * 上边距 */ @property (nonatomic, assign) CGFloat top; /** * 上边距+高度 */ @property (nonatomic, assign) CGFloat bottom; /** * 横轴中心位置 */ @property (nonatomic, assign) CGFloat centerX; /** * 纵轴中心位置 */ @property (nonatomic, assign) CGFloat centerY; /** * 宽度 */ @property (nonatomic, assign) CGFloat width; /** * 高度 */ @property (nonatomic, assign) CGFloat height; /** * 内部center */ @property (nonatomic, assign, readonly) CGPoint innerCenter; /** * 遍历出当前view所在的viewcontroller */ @property (nonatomic, readonly) UIViewController *viewController; /** * 载入同类名的nib文件并返回该view的实例 * * @return 指定view的实例 */ + (instancetype)viewWithClassNamedNib; /** * 载入同类名的nib文件并返回该view的实例 * * @return 指定view的实例 */ + (instancetype)viewOfClassNamedNib; /** * 载入同类名的nib文件并返回该view的实例 * * @return 指定view的实例 */ + (instancetype)viewOfClassNamedNibWithBundleName:(NSString*)strBundleName; @end
13.923913
75
0.665105
c12aef56a878b4c7c86e34dbf9129dec2be1f7a4
32,698
h
C
tsf/include/tencentcloud/tsf/v20180326/model/ContainerGroupDetail.h
X-Crack/tencentcloud-sdk-cpp
57ada84c1651b223bd6540a3e894cd1041c52e14
[ "Apache-2.0" ]
null
null
null
tsf/include/tencentcloud/tsf/v20180326/model/ContainerGroupDetail.h
X-Crack/tencentcloud-sdk-cpp
57ada84c1651b223bd6540a3e894cd1041c52e14
[ "Apache-2.0" ]
null
null
null
tsf/include/tencentcloud/tsf/v20180326/model/ContainerGroupDetail.h
X-Crack/tencentcloud-sdk-cpp
57ada84c1651b223bd6540a3e894cd1041c52e14
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. 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. */ #ifndef TENCENTCLOUD_TSF_V20180326_MODEL_CONTAINERGROUPDETAIL_H_ #define TENCENTCLOUD_TSF_V20180326_MODEL_CONTAINERGROUPDETAIL_H_ #include <string> #include <vector> #include <map> #include <tencentcloud/core/utils/rapidjson/document.h> #include <tencentcloud/core/utils/rapidjson/writer.h> #include <tencentcloud/core/utils/rapidjson/stringbuffer.h> #include <tencentcloud/core/AbstractModel.h> #include <tencentcloud/tsf/v20180326/model/ProtocolPort.h> #include <tencentcloud/tsf/v20180326/model/Env.h> namespace TencentCloud { namespace Tsf { namespace V20180326 { namespace Model { /** * 容器部署组详情 */ class ContainerGroupDetail : public AbstractModel { public: ContainerGroupDetail(); ~ContainerGroupDetail() = default; void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const; CoreInternalOutcome Deserialize(const rapidjson::Value &value); /** * 获取部署组ID 注意:此字段可能返回 null,表示取不到有效值。 * @return GroupId 部署组ID 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetGroupId() const; /** * 设置部署组ID 注意:此字段可能返回 null,表示取不到有效值。 * @param GroupId 部署组ID 注意:此字段可能返回 null,表示取不到有效值。 */ void SetGroupId(const std::string& _groupId); /** * 判断参数 GroupId 是否已赋值 * @return GroupId 是否已赋值 */ bool GroupIdHasBeenSet() const; /** * 获取分组名称 注意:此字段可能返回 null,表示取不到有效值。 * @return GroupName 分组名称 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetGroupName() const; /** * 设置分组名称 注意:此字段可能返回 null,表示取不到有效值。 * @param GroupName 分组名称 注意:此字段可能返回 null,表示取不到有效值。 */ void SetGroupName(const std::string& _groupName); /** * 判断参数 GroupName 是否已赋值 * @return GroupName 是否已赋值 */ bool GroupNameHasBeenSet() const; /** * 获取实例总数 注意:此字段可能返回 null,表示取不到有效值。 * @return InstanceNum 实例总数 注意:此字段可能返回 null,表示取不到有效值。 */ int64_t GetInstanceNum() const; /** * 设置实例总数 注意:此字段可能返回 null,表示取不到有效值。 * @param InstanceNum 实例总数 注意:此字段可能返回 null,表示取不到有效值。 */ void SetInstanceNum(const int64_t& _instanceNum); /** * 判断参数 InstanceNum 是否已赋值 * @return InstanceNum 是否已赋值 */ bool InstanceNumHasBeenSet() const; /** * 获取已启动实例总数 注意:此字段可能返回 null,表示取不到有效值。 * @return CurrentNum 已启动实例总数 注意:此字段可能返回 null,表示取不到有效值。 */ int64_t GetCurrentNum() const; /** * 设置已启动实例总数 注意:此字段可能返回 null,表示取不到有效值。 * @param CurrentNum 已启动实例总数 注意:此字段可能返回 null,表示取不到有效值。 */ void SetCurrentNum(const int64_t& _currentNum); /** * 判断参数 CurrentNum 是否已赋值 * @return CurrentNum 是否已赋值 */ bool CurrentNumHasBeenSet() const; /** * 获取创建时间 注意:此字段可能返回 null,表示取不到有效值。 * @return CreateTime 创建时间 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetCreateTime() const; /** * 设置创建时间 注意:此字段可能返回 null,表示取不到有效值。 * @param CreateTime 创建时间 注意:此字段可能返回 null,表示取不到有效值。 */ void SetCreateTime(const std::string& _createTime); /** * 判断参数 CreateTime 是否已赋值 * @return CreateTime 是否已赋值 */ bool CreateTimeHasBeenSet() const; /** * 获取镜像server 注意:此字段可能返回 null,表示取不到有效值。 * @return Server 镜像server 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetServer() const; /** * 设置镜像server 注意:此字段可能返回 null,表示取不到有效值。 * @param Server 镜像server 注意:此字段可能返回 null,表示取不到有效值。 */ void SetServer(const std::string& _server); /** * 判断参数 Server 是否已赋值 * @return Server 是否已赋值 */ bool ServerHasBeenSet() const; /** * 获取镜像名,如/tsf/nginx 注意:此字段可能返回 null,表示取不到有效值。 * @return Reponame 镜像名,如/tsf/nginx 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetReponame() const; /** * 设置镜像名,如/tsf/nginx 注意:此字段可能返回 null,表示取不到有效值。 * @param Reponame 镜像名,如/tsf/nginx 注意:此字段可能返回 null,表示取不到有效值。 */ void SetReponame(const std::string& _reponame); /** * 判断参数 Reponame 是否已赋值 * @return Reponame 是否已赋值 */ bool ReponameHasBeenSet() const; /** * 获取镜像版本名称 注意:此字段可能返回 null,表示取不到有效值。 * @return TagName 镜像版本名称 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetTagName() const; /** * 设置镜像版本名称 注意:此字段可能返回 null,表示取不到有效值。 * @param TagName 镜像版本名称 注意:此字段可能返回 null,表示取不到有效值。 */ void SetTagName(const std::string& _tagName); /** * 判断参数 TagName 是否已赋值 * @return TagName 是否已赋值 */ bool TagNameHasBeenSet() const; /** * 获取集群ID 注意:此字段可能返回 null,表示取不到有效值。 * @return ClusterId 集群ID 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetClusterId() const; /** * 设置集群ID 注意:此字段可能返回 null,表示取不到有效值。 * @param ClusterId 集群ID 注意:此字段可能返回 null,表示取不到有效值。 */ void SetClusterId(const std::string& _clusterId); /** * 判断参数 ClusterId 是否已赋值 * @return ClusterId 是否已赋值 */ bool ClusterIdHasBeenSet() const; /** * 获取集群名称 注意:此字段可能返回 null,表示取不到有效值。 * @return ClusterName 集群名称 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetClusterName() const; /** * 设置集群名称 注意:此字段可能返回 null,表示取不到有效值。 * @param ClusterName 集群名称 注意:此字段可能返回 null,表示取不到有效值。 */ void SetClusterName(const std::string& _clusterName); /** * 判断参数 ClusterName 是否已赋值 * @return ClusterName 是否已赋值 */ bool ClusterNameHasBeenSet() const; /** * 获取命名空间ID 注意:此字段可能返回 null,表示取不到有效值。 * @return NamespaceId 命名空间ID 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetNamespaceId() const; /** * 设置命名空间ID 注意:此字段可能返回 null,表示取不到有效值。 * @param NamespaceId 命名空间ID 注意:此字段可能返回 null,表示取不到有效值。 */ void SetNamespaceId(const std::string& _namespaceId); /** * 判断参数 NamespaceId 是否已赋值 * @return NamespaceId 是否已赋值 */ bool NamespaceIdHasBeenSet() const; /** * 获取命名空间名称 注意:此字段可能返回 null,表示取不到有效值。 * @return NamespaceName 命名空间名称 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetNamespaceName() const; /** * 设置命名空间名称 注意:此字段可能返回 null,表示取不到有效值。 * @param NamespaceName 命名空间名称 注意:此字段可能返回 null,表示取不到有效值。 */ void SetNamespaceName(const std::string& _namespaceName); /** * 判断参数 NamespaceName 是否已赋值 * @return NamespaceName 是否已赋值 */ bool NamespaceNameHasBeenSet() const; /** * 获取应用ID 注意:此字段可能返回 null,表示取不到有效值。 * @return ApplicationId 应用ID 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetApplicationId() const; /** * 设置应用ID 注意:此字段可能返回 null,表示取不到有效值。 * @param ApplicationId 应用ID 注意:此字段可能返回 null,表示取不到有效值。 */ void SetApplicationId(const std::string& _applicationId); /** * 判断参数 ApplicationId 是否已赋值 * @return ApplicationId 是否已赋值 */ bool ApplicationIdHasBeenSet() const; /** * 获取负载均衡ip 注意:此字段可能返回 null,表示取不到有效值。 * @return LbIp 负载均衡ip 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetLbIp() const; /** * 设置负载均衡ip 注意:此字段可能返回 null,表示取不到有效值。 * @param LbIp 负载均衡ip 注意:此字段可能返回 null,表示取不到有效值。 */ void SetLbIp(const std::string& _lbIp); /** * 判断参数 LbIp 是否已赋值 * @return LbIp 是否已赋值 */ bool LbIpHasBeenSet() const; /** * 获取应用类型 注意:此字段可能返回 null,表示取不到有效值。 * @return ApplicationType 应用类型 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetApplicationType() const; /** * 设置应用类型 注意:此字段可能返回 null,表示取不到有效值。 * @param ApplicationType 应用类型 注意:此字段可能返回 null,表示取不到有效值。 */ void SetApplicationType(const std::string& _applicationType); /** * 判断参数 ApplicationType 是否已赋值 * @return ApplicationType 是否已赋值 */ bool ApplicationTypeHasBeenSet() const; /** * 获取Service ip 注意:此字段可能返回 null,表示取不到有效值。 * @return ClusterIp Service ip 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetClusterIp() const; /** * 设置Service ip 注意:此字段可能返回 null,表示取不到有效值。 * @param ClusterIp Service ip 注意:此字段可能返回 null,表示取不到有效值。 */ void SetClusterIp(const std::string& _clusterIp); /** * 判断参数 ClusterIp 是否已赋值 * @return ClusterIp 是否已赋值 */ bool ClusterIpHasBeenSet() const; /** * 获取NodePort端口,只有公网和NodePort访问方式才有值 注意:此字段可能返回 null,表示取不到有效值。 * @return NodePort NodePort端口,只有公网和NodePort访问方式才有值 注意:此字段可能返回 null,表示取不到有效值。 */ int64_t GetNodePort() const; /** * 设置NodePort端口,只有公网和NodePort访问方式才有值 注意:此字段可能返回 null,表示取不到有效值。 * @param NodePort NodePort端口,只有公网和NodePort访问方式才有值 注意:此字段可能返回 null,表示取不到有效值。 */ void SetNodePort(const int64_t& _nodePort); /** * 判断参数 NodePort 是否已赋值 * @return NodePort 是否已赋值 */ bool NodePortHasBeenSet() const; /** * 获取最大分配的 CPU 核数,对应 K8S limit 注意:此字段可能返回 null,表示取不到有效值。 * @return CpuLimit 最大分配的 CPU 核数,对应 K8S limit 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetCpuLimit() const; /** * 设置最大分配的 CPU 核数,对应 K8S limit 注意:此字段可能返回 null,表示取不到有效值。 * @param CpuLimit 最大分配的 CPU 核数,对应 K8S limit 注意:此字段可能返回 null,表示取不到有效值。 */ void SetCpuLimit(const std::string& _cpuLimit); /** * 判断参数 CpuLimit 是否已赋值 * @return CpuLimit 是否已赋值 */ bool CpuLimitHasBeenSet() const; /** * 获取最大分配的内存 MiB 数,对应 K8S limit 注意:此字段可能返回 null,表示取不到有效值。 * @return MemLimit 最大分配的内存 MiB 数,对应 K8S limit 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetMemLimit() const; /** * 设置最大分配的内存 MiB 数,对应 K8S limit 注意:此字段可能返回 null,表示取不到有效值。 * @param MemLimit 最大分配的内存 MiB 数,对应 K8S limit 注意:此字段可能返回 null,表示取不到有效值。 */ void SetMemLimit(const std::string& _memLimit); /** * 判断参数 MemLimit 是否已赋值 * @return MemLimit 是否已赋值 */ bool MemLimitHasBeenSet() const; /** * 获取0:公网 1:集群内访问 2:NodePort 注意:此字段可能返回 null,表示取不到有效值。 * @return AccessType 0:公网 1:集群内访问 2:NodePort 注意:此字段可能返回 null,表示取不到有效值。 */ uint64_t GetAccessType() const; /** * 设置0:公网 1:集群内访问 2:NodePort 注意:此字段可能返回 null,表示取不到有效值。 * @param AccessType 0:公网 1:集群内访问 2:NodePort 注意:此字段可能返回 null,表示取不到有效值。 */ void SetAccessType(const uint64_t& _accessType); /** * 判断参数 AccessType 是否已赋值 * @return AccessType 是否已赋值 */ bool AccessTypeHasBeenSet() const; /** * 获取更新方式:0:快速更新 1:滚动更新 注意:此字段可能返回 null,表示取不到有效值。 * @return UpdateType 更新方式:0:快速更新 1:滚动更新 注意:此字段可能返回 null,表示取不到有效值。 */ int64_t GetUpdateType() const; /** * 设置更新方式:0:快速更新 1:滚动更新 注意:此字段可能返回 null,表示取不到有效值。 * @param UpdateType 更新方式:0:快速更新 1:滚动更新 注意:此字段可能返回 null,表示取不到有效值。 */ void SetUpdateType(const int64_t& _updateType); /** * 判断参数 UpdateType 是否已赋值 * @return UpdateType 是否已赋值 */ bool UpdateTypeHasBeenSet() const; /** * 获取更新间隔,单位秒 注意:此字段可能返回 null,表示取不到有效值。 * @return UpdateIvl 更新间隔,单位秒 注意:此字段可能返回 null,表示取不到有效值。 */ int64_t GetUpdateIvl() const; /** * 设置更新间隔,单位秒 注意:此字段可能返回 null,表示取不到有效值。 * @param UpdateIvl 更新间隔,单位秒 注意:此字段可能返回 null,表示取不到有效值。 */ void SetUpdateIvl(const int64_t& _updateIvl); /** * 判断参数 UpdateIvl 是否已赋值 * @return UpdateIvl 是否已赋值 */ bool UpdateIvlHasBeenSet() const; /** * 获取端口数组对象 注意:此字段可能返回 null,表示取不到有效值。 * @return ProtocolPorts 端口数组对象 注意:此字段可能返回 null,表示取不到有效值。 */ std::vector<ProtocolPort> GetProtocolPorts() const; /** * 设置端口数组对象 注意:此字段可能返回 null,表示取不到有效值。 * @param ProtocolPorts 端口数组对象 注意:此字段可能返回 null,表示取不到有效值。 */ void SetProtocolPorts(const std::vector<ProtocolPort>& _protocolPorts); /** * 判断参数 ProtocolPorts 是否已赋值 * @return ProtocolPorts 是否已赋值 */ bool ProtocolPortsHasBeenSet() const; /** * 获取环境变量数组对象 注意:此字段可能返回 null,表示取不到有效值。 * @return Envs 环境变量数组对象 注意:此字段可能返回 null,表示取不到有效值。 */ std::vector<Env> GetEnvs() const; /** * 设置环境变量数组对象 注意:此字段可能返回 null,表示取不到有效值。 * @param Envs 环境变量数组对象 注意:此字段可能返回 null,表示取不到有效值。 */ void SetEnvs(const std::vector<Env>& _envs); /** * 判断参数 Envs 是否已赋值 * @return Envs 是否已赋值 */ bool EnvsHasBeenSet() const; /** * 获取应用名称 注意:此字段可能返回 null,表示取不到有效值。 * @return ApplicationName 应用名称 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetApplicationName() const; /** * 设置应用名称 注意:此字段可能返回 null,表示取不到有效值。 * @param ApplicationName 应用名称 注意:此字段可能返回 null,表示取不到有效值。 */ void SetApplicationName(const std::string& _applicationName); /** * 判断参数 ApplicationName 是否已赋值 * @return ApplicationName 是否已赋值 */ bool ApplicationNameHasBeenSet() const; /** * 获取pod错误信息描述 注意:此字段可能返回 null,表示取不到有效值。 * @return Message pod错误信息描述 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetMessage() const; /** * 设置pod错误信息描述 注意:此字段可能返回 null,表示取不到有效值。 * @param Message pod错误信息描述 注意:此字段可能返回 null,表示取不到有效值。 */ void SetMessage(const std::string& _message); /** * 判断参数 Message 是否已赋值 * @return Message 是否已赋值 */ bool MessageHasBeenSet() const; /** * 获取部署组状态 注意:此字段可能返回 null,表示取不到有效值。 * @return Status 部署组状态 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetStatus() const; /** * 设置部署组状态 注意:此字段可能返回 null,表示取不到有效值。 * @param Status 部署组状态 注意:此字段可能返回 null,表示取不到有效值。 */ void SetStatus(const std::string& _status); /** * 判断参数 Status 是否已赋值 * @return Status 是否已赋值 */ bool StatusHasBeenSet() const; /** * 获取服务类型 注意:此字段可能返回 null,表示取不到有效值。 * @return MicroserviceType 服务类型 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetMicroserviceType() const; /** * 设置服务类型 注意:此字段可能返回 null,表示取不到有效值。 * @param MicroserviceType 服务类型 注意:此字段可能返回 null,表示取不到有效值。 */ void SetMicroserviceType(const std::string& _microserviceType); /** * 判断参数 MicroserviceType 是否已赋值 * @return MicroserviceType 是否已赋值 */ bool MicroserviceTypeHasBeenSet() const; /** * 获取初始分配的 CPU 核数,对应 K8S request 注意:此字段可能返回 null,表示取不到有效值。 * @return CpuRequest 初始分配的 CPU 核数,对应 K8S request 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetCpuRequest() const; /** * 设置初始分配的 CPU 核数,对应 K8S request 注意:此字段可能返回 null,表示取不到有效值。 * @param CpuRequest 初始分配的 CPU 核数,对应 K8S request 注意:此字段可能返回 null,表示取不到有效值。 */ void SetCpuRequest(const std::string& _cpuRequest); /** * 判断参数 CpuRequest 是否已赋值 * @return CpuRequest 是否已赋值 */ bool CpuRequestHasBeenSet() const; /** * 获取初始分配的内存 MiB 数,对应 K8S request 注意:此字段可能返回 null,表示取不到有效值。 * @return MemRequest 初始分配的内存 MiB 数,对应 K8S request 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetMemRequest() const; /** * 设置初始分配的内存 MiB 数,对应 K8S request 注意:此字段可能返回 null,表示取不到有效值。 * @param MemRequest 初始分配的内存 MiB 数,对应 K8S request 注意:此字段可能返回 null,表示取不到有效值。 */ void SetMemRequest(const std::string& _memRequest); /** * 判断参数 MemRequest 是否已赋值 * @return MemRequest 是否已赋值 */ bool MemRequestHasBeenSet() const; /** * 获取子网id 注意:此字段可能返回 null,表示取不到有效值。 * @return SubnetId 子网id 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetSubnetId() const; /** * 设置子网id 注意:此字段可能返回 null,表示取不到有效值。 * @param SubnetId 子网id 注意:此字段可能返回 null,表示取不到有效值。 */ void SetSubnetId(const std::string& _subnetId); /** * 判断参数 SubnetId 是否已赋值 * @return SubnetId 是否已赋值 */ bool SubnetIdHasBeenSet() const; /** * 获取部署组资源类型 注意:此字段可能返回 null,表示取不到有效值。 * @return GroupResourceType 部署组资源类型 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetGroupResourceType() const; /** * 设置部署组资源类型 注意:此字段可能返回 null,表示取不到有效值。 * @param GroupResourceType 部署组资源类型 注意:此字段可能返回 null,表示取不到有效值。 */ void SetGroupResourceType(const std::string& _groupResourceType); /** * 判断参数 GroupResourceType 是否已赋值 * @return GroupResourceType 是否已赋值 */ bool GroupResourceTypeHasBeenSet() const; /** * 获取部署组实例个数 注意:此字段可能返回 null,表示取不到有效值。 * @return InstanceCount 部署组实例个数 注意:此字段可能返回 null,表示取不到有效值。 */ uint64_t GetInstanceCount() const; /** * 设置部署组实例个数 注意:此字段可能返回 null,表示取不到有效值。 * @param InstanceCount 部署组实例个数 注意:此字段可能返回 null,表示取不到有效值。 */ void SetInstanceCount(const uint64_t& _instanceCount); /** * 判断参数 InstanceCount 是否已赋值 * @return InstanceCount 是否已赋值 */ bool InstanceCountHasBeenSet() const; /** * 获取部署组更新时间戳 注意:此字段可能返回 null,表示取不到有效值。 * @return UpdatedTime 部署组更新时间戳 注意:此字段可能返回 null,表示取不到有效值。 */ int64_t GetUpdatedTime() const; /** * 设置部署组更新时间戳 注意:此字段可能返回 null,表示取不到有效值。 * @param UpdatedTime 部署组更新时间戳 注意:此字段可能返回 null,表示取不到有效值。 */ void SetUpdatedTime(const int64_t& _updatedTime); /** * 判断参数 UpdatedTime 是否已赋值 * @return UpdatedTime 是否已赋值 */ bool UpdatedTimeHasBeenSet() const; private: /** * 部署组ID 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_groupId; bool m_groupIdHasBeenSet; /** * 分组名称 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_groupName; bool m_groupNameHasBeenSet; /** * 实例总数 注意:此字段可能返回 null,表示取不到有效值。 */ int64_t m_instanceNum; bool m_instanceNumHasBeenSet; /** * 已启动实例总数 注意:此字段可能返回 null,表示取不到有效值。 */ int64_t m_currentNum; bool m_currentNumHasBeenSet; /** * 创建时间 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_createTime; bool m_createTimeHasBeenSet; /** * 镜像server 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_server; bool m_serverHasBeenSet; /** * 镜像名,如/tsf/nginx 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_reponame; bool m_reponameHasBeenSet; /** * 镜像版本名称 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_tagName; bool m_tagNameHasBeenSet; /** * 集群ID 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_clusterId; bool m_clusterIdHasBeenSet; /** * 集群名称 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_clusterName; bool m_clusterNameHasBeenSet; /** * 命名空间ID 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_namespaceId; bool m_namespaceIdHasBeenSet; /** * 命名空间名称 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_namespaceName; bool m_namespaceNameHasBeenSet; /** * 应用ID 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_applicationId; bool m_applicationIdHasBeenSet; /** * 负载均衡ip 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_lbIp; bool m_lbIpHasBeenSet; /** * 应用类型 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_applicationType; bool m_applicationTypeHasBeenSet; /** * Service ip 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_clusterIp; bool m_clusterIpHasBeenSet; /** * NodePort端口,只有公网和NodePort访问方式才有值 注意:此字段可能返回 null,表示取不到有效值。 */ int64_t m_nodePort; bool m_nodePortHasBeenSet; /** * 最大分配的 CPU 核数,对应 K8S limit 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_cpuLimit; bool m_cpuLimitHasBeenSet; /** * 最大分配的内存 MiB 数,对应 K8S limit 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_memLimit; bool m_memLimitHasBeenSet; /** * 0:公网 1:集群内访问 2:NodePort 注意:此字段可能返回 null,表示取不到有效值。 */ uint64_t m_accessType; bool m_accessTypeHasBeenSet; /** * 更新方式:0:快速更新 1:滚动更新 注意:此字段可能返回 null,表示取不到有效值。 */ int64_t m_updateType; bool m_updateTypeHasBeenSet; /** * 更新间隔,单位秒 注意:此字段可能返回 null,表示取不到有效值。 */ int64_t m_updateIvl; bool m_updateIvlHasBeenSet; /** * 端口数组对象 注意:此字段可能返回 null,表示取不到有效值。 */ std::vector<ProtocolPort> m_protocolPorts; bool m_protocolPortsHasBeenSet; /** * 环境变量数组对象 注意:此字段可能返回 null,表示取不到有效值。 */ std::vector<Env> m_envs; bool m_envsHasBeenSet; /** * 应用名称 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_applicationName; bool m_applicationNameHasBeenSet; /** * pod错误信息描述 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_message; bool m_messageHasBeenSet; /** * 部署组状态 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_status; bool m_statusHasBeenSet; /** * 服务类型 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_microserviceType; bool m_microserviceTypeHasBeenSet; /** * 初始分配的 CPU 核数,对应 K8S request 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_cpuRequest; bool m_cpuRequestHasBeenSet; /** * 初始分配的内存 MiB 数,对应 K8S request 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_memRequest; bool m_memRequestHasBeenSet; /** * 子网id 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_subnetId; bool m_subnetIdHasBeenSet; /** * 部署组资源类型 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_groupResourceType; bool m_groupResourceTypeHasBeenSet; /** * 部署组实例个数 注意:此字段可能返回 null,表示取不到有效值。 */ uint64_t m_instanceCount; bool m_instanceCountHasBeenSet; /** * 部署组更新时间戳 注意:此字段可能返回 null,表示取不到有效值。 */ int64_t m_updatedTime; bool m_updatedTimeHasBeenSet; }; } } } } #endif // !TENCENTCLOUD_TSF_V20180326_MODEL_CONTAINERGROUPDETAIL_H_
31.260038
116
0.423206