Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add simple unit tests for the controller
/** * @file test_controller.c * @author Travis Lane * @version 0.0.1 * @date 2019-04-21 */ #include <check.h> #include "pwm.h" #include "pwm_internal.h" START_TEST(test_controller_basic) { struct usp_controller_t *ctrl; struct usp_pwm_list_t *lst; ctrl = usp_controller_new(); fail_if(ctrl == NULL, "Fai...
Increase max number of elements per instruction.
/* * 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 ...
/* * 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 ...
Add default SWO pin number and config if not defined in Ambiq target
/* mbed Microcontroller Library * Copyright (c) 2017 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * 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/li...
/* mbed Microcontroller Library * Copyright (c) 2017 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * 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/li...
Revert "Add slight tolerance for image differences to visual test macro."
#import <FBSnapshotTestCase/FBSnapshotTestCase.h> #import "UIApplication+VisualTestUtils.h" /** * @function WMFSnapshotVerifyView * * Verify correct appearance of a given view. * * Search all folder suffixes, use default naming conventions. * * @param view The view to verify. */ #define WMFSnapshotVerifyVi...
#import <FBSnapshotTestCase/FBSnapshotTestCase.h> #import "UIApplication+VisualTestUtils.h" /** * @function WMFSnapshotVerifyView * * Verify correct appearance of a given view. * * Search all folder suffixes, use default naming conventions. * * @param view The view to verify. */ #define WMFSnapshotVerifyVi...
Fix a long line in a comment
// ---------------------------------------------------------------------------- // pomodoro - Provides data structures and methods for manipulating pomodoros // Copyright (c) 2013 Jonathan Speicher (jon.speicher@gmail.com) // Licensed under the MIT license: http://opensource.org/licenses/MIT // ------------------------...
// ---------------------------------------------------------------------------- // pomodoro - Provides data structures and methods for manipulating pomodoros // Copyright (c) 2013 Jonathan Speicher (jon.speicher@gmail.com) // Licensed under the MIT license: http://opensource.org/licenses/MIT // ------------------------...
Change max gas value Swap CW/CCW pins
#define PIN_GAS_PEDAL A0 #define PIN_BATTERY_VOLTAGE A1 #define PIN_CW 5 #define PIN_CCW 6 #define PIN_SWITCH_FORWARDS 10 #define PIN_SWITCH_BACKWARDS 11 #define GAS_VALUE_MIN 446 #define GAS_VALUE_MAX 510 #define BATTERY_READING_12V 670 #define BATTERY_READING_6V 331 #define BATTERY_VOLTAGE_MIN 11 #define SPEED_...
#define PIN_GAS_PEDAL A0 #define PIN_BATTERY_VOLTAGE A1 #define PIN_CW 6 #define PIN_CCW 5 #define PIN_SWITCH_FORWARDS 10 #define PIN_SWITCH_BACKWARDS 11 #define GAS_VALUE_MIN 446 #define GAS_VALUE_MAX 490 //510 #define BATTERY_READING_12V 670 #define BATTERY_READING_6V 331 #define BATTERY_VOLTAGE_MIN 11 #define ...
Print hex in debug messages
// // Created by Jake Kinsella on 4/17/17. // #include "cpu.h" #include "registers.h" #include "ram.h" #include "matcher/matcher.h" void initialize() { initialize_registers(); initialize_ram(); } void cycle() { uint8_t instruction = read_byte_from_address(pc); printf("%d: %d\n", pc, instruction); ...
// // Created by Jake Kinsella on 4/17/17. // #include "cpu.h" #include "registers.h" #include "ram.h" #include "matcher/matcher.h" void initialize() { initialize_registers(); initialize_ram(); } void cycle() { uint8_t instruction = read_byte_from_address(pc); printf("0x%x: 0x%x\n", pc, instruction);...
Add a C program to github to test
#include <stdio.h> #include <stdlib.h> int main() { int a[100],i,j,n,t; printf("Enter the value of n (num. of ints)"); scanf("%d",&n); for(i=0;i<=n-1;i++) { printf("Enter a number:"); scanf("%d",&a[i]); printf(" Good, %d to go\n", n-1-i); } printf(" Start sorting ... \n"); // //Bubb...
Add UNKNOWN annotations to 02/51
// from SV-COMP: nla-digbench-scaling/ps6-ll_valuebound5.c // contains deep integer expressions that shouldn't cause extremely exponential slowdown // when evaluated by base's eval_rv and EvalInt jointly // runs (as unknown) under 0.1s #include <assert.h> void assume_abort_if_not(int cond) { if(!cond) {abort();} } ...
// from SV-COMP: nla-digbench-scaling/ps6-ll_valuebound5.c // contains deep integer expressions that shouldn't cause extremely exponential slowdown // when evaluated by base's eval_rv and EvalInt jointly // runs (as unknown) under 0.1s #include <assert.h> void assume_abort_if_not(int cond) { if(!cond) {abort();} } ...
Add test for apron dummy privatization soundness
// SKIP PARAM: --set ana.activated[+] apron --set ana.apron.privatization dummy #include <pthread.h> #include <assert.h> int g; void *t_fun(void *arg) { // shouldn't have g, x, y in local apron state g = 43; int *p = arg; *p = 11; return NULL; } int main() { g = 42; int x = 10; int y = 20; pthread...
Fix a potentially unportable use of snprintf found by flawfinder.
#include <X11/X.h> #include <X11/Xatom.h> #include <X11/Xlib.h> #include <stdio.h> int main() { Display *display = XOpenDisplay(NULL); if (display == NULL) { fprintf(stderr, "Could not connect to $DISPLAY.\n"); return 1; } char buf[32]; snprintf(buf, sizeof(buf), "_NET_WM_CM_S%d", (int)DefaultScreen(...
#include <X11/X.h> #include <X11/Xatom.h> #include <X11/Xlib.h> #include <stdio.h> int main() { Display *display = XOpenDisplay(NULL); if (display == NULL) { fprintf(stderr, "Could not connect to $DISPLAY.\n"); return 1; } char buf[32]; // Flawfinder: ignore snprintf(buf, sizeof(buf), "_NET_WM_CM_S%...
Update driver version to 5.02.00-k11
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2010 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.02.00-k10"
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2010 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.02.00-k11"
Add some color for console output
#ifndef KAI_PLATFORM_GAME_CONTROLLER_H #define KAI_PLATFORM_GAME_CONTROLLER_H #include KAI_PLATFORM_INCLUDE(GameController.h) #endif // SHATTER_PLATFORM_GAME_CONTROLLER_H //EOF
#ifndef KAI_PLATFORM_GAME_CONTROLLER_H #define KAI_PLATFORM_GAME_CONTROLLER_H #include KAI_PLATFORM_INCLUDE(GameController.h) #endif //EOF
Fix memory leak in Python 3.2
#ifndef PYTHON3ADAPT_H #define PYTHON3ADAPT_H #if (PY_VERSION_HEX < 0x03000000) #define PyBytes_Check PyString_Check #define PyBytes_Size PyString_Size #define PyBytes_AsString PyString_AsString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_From...
#ifndef PYTHON3ADAPT_H #define PYTHON3ADAPT_H #if (PY_VERSION_HEX < 0x03000000) #define PyBytes_Check PyString_Check #define PyBytes_Size PyString_Size #define PyBytes_AsString PyString_AsString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_From...
Support for additional data to be passed for controller support (implemented on consoles).
#pragma once #include <functional> #include "halley/maths/vector2.h" #include "halley/core/input/input_device.h" namespace Halley { class InputJoystick; class InputTouch; class InputAPI { public: virtual ~InputAPI() {} virtual size_t getNumberOfKeyboards() const = 0; virtual std::shared_ptr<InputDevice...
#pragma once #include <functional> #include "halley/maths/vector2.h" #include "halley/core/input/input_device.h" #include "halley/maths/colour.h" #include "halley/data_structures/maybe.h" namespace Halley { class InputJoystick; class InputTouch; class InputControllerData { public: Colour colour; String name;...
Move this in to an actual class.
#include <ruby.h> #include "client.h" static VALUE metrics_report_metric(VALUE self, VALUE user_id, VALUE key, VALUE val) { char * user_id_str, * key_str; int result = 0; user_id_str = RSTRING_PTR(user_id); key_str = RSTRING_PTR(key); /* Figure out what this belongs to and call the apprioriate one. */ sw...
#include <ruby.h> #include "client.h" static VALUE rb_metrics_report_metric(VALUE self, VALUE user_id, VALUE key, VALUE val) { char * user_id_str, * key_str; int result = 0; user_id_str = RSTRING_PTR(user_id); key_str = RSTRING_PTR(key); /* Figure out what this belongs to and call the apprioriate one. */ ...
Prepare for next version version
#define FLATCC_VERSION_TEXT "0.4.3" #define FLATCC_VERSION_MAJOR 0 #define FLATCC_VERSION_MINOR 4 #define FLATCC_VERSION_PATCH 3 /* 1 or 0 */ #define FLATCC_VERSION_RELEASED 1
#define FLATCC_VERSION_TEXT "0.5.0-pre" #define FLATCC_VERSION_MAJOR 0 #define FLATCC_VERSION_MINOR 5 #define FLATCC_VERSION_PATCH 0 /* 1 or 0 */ #define FLATCC_VERSION_RELEASED 0
Add framework for a new lasi plugin, currently disabled. The lasi library provides UTF-8 support in PostScript
/* $Id$ $Revision$ */ /* vim:set shiftwidth=4 ts=8: */ /********************************************************** * This software is part of the graphviz package * * http://www.graphviz.org/ * * * * Copyright (...
Use variable that cmake defines instead of specific one
#pragma once #ifndef INCL_NETWORKOS #define INCL_NETWORKOS #include <iostream> #include <memory> #include <string> #include <vector> #include <map> #include <cstdlib> #ifdef WIN32 #include <WinSock2.h> #include <WS2tcpip.h> #include <inaddr.h> #include <in6addr.h> #include <mstcpip.h> #define SHUT_RDWR SD_BOTH typede...
#pragma once #ifndef INCL_NETWORKOS #define INCL_NETWORKOS #include <iostream> #include <memory> #include <string> #include <vector> #include <map> #include <cstdlib> #if defined(_MSC_VER) #include <WinSock2.h> #include <WS2tcpip.h> #include <inaddr.h> #include <in6addr.h> #include <mstcpip.h> #define SHUT_RDWR SD_BO...
Add comments for clarification about memset implementation.
/** @file Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based Cryptographic Library. Copyright (c) 2010, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies ...
/** @file Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based Cryptographic Library. Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accom...
Make get_nodes return a const&, and optimize uses of this function
#ifndef Bag_h #define Bag_h #include <unordered_set> #include <vector> #include <ostream> //A node in the tree deocomposition class Bag{ private: unsigned long id; std::vector<unsigned long> nodes; unsigned long parent=0; std::vector<unsigned long> children; public: Bag(unsigned long id, std::unordered_set<...
#ifndef Bag_h #define Bag_h #include <unordered_set> #include <vector> #include <ostream> //A node in the tree deocomposition class Bag{ private: unsigned long id; std::vector<unsigned long> nodes; unsigned long parent=0; std::vector<unsigned long> children; public: Bag(unsigned long id, const std::unordere...
Update comment for enum proc_log_ebreak_cli
// // riscv-processor-logging.h // #ifndef riscv_processor_logging_h #define riscv_processor_logging_h namespace riscv { /* Processor logging flags */ enum { proc_log_inst = 1<<0, /* Log instructions */ proc_log_operands = 1<<1, /* Log instruction operands */ proc_log_memory =...
// // riscv-processor-logging.h // #ifndef riscv_processor_logging_h #define riscv_processor_logging_h namespace riscv { /* Processor logging flags */ enum { proc_log_inst = 1<<0, /* Log instructions */ proc_log_operands = 1<<1, /* Log instruction operands */ proc_log_memory =...
Enable GZIP and ZLIB options in iPXE
#define CONSOLE_CMD /* Console command */ #define DIGEST_CMD /* Image crypto digest commands */ #define DOWNLOAD_PROTO_HTTPS /* Secure Hypertext Transfer Protocol */ #define IMAGE_COMBOOT /* COMBOOT */ #define IMAGE_TRUST_CMD /* Image trust management commands */ #define NET_PROTO...
#define CONSOLE_CMD /* Console command */ #define DIGEST_CMD /* Image crypto digest commands */ #define DOWNLOAD_PROTO_HTTPS /* Secure Hypertext Transfer Protocol */ #define IMAGE_COMBOOT /* COMBOOT */ #define IMAGE_TRUST_CMD /* Image trust management commands */ #define IMAGE_GZIP ...
Add missing file for variadic template version of TQObject::EmitVA
// @(#)root/base:$Id$ // Author: Philippe Canal 09/2014 /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * ...
Print sha1 of last commit
#include <glib.h> #include <glib/gstdio.h> #include <uuid/uuid.h> #include <wizbit/file.h> int main() { { struct wiz_file *file; wiz_vref vref; FILE *fp; /* Open up a new versioned file and create a couple of revisions */ file = wiz_file_open(WIZ_FILE_NEW, 0, 0); fp = wiz_file_get_handle(f...
#include <glib.h> #include <glib/gstdio.h> #include <uuid/uuid.h> #include <wizbit/vref.h> #include <wizbit/file.h> int main() { { wiz_vref_hexbuffer buffer; struct wiz_file *file; wiz_vref vref; FILE *fp; /* Open up a new versioned file and create a couple of revisions */ file = wiz_file_...
Fix angle_perftests compilation on Linux
// // Copyright (c) 2017 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // draw_call_perf_utils.h: // Common utilities for performance tests that need to do a large amount of draw calls. // #ifndef TESTS_TEST_...
// // Copyright (c) 2017 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // draw_call_perf_utils.h: // Common utilities for performance tests that need to do a large amount of draw calls. // #ifndef TESTS_TEST_...
Fix test by fully specifying the platform.
// RUN: %clang -ccc-host-triple i386 -S -o - %s | \ // RUN: FileCheck --check-prefix=DEFAULT %s // DEFAULT: f0: // DEFAULT: pushl %ebp // DEFAULT: ret // DEFAULT: f1: // DEFAULT: pushl %ebp // DEFAULT: ret // RUN: %clang -ccc-host-triple i386 -S -o - -fomit-frame-pointer %s | \ // RUN: FileCheck --check-prefix=OMI...
// RUN: %clang -ccc-host-triple i386-apple-darwin -S -o - %s | \ // RUN: FileCheck --check-prefix=DARWIN %s // DARWIN: f0: // DARWIN: pushl %ebp // DARWIN: ret // DARWIN: f1: // DARWIN: pushl %ebp // DARWIN: ret // RUN: %clang -ccc-host-triple i386-pc-linux-gnu -S -o - %s | \ // RUN: FileCheck --check-prefix=LINUX...
Make remove and initWithName:path:parent optional.
// // FileSystemObject.h // arc // // Created by Jerome Cheng on 1/4/13. // Copyright (c) 2013 nus.cs3217. All rights reserved. // #import <Foundation/Foundation.h> @protocol FileSystemObject <NSObject> @required // The name of this object. @property (strong, nonatomic) NSString *name; // This should be able t...
// // FileSystemObject.h // arc // // Created by Jerome Cheng on 1/4/13. // Copyright (c) 2013 nus.cs3217. All rights reserved. // #import <Foundation/Foundation.h> @protocol FileSystemObject <NSObject> @required // The name of this object. @property (strong, nonatomic) NSString *name; // This should be able t...
Fix compiler warning from xfs_file_compat_invis_ioctl prototype.
/* * Copyright (c) 2004-2005 Silicon Graphics, Inc. * All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be ...
/* * Copyright (c) 2004-2005 Silicon Graphics, Inc. * All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be ...
Add test case for -fexceptions
// RUN: clang -fexceptions -emit-llvm -o - %s | grep "@foo() {" | count 1 // RUN: clang -emit-llvm -o - %s | grep "@foo() nounwind {" | count 1 int foo(void) { }
Update driver version to 5.03.00-k3
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2012 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.03.00-k2"
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2012 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #define QLA4XXX_DRIVER_VERSION "5.03.00-k3"
Add wave header analyzer test
#include <stdio.h> #include <stdlib.h> int main(){ unsigned char header[44]; FILE * wavfile; wavfile = fopen("test.wav", "r"); for(int i = 0; i < 44; i++){ fscanf(wavfile, "%c", &header[i]); } fclose(wavfile); for(int i = 0; i < 44; i++){ printf("%x\n", header[i]); } ...
Update the files referred to by the linter.
/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
Update Skia milestone to 82
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 81 #endif
/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SK_MILESTONE #define SK_MILESTONE 82 #endif
Add turing_try function for handling errors
#include <stdio.h> #include <stdlib.h> #include "turing.h" #define MAX_PROGRAM_LENGTH 32 int main() { int status; Turing *turing; status = 0; turing = init_turing(); status = execute_instruction(turing, "0 110\n1 110"); if (TURING_ERROR == status) { fprintf(stderr, "Exiting\n"); ...
#include <stdio.h> #include <stdlib.h> #include "turing.h" #define MAX_PROGRAM_LENGTH 32 #define turing_try(statement) status = statement;\ if (TURING_ERROR == status) {\ return 1;\ } int main()...
Remove methods from TBAVC that we no longer want to expose publically
// // TBAViewController.h // the-blue-alliance // // Created by Zach Orr on 4/28/16. // Copyright © 2016 The Blue Alliance. All rights reserved. // #import <UIKit/UIKit.h> @class TBAPersistenceController, TBARefreshViewController; @interface TBAViewController : UIViewController @property (nonnull, readonly) TBA...
// // TBAViewController.h // the-blue-alliance // // Created by Zach Orr on 4/28/16. // Copyright © 2016 The Blue Alliance. All rights reserved. // #import <UIKit/UIKit.h> @class TBAPersistenceController, TBARefreshViewController; @interface TBAViewController : UIViewController @property (nonnull, readonly) TBA...
Fix forward declaration of idris_closeDir
#ifndef __IDRIS_DIRECTORY_H #define __IDRIS_DIRECTORY_H char* idris2_currentDirectory(); int idris2_changeDir(char* dir); int idris2_createDir(char* dir); void* idris2_openDir(char* dir); void idris2_closeDIr(void* d); int idris2_removeDir(char* path); char* idris2_nextDirEntry(void* d); #endif
#ifndef __IDRIS_DIRECTORY_H #define __IDRIS_DIRECTORY_H char* idris2_currentDirectory(); int idris2_changeDir(char* dir); int idris2_createDir(char* dir); void* idris2_openDir(char* dir); void idris2_closeDir(void* d); int idris2_removeDir(char* path); char* idris2_nextDirEntry(void* d); #endif
Remove http form for mass, only manipulate local mass
inherit "/lib/string/sprint"; inherit "../support"; static string thing_form(object obj) { string buffer; buffer = "<p>Fun little boxes:</p>\n"; buffer += "<form action=\"object.lpc?obj=" + object2string(obj) + "\" method=\"post\">\n"; buffer += "Mass: <input type=\"text\" name=\"mass\" value=\"" + mixed_sprint(...
inherit "/lib/string/sprint"; inherit "../support"; static string thing_form(object obj) { string buffer; buffer = "<p>Fun little boxes:</p>\n"; buffer += "<form action=\"object.lpc?obj=" + object2string(obj) + "\" method=\"post\">\n"; buffer += "Local mass: <input type=\"text\" name=\"localmass\" value=\"" + mi...
Add source code documentation for the RocksDB Cuckoo Table Options class
// // RocksDBCuckooTableOptions.h // ObjectiveRocks // // Created by Iska on 04/01/15. // Copyright (c) 2015 BrainCookie. All rights reserved. // #import <Foundation/Foundation.h> @interface RocksDBCuckooTableOptions : NSObject @property (nonatomic, assign) double hashTableRatio; @property (nonatomic, assign) ui...
// // RocksDBCuckooTableOptions.h // ObjectiveRocks // // Created by Iska on 04/01/15. // Copyright (c) 2015 BrainCookie. All rights reserved. // #import <Foundation/Foundation.h> @interface RocksDBCuckooTableOptions : NSObject /** @brief Determines the utilization of hash tables. Smaller values result in l...
Use bit shift for flag values not constant values.
/* * lock_driver_lockd.h: Locking for domain lifecycle operations * * Copyright (C) 2010-2011 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.1 ...
/* * lock_driver_lockd.h: Locking for domain lifecycle operations * * Copyright (C) 2010-2011 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.1 ...
Add folder with is prime program Krastian Tomov No 21 10g
#include <stdio.h> int is_prime(int *); int main() { int answer; int number; int *refernce_of_a = &number; scanf("%d",refernce_of_a); answer = is_prime(&number); printf("%d",answer); } int is_prime(int *numb) { int counter; for(counter = 0; counter <= *numb/2; counter++) { if(counter * counter ==...
Add test case for indexing into an array, since the array index can be an expression
extern void print_int(int i); extern void print_string(char c[]); int return1(void) { return 1; } void main(void){ int myInt; int intArr[3]; /* need assignToArry to work for this to work */ intArr[0] = 999; intArr[1] = 100; intArr[2] = 200; /* test index from a variable */ myInt...
Use comments to structure file
/** * @file * * @brief Tests for mini plugin * * @copyright BSD License (see doc/LICENSE.md or http://www.libelektra.org) * */ #include "values.h" #include <stdlib.h> #include <string.h> #include <kdbconfig.h> #include <tests_plugin.h> static void test_basics () { printf ("• Test basic functionality of plu...
/** * @file * * @brief Tests for mini plugin * * @copyright BSD License (see doc/LICENSE.md or http://www.libelektra.org) * */ /* -- Imports --------------------------------------------------------------------------------------------------------------------------- */ #include "values.h" #include <stdlib.h> #i...
Fix helpers multiple defined symbols
#ifndef QTPROMISE_QPROMISEHELPERS_H #define QTPROMISE_QPROMISEHELPERS_H // QtPromise #include "qpromise_p.h" namespace QtPromise { template <typename T> typename QtPromisePrivate::PromiseDeduce<T>::Type qPromise(T&& value) { using namespace QtPromisePrivate; using Promise = typename PromiseDeduce<T>::Type; ...
#ifndef QTPROMISE_QPROMISEHELPERS_H #define QTPROMISE_QPROMISEHELPERS_H // QtPromise #include "qpromise_p.h" namespace QtPromise { template <typename T> static inline typename QtPromisePrivate::PromiseDeduce<T>::Type qPromise(T&& value) { using namespace QtPromisePrivate; using Promise = typename PromiseDedu...
Add a test case showing that CIL forgets to remove the "const" qualifier on structures within structures. When it subsequently converts initializations of such structures into assignments, the resulting C code appears to be assigning into a const field. That produces warnings or errors from the C compiler.
struct inner { int field; }; struct outer { const struct inner inner; }; int main() { struct outer outer = { { 0 } }; return outer.inner.field; }
Add inl and outl functions
#include <stdint.h> void outb(uint16_t port, uint8_t value) { asm volatile ("outb %1, %0" : : "dN" (port), "a" (value)); } unsigned char inb(uint16_t port) { unsigned char ret; asm volatile ("inb %1, %0" : "=a" (ret) : "dN" (port)); return ret; }
#include <stdint.h> void outb(uint16_t port, uint8_t value) { asm volatile ("outb %1, %0" : : "dN" (port), "a" (value)); } unsigned char inb(uint16_t port) { unsigned char ret; asm volatile ("inb %1, %0" : "=a" (ret) : "dN" (port)); return ret; } void outl(uint16_t port, uint32_t value) { asm volatile ("ou...
Fix wrong member declaration which shadows parent class.
// -*- C++ -*- #ifndef _writer_verilog_axi_master_controller_h_ #define _writer_verilog_axi_master_controller_h_ #include "writer/verilog/axi/axi_controller.h" namespace iroha { namespace writer { namespace verilog { namespace axi { class MasterController : public AxiController { public: MasterController(const IRe...
// -*- C++ -*- #ifndef _writer_verilog_axi_master_controller_h_ #define _writer_verilog_axi_master_controller_h_ #include "writer/verilog/axi/axi_controller.h" namespace iroha { namespace writer { namespace verilog { namespace axi { class MasterController : public AxiController { public: MasterController(const IRe...
Add program to list blocks of a file
/* * fibmap - List blocks of a file * * Written in 2012 by Prashant P Shah <pshah.mumbai@gmail.com> * * To the extent possible under law, the author(s) have dedicated * all copyright and related and neighboring rights to this software * to the public domain worldwide. This software is distributed * without any ...
Use flags that will actually work when testing.
#include <stdio.h> #include <string.h> #include <efivar.h> #define TEST_GUID EFI_GUID(0x84be9c3e,0x8a32,0x42c0,0x891c,0x4c,0xd3,0xb0,0x72,0xbe,0xcc) static void clean_test_environment(void) { efi_del_variable(TEST_GUID, "small"); efi_del_variable(TEST_GUID, "large"); } #define report_error(str) ({fprintf(stderr, ...
#include <stdio.h> #include <string.h> #include <efivar.h> #define TEST_GUID EFI_GUID(0x84be9c3e,0x8a32,0x42c0,0x891c,0x4c,0xd3,0xb0,0x72,0xbe,0xcc) static void clean_test_environment(void) { efi_del_variable(TEST_GUID, "small"); efi_del_variable(TEST_GUID, "large"); } #define report_error(str) ({fprintf(stderr, ...
Make test robust to changes in prefix/avoid hardcoded line numbers
// REQUIRES: x86_64-linux // RUN: %host_cc -O0 -g %s -o %t 2>&1 // RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s #include <stdio.h> int inc(int a) { return a + 1; } int main() { printf("%p\n", inc); return 0; } // CHECK: inc // CHECK: print_context.c:7 // CHECK: 5 : #inc...
// REQUIRES: x86_64-linux // RUN: %host_cc -O0 -g %s -o %t 2>&1 // RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s // CHECK: inc // CHECK: print_context.c:[[@LINE+9]] // CHECK: [[@LINE+6]] : #include // CHECK: [[@LINE+6]] : // CHECK: [[@LINE+6]] >: int inc // CHECK: [[@LINE+6]] :...
Add file to replace android_framework_defines.gni
/* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkUserConfigManual_DEFINED #define SkUserConfigManual_DEFINED #define GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h" #define GR_TEST_UTILS 1 #define SKIA_DLL...
Add hashing for AbstractExpression, TupleValueExpression, ConstValueExpression
// // Created by patrick on 31/03/17. // #ifndef PELOTON_HASH_UTIL_H #define PELOTON_HASH_UTIL_H #endif //PELOTON_HASH_UTIL_H
Remove trailing whitespace (especially after a \ which should be trailing)
// Parse diagnostic arguments in the driver // PR12181 // RUN: not %clang -target x86_64-apple-darwin10 \ // RUN: -fsyntax-only -fzyzzybalubah \ // RUN: -Werror=unused-command-line-argument %s // RUN: not %clang -target x86_64-apple-darwin10 \ // RUN: -fsyntax-only -fzyzzybalubah -Werror %s
// Parse diagnostic arguments in the driver // PR12181 // RUN: not %clang -target x86_64-apple-darwin10 \ // RUN: -fsyntax-only -fzyzzybalubah \ // RUN: -Werror=unused-command-line-argument %s // RUN: not %clang -target x86_64-apple-darwin10 \ // RUN: -fsyntax-only -fzyzzybalubah -Werror %s
Add algorithm for greatest common divisor
#ifndef __gcd_h_included__ #define __gcd_h_included__ // Euclid's algorithm for computing the greatest common divisor template<typename I> I gcd(I a, I b) { while (a > 0 && b > 0) { if (a > b) a -= b; else b -= a; } return a == 0 ? b : a; } #endif
Add best guess at a method that returns an array with the names of all sources
/* * Copyright 2008 Markus Prinz * Released unter an MIT licence * */ #include <ruby.h> #include <CoreMIDI/CoreMIDI.h> VALUE callback_proc = Qnil; MIDIPortRef inPort = NULL; MIDIClientRef client = NULL; static void RbMIDIReadProc(const MIDIPacketList* packetList, void* readProcRefCon, void* srcConnRefCon) { ...
/* * Copyright 2008 Markus Prinz * Released unter an MIT licence * */ #include <ruby.h> #include <CoreMIDI/CoreMIDI.h> VALUE callback_proc = Qnil; MIDIPortRef inPort = NULL; MIDIClientRef client = NULL; static void RbMIDIReadProc(const MIDIPacketList* packetList, void* readProcRefCon, void* srcConnRefCon) { ...
Add incredibly lame solution to Exercise 1-11.
/* Exercise 1-11: How would you test the word count program? What kinds of * input are most likely to uncover bugs if there are any? */ #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { /* This is such a cheat. */ printf("Types of input that could be used to test a word counting program:\n...
Add function prototype for min_size_get.
#ifdef E_TYPEDEFS #else # ifndef E_SMART_RANDR_H # define E_SMART_RANDR_H Evas_Object *e_smart_randr_add(Evas *evas); void e_smart_randr_virtual_size_calc(Evas_Object *obj); void e_smart_randr_monitors_create(Evas_Object *obj); # endif #endif
#ifdef E_TYPEDEFS #else # ifndef E_SMART_RANDR_H # define E_SMART_RANDR_H Evas_Object *e_smart_randr_add(Evas *evas); void e_smart_randr_virtual_size_calc(Evas_Object *obj); void e_smart_randr_monitors_create(Evas_Object *obj); void e_smart_randr_min_size_get(Evas_Object *obj, Evas_Coord *mw, Evas_Coord *mh); # endi...
Add function declarations for Circular Lists.
#ifndef _LIBADT_CL_LIST_H #define _LIBADT_CL_LIST_H #include <adt_commons.h> #include <list.h> typedef list_root cl_list_root; struct _list_node { list_node *prev; // Pointer to prev list_node element. list_node *next; // Pointer to next list_node element. void *data; // Pointer to the element added on the lis...
Make block size a protected member of a block channel.
#ifndef BLOCK_CHANNEL_H #define BLOCK_CHANNEL_H class Action; class Buffer; class BlockChannel { protected: BlockChannel(void) { } public: virtual ~BlockChannel() { } virtual Action *close(EventCallback *) = 0; virtual Action *read(off_t, EventCallback *) = 0; virtual Action *write(off_t, Buffer *, EventCall...
#ifndef BLOCK_CHANNEL_H #define BLOCK_CHANNEL_H class Action; class Buffer; class BlockChannel { protected: size_t bsize_; BlockChannel(size_t bsize) : bsize_(bsize) { } public: virtual ~BlockChannel() { } virtual Action *close(EventCallback *) = 0; virtual Action *read(off_t, EventCallback *) = 0; virtua...
Clean up some whitespace to be consistent with Python's C style.
/* Tuple object interface */ #ifndef Py_STRUCTSEQ_H #define Py_STRUCTSEQ_H #ifdef __cplusplus extern "C" { #endif typedef struct PyStructSequence_Field { char *name; char *doc; } PyStructSequence_Field; typedef struct PyStructSequence_Desc { char *name; char *doc; struct PyStructSequence_Field *...
/* Tuple object interface */ #ifndef Py_STRUCTSEQ_H #define Py_STRUCTSEQ_H #ifdef __cplusplus extern "C" { #endif typedef struct PyStructSequence_Field { char *name; char *doc; } PyStructSequence_Field; typedef struct PyStructSequence_Desc { char *name; char *doc; struct PyStructSequence_Field *fields; int n_...
Add shortcuts to create NSURL's for various app folders
#import <Foundation/Foundation.h> @interface NSURL (Directories) /** Returns an NSURL representing the first path found matching the specified constants or nil if none */ + (NSURL *)URLForDirectory:(NSSearchPathDirectory)directoryConstant domainMask:(NSSearchPathDomainMask)domainMask; /** Returns the application su...
Add a skeleton for a unit to manipulate and display the event log
/* * Copyright (c) 2016, Natacha Porté * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAI...
Update typedef of byte to standard type
#ifndef INCLUDE_STREAM_OF_BYTE_H #define INCLUDE_STREAM_OF_BYTE_H #include "varray.h" #include "utils.h" typedef unsigned char byte; struct byte_stream { void(*next)(struct byte_stream *self, byte v); void(*error)(struct byte_stream *self, byte e); void(*complete)(struct byte_stream *self); varray *listeners; };...
#ifndef INCLUDE_STREAM_OF_BYTE_H #define INCLUDE_STREAM_OF_BYTE_H #include "varray.h" #include "utils.h" typedef uint8_t byte; struct byte_stream { void(*next)(struct byte_stream *self, byte v); void(*error)(struct byte_stream *self, byte e); void(*complete)(struct byte_stream *self); varray *listeners; }; type...
Add test cases for unsigned
// PARAM: --enable ana.int.congruence int main() { int top; int i = 0; if(top % 17 == 3) { assert(top%17 ==3); if(top %17 != 3) { i = 12; } else { } } assert(i ==0); if(top % 17 == 0) { assert(top%17 == 0); if(top %17 != 0) { ...
// PARAM: --enable ana.int.congruence void unsignedCase() { unsigned int top; unsigned int i = 0; if(top % 17 == 3) { assert(top%17 ==3); if(top %17 != 3) { i = 12; } else { } } assert(i ==0); if(top % 17 == 0) { assert(top%17 == 0); ...
Add List creation function declaration
#include <stdlib.h> #ifndef __LIST_H__ #define __LIST_H__ struct ListNode; struct List; typedef struct ListNode ListNode; typedef struct List List; #endif
#include <stdlib.h> #ifndef __LIST_H__ #define __LIST_H__ struct ListNode; struct List; typedef struct ListNode ListNode; typedef struct List List; List* List_Create(void); #endif
Remove a bunch of the randomization stuff; the program now uses tempnam(3).
/* shuffle files in a directory by giving them random names, optionally tacking a global file extension to the end */ #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <string.h> char *extension = '\0'; DIR *dir; struct dirent *fileInDir; int fileCount = 0; int main(int argc, char **argv){ i...
/* shuffle files in a directory by giving them random names, optionally tacking a global file extension to the end */ #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <string.h> int main(int argc, char **argv){ char *extension = '\0'; DIR *dir = opendir(argv[1]); DIR *dir_nameclobber...
Fix warning about C++ style comment in C file
//===- InstrProfilingNameVar.c - profile name variable setup --------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===-------------------------------------------------------...
/*===- InstrProfilingNameVar.c - profile name variable setup -------------===*\ |* |* The LLVM Compiler Infrastructure |* |* This file is distributed under the University of Illinois Open Source |* License. See LICENSE.TXT for details. |* \*===-------------------------------------------------------...
Include cstddef to define size_t
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <cstdint> #include <vector> namespace search::tensor { class LargeSubspacesBufferType; class SmallSubspacesBufferType; class TensorBufferOperations; /* * This class provides mapping betwe...
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <cstddef> #include <cstdint> #include <vector> namespace search::tensor { class LargeSubspacesBufferType; class SmallSubspacesBufferType; class TensorBufferOperations; /* * This class pro...
Use posix-compliant __linux__ (__linux not defined on BG/Q)
/* Copyright (c) 2014 Stefan.Eilemann@epfl.ch */ #ifndef @UPPER_PROJECT_NAME@_DEFINES_H #define @UPPER_PROJECT_NAME@_DEFINES_H #ifdef __APPLE__ # include <@PROJECT_INCLUDE_NAME@/definesDarwin.h> #endif #ifdef __linux # include <@PROJECT_INCLUDE_NAME@/definesLinux.h> #endif #ifdef _WIN32 //_MSC_VER # include <@PRO...
/* Copyright (c) 2014 Stefan.Eilemann@epfl.ch */ #ifndef @UPPER_PROJECT_NAME@_DEFINES_H #define @UPPER_PROJECT_NAME@_DEFINES_H #ifdef __APPLE__ # include <@PROJECT_INCLUDE_NAME@/definesDarwin.h> #endif #ifdef __linux__ # include <@PROJECT_INCLUDE_NAME@/definesLinux.h> #endif #ifdef _WIN32 //_MSC_VER # include <@P...
Add header to support C++ headers exported to C
#ifndef ZEPHYR_CEXPORT_H #define ZEPHYR_CEXPORT_H #ifdef __cplusplus #define Z_NS_START(n) namespace n { #define Z_NS_END } #else #define Z_NS_START(n) #define Z_NS_END #endif #ifdef __cplusplus #define Z_ENUM_CLASS(ns, n) enum class n #else #define Z_ENUM_CLASS(ns, n) enum ns ## _ ## n #endif #ifdef __cplusplus #de...
Remove TMPDIR from glibc's commented list
/* * Environment variable to be removed for SUID programs. The names are all * stuffed in a single string which means they have to be terminated with a * '\0' explicitly. */ #define UNSECURE_ENVVARS \ "LD_PRELOAD\0" \ "LD_LIBRARY_PATH\0" \ "LD_DEBUG\0" \ "LD_DEBUG_OUTPUT\0" \ "LD_TRACE_LOADED_OBJECTS\0" \ ...
/* * Environment variable to be removed for SUID programs. The names are all * stuffed in a single string which means they have to be terminated with a * '\0' explicitly. */ #define UNSECURE_ENVVARS \ "LD_PRELOAD\0" \ "LD_LIBRARY_PATH\0" \ "LD_DEBUG\0" \ "LD_DEBUG_OUTPUT\0" \ "LD_TRACE_LOADED_OBJECTS\0" \ ...
Fix a trivial bug that causes a compilation error with clang++ -O0
#pragma once #include <string> #include "random.h" #include "ray.h" #include "vector.h" namespace amber { namespace lens { template <typename RealType> struct Lens { using real_type = RealType; using ray_type = Ray<real_type>; using vector3_type = Vector3<real_type>; static constexpr real_type kFoca...
#pragma once #include <string> #include "random.h" #include "ray.h" #include "vector.h" namespace amber { namespace lens { template <typename RealType> struct Lens { using real_type = RealType; using ray_type = Ray<real_type>; using vector3_type = Vector3<real_type>; static constexpr real_type kFoca...
Add a config constants file missing from previous checkin.
// Copyright 2009 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 ...
Add explicit set index to Globals uniform buffer
#define ATTR_POS 0 #define ATTR_UV 1 #define ATTR_COLOR 2 #ifdef __cplusplus struct Globals #else // __cplusplus layout(binding = 0, std140) uniform Globals #endif // __cplusplus { vec4 screenSize; mat4 viewProj; mat4 guiOrtho; }; struct Cube { vec4 rotation; vec3 position; uint color; };
#define ATTR_POS 0 #define ATTR_UV 1 #define ATTR_COLOR 2 #ifdef __cplusplus struct Globals #else // __cplusplus layout(set = 0, binding = 0, std140) uniform Globals #endif // __cplusplus { vec4 screenSize; mat4 viewProj; mat4 guiOrtho; }; struct Cube { vec4 rotation; vec3 position; uint color; };
Convert from reboot to shutdown
/* * nope - for noping out. * * Copyright 2017 by Jack Kingsman <jack.kingsman@gmail.com> * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both...
/* * nope - for noping out. * * Copyright 2017 by Jack Kingsman <jack.kingsman@gmail.com> * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both...
Create structs for triangle mesh representations
/* Lantern - A path tracer * * Lantern is the legal property of Adrian Astley * Copyright Adrian Astley 2015 - 2016 */ #pragma once #include "vector_types.h" namespace Lantern { typedef float4 Vertex; struct Triangle { int V0, V1, V2; }; } // End of namespace Lantern
Use assert_string... instead of assert_int...
#define _RESCLIB_SOURCE #include <stdlib.h> #undef _RESCLIB_SOURCE #include <string.h> #include <time.h> #include "seatest.h" static void test_gmtime_asctime (void) { time_t timestamps[] = { -12219292800, 0, 1468110957 }; char timestamp_strings[][26] = { "Fri Oct 15 0: 0: 0...
#define _RESCLIB_SOURCE #include <stdlib.h> #undef _RESCLIB_SOURCE #include <time.h> #include "seatest.h" static void test_gmtime_asctime (void) { time_t timestamps[] = { -12219292800, 0, 1468110957 }; char timestamp_strings[][26] = { "Fri Oct 15 0: 0: 0 1582\n", "T...
Add comment about source of urlencode category
// // NSString+urlencode.h // Respoke SDK // // Copyright 2015, Digium, Inc. // All rights reserved. // // This source code is licensed under The MIT License found in the // LICENSE file in the root directory of this source tree. // // For all details and documentation: https://www.respoke.io // #import <Found...
// // NSString+urlencode.h // Respoke SDK // // Copyright 2015, Digium, Inc. // All rights reserved. // // This source code is licensed under The MIT License found in the // LICENSE file in the root directory of this source tree. // // For all details and documentation: https://www.respoke.io // #import <Found...
Use the right opcode for the svc instruction
/* * Copyright (c) 2017, Shawn Webb * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of...
/* * Copyright (c) 2017, Shawn Webb * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of...
Add basic implementation of defsym()
#include <stdio.h> #include <stdlib.h> #include "arch.h" #include "../../cc2.h" #include "../../../inc/sizes.h" void defsym(Symbol *sym, int alloc) { } void data(Node *np) { } void writeout(void) { }
#include <stdio.h> #include <stdlib.h> #include "arch.h" #include "../../cc2.h" #include "../../../inc/sizes.h" /* * : is for user-defined Aggregate Types * $ is for globals (represented by a pointer) * % is for function-scope temporaries * @ is for block labels */ static char sigil(Symbol *sym) { switch (sym-...
Add _ASSERT() test on returned device_get_binding
/* * Copyright (c) 2017 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #include <atomic.h> #include <kernel.h> #include <entropy.h> static atomic_t entropy_driver; u32_t sys_rand32_get(void) { struct device *dev = (struct device *)atomic_get(&entropy_driver); u32_t random_num; int ret; if (unl...
/* * Copyright (c) 2017 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #include <atomic.h> #include <kernel.h> #include <entropy.h> static atomic_t entropy_driver; u32_t sys_rand32_get(void) { struct device *dev = (struct device *)atomic_get(&entropy_driver); u32_t random_num; int ret; if (unl...
Add an empty line. Yeah, that's a fantastic commit.
#include "crypto_scalarmult_curve25519.h" size_t crypto_scalarmult_curve25519_bytes(void) { return crypto_scalarmult_curve25519_BYTES; } size_t crypto_scalarmult_curve25519_scalarbytes(void) { return crypto_scalarmult_curve25519_SCALARBYTES; }
#include "crypto_scalarmult_curve25519.h" size_t crypto_scalarmult_curve25519_bytes(void) { return crypto_scalarmult_curve25519_BYTES; } size_t crypto_scalarmult_curve25519_scalarbytes(void) { return crypto_scalarmult_curve25519_SCALARBYTES; }
Fix the test added in r260266
// RUN: %clang_cc1 -load %llvmshlibdir/PrintFunctionNames%pluginext -plugin print-fns %s 2>&1 | FileCheck %s // RUN: %clang_cl -Xclang -load -Xclang %llvmshlibdir/PrintFunctionNames%pluginext -Xclang -plugin -Xclang print-fns %s 2>&1 | FileCheck %s // REQUIRES: plugins, examples // CHECK: top-level-decl: "x" void x();...
// RUN: %clang_cc1 -load %llvmshlibdir/PrintFunctionNames%pluginext -plugin print-fns %s 2>&1 | FileCheck %s // RUN: %clang_cl -c -Xclang -load -Xclang %llvmshlibdir/PrintFunctionNames%pluginext -Xclang -plugin -Xclang print-fns -Tc %s 2>&1 | FileCheck %s // REQUIRES: plugins, examples // CHECK: top-level-decl: "x" vo...
Revert "Enable debug option for all components"
#ifndef _TSLIB_PRIVATE_H_ #define _TSLIB_PRIVATE_H_ /* * tslib/src/tslib-private.h * * Copyright (C) 2001 Russell King. * * This file is placed under the LGPL. * * * Internal touch screen library definitions. */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "tslib.h" #include "tslib-filt...
#ifndef _TSLIB_PRIVATE_H_ #define _TSLIB_PRIVATE_H_ /* * tslib/src/tslib-private.h * * Copyright (C) 2001 Russell King. * * This file is placed under the LGPL. * * * Internal touch screen library definitions. */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "tslib.h" #include "tslib-filt...
Add non-secure reset handler address
/* mbed Microcontroller Library * Copyright (c) 2015-2017 Nuvoton * * 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 requir...
/* mbed Microcontroller Library * Copyright (c) 2015-2017 Nuvoton * * 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 requir...
Add Task 01 from Homework 03
#include <stdio.h> #include <string.h> int is_valid_ucn(char*); int main() { char ucn[12]; fgets(ucn, 13, stdin); printf("%d", is_valid_ucn(ucn)); return 0; } int is_valid_ucn(char *ucn) { int control = 0, month = (ucn[2] - '0') * 10 + (ucn[3] - '0'); int length = strlen(u...
Add missing header file change.
//===--- ParentMap.h - Mappings from Stmts to their Parents -----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===-------------------------------------------------------...
//===--- ParentMap.h - Mappings from Stmts to their Parents -----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===-------------------------------------------------------...
Standardize most important error codes.
/************************************************************************** * * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Softwa...
Add a NOLINT to avoid a build/header_guard cpplint warning.
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Multiply-included file, hence no include guard. #include "xwalk/runtime/common/xwalk_common_messages.h"
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Multiply-included file, hence no include guard. // NOLINT(build/header_guard) #include "xwalk/runtime/common/xwalk_common_messages.h"
Adjust snp packet size to better accomodate small MTUs.
#pragma once #include <winsock2.h> #include "common/types.h" #define SNP_PACKET_SIZE 512 namespace sbat { namespace snp { enum class PacketType : byte { Storm = 0 }; #pragma pack(push) #pragma pack(1) // this packet info wraps the packets sent by storm/us with something that can be used to route it struct Packet...
#pragma once #include <winsock2.h> #include "common/types.h" namespace sbat { namespace snp { // min-MTU - (max-IP-header-size + udp-header-size) const size_t SNP_PACKET_SIZE = 576 - (60 + 8); enum class PacketType : byte { Storm = 0 }; #pragma pack(push) #pragma pack(1) // this packet info wraps the packets s...
Add Simpron integral approx. kata
#include <stdio.h> #include <math.h> #define SIMPSON_METHOD 1 double fun(double x) { return (3.0 / 2) * pow(sin(x), 3); } double simpson_helper(double (*f)(double), double from, double to, int steps) { double result = 0.0; double acc = 0.0; double h = (to - from) / steps; result += (*f)(from) + ...
Speed up Adler-32 by doing modulo less often
/* * adler32.c * * Adler-32 checksum algorithm. */ #include "adler32.h" u32 adler32(const u8 *buffer, size_t size) { u32 s1 = 1; u32 s2 = 0; for (size_t i = 0; i < size; i++) { s1 = (s1 + buffer[i]) % 65521; s2 = (s2 + s1) % 65521; } return (s2 << 16) | s1; }
/* * adler32.c * * Adler-32 checksum algorithm. */ #include "adler32.h" #include "compiler.h" /* * The Adler-32 divisor, or "base", value. */ #define DIVISOR 65521 /* * MAX_BYTES_PER_CHUNK is the most bytes that can be processed without the * possibility of s2 overflowing when it is represented as an unsigne...
Change "AUDIO_DEVICE" to "AUDIO_DEVICE_FDINDEX", and change its value. Add new "NO_DEVICE_FDINDEX".
/* To avoid recursion in certain includes */ #ifndef _RTDEFS_H_ #define _RTDEFS_H_ 1 #define MAXCHANS 4 #define MAX_INPUT_FDS 128 #define AUDIO_DEVICE 9999999 /* definition of input file desc struct used by rtinput */ typedef struct inputdesc { char filename[1024]; int fd; int refcount; short header_...
/* To avoid recursion in certain includes */ #ifndef _RTDEFS_H_ #define _RTDEFS_H_ 1 #define MAXCHANS 4 #define MAX_INPUT_FDS 128 #define NO_DEVICE_FDINDEX -1 #define AUDIO_DEVICE_FDINDEX -2 /* definition of input file desc struct used by rtinput */ typedef struct inputdesc { char filename[1024]; in...
Allow user to move fingers between own hands
#include <stdio.h> typedef struct { int hands[2][2]; int turn; } Sticks; void sticks_create(Sticks *sticks) { sticks->hands[0][0] = 1; sticks->hands[0][1] = 1; sticks->hands[1][0] = 1; sticks->hands[1][1] = 1; sticks->turn = 0; } void sticks_play(Sticks *sticks, int x, int y) { sticks...
#include <stdio.h> typedef struct { int hands[2][2]; int turn; } Sticks; void sticks_create(Sticks *sticks) { sticks->hands[0][0] = 1; sticks->hands[0][1] = 1; sticks->hands[1][0] = 1; sticks->hands[1][1] = 1; sticks->turn = 0; } void sticks_play(Sticks *sticks, int attack, int x, int y) ...
Add a timer utility to interval namespace
#ifndef INTERVAL_H #define INTERVAL_H namespace Interval{ class RepeatedInterval{ uint32_t next; uint32_t span; public: RepeatedInterval(uint32_t span): span(span) { next = millis() + span; } boolean operator()() { if(millis() > next){ next += span; ...
#ifndef INTERVAL_H #define INTERVAL_H namespace Interval{ class RepeatedInterval{ uint32_t next; uint32_t span; public: RepeatedInterval(uint32_t span): span(span) { next = millis() + span; } boolean operator()() { if(millis() > next){ next += span; ...
Enable clearing, use getline to read empty lines
#ifndef _WINDOW_H_ #define _WINDOW_H_ #include <string> #include <iostream> class Window { std::string title; public: Window(const std::string& title): title(title) {} virtual void handle() = 0; void drawTitle() { //#ifdef _WIN32 //std::system("cls"); //#else //assuming linux, yeah, I know ...
#ifndef _WINDOW_H_ #define _WINDOW_H_ #include <string> #include <iostream> #include <cstdlib> class Window { std::string title; public: Window(const std::string& title): title(title) {} virtual void handle() = 0; void drawTitle() { #ifdef _WIN32 std::system("cls"); #else //assuming linux, y...
Disable warning C4996 in amalgamation
#include "sampgdk.h" #if SAMPGDK_WINDOWS #undef CreateMenu #undef DestroyMenu #undef GetTickCount #undef KillTimer #undef SelectObject #undef SetTimer #define WIN32_LEAN_AND_MEAN #include <windows.h> #else #define _GNU_SOURCE #endif
#include "sampgdk.h" #if SAMPGDK_WINDOWS #ifdef _MSC_VER #pragma warning(disable: 4996) #endif #undef CreateMenu #undef DestroyMenu #undef GetTickCount #undef KillTimer #undef SelectObject #undef SetTimer #define WIN32_LEAN_AND_MEAN #include <windows.h> #else #define _GNU_SOURCE #endif
Split mul_div flag part to avoid bugs
#include "calc.h" #include <ctype.h> #include <stdio.h> #include <stdlib.h> double calc(const char* p, int mul_div_flag) { int i; double ans; ans = atof(p); if (p[0] != '(' && mul_div_flag == 1){ return (ans); } i = 0; while (p[i] != '\0'){ while (isdigit(p[i])){ ...
#include "calc.h" #include <ctype.h> #include <stdio.h> #include <stdlib.h> double calc(const char* p, int mul_div_flag) { int i; double ans; if (p[0] != '(' && mul_div_flag == 1){ return (atof(p)); } else if (p[0] == '('){ ans = 0; } else { ans = atof(p); } ...
Allow program to run to be specified on command line
#include <stdlib.h> #include <stdio.h> int main() { FILE *file; long length; char *buffer; file = fopen("example.minty", "r"); if (file == NULL) { return 1; } fseek(file, 0, SEEK_END); length = ftell(file); fseek(file, 0, SEEK_SET); buffer = (char *)malloc(length); fread(buffer, length, 1, file); fclose(...
#include <stdlib.h> #include <stdio.h> int main(int argc, char *argv[]) { FILE *file; long length; char *buffer; if (argc < 2) { return 1; } file = fopen(argv[1], "r"); if (file == NULL) { return 1; } fseek(file, 0, SEEK_END); length = ftell(file); fseek(file, 0, SEEK_SET); buffer = (char *)malloc(len...
Revert "tests: drivers: build_all: add fake serial device for modem tests"
/* * Copyright (c) 2012-2014 Wind River Systems, Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr.h> #include <sys/printk.h> #include <device.h> /* * @file * @brief Hello World demo */ void main(void) { printk("Hello World!\n"); } #if DT_NODE_EXISTS(DT_INST(0, vnd_gpio)) /* Fake GPIO devic...
/* * Copyright (c) 2012-2014 Wind River Systems, Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr.h> #include <sys/printk.h> #include <device.h> /* * @file * @brief Hello World demo */ void main(void) { printk("Hello World!\n"); } #if DT_NODE_EXISTS(DT_INST(0, vnd_gpio)) /* Fake GPIO devic...