text
stringlengths
4
6.14k
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_environment_w32_spawnvp_09.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-09.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: environment Read input from an environment variable * GoodSource: Fixed string * Sink: w32_spawnvp * BadSink : execute command with spawnvp * Flow Variant: 09 Control flow: if(GLOBAL_CONST_TRUE) and if(GLOBAL_CONST_FALSE) * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT "cmd.exe" #define COMMAND_ARG1 "/c" #define COMMAND_ARG2 "dir" #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH "/bin/sh" #define COMMAND_INT "sh" #define COMMAND_ARG1 "ls" #define COMMAND_ARG2 "-la" #define COMMAND_ARG3 data #endif #define ENV_VARIABLE "ADD" #ifdef _WIN32 #define GETENV getenv #else #define GETENV getenv #endif #include <process.h> #ifndef OMITBAD void CWE78_OS_Command_Injection__char_environment_w32_spawnvp_09_bad() { char * data; char dataBuffer[100] = ""; data = dataBuffer; if(GLOBAL_CONST_TRUE) { { /* Append input from an environment variable to data */ size_t dataLen = strlen(data); char * environment = GETENV(ENV_VARIABLE); /* If there is data in the environment variable */ if (environment != NULL) { /* POTENTIAL FLAW: Read data from an environment variable */ strncat(data+dataLen, environment, 100-dataLen-1); } } } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL}; /* spawnvp - searches for the location of the command among * the directories specified by the PATH environment variable */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ _spawnvp(_P_WAIT, COMMAND_INT, args); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the GLOBAL_CONST_TRUE to GLOBAL_CONST_FALSE */ static void goodG2B1() { char * data; char dataBuffer[100] = ""; data = dataBuffer; if(GLOBAL_CONST_FALSE) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL}; /* spawnvp - searches for the location of the command among * the directories specified by the PATH environment variable */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ _spawnvp(_P_WAIT, COMMAND_INT, args); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { char * data; char dataBuffer[100] = ""; data = dataBuffer; if(GLOBAL_CONST_TRUE) { /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL}; /* spawnvp - searches for the location of the command among * the directories specified by the PATH environment variable */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ _spawnvp(_P_WAIT, COMMAND_INT, args); } } void CWE78_OS_Command_Injection__char_environment_w32_spawnvp_09_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE78_OS_Command_Injection__char_environment_w32_spawnvp_09_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE78_OS_Command_Injection__char_environment_w32_spawnvp_09_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#import <UIKit/UIKit.h> @interface UIFont (MysteryQuest) + (instancetype)mysteryQuestFontOfSize:(CGFloat)size; @end
// CocoaUPnP by A&R Cambridge Ltd, http://www.arcam.co.uk // Copyright 2015 Arcam. See LICENSE file. #import "UPPBaseParser.h" @class UPPBasicDevice; /** Parser completion block @param devices If parsing succeeds, a new `UPPBasicDevice` object is returned @param error If parsing fails, an `NSError` object is returned */ typedef void(^CompletionBlock)(NSArray * _Nullable devices, NSError * _Nullable error); /** This class defines an object whose sole responsibility is to parse a device description XML document into a `UPPDevice` object. @see UPPDevice */ @interface UPPDeviceParser : UPPBaseParser /** Download and parse a device's XML description @param url The URL for the XML description file @param completion A completion block returning either a `UPPDevice` object or an `NSError` object */ - (void)parseURL:(nonnull NSURL *)url withCompletion:(nonnull CompletionBlock)completion; @end
/* * PRS - Personal Radio Station * * Copyright 2003 Marc Mulcahy * */ #include <assert.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <pthread.h> #include <signal.h> #include <sys/types.h> #include <sys/wait.h> #include "debug.h" #include "aplaymixeroutput.h" #include "list.h" typedef struct { pid_t aplay_pid; int aplay_input[2]; } aplay_info; static void start_aplay (MixerOutput *o) { aplay_info *i; int aplay_input[2]; if (!o) return; if (!o->data) return; i = (aplay_info *) o->data; /* Fork the aplay process */ i->aplay_pid = fork (); if (i->aplay_pid) { close (i->aplay_input[0]); } else { char sample_rate_arg[128]; char channels_arg[128]; sprintf (sample_rate_arg, "%d", o->rate); sprintf (channels_arg, "%d", o->channels); close (0); dup (i->aplay_input[0]); close (i->aplay_input[0]); close (i->aplay_input[1]); execlp ("aplay", "aplay", "-t", "raw", "-f", "s16", "-r", sample_rate_arg, "-c", channels_arg, NULL); } } static void stop_aplay (MixerOutput *o) { aplay_info *i; if (!o) return; if (!o->data) return; i = (aplay_info *) o->data; kill (i->aplay_pid, SIGTERM); waitpid (i->aplay_pid, NULL, 0); } static void aplay_mixer_output_free_data (MixerOutput *o) { aplay_info *i; assert (o != NULL); assert (o->data != NULL); debug_printf (DEBUG_FLAGS_MIXER, "aplay_mixer_output_free_data called\n"); i = (aplay_info *) o->data; stop_aplay (o); /* Close the pipes */ close (i->aplay_input[0]); close (i->aplay_input[1]); free (o->data); } static void aplay_mixer_output_post_data (MixerOutput *o) { aplay_info *i; assert (o != NULL); i = (aplay_info *) o->data; write (i->aplay_input[1], o->buffer, o->buffer_size*sizeof(short)*o->channels); } MixerOutput * aplay_mixer_output_new (const char *name, const int rate, const int channels, const int latency) { MixerOutput *o; aplay_info *i; i = malloc (sizeof (aplay_info)); if (!i) return NULL; /* Create pipes */ pipe (i->aplay_input); fcntl (i->aplay_input[1], F_SETFL, O_NONBLOCK); fcntl (i->aplay_input[1], F_SETFD, FD_CLOEXEC); o = malloc (sizeof (MixerOutput)); if (!o) { free (i); return NULL; } o->name = strdup (name); o->rate = rate; o->channels = channels; o->data = (void *) i; o->enabled = 1; /* Overrideable methods */ o->free_data = aplay_mixer_output_free_data; o->post_data = aplay_mixer_output_post_data; mixer_output_alloc_buffer (o, latency); start_aplay (o); return o; }
#ifndef XIVELY_FEED_H #define XIVELY_FEED_H #include <Client.h> #include <XivelyDatastream.h> #include <Printable.h> class XivelyFeed : public Printable { public: XivelyFeed(unsigned long aID, XivelyDatastream* aDatastreams, int aDatastreamsCount); virtual size_t printTo(Print&) const; unsigned long id() { return _id; }; int size() { return _datastreamsCount; }; XivelyDatastream& operator[] (unsigned i) { return _datastreams[i]; }; // protected: int _datastreamsCount; unsigned long _id; XivelyDatastream* _datastreams; }; #endif
#pragma once #include "CompositeTypeDefinitionNode.h" namespace Three { class StructureNode : public CompositeTypeDefinitionNode { public: std::string nodeName() const; void accept(ASTVisitor& visitor); uint32_t packing() const; protected: void setParsedIntegerSpecifier(Parser& parser, uint32_t value); private: uint32_t _packing; }; }
// // Generated by the J2ObjC translator. DO NOT EDIT! // source: ./sandbox/src/java/org/apache/lucene/bkdtree/OfflineLatLonReader.java // #include "J2ObjC_header.h" #pragma push_macro("INCLUDE_ALL_OrgApacheLuceneBkdtreeOfflineLatLonReader") #ifdef RESTRICT_OrgApacheLuceneBkdtreeOfflineLatLonReader #define INCLUDE_ALL_OrgApacheLuceneBkdtreeOfflineLatLonReader 0 #else #define INCLUDE_ALL_OrgApacheLuceneBkdtreeOfflineLatLonReader 1 #endif #undef RESTRICT_OrgApacheLuceneBkdtreeOfflineLatLonReader #if __has_feature(nullability) #pragma clang diagnostic push #pragma GCC diagnostic ignored "-Wnullability" #pragma GCC diagnostic ignored "-Wnullability-completeness" #endif #if !defined (OrgApacheLuceneBkdtreeOfflineLatLonReader_) && (INCLUDE_ALL_OrgApacheLuceneBkdtreeOfflineLatLonReader || defined(INCLUDE_OrgApacheLuceneBkdtreeOfflineLatLonReader)) #define OrgApacheLuceneBkdtreeOfflineLatLonReader_ #define RESTRICT_OrgApacheLuceneBkdtreeLatLonReader 1 #define INCLUDE_OrgApacheLuceneBkdtreeLatLonReader 1 #include "org/apache/lucene/bkdtree/LatLonReader.h" @class OrgApacheLuceneStoreInputStreamDataInput; @class OrgLukhnosPortmobileFilePath; @interface OrgApacheLuceneBkdtreeOfflineLatLonReader : NSObject < OrgApacheLuceneBkdtreeLatLonReader > { @public OrgApacheLuceneStoreInputStreamDataInput *in_; jlong countLeft_; } #pragma mark Public - (void)close; - (jint)docID; - (jint)latEnc; - (jint)lonEnc; - (jboolean)next; - (jlong)ord; #pragma mark Package-Private - (instancetype __nonnull)initPackagePrivateWithOrgLukhnosPortmobileFilePath:(OrgLukhnosPortmobileFilePath *)tempFile withLong:(jlong)start withLong:(jlong)count; // Disallowed inherited constructors, do not use. - (instancetype __nonnull)init NS_UNAVAILABLE; @end J2OBJC_EMPTY_STATIC_INIT(OrgApacheLuceneBkdtreeOfflineLatLonReader) J2OBJC_FIELD_SETTER(OrgApacheLuceneBkdtreeOfflineLatLonReader, in_, OrgApacheLuceneStoreInputStreamDataInput *) FOUNDATION_EXPORT void OrgApacheLuceneBkdtreeOfflineLatLonReader_initPackagePrivateWithOrgLukhnosPortmobileFilePath_withLong_withLong_(OrgApacheLuceneBkdtreeOfflineLatLonReader *self, OrgLukhnosPortmobileFilePath *tempFile, jlong start, jlong count); FOUNDATION_EXPORT OrgApacheLuceneBkdtreeOfflineLatLonReader *new_OrgApacheLuceneBkdtreeOfflineLatLonReader_initPackagePrivateWithOrgLukhnosPortmobileFilePath_withLong_withLong_(OrgLukhnosPortmobileFilePath *tempFile, jlong start, jlong count) NS_RETURNS_RETAINED; FOUNDATION_EXPORT OrgApacheLuceneBkdtreeOfflineLatLonReader *create_OrgApacheLuceneBkdtreeOfflineLatLonReader_initPackagePrivateWithOrgLukhnosPortmobileFilePath_withLong_withLong_(OrgLukhnosPortmobileFilePath *tempFile, jlong start, jlong count); J2OBJC_TYPE_LITERAL_HEADER(OrgApacheLuceneBkdtreeOfflineLatLonReader) #endif #if __has_feature(nullability) #pragma clang diagnostic pop #endif #pragma pop_macro("INCLUDE_ALL_OrgApacheLuceneBkdtreeOfflineLatLonReader")
#include <stdio.h> #include <stdlib.h> #include <string.h> /** * Reads CSV data from stdin that is of the form * * 2017/01/18 15:32:37,-6.09,64.39 * 2017/01/18 15:33:38,-6.12,64.58 * ... * * and in lines where the humidity value (the last one) is 100.00 * because of faulty measurements, replaces it with the last valid * humidity value. The new CSV data is then printed to stdout. * * Use as follows: * ./replace < original.csv > replaced.csv * */ int main() { int size = 300; char **lines = calloc(size, sizeof(char *)); int line = 0, element = 0, character = 0; int c; lines[0] = calloc(20, sizeof(char)); while ((c = getchar()) != EOF) { switch (c) { case ',': lines[3*line + element][character] = '\0'; element++; character = 0; lines[3*line + element] = calloc(20, sizeof(char)); break; case '\n': lines[3*line + element][character] = '\0'; line++; element = 0; character = 0; if (size == 3*line) { size *= 2; char **newp = realloc(lines, size * sizeof(char *)); if (newp) lines = newp; else printf("Error reallocating memory\n"); } lines[3*line + element] = calloc(20, sizeof(char)); break; default: lines[3*line + element][character++] = c; break; } } int l; char lastHum[20]; strcpy(lastHum, "50.00"); for (l = 0; l < line; l++) { if (strcmp(lines[3*l + 2], "100.00") == 0) strcpy(lines[3*l + 2], lastHum); else strcpy(lastHum, lines[3*l + 2]); printf("%s,%s,%s\n", lines[3*l], lines[3*l + 1], lines[3*l + 2]); free(lines[3*l]); free(lines[3*l + 1]); free(lines[3*l + 2]); } free(lines[3*line + element]); free(lines); return 0; }
#ifndef ARRO_DATABASE_DB_H #define ARRO_DATABASE_DB_H #include <stdexcept> #include <thread> #include <google/protobuf/message.h> #include <list> #include <condition_variable> #include <memory> #include <functional> #include "INodeDefinition.h" #include "INodeContext.h" #include "Trace.h" namespace Arro { class DatabaseImpl; class Iterator; /** * Facade class for database implementation */ class Database { friend Iterator; public: Database(); ~Database(); // Copy and assignment is not supported. Database(const Database&) = delete; Database& operator=(const Database& other) = delete; /** * Get database lock. * * @return */ std::mutex& getDbLock(); std::condition_variable& getConditionVariable(); unsigned int getCurrentRunCycle(); /** * Return iterator for input pad. * * @param input * @param connection: padId of the connected output pad. So only records * marked with that padId as origin. If 0 than padId not considered. * @param mode: ALL, DELTA, LATEST. Currently only DELTA supported. * @return */ INodeContext::ItRef begin(InputPad* input, unsigned int connection, INodeContext::Mode mode); /** * Return iterator for output pad. Essentially used to (over) write data to output. * * @param input * @param connection * @return */ INodeContext::ItRef end(OutputPad* input, unsigned int connection); /** * Swap (full) input queue and (empty) output queue. */ const std::list<unsigned int> incRunCycle(); /** * Indicates that the previous Run cycle produced no more outputs (that would * require yet another Run cycle). So system can go to sleep. * @return */ bool noMoreUpdates(); private: DatabaseImpl* m_db = nullptr; }; class Iterator: public INodeContext::Iterator { public: Iterator(DatabaseImpl* db, INodeContext::Mode mode, const std::list<unsigned int>& conns); virtual ~Iterator(); virtual bool getNext(MessageBuf& msg); virtual void insertRecord(google::protobuf::MessageLite& msg); virtual void insertRecord(MessageBuf& msg); virtual void updateRecord(google::protobuf::MessageLite& msg); virtual void updateRecord(MessageBuf& msg); virtual void setRecord(google::protobuf::MessageLite& msg) { if(empty()) { insertRecord(msg); } else { updateRecord(msg); } }; virtual void setRecord(MessageBuf& msg) { if(empty()) { insertRecord(msg); } else { updateRecord(msg); } }; virtual void deleteRecord(); virtual bool empty() { return m_rowId == -1; } virtual void update(long* shiftList); private: Trace m_trace; DatabaseImpl* m_ref; // Search criteria INodeContext::Mode m_mode; const std::list<unsigned int> m_conns; // Current position long int m_journalRowId; long int m_rowId; }; } #endif
#include "u.h" #include "../port/lib.h" #include "mem.h" #include "dat.h" #include "fns.h" #include "../port/error.h" #include "io.h" enum { Qdir = 0, Qbase, Qmax = 16, }; typedef long Rdwrfn(Chan*, void*, long, vlong); static Rdwrfn *readfn[Qmax]; static Rdwrfn *writefn[Qmax]; static Dirtab archdir[Qmax] = { ".", { Qdir, 0, QTDIR }, 0, 0555, }; Lock archwlock; /* the lock is only for changing archdir */ int narchdir = Qbase; /* * Add a file to the #P listing. Once added, you can't delete it. * You can't add a file with the same name as one already there, * and you get a pointer to the Dirtab entry so you can do things * like change the Qid version. Changing the Qid path is disallowed. */ Dirtab* addarchfile(char *name, int perm, Rdwrfn *rdfn, Rdwrfn *wrfn) { int i; Dirtab d; Dirtab *dp; memset(&d, 0, sizeof d); strcpy(d.name, name); d.perm = perm; lock(&archwlock); if(narchdir >= Qmax){ unlock(&archwlock); return nil; } for(i=0; i<narchdir; i++) if(strcmp(archdir[i].name, name) == 0){ unlock(&archwlock); return nil; } d.qid.path = narchdir; archdir[narchdir] = d; readfn[narchdir] = rdfn; writefn[narchdir] = wrfn; dp = &archdir[narchdir++]; unlock(&archwlock); return dp; } static Chan* archattach(char* spec) { return devattach('P', spec); } Walkqid* archwalk(Chan* c, Chan *nc, char** name, int nname) { return devwalk(c, nc, name, nname, archdir, narchdir, devgen); } static int archstat(Chan* c, uchar* dp, int n) { return devstat(c, dp, n, archdir, narchdir, devgen); } static Chan* archopen(Chan* c, int omode) { return devopen(c, omode, archdir, narchdir, devgen); } static void archclose(Chan*) { } static long archread(Chan *c, void *a, long n, vlong offset) { Rdwrfn *fn; switch((ulong)c->qid.path){ case Qdir: return devdirread(c, a, n, archdir, narchdir, devgen); default: if(c->qid.path < narchdir && (fn = readfn[c->qid.path])) return fn(c, a, n, offset); error(Eperm); break; } return 0; } static long archwrite(Chan *c, void *a, long n, vlong offset) { Rdwrfn *fn; if(c->qid.path < narchdir && (fn = writefn[c->qid.path])) return fn(c, a, n, offset); error(Eperm); return 0; } void archinit(void); Dev archdevtab = { 'P', "arch", devreset, archinit, devshutdown, archattach, archwalk, archstat, archopen, devcreate, archclose, archread, devbread, archwrite, devbwrite, devremove, devwstat, }; static long cputyperead(Chan*, void *a, long n, vlong offset) { char str[128]; snprint(str, sizeof str, "MIPS LE %lud\n", m->hz / Mhz); return readstr(offset, a, n, str); } static long tbread(Chan*, void *a, long n, vlong offset) { char str[17]; uvlong tb; cycles(&tb); snprint(str, sizeof(str), "%16.16llux", tb); return readstr(offset, a, n, str); } static long nsread(Chan*, void *a, long n, vlong offset) { char str[17]; uvlong tb; cycles(&tb); snprint(str, sizeof(str), "%16.16llux", (tb/700)* 1000); return readstr(offset, a, n, str); } char *cputype = "spim"; char *faultsprint(char *, char *); static long archctlread(Chan*, void *a, long nn, vlong offset) { int n; char *buf, *p, *ep; p = buf = malloc(READSTR); if(p == nil) error(Enomem); ep = p + READSTR; p = seprint(p, ep, "cpu %s %lud\n", cputype, (ulong)(m->hz+999999)/1000000); p = seprint(p, ep, "stlb hash collisions"); for (n = 0; n < conf.nmach; n++) p = seprint(p, ep, " %d", MACHP(n)->hashcoll); p = seprint(p, ep, "\n"); p = seprint(p, ep, "NKTLB %d ktlb misses %ld utlb misses %ld\n", NKTLB, m->ktlbfault, m->utlbfault); faultsprint(p, ep); n = readstr(offset, a, nn, buf); free(buf); return n; } //static Cmdtab archctlmsg[]; static long archctlwrite(Chan*, void *a, long n, vlong) { Cmdbuf *cb; Cmdtab *ct; cb = parsecmd(a, n); if(waserror()){ free(cb); nexterror(); } // ct = lookupcmd(cb, archctlmsg, nelem(archctlmsg)); cmderror(cb, "unknown control message"); SET(ct); USED(ct); free(cb); poperror(); return n; } void archinit(void) { addarchfile("cputype", 0444, cputyperead, nil); addarchfile("timebase",0444, tbread, nil); addarchfile("archctl", 0664, archctlread, archctlwrite); // addarchfile("nsec", 0444, nsread, nil); }
#ifndef _MINICLASSES_HEADER #define _MINICLASSES_HEADER namespace java { namespace lang { class Object; class Comparable; class String; class System; class Throwable; class Exception; class OutOfMemoryError; class ArrayIndexOutOfBoundsException; class RuntimeException; class NullPointerException; class UnsupportedOperationException; class Number; class Integer; } //lang namespace io { class OutputStream; class InputStream; class PrintStream; class File; } //io namespace util { class Iterator; class Collection; class Vector; class NoSuchElementException; } //util } //java namespace polyglot { namespace ext { } //ext } //polyglot #include"java/lang/Object.h" #include"java/lang/Comparable.h" #include"java/lang/String.h" #include"java/lang/System.h" #include"java/lang/Throwable.h" #include"java/lang/Exception.h" #include"java/lang/Number.h" #include"java/lang/Integer.h" #include"java/lang/OutOfMemoryError.h" #include"java/lang/ArrayIndexOutOfBoundsException.h" #include"java/lang/RuntimeException.h" #include"java/lang/NullPointerException.h" #include"java/lang/UnsupportedOperationException.h" #include"java/io/File.h" #include"java/io/OutputStream.h" #include"java/io/PrintStream.h" #include"java/util/Iterator.h" #include"java/util/Collection.h" #include"java/util/Vector.h" #include"java/util/NoSuchElementException.h" #endif
/* 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., 675 Mass Ave, Cambridge, MA 02139, USA. xrdp: A Remote Desktop Protocol server. Copyright (C) Jay Sorg 2005-2008 */ /** * * @file sig.h * @brief Signal handling function declarations * @author Jay Sorg, Simone Fedele * */ #ifndef SIG_H #define SIG_H /** * * @brief Shutdown signal code * @param sig The received signal * */ void DEFAULT_CC sig_sesman_shutdown(int sig); /** * * @brief SIGHUP handling code * @param sig The received signal * */ void DEFAULT_CC sig_sesman_reload_cfg(int sig); /** * * @brief SIGCHLD handling code * @param sig The received signal * */ void DEFAULT_CC sig_sesman_session_end(int sig); /** * * @brief signal handling thread * */ void* DEFAULT_CC sig_handler_thread(void* arg); #endif
/* * Copyright (C) 2013-2020 Canonical, Ltd. * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * This code is a complete clean re-write of the stress tool by * Colin Ian King <colin.king@canonical.com> and attempts to be * backwardly compatible with the stress tool by Amos Waterland * <apw@rossby.metr.ou.edu> but has more stress tests and more * functionality. * */ #include "stress-ng.h" static const stress_help_t help[] = { { NULL, "tsearch N", "start N workers that exercise a tree search" }, { NULL, "tsearch-ops N", "stop after N tree search bogo operations" }, { NULL, "tsearch-size N", "number of 32 bit integers to tsearch" }, { NULL, NULL, NULL } }; /* * stress_set_tsearch_size() * set tsearch size from given option string */ static int stress_set_tsearch_size(const char *opt) { uint64_t tsearch_size; tsearch_size = stress_get_uint64(opt); stress_check_range("tsearch-size", tsearch_size, MIN_TSEARCH_SIZE, MAX_TSEARCH_SIZE); return stress_set_setting("tsearch-size", TYPE_ID_UINT64, &tsearch_size); } /* * cmp() * sort on int32 values */ static int cmp(const void *p1, const void *p2) { const int32_t *i1 = (const int32_t *)p1; const int32_t *i2 = (const int32_t *)p2; if (*i1 > *i2) return 1; else if (*i1 < *i2) return -1; else return 0; } /* * stress_tsearch() * stress tsearch */ static int stress_tsearch(const stress_args_t *args) { uint64_t tsearch_size = DEFAULT_TSEARCH_SIZE; int32_t *data; size_t i, n; if (!stress_get_setting("tsearch-size", &tsearch_size)) { if (g_opt_flags & OPT_FLAGS_MAXIMIZE) tsearch_size = MAX_TSEARCH_SIZE; if (g_opt_flags & OPT_FLAGS_MINIMIZE) tsearch_size = MIN_TSEARCH_SIZE; } n = (size_t)tsearch_size; if ((data = calloc(n, sizeof(*data))) == NULL) { pr_fail_dbg("calloc"); return EXIT_NO_RESOURCE; } do { void *root = NULL; /* Step #1, populate tree */ for (i = 0; i < n; i++) { data[i] = ((stress_mwc32() & 0xfff) << 20) ^ i; if (tsearch(&data[i], &root, cmp) == NULL) { size_t j; pr_err("%s: cannot allocate new " "tree node\n", args->name); for (j = 0; j < i; j++) tdelete(&data[j], &root, cmp); goto abort; } } /* Step #2, find */ for (i = 0; keep_stressing_flag() && i < n; i++) { void **result; result = tfind(&data[i], &root, cmp); if (g_opt_flags & OPT_FLAGS_VERIFY) { if (result == NULL) pr_fail("%s: element %zu " "could not be found\n", args->name, i); else { int32_t *val; val = *result; if (*val != data[i]) pr_fail("%s: element " "%zu found %" PRIu32 ", expecting %" PRIu32 "\n", args->name, i, *val, data[i]); } } } /* Step #3, delete */ for (i = 0; i < n; i++) { void **result; result = tdelete(&data[i], &root, cmp); if ((g_opt_flags & OPT_FLAGS_VERIFY) && (result == NULL)) pr_fail("%s: element %zu could not " "be found\n", args->name, i); } inc_counter(args); } while (keep_stressing()); abort: free(data); return EXIT_SUCCESS; } static const stress_opt_set_func_t opt_set_funcs[] = { { OPT_tsearch_size, stress_set_tsearch_size }, { 0, NULL } }; stressor_info_t stress_tsearch_info = { .stressor = stress_tsearch, .class = CLASS_CPU_CACHE | CLASS_CPU | CLASS_MEMORY, .opt_set_funcs = opt_set_funcs, .help = help };
/************************************************************************* > File Name: test.c > Author: hobson > Mail: song1919@163.com > Created Time: 2015年01月14日 星期三 12时26分22秒 ************************************************************************/ #include <stdio.h> #include <pthread.h> #include <unistd.h> #include <sys/epoll.h> #include "bc_epoll.h" #include "console.h" void* thread_fun(void *obj) { while(1) { printf("run...\n"); bc_epoll_process(obj); } } static void *obj; int main() { void *obj = NULL; struct epoll_event ev; pthread_t pid; int fd; int n,nread,i; char buff[1024]={0}; int freq = 9600; if((fd=open_port(fd,1))<0) { perror("open_port error"); return; } if((i=set_opt(fd,freq,8,'N',0))<0) { perror("set_opt error"); return; } printf("fd=%d\n",fd); /* sprintf(buff, "ATHBT\n"); sprintf(buff, "ATRON\r\n"); printf("%s\n", buff); n=write(fd,buff,strlen(buff)); printf("write:%d\n", n); while(1) { memset(buff, 0, sizeof(buff)); nread=read(fd,buff,1024); printf("nread=%d,%s\n",nread,buff); sleep(1); } */ ev.events = EPOLLIN | EPOLLET; ev.data.fd = fd; obj = bc_epoll_create(); bc_epoll_add_evt(obj, &ev); pthread_create(&pid, NULL, thread_fun, obj); pthread_join(pid, NULL); close(fd); return 0; }
/* * se.h -- definitions for the char module * * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet * Copyright (C) 2001 O'Reilly & Associates * * The source code in this file can be freely used, adapted, * and redistributed in source or binary form, so long as an * acknowledgment appears in derived source files. The citation * should list that the code comes from the book "Linux Device * Drivers" by Alessandro Rubini and Jonathan Corbet, published * by O'Reilly & Associates. No warranty is attached; * we cannot take responsibility for errors or fitness for use. * * $Id: se.h,v 1.15 2004/11/04 17:51:18 rubini Exp $ */ #ifndef _SE_DRIVER_H_ #define _SE_DRIVER_H_ #ifdef __cplusplus extern "C" { #endif #include "se_export.h" #include "OSAL.h" #include "hresult.h" #include <pthread.h> struct se_dev { void *CmdBuf; /* Pointer to first quantum set */ void *CachedCmdBuf; void *CmdBase; void *CmdLimit; int wrptr; int v_to_p_offset; int size; se_cmd_counter sw_counter; se_cmd_counter hw_counter; pthread_mutex_t lock_mutex; //mutex for preventing race condition }; /* * Prototypes for shared functions */ HRESULT se_open(void); HRESULT se_close(void); size_t se_write(const char *buf, size_t count); HRESULT se_ioctl(unsigned int cmd, void *arg); #ifdef __cplusplus } #endif #endif /* _SE_H_ */
/******************************************************************************** * Marvell GPL License Option * * If you received this File from Marvell, you may opt to use, redistribute and/or * modify this File in accordance with the terms and conditions of the General * Public License Version 2, June 1991 (the "GPL License"), a copy of which is * available along with the File in the license.txt file or by writing to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or * on the worldwide web at http://www.gnu.org/licenses/gpl.txt. * * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED * WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY * DISCLAIMED. The GPL License provides additional details about this warranty * disclaimer. ********************************************************************************/ #ifndef _OSAL_DRIVER_H_ #define _OSAL_DRIVER_H_ #define MV_CC_SID_BIT_LOCAL 0 #define NETLINK_GALOIS_CC_SINGLECPU (29) /* Galois CC module transports by netlink*/ #define NETLINK_GALOIS_CC_GROUP_SINGLECPU (0) /* Galois CC module transports by netlink*/ #define MV_CC_ICCFIFO_FRAME_SIZE (128) #define CC_DEVICE_NAME "galois_cc" #define CC_DEVICE_TAG "[Galois][cc_driver] " #define CC_DEVICE_PROCFILE_STATUS "status" #define CC_DEVICE_PROCFILE_DETAIL "detail" #define CC_DEVICE_LIST_NUM (100) #define CC_DEVICE_CMD_REG (0x1E01) #define CC_DEVICE_CMD_FREE (0x1E02) #define CC_DEVICE_CMD_INQUIRY (0x1E03) #define CC_DEVICE_CMD_GET_LIST (0x1E04) #define CC_DEVICE_CMD_GET_STATUS (0x1E05) #define CC_DEVICE_CMD_TEST_MSG (0x1E06) #define CC_DEVICE_CMD_UPDATE (0x1E07) #define CC_DEVICE_CMD_CREATE_CBUF (0x1E08) #define CC_DEVICE_CMD_DESTROY_CBUF (0x1E09) #endif
/* WMix 3.0 -- a mixer using the OSS mixer API. * Copyright (C) 2000, 2001 * Daniel Richard G. <skunk@mit.edu>, * timecop <timecop@japan.co.jp> * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <sys/types.h> #include <stdio.h> #include <assert.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/time.h> #include "include/common.h" #include "include/misc.h" typedef struct { int enable; int x; int y; int width; int height; } MRegion; MRegion mr[16]; /* Converts separate left and right channel volumes (each in [0, 1]) to * volume and balance values. (Volume is in [0, 1], balance is in [-1, 1]) */ void lr_to_vb(float left, float right, float *volume, float *balance) { assert((left >= 0.0) && (right >= 0.0)); *volume = MAX(left, right); if (left > right) *balance = -1.0 + right / left; else if (right > left) *balance = 1.0 - left / right; else *balance = 0.0; } /* Performs the reverse calculation of lr_to_vb() */ void vb_to_lr(float volume, float balance, float *left, float *right) { /* *left = volume; *right = volume; return; // XXX */ *left = volume * (1.0 - MAX(0.0, balance)); *right = volume * (1.0 + MIN(0.0, balance)); } double get_current_time(void) { struct timeval tv; double t; gettimeofday(&tv, NULL); t = (double)tv.tv_sec; t += (double)tv.tv_usec / 1.0e6; return t; } void add_region(int index, int x, int y, int width, int height) { mr[index].enable = 1; mr[index].x = x; mr[index].y = y; mr[index].width = width; mr[index].height = height; } int check_region(int x, int y) { register int i; bool found = false; for (i = 0; i < 16 && !found; i++) { if (mr[i].enable && x >= mr[i].x && x <= mr[i].x + mr[i].width && y >= mr[i].y && y <= mr[i].y + mr[i].height) found = true; } if (!found) return -1; return (i - 1); } /* handle writing PID file, silently ignore if we can't do it */ void create_pid_file(void) { char *home; char *pid; FILE *fp; home = getenv("HOME"); if (home == NULL) return; pid = malloc(strlen(home) + 11); sprintf(pid, "%s/.wmix.pid", home); fp = fopen(pid, "w"); if (fp) { fprintf(fp, "%d\n", getpid()); fclose(fp); } free(pid); }
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * 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: * * Copyright (C) 2008 - 2009 Novell, Inc. * Copyright (C) 2009 Red Hat, Inc. */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include "mm-modem-moto-c-gsm.h" #include "mm-errors.h" #include "mm-callback-info.h" #include "mm-modem-gsm-card.h" static void modem_init (MMModem *modem_class); static void modem_gsm_card_init (MMModemGsmCard *gsm_card_class); G_DEFINE_TYPE_EXTENDED (MMModemMotoCGsm, mm_modem_moto_c_gsm, MM_TYPE_GENERIC_GSM, 0, G_IMPLEMENT_INTERFACE (MM_TYPE_MODEM, modem_init) G_IMPLEMENT_INTERFACE (MM_TYPE_MODEM_GSM_CARD, modem_gsm_card_init)) MMModem * mm_modem_moto_c_gsm_new (const char *device, const char *driver, const char *plugin) { g_return_val_if_fail (device != NULL, NULL); g_return_val_if_fail (driver != NULL, NULL); g_return_val_if_fail (plugin != NULL, NULL); return MM_MODEM (g_object_new (MM_TYPE_MODEM_MOTO_C_GSM, MM_MODEM_MASTER_DEVICE, device, MM_MODEM_DRIVER, driver, MM_MODEM_PLUGIN, plugin, NULL)); } /*****************************************************************************/ static void modem_init (MMModem *modem_class) { } /*****************************************************************************/ static void get_imei (MMModemGsmCard *modem, MMModemStringFn callback, gpointer user_data) { MMCallbackInfo *info; info = mm_callback_info_string_new (MM_MODEM (modem), callback, user_data); info->error = g_error_new_literal (MM_MODEM_ERROR, MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED, "Operation not supported"); mm_callback_info_schedule (info); } static void modem_gsm_card_init (MMModemGsmCard *class) { class->get_imei = get_imei; } /*****************************************************************************/ static void mm_modem_moto_c_gsm_init (MMModemMotoCGsm *self) { } static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { /* These devices just don't implement AT+CFUN */ switch (prop_id) { case MM_GENERIC_GSM_PROP_POWER_UP_CMD: g_value_set_string (value, ""); break; case MM_GENERIC_GSM_PROP_POWER_DOWN_CMD: g_value_set_string (value, ""); break; default: break; } } static void set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { } static void mm_modem_moto_c_gsm_class_init (MMModemMotoCGsmClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); mm_modem_moto_c_gsm_parent_class = g_type_class_peek_parent (klass); object_class->get_property = get_property; object_class->set_property = set_property; g_object_class_override_property (object_class, MM_GENERIC_GSM_PROP_POWER_UP_CMD, MM_GENERIC_GSM_POWER_UP_CMD); g_object_class_override_property (object_class, MM_GENERIC_GSM_PROP_POWER_DOWN_CMD, MM_GENERIC_GSM_POWER_DOWN_CMD); }
/* Definitions for the Philips SAA7196 digital video decoder, scaler, and clock generator circuit (DESCpro), as used in the PlanB video input of the Powermac 7x00/8x00 series. Copyright (C) 1998 - 2002 Michel Lanners <mailto:mlan@cpu.lu> The register defines are shamelessly copied from the meteor driver out of FreeBSD (with permission), and are copyrighted (c) 1995 Mark Tinguely and Jim Lowe (Thanks !) The default values used for PlanB are my mistakes. */ /* $Id: saa7196.h,v 1.1.1.1 2004/09/28 06:06:11 sure Exp $ */ #ifndef _SAA7196_H_ #define _SAA7196_H_ #define SAA7196_NUMREGS 0x31 /* Number of registers (used)*/ #define NUM_SUPPORTED_NORM 3 /* Number of supported norms by PlanB */ /* Decoder part: */ #define SAA7196_IDEL 0x00 /* Increment delay */ #define SAA7196_HSB5 0x01 /* H-sync begin; 50 hz */ #define SAA7196_HSS5 0x02 /* H-sync stop; 50 hz */ #define SAA7196_HCB5 0x03 /* H-clamp begin; 50 hz */ #define SAA7196_HCS5 0x04 /* H-clamp stop; 50 hz */ #define SAA7196_HSP5 0x05 /* H-sync after PHI1; 50 hz */ #define SAA7196_LUMC 0x06 /* Luminance control */ #define SAA7196_HUEC 0x07 /* Hue control */ #define SAA7196_CKTQ 0x08 /* Colour Killer Threshold QAM (PAL, NTSC) */ #define SAA7196_CKTS 0x09 /* Colour Killer Threshold SECAM */ #define SAA7196_PALS 0x0a /* PAL switch sensitivity */ #define SAA7196_SECAMS 0x0b /* SECAM switch sensitivity */ #define SAA7196_CGAINC 0x0c /* Chroma gain control */ #define SAA7196_STDC 0x0d /* Standard/Mode control */ #define SAA7196_IOCC 0x0e /* I/O and Clock Control */ #define SAA7196_CTRL1 0x0f /* Control #1 */ #define SAA7196_CTRL2 0x10 /* Control #2 */ #define SAA7196_CGAINR 0x11 /* Chroma Gain Reference */ #define SAA7196_CSAT 0x12 /* Chroma Saturation */ #define SAA7196_CONT 0x13 /* Luminance Contrast */ #define SAA7196_HSB6 0x14 /* H-sync begin; 60 hz */ #define SAA7196_HSS6 0x15 /* H-sync stop; 60 hz */ #define SAA7196_HCB6 0x16 /* H-clamp begin; 60 hz */ #define SAA7196_HCS6 0x17 /* H-clamp stop; 60 hz */ #define SAA7196_HSP6 0x18 /* H-sync after PHI1; 60 hz */ #define SAA7196_BRIG 0x19 /* Luminance Brightness */ /* Scaler part: */ #define SAA7196_FMTS 0x20 /* Formats and sequence */ #define SAA7196_OUTPIX 0x21 /* Output data pixel/line */ #define SAA7196_INPIX 0x22 /* Input data pixel/line */ #define SAA7196_HWS 0x23 /* Horiz. window start */ #define SAA7196_HFILT 0x24 /* Horiz. filter */ #define SAA7196_OUTLINE 0x25 /* Output data lines/field */ #define SAA7196_INLINE 0x26 /* Input data lines/field */ #define SAA7196_VWS 0x27 /* Vertical window start */ #define SAA7196_VYP 0x28 /* AFS/vertical Y processing */ #define SAA7196_VBS 0x29 /* Vertical Bypass start */ #define SAA7196_VBCNT 0x2a /* Vertical Bypass count */ #define SAA7196_VBP 0x2b /* veritcal Bypass Polarity */ #define SAA7196_VLOW 0x2c /* Colour-keying lower V limit */ #define SAA7196_VHIGH 0x2d /* Colour-keying upper V limit */ #define SAA7196_ULOW 0x2e /* Colour-keying lower U limit */ #define SAA7196_UHIGH 0x2f /* Colour-keying upper U limit */ #define SAA7196_DPATH 0x30 /* Data path setting */ /* Initialization default values: */ unsigned char saa_regs[NUM_SUPPORTED_NORM][SAA7196_NUMREGS] = { /* PAL, 768x576 (no scaling), composite video-in */ /* Decoder: */ { 0x50, 0x30, 0x00, 0xe8, 0xb6, 0xe5, 0x63, 0xff, 0xfe, 0xf0, 0xfe, 0xe0, 0x20, 0x06, 0x3b, 0x98, 0x00, 0x59, 0x41, 0x45, 0x34, 0x0a, 0xf4, 0xd2, 0xe9, 0xa2, /* Padding */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, /* Scaler: */ 0x72, 0x80, 0x00, 0x03, 0x8d, 0x20, 0x20, 0x12, 0xa5, 0x12, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x87 }, /* NTSC, 640x480? (no scaling), composite video-in */ /* Decoder: */ { 0x50, 0x30, 0x00, 0xe8, 0xb6, 0xe5, 0x50, 0x00, 0xf8, 0xf0, 0xfe, 0xe0, 0x00, 0x06, 0x3b, 0x98, 0x00, 0x2c, 0x3d, 0x40, 0x34, 0x0a, 0xf4, 0xd2, 0xe9, 0x98, /* Padding */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, /* Scaler: */ 0x72, 0x80, 0x80, 0x03, 0x89, 0xf0, 0xf0, 0x0d, 0xa0, 0x0d, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x87 }, /* SECAM, 768x576 (no scaling), composite video-in */ /* Decoder: */ { 0x50, 0x30, 0x00, 0xe8, 0xb6, 0xe5, 0x63, 0xff, 0xfe, 0xf0, 0xfe, 0xe0, 0x20, 0x07, 0x3b, 0x98, 0x00, 0x59, 0x41, 0x45, 0x34, 0x0a, 0xf4, 0xd2, 0xe9, 0xa2, /* Padding */ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, /* Scaler: */ 0x72, 0x80, 0x00, 0x03, 0x8d, 0x20, 0x20, 0x12, 0xa5, 0x12, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x87 } }; #endif /* _SAA7196_H_ */
/* * Copyright (C) 2018 Sarod Yatawatta <sarod@users.sf.net> 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 $Id$ */ #ifndef DIRAC_GPUTUNE_H #define DIRAC_GPUTUNE_H #ifdef __cplusplus extern "C" { #endif /********************************************/ #ifdef HAVE_CUDA /* include tunable parameters of GPU version here */ /* such as number of blocks, threads per block etc */ #ifndef MAX_GPU_ID #define MAX_GPU_ID 3 /* use 0 (1 GPU), 1 (2 GPUs), ... */ #endif /* default value for threads per block */ #ifndef DEFAULT_TH_PER_BK #define DEFAULT_TH_PER_BK 64 #endif #ifndef DEFAULT_TH_PER_BK_2 #define DEFAULT_TH_PER_BK_2 32 #endif #endif /********************************************/ #ifdef __cplusplus } /* extern "C" */ #endif #endif /* DIRAC_GPUTUNE_H */
#ifndef FASTREAD_COLLECTORDATETIME_H_ #define FASTREAD_COLLECTORDATETIME_H_ #include <Rcpp.h> #include "Collector.h" #include "DateTime.h" #include "DateTimeParser.h" #include "DateTimeLocale.h" std::string formatStandard(const std::string& format) { std::string out; out.resize(100); // Standard time used by go: http://golang.org/pkg/time/ struct tm tm; tm.tm_year = 2006 - 1900; tm.tm_mon = 1 - 1; tm.tm_mday = 2; tm.tm_hour = 15; tm.tm_min = 4; tm.tm_sec = 5; size_t len = strftime(&out[0], 100, format.c_str(), &tm); if (len == 0) return "???"; out.resize(len); return out; } class CollectorDateTime : public Collector { std::string format_, tz_; DateTimeLocale locale_; DateTimeParser parser_; TzManager tzMan_; public: CollectorDateTime(const std::string& format, const std::string& tz): Collector(Rcpp::NumericVector()), format_(format), tz_(tz), parser_(locale_, tz), tzMan_(tz) { } void setValue(int i, const Token& t) { REAL(column_)[i] = parse(t); } double parse(const Token& t) { switch(t.type()) { case TOKEN_STRING: { boost::container::string buffer; SourceIterators string = t.getString(&buffer); std::string std_string(string.first, string.second); parser_.setDate(std_string.c_str()); bool res = (format_ == "") ? parser_.parse() : parser_.parse(format_); if (!res) { warn(t.row(), t.col(), "date like " + format_, std_string); return NA_REAL; } DateTime dt = parser_.makeDateTime(); if (!dt.isValid()) { warn(t.row(), t.col(), "valid date", std_string); return NA_REAL; } return dt.time(&tzMan_); } case TOKEN_MISSING: case TOKEN_EMPTY: return NA_REAL; case TOKEN_EOF: Rcpp::stop("Invalid token"); } return 0; } Rcpp::RObject vector() { column_.attr("class") = Rcpp::CharacterVector::create("POSIXct", "POSIXt"); column_.attr("tzone") = tz_; return column_; }; static bool canParse(const std::string& x) { DateTimeLocale loc; DateTimeParser parser(loc, "UTC"); parser.setDate(x.c_str()); return parser.parse(false); } }; #endif
/* * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once #include "RenderFrameBase.h" namespace WebCore { class RenderView; class RenderIFrame final : public RenderFrameBase { WTF_MAKE_ISO_ALLOCATED(RenderIFrame); public: RenderIFrame(HTMLIFrameElement&, RenderStyle&&); HTMLIFrameElement& iframeElement() const; bool flattenFrame() const; private: void frameOwnerElement() const = delete; bool shouldComputeSizeAsReplaced() const override; bool isInlineBlockOrInlineTable() const override; void layout() override; bool isRenderIFrame() const override { return true; } #if PLATFORM(IOS) // FIXME: Do we still need this workaround to avoid breaking layout tests? const char* renderName() const override { return "RenderPartObject"; } #else const char* renderName() const override { return "RenderIFrame"; } #endif bool requiresLayer() const override; RenderView* contentRootRenderer() const; bool isFullScreenIFrame() const; }; } // namespace WebCore SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderIFrame, isRenderIFrame())
/* ggrd_velinterpol.c */ int ggrd_find_vel_and_der(double *, double, double, struct ggrd_master *, int, unsigned short, unsigned short, double *, double *, double *); void ggrd_get_velocities(double *, double *, double *, int, struct ggrd_master *, double, double); void ggrd_weights(double, double *, int, int, double [(5 +1)][(1 +1)]); /* ggrd_readgrds.c */ void ggrd_init_vstruc(struct ggrd_master *); int ggrd_read_vel_grids(struct ggrd_master *, double, unsigned short, unsigned short, char *, unsigned char); void ggrd_resort_and_check(double *, float *, double *, int, int, unsigned short, double, unsigned short, unsigned short, double, unsigned char *); void ggrd_read_depth_levels(struct ggrd_master *, int **, char *, unsigned short); /* ggrd_grdtrack_util.c */ void ggrd_init_master(struct ggrd_master *); void ggrd_grdinfo(char *); int ggrd_grdtrack_init_general(unsigned char, char *, char *, char *, struct ggrd_gt *, unsigned char, unsigned char, unsigned char); int ggrd_grdtrack_rescale(struct ggrd_gt *, unsigned char, unsigned char, unsigned char, double); unsigned char ggrd_grdtrack_interpolate_rtp(double, double, double, struct ggrd_gt *, double *, unsigned char, unsigned char, double); unsigned char ggrd_grdtrack_interpolate_lonlatz(double, double, double, struct ggrd_gt *, double *, unsigned char); unsigned char ggrd_grdtrack_interpolate_xyz(double, double, double, struct ggrd_gt *, double *, unsigned char); unsigned char ggrd_grdtrack_interpolate_tp(double, double, struct ggrd_gt *, double *, unsigned char, unsigned char); unsigned char ggrd_grdtrack_interpolate_xy(double, double, struct ggrd_gt *, double *, unsigned char); void ggrd_grdtrack_free_gstruc(struct ggrd_gt *); void ggrd_find_spherical_vel_from_rigid_cart_rot(double *, double *, double *, double *, double *); int ggrd_grdtrack_init(double *, double *, double *, double *, float **, int *, char *, struct GRD_HEADER **, struct GMT_EDGEINFO **, char *, unsigned char *, GMT_LONG *, unsigned char, char *, float **, int *, GMT_LONG, unsigned char, unsigned char, struct GMT_BCR *); void ggrd_print_layer_avg(float *, float *, int, int, int, FILE *, GMT_LONG *); unsigned char ggrd_grdtrack_interpolate(double *, unsigned char, struct GRD_HEADER *, float *, struct GMT_EDGEINFO *, int, float *, int, double *, unsigned char, struct GMT_BCR *); int ggrd_init_thist_from_file(struct ggrd_t *, char *, unsigned char, unsigned char); void ggrd_gt_interpolate_z(double, float *, int, int *, int *, double *, double *, unsigned char, unsigned char *); int ggrd_interpol_time(double, struct ggrd_t *, int *, int *, double *, double *); int interpolate_seafloor_ages(double, double, double, struct ggrd_master *, double *); FILE *ggrd_open(char *, char *, char *); void ggrd_vecalloc(double **, int, char *); void ggrd_vecrealloc(double **, int, char *); void ggrd_calc_mean_and_stddev(double *, double *, int, double *, double *, double *, unsigned char, unsigned char, double *); void ggrd_indexx(int, double *, int *); float ggrd_gt_rms(float *, int); float ggrd_gt_mean(float *, int); /* sh_exp_ggrd.c */ void sh_read_spatial_data_from_grd(struct sh_lms *, struct ggrd_gt *, unsigned short, int, double *, double *);
/* * BB: The portable demo * * (C) 1997 by AA-group (e-mail: aa@horac.ta.jcu.cz) * * 3rd August 1997 * version: 1.2 [final3] * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public Licences as by published * by the Free Software Foundation; either version 2; or (at your option) * any later version * * This program is distributed in the hope that it will entertaining, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Publis 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. * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <string.h> #include <malloc.h> #include "bb.h" static int cursor_x, cursor_y; static int start; static void newline() { while (cursor_x < aa_scrwidth(context)) { context->textbuffer[cursor_x + cursor_y * aa_scrwidth(context)] = ' '; context->attrbuffer[cursor_x + cursor_y * aa_scrwidth(context)] = AA_NORMAL; cursor_x++; } start--; if (start < 0) start = 0; cursor_y++, cursor_x = 0; if (cursor_y >= aa_scrheight(context)) { memcpy(context->textbuffer + start * aa_scrwidth(context), context->textbuffer + (start + 1) * aa_scrwidth(context), aa_scrwidth(context) * (aa_scrheight(context) - start - 1)); memcpy(context->attrbuffer + start * aa_scrwidth(context), context->attrbuffer + (start + 1) * aa_scrwidth(context), aa_scrwidth(context) * (aa_scrheight(context) - start - 1)); memset(context->textbuffer + aa_scrwidth(context) * (aa_scrheight(context) - 1), ' ', aa_scrwidth(context)); memset(context->attrbuffer + aa_scrwidth(context) * (aa_scrheight(context) - 1), 0, aa_scrwidth(context)); cursor_y--; } } static void put(char c) { if (c == '\n') { newline(); return; } context->textbuffer[cursor_x + cursor_y * aa_scrwidth(context)] = c; context->attrbuffer[cursor_x + cursor_y * aa_scrwidth(context)] = AA_NORMAL; cursor_x++; if (cursor_x == aa_scrwidth(context)) newline(); } static void putcursor(void) { context->attrbuffer[cursor_x + cursor_y * aa_scrwidth(context)] = AA_REVERSE; context->textbuffer[cursor_x + cursor_y * aa_scrwidth(context)] = ' '; aa_gotoxy(context, cursor_x, cursor_y); } void messager(char *c) { int i, s = strlen(c); start = cursor_y = aa_scrheight(context) - 1; cursor_x = 0; for (i = 0; i < s; i++) { put(c[i]); putcursor(); bbflushwait(0.03 * 1000000); } bbflushwait(1000000); aa_gotoxy(context, 0, 0); } void tographics() { backconvert(0, start, aa_scrwidth(context), aa_scrheight(context)); } static char *bckup; static char *bckup1; #define STAGE (TIME-starttime) static void toblack() { params->bright = -STAGE * 256 / (endtime - starttime); } static void towhite() { params->bright = STAGE * 256 / (endtime - starttime); } static void decontr() { params->contrast = -STAGE * 256 / (endtime - starttime); } static void incrandom() { params->randomval = STAGE * 100 / (endtime - starttime); } static void toblack1() { int x, y, mul1, mul2 = 0, pos; int minpos = 0; unsigned char *b1 = bckup, *b2 = bckup1; pos = STAGE * (aa_imgheight(context) + aa_imgheight(context)) / (endtime - starttime) - aa_imgheight(context); for (y = 0; y < aa_imgheight(context); y++) { mul1 = (y - pos); if (mul1 < 0) mul1 = 0; else mul1 = mul1 * 256 * 4 / aa_imgheight(context); if (mul1 > 256) mul1 = 256; mul2 = (y - pos - aa_imgheight(context)); if (mul2 < 0) mul2 = 0; else mul2 = mul2 * 256 * 8 / aa_imgheight(context); if (mul2 > 256) mul2 = 256; if (mul2 == 0) minpos = y; mul1 -= mul2; for (x = 0; x < aa_imgwidth(context); x++) { aa_putpixel(context, x, y, (mul1 * (int) (*b1) + mul2 * (int) (*b2)) / 256); b1++; b2++; } } minpos = pos + 3 * aa_imgheight(context) / 4; if (minpos < 0) minpos = 0; if (minpos > aa_imgheight(context)) minpos = aa_imgheight(context); aa_render(context, params, 0, 0, aa_imgwidth(context), minpos); aa_flush(context); emscripten_sleep(1); } void devezen1() { bckup = (char *) malloc(aa_imgwidth(context) * aa_imgheight(context)); memcpy(bckup, context->imagebuffer, aa_imgwidth(context) * aa_imgheight(context)); tographics(); bckup1 = (char *) malloc(aa_imgwidth(context) * aa_imgheight(context)); memcpy(bckup1, context->imagebuffer, aa_imgwidth(context) * aa_imgheight(context)); drawptr = toblack1; timestuff(0, NULL, toblack1, 5000000); free(bckup); free(bckup1); } void devezen2() { tographics(); drawptr = toblack; timestuff(0, NULL, draw, 1000000); } void devezen3() { tographics(); drawptr = incrandom; timestuff(0, NULL, draw, 1000000); params->randomval = 100; drawptr = toblack; timestuff(0, NULL, draw, 1000000); params->randomval = 0; params->bright = 0; } void devezen4() { tographics(); drawptr = decontr; timestuff(0, NULL, draw, 500000); drawptr = towhite; timestuff(0, NULL, draw, 500000); params->bright = 0; params->contrast = 0; }
/* * Copyright (C) 2003 PMC-Sierra Inc. * Author: Manish Lachwani (lachwani@pmc-sierra.com) * * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) * * 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHOR 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. * * 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., * 675 Mass Ave, Cambridge, MA 02139, USA. * * Second level Interrupt handlers for the PMC-Sierra Titan/Yosemite board */ #include <linux/errno.h> #include <linux/init.h> #include <linux/kernel_stat.h> #include <linux/module.h> #include <linux/signal.h> #include <linux/sched.h> #include <linux/types.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/irq.h> #include <linux/timex.h> #include <linux/random.h> #include <linux/bitops.h> #include <asm/bootinfo.h> #include <asm/io.h> #include <asm/irq.h> #include <asm/irq_cpu.h> #include <asm/mipsregs.h> #include <asm/system.h> #include <asm/titan_dep.h> /* Hypertransport specific */ #define IRQ_ACK_BITS 0x00000000 /* Ack bits */ #define HYPERTRANSPORT_INTA 0x78 /* INTA# */ #define HYPERTRANSPORT_INTB 0x79 /* INTB# */ #define HYPERTRANSPORT_INTC 0x7a /* INTC# */ #define HYPERTRANSPORT_INTD 0x7b /* INTD# */ extern void titan_mailbox_irq(void); #ifdef CONFIG_HYPERTRANSPORT /* * Handle hypertransport & SMP interrupts. The interrupt lines are scarce. * For interprocessor interrupts, the best thing to do is to use the INTMSG * register. We use the same external interrupt line, i.e. INTB3 and monitor * another status bit */ static void ll_ht_smp_irq_handler(int irq) { u32 status = OCD_READ(RM9000x2_OCD_INTP0STATUS4); /* Ack all the bits that correspond to the interrupt sources */ if (status != 0) OCD_WRITE(RM9000x2_OCD_INTP0STATUS4, IRQ_ACK_BITS); status = OCD_READ(RM9000x2_OCD_INTP1STATUS4); if (status != 0) OCD_WRITE(RM9000x2_OCD_INTP1STATUS4, IRQ_ACK_BITS); #ifdef CONFIG_HT_LEVEL_TRIGGER /* * Level Trigger Mode only. Send the HT EOI message back to the source. */ switch (status) { case 0x1000000: OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTA); break; case 0x2000000: OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTB); break; case 0x4000000: OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTC); break; case 0x8000000: OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTD); break; case 0x0000001: /* PLX */ OCD_WRITE(RM9000x2_OCD_HTEOI, 0x20); OCD_WRITE(IRQ_CLEAR_REG, IRQ_ACK_BITS); break; case 0xf000000: OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTA); OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTB); OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTC); OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTD); break; } #endif /* CONFIG_HT_LEVEL_TRIGGER */ do_IRQ(irq); } #endif asmlinkage void plat_irq_dispatch(void) { unsigned int cause = read_c0_cause(); unsigned int status = read_c0_status(); unsigned int pending = cause & status; if (pending & STATUSF_IP7) { do_IRQ(7); } else if (pending & STATUSF_IP2) { #ifdef CONFIG_HYPERTRANSPORT ll_ht_smp_irq_handler(2); #else do_IRQ(2); #endif } else if (pending & STATUSF_IP3) { do_IRQ(3); } else if (pending & STATUSF_IP4) { do_IRQ(4); } else if (pending & STATUSF_IP5) { #ifdef CONFIG_SMP titan_mailbox_irq(); #else do_IRQ(5); #endif } else if (pending & STATUSF_IP6) { do_IRQ(4); } } /* * Initialize the next level interrupt handler */ void __init arch_init_irq(void) { clear_c0_status(ST0_IM); mips_cpu_irq_init(); rm7k_cpu_irq_init(); rm9k_cpu_irq_init(); <<<<<<< HEAD ======= #ifdef CONFIG_GDB_CONSOLE register_gdb_console(); #endif >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a }
/* * * BlueZ - Bluetooth protocol stack for Linux * * Copyright (C) 2011 Nokia Corporation * Copyright (C) 2011 Marcel Holtmann <marcel@holtmann.org> * * * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef __BLUETOOTH_UUID_H #define __BLUETOOTH_UUID_H #ifdef __cplusplus extern "C" { #endif #include <stdint.h> #include <bluetooth/bluetooth.h> #define GENERIC_AUDIO_UUID "00001203-0000-1000-8000-00805f9b34fb" #define HSP_HS_UUID "00001108-0000-1000-8000-00805f9b34fb" #define HSP_AG_UUID "00001112-0000-1000-8000-00805f9b34fb" #define HFP_HS_UUID "0000111e-0000-1000-8000-00805f9b34fb" #define HFP_AG_UUID "0000111f-0000-1000-8000-00805f9b34fb" #define ADVANCED_AUDIO_UUID "0000110d-0000-1000-8000-00805f9b34fb" #define A2DP_SOURCE_UUID "0000110a-0000-1000-8000-00805f9b34fb" #define A2DP_SINK_UUID "0000110b-0000-1000-8000-00805f9b34fb" #define AVRCP_REMOTE_UUID "0000110e-0000-1000-8000-00805f9b34fb" #define AVRCP_TARGET_UUID "0000110c-0000-1000-8000-00805f9b34fb" #define PANU_UUID "00001115-0000-1000-8000-00805f9b34fb" #define NAP_UUID "00001116-0000-1000-8000-00805f9b34fb" #define GN_UUID "00001117-0000-1000-8000-00805f9b34fb" #define BNEP_SVC_UUID "0000000f-0000-1000-8000-00805f9b34fb" #define PNPID_UUID "00002a50-0000-1000-8000-00805f9b34fb" #define DEVICE_INFORMATION_UUID "0000180a-0000-1000-8000-00805f9b34fb" #define GATT_UUID "00001801-0000-1000-8000-00805f9b34fb" #define IMMEDIATE_ALERT_UUID "00001802-0000-1000-8000-00805f9b34fb" #define LINK_LOSS_UUID "00001803-0000-1000-8000-00805f9b34fb" #define TX_POWER_UUID "00001804-0000-1000-8000-00805f9b34fb" #define SAP_UUID "0000112D-0000-1000-8000-00805f9b34fb" #define HEART_RATE_UUID "0000180d-0000-1000-8000-00805f9b34fb" #define HEART_RATE_MEASUREMENT_UUID "00002a37-0000-1000-8000-00805f9b34fb" #define BODY_SENSOR_LOCATION_UUID "00002a38-0000-1000-8000-00805f9b34fb" #define HEART_RATE_CONTROL_POINT_UUID "00002a39-0000-1000-8000-00805f9b34fb" #define HEALTH_THERMOMETER_UUID "00001809-0000-1000-8000-00805f9b34fb" #define TEMPERATURE_MEASUREMENT_UUID "00002a1c-0000-1000-8000-00805f9b34fb" #define TEMPERATURE_TYPE_UUID "00002a1d-0000-1000-8000-00805f9b34fb" #define INTERMEDIATE_TEMPERATURE_UUID "00002a1e-0000-1000-8000-00805f9b34fb" #define MEASUREMENT_INTERVAL_UUID "00002a21-0000-1000-8000-00805f9b34fb" #define CYCLING_SC_UUID "00001816-0000-1000-8000-00805f9b34fb" #define CSC_MEASUREMENT_UUID "00002a5b-0000-1000-8000-00805f9b34fb" #define CSC_FEATURE_UUID "00002a5c-0000-1000-8000-00805f9b34fb" #define SENSOR_LOCATION_UUID "00002a5d-0000-1000-8000-00805f9b34fb" #define SC_CONTROL_POINT_UUID "00002a55-0000-1000-8000-00805f9b34fb" #define RFCOMM_UUID_STR "00000003-0000-1000-8000-00805f9b34fb" #define HDP_UUID "00001400-0000-1000-8000-00805f9b34fb" #define HDP_SOURCE_UUID "00001401-0000-1000-8000-00805f9b34fb" #define HDP_SINK_UUID "00001402-0000-1000-8000-00805f9b34fb" #define HSP_HS_UUID "00001108-0000-1000-8000-00805f9b34fb" #define HID_UUID "00001124-0000-1000-8000-00805f9b34fb" #define DUN_GW_UUID "00001103-0000-1000-8000-00805f9b34fb" #define GAP_UUID "00001800-0000-1000-8000-00805f9b34fb" #define PNP_UUID "00001200-0000-1000-8000-00805f9b34fb" #define SPP_UUID "00001101-0000-1000-8000-00805f9b34fb" #define OBEX_SYNC_UUID "00001104-0000-1000-8000-00805f9b34fb" #define OBEX_OPP_UUID "00001105-0000-1000-8000-00805f9b34fb" #define OBEX_FTP_UUID "00001106-0000-1000-8000-00805f9b34fb" #define OBEX_PCE_UUID "0000112e-0000-1000-8000-00805f9b34fb" #define OBEX_PSE_UUID "0000112f-0000-1000-8000-00805f9b34fb" #define OBEX_PBAP_UUID "00001130-0000-1000-8000-00805f9b34fb" #define OBEX_MAS_UUID "00001132-0000-1000-8000-00805f9b34fb" #define OBEX_MNS_UUID "00001133-0000-1000-8000-00805f9b34fb" #define OBEX_MAP_UUID "00001134-0000-1000-8000-00805f9b34fb" typedef struct { enum { BT_UUID_UNSPEC = 0, BT_UUID16 = 16, BT_UUID32 = 32, BT_UUID128 = 128, } type; union { uint16_t u16; uint32_t u32; uint128_t u128; } value; } bt_uuid_t; int bt_uuid_strcmp(const void *a, const void *b); int bt_uuid16_create(bt_uuid_t *btuuid, uint16_t value); int bt_uuid32_create(bt_uuid_t *btuuid, uint32_t value); int bt_uuid128_create(bt_uuid_t *btuuid, uint128_t value); int bt_uuid_cmp(const bt_uuid_t *uuid1, const bt_uuid_t *uuid2); void bt_uuid_to_uuid128(const bt_uuid_t *src, bt_uuid_t *dst); #define MAX_LEN_UUID_STR 37 int bt_uuid_to_string(const bt_uuid_t *uuid, char *str, size_t n); int bt_string_to_uuid(bt_uuid_t *uuid, const char *string); int bt_uuid_len(const bt_uuid_t *uuid); #ifdef __cplusplus } #endif #endif /* __BLUETOOTH_UUID_H */
/* THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK http://dev-c.com (C) Alexander Blade 2015 */ #pragma once #include <windows.h> #include <string> #include <vector> // parameters are the same as with aru's ScriptHook for IV void OnKeyboardMessage(DWORD key, WORD repeats, BYTE scanCode, BOOL isExtended, BOOL isWithAlt, BOOL wasDownBefore, BOOL isUpNow); bool IsKeyDown(DWORD key); bool IsKeyJustUp(DWORD key, bool exclusive = true); void ResetKeyState(DWORD key); int FetchKey(); int FetchKeyUp(); bool IsKeyCombinationDown(std::string humanReadableKey); bool IsKeyCombinationJustUp(std::string humanReadableKey); void PressKeyCombination(std::vector<int> keys); void PressKeyCombination(std::vector<std::string> humanReadableKeys); void PressKey(std::string humanReadableKey); std::vector<std::string> SplitKeyCombination(std::string humanReadableKey); DWORD str2key(std::string humanReadableKey); std::string key2str(DWORD key); bool IsControllerButtonPressed(int button); bool IsControllerButtonJustPressed(int button);
#include "nps_radio_control.h" #include <glib.h> #include <stdio.h> #include <string.h> #include <sys/types.h> #include <glib.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h> #include <sys/ioctl.h> #include <linux/joystick.h> static gboolean on_js_data_received(GIOChannel *source, GIOCondition condition, gpointer data); int nps_radio_control_joystick_init(const char* device) { int fd = open(device, O_RDONLY | O_NONBLOCK); if (fd == -1) { printf("opening joystick device %s : %s\n", device, strerror(errno)); return -1; } GIOChannel* channel = g_io_channel_unix_new(fd); g_io_channel_set_encoding(channel, NULL, NULL); g_io_add_watch (channel, G_IO_IN , on_js_data_received, NULL); return 0; } #define JS_ROLL 0 #define JS_PITCH 1 #define JS_MODE 2 #define JS_YAW 5 #define JS_THROTTLE 6 #define JS_NB_AXIS 7 static gboolean on_js_data_received(GIOChannel *source, GIOCondition condition __attribute__ ((unused)), gpointer data __attribute__ ((unused))) { struct js_event js; gsize len; GError *err = NULL; g_io_channel_read_chars(source, (gchar*)(&js), sizeof(struct js_event), &len, &err); if (js.type == JS_EVENT_AXIS) { if (js.number < JS_NB_AXIS) { switch (js.number) { case JS_THROTTLE: nps_radio_control.throttle = ((float)js.value + 28000.)/56000.; //printf("joystick throttle %d\n",js.value); break; case JS_ROLL: nps_radio_control.roll = (float)js.value/-28000.; //printf("joystick roll %d %f\n",js.value, nps_radio_control.roll); break; case JS_PITCH: nps_radio_control.pitch = (float)js.value/-28000.; //printf("joystick pitch %d\n",js.value); break; case JS_YAW: nps_radio_control.yaw = (float)js.value/-28000.; //printf("joystick yaw %d\n",js.value); break; case JS_MODE: nps_radio_control.mode = (float)js.value/-32000.; //printf("joystick mode %d\n",js.value); break; } } } return TRUE; }
/* $Id: ioctls.h,v 1.1.1.1 2010/03/11 21:10:21 kris Exp $ */ #ifndef _ASM_SPARC64_IOCTLS_H #define _ASM_SPARC64_IOCTLS_H #include <asm/ioctl.h> /* Big T */ #define TCGETA _IOR('T', 1, struct termio) #define TCSETA _IOW('T', 2, struct termio) #define TCSETAW _IOW('T', 3, struct termio) #define TCSETAF _IOW('T', 4, struct termio) #define TCSBRK _IO('T', 5) #define TCXONC _IO('T', 6) #define TCFLSH _IO('T', 7) #define TCGETS _IOR('T', 8, struct termios) #define TCSETS _IOW('T', 9, struct termios) #define TCSETSW _IOW('T', 10, struct termios) #define TCSETSF _IOW('T', 11, struct termios) #define TCGETS2 _IOR('T', 12, struct termios2) #define TCSETS2 _IOW('T', 13, struct termios2) #define TCSETSW2 _IOW('T', 14, struct termios2) #define TCSETSF2 _IOW('T', 15, struct termios2) /* Note that all the ioctls that are not available in Linux have a * double underscore on the front to: a) avoid some programs to * think we support some ioctls under Linux (autoconfiguration stuff) */ /* Little t */ #define TIOCGETD _IOR('t', 0, int) #define TIOCSETD _IOW('t', 1, int) #define __TIOCHPCL _IO('t', 2) /* SunOS Specific */ #define __TIOCMODG _IOR('t', 3, int) /* SunOS Specific */ #define __TIOCMODS _IOW('t', 4, int) /* SunOS Specific */ #define __TIOCGETP _IOR('t', 8, struct sgttyb) /* SunOS Specific */ #define __TIOCSETP _IOW('t', 9, struct sgttyb) /* SunOS Specific */ #define __TIOCSETN _IOW('t', 10, struct sgttyb) /* SunOS Specific */ #define TIOCEXCL _IO('t', 13) #define TIOCNXCL _IO('t', 14) #define __TIOCFLUSH _IOW('t', 16, int) /* SunOS Specific */ #define __TIOCSETC _IOW('t', 17, struct tchars) /* SunOS Specific */ #define __TIOCGETC _IOR('t', 18, struct tchars) /* SunOS Specific */ #define __TIOCTCNTL _IOW('t', 32, int) /* SunOS Specific */ #define __TIOCSIGNAL _IOW('t', 33, int) /* SunOS Specific */ #define __TIOCSETX _IOW('t', 34, int) /* SunOS Specific */ #define __TIOCGETX _IOR('t', 35, int) /* SunOS Specific */ #define TIOCCONS _IO('t', 36) #define __TIOCSSIZE _IOW('t', 37, struct sunos_ttysize) /* SunOS Specific */ #define __TIOCGSIZE _IOR('t', 38, struct sunos_ttysize) /* SunOS Specific */ #define TIOCGSOFTCAR _IOR('t', 100, int) #define TIOCSSOFTCAR _IOW('t', 101, int) #define __TIOCUCNTL _IOW('t', 102, int) /* SunOS Specific */ #define TIOCSWINSZ _IOW('t', 103, struct winsize) #define TIOCGWINSZ _IOR('t', 104, struct winsize) #define __TIOCREMOTE _IOW('t', 105, int) /* SunOS Specific */ #define TIOCMGET _IOR('t', 106, int) #define TIOCMBIC _IOW('t', 107, int) #define TIOCMBIS _IOW('t', 108, int) #define TIOCMSET _IOW('t', 109, int) #define TIOCSTART _IO('t', 110) #define TIOCSTOP _IO('t', 111) #define TIOCPKT _IOW('t', 112, int) #define TIOCNOTTY _IO('t', 113) #define TIOCSTI _IOW('t', 114, char) #define TIOCOUTQ _IOR('t', 115, int) #define __TIOCGLTC _IOR('t', 116, struct ltchars) /* SunOS Specific */ #define __TIOCSLTC _IOW('t', 117, struct ltchars) /* SunOS Specific */ /* 118 is the non-posix setpgrp tty ioctl */ /* 119 is the non-posix getpgrp tty ioctl */ #define __TIOCCDTR _IO('t', 120) /* SunOS Specific */ #define __TIOCSDTR _IO('t', 121) /* SunOS Specific */ #define TIOCCBRK _IO('t', 122) #define TIOCSBRK _IO('t', 123) #define __TIOCLGET _IOW('t', 124, int) /* SunOS Specific */ #define __TIOCLSET _IOW('t', 125, int) /* SunOS Specific */ #define __TIOCLBIC _IOW('t', 126, int) /* SunOS Specific */ #define __TIOCLBIS _IOW('t', 127, int) /* SunOS Specific */ #define __TIOCISPACE _IOR('t', 128, int) /* SunOS Specific */ #define __TIOCISIZE _IOR('t', 129, int) /* SunOS Specific */ #define TIOCSPGRP _IOW('t', 130, int) #define TIOCGPGRP _IOR('t', 131, int) #define TIOCSCTTY _IO('t', 132) #define TIOCGSID _IOR('t', 133, int) /* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */ #define TIOCGPTN _IOR('t', 134, unsigned int) /* Get Pty Number */ #define TIOCSPTLCK _IOW('t', 135, int) /* Lock/unlock PTY */ /* Little f */ #define FIOCLEX _IO('f', 1) #define FIONCLEX _IO('f', 2) #define FIOASYNC _IOW('f', 125, int) #define FIONBIO _IOW('f', 126, int) #define FIONREAD _IOR('f', 127, int) #define TIOCINQ FIONREAD #define FIOQSIZE _IOR('f', 128, loff_t) /* SCARY Rutgers local SunOS kernel hackery, perhaps I will support it * someday. This is completely bogus, I know... */ #define __TCGETSTAT _IO('T', 200) /* Rutgers specific */ #define __TCSETSTAT _IO('T', 201) /* Rutgers specific */ /* Linux specific, no SunOS equivalent. */ #define TIOCLINUX 0x541C #define TIOCGSERIAL 0x541E #define TIOCSSERIAL 0x541F #define TCSBRKP 0x5425 #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 #define TIOCSERSWILD 0x5455 #define TIOCGLCKTRMIOS 0x5456 #define TIOCSLCKTRMIOS 0x5457 #define TIOCSERGSTRUCT 0x5458 /* For debugging only */ #define TIOCSERGETLSR 0x5459 /* Get line status register */ #define TIOCSERGETMULTI 0x545A /* Get multiport config */ #define TIOCSERSETMULTI 0x545B /* Set multiport config */ #define TIOCMIWAIT 0x545C /* Wait for change on serial input line(s) */ #define TIOCGICOUNT 0x545D /* Read serial port inline interrupt counts */ /* Kernel definitions */ #ifdef __KERNEL__ #define TIOCGETC __TIOCGETC #define TIOCGETP __TIOCGETP #define TIOCGLTC __TIOCGLTC #define TIOCSLTC __TIOCSLTC #define TIOCSETP __TIOCSETP #define TIOCSETN __TIOCSETN #define TIOCSETC __TIOCSETC #endif /* Used for packet mode */ #define TIOCPKT_DATA 0 #define TIOCPKT_FLUSHREAD 1 #define TIOCPKT_FLUSHWRITE 2 #define TIOCPKT_STOP 4 #define TIOCPKT_START 8 #define TIOCPKT_NOSTOP 16 #define TIOCPKT_DOSTOP 32 #endif /* !(_ASM_SPARC64_IOCTLS_H) */
#ifndef GVFONT #define GVFONT // // gvfont.h // ///////////////////////////////////////////////////////////////////////////// #define _MAX_PATH 255 #define PREFONT "/usr/local/lib/jmce/" #define m_stdfont PREFONT"stdfont.15" #define m_spcfont PREFONT"spcfont.15" #define m_supfont PREFONT"spcfsupp.15" #define m_ascfont PREFONT"ascfont.15" FILE *fp_asc; FILE *fp_std; FILE *fp_spc; FILE *fp_sup; enum fontid //global enum { stdfont, ascfont, spcfont, spcfsupp }; int m_includechinese = 1; int m_fontheight = 15; /*16; */ int m_fontwidth = 16; extern unsigned char m_byBits[32]; //jmt:#1 own chinese font #endif
/*************************************************************************** YAM - Yet Another Mailer Copyright (C) 1995-2000 Marcel Beck Copyright (C) 2000-2019 YAM Open Source Team 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 YAM Official Support Site : http://www.yam.ch YAM OpenSource project : http://sourceforge.net/projects/yamos/ $Id$ Superclass: MUIC_Group Description: Group of two cycle object to choose a time zone ***************************************************************************/ #include "TZoneChooser_cl.h" #include <string.h> #include <proto/muimaster.h> #include "extrasrc.h" #include "MUIObjects.h" #include "TZone.h" #include "mui/TZoneContinentChooser.h" #include "mui/TZoneLocationChooser.h" #include "Debug.h" /* CLASSDATA struct Data { Object *continents; Object *locations; ULONG continent; ULONG location; BOOL selfSet; char tzone[SIZE_DEFAULT]; }; */ /* Overloaded Methods */ /// OVERLOAD(OM_NEW) OVERLOAD(OM_NEW) { Object *continents; Object *locations; ENTER(); if((obj = DoSuperNew(cl, obj, MUIA_Group_Horiz, TRUE, Child, continents = TZoneContinentChooserObject, End, Child, locations = TZoneLocationChooserObject, End, TAG_MORE, inittags(msg))) != NULL) { GETDATA; data->continents = continents; data->locations = locations; DoMethod(continents, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, obj, 3, METHOD(BuildTZoneName), continents, MUIV_TriggerValue); DoMethod(locations, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, obj, 3, METHOD(BuildTZoneName), locations, MUIV_TriggerValue); } RETURN((IPTR)obj); return (IPTR)obj; } /// /// OVERLOAD(OM_SET) OVERLOAD(OM_SET) { GETDATA; struct TagItem *tags = inittags(msg), *tag; ULONG result; ENTER(); while((tag = NextTagItem((APTR)&tags)) != NULL) { switch(tag->ti_Tag) { case ATTR(TZone): { if(data->selfSet == FALSE) { char *tzone = (char *)tag->ti_Data; if(tzone != NULL) { ULONG continent; ULONG location; if(ParseTZoneName(tzone, &continent, &location, NULL) == TRUE) { nnset(data->continents, MUIA_Cycle_Active, continent); nnset(data->locations, MUIA_TZoneLocationChooser_Continent, continent); nnset(data->locations, MUIA_Cycle_Active, location); strlcpy(data->tzone, tzone, sizeof(data->tzone)); data->continent = continent; data->location = location; } } } // don't set the tag value to TAG_IGNORE to allow notifications to work } break; } } result = DoSuperMethodA(cl, obj, msg); RETURN(result); return result; } /// /// OVERLOAD(OM_GET) OVERLOAD(OM_GET) { GETDATA; IPTR *store = ((struct opGet *)msg)->opg_Storage; ULONG result = FALSE; ENTER(); switch(((struct opGet *)msg)->opg_AttrID) { case ATTR(TZone): { *store = (IPTR)data->tzone; result = TRUE; } break; } if(result == FALSE) result = DoSuperMethodA(cl, obj, msg); RETURN(result); return result; } /// /* Private Functions */ /* Public Methods */ /// DECLARE(BuildTZoneName) DECLARE(BuildTZoneName) // Object *origin, ULONG entry { GETDATA; ENTER(); if(msg->origin == data->continents) { data->continent = msg->entry; data->location = 0; nnset(data->locations, MUIA_TZoneLocationChooser_Continent, msg->entry); } else if(msg->origin == data->locations) { data->location = msg->entry; } // rebuild the time zone name BuildTZoneName(data->tzone, sizeof(data->tzone), data->continent, data->location); // don't do a recursive set() of the new time zone name, // but trigger notifications data->selfSet = TRUE; set(obj, ATTR(TZone), data->tzone); data->selfSet = FALSE; RETURN(0); return 0; } ///
/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: ./lib/Cshift.h Copyright (C) 2015 Author: Peter Boyle <paboyle@ph.ed.ac.uk> 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. See the full license in the file "LICENSE" in the top level distribution directory *************************************************************************************/ /* END LEGAL */ #ifndef _GRID_CSHIFT_H_ #define _GRID_CSHIFT_H_ #include <cshift/Cshift_common.h> #ifdef GRID_COMMS_NONE #include <cshift/Cshift_none.h> #endif #ifdef GRID_COMMS_MPI #include <cshift/Cshift_mpi.h> #endif #ifdef GRID_COMMS_SHMEM #include <cshift/Cshift_mpi.h> // uses same implementation of communicator #endif #endif
// OpenCSG - library for image-based CSG rendering for OpenGL // Copyright (C) 2002-2016, Florian Kirsch, // Hasso-Plattner-Institute at the University of Potsdam, Germany // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License, // Version 2, as published by the Free Software Foundation. // As a special exception, you have permission to link this library // with the CGAL library and distribute executables. // // 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // displaylistPrimitive.h // // example for a primitive which renders itself using a display list // #ifndef __OpenCSG__displaylistprimitive_h__ #define __OpenCSG__displaylistprimitive_h__ #include <opencsg.h> namespace OpenCSG { class DisplayListPrimitive : public Primitive { public: /// An object of this class contains the OpenGL id of a display /// list that is compiled by the application. render() just invokes /// this display list. /// Operation and convexity are just forwarded to the base Primitive class. DisplayListPrimitive(unsigned int displayListId_, Operation, unsigned int convexity); /// Sets the display list id void setDisplayListId(unsigned int); /// Returns the display list id unsigned int getDisplayListId() const; /// Calls the display list. virtual void render(); private: unsigned int mDisplayListId; }; } // namespace OpenCSG #endif
/** * \file rq_asset_correlation_mgr.h * \author Hendra * * \brief rq_asset_correlation_mgr provides a manager class for exchange * rate objects */ /* ** rq_asset_correlation_mgr.h ** ** Written by Hendra ** ** Copyright (C) 2002-2008 Brett Hutley ** ** This file is part of the Risk Quantify Library ** ** Risk Quantify is free software; you can redistribute it and/or ** modify it under the terms of the GNU Library General Public ** License as published by the Free Software Foundation; either ** version 2 of the License, or (at your option) any later version. ** ** Risk Quantify is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Library General Public License for more details. ** ** You should have received a copy of the GNU Library General Public ** License along with Risk Quantify; if not, write to the Free ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef rq_asset_correlation_mgr_h #define rq_asset_correlation_mgr_h #include "rq_asset_correlation.h" #include "rq_tree_rb.h" #ifdef __cplusplus extern "C" { #if 0 } // purely to not screw up my indenting... #endif #endif typedef struct rq_asset_correlation_mgr { rq_tree_rb_t tree; } * rq_asset_correlation_mgr_t; typedef struct rq_asset_correlation_mgr_iterator { rq_tree_rb_iterator_t asset_correlation_it; } * rq_asset_correlation_mgr_iterator_t; /** Test whether the rq_asset_correlation_mgr is NULL */ RQ_EXPORT int rq_asset_correlation_mgr_is_null(rq_asset_correlation_mgr_t obj); /** * Allocate a new asset correlation manager */ RQ_EXPORT rq_asset_correlation_mgr_t rq_asset_correlation_mgr_alloc(); /** * Make a deep copy of the asset correlation manager */ RQ_EXPORT rq_asset_correlation_mgr_t rq_asset_correlation_mgr_clone(rq_asset_correlation_mgr_t ermgr); /** * Free the asset correlation manager */ RQ_EXPORT void rq_asset_correlation_mgr_free(rq_asset_correlation_mgr_t asset_correlation_mgr); /** * Free the asset correlation managed by the asset correlation manager. */ RQ_EXPORT void rq_asset_correlation_mgr_clear(rq_asset_correlation_mgr_t asset_correlation_mgr); /** * This function returns the asset correlation between asset1 and asset2. * 0: success, returns the correlation value * 1: fail, correlation set to 0.0 */ RQ_EXPORT int rq_asset_correlation_mgr_get_correlation( rq_asset_correlation_mgr_t m, const char* asset1, const char* asset2, double* correlation ); /** * Add an asset correlation to the manager */ RQ_EXPORT void rq_asset_correlation_mgr_add( rq_asset_correlation_mgr_t m, const char* asset1, const char* asset2, double correlation ); /** * Allocate an iterator that can iterator over the list of asset correlation */ RQ_EXPORT rq_asset_correlation_mgr_iterator_t rq_asset_correlation_mgr_iterator_alloc(); /** * Free an allocated asset correlation iterator */ RQ_EXPORT void rq_asset_correlation_mgr_iterator_free(rq_asset_correlation_mgr_iterator_t it); /** * Initialize an iterator to the start of the list of asset correlations */ RQ_EXPORT void rq_asset_correlation_mgr_begin(rq_asset_correlation_mgr_t tree, rq_asset_correlation_mgr_iterator_t it); /** * Test whether the iterator has passed the end of the list of asset correlations */ RQ_EXPORT int rq_asset_correlation_mgr_at_end(rq_asset_correlation_mgr_iterator_t it); /** * Move to the next asset correlation in the list of asset correlations */ RQ_EXPORT void rq_asset_correlation_mgr_next(rq_asset_correlation_mgr_iterator_t i); /** * Return the asset correlation pointed to by the iterator */ RQ_EXPORT rq_asset_correlation_t rq_asset_correlation_mgr_iterator_deref(rq_asset_correlation_mgr_iterator_t i); #ifdef __cplusplus #if 0 { // purely to not screw up my indenting... #endif }; #endif #endif
// -*- C++ -*- //========================================================================== /** * @file Null_Barrier.h * * $Id: Null_Barrier.h 80826 2008-03-04 14:51:23Z wotte $ * * Moved from Synch.h. * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ //========================================================================== #ifndef ACE_NULL_BARRIER_H #define ACE_NULL_BARRIER_H #include /**/ "ace/pre.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL // All methods in this class are inline, so there is no // need to import or export on Windows. -- CAE 12/18/2003 /** * @class ACE_Null_Barrier * * @brief Implements "NULL barrier synchronization". */ class ACE_Null_Barrier { public: /// Initialize the barrier to synchronize <count> threads. ACE_Null_Barrier (unsigned int, const char * = 0, void * = 0) {}; /// Default dtor. ~ACE_Null_Barrier (void) {}; /// Block the caller until all <count> threads have called <wait> and /// then allow all the caller threads to continue in parallel. int wait (void) { return 0; }; /// Dump the state of an object. void dump (void) const {}; /// Declare the dynamic allocation hooks. //ACE_ALLOC_HOOK_DECLARE; private: // = Prevent assignment and initialization. void operator= (const ACE_Null_Barrier &); ACE_Null_Barrier (const ACE_Null_Barrier &); }; ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" #endif /* ACE_NULL_BARRIER_H */
/*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * $Id: mv.h 21933 2009-07-17 22:28:49Z gevaerts $ * * Copyright (C) 2008 by Frank Gevaerts * * 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ #ifndef __MV_H__ #define __MV_H__ #include "config.h" /* FixMe: These macros are a bit nasty and perhaps misplaced here. We'll get rid of them once decided on how to proceed with multivolume. */ /* Drives are things like a disk, a card, a flash chip. They can have volumes on them */ #ifdef HAVE_MULTIDRIVE #define IF_MD(x) x /* optional drive parameter */ #define IF_MD2(x,y) x,y /* same, for a list of arguments */ #define IF_MD_NONVOID(x) x /* for prototype with sole volume parameter */ #else /* empty definitions if no multi-drive */ #define IF_MD(x) #define IF_MD2(x,y) #define IF_MD_NONVOID(x) void #endif /* Volumes mean things that have filesystems on them, like partitions */ #ifdef HAVE_MULTIVOLUME #define IF_MV(x) x /* optional volume parameter */ #define IF_MV2(x,y) x,y /* same, for a list of arguments */ #define IF_MV_NONVOID(x) x /* for prototype with sole volume parameter */ #else /* empty definitions if no multi-volume */ #define IF_MV(x) #define IF_MV2(x,y) #define IF_MV_NONVOID(x) void #endif #endif
/* * Copyright (c) 2003-2010 University of Florida * * 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. * * The GNU General Public License is included in this distribution * in the file COPYRIGHT. */ #include <stdio.h> #include <stdlib.h> #include "f77_name.h" #include "f_types.h" #ifdef HP #include <stddef.h> #endif #ifdef ALTIX #include <mpp/shmem.h> #endif #define MAX_MEM_ALLOC_PTRS 1000 f_int *malloced_pointers[MAX_MEM_ALLOC_PTRS]; int malloced_len[MAX_MEM_ALLOC_PTRS]; int n_malloced_pointers = 0; void F77_NAME(malloc_wrapper, MALLOC_WRAPPER)(f_int *nwords, f_int *element_size, f_int *sheap_flag, void *x, long long *ixmem, f_int *ierr) { size_t nbytes = (*nwords) * (*element_size); size_t nb_shmalloc; f_int *fp, *fp2; long long llvar; #ifdef HP ptrdiff_t offset; #else long long offset; #endif if (*sheap_flag) { #ifdef USE_SHMEM nb_shmalloc = (size_t) nbytes; printf("Call shmalloc with %ld\n", nb_shmalloc); fp = (f_int *) shmalloc(nb_shmalloc); printf("Pointer from shmalloc: %x\n", fp); #else printf("Error: shmalloc not implemented for this machine.\n"); *ierr = -1; return; #endif } else { nbytes = (*nwords); nbytes *= (*element_size); nbytes += 8; fp = (f_int *) malloc(nbytes); } if (!fp) { printf("(SH)MALLOC ERROR: nwords %d, element size %d\n",*nwords, *element_size); *ierr = -1; return; } llvar = (long long) fp; if (llvar/8*8 == llvar) fp2 = fp; else fp2 = fp + 1; /* Enter the memory pointer into the set of malloc'd pointers. */ if (n_malloced_pointers >= MAX_MEM_ALLOC_PTRS) { printf("Error: Limit of %d mem_alloc pointers has been exceeded.\n", MAX_MEM_ALLOC_PTRS); *ierr = -1; return; } malloced_pointers[n_malloced_pointers] = fp; malloced_len[n_malloced_pointers] = nbytes; n_malloced_pointers++; offset = ( fp2 - (f_int *) x); *ixmem = (long long) (( fp2 - (f_int *) x) / (*element_size/sizeof(f_int)) + 1); /* printf("malloc_wrapper: fp = %x %ld, address of x = %x %ld, ixmem = %ld\n",fp,fp,x,x,*ixmem); */ *ierr = 0; } void F77_NAME(free_mem_alloc, FREE_MEM_ALLOC) () { /* Frees all memory allocated by calls to mem_alloc */ int i; for (i = 0; i < n_malloced_pointers; i++) { free( malloced_pointers[i] ); } n_malloced_pointers = 0; } long long F77_NAME(c_loc64, C_LOC64)(char *base, long long *ix, f_int *size) { long long addr; addr = (long long) base + (*ix-1)*(*size); /* printf("C_LOC64: base address %x %ld, ix %ld, size %d, addr %x %ld\n", base,base,*ix,*size,addr,addr); */ return addr; } long long F77_NAME(c_loc64p, C_LOC64P)(char *base, long long *ix, f_int *size) { long long addr; addr = (long long) base + (*ix-1)*(*size); return addr; }
#pragma once #include "gfx/gl_common.h"
/* * This file is part of the coreboot project. * * Copyright (C) 2007-2009 coresystems GmbH * * 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; version 2 of the License. * * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <types.h> #include <device/device.h> #include <console/console.h> #if CONFIG_VGA_ROM_RUN #include <x86emu/x86emu.h> #endif #include <pc80/mc146818rtc.h> #include <arch/io.h> #include <arch/interrupt.h> #include "superio_hwm.h" #if CONFIG_VGA_ROM_RUN static int int15_handler(void) { #define BOOT_DISPLAY_DEFAULT 0 #define BOOT_DISPLAY_CRT (1 << 0) #define BOOT_DISPLAY_TV (1 << 1) #define BOOT_DISPLAY_EFP (1 << 2) #define BOOT_DISPLAY_LCD (1 << 3) #define BOOT_DISPLAY_CRT2 (1 << 4) #define BOOT_DISPLAY_TV2 (1 << 5) #define BOOT_DISPLAY_EFP2 (1 << 6) #define BOOT_DISPLAY_LCD2 (1 << 7) printk(BIOS_DEBUG, "%s: AX=%04x BX=%04x CX=%04x DX=%04x\n", __func__, X86_AX, X86_BX, X86_CX, X86_DX); switch (X86_AX) { case 0x5f35: /* Boot Display */ X86_AX = 0x005f; // Success X86_CL = BOOT_DISPLAY_DEFAULT; break; case 0x5f40: /* Boot Panel Type */ // M.x86.R_AX = 0x015f; // Supported but failed X86_AX = 0x005f; // Success X86_CL = 3; // Display ID break; default: /* Interrupt was not handled */ return 0; } /* Interrupt handled */ return 1; } #endif /* Audio Setup */ extern u32 * cim_verb_data; extern u32 cim_verb_data_size; static void verb_setup(void) { // Default VERB is fine on this mainboard. cim_verb_data = NULL; cim_verb_data_size = 0; } // mainboard_enable is executed as first thing after // enumerate_buses(). static void mainboard_enable(device_t dev) { #if CONFIG_VGA_ROM_RUN /* Install custom int15 handler for VGA OPROM */ mainboard_interrupt_handlers(0x15, &int15_handler); #endif verb_setup(); hwm_setup(); } struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, };
/* * MRAG_STDTestL1.h * MRAG * * Created by Diego Rossinelli on 7/16/08. * Copyright 2008 CSE Lab, ETH Zurich. All rights reserved. * */ #pragma once #include "MRAGCommon.h" #include "MRAGrid.h" namespace MRAG { template <typename Wavelets, typename Block> class MRAG_STDTestL1 //LEVEL 1: crashes, memory leaks { protected: virtual bool run() { // OVERLOAD THIS try { const int nBlocks = 20; MRAG::Grid<Wavelets, Block> * grid = new MRAG::Grid<Wavelets, Block>(nBlocks,nBlocks,1); delete grid; } catch(...) { return false; } return true; } public: static void runTests() { MRAG_STDTestL1<Wavelets, Block> test; test.run(); } }; }
#ifndef __DIRCRAWL_SOL_H__ #define __DIRCRAWL_SOL_H__ #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <sys/types.h> #include <stdlib.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <sys/queue.h> typedef enum file_type_e { FILE_TYPE_INVALID = 0, FILE_TYPE_REGULAR = 1, FILE_TYPE_DIR = 2, FILE_TYPE_OTHER = 3 } file_type_t; extern file_type_t file_type(char *path); extern char *next_file(char *dir_name, DIR *dir); #endif // __DIRCRAWL_SOL_H__
#ifndef DT_BINDINGS_MEMORY_TEGRA124_MC_H #define DT_BINDINGS_MEMORY_TEGRA124_MC_H #define TEGRA_SWGROUP_INVALID 0xff /* 0x238 */ #define TEGRA_SWGROUP_AFI 0 /* 0x238 */ #define TEGRA_SWGROUP_AVPC 1 /* 0x23c */ #define TEGRA_SWGROUP_DC 2 /* 0x240 */ #define TEGRA_SWGROUP_DCB 3 /* 0x244 */ #define TEGRA_SWGROUP_EPP 4 /* 0x248 */ #define TEGRA_SWGROUP_G2 5 /* 0x24c */ #define TEGRA_SWGROUP_HC 6 /* 0x250 */ #define TEGRA_SWGROUP_HDA 7 /* 0x254 */ #define TEGRA_SWGROUP_ISP 8 /* 0x258 */ #define TEGRA_SWGROUP_ISP2 8 #define TEGRA_SWGROUP_DC14 9 /* 0x490 */ /* Exceptional non-linear */ #define TEGRA_SWGROUP_DC12 10 /* 0xa88 */ /* Exceptional non-linear */ #define TEGRA_SWGROUP_MPE 11 /* 0x264 */ #define TEGRA_SWGROUP_MSENC 11 #define TEGRA_SWGROUP_NVENC 11 #define TEGRA_SWGROUP_NV 12 /* 0x268 */ #define TEGRA_SWGROUP_NV2 13 /* 0x26c */ #define TEGRA_SWGROUP_PPCS 14 /* 0x270 */ #define TEGRA_SWGROUP_SATA2 15 /* 0x274 */ #define TEGRA_SWGROUP_SATA 16 /* 0x278 */ #define TEGRA_SWGROUP_VDE 17 /* 0x27c */ #define TEGRA_SWGROUP_VI 18 /* 0x280 */ #define TEGRA_SWGROUP_VII2C 18 /* 0x280 */ #define TEGRA_SWGROUP_VIC 19 /* 0x284 */ #define TEGRA_SWGROUP_XUSB_HOST 20 /* 0x288 */ #define TEGRA_SWGROUP_XUSB_DEV 21 /* 0x28c */ #define TEGRA_SWGROUP_A9AVP 22 /* 0x290 */ #define TEGRA_SWGROUP_TSEC 23 /* 0x294 */ #define TEGRA_SWGROUP_PPCS1 24 /* 0x298 */ #define TEGRA_SWGROUP_SDMMC1A 25 /* 0xa94 */ /* Linear shift again */ #define TEGRA_SWGROUP_SDMMC2A 26 /* 0xa98 */ #define TEGRA_SWGROUP_SDMMC3A 27 /* 0xa9c */ #define TEGRA_SWGROUP_SDMMC4A 28 /* 0xaa0 */ #define TEGRA_SWGROUP_ISP2B 29 /* 0xaa4 */ #define TEGRA_SWGROUP_GPU 30 /* 0xaa8, DO NOT USE THIS */ #define TEGRA_SWGROUP_GPUB 31 /* 0xaac */ #define TEGRA_SWGROUP_PPCS2 32 /* 0xab0 */ #define TEGRA_SWGROUP_NVDEC 33 /* 0xab4 */ #define TEGRA_SWGROUP_APE 34 /* 0xab8 */ #define TEGRA_SWGROUP_SE 35 /* 0xabc */ #define TEGRA_SWGROUP_NVJPG 36 /* 0xac0 */ #define TEGRA_SWGROUP_HC1 37 /* 0xac4 */ #define TEGRA_SWGROUP_SE1 38 /* 0xac8 */ #define TEGRA_SWGROUP_AXIAP 39 /* 0xacc */ #define TEGRA_SWGROUP_ETR 40 /* 0xad0 */ #define TEGRA_SWGROUP_TSECB 41 /* 0xad4 */ #define TEGRA_SWGROUP_TSEC1 42 /* 0xad8 */ #define TEGRA_SWGROUP_TSECB1 43 /* 0xadc */ #define TEGRA_SWGROUP_NVDEC1 44 /* 0xae0 */ /* Reserved 45 */ #define TEGRA_SWGROUP_AXIS 46 /* 0xae8 */ #define TEGRA_SWGROUP_EQOS 47 /* 0xaec */ #define TEGRA_SWGROUP_UFSHC 48 /* 0xaf0 */ #define TEGRA_SWGROUP_NVDISPLAY 49 /* 0xaf4 */ #define TEGRA_SWGROUP_BPMP 50 /* 0xaf8 */ #define TEGRA_SWGROUP_AON 51 /* 0xafc */ /* Reserved 50 */ #define TWO_U32_OF_U64(x) ((x) & 0xffffffff) ((x) >> 32) #define TEGRA_SWGROUP_BIT(x) (1ULL << TEGRA_SWGROUP_##x) #define TEGRA_SWGROUP_CELLS(x) TWO_U32_OF_U64(TEGRA_SWGROUP_BIT(x)) #define TEGRA_SWGROUP_CELLS2(x1, x2) \ TWO_U32_OF_U64( TEGRA_SWGROUP_BIT(x1) | \ TEGRA_SWGROUP_BIT(x2)) #define TEGRA_SWGROUP_CELLS3(x1, x2, x3) \ TWO_U32_OF_U64( TEGRA_SWGROUP_BIT(x1) | \ TEGRA_SWGROUP_BIT(x2) | \ TEGRA_SWGROUP_BIT(x3)) #define TEGRA_SWGROUP_CELLS4(x1, x2, x3, x4) \ TWO_U32_OF_U64( TEGRA_SWGROUP_BIT(x1) | \ TEGRA_SWGROUP_BIT(x2) | \ TEGRA_SWGROUP_BIT(x3) | \ TEGRA_SWGROUP_BIT(x4)) #define TEGRA_SWGROUP_CELLS5(x1, x2, x3, x4, x5) \ TWO_U32_OF_U64( TEGRA_SWGROUP_BIT(x1) | \ TEGRA_SWGROUP_BIT(x2) | \ TEGRA_SWGROUP_BIT(x3) | \ TEGRA_SWGROUP_BIT(x4) | \ TEGRA_SWGROUP_BIT(x5)) #define TEGRA_SWGROUP_CELLS9(x1, x2, x3, x4, x5, x6, x7, x8, x9) \ TWO_U32_OF_U64( TEGRA_SWGROUP_BIT(x1) | \ TEGRA_SWGROUP_BIT(x2) | \ TEGRA_SWGROUP_BIT(x3) | \ TEGRA_SWGROUP_BIT(x4) | \ TEGRA_SWGROUP_BIT(x5) | \ TEGRA_SWGROUP_BIT(x6) | \ TEGRA_SWGROUP_BIT(x7) | \ TEGRA_SWGROUP_BIT(x8) | \ TEGRA_SWGROUP_BIT(x9)) #define TEGRA_SWGROUP_CELLS12(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12) \ TWO_U32_OF_U64( TEGRA_SWGROUP_BIT(x1) | \ TEGRA_SWGROUP_BIT(x2) | \ TEGRA_SWGROUP_BIT(x3) | \ TEGRA_SWGROUP_BIT(x4) | \ TEGRA_SWGROUP_BIT(x5) | \ TEGRA_SWGROUP_BIT(x6) | \ TEGRA_SWGROUP_BIT(x7) | \ TEGRA_SWGROUP_BIT(x8) | \ TEGRA_SWGROUP_BIT(x9) | \ TEGRA_SWGROUP_BIT(x10)| \ TEGRA_SWGROUP_BIT(x11)| \ TEGRA_SWGROUP_BIT(x12)) #define TEGRA_SWGROUP_MAX 64 #define SWGIDS_ERROR_CODE (~0ULL) #define swgids_is_error(x) ((x) == SWGIDS_ERROR_CODE) #endif
#ifndef GAMMA_SYNC_H_INC #define GAMMA_SYNC_H_INC /* Gamma - Generic processing library See COPYRIGHT file for authors and license information */ #include "Gamma/Node.h" namespace gam{ class Sync; /// Normalized unit synchronization observer class Synced1{ public: virtual ~Synced1(){} double spu() const { return 1.; } ///< Returns local samples/unit double ups() const { return 1.; } ///< Returns local units/sample const Sync * sync() const { return subjectSingleton(); } ///< Returns reference to my subject /// Notification that subject's samples/unit has changed. /// Any instance state that depends on the samples/unit ratio should be /// updated here. The ratio of the new to the old samples/unit is passed in. virtual void onResync(double ratioSPU){} void spu(double val){} ///< Set local samples/unit void ups(double val){} ///< Set local units/sample protected: void initSynced(){ onResync(1); } static Sync * subjectSingleton(); }; /// Unit synchronization observer /// A Synced will attempt to copy its local variables from the master Sync /// upon construction. If the master Sync has not been constructed, it will /// use its default values of 1. /// This class has a reference to a Sync and its own local scaling factors. /// By default, the reference Sync is Sync::master. class Synced : public Node2<Synced> { public: Synced(); /// Copy constructor /// If the argument has a subject, then attach this as an observer to the /// same subject. Otherwise, attach as observer of Sync::master(). Synced(const Synced& rhs); virtual ~Synced(){} double scaleSPU() const; ///< Returns ratio of my SPU to my Sync's SPU double spu() const; ///< Returns local samples/unit double ups() const; ///< Returns local units/sample const Sync * sync() const; ///< Returns reference to my Sync /// Called by my Sync reference after it changes its value /// Any instance state that depends on the sampling length should be /// updated here. virtual void onResync(double ratioSPU){} void scaleSPU(double v); ///< Scales samples/unit by factor void scaleUPS(double v); ///< Scales units/sample by factor void spu(double v); ///< Set local samples/unit void sync(Sync& src); ///< Set absolute Sync source void ups(double v); ///< Set local units/sample Synced& operator= (const Synced& rhs); protected: void initSynced(); ///< To be called from the constructor(s) of derived classes private: friend class Sync; Synced(bool zeroLinks, Sync& src); Sync * mSubject; // My subject double mSPU; // Local samples/unit double mUPS; // Local units/sample }; /// Unit synchronization subject class Sync{ public: Sync(); /// \param[in] spu samples/unit Sync(double spu); ~Sync(); Sync& operator<< (Synced& obs); ///< Attach observer void notifyObservers(double r); ///< Notify observers (\see Synced::onResync) void spu(double v); ///< Set samples/unit and notify observers void ups(double v); ///< Set units/sample and notify observers bool hasBeenSet() const; ///< Returns true if spu has been set at least once double spu() const; ///< Returns samples/unit, i.e. sample rate double ups() const; ///< Returns units/sample, i.e. sample interval /// Master sync. By default, Synceds will be synced to this. static Sync& master(){ static Sync * s = new Sync; return *s; } protected: double mSPU, mUPS; Synced mHeadObserver; // Head of observer doubly-linked list bool mHasBeenSet; friend class Synced; void addObserver(Synced& obs); }; // Implementation_______________________________________________________________ inline Sync * Synced1::subjectSingleton(){ static Sync * s = new Sync(1.); return s; } #define SYNCED_INIT mSubject(0), mSPU(1), mUPS(1) inline Synced::Synced() : Node2<Synced>(), SYNCED_INIT { //printf("Synced::Synced() - %p\n", this); sync(Sync::master()); } // This ctor is used to create the head Synced in a Sync inline Synced::Synced(bool zeroLinks, Sync& src) : Node2<Synced>(zeroLinks), SYNCED_INIT { sync(src); } inline Synced::Synced(const Synced& rhs) : Node2<Synced>(), SYNCED_INIT { //printf("Synced::Synced(const Synced&) - %p\n", this); Sync& s = rhs.mSubject ? *rhs.mSubject : Sync::master(); sync(s); } #undef SYNCED_INIT inline void Synced::initSynced(){ if(sync()) spu(sync()->spu()); } inline double Synced::scaleSPU() const { return sync() ? spu() / sync()->spu() : 1; } inline void Synced::spu(double v){ scaleSPU(v * ups()); } inline void Synced::ups(double v){ scaleUPS(v * spu()); } inline double Synced::spu() const { return mSPU; } inline double Synced::ups() const { return mUPS; } inline const Sync * Synced::sync() const { return mSubject; } inline bool Sync::hasBeenSet() const { return mHasBeenSet; } inline double Sync::spu() const { return mSPU; } inline double Sync::ups() const { return mUPS; } } // gam:: #endif
#include "cantera/base/logger.h" #include <string> #include <fstream> class fileLog: public Cantera::Logger { public: fileLog(std::string fName) { m_fName = fName; m_fs.open(fName.c_str()); } virtual void write(const std::string& msg) { m_fs << msg << std::endl; } virtual ~fileLog() { m_fs.close(); } std::string m_fName; std::fstream m_fs; };
/* * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) * From ASN.1 module "PKIXTSP" * found in "lpa2.asn1" * `asn1c -S/skeletons` */ #ifndef _TimeStampToken_H_ #define _TimeStampToken_H_ #include <asn_application.h> /* Including external dependencies */ #include "ContentInfo.h" #ifdef __cplusplus extern "C" { #endif /* TimeStampToken */ typedef ContentInfo_t TimeStampToken_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_TimeStampToken; asn_struct_free_f TimeStampToken_free; asn_struct_print_f TimeStampToken_print; asn_constr_check_f TimeStampToken_constraint; ber_type_decoder_f TimeStampToken_decode_ber; der_type_encoder_f TimeStampToken_encode_der; xer_type_decoder_f TimeStampToken_decode_xer; xer_type_encoder_f TimeStampToken_encode_xer; #ifdef __cplusplus } #endif #endif /* _TimeStampToken_H_ */
#include <linux/module.h> #include <linux/preempt.h> #include <linux/smp.h> #include <asm/msr.h> static void __rdmsr_on_cpu(void *info) { struct msr_info *rv = info; struct msr *reg; int this_cpu = raw_smp_processor_id(); if (rv->msrs) reg = per_cpu_ptr(rv->msrs, this_cpu); else reg = &rv->reg; rdmsr(rv->msr_no, reg->l, reg->h); } static void __wrmsr_on_cpu(void *info) { struct msr_info *rv = info; struct msr *reg; int this_cpu = raw_smp_processor_id(); if (rv->msrs) reg = per_cpu_ptr(rv->msrs, this_cpu); else reg = &rv->reg; wrmsr(rv->msr_no, reg->l, reg->h); } int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) { int err; struct msr_info rv; memset(&rv, 0, sizeof(rv)); rv.msr_no = msr_no; err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1); *l = rv.reg.l; *h = rv.reg.h; return err; } EXPORT_SYMBOL(rdmsr_on_cpu); int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) { int err; struct msr_info rv; memset(&rv, 0, sizeof(rv)); rv.msr_no = msr_no; rv.reg.l = l; rv.reg.h = h; err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1); return err; } EXPORT_SYMBOL(wrmsr_on_cpu); static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs, void (*msr_func) (void *info)) { struct msr_info rv; int this_cpu; memset(&rv, 0, sizeof(rv)); rv.msrs = msrs; rv.msr_no = msr_no; this_cpu = get_cpu(); if (cpumask_test_cpu(this_cpu, mask)) msr_func(&rv); smp_call_function_many(mask, msr_func, &rv, 1); put_cpu(); } void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs) { __rwmsr_on_cpus(mask, msr_no, msrs, __rdmsr_on_cpu); } EXPORT_SYMBOL(rdmsr_on_cpus); void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs) { __rwmsr_on_cpus(mask, msr_no, msrs, __wrmsr_on_cpu); } EXPORT_SYMBOL(wrmsr_on_cpus); static void __rdmsr_safe_on_cpu(void *info) { struct msr_info *rv = info; rv->err = rdmsr_safe(rv->msr_no, &rv->reg.l, &rv->reg.h); } static void __wrmsr_safe_on_cpu(void *info) { struct msr_info *rv = info; rv->err = wrmsr_safe(rv->msr_no, rv->reg.l, rv->reg.h); } int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) { int err; struct msr_info rv; memset(&rv, 0, sizeof(rv)); rv.msr_no = msr_no; err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1); *l = rv.reg.l; *h = rv.reg.h; return err ? err : rv.err; } EXPORT_SYMBOL(rdmsr_safe_on_cpu); int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) { int err; struct msr_info rv; memset(&rv, 0, sizeof(rv)); rv.msr_no = msr_no; rv.reg.l = l; rv.reg.h = h; err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1); return err ? err : rv.err; } EXPORT_SYMBOL(wrmsr_safe_on_cpu); static void __rdmsr_safe_regs_on_cpu(void *info) { struct msr_regs_info *rv = info; rv->err = rdmsr_safe_regs(rv->regs); } static void __wrmsr_safe_regs_on_cpu(void *info) { struct msr_regs_info *rv = info; rv->err = wrmsr_safe_regs(rv->regs); } int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs) { int err; struct msr_regs_info rv; rv.regs = regs; rv.err = -EIO; err = smp_call_function_single(cpu, __rdmsr_safe_regs_on_cpu, &rv, 1); return err ? err : rv.err; } EXPORT_SYMBOL(rdmsr_safe_regs_on_cpu); int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs) { int err; struct msr_regs_info rv; rv.regs = regs; rv.err = -EIO; err = smp_call_function_single(cpu, __wrmsr_safe_regs_on_cpu, &rv, 1); return err ? err : rv.err; } EXPORT_SYMBOL(wrmsr_safe_regs_on_cpu);
/* * Berkeley Lab Checkpoint/Restart (BLCR) for Linux is Copyright (c) * 2003, The Regents of the University of California, through Lawrence * Berkeley National Laboratory (subject to receipt of any required * approvals from the U.S. Dept. of Energy). All rights reserved. * * Portions may be copyrighted by others, as may be noted in specific * copyright notices within specific files. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: cr_trace.h,v 1.15 2008/02/13 22:41:59 phargrov Exp $ */ #ifndef _CR_TRACE_H #define _CR_TRACE_H 1 #include <stdlib.h> // for abort() #include <signal.h> // for signal() #include <unistd.h> // for _exit() extern void libcr_trace_init(void); extern void libcr_trace(const char *filename, int line, const char *function, const char * format, ...) __attribute__ ((format (printf, 4, 5))); #if LIBCR_TRACING || !defined(LIBCR_SIGNAL_ONLY) #define __cri_abort libcr_trace #else #include <stdio.h> #define __cri_abort(__FILE__, __LINE__, __FUNCTION__, args...) \ fprintf(stderr, args) #endif #define CRI_ABORT(args...) \ do { \ __cri_abort(__FILE__, __LINE__, __FUNCTION__, args); \ signal(SIGABRT, SIG_DFL); \ abort(); \ _exit(42); \ } while(0); #if LIBCR_TRACING extern unsigned int libcr_trace_mask; #define LIBCR_TRACE_NONE 0 #define LIBCR_TRACE_ALL (~0) #define LIBCR_TRACE_INFO 0x00000001 #define LIBCR_TRACE(trace, args...) \ do { \ if (libcr_trace_mask & (trace)) { \ libcr_trace(__FILE__, __LINE__, __FUNCTION__, args); \ } \ } while (0) #define LIBCR_TRACE_INIT() libcr_trace_init() #else /* If not tracing then just eat the args */ #define LIBCR_TRACE(args...) do {} while (0) #define LIBCR_TRACE_INIT() do {} while (0) #endif #endif
// Copyright (c) Charles J. Cliffe // SPDX-License-Identifier: GPL-2.0+ #pragma once #include "GLPanel.h" class SpectrumPanel : public GLPanel { public: SpectrumPanel(); void setPoints(std::vector<float> &points); void setPeakPoints(std::vector<float> &points); float getFloorValue(); void setFloorValue(float floorValue); float getCeilValue(); void setCeilValue(float ceilValue); void setFreq(long long freq); long long getFreq(); void setBandwidth(long long bandwidth); long long getBandwidth(); void setFFTSize(int fftSize_in); int getFFTSize(); void setShowDb(bool showDb); bool getShowDb(); void setUseDBOffset(bool useOfs); bool getUseDBOffset(); protected: void drawPanelContents(); private: float floorValue, ceilValue; int fftSize; long long freq; long long bandwidth; std::vector<float> points; std::vector<float> peak_points; GLTextPanel dbPanelCeil; GLTextPanel dbPanelFloor; bool showDb, useDbOfs; };
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2008 Ralf Baechle (ralf@linux-mips.org) * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. * Copyright 2012 Tony Wu (tonywu@realtek.com) */ #include <linux/bitmap.h> #include <linux/init.h> #include <linux/smp.h> #include <linux/irq.h> #include <linux/hardirq.h> #include <asm/io.h> #include <asm/mmcr.h> #include <asm/gic.h> #include <asm-generic/bitops/find.h> unsigned int gic_frequency; unsigned int gic_present; unsigned long _gic_base; unsigned int gic_irq_base; unsigned int gic_irq_flags[GIC_NUM_INTRS]; static unsigned int girq_base; static unsigned int girq_flag[GIC_NUM_INTRS]; static struct gic_pcpu_mask pcpu_masks[NR_CPUS]; static struct gic_pending_regs pending_regs[NR_CPUS]; static struct gic_intrmask_regs intrmask_regs[NR_CPUS]; void gic_send_ipi(unsigned int intr) { pr_debug("CPU%d: %s status %08x\n", smp_processor_id(), __func__, read_c0_status()); GIC_SET_IPI_MASK(intr); } static void __init gic_setup_local(unsigned int numcore, unsigned int flag, unsigned int intr) { int i; flag &= GIC_FLAG_LOCAL_MASK; /* Setup the timer interrupts for all cores */ for (i = 0; i < numcore; i++) { switch (flag) { case GIC_FLAG_TIMER: GIC_REG32p(SITIMER_R2P, i*4) = intr; break; } } } /* Get GIC pending intr number */ unsigned int gic_get_int(void) { unsigned int i; unsigned long *pending, *intrmask, *pcpumask; /* Get per-cpu bitmaps */ pending = pending_regs[smp_processor_id()].pending; intrmask = intrmask_regs[smp_processor_id()].intrmask; pcpumask = pcpu_masks[smp_processor_id()].pcpu_mask; for (i = 0; i < BITS_TO_LONGS(GIC_NUM_INTRS); i++) { pending[i] = GIC_REG32p(PEND, i*4); intrmask[i] = GIC_REG32p(MASK, i*4); } bitmap_and(pending, pending, intrmask, GIC_NUM_INTRS); bitmap_and(pending, pending, pcpumask, GIC_NUM_INTRS); /* Find first set bit */ i = find_first_bit(pending, GIC_NUM_INTRS); if (i == GIC_NUM_INTRS) return -1; pr_debug("CPU%d: %s pend=%d\n", smp_processor_id(), __func__, i); return i; } static void gic_irq_ack(struct irq_data *d) { unsigned int intr = d->irq - girq_base; pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, intr); GIC_CLR_INTR_MASK(intr); /* if it's IPI, clear IPI mask */ if (girq_flag[intr] & GIC_FLAG_IPI) GIC_CLR_IPI_MASK(intr); } static void gic_mask_irq(struct irq_data *d) { GIC_CLR_INTR_MASK(d->irq - gic_irq_base); } static void gic_unmask_irq(struct irq_data *d) { GIC_SET_INTR_MASK(d->irq - gic_irq_base); } #ifdef CONFIG_SMP static DEFINE_SPINLOCK(gic_lock); static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask, bool force) { unsigned int irq = d->irq - girq_base; cpumask_t tmp = CPU_MASK_NONE; unsigned long flags; int i; cpumask_and(&tmp, cpumask, cpu_online_mask); if (cpus_empty(tmp)) return -1; /* Assumption : cpumask refers to a single CPU */ spin_lock_irqsave(&gic_lock, flags); for (;;) { /* Re-route this IRQ */ GIC_ROUTE_TO_CORE(irq, 1 << first_cpu(tmp)); /* Update the pcpu_masks */ for (i = 0; i < NR_CPUS; i++) clear_bit(irq, pcpu_masks[i].pcpu_mask); set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask); } cpumask_copy(d->affinity, cpumask); spin_unlock_irqrestore(&gic_lock, flags); return IRQ_SET_MASK_OK_NOCOPY; } #endif static struct irq_chip gic_irq_controller = { .name = "RLX GIC", .irq_ack = gic_irq_ack, .irq_mask = gic_mask_irq, .irq_mask_ack = gic_mask_irq, .irq_unmask = gic_unmask_irq, .irq_eoi = gic_finish_irq, #ifdef CONFIG_SMP .irq_set_affinity = gic_set_affinity, #endif }; static void __init gic_setup_intr(unsigned int intr, unsigned int cpu, unsigned int pin, unsigned int flags) { /* Setup Intr to PIN mapping */ GIC_ROUTE_TO_PIN(intr, pin); /* Setup Intr to CPU mapping */ GIC_ROUTE_TO_CORE(intr, cpu); /* Init Intr Masks */ GIC_CLR_INTR_MASK(intr); /* Initialise per-cpu Interrupt software masks */ if (flags & GIC_FLAG_IPI) { GIC_CLR_IPI_MASK(intr); set_bit(intr, pcpu_masks[cpu].pcpu_mask); } girq_flag[intr] = flags; } /* * Setup IPI interrupts * * IPI resched interrupts are appeneded to gic_intr_map starting at * GIC_NUM_INTRS - NR_CPUS * 2 * * IPI call interrupts are appened to gic_intr_map starting at * GIC_NUM_INTRS - NR_CPUS * * i.e. * * cpu0 resched GIC_NUM_INTRS - NR_CPUS * 2 * cpu1 resched * cpu2 resched * cpu3 resched * cpu0 call GIC_NUM_INTRS - NR_CPUS * cpu1 call * cpu2 call * cpu3 call */ void __init gic_setup_ipi(unsigned int *ipimap, unsigned int resched, unsigned int call) { int cpu; for (cpu = 0; cpu < NR_CPUS; cpu++) { gic_setup_intr(GIC_IPI_RESCHED(cpu), cpu, resched, GIC_FLAG_IPI); gic_setup_intr(GIC_IPI_CALL(cpu), cpu, call, GIC_FLAG_IPI); ipimap[cpu] |= (1 << (resched + 2)); ipimap[cpu] |= (1 << (call + 2)); } } void __init gic_init(struct gic_intr_map *intrmap, unsigned int irqbase) { unsigned int i, cpu; int numcore, numintr; girq_base = irqbase; numcore = MMCR_VAL32(CORE, NUMCORES); numintr = MMCR_VAL32(CORE, NUMINTS); /* Setup defaults */ for (i = 0; i < numintr; i++) { GIC_CLR_INTR_MASK(i); if (i < GIC_NUM_INTRS) girq_flag[i] = 0; } /* Setup specifics */ for (i = 0; i < GIC_NUM_INTRS; i++) { cpu = intrmap[i].cpunum; if (intrmap[i].flags & GIC_FLAG_LOCAL_MASK) { gic_setup_local(numcore, intrmap[i].flags, intrmap[i].pin); continue; } irq_set_chip(girq_base + i, &gic_irq_controller); if (cpu == GIC_UNUSED) continue; if (cpu == 0 && i != 0 && intrmap[i].flags == 0) continue; gic_setup_intr(i, intrmap[i].cpunum, intrmap[i].pin, intrmap[i].flags); irq_set_handler(girq_base + i, handle_level_irq); } #ifdef CONFIG_SMP /* * In case of SMP, interrupts are routed via GIC, * unmask all interrupts by default, and let GIC * do the routing */ change_c0_status(ST0_IM, 0xff00); change_lxc0_estatus(EST0_IM, 0xff0000); #endif }
//----------------------------------------------------------------------------------- // // Bitfighter - A multiplayer vector graphics space game // Based on Zap demo released for Torque Network Library by GarageGames.com // // Derivative work copyright (C) 2008-2009 Chris Eykamp // Original work copyright (C) 2004 GarageGames.com, Inc. // Other code copyright as noted // // 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 (and fun!), // 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 // //------------------------------------------------------------------------------------ #ifndef _LUAUTIL_H_ #define _LUAUTIL_H_ #include "luaObject.h" #include "tnlRandom.h" using namespace std; namespace Zap { // Some util functions for scripts and levelgen files class LuaUtil: public LuaObject { public: void logError(const char *format, ...); LuaUtil(lua_State *L); // Lua constructor static const char className[]; static Lunar<LuaUtil>::RegType methods[]; // Lua methods S32 logprint(lua_State *L); S32 getMachineTime(lua_State *L) { return returnInt(L, Platform::getRealMilliseconds()); } S32 getRandomNumber(lua_State *L); }; }; #endif
//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by GSdx.rc // #define IDC_PALTEX 2001 #define IDC_LOGZ 2002 #define IDC_CODECS 2003 #define IDC_RESOLUTION 2004 #define IDC_RESX_EDIT 2005 #define IDC_RESY_EDIT 2006 #define IDC_AA1 2007 #define IDC_SWTHREADS_TEXT 2008 #define IDC_SWTHREADS 2009 #define IDC_SWTHREADS_EDIT 2010 #define IDC_FILTER_TEXT 2011 #define IDC_FILTER 2012 #define IDC_DITHERING 2013 #define IDC_RESX 2014 #define IDC_RESY 2015 #define IDD_CONFIG 2016 #define IDB_LOGO9 2017 #define IDB_LOGO10 2018 #define IDB_LOGO11 2019 #define IDB_LOGOGL 2020 #define IDB_NULL 2021 #define IDB_PSX_LOGO9 2022 #define IDB_PSX_LOGO11 2023 #define IDB_PSX_NULL 2024 #define IDC_FBA 2025 #define IDC_LOGO9 2026 #define IDC_LOGO10 2027 #define IDC_LOGO11 2028 #define IDC_LOGOGL 2029 #define IDC_NULL 2030 #define IDC_PSX_LOGO9 2031 #define IDC_PSX_LOGO11 2032 #define IDC_PSX_NULL 2033 #define IDD_CAPTURE 2034 #define IDD_GPUCONFIG 2035 #define IDC_RENDERER 2036 #define IDC_INTERLACE 2037 #define IDC_ASPECTRATIO 2038 #define IDC_ALPHAHACK 2039 #define IDC_SCALE 2040 #define IDC_UPSCALE_MULTIPLIER 2041 #define IDC_BROWSE 2042 #define IDC_OFFSETHACK 2043 #define IDC_FILENAME 2044 #define IDC_SKIPDRAWHACK 2045 #define IDC_WIDTH 2046 #define IDC_HEIGHT 2047 #define IDC_CONFIGURE 2048 #define IDC_ACCURATE_BLEND_UNIT_TEXT 2049 #define IDC_WINDOWED 2050 #define IDC_SKIPDRAWHACKEDIT 2051 #define IDC_SPRITEHACK 2052 #define IDC_SPRITEHACK_TEXT 2053 #define IDC_SATURATION_SLIDER 2054 #define IDC_BRIGHTNESS_SLIDER 2055 #define IDC_CONTRAST_SLIDER 2056 #define IDC_SHADEBUTTON 2057 #define IDC_SHADEBOOST 2058 #define IDC_HACKS_ENABLED 2059 #define IDC_SATURATION_TEXT 2060 #define IDC_BRIGHTNESS_TEXT 2061 #define IDC_CONTRAST_TEXT 2062 #define IDC_MSAACB 2063 #define IDC_MSAA_TEXT 2064 #define IDC_HACKSBUTTON 2065 #define IDC_WILDHACK 2066 #define IDC_CHECK_DISABLE_ALL_HACKS 2067 #define IDC_ALPHASTENCIL 2068 #define IDC_ADAPTER 2069 #define IDC_TCOFFSETX 2070 #define IDC_TCOFFSETX2 2071 #define IDC_TCOFFSETY 2072 #define IDC_TCOFFSETY2 2073 #define IDC_FXAA 2074 #define IDC_SHADER_FX 2075 #define IDC_AFCOMBO_TEXT 2076 #define IDC_AFCOMBO 2077 #define IDC_OPENCL_DEVICE 2078 #define IDC_OPENCL_TEXT 2079 #define IDC_ACCURATE_BLEND_UNIT 2080 #define IDC_ACCURATE_DATE 2081 #define IDC_ROUND_SPRITE 2082 #define IDC_ROUND_SPRITE_TEXT 2083 #define IDC_ALIGN_SPRITE 2084 #define IDC_CRC_LEVEL 2085 #define IDC_CRC_LEVEL_TEXT 2086 #define IDC_TC_DEPTH 2087 #define IDC_COLORSPACE 2088 #define IDC_SHADER_FX_EDIT 2089 #define IDC_SHADER_FX_CONF_EDIT 2090 #define IDC_SHADER_FX_BUTTON 2091 #define IDC_SHADER_FX_CONF_BUTTON 2092 #define IDC_SHADER_FX_TEXT 2093 #define IDC_SHADER_FX_CONF_TEXT 2094 #define IDC_CUSTOM_TEXT 2095 #define IDC_UPSCALE_MULTIPLIER_TEXT 2096 #define IDC_MIPMAP 2097 #define IDC_PRELOAD_GS 2098 #define IDC_TVSHADER 2099 #define IDC_SAFE_FBMASK 2100 #define IDC_FAST_TC_INV 2101 #define IDR_CONVERT_FX 10000 #define IDR_TFX_FX 10001 #define IDR_MERGE_FX 10002 #define IDR_INTERLACE_FX 10003 #define IDR_FXAA_FX 10004 #define IDR_CS_FX 10005 #define IDD_SHADER 10006 #define IDR_SHADEBOOST_FX 10007 #define IDR_TFX_CL 10008 #define IDD_HACKS 10009 #define IDC_STATIC -1 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 10013 #define _APS_NEXT_COMMAND_VALUE 32771 #define _APS_NEXT_CONTROL_VALUE 2102 #define _APS_NEXT_SYMED_VALUE 5000 #endif #endif
#ifndef _UMLATTRIBUTE_H #define _UMLATTRIBUTE_H #include "UmlBaseAttribute.h" #include <q3cstring.h> // This class manages 'attribute', notes that the class 'UmlClassItem' // is a mother class of the class's children. // // You can modify it as you want (except the constructor) class UmlAttribute : public UmlBaseAttribute { public: UmlAttribute(void * id, const Q3CString & n) : UmlBaseAttribute(id, n) {}; bool check(); }; #endif
/* * Copyright (C) 2003 Robert Kooima - 2006 Jean Privat * * NEVERBALL 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. */ #include <string.h> #include <ctype.h> #include "gui.h" #include "util.h" #include "audio.h" #include "config.h" #include "video.h" #include "text.h" #include "back.h" #include "game_common.h" #include "game_server.h" #include "game_client.h" #include "st_name.h" #include "st_shared.h" /*---------------------------------------------------------------------------*/ static char player[MAXNAM]; /*---------------------------------------------------------------------------*/ static struct state *ok_state, *cancel_state; static unsigned int draw_back; int goto_name(struct state *ok, struct state *cancel, unsigned int back) { strncpy(player, config_get_s(CONFIG_PLAYER), sizeof (player) - 1); ok_state = ok; cancel_state = cancel; draw_back = back; return goto_state(&st_name); } /*---------------------------------------------------------------------------*/ #define NAME_OK -1 #define NAME_CANCEL -2 static int name_id; static int name_action(int i) { audio_play(AUD_MENU, 1.0f); switch (i) { case NAME_OK: if (strlen(player) == 0) return 1; config_set_s(CONFIG_PLAYER, player); return goto_state(ok_state); case NAME_CANCEL: return goto_state(cancel_state); case GUI_CL: gui_keyboard_lock(); break; case GUI_BS: if (text_del_char(player)) gui_set_label(name_id, player); break; default: if (text_add_char(i, player, sizeof (player))) gui_set_label(name_id, player); } return 1; } static int enter_id; static int name_enter(void) { int id, jd; if (draw_back) { game_client_free(); back_init("back/gui.png", config_get_d(CONFIG_GEOMETRY)); } if ((id = gui_vstack(0))) { gui_label(id, _("Player Name"), GUI_MED, GUI_ALL, 0, 0); gui_space(id); name_id = gui_label(id, " ", GUI_MED, GUI_ALL, gui_yel, gui_yel); gui_space(id); gui_keyboard(id); gui_space(id); if ((jd = gui_harray(id))) { enter_id = gui_start(jd, _("OK"), GUI_SML, NAME_OK, 0); gui_space(jd); gui_state(jd, _("Cancel"), GUI_SML, NAME_CANCEL, 0); } gui_layout(id, 0, 0); gui_set_trunc(name_id, TRUNC_HEAD); gui_set_label(name_id, player); } SDL_EnableUNICODE(1); return id; } static void name_leave(int id) { if (draw_back) back_free(); SDL_EnableUNICODE(0); gui_delete(id); } static void name_paint(int id, float t) { if (draw_back) { video_push_persp((float) config_get_d(CONFIG_VIEW_FOV), 0.1f, FAR_DIST); { back_draw(0); } video_pop_matrix(); } else game_draw(0, t); gui_paint(id); } static int name_keybd(int c, int d) { if (d) { gui_focus(enter_id); if (c == '\b' || c == 0x7F) return name_action(GUI_BS); if (c >= ' ') return name_action(c); } return 1; } static int name_buttn(int b, int d) { if (d) { if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b)) { int c = gui_token(gui_click()); if (c >= 0 && !GUI_ISMSK(c)) return name_action(gui_keyboard_char(c)); else return name_action(c); } if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b)) name_action(NAME_CANCEL); } return 1; } /*---------------------------------------------------------------------------*/ struct state st_name = { name_enter, name_leave, name_paint, shared_timer, shared_point, shared_stick, shared_angle, shared_click, name_keybd, name_buttn, 1, 0 };
/* * $Id: c_agcurv.c,v 1.5 2008-07-23 16:16:40 haley Exp $ */ /************************************************************************ * * * Copyright (C) 2000 * * University Corporation for Atmospheric Research * * All Rights Reserved * * * * The use of this Software is governed by a License Agreement. * * * ************************************************************************/ #include <ncarg/ncargC.h> extern void NGCALLF(agcurv,AGCURV)(float*,int*,float*,int*,int*,int*); void c_agcurv #ifdef NeedFuncProto ( float *xvec, int iiex, float *yvec, int iiey, int nexy, int kdsh ) #else (xvec,iiex,yvec,iiey,nexy,kdsh) float *xvec; int iiex; float *yvec; int iiey; int nexy; int kdsh; #endif { NGCALLF(agcurv,AGCURV)(xvec,&iiex,yvec,&iiey,&nexy,&kdsh); }
/***************************************************************************** Kodovani: UTF-8 Soubor: scanner_define.h Projekt: IFJ06 Datum: 17.12.2006 Autori: Lukas Marsik, xmarsi03@stud.fit.vutbr.cz Libor Polcak, xpolca03@stud.fit.vutbr.cz Boris Prochazka, xproch63@stud.fit.vutbr.cz Martin Tomec, xtomec05@stud.fit.vutbr.cz Petr Zemek, xzemek02@stud.fit.vutbr.cz Popis: Stavy scanneru (FSM) + ostatni potrebne definice ******************************************************************************/ #ifndef _SCANNER_DEFINE_H_ #define _SCANNER_DEFINE_H_ /* Urcuje, po jakych blocich se bude alokovat misto pro lexem */ #define BLOCK_INCREMENT 16 /* Znaky tvorici retezcovy literal jsou vetsi nez ASCIINUM */ #define ASCIINUM 31 /* Stavy FSM */ typedef enum { FSM_S, FSM_F_COMMA, FSM_F_SEMICOLON, FSM_F_LABEL, FSM_F_ASSIGNMENT, FSM_F_POWER, FSM_F_PLUS, FSM_F_MINUS, FSM_F_MULTIPLE, FSM_F_DIVDOUBLE, FSM_COMMENT, FSM_F_LESS, FSM_F_LESSEQUAL, FSM_F_GREATER, FSM_F_GREATEREQUAL, FSM_Q_EQUAL, FSM_F_EQUAL, FSM_Q_NOTEQUAL, FSM_F_NOTEQUAL, FSM_F_LBRACKET, FSM_F_RBRACKET, FSM_F_LVINCULUM, FSM_F_RVINCULUM, FSM_Q1_STRING, FSM_Q2_STRING, FSM_F_STRING, FSM_F_CONSTINT, FSM_F1_CONSTDOUBLE, FSM_F2_CONSTDOUBLE, FSM_Q1_CONSTDOUBLE, FSM_Q2_CONSTDOUBLE, FSM_F3_CONSTDOUBLE, FSM_F_IDENTIFIERORKEYWORD, /* rozsireni o blokove komentare. */ FSM_Q_EXTENSION_IN, FSM_Q_EXTENSION_DEEPER, /* zanoreni o uroven. */ FSM_Q_EXTENSION_LOWER, /* vynoreni o uroven. */ FSM_Q_EXTENSION_COMMENT } Efsm_state; #endif /* #ifndef _SCANNER_DEFINE_H_ */ /* Konec souboru scanner_define.h */
/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ /* #undef AC_APPLE_UNIVERSAL_BUILD */ /* Make use of ARM4 assembly optimizations */ /* #undef ARM4_ASM */ /* Make use of ARM5E assembly optimizations */ /* #undef ARM5E_ASM */ /* Make use of Blackfin assembly optimizations */ /* #undef BFIN_ASM */ /* Disable all parts of the API that are using floats */ /* #undef DISABLE_FLOAT_API */ /* Enable valgrind extra checks */ /* #undef ENABLE_VALGRIND */ /* Symbol visibility prefix */ #define EXPORT __attribute__((visibility("default"))) /* Debug fixed-point implementation */ /* #undef FIXED_DEBUG */ /* Compile as fixed-point */ /* #undef FIXED_POINT */ /* Compile as floating-point */ #define FLOATING_POINT /**/ /* Define to 1 if you have the <alloca.h> header file. */ #define HAVE_ALLOCA_H 1 /* Define to 1 if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the <getopt.h> header file. */ #define HAVE_GETOPT_H 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the <strings.h> header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the <sys/audioio.h> header file. */ /* #undef HAVE_SYS_AUDIOIO_H */ /* Define to 1 if you have the <sys/soundcard.h> header file. */ #define HAVE_SYS_SOUNDCARD_H 1 /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "speex-dev@xiph.org" /* Define to the full name of this package. */ #define PACKAGE_NAME "speexdsp" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "speexdsp 1.2rc3" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "speexdsp" /* Define to the home page for this package. */ #define PACKAGE_URL "" /* Define to the version of this package. */ #define PACKAGE_VERSION "1.2rc3" /* Resample with full SINC table (no interpolation) */ /* #undef RESAMPLE_FULL_SINC_TABLE */ /* The size of `int', as computed by sizeof. */ #define SIZEOF_INT 4 /* The size of `int16_t', as computed by sizeof. */ #define SIZEOF_INT16_T 2 /* The size of `int32_t', as computed by sizeof. */ #define SIZEOF_INT32_T 4 /* The size of `long', as computed by sizeof. */ #define SIZEOF_LONG 8 /* The size of `short', as computed by sizeof. */ #define SIZEOF_SHORT 2 /* The size of `uint16_t', as computed by sizeof. */ #define SIZEOF_UINT16_T 2 /* The size of `uint32_t', as computed by sizeof. */ #define SIZEOF_UINT32_T 4 /* The size of `u_int16_t', as computed by sizeof. */ #define SIZEOF_U_INT16_T 2 /* The size of `u_int32_t', as computed by sizeof. */ #define SIZEOF_U_INT32_T 4 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Enable support for TI C55X DSP */ /* #undef TI_C55X */ /* Make use of alloca */ /* #undef USE_ALLOCA */ /* Use FFTW3 for FFT */ /* #undef USE_GPL_FFTW3 */ /* Use Intel Math Kernel Library for FFT */ /* #undef USE_INTEL_MKL */ /* Use KISS Fast Fourier Transform */ /* #undef USE_KISS_FFT */ /* Use FFT from OggVorbis */ #define USE_SMALLFT /**/ /* Use C99 variable-size arrays */ #define VAR_ARRAYS /**/ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN /* # undef WORDS_BIGENDIAN */ # endif #endif /* Enable NEON support */ /* #undef _USE_NEON */ /* Enable SSE support */ #define _USE_SSE /**/ /* Enable SSE2 support */ #define _USE_SSE2 /**/ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus /* #undef inline */ #endif /* Define to the equivalent of the C99 'restrict' keyword, or to nothing if this is not supported. Do not define if restrict is supported directly. */ #define restrict __restrict /* Work around a bug in Sun C++: it does not support _Restrict or __restrict__, even though the corresponding Sun C compiler ends up with "#define restrict _Restrict" or "#define restrict __restrict__" in the previous line. Perhaps some future version of Sun C++ will work with restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ #if defined __SUNPRO_CC && !defined __RESTRICT # define _Restrict # define __restrict__ #endif
// -*- c++ -*- // Generated by gtkmmproc -- DO NOT MODIFY! #ifndef _GTKMM_TOOLBUTTON_P_H #define _GTKMM_TOOLBUTTON_P_H #include <gtkmm/private/toolitem_p.h> #include <glibmm/class.h> namespace Gtk { class ToolButton_Class : public Glib::Class { public: #ifndef DOXYGEN_SHOULD_SKIP_THIS typedef ToolButton CppObjectType; typedef GtkToolButton BaseObjectType; typedef GtkToolButtonClass BaseClassType; typedef Gtk::ToolItem_Class CppClassParent; typedef GtkToolItemClass BaseClassParent; friend class ToolButton; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ const Glib::Class& init(); static void class_init_function(void* g_class, void* class_data); static Glib::ObjectBase* wrap_new(GObject*); protected: #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED //Callbacks (default signal handlers): //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. //You could prevent the original default signal handlers being called by overriding the *_impl method. static void clicked_callback(GtkToolButton* self); #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED //Callbacks (virtual functions): #ifdef GLIBMM_VFUNCS_ENABLED #endif //GLIBMM_VFUNCS_ENABLED }; } // namespace Gtk #endif /* _GTKMM_TOOLBUTTON_P_H */
/* Armator - simulateur de jeu d'instruction ARMv5T à but pédagogique Copyright (C) 2011 Guillaume Huard Ce programme est libre, vous pouvez le redistribuer et/ou le modifier selon les termes de la Licence Publique Générale GNU publiée par la Free Software Foundation (version 2 ou bien toute autre version ultérieure choisie par vous). Ce programme est distribué car potentiellement utile, mais SANS AUCUNE GARANTIE, ni explicite ni implicite, y compris les garanties de commercialisation ou d'adaptation dans un but spécifique. Reportez-vous à la Licence Publique Générale GNU pour plus de détails. Vous devez avoir reçu une copie de la Licence Publique Générale GNU en même temps que ce programme ; si ce n'est pas le cas, écrivez à la Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, États-Unis. Contact: Guillaume.Huard@imag.fr ENSIMAG - Laboratoire LIG 51 avenue Jean Kuntzmann 38330 Montbonnot Saint-Martin */ #ifndef __ARM_DATA_PROCESSING_H__ #define __ARM_DATA_PROCESSING_H__ #include <stdint.h> #include "arm_core.h" int arm_data_processing_shift(arm_core p, uint32_t ins); void opChoice(arm_core p, uint32_t ins, uint32_t cpsr, uint32_t shifter_operand, int shifter_carry_out); int arm_data_processing_immediate(arm_core p, uint32_t ins); uint32_t rightRotate (uint8_t shift_imm, uint32_t rm); #endif
/* * Copyright (C) 2008-2008 LeGACY <http://www.legacy-project.org/> * * 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 */ #ifndef __LEGACY_OBJECTLIFETIME_H #define __LEGACY_OBJECTLIFETIME_H #include <stdexcept> #include "Platform/Define.h" typedef void (* Destroyer)(void); namespace LeGACY { void at_exit( void (*func)() ); template <class T> class LEGACY_DLL_DECL ObjectLifeTime { public: inline static void ScheduleCall(void (*destroyer)() ) { at_exit( destroyer ); } static void OnDeadReference(void) // We don't handle Dead Reference for now { throw std::runtime_error("Dead Reference"); } }; } #endif
/* * AiksaurusKDE - A KDE interface to the Aiksaurus library * Copyright (C) 2001 by Jared Davis * * 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. */ #ifndef INCLUDED_AIKSAURUS_QT_ICONS_H #define INCLUDED_AIKSAURUS_QT_ICONS_H namespace AiksaurusQT_impl { namespace Icons { extern const char* backNormal[]; extern const char* backHover[]; extern const char* forwardNormal[]; extern const char* forwardHover[]; extern const char* searchNormal[]; extern const char* searchHover[]; } } #endif // INCLUDED_AIKSAURUS_QT_ICONS_H
/// @addtogroup privileged /// @{ /// @file syslog.h /// @brief syslog interface /// @author Gwenhwyvar /// @version 0.1.0 /// @date 2015-12-13 #ifndef __SEC_SYSLOG_H #define __SEC_SYSLOG_H varargs void syslog(int priority, string format, mixed *args...); #define LOG_SHIFT 8 // internal use only // log facilities // these facilities are reserved for the corresponding subsystems #define LOG_SYSLOG 1 ///< messages generated internally by syslogd #define LOG_KERN 2 ///< kernel messages (reserved for master/simul_efuns) #define LOG_AUTH 3 ///< security/authorization messages #define LOG_DAEMON 4 ///< system daemons without separate facility value #define LOG_CRON 5 ///< clock daemon (cron and at) #define LOG_FTP 6 ///< ftp daemon #define LOG_MAIL 7 ///< mail subsystem #define LOG_NEWS 8 ///< news subsystem #define LOG_DESTRUCT 127 ///< calls to efun::destruct // facilities between LOG_USER and LOG_FACLITY (both included) are free to be // used and can be mapped to different logfiles via syslogd #define LOG_USER 128 ///< (default) generic user-level messages #define LOG_FACILITY ((1 << LOG_SHIFT) - 1) ///< maximum facility number (255) // log levels // logging for these levels can't be suppressed and they should _not_ be // used by any user defined objects #define LOG_EMERG ( 1 << LOG_SHIFT) ///< emergency (crash iminent) #define LOG_ALERT ( 2 << LOG_SHIFT) ///< alert (crash likely) #define LOG_CRIT ( 3 << LOG_SHIFT) ///< critical (crash possible) // logging for these levels can't be suppressed and should be used by // user defined objects to log corresponding conditions #define LOG_ERR ( 4 << LOG_SHIFT) ///< error #define LOG_WARNING ( 5 << LOG_SHIFT) ///< warnings // logging for these levels can be suppressed #define LOG_NOTICE ( 6 << LOG_SHIFT) ///< notices #define LOG_INFO ( 7 << LOG_SHIFT) ///< informations #define LOG_DEBUG ( 8 << LOG_SHIFT) ///< debug only // logging for these levels can be suppressed #define LOG_USER1 ( 9 << LOG_SHIFT) ///< userdefined log levels #define LOG_USER2 (10 << LOG_SHIFT) #define LOG_USER3 (11 << LOG_SHIFT) #define LOG_USER4 (12 << LOG_SHIFT) #define LOG_USER5 (13 << LOG_SHIFT) #define LOG_USER6 (14 << LOG_SHIFT) #define LOG_USER7 (15 << LOG_SHIFT) #define LOG_LEVEL (15 << LOG_SHIFT) ///< maximum log level #endif // __SEC_SYSLOG_H /// @}
/* Copyright (C) 2011 Birunthan Mohanathas (www.poiru.net) 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __LYRICS_H__ #define __LYRICS_H__ class CLyrics { public: static bool GetFromInternet(const std::wstring& artist, const std::wstring& title, std::wstring& out); private: static bool GetFromLetras(const std::wstring& artist, const std::wstring& title, std::wstring& data); static bool GetFromLYRDB(const std::wstring& artist, const std::wstring& title, std::wstring& data); static bool GetFromWikia(const std::wstring& artist, const std::wstring& title, std::wstring& data); }; #endif
#include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <assert.h> #include <limits.h> #include <stdbool.h> int checkString(char *s,int i,int j,int len){ char X = 'a'+i; char Y = 'a'+j; int top =-1; char *stack = (char *)malloc(sizeof(char)*len); for(int i = 0; i < len; i++){ if(top==-1 &&(X==s[i]||Y==s[i])){ top++; stack[top]=s[i]; }else{ if(s[i]==X && stack[top]==Y){ top++; stack[top]=s[i]; }else if(s[i]==Y && stack[top]==X){ top++; stack[top]=s[i]; }else if(s[i]==X && stack[top]==X || (s[i]==Y && stack[top]==Y)){ top = -1; break; } } } return top; } int main(){ int len; int i,j; scanf("%d",&len); char* s = (char *)malloc(512000 * sizeof(char)); scanf("%s",s); int max = 0; int maxI,maxJ; for(i=0;i<26;i++){ int flag = 1; for(j=i+1;j<26;j++){ int ans = checkString(s,i,j,len); if(ans > max){ max = ans; maxI = i; maxJ = j; } } } if(max !=0){ printf("%d",max+1); }else{ printf("0"); } return 0; }
/* linux/drivers/video/samsung/s3cfb_extdsp.h * * Copyright (c) 2010 Samsung Electronics Co., Ltd. * http://www.samsung.com/ * * Header file for Samsung Display Driver (FIMD) driver * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef _S3CFB_EXTDSP_H #define _S3CFB_EXTDSP_H __FILE__ #ifdef __KERNEL__ #include <linux/mutex.h> #include <linux/fb.h> #ifdef CONFIG_HAS_WAKELOCK #include <linux/wakelock.h> #include <linux/earlysuspend.h> #endif #include <plat/fb-s5p.h> #endif #define S3CFB_EXTDSP_NAME "s3cfb_extdsp" #define POWER_ON 1 #define POWER_OFF 0 enum s3cfb_extdsp_output_t { OUTPUT_RGB, OUTPUT_ITU, OUTPUT_I80LDI0, OUTPUT_I80LDI1, OUTPUT_WB_RGB, OUTPUT_WB_I80LDI0, OUTPUT_WB_I80LDI1, }; enum s3cfb_extdsp_rgb_mode_t { MODE_RGB_P = 0, MODE_BGR_P = 1, MODE_RGB_S = 2, MODE_BGR_S = 3, }; enum s3cfb_extdsp_mem_owner_t { DMA_MEM_NONE = 0, DMA_MEM_FIMD = 1, DMA_MEM_OTHER = 2, }; enum s3cfb_extdsp_buf_status_t { BUF_FREE = 0, BUF_ACTIVE = 1, BUF_LOCKED = 2, }; struct s3cfb_extdsp_lcd_polarity { int rise_vclk; int inv_hsync; int inv_vsync; int inv_vden; }; struct s3cfb_extdsp_lcd { int width; int height; int bpp; }; struct s3cfb_extdsp_extdsp_desc { int state; struct s3cfb_extdsp_global *fbdev[1]; }; struct s3cfb_extdsp_time_stamp { unsigned int phys_addr; struct timeval time_marker; }; struct s3cfb_extdsp_buf_list { unsigned int phys_addr; struct timeval time_marker; int buf_status; }; struct s3cfb_extdsp_global { struct mutex lock; struct device *dev; #ifdef CONFIG_BUSFREQ_OPP struct device *bus_dev; #endif struct fb_info **fb; atomic_t enabled_win; enum s3cfb_extdsp_output_t output; enum s3cfb_extdsp_rgb_mode_t rgb_mode; struct s3cfb_extdsp_lcd *lcd; int system_state; #ifdef CONFIG_HAS_WAKELOCK struct early_suspend early_suspend; struct wake_lock idle_lock; #endif struct s3cfb_extdsp_buf_list buf_list[CONFIG_FB_S5P_EXTDSP_NR_BUFFERS]; unsigned int enabled_tz; unsigned int lock_cnt; }; struct s3cfb_extdsp_window { int id; int enabled; atomic_t in_use; int x; int y; unsigned int pseudo_pal[16]; int power_state; int lock_status; int lock_buf_idx; unsigned int lock_buf_offset; unsigned int free_buf_offset; }; struct s3cfb_extdsp_user_window { int x; int y; }; /* IOCTL commands */ #define S3CFB_EXTDSP_WIN_POSITION _IOW('F', 203, \ struct s3cfb_extdsp_user_window) #define S3CFB_EXTDSP_GET_LCD_WIDTH _IOR('F', 302, int) #define S3CFB_EXTDSP_GET_LCD_HEIGHT _IOR('F', 303, int) #define S3CFB_EXTDSP_SET_WIN_ON _IOW('F', 305, u32) #define S3CFB_EXTDSP_SET_WIN_OFF _IOW('F', 306, u32) #define S3CFB_EXTDSP_SET_WIN_ADDR _IOW('F', 308, unsigned long) #define S3CFB_EXTDSP_GET_FB_PHY_ADDR _IOR('F', 310, unsigned int) #define S3CFB_EXTDSP_LOCK_BUFFER _IOW('F', 320, int) #define S3CFB_EXTDSP_GET_NEXT_INDEX _IOW('F', 321, unsigned int) #define S3CFB_EXTDSP_GET_LOCKED_BUFFER _IOW('F', 322, unsigned int) #define S3CFB_EXTDSP_PUT_TIME_STAMP _IOW('F', 323, \ struct s3cfb_extdsp_time_stamp) #define S3CFB_EXTDSP_GET_TIME_STAMP _IOW('F', 324, \ struct s3cfb_extdsp_time_stamp) #define S3CFB_EXTDSP_GET_TZ_MODE _IOW ('F', 325, unsigned int) #define S3CFB_EXTDSP_SET_TZ_MODE _IOW ('F', 326, unsigned int) #define S3CFB_EXTDSP_GET_LOCKED_NUMBER _IOW ('F', 327, unsigned int) #define S3CFB_EXTDSP_LOCK_AND_GET_BUF _IOW ('F', 328, \ struct s3cfb_extdsp_buf_list) #define S3CFB_EXTDSP_GET_FREE_BUFFER _IOW('F', 329, unsigned int) extern struct fb_ops s3cfb_extdsp_ops; extern inline struct s3cfb_extdsp_global *get_extdsp_global(int id); /* S3CFB_EXTDSP */ extern int s3cfb_extdsp_enable_window(struct s3cfb_extdsp_global *fbdev, int id); extern int s3cfb_extdsp_disable_window(struct s3cfb_extdsp_global *fbdev, int id); extern int s3cfb_extdsp_update_power_state(struct s3cfb_extdsp_global *fbdev, int id, int state); extern int s3cfb_extdsp_init_global(struct s3cfb_extdsp_global *fbdev); extern int s3cfb_extdsp_map_default_video_memory(struct s3cfb_extdsp_global *fbdev, struct fb_info *fb, int extdsp_id); extern int s3cfb_extdsp_unmap_default_video_memory(struct s3cfb_extdsp_global *fbdev, struct fb_info *fb); extern int s3cfb_extdsp_check_var(struct fb_var_screeninfo *var, struct fb_info *fb); extern int s3cfb_extdsp_check_var_window(struct s3cfb_extdsp_global *fbdev, struct fb_var_screeninfo *var, struct fb_info *fb); extern int s3cfb_extdsp_set_par_window(struct s3cfb_extdsp_global *fbdev, struct fb_info *fb); extern int s3cfb_extdsp_set_par(struct fb_info *fb); extern int s3cfb_extdsp_init_fbinfo(struct s3cfb_extdsp_global *fbdev, int id); extern int s3cfb_extdsp_alloc_framebuffer(struct s3cfb_extdsp_global *fbdev, int extdsp_id); extern int s3cfb_extdsp_open(struct fb_info *fb, int user); extern int s3cfb_extdsp_release_window(struct fb_info *fb); extern int s3cfb_extdsp_release(struct fb_info *fb, int user); extern int s3cfb_extdsp_pan_display(struct fb_var_screeninfo *var, struct fb_info *fb); extern int s3cfb_extdsp_blank(int blank_mode, struct fb_info *fb); extern inline unsigned int __chan_to_field(unsigned int chan, struct fb_bitfield bf); extern int s3cfb_extdsp_setcolreg(unsigned int regno, unsigned int red, unsigned int green, unsigned int blue, unsigned int transp, struct fb_info *fb); extern int s3cfb_extdsp_cursor(struct fb_info *fb, struct fb_cursor *cursor); extern int s3cfb_extdsp_ioctl(struct fb_info *fb, unsigned int cmd, unsigned long arg); #ifdef CONFIG_HAS_WAKELOCK #ifdef CONFIG_HAS_EARLYSUSPEND extern void s3cfb_extdsp_early_suspend(struct early_suspend *h); extern void s3cfb_extdsp_late_resume(struct early_suspend *h); #endif #endif #endif /* _S3CFB_EXTDSP_H */
/* * FeatureManager.h - header for the FeatureManager class * * Copyright (c) 2017-2022 Tobias Junghans <tobydox@veyon.io> * * This file is part of Veyon - https://veyon.io * * 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 (see COPYING); if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * */ #pragma once #include <QObject> #include "Feature.h" #include "FeatureProviderInterface.h" #include "ComputerControlInterface.h" #include "Plugin.h" class QWidget; class FeatureWorkerManager; class VEYON_CORE_EXPORT FeatureManager : public QObject { Q_OBJECT public: explicit FeatureManager( QObject* parent = nullptr ); const FeatureList& features() const { return m_features; } const FeatureList& features( Plugin::Uid pluginUid ) const; const Feature& feature( Feature::Uid featureUid ) const; const FeatureList& relatedFeatures( Feature::Uid featureUid ) const; Feature::Uid metaFeatureUid( Feature::Uid featureUid ) const; Plugin::Uid pluginUid( Feature::Uid featureUid ) const; void controlFeature( Feature::Uid featureUid, FeatureProviderInterface::Operation operation, const QVariantMap& arguments, const ComputerControlInterfaceList& computerControlInterfaces ) const; void startFeature( VeyonMasterInterface& master, const Feature& feature, const ComputerControlInterfaceList& computerControlInterfaces ) const; void stopFeature( VeyonMasterInterface& master, const Feature& feature, const ComputerControlInterfaceList& computerControlInterfaces ) const; void handleFeatureMessage(ComputerControlInterface::Pointer computerControlInterface, const FeatureMessage& message) const; void handleFeatureMessage(VeyonServerInterface& server, const MessageContext& messageContext, const FeatureMessage& message) const; void handleFeatureMessage(VeyonWorkerInterface& worker, const FeatureMessage& message) const; void sendAsyncFeatureMessages(VeyonServerInterface& server, const MessageContext& messageContext) const; FeatureUidList activeFeatures( VeyonServerInterface& server ) const; private: FeatureList m_features{}; const FeatureList m_emptyFeatureList{}; QObjectList m_pluginObjects{}; FeatureProviderInterfaceList m_featurePluginInterfaces{}; const Feature m_dummyFeature{}; };
/* Generated by CIL v. 1.7.0 */ /* print_CIL_Input is false */ struct _1_sort__opaque_Node_1; struct _IO_FILE; struct timeval; extern void signal(int sig , void *func ) ; extern float strtof(char const *str , char const *endptr ) ; typedef unsigned long size_t; typedef struct _IO_FILE FILE; extern __attribute__((__nothrow__)) int ( __attribute__((__nonnull__(1), __leaf__)) atoi)(char const *__nptr ) __attribute__((__pure__)) ; extern double strtod(char const *str , char const *endptr ) ; extern int fclose(void *stream ) ; extern void *fopen(char const *filename , char const *mode ) ; extern void abort() ; extern void exit(int status ) ; extern int raise(int sig ) ; extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ; extern int rand() ; extern unsigned long strtoul(char const *str , char const *endptr , int base ) ; typedef struct _1_sort__opaque_Node_1 *_1_sort__opaque_List_1; extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ; struct _1_sort__opaque_Node_1 { int data ; struct _1_sort__opaque_Node_1 *next ; }; struct _1_sort__opaque_Node_1 *_1_sort__opaque_list2_1 = (struct _1_sort__opaque_Node_1 *)0; extern int gettimeofday(struct timeval *tv , void *tz , ...) ; extern int printf(char const * __restrict __format , ...) ; int main(int argc , char **argv ) ; void megaInit(void) ; extern unsigned long strlen(char const *s ) ; void sort(int *mlist , int size ) ; extern long strtol(char const *str , char const *endptr , int base ) ; struct _1_sort__opaque_Node_1 *_1_sort__opaque_list1_1 = (struct _1_sort__opaque_Node_1 *)0; extern unsigned long strnlen(char const *s , unsigned long maxlen ) ; extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ; struct timeval { long tv_sec ; long tv_usec ; }; extern __attribute__((__nothrow__)) void *( __attribute__((__leaf__)) malloc)(size_t __size ) __attribute__((__malloc__)) ; extern int scanf(char const *format , ...) ; void sort(int *mlist , int size ) { int i ; int j ; int tmp ; int i6 ; int r7 ; struct _1_sort__opaque_Node_1 *p8 ; int _1_sort__BEGIN_0 ; int _1_sort__END_0 ; int _1_sort__BARRIER_1 ; unsigned long _2_sort_next ; { { /* __blockattribute__(__ATOMIC__)*/ _1_sort__BEGIN_0 = 1; i6 = 0; while (i6 < 2) { r7 = rand(); p8 = (struct _1_sort__opaque_Node_1 *)malloc(sizeof(struct _1_sort__opaque_Node_1 )); if (p8 != (struct _1_sort__opaque_Node_1 *)0UL) { p8->data = r7; if (_1_sort__opaque_list1_1 != (struct _1_sort__opaque_Node_1 *)0UL) { p8->next = _1_sort__opaque_list1_1->next; _1_sort__opaque_list1_1->next = p8; } else { p8->next = p8; _1_sort__opaque_list1_1 = p8; } } else { } i6 ++; } _1_sort__opaque_list2_1 = _1_sort__opaque_list1_1; _1_sort__END_0 = 1; } _1_sort__BARRIER_1 = 1; _2_sort_next = 12 * ! (_1_sort__opaque_list2_1 == (struct _1_sort__opaque_Node_1 *)0UL); while (1) { switch (_2_sort_next) { case 0: ; return; break; case 10: ; if (i < size - 1) { _2_sort_next = 8 + (_1_sort__opaque_list1_1 == (struct _1_sort__opaque_Node_1 *)0UL); } else { _2_sort_next = (unsigned long )(_1_sort__opaque_list1_1 != _1_sort__opaque_list2_1) + (unsigned long )(_1_sort__opaque_list1_1 != _1_sort__opaque_list2_1); } break; case 12: i = 0; _2_sort_next = 10 - ! (_1_sort__opaque_list2_1 != (struct _1_sort__opaque_Node_1 *)0UL); break; case 4: ; if (*(mlist + j) > *(mlist + (j + 1))) { _2_sort_next = ((unsigned long )(_1_sort__opaque_list2_1 != (struct _1_sort__opaque_Node_1 *)0UL) - (unsigned long )(_1_sort__opaque_list2_1 == (struct _1_sort__opaque_Node_1 *)0UL)) + ((unsigned long )(! ((unsigned long )(_1_sort__opaque_list1_1 != _1_sort__opaque_list2_1))) + 1); } else { _2_sort_next = (unsigned long )(! ((unsigned long )(_1_sort__opaque_list1_1 != _1_sort__opaque_list2_1))) + 1; } break; case 14: *(mlist + j) = *(mlist + (j + 1)); _2_sort_next = _1_sort__opaque_list1_1 != (struct _1_sort__opaque_Node_1 *)0UL ? 13 : 5; break; case 2: j ++; _2_sort_next = 6 - (_1_sort__opaque_list1_1 == (struct _1_sort__opaque_Node_1 *)0UL); break; case 13: *(mlist + (j + 1)) = tmp; _2_sort_next = ((unsigned long )(_1_sort__opaque_list1_1 == (struct _1_sort__opaque_Node_1 *)0UL) + (unsigned long )(_1_sort__opaque_list1_1 == _1_sort__opaque_list2_1)) + 1; break; case 8: j = 0; _2_sort_next = _1_sort__opaque_list1_1 != _1_sort__opaque_list2_1 ? 2 : 6; break; case 6: ; if (j < (size - 1) - i) { _2_sort_next = 4 + ((_1_sort__opaque_list1_1 != _1_sort__opaque_list2_1) + (_1_sort__opaque_list1_1 != _1_sort__opaque_list2_1)); } else { _2_sort_next = (unsigned long )(! ((unsigned long )(_1_sort__opaque_list2_1 == (struct _1_sort__opaque_Node_1 *)0UL))); } break; case 1: i ++; _2_sort_next = 10 - ((_1_sort__opaque_list1_1 != (struct _1_sort__opaque_Node_1 *)0UL) - (_1_sort__opaque_list1_1 != (struct _1_sort__opaque_Node_1 *)0UL)); break; case 3: tmp = *(mlist + j); _2_sort_next = 14 - ((_1_sort__opaque_list1_1 == (struct _1_sort__opaque_Node_1 *)0UL) + (_1_sort__opaque_list1_1 == (struct _1_sort__opaque_Node_1 *)0UL)); break; } } } } void megaInit(void) { { } } int main(int argc , char **argv ) { int size_of_list ; int tmp ; int *list ; void *tmp___0 ; int i ; int i___0 ; { megaInit(); tmp = atoi((char const *)*(argv + 1)); size_of_list = tmp; tmp___0 = malloc((unsigned long )size_of_list * sizeof(int )); list = (int *)tmp___0; i = 0; while (i < size_of_list) { *(list + i) = atoi((char const *)*(argv + (2 + i))); i ++; } sort(list, size_of_list); i___0 = 0; while (i___0 < size_of_list) { printf((char const */* __restrict */)"%d", *(list + i___0)); i___0 ++; } printf((char const */* __restrict */)"\n"); return (0); } }
/* * cstring.h * * Created on: Dec 30, 2014 * Author: muneer */ #ifndef CSTRING_H_ #define CSTRING_H_ /** * t_cstring * * A struct to pretend like a String */ typedef struct C_String { int size; char *value; } t_cstring; /** * Create and return a t_cstring type */ t_cstring *cstring_create(); /** * Free the allocated memory * * @param t_msring * @return int */ int cstring_delete(t_cstring *string); /** * Add char array to t_cstring * * @param t_cstring * @param char* * @return int */ int cstring_add(t_cstring *string, char *s); /** * Assign initial value to the t_cstring * @param t_cstring * @param char* * @return int */ int cstring_assign(t_cstring *string, const char *str); /** * Compare two t_cstrings */ int cstring_compare(t_cstring *str1, t_cstring *str2); /** * Substring function */ int cstring_substring(t_cstring *string, int start, int length); /** * Find the position of specified character */ int cstring_charpos(t_cstring *string, const char c); /** * Find the position of specified char * */ int cstring_strpos(t_cstring *string, const char *str); #endif /* CSTRING_H_ */
#ifndef __STATEADDOBJECTS_H #define __STATEADDOBJECTS_H #include "EditorState.h" #include "editorapp.h" class CStateAddObjects : public CEditorState { public: CStateAddObjects(CStateHandler* aStateHandler,CEditorBrush* aBrush,CEditableLevel* aLevel); ~CStateAddObjects(void); public: void Draw(CEditorDrawer* aDrawer); void HandleKeys(CEventHandler* aEventHandler,CEditorDrawer* aDrawer); void HandleMouse(CEventHandler* aEventHandler,CEditorDrawer* aDrawer); void SetMode(int aEditMode); protected: TEditObjectMode iCurrentMode; // SpotLight variables int iSpotSize; int iSpotSetSizeMode; // boolean int iSpotSizeX,iSpotSizeY; // Steam variables int iSteamSpeed; int iSteamAngle; int iSteamAdjustMode; // boolean int iSteamX,iSteamY; // Crates variables int iCrateType1; int iCrateType2; // Enemytype int iEnemyType; int iMouseX; int iMouseY; // Number of player to place startpoint int iPlayerToPlace; }; #endif
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_EXTENSIONS_API_IDENTITY_WEB_AUTH_FLOW_H_ #define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_WEB_AUTH_FLOW_H_ #include <string> #include "apps/shell_window_registry.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents_observer.h" #include "ui/gfx/rect.h" #include "url/gurl.h" class Profile; class WebAuthFlowTest; namespace content { class NotificationDetails; class NotificationSource; class RenderViewHost; class WebContents; } namespace extensions { class WebAuthFlow : public content::NotificationObserver, public content::WebContentsObserver, public apps::ShellWindowRegistry::Observer { public: enum Mode { INTERACTIVE, SILENT }; enum Failure { WINDOW_CLOSED, INTERACTION_REQUIRED, LOAD_FAILED }; class Delegate { public: virtual void OnAuthFlowFailure(Failure failure) = 0; virtual void OnAuthFlowURLChange(const GURL& redirect_url) = 0; virtual void OnAuthFlowTitleChange(const std::string& title) = 0; protected: virtual ~Delegate() {} }; WebAuthFlow(Delegate* delegate, Profile* profile, const GURL& provider_url, Mode mode); virtual ~WebAuthFlow(); virtual void Start(); void DetachDelegateAndDelete(); private: friend class ::WebAuthFlowTest; virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE; virtual void OnShellWindowIconChanged(apps::ShellWindow* shell_window) OVERRIDE; virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) OVERRIDE; virtual void Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; virtual void DidStopLoading(content::RenderViewHost* render_view_host) OVERRIDE; virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) OVERRIDE; virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; virtual void DidStartProvisionalLoadForFrame( int64 frame_id, int64 parent_frame_id, bool is_main_frame, const GURL& validated_url, bool is_error_page, bool is_iframe_srcdoc, content::RenderViewHost* render_view_host) OVERRIDE; virtual void DidFailProvisionalLoad(int64 frame_id, const base::string16& frame_unique_name, bool is_main_frame, const GURL& validated_url, int error_code, const base::string16& error_description, content::RenderViewHost* render_view_host) OVERRIDE; void BeforeUrlLoaded(const GURL& url); void AfterUrlLoaded(); Delegate* delegate_; Profile* profile_; GURL provider_url_; Mode mode_; apps::ShellWindow* shell_window_; std::string shell_window_key_; bool embedded_window_created_; content::NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(WebAuthFlow); }; } #endif
/* ieee-utils/print.c * * Copyright (C) 1996, 1997, 1998, 1999, 2000 Brian Gough * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include <stdio.h> #include <math.h> #include "gsl_ieee_utils.h" /* A table of sign characters, 0=positive, 1=negative. We print a space instead of a unary + sign for compatibility with bc */ static char signs[2]={' ','-'} ; void gsl_ieee_fprintf_float (FILE * stream, const float * x) { gsl_ieee_float_rep r ; gsl_ieee_float_to_rep(x, &r) ; switch (r.type) { case GSL_IEEE_TYPE_NAN: fprintf(stream, "NaN") ; break ; case GSL_IEEE_TYPE_INF: fprintf(stream, "%cInf", signs[r.sign]) ; break ; case GSL_IEEE_TYPE_NORMAL: fprintf(stream, "%c1.%s*2^%d", signs[r.sign], r.mantissa, r.exponent) ; break ; case GSL_IEEE_TYPE_DENORMAL: fprintf(stream, "%c0.%s*2^%d", signs[r.sign], r.mantissa, r.exponent + 1) ; break ; case GSL_IEEE_TYPE_ZERO: fprintf(stream, "%c0", signs[r.sign]) ; break ; default: fprintf(stream, "[non-standard IEEE float]") ; } } void gsl_ieee_printf_float (const float * x) { gsl_ieee_fprintf_float (stdout,x); } void gsl_ieee_fprintf_double (FILE * stream, const double * x) { gsl_ieee_double_rep r ; gsl_ieee_double_to_rep (x, &r) ; switch (r.type) { case GSL_IEEE_TYPE_NAN: fprintf(stream, "NaN") ; break ; case GSL_IEEE_TYPE_INF: fprintf(stream, "%cInf", signs[r.sign]) ; break ; case GSL_IEEE_TYPE_NORMAL: fprintf(stream, "%c1.%s*2^%d", signs[r.sign], r.mantissa, r.exponent) ; break ; case GSL_IEEE_TYPE_DENORMAL: fprintf(stream, "%c0.%s*2^%d", signs[r.sign], r.mantissa, r.exponent + 1) ; break ; case GSL_IEEE_TYPE_ZERO: fprintf(stream, "%c0", signs[r.sign]) ; break ; default: fprintf(stream, "[non-standard IEEE double]") ; } } void gsl_ieee_printf_double (const double * x) { gsl_ieee_fprintf_double (stdout,x); }
/* * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ #ifndef _GLASS_APPLICATION_ #define _GLASS_APPLICATION_ #include "BaseWnd.h" class Action { public: virtual void Do() = 0; virtual ~Action() {} }; #define ENTER_MAIN_THREAD_AND_RETURN(RetType) \ class _MyAction : public Action { \ public: \ RetType _retValue; \ virtual void Do() { \ _retValue = _UserDo(); \ } \ RetType _UserDo() #define ENTER_MAIN_THREAD() \ class _MyAction : public Action { \ public: \ virtual void Do() #define LEAVE_MAIN_THREAD \ } _action; #define LEAVE_MAIN_THREAD_LATER \ }; \ _MyAction * _pAction = new _MyAction(); \ _MyAction & _action = *_pAction; #define ARG(var) _action.var #define DECL_JREF(T, var) JGlobalRef<T> var #define DECL_jobject(var) DECL_JREF(jobject, var) #define PERFORM() GlassApplication::ExecAction(&_action) #define PERFORM_AND_RETURN() (PERFORM(), _action._retValue) #define PERFORM_LATER() GlassApplication::ExecActionLater(_pAction) #define WM_DO_ACTION (WM_USER+1) #define WM_DO_ACTION_LATER (WM_USER+2) // Accessibility (a11y) messages #define WM_A11Y_INIT_IS_COMPLETE (WM_USER+3) class GlassApplication : protected BaseWnd { public: GlassApplication(jobject jrefThis); virtual ~GlassApplication(); static HWND GetToolkitHWND() { return (NULL == pInstance) ? NULL : pInstance->GetHWND(); } static GlassApplication *GetInstance() { return pInstance; } static void ExecAction(Action *action); static void ExecActionLater(Action *action); void RegisterClipboardViewer(jobject clipboard); void UnregisterClipboardViewer(); inline static DWORD GetMainThreadId() { return pInstance == NULL ? 0 : pInstance->m_mainThreadId; } static jobject EnterNestedEventLoop(JNIEnv * env); static void LeaveNestedEventLoop(JNIEnv * env, jobject retValue); static void SetGlassClassLoader(JNIEnv *env, jobject classLoader); static jclass ClassForName(JNIEnv *env, char *className); static void SetHInstance(HINSTANCE hInstace) { GlassApplication::hInstace = hInstace; } static HINSTANCE GetHInstance() { return GlassApplication::hInstace; } /* Maintains a counter. Must be balanced with UninstallMouseLLHook. */ static void InstallMouseLLHook(); static void UninstallMouseLLHook(); protected: virtual LRESULT WindowProc(UINT msg, WPARAM wParam, LPARAM lParam); virtual LPCTSTR GetWindowClassNameSuffix(); private: jobject m_grefThis; jobject m_clipboard; static GlassApplication *pInstance; HWND m_hNextClipboardView; DWORD m_mainThreadId; static jobject sm_glassClassLoader; // These are static because the GlassApplication instance may be // destroyed while the nested loop is spinning static bool sm_shouldLeaveNestedLoop; static JGlobalRef<jobject> sm_nestedLoopReturnValue; static HINSTANCE hInstace; static unsigned int sm_mouseLLHookCounter; static HHOOK sm_hMouseLLHook; static LRESULT CALLBACK MouseLLHook(int nCode, WPARAM wParam, LPARAM lParam); }; #endif //_GLASS_APPLICATION_
/* * $Id$ * * This file is part of the OpenLink Software Virtuoso Open-Source (VOS) * project. * * Copyright (C) 1998-2012 OpenLink Software * * This project 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; only version 2 of the License, dated June 1991. * * 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., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "ctype.h" #include "Dk.h" #include "sqlparext.h" #include "sql3.c" #include "sqlpfn.h"
/* Copyright (C) 2014 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. DCP-o-matic 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. DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. */ #include <wx/wx.h> #include <boost/optional.hpp> class UpdateDialog : public wxDialog { public: UpdateDialog (wxWindow *, boost::optional<std::string>, boost::optional<std::string>); };
/* Sieve of Eratosthenes * * A method to calculate prime numbers */ #include <stdio.h> #include <stdlib.h> #include <errno.h> int main (int argc, char *argv[]) { /* limit = the amount of numbers to check are prime or not */ int limit, i, j; if (argc != 2 || ((limit = atoi(argv[1]))) <= 0) { printf("Usage: %s NUMBERS\n", argv[0]); exit(1); } limit = limit-1; /* allocate an array to store numbers * we can't store this on the stack because it could get huge! */ int *numbers; numbers = (int *)malloc(sizeof(int)*limit); if (!numbers) { perror("Could not allocate memory"); exit(1); } /* fill the array with all numbers to check */ for(i = 0; i < limit; i++) { numbers[i] = i+2; } for (i = 0; i < limit; i++) { /* if we've already crossed this one out, skip it */ if (numbers[i] != 0) { /* square the number, if it's smaller than the limit, find its array address and zero it */ for (j = 2 * numbers[i]-2; j < limit; j += numbers[i]) numbers[j]=0; } } /* one is always prime */ printf("1 "); /* walk the number array. if the number is not zero, print it */ for (i = 0; i < limit; i++) { if (numbers[i] != 0) { printf("%d ", numbers [i]); } } /* clean up */ printf("\n"); free(numbers); return 0; }
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * 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 * * Author: Giuseppe Piro <g.piro@poliba.it> */ #ifndef RLC_ENTITY_H #define RLC_ENTITY_H #include "ns3/object.h" #include <list> namespace ns3 { class Packet; class LteNetDevice; class RadioBearerInstance; /** * \ingroup lte * * This class implements the RLC entity */ class RlcEntity : public Object { public: static TypeId GetTypeId (void); RlcEntity (void); /** * \brief Create the RLC entity * \param d the device where the RLC entity is created */ RlcEntity (Ptr<LteNetDevice> d); virtual ~RlcEntity (void); virtual void DoDispose (void); /** * \brief Set the device where the RLC entity is attached * \param d the device */ void SetDevice (Ptr<LteNetDevice> d); /** * \brief Get the device where the RLC entity is attached * \return the pointer to the device */ Ptr<LteNetDevice> GetDevice (); /** * \brief Get A packet form the queue * \return a pointer to the packet */ Ptr<Packet> Dequeue (); /** * \brief Set the bearer where the rlc entity is attached * \param b the radio bearer */ void SetRadioBearer (Ptr<RadioBearerInstance> b); /** * \brief Get the bearer where the rlc entity is attached * \return the pointer to the radio bearer */ Ptr<RadioBearerInstance> GetRadioBearer (void); private: Ptr<LteNetDevice> m_device; Ptr<RadioBearerInstance> m_bearer; }; } // namespace ns3 #endif /* RLC_ENTITY_H */
#include "stdio.h" /** this progarm just use to test the scope of the global variables. */ int sp; // sp is the global variables. void shadowornot(void){ int sp; sp = 3; if(sp == 0){ printf("local variable with same name do not shadow the external variable. \n"); }else{ printf("local variable will shadow the global variables.\n"); } } int main(void){ shadowornot(); return 0; }
#include <std.h> /* * ======== unit headers ======== */ #ifndef test42_TestMod__M #define test42_TestMod__M #include "../../test42/TestMod/TestMod.h" #endif #ifndef test42_TestProg__M #define test42_TestProg__M #include "../../test42/TestProg/TestProg.h" #endif /* * ======== target data definitions (unit TestMod) ======== */ struct test42_TestMod_ test42_TestMod = { /* module data */ }; /* * ======== target data definitions (unit TestProg) ======== */ struct test42_TestProg_ test42_TestProg = { /* module data */ }; /* * ======== pollen print ======== */ void test42_TestProg_pollen__printBool(bool b) { } void test42_TestProg_pollen__printInt(int32 i) { } void test42_TestProg_pollen__printReal(float f) { } void test42_TestProg_pollen__printUint(uint32 u) { } void test42_TestProg_pollen__printStr(string s) { } /* * ======== module functions ======== */ #include "../../test42/TestMod/TestMod.c" #include "../../test42/TestProg/TestProg.c" /* * ======== pollen.reset() ======== */ void test42_TestProg_pollen__reset__E() { /* empty default */ } /* * ======== pollen.ready() ======== */ void test42_TestProg_pollen__ready__E() { /* empty default */ } /* * ======== pollen.shutdown(uint8) ======== */ void test42_TestProg_pollen__shutdown__E(uint8 i) { volatile int dummy = 0xCAFE; while (dummy) ; } /* * ======== main() ======== */ int main() { test42_TestProg_pollen__reset__E(); test42_TestMod_targetInit__I(); test42_TestProg_targetInit__I(); test42_TestProg_pollen__ready__E(); test42_TestProg_pollen__run__E(); test42_TestProg_pollen__shutdown__E(0); }
/* ** $Id: propsheet_impl.h 7338 2007-08-16 03:46:09Z xgwang $ ** ** propsheet.h: the head file of PropSheet control. ** ** Copyright (C) 2003 ~ 2007 Feynman Software. ** Copyright (C) 2001 ~ 2002 Wei Yongming and others. ** ** NOTE: Originally by Wang Jian and Jiang Jun. ** ** Create date: 2001/11/19 */ #ifndef GUI_PROPSHEET_IMPL_H_ #define GUI_PROPSHEET_IMPL_H_ #ifdef __cplusplus extern "C" { #endif typedef struct tagPROPPAGE { char* title; /* title of page */ HICON icon; /* icon of page */ int width; /* width of title */ HWND hwnd; /* container control */ WNDPROC proc; /* callback of page */ struct tagPROPPAGE* next; /* next page */ } PROPPAGE; typedef PROPPAGE* PPROPPAGE; typedef struct tagPROPSHEETDATA { RECT head_rc; /* height of page title */ int head_width; /* the effective width of head */ int page_count; /* the number of pages */ PROPPAGE *active; /* index of active page */ PROPPAGE *first_display_page;/* index of active page */ PROPPAGE *head; /* head of page list */ BOOL overload; /* if too much head and too long for display, head_overload = TRUE */ } PROPSHEETDATA; typedef PROPSHEETDATA* PPROPSHEETDATA; BOOL RegisterPropSheetControl (void); void PropSheetControlCleanup (void); #ifdef __cplusplus } #endif #endif // GUI_PROPSHEET_IMPL_H_
/* * This file is part of PRO ONLINE. * PRO ONLINE 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 3 of the License, or * (at your option) any later version. * PRO ONLINE 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 PRO ONLINE. If not, see <http://www.gnu.org/licenses/ . */ #ifndef _STATUS_H_ #define _STATUS_H_ /** * Update Status Logfile */ void update_status(void); #endif
/* **************************************************************************** * * UNIVERSITY OF WATERLOO SE 350 RTX LAB * * Copyright 2020-2022 Yiqing Huang * 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 and the following disclaimer. * * * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *---------------------------------------------------------------------------*/ /**************************************************************************//** * @file ae_proc.h * @brief six user test processes header file * * @version V1.2021.01 * @authors Yiqing Huang * @date 2021 JAN *****************************************************************************/ #ifndef AE_PROC_H_ #define AE_PROC_H_ #include "ae.h" #include "ae_timer.h" /* *=========================================================================== * MACROS *=========================================================================== */ #ifdef SIM_TARGET /* using the simulator is slow */ #define DELAY 100000 #else #define DELAY 10000000 #endif /* SIM_TARGET */ /* *=========================================================================== * FUNCTION PROTOTYPES *=========================================================================== */ extern void set_test_procs(PROC_INIT *procs, int num); extern void proc1(void); extern void proc2(void); extern void proc3(void); extern void proc4(void); extern void proc5(void); extern void proc6(void); #endif /* AE_PROC_H_ */
#ifndef _IP_H #define _IP_H struct iphdr { uint8_t verhdrlen; uint8_t service; uint16_t len; uint16_t ident; uint16_t frags; uint8_t ttl; uint8_t protocol; uint16_t chksum; in_addr src; in_addr dest; }; #endif /* _IP_H */
// Mandelbrot Rendering routines. All have the same signature, so we can easily switch routine using // function pointers. // Compute mandelbrot set inside supplied coordinates, returned in *image. Resolution variables used to // determine mandelbrot coordinates of each pixel. // Includes #include <stdio.h> #include <math.h> #ifdef WITHGMP #include <gmp.h> #endif #ifdef WITHAVX #include <immintrin.h> #endif #define GLEW_STATIC #include <GL/glew.h> #include <GLFW/glfw3.h> #ifdef WITHOPENCL #include <CL/opencl.h> #include <CL/cl_gl.h> #include "CheckOpenCLError.h" #endif #include "structs.h" #include "GaussianBlur.h" #include "config.h" #include "GetWallTime.h" // Set pixels in r,g,b pointers based on final iteration value void SetPixelColour(const int iter, const int maxIters, float mag, float *r, float *g, float *b, const double colourPeriod); // Basic routine, using CPU. void RenderMandelbrotCPU(renderStruct *render, imageStruct *image); #ifdef WITHGMP // High precision routine using GMP void RenderMandelbrotGMPCPU(renderStruct *render, imageStruct *image); #endif #ifdef WITHAVX // AVX Vectorized void RenderMandelbrotAVXCPU(renderStruct *render, imageStruct *image); #endif #ifdef WITHOPENCL // OpenCL. Sets kernel arguments, acquires opengl texture, runs kernel, releases texture. // This function blocks until OpenCL has finished with the texture, and OpenGL is free to // use it. void RenderMandelbrotOpenCL(renderStruct *render, imageStruct *image); #endif
/*************************************************************************** * Copyright (C) 2008 by Sindre Aamås * * aamas@stud.ntnu.no * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License version 2 as * * published by the Free Software Foundation. * * * * 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 version 2 for more details. * * * * You should have received a copy of the GNU General Public License * * version 2 along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef STATESAVER_H #define STATESAVER_H #include "gbint.h" #include <string> namespace gambatte { struct SaveState; class StateSaver { StateSaver(); public: enum { SS_SHIFT = 2 }; enum { SS_DIV = 1 << 2 }; enum { SS_WIDTH = 160 >> SS_SHIFT }; enum { SS_HEIGHT = 144 >> SS_SHIFT }; static void saveState(const SaveState &state, const uint_least32_t *videoBuf, int pitch, const std::string &filename); static bool loadState(SaveState &state, const std::string &filename); }; } #endif
/* * Copyright 2010-2017 Intel Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, * as published by the Free Software Foundation. * * 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. * * Disclaimer: The codes contained in these modules may be specific to * the Intel Software Development Platform codenamed Knights Ferry, * and the Intel product codenamed Knights Corner, and are not backward * compatible with other Intel products. Additionally, Intel will NOT * support the codes or instruction set in future products. * * Intel offers no warranty of any kind regarding the code. This code is * licensed on an "AS IS" basis and Intel is not obligated to provide * any support, assistance, installation, training, or other services * of any kind. Intel is also not obligated to provide any updates, * enhancements or extensions. Intel specifically disclaims any warranty * of merchantability, non-infringement, fitness for any particular * purpose, and any other warranty. * * Further, Intel disclaims all liability of any kind, including but * not limited to liability for infringement of any proprietary rights, * relating to the use of the code, even if Intel is notified of the * possibility of such liability. Except as expressly stated in an Intel * license agreement provided with this code and agreed upon with Intel, * no license, express or implied, by estoppel or otherwise, to any * intellectual property rights is granted herein. */ #include<linux/module.h> #include<linux/init.h> #include<asm/io.h> #include <mic/mic_sbox_md.h> #include <mic/micsboxdefine.h> #define PR_PREFIX "SBOX:" extern void *mic_sbox_mmio_va; void *mic_sbox_md_init(void) { return mic_sbox_mmio_va; } void mic_sbox_md_uninit(void *mic_sbox_mmio_va) { iounmap(mic_sbox_mmio_va); pr_debug(PR_PREFIX "Uninitialized sbox md\n"); }
/* Ghost File System, or simply GhostFS Copyright (C) 2016 Péricles Lopes Machado This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #ifndef BASE_PROTOCOL_H #define BASE_PROTOCOL_H #include <stdint.h> #include <unordered_map> struct base_protocol { virtual ~base_protocol(){} virtual const char* name() = 0; virtual bool is_url_valid(const char* url) = 0; virtual uint64_t get_content_length_for_url(const char *url) = 0; // Return number of bytes stored in data, which cannot be greater than block_size. // Otherwise there would be an overflow on data. virtual size_t get_block(const char *url, size_t block_id, size_t block_size, const std::unordered_map<std::string, std::string>& attributes, char* data) = 0; }; // write_callback() may be called multiple times to fullfil a request, // so data_info is needed to keep track of the offset in data. struct data_info { void *data; size_t offset; size_t size; }; size_t write_callback(void *content_read, size_t size, size_t nmemb, void *p); struct base_protocol* get_handler(const char* path); void register_handler(struct base_protocol *handler); #endif // BASE_PROTOCOL_H
/* K&R2 1-23: Write a program to remove all comments from a C program. Don't forget to handle quoted strings and character constants properly. C comments do not nest. This solution does not deal with other special cases, such as trigraphs, line continuation with \, or <> quoting on #include, since these aren't mentioned up 'til then in K&R2. Perhaps this is cheating. Note that this program contains both comments and quoted strings of text that looks like comments, so running it on itself is a reasonable test. It also contains examples of a comment that ends in a star and a comment preceded by a slash. Note that the latter will break C99 compilers and C89 compilers with // comment extensions. Interface: The C source file is read from stdin and the comment-less output is written to stdout. **/ #include <stdio.h> int main(void) { #define PROGRAM 0 #define SLASH 1 #define COMMENT 2 #define STAR 3 #define QUOTE 4 #define LITERAL 5 /* State machine's current state, one of the above values. */ int state; /* If state == QUOTE, then ' or ". Otherwise, undefined. */ int quote; /* Input character. */ int c; state = PROGRAM; while ((c = getchar()) != EOF) { /* The following cases are in guesstimated order from most common to least common. */ if (state == PROGRAM || state == SLASH) { if (state == SLASH) { /* Program text following a slash. */ if (c == '*') state = COMMENT; else { putchar('/'); state = PROGRAM; } } if (state == PROGRAM) { /* Program text. */ if (c == '\'' || c == '"') { quote = c; state = QUOTE; putchar(c); } else if (c == "/*"[0]) state = SLASH; else putchar(c); } } else if (state == COMMENT) { /* Comment. */ if (c == "/*"[1]) state = STAR; } else if (state == QUOTE) { /* Within quoted string or character constant. */ putchar(c); if (c == '\\') state = LITERAL; else if (c == quote) state = PROGRAM; } else if (state == SLASH) { } else if (state == STAR) { /* Comment following a star. */ if (c == '/') state = PROGRAM; else if (c != '*') state = COMMENT; } else /* state == LITERAL */ { /* Within quoted string or character constant, following \. */ putchar(c); state = QUOTE; } } if (state == SLASH) putchar('/' //**/ 1); return 0; } /* Local variables: compile-command: "checkergcc -W -Wall -ansi -pedantic knr123-0.c -o knr123-0" End: */
/* * Copyright 2014 vincent Sanders <vince@netsurf-browser.org> * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf 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; version 2 of the License. * * NetSurf 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, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <ctype.h> #include <string.h> #include <strings.h> #include <gtk/gtk.h> #include "utils/hashtable.h" #include "utils/log.h" #include "utils/filepath.h" #include "utils/file.h" #include "utils/nsurl.h" #include "desktop/gui_fetch.h" #include "gtk/gui.h" #include "gtk/resources.h" #include "gtk/fetch.h" static struct hash_table *mime_hash = NULL; void gtk_fetch_filetype_init(const char *mimefile) { struct stat statbuf; FILE *fh = NULL; mime_hash = hash_create(117); /* first, check to see if /etc/mime.types in preference */ if ((stat("/etc/mime.types", &statbuf) == 0) && S_ISREG(statbuf.st_mode)) { mimefile = "/etc/mime.types"; } fh = fopen(mimefile, "r"); /* Some OSes (mentioning no Solarises) have a worthlessly tiny * /etc/mime.types that don't include essential things, so we * pre-seed our hash with the essentials. These will get * over-ridden if they are mentioned in the mime.types file. */ hash_add(mime_hash, "css", "text/css"); hash_add(mime_hash, "htm", "text/html"); hash_add(mime_hash, "html", "text/html"); hash_add(mime_hash, "jpg", "image/jpeg"); hash_add(mime_hash, "jpeg", "image/jpeg"); hash_add(mime_hash, "gif", "image/gif"); hash_add(mime_hash, "png", "image/png"); hash_add(mime_hash, "jng", "image/jng"); hash_add(mime_hash, "mng", "image/mng"); hash_add(mime_hash, "webp", "image/webp"); hash_add(mime_hash, "spr", "image/x-riscos-sprite"); if (fh == NULL) { LOG("Unable to open a mime.types file, so using a minimal one for you."); return; } while (!feof(fh)) { char line[256], *ptr, *type, *ext; if (fgets(line, 256, fh) == NULL) break; if (!feof(fh) && line[0] != '#') { ptr = line; /* search for the first non-whitespace character */ while (isspace(*ptr)) { ptr++; } /* is this line empty other than leading whitespace? */ if (*ptr == '\n' || *ptr == '\0') { continue; } type = ptr; /* search for the first non-whitespace char or NUL or * NL */ while (*ptr && (!isspace(*ptr)) && *ptr != '\n') { ptr++; } if (*ptr == '\0' || *ptr == '\n') { /* this mimetype has no extensions - read next * line. */ continue; } *ptr++ = '\0'; /* search for the first non-whitespace character which * will be the first filename extenion */ while (isspace(*ptr)) { ptr++; } while(true) { ext = ptr; /* search for the first whitespace char or * NUL or NL which is the end of the ext. */ while (*ptr && (!isspace(*ptr)) && *ptr != '\n') { ptr++; } if (*ptr == '\0' || *ptr == '\n') { /* special case for last extension on * the line */ *ptr = '\0'; hash_add(mime_hash, ext, type); break; } *ptr++ = '\0'; hash_add(mime_hash, ext, type); /* search for the first non-whitespace char or * NUL or NL, to find start of next ext. */ while (*ptr && (isspace(*ptr)) && *ptr != '\n') { ptr++; } } } } fclose(fh); } void gtk_fetch_filetype_fin(void) { hash_destroy(mime_hash); } const char *fetch_filetype(const char *unix_path) { struct stat statbuf; char *ext; const char *ptr; char *lowerchar; const char *type; int l; /* stat the path to attempt to determine if the file is special */ if (stat(unix_path, &statbuf) == 0) { /* stat suceeded so can check for directory */ if (S_ISDIR(statbuf.st_mode)) { return "application/x-netsurf-directory"; } } l = strlen(unix_path); /* Hacky RISC OS compatibility */ if ((3 < l) && (strcasecmp(unix_path + l - 4, ",f79") == 0)) { return "text/css"; } else if ((3 < l) && (strcasecmp(unix_path + l - 4, ",faf") == 0)) { return "text/html"; } else if ((3 < l) && (strcasecmp(unix_path + l - 4, ",b60") == 0)) { return "image/png"; } else if ((3 < l) && (strcasecmp(unix_path + l - 4, ",ff9") == 0)) { return "image/x-riscos-sprite"; } if (strchr(unix_path, '.') == NULL) { /* no extension anywhere! */ return "text/plain"; } ptr = unix_path + strlen(unix_path); while (*ptr != '.' && *ptr != '/') { ptr--; } if (*ptr != '.') { return "text/plain"; } ext = strdup(ptr + 1); /* skip the . */ /* the hash table only contains lower-case versions - make sure this * copy is lower case too. */ lowerchar = ext; while (*lowerchar) { *lowerchar = tolower(*lowerchar); lowerchar++; } type = hash_get(mime_hash, ext); free(ext); if (type == NULL) { type = "text/plain"; } return type; } static nsurl *nsgtk_get_resource_url(const char *path) { char buf[PATH_MAX]; nsurl *url = NULL; /* favicon.ico -> favicon.png */ if (strcmp(path, "favicon.ico") == 0) { nsurl_create("resource:favicon.png", &url); } else { netsurf_path_to_nsurl(filepath_sfind(respaths, buf, path), &url); } return url; } static struct gui_fetch_table fetch_table = { .filetype = fetch_filetype, .get_resource_url = nsgtk_get_resource_url, .get_resource_data = nsgtk_data_from_resname, }; struct gui_fetch_table *nsgtk_fetch_table = &fetch_table;
/* =========================================================================== Copyright (C) 1999-2005 Id Software, Inc. This file is part of Quake III Arena source code. Quake III Arena source code 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. Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ // /***************************************************************************** * name: ai_team.h * * desc: Quake3 bot AI * * $Archive: /source/code/botai/ai_chat.c $ * *****************************************************************************/ int BotGetTeamMateTaskPreference(bot_state_t *bs, int teammate); void BotSetTeamMateTaskPreference(bot_state_t *bs, int teammate, int preference); void BotVoiceChat(bot_state_t *bs, int toclient, char *voicechat); void BotVoiceChatOnly(bot_state_t *bs, int toclient, char *voicechat);
/**************************************************************** * * * Copyright 2001, 2004 Sanchez Computer Associates, Inc. * * * * This source code contains the intellectual property * * of its copyright holder(s), and is made available * * under a license. If you do not know the terms of * * the license, please stop and do not read further. * * * ****************************************************************/ #include "mdef.h" #include <arpa/inet.h> #include <netinet/in.h> #include <fcntl.h> #include <unistd.h> #include <signal.h> #include "mlkdef.h" #include "gtm_stdlib.h" #include "gtm_stdio.h" #include "gtm_string.h" #include "stp_parms.h" #include "iosp.h" #include "error.h" #include "cli.h" #include "stringpool.h" #include "interlock.h" #include "gtmimagename.h" #include "gdsroot.h" #include "gtm_facility.h" #include "fileinfo.h" #include "gdsbt.h" #include "gdsfhead.h" #include "gdskill.h" #include "gdscc.h" #include "filestruct.h" #include "jnl.h" #include "hashtab.h" #include "buddy_list.h" #include "tp.h" #include "repl_msg.h" #include "gtmsource.h" #include "util.h" #include "cache.h" #include "gt_timer.h" #include "lke.h" #include "lke_fileio.h" #include "dpgbldir.h" #include "get_page_size.h" #include "gtm_startup_chk.h" #include "generic_signal_handler.h" #include "init_secshr_addrs.h" #include "cli_parse.h" #include "getzdir.h" #include "getjobname.h" #include "getjobnum.h" #include "sig_init.h" #include "gtmmsg.h" #include "gtm_env_init.h" /* for gtm_env_init() prototype */ GBLREF VSIG_ATOMIC_T util_interrupt; GBLREF bool licensed; GBLREF void (*func)(void); GBLREF spdesc rts_stringpool, stringpool; GBLREF global_latch_t defer_latch; GBLREF enum gtmImageTypes image_type; GBLREF sgm_info *first_sgm_info; GBLREF cw_set_element cw_set[]; GBLREF unsigned char cw_set_depth; GBLREF uint4 process_id; GBLREF jnlpool_addrs jnlpool; GBLREF char cli_err_str[]; static bool lke_process(int argc); static void display_prompt(void); int main (int argc, char *argv[]) { image_type = LKE_IMAGE; gtm_env_init(); /* read in all environment variables */ licensed = TRUE; err_init(util_base_ch); sig_init(generic_signal_handler, lke_ctrlc_handler); atexit(util_exit_handler); SET_LATCH_GLOBAL(&defer_latch, LOCK_AVAILABLE); get_page_size(); stp_init(STP_INITSIZE); rts_stringpool = stringpool; getjobname(); init_secshr_addrs(get_next_gdr, cw_set, &first_sgm_info, &cw_set_depth, process_id, OS_PAGE_SIZE, &jnlpool.jnlpool_dummy_reg); getzdir(); prealloc_gt_timers(); gvinit(); region_init(TRUE); cache_init(); getjobnum(); cli_lex_setup(argc, argv); /* this should be after cli_lex_setup() due to S390 A/E conversion */ gtm_chk_dist(argv[0]); while (1) { if (!lke_process(argc)) break; } lke_exit(); } static bool lke_process(int argc) { bool flag = FALSE; int res; static int save_stderr = 2; error_def(ERR_CTRLC); ESTABLISH_RET(util_ch, TRUE); if (util_interrupt) rts_error(VARLSTCNT(1) ERR_CTRLC); if (save_stderr != 2) /* necesary in case of rts_error */ close_fileio(save_stderr); func = 0; util_interrupt = 0; if (argc < 2) display_prompt(); if ( EOF == (res = parse_cmd())) { if (util_interrupt) { rts_error(VARLSTCNT(1) ERR_CTRLC); REVERT; return TRUE; } else { REVERT; return FALSE; } } else if (res) { if (1 < argc) { REVERT; rts_error(VARLSTCNT(4) res, 2, LEN_AND_STR(cli_err_str)); } else gtm_putmsg(VARLSTCNT(4) res, 2, LEN_AND_STR(cli_err_str)); } if (func) { flag = open_fileio(&save_stderr); /* save_stderr = 2 if -output option not present */ func(); if (flag) close_fileio(save_stderr); } REVERT; return(1 >= argc); } static void display_prompt(void) { PRINTF("LKE> "); fflush(stdout); }
// Copyright (C) 2003 Dolphin Project. // 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, version 2.0. // 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 2.0 for more details. // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _ATOMIC_WIN32_H_ #define _ATOMIC_WIN32_H_ #include "Common.h" #include <intrin.h> #include <Windows.h> // Atomic operations are performed in a single step by the CPU. It is // impossible for other threads to see the operation "half-done." // // Some atomic operations can be combined with different types of memory // barriers called "Acquire semantics" and "Release semantics", defined below. // // Acquire semantics: Future memory accesses cannot be relocated to before the // operation. // // Release semantics: Past memory accesses cannot be relocated to after the // operation. // // These barriers affect not only the compiler, but also the CPU. // // NOTE: Acquire and Release are not differentiated right now. They perform a // full memory barrier instead of a "one-way" memory barrier. The newest // Windows SDK has Acquire and Release versions of some Interlocked* functions. namespace Common { inline void AtomicAdd(volatile u32& target, u32 value) { InterlockedExchangeAdd((volatile LONG*)&target, (LONG)value); } inline void AtomicAnd(volatile u32& target, u32 value) { _InterlockedAnd((volatile LONG*)&target, (LONG)value); } inline void AtomicIncrement(volatile u32& target) { InterlockedIncrement((volatile LONG*)&target); } inline void AtomicDecrement(volatile u32& target) { InterlockedDecrement((volatile LONG*)&target); } inline u32 AtomicLoad(volatile u32& src) { return src; // 32-bit reads are always atomic. } inline u32 AtomicLoadAcquire(volatile u32& src) { u32 result = src; // 32-bit reads are always atomic. _ReadBarrier(); // Compiler instruction only. x86 loads always have acquire semantics. return result; } inline void AtomicOr(volatile u32& target, u32 value) { _InterlockedOr((volatile LONG*)&target, (LONG)value); } inline void AtomicStore(volatile u32& dest, u32 value) { dest = value; // 32-bit writes are always atomic. } inline void AtomicStoreRelease(volatile u32& dest, u32 value) { _WriteBarrier(); // Compiler instruction only. x86 stores always have release semantics. dest = value; // 32-bit writes are always atomic. } } #endif
/* -*- Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */ /* * vmx.h: prototype for generial vmx related interface * Copyright (c) 2004, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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. * * Kun Tian (Kevin Tian) (kevin.tian@intel.com) */ #ifndef _ASM_IA64_VT_H #define _ASM_IA64_VT_H #include <public/hvm/ioreq.h> #include <asm/ia64_int.h> #define vmx_user_mode(regs) (((struct ia64_psr *)&(regs)->cr_ipsr)->vm == 1) #define VCPU_LID(v) (((u64)(v)->vcpu_id)<<24) extern void identify_vmx_feature(void); extern unsigned int vmx_enabled; extern void *vmx_init_env(void *start, unsigned long end_in_pa); extern int vmx_final_setup_guest(struct vcpu *v); extern void vmx_save_state(struct vcpu *v); extern void vmx_load_state(struct vcpu *v); extern int vmx_setup_platform(struct domain *d); extern void vmx_do_resume(struct vcpu *v); extern void vmx_io_assist(struct vcpu *v); extern IA64FAULT ia64_hypercall (struct pt_regs *regs); extern unsigned long __gpfn_to_mfn_foreign(struct domain *d, unsigned long gpfn); extern void set_privileged_operation_isr (struct vcpu *vcpu,int inst); extern void set_rsv_reg_field_isr (struct vcpu *vcpu); extern void vmx_relinquish_guest_resources(struct domain *d); extern void vmx_relinquish_vcpu_resources(struct vcpu *v); extern void vmx_send_assist_req(struct vcpu *v); extern void deliver_pal_init(struct vcpu *vcpu); extern void vmx_pend_pal_init(struct domain *d); extern void vmx_lazy_load_fpu(struct vcpu *vcpu); static inline vcpu_iodata_t *get_vio(struct vcpu *v) { struct domain *d = v->domain; shared_iopage_t *p = (shared_iopage_t *)d->arch.vmx_platform.ioreq.va; ASSERT((v == current) || spin_is_locked(&d->arch.vmx_platform.ioreq.lock)); ASSERT(d->arch.vmx_platform.ioreq.va != NULL); return &p->vcpu_iodata[v->vcpu_id]; } #endif /* _ASM_IA64_VT_H */
/* * $Id: sml.c,v 1.7 2006/05/30 04:37:13 darren Exp $ * * Copyright (c) 2002, Venkatesh Prasad Ranganath and Darren Hiebert * * This source code is released for free distribution under the terms of the * GNU General Public License. * * This module contains functions for generating tags for SML language files. */ /* * INCLUDE FILES */ #include "general.h" /* must always come first */ #include <string.h> #include "entry.h" #include "parse.h" #include "read.h" #include "vstring.h" /* * DATA DECLARATIONS */ typedef enum { K_AND = -2, K_NONE = -1, K_EXCEPTION, K_FUNCTION, K_FUNCTOR, K_SIGNATURE, K_STRUCTURE, K_TYPE, K_VAL } smlKind; /* * DATA DEFINITIONS */ static kindOption SmlKinds[] = { { TRUE, 'e', "exception", "exception declarations" }, { TRUE, 'f', "function", "function definitions" }, { TRUE, 'c', "functor", "functor definitions" }, { TRUE, 's', "signature", "signature declarations" }, { TRUE, 'r', "structure", "structure declarations" }, { TRUE, 't', "type", "type definitions" }, { TRUE, 'v', "value", "value bindings" } }; static struct { const char *keyword; smlKind kind; } SmlKeywordTypes [] = { { "abstype", K_TYPE }, { "and", K_AND }, { "datatype", K_TYPE }, { "exception", K_EXCEPTION }, { "functor", K_FUNCTOR }, { "fun", K_FUNCTION }, { "signature", K_SIGNATURE }, { "structure", K_STRUCTURE }, { "type", K_TYPE }, { "val", K_VAL } }; static unsigned int CommentLevel = 0; /* * FUNCTION DEFINITIONS */ static void makeSmlTag (smlKind type, vString *name) { tagEntryInfo tag; initTagEntry (&tag, vStringValue (name)); tag.kindName = SmlKinds [type].name; tag.kind = SmlKinds [type].letter; makeTagEntry (&tag); } static const unsigned char *skipSpace (const unsigned char *cp) { while (isspace ((int) *cp)) ++cp; return cp; } static boolean isIdentifier (int c) { boolean result = FALSE; /* Consider '_' as an delimiter to aid user in tracking it's usage. */ const char *const alternateIdentifiers = "!%&$#+-<>=/?@\\~'^|*_"; if (isalnum (c)) result = TRUE; else if (c != '\0' && strchr (alternateIdentifiers, c) != NULL) result = TRUE; return result; } static const unsigned char *parseIdentifier ( const unsigned char *cp, vString *const identifier) { boolean stringLit = FALSE; vStringClear (identifier); while (*cp != '\0' && (!isIdentifier ((int) *cp) || stringLit)) { int oneback = *cp; cp++; if (oneback == '(' && *cp == '*' && stringLit == FALSE) { CommentLevel++; return ++cp; } if (*cp == '"' && oneback != '\\') { stringLit = TRUE; continue; } if (stringLit && *cp == '"' && oneback != '\\') stringLit = FALSE; } if (strcmp ((const char *) cp, "") == 0 || cp == NULL) return cp; while (isIdentifier ((int) *cp)) { vStringPut (identifier, (int) *cp); cp++; } vStringTerminate (identifier); return cp; } static smlKind findNextIdentifier (const unsigned char **cp) { smlKind result = K_NONE; vString *const identifier = vStringNew (); unsigned int count = sizeof (SmlKeywordTypes) / sizeof (SmlKeywordTypes [0]); unsigned int i; *cp = parseIdentifier (*cp, identifier); for (i = 0 ; i < count && result == K_NONE ; ++i) { const char *id = vStringValue (identifier); if (strcmp (id, SmlKeywordTypes [i].keyword) == 0) result = SmlKeywordTypes [i].kind; } return result; } static void findSmlTags (void) { vString *const identifier = vStringNew (); const unsigned char *line; smlKind lastTag = K_NONE; while ((line = fileReadLine ()) != NULL) { const unsigned char *cp = skipSpace (line); do { smlKind foundTag; if (CommentLevel != 0) { cp = (const unsigned char *) strstr ((const char *) cp, "*)"); if (cp == NULL) continue; else { --CommentLevel; cp += 2; } } foundTag = findNextIdentifier (&cp); if (foundTag != K_NONE) { cp = skipSpace (cp); cp = parseIdentifier (cp, identifier); if (foundTag == K_AND) makeSmlTag (lastTag, identifier); else { makeSmlTag (foundTag, identifier); lastTag = foundTag; } } if (strstr ((const char *) cp, "(*") != NULL) { cp += 2; cp = (const unsigned char *) strstr ((const char *) cp, "*)"); if (cp == NULL) ++CommentLevel; } } while (cp != NULL && strcmp ((const char *) cp, "") != 0); } vStringDelete (identifier); } extern parserDefinition *SmlParser (void) { static const char *const extensions[] = { "sml", "sig", NULL }; parserDefinition *def = parserNew ("SML"); def->kinds = SmlKinds; def->kindCount = KIND_COUNT (SmlKinds); def->extensions = extensions; def->parser = findSmlTags; return def; } /* vi:set tabstop=4 shiftwidth=4: */
/* * Copyright (C) 2011-2014 Project SkyFire <http://www.projectskyfire.org/> * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2014 MaNGOS <http://getmangos.com/> * * 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 3 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, see <http://www.gnu.org/licenses/>. */ #ifndef SC_SCRIPTLOADER_H #define SC_SCRIPTLOADER_H void AddScripts(); void AddExampleScripts(); void AddSpellScripts(); void AddCommandScripts(); void AddWorldScripts(); void AddEasternKingdomsScripts(); void AddKalimdorScripts(); void AddOutlandScripts(); void AddNorthrendScripts(); void AddMaelstromScripts(); void AddEventScripts(); void AddPandariaScripts(); void AddDraenorScripts(); void AddPetScripts(); void AddBattlegroundScripts(); void AddOutdoorPvPScripts(); void AddCustomScripts(); #endif
void twofft(float data1[], float data2[], float fft1[], float fft2[], unsigned long n) { void four1(float data[], unsigned long nn, int isign); unsigned long nn3,nn2,jj,j; float rep,rem,aip,aim; nn3=1+(nn2=2+n+n); for (j=1,jj=2;j<=n;j++,jj+=2) { fft1[jj-1]=data1[j]; fft1[jj]=data2[j]; } four1(fft1,n,1); fft2[1]=fft1[2]; fft1[2]=fft2[2]=0.0; for (j=3;j<=n+1;j+=2) { rep=0.5*(fft1[j]+fft1[nn2-j]); rem=0.5*(fft1[j]-fft1[nn2-j]); aip=0.5*(fft1[j+1]+fft1[nn3-j]); aim=0.5*(fft1[j+1]-fft1[nn3-j]); fft1[j]=rep; fft1[j+1]=aim; fft1[nn2-j]=rep; fft1[nn3-j] = -aim; fft2[j]=aip; fft2[j+1] = -rem; fft2[nn2-j]=aip; fft2[nn3-j]=rem; } }
/* * arch/arm/include/asm/thread_info.h * * Copyright (C) 2002 Russell King. * Copyright (C) 2011, Red Bend Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __ASM_ARM_THREAD_INFO_H #define __ASM_ARM_THREAD_INFO_H #ifdef __KERNEL__ #include <linux/compiler.h> #include <asm/fpstate.h> #define THREAD_SIZE_ORDER 1 #define THREAD_SIZE 8192 #define THREAD_START_SP (THREAD_SIZE - 8) #ifndef __ASSEMBLY__ struct task_struct; struct exec_domain; #include <asm/types.h> #include <asm/domain.h> typedef unsigned long mm_segment_t; struct cpu_context_save { __u32 r4; __u32 r5; __u32 r6; __u32 r7; __u32 r8; __u32 r9; __u32 sl; __u32 fp; __u32 sp; __u32 pc; __u32 extra[2]; /* Xscale 'acc' register, etc */ }; /* * low level task data that entry.S needs immediate access to. * __switch_to() assumes cpu_context follows immediately after cpu_domain. */ struct thread_info { unsigned long flags; /* low level flags */ int preempt_count; /* 0 => preemptable, <0 => bug */ mm_segment_t addr_limit; /* address limit */ struct task_struct *task; /* main task structure */ struct exec_domain *exec_domain; /* execution domain */ __u32 cpu; /* cpu */ __u32 cpu_domain; /* cpu domain */ struct cpu_context_save cpu_context; /* cpu context */ __u32 syscall; /* syscall number */ __u8 used_cp[16]; /* thread used copro */ unsigned long tp_value; struct crunch_state crunchstate; union fp_state fpstate __attribute__((aligned(8))); union vfp_state vfpstate; #ifdef CONFIG_ARM_THUMBEE unsigned long thumbee_state; /* ThumbEE Handler Base register */ #endif struct restart_block restart_block; }; #ifdef CONFIG_NKERNEL #define INIT_THREAD_INFO(tsk) \ { \ .task = &tsk, \ .exec_domain = &default_exec_domain, \ .flags = 0, \ .preempt_count = INIT_PREEMPT_COUNT, \ .addr_limit = KERNEL_DS, \ .cpu_domain = domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ domain_val(DOMAIN_IO, DOMAIN_CLIENT) | \ domain_val(DOMAIN_NKVEC, DOMAIN_CLIENT), \ .restart_block = { \ .fn = do_no_restart_syscall, \ }, \ } #else #define INIT_THREAD_INFO(tsk) \ { \ .task = &tsk, \ .exec_domain = &default_exec_domain, \ .flags = 0, \ .preempt_count = INIT_PREEMPT_COUNT, \ .addr_limit = KERNEL_DS, \ .cpu_domain = domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ domain_val(DOMAIN_IO, DOMAIN_CLIENT), \ .restart_block = { \ .fn = do_no_restart_syscall, \ }, \ } #endif #define init_thread_info (init_thread_union.thread_info) #define init_stack (init_thread_union.stack) /* * how to get the thread information struct from C */ static inline struct thread_info *current_thread_info(void) __attribute_const__; static inline struct thread_info *current_thread_info(void) { register unsigned long sp asm ("sp"); return (struct thread_info *)(sp & ~(THREAD_SIZE - 1)); } #define thread_saved_pc(tsk) \ ((unsigned long)(task_thread_info(tsk)->cpu_context.pc)) #define thread_saved_sp(tsk) \ ((unsigned long)(task_thread_info(tsk)->cpu_context.sp)) #define thread_saved_fp(tsk) \ ((unsigned long)(task_thread_info(tsk)->cpu_context.fp)) extern void crunch_task_disable(struct thread_info *); extern void crunch_task_copy(struct thread_info *, void *); extern void crunch_task_restore(struct thread_info *, void *); extern void crunch_task_release(struct thread_info *); extern void iwmmxt_task_disable(struct thread_info *); extern void iwmmxt_task_copy(struct thread_info *, void *); extern void iwmmxt_task_restore(struct thread_info *, void *); extern void iwmmxt_task_release(struct thread_info *); extern void iwmmxt_task_switch(struct thread_info *); extern void vfp_sync_hwstate(struct thread_info *); extern void vfp_flush_hwstate(struct thread_info *); #ifdef CONFIG_SPRD_MEM_POOL #include <mach/sprd_mem_pool.h> #endif struct user_vfp; struct user_vfp_exc; extern int vfp_preserve_user_clear_hwstate(struct user_vfp __user *, struct user_vfp_exc __user *); extern int vfp_restore_user_hwstate(struct user_vfp __user *, struct user_vfp_exc __user *); #endif /* * We use bit 30 of the preempt_count to indicate that kernel * preemption is occurring. See <asm/hardirq.h>. */ #define PREEMPT_ACTIVE 0x40000000 /* * thread information flags: * TIF_SYSCALL_TRACE - syscall trace active * TIF_SIGPENDING - signal pending * TIF_NEED_RESCHED - rescheduling necessary * TIF_NOTIFY_RESUME - callback before returning to user * TIF_USEDFPU - FPU was used by this task this quantum (SMP) * TIF_POLLING_NRFLAG - true if poll_idle() is polling TIF_NEED_RESCHED */ #define TIF_SIGPENDING 0 #define TIF_NEED_RESCHED 1 #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ #define TIF_SYSCALL_TRACE 8 #define TIF_POLLING_NRFLAG 16 #define TIF_USING_IWMMXT 17 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ #define TIF_FREEZE 19 #define TIF_RESTORE_SIGMASK 20 #define TIF_SECCOMP 21 #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) #define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) #define _TIF_FREEZE (1 << TIF_FREEZE) #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) #define _TIF_SECCOMP (1 << TIF_SECCOMP) /* * Change these and you break ASM code in entry-common.S */ #define _TIF_WORK_MASK 0x000000ff #endif /* __KERNEL__ */ #endif /* __ASM_ARM_THREAD_INFO_H */
/**************************************************************** * * * Copyright 2001, 2003 Sanchez Computer Associates, Inc. * * * * This source code contains the intellectual property * * of its copyright holder(s), and is made available * * under a license. If you do not know the terms of * * the license, please stop and do not read further. * * * ****************************************************************/ #include "mdef.h" #include "gdsroot.h" /* needed for gdsfhead.h */ #include "gtm_facility.h" /* needed for gdsfhead.h */ #include "fileinfo.h" /* needed for gdsfhead.h */ #include "gdsbt.h" /* needed for gdsfhead.h */ #include "gdsfhead.h" #include "stringpool.h" #include "format_targ_key.h" GBLREF gv_key *gv_currkey; GBLREF spdesc stringpool; GBLREF mstr extnam_str; void get_reference(mval *var) { char *end, *start; char extnamdelim[] = "^|\"\"|"; char *extnamsrc, *extnamtop; int maxlen; /* you need to return a double-quote for every single-quote. assume worst case. */ maxlen = MAX_ZWR_KEY_SZ + (!extnam_str.len ? 0 : ((extnam_str.len * 2) + sizeof(extnamdelim))); if (stringpool.free + maxlen > stringpool.top) stp_gcol(maxlen); var->mvtype = MV_STR; start = var->str.addr = (char *)stringpool.free; var->str.len = 0; if (gv_currkey && gv_currkey->end) { if (extnam_str.len) { *start++ = extnamdelim[0]; *start++ = extnamdelim[1]; *start++ = extnamdelim[2]; extnamsrc = &extnam_str.addr[0]; extnamtop = extnamsrc + extnam_str.len; for ( ; extnamsrc < extnamtop; ) { *start++ = *extnamsrc; if ('"' == *extnamsrc++) /* caution : pointer increment side-effect */ *start++ = '"'; } *start++ = extnamdelim[3]; } end = (char *)format_targ_key((unsigned char *)start, MAX_ZWR_KEY_SZ, gv_currkey, TRUE); if (extnam_str.len) /* Note: the next vertical bar overwrites the caret that * was part of he original name of the global variable */ *start = extnamdelim[4]; var->str.len = end - var->str.addr; stringpool.free += var->str.len; } }
// GB Enhanced Copyright Daniel Baxter 2015 // Licensed under the GPLv2 // See LICENSE.txt for full license text // File : apu.h // Date : March 05, 2015 // Description : Game Boy Advance APU emulation // // Sets up SDL audio for mixing // Generates and mixes samples for the GBA's 4 sound channels + DMA channels #ifndef GBA_APU #define GBA_APU #include <SDL2/SDL.h> #include <SDL2/SDL_audio.h> #include "mmu.h" class AGB_APU { public: //Link to memory map AGB_MMU* mem; agb_apu_data apu_stat; SDL_AudioSpec desired_spec; AGB_APU(); ~AGB_APU(); bool init(); void reset(); void buffer_channels(); void buffer_channel_1(); void buffer_channel_2(); void buffer_channel_3(); void buffer_channel_4(); void generate_channel_1_samples(s16* stream, int length); void generate_channel_2_samples(s16* stream, int length); void generate_channel_3_samples(s16* stream, int length); void generate_channel_4_samples(s16* stream, int length); void generate_dma_a_samples(s16* stream, int length); void generate_dma_b_samples(s16* stream, int length); //Serialize data for save state loading/saving bool apu_read(u32 offset, std::string filename); bool apu_write(std::string filename); u32 size(); }; /****** SDL Audio Callback ******/ void agb_audio_callback(void* _apu, u8 *_stream, int _length); #endif // GBA_APU
/* * Copyright (C) 2004-2022 by the Widelands Development Team * * 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, see <https://www.gnu.org/licenses/>. * */ #ifndef WL_ECONOMY_SUPPLY_H #define WL_ECONOMY_SUPPLY_H #include "economy/trackptr.h" #include "logic/map_objects/tribes/wareworker.h" #include "logic/widelands.h" namespace Widelands { struct PlayerImmovable; class Game; class Request; class Warehouse; class WareInstance; class Worker; enum class SupplyProviders { kWarehouse, kFlagOrRoad, kShip }; /** * A Supply is a virtual base class representing something that can offer * wares of any type for any purpose. * * Subsequent calls to get_position() can return different results. * If a Supply is "active", it should be transferred to a possible Request * quickly. Basically, supplies in warehouses (or unused supplies that are * being carried into a warehouse) are inactive, and supplies that are just * sitting on a flag are active. * * Important note: The implementation of Supply is responsible for adding * and removing itself from Economies. This rule holds true for Economy * changes. */ struct Supply : public Trackable { virtual PlayerImmovable* get_position(Game&) = 0; /** * Indicates whether this supply is active as explained above (out * on the road network). */ virtual bool is_active() const = 0; /** * Return the type of player im/movable where the ware is now (warehouse, * flag or ship). */ virtual SupplyProviders provider_type(Game*) const = 0; /** * Indicates whether this supply is in storage or on its way to * storage. * * If this is \c false, somebody needs to find this supply a warehouse. */ virtual bool has_storage() const = 0; /** * Gets the ware type of this supply. * * \note This is only valid if \ref has_storage returns \c false. */ virtual void get_ware_type(WareWorker& type, DescriptionIndex& ware) const = 0; /** * Send this to the given warehouse. * * Sets up all the required transfers; assumes that \ref has_storage * returns \c false. */ virtual void send_to_storage(Game&, Warehouse* wh) = 0; /** * \return the number of wares or workers that can be launched right * now for the thing requested by the given request */ virtual uint32_t nr_supplies(const Game&, const Request&) const = 0; /** * Prepare an ware to satisfy the given request. Note that the caller * must assign a transfer to the launched ware. * * \throw wexception if the request is not an ware request or no such * ware is available in the supply. */ virtual WareInstance& launch_ware(Game&, const Request&) = 0; /** * Prepare a worker to satisfy the given request. Note that the caller * must assign a transfer to the launched ware. * * \throw wexception if the request is not a worker request or no such * worker is available in the supply. */ virtual Worker& launch_worker(Game&, const Request&) = 0; }; } // namespace Widelands #endif // end of include guard: WL_ECONOMY_SUPPLY_H
/* * The implementation of the TRM.generateTRM methods * * author Christian Pesch */ #include "trm_wrapper.h" /* * Utility procedures. */ void setLongJavaMember(JNIEnv *env, jobject obj, char *field, unsigned long value) { jclass cls = (*env)->GetObjectClass(env, obj); jfieldID fid = (*env)->GetFieldID(env, cls, field, "J"); if(fid == 0) { return; } (*env)->SetLongField(env, obj, fid, value); } void setStringJavaMember(JNIEnv * env, jobject obj, char * field, char * value) { jstring string = (*env)->NewStringUTF(env, value); jclass cls = (*env)->GetObjectClass(env, obj); jfieldID fid = (*env)->GetFieldID(env, cls, field, "Ljava/lang/String;"); if(fid == 0) { return; } (*env)->SetObjectField(env, obj, fid, string); } /* ----------------------------------------------------------------------- */ /* Convert utf8-string to ucs1-string */ /* ----------------------------------------------------------------------- */ char* utf2ucs(const char *utf8, char *ucs, size_t n) { const char *pin; char *pout; unsigned char current, next; int i; for (i=0,pin=utf8,pout=ucs; i < n && *pin; i++,pin++,pout++) { current = *pin; if (current >= 0xE0) { /* we support only two-byte utf8 */ return NULL; } else if ((current & 0x80) == 0) /* one-byte utf8 */ *pout = current; else { /* two-byte utf8 */ next = *(++pin); if (next >= 0xC0) { /* illegal coding */ return NULL; } *pout = ((current & 3) << 6) + /* first two bits of first byte */ (next & 63); /* last six bits of second byte */ } } if (i < n) *pout = '\0'; return ucs; } JNIEXPORT jint JNICALL Java_org_metamusic_trm_TRM_generateTRMforMP3 (JNIEnv *javaEnv, jclass javaClass, jstring fileName, jlong durationL, jstring proxyServer, jint proxyPort, jobject result) { const char *file_name; const char *proxy_server; char signature[37]; unsigned long duration = durationL; int ret; file_name = (*javaEnv)->GetStringUTFChars(javaEnv, fileName, 0); proxy_server = (*javaEnv)->GetStringUTFChars(javaEnv, proxyServer, 0); // printf("file_name %s\n", file_name); ret = MP3_generateTRM(file_name, signature, &duration, proxy_server, proxyPort); // printf("duration %lu\n", duration); setLongJavaMember(javaEnv, result, "duration", duration); setStringJavaMember(javaEnv, result, "signature", signature); (*javaEnv)->ReleaseStringUTFChars(javaEnv, fileName, file_name); if(proxyServer != NULL) (*javaEnv)->ReleaseStringUTFChars(javaEnv, proxyServer, proxy_server); return ret; } JNIEXPORT jint JNICALL Java_org_metamusic_trm_TRM_generateTRMforWAV (JNIEnv *javaEnv, jclass javaClass, jstring fileName, jlong durationL, jstring proxyServer, jint proxyPort, jobject result) { const char *file_name; const char *proxy_server; char signature[37]; unsigned long duration = durationL; int ret; file_name = (*javaEnv)->GetStringUTFChars(javaEnv, fileName, 0); proxy_server = (*javaEnv)->GetStringUTFChars(javaEnv, proxyServer, 0); ret = Wav_generateTRM(file_name, signature, &duration, proxy_server, proxyPort); setLongJavaMember(javaEnv, result, "duration", duration); setStringJavaMember(javaEnv, result, "signature", signature); (*javaEnv)->ReleaseStringUTFChars(javaEnv, fileName, file_name); if(proxyServer != NULL) (*javaEnv)->ReleaseStringUTFChars(javaEnv, proxyServer, proxy_server); return ret; } JNIEXPORT jint JNICALL Java_org_metamusic_trm_TRM_generateTRMforOggVorbis (JNIEnv *javaEnv, jclass javaClass, jstring fileName, jlong durationL, jstring proxyServer, jint proxyPort, jobject result) { const char *file_name; const char *proxy_server; char signature[37]; unsigned long duration = durationL; int ret; file_name = (*javaEnv)->GetStringUTFChars(javaEnv, fileName, 0); proxy_server = (*javaEnv)->GetStringUTFChars(javaEnv, proxyServer, 0); ret = OggVorbis_generateTRM(file_name, signature, &duration, proxy_server, proxyPort); setLongJavaMember(javaEnv, result, "duration", duration); setStringJavaMember(javaEnv, result, "signature", signature); (*javaEnv)->ReleaseStringUTFChars(javaEnv, fileName, file_name); if(proxyServer != NULL) (*javaEnv)->ReleaseStringUTFChars(javaEnv, proxyServer, proxy_server); return ret; }
#ifndef STYLEIMAGE_H #define STYLEIMAGE_H #include "style_global.h" #include "global/global.h" #include <QString> class StyleLine; class StyleFill; class STYLESHARED_EXPORT StyleImage { public: StyleImage(); void setScaleX(QString scaleX) {this->scaleX = scaleX.TOQREAL();} void setScaleY(QString scaleY) {this->scaleY = scaleY.TOQREAL();} void setScaleType(QString scaleType) {this->scaleType = scaleType.TOBOOL();} void setAspectRatio(QString aspectRatio) {this->aspectRatio = aspectRatio.TOBOOL();} void setLowResType(QString lowResType) {this->lowResType = lowResType.toInt();} void setUseEmbeddedPath(QString useEmbeddedPath) {this->useEmbeddedPath = useEmbeddedPath.TOBOOL();} StyleLine *getLine() {return line;} StyleFill *getFill() {return fill;} protected: qreal scaleX; qreal scaleY; bool scaleType; bool aspectRatio; int lowResType; bool useEmbeddedPath; StyleLine *line; StyleFill *fill; }; #endif // STYLEIMAGE_H