text
stringlengths
4
6.14k
#ifndef _XFUNCTIONS_H #define _XFUNCTIONS_H #include <stdio.h> #include <strings.h> #include <stdlib.h> #include <errno.h> #include <setjmp.h> #ifdef __GNUC__ #define no_return __attribute__ ((noreturn)) #else #define no_return #endif void * xmalloc(size_t size); void * xcalloc(size_t nelem, size_t elsize); char * xstrdup(const char * str); FILE * xfopen(const char *pathname, const char *type); int yfclose(FILE * stream); int yfflush(FILE * stream); long xatol(const char *str); int xatoi(const char *str); unsigned long xatoul(const char *str); unsigned int xatoui(const char *str); double xatof(const char *str); long yatol(const char *str); int yatoi(const char *str); unsigned long yatoul(const char *str); unsigned int yatoui(const char *str); double yatof(const char *str); bool xatob(const char * str); bool yatob(const char * str); void xexit(int exitCode) no_return; // The program should define xexit somewhere, i.e. // void xexit(int exitCode) { exit(exitCode); } // #endif /* _XFUNCTIONS_H */
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #define WIDTH 1000 #define HEIGHT 1000 typedef struct { bool on; int brightness; } state; enum action { INVALID, TOGGLE, ON, OFF }; int max(int a, int b) { return a > b ? a : b; } int min(int a, int b) { return a < b ? a : b; } size_t rdline(FILE *in, char **out, size_t *size) { size_t bufsize, written = 0; char *buf = NULL; int c; if (out == NULL || in == NULL || size == NULL) { return UINT_MAX; } buf = *out; bufsize = *size; if ((c = fgetc(in)) == EOF) { return UINT_MAX; } else if (buf == NULL) { bufsize = 128; buf = (char*)malloc(bufsize * sizeof(char)); if (buf == NULL) { return UINT_MAX; } *size = bufsize; } do { if (written > (bufsize - 1)) { bufsize += 128; char *tmp = (char*)realloc(buf, bufsize * sizeof(char)); if (tmp == NULL) { return UINT_MAX; } buf = tmp; *size = bufsize; } buf[written++] = c; } while (c != '\n' && (c = fgetc(in)) != EOF); buf[written] = '\0'; *out = buf; return written; } int main(int argc, char **argv) { char *line = NULL, *rd = NULL; int n = 0; size_t len; state *grid = (state*) malloc(WIDTH * HEIGHT * sizeof(state)); memset(grid, 0, WIDTH * HEIGHT * sizeof(state)); while ((len = rdline(stdin, &line, &n)) != UINT_MAX) { enum action cmd = INVALID; rd = line; if (strncmp(rd, "toggle", 6) == 0) { rd += 7; cmd = TOGGLE; } else if (strncmp(rd, "turn", 4) == 0) { rd += 5; if (strncmp(rd, "on", 2) == 0) { rd += 3; cmd = ON; } else if (strncmp(rd, "off", 3) == 0) { rd += 4; cmd = OFF; } } if (cmd == INVALID) { continue; } int xstart = max(atoi(rd), 0); while (*rd++ != ','); int ystart = max(atoi(rd), 0); while (*rd++ != ' '); if (strncmp(rd, "through", 7) != 0) { continue; } rd += 8; int xend = min(atoi(rd), WIDTH - 1); while (*rd++ != ','); int yend = min(atoi(rd), HEIGHT - 1); for (int y = ystart; y <= yend; ++y) { state *line = &grid[y * WIDTH]; for (int x = xstart; x <= xend; ++x) { state *s = &line[x]; switch (cmd) { case TOGGLE: s->on = !s->on; s->brightness += 2; break; case ON: s->on = true; s->brightness += 1; break; case OFF: s->on = false; if (s->brightness) { s->brightness -= 1; } break; } } } } int lit = 0, brightness = 0; for (int y = 0; y < HEIGHT; ++y) { state *line = &grid[y * WIDTH]; for (int x = 0; x < WIDTH; ++x) { state *s = &line[x]; if (s->on) { ++lit; } brightness += s->brightness; } } printf("Part 1: %d\n", lit); printf("Part 2: %d\n", brightness); }
#include <stdio.h> #include <string.h> #include <errno.h> #include "parse.h" #include "common.h" #include "colormap.h" int *load_array (char *list); /* Load configuration */ void load_config (FILE * infile) { if (infile == NULL) { fprintf (stderr, "%s: failed to read config file - %s\n", progname, strerror (errno)); exit (EXIT_FAILURE); } int comment = 0; int lineno = 1; /* Prepare buffer */ char *buffer, *ptr; size_t buffer_len = 128; buffer = ptr = xmalloc (buffer_len); *buffer = 0; while (!feof (infile)) { char c = getc (infile); /* End of line */ if (c == 10 || c == 13) { *ptr = 0; int result = process_line (buffer); if (result != 0) { fprintf (stderr, "%s:%d: config parse error\n", progname, lineno); exit (EXIT_FAILURE); } *buffer = 0; ptr = buffer; lineno++; comment = 0; continue; } if (comment) continue; if (c == '#') { comment = 1; continue; } *ptr = c; ptr++; if (ptr - buffer > (int) buffer_len - 4) { size_t off = ptr - buffer; buffer_len *= 2; buffer = realloc (buffer, buffer_len); if (buffer == NULL) { fprintf (stderr, "%s: realloc failed\n", progname); exit (EXIT_FAILURE); } ptr = buffer + off; } } } /* Parse a single line */ int process_line (char *line) { char *base = line; /* trim whitespace */ while (*base == ' ') base++; if (*base == 0) return 0; char *ptr = base; while (*ptr != '=' && *ptr != ' ' && *ptr != 0) ptr++; if (*ptr == 0) return 1; *ptr = 0; /* Now find value */ ptr++; while (*ptr == '=' || *ptr == ' ') ptr++; if (*ptr == 0) return 1; char *val = ptr; /* Match keyword */ if (strcmp (base, "xmin") == 0) xmin = strtod (val, NULL); else if (strcmp (base, "xmax") == 0) xmax = strtod (val, NULL); else if (strcmp (base, "ymin") == 0) ymin = strtod (val, NULL); else if (strcmp (base, "ymax") == 0) ymax = strtod (val, NULL); else if (strcmp (base, "zoomx") == 0) zoomx = strtod (val, NULL); else if (strcmp (base, "zoomy") == 0) zoomy = strtod (val, NULL); else if (strcmp (base, "iterations") == 0) it = atoi (val); else if (strcmp (base, "image_width") == 0) width = atoi (val); else if (strcmp (base, "image_height") == 0) height = atoi (val); else if (strcmp (base, "image_jobs") == 0) jobs = atoi (val); else if (strcmp (base, "zoom_jobs") == 0) zoom_jobs = atoi (val); else if (strcmp (base, "zoom_frames") == 0) zoom_it = atoi (val); else if (strcmp (base, "zoom_rate") == 0) zoom_rate = strtod (val, NULL); else if (strcmp (base, "color_width") == 0) cwidth = atoi (val); else if (strcmp (base, "red") == 0) { red = load_array (val); if (red == NULL) return 1; } else if (strcmp (base, "green") == 0) { green = load_array (val); if (green == NULL) return 1; } else if (strcmp (base, "blue") == 0) { blue = load_array (val); if (blue == NULL) return 1; } else return 1; return 0; } /* Load an array for a colormap */ int *load_array (char *list) { int *c = xmalloc (cmap_len * sizeof (int)); int ci = 0; char *ptr = list; while (*ptr != '{' && *ptr != 0) ptr++; if (*ptr == 0) return NULL; ptr++; while (*ptr != 0) { if (*ptr == '}') break; c[ci] = atoi (ptr); ci++; if (ci > cmap_len) { /* Badly formed colormap */ if (cmap_edit) return NULL; cmap_len *= 2; c = realloc (c, cmap_len); if (c == NULL) { fprintf (stderr, "%s: cmap realloc failed - %s\n", progname, strerror (errno)); exit (EXIT_FAILURE); } } while (*ptr != ',' && *ptr != 0) ptr++; ptr++; } /* Make sure we read in enough values. */ if (cmap_edit && cmap_len != ci) return NULL; cmap_len = ci; cmap_edit = 1; return c; }
#import "UIKBTree.h" @interface UIKBKeyplaneView : UIView - (NSInteger)stateForKey:(UIKBTree *)key; - (UIView *)viewForKey:(UIKBTree *)key; - (NSString *)cacheIdentifierForKey:(UIKBTree *)key withState:(NSInteger)state; @end
#include<stdio.h> #define print(exp) printf(#exp /* # */ "=%7.0f\n",exp) main() { float x=22,y=7; print(x/y); }
/*- * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: release/9.0.0/include/fmtmsg.h 101390 2002-08-05 16:37:05Z mike $ */ #ifndef _FMTMSG_H_ #define _FMTMSG_H_ /* Source of condition is... */ #define MM_HARD 0x0001 /* ...hardware. */ #define MM_SOFT 0x0002 /* ...software. */ #define MM_FIRM 0x0004 /* ...fireware. */ /* Condition detected by... */ #define MM_APPL 0x0010 /* ...application. */ #define MM_UTIL 0x0020 /* ...utility. */ #define MM_OPSYS 0x0040 /* ...operating system. */ /* Display on... */ #define MM_PRINT 0x0100 /* ...standard error. */ #define MM_CONSOLE 0x0200 /* ...system console. */ #define MM_RECOVER 0x1000 /* Recoverable error. */ #define MM_NRECOV 0x2000 /* Non-recoverable error. */ /* Severity levels. */ #define MM_NOSEV 0 /* No severity level provided. */ #define MM_HALT 1 /* Error causing application to halt. */ #define MM_ERROR 2 /* Non-fault fault. */ #define MM_WARNING 3 /* Unusual non-error condition. */ #define MM_INFO 4 /* Informative message. */ /* Null options. */ #define MM_NULLLBL (char *)0 #define MM_NULLSEV 0 #define MM_NULLMC 0L #define MM_NULLTXT (char *)0 #define MM_NULLACT (char *)0 #define MM_NULLTAG (char *)0 /* Return values. */ #define MM_OK 0 /* Success. */ #define MM_NOMSG 1 /* Failed to output to stderr. */ #define MM_NOCON 2 /* Failed to output to console. */ #define MM_NOTOK 3 /* Failed to output anything. */ int fmtmsg(long, const char *, int, const char *, const char *, const char *); #endif /* !_FMTMSG_H_ */
/* This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. 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 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. For more information, please refer to <http://unlicense.org> */ #ifndef __XL2_H__ #define __XL2_H__ #include <X11/Xlib.h> #include <string> #define DEFAULT_FONT "pfk20" #define FALLBACK_FONT "fixed" #define DEF_BG "White" #define DEF_FG "Black" #define PROGRAM_NAME "XLOCK2" struct xl2_screen { static const int NUMCOLORS = 64; int screen; // index in the screens array Display * dsp; // for convenience Window root; Window win; Window icon; Screen * scr; long bgcol; long fgcol; GC gc; GC textgc; int npixels; u_long pixels[NUMCOLORS]; int iconx; int icony; }; class LockProcFactory; class LockProc { friend class LockProcFactory; static int factory_count; static const int max_factories = 20; static LockProcFactory * factories[max_factories]; static void register_lp(LockProcFactory * lpf); protected: xl2_screen &s; public: LockProc(xl2_screen &_s) : s(_s) { } virtual ~LockProc(void) { }; virtual void draw(void) = 0; static LockProc * make(const std::string &name, xl2_screen &s); static LockProc * make_random(xl2_screen &s); }; class LockProcFactory { public: LockProcFactory * next; const char * name; LockProcFactory(const char * _name) { name = _name; LockProc::register_lp(this); } virtual LockProc * make(xl2_screen &_s) = 0; }; extern int get_idle_seconds(Display *d); #endif /* __XL2_H__ */
#ifndef E_POLICY_H # define E_POLICY_H void e_policy_init(void); void e_policy_shutdown(void); void e_policy_kbd_override_set(Eina_Bool override); const Eina_List *e_policy_clients_get(void); const E_Client *e_policy_client_active_get(void); #endif
// // BXMultipleChoicePredicateEditorRowTemplateFactory.h // BaseTen // // Copyright 2010 Marko Karppinen & Co. 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 // // 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. // @import Foundation; @class BXEntityDescription; @class BXDatabaseContext; @interface BXMultipleChoicePredicateEditorRowTemplateFactory : NSObject - (NSArray*)multipleChoiceTemplatesWithDisplayNames:(NSArray*) displayNames andOptionDisplayNameKeyPaths: (NSArray *) displayNameKeyPaths forRelationshipKeyPaths: (NSArray *) keyPaths inEntityDescription: (BXEntityDescription *) originalEntity databaseContext:(BXDatabaseContext *) ctx error:(NSError **)err; - (Class)rowTemplateClass; @end
// // AppDelegate.h // adb-ios // // Created by Li Zonghai on 9/28/15. // Copyright (c) 2015 Li Zonghai. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ #ifndef __PWM_H__ #define __PWM_H__ #include <os/os_dev.h> #ifdef __cplusplus extern "C" { #endif struct pwm_dev; struct pwm_chan_cfg; /** * Configure a channel on the PWM device. * * @param dev The device to configure. * @param cnum The channel number to configure. * @param cfg Configuration data for this channel. * * @return 0 on success, non-zero error code on failure. */ typedef int (*pwm_configure_channel_func_t)(struct pwm_dev *, uint8_t, struct pwm_chan_cfg *); /** * Enable the PWM with specified duty cycle. * * This duty cycle is a fractional duty cycle where 0 == off, 65535=on, * and any value in between is on for fraction clocks and off * for 65535-fraction clocks. * * @param dev The device to configure. * @param cnum The channel to configure. * @param fraction The fraction value. * * @return 0 on success, negative on error. */ typedef int (*pwm_enable_duty_cycle_func_t)(struct pwm_dev *, uint8_t, uint16_t); /** * Set the frequency for the device's clock. * This frequency must be between 1/2 the clock frequency and * the clock divided by the resolution. * * @param dev The device to configure. * @param freq_hz The frequency value in Hz. * * @return 0 on success, negative on error. */ typedef int (*pwm_set_frequency_func_t) (struct pwm_dev *, uint32_t); /** * Get the underlying clock driving the PWM device. * * @param dev * * @return value is in Hz on success, negative on error. */ typedef int (*pwm_get_clock_freq_func_t) (struct pwm_dev *); /** * Get the resolution of the PWM in bits. * * @param dev The device to query. * * @return The value in bits on success, negative on error. */ typedef int (*pwm_get_resolution_bits_func_t) (struct pwm_dev *); /** * Disable the PWM channel, it will be marked as unconfigured. * * @param dev The device to configure. * @param cnum The channel number. * * @return 0 on success, negative on error. */ typedef int (*pwm_disable_func_t) (struct pwm_dev *, uint8_t); struct pwm_driver_funcs { pwm_configure_channel_func_t pwm_configure_channel; pwm_enable_duty_cycle_func_t pwm_enable_duty_cycle; pwm_set_frequency_func_t pwm_set_frequency; pwm_get_clock_freq_func_t pwm_get_clock_freq; pwm_get_resolution_bits_func_t pwm_get_resolution_bits; pwm_disable_func_t pwm_disable; }; struct pwm_dev { struct os_dev pwm_os_dev; struct os_mutex pwm_lock; struct pwm_driver_funcs pwm_funcs; uint32_t pwm_chan_count; int pwm_instance_id; }; /** * PWM channel configuration data. * * pin - The pin to be assigned to this pwm channel. * inverted - Whether this channel's output polarity is inverted or not. * data - A pointer do a driver specific parameter. */ struct pwm_chan_cfg { uint8_t pin; bool inverted; void* data; }; int pwm_chan_config(struct pwm_dev *dev, uint8_t cnum, struct pwm_chan_cfg *cfg); int pwm_enable_duty_cycle(struct pwm_dev *pwm_d, uint8_t cnum, uint16_t fraction); int pwm_set_frequency(struct pwm_dev *dev, uint32_t freq_hz); int pwm_get_clock_freq(struct pwm_dev *dev); int pwm_get_resolution_bits(struct pwm_dev *dev); int pwm_disable(struct pwm_dev *dev, uint8_t cnum); #ifdef __cplusplus } #endif #endif /* __PWM_H__ */
/* * jmemnobs.c * * Copyright (C) 1992-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file provides a really simple implementation of the system- * dependent portion of the JPEG memory manager. This implementation * assumes that no backing-store files are needed: all required space * can be obtained from malloc(). * This is very portable in the sense that it'll compile on almost anything, * but you'd better have lots of main memory (or virtual memory) if you want * to process big images. * Note that the max_memory_to_use option is ignored by this implementation. */ #define JPEG_INTERNALS #include "MoJpgInclude.h" #include "MoJpgLib.h" #include "MoJpgMemory.h" /* import the system-dependent declarations */ #ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc(),free() */ extern void * malloc JPP((size_t size)); extern void free JPP((void *ptr)); #endif /* * Memory allocation and freeing are controlled by the regular library * routines malloc() and free(). */ GLOBAL(void *) jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) { return (void *) malloc(sizeofobject); } GLOBAL(void) jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) { free(object); } /* * "Large" objects are treated the same as "small" ones. * NB: although we include FAR keywords in the routine declarations, * this file won't actually work in 80x86 small/medium model; at least, * you probably won't be able to process useful-size images in only 64KB. */ GLOBAL(void FAR *) jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) { return (void FAR *) malloc(sizeofobject); } GLOBAL(void) jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) { free(object); } /* * This routine computes the total memory space available for allocation. * Here we always say, "we got all you want bud!" */ GLOBAL(long) jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated) { return max_bytes_needed; } /* * Backing store (temporary file) management. * Since jpeg_mem_available always promised the moon, * this should never be called and we can just error out. */ GLOBAL(void) jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed) { ERREXIT(cinfo, JERR_NO_BACKING_STORE); } /* * These routines take care of any system-dependent initialization and * cleanup required. Here, there isn't any. */ GLOBAL(long) jpeg_mem_init (j_common_ptr cinfo) { return 0; /* just set max_memory_to_use to 0 */ } GLOBAL(void) jpeg_mem_term (j_common_ptr cinfo) { /* no work */ }
// // ViewController.h // TestGit // // Created by ws on 17/4/17. // Copyright ยฉ 2017ๅนด ws. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
/*========================================================================= * * Copyright Insight Software Consortium * * 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.txt * * 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 itkAnchorOpenImageFilter_h #define itkAnchorOpenImageFilter_h #include "itkAnchorOpenCloseImageFilter.h" namespace itk { template< typename TImage, typename TKernel > class AnchorOpenImageFilter: public AnchorOpenCloseImageFilter< TImage, TKernel, std::less< typename TImage::PixelType >, std::greater< typename TImage::PixelType > > { public: typedef AnchorOpenImageFilter Self; typedef AnchorOpenCloseImageFilter< TImage, TKernel, std::less< typename TImage::PixelType >, std::greater< typename TImage::PixelType > > Superclass; typedef SmartPointer< Self > Pointer; typedef SmartPointer< const Self > ConstPointer; /** Method for creation through the object factory. */ itkNewMacro(Self); protected: AnchorOpenImageFilter() { this->m_Boundary1 = NumericTraits< typename TImage::PixelType >::max(); this->m_Boundary2 = NumericTraits< typename TImage::PixelType >::NonpositiveMin(); } virtual ~AnchorOpenImageFilter() {} private: ITK_DISALLOW_COPY_AND_ASSIGN(AnchorOpenImageFilter); }; } // namespace itk #endif
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #ifndef GB_STDIO_H #define GB_STDIO_H /*this file, if included instead of <stdio.h> has the following functionality: 1) if GB_STDIO_INTERCEPT is defined then a) some of the stdio.h symbols shall be redefined, for example: fopen => gb_fopen b) all "code" using the fopen will actually (because of the preprocessor) call to gb_fopen c) gb_fopen shall blindly call into fopen, thus realizing a passthrough reason is: unittesting. fopen is comes with the C Run Time and cannot be mocked (that is, in the global namespace cannot exist a function called fopen 2) if GB_STDIO_INTERCEPT is not defined then a) it shall include <stdio.h> => no passthrough, just direct linking. */ #ifndef GB_STDIO_INTERCEPT #include <stdio.h> #else /*source level intercepting of function calls*/ #define fopen fopen_never_called_never_implemented_always_forgotten #define fclose fclose_never_called_never_implemented_always_forgotten #define fseek fseek_never_called_never_implemented_always_forgotten #define ftell ftell_never_called_never_implemented_always_forgotten #define fprintf fprintf_never_called_never_implemented_always_forgotten #include "azure_c_shared_utility/umock_c_prod.h" #ifdef __cplusplus #include <cstdio.h> extern "C" { #else #include <stdio.h> #endif #undef fopen #define fopen gb_fopen MOCKABLE_FUNCTION(, FILE*, gb_fopen, const char*, filename, const char*, mode); #undef fclose #define fclose gb_fclose MOCKABLE_FUNCTION(, int, fclose, FILE *, stream); #undef fseek #define fseek gb_fseek MOCKABLE_FUNCTION(, int, fseek, FILE *,stream, long int, offset, int, whence); #undef ftell #define ftell gb_ftell MOCKABLE_FUNCTION(, long int, ftell, FILE *, stream); #undef fprintf #define fprintf gb_fprintf extern int fprintf(FILE * stream, const char * format, ...); #ifdef __cplusplus } #endif #endif /*GB_STDIO_INTERCEPT*/ #endif /* GB_STDIO_H */
// This file is automagically generated by mphtogen, do not edit //0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 -1, -1, -1, -1, -1, -1, -1, 3, -1, -1, 4, -1, -1, 1, 5, -1, -1, -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, 7, 8, -1, -1, -1, -1, 10, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, 13
/* Test regular cases */ result = ${library_name}_${type_name}_copy_from_byte_stream( ${type_name}, ${library_name_suffix}_test_${type_name}_data1, ${test_data_size}, ${library_name_upper_case}_CODEPAGE_WINDOWS_1252, &error ); ${library_name_suffix_upper_case}_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); ${library_name_suffix_upper_case}_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = ${library_name}_${type_name}_copy_from_byte_stream( NULL, ${library_name_suffix}_test_${type_name}_data1, ${test_data_size}, ${library_name_upper_case}_CODEPAGE_WINDOWS_1252, &error ); ${library_name_suffix_upper_case}_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); ${library_name_suffix_upper_case}_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = ${library_name}_${type_name}_copy_from_byte_stream( ${type_name}, NULL, ${test_data_size}, ${library_name_upper_case}_CODEPAGE_WINDOWS_1252, &error ); ${library_name_suffix_upper_case}_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); ${library_name_suffix_upper_case}_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = ${library_name}_${type_name}_copy_from_byte_stream( ${type_name}, ${library_name_suffix}_test_${type_name}_data1, (size_t) SSIZE_MAX + 1, ${library_name_upper_case}_CODEPAGE_WINDOWS_1252, &error ); ${library_name_suffix_upper_case}_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); ${library_name_suffix_upper_case}_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = ${library_name}_${type_name}_copy_from_byte_stream( ${type_name}, ${library_name_suffix}_test_${type_name}_data1, 0, ${library_name_upper_case}_CODEPAGE_WINDOWS_1252, &error ); ${library_name_suffix_upper_case}_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); ${library_name_suffix_upper_case}_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* TODO: test with invalid codepage */
// // AudioStreamer.h // StreamingAudioPlayer // // Created by Matt Gallagher on 27/09/08. // Copyright 2008 Matt Gallagher. All rights reserved. // // Permission is given to use this source code file, free of charge, in any // project, commercial or otherwise, entirely at your risk, with the condition // that any redistribution (in part or whole) of source code must retain // this copyright and permission notice. Attribution in compiled projects is // appreciated but not required. // // This file is meant to be a repository for common defintions between AudioStreamerBC (backcompat, 3.1.x) // and AudioStreamerCUR (iOS 3.2+), as well as a proxy which shunts messages to the appropriate AudioStreamer. // - SPT // Also note that we've had to change enumeration and class names here - this is because // some modules may require the use of AudioStreamer in external libraries and the // symbols cannot be changed on that end. The use of common symbols in LookPage without // namespaces is a recurring problem, and we can thank Objective-C for it. // - SPT #ifdef USE_TI_MEDIA #define LOG_QUEUED_BUFFERS 0 #define kNumAQBufs 16 // Number of audio queue buffers we allocate. // Needs to be big enough to keep audio pipeline // busy (non-zero number of queued buffers) but // not so big that audio takes too long to begin // (kNumAQBufs * kAQBufSize of data must be // loaded before playback will start). // Set LOG_QUEUED_BUFFERS to 1 to log how many // buffers are queued at any time -- if it drops // to zero too often, this value may need to // increase. Min 3, typical 8-24. #define kAQMaxPacketDescs 512 // Number of packet descriptions in our array #define kAQDefaultBufSize 2048 // Number of bytes in each audio queue buffer // Needs to be big enough to hold a packet of // audio from the audio file. If number is too // large, queuing of audio before playback starts // will take too long. // Highly compressed files can use smaller // numbers (512 or less). 2048 should hold all // but the largest packets. A buffer size error // will occur if this number is too small. typedef enum { AS_INITIALIZED = 0, AS_STARTING_FILE_THREAD, AS_WAITING_FOR_DATA, AS_WAITING_FOR_QUEUE_TO_START, AS_PLAYING, AS_BUFFERING, AS_STOPPING, AS_STOPPED, AS_PAUSED, AS_FLUSHING_EOF } AudioStreamerState; typedef enum { AS_NO_STOP = 0, AS_STOPPING_EOF, AS_STOPPING_USER_ACTION, AS_STOPPING_ERROR, AS_STOPPING_TEMPORARILY } AudioStreamerStopReason; typedef enum { AS_NO_ERROR = 0, AS_NETWORK_CONNECTION_FAILED, AS_FILE_STREAM_GET_PROPERTY_FAILED, AS_FILE_STREAM_SEEK_FAILED, AS_FILE_STREAM_PARSE_BYTES_FAILED, AS_FILE_STREAM_OPEN_FAILED, AS_FILE_STREAM_CLOSE_FAILED, AS_AUDIO_DATA_NOT_FOUND, AS_AUDIO_QUEUE_CREATION_FAILED, AS_AUDIO_QUEUE_BUFFER_ALLOCATION_FAILED, AS_AUDIO_QUEUE_ENQUEUE_FAILED, AS_AUDIO_QUEUE_ADD_LISTENER_FAILED, AS_AUDIO_QUEUE_REMOVE_LISTENER_FAILED, AS_AUDIO_QUEUE_START_FAILED, AS_AUDIO_QUEUE_PAUSE_FAILED, AS_AUDIO_QUEUE_BUFFER_MISMATCH, AS_AUDIO_QUEUE_DISPOSE_FAILED, AS_AUDIO_QUEUE_STOP_FAILED, AS_AUDIO_QUEUE_FLUSH_FAILED, AS_AUDIO_STREAMER_FAILED, AS_GET_AUDIO_TIME_FAILED, AS_AUDIO_BUFFER_TOO_SMALL } AudioStreamerErrorCode; extern NSString * const ASStatusChangedNotification; @protocol AudioStreamerDelegate<NSObject> -(void)playbackStateChanged:(id)sender; @end @protocol AudioStreamerProtocol<NSObject> @property AudioStreamerErrorCode errorCode; @property (nonatomic, readonly) AudioStreamerState state; @property (readonly) double progress; @property (readwrite) UInt32 bitRate; @property (readwrite) double volume; @property (readwrite,assign) id<AudioStreamerDelegate> delegate; @property (nonatomic,readwrite,assign) NSUInteger bufferSize; - (void)start; - (void)stop; - (void)pause; - (BOOL)isPlaying; - (BOOL)isPaused; - (BOOL)isWaiting; - (BOOL)isIdle; @end @interface AudioStreamer : NSObject<AudioStreamerProtocol,AudioStreamerDelegate> { id<AudioStreamerProtocol> streamer; id<AudioStreamerDelegate> delegate; } - (id)initWithURL:(NSURL *)aURL; + (NSString*)stringForErrorCode:(AudioStreamerErrorCode)code; @end #endif
// // HomeSearchDetialViewController.h // ChangChunTax // // Created by XIU-Developer on 16/5/5. // Copyright ยฉ 2016ๅนด XIU. All rights reserved. // #import <UIKit/UIKit.h> @interface HomeSearchListDetialNewsVC : UIViewController @property (nonatomic, strong) NSString *ids; @end
int a[2] = {2, 2}, b[3] = {3, 3, 3}, c = 4, d = 5; int i = 0, j = 1; void main() { ++b[i]; assert(b[0] == 4, "b[0] must be 4"); ++c; assert(c == 5, "c must be 5"); d = ++b[j]; assert(d == 4, "d must be 4"); d = ++c; assert(d == 6, "d must be 6"); --b[1]; assert(b[1] == 3, "b[1] must be 3"); --i; assert(i == -1, "i must be -1"); c = --b[j]; assert(c == 2, "c must be 2"); i = 1; j = 2; c = --d; assert(c == 5, "c must be 5"); b[i]++; assert(b[1] == 3, "b[1] must be 3"); d++; assert(d == 6, "d must be 6"); d = b[j]++; assert(d == 3, "d must be 3"); c = d++; assert(c == 3, "c must be 3"); b[1] += i; assert(b[1] == 4, "b[1] must be 4"); --d; assert(d == 3, "d must be 3"); d = b[j]--; assert(d == 4, "d must be 4"); d = c--; assert(d == 3, "d must be 3"); assert(c == 2, "c must be 2"); }
// Copyright ยฉ2017 Black Sphere Studios #ifndef __ZLIBSTREAM_H__UPATCH__ #define __ZLIBSTREAM_H__UPATCH__ #include "bss-util/stream.h" #include "zlib.h" #include <istream> #include <ostream> namespace upatch { struct InstallPayload; class ZLibStream : public bss::StreamBufFunction { inline ZLibStream(const ZLibStream& copy) BSS_DELETEFUNC inline ZLibStream& operator =(const ZLibStream& right) BSS_DELETEFUNCOP public: inline ZLibStream(ZLibStream&& mov) : StreamBufFunction(std::move(mov)) {} ZLibStream(std::istream& in, size_t bufsize = DEFAULTBUFSIZE); ZLibStream(std::ostream& out, int level = -1, size_t bufsize = DEFAULTBUFSIZE); ~ZLibStream(); protected: virtual void _onwrite() override; virtual void _onread() override; char* _icur; char* _iend; z_stream strm; }; } #endif
/**************************************************************************** * * Copyright 2016 Samsung Electronics 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. * ****************************************************************************/ /**************************************************************************** * tools/cfgdefine.h * * Copyright (C) 2007-2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ #ifndef __TOOLS_CFGDEFINE_H #define __TOOLS_CFGDEFINE_H /**************************************************************************** * Included Files ****************************************************************************/ #include <stdio.h> #include <limits.h> /**************************************************************************** * Definitions ****************************************************************************/ #define LINESIZE (PATH_MAX > 256 ? PATH_MAX : 256) /**************************************************************************** * Public Data ****************************************************************************/ extern char line[LINESIZE + 1]; /**************************************************************************** * Public Functions ****************************************************************************/ void generate_definitions(FILE *stream); #endif /* __TOOLS_CFGDEFINE_H */
#include <endian.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { union { uint32_t u32; uint8_t arr[4]; } x; x.arr[0] = 0x11; /* Lowest-address byte */ x.arr[1] = 0x22; x.arr[2] = 0x33; x.arr[3] = 0x44; /* Highest-address byte */ printf("x.u32 = 0x%x\n", x.u32); printf("htole32(x.u32) = 0x%x\n", htole32(x.u32)); printf("htobe32(x.u32) = 0x%x\n", htobe32(x.u32)); printf("0x%x\n", *(uint32_t*)&x); exit(EXIT_SUCCESS); } // !!! man endian to see more functions ~
// Copyright 2009 Todd Ditchendorf // // 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. #import "FUBasePreferences.h" // Abstract base class for FUUserthingPreferences and FUUserstylePreferences @interface FUUserthingPreferences : FUBasePreferences { NSArrayController *arrayController; NSTextView *textView; NSMutableArray *userthings; } - (void)insertObject:(NSMutableDictionary *)dict inUserthingsAtIndex:(NSInteger)i; - (void)removeObjectFromUserthingsAtIndex:(NSInteger)i; - (void)startObservingRule:(NSMutableDictionary *)rule; - (void)stopObservingRule:(NSMutableDictionary *)rule; - (void)loadUserthings; - (void)storeUserthings; @property (nonatomic, retain) IBOutlet NSArrayController *arrayController; @property (nonatomic, retain) IBOutlet NSTextView *textView; @property (nonatomic, retain) NSMutableArray *userthings; @end
// Copyright 2019 The MediaPipe Authors. // // 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 MEDIAPIPE_PORT_PORT_H_ #define MEDIAPIPE_PORT_PORT_H_ #include "absl/base/port.h" #endif // MEDIAPIPE_PORT_PORT_H_
#include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int vec[50], i,aux,suma,promedio,mayor,menor; mayor=-999; menor=999; srand(time(0)); for(i=0;i<50;i++) { vec[i]=rand()%90+10; } for(i=0;i<50;i++) { aux=vec[i]; vec[i]=vec[i+1]; vec[i+1]=aux; suma=suma+vec[i]; promedio=suma/50; if(vec[i]>mayor) { mayor=vec[i]; } if(vec[i]<menor) { menor=vec[i]; } } for(i=0;i<50;i++) { printf("%d\n", vec[i]); } printf("La Suma de los numeros del Vector es: %d\n", suma); printf("El Promedio del Vector es: %d\n", promedio); printf("El Numero Mayor es: %d\n", mayor); printf("El Numero Menor es: %d\n", menor); system("pause"); return 0; }
#import "ViewController.h" @protocol MWMSearchDownloadProtocol <NSObject> - (void)selectMapsAction; @end @interface MWMSearchDownloadViewController : ViewController - (nonnull instancetype)init __attribute__((unavailable("init is not available"))); - (nonnull instancetype)initWithDelegate:(nonnull id<MWMSearchDownloadProtocol>)delegate; - (void)downloadProgress:(CGFloat)progress countryName:(nonnull NSString *)countryName; - (void)setDownloadFailed; @end
/* * Copyright 2014 Facebook, Inc. * * 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 FOLLY_IO_HUGEPAGES_H_ #define FOLLY_IO_HUGEPAGES_H_ #include <sys/stat.h> #include <sys/types.h> #include <cstddef> #include <string> #include <unistd.h> #include <utility> #include <vector> #include <boost/operators.hpp> #include <folly/Range.h> #include <folly/experimental/io/FsUtil.h> namespace folly { struct HugePageSize : private boost::totally_ordered<HugePageSize> { explicit HugePageSize(size_t s) : size(s) { } fs::path filePath(const fs::path& relpath) const { return mountPoint / relpath; } size_t size = 0; fs::path mountPoint; dev_t device = 0; }; inline bool operator<(const HugePageSize& a, const HugePageSize& b) { return a.size < b.size; } inline bool operator==(const HugePageSize& a, const HugePageSize& b) { return a.size == b.size; } /** * Vector of (huge_page_size, mount_point), sorted by huge_page_size. * mount_point might be empty if no hugetlbfs file system is mounted for * that size. */ typedef std::vector<HugePageSize> HugePageSizeVec; /** * Get list of supported huge page sizes and their mount points, if * hugetlbfs file systems are mounted for those sizes. */ const HugePageSizeVec& getHugePageSizes(); /** * Return the mount point for the requested huge page size. * 0 = use smallest available. * Returns nullptr if the requested huge page size is not available. */ const HugePageSize* getHugePageSize(size_t size = 0); /** * Return the huge page size for a device. * returns nullptr if device does not refer to a huge page filesystem. */ const HugePageSize* getHugePageSizeForDevice(dev_t device); } // namespace folly #endif /* FOLLY_IO_HUGEPAGES_H_ */
// // OldStuff.h // MacNagios // // Created by Kiko Albiol on 21/11/15. // Copyright ยฉ 2015 BGP. All rights reserved. // #import <Foundation/Foundation.h> /** * @brief Old stuff */ @interface AppDelegateOld : NSObject <NSApplicationDelegate, NSUserNotificationCenterDelegate> @property (assign) IBOutlet NSWindow *window; @property WebView *webView; @property NSStatusItem *statusItem; @property NSTimer *timer; @property NSDictionary *configData; // data loaded from config plist @property NSArray *checkResults; // the results of the checking @property NSMutableArray *checkMessages; // an array of strings which are the messages that go into the next alert @property NSString *lastStatusString; // the last overall status string we had @property NSMutableDictionary *serviceStatusDict; // keep track of the last status of each service - so we can make a list of what changed //@property NSMenu *menu; @end
/* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 2000-2001 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. */ #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) #error "Only <glib-object.h> can be included directly." #endif #ifndef __G_CLOSURE_H__ #define __G_CLOSURE_H__ #include <gobject/gtype.h> G_BEGIN_DECLS /* --- defines --- */ #define G_CLOSURE_NEEDS_MARSHAL(closure) (((GClosure*) (closure))->marshal == NULL) #define G_CLOSURE_N_NOTIFIERS(cl) ((cl)->meta_marshal + ((cl)->n_guards << 1L) + \ (cl)->n_fnotifiers + (cl)->n_inotifiers) #define G_CCLOSURE_SWAP_DATA(cclosure) (((GClosure*) (closure))->derivative_flag) #define G_CALLBACK(f) ((GCallback) (f)) /* -- typedefs --- */ typedef struct _GClosure GClosure; typedef struct _GClosureNotifyData GClosureNotifyData; typedef void (*GCallback) (void); typedef void (*GClosureNotify) (gpointer data, GClosure *closure); typedef void (*GClosureMarshal) (GClosure *closure, GValue *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); typedef struct _GCClosure GCClosure; /* --- structures --- */ struct _GClosureNotifyData { gpointer data; GClosureNotify notify; }; struct _GClosure { /*< private >*/ guint ref_count : 15; /*< private >*/ guint meta_marshal : 1; /*< private >*/ guint n_guards : 1; /*< private >*/ guint n_fnotifiers : 2; /* finalization notifiers */ /*< private >*/ guint n_inotifiers : 8; /* invalidation notifiers */ /*< private >*/ guint in_inotify : 1; /*< private >*/ guint floating : 1; /*< protected >*/ guint derivative_flag : 1; /*< public >*/ guint in_marshal : 1; /*< public >*/ guint is_invalid : 1; /*< private >*/ void (*marshal) (GClosure *closure, GValue /*out*/ *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); /*< protected >*/ gpointer data; /*< private >*/ GClosureNotifyData *notifiers; /* invariants/constrains: * - ->marshal and ->data are _invalid_ as soon as ->is_invalid==TRUE * - invocation of all inotifiers occours prior to fnotifiers * - order of inotifiers is random * inotifiers may _not_ free/invalidate parameter values (e.g. ->data) * - order of fnotifiers is random * - each notifier may only be removed before or during its invocation * - reference counting may only happen prior to fnotify invocation * (in that sense, fnotifiers are really finalization handlers) */ }; /* closure for C function calls, callback() is the user function */ struct _GCClosure { GClosure closure; gpointer callback; }; /* --- prototypes --- */ GClosure* g_cclosure_new (GCallback callback_func, gpointer user_data, GClosureNotify destroy_data); GClosure* g_cclosure_new_swap (GCallback callback_func, gpointer user_data, GClosureNotify destroy_data); GClosure* g_signal_type_cclosure_new (GType itype, guint struct_offset); /* --- prototypes --- */ GClosure* g_closure_ref (GClosure *closure); void g_closure_sink (GClosure *closure); void g_closure_unref (GClosure *closure); /* intimidating */ GClosure* g_closure_new_simple (guint sizeof_closure, gpointer data); void g_closure_add_finalize_notifier (GClosure *closure, gpointer notify_data, GClosureNotify notify_func); void g_closure_remove_finalize_notifier (GClosure *closure, gpointer notify_data, GClosureNotify notify_func); void g_closure_add_invalidate_notifier (GClosure *closure, gpointer notify_data, GClosureNotify notify_func); void g_closure_remove_invalidate_notifier (GClosure *closure, gpointer notify_data, GClosureNotify notify_func); void g_closure_add_marshal_guards (GClosure *closure, gpointer pre_marshal_data, GClosureNotify pre_marshal_notify, gpointer post_marshal_data, GClosureNotify post_marshal_notify); void g_closure_set_marshal (GClosure *closure, GClosureMarshal marshal); void g_closure_set_meta_marshal (GClosure *closure, gpointer marshal_data, GClosureMarshal meta_marshal); void g_closure_invalidate (GClosure *closure); void g_closure_invoke (GClosure *closure, GValue /*out*/ *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint); /* FIXME: OK: data_object::destroy -> closure_invalidate(); MIS: closure_invalidate() -> disconnect(closure); MIS: disconnect(closure) -> (unlink) closure_unref(); OK: closure_finalize() -> g_free (data_string); random remarks: - need marshaller repo with decent aliasing to base types - provide marshaller collection, virtually covering anything out there */ G_END_DECLS #endif /* __G_CLOSURE_H__ */
// // ViewController.h // adfadsf // // Created by lisongfa on 16/6/16. // Copyright ยฉ 2016ๅนด lisongfa. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
/* Copyright 2010-2013 SourceGear, 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 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. */ /** * * @file sg_variant.h * * @details SG_variant is a struct which can represent any of the * values that can appear in a JSON object. * * Note that storing a null pointer in a variant MUST be as * SG_VARIANT_TYPE_NULL. You may NOT use SG_VARIANT_TYPE_VHASH * (or the others like it) and then set pv->v.val_vhash to NULL. * */ #ifndef H_SG_VARIANT_H #define H_SG_VARIANT_H BEGIN_EXTERN_C #define SG_VARIANT_TYPE_NULL 1 #define SG_VARIANT_TYPE_INT64 2 #define SG_VARIANT_TYPE_DOUBLE 4 #define SG_VARIANT_TYPE_BOOL 8 #define SG_VARIANT_TYPE_SZ 16 #define SG_VARIANT_TYPE_VHASH 32 #define SG_VARIANT_TYPE_VARRAY 64 typedef union { SG_int64 val_int64; const char* val_sz; SG_vhash* val_vhash; SG_varray* val_varray; SG_bool val_bool; double val_double; } SG_variant_value; typedef struct _sg_variant { SG_variant_value v; /* we declare the type as 2 bytes instead of 1, for two * reasons: * * 1. to leave room for future expansion * * 2. the compiler is probably going to insert padding for * alignment purposes anyway * */ SG_uint16 type; } SG_variant; /** * The following functions are used to access the value of a variant * as its actual type. If the variant is not of the proper type, * the error will be SG_ERR_VARIANT_INVALIDTYPE. * * For nullable types, if the variant is of type NULL, then the * result will be NULL. This includes id, sz, vhash and varray. * For int64, bool and double, if the variant is of type NULL, the * result will be SG_ERR_VARIANT_INVALIDTYPE. * * These routines do NOT convert sz to/from int64, bool or double. If * you want int64 from a variant which is a string, get the string and * parse the int64 yourself. * * @defgroup SG_variant__get Functions to convert a variant to other types. * * @{ * */ void SG_variant__get__sz( SG_context* pCtx, const SG_variant* pv, const char** pputf8Value ); void SG_variant__get__int64( SG_context* pCtx, const SG_variant* pv, SG_int64* pResult ); void SG_variant__get__uint64( SG_context* pCtx, const SG_variant* pv, SG_uint64* pResult ); void SG_variant__get__int64_or_double( SG_context* pCtx, const SG_variant* pv, SG_int64* pResult ); void SG_variant__get__bool( SG_context* pCtx, const SG_variant* pv, SG_bool* pResult ); void SG_variant__get__double( SG_context* pCtx, const SG_variant* pv, double* pResult ); void SG_variant__get__vhash( SG_context* pCtx, const SG_variant* pv, SG_vhash** pResult ); void SG_variant__get__varray( SG_context* pCtx, const SG_variant* pv, SG_varray** pResult ); /** @} */ void SG_variant__compare(SG_context* pCtx, const SG_variant* pv1, const SG_variant* pv2, int* piResult); void SG_variant__equal( SG_context* pCtx, const SG_variant* pv1, const SG_variant* pv2, SG_bool* pbResult ); void SG_variant__can_be_sorted( SG_context* pCtx, const SG_variant* pv1, const SG_variant* pv2, SG_bool* pbResult ); void SG_variant__to_string( SG_context* pCtx, const SG_variant* pv, SG_string** ppstr ); /** * Creates a deep copy of a variant. */ void SG_variant__copy( SG_context* pCtx, //< [in] [out] Error and context info. const SG_variant* pSource, //< [in] The variant to copy. SG_variant** ppDest //< [out] A deep copy of the given variant. ); void SG_variant__free( SG_context* pCtx, SG_variant* pv ); const char* sg_variant__type_name(SG_uint16 t); ////////////////////////////////////////////////////////////////// /** * Normal increasing, case sensitive ordering. */ SG_qsort_compare_function SG_variant_sort_callback__increasing; int SG_variant_sort_callback__increasing(SG_context * pCtx, const void * pVoid_ppv1, // const SG_variant ** ppv1 const void * pVoid_ppv2, // const SG_variant ** ppv2 void * pVoidCallerData); ////////////////////////////////////////////////////////////////// END_EXTERN_C #endif
/** * @author ${kekkaishivn} - dattl@ifi.uio.no * * ${tags} */ #ifndef SGX_SYSSTAT_UTIL_H #define SGX_SYSSTAT_UTIL_H #include <sgx/sys/types.h> #ifdef __cplusplus extern "C" { #endif extern int sgx_wrapper_stat(const char *path, struct stat *buf); extern int sgx_wrapper_fstat(int fd, struct stat *buf); extern int sgx_wrapper_lstat(const char *path, struct stat *buf); extern int sgx_wrapper_chmod(const char *file, mode_t mode); extern int sgx_wrapper_fchmod(int fd, mode_t mode); extern int sgx_wrapper_fchmodat(int fd, const char *file, mode_t mode, int flag); extern mode_t sgx_wrapper_umask(mode_t mask); extern int sgx_wrapper_mkdir(const char *path, mode_t mode); extern int sgx_wrapper_mkdirat(int fd, const char *path, mode_t mode); extern int sgx_wrapper_mkfifo(const char *path, mode_t mode); extern int sgx_wrapper_mkfifoat(int fd, const char *path, mode_t mode); #ifdef __cplusplus } #endif #define stat(A, B) sgx_wrapper_stat(A, B) #define fstat(A, B) sgx_wrapper_fstat(A, B) #define lstat(A, B) sgx_wrapper_lstat(A, B) #define chmod(A, B) sgx_wrapper_chmod(A, B) #define fchmod(A, B) sgx_wrapper_fchmod(A, B) #define fchmodat(A, B, C) sgx_wrapper_fchmodat(A, B, C) #define umask(A) sgx_wrapper_umask(A) #define mkdir(A, B) sgx_wrapper_mkdir(A, B) #define mkdirat(A, B, C) sgx_wrapper_mkdirat(A, B, C) #define mkfifo(A, B) sgx_wrapper_mkfifo(A, B) #define mkfifoat(A, B, C) sgx_wrapper_mkfifoat(A, B, C) #endif
// // IntroScene.h // HelloCocos2d // // Created by Patrick Lo on 12/16/14. // Copyright Patrick Lo 2014. All rights reserved. // // ----------------------------------------------------------------------- // Importing cocos2d.h and cocos2d-ui.h, will import anything you need to start using cocos2d-v3 #import "cocos2d.h" #import "cocos2d-ui.h" // ----------------------------------------------------------------------- /** * The intro scene * Note, that scenes should now be based on CCScene, and not CCLayer, as previous versions * Main usage for CCLayer now, is to make colored backgrounds (rectangles) * */ @interface IntroScene : CCScene // ----------------------------------------------------------------------- + (IntroScene *)scene; - (id)init; // ----------------------------------------------------------------------- @end
/** * Appcelerator Titanium Mobile * Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. */ #ifndef TITITANIUMOBJECT_H_ #define TITITANIUMOBJECT_H_ #include "TiProxy.h" class TiCascadesApp; /* * TiTitaniumObject * * Titanium namespace */ class TiTitaniumObject : public TiProxy { public: static TiObject* createObject(NativeObjectFactory* objectFactory); protected: virtual ~TiTitaniumObject(); virtual void onCreateStaticMembers(); virtual bool canAddMembers() const; private: explicit TiTitaniumObject(); TiTitaniumObject(const TiTitaniumObject&); TiTitaniumObject& operator=(const TiTitaniumObject&); static Handle<Value> _globalInclude(void* userContext, TiObject* caller, const Arguments& args); static Handle<Value> _createBuffer(void* userContext, TiObject* caller, const Arguments& args); NativeObjectFactory* objectFactory_; }; #endif /* TITITANIUMOBJECT_H_ */
// // FlyClip.h // FlyClipSDK // // Created by wanghexiang on 2017/7/11. // Copyright ยฉ 2017ๅนด Eric. All rights reserved. // #import "FCMedia.h" #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> @interface FlyClip : NSObject /* * ่ฎพ็ฝฎๅฝ“ๅ‰ๅบ”็”จ็š„URLSchema */ +(void)setURLSchema:(NSString *)urlSchema; // ๆญคๅค„่ฎพ็ฝฎไธบๅฝ“ๅ‰App็š„hostๅณๅฏ /* * ๅผ€ๅฏSDK็š„ๅŠŸ่ƒฝ */ +(void)startWithAppKey:(NSString *)key; /* * ๆ‰“ๅผ€้ฃžๅฑApp */ +(void)openFlyClipApplication; /* * ๆ‰“ๅผ€ๆŒ‡ๅฎšApp็š„host */ +(void)openApplicationWithHost:(NSString *)applicationHost; /* * openApplication๏ผ› */ +(void)applicationOpenedWithURL:(NSString *)url; /* * ่ฟ›ๅ…ฅๅŽๅฐ */ +(void)applicationDidEnterBackground; /* * ็จ‹ๅบๅ˜ๆดป่ทƒ */ +(void)applicationDidBecomeActive; /* * ่ฎพ็ฝฎๅฝ“ๅ‰็š„ๅช’ไฝ“ๆ–‡ไปถ */ +(void)setCurrentMedia:(FCMedia *)media; +(void)back; @end
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <aboutdialog.h> #include <robot.h> #include <QTimer> #include "scenario.h" #include "bayesmap.h" #include "himmmap.h" namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); public slots: void dialChanged(int value); void openAboutDialog(); void upClicked(); void downClicked(); void leftClicked(); void rightClicked(); void updateData(); void startStopRobot(); signals: void moving(int distanceMM); private: void connectActions(); Ui::MainWindow *ui; AboutDialog aboutDialog; Robot *mRobot; QTimer mTimer; Scenario *environment; }; #endif // MAINWINDOW_H
// // NBSendStatusParam.h // weibo // // Created by yoga on 15/8/31. // Copyright (c) 2015ๅนด ioslearning. All rights reserved. // #import "NBBaseParam.h" @interface NBSendStatusParam : NBBaseParam /** true string ่ฆๅ‘ๅธƒ็š„ๅพฎๅšๆ–‡ๆœฌๅ†…ๅฎน๏ผŒๅฟ…้กปๅšURLencode๏ผŒๅ†…ๅฎนไธ่ถ…่ฟ‡140ไธชๆฑ‰ๅญ—ใ€‚*/ @property (nonatomic, copy) NSString *status; @end
// // SignInViewController.h // ContentBox // // Created by Igor Sapyanik on 22.01.14. /** * Copyright (c) 2014 Kinvey Inc. * * 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. * */ #import <UIKit/UIKit.h> @interface SignInViewController : UIViewController <UIWebViewDelegate, CLLocationManagerDelegate> + (void)presentSignInFlowOnViewController:(UIViewController *)vc animated:(BOOL)animated onCompletion:(STEmptyBlock)success; @property (nonatomic, copy) STEmptyBlock completionBlock; @end
/******************************************************************************* * * Copyright (c) 2011, 2012, 2013, 2014, 2015 Olaf Bergmann (TZI) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v. 1.0 which accompanies this distribution. * * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html * and the Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * Contributors: * Olaf Bergmann - initial API and implementation * Hauke Mehrtens - memory optimization, ECC integration * *******************************************************************************/ #ifndef _DTLS_NETQ_H_ #define _DTLS_NETQ_H_ #include "tinydtls.h" #include "global.h" #include "dtls.h" #include "dtls_time.h" /** * \defgroup netq Network Packet Queue * The netq utility functions implement an ordered queue of data packets * to send over the network and can also be used to queue received packets * from the network. * @{ */ #ifndef NETQ_MAXCNT #ifdef DTLS_ECC #define NETQ_MAXCNT 5 /**< maximum number of elements in netq structure */ #elif defined(DTLS_PSK) #define NETQ_MAXCNT 3 /**< maximum number of elements in netq structure */ #endif #endif /** * Datagrams in the netq_t structure have a fixed maximum size of * DTLS_MAX_BUF to simplify memory management on constrained nodes. */ typedef unsigned char netq_packet_t[DTLS_MAX_BUF]; typedef struct netq_t { struct netq_t *next; clock_time_t t; /**< when to send PDU for the next time */ unsigned int timeout; /**< randomized timeout value */ dtls_peer_t *peer; /**< remote address */ uint16_t epoch; uint8_t type; unsigned char retransmit_cnt; /**< retransmission counter, will be removed when zero */ size_t length; /**< actual length of data */ #if !(defined (WITH_CONTIKI)) && !(defined (RIOT_VERSION)) unsigned char data[]; /**< the datagram to send */ #else netq_packet_t data; /**< the datagram to send */ #endif } netq_t; #if !(defined (WITH_CONTIKI)) && !(defined (RIOT_VERSION)) static inline void netq_init(void) { } #else void netq_init(void); #endif /** * Adds a node to the given queue, ordered by their time-stamp t. * This function returns @c 0 on error, or non-zero if @p node has * been added successfully. * * @param queue A pointer to the queue head where @p node will be added. * @param node The new item to add. * @return @c 0 on error, or non-zero if the new item was added. */ int netq_insert_node(netq_t **queue, netq_t *node); /** Destroys specified node and releases any memory that was allocated * for the associated datagram. */ void netq_node_free(netq_t *node); /** Removes all items from given queue and frees the allocated storage */ void netq_delete_all(netq_t **queue); /** Creates a new node suitable for adding to a netq_t queue. */ netq_t *netq_node_new(size_t size); /** * Returns a pointer to the first item in given queue or NULL if * empty. */ netq_t *netq_head(netq_t **queue); netq_t *netq_next(netq_t *p); void netq_remove(netq_t **queue, netq_t *p); /** * Removes the first item in given queue and returns a pointer to the * removed element. If queue is empty when netq_pop_first() is called, * this function returns NULL. */ netq_t *netq_pop_first(netq_t **queue); /**@}*/ #endif /* _DTLS_NETQ_H_ */
#include "common.h" #include "control.h" #include "error.h" #include "params.h" static eeprom_params eeprom; void params_init() { // Read the parameters in the EEPROM into local memory EEPROM_read_block(0, (uint8_t*)&eeprom, sizeof(eeprom)); } int params_set_gain(uint8_t gain) { uint16_t amppot_set = 0, amppot_get = 0; // Get the potentiometer setting for the gain from the EEPROM if (gain == PARAM_GAIN_LOW) amppot_set = eeprom.gainL_amppot; else if (gain == PARAM_GAIN_HIGH) amppot_set = eeprom.gainH_amppot; else if (gain == PARAM_GAIN_CAL) amppot_set = POT_WIPERPOS_MAX; else halt(ERROR_AMPPOT_SET_FAILED); // Set the potentiometer setting pot_wiperpos_set(POT_AMP_CS_PIN_gm, amppot_set); amppot_get = pot_wiperpos_get(POT_AMP_CS_PIN_gm); if (amppot_get != amppot_set) halt(ERROR_AMPPOT_SET_FAILED); return 0; } void params_set_samplerate() { uint16_t tovf = 0, tdiv = 0; uint16_t filpot_set = 0, filpot_get = 0; if (g_control_mode == CONTROL_MODE_STREAM) { tovf = eeprom.uart_tovf; tdiv = eeprom.uart_tdiv; filpot_set = eeprom.uart_filpot; } else if (g_control_mode == CONTROL_MODE_USB_STORE || g_control_mode == CONTROL_MODE_PORT_STORE) { tovf = eeprom.sd_tovf; tdiv = eeprom.sd_tdiv; filpot_set = eeprom.sd_filpot; } else halt(ERROR_SAMPLERATE_SET_WRONG_MODE); // set timer prescaler and period timer_set(&TCD0, tdiv, tovf); // set filter potentiomter pot_wiperpos_set(POT_FIL_CS_PIN_gm, filpot_set); filpot_get = pot_wiperpos_get(POT_FIL_CS_PIN_gm); if (filpot_get != filpot_set) halt(ERROR_FILPOT_SET_FAILED); } int8_t params_get_port_ovs_bits() { if (eeprom.version < PARAMS_EEPROM_PORT_OVS_BITS_VER) return -1; return eeprom.port_ovs_bits; }
/** @file * Copyright (c) 2016, ARM Limited or its affiliates. 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. **/ /** This file is common to all test cases and Val layer of the Suite */ #ifndef __SBSA_AVS_COMMON_H__ #define __SBSA_AVS_COMMON_H__ #define TEST_NAME_HELPER(x,y) c##x##y #define TEST_NAME(x,y) TEST_NAME_HELPER(x,y) #define AVS_PE_TEST_NUM_BASE 0 #define AVS_GIC_TEST_NUM_BASE 20 #define AVS_TIMER_TEST_NUM_BASE 30 #define AVS_WD_TEST_NUM_BASE 40 #define AVS_PCIE_TEST_NUM_BASE 50 #define AVS_WAKEUP_TEST_NUM_BASE 70 #define AVS_PER_TEST_NUM_BASE 80 #define AVS_SMMU_TEST_NUM_BASE 90 #define AVS_SECURE_TEST_NUM_BASE 900 #define STATE_BIT 28 #define STATE_MASK 0xF //These are the states a test can be in */ #define TEST_START_VAL 0x1 #define TEST_END_VAL 0x2 #define TEST_PASS_VAL 0x4 #define TEST_FAIL_VAL 0x8 #define TEST_SKIP_VAL 0x9 #define TEST_PENDING_VAL 0xA #define CPU_NUM_BIT 32 #define CPU_NUM_MASK 0xFFFFFFFF #define LEVEL_BIT 24 #define LEVEL_MASK 0xF #define TEST_NUM_BIT 16 #define TEST_NUM_MASK 0xFF /* TEST start and Stop defines */ #define SBSA_AVS_START(level, test_num) (((TEST_START_VAL) << STATE_BIT) | ((level) << LEVEL_BIT) | ((test_num) << TEST_NUM_BIT)) #define SBSA_AVS_END(level, test_num) (((TEST_END_VAL) << STATE_BIT) | ((level) << LEVEL_BIT) | ((test_num) << TEST_NUM_BIT)) /* TEST Result defines */ #define RESULT_PASS(level, test_num, status) (((TEST_PASS_VAL) << STATE_BIT) | ((level) << LEVEL_BIT) | ((test_num) << TEST_NUM_BIT) | (status)) #define RESULT_FAIL(level, test_num, status) (((TEST_FAIL_VAL) << STATE_BIT) | ((level) << LEVEL_BIT) | ((test_num) << TEST_NUM_BIT) | (status)) #define RESULT_SKIP(level, test_num, status) (((TEST_SKIP_VAL) << STATE_BIT) | ((level) << LEVEL_BIT) | ((test_num) << TEST_NUM_BIT) | (status)) #define RESULT_PENDING(level, test_num) (((TEST_PENDING_VAL) << STATE_BIT) | \ ((level) << LEVEL_BIT) | ((test_num) << TEST_NUM_BIT)) #define IS_TEST_START(value) (((value >> STATE_BIT) & (STATE_MASK)) == TEST_START_VAL) #define IS_TEST_END(value) (((value >> STATE_BIT) & (STATE_MASK)) == TEST_END_VAL) #define IS_RESULT_PENDING(value) (((value >> STATE_BIT) & (STATE_MASK)) == TEST_PENDING_VAL) #define IS_TEST_PASS(value) (((value >> STATE_BIT) & (STATE_MASK)) == TEST_PASS_VAL) #define IS_TEST_FAIL(value) (((value >> STATE_BIT) & (STATE_MASK)) == TEST_FAIL_VAL) #define IS_TEST_SKIP(value) (((value >> STATE_BIT) & (STATE_MASK)) == TEST_SKIP_VAL) #define IS_TEST_FAIL_SKIP(value) ((IS_TEST_FAIL(value)) || (IS_TEST_SKIP(value))) uint32_t val_mmio_read(addr_t addr); void val_mmio_write(addr_t addr, uint32_t data); uint32_t val_initialize_test(uint32_t test_num, char8_t * desc, uint32_t num_pe, uint32_t level); uint32_t val_check_for_error(uint32_t test_num, uint32_t num_pe); void val_run_test_payload(uint32_t test_num, uint32_t num_pe, void (*payload)(void), uint64_t test_input); void val_data_cache_ops_by_va(addr_t addr, uint32_t type); #endif
/* * Copyright 2016 Utkin Dmitry <loentar@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * This file is part of ngrest-db: http://github.com/loentar/ngrest-db */ #ifndef NGREST_QUERYIMPL_H #define NGREST_QUERYIMPL_H #include <string> namespace ngrest { class QueryImpl { public: virtual ~QueryImpl(); virtual void reset() = 0; inline bool query(const std::string& query) { prepare(query); return next(); } virtual void prepare(const std::string& query) = 0; virtual void bindNull(int arg) = 0; virtual void bindBool(int arg, bool value) = 0; virtual void bindInt(int arg, int value) = 0; virtual void bindBigInt(int arg, int64_t value) = 0; virtual void bindFloat(int arg, double value) = 0; virtual void bindString(int arg, const std::string& value) = 0; virtual bool next() = 0; virtual bool resultIsNull(int column) = 0; virtual bool resultBool(int column) = 0; virtual int resultInt(int column) = 0; virtual int64_t resultBigInt(int column) = 0; virtual double resultFloat(int column) = 0; virtual void resultString(int column, std::string& value) = 0; virtual int64_t lastInsertId() = 0; }; } // namespace ngrest #endif // NGREST_QUERYIMPL_H
#ifndef ParticlesObjectH #define ParticlesObjectH #include "../PS_instance.h" extern const Fvector zero_vel; class CParticlesObject : public CPS_Instance { typedef CPS_Instance inherited; u32 dwLastTime; void Init (LPCSTR p_name, IRender_Sector* S, BOOL bAutoRemove); void UpdateSpatial (); protected: bool m_bLooped; //รดรซร รฃ, รทรฒรฎ รฑรจรฑรฒรฅรฌร  รงร รถรจรชรซรฅรญร  bool m_bStopping; //รขรปรงรขร รญร  รดรณรญรชรถรจรฟ Stop() protected: u32 mt_dt; protected: virtual ~CParticlesObject (); public: CParticlesObject (LPCSTR p_name, BOOL bAutoRemove); virtual bool shedule_Needed () {return true;}; virtual float shedule_Scale () { return Device.vCameraPosition.distance_to(Position())/200.f; } virtual void shedule_Update (u32 dt); virtual void renderable_Render (); void PerformAllTheWork (u32 dt); void __stdcall PerformAllTheWork_mt(); Fvector& Position (); void SetXFORM (const Fmatrix& m); IC Fmatrix& XFORM () {return renderable.xform;} void UpdateParent (const Fmatrix& m, const Fvector& vel); void play_at_pos (const Fvector& pos, BOOL xform=FALSE); virtual void Play (); void Stop (BOOL bDefferedStop=TRUE); virtual BOOL Locked () { return mt_dt; } bool IsLooped () {return m_bLooped;} bool IsAutoRemove (); bool IsPlaying (); void SetAutoRemove (bool auto_remove); const shared_str Name (); public: static CParticlesObject* Create (LPCSTR p_name, BOOL bAutoRemove=TRUE) { return xr_new<CParticlesObject>(p_name, bAutoRemove); } static void Destroy (CParticlesObject*& p) { if (p){ p->PSI_destroy (); p = 0; } } }; #endif /*ParticlesObjectH*/
/* Copyright 2018 Google Inc. 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 __DEBUG_MARKER_H__ #define __DEBUG_MARKER_H__ #include <glm/glm.hpp> #include "VkexLoader.h" #define SCOPE1(cmd, name) vkex::internal::DebugMarkerHelper temp_##__LINE__(cmd, name); #define SCOPE2(cmd, name, color) vkex::internal::DebugMarkerHelper temp_##__LINE__(cmd, name, color); #define BEGIN1(cmd, name) vkex::internal::DebugMarkerBegin(cmd, name); #define BEGIN2(cmd, name, color) vkex::internal::DebugMarkerBegin(cmd, name, color); #define GET_MACRO(_1, _2, _3, NAME, ...) NAME #if defined(VKEX_WIN32) // No op these for Windows #define DEBUG_MARKER_SCOPE #define DEBUG_MARKER_BEGIN #define DEBUG_MARKER_END #else // Use as follows: DEBUG_MARKER_SCOPE(name) or DEBUG_MARKER_SCOPE(name, color). // Note: Make sure scope exists within vkBeginCommandBuffer/vkEndCommandBuffer! #define DEBUG_MARKER_SCOPE(...) GET_MACRO(__VA_ARGS__, SCOPE2, SCOPE1)(__VA_ARGS__) // Use as follows: DEBUG_MARKER_BEGIN(name) or DEBUG_MARKER_BEGIN(name, color). #define DEBUG_MARKER_BEGIN(...) GET_MACRO(__VA_ARGS__, BEGIN2, BEGIN1)(__VA_ARGS__) #define DEBUG_MARKER_END(cmd) vkex::internal::DebugMarkerEnd(cmd); #endif namespace vkex { // ================================================================================================= // Internal functions/classes. Use above DEBUG_MARKER_* macros! // ================================================================================================= namespace internal { inline void DebugMarkerBegin(VkCommandBuffer cmd_buffer, const char *marker_name, const glm::vec4 &color = glm::vec4(1,1,1,1)) { VkDebugMarkerMarkerInfoEXT markerInfo = {}; markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT; memcpy(markerInfo.color, &color[0], sizeof(float) * 4); markerInfo.pMarkerName = marker_name; if (vkex::CmdDebugMarkerBeginEXT != nullptr) vkex::CmdDebugMarkerBeginEXT(cmd_buffer, &markerInfo); } inline void DebugMarkerEnd(VkCommandBuffer cmd_buffer) { if (vkex::CmdDebugMarkerEndEXT != nullptr) vkex::CmdDebugMarkerEndEXT(cmd_buffer); } // ================================================================================================= // DebugMarkerHelper // ================================================================================================= class DebugMarkerHelper { public: DebugMarkerHelper(VkCommandBuffer cmd_buffer, const char *marker_name, const glm::vec4 &color = glm::vec4(1,1,1,1)) { m_cmd_buffer = cmd_buffer; DebugMarkerBegin(cmd_buffer, marker_name, color); } ~DebugMarkerHelper() { DebugMarkerEnd(m_cmd_buffer); } private: VkCommandBuffer m_cmd_buffer; }; } // namespace internal } // namespace vkex #endif // __DEBUG_MARKER_H__
// Copyright 2016 InnerFunction Ltd. // // 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. // // Created by Julian Goacher on 12/03/2016. // Copyright ยฉ 2016 InnerFunction. All rights reserved. // #import <UIKit/UIKit.h> #import "SCViewBehaviour.h" /** * A default do-nothing implementation of the view behaviour protocol. * Provides empty implementations of the required methods. */ @interface SCViewBehaviourObject : NSObject <SCViewBehaviour> @end
/* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class org_apache_hadoop_io_compress_zlib_ZlibCompressor_CompressionLevel */ #ifndef _Included_org_apache_hadoop_io_compress_zlib_ZlibCompressor_CompressionLevel #define _Included_org_apache_hadoop_io_compress_zlib_ZlibCompressor_CompressionLevel #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif
// // AppDelegate.h // MoMo // // Created by Monster on 15/7/12. // Copyright (c) 2015ๅนด aib. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
/****************************************************************************** * Copyright 2011 Kitware Inc. * * 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 __ButtonLineEdit_H #define __ButtonLineEdit_H #include <QWidget> #include <QLineEdit> #include <QPushButton> #include "MidasResourceDescTable.h" class MidasItemTreeItem; class ButtonEditUI; class ButtonLineEdit : public QWidget { Q_OBJECT public: ButtonLineEdit(MidasItemTreeItem* item, MIDASFields field, ButtonEditUI* handler, QWidget* parent = 0, std::string text = "Add"); ~ButtonLineEdit(); QString getData(); void setData(const QString& value); public slots: void appendText(const QString& text); protected: QLineEdit* m_TextEdit; QPushButton* m_AddButton; MIDASFields m_Field; MidasItemTreeItem* m_Item; }; #endif
#ifndef GETOPT_H #define GETOPT_H /* include files needed by this include file */ /* macros defined by this include file */ #define no_argument 0 #define REQUIRED_ARG 1 #define OPTIONAL_ARG 2 /* types defined by this include file */ /* GETOPT_LONG_OPTION_T: The type of long option */ typedef struct GETOPT_LONG_OPTION_T { char *name; /* the name of the long option */ int has_arg; /* one of the above macros */ int *flag; /* determines if getopt_long() returns a * value for a long option; if it is * non-NULL, 0 is returned as a function * value and the value of val is stored in * the area pointed to by flag. Otherwise, * val is returned. */ int val; /* determines the value to return if flag is * NULL. */ } GETOPT_LONG_OPTION_T; typedef GETOPT_LONG_OPTION_T option; #ifdef __cplusplus extern "C" { #endif /* externally-defined variables */ extern char *optarg; extern int optind; extern int opterr; extern int optopt; /* function prototypes */ int getopt (int argc, char **argv, char *optstring); int getopt_long (int argc, char **argv, char *shortopts, GETOPT_LONG_OPTION_T * longopts, int *longind); int getopt_long_only (int argc, char **argv, char *shortopts, GETOPT_LONG_OPTION_T * longopts, int *longind); #ifdef __cplusplus }; #endif #endif /* GETOPT_H */ /* END OF FILE getopt.h */
// // NSMutableArray+LoggingAddObject.h // MethodSwizzling // // Created by tarena on 16/5/19. // Copyright ยฉ 2016ๅนด tarena. All rights reserved. // #import <Foundation/Foundation.h> #import <objc/runtime.h> @interface NSMutableArray (LoggingAddObject) -(void)logAddObject:(id)object; @end
/* * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg 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 FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Replacements for frequently missing libm functions */ #ifndef AVUTIL_LIBM_H #define AVUTIL_LIBM_H #include <math.h> #include "config.h" #include "attributes.h" #if !HAVE_EXP2 #undef exp2 #define exp2(x) exp((x) * 0.693147180559945) #endif /* HAVE_EXP2 */ #if !HAVE_EXP2F #undef exp2f #define exp2f(x) ((float)exp2(x)) #endif /* HAVE_EXP2F */ #if !HAVE_LLRINT #undef llrint #define llrint(x) ((long long)rint(x)) #endif /* HAVE_LLRINT */ #if !HAVE_LLRINTF #undef llrintf #define llrintf(x) ((long long)rint(x)) #endif /* HAVE_LLRINT */ #if !HAVE_LOG2 #undef log2 #define log2(x) (log(x) * 1.44269504088896340736) #endif /* HAVE_LOG2 */ #if !HAVE_LOG2F #undef log2f #define log2f(x) ((float)log2(x)) #endif /* HAVE_LOG2F */ #if !HAVE_LRINT av_always_inline av_const long int lrint(double x) { return rint(x); } #endif /* HAVE_LRINT */ #if !HAVE_LRINTF av_always_inline av_const long int lrintf(float x) { return (int)(rint(x)); } #endif /* HAVE_LRINTF */ #if !HAVE_ROUND av_always_inline av_const double round(double x) { return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5); } #endif /* HAVE_ROUND */ #if !HAVE_ROUNDF av_always_inline av_const float roundf(float x) { return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5); } #endif /* HAVE_ROUNDF */ #if !HAVE_TRUNCF av_always_inline av_const float truncf(float x) { return (x > 0) ? floor(x) : ceil(x); } #endif /* HAVE_TRUNCF */ #endif /* AVUTIL_LIBM_H */
#ifndef DOBBY_SYMBOL_RESOLVER_H #define DOBBY_SYMBOL_RESOLVER_H #ifdef __cplusplus extern "C" { #endif void *DobbySymbolResolver(const char *image_name, const char *symbol_name); #ifdef __cplusplus } #endif #endif
#ifndef Alchemy_ElePanda #define Alchemy_ElePanda #include "Common.h" #include "../Monster.h" class ElePanda : public Monster { public: ElePanda(); ~ElePanda(); static Monster* create(void); static PE_s_monster param_ElePanda; private: }; #endif
// // BindingPlatesViewController.h // sgSalerReport // // Created by YaoHuiQiu on 16/5/4. // Copyright ยฉ 2016ๅนด dwolf. All rights reserved. // #import "BaseViewController.h" //่งฃ้™ค็ป‘ๅฎšor็ป‘ๅฎš @interface BindingPlatesViewController : BaseViewController @end
// // MeeRefreshFooter.h // MeeBS // // Created by ๆ‰ฌๅธ†่ตท่ˆช on 15/12/19. // Copyright ยฉ 2015ๅนด Lee. All rights reserved. // #import <MJRefresh/MJRefresh.h> @interface MeeRefreshFooter : MJRefreshAutoNormalFooter @end
/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. * * The information contained herein is property of Nordic Semiconductor ASA. * Terms and conditions of usage are described in detail in NORDIC * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. * * Licensees are granted free, non-transferable use of the information. NO * WARRANTY of ANY KIND is provided. This heading must NOT be removed from * the file. * */ #ifndef ANT_KEY_MANAGER_CONFIG_H__ #define ANT_KEY_MANAGER_CONFIG_H__ /** * @addtogroup ant_key_manager * @{ */ #ifndef ANT_PLUS_NETWORK_KEY #define ANT_PLUS_NETWORK_KEY {0, 0, 0, 0, 0, 0, 0, 0} /**< The ANT+ network key. */ #endif //ANT_PLUS_NETWORK_KEY #ifndef ANT_FS_NETWORK_KEY #define ANT_FS_NETWORK_KEY {0, 0, 0, 0, 0, 0, 0, 0} /**< The ANT-FS network key. */ #endif // ANT_FS_NETWORK_KEY /** * @} */ #endif // ANT_KEY_MANAGER_CONFIG_H__
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * 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 <folly/Portability.h> #include <folly/lang/Hint.h> namespace folly { /** * assume*() functions can be used to fine-tune optimizations or suppress * warnings when certain conditions are provably true, but the compiler is not * able to prove them. * * This is different from assertions: an assertion will place an explicit check * that the condition is true, and abort the program if the condition is not * verified. Calling assume*() with a condition that is not true at runtime * is undefined behavior: for example, it may or may not result in a crash, * silently corrupt memory, or jump to a random code path. * * These functions should only be used on conditions that are provable internal * logic invariants; they cannot be used safely if the condition depends on * external inputs or data. To detect unexpected conditions that *can* happen, * an assertion or exception should be used. */ /** * assume(cond) informs the compiler that cond can be assumed true. If cond is * not true at runtime the behavior is undefined. * * The typical use case is to allow the compiler exploit data structure * invariants that can trigger better optimizations, for example to eliminate * unnecessary bounds checks in a called function. It is recommended to check * the generated code or run microbenchmarks to assess whether it is actually * effective. * * The semantics are similar to clang's __builtin_assume(), but intentionally * implemented as a function to force the evaluation of its argument, contrary * to the builtin, which cannot used with expressions that have side-effects. */ FOLLY_ALWAYS_INLINE void assume(bool cond) { compiler_may_unsafely_assume(cond); } /** * assume_unreachable() informs the compiler that the statement is not reachable * at runtime. It is undefined behavior if the statement is actually reached. * * Common use cases are to suppress a warning when the compiler cannot prove * that the end of a non-void function is not reachable, or to optimize the * evaluation of switch/case statements when all the possible values are * provably enumerated. */ [[noreturn]] FOLLY_ALWAYS_INLINE void assume_unreachable() { compiler_may_unsafely_assume_unreachable(); } } // namespace folly
// // ZKShop.h // ZKWaterflow(็€‘ๅธƒๆต) // // Created by ้—ซๆŒฏๅฅŽ on 16/6/22. // Copyright ยฉ 2016ๅนด TowMen. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface ZKShop : NSObject @property (nonatomic, assign) CGFloat w; @property (nonatomic, assign) CGFloat h; @property (nonatomic, copy) NSString *img; @property (nonatomic, copy) NSString *price; @end
#include "sympl_utils.h" void sympl_calculateDelta(DVector *delta, Matrix *A, DVector *C, IVector *basis) { for (int j = 0; j < A->w; j++) { delta->data[j] = 0; for (int i = 0; i < A->h; i++) { delta->data[j] += A->data[i][j] * C->data[basis->data[i]]; } delta->data[j] -= C->data[j]; } } int sympl_is_good_delta(DVector *delta, int delta_flag) { if (delta_flag == DELTA_BEFORE_ZERO) { for (int i = 0; i < delta->size; i++) { if (delta->data[i] > 0) return DELTA_BAD; } } else { for (int i = 0; i < delta->size; i++) { if (delta->data[i] < 0) return DELTA_BAD; } } return DELTA_GOOD; } void sympl_print(FILE *out, Matrix *A, DVector *C, DVector *delta, IVector *basis) { printf("\n\n| "); for (int i = 0; i < A->w; i++) { printf("| A%i ", i); } printf("| C |\n"); for (int i = 0; i < basis->size; i++) { printf("|A%i", basis->data[i]); for (int j = 0; j < A->w; j++) { printf("|%.2lf", A->data[i][j]); } printf("|%0.2lf\n", C->data[basis->data[i]]); } printf("|dl"); for (int i = 0; i < delta->size; i++) { printf("|%.2lf", delta->data[i]); } printf("\n\n"); } void sympl_find_p_k(Matrix *A, DVector *delta, int *p, int *k) { *p = 1; double p_val = delta->data[*p]; for (int i = *p + 1; i < delta->size; i++) { if (delta->data[i] < p_val) { p_val = delta->data[i]; *p = i; } } *k = 0; double k_val = A->data[*k][0] / A->data[*k][*p]; for (int i = 1; i < A->h; i++) { if (A->data[i][*p] < 0) continue; double newValue = A->data[i][0] / A->data[i][*p]; if (newValue < k_val) { k_val = newValue; *k = i; } } } void sympl_process_table(Matrix *A, DVector *delta, IVector *basis) { int p,k; sympl_find_p_k(A, delta, &p, &k); basis->data[k] = p; Matrix *A_tmp = matrix_allocate(A->h, A->w); for (int i = 0; i < A_tmp->h; i++) { for (int j = 0; j < A_tmp->w; j++) { if (i == k) { A_tmp->data[i][j] = A->data[k][j] / A->data[k][p]; } else { A_tmp->data[i][j] = (A->data[i][j] * A->data[k][p] - A->data[i][p] * A->data[k][j]) / A->data[k][p]; } } } matrix_fill(A_tmp, A); matrix_free(A_tmp); } #define CORRECT 0 #define INCORRECT 1 #define POSITION_NOT_SET -1 IVector * sympl_add_basis_vars(Matrix *A) { IVector *counter = IVector_allocate(A->h); for (int i = 0 ; i < counter->size; i++) { counter->data[i] = 0; } IVector *basis = IVector_allocate(A->h); int basis_pos = 0; for (int j = 0; j < A->w; j++) { int is_correct = CORRECT; int one_position = POSITION_NOT_SET; int one_col; for (int i = 0; i < A->h; i++) { if (A->data[i][j] != 0 && A->data[i][j] != 1) { is_correct = INCORRECT; break; } if (A->data[i][j] == 1) { if (one_position == POSITION_NOT_SET) { one_position = i; one_col = j; } else { is_correct = INCORRECT; break; } } } if (is_correct == CORRECT) { counter->data[one_position]++; basis->data[basis_pos++] = one_col; } } for (int i = 0; i < counter->size; i++) { if (counter->data[i] == 0) { // add new col matrix_add_col(A, A->w); A->data[i][A->w - 1] = 1; counter->data[i] = 1; basis->data[basis_pos++] = A->w - 1; } } return basis; } void sympl_add_artificial_vars(Matrix *A, CVector *operators) { for (int i = 0; i < operators->size; i++) { char operator = operators->data[i]; if (operator == '=') continue; matrix_add_col(A, A->w); A->data[i][A->w - 1] = operator == '>' ? -1 : 1; } } void sympl_print_result(FILE *out, IVector *basis, Matrix *A) { for (int i = 0 ;i < basis->size; i++) { fprintf(out, "x%i = %lf\n", basis->data[i], A->data[i][0]); } }
// // SecondIntroductionView.h // Inneract // // Created by Jim Liu on 3/5/15. // Copyright (c) 2015 Emmanuel Texier. All rights reserved. // #import <UIKit/UIKit.h> @interface SecondIntroductionView : UIView @end
//#include "stdafx.h" #ifndef __DXTRILIST_INCLUDED__ #define __DXTRILIST_INCLUDED__ #include "ode/include/ode/common.h" struct dcVector3 { float x, y, z; dcVector3() {} dcVector3(dReal x, dReal y, dReal z) { this->x = (float)x; this->y = (float)y; this->z = (float)z; } dcVector3(const dReal* v) { x = (float)v[0]; y = (float)v[1]; z = (float)v[2]; } ~dcVector3() {} operator float*() { //&slipch return reinterpret_cast<float*>(this); } /* Add */ dcVector3 operator+(const dcVector3& v) const { dcVector3 Out; Out.x = x + v.x; Out.y = y + v.y; Out.z = z + v.z; return Out; } dcVector3& operator+=(const dcVector3& v) { x += v.x; y += v.y; z += v.z; return *this; } /* Sub */ dcVector3 operator-(const dcVector3& v) const { dcVector3 Out; Out.x = x - v.x; Out.y = y - v.y; Out.z = z - v.z; return Out; } dcVector3& operator-=(const dcVector3& v) { x -= v.x; y -= v.y; z -= v.z; return *this; } /* Mul */ dcVector3 operator*(const dcVector3& v) const { dcVector3 Out; Out.x = x * v.x; Out.y = y * v.y; Out.z = z * v.z; return Out; } dcVector3 operator*(float Scalar) const { dcVector3 Out; Out.x = x * Scalar; Out.y = y * Scalar; Out.z = z * Scalar; return Out; } dcVector3& operator*=(const dcVector3& v) { x *= v.x; y *= v.y; z *= v.z; return *this; } dcVector3& operator*=(float Scalar) { x *= Scalar; y *= Scalar; z *= Scalar; return *this; } /* Div */ dcVector3 operator/(const dcVector3& v) const { dcVector3 Out; Out.x = x / v.x; Out.y = y / v.y; Out.z = z / v.z; return Out; } dcVector3 operator/(float Scalar) const { dcVector3 Out; Out.x = x / Scalar; Out.y = y / Scalar; Out.z = z / Scalar; return Out; } dcVector3& operator/=(const dcVector3& v) { x /= v.x; y /= v.y; z /= v.z; return *this; } dcVector3& operator/=(float Scalar) { x /= Scalar; y /= Scalar; z /= Scalar; return *this; } /* Negative */ dcVector3& operator-() { x = -x; y = -y; z = -z; return *this; } /* Comparison */ bool operator==(const dcVector3& v) const { return x == v.x && y == v.y && z == v.z; } bool operator!=(const dcVector3& v) const { return v.x != x || v.y != y || v.z != z; } float DotProduct(const dcVector3& v) const { return x * v.x + y * v.y + z * v.z; } dcVector3 CrossProduct(const dcVector3& v) const { dcVector3 Out; Out.x = y * v.z - z * v.y; Out.y = z * v.x - x * v.z; Out.z = x * v.y - y * v.x; return Out; } float MagnitudeSq() const { return DotProduct(*this); } float Magnitude() const { return std::sqrt(MagnitudeSq()); } void Normalize() { operator/=(Magnitude()); } /* Member access */ float& operator[](int Index) { return *(&x + Index); } float operator[](int Index) const { return *(&x + Index); } }; /* Class ID */ extern int dTriListClass; /* Per triangle callback */ typedef int dTriCallback(dGeomID TriList, dGeomID RefObject, int TriangleIndex); void dGeomTriListSetCallback(dGeomID g, dTriCallback* Callback); dTriCallback* dGeomTriListGetCallback(dGeomID g); /* Per object callback */ typedef void dTriArrayCallback(dGeomID TriList, dGeomID RefObject, const int* TriIndices, int TriCount); void dGeomTriListSetArrayCallback(dGeomID g, dTriArrayCallback* ArrayCallback); dTriArrayCallback* dGeomTriListGetArrayCallback(dGeomID g); /* Construction */ dxGeom* dCreateTriList(dSpaceID space, dTriCallback* Callback, dTriArrayCallback* ArrayCallback); /* Setting data */ void dGeomTriListBuild(dGeomID g, const dcVector3* Vertices, int VertexCount, const int* Indices, int IndexCount); /* Getting data */ void dGeomTriListGetTriangle(dGeomID g, int Index, dVector3* v0, dVector3* v1, dVector3* v2); /* Internal types */ class dcTriListCollider; struct dxTriList { dReal p[4]; // dxPlane dTriCallback* Callback; dTriArrayCallback* ArrayCallback; dcTriListCollider* Collider; }; struct dcPlane { dcVector3 Normal; float Distance; dcPlane() {} dcPlane(const dcVector3& v0, const dcVector3& v1, const dcVector3& v2) { dcVector3 u = v1 - v0; dcVector3 v = v2 - v0; Normal = u.CrossProduct(v); Distance = v0.DotProduct(Normal); Normalize(); } void Normalize() { float Factor = 1.0f / Normal.Magnitude(); Normal *= Factor; Distance *= Factor; } bool Contains(const dcVector3& RefObject, float Epsilon = 0.0f) const { return Normal.DotProduct(RefObject) - Distance >= -Epsilon; //@slipch ">=" instead ">" } }; template <class T> const T& dcMAX(const T& x, const T& y) { return x > y ? x : y; } template <class T> const T& dcMIN(const T& x, const T& y) { return x < y ? x : y; } #endif //__DXTRILIST_INCLUDED__
/* Copyright 2015-2016 Samsung Electronics Co., Ltd. * Copyright 2016 University of Szeged. * * 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 LIT_GLOBALS_H #define LIT_GLOBALS_H #include "jrt.h" /** * ECMAScript standard defines terms "code unit" and "character" as 16-bit unsigned value * used to represent 16-bit unit of text, this is the same as code unit in UTF-16 (See ECMA-262 5.1 Chapter 6). * * The term "code point" or "Unicode character" is used to refer a single Unicode scalar value (may be longer * than 16 bits: 0x0 - 0x10FFFFF). One code point could be represented with one ore two 16-bit code units. * * According to the standard all strings and source text are assumed to be a sequence of code units. * Length of a string equals to number of code units in the string, which is not the same as number of Unicode * characters in a string. * * Internally JerryScript engine uses UTF-8 representation of strings to reduce memory overhead. Unicode character * occupies from one to four bytes in UTF-8 representation. * * Unicode scalar value | Bytes in UTF-8 | Bytes in UTF-16 * | (internal representation) | * ---------------------------------------------------------------------- * 0x0 - 0x7F | 1 byte | 2 bytes * 0x80 - 0x7FF | 2 bytes | 2 bytes * 0x800 - 0xFFFF | 3 bytes | 2 bytes * 0x10000 - 0x10FFFF | 4 bytes | 4 bytes * * Scalar values from 0xD800 to 0xDFFF are permanently reserved by Unicode standard to encode high and low * surrogates in UTF-16 (Code points 0x10000 - 0x10FFFF are encoded via pair of surrogates in UTF-16). * Despite that the official Unicode standard says that no UTF forms can encode these code points, we allow * them to be encoded inside strings. The reason for that is compatibility with ECMA standard. * * For example, assume a string which consists one Unicode character: 0x1D700 (Mathematical Italic Small Epsilon). * It has the following representation in UTF-16: 0xD835 0xDF00. * * ECMA standard allows extracting a substring from this string: * > var str = String.fromCharCode (0xD835, 0xDF00); // Create a string containing one character: 0x1D700 * > str.length; // 2 * > var str1 = str.substring (0, 1); * > str1.length; // 1 * > str1.charCodeAt (0); // 55349 (this equals to 0xD835) * * Internally original string would be represented in UTF-8 as the following byte sequence: 0xF0 0x9D 0x9C 0x80. * After substring extraction high surrogate 0xD835 should be encoded via UTF-8: 0xED 0xA0 0xB5. * * Pair of low and high surrogates encoded separately should never occur in internal string representation, * it should be encoded as any code point and occupy 4 bytes. So, when constructing a string from two surrogates, * it should be processed gracefully; * > var str1 = String.fromCharCode (0xD835); // 0xED 0xA0 0xB5 - internal representation * > var str2 = String.fromCharCode (0xDF00); // 0xED 0xBC 0x80 - internal representation * > var str = str1 + str2; // 0xF0 0x9D 0x9C 0x80 - internal representation, * // !!! not 0xED 0xA0 0xB5 0xED 0xBC 0x80 */ /** * Description of an ecma-character, which represents 16-bit code unit, * which is equal to UTF-16 character (see Chapter 6 from ECMA-262 5.1) */ typedef uint16_t ecma_char_t; /** * Description of a collection's/string's length */ typedef uint32_t ecma_length_t; /** * Description of an ecma-character pointer */ typedef ecma_char_t *ecma_char_ptr_t; /** * Max bytes needed to represent a code unit (utf-16 char) via utf-8 encoding */ #define LIT_UTF8_MAX_BYTES_IN_CODE_UNIT (3) /** * Max bytes needed to represent a code point (Unicode character) via utf-8 encoding */ #define LIT_UTF8_MAX_BYTES_IN_CODE_POINT (4) /** * Max bytes needed to represent a code unit (utf-16 char) via cesu-8 encoding */ #define LIT_CESU8_MAX_BYTES_IN_CODE_UNIT (3) /** * Max bytes needed to represent a code point (Unicode character) via cesu-8 encoding */ #define LIT_CESU8_MAX_BYTES_IN_CODE_POINT (6) /** * A byte of utf-8 string */ typedef uint8_t lit_utf8_byte_t; /** * Size of a utf-8 string in bytes */ typedef uint32_t lit_utf8_size_t; /** * Size of a magic string in bytes */ typedef uint8_t lit_magic_size_t; /** * Unicode code point */ typedef uint32_t lit_code_point_t; /** * ECMA string hash */ typedef uint16_t lit_string_hash_t; /** * Maximum value of ECMA string hash + 1 * * Note: * On ARM, this constant can be encoded as an immediate value * while 0xffffu cannot be. Hence using this constant reduces * binary size and improves performance. */ #define LIT_STRING_HASH_LIMIT 0x10000u /** * Hash of the frequently used "length" string. */ #define LIT_STRING_LENGTH_HASH 0x3615u #endif /* !LIT_GLOBALS_H */
/* * Copyright (C) 2012 The Android 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 _BDROID_BUILDCFG_H #define _BDROID_BUILDCFG_H #define BTM_DEF_LOCAL_NAME "Xperia Ion" #define BTA_DISABLE_DELAY 1000 /* in milliseconds */ #endif
// ProgramOptions.h // Created by Caner Korkmaz on 20/5/2017. // Copyright 2017 Caner Korkmaz // #ifndef SOCKETPLAY_PROGRAMOPTIONSPARSER_H #define SOCKETPLAY_PROGRAMOPTIONSPARSER_H #include <vector> #include <string> #include <memory> #include <tuple> #include <boost/program_options.hpp> #include "ProgramMode.h" namespace socketplay { /** * @brief Helper for parsing command line options, uses boost::program_options */ class ProgramOptionsParser { public: /** * Initiates parser for command line arguments * @param arguments Command Line Arguments */ explicit ProgramOptionsParser(std::vector<std::string>&& arguments); /// Parser for stream options, checks whether the mode is true StreamOptions parse_stream_options(); /// Parser for stream file options, checks whether the mode is true StreamFileOptions parse_stream_file_options(); /// Parser for play options, checks whether the mode is true PlayOptions parse_play_options(); // TODO: Add parser for config file /// Variables map parsed from program options const boost::program_options::variables_map &variables_map() const { return variables_map_; } /// Checks whether an options exists bool has(const std::string &variable) const { return variables_map_.count(variable) != 0; } /** * @brief Helper to get variable from variables map and convert to required type * @pre The variable should exist and be of type T * @tparam T Type of the requested variable * @param variable Variable to get from the map * @return Const ref of type T to given variable from options map */ template<typename T> const T &get(const std::string &variable) const { return variables_map_[variable].as<T>(); } /** * @brief Helper to get variable from variables map if it exists and convert to required type, * throws otherwise * @tparam T Type of the requested variable * @tparam Error Type of error to throw, defaults to std::runtime_error * @param variable Variable to get from the map * @param error Error message to throw if the variable doesnt exist, defaults to "" * @throws Error if the variable doesn't exist * @return Const ref of type T to given variable from options map */ template<typename T, typename Error = std::runtime_error> const T &get_checked(const std::string &variable, const std::string &error = "") const { if (!has(variable)) throw Error(error); return variables_map_[variable].as<T>(); } /** * Gets specified mode * @return Mode got from arguments */ ProgramMode mode() const { return mode_; } /// Returns the generated help message const std::string &help_message() const { return help_message_; } private: boost::program_options::options_description general_options_; boost::program_options::positional_options_description positional_options_; boost::program_options::options_description stream_options_; boost::program_options::options_description stream_file_options_; boost::program_options::options_description play_options_; boost::program_options::options_description all_options_; boost::program_options::variables_map variables_map_; std::string help_message_; std::vector<std::string> arguments_; std::vector<std::string> unrecognized_; ProgramMode mode_; }; } #endif //SOCKETPLAY_PROGRAMOPTIONS_H
// // main.c // 3-ใ€ไบ†่งฃใ€‘printfๅ‡ฝๆ•ฐ็š„ไป‹็ปๅ’Œไฝฟ็”จ // // Created by ้ซ˜ๆ˜Ž่พ‰ on 15/12/24. // Copyright ยฉ 2015ๅนด itcast. All rights reserved. // #include <stdio.h> int main(int argc, const char * argv[]) { /* ไฝฟ็”จprintfๅ‡ฝๆ•ฐ๏ผŒ้œ€่ฆๅผ•ๅ…ฅๅคดๆ–‡ไปถstdio.h ๏ผŒไฝ†ๆ˜ฏๅฏนไบŽprintfๅ‡ฝๆ•ฐไนŸๅฏไปฅไธๅผ•ๅ…ฅใ€‚ printfๅ‡ฝๆ•ฐ็š„ไธ€่ˆฌไฝฟ็”จๅฝขๅผ๏ผš 1ใ€่พ“ๅ‡บไธ€ๆฎตๅญ—็ฌฆ๏ผš printf("hello owrld \n"); 2ใ€่พ“ๅ‡บๅ˜้‡็š„ๅ€ผใ€‚ printf("ๆ ผๅผๆŽงๅˆถๅญ—็ฌฆไธฒ",่พ“ๅ‡บ้กนๅˆ—่กจ); 3ใ€่พ“ๅ‡บๅคšไธชๅ˜้‡็š„ๅ€ผ printf("%d,%d,%d",a,b,c); ๆณจๆ„๏ผš ๆ ผๅผๆŽงๅˆถๅญ—็ฌฆไธฒไธญ็š„ๅ ไฝ็ฌฆ่ฆๅ’ŒๅŽ้ข็š„่พ“ๅ‡บ็›ธ็š„็ฑปๅž‹ๅ’Œๆฌกๅบไธ€ไธ€ๅฏนๅบ”ใ€‚ ๆณจๆ„๏ผš %.2f ่กจ็คบไฟ็•™ๅฐๆ•ฐ็‚นๅŽ้ข2ไฝๅฐๆ•ฐ๏ผŒๅนถไธ”ๅ››่ˆไบ”ๅ…ฅใ€‚ ๅŸŸๅฎฝ๏ผš %5d %-5d %0d ่ฝฌไน‰ๅญ—็ฌฆ๏ผš ๅœจๆŽงๅˆถๅฐๆ‰“ๅฐๅ‡บ : "hello,'dog',\o/,50%" "hello,'dog',\o/,50%" "\"hello,\'dog',\\o/,50%%\"\n" */ printf("hello world...\n"); int a = 210; // ๆˆ‘ๆƒณๆ‰“ๅฐๅ‡บa็š„ๅ€ผ๏ผŒๆ€ŽไนˆๅŠž๏ผŸ printf("a = %d\n",a); float f = 123456.56789f; printf("f = %5.2f\n",f);// ๏ผ…f้ป˜่ฎค่พ“ๅ‡บ6ไฝๅฐๆ•ฐใ€‚ float f1 = 1.23456789f; printf("f1 = %.9f\n",f1); float f2 = 123456789.0f; printf("f2 = %f\n",f2); double d = 1.23456789123456789; printf("d = %.19lf\n",d); int a1 = 10; long b = 100000l; float fx = 1.2f; printf("a1 = %d,b = %ld,fx = %.2f\n",a1,b,fx); // ๆ‰“ๅฐ่ฝฌไน‰ๅญ—็ฌฆ๏ผš printf("\"hello,\'dog',\\o/,50%%\"\n"); return 0; }
/* Copyright (c) 2021, Craig Barnes. 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 https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include <limits.h> #include <stddef.h> #include <lua.h> #include <lauxlib.h> #include "compat.h" #include "../lib/ascii.h" #include "../lib/macros.h" static const char *do_trim(const char *str, size_t *n) { size_t len = *n; while (len && ascii_isspace(*str)) { len--; str++; } const char *end = str + len - 1; while (len && ascii_isspace(*end)) { len--; end--; } *n = len; return str; } static int trim_and_collapse(lua_State *L) { luaL_Buffer b; size_t len; const char *str = luaL_checklstring(L, 1, &len); str = do_trim(str, &len); #if LUA_VERSION_NUM >= 502 char *out = luaL_buffinitsize(L, &b, len); size_t pos = 0; #else luaL_buffinit(L, &b); #endif for (size_t i = 0; i < len; ) { char ch = str[i++]; if (ascii_isspace(ch)) { while (i < len && ascii_isspace(str[i])) { i++; } ch = ' '; } #if LUA_VERSION_NUM >= 502 out[pos++] = ch; #else luaL_addchar(&b, ch); #endif } #if LUA_VERSION_NUM >= 502 luaL_addsize(&b, pos); #endif luaL_pushresult(&b); return 1; } static int trim(lua_State *L) { size_t len; const char *str = luaL_checklstring(L, 1, &len); const char *trimmed = do_trim(str, &len); lua_pushlstring(L, trimmed, len); return 1; } static int createtable(lua_State *L) { lua_Integer narr = luaL_checkinteger(L, 1); lua_Integer nrec = luaL_checkinteger(L, 2); if (unlikely(narr < 0 || narr > INT_MAX)) { luaL_argerror(L, 1, "value outside valid range"); } if (unlikely(nrec < 0 || nrec > INT_MAX)) { luaL_argerror(L, 2, "value outside valid range"); } lua_createtable(L, (int)narr, (int)nrec); return 1; } static const luaL_Reg lib[] = { {"trim", trim}, {"trimAndCollapseWhitespace", trim_and_collapse}, {"createtable", createtable}, {NULL, NULL} }; EXPORT int luaopen_gumbo_util(lua_State *L) { luaL_newlib(L, lib); return 1; }
/* Copyright 2010-2013 SourceGear, 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 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ ////////////////////////////////////////////////////////////////// #include <sg.h> #include "sg_wc__public_typedefs.h" #include "sg_wc__public_prototypes.h" #include "sg_wc__private.h" #include "sg_vv2__public_typedefs.h" #include "sg_vv2__public_prototypes.h" #include "sg_vv2__private.h" ////////////////////////////////////////////////////////////////// static SG_varray_foreach_callback _diff_to_stream_cb; static void _diff_to_stream_cb(SG_context * pCtx, void * pVoidData, const SG_varray * pvaStatus, SG_uint32 k, const SG_variant * pv) { sg_vv6diff__diff_to_stream_data * pData = (sg_vv6diff__diff_to_stream_data *)pVoidData; SG_vhash * pvhItem; // we do not own this SG_vhash * pvhItemStatus; // we do not own this SG_int64 i64; SG_wc_status_flags statusFlags; SG_UNUSED( pvaStatus ); SG_UNUSED( k ); SG_ERR_CHECK( SG_variant__get__vhash(pCtx, pv, &pvhItem) ); SG_ERR_CHECK( SG_vhash__get__vhash(pCtx, pvhItem, "status", &pvhItemStatus) ); SG_ERR_CHECK( SG_vhash__get__int64(pCtx, pvhItemStatus, "flags", &i64) ); statusFlags = (SG_wc_status_flags)i64; switch (statusFlags & SG_WC_STATUS_FLAGS__T__MASK) { case SG_WC_STATUS_FLAGS__T__FILE: SG_ERR_CHECK( sg_vv2__diff__file(pCtx, pData, pvhItem, statusFlags) ); break; case SG_WC_STATUS_FLAGS__T__DIRECTORY: SG_ERR_CHECK( sg_vv2__diff__directory(pCtx, pData, pvhItem, statusFlags) ); break; case SG_WC_STATUS_FLAGS__T__SYMLINK: SG_ERR_CHECK( sg_vv2__diff__symlink(pCtx, pData, pvhItem, statusFlags) ); break; // case SG_WC_STATUS_FLAGS__T__SUBREPO: default: SG_ERR_THROW( SG_ERR_NOTIMPLEMENTED ); } fail: return; } void sg_vv2__diff__diff_to_stream(SG_context * pCtx, const char * pszRepoName, const SG_varray * pvaStatus, SG_bool bInteractive, const char * pszTool, SG_vhash ** ppvhResultCodes) { sg_vv6diff__diff_to_stream_data data; SG_vhash * pvhWcInfo = NULL; SG_bool bGivenRepoName; // ppvhResultCodes is optional. memset(&data, 0, sizeof(data)); bGivenRepoName = (pszRepoName && *pszRepoName); if (!bGivenRepoName) { // If they didn't give us a RepoName, try to get it from the WD. SG_wc__get_wc_info(pCtx, NULL, &pvhWcInfo); if (SG_CONTEXT__HAS_ERR(pCtx)) SG_ERR_RETHROW2( (pCtx, "Use 'repo' option or be in a working copy.") ); SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvhWcInfo, "repo", &pszRepoName) ); } SG_ERR_CHECK( SG_REPO__OPEN_REPO_INSTANCE(pCtx, pszRepoName, &data.pRepo) ); data.pPathSessionTempDir = NULL; // defer until needed data.pszTool = pszTool; data.bInteractive = bInteractive; if (bInteractive) data.pszDiffToolContext = SG_DIFFTOOL__CONTEXT__GUI; else data.pszDiffToolContext = SG_DIFFTOOL__CONTEXT__CONSOLE; data.pszSubsectionLeft = SG_WC__STATUS_SUBSECTION__A; // must match values in sg_vv2__status.c data.pszSubsectionRight = SG_WC__STATUS_SUBSECTION__B; if (ppvhResultCodes) { // The caller wants to know if we were able to lauch // a difftool. However, we take a VARRAY of items to // compare -- rather than a single item. So we must // build a container to return the individual tool // results on each file. SG_ERR_CHECK( SG_VHASH__ALLOC(pCtx, &data.pvhResultCodes) ); } SG_ERR_CHECK( SG_varray__foreach(pCtx, pvaStatus, _diff_to_stream_cb, &data) ); if (ppvhResultCodes) { *ppvhResultCodes = data.pvhResultCodes; data.pvhResultCodes = NULL; } fail: SG_VHASH_NULLFREE(pCtx, pvhWcInfo); SG_REPO_NULLFREE(pCtx, data.pRepo); if (data.pPathSessionTempDir) { // we may or may not be able to delete the tmp dir (they may be visiting it in another window) // so we have to allow this to fail and not mess up the real context. SG_ERR_IGNORE( SG_fsobj__rmdir_recursive__pathname(pCtx, data.pPathSessionTempDir) ); SG_PATHNAME_NULLFREE(pCtx, data.pPathSessionTempDir); } SG_VHASH_NULLFREE(pCtx, data.pvhResultCodes); } void sg_vv2__diff__print_header_on_console(SG_context * pCtx, sg_vv6diff__diff_to_stream_data * pData, const SG_string * pStringHeader) { if (pData->bInteractive) return; SG_ERR_CHECK( SG_console__raw(pCtx, SG_CS_STDOUT, SG_string__sz(pStringHeader)) ); fail: return; }
๏ปฟ/* * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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 <aws/elasticbeanstalk/ElasticBeanstalk_EXPORTS.h> #include <aws/elasticbeanstalk/model/ApplicationDescription.h> #include <aws/elasticbeanstalk/model/ResponseMetadata.h> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Xml { class XmlDocument; } // namespace Xml } // namespace Utils namespace ElasticBeanstalk { namespace Model { /** * <p>Result message containing a single description of an application.</p> */ class AWS_ELASTICBEANSTALK_API UpdateApplicationResult { public: UpdateApplicationResult(); UpdateApplicationResult(const AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result); UpdateApplicationResult& operator=(const AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result); /** * <p> The <a>ApplicationDescription</a> of the application. </p> */ inline const ApplicationDescription& GetApplication() const{ return m_application; } /** * <p> The <a>ApplicationDescription</a> of the application. </p> */ inline void SetApplication(const ApplicationDescription& value) { m_application = value; } /** * <p> The <a>ApplicationDescription</a> of the application. </p> */ inline void SetApplication(ApplicationDescription&& value) { m_application = value; } /** * <p> The <a>ApplicationDescription</a> of the application. </p> */ inline UpdateApplicationResult& WithApplication(const ApplicationDescription& value) { SetApplication(value); return *this;} /** * <p> The <a>ApplicationDescription</a> of the application. </p> */ inline UpdateApplicationResult& WithApplication(ApplicationDescription&& value) { SetApplication(value); return *this;} inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = value; } inline UpdateApplicationResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} inline UpdateApplicationResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(value); return *this;} private: ApplicationDescription m_application; ResponseMetadata m_responseMetadata; }; } // namespace Model } // namespace ElasticBeanstalk } // namespace Aws
// // ViewController.h // Demo02_GitServer // // Created by tarena on 15/10/8. // Copyright (c) 2015ๅนด tarena. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
//--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA Engine // // This file contains the Debugger class and its helpers header // (C)2005-2015, by Alexei Rakov //--------------------------------------------------------------------------- #ifndef gtkdebuggerH #define gtkdebuggerH #include "../debugging.h" // --- EventManager --- #define DEBUG_CLOSE 0 #define DEBUG_SUSPEND 1 #define DEBUG_RESUME 2 #define DEBUG_ACTIVE 3 #define MAX_DEBUG_EVENT 4 namespace _ELENA_ { class DebugEventManager { // //HANDLE _events[MAX_DEBUG_EVENT]; public: void init(); void resetEvent(int event); void setEvent(int event); int waitForAnyEvent(); bool waitForEvent(int event, int timeout); void close(); DebugEventManager() { // for (int i = 0 ; i < MAX_DEBUG_EVENT ; i++) // _events[i] = NULL; } ~DebugEventManager() { close(); } }; // --- ThreadBreakpoint --- struct ThreadBreakpoint { bool software; bool hardware; size_t next; size_t stackLevel; void clearSoftware() { software = false; next = 0; } ThreadBreakpoint() { hardware = software = false; stackLevel = next = 0; } }; // --- ProcessException --- struct ProcessException { int code; int address; const char* Text(); ProcessException() { code = 0; } }; // --- ThreadContext --- struct ThreadContext { friend class Debugger; friend struct BreakpointContext; protected: void* state; // HANDLE hProcess; // HANDLE hThread; // CONTEXT context; public: ThreadBreakpoint breakpoint; bool atCheckPoint; bool checkFailed; void* State() const { return state; } size_t EIP() const { return /*context.Eip*/0; } // !! temporal size_t Frame() { return /*context.Ebp - offset * */4; } // !! temporal size_t Local(int offset) { return /*context.Ebp - offset * */4; } // !! temporal size_t Current(int offset) { return /*context.Esp + offset * */4; }// !! temporal size_t ClassVMT(size_t address); size_t VMTFlags(size_t address); size_t ObjectPtr(size_t address); size_t LocalPtr(int offset) { return ObjectPtr(Local(offset)); } size_t CurrentPtr(int offset) { return ObjectPtr(Current(offset)); } void readDump(size_t address, char* dump, size_t length); void writeDump(size_t address, char* dump, size_t length); size_t readDWord(size_t address) { return 0; } // !! temporal size_t readWord(size_t address) { return 0; } // !! temporal void refresh(); void setCheckPoint(); void setTrapFlag(); void resetTrapFlag(); void setHardwareBreakpoint(size_t breakpoint); unsigned char setSoftwareBreakpoint(size_t breakpoint); void setEIP(size_t address); void clearHardwareBreakpoint(); void clearSoftwareBreakpoint(size_t breakpoint, char substitute); // ThreadContext(HANDLE hProcess, HANDLE hThread); }; // --- BreakpointContext --- struct BreakpointContext { Map<size_t, char> breakpoints; void addBreakpoint(size_t address, ThreadContext* context, bool started); void removeBreakpoint(size_t address, ThreadContext* context, bool started); void setSoftwareBreakpoints(ThreadContext* context); void setHardwareBreakpoint(size_t address, ThreadContext* context, bool withStackLevelControl); bool processStep(ThreadContext* context, bool stepMode); bool processBreakpoint(ThreadContext* context); void clear(); BreakpointContext(); }; // --- Debugger --- class Debugger { // typedef Map<int, ThreadContext*> ThreadContextes; // // DWORD threadId; // bool started; bool trapped; // bool stepMode; // bool needToHandle; // bool exitCheckPoint; // // BreakpointContext breakpoints; // // ThreadContextes threads; // ThreadContext* current; // // DWORD dwCurrentProcessId; // DWORD dwCurrentThreadId; // // size_t minAddress, maxAddress; //// size_t vmhookAddress; // =0 - hook is turned off, =-1 : waiting for initializing, >0 hook address // // MemoryMap<int, void*> steps; // // ProcessException exception; // // bool startProcess(const TCHAR* exePath, const TCHAR* cmdLine); // void processEvent(size_t timeout); // void processException(EXCEPTION_DEBUG_INFO* exception); // void continueProcess(); // // void processStep(); public: bool isStarted() const { return started; } bool isTrapped() const { return trapped; } // !! temporal bool isInitBreakpoint() const { return /*vmhookAddress == current->context.Eip;*/ false; } ThreadContext* Context() { return /*current*/NULL; } ProcessException* Exception() { return /*exception.code == 0 ? */NULL/* : &exception*/; } // !! temporal void resetException() { /*exception.code = 0;*/ } void addStep(size_t address, void* state); void addBreakpoint(size_t address); void removeBreakpoint(size_t address); void clearBreakpoints(); void setStepMode(); void setBreakpoint(size_t address, bool withStackLevelControl); void setCheckMode(); bool startThread(_DebugController* controller); bool start(const char* exePath, const char* cmdLine); void run(); bool proceed(size_t timeout); void stop(); void processVirtualStep(void* step); bool proceedCheckPoint(); void reset(); void activate(); // !! temporal void initHook() { /*vmhookAddress = -1;*/ } bool initDebugInfo(bool standalone, StreamReader& reader, size_t& debugInfoPtr); size_t findEntryPoint(const char* programPath); bool findSignature(char* signature); Debugger(); }; } // _ELENA_ #endif // gtkdebuggerH
#pragma once #include "Holder.h" #include "CircularBuffer.h"
// // UIViewController+Common.h // HappyWeekDayer // // Created by scjy on 16/1/6. // Copyright ยฉ 2016ๅนด ๆŽๅฟ—้น. All rights reserved. // #import <UIKit/UIKit.h> @interface UIViewController (Common) - (void)showBackButtonWithImage:(NSString *)imageName; - (void)showRightButtonWithTitle:(NSString *)Title; @end
#include <RefCounted.h> #include <Lockable.h> // DataSet.h class DataSet : public RefCounted, public Lockable { public: DataSet(); off_t open(const char *fileName, int npoleGuess, float sampRate); int getNPoles() const { return _nPoles; } off_t getFrameCount() const { return _frameCount; } int getFrame(float frameno, float *pCoeffs); protected: ~DataSet(); void allocArray(int nPoles); private: int _nPoles; off_t _frameCount; int _fdesc; int _lpHeaderSize; float *_array; off_t _oldframe, _endframe; int _framsize; int _fprec; int _recsize; int _bprec; int _bpframe; int _npolem1; bool _swapped; };
// // HotKey.h // // Created by chao on 7/12/16. // Copyright ยฉ 2016 eschao. All rights reserved. // #import <Cocoa/Cocoa.h> #import <Carbon/Carbon.h> @interface HotKey : NSObject @property (readonly) NSUInteger keyCode; @property (readonly) NSUInteger keyMod; @property (readonly) BOOL enabled; - (instancetype)initWithKeyCode:(NSUInteger)keyCode keyMod:(NSUInteger)keyMod target:(id)target action:(SEL)action; - (instancetype)initWithHotKey:(NSString *)hotKey target:(id)target action:(SEL)action; - (NSNumber *)getID; - (BOOL)register; - (BOOL)registerWith:(NSString *)hotKey; - (BOOL)registerWith:(NSUInteger)keyCode keyMod:(NSUInteger)keyMod; - (BOOL)unregister; - (BOOL)canRestoreWithDefaultHotKey; - (BOOL)enable:(NSString *)hotKey; - (BOOL)disable; - (void)perform; - (NSString *)hotKey2String; + (NSNumber *)getID:(NSUInteger)keyCode keyMod:(NSUInteger)keyMod; + (NSString *)hotKey2String:(NSUInteger)keyCode keyMod:(NSUInteger)keyMod; @end
/*------------------------------------------------------------------------- * * execBitmapHeapScan.c * Support routines for scanning Heap tables using bitmaps. * * Portions Copyright (c) 2014-Present Pivotal Software, Inc. * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION * src/backend/executor/execBitmapHeapScan.c * *------------------------------------------------------------------------- */ #include "postgres.h" #include "executor/executor.h" #include "nodes/execnodes.h" #include "access/heapam.h" #include "access/relscan.h" #include "access/transam.h" #include "executor/execdebug.h" #include "executor/nodeBitmapHeapscan.h" #include "pgstat.h" #include "storage/bufmgr.h" #include "utils/memutils.h" #include "miscadmin.h" #include "parser/parsetree.h" #include "cdb/cdbvars.h" /* gp_select_invisible */ #include "nodes/tidbitmap.h" /* * Prepares for a new heap scan. */ void BitmapHeapScanBegin(ScanState *scanState) { BitmapTableScanState *node = (BitmapTableScanState *)scanState; Relation currentRelation = node->ss.ss_currentRelation; EState *estate = node->ss.ps.state; Assert(node->scanDesc == NULL); /* * Even though we aren't going to do a conventional seqscan, it is useful * to create a HeapScanDesc --- most of the fields in it are usable. */ node->scanDesc = heap_beginscan_bm(currentRelation, estate->es_snapshot, 0, NULL); /* * Heap always needs rechecking each tuple because of potential * visibility issue (we don't store MVCC info in the index). */ node->recheckTuples = true; } /* * Cleans up after the scanning is done. */ void BitmapHeapScanEnd(ScanState *scanState) { BitmapTableScanState *node = (BitmapTableScanState *)scanState; /* * We might call "End" method before even calling init method, * in case we had an ERROR. Ignore scanDesc cleanup in such cases */ if (NULL != node->scanDesc) { heap_endscan((HeapScanDesc)node->scanDesc); node->scanDesc = NULL; } if (NULL != node->iterator) { pfree(node->iterator); node->iterator = NULL; } } /* * Returns the next matching tuple. */ TupleTableSlot * BitmapHeapScanNext(ScanState *scanState) { BitmapTableScanState *node = (BitmapTableScanState *)scanState; Assert((node->ss.scan_state & SCAN_SCAN) != 0); /* * extract necessary information from index scan node */ TupleTableSlot *slot = node->ss.ss_ScanTupleSlot; HeapScanDesc scan = node->scanDesc; TBMIterateResult *tbmres = (TBMIterateResult *)node->tbmres; Assert(tbmres != NULL && tbmres->ntuples != 0); Assert(node->needNewBitmapPage == false); for (;;) { CHECK_FOR_INTERRUPTS(); if (node->iterator == NULL) { /* * Fetch the current heap page and identify candidate tuples. */ bitgetpage(scan, tbmres); /* * Set rs_cindex to first slot to examine */ scan->rs_cindex = 0; /* * The nullity of the iterator is used to check if * we need a new iterator to process a new bitmap page. * Note: the bitmap page is provided by BitmapTableScan. * This iterator is supposed to maintain the cursor position * in the heap page that it is scanning. However, for heap * tables we already have such cursor state as part of ScanState, * and so, we just use a dummy allocation here to indicate * ourselves that we have finished initialization for processing * a new bitmap page. */ node->iterator = palloc(0); } else { /* * Continuing in previously obtained page; advance rs_cindex */ scan->rs_cindex++; } /* * If we reach the end of the relation or if we are out of range or * nothing more to look at on this page, then request a new bitmap page. */ if (tbmres->blockno >= scan->rs_nblocks || scan->rs_cindex < 0 || scan->rs_cindex >= scan->rs_ntuples) { Assert(NULL != node->iterator); pfree(node->iterator); node->iterator = NULL; node->needNewBitmapPage = true; return ExecClearTuple(slot); } /* * Okay to fetch the tuple */ OffsetNumber targoffset = scan->rs_vistuples[scan->rs_cindex]; Page dp = (Page) BufferGetPage(scan->rs_cbuf); ItemId lp = PageGetItemId(dp, targoffset); Assert(ItemIdIsUsed(lp)); scan->rs_ctup.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp); scan->rs_ctup.t_len = ItemIdGetLength(lp); ItemPointerSet(&scan->rs_ctup.t_self, tbmres->blockno, targoffset); pgstat_count_heap_fetch(scan->rs_rd); /* * Set up the result slot to point to this tuple. Note that the slot * acquires a pin on the buffer. */ ExecStoreHeapTuple(&scan->rs_ctup, slot, scan->rs_cbuf, false); if (!BitmapTableScanRecheckTuple(node, slot)) { ExecClearTuple(slot); continue; } return slot; } /* * We should never reach here as the termination is handled * from nodeBitmapTableScan. */ Assert(false); return NULL; } /* * Prepares for a re-scan. */ void BitmapHeapScanReScan(ScanState *scanState) { BitmapTableScanState *node = (BitmapTableScanState *)scanState; Assert(node->scanDesc != NULL); /* rescan to release any page pin */ heap_rescan(node->scanDesc, NULL); }
// // FNNewsKeyButton.h // FourNews // // Created by xmg on 16/4/4. // Copyright ยฉ 2016ๅนด ๅคฉๆถฏๆตทๅŒ—. All rights reserved. // #import <UIKit/UIKit.h> @interface FNNewsKeyButton : UIButton @end
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> #define DATASETSIZE 10 void heap_sort(double* srcdata, int len); void main(void){ double srcdata[DATASETSIZE]; int idx, jdx; srand(time(NULL)); for( idx=0; idx<DATASETSIZE; idx++ ){ srcdata[idx] = rand()*1.0/RAND_MAX; } for( idx=0; idx<DATASETSIZE; idx++ ){ if(idx%10 == 0) printf("\n\n"); printf(" %f, ",srcdata[idx]); } printf("\n"); heap_sort(srcdata,DATASETSIZE); for( idx=0; idx<DATASETSIZE; idx++ ){ if(idx%10 == 0) printf("\n\n"); printf(" %f, ",srcdata[idx]); } printf("\n"); } void swap(double* srcdata,int i,int j){ double temp; temp = srcdata[i]; srcdata[i] = srcdata[j]; srcdata[j] = temp; } int left(int i){ return 2*i; } int right(int i){ return 2*i+1; } void max_heapify(double* srcdata,int len,int i){ int l = left(i); int r = right(i); int largest = 0; if( l<len && srcdata[l]>srcdata[i] ){ largest = l; }else largest = i; if( r<len && srcdata[largest]<srcdata[r] ){ largest = r; } if( largest!=i ){ swap(srcdata,largest,i); max_heapify(srcdata,len,largest); } } void build_max_heap(double* srcdata,int len){ int idx=0; for(idx=(int)(floor(len/2));idx>=0;idx--){ max_heapify(srcdata,len,idx); } } void heap_sort(double* srcdata,int len){ int idx=0; build_max_heap(srcdata,len); for(idx=len-1;idx>0;idx--){ swap(srcdata,0,idx); len--; max_heapify(srcdata,len,0); } }
// dominators // another problem with gcc void cprop_test6(int *data) { int j = 5; if (data[0]) data[1] = 10*j; else data[2] = 15*j; data[3] = 21*j; }
/*Copyright 2014-2015 George Karagoulis 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 GUTIL_SOURCESANDSINKS_H #define GUTIL_SOURCESANDSINKS_H #include <gutil/iio.h> #include <gutil/string.h> #include <cstdarg> NAMESPACE_GUTIL; /** Defines a byte array input source. The byte array must exist * for the lifetime of this instance. The caller retains ownership * of the byte array. */ class ByteArrayInput : public GUtil::IRandomAccessInput { byte const *const m_start; byte const *const m_end; byte const *m_cur; public: /** Initialize from a byte array. */ ByteArrayInput(byte const *ba, GUINT32 len) :m_start(ba), m_end(m_start + len), m_cur(m_start) {} /** Initialize from a char array. */ ByteArrayInput(char const *ba, GUINT32 len) :m_start((byte const *)ba), m_end(m_start + len), m_cur(m_start) {} ByteArrayInput(const String &s) :m_start((byte const *)s.ConstData()), m_end(m_start + s.Length()), m_cur(m_start) {} ByteArrayInput(const GUtil::Vector<byte> &s) :m_start((byte const *)s.ConstData()), m_end(m_start + s.Length()), m_cur(m_start) {} virtual ~ByteArrayInput(); /** \name GUtil::IRandomAccessInput \{ */ virtual GUINT32 ReadBytes(byte *buf, GUINT32 len, GUINT32 to_read); virtual GUINT64 Pos() const{ return m_cur - m_start; } virtual GUINT64 Length() const{ return m_end - m_start; } virtual void Seek(GUINT64 pos){ m_cur = m_start + pos; } /** \} */ }; /** Takes a large input device and constrains the input to a section of it. * Like if you only want to read part of a file, not the whole thing, you might * constrain it as an input. */ class ConstrainedInput : public GUtil::IRandomAccessInput { IRandomAccessInput &m_input; const GUINT32 m_start, m_end; public: ConstrainedInput(IRandomAccessInput &input, GUINT32 startpos, GUINT32 endpos) :m_input(input), m_start(startpos), m_end(endpos) { GASSERT(m_input.Length() > startpos); GASSERT(m_input.Length() >= endpos); GASSERT(endpos >= startpos); m_input.Seek(startpos); } virtual GUINT32 ReadBytes(byte *buf, GUINT32 len, GUINT32 to_read){ return m_input.ReadBytes(buf, len, to_read); } virtual GUINT64 Pos() const{ return m_input.Pos() - m_start; } virtual GUINT64 Length() const{ return m_end - m_start; } virtual void Seek(GUINT64 pos){ m_input.Seek(m_start + pos); } }; /** Outputs to a generic byte array. Use as a data sink. * You must be very careful with this class, and only use it if * you know your buffer is large enough to receive the data * This could cause a seg fault if used improperly. If you don't * know the size of the output, then use VectorByteArrayOutput. */ class ByteArrayOutput : public GUtil::IOutput { byte *m_cur; public: ByteArrayOutput(char *ba) :m_cur((byte *)ba) {} ByteArrayOutput(byte *ba) :m_cur(ba) {} virtual GUINT32 WriteBytes(const byte *data, GUINT32 len){ memcpy(m_cur, data, len); m_cur += len; return len; } }; /** Outputs to a string. Use as a data sink. */ class StringOutput : public GUtil::IOutput { String &m_out; public: StringOutput(String &ba) :m_out(ba) {} virtual GUINT32 WriteBytes(const byte *data, GUINT32 len){ m_out.Insert((const char *)data, len, m_out.Length()); return len; } }; /** Outputs to a vector byte array. Use as a data sink. */ class VectorByteArrayOutput : public GUtil::IOutput { Vector<byte> &m_out; public: VectorByteArrayOutput(Vector<byte> &ba) :m_out(ba) {} virtual GUINT32 WriteBytes(const byte *data, GUINT32 len){ m_out.Insert(data, len, m_out.Length()); return len; } }; /** A class that replicates output across several output devices. The output data received by this device will be replicated to the other devices in the order they are given. The separate output devices are not owned by the replicator, so you must manage their memory yourself. If one device encounters an error during output and it throws an exception, all further processing will be halted. If the device fails silently (i.e. returns less than the desired number of bytes written) then it will not be known to the outside. The replicator simply skips over it and always returns the desired number of bytes written. */ class OutputReplicator : public GUtil::IOutput { Vector<IOutput *> m_outputs; public: /** Variadic constructor allows you to make a replicator with arbitrarily many outputs. The number of arguments must match the first argument N. */ OutputReplicator(GUINT32 N = 0, ...) :m_outputs(N) { va_list args; va_start(args, N); for(GUINT32 i = 0; i < N; ++i) m_outputs.PushBack(va_arg(args, IOutput*)); va_end(args); } /** Appends an output device to the list. */ void AddOutputDevice(IOutput *o){ m_outputs.PushBack(o); } /** Returns the current number of outputs to which the data is being replicated. */ GUINT32 NumberOfOutputs() const{ return m_outputs.Length(); } /** Writes the data to all output devices in the order they were given. Errors are only presented if an exception is thrown. */ virtual GUINT32 WriteBytes(const byte *data, GUINT32 len){ for(GUINT32 i = 0; i < m_outputs.Length(); ++i) m_outputs[i]->WriteBytes(data, len); return len; } }; END_NAMESPACE_GUTIL; #endif // GUTIL_SOURCESANDSINKS_H
/* $NetBSD: log.c,v 1.1.1.2 2004/07/12 23:27:15 wiz Exp $ */ /* Log file output. Copyright (C) 2003 Free Software Foundation, Inc. This program 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, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by Bruno Haible <bruno@clisp.org>. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <stdio.h> #include <stdlib.h> #include <string.h> /* Print an ASCII string with quotes and escape sequences where needed. */ static void print_escaped (FILE *stream, const char *str) { putc ('"', stream); for (; *str != '\0'; str++) if (*str == '\n') { fputs ("\\n\"", stream); if (str[1] == '\0') return; fputs ("\n\"", stream); } else { if (*str == '"' || *str == '\\') putc ('\\', stream); putc (*str, stream); } putc ('"', stream); } /* Add to the log file an entry denoting a failed translation. */ void _nl_log_untranslated (const char *logfilename, const char *domainname, const char *msgid1, const char *msgid2, int plural) { static char *last_logfilename = NULL; static FILE *last_logfile = NULL; FILE *logfile; /* Can we reuse the last opened logfile? */ if (last_logfilename == NULL || strcmp (logfilename, last_logfilename) != 0) { /* Close the last used logfile. */ if (last_logfilename != NULL) { if (last_logfile != NULL) { fclose (last_logfile); last_logfile = NULL; } free (last_logfilename); last_logfilename = NULL; } /* Open the logfile. */ last_logfilename = (char *) malloc (strlen (logfilename) + 1); if (last_logfilename == NULL) return; strcpy (last_logfilename, logfilename); last_logfile = fopen (logfilename, "a"); if (last_logfile == NULL) return; } logfile = last_logfile; fprintf (logfile, "domain "); print_escaped (logfile, domainname); fprintf (logfile, "\nmsgid "); print_escaped (logfile, msgid1); if (plural) { fprintf (logfile, "\nmsgid_plural "); print_escaped (logfile, msgid2); fprintf (logfile, "\nmsgstr[0] \"\"\n"); } else fprintf (logfile, "\nmsgstr \"\"\n"); putc ('\n', logfile); }
// // UIView+JHFrameConvenince.h // ็™พๆ€ไธๅพ—ๅง // // Created by ๆŽๅปบ่ฏ on 16/3/24. // Copyright ยฉ 2016ๅนด lijianhua. All rights reserved. // #import <UIKit/UIKit.h> @interface UIView (JHFrameConvenince) @property(nonatomic, assign)CGFloat width; @property(nonatomic, assign)CGFloat height; @property(nonatomic, assign)CGFloat x; @property(nonatomic, assign)CGFloat y; @property(nonatomic, assign)CGSize size; @property(nonatomic, assign)CGPoint origin; @property(nonatomic, assign)CGFloat centerX; @property(nonatomic, assign)CGFloat centerY; /** * ๅˆคๆ–ญๆ˜ฏๅฆๆญฃๅœจ่ขซไธป็ช—ๅฃ่Œƒๅ›ดๆ˜พ็คบ */ @property(nonatomic, assign, readonly, getter=isShowingInKeyWindow)BOOL showingInKeyWindow; /** * ไปŽxibไธญๅŠ ่ฝฝ่ง†ๅ›พ */ + (instancetype)loadViewFromXib; @end
// // AnnotationXMLParser.h // Annotation // // Created by Adam Fouse on 6/22/09. // Copyright 2009 __MyCompanyName__. All rights reserved. // #import <Cocoa/Cocoa.h> @class Annotation; @class AnnotationDocument; @interface AnnotationXMLParser : NSObject { NSXMLDocument *xmlDoc; NSXMLNode *annotationsRoot; AnnotationDocument *annotationDoc; NSOperationQueue *xmlOperationsQueue; NSDateFormatter *dateFormatter; NSDateFormatter *altDateFormatter; NSMutableArray *annotations; BOOL updateAnnotations; } @property BOOL updateAnnotations; - (id)init; -(id)initForDocument:(AnnotationDocument*)doc; - (id)initWithFile:(NSString *)file forDocument:(AnnotationDocument*)doc; - (void)addAnnotation:(Annotation *)annotation; - (void)removeAnnotation:(Annotation *)annotation; - (void)updateAnnotation:(Annotation *)annotation; - (NSArray*)annotations; - (NSXMLElement*)createAnnotationElement:(Annotation *)annotation; - (void)setup; - (NSDateFormatter*)dateFormatter; - (void)writeToFile:(NSString *)fileName; - (void)writeToFile:(NSString *)filename waitUntilDone:(BOOL)wait; @end
/* * ENSICAEN * 6 Boulevard Marรฉchal Juin * F-14050 Caen Cedex * * Unix System Programming Examples / Exemplier de programmation systรจme Unix * Chapter "Interprocess communication" / Chapitre "Communication interprocessus" * * Copyright (C) 1995-2016 Alain Lebret (alain.lebret@ensicaen.fr) * * 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. */ /** * @author Alain Lebret (2011) * @author Janet Davis (2006) * @author Henry Walker (2004) * @version 1.3 * @date 2011-12-01 */ /** * @file mmap_buffer_02.c * * Producer-consumer program using a shared memory that stores a buffer of * integers. This code is based on the example presented by: Janet Davis (2006) * and Henry Walker (2004). */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> /* wait() */ #include <sys/wait.h> /* wait() */ #include <sys/mman.h> #define INTEGER_SIZE sizeof(int) #define BUFFER_SIZE 5 #define MEMORY_SIZE (BUFFER_SIZE+2)*INTEGER_SIZE #define ITERATIONS 10 /** * Handles a fatal error. It displays a message, then exits. */ void handle_fatal_error(char *message) { fprintf(stderr, "%s", message); exit(EXIT_FAILURE); } /** * Writes the square of a serie of integers onto the shared memory. */ void write_memory(int *buffer, int *begin, int *end) { int i; for (i = 0; i < ITERATIONS; i++) { while ((*begin + 1) % BUFFER_SIZE == *end); buffer[*begin] = i * i; *begin = (*begin + 1) % BUFFER_SIZE; printf("Parent: initial value %2d before writing in the buffer\n", i); } } /** * Manages the parent process. It writes data to the shared memory and waits * for his child to finish. */ void manage_parent(int *buffer, int *begin, int *end) { pid_t child; int status; printf("Parent process (PID %d)\n", getpid()); write_memory(buffer, begin, end); printf("Parent: end of production.\n"); child = wait(&status); if (WIFEXITED(status)) { printf("Parent: child %d has finished (code %d)\n", child, WEXITSTATUS(status)); } } /** * Reads a serie of integers from the shared memory and displays them. */ void read_memory(int *buffer, int *in, int *out) { int i; int value; for (i = 0; i < ITERATIONS; i++) { sleep(1); /* waiting for the memory update (not as good as semaphore) */ while (*in == *out); value = buffer[*out]; *out = (*out + 1) % BUFFER_SIZE; printf("Child: element %2d == %2d read from the buffer.\n", i, value); } } /** * Manages the child process that reads all data from shared memory. */ void manage_child(int *buffer, int *in, int *out) { printf("Child process (PID %d)\n", getpid()); read_memory(buffer, in, out); printf("Child: memory has been consumed.\n"); } /** * Creates and initializes a new shared memory using mmap. * @return Pointer on the shared memory */ void *create_shared_memory() { /* initialize shared memory using mmap */ void *shared_memory = mmap(0, /* beginning (starting address is ignored) */ MEMORY_SIZE, /* size of the shared memory */ PROT_READ | PROT_WRITE, /* protection */ MAP_SHARED | MAP_ANONYMOUS, -1, /* the shared memory do not use a file */ 0); /* ignored: set when using a file */ if (shared_memory == (void *) -1) { handle_fatal_error("Error allocating shared memory using mmap!\n"); } return shared_memory; } int main(void) { pid_t pid; void *shared_memory; /* shared memory base address */ int *buffer; /* logical base address for buffer */ int *in; /* pointer to logical 'in' address for producer */ int *out; /* pointer to logical 'out' address for consumer */ shared_memory = create_shared_memory(); /* The segment of shared memory is organised as: * 0 n-1 n n+1 * ---------------------------------------------------------------- * | | | | * ---------------------------------------------------------------- * ^ ^ ^ * buffer in out */ buffer = (int *) shared_memory; in = (int *) shared_memory + BUFFER_SIZE * INTEGER_SIZE; out = (int *) shared_memory + (BUFFER_SIZE + 1) * INTEGER_SIZE; *in = *out = 0; /* starting index */ if (-1 == (pid = fork())) { handle_fatal_error("Error using fork()\n"); } if (0 == pid) { manage_child(buffer, in, out); } else { manage_parent(buffer, in, out); } exit(EXIT_SUCCESS); }
/*D************************************************************ * Modul: GRAPHIC gbook.c * * Booking operations: book many DLTs, book one DLT * * * * Copyright: yafra.org, Basel, Switzerland ************************************************************** */ #include <uinclude.h> #include <ginclude.h> static char rcsid[]="$Header: /yafra/cvsroot/mapo/source/gui/gbook.c,v 1.2 2008-11-02 19:55:44 mwn Exp $"; void xGRbook(XEvent *event, int tog) { extern Display *display; extern GRAWIDGETS grawidgets; extern GRAWINDOWS grawindows; extern long anzregObj; extern REGOBJ *regObj; extern GRAGLOB graglob; REGOBJ *region, *reg; XmString eintrag; long aktnummer, i, oldnum; int x, y; unsigned int width, height; unsigned int dummy; Window root; Arg args[2]; /*--- Check if booking is possible ---------*/ aktnummer = xGRfind_region_koord(event->xbutton.x, event->xbutton.y); if (aktnummer == NOVATER) { xUIbeep(grawidgets.shell, 0, 0, 0); return; } /*--- Find aktuelle Pointerregion -----*/ region = &regObj[aktnummer]; if (graglob.bookingMode == XGRBOOK_MANY) { /*--- many in list booking ---------------------------------------*/ eintrag = xGRregion_name( region, 0); if (!XmListItemExists(grawidgets.booking, eintrag)) { XGetGeometry(display, XtWindow(grawidgets.scrolledgraphik), &root, &x, &y, &width, &height, &dummy, &dummy); XtSetArg(args[0], XmNwidth, width); XtSetArg(args[1], XmNheight, height); XtSetValues(grawidgets.scrolledgraphik, args, 2); /*--- list ---*/ XmListAddItem(grawidgets.booking, eintrag, 0); } XmStringFree(eintrag); region->temp = True; } else /*------ single booking -------------------------------------*/ { /*--- Reset all booked regions ---*/ xGRbook_temp_reset(); /*--- book new -------------------*/ region->temp = True; } XClearArea(display, grawindows.graphik, 0, 0, 0, 0, True); } void xGRshowbook(XEvent *event, int tog) { extern Display *display; extern GRAWIDGETS grawidgets; extern GRAWINDOWS grawindows; extern long anzregObj; extern REGOBJ *regObj; extern GRAGLOB graglob; extern char *outcomm; extern int aktmenuz; extern int aktmenuobj[]; extern int aktfield[]; BOOKMENU *b; REGOBJ *region, *reg; XmString eintrag; XmString xmstring; String string; char *ptr; long aktnummer, i, oldnum; int x, y; int len; unsigned int width, height; unsigned int dummy; Window root; Arg args[2]; /*--- Check if booking is possible ---------*/ aktnummer = xGRfind_region_koord(event->xbutton.x, event->xbutton.y); if (aktnummer == NOVATER) { xUIbeep(grawidgets.shell, 0, 0, 0); return; } /*--- inits ----*/ ptr = outcomm; *ptr = '\0'; /*--- Find aktuelle Pointerregion -----*/ region = &regObj[aktnummer]; /*--- Reset all booked regions ---*/ xGRbook_temp_reset(); /*--- book new -------------------*/ region->temp = True; XClearArea(display, grawindows.graphik, 0, 0, 0, 0, True); xmstring = xGRregion_name( region, 0); XmStringGetLtoR( xmstring, XmSTRING_DEFAULT_CHARSET, &string); strcpy(ptr, string); XtFree((void *)string); /*--- get BM menu ----*/ b = xBMmenuActive(); if (b) MENUNR = (unsigned char) _RESERVATION; /* bm_ix is _BMCATIX */ else MENUNR = (unsigned char)aktmenuobj[aktmenuz]; /*--- Send to DB --------------*/ len = strlen(outcomm); COMMTYP = GRACHOOSE; ACTIONTYP = GRASHOWINFO; FELDNR = (unsigned char)aktfield[aktmenuz]; (void)xUItalkto(SEND, outcomm, len); } /*F-------------------------------------------------------------------------- * Function: xGRbook_one () * -call specialized function for booking * - * *--------------------------------------------------------------------------- */ XtActionProc xGRbook_one( Widget w, XEvent* event, String* s, Cardinal* m) { extern GRAGLOB graglob; extern Boolean zoomingflag; /*--- Inhibit during zooming operations ---*/ if (zoomingflag) return; if (graglob.mode == XGRSELGRAFIC) xGRbook(event, 0); else if (graglob.mode == XGRSHOWGRAFIC) xGRshowbook(event, 0); } /*F-------------------------------------------------------------------------- * Function: xGRbook_andquit () * -single booking is done in one shot: select and quit * -(First click has already selected the region) * *--------------------------------------------------------------------------- */ XtActionProc xGRbook_andquit( Widget w, XEvent* event, String* s, Cardinal* m) { extern GRAWIDGETS grawidgets; extern GRAGLOB graglob; extern Boolean zoomingflag; /*--- Inhibit during zooming operations ---*/ if (zoomingflag) return; if (graglob.mode == XGRSELGRAFIC) xGRquit( grawidgets.shell, 0, 0); } /*F-------------------------------------------------------------------------- * Function: xGRbook_clear () * -reset and forget the booked regions * - * *--------------------------------------------------------------------------- */ XtActionProc xGRbook_clear( Widget w, XEvent* event, String* s, Cardinal* m) { extern Display *display; extern GRAWINDOWS grawindows; extern GRAGLOB graglob; extern Boolean zoomingflag; /*--- Inhibit during zooming operations ---*/ if (zoomingflag) return; if ((graglob.bookingMode == XGRBOOK_ONE) && (graglob.mode == XGRSELGRAFIC)) { xGRbook_temp_reset(); XClearArea(display, grawindows.graphik, 0, 0, 0, 0, True); } } /*F-------------------------------------------------------------------------- * Function: xGRbook_temp_reset () * -clear temporary-booked flag of all regions * - * *--------------------------------------------------------------------------- */ void xGRbook_temp_reset() { extern long anzregObj; extern REGOBJ *regObj; REGOBJ *reg; long i; /*--- Reset all booked regions and keep index ---*/ for (i=0; i<anzregObj; i++) { reg = &regObj[i]; reg->temp = False; } }
/** * HomeworkAssignmentTwo APSHTTPClient Library * Copyright (c) 2009-2015 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. * * WARNING: This is generated code. Modify at your own risk and without support. */ #import <Foundation/Foundation.h> @interface APSHTTPPostForm : NSObject @property(nonatomic, readonly) NSData *requestData; @property(nonatomic, readonly) NSDictionary *requestHeaders; @property(nonatomic, readonly) NSString *contentType; -(void)setJSONData:(id)json; -(void)setStringData:(NSString*)str; -(void)appendData:(NSData*)data withContentType:(NSString*)contentType; -(void)addDictionay:(NSDictionary*)dict; -(void)addFormKey:(NSString*)key andValue:(NSString*)value; -(void)addFormFile:(NSString*)path; -(void)addFormFile:(NSString*)path fieldName:(NSString*)name; -(void)addFormFile:(NSString*)path fieldName:(NSString*)name contentType:(NSString*)contentType; -(void)addFormData:(NSData*)data; -(void)addFormData:(NSData*)data fileName:(NSString*)fileName; -(void)addFormData:(NSData*)data fileName:(NSString*)fileName fieldName:(NSString*)fieldName; -(void)addFormData:(NSData*)data fileName:(NSString*)fileName fieldName:(NSString*)fieldName contentType:(NSString*)contentType; -(void)addHeaderKey:(NSString*)key andHeaderValue:(NSString*)value; @end
/* * Copyright 2016 The Cartographer Authors * * 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 CARTOGRAPHER_MAPPING_2D_SCAN_MATCHING_OCCUPIED_SPACE_COST_FUNCTOR_H_ #define CARTOGRAPHER_MAPPING_2D_SCAN_MATCHING_OCCUPIED_SPACE_COST_FUNCTOR_H_ #include "Eigen/Core" #include "Eigen/Geometry" #include "cartographer/mapping_2d/probability_grid.h" #include "cartographer/sensor/point_cloud.h" #include "ceres/ceres.h" #include "ceres/cubic_interpolation.h" namespace cartographer { namespace mapping_2d { namespace scan_matching { // Computes the cost of inserting occupied space described by the point cloud // into the map. The cost increases with the amount of free space that would be // replaced by occupied space. class OccupiedSpaceCostFunctor { public: // Creates an OccupiedSpaceCostFunctor using the specified map, resolution // level, and point cloud. OccupiedSpaceCostFunctor(const double scaling_factor, const sensor::PointCloud& point_cloud, const ProbabilityGrid& probability_grid) : scaling_factor_(scaling_factor), point_cloud_(point_cloud), probability_grid_(probability_grid) {} OccupiedSpaceCostFunctor(const OccupiedSpaceCostFunctor&) = delete; OccupiedSpaceCostFunctor& operator=(const OccupiedSpaceCostFunctor&) = delete; template <typename T> bool operator()(const T* const pose, T* residual) const { Eigen::Matrix<T, 2, 1> translation(pose[0], pose[1]); Eigen::Rotation2D<T> rotation(pose[2]); Eigen::Matrix<T, 2, 2> rotation_matrix = rotation.toRotationMatrix(); Eigen::Matrix<T, 3, 3> transform; transform << rotation_matrix, translation, T(0.), T(0.), T(1.); const GridArrayAdapter adapter(probability_grid_); ceres::BiCubicInterpolator<GridArrayAdapter> interpolator(adapter); const MapLimits& limits = probability_grid_.limits(); for (size_t i = 0; i < point_cloud_.size(); ++i) { // Note that this is a 2D point. The third component is a scaling factor. const Eigen::Matrix<T, 3, 1> point((T(point_cloud_[i].x())), (T(point_cloud_[i].y())), T(1.)); const Eigen::Matrix<T, 3, 1> world = transform * point; interpolator.Evaluate( (limits.max().x() - world[0]) / limits.resolution() - 0.5 + T(kPadding), (limits.max().y() - world[1]) / limits.resolution() - 0.5 + T(kPadding), &residual[i]); residual[i] = scaling_factor_ * (1. - residual[i]); } return true; } private: static constexpr int kPadding = INT_MAX / 4; class GridArrayAdapter { public: enum { DATA_DIMENSION = 1 }; explicit GridArrayAdapter(const ProbabilityGrid& probability_grid) : probability_grid_(probability_grid) {} void GetValue(const int row, const int column, double* const value) const { if (row < kPadding || column < kPadding || row >= NumRows() - kPadding || column >= NumCols() - kPadding) { *value = mapping::kMinProbability; } else { *value = static_cast<double>(probability_grid_.GetProbability( Eigen::Array2i(column - kPadding, row - kPadding))); } } int NumRows() const { return probability_grid_.limits().cell_limits().num_y_cells + 2 * kPadding; } int NumCols() const { return probability_grid_.limits().cell_limits().num_x_cells + 2 * kPadding; } private: const ProbabilityGrid& probability_grid_; }; const double scaling_factor_; const sensor::PointCloud& point_cloud_; const ProbabilityGrid& probability_grid_; }; } // namespace scan_matching } // namespace mapping_2d } // namespace cartographer #endif // CARTOGRAPHER_MAPPING_2D_SCAN_MATCHING_OCCUPIED_SPACE_COST_FUNCTOR_H_
// // YWMessageFriendsAddViewController.h // YuWa // // Created by ่’‹ๅจ on 16/9/29. // Copyright ยฉ 2016ๅนด ่’‹ๅจ. All rights reserved. // #import "JWBasicViewController.h" @interface YWMessageFriendsAddViewController : JWBasicViewController @end
/* * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. */ #ifndef vnsw_agent_uve_base_h #define vnsw_agent_uve_base_h #include <sandesh/sandesh_types.h> #include <sandesh/sandesh.h> #include "nodeinfo_types.h" #include <base/connection_info.h> #include <uve/vn_uve_table_base.h> #include <uve/vm_uve_table_base.h> #include <uve/vrouter_uve_entry_base.h> #include <uve/prouter_uve_table.h> #include <uve/interface_uve_table.h> #include <boost/scoped_ptr.hpp> class VrouterStatsCollector; //The class to drive UVE module initialization for agent. //Defines objects required for statistics collection from vrouter and //objects required for sending UVE information to collector. class AgentUveBase { public: /* Number of UVEs to be sent each time, the timer callback is Run */ static const uint32_t kUveCountPerTimer = 64; /* The interval at which timer is fired */ static const uint32_t kDefaultInterval = (30 * 1000); // time in millisecs /* When timer is Run, we send atmost 'kUveCountPerTimer' UVEs. If there * are more UVEs to be sent, we reschedule timer at the following shorter * interval*/ static const uint32_t kIncrementalInterval = (1000); // time in millisecs static const uint64_t kBandwidthInterval = (1000000); // time in microseconds AgentUveBase(Agent *agent, uint64_t intvl, uint32_t default_intvl, uint32_t incremental_intvl); virtual ~AgentUveBase(); virtual void Shutdown(); uint64_t bandwidth_intvl() const { return bandwidth_intvl_; } VnUveTableBase* vn_uve_table() const { return vn_uve_table_.get(); } VmUveTableBase* vm_uve_table() const { return vm_uve_table_.get(); } Agent* agent() const { return agent_; } VrouterUveEntryBase* vrouter_uve_entry() const { return vrouter_uve_entry_.get(); } ProuterUveTable* prouter_uve_table() const { return prouter_uve_table_.get(); } InterfaceUveTable* interface_uve_table() const { return interface_uve_table_.get(); } VrouterStatsCollector *vrouter_stats_collector() const { return vrouter_stats_collector_.get(); } void Init(); virtual void InitDone() {} virtual void RegisterDBClients(); static AgentUveBase *GetInstance() {return singleton_;} uint8_t ExpectedConnections(uint8_t &num_c_nodes, uint8_t &num_d_servers); uint32_t default_interval() const { return default_interval_; } uint32_t incremental_interval() const { return incremental_interval_; } protected: boost::scoped_ptr<VnUveTableBase> vn_uve_table_; boost::scoped_ptr<VmUveTableBase> vm_uve_table_; boost::scoped_ptr<VrouterUveEntryBase> vrouter_uve_entry_; boost::scoped_ptr<ProuterUveTable> prouter_uve_table_; boost::scoped_ptr<InterfaceUveTable> interface_uve_table_; uint32_t default_interval_; uint32_t incremental_interval_; static AgentUveBase *singleton_; private: friend class UveTest; void VrouterAgentProcessState( const std::vector<process::ConnectionInfo> &c, process::ProcessState::type &state, std::string &message); void UpdateMessage(const process::ConnectionInfo &info, std::string &message); Agent *agent_; uint64_t bandwidth_intvl_; //in microseconds process::ConnectionStateManager *connection_state_manager_; DISALLOW_COPY_AND_ASSIGN(AgentUveBase); protected: boost::scoped_ptr<VrouterStatsCollector> vrouter_stats_collector_; }; #endif //vnsw_agent_uve_base_h
/* * author: Thomas Yao */ #ifndef _WCHAR_LIST_H_ #define _WCHAR_LIST_H_ #include <wchar.h> struct _wchar_list_node { struct _wchar_list_node* next; struct _wchar_list_node* prev; wchar_t* data; int index; }; struct _wchar_list { struct _wchar_list_node* curr; int size; }; struct _wchar_list* wchar_list_initial(); void wchar_list_add(struct _wchar_list* _s, wchar_t* _data); struct _wchar_list* wchar_list_initial_by_array(wchar_t* _array[], int _size); void wchar_list_rm_curr(struct _wchar_list* _s); wchar_t* wchar_list_get_index(struct _wchar_list* s, int _index); void wchar_list_destory(struct _wchar_list* _s); void wchar_list_rmall_by_data(struct _wchar_list* _s, wchar_t* _data); void wchar_list_print(struct _wchar_list* _s); #endif
#ifndef __SDHASH_THREADS_H #define __SDHASH_THREADS_H void *thread_sdbf_hashfile( void *task_param) ; void sdbf_hash_files( char **filenames, uint32_t file_count, int32_t thread_cnt, sdbf_set *addto); sdbf_set *sdbf_hash_stdin( ); void sdbf_hash_files_dd( char **filenames, uint32_t file_count, uint32_t dd_block_size, uint64_t chunk_size, sdbf_set *addto) ; #endif
// // PayTool.h // DingYouMing // // Created by ceyu on 2017/3/8. // Copyright ยฉ 2017ๅนด ๅดๅฎไฝณ. All rights reserved. // #import <UIKit/UIKit.h> #import "PayParamObj.h" @protocol PayToolDelegate <NSObject> @optional -(void)payResultWithErrorCode:(NSInteger)errorCode withErrorInfo:(NSString *)errorInfo withObject:(id)object;// -(void)payBeginWithObject:(id)object;// @end @interface PayTool : NSObject /**ไปฃ็†*/ @property (weak, nonatomic) id<PayToolDelegate> delegate; @property (strong, nonatomic) id object; +(instancetype)sharePayTool; -(void)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options; -(void)aliPayAction:(PayParamObj*)param; -(void)wePayAction:(PayParamObj*)param; ///ๆ”ฏไป˜็กฎ่ฎค็ป“ๆžœ -(void)payVerifyResults; @end
/* * Copyright 2017 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #include <s2n.h> #include "error/s2n_errno.h" #include "tls/s2n_client_extensions.h" #include "tls/s2n_cipher_suites.h" #include "tls/s2n_connection.h" #include "tls/s2n_config.h" #include "tls/s2n_tls.h" #include "stuffer/s2n_stuffer.h" #include "utils/s2n_safety.h" int s2n_client_cert_verify_recv(struct s2n_connection *conn) { struct s2n_stuffer *in = &conn->handshake.io; s2n_hash_algorithm chosen_hash_alg = S2N_HASH_MD5_SHA1; s2n_signature_algorithm chosen_signature_alg = S2N_SIGNATURE_RSA; if(conn->actual_protocol_version == S2N_TLS12){ int pairs_available = 1; /* Make sure the client is actually using one of the {sig,hash} pairs that we sent in the ClientCertificateRequest */ GUARD(s2n_choose_preferred_signature_hash_pair(in, pairs_available, &chosen_hash_alg, &chosen_signature_alg)); } uint16_t signature_size; struct s2n_blob signature; GUARD(s2n_stuffer_read_uint16(in, &signature_size)); signature.size = signature_size; signature.data = s2n_stuffer_raw_read(in, signature.size); notnull_check(signature.data); struct s2n_hash_state hash_state; GUARD(s2n_handshake_get_hash_state(conn, chosen_hash_alg, &hash_state)); switch (chosen_signature_alg) { /* s2n currently only supports RSA Signatures */ case S2N_SIGNATURE_RSA: GUARD(s2n_pkey_verify(&conn->secure.client_public_key, &hash_state, &signature)); break; default: S2N_ERROR(S2N_ERR_INVALID_SIGNATURE_ALGORITHM); } /* Client certificate has been verified. Minimize required handshake hash algs */ GUARD(s2n_conn_update_required_handshake_hashes(conn)); return 0; } int s2n_client_cert_verify_send(struct s2n_connection *conn) { struct s2n_stuffer *out = &conn->handshake.io; s2n_hash_algorithm chosen_hash_alg = S2N_HASH_MD5_SHA1; s2n_signature_algorithm chosen_signature_alg = S2N_SIGNATURE_RSA; if(conn->actual_protocol_version == S2N_TLS12){ chosen_hash_alg = conn->secure.client_cert_hash_algorithm; chosen_signature_alg = conn->secure.client_cert_sig_alg; GUARD(s2n_stuffer_write_uint8(out, (uint8_t) chosen_hash_alg)); GUARD(s2n_stuffer_write_uint8(out, (uint8_t) chosen_signature_alg)); } struct s2n_hash_state hash_state; GUARD(s2n_handshake_get_hash_state(conn, chosen_hash_alg, &hash_state)); struct s2n_blob signature; switch (chosen_signature_alg) { /* s2n currently only supports RSA Signatures */ case S2N_SIGNATURE_RSA: signature.size = s2n_rsa_private_encrypted_size(&conn->config->cert_and_key_pairs->private_key.key.rsa_key); GUARD(s2n_stuffer_write_uint16(out, signature.size)); signature.data = s2n_stuffer_raw_write(out, signature.size); notnull_check(signature.data); GUARD(s2n_pkey_sign(&conn->config->cert_and_key_pairs->private_key, &hash_state, &signature)); break; default: S2N_ERROR(S2N_ERR_INVALID_SIGNATURE_ALGORITHM); } /* Client certificate has been verified. Minimize required handshake hash algs */ GUARD(s2n_conn_update_required_handshake_hashes(conn)); return 0; }
/** * @license Apache-2.0 * * Copyright (c) 2020 The Stdlib Authors. * * 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. */ #include "stdlib/stats/base/dnanmaxabs.h" #include <stdint.h> #include <stdio.h> int main() { // Create a strided array: double x[] = { 1.0, -2.0, -3.0, 4.0, -5.0, -6.0, 7.0, 8.0, 0.0/0.0, 0.0/0.0 }; // Specify the number of elements: int64_t N = 5; // Specify the stride length: int64_t stride = 2; // Compute the maximum absolute value: double v = stdlib_strided_dnanmaxabs( N, x, stride ); // Print the result: printf( "maxabs: %lf\n", v ); }
/*========================================================================= Program: Bender Copyright (c) Kitware Inc. 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.txt 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. This file was originally developed by Yuanxin Liu, Kitware Inc. =========================================================================*/ #ifndef __Armature_h #define __Armature_h // ITK includes #include <itkImage.h> // VTK includes class vtkPolyData; // STD includes #include <vector> typedef unsigned char CharType; typedef unsigned short LabelType; typedef unsigned int EdgeType; typedef float WeightImagePixel; typedef itk::Image<LabelType, 3> LabelImageType; typedef itk::Image<CharType, 3> CharImageType; typedef itk::Image<WeightImagePixel, 3> WeightImage; typedef itk::Index<3> Voxel; typedef itk::Offset<3> VoxelOffsetType; typedef itk::ImageRegion<3> RegionType; //------------------------------------------------------------------------------- template<unsigned int dimension> class Neighborhood { public: Neighborhood() { for(unsigned int i=0; i<dimension; ++i) { int lo = 2*i; int hi = 2*i+1; for(unsigned int j=0; j<dimension; ++j) { this->Offsets[lo][j] = j==i? -1 : 0; this->Offsets[hi][j] = j==i? 1 : 0; } } } itk::Offset<dimension> Offsets[2*dimension]; }; //------------------------------------------------------------------------------- class ArmatureType { public: // Enums the types of label used enum LabelTypes { BackgroundLabel = 0, DomainLabel, EdgeLabels }; // Typedefs: // Pixels: typedef unsigned char CharType; typedef unsigned short LabelType; typedef unsigned int EdgeType; typedef float WeightImagePixel; // Images: typedef itk::Image<LabelType, 3> LabelImageType; typedef itk::Image<CharType, 3> CharImageType; typedef itk::Image<WeightImagePixel, 3> WeightImage; // Others: typedef itk::Index<3> VoxelType; typedef itk::Offset<3> VoxelOffsetType; typedef itk::ImageRegion<3> RegionType; // Constructor ArmatureType(LabelImageType::Pointer image); // Label functions: CharType GetEdgeLabel(EdgeType edgeId) const; CharType GetMaxEdgeLabel() const; size_t GetNumberOfEdges() const; // Set/Get dump debug information void SetDebug(bool); bool GetDebug()const; // Create the body partition from the armature. // Return success/failure. bool InitSkeleton(vtkPolyData* armaturePolyData); // Get body/bones partition. // Should be called after Init() otherwise this will return empty volumes. LabelImageType::Pointer GetBodyPartition(); protected: LabelImageType::Pointer BodyMap; // Reference on the input volume LabelImageType::Pointer BodyPartition; //the partition of body by armature edges std::vector<std::vector<Voxel> > SkeletonVoxels; std::vector<CharImageType::Pointer> Domains; std::vector<Voxel> Fixed; std::vector<WeightImage::Pointer> Weights; bool InitBones(); bool Debug; }; #endif
/** * Appcelerator Titanium Mobile * Copyright (c) 2009-2011 by IndiaMap, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. * * WARNING: This is generated code. Modify at your own risk and without support. */ #ifdef USE_TI_FACEBOOK #import "TiModule.h" #import "Facebook.h" @protocol TiFacebookStateListener @required -(void)login; -(void)logout; @end @interface FacebookModule : TiModule <FBSessionDelegate2, FBRequestDelegate2> { Facebook *facebook; BOOL loggedIn; NSString *uid; NSString *url; NSString *appid; NSArray *permissions; NSMutableArray *stateListeners; BOOL forceDialogAuth; } @property(nonatomic,readonly) Facebook *facebook; @property(nonatomic,readonly) NSNumber *BUTTON_STYLE_NORMAL; @property(nonatomic,readonly) NSNumber *BUTTON_STYLE_WIDE; -(BOOL)isLoggedIn; -(void)addListener:(id<TiFacebookStateListener>)listener; -(void)removeListener:(id<TiFacebookStateListener>)listener; -(void)authorize:(id)args; -(void)logout:(id)args; @end #endif
/* * Copyright 2018 OpenCensus Authors * * 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 PHP_VARINT_H #define PHP_VARINT_H 1 #include <stddef.h> size_t uvarint_encode(char *buf, size_t len, unsigned long long x); size_t varint_encode(char *buf, size_t len, long long x); size_t uvarint_decode(char *buf, size_t len, unsigned long long *x); size_t varint_decode(char *buf, size_t len, long long *x); #endif /* PHP_VARINT_H */
๏ปฟ/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/kinesisanalyticsv2/KinesisAnalyticsV2_EXPORTS.h> #include <aws/kinesisanalyticsv2/model/S3ContentBaseLocationUpdate.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace KinesisAnalyticsV2 { namespace Model { /** * <p>Updates to the configuration information required to deploy an Amazon Data * Analytics Studio notebook as an application with durable state..</p><p><h3>See * Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/kinesisanalyticsv2-2018-05-23/DeployAsApplicationConfigurationUpdate">AWS * API Reference</a></p> */ class AWS_KINESISANALYTICSV2_API DeployAsApplicationConfigurationUpdate { public: DeployAsApplicationConfigurationUpdate(); DeployAsApplicationConfigurationUpdate(Aws::Utils::Json::JsonView jsonValue); DeployAsApplicationConfigurationUpdate& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>Updates to the location that holds the data required to specify an Amazon * Data Analytics application.</p> */ inline const S3ContentBaseLocationUpdate& GetS3ContentLocationUpdate() const{ return m_s3ContentLocationUpdate; } /** * <p>Updates to the location that holds the data required to specify an Amazon * Data Analytics application.</p> */ inline bool S3ContentLocationUpdateHasBeenSet() const { return m_s3ContentLocationUpdateHasBeenSet; } /** * <p>Updates to the location that holds the data required to specify an Amazon * Data Analytics application.</p> */ inline void SetS3ContentLocationUpdate(const S3ContentBaseLocationUpdate& value) { m_s3ContentLocationUpdateHasBeenSet = true; m_s3ContentLocationUpdate = value; } /** * <p>Updates to the location that holds the data required to specify an Amazon * Data Analytics application.</p> */ inline void SetS3ContentLocationUpdate(S3ContentBaseLocationUpdate&& value) { m_s3ContentLocationUpdateHasBeenSet = true; m_s3ContentLocationUpdate = std::move(value); } /** * <p>Updates to the location that holds the data required to specify an Amazon * Data Analytics application.</p> */ inline DeployAsApplicationConfigurationUpdate& WithS3ContentLocationUpdate(const S3ContentBaseLocationUpdate& value) { SetS3ContentLocationUpdate(value); return *this;} /** * <p>Updates to the location that holds the data required to specify an Amazon * Data Analytics application.</p> */ inline DeployAsApplicationConfigurationUpdate& WithS3ContentLocationUpdate(S3ContentBaseLocationUpdate&& value) { SetS3ContentLocationUpdate(std::move(value)); return *this;} private: S3ContentBaseLocationUpdate m_s3ContentLocationUpdate; bool m_s3ContentLocationUpdateHasBeenSet; }; } // namespace Model } // namespace KinesisAnalyticsV2 } // namespace Aws
/** * Copyright 2015-2016 Kakao Corp. * * 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. */ #import "KOSessionTask.h" #import "KOTalkProfile.h" #import "KOChatContext.h" #import "KOUser.h" #import "KOChat.h" #import "KOFriend.h" /*! @header KOSessionTask+TalkAPI.h ์ธ์ฆ๋œ session ์ •๋ณด๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๊ฐ์ข… ์นด์นด์˜คํ†ก API๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. */ /*! @abstract KOTalkMessageReceiverType @constant KOTalkMessageReceiverTypeUser @constant KOTalkMessageReceiverTypeFriend @constant KOTalkMessageReceiverTypeChat */ typedef NS_ENUM(NSInteger, KOTalkMessageReceiverType) { KOTalkMessageReceiverTypeUser = 0, KOTalkMessageReceiverTypeFriend, KOTalkMessageReceiverTypeChat }; /*! ์ธ์ฆ๋œ session ์ •๋ณด๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๊ฐ์ข… ์นด์นด์˜คํ†ก API๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. */ @interface KOSessionTask (TalkAPI) #pragma mark - KakaoTalk /*! @abstract ํ˜„์žฌ ๋กœ๊ทธ์ธ๋œ ์‚ฌ์šฉ์ž์˜ ์นด์นด์˜คํ†ก ํ”„๋กœํ•„ ์ •๋ณด๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. @param completionHandler ์นด์นด์˜คํ†ก ํ”„๋กœํ•„ ์ •๋ณด๋ฅผ ์–ป์–ด ์ฒ˜๋ฆฌํ•˜๋Š” ํ•ธ๋“ค๋Ÿฌ */ + (instancetype)talkProfileTaskWithCompletionHandler:(KOSessionTaskCompletionHandler)completionHandler; /*! @abstract ํ˜„์žฌ ๋กœ๊ทธ์ธ๋œ ์‚ฌ์šฉ์ž์˜ ์นด์นด์˜คํ†ก ํ”„๋กœํ•„ ์ •๋ณด๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. @param secureResource ํ”„๋กœํ•„, ์ธ๋„ค์ผ ์ด๋ฏธ์ง€ ๋“ฑ์˜ ๋ฆฌ์†Œ์Šค ์ •๋ณด๋“ค์— ๋Œ€ํ•ด https๋ฅผ ์ง€์›ํ•˜๋Š” ํ˜•์‹์œผ๋กœ ์‘๋‹ต์„ ๋ฐ›์„์ง€์˜ ์—ฌ๋ถ€. YES์ผ ๊ฒฝ์šฐ https์ง€์›, NO์ผ ๊ฒฝ์šฐ http์ง€์›. @param completionHandler ์นด์นด์˜คํ†ก ํ”„๋กœํ•„ ์ •๋ณด๋ฅผ ์–ป์–ด ์ฒ˜๋ฆฌํ•˜๋Š” ํ•ธ๋“ค๋Ÿฌ */ + (instancetype)talkProfileTaskWithSecureResource:(BOOL)secureResource completionHandler:(KOSessionTaskCompletionHandler)completionHandler; /*! @abstract ๋ฏธ๋ฆฌ ์ง€์ •๋œ Template Message๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ, ์นด์นด์˜คํ†ก์œผ๋กœ ๋ฉ”์‹œ์ง€๋ฅผ ์ „์†กํ•ฉ๋‹ˆ๋‹ค. ์ œํœด๋ฅผ ํ†ตํ•ด ๊ถŒํ•œ์ด ๋ถ€์—ฌ๋œ ํŠน์ • ์•ฑ์—์„œ๋งŒ ํ˜ธ์ถœ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. @param templateID ๋ฏธ๋ฆฌ ์ง€์ •๋œ ํ…œํ”Œ๋ฆฟ ๋ฉ”์‹œ์ง€ ID. @param user ์ด ๋ฉ”์‹œ์ง€๋ฅผ ์ˆ˜์‹ ํ•  User. @param messageArguments ํ…œํ”Œ๋ฆฟ ๋ฉ”์‹œ์ง€๋ฅผ ๋งŒ๋“ค ๋•Œ, ์ฑ„์›Œ์ค˜์•ผํ•  ํŒŒ๋ผ๋ฏธํ„ฐ๋“ค. @param completionHandler ์š”์ฒญ ์™„๋ฃŒ์‹œ ์‹คํ–‰๋  block. ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ์™€ ์ „์†ก ์™„๋ฃŒ ์‹œ ์ˆ˜ํ–‰๋œ๋‹ค. */ + (instancetype)talkSendMessageTaskWithTemplateID:(NSString *)templateID receiverUser:(KOUserInfo *)user messageArguments:(NSDictionary *)messageArguments completionHandler:(void (^)(NSError *error))completionHandler; /*! @abstract ๋ฏธ๋ฆฌ ์ง€์ •๋œ Template Message๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ, ์นด์นด์˜คํ†ก์œผ๋กœ ๋ฉ”์‹œ์ง€๋ฅผ ์ „์†กํ•ฉ๋‹ˆ๋‹ค. ์ œํœด๋ฅผ ํ†ตํ•ด ๊ถŒํ•œ์ด ๋ถ€์—ฌ๋œ ํŠน์ • ์•ฑ์—์„œ๋งŒ ํ˜ธ์ถœ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.<br> @param templateID ๋ฏธ๋ฆฌ ์ง€์ •๋œ ํ…œํ”Œ๋ฆฟ ๋ฉ”์‹œ์ง€ ID. @param receiverFriend ์ด ๋ฉ”์‹œ์ง€๋ฅผ ์ˆ˜์‹ ํ•  ์นœ๊ตฌ. @param messageArguments ํ…œํ”Œ๋ฆฟ ๋ฉ”์‹œ์ง€๋ฅผ ๋งŒ๋“ค ๋•Œ, ์ฑ„์›Œ์ค˜์•ผํ•  ํŒŒ๋ผ๋ฏธํ„ฐ๋“ค. @param completionHandler ์š”์ฒญ ์™„๋ฃŒ์‹œ ์‹คํ–‰๋  block. ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ์™€ ์ „์†ก ์™„๋ฃŒ ์‹œ ์ˆ˜ํ–‰๋œ๋‹ค. */ + (instancetype)talkSendMessageTaskWithTemplateID:(NSString *)templateID receiverFriend:(KOFriend *)receiverFriend messageArguments:(NSDictionary *)messageArguments completionHandler:(void (^)(NSError *error))completionHandler DEPRECATED_MSG_ATTRIBUTE("Use talkSendMessageTaskWithTemplateID:receiverUser:messageArguments:completionHandler in v1.0.46"); /*! @abstract ๋ฏธ๋ฆฌ ์ง€์ •๋œ Template Message๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ, ์นด์นด์˜คํ†ก์œผ๋กœ ๋ฉ”์‹œ์ง€๋ฅผ ์ „์†กํ•ฉ๋‹ˆ๋‹ค. ์ œํœด๋ฅผ ํ†ตํ•ด ๊ถŒํ•œ์ด ๋ถ€์—ฌ๋œ ํŠน์ • ์•ฑ์—์„œ๋งŒ ํ˜ธ์ถœ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. @param templateID ๋ฏธ๋ฆฌ ์ง€์ •๋œ ํ…œํ”Œ๋ฆฟ ๋ฉ”์‹œ์ง€ ID. @param receiverChat ์ด ๋ฉ”์‹œ์ง€๋ฅผ ์ˆ˜์‹ ํ•  ์ฑ„ํŒ…๋ฐฉ. @param messageArguments ํ…œํ”Œ๋ฆฟ ๋ฉ”์‹œ์ง€๋ฅผ ๋งŒ๋“ค ๋•Œ, ์ฑ„์›Œ์ค˜์•ผํ•  ํŒŒ๋ผ๋ฏธํ„ฐ๋“ค. @param completionHandler ์š”์ฒญ ์™„๋ฃŒ์‹œ ์‹คํ–‰๋  block. ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ์™€ ์ „์†ก ์™„๋ฃŒ ์‹œ ์ˆ˜ํ–‰๋œ๋‹ค. */ + (instancetype)talkSendMessageTaskWithTemplateID:(NSString *)templateID receiverChat:(KOChat *)receiverChat messageArguments:(NSDictionary *)messageArguments completionHandler:(void (^)(NSError *error))completionHandler; /*! @abstract ์นด์นด์˜คํ†ก ์ฑ„ํŒ…๋ฐฉ ๋ชฉ๋ก์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค. ์ œํœด๋ฅผ ํ†ตํ•ด ๊ถŒํ•œ์ด ๋ถ€์—ฌ๋œ ํŠน์ • ์•ฑ์—์„œ๋งŒ ํ˜ธ์ถœ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. @param context ์ฑ„ํŒ…๋ฐฉ ๋ชฉ๋ก์„ ๋ถˆ๋Ÿฌ์˜ฌ ๋•Œ, ํŽ˜์ด์ง• ์ •๋ณด๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ context. @param completionHandler ์นด์นด์˜คํ†ก ์ฑ„ํŒ…๋ฐฉ ๋ชฉ๋ก์„ ๊ฐ€์ ธ์™€์„œ ์ฒ˜๋ฆฌํ•˜๋Š” ํ•ธ๋“ค๋Ÿฌ. */ + (instancetype)talkChatListTaskWithContext:(KOChatContext *)context completionHandler:(void (^)(NSArray *chats, NSError *error))completionHandler; /*! @abstract ๋ฏธ๋ฆฌ ์ง€์ •๋œ Message Template์„ ์‚ฌ์šฉํ•˜์—ฌ, ์นด์นด์˜คํ†ก์˜ "๋‚˜์™€์˜ ์ฑ„ํŒ…๋ฐฉ"์œผ๋กœ ๋ฉ”์‹œ์ง€๋ฅผ ์ „์†กํ•ฉ๋‹ˆ๋‹ค. ๋ชจ๋“  ์•ฑ์—์„œ ํ˜ธ์ถœ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. @param templateID ๊ฐœ๋ฐœ์ž ์‚ฌ์ดํŠธ๋ฅผ ํ†ตํ•ด ์ƒ์„ฑํ•œ ๋ฉ”์‹œ์ง€ ํ…œํ”Œ๋ฆฟ id @param messageArguments ๋ฉ”์‹œ์ง€ ํ…œํ”Œ๋ฆฟ์— ์ •์˜ํ•œ ํ‚ค/๋ฐธ๋ฅ˜์˜ ํŒŒ๋ผ๋ฏธํ„ฐ๋“ค. ํ…œํ”Œ๋ฆฟ์— ์ •์˜๋œ ๋ชจ๋“  ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ ํฌํ•จ๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. @param completionHandler ์š”์ฒญ ์™„๋ฃŒ์‹œ ์‹คํ–‰๋  block. ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ์™€ ์ „์†ก ์™„๋ฃŒ ์‹œ ์ˆ˜ํ–‰๋œ๋‹ค. */ + (instancetype)talkSendMemoTaskWithTemplateID:(NSString *)templateID messageArguments:(NSDictionary *)messageArguments completionHandler:(void (^)(NSError *error))completionHandler; @end
/* mbed Microcontroller Library * Copyright (c) 2014, STMicroelectronics * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "mbed_assert.h" #include "analogout_api.h" #if DEVICE_ANALOGOUT #include "cmsis.h" #include "pinmap.h" #include "error.h" #define DAC_RANGE (0xFFF) // 12 bits static const PinMap PinMap_DAC[] = { {PA_4, DAC_1, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0)}, // DAC_OUT {NC, NC, 0} }; static DAC_HandleTypeDef DacHandle; void analogout_init(dac_t *obj, PinName pin) { DAC_ChannelConfTypeDef sConfig; DacHandle.Instance = DAC; // Get the peripheral name (DAC_1, ...) from the pin and assign it to the object obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC); MBED_ASSERT(obj->dac != (DACName)NC); // Configure GPIO pinmap_pinout(pin, PinMap_DAC); // Save the channel for future use obj->pin = pin; // Enable DAC clock __DAC_CLK_ENABLE(); // Configure DAC sConfig.DAC_Trigger = DAC_TRIGGER_NONE; sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_DISABLE; HAL_DAC_ConfigChannel(&DacHandle, &sConfig, DAC_CHANNEL_1); analogout_write_u16(obj, 0); } void analogout_free(dac_t *obj) { // Reset DAC and disable clock __DAC_FORCE_RESET(); __DAC_RELEASE_RESET(); __DAC_CLK_DISABLE(); // Configure GPIO pin_function(obj->pin, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0)); } static inline void dac_write(dac_t *obj, uint16_t value) { HAL_DAC_SetValue(&DacHandle, DAC_CHANNEL_1, DAC_ALIGN_12B_R, value); HAL_DAC_Start(&DacHandle, DAC_CHANNEL_1); } static inline int dac_read(dac_t *obj) { return (int)HAL_DAC_GetValue(&DacHandle, DAC_CHANNEL_1); } void analogout_write(dac_t *obj, float value) { if (value < 0.0f) { dac_write(obj, 0); // Min value } else if (value > 1.0f) { dac_write(obj, (uint16_t)DAC_RANGE); // Max value } else { dac_write(obj, (uint16_t)(value * (float)DAC_RANGE)); } } void analogout_write_u16(dac_t *obj, uint16_t value) { if (value > (uint16_t)DAC_RANGE) { dac_write(obj, (uint16_t)DAC_RANGE); // Max value } else { dac_write(obj, value); } } float analogout_read(dac_t *obj) { uint32_t value = dac_read(obj); return (float)((float)value * (1.0f / (float)DAC_RANGE)); } uint16_t analogout_read_u16(dac_t *obj) { return (uint16_t)dac_read(obj); } #endif // DEVICE_ANALOGOUT