#include <glib.h>
#include <glib/gstdio.h>

#include <uuid/uuid.h>

#include <wizbit/file.h>

char *work_dir = "/tmp/wizbittest";

int main()
{
	system ("rm -rf /tmp/wizbittest");
	mkdir (work_dir,0700);
	chdir (work_dir);

	{
		struct wiz_file *file;
		wiz_vref vref;
		FILE *fp;

		file = wiz_file_open(WIZ_FILE_NEW, 0, 0);
		fp = wiz_file_get_handle(file);
		wiz_file_snapshot(file, vref);
		wiz_file_close(file);
	}

	return 0;
}

#include <glib.h>
#include <glib/gstdio.h>

#include <uuid/uuid.h>

#include <wizbit/file.h>

char *work_dir = "/tmp/wizbittest";

int main()
{
	system ("rm -rf /tmp/wizbittest");
	mkdir (work_dir,0700);
	chdir (work_dir);

	{
		struct wiz_file *file;
		wiz_vref vref;
		FILE *fp;

		file = wiz_file_open(WIZ_FILE_NEW, 0, 0);
		fp = wiz_file_get_handle(file);
		fprintf(fp, "I BELIEVE");
		wiz_file_snapshot(file, vref);
		wiz_file_close(file);
	}

	return 0;
}

Test writing to temp file and making a snapshot


#include <stdio.h>
#include <stdlib.h>

typedef struct State State;
struct State
{
    char c;
    State *out;
};

typedef struct List List;
struct List
{
    State *s;
};

State *State_new(char c, State *out)
{
	State *s;
	s = malloc(sizeof(*s));
	s->c = c;
	s->out = out;
	return s;
}

void *List_new(State **outpp)
{
    List *slist = malloc(sizeof(*slist));
    slist->s = *outpp;
    return slist;
}

int main()
{
    State *a = State_new('a', NULL);
    List *l  = List_new(&(a->out));

    /* This printf() will result in a seg fault, since a->out is NULL. */
    //printf("%c\n", a->out->c);

    /* change what State struct is pointed to by l */
    l->s = State_new('b', NULL);

    /* why is this not b? */
    //printf("%c\n", a->out->c);
    return 0;
}

Test code to simplify error

Test code to simplify error


#ifndef GAMEMAPS_PARSER_H
#define GAMEMAPS_PARSER_H

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

///
/// Parses content of the map header file.
///
/// \return `true` if successful, `false` otherwise
///
bool parse_map_header(
    uint8_t  *header,               ///< [in]  The content of the map header file
    size_t   length,                ///< [in]  The length of the map header file
    uint32_t *level_pointers,       ///< [out] The level pointers array
    size_t   *level_pointers_length ///< [out] The length of the level pointers array
);

#endif

#ifndef GAMEMAPS_PARSER_H
#define GAMEMAPS_PARSER_H

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

///
/// A structure representing a plane
///
typedef struct {
    uint16_t *data;  ///< Plane data
    size_t   length; ///< The length of the plane data
} plane_t;

///
/// A structure representing a level
///
typedef struct {
    plane_t  *planes;    ///< Planes
    size_t   planes_num; ///< The number of planes
    uint16_t width;      ///< The width of the level
    uint16_t height;     ///< The height of the level
    uint8_t  name[16];   ///< The name of the level
} level_t;

///
/// A structure representing map data
///
typedef struct {
    level_t *levels;    ///< Levels
    size_t  levels_num; ///< The number of levels
} map_data_t;

///
/// Parses content of the map header file.
///
/// \return `true` if successful, `false` otherwise
///
bool parse_map_header(
    uint8_t  *header,               ///< [in]  The content of the map header file
    size_t   length,                ///< [in]  The length of the map header file
    uint32_t *level_pointers,       ///< [out] The level pointers array
    size_t   *level_pointers_length ///< [out] The length of the level pointers array
);

///
/// Parses content of the map data file.
///
/// \return `true` if successful, `false` otherwise
///
bool parse_map_data(
    uint8_t    *data,       ///< [in]  Raw map data
    size_t     data_length, ///< [in]  The length of the raw map data
    map_data_t *map_data    ///< [out] Parsed map data
);

#endif

Add some definitions required for parsing map data


#undef __STRICT_ANSI__

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <windows.h>

#define URL "https://msdn.microsoft.com/en-us/library/windows/desktop/ms645505\
(v=vs.85).aspx"
#define VERSION "0.1.0"

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, LPSTR lpCmdLine,
                   int nCmdShow)
{
    LPWSTR *szArgList;
    int argCount;

    szArgList = CommandLineToArgvW(GetCommandLineW(), &argCount);
    if (szArgList == NULL) {
        fprintf(stderr, "Unable to parse the command line.\n");
        return 255;
    }
    if (argCount < 3 || argCount > 4) {
        fprintf(stderr, "Batch MessageBox v" VERSION "\n");
        fprintf(stderr, "Usage: %ls message title [type]\n\n", szArgList[0]);

        fprintf(stderr, "Calls MessageBoxW() with the given arguments. See\n"
                        URL "\nfor the possible values of \"type\". "
                        "ERRORLEVEL is the return value or 255 on\nerror.\n");
        return 255;
    }
    /* Ignore _wtoi errors. */
    int type = _wtoi(szArgList[3]);
    int button = MessageBoxW(NULL, szArgList[1], szArgList[2], type);
    LocalFree(szArgList);
    return button;
}

Fix warning about implicit declaration of _wtoi()

Per http://0mg.hatenadiary.jp/entry/2015/08/25/172457.


//
//  VOKManagedObjectMapperMacros.h
//  Vokoder
//
//  Copyright © 2016 Vokal.
//

#ifndef VOKManagedObjectMapperMacros_h
#define VOKManagedObjectMapperMacros_h

#import "VOKManagedObjectMap.h"

#import <VOKKeyPathHelper.h>

/**
 *  Creates a map with the default date mapper.
 *
 *  @param inputKeyPath           The foreign key to match with the local key.
 *  @param coreDataSelectorSymbol The local selector symbol.
 *  @param klass                  The class on which the local selector symbol is defined.
 *
 *  @return A VOKManagedObjectMap
 */
#ifndef VOKMapForeignToLocalClassProperty
#   define VOKMapForeignToLocalClassProperty(inputKeyPath, klass, coreDataSelectorSymbol) \
[VOKManagedObjectMap mapWithForeignKeyPath:inputKeyPath coreDataKey:VOKKeyForInstanceOf(klass, coreDataSelectorSymbol)]
#endif

/**
 *  Creates a map with the default date mapper.
 *
 *  @param inputKeyPath           The foreign key to match with the local key.
 *  @param coreDataSelectorSymbol The local selector symbol on the class of self.
 *
 *  @return A VOKManagedObjectMap
 */
#ifndef VOKMapForeignToLocalForSelf
#   define VOKMapForeignToLocalForSelf(inputKeyPath, coreDataSelectorSymbol) \
[VOKManagedObjectMap mapWithForeignKeyPath:inputKeyPath coreDataKey:VOKKeyForSelf(coreDataSelectorSymbol)]
#endif

#endif /* VOKManagedObjectMapperMacros_h */

//
//  VOKManagedObjectMapperMacros.h
//  Vokoder
//
//  Copyright © 2016 Vokal.
//

#ifndef VOKManagedObjectMapperMacros_h
#define VOKManagedObjectMapperMacros_h

#import "VOKManagedObjectMap.h"

#import <VOKUtilities/VOKKeyPathHelper.h>

/**
 *  Creates a map with the default date mapper.
 *
 *  @param inputKeyPath           The foreign key to match with the local key.
 *  @param coreDataSelectorSymbol The local selector symbol.
 *  @param klass                  The class on which the local selector symbol is defined.
 *
 *  @return A VOKManagedObjectMap
 */
#ifndef VOKMapForeignToLocalClassProperty
#   define VOKMapForeignToLocalClassProperty(inputKeyPath, klass, coreDataSelectorSymbol) \
[VOKManagedObjectMap mapWithForeignKeyPath:inputKeyPath coreDataKey:VOKKeyForInstanceOf(klass, coreDataSelectorSymbol)]
#endif

/**
 *  Creates a map with the default date mapper.
 *
 *  @param inputKeyPath           The foreign key to match with the local key.
 *  @param coreDataSelectorSymbol The local selector symbol on the class of self.
 *
 *  @return A VOKManagedObjectMap
 */
#ifndef VOKMapForeignToLocalForSelf
#   define VOKMapForeignToLocalForSelf(inputKeyPath, coreDataSelectorSymbol) \
[VOKManagedObjectMap mapWithForeignKeyPath:inputKeyPath coreDataKey:VOKKeyForSelf(coreDataSelectorSymbol)]
#endif

#endif /* VOKManagedObjectMapperMacros_h */

Include VOKKeyPathHelper.h as a module header


#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int* toInt(char * s, int len){
	int * arr = malloc(sizeof(char) * len);
	int i = 0;

	for(i = 0; i < len; i++) {
		arr[i] = s[i] - '0';
	}

	return arr;
}

int main(int argc, char *argv[]) {
	int n1_len = strlen(argv[1]);
	int n2_len = strlen(argv[2]);

	int * n1 = toInt(argv[1], n1_len);
	int * n2 = toInt(argv[2], n2_len);

	free(n2);
	free(n1);
	return 0;
}

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int* toInt(char * s, int len){
	int * arr = malloc(sizeof(int) * len);
	int i = 0;

	for(i = 0; i < len; i++) {
		arr[i] = s[i] - '0';
	}

	return arr;
}

int** getabcd(int *arr1, int *arr2, int len1, int len2){
	int i,j;
	int *a = malloc(sizeof(int*) * (len1 / 2));
	int *b = malloc(sizeof(int*) * (len1 / 2 + (len1 % 2)));
	int *c = malloc(sizeof(int*) * (len2 / 2));
	int *d = malloc(sizeof(int*) * (len2 / 2 + (len2 % 2)));
	int **abcd = malloc(sizeof(int*) * 4);

	for(i = 0; i < len1/2; i++){
		a[i] = arr1[i];
		b[i] = arr1[i+len1/2];
	}
	if (len1 % 2) {
		b[i] = arr1[len1 - 1];
	}

	for(i = 0; i < len2/2; i++){
		c[i] = arr2[i];
		d[i] = arr2[i+len2/2];
	}
	if (len2 % 2) {
		d[i] = arr2[len2 - 1];
	}

	abcd = (int*[4]){a,b,c,d};

	return abcd;
}

int main(int argc, char *argv[]) {
	int n1_len = strlen(argv[1]);
	int n2_len = strlen(argv[2]);

	int * n1 = toInt(argv[1], n1_len);
	int * n2 = toInt(argv[2], n2_len);
	int i,j;
	int **abcd = getabcd(n1, n2, n1_len, n2_len);

	free(n2);
	free(n1);
	return 0;
}

Split int arrays into 4 smaller int arrays

Managed to split int arrays into 4 smaller int arrays representing
a, b, c, and d, and return as an array of these 4 arrays. Am not
sure this is the best way to go about this anymore...


#include <stdio.h>
#include <string.h>
#include <time.h>
#include <orbit/orbit.h>

int main(int argc, const char** argv) {

    if(argc < 2) {
        fprintf(stderr, "error: no input module file.\n");
        return -1;
    }

    OrbitVM* vm = orbit_vmNew();
    if(orbit_vmInvoke(vm, argv[1], "main")) {
        fprintf(stderr, "error: interpreter error\n");
    }
    orbit_vmDealloc(vm);
}

#include <stdio.h>
#include <string.h>
#include <time.h>
#include <orbit/orbit.h>

int main(int argc, const char** argv) {

    if(argc < 2) {
        fprintf(stderr, "error: no input module file.\n");
        return -1;
    }

    OrbitVM* vm = orbit_vmNew();
    if(!orbit_vmInvoke(vm, argv[1], "main")) {
        fprintf(stderr, "error: interpreter error\n");
    }
    orbit_vmDealloc(vm);
}

Fix wrong success check in runtime cli

Fix wrong success check in runtime cli


// MonoIC compiler
#ifndef IV_BREAKER_MONO_IC_H_
#define IV_BREAKER_MONO_IC_H_
namespace iv {
namespace lv5 {
namespace breaker {

class MonoIC {
};

} } }  // namespace iv::lv5::breaker
#endif  // IV_BREAKER_MONO_IC_H_

Add initial MonoIC compiler file

Add initial MonoIC compiler file


//===- TargetSelect.h - Target Selection & Registration -------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file provides utilities to make sure that certain classes of targets are
// linked into the main application executable, and initialize them as
// appropriate.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TARGET_TARGETSELECT_H
#define LLVM_TARGET_TARGETSELECT_H

#include "llvm/Config/config.h"

namespace llvm {
  // Declare all of the target-initialization functions that are available.
#define LLVM_TARGET(TargetName) void Initialize##TargetName##Target();
#include "llvm/Config/Targets.def"

  // Declare all of the available asm-printer initialization functions.
  // Declare all of the target-initialization functions.
#define LLVM_ASM_PRINTER(TargetName) void Initialize##TargetName##AsmPrinter();
#include "llvm/Config/AsmPrinters.def"

  /// InitializeAllTargets - The main program should call this function if it
  /// wants to link in all available targets that LLVM is configured to support.
  inline void InitializeAllTargets() {
#define LLVM_TARGET(TargetName) llvm::Initialize##TargetName##Target();
#include "llvm/Config/Targets.def"
  }

  /// InitializeAllAsmPrinters - The main program should call this function if
  /// it wants all asm printers that LLVM is configured to support.  This will
  /// cause them to be linked into its executable.
  inline void InitializeAllAsmPrinters() {
#define LLVM_ASM_PRINTER(TargetName) Initialize##TargetName##AsmPrinter();
#include "llvm/Config/AsmPrinters.def"
  }

  /// InitializeNativeTarget - The main program should call this function to
  /// initialize the native target corresponding to the host.  This is useful
  /// for JIT applications to ensure that the target gets linked in correctly.
  inline bool InitializeNativeTarget() {
  // If we have a native target, initialize it to ensure it is linked in.
#ifdef LLVM_NATIVE_ARCH
#define DoInit2(TARG, MOD)   llvm::Initialize ## TARG ## MOD()
#define DoInit(T, M) DoInit2(T, M)
    DoInit(LLVM_NATIVE_ARCH, Target);
    return false;
#undef DoInit
#undef DoInit2
#else
    return true;
#endif
  }
}

#endif

Add a utility header that makes it easy to link in the right set
of targets for various purposes.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@73610 91177308-0d34-0410-b5e6-96231b3b80d8


#ifndef _GL_H_
#define _GL_H_

#if defined __APPLE__
#include <OpenGLES/ES3/gl.h>
#include <OpenGLES/ES3/glext.h>
#elif defined GL_ES
#include <GLES3/gl3.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#else
#define GL_GLEXT_PROTOTYPES

#ifdef WIN32
#include <GL/glew.h>
#include <windows.h>
#endif

#ifdef __ANDROID__
#include <GLES3/gl3.h>
#include <GLES3/gl3ext.h>
#else
#include <GL/gl.h>

#ifdef _WIN32
#include "../system/win32/glext.h"
#else
#include <GL/glext.h>
#endif
#endif

#endif

#endif

#ifndef _GL_H_
#define _GL_H_

#if defined __APPLE__
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#elif defined GL_ES
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <importgl.h>
#else
//#define GL_GLEXT_PROTOTYPES

#ifdef WIN32
#include <GL/glew.h>
#include <windows.h>
#endif

#ifdef __ANDROID__
#include <importgl.h>
#else
#include <GL/gl.h>

#ifdef _WIN32
#include "../system/win32/glext.h"
#else
#include <GL/glext.h>
#endif
#endif

#endif

#endif

Remove gl includes from __ANDROID__

Remove gl includes from __ANDROID__


#ifndef __IDRIS_DIRECTORY_H
#define __IDRIS_DIRECTORY_H

char* idris2_currentDirectory();
int idris2_changeDir(char* dir);
int idris2_createDir(char* dir);
void* idris2_openDir(char* dir);
void idris2_dirClose(void* d);
char* idris2_nextDirEntry(void* d);

#endif

#ifndef __IDRIS_DIRECTORY_H
#define __IDRIS_DIRECTORY_H

char* idris2_currentDirectory();
int idris2_changeDir(char* dir);
int idris2_createDir(char* dir);
void* idris2_openDir(char* dir);
void idris2_closeDIr(void* d);
int idris2_removeDir(char* path);
char* idris2_nextDirEntry(void* d);

#endif

Update C support header files

Update C support header files


// Copyright 2012-2013 Samplecount S.L.
//
// 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 METHCLA_UTILITY_MACROS_H_INCLUDED
#define METHCLA_UTILITY_MACROS_H_INCLUDED

#if defined(__GNUC__)
#    define METHCLA_WITHOUT_WARNINGS_BEGIN                           \
        _Pragma("GCC diagnostic push")                               \
            _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \
                _Pragma("GCC diagnostic ignored \"-Wunused-private-field\"")
#    define METHCLA_WITHOUT_WARNINGS_END _Pragma("GCC diagnostic pop")
#else
#    define METHCLA_WITHOUT_WARNINGS_BEGIN
#    define METHCLA_WITHOUT_WARNINGS_END
#endif

#endif // METHCLA_UTILITY_MACROS_H_INCLUDED

// Copyright 2012-2013 Samplecount S.L.
//
// 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 METHCLA_UTILITY_MACROS_H_INCLUDED
#define METHCLA_UTILITY_MACROS_H_INCLUDED

#if defined(__GNUC__)
#    if __GNUC__ > 4
#        define METHCLA_WITHOUT_WARNINGS_BEGIN                   \
            _Pragma("GCC diagnostic push") _Pragma(              \
                "GCC diagnostic ignored \"-Wunused-parameter\"") \
                _Pragma("GCC diagnostic ignored \"-Wunused-private-field\"")
#        define METHCLA_WITHOUT_WARNINGS_END _Pragma("GCC diagnostic pop")
#    else
#        define METHCLA_WITHOUT_WARNINGS_BEGIN \
            _Pragma("GCC diagnostic push")     \
                _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"")
#        define METHCLA_WITHOUT_WARNINGS_END _Pragma("GCC diagnostic pop")
#    endif
#else
#    define METHCLA_WITHOUT_WARNINGS_BEGIN
#    define METHCLA_WITHOUT_WARNINGS_END
#endif

#endif // METHCLA_UTILITY_MACROS_H_INCLUDED

Remove -Wunused-private-field from pragma for gcc <= 4


// RUN: %check -e %s

main()
{
	struct A
	{
		int i;
	} a, b, c;

	a = b ? : c; // CHECK: error: struct involved in if-expr
}

// RUN: %check -e %s

main()
{
	struct A
	{
		int i;
	} a, b, c;

	a = b ? : c; // CHECK: error: struct involved in ?:
}

Fix struct if-expression test warning

Fix struct if-expression test warning


#ifndef __ResourceEdit_H
#define __ResourceEdit_H

#include "midasLogAware.h"
#include "midasResourceDescTable.h"
#include <QObject>

class midasDatabaseProxy;
class QTableWidgetItem;

namespace mdo {
  class Community;
  class Collection;
  class Item;
  class Bitstream;
};

class ResourceEdit : public QObject, public midasLogAware
{
  Q_OBJECT
public:

  ResourceEdit(midasDatabaseProxy* database);
  ~ResourceEdit();

  void Save(QTableWidgetItem* row);

signals:
  void DataModified(std::string uuid);

protected:

  void SaveCommunity(mdo::Community*, MIDASFields, std::string data);
  void SaveCollection(mdo::Collection*, MIDASFields, std::string data);
  void SaveItem(mdo::Item*, MIDASFields, std::string data);
  void SaveBitstream(mdo::Bitstream*, MIDASFields, std::string data);

  midasDatabaseProxy* m_database;
};

#endif

#ifndef __ResourceEdit_H
#define __ResourceEdit_H

#include "midasLogAware.h"
#include "MidasResourceDescTable.h"
#include <QObject>

class midasDatabaseProxy;
class QTableWidgetItem;

namespace mdo {
  class Community;
  class Collection;
  class Item;
  class Bitstream;
};

class ResourceEdit : public QObject, public midasLogAware
{
  Q_OBJECT
public:

  ResourceEdit(midasDatabaseProxy* database);
  ~ResourceEdit();

  void Save(QTableWidgetItem* row);

signals:
  void DataModified(std::string uuid);

protected:

  void SaveCommunity(mdo::Community*, MIDASFields, std::string data);
  void SaveCollection(mdo::Collection*, MIDASFields, std::string data);
  void SaveItem(mdo::Item*, MIDASFields, std::string data);
  void SaveBitstream(mdo::Bitstream*, MIDASFields, std::string data);

  midasDatabaseProxy* m_database;
};

#endif

BUG: Fix wrong case bug causing compile error on unix platforms

SVN-Revision: 2901


/*
 * This file is part of libFirm.
 * Copyright (C) 2012 University of Karlsruhe.
 */

/**
 * @file
 * @brief       Compute an estimate of basic block executions.
 * @author      Adam M. Szalkowski
 * @date        28.05.2006
 */
#ifndef FIRM_ANA_EXECFREQ_T_H
#define FIRM_ANA_EXECFREQ_T_H

#include "execfreq.h"

void init_execfreq(void);

void exit_execfreq(void);

void set_block_execfreq(ir_node *block, double freq);

typedef struct ir_execfreq_int_factors {
	double max;
	double min_non_zero;
	double m, b;
} ir_execfreq_int_factors;

void ir_calculate_execfreq_int_factors(ir_execfreq_int_factors *factors,
                                       ir_graph *irg);

int get_block_execfreq_int(const ir_execfreq_int_factors *factors,
                           const ir_node *block);

#endif

/*
 * This file is part of libFirm.
 * Copyright (C) 2012 University of Karlsruhe.
 */

/**
 * @file
 * @brief       Compute an estimate of basic block executions.
 * @author      Adam M. Szalkowski
 * @date        28.05.2006
 */
#ifndef FIRM_ANA_EXECFREQ_T_H
#define FIRM_ANA_EXECFREQ_T_H

#include "execfreq.h"

void init_execfreq(void);

void exit_execfreq(void);

void set_block_execfreq(ir_node *block, double freq);

typedef struct ir_execfreq_int_factors {
	double min_non_zero;
	double m, b;
} ir_execfreq_int_factors;

void ir_calculate_execfreq_int_factors(ir_execfreq_int_factors *factors,
                                       ir_graph *irg);

int get_block_execfreq_int(const ir_execfreq_int_factors *factors,
                           const ir_node *block);

#endif

execfreq: Remove unused attribute max from int_factors.


//  L3TestResult.h
//  Created by Rob Rix on 2012-11-12.
//  Copyright (c) 2012 Rob Rix. All rights reserved.

#import <Foundation/Foundation.h>

@interface L3TestResult : NSObject

+(instancetype)testResultWithName:(NSString *)name startDate:(NSDate *)startDate;

@property (strong, nonatomic) L3TestResult *parent; // this really only exists to make stacks easier; nil it out on pop or you get retain cycles

@property (copy, nonatomic, readonly) NSString *name;
@property (strong, nonatomic, readonly) NSDate *startDate;
@property (assign, nonatomic) NSTimeInterval duration;
@property (assign, nonatomic) NSUInteger testCaseCount;
@property (assign, nonatomic) NSUInteger assertionCount;
@property (assign, nonatomic) NSUInteger assertionFailureCount;
@property (assign, nonatomic) NSUInteger exceptionCount;

@property (nonatomic, readonly) bool succeeded;
@property (nonatomic, readonly) bool failed;

@property (nonatomic, readonly) NSArray *testResults;
-(void)addTestResult:(L3TestResult *)testResult;

@end

//  L3TestResult.h
//  Created by Rob Rix on 2012-11-12.
//  Copyright (c) 2012 Rob Rix. All rights reserved.

#import <Foundation/Foundation.h>

@interface L3TestResult : NSObject

+(instancetype)testResultWithName:(NSString *)name startDate:(NSDate *)startDate;

@property (strong, nonatomic) L3TestResult *parent; // this really only exists to make stacks easier; nil it out on pop or you get retain cycles

@property (copy, nonatomic, readonly) NSString *name;
@property (strong, nonatomic, readonly) NSDate *startDate;
@property (strong, nonatomic) NSDate *endDate;
@property (assign, nonatomic) NSTimeInterval duration;
@property (assign, nonatomic) NSUInteger testCaseCount;
@property (assign, nonatomic) NSUInteger assertionCount;
@property (assign, nonatomic) NSUInteger assertionFailureCount;
@property (assign, nonatomic) NSUInteger exceptionCount;

@property (nonatomic, readonly) bool succeeded;
@property (nonatomic, readonly) bool failed;

@property (nonatomic, readonly) NSArray *testResults;
-(void)addTestResult:(L3TestResult *)testResult;

@end

Test results have an end date.

Test results have an end date.


/* -*- C++ -*- */
#ifndef   	FOO_H_
# define   	FOO_H_

#include <string>

int print_something(const char *message);
int print_something_else(const char *message2);

class SomeObject
{
    std::string m_prefix;
public:
    SomeObject (std::string const prefix)
        : m_prefix (prefix) {}

    int add_prefix (std::string& message) {
        message = m_prefix + message;
        return message.size();
    }

};

#endif 	    /* !FOO_H_ */

// -*- Mode: C++; c-file-style: "stroustrup"; indent-tabs-mode:nil; -*-
#ifndef   	FOO_H_
# define   	FOO_H_

#include <string>

// Yes, this code is stupid, I know; it is only meant as an example!

int print_something(const char *message);
int print_something_else(const char *message2);

class Foo
{
    std::string m_datum;
public:
    Foo () : m_datum ("")
        {}
    Foo (std::string datum) : m_datum (datum)
        {}
    std::string get_datum () const { return m_datum; }

    Foo (Foo const & other) : m_datum (other.get_datum ())
        {}
};

class Bar : public Foo
{

};

class SomeObject
{
    std::string m_prefix;
    Foo m_foo_value;
    Foo *m_foo_ptr;
    Foo *m_foo_shared_ptr;

public:
    SomeObject (std::string const prefix)
        : m_prefix (prefix), m_foo_ptr (0),
          m_foo_shared_ptr (0)
        {}

    int add_prefix (std::string& message) {
        message = m_prefix + message;
        return message.size ();
    }

    // pass by value, direction=in
    void set_foo_value (Foo foo) {
        m_foo_value = foo;
    }

    // pass by reference, direction=in
    void set_foo_ref (Foo& foo) {
        m_foo_value = foo;
    }

    // pass by reference, direction=out
    void peek_foo_ref (Foo& foo) {
        foo = m_foo_value;
    }

    // pass by pointer, direction=in, transfers ownership
    void set_foo_ptr (Foo *foo) {
        if (m_foo_ptr)
            delete m_foo_ptr;
        m_foo_ptr = foo;
    }

    // pass by pointer, direction=in, doesn't transfer ownership
    void set_foo_shared_ptr (Foo *foo) {
        m_foo_shared_ptr = foo;
    }

    // return value
    Foo get_foo_value () {
        return m_foo_value;
    }

    // return pointer, caller doesn't own return
    Foo * get_foo_shared_ptr () {
        return m_foo_shared_ptr;
    }

    // return pointer, caller owns return
    Foo * get_foo_ptr () {
        Foo *foo = m_foo_ptr;
        m_foo_ptr = NULL;
        return foo;
    }

};

#endif 	    /* !FOO_H_ */

Add example interfaces to test a bunch of new stuff (c++ subclassing, class parameter handling)


/* Copyright (C) 2003 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#include <ndb_global.h>
#include <NdbSleep.h>

int
NdbSleep_MilliSleep(int milliseconds){
  int result = 0;
  struct timespec sleeptime;
  sleeptime.tv_sec = milliseconds / 1000;
  sleeptime.tv_nsec = (milliseconds - (sleeptime.tv_sec * 1000)) * 1000000;
  result = nanosleep(&sleeptime, NULL);
  return result;
}

int
NdbSleep_SecSleep(int seconds){
  int result = 0;
  result = sleep(seconds);
  return result;
}

/* Copyright (C) 2003 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#include <ndb_global.h>
#include <my_sys.h>
#include <NdbSleep.h>

int
NdbSleep_MilliSleep(int milliseconds){
  my_sleep(milliseconds*1000);
  return 0;
#if 0
  int result = 0;
  struct timespec sleeptime;
  sleeptime.tv_sec = milliseconds / 1000;
  sleeptime.tv_nsec = (milliseconds - (sleeptime.tv_sec * 1000)) * 1000000;
  result = nanosleep(&sleeptime, NULL);
  return result;
#endif
}

int
NdbSleep_SecSleep(int seconds){
  int result = 0;
  result = sleep(seconds);
  return result;
}

Use my_sleep instead of nanosleep for portability


#ifndef _GPIO_H
#define _GPIO_H

#include <unistd.h>
#include "tock.h"

#define GPIO_DRIVER_NUM 1

#ifdef __cplusplus
extern "C" {
#endif

// GPIO pin enum is defined externally in platform headers
enum GPIO_Pin_enum;
typedef enum GPIO_Pin_enum GPIO_Pin_t;

typedef enum {
  PullUp=0,
  PullDown,
  PullNone,
} GPIO_InputMode_t;

typedef enum {
  Change=0,
  RisingEdge,
  FallingEdge,
} GPIO_InterruptMode_t;

int gpio_enable_output(GPIO_Pin_t pin);
int gpio_set(GPIO_Pin_t pin);
int gpio_clear(GPIO_Pin_t pin);
int gpio_toggle(GPIO_Pin_t pin);
int gpio_enable_input(GPIO_Pin_t pin, GPIO_InputMode_t pin_config);
int gpio_read(GPIO_Pin_t pin);
int gpio_enable_interrupt(GPIO_Pin_t pin, GPIO_InputMode_t pin_config,
    GPIO_InterruptMode_t irq_config);
int gpio_disable_interrupt(GPIO_Pin_t pin);
int gpio_disable(GPIO_Pin_t pin);
int gpio_interrupt_callback(subscribe_cb callback, void* callback_args);

#ifdef __cplusplus
}
#endif

#endif // _GPIO_H

#ifndef _GPIO_H
#define _GPIO_H

#include <unistd.h>
#include "tock.h"
#include "firestorm.h"

#define GPIO_DRIVER_NUM 1

#ifdef __cplusplus
extern "C" {
#endif

// GPIO pin enum is defined externally in platform headers
enum GPIO_Pin_enum;
typedef enum GPIO_Pin_enum GPIO_Pin_t;

typedef enum {
  PullUp=0,
  PullDown,
  PullNone,
} GPIO_InputMode_t;

typedef enum {
  Change=0,
  RisingEdge,
  FallingEdge,
} GPIO_InterruptMode_t;

int gpio_enable_output(GPIO_Pin_t pin);
int gpio_set(GPIO_Pin_t pin);
int gpio_clear(GPIO_Pin_t pin);
int gpio_toggle(GPIO_Pin_t pin);
int gpio_enable_input(GPIO_Pin_t pin, GPIO_InputMode_t pin_config);
int gpio_read(GPIO_Pin_t pin);
int gpio_enable_interrupt(GPIO_Pin_t pin, GPIO_InputMode_t pin_config,
    GPIO_InterruptMode_t irq_config);
int gpio_disable_interrupt(GPIO_Pin_t pin);
int gpio_disable(GPIO_Pin_t pin);
int gpio_interrupt_callback(subscribe_cb callback, void* callback_args);

#ifdef __cplusplus
}
#endif

#endif // _GPIO_H

Make GPIO_Pin_t type work by including firestorm.h

This isn't good long-term. The gpio driver should not have to depend on
a specific platform


// PARAM: --enable ana.int.interval --disable ana.int.def_exc --disable ana.int.enums
void main(){
  int n = 7;
  for (; n; n--) {
      assert(n==1); // UNKNOWN!
  }
  int i;
  if(i-1){
    assert(i==2); // UNKNOWN
  }
  return;
}

// PARAM: --enable ana.int.interval --disable ana.int.def_exc --disable ana.int.enums
void main(){
  int n = 7;
  for (; n; n--) {
      assert(n==1); // UNKNOWN!
  }
  int i;
  if(i-1){
    assert(i==2); // UNKNOWN!
  }
  return;
}

Fix tests 01/35: Any int != 0 evaluates to true


#include "config.h"

#ifdef HAVE_LIBSSL
#include <openssl/ssl.h>
#include <openssl/rand.h>
#include <openssl/err.h>
#endif /* HAVE_LIBSSL */

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/param.h>

#include <arpa/inet.h>

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <dirent.h>
#include <netdb.h>
#include <unistd.h>
#include <syslog.h>
#include <sysexits.h>
#include <utime.h>

#include <snet.h>

#include "denser.h"
#include "envelope.h"
#include "mx.h"
#include "ll.h"
#include "simta.h"

    int
main( int argc, char *argv[])
{
    extern int          optind;
    extern char         *optarg;

    struct in_addr	addr;

    if ( argc < 1 ) {
	fprintf( stderr, "Usage: %s address\n", argv[ 0 ]);
	exit( EX_USAGE );
    }

    if ( inet_pton( AF_INET, argv[ 1 ], &addr ) <= 0 ) {
	perror( "inet_pton" );
	exit( 1 );
    }

    switch ( check_reverse( argv[ 1 ], &addr )) {
    case 0:
	printf( "valid reverse\n" );
	exit( 0 );

    case 1:
	printf( "invalid reverse\n" );
	exit( 1 );

    default:
	fprintf( stderr, "check_reverse failed\n" );
	exit( 1 );
    }
}

Check the reverse of an IP

Check the reverse of an IP


/*
 * Copyright (c) 2016 Jan Hoffmann
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include "windows/main_window.h"

#include <pebble.h>

static void init(void) {
  main_window_push();
}

static void deinit(void) {
}

int main(void) {
  init();
  app_event_loop();
  deinit();
}

/*
 * Copyright (c) 2016 Jan Hoffmann
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include "lib/data.h"
#include "windows/main_window.h"

#include <pebble.h>

static void init(void) {
  if (data_init_receiver()) {
    main_window_push();
  }
}

# ifndef PBL_PLATFORM_APLITE
static void app_glance_reload_callback(AppGlanceReloadSession *session, size_t limit, void *context) {
  size_t count = data_get_fast_seller_count();
  if (limit < count) {
    count = limit;
  }

  AppGlanceSlice slice = (AppGlanceSlice) {};
  slice.layout.icon = APP_GLANCE_SLICE_DEFAULT_ICON;

  data_fast_seller *fast_seller;

  for (unsigned int i = 0; i < count; i++) {
    fast_seller = data_get_fast_seller(i);

    slice.layout.subtitle_template_string = fast_seller->title;
    slice.expiration_time = fast_seller->date;

    AppGlanceResult result = app_glance_add_slice(session, slice);
    if (result != APP_GLANCE_RESULT_SUCCESS) {
      APP_LOG(APP_LOG_LEVEL_ERROR, "Failed to add app glance slice: %d", result);
    }
  }

  data_deinit();
}
#endif

static void deinit(void) {
  # ifndef PBL_PLATFORM_APLITE
  if (data_get_fast_seller_count() > 0) {
    app_glance_reload(app_glance_reload_callback, NULL);
  } else {
    data_deinit();
  }
  # else
  data_deinit();
  # endif
}

int main(void) {
  init();
  app_event_loop();
  deinit();
}

Set fast sellers as app glance on supported watches


// precompiled header
/*
 *
 * Author: septimomend (Ivan Chapkailo)
 *
 * 27.06.2017
 *
 */

 #define _DEFAULT_SOURCE
 #define _BSD_SOURCE
 #define _GNU_SOURCE

 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <termios.h>
 #include <time.h>
 #include <unistd.h>

// precompiled header
/*
 *
 * Author: septimomend (Ivan Chapkailo)
 *
 * 27.06.2017
 *
 */

 #define _DEFAULT_SOURCE
 #define _BSD_SOURCE
 #define _GNU_SOURCE

 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <iostream>
 #include <stdarg.h>
 #include <cstdlib>
 #include <string>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <termios.h>
 #include <ctime>
 #include <unistd.h>

// defines

#define SEPT_CPP_EDITOR_VERSION "0.0.1"
#define SEPT_TAB_STOP 8
#define SEPT_QUIT_TIMES 2 // click times for exit

#define CTRL_KEY(k) ((k) & 0x1f)

enum keys
{
  BACKSPACE = 127,
  ARROW_LEFT = 1000,
  ARROW_RIGHT,
  ARROW_UP,
  ARROW_DOWN,
  DELETE_KEY,
  HOME_KEY,
  END_KEY,
  PAGE_UP,
  PAGE_DOWN
};

enum colorful
{
  HL_NORMAL = 0,
  HL_COMMENT,
  HL_MLCOMMENT,
  HL_KEYWORD1,
  HL_KEYWORD2,
  HL_STRING,
  HL_NUMBER,
  HL_MATCH
};

Update precompiled header -- added defines


#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class AliQuarkoniaAcceptance+;
#pragma link C++ class AliQuarkoniaEfficiency+;

#pragma link C++ class AliD0toKpi+;
#pragma link C++ class AliD0toKpiAnalysis+;
#pragma link C++ class AliBtoJPSItoEle+;
#pragma link C++ class AliBtoJPSItoEleAnalysis+;

#pragma link C++ class AliAODRecoDecayHF+;
#pragma link C++ class AliAODRecoDecayHF2Prong+;
#pragma link C++ class AliAODRecoDecayHF3Prong+;
#pragma link C++ class AliAODRecoDecayHF4Prong+;
#pragma link C++ class AliAnalysisVertexingHF+;
#pragma link C++ class AliAnalysisTaskVertexingHF+;

#pragma link C++ class AliAODDimuon+;
#pragma link C++ class AliAODEventInfo+;
#pragma link C++ class AliAnalysisTaskMuonAODfromGeneral+;
#pragma link C++ class AliAnalysisTaskSingleMu+;

#endif

#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class AliQuarkoniaAcceptance+;
#pragma link C++ class AliQuarkoniaEfficiency+;

#pragma link C++ class AliAODRecoDecayHF+;
#pragma link C++ class AliAODRecoDecayHF2Prong+;
#pragma link C++ class AliAODRecoDecayHF3Prong+;
#pragma link C++ class AliAODRecoDecayHF4Prong+;
#pragma link C++ class AliAnalysisVertexingHF+;
#pragma link C++ class AliAnalysisTaskVertexingHF+;

#pragma link C++ class AliAODDimuon+;
#pragma link C++ class AliAODEventInfo+;
#pragma link C++ class AliAnalysisTaskMuonAODfromGeneral+;
#pragma link C++ class AliAnalysisTaskSingleMu+;

#endif

Move AliD0toKpi* and AliBtoJPSI* from libPWG3base to libPWG3 (Andrea)


#ifdef __CINT__
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id$ */

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class  AliBODY;
#pragma link C++ class  AliMAG;
#pragma link C++ class  AliABSO;
#pragma link C++ class  AliDIPO;
#pragma link C++ class  AliDIPOv1;
#pragma link C++ class  AliDIPOv2;
#pragma link C++ class  AliFRAME;
#pragma link C++ class  AliFRAMEv0;
#pragma link C++ class  AliFRAMEv1;
#pragma link C++ class  AliHALL;
#pragma link C++ class  AliPIPE;
#pragma link C++ class  AliPIPEv0;
#pragma link C++ class  AliPIPEv1;
#pragma link C++ class  AliPIPEv3;
#pragma link C++ class  AliSHIL;

#endif

#ifdef __CINT__
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id$ */

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class  AliBODY;
#pragma link C++ class  AliMAG;
#pragma link C++ class  AliABSO;
#pragma link C++ class  AliABSOv0;
#pragma link C++ class  AliDIPO;
#pragma link C++ class  AliDIPOv1;
#pragma link C++ class  AliDIPOv2;
#pragma link C++ class  AliFRAME;
#pragma link C++ class  AliFRAMEv0;
#pragma link C++ class  AliFRAMEv1;
#pragma link C++ class  AliHALL;
#pragma link C++ class  AliPIPE;
#pragma link C++ class  AliPIPEv0;
#pragma link C++ class  AliPIPEv1;
#pragma link C++ class  AliPIPEv3;
#pragma link C++ class  AliSHIL;
#pragma link C++ class  AliSHILv0;

#endif

Add new classes to LinkDef

Add new classes to LinkDef


/*
 * This file is part of the KNOT Project
 *
 * Copyright (c) 2015, CESAR. 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.
 *    * Neither the name of the CESAR nor the
 *      names of its contributors may be used to endorse or promote products
 *      derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL CESAR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <errno.h>
#include <stdio.h>

#include "node.h"

static int tcp_probe(void)
{
	return -ENOSYS;
}

static void tcp_remove(void)
{
}

static int tcp_listen(void)
{
	return -ENOSYS;
}

static int tcp_accept(int srv_sockfd)
{
	return -ENOSYS;
}

static ssize_t tcp_recv(int sockfd, void *buffer, size_t len)
{
	return -ENOSYS;
}

static ssize_t tcp_send(int sockfd, const void *buffer, size_t len)
{
	return -ENOSYS;
}

static struct node_ops tcp_ops = {
	.name = "Radio Head: TCP",
	.probe = tcp_probe,
	.remove = tcp_remove,

	.listen = tcp_listen,
	.accept = tcp_accept,
	.recv = tcp_recv,
	.send = tcp_send
};

/*
 * The following functions MAY be implemented as plugins
 * initialization functions, avoiding function calls such
 * as manager@manager_start()->node@node_init()->
 * manager@node_ops_register()->node@node_probe()
 */
int node_init(void)
{
	return node_ops_register(&tcp_ops);
}

void node_exit(void)
{
}

gw: Add RadioHead TCP node 'driver' skeleton

This patch adds an abstraction for RadioHead TCP driver, allowing
development on Linux using TCP sockets instead of 'real' radios.


/* Remote access
--  Copyright (C) 2011, 2012, 2013 Stephane Carrez
--  Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
--  Licensed under the Apache License, Version 2.0 (the "License");
--  you may not use this file except in compliance with the License.
--  You may obtain a copy of the License at
--
--      http://www.apache.org/licenses/LICENSE-2.0
--
--  Unless required by applicable law or agreed to in writing, software
--  distributed under the License is distributed on an "AS IS" BASIS,
--  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--  See the License for the specific language governing permissions and
--  limitations under the License.
*/
#ifndef _GP_REMOTE_H
#define _GP_REMOTE_H

struct gp_server;

typedef int (* gp_remote_send_t) (struct gp_server *, const void *, size_t);

typedef int (* gp_remote_sync_t) (struct gp_server *);

typedef void (* gp_remote_close_t) (struct gp_server *);

struct gp_server
{
  gp_remote_send_t to_send;
  gp_remote_sync_t to_synchronize;
  gp_remote_close_t to_close;
};

extern void gp_remote_send (const void *addr, size_t len);

extern void gp_remote_sync (void);

extern void gp_remote_close (void);

extern int gp_remote_initialize (void);

#endif

Remove access to mat server

Remove access to mat server


#include "strings.h"
#include "sway/commands.h"
#include "sway/config.h"
#include "sway/input/keyboard.h"

struct cmd_results *cmd_floating_modifier(int argc, char **argv) {
	struct cmd_results *error = NULL;
	if ((error = checkarg(argc, "floating_modifier", EXPECTED_AT_LEAST, 1))) {
		return error;
	}

	uint32_t mod = get_modifier_mask_by_name(argv[0]);
	if (!mod) {
		return cmd_results_new(CMD_INVALID, "Invalid modifier");
	}

	if (argc == 1 || strcasecmp(argv[1], "normal") == 0) {
		config->floating_mod_inverse = false;
	} else if (strcasecmp(argv[1], "inverse") == 0) {
		config->floating_mod_inverse = true;
	} else {
		return cmd_results_new(CMD_INVALID,
				"Usage: floating_modifier <mod> [inverse|normal]");
	}

	config->floating_mod = mod;

	return cmd_results_new(CMD_SUCCESS, NULL);
}

#include "strings.h"
#include "sway/commands.h"
#include "sway/config.h"
#include "sway/input/keyboard.h"

struct cmd_results *cmd_floating_modifier(int argc, char **argv) {
	struct cmd_results *error = NULL;
	if ((error = checkarg(argc, "floating_modifier", EXPECTED_AT_LEAST, 1))) {
		return error;
	}

	if (strcasecmp(argv[0], "none") == 0) {
		config->floating_mod = 0;
		return cmd_results_new(CMD_SUCCESS, NULL);
	}

	uint32_t mod = get_modifier_mask_by_name(argv[0]);
	if (!mod) {
		return cmd_results_new(CMD_INVALID, "Invalid modifier");
	}

	if (argc == 1 || strcasecmp(argv[1], "normal") == 0) {
		config->floating_mod_inverse = false;
	} else if (strcasecmp(argv[1], "inverse") == 0) {
		config->floating_mod_inverse = true;
	} else {
		return cmd_results_new(CMD_INVALID,
				"Usage: floating_modifier <mod> [inverse|normal]");
	}

	config->floating_mod = mod;

	return cmd_results_new(CMD_SUCCESS, NULL);
}

Add ability to remove the floating modifier


//
//  SQRLInstaller+Private.h
//  Squirrel
//
//  Created by Justin Spahr-Summers on 2013-11-19.
//  Copyright (c) 2013 GitHub. All rights reserved.
//

#import "SQRLInstaller.h"

// A preferences key for the URL where the target bundle has been moved before
// installation.
//
// This is stored in preferences, rather than `SQRLShipItState`, to prevent an
// attacker from rewriting the URL during the installation process.
//
// Note that this key must remain backwards compatible, so ShipIt doesn't fail
// confusingly on a newer version.
extern NSString * const SQRLInstallerOwnedTargetBundleURLKey;

// A preferences key for the URL where the update bundle has been moved before
// installation.
//
// This is stored in preferences, rather than `SQRLShipItState`, to prevent an
// attacker from rewriting the URL during the installation process.
//
// Note that this key must remain backwards compatible, so ShipIt doesn't fail
// confusingly on a newer version.
extern NSString * const SQRLInstallerOwnedUpdateBundleURLKey;

// A preferences key for the code signature that the update _and_ target bundles
// must match in order to be valid.
//
// This is stored in preferences, rather than `SQRLShipItState`, to prevent an
// attacker from spoofing the validity requirements.
//
// Note that this key must remain backwards compatible, so ShipIt doesn't fail
// confusingly on a newer version.
extern NSString * const SQRLInstallerCodeSignatureKey;

//
//  SQRLInstaller+Private.h
//  Squirrel
//
//  Created by Justin Spahr-Summers on 2013-11-19.
//  Copyright (c) 2013 GitHub. All rights reserved.
//

#import "SQRLInstaller.h"

// A preferences key for the URL where the target bundle has been moved before
// installation.
//
// This is stored in preferences to prevent an attacker from rewriting the URL
// during the installation process.
//
// Note that this key must remain backwards compatible, so ShipIt doesn't fail
// confusingly on a newer version.
extern NSString * const SQRLInstallerOwnedTargetBundleURLKey;

// A preferences key for the URL where the update bundle has been moved before
// installation.
//
// This is stored in preferences to prevent an attacker from rewriting the URL
// during the installation process.
//
// Note that this key must remain backwards compatible, so ShipIt doesn't fail
// confusingly on a newer version.
extern NSString * const SQRLInstallerOwnedUpdateBundleURLKey;

// A preferences key for the code signature that the update _and_ target bundles
// must match in order to be valid.
//
// This is stored in preferences to prevent an attacker from spoofing the
// validity requirements.
//
// Note that this key must remain backwards compatible, so ShipIt doesn't fail
// confusingly on a newer version.
extern NSString * const SQRLInstallerCodeSignatureKey;

Update docs to reflect that the root prefs aren’t opposed to shipit state

ShipIt state is now in the prefs too.


#include <stdio.h>

void print_fib(int n)
{
    int a = 0;
    int b = 1;
    while (a < n)
    {
        printf("%d ", a);

        int old_a = a;
        a = b;
        b = old_a + b;
    }
}

int main()
{
    print_fib(500);
    printf("\n");
    return 0;
}

#include <stdio.h>

void print_fib(int n)
{
    int a = 0;
    int b = 1;
    while (a < n)
    {
        int old_a = a;
        printf("%d ", a);
        a = b;
        b = old_a + b;
    }
}

int main()
{
    print_fib(500);
    printf("\n");
    return 0;
}

Fix variable declaration non-conformant to C89

Declaring variables on C89 need to be done at the beginning of the
function scope. The old code failed on VS2010.


#pragma once
#include <string_view>

namespace tid {
    enum level : int {
        parent = -1,
        normal = 0,
        detail = 1,
        pedant = 2,
    };

    constexpr std::string_view level2sv(level l) noexcept {
        switch(l) {
            case normal: return "normal";
            case detail: return "detail";
            case pedant: return "pedant";
            case parent: return "parent";
            default: return "unknown";
        }
    }
}

template<typename T>
extern constexpr std::string_view enum2sv(const T &item);

template<typename T>
extern constexpr auto sv2enum(std::string_view item);

template<>
constexpr std::string_view enum2sv(const tid::level & item) {
    switch(item) {
        case(tid::level::normal): return "normal";
        case(tid::level::detail): return "detail";
        case(tid::level::pedant): return "pedant";
        case(tid::level::parent): return "parent";
        default: throw std::runtime_error("Unrecognized tid::level enum");
    }
}

template<>
constexpr auto sv2enum<tid::level>(std::string_view item) {
    if(item == "normal") return tid::level::normal;
    if(item == "detail") return tid::level::detail;
    if(item == "pedant") return tid::level::pedant;
    if(item == "parent") return tid::level::parent;
    throw std::runtime_error("Given item is not a tid::level enum: " + std::string(item));
}

Add support for specifying tid print level

Former-commit-id: dcbe2db0f881cae1e908cc67e3c32526477ea6a6


/*
 * #%L
 * %%
 * Copyright (C) 2011 - 2017 BMW Car IT GmbH
 * %%
 * 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.
 * #L%
 */
#ifndef STATUSCODE_H
#define STATUSCODE_H

#include <cstdint>
#include <string>

namespace joynr
{

/**
 * @brief This struct contains all the possible status codes of a Future.
 *
 */
enum class StatusCodeEnum : std::uint8_t {
    /**
     * @brief
     */
    SUCCESS = 0,
    /**
     * @brief
     */
    IN_PROGRESS = 1,
    /**
     * @brief
     */
    ERROR = 2,
    /**
     * @brief Future::waitFor() timed out.
     */
    WAIT_TIMED_OUT = 3,
};

class StatusCode
{
public:
    static std::string toString(StatusCodeEnum enumValue);
};

} // namespace joynr
#endif // STATUSCODE_H

/*
 * #%L
 * %%
 * Copyright (C) 2011 - 2017 BMW Car IT GmbH
 * %%
 * 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.
 * #L%
 */
#ifndef STATUSCODE_H
#define STATUSCODE_H

#include <cstdint>
#include <string>

namespace joynr
{

/**
 * @brief This struct contains all the possible status codes of a Future.
 *
 */
enum class StatusCodeEnum : std::uint8_t {
    /**
     * @brief The Future was successful and onSuccess was called.
     */
    SUCCESS = 0,

    /**
     * @brief The future is still in progress.
     */
    IN_PROGRESS = 1,

    /**
     * @brief Either a time-out occured or onError was called.
     */
    ERROR = 2,

    /**
     * @brief Future::waitFor() timed out.
     */
    WAIT_TIMED_OUT = 3,
};

class StatusCode
{
public:
    static std::string toString(StatusCodeEnum enumValue);
};

} // namespace joynr
#endif // STATUSCODE_H

[C++] Improve documentation of Future status codes.

Change-Id: I979083e18ea5facec4e6f52fc2ed486b4a18d358


/*
 *
 * Copyright 2018 Asylo authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#ifndef ASYLO_TEST_UTIL_TEST_FLAGS_H_
#define ASYLO_TEST_UTIL_TEST_FLAGS_H_

#include "absl/flags/declare.h"

// Location for all temporary test files.
ABSL_DECLARE_FLAG(std::string, test_tmpdir);

#endif  // ASYLO_TEST_UTIL_TEST_FLAGS_H_

/*
 *
 * Copyright 2018 Asylo authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#ifndef ASYLO_TEST_UTIL_TEST_FLAGS_H_
#define ASYLO_TEST_UTIL_TEST_FLAGS_H_

#include <string>

#include "absl/flags/declare.h"

// Location for all temporary test files.
ABSL_DECLARE_FLAG(std::string, test_tmpdir);

#endif  // ASYLO_TEST_UTIL_TEST_FLAGS_H_

Add missing include of string

Add missing include of string

PiperOrigin-RevId: 317401762
Change-Id: Icbc4d0e2a4e99a9e73a4d8e7ad148e34ee2e9d03


#include <sys/signal.h>
#include <stdio.h>
#include <unistd.h>

void handler_usr1 (int i)
{
  puts ("got signal usr1");
}

void handler_alrm (int i)
{
  puts ("got signal ALRM");
}

int main ()
{
  int i = 0;

  signal (SIGUSR1, handler_usr1);
  signal (SIGALRM, handler_alrm);

  puts ("Put breakpoint here");

  while (i++ < 20)
     sleep (1);
}

#include <signal.h>
#include <stdio.h>
#include <unistd.h>

void handler_usr1 (int i)
{
  puts ("got signal usr1");
}

void handler_alrm (int i)
{
  puts ("got signal ALRM");
}

int main ()
{
  int i = 0;

  signal (SIGUSR1, handler_usr1);
  signal (SIGALRM, handler_alrm);

  puts ("Put breakpoint here");

  while (i++ < 20)
     sleep (1);
}

[TestSendSignal] Include signal.h instead of sys/signal.h in the test case.

Summary:
Android API-9 does not have sys/signal.h. However, all sys/signal.h
has when present is an include of signal.h.

Test Plan: dotest.py -p TestSendSignal on linux and Android.

Reviewers: chaoren

Reviewed By: chaoren

Subscribers: tberghammer, lldb-commits

Differential Revision: http://reviews.llvm.org/D9779

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@237381 91177308-0d34-0410-b5e6-96231b3b80d8


int rec(int i,int* ptr) {
    int top;
    int x = 17;

    if(i == 0) {
        rec(5,&x);
        // Recursive call may have modified x
        assert(x == 17); //UNKNOWN!
    } else {
        x = 31;

        // ptr points to the outer x, it is unaffected by this assignment
        // and should be 17
        assert(*ptr == 31); //UNKNOWN!

        if(top) {
            ptr = &x;
        }

        // ptr may now point to both the inner and the outer x
        *ptr = 12;
        assert(*ptr == 12); //UNKNOWN!
        assert(x == 12); //UNKNOWN!
    }
    return 0;
}

int main() {
    int t;
    rec(0,&t);
    return 0;
}

Add test case for escaping via recursion


#ifndef SkEdgeBuilder_DEFINED
#define SkEdgeBuilder_DEFINED

#include "SkChunkAlloc.h"
#include "SkRect.h"
#include "SkTDArray.h"

class SkEdge;
class SkEdgeClipper;
class SkPath;

class SkEdgeBuilder {
public:
    SkEdgeBuilder();

    int build(const SkPath& path, const SkIRect* clip, int shiftUp);

    SkEdge** edgeList() { return fList.begin(); }

private:
    SkChunkAlloc        fAlloc;
    SkTDArray<SkEdge*>  fList;
    int                 fShiftUp;

    void addLine(const SkPoint pts[]);
    void addQuad(const SkPoint pts[]);
    void addCubic(const SkPoint pts[]);
    void addClipper(SkEdgeClipper*);
};

#endif

#ifndef SkEdgeBuilder_DEFINED
#define SkEdgeBuilder_DEFINED

#include "SkChunkAlloc.h"
#include "SkRect.h"
#include "SkTDArray.h"

struct SkEdge;
class SkEdgeClipper;
class SkPath;

class SkEdgeBuilder {
public:
    SkEdgeBuilder();

    int build(const SkPath& path, const SkIRect* clip, int shiftUp);

    SkEdge** edgeList() { return fList.begin(); }

private:
    SkChunkAlloc        fAlloc;
    SkTDArray<SkEdge*>  fList;
    int                 fShiftUp;

    void addLine(const SkPoint pts[]);
    void addQuad(const SkPoint pts[]);
    void addCubic(const SkPoint pts[]);
    void addClipper(SkEdgeClipper*);
};

#endif

Fix warning (struct forward-declared as class).

Review URL:  http://codereview.appspot.com/164061

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@451 2bbb7eff-a529-9590-31e7-b0007b416f81


/*
name: TEST042
description: Test for bug parsing ternary operators
output:
test042.c:19: error: bad type convertion requested
F1	I
G2	F1	main
{
\
F3	0
X4	F3	f
*/

int
main(void)
{
        void f(void);

        return (int) f();
}

Add test for casting from void

Add test for casting from void

This cast is not allowed, because there is no value
to cast.


// @(#)root/meta:$Id$
// Author: Bianca-Cristina Cristescu   09/07/13

/*************************************************************************
 * Copyright (C) 1995-2013, 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_TEnumConstant
#define ROOT_TEnumConstant

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TEnumConstant                                                        //
//                                                                      //
// TEnumConstant class defines a constant in the TEnum type.            //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGlobal
#include "TGlobal.h"
#endif

class TEnum;

class TEnumConstant : public TGlobal {
private:
   const TEnum       *fEnum;  //the enum type
   Long64_t           fValue; //the value for the constant

public:
   TEnumConstant(): fEnum(0), fValue(-1) {}
   TEnumConstant(DataMemberInfo_t *info, const char* name, Long64_t value, TEnum* type);
   virtual ~TEnumConstant();

   virtual void *GetAddress() const { return (void*)fValue; }
   Long64_t      GetValue() const { return fValue; }
   const TEnum  *GetType() const { return fEnum; }

   ClassDef(TEnumConstant,2)  //Enum type constant
};

#endif

// @(#)root/meta:$Id$
// Author: Bianca-Cristina Cristescu   09/07/13

/*************************************************************************
 * Copyright (C) 1995-2013, 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_TEnumConstant
#define ROOT_TEnumConstant

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TEnumConstant                                                        //
//                                                                      //
// TEnumConstant class defines a constant in the TEnum type.            //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGlobal
#include "TGlobal.h"
#endif

class TEnum;

class TEnumConstant : public TGlobal {
private:
   const TEnum       *fEnum;  //the enum type
   Long64_t           fValue; //the value for the constant

public:
   TEnumConstant(): fEnum(0), fValue(-1) {}
   TEnumConstant(DataMemberInfo_t *info, const char* name, Long64_t value, TEnum* type);
   virtual ~TEnumConstant();

   virtual void *GetAddress() const { return (void*) &fValue; }
   Long64_t      GetValue() const { return fValue; }
   const TEnum  *GetType() const { return fEnum; }

   ClassDef(TEnumConstant,2)  //Enum type constant
};

#endif

Implement a GetAddress method that returns the address of the value data member

this is different from the one of TGlobal which implies the presence of
information in the interpreter. This is done in order to support enum constants
which are created in the ROOT typesystem starting from the information in rootpcms.
*IMPORTANT NOTE*: the type of the enum constant value is Long64_t.


/* $Id: wUuid.h,v 1.1.2.2 2012/03/20 11:15:17 emmapollock Exp $
 *
 * OpenMAMA: The open middleware agnostic messaging API
 * Copyright (C) 2011 NYSE Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */
#ifndef WUUID_H__
#define WUUID_H__

#include "wombat/port.h"

typedef int wUuid;

COMMONExpDLL
void wUuid_generate_time (wUuid myUuid);

COMMONExpDLL
void wUuid_unparse (wUuid myUuid, char* out);

#endif /* WUUID_H__ */

/* $Id: wUuid.h,v 1.1.2.2 2012/03/20 11:15:17 emmapollock Exp $
 *
 * OpenMAMA: The open middleware agnostic messaging API
 * Copyright (C) 2011 NYSE Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */
#ifndef WUUID_H__
#define WUUID_H__

#include "wombat/port.h"

typedef char* wUuid;

COMMONExpDLL
void wUuid_generate_time (wUuid myUuid);

COMMONExpDLL
void wUuid_unparse (wUuid myUuid, char* out);

#endif /* WUUID_H__ */

Change uuid to char* from int for Windows

Signed-off-by: Mike Schonberg <a0b795d7498c6bea81956c992e86c1008615b63d@nyx.com>


// Copied & modified from 13/28.
#include <pthread.h>
#include <assert.h>

int g;
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  pthread_mutex_lock(&A);
  pthread_mutex_lock(&B);
  g++;
  pthread_mutex_unlock(&B); // Write Mine influence: [[g, B], t2_fun, {A}] -> 1
  pthread_mutex_lock(&B);
  g--;
  pthread_mutex_unlock(&B); // Write Mine influence: [[g, B], t2_fun, {A}] -> 0
  pthread_mutex_unlock(&A);
  return NULL;
}

int main(void) {
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);

  pthread_mutex_lock(&B); // Read & join to g Mine influence: [[g, B], t2_fun, {A}] -> (0 join 1 = Unknown)
  pthread_mutex_unlock(&B);

  pthread_mutex_lock(&A);
  pthread_mutex_lock(&B);
  assert(g == 0);
  pthread_mutex_unlock(&B);
  pthread_mutex_unlock(&A);

  pthread_join(id, NULL);
  return 0;
}

Add cleaned up example where mine and mutex-* differ


// REQUIRES: x86_64-linux
// RUN: %host_cc -O0 -g %s -o %t 2>&1
// RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s

#include <stdio.h>

int inc(int a) {
  return a + 1;
}

int main() {
  printf("%p\n", inc);
  return 0;
}

// CHECK: inc
// CHECK: print_context.c:7
// CHECK: 5  : #include
// CHECK: 6  :
// CHECK: 7 >: int inc
// CHECK: 8  :   return
// CHECK: 9  : }

// REQUIRES: x86_64-linux
// RUN: %host_cc -O0 -g %s -o %t 2>&1
// RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s
//
// See PR31870 for more details on the XFAIL
// XFAIL: avr

#include <stdio.h>

int inc(int a) {
  return a + 1;
}

int main() {
  printf("%p\n", inc);
  return 0;
}

// CHECK: inc
// CHECK: print_context.c:7
// CHECK: 5  : #include
// CHECK: 6  :
// CHECK: 7 >: int inc
// CHECK: 8  :   return
// CHECK: 9  : }

Mark a failing symbolizer test as XFAIL

[AVR] Mark a failing symbolizer test as XFAIL

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@309512 91177308-0d34-0410-b5e6-96231b3b80d8


#define JMP_BUF
#define HAS_TEST_AND_SET
typedef unsigned char slock_t;

#ifndef O_DIROPEN
#define O_DIROPEN	0x100000	/* should be in sys/fcntl.h */
#endif

#define tzname _tzname /* should be in time.h?*/
#define USE_POSIX_TIME
#define HAVE_INT_TIMEZONE /* has int _timezone */

Fix from Yutaka Tanida <yutaka@marin.or.jp>


#include <inttypes.h>
#include <stdio.h>

int main()
{
	uint64_t rflags;
	__asm__ __volatile__ ("pushf; popq %0" : "=g" (rflags) ::"memory");
	printf("rFLAGS: %016llx\n", rflags);
#define BIT(name, number) \
	printf("\t%s: %d\n", name, rflags & (1 << number) ? 1 : 0)

	const char* bits[] = {
		"CF",
		"Reserved (1)",
		"PF",
		"Reserved (0)",
		"AF",
		"Reserved (0)",
		"ZF (Zero)",
		"SF (Sign)",
		"TF (Trap)",
		"IF (Interrupt)",
		"DF (Direction)",
		"OF (Overflow)",
		"IOPL LSB",
		"IOPL MSB",
		"NT"
	};
	int i;
	for (i=0;i<sizeof(bits)/sizeof(*bits);i++)
		BIT(bits[i], i);
}

#include <inttypes.h>
#include <stdio.h>

int main()
{
	uint64_t rflags;
	__asm__ __volatile__ ("pushf; popq %0" : "=g" (rflags) ::"memory");
	printf("rFLAGS: %016llx\n", (unsigned long long)rflags);
#define BIT(name, number) \
	printf("\t%s: %d\n", name, rflags & (1 << number) ? 1 : 0)

	const char* bits[] = {
		"CF",
		"Reserved (1)",
		"PF",
		"Reserved (0)",
		"AF",
		"Reserved (0)",
		"ZF (Zero)",
		"SF (Sign)",
		"TF (Trap)",
		"IF (Interrupt)",
		"DF (Direction)",
		"OF (Overflow)",
		"IOPL LSB",
		"IOPL MSB",
		"NT"
	};
	int i;
	for (i=0;i<sizeof(bits)/sizeof(*bits);i++)
		BIT(bits[i], i);
}

Fix printf warning when long long is 128-bit.


/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
  #define GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"
  #define GR_TEST_UTILS 1
  #define SK_BUILD_FOR_ANDROID_FRAMEWORK
  #define SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)
  #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)
  #define SK_USE_FREETYPE_EMBOLDEN

  // Disable these Ganesh features
  #define SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION
  #define SK_DISABLE_RENDER_TARGET_SORTING

  // Legacy flags
  #define SK_IGNORE_GPU_DITHER
  #define SK_SUPPORT_DEPRECATED_CLIPOPS
  #define SK_SUPPORT_LEGACY_PAINT_TEXTMEASURE

  // Needed until we fix https://bug.skia.org/2440
  #define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
  #define SK_SUPPORT_LEGACY_EMBOSSMASKFILTER
  #define SK_SUPPORT_LEGACY_AA_CHOICE
  #define SK_SUPPORT_LEGACY_A8_MASKBLITTER
  #define SK_SUPPORT_LEGACY_AAA_CHOICE
#endif // SkUserConfigManual_DEFINED

/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
  #define GR_TEST_UTILS 1
  #define SK_BUILD_FOR_ANDROID_FRAMEWORK
  #define SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)
  #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)
  #define SK_USE_FREETYPE_EMBOLDEN

  // Disable these Ganesh features
  #define SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION
  #define SK_DISABLE_RENDER_TARGET_SORTING
  // Check error is expensive. HWUI historically also doesn't check its allocations
  #define GR_GL_CHECK_ALLOC_WITH_GET_ERROR 0

  // Legacy flags
  #define SK_IGNORE_GPU_DITHER
  #define SK_SUPPORT_DEPRECATED_CLIPOPS
  #define SK_SUPPORT_LEGACY_PAINT_TEXTMEASURE

  // Needed until we fix https://bug.skia.org/2440
  #define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
  #define SK_SUPPORT_LEGACY_EMBOSSMASKFILTER
  #define SK_SUPPORT_LEGACY_AA_CHOICE
  #define SK_SUPPORT_LEGACY_A8_MASKBLITTER
  #define SK_SUPPORT_LEGACY_AAA_CHOICE
#endif // SkUserConfigManual_DEFINED

Stop using Chrome config options.

Stop using Chrome config options.

These options used to apply some best practices for how to configure
Skia but those have been moved to GrContext options and this file is
now mostly optimizations specific to the Chrome rendering pipeline.

Specifically, we don't want to use VBOs on all classes of GPUs as it
can be much more efficient to allocate them on the CPU and pass the
allocation to the driver.

Bug: 119222339
Test: CTS passes and systrace shows increased performance
Change-Id: I1d495a4ae8de99215d6be1ac1e7e01b1263af9f1


#include <stdio.h>

int main() {
    float a, b;

    scanf("%f", &a);
    scanf("%f", &b);

    printf("MEDIA = %.5f\n", (a * 3.5 + b * 7.5) / 11.0);

    return 0;
}

Solve Average 1 in c

Solve Average 1 in c


/**
 * \file   os_rmdir.c
 * \brief  Remove a subdirectory.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */

#include <stdlib.h>
#include "premake.h"

int os_rmdir(lua_State* L)
{
	int z;
	const char* path = luaL_checkstring(L, 1);

#if PLATFORM_WINDOWS
	z = RemoveDirectory(path);
#else
	z = rmdir(path);
#endif

	if (!z)
	{
		lua_pushnil(L);
		lua_pushfstring(L, "unable to remove directory '%s'", path);
		return 2;
	}
	else
	{
		lua_pushboolean(L, 1);
		return 1;
	}
}

/**
 * \file   os_rmdir.c
 * \brief  Remove a subdirectory.
 * \author Copyright (c) 2002-2013 Jason Perkins and the Premake project
 */

#include <stdlib.h>
#include "premake.h"

int os_rmdir(lua_State* L)
{
	int z;
	const char* path = luaL_checkstring(L, 1);

#if PLATFORM_WINDOWS
	z = RemoveDirectory(path);
#else
	z = (0 == rmdir(path));
#endif

	if (!z)
	{
		lua_pushnil(L);
		lua_pushfstring(L, "unable to remove directory '%s'", path);
		return 2;
	}
	else
	{
		lua_pushboolean(L, 1);
		return 1;
	}
}

Fix error result handling in os.rmdir()

Fix error result handling in os.rmdir()


//=== SelectorExtras.h - Helpers for checkers using selectors -----*- C++ -*-=//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SELECTOREXTRAS_H
#define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SELECTOREXTRAS_H

#include "clang/AST/ASTContext.h"

namespace clang {
namespace ento {

template <typename... IdentifierInfos>
static inline Selector getKeywordSelector(ASTContext &Ctx,
                                          IdentifierInfos *... IIs) {
  static_assert(sizeof...(IdentifierInfos),
                "keyword selectors must have at least one argument");
  SmallVector<IdentifierInfo *, 10> II{{&Ctx.Idents.get(IIs)...}};

  return Ctx.Selectors.getSelector(II.size(), &II[0]);
}

template <typename... IdentifierInfos>
static inline void lazyInitKeywordSelector(Selector &Sel, ASTContext &Ctx,
                                           IdentifierInfos *... IIs) {
  if (!Sel.isNull())
    return;
  Sel = getKeywordSelector(Ctx, IIs...);
}

static inline void lazyInitNullarySelector(Selector &Sel, ASTContext &Ctx,
                                           const char *Name) {
  if (!Sel.isNull())
    return;
  Sel = GetNullarySelector(Name, Ctx);
}

} // end namespace ento
} // end namespace clang

#endif

//=== SelectorExtras.h - Helpers for checkers using selectors -----*- C++ -*-=//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SELECTOREXTRAS_H
#define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SELECTOREXTRAS_H

#include "clang/AST/ASTContext.h"

namespace clang {
namespace ento {

template <typename... IdentifierInfos>
static inline Selector getKeywordSelector(ASTContext &Ctx,
                                          IdentifierInfos *... IIs) {
  static_assert(sizeof...(IdentifierInfos),
                "keyword selectors must have at least one argument");
  SmallVector<IdentifierInfo *, 10> II({&Ctx.Idents.get(IIs)...});

  return Ctx.Selectors.getSelector(II.size(), &II[0]);
}

template <typename... IdentifierInfos>
static inline void lazyInitKeywordSelector(Selector &Sel, ASTContext &Ctx,
                                           IdentifierInfos *... IIs) {
  if (!Sel.isNull())
    return;
  Sel = getKeywordSelector(Ctx, IIs...);
}

static inline void lazyInitNullarySelector(Selector &Sel, ASTContext &Ctx,
                                           const char *Name) {
  if (!Sel.isNull())
    return;
  Sel = GetNullarySelector(Name, Ctx);
}

} // end namespace ento
} // end namespace clang

#endif

Use clang++-3.5 compatible initializer_list constructor

Otherwise, a warning is issued.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@302654 91177308-0d34-0410-b5e6-96231b3b80d8


/* To avoid recursion in certain includes */
#ifndef _RTDEFS_H_
#define _RTDEFS_H_ 1

#define MAXCHANS 4
#define MAX_INPUT_FDS 128
#define AUDIO_DEVICE 9999999

/* definition of input file desc struct used by rtinput */
typedef struct inputdesc {
	char filename[1024];
	int fd;
	int refcount;
#ifdef USE_SNDLIB
	short header_type;        /* e.g., AIFF_sound_file (in sndlib.h) */
	short data_format;        /* e.g., snd_16_linear (in sndlib.h) */
#else
  #ifdef sgi
	void *handle;
  #endif
#endif
	int data_location;        /* offset of sound data start in file */
	float dur;
} InputDesc;

extern float *outbuff;
extern float *outbptr;
extern short *inbuff;  // DT:  for use with real-time audio input

// NOTE: MAXBUF is a constant in SGI version!
extern int MAXBUF;

#ifdef _LANGUAGE_C_PLUS_PLUS     /* Needed for MIPSpro */
extern "C" {
#endif
extern float SR;
extern int NCHANS;
extern int RTBUFSAMPS;
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif

#endif /* _RTDEFS_H_ */

/* To avoid recursion in certain includes */
#ifndef _RTDEFS_H_
#define _RTDEFS_H_ 1

#define MAXCHANS 4
#define MAX_INPUT_FDS 128
#define AUDIO_DEVICE 9999999

/* definition of input file desc struct used by rtinput */
typedef struct inputdesc {
	char filename[1024];
	int fd;
	int refcount;
#ifdef USE_SNDLIB
	short header_type;        /* e.g., AIFF_sound_file (in sndlib.h) */
	short data_format;        /* e.g., snd_16_linear (in sndlib.h) */
#else
  #ifdef sgi
	void *handle;
  #endif
#endif
	int data_location;        /* offset of sound data start in file */
	float dur;
} InputDesc;

/* for insts - so they don't have to include globals.h */
extern int MAXBUF;
extern int NCHANS;
extern int RTBUFSAMPS;
extern float SR;

#endif /* _RTDEFS_H_ */

Move some globals to globals.h.

Move some globals to globals.h.


/* Copyright 2019 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef __CROS_EC_DRIVER_FINGERPRINT_FPSENSOR_H_
#define __CROS_EC_DRIVER_FINGERPRINT_FPSENSOR_H_

#if defined(HAVE_PRIVATE) && !defined(TEST_BUILD)
#define HAVE_FP_PRIVATE_DRIVER
#include "fpc/fpc_sensor.h"
#else
/* These values are used by the host (emulator) tests. */
#define FP_SENSOR_IMAGE_SIZE 0
#define FP_SENSOR_RES_X 0
#define FP_SENSOR_RES_Y 0
#define FP_ALGORITHM_TEMPLATE_SIZE 0
#define FP_MAX_FINGER_COUNT 5
#endif

#ifdef TEST_BUILD
/* This represents the mock of the private */
#define HAVE_FP_PRIVATE_DRIVER
#endif

#endif /* __CROS_EC_DRIVER_FINGERPRINT_FPSENSOR_H_ */

/* Copyright 2019 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef __CROS_EC_DRIVER_FINGERPRINT_FPSENSOR_H_
#define __CROS_EC_DRIVER_FINGERPRINT_FPSENSOR_H_

#if defined(HAVE_PRIVATE) && !defined(EMU_BUILD)
#define HAVE_FP_PRIVATE_DRIVER
#include "fpc/fpc_sensor.h"
#else
/* These values are used by the host (emulator) tests. */
#define FP_SENSOR_IMAGE_SIZE 0
#define FP_SENSOR_RES_X 0
#define FP_SENSOR_RES_Y 0
#define FP_ALGORITHM_TEMPLATE_SIZE 0
#define FP_MAX_FINGER_COUNT 5
#endif

#ifdef TEST_BUILD
/* This represents the mock of the private */
#define HAVE_FP_PRIVATE_DRIVER
#endif

#endif /* __CROS_EC_DRIVER_FINGERPRINT_FPSENSOR_H_ */

driver/fingerprint: Exclude header on emulator build, not test build

Now that we run unit tests on device, we want to be able to include the
fingerprint sensor headers in test builds.

BRANCH=none
BUG=b:76037094
TEST=make buildall -j
TEST=With dragonclaw v0.2 connected to Segger J-Trace and servo micro:
       ./test/run_device_tests.py

Signed-off-by: Tom Hughes <fc5c12f30a5ed2baa0581f44ee14ad1eb7b20d83@chromium.org>
Change-Id: Id406fd6039f1136f2ae8743453ead4a951805db5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2321827
Reviewed-by: Yicheng Li <77a205905d8955597c069555e9569c30512f6bd8@chromium.org>


#include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;

List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void* k);
void ListNode_Destroy(ListNode* n);
ListNode* List_Search(List* l, void* k, int (f)(void*, void*));
void List_Insert(List* l, ListNode* n);
void List_Delete(List* l, ListNode* n);
#endif

#include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;

List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void* k);
void* ListNode_Retrieve(ListNode* n);
void ListNode_Destroy(ListNode* n);
ListNode* List_Search(List* l, void* k, int (f)(void*, void*));
void List_Insert(List* l, ListNode* n);
void List_Delete(List* l, ListNode* n);
#endif

Add List Node Retrieve function declaration

Function to retrieve key from any List Node


/*
 * QLogic Fibre Channel HBA Driver
 * Copyright (c)  2003-2005 QLogic Corporation
 *
 * See LICENSE.qla2xxx for copyright and licensing details.
 */
/*
 * Driver version
 */
#define QLA2XXX_VERSION      "8.01.05-k2"

#define QLA_DRIVER_MAJOR_VER	8
#define QLA_DRIVER_MINOR_VER	1
#define QLA_DRIVER_PATCH_VER	5
#define QLA_DRIVER_BETA_VER	0

/*
 * QLogic Fibre Channel HBA Driver
 * Copyright (c)  2003-2005 QLogic Corporation
 *
 * See LICENSE.qla2xxx for copyright and licensing details.
 */
/*
 * Driver version
 */
#define QLA2XXX_VERSION      "8.01.05-k3"

#define QLA_DRIVER_MAJOR_VER	8
#define QLA_DRIVER_MINOR_VER	1
#define QLA_DRIVER_PATCH_VER	5
#define QLA_DRIVER_BETA_VER	0

Update version number to 8.01.05-k3.

[SCSI] qla2xxx: Update version number to 8.01.05-k3.

Signed-off-by: Andrew Vasquez <67840a4977006af7f584bdc4c86d7243c1629cad@qlogic.com>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@SteelEye.com>


/*
 * db.h
 *
 * Copyright (C) 2011		OpenTech Labs
 *				Andrew Clayton <andrew@opentechlabs.co.uk>
 * Released under the GNU General Public License (GPL) version 3.
 * See COPYING
 */

#ifndef _DB_H_
#define _DB_H_

/* For Tokyocabinet (user sessions) */
#include <tcutil.h>
#include <tctdb.h>
#include <stdbool.h>
#include <stdint.h>
#include <libgen.h>

/* MySQL */
#include <my_global.h>
#include <mysql.h>

MYSQL *db_conn(void);

#endif /* _DB_H_ */

/*
 * db.h
 *
 * Copyright (C) 2011		OpenTech Labs
 *				Andrew Clayton <andrew@opentechlabs.co.uk>
 * Released under the GNU General Public License (GPL) version 3.
 * See COPYING
 */

#ifndef _DB_H_
#define _DB_H_

/* For Tokyocabinet (user sessions) */
#include <tcutil.h>
#include <tctdb.h>
#include <stdbool.h>
#include <stdint.h>
#include <libgen.h>

/* MySQL */

/*
 * The FCGI printf function seemed to be causing a conflict here, under F16
 * with GCC 4.6.2
 *
 * Just undef printf for the my_global stuff and then define it back again.
 */
#undef printf
#include <my_global.h>
#define printf FCGI_printf

#include <mysql.h>

MYSQL *db_conn(void);

#endif /* _DB_H_ */

Fix compiler warnings under F16/GCC 4.6.2

When compiling receiptomatic under Fedora 16 with GCC 4.6.2 we were
getting the following warnings...

gcc -Wall -std=c99 -O2 -g -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -fPIE -c receiptomatic-www.c
-D_RECEIPTOMATIC_WWW_ -I../../libctemplate `pkg-config --cflags
glib-2.0` `pkg-config --cflags gmime-2.0` `mysql_config --cflags`
In file included from /usr/include/mysql/my_global.h:1039:0,
                 from db.h:21,
                 from common.h:31,
                 from receiptomatic-www.c:22:
/usr/include/mysql/my_dbug.h:59:3: warning: ‘FCGI_printf’ is an
unrecognized format function type [-Wformat]

This seemed to be a conflict between the FCGI_printf definition and the
use of 'ATTRIBUTE_FORMAT(printf, 1, 2)' in my_global.h

The workaround seems to be to undef printf before including my_global.h
and then defining it back again afterwards.

Signed-off-by: Andrew Clayton <02e0a999c50b1f88df7a8f5a04e1b76b35ea6a88@opentechlabs.co.uk>


#include "mruby.h"
#include "mruby/value.h"

static mrb_value longsize(mrb_state *mrb, mrb_value self)
{
  uint8_t size = (uint8_t)sizeof(long);
  return mrb_fixnum_value(size);
}

/* ruby calls this to load the extension */
void mrb_mruby_rubyffi_compat_gem_init(mrb_state *mrb)
{
  struct RClass *mod = mrb_define_module(mrb, "FFI");
  mrb_define_class_method(mrb, mod, "longsize", longsize, ARGS_NONE());
}

void mrb_mruby_rubyffi_compat_gem_final(mrb_state *mrb)
{

}

#include "mruby.h"
#include "mruby/value.h"

static mrb_value longsize(mrb_state *mrb, mrb_value self)
{
  uint8_t size = (uint8_t)sizeof(long);
  return mrb_fixnum_value(size);
}

/* ruby calls this to load the extension */
void mrb_mruby_rubyffi_compat_gem_init(mrb_state *mrb)
{
  struct RClass *mod = mrb_define_module(mrb, "FFI");
  mrb_define_class_method(mrb, mod, "longsize", longsize, MRB_ARGS_NONE());
}

void mrb_mruby_rubyffi_compat_gem_final(mrb_state *mrb)
{

}

Fix for "implicit declaration of function 'ARGS_NONE' is invalid" error


/* string_funcs.h
 *  Copyright (C) 2001-2003, The Perl Foundation.
 *  SVN Info
 *     $Id$
 *  Overview:
 *     This is the api header for the string subsystem
 *  Data Structure and Algorithms:
 *  History:
 *  Notes:
 *  References:
 */

#ifndef PARROT_STRING_PRIMITIVES_H_GUARD
#define PARROT_STRING_PRIMITIVES_H_GUARD

#ifdef PARROT_IN_CORE

/* Set the directory where ICU finds its data files (encodings,
   locales, etc.) */
void string_set_data_directory(const char *dir);

/* Convert from any supported encoding, into our internal format */
void string_fill_from_buffer(Interp *interp,
        const void *buffer, UINTVAL len, const char *encoding_name, STRING *s);

/* Utility method which knows how to uwind a single escape sequence */
typedef Parrot_UInt2 (*Parrot_unescape_cb)(Parrot_Int4 offset, void *context);
Parrot_UInt4
string_unescape_one(Interp *interp, UINTVAL *offset, STRING *string);

UINTVAL
Parrot_char_digit_value(Interp *interp, UINTVAL character);

#endif /* PARROT_IN_CORE */
#endif /* PARROT_STRING_PRIMITIVES_H_GUARD */

/*
 * Local variables:
 *   c-file-style: "parrot"
 * End:
 * vim: expandtab shiftwidth=4:
 */

/* string_funcs.h
 *  Copyright (C) 2001-2003, The Perl Foundation.
 *  SVN Info
 *     $Id$
 *  Overview:
 *     This is the api header for the string subsystem
 *  Data Structure and Algorithms:
 *  History:
 *  Notes:
 *  References:
 */

#ifndef PARROT_STRING_PRIMITIVES_H_GUARD
#define PARROT_STRING_PRIMITIVES_H_GUARD

#ifdef PARROT_IN_CORE

/* Set the directory where ICU finds its data files (encodings,
   locales, etc.) */
PARROT_API void string_set_data_directory(const char *dir);

/* Convert from any supported encoding, into our internal format */
PARROT_API void string_fill_from_buffer(Interp *interp,
        const void *buffer, UINTVAL len, const char *encoding_name, STRING *s);

/* Utility method which knows how to uwind a single escape sequence */
typedef Parrot_UInt2 (*Parrot_unescape_cb)(Parrot_Int4 offset, void *context);
PARROT_API Parrot_UInt4
string_unescape_one(Interp *interp, UINTVAL *offset, STRING *string);

PARROT_API UINTVAL
Parrot_char_digit_value(Interp *interp, UINTVAL character);

#endif /* PARROT_IN_CORE */
#endif /* PARROT_STRING_PRIMITIVES_H_GUARD */

/*
 * Local variables:
 *   c-file-style: "parrot"
 * End:
 * vim: expandtab shiftwidth=4:
 */

Fix the build on Win32 by making linkage of various symbols consistent again.

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@18778 d31e2699-5ff4-0310-a27c-f18f2fbe73fe


/*
name: TEST038
description: Basic test for tentative definitions
output:

*/

int x;
int x = 0;
int x;

int main();

void *
foo()
{
	return &main;
}

int
main()
{
	x = 0;
	return x;
}

/*
name: TEST038
description: Basic test for tentative definitions
output:
test038.c:45: error: redeclaration of 'x'
G1	I	x
(
	#I0
)
F2	I	E
X3	F2	main
F4	P	E
G5	F4	foo
{
\
	r	X3	'P
}
G3	F2	main
{
\
	G1	#I0	:I
	r	G1
}
*/

int x;
int x = 0;
int x;

int main();

void *
foo()
{
	return &main;
}

int
main()
{
	x = 0;
	return x;
}
int x = 1;

Add solution for test of tentative declarations


/*
 *  Copyright (c) 2015 The WebM 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 VPX_PORTS_MSVC_H_
#define VPX_PORTS_MSVC_H_
#ifdef _MSC_VER

#include "./vpx_config.h"

# if _MSC_VER < 1900  // VS2015 provides snprintf
#  define snprintf _snprintf
# endif  // _MSC_VER < 1900

#if _MSC_VER < 1800  // VS2013 provides round
#include <math.h>
static INLINE double round(double x) {
  if (x < 0)
    return ceil(x - 0.5);
  else
    return floor(x + 0.5);
}
#endif  // _MSC_VER < 1800

#endif  // _MSC_VER
#endif  // VPX_PORTS_MSVC_H_

/*
 *  Copyright (c) 2015 The WebM 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 VPX_PORTS_MSVC_H_
#define VPX_PORTS_MSVC_H_
#ifdef _MSC_VER

#include "./vpx_config.h"

# if _MSC_VER < 1900  // VS2015 provides snprintf
#  define snprintf _snprintf
# endif  // _MSC_VER < 1900

#if _MSC_VER < 1800  // VS2013 provides round
#include <math.h>
static INLINE double round(double x) {
  if (x < 0)
    return ceil(x - 0.5);
  else
    return floor(x + 0.5);
}

static INLINE float roundf(float x) {
  if (x < 0)
    return (float)ceil(x - 0.5f);
  else
    return (float)floor(x + 0.5f);
}

static INLINE long lroundf(float x) {
  if (x < 0)
    return (long)(x - 0.5f);
  else
    return (long)(x + 0.5f);
}
#endif  // _MSC_VER < 1800

#endif  // _MSC_VER
#endif  // VPX_PORTS_MSVC_H_

Add roundf and lroundf replacements for VS < 2013.

Change-Id: I25678279ab44672acf680bf04d9c551156e2904b


#ifndef __BOARD_H
#define __BOARD_H

#include <aery32/all.h>

#define ADC_VREF 3.0
#define ADC_BITS 10

namespace board {

	void init(void);

	inline double cnv_to_volt(unsigned int cnv)
	{
		return cnv * (ADC_VREF / (1UL << ADC_BITS));
	}

} /* end of namespace board */

#endif

#ifndef __BOARD_H
#define __BOARD_H

#define ADC_VREF 3.0
#define ADC_BITS 10

namespace board {

	void init(void);

	inline double cnv_to_volt(unsigned int cnv)
	{
		return cnv * (ADC_VREF / (1UL << ADC_BITS));
	}

} /* end of namespace board */

#endif

Remove unnecessary include of aery32/all.h


/* Copyright 2021 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include <zephyr/zephyr.h>
#include <ztest.h>
#include "ec_app_main.h"
#include "test/drivers/test_state.h"

bool drivers_predicate_pre_main(const void *state)
{
	return ((struct test_state *)state)->ec_app_main_run == false;
}

bool drivers_predicate_post_main(const void *state)
{
	return !drivers_predicate_pre_main(state);
}

void test_main(void)
{
	struct test_state state = {
		.ec_app_main_run = false,
	};

	/* Run all the suites that depend on main not being called yet */
	ztest_run_test_suites(&state);

	ec_app_main();
	state.ec_app_main_run = true;

	/* Run all the suites that depend on main being called */
	ztest_run_test_suites(&state);

	/* Check that every suite ran */
	ztest_verify_all_test_suites_ran();
}

/* Copyright 2021 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include <zephyr/zephyr.h>
#include <ztest.h>
#include "ec_app_main.h"
#include "test/drivers/test_state.h"

bool drivers_predicate_pre_main(const void *state)
{
	return ((struct test_state *)state)->ec_app_main_run == false;
}

bool drivers_predicate_post_main(const void *state)
{
	return !drivers_predicate_pre_main(state);
}

void test_main(void)
{
	struct test_state state = {
		.ec_app_main_run = false,
	};

	/* Run all the suites that depend on main not being called yet */
	ztest_run_all(&state);

	ec_app_main();
	state.ec_app_main_run = true;

	/* Run all the suites that depend on main being called */
	ztest_run_all(&state);
}

Fix listing of test cases

zephyr: Fix listing of test cases

Use correct ZTEST API so test cases can be listed

BUG=b:240364238
BRANCH=NONE
TEST=./zephyr.exe -list

Signed-off-by: Al Semjonovs <c3a2ecb550cad1e7d5a943ca6241377f7b43ffc4@google.com>
Change-Id: If3b603ab64421da558228e67a907039a1674ba0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3789128
Reviewed-by: Yuval Peress <50dc11c009bd4d7e9d9d15a383c1743ce5ee82ef@google.com>


/* GLOBAL.H - RSAREF types and constants
 */

/* PROTOTYPES should be set to one if and only if the compiler supports
  function argument prototyping.
The following makes PROTOTYPES default to 0 if it has not already
  been defined with C compiler flags.
 */
#ifndef PROTOTYPES
#define PROTOTYPES 0
#endif

/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;

/* UINT2 defines a two byte word */
typedef unsigned short int UINT2;

/* UINT4 defines a four byte word */
typedef unsigned long int UINT4;

/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
  returns an empty list.
 */
#if PROTOTYPES
#define PROTO_LIST(list) list
#else
#define PROTO_LIST(list) ()
#endif

/* GLOBAL.H - RSAREF types and constants
 */

/* PROTOTYPES should be set to one if and only if the compiler supports
  function argument prototyping.
The following makes PROTOTYPES default to 0 if it has not already
  been defined with C compiler flags.
 */
#ifndef PROTOTYPES
#define PROTOTYPES 0
#endif

/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;

#if 0
/* UINT2 defines a two byte word */
typedef unsigned short int UINT2;

/* UINT4 defines a four byte word */
typedef unsigned long int UINT4;
#else
#include <sys/types.h>

/* UINT2 defines a two byte word */
typedef u_int16_t UINT2;

/* UINT4 defines a four byte word */
typedef u_int32_t UINT4;
#endif /* 0 */

/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
  returns an empty list.
 */
#if PROTOTYPES
#define PROTO_LIST(list) list
#else
#define PROTO_LIST(list) ()
#endif

Fix bad assumptions about types. PR: 1649 Reviewed by: phk Submitted by: Jason Thorpe <thorpej@nas.nasa.gov>


#ifndef E_MOD_MAIN_H
# define E_MOD_MAIN_H

# define LOGFNS 1

# ifdef LOGFNS
#  include <stdio.h>
#  define LOGFN(fl, ln, fn) printf("-CONF-RANDR: %25s: %5i - %s\n", fl, ln, fn);
# else
#  define LOGFN(fl, ln, fn)
# endif

# ifndef ECORE_X_RANDR_1_2
#  define ECORE_X_RANDR_1_2 ((1 << 16) | 2)
# endif

# ifndef ECORE_X_RANDR_1_3
#  define ECORE_X_RANDR_1_3 ((1 << 16) | 3)
# endif

# ifndef E_RANDR_12
#  define E_RANDR_12 (e_randr_screen_info.rrvd_info.randr_info_12)
# endif

EAPI extern E_Module_Api e_modapi;

EAPI void *e_modapi_init(E_Module *m);
EAPI int e_modapi_shutdown(E_Module *m);
EAPI int e_modapi_save(E_Module *m);

extern const char *mod_dir;

/**
 * @addtogroup Optional_Conf
 * @{
 *
 * @defgroup Module_Conf_RandR RandR (Screen Resize, Rotate and Mirror)
 *
 * Configures size, rotation and mirroring of screen. Uses the X11
 * RandR protocol (does not work with NVidia proprietary drivers).
 *
 * @}
 */

#endif

#ifndef E_MOD_MAIN_H
# define E_MOD_MAIN_H

//# define LOGFNS 1

# ifdef LOGFNS
#  include <stdio.h>
#  define LOGFN(fl, ln, fn) printf("-CONF-RANDR: %25s: %5i - %s\n", fl, ln, fn);
# else
#  define LOGFN(fl, ln, fn)
# endif

EAPI extern E_Module_Api e_modapi;

EAPI void *e_modapi_init(E_Module *m);
EAPI int e_modapi_shutdown(E_Module *m);
EAPI int e_modapi_save(E_Module *m);

/**
 * @addtogroup Optional_Conf
 * @{
 *
 * @defgroup Module_Conf_RandR RandR (Screen Resize, Rotate and Mirror)
 *
 * Configures size, rotation and mirroring of screen. Uses the X11
 * RandR protocol (does not work with NVidia proprietary drivers).
 *
 * @}
 */

#endif

Remove useless defines and variables.

Remove useless defines and variables.

Signed-off-by: Christopher Michael <cp.michael@samsung.com>

SVN revision: 84200


#include "postgres.h"
#include "executor/spi.h"
#include "commands/trigger.h"
#include "fmgr.h"
#include "access/heapam.h"
#include "utils/syscache.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"

/*
Figure out how to include these properly
#include "parrot/embed.h"
#include "parrot/debugger.h"
#include "parrot/runcore_api.h"
*/

PG_MODULE_MAGIC;

Datum plparrot_call_handler(PG_FUNCTION_ARGS);
void plparrot_elog(int level, char *message);

PG_FUNCTION_INFO_V1(plparrot_call_handler);

Datum
plparrot_call_handler(PG_FUNCTION_ARGS)
{
    Datum retval;

    retval = PG_GETARG_DATUM(0);
    PG_TRY();
    {
    }
    PG_CATCH();
    {
    }
    PG_END_TRY();

    return retval;
}

void
plparrot_elog(int level, char *message)
{
    elog(level, "%s", message);
}

#include "postgres.h"
#include "executor/spi.h"
#include "commands/trigger.h"
#include "fmgr.h"
#include "access/heapam.h"
#include "utils/syscache.h"
#include "utils/builtins.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"

/*
Figure out how to include these properly

We need to use "parrot_config includedir"

#include "parrot/embed.h"
#include "parrot/debugger.h"
#include "parrot/runcore_api.h"
*/

PG_MODULE_MAGIC;
int execq(text *sql, int cnt);

int
execq(text *sql, int cnt)
{
    char *command;
    int ret;
    int proc;

    SPI_connect();

    SPI_finish();
    //pfree(command);

    return (proc);
}

Datum plparrot_call_handler(PG_FUNCTION_ARGS);
void plparrot_elog(int level, char *message);

PG_FUNCTION_INFO_V1(plparrot_call_handler);

Datum
plparrot_call_handler(PG_FUNCTION_ARGS)
{
    Datum retval;

    retval = PG_GETARG_DATUM(0);
    PG_TRY();
    {
    }
    PG_CATCH();
    {
    }
    PG_END_TRY();

    return retval;
}

void
plparrot_elog(int level, char *message)
{
    elog(level, "%s", message);
}

Add the beginnings of something that does SPI