code
stringlengths
1
2.06M
language
stringclasses
1 value
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * t...
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the Lic...
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the Lic...
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the Lic...
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the Lic...
C++
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MP...
C++
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MP...
C++
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MP...
C++
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
C++
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
C++
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
C++
/* ** ** Copyright 2009, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by appl...
C++
/* ** ** Copyright 2009, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by appl...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
// Simplified Nintendo Game Boy PAPU sound chip emulator // Gb_Snd_Emu 0.1.4. Copyright (C) 2003-2005 Shay Green. GNU LGPL license. #ifndef BASIC_GB_APU_H #define BASIC_GB_APU_H #include "gb_apu/Gb_Apu.h" #include "gb_apu/Multi_Buffer.h" class Basic_Gb_Apu { public: Basic_Gb_Apu(); ~Basic_Gb_Apu(); // Set out...
C++
// Gb_Snd_Emu 0.1.4. http://www.slack.net/~ant/libs/ #include "Wave_Writer.h" #include <assert.h> #include <stdlib.h> /* Copyright (C) 2003-2005 by Shay Green. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal i...
C++
// Nintendo Game Boy PAPU sound chip emulator // Gb_Snd_Emu 0.1.4. Copyright (C) 2003-2005 Shay Green. GNU LGPL license. #ifndef GB_APU_H #define GB_APU_H typedef long gb_time_t; // clock cycle count typedef unsigned gb_addr_t; // 16-bit address #include "Gb_Oscs.h" class Gb_Apu { public: Gb_Apu(); ~Gb_Apu(...
C++
// Blip_Buffer 0.3.4. http://www.slack.net/~ant/libs/ #include "Multi_Buffer.h" /* Copyright (C) 2003-2005 Shay Green. This module is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of th...
C++
// Multi-channel sound buffer interface, and basic mono and stereo buffers // Blip_Buffer 0.3.4. Copyright (C) 2003-2005 Shay Green. GNU LGPL license. #ifndef MULTI_BUFFER_H #define MULTI_BUFFER_H #include "Blip_Buffer.h" // Interface to one or more Blip_Buffers mapped to one or more channels // consisting of left...
C++
// Blip_Buffer 0.3.4. http://www.slack.net/~ant/libs/ #include "Blip_Buffer.h" #include <string.h> #include <stddef.h> #include <math.h> /* Copyright (C) 2003-2005 Shay Green. This module is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published...
C++
// Gb_Snd_Emu 0.1.4. http://www.slack.net/~ant/libs/ #include "Gb_Apu.h" #include <string.h> /* Copyright (C) 2003-2005 Shay Green. This module is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either ver...
C++
// Buffer of sound samples into which band-limited waveforms can be synthesized // using Blip_Wave or Blip_Synth. // Blip_Buffer 0.3.4. Copyright (C) 2003-2005 Shay Green. GNU LGPL license. #ifndef BLIP_BUFFER_H #define BLIP_BUFFER_H #include "blargg_common.h" class Blip_Reader; // Source time unit. typedef long ...
C++
// By default, #included at beginning of library source files // Copyright (C) 2005 Shay Green. #ifndef BLARGG_SOURCE_H #define BLARGG_SOURCE_H // If debugging is enabled, abort program if expr is false. Meant for checking // internal state and consistency. A failed assertion indicates a bug in the module. // void ...
C++
// Gb_Snd_Emu 0.1.4. http://www.slack.net/~ant/libs/ #include "Gb_Apu.h" #include <string.h> /* Copyright (C) 2003-2005 Shay Green. This module is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either ver...
C++
// Blip_Synth and Blip_Wave are waveform transition synthesizers for adding // waveforms to a Blip_Buffer. // Blip_Buffer 0.3.4. Copyright (C) 2003-2005 Shay Green. GNU LGPL license. #ifndef BLIP_SYNTH_H #define BLIP_SYNTH_H #ifndef BLIP_BUFFER_H #include "Blip_Buffer.h" #endif // Quality level. Higher levels are...
C++
// Gb_Snd_Emu 0.1.4. http://www.slack.net/~ant/libs/ #include "Basic_Gb_Apu.h" /* Copyright (C) 2003-2005 Shay Green. This module is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the...
C++
// Use Basic_Gb_Apu to play random tones. Writes output to sound file "out.wav". #include "Basic_Gb_Apu.h" #include "Wave_Writer.h" #include <stdlib.h> static Basic_Gb_Apu apu; // "emulate" 1/60 second of sound static void emulate_frame() { static int delay; if ( --delay <= 0 ) { delay = 12; // Start a n...
C++
// Gb_Snd_Emu 0.1.4. http://www.slack.net/~ant/ #include "Sound_Queue.h" #include <assert.h> #include <string.h> /* Copyright (C) 2005 by Shay Green. Permission is hereby granted, free of charge, to any person obtaining a copy of this software module and associated documentation files (the "Software"), to deal in t...
C++
// WAVE sound file writer for recording 16-bit output during program development // Copyright (C) 2003-2004 Shay Green. MIT license. #ifndef WAVE_WRITER_HPP #define WAVE_WRITER_HPP #include <stddef.h> #include <stdio.h> class Wave_Writer { public: typedef short sample_t; // Create sound file with given sample ...
C++
// Simple sound queue for synchronous sound handling in SDL // Copyright (C) 2005 Shay Green. MIT license. #ifndef SOUND_QUEUE_H #define SOUND_QUEUE_H #include "SDL.h" // Simple SDL sound wrapper that has a synchronous interface class Sound_Queue { public: Sound_Queue(); ~Sound_Queue(); // Initialize with spe...
C++
// Use Sound_Queue to play APU sound using SDL #include "Basic_Gb_Apu.h" #include "Sound_Queue.h" #include "SDL.h" #include <stdlib.h> static Basic_Gb_Apu apu; // "emulate" 1/60 second of sound static void emulate_frame() { static int delay; if ( --delay <= 0 ) { delay = 12; // Start a new random tone ...
C++
// Boost substitute. For full boost library see http://boost.org #ifndef BOOST_CSTDINT_HPP #define BOOST_CSTDINT_HPP #if BLARGG_USE_NAMESPACE #include <climits> #else #include <limits.h> #endif BLARGG_BEGIN_NAMESPACE( boost ) #if UCHAR_MAX != 0xFF || SCHAR_MAX != 0x7F # error "No suitable 8-bit type available"...
C++
// Boost substitute. For full boost library see http://boost.org #ifndef BOOST_STATIC_ASSERT_HPP #define BOOST_STATIC_ASSERT_HPP #if defined (_MSC_VER) && _MSC_VER <= 1200 // MSVC6 can't handle the ##line concatenation #define BOOST_STATIC_ASSERT( expr ) struct { int n [1 / ((expr) ? 1 : 0)]; } #else #define BOO...
C++
// Boost substitute. For full boost library see http://boost.org #ifndef BOOST_CONFIG_HPP #define BOOST_CONFIG_HPP #define BOOST_MINIMAL 1 #define BLARGG_BEGIN_NAMESPACE( name ) #define BLARGG_END_NAMESPACE #endif
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hop...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that i...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that i...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that i...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the h...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
/* This file is part of gbpablog. gbpablog 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. gbpablog is distributed in the hope that...
C++
#include <iostream> class Errors { private: int liczba_bledow; public: int getLiczbaBledow() { return liczba_bledow; } double blad(const char* s) { std::cerr << "blad: " << s << '\n'; liczba_bledow++; return 1; } ...
C++
// kalkulator #include <iostream> #include <strstream> #include <ctype.h> #include <math.h> using namespace std; /************* typy i zmienne globalne ***********/ enum wartosc_symbolu { NAZWA, LICZBA, KONIEC, PLUS='+', MINUS='-', MNOZ='*', DZIEL='/', POTEGA='^', DRUK=';', PRZYPIS='=',LN='(', PN=...
C++
#include <vector> #include <string> #include <iostream> #include "Errors.cpp" using namespace std; class nazwa { private: string napis; double wartosc; public: nazwa(string text,double value) { napis=text; wartosc=value; } double getWartos...
C++
#include <iostream> #include <strstream> #include "Inter.cpp" #include <ctype.h> #include <math.h> using namespace std; int main(int argc, char* argv[]) { Inter i; Errors e; switch(argc) { case 1: // czytaj ze standardowego pliku wejsciowego break; case 2: // czytaj napis argumentow //...
C++
#include <iostream> #include <strstream> #include "Lista.cpp" #include <ctype.h> #include <math.h> using namespace std; enum wartosc_symbolu { NAZWA, LICZBA, KONIEC, PLUS='+', MINUS='-', MNOZ='*', DZIEL='/', POTEGA='^', DRUK=';', PRZYPIS='=',LN='(', PN=')' }; class Inter { private: warto...
C++
// stdafx.cpp : source file that includes just the standard includes // test.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file
C++
// test.cpp : Defines the entry point for the console application. // #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { Hello return 0; }
C++
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli...
C++
/* ** MEMWATCH.H ** Nonintrusive ANSI C memory leak / overwrite detection ** Copyright (C) 1992-2002 Johan Lindh ** All rights reserved. ** Version 2.71 ** ************************************************************************ ** ** PURPOSE: ** ** MEMWATCH has been written to allow guys and gals that like to ** pro...
C++
/* lex.cpp - implement lexing. * * Lex acts like a global singleton that retains in-memory copies * of ****/ #include "lex.h" #include <fstream> // keep constants in private namespace namespace { const size_t IO_SIZE = (1024*16); // grow by this much, as needed const siz...
C++
#include "common.h" #include <string> #include <map> #include <memory> struct TToken; class LexedFile { char* Load(const char* Filename); friend class Lex; LexedFile(const char* Filename); private: ~LexedFile(); LexedFile(const LexedFile& Other); // disall...
C++
#ifndef COMMON_H_ #define COMMON_H_ /* common.h - header file with information most files need. * * This should be included first by every .h and .c file. That ensures * an opportunity to make early tweaks, such as is needed by Microsoft C++ * for memory debugging. */ //#include "microsoft.h" // should b...
C++
#ifdef _MSC_VER #include "common.h" void MicrosoftDebug() { _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF /*| _CRTDBG_CHECK_CRT_DF */); _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); _CrtSetReportMode(_CRT_WARN, _CRTDBG...
C++
/* globals.cpp - source for Global. */ #include "common.h" Global::OptionBag Global::Options = { -1, // ExpectCode -1, // ExpectLine 0, // TabStop 0, // VerboseFlag false, // TokenizeFlag NULL, ...
C++
#include "common.h" void Dump(const char* Format, ...) { va_list ArgPtr; if(Global::Dump()) { assert(Format != NULL); va_start(ArgPtr, Format); vfprintf(stdout, Format, ArgPtr); va_end(ArgPtr); fflush(stdout); } } void Dump...
C++
#include "common.h" #include "file.h" File::File() : Buffer(nullptr), Filename(nullptr) { printf("Construct file!\n"); } File::~File() { printf("Destruct file!\n"); if(Buffer) free(Buffer); }
C++
/* main.cpp - entry point for BLACC (Burk Labs' Anachronistic Compiler Compiler) * * BLACC is designed to be a parser generator that I can easily bend * to whatever inconvenient need I have. */ #include "common.h" #include "lex.h" #include <stdio.h> #include <thread> #include <stack> static TTokenized...
C++
#ifndef SYMBOL_H_ #define SYMBOL_H_ /* symbol.h - define core data type. * * SYMBOL is an opaque pointer representing an instance of a symbol * (terminal, non-terminal, or action). There may be one or more * instances for a given symbol; an instance basically refers to a * specific textual occurrence in the...
C++
#ifndef FILE_H_ #define FILE_H_ #include <memory> #include <string> using namespace std; class File { public: File(); ~File(); char* Load(const char* Filename); private: File(const File& Other); // disallow: private and no definition File& operator=(const File& O...
C++
#ifndef LEX_H_ #define LEX_H_ #include "common.h" #include <limits.h> // a pox on C++'s limits framework! //#include <functional> #include <map> #include <memory> #include <new> #include <vector> /* TToken - a token type. * * Tokens need to be relatively small and cheap since we will be storing ...
C++
#ifndef DRIVE_H_ #define DRIVE_H_ #include "WPILib.h" #include "GlobalInclude.h" class Drive { public: Drive(); virtual ~Drive(); void printLeft(void); void jagDebug(int); void printRight(void); /* CANJaguar *leftJag;// CAN attached Jag for the Left1 motor **** 2 CANJaguar *rightJag;// CAN attache...
C++
#ifndef ARM_H_ #define ARM_H_ #include "WPILib.h" #include "DoubleSolenoid.h" #include "GlobalInclude.h" #include "PIDCalculator.h" #include "OperatorInterface.h" class Arm { public: Arm(OperatorInterface *oiArmX); //void jagDebug(int); virtual ~Arm(); void liftInit(void); OperatorInterface *oiAr...
C++
#ifndef PHOTOSWITCH_H_ #define PHOTOSWITCH_H_ #include "WPIlib.h" #include "GlobalInclude.h" #include "Sensor.h" class PhotoSwitch { public: PhotoSwitch(Drive *y); ~PhotoSwitch(void); int onLight(void); int onDark(void); int onDark1(void); int onDark3(void); int allLight(void); int all...
C++
#include "WPILib.h" #include "GlobalInclude.h" //#include "CANJaguar.h" #include "PhotoSwitch.h" #include "Drive.h" #include "OperatorInterface.h" #include "PIDCalculator.h" #include "Arm.h" #define waitTime 0.01//try 0.05 or 0.1 class CANRobotDemo : public IterativeRobot { Drive *dr; OperatorInterfac...
C++
#ifndef SENSOR_H_ #define SENSOR_H_ #include "WPILib.h" #include "GlobalInclude.h" #include "PIDCalculator.h" #include "Drive.h" class Sensor { public: Sensor(Drive *z); virtual ~Sensor(); Drive *sensorDrive; Gyro *gyro; PIDCalculator *calc; PIDController *pid; void gyroSubroutine(int); float ...
C++
#include "Sensor.h" Sensor::Sensor(Drive *z) { sensorDrive = z; gyro = new Gyro(1); calc = new PIDCalculator(); pid = new PIDController(0.0625,0.003,0,gyro,calc); pid->SetInputRange(-360,360);//-360 degrees to 360 degrees pid->SetTolerance(0.15);//tolerance is 0.15% of total range pid->SetOutputRan...
C++
#include "Arm.h" #define manual 1 #define armGain 0.4 #define liftGain 0.5 Arm::Arm(OperatorInterface *oiArmX) { oiArm = oiArmX; lift1 = new Jaguar(5); lift2 = new Jaguar(6); arm = new Jaguar(7); liftEnc = new Encoder(7,8); liftEnc->SetDistancePerPulse(1); liftEnc->Start(); //armEnc = new...
C++
#include "OperatorInterface.h" OperatorInterface::OperatorInterface() { leftStick = new Joystick(1); rightStick = new Joystick(2); ds = DriverStation::GetInstance(); lcd = DriverStationLCD::GetInstance(); estop = new Joystick(3); } void OperatorInterface::updateButtons() { #if oiExperimental == 1 ...
C++
#include "PIDCalculator.h" PIDCalculator::PIDCalculator() { printf("PIDCalculator Initialized"); pidOutput = 0; } PIDCalculator::~PIDCalculator() { printf("PIDCalculator Deconstructor Called"); //delete instance; //instance = NULL; } float PIDCalculator::getOutput() { return pidOutput; } void PI...
C++
#include "WPILib.h" #include "Drive.h" Drive::Drive() { /* leftJag = new CANJaguar(5); // These must be initialized in the same order rightJag = new CANJaguar(3); // as they are declared above. leftJag2 = new CANJaguar(4); rightJag2 = new CANJaguar(2); */ leftJag = new Jaguar(4); // These must be ini...
C++
#ifndef PIDCALCULATOR_H_ #define PIDCALCULATOR_H_ #include "WPILib.h" #include "GlobalInclude.h" class PIDCalculator : public PIDOutput { public: //static PIDCalculator* PIDCalculator::instance; PIDCalculator(); virtual ~PIDCalculator(); virtual void PIDWrite(float output); virtual float getOutput...
C++
#ifndef OPERATORINTERFACE_H_ #define OPERATORINTERFACE_H_ #include "WPILib.h" #include "GlobalInclude.h" class OperatorInterface { public: OperatorInterface(); virtual ~OperatorInterface(); void updateButtons(void); Joystick *leftStick; // left joystick Joystick *rightStick; DriverStation *ds; D...
C++