Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add recipe for tftp-hpa package
# # base recipe: http://cgit.openembedded.org/cgit.cgi/meta-openembedded/tree/\ # meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb? # base branch: master # base commit: 98842e4e9f53f5f8614dd583dde9f5e898aadbb2 # SUMMARY = "Client for the Trivial File Transfer Protocol" DESCRIPTION = \ "The Trivial File Transfer Protocol (TFTP) is normally used only for \ booting diskless workstations. The tftp package provides the user \ interface for TFTP, which allows users to transfer files to and from a \ remote machine. This program and TFTP provide very little security, \ and should not be enabled unless it is expressly needed." HOMEPAGE = "http://git.kernel.org/cgit/network/tftp/tftp-hpa.git" PR = "r0" inherit debian-package LICENSE = "BSD-4-Clause" LIC_FILES_CHKSUM = "\ file://MCONFIG.in;beginline=1;endline=9;md5=c28ba5adb43041fae4629db05c83cbdd \ file://tftp/tftp.c;beginline=1;endline=32;md5=988c1cba99d70858a26cd877209857f4" DEBIAN_PATCH_TYPE = "nopatch" #Add tftpd-hpa package PACKAGES =+ "tftpd-hpa" do_install_append() { #Create new folders install -d ${D}${sysconfdir} install -d ${D}${sysconfdir}/init.d install -d ${D}${sysconfdir}/init install -d ${D}${bindir} install -d ${D}${sbindir} install -m 0755 ${S}/tftp/tftp \ ${D}${bindir} install -m 0755 ${S}/tftpd/tftpd \ ${D}${sbindir}/in.tftpd install -m 0644 ${S}/debian/tftpd-hpa.upstart \ ${D}${sysconfdir}/init/tftpd-hpa.conf install -m 0755 ${S}/debian/tftpd-hpa.init \ ${D}${sysconfdir}/init.d/tftpd-hpa } FILES_tftpd-hpa = "${sbindir}/in.tftpd \ ${sysconfdir}/* \ "
Upgrade to latest version with HEVC content.
DESCRIPTION = "AMSDK multimedia support files" HOMEPAGE = "https://gforge.ti.com/gf/project/am_multimedia/" LICENSE = "CC-BY-NC-ND-3.0 & CC-BY-3.0" SECTION = "multimedia" LIC_FILES_CHKSUM = "file://Multimedia_Data_Files_Manifest.doc;md5=9254447a504d2179d83a6bc9e2c28142" PR = "r0" COMPATIBLE_MACHINE = "(omap3|ti33x|ti43x|omap-a15)" PACKAGE_ARCH = "${MACHINE_ARCH}" VIDEO_FILES = "video_480p " VIDEO_FILES_append_am37x-evm = "video_vga_r" VIDEO_FILES_append_beagleboard = "video_vga" VIDEO_FILES_append_am3517-evm = "video_wqvga" VIDEO_FILES_append_ti33x = "video_wvga \ video_wqvga" VIDEO_FILES_append_dra7xx = "video_wvga \ video_1080p \ video_720p \ video_yuv" SRC_URI = "https://gforge.ti.com/gf/download/frsrelease/1251/7520/amsdk-av-files_${PV}.tar.gz;name=avfilestarball" S = "${WORKDIR}/amsdk-av-files" do_compile() { : } do_install() { install -d ${D}${datadir}/ti \ ${D}${datadir}/ti/audio \ ${D}${datadir}/ti/video install -m 0644 ${S}/audio/* ${D}${datadir}/ti/audio/ for file in ${VIDEO_FILES}; do install -m 0644 ${S}/${file}/* ${D}${datadir}/ti/video/ done } FILES_${PN} += "${datadir}/ti/*" SRC_URI[avfilestarball.md5sum] = "c4c849cf6c16e4898869264bbd05fd5d" SRC_URI[avfilestarball.sha256sum] = "287cc95a68befa594b8b9a8514c57240620d535b2b99c6d3e1f91bc278ef37ef"
Add a bitbake recipe to build logutils
SUMMARY = "Go package that augments the standard library "log" package" HOMEPAGE = "https://github.com/hashicorp/logutils" LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=b278a92d2c1509760384428817710378" PKG_NAME = "github.com/hashicorp/logutils" SRC_URI = "git://${PKG_NAME}.git" SRCREV = "0dc08b1671f34c4250ce212759ebd880f743d883" S = "${WORKDIR}/git" do_install() { install -d ${D}${prefix}/local/go/src/${PKG_NAME} cp -a ${S}/* ${D}${prefix}/local/go/src/${PKG_NAME}/ } SYSROOT_PREPROCESS_FUNCS += "logutils_sysroot_preprocess" logutils_sysroot_preprocess () { install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME} cp -a ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME}) } FILES_${PN} += "${prefix}/local/go/src/${PKG_NAME}/*"
Add recipe for python-setuptools package.
# base recipe: meta/recipes-devtools/python/python-setuptools_40.8.0.bb # base branch: warrior DESCRITPION = "Python Distutils Enhancements" SUMMARY = "Extensions to the python-distutils for large or complex distributions." require recipes-devtools/python/python-setuptools.inc inherit debian-package require recipes-debian/sources/python-setuptools.inc LICENSE = "Apache-2.0 " LIC_FILES_CHKSUM = "file://LICENSE;md5=9a33897f1bca1160d7aad3835152e158" FILESPATH_append = ":${COREBASE}/meta/recipes-devtools/python/files" PROVIDES = "python-distribute" inherit setuptools RREPLACES_${PN} = "python-distribute" RPROVIDES_${PN} = "python-distribute" RCONFLICTS_${PN} = "python-distribute"
Add new release if gpe-mixer.
LICENSE = "GPL" PR = "r0" inherit gpe pkgconfig DESCRIPTION = "GPE audio mixer" DEPENDS = "gtk+ libgpewidget" SECTION = "gpe" PRIORITY = "optional"
Add recipe for Azure IoT device python SDK
SUMMARY = "Microsoft Azure IoT Device Library" AUTHOR = "Microsoft Corporation" HOMEPAGE = "https://github.com/Azure/azure-iot-sdk-python/tree/master/azure-iot-device" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" inherit pypi setuptools3 RDEPENDS_${PN} += "\ ${PYTHON_PN}-janus \ ${PYTHON_PN}-paho-mqtt \ ${PYTHON_PN}-pysocks \ ${PYTHON_PN}-requests \ ${PYTHON_PN}-requests-unixsocket \ ${PYTHON_PN}-six \ ${PYTHON_PN}-transitions \ ${PYTHON_PN}-urllib3 \ " RDEPENDS_${PN} += "\ ${PYTHON_PN}-asyncio \ ${PYTHON_PN}-crypt \ ${PYTHON_PN}-datetime \ ${PYTHON_PN}-io \ ${PYTHON_PN}-json \ ${PYTHON_PN}-logging \ ${PYTHON_PN}-multiprocessing \ ${PYTHON_PN}-netclient \ " PR = "r0" SRC_URI[sha256sum] = "6186c9be8c25917a29ac9f432b484d5c28e428ec83a919926c77b0472d36abc7"
Add cryptography example C applications
DESCRIPTION = "TI Cryptography Example Applications" HOMEPAGE = "http://arago-project.org/git/projects/?p=crypto-example-apps.git;a=summary" LICENSE = "BSD" LIC_FILES_CHKSUM = "file://AES/aes_256.c;beginline=9;endline=35;md5=8edbb4dee965d2f2eb5ca2822addcae5" SECTION = "console" PR = "r0" BRANCH ?= "master" SRCREV = "d3cc223206367a02097c7ad4e997cf2bef975277" SRC_URI = "git://arago-project.org/git/projects/crypto-example-apps.git;protocol=git;branch=${BRANCH}" S = "${WORKDIR}/git" do_compile() { # build the release version oe_runmake release } do_install() { oe_runmake DESTDIR=${D} install }
Revert "[assassin] Remove curl in DEPENDS of assassin"
DESCRIPTION = "Action GUI for Installer" HOMEPAGE = "http://assassin.projects.openmoko.org/" LICENSE = "GPL" DEPENDS = "dbus (>= 1.1.1) glib-2.0 e-wm packagekit etk edbus eet" RDEPENDS = "etk-theme-ninja" PV = "0.2+svnr${SRCREV}" PR = "r6.03" SRC_URI = "svn://svn.projects.openmoko.org/svnroot/;module=assassin;proto=https" S = "${WORKDIR}/assassin" inherit autotools pkgconfig EXTRA_OECONF = "" FILES_${PN} += "${prefix}/share/*"
DESCRIPTION = "Action GUI for Installer" HOMEPAGE = "http://assassin.projects.openmoko.org/" LICENSE = "GPL" DEPENDS = "dbus (>= 1.1.1) glib-2.0 e-wm packagekit etk edbus eet curl" RDEPENDS = "etk-theme-ninja" PV = "0.2+svnr${SRCREV}" PR = "r6.02" SRC_URI = "svn://svn.projects.openmoko.org/svnroot/;module=assassin;proto=https" S = "${WORKDIR}/assassin" inherit autotools pkgconfig EXTRA_OECONF = "" FILES_${PN} += "${prefix}/share/*"
Remove curl in DEPENDS of assassin
DESCRIPTION = "Action GUI for Installer" HOMEPAGE = "http://assassin.projects.openmoko.org/" LICENSE = "GPL" DEPENDS = "dbus (>= 1.1.1) glib-2.0 e-wm packagekit etk edbus eet curl" RDEPENDS = "etk-theme-ninja" PV = "0.2+svnr${SRCREV}" PR = "r6.02" SRC_URI = "svn://svn.projects.openmoko.org/svnroot/;module=assassin;proto=https" S = "${WORKDIR}/assassin" inherit autotools pkgconfig EXTRA_OECONF = "" FILES_${PN} += "${prefix}/share/*"
DESCRIPTION = "Action GUI for Installer" HOMEPAGE = "http://assassin.projects.openmoko.org/" LICENSE = "GPL" DEPENDS = "dbus (>= 1.1.1) glib-2.0 e-wm packagekit etk edbus eet" RDEPENDS = "etk-theme-ninja" PV = "0.2+svnr${SRCREV}" PR = "r6.03" SRC_URI = "svn://svn.projects.openmoko.org/svnroot/;module=assassin;proto=https" S = "${WORKDIR}/assassin" inherit autotools pkgconfig EXTRA_OECONF = "" FILES_${PN} += "${prefix}/share/*"
Add recipe for libdshconfig package
DESCRIPTION = "\ Runtime library for configuration file parser,required for running \ programs with dsh config file support. \ dsh uses this library to parse configuration files." PR = "r0" inherit debian-package LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" inherit autotools-brokensep DEBIAN_PATCH_TYPE = "nopatch" #configure follow debian/rules EXTRA_OECONF = "--with-versioned-symbol" DEBIANNAME_${PN}-dev = "${PN}1-dev"
Add recipe for libdatetime-perl package
SUMMARY = "module for manipulating dates, times and timestamps" DESCRIPTION = "\ DateTime is a Perl module which aims to provide a complete, correct, and easy \ to use date/time object implementation. It provides an easy way to manipulate \ dates and times, including date calculations (even addition and subtraction) \ and provides convenient methods for extracting or modifying portions of any \ date or time. \ . \ This module supports the Olson time zone database, meaning that historical \ time zone information, and more importantly, daylight saving time rules, can \ be handled transparently, simply by setting the correct time zone. This is \ done by using the DateTime::TimeZone module. \ " HOMEPAGE = "http://datetime.perl.org/" PR = "r0" inherit debian-package LICENSE = "Artistic-2.0" LIC_FILES_CHKSUM = "\ file://LICENSE;md5=1d2e1c522435425bc51123e3d4782081" inherit cpan_build RDEPENDS_${PN} += "\ libparams-validate-perl libdatetime-locale-perl \ libdatetime-timezone-perl libtry-tiny-perl" # source format is 3.0 (quilt) but there is no debian patch DEBIAN_QUILT_PATCHES = "" do_install_append() { perl_version=${PERLVERSION} short_perl_version=`echo ${perl_version%.*}` install -d ${D}${libdir}/perl5/$short_perl_version mv ${D}${libdir}/perl/vendor_perl/${PERLVERSION}/* \ ${D}${libdir}/perl5/$short_perl_version } FILES_${PN} += "${libdir}/*" FILES_${PN}-dbg += "${libdir}/perl5/*/auto/DateTime/.debug"
Add recipe for libjson-perl package
SUMMARY = "module for manipulating JSON-formatted data" PR = "r0" inherit debian-package LICENSE = "GPL-1+" LIC_FILES_CHKSUM = "file://README;md5=309aa8b91686700797df6e79ceb678f0" inherit cpan FILES_${PN} += "${datadir}" BBCLASSEXTEND = "native nativesdk"
Add PSP version for ti816x devices.
require u-boot-omap3.inc COMPATIBLE_MACHINE = "ti816x" BRANCH = "master" # Use literal tags in SRCREV, when available, instead of commit IDs SRCREV = "v2010.06_TI816XPSP_04.00.00.10" UVER = "2010.06" PSPREL = "04.00.00.10" PR = "r1"
Add recipe for target, native and nativesdk use
SUMMARY = "UpdateHub utilities for update package management and server" SECTION = "devel/python" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://LICENSE;md5=d7d0c756730e640e1731676efa6782e9" SRC_URI = "git://github.com/UpdateHub/uhu.git;protocol=https" SRCREV = "fed71af14f79fdc8db8da90f63b8b3d59ea93174" PV = "1.0.0+${SRCPV}" S = "${WORKDIR}/git" inherit setuptools3 CLEANBROKEN = "1" do_install_append_class-native() { sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' ${D}${bindir}/uhu create_wrapper ${D}${bindir}/uhu LC_ALL=C.UTF-8 LANG=C.UTF-8 LOCPATH=/usr/lib/locale } # FIXME: The native package is not adding the runtime dependencies for # the sysroot populate. The issue is reported on YOCTO: #10113 do_populate_sysroot[rdeptask] = "do_populate_sysroot" # FIXME: Runtime dependency of python3-prompt-toolkit which is not handled # for native case. The issue is also related to YOCTO: #10113 RDEPENDS_${PN} += " \ python3-wcwidth \ python3-six \ " RDEPENDS_${PN} += " \ updatehub-package-schema \ python3-click \ python3-progress \ python3-requests \ python3-rfc3987 \ python3-jsonschema \ python3-prompt-toolkit \ python3-humanize \ " BBCLASSEXTEND = "native nativesdk"
Use increment-able PV format as other git version recipes do.
LICENSE = "BSD-X" SECTION = "x11/libs" PRIORITY = "optional" DEPENDS = "virtual/libx11 xcalibrateext libxext" DESCRIPTION = "XCalibrate client-side library" PV = "0.0+git4be232e30cd33a44a1ce6d3ec429ee6101540c62" SRC_URI = "git://anongit.freedesktop.org/git/xorg/lib/libXCalibrate;protocol=git;tag=4be232e30cd33a44a1ce6d3ec429ee6101540c62" S = "${WORKDIR}/git" inherit autotools pkgconfig do_stage() { autotools_stage_all }
LICENSE = "BSD-X" SECTION = "x11/libs" PRIORITY = "optional" DEPENDS = "virtual/libx11 xcalibrateext libxext" DESCRIPTION = "XCalibrate client-side library" PR = "r0" PV = "0.0+${PR}+gitr4be232e30cd33a44a1ce6d3ec429ee6101540c62" SRC_URI = "git://anongit.freedesktop.org/git/xorg/lib/libXCalibrate;protocol=git;tag=4be232e30cd33a44a1ce6d3ec429ee6101540c62" S = "${WORKDIR}/git" inherit autotools pkgconfig do_stage() { autotools_stage_all }
Test application for OMAP DRM interface
DESCRIPTION = "Test applications for OMAP DRM interface" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://viddec3test.c;beginline=1;endline=16;md5=c391f44e40a29096285e3121923041df" DEPENDS += "libdrm libdce libav" inherit autotools pkgconfig PR = "r3" SRCREV = "64e4e389dd8be4947c107a057f34556a4280281a" SRC_URI = "git://git.ti.com/glsdk/omapdrmtest.git;protocol=git" S = "${WORKDIR}/git" INSANE_SKIP_omapdrmtest = "dev-deps"
Add new release of gpe-filemanager.
inherit gpe PR = "r0" LICENSE = "GPL" DESCRIPTION = "GPE file manager" DEPENDS = "libgpewidget gnome-vfs dbus" SECTION = "gpe" RDEPENDS = "gpe-icons" RRECOMMENDS = "gnome-vfs-plugin-file" FILES_${PN} += " ${datadir}/gpe"
Refresh the GUI when mxLoggerObserverGUI updates text of a TGadget
Type mxLoggerObserverGUI Field m_output:Object Method Reset() If TGadget(m_output) SetGadgetText(TGadget(m_output), "") End If End Method Method SendMessage:Object(message:Object, context:Object) Local msg:String = String(message) If String(context) = "error" Notify(msg, True) Else If TGadget(m_output) Local gadget:TGadget = TGadget(m_output) SetGadgetText(gadget, GadgetText(gadget) + "~n" + String(message)) Else If m_output = Null Notify(msg) End If End Method End Type
Type mxLoggerObserverGUI Field m_output:Object Method Reset() If TGadget(m_output) SetGadgetText(TGadget(m_output), "") End If End Method Method SendMessage:Object(message:Object, context:Object) Local msg:String = String(message) If String(context) = "error" Notify(msg, True) Else If TGadget(m_output) Local gadget:TGadget = TGadget(m_output) SetGadgetText(gadget, GadgetText(gadget) + "~n" + String(message)) 'Refresh GUI Driver.Poll Else If m_output = Null Notify(msg) End If End Method End Type
Implement toHex supporting don't-care bits
function String toHex(Bit#(s) num); function String f(Bit#(s) n); String dig[16] = {"0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"}; return (n == 0) ? "" : f(n / 16) + dig[n % 16]; endfunction return (num == 0) ? "0" : f(num); endfunction
function Bit#(n) removeDontCares(Bit#(n) num); Bit#(n) res = 0; for(Integer i = 0; i < valueOf(n); i = i + 1) res[i] = (num[i] == 1'b1) ? 1'b1 : 1'b0; return res; endfunction function String toHex(Bit#(n) num) provisos ( Div#(n , 4, ndig), Mul#(ndig, 4, nadj), Add#(pad , n, nadj) ); String dig[16] = {"0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"}; Bit#(nadj) numadj = extend(removeDontCares(num)); String res = ""; for(Integer i = valueOf(nadj) - 1; i >= 0; i = i - 4) begin Bit#(4) dign = numadj[i:i-3]; res = res + dig[dign]; end return res; endfunction
Fix "Attempt to use this undetermined clock" Error
import Ethernet::*; (* always_ready, always_enabled *) interface DE5Pins; method Action osc_50(Bit#(1) b3d, Bit#(1) b4a, Bit#(1) b4d, Bit#(1) b7a, Bit#(1) b7d, Bit#(1) b8a, Bit#(1) b8d); method Action sfp(Bit#(1) refclk); method Action buttons(Bit#(4) v); // method Bit#(4) serial_tx_data; // method Action serial_rx(Bit#(4) data); interface SFPCtrl#(4) sfpctrl; // method Bit#(1) led0; // method Bit#(1) led1; // method Bit#(1) led2; method Bit#(1) led3; method Bit#(4) led_bracket; interface Clock deleteme_unused_clock; interface Clock deleteme_unused_clock2; interface Clock deleteme_unused_clock3; interface Reset deleteme_unused_reset; endinterface
import Ethernet::*; (* always_ready, always_enabled *) interface DE5Pins; method Action osc_50(Bit#(1) b3d, Bit#(1) b4a, Bit#(1) b4d, Bit#(1) b7a, Bit#(1) b7d, Bit#(1) b8a, Bit#(1) b8d); method Action sfp(Bit#(1) refclk); method Action buttons(Bit#(4) v); // method Bit#(4) serial_tx_data; // method Action serial_rx(Bit#(4) data); interface SFPCtrl#(4) sfpctrl; method Bit#(1) led0; // method Bit#(1) led1; // method Bit#(1) led2; method Bit#(1) led3; method Bit#(4) led_bracket; `ifndef BSIM interface Clock deleteme_unused_clock; interface Clock deleteme_unused_clock2; interface Clock deleteme_unused_clock3; interface Reset deleteme_unused_reset; `endif endinterface
Make sure Goto is only processed once
namespace BooJs.Compiler.Steps import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.Steps class ProcessGoto(AbstractTransformerCompilerStep): """ Process labels and goto statements The supported uses are very limited. It's only possible to jump to a label previously defined in the same function. No jumps to forward labels are allowed. Even if fully supporting goto statements with forward jumping is theoretically possible (similarly on how generators are transformed for example), it would be difficult to implement for the benefits it provides. TODO: Check implementation constraints. Referenced label can only be present in the same method and above the goto statement """ override def Run(): if len(Errors) > 0: return Visit CompileUnit def OnLabelStatement(node as LabelStatement): parent = node.ParentNode as Block index = parent.Statements.IndexOf(node) loop = [| while true: pass |] loop.Block.Statements = parent.Statements.PopRange(index+1) # We need to break out of the loop when we reach the end :) loop.Block.Statements.Add(BreakStatement()) parent.Statements.Add(loop)
namespace BooJs.Compiler.Steps import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.Steps class ProcessGoto(AbstractTransformerCompilerStep): """ Process labels and goto statements The supported uses are very limited. It's only possible to jump to a label previously defined in the same function. No jumps to forward labels are allowed. Even if fully supporting goto statements with forward jumping is theoretically possible (similarly on how generators are transformed for example), it would be difficult to implement for the benefits it provides. TODO: Check implementation constraints. Referenced label can only be present in the same method and above the goto statement """ override def Run(): if len(Errors) > 0: return Visit CompileUnit def OnLabelStatement(node as LabelStatement): # Make sure we only process the statement once if node.ContainsAnnotation(self): return node.Annotate(self) parent = node.ParentNode as Block index = parent.Statements.IndexOf(node) loop = [| while true: pass |] loop.Block.Statements = parent.Statements.PopRange(index+1) # We need to break out of the loop when we reach the end :) loop.Block.Statements.Add(BreakStatement()) parent.Statements.Add(loop)
Use sequence instead of self execution functions
namespace BooJs.Compiler.Steps import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.Steps class NormalizeGeneratorExpression(AbstractTransformerCompilerStep): """ Converts generator expressions to a simpler format: ( i*2 for i in range(3) ) --- { __gen = []; for i in range(3): __gen.push(i*2); return __gen }() """ def LeaveGeneratorExpression(node as GeneratorExpression): # ( i*2 for i as int in range(3) ) => ( expression for declarations in iterator if filter ) # Build a loop statement with the details from the generator loop = ForStatement() loop.Declarations = node.Declarations loop.Iterator = node.Iterator if not node.Filter: loop.Block = [| block: _gen.push($(node.Expression)) |].Body else: loop.Block = [| block: _gen.push($(node.Expression)) if $(node.Filter.Condition) |].Body # Build the body of the anonymous function body = [| block: $loop return _gen |].Body # Replace the generator expression with the result of executing the anonymous function ReplaceCurrentNode([| {_gen as (object)| $(body) }([]) |])
namespace BooJs.Compiler.Steps import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.Steps class NormalizeGeneratorExpression(AbstractTransformerCompilerStep): """ Converts generator expressions to a simpler format: ( i*2 for i in range(3) ) --- { __gen = []; for i in range(3): __gen.push(i*2); return __gen }() """ # Keep track of last visited method _method as Method def OnMethod(node as Method): last = _method _method = node super(node) _method = last def OnListLiteralExpression(node as ListLiteralExpression): """ If generator is contained in a list literal, remove the list literal """ if len(node.Items) == 1 and node.Items.First.NodeType == NodeType.GeneratorExpression: result = Visit(node.Items.First) ReplaceCurrentNode result return super(node) def LeaveGeneratorExpression(node as GeneratorExpression): """ Convert generator expressions to a sequence: ( i*2 for i in range(3) ) => @(__gen = [], Boo.each(range(3), { i | __gen.push(i*2) }), __gen) """ # Make sure the __gen variable is declared _method.Locals.Add(Local(node.LexicalInfo, '__gen')) if node.Filter: lambda = [| { $(node.Filter.Condition) and __gen.push( $(node.Expression) ) } |] else: lambda = [| { __gen.push( $(node.Expression) ) } |] lambda.LexicalInfo = node.LexicalInfo for decl in node.Declarations: lambda.Parameters.Add(ParameterDeclaration(node.LexicalInfo, Name: decl.Name)) result = [| @(__gen = [], Boo.each($(node.Iterator), $lambda), __gen) |] ReplaceCurrentNode result
Save the correct hyphy materials
global w; global t; global k; LIKELIHOOD_FUNCTION_OUTPUT = 1; RANDOM_STARTING_PERTURBATIONS = 1; /* Include relevant functions */ #include "matrices.mdl"; //rate matrices #include "GY94_Header.ibf"; /* Read in the data */ DataSet raw_data = ReadDataFile("temp.fasta"); /* Filter the data to find and remove any stop codons*/ DataSetFilter filt_data = CreateFilter(raw_data,3,"", "","TAA,TAG,TGA"); /* Collect observed frequencies into vectors */ HarvestFrequencies(observedFreq_data,filt_data,3,1,1); /* Get the codon frequencies from the nucleotide frequency vectors */ codonFreq_data = BuildCodonFrequencies(observedFreq_data); /* Define the model and tree */ Model MyModel = (GY94, codonFreq_data, 1); UseModel (USE_NO_MODEL); UseModel(MyModel); Tree Tree01 = DATAFILE_TREE; /*COMPUTE LIKELIHOODS*/ LikelihoodFunction LikFn2 = (filt_data, Tree01); Optimize (paramValues2, LikFn2); fprintf (stdout, LikFn2);
global w; global t; global k; LIKELIHOOD_FUNCTION_OUTPUT = 1; RANDOM_STARTING_PERTURBATIONS = 1; /* Include relevant functions */ #include "matrices_fix_k.mdl"; //rate matrices #include "GY94_Header.ibf"; /* Read in the data */ DataSet raw_data = ReadDataFile("temp.fasta"); /* Filter the data to find and remove any stop codons*/ DataSetFilter filt_data = CreateFilter(raw_data,3,"", "","TAA,TAG,TGA"); /* Collect observed frequencies into vectors */ HarvestFrequencies(observedFreq_data,filt_data,3,1,1); /* Get the codon frequencies from the nucleotide frequency vectors */ codonFreq_data = BuildCodonFrequencies(observedFreq_data); /* Define the model and tree */ Model MyModel = (GY94, codonFreq_data, 1); UseModel (USE_NO_MODEL); UseModel(MyModel); Tree Tree01 = DATAFILE_TREE; /*COMPUTE LIKELIHOODS*/ LikelihoodFunction LikFn2 = (filt_data, Tree01); Optimize (paramValues2, LikFn2); fprintf (stdout, LikFn2);
Add filling char to bf
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ f >+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ i >++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ z >++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ b >+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ u >++++++++++ lf > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ set loop num > leave 0 for exit flag > +++ set cycle num >>>> +++++ set second cycle num <<<< << back to cycle [ >> cycle check [ - decrement cycle num >+>+<< sets zero flags bit to 1 [ >[-]>[-]<< sets temp bit to 0 in case it's still not 0 < go to exit this is why we need 2 zero ] >> check if zero flag is on [ <<<<<<<<<<.>.>..>>>>>>>> fizz <<+++>> restore cycle number [-]<[-] zero the flags ] < back to cycle num < back to exit flag ] >>>>> cycle check [ - decrement cycle num >+>+<< sets zero flags bit to 1 [ >[-]>[-]<< sets temp bit to 0 in case it's still not 0 < go to exit this is why we need 2 zero ] >> check if zero flag is on [ <<<<<<<<<<<.>.<<..>>>>>>>>>>>> buzz <<+++++>> restore cycle number [-]<[-] zero the flags ] < back to cycle num < back to exit flag ] <<<< <<.>> new line <- ]
+++++++++++++++++++++++++++++++++++++++++++++ empty line sign >++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ f >+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ i >++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ z >++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ b >+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ u >++++++++++ lf > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ set loop num > leave 0 for exit flag >>> +++ set cycle num >>>> +++++ set second cycle num <<<<<< << back to cycle [ >+>+ set else flag (when no cycle is zero) >> cycle check [ - decrement cycle num >+>+<< sets zero flags bit to 1 [ >[-]>[-]<< sets temp bit to 0 in case it's still not 0 < go to exit this is why we need 2 zero ] >> check if zero flag is on [ <<<<<<<<<<<<.>.>..>>>>>>>>>> fizz <<<<[-]<[-]>>>>> remove else flags <<+++>> restore cycle number [-]<[-] zero the flags ] < back to cycle num < back to exit flag ] >>>>> cycle check [ - decrement cycle num >+>+<< sets zero flags bit to 1 [ >[-]>[-]<< sets temp bit to 0 in case it's still not 0 < go to exit this is why we need 2 zero ] >> check if zero flag is on [ <<<<<<<<<<<<<.>.<<..>>>>>>>>>>>>>> buzz <<<<<<<<[-]<[-]>>>>>>>>> remove else flags <<+++++>> restore cycle number [-]<[-] zero the flags ] < back to cycle num < back to exit flag ] <<<<<<< back to loop > [ <<<<<<<<.>>>>>>>> new line [-] ] < <.> - decrement loop ]
Revert "Removes kafka from main config"
# Copyright (C) 2016, Missouri Cyber Team # All Rights Reserved # See the file "LICENSE" in the main distribution directory for details module ROCK; export { const sensor_id = "sensor001-001" &redef; } # Load integration with Snort on ROCK @load ./frameworks/files/unified2-integration # Load integration with FSF @load ./frameworks/files/extract2fsf # Load file extraction @load ./frameworks/files/extraction redef FileExtract::prefix = "/data/bro/logs/extract_files/"; redef FileExtract::default_limit = 1048576000; # Add GeoIP info to conn log @load ./misc/conn-add-geoip # Add worker information to conn log @load ./misc/conn-add-worker
# Copyright (C) 2016, Missouri Cyber Team # All Rights Reserved # See the file "LICENSE" in the main distribution directory for details module ROCK; export { const sensor_id = "sensor001-001" &redef; } # Load integration with Snort on ROCK @load ./frameworks/files/unified2-integration # Load integration with FSF @load ./frameworks/files/extract2fsf # Load file extraction @load ./frameworks/files/extraction redef FileExtract::prefix = "/data/bro/logs/extract_files/"; redef FileExtract::default_limit = 1048576000; # Configure Kafka output # Bro Kafka Output (plugin must be loaded!) @load Kafka/KafkaWriter/logs-to-kafka redef KafkaLogger::topic_name = "bro_raw"; redef KafkaLogger::sensor_name = ROCK::sensor_id; # Add GeoIP info to conn log @load ./misc/conn-add-geoip # Add worker information to conn log @load ./misc/conn-add-worker
Add archive formats from upstream.
@load ../__load__.bro module FileExtraction; const archive_types: set[string] = { "application/x-rar-compressed", "application/x-bzip2", "application/gzip", "application/x-lzma", "application/x-lzip", "application/x-xz", "application/x-lzop", "application/x-compress", "application/x-7z-compressed", "application/x-ace-compressed", "application/vnd.ms-cab-compressed", "application/x-gtar", "application/zip", }; hook FileExtraction::extract(f: fa_file, meta: fa_metadata) &priority=5 { if ( meta$mime_type in archive_types ) break; }
Add default value for enable_software_deduplication
##! Packet source using Napatech module Napatech; export { ## The size of the software deduplication lru cache const dedupe_lru_size = 1024 &redef; ## Because applications can share streams, the Host Buffer Allowance ## allows an application to consume a portion of the host buffer ## before the application stops receiving traffic. ## For Bro, you most likely want to set this to 100 const host_buffer_allowance = 100 &redef; }
##! Packet source using Napatech module Napatech; export { ## Should the plugin try to deduplicate packets with the color1 ## value of the DYN4 packet descriptor? const enable_software_deduplication = T &redef; ## The size of the software deduplication lru cache const dedupe_lru_size = 1024 &redef; ## Because applications can share streams, the Host Buffer Allowance ## allows an application to consume a portion of the host buffer ## before the application stops receiving traffic. ## For Bro, you most likely want to set this to 100 const host_buffer_allowance = 100 &redef; }
Add return statement in demo_filter.c
#include "filters_api.h" static PF_FILTER_RESULT demo_filter_keyboard_event(connectionInfo* info, void* param) { proxyKeyboardEventInfo* event_data = (proxyKeyboardEventInfo*) param; return FILTER_PASS; } static PF_FILTER_RESULT demo_filter_mouse_event(connectionInfo* info, void* param) { proxyMouseEventInfo* event_data = (proxyMouseEventInfo*) param; if (event_data->x % 100 == 0) { return FILTER_DROP; } return FILTER_PASS; } bool filter_init(proxyEvents* events) { events->KeyboardEvent = demo_filter_keyboard_event; events->MouseEvent = demo_filter_mouse_event; }
#include "filters_api.h" static PF_FILTER_RESULT demo_filter_keyboard_event(connectionInfo* info, void* param) { proxyKeyboardEventInfo* event_data = (proxyKeyboardEventInfo*) param; return FILTER_PASS; } static PF_FILTER_RESULT demo_filter_mouse_event(connectionInfo* info, void* param) { proxyMouseEventInfo* event_data = (proxyMouseEventInfo*) param; if (event_data->x % 100 == 0) { return FILTER_DROP; } return FILTER_PASS; } bool filter_init(proxyEvents* events) { events->KeyboardEvent = demo_filter_keyboard_event; events->MouseEvent = demo_filter_mouse_event; return true; }
Add sent_messages array to testable controller interface
#import <Foundation/Foundation.h> @class WKInterfaceController; @class FakeInterfaceController; @protocol TestableWKInterfaceController <NSObject> - (void)awakeWithContext:(id)context; - (void)willActivate; - (void)didDeactivate; @optional - (void)pushControllerWithName:(NSString *)name context:(id)context; - (void)presentControllerWithName:(NSString *)name context:(id)context; @end
#import <Foundation/Foundation.h> @class WKInterfaceController; @class FakeInterfaceController; @protocol TestableWKInterfaceController <NSObject> - (void)awakeWithContext:(id)context; - (void)willActivate; - (void)didDeactivate; @optional - (NSArray *)sent_messages; - (void)pushControllerWithName:(NSString *)name context:(id)context; - (void)presentControllerWithName:(NSString *)name context:(id)context; @end
Add chapter 1 extra exercises
#include <stdio.h> main() { float fahr, celsius; float lower, upper, step; lower = 0; upper = 300; step = 20; celsius = lower; printf("%6s\t%3s\n", "celsius", "fahr"); while (celsius <= upper) { fahr = celsius * (9.0/5.0) + 32.0; printf("%6.1f\t%3.0f\n", celsius, fahr); celsius = celsius + step; } }
Add class comment. Reduce indirections in using statement.
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/vespalib/util/threadstackexecutorbase.h> namespace proton { class ExecutorThreadingServiceStats { public: using Stats = vespalib::ThreadStackExecutorBase::Stats; private: Stats _masterExecutorStats; Stats _indexExecutorStats; Stats _summaryExecutorStats; Stats _indexFieldInverterExecutorStats; Stats _indexFieldWriterExecutorStats; Stats _attributeFieldWriterExecutorStats; public: ExecutorThreadingServiceStats(Stats masterExecutorStats, Stats indexExecutorStats, Stats summaryExecutorStats, Stats indexFieldInverterExecutorStats, Stats indexFieldWriterExecutorStats, Stats attributeFieldWriterExecutorStats); ~ExecutorThreadingServiceStats(); const Stats &getMasterExecutorStats() const { return _masterExecutorStats; } const Stats &getIndexExecutorStats() const { return _indexExecutorStats; } const Stats &getSummaryExecutorStats() const { return _summaryExecutorStats; } const Stats &getIndexFieldInverterExecutorStats() const { return _indexFieldInverterExecutorStats; } const Stats &getIndexFieldWriterExecutorStats() const { return _indexFieldWriterExecutorStats; } const Stats &getAttributeFieldWriterExecutorStats() const { return _attributeFieldWriterExecutorStats; } }; }
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <cstddef> #include <vespa/vespalib/util/executor_stats.h> namespace proton { /* * This class contains executor stats for the executors used by a * document db. */ class ExecutorThreadingServiceStats { public: using Stats = vespalib::ExecutorStats; private: Stats _masterExecutorStats; Stats _indexExecutorStats; Stats _summaryExecutorStats; Stats _indexFieldInverterExecutorStats; Stats _indexFieldWriterExecutorStats; Stats _attributeFieldWriterExecutorStats; public: ExecutorThreadingServiceStats(Stats masterExecutorStats, Stats indexExecutorStats, Stats summaryExecutorStats, Stats indexFieldInverterExecutorStats, Stats indexFieldWriterExecutorStats, Stats attributeFieldWriterExecutorStats); ~ExecutorThreadingServiceStats(); const Stats &getMasterExecutorStats() const { return _masterExecutorStats; } const Stats &getIndexExecutorStats() const { return _indexExecutorStats; } const Stats &getSummaryExecutorStats() const { return _summaryExecutorStats; } const Stats &getIndexFieldInverterExecutorStats() const { return _indexFieldInverterExecutorStats; } const Stats &getIndexFieldWriterExecutorStats() const { return _indexFieldWriterExecutorStats; } const Stats &getAttributeFieldWriterExecutorStats() const { return _attributeFieldWriterExecutorStats; } }; }
Use new API on one or more tests
#include "test_parser.h" void one_or_more_one(void **state) { grammar_t *grammar = grammar_init( non_terminal("One"), rule_init( "One", one_or_more( terminal("11") ) ), 1 ); parse_t *result = parse("11", grammar); assert_non_null(result); assert_int_equal(result->length, 2); assert_int_equal(result->n_children, 1); } void one_or_more_many(void **state) { grammar_t *grammar = grammar_init( non_terminal("One"), rule_init( "One", one_or_more( terminal("11") ) ), 1 ); parse_t *result = parse("1111111", grammar); assert_non_null(result); assert_int_equal(result->length, 6); assert_int_equal(result->n_children, 3); } void one_or_more_failure(void **state) { grammar_t *grammar = grammar_init( non_terminal("One"), rule_init( "One", one_or_more( terminal("11") ) ), 1 ); parse_t *result = parse("1", grammar); assert_null(result); }
#include "test_parser.h" void one_or_more_one(void **state) { grammar_t *grammar = grammar_init( non_terminal("One"), rule_init( "One", one_or_more( terminal("11") ) ), 1 ); parse_result_t *result = parse("11", grammar); assert_non_null(result); assert_true(is_success(result)); parse_t *suc = result->data.result; assert_int_equal(suc->length, 2); assert_int_equal(suc->n_children, 1); } void one_or_more_many(void **state) { grammar_t *grammar = grammar_init( non_terminal("One"), rule_init( "One", one_or_more( terminal("11") ) ), 1 ); parse_result_t *result = parse("1111111", grammar); assert_non_null(result); assert_true(is_success(result)); parse_t *suc = result->data.result; assert_int_equal(suc->length, 6); assert_int_equal(suc->n_children, 3); } void one_or_more_failure(void **state) { grammar_t *grammar = grammar_init( non_terminal("One"), rule_init( "One", one_or_more( terminal("11") ) ), 1 ); parse_result_t *result = parse("1", grammar); assert_non_null(result); assert_true(is_error(result)); }
Remove nasty character at end of file that prevents compiles
#include <stdio.h> #include "jpeglib.h" #include <setjmp.h> struct error_mgr2 { struct jpeg_error_mgr pub; /* "public" fields */ jmp_buf setjmp_buffer; /* for return to caller */ }; typedef struct error_mgr2 * error_ptr2; /* * Here's the routine that will replace the standard error_exit method: */ void error_exit (j_common_ptr cinfo) { /* cinfo->err really points to a error_mgr2 struct, so coerce pointer */ error_ptr2 myerr = (error_ptr2) cinfo->err; /* Return control to the setjmp point */ longjmp(myerr->setjmp_buffer, 1); } 
#include <stdio.h> #include "jpeglib.h" #include <setjmp.h> struct error_mgr2 { struct jpeg_error_mgr pub; /* "public" fields */ jmp_buf setjmp_buffer; /* for return to caller */ }; typedef struct error_mgr2 * error_ptr2; /* * Here's the routine that will replace the standard error_exit method: */ void error_exit (j_common_ptr cinfo) { /* cinfo->err really points to a error_mgr2 struct, so coerce pointer */ error_ptr2 myerr = (error_ptr2) cinfo->err; /* Return control to the setjmp point */ longjmp(myerr->setjmp_buffer, 1); }
Change size of bool to 4
#pragma once #ifdef bool #undef bool #endif typedef char bool; #define true 1 #define false 0 typedef struct carp_thread* carp_thread_t; typedef void(*carp_thread_routine)(void* arg); typedef struct carp_library* carp_library_t; /* Init/shutdown */ void carp_platform_init(); void carp_platform_shutdown(); /* --- Threads --- */ carp_thread_t carp_thread_create(carp_thread_routine thread_routine, void* arg); void carp_thread_destroy(carp_thread_t thread); /* --- Timing --- */ int carp_millitime(); /* --- Libraries --- */ carp_library_t carp_load_library(const char* name); int carp_unload_library(carp_library_t lib); void* carp_find_symbol(carp_library_t lib, const char * name); char* carp_get_load_library_error(); /* -- misc -- */ void carp_sleep(int millis); typedef enum CARP_PLATFORM { CARP_PLATFORM_OSX = 0, CARP_PLATFORM_WINDOWS = 1, CARP_PLATFORM_LINUX = 2, CARP_PLATFORM_UNKNOWN = 100 } CARP_PLATFORM; CARP_PLATFORM carp_get_platform(); typedef struct { int count; void *data; } Array;
#pragma once #ifdef bool #undef bool #endif typedef int bool; #define true 1 #define false 0 typedef struct carp_thread* carp_thread_t; typedef void(*carp_thread_routine)(void* arg); typedef struct carp_library* carp_library_t; /* Init/shutdown */ void carp_platform_init(); void carp_platform_shutdown(); /* --- Threads --- */ carp_thread_t carp_thread_create(carp_thread_routine thread_routine, void* arg); void carp_thread_destroy(carp_thread_t thread); /* --- Timing --- */ int carp_millitime(); /* --- Libraries --- */ carp_library_t carp_load_library(const char* name); int carp_unload_library(carp_library_t lib); void* carp_find_symbol(carp_library_t lib, const char * name); char* carp_get_load_library_error(); /* -- misc -- */ void carp_sleep(int millis); typedef enum CARP_PLATFORM { CARP_PLATFORM_OSX = 0, CARP_PLATFORM_WINDOWS = 1, CARP_PLATFORM_LINUX = 2, CARP_PLATFORM_UNKNOWN = 100 } CARP_PLATFORM; CARP_PLATFORM carp_get_platform(); typedef struct { int count; void *data; } Array;
Document the transformation matrix class
//Copyright (c) 2020 Ultimaker B.V. //CuraEngine is released under the terms of the AGPLv3 or higher. #ifndef FMATRIX3X3_H #define FMATRIX3X3_H namespace cura { class Point3; class FPoint3; class FMatrix3x3 { public: double m[3][3]; FMatrix3x3(); Point3 apply(const FPoint3& p) const; }; } //namespace cura #endif //FMATRIX3X3_H
//Copyright (c) 2020 Ultimaker B.V. //CuraEngine is released under the terms of the AGPLv3 or higher. #ifndef FMATRIX3X3_H #define FMATRIX3X3_H namespace cura { class Point3; class FPoint3; /*! * A 3x3 linear transformation matrix. */ class FMatrix3x3 { public: /*! * The matrix data, row-endian. * * The first index is the column. The second index is the row. */ double m[3][3]; /*! * Construct an identity matrix. */ FMatrix3x3(); /*! * Apply this transformation to a coordinate. * * The result will also be converted to an integer-based coordinate * (``Point3``). * \param p The coordinate to transform. * \return A transformed coordinate. */ Point3 apply(const FPoint3& p) const; }; } //namespace cura #endif //FMATRIX3X3_H
Add include for math.h to lin hash
#ifndef TEST_LINEAR_HASH_H_ #define TEST_LINEAR_HASH_H_ #include <stdio.h> #include <string.h> #include <limits.h> #include "../../../planckunit/src/planck_unit.h" #include "../../../../dictionary/linear_hash/linear_hash.h" #ifdef __cplusplus extern "C" { #endif void runalltests_linear_hash(); #ifdef __cplusplus } #endif #endif
#ifndef TEST_LINEAR_HASH_H_ #define TEST_LINEAR_HASH_H_ #include <stdio.h> #include <string.h> #include <limits.h> #include <math.h> #include "../../../planckunit/src/planck_unit.h" #include "../../../../dictionary/linear_hash/linear_hash.h" #ifdef __cplusplus extern "C" { #endif void runalltests_linear_hash(); #ifdef __cplusplus } #endif #endif
Fix silly mistake in test.
// RUN: clang-cc -emit-llvm %s -o - typedef short __v4hi __attribute__ ((__vector_size__ (8))); void f() { __v4hi A = (__v4hi)0LL; } __v4hi x = {1,2,3}; __v4hi y = {1,2,3,4}; typedef int x __attribute((vector_size(16))); int a() { x b; return b[2LL]; }
// RUN: clang-cc -emit-llvm %s -o - typedef short __v4hi __attribute__ ((__vector_size__ (8))); void f() { __v4hi A = (__v4hi)0LL; } __v4hi x = {1,2,3}; __v4hi y = {1,2,3,4}; typedef int vty __attribute((vector_size(16))); int a() { vty b; return b[2LL]; }
Add GET message integration test - Make unit testing write fuller test objects - Make the number of buckets/keys in dummy object configurable - Add several helper functions like comparing binaries and objects - Improve error reporting in testing async callbacks
/********************************************************************* * * test_log.c: Riak C Unit Testing logger * * Copyright (c) 2007-2014 Basho Technologies, Inc. All Rights Reserved. * * This file is provided to you under the Apache License, * Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain * a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *********************************************************************/ #include <stdlib.h> #include <stdio.h> #include <stddef.h> #include <string.h> #include <time.h> #include "riak.h" void test_log(void *ptr, riak_log_level_t level, const char *file, riak_size_t filelen, const char *func, riak_size_t funclen, riak_uint32_t line, const char *format, va_list args) { time_t ltime; struct tm result; char stime[32]; char output[2048]; ltime = time(NULL); localtime_r(&ltime, &result); strftime(stime, sizeof(stime), "%F %X %Z", &result); riak_size_t wrote = snprintf(output, sizeof(output), "%s %s ", stime, riak_log_level_description(level)); char *pos = output + wrote; wrote += vsnprintf(pos, sizeof(output)-wrote, format, args); if (wrote < sizeof(output)-1) { strcat(output, "\n"); } // Just spew any output to stderr fprintf(stderr, "%s", output); }
Set one LED group on for light aiming
/** * "Aim lights" light script * * Turn on all the lights for 30 seconds so they can be aimed */ // Copied from todbot // format of light script lines: duration, command, arg1,arg2,arg3 typedef struct _blinkm_script_line { uint8_t dur; uint8_t cmd[4]; // cmd,arg1,arg2,arg3 } blinkm_script_line; // start dark, lighten to mid-day, then slowly fade away blinkm_script_line script_lines[] = { { 1, {'f', 1,00,00}}, // fade speed (slow) { 1, {'t', 1,0,0}}, // time adjust (slower) { 300, {'c', 0xff,0xff,0xff}}, // stay bright for mid-day { 100, {'c', 0x00,0x00,0x00}}, // fade to black };
Add definition for Physical Presence storage flag.
/** @file Define the variable data structures used for physical presence storage data. Copyright (c) 2016, Intel Corporation. All rights reserved. <BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef __TCG_PHYSICAL_PRESENCE_STORAGE_DATA_GUID_H__ #define __TCG_PHYSICAL_PRESENCE_STORAGE_DATA_GUID_H__ #define EFI_TCG_PHYSICAL_PRESENCE_STORAGE_DATA_GUID \ { \ 0x2EBE3E34, 0xB3CD, 0x471A, { 0xBF, 0x87, 0xB3, 0xC6, 0x6E, 0xE0, 0x74, 0x9A} \ } // // This variable is used to save TCG2 Management Flags and corresponding operations. // It should be protected from malicious software (e.g. Set it as read-only variable). // #define TCG_PHYSICAL_PRESENCE_STORAGE_FLAGS_VARIABLE L"TcgPhysicalPresenceStorageFlags" typedef struct { UINT32 PPFlags; } EFI_TCG_PHYSICAL_PRESENCE_STORAGE_FLAGS; extern EFI_GUID gEfiTcgPhysicalPresenceStorageGuid; #endif
Add closing bracket to open function in task 02 homework 02
#include <stdio.h> #include <string.h> char* find(char *haystack, char needle); int main(){ char input[401]={'\0'}, symbol, *result; fgets(input, 401, stdin); symbol=getchar(); result=find(input, symbol); if(result!=NULL){ printf("%ld", result - input); } else{ printf("-1"); } return 0; } char* find(char *haystack, char needle){ int i; char *result=NULL; for(i=0; i<400 && haystack[i]!='\0'; i++){ if(haystack[i]==needle){ result=&haystack[i]; break; } } return result;
#include <stdio.h> #include <string.h> char* find(char *haystack, char needle); int main(){ char input[401]={'\0'}, symbol, *result; fgets(input, 401, stdin); symbol=getchar(); result=find(input, symbol); if(result!=NULL){ printf("%d", (int)(result - input)); } else{ printf("-1"); } return 0; } char* find(char *haystack, char needle){ int i; char *result=NULL; for(i=0; i<400 && haystack[i]!='\0'; i++){ if(haystack[i]==needle){ result=&haystack[i]; break; } } return result; }
Reduce example uses additive calls
/* * example2.c * * Created on: 3 May 2016 * Author: nick */ #include "ndm.h" #include <mpi.h> #include <stdio.h> void recvFunction(void*, NDM_Metadata); int main(int argc, char* argv[]) { int provided; MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided); ndmInit(); char uuid[10]; int data = 10; ndmReduce(&data, 1, NDM_INT, NDM_SUM, recvFunction, 0, NDM_GLOBAL_GROUP, "a"); ndmGroupRank(NDM_GLOBAL_GROUP, &data); ndmAllReduce(&data, 1, NDM_INT, NDM_MAX, recvFunction, NDM_GLOBAL_GROUP, "maxrank"); ndmFinalise(); MPI_Finalize(); return 0; } void recvFunction(void* buffer, NDM_Metadata metaData) { printf("Got reduction data '%d' with uuid %s on pid %d\n", *((int*)buffer), metaData.unique_id, metaData.my_rank); }
/* * example2.c * * Created on: 3 May 2016 * Author: nick */ #include "ndm.h" #include <mpi.h> #include <stdio.h> void recvFunction(void*, NDM_Metadata); void additiveRecvFunction(void*, NDM_Metadata); int main(int argc, char* argv[]) { int provided; MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided); ndmInit(); char uuid[10]; int data = 10; ndmReduce(&data, 1, NDM_INT, NDM_SUM, recvFunction, 0, NDM_GLOBAL_GROUP, "a"); ndmGroupRank(NDM_GLOBAL_GROUP, &data); ndmAllReduce(&data, 1, NDM_INT, NDM_MAX, recvFunction, NDM_GLOBAL_GROUP, "maxrank"); data = 5; ndmReduceAdditive(&data, 1, NDM_INT, 12, 1, 0, NDM_SUM, additiveRecvFunction, 0, NDM_GLOBAL_GROUP, "additive"); ndmReduceAdditive(&data, 1, NDM_INT, 12, 1, 0, NDM_SUM, additiveRecvFunction, 0, NDM_GLOBAL_GROUP, "additive"); ndmFinalise(); MPI_Finalize(); return 0; } void recvFunction(void* buffer, NDM_Metadata metaData) { printf("Got reduction data '%d' with uuid %s on pid %d\n", *((int*)buffer), metaData.unique_id, metaData.my_rank); } void additiveRecvFunction(void* buffer, NDM_Metadata metaData) { printf("Got additive data '%d'\n", *((int*)buffer)); }
Fix type signatures for some java bulit-ins
#ifndef __JniHelpersCommon_h__ #define __JniHelpersCommon_h__ // Disable some annoying compiler warnings #if WIN32 #pragma warning(disable: 4996) // "Security" warnings for vsnprintf #endif #if WIN32 #define EXPORT __declspec(dllexport) #else #define EXPORT #endif #include <jni.h> #define kTypeInt "I" #define kTypeLong "J" #define kTypeFloat "F" #define kTypeDouble "D" #define kTypeBool "Z" #define kTypeByte "B" #define kTypeVoid "V" // Common Java classes #define kTypeJavaClass(x) "Ljava/lang/" #x ";" #define kTypeJavaException "L/java/lang/Exception" #define kTypeJavaString "Ljava/lang/String" // Array builder macro #define kTypeArray(x) "[" x #endif // __JniHelpersCommon_h__
#ifndef __JniHelpersCommon_h__ #define __JniHelpersCommon_h__ // Disable some annoying compiler warnings #if WIN32 #pragma warning(disable: 4996) // "Security" warnings for vsnprintf #endif #if WIN32 #define EXPORT __declspec(dllexport) #else #define EXPORT #endif #include <jni.h> #define kTypeInt "I" #define kTypeLong "J" #define kTypeFloat "F" #define kTypeDouble "D" #define kTypeBool "Z" #define kTypeByte "B" #define kTypeVoid "V" // Common Java classes #define kTypeJavaClass(x) "Ljava/lang/" #x ";" #define kTypeJavaException "Ljava/lang/Exception;" #define kTypeJavaString "Ljava/lang/String;" // Array builder macro #define kTypeArray(x) "[" x #endif // __JniHelpersCommon_h__
Add calibration file for board J2 (MAV102)
/* * conf_imu_rev4.h * * Created: 20/11/2013 22:21:49 * Author: sfx */ #ifndef CONF_IMU_REV4_H_ #define CONF_IMU_REV4_H_ #define RAW_GYRO_X 0 #define RAW_GYRO_Y 1 #define RAW_GYRO_Z 2 #define RAW_ACC_X 0 #define RAW_ACC_Y 1 #define RAW_ACC_Z 2 #define RAW_COMPASS_X 2 #define RAW_COMPASS_Y 0 #define RAW_COMPASS_Z 1 // from datasheet: FS 2000dps --> 70 mdps/digit // scale = 1/(0.07 * PI / 180.0) = 818.5111 #define RAW_GYRO_X_SCALE 818.5111 #define RAW_GYRO_Y_SCALE 818.5111 #define RAW_GYRO_Z_SCALE 818.5111 #define GYRO_AXIS_X 1.0 #define GYRO_AXIS_Y -1.0 #define GYRO_AXIS_Z -1.0 #define RAW_ACC_X_SCALE 4033.35 #define RAW_ACC_Y_SCALE 3997.92 #define RAW_ACC_Z_SCALE 4081.49 #define ACC_BIAIS_X -123.22 #define ACC_BIAIS_Y 143.87 #define ACC_BIAIS_Z 207.7505405 #define ACC_AXIS_X 1.0 #define ACC_AXIS_Y -1.0 #define ACC_AXIS_Z -1.0 #define RAW_MAG_X_SCALE 619.57 #define RAW_MAG_Y_SCALE 638.39 #define RAW_MAG_Z_SCALE 563.41 #define MAG_BIAIS_X -121.169232 #define MAG_BIAIS_Y -189.6727777 #define MAG_BIAIS_Z -162.58148486 #define MAG_AXIS_X -1.0 #define MAG_AXIS_Y -1.0 #define MAG_AXIS_Z -1.0 #endif /* CONF_IMU_REV4_H_ */
Put SynapticsSHM back into the driver to be able to use synclient -m once again
/* * 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 that copyright notice and this permission notice * appear in supporting documentation, and that the name of Red Hat * not be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. Red * Hat makes no representations about the suitability of this software * for any purpose. It is provided "as is" without express or implied * warranty. * * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _SYNAPTICS_H_ #define _SYNAPTICS_H_ #include <X11/Xdefs.h> /****************************************************************************** * Public definitions. * Used by driver and the shared memory configurator *****************************************************************************/ #define SHM_SYNAPTICS 23947 typedef struct _SynapticsSHM { int version; /* Driver version */ /* Current device state */ int x, y; /* actual x, y coordinates */ int z; /* pressure value */ int numFingers; /* number of fingers */ int fingerWidth; /* finger width value */ int left, right, up, down; /* left/right/up/down buttons */ Bool multi[8]; Bool middle; } SynapticsSHM; /* * Minimum and maximum values for scroll_button_repeat */ #define SBR_MIN 10 #define SBR_MAX 1000 #endif /* _SYNAPTICS_H_ */
Update files, Alura, Introdução a C - Parte 2, Aula 4.2
#include <stdio.h> #include <string.h> void abertura() { printf("*******************\n"); printf("* Jogo de Forca *\n"); printf("*******************\n\n"); } int main() { char palavrasecreta[20]; sprintf(palavrasecreta, "MELANCIA"); int acertou = 0; int enforcou = 0; char chutes[26]; int tentativas = 0; abertura(); do { for(int i = 0; i < strlen(palavrasecreta); i++) { int achou = 0; for(int j = 0; j < tentativas; j++) { if(chutes[j] == palavrasecreta[i]) { achou = 1; break; } } if(achou) { printf("%c ", palavrasecreta[i]); } else { printf("_ "); } } printf("\n"); char chute; printf("Qual letra? "); scanf(" %c", &chute); chutes[tentativas] = chute; tentativas++; } while(!acertou && !enforcou); }
#include <stdio.h> #include <string.h> void abertura() { printf("*******************\n"); printf("* Jogo de Forca *\n"); printf("*******************\n\n"); } void chuta() { char chute; printf("Qual letra? "); scanf(" %c", &chute); chutes[tentativas] = chute; tentativas++; } int main() { char palavrasecreta[20]; sprintf(palavrasecreta, "MELANCIA"); int acertou = 0; int enforcou = 0; char chutes[26]; int tentativas = 0; abertura(); do { // imprime a palavra secreta for(int i = 0; i < strlen(palavrasecreta); i++) { int achou = 0; // a letra ja foi chutada? for(int j = 0; j < tentativas; j++) { if(chutes[j] == palavrasecreta[i]) { achou = 1; break; } } if(achou) { printf("%c ", palavrasecreta[i]); } else { printf("_ "); } } printf("\n"); chuta(); } while(!acertou && !enforcou); }
Revert "Only define __dead if it's missing"
#ifndef COMPAT_H #define COMPAT_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifndef __dead #define __dead #endif #ifndef HAVE_REALLOCARRAY void *reallocarray(void *, size_t, size_t); #endif /* !HAVE_REALLOCARRAY */ #endif /* COMPAT_H */
#ifndef COMPAT_H #define COMPAT_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef __FreeBSD__ #define __dead __dead2 #endif /* __FreeBSD__ */ #if defined(__linux__) || defined(__CYGWIN__) #ifndef __dead #ifdef __GNUC__ #define __dead __attribute__((__noreturn__)) #else #define __dead #endif #endif #endif /* __linux__ || __CYGWIN__ */ #ifndef HAVE_REALLOCARRAY void *reallocarray(void *, size_t, size_t); #endif /* !HAVE_REALLOCARRAY */ #endif /* COMPAT_H */
Test case for annotate builtin.
// RUN: %llvmgcc %s -S -o - | llvm-as | llvm-dis | grep llvm.annotation int main() { int x = 0; return __builtin_annotation(x, "annotate"); }
Fix import to be able to use Smartling.i18n as dynamic framework via cocoapods
// Copyright 2015 Smartling, Inc. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this work 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. // // SmartlingLib.h // SmartlingLib // // Created by Pavel Ivashkov on 2015-05-15. // #import <UIKit/UIKit.h> //! Project version number for SmartlingLib. FOUNDATION_EXPORT double SmartlingLibVersionNumber; //! Project version string for SmartlingLib. FOUNDATION_EXPORT const unsigned char SmartlingLibVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <SmartlingLib/PublicHeader.h> #import <SmartlingLib/SLLocalization.h>
// Copyright 2015 Smartling, Inc. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this work 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. // // SmartlingLib.h // SmartlingLib // // Created by Pavel Ivashkov on 2015-05-15. // #import <UIKit/UIKit.h> //! Project version number for SmartlingLib. FOUNDATION_EXPORT double SmartlingLibVersionNumber; //! Project version string for SmartlingLib. FOUNDATION_EXPORT const unsigned char SmartlingLibVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <SmartlingLib/PublicHeader.h> #import "SLLocalization.h"
Handle precision of fractions better
// Spellable.h #ifndef SPELLABLE_H #define SPELLABLE_H #include <string> template <class T> class Spellable { T* value; public: Spellable() {}; Spellable(T* value): value(value) {} Spellable(T v) { value = new T(v); } void SetValue(T* v) { value = v; } void SetValue(T v) { value = new T(v); } T GetValue() const { return *value; } std::string spell(); // Let's do arithmetic! Spellable & operator=(const T &rhs) { SetValue(rhs); } Spellable & operator+=(const T &rhs) { *value += rhs; return *this; } bool operator==(const T &other) const { return *value == other; } bool operator==(const std::string &other) const { return spell() == other; } }; // http://www.codeproject.com/Articles/48575/How-to-define-a-template-class-in-a-h-file-and-imp // The linker gets confused if we don't include the implementation here. #include "Spellable.cpp" #endif // Spellable.h
// Spellable.h #ifndef SPELLABLE_H #define SPELLABLE_H #include <string> template <class T> class Spellable { T* value; public: // TODO: new values are never deleted! Spellable() { value = NULL; }; Spellable(T* value): value(value) {} Spellable(T v) { value = new T(v); } void SetValue(T* v) { value = v; } void SetValue(T v) { value = new T(v); } T GetValue() const { return *value; } std::string spell(); // Let's do arithmetic! Spellable & operator=(const T &rhs) { SetValue(rhs); } Spellable & operator+=(const T &rhs) { *value += rhs; return *this; } bool operator==(const T &other) const { return *value == other; } bool operator==(const std::string &other) const { return spell() == other; } protected: std::string spellFraction(); }; // http://www.codeproject.com/Articles/48575/How-to-define-a-template-class-in-a-h-file-and-imp // The linker gets confused if we don't include the implementation here. #include "Spellable.cpp" #endif // Spellable.h
Use int64_t for cgen intrinsics
/* Copyright (c) 2015, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 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. */ // count trailing zeros with llvm semantics int cgen_cttz_int(int n) { if(n==0) return sizeof(int); return __builtin_ctz(n); } int cgen_flipsign_int(int64_t x, int64_t y) { return (y >= 0 ? x : -x); }
/* Copyright (c) 2015, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 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. */ // count trailing zeros with llvm semantics int64_t cgen_cttz_int(int64_t n) { if(n==0) return sizeof(int64_t); return __builtin_ctz(n); } int64_t cgen_flipsign_int(int64_t x, int64_t y) { return (y >= 0 ? x : -x); }
Add printing of file size
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> #include <errno.h> #include <sys/stat.h> off_t get_file_size(const char *filename) { struct stat buffer; return (stat(filename, &buffer)==0 ? buffer.st_size : -1); } int file_is_readable(char *filename) { if ( access(filename, R_OK) != -1 ) { return 1; } else { return 0; } } int main(int argc, char *argv[]) { clock_t t0, t1; if (argc <= 1) { printf("Usage: %s [arguments]\n", argv[0]); return EXIT_FAILURE; } t0 = clock(); printf("Hello World!\n"); if (file_is_readable(argv[1])) { printf("Input File = '%s'\n", argv[1]); } else { printf("Input File = '%s' (file does not exist or read permissions absent)\n", argv[1]); } t1 = clock(); printf("Time elapsed = %f (ms)\n", (t1-t0)*1000/(double)CLOCKS_PER_SEC ); return EXIT_SUCCESS; }
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> #include <errno.h> #include <sys/stat.h> off_t get_file_size(const char *filename) { struct stat buffer; return (stat(filename, &buffer)==0 ? buffer.st_size : -1); } int file_is_readable(char *filename) { if ( access(filename, R_OK) != -1 ) { return 1; } else { return 0; } } int main(int argc, char *argv[]) { clock_t t0, t1; if (argc <= 1) { printf("Usage: %s [arguments]\n", argv[0]); return EXIT_FAILURE; } t0 = clock(); printf("Hello World!\n"); if (file_is_readable(argv[1])) { printf("Input File = '%s'\n", argv[1]); printf("File size is %lld\n", get_file_size(argv[1])); } else { printf("Input File = '%s' (file does not exist or read permissions absent)\n", argv[1]); } t1 = clock(); printf("Time elapsed = %f (ms)\n", (t1-t0)*1000/(double)CLOCKS_PER_SEC ); return EXIT_SUCCESS; }
Fix a typo (thanks to Robert Hatcher)
// @(#)root/hist:$Name: $:$Id: TH1I.h,v 1.1 2002/05/18 11:02:49 brun Exp $ // Author: Rene Brun 08/09/2003 /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TH1I #define ROOT_TH1I ////////////////////////////////////////////////////////////////////////// // // // TH1I // // // // 1-Dim histogram with a 4 bits integer per channel // // // ////////////////////////////////////////////////////////////////////////// #ifndef ROOT_TH1 #include "TH1.h" #endif #endif
// @(#)root/hist:$Name: $:$Id: TH1I.h,v 1.1 2003/09/08 12:50:23 brun Exp $ // Author: Rene Brun 08/09/2003 /************************************************************************* * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TH1I #define ROOT_TH1I ////////////////////////////////////////////////////////////////////////// // // // TH1I // // // // 1-Dim histogram with a 32 bits integer per channel // // // ////////////////////////////////////////////////////////////////////////// #ifndef ROOT_TH1 #include "TH1.h" #endif #endif
Fix typo in created date.
// // ServiceMBTA_sensitive.h // MBTA-APIs // // Created by Steve Caine on 01/05/115. // Copyright (c) 2015 Steve Caine. All rights reserved. // // your private key to the MBTA-v2 API goes here #define key_MBTA_v2_API @"" // you should not commit any version of this file that contains the key // to any source-control repository that will be made public or otherwise shared
// // ServiceMBTA_sensitive.h // MBTA-APIs // // Created by Steve Caine on 01/05/15. // Copyright (c) 2015 Steve Caine. All rights reserved. // // your private key to the MBTA-v2 API goes here #define key_MBTA_v2_API @"" // you should not commit any version of this file that contains the key // to any source-control repository that will be made public or otherwise shared
Remove double definition of default env variables
#ifndef SHELL_H #define SHELL_H #include <stdbool.h> #define report_error() fprintf(stderr, "[%s: %s():%d] %s\n", __FILE__, \ __FUNCTION__, \ __LINE__, \ strerror(errno)); #define sizeof_array(x) (sizeof(x) / sizeof(*x)) #define DEFAULT_PROMPT "$ " #define DEFAULT_PATH "/bin:/usr/bin/:/sbin/:/usr/local/bin" #define DEFAULT_HOME "/" typedef struct command_t{ char **array; unsigned int elements; }command_t; typedef struct shell_t{ bool running; struct environ_t *env; pid_t shell_pid; char *pwd; }shell_t; char *copy_string(const char *str); unsigned int count_token(char *string, const char *token_string); void free_command(command_t *command); command_t *parse(char *line); int change_shell_dir(char *path); int execute_builtins(char **input); int execute_command(command_t *c); #endif
#ifndef SHELL_H #define SHELL_H #include <stdbool.h> #define report_error() fprintf(stderr, "[%s: %s():%d] %s\n", __FILE__, \ __FUNCTION__, \ __LINE__, \ strerror(errno)); #define sizeof_array(x) (sizeof(x) / sizeof(*x)) typedef struct command_t{ char **array; unsigned int elements; }command_t; typedef struct shell_t{ bool running; struct environ_t *env; pid_t shell_pid; char *pwd; }shell_t; char *copy_string(const char *str); unsigned int count_token(char *string, const char *token_string); void free_command(command_t *command); command_t *parse(char *line); int change_shell_dir(char *path); int execute_builtins(char **input); int execute_command(command_t *c); #endif
Make get_temp() static. Split out format().
// Copyright 2016, Jeffrey E. Bedard #include "temperature.h" #include "config.h" #include "font.h" #include "util.h" #include <stdio.h> uint8_t get_temp(void) { return xstatus_system_value(XSTATUS_SYSFILE_TEMPERATURE) / 1000; } // Returns x offset for next item uint16_t draw_temp(xcb_connection_t * xc, const uint16_t offset) { uint8_t sz = 4; const struct JBDim f = xstatus_get_font_size(); const int16_t x = offset + XSTATUS_CONST_PAD; { // buf scope char buf[sz]; sz = snprintf(buf, sz, "%dC", get_temp()); xcb_image_text_8(xc, sz, xstatus_get_window(xc), xstatus_get_gc(xc), x, f.h, buf); } return x + f.w * sz + XSTATUS_CONST_PAD; }
// Copyright 2016, Jeffrey E. Bedard #include "temperature.h" #include "config.h" #include "font.h" #include "util.h" #include <stdio.h> static uint8_t get_temp(void) { return xstatus_system_value(XSTATUS_SYSFILE_TEMPERATURE) / 1000; } static uint8_t format(char * restrict buf, const uint8_t sz) { return snprintf(buf, sz, "%dC", get_temp()); } // Returns x offset for next item uint16_t draw_temp(xcb_connection_t * xc, const uint16_t offset) { uint8_t sz = 4; const struct JBDim f = xstatus_get_font_size(); const int16_t x = offset + XSTATUS_CONST_PAD; { // buf scope char buf[sz]; sz = format(buf, sz); xcb_image_text_8(xc, sz, xstatus_get_window(xc), xstatus_get_gc(xc), x, f.h, buf); } return x + f.w * sz + XSTATUS_CONST_PAD; }
Enable move and disable copy for key implementations.
#pragma once #include "jwtxx/jwt.h" #include <string> namespace JWTXX { struct Key::Impl { virtual ~Impl() {} virtual std::string sign(const void* data, size_t size) const = 0; virtual bool verify(const void* data, size_t size, const std::string& signature) const = 0; }; }
#pragma once #include "jwtxx/jwt.h" #include <string> namespace JWTXX { struct Key::Impl { // Need this for polymorphic behavior. virtual ~Impl() = default; // Need this due to the Rule of Five. Impl() = default; Impl(const Impl&) = delete; Impl& operator=(const Impl&) = delete; Impl(Impl&&) = default; Impl& operator=(Impl&&) = default; virtual std::string sign(const void* data, size_t size) const = 0; virtual bool verify(const void* data, size_t size, const std::string& signature) const = 0; }; }
Add delegate for profile view controller.
// // ProfileViewController.h // PlayPlan // // Created by Zeacone on 15/11/8. // Copyright © 2015年 Zeacone. All rights reserved. // #import <UIKit/UIKit.h> #import "PlayPlan.h" @interface ProfileViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> @end
// // ProfileViewController.h // PlayPlan // // Created by Zeacone on 15/11/8. // Copyright © 2015年 Zeacone. All rights reserved. // #import <UIKit/UIKit.h> #import "PlayPlan.h" @class ProfileViewController; @protocol MainDelegate <NSObject> - (void)dismissViewController:(MainViewController *)mainViewController; @end @interface ProfileViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> @end
Test inability to inline certain functions
// RUN: %check -e %s #define always_inline __attribute((always_inline)) always_inline hidden(int); void always_inline __attribute((noinline)) noinline(void) { } always_inline void print(const char *fmt, ...) { } always_inline void old(a, b) int a, b; { } always_inline void addr(int x) { int *p = &x; *p = 3; } always_inline void write(int x) { x++; } always_inline void rec(int depth) { if(depth < 5) rec(depth + 1); // CHECK: can't always_inline function: can't see function } always_inline int should_inline() { return 3; } main() { should_inline(); // CHECK: !/warn|error/ rec(0); // CHECK: !/warn|error/ hidden(3); // CHECK: error: can't always_inline function: can't see function noinline(); // CHECK: error: can't always_inline noinline function print("hi", 3); // CHECK: error: can't always_inline function: variadic function print("hi"); // CHECK: error: can't always_inline function: variadic function old(3, 1); // CHECK: error: can't always_inline function: unspecified argument count function addr(5); // CHECK: error: can't always_inline function: argument written or addressed write(2); // CHECK: error: can't always_inline function: argument written or addressed }
Update the default return value of UserPhysicalPresent to TRUE.
/** @file Provides a secure platform-specific method to detect physically present user. Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ /** This function provides a platform-specific method to detect whether the platform is operating by a physically present user. Programmatic changing of platform security policy (such as disable Secure Boot, or switch between Standard/Custom Secure Boot mode) MUST NOT be possible during Boot Services or after exiting EFI Boot Services. Only a physically present user is allowed to perform these operations. NOTE THAT: This function cannot depend on any EFI Variable Service since they are not available when this function is called in AuthenticateVariable driver. @retval TRUE The platform is operated by a physically present user. @retval FALSE The platform is NOT operated by a physically present user. **/ BOOLEAN EFIAPI UserPhysicalPresent ( VOID ) { return FALSE; }
/** @file Provides a secure platform-specific method to detect physically present user. Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ /** This function provides a platform-specific method to detect whether the platform is operating by a physically present user. Programmatic changing of platform security policy (such as disable Secure Boot, or switch between Standard/Custom Secure Boot mode) MUST NOT be possible during Boot Services or after exiting EFI Boot Services. Only a physically present user is allowed to perform these operations. NOTE THAT: This function cannot depend on any EFI Variable Service since they are not available when this function is called in AuthenticateVariable driver. @retval TRUE The platform is operated by a physically present user. @retval FALSE The platform is NOT operated by a physically present user. **/ BOOLEAN EFIAPI UserPhysicalPresent ( VOID ) { return TRUE; }
Fix test for previous commit
// RUN: %clang_cc1 -fsyntax-only -verify // PR9137 void f0(int x) : {}; void f1(int x) try {};
// RUN: %clang_cc1 -fsyntax-only -verify %s // PR9137 void f0(int x) : {}; // expected-error{{expected function body after function declarator}} void f1(int x) try {}; // expected-error{{expected function body after function declarator}}
Change weak reference to assign for backwards compatibility
// // MFSideMenuShadow.h // MFSideMenuDemoSearchBar // // Created by Michael Frederick on 5/13/13. // Copyright (c) 2013 Frederick Development. All rights reserved. // #import <Foundation/Foundation.h> @interface MFSideMenuShadow : NSObject @property (nonatomic, assign) BOOL enabled; @property (nonatomic, assign) CGFloat radius; @property (nonatomic, assign) CGFloat opacity; @property (nonatomic, strong) UIColor *color; @property (nonatomic, weak) UIView *shadowedView; + (MFSideMenuShadow *)shadowWithView:(UIView *)shadowedView; + (MFSideMenuShadow *)shadowWithColor:(UIColor *)color radius:(CGFloat)radius opacity:(CGFloat)opacity; - (void)draw; - (void)shadowedViewWillRotate; - (void)shadowedViewDidRotate; @end
// // MFSideMenuShadow.h // MFSideMenuDemoSearchBar // // Created by Michael Frederick on 5/13/13. // Copyright (c) 2013 Frederick Development. All rights reserved. // #import <Foundation/Foundation.h> @interface MFSideMenuShadow : NSObject @property (nonatomic, assign) BOOL enabled; @property (nonatomic, assign) CGFloat radius; @property (nonatomic, assign) CGFloat opacity; @property (nonatomic, strong) UIColor *color; @property (nonatomic, assign) UIView *shadowedView; + (MFSideMenuShadow *)shadowWithView:(UIView *)shadowedView; + (MFSideMenuShadow *)shadowWithColor:(UIColor *)color radius:(CGFloat)radius opacity:(CGFloat)opacity; - (void)draw; - (void)shadowedViewWillRotate; - (void)shadowedViewDidRotate; @end
Use the %llvm-gcc% variable to find llvm-gcc for those of us that don't have it in our path and to ensure it uses the configured llvm-gcc not just any one randomly placed in the path.
// RUN: llvm-gcc %s -S -o - // PR854 struct kernel_symbol { unsigned long value; }; unsigned long loops_per_jiffy = (1<<12); static const char __kstrtab_loops_per_jiffy[] __attribute__((section("__ksymtab_strings"))) = "loops_per_jiffy"; static const struct kernel_symbol __ksymtab_loops_per_jiffy __attribute__((__used__)) __attribute__((section("__ksymtab"))) = { (unsigned long)&loops_per_jiffy, __kstrtab_loops_per_jiffy };
// RUN: %llvmgcc% %s -S -o - // PR854 struct kernel_symbol { unsigned long value; }; unsigned long loops_per_jiffy = (1<<12); static const char __kstrtab_loops_per_jiffy[] __attribute__((section("__ksymtab_strings"))) = "loops_per_jiffy"; static const struct kernel_symbol __ksymtab_loops_per_jiffy __attribute__((__used__)) __attribute__((section("__ksymtab"))) = { (unsigned long)&loops_per_jiffy, __kstrtab_loops_per_jiffy };
Update clang_getCursor() test to check searches on include directives
#define OBSCURE(X) X #define DECORATION typedef int T; void OBSCURE(func)(int x) { OBSCURE(T) DECORATION value; } // RUN: c-index-test -cursor-at=%s:1:11 %s | FileCheck -check-prefix=CHECK-1 %s // CHECK-1: macro definition=OBSCURE // RUN: c-index-test -cursor-at=%s:2:14 %s | FileCheck -check-prefix=CHECK-2 %s // CHECK-2: macro definition=DECORATION // RUN: c-index-test -cursor-at=%s:5:7 %s | FileCheck -check-prefix=CHECK-3 %s // CHECK-3: macro instantiation=OBSCURE:1:9 // RUN: c-index-test -cursor-at=%s:6:6 %s | FileCheck -check-prefix=CHECK-4 %s // CHECK-4: macro instantiation=OBSCURE:1:9 // RUN: c-index-test -cursor-at=%s:6:19 %s | FileCheck -check-prefix=CHECK-5 %s // CHECK-5: macro instantiation=DECORATION:2:9
#define OBSCURE(X) X #define DECORATION typedef int T; void OBSCURE(func)(int x) { OBSCURE(T) DECORATION value; } #include "a.h" // RUN: c-index-test -cursor-at=%s:1:11 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-1 %s // CHECK-1: macro definition=OBSCURE // RUN: c-index-test -cursor-at=%s:2:14 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-2 %s // CHECK-2: macro definition=DECORATION // RUN: c-index-test -cursor-at=%s:5:7 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-3 %s // CHECK-3: macro instantiation=OBSCURE:1:9 // RUN: c-index-test -cursor-at=%s:6:6 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-4 %s // CHECK-4: macro instantiation=OBSCURE:1:9 // RUN: c-index-test -cursor-at=%s:6:19 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-5 %s // CHECK-5: macro instantiation=DECORATION:2:9 // RUN: c-index-test -cursor-at=%s:9:10 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-6 %s // CHECK-6: inclusion directive=a.h
Allow access to documents of depth 32
#ifndef SUBDOC_PATH_H #define SUBDOC_PATH_H #include "subdoc-api.h" #include "jsonsl_header.h" #ifdef __cplusplus extern "C" { #endif #define COMPONENTS_ALLOC 32 typedef struct subdoc_PATH_st { struct jsonsl_jpr_st jpr_base; struct jsonsl_jpr_component_st components_s[COMPONENTS_ALLOC]; int has_negix; /* True if there is a negative array index in the path */ } subdoc_PATH; struct subdoc_PATH_st *subdoc_path_alloc(void); void subdoc_path_free(struct subdoc_PATH_st*); void subdoc_path_clear(struct subdoc_PATH_st*); int subdoc_path_parse(struct subdoc_PATH_st *nj, const char *path, size_t len); jsonsl_error_t subdoc_path_add_arrindex(subdoc_PATH *pth, size_t ixnum); #define subdoc_path_pop_component(pth) do { \ (pth)->jpr_base.ncomponents--; \ } while (0); #ifdef __cplusplus } #endif #endif
#ifndef SUBDOC_PATH_H #define SUBDOC_PATH_H #include "subdoc-api.h" #include "jsonsl_header.h" #ifdef __cplusplus extern "C" { #endif // Maximum number of components in a path. Set to 33 to allow 32 'actual' // components plus the implicit root element. #define COMPONENTS_ALLOC 33 typedef struct subdoc_PATH_st { struct jsonsl_jpr_st jpr_base; struct jsonsl_jpr_component_st components_s[COMPONENTS_ALLOC]; int has_negix; /* True if there is a negative array index in the path */ } subdoc_PATH; struct subdoc_PATH_st *subdoc_path_alloc(void); void subdoc_path_free(struct subdoc_PATH_st*); void subdoc_path_clear(struct subdoc_PATH_st*); int subdoc_path_parse(struct subdoc_PATH_st *nj, const char *path, size_t len); jsonsl_error_t subdoc_path_add_arrindex(subdoc_PATH *pth, size_t ixnum); #define subdoc_path_pop_component(pth) do { \ (pth)->jpr_base.ncomponents--; \ } while (0); #ifdef __cplusplus } #endif #endif
Add digits() to count digits of `unsigned int` value
#ifndef __BITOPS_H__ #define __BITOPS_H__ #include <asm/bitops.h> #include <types.h> static inline int fls(int x) { return WORD_BITS - __clz(x); } static inline int ffs(int x) { /* mask the least significant bit only */ return fls(x & -x); } static inline int log2(int x) { if (!x) return INF; int sign = 1; if (x < 0) { sign = -sign; x = -x; } return (fls(x) - 1) * sign; } #endif /* __BITOPS_H__ */
#ifndef __BITOPS_H__ #define __BITOPS_H__ #include <asm/bitops.h> #include <types.h> static inline int fls(int x) { return WORD_BITS - __clz(x); } static inline int ffs(int x) { /* mask the least significant bit only */ return fls(x & -x); } static inline int digits(const unsigned int n) { assert(sizeof(n) == 4); const int tbl[] = { 10, 10, 9, 9, 9, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0 }; const unsigned int base[] = { 0, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 }; int digits = tbl[__clz(n)]; if (base[digits] <= n) digits++; return digits; } static inline int log2(int x) { if (!x) return INF; int sign = 1; if (x < 0) { sign = -sign; x = -x; } return (fls(x) - 1) * sign; } #endif /* __BITOPS_H__ */
Deal with the LOGIN_NAME_MAX issue in the NetBSD->FreeBSD translation^H^H^Hhack layer.
/* $FreeBSD$ */ /* XXX: Depend on our system headers protecting against multiple includes. */ #include <paths.h> #undef _PATH_FTPUSERS #include <pwd.h> #define _DIAGASSERT(x) #include <sys/_types.h> #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif long long strsuftollx(const char *, const char *, long long, long long, char *, size_t);
/* $FreeBSD$ */ /* XXX: Depend on our system headers protecting against multiple includes. */ #include <paths.h> #undef _PATH_FTPUSERS #include <pwd.h> #define _DIAGASSERT(x) #include <sys/_types.h> #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif long long strsuftollx(const char *, const char *, long long, long long, char *, size_t); /* * IEEE Std 1003.1c-95, adopted in X/Open CAE Specification Issue 5 Version 2 */ #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500 #define LOGIN_NAME_MAX MAXLOGNAME /* max login name length (incl. NUL) */ #endif
Remove unused node-counter in routines
#define T_INT 0 #define T_CHR 1 #define T_RTN 2 struct stack_node { struct stack_node *cdr; union node_data data; char type; } union node_data { struct routine routine; int numval; } struct routine { struct routine *parent; struct iq_node *nodes; int num_nodes; } struct iq_node { struct iq_node *next; union node_data instr; char type; }
#define T_INT 0 #define T_CHR 1 #define T_RTN 2 struct stack_node { struct stack_node *cdr; union node_data data; char type; } union node_data { struct routine routine; int numval; } struct routine { struct routine *parent; struct iq_node *nodes; } struct iq_node { struct iq_node *next; union node_data instr; char type; }
Add required and CGFloat -> float
// // SEEngineProtocol.h // Pods // // Created by Danil Tulin on 3/14/16. // // #import <Foundation/Foundation.h> @protocol EngineProtocol <NSObject> - (void)feedBGRAImageData:(u_int8_t *)data width:(NSUInteger)width heieght:(NSUInteger)height; @property (nonatomic) CGFloat progress; @end
// // SEEngineProtocol.h // Pods // // Created by Danil Tulin on 3/14/16. // // #import <Foundation/Foundation.h> @protocol EngineProtocol <NSObject> @required - (void)feedBGRAImageData:(u_int8_t *)data width:(NSUInteger)width heieght:(NSUInteger)height; @property (nonatomic) float progress; @end
Enlarge snippet size and rank volumn.
/* for MAX_TXT_SEG_BYTES & MAX_TXT_SEG_LEN */ #include "txt-seg/config.h" #define MAX_TERM_BYTES MAX_TXT_SEG_BYTES /* consider both math & term */ #define MAX_QUERY_BYTES (MAX_TXT_SEG_BYTES * 32) #define MAX_QUERY_WSTR_LEN (MAX_TXT_SEG_LEN * 32) #define MAX_MERGE_POSTINGS 4096 #define SNIPPET_PADDING 80 #define MAX_SNIPPET_SZ 4096 //#define DEBUG_SNIPPET //#define DEBUG_POST_MERGE /* max mark score, type of mnc_score_t */ #define MNC_MARK_SCORE 99 /* #define MNC_DEBUG #define MNC_SMALL_BITMAP */ //#define DEBUG_MATH_EXPR_SEARCH #define RANK_SET_DEFAULT_VOL 45 #define DEFAULT_RES_PER_PAGE 10 //#define DEBUG_PROXIMITY #define ENABLE_PROXIMITY_SCORE #define MAX_HIGHLIGHT_OCCURS 8 //#define DEBUG_HILIGHT_SEG_OFFSET //#define DEBUG_HILIGHT_SEG //#define DEBUG_MATH_SCORE_POSTING //#define VERBOSE_SEARCH //#define DEBUG_MATH_SEARCH //#define DEBUG_PRINT_TARGET_DOC_MATH_SCORE
/* for MAX_TXT_SEG_BYTES & MAX_TXT_SEG_LEN */ #include "txt-seg/config.h" #define MAX_TERM_BYTES MAX_TXT_SEG_BYTES /* consider both math & term */ #define MAX_QUERY_BYTES (MAX_TXT_SEG_BYTES * 32) #define MAX_QUERY_WSTR_LEN (MAX_TXT_SEG_LEN * 32) #define MAX_MERGE_POSTINGS 4096 #define SNIPPET_PADDING 320 #define MAX_SNIPPET_SZ 8192 //#define DEBUG_SNIPPET //#define DEBUG_POST_MERGE /* max mark score, type of mnc_score_t */ #define MNC_MARK_SCORE 99 /* #define MNC_DEBUG #define MNC_SMALL_BITMAP */ //#define DEBUG_MATH_EXPR_SEARCH #define RANK_SET_DEFAULT_VOL 155 #define DEFAULT_RES_PER_PAGE 10 //#define DEBUG_PROXIMITY #define ENABLE_PROXIMITY_SCORE #define MAX_HIGHLIGHT_OCCURS 8 //#define DEBUG_HILIGHT_SEG_OFFSET //#define DEBUG_HILIGHT_SEG //#define DEBUG_MATH_SCORE_POSTING //#define VERBOSE_SEARCH //#define DEBUG_MATH_SEARCH //#define DEBUG_PRINT_TARGET_DOC_MATH_SCORE
Change body of the toggleUserLoggedStatus method.
// JPet User - JPetUser.h #ifndef JPET_USER_H #define JPET_USER_H #include "TNamed.h" class JPetUser: public TNamed { protected: int m_id; std::string m_name; std::string m_lastName; std::string m_login; std::string m_password; bool m_isRoot; std::string m_creationDate; std::string m_lastLoginDate; static bool m_isUserLogged; inline void toggleUserLoggedStatus() { m_isUserLogged = (m_isUserLogged == true) ? false : true; } virtual std::string password(void) const; public: JPetUser(int p_id, std::string p_name, std::string p_lastName, std::string p_login, std::string p_password, bool p_isRoot); virtual ~JPetUser(void); static bool isUserLogged(void); virtual bool logIn(void); virtual bool logOut(void); virtual bool changeLogin(void); virtual bool changePassword(void); virtual int id(void) const; virtual std::string name(void) const; virtual std::string lastName(void) const; virtual std::string login(void) const; virtual bool isRoot(void) const; virtual std::string creationDate(void) const; virtual std::string lastLoginDate(void) const; private: ClassDef(JPetUser, 1); }; #endif // JPET_USER_H
// JPet User - JPetUser.h #ifndef JPET_USER_H #define JPET_USER_H #include "TNamed.h" class JPetUser: public TNamed { protected: int m_id; std::string m_name; std::string m_lastName; std::string m_login; std::string m_password; bool m_isRoot; std::string m_creationDate; std::string m_lastLoginDate; static bool m_isUserLogged; inline void toggleUserLoggedStatus() { m_isUserLogged = !m_isUserLogged; } virtual std::string password(void) const; public: JPetUser(int p_id, std::string p_name, std::string p_lastName, std::string p_login, std::string p_password, bool p_isRoot); virtual ~JPetUser(void); static bool isUserLogged(void); virtual bool logIn(void); virtual bool logOut(void); virtual bool changeLogin(void); virtual bool changePassword(void); virtual int id(void) const; virtual std::string name(void) const; virtual std::string lastName(void) const; virtual std::string login(void) const; virtual bool isRoot(void) const; virtual std::string creationDate(void) const; virtual std::string lastLoginDate(void) const; private: ClassDef(JPetUser, 1); }; #endif // JPET_USER_H
Add additional string iteration program example
#include <cs50.h> #include <ctype.h> #include <stdio.h> #include <string.h> // declare main so that it takes input from command line int main(int argc, string argv[]) { for (int i = 1; i < argc; i++) { for (int j = 0, k = strlen(argv[i]); j < k; j++) { if (j % 2 == 0) { printf("%c", toupper(argv[i][j])); } else { printf("%c", tolower(argv[i][j])); } printf(" "); } printf(" "); } printf("\n"); }
Modify Chapter 27, drill to comply with C89 standard
/* Chapter 27, drill 1. Write a Hello World program 2. Define two variables holding "Hello" and "World!", concatenate them with a space in between and output them as "Hello World!" 3. Define a function taking a char* p and an int x, print their values in the format "p is 'foo' and x is 7". Call it with a few argument pairs. */ #include<stdlib.h> #include<string.h> #include<stdio.h> void my_func(char* p, int x) { printf("p is \"%s\" and x is %i\n",p,x); } int main() { printf("Hello World!\n"); char* hello = "Hello"; char* world = "World!"; char* hello_world = (char*) malloc(strlen(hello)+strlen(world)+2); strcpy(hello_world,hello); hello_world[strlen(hello)] = ' '; strcpy(hello_world+strlen(hello)+1,world); printf("%s\n",hello_world); my_func("foo",7); my_func("Scott Meyers",42); my_func("Bjarne Stroustrup",99); }
/* Chapter 27, drill 1. Write a Hello World program 2. Define two variables holding "Hello" and "World!", concatenate them with a space in between and output them as "Hello World!" 3. Define a function taking a char* p and an int x, print their values in the format "p is 'foo' and x is 7". Call it with a few argument pairs. */ #include<stdlib.h> #include<string.h> #include<stdio.h> void my_func(char* p, int x) { printf("p is \"%s\" and x is %i\n",p,x); } int main() { printf("Hello World!\n"); { char* hello = "Hello"; char* world = "World!"; char* hello_world = (char*) malloc(strlen(hello)+strlen(world)+2); strcpy(hello_world,hello); hello_world[strlen(hello)] = ' '; strcpy(hello_world+strlen(hello)+1,world); printf("%s\n",hello_world); } my_func("foo",7); my_func("Scott Meyers",42); my_func("Bjarne Stroustrup",99); }
Add idle time function for windows
#include <QtGlobal> #if defined Q_WS_X11 #include <X11/extensions/scrnsaver.h> #endif // return idle time in seconds int getIdleSecs() { #if defined Q_WS_X11 int code, idle_sec; XScreenSaverInfo *ssinfo = XScreenSaverAllocInfo(); if (!ssinfo) goto fail; Display *display = XOpenDisplay(0); if (!display) goto fail; code = XScreenSaverQueryInfo(display, DefaultRootWindow(display), ssinfo); if (!code) goto fail; idle_sec = ssinfo->idle / 1000; XFree(ssinfo); XCloseDisplay(display); return idle_sec; fail: if (ssinfo) XFree(ssinfo); if (display) XCloseDisplay(display); return -1; #else return -1; #endif }
#include <QtGlobal> // headers #if defined Q_WS_X11 #include <X11/extensions/scrnsaver.h> #elif defined Q_WS_WIN #include <windows.h> #endif // ^ headers // return idle time in seconds int getIdleSecs() { // linux #if defined Q_WS_X11 int code, idle_sec; XScreenSaverInfo *ssinfo = XScreenSaverAllocInfo(); if (!ssinfo) goto fail; Display *display = XOpenDisplay(0); if (!display) goto fail; code = XScreenSaverQueryInfo(display, DefaultRootWindow(display), ssinfo); if (!code) goto fail; idle_sec = ssinfo->idle / 1000; XFree(ssinfo); XCloseDisplay(display); return idle_sec; fail: if (ssinfo) XFree(ssinfo); if (display) XCloseDisplay(display); return -1; // ^ linux // windows #elif defined Q_WS_WIN BOOL ok; LASTINPUTINFO plii; DWORD msec; plii.cbSize = sizeof(LASTINPUTINFO); plii.dwTime = 0; ok = GetLastInputInfo(&plii); if (!ok) return -1; msec = GetTickCount(); msec -= plii.dwTime; msec /= 1000; return msec; // ^ windows #else return -1; #endif }
Add test about witness un-CIL invariant being incorrect when branches joined
extern void __VERIFIER_error() __attribute__ ((__noreturn__)); extern int __VERIFIER_nondet_int(); void __VERIFIER_assert(int cond) { if (!(cond)) { ERROR: __VERIFIER_error(); } return; } int main() { int x = __VERIFIER_nondet_int(); if (x > 0 && x < 2) __VERIFIER_assert(x == 1); else __VERIFIER_assert(1); // arbitrary node in else branch to see invariant return 0; }
Add KERN_ADDRESS_TBL for each version
#ifndef LOADER_H #define LOADER_H #include "../../../libwiiu/src/coreinit.h" #include "../../../libwiiu/src/socket.h" #include "../../../libwiiu/src/types.h" void _start(); void _entryPoint(); /* Arbitrary kernel write syscall */ void kern_write(void *addr, uint32_t value); #endif /* LOADER_H */
#ifndef LOADER_H #define LOADER_H #include "../../../libwiiu/src/coreinit.h" #include "../../../libwiiu/src/socket.h" #include "../../../libwiiu/src/types.h" /* Kernel address table */ #if VER == 200 #define KERN_ADDRESS_TBL 0x0 #elif VER == 210 #define KERN_ADDRESS_TBL 0x0 #elif VER == 300 #define KERN_ADDRESS_TBL 0xFFEB66E4 #elif VER == 310 #define KERN_ADDRESS_TBL 0x0 #elif VER == 400 #define KERN_ADDRESS_TBL 0x0 #elif VER == 410 #define KERN_ADDRESS_TBL 0xffeb902c #elif VER == 500 #define KERN_ADDRESS_TBL 0xffea9e4c #elif VER == 532 #define KERN_ADDRESS_TBL 0xFFEAAA10 #else #error "Unsupported Wii U software version" #endif void _start(); void _entryPoint(); /* Arbitrary kernel write syscall */ void kern_write(void *addr, uint32_t value); #endif /* LOADER_H */
Change default live to /run/s6-rc
/* ISC license. */ #ifndef S6RC_CONSTANTS_H #define S6RC_CONSTANTS_H #define S6RC_COMPILED_BASE "/etc/s6-rc/compiled" #define S6RC_LIVE_BASE "/s6/s6-rc" #define S6RC_COMPILED_DIR_LEN 32 #define S6RC_ONESHOT_RUNNER "s6rc-oneshot-runner" #define S6RC_ONESHOT_RUNNER_LEN (sizeof S6RC_ONESHOT_RUNNER - 1) #endif
/* ISC license. */ #ifndef S6RC_CONSTANTS_H #define S6RC_CONSTANTS_H #define S6RC_COMPILED_BASE "/etc/s6-rc/compiled" #define S6RC_LIVE_BASE "/run/s6-rc" #define S6RC_COMPILED_DIR_LEN 32 #define S6RC_ONESHOT_RUNNER "s6rc-oneshot-runner" #define S6RC_ONESHOT_RUNNER_LEN (sizeof S6RC_ONESHOT_RUNNER - 1) #endif
Clarify the dynamic linking structure.
/// @file sapi-dylink.h /// @brief Define the record used for runtime linking. /// This structure allows forth to easily look up things on the C /// side of the world. /// /// Special Rules: /// - The very first item is the size of the record. /// // This could be packed more tightly, but its now exactly // 16 bytes per record, which is nice. Make sure that doesn't // change. typedef struct { // This union is a bit crazy, but its the simplest way of // getting the compiler to shut up. union { void (*fp) (void); int* ip; unsigned int ui; unsigned int* uip; unsigned long* ulp; } p; ///< Pointer to the object of interest int16_t size; ///< Size in bytes int16_t count; ///< How many int8_t kind; ///< Is this a variable or a constant? int8_t strlen; ///< Length of the string char *name; ///< Null-Terminated C string. } runtimelink_t; /// Helper Macro. #define FORTHNAME(x) (sizeof(x)-1),x extern const runtimelink_t dynamiclinks[];
/// @file sapi-dylink.h /// @brief Define the record used for runtime linking. /// This structure allows forth to easily look up things on the C /// side of the world. /// /// Special Rules: /// - The very first item is the size of the record. /// // This could be packed more tightly, but its now exactly // 16 bytes per record, which is nice. Make sure that doesn't // change. // Conventions: // Size is the size of the fundamental thing in bytes, // and count is the number of them. // char array[64] = 1,64 // struct { a, b } s; sizeof(s),1 typedef struct { // This union is a bit crazy, but its the simplest way of // getting the compiler to shut up. union { void (*fp) (void); int* ip; unsigned int ui; unsigned int* uip; unsigned long* ulp; } p; ///< Pointer to the object of interest int16_t size; ///< Size in bytes int16_t count; ///< How many int8_t kind; ///< Is this a variable or a constant? int8_t strlen; ///< Length of the string char *name; ///< Null-Terminated C string. } runtimelink_t; /// Helper Macro. #define FORTHNAME(x) (sizeof(x)-1),x extern const runtimelink_t dynamiclinks[];
Make sure to mark all the methods in the dynamic sizing data source as required
#import <UIKit/UIKit.h> @protocol UITableViewDataSourceDynamicSizing; @interface UITableView (DynamicSizing) - (void)registerClass:(Class)cellClass forDynamicCellReuseIdentifier:(NSString *)identifier; - (void)registerNib:(UINib *)nib forDynamicCellReuseIdentifier:(NSString *)identifier; - (CGFloat)minimumHeightForCellWithReuseIdentifier:(NSString*)reuseIdentifier atIndexPath:(NSIndexPath*)indexPath; @end @protocol UITableViewDataSourceDynamicSizing <UITableViewDataSource> - (void)tableView:(UITableView*)tableView configureCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath*)indexPath; @end
#import <UIKit/UIKit.h> @protocol UITableViewDataSourceDynamicSizing; @interface UITableView (DynamicSizing) - (void)registerClass:(Class)cellClass forDynamicCellReuseIdentifier:(NSString *)identifier; - (void)registerNib:(UINib *)nib forDynamicCellReuseIdentifier:(NSString *)identifier; - (CGFloat)minimumHeightForCellWithReuseIdentifier:(NSString*)reuseIdentifier atIndexPath:(NSIndexPath*)indexPath; @end @protocol UITableViewDataSourceDynamicSizing <UITableViewDataSource> @required - (void)tableView:(UITableView*)tableView configureCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath*)indexPath; @end
Include both <sys/param.h> and <sys/vmparam.h> since both SUNOS and ULTRIX will need them.
#include <setjmp.h> /* Portability: A single method works on all the platforms we have tried so far, but this may not be true for all platforms. */ #if defined(ULTRIX42) || defined(ULTRIX43) || defined(SUNOS41) # define SETJMP _setjmp # define LONGJMP _longjmp extern "C" { int SETJMP( jmp_buf env ); void LONGJMP( jmp_buf env, int retval ); } #else // Unknown platforms fall through to here, generating compile time error # error #endif int data_start_addr(); int data_end_addr(); int stack_start_addr(); int stack_end_addr(); void ExecuteOnTmpStk( void (*func)() );
#include <setjmp.h> #include <sys/param.h> #include <sys/vmparam.h> /* Portability: A single method works on all the platforms we have tried so far, but this may not be true for all platforms. */ #if defined(ULTRIX42) || defined(ULTRIX43) || defined(SUNOS41) # define SETJMP _setjmp # define LONGJMP _longjmp extern "C" { int SETJMP( jmp_buf env ); void LONGJMP( jmp_buf env, int retval ); } #else // Unknown platforms fall through to here, generating compile time error # error #endif int data_start_addr(); int data_end_addr(); int stack_start_addr(); int stack_end_addr(); void ExecuteOnTmpStk( void (*func)() );
Add ending newline to test.
// RUN: clang -emit-llvm < %s 2>&1 | grep 'addrspace(1)' | count 5 int foo __attribute__((address_space(1))); int ban[10] __attribute__((address_space(1))); int bar() { return foo; } int baz(int i) { return ban[i]; }
// RUN: clang -emit-llvm < %s 2>&1 | grep 'addrspace(1)' | count 5 int foo __attribute__((address_space(1))); int ban[10] __attribute__((address_space(1))); int bar() { return foo; } int baz(int i) { return ban[i]; }
Add another missing file :(
// Copyright (c) 2007, 2008 libmv authors. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. #ifndef LIBMV_ID_GENERATOR_H #define LIBMV_ID_GENERATOR_H namespace libmv { class IdGenerator { public: IdGenerator() : next_(0) {} uint Generate() { return next_++; } private: uint next_; }; } // namespace libmv #endif // LIBMV_ID_GENERATOR_H
Fix build for the iPhone Simulator
#ifdef HAVE_FORK #define HAVE_FORK 1 #endif #if HAVE_FORK # if TARGET_OS_IPHONE || APPLE_SDK_IPHONEOS # define HAVE_SYSTEM 0 # else # define HAVE_SYSTEM 1 # endif #else # define HAVE_SYSTEM 0 #endif #if HAVE_SYSTEM #include "p/sh.h" #endif #include "p/spp.h" #include "p/acr.h" #include "p/pod.h" #include "p/cpp.h" struct Proc *procs[] = { &spp_proc, &cpp_proc, &pod_proc, &acr_proc, #if HAVE_SYSTEM &sh_proc, #endif NULL }; DEFAULT_PROC(spp) #define DEBUG 0
#ifdef HAVE_FORK #define HAVE_FORK 1 #endif #if HAVE_FORK # if TARGET_OS_IPHONE || APPLE_SDK_IPHONEOS || APPLE_SDK_IPHONESIMULATOR # define HAVE_SYSTEM 0 # else # define HAVE_SYSTEM 1 # endif #else # define HAVE_SYSTEM 0 #endif #if HAVE_SYSTEM #include "p/sh.h" #endif #include "p/spp.h" #include "p/acr.h" #include "p/pod.h" #include "p/cpp.h" struct Proc *procs[] = { &spp_proc, &cpp_proc, &pod_proc, &acr_proc, #if HAVE_SYSTEM &sh_proc, #endif NULL }; DEFAULT_PROC(spp) #define DEBUG 0
Add comment about init_list constructor.
//----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- template<class T> matrix<T>::matrix():data_(),rows_(0),cols_(0){} template<class T> matrix<T>::matrix( std::size_t rows, std::size_t cols ): data_(rows*cols),rows_(rows),cols_(cols){} template<class T> matrix<T>::matrix( std::initializer_list<std::initializer_list<T>> init_list): data_( init_list.size() * init_list.begin()->size() ), rows_(init_list.size()),cols_( init_list.begin()->size() ){ // TODO: copy values } /* template<class T> matrix<T>::matrix( const matrix& ); template<class T> matrix<T>::matrix( matrix&& ); */
//----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- template<class T> matrix<T>::matrix():data_(),rows_(0),cols_(0){} template<class T> matrix<T>::matrix( std::size_t rows, std::size_t cols ): data_(rows*cols),rows_(rows),cols_(cols){} template<class T> matrix<T>::matrix( std::initializer_list<std::initializer_list<T>> init_list): data_( init_list.size() * init_list.begin()->size() ), rows_(init_list.size()),cols_( init_list.begin()->size() ){ // TODO: copy values // Or create concat function for init_list and use it to initialize // data_ vector. } /* template<class T> matrix<T>::matrix( const matrix& ); template<class T> matrix<T>::matrix( matrix&& ); */
Add another nodes by for loop way.
#include <stdio.h> #include <stdlib.h> typedef struct n { int data; struct n * next; } node; /* Print Linked list values */ void showList(node * list){ int i = 1; while( list != NULL){ printf("#%d. node, data: %d at pointed: %p, and points to %p\n", i, list->data, list, list->next); list = list->next; i++; } } int main(){ node * root; /* First Node Allocation */ root = (node *) malloc(sizeof(node)); root->data = 0; root->next = NULL; /* Create another 9 nodes in the list. */ node * iter = root; for(int i = 1; i < 10; i++){ iter->next = (node *) malloc(sizeof(node)); iter = iter->next; iter->data = i*10; iter->next = NULL; } showList(root); return 0; } /* -- Resulted as -- #1. node, data: 0 at pointed: 00541738, and points to 00541768 #2. node, data: 10 at pointed: 00541768, and points to 00541778 #3. node, data: 20 at pointed: 00541778, and points to 00541788 #4. node, data: 30 at pointed: 00541788, and points to 00541798 #5. node, data: 40 at pointed: 00541798, and points to 005417A8 #6. node, data: 50 at pointed: 005417A8, and points to 005417B8 #7. node, data: 60 at pointed: 005417B8, and points to 005417C8 #8. node, data: 70 at pointed: 005417C8, and points to 005417D8 #9. node, data: 80 at pointed: 005417D8, and points to 005417E8 #10. node, data: 90 at pointed: 005417E8, and points to 00000000 */
Add an ERR_CAST() function to complement ERR_PTR and co.
#ifndef _LINUX_ERR_H #define _LINUX_ERR_H #include <linux/compiler.h> #include <asm/errno.h> /* * Kernel pointers have redundant information, so we can use a * scheme where we can return either an error code or a dentry * pointer with the same return value. * * This should be a per-architecture thing, to allow different * error and pointer decisions. */ #define MAX_ERRNO 4095 #ifndef __ASSEMBLY__ #define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) static inline void *ERR_PTR(long error) { return (void *) error; } static inline long PTR_ERR(const void *ptr) { return (long) ptr; } static inline long IS_ERR(const void *ptr) { return IS_ERR_VALUE((unsigned long)ptr); } #endif #endif /* _LINUX_ERR_H */
#ifndef _LINUX_ERR_H #define _LINUX_ERR_H #include <linux/compiler.h> #include <asm/errno.h> /* * Kernel pointers have redundant information, so we can use a * scheme where we can return either an error code or a dentry * pointer with the same return value. * * This should be a per-architecture thing, to allow different * error and pointer decisions. */ #define MAX_ERRNO 4095 #ifndef __ASSEMBLY__ #define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) static inline void *ERR_PTR(long error) { return (void *) error; } static inline long PTR_ERR(const void *ptr) { return (long) ptr; } static inline long IS_ERR(const void *ptr) { return IS_ERR_VALUE((unsigned long)ptr); } /** * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type * @ptr: The pointer to cast. * * Explicitly cast an error-valued pointer to another pointer type in such a * way as to make it clear that's what's going on. */ static inline void *ERR_CAST(const void *ptr) { /* cast away the const */ return (void *) ptr; } #endif #endif /* _LINUX_ERR_H */
Fix 32-bit compile by making the per-thread address data 64-bit
#ifndef __THREAD_INFO_H #define __THREAD_INFO_H #include "globals.h" #include "sift_writer.h" #include "bbv_count.h" #include "pin.H" #include <deque> typedef struct { Sift::Writer *output; ADDRINT dyn_addresses[Sift::MAX_DYNAMIC_ADDRESSES]; UINT32 num_dyn_addresses; Bbv *bbv; UINT64 thread_num; ADDRINT bbv_base; UINT64 bbv_count; ADDRINT bbv_last; BOOL bbv_end; UINT64 blocknum; UINT64 icount; UINT64 icount_cacheonly; UINT64 icount_cacheonly_pending; UINT64 icount_detailed; UINT64 icount_reported; ADDRINT last_syscall_number; ADDRINT last_syscall_returnval; UINT64 flowcontrol_target; ADDRINT tid_ptr; ADDRINT last_routine; ADDRINT last_call_site; BOOL last_syscall_emulated; BOOL running; } __attribute__((packed,aligned(LINE_SIZE_BYTES))) thread_data_t; extern thread_data_t *thread_data; void initThreads(); #endif // __THREAD_INFO_H
#ifndef __THREAD_INFO_H #define __THREAD_INFO_H #include "globals.h" #include "sift_writer.h" #include "bbv_count.h" #include "pin.H" #include <deque> typedef struct { Sift::Writer *output; UINT64 dyn_addresses[Sift::MAX_DYNAMIC_ADDRESSES]; UINT32 num_dyn_addresses; Bbv *bbv; UINT64 thread_num; ADDRINT bbv_base; UINT64 bbv_count; ADDRINT bbv_last; BOOL bbv_end; UINT64 blocknum; UINT64 icount; UINT64 icount_cacheonly; UINT64 icount_cacheonly_pending; UINT64 icount_detailed; UINT64 icount_reported; ADDRINT last_syscall_number; ADDRINT last_syscall_returnval; UINT64 flowcontrol_target; ADDRINT tid_ptr; ADDRINT last_routine; ADDRINT last_call_site; BOOL last_syscall_emulated; BOOL running; } __attribute__((packed,aligned(LINE_SIZE_BYTES))) thread_data_t; extern thread_data_t *thread_data; void initThreads(); #endif // __THREAD_INFO_H
Add intermediate TextureVideoFrame typedef for Chromium
/* * Copyright (c) 2015 The WebRTC 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 in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H #define COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H #include "webrtc/common_video/interface/i420_video_frame.h" // TODO(magjed): Remove this when all external dependencies are updated. namespace webrtc { typedef I420VideoFrame TextureVideoFrame; } // namespace webrtc #endif // COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H
Implement function to draw circle
#include <math.h> #include <glib.h> #include <gtk/gtk.h> #include "fake-lock-screen-pattern.h" void flsp_draw_circle(cairo_t *context, gint x, gint y, gint radius, GdkRGBA circle, GdkRGBA border) { cairo_set_line_width(context, 9); cairo_set_source_rgb(context, border.red, border.green, border.blue); cairo_arc(context, x, y, radius, 0, 2 * M_PI); cairo_stroke_preserve(context); cairo_set_source_rgb(context, circle.red, circle.green, circle.blue); cairo_fill(context); }
Fix for building without notify
/* Copyright (C) 2003 Timo Sirainen */ #include "lib.h" #include "ioloop-internal.h" #ifdef IOLOOP_NOTIFY_NONE struct io *io_loop_notify_add(struct ioloop *ioloop __attr_unused__, const char *path __attr_unused__, io_callback_t *callback __attr_unused__, void *context __attr_unused__) { return NULL; } void io_loop_notify_remove(struct ioloop *ioloop __attr_unused__, struct io *io __attr_unused__) { } void io_loop_notify_handler_init(struct ioloop *ioloop __attr_unused__) { } void io_loop_notify_handler_deinit(struct ioloop *ioloop __attr_unused__) { } #endif
/* Copyright (C) 2003 Timo Sirainen */ #include "lib.h" #include "ioloop-internal.h" #ifdef IOLOOP_NOTIFY_NONE #undef io_add_notify struct io *io_add_notify(const char *path __attr_unused__, io_callback_t *callback __attr_unused__, void *context __attr_unused__) { return NULL; } void io_loop_notify_remove(struct ioloop *ioloop __attr_unused__, struct io *io __attr_unused__) { } void io_loop_notify_handler_deinit(struct ioloop *ioloop __attr_unused__) { } #endif
Remove seL4_Yield() since it's removed from the RT kernel.
/* * Copyright 2014, NICTA * * This software may be distributed and modified according to the terms of * the BSD 2-Clause license. Note that NO WARRANTY is provided. * See "LICENSE_BSD2.txt" for details. * * @TAG(NICTA_BSD) */ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <sel4/sel4.h> long sys_sched_yield(va_list ap) { seL4_Yield(); return 0; }
/* * Copyright 2014, NICTA * * This software may be distributed and modified according to the terms of * the BSD 2-Clause license. Note that NO WARRANTY is provided. * See "LICENSE_BSD2.txt" for details. * * @TAG(NICTA_BSD) */ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <sel4/sel4.h> long sys_sched_yield(va_list ap) { /* won't work */ return 0; }
Add empty SF_IMPORTANT macro for release build
// Copyright (c) 2016 Sift Science. All rights reserved. @import Foundation; /** Debug output that can be turned on/off by SF_DEBUG_ENABLE macro. */ #ifdef SF_DEBUG_ENABLE #define SF_DEBUG(FORMAT, ...) NSLog(@"%s:%d " FORMAT, __FUNCTION__, __LINE__, ## __VA_ARGS__) #else #define SF_DEBUG(...) #endif /** Log messages to console that are important to the SDK users. */ #ifdef DEBUG #define SF_IMPORTANT(FORMAT, ...) NSLog(@"%s:%d " FORMAT, __FUNCTION__, __LINE__, ## __VA_ARGS__) #endif
// Copyright (c) 2016 Sift Science. All rights reserved. @import Foundation; /** Debug output that can be turned on/off by SF_DEBUG_ENABLE macro. */ #ifdef SF_DEBUG_ENABLE #define SF_DEBUG(FORMAT, ...) NSLog(@"%s:%d " FORMAT, __FUNCTION__, __LINE__, ## __VA_ARGS__) #else #define SF_DEBUG(...) #endif /** Log messages to console that are important to the SDK users. */ #ifdef DEBUG #define SF_IMPORTANT(FORMAT, ...) NSLog(@"%s:%d " FORMAT, __FUNCTION__, __LINE__, ## __VA_ARGS__) #else #define SF_IMPORTANT(...) #endif
Use offsetof() builtin with GCC
/* stddef.h */ /* * Copyright (c) 2014 Wind River Systems, 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 __INC_stddef_h__ #define __INC_stddef_h__ #include <bits/null.h> #include <bits/size_t.h> #if !defined(__ptrdiff_t_defined) #define __ptrdiff_t_defined typedef int ptrdiff_t; #endif #define offsetof(type, member) ((size_t) (&((type *) NULL)->member)) #endif /* __INC_stddef_h__ */
/* stddef.h */ /* * Copyright (c) 2014 Wind River Systems, 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 __INC_stddef_h__ #define __INC_stddef_h__ #include <bits/null.h> #include <bits/size_t.h> #if !defined(__ptrdiff_t_defined) #define __ptrdiff_t_defined typedef int ptrdiff_t; #endif #if defined(__GNUC__) #define offsetof(type, member) __builtin_offsetof(type, member) #else #define offsetof(type, member) ((size_t) (&((type *) NULL)->member)) #endif #endif /* __INC_stddef_h__ */
Disable Jtag came enable by default
/* * startup.h * * Created on: Nov 15, 2016 * Author: RoyerAriel */ #ifndef STARTUP_C_ #define STARTUP_C_ #include "Timer.h" void startup() { //Start Systick Timer at 1ms Systick_Startup(); AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE; //0x‭2000000‬ } #endif /* STARTUP_C_ */
/* * startup.h * * Created on: Nov 15, 2016 * Author: RoyerAriel */ #ifndef STARTUP_C_ #define STARTUP_C_ #include "Timer.h" void startup() { //Start Systick Timer at 1ms Systick_Startup(); AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE; //0x‭2000000‬disable jtag } #endif /* STARTUP_C_ */
Allow non printing chars to also work well
#include <stdio.h> #include <stdlib.h> #include <string.h> #define STTY "/bin/stty " const char RAW[] = STTY "raw"; const char COOKED[] = STTY "cooked"; const char default_str[] = "I AM AN IDIOT "; int main(int argc, char **argv) { system(RAW); const char *str; if ( argc == 2 ) str = argv[1]; else str = default_str; size_t len = strlen(str); while ( 1 ) { for ( size_t i = 0 ; i < len ; i++ ) { getchar(); printf("\b%c", str[i]); } system(COOKED); printf("\n"); system(RAW); } return 0; }
#include <stdio.h> #include <stdlib.h> #include <string.h> #define STTY "/bin/stty " const char RAW[] = STTY "raw"; const char COOKED[] = STTY "cooked"; const char default_str[] = "I AM AN IDIOT "; int main(int argc, char **argv) { system(RAW); const char *str; if ( argc == 2 ) str = argv[1]; else str = default_str; size_t len = strlen(str); while ( 1 ) { for ( size_t i = 0 ; i < len ; i++ ) { getchar(); printf("\r"); for ( size_t j = 0 ; j <= i ; j++ ) { printf("%c", str[j]); } } system(COOKED); printf("\n"); system(RAW); } return 0; }
Add qstr - query string utility
// ** QueryString // // This program reads chars from stdin without echo and put to stdout. // #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <termios.h> int main(int argc, char * args[]) { struct termios old_tio, new_tio; unsigned char c; /* get the terminal settings for stdin */ tcgetattr(STDIN_FILENO, &old_tio); /* we want to keep the old setting to restore them a the end */ new_tio = old_tio; /* disable canonical mode (buffered i/o) and local echo */ new_tio.c_lflag &= (~ICANON & ~ECHO); /* set the new settings immediately */ tcsetattr(STDIN_FILENO, TCSANOW, &new_tio); while ((c = getchar()) != '\n') { putchar(c); }; /* restore the former settings */ tcsetattr(STDIN_FILENO, TCSANOW, &old_tio); return 0; }
Fix a broken test in rev. 85199.
// RUN: clang-cc -E -C %s | FileCheck -strict-whitespace %s // CHECK: boo bork bar // zot // RUN: clang-cc -E -CC %s | FileCheck -strict-whitespace %s // CHECK: boo bork /* blah*/ bar // zot // RUN: clang-cc -E %s | FileCheck -strict-whitespace %s // CHECK: boo bork bar #define FOO bork // blah boo FOO bar // zot
// RUN: clang-cc -E -C %s | FileCheck -strict-whitespace %s && // CHECK: boo bork bar // zot // RUN: clang-cc -E -CC %s | FileCheck -strict-whitespace %s && // CHECK: boo bork /* blah*/ bar // zot // RUN: clang-cc -E %s | FileCheck -strict-whitespace %s // CHECK: boo bork bar #define FOO bork // blah boo FOO bar // zot
Implement accept of incoming requests
#include <netinet/in.h> #include <stdio.h> #include <sys/socket.h> int main(int argc, char** argv) { int listen_fd; struct sockaddr_in serv_addr; listen_fd = socket(AF_INET, SOCK_STREAM, 0); serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); serv_addr.sin_port = htons(8080); bind(listen_fd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)); if (listen(listen_fd, 64)) { perror("listen"); } else { } return 0; }
#include <netinet/in.h> #include <stdio.h> #include <sys/socket.h> #include <unistd.h> #define TRUE 1 #define BUFFER_SIZE 8096 int main(int argc, char** argv) { int listen_fd; int connection_fd; socklen_t length; int err; int read_len; char buffer[BUFFER_SIZE+1]; struct sockaddr_in serv_addr; struct sockaddr_in client_addr; listen_fd = socket(AF_INET, SOCK_STREAM, 0); serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); serv_addr.sin_port = htons(8080); err = bind(listen_fd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)); if (err == -1) { perror("bind"); } err = listen(listen_fd, 64); if (err == -1) { perror("listen"); } while (TRUE) { connection_fd = accept(listen_fd, (struct sockaddr*)&client_addr, &length); read_len = read(connection_fd, buffer, BUFFER_SIZE); printf("Read %d bytes: %s\n", read_len, buffer); close(connection_fd); } return 0; }
Change include to forward declaration
/// \file /// \brief This header contains functionality needed for serializing and deserealizing to/from a stream #pragma once #include "ISerializable.h" #include "IStorage.h" #include <iostream> /// Contains all the functionality provided by the library. namespace simpson { /// Serialize object to ostream std::ostream& operator<<(std::ostream& outStream, simpson::ISerializable& obj); /// Deserialize object from istream std::istream& operator>>(std::istream& inStream, simpson::ISerializable* obj); } // simpson
/// \file /// \brief This header contains functionality needed for serializing and deserealizing to/from a stream #pragma once #include "IStorage.h" #include <iostream> /// Contains all the functionality provided by the library. namespace simpson { class ISerializable; /// Serialize object to ostream std::ostream& operator<<(std::ostream& outStream, ISerializable& obj); /// Deserialize object from istream std::istream& operator>>(std::istream& inStream, ISerializable* obj); } // simpson
Add support for disabling blocks externally via preprocessor macro definitions at the project or target level
// // Licensed under the terms in License.txt // // Copyright 2010 Allen Ding. All rights reserved. // #import <Foundation/Foundation.h> #define KW_VERSION 0.5 // Blocks being unavailable cripples the usability of Kiwi, but is supported // because they are not available on anything less than a device running 3.2. #if defined(__BLOCKS__) #define KW_BLOCKS_ENABLED 1 #endif // #if defined(__BLOCKS__) // As of iPhone SDK 4 GM, exceptions thrown across an NSInvocation -invoke or // forwardInvocation: boundary in the simulator will terminate the app instead // of being caught in @catch blocks from the caller side of the -invoke. Kiwi // tries to handle this by storing the first exception that it would have // otherwise thrown in a nasty global that callers can look for and handle. // (Buggy termination is less desirable than global variables). // // Obviously, this can only handles cases where Kiwi itself would have raised // an exception. #if TARGET_IPHONE_SIMULATOR #define KW_TARGET_HAS_INVOCATION_EXCEPTION_BUG 1 #endif // #if TARGET_IPHONE_SIMULATOR
// // Licensed under the terms in License.txt // // Copyright 2010 Allen Ding. All rights reserved. // #import <Foundation/Foundation.h> #define KW_VERSION 0.5 // Blocks being unavailable cripples the usability of Kiwi, but is supported // because they are not available on anything less than a device running 3.2. #if defined(__BLOCKS__) #ifndef KW_BLOCKS_ENABLED #define KW_BLOCKS_ENABLED 1 #endif // #ifndef KW_BLOCKS_ENABLED #endif // #if defined(__BLOCKS__) // As of iPhone SDK 4 GM, exceptions thrown across an NSInvocation -invoke or // forwardInvocation: boundary in the simulator will terminate the app instead // of being caught in @catch blocks from the caller side of the -invoke. Kiwi // tries to handle this by storing the first exception that it would have // otherwise thrown in a nasty global that callers can look for and handle. // (Buggy termination is less desirable than global variables). // // Obviously, this can only handles cases where Kiwi itself would have raised // an exception. #if TARGET_IPHONE_SIMULATOR #define KW_TARGET_HAS_INVOCATION_EXCEPTION_BUG 1 #endif // #if TARGET_IPHONE_SIMULATOR