content
stringlengths
6
1.05M
obf_code
stringlengths
6
1.05M
probability
float64
0
1
obf_dict
stringlengths
0
25.3k
#ifndef STORM_LOGIC_COMPARISONTYPE_H_ #define STORM_LOGIC_COMPARISONTYPE_H_ #include <iostream> #include "storm/utility/macros.h" #include "storm/exceptions/IllegalArgumentException.h" namespace storm { namespace logic { enum class ComparisonType { Less, LessEqual, Greater, GreaterEqual }; inline bool isStrict(ComparisonType t) { return (t == ComparisonType::Less || t == ComparisonType::Greater); } inline bool isLowerBound(ComparisonType t) { return (t == ComparisonType::Greater || t == ComparisonType::GreaterEqual); } inline ComparisonType invert(ComparisonType t) { switch(t) { case ComparisonType::Less: return ComparisonType::GreaterEqual; case ComparisonType::LessEqual: return ComparisonType::Greater; case ComparisonType::Greater: return ComparisonType::LessEqual; case ComparisonType::GreaterEqual: return ComparisonType::Less; } STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Unknown ComparisonType"); } inline ComparisonType invertPreserveStrictness(ComparisonType t) { switch(t) { case ComparisonType::Less: return ComparisonType::Greater; case ComparisonType::LessEqual: return ComparisonType::GreaterEqual; case ComparisonType::Greater: return ComparisonType::Less; case ComparisonType::GreaterEqual: return ComparisonType::LessEqual; } STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Unknown ComparisonType"); } std::ostream& operator<<(std::ostream& out, ComparisonType const& comparisonType); } } #endif /* STORM_LOGIC_COMPARISONTYPE_H_ */
#ifndef VAR_0 #define VAR_0 #include <IMPORT_0> #include "IMPORT_1" #include "storm/exceptions/IllegalArgumentException.h" CLASS_0 VAR_1 { CLASS_0 logic { enum CLASS_1 VAR_2 { VAR_3, VAR_4, VAR_5, VAR_6 }; inline bool FUNC_0(CLASS_2 t) { return (t == VAR_2::VAR_3 || t == VAR_2::VAR_5); } inline bool isLowerBound(CLASS_2 t) { return (t == VAR_2::VAR_5 || t == VAR_2::VAR_6); } inline CLASS_2 invert(CLASS_2 t) { switch(t) { case VAR_2::Less: return VAR_2::VAR_6; case VAR_2::LessEqual: return VAR_2::VAR_5; case VAR_2::Greater: return VAR_2::VAR_4; case VAR_2::GreaterEqual: return VAR_2::VAR_3; } FUNC_1(false, VAR_1::VAR_7::VAR_8, "Unknown ComparisonType"); } inline CLASS_2 FUNC_2(CLASS_2 t) { switch(t) { case VAR_2::Less: return VAR_2::VAR_5; case VAR_2::LessEqual: return VAR_2::VAR_6; case VAR_2::Greater: return VAR_2::VAR_3; case VAR_2::GreaterEqual: return VAR_2::VAR_4; } FUNC_1(false, VAR_1::VAR_7::VAR_8, "Unknown ComparisonType"); } std::VAR_9& VAR_10<<(std::VAR_9& out, VAR_2 VAR_11& comparisonType); } } #endif /* STORM_LOGIC_COMPARISONTYPE_H_ */
0.875527
{'VAR_0': 'STORM_LOGIC_COMPARISONTYPE_H_', 'IMPORT_0': 'iostream', 'IMPORT_1': 'storm/utility/macros.h', 'CLASS_0': 'namespace', 'VAR_1': 'storm', 'CLASS_1': 'class', 'VAR_2': 'ComparisonType', 'CLASS_2': 'ComparisonType', 'VAR_3': 'Less', 'VAR_4': 'LessEqual', 'VAR_5': 'Greater', 'VAR_6': 'GreaterEqual', 'FUNC_0': 'isStrict', 'FUNC_1': 'STORM_LOG_THROW', 'VAR_7': 'exceptions', 'VAR_8': 'IllegalArgumentException', 'FUNC_2': 'invertPreserveStrictness', 'VAR_9': 'ostream', 'VAR_10': 'operator', 'VAR_11': 'const'}
// change most of these to inline and put them here: bool inline MakeSureCornersAnticlockwise() { f64_vec2 pos0, pos1, pos2; this->MapLeftIfNecessary(pos0, pos1, pos2); f64_vec2 vec01 = pos1 - pos0; f64_vec2 vec02 = pos2 - pos0; f64 cross = vec01.x*vec02.y - vec01.y*vec02.x; if (cross < 0.0) { Vertex * temp = cornerptr[1]; cornerptr[1] = cornerptr[2]; cornerptr[2] = temp; return true; }; return false; }
// change most of these to inline and put them here: bool inline MakeSureCornersAnticlockwise() { f64_vec2 pos0, pos1, pos2; this->MapLeftIfNecessary(pos0, pos1, pos2); f64_vec2 vec01 = pos1 - pos0; f64_vec2 vec02 = pos2 - pos0; f64 cross = vec01.x*vec02.y - vec01.y*vec02.x; if (cross < 0.0) { Vertex * temp = cornerptr[1]; cornerptr[1] = cornerptr[2]; cornerptr[2] = temp; return true; }; return false; }
0.110298
{}
/* Write function prototype for pass_by_val_and_ref with a value int and ref int parameter. */ /* Write function prototype for pass_by_const_ref with const int reference parameter */
/* Write function prototype for pass_by_val_and_ref with a value int and ref int parameter. */ /* Write function prototype for pass_by_const_ref with const int reference parameter */
0.42279
{}
/* * Copyright (C) 2020 Centre National d'Etudes Spatiales (CNES) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /************************************************************************************************************ * * * ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo * * o * * o * * o * * o * * o ooooooo ooooooo o o oo * * o o o o o o o o o o * * o o o o o o o o o o * * o o o o o o o o o o * * o o o oooo o o o o o o * * o o o o o o o o o * * o o o o o o o o o o * * oo oooooooo o o o oooooo o oooo * * o * * o * * o o * * o o oooo o o oooo * * o o o o o o * * o o ooo o o ooo * * o o o o o * * ooooo oooo o ooooo oooo * * o * * * ************************************************************************************************************ * * * Author: CS Systemes d'Information (France) * * * ************************************************************************************************************ * HISTORIQUE * * * * VERSION : 1.0.0 : FA : LAIG-FA-MAC-148399-CS : 24 octobre 2016 : Audit code - Correction qualite * * VERSION : 1.0.0 : FA : LAIG-FA-MAC-1988-CNES : 21 octobre 2016 : Correction qualite (code mort) * * VERSION : 5-1-0 : FA : LAIG-FA-MAC-145739-CS : 27 juin 2016 : Audit code - Supp de la macro ITK_EXPORT * * VERSION : 5-0-0 : FA : LAIG-FA-MAC-1619-CNES : 21 avril 2016 : Modification pour corriger l'anomalie * * VERSION : 5-0-0 : FA : LAIG-FA-MAC-143764-CS : 12 avril 2016 : Mise en forme du code (indentation, etc.) * * VERSION : 4-8-0 : DM : LAIG-DM-MAC-1638-CNES : 1 mars 2016 : Nouveau filtre reechantillonnage issu OTB * * VERSION : 1-0-0 : <TypeFT> : <NumFT> : 11 01 2011 : Creation * * * FIN-HISTORIQUE * * * * $Id: vnsPadAndResampleImageFilter.h 9591 2015-03-20 17:29:33Z tfeuvrie $ * * ************************************************************************************************************/ #ifndef __vnsPadAndResampleImageFilter_h #define __vnsPadAndResampleImageFilter_h #include "vnsGridResampleImageFilter.h" #include "itkBinaryThresholdImageFilter.h" #include "itkZeroFluxNeumannPadImageFilter.h" #include "vnsMacro.h" #include "vnsLoggers.h" #include "vnsResamplerHelper.h" #include "itkProcessObject.h" #include "itkImageToImageFilter.h" #include "itkIdentityTransform.h" namespace vns { /** \class PadAndResampleImageFilter * \brief chain pad -> resample * * \sa PadImageFilter * \sa StreamingResampleImageFilter * * \ingroup Common */ template<class TInputImage, class TOutputImage> class PadAndResampleImageFilter : public itk::ProcessObject { public: /** Standard class typedefs. */ typedef PadAndResampleImageFilter Self; typedef itk::ProcessObject Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; /** Type macro */ itkNewMacro(Self) /** Creation through object factory macro */ itkTypeMacro(PadAndResampleImageFilter, ProcessObject ) /** Some convenient typedefs. */ typedef TInputImage InputImageType; typedef typename InputImageType::ConstPointer InputImageConstPointer; typedef typename InputImageType::Pointer InputImagePointer; typedef typename InputImageType::PixelType InputPixelType; typedef TOutputImage OutputImageType; typedef typename OutputImageType::Pointer OutputImagePointer; typedef typename OutputImageType::PixelType OutputPixelType; /** PadFilter used to manipulate real data */ typedef itk::ZeroFluxNeumannPadImageFilter<InputImageType, InputImageType> PadFilterType; typedef typename PadFilterType::Pointer PadFilterPointer; /** Expand only real images */ //typedef otb::StreamingResampleImageFilter<InputImageType, OutputImageType> ResamplerFilterType; typedef GridResampleImageFilter<InputImageType, OutputImageType> ResamplerFilterType; typedef typename ResamplerFilterType::Pointer ResamplerFilterPointer; typedef typename ResamplerHelper::InterpolatorType InterpolatorType; typedef itk::IdentityTransform<double, InputImageType::ImageDimension> IdentityTransformType; vnsMemberAndSetAndGetConstReferenceMacro(Interpolator, InterpolatorType) // Input 0 vnsSetGetInputRawMacro(Input0, InputImageType , 0) //Set the radius of the padding (0 desactivated) vnsSetMacro(PadRadius, unsigned int); vnsGetConstMacro(PadRadius, unsigned int); virtual OutputImageType * GetOutput(void) { return m_OutputResampler; //m_Resampler->GetOutput(); } vnsMemberAndDirectSetAndGetConstReferenceMacro(AreaToOutputImageResolution, AreaType) /** Composite Filter method. */ virtual void UpdateWithCaching(); // Modifiable !! itkGetObjectMacro(Resampler, ResamplerFilterType) protected: PadAndResampleImageFilter(); virtual ~PadAndResampleImageFilter() { } private: PadAndResampleImageFilter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented PadFilterPointer m_Pader; ResamplerFilterPointer m_Resampler; OutputImagePointer m_OutputResampler; unsigned int m_PadRadius; }; #define vnsImagePadAndResamplerMacro(comment, resampler, inputPointer, interpolator, output_area ) \ { \ /* First, get input image parameters */ \ if (!(inputPointer) )\ { \ vnsStaticExceptionBusinessMacro("Internal error: In the ResamplerHelper, the input image pointer is null.") \ } \ vnsLogDebugMacro("Setting padding and resampling for " << (comment) <<"...") \ (resampler)->SetInput0(inputPointer); \ (resampler)->SetInterpolator(interpolator); \ (resampler)->SetAreaToOutputImageResolution(output_area); \ (resampler)->UpdateWithCaching(); \ vnsLogDebugMacro("Setting padding and resampling for " << (comment) <<" done.") \ } } // end namespace vns #ifndef VNS_MANUAL_INSTANTIATION #include "vnsPadAndResampleImageFilter.txx" #endif #endif
/* * Copyright (C) 2020 Centre National d'Etudes Spatiales (CNES) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /************************************************************************************************************ * * * ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo * * o * * o * * o * * o * * o ooooooo ooooooo o o oo * * o o o o o o o o o o * * o o o o o o o o o o * * o o o o o o o o o o * * o o o oooo o o o o o o * * o o o o o o o o o * * o o o o o o o o o o * * oo oooooooo o o o oooooo o oooo * * o * * o * * o o * * o o oooo o o oooo * * o o o o o o * * o o ooo o o ooo * * o o o o o * * ooooo oooo o ooooo oooo * * o * * * ************************************************************************************************************ * * * Author: CS Systemes d'Information (France) * * * ************************************************************************************************************ * HISTORIQUE * * * * VERSION : 1.0.0 : FA : LAIG-FA-MAC-148399-CS : 24 octobre 2016 : Audit code - Correction qualite * * VERSION : 1.0.0 : FA : LAIG-FA-MAC-1988-CNES : 21 octobre 2016 : Correction qualite (code mort) * * VERSION : 5-1-0 : FA : LAIG-FA-MAC-145739-CS : 27 juin 2016 : Audit code - Supp de la macro ITK_EXPORT * * VERSION : 5-0-0 : FA : LAIG-FA-MAC-1619-CNES : 21 avril 2016 : Modification pour corriger l'anomalie * * VERSION : 5-0-0 : FA : LAIG-FA-MAC-143764-CS : 12 avril 2016 : Mise en forme du code (indentation, etc.) * * VERSION : 4-8-0 : DM : LAIG-DM-MAC-1638-CNES : 1 mars 2016 : Nouveau filtre reechantillonnage issu OTB * * VERSION : 1-0-0 : <TypeFT> : <NumFT> : 11 01 2011 : Creation * * * FIN-HISTORIQUE * * * * $Id: vnsPadAndResampleImageFilter.h 9591 2015-03-20 17:29:33Z tfeuvrie $ * * ************************************************************************************************************/ #ifndef __vnsPadAndResampleImageFilter_h #define __vnsPadAndResampleImageFilter_h #include "IMPORT_0" #include "itkBinaryThresholdImageFilter.h" #include "itkZeroFluxNeumannPadImageFilter.h" #include "vnsMacro.h" #include "vnsLoggers.h" #include "vnsResamplerHelper.h" #include "itkProcessObject.h" #include "IMPORT_1" #include "itkIdentityTransform.h" namespace vns { /** \class PadAndResampleImageFilter * \brief chain pad -> resample * * \sa PadImageFilter * \sa StreamingResampleImageFilter * * \ingroup Common */ template<VAR_0 TInputImage, VAR_0 TOutputImage> VAR_0 PadAndResampleImageFilter : public itk::ProcessObject { public: /** Standard class typedefs. */ typedef PadAndResampleImageFilter Self; typedef itk::ProcessObject Superclass; typedef itk::CLASS_0<Self> Pointer; typedef itk::CLASS_0<const Self> ConstPointer; /** Type macro */ itkNewMacro(Self) /** Creation through object factory macro */ itkTypeMacro(PadAndResampleImageFilter, ProcessObject ) /** Some convenient typedefs. */ typedef TInputImage InputImageType; typedef typename InputImageType::ConstPointer InputImageConstPointer; typedef typename InputImageType::Pointer InputImagePointer; typedef typename InputImageType::PixelType InputPixelType; typedef TOutputImage OutputImageType; typedef typename OutputImageType::Pointer OutputImagePointer; typedef typename OutputImageType::PixelType OutputPixelType; /** PadFilter used to manipulate real data */ typedef itk::ZeroFluxNeumannPadImageFilter<InputImageType, InputImageType> PadFilterType; typedef typename PadFilterType::Pointer PadFilterPointer; /** Expand only real images */ //typedef otb::StreamingResampleImageFilter<InputImageType, OutputImageType> ResamplerFilterType; typedef GridResampleImageFilter<InputImageType, OutputImageType> VAR_1; typedef typename VAR_1::Pointer ResamplerFilterPointer; typedef typename ResamplerHelper::InterpolatorType InterpolatorType; typedef itk::IdentityTransform<double, InputImageType::ImageDimension> IdentityTransformType; VAR_2(Interpolator, InterpolatorType) // Input 0 vnsSetGetInputRawMacro(Input0, InputImageType , 0) //Set the radius of the padding (0 desactivated) vnsSetMacro(PadRadius, unsigned int); vnsGetConstMacro(PadRadius, unsigned int); virtual OutputImageType * GetOutput(void) { return m_OutputResampler; //m_Resampler->GetOutput(); } vnsMemberAndDirectSetAndGetConstReferenceMacro(AreaToOutputImageResolution, AreaType) /** Composite Filter method. */ virtual void FUNC_0(); // Modifiable !! FUNC_1(Resampler, VAR_1) protected: PadAndResampleImageFilter(); virtual ~PadAndResampleImageFilter() { } private: PadAndResampleImageFilter(const Self&); //purposely not implemented void VAR_3=(const Self&); //purposely not implemented PadFilterPointer m_Pader; ResamplerFilterPointer VAR_4; OutputImagePointer m_OutputResampler; unsigned int m_PadRadius; }; #define vnsImagePadAndResamplerMacro(VAR_5, resampler, inputPointer, interpolator, output_area ) \ { \ /* First, get input image parameters */ \ VAR_6 (!(inputPointer) )\ { \ vnsStaticExceptionBusinessMacro("Internal error: In the ResamplerHelper, the input image pointer is null.") \ } \ vnsLogDebugMacro("Setting padding and resampling for " << (comment) <<"...") \ (resampler)->SetInput0(inputPointer); \ (resampler)->SetInterpolator(interpolator); \ (resampler)->SetAreaToOutputImageResolution(output_area); \ (resampler)->UpdateWithCaching(); \ vnsLogDebugMacro("Setting padding and resampling for " << (comment) <<" done.") \ } } // end namespace vns #ifndef VNS_MANUAL_INSTANTIATION #include "IMPORT_2" #endif #endif
0.154616
{'IMPORT_0': 'vnsGridResampleImageFilter.h', 'IMPORT_1': 'itkImageToImageFilter.h', 'VAR_0': 'class', 'CLASS_0': 'SmartPointer', 'VAR_1': 'ResamplerFilterType', 'VAR_2': 'vnsMemberAndSetAndGetConstReferenceMacro', 'FUNC_0': 'UpdateWithCaching', 'FUNC_1': 'itkGetObjectMacro', 'VAR_3': 'operator', 'VAR_4': 'm_Resampler', 'VAR_5': 'comment', 'VAR_6': 'if', 'IMPORT_2': 'vnsPadAndResampleImageFilter.txx'}
#ifndef PE_PROCESSOR_H #define PE_PROCESSOR_H #include <stdio.h> #include <stdlib.h> #include <string> #include "read.h" #include <cstdlib> #include <condition_variable> #include <mutex> #include <thread> #include "options.h" #include "threadconfig.h" #include "filter.h" #include "umiprocessor.h" using namespace std; struct ReadPairPack { ReadPair** data; int count; }; typedef struct ReadPairPack ReadPairPack; struct ReadPairRepository { ReadPairPack** packBuffer; size_t readPos; size_t writePos; size_t readCounter; std::mutex mtx; std::mutex readCounterMtx; std::condition_variable repoNotFull; std::condition_variable repoNotEmpty; }; typedef struct ReadPairRepository ReadPairRepository; class PairEndProcessor{ public: PairEndProcessor(Options* opt); ~PairEndProcessor(); bool process(); private: bool processPairEnd(ReadPairPack* pack, ThreadConfig* config); bool processRead(Read* r, ReadPair* originalRead, bool reversed); void initPackRepository(); void destroyPackRepository(); void producePack(ReadPairPack* pack); void consumePack(ThreadConfig* config); void producerTask(); void consumerTask(ThreadConfig* config); void initConfig(ThreadConfig* config); void initOutput(); void closeOutput(); private: ReadPairRepository mRepo; bool mProduceFinished; std::mutex mOutputMtx; Options* mOptions; Filter* mFilter; gzFile mZipFile1; gzFile mZipFile2; ofstream* mOutStream1; ofstream* mOutStream2; UmiProcessor* mUmiProcessor; }; #endif
#ifndef PE_PROCESSOR_H #define PE_PROCESSOR_H #include <IMPORT_0> #include <stdlib.h> #include <IMPORT_1> #include "IMPORT_2" #include <IMPORT_3> #include <IMPORT_4> #include <IMPORT_5> #include <IMPORT_6> #include "IMPORT_7" #include "IMPORT_8" #include "IMPORT_9" #include "umiprocessor.h" CLASS_0 namespace std; struct CLASS_1 { CLASS_2** VAR_1; int count; }; typedef struct CLASS_1 ID_0; struct CLASS_3 { CLASS_1** packBuffer; size_t VAR_3; size_t VAR_4; size_t readCounter; std::IMPORT_5 VAR_5; std::IMPORT_5 VAR_6; std::IMPORT_4 VAR_7; std::IMPORT_4 repoNotEmpty; }; typedef struct CLASS_3 ID_1; CLASS_4 VAR_8{ public: FUNC_0(VAR_9* VAR_10); ~FUNC_0(); bool process(); private: VAR_11 processPairEnd(VAR_0* VAR_12, ThreadConfig* VAR_13); bool FUNC_1(CLASS_6* VAR_14, CLASS_2* VAR_15, bool VAR_16); void FUNC_2(); void FUNC_3(); void FUNC_4(CLASS_1* VAR_12); void FUNC_5(ThreadConfig* VAR_13); void FUNC_6(); void FUNC_7(ThreadConfig* VAR_13); void FUNC_8(ThreadConfig* VAR_13); void FUNC_9(); void FUNC_10(); private: VAR_2 VAR_17; bool mProduceFinished; std::IMPORT_5 VAR_18; CLASS_5* VAR_19; CLASS_7* VAR_20; gzFile VAR_21; gzFile VAR_22; CLASS_8* mOutStream1; CLASS_8* VAR_23; CLASS_9* VAR_24; }; #endif
0.824192
{'IMPORT_0': 'stdio.h', 'IMPORT_1': 'string', 'IMPORT_2': 'read.h', 'IMPORT_3': 'cstdlib', 'IMPORT_4': 'condition_variable', 'IMPORT_5': 'mutex', 'IMPORT_6': 'thread', 'IMPORT_7': 'options.h', 'IMPORT_8': 'threadconfig.h', 'IMPORT_9': 'filter.h', 'CLASS_0': 'using', 'CLASS_1': 'ReadPairPack', 'ID_0': 'ReadPairPack', 'VAR_0': 'ReadPairPack', 'CLASS_2': 'ReadPair', 'VAR_1': 'data', 'CLASS_3': 'ReadPairRepository', 'ID_1': 'ReadPairRepository', 'VAR_2': 'ReadPairRepository', 'VAR_3': 'readPos', 'VAR_4': 'writePos', 'VAR_5': 'mtx', 'VAR_6': 'readCounterMtx', 'VAR_7': 'repoNotFull', 'CLASS_4': 'class', 'VAR_8': 'PairEndProcessor', 'FUNC_0': 'PairEndProcessor', 'VAR_9': 'Options', 'CLASS_5': 'Options', 'VAR_10': 'opt', 'VAR_11': 'bool', 'VAR_12': 'pack', 'VAR_13': 'config', 'FUNC_1': 'processRead', 'CLASS_6': 'Read', 'VAR_14': 'r', 'VAR_15': 'originalRead', 'VAR_16': 'reversed', 'FUNC_2': 'initPackRepository', 'FUNC_3': 'destroyPackRepository', 'FUNC_4': 'producePack', 'FUNC_5': 'consumePack', 'FUNC_6': 'producerTask', 'FUNC_7': 'consumerTask', 'FUNC_8': 'initConfig', 'FUNC_9': 'initOutput', 'FUNC_10': 'closeOutput', 'VAR_17': 'mRepo', 'VAR_18': 'mOutputMtx', 'VAR_19': 'mOptions', 'CLASS_7': 'Filter', 'VAR_20': 'mFilter', 'VAR_21': 'mZipFile1', 'VAR_22': 'mZipFile2', 'CLASS_8': 'ofstream', 'VAR_23': 'mOutStream2', 'CLASS_9': 'UmiProcessor', 'VAR_24': 'mUmiProcessor'}
/* Respond to a button-press by posting a menu passed in as widget. * * Note that the "widget" argument is the menu being posted, NOT * the button that was pressed. */ static gint button_press( GtkWidget *widget, GdkEvent *event ) { if (event->type == GDK_BUTTON_PRESS) { GdkEventButton *bevent = (GdkEventButton *) event; gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, bevent->button, bevent->time); return TRUE; } return FALSE; }
/* Respond to a button-press by posting a menu passed in as widget. * * Note that the "widget" argument is the menu being posted, NOT * the button that was pressed. */ static gint FUNC_0( GtkWidget *VAR_0, CLASS_0 *VAR_1 ) { if (VAR_1->VAR_2 == GDK_BUTTON_PRESS) { CLASS_1 *VAR_3 = (CLASS_1 *) VAR_1; gtk_menu_popup (FUNC_1 (VAR_0), NULL, NULL, NULL, NULL, VAR_3->VAR_4, VAR_3->VAR_5); return TRUE; } return FALSE; }
0.613793
{'FUNC_0': 'button_press', 'VAR_0': 'widget', 'CLASS_0': 'GdkEvent', 'VAR_1': 'event', 'VAR_2': 'type', 'CLASS_1': 'GdkEventButton', 'VAR_3': 'bevent', 'FUNC_1': 'GTK_MENU', 'VAR_4': 'button', 'VAR_5': 'time'}
// SPDX-License-Identifier: BSD-3-Clause /* Copyright 2020, Intel Corporation */ /* * common-conn.c -- a common connection functions used by examples */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include "common-conn.h" /* * malloc_aligned -- allocate an aligned chunk of memory */ void * malloc_aligned(size_t size) { long pagesize = sysconf(_SC_PAGESIZE); if (pagesize < 0) { perror("sysconf"); return NULL; } /* allocate a page size aligned local memory pool */ void *mem; int ret = posix_memalign(&mem, (size_t)pagesize, size); if (ret) { (void) fprintf(stderr, "posix_memalign: %s\n", strerror(ret)); return NULL; } /* zero the allocated memory */ memset(mem, 0, size); return mem; } /* * common_peer_via_address -- create a new RPMA peer based on ibv_context * received by the provided address */ int common_peer_via_address(const char *addr, enum rpma_util_ibv_context_type type, struct rpma_peer **peer_ptr) { struct ibv_context *dev = NULL; int ret = rpma_utils_get_ibv_context(addr, type, &dev); if (ret) return ret; /* create a new peer object */ return rpma_peer_new(dev, peer_ptr); } /* * client_connect -- establish a new connection to a server listening at * addr:port */ int client_connect(struct rpma_peer *peer, const char *addr, const char *port, struct rpma_conn_private_data *pdata, struct rpma_conn **conn_ptr) { struct rpma_conn_req *req = NULL; enum rpma_conn_event conn_event = RPMA_CONN_UNDEFINED; /* create a connection request */ int ret = rpma_conn_req_new(peer, addr, port, NULL, &req); if (ret) return ret; /* connect the connection request and obtain the connection object */ ret = rpma_conn_req_connect(&req, pdata, conn_ptr); if (ret) { (void) rpma_conn_req_delete(&req); return ret; } /* wait for the connection to establish */ ret = rpma_conn_next_event(*conn_ptr, &conn_event); if (ret) { goto err_conn_delete; } else if (conn_event != RPMA_CONN_ESTABLISHED) { fprintf(stderr, "rpma_conn_next_event returned an unexptected event\n"); goto err_conn_delete; } return 0; err_conn_delete: (void) rpma_conn_delete(conn_ptr); return ret; } /* * server_accept_connection -- wait for an incoming connection request, * accept it and wait for its establishment */ int server_accept_connection(struct rpma_ep *ep, struct rpma_conn_private_data *pdata, struct rpma_conn **conn_ptr) { struct rpma_conn_req *req = NULL; enum rpma_conn_event conn_event = RPMA_CONN_UNDEFINED; /* receive an incoming connection request */ int ret = rpma_ep_next_conn_req(ep, NULL, &req); if (ret) return ret; /* * connect / accept the connection request and obtain the connection * object */ ret = rpma_conn_req_connect(&req, pdata, conn_ptr); if (ret) { (void) rpma_conn_req_delete(&req); return ret; } /* wait for the connection to be established */ ret = rpma_conn_next_event(*conn_ptr, &conn_event); if (!ret && conn_event != RPMA_CONN_ESTABLISHED) { fprintf(stderr, "rpma_conn_next_event returned an unexptected event\n"); ret = -1; } if (ret) (void) rpma_conn_delete(conn_ptr); return ret; } /* * common_wait_for_conn_close_verbose -- wait for RPMA_CONN_CLOSED and print * an error message on error */ static inline int common_wait_for_conn_close_verbose(struct rpma_conn *conn) { enum rpma_conn_event conn_event = RPMA_CONN_UNDEFINED; /* wait for the connection to be closed */ int ret = rpma_conn_next_event(conn, &conn_event); if (!ret && conn_event != RPMA_CONN_CLOSED) { fprintf(stderr, "rpma_conn_next_event returned an unexptected event\n"); } return ret; } /* * common_wait_for_conn_close_and_disconnect -- wait for RPMA_CONN_CLOSED, * disconnect and delete the connection structure */ int common_wait_for_conn_close_and_disconnect(struct rpma_conn **conn_ptr) { int ret = 0; ret |= common_wait_for_conn_close_verbose(*conn_ptr); ret |= rpma_conn_disconnect(*conn_ptr); ret |= rpma_conn_delete(conn_ptr); return ret; } /* * common_disconnect_and_wait_for_conn_close -- disconnect, wait for * RPMA_CONN_CLOSED and delete the connection structure */ int common_disconnect_and_wait_for_conn_close(struct rpma_conn **conn_ptr) { int ret = 0; ret |= rpma_conn_disconnect(*conn_ptr); if (ret == 0) ret |= common_wait_for_conn_close_verbose(*conn_ptr); ret |= rpma_conn_delete(conn_ptr); return ret; }
// SPDX-License-Identifier: BSD-3-Clause /* Copyright 2020, Intel Corporation */ /* * common-conn.c -- a common connection functions used by examples */ #include <stdlib.h> #include <stdio.h> #include <IMPORT_0> #include <IMPORT_1> #include "IMPORT_2" /* * malloc_aligned -- allocate an aligned chunk of memory */ void * malloc_aligned(size_t VAR_0) { long VAR_1 = sysconf(VAR_2); if (VAR_1 < 0) { perror("sysconf"); return NULL; } /* allocate a page size aligned local memory pool */ void *mem; int ret = FUNC_0(&mem, (size_t)VAR_1, VAR_0); if (ret) { (void) fprintf(stderr, "posix_memalign: %s\n", FUNC_1(ret)); return NULL; } /* zero the allocated memory */ memset(mem, 0, VAR_0); return mem; } /* * common_peer_via_address -- create a new RPMA peer based on ibv_context * received by the provided address */ int FUNC_2(const char *addr, enum CLASS_0 type, struct rpma_peer **VAR_3) { struct CLASS_1 *dev = NULL; int ret = rpma_utils_get_ibv_context(addr, type, &dev); if (ret) return ret; /* create a new peer object */ return FUNC_3(dev, VAR_3); } /* * client_connect -- establish a new connection to a server listening at * addr:port */ int FUNC_4(struct rpma_peer *VAR_4, const char *addr, const char *port, struct CLASS_2 *pdata, struct CLASS_3 **VAR_5) { struct CLASS_4 *req = NULL; enum rpma_conn_event conn_event = RPMA_CONN_UNDEFINED; /* create a connection request */ int ret = FUNC_5(VAR_4, addr, port, NULL, &req); if (ret) return ret; /* connect the connection request and obtain the connection object */ ret = FUNC_6(&req, pdata, VAR_5); if (ret) { (void) FUNC_7(&req); return ret; } /* wait for the connection to establish */ ret = FUNC_8(*VAR_5, &conn_event); if (ret) { goto err_conn_delete; } else if (conn_event != RPMA_CONN_ESTABLISHED) { fprintf(stderr, "rpma_conn_next_event returned an unexptected event\n"); goto err_conn_delete; } return 0; err_conn_delete: (void) rpma_conn_delete(VAR_5); return ret; } /* * server_accept_connection -- wait for an incoming connection request, * accept it and wait for its establishment */ int server_accept_connection(struct rpma_ep *ep, struct CLASS_2 *pdata, struct CLASS_3 **VAR_5) { struct CLASS_4 *req = NULL; enum rpma_conn_event conn_event = RPMA_CONN_UNDEFINED; /* receive an incoming connection request */ int ret = FUNC_9(ep, NULL, &req); if (ret) return ret; /* * connect / accept the connection request and obtain the connection * object */ ret = FUNC_6(&req, pdata, VAR_5); if (ret) { (void) FUNC_7(&req); return ret; } /* wait for the connection to be established */ ret = FUNC_8(*VAR_5, &conn_event); if (!ret && conn_event != RPMA_CONN_ESTABLISHED) { fprintf(stderr, "rpma_conn_next_event returned an unexptected event\n"); ret = -1; } if (ret) (void) rpma_conn_delete(VAR_5); return ret; } /* * common_wait_for_conn_close_verbose -- wait for RPMA_CONN_CLOSED and print * an error message on error */ static inline int common_wait_for_conn_close_verbose(struct CLASS_3 *conn) { enum rpma_conn_event conn_event = RPMA_CONN_UNDEFINED; /* wait for the connection to be closed */ int ret = FUNC_8(conn, &conn_event); if (!ret && conn_event != VAR_6) { fprintf(stderr, "rpma_conn_next_event returned an unexptected event\n"); } return ret; } /* * common_wait_for_conn_close_and_disconnect -- wait for RPMA_CONN_CLOSED, * disconnect and delete the connection structure */ int FUNC_10(struct CLASS_3 **VAR_5) { int ret = 0; ret |= common_wait_for_conn_close_verbose(*VAR_5); ret |= rpma_conn_disconnect(*VAR_5); ret |= rpma_conn_delete(VAR_5); return ret; } /* * common_disconnect_and_wait_for_conn_close -- disconnect, wait for * RPMA_CONN_CLOSED and delete the connection structure */ int FUNC_11(struct CLASS_3 **VAR_5) { int ret = 0; ret |= rpma_conn_disconnect(*VAR_5); if (ret == 0) ret |= common_wait_for_conn_close_verbose(*VAR_5); ret |= rpma_conn_delete(VAR_5); return ret; }
0.5997
{'IMPORT_0': 'string.h', 'IMPORT_1': 'unistd.h', 'IMPORT_2': 'common-conn.h', 'VAR_0': 'size', 'VAR_1': 'pagesize', 'VAR_2': '_SC_PAGESIZE', 'FUNC_0': 'posix_memalign', 'FUNC_1': 'strerror', 'FUNC_2': 'common_peer_via_address', 'CLASS_0': 'rpma_util_ibv_context_type', 'VAR_3': 'peer_ptr', 'CLASS_1': 'ibv_context', 'FUNC_3': 'rpma_peer_new', 'FUNC_4': 'client_connect', 'VAR_4': 'peer', 'CLASS_2': 'rpma_conn_private_data', 'CLASS_3': 'rpma_conn', 'VAR_5': 'conn_ptr', 'CLASS_4': 'rpma_conn_req', 'FUNC_5': 'rpma_conn_req_new', 'FUNC_6': 'rpma_conn_req_connect', 'FUNC_7': 'rpma_conn_req_delete', 'FUNC_8': 'rpma_conn_next_event', 'FUNC_9': 'rpma_ep_next_conn_req', 'VAR_6': 'RPMA_CONN_CLOSED', 'FUNC_10': 'common_wait_for_conn_close_and_disconnect', 'FUNC_11': 'common_disconnect_and_wait_for_conn_close'}
// Ceres Solver - A fast non-linear least squares minimizer // Copyright 2018 Google Inc. All rights reserved. // http://ceres-solver.org/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of Google Inc. nor the names of its contributors may be // used to endorse or promote products derived from this software without // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. // // Author: [email protected] (Michael Vitus) #ifndef CERES_INTERNAL_CONCURRENT_QUEUE_H_ #define CERES_INTERNAL_CONCURRENT_QUEUE_H_ #include <condition_variable> #include <mutex> #include <queue> #include <thread> #include "glog/logging.h" namespace ceres { namespace internal { // A thread-safe multi-producer, multi-consumer queue for queueing items that // are typically handled asynchronously by multiple threads. The ConcurrentQueue // has two states which only affect the Wait call: // // (1) Waiters have been enabled (enabled by default or calling // EnableWaiters). The call to Wait will block until an item is available. // Push and pop will operate as expected. // // (2) StopWaiters has been called. All threads blocked in a Wait() call will // be woken up and pop any available items from the queue. All future Wait // requests will either return an element from the queue or return // immediately if no element is present. Push and pop will operate as // expected. // // A common use case is using the concurrent queue as an interface for // scheduling tasks for a set of thread workers: // // ConcurrentQueue<Task> task_queue; // // [Worker threads]: // Task task; // while(task_queue.Wait(&task)) { // ... // } // // [Producers]: // task_queue.Push(...); // .. // task_queue.Push(...); // ... // // Signal worker threads to stop blocking on Wait and terminate. // task_queue.StopWaiters(); // template <typename T> class ConcurrentQueue { public: // Defaults the queue to blocking on Wait calls. ConcurrentQueue() : wait_(true) {} // Atomically push an element onto the queue. If a thread was waiting for an // element, wake it up. void Push(const T& value) { std::lock_guard<std::mutex> lock(mutex_); queue_.push(value); work_pending_condition_.notify_one(); } // Atomically pop an element from the queue. If an element is present, return // true. If the queue was empty, return false. bool Pop(T* value) { CHECK(value != nullptr); std::lock_guard<std::mutex> lock(mutex_); return PopUnlocked(value); } // Atomically pop an element from the queue. Blocks until one is available or // StopWaiters is called. Returns true if an element was successfully popped // from the queue, otherwise returns false. bool Wait(T* value) { CHECK(value != nullptr); std::unique_lock<std::mutex> lock(mutex_); work_pending_condition_.wait(lock, [&]() { return !(wait_ && queue_.empty()); }); return PopUnlocked(value); } // Unblock all threads waiting to pop a value from the queue, and they will // exit Wait() without getting a value. All future Wait requests will return // immediately if no element is present until EnableWaiters is called. void StopWaiters() { std::lock_guard<std::mutex> lock(mutex_); wait_ = false; work_pending_condition_.notify_all(); } // Enable threads to block on Wait calls. void EnableWaiters() { std::lock_guard<std::mutex> lock(mutex_); wait_ = true; } private: // Pops an element from the queue. If an element is present, return // true. If the queue was empty, return false. Not thread-safe. Must acquire // the lock before calling. bool PopUnlocked(T* value) { if (queue_.empty()) { return false; } *value = queue_.front(); queue_.pop(); return true; } // The mutex controls read and write access to the queue_ and stop_ // variables. It is also used to block the calling thread until an element is // available to pop from the queue. std::mutex mutex_; std::condition_variable work_pending_condition_; std::queue<T> queue_; // If true, signals that callers of Wait will block waiting to pop an // element off the queue. bool wait_; }; } // namespace internal } // namespace ceres #endif // CERES_INTERNAL_CONCURRENT_QUEUE_H_
// Ceres Solver - A fast non-linear least squares minimizer // Copyright 2018 Google Inc. All rights reserved. // http://ceres-solver.org/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of Google Inc. nor the names of its contributors may be // used to endorse or promote products derived from this software without // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. // // Author: [email protected] (Michael Vitus) #ifndef VAR_0 #define VAR_0 #include <IMPORT_0> #include <IMPORT_1> #include <queue> #include <IMPORT_2> #include "glog/logging.h" CLASS_0 ceres { CLASS_0 internal { // A thread-safe multi-producer, multi-consumer queue for queueing items that // are typically handled asynchronously by multiple threads. The ConcurrentQueue // has two states which only affect the Wait call: // // (1) Waiters have been enabled (enabled by default or calling // EnableWaiters). The call to Wait will block until an item is available. // Push and pop will operate as expected. // // (2) StopWaiters has been called. All threads blocked in a Wait() call will // be woken up and pop any available items from the queue. All future Wait // requests will either return an element from the queue or return // immediately if no element is present. Push and pop will operate as // expected. // // A common use case is using the concurrent queue as an interface for // scheduling tasks for a set of thread workers: // // ConcurrentQueue<Task> task_queue; // // [Worker threads]: // Task task; // while(task_queue.Wait(&task)) { // ... // } // // [Producers]: // task_queue.Push(...); // .. // task_queue.Push(...); // ... // // Signal worker threads to stop blocking on Wait and terminate. // task_queue.StopWaiters(); // template <VAR_1 VAR_2> VAR_3 ConcurrentQueue { public: // Defaults the queue to blocking on Wait calls. ConcurrentQueue() : FUNC_0(true) {} // Atomically push an element onto the queue. If a thread was waiting for an // element, wake it up. void FUNC_1(const CLASS_1& VAR_5) { std::VAR_7<VAR_6::IMPORT_1> lock(VAR_8); VAR_9.FUNC_2(VAR_5); VAR_10.FUNC_3(); } // Atomically pop an element from the queue. If an element is present, return // true. If the queue was empty, return false. bool FUNC_4(CLASS_1* VAR_5) { FUNC_5(VAR_5 != nullptr); std::VAR_7<VAR_6::IMPORT_1> lock(VAR_8); return PopUnlocked(VAR_5); } // Atomically pop an element from the queue. Blocks until one is available or // StopWaiters is called. Returns true if an element was successfully popped // from the queue, otherwise returns false. bool FUNC_6(CLASS_1* VAR_5) { FUNC_5(VAR_5 != nullptr); std::VAR_11<VAR_6::IMPORT_1> lock(VAR_8); VAR_10.wait(lock, [&VAR_12]() { return !(VAR_4 && VAR_9.empty()); }); return PopUnlocked(VAR_5); } // Unblock all threads waiting to pop a value from the queue, and they will // exit Wait() without getting a value. All future Wait requests will return // immediately if no element is present until EnableWaiters is called. void StopWaiters() { std::VAR_7<VAR_6::IMPORT_1> lock(VAR_8); VAR_4 = false; VAR_10.notify_all(); } // Enable threads to block on Wait calls. void FUNC_7() { std::VAR_7<VAR_6::IMPORT_1> lock(VAR_8); VAR_4 = true; } private: // Pops an element from the queue. If an element is present, return // true. If the queue was empty, return false. Not thread-safe. Must acquire // the lock before calling. bool PopUnlocked(VAR_2* VAR_5) { if (VAR_9.empty()) { return false; } *VAR_5 = VAR_9.FUNC_8(); VAR_9.FUNC_9(); return true; } // The mutex controls read and write access to the queue_ and stop_ // variables. It is also used to block the calling thread until an element is // available to pop from the queue. std::IMPORT_1 VAR_8; std::IMPORT_0 VAR_10; std::queue<VAR_2> VAR_9; // If true, signals that callers of Wait will block waiting to pop an // element off the queue. bool VAR_4; }; } // namespace internal } // namespace ceres #endif // CERES_INTERNAL_CONCURRENT_QUEUE_H_
0.53139
{'VAR_0': 'CERES_INTERNAL_CONCURRENT_QUEUE_H_', 'IMPORT_0': 'condition_variable', 'IMPORT_1': 'mutex', 'IMPORT_2': 'thread', 'CLASS_0': 'namespace', 'VAR_1': 'typename', 'VAR_2': 'T', 'CLASS_1': 'T', 'VAR_3': 'class', 'FUNC_0': 'wait_', 'VAR_4': 'wait_', 'FUNC_1': 'Push', 'VAR_5': 'value', 'VAR_6': 'std', 'VAR_7': 'lock_guard', 'VAR_8': 'mutex_', 'VAR_9': 'queue_', 'FUNC_2': 'push', 'VAR_10': 'work_pending_condition_', 'FUNC_3': 'notify_one', 'FUNC_4': 'Pop', 'FUNC_5': 'CHECK', 'FUNC_6': 'Wait', 'VAR_11': 'unique_lock', 'VAR_12': '', 'FUNC_7': 'EnableWaiters', 'FUNC_8': 'front', 'FUNC_9': 'pop'}
/**************************************************************************** * Copyright (C) 2020 by NQMCyber Ltd * * * * This file is part of EDGESec. * * * * EDGESec 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 3 of the License, or * * (at your option) any later version. * * * * EDGESec is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public * * License along with EDGESec. If not, see <http://www.gnu.org/licenses/>.* ****************************************************************************/ /** * @file supervisor_config.c * @author <NAME> * @brief File containing the definition of the supervisor service structure. */ #ifndef SUPERVISOR_CONFIG_H #define SUPERVISOR_CONFIG_H #include <stdbool.h> #include <sqlite3.h> #include "../ap/ap_config.h" #include "../dhcp/dhcp_config.h" #include "../dns/dns_config.h" #include "../utils/if.h" #include "../capture/capture_config.h" #include "../crypt/crypt_config.h" #include "mac_mapper.h" /** * @brief Authentication ticket structure definition * */ struct auth_ticket { uint8_t passphrase[AP_SECRET_LEN]; /**< the ticket passphrase */ ssize_t passphrase_len; /**< the ticket passphrase length */ char device_label[MAX_DEVICE_LABEL_SIZE]; /**< the device label */ int vlanid; /**< the ticket associated VLAN ID */ uint8_t issuer_mac_addr[ETH_ALEN]; /**< Issuer MAC */ }; /** * @brief Supervisor structure definition * */ struct supervisor_context { hmap_mac_conn *mac_mapper; /**< MAC mapper connection structure */ hmap_if_conn *if_mapper; /**< WiFi subnet to interface mapper */ hmap_vlan_conn *vlan_mapper; /**< WiFi VLAN to interface mapper */ hmap_str_keychar *hmap_bin_paths; /**< Mapper for paths to systems binaries */ bool allow_all_connections; /**< @c allow_all_connections Flag from @c struct app_config */ bool allow_all_nat; /**< @c allow_all_nat Flag from @c struct app_config */ bool exec_capture; /**< @c execute_capture from @c struct app_config */ uint8_t wpa_passphrase[AP_SECRET_LEN]; /**< @c wpa_passphrase from @c struct hostapd_conf */ ssize_t wpa_passphrase_len; /**< the length of @c wpa_passphrase*/ char nat_interface[IFNAMSIZ]; /**< @c nat_interface param from @c struct app_config */ bool allocate_vlans; /**< @c allocate_vlans from @c struct app_config */ int default_open_vlanid; /**< @c default_open_vlanid from @c struct app_config */ int quarantine_vlanid; /**< @c quarantine_vlanid from @c struct app_config */ int risk_score; /**< @c risk_score from @c struct app_config */ char db_path[MAX_OS_PATH_LEN]; /**< @c db_path from @c struct app_config */ UT_array *config_ifinfo_array; /**< @c config_ifinfo_array from @c struct app_config */ UT_array *subscribers_array; /**< The array of events subscribers */ struct bridge_mac_list *bridge_list; /**< List of assigned bridges */ char domain_delim; /**< Control server command delimiter */ int domain_sock; /**< The domain socket */ char nat_ip[OS_INET_ADDRSTRLEN]; /**< The NAT IP address */ struct capture_conf capture_config; /**< Capture service configuration. */ struct apconf hconfig; /**< AP service configuration. */ struct radius_conf rconfig; /**< Radius service configuration. */ struct dhcp_conf dconfig; /**< DHCP service configuration. */ struct dns_conf nconfig; /**< DNS service configuration. */ struct mdns_conf mconfig; /**< DNS service configuration. */ sqlite3 *fingeprint_db; /**< The fingerprint sqlite db structure. */ sqlite3 *alert_db; /**< The alert sqlite db structure. */ sqlite3 *macconn_db; /**< The macconn db structure. */ struct radius_server_data *radius_srv; /**< The radius server context. */ struct iptables_context *iptables_ctx; /**< The iptables context. */ struct crypt_context *crypt_ctx; /**< The crypt context. */ struct auth_ticket *ticket; /**< The authentication ticket. */ int ap_sock; /**< The AP notifier socket. */ }; #endif
/**************************************************************************** * Copyright (C) 2020 by NQMCyber Ltd * * * * This file is part of EDGESec. * * * * EDGESec 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 3 of the License, or * * (at your option) any later version. * * * * EDGESec is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public * * License along with EDGESec. If not, see <http://www.gnu.org/licenses/>.* ****************************************************************************/ /** * @file supervisor_config.c * @author <NAME> * @brief File containing the definition of the supervisor service structure. */ #ifndef SUPERVISOR_CONFIG_H #define SUPERVISOR_CONFIG_H #include <stdbool.h> #include <sqlite3.h> #include "IMPORT_0" #include "../dhcp/dhcp_config.h" #include "../dns/dns_config.h" #include "../utils/if.h" #include "../capture/capture_config.h" #include "../crypt/crypt_config.h" #include "mac_mapper.h" /** * @brief Authentication ticket structure definition * */ struct auth_ticket { uint8_t passphrase[VAR_0]; /**< the ticket passphrase */ ssize_t VAR_1; /**< the ticket passphrase length */ char device_label[VAR_2]; /**< the device label */ int vlanid; /**< the ticket associated VLAN ID */ uint8_t issuer_mac_addr[VAR_3]; /**< Issuer MAC */ }; /** * @brief Supervisor structure definition * */ struct supervisor_context { hmap_mac_conn *mac_mapper; /**< MAC mapper connection structure */ hmap_if_conn *VAR_4; /**< WiFi subnet to interface mapper */ hmap_vlan_conn *VAR_5; /**< WiFi VLAN to interface mapper */ hmap_str_keychar *VAR_6; /**< Mapper for paths to systems binaries */ bool VAR_7; /**< @c allow_all_connections Flag from @c struct app_config */ bool allow_all_nat; /**< @c allow_all_nat Flag from @c struct app_config */ bool exec_capture; /**< @c execute_capture from @c struct app_config */ uint8_t wpa_passphrase[VAR_0]; /**< @c wpa_passphrase from @c struct hostapd_conf */ ssize_t wpa_passphrase_len; /**< the length of @c wpa_passphrase*/ char nat_interface[IFNAMSIZ]; /**< @c nat_interface param from @c struct app_config */ bool allocate_vlans; /**< @c allocate_vlans from @c struct app_config */ int VAR_8; /**< @c default_open_vlanid from @c struct app_config */ int quarantine_vlanid; /**< @c quarantine_vlanid from @c struct app_config */ int risk_score; /**< @c risk_score from @c struct app_config */ char db_path[VAR_9]; /**< @c db_path from @c struct app_config */ UT_array *config_ifinfo_array; /**< @c config_ifinfo_array from @c struct app_config */ UT_array *subscribers_array; /**< The array of events subscribers */ struct bridge_mac_list *bridge_list; /**< List of assigned bridges */ char domain_delim; /**< Control server command delimiter */ int VAR_10; /**< The domain socket */ char nat_ip[VAR_11]; /**< The NAT IP address */ struct CLASS_0 capture_config; /**< Capture service configuration. */ struct apconf hconfig; /**< AP service configuration. */ struct CLASS_1 rconfig; /**< Radius service configuration. */ struct dhcp_conf dconfig; /**< DHCP service configuration. */ struct dns_conf nconfig; /**< DNS service configuration. */ struct mdns_conf mconfig; /**< DNS service configuration. */ sqlite3 *fingeprint_db; /**< The fingerprint sqlite db structure. */ sqlite3 *VAR_12; /**< The alert sqlite db structure. */ sqlite3 *macconn_db; /**< The macconn db structure. */ struct radius_server_data *radius_srv; /**< The radius server context. */ struct iptables_context *VAR_13; /**< The iptables context. */ struct crypt_context *crypt_ctx; /**< The crypt context. */ struct auth_ticket *ticket; /**< The authentication ticket. */ int ap_sock; /**< The AP notifier socket. */ }; #endif
0.231308
{'IMPORT_0': '../ap/ap_config.h', 'VAR_0': 'AP_SECRET_LEN', 'VAR_1': 'passphrase_len', 'VAR_2': 'MAX_DEVICE_LABEL_SIZE', 'VAR_3': 'ETH_ALEN', 'VAR_4': 'if_mapper', 'VAR_5': 'vlan_mapper', 'VAR_6': 'hmap_bin_paths', 'VAR_7': 'allow_all_connections', 'VAR_8': 'default_open_vlanid', 'VAR_9': 'MAX_OS_PATH_LEN', 'VAR_10': 'domain_sock', 'VAR_11': 'OS_INET_ADDRSTRLEN', 'CLASS_0': 'capture_conf', 'CLASS_1': 'radius_conf', 'VAR_12': 'alert_db', 'VAR_13': 'iptables_ctx'}
#pragma once #include <DirectXMath.h> using namespace DirectX; namespace Libero { struct VertexPosCol { VertexPosCol() = default; VertexPosCol(XMFLOAT3 pos, XMFLOAT4 color) : m_Position{ pos }, m_Color{ color }{}; XMFLOAT3 m_Position{}; XMFLOAT4 m_Color{}; }; struct VertexPosTexCol { VertexPosTexCol() = default; VertexPosTexCol(XMFLOAT3 pos, XMFLOAT2 uv, XMFLOAT4 color) : m_Position{ pos }, m_UV{ uv }, m_Color{ color }{}; XMFLOAT3 m_Position{}; XMFLOAT2 m_UV{}; XMFLOAT4 m_Color{}; }; struct VertexPosTexColNormTan { VertexPosTexColNormTan() = default; VertexPosTexColNormTan(XMFLOAT3 pos, XMFLOAT2 uv, XMFLOAT4 color, XMFLOAT3 norm, XMFLOAT3 tan) : m_Position{ pos }, m_UV{ uv }, m_Color{ color }, m_Norm{ norm }, m_Tangent{ tan }{}; XMFLOAT3 m_Position{}; XMFLOAT2 m_UV{}; XMFLOAT4 m_Color{}; XMFLOAT3 m_Norm{}; XMFLOAT3 m_Tangent{}; static D3D11_INPUT_ELEMENT_DESC m_StatVertexLayout[5]; }; inline D3D11_INPUT_ELEMENT_DESC VertexPosTexColNormTan::m_StatVertexLayout[5] { {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0 * 4, D3D11_INPUT_PER_VERTEX_DATA, 0}, { "UV", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (3) * 4, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, (3 + 2) * 4, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, (3 + 2 + 3) * 4, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, (3 + 2 + 3 + 3) * 4, D3D11_INPUT_PER_VERTEX_DATA, 0 } }; struct TrianglePosCol { TrianglePosCol() = default; TrianglePosCol(VertexPosCol v0, VertexPosCol v1, VertexPosCol v2) : m_V0{ v0 }, m_V1{ v1 }, m_V2{ v2 }{}; VertexPosCol m_V0{}; VertexPosCol m_V1{}; VertexPosCol m_V2{}; }; struct TrianglePosTexCol { TrianglePosTexCol() = default; TrianglePosTexCol(VertexPosTexCol v0, VertexPosTexCol v1, VertexPosTexCol v2) : m_V0{ v0 }, m_V1{ v1 }, m_V2{ v2 }{}; VertexPosTexCol m_V0{}; VertexPosTexCol m_V1{}; VertexPosTexCol m_V2{}; }; }
#pragma once #include <DirectXMath.h> using namespace DirectX; namespace Libero { struct VertexPosCol { VertexPosCol() = default; VertexPosCol(XMFLOAT3 pos, XMFLOAT4 color) : m_Position{ pos }, m_Color{ color }{}; XMFLOAT3 m_Position{}; XMFLOAT4 m_Color{}; }; struct VertexPosTexCol { VertexPosTexCol() = default; VertexPosTexCol(XMFLOAT3 pos, XMFLOAT2 uv, XMFLOAT4 color) : m_Position{ pos }, m_UV{ uv }, m_Color{ color }{}; XMFLOAT3 m_Position{}; XMFLOAT2 m_UV{}; XMFLOAT4 m_Color{}; }; struct VertexPosTexColNormTan { VertexPosTexColNormTan() = default; VertexPosTexColNormTan(XMFLOAT3 pos, XMFLOAT2 uv, XMFLOAT4 color, XMFLOAT3 norm, XMFLOAT3 tan) : m_Position{ pos }, m_UV{ uv }, m_Color{ color }, m_Norm{ norm }, m_Tangent{ tan }{}; XMFLOAT3 m_Position{}; XMFLOAT2 m_UV{}; XMFLOAT4 m_Color{}; XMFLOAT3 m_Norm{}; XMFLOAT3 m_Tangent{}; static D3D11_INPUT_ELEMENT_DESC m_StatVertexLayout[5]; }; inline D3D11_INPUT_ELEMENT_DESC VertexPosTexColNormTan::m_StatVertexLayout[5] { {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0 * 4, D3D11_INPUT_PER_VERTEX_DATA, 0}, { "UV", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (3) * 4, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, (3 + 2) * 4, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, (3 + 2 + 3) * 4, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, (3 + 2 + 3 + 3) * 4, D3D11_INPUT_PER_VERTEX_DATA, 0 } }; struct TrianglePosCol { TrianglePosCol() = default; TrianglePosCol(VertexPosCol v0, VertexPosCol v1, VertexPosCol v2) : m_V0{ v0 }, m_V1{ v1 }, m_V2{ v2 }{}; VertexPosCol m_V0{}; VertexPosCol m_V1{}; VertexPosCol m_V2{}; }; struct TrianglePosTexCol { TrianglePosTexCol() = default; TrianglePosTexCol(VertexPosTexCol v0, VertexPosTexCol v1, VertexPosTexCol v2) : m_V0{ v0 }, m_V1{ v1 }, m_V2{ v2 }{}; VertexPosTexCol m_V0{}; VertexPosTexCol m_V1{}; VertexPosTexCol m_V2{}; }; }
0.016226
{}
#ifndef ASLAM_CV_MATCHING_PROBLEM_FRAME_TO_FRAME_H_ #define ASLAM_CV_MATCHING_PROBLEM_FRAME_TO_FRAME_H_ /// \addtogroup Matching /// @{ /// /// @} #include <map> #include <memory> #include <vector> #include <aslam/common/macros.h> #include <aslam/common/memory.h> #include <aslam/common/pose-types.h> #include <aslam/common/feature-descriptor-ref.h> #include <Eigen/Core> #include "aslam/matcher/match.h" #include "aslam/matcher/matching-problem.h" namespace aslam { class VisualFrame; /// \class MatchingProblem /// \brief Defines the specifics of a matching problem. /// The problem is assumed to have two visual frames (apple_frame and banana_frame) filled with /// keypoints and binary descriptors and a rotation matrix taking vectors from the banana frame /// into the apple frame. The problem matches banana features against apple features. /// /// Coordinate Frames: /// A: apple frame /// B: banana frame class MatchingProblemFrameToFrame : public MatchingProblem { public: ASLAM_POINTER_TYPEDEFS(MatchingProblemFrameToFrame); ASLAM_DISALLOW_EVIL_CONSTRUCTORS(MatchingProblemFrameToFrame); ASLAM_ADD_MATCH_TYPEDEFS(FrameToFrame); friend class MatcherTest; MatchingProblemFrameToFrame() = delete; /// \brief Constructor for a frame-to-frame matching problem. /// /// @param[in] apple_frame Apple frame. /// @param[in] banana_frame Banana frame. /// @param[in] q_A_B Quaternion taking vectors from /// the banana frame into the /// apple frame. /// @param[in] image_space_distance_threshold_pixels Max image space distance threshold /// for two pairs to become match /// candidates. /// @param[in] hamming_distance_threshold Max hamming distance for two pairs /// to become candidates. MatchingProblemFrameToFrame(const VisualFrame& apple_frame, const VisualFrame& banana_frame, const aslam::Quaternion& q_A_B, double image_space_distance_threshold_pixels, int hamming_distance_threshold); virtual ~MatchingProblemFrameToFrame() {}; virtual size_t numApples() const; virtual size_t numBananas() const; /// Get a short list of candidates in list a for index b /// /// \param[in] frame_banana_keypoint_index The index of b queried for candidates. /// \param[out] candidates Candidates from the apple frame keypoints that could /// potentially match the given keypoint from the banana frame. virtual void getAppleCandidatesForBanana(int frame_banana_keypoint_index, Candidates* candidates); inline double computeMatchScore(int hamming_distance) { return static_cast<double>(384 - hamming_distance) / 384.0; } inline int computeHammingDistance(int banana_index, int apple_index) { CHECK_LT(apple_index, static_cast<int>(apple_descriptors_.size())) << "No descriptor for this apple."; CHECK_LT(banana_index, static_cast<int>(banana_descriptors_.size())) << "No descriptor for this banana."; CHECK_LT(apple_index, static_cast<int>(valid_apples_.size())) << "No valid flag for this apple."; CHECK_LT(banana_index, static_cast<int>(valid_bananas_.size())) << "No valid flag for this apple."; CHECK(valid_apples_[apple_index]) << "The given apple is not valid."; CHECK(valid_bananas_[banana_index]) << "The given banana is not valid."; const common::FeatureDescriptorConstRef& apple_descriptor = apple_descriptors_[apple_index]; const common::FeatureDescriptorConstRef& banana_descriptor = banana_descriptors_[banana_index]; CHECK_NOTNULL(apple_descriptor.data()); CHECK_NOTNULL(banana_descriptor.data()); return common::GetNumBitsDifferent(banana_descriptor, apple_descriptor); } /// \brief Gets called at the beginning of the matching problem. /// Creates a y-coordinate LUT for all apple keypoints and projects all banana keypoints into the /// apple frame. virtual bool doSetup(); private: /// The apple frame. const VisualFrame& apple_frame_; /// The banana frame. const VisualFrame& banana_frame_; /// Rotation matrix taking vectors from the banana frame into the apple frame. aslam::Quaternion q_A_B_; /// Map mapping y coordinates in the image plane onto keypoint indices of apple keypoints. std::multimap<size_t, size_t> y_coordinate_to_apple_keypoint_index_map_; /// Index marking apples as valid or invalid. std::vector<bool> valid_apples_; /// Index marking bananas as valid or invalid. std::vector<bool> valid_bananas_; /// The banana keypoints projected into the apple frame, expressed in the apple frame. Aligned<std::vector, Eigen::Vector2d> A_projected_keypoints_banana_; /// The apple descriptors. std::vector<common::FeatureDescriptorConstRef> apple_descriptors_; /// The banana descriptors. std::vector<common::FeatureDescriptorConstRef> banana_descriptors_; /// Descriptor size in bytes. size_t descriptor_size_bytes_; /// Half width of the vertical band used for match lookup in pixels. int vertical_band_halfwidth_pixels_; /// Pairs with image space distance >= image_space_distance_threshold_pixels_ are /// excluded from matches. double squared_image_space_distance_threshold_px_sq_; /// Pairs with descriptor distance >= hamming_distance_threshold_ are /// excluded from matches. int hamming_distance_threshold_; /// The heigh of the apple frame. size_t image_height_apple_frame_; }; } #endif //ASLAM_CV_MATCHING_PROBLEM_FRAME_TO_FRAME_H_
#ifndef ASLAM_CV_MATCHING_PROBLEM_FRAME_TO_FRAME_H_ #define ASLAM_CV_MATCHING_PROBLEM_FRAME_TO_FRAME_H_ /// \addtogroup Matching /// @{ /// /// @} #include <IMPORT_0> #include <IMPORT_1> #include <IMPORT_2> #include <IMPORT_3> #include <IMPORT_4> #include <IMPORT_5> #include <IMPORT_6> #include <Eigen/Core> #include "IMPORT_7" #include "aslam/matcher/matching-problem.h" CLASS_0 VAR_0 { CLASS_1 VAR_2; /// \class MatchingProblem /// \brief Defines the specifics of a matching problem. /// The problem is assumed to have two visual frames (apple_frame and banana_frame) filled with /// keypoints and binary descriptors and a rotation matrix taking vectors from the banana frame /// into the apple frame. The problem matches banana features against apple features. /// /// Coordinate Frames: /// A: apple frame /// B: banana frame CLASS_1 VAR_3 : VAR_4 MatchingProblem { public: FUNC_1(VAR_3); FUNC_2(VAR_3); FUNC_3(FrameToFrame); CLASS_3 VAR_1 VAR_5; FUNC_0() = VAR_6; /// \brief Constructor for a frame-to-frame matching problem. /// /// @param[in] apple_frame Apple frame. /// @param[in] banana_frame Banana frame. /// @param[in] q_A_B Quaternion taking vectors from /// the banana frame into the /// apple frame. /// @param[in] image_space_distance_threshold_pixels Max image space distance threshold /// for two pairs to become match /// candidates. /// @param[in] hamming_distance_threshold Max hamming distance for two pairs /// to become candidates. VAR_3(const CLASS_2& VAR_7, VAR_8 VAR_2& VAR_9, VAR_8 aslam::VAR_10& VAR_11, VAR_12 VAR_13, VAR_14 hamming_distance_threshold); CLASS_4 ~FUNC_0() {}; CLASS_4 VAR_15 FUNC_4() const; CLASS_4 VAR_15 FUNC_5() VAR_8; /// Get a short list of candidates in list a for index b /// /// \param[in] frame_banana_keypoint_index The index of b queried for candidates. /// \param[out] candidates Candidates from the apple frame keypoints that could /// potentially match the given keypoint from the banana frame. CLASS_4 VAR_16 getAppleCandidatesForBanana(int VAR_17, CLASS_5* VAR_18); inline double FUNC_6(int hamming_distance) { return VAR_19<VAR_12>(384 - hamming_distance) / 384.0; } inline int computeHammingDistance(int VAR_20, int VAR_21) { FUNC_7(VAR_21, VAR_19<VAR_14>(apple_descriptors_.FUNC_8())) << "No descriptor for this apple."; FUNC_7(VAR_20, VAR_19<VAR_14>(VAR_22.FUNC_8())) << "No descriptor for this banana."; FUNC_7(VAR_21, VAR_19<VAR_14>(VAR_23.FUNC_8())) << "No valid flag for this apple."; FUNC_7(VAR_20, VAR_19<VAR_14>(VAR_24.FUNC_8())) << "No valid flag for this apple."; FUNC_9(VAR_23[VAR_21]) << "The given apple is not valid."; FUNC_9(VAR_24[VAR_20]) << "The given banana is not valid."; const CLASS_6::VAR_26& VAR_27 = apple_descriptors_[VAR_21]; const CLASS_6::VAR_26& VAR_28 = VAR_22[VAR_20]; FUNC_10(VAR_27.FUNC_11()); FUNC_10(VAR_28.FUNC_11()); return VAR_25::GetNumBitsDifferent(VAR_28, VAR_27); } /// \brief Gets called at the beginning of the matching problem. /// Creates a y-coordinate LUT for all apple keypoints and projects all banana keypoints into the /// apple frame. CLASS_4 bool FUNC_12(); private: /// The apple frame. VAR_8 VAR_2& VAR_29; /// The banana frame. const CLASS_2& VAR_30; /// Rotation matrix taking vectors from the banana frame into the apple frame. aslam::VAR_10 VAR_31; /// Map mapping y coordinates in the image plane onto keypoint indices of apple keypoints. std::VAR_33<VAR_15, VAR_15> VAR_34; /// Index marking apples as valid or invalid. std::IMPORT_2<bool> VAR_23; /// Index marking bananas as valid or invalid. std::IMPORT_2<bool> VAR_24; /// The banana keypoints projected into the apple frame, expressed in the apple frame. VAR_35<VAR_32::IMPORT_2, VAR_36::Vector2d> VAR_37; /// The apple descriptors. std::IMPORT_2<VAR_25::VAR_26> apple_descriptors_; /// The banana descriptors. std::IMPORT_2<VAR_25::VAR_26> VAR_22; /// Descriptor size in bytes. size_t VAR_38; /// Half width of the vertical band used for match lookup in pixels. int VAR_39; /// Pairs with image space distance >= image_space_distance_threshold_pixels_ are /// excluded from matches. double VAR_40; /// Pairs with descriptor distance >= hamming_distance_threshold_ are /// excluded from matches. int VAR_41; /// The heigh of the apple frame. size_t image_height_apple_frame_; }; } #endif //ASLAM_CV_MATCHING_PROBLEM_FRAME_TO_FRAME_H_
0.784932
{'IMPORT_0': 'map', 'IMPORT_1': 'memory', 'IMPORT_2': 'vector', 'IMPORT_3': 'aslam/common/macros.h', 'IMPORT_4': 'aslam/common/memory.h', 'IMPORT_5': 'aslam/common/pose-types.h', 'IMPORT_6': 'aslam/common/feature-descriptor-ref.h', 'IMPORT_7': 'aslam/matcher/match.h', 'CLASS_0': 'namespace', 'VAR_0': 'aslam', 'CLASS_1': 'class', 'VAR_1': 'class', 'VAR_2': 'VisualFrame', 'CLASS_2': 'VisualFrame', 'VAR_3': 'MatchingProblemFrameToFrame', 'FUNC_0': 'MatchingProblemFrameToFrame', 'VAR_4': 'public', 'FUNC_1': 'ASLAM_POINTER_TYPEDEFS', 'FUNC_2': 'ASLAM_DISALLOW_EVIL_CONSTRUCTORS', 'FUNC_3': 'ASLAM_ADD_MATCH_TYPEDEFS', 'CLASS_3': 'friend', 'VAR_5': 'MatcherTest', 'VAR_6': 'delete', 'VAR_7': 'apple_frame', 'VAR_8': 'const', 'VAR_9': 'banana_frame', 'VAR_10': 'Quaternion', 'VAR_11': 'q_A_B', 'VAR_12': 'double', 'VAR_13': 'image_space_distance_threshold_pixels', 'VAR_14': 'int', 'CLASS_4': 'virtual', 'VAR_15': 'size_t', 'FUNC_4': 'numApples', 'FUNC_5': 'numBananas', 'VAR_16': 'void', 'VAR_17': 'frame_banana_keypoint_index', 'CLASS_5': 'Candidates', 'VAR_18': 'candidates', 'FUNC_6': 'computeMatchScore', 'VAR_19': 'static_cast', 'VAR_20': 'banana_index', 'VAR_21': 'apple_index', 'FUNC_7': 'CHECK_LT', 'FUNC_8': 'size', 'VAR_22': 'banana_descriptors_', 'VAR_23': 'valid_apples_', 'VAR_24': 'valid_bananas_', 'FUNC_9': 'CHECK', 'CLASS_6': 'common', 'VAR_25': 'common', 'VAR_26': 'FeatureDescriptorConstRef', 'VAR_27': 'apple_descriptor', 'VAR_28': 'banana_descriptor', 'FUNC_10': 'CHECK_NOTNULL', 'FUNC_11': 'data', 'FUNC_12': 'doSetup', 'VAR_29': 'apple_frame_', 'VAR_30': 'banana_frame_', 'VAR_31': 'q_A_B_', 'VAR_32': 'std', 'VAR_33': 'multimap', 'VAR_34': 'y_coordinate_to_apple_keypoint_index_map_', 'VAR_35': 'Aligned', 'VAR_36': 'Eigen', 'VAR_37': 'A_projected_keypoints_banana_', 'VAR_38': 'descriptor_size_bytes_', 'VAR_39': 'vertical_band_halfwidth_pixels_', 'VAR_40': 'squared_image_space_distance_threshold_px_sq_', 'VAR_41': 'hamming_distance_threshold_'}
/* * Push x on top of the stack */ static void remap_undo_stack_push(remap_undo_stack_t *stack, int32_t x) { uint32_t i; i = stack->top; if (i == stack->size) { extend_remap_undo_stack(stack); } assert(i < stack->size); stack->data[i] = x; stack->top = i+1; }
/* * Push x on top of the stack */ static void FUNC_0(CLASS_0 *VAR_0, int32_t VAR_1) { uint32_t VAR_2; VAR_2 = VAR_0->VAR_3; if (VAR_2 == VAR_0->VAR_4) { FUNC_1(VAR_0); } FUNC_2(VAR_2 < VAR_0->VAR_4); VAR_0->VAR_5[VAR_2] = VAR_1; VAR_0->VAR_3 = VAR_2+1; }
0.849983
{'FUNC_0': 'remap_undo_stack_push', 'CLASS_0': 'remap_undo_stack_t', 'VAR_0': 'stack', 'VAR_1': 'x', 'VAR_2': 'i', 'VAR_3': 'top', 'VAR_4': 'size', 'FUNC_1': 'extend_remap_undo_stack', 'FUNC_2': 'assert', 'VAR_5': 'data'}
#include <nanafy.h> #include <stddef.h> size_t sizeof_nanafy_section_product (nanafy_section section, nanafy *nana){ return nanafy_section_file_size(section, nana); }
#include <nanafy.h> #include <IMPORT_0> size_t sizeof_nanafy_section_product (CLASS_0 VAR_0, CLASS_1 *VAR_1){ return FUNC_0(VAR_0, VAR_1); }
0.54758
{'IMPORT_0': 'stddef.h', 'CLASS_0': 'nanafy_section', 'VAR_0': 'section', 'CLASS_1': 'nanafy', 'VAR_1': 'nana', 'FUNC_0': 'nanafy_section_file_size'}
#ifndef GPLAY_H #define GPLAY_H #define PLAY_PLAYING 0x00 #define PLAY_BEGINNING 0x01 #define PLAY_POS 0x02 #define PLAY_PATTERN 0x03 #define PLAY_STOP 0x04 #define PLAY_STOPPED 0x80 typedef struct { unsigned char trans; unsigned char instr; unsigned char note; unsigned char lastnote; unsigned char newnote; unsigned pattptr; unsigned char pattnum; unsigned char songptr; unsigned char repeat; unsigned short freq; unsigned char gate; unsigned char wave; unsigned short pulse; unsigned char ptr[2]; unsigned char pulsetime; unsigned char wavetime; unsigned char vibtime; unsigned char vibdelay; unsigned char command; unsigned char cmddata; unsigned char newcommand; unsigned char newcmddata; unsigned char tick; unsigned char tempo; unsigned char mute; unsigned char advance; unsigned char gatetimer; } CHN; #ifndef GPLAY_C extern CHN chn[MAX_CHN]; extern unsigned char masterfader; extern unsigned char freqtbllo[]; extern unsigned char freqtblhi[]; extern int lastsonginit; #endif void initchannels(void); void initsong(int num, int playmode); void initsongpos(int num, int playmode, int pattpos); void stopsong(void); void rewindsong(void); void playtestnote(int note, int ins, int chnnum); void releasenote(int chnnum); void mutechannel(int chnnum); int isplaying(void); void playroutine(void); #endif
#ifndef VAR_0 #define VAR_0 #define VAR_1 0x00 #define PLAY_BEGINNING 0x01 #define PLAY_POS 0x02 #define VAR_2 0x03 #define VAR_3 0x04 #define VAR_4 0x80 typedef struct { unsigned char trans; unsigned char instr; unsigned char VAR_5; unsigned char VAR_6; unsigned char VAR_7; unsigned VAR_8; unsigned char pattnum; unsigned char VAR_9; unsigned char repeat; unsigned short freq; unsigned char gate; unsigned char VAR_10; unsigned short pulse; unsigned char ptr[2]; unsigned char VAR_11; unsigned char VAR_12; unsigned char vibtime; unsigned char VAR_13; unsigned char VAR_14; unsigned char cmddata; unsigned char newcommand; unsigned char newcmddata; unsigned char VAR_15; unsigned char tempo; unsigned char VAR_16; unsigned char VAR_17; unsigned char gatetimer; } ID_0; #ifndef VAR_18 extern CLASS_0 VAR_19[VAR_20]; extern unsigned char VAR_21; extern unsigned char VAR_22[]; extern unsigned char freqtblhi[]; extern int VAR_23; #endif void FUNC_0(void); void FUNC_1(int num, int VAR_24); void FUNC_2(int num, int VAR_24, int pattpos); void FUNC_3(void); void FUNC_4(void); void FUNC_5(int VAR_5, int VAR_25, int chnnum); void releasenote(int chnnum); void mutechannel(int chnnum); int isplaying(void); void playroutine(void); #endif
0.565274
{'VAR_0': 'GPLAY_H', 'VAR_1': 'PLAY_PLAYING', 'VAR_2': 'PLAY_PATTERN', 'VAR_3': 'PLAY_STOP', 'VAR_4': 'PLAY_STOPPED', 'VAR_5': 'note', 'VAR_6': 'lastnote', 'VAR_7': 'newnote', 'VAR_8': 'pattptr', 'VAR_9': 'songptr', 'VAR_10': 'wave', 'VAR_11': 'pulsetime', 'VAR_12': 'wavetime', 'VAR_13': 'vibdelay', 'VAR_14': 'command', 'VAR_15': 'tick', 'VAR_16': 'mute', 'VAR_17': 'advance', 'ID_0': 'CHN', 'CLASS_0': 'CHN', 'VAR_18': 'GPLAY_C', 'VAR_19': 'chn', 'VAR_20': 'MAX_CHN', 'VAR_21': 'masterfader', 'VAR_22': 'freqtbllo', 'VAR_23': 'lastsonginit', 'FUNC_0': 'initchannels', 'FUNC_1': 'initsong', 'VAR_24': 'playmode', 'FUNC_2': 'initsongpos', 'FUNC_3': 'stopsong', 'FUNC_4': 'rewindsong', 'FUNC_5': 'playtestnote', 'VAR_25': 'ins'}
// // Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Sep 26 2020 13:48:20). // // Copyright (C) 1997-2019 <NAME>. // #import <ProtocolBuffer/PBCodable.h> #import "NSCopying-Protocol.h" @class NSMutableArray; @interface NRPBPropertyResponse : PBCodable <NSCopying> { NSMutableArray *_properties; // 8 = 0x8 } + (Class)propertiesType; // IMP=0x000000010009a070 - (void).cxx_destruct; // IMP=0x000000010009aa8c @property(retain, nonatomic) NSMutableArray *properties; // @synthesize properties=_properties; - (void)mergeFrom:(id)arg1; // IMP=0x000000010009a940 - (unsigned long long)hash; // IMP=0x000000010009a928 - (_Bool)isEqual:(id)arg1; // IMP=0x000000010009a888 - (id)copyWithZone:(struct _NSZone *)arg1; // IMP=0x000000010009a710 - (void)copyTo:(id)arg1; // IMP=0x000000010009a63c - (void)writeTo:(id)arg1; // IMP=0x000000010009a510 - (_Bool)readFrom:(id)arg1; // IMP=0x000000010009a508 - (id)dictionaryRepresentation; // IMP=0x000000010009a130 - (id)description; // IMP=0x000000010009a07c - (id)propertiesAtIndex:(unsigned long long)arg1; // IMP=0x000000010009a058 - (unsigned long long)propertiesCount; // IMP=0x000000010009a040 - (void)addProperties:(id)arg1; // IMP=0x0000000100099fcc - (void)clearProperties; // IMP=0x0000000100099fb4 @end
// // Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Sep 26 2020 13:48:20). // // Copyright (C) 1997-2019 <NAME>. // #import <ProtocolBuffer/PBCodable.h> #import "NSCopying-Protocol.h" @CLASS_0 VAR_0; @CLASS_2 VAR_1 : VAR_2 <VAR_3> { CLASS_1 *VAR_4; // 8 = 0x8 } + (ID_0)propertiesType; // IMP=0x000000010009a070 - (void).VAR_5; // IMP=0x000000010009aa8c @FUNC_0(VAR_6, VAR_7) CLASS_1 *VAR_8; // @synthesize properties=_properties; - (void)VAR_9:(VAR_10)VAR_11; // IMP=0x000000010009a940 - (unsigned long long)VAR_12; // IMP=0x000000010009a928 - (ID_2)VAR_13:(VAR_10)VAR_11; // IMP=0x000000010009a888 - (ID_1)VAR_14:(struct CLASS_3 *)VAR_11; // IMP=0x000000010009a710 - (void)VAR_15:(VAR_10)VAR_11; // IMP=0x000000010009a63c - (void)VAR_16:(VAR_10)VAR_11; // IMP=0x000000010009a510 - (ID_2)VAR_17:(VAR_10)VAR_11; // IMP=0x000000010009a508 - (ID_1)VAR_18; // IMP=0x000000010009a130 - (ID_1)VAR_19; // IMP=0x000000010009a07c - (ID_1)VAR_20:(unsigned long long)VAR_11; // IMP=0x000000010009a058 - (unsigned long long)VAR_21; // IMP=0x000000010009a040 - (void)VAR_22:(VAR_10)VAR_11; // IMP=0x0000000100099fcc - (void)VAR_23; // IMP=0x0000000100099fb4 @CLASS_4
0.933432
{'CLASS_0': 'class', 'VAR_0': 'NSMutableArray', 'CLASS_1': 'NSMutableArray', 'CLASS_2': 'interface', 'VAR_1': 'NRPBPropertyResponse', 'VAR_2': 'PBCodable', 'VAR_3': 'NSCopying', 'VAR_4': '_properties', 'ID_0': 'Class', 'VAR_5': 'cxx_destruct', 'FUNC_0': 'property', 'VAR_6': 'retain', 'VAR_7': 'nonatomic', 'VAR_8': 'properties', 'VAR_9': 'mergeFrom', 'VAR_10': 'id', 'ID_1': 'id', 'VAR_11': 'arg1', 'VAR_12': 'hash', 'ID_2': '_Bool', 'VAR_13': 'isEqual', 'VAR_14': 'copyWithZone', 'CLASS_3': '_NSZone', 'VAR_15': 'copyTo', 'VAR_16': 'writeTo', 'VAR_17': 'readFrom', 'VAR_18': 'dictionaryRepresentation', 'VAR_19': 'description', 'VAR_20': 'propertiesAtIndex', 'VAR_21': 'propertiesCount', 'VAR_22': 'addProperties', 'VAR_23': 'clearProperties', 'CLASS_4': 'end'}
/* * TLP Timer, here we simply setup what segment we want to * have the TLP expire on, the normal rack_output() will then * send it out. * * We return 1, saying don't proceed with rack_output only * when all timers have been stopped (destroyed PCB?). */ static int rack_timeout_tlp(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) { struct rack_sendmap *rsm = NULL; struct rack_sendmap *insret; struct socket *so; uint32_t amm, old_prr_snd = 0; uint32_t out, avail; int collapsed_win = 0; if (tp->t_timers->tt_flags & TT_STOPPED) { return (1); } if (TSTMP_LT(cts, rack->r_ctl.rc_timer_exp)) { return (0); } if (rack_progress_timeout_check(tp)) { tcp_set_inp_to_drop(tp->t_inpcb, ETIMEDOUT); return (1); } rack_log_to_event(rack, RACK_TO_FRM_TLP, 0); counter_u64_add(rack_tlp_tot, 1); if (rack->r_state && (rack->r_state != tp->t_state)) rack_set_state(tp, rack); so = tp->t_inpcb->inp_socket; #ifdef KERN_TLS if (rack->rc_inp->inp_socket->so_snd.sb_flags & SB_TLS_IFNET) { goto need_retran; } #endif avail = sbavail(&so->so_snd); out = tp->snd_max - tp->snd_una; rack->tlp_timer_up = 1; if (out > tp->snd_wnd) { collapsed_win = 1; goto need_retran; } if ((avail > out) && ((rack_always_send_oldest == 0) || (TAILQ_EMPTY(&rack->r_ctl.rc_tmap)))) { amm = avail - out; if (amm > ctf_fixed_maxseg(tp)) { amm = ctf_fixed_maxseg(tp); } else if ((amm < ctf_fixed_maxseg(tp)) && ((tp->t_flags & TF_NODELAY) == 0)) { goto need_retran; } if (IN_RECOVERY(tp->t_flags)) { old_prr_snd = rack->r_ctl.rc_prr_sndcnt; if (out + amm <= tp->snd_wnd) { rack->r_ctl.rc_prr_sndcnt = amm; rack_log_to_prr(rack, 4); } else goto need_retran; } else { if (out + amm <= tp->snd_wnd) rack->r_ctl.rc_tlp_new_data = amm; else goto need_retran; } rack->r_ctl.rc_tlp_seg_send_cnt = 0; rack->r_ctl.rc_last_tlp_seq = tp->snd_max; rack->r_ctl.rc_tlpsend = NULL; counter_u64_add(rack_tlp_newdata, 1); goto send; } need_retran: if (collapsed_win == 0) { if (rack_always_send_oldest) rsm = TAILQ_FIRST(&rack->r_ctl.rc_tmap); else { rsm = RB_MAX(rack_rb_tree_head, &rack->r_ctl.rc_mtree); if (rsm && (rsm->r_flags & (RACK_ACKED | RACK_HAS_FIN))) { rsm = rack_find_high_nonack(rack, rsm); } } if (rsm == NULL) { counter_u64_add(rack_tlp_does_nada, 1); #ifdef TCP_BLACKBOX tcp_log_dump_tp_logbuf(tp, "nada counter trips", M_NOWAIT, true); #endif goto out; } } else { RB_FOREACH_REVERSE(rsm, rack_rb_tree_head, &rack->r_ctl.rc_mtree) { if ((rsm->r_flags & RACK_RWND_COLLAPSED) == 0) { break; } } if (rsm == NULL) { rsm = RB_MIN(rack_rb_tree_head, &rack->r_ctl.rc_mtree); if (rsm == NULL) { counter_u64_add(rack_tlp_does_nada, 1); #ifdef TCP_BLACKBOX tcp_log_dump_tp_logbuf(tp, "nada counter trips", M_NOWAIT, true); #endif goto out; } } } if ((rsm->r_end - rsm->r_start) > ctf_fixed_maxseg(tp)) { struct rack_sendmap *nrsm; nrsm = rack_alloc_full_limit(rack); if (nrsm == NULL) { counter_u64_add(rack_tlp_does_nada, 1); goto out; } rack_clone_rsm(rack, nrsm, rsm, (rsm->r_end - ctf_fixed_maxseg(tp))); insret = RB_INSERT(rack_rb_tree_head, &rack->r_ctl.rc_mtree, nrsm); #ifdef INVARIANTS if (insret != NULL) { panic("Insert in rb tree of %p fails ret:%p rack:%p rsm:%p", nrsm, insret, rack, rsm); } #endif if (rsm->r_in_tmap) { TAILQ_INSERT_AFTER(&rack->r_ctl.rc_tmap, rsm, nrsm, r_tnext); nrsm->r_in_tmap = 1; } rsm->r_flags &= (~RACK_HAS_FIN); rsm = nrsm; } rack->r_ctl.rc_tlpsend = rsm; rack->r_ctl.rc_tlp_rtx_out = 1; if (rsm->r_start == rack->r_ctl.rc_last_tlp_seq) { rack->r_ctl.rc_tlp_seg_send_cnt++; tp->t_rxtshift++; } else { rack->r_ctl.rc_last_tlp_seq = rsm->r_start; rack->r_ctl.rc_tlp_seg_send_cnt = 1; } send: rack->r_ctl.rc_tlp_send_cnt++; if (rack->r_ctl.rc_tlp_send_cnt > rack_tlp_max_resend) { restore: rack->r_ctl.rc_tlpsend = NULL; if (rsm) rsm->r_flags &= ~RACK_TLP; rack->r_ctl.rc_prr_sndcnt = old_prr_snd; rack_log_to_prr(rack, 5); counter_u64_add(rack_tlp_retran_fail, 1); goto out; } else if (rsm) { rsm->r_flags |= RACK_TLP; } if (rsm && (rsm->r_start == rack->r_ctl.rc_last_tlp_seq) && (rack->r_ctl.rc_tlp_seg_send_cnt > rack_tlp_max_resend)) { goto restore; } rack->r_timer_override = 1; rack->r_tlp_running = 1; rack->rc_tlp_in_progress = 1; rack->r_ctl.rc_hpts_flags &= ~PACE_TMR_TLP; return (0); out: rack->tlp_timer_up = 0; rack->r_ctl.rc_hpts_flags &= ~PACE_TMR_TLP; return (0); }
/* * TLP Timer, here we simply setup what segment we want to * have the TLP expire on, the normal rack_output() will then * send it out. * * We return 1, saying don't proceed with rack_output only * when all timers have been stopped (destroyed PCB?). */ static int FUNC_0(struct tcpcb *tp, struct tcp_rack *VAR_0, uint32_t VAR_1) { struct CLASS_0 *rsm = NULL; struct CLASS_0 *insret; struct CLASS_1 *VAR_2; uint32_t amm, old_prr_snd = 0; uint32_t VAR_3, avail; int collapsed_win = 0; if (tp->t_timers->VAR_4 & TT_STOPPED) { return (1); } if (FUNC_1(VAR_1, VAR_0->VAR_5.rc_timer_exp)) { return (0); } if (rack_progress_timeout_check(tp)) { tcp_set_inp_to_drop(tp->t_inpcb, ETIMEDOUT); return (1); } rack_log_to_event(VAR_0, VAR_6, 0); counter_u64_add(rack_tlp_tot, 1); if (VAR_0->VAR_7 && (VAR_0->VAR_7 != tp->VAR_8)) FUNC_2(tp, VAR_0); VAR_2 = tp->t_inpcb->inp_socket; #ifdef VAR_9 if (VAR_0->VAR_10->inp_socket->so_snd.sb_flags & SB_TLS_IFNET) { goto need_retran; } #endif avail = FUNC_3(&VAR_2->so_snd); VAR_3 = tp->VAR_11 - tp->snd_una; VAR_0->tlp_timer_up = 1; if (VAR_3 > tp->snd_wnd) { collapsed_win = 1; goto need_retran; } if ((avail > VAR_3) && ((rack_always_send_oldest == 0) || (FUNC_4(&VAR_0->VAR_5.rc_tmap)))) { amm = avail - VAR_3; if (amm > ctf_fixed_maxseg(tp)) { amm = ctf_fixed_maxseg(tp); } else if ((amm < ctf_fixed_maxseg(tp)) && ((tp->VAR_12 & TF_NODELAY) == 0)) { goto need_retran; } if (IN_RECOVERY(tp->VAR_12)) { old_prr_snd = VAR_0->VAR_5.VAR_13; if (VAR_3 + amm <= tp->snd_wnd) { VAR_0->VAR_5.VAR_13 = amm; FUNC_5(VAR_0, 4); } else goto need_retran; } else { if (VAR_3 + amm <= tp->snd_wnd) VAR_0->VAR_5.VAR_14 = amm; else goto need_retran; } VAR_0->VAR_5.VAR_15 = 0; VAR_0->VAR_5.rc_last_tlp_seq = tp->VAR_11; VAR_0->VAR_5.rc_tlpsend = NULL; counter_u64_add(rack_tlp_newdata, 1); goto send; } need_retran: if (collapsed_win == 0) { if (rack_always_send_oldest) rsm = TAILQ_FIRST(&VAR_0->VAR_5.rc_tmap); else { rsm = RB_MAX(VAR_16, &VAR_0->VAR_5.rc_mtree); if (rsm && (rsm->r_flags & (RACK_ACKED | RACK_HAS_FIN))) { rsm = rack_find_high_nonack(VAR_0, rsm); } } if (rsm == NULL) { counter_u64_add(VAR_17, 1); #ifdef TCP_BLACKBOX FUNC_6(tp, "nada counter trips", VAR_18, true); #endif goto out; } } else { RB_FOREACH_REVERSE(rsm, VAR_16, &VAR_0->VAR_5.rc_mtree) { if ((rsm->r_flags & VAR_19) == 0) { break; } } if (rsm == NULL) { rsm = FUNC_7(VAR_16, &VAR_0->VAR_5.rc_mtree); if (rsm == NULL) { counter_u64_add(VAR_17, 1); #ifdef TCP_BLACKBOX FUNC_6(tp, "nada counter trips", VAR_18, true); #endif goto out; } } } if ((rsm->VAR_20 - rsm->VAR_21) > ctf_fixed_maxseg(tp)) { struct CLASS_0 *nrsm; nrsm = rack_alloc_full_limit(VAR_0); if (nrsm == NULL) { counter_u64_add(VAR_17, 1); goto out; } FUNC_8(VAR_0, nrsm, rsm, (rsm->VAR_20 - ctf_fixed_maxseg(tp))); insret = RB_INSERT(VAR_16, &VAR_0->VAR_5.rc_mtree, nrsm); #ifdef VAR_22 if (insret != NULL) { panic("Insert in rb tree of %p fails ret:%p rack:%p rsm:%p", nrsm, insret, VAR_0, rsm); } #endif if (rsm->r_in_tmap) { TAILQ_INSERT_AFTER(&VAR_0->VAR_5.rc_tmap, rsm, nrsm, r_tnext); nrsm->r_in_tmap = 1; } rsm->r_flags &= (~RACK_HAS_FIN); rsm = nrsm; } VAR_0->VAR_5.rc_tlpsend = rsm; VAR_0->VAR_5.rc_tlp_rtx_out = 1; if (rsm->VAR_21 == VAR_0->VAR_5.rc_last_tlp_seq) { VAR_0->VAR_5.VAR_15++; tp->VAR_23++; } else { VAR_0->VAR_5.rc_last_tlp_seq = rsm->VAR_21; VAR_0->VAR_5.VAR_15 = 1; } send: VAR_0->VAR_5.VAR_24++; if (VAR_0->VAR_5.VAR_24 > VAR_25) { restore: VAR_0->VAR_5.rc_tlpsend = NULL; if (rsm) rsm->r_flags &= ~VAR_26; VAR_0->VAR_5.VAR_13 = old_prr_snd; FUNC_5(VAR_0, 5); counter_u64_add(rack_tlp_retran_fail, 1); goto out; } else if (rsm) { rsm->r_flags |= VAR_26; } if (rsm && (rsm->VAR_21 == VAR_0->VAR_5.rc_last_tlp_seq) && (VAR_0->VAR_5.VAR_15 > VAR_25)) { goto restore; } VAR_0->VAR_27 = 1; VAR_0->r_tlp_running = 1; VAR_0->rc_tlp_in_progress = 1; VAR_0->VAR_5.rc_hpts_flags &= ~PACE_TMR_TLP; return (0); out: VAR_0->tlp_timer_up = 0; VAR_0->VAR_5.rc_hpts_flags &= ~PACE_TMR_TLP; return (0); }
0.444945
{'FUNC_0': 'rack_timeout_tlp', 'VAR_0': 'rack', 'VAR_1': 'cts', 'CLASS_0': 'rack_sendmap', 'CLASS_1': 'socket', 'VAR_2': 'so', 'VAR_3': 'out', 'VAR_4': 'tt_flags', 'FUNC_1': 'TSTMP_LT', 'VAR_5': 'r_ctl', 'VAR_6': 'RACK_TO_FRM_TLP', 'VAR_7': 'r_state', 'VAR_8': 't_state', 'FUNC_2': 'rack_set_state', 'VAR_9': 'KERN_TLS', 'VAR_10': 'rc_inp', 'FUNC_3': 'sbavail', 'VAR_11': 'snd_max', 'FUNC_4': 'TAILQ_EMPTY', 'VAR_12': 't_flags', 'VAR_13': 'rc_prr_sndcnt', 'FUNC_5': 'rack_log_to_prr', 'VAR_14': 'rc_tlp_new_data', 'VAR_15': 'rc_tlp_seg_send_cnt', 'VAR_16': 'rack_rb_tree_head', 'VAR_17': 'rack_tlp_does_nada', 'FUNC_6': 'tcp_log_dump_tp_logbuf', 'VAR_18': 'M_NOWAIT', 'VAR_19': 'RACK_RWND_COLLAPSED', 'FUNC_7': 'RB_MIN', 'VAR_20': 'r_end', 'VAR_21': 'r_start', 'FUNC_8': 'rack_clone_rsm', 'VAR_22': 'INVARIANTS', 'VAR_23': 't_rxtshift', 'VAR_24': 'rc_tlp_send_cnt', 'VAR_25': 'rack_tlp_max_resend', 'VAR_26': 'RACK_TLP', 'VAR_27': 'r_timer_override'}
// // GPForwards.h // GPDesignMode // // Created by 郭鹏 on 2017/3/7. // Copyright © 2017年 dandan. All rights reserved. // #import "GPPlayer.h" @interface GPForwards : GPPlayer @end
// // GPForwards.h // GPDesignMode // // Created by 郭鹏 on 2017/3/7. // Copyright © 2017年 dandan. All rights reserved. // #import "GPPlayer.h" @CLASS_0 VAR_0 : VAR_1 @VAR_2
0.977962
{'CLASS_0': 'interface', 'VAR_0': 'GPForwards', 'VAR_1': 'GPPlayer', 'VAR_2': 'end'}
/** * Finalize DDC library. Close DDC device * @return If succeed in closing DDC device or it is being used yet, return 1;@n * Otherwise, return 0. */ int DDCClose() { int ret = 1; if (ref_cnt == 0) { #if DDC_DEBUG ALOGE("%s: I2C_DDC is not available!!!!", __func__); #endif return 1; } if (ref_cnt > 1) { ref_cnt--; return 1; } if (close(ddc_fd) < 0) { #if DDC_DEBUG ALOGE("%s: Cannot close I2C_DDC : %s",__func__,DEV_NAME); #endif ret = 0; } ref_cnt--; ddc_fd = -1; return ret; }
/** * Finalize DDC library. Close DDC device * @return If succeed in closing DDC device or it is being used yet, return 1;@n * Otherwise, return 0. */ int FUNC_0() { int VAR_0 = 1; if (ref_cnt == 0) { #if DDC_DEBUG ALOGE("%s: I2C_DDC is not available!!!!", __func__); #endif return 1; } if (ref_cnt > 1) { ref_cnt--; return 1; } if (FUNC_1(VAR_1) < 0) { #if DDC_DEBUG ALOGE("%s: Cannot close I2C_DDC : %s",__func__,DEV_NAME); #endif VAR_0 = 0; } ref_cnt--; VAR_1 = -1; return VAR_0; }
0.557226
{'FUNC_0': 'DDCClose', 'VAR_0': 'ret', 'FUNC_1': 'close', 'VAR_1': 'ddc_fd'}
/* Ultima modificacion: 07/05 - 07:10 Modificado por: Diego */ int LineaValida ( char * ); int CargaConfigDatos( char *, char *, CFG * ); int CargaConfig ( CFG *Config ) { char ConfigFile[20] = CFG_FileName; char *ptr; char linea[200 + 2]; char campo[30 + 2]; int CantParams = 0; FILE *Arch; /* Cantidad de parametros que debe contener el archivo CFG */ Config->CantParams = CFG_CantParams; if ( (Arch = fopen(ConfigFile,"rt")) == NULL ) { printf( "ERROR: No se puede abrir el archivo de configuracion %s\n", ConfigFile ); return FAIL; } ptr = malloc ( 200 + 2 ); while ( fgets(linea,200+2,Arch) != NULL ) { if( LineaValida(linea) ) { ptr = strtok( linea, "=" ); if ( ptr == NULL ) { printf( "ERROR: El archivo de configuracion no tiene un formato valido\n" ); fclose( Arch ); return FAIL; } strcpy( campo, ptr ); ptr = strtok( NULL, ";" ); if ( ptr == NULL ) { printf( "ERROR: El archivo de configuracion no tiene un formato valido\n" ); fclose( Arch ); return FAIL; } if ( CargaConfigDatos( campo, ptr, Config) == OK ) { CantParams++; } } } if ( CantParams == Config->CantParams ) { /* Se cargaron todos los campos de la estructura */ return OK; } /* No se cargaron todos los campos */ printf( "ERROR: Falta(n) %d parametro(s) de configuracion en el archivo\n", Config->CantParams-CantParams ); return FAIL; } int LineaValida ( char *linea ) { char CommentChar = '#'; char line[200+2]; /*char *ptr;*/ /* Se planteo asi para futuras implementaciones de mejorias, por ahora no es necesario */ strcpy( line, linea ); /* Guarda una copia de la cadena original */ if ( line[0] == CommentChar ) { return FALSE; } if ( ! isalpha(line[0]) ) { return FALSE; } return TRUE; } int CargaConfigDatos( char *campo, char *valor, CFG *Config ) { struct in_addr strAddr; if ( strcmp(campo,"CantMaxEquipos") == 0 ) { Config->CantMaxEquipos = atoi(valor); } else if ( strcmp(campo,"DuracionPartidosMIN") == 0 ) { Config->DuracionPartidosMIN = atoi(valor); } else if ( strcmp(campo,"DuracionPartidosMAX") == 0 ) { Config->DuracionPartidosMAX = atoi(valor); } else if ( strcmp(campo,"TiempoInactividad") == 0 ) { Config->TiempoInactividad = atoi(valor); } else if ( strcmp(campo,"CansancioMAX") == 0 ) { Config->CansancioMAX = atoi(valor); } else if ( strcmp(campo,"EquiposCdeMAX") == 0 ) { Config->EquiposCdeMAX = atoi(valor); } else if ( strcmp(campo,"TiempoCdeMIN") == 0 ) { Config->TiempoCdeMIN = atoi(valor); } else if ( strcmp(campo,"TiempoCdeMAX") == 0 ) { Config->TiempoCdeMAX = atoi(valor); } else if ( strcmp(campo,"RouterLocalIP") == 0 ) { inet_aton( valor, &strAddr ); Config->RouterLocalIP = htonl( strAddr.s_addr ); sprintf( Config->CiudadLocalIP, "%s", valor ); /* Se guarda la IP sin convertir */ } else if ( strcmp(campo,"RouterLocalPort") == 0 ) { Config->RouterLocalPort = atoi(valor); } else if ( strcmp(campo,"RouterRemoteIP") == 0 ) { inet_aton( valor, &strAddr ); Config->RouterRemoteIP = htonl( strAddr.s_addr ); } else if ( strcmp(campo,"RouterRemotePort") == 0 ) { Config->RouterRemotePort = atoi(valor); } else if ( strcmp(campo,"DiscoverTimeout") == 0 ) { Config->DiscoverTimeout = atoi(valor); } else if ( strcmp(campo,"MigracionTimeout") == 0 ) { Config->MigracionTimeout = atoi(valor); } else if ( strcmp(campo,"TTL") == 0 ) { Config->TTL = (char) atoi(valor); } else { printf( "WARNING: Campo no reconocido en archivo de configuracion: %s\n", campo ); return FAIL; } return OK; }
/* Ultima modificacion: 07/05 - 07:10 Modificado por: Diego */ int LineaValida ( char * ); int CargaConfigDatos( char *, char *, CFG * ); int CargaConfig ( CFG *Config ) { char ConfigFile[20] = CFG_FileName; char *ptr; char linea[200 + 2]; char campo[30 + 2]; int VAR_0 = 0; FILE *Arch; /* Cantidad de parametros que debe contener el archivo CFG */ Config->VAR_0 = CFG_CantParams; if ( (Arch = fopen(ConfigFile,"rt")) == NULL ) { printf( "ERROR: No se puede abrir el archivo de configuracion %s\n", ConfigFile ); return FAIL; } ptr = malloc ( 200 + 2 ); while ( fgets(linea,200+2,Arch) != NULL ) { if( LineaValida(linea) ) { ptr = FUNC_0( linea, "=" ); if ( ptr == NULL ) { printf( "ERROR: El archivo de configuracion no tiene un formato valido\n" ); fclose( Arch ); return FAIL; } strcpy( campo, ptr ); ptr = FUNC_0( NULL, ";" ); if ( ptr == NULL ) { printf( "ERROR: El archivo de configuracion no tiene un formato valido\n" ); fclose( Arch ); return FAIL; } if ( CargaConfigDatos( campo, ptr, Config) == OK ) { VAR_0++; } } } if ( VAR_0 == Config->VAR_0 ) { /* Se cargaron todos los campos de la estructura */ return OK; } /* No se cargaron todos los campos */ printf( "ERROR: Falta(n) %d parametro(s) de configuracion en el archivo\n", Config->VAR_0-VAR_0 ); return FAIL; } int LineaValida ( char *linea ) { char CommentChar = '#'; char line[200+2]; /*char *ptr;*/ /* Se planteo asi para futuras implementaciones de mejorias, por ahora no es necesario */ strcpy( line, linea ); /* Guarda una copia de la cadena original */ if ( line[0] == CommentChar ) { return FALSE; } if ( ! isalpha(line[0]) ) { return FALSE; } return TRUE; } int CargaConfigDatos( char *campo, char *valor, CFG *Config ) { struct in_addr strAddr; if ( strcmp(campo,"CantMaxEquipos") == 0 ) { Config->CantMaxEquipos = atoi(valor); } else if ( strcmp(campo,"DuracionPartidosMIN") == 0 ) { Config->DuracionPartidosMIN = atoi(valor); } else if ( strcmp(campo,"DuracionPartidosMAX") == 0 ) { Config->DuracionPartidosMAX = atoi(valor); } else if ( strcmp(campo,"TiempoInactividad") == 0 ) { Config->TiempoInactividad = atoi(valor); } else if ( strcmp(campo,"CansancioMAX") == 0 ) { Config->CansancioMAX = atoi(valor); } else if ( strcmp(campo,"EquiposCdeMAX") == 0 ) { Config->VAR_1 = atoi(valor); } else if ( strcmp(campo,"TiempoCdeMIN") == 0 ) { Config->TiempoCdeMIN = atoi(valor); } else if ( strcmp(campo,"TiempoCdeMAX") == 0 ) { Config->TiempoCdeMAX = atoi(valor); } else if ( strcmp(campo,"RouterLocalIP") == 0 ) { FUNC_1( valor, &strAddr ); Config->RouterLocalIP = htonl( strAddr.s_addr ); sprintf( Config->CiudadLocalIP, "%s", valor ); /* Se guarda la IP sin convertir */ } else if ( strcmp(campo,"RouterLocalPort") == 0 ) { Config->RouterLocalPort = atoi(valor); } else if ( strcmp(campo,"RouterRemoteIP") == 0 ) { FUNC_1( valor, &strAddr ); Config->RouterRemoteIP = htonl( strAddr.s_addr ); } else if ( strcmp(campo,"RouterRemotePort") == 0 ) { Config->RouterRemotePort = atoi(valor); } else if ( strcmp(campo,"DiscoverTimeout") == 0 ) { Config->DiscoverTimeout = atoi(valor); } else if ( strcmp(campo,"MigracionTimeout") == 0 ) { Config->MigracionTimeout = atoi(valor); } else if ( strcmp(campo,"TTL") == 0 ) { Config->TTL = (char) atoi(valor); } else { printf( "WARNING: Campo no reconocido en archivo de configuracion: %s\n", campo ); return FAIL; } return OK; }
0.100234
{'VAR_0': 'CantParams', 'FUNC_0': 'strtok', 'VAR_1': 'EquiposCdeMAX', 'FUNC_1': 'inet_aton'}
#include "mempool.h" #include "crypto.h" #include "utxo_to_tx.h" void mempool_init() { mempool = NULL; utxo_to_tx_init(); } Transaction *mempool_add(Transaction *tx) { MemPool *new_entry, *found_entry; new_entry = malloc(sizeof(MemPool)); hash_tx(new_entry->id, tx); new_entry->tx = tx; found_entry = mempool_find_node(new_entry->id); if (found_entry == NULL) { HASH_ADD(hh, mempool, id, TX_HASH_LEN, new_entry); utxo_to_tx_add_tx(tx); return tx; } free(new_entry); return NULL; } Transaction *mempool_remove(unsigned char *tx_hash) { MemPool *entry; Transaction *tx; entry = mempool_find_node(tx_hash); if (entry == NULL) return NULL; tx = entry->tx; HASH_DEL(mempool, entry); free(entry); // Remove every mapping that referenced removed tx for (unsigned int k = 0; k < tx->num_inputs; k++) utxo_to_tx_remove( tx->inputs[k].prev_tx_id, tx->inputs[k].prev_utxo_output ); return tx; } Transaction *mempool_find(unsigned char *tx_hash) { MemPool *found_entry; found_entry = mempool_find_node(tx_hash); if (found_entry != NULL) { return found_entry->tx; } return NULL; } MemPool *mempool_find_node(unsigned char *tx_hash) { MemPool *found_entry; HASH_FIND(hh, mempool, tx_hash, TX_HASH_LEN, found_entry); return found_entry; } void print_mempool(MemPool *mempool, char *prefix){ dump_buf(prefix, "hashmap_id: ", mempool->id, TX_HASH_LEN); print_tx(mempool->tx, prefix); } void print_mempool_hashmap(char *prefix){ char *sub_prefix = malloc(strlen(prefix)+strlen(PRINT_TAB)+1); strcpy(sub_prefix, prefix); strcat(sub_prefix, PRINT_TAB); MemPool *s; printf("%sMempool Hashmap items(%i):\n", prefix, HASH_COUNT(mempool)); for (s = mempool; s != NULL; s = s->hh.next) { print_mempool(s, sub_prefix); } free(sub_prefix); }
#include "IMPORT_0" #include "IMPORT_1" #include "IMPORT_2" void FUNC_0() { VAR_0 = NULL; utxo_to_tx_init(); } Transaction *FUNC_1(Transaction *VAR_1) { CLASS_0 *VAR_3, *found_entry; VAR_3 = FUNC_2(sizeof(VAR_2)); FUNC_3(VAR_3->VAR_4, VAR_1); VAR_3->VAR_1 = VAR_1; found_entry = mempool_find_node(VAR_3->VAR_4); if (found_entry == NULL) { FUNC_4(VAR_5, VAR_0, VAR_4, TX_HASH_LEN, VAR_3); utxo_to_tx_add_tx(VAR_1); return VAR_1; } FUNC_5(VAR_3); return NULL; } Transaction *FUNC_6(unsigned char *tx_hash) { CLASS_0 *VAR_6; Transaction *VAR_1; VAR_6 = mempool_find_node(tx_hash); if (VAR_6 == NULL) return NULL; VAR_1 = VAR_6->VAR_1; FUNC_7(VAR_0, VAR_6); FUNC_5(VAR_6); // Remove every mapping that referenced removed tx for (unsigned int k = 0; k < VAR_1->VAR_7; k++) utxo_to_tx_remove( VAR_1->VAR_8[k].VAR_9, VAR_1->VAR_8[k].prev_utxo_output ); return VAR_1; } Transaction *mempool_find(unsigned char *tx_hash) { CLASS_0 *found_entry; found_entry = mempool_find_node(tx_hash); if (found_entry != NULL) { return found_entry->VAR_1; } return NULL; } CLASS_0 *mempool_find_node(unsigned char *tx_hash) { CLASS_0 *found_entry; FUNC_8(VAR_5, VAR_0, tx_hash, TX_HASH_LEN, found_entry); return found_entry; } void print_mempool(CLASS_0 *VAR_0, char *VAR_10){ FUNC_9(VAR_10, "hashmap_id: ", VAR_0->VAR_4, TX_HASH_LEN); FUNC_10(VAR_0->VAR_1, VAR_10); } void FUNC_11(char *VAR_10){ char *VAR_11 = FUNC_2(FUNC_12(VAR_10)+FUNC_12(PRINT_TAB)+1); strcpy(VAR_11, VAR_10); strcat(VAR_11, PRINT_TAB); CLASS_0 *s; printf("%sMempool Hashmap items(%i):\n", VAR_10, HASH_COUNT(VAR_0)); for (s = VAR_0; s != NULL; s = s->VAR_5.next) { print_mempool(s, VAR_11); } FUNC_5(VAR_11); }
0.570939
{'IMPORT_0': 'mempool.h', 'IMPORT_1': 'crypto.h', 'IMPORT_2': 'utxo_to_tx.h', 'FUNC_0': 'mempool_init', 'VAR_0': 'mempool', 'FUNC_1': 'mempool_add', 'VAR_1': 'tx', 'CLASS_0': 'MemPool', 'VAR_2': 'MemPool', 'VAR_3': 'new_entry', 'FUNC_2': 'malloc', 'FUNC_3': 'hash_tx', 'VAR_4': 'id', 'FUNC_4': 'HASH_ADD', 'VAR_5': 'hh', 'FUNC_5': 'free', 'FUNC_6': 'mempool_remove', 'VAR_6': 'entry', 'FUNC_7': 'HASH_DEL', 'VAR_7': 'num_inputs', 'VAR_8': 'inputs', 'VAR_9': 'prev_tx_id', 'FUNC_8': 'HASH_FIND', 'VAR_10': 'prefix', 'FUNC_9': 'dump_buf', 'FUNC_10': 'print_tx', 'FUNC_11': 'print_mempool_hashmap', 'VAR_11': 'sub_prefix', 'FUNC_12': 'strlen'}
//===========================================================================// // Copyright (C) Microsoft Corporation. All rights reserved. // //===========================================================================// #pragma once #ifndef MLR_MLRLINECLOUD_HPP #define MLR_MLRLINECLOUD_HPP #include "mlr/mlreffect.h" namespace MidLevelRenderer { //########################################################################## //####################### MLRLineCloud ############################## //########################################################################## class MLRLineCloud : public MLREffect { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Initialization // public: static void __stdcall InitializeClass(void); static void __stdcall TerminateClass(void); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Constructors/Destructors // public: MLRLineCloud(uint32_t, uint32_t = 0); ~MLRLineCloud(void); void SetData( const size_t* count, const Stuff::Point3D* point_data, const Stuff::RGBAcolour* color_data); virtual uint32_t GetType(uint32_t) { return type; } void Draw(DrawEffectInformation*, GOSVertexPool*, MLRSorter*); void Transform(size_t, size_t); uint32_t Clip(MLRClippingState, GOSVertexPool*); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class Data Support // public: static ClassData* DefaultData; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Testing // public: void TestInstance(void) const; protected: uint32_t type; const size_t* usedNrOfVertices; }; } // namespace MidLevelRenderer #endif
//===========================================================================// // Copyright (C) Microsoft Corporation. All rights reserved. // //===========================================================================// #pragma once #ifndef MLR_MLRLINECLOUD_HPP #define MLR_MLRLINECLOUD_HPP #include "mlr/mlreffect.h" namespace MidLevelRenderer { //########################################################################## //####################### MLRLineCloud ############################## //########################################################################## class MLRLineCloud : public MLREffect { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Initialization // public: static void __stdcall InitializeClass(void); static void __stdcall TerminateClass(void); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Constructors/Destructors // public: MLRLineCloud(uint32_t, uint32_t = 0); ~MLRLineCloud(VAR_0); void FUNC_0( const size_t* count, const Stuff::Point3D* point_data, const Stuff::RGBAcolour* color_data); virtual uint32_t GetType(uint32_t) { return type; } void Draw(DrawEffectInformation*, GOSVertexPool*, MLRSorter*); void Transform(size_t, size_t); uint32_t Clip(CLASS_0, GOSVertexPool*); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class Data Support // public: static ClassData* DefaultData; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Testing // public: VAR_0 TestInstance(void) constVAR_1; protected: uint32_t type; const size_t* usedNrOfVertices; }; } // namespace MidLevelRenderer #endif
0.090437
{'VAR_0': 'void', 'FUNC_0': 'SetData', 'CLASS_0': 'MLRClippingState', 'VAR_1': ''}
#ifndef __DX12DESCRIPTORHEAP_H__ #define __DX12DESCRIPTORHEAP_H__ #ifdef _USE_DIRECTX12 #include "DX12Device.h" #include "DX12CommandList.h" #include "log.h" class DX12DescriptorHeap { public: DX12DescriptorHeap(); virtual ~DX12DescriptorHeap() {} bool Create(DX12Device* device, DESCRIPTOR_HEAP_TYPE type, uint32 numDescriptors, bool shaderVisiblity = true); void Destroy(); void Apply(revGraphicsCommandList& commandList, uint32 rootIndex, uint32 offset = 0); D3D12_CPU_DESCRIPTOR_HANDLE GetCPUHandle(uint32 index = 0) { if (allocNum < index) NATIVE_LOGE("failed to get handle from descriptor heap. File[%s], line[%d]", __FILE__, __LINE__); return GetHandle(cpuHandle, index); } D3D12_GPU_DESCRIPTOR_HANDLE GetGPUHandle(uint32 index = 0) { if (allocNum < index) NATIVE_LOGE("failed to get handle from descriptor heap. File[%s], line[%d]", __FILE__, __LINE__); return GetHandle(gpuHandle, index); } class Chunk { friend class DX12DescriptorHeap; public: Chunk(){} D3D12_CPU_DESCRIPTOR_HANDLE GetHandle(uint32 index = 0) { D3D12_CPU_DESCRIPTOR_HANDLE newHandle = base; if (index >= maxAllocationNum) { NATIVE_LOGE("Descriptor Heap Over run! file:%s, line:%s", __FILE__, __LINE__); newHandle.ptr = 0; return newHandle; } newHandle.ptr += (index+startIndex) * incrementalSize; return newHandle; } uint32 GetIndexStartAllocation() const { return startIndex; } uint32 GetDescriptorOffset(uint32 indexOfAllocation) const { return startIndex + indexOfAllocation; } private: Chunk(D3D12_CPU_DESCRIPTOR_HANDLE handle, uint32 allocationNum, uint32 startIndex, uint32 incrementalSize) { base = handle; maxAllocationNum = allocationNum; this->startIndex = startIndex; this->incrementalSize = incrementalSize; } private: D3D12_CPU_DESCRIPTOR_HANDLE base; uint32 maxAllocationNum; uint32 incrementalSize; uint32 startIndex; }; Chunk Allocation(uint32 allocationNum) { // TODO: allocNUm + allocationNum < maxDescriptors Check Chunk chunk(cpuHandle, allocationNum, allocNum, incrementalSize); allocNum += allocationNum; return chunk; } private: template<typename T> T GetHandle(T handle, uint32 index) { T newHandle = handle; newHandle.ptr += index * incrementalSize; return newHandle; } DX12Device* device; DESCRIPTOR_HEAP_TYPE type; uint32 maxDescriptors; uint32 incrementalSize; uint32 allocNum; D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle; D3D12_GPU_DESCRIPTOR_HANDLE gpuHandle; revDescriptorHeap* heap; }; #endif #endif
#ifndef __DX12DESCRIPTORHEAP_H__ #define __DX12DESCRIPTORHEAP_H__ #ifdef _USE_DIRECTX12 #include "DX12Device.h" #include "DX12CommandList.h" #include "log.h" class VAR_0 { public: FUNC_0(); virtual ~FUNC_0() {} bool Create(DX12Device* device, DESCRIPTOR_HEAP_TYPE type, uint32 numDescriptors, bool shaderVisiblity = true); void Destroy(); void FUNC_1(revGraphicsCommandList& VAR_1, uint32 rootIndex, uint32 offset = 0); D3D12_CPU_DESCRIPTOR_HANDLE GetCPUHandle(uint32 VAR_2 = 0) { if (allocNum < VAR_2) NATIVE_LOGE("failed to get handle from descriptor heap. File[%s], line[%d]", __FILE__, __LINE__); return GetHandle(cpuHandle, VAR_2); } D3D12_GPU_DESCRIPTOR_HANDLE FUNC_2(uint32 VAR_2 = 0) { if (allocNum < VAR_2) NATIVE_LOGE("failed to get handle from descriptor heap. File[%s], line[%d]", __FILE__, __LINE__); return GetHandle(gpuHandle, VAR_2); } class Chunk { friend class VAR_0; public: Chunk(){} D3D12_CPU_DESCRIPTOR_HANDLE GetHandle(uint32 VAR_2 = 0) { D3D12_CPU_DESCRIPTOR_HANDLE newHandle = base; if (VAR_2 >= maxAllocationNum) { NATIVE_LOGE("Descriptor Heap Over run! file:%s, line:%s", __FILE__, __LINE__); newHandle.ptr = 0; return newHandle; } newHandle.ptr += (VAR_2+startIndex) * incrementalSize; return newHandle; } uint32 FUNC_3() const { return startIndex; } uint32 GetDescriptorOffset(uint32 indexOfAllocation) const { return startIndex + indexOfAllocation; } private: Chunk(D3D12_CPU_DESCRIPTOR_HANDLE handle, uint32 allocationNum, uint32 startIndex, uint32 incrementalSize) { base = handle; maxAllocationNum = allocationNum; this->startIndex = startIndex; this->incrementalSize = incrementalSize; } private: D3D12_CPU_DESCRIPTOR_HANDLE base; uint32 maxAllocationNum; uint32 incrementalSize; uint32 startIndex; }; Chunk Allocation(uint32 allocationNum) { // TODO: allocNUm + allocationNum < maxDescriptors Check Chunk chunk(cpuHandle, allocationNum, allocNum, incrementalSize); allocNum += allocationNum; return chunk; } private: template<typename T> T GetHandle(T handle, uint32 VAR_2) { T newHandle = handle; newHandle.ptr += VAR_2 * incrementalSize; return newHandle; } DX12Device* device; DESCRIPTOR_HEAP_TYPE type; uint32 maxDescriptors; uint32 incrementalSize; uint32 allocNum; D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle; D3D12_GPU_DESCRIPTOR_HANDLE gpuHandle; CLASS_0* heap; }; #endif #endif
0.205324
{'VAR_0': 'DX12DescriptorHeap', 'FUNC_0': 'DX12DescriptorHeap', 'FUNC_1': 'Apply', 'VAR_1': 'commandList', 'VAR_2': 'index', 'FUNC_2': 'GetGPUHandle', 'FUNC_3': 'GetIndexStartAllocation', 'CLASS_0': 'revDescriptorHeap'}
/**************************************************************************** * examples/lvgdemo/lvgldemo.c * * Copyright (C) 2019 <NAME>. All rights reserved. * Author: <NAME> <<EMAIL>> * * 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. * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER 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. * ****************************************************************************/ /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> #include <sys/boardctl.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <pthread.h> #include <time.h> #include <graphics/lvgl.h> #include "fbdev.h" #include "tp.h" #include "tp_cal.h" #include "demo.h" #include "lv_test_theme_1.h" #include "lv_test_theme_2.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ /* Should we perform board-specific driver initialization? There are two * ways that board initialization can occur: 1) automatically via * board_late_initialize() during bootupif CONFIG_BOARD_LATE_INITIALIZE * or 2). * via a call to boardctl() if the interface is enabled * (CONFIG_LIB_BOARDCTL=y). * If this task is running as an NSH built-in application, then that * initialization has probably already been performed otherwise we do it * here. */ #undef NEED_BOARDINIT #if defined(CONFIG_LIB_BOARDCTL) && !defined(CONFIG_NSH_ARCHINIT) # define NEED_BOARDINIT 1 #endif /**************************************************************************** * Private Functions ****************************************************************************/ /**************************************************************************** * Name: tick_func * * Description: * Calls lv_tick_inc(...) every 5ms. * * Input Parameters: * data * * Returned Value: * NULL * ****************************************************************************/ static FAR void *tick_func(void *data) { static long last_ms; long ms; struct timespec spec; while (1) { long diff; /* Calculate how much time elapsed */ clock_gettime(CLOCK_REALTIME, &spec); ms = (long)spec.tv_nsec / 1000000; diff = ms - last_ms; /* Handle overflow */ if (diff < 0) { diff = 1000 + diff; } lv_tick_inc(diff); usleep(5000); last_ms = ms; } /* Never will reach here */ return NULL; } /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** * Name: main or lvgldemo_main * * Description: * * Input Parameters: * Standard argc and argv * * Returned Value: * Zero on success; a positive, non-zero value on failure. * ****************************************************************************/ int main(int argc, FAR char *argv[]) { lv_disp_drv_t disp_drv; pthread_t tick_thread; lv_disp_buf_t disp_buf; static lv_color_t buf[CONFIG_LV_VDB_SIZE]; #ifndef CONFIG_EXAMPLES_LVGLDEMO_CALIBRATE lv_point_t p[4]; /* top left */ p[0].x = 0; p[0].y = 0; /* top right */ p[1].x = LV_HOR_RES; p[1].y = 0; /* bottom left */ p[2].x = 0; p[2].y = LV_VER_RES; /* bottom right */ p[3].x = LV_HOR_RES; p[3].y = LV_VER_RES; #endif #ifdef NEED_BOARDINIT /* Perform board-specific driver initialization */ boardctl(BOARDIOC_INIT, 0); #ifdef CONFIG_BOARDCTL_FINALINIT /* Perform architecture-specific final-initialization (if configured) */ boardctl(BOARDIOC_FINALINIT, 0); #endif #endif /* LittlevGL initialization */ lv_init(); /* Display interface initialization */ fbdev_init(); /* Basic LittlevGL display driver initialization */ lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10); lv_disp_drv_init(&disp_drv); disp_drv.flush_cb = fbdev_flush; disp_drv.buffer = &disp_buf; lv_disp_drv_register(&disp_drv); /* Tick interface initialization */ pthread_create(&tick_thread, NULL, tick_func, NULL); /* Touchpad Initialization */ tp_init(); lv_indev_drv_t indev_drv; lv_indev_drv_init(&indev_drv); indev_drv.type = LV_INDEV_TYPE_POINTER; /* This function will be called periodically (by the library) to get the * mouse position and state. */ indev_drv.read_cb = tp_read; lv_indev_drv_register(&indev_drv); /* Demo initialization */ #if defined(CONFIG_EXAMPLES_LVGLDEMO_SIMPLE) demo_create(); #elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1) lv_theme_t *theme = NULL; #if defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_DEFAULT) theme = lv_theme_default_init(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL); #elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_ALIEN) theme = lv_theme_alien_init(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL); #elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_NIGHT) theme = lv_theme_night_init(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL); #elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_MONO) theme = lv_theme_mono_init(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL); #elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_MATERIAL) theme = lv_theme_material_init(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL); #elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_ZEN) theme = lv_theme_zen_init(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL); #elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_NEMO) theme = lv_theme_nemo_init(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL); #else # error "No theme selected for this application" #endif lv_test_theme_1(theme); #elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_2) lv_test_theme_2(); #else # error "No LVGL demo selected" #endif /* Start TP calibration */ #ifdef CONFIG_EXAMPLES_LVGLDEMO_CALIBRATE tp_cal_create(); #else tp_set_cal_values(p, p + 1, p + 2, p + 3); #endif /* Handle LittlevGL tasks */ while (1) { lv_task_handler(); usleep(10000); } return EXIT_SUCCESS; }
/**************************************************************************** * examples/lvgdemo/lvgldemo.c * * Copyright (C) 2019 <NAME>. All rights reserved. * Author: <NAME> <<EMAIL>> * * 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. * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER 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. * ****************************************************************************/ /**************************************************************************** * Included Files ****************************************************************************/ #include <IMPORT_0> #include <IMPORT_1> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <pthread.h> #include <IMPORT_2> #include <IMPORT_3> #include "IMPORT_4" #include "tp.h" #include "IMPORT_5" #include "IMPORT_6" #include "IMPORT_7" #include "IMPORT_8" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ /* Should we perform board-specific driver initialization? There are two * ways that board initialization can occur: 1) automatically via * board_late_initialize() during bootupif CONFIG_BOARD_LATE_INITIALIZE * or 2). * via a call to boardctl() if the interface is enabled * (CONFIG_LIB_BOARDCTL=y). * If this task is running as an NSH built-in application, then that * initialization has probably already been performed otherwise we do it * here. */ #undef NEED_BOARDINIT #if defined(VAR_0) && !defined(VAR_1) # define VAR_2 1 #endif /**************************************************************************** * Private Functions ****************************************************************************/ /**************************************************************************** * Name: tick_func * * Description: * Calls lv_tick_inc(...) every 5ms. * * Input Parameters: * data * * Returned Value: * NULL * ****************************************************************************/ static CLASS_0 VAR_3 *FUNC_0(void *VAR_5) { static long VAR_6; long VAR_7; struct CLASS_1 VAR_8; while (1) { long VAR_9; /* Calculate how much time elapsed */ clock_gettime(VAR_10, &VAR_8); VAR_7 = (long)VAR_8.VAR_11 / 1000000; VAR_9 = VAR_7 - VAR_6; /* Handle overflow */ if (VAR_9 < 0) { VAR_9 = 1000 + VAR_9; } FUNC_1(VAR_9); FUNC_2(5000); VAR_6 = VAR_7; } /* Never will reach here */ return NULL; } /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** * Name: main or lvgldemo_main * * Description: * * Input Parameters: * Standard argc and argv * * Returned Value: * Zero on success; a positive, non-zero value on failure. * ****************************************************************************/ int FUNC_3(int VAR_12, CLASS_0 VAR_13 *argv[]) { CLASS_2 disp_drv; CLASS_3 tick_thread; CLASS_4 VAR_14; static CLASS_5 buf[VAR_15]; #ifndef VAR_16 CLASS_6 VAR_17[4]; /* top left */ VAR_17[0].x = 0; VAR_17[0].VAR_18 = 0; /* top right */ VAR_17[1].x = VAR_19; VAR_17[1].VAR_18 = 0; /* bottom left */ VAR_17[2].x = 0; VAR_17[2].VAR_18 = LV_VER_RES; /* bottom right */ VAR_17[3].x = VAR_19; VAR_17[3].VAR_18 = LV_VER_RES; #endif #ifdef VAR_2 /* Perform board-specific driver initialization */ FUNC_4(VAR_20, 0); #ifdef VAR_21 /* Perform architecture-specific final-initialization (if configured) */ FUNC_4(VAR_22, 0); #endif #endif /* LittlevGL initialization */ FUNC_5(); /* Display interface initialization */ FUNC_6(); /* Basic LittlevGL display driver initialization */ FUNC_7(&VAR_14, buf, NULL, VAR_23 * 10); FUNC_8(&disp_drv); disp_drv.VAR_24 = fbdev_flush; disp_drv.buffer = &VAR_14; FUNC_9(&disp_drv); /* Tick interface initialization */ FUNC_10(&tick_thread, NULL, VAR_4, NULL); /* Touchpad Initialization */ FUNC_11(); CLASS_7 indev_drv; lv_indev_drv_init(&indev_drv); indev_drv.type = LV_INDEV_TYPE_POINTER; /* This function will be called periodically (by the library) to get the * mouse position and state. */ indev_drv.VAR_25 = VAR_26; FUNC_12(&indev_drv); /* Demo initialization */ #if defined(VAR_27) FUNC_13(); #elif defined(VAR_28) CLASS_8 *VAR_29 = NULL; #if defined(VAR_30) VAR_29 = FUNC_14(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL); #elif defined(VAR_31) VAR_29 = FUNC_15(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL); #elif defined(VAR_32) VAR_29 = FUNC_16(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL); #elif defined(VAR_33) VAR_29 = FUNC_17(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL); #elif defined(VAR_34) VAR_29 = FUNC_18(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL); #elif defined(VAR_35) VAR_29 = FUNC_19(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL); #elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_NEMO) VAR_29 = FUNC_20(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL); #else # error "No theme selected for this application" #endif lv_test_theme_1(VAR_29); #elif defined(VAR_36) FUNC_21(); #else # error "No LVGL demo selected" #endif /* Start TP calibration */ #ifdef VAR_16 FUNC_22(); #else FUNC_23(VAR_17, VAR_17 + 1, VAR_17 + 2, VAR_17 + 3); #endif /* Handle LittlevGL tasks */ while (1) { FUNC_24(); FUNC_2(10000); } return VAR_37; }
0.794381
{'IMPORT_0': 'nuttx/config.h', 'IMPORT_1': 'sys/boardctl.h', 'IMPORT_2': 'time.h', 'IMPORT_3': 'graphics/lvgl.h', 'IMPORT_4': 'fbdev.h', 'IMPORT_5': 'tp_cal.h', 'IMPORT_6': 'demo.h', 'IMPORT_7': 'lv_test_theme_1.h', 'IMPORT_8': 'lv_test_theme_2.h', 'VAR_0': 'CONFIG_LIB_BOARDCTL', 'VAR_1': 'CONFIG_NSH_ARCHINIT', 'VAR_2': 'NEED_BOARDINIT', 'CLASS_0': 'FAR', 'VAR_3': 'void', 'FUNC_0': 'tick_func', 'VAR_4': 'tick_func', 'VAR_5': 'data', 'VAR_6': 'last_ms', 'VAR_7': 'ms', 'CLASS_1': 'timespec', 'VAR_8': 'spec', 'VAR_9': 'diff', 'VAR_10': 'CLOCK_REALTIME', 'VAR_11': 'tv_nsec', 'FUNC_1': 'lv_tick_inc', 'FUNC_2': 'usleep', 'FUNC_3': 'main', 'VAR_12': 'argc', 'VAR_13': 'char', 'CLASS_2': 'lv_disp_drv_t', 'CLASS_3': 'pthread_t', 'CLASS_4': 'lv_disp_buf_t', 'VAR_14': 'disp_buf', 'CLASS_5': 'lv_color_t', 'VAR_15': 'CONFIG_LV_VDB_SIZE', 'VAR_16': 'CONFIG_EXAMPLES_LVGLDEMO_CALIBRATE', 'CLASS_6': 'lv_point_t', 'VAR_17': 'p', 'VAR_18': 'y', 'VAR_19': 'LV_HOR_RES', 'FUNC_4': 'boardctl', 'VAR_20': 'BOARDIOC_INIT', 'VAR_21': 'CONFIG_BOARDCTL_FINALINIT', 'VAR_22': 'BOARDIOC_FINALINIT', 'FUNC_5': 'lv_init', 'FUNC_6': 'fbdev_init', 'FUNC_7': 'lv_disp_buf_init', 'VAR_23': 'LV_HOR_RES_MAX', 'FUNC_8': 'lv_disp_drv_init', 'VAR_24': 'flush_cb', 'FUNC_9': 'lv_disp_drv_register', 'FUNC_10': 'pthread_create', 'FUNC_11': 'tp_init', 'CLASS_7': 'lv_indev_drv_t', 'VAR_25': 'read_cb', 'VAR_26': 'tp_read', 'FUNC_12': 'lv_indev_drv_register', 'VAR_27': 'CONFIG_EXAMPLES_LVGLDEMO_SIMPLE', 'FUNC_13': 'demo_create', 'VAR_28': 'CONFIG_EXAMPLES_LVGLDEMO_THEME_1', 'CLASS_8': 'lv_theme_t', 'VAR_29': 'theme', 'VAR_30': 'CONFIG_EXAMPLES_LVGLDEMO_THEME_1_DEFAULT', 'FUNC_14': 'lv_theme_default_init', 'VAR_31': 'CONFIG_EXAMPLES_LVGLDEMO_THEME_1_ALIEN', 'FUNC_15': 'lv_theme_alien_init', 'VAR_32': 'CONFIG_EXAMPLES_LVGLDEMO_THEME_1_NIGHT', 'FUNC_16': 'lv_theme_night_init', 'VAR_33': 'CONFIG_EXAMPLES_LVGLDEMO_THEME_1_MONO', 'FUNC_17': 'lv_theme_mono_init', 'VAR_34': 'CONFIG_EXAMPLES_LVGLDEMO_THEME_1_MATERIAL', 'FUNC_18': 'lv_theme_material_init', 'VAR_35': 'CONFIG_EXAMPLES_LVGLDEMO_THEME_1_ZEN', 'FUNC_19': 'lv_theme_zen_init', 'FUNC_20': 'lv_theme_nemo_init', 'VAR_36': 'CONFIG_EXAMPLES_LVGLDEMO_THEME_2', 'FUNC_21': 'lv_test_theme_2', 'FUNC_22': 'tp_cal_create', 'FUNC_23': 'tp_set_cal_values', 'FUNC_24': 'lv_task_handler', 'VAR_37': 'EXIT_SUCCESS'}
// atoi.c int atoi(string str) { int v; if (!stringp(str) || !sscanf(str, "%d", v)) return 0; return v; }
// atoi.c int FUNC_0(CLASS_0 str) { int VAR_0; if (!FUNC_1(str) || !FUNC_2(str, "%d", VAR_0)) return 0; return VAR_0; }
0.662334
{'FUNC_0': 'atoi', 'CLASS_0': 'string', 'VAR_0': 'v', 'FUNC_1': 'stringp', 'FUNC_2': 'sscanf'}
// // LoginViewController.h // LoginModule // // Created by gaopeng on 2019/5/20. // Copyright © 2019 gaopeng. All rights reserved. // #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface LoginViewController : UIViewController @property (nonatomic, copy) void(^loginResponse)(id result); @end NS_ASSUME_NONNULL_END
// // LoginViewController.h // LoginModule // // Created by gaopeng on 2019/5/20. // Copyright © 2019 gaopeng. All rights reserved. // #import <UIKit/UIKit.h> CLASS_0 @VAR_0 LoginViewController : FUNC_0 @VAR_1 (VAR_2, VAR_3) void(^VAR_4)(CLASS_1 VAR_5); @CLASS_2 VAR_6
0.985062
{'CLASS_0': 'NS_ASSUME_NONNULL_BEGIN', 'VAR_0': 'interface', 'FUNC_0': 'UIViewController', 'VAR_1': 'property', 'VAR_2': 'nonatomic', 'VAR_3': 'copy', 'VAR_4': 'loginResponse', 'CLASS_1': 'id', 'VAR_5': 'result', 'CLASS_2': 'end', 'VAR_6': 'NS_ASSUME_NONNULL_END'}
#include "_aqb.h" #include <clib/exec_protos.h> #include <inline/exec.h> void _ExecNode_CONSTRUCTOR (ExecNode *n, UBYTE ln_Type, BYTE ln_Pri, STRPTR ln_Name) { DPRINTF ("_ExecNode_CONSTRUCTOR: n=0x%08lx, ln_Type=%d, ln_Pri=%d, ln_Name=%s\n", n, ln_Type, ln_Pri, ln_Name ? ln_Name : (STRPTR)"NULL"); n->n.ln_Succ = NULL; n->n.ln_Pred = NULL; n->n.ln_Type = ln_Type; n->n.ln_Pri = ln_Pri; n->n.ln_Name = (char *) ln_Name; } void _ExecList_CONSTRUCTOR (ExecList *l, UBYTE lh_Type) { DPRINTF ("_ExecList_CONSTRUCTOR: l=0x%08lx, lh_Type=%d\n", l, lh_Type); l->l.lh_TailPred = (struct Node *) &l->l; l->l.lh_Head = (struct Node *) &l->l.lh_Tail; l->l.lh_Tail = 0; } void _ExecList_AddTail (ExecList *l, ExecNode *n) { DPRINTF ("_ExecList_AddTail: l=0x%08lx, n=0x%08lx\n", l, n); if (!l || !n) { ERROR (AE_EXEC_LIST); return; } AddTail (&l->l, &n->n); }
#include "_aqb.h" #include <IMPORT_0> #include <IMPORT_1> void FUNC_0 (CLASS_0 *VAR_0, UBYTE VAR_1, CLASS_1 ln_Pri, CLASS_2 VAR_2) { FUNC_1 ("_ExecNode_CONSTRUCTOR: n=0x%08lx, ln_Type=%d, ln_Pri=%d, ln_Name=%s\n", VAR_0, VAR_1, ln_Pri, VAR_2 ? VAR_2 : (ID_0)"NULL"); VAR_0->VAR_0.VAR_3 = NULL; VAR_0->VAR_0.ln_Pred = NULL; VAR_0->VAR_0.VAR_1 = VAR_1; VAR_0->VAR_0.ln_Pri = ln_Pri; VAR_0->VAR_0.VAR_2 = (char *) VAR_2; } void FUNC_2 (CLASS_3 *l, UBYTE VAR_4) { FUNC_1 ("_ExecList_CONSTRUCTOR: l=0x%08lx, lh_Type=%d\n", l, VAR_4); l->l.lh_TailPred = (struct Node *) &l->l; l->l.VAR_5 = (struct Node *) &l->l.lh_Tail; l->l.lh_Tail = 0; } void FUNC_3 (CLASS_3 *l, CLASS_0 *VAR_0) { FUNC_1 ("_ExecList_AddTail: l=0x%08lx, n=0x%08lx\n", l, VAR_0); if (!l || !VAR_0) { ERROR (AE_EXEC_LIST); return; } FUNC_4 (&l->l, &VAR_0->VAR_0); }
0.565345
{'IMPORT_0': 'clib/exec_protos.h', 'IMPORT_1': 'inline/exec.h', 'FUNC_0': '_ExecNode_CONSTRUCTOR', 'CLASS_0': 'ExecNode', 'VAR_0': 'n', 'VAR_1': 'ln_Type', 'CLASS_1': 'BYTE', 'CLASS_2': 'STRPTR', 'ID_0': 'STRPTR', 'VAR_2': 'ln_Name', 'FUNC_1': 'DPRINTF', 'VAR_3': 'ln_Succ', 'FUNC_2': '_ExecList_CONSTRUCTOR', 'CLASS_3': 'ExecList', 'VAR_4': 'lh_Type', 'VAR_5': 'lh_Head', 'FUNC_3': '_ExecList_AddTail', 'FUNC_4': 'AddTail'}
{ { 25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605 }, { -12545711, 934262, -2722910, 3049990, -727428, 9406986, 12720692, 5043384, 19500929, -15469378 }, { -8738181, 4489570, 9688441, -14785194, 10184609, -12363380, 29287919, 11864899, -24514362, -4438546 } }, { { 15636291, -9688557, 24204773, -7912398, 616977, -16685262, 27787600, -14772189, 28944400, -1550024 }, { 16568933, 4717097, -11556148, -1102322, 15682896, -11807043, 16354577, -11775962, 7689662, 11199574 }, { 30464156, -5976125, -11779434, -15670865, 23220365, 15915852, 7512774, 10017326, -17749093, -9920357 } }, { { 10861363, 11473154, 27284546, 1981175, -30064349, 12577861, 32867885, 14515107, -15438304, 10819380 }, { 4708026, 6336745, 20377586, 9066809, -11272109, 6594696, -25653668, 12483688, -12668491, 5581306 }, { 19563160, 16186464, -29386857, 4097519, 10237984, -4348115, 28542350, 13850243, -23678021, -15815942 } }, { { 5153746, 9909285, 1723747, -2777874, 30523605, 5516873, 19480852, 5230134, -23952439, -15175766 }, { -30269007, -3463509, 7665486, 10083793, 28475525, 1649722, 20654025, 16520125, 30598449, 7715701 }, { 28881845, 14381568, 9657904, 3680757, -20181635, 7843316, -31400660, 1370708, 29794553, -1409300 } }, { { -22518993, -6692182, 14201702, -8745502, -23510406, 8844726, 18474211, -1361450, -13062696, 13821877 }, { -6455177, -7839871, 3374702, -4740862, -27098617, -10571707, 31655028, -7212327, 18853322, -14220951 }, { 4566830, -12963868, -28974889, -12240689, -7602672, -2830569, -8514358, -10431137, 2207753, -3209784 } }, { { -25154831, -4185821, 29681144, 7868801, -6854661, -9423865, -12437364, -663000, -31111463, -16132436 }, { 25576264, -2703214, 7349804, -11814844, 16472782, 9300885, 3844789, 15725684, 171356, 6466918 }, { 23103977, 13316479, 9739013, -16149481, 817875, -15038942, 8965339, -14088058, -30714912, 16193877 } }, { { -33521811, 3180713, -2394130, 14003687, -16903474, -16270840, 17238398, 4729455, -18074513, 9256800 }, { -25182317, -4174131, 32336398, 5036987, -21236817, 11360617, 22616405, 9761698, -19827198, 630305 }, { -13720693, 2639453, -24237460, -7406481, 9494427, -5774029, -6554551, -15960994, -2449256, -14291300 } }, { { -3151181, -5046075, 9282714, 6866145, -31907062, -863023, -18940575, 15033784, 25105118, -7894876 }, { -24326370, 15950226, -31801215, -14592823, -11662737, -5090925, 1573892, -2625887, 2198790, -15804619 }, { -3099351, 10324967, -2241613, 7453183, -5446979, -2735503, -13812022, -16236442, -32461234, -12290683 } }
{ { 25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605 }, { -12545711, 934262, -2722910, 3049990, -727428, 9406986, 12720692, 5043384, 19500929, -15469378 }, { -8738181, 4489570, 9688441, -14785194, 10184609, -12363380, 29287919, 11864899, -24514362, -4438546 } }, { { 15636291, -9688557, 24204773, -7912398, 616977, -16685262, 27787600, -14772189, 28944400, -1550024 }, { 16568933, 4717097, -11556148, -1102322, 15682896, -11807043, 16354577, -11775962, 7689662, 11199574 }, { 30464156, -5976125, -11779434, -15670865, 23220365, 15915852, 7512774, 10017326, -17749093, -9920357 } }, { { 10861363, 11473154, 27284546, 1981175, -30064349, 12577861, 32867885, 14515107, -15438304, 10819380 }, { 4708026, 6336745, 20377586, 9066809, -11272109, 6594696, -25653668, 12483688, -12668491, 5581306 }, { 19563160, 16186464, -29386857, 4097519, 10237984, -4348115, 28542350, 13850243, -23678021, -15815942 } }, { { 5153746, 9909285, 1723747, -2777874, 30523605, 5516873, 19480852, 5230134, -23952439, -15175766 }, { -30269007, -3463509, 7665486, 10083793, 28475525, 1649722, 20654025, 16520125, 30598449, 7715701 }, { 28881845, 14381568, 9657904, 3680757, -20181635, 7843316, -31400660, 1370708, 29794553, -1409300 } }, { { -22518993, -6692182, 14201702, -8745502, -23510406, 8844726, 18474211, -1361450, -13062696, 13821877 }, { -6455177, -7839871, 3374702, -4740862, -27098617, -10571707, 31655028, -7212327, 18853322, -14220951 }, { 4566830, -12963868, -28974889, -12240689, -7602672, -2830569, -8514358, -10431137, 2207753, -3209784 } }, { { -25154831, -4185821, 29681144, 7868801, -6854661, -9423865, -12437364, -663000, -31111463, -16132436 }, { 25576264, -2703214, 7349804, -11814844, 16472782, 9300885, 3844789, 15725684, 171356, 6466918 }, { 23103977, 13316479, 9739013, -16149481, 817875, -15038942, 8965339, -14088058, -30714912, 16193877 } }, { { -33521811, 3180713, -2394130, 14003687, -16903474, -16270840, 17238398, 4729455, -18074513, 9256800 }, { -25182317, -4174131, 32336398, 5036987, -21236817, 11360617, 22616405, 9761698, -19827198, 630305 }, { -13720693, 2639453, -24237460, -7406481, 9494427, -5774029, -6554551, -15960994, -2449256, -14291300 } }, { { -3151181, -5046075, 9282714, 6866145, -31907062, -863023, -18940575, 15033784, 25105118, -7894876 }, { -24326370, 15950226, -31801215, -14592823, -11662737, -5090925, 1573892, -2625887, 2198790, -15804619 }, { -3099351, 10324967, -2241613, 7453183, -5446979, -2735503, -13812022, -16236442, -32461234, -12290683 } }
0.265667
{}
#include "stdarg.h" #include "stdio.h" int fprintf(FILE *fp, const char *format, ...) { int ret; va_list arg; va_start(arg, format); ret = vfprintf(fp, format, arg); va_end(arg); return ret; }
#include "IMPORT_0" #include "stdio.h" int FUNC_0(CLASS_0 *VAR_0, const char *VAR_1, ...) { int VAR_2; CLASS_1 arg; va_start(arg, VAR_1); VAR_2 = FUNC_1(VAR_0, VAR_1, arg); va_end(arg); return VAR_2; }
0.915528
{'IMPORT_0': 'stdarg.h', 'FUNC_0': 'fprintf', 'CLASS_0': 'FILE', 'VAR_0': 'fp', 'VAR_1': 'format', 'VAR_2': 'ret', 'CLASS_1': 'va_list', 'FUNC_1': 'vfprintf'}
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "NBIOT-RRC-Definitions" * found in "/home/lixh/enb_folder/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-14.7.0.asn1" * `asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D /home/lixh/enb_folder/cmake_targets/lte_build_oai/build/CMakeFiles/RRC_Rel14` */ #ifndef _LTE_NPUSCH_ConfigCommon_NB_r13_H_ #define _LTE_NPUSCH_ConfigCommon_NB_r13_H_ #include <asn_application.h> /* Including external dependencies */ #include <NativeEnumerated.h> #include "LTE_UL-ReferenceSignalsNPUSCH-NB-r13.h" #include "LTE_ACK-NACK-NumRepetitions-NB-r13.h" #include <asn_SEQUENCE_OF.h> #include <constr_SEQUENCE_OF.h> #include <NativeInteger.h> #include <constr_SEQUENCE.h> #ifdef __cplusplus extern "C" { #endif /* Dependencies */ typedef enum LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13 { LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc0 = 0, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc1 = 1, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc2 = 2, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc3 = 3, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc4 = 4, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc5 = 5, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc6 = 6, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc7 = 7, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc8 = 8, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc9 = 9, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc10 = 10, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc11 = 11, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc12 = 12, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc13 = 13, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc14 = 14, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc15 = 15 } e_LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13; /* LTE_NPUSCH-ConfigCommon-NB-r13 */ typedef struct LTE_NPUSCH_ConfigCommon_NB_r13 { struct LTE_NPUSCH_ConfigCommon_NB_r13__ack_NACK_NumRepetitions_Msg4_r13 { A_SEQUENCE_OF(LTE_ACK_NACK_NumRepetitions_NB_r13_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ack_NACK_NumRepetitions_Msg4_r13; long *srs_SubframeConfig_r13; /* OPTIONAL */ struct LTE_NPUSCH_ConfigCommon_NB_r13__dmrs_Config_r13 { long *threeTone_BaseSequence_r13; /* OPTIONAL */ long threeTone_CyclicShift_r13; long *sixTone_BaseSequence_r13; /* OPTIONAL */ long sixTone_CyclicShift_r13; long *twelveTone_BaseSequence_r13; /* OPTIONAL */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } *dmrs_Config_r13; LTE_UL_ReferenceSignalsNPUSCH_NB_r13_t ul_ReferenceSignalsNPUSCH_r13; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } LTE_NPUSCH_ConfigCommon_NB_r13_t; /* Implementation */ /* extern asn_TYPE_descriptor_t asn_DEF_LTE_srs_SubframeConfig_r13_4; // (Use -fall-defs-global to expose) */ extern asn_TYPE_descriptor_t asn_DEF_LTE_NPUSCH_ConfigCommon_NB_r13; extern asn_SEQUENCE_specifics_t asn_SPC_LTE_NPUSCH_ConfigCommon_NB_r13_specs_1; extern asn_TYPE_member_t asn_MBR_LTE_NPUSCH_ConfigCommon_NB_r13_1[4]; #ifdef __cplusplus } #endif #endif /* _LTE_NPUSCH_ConfigCommon_NB_r13_H_ */ #include <asn_internal.h>
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "NBIOT-RRC-Definitions" * found in "/home/lixh/enb_folder/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-14.7.0.asn1" * `asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D /home/lixh/enb_folder/cmake_targets/lte_build_oai/build/CMakeFiles/RRC_Rel14` */ #ifndef VAR_0 #define VAR_0 #include <IMPORT_0> /* Including external dependencies */ #include <IMPORT_1> #include "IMPORT_2" #include "IMPORT_3" #include <IMPORT_4> #include <IMPORT_5> #include <IMPORT_6> #include <IMPORT_7> #ifdef VAR_1 extern "C" { #endif /* Dependencies */ typedef enum CLASS_0 { VAR_2 = 0, VAR_3 = 1, VAR_4 = 2, VAR_5 = 3, VAR_6 = 4, VAR_7 = 5, VAR_8 = 6, VAR_9 = 7, VAR_10 = 8, VAR_11 = 9, VAR_12 = 10, VAR_13 = 11, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc12 = 12, LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc13 = 13, VAR_14 = 14, VAR_15 = 15 } ID_0; /* LTE_NPUSCH-ConfigCommon-NB-r13 */ typedef struct CLASS_1 { struct CLASS_2 { VAR_16(LTE_ACK_NACK_NumRepetitions_NB_r13_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t VAR_17; } ack_NACK_NumRepetitions_Msg4_r13; long *VAR_18; /* OPTIONAL */ struct CLASS_3 { long *VAR_19; /* OPTIONAL */ long VAR_20; long *VAR_21; /* OPTIONAL */ long sixTone_CyclicShift_r13; long *VAR_22; /* OPTIONAL */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t VAR_17; } *dmrs_Config_r13; CLASS_4 ul_ReferenceSignalsNPUSCH_r13; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t VAR_17; } ID_1; /* Implementation */ /* extern asn_TYPE_descriptor_t asn_DEF_LTE_srs_SubframeConfig_r13_4; // (Use -fall-defs-global to expose) */ extern CLASS_5 VAR_23; extern CLASS_6 asn_SPC_LTE_NPUSCH_ConfigCommon_NB_r13_specs_1; extern CLASS_7 asn_MBR_LTE_NPUSCH_ConfigCommon_NB_r13_1[4]; #ifdef VAR_1 } #endif #endif /* _LTE_NPUSCH_ConfigCommon_NB_r13_H_ */ #include <IMPORT_8>
0.809418
{'VAR_0': '_LTE_NPUSCH_ConfigCommon_NB_r13_H_', 'IMPORT_0': 'asn_application.h', 'IMPORT_1': 'NativeEnumerated.h', 'IMPORT_2': 'LTE_UL-ReferenceSignalsNPUSCH-NB-r13.h', 'IMPORT_3': 'LTE_ACK-NACK-NumRepetitions-NB-r13.h', 'IMPORT_4': 'asn_SEQUENCE_OF.h', 'IMPORT_5': 'constr_SEQUENCE_OF.h', 'IMPORT_6': 'NativeInteger.h', 'IMPORT_7': 'constr_SEQUENCE.h', 'VAR_1': '__cplusplus', 'CLASS_0': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13', 'VAR_2': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc0', 'VAR_3': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc1', 'VAR_4': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc2', 'VAR_5': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc3', 'VAR_6': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc4', 'VAR_7': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc5', 'VAR_8': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc6', 'VAR_9': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc7', 'VAR_10': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc8', 'VAR_11': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc9', 'VAR_12': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc10', 'VAR_13': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc11', 'VAR_14': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc14', 'VAR_15': 'LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13_sc15', 'ID_0': 'e_LTE_NPUSCH_ConfigCommon_NB_r13__srs_SubframeConfig_r13', 'CLASS_1': 'LTE_NPUSCH_ConfigCommon_NB_r13', 'CLASS_2': 'LTE_NPUSCH_ConfigCommon_NB_r13__ack_NACK_NumRepetitions_Msg4_r13', 'VAR_16': 'A_SEQUENCE_OF', 'VAR_17': '_asn_ctx', 'VAR_18': 'srs_SubframeConfig_r13', 'CLASS_3': 'LTE_NPUSCH_ConfigCommon_NB_r13__dmrs_Config_r13', 'VAR_19': 'threeTone_BaseSequence_r13', 'VAR_20': 'threeTone_CyclicShift_r13', 'VAR_21': 'sixTone_BaseSequence_r13', 'VAR_22': 'twelveTone_BaseSequence_r13', 'CLASS_4': 'LTE_UL_ReferenceSignalsNPUSCH_NB_r13_t', 'ID_1': 'LTE_NPUSCH_ConfigCommon_NB_r13_t', 'CLASS_5': 'asn_TYPE_descriptor_t', 'VAR_23': 'asn_DEF_LTE_NPUSCH_ConfigCommon_NB_r13', 'CLASS_6': 'asn_SEQUENCE_specifics_t', 'CLASS_7': 'asn_TYPE_member_t', 'IMPORT_8': 'asn_internal.h'}
/** * pm_genpd_name_poweron - Restore power to a given PM domain and its masters. * @domain_name: Name of the PM domain to power up. */ int pm_genpd_name_poweron(const char *domain_name) { struct generic_pm_domain *genpd; genpd = pm_genpd_lookup_name(domain_name); return genpd ? pm_genpd_poweron(genpd) : -EINVAL; }
/** * pm_genpd_name_poweron - Restore power to a given PM domain and its masters. * @domain_name: Name of the PM domain to power up. */ int pm_genpd_name_poweron(const char *VAR_0) { struct CLASS_0 *VAR_1; VAR_1 = FUNC_0(VAR_0); return VAR_1 ? FUNC_1(VAR_1) : -EINVAL; }
0.638072
{'VAR_0': 'domain_name', 'CLASS_0': 'generic_pm_domain', 'VAR_1': 'genpd', 'FUNC_0': 'pm_genpd_lookup_name', 'FUNC_1': 'pm_genpd_poweron'}
/** * Copyright (C) 2017 Alibaba Group Holding Limited. All Rights Reserved. * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __media_native_buffer_h__ #define __media_native_buffer_h__ struct wl_buffer; struct omap_bo; struct MMWlDrmBuffer { uint32_t fourcc, width, height; struct omap_bo *bo[4]; int32_t pitches[4]; int32_t offsets[4]; bool multiBo; /* True when Y and U/V are in separate buffers/drm-bo. */ int fd[4]; /* dmabuf */ int size; /* bo size used by EGL_RAW_VIDEO_TI_DMABUF */ bool usedByCodec; /* true: since send to codec, until queueBuffer; freeBufID[] is tracked by v4l2device */ bool usedByDisplay; /* true: since send to weston, until wl_buffer call_back */ uint32_t drmName; wl_buffer *wl_buf; int32_t cropX; int32_t cropY; int32_t cropW; int32_t cropH; }; struct MMVpuBuffer { uint32_t fourcc; uint32_t width; uint32_t height; int32_t cropX; int32_t cropY; int32_t cropW; int32_t cropH; int32_t reserved[4]; }; #endif
/** * Copyright (C) 2017 Alibaba Group Holding Limited. All Rights Reserved. * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef VAR_0 #define VAR_0 struct wl_buffer; struct omap_bo; struct MMWlDrmBuffer { uint32_t VAR_1, width, height; struct omap_bo *VAR_2[4]; int32_t pitches[4]; int32_t VAR_3[4]; bool multiBo; /* True when Y and U/V are in separate buffers/drm-bo. */ int fd[4]; /* dmabuf */ int VAR_4; /* bo size used by EGL_RAW_VIDEO_TI_DMABUF */ bool usedByCodec; /* true: since send to codec, until queueBuffer; freeBufID[] is tracked by v4l2device */ bool VAR_5; /* true: since send to weston, until wl_buffer call_back */ uint32_t drmName; wl_buffer *wl_buf; int32_t cropX; int32_t cropY; int32_t VAR_6; int32_t cropH; }; struct MMVpuBuffer { uint32_t VAR_1; uint32_t width; uint32_t height; int32_t cropX; int32_t cropY; int32_t VAR_6; int32_t cropH; int32_t reserved[4]; }; #endif
0.426576
{'VAR_0': '__media_native_buffer_h__', 'VAR_1': 'fourcc', 'VAR_2': 'bo', 'VAR_3': 'offsets', 'VAR_4': 'size', 'VAR_5': 'usedByDisplay', 'VAR_6': 'cropW'}
#pragma once #ifdef DEBUGMENU typedef void (*TriggerFunc)(void); struct Menu; struct MenuEntry { int type; const char *name; MenuEntry *next; RwRect r; Menu *menu; MenuEntry(const char *name); virtual ~MenuEntry(void) { free((void*)name); } }; typedef MenuEntry DebugMenuEntry; MenuEntry *DebugMenuAddInt8(const char *path, const char *name, int8 *ptr, TriggerFunc triggerFunc, int8 step, int8 lowerBound, int8 upperBound, const char **strings); MenuEntry *DebugMenuAddInt16(const char *path, const char *name, int16 *ptr, TriggerFunc triggerFunc, int16 step, int16 lowerBound, int16 upperBound, const char **strings); MenuEntry *DebugMenuAddInt32(const char *path, const char *name, int32 *ptr, TriggerFunc triggerFunc, int32 step, int32 lowerBound, int32 upperBound, const char **strings); MenuEntry *DebugMenuAddInt64(const char *path, const char *name, int64 *ptr, TriggerFunc triggerFunc, int64 step, int64 lowerBound, int64 upperBound, const char **strings); MenuEntry *DebugMenuAddUInt8(const char *path, const char *name, uint8 *ptr, TriggerFunc triggerFunc, uint8 step, uint8 lowerBound, uint8 upperBound, const char **strings); MenuEntry *DebugMenuAddUInt16(const char *path, const char *name, uint16 *ptr, TriggerFunc triggerFunc, uint16 step, uint16 lowerBound, uint16 upperBound, const char **strings); MenuEntry *DebugMenuAddUInt32(const char *path, const char *name, uint32 *ptr, TriggerFunc triggerFunc, uint32 step, uint32 lowerBound, uint32 upperBound, const char **strings); MenuEntry *DebugMenuAddUInt64(const char *path, const char *name, uint64 *ptr, TriggerFunc triggerFunc, uint64 step, uint64 lowerBound, uint64 upperBound, const char **strings); MenuEntry *DebugMenuAddFloat32(const char *path, const char *name, float *ptr, TriggerFunc triggerFunc, float step, float lowerBound, float upperBound); MenuEntry *DebugMenuAddFloat64(const char *path, const char *name, double *ptr, TriggerFunc triggerFunc, double step, double lowerBound, double upperBound); MenuEntry *DebugMenuAddCmd(const char *path, const char *name, TriggerFunc triggerFunc); void DebugMenuEntrySetWrap(MenuEntry *e, bool wrap); void DebugMenuEntrySetStrings(MenuEntry *e, const char **strings); void DebugMenuEntrySetAddress(MenuEntry *e, void *addr); void DebugMenuInit(void); void DebugMenuShutdown(void); void DebugMenuProcess(void); void DebugMenuRender(void); // Some overloads for simplicity inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, int8_t *ptr, TriggerFunc triggerFunc, int8_t step, int8_t lowerBound, int8_t upperBound, const char **strings) { return DebugMenuAddInt8(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, int16_t *ptr, TriggerFunc triggerFunc, int16_t step, int16_t lowerBound, int16_t upperBound, const char **strings) { return DebugMenuAddInt16(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, int32_t *ptr, TriggerFunc triggerFunc, int32_t step, int32_t lowerBound, int32_t upperBound, const char **strings) { return DebugMenuAddInt32(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, int64_t *ptr, TriggerFunc triggerFunc, int64_t step, int64_t lowerBound, int64_t upperBound, const char **strings) { return DebugMenuAddInt64(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, uint8_t *ptr, TriggerFunc triggerFunc, uint8_t step, uint8_t lowerBound, uint8_t upperBound, const char **strings) { return DebugMenuAddUInt8(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, uint16_t *ptr, TriggerFunc triggerFunc, uint16_t step, uint16_t lowerBound, uint16_t upperBound, const char **strings) { return DebugMenuAddUInt16(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, uint32_t *ptr, TriggerFunc triggerFunc, uint32_t step, uint32_t lowerBound, uint32_t upperBound, const char **strings) { return DebugMenuAddUInt32(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, uint64_t *ptr, TriggerFunc triggerFunc, uint64_t step, uint64_t lowerBound, uint64_t upperBound, const char **strings) { return DebugMenuAddUInt64(path, name, ptr, triggerFunc, step, lowerBound, upperBound, strings); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, float *ptr, TriggerFunc triggerFunc, float step, float lowerBound, float upperBound) { return DebugMenuAddFloat32(path, name, ptr, triggerFunc, step, lowerBound, upperBound); } inline DebugMenuEntry *DebugMenuAddVar(const char *path, const char *name, double *ptr, TriggerFunc triggerFunc, double step, double lowerBound, double upperBound) { return DebugMenuAddFloat64(path, name, ptr, triggerFunc, step, lowerBound, upperBound); } inline DebugMenuEntry *DebugMenuAddVarBool32(const char *path, const char *name, int32_t *ptr, TriggerFunc triggerFunc) { static const char *boolstr[] = { "Off", "On" }; DebugMenuEntry *e = DebugMenuAddVar(path, name, ptr, triggerFunc, 1, 0, 1, boolstr); DebugMenuEntrySetWrap(e, true); return e; } inline DebugMenuEntry *DebugMenuAddVarBool16(const char *path, const char *name, int16_t *ptr, TriggerFunc triggerFunc) { static const char *boolstr[] = { "Off", "On" }; DebugMenuEntry *e = DebugMenuAddVar(path, name, ptr, triggerFunc, 1, 0, 1, boolstr); DebugMenuEntrySetWrap(e, true); return e; } inline DebugMenuEntry *DebugMenuAddVarBool8(const char *path, const char *name, int8_t *ptr, TriggerFunc triggerFunc) { static const char *boolstr[] = { "Off", "On" }; DebugMenuEntry *e = DebugMenuAddVar(path, name, ptr, triggerFunc, 1, 0, 1, boolstr); DebugMenuEntrySetWrap(e, true); return e; } inline DebugMenuEntry *DebugMenuAddVarBool8(const char *path, const char *name, bool *ptr, TriggerFunc triggerFunc) { return DebugMenuAddVarBool8(path, name, (int8_t*)ptr, triggerFunc); } #endif
#pragma once #ifdef DEBUGMENU typedef void (*CLASS_0)(void); struct CLASS_1; struct CLASS_2 { int VAR_1; const char *VAR_2; CLASS_2 *VAR_3; RwRect VAR_4; CLASS_1 *menu; VAR_0(const char *VAR_2); CLASS_3 ~VAR_0(void) { VAR_5(VAR_6(void*)VAR_2); } }; typedef CLASS_2 ID_0; CLASS_2 *FUNC_0(const char *VAR_7, const char *VAR_2, int8 *VAR_8, CLASS_0 VAR_9, int8 VAR_10, int8 VAR_11, int8 upperBound, const char **VAR_12); CLASS_2 *FUNC_1(const char *VAR_7, const char *VAR_2, CLASS_5 *VAR_8, CLASS_0 VAR_9, CLASS_5 VAR_10, CLASS_5 VAR_11, CLASS_5 upperBound, const char **VAR_12); CLASS_2 *FUNC_2(const char *VAR_7, const char *VAR_2, CLASS_6 *VAR_8, CLASS_0 VAR_9, CLASS_6 VAR_10, CLASS_6 VAR_11, CLASS_6 upperBound, const char **VAR_12); CLASS_2 *FUNC_3(const char *VAR_7, const char *VAR_2, CLASS_7 *VAR_8, CLASS_0 VAR_9, CLASS_7 VAR_10, CLASS_7 VAR_11, CLASS_7 upperBound, const char **VAR_12); CLASS_2 *FUNC_4(const char *VAR_7, const char *VAR_2, CLASS_8 *VAR_8, CLASS_0 VAR_9, CLASS_8 VAR_10, CLASS_8 VAR_11, CLASS_8 upperBound, const char **VAR_12); CLASS_2 *FUNC_5(const char *VAR_7, const char *VAR_2, uint16 *VAR_8, CLASS_0 VAR_9, uint16 VAR_10, uint16 VAR_11, uint16 upperBound, const char **VAR_12); CLASS_2 *DebugMenuAddUInt32(const char *VAR_7, const char *VAR_2, CLASS_9 *VAR_8, CLASS_0 VAR_9, CLASS_9 VAR_10, CLASS_9 VAR_11, CLASS_9 upperBound, const char **VAR_12); CLASS_2 *DebugMenuAddUInt64(const char *VAR_7, const char *VAR_2, uint64 *VAR_8, CLASS_0 VAR_9, uint64 VAR_10, uint64 VAR_11, uint64 upperBound, const char **VAR_12); CLASS_2 *DebugMenuAddFloat32(const char *VAR_7, const char *VAR_2, float *VAR_8, CLASS_0 VAR_9, float VAR_10, float VAR_11, float upperBound); CLASS_2 *DebugMenuAddFloat64(const char *VAR_7, const char *VAR_2, double *VAR_8, CLASS_0 VAR_9, double VAR_10, double VAR_11, double upperBound); CLASS_2 *FUNC_6(const char *VAR_7, const char *VAR_2, CLASS_0 VAR_9); void FUNC_7(CLASS_2 *e, bool VAR_13); void FUNC_8(CLASS_2 *e, const char **VAR_12); void DebugMenuEntrySetAddress(CLASS_2 *e, void *VAR_14); void FUNC_9(void); void FUNC_10(void); void DebugMenuProcess(void); void FUNC_11(void); // Some overloads for simplicity inline CLASS_4 *FUNC_12(const char *VAR_7, const char *VAR_2, int8_t *VAR_8, CLASS_0 VAR_9, int8_t VAR_10, int8_t VAR_11, int8_t upperBound, const char **VAR_12) { return FUNC_0(VAR_7, VAR_2, VAR_8, VAR_9, VAR_10, VAR_11, upperBound, VAR_12); } inline CLASS_4 *FUNC_12(const char *VAR_7, const char *VAR_2, int16_t *VAR_8, CLASS_0 VAR_9, int16_t VAR_10, int16_t VAR_11, int16_t upperBound, const char **VAR_12) { return FUNC_1(VAR_7, VAR_2, VAR_8, VAR_9, VAR_10, VAR_11, upperBound, VAR_12); } inline CLASS_4 *FUNC_12(const char *VAR_7, const char *VAR_2, int32_t *VAR_8, CLASS_0 VAR_9, int32_t VAR_10, int32_t VAR_11, int32_t upperBound, const char **VAR_12) { return FUNC_2(VAR_7, VAR_2, VAR_8, VAR_9, VAR_10, VAR_11, upperBound, VAR_12); } inline CLASS_4 *FUNC_12(const char *VAR_7, const char *VAR_2, int64_t *VAR_8, CLASS_0 VAR_9, int64_t VAR_10, int64_t VAR_11, int64_t upperBound, const char **VAR_12) { return FUNC_3(VAR_7, VAR_2, VAR_8, VAR_9, VAR_10, VAR_11, upperBound, VAR_12); } inline CLASS_4 *FUNC_12(const char *VAR_7, const char *VAR_2, uint8_t *VAR_8, CLASS_0 VAR_9, uint8_t VAR_10, uint8_t VAR_11, uint8_t upperBound, const char **VAR_12) { return FUNC_4(VAR_7, VAR_2, VAR_8, VAR_9, VAR_10, VAR_11, upperBound, VAR_12); } inline CLASS_4 *FUNC_12(const char *VAR_7, const char *VAR_2, uint16_t *VAR_8, CLASS_0 VAR_9, uint16_t VAR_10, uint16_t VAR_11, uint16_t upperBound, const char **VAR_12) { return FUNC_5(VAR_7, VAR_2, VAR_8, VAR_9, VAR_10, VAR_11, upperBound, VAR_12); } inline CLASS_4 *FUNC_12(const char *VAR_7, const char *VAR_2, uint32_t *VAR_8, CLASS_0 VAR_9, uint32_t VAR_10, uint32_t VAR_11, uint32_t upperBound, const char **VAR_12) { return DebugMenuAddUInt32(VAR_7, VAR_2, VAR_8, VAR_9, VAR_10, VAR_11, upperBound, VAR_12); } inline CLASS_4 *FUNC_12(const char *VAR_7, const char *VAR_2, uint64_t *VAR_8, CLASS_0 VAR_9, uint64_t VAR_10, uint64_t VAR_11, uint64_t upperBound, const char **VAR_12) { return DebugMenuAddUInt64(VAR_7, VAR_2, VAR_8, VAR_9, VAR_10, VAR_11, upperBound, VAR_12); } inline CLASS_4 *FUNC_12(const char *VAR_7, const char *VAR_2, float *VAR_8, CLASS_0 VAR_9, float VAR_10, float VAR_11, float upperBound) { return DebugMenuAddFloat32(VAR_7, VAR_2, VAR_8, VAR_9, VAR_10, VAR_11, upperBound); } inline CLASS_4 *FUNC_12(const char *VAR_7, const char *VAR_2, double *VAR_8, CLASS_0 VAR_9, double VAR_10, double VAR_11, double upperBound) { return DebugMenuAddFloat64(VAR_7, VAR_2, VAR_8, VAR_9, VAR_10, VAR_11, upperBound); } inline CLASS_4 *FUNC_13(const char *VAR_7, const char *VAR_2, int32_t *VAR_8, CLASS_0 VAR_9) { static const char *VAR_15[] = { "Off", "On" }; CLASS_4 *e = FUNC_12(VAR_7, VAR_2, VAR_8, VAR_9, 1, 0, 1, VAR_15); FUNC_7(e, true); return e; } inline CLASS_4 *FUNC_14(const char *VAR_7, const char *VAR_2, int16_t *VAR_8, CLASS_0 VAR_9) { static const char *VAR_15[] = { "Off", "On" }; CLASS_4 *e = FUNC_12(VAR_7, VAR_2, VAR_8, VAR_9, 1, 0, 1, VAR_15); FUNC_7(e, true); return e; } inline CLASS_4 *FUNC_15(const char *VAR_7, const char *VAR_2, int8_t *VAR_8, CLASS_0 VAR_9) { static const char *VAR_15[] = { "Off", "On" }; CLASS_4 *e = FUNC_12(VAR_7, VAR_2, VAR_8, VAR_9, 1, 0, 1, VAR_15); FUNC_7(e, true); return e; } inline CLASS_4 *FUNC_15(const char *VAR_7, const char *VAR_2, bool *VAR_8, CLASS_0 VAR_9) { return FUNC_15(VAR_7, VAR_2, (int8_t*)VAR_8, VAR_9); } #endif
0.867434
{'CLASS_0': 'TriggerFunc', 'CLASS_1': 'Menu', 'CLASS_2': 'MenuEntry', 'VAR_0': 'MenuEntry', 'VAR_1': 'type', 'VAR_2': 'name', 'VAR_3': 'next', 'VAR_4': 'r', 'CLASS_3': 'virtual', 'VAR_5': 'free', 'VAR_6': '', 'ID_0': 'DebugMenuEntry', 'CLASS_4': 'DebugMenuEntry', 'FUNC_0': 'DebugMenuAddInt8', 'VAR_7': 'path', 'VAR_8': 'ptr', 'VAR_9': 'triggerFunc', 'VAR_10': 'step', 'VAR_11': 'lowerBound', 'VAR_12': 'strings', 'FUNC_1': 'DebugMenuAddInt16', 'CLASS_5': 'int16', 'FUNC_2': 'DebugMenuAddInt32', 'CLASS_6': 'int32', 'FUNC_3': 'DebugMenuAddInt64', 'CLASS_7': 'int64', 'FUNC_4': 'DebugMenuAddUInt8', 'CLASS_8': 'uint8', 'FUNC_5': 'DebugMenuAddUInt16', 'CLASS_9': 'uint32', 'FUNC_6': 'DebugMenuAddCmd', 'FUNC_7': 'DebugMenuEntrySetWrap', 'VAR_13': 'wrap', 'FUNC_8': 'DebugMenuEntrySetStrings', 'VAR_14': 'addr', 'FUNC_9': 'DebugMenuInit', 'FUNC_10': 'DebugMenuShutdown', 'FUNC_11': 'DebugMenuRender', 'FUNC_12': 'DebugMenuAddVar', 'FUNC_13': 'DebugMenuAddVarBool32', 'VAR_15': 'boolstr', 'FUNC_14': 'DebugMenuAddVarBool16', 'FUNC_15': 'DebugMenuAddVarBool8'}
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef __nsScriptableUConv_h_ #define __nsScriptableUConv_h_ #include "nsICharsetConverterManager.h" #include "nsIScriptableUConv.h" class nsScriptableUnicodeConverter : public nsIScriptableUnicodeConverter { public: NS_DECL_ISUPPORTS NS_DECL_NSISCRIPTABLEUNICODECONVERTER nsScriptableUnicodeConverter(); virtual ~nsScriptableUnicodeConverter(); protected: nsCString mCharset; nsCOMPtr<nsIUnicodeEncoder> mEncoder; nsCOMPtr<nsIUnicodeDecoder> mDecoder; bool mIsInternal; nsresult FinishWithLength(char **_retval, int32_t* aLength); nsresult ConvertFromUnicodeWithLength(const nsAString& aSrc, int32_t* aOutLen, char **_retval); nsresult InitConverter(); }; #endif
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef __nsScriptableUConv_h_ #define __nsScriptableUConv_h_ #include "nsICharsetConverterManager.h" #include "nsIScriptableUConv.h" class nsScriptableUnicodeConverter : public nsIScriptableUnicodeConverter { public: NS_DECL_ISUPPORTS NS_DECL_NSISCRIPTABLEUNICODECONVERTER nsScriptableUnicodeConverter(); virtual ~nsScriptableUnicodeConverter(); protected: nsCString mCharset; nsCOMPtr<nsIUnicodeEncoder> mEncoder; nsCOMPtr<nsIUnicodeDecoder> mDecoder; bool mIsInternal; nsresult FinishWithLength(char **_retval, int32_t* aLength); nsresult ConvertFromUnicodeWithLength(const nsAString& aSrc, int32_t* aOutLen, char **_retval); nsresult InitConverter(); }; #endif
0.002562
{}
/* * ===================================================================================== * * Filename: CSCDQM_Collection.h * * Description: Histogram Booking Collection Management Class * * Version: 1.0 * Created: 10/30/2008 04:40:38 PM * Revision: none * Compiler: gcc * * Author: Valdas Rapsevicius (VR), [email protected] * Company: CERN, CH * * ===================================================================================== */ #ifndef CSCDQM_Collection_H #define CSCDQM_Collection_H #include <string> #include <map> #include <vector> #include <sstream> #include <TProfile.h> #include <xercesc/parsers/XercesDOMParser.hpp> #include <xercesc/dom/DOMNodeList.hpp> #include <xercesc/dom/DOMElement.hpp> #include "CSCDQM_Exception.h" #include "CSCDQM_Logger.h" #include "CSCDQM_Utility.h" #include "CSCDQM_Configuration.h" namespace cscdqm { /** * Constants used for element recognition in Booking XML. */ static const char XML_BOOK_DEFINITION[] = "Definition"; static const char XML_BOOK_DEFINITION_ID[] = "id"; static const char XML_BOOK_HISTOGRAM[] = "Histogram"; static const char XML_BOOK_DEFINITION_REF[] = "ref"; static const char XML_BOOK_HISTO_NAME[] = "Name"; static const char XML_BOOK_HISTO_PREFIX[] = "Prefix"; static const char XML_BOOK_HISTO_TYPE[] = "Type"; static const char XML_BOOK_HISTO_TITLE[] = "Title"; static const char XML_BOOK_ONDEMAND[] = "OnDemand"; static const char XML_BOOK_ONDEMAND_TRUE[] = "1"; static const char XML_BOOK_ONDEMAND_FALSE[] = "0"; static const char XML_BOOK_NAME_FROM[] = "Name_from"; static const char XML_BOOK_NAME_TO[] = "Name_to"; /** Default histogram color */ static const int DEF_HISTO_COLOR = 48; /** List of Single Histogram properties */ typedef std::map<std::string, std::string> CoHistoProps; /** List of Histograms */ typedef std::map<std::string, CoHistoProps> CoHisto; /** List of Histogram Types */ typedef std::map<std::string, CoHisto> CoHistoMap; /** * @class Collection * @brief Manage collection of histograms, load histogram definitions from * XML file and book histograms by calling MonitorObjectProvider routines. */ class Collection { public: typedef xercesc::DOMDocument DOMDocument; typedef xercesc::DOMElement DOMElement; typedef xercesc::DOMNode DOMNode; typedef xercesc::DOMNodeList DOMNodeList; typedef xercesc::DOMNamedNodeMap DOMNamedNodeMap; typedef xercesc::XMLException XMLException; typedef xercesc::XMLString XMLString; typedef xercesc::XMLPlatformUtils XMLPlatformUtils; typedef xercesc::XercesDOMParser XercesDOMParser; Collection(Configuration* const p_config); void load(); void bookEMUHistos() const; void bookFEDHistos(const HwId fedId) const; void bookDDUHistos(const HwId dduId) const; void bookCSCHistos(const HwId crateId, const HwId dmbId) const; void bookCSCHistos(const HistoId hid, const HwId crateId, const HwId dmbId, const HwId addId) const; const bool isOnDemand(const HistoName& name) const; void printCollection() const; private: static const bool checkHistoValue(const CoHistoProps& h, const std::string& name, std::string& value); static const bool checkHistoValue(const CoHistoProps& h, const std::string& name, int& value); static const bool checkHistoValue(const CoHistoProps& h, const std::string name, double& value); static std::string& getHistoValue(const CoHistoProps& h, const std::string& name, std::string& value, const std::string& def_value = ""); static int& getHistoValue(const CoHistoProps& h, const std::string& name, int& value, const int& def_value = 0); static double& getHistoValue(const CoHistoProps& h, const std::string name, double& value, const int def_value = 0.0); void book(const HistoDef& h, const CoHistoProps& p, const std::string& folder) const; static const int ParseAxisLabels(const std::string& s, std::map<int, std::string>& labels); static void getNodeProperties(DOMNode*& node, CoHistoProps& hp); Configuration* config; CoHistoMap collection; }; } // namespace cscdqm #endif
/* * ===================================================================================== * * Filename: CSCDQM_Collection.h * * Description: Histogram Booking Collection Management Class * * Version: 1.0 * Created: 10/30/2008 04:40:38 PM * Revision: none * Compiler: gcc * * Author: Valdas Rapsevicius (VR), [email protected] * Company: CERN, CH * * ===================================================================================== */ #ifndef CSCDQM_Collection_H #define CSCDQM_Collection_H #include <string> #include <map> #include <vector> #include <sstream> #include <TProfile.h> #include <xercesc/parsers/XercesDOMParser.hpp> #include <xercesc/dom/DOMNodeList.hpp> #include <xercesc/dom/DOMElement.hpp> #include "CSCDQM_Exception.h" #include "CSCDQM_Logger.h" #include "CSCDQM_Utility.h" #include "CSCDQM_Configuration.h" namespace cscdqm { /** * Constants used for element recognition in Booking XML. */ static const char XML_BOOK_DEFINITION[] = "Definition"; static const char XML_BOOK_DEFINITION_ID[] = "id"; static const char XML_BOOK_HISTOGRAM[] = "Histogram"; static const char XML_BOOK_DEFINITION_REF[] = "ref"; static const char XML_BOOK_HISTO_NAME[] = "Name"; static const char XML_BOOK_HISTO_PREFIX[] = "Prefix"; static const char XML_BOOK_HISTO_TYPE[] = "Type"; static const char VAR_0[] = "Title"; static const char VAR_1[] = "OnDemand"; static const char XML_BOOK_ONDEMAND_TRUE[] = "1"; static const char XML_BOOK_ONDEMAND_FALSE[] = "0"; static const char XML_BOOK_NAME_FROM[] = "Name_from"; static const char XML_BOOK_NAME_TO[] = "Name_to"; /** Default histogram color */ static const int DEF_HISTO_COLOR = 48; /** List of Single Histogram properties */ typedef std::map<std::string, std::string> CoHistoProps; /** List of Histograms */ typedef std::map<std::string, CoHistoProps> CoHisto; /** List of Histogram Types */ typedef std::map<std::string, CoHisto> CoHistoMap; /** * @class Collection * @brief Manage collection of histograms, load histogram definitions from * XML file and book histograms by calling MonitorObjectProvider routines. */ class Collection { public: typedef xercesc::DOMDocument DOMDocument; typedef xercesc::DOMElement DOMElement; typedef xercesc::DOMNode DOMNode; typedef xercesc::DOMNodeList DOMNodeList; typedef xercesc::DOMNamedNodeMap DOMNamedNodeMap; typedef xercesc::XMLException XMLException; typedef xercesc::XMLString XMLString; typedef xercesc::XMLPlatformUtils XMLPlatformUtils; typedef xercesc::XercesDOMParser XercesDOMParser; Collection(Configuration* const p_config); void load(); void bookEMUHistos() const; void bookFEDHistos(const HwId fedId) const; void bookDDUHistos(const HwId dduId) const; void bookCSCHistos(const HwId crateId, const HwId dmbId) const; void bookCSCHistos(const HistoId hid, const HwId crateId, const HwId dmbId, const HwId addId) const; const bool isOnDemand(const CLASS_0& name) const; void printCollection() const; private: static const bool checkHistoValue(const CoHistoProps& h, const std::string& name, std::string& value); static const bool checkHistoValue(const CoHistoProps& h, const std::string& name, int& value); static const bool checkHistoValue(const CoHistoProps& h, const std::string name, double& value); static std::string& getHistoValue(const CoHistoProps& h, const std::string& name, std::string& value, const std::string& def_value = ""); static int& getHistoValue(const CoHistoProps& h, const std::string& name, int& value, const int& def_value = 0); static double& getHistoValue(const CoHistoProps& h, const std::string name, double& value, const int def_value = 0.0); void book(const HistoDef& h, const CoHistoProps& p, const std::string& folder) const; static const int ParseAxisLabels(const std::string& s, std::map<int, std::string>& labels); static void getNodeProperties(DOMNode*& node, CoHistoProps& hp); Configuration* config; CoHistoMap collection; }; } // namespace cscdqm #endif
0.04953
{'VAR_0': 'XML_BOOK_HISTO_TITLE', 'VAR_1': 'XML_BOOK_ONDEMAND', 'CLASS_0': 'HistoName'}
#ifndef _THREADPOOL_H_ #define _THREADPOOL_H_ #include <pthread.h> #include "condition.h" typedef struct task { void *(*run)(void *arg); //指针函数(即这个任务要去做什么事情) void *arg; // 参数 struct task *next; // 指向下一个任务的指针 } task_t; typedef struct threadpool //线程池结构体 { condition_t ready; // 任务准备就绪或者线程池销毁通知 task_t *first; // 任务队列头指针 task_t *last; // 任务队列尾指针 int count; // 线程池中当前线程数 int idle; // 线程池中当前正在等待任务的线程数 int max_threads; // 线程池中最大允许的线程数 int quit; // 销毁线程池的时候置1 }threadpool_t; void threadpool_init(threadpool_t *pool,int threads); void threadpool_add_task(threadpool_t *pool, void *(*run)(void *arg),void *arg); void threadpool_destroy(threadpool_t *pool); #endif
#ifndef VAR_0 #define VAR_0 #include <pthread.h> #include "IMPORT_0" typedef struct task { void *(*run)(void *VAR_1); //指针函数(即这个任务要去做什么事情) void *VAR_1; // 参数 struct task *VAR_2; // 指向下一个任务的指针 } ID_0; typedef struct CLASS_1 //线程池结构体 { CLASS_2 VAR_3; // 任务准备就绪或者线程池销毁通知 CLASS_0 *VAR_4; // 任务队列头指针 CLASS_0 *last; // 任务队列尾指针 int count; // 线程池中当前线程数 int VAR_5; // 线程池中当前正在等待任务的线程数 int VAR_6; // 线程池中最大允许的线程数 int quit; // 销毁线程池的时候置1 }ID_1; void FUNC_0(CLASS_3 *VAR_7,int VAR_8); void threadpool_add_task(CLASS_3 *VAR_7, void *(*run)(void *VAR_1),void *VAR_1); void FUNC_1(CLASS_3 *VAR_7); #endif
0.781089
{'VAR_0': '_THREADPOOL_H_', 'IMPORT_0': 'condition.h', 'VAR_1': 'arg', 'VAR_2': 'next', 'ID_0': 'task_t', 'CLASS_0': 'task_t', 'CLASS_1': 'threadpool', 'CLASS_2': 'condition_t', 'VAR_3': 'ready', 'VAR_4': 'first', 'VAR_5': 'idle', 'VAR_6': 'max_threads', 'ID_1': 'threadpool_t', 'CLASS_3': 'threadpool_t', 'FUNC_0': 'threadpool_init', 'VAR_7': 'pool', 'VAR_8': 'threads', 'FUNC_1': 'threadpool_destroy'}
// Copyright 2014 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 EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_INTERFACE_H_ #define EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_INTERFACE_H_ #include <string> #include <vector> #include "base/callback.h" #include "base/memory/scoped_ptr.h" namespace extensions { namespace core_api { class DocumentScanInterface { public: struct ScannerDescription { ScannerDescription(); ~ScannerDescription(); std::string name; std::string manufacturer; std::string model; std::string scanner_type; std::string image_mime_type; }; enum ScanMode { kScanModeColor, kScanModeGray, kScanModeLineart }; typedef base::Callback<void( const std::vector<ScannerDescription>& scanner_descriptions, const std::string& error)> ListScannersResultsCallback; typedef base::Callback<void(const std::string& scanned_image, const std::string& mime_type, const std::string& error)> ScanResultsCallback; virtual ~DocumentScanInterface(); virtual void Scan(const std::string& scanner_name, ScanMode mode, int resolution_dpi, const ScanResultsCallback& callback) = 0; virtual void ListScanners(const ListScannersResultsCallback& callback) = 0; // Creates a platform-specific DocumentScanInterface instance. static DocumentScanInterface* CreateInstance(); protected: DocumentScanInterface(); }; } // namespace core_api } // namespace extensions #endif // EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_INTERFACE_H_
// Copyright 2014 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 EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_INTERFACE_H_ #define EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_INTERFACE_H_ #include <string> #include <vector> #include "base/callback.h" #include "base/memory/scoped_ptr.h" namespace extensions { namespace core_api { class VAR_0 { public: struct VAR_1 { FUNC_1(); ~FUNC_1(); std::string name; std::string manufacturer; std::string VAR_2; std::string scanner_type; std::string image_mime_type; }; enum ScanMode { kScanModeColor, kScanModeGray, kScanModeLineart }; typedef base::Callback<void( const CLASS_1::vector<VAR_1>& scanner_descriptions, const CLASS_1::string& VAR_3)> ListScannersResultsCallback; typedef base::Callback<void(const CLASS_1::string& scanned_image, const CLASS_1::string& mime_type, const CLASS_1::string& VAR_3)> ScanResultsCallback; virtual ~FUNC_0(); virtual void Scan(const CLASS_1::string& scanner_name, ScanMode mode, int VAR_4, const ScanResultsCallback& callback) = 0; virtual void ListScanners(const ListScannersResultsCallback& callback) = 0; // Creates a platform-specific DocumentScanInterface instance. static CLASS_0* CreateInstance(); protected: FUNC_0(); }; } // namespace core_api } // namespace extensions #endif // EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_INTERFACE_H_
0.226223
{'VAR_0': 'DocumentScanInterface', 'FUNC_0': 'DocumentScanInterface', 'CLASS_0': 'DocumentScanInterface', 'VAR_1': 'ScannerDescription', 'FUNC_1': 'ScannerDescription', 'CLASS_1': 'std', 'VAR_2': 'model', 'VAR_3': 'error', 'VAR_4': 'resolution_dpi'}
/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2010-2016 Intel Corporation */ /* Test prototypes */ int test_table_hash_cuckoo(void); int test_table_lpm(void); int test_table_lpm_ipv6(void); int test_table_array(void); #ifdef RTE_LIB_ACL int test_table_acl(void); #endif int test_table_hash_unoptimized(void); int test_table_hash_lru(void); int test_table_hash_ext(void); int test_table_stub(void); /* Extern variables */ typedef int (*table_test)(void); extern table_test table_tests[]; extern unsigned n_table_tests;
/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2010-2016 Intel Corporation */ /* Test prototypes */ int test_table_hash_cuckoo(void); int FUNC_0(void); int FUNC_1(void); int FUNC_2(void); #ifdef VAR_0 int FUNC_3(void); #endif int FUNC_4(void); int FUNC_5(void); int FUNC_6(void); int test_table_stub(void); /* Extern variables */ typedef int (*CLASS_0)(void); extern CLASS_0 VAR_1[]; extern unsigned VAR_2;
0.828969
{'FUNC_0': 'test_table_lpm', 'FUNC_1': 'test_table_lpm_ipv6', 'FUNC_2': 'test_table_array', 'VAR_0': 'RTE_LIB_ACL', 'FUNC_3': 'test_table_acl', 'FUNC_4': 'test_table_hash_unoptimized', 'FUNC_5': 'test_table_hash_lru', 'FUNC_6': 'test_table_hash_ext', 'CLASS_0': 'table_test', 'VAR_1': 'table_tests', 'VAR_2': 'n_table_tests'}
#ifndef __BL_NONBLOCK_MPMC_BOUNDED_PRODUCER_MULTISLOT_H__ #define __BL_NONBLOCK_MPMC_BOUNDED_PRODUCER_MULTISLOT_H__ #include <bl/nonblock/libexport.h> #include <bl/nonblock/mpmc_b_common.h> #include <bl/base/platform.h> #include <bl/base/cache.h> #include <bl/base/alignment.h> #include <bl/base/allocator.h> #include <bl/base/error.h> #include <bl/base/integer_manipulation.h> #include <bl/base/utility.h> #include <bl/base/atomic.h> #ifdef __cplusplus extern "C" { #endif /*------------------------------------------------------------------------------ This is the <NAME> MPMC with added variations: -It's broken in prepare commit blocks, giving direct access to the underlying array memory. The queue doubles as a FIFO and as a fixed-size memory allocator. -The produce functions can reserve more than a slot at once, the consume functions retrieve a variable amount of slots. -Adds some bits of the produce/consumer counters for communicating producer with producers or consumers with consumers. This feature is called "signals" and it's useful to reuse the CAS loop to broadcast state between producers. It uses 6 bits. -Can be used as a backup allocator for other queues as long as the elements have very similar lifetimes. It is ideal to function as a per-CPU allocator (threads moved to another CPU won't make the queue to fail, as it's still multithreaded, but having a fast CPU heuristic could help fighting contention). (TODO fix free alloc producer functions). -TODO: Add fair blocking behavior The algorithm is veryfied by relacy and is race-free, but when in contention it has extra unfairness towards the producers trying to allocate more slots (they operate slowly). ------------------------------------------------------------------------------*/ typedef struct bl_mpmc_bpm { bl_u8* mem; bl_u8* mem_unaligned; bl_u32 slots; bl_u32 slot_max; bl_u32 slot_size; bl_u32 flags; bl_declare_cache_pad_member; bl_atomic_u32 push_slot; bl_declare_cache_pad_member; bl_atomic_u32 pop_slot; bl_declare_cache_pad_member; } bl_mpmc_bpm; /*----------------------------------------------------------------------------*/ static inline bl_u32 bl_mpmc_bpm_slot_size (bl_mpmc_bpm const* q) { return q->slot_size; } /*----------------------------------------------------------------------------*/ static inline bl_uword bl_mpmc_bpm_required_slots (bl_mpmc_bpm const* q, bl_uword payload) { return bl_round_to_next_multiple (payload + sizeof (bl_u32), q->slot_size); } /*----------------------------------------------------------------------------*/ static inline bl_uword bl_mpmc_bpm_slot_payload (bl_mpmc_bpm const* q, bl_uword slots) { return (q->slot_size * slots) - sizeof (bl_u32); } /*----------------------------------------------------------------------------*/ static inline bl_u32 bl_mpmc_bpm_slot_count (bl_mpmc_bpm const* q) { return q->slots; } /*------------------------------------------------------------------------------ slot_count: number of queue slots. a power of two. max is "bl_mpmc_bpm_max_slots". The slot count must be bigger than the number of producer threads if you use "bl_mpmc_bpm_fifo_produce_prepare". slot_size: Absolute size of the slot including a leading bl_u32 variable. slot_max: the maximum amount of slots to be reserved at once. This parameter causes the queue to a tail of free memory so the last slot of the queue can reserve "slot_max" slots. A queue of "slot_count = 8" and "slot_max" = 8 would result in a queue of (2 * 8) - 1 = 15 slots. slot_alignment: the required alignment of the memory pointer returned by the produce calls. enable_fairness: When disabled reserving higher "slot_count" values take more time to complete that the lower ones, which can lead to noticieable unfairness when the queue is under contention. Enabling this flag equates all slow counts to the worst case. In any case this queue fits best for elements without a big size differences. ------------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_err bl_mpmc_bpm_init( bl_mpmc_bpm* q, bl_alloc_tbl const* alloc, bl_u32 slot_count, bl_u32 slot_max, bl_u32 slot_size, bl_u32 slot_alignment, bool enable_fairness ); /*----------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT void bl_mpmc_bpm_destroy (bl_mpmc_bpm* q, bl_alloc_tbl const* alloc); /*------------------------------------------------------------------------------ "bl_mpmc_bpm_produce_prepare*" funtion call variants. "produce_prepare" Gets a FIFO memory chunk from the queue for producing. On a successful call the memory chunk can be written. The memory write is signaled by calling "bl_mpmc_bpm_produce_commit". op: when there is no error will contain the current ticket id and the signal that was present on the producer's "channel". You unpack them with "bl_mpmc_b_sig_decode (op)" and "bl_mpmc_b_ticket_decode (op)" On return of an error code the operation has been blocked and can't be commited. On return of the "bl_preconditions" error code the operation has been blocked because of "sig_fallback_mask" and "sig_fallback_match". The signal returned will be the signal that was present on the channel, the ticket will be the ticket of the next insertion's ticket (which should be ignored). mem: on success will contain a pointer to contiguous memory, nullptr otherwise. replace_sigl + sig_replacement: If "replace_signal" is "true" the current producer channel signal value will be replaced on success with "signal_replacement". If "replace_signal" is false the "signal_replacement" value is ignored. sig_fallback_mask + sig_fallback_match: The call will early fail with the "bl_preconditions" error code if signal present on the channel now matches the condition below: ("signal_on_channel_now" & sig_fallback_mask) == sig_fallback_match This can be used e.g. on termination contexts, the signal is set to a value that represents "on termination" and with an according mask + match the producers will be blocked. Errors returned: - bl_ok: Succes, "mem" can be written and "mpmpc_ba_produce_commit" can be called. - bl_preconditions: see sig_fallback_mask + sig_fallback_match. - bl_would_overflow: queue can't allocate that number of bytes - queue full. - bl_locked: The queue is blocked Example usage snippet: TODO: ------------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_err bl_mpmc_bpm_produce_prepare_sig_fallback( bl_mpmc_bpm* q, bl_mpmc_b_op* op, bl_u8** mem, bl_u32 slots, bool replace_sig, bl_mpmc_b_sig sig_replacement, bl_mpmc_b_sig sig_fallback_mask, bl_mpmc_b_sig sig_fallback_match ); /*----------------------------------------------------------------------------*/ static inline bl_err bl_mpmc_bpm_produce_prepare_fallback( bl_mpmc_bpm* q, bl_mpmc_b_op* op, bl_u8** mem, bl_u32 slots, bl_mpmc_b_sig sig_fallback_mask, bl_mpmc_b_sig sig_fallback_match ) { return bl_mpmc_bpm_produce_prepare_sig_fallback( q, op, mem, slots, false, 0, sig_fallback_mask, sig_fallback_match ); } /*----------------------------------------------------------------------------*/ static inline bl_err bl_mpmc_bpm_produce_prepare_sig( bl_mpmc_bpm* q, bl_mpmc_b_op* op, bl_u8** mem, bl_u32 slots, bl_mpmc_b_sig sig_replacement ) { return bl_mpmc_bpm_produce_prepare_sig_fallback( q, op, mem, slots, true, sig_replacement, 0, 1 ); } /*----------------------------------------------------------------------------*/ static inline bl_err bl_mpmc_bpm_produce_prepare( bl_mpmc_bpm* q, bl_mpmc_b_op* op, bl_u8** mem, bl_u32 slots ) { return bl_mpmc_bpm_produce_prepare_sig_fallback( q, op, mem, slots, false, 0, 0, 1 ); } /*----------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT void bl_mpmc_bpm_produce_commit( bl_mpmc_bpm* q, bl_mpmc_b_op op, bl_u8* mem, bl_u32 slots ); /*------------------------------------------------------------------------------ The interface is exactly the same as on the "bl_mpmc_bpm_produce_prepare*" funtion call variants but consuming instead. ------------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_err bl_mpmc_bpm_consume_prepare_sig_fallback( bl_mpmc_bpm* q, bl_mpmc_b_op* op, bl_u8** mem, bl_u32* slots, bool replace_sig, bl_mpmc_b_sig sig_replacement, bl_mpmc_b_sig sig_fallback_mask, bl_mpmc_b_sig sig_fallback_match ); /*----------------------------------------------------------------------------*/ static inline bl_err bl_mpmc_bpm_consume_prepare_fallback( bl_mpmc_bpm* q, bl_mpmc_b_op* op, bl_u8** mem, bl_u32* slots, bl_mpmc_b_sig sig_fallback_mask, bl_mpmc_b_sig sig_fallback_match ) { return bl_mpmc_bpm_consume_prepare_sig_fallback( q, op, mem, slots, false, 0, sig_fallback_mask, sig_fallback_match ); } /*----------------------------------------------------------------------------*/ static inline bl_err bl_mpmc_bpm_consume_prepare_sig( bl_mpmc_bpm* q, bl_mpmc_b_op* op, bl_u8** mem, bl_u32* slots, bl_mpmc_b_sig sig_replacement ) { return bl_mpmc_bpm_consume_prepare_sig_fallback( q, op, mem, slots, true, sig_replacement, 0, 1 ); } /*----------------------------------------------------------------------------*/ static inline bl_err bl_mpmc_bpm_consume_prepare( bl_mpmc_bpm* q, bl_mpmc_b_op* op, bl_u8** mem, bl_u32* slots ) { return bl_mpmc_bpm_consume_prepare_sig_fallback( q, op, mem, slots, false, 0, 0, 1 ); } /*----------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT void bl_mpmc_bpm_consume_commit( bl_mpmc_bpm* q, bl_mpmc_b_op op, bl_u8* mem, bl_u32 slots ); /*------------------------------------------------------------------------------ This queue can be used just as an allocator, but the underlying queue is the same so: -Deallocations must happen in a near-FIFO order (e.g. this queue could be the allocator of a linked list based MPxC queue). The producers (alloc callers) will be blocked when they find an allocated slot -When on extreme contention, the "alloc" calls with less slots will have more chances to finish that those that request less slots unless the fairness is activated. ------------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_u8* bl_mpmc_bpm_alloc( bl_mpmc_bpm* q, bl_uword slots ); /*--------------------------- ------------------------------------------------*/ extern BL_NONBLOCK_EXPORT void bl_mpmc_bpm_dealloc( bl_mpmc_bpm* q, bl_u8* mem, bl_uword slots ); /*----------------------------------------------------------------------------*/ static inline void bl_mpmc_bpm_dealloc_unsafe (bl_mpmc_bpm* q, bl_u8* mem) { bl_mpmc_bpm_dealloc (q, mem, 0); } /*----------------------------------------------------------------------------*/ static inline bool bl_mpmc_bpm_allocation_is_in_range (bl_mpmc_bpm* q, bl_u8* mem) { return (mem >= q->mem) && (mem < (q->mem + (q->slots * q->slot_size))); } /*------------------------------------------------------------------------------ See bl_mpmc_b.h for documentation on these functions, they work exactly the same ------------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_err bl_mpmc_bpm_producer_signal_try_set( bl_mpmc_bpm* q, bl_mpmc_b_sig* expected, bl_mpmc_b_sig desired ); /*----------------------------------------------------------------------------- Same as the above but the last successful ticket has to match too. If the queue is unitialized the last successful ticket is uint_max; -----------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_err bl_mpmc_bpm_producer_signal_try_set_tmatch( bl_mpmc_bpm* q, bl_mpmc_b_ticket* expected, bl_mpmc_b_sig desired ); /*----------------------------------------------------------------------------- Same as above but for consumers. Can only be used on MPMC or SPMC mode -----------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_err bl_mpmc_bpm_consumer_signal_try_set( bl_mpmc_bpm* q, bl_mpmc_b_sig* expected, bl_mpmc_b_sig desired ); /*--------------------------- ------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_err bl_mpmc_bpm_consumer_signal_try_set_tmatch( bl_mpmc_bpm* q, bl_mpmc_b_ticket* expected, bl_mpmc_b_sig desired ); /*--------------------------- ------------------------------------------------*/ #ifdef __cplusplus } /*extern "C" {*/ #endif #endif /* __BL_NONBLOCK_MPMC_BOUNDED_PRODUCER_MULTI_H__ */
#ifndef VAR_0 #define VAR_0 #include <IMPORT_0> #include <IMPORT_1> #include <IMPORT_2> #include <IMPORT_3> #include <IMPORT_4> #include <IMPORT_5> #include <IMPORT_6> #include <bl/base/integer_manipulation.h> #include <bl/base/utility.h> #include <bl/base/atomic.h> #ifdef __cplusplus extern "C" { #endif /*------------------------------------------------------------------------------ This is the <NAME> MPMC with added variations: -It's broken in prepare commit blocks, giving direct access to the underlying array memory. The queue doubles as a FIFO and as a fixed-size memory allocator. -The produce functions can reserve more than a slot at once, the consume functions retrieve a variable amount of slots. -Adds some bits of the produce/consumer counters for communicating producer with producers or consumers with consumers. This feature is called "signals" and it's useful to reuse the CAS loop to broadcast state between producers. It uses 6 bits. -Can be used as a backup allocator for other queues as long as the elements have very similar lifetimes. It is ideal to function as a per-CPU allocator (threads moved to another CPU won't make the queue to fail, as it's still multithreaded, but having a fast CPU heuristic could help fighting contention). (TODO fix free alloc producer functions). -TODO: Add fair blocking behavior The algorithm is veryfied by relacy and is race-free, but when in contention it has extra unfairness towards the producers trying to allocate more slots (they operate slowly). ------------------------------------------------------------------------------*/ typedef struct CLASS_0 { bl_u8* VAR_1; bl_u8* mem_unaligned; CLASS_1 VAR_3; CLASS_1 slot_max; CLASS_1 slot_size; CLASS_1 flags; CLASS_2; CLASS_3 VAR_4; CLASS_2; CLASS_3 VAR_5; CLASS_2; } ID_0; /*----------------------------------------------------------------------------*/ static inline CLASS_1 FUNC_0 (CLASS_0 const* VAR_6) { return VAR_6->slot_size; } /*----------------------------------------------------------------------------*/ static inline bl_uword FUNC_1 (CLASS_0 const* VAR_6, bl_uword VAR_7) { return FUNC_2 (VAR_7 + sizeof (VAR_2), VAR_6->slot_size); } /*----------------------------------------------------------------------------*/ static inline bl_uword bl_mpmc_bpm_slot_payload (CLASS_0 const* VAR_6, bl_uword VAR_3) { return (VAR_6->slot_size * VAR_3) - sizeof (VAR_2); } /*----------------------------------------------------------------------------*/ static inline CLASS_1 bl_mpmc_bpm_slot_count (CLASS_0 const* VAR_6) { return VAR_6->VAR_3; } /*------------------------------------------------------------------------------ slot_count: number of queue slots. a power of two. max is "bl_mpmc_bpm_max_slots". The slot count must be bigger than the number of producer threads if you use "bl_mpmc_bpm_fifo_produce_prepare". slot_size: Absolute size of the slot including a leading bl_u32 variable. slot_max: the maximum amount of slots to be reserved at once. This parameter causes the queue to a tail of free memory so the last slot of the queue can reserve "slot_max" slots. A queue of "slot_count = 8" and "slot_max" = 8 would result in a queue of (2 * 8) - 1 = 15 slots. slot_alignment: the required alignment of the memory pointer returned by the produce calls. enable_fairness: When disabled reserving higher "slot_count" values take more time to complete that the lower ones, which can lead to noticieable unfairness when the queue is under contention. Enabling this flag equates all slow counts to the worst case. In any case this queue fits best for elements without a big size differences. ------------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_err FUNC_3( CLASS_0* VAR_6, bl_alloc_tbl const* VAR_8, CLASS_1 VAR_9, CLASS_1 slot_max, CLASS_1 slot_size, CLASS_1 slot_alignment, bool VAR_10 ); /*----------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT VAR_11 FUNC_4 (CLASS_0* VAR_6, bl_alloc_tbl const* VAR_8); /*------------------------------------------------------------------------------ "bl_mpmc_bpm_produce_prepare*" funtion call variants. "produce_prepare" Gets a FIFO memory chunk from the queue for producing. On a successful call the memory chunk can be written. The memory write is signaled by calling "bl_mpmc_bpm_produce_commit". op: when there is no error will contain the current ticket id and the signal that was present on the producer's "channel". You unpack them with "bl_mpmc_b_sig_decode (op)" and "bl_mpmc_b_ticket_decode (op)" On return of an error code the operation has been blocked and can't be commited. On return of the "bl_preconditions" error code the operation has been blocked because of "sig_fallback_mask" and "sig_fallback_match". The signal returned will be the signal that was present on the channel, the ticket will be the ticket of the next insertion's ticket (which should be ignored). mem: on success will contain a pointer to contiguous memory, nullptr otherwise. replace_sigl + sig_replacement: If "replace_signal" is "true" the current producer channel signal value will be replaced on success with "signal_replacement". If "replace_signal" is false the "signal_replacement" value is ignored. sig_fallback_mask + sig_fallback_match: The call will early fail with the "bl_preconditions" error code if signal present on the channel now matches the condition below: ("signal_on_channel_now" & sig_fallback_mask) == sig_fallback_match This can be used e.g. on termination contexts, the signal is set to a value that represents "on termination" and with an according mask + match the producers will be blocked. Errors returned: - bl_ok: Succes, "mem" can be written and "mpmpc_ba_produce_commit" can be called. - bl_preconditions: see sig_fallback_mask + sig_fallback_match. - bl_would_overflow: queue can't allocate that number of bytes - queue full. - bl_locked: The queue is blocked Example usage snippet: TODO: ------------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_err FUNC_5( CLASS_0* VAR_6, CLASS_4* op, bl_u8** VAR_1, CLASS_1 VAR_3, bool VAR_12, CLASS_5 VAR_13, CLASS_5 VAR_14, CLASS_5 sig_fallback_match ); /*----------------------------------------------------------------------------*/ static inline bl_err FUNC_6( CLASS_0* VAR_6, CLASS_4* op, bl_u8** VAR_1, CLASS_1 VAR_3, CLASS_5 VAR_14, CLASS_5 sig_fallback_match ) { return FUNC_5( VAR_6, op, VAR_1, VAR_3, false, 0, VAR_14, sig_fallback_match ); } /*----------------------------------------------------------------------------*/ static inline bl_err FUNC_7( CLASS_0* VAR_6, CLASS_4* op, bl_u8** VAR_1, CLASS_1 VAR_3, CLASS_5 VAR_13 ) { return FUNC_5( VAR_6, op, VAR_1, VAR_3, true, VAR_13, 0, 1 ); } /*----------------------------------------------------------------------------*/ static inline bl_err bl_mpmc_bpm_produce_prepare( CLASS_0* VAR_6, CLASS_4* op, bl_u8** VAR_1, CLASS_1 VAR_3 ) { return FUNC_5( VAR_6, op, VAR_1, VAR_3, false, 0, 0, 1 ); } /*----------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT VAR_11 bl_mpmc_bpm_produce_commit( CLASS_0* VAR_6, CLASS_4 op, bl_u8* VAR_1, CLASS_1 VAR_3 ); /*------------------------------------------------------------------------------ The interface is exactly the same as on the "bl_mpmc_bpm_produce_prepare*" funtion call variants but consuming instead. ------------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_err FUNC_8( CLASS_0* VAR_6, CLASS_4* op, bl_u8** VAR_1, CLASS_1* VAR_3, bool VAR_12, CLASS_5 VAR_13, CLASS_5 VAR_14, CLASS_5 sig_fallback_match ); /*----------------------------------------------------------------------------*/ static inline bl_err bl_mpmc_bpm_consume_prepare_fallback( CLASS_0* VAR_6, CLASS_4* op, bl_u8** VAR_1, CLASS_1* VAR_3, CLASS_5 VAR_14, CLASS_5 sig_fallback_match ) { return FUNC_8( VAR_6, op, VAR_1, VAR_3, false, 0, VAR_14, sig_fallback_match ); } /*----------------------------------------------------------------------------*/ static inline bl_err FUNC_9( CLASS_0* VAR_6, CLASS_4* op, bl_u8** VAR_1, CLASS_1* VAR_3, CLASS_5 VAR_13 ) { return FUNC_8( VAR_6, op, VAR_1, VAR_3, true, VAR_13, 0, 1 ); } /*----------------------------------------------------------------------------*/ static inline bl_err bl_mpmc_bpm_consume_prepare( CLASS_0* VAR_6, CLASS_4* op, bl_u8** VAR_1, CLASS_1* VAR_3 ) { return FUNC_8( VAR_6, op, VAR_1, VAR_3, false, 0, 0, 1 ); } /*----------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT VAR_11 bl_mpmc_bpm_consume_commit( CLASS_0* VAR_6, CLASS_4 op, bl_u8* VAR_1, CLASS_1 VAR_3 ); /*------------------------------------------------------------------------------ This queue can be used just as an allocator, but the underlying queue is the same so: -Deallocations must happen in a near-FIFO order (e.g. this queue could be the allocator of a linked list based MPxC queue). The producers (alloc callers) will be blocked when they find an allocated slot -When on extreme contention, the "alloc" calls with less slots will have more chances to finish that those that request less slots unless the fairness is activated. ------------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_u8* FUNC_10( CLASS_0* VAR_6, bl_uword VAR_3 ); /*--------------------------- ------------------------------------------------*/ extern BL_NONBLOCK_EXPORT VAR_11 bl_mpmc_bpm_dealloc( CLASS_0* VAR_6, bl_u8* VAR_1, bl_uword VAR_3 ); /*----------------------------------------------------------------------------*/ static inline void FUNC_11 (CLASS_0* VAR_6, bl_u8* VAR_1) { bl_mpmc_bpm_dealloc (VAR_6, VAR_1, 0); } /*----------------------------------------------------------------------------*/ static inline bool FUNC_12 (CLASS_0* VAR_6, bl_u8* VAR_1) { return (VAR_1 >= VAR_6->VAR_1) && (VAR_1 < (VAR_6->VAR_1 + (VAR_6->VAR_3 * VAR_6->slot_size))); } /*------------------------------------------------------------------------------ See bl_mpmc_b.h for documentation on these functions, they work exactly the same ------------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_err FUNC_13( CLASS_0* VAR_6, CLASS_5* VAR_15, CLASS_5 desired ); /*----------------------------------------------------------------------------- Same as the above but the last successful ticket has to match too. If the queue is unitialized the last successful ticket is uint_max; -----------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_err FUNC_14( CLASS_0* VAR_6, CLASS_6* VAR_15, CLASS_5 desired ); /*----------------------------------------------------------------------------- Same as above but for consumers. Can only be used on MPMC or SPMC mode -----------------------------------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_err FUNC_15( CLASS_0* VAR_6, CLASS_5* VAR_15, CLASS_5 desired ); /*--------------------------- ------------------------------------------------*/ extern BL_NONBLOCK_EXPORT bl_err FUNC_16( CLASS_0* VAR_6, CLASS_6* VAR_15, CLASS_5 desired ); /*--------------------------- ------------------------------------------------*/ #ifdef __cplusplus } /*extern "C" {*/ #endif #endif /* __BL_NONBLOCK_MPMC_BOUNDED_PRODUCER_MULTI_H__ */
0.58023
{'VAR_0': '__BL_NONBLOCK_MPMC_BOUNDED_PRODUCER_MULTISLOT_H__', 'IMPORT_0': 'bl/nonblock/libexport.h', 'IMPORT_1': 'bl/nonblock/mpmc_b_common.h', 'IMPORT_2': 'bl/base/platform.h', 'IMPORT_3': 'bl/base/cache.h', 'IMPORT_4': 'bl/base/alignment.h', 'IMPORT_5': 'bl/base/allocator.h', 'IMPORT_6': 'bl/base/error.h', 'CLASS_0': 'bl_mpmc_bpm', 'ID_0': 'bl_mpmc_bpm', 'VAR_1': 'mem', 'CLASS_1': 'bl_u32', 'VAR_2': 'bl_u32', 'VAR_3': 'slots', 'CLASS_2': 'bl_declare_cache_pad_member', 'CLASS_3': 'bl_atomic_u32', 'VAR_4': 'push_slot', 'VAR_5': 'pop_slot', 'FUNC_0': 'bl_mpmc_bpm_slot_size', 'VAR_6': 'q', 'FUNC_1': 'bl_mpmc_bpm_required_slots', 'VAR_7': 'payload', 'FUNC_2': 'bl_round_to_next_multiple', 'FUNC_3': 'bl_mpmc_bpm_init', 'VAR_8': 'alloc', 'VAR_9': 'slot_count', 'VAR_10': 'enable_fairness', 'VAR_11': 'void', 'FUNC_4': 'bl_mpmc_bpm_destroy', 'FUNC_5': 'bl_mpmc_bpm_produce_prepare_sig_fallback', 'CLASS_4': 'bl_mpmc_b_op', 'VAR_12': 'replace_sig', 'CLASS_5': 'bl_mpmc_b_sig', 'VAR_13': 'sig_replacement', 'VAR_14': 'sig_fallback_mask', 'FUNC_6': 'bl_mpmc_bpm_produce_prepare_fallback', 'FUNC_7': 'bl_mpmc_bpm_produce_prepare_sig', 'FUNC_8': 'bl_mpmc_bpm_consume_prepare_sig_fallback', 'FUNC_9': 'bl_mpmc_bpm_consume_prepare_sig', 'FUNC_10': 'bl_mpmc_bpm_alloc', 'FUNC_11': 'bl_mpmc_bpm_dealloc_unsafe', 'FUNC_12': 'bl_mpmc_bpm_allocation_is_in_range', 'FUNC_13': 'bl_mpmc_bpm_producer_signal_try_set', 'VAR_15': 'expected', 'FUNC_14': 'bl_mpmc_bpm_producer_signal_try_set_tmatch', 'CLASS_6': 'bl_mpmc_b_ticket', 'FUNC_15': 'bl_mpmc_bpm_consumer_signal_try_set', 'FUNC_16': 'bl_mpmc_bpm_consumer_signal_try_set_tmatch'}
#ifndef __MONO_NATIVE_MSCORLIB_SYSTEM_ISERVICEPROVIDER_H #define __MONO_NATIVE_MSCORLIB_SYSTEM_ISERVICEPROVIDER_H #include <mscorlib/System/mscorlib_System_Object.h> namespace mscorlib { namespace System { class Type; } } namespace mscorlib { namespace System { class IServiceProvider { public: IServiceProvider(MonoObject *nativeObject) { __mscorlib_System_IServiceProvider = nativeObject; }; ~IServiceProvider() { }; IServiceProvider & operator=(IServiceProvider &value) { __mscorlib_System_IServiceProvider = value.__mscorlib_System_IServiceProvider; return value; }; operator MonoObject*() { return __mscorlib_System_IServiceProvider; }; MonoObject* operator=(MonoObject* value) { __mscorlib_System_IServiceProvider = value; return value; }; virtual mscorlib::System::Object GetService(mscorlib::System::Type serviceType); protected: MonoObject *__mscorlib_System_IServiceProvider; private: }; } } #endif
#ifndef VAR_0 #define VAR_0 #include <IMPORT_0> namespace mscorlib { namespace VAR_1 { class Type; } } namespace mscorlib { namespace VAR_1 { class VAR_2 { public: FUNC_0(VAR_3 *nativeObject) { __mscorlib_System_IServiceProvider = nativeObject; }; ~FUNC_0() { }; VAR_2 & operator=(VAR_2 &VAR_4) { __mscorlib_System_IServiceProvider = VAR_4.__mscorlib_System_IServiceProvider; return VAR_4; }; operator VAR_3*() { return __mscorlib_System_IServiceProvider; }; CLASS_0* operator=(VAR_3* VAR_4) { __mscorlib_System_IServiceProvider = VAR_4; return VAR_4; }; CLASS_1 mscorlib::VAR_1::VAR_5 FUNC_1(mscorlib::VAR_1::Type serviceType); protected: VAR_3 *__mscorlib_System_IServiceProvider; private: }; } } #endif
0.648282
{'VAR_0': '__MONO_NATIVE_MSCORLIB_SYSTEM_ISERVICEPROVIDER_H', 'IMPORT_0': 'mscorlib/System/mscorlib_System_Object.h', 'VAR_1': 'System', 'VAR_2': 'IServiceProvider', 'FUNC_0': 'IServiceProvider', 'VAR_3': 'MonoObject', 'CLASS_0': 'MonoObject', 'VAR_4': 'value', 'CLASS_1': 'virtual', 'VAR_5': 'Object', 'FUNC_1': 'GetService'}
/** * Measure ADC voltage. * @param device Katherine device * @param channel_id Index of the measured ADC channel * @param voltage Retrieved voltage * @return Error code. */ int katherine_get_adc_voltage(katherine_device_t *device, unsigned char channel_id, float *voltage) { int res; res = katherine_cmd_get_adc_voltage(&device->control_socket, channel_id); if (res) goto err; char crd[8]; res = katherine_cmd_wait_ack_crd(&device->control_socket, crd); if (res) goto err; *voltage = *(float*) crd; return 0; err: return res; }
/** * Measure ADC voltage. * @param device Katherine device * @param channel_id Index of the measured ADC channel * @param voltage Retrieved voltage * @return Error code. */ int FUNC_0(CLASS_0 *device, unsigned char VAR_0, float *VAR_1) { int VAR_2; VAR_2 = FUNC_1(&device->control_socket, VAR_0); if (VAR_2) goto err; char VAR_3[8]; VAR_2 = katherine_cmd_wait_ack_crd(&device->control_socket, VAR_3); if (VAR_2) goto err; *VAR_1 = *(float*) VAR_3; return 0; err: return VAR_2; }
0.547557
{'FUNC_0': 'katherine_get_adc_voltage', 'CLASS_0': 'katherine_device_t', 'VAR_0': 'channel_id', 'VAR_1': 'voltage', 'VAR_2': 'res', 'FUNC_1': 'katherine_cmd_get_adc_voltage', 'VAR_3': 'crd'}
/** * @file registration.h * @author <NAME> <<EMAIL>> * @version 1.0 * * @section LICENSE * * The MIT License (MIT) * * Copyright (c) 2016 <NAME> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * @section DESCRIPTION * * Register benchmark in bmbs */ #ifndef _REGISTRATION_H_ #define _REGISTRATION_H_ #include <stdint.h> /** * Type definition of an benchmark entry function */ typedef void (*benchmark_entry)(void); /** * Struct of a benchmark registration * * This struct represents a executable benchmark. * The framework calls entry() when an execution is triggered */ typedef struct { char* name; /**< name of the benchmark */ uint8_t version_major; /**< major version number */ uint8_t version_minor; /**< minor version number */ benchmark_entry entry; /**< function that is called on execution */ } __attribute__((packed)) Benchmark; /** * Macro tu registe a benchmark * * This macro registers a benchmark in the system. * Only registregistered benchmarks are visible in bmbs * * @param _name name for this benchmark * @param _version_major major version number * @param _version_minor minor version number * @param _entry function that is called on execution */ #define BMBS_REGISTER_BENCHMARK(_name, _version_major, _version_minor, _entry) \ extern void _entry(void); \ volatile Benchmark const __benchmark_##_name __attribute__((section(".bmbs_benchmarks"))) = { \ .name = #_name, \ .version_major = _version_major, \ .version_minor = _version_minor, \ .entry = &_entry, \ }; extern uint8_t const bmbs_benchmark_count; //total number of registered benchmarks extern Benchmark const bmbs_benchmarks[]; //registered benchmarks #endif
/** * @file registration.h * @author <NAME> <<EMAIL>> * @version 1.0 * * @section LICENSE * * The MIT License (MIT) * * Copyright (c) 2016 <NAME> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * @section DESCRIPTION * * Register benchmark in bmbs */ #ifndef VAR_0 #define VAR_0 #include <stdint.h> /** * Type definition of an benchmark entry function */ typedef void (*benchmark_entry)(void); /** * Struct of a benchmark registration * * This struct represents a executable benchmark. * The framework calls entry() when an execution is triggered */ typedef struct { char* name; /**< name of the benchmark */ uint8_t version_major; /**< major version number */ uint8_t VAR_1; /**< minor version number */ benchmark_entry entry; /**< function that is called on execution */ } __attribute__((VAR_2)) Benchmark; /** * Macro tu registe a benchmark * * This macro registers a benchmark in the system. * Only registregistered benchmarks are visible in bmbs * * @param _name name for this benchmark * @param _version_major major version number * @param _version_minor minor version number * @param _entry function that is called on execution */ #define BMBS_REGISTER_BENCHMARK(_name, VAR_3, VAR_4, _entry) \ extern void _entry(void); \ volatile Benchmark const __benchmark_##_name __attribute__((section(".bmbs_benchmarks"))) = { \ .name = #_name, \ .version_major = _version_major, \ .version_minor = _version_minor, \ .entry = &_entry, \ }; extern uint8_t const bmbs_benchmark_count; //total number of registered benchmarks extern Benchmark const VAR_5[]; //registered benchmarks #endif
0.326424
{'VAR_0': '_REGISTRATION_H_', 'VAR_1': 'version_minor', 'VAR_2': 'packed', 'VAR_3': '_version_major', 'VAR_4': '_version_minor', 'VAR_5': 'bmbs_benchmarks'}
/** * This header is generated by class-dump-z 0.2a. * class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3. * * Source: (null) */ #import "WeChat-Structs.h" #import "IEmoticonPackageStateMgrExt.h" #import "IEmoticonPackageMgrExt.h" #import <XXUnknownSuperclass.h> // Unknown library @class UIImageView, EmotionProgressView, UIActivityIndicatorView, UIButton, EmoticonStoreItem; @protocol EmoticonStoreCellDelegate, EmoticonStoreDownloadViewDelegate; @interface EmoticonStoreDownloadView : XXUnknownSuperclass <IEmoticonPackageStateMgrExt, IEmoticonPackageMgrExt> { BOOL _m_freeToDownload; unsigned long _m_extrance; id<EmoticonStoreCellDelegate> _m_delegate; UIImageView* _m_downloadedView; UIButton* _m_button; UIButton* _m_downloadButton; UIButton* _m_downloadedButton; EmotionProgressView* _m_progressView; UIActivityIndicatorView* _m_activityIndicatorView; int _m_scene; int _m_type; int _type; id<EmoticonStoreDownloadViewDelegate> _delegate; EmoticonStoreItem* _m_storeItem; } @property(assign, nonatomic) BOOL m_freeToDownload; @property(retain, nonatomic) EmoticonStoreItem* m_storeItem; @property(assign, nonatomic) __weak id<EmoticonStoreDownloadViewDelegate> delegate; @property(assign, nonatomic) int type; @property(assign, nonatomic) int m_type; @property(assign, nonatomic) int m_scene; @property(retain, nonatomic) UIActivityIndicatorView* m_activityIndicatorView; @property(retain, nonatomic) EmotionProgressView* m_progressView; @property(retain, nonatomic) UIButton* m_downloadedButton; @property(retain, nonatomic) UIButton* m_downloadButton; @property(retain, nonatomic) UIButton* m_button; @property(retain, nonatomic) UIImageView* m_downloadedView; @property(assign, nonatomic) __weak id<EmoticonStoreCellDelegate> m_delegate; @property(assign, nonatomic) unsigned long m_extrance; -(void).cxx_destruct; -(void)OnEmoticonPackageDownloadStatusChanged:(id)changed IsDownloaded:(BOOL)downloaded; -(void)OnBuyItemCancel:(id)cancel; -(void)OnBuyItemFailed:(id)failed; -(void)OnBuyItemSuccess:(id)success; -(void)OnDownloadProgressChanged:(id)changed CurrLength:(unsigned)length TotalLength:(unsigned)length3; -(void)OnUpdateEmoticonPackageState:(id)state toState:(int)state2; -(void)checkEmoticonBuyRet:(int)ret; -(void)onClickButton; -(void)onClickDownloadButton; -(void)onState:(int)state; -(void)updateStoreItem:(id)item; -(id)getChannelButton; -(void)initChannelButton; -(void)initDownloadProgressView; -(void)initDownloadButton; -(void)initStateButton; -(void)initDownloadedView; -(void)layoutSubviews; -(void)loadSubView; -(id)initWithFrame:(CGRect)frame; -(void)dealloc; @end
/** * This header is generated by class-dump-z 0.2a. * class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3. * * Source: (null) */ #import "WeChat-Structs.h" #import "IEmoticonPackageStateMgrExt.h" #import "IEmoticonPackageMgrExt.h" #import <XXUnknownSuperclass.h> // Unknown library @class VAR_0, EmotionProgressView, UIActivityIndicatorView, UIButton, VAR_1; @CLASS_2 EmoticonStoreCellDelegate, VAR_2; @interface EmoticonStoreDownloadView : VAR_3 <IEmoticonPackageStateMgrExt, IEmoticonPackageMgrExt> { BOOL VAR_4; unsigned long _m_extrance; id<EmoticonStoreCellDelegate> _m_delegate; CLASS_0* _m_downloadedView; UIButton* VAR_5; UIButton* VAR_6; UIButton* VAR_7; EmotionProgressView* VAR_8; UIActivityIndicatorView* _m_activityIndicatorView; int VAR_9; int _m_type; int _type; id<VAR_2> VAR_10; CLASS_1* _m_storeItem; } @FUNC_0(assign, nonatomic) BOOL VAR_11; @FUNC_0(retain, nonatomic) CLASS_1* VAR_12; @FUNC_0(assign, nonatomic) VAR_13 id<VAR_2> delegate; @FUNC_0(assign, nonatomic) VAR_14 type; @FUNC_0(assign, nonatomic) VAR_14 VAR_15; @FUNC_0(assign, nonatomic) VAR_14 m_scene; @FUNC_0(retain, nonatomic) UIActivityIndicatorView* m_activityIndicatorView; @FUNC_0(retain, nonatomic) EmotionProgressView* m_progressView; @FUNC_0(retain, nonatomic) UIButton* m_downloadedButton; @FUNC_0(retain, nonatomic) UIButton* m_downloadButton; @FUNC_0(retain, nonatomic) UIButton* VAR_16; @FUNC_0(retain, nonatomic) CLASS_0* VAR_17; @FUNC_0(assign, nonatomic) VAR_13 id<EmoticonStoreCellDelegate> m_delegate; @FUNC_0(assign, nonatomic) unsigned long VAR_18; -(void).VAR_19; -(void)OnEmoticonPackageDownloadStatusChanged:(id)CLASS_3 IsDownloaded:(BOOL)downloaded; -(void)VAR_20:(id)cancel; -(void)OnBuyItemFailed:(id)failed; -(void)OnBuyItemSuccess:(id)VAR_21; -(void)OnDownloadProgressChanged:(id)CLASS_3 CurrLength:(unsigned)VAR_22 TotalLength:(unsigned)VAR_23; -(void)OnUpdateEmoticonPackageState:(id)CLASS_4 toState:(int)VAR_25; -(void)checkEmoticonBuyRet:(int)VAR_26; -(void)onClickButton; -(void)VAR_27; -(void)VAR_28:(int)VAR_24; -(void)updateStoreItem:(id)item; -(id)getChannelButton; -(void)VAR_29; -(void)VAR_30; -(void)initDownloadButton; -(void)initStateButton; -(void)initDownloadedView; -(void)VAR_31; -(void)VAR_32; -(id)VAR_33:(CGRect)VAR_34; -(void)dealloc; @end
0.421423
{'VAR_0': 'UIImageView', 'CLASS_0': 'UIImageView', 'VAR_1': 'EmoticonStoreItem', 'CLASS_1': 'EmoticonStoreItem', 'CLASS_2': 'protocol', 'VAR_2': 'EmoticonStoreDownloadViewDelegate', 'VAR_3': 'XXUnknownSuperclass', 'VAR_4': '_m_freeToDownload', 'VAR_5': '_m_button', 'VAR_6': '_m_downloadButton', 'VAR_7': '_m_downloadedButton', 'VAR_8': '_m_progressView', 'VAR_9': '_m_scene', 'VAR_10': '_delegate', 'FUNC_0': 'property', 'VAR_11': 'm_freeToDownload', 'VAR_12': 'm_storeItem', 'VAR_13': '__weak', 'VAR_14': 'int', 'VAR_15': 'm_type', 'VAR_16': 'm_button', 'VAR_17': 'm_downloadedView', 'VAR_18': 'm_extrance', 'VAR_19': 'cxx_destruct', 'CLASS_3': 'changed', 'VAR_20': 'OnBuyItemCancel', 'VAR_21': 'success', 'VAR_22': 'length', 'VAR_23': 'length3', 'CLASS_4': 'state', 'VAR_24': 'state', 'VAR_25': 'state2', 'VAR_26': 'ret', 'VAR_27': 'onClickDownloadButton', 'VAR_28': 'onState', 'VAR_29': 'initChannelButton', 'VAR_30': 'initDownloadProgressView', 'VAR_31': 'layoutSubviews', 'VAR_32': 'loadSubView', 'VAR_33': 'initWithFrame', 'VAR_34': 'frame'}
// // MPRewardedVideoReward.h // // Copyright 2018-2020 Twitter, Inc. // Licensed under the MoPub SDK License Agreement // http://www.mopub.com/legal/sdk-license-agreement/ // #import <Foundation/Foundation.h> #import "MPReward.h" /** A constant that indicates that no currency type was specified with the reward. */ extern NSString *const kMPRewardedVideoRewardCurrencyTypeUnspecified __deprecated_msg("Use `kMPRewardCurrencyTypeUnspecified` instead."); /** A constant that indicates that no currency amount was specified with the reward. */ extern NSInteger const kMPRewardedVideoRewardCurrencyAmountUnspecified __deprecated_msg("Use `kMPRewardCurrencyAmountUnspecified` instead."); /** @c MPRewardedVideoReward is about to be deprecated after the public API @c MPRewardedVideo is updated to use @c MPReward instead. Internally in the SDK, use Use `MPReward` instead. `MPRewardedVideoReward` contains all the information needed to reward the user for watching a rewarded video ad. The class provides a currency amount and currency type. */ @interface MPRewardedVideoReward : MPReward + (MPRewardedVideoReward *)rewardWithReward:(MPReward *)reward; @end
// // MPRewardedVideoReward.h // // Copyright 2018-2020 Twitter, Inc. // Licensed under the MoPub SDK License Agreement // http://www.mopub.com/legal/sdk-license-agreement/ // #import <Foundation/Foundation.h> #import "MPReward.h" /** A constant that indicates that no currency type was specified with the reward. */ extern CLASS_0 *const VAR_0 __deprecated_msg("Use `kMPRewardCurrencyTypeUnspecified` instead."); /** A constant that indicates that no currency amount was specified with the reward. */ extern NSInteger const kMPRewardedVideoRewardCurrencyAmountUnspecified __deprecated_msg("Use `kMPRewardCurrencyAmountUnspecified` instead."); /** @c MPRewardedVideoReward is about to be deprecated after the public API @c MPRewardedVideo is updated to use @c MPReward instead. Internally in the SDK, use Use `MPReward` instead. `MPRewardedVideoReward` contains all the information needed to reward the user for watching a rewarded video ad. The class provides a currency amount and currency type. */ @interface MPRewardedVideoReward : MPReward + (MPRewardedVideoReward *)rewardWithReward:(MPReward *)reward; @end
0.352082
{'CLASS_0': 'NSString', 'VAR_0': 'kMPRewardedVideoRewardCurrencyTypeUnspecified'}
#ifndef ___NICE_KCPSERVER____ #define ___NICE_KCPSERVER____ #include <string> #include "Type.h" #include <memory> #include "Server.h" #include <unordered_map> #include <array> #include <list> #include <atomic> #include "Message.h" #include "NoCopy.h" #include <functional> #include "CopyablePtr.hpp" #include "Task.hpp" namespace nicehero { const i32 IKCP_OVERHEAD = 89; const i32 INVALID_CONV = (~0); class KcpSession; using kcpuid = std::string; using KcpTask = Task<bool,TO_MAIN>; using KcpSessionPtr = std::shared_ptr<KcpSession>; using MessagePtr = CopyablePtr<Message>; using kcpcommand = KcpTask(*)(KcpSessionPtr, MessagePtr); class KcpServer; class KcpSessionImpl; class KcpServerImpl; class KcpMessageParser { public: kcpcommand m_commands[65536] = {nullptr}; }; class KcpSessionCommand { public: KcpSessionCommand(const std::type_info & info, ui16 command, kcpcommand fucnc ); }; class KcpSession :public NoCopy,public std::enable_shared_from_this<KcpSession> { friend class KcpSessionImpl; friend class KcpSessionS; friend class KcpServer; friend class KcpServerImpl; public: KcpSession(); virtual void init(); virtual void init(KcpServer& server); virtual void init2(KcpServer& server); virtual void init3(KcpServer& server); virtual void close(); virtual void setMessageParser(KcpMessageParser* messageParser); virtual void sendMessage(Message& msg,bool pureUdp = false); virtual void sendMessage(Serializable& msg, bool pureUdp = false); KcpMessageParser* m_MessageParser = nullptr; kcpuid& getUid(); protected: void init_kcp(); std::unique_ptr<KcpSessionImpl> m_impl; std::string m_hash; kcpuid m_uid; ui32 m_conv = INVALID_CONV; ui64 m_serialID; Message m_PreMsg; bool parseMsg(unsigned char* data, ui32 len); virtual void removeSelf(); virtual void removeSelfImpl(); void doPing(); virtual void doRead(); void doSend(Message& msg, bool pureUdp); std::atomic_bool m_IsSending; std::list<Message> m_SendList; virtual void handleMessage(MessagePtr msg); bool m_Ready = true; std::atomic_bool m_closed; private: ui64 m_lastPingTime = 0; ui64 m_lastPongTime = 0; }; class KcpSessionS :public KcpSession { friend class KcpServer; friend class KcpSessionImpl; friend class KcpServerImpl; public: KcpSessionS(); virtual ~KcpSessionS(); void init(KcpServer& server); void init2(KcpServer& server); void init3(KcpServer& server); void close(); protected: KcpServer* m_KcpServer = nullptr; void removeSelf(); void removeSelfImpl(); void doRead()final; private: std::atomic_bool m_waitRemove; }; class KcpSessionC :public KcpSession,public Server { public: KcpSessionC(); virtual ~KcpSessionC(); bool connect(const std::string& ip, ui16 port); void init(bool isAsync = false); void startRead(); std::atomic<bool> m_isInit; protected: void doRead()final; void removeSelf(); private: int checkServerSign(ui8* data_);//return 0 ok 1 error 2 warning std::shared_ptr<std::string> m_buffer; void startRead2(); std::atomic<bool> m_isStartRead2; }; class KcpServer :public Server { friend class KcpSession; friend class KcpSessionS; public: KcpServer(const std::string& ip,ui16 port ); virtual ~KcpServer(); std::unique_ptr<KcpServerImpl> m_impl; bool m_Started = false; virtual KcpSessionS* createSession(); virtual void addSession(const kcpuid& uid, KcpSessionPtr session); virtual void removeSession(const kcpuid& uid,ui64 serialID); virtual void accept(); std::unordered_map<kcpuid, std::shared_ptr<KcpSession> > m_sessions; ui32 getFreeUid(); ui32 m_maxSessions = 10000; ui32 m_nextConv = 1; }; KcpMessageParser& getKcpMessagerParse(const std::type_info& typeInfo); inline KcpSessionCommand::KcpSessionCommand(const std::type_info & info, ui16 command, kcpcommand func ) { KcpMessageParser& msgParser = getKcpMessagerParse(info); msgParser.m_commands[command] = func; } } #define KCP_SESSION_COMMAND(CLASS,COMMAND) \ static nicehero::KcpTask _##CLASS##_##COMMAND##FUNC(nicehero::KcpSessionPtr session,nicehero::MessagePtr msg); \ static nicehero::KcpSessionCommand _##CLASS##_##COMMAND(typeid(CLASS), COMMAND, _##CLASS##_##COMMAND##FUNC);\ static nicehero::KcpTask _##CLASS##_##COMMAND##FUNC(nicehero::KcpSessionPtr session,nicehero::MessagePtr msg) #ifndef SESSION_COMMAND #define SESSION_COMMAND KCP_SESSION_COMMAND #endif #endif
#ifndef VAR_0 #define VAR_0 #include <IMPORT_0> #include "Type.h" #include <IMPORT_1> #include "IMPORT_2" #include <unordered_map> #include <IMPORT_3> #include <list> #include <IMPORT_4> #include "IMPORT_5" #include "NoCopy.h" #include <IMPORT_6> #include "IMPORT_7" #include "IMPORT_8" CLASS_0 VAR_1 { const i32 VAR_2 = 89; const i32 VAR_3 = (~0); class VAR_4; CLASS_1 VAR_5 = std::IMPORT_0; CLASS_1 VAR_6 = VAR_7<VAR_8,VAR_9>; CLASS_1 VAR_10 = std::shared_ptr<VAR_4>; CLASS_1 VAR_11 = VAR_12<Message>; CLASS_1 VAR_13 = FUNC_1(*)(VAR_10, VAR_11); class VAR_14; class KcpSessionImpl; class VAR_15; class VAR_16 { public: VAR_13 VAR_18[65536] = {nullptr}; }; class KcpSessionCommand { public: KcpSessionCommand(const std::type_info & VAR_19, VAR_20 command, VAR_13 VAR_21 ); }; class VAR_4 :VAR_17 NoCopy,VAR_17 std::VAR_22<VAR_4> { CLASS_9 class KcpSessionImpl; CLASS_9 class KcpSessionS; CLASS_9 class VAR_14; CLASS_9 class VAR_15; public: FUNC_0(); virtual void FUNC_3(); virtual void FUNC_3(VAR_14& VAR_23); virtual void init2(VAR_14& VAR_23); virtual void FUNC_4(VAR_14& VAR_23); virtual void FUNC_5(); virtual void FUNC_6(CLASS_7* messageParser); virtual void FUNC_7(Message& VAR_24,VAR_8 pureUdp = false); virtual void FUNC_7(VAR_25& VAR_24, VAR_8 pureUdp = false); CLASS_7* m_MessageParser = nullptr; VAR_5& FUNC_8(); protected: void FUNC_9(); std::VAR_26<KcpSessionImpl> VAR_27; std::IMPORT_0 m_hash; CLASS_2 m_uid; ui32 VAR_28 = VAR_3; CLASS_10 m_serialID; Message m_PreMsg; bool parseMsg(unsigned char* data, ui32 VAR_30); virtual void removeSelf(); virtual void FUNC_10(); void doPing(); virtual void doRead(); void FUNC_11(Message& VAR_24, bool pureUdp); std::atomic_bool m_IsSending; std::list<Message> m_SendList; virtual void FUNC_12(CLASS_4 VAR_24); bool VAR_31 = true; std::atomic_bool VAR_32; private: VAR_29 VAR_33 = 0; CLASS_10 VAR_34 = 0; }; class KcpSessionS :VAR_17 VAR_4 { CLASS_9 class VAR_14; CLASS_9 class KcpSessionImpl; CLASS_9 class VAR_15; public: KcpSessionS(); virtual ~KcpSessionS(); void FUNC_3(CLASS_6& VAR_23); void init2(CLASS_6& VAR_23); void FUNC_4(CLASS_6& VAR_23); void FUNC_5(); protected: VAR_14* VAR_35 = nullptr; void removeSelf(); void FUNC_10(); void doRead()final; private: std::atomic_bool m_waitRemove; }; class KcpSessionC :VAR_17 VAR_4,VAR_17 Server { public: KcpSessionC(); virtual ~KcpSessionC(); bool FUNC_13(const std::IMPORT_0& ip, CLASS_8 port); void FUNC_3(bool isAsync = false); void startRead(); std::IMPORT_4<VAR_8> VAR_36; protected: void doRead()final; void removeSelf(); private: int checkServerSign(ui8* VAR_37);//return 0 ok 1 error 2 warning std::shared_ptr<std::IMPORT_0> m_buffer; void FUNC_14(); std::IMPORT_4<VAR_8> VAR_38; }; class VAR_14 :VAR_17 Server { CLASS_9 class VAR_4; CLASS_9 class KcpSessionS; public: FUNC_2(const std::IMPORT_0& ip,VAR_20 port ); virtual ~FUNC_2(); std::VAR_26<VAR_15> VAR_27; bool VAR_39 = false; virtual KcpSessionS* createSession(); virtual void FUNC_15(const CLASS_2& VAR_40, CLASS_3 VAR_41); virtual void FUNC_16(const CLASS_2& VAR_40,CLASS_10 VAR_42); virtual void FUNC_17(); std::unordered_map<VAR_5, std::shared_ptr<VAR_4> > m_sessions; ui32 FUNC_18(); ui32 m_maxSessions = 10000; ui32 m_nextConv = 1; }; VAR_16& FUNC_19(const std::type_info& VAR_43); inline KcpSessionCommand::KcpSessionCommand(const std::type_info & VAR_19, CLASS_8 command, CLASS_5 VAR_44 ) { VAR_16& VAR_45 = FUNC_19(VAR_19); VAR_45.VAR_18[command] = VAR_44; } } #define FUNC_20(VAR_46,COMMAND) \ static nicehero::KcpTask _##CLASS##_##COMMAND##FUNC(nicehero::KcpSessionPtr session,nicehero::MessagePtr msg); \ static nicehero::KcpSessionCommand _##CLASS##_##COMMAND(typeid(CLASS), COMMAND, _##CLASS##_##COMMAND##FUNC);\ static nicehero::KcpTask _##CLASS##_##COMMAND##FUNC(nicehero::KcpSessionPtr session,nicehero::MessagePtr msg) #ifndef VAR_47 #define VAR_47 KCP_SESSION_COMMAND #endif #endif
0.575331
{'VAR_0': '___NICE_KCPSERVER____', 'IMPORT_0': 'string', 'IMPORT_1': 'memory', 'IMPORT_2': 'Server.h', 'IMPORT_3': 'array', 'IMPORT_4': 'atomic', 'IMPORT_5': 'Message.h', 'IMPORT_6': 'functional', 'IMPORT_7': 'CopyablePtr.hpp', 'IMPORT_8': 'Task.hpp', 'CLASS_0': 'namespace', 'VAR_1': 'nicehero', 'VAR_2': 'IKCP_OVERHEAD', 'VAR_3': 'INVALID_CONV', 'VAR_4': 'KcpSession', 'FUNC_0': 'KcpSession', 'CLASS_1': 'using', 'VAR_5': 'kcpuid', 'CLASS_2': 'kcpuid', 'VAR_6': 'KcpTask', 'FUNC_1': 'KcpTask', 'VAR_7': 'Task', 'VAR_8': 'bool', 'VAR_9': 'TO_MAIN', 'VAR_10': 'KcpSessionPtr', 'CLASS_3': 'KcpSessionPtr', 'VAR_11': 'MessagePtr', 'CLASS_4': 'MessagePtr', 'VAR_12': 'CopyablePtr', 'VAR_13': 'kcpcommand', 'CLASS_5': 'kcpcommand', 'VAR_14': 'KcpServer', 'CLASS_6': 'KcpServer', 'FUNC_2': 'KcpServer', 'VAR_15': 'KcpServerImpl', 'VAR_16': 'KcpMessageParser', 'CLASS_7': 'KcpMessageParser', 'VAR_17': 'public', 'VAR_18': 'm_commands', 'VAR_19': 'info', 'VAR_20': 'ui16', 'CLASS_8': 'ui16', 'VAR_21': 'fucnc', 'VAR_22': 'enable_shared_from_this', 'CLASS_9': 'friend', 'FUNC_3': 'init', 'VAR_23': 'server', 'FUNC_4': 'init3', 'FUNC_5': 'close', 'FUNC_6': 'setMessageParser', 'FUNC_7': 'sendMessage', 'VAR_24': 'msg', 'VAR_25': 'Serializable', 'FUNC_8': 'getUid', 'FUNC_9': 'init_kcp', 'VAR_26': 'unique_ptr', 'VAR_27': 'm_impl', 'VAR_28': 'm_conv', 'CLASS_10': 'ui64', 'VAR_29': 'ui64', 'VAR_30': 'len', 'FUNC_10': 'removeSelfImpl', 'FUNC_11': 'doSend', 'FUNC_12': 'handleMessage', 'VAR_31': 'm_Ready', 'VAR_32': 'm_closed', 'VAR_33': 'm_lastPingTime', 'VAR_34': 'm_lastPongTime', 'VAR_35': 'm_KcpServer', 'FUNC_13': 'connect', 'VAR_36': 'm_isInit', 'VAR_37': 'data_', 'FUNC_14': 'startRead2', 'VAR_38': 'm_isStartRead2', 'VAR_39': 'm_Started', 'FUNC_15': 'addSession', 'VAR_40': 'uid', 'VAR_41': 'session', 'FUNC_16': 'removeSession', 'VAR_42': 'serialID', 'FUNC_17': 'accept', 'FUNC_18': 'getFreeUid', 'FUNC_19': 'getKcpMessagerParse', 'VAR_43': 'typeInfo', 'VAR_44': 'func', 'VAR_45': 'msgParser', 'FUNC_20': 'KCP_SESSION_COMMAND', 'VAR_46': 'CLASS', 'VAR_47': 'SESSION_COMMAND'}
/* * Copyright (c) 2015 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <zephyr.h> #include <atomic.h> #include <tc_util.h> #define CHECK_OUTPUT(expr, val) do { \ atomic_val_t x = (expr); \ if (x != (val)) { \ failed++; \ TC_ERROR(#expr" != " #val " got %d\n", x); \ } \ } while (0) #define CHECK_TRUTH(expr, val) CHECK_OUTPUT(!!(expr), !!(val)) void main(void) { int failed, rv, i; atomic_t target, orig; atomic_val_t value; atomic_val_t oldvalue; failed = 0; TC_START("Test atomic operation primitives"); TC_PRINT("Test atomic_cas()\n"); target = 4; value = 5; oldvalue = 6; CHECK_OUTPUT(atomic_cas(&target, oldvalue, value), 0); target = 6; CHECK_OUTPUT(atomic_cas(&target, oldvalue, value), 1); CHECK_OUTPUT(target, value); TC_PRINT("Test atomic_add()\n"); target = 1; value = 2; CHECK_OUTPUT(atomic_add(&target, value), 1); CHECK_OUTPUT(target, 3); TC_PRINT("Test atomic_sub()\n"); target = 10; value = 2; CHECK_OUTPUT(atomic_sub(&target, value), 10); CHECK_OUTPUT(target, 8); TC_PRINT("Test atomic_inc()\n"); target = 5; CHECK_OUTPUT(atomic_inc(&target), 5); CHECK_OUTPUT(target, 6); TC_PRINT("Test atomic_dec()\n"); target = 2; CHECK_OUTPUT(atomic_dec(&target), 2); CHECK_OUTPUT(target, 1); TC_PRINT("Test atomic_get()\n"); target = 50; CHECK_OUTPUT(atomic_get(&target), 50); TC_PRINT("Test atomic_set()\n"); target = 42; value = 77; CHECK_OUTPUT(atomic_set(&target, value), 42); CHECK_OUTPUT(target, value); TC_PRINT("Test atomic_clear()\n"); target = 100; CHECK_OUTPUT(atomic_clear(&target), 100); CHECK_OUTPUT(target, 0); TC_PRINT("Test atomic_or()\n"); target = 0xFF00; value = 0x0F0F; CHECK_OUTPUT(atomic_or(&target, value), 0xFF00); CHECK_OUTPUT(target, 0xFF0F); TC_PRINT("Test atomic_xor()\n"); target = 0xFF00; value = 0x0F0F; CHECK_OUTPUT(atomic_xor(&target, value), 0xFF00); CHECK_OUTPUT(target, 0xF00F); TC_PRINT("Test atomic_and()\n"); target = 0xFF00; value = 0x0F0F; CHECK_OUTPUT(atomic_and(&target, value), 0xFF00); CHECK_OUTPUT(target, 0x0F00); TC_PRINT("Test atomic_nand()\n"); target = 0xFF00; value = 0x0F0F; CHECK_OUTPUT(atomic_nand(&target, value), 0xFF00); CHECK_OUTPUT(target, 0xFFFFF0FF); TC_PRINT("Test atomic_test_bit()\n"); for (i = 0; i < 32; i++) { target = 0x0F0F0F0F; CHECK_TRUTH(atomic_test_bit(&target, i), (target & (1 << i))); } TC_PRINT("Test atomic_test_and_clear_bit()\n"); for (i = 0; i < 32; i++) { orig = 0x0F0F0F0F; target = orig; CHECK_TRUTH(atomic_test_and_clear_bit(&target, i), (orig & (1 << i))); CHECK_OUTPUT(target, orig & ~(1 << i)); } TC_PRINT("Test atomic_test_and_set_bit()\n"); for (i = 0; i < 32; i++) { orig = 0x0F0F0F0F; target = orig; CHECK_TRUTH(atomic_test_and_set_bit(&target, i), (orig & (1 << i))); CHECK_OUTPUT(target, orig | (1 << i)); } TC_PRINT("Test atomic_clear_bit()\n"); for (i = 0; i < 32; i++) { orig = 0x0F0F0F0F; target = orig; atomic_clear_bit(&target, i); CHECK_OUTPUT(target, orig & ~(1 << i)); } TC_PRINT("Test atomic_set_bit()\n"); for (i = 0; i < 32; i++) { orig = 0x0F0F0F0F; target = orig; atomic_set_bit(&target, i); CHECK_OUTPUT(target, orig | (1 << i)); } if (failed) { TC_PRINT("%d tests failed\n", failed); rv = TC_FAIL; } else { rv = TC_PASS; } TC_END_RESULT(rv); TC_END_REPORT(rv); }
/* * Copyright (c) 2015 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <IMPORT_0> #include <atomic.h> #include <tc_util.h> #define FUNC_0(expr, val) do { \ atomic_val_t x = (expr); \ if (x != (val)) { \ failed++; \ TC_ERROR(#expr" != " #val " got %d\n", x); \ } \ } while (0) #define CHECK_TRUTH(expr, val) CHECK_OUTPUT(!!(expr), !!(val)) void main(void) { int VAR_0, rv, i; atomic_t target, orig; CLASS_0 VAR_1; CLASS_0 oldvalue; VAR_0 = 0; TC_START("Test atomic operation primitives"); FUNC_1("Test atomic_cas()\n"); target = 4; VAR_1 = 5; oldvalue = 6; FUNC_0(atomic_cas(&target, oldvalue, VAR_1), 0); target = 6; FUNC_0(atomic_cas(&target, oldvalue, VAR_1), 1); FUNC_0(target, VAR_1); FUNC_1("Test atomic_add()\n"); target = 1; VAR_1 = 2; FUNC_0(atomic_add(&target, VAR_1), 1); FUNC_0(target, 3); FUNC_1("Test atomic_sub()\n"); target = 10; VAR_1 = 2; FUNC_0(atomic_sub(&target, VAR_1), 10); FUNC_0(target, 8); FUNC_1("Test atomic_inc()\n"); target = 5; FUNC_0(atomic_inc(&target), 5); FUNC_0(target, 6); FUNC_1("Test atomic_dec()\n"); target = 2; FUNC_0(atomic_dec(&target), 2); FUNC_0(target, 1); FUNC_1("Test atomic_get()\n"); target = 50; FUNC_0(atomic_get(&target), 50); FUNC_1("Test atomic_set()\n"); target = 42; VAR_1 = 77; FUNC_0(atomic_set(&target, VAR_1), 42); FUNC_0(target, VAR_1); FUNC_1("Test atomic_clear()\n"); target = 100; FUNC_0(atomic_clear(&target), 100); FUNC_0(target, 0); FUNC_1("Test atomic_or()\n"); target = 0xFF00; VAR_1 = 0x0F0F; FUNC_0(atomic_or(&target, VAR_1), 0xFF00); FUNC_0(target, 0xFF0F); FUNC_1("Test atomic_xor()\n"); target = 0xFF00; VAR_1 = 0x0F0F; FUNC_0(atomic_xor(&target, VAR_1), 0xFF00); FUNC_0(target, 0xF00F); FUNC_1("Test atomic_and()\n"); target = 0xFF00; VAR_1 = 0x0F0F; FUNC_0(atomic_and(&target, VAR_1), 0xFF00); FUNC_0(target, 0x0F00); FUNC_1("Test atomic_nand()\n"); target = 0xFF00; VAR_1 = 0x0F0F; FUNC_0(FUNC_2(&target, VAR_1), 0xFF00); FUNC_0(target, 0xFFFFF0FF); FUNC_1("Test atomic_test_bit()\n"); for (i = 0; i < 32; i++) { target = 0x0F0F0F0F; CHECK_TRUTH(atomic_test_bit(&target, i), (target & (1 << i))); } FUNC_1("Test atomic_test_and_clear_bit()\n"); for (i = 0; i < 32; i++) { orig = 0x0F0F0F0F; target = orig; CHECK_TRUTH(atomic_test_and_clear_bit(&target, i), (orig & (1 << i))); FUNC_0(target, orig & ~(1 << i)); } FUNC_1("Test atomic_test_and_set_bit()\n"); for (i = 0; i < 32; i++) { orig = 0x0F0F0F0F; target = orig; CHECK_TRUTH(FUNC_3(&target, i), (orig & (1 << i))); FUNC_0(target, orig | (1 << i)); } FUNC_1("Test atomic_clear_bit()\n"); for (i = 0; i < 32; i++) { orig = 0x0F0F0F0F; target = orig; atomic_clear_bit(&target, i); FUNC_0(target, orig & ~(1 << i)); } FUNC_1("Test atomic_set_bit()\n"); for (i = 0; i < 32; i++) { orig = 0x0F0F0F0F; target = orig; atomic_set_bit(&target, i); FUNC_0(target, orig | (1 << i)); } if (VAR_0) { FUNC_1("%d tests failed\n", VAR_0); rv = VAR_2; } else { rv = TC_PASS; } FUNC_4(rv); FUNC_5(rv); }
0.294439
{'IMPORT_0': 'zephyr.h', 'FUNC_0': 'CHECK_OUTPUT', 'VAR_0': 'failed', 'CLASS_0': 'atomic_val_t', 'VAR_1': 'value', 'FUNC_1': 'TC_PRINT', 'FUNC_2': 'atomic_nand', 'FUNC_3': 'atomic_test_and_set_bit', 'VAR_2': 'TC_FAIL', 'FUNC_4': 'TC_END_RESULT', 'FUNC_5': 'TC_END_REPORT'}
// // Copyright 2015, <NAME> <<EMAIL>> // // This file is free software: you may copy, redistribute 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 file 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 "uat.h" #include "uat_decode.h" #include "reader.h" void handle_frame(frame_type_t type, uint8_t *frame, int len, void *extra) { if (type == UAT_DOWNLINK) { struct uat_adsb_mdb mdb; uat_decode_adsb_mdb(frame, &mdb); uat_display_adsb_mdb(&mdb, stdout); } else { struct uat_uplink_mdb mdb; uat_decode_uplink_mdb(frame, &mdb); uat_display_uplink_mdb(&mdb, stdout); } fprintf(stdout, "\n"); fflush(stdout); } int main(int argc, char **argv) { struct dump978_reader *reader; int framecount; reader = dump978_reader_new(0,0); if (!reader) { perror("dump978_reader_new"); return 1; } while ((framecount = dump978_read_frames(reader, handle_frame, NULL)) > 0) ; if (framecount < 0) { perror("dump978_read_frames"); return 1; } return 0; }
// // Copyright 2015, <NAME> <<EMAIL>> // // This file is free software: you may copy, redistribute 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 file 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 "uat.h" #include "uat_decode.h" #include "reader.h" void handle_frame(frame_type_t type, uint8_t *frame, int len, void *extra) { if (type == UAT_DOWNLINK) { struct uat_adsb_mdb mdb; uat_decode_adsb_mdb(frame, &mdb); uat_display_adsb_mdb(&mdb, stdout); } else { struct uat_uplink_mdb mdb; uat_decode_uplink_mdb(frame, &mdb); uat_display_uplink_mdb(&mdb, stdout); } fprintf(stdout, "\n"); fflush(stdout); } int main(int argc, char **argv) { struct dump978_reader *reader; int framecount; reader = dump978_reader_new(0,0); if (!reader) { perror("dump978_reader_new"); return 1; } while ((framecount = dump978_read_frames(reader, handle_frame, NULL)) > 0) ; if (framecount < 0) { perror("dump978_read_frames"); return 1; } return 0; }
0.041113
{}
/******************************************************************************** ** Form generated from reading UI file 'mt_visionui.ui' ** ** Created by: Qt User Interface Compiler version 5.13.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_MT_VISIONUI_H #define UI_MT_VISIONUI_H #include <QtCore/QVariant> #include <QtWidgets/QApplication> #include <QtWidgets/QCheckBox> #include <QtWidgets/QGroupBox> #include <QtWidgets/QHBoxLayout> #include <QtWidgets/QLabel> #include <QtWidgets/QLineEdit> #include <QtWidgets/QMainWindow> #include <QtWidgets/QPushButton> #include <QtWidgets/QSpacerItem> #include <QtWidgets/QSpinBox> #include <QtWidgets/QVBoxLayout> #include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE class Ui_MT_VisionUI { public: QWidget *centralWidget; QVBoxLayout *verticalLayout_3; QHBoxLayout *horizontalLayout; QLabel *label; QSpinBox *devIdSB; QSpacerItem *horizontalSpacer_2; QHBoxLayout *horizontalLayout_2; QLabel *label_2; QSpinBox *clientIdSB; QSpacerItem *horizontalSpacer_3; QSpacerItem *verticalSpacer; QHBoxLayout *horizontalLayout_9; QGroupBox *groupBox; QVBoxLayout *verticalLayout; QHBoxLayout *horizontalLayout_3; QLabel *label_3; QSpinBox *roiLSB; QHBoxLayout *horizontalLayout_4; QLabel *label_4; QSpinBox *roiRSB; QHBoxLayout *horizontalLayout_5; QLabel *label_5; QSpinBox *roiTSB; QHBoxLayout *horizontalLayout_6; QLabel *label_6; QSpinBox *roiBSB; QGroupBox *groupBox_2; QVBoxLayout *verticalLayout_2; QHBoxLayout *horizontalLayout_7; QLabel *label_7; QLineEdit *serverUrlLineEdit; QHBoxLayout *horizontalLayout_8; QLabel *label_8; QSpinBox *serverUpdateSB; QGroupBox *groupBox_3; QVBoxLayout *verticalLayout_4; QCheckBox *sendCB; QCheckBox *randomIdCB; QHBoxLayout *horizontalLayout_13; QHBoxLayout *horizontalLayout_12; QHBoxLayout *horizontalLayout_11; QLabel *label_9; QSpinBox *randBeginSB; QLabel *label_10; QSpinBox *randEndSB; QHBoxLayout *horizontalLayout_14; QCheckBox *useVideoCB; QLineEdit *videoNameLineEdit; QHBoxLayout *horizontalLayout_10; QSpacerItem *horizontalSpacer_4; QPushButton *saveBtn; QPushButton *runBtn; QSpacerItem *horizontalSpacer_5; void setupUi(QMainWindow *MT_VisionUI) { if (MT_VisionUI->objectName().isEmpty()) MT_VisionUI->setObjectName(QString::fromUtf8("MT_VisionUI")); MT_VisionUI->resize(707, 414); centralWidget = new QWidget(MT_VisionUI); centralWidget->setObjectName(QString::fromUtf8("centralWidget")); verticalLayout_3 = new QVBoxLayout(centralWidget); verticalLayout_3->setSpacing(6); verticalLayout_3->setContentsMargins(11, 11, 11, 11); verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3")); horizontalLayout = new QHBoxLayout(); horizontalLayout->setSpacing(6); horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); label = new QLabel(centralWidget); label->setObjectName(QString::fromUtf8("label")); horizontalLayout->addWidget(label); devIdSB = new QSpinBox(centralWidget); devIdSB->setObjectName(QString::fromUtf8("devIdSB")); horizontalLayout->addWidget(devIdSB); horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout->addItem(horizontalSpacer_2); verticalLayout_3->addLayout(horizontalLayout); horizontalLayout_2 = new QHBoxLayout(); horizontalLayout_2->setSpacing(6); horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2")); label_2 = new QLabel(centralWidget); label_2->setObjectName(QString::fromUtf8("label_2")); horizontalLayout_2->addWidget(label_2); clientIdSB = new QSpinBox(centralWidget); clientIdSB->setObjectName(QString::fromUtf8("clientIdSB")); horizontalLayout_2->addWidget(clientIdSB); horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout_2->addItem(horizontalSpacer_3); verticalLayout_3->addLayout(horizontalLayout_2); verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Fixed); verticalLayout_3->addItem(verticalSpacer); horizontalLayout_9 = new QHBoxLayout(); horizontalLayout_9->setSpacing(6); horizontalLayout_9->setObjectName(QString::fromUtf8("horizontalLayout_9")); groupBox = new QGroupBox(centralWidget); groupBox->setObjectName(QString::fromUtf8("groupBox")); verticalLayout = new QVBoxLayout(groupBox); verticalLayout->setSpacing(6); verticalLayout->setContentsMargins(11, 11, 11, 11); verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); verticalLayout->setContentsMargins(2, 2, 2, 2); horizontalLayout_3 = new QHBoxLayout(); horizontalLayout_3->setSpacing(6); horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3")); label_3 = new QLabel(groupBox); label_3->setObjectName(QString::fromUtf8("label_3")); horizontalLayout_3->addWidget(label_3); roiLSB = new QSpinBox(groupBox); roiLSB->setObjectName(QString::fromUtf8("roiLSB")); roiLSB->setMaximum(65000); roiLSB->setValue(200); horizontalLayout_3->addWidget(roiLSB); verticalLayout->addLayout(horizontalLayout_3); horizontalLayout_4 = new QHBoxLayout(); horizontalLayout_4->setSpacing(6); horizontalLayout_4->setObjectName(QString::fromUtf8("horizontalLayout_4")); label_4 = new QLabel(groupBox); label_4->setObjectName(QString::fromUtf8("label_4")); horizontalLayout_4->addWidget(label_4); roiRSB = new QSpinBox(groupBox); roiRSB->setObjectName(QString::fromUtf8("roiRSB")); roiRSB->setMaximum(65000); roiRSB->setValue(1280); horizontalLayout_4->addWidget(roiRSB); verticalLayout->addLayout(horizontalLayout_4); horizontalLayout_5 = new QHBoxLayout(); horizontalLayout_5->setSpacing(6); horizontalLayout_5->setObjectName(QString::fromUtf8("horizontalLayout_5")); label_5 = new QLabel(groupBox); label_5->setObjectName(QString::fromUtf8("label_5")); horizontalLayout_5->addWidget(label_5); roiTSB = new QSpinBox(groupBox); roiTSB->setObjectName(QString::fromUtf8("roiTSB")); roiTSB->setMaximum(65000); roiTSB->setValue(400); horizontalLayout_5->addWidget(roiTSB); verticalLayout->addLayout(horizontalLayout_5); horizontalLayout_6 = new QHBoxLayout(); horizontalLayout_6->setSpacing(6); horizontalLayout_6->setObjectName(QString::fromUtf8("horizontalLayout_6")); label_6 = new QLabel(groupBox); label_6->setObjectName(QString::fromUtf8("label_6")); horizontalLayout_6->addWidget(label_6); roiBSB = new QSpinBox(groupBox); roiBSB->setObjectName(QString::fromUtf8("roiBSB")); roiBSB->setMaximum(65000); roiBSB->setValue(500); horizontalLayout_6->addWidget(roiBSB); verticalLayout->addLayout(horizontalLayout_6); horizontalLayout_9->addWidget(groupBox); groupBox_2 = new QGroupBox(centralWidget); groupBox_2->setObjectName(QString::fromUtf8("groupBox_2")); verticalLayout_2 = new QVBoxLayout(groupBox_2); verticalLayout_2->setSpacing(6); verticalLayout_2->setContentsMargins(11, 11, 11, 11); verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2")); verticalLayout_2->setContentsMargins(2, 2, 2, 2); horizontalLayout_7 = new QHBoxLayout(); horizontalLayout_7->setSpacing(6); horizontalLayout_7->setObjectName(QString::fromUtf8("horizontalLayout_7")); label_7 = new QLabel(groupBox_2); label_7->setObjectName(QString::fromUtf8("label_7")); horizontalLayout_7->addWidget(label_7); serverUrlLineEdit = new QLineEdit(groupBox_2); serverUrlLineEdit->setObjectName(QString::fromUtf8("serverUrlLineEdit")); horizontalLayout_7->addWidget(serverUrlLineEdit); verticalLayout_2->addLayout(horizontalLayout_7); horizontalLayout_8 = new QHBoxLayout(); horizontalLayout_8->setSpacing(6); horizontalLayout_8->setObjectName(QString::fromUtf8("horizontalLayout_8")); label_8 = new QLabel(groupBox_2); label_8->setObjectName(QString::fromUtf8("label_8")); horizontalLayout_8->addWidget(label_8); serverUpdateSB = new QSpinBox(groupBox_2); serverUpdateSB->setObjectName(QString::fromUtf8("serverUpdateSB")); serverUpdateSB->setMaximum(65000); serverUpdateSB->setValue(30); horizontalLayout_8->addWidget(serverUpdateSB); verticalLayout_2->addLayout(horizontalLayout_8); horizontalLayout_9->addWidget(groupBox_2); groupBox_3 = new QGroupBox(centralWidget); groupBox_3->setObjectName(QString::fromUtf8("groupBox_3")); verticalLayout_4 = new QVBoxLayout(groupBox_3); verticalLayout_4->setSpacing(6); verticalLayout_4->setContentsMargins(11, 11, 11, 11); verticalLayout_4->setObjectName(QString::fromUtf8("verticalLayout_4")); verticalLayout_4->setContentsMargins(2, 2, 2, 2); sendCB = new QCheckBox(groupBox_3); sendCB->setObjectName(QString::fromUtf8("sendCB")); sendCB->setChecked(true); verticalLayout_4->addWidget(sendCB); randomIdCB = new QCheckBox(groupBox_3); randomIdCB->setObjectName(QString::fromUtf8("randomIdCB")); randomIdCB->setChecked(true); verticalLayout_4->addWidget(randomIdCB); horizontalLayout_13 = new QHBoxLayout(); horizontalLayout_13->setSpacing(6); horizontalLayout_13->setObjectName(QString::fromUtf8("horizontalLayout_13")); horizontalLayout_12 = new QHBoxLayout(); horizontalLayout_12->setSpacing(6); horizontalLayout_12->setObjectName(QString::fromUtf8("horizontalLayout_12")); horizontalLayout_11 = new QHBoxLayout(); horizontalLayout_11->setSpacing(6); horizontalLayout_11->setObjectName(QString::fromUtf8("horizontalLayout_11")); label_9 = new QLabel(groupBox_3); label_9->setObjectName(QString::fromUtf8("label_9")); horizontalLayout_11->addWidget(label_9); randBeginSB = new QSpinBox(groupBox_3); randBeginSB->setObjectName(QString::fromUtf8("randBeginSB")); randBeginSB->setMaximum(65000); randBeginSB->setValue(0); horizontalLayout_11->addWidget(randBeginSB); horizontalLayout_12->addLayout(horizontalLayout_11); label_10 = new QLabel(groupBox_3); label_10->setObjectName(QString::fromUtf8("label_10")); horizontalLayout_12->addWidget(label_10); randEndSB = new QSpinBox(groupBox_3); randEndSB->setObjectName(QString::fromUtf8("randEndSB")); randEndSB->setMaximum(65000); randEndSB->setValue(3); horizontalLayout_12->addWidget(randEndSB); horizontalLayout_13->addLayout(horizontalLayout_12); verticalLayout_4->addLayout(horizontalLayout_13); horizontalLayout_14 = new QHBoxLayout(); horizontalLayout_14->setSpacing(6); horizontalLayout_14->setObjectName(QString::fromUtf8("horizontalLayout_14")); useVideoCB = new QCheckBox(groupBox_3); useVideoCB->setObjectName(QString::fromUtf8("useVideoCB")); useVideoCB->setChecked(true); horizontalLayout_14->addWidget(useVideoCB); videoNameLineEdit = new QLineEdit(groupBox_3); videoNameLineEdit->setObjectName(QString::fromUtf8("videoNameLineEdit")); horizontalLayout_14->addWidget(videoNameLineEdit); verticalLayout_4->addLayout(horizontalLayout_14); horizontalLayout_9->addWidget(groupBox_3); verticalLayout_3->addLayout(horizontalLayout_9); horizontalLayout_10 = new QHBoxLayout(); horizontalLayout_10->setSpacing(6); horizontalLayout_10->setObjectName(QString::fromUtf8("horizontalLayout_10")); horizontalSpacer_4 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout_10->addItem(horizontalSpacer_4); saveBtn = new QPushButton(centralWidget); saveBtn->setObjectName(QString::fromUtf8("saveBtn")); horizontalLayout_10->addWidget(saveBtn); runBtn = new QPushButton(centralWidget); runBtn->setObjectName(QString::fromUtf8("runBtn")); horizontalLayout_10->addWidget(runBtn); horizontalSpacer_5 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout_10->addItem(horizontalSpacer_5); verticalLayout_3->addLayout(horizontalLayout_10); MT_VisionUI->setCentralWidget(centralWidget); retranslateUi(MT_VisionUI); QMetaObject::connectSlotsByName(MT_VisionUI); } // setupUi void retranslateUi(QMainWindow *MT_VisionUI) { MT_VisionUI->setWindowTitle(QCoreApplication::translate("MT_VisionUI", "MT_VisionUI", nullptr)); label->setText(QCoreApplication::translate("MT_VisionUI", "Camera Device Id :", nullptr)); label_2->setText(QCoreApplication::translate("MT_VisionUI", "Computer Vision Client Id :", nullptr)); groupBox->setTitle(QCoreApplication::translate("MT_VisionUI", "Region Of Interest", nullptr)); label_3->setText(QCoreApplication::translate("MT_VisionUI", "left side :", nullptr)); label_4->setText(QCoreApplication::translate("MT_VisionUI", "right side :", nullptr)); label_5->setText(QCoreApplication::translate("MT_VisionUI", "top side :", nullptr)); label_6->setText(QCoreApplication::translate("MT_VisionUI", "bottom side :", nullptr)); groupBox_2->setTitle(QCoreApplication::translate("MT_VisionUI", "Network", nullptr)); label_7->setText(QCoreApplication::translate("MT_VisionUI", "Server URL : ", nullptr)); serverUrlLineEdit->setText(QCoreApplication::translate("MT_VisionUI", "http://192.168.43.234/mtApi/api/", nullptr)); label_8->setText(QCoreApplication::translate("MT_VisionUI", "Update Period (seconds) :", nullptr)); groupBox_3->setTitle(QCoreApplication::translate("MT_VisionUI", "Testing", nullptr)); sendCB->setText(QCoreApplication::translate("MT_VisionUI", "Send to server", nullptr)); randomIdCB->setText(QCoreApplication::translate("MT_VisionUI", "use random range for id", nullptr)); label_9->setText(QCoreApplication::translate("MT_VisionUI", "from :", nullptr)); label_10->setText(QCoreApplication::translate("MT_VisionUI", "To :", nullptr)); useVideoCB->setText(QCoreApplication::translate("MT_VisionUI", "use Video", nullptr)); videoNameLineEdit->setText(QCoreApplication::translate("MT_VisionUI", "test 1.mp4", nullptr)); saveBtn->setText(QCoreApplication::translate("MT_VisionUI", "Save Settings", nullptr)); runBtn->setText(QCoreApplication::translate("MT_VisionUI", "Run Program", nullptr)); } // retranslateUi }; namespace Ui { class MT_VisionUI: public Ui_MT_VisionUI {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_MT_VISIONUI_H
/******************************************************************************** ** Form generated from reading UI file 'mt_visionui.ui' ** ** Created by: Qt User Interface Compiler version 5.13.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_MT_VISIONUI_H #define UI_MT_VISIONUI_H #include <QtCore/QVariant> #include <IMPORT_0> #include <QtWidgets/QCheckBox> #include <IMPORT_1> #include <IMPORT_2> #include <QtWidgets/QLabel> #include <QtWidgets/QLineEdit> #include <QtWidgets/QMainWindow> #include <IMPORT_3> #include <IMPORT_4> #include <IMPORT_5> #include <IMPORT_6> #include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE VAR_0 VAR_1 { public: VAR_2 *centralWidget; QVBoxLayout *verticalLayout_3; CLASS_1 *VAR_3; QLabel *label; QSpinBox *VAR_4; CLASS_2 *horizontalSpacer_2; CLASS_1 *VAR_5; QLabel *VAR_6; QSpinBox *clientIdSB; CLASS_2 *VAR_7; CLASS_2 *VAR_8; CLASS_1 *VAR_9; CLASS_3 *VAR_10; QVBoxLayout *VAR_11; CLASS_1 *VAR_12; QLabel *VAR_13; QSpinBox *roiLSB; CLASS_1 *VAR_14; QLabel *VAR_15; QSpinBox *VAR_16; CLASS_1 *VAR_17; QLabel *VAR_18; QSpinBox *roiTSB; CLASS_1 *VAR_19; QLabel *VAR_20; QSpinBox *VAR_21; CLASS_3 *VAR_22; QVBoxLayout *VAR_23; CLASS_1 *VAR_24; QLabel *VAR_25; QLineEdit *VAR_26; CLASS_1 *VAR_27; QLabel *VAR_28; QSpinBox *VAR_29; CLASS_3 *VAR_30; QVBoxLayout *VAR_31; CLASS_4 *VAR_32; CLASS_4 *VAR_33; CLASS_1 *VAR_34; CLASS_1 *horizontalLayout_12; CLASS_1 *VAR_35; QLabel *label_9; QSpinBox *VAR_36; QLabel *VAR_37; QSpinBox *randEndSB; CLASS_1 *VAR_38; CLASS_4 *VAR_39; QLineEdit *VAR_40; CLASS_1 *VAR_41; CLASS_2 *VAR_42; CLASS_5 *VAR_43; CLASS_5 *VAR_44; CLASS_2 *VAR_45; void FUNC_6(CLASS_6 *MT_VisionUI) { if (MT_VisionUI->FUNC_7().FUNC_8()) MT_VisionUI->setObjectName(VAR_46::FUNC_9("MT_VisionUI")); MT_VisionUI->resize(707, 414); centralWidget = new FUNC_0(MT_VisionUI); centralWidget->setObjectName(VAR_46::FUNC_9("centralWidget")); verticalLayout_3 = new QVBoxLayout(centralWidget); verticalLayout_3->FUNC_10(6); verticalLayout_3->FUNC_11(11, 11, 11, 11); verticalLayout_3->setObjectName(VAR_46::FUNC_9("verticalLayout_3")); VAR_3 = new FUNC_1(); VAR_3->FUNC_10(6); VAR_3->setObjectName(VAR_46::FUNC_9("horizontalLayout")); label = new QLabel(centralWidget); label->setObjectName(VAR_46::FUNC_9("label")); VAR_3->addWidget(label); VAR_4 = new QSpinBox(centralWidget); VAR_4->setObjectName(VAR_46::FUNC_9("devIdSB")); VAR_3->addWidget(VAR_4); horizontalSpacer_2 = new FUNC_2(40, 20, QSizePolicy::VAR_47, QSizePolicy::Minimum); VAR_3->FUNC_12(horizontalSpacer_2); verticalLayout_3->FUNC_13(VAR_3); VAR_5 = new FUNC_1(); VAR_5->FUNC_10(6); VAR_5->setObjectName(VAR_46::FUNC_9("horizontalLayout_2")); VAR_6 = new QLabel(centralWidget); VAR_6->setObjectName(VAR_46::FUNC_9("label_2")); VAR_5->addWidget(VAR_6); clientIdSB = new QSpinBox(centralWidget); clientIdSB->setObjectName(VAR_46::FUNC_9("clientIdSB")); VAR_5->addWidget(clientIdSB); VAR_7 = new FUNC_2(40, 20, QSizePolicy::VAR_47, QSizePolicy::Minimum); VAR_5->FUNC_12(VAR_7); verticalLayout_3->FUNC_13(VAR_5); VAR_8 = new FUNC_2(20, 40, QSizePolicy::Minimum, QSizePolicy::Fixed); verticalLayout_3->FUNC_12(VAR_8); VAR_9 = new FUNC_1(); VAR_9->FUNC_10(6); VAR_9->setObjectName(VAR_46::FUNC_9("horizontalLayout_9")); VAR_10 = new FUNC_3(centralWidget); VAR_10->setObjectName(VAR_46::FUNC_9("groupBox")); VAR_11 = new QVBoxLayout(VAR_10); VAR_11->FUNC_10(6); VAR_11->FUNC_11(11, 11, 11, 11); VAR_11->setObjectName(VAR_46::FUNC_9("verticalLayout")); VAR_11->FUNC_11(2, 2, 2, 2); VAR_12 = new FUNC_1(); VAR_12->FUNC_10(6); VAR_12->setObjectName(VAR_46::FUNC_9("horizontalLayout_3")); VAR_13 = new QLabel(VAR_10); VAR_13->setObjectName(VAR_46::FUNC_9("label_3")); VAR_12->addWidget(VAR_13); roiLSB = new QSpinBox(VAR_10); roiLSB->setObjectName(VAR_46::FUNC_9("roiLSB")); roiLSB->FUNC_14(65000); roiLSB->FUNC_15(200); VAR_12->addWidget(roiLSB); VAR_11->FUNC_13(VAR_12); VAR_14 = new FUNC_1(); VAR_14->FUNC_10(6); VAR_14->setObjectName(VAR_46::FUNC_9("horizontalLayout_4")); VAR_15 = new QLabel(VAR_10); VAR_15->setObjectName(VAR_46::FUNC_9("label_4")); VAR_14->addWidget(VAR_15); VAR_16 = new QSpinBox(VAR_10); VAR_16->setObjectName(VAR_46::FUNC_9("roiRSB")); VAR_16->FUNC_14(65000); VAR_16->FUNC_15(1280); VAR_14->addWidget(VAR_16); VAR_11->FUNC_13(VAR_14); VAR_17 = new FUNC_1(); VAR_17->FUNC_10(6); VAR_17->setObjectName(VAR_46::FUNC_9("horizontalLayout_5")); VAR_18 = new QLabel(VAR_10); VAR_18->setObjectName(VAR_46::FUNC_9("label_5")); VAR_17->addWidget(VAR_18); roiTSB = new QSpinBox(VAR_10); roiTSB->setObjectName(VAR_46::FUNC_9("roiTSB")); roiTSB->FUNC_14(65000); roiTSB->FUNC_15(400); VAR_17->addWidget(roiTSB); VAR_11->FUNC_13(VAR_17); VAR_19 = new FUNC_1(); VAR_19->FUNC_10(6); VAR_19->setObjectName(VAR_46::FUNC_9("horizontalLayout_6")); VAR_20 = new QLabel(VAR_10); VAR_20->setObjectName(VAR_46::FUNC_9("label_6")); VAR_19->addWidget(VAR_20); VAR_21 = new QSpinBox(VAR_10); VAR_21->setObjectName(VAR_46::FUNC_9("roiBSB")); VAR_21->FUNC_14(65000); VAR_21->FUNC_15(500); VAR_19->addWidget(VAR_21); VAR_11->FUNC_13(VAR_19); VAR_9->addWidget(VAR_10); VAR_22 = new FUNC_3(centralWidget); VAR_22->setObjectName(VAR_46::FUNC_9("groupBox_2")); VAR_23 = new QVBoxLayout(VAR_22); VAR_23->FUNC_10(6); VAR_23->FUNC_11(11, 11, 11, 11); VAR_23->setObjectName(VAR_46::FUNC_9("verticalLayout_2")); VAR_23->FUNC_11(2, 2, 2, 2); VAR_24 = new FUNC_1(); VAR_24->FUNC_10(6); VAR_24->setObjectName(VAR_46::FUNC_9("horizontalLayout_7")); VAR_25 = new QLabel(VAR_22); VAR_25->setObjectName(VAR_46::FUNC_9("label_7")); VAR_24->addWidget(VAR_25); VAR_26 = new QLineEdit(VAR_22); VAR_26->setObjectName(VAR_46::FUNC_9("serverUrlLineEdit")); VAR_24->addWidget(VAR_26); VAR_23->FUNC_13(VAR_24); VAR_27 = new FUNC_1(); VAR_27->FUNC_10(6); VAR_27->setObjectName(VAR_46::FUNC_9("horizontalLayout_8")); VAR_28 = new QLabel(VAR_22); VAR_28->setObjectName(VAR_46::FUNC_9("label_8")); VAR_27->addWidget(VAR_28); VAR_29 = new QSpinBox(VAR_22); VAR_29->setObjectName(VAR_46::FUNC_9("serverUpdateSB")); VAR_29->FUNC_14(65000); VAR_29->FUNC_15(30); VAR_27->addWidget(VAR_29); VAR_23->FUNC_13(VAR_27); VAR_9->addWidget(VAR_22); VAR_30 = new FUNC_3(centralWidget); VAR_30->setObjectName(VAR_46::FUNC_9("groupBox_3")); VAR_31 = new QVBoxLayout(VAR_30); VAR_31->FUNC_10(6); VAR_31->FUNC_11(11, 11, 11, 11); VAR_31->setObjectName(VAR_46::FUNC_9("verticalLayout_4")); VAR_31->FUNC_11(2, 2, 2, 2); VAR_32 = new FUNC_4(VAR_30); VAR_32->setObjectName(VAR_46::FUNC_9("sendCB")); VAR_32->setChecked(true); VAR_31->addWidget(VAR_32); VAR_33 = new FUNC_4(VAR_30); VAR_33->setObjectName(VAR_46::FUNC_9("randomIdCB")); VAR_33->setChecked(true); VAR_31->addWidget(VAR_33); VAR_34 = new FUNC_1(); VAR_34->FUNC_10(6); VAR_34->setObjectName(VAR_46::FUNC_9("horizontalLayout_13")); horizontalLayout_12 = new FUNC_1(); horizontalLayout_12->FUNC_10(6); horizontalLayout_12->setObjectName(VAR_46::FUNC_9("horizontalLayout_12")); VAR_35 = new FUNC_1(); VAR_35->FUNC_10(6); VAR_35->setObjectName(VAR_46::FUNC_9("horizontalLayout_11")); label_9 = new QLabel(VAR_30); label_9->setObjectName(VAR_46::FUNC_9("label_9")); VAR_35->addWidget(label_9); VAR_36 = new QSpinBox(VAR_30); VAR_36->setObjectName(VAR_46::FUNC_9("randBeginSB")); VAR_36->FUNC_14(65000); VAR_36->FUNC_15(0); VAR_35->addWidget(VAR_36); horizontalLayout_12->FUNC_13(VAR_35); VAR_37 = new QLabel(VAR_30); VAR_37->setObjectName(VAR_46::FUNC_9("label_10")); horizontalLayout_12->addWidget(VAR_37); randEndSB = new QSpinBox(VAR_30); randEndSB->setObjectName(VAR_46::FUNC_9("randEndSB")); randEndSB->FUNC_14(65000); randEndSB->FUNC_15(3); horizontalLayout_12->addWidget(randEndSB); VAR_34->FUNC_13(horizontalLayout_12); VAR_31->FUNC_13(VAR_34); VAR_38 = new FUNC_1(); VAR_38->FUNC_10(6); VAR_38->setObjectName(VAR_46::FUNC_9("horizontalLayout_14")); VAR_39 = new FUNC_4(VAR_30); VAR_39->setObjectName(VAR_46::FUNC_9("useVideoCB")); VAR_39->setChecked(true); VAR_38->addWidget(VAR_39); VAR_40 = new QLineEdit(VAR_30); VAR_40->setObjectName(VAR_46::FUNC_9("videoNameLineEdit")); VAR_38->addWidget(VAR_40); VAR_31->FUNC_13(VAR_38); VAR_9->addWidget(VAR_30); verticalLayout_3->FUNC_13(VAR_9); VAR_41 = new FUNC_1(); VAR_41->FUNC_10(6); VAR_41->setObjectName(VAR_46::FUNC_9("horizontalLayout_10")); VAR_42 = new FUNC_2(40, 20, QSizePolicy::VAR_47, QSizePolicy::Minimum); VAR_41->FUNC_12(VAR_42); VAR_43 = new FUNC_5(centralWidget); VAR_43->setObjectName(VAR_46::FUNC_9("saveBtn")); VAR_41->addWidget(VAR_43); VAR_44 = new FUNC_5(centralWidget); VAR_44->setObjectName(VAR_46::FUNC_9("runBtn")); VAR_41->addWidget(VAR_44); VAR_45 = new FUNC_2(40, 20, QSizePolicy::VAR_47, QSizePolicy::Minimum); VAR_41->FUNC_12(VAR_45); verticalLayout_3->FUNC_13(VAR_41); MT_VisionUI->setCentralWidget(centralWidget); retranslateUi(MT_VisionUI); QMetaObject::FUNC_16(MT_VisionUI); } // setupUi void retranslateUi(CLASS_6 *MT_VisionUI) { MT_VisionUI->FUNC_17(QCoreApplication::FUNC_18("MT_VisionUI", "MT_VisionUI", nullptr)); label->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "Camera Device Id :", nullptr)); VAR_6->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "Computer Vision Client Id :", nullptr)); VAR_10->FUNC_20(QCoreApplication::FUNC_18("MT_VisionUI", "Region Of Interest", nullptr)); VAR_13->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "left side :", nullptr)); VAR_15->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "right side :", nullptr)); VAR_18->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "top side :", nullptr)); VAR_20->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "bottom side :", nullptr)); VAR_22->FUNC_20(QCoreApplication::FUNC_18("MT_VisionUI", "Network", nullptr)); VAR_25->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "Server URL : ", nullptr)); VAR_26->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "http://192.168.43.234/mtApi/api/", nullptr)); VAR_28->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "Update Period (seconds) :", nullptr)); VAR_30->FUNC_20(QCoreApplication::FUNC_18("MT_VisionUI", "Testing", nullptr)); VAR_32->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "Send to server", nullptr)); VAR_33->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "use random range for id", nullptr)); label_9->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "from :", nullptr)); VAR_37->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "To :", nullptr)); VAR_39->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "use Video", nullptr)); VAR_40->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "test 1.mp4", nullptr)); VAR_43->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "Save Settings", nullptr)); VAR_44->FUNC_19(QCoreApplication::FUNC_18("MT_VisionUI", "Run Program", nullptr)); } // retranslateUi }; namespace VAR_48 { CLASS_0 MT_VisionUI: public VAR_1 {}; } // namespace Ui CLASS_7 #endif // UI_MT_VISIONUI_H
0.672501
{'IMPORT_0': 'QtWidgets/QApplication', 'IMPORT_1': 'QtWidgets/QGroupBox', 'IMPORT_2': 'QtWidgets/QHBoxLayout', 'IMPORT_3': 'QtWidgets/QPushButton', 'IMPORT_4': 'QtWidgets/QSpacerItem', 'IMPORT_5': 'QtWidgets/QSpinBox', 'IMPORT_6': 'QtWidgets/QVBoxLayout', 'VAR_0': 'class', 'CLASS_0': 'class', 'VAR_1': 'Ui_MT_VisionUI', 'VAR_2': 'QWidget', 'FUNC_0': 'QWidget', 'CLASS_1': 'QHBoxLayout', 'FUNC_1': 'QHBoxLayout', 'VAR_3': 'horizontalLayout', 'VAR_4': 'devIdSB', 'CLASS_2': 'QSpacerItem', 'FUNC_2': 'QSpacerItem', 'VAR_5': 'horizontalLayout_2', 'VAR_6': 'label_2', 'VAR_7': 'horizontalSpacer_3', 'VAR_8': 'verticalSpacer', 'VAR_9': 'horizontalLayout_9', 'CLASS_3': 'QGroupBox', 'FUNC_3': 'QGroupBox', 'VAR_10': 'groupBox', 'VAR_11': 'verticalLayout', 'VAR_12': 'horizontalLayout_3', 'VAR_13': 'label_3', 'VAR_14': 'horizontalLayout_4', 'VAR_15': 'label_4', 'VAR_16': 'roiRSB', 'VAR_17': 'horizontalLayout_5', 'VAR_18': 'label_5', 'VAR_19': 'horizontalLayout_6', 'VAR_20': 'label_6', 'VAR_21': 'roiBSB', 'VAR_22': 'groupBox_2', 'VAR_23': 'verticalLayout_2', 'VAR_24': 'horizontalLayout_7', 'VAR_25': 'label_7', 'VAR_26': 'serverUrlLineEdit', 'VAR_27': 'horizontalLayout_8', 'VAR_28': 'label_8', 'VAR_29': 'serverUpdateSB', 'VAR_30': 'groupBox_3', 'VAR_31': 'verticalLayout_4', 'CLASS_4': 'QCheckBox', 'FUNC_4': 'QCheckBox', 'VAR_32': 'sendCB', 'VAR_33': 'randomIdCB', 'VAR_34': 'horizontalLayout_13', 'VAR_35': 'horizontalLayout_11', 'VAR_36': 'randBeginSB', 'VAR_37': 'label_10', 'VAR_38': 'horizontalLayout_14', 'VAR_39': 'useVideoCB', 'VAR_40': 'videoNameLineEdit', 'VAR_41': 'horizontalLayout_10', 'VAR_42': 'horizontalSpacer_4', 'CLASS_5': 'QPushButton', 'FUNC_5': 'QPushButton', 'VAR_43': 'saveBtn', 'VAR_44': 'runBtn', 'VAR_45': 'horizontalSpacer_5', 'FUNC_6': 'setupUi', 'CLASS_6': 'QMainWindow', 'FUNC_7': 'objectName', 'FUNC_8': 'isEmpty', 'VAR_46': 'QString', 'FUNC_9': 'fromUtf8', 'FUNC_10': 'setSpacing', 'FUNC_11': 'setContentsMargins', 'VAR_47': 'Expanding', 'FUNC_12': 'addItem', 'FUNC_13': 'addLayout', 'FUNC_14': 'setMaximum', 'FUNC_15': 'setValue', 'FUNC_16': 'connectSlotsByName', 'FUNC_17': 'setWindowTitle', 'FUNC_18': 'translate', 'FUNC_19': 'setText', 'FUNC_20': 'setTitle', 'VAR_48': 'Ui', 'CLASS_7': 'QT_END_NAMESPACE'}
// // Created by zhuangxk on 5/17/16. // template <class T> Stack<T>::Stack() : stack_top(Stack::BOTTOM) { } template <class T> Stack<T>::Stack(const Stack& s) : stack_top(s.stack_top) { for(int i = 0; i < s.stack_top; i++) { this->content[i] = s.content[i]; } } template <class T> Stack<T>::~Stack() { this->stack_top = Stack::BOTTOM; } template <class T> Stack<T>& Stack<T>::operator=(const Stack& s) { if (this != &s) { this->stack_top = s.stack_top; for (int i = 0; i < s.stack_top; i++) { this->content[i] = s.content[i]; } } return *this; } template <class T> int Stack<T>::is_empty() { return this->stack_top == Stack::BOTTOM; } template <class T> int Stack<T>::is_full() { return this->stack_top == Stack::SIZE; } template <class T> void Stack<T>::push(T new_item) { this->content[this->stack_top++] = new_item; } template <class T> T Stack<T>::pop() { return this->content[--this->stack_top]; } template <class T> T Stack<T>::top() { return this->content[this->stack_top - 1]; }
// // Created by zhuangxk on 5/17/16. // template <class T> Stack<T>::Stack() : stack_top(Stack::BOTTOM) { } template <class T> Stack<T>::Stack(const Stack& s) : stack_top(s.stack_top) { for(int i = 0; i < s.stack_top; i++) { VAR_0->VAR_1[i] = s.VAR_1[i]; } } template <class T> Stack<T>::~Stack() { VAR_0->stack_top = Stack::BOTTOM; } template <class T> Stack<T>& Stack<T>::operator=(const Stack& s) { if (VAR_0 != &s) { VAR_0->stack_top = s.stack_top; for (int i = 0; i < s.stack_top; i++) { VAR_0->VAR_1[i] = s.VAR_1[i]; } } return *VAR_0; } template <class T> int Stack<T>::is_empty() { return VAR_0->stack_top == Stack::BOTTOM; } template <class T> int Stack<T>::is_full() { return VAR_0->stack_top == Stack::VAR_2; } template <class T> void Stack<T>::push(T new_item) { VAR_0->VAR_1[VAR_0->stack_top++] = new_item; } template <class T> T Stack<T>::FUNC_0() { return VAR_0->VAR_1[--VAR_0->stack_top]; } template <class T> T Stack<T>::top() { return VAR_0->VAR_1[VAR_0->stack_top - 1]; }
0.258119
{'VAR_0': 'this', 'VAR_1': 'content', 'VAR_2': 'SIZE', 'FUNC_0': 'pop'}
#ifndef CHARACTER_LOADER_H #define CHARACTER_LOADER_H #include "VisibleLoader.h" #include "../BulletLoader/BulletBodyLoader.h" #include <Entities/VisibleObjects/Character.h> #include <Entities/PhysicsObjects/BulletVisibleObjectState.h> #include <Entities/PhysicsObjects/BulletControllable.h> class CharacterLoader { private: VisibleLoader visible_loader; PhysBodyBuilder phys_body_builder; BulletBodyLoader phys_body_loader; IProjectileFactory &projectile_factory; unsigned int species = 0; public: void SetPosition(const btVector3 &new_position) { phys_body_builder.SetPosition(new_position); } void SetOrientation(const btQuaternion &new_orientation) { phys_body_builder.SetOrientation(new_orientation); } void SetSpecies(unsigned int new_species) { species = new_species; } virtual void Load(const liJSON_Object *object) { object->Forall([this](const std::string &key,const liJSON_Value *value) { if(key == "visible") { visible_loader.Load(ToConstObject(value)); } if(key == "body") { phys_body_loader.Load(ToConstObject(value)); } } ); } Character *Build() { Character *new_character = nullptr; btRigidBody *body = phys_body_builder.Build(); if(body != nullptr) { IVisibleObjectState *visible_state = new BulletVisibleObjectState(body); IControllable *controllable = new BulletControllable(body); new_character = new Character(visible_state,visible_loader.GetLabel(),controllable,species,projectile_factory); ICollisionCallback *character_callback = new_character; body->setUserPointer(character_callback); std::cout << "Character registered: " << character_callback << ";" << body->getUserPointer() << std::endl; } return new_character; } CharacterLoader(PhysWorld &world,IProjectileFactory &p_projectile_factory) :phys_body_builder(world),phys_body_loader(phys_body_builder),projectile_factory(p_projectile_factory) {} }; #endif // CHARACTER_LOADER_H
#ifndef VAR_0 #define VAR_0 #include "VisibleLoader.h" #include "IMPORT_0" #include <IMPORT_1> #include <Entities/PhysicsObjects/BulletVisibleObjectState.h> #include <IMPORT_2> CLASS_0 VAR_1 { private: VAR_2 visible_loader; CLASS_1 VAR_3; CLASS_2 VAR_4; IProjectileFactory &VAR_5; unsigned int species = 0; public: VAR_6 VAR_7(const CLASS_3 &VAR_8) { VAR_3.FUNC_4(VAR_8); } void FUNC_5(const CLASS_4 &VAR_9) { VAR_3.FUNC_5(VAR_9); } void FUNC_6(unsigned int VAR_10) { species = VAR_10; } virtual VAR_6 FUNC_7(const CLASS_5 *VAR_11) { VAR_11->Forall([VAR_12](const VAR_13::VAR_14 &VAR_15,const VAR_16 *VAR_17) { if(VAR_15 == "visible") { visible_loader.FUNC_7(ToConstObject(VAR_17)); } if(VAR_15 == "body") { VAR_4.FUNC_7(ToConstObject(VAR_17)); } } ); } CLASS_6 *FUNC_9() { CLASS_6 *new_character = nullptr; btRigidBody *VAR_18 = VAR_3.FUNC_9(); if(VAR_18 != nullptr) { CLASS_7 *visible_state = VAR_19 FUNC_10(VAR_18); CLASS_8 *VAR_20 = VAR_19 FUNC_11(VAR_18); new_character = VAR_19 FUNC_8(visible_state,visible_loader.FUNC_12(),VAR_20,species,VAR_5); CLASS_9 *VAR_21 = new_character; VAR_18->FUNC_13(VAR_21); std::cout << "Character registered: " << VAR_21 << ";" << VAR_18->getUserPointer() << VAR_13::VAR_22; } return new_character; } FUNC_0(VAR_23 &world,IProjectileFactory &p_projectile_factory) :FUNC_1(world),FUNC_2(VAR_3),FUNC_3(p_projectile_factory) {} }; #endif // CHARACTER_LOADER_H
0.682862
{'VAR_0': 'CHARACTER_LOADER_H', 'IMPORT_0': '../BulletLoader/BulletBodyLoader.h', 'IMPORT_1': 'Entities/VisibleObjects/Character.h', 'IMPORT_2': 'Entities/PhysicsObjects/BulletControllable.h', 'CLASS_0': 'class', 'VAR_1': 'CharacterLoader', 'FUNC_0': 'CharacterLoader', 'VAR_2': 'VisibleLoader', 'CLASS_1': 'PhysBodyBuilder', 'VAR_3': 'phys_body_builder', 'FUNC_1': 'phys_body_builder', 'CLASS_2': 'BulletBodyLoader', 'VAR_4': 'phys_body_loader', 'FUNC_2': 'phys_body_loader', 'VAR_5': 'projectile_factory', 'FUNC_3': 'projectile_factory', 'VAR_6': 'void', 'VAR_7': 'SetPosition', 'FUNC_4': 'SetPosition', 'CLASS_3': 'btVector3', 'VAR_8': 'new_position', 'FUNC_5': 'SetOrientation', 'CLASS_4': 'btQuaternion', 'VAR_9': 'new_orientation', 'FUNC_6': 'SetSpecies', 'VAR_10': 'new_species', 'FUNC_7': 'Load', 'CLASS_5': 'liJSON_Object', 'VAR_11': 'object', 'VAR_12': 'this', 'VAR_13': 'std', 'VAR_14': 'string', 'VAR_15': 'key', 'VAR_16': 'liJSON_Value', 'VAR_17': 'value', 'CLASS_6': 'Character', 'FUNC_8': 'Character', 'FUNC_9': 'Build', 'VAR_18': 'body', 'CLASS_7': 'IVisibleObjectState', 'VAR_19': 'new', 'FUNC_10': 'BulletVisibleObjectState', 'CLASS_8': 'IControllable', 'VAR_20': 'controllable', 'FUNC_11': 'BulletControllable', 'FUNC_12': 'GetLabel', 'CLASS_9': 'ICollisionCallback', 'VAR_21': 'character_callback', 'FUNC_13': 'setUserPointer', 'VAR_22': 'endl', 'VAR_23': 'PhysWorld'}
#ifndef INTERACTION_MANAGER_H #define INTERACTION_MANAGER_H #include "common/AABB.h" #include "common/UID.h" #include "gui/layout/ViewType.h" #include "gui/layout/ViewTypeRange.h" #include "common/CoordinateFrame.h" #include "common/CoordinateFrameLinkingType.h" #include "common/PublicTypes.h" #include "logic/camera/CameraTypes.h" #include "logic/camera/CameraStartFrameType.h" #include "logic/CrosshairsType.h" #include "logic/interaction/InteractionModes.h" #include "logic/interaction/InteractionHandlerType.h" #include <glm/fwd.hpp> #include <functional> #include <memory> #include <optional> #include <unordered_map> namespace camera { class Camera; class Projection; } class IInteractionHandler; class InteractionPack; /// @todo Rename to ViewInteractionManager class InteractionManager { public: /// Defines the direction in which the camera looks at the Active Slide view. enum class ActiveSlideViewDirection { TopToBottomSlide, //!< From top (+z) to bottom (-z) of the slide stack axis BottomToTopSlide //!< From bottom (-z) to top (+z) of the slide stack axis }; InteractionManager( GetterType<view_type_range_t> viewUidAndTypeRangeProvider, GetterType<CoordinateFrame> crosshairsFrameProvider, GetterType<CoordinateFrame> slideStackCrosshairsFrameProvider, GetterType<CoordinateFrame> slideStackFrameProvider ); InteractionManager( const InteractionManager& ) = default; InteractionManager& operator=( const InteractionManager& ) = default; InteractionManager( InteractionManager&& ) = default; InteractionManager& operator=( InteractionManager&& ) = default; ~InteractionManager(); /// Set functional that provides the reference space AABB void setRefSpaceAABBoxProvider( GetterType< AABB<float> > ); /// Set functional that provides the slide stack AABB void setSlideStackAABBoxProvider( GetterType< std::optional< AABB<float> > > ); /// Get non-owning pointer to the interaction pack for a given view InteractionPack* getInteractionPack( const UID& viewUid ); /// Get non-owning pointer to the camera for a given view camera::Camera* getCamera( const UID& viewUid ); /// Set the main interaction handler type void setInteractionModeType( const InteractionModeType& ); /// Get non-owning pointer to the active interaction handler for a given view IInteractionHandler* getActiveInteractionHandler( const UID& viewUid ); /// Set the view direction of the active slide view void setActiveSlideViewDirection( const ActiveSlideViewDirection& ); /// Get the view direction of the actie slide view ActiveSlideViewDirection getActiveSlideViewDirection() const; /// Set the cameras to view the bounding box of the reference space. void setupCamerasForAABBox( const AABB<float>& worldRefAABB, float refVoxelSize ); void setCameraNearDistance( float distance ); void alignCamerasToFrames(); void resetCameras(); camera::CameraType getCameraType( const gui::ViewType& ) const; CrosshairsType getCrosshairsType( const gui::ViewType& ) const; void applyExtraToCameras( const LinkedFrameType& linkedFrameType, const glm::mat4& extra ); private: void initialize(); void addInteractionPackForView( const UID& viewUid, const gui::ViewType& viewType ); void setCameraInteractionMode( const CameraInteractionMode& ); void setCrosshairsInteractionMode( const CrosshairsInteractionMode& ); void setRefImageInteractionMode( const RefImageInteractionMode& ); void setStackInteractionMode( const StackInteractionMode& ); void setSlideInteractionMode( const SlideInteractionMode& ); void setWindowLevelInteractionMode( const WindowLevelInteractionMode& ); /** * @brief For a given view type, this computes the coordinate frame mapping the view camera * Start Frame space to World space * * @param[in] viewType View type * * @return Coordinate frame mapping camera Start to World space */ CoordinateFrame computeStartFrame( const gui::ViewType& viewType ) const; GetterType<view_type_range_t> m_viewTypeRangeProvider; /// Function returning the AABB of the reference space in World space coordinates. GetterType< AABB<float> > m_refSpaceAABBoxProvider; /// Function providing the slide stack AABB in World space GetterType< std::optional< AABB<float> > > m_slideStackAABBoxProvider; /// Function providing the crosshairs for Reference Image views GetterType<CoordinateFrame> m_crosshairsFrameProvider; /// Function providing the crosshairs for Slide Stack views GetterType<CoordinateFrame> m_slideStackCrosshairsFrameProvider; /// Function providing the slide stack frame GetterType<CoordinateFrame> m_slideStackFrameProvider; /// Hash map of interaction packs, keyed by view UID. /// There is exactly one interaction pack per view. std::unordered_map< UID, std::unique_ptr<InteractionPack> > m_interactionPacks; /// Current map from view type to camera type std::unordered_map< gui::ViewType, camera::CameraType > m_viewTypeToCameraTypeMap; /// Map from view type to default crosshairs type static const std::unordered_map< gui::ViewType, CrosshairsType > smk_viewTypeToDefaultCrosshairsTypeMap; static CrosshairsType getDefaultCrosshairsType( const gui::ViewType& ); /// Map from view type to default camera type static const std::unordered_map< gui::ViewType, camera::CameraType > smk_viewTypeToDefaultCameraTypeMap; static camera::CameraType getDefaultCameraType( const gui::ViewType& ); /// Map from camera type to projection type static const std::unordered_map< camera::CameraType, camera::ProjectionType > smk_cameraTypeToProjectionTypeMap; static camera::ProjectionType getProjectionType( const camera::CameraType& ); /// Map from camera type to default start frame linking type. This defines the /// Coordinate frame to which a camera start frame is linked. static const std::unordered_map< camera::CameraType, LinkedFrameType > smk_cameraStartFrameTypeToDefaultLinkedStartFrameTypeMap; static LinkedFrameType getDefaultLinkedStartFrameType( const camera::CameraType& ); /// Map from camera type to default camera start frame type static const std::unordered_map< camera::CameraType, CameraStartFrameType > smk_cameraTypeToDefaultStartFrameTypeMap; static CameraStartFrameType getDefaultCameraStartFrameType( const camera::CameraType& ); /// Default map from start frame type to start frame /// Anatomical coordinate frame transformation applied atop the linked frame, /// This is used for defining the Axial, Coronal, Sagittal, etc. anatomical transformations. /// The frame's "world_O_frame" transformation really maps linkedFrame_O_anatomicalFrame. static const std::unordered_map< CameraStartFrameType, glm::quat > smk_cameraStartFrameTypeToDefaultAnatomicalRotationMap; static glm::quat getDefaultAnatomicalRotation( const CameraStartFrameType& ); /// @note Taken together, the concatenation of the two transformations /// (world_O_linkedFrame * linkedFrame_O_anatomicalFrame), /// i.e. linkedFrame.world_O_frame * anatomicalFrame.world_O_frame /// defines the "start anatomical frame" for the view camera. }; #endif // INTERACTION_MANAGER_H
#ifndef INTERACTION_MANAGER_H #define INTERACTION_MANAGER_H #include "IMPORT_0" #include "IMPORT_1" #include "gui/layout/ViewType.h" #include "IMPORT_2" #include "common/CoordinateFrame.h" #include "IMPORT_3" #include "IMPORT_4" #include "logic/camera/CameraTypes.h" #include "logic/camera/CameraStartFrameType.h" #include "IMPORT_5" #include "IMPORT_6" #include "IMPORT_7" #include <IMPORT_8> #include <IMPORT_9> #include <memory> #include <IMPORT_10> #include <IMPORT_11> CLASS_0 VAR_0 { class Camera; class Projection; } class IInteractionHandler; class InteractionPack; /// @todo Rename to ViewInteractionManager class VAR_1 { public: /// Defines the direction in which the camera looks at the Active Slide view. VAR_2 class VAR_3 { TopToBottomSlide, //!< From top (+z) to bottom (-z) of the slide stack axis BottomToTopSlide //!< From bottom (-z) to top (+z) of the slide stack axis }; FUNC_0( VAR_4<view_type_range_t> VAR_5, VAR_4<VAR_6> crosshairsFrameProvider, VAR_4<VAR_6> slideStackCrosshairsFrameProvider, VAR_4<VAR_6> slideStackFrameProvider ); VAR_1( const CLASS_2& ) = VAR_7; VAR_1& operator=( const CLASS_2& ) = default; FUNC_0( VAR_1&& ) = VAR_7; VAR_1& operator=( VAR_1&& ) = VAR_7; ~FUNC_0(); /// Set functional that provides the reference space AABB void FUNC_1( CLASS_4< AABB<float> > ); /// Set functional that provides the slide stack AABB void setSlideStackAABBoxProvider( CLASS_4< VAR_8::IMPORT_10< AABB<float> > > ); /// Get non-owning pointer to the interaction pack for a given view InteractionPack* getInteractionPack( const UID& VAR_9 ); /// Get non-owning pointer to the camera for a given view camera::Camera* FUNC_2( VAR_10 UID& VAR_9 ); /// Set the main interaction handler type void setInteractionModeType( const CLASS_7& ); /// Get non-owning pointer to the active interaction handler for a given view IInteractionHandler* FUNC_3( const UID& VAR_9 ); /// Set the view direction of the active slide view void FUNC_4( const CLASS_3& ); /// Get the view direction of the actie slide view CLASS_3 FUNC_5() const; /// Set the cameras to view the bounding box of the reference space. void FUNC_6( const AABB<float>& VAR_11, float refVoxelSize ); void FUNC_7( float VAR_12 ); void alignCamerasToFrames(); void resetCameras(); CLASS_1::CameraType FUNC_8( const gui::ViewType& ) VAR_10; CrosshairsType FUNC_9( const gui::ViewType& ) VAR_10; void FUNC_10( const LinkedFrameType& linkedFrameType, const CLASS_8::mat4& VAR_14 ); private: void initialize(); void addInteractionPackForView( const UID& VAR_9, const gui::ViewType& viewType ); void setCameraInteractionMode( const CLASS_9& ); void FUNC_11( const CLASS_10& ); void FUNC_12( const RefImageInteractionMode& ); void setStackInteractionMode( const CLASS_11& ); void FUNC_13( const SlideInteractionMode& ); void FUNC_14( const CLASS_12& ); /** * @brief For a given view type, this computes the coordinate frame mapping the view camera * Start Frame space to World space * * @param[in] viewType View type * * @return Coordinate frame mapping camera Start to World space */ CLASS_5 FUNC_15( const gui::ViewType& viewType ) VAR_10; CLASS_4<view_type_range_t> m_viewTypeRangeProvider; /// Function returning the AABB of the reference space in World space coordinates. CLASS_4< AABB<float> > m_refSpaceAABBoxProvider; /// Function providing the slide stack AABB in World space CLASS_4< VAR_8::IMPORT_10< AABB<float> > > VAR_15; /// Function providing the crosshairs for Reference Image views CLASS_4<VAR_6> m_crosshairsFrameProvider; /// Function providing the crosshairs for Slide Stack views CLASS_4<VAR_6> VAR_16; /// Function providing the slide stack frame CLASS_4<VAR_6> VAR_17; /// Hash map of interaction packs, keyed by view UID. /// There is exactly one interaction pack per view. CLASS_6::IMPORT_11< UID, VAR_8::VAR_18<InteractionPack> > m_interactionPacks; /// Current map from view type to camera type CLASS_6::IMPORT_11< gui::ViewType, VAR_0::CameraType > VAR_19; /// Map from view type to default crosshairs type static const CLASS_6::IMPORT_11< gui::ViewType, CrosshairsType > smk_viewTypeToDefaultCrosshairsTypeMap; static CrosshairsType FUNC_16( const gui::ViewType& ); /// Map from view type to default camera type static const CLASS_6::IMPORT_11< gui::ViewType, VAR_0::CameraType > VAR_20; static CLASS_1::CameraType FUNC_17( const gui::ViewType& ); /// Map from camera type to projection type static const CLASS_6::IMPORT_11< VAR_0::CameraType, VAR_0::ProjectionType > VAR_21; static CLASS_1::ProjectionType FUNC_18( const CLASS_1::CameraType& ); /// Map from camera type to default start frame linking type. This defines the /// Coordinate frame to which a camera start frame is linked. static const CLASS_6::IMPORT_11< VAR_0::CameraType, LinkedFrameType > smk_cameraStartFrameTypeToDefaultLinkedStartFrameTypeMap; static LinkedFrameType FUNC_19( const CLASS_1::CameraType& ); /// Map from camera type to default camera start frame type static const CLASS_6::IMPORT_11< VAR_0::CameraType, VAR_22 > VAR_23; static CLASS_13 FUNC_20( const CLASS_1::CameraType& ); /// Default map from start frame type to start frame /// Anatomical coordinate frame transformation applied atop the linked frame, /// This is used for defining the Axial, Coronal, Sagittal, etc. anatomical transformations. /// The frame's "world_O_frame" transformation really maps linkedFrame_O_anatomicalFrame. static const CLASS_6::IMPORT_11< VAR_22, VAR_13::VAR_24 > smk_cameraStartFrameTypeToDefaultAnatomicalRotationMap; static CLASS_8::VAR_24 FUNC_21( const CLASS_13& ); /// @note Taken together, the concatenation of the two transformations /// (world_O_linkedFrame * linkedFrame_O_anatomicalFrame), /// i.e. linkedFrame.world_O_frame * anatomicalFrame.world_O_frame /// defines the "start anatomical frame" for the view camera. }; #endif // INTERACTION_MANAGER_H
0.605212
{'IMPORT_0': 'common/AABB.h', 'IMPORT_1': 'common/UID.h', 'IMPORT_2': 'gui/layout/ViewTypeRange.h', 'IMPORT_3': 'common/CoordinateFrameLinkingType.h', 'IMPORT_4': 'common/PublicTypes.h', 'IMPORT_5': 'logic/CrosshairsType.h', 'IMPORT_6': 'logic/interaction/InteractionModes.h', 'IMPORT_7': 'logic/interaction/InteractionHandlerType.h', 'IMPORT_8': 'glm/fwd.hpp', 'IMPORT_9': 'functional', 'IMPORT_10': 'optional', 'IMPORT_11': 'unordered_map', 'CLASS_0': 'namespace', 'VAR_0': 'camera', 'CLASS_1': 'camera', 'VAR_1': 'InteractionManager', 'FUNC_0': 'InteractionManager', 'CLASS_2': 'InteractionManager', 'VAR_2': 'enum', 'VAR_3': 'ActiveSlideViewDirection', 'CLASS_3': 'ActiveSlideViewDirection', 'VAR_4': 'GetterType', 'CLASS_4': 'GetterType', 'VAR_5': 'viewUidAndTypeRangeProvider', 'VAR_6': 'CoordinateFrame', 'CLASS_5': 'CoordinateFrame', 'VAR_7': 'default', 'FUNC_1': 'setRefSpaceAABBoxProvider', 'VAR_8': 'std', 'CLASS_6': 'std', 'VAR_9': 'viewUid', 'FUNC_2': 'getCamera', 'VAR_10': 'const', 'CLASS_7': 'InteractionModeType', 'FUNC_3': 'getActiveInteractionHandler', 'FUNC_4': 'setActiveSlideViewDirection', 'FUNC_5': 'getActiveSlideViewDirection', 'FUNC_6': 'setupCamerasForAABBox', 'VAR_11': 'worldRefAABB', 'FUNC_7': 'setCameraNearDistance', 'VAR_12': 'distance', 'FUNC_8': 'getCameraType', 'FUNC_9': 'getCrosshairsType', 'FUNC_10': 'applyExtraToCameras', 'CLASS_8': 'glm', 'VAR_13': 'glm', 'VAR_14': 'extra', 'CLASS_9': 'CameraInteractionMode', 'FUNC_11': 'setCrosshairsInteractionMode', 'CLASS_10': 'CrosshairsInteractionMode', 'FUNC_12': 'setRefImageInteractionMode', 'CLASS_11': 'StackInteractionMode', 'FUNC_13': 'setSlideInteractionMode', 'FUNC_14': 'setWindowLevelInteractionMode', 'CLASS_12': 'WindowLevelInteractionMode', 'FUNC_15': 'computeStartFrame', 'VAR_15': 'm_slideStackAABBoxProvider', 'VAR_16': 'm_slideStackCrosshairsFrameProvider', 'VAR_17': 'm_slideStackFrameProvider', 'VAR_18': 'unique_ptr', 'VAR_19': 'm_viewTypeToCameraTypeMap', 'FUNC_16': 'getDefaultCrosshairsType', 'VAR_20': 'smk_viewTypeToDefaultCameraTypeMap', 'FUNC_17': 'getDefaultCameraType', 'VAR_21': 'smk_cameraTypeToProjectionTypeMap', 'FUNC_18': 'getProjectionType', 'FUNC_19': 'getDefaultLinkedStartFrameType', 'VAR_22': 'CameraStartFrameType', 'CLASS_13': 'CameraStartFrameType', 'VAR_23': 'smk_cameraTypeToDefaultStartFrameTypeMap', 'FUNC_20': 'getDefaultCameraStartFrameType', 'VAR_24': 'quat', 'FUNC_21': 'getDefaultAnatomicalRotation'}
/******************************************************************************* can.c - description ------------------- begin : 28.02.2017 copyright : (C) 2017 by MHS-Elektronik GmbH & Co. KG, Germany http://www.mhs-elektronik.de autho : <NAME>, <EMAIL> *******************************************************************************/ /*************************************************************************** * * * This program is free software, you can redistribute it and/or modify * * it under the terms of the MIT License <LICENSE.TXT or * * http://opensource.org/licenses/MIT> * * * ***************************************************************************/ #include <math.h> #include <gtk/gtk.h> #include "util.h" #include "can_drv.h" #include "mhs_g_messages.h" #include "mhs_msg_types.h" #include "main.h" #include "can.h" /*************************************/ /* SETUP */ /*************************************/ #ifdef __WIN32__ #deinfe DRIVER_FILE "mhstcan.dll" #define FULL_DRIVER_FILE NULL #else #define DRIVER_FILE "libmhstcan.so" #define FULL_DRIVER_FILE "/opt/tiny_can/can_api/libmhstcan.so" #endif #define CAN_SPEED 500 // 500 kBit/s #define DEVICE_SNR NULL // "Snr=01000001" // Name | ID | PGN | DLC | Int. | // | | Time | | | //----------+------------+-------+-----+-------+--------------------- #define J1939_ID1 0x18FEEE00 // EET | 0x18FEEE00 | 65262 | 8 | 1s | Electronic Engine Temperature #define J1939_ID2 0x18FEEF00 // EFL/P | 0x18FEEF00 | 65263 | 8 | 500ms | Engine Fluid Level/Pressure #define J1939_ID3 0x0CF00400 // EEC1 | 0x0CF00400 | 61444 | 8 | 10ms | Electronic Engine Controller #define J1939_ID4 0x18FEF600 // IC1 | 0x18FEF600 | 56270 | 8 | 500ms | Inlet / Exhaust Conditions 1 #define J1939_ID5 0x18FEF200 // LFE | 0x18FEF200 | 65266 | 8 | 100ms | Fuel Economy (Liquid) #define J1939_ID1_IDX (1 | INDEX_SOFT_FLAG) #define J1939_ID2_IDX (2 | INDEX_SOFT_FLAG) #define J1939_ID3_IDX (3 | INDEX_SOFT_FLAG) #define J1939_ID4_IDX (4 | INDEX_SOFT_FLAG) #define J1939_ID5_IDX (5 | INDEX_SOFT_FLAG) #define PNP_EVENT 0x00000001 #define SCAN_EVENT 0x00000002 static const uint32_t J1939IdTab[] = {J1939_ID1, J1939_ID2, J1939_ID3, J1939_ID4, J1939_ID5, 0xFFFFFFFF}; static const uint32_t J1939IdxTab[] = {J1939_ID1_IDX, J1939_ID2_IDX, J1939_ID3_IDX, J1939_ID4_IDX, J1939_ID5_IDX}; static const guint RxDMessageTimeout = 3000; // 3 Sek. static guint64 LastRxDDataTime = 0; static int32_t LastNumDevs = -1; static gint FilterSetup(void) { uint32_t id; gint res, i; struct TMsgFilter msg_filter; msg_filter.FilFlags = 0L; // Alle Flags mit 0 Initialisieren msg_filter.FilEFF = 1; // Extended Frame Format msg_filter.FilIdMode = 2; // 2 = Single Id msg_filter.FilMode = 1; // 1 = Nachricht nicht enfernen msg_filter.FilEnable = 1; // Filter freigeben for (i = 0; (id = J1939IdTab[i]) != 0xFFFFFFFF; i++) { msg_filter.Code = id; if ((res = (gint)CanSetFilter(J1939IdxTab[i], &msg_filter)) < 0) break; } return(res); } gint J1939CanInit(struct TCanCore *can_core) { char *str; gint err; can_core->AppCanStatus = APP_CAN_INIT; safe_free(can_core->DriverFileName); can_core->DriverFileName = g_strdup(DRIVER_FILE); safe_free(can_core->DriverInfoStr); safe_free(can_core->LastErrorString); // **** Treiber DLL laden if ((err = (gint)LoadDriver(FULL_DRIVER_FILE)) < 0) can_core->LastErrorString = g_strdup_printf("LoadDriver Error-Code:%d", err); // **** Treiber DLL initialisieren else if ((err = (gint)CanExInitDriver("CanCallThread=0")) < 0) can_core->LastErrorString = g_strdup_printf("CanExInitDriver Error-Code:%d", err); else if ((err = (gint)CanExCreateDevice(&can_core->DeviceIndex, NULL)) < 0) can_core->LastErrorString = g_strdup_printf("CanExCreateDevice Error-Code:%d", err); else if ((err = CanExCreateFifo(INDEX_AUTOBAUD_FIFO, 1000, NULL, 0, 0xFFFFFFFF))) can_core->LastErrorString = g_strdup_printf("CanExCreateFifo Error-Code:%d", err); // Empfangs FIFO erzeugen else if ((err = CanExCreateFifo(INDEX_TRACE_FIFO, 100000, NULL, 0, 0xFFFFFFFF))) can_core->LastErrorString = g_strdup_printf("CanExCreateFifo Error-Code:%d", err); // **** Filter konfigurieren else if ((err = FilterSetup()) < 0) can_core->LastErrorString = g_strdup_printf("FilterSetup Error-Code:%d", err); if (err < 0) can_core->AppCanStatus = APP_CAN_DRIVER_ERROR; else { if ((str = CanDrvInfo())) can_core->DriverInfoStr = g_strdup(str); can_core->AppCanStatus = APP_CAN_CLOSE; } return(err); } void J1939CanDown(struct TCanCore *can_core) { if (can_core->AppCanStatus >= APP_CAN_OPEN) J1939CanClose(can_core); J1939PnPStop(can_core); // **** Treiber entladen UnloadDriver(); } gint J1939CanOpen(struct TCanCore *can_core) { gint err; if ((can_core->AppCanStatus == APP_CAN_INIT) || (can_core->AppCanStatus == APP_CAN_DRIVER_ERROR)) return(-1); safe_free(can_core->LastErrorString); if (can_core->AppCanStatus >= APP_CAN_OPEN) J1939CanClose(can_core); // **** Schnittstelle PC <-> USB-Tiny öffnen if ((err = (gint)CanDeviceOpen(can_core->DeviceIndex, DEVICE_SNR)) < 0) can_core->LastErrorString = g_strdup_printf("CanDeviceOpen Error-Code:%d", err); else if ((err = (gint)CanExGetDeviceInfo(can_core->DeviceIndex, &can_core->DeviceInfo, NULL, NULL)) < 0) { can_core->LastErrorString = g_strdup_printf("CanExGetDeviceInfo Error-Code:%d", err); J1939CanClose(can_core); } if (err >= 0) { // **** Übertragungsgeschwindigkeit einstellen CanSetSpeed(can_core->DeviceIndex, can_core->CanSpeed); // **** CAN Bus Start CanSetMode(can_core->DeviceIndex, OP_CAN_START_LOM, CAN_CMD_CLEAR_NO_SW_FILTER_CHANGE); } if (err) can_core->AppCanStatus = APP_CAN_OPEN_ERROR; else can_core->AppCanStatus = APP_CAN_RUN; return(err); } void J1939CanClose(struct TCanCore *can_core) { if ((can_core->AppCanStatus == APP_CAN_INIT) || (can_core->AppCanStatus == APP_CAN_DRIVER_ERROR)) return; CanDeviceClose(can_core->DeviceIndex); can_core->AppCanStatus = APP_CAN_CLOSE; } void J1939CanReadMessages(struct TCanCore *can_core, struct TJ1939Data *d) { gdouble value; struct TCanMsg msg; struct TDeviceStatus status; guint hit; hit = 0; if (can_core->AppCanStatus < APP_CAN_RUN) return; /*********************************/ /* Status abfragen & auswerten */ /*********************************/ CanGetDeviceStatus(can_core->DeviceIndex, &status); if (status.DrvStatus >= DRV_STATUS_CAN_OPEN) { if (status.CanStatus == CAN_STATUS_BUS_OFF) CanSetMode(can_core->DeviceIndex, OP_CAN_RESET, CAN_CMD_NONE); } else { can_core->AppCanStatus = APP_CAN_CLOSE; return; } if (CanReceive(J1939_ID1_IDX, &msg, 1) > 0) // id = 0x18FEEE00 { if (msg.MsgLen >= 4) { hit |= 0x0001; value = msg.MsgData[0]; // Wassertemperatur d->WaterTemp = value - 40; // -40 - +215 °C value = msg.MsgData[1]; // Kraftstofftemperatur d->FuelTemp = value - 40; // -40 - +215 °C value = ((msg.MsgData[3] << 8) | msg.MsgData[2]) ; // Öltemperatur d->OilTemp = (value * 0.03125) - 273; } } if (CanReceive(J1939_ID2_IDX, &msg, 1) > 0) // id = 0x18FEEF00 { if (msg.MsgLen >= 4) { hit |= 0x0002; value = msg.MsgData[2]; // Ölstand [###.#] d->OilLevel = value * 0.4; value = msg.MsgData[3]; // Öldruck [##.##] d->OilPressure = value * 0.04; } } if (CanReceive(J1939_ID3_IDX, &msg, 1) > 0) // id = 0x0CF00400 { if (msg.MsgLen >= 5) { hit |= 0x0004; value = msg.MsgData[2]; // Drehmoment d->EngineTorque = value - 125; value = ((msg.MsgData[4] << 8) | msg.MsgData[3]) ; // Drehzahl d->Rpm = value * 0.125; } } if (CanReceive(J1939_ID4_IDX, &msg, 1) > 0) // id = 0x18FEF600 { if (msg.MsgLen >= 3) { hit |= 0x0008; value = msg.MsgData[1]; // Ladedruck d->TurbochargerPressure = value * 0.02; // [##.##] value = msg.MsgData[2]; // Ansauglufttemp (ladeluft) d->AirTemp = value - 40; // -40 - +215 °C } } if (CanReceive(J1939_ID5_IDX, &msg, 1) > 0) // id = 0x18FEF200 { if (msg.MsgLen >= 2) { hit |= 0x0010; value = ((msg.MsgData[1] << 8) | msg.MsgData[0]) ; // Verbrauch d->FuelConsumptionInL = value * 0.05; // in l/h [##.##] //d->FuelConsumptionInKg = d->FuelConsumptionInL * 0.92; // in kg [##.##] <*> } } if (hit) { LastRxDDataTime = TimeNow; can_core->AppCanStatus = APP_CAN_RUN_RECEIVE; } else { if ((TimeNow - LastRxDDataTime) >= (RxDMessageTimeout * 1000)) can_core->AppCanStatus = APP_CAN_RUN; } } /********************/ /* PnP Event Thread */ /********************/ static gpointer PnPThreadExecute(gpointer data) { uint32_t event; int32_t num_devs; struct TCanCore *can_core; TMhsGMessage *g_msg; can_core = (struct TCanCore *)data; do { event = CanExWaitForEvent(can_core->PnPEvent, 0); if (event & 0x80000000) // Beenden Event, Thread Schleife verlassen break; else if (event & (PNP_EVENT | SCAN_EVENT)) // Pluy & Play Event { can_core->DevicesListCount = 0; CanExDataFree((void **)&can_core->DevicesList); if ((num_devs = CanExGetDeviceList(&can_core->DevicesList, 0)) > 0) can_core->DevicesListCount = num_devs; if ((!(event & PNP_EVENT)) || (num_devs != LastNumDevs)) { LastNumDevs = num_devs; g_msg = mhs_g_new_message(MHS_MSG_PNP_EVENT, &num_devs, sizeof(int32_t)); mhs_g_message_post(can_core->Scheduler, g_msg); } } } while (1); return(NULL); } gint J1939PnPStart(struct TCanCore *can_core, TMhsGScheduler *scheduler) { LastNumDevs = -1; can_core->Scheduler = scheduler; can_core->PnPEvent = CanExCreateEvent(); // Event Objekt erstellen CanExSetObjEvent(INDEX_INVALID, MHS_EVS_PNP, can_core->PnPEvent, PNP_EVENT); // Thread erzeugen und starten can_core->PnPThread = g_thread_new(NULL, PnPThreadExecute, can_core); return(0); } void J1939PnPScan(struct TCanCore *can_core) { CanExSetEvent(can_core->PnPEvent, SCAN_EVENT); } void J1939PnPStop(struct TCanCore *can_core) { if (can_core->PnPThread) { // Terminate Event setzen CanExSetEvent(can_core->PnPEvent, MHS_TERMINATE); g_thread_join(can_core->PnPThread); can_core->PnPThread = NULL; } }
/******************************************************************************* can.c - description ------------------- begin : 28.02.2017 copyright : (C) 2017 by MHS-Elektronik GmbH & Co. KG, Germany http://www.mhs-elektronik.de autho : <NAME>, <EMAIL> *******************************************************************************/ /*************************************************************************** * * * This program is free software, you can redistribute it and/or modify * * it under the terms of the MIT License <LICENSE.TXT or * * http://opensource.org/licenses/MIT> * * * ***************************************************************************/ #include <math.h> #include <gtk/gtk.h> #include "util.h" #include "can_drv.h" #include "IMPORT_0" #include "IMPORT_1" #include "IMPORT_2" #include "can.h" /*************************************/ /* SETUP */ /*************************************/ #ifdef VAR_0 #deinfe DRIVER_FILE "mhstcan.dll" #define VAR_1 NULL #else #define DRIVER_FILE "libmhstcan.so" #define VAR_1 "/opt/tiny_can/can_api/libmhstcan.so" #endif #define CAN_SPEED 500 // 500 kBit/s #define DEVICE_SNR NULL // "Snr=01000001" // Name | ID | PGN | DLC | Int. | // | | Time | | | //----------+------------+-------+-----+-------+--------------------- #define VAR_2 0x18FEEE00 // EET | 0x18FEEE00 | 65262 | 8 | 1s | Electronic Engine Temperature #define VAR_3 0x18FEEF00 // EFL/P | 0x18FEEF00 | 65263 | 8 | 500ms | Engine Fluid Level/Pressure #define VAR_4 0x0CF00400 // EEC1 | 0x0CF00400 | 61444 | 8 | 10ms | Electronic Engine Controller #define VAR_5 0x18FEF600 // IC1 | 0x18FEF600 | 56270 | 8 | 500ms | Inlet / Exhaust Conditions 1 #define J1939_ID5 0x18FEF200 // LFE | 0x18FEF200 | 65266 | 8 | 100ms | Fuel Economy (Liquid) #define J1939_ID1_IDX (1 | INDEX_SOFT_FLAG) #define VAR_6 (2 | INDEX_SOFT_FLAG) #define J1939_ID3_IDX (3 | INDEX_SOFT_FLAG) #define J1939_ID4_IDX (4 | INDEX_SOFT_FLAG) #define J1939_ID5_IDX (5 | INDEX_SOFT_FLAG) #define PNP_EVENT 0x00000001 #define VAR_7 0x00000002 static const uint32_t J1939IdTab[] = {VAR_2, VAR_3, VAR_4, VAR_5, J1939_ID5, 0xFFFFFFFF}; static const uint32_t J1939IdxTab[] = {J1939_ID1_IDX, VAR_6, J1939_ID3_IDX, J1939_ID4_IDX, J1939_ID5_IDX}; static const CLASS_0 VAR_8 = 3000; // 3 Sek. static guint64 VAR_9 = 0; static int32_t VAR_10 = -1; static CLASS_1 FUNC_0(void) { uint32_t id; CLASS_1 res, VAR_11; struct TMsgFilter msg_filter; msg_filter.VAR_12 = 0L; // Alle Flags mit 0 Initialisieren msg_filter.FilEFF = 1; // Extended Frame Format msg_filter.FilIdMode = 2; // 2 = Single Id msg_filter.FilMode = 1; // 1 = Nachricht nicht enfernen msg_filter.VAR_13 = 1; // Filter freigeben for (VAR_11 = 0; (id = J1939IdTab[VAR_11]) != 0xFFFFFFFF; VAR_11++) { msg_filter.Code = id; if ((res = (ID_0)CanSetFilter(J1939IdxTab[VAR_11], &msg_filter)) < 0) break; } return(res); } CLASS_1 J1939CanInit(struct TCanCore *can_core) { char *VAR_14; CLASS_1 err; can_core->VAR_15 = VAR_16; safe_free(can_core->DriverFileName); can_core->DriverFileName = FUNC_1(DRIVER_FILE); safe_free(can_core->DriverInfoStr); safe_free(can_core->VAR_17); // **** Treiber DLL laden if ((err = (ID_0)FUNC_2(VAR_1)) < 0) can_core->VAR_17 = g_strdup_printf("LoadDriver Error-Code:%d", err); // **** Treiber DLL initialisieren else if ((err = (ID_0)CanExInitDriver("CanCallThread=0")) < 0) can_core->VAR_17 = g_strdup_printf("CanExInitDriver Error-Code:%d", err); else if ((err = (ID_0)CanExCreateDevice(&can_core->DeviceIndex, NULL)) < 0) can_core->VAR_17 = g_strdup_printf("CanExCreateDevice Error-Code:%d", err); else if ((err = FUNC_3(VAR_18, 1000, NULL, 0, 0xFFFFFFFF))) can_core->VAR_17 = g_strdup_printf("CanExCreateFifo Error-Code:%d", err); // Empfangs FIFO erzeugen else if ((err = FUNC_3(VAR_19, 100000, NULL, 0, 0xFFFFFFFF))) can_core->VAR_17 = g_strdup_printf("CanExCreateFifo Error-Code:%d", err); // **** Filter konfigurieren else if ((err = FUNC_0()) < 0) can_core->VAR_17 = g_strdup_printf("FilterSetup Error-Code:%d", err); if (err < 0) can_core->VAR_15 = APP_CAN_DRIVER_ERROR; else { if ((VAR_14 = CanDrvInfo())) can_core->DriverInfoStr = FUNC_1(VAR_14); can_core->VAR_15 = APP_CAN_CLOSE; } return(err); } void FUNC_4(struct TCanCore *can_core) { if (can_core->VAR_15 >= VAR_20) FUNC_5(can_core); J1939PnPStop(can_core); // **** Treiber entladen UnloadDriver(); } CLASS_1 J1939CanOpen(struct TCanCore *can_core) { CLASS_1 err; if ((can_core->VAR_15 == VAR_16) || (can_core->VAR_15 == APP_CAN_DRIVER_ERROR)) return(-1); safe_free(can_core->VAR_17); if (can_core->VAR_15 >= VAR_20) FUNC_5(can_core); // **** Schnittstelle PC <-> USB-Tiny öffnen if ((err = (ID_0)CanDeviceOpen(can_core->DeviceIndex, DEVICE_SNR)) < 0) can_core->VAR_17 = g_strdup_printf("CanDeviceOpen Error-Code:%d", err); else if ((err = (ID_0)CanExGetDeviceInfo(can_core->DeviceIndex, &can_core->DeviceInfo, NULL, NULL)) < 0) { can_core->VAR_17 = g_strdup_printf("CanExGetDeviceInfo Error-Code:%d", err); FUNC_5(can_core); } if (err >= 0) { // **** Übertragungsgeschwindigkeit einstellen CanSetSpeed(can_core->DeviceIndex, can_core->VAR_21); // **** CAN Bus Start CanSetMode(can_core->DeviceIndex, OP_CAN_START_LOM, CAN_CMD_CLEAR_NO_SW_FILTER_CHANGE); } if (err) can_core->VAR_15 = VAR_22; else can_core->VAR_15 = APP_CAN_RUN; return(err); } void FUNC_5(struct TCanCore *can_core) { if ((can_core->VAR_15 == VAR_16) || (can_core->VAR_15 == APP_CAN_DRIVER_ERROR)) return; FUNC_6(can_core->DeviceIndex); can_core->VAR_15 = APP_CAN_CLOSE; } void FUNC_7(struct TCanCore *can_core, struct CLASS_2 *d) { CLASS_3 value; struct TCanMsg VAR_23; struct CLASS_4 status; CLASS_0 hit; hit = 0; if (can_core->VAR_15 < APP_CAN_RUN) return; /*********************************/ /* Status abfragen & auswerten */ /*********************************/ CanGetDeviceStatus(can_core->DeviceIndex, &status); if (status.DrvStatus >= VAR_24) { if (status.VAR_25 == VAR_26) CanSetMode(can_core->DeviceIndex, VAR_27, CAN_CMD_NONE); } else { can_core->VAR_15 = APP_CAN_CLOSE; return; } if (FUNC_8(J1939_ID1_IDX, &VAR_23, 1) > 0) // id = 0x18FEEE00 { if (VAR_23.MsgLen >= 4) { hit |= 0x0001; value = VAR_23.MsgData[0]; // Wassertemperatur d->VAR_28 = value - 40; // -40 - +215 °C value = VAR_23.MsgData[1]; // Kraftstofftemperatur d->FuelTemp = value - 40; // -40 - +215 °C value = ((VAR_23.MsgData[3] << 8) | VAR_23.MsgData[2]) ; // Öltemperatur d->OilTemp = (value * 0.03125) - 273; } } if (FUNC_8(VAR_6, &VAR_23, 1) > 0) // id = 0x18FEEF00 { if (VAR_23.MsgLen >= 4) { hit |= 0x0002; value = VAR_23.MsgData[2]; // Ölstand [###.#] d->OilLevel = value * 0.4; value = VAR_23.MsgData[3]; // Öldruck [##.##] d->VAR_29 = value * 0.04; } } if (FUNC_8(J1939_ID3_IDX, &VAR_23, 1) > 0) // id = 0x0CF00400 { if (VAR_23.MsgLen >= 5) { hit |= 0x0004; value = VAR_23.MsgData[2]; // Drehmoment d->EngineTorque = value - 125; value = ((VAR_23.MsgData[4] << 8) | VAR_23.MsgData[3]) ; // Drehzahl d->VAR_30 = value * 0.125; } } if (FUNC_8(J1939_ID4_IDX, &VAR_23, 1) > 0) // id = 0x18FEF600 { if (VAR_23.MsgLen >= 3) { hit |= 0x0008; value = VAR_23.MsgData[1]; // Ladedruck d->VAR_31 = value * 0.02; // [##.##] value = VAR_23.MsgData[2]; // Ansauglufttemp (ladeluft) d->VAR_32 = value - 40; // -40 - +215 °C } } if (FUNC_8(J1939_ID5_IDX, &VAR_23, 1) > 0) // id = 0x18FEF200 { if (VAR_23.MsgLen >= 2) { hit |= 0x0010; value = ((VAR_23.MsgData[1] << 8) | VAR_23.MsgData[0]) ; // Verbrauch d->VAR_33 = value * 0.05; // in l/h [##.##] //d->FuelConsumptionInKg = d->FuelConsumptionInL * 0.92; // in kg [##.##] <*> } } if (hit) { VAR_9 = TimeNow; can_core->VAR_15 = VAR_34; } else { if ((TimeNow - VAR_9) >= (VAR_8 * 1000)) can_core->VAR_15 = APP_CAN_RUN; } } /********************/ /* PnP Event Thread */ /********************/ static gpointer PnPThreadExecute(gpointer VAR_35) { uint32_t VAR_36; int32_t VAR_37; struct TCanCore *can_core; TMhsGMessage *VAR_38; can_core = (struct TCanCore *)VAR_35; do { VAR_36 = FUNC_9(can_core->PnPEvent, 0); if (VAR_36 & 0x80000000) // Beenden Event, Thread Schleife verlassen break; else if (VAR_36 & (PNP_EVENT | VAR_7)) // Pluy & Play Event { can_core->VAR_39 = 0; CanExDataFree((void **)&can_core->DevicesList); if ((VAR_37 = FUNC_10(&can_core->DevicesList, 0)) > 0) can_core->VAR_39 = VAR_37; if ((!(VAR_36 & PNP_EVENT)) || (VAR_37 != VAR_10)) { VAR_10 = VAR_37; VAR_38 = mhs_g_new_message(VAR_40, &VAR_37, sizeof(int32_t)); FUNC_11(can_core->Scheduler, VAR_38); } } } while (1); return(NULL); } CLASS_1 J1939PnPStart(struct TCanCore *can_core, CLASS_5 *scheduler) { VAR_10 = -1; can_core->Scheduler = scheduler; can_core->PnPEvent = FUNC_12(); // Event Objekt erstellen FUNC_13(VAR_41, VAR_42, can_core->PnPEvent, PNP_EVENT); // Thread erzeugen und starten can_core->VAR_43 = g_thread_new(NULL, PnPThreadExecute, can_core); return(0); } void FUNC_14(struct TCanCore *can_core) { CanExSetEvent(can_core->PnPEvent, VAR_7); } void J1939PnPStop(struct TCanCore *can_core) { if (can_core->VAR_43) { // Terminate Event setzen CanExSetEvent(can_core->PnPEvent, MHS_TERMINATE); FUNC_15(can_core->VAR_43); can_core->VAR_43 = NULL; } }
0.497775
{'IMPORT_0': 'mhs_g_messages.h', 'IMPORT_1': 'mhs_msg_types.h', 'IMPORT_2': 'main.h', 'VAR_0': '__WIN32__', 'VAR_1': 'FULL_DRIVER_FILE', 'VAR_2': 'J1939_ID1', 'VAR_3': 'J1939_ID2', 'VAR_4': 'J1939_ID3', 'VAR_5': 'J1939_ID4', 'VAR_6': 'J1939_ID2_IDX', 'VAR_7': 'SCAN_EVENT', 'CLASS_0': 'guint', 'VAR_8': 'RxDMessageTimeout', 'VAR_9': 'LastRxDDataTime', 'VAR_10': 'LastNumDevs', 'CLASS_1': 'gint', 'ID_0': 'gint', 'FUNC_0': 'FilterSetup', 'VAR_11': 'i', 'VAR_12': 'FilFlags', 'VAR_13': 'FilEnable', 'VAR_14': 'str', 'VAR_15': 'AppCanStatus', 'VAR_16': 'APP_CAN_INIT', 'FUNC_1': 'g_strdup', 'VAR_17': 'LastErrorString', 'FUNC_2': 'LoadDriver', 'FUNC_3': 'CanExCreateFifo', 'VAR_18': 'INDEX_AUTOBAUD_FIFO', 'VAR_19': 'INDEX_TRACE_FIFO', 'FUNC_4': 'J1939CanDown', 'VAR_20': 'APP_CAN_OPEN', 'FUNC_5': 'J1939CanClose', 'VAR_21': 'CanSpeed', 'VAR_22': 'APP_CAN_OPEN_ERROR', 'FUNC_6': 'CanDeviceClose', 'FUNC_7': 'J1939CanReadMessages', 'CLASS_2': 'TJ1939Data', 'CLASS_3': 'gdouble', 'VAR_23': 'msg', 'CLASS_4': 'TDeviceStatus', 'VAR_24': 'DRV_STATUS_CAN_OPEN', 'VAR_25': 'CanStatus', 'VAR_26': 'CAN_STATUS_BUS_OFF', 'VAR_27': 'OP_CAN_RESET', 'FUNC_8': 'CanReceive', 'VAR_28': 'WaterTemp', 'VAR_29': 'OilPressure', 'VAR_30': 'Rpm', 'VAR_31': 'TurbochargerPressure', 'VAR_32': 'AirTemp', 'VAR_33': 'FuelConsumptionInL', 'VAR_34': 'APP_CAN_RUN_RECEIVE', 'VAR_35': 'data', 'VAR_36': 'event', 'VAR_37': 'num_devs', 'VAR_38': 'g_msg', 'FUNC_9': 'CanExWaitForEvent', 'VAR_39': 'DevicesListCount', 'FUNC_10': 'CanExGetDeviceList', 'VAR_40': 'MHS_MSG_PNP_EVENT', 'FUNC_11': 'mhs_g_message_post', 'CLASS_5': 'TMhsGScheduler', 'FUNC_12': 'CanExCreateEvent', 'FUNC_13': 'CanExSetObjEvent', 'VAR_41': 'INDEX_INVALID', 'VAR_42': 'MHS_EVS_PNP', 'VAR_43': 'PnPThread', 'FUNC_14': 'J1939PnPScan', 'FUNC_15': 'g_thread_join'}
#include <stdarg.h> extern "C" { #include "celix_errno.h" #include "celix_log.h" } class CelixLogInterface { public: virtual ~CelixLogInterface(){} virtual void gmock_mock_framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, const char *fmsg) = 0; }; class MockCelixLog : public CelixLogInterface { public: virtual ~MockCelixLog(){}; //MOCK_METHOD6(gmock_mock_framework_log, void(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, const char *fmsg)); virtual void gmock_mock_framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, const char *fmsg) { framework_log(logger, level, func, file, line, fmsg); } };
#include <IMPORT_0> extern "C" { #include "celix_errno.h" #include "IMPORT_1" } CLASS_0 VAR_0 { public: virtual ~FUNC_0(){} virtual VAR_2 FUNC_1(CLASS_1 VAR_3, framework_log_level_t VAR_4, const char *func, const char *file, int line, const char *fmsg) = 0; }; CLASS_0 VAR_5 : VAR_1 VAR_0 { public: virtual ~FUNC_2(){}; //MOCK_METHOD6(gmock_mock_framework_log, void(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, const char *fmsg)); virtual VAR_2 FUNC_1(CLASS_1 VAR_3, framework_log_level_t VAR_4, const char *func, const char *file, int line, const char *fmsg) { FUNC_3(VAR_3, VAR_4, func, file, line, fmsg); } };
0.58573
{'IMPORT_0': 'stdarg.h', 'IMPORT_1': 'celix_log.h', 'CLASS_0': 'class', 'VAR_0': 'CelixLogInterface', 'FUNC_0': 'CelixLogInterface', 'VAR_1': 'public', 'VAR_2': 'void', 'FUNC_1': 'gmock_mock_framework_log', 'CLASS_1': 'framework_logger_pt', 'VAR_3': 'logger', 'VAR_4': 'level', 'VAR_5': 'MockCelixLog', 'FUNC_2': 'MockCelixLog', 'FUNC_3': 'framework_log'}
/*************************************************************************************** * Original Author: <NAME> * Created: 2018-10-13 * Copyright: <NAME> (https://github.com/GabrieleGiuseppini) ***************************************************************************************/ #pragma once #include "Font.h" #include "GlobalRenderContext.h" #include "RenderParameters.h" #include "ResourceLocator.h" #include "ShaderTypes.h" #include "TextureAtlas.h" #include "TextureTypes.h" #include <GameOpenGL/ShaderManager.h> #include <GameCore/GameTypes.h> #include <array> #include <memory> #include <optional> #include <string> #include <vector> namespace Render { /* * This class implements the machinery for rendering UI notifications. * * The class is fully owned by the RenderContext class. * * The geometry produced by this class is highly dependent on the screen * (canvas) size; for this reason, this context has to remember enough data * about the primitives it renders so to be able to re-calculate vertex * buffers when the screen size changes. */ class NotificationRenderContext { private: enum class TextNotificationType { StatusText = 0, NotificationText = 1, PhysicsProbeReading = 2, _Last = PhysicsProbeReading }; enum class NotificationAnchorPositionType { TopLeft, TopRight, BottomLeft, BottomRight, PhysicsProbeReadingDepth, PhysicsProbeReadingPressure, PhysicsProbeReadingSpeed, PhysicsProbeReadingTemperature, }; public: NotificationRenderContext( ResourceLocator const & resourceLocator, ShaderManager<ShaderManagerTraits> & shaderManager, GlobalRenderContext const & globalRenderContext); public: void UploadStart(); inline void UploadStatusTextStart() { UploadTextStart(TextNotificationType::StatusText); } inline void UploadStatusTextLine( std::string const & text, AnchorPositionType anchor, vec2f const & screenOffset, // In font cell-size fraction (0.0 -> 1.0) float alpha) { auto & textNotificationContext = mTextNotificationTypeContexts[static_cast<size_t>(TextNotificationType::StatusText)]; textNotificationContext.TextLines.emplace_back( text, TranslateAnchorPosition(anchor), screenOffset, alpha); } inline void UploadStatusTextEnd() { // Nop } inline void UploadNotificationTextStart() { UploadTextStart(TextNotificationType::NotificationText); } inline void UploadNotificationTextLine( std::string const & text, AnchorPositionType anchor, vec2f const & screenOffset, // In font cell-size fraction (0.0 -> 1.0) float alpha) { auto & textNotificationContext = mTextNotificationTypeContexts[static_cast<size_t>(TextNotificationType::NotificationText)]; textNotificationContext.TextLines.emplace_back( text, TranslateAnchorPosition(anchor), screenOffset, alpha); } inline void UploadNotificationTextEnd() { // Nop } inline void UploadTextureNotificationStart() { // // Texture notifications are sticky: we upload them once in a while and // continue drawing the same buffer // // Cleanup buffers mTextureNotifications.clear(); mIsTextureNotificationDataDirty = true; } inline void UploadTextureNotification( TextureFrameId<GenericLinearTextureGroups> const & textureFrameId, AnchorPositionType anchor, vec2f const & screenOffset, // In texture-size fraction (0.0 -> 1.0) float alpha) { // // Store notification data // mTextureNotifications.emplace_back( textureFrameId, anchor, screenOffset, alpha); } inline void UploadTextureNotificationEnd() { // Nop } inline void UploadPhysicsProbePanel(float open, bool isOpening) { // Clear vertex buffers mPhysicsProbePanelVertexBuffer.clear(); if (open != 0.0f) { // // Generate quad // // First 1/3rd of open: grow vertically // Last 2/3rds of open: grow horizontally float constexpr VerticalOpenFraction = 0.3333f; float const verticalOpen = (open < VerticalOpenFraction) ? open / VerticalOpenFraction : 1.0f; float const MinHorizontalOpen = 0.0125f; float const horizontalOpen = (open < VerticalOpenFraction) ? MinHorizontalOpen : MinHorizontalOpen + (1.0f - MinHorizontalOpen) * (open - VerticalOpenFraction) / (1.0f - VerticalOpenFraction); float const midYNdc = -1.f + mPhysicsProbePanelNdcDimensions.y / 2.0f; vec2f const quadTopLeft = vec2f( -1.0f, midYNdc + verticalOpen * (mPhysicsProbePanelNdcDimensions.y / 2.0f)); vec2f const quadBottomRight = vec2f( -1.0f + mPhysicsProbePanelNdcDimensions.x, midYNdc - verticalOpen * (mPhysicsProbePanelNdcDimensions.y / 2.0f)); vec2f const xLimits = vec2f( quadTopLeft.x + mPhysicsProbePanelNdcDimensions.x / 2.0f * (1.0f - horizontalOpen), quadBottomRight.x - mPhysicsProbePanelNdcDimensions.x / 2.0f * (1.0f - horizontalOpen)); float opening = isOpening ? 1.0f : 0.0f; // Get texture NDC dimensions (assuming all panels have equal dimensions) auto const & atlasFrame = mGenericLinearTextureAtlasMetadata.GetFrameMetadata(TextureFrameId<GenericLinearTextureGroups>(GenericLinearTextureGroups::PhysicsProbePanel, 0)); float const textureWidthNdc = atlasFrame.TextureCoordinatesTopRight.x - atlasFrame.TextureCoordinatesBottomLeft.x; float const textureHeightNdc = atlasFrame.TextureCoordinatesTopRight.y - atlasFrame.TextureCoordinatesBottomLeft.y; // Triangle 1 // Top-left mPhysicsProbePanelVertexBuffer.emplace_back( quadTopLeft, vec2f(0.0f, textureHeightNdc), xLimits, opening); // Top-right mPhysicsProbePanelVertexBuffer.emplace_back( vec2f(quadBottomRight.x, quadTopLeft.y), vec2f(textureWidthNdc, textureHeightNdc), xLimits, opening); // Bottom-left mPhysicsProbePanelVertexBuffer.emplace_back( vec2f(quadTopLeft.x, quadBottomRight.y), vec2f(0.0f, 0.0f), xLimits, opening); // Triangle 2 // Top-right mPhysicsProbePanelVertexBuffer.emplace_back( vec2f(quadBottomRight.x, quadTopLeft.y), vec2f(textureWidthNdc, textureHeightNdc), xLimits, opening); // Bottom-left mPhysicsProbePanelVertexBuffer.emplace_back( vec2f(quadTopLeft.x, quadBottomRight.y), vec2f(0.0f, 0.0f), xLimits, opening); // Bottom-right mPhysicsProbePanelVertexBuffer.emplace_back( quadBottomRight, vec2f(textureWidthNdc, 0.0f), xLimits, opening); } // Remember quad vertex buffer is dirty mIsPhysicsProbePanelVertexBufferDirty = true; } inline void UploadPhysicsProbeReading( std::string const & speed, std::string const & temperature, std::string const & depth, std::string const & pressure) { auto & textNotificationContext = mTextNotificationTypeContexts[static_cast<size_t>(TextNotificationType::PhysicsProbeReading)]; textNotificationContext.TextLines.clear(); textNotificationContext.TextLines.emplace_back( speed, NotificationAnchorPositionType::PhysicsProbeReadingSpeed, vec2f::zero(), 1.0f); textNotificationContext.TextLines.emplace_back( temperature, NotificationAnchorPositionType::PhysicsProbeReadingTemperature, vec2f::zero(), 1.0f); textNotificationContext.TextLines.emplace_back( depth, NotificationAnchorPositionType::PhysicsProbeReadingDepth, vec2f::zero(), 1.0f); textNotificationContext.TextLines.emplace_back( pressure, NotificationAnchorPositionType::PhysicsProbeReadingPressure, vec2f::zero(), 1.0f); textNotificationContext.AreTextLinesDirty = true; } inline void UploadPhysicsProbeReadingClear() { auto & textNotificationContext = mTextNotificationTypeContexts[static_cast<size_t>(TextNotificationType::PhysicsProbeReading)]; textNotificationContext.TextLines.clear(); textNotificationContext.AreTextLinesDirty = true; } inline void UploadHeatBlasterFlame( vec2f const & centerPosition, float radius, HeatBlasterActionType action) { // // Populate vertices // float const quadHalfSize = (radius * 1.5f) / 2.0f; // Add some slack for transparency float const left = centerPosition.x - quadHalfSize; float const right = centerPosition.x + quadHalfSize; float const top = centerPosition.y + quadHalfSize; float const bottom = centerPosition.y - quadHalfSize; // Triangle 1 mHeatBlasterFlameVertexBuffer[0].vertexPosition = vec2f(left, bottom); mHeatBlasterFlameVertexBuffer[0].flameSpacePosition = vec2f(-0.5f, -0.5f); mHeatBlasterFlameVertexBuffer[1].vertexPosition = vec2f(left, top); mHeatBlasterFlameVertexBuffer[1].flameSpacePosition = vec2f(-0.5f, 0.5f); mHeatBlasterFlameVertexBuffer[2].vertexPosition = vec2f(right, bottom); mHeatBlasterFlameVertexBuffer[2].flameSpacePosition = vec2f(0.5f, -0.5f); // Triangle 2 mHeatBlasterFlameVertexBuffer[3].vertexPosition = vec2f(left, top); mHeatBlasterFlameVertexBuffer[3].flameSpacePosition = vec2f(-0.5f, 0.5f); mHeatBlasterFlameVertexBuffer[4].vertexPosition = vec2f(right, bottom); mHeatBlasterFlameVertexBuffer[4].flameSpacePosition = vec2f(0.5f, -0.5f); mHeatBlasterFlameVertexBuffer[5].vertexPosition = vec2f(right, top); mHeatBlasterFlameVertexBuffer[5].flameSpacePosition = vec2f(0.5f, 0.5f); // // Store shader // switch (action) { case HeatBlasterActionType::Cool: { mHeatBlasterFlameShaderToRender = Render::ProgramType::HeatBlasterFlameCool; break; } case HeatBlasterActionType::Heat: { mHeatBlasterFlameShaderToRender = Render::ProgramType::HeatBlasterFlameHeat; break; } } } inline void UploadFireExtinguisherSpray( vec2f const & centerPosition, float radius) { // // Populate vertices // float const quadHalfSize = (radius * 3.5f) / 2.0f; // Add some slack to account for transparency float const left = centerPosition.x - quadHalfSize; float const right = centerPosition.x + quadHalfSize; float const top = centerPosition.y + quadHalfSize; float const bottom = centerPosition.y - quadHalfSize; // Triangle 1 mFireExtinguisherSprayVertexBuffer[0].vertexPosition = vec2f(left, bottom); mFireExtinguisherSprayVertexBuffer[0].spraySpacePosition = vec2f(-0.5f, -0.5f); mFireExtinguisherSprayVertexBuffer[1].vertexPosition = vec2f(left, top); mFireExtinguisherSprayVertexBuffer[1].spraySpacePosition = vec2f(-0.5f, 0.5f); mFireExtinguisherSprayVertexBuffer[2].vertexPosition = vec2f(right, bottom); mFireExtinguisherSprayVertexBuffer[2].spraySpacePosition = vec2f(0.5f, -0.5f); // Triangle 2 mFireExtinguisherSprayVertexBuffer[3].vertexPosition = vec2f(left, top); mFireExtinguisherSprayVertexBuffer[3].spraySpacePosition = vec2f(-0.5f, 0.5f); mFireExtinguisherSprayVertexBuffer[4].vertexPosition = vec2f(right, bottom); mFireExtinguisherSprayVertexBuffer[4].spraySpacePosition = vec2f(0.5f, -0.5f); mFireExtinguisherSprayVertexBuffer[5].vertexPosition = vec2f(right, top); mFireExtinguisherSprayVertexBuffer[5].spraySpacePosition = vec2f(0.5f, 0.5f); // // Store shader // mFireExtinguisherSprayShaderToRender = Render::ProgramType::FireExtinguisherSpray; } inline void UploadBlastToolHalo( vec2f const & centerPosition, float radius, float renderProgress, float personalitySeed) { // // Populate vertices // float const left = centerPosition.x - radius; float const right = centerPosition.x + radius; float const top = centerPosition.y + radius; float const bottom = centerPosition.y - radius; // Triangle 1 mBlastToolHaloVertexBuffer.emplace_back( vec2f(left, bottom), vec2f(-1.0f, -1.0f), renderProgress, personalitySeed); mBlastToolHaloVertexBuffer.emplace_back( vec2f(left, top), vec2f(-1.0f, 1.0f), renderProgress, personalitySeed); mBlastToolHaloVertexBuffer.emplace_back( vec2f(right, bottom), vec2f(1.0f, -1.0f), renderProgress, personalitySeed); // Triangle 2 mBlastToolHaloVertexBuffer.emplace_back( vec2f(left, top), vec2f(-1.0f, 1.0f), renderProgress, personalitySeed); mBlastToolHaloVertexBuffer.emplace_back( vec2f(right, bottom), vec2f(1.0f, -1.0f), renderProgress, personalitySeed); mBlastToolHaloVertexBuffer.emplace_back( vec2f(right, top), vec2f(1.0f, 1.0f), renderProgress, personalitySeed); } inline void UploadPressureInjectionHalo( vec2f const & centerPosition, float flowMultiplier) { // // Populate vertices // float const quadHalfSize = 9.0f / 2.0f; // Add some slack to account for transparency float const left = centerPosition.x - quadHalfSize; float const right = centerPosition.x + quadHalfSize; float const top = centerPosition.y + quadHalfSize; float const bottom = centerPosition.y - quadHalfSize; // Triangle 1 mPressureInjectionHaloVertexBuffer.emplace_back( vec2f(left, bottom), vec2f(-1.0f, -1.0f), flowMultiplier); mPressureInjectionHaloVertexBuffer.emplace_back( vec2f(left, top), vec2f(-1.0f, 1.0f), flowMultiplier); mPressureInjectionHaloVertexBuffer.emplace_back( vec2f(right, bottom), vec2f(1.0f, -1.0f), flowMultiplier); // Triangle 2 mPressureInjectionHaloVertexBuffer.emplace_back( vec2f(left, top), vec2f(-1.0f, 1.0f), flowMultiplier); mPressureInjectionHaloVertexBuffer.emplace_back( vec2f(right, bottom), vec2f(1.0f, -1.0f), flowMultiplier); mPressureInjectionHaloVertexBuffer.emplace_back( vec2f(right, top), vec2f(1.0f, 1.0f), flowMultiplier); } void UploadEnd(); void ProcessParameterChanges(RenderParameters const & renderParameters); void RenderPrepare(); void RenderDraw(); private: void ApplyViewModelChanges(RenderParameters const & renderParameters); void ApplyCanvasSizeChanges(RenderParameters const & renderParameters); void ApplyEffectiveAmbientLightIntensityChanges(RenderParameters const & renderParameters); void ApplyDisplayUnitsSystemChanges(RenderParameters const & renderParameters); inline void RenderPrepareTextNotifications(); inline void RenderDrawTextNotifications(); inline void RenderPrepareTextureNotifications(); inline void RenderDrawTextureNotifications(); inline void RenderPreparePhysicsProbePanel(); inline void RenderDrawPhysicsProbePanel(); inline void RenderPrepareHeatBlasterFlame(); inline void RenderDrawHeatBlasterFlame(); inline void RenderPrepareFireExtinguisherSpray(); inline void RenderDrawFireExtinguisherSpray(); inline void RenderPrepareBlastToolHalo(); inline void RenderDrawBlastToolHalo(); inline void RenderPreparePressureInjectionHalo(); inline void RenderDrawPressureInjectionHalo(); private: static inline constexpr NotificationAnchorPositionType TranslateAnchorPosition(AnchorPositionType anchor) { switch (anchor) { case Render::AnchorPositionType::TopLeft: return NotificationAnchorPositionType::TopLeft; case Render::AnchorPositionType::TopRight: return NotificationAnchorPositionType::TopRight; case Render::AnchorPositionType::BottomLeft: return NotificationAnchorPositionType::BottomLeft; case Render::AnchorPositionType::BottomRight: return NotificationAnchorPositionType::BottomRight; } return NotificationAnchorPositionType::BottomLeft; } struct FontTextureAtlasMetadata; struct TextNotificationTypeContext; inline void UploadTextStart(TextNotificationType textNotificationType) { // // Text notifications are sticky: we upload them once in a while and // continue drawing the same buffer // // Cleanup line buffers for this notification type auto & textContext = mTextNotificationTypeContexts[static_cast<size_t>(textNotificationType)]; textContext.TextLines.clear(); textContext.AreTextLinesDirty = true; } void GenerateTextVertices(TextNotificationTypeContext & context) const; void GenerateTextureNotificationVertices(); private: ShaderManager<ShaderManagerTraits> & mShaderManager; float mScreenToNdcX; float mScreenToNdcY; private: // // Types // #pragma pack(push, 1) struct TextureNotificationVertex { vec2f vertexPositionNDC; vec2f textureCoordinate; float alpha; TextureNotificationVertex( vec2f const & _vertexPositionNDC, vec2f const & _textureCoordinate, float _alpha) : vertexPositionNDC(_vertexPositionNDC) , textureCoordinate(_textureCoordinate) , alpha(_alpha) {} }; struct PhysicsProbePanelVertex { vec2f vertexPositionNDC; vec2f textureFrameOffset; vec2f xLimitsNDC; float vertexIsOpening; PhysicsProbePanelVertex( vec2f const & _vertexPositionNDC, vec2f const & _textureFrameOffset, vec2f const & _xLimitsNDC, float _vertexIsOpening) : vertexPositionNDC(_vertexPositionNDC) , textureFrameOffset(_textureFrameOffset) , xLimitsNDC(_xLimitsNDC) , vertexIsOpening(_vertexIsOpening) {} }; struct HeatBlasterFlameVertex { vec2f vertexPosition; vec2f flameSpacePosition; HeatBlasterFlameVertex() {} }; struct FireExtinguisherSprayVertex { vec2f vertexPosition; vec2f spraySpacePosition; FireExtinguisherSprayVertex() {} }; struct BlastToolHaloVertex { vec2f vertexPosition; vec2f haloSpacePosition; float renderProgress; float personalitySeed; BlastToolHaloVertex( vec2f _vertexPosition, vec2f _haloSpacePosition, float _renderProgress, float _personalitySeed) : vertexPosition(_vertexPosition) , haloSpacePosition(_haloSpacePosition) , renderProgress(_renderProgress) , personalitySeed(_personalitySeed) {} }; struct PressureInjectionHaloVertex { vec2f vertexPosition; vec2f haloSpacePosition; float flowMultiplier; PressureInjectionHaloVertex( vec2f _vertexPosition, vec2f _haloSpacePosition, float _flowMultiplier) : vertexPosition(_vertexPosition) , haloSpacePosition(_haloSpacePosition) , flowMultiplier(_flowMultiplier) {} }; #pragma pack(pop) // // Text notifications // /* * Metadata for each font in the single font atlas. */ struct FontTextureAtlasMetadata { vec2f CellTextureAtlasSize; // Size of one cell of the font, in texture atlas space coordinates std::array<vec2f, 256> GlyphTextureAtlasBottomLefts; // Bottom-left of each glyph, in texture atlas space coordinates std::array<vec2f, 256> GlyphTextureAtlasTopRights; // Top-right of each glyph, in texture atlas space coordinates FontMetadata OriginalFontMetadata; FontTextureAtlasMetadata( vec2f cellTextureAtlasSize, std::array<vec2f, 256> glyphTextureAtlasBottomLefts, std::array<vec2f, 256> glyphTextureAtlasTopRights, FontMetadata originalFontMetadata) : CellTextureAtlasSize(cellTextureAtlasSize) , GlyphTextureAtlasBottomLefts(std::move(glyphTextureAtlasBottomLefts)) , GlyphTextureAtlasTopRights(std::move(glyphTextureAtlasTopRights)) , OriginalFontMetadata(originalFontMetadata) {} }; std::vector<FontTextureAtlasMetadata> mFontTextureAtlasMetadata; // This vector is storage, allowing for N:1 between contextes and fonts /* * State per-line-of-text. */ struct TextLine { std::string Text; NotificationAnchorPositionType Anchor; vec2f ScreenOffset; // In font cell-size fraction (0.0 -> 1.0) float Alpha; TextLine( std::string const & text, NotificationAnchorPositionType anchor, vec2f const & screenOffset, float alpha) : Text(text) , Anchor(anchor) , ScreenOffset(screenOffset) , Alpha(alpha) {} }; /* * State per-text-notification-type. */ struct TextNotificationTypeContext { FontTextureAtlasMetadata const & NotificationFontTextureAtlasMetadata; // The metadata of the font to be used for this notification type std::vector<TextLine> TextLines; bool AreTextLinesDirty; // When dirty, we'll re-build the quads for this notification type std::vector<TextQuadVertex> TextQuadVertexBuffer; explicit TextNotificationTypeContext(FontTextureAtlasMetadata const & notificationFontTextureAtlasMetadata) : NotificationFontTextureAtlasMetadata(notificationFontTextureAtlasMetadata) , TextLines() , AreTextLinesDirty(false) , TextQuadVertexBuffer() {} }; std::vector<TextNotificationTypeContext> mTextNotificationTypeContexts; GameOpenGLVAO mTextVAO; size_t mCurrentTextQuadVertexBufferSize; // Number of elements (vertices) size_t mAllocatedTextQuadVertexBufferSize; // Number of elements (vertices) GameOpenGLVBO mTextVBO; // Fonts GameOpenGLTexture mFontAtlasTextureHandle; // // Texture notifications // TextureAtlasMetadata<GenericLinearTextureGroups> const & mGenericLinearTextureAtlasMetadata; struct TextureNotification { TextureFrameId<GenericLinearTextureGroups> FrameId; AnchorPositionType Anchor; vec2f ScreenOffset; // In texture-size fraction (0.0 -> 1.0) float Alpha; TextureNotification( TextureFrameId<GenericLinearTextureGroups> const & frameId, AnchorPositionType anchor, vec2f const & screenOffset, float alpha) : FrameId(frameId) , Anchor(anchor) , ScreenOffset(screenOffset) , Alpha(alpha) {} }; std::vector<TextureNotification> mTextureNotifications; bool mIsTextureNotificationDataDirty; // When dirty, we'll re-build and re-upload the vertex data GameOpenGLVAO mTextureNotificationVAO; std::vector<TextureNotificationVertex> mTextureNotificationVertexBuffer; GameOpenGLVBO mTextureNotificationVBO; // // Physics probe panel // GameOpenGLVAO mPhysicsProbePanelVAO; std::vector<PhysicsProbePanelVertex> mPhysicsProbePanelVertexBuffer; bool mIsPhysicsProbePanelVertexBufferDirty; GameOpenGLVBO mPhysicsProbePanelVBO; vec2f mPhysicsProbePanelNdcDimensions; // // Tool notifications // GameOpenGLVAO mHeatBlasterFlameVAO; std::array<HeatBlasterFlameVertex, 6> mHeatBlasterFlameVertexBuffer; GameOpenGLVBO mHeatBlasterFlameVBO; std::optional<Render::ProgramType> mHeatBlasterFlameShaderToRender; GameOpenGLVAO mFireExtinguisherSprayVAO; std::array<FireExtinguisherSprayVertex, 6> mFireExtinguisherSprayVertexBuffer; GameOpenGLVBO mFireExtinguisherSprayVBO; std::optional<Render::ProgramType> mFireExtinguisherSprayShaderToRender; GameOpenGLVAO mBlastToolHaloVAO; std::vector<BlastToolHaloVertex> mBlastToolHaloVertexBuffer; GameOpenGLVBO mBlastToolHaloVBO; GameOpenGLVAO mPressureInjectionHaloVAO; std::vector<PressureInjectionHaloVertex> mPressureInjectionHaloVertexBuffer; GameOpenGLVBO mPressureInjectionHaloVBO; }; }
/*************************************************************************************** * Original Author: <NAME> * Created: 2018-10-13 * Copyright: <NAME> (https://github.com/GabrieleGiuseppini) ***************************************************************************************/ #pragma once #include "Font.h" #include "GlobalRenderContext.h" #include "IMPORT_0" #include "ResourceLocator.h" #include "ShaderTypes.h" #include "TextureAtlas.h" #include "TextureTypes.h" #include <IMPORT_1> #include <GameCore/GameTypes.h> #include <array> #include <IMPORT_2> #include <IMPORT_3> #include <string> #include <vector> CLASS_0 Render { /* * This class implements the machinery for rendering UI notifications. * * The class is fully owned by the RenderContext class. * * The geometry produced by this class is highly dependent on the screen * (canvas) size; for this reason, this context has to remember enough data * about the primitives it renders so to be able to re-calculate vertex * buffers when the screen size changes. */ CLASS_1 NotificationRenderContext { private: VAR_0 CLASS_1 VAR_1 { StatusText = 0, VAR_2 = 1, PhysicsProbeReading = 2, VAR_3 = PhysicsProbeReading }; enum CLASS_1 NotificationAnchorPositionType { TopLeft, TopRight, VAR_4, BottomRight, PhysicsProbeReadingDepth, VAR_5, VAR_6, PhysicsProbeReadingTemperature, }; public: NotificationRenderContext( ResourceLocator VAR_7 & VAR_8, ShaderManager<ShaderManagerTraits> & shaderManager, GlobalRenderContext VAR_7 & globalRenderContext); public: void UploadStart(); inline void UploadStatusTextStart() { UploadTextStart(ID_0::StatusText); } inline void UploadStatusTextLine( std::string VAR_7 & text, AnchorPositionType VAR_9, vec2f const & VAR_10, // In font cell-size fraction (0.0 -> 1.0) float VAR_11) { auto & VAR_12 = mTextNotificationTypeContexts[static_cast<size_t>(VAR_1::StatusText)]; VAR_12.VAR_13.FUNC_0( text, TranslateAnchorPosition(VAR_9), VAR_10, VAR_11); } inline void UploadStatusTextEnd() { // Nop } inline void UploadNotificationTextStart() { UploadTextStart(ID_0::VAR_2); } inline void UploadNotificationTextLine( std::string VAR_7 & text, AnchorPositionType VAR_9, vec2f const & VAR_10, // In font cell-size fraction (0.0 -> 1.0) float VAR_11) { auto & VAR_12 = mTextNotificationTypeContexts[static_cast<size_t>(VAR_1::VAR_2)]; VAR_12.VAR_13.FUNC_0( text, TranslateAnchorPosition(VAR_9), VAR_10, VAR_11); } inline void UploadNotificationTextEnd() { // Nop } inline void UploadTextureNotificationStart() { // // Texture notifications are sticky: we upload them once in a while and // continue drawing the same buffer // // Cleanup buffers mTextureNotifications.FUNC_1(); mIsTextureNotificationDataDirty = true; } inline void UploadTextureNotification( TextureFrameId<GenericLinearTextureGroups> const & VAR_14, AnchorPositionType VAR_9, vec2f const & VAR_10, // In texture-size fraction (0.0 -> 1.0) float VAR_11) { // // Store notification data // mTextureNotifications.FUNC_0( VAR_14, VAR_9, VAR_10, VAR_11); } inline void UploadTextureNotificationEnd() { // Nop } inline void UploadPhysicsProbePanel(float open, bool VAR_15) { // Clear vertex buffers VAR_16.FUNC_1(); if (open != 0.0f) { // // Generate quad // // First 1/3rd of open: grow vertically // Last 2/3rds of open: grow horizontally float constexpr VerticalOpenFraction = 0.3333f; float const verticalOpen = (open < VerticalOpenFraction) ? open / VerticalOpenFraction : 1.0f; float const VAR_17 = 0.0125f; float const horizontalOpen = (open < VerticalOpenFraction) ? VAR_17 : VAR_17 + (1.0f - VAR_17) * (open - VerticalOpenFraction) / (1.0f - VerticalOpenFraction); float const VAR_18 = -1.f + mPhysicsProbePanelNdcDimensions.y / 2.0f; vec2f const VAR_19 = vec2f( -1.0f, VAR_18 + verticalOpen * (mPhysicsProbePanelNdcDimensions.y / 2.0f)); vec2f const VAR_20 = vec2f( -1.0f + mPhysicsProbePanelNdcDimensions.x, VAR_18 - verticalOpen * (mPhysicsProbePanelNdcDimensions.y / 2.0f)); vec2f const VAR_21 = vec2f( VAR_19.x + mPhysicsProbePanelNdcDimensions.x / 2.0f * (1.0f - horizontalOpen), VAR_20.x - mPhysicsProbePanelNdcDimensions.x / 2.0f * (1.0f - horizontalOpen)); float VAR_22 = VAR_15 ? 1.0f : 0.0f; // Get texture NDC dimensions (assuming all panels have equal dimensions) auto const & atlasFrame = mGenericLinearTextureAtlasMetadata.FUNC_2(TextureFrameId<GenericLinearTextureGroups>(GenericLinearTextureGroups::PhysicsProbePanel, 0)); float const textureWidthNdc = atlasFrame.TextureCoordinatesTopRight.x - atlasFrame.TextureCoordinatesBottomLeft.x; float const textureHeightNdc = atlasFrame.TextureCoordinatesTopRight.y - atlasFrame.TextureCoordinatesBottomLeft.y; // Triangle 1 // Top-left VAR_16.FUNC_0( VAR_19, vec2f(0.0f, textureHeightNdc), VAR_21, VAR_22); // Top-right VAR_16.FUNC_0( vec2f(VAR_20.x, VAR_19.y), vec2f(textureWidthNdc, textureHeightNdc), VAR_21, VAR_22); // Bottom-left VAR_16.FUNC_0( vec2f(VAR_19.x, VAR_20.y), vec2f(0.0f, 0.0f), VAR_21, VAR_22); // Triangle 2 // Top-right VAR_16.FUNC_0( vec2f(VAR_20.x, VAR_19.y), vec2f(textureWidthNdc, textureHeightNdc), VAR_21, VAR_22); // Bottom-left VAR_16.FUNC_0( vec2f(VAR_19.x, VAR_20.y), vec2f(0.0f, 0.0f), VAR_21, VAR_22); // Bottom-right VAR_16.FUNC_0( VAR_20, vec2f(textureWidthNdc, 0.0f), VAR_21, VAR_22); } // Remember quad vertex buffer is dirty VAR_23 = true; } inline void UploadPhysicsProbeReading( std::string VAR_7 & speed, std::string VAR_7 & VAR_24, std::string VAR_7 & depth, std::string VAR_7 & pressure) { auto & VAR_12 = mTextNotificationTypeContexts[static_cast<size_t>(VAR_1::PhysicsProbeReading)]; VAR_12.VAR_13.FUNC_1(); VAR_12.VAR_13.FUNC_0( speed, NotificationAnchorPositionType::VAR_6, vec2f::FUNC_3(), 1.0f); VAR_12.VAR_13.FUNC_0( VAR_24, NotificationAnchorPositionType::PhysicsProbeReadingTemperature, vec2f::FUNC_3(), 1.0f); VAR_12.VAR_13.FUNC_0( depth, NotificationAnchorPositionType::PhysicsProbeReadingDepth, vec2f::FUNC_3(), 1.0f); VAR_12.VAR_13.FUNC_0( pressure, NotificationAnchorPositionType::VAR_5, vec2f::FUNC_3(), 1.0f); VAR_12.AreTextLinesDirty = true; } inline void FUNC_4() { auto & VAR_12 = mTextNotificationTypeContexts[static_cast<size_t>(VAR_1::PhysicsProbeReading)]; VAR_12.VAR_13.FUNC_1(); VAR_12.AreTextLinesDirty = true; } inline void UploadHeatBlasterFlame( vec2f const & centerPosition, float VAR_25, HeatBlasterActionType action) { // // Populate vertices // float const VAR_26 = (VAR_25 * 1.5f) / 2.0f; // Add some slack for transparency float const left = centerPosition.x - VAR_26; float const VAR_27 = centerPosition.x + VAR_26; float const top = centerPosition.y + VAR_26; float const bottom = centerPosition.y - VAR_26; // Triangle 1 mHeatBlasterFlameVertexBuffer[0].VAR_28 = vec2f(left, bottom); mHeatBlasterFlameVertexBuffer[0].VAR_29 = vec2f(-0.5f, -0.5f); mHeatBlasterFlameVertexBuffer[1].VAR_28 = vec2f(left, top); mHeatBlasterFlameVertexBuffer[1].VAR_29 = vec2f(-0.5f, 0.5f); mHeatBlasterFlameVertexBuffer[2].VAR_28 = vec2f(VAR_27, bottom); mHeatBlasterFlameVertexBuffer[2].VAR_29 = vec2f(0.5f, -0.5f); // Triangle 2 mHeatBlasterFlameVertexBuffer[3].VAR_28 = vec2f(left, top); mHeatBlasterFlameVertexBuffer[3].VAR_29 = vec2f(-0.5f, 0.5f); mHeatBlasterFlameVertexBuffer[4].VAR_28 = vec2f(VAR_27, bottom); mHeatBlasterFlameVertexBuffer[4].VAR_29 = vec2f(0.5f, -0.5f); mHeatBlasterFlameVertexBuffer[5].VAR_28 = vec2f(VAR_27, top); mHeatBlasterFlameVertexBuffer[5].VAR_29 = vec2f(0.5f, 0.5f); // // Store shader // switch (action) { case HeatBlasterActionType::Cool: { mHeatBlasterFlameShaderToRender = Render::ProgramType::HeatBlasterFlameCool; break; } case HeatBlasterActionType::Heat: { mHeatBlasterFlameShaderToRender = Render::ProgramType::HeatBlasterFlameHeat; break; } } } inline void UploadFireExtinguisherSpray( vec2f const & centerPosition, float VAR_25) { // // Populate vertices // float const VAR_26 = (VAR_25 * 3.5f) / 2.0f; // Add some slack to account for transparency float const left = centerPosition.x - VAR_26; float const VAR_27 = centerPosition.x + VAR_26; float const top = centerPosition.y + VAR_26; float const bottom = centerPosition.y - VAR_26; // Triangle 1 VAR_30[0].VAR_28 = vec2f(left, bottom); VAR_30[0].VAR_31 = vec2f(-0.5f, -0.5f); VAR_30[1].VAR_28 = vec2f(left, top); VAR_30[1].VAR_31 = vec2f(-0.5f, 0.5f); VAR_30[2].VAR_28 = vec2f(VAR_27, bottom); VAR_30[2].VAR_31 = vec2f(0.5f, -0.5f); // Triangle 2 VAR_30[3].VAR_28 = vec2f(left, top); VAR_30[3].VAR_31 = vec2f(-0.5f, 0.5f); VAR_30[4].VAR_28 = vec2f(VAR_27, bottom); VAR_30[4].VAR_31 = vec2f(0.5f, -0.5f); VAR_30[5].VAR_28 = vec2f(VAR_27, top); VAR_30[5].VAR_31 = vec2f(0.5f, 0.5f); // // Store shader // mFireExtinguisherSprayShaderToRender = Render::ProgramType::FireExtinguisherSpray; } inline void UploadBlastToolHalo( vec2f const & centerPosition, float VAR_25, float renderProgress, float personalitySeed) { // // Populate vertices // float const left = centerPosition.x - VAR_25; float const VAR_27 = centerPosition.x + VAR_25; float const top = centerPosition.y + VAR_25; float const bottom = centerPosition.y - VAR_25; // Triangle 1 mBlastToolHaloVertexBuffer.FUNC_0( vec2f(left, bottom), vec2f(-1.0f, -1.0f), renderProgress, personalitySeed); mBlastToolHaloVertexBuffer.FUNC_0( vec2f(left, top), vec2f(-1.0f, 1.0f), renderProgress, personalitySeed); mBlastToolHaloVertexBuffer.FUNC_0( vec2f(VAR_27, bottom), vec2f(1.0f, -1.0f), renderProgress, personalitySeed); // Triangle 2 mBlastToolHaloVertexBuffer.FUNC_0( vec2f(left, top), vec2f(-1.0f, 1.0f), renderProgress, personalitySeed); mBlastToolHaloVertexBuffer.FUNC_0( vec2f(VAR_27, bottom), vec2f(1.0f, -1.0f), renderProgress, personalitySeed); mBlastToolHaloVertexBuffer.FUNC_0( vec2f(VAR_27, top), vec2f(1.0f, 1.0f), renderProgress, personalitySeed); } inline void UploadPressureInjectionHalo( vec2f const & centerPosition, float VAR_32) { // // Populate vertices // float const VAR_26 = 9.0f / 2.0f; // Add some slack to account for transparency float const left = centerPosition.x - VAR_26; float const VAR_27 = centerPosition.x + VAR_26; float const top = centerPosition.y + VAR_26; float const bottom = centerPosition.y - VAR_26; // Triangle 1 mPressureInjectionHaloVertexBuffer.FUNC_0( vec2f(left, bottom), vec2f(-1.0f, -1.0f), VAR_32); mPressureInjectionHaloVertexBuffer.FUNC_0( vec2f(left, top), vec2f(-1.0f, 1.0f), VAR_32); mPressureInjectionHaloVertexBuffer.FUNC_0( vec2f(VAR_27, bottom), vec2f(1.0f, -1.0f), VAR_32); // Triangle 2 mPressureInjectionHaloVertexBuffer.FUNC_0( vec2f(left, top), vec2f(-1.0f, 1.0f), VAR_32); mPressureInjectionHaloVertexBuffer.FUNC_0( vec2f(VAR_27, bottom), vec2f(1.0f, -1.0f), VAR_32); mPressureInjectionHaloVertexBuffer.FUNC_0( vec2f(VAR_27, top), vec2f(1.0f, 1.0f), VAR_32); } void FUNC_6(); void ProcessParameterChanges(RenderParameters const & VAR_33); void RenderPrepare(); void RenderDraw(); private: void ApplyViewModelChanges(RenderParameters const & VAR_33); void ApplyCanvasSizeChanges(RenderParameters const & VAR_33); void ApplyEffectiveAmbientLightIntensityChanges(RenderParameters const & VAR_33); void ApplyDisplayUnitsSystemChanges(RenderParameters const & VAR_33); inline void RenderPrepareTextNotifications(); inline void RenderDrawTextNotifications(); inline void FUNC_7(); inline void RenderDrawTextureNotifications(); inline void FUNC_8(); inline void RenderDrawPhysicsProbePanel(); inline void RenderPrepareHeatBlasterFlame(); inline void RenderDrawHeatBlasterFlame(); inline void RenderPrepareFireExtinguisherSpray(); inline void RenderDrawFireExtinguisherSpray(); inline void RenderPrepareBlastToolHalo(); inline void RenderDrawBlastToolHalo(); inline void RenderPreparePressureInjectionHalo(); inline void FUNC_9(); private: VAR_34 inline constexpr NotificationAnchorPositionType TranslateAnchorPosition(AnchorPositionType VAR_9) { switch (VAR_9) { case Render::AnchorPositionType::TopLeft: return NotificationAnchorPositionType::TopLeft; case Render::AnchorPositionType::TopRight: return NotificationAnchorPositionType::TopRight; case Render::AnchorPositionType::BottomLeft: return NotificationAnchorPositionType::VAR_4; case Render::AnchorPositionType::BottomRight: return NotificationAnchorPositionType::BottomRight; } return NotificationAnchorPositionType::VAR_4; } struct FontTextureAtlasMetadata; struct CLASS_6; inline void UploadTextStart(CLASS_2 textNotificationType) { // // Text notifications are sticky: we upload them once in a while and // continue drawing the same buffer // // Cleanup line buffers for this notification type auto & textContext = mTextNotificationTypeContexts[static_cast<size_t>(textNotificationType)]; textContext.VAR_13.FUNC_1(); textContext.AreTextLinesDirty = true; } void FUNC_10(CLASS_6 & context) VAR_7; void GenerateTextureNotificationVertices(); private: ShaderManager<ShaderManagerTraits> & mShaderManager; float mScreenToNdcX; float mScreenToNdcY; private: // // Types // #pragma pack(push, 1) struct TextureNotificationVertex { vec2f VAR_36; vec2f textureCoordinate; float VAR_11; TextureNotificationVertex( vec2f const & _vertexPositionNDC, vec2f const & _textureCoordinate, float _alpha) : VAR_36(_vertexPositionNDC) , textureCoordinate(_textureCoordinate) , VAR_11(_alpha) {} }; struct PhysicsProbePanelVertex { vec2f VAR_36; vec2f textureFrameOffset; vec2f VAR_37; float VAR_38; PhysicsProbePanelVertex( vec2f const & _vertexPositionNDC, vec2f const & ID_1, vec2f const & ID_2, float _vertexIsOpening) : VAR_36(_vertexPositionNDC) , textureFrameOffset(CLASS_7) , VAR_37(CLASS_8) , VAR_38(_vertexIsOpening) {} }; struct HeatBlasterFlameVertex { vec2f VAR_28; vec2f VAR_29; HeatBlasterFlameVertex() {} }; struct FireExtinguisherSprayVertex { vec2f VAR_28; vec2f VAR_31; FireExtinguisherSprayVertex() {} }; struct BlastToolHaloVertex { vec2f VAR_28; vec2f haloSpacePosition; float renderProgress; float personalitySeed; BlastToolHaloVertex( vec2f VAR_39, vec2f VAR_40, float VAR_41, float _personalitySeed) : FUNC_5(VAR_39) , haloSpacePosition(CLASS_9) , renderProgress(CLASS_10) , personalitySeed(_personalitySeed) {} }; struct PressureInjectionHaloVertex { vec2f VAR_28; vec2f haloSpacePosition; float VAR_32; PressureInjectionHaloVertex( vec2f VAR_39, vec2f VAR_40, float _flowMultiplier) : FUNC_5(VAR_39) , haloSpacePosition(CLASS_9) , VAR_32(_flowMultiplier) {} }; #pragma pack(pop) // // Text notifications // /* * Metadata for each font in the single font atlas. */ struct FontTextureAtlasMetadata { vec2f CellTextureAtlasSize; // Size of one cell of the font, in texture atlas space coordinates std::array<vec2f, 256> GlyphTextureAtlasBottomLefts; // Bottom-left of each glyph, in texture atlas space coordinates std::array<vec2f, 256> GlyphTextureAtlasTopRights; // Top-right of each glyph, in texture atlas space coordinates CLASS_11 OriginalFontMetadata; FontTextureAtlasMetadata( vec2f cellTextureAtlasSize, std::array<vec2f, 256> glyphTextureAtlasBottomLefts, std::array<vec2f, 256> VAR_43, VAR_42 originalFontMetadata) : CellTextureAtlasSize(cellTextureAtlasSize) , GlyphTextureAtlasBottomLefts(std::move(glyphTextureAtlasBottomLefts)) , GlyphTextureAtlasTopRights(std::move(CLASS_12)) , OriginalFontMetadata(originalFontMetadata) {} }; std::vector<FontTextureAtlasMetadata> VAR_44; // This vector is storage, allowing for N:1 between contextes and fonts /* * State per-line-of-text. */ struct TextLine { std::string Text; NotificationAnchorPositionType Anchor; vec2f ScreenOffset; // In font cell-size fraction (0.0 -> 1.0) float Alpha; TextLine( std::string const & text, NotificationAnchorPositionType VAR_9, vec2f VAR_7 & VAR_10, float VAR_11) : Text(text) , Anchor(CLASS_3) , ScreenOffset(CLASS_4) , Alpha(CLASS_5) {} }; /* * State per-text-notification-type. */ struct CLASS_6 { FontTextureAtlasMetadata const & NotificationFontTextureAtlasMetadata; // The metadata of the font to be used for this notification type std::vector<TextLine> VAR_13; bool AreTextLinesDirty; // When dirty, we'll re-build the quads for this notification type std::vector<TextQuadVertex> TextQuadVertexBuffer; explicit VAR_35(FontTextureAtlasMetadata const & VAR_45) : NotificationFontTextureAtlasMetadata(VAR_45) , VAR_13() , AreTextLinesDirty(CLASS_13) , TextQuadVertexBuffer() {} }; std::vector<VAR_35> mTextNotificationTypeContexts; CLASS_14 VAR_46; size_t mCurrentTextQuadVertexBufferSize; // Number of elements (vertices) size_t mAllocatedTextQuadVertexBufferSize; // Number of elements (vertices) GameOpenGLVBO mTextVBO; // Fonts GameOpenGLTexture mFontAtlasTextureHandle; // // Texture notifications // TextureAtlasMetadata<GenericLinearTextureGroups> const & mGenericLinearTextureAtlasMetadata; struct TextureNotification { TextureFrameId<GenericLinearTextureGroups> FrameId; AnchorPositionType Anchor; vec2f ScreenOffset; // In texture-size fraction (0.0 -> 1.0) float Alpha; TextureNotification( TextureFrameId<GenericLinearTextureGroups> const & frameId, AnchorPositionType VAR_9, vec2f VAR_7 & VAR_10, float VAR_11) : FrameId(frameId) , Anchor(CLASS_3) , ScreenOffset(CLASS_4) , Alpha(CLASS_5) {} }; std::vector<TextureNotification> mTextureNotifications; bool mIsTextureNotificationDataDirty; // When dirty, we'll re-build and re-upload the vertex data CLASS_14 VAR_47; std::vector<TextureNotificationVertex> mTextureNotificationVertexBuffer; GameOpenGLVBO VAR_48; // // Physics probe panel // CLASS_14 mPhysicsProbePanelVAO; std::vector<PhysicsProbePanelVertex> VAR_16; bool VAR_23; GameOpenGLVBO VAR_49; vec2f mPhysicsProbePanelNdcDimensions; // // Tool notifications // CLASS_14 VAR_50; std::array<HeatBlasterFlameVertex, 6> mHeatBlasterFlameVertexBuffer; GameOpenGLVBO mHeatBlasterFlameVBO; std::IMPORT_3<Render::ProgramType> mHeatBlasterFlameShaderToRender; CLASS_14 mFireExtinguisherSprayVAO; std::array<FireExtinguisherSprayVertex, 6> VAR_30; GameOpenGLVBO mFireExtinguisherSprayVBO; std::IMPORT_3<Render::ProgramType> mFireExtinguisherSprayShaderToRender; CLASS_14 VAR_51; std::vector<BlastToolHaloVertex> mBlastToolHaloVertexBuffer; GameOpenGLVBO mBlastToolHaloVBO; CLASS_14 VAR_52; std::vector<PressureInjectionHaloVertex> mPressureInjectionHaloVertexBuffer; GameOpenGLVBO mPressureInjectionHaloVBO; }; }
0.300508
{'IMPORT_0': 'RenderParameters.h', 'IMPORT_1': 'GameOpenGL/ShaderManager.h', 'IMPORT_2': 'memory', 'IMPORT_3': 'optional', 'CLASS_0': 'namespace', 'CLASS_1': 'class', 'VAR_0': 'enum', 'VAR_1': 'TextNotificationType', 'ID_0': 'TextNotificationType', 'CLASS_2': 'TextNotificationType', 'VAR_2': 'NotificationText', 'VAR_3': '_Last', 'VAR_4': 'BottomLeft', 'VAR_5': 'PhysicsProbeReadingPressure', 'VAR_6': 'PhysicsProbeReadingSpeed', 'VAR_7': 'const', 'VAR_8': 'resourceLocator', 'VAR_9': 'anchor', 'CLASS_3': 'anchor', 'VAR_10': 'screenOffset', 'CLASS_4': 'screenOffset', 'VAR_11': 'alpha', 'CLASS_5': 'alpha', 'VAR_12': 'textNotificationContext', 'VAR_13': 'TextLines', 'FUNC_0': 'emplace_back', 'FUNC_1': 'clear', 'VAR_14': 'textureFrameId', 'VAR_15': 'isOpening', 'VAR_16': 'mPhysicsProbePanelVertexBuffer', 'VAR_17': 'MinHorizontalOpen', 'VAR_18': 'midYNdc', 'VAR_19': 'quadTopLeft', 'VAR_20': 'quadBottomRight', 'VAR_21': 'xLimits', 'VAR_22': 'opening', 'FUNC_2': 'GetFrameMetadata', 'VAR_23': 'mIsPhysicsProbePanelVertexBufferDirty', 'VAR_24': 'temperature', 'FUNC_3': 'zero', 'FUNC_4': 'UploadPhysicsProbeReadingClear', 'VAR_25': 'radius', 'VAR_26': 'quadHalfSize', 'VAR_27': 'right', 'VAR_28': 'vertexPosition', 'FUNC_5': 'vertexPosition', 'VAR_29': 'flameSpacePosition', 'VAR_30': 'mFireExtinguisherSprayVertexBuffer', 'VAR_31': 'spraySpacePosition', 'VAR_32': 'flowMultiplier', 'FUNC_6': 'UploadEnd', 'VAR_33': 'renderParameters', 'FUNC_7': 'RenderPrepareTextureNotifications', 'FUNC_8': 'RenderPreparePhysicsProbePanel', 'FUNC_9': 'RenderDrawPressureInjectionHalo', 'VAR_34': 'static', 'CLASS_6': 'TextNotificationTypeContext', 'VAR_35': 'TextNotificationTypeContext', 'FUNC_10': 'GenerateTextVertices', 'VAR_36': 'vertexPositionNDC', 'VAR_37': 'xLimitsNDC', 'VAR_38': 'vertexIsOpening', 'ID_1': '_textureFrameOffset', 'CLASS_7': '_textureFrameOffset', 'ID_2': '_xLimitsNDC', 'CLASS_8': '_xLimitsNDC', 'VAR_39': '_vertexPosition', 'VAR_40': '_haloSpacePosition', 'CLASS_9': '_haloSpacePosition', 'VAR_41': '_renderProgress', 'CLASS_10': '_renderProgress', 'CLASS_11': 'FontMetadata', 'VAR_42': 'FontMetadata', 'VAR_43': 'glyphTextureAtlasTopRights', 'CLASS_12': 'glyphTextureAtlasTopRights', 'VAR_44': 'mFontTextureAtlasMetadata', 'VAR_45': 'notificationFontTextureAtlasMetadata', 'CLASS_13': 'false', 'CLASS_14': 'GameOpenGLVAO', 'VAR_46': 'mTextVAO', 'VAR_47': 'mTextureNotificationVAO', 'VAR_48': 'mTextureNotificationVBO', 'VAR_49': 'mPhysicsProbePanelVBO', 'VAR_50': 'mHeatBlasterFlameVAO', 'VAR_51': 'mBlastToolHaloVAO', 'VAR_52': 'mPressureInjectionHaloVAO'}
#include <stdio.h> void loop1(void) { for (int x = 0; x < 10; x++) { printf("%d\n", x); } } void loop2(void) { int x = 0; while (x < 10) { printf("%d\n", x); x++; } } void loop3(void) { int x; x = 0; do { printf("Hello, World!\n"); } while (x != 0); } int main(void) { loop1(); loop2(); loop3(); }
#include <stdio.h> void loop1(void) { for (int x = 0; x < 10; x++) { printf("%d\n", x); } } void loop2(void) { int x = 0; while (x < 10) { printf("%d\n", x); x++; } } void loop3(void) { int x; x = 0; do { printf("Hello, World!\n"); } while (x != 0); } int main(void) { loop1(); loop2(); loop3(); }
0.079519
{}
#pragma once #ifdef HRZ_PLATFORM_WINDOWS #else #error Nah cant do that #endif
#pragma once #ifdef HRZ_PLATFORM_WINDOWS #else #error Nah cant do that #endif
0.737193
{}
#ifndef _IGCMC_H_ #define _IGCMC_H_ #include <cstddef> #include <string> #include <stdint.h> #include <vector> #ifdef _WIN32 #define __EXPORT__ __declspec(dllexport) #else #define __EXPORT__ __attribute__((visibility("default"))) #endif // Supported kernel argument attributes. struct cmc_resource_attibute { static constexpr const char* ReadOnly = "read_only"; // This resource is for read only. static constexpr const char* WriteOnly = "write_only"; // This resource is for write only. static constexpr const char* ReadWrite = "read_write"; // This resource is for read and write. static constexpr const char* Buffer = "buffer_t"; // This resource is a buffer. static constexpr const char* SVM = "svmptr_t"; // This resource is a SVM buffer. static constexpr const char* Sampler = "sampler_t"; // This resource is a sampler. static constexpr const char* Image1d = "image1d_t"; // This resource is a 1D surface. static constexpr const char* Image2d = "image2d_t"; // This resource is a 2D surface. static constexpr const char* Image3d = "image3d_t"; // This resource is a 3D surface. }; // optional resource access kind enum class cmc_access_kind : int32_t { undef, read_only, write_only, read_write }; enum class cmc_arg_kind : int32_t { General, LocalSize, // IMPLICIT_LOCAL_SIZE GroupCount, // IMPLICIT_NUM_GROUPS Buffer, // 1D buffer SVM, // stateless global pointer Sampler, Image1d, Image2d, Image3d, PrintBuffer }; struct cmc_ocl_print_string { static constexpr unsigned max_width = 256; char s[max_width]; }; struct cmc_arg_info { // The argument kind. cmc_arg_kind kind = cmc_arg_kind::General; // The argument index in this kernel. int32_t index = 0; // the byte offset of this argument in payload int32_t offset = 0; // The byte size of this argument in payload int32_t sizeInBytes = 0; // The BTI for this resource, if applicable. int32_t BTI = 0; // the optional resource access kind, if applicable. cmc_access_kind access = cmc_access_kind::undef; }; // compilation interface bewteen cmc and igc struct cmc_kernel_info_v2 { /// The kernel name. const char *name; /// The number of kernel arguments unsigned num_args; /// The kernel argument info. cmc_arg_info *arg_descs; // ThreadPayload bool HasLocalIDx = false; bool HasLocalIDy = false; bool HasLocalIDz = false; bool HasGroupID = false; // ExecutionEnivronment uint32_t CompiledSIMDSize = 8; uint32_t SLMSize = 0; uint32_t NumGRFRequired = 128; uint32_t GRFByteSize = 32; uint32_t HasBarriers = 0; bool HasReadWriteImages = false; uint32_t ThreadPrivateMemSize = 0; /// number of format strings in the kernel unsigned num_print_strings; /// The kernel format string storage cmc_ocl_print_string *print_string_descs; struct TableInfo { void *Buf = nullptr; uint32_t Size = 0; uint32_t NumEntries = 0; }; TableInfo RelocationTable; TableInfo SymbolTable; }; struct cmc_compile_info_v2 { /// The vISA binary size in bytes. uint64_t binary_size; /// The vISA binary data. void* binary; uint32_t pointer_size_in_bytes; /// The vISA major version. uint32_t visa_major_version; /// The vISA minor version. uint32_t visa_minor_version; /// The number of kernel. unsigned num_kernels; /// Ugly stub for compatibility with cmc void *compatibility_stub; /// The context for this compilation. This opaque data holds all memory /// allocations that will be freed in the end. void* context; /// The kernel infomation. cmc_kernel_info_v2 *kernel_info_v2; }; extern "C" __EXPORT__ int32_t cmc_load_and_compile_v2(const char* input, size_t input_size, const char* const options, cmc_compile_info_v2** output_v2); extern "C" __EXPORT__ int32_t cmc_free_compile_info_v2(cmc_compile_info_v2* output_v2); #endif // _IGCMC_H_
#ifndef _IGCMC_H_ #define _IGCMC_H_ #include <cstddef> #include <string> #include <stdint.h> #include <vector> #ifdef _WIN32 #define VAR_0 __declspec(dllexport) #else #define VAR_0 __attribute__((visibility("default"))) #endif // Supported kernel argument attributes. struct CLASS_1 { static constexpr const char* ReadOnly = "VAR_1"; // This resource is for read only. static constexpr const char* WriteOnly = "write_only"; // This resource is for write only. static constexpr const char* ReadWrite = "read_write"; // This resource is for read and write. static constexpr const char* Buffer = "buffer_t"; // This resource is a buffer. static constexpr const char* SVM = "svmptr_t"; // This resource is a SVM buffer. static constexpr const char* Sampler = "VAR_2"; // This resource is a sampler. static constexpr const char* VAR_3 = "image1d_t"; // This resource is a 1D surface. static constexpr const char* Image2d = "image2d_t"; // This resource is a 2D surface. static constexpr const char* Image3d = "image3d_t"; // This resource is a 3D surface. }; // optional resource access kind enum class cmc_access_kind : int32_t { undef, VAR_1, write_only, read_write }; enum class VAR_4 : int32_t { General, LocalSize, // IMPLICIT_LOCAL_SIZE GroupCount, // IMPLICIT_NUM_GROUPS Buffer, // 1D buffer SVM, // stateless global pointer Sampler, VAR_3, Image2d, Image3d, PrintBuffer }; struct cmc_ocl_print_string { static constexpr unsigned max_width = 256; char VAR_5[max_width]; }; struct cmc_arg_info { // The argument kind. CLASS_2 VAR_6 = VAR_4::General; // The argument index in this kernel. int32_t index = 0; // the byte offset of this argument in payload int32_t VAR_7 = 0; // The byte size of this argument in payload int32_t sizeInBytes = 0; // The BTI for this resource, if applicable. int32_t BTI = 0; // the optional resource access kind, if applicable. cmc_access_kind VAR_8 = cmc_access_kind::undef; }; // compilation interface bewteen cmc and igc struct cmc_kernel_info_v2 { /// The kernel name. const char *name; /// The number of kernel arguments unsigned VAR_9; /// The kernel argument info. cmc_arg_info *VAR_10; // ThreadPayload bool VAR_11 = false; bool VAR_12 = false; bool HasLocalIDz = false; bool HasGroupID = false; // ExecutionEnivronment uint32_t CompiledSIMDSize = 8; uint32_t SLMSize = 0; uint32_t NumGRFRequired = 128; uint32_t GRFByteSize = 32; uint32_t HasBarriers = 0; bool HasReadWriteImages = false; uint32_t VAR_13 = 0; /// number of format strings in the kernel unsigned num_print_strings; /// The kernel format string storage cmc_ocl_print_string *VAR_14; struct TableInfo { void *Buf = nullptr; uint32_t VAR_15 = 0; uint32_t NumEntries = 0; }; TableInfo VAR_16; TableInfo SymbolTable; }; struct cmc_compile_info_v2 { /// The vISA binary size in bytes. uint64_t binary_size; /// The vISA binary data. void* binary; uint32_t pointer_size_in_bytes; /// The vISA major version. uint32_t visa_major_version; /// The vISA minor version. uint32_t visa_minor_version; /// The number of kernel. unsigned num_kernels; /// Ugly stub for compatibility with cmc void *compatibility_stub; /// The context for this compilation. This opaque data holds all memory /// allocations that will be freed in the end. void* context; /// The kernel infomation. cmc_kernel_info_v2 *VAR_17; }; extern "C" CLASS_0 VAR_18 FUNC_0(const char* input, size_t input_size, const char* const options, cmc_compile_info_v2** VAR_19); extern "C" CLASS_0 VAR_18 cmc_free_compile_info_v2(cmc_compile_info_v2* VAR_19); #endif // _IGCMC_H_
0.244473
{'VAR_0': '__EXPORT__', 'CLASS_0': '__EXPORT__', 'CLASS_1': 'cmc_resource_attibute', 'VAR_1': 'read_only', 'VAR_2': 'sampler_t', 'VAR_3': 'Image1d', 'VAR_4': 'cmc_arg_kind', 'CLASS_2': 'cmc_arg_kind', 'VAR_5': 's', 'VAR_6': 'kind', 'VAR_7': 'offset', 'VAR_8': 'access', 'VAR_9': 'num_args', 'VAR_10': 'arg_descs', 'VAR_11': 'HasLocalIDx', 'VAR_12': 'HasLocalIDy', 'VAR_13': 'ThreadPrivateMemSize', 'VAR_14': 'print_string_descs', 'VAR_15': 'Size', 'VAR_16': 'RelocationTable', 'VAR_17': 'kernel_info_v2', 'VAR_18': 'int32_t', 'FUNC_0': 'cmc_load_and_compile_v2', 'VAR_19': 'output_v2'}
/* -------------------------------------------------------------------------------- This source file is part of SkyX. Visit --- Copyright (C) 2009 <NAME> <<EMAIL>> <<EMAIL>> This program 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 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser 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, or go to http://www.gnu.org/copyleft/lesser.txt. -------------------------------------------------------------------------------- */ #ifndef _SkyX_VClouds_DataManager_H_ #define _SkyX_VClouds_DataManager_H_ #include "../Prerequisites.h" #include "FastFakeRandom.h" namespace SkyX { namespace VClouds{ class VClouds; class Ellipsoid; class DllExport DataManager { public: /** Cell struct */ struct Cell { /// Humidity, phase and cloud bool hum, act, cld; /// Probabilities float phum, pext, pact; /// Continous density float dens; /// Light absorcion float light; }; /** Volumetric textures enumeration */ enum VolTextureId { VOL_TEX0 = 0, VOL_TEX1 = 1 }; /** Constructor @param vc VClouds parent pointer */ DataManager(VClouds *vc); /** Destructor */ ~DataManager(); /** Create @param nx X complexity @param ny Y complexity @param nz Z complexity */ void create(const int& nx, const int& ny, const int& nz); /** Update @param timeSinceLastFrame Time elapsed since last frame */ void update(const Ogre::Real &timeSinceLastFrame); /** Remove */ void remove(); /** Has been create(...) already called? @return true if created() have been already called */ inline const bool& isCreated() const { return mCreated; } /** Set update time @param UpdateTime Time elapsed between data calculations, a little freeze could be experimented during these calculations on old CPU's */ inline void setUpdateTime(const float& UpdateTime) { mUpdateTime = UpdateTime; } /** Get update time @return Update time */ inline const Ogre::Real& getUpdateTime() const { return mUpdateTime; } /** Get current interpolation factor @return Interpolation factor @remarks Only for internal use */ inline const Ogre::Real _getInterpolation() const { return mCurrentTransition/mUpdateTime; } /** Set wheater parameters Use this funtion to update the cloud field parameters, you'll get a smart and smooth transition from your old setting to your new ones. @param Humidity Humidity, in other words: the percentage of clouds in [0,1] range. @param AverageCloudsSize Average clouds size, for example: if previous wheater clouds size parameter was very different from new one(i.e: more little) only the old biggest clouds are going to be keept and the little ones are going to be replaced @param NumberOfForcedUpdates Number of times the data simulation are going to be re-calculated for the next frame. This parameters is useful if you want to avoid a delayed response or, in other words, 0 means that you're going to get a smooth transition between old and news wheater parameters(delayed response) and a positive number(2 might be sufficient) is going to change the clouds for the next frame */ void setWheater(const float& Humidity, const float& AverageCloudsSize, const int& NumberOfForcedUpdates = 0); /** Add ellipsoid: clouds are modelled as ellipsoids in our simulation approach, so.. different kind of clouds can be modelled with ellipsoids compositions. @param e Ellipsoid @param UpdateProbabilities Update probabilities? */ void addEllipsoid(Ellipsoid *e, const bool& UpdateProbabilities = true); /** Forces the data manager to calculate the next step right now */ void forceToUpdateData(); private: /** Initialize data @param nx X complexity @param ny Y complexity @param nz Z complexity */ void _initData(const int& nx, const int& ny, const int& nz); /** Create tridimensional cell array @param nx X size @param ny Y size @param nz Z size @param init Initialize values @return Cell 3d pointer */ Cell *** _create3DCellArray(const int& nx, const int& ny, const int& nz, const bool& init = true); /** Delete tridimensional cell array @param c Cell pointer to be deleted @param nx X size @param ny Y size */ void _delete3DCellArray(Cell ***c, const int& nx, const int& ny); /** Copy 3d cells arrays data @param or Origin @param dest Dest @param nx X size @param ny Y size @param nz Z size */ void _copy3DCellArraysData(Cell ***_or, Cell ***dest, const int& nx, const int& ny, const int& nz); /** Perform celullar automata simulation @param nx X size @param ny Y size @param nz Z size */ void _performCalculations(const int& nx, const int& ny, const int& nz); /** Update volumetric texture data @param c Cells data @param TexId Texture Id @param nx X size @param ny Y size @param nz Z size */ void _updateVolTextureData(Cell ***c, const VolTextureId& TexId, const int& nx, const int& ny, const int& nz); /** Get continous density at a point @param c Cells data @param nx X size @param ny Y size @param nz Z size @param x x Coord @param y y Coord @param z z Coord @param r Radius */ const float _getDensityAt(Cell ***c, const int& nx, const int& ny, const int& nz, const int& x, const int& y, const int& z, const int& r) const; /** Get discrete density at a point @param c Cells data @param x x Coord @param y y Coord @param z z Coord */ const float _getDensityAt(Cell ***c, const int& x, const int& y, const int& z) const; /** Fact funtion @param c Cells data @param nx X size @param ny Y size @param nz Z size @param x x Coord @param y y Coord @param z z Coord */ const bool _fact(Cell ***c, const int& nx, const int& ny, const int& nz, const int& x, const int& y, const int& z) const; /** Clear probabilities @param c Cells data @param nx X size @param ny Y size @param nz Z size */ void _clearProbabilities(Cell*** c, const int& nx, const int& ny, const int& nz); /** Update probabilities based from the Ellipsoid vector @param c Cells data @param nx X size @param ny Y size @param nz Z size @param ClearProbabilities Clear probabilities? */ void _updateProbabilities(Cell*** c, const int& nx, const int& ny, const int& nz, const bool& ClearProbabilities = true); /** Get light absorcion factor at a point @param c Cells data @param nx X size @param ny Y size @param nz Z size @param x x Coord @param y y Coord @param z z Coord @param d Light direction @param att Attenuation factor */ const Ogre::Real _getLightAbsorcionAt(Cell*** c, const int& nx, const int& ny, const int& nz, const int& x, const int& y, const int& z, const Ogre::Vector3& d, const float& att) const; /** Create volumetric texture @param TexId Texture Id @param nx X size @param ny Y size @param nz Z size */ void _createVolTexture(const VolTextureId& TexId, const int& nx, const int& ny, const int& nz); /// Simulation data Cell ***mCellsCurrent, ***mCellsTmp; /// Current transition float mCurrentTransition; /// Update time float mUpdateTime; /// Complexities int mNx, mNy, mNz; /// Volumetric textures array Ogre::TexturePtr mVolTextures[2]; /// Current texture bool mVolTexToUpdate; /// Has been create(...) already called? bool mCreated; /// Fast fake random FastFakeRandom *mFFRandom; /// Max number of clouds(Ellipsoids) int mMaxNumberOfClouds; /// Ellipsoids std::vector<Ellipsoid*> mEllipsoids; /// SkyX parent pointer VClouds *mVClouds; }; }} #endif
/* -------------------------------------------------------------------------------- This source file is part of SkyX. Visit --- Copyright (C) 2009 <NAME> <<EMAIL>> <<EMAIL>> This program 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 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser 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, or go to http://www.gnu.org/copyleft/lesser.txt. -------------------------------------------------------------------------------- */ #ifndef VAR_0 #define VAR_0 #include "../Prerequisites.h" #include "IMPORT_0" namespace SkyX { namespace VClouds{ class VClouds; class VAR_1; class DllExport DataManager { public: /** Cell struct */ struct Cell { /// Humidity, phase and cloud bool VAR_2, VAR_3, cld; /// Probabilities float phum, pext, pact; /// Continous density float dens; /// Light absorcion float light; }; /** Volumetric textures enumeration */ enum VolTextureId { VAR_4 = 0, VOL_TEX1 = 1 }; /** Constructor @param vc VClouds parent pointer */ DataManager(VClouds *vc); /** Destructor */ ~DataManager(); /** Create @param nx X complexity @param ny Y complexity @param nz Z complexity */ void create(const int& nx, const int& ny, const int& nz); /** Update @param timeSinceLastFrame Time elapsed since last frame */ void FUNC_0(const Ogre::Real &timeSinceLastFrame); /** Remove */ void remove(); /** Has been create(...) already called? @return true if created() have been already called */ inline const bool& isCreated() const { return mCreated; } /** Set update time @param UpdateTime Time elapsed between data calculations, a little freeze could be experimented during these calculations on old CPU's */ inline void setUpdateTime(const float& UpdateTime) { VAR_5 = UpdateTime; } /** Get update time @return Update time */ inline const Ogre::Real& getUpdateTime() const { return VAR_5; } /** Get current interpolation factor @return Interpolation factor @remarks Only for internal use */ inline const Ogre::Real _getInterpolation() const { return mCurrentTransition/VAR_5; } /** Set wheater parameters Use this funtion to update the cloud field parameters, you'll get a smart and smooth transition from your old setting to your new ones. @param Humidity Humidity, in other words: the percentage of clouds in [0,1] range. @param AverageCloudsSize Average clouds size, for example: if previous wheater clouds size parameter was very different from new one(i.e: more little) only the old biggest clouds are going to be keept and the little ones are going to be replaced @param NumberOfForcedUpdates Number of times the data simulation are going to be re-calculated for the next frame. This parameters is useful if you want to avoid a delayed response or, in other words, 0 means that you're going to get a smooth transition between old and news wheater parameters(delayed response) and a positive number(2 might be sufficient) is going to change the clouds for the next frame */ void setWheater(const float& VAR_6, const float& AverageCloudsSize, const int& NumberOfForcedUpdates = 0); /** Add ellipsoid: clouds are modelled as ellipsoids in our simulation approach, so.. different kind of clouds can be modelled with ellipsoids compositions. @param e Ellipsoid @param UpdateProbabilities Update probabilities? */ void FUNC_1(CLASS_0 *VAR_7, const bool& UpdateProbabilities = true); /** Forces the data manager to calculate the next step right now */ void FUNC_2(); private: /** Initialize data @param nx X complexity @param ny Y complexity @param nz Z complexity */ void _initData(const int& nx, VAR_8 VAR_9& ny, VAR_8 VAR_9& nz); /** Create tridimensional cell array @param nx X size @param ny Y size @param nz Z size @param init Initialize values @return Cell 3d pointer */ Cell *** FUNC_3(const int& nx, const int& ny, const int& nz, const bool& init = true); /** Delete tridimensional cell array @param c Cell pointer to be deleted @param nx X size @param ny Y size */ void _delete3DCellArray(Cell ***VAR_10, const int& nx, const int& ny); /** Copy 3d cells arrays data @param or Origin @param dest Dest @param nx X size @param ny Y size @param nz Z size */ void FUNC_4(Cell ***VAR_11, Cell ***VAR_12, const int& nx, const int& ny, const int& nz); /** Perform celullar automata simulation @param nx X size @param ny Y size @param nz Z size */ void _performCalculations(const int& nx, const int& ny, const int& nz); /** Update volumetric texture data @param c Cells data @param TexId Texture Id @param nx X size @param ny Y size @param nz Z size */ void FUNC_5(Cell ***VAR_10, const VolTextureId& TexId, const int& nx, const int& ny, const int& nz); /** Get continous density at a point @param c Cells data @param nx X size @param ny Y size @param nz Z size @param x x Coord @param y y Coord @param z z Coord @param r Radius */ const float _getDensityAt(Cell ***VAR_10, const int& nx, const int& ny, const int& nz, const int& VAR_13, const int& y, const int& VAR_14, const int& r) VAR_8; /** Get discrete density at a point @param c Cells data @param x x Coord @param y y Coord @param z z Coord */ const float _getDensityAt(Cell ***VAR_10, const int& VAR_13, const int& y, const int& VAR_14) VAR_8; /** Fact funtion @param c Cells data @param nx X size @param ny Y size @param nz Z size @param x x Coord @param y y Coord @param z z Coord */ const bool _fact(Cell ***VAR_10, const int& nx, const int& ny, const int& nz, const int& VAR_13, const int& y, const int& VAR_14) VAR_8; /** Clear probabilities @param c Cells data @param nx X size @param ny Y size @param nz Z size */ void _clearProbabilities(Cell*** VAR_10, const int& nx, const int& ny, const int& nz); /** Update probabilities based from the Ellipsoid vector @param c Cells data @param nx X size @param ny Y size @param nz Z size @param ClearProbabilities Clear probabilities? */ void FUNC_6(Cell*** VAR_10, const int& nx, const int& ny, const int& nz, const bool& VAR_15 = true); /** Get light absorcion factor at a point @param c Cells data @param nx X size @param ny Y size @param nz Z size @param x x Coord @param y y Coord @param z z Coord @param d Light direction @param att Attenuation factor */ const Ogre::Real _getLightAbsorcionAt(Cell*** VAR_10, const int& nx, const int& ny, const int& nz, const int& VAR_13, const int& y, const int& VAR_14, const Ogre::Vector3& VAR_16, const float& VAR_17) VAR_8; /** Create volumetric texture @param TexId Texture Id @param nx X size @param ny Y size @param nz Z size */ void _createVolTexture(const VolTextureId& TexId, const int& nx, const int& ny, const int& nz); /// Simulation data Cell ***VAR_18, ***VAR_19; /// Current transition float mCurrentTransition; /// Update time float VAR_5; /// Complexities int mNx, mNy, VAR_20; /// Volumetric textures array Ogre::VAR_21 mVolTextures[2]; /// Current texture bool mVolTexToUpdate; /// Has been create(...) already called? bool mCreated; /// Fast fake random CLASS_1 *mFFRandom; /// Max number of clouds(Ellipsoids) int mMaxNumberOfClouds; /// Ellipsoids std::vector<VAR_1*> VAR_22; /// SkyX parent pointer VClouds *mVClouds; }; }} #endif
0.448138
{'VAR_0': '_SkyX_VClouds_DataManager_H_', 'IMPORT_0': 'FastFakeRandom.h', 'VAR_1': 'Ellipsoid', 'CLASS_0': 'Ellipsoid', 'VAR_2': 'hum', 'VAR_3': 'act', 'VAR_4': 'VOL_TEX0', 'FUNC_0': 'update', 'VAR_5': 'mUpdateTime', 'VAR_6': 'Humidity', 'FUNC_1': 'addEllipsoid', 'VAR_7': 'e', 'FUNC_2': 'forceToUpdateData', 'VAR_8': 'const', 'VAR_9': 'int', 'FUNC_3': '_create3DCellArray', 'VAR_10': 'c', 'FUNC_4': '_copy3DCellArraysData', 'VAR_11': '_or', 'VAR_12': 'dest', 'FUNC_5': '_updateVolTextureData', 'VAR_13': 'x', 'VAR_14': 'z', 'FUNC_6': '_updateProbabilities', 'VAR_15': 'ClearProbabilities', 'VAR_16': 'd', 'VAR_17': 'att', 'VAR_18': 'mCellsCurrent', 'VAR_19': 'mCellsTmp', 'VAR_20': 'mNz', 'VAR_21': 'TexturePtr', 'CLASS_1': 'FastFakeRandom', 'VAR_22': 'mEllipsoids'}
#pragma once // Copyright (c) 2015 <NAME>. License MIT (http://www.opensource.org/licenses/mit-license.php) #include <spuce/typedefs.h> #include <cmath> #include <vector> namespace spuce { //! \file //! \brief Calculate Allpass coefficients for halfband bireciprocal wave filter //! assuming elliptic frequency response //! \ingroup functions iir //! \author <NAME>, Copyright(c) 2015 void elliptic_allpass(std::vector<float_type>& a0, std::vector<float_type>& a1, float_type fp, int L); } // namespace spuce
#pragma once // Copyright (c) 2015 <NAME>. License MIT (http://www.opensource.org/licenses/mit-license.php) #include <IMPORT_0> #include <IMPORT_1> #include <vector> CLASS_0 spuce { //! \file //! \brief Calculate Allpass coefficients for halfband bireciprocal wave filter //! assuming elliptic frequency response //! \ingroup functions iir //! \author <NAME>, Copyright(c) 2015 void elliptic_allpass(std::vector<VAR_0>& VAR_1, std::vector<VAR_0>& a1, CLASS_1 fp, int VAR_2); } // namespace spuce
0.315624
{'IMPORT_0': 'spuce/typedefs.h', 'IMPORT_1': 'cmath', 'CLASS_0': 'namespace', 'VAR_0': 'float_type', 'CLASS_1': 'float_type', 'VAR_1': 'a0', 'VAR_2': 'L'}
/* Return valid, unused, channel for a passive scan to reset the RF */ u8 il_get_single_channel_number(struct il_priv *il, enum nl80211_band band) { const struct il_channel_info *ch_info; int i; u8 channel = 0; u8 min, max; if (band == NL80211_BAND_5GHZ) { min = 14; max = il->channel_count; } else { min = 0; max = 14; } for (i = min; i < max; i++) { channel = il->channel_info[i].channel; if (channel == le16_to_cpu(il->staging.channel)) continue; ch_info = il_get_channel_info(il, band, channel); if (il_is_channel_valid(ch_info)) break; } return channel; }
/* Return valid, unused, channel for a passive scan to reset the RF */ u8 FUNC_0(struct il_priv *VAR_0, enum CLASS_0 band) { const struct CLASS_1 *ch_info; int i; u8 channel = 0; u8 VAR_1, VAR_2; if (band == NL80211_BAND_5GHZ) { VAR_1 = 14; VAR_2 = VAR_0->channel_count; } else { VAR_1 = 0; VAR_2 = 14; } for (i = VAR_1; i < VAR_2; i++) { channel = VAR_0->VAR_3[i].channel; if (channel == le16_to_cpu(VAR_0->VAR_4.channel)) continue; ch_info = il_get_channel_info(VAR_0, band, channel); if (FUNC_1(ch_info)) break; } return channel; }
0.421597
{'FUNC_0': 'il_get_single_channel_number', 'VAR_0': 'il', 'CLASS_0': 'nl80211_band', 'CLASS_1': 'il_channel_info', 'VAR_1': 'min', 'VAR_2': 'max', 'VAR_3': 'channel_info', 'VAR_4': 'staging', 'FUNC_1': 'il_is_channel_valid'}
#ifndef DMR_C_LINEARIZE_H #define DMR_C_LINEARIZE_H /* * Linearize - walk the parse tree and generate a linear version * of it and the basic blocks. * * Copyright (C) 2004 <NAME> * Copyright (C) 2004 <NAME> */ #include <lib.h> #include <allocate.h> #include <token.h> #include <parse.h> #include <symbol.h> #ifdef __cplusplus extern "C" { #endif struct instruction; DECLARE_PTR_LIST(basic_block_list, struct basic_block); DECLARE_PTR_LIST(instruction_list, struct instruction); DECLARE_PTR_LIST(multijmp_list, struct multijmp); DECLARE_PTR_LIST(pseudo_list, struct pseudo); struct pseudo_user { struct instruction *insn; pseudo_t *userp; }; DECLARE_PTR_LIST(pseudo_user_list, struct pseudo_user); enum pseudo_type { PSEUDO_VOID, PSEUDO_REG, PSEUDO_SYM, PSEUDO_VAL, PSEUDO_ARG, PSEUDO_PHI, }; /* Have you ever heard of "static single assignment" or SSA form? struct pseudo represents one of those single-assignment variables. Each one has a pointer to the symbol it represents (which may have many pseudos referencing it). Each one also has a pointer to the instruction that defines it.*/ struct pseudo { int nr; enum pseudo_type type; int size; /* OP_SETVAL only */ struct pseudo_user_list *users; /* pseudo_user list */ struct ident *ident; union { struct symbol *sym; // PSEUDO_SYM, VAL & ARG struct instruction *def; // PSEUDO_REG & PHI long long value; // PSEUDO_VAL }; DMRC_BACKEND_TYPE priv; DMRC_BACKEND_TYPE priv2; /* FIXME - we use this to save ptr to allocated stack in PHI instructions (nanojit) */ }; struct linearizer_state_t { struct allocator pseudo_allocator; struct allocator pseudo_user_allocator; struct allocator asm_constraint_allocator; struct allocator asm_rules_allocator; struct allocator multijmp_allocator; struct allocator basic_block_allocator; struct allocator entrypoint_allocator; struct allocator instruction_allocator; struct pseudo void_pseudo; struct position current_pos; int repeat_phase; unsigned long bb_generation; int liveness_changed; struct pseudo_list **live_list; struct pseudo_list *dead_list; #define MAX_VAL_HASH 64 struct pseudo_list *prev[MAX_VAL_HASH]; /* from pseudo_t value_pseudo(long long val) in linearize.c */ int nr; /* pseudo number */ int bb_nr; /* basic block number */ char buffer[4096*4]; int n; char pseudo_buffer[4][64]; #define INSN_HASH_SIZE 256 struct instruction_list *insn_hash_table[INSN_HASH_SIZE]; }; #define VOID_PSEUDO(C) (&C->L->void_pseudo) struct multijmp { struct basic_block *target; long long begin, end; }; struct asm_constraint { pseudo_t pseudo; const char *constraint; const struct ident *ident; }; DECLARE_PTR_LIST(asm_constraint_list, struct asm_constraint); struct asm_rules { struct asm_constraint_list *inputs; /* list of asm_constraint */ struct asm_constraint_list *outputs; /* list of asm_constraint */ struct asm_constraint_list *clobbers; /* list of asm_constraint */ }; struct instruction { unsigned opcode:8, size:24; struct basic_block *bb; struct position pos; struct symbol *type; union { pseudo_t target; pseudo_t cond; /* for branch and switch */ }; union { struct /* entrypoint */ { struct pseudo_list *arg_list; /* pseudo list */ }; struct /* branch */ { struct basic_block *bb_true, *bb_false; }; struct /* switch */ { struct multijmp_list *multijmp_list; }; struct /* phi_node */ { struct pseudo_list *phi_list; /* pseudo list */ }; struct /* phi source */ { pseudo_t phi_src; struct instruction_list *phi_users; /* instruction list */ }; struct /* unops */ { pseudo_t src; struct symbol *orig_type; /* casts */ unsigned int offset; /* memops */ }; struct /* binops and sel */ { pseudo_t src1, src2, src3; }; struct /* slice */ { pseudo_t base; unsigned from, len; }; struct /* setval */ { pseudo_t symbol; /* Subtle: same offset as "src" !! */ struct expression *val; }; struct /* call */ { pseudo_t func; struct pseudo_list *arguments; /* instruction list */ struct symbol *fntype; }; struct /* context */ { int increment; int check; struct expression *context_expr; }; struct /* asm */ { const char *string; struct asm_rules *asm_rules; }; }; }; enum opcode { OP_BADOP, /* Entry */ OP_ENTRY, /* Terminator */ OP_TERMINATOR, OP_RET = OP_TERMINATOR, OP_BR, OP_CBR, OP_SWITCH, OP_INVOKE, OP_COMPUTEDGOTO, OP_UNWIND, OP_TERMINATOR_END = OP_UNWIND, /* Binary */ OP_BINARY, OP_ADD = OP_BINARY, OP_SUB, OP_MULU, OP_MULS, OP_DIVU, OP_DIVS, OP_MODU, OP_MODS, OP_SHL, OP_LSR, OP_ASR, /* Logical */ OP_AND, OP_OR, OP_XOR, OP_AND_BOOL, OP_OR_BOOL, OP_BINARY_END = OP_OR_BOOL, /* Binary comparison */ OP_BINCMP, OP_SET_EQ = OP_BINCMP, OP_SET_NE, OP_SET_LE, OP_SET_GE, OP_SET_LT, OP_SET_GT, OP_SET_B, OP_SET_A, OP_SET_BE, OP_SET_AE, OP_BINCMP_END = OP_SET_AE, /* Uni */ OP_NOT, OP_NEG, /* Select - three input values */ OP_SEL, /* Memory */ OP_MALLOC, OP_FREE, OP_ALLOCA, OP_LOAD, OP_STORE, OP_SETVAL, OP_SYMADDR, OP_GET_ELEMENT_PTR, /* Other */ OP_PHI, OP_PHISOURCE, OP_CAST, OP_SCAST, OP_FPCAST, OP_PTRCAST, OP_INLINED_CALL, OP_CALL, OP_VANEXT, OP_VAARG, OP_SLICE, OP_SNOP, OP_LNOP, OP_NOP, OP_DEATHNOTE, OP_ASM, /* Sparse tagging (line numbers, context, whatever) */ OP_CONTEXT, OP_RANGE, /* Needed to translate SSA back to normal form */ OP_COPY, }; /* A basic block represents a series of instructions with no branches. Straight-line code. A branch only occurs at the end of a basic block, and branches can only target the beginning of a basic block. Typically, a conditional will consist of a basic block leading up to the branch, a basic block for the true case, a basic block for the false case, and a basic block where the two paths merge back together. Either the true or the false case may not exist. A loop will normally have a basic block for the loop body, which can branch to the top at the end or continue to the next basic block. So basic blocks represent a node in the control flow graph. The edges in that graph lead from one basic block to a basic block which can follow it in the execution of the program. */ struct basic_block { struct position pos; unsigned long generation; int context; struct entrypoint *ep; struct basic_block_list *parents; /* basic_block sources */ /* predecessors */ struct basic_block_list *children; /* basic_block destinations */ /* successors */ struct instruction_list *insns; /* Linear list of instructions */ struct pseudo_list *needs, *defines; /* pseudo lists */ /* TODO Following fields are used by the codegen backends. In Sparse this is a union but we need the nr field for NanoJIT backend's liveness analysis in addition to creating unique labels. */ //union { unsigned int nr; /* unique id for label's names */ DMRC_BACKEND_TYPE priv; //}; }; static inline int dmrC_instruction_list_size(struct instruction_list *list) { return ptrlist_size((struct ptr_list *)list); } static inline int dmrC_pseudo_list_size(struct pseudo_list *list) { return ptrlist_size((struct ptr_list *)list); } static inline int dmrC_bb_list_size(struct basic_block_list *list) { return ptrlist_size((struct ptr_list *)list); } static inline void dmrC_free_instruction_list(struct pseudo_list **head) { ptrlist_remove_all((struct ptr_list **)head); } static inline struct instruction * dmrC_delete_last_instruction(struct instruction_list **head) { return (struct instruction *) ptrlist_undo_last((struct ptr_list **)head); } static inline struct basic_block * dmrC_delete_last_basic_block(struct basic_block_list **head) { return (struct basic_block *) ptrlist_delete_last((struct ptr_list **)head); } static inline struct basic_block *dmrC_first_basic_block(struct basic_block_list *head) { return (struct basic_block *) ptrlist_first((struct ptr_list *)head); } static inline struct instruction *dmrC_last_instruction(struct instruction_list *head) { return (struct instruction *) ptrlist_last((struct ptr_list *)head); } static inline struct instruction *dmrC_first_instruction(struct instruction_list *head) { return (struct instruction *) ptrlist_first((struct ptr_list *)head); } static inline pseudo_t dmrC_first_pseudo(struct pseudo_list *head) { return (pseudo_t) ptrlist_first((struct ptr_list *)head); } static inline void dmrC_concat_basic_block_list(struct basic_block_list *from, struct basic_block_list **to) { ptrlist_concat((struct ptr_list *)from, (struct ptr_list **)to); } static inline void dmrC_concat_instruction_list(struct instruction_list *from, struct instruction_list **to) { ptrlist_concat((struct ptr_list *)from, (struct ptr_list **)to); } static inline int dmrC_is_branch_goto(struct instruction *br) { return br && br->opcode==OP_BR && (!br->bb_true || !br->bb_false); } static inline void dmrC_add_bb(struct dmr_C *C, struct basic_block_list **list, struct basic_block *bb) { ptrlist_add((struct ptr_list **)list, bb, &C->ptrlist_allocator); } static inline void dmrC_add_instruction(struct dmr_C *C, struct instruction_list **list, struct instruction *insn) { ptrlist_add((struct ptr_list **)list, insn, &C->ptrlist_allocator); } static inline void dmrC_add_multijmp(struct dmr_C *C, struct multijmp_list **list, struct multijmp *multijmp) { ptrlist_add((struct ptr_list **)list, multijmp, &C->ptrlist_allocator); } static inline pseudo_t *dmrC_add_pseudo(struct dmr_C *C, struct pseudo_list **list, pseudo_t pseudo) { return (pseudo_t *) ptrlist_add((struct ptr_list **)list, pseudo, &C->ptrlist_allocator); } static inline int dmrC_remove_pseudo(struct pseudo_list **list, pseudo_t pseudo) { return ptrlist_remove((struct ptr_list **)list, pseudo, 0) != 0; } static inline int dmrC_bb_terminated(struct basic_block *bb) { struct instruction *insn; if (!bb) return 0; insn = dmrC_last_instruction(bb->insns); return insn && insn->opcode >= OP_TERMINATOR && insn->opcode <= OP_TERMINATOR_END; } static inline int dmrC_bb_reachable(struct basic_block *bb) { return bb != NULL; } static inline void dmrC_add_pseudo_user_ptr(struct dmr_C *C, struct pseudo_user *user, struct pseudo_user_list **list) { ptrlist_add((struct ptr_list **)list, user, &C->ptrlist_allocator); } static inline int dmrC_has_use_list(pseudo_t p) { return (p && p->type != PSEUDO_VOID && p->type != PSEUDO_VAL); } static inline struct pseudo_user *dmrC_alloc_pseudo_user(struct dmr_C *C, struct instruction *insn, pseudo_t *pp) { struct pseudo_user *user = (struct pseudo_user *) dmrC_allocator_allocate(&C->L->pseudo_user_allocator, 0); user->userp = pp; user->insn = insn; return user; } static inline void dmrC_use_pseudo(struct dmr_C *C, struct instruction *insn, pseudo_t p, pseudo_t *pp) { *pp = p; if (dmrC_has_use_list(p)) dmrC_add_pseudo_user_ptr(C, dmrC_alloc_pseudo_user(C, insn, pp), &p->users); } static inline void dmrC_remove_bb_from_list(struct basic_block_list **list, struct basic_block *entry, int count) { ptrlist_remove((struct ptr_list **)list, entry, count); } static inline void dmrC_replace_bb_in_list(struct basic_block_list **list, struct basic_block *old, struct basic_block *newbb, int count) { ptrlist_replace((struct ptr_list **)list, old, newbb, count); } struct entrypoint { struct symbol *name; struct symbol_list *syms; /* symbol list */ struct pseudo_list *accesses; /* pseudo list */ struct basic_block_list *bbs; /* basic_block list */ struct basic_block *active; struct instruction *entry; }; extern void dmrC_insert_select(struct dmr_C *C, struct basic_block *bb, struct instruction *br, struct instruction *phi, pseudo_t if_true, pseudo_t if_false); extern void dmrC_insert_branch(struct dmr_C *C, struct basic_block *bb, struct instruction *br, struct basic_block *target); // From Luc: sssa-mini struct instruction *dmrC_alloc_phisrc(struct dmr_C *C, pseudo_t pseudo, struct symbol *type); pseudo_t dmrC_insert_phi_node(struct dmr_C *C, struct basic_block *bb, struct symbol *type); pseudo_t dmrC_alloc_phi(struct dmr_C *C, struct basic_block *source, pseudo_t pseudo, struct symbol *type); pseudo_t dmrC_alloc_pseudo(struct dmr_C *C, struct instruction *def); pseudo_t dmrC_value_pseudo(struct dmr_C *C, struct symbol *type, long long val); unsigned int dmrC_value_size(long long value); struct entrypoint *dmrC_linearize_symbol(struct dmr_C *C, struct symbol *sym); int dmrC_unssa(struct dmr_C *C, struct entrypoint *ep); void dmrC_show_entry(struct dmr_C *C, struct entrypoint *ep); const char *dmrC_show_pseudo(struct dmr_C *C, pseudo_t pseudo); void dmrC_show_bb(struct dmr_C *C, struct basic_block *bb); const char *dmrC_show_instruction(struct dmr_C *C, struct instruction *insn); void dmrC_convert_instruction_target(struct dmr_C *C, struct instruction *insn, pseudo_t src); void dmrC_kill_use(struct dmr_C *C, pseudo_t *usep); void dmrC_kill_insn(struct dmr_C *C, struct instruction *, int force); void dmrC_kill_unreachable_bbs(struct dmr_C *C, struct entrypoint *ep); void dmrC_kill_bb(struct dmr_C *C, struct basic_block *); static inline void dmrC_kill_instruction(struct dmr_C *C, struct instruction *insn) { dmrC_kill_insn(C, insn, 0); } static inline void dmrC_kill_instruction_force(struct dmr_C *C, struct instruction *insn) { dmrC_kill_insn(C, insn, 1); } void dmrC_clear_liveness(struct entrypoint *ep); void dmrC_track_pseudo_liveness(struct dmr_C *C, struct entrypoint *ep); void dmrC_track_pseudo_death(struct dmr_C *C, struct entrypoint *ep); void dmrC_track_phi_uses(struct dmr_C *C, struct instruction *insn); void dmrC_init_linearizer(struct dmr_C *C); void dmrC_destroy_linearizer(struct dmr_C *C); #define dmrC_hashval(x) ((unsigned long)(((uintptr_t)(x)))) #define REPEAT_CSE 1 #define REPEAT_SYMBOL_CLEANUP 2 #define REPEAT_CFG_CLEANUP 3 #ifdef __cplusplus } #endif #endif /* LINEARIZE_H */
#ifndef VAR_0 #define VAR_0 /* * Linearize - walk the parse tree and generate a linear version * of it and the basic blocks. * * Copyright (C) 2004 <NAME> * Copyright (C) 2004 <NAME> */ #include <IMPORT_0> #include <IMPORT_1> #include <IMPORT_2> #include <IMPORT_3> #include <IMPORT_4> #ifdef VAR_1 extern "C" { #endif struct CLASS_0; DECLARE_PTR_LIST(VAR_3, VAR_4 VAR_5); DECLARE_PTR_LIST(VAR_6, VAR_4 VAR_2); DECLARE_PTR_LIST(VAR_7, VAR_4 multijmp); DECLARE_PTR_LIST(VAR_8, VAR_4 pseudo); struct pseudo_user { struct CLASS_0 *insn; CLASS_6 *VAR_9; }; DECLARE_PTR_LIST(pseudo_user_list, VAR_4 pseudo_user); enum CLASS_7 { VAR_10, PSEUDO_REG, PSEUDO_SYM, PSEUDO_VAL, VAR_11, VAR_12, }; /* Have you ever heard of "static single assignment" or SSA form? struct pseudo represents one of those single-assignment variables. Each one has a pointer to the symbol it represents (which may have many pseudos referencing it). Each one also has a pointer to the instruction that defines it.*/ struct pseudo { int nr; enum CLASS_7 VAR_13; int VAR_14; /* OP_SETVAL only */ struct pseudo_user_list *VAR_15; /* pseudo_user list */ struct CLASS_8 *VAR_16; union { struct symbol *sym; // PSEUDO_SYM, VAL & ARG struct CLASS_0 *VAR_17; // PSEUDO_REG & PHI long long value; // PSEUDO_VAL }; CLASS_9 VAR_18; CLASS_9 VAR_19; /* FIXME - we use this to save ptr to allocated stack in PHI instructions (nanojit) */ }; struct CLASS_10 { struct CLASS_11 VAR_20; struct CLASS_11 pseudo_user_allocator; struct CLASS_11 asm_constraint_allocator; struct CLASS_11 asm_rules_allocator; struct CLASS_11 VAR_21; struct CLASS_11 VAR_22; struct CLASS_11 VAR_23; struct CLASS_11 VAR_24; struct pseudo void_pseudo; struct CLASS_12 VAR_25; int repeat_phase; unsigned long bb_generation; int VAR_26; struct CLASS_5 **VAR_27; struct CLASS_5 *dead_list; #define VAR_28 64 struct CLASS_5 *VAR_29[VAR_28]; /* from pseudo_t value_pseudo(long long val) in linearize.c */ int nr; /* pseudo number */ int bb_nr; /* basic block number */ char VAR_30[4096*4]; int n; char VAR_31[4][64]; #define VAR_32 256 struct CLASS_3 *VAR_33[VAR_32]; }; #define VOID_PSEUDO(VAR_34) (&C->L->void_pseudo) struct multijmp { struct CLASS_2 *target; long long begin, VAR_35; }; struct CLASS_13 { CLASS_6 pseudo; const char *VAR_37; const struct CLASS_8 *VAR_16; }; DECLARE_PTR_LIST(asm_constraint_list, VAR_4 VAR_36); struct asm_rules { struct asm_constraint_list *inputs; /* list of asm_constraint */ struct asm_constraint_list *outputs; /* list of asm_constraint */ struct asm_constraint_list *VAR_38; /* list of asm_constraint */ }; struct CLASS_0 { unsigned VAR_39:8, VAR_14:24; struct CLASS_2 *bb; struct CLASS_12 VAR_40; struct symbol *VAR_13; union { CLASS_6 target; CLASS_6 VAR_41; /* for branch and switch */ }; union { struct /* entrypoint */ { struct CLASS_5 *VAR_42; /* pseudo list */ }; struct /* branch */ { struct CLASS_2 *bb_true, *bb_false; }; struct /* switch */ { struct CLASS_4 *VAR_7; }; struct /* phi_node */ { struct CLASS_5 *VAR_43; /* pseudo list */ }; struct /* phi source */ { CLASS_6 phi_src; struct CLASS_3 *phi_users; /* instruction list */ }; struct /* unops */ { CLASS_6 VAR_44; struct symbol *VAR_45; /* casts */ unsigned int VAR_46; /* memops */ }; struct /* binops and sel */ { CLASS_6 src1, VAR_47, src3; }; struct /* slice */ { CLASS_6 VAR_48; unsigned VAR_49, len; }; struct /* setval */ { CLASS_6 symbol; /* Subtle: same offset as "src" !! */ struct CLASS_15 *VAR_50; }; struct /* call */ { CLASS_6 func; struct CLASS_5 *VAR_51; /* instruction list */ struct symbol *fntype; }; struct /* context */ { int VAR_52; int VAR_53; struct CLASS_15 *context_expr; }; struct /* asm */ { const char *string; struct asm_rules *asm_rules; }; }; }; enum CLASS_14 { VAR_54, /* Entry */ VAR_55, /* Terminator */ VAR_56, OP_RET = VAR_56, VAR_57, VAR_58, OP_SWITCH, OP_INVOKE, VAR_59, VAR_60, VAR_61 = VAR_60, /* Binary */ VAR_62, OP_ADD = VAR_62, OP_SUB, OP_MULU, VAR_63, VAR_64, OP_DIVS, VAR_65, VAR_66, VAR_67, VAR_68, VAR_69, /* Logical */ VAR_70, VAR_71, VAR_72, VAR_73, VAR_74, OP_BINARY_END = VAR_74, /* Binary comparison */ VAR_75, VAR_76 = VAR_75, OP_SET_NE, OP_SET_LE, OP_SET_GE, VAR_77, OP_SET_GT, VAR_78, VAR_79, VAR_80, OP_SET_AE, VAR_81 = OP_SET_AE, /* Uni */ VAR_82, VAR_83, /* Select - three input values */ OP_SEL, /* Memory */ VAR_84, VAR_85, OP_ALLOCA, OP_LOAD, VAR_86, VAR_87, OP_SYMADDR, OP_GET_ELEMENT_PTR, /* Other */ OP_PHI, VAR_88, VAR_89, VAR_90, VAR_91, VAR_92, VAR_93, VAR_94, OP_VANEXT, OP_VAARG, VAR_95, VAR_96, VAR_97, VAR_98, VAR_99, VAR_100, /* Sparse tagging (line numbers, context, whatever) */ VAR_101, OP_RANGE, /* Needed to translate SSA back to normal form */ VAR_102, }; /* A basic block represents a series of instructions with no branches. Straight-line code. A branch only occurs at the end of a basic block, and branches can only target the beginning of a basic block. Typically, a conditional will consist of a basic block leading up to the branch, a basic block for the true case, a basic block for the false case, and a basic block where the two paths merge back together. Either the true or the false case may not exist. A loop will normally have a basic block for the loop body, which can branch to the top at the end or continue to the next basic block. So basic blocks represent a node in the control flow graph. The edges in that graph lead from one basic block to a basic block which can follow it in the execution of the program. */ struct CLASS_2 { struct CLASS_12 VAR_40; unsigned long VAR_103; int VAR_104; struct CLASS_16 *VAR_105; struct CLASS_1 *VAR_106; /* basic_block sources */ /* predecessors */ struct CLASS_1 *children; /* basic_block destinations */ /* successors */ struct CLASS_3 *insns; /* Linear list of instructions */ struct CLASS_5 *VAR_107, *defines; /* pseudo lists */ /* TODO Following fields are used by the codegen backends. In Sparse this is a union but we need the nr field for NanoJIT backend's liveness analysis in addition to creating unique labels. */ //union { unsigned int nr; /* unique id for label's names */ CLASS_9 VAR_18; //}; }; static inline int FUNC_0(struct CLASS_3 *list) { return FUNC_1((struct CLASS_17 *)list); } static inline int dmrC_pseudo_list_size(struct CLASS_5 *list) { return FUNC_1((struct CLASS_17 *)list); } static inline int FUNC_2(struct CLASS_1 *list) { return FUNC_1((struct CLASS_17 *)list); } static inline void dmrC_free_instruction_list(struct CLASS_5 **VAR_108) { ptrlist_remove_all((struct CLASS_17 **)VAR_108); } static inline struct CLASS_0 * dmrC_delete_last_instruction(struct CLASS_3 **VAR_108) { return (struct CLASS_0 *) ptrlist_undo_last((struct CLASS_17 **)VAR_108); } static inline struct CLASS_2 * FUNC_3(struct CLASS_1 **VAR_108) { return (struct CLASS_2 *) ptrlist_delete_last((struct CLASS_17 **)VAR_108); } static inline struct CLASS_2 *FUNC_4(struct CLASS_1 *VAR_108) { return (struct CLASS_2 *) FUNC_5((struct CLASS_17 *)VAR_108); } static inline struct CLASS_0 *FUNC_6(struct CLASS_3 *VAR_108) { return (struct CLASS_0 *) FUNC_7((struct CLASS_17 *)VAR_108); } static inline struct CLASS_0 *dmrC_first_instruction(struct CLASS_3 *VAR_108) { return (struct CLASS_0 *) FUNC_5((struct CLASS_17 *)VAR_108); } static inline CLASS_6 FUNC_8(struct CLASS_5 *VAR_108) { return (ID_0) FUNC_5((struct CLASS_17 *)VAR_108); } static inline void dmrC_concat_basic_block_list(struct CLASS_1 *VAR_49, struct CLASS_1 **VAR_109) { ptrlist_concat((struct CLASS_17 *)VAR_49, (struct CLASS_17 **)VAR_109); } static inline void FUNC_9(struct CLASS_3 *VAR_49, struct CLASS_3 **VAR_109) { ptrlist_concat((struct CLASS_17 *)VAR_49, (struct CLASS_17 **)VAR_109); } static inline int FUNC_10(struct CLASS_0 *br) { return br && br->VAR_39==VAR_57 && (!br->bb_true || !br->bb_false); } static inline void FUNC_11(struct CLASS_18 *VAR_34, struct CLASS_1 **list, struct CLASS_2 *bb) { FUNC_12((struct CLASS_17 **)list, bb, &VAR_34->VAR_110); } static inline void FUNC_13(struct CLASS_18 *VAR_34, struct CLASS_3 **list, struct CLASS_0 *insn) { FUNC_12((struct CLASS_17 **)list, insn, &VAR_34->VAR_110); } static inline void FUNC_14(struct CLASS_18 *VAR_34, struct CLASS_4 **list, struct multijmp *multijmp) { FUNC_12((struct CLASS_17 **)list, multijmp, &VAR_34->VAR_110); } static inline CLASS_6 *FUNC_15(struct CLASS_18 *VAR_34, struct CLASS_5 **list, CLASS_6 pseudo) { return (CLASS_6 *) FUNC_12((struct CLASS_17 **)list, pseudo, &VAR_34->VAR_110); } static inline int dmrC_remove_pseudo(struct CLASS_5 **list, CLASS_6 pseudo) { return FUNC_16((struct CLASS_17 **)list, pseudo, 0) != 0; } static inline int dmrC_bb_terminated(struct CLASS_2 *bb) { struct CLASS_0 *insn; if (!bb) return 0; insn = FUNC_6(bb->insns); return insn && insn->VAR_39 >= VAR_56 && insn->VAR_39 <= VAR_61; } static inline int dmrC_bb_reachable(struct CLASS_2 *bb) { return bb != NULL; } static inline void FUNC_17(struct CLASS_18 *VAR_34, struct pseudo_user *VAR_111, struct pseudo_user_list **list) { FUNC_12((struct CLASS_17 **)list, VAR_111, &VAR_34->VAR_110); } static inline int dmrC_has_use_list(CLASS_6 VAR_112) { return (VAR_112 && VAR_112->VAR_13 != VAR_10 && VAR_112->VAR_13 != PSEUDO_VAL); } static inline struct pseudo_user *FUNC_18(struct CLASS_18 *VAR_34, struct CLASS_0 *insn, CLASS_6 *pp) { struct pseudo_user *VAR_111 = (struct pseudo_user *) FUNC_19(&VAR_34->VAR_113->pseudo_user_allocator, 0); VAR_111->VAR_9 = pp; VAR_111->insn = insn; return VAR_111; } static inline void dmrC_use_pseudo(struct CLASS_18 *VAR_34, struct CLASS_0 *insn, CLASS_6 VAR_112, CLASS_6 *pp) { *pp = VAR_112; if (dmrC_has_use_list(VAR_112)) FUNC_17(VAR_34, FUNC_18(VAR_34, insn, pp), &VAR_112->VAR_15); } static inline void FUNC_20(struct CLASS_1 **list, struct CLASS_2 *VAR_114, int VAR_115) { FUNC_16((struct CLASS_17 **)list, VAR_114, VAR_115); } static inline void dmrC_replace_bb_in_list(struct CLASS_1 **list, struct CLASS_2 *VAR_116, struct CLASS_2 *VAR_117, int VAR_115) { FUNC_21((struct CLASS_17 **)list, VAR_116, VAR_117, VAR_115); } struct CLASS_16 { struct symbol *name; struct CLASS_19 *VAR_118; /* symbol list */ struct CLASS_5 *accesses; /* pseudo list */ struct CLASS_1 *VAR_119; /* basic_block list */ struct CLASS_2 *active; struct CLASS_0 *VAR_114; }; extern void FUNC_22(struct CLASS_18 *VAR_34, struct CLASS_2 *bb, struct CLASS_0 *br, struct CLASS_0 *VAR_120, CLASS_6 VAR_121, CLASS_6 if_false); extern void dmrC_insert_branch(struct CLASS_18 *VAR_34, struct CLASS_2 *bb, struct CLASS_0 *br, struct CLASS_2 *target); // From Luc: sssa-mini struct CLASS_0 *FUNC_23(struct CLASS_18 *VAR_34, CLASS_6 pseudo, struct symbol *VAR_13); CLASS_6 dmrC_insert_phi_node(struct CLASS_18 *VAR_34, struct CLASS_2 *bb, struct symbol *VAR_13); CLASS_6 FUNC_24(struct CLASS_18 *VAR_34, struct CLASS_2 *VAR_122, CLASS_6 pseudo, struct symbol *VAR_13); CLASS_6 dmrC_alloc_pseudo(struct CLASS_18 *VAR_34, struct CLASS_0 *VAR_17); CLASS_6 FUNC_25(struct CLASS_18 *VAR_34, struct symbol *VAR_13, long long VAR_50); unsigned int dmrC_value_size(long long value); struct CLASS_16 *dmrC_linearize_symbol(struct CLASS_18 *VAR_34, struct symbol *sym); int dmrC_unssa(struct CLASS_18 *VAR_34, struct CLASS_16 *VAR_105); void FUNC_26(struct CLASS_18 *VAR_34, struct CLASS_16 *VAR_105); const char *FUNC_27(struct CLASS_18 *VAR_34, CLASS_6 pseudo); void FUNC_28(struct CLASS_18 *VAR_34, struct CLASS_2 *bb); const char *dmrC_show_instruction(struct CLASS_18 *VAR_34, struct CLASS_0 *insn); void FUNC_29(struct CLASS_18 *VAR_34, struct CLASS_0 *insn, CLASS_6 VAR_44); void dmrC_kill_use(struct CLASS_18 *VAR_34, CLASS_6 *usep); void FUNC_30(struct CLASS_18 *VAR_34, struct CLASS_0 *, int force); void FUNC_31(struct CLASS_18 *VAR_34, struct CLASS_16 *VAR_105); void FUNC_32(struct CLASS_18 *VAR_34, struct CLASS_2 *); static inline void dmrC_kill_instruction(struct CLASS_18 *VAR_34, struct CLASS_0 *insn) { FUNC_30(VAR_34, insn, 0); } static inline void dmrC_kill_instruction_force(struct CLASS_18 *VAR_34, struct CLASS_0 *insn) { FUNC_30(VAR_34, insn, 1); } void FUNC_33(struct CLASS_16 *VAR_105); void FUNC_34(struct CLASS_18 *VAR_34, struct CLASS_16 *VAR_105); void FUNC_35(struct CLASS_18 *VAR_34, struct CLASS_16 *VAR_105); void FUNC_36(struct CLASS_18 *VAR_34, struct CLASS_0 *insn); void FUNC_37(struct CLASS_18 *VAR_34); void dmrC_destroy_linearizer(struct CLASS_18 *VAR_34); #define FUNC_38(x) ((unsigned long)(((uintptr_t)(x)))) #define VAR_123 1 #define REPEAT_SYMBOL_CLEANUP 2 #define VAR_124 3 #ifdef VAR_1 } #endif #endif /* LINEARIZE_H */
0.616183
{'VAR_0': 'DMR_C_LINEARIZE_H', 'IMPORT_0': 'lib.h', 'IMPORT_1': 'allocate.h', 'IMPORT_2': 'token.h', 'IMPORT_3': 'parse.h', 'IMPORT_4': 'symbol.h', 'VAR_1': '__cplusplus', 'CLASS_0': 'instruction', 'VAR_2': 'instruction', 'VAR_3': 'basic_block_list', 'CLASS_1': 'basic_block_list', 'VAR_4': 'struct', 'VAR_5': 'basic_block', 'CLASS_2': 'basic_block', 'VAR_6': 'instruction_list', 'CLASS_3': 'instruction_list', 'VAR_7': 'multijmp_list', 'CLASS_4': 'multijmp_list', 'VAR_8': 'pseudo_list', 'CLASS_5': 'pseudo_list', 'CLASS_6': 'pseudo_t', 'ID_0': 'pseudo_t', 'VAR_9': 'userp', 'CLASS_7': 'pseudo_type', 'VAR_10': 'PSEUDO_VOID', 'VAR_11': 'PSEUDO_ARG', 'VAR_12': 'PSEUDO_PHI', 'VAR_13': 'type', 'VAR_14': 'size', 'VAR_15': 'users', 'CLASS_8': 'ident', 'VAR_16': 'ident', 'VAR_17': 'def', 'CLASS_9': 'DMRC_BACKEND_TYPE', 'VAR_18': 'priv', 'VAR_19': 'priv2', 'CLASS_10': 'linearizer_state_t', 'CLASS_11': 'allocator', 'VAR_20': 'pseudo_allocator', 'VAR_21': 'multijmp_allocator', 'VAR_22': 'basic_block_allocator', 'VAR_23': 'entrypoint_allocator', 'VAR_24': 'instruction_allocator', 'CLASS_12': 'position', 'VAR_25': 'current_pos', 'VAR_26': 'liveness_changed', 'VAR_27': 'live_list', 'VAR_28': 'MAX_VAL_HASH', 'VAR_29': 'prev', 'VAR_30': 'buffer', 'VAR_31': 'pseudo_buffer', 'VAR_32': 'INSN_HASH_SIZE', 'VAR_33': 'insn_hash_table', 'VAR_34': 'C', 'VAR_35': 'end', 'CLASS_13': 'asm_constraint', 'VAR_36': 'asm_constraint', 'VAR_37': 'constraint', 'VAR_38': 'clobbers', 'VAR_39': 'opcode', 'CLASS_14': 'opcode', 'VAR_40': 'pos', 'VAR_41': 'cond', 'VAR_42': 'arg_list', 'VAR_43': 'phi_list', 'VAR_44': 'src', 'VAR_45': 'orig_type', 'VAR_46': 'offset', 'VAR_47': 'src2', 'VAR_48': 'base', 'VAR_49': 'from', 'CLASS_15': 'expression', 'VAR_50': 'val', 'VAR_51': 'arguments', 'VAR_52': 'increment', 'VAR_53': 'check', 'VAR_54': 'OP_BADOP', 'VAR_55': 'OP_ENTRY', 'VAR_56': 'OP_TERMINATOR', 'VAR_57': 'OP_BR', 'VAR_58': 'OP_CBR', 'VAR_59': 'OP_COMPUTEDGOTO', 'VAR_60': 'OP_UNWIND', 'VAR_61': 'OP_TERMINATOR_END', 'VAR_62': 'OP_BINARY', 'VAR_63': 'OP_MULS', 'VAR_64': 'OP_DIVU', 'VAR_65': 'OP_MODU', 'VAR_66': 'OP_MODS', 'VAR_67': 'OP_SHL', 'VAR_68': 'OP_LSR', 'VAR_69': 'OP_ASR', 'VAR_70': 'OP_AND', 'VAR_71': 'OP_OR', 'VAR_72': 'OP_XOR', 'VAR_73': 'OP_AND_BOOL', 'VAR_74': 'OP_OR_BOOL', 'VAR_75': 'OP_BINCMP', 'VAR_76': 'OP_SET_EQ', 'VAR_77': 'OP_SET_LT', 'VAR_78': 'OP_SET_B', 'VAR_79': 'OP_SET_A', 'VAR_80': 'OP_SET_BE', 'VAR_81': 'OP_BINCMP_END', 'VAR_82': 'OP_NOT', 'VAR_83': 'OP_NEG', 'VAR_84': 'OP_MALLOC', 'VAR_85': 'OP_FREE', 'VAR_86': 'OP_STORE', 'VAR_87': 'OP_SETVAL', 'VAR_88': 'OP_PHISOURCE', 'VAR_89': 'OP_CAST', 'VAR_90': 'OP_SCAST', 'VAR_91': 'OP_FPCAST', 'VAR_92': 'OP_PTRCAST', 'VAR_93': 'OP_INLINED_CALL', 'VAR_94': 'OP_CALL', 'VAR_95': 'OP_SLICE', 'VAR_96': 'OP_SNOP', 'VAR_97': 'OP_LNOP', 'VAR_98': 'OP_NOP', 'VAR_99': 'OP_DEATHNOTE', 'VAR_100': 'OP_ASM', 'VAR_101': 'OP_CONTEXT', 'VAR_102': 'OP_COPY', 'VAR_103': 'generation', 'VAR_104': 'context', 'CLASS_16': 'entrypoint', 'VAR_105': 'ep', 'VAR_106': 'parents', 'VAR_107': 'needs', 'FUNC_0': 'dmrC_instruction_list_size', 'FUNC_1': 'ptrlist_size', 'CLASS_17': 'ptr_list', 'FUNC_2': 'dmrC_bb_list_size', 'VAR_108': 'head', 'FUNC_3': 'dmrC_delete_last_basic_block', 'FUNC_4': 'dmrC_first_basic_block', 'FUNC_5': 'ptrlist_first', 'FUNC_6': 'dmrC_last_instruction', 'FUNC_7': 'ptrlist_last', 'FUNC_8': 'dmrC_first_pseudo', 'VAR_109': 'to', 'FUNC_9': 'dmrC_concat_instruction_list', 'FUNC_10': 'dmrC_is_branch_goto', 'FUNC_11': 'dmrC_add_bb', 'CLASS_18': 'dmr_C', 'FUNC_12': 'ptrlist_add', 'VAR_110': 'ptrlist_allocator', 'FUNC_13': 'dmrC_add_instruction', 'FUNC_14': 'dmrC_add_multijmp', 'FUNC_15': 'dmrC_add_pseudo', 'FUNC_16': 'ptrlist_remove', 'FUNC_17': 'dmrC_add_pseudo_user_ptr', 'VAR_111': 'user', 'VAR_112': 'p', 'FUNC_18': 'dmrC_alloc_pseudo_user', 'FUNC_19': 'dmrC_allocator_allocate', 'VAR_113': 'L', 'FUNC_20': 'dmrC_remove_bb_from_list', 'VAR_114': 'entry', 'VAR_115': 'count', 'VAR_116': 'old', 'VAR_117': 'newbb', 'FUNC_21': 'ptrlist_replace', 'CLASS_19': 'symbol_list', 'VAR_118': 'syms', 'VAR_119': 'bbs', 'FUNC_22': 'dmrC_insert_select', 'VAR_120': 'phi', 'VAR_121': 'if_true', 'FUNC_23': 'dmrC_alloc_phisrc', 'FUNC_24': 'dmrC_alloc_phi', 'VAR_122': 'source', 'FUNC_25': 'dmrC_value_pseudo', 'FUNC_26': 'dmrC_show_entry', 'FUNC_27': 'dmrC_show_pseudo', 'FUNC_28': 'dmrC_show_bb', 'FUNC_29': 'dmrC_convert_instruction_target', 'FUNC_30': 'dmrC_kill_insn', 'FUNC_31': 'dmrC_kill_unreachable_bbs', 'FUNC_32': 'dmrC_kill_bb', 'FUNC_33': 'dmrC_clear_liveness', 'FUNC_34': 'dmrC_track_pseudo_liveness', 'FUNC_35': 'dmrC_track_pseudo_death', 'FUNC_36': 'dmrC_track_phi_uses', 'FUNC_37': 'dmrC_init_linearizer', 'FUNC_38': 'dmrC_hashval', 'VAR_123': 'REPEAT_CSE', 'VAR_124': 'REPEAT_CFG_CLEANUP'}
//+------------------------------------------------------------------------- // // Microsoft Windows // // Copyright (C) Microsoft Corporation // // File: queue.h // //-------------------------------------------------------------------------- #if !defined( _QUEUE_H_ ) #define _QUEUE_H_ #define SMALL_STRING 64 #include <tchar.h> #include <cmnhdr.h> #include <windows.h> #include <winsock2.h> #include <TlntUtils.h> #include <Telnetd.h> class CQueue; typedef char IP_ADDR; typedef struct Q_LIST_ENTRY { struct Q_LIST_ENTRY *pQPrev; struct Q_LIST_ENTRY *pQNext; IP_ADDR chIPAddr[SMALL_STRING]; DWORD dwPid; HANDLE hWritePipe; } Q_LIST_ENTRY, *PQ_LIST_ENTRY; class CQueue { PQ_LIST_ENTRY m_pHead; PQ_LIST_ENTRY m_pTail; CRITICAL_SECTION m_csQModification; public: DWORD m_dwNumOfUnauthenticatedConnections; DWORD m_dwMaxUnauthenticatedConnections; DWORD m_dwMaxIPLimit; // constructor CQueue(); // destructor ~CQueue(); bool IsQFull(); // Allocates memory for an entry and adds it in the queue. bool Push(DWORD dwPid, HANDLE *phWritePipe, IP_ADDR *pchIPAddr); // Frees a head entry in the queue. bool Pop(HANDLE *phWritePipe); // Frees a particular entry in the queue. bool FreeEntry(DWORD dwPid); //See if allowed to add to the queue. bool OkToProceedWithThisClient(IP_ADDR *pchIPAddr); //Check whether the client was added to our queue or not bool WasTheClientAdded(DWORD dwPid, IP_ADDR *pchIPAddr, HANDLE *phWritePipe, bool *pbSendMessage); //See if per IP limit is reached bool IsIPLimitReached(IP_ADDR *pchIPAddr); }; #endif
//+------------------------------------------------------------------------- // // Microsoft Windows // // Copyright (C) Microsoft Corporation // // File: queue.h // //-------------------------------------------------------------------------- #if !defined( _QUEUE_H_ ) #define _QUEUE_H_ #define SMALL_STRING 64 #include <tchar.h> #include <cmnhdr.h> #include <windows.h> #include <winsock2.h> #include <TlntUtils.h> #include <Telnetd.h> class CQueue; typedef char ID_0; typedef struct Q_LIST_ENTRY { struct Q_LIST_ENTRY *pQPrev; struct Q_LIST_ENTRY *pQNext; CLASS_0 chIPAddr[SMALL_STRING]; DWORD dwPid; HANDLE hWritePipe; } Q_LIST_ENTRY, *PQ_LIST_ENTRY; class CQueue { PQ_LIST_ENTRY VAR_0; PQ_LIST_ENTRY m_pTail; CRITICAL_SECTION m_csQModification; public: DWORD m_dwNumOfUnauthenticatedConnections; DWORD m_dwMaxUnauthenticatedConnections; DWORD m_dwMaxIPLimit; // constructor CQueue(); // destructor ~CQueue(); bool IsQFull(); // Allocates memory for an entry and adds it in the queue. bool Push(DWORD dwPid, HANDLE *phWritePipe, CLASS_0 *VAR_1); // Frees a head entry in the queue. bool Pop(HANDLE *phWritePipe); // Frees a particular entry in the queue. bool FreeEntry(DWORD dwPid); //See if allowed to add to the queue. bool OkToProceedWithThisClient(CLASS_0 *VAR_1); //Check whether the client was added to our queue or not bool WasTheClientAdded(DWORD dwPid, CLASS_0 *VAR_1, HANDLE *phWritePipe, bool *VAR_2); //See if per IP limit is reached bool IsIPLimitReached(CLASS_0 *VAR_1); }; #endif
0.165589
{'ID_0': 'IP_ADDR', 'CLASS_0': 'IP_ADDR', 'VAR_0': 'm_pHead', 'VAR_1': 'pchIPAddr', 'VAR_2': 'pbSendMessage'}
// Copyright 2017-2019 <NAME>, <NAME> #pragma once #include "UObject/Object.h" #include "DlgNodeData.generated.h" /** * Abstract base class for node data * Defining class via inheriting from UNYTaskBase outside of the plugin is possible both in Blueprint and C++ * Extend this class to define additional data you want to store on your nodes */ UCLASS(BlueprintType, Blueprintable, EditInlineNew, Abstract) class DLGSYSTEM_API UDlgNodeData : public UObject { GENERATED_BODY() };
// Copyright 2017-2019 <NAME>, <NAME> #pragma once #include "IMPORT_0" #include "DlgNodeData.generated.h" /** * Abstract base class for node data * Defining class via inheriting from UNYTaskBase outside of the plugin is possible both in Blueprint and C++ * Extend this class to define additional data you want to store on your nodes */ FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3) VAR_4 CLASS_0 VAR_5 : VAR_6 UObject { GENERATED_BODY() };
0.776671
{'IMPORT_0': 'UObject/Object.h', 'FUNC_0': 'UCLASS', 'VAR_0': 'BlueprintType', 'VAR_1': 'Blueprintable', 'VAR_2': 'EditInlineNew', 'VAR_3': 'Abstract', 'VAR_4': 'class', 'CLASS_0': 'DLGSYSTEM_API', 'VAR_5': 'UDlgNodeData', 'VAR_6': 'public'}
// // UIViewController+UIScreenBrightness.h // PPMakerExample // // Created by PPAbner on 2019/10/31. // Copyright © 2019 PPAbner. All rights reserved. // #import <UIKit/UIKit.h> @interface UIViewController (UIScreenBrightness) /// 是否更新用户设置的亮度,默认NO。 /// 用户设置包含以下2种情况: /// 1.不活跃状态(UIApplicationStateInactive)时,【下拉通知栏】更改亮度,更新用户设置的亮度; /// 2. 进入后台(UIApplicationStateBackground,双击home键或者打开其它APP), /// 用户通过【设置--亮度】or【下拉通知栏】更改亮度,更新用户设置的亮度。 /// 参考: /// 「支付宝 & 微信」付款码界面,isNeedToUpdateWhenUserBrightnessChanged = NO; /// @property (nonatomic, assign) BOOL isNeedToUpdateWhenUserBrightnessChanged; /// 设置最大亮度(0.0 - 1.0) /// 如果小于0.0,默认0.6; /// 如果大于1.0,默认1.0; /// @param maxBrightness 最大亮度 - (void)setupMaxBrightness:(CGFloat)maxBrightness; /// 进入扫码界面,渐变到最大亮度(maxBrightness) - (void)changeToMaxBrightnessWhenViewDidAppear; /// 退出扫码界面,恢复到用户设置的亮度 - (void)changeToUserBrightnessWhenViewDidDisappear; @end
// // UIViewController+UIScreenBrightness.h // PPMakerExample // // Created by PPAbner on 2019/10/31. // Copyright © 2019 PPAbner. All rights reserved. // #import <UIKit/UIKit.h> @CLASS_0 FUNC_0 (UIScreenBrightness) /// 是否更新用户设置的亮度,默认NO。 /// 用户设置包含以下2种情况: /// 1.不活跃状态(UIApplicationStateInactive)时,【下拉通知栏】更改亮度,更新用户设置的亮度; /// 2. 进入后台(UIApplicationStateBackground,双击home键或者打开其它APP), /// 用户通过【设置--亮度】or【下拉通知栏】更改亮度,更新用户设置的亮度。 /// 参考: /// 「支付宝 & 微信」付款码界面,isNeedToUpdateWhenUserBrightnessChanged = NO; /// @property (ID_0, assign) BOOL VAR_0; /// 设置最大亮度(0.0 - 1.0) /// 如果小于0.0,默认0.6; /// 如果大于1.0,默认1.0; /// @param maxBrightness 最大亮度 - (void)VAR_1:(CGFloat)maxBrightness; /// 进入扫码界面,渐变到最大亮度(maxBrightness) - (void)changeToMaxBrightnessWhenViewDidAppear; /// 退出扫码界面,恢复到用户设置的亮度 - (void)VAR_2; @VAR_3
0.593521
{'CLASS_0': 'interface', 'FUNC_0': 'UIViewController', 'ID_0': 'nonatomic', 'VAR_0': 'isNeedToUpdateWhenUserBrightnessChanged', 'VAR_1': 'setupMaxBrightness', 'VAR_2': 'changeToUserBrightnessWhenViewDidDisappear', 'VAR_3': 'end'}
/* * File : ServiceDef.h * Remark : Service number and call service definition used by NanoOS API * */ #ifndef SERVICE_DEF_H #define SERVICE_DEF_H #define SVC__ZERO 0 #define SVC__GET_OS_VERSION 1 #define SVC__GET_OS_NAME 2 #define SVC__GET_SYSTEM_CLOCK 3 #define SVC__RESERVED4 4 #define SVC__DEBUG_CHAR_OUT 5 #define SVC__RESERVED6 6 #define SVC__IS_USB_SER_READY 7 #define SVC__WRITE_USB_SER 8 #define SVC__READ_USB_SER 9 #define SVC__CANCEL_READ_USB_SER 10 #define SVC__RESERVED11 11 #define SVC__CREATE_THREAD 12 #define SVC__TERMINATE_THREAD 13 #define SVC__EXIT_THREAD 14 #define SVC__GET_THREAD_RETURN_VALUE 15 #define SVC__GET_THREAD_STATUS 16 #define SVC__GET_CURRENT_THREAD_ID 17 #define SVC__SLEEP 18 #define SVC__SUSPEND_THREAD 19 #define SVC__RESUME_THREAD 20 #define SVC__WAIT_FOR_OBJECT 21 #define SVC__SWITCH_TO_NEXT_THREAD 22 #define SVC__RESERVED23 23 #define SVC__RESERVED24 24 #define SVC__RESERVED25 25 #define SVC__RESERVED26 26 #define SVC__CREATE_EVENT 27 #define SVC__SET_EVENT 28 #define SVC__RESET_EVENT 29 #define SVC__CLOSE_EVENT 30 #define SVC__RESERVED31 31 #define SVC__RESERVED32 32 #define SVC__SET_TERMINATION_HANDLER 33 #define SVC__GET_FAULT_ADDRESS 34 #define SVC__SET_LAST_ERROR 35 #define SVC__GET_LAST_ERROR 36 #define SVC__GET_LAST_FAULT 37 #define SVC__SET_INT_HANDLER 38 #define SVC__RESERVED39 39 #define SVC__RESERVED40 40 #define SVC__LOAD_CONFIG 41 #define SVC__SAVE_CONFIG 42 #define SVC__RESERVED43 43 #define SVC__RESERVED44 44 #define SVC__UNLOCK_FLASH 45 #define SVC__LOCK_FLASH 46 #define SVC__ERASE_FLASH 47 #define SVC__PROGRAM_FLASH 48 #define SVC__RESERVED49 49 #define SVC__RESERVED50 50 #define SVC__ACQUIRE_SPIN_LOCK 51 #define SVC__RELEASE_SPIN_LOCK 52 #define SVC__RESERVED53 53 #define SVC__RESET_SYSTEM 54 #define SVC__RESERVED55 55 #define SVC__SET_PROBE 56 #define SVC__RESET_PROBE 57 #define SVC__RESERVED58 58 #define SVC__MAXIMUM 59 #define ASM_VOLATILE __asm volatile #define CALL_SVC(ServiceIndex, ReturnValueVar) \ ASM_VOLATILE ( \ "MOV.W R0, %0;" \ "SVC #0;" \ "MOV.W %0, R1;" \ : "=r" (ReturnValueVar) \ : "r" (ServiceIndex) \ ) #define PUSH_SVC_PARAM(Param) \ ASM_VOLATILE ( \ "MOV.W R0, %0;" \ "PUSH {R0};" \ : \ : \ "r" (Param) \ ) #define POP_SVC_PARAM() ASM_VOLATILE ("POP {R0};") #define SAVE_SVC_REGS() ASM_VOLATILE ("PUSH {LR};") #define RESTORE_SVC_REGS() ASM_VOLATILE ("POP {LR};") #define CALL_SVC_WITH_ZERO_PARAM( \ ServiceIndex, \ ReturnValueVar \ ) \ SAVE_SVC_REGS(); \ CALL_SVC(ServiceIndex, ReturnValueVar); \ RESTORE_SVC_REGS() #define CALL_SVC_WITH_ONE_PARAM( \ ServiceIndex, \ ReturnValueVar, \ Param \ ) \ SAVE_SVC_REGS(); \ PUSH_SVC_PARAM(Param); \ CALL_SVC(ServiceIndex, ReturnValueVar); \ POP_SVC_PARAM(); \ RESTORE_SVC_REGS() #define CALL_SVC_WITH_TWO_PARAMS( \ ServiceIndex, \ ReturnValueVar, \ Param0, \ Param1 \ ) \ SAVE_SVC_REGS(); \ PUSH_SVC_PARAM(Param1); \ PUSH_SVC_PARAM(Param0); \ CALL_SVC(ServiceIndex, ReturnValueVar); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ RESTORE_SVC_REGS() #define CALL_SVC_WITH_THREE_PARAMS( \ ServiceIndex, \ ReturnValueVar, \ Param0, \ Param1, \ Param2 \ ) \ SAVE_SVC_REGS(); \ PUSH_SVC_PARAM(Param2); \ PUSH_SVC_PARAM(Param1); \ PUSH_SVC_PARAM(Param0); \ CALL_SVC(ServiceIndex, ReturnValueVar); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ RESTORE_SVC_REGS() #define CALL_SVC_WITH_FOUR_PARAMS( \ ServiceIndex, \ ReturnValueVar, \ Param0, \ Param1, \ Param2, \ Param3 \ ) \ SAVE_SVC_REGS(); \ PUSH_SVC_PARAM(Param3); \ PUSH_SVC_PARAM(Param2); \ PUSH_SVC_PARAM(Param1); \ PUSH_SVC_PARAM(Param0); \ CALL_SVC(ServiceIndex, ReturnValueVar); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ RESTORE_SVC_REGS() #define CALL_SVC_WITH_FIVE_PARAMS( \ ServiceIndex, \ ReturnValueVar, \ Param0, \ Param1, \ Param2, \ Param3, \ Param4 \ ) \ SAVE_SVC_REGS(); \ PUSH_SVC_PARAM(Param4); \ PUSH_SVC_PARAM(Param3); \ PUSH_SVC_PARAM(Param2); \ PUSH_SVC_PARAM(Param1); \ PUSH_SVC_PARAM(Param0); \ CALL_SVC(ServiceIndex, ReturnValueVar); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ RESTORE_SVC_REGS() #define CALL_SVC_WITH_SIX_PARAMS( \ ServiceIndex, \ ReturnValueVar, \ Param0, \ Param1, \ Param2, \ Param3, \ Param4, \ Param5 \ ) \ SAVE_SVC_REGS(); \ PUSH_SVC_PARAM(Param5); \ PUSH_SVC_PARAM(Param4); \ PUSH_SVC_PARAM(Param3); \ PUSH_SVC_PARAM(Param2); \ PUSH_SVC_PARAM(Param1); \ PUSH_SVC_PARAM(Param0); \ CALL_SVC(ServiceIndex, ReturnValueVar); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ RESTORE_SVC_REGS() #endif // End of SERVICE_DEF_H
/* * File : ServiceDef.h * Remark : Service number and call service definition used by NanoOS API * */ #ifndef SERVICE_DEF_H #define SERVICE_DEF_H #define SVC__ZERO 0 #define VAR_0 1 #define SVC__GET_OS_NAME 2 #define VAR_1 3 #define VAR_2 4 #define VAR_3 5 #define VAR_4 6 #define SVC__IS_USB_SER_READY 7 #define SVC__WRITE_USB_SER 8 #define SVC__READ_USB_SER 9 #define SVC__CANCEL_READ_USB_SER 10 #define SVC__RESERVED11 11 #define VAR_5 12 #define SVC__TERMINATE_THREAD 13 #define VAR_6 14 #define SVC__GET_THREAD_RETURN_VALUE 15 #define SVC__GET_THREAD_STATUS 16 #define SVC__GET_CURRENT_THREAD_ID 17 #define SVC__SLEEP 18 #define SVC__SUSPEND_THREAD 19 #define SVC__RESUME_THREAD 20 #define VAR_7 21 #define SVC__SWITCH_TO_NEXT_THREAD 22 #define SVC__RESERVED23 23 #define SVC__RESERVED24 24 #define SVC__RESERVED25 25 #define SVC__RESERVED26 26 #define VAR_8 27 #define SVC__SET_EVENT 28 #define SVC__RESET_EVENT 29 #define SVC__CLOSE_EVENT 30 #define SVC__RESERVED31 31 #define SVC__RESERVED32 32 #define SVC__SET_TERMINATION_HANDLER 33 #define SVC__GET_FAULT_ADDRESS 34 #define VAR_9 35 #define SVC__GET_LAST_ERROR 36 #define SVC__GET_LAST_FAULT 37 #define VAR_10 38 #define VAR_11 39 #define SVC__RESERVED40 40 #define VAR_12 41 #define SVC__SAVE_CONFIG 42 #define VAR_13 43 #define SVC__RESERVED44 44 #define SVC__UNLOCK_FLASH 45 #define VAR_14 46 #define VAR_15 47 #define SVC__PROGRAM_FLASH 48 #define VAR_16 49 #define SVC__RESERVED50 50 #define VAR_17 51 #define VAR_18 52 #define VAR_19 53 #define VAR_20 54 #define SVC__RESERVED55 55 #define SVC__SET_PROBE 56 #define VAR_21 57 #define VAR_22 58 #define SVC__MAXIMUM 59 #define ASM_VOLATILE __asm volatile #define CALL_SVC(VAR_23, ReturnValueVar) \ ASM_VOLATILE ( \ "MOV.W R0, %0;" \ "SVC #0;" \ "MOV.W %0, R1;" \ : "=r" (ReturnValueVar) \ : "r" (ServiceIndex) \ ) #define PUSH_SVC_PARAM(VAR_24) \ ASM_VOLATILE ( \ "MOV.W R0, %0;" \ "PUSH {R0};" \ : \ : \ "r" (Param) \ ) #define FUNC_0() ASM_VOLATILE ("POP {R0};") #define SAVE_SVC_REGS() ASM_VOLATILE ("PUSH {LR};") #define FUNC_1() ASM_VOLATILE ("POP {LR};") #define CALL_SVC_WITH_ZERO_PARAM( \ VAR_23, \ ReturnValueVar \ ) \ SAVE_SVC_REGS(); \ CALL_SVC(ServiceIndex, ReturnValueVar); \ RESTORE_SVC_REGS() #define CALL_SVC_WITH_ONE_PARAM( \ VAR_23, \ ReturnValueVar, \ VAR_24 \ ) \ SAVE_SVC_REGS(); \ PUSH_SVC_PARAM(Param); \ CALL_SVC(ServiceIndex, ReturnValueVar); \ POP_SVC_PARAM(); \ RESTORE_SVC_REGS() #define CALL_SVC_WITH_TWO_PARAMS( \ VAR_23, \ ReturnValueVar, \ Param0, \ VAR_25 \ ) \ SAVE_SVC_REGS(); \ PUSH_SVC_PARAM(Param1); \ PUSH_SVC_PARAM(Param0); \ CALL_SVC(ServiceIndex, ReturnValueVar); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ RESTORE_SVC_REGS() #define CALL_SVC_WITH_THREE_PARAMS( \ VAR_23, \ ReturnValueVar, \ Param0, \ VAR_25, \ Param2 \ ) \ SAVE_SVC_REGS(); \ PUSH_SVC_PARAM(Param2); \ PUSH_SVC_PARAM(Param1); \ PUSH_SVC_PARAM(Param0); \ CALL_SVC(ServiceIndex, ReturnValueVar); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ RESTORE_SVC_REGS() #define CALL_SVC_WITH_FOUR_PARAMS( \ VAR_23, \ ReturnValueVar, \ Param0, \ VAR_25, \ Param2, \ Param3 \ ) \ SAVE_SVC_REGS(); \ PUSH_SVC_PARAM(Param3); \ PUSH_SVC_PARAM(Param2); \ PUSH_SVC_PARAM(Param1); \ PUSH_SVC_PARAM(Param0); \ CALL_SVC(ServiceIndex, ReturnValueVar); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ RESTORE_SVC_REGS() #define CALL_SVC_WITH_FIVE_PARAMS( \ VAR_23, \ ReturnValueVar, \ Param0, \ VAR_25, \ Param2, \ Param3, \ Param4 \ ) \ SAVE_SVC_REGS(); \ PUSH_SVC_PARAM(Param4); \ PUSH_SVC_PARAM(Param3); \ PUSH_SVC_PARAM(Param2); \ PUSH_SVC_PARAM(Param1); \ PUSH_SVC_PARAM(Param0); \ CALL_SVC(ServiceIndex, ReturnValueVar); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ RESTORE_SVC_REGS() #define FUNC_2( \ VAR_23, \ ReturnValueVar, \ Param0, \ VAR_25, \ Param2, \ Param3, \ Param4, \ VAR_26 \ ) \ SAVE_SVC_REGS(); \ PUSH_SVC_PARAM(Param5); \ PUSH_SVC_PARAM(Param4); \ PUSH_SVC_PARAM(Param3); \ PUSH_SVC_PARAM(Param2); \ PUSH_SVC_PARAM(Param1); \ PUSH_SVC_PARAM(Param0); \ CALL_SVC(ServiceIndex, ReturnValueVar); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ POP_SVC_PARAM(); \ RESTORE_SVC_REGS() #endif // End of SERVICE_DEF_H
0.306744
{'VAR_0': 'SVC__GET_OS_VERSION', 'VAR_1': 'SVC__GET_SYSTEM_CLOCK', 'VAR_2': 'SVC__RESERVED4', 'VAR_3': 'SVC__DEBUG_CHAR_OUT', 'VAR_4': 'SVC__RESERVED6', 'VAR_5': 'SVC__CREATE_THREAD', 'VAR_6': 'SVC__EXIT_THREAD', 'VAR_7': 'SVC__WAIT_FOR_OBJECT', 'VAR_8': 'SVC__CREATE_EVENT', 'VAR_9': 'SVC__SET_LAST_ERROR', 'VAR_10': 'SVC__SET_INT_HANDLER', 'VAR_11': 'SVC__RESERVED39', 'VAR_12': 'SVC__LOAD_CONFIG', 'VAR_13': 'SVC__RESERVED43', 'VAR_14': 'SVC__LOCK_FLASH', 'VAR_15': 'SVC__ERASE_FLASH', 'VAR_16': 'SVC__RESERVED49', 'VAR_17': 'SVC__ACQUIRE_SPIN_LOCK', 'VAR_18': 'SVC__RELEASE_SPIN_LOCK', 'VAR_19': 'SVC__RESERVED53', 'VAR_20': 'SVC__RESET_SYSTEM', 'VAR_21': 'SVC__RESET_PROBE', 'VAR_22': 'SVC__RESERVED58', 'VAR_23': 'ServiceIndex', 'VAR_24': 'Param', 'FUNC_0': 'POP_SVC_PARAM', 'FUNC_1': 'RESTORE_SVC_REGS', 'VAR_25': 'Param1', 'FUNC_2': 'CALL_SVC_WITH_SIX_PARAMS', 'VAR_26': 'Param5'}
////////////////////////////////////////////////////////////////////////// // // // wapi.h - prototypes WinAPI functions // // Created by: // // @nummer aka @nummerok // // 05.02.2016 // // // // modified: 05.02.2016 // // // // undocumented WinAPI functions // // // // https://github.com/Nummer/wapi // // // ////////////////////////////////////////////////////////////////////////// #pragma once #undef WAPI_FULL_LOG #include <Windows.h> typedef LONG NTSTATUS; #if ((defined(_DEBUG) || defined(DEBUG)) && !defined(WAPI_NO_LOG)) #define WAPI_FULL_LOG #include <stdio.h> #endif namespace _wapi_api { HMODULE GetNTDLLHmodule(); } namespace _wapi_ntdll { //---------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------- typedef enum _NT_PRODUCT_TYPE { NtProductWinNt = 1, NtProductLanManNt = 2, NtProductServer = 3 } NT_PRODUCT_TYPE; typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE { StandardDesign = 0, NEC98x86 = 1, EndAlternatives = 2 } ALTERNATIVE_ARCHITECTURE_TYPE; typedef struct _KSYSTEM_TIME { ULONG LowPart; LONG High1Time; LONG High2Time; } KSYSTEM_TIME, *PKSYSTEM_TIME; typedef struct _KUSER_SHARED_DATA { ULONG TickCountLowDeprecated; ULONG TickCountMultiplier; KSYSTEM_TIME InterruptTime; KSYSTEM_TIME SystemTime; KSYSTEM_TIME TimeZoneBias; WORD ImageNumberLow; WORD ImageNumberHigh; WCHAR NtSystemRoot[260]; ULONG MaxStackTraceDepth; ULONG CryptoExponent; ULONG TimeZoneId; ULONG LargePageMinimum; ULONG Reserved2[7]; NT_PRODUCT_TYPE NtProductType; UCHAR ProductTypeIsValid; ULONG NtMajorVersion; ULONG NtMinorVersion; UCHAR ProcessorFeatures[64]; ULONG Reserved1; ULONG Reserved3; ULONG TimeSlip; ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture; LARGE_INTEGER SystemExpirationDate; ULONG SuiteMask; UCHAR KdDebuggerEnabled; UCHAR NXSupportPolicy; ULONG ActiveConsoleId; ULONG DismountCount; ULONG ComPlusPackage; ULONG LastSystemRITEventTickCount; ULONG NumberOfPhysicalPages; UCHAR SafeBootMode; ULONG SharedDataFlags; ULONG DbgErrorPortPresent : 1; ULONG DbgElevationEnabled : 1; ULONG DbgVirtEnabled : 1; ULONG DbgInstallerDetectEnabled : 1; ULONG SystemDllRelocated : 1; ULONG SpareBits : 27; UINT64 TestRetInstruction; ULONG SystemCall; ULONG SystemCallReturn; UINT64 SystemCallPad[3]; union { KSYSTEM_TIME TickCount; UINT64 TickCountQuad; }; ULONG Cookie; INT64 ConsoleSessionForegroundProcessId; ULONG Wow64SharedInformation[16]; WORD UserModeGlobalLogger[8]; ULONG HeapTracingPid[2]; ULONG CritSecTracingPid[2]; ULONG ImageFileExecutionOptions; union { UINT64 AffinityPad; ULONG ActiveProcessorAffinity; }; UINT64 InterruptTimeBias; } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA; //---------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////// // APC //---------------------------- // KiUserApcDispatcher NTSYSAPI VOID NTAPI KiUserApcDispatcher( IN PVOID Unused1, IN PVOID Unused2, IN PVOID Unused3, IN PVOID ContextStart, IN PVOID ContextBody); //---------------------------- // NtAlertThread NTSYSAPI NTSTATUS NTAPI NtAlertThread( IN HANDLE ThreadHandle); //---------------------------- // NtCallbackReturn NTSYSAPI NTSTATUS NTAPI NtCallbackReturn( IN PVOID Result OPTIONAL, IN ULONG ResultLength, IN NTSTATUS Status); //////////////////////////////////////////////////////////////////// // HASH //---------------------------- // RtlComputeCrc32 NTSYSAPI INT NTAPI RtlComputeCrc32( IN INT accumCRC32, IN const BYTE* buffer, IN UINT buflen); //////////////////////////////////////////////////////////////////// // TIME //---------------------------- // NtGetTickCount NTSYSAPI ULONG NTAPI NtGetTickCount(); //---------------------------- // NtSetTimerResolution NTSYSAPI NTSTATUS NTAPI NtSetTimerResolution( IN ULONG DesiredResolution, IN BOOLEAN SetResolution, OUT PULONG CurrentResolution); //---------------------------- // NtQueryTimerResolution NTSYSAPI NTSTATUS NTAPI NtQueryTimerResolution( OUT PULONG MinimumResolution, OUT PULONG MaximumResolution, OUT PULONG CurrentResolution); }
////////////////////////////////////////////////////////////////////////// // // // wapi.h - prototypes WinAPI functions // // Created by: // // @nummer aka @nummerok // // 05.02.2016 // // // // modified: 05.02.2016 // // // // undocumented WinAPI functions // // // // https://github.com/Nummer/wapi // // // ////////////////////////////////////////////////////////////////////////// #pragma once #undef WAPI_FULL_LOG #include <IMPORT_0> typedef CLASS_0 ID_0; #if ((defined(_DEBUG) || defined(VAR_1)) && !defined(VAR_2)) #define VAR_3 #include <IMPORT_1> #endif CLASS_1 _wapi_api { CLASS_2 FUNC_0(); } CLASS_1 _wapi_ntdll { //---------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------- typedef enum CLASS_3 { VAR_4 = 1, NtProductLanManNt = 2, VAR_5 = 3 } NT_PRODUCT_TYPE; typedef enum CLASS_4 { StandardDesign = 0, VAR_6 = 1, VAR_7 = 2 } ID_1; typedef struct CLASS_6 { CLASS_7 VAR_9; CLASS_0 VAR_10; CLASS_0 VAR_11; } ID_2, *CLASS_9; typedef struct CLASS_10 { CLASS_7 VAR_12; CLASS_7 VAR_13; CLASS_8 VAR_14; CLASS_8 SystemTime; CLASS_8 VAR_15; WORD ImageNumberLow; WORD VAR_16; CLASS_11 VAR_17[260]; CLASS_7 MaxStackTraceDepth; CLASS_7 CryptoExponent; CLASS_7 VAR_18; CLASS_7 VAR_19; CLASS_7 VAR_20[7]; NT_PRODUCT_TYPE VAR_21; CLASS_12 VAR_22; CLASS_7 NtMajorVersion; CLASS_7 NtMinorVersion; CLASS_12 ProcessorFeatures[64]; CLASS_7 Reserved1; CLASS_7 Reserved3; CLASS_7 VAR_23; CLASS_5 VAR_24; CLASS_13 VAR_25; CLASS_7 SuiteMask; CLASS_12 VAR_26; CLASS_12 VAR_27; CLASS_7 VAR_28; CLASS_7 VAR_29; CLASS_7 VAR_30; CLASS_7 LastSystemRITEventTickCount; CLASS_7 VAR_31; CLASS_12 VAR_32; CLASS_7 VAR_33; CLASS_7 VAR_34 : 1; CLASS_7 VAR_35 : 1; CLASS_7 DbgVirtEnabled : 1; CLASS_7 VAR_36 : 1; CLASS_7 VAR_37 : 1; CLASS_7 VAR_38 : 27; CLASS_14 VAR_39; CLASS_7 VAR_40; CLASS_7 VAR_41; CLASS_14 VAR_42[3]; union { CLASS_8 VAR_43; CLASS_14 VAR_44; }; CLASS_7 VAR_45; CLASS_15 VAR_46; CLASS_7 Wow64SharedInformation[16]; WORD VAR_47[8]; CLASS_7 VAR_48[2]; CLASS_7 CritSecTracingPid[2]; CLASS_7 VAR_49; union { CLASS_14 VAR_50; CLASS_7 ActiveProcessorAffinity; }; CLASS_14 VAR_51; } ID_3, *CLASS_16; //---------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////// // APC //---------------------------- // KiUserApcDispatcher CLASS_17 VAR_52 CLASS_18 KiUserApcDispatcher( IN VAR_53 VAR_54, IN VAR_53 Unused2, IN VAR_53 VAR_55, IN VAR_53 ContextStart, IN VAR_53 ContextBody); //---------------------------- // NtAlertThread CLASS_17 VAR_0 CLASS_18 FUNC_1( IN VAR_56 VAR_57); //---------------------------- // NtCallbackReturn CLASS_17 VAR_0 CLASS_18 FUNC_2( IN VAR_53 Result VAR_58, IN VAR_8 VAR_59, IN VAR_0 VAR_60); //////////////////////////////////////////////////////////////////// // HASH //---------------------------- // RtlComputeCrc32 CLASS_17 VAR_61 CLASS_18 FUNC_3( IN VAR_61 VAR_62, IN const BYTE* VAR_63, IN VAR_64 VAR_65); //////////////////////////////////////////////////////////////////// // TIME //---------------------------- // NtGetTickCount CLASS_17 VAR_8 CLASS_18 FUNC_4(); //---------------------------- // NtSetTimerResolution CLASS_17 VAR_0 CLASS_18 FUNC_5( IN VAR_8 VAR_66, IN VAR_67 VAR_68, CLASS_19 VAR_69 CurrentResolution); //---------------------------- // NtQueryTimerResolution CLASS_17 VAR_0 CLASS_18 FUNC_6( CLASS_19 VAR_69 MinimumResolution, CLASS_19 VAR_69 VAR_70, CLASS_19 VAR_69 CurrentResolution); }
0.814402
{'IMPORT_0': 'Windows.h', 'CLASS_0': 'LONG', 'ID_0': 'NTSTATUS', 'VAR_0': 'NTSTATUS', 'VAR_1': 'DEBUG', 'VAR_2': 'WAPI_NO_LOG', 'VAR_3': 'WAPI_FULL_LOG', 'IMPORT_1': 'stdio.h', 'CLASS_1': 'namespace', 'CLASS_2': 'HMODULE', 'FUNC_0': 'GetNTDLLHmodule', 'CLASS_3': '_NT_PRODUCT_TYPE', 'VAR_4': 'NtProductWinNt', 'VAR_5': 'NtProductServer', 'CLASS_4': '_ALTERNATIVE_ARCHITECTURE_TYPE', 'VAR_6': 'NEC98x86', 'VAR_7': 'EndAlternatives', 'ID_1': 'ALTERNATIVE_ARCHITECTURE_TYPE', 'CLASS_5': 'ALTERNATIVE_ARCHITECTURE_TYPE', 'CLASS_6': '_KSYSTEM_TIME', 'CLASS_7': 'ULONG', 'VAR_8': 'ULONG', 'VAR_9': 'LowPart', 'VAR_10': 'High1Time', 'VAR_11': 'High2Time', 'ID_2': 'KSYSTEM_TIME', 'CLASS_8': 'KSYSTEM_TIME', 'CLASS_9': 'PKSYSTEM_TIME', 'CLASS_10': '_KUSER_SHARED_DATA', 'VAR_12': 'TickCountLowDeprecated', 'VAR_13': 'TickCountMultiplier', 'VAR_14': 'InterruptTime', 'VAR_15': 'TimeZoneBias', 'VAR_16': 'ImageNumberHigh', 'CLASS_11': 'WCHAR', 'VAR_17': 'NtSystemRoot', 'VAR_18': 'TimeZoneId', 'VAR_19': 'LargePageMinimum', 'VAR_20': 'Reserved2', 'VAR_21': 'NtProductType', 'CLASS_12': 'UCHAR', 'VAR_22': 'ProductTypeIsValid', 'VAR_23': 'TimeSlip', 'VAR_24': 'AlternativeArchitecture', 'CLASS_13': 'LARGE_INTEGER', 'VAR_25': 'SystemExpirationDate', 'VAR_26': 'KdDebuggerEnabled', 'VAR_27': 'NXSupportPolicy', 'VAR_28': 'ActiveConsoleId', 'VAR_29': 'DismountCount', 'VAR_30': 'ComPlusPackage', 'VAR_31': 'NumberOfPhysicalPages', 'VAR_32': 'SafeBootMode', 'VAR_33': 'SharedDataFlags', 'VAR_34': 'DbgErrorPortPresent', 'VAR_35': 'DbgElevationEnabled', 'VAR_36': 'DbgInstallerDetectEnabled', 'VAR_37': 'SystemDllRelocated', 'VAR_38': 'SpareBits', 'CLASS_14': 'UINT64', 'VAR_39': 'TestRetInstruction', 'VAR_40': 'SystemCall', 'VAR_41': 'SystemCallReturn', 'VAR_42': 'SystemCallPad', 'VAR_43': 'TickCount', 'VAR_44': 'TickCountQuad', 'VAR_45': 'Cookie', 'CLASS_15': 'INT64', 'VAR_46': 'ConsoleSessionForegroundProcessId', 'VAR_47': 'UserModeGlobalLogger', 'VAR_48': 'HeapTracingPid', 'VAR_49': 'ImageFileExecutionOptions', 'VAR_50': 'AffinityPad', 'VAR_51': 'InterruptTimeBias', 'ID_3': 'KUSER_SHARED_DATA', 'CLASS_16': 'PKUSER_SHARED_DATA', 'CLASS_17': 'NTSYSAPI', 'VAR_52': 'VOID', 'CLASS_18': 'NTAPI', 'VAR_53': 'PVOID', 'VAR_54': 'Unused1', 'VAR_55': 'Unused3', 'FUNC_1': 'NtAlertThread', 'VAR_56': 'HANDLE', 'VAR_57': 'ThreadHandle', 'FUNC_2': 'NtCallbackReturn', 'VAR_58': 'OPTIONAL', 'VAR_59': 'ResultLength', 'VAR_60': 'Status', 'VAR_61': 'INT', 'FUNC_3': 'RtlComputeCrc32', 'VAR_62': 'accumCRC32', 'VAR_63': 'buffer', 'VAR_64': 'UINT', 'VAR_65': 'buflen', 'FUNC_4': 'NtGetTickCount', 'FUNC_5': 'NtSetTimerResolution', 'VAR_66': 'DesiredResolution', 'VAR_67': 'BOOLEAN', 'VAR_68': 'SetResolution', 'CLASS_19': 'OUT', 'VAR_69': 'PULONG', 'FUNC_6': 'NtQueryTimerResolution', 'VAR_70': 'MaximumResolution'}
#ifndef CALCULADORA_H #define CALCULADORA_H #include <iostream> using namespace std; template <typename Data> class Calculadora { public: Calculadora(){}; ~Calculadora(){}; Data add(Data &d1, const Data &d2){return d1+d2;} Data sub(Data &d1, const Data &d2){return d1-d2; } Data mul(Data &d1, const Data &d2){return d1*d2;} Data div(Data &d1, const Data &d2){return d1/d2;} void print(Data &d1){ cout << "el resultado es: " << d1 <<endl; } }; #endif
#ifndef VAR_0 #define VAR_0 #include <iostream> CLASS_0 namespace std; VAR_1 <VAR_2 Data> class VAR_3 { public: FUNC_0(){}; ~FUNC_0(){}; Data add(Data &VAR_4, const Data &d2){return VAR_4+d2;} Data sub(Data &VAR_4, const Data &d2){return VAR_4-d2; } Data FUNC_1(Data &VAR_4, const Data &d2){return VAR_4*d2;} Data FUNC_2(Data &VAR_4, const Data &d2){return VAR_4/d2;} void print(Data &VAR_4){ cout << "el resultado es: " << VAR_4 <<endl; } }; #endif
0.420039
{'VAR_0': 'CALCULADORA_H', 'CLASS_0': 'using', 'VAR_1': 'template', 'VAR_2': 'typename', 'VAR_3': 'Calculadora', 'FUNC_0': 'Calculadora', 'VAR_4': 'd1', 'FUNC_1': 'mul', 'FUNC_2': 'div'}
#pragma once #include <Config/Config.h> #include <Wallet/WalletManager.h> #include <Net/Clients/RPC/RPC.h> #include <Net/Servers/RPC/RPCMethod.h> #include <Net/Tor/TorManager.h> #include <Net/Tor/TorAddressParser.h> #include <Common/Util/FileUtil.h> #include <optional> class ReceiveHandler : public RPCMethod { public: ReceiveHandler(const IWalletManagerPtr& pWalletManager) : m_pWalletManager(pWalletManager) { } virtual ~ReceiveHandler() = default; RPC::Response Handle(const RPC::Request& request) const final { if (!request.GetParams().has_value()) { throw DESERIALIZATION_EXCEPTION(); } ReceiveCriteria criteria = ReceiveCriteria::FromJSON(request.GetParams().value()); if (criteria.GetFile().has_value()) { return ReceiveViaFile(request, criteria, criteria.GetFile().value()); } else { Slate slate = m_pWalletManager->Receive(criteria); Json::Value result; result["status"] = "RECEIVED"; result["slate"] = slate.ToJSON(); return request.BuildResult(result); } } private: RPC::Response ReceiveViaFile( const RPC::Request& request, const ReceiveCriteria& criteria, const std::string& file) const { // FUTURE: Check write permissions before creating slate Slate slate = m_pWalletManager->Receive(criteria); Json::Value slateJSON = slate.ToJSON(); try { FileUtil::WriteTextToFile(FileUtil::ToPath(file), JsonUtil::WriteCondensed(slateJSON)); WALLET_INFO_F("Slate file saved to: {}", file); Json::Value result; result["status"] = "RECEIVED"; result["slate"] = slateJSON; return RPC::Response::BuildResult(request.GetId(), result); } catch (std::exception&) { WALLET_ERROR_F("Slate failed to save to: {}", file); Json::Value errorJson; errorJson["status"] = "WRITE_FAILED"; errorJson["slate"] = slateJSON; return request.BuildError(RPC::ErrorCode::INTERNAL_ERROR, "Failed to write file.", errorJson); } } IWalletManagerPtr m_pWalletManager; };
#pragma once #include <IMPORT_0> #include <IMPORT_1> #include <IMPORT_2> #include <IMPORT_3> #include <IMPORT_4> #include <IMPORT_5> #include <IMPORT_6> #include <optional> CLASS_0 VAR_0 : public VAR_1 { public: FUNC_0(VAR_2 VAR_3& VAR_4) : FUNC_1(VAR_4) { } CLASS_2 ~FUNC_0() = VAR_6; RPC::VAR_8 FUNC_2(VAR_2 VAR_7::VAR_9& VAR_10) VAR_2 VAR_11 { if (!VAR_10.FUNC_3().has_value()) { CLASS_3 FUNC_4(); } ReceiveCriteria VAR_12 = ReceiveCriteria::FUNC_5(VAR_10.FUNC_3().FUNC_6()); if (VAR_12.FUNC_7().has_value()) { return FUNC_8(VAR_10, VAR_12, VAR_12.FUNC_7().FUNC_6()); } else { CLASS_4 VAR_13 = VAR_5->Receive(VAR_12); Json::VAR_14 result; result["status"] = "RECEIVED"; result["slate"] = VAR_13.FUNC_9(); return VAR_10.FUNC_10(result); } } private: RPC::VAR_8 FUNC_8( VAR_2 VAR_7::VAR_9& VAR_10, VAR_2 ReceiveCriteria& VAR_12, VAR_2 VAR_15::VAR_16& VAR_17) VAR_2 { // FUTURE: Check write permissions before creating slate CLASS_4 VAR_13 = VAR_5->Receive(VAR_12); Json::VAR_14 slateJSON = VAR_13.FUNC_9(); CLASS_5 { FileUtil::WriteTextToFile(VAR_18::FUNC_11(VAR_17), VAR_19::WriteCondensed(slateJSON)); FUNC_12("Slate file saved to: {}", VAR_17); Json::VAR_14 result; result["status"] = "RECEIVED"; result["slate"] = slateJSON; return VAR_7::VAR_8::FUNC_10(VAR_10.GetId(), result); } catch (ID_0::VAR_20&) { FUNC_13("Slate failed to save to: {}", VAR_17); Json::VAR_14 VAR_21; VAR_21["status"] = "WRITE_FAILED"; VAR_21["slate"] = slateJSON; return VAR_10.FUNC_14(VAR_7::ErrorCode::VAR_22, "Failed to write file.", VAR_21); } } CLASS_1 VAR_5; };
0.832884
{'IMPORT_0': 'Config/Config.h', 'IMPORT_1': 'Wallet/WalletManager.h', 'IMPORT_2': 'Net/Clients/RPC/RPC.h', 'IMPORT_3': 'Net/Servers/RPC/RPCMethod.h', 'IMPORT_4': 'Net/Tor/TorManager.h', 'IMPORT_5': 'Net/Tor/TorAddressParser.h', 'IMPORT_6': 'Common/Util/FileUtil.h', 'CLASS_0': 'class', 'VAR_0': 'ReceiveHandler', 'FUNC_0': 'ReceiveHandler', 'VAR_1': 'RPCMethod', 'VAR_2': 'const', 'VAR_3': 'IWalletManagerPtr', 'CLASS_1': 'IWalletManagerPtr', 'VAR_4': 'pWalletManager', 'FUNC_1': 'm_pWalletManager', 'VAR_5': 'm_pWalletManager', 'CLASS_2': 'virtual', 'VAR_6': 'default', 'VAR_7': 'RPC', 'VAR_8': 'Response', 'FUNC_2': 'Handle', 'VAR_9': 'Request', 'VAR_10': 'request', 'VAR_11': 'final', 'FUNC_3': 'GetParams', 'CLASS_3': 'throw', 'FUNC_4': 'DESERIALIZATION_EXCEPTION', 'VAR_12': 'criteria', 'FUNC_5': 'FromJSON', 'FUNC_6': 'value', 'FUNC_7': 'GetFile', 'FUNC_8': 'ReceiveViaFile', 'CLASS_4': 'Slate', 'VAR_13': 'slate', 'VAR_14': 'Value', 'FUNC_9': 'ToJSON', 'FUNC_10': 'BuildResult', 'VAR_15': 'std', 'ID_0': 'std', 'VAR_16': 'string', 'VAR_17': 'file', 'CLASS_5': 'try', 'VAR_18': 'FileUtil', 'FUNC_11': 'ToPath', 'VAR_19': 'JsonUtil', 'FUNC_12': 'WALLET_INFO_F', 'VAR_20': 'exception', 'FUNC_13': 'WALLET_ERROR_F', 'VAR_21': 'errorJson', 'FUNC_14': 'BuildError', 'VAR_22': 'INTERNAL_ERROR'}
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. #define SIG_REGS(ctxt) (((UcontextT*)(ctxt))->uc_mcontext) #define SIG_R0(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R0]) #define SIG_R1(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R1]) #define SIG_R2(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R2]) #define SIG_R3(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R3]) #define SIG_R4(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R4]) #define SIG_R5(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R5]) #define SIG_R6(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R6]) #define SIG_R7(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R7]) #define SIG_R8(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R8]) #define SIG_R9(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R9]) #define SIG_R10(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R10]) #define SIG_FP(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R11]) #define SIG_IP(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R12]) #define SIG_SP(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R13]) #define SIG_LR(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R14]) #define SIG_PC(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_R15]) #define SIG_CPSR(info, ctxt) (SIG_REGS(ctxt).__gregs[REG_CPSR]) #define SIG_FAULT(info, ctxt) (*(uintptr*)&(info)->_reason[0]) #define SIG_TRAP(info, ctxt) (0) #define SIG_ERROR(info, ctxt) (0) #define SIG_OLDMASK(info, ctxt) (0) #define SIG_CODE0(info, ctxt) ((info)->_code) #define SIG_CODE1(info, ctxt) (*(uintptr*)&(info)->_reason[0])
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. #define FUNC_0(VAR_0) (((UcontextT*)(ctxt))->uc_mcontext) #define FUNC_1(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R0]) #define FUNC_2(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R1]) #define FUNC_3(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R2]) #define FUNC_4(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R3]) #define FUNC_5(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R4]) #define SIG_R5(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R5]) #define SIG_R6(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R6]) #define FUNC_6(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R7]) #define FUNC_7(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R8]) #define FUNC_8(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R9]) #define FUNC_9(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R10]) #define FUNC_10(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R11]) #define FUNC_11(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R12]) #define FUNC_12(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R13]) #define SIG_LR(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R14]) #define FUNC_13(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_R15]) #define FUNC_14(VAR_1, VAR_0) (SIG_REGS(ctxt).__gregs[REG_CPSR]) #define FUNC_15(VAR_1, VAR_0) (*(uintptr*)&(info)->_reason[0]) #define FUNC_16(VAR_1, VAR_0) (0) #define FUNC_17(VAR_1, VAR_0) (0) #define FUNC_18(VAR_1, VAR_0) (0) #define FUNC_19(VAR_1, VAR_0) ((info)->_code) #define FUNC_20(VAR_1, VAR_0) (*(uintptr*)&(info)->_reason[0])
0.831445
{'FUNC_0': 'SIG_REGS', 'VAR_0': 'ctxt', 'FUNC_1': 'SIG_R0', 'VAR_1': 'info', 'FUNC_2': 'SIG_R1', 'FUNC_3': 'SIG_R2', 'FUNC_4': 'SIG_R3', 'FUNC_5': 'SIG_R4', 'FUNC_6': 'SIG_R7', 'FUNC_7': 'SIG_R8', 'FUNC_8': 'SIG_R9', 'FUNC_9': 'SIG_R10', 'FUNC_10': 'SIG_FP', 'FUNC_11': 'SIG_IP', 'FUNC_12': 'SIG_SP', 'FUNC_13': 'SIG_PC', 'FUNC_14': 'SIG_CPSR', 'FUNC_15': 'SIG_FAULT', 'FUNC_16': 'SIG_TRAP', 'FUNC_17': 'SIG_ERROR', 'FUNC_18': 'SIG_OLDMASK', 'FUNC_19': 'SIG_CODE0', 'FUNC_20': 'SIG_CODE1'}
/************************************************************************/ /* * StatsListProc: Subclassed window procedure for list box. */ long CALLBACK StatsListProc(HWND hwnd, UINT message, UINT wParam, LONG lParam) { switch (message) { case WM_KEYDOWN: if (HANDLE_WM_KEYDOWN_BLAK(hwnd, wParam, lParam, StatListKey) == True) return 0; break; HANDLE_MSG(hwnd, WM_VSCROLL, StatsListVScroll); case WM_ERASEBKGND: return 1; case WM_LBUTTONDOWN: HANDLE_WM_LBUTTONDOWN(hwnd, wParam, lParam, StatsListLButton); return 1; case WM_LBUTTONDBLCLK: HANDLE_WM_LBUTTONDBLCLK( hwnd, wParam, lParam, StatsListLButtonDblClk ); return 1; case WM_RBUTTONDOWN: HANDLE_WM_RBUTTONDOWN(hwnd, wParam, lParam, StatsListRButton); return 0; case WM_SETFOCUS: case WM_KILLFOCUS: StatsDrawBorder(); break; } return CallWindowProc(lpfnDefStatListProc, hwnd, message, wParam, lParam); }
/************************************************************************/ /* * StatsListProc: Subclassed window procedure for list box. */ long CALLBACK StatsListProc(HWND hwnd, UINT message, UINT wParam, LONG lParam) { switch (message) { case VAR_0: if (HANDLE_WM_KEYDOWN_BLAK(hwnd, wParam, lParam, StatListKey) == True) return 0; break; FUNC_0(hwnd, WM_VSCROLL, VAR_1); case WM_ERASEBKGND: return 1; case WM_LBUTTONDOWN: HANDLE_WM_LBUTTONDOWN(hwnd, wParam, lParam, VAR_2); return 1; case WM_LBUTTONDBLCLK: HANDLE_WM_LBUTTONDBLCLK( hwnd, wParam, lParam, StatsListLButtonDblClk ); return 1; case VAR_3: HANDLE_WM_RBUTTONDOWN(hwnd, wParam, lParam, StatsListRButton); return 0; case WM_SETFOCUS: case VAR_4: StatsDrawBorder(); break; } return CallWindowProc(VAR_5, hwnd, message, wParam, lParam); }
0.326649
{'VAR_0': 'WM_KEYDOWN', 'FUNC_0': 'HANDLE_MSG', 'VAR_1': 'StatsListVScroll', 'VAR_2': 'StatsListLButton', 'VAR_3': 'WM_RBUTTONDOWN', 'VAR_4': 'WM_KILLFOCUS', 'VAR_5': 'lpfnDefStatListProc'}
/* Copyright (c) 2018 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only 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. */ #undef TRACE_SYSTEM #define TRACE_SYSTEM ion #if !defined(_TRACE_ION_H) || defined(TRACE_HEADER_MULTI_READ) #define _TRACE_ION_H #include <linux/types.h> #include <linux/tracepoint.h> #define DEV_NAME_NONE "None" DECLARE_EVENT_CLASS(ion_dma_map_cmo_class, TP_PROTO(const struct device *dev, const char *name, bool cached, bool hlos_accessible, unsigned long map_attrs, enum dma_data_direction dir), TP_ARGS(dev, name, cached, hlos_accessible, map_attrs, dir), TP_STRUCT__entry( __string(dev_name, dev ? dev_name(dev) : DEV_NAME_NONE) __string(name, name) __field(bool, cached) __field(bool, hlos_accessible) __field(unsigned long, map_attrs) __field(enum dma_data_direction, dir) ), TP_fast_assign( __assign_str(dev_name, dev ? dev_name(dev) : DEV_NAME_NONE); __assign_str(name, name); __entry->cached = cached; __entry->hlos_accessible = hlos_accessible; __entry->map_attrs = map_attrs; __entry->dir = dir; ), TP_printk("dev=%s name=%s cached=%d access=%d map_attrs=0x%lx dir=%d", __get_str(dev_name), __get_str(name), __entry->cached, __entry->hlos_accessible, __entry->map_attrs, __entry->dir) ); DEFINE_EVENT(ion_dma_map_cmo_class, ion_dma_map_cmo_apply, TP_PROTO(const struct device *dev, const char *name, bool cached, bool hlos_accessible, unsigned long map_attrs, enum dma_data_direction dir), TP_ARGS(dev, name, cached, hlos_accessible, map_attrs, dir) ); DEFINE_EVENT(ion_dma_map_cmo_class, ion_dma_map_cmo_skip, TP_PROTO(const struct device *dev, const char *name, bool cached, bool hlos_accessible, unsigned long map_attrs, enum dma_data_direction dir), TP_ARGS(dev, name, cached, hlos_accessible, map_attrs, dir) ); DEFINE_EVENT(ion_dma_map_cmo_class, ion_dma_unmap_cmo_apply, TP_PROTO(const struct device *dev, const char *name, bool cached, bool hlos_accessible, unsigned long map_attrs, enum dma_data_direction dir), TP_ARGS(dev, name, cached, hlos_accessible, map_attrs, dir) ); DEFINE_EVENT(ion_dma_map_cmo_class, ion_dma_unmap_cmo_skip, TP_PROTO(const struct device *dev, const char *name, bool cached, bool hlos_accessible, unsigned long map_attrs, enum dma_data_direction dir), TP_ARGS(dev, name, cached, hlos_accessible, map_attrs, dir) ); DECLARE_EVENT_CLASS(ion_access_cmo_class, TP_PROTO(const struct device *dev, const char *name, bool cached, bool hlos_accessible, enum dma_data_direction dir, bool only_mapped), TP_ARGS(dev, name, cached, hlos_accessible, dir, only_mapped), TP_STRUCT__entry( __string(dev_name, dev ? dev_name(dev) : DEV_NAME_NONE) __string(name, name) __field(bool, cached) __field(bool, hlos_accessible) __field(enum dma_data_direction, dir) __field(bool, only_mapped) ), TP_fast_assign( __assign_str(dev_name, dev ? dev_name(dev) : DEV_NAME_NONE); __assign_str(name, name); __entry->cached = cached; __entry->hlos_accessible = hlos_accessible; __entry->dir = dir; __entry->only_mapped = only_mapped; ), TP_printk("dev=%s name=%s cached=%d access=%d dir=%d, only_mapped=%d", __get_str(dev_name), __get_str(name), __entry->cached, __entry->hlos_accessible, __entry->dir, __entry->only_mapped) ); DEFINE_EVENT(ion_access_cmo_class, ion_begin_cpu_access_cmo_apply, TP_PROTO(const struct device *dev, const char *name, bool cached, bool hlos_accessible, enum dma_data_direction dir, bool only_mapped), TP_ARGS(dev, name, cached, hlos_accessible, dir, only_mapped) ); DEFINE_EVENT(ion_access_cmo_class, ion_begin_cpu_access_cmo_skip, TP_PROTO(const struct device *dev, const char *name, bool cached, bool hlos_accessible, enum dma_data_direction dir, bool only_mapped), TP_ARGS(dev, name, cached, hlos_accessible, dir, only_mapped) ); DEFINE_EVENT(ion_access_cmo_class, ion_begin_cpu_access_notmapped, TP_PROTO(const struct device *dev, const char *name, bool cached, bool hlos_accessible, enum dma_data_direction dir, bool only_mapped), TP_ARGS(dev, name, cached, hlos_accessible, dir, only_mapped) ); DEFINE_EVENT(ion_access_cmo_class, ion_end_cpu_access_cmo_apply, TP_PROTO(const struct device *dev, const char *name, bool cached, bool hlos_accessible, enum dma_data_direction dir, bool only_mapped), TP_ARGS(dev, name, cached, hlos_accessible, dir, only_mapped) ); DEFINE_EVENT(ion_access_cmo_class, ion_end_cpu_access_cmo_skip, TP_PROTO(const struct device *dev, const char *name, bool cached, bool hlos_accessible, enum dma_data_direction dir, bool only_mapped), TP_ARGS(dev, name, cached, hlos_accessible, dir, only_mapped) ); DEFINE_EVENT(ion_access_cmo_class, ion_end_cpu_access_notmapped, TP_PROTO(const struct device *dev, const char *name, bool cached, bool hlos_accessible, enum dma_data_direction dir, bool only_mapped), TP_ARGS(dev, name, cached, hlos_accessible, dir, only_mapped) ); #endif /* _TRACE_ION_H */ #include <trace/define_trace.h>
/* Copyright (c) 2018 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only 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. */ #undef TRACE_SYSTEM #define VAR_0 ion #if !defined(_TRACE_ION_H) || defined(VAR_1) #define _TRACE_ION_H #include <IMPORT_0> #include <linux/tracepoint.h> #define VAR_2 "None" FUNC_0(ion_dma_map_cmo_class, TP_PROTO(VAR_3 VAR_4 VAR_5 *VAR_6, VAR_3 VAR_7 *VAR_8, VAR_9 VAR_10, VAR_9 VAR_11, VAR_12 VAR_13 VAR_14, VAR_15 dma_data_direction VAR_16), TP_ARGS(VAR_6, VAR_8, VAR_10, VAR_11, VAR_14, VAR_16), FUNC_1( __string(dev_name, VAR_6 ? dev_name(VAR_6) : VAR_2) __string(VAR_8, VAR_8) __field(VAR_9, VAR_10) __field(VAR_9, VAR_11) __field(VAR_12 VAR_13, VAR_14) __field(VAR_15 dma_data_direction, VAR_16) ), TP_fast_assign( FUNC_2(dev_name, VAR_6 ? dev_name(VAR_6) : VAR_2); FUNC_2(VAR_8, VAR_8); __entry->VAR_10 = VAR_10; __entry->VAR_11 = VAR_11; __entry->VAR_14 = VAR_14; __entry->VAR_16 = VAR_16; ), FUNC_3("dev=%s name=%s cached=%d access=%d map_attrs=0x%lx dir=%d", FUNC_4(dev_name), FUNC_4(VAR_8), __entry->VAR_10, __entry->VAR_11, __entry->VAR_14, __entry->VAR_16) ); FUNC_5(ion_dma_map_cmo_class, VAR_17, TP_PROTO(VAR_3 VAR_4 VAR_5 *VAR_6, VAR_3 VAR_7 *VAR_8, VAR_9 VAR_10, VAR_9 VAR_11, VAR_12 VAR_13 VAR_14, VAR_15 dma_data_direction VAR_16), TP_ARGS(VAR_6, VAR_8, VAR_10, VAR_11, VAR_14, VAR_16) ); FUNC_5(ion_dma_map_cmo_class, ion_dma_map_cmo_skip, TP_PROTO(VAR_3 VAR_4 VAR_5 *VAR_6, VAR_3 VAR_7 *VAR_8, VAR_9 VAR_10, VAR_9 VAR_11, VAR_12 VAR_13 VAR_14, VAR_15 dma_data_direction VAR_16), TP_ARGS(VAR_6, VAR_8, VAR_10, VAR_11, VAR_14, VAR_16) ); FUNC_5(ion_dma_map_cmo_class, VAR_18, TP_PROTO(VAR_3 VAR_4 VAR_5 *VAR_6, VAR_3 VAR_7 *VAR_8, VAR_9 VAR_10, VAR_9 VAR_11, VAR_12 VAR_13 VAR_14, VAR_15 dma_data_direction VAR_16), TP_ARGS(VAR_6, VAR_8, VAR_10, VAR_11, VAR_14, VAR_16) ); FUNC_5(ion_dma_map_cmo_class, VAR_19, TP_PROTO(VAR_3 VAR_4 VAR_5 *VAR_6, VAR_3 VAR_7 *VAR_8, VAR_9 VAR_10, VAR_9 VAR_11, VAR_12 VAR_13 VAR_14, VAR_15 dma_data_direction VAR_16), TP_ARGS(VAR_6, VAR_8, VAR_10, VAR_11, VAR_14, VAR_16) ); FUNC_0(VAR_20, TP_PROTO(VAR_3 VAR_4 VAR_5 *VAR_6, VAR_3 VAR_7 *VAR_8, VAR_9 VAR_10, VAR_9 VAR_11, VAR_15 dma_data_direction VAR_16, VAR_9 VAR_21), TP_ARGS(VAR_6, VAR_8, VAR_10, VAR_11, VAR_16, VAR_21), FUNC_1( __string(dev_name, VAR_6 ? dev_name(VAR_6) : VAR_2) __string(VAR_8, VAR_8) __field(VAR_9, VAR_10) __field(VAR_9, VAR_11) __field(VAR_15 dma_data_direction, VAR_16) __field(VAR_9, VAR_21) ), TP_fast_assign( FUNC_2(dev_name, VAR_6 ? dev_name(VAR_6) : VAR_2); FUNC_2(VAR_8, VAR_8); __entry->VAR_10 = VAR_10; __entry->VAR_11 = VAR_11; __entry->VAR_16 = VAR_16; __entry->VAR_21 = VAR_21; ), FUNC_3("dev=%s name=%s cached=%d access=%d dir=%d, only_mapped=%d", FUNC_4(dev_name), FUNC_4(VAR_8), __entry->VAR_10, __entry->VAR_11, __entry->VAR_16, __entry->VAR_21) ); FUNC_5(VAR_20, VAR_22, TP_PROTO(VAR_3 VAR_4 VAR_5 *VAR_6, VAR_3 VAR_7 *VAR_8, VAR_9 VAR_10, VAR_9 VAR_11, VAR_15 dma_data_direction VAR_16, VAR_9 VAR_21), TP_ARGS(VAR_6, VAR_8, VAR_10, VAR_11, VAR_16, VAR_21) ); FUNC_5(VAR_20, VAR_23, TP_PROTO(VAR_3 VAR_4 VAR_5 *VAR_6, VAR_3 VAR_7 *VAR_8, VAR_9 VAR_10, VAR_9 VAR_11, VAR_15 dma_data_direction VAR_16, VAR_9 VAR_21), TP_ARGS(VAR_6, VAR_8, VAR_10, VAR_11, VAR_16, VAR_21) ); FUNC_5(VAR_20, VAR_24, TP_PROTO(VAR_3 VAR_4 VAR_5 *VAR_6, VAR_3 VAR_7 *VAR_8, VAR_9 VAR_10, VAR_9 VAR_11, VAR_15 dma_data_direction VAR_16, VAR_9 VAR_21), TP_ARGS(VAR_6, VAR_8, VAR_10, VAR_11, VAR_16, VAR_21) ); FUNC_5(VAR_20, VAR_25, TP_PROTO(VAR_3 VAR_4 VAR_5 *VAR_6, VAR_3 VAR_7 *VAR_8, VAR_9 VAR_10, VAR_9 VAR_11, VAR_15 dma_data_direction VAR_16, VAR_9 VAR_21), TP_ARGS(VAR_6, VAR_8, VAR_10, VAR_11, VAR_16, VAR_21) ); FUNC_5(VAR_20, VAR_26, TP_PROTO(VAR_3 VAR_4 VAR_5 *VAR_6, VAR_3 VAR_7 *VAR_8, VAR_9 VAR_10, VAR_9 VAR_11, VAR_15 dma_data_direction VAR_16, VAR_9 VAR_21), TP_ARGS(VAR_6, VAR_8, VAR_10, VAR_11, VAR_16, VAR_21) ); FUNC_5(VAR_20, VAR_27, TP_PROTO(VAR_3 VAR_4 VAR_5 *VAR_6, VAR_3 VAR_7 *VAR_8, VAR_9 VAR_10, VAR_9 VAR_11, VAR_15 dma_data_direction VAR_16, VAR_9 VAR_21), TP_ARGS(VAR_6, VAR_8, VAR_10, VAR_11, VAR_16, VAR_21) ); #endif /* _TRACE_ION_H */ #include <IMPORT_1>
0.770168
{'VAR_0': 'TRACE_SYSTEM', 'VAR_1': 'TRACE_HEADER_MULTI_READ', 'IMPORT_0': 'linux/types.h', 'VAR_2': 'DEV_NAME_NONE', 'FUNC_0': 'DECLARE_EVENT_CLASS', 'VAR_3': 'const', 'VAR_4': 'struct', 'VAR_5': 'device', 'VAR_6': 'dev', 'VAR_7': 'char', 'VAR_8': 'name', 'VAR_9': 'bool', 'VAR_10': 'cached', 'VAR_11': 'hlos_accessible', 'VAR_12': 'unsigned', 'VAR_13': 'long', 'VAR_14': 'map_attrs', 'VAR_15': 'enum', 'VAR_16': 'dir', 'FUNC_1': 'TP_STRUCT__entry', 'FUNC_2': '__assign_str', 'FUNC_3': 'TP_printk', 'FUNC_4': '__get_str', 'FUNC_5': 'DEFINE_EVENT', 'VAR_17': 'ion_dma_map_cmo_apply', 'VAR_18': 'ion_dma_unmap_cmo_apply', 'VAR_19': 'ion_dma_unmap_cmo_skip', 'VAR_20': 'ion_access_cmo_class', 'VAR_21': 'only_mapped', 'VAR_22': 'ion_begin_cpu_access_cmo_apply', 'VAR_23': 'ion_begin_cpu_access_cmo_skip', 'VAR_24': 'ion_begin_cpu_access_notmapped', 'VAR_25': 'ion_end_cpu_access_cmo_apply', 'VAR_26': 'ion_end_cpu_access_cmo_skip', 'VAR_27': 'ion_end_cpu_access_notmapped', 'IMPORT_1': 'trace/define_trace.h'}
/////////////////////////////////////////////////////////////////////////// // // Copyright(C) 1997-1998 Microsoft Corporation all rights reserved. // // Module: sdoschema.h // // Project: Everest // // Description: SDO Schema Class Declaration // // Author: TLP 9/1/98 // /////////////////////////////////////////////////////////////////////////// #ifndef _INC_SDO_SCHEMA_H_ #define _INC_SDO_SCHEMA_H_ #include <ias.h> #include <sdoiaspriv.h> #include <comdef.h> // COM definitions - Needed for IEnumVARIANT #include "sdohelperfuncs.h" #include "sdo.h" #include "resource.h" // main symbols #include "StdString.h" #include <vector> using namespace std; ////////////////////////////////////////////////////////////////////// // SDO Schema Data Types ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// typedef struct _SCHEMA_PROPERTY_INFO { LPCWSTR lpszName; LPCWSTR Id; LONG Syntax; LONG Alias; DWORD Flags; DWORD MinLength; DWORD MaxLength; LPCWSTR lpszDisplayName; } SCHEMA_PROPERTY_INFO, *PSCHEMA_PROPERTY_INFO; ////////////////////////////////////////////////////////////////////// typedef LPCWSTR *PCLASSPROPERTIES; typedef struct _SCHEMA_CLASS_INFO { LPCWSTR lpszClassId; PCLASSPROPERTIES pRequiredProperties; PCLASSPROPERTIES pOptionalProperties; } SCHEMA_CLASS_INFO, *PSCHEMA_CLASS_INFO; ////////////////////////////////////////////////////////////////////// #define BEGIN_SCHEMA_PROPERTY_MAP(x) \ static SCHEMA_PROPERTY_INFO x[] = { ////////////////////////////////////////////////////////////////////// #define DEFINE_SCHEMA_PROPERTY(name, id, syntax, alias, flags, minLength, maxLength, displayName) \ { \ name, \ id, \ syntax, \ alias, \ flags, \ minLength, \ maxLength, \ displayName \ }, ////////////////////////////////////////////////////////////////////// #define END_SCHEMA_PROPERTY_MAP \ { \ NULL, \ NULL, \ 0, \ PROPERTY_SDO_RESERVED, \ 0, \ 0, \ 0, \ NULL \ } }; ////////////////////////////////////////////////////////////////////// #define BEGIN_SCHEMA_CLASS_MAP(x) \ static SCHEMA_CLASS_INFO x[] = { ////////////////////////////////////////////////////////////////////// #define DEFINE_SCHEMA_CLASS(id, required, optional) \ { \ id, \ required, \ optional \ }, ////////////////////////////////////////////////////////////////////// #define END_SCHEMA_CLASS_MAP \ { \ NULL, \ NULL, \ NULL \ } }; ////////////////////////////////////////////////////////////////////// typedef enum _SCHEMA_OBJECT_STATE { SCHEMA_OBJECT_SHUTDOWN, SCHEMA_OBJECT_UNINITIALIZED, SCHEMA_OBJECT_INITIALIZED } SCHEMA_OBJECT_STATE; ////////////////////////////////////////// class CSdoSchema; // Forward declaration ////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // CSdoSchemaClass Declaration ///////////////////////////////////////////////////////////////////////////// #define SDO_SCHEMA_CLASS_ID L"ClassId" #define SDO_SCHEMA_CLASS_BASE_CLASSES L"BaseClasses" #define SDO_SCHEMA_CLASS_REQUIRED_PROPERTIES L"RequiredProperties" #define SDO_SCHEMA_CLASS_OPTIONAL_PROPERTIES L"OptionalProperties" //////////////////////////////////////////////////////////////////////////// class ATL_NO_VTABLE CSdoSchemaClass : public CComObjectRootEx<CComMultiThreadModel>, public IDispatchImpl<ISdoClassInfo, &IID_ISdoClassInfo, &LIBID_SDOIASLibPrivate> { friend CSdoSchema; public: CSdoSchemaClass(); virtual ~CSdoSchemaClass(); // ATL Interface Map BEGIN_COM_MAP(CSdoSchemaClass) COM_INTERFACE_ENTRY(IDispatch) COM_INTERFACE_ENTRY(ISdoClassInfo) END_COM_MAP() //////////////////////// // ISdoClassInfo Methods ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_Id)( /*[out]*/ BSTR* Id ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(GetProperty)( /*[in]*/ LONG alias, /*[out]*/ IUnknown** ppPropertyInfo ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_RequiredPropertyCount)( /*[out]*/ LONG* count ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_RequiredProperties)( /*[out]*/ IUnknown** ppUnknown ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_OptionalPropertyCount)( /*[out]*/ LONG* count ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_OptionalProperties)( /*[out]*/ IUnknown** ppUnknown ); private: CSdoSchemaClass(const CSdoSchemaClass&); CSdoSchemaClass& operator = (CSdoSchemaClass&); ///////////////////////////////////////////////////////////////////////////// HRESULT InitNew( /*[in]*/ IDataStoreObject* pDSClass, /*[in]*/ ISdoSchema* pSchema ); ///////////////////////////////////////////////////////////////////////////// HRESULT Initialize( /*[in]*/ ISdoSchema* pSchema ); ///////////////////////////////////////////////////////////////////////////// HRESULT Initialize( /*[in]*/ PSCHEMA_CLASS_INFO pClassInfo, /*[in]*/ ISdoSchema* pSchema ); ///////////////////////////////////////////////////////////////////////////// HRESULT AddProperty( /*[in]*/ CLASSPROPERTYSET ePropertySet, /*[in]*/ ISdoPropertyInfo* pPropertyInfo ); ///////////////////////////////////////////////////////////////////////////// HRESULT AddBaseClassProperties( /*[in]*/ ISdoClassInfo* pSdoClassInfo ); ///////////////////////////////////////////////////////////////////////////// HRESULT ReadClassProperties( /*[in]*/ IDataStoreObject* pDSClass ); ////////////////////////////////////////////////////////////////////////////// void FreeProperties(void); typedef map<LONG, ISdoPropertyInfo*> ClassPropertyMap; typedef ClassPropertyMap::iterator ClassPropertyMapIterator; enum { VARIANT_BASES = 0, VARIANT_REQUIRED, VARIANT_OPTIONAL, VARIANT_MAX }; SCHEMA_OBJECT_STATE m_state; StdWString m_id; _variant_t m_variants[VARIANT_MAX]; ClassPropertyMap m_requiredProperties; ClassPropertyMap m_optionalProperties; }; // End of class cSdoSchemaClass typedef CComObjectNoLock<CSdoSchemaClass> SDO_CLASS_OBJ; typedef CComObjectNoLock<CSdoSchemaClass>* PSDO_CLASS_OBJ; ///////////////////////////////////////////////////////////////////////////// // CSdoSchemaProperty Declaration ///////////////////////////////////////////////////////////////////////////// #define SDO_SCHEMA_PROPERTY_NAME SDO_STOCK_PROPERTY_NAME #define SDO_SCHEMA_PROPERTY_ID L"PropertyId" #define SDO_SCHEMA_PROPERTY_TYPE L"Syntax" #define SDO_SCHEMA_PROPERTY_ALIAS L"Alias" #define SDO_SCHEMA_PROPERTY_FLAGS L"Flags" #define SDO_SCHEMA_PROPERTY_DISPLAYNAME L"DisplayName" #define SDO_SCHEMA_PROPERTY_MINVAL L"MinValue" #define SDO_SCHEMA_PROPERTY_MAXVAL L"MaxValue" #define SDO_SCHEMA_PROPERTY_MINLENGTH L"MinLength" #define SDO_SCHEMA_PROPERTY_MAXLENGTH L"MaxLength" #define SDO_SCHEMA_PROPERTY_DEFAULTVAL L"DefaultValue" #define SDO_SCHEMA_PROPERTY_FORMAT L"Format" class ATL_NO_VTABLE CSdoSchemaProperty : public CComObjectRootEx<CComMultiThreadModel>, public IDispatchImpl<ISdoPropertyInfo, &IID_ISdoPropertyInfo, &LIBID_SDOIASLibPrivate> { friend CSdoSchema; public: CSdoSchemaProperty(); virtual ~CSdoSchemaProperty(); // ATL Interface Map BEGIN_COM_MAP(CSdoSchemaProperty) COM_INTERFACE_ENTRY(IDispatch) COM_INTERFACE_ENTRY(ISdoPropertyInfo) END_COM_MAP() // ISdoPropertyInfo Methods ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_Name)( /*[out]*/ BSTR* Name ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_Id)( /*[out]*/ BSTR* Id ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_Type)( /*[out]*/ LONG* type ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_Alias)( /*[out]*/ LONG* alias ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_Flags)( /*[out]*/ LONG* flags ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_DisplayName)( /*[out]*/ BSTR* displayName ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(HasMinLength)( /*[out]*/ VARIANT_BOOL* pBool ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_MinLength)( /*[out]*/ LONG* length ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(HasMaxLength)( /*[out]*/ VARIANT_BOOL* pBool ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_MaxLength)( /*[out]*/ LONG* length ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(HasMinValue)( /*[out]*/ VARIANT_BOOL* pBool ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_MinValue)( /*[out]*/ VARIANT* value ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(HasMaxValue)( /*[out]*/ VARIANT_BOOL* pBool ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_MaxValue)( /*[out]*/ VARIANT* value ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(HasDefaultValue)( /*[out]*/ VARIANT_BOOL* pBool ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_DefaultValue)( /*[out]*/ VARIANT* value ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(HasFormat)( /*[out]*/ VARIANT_BOOL* pBool ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_Format)( /*[out]*/ BSTR* displayName ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(IsRequired)( /*[out]*/ VARIANT_BOOL* pBool ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(IsReadOnly)( /*[out]*/ VARIANT_BOOL* pBool ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(IsMultiValued)( /*[out]*/ VARIANT_BOOL* pBool ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(IsCollection)( /*[out]*/ VARIANT_BOOL* pBool ); private: CSdoSchemaProperty(const CSdoSchemaProperty&); CSdoSchemaProperty& operator = (CSdoSchemaProperty&); ////////////////////////////////////////////////////////////////////////////// HRESULT Initialize( /*[in]*/ IDataStoreObject* pDSObject ); ////////////////////////////////////////////////////////////////////////////// HRESULT Initialize( /*[in]*/ PSCHEMA_PROPERTY_INFO pPropertyInfo ); ////////////////////////////////////////////////////////////////////////////// SCHEMA_OBJECT_STATE m_state; StdWString m_name; StdWString m_id; StdWString m_displayName; StdWString m_format; LONG m_type; LONG m_alias; DWORD m_flags; DWORD m_minLength; DWORD m_maxLength; _variant_t m_minValue; _variant_t m_maxValue; _variant_t m_defaultValue; }; // End of class CSdoSchemaProperty typedef CComObjectNoLock<CSdoSchemaProperty> SDO_PROPERTY_OBJ; typedef CComObjectNoLock<CSdoSchemaProperty>* PSDO_PROPERTY_OBJ; ///////////////////////////////////////////////////////////////////////////// // CSdoSchema Declaration ///////////////////////////////////////////////////////////////////////////// #define SDO_SCHEMA_ROOT_OBJECT L"SDO Schema" #define SDO_SCHEMA_PROPERTIES_CONTAINER L"SDO Schema Properties" #define SDO_SCHEMA_CLASSES_CONTAINER L"SDO Schema Classes" class ATL_NO_VTABLE CSdoSchema : public CComObjectRootEx<CComMultiThreadModel>, public IDispatchImpl<ISdoSchema, &IID_ISdoSchema, &LIBID_SDOIASLibPrivate> { friend HRESULT MakeSDOSchema( /*[in]*/ IDataStoreContainer* pDSRootContainer, /*[out*/ ISdoSchema** ppSdoSchema ); public: CSdoSchema(); ~CSdoSchema(); // Don't plan to derive from this class... // ATL Interface Map BEGIN_COM_MAP(CSdoSchema) COM_INTERFACE_ENTRY(IDispatch) COM_INTERFACE_ENTRY(ISdoSchema) END_COM_MAP() ///////////////////////////////////////////////////////////////////////////// HRESULT Initialize( /*[in]*/ IDataStoreObject* pSchemaDataStore ); /////////////////////////// // ISdoPropertyInfo Methods ///////////////////////////////////////////////////////////////////////////// STDMETHOD(GetVersion)( /*[in]*/ BSTR* version ); ///////////////////////////////////////////////////////////////////////////// STDMETHOD(GetClass)( /*[in]*/ BSTR classId, /*[out]*/ IUnknown** sdoClassInfo ); ///////////////////////////////////////////////////////////////////////////// STDMETHOD(GetProperty)( /*[in]*/ BSTR propertyId, /*[out]*/ IUnknown** sdoPropertyInfo ); private: CSdoSchema(const CSdoSchema&); // No copy CSdoSchema& operator = (CSdoSchema&); // No assignment ///////////////////////////////////////////////////////////////////////////// SCHEMA_OBJECT_STATE GetState() const { return m_state; } ///////////////////////////////////////////////////////////////////////////// HRESULT AddProperty( /*[in]*/ PSDO_PROPERTY_OBJ pPropertyObj ); ///////////////////////////////////////////////////////////////////////////// HRESULT AddClass( /*[in]*/ PSDO_CLASS_OBJ pClassObj ); ///////////////////////////////////////////////////////////////////////////// HRESULT InitializeClasses(void); ///////////////////////////////////////////////////////////////////////////// void DestroyProperties(void); ///////////////////////////////////////////////////////////////////////////// void DestroyClasses(void); ///////////////////////////////////////////////////////////////////////////// HRESULT BuildInternalProperties(void); ///////////////////////////////////////////////////////////////////////////// HRESULT BuildInternalClasses(void); ///////////////////////////////////////////////////////////////////////////// HRESULT BuildSchemaProperties( /*[in]*/ IDataStoreObject* pSchema ); ///////////////////////////////////////////////////////////////////////////// HRESULT BuildSchemaClasses( /*[in]*/ IDataStoreObject* pSchema ); typedef map<StdWString, ISdoClassInfo*> ClassMap; typedef ClassMap::iterator ClassMapIterator; typedef map<StdWString, ISdoPropertyInfo*> PropertyMap; typedef PropertyMap::iterator PropertyMapIterator; SCHEMA_OBJECT_STATE m_state; bool m_fInternalObjsInitialized; bool m_fSchemaObjsInitialized; CRITICAL_SECTION m_critSec; StdWString m_version; ClassMap m_classMap; PropertyMap m_propertyMap; }; // End of class CSdoSchema typedef CComObjectNoLock<CSdoSchema> SDO_SCHEMA_OBJ; typedef CComObjectNoLock<CSdoSchema>* PSDO_SCHEMA_OBJ; #endif // _INC_SDO_SCHEMA_H_
/////////////////////////////////////////////////////////////////////////// // // Copyright(C) 1997-1998 Microsoft Corporation all rights reserved. // // Module: sdoschema.h // // Project: Everest // // Description: SDO Schema Class Declaration // // Author: TLP 9/1/98 // /////////////////////////////////////////////////////////////////////////// #ifndef VAR_0 #define VAR_0 #include <IMPORT_0> #include <sdoiaspriv.h> #include <comdef.h> // COM definitions - Needed for IEnumVARIANT #include "IMPORT_1" #include "IMPORT_2" #include "resource.h" // main symbols #include "StdString.h" #include <vector> using namespace std; ////////////////////////////////////////////////////////////////////// // SDO Schema Data Types ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// typedef struct CLASS_0 { LPCWSTR lpszName; LPCWSTR Id; LONG Syntax; LONG Alias; DWORD Flags; DWORD MinLength; DWORD MaxLength; LPCWSTR VAR_1; } ID_0, *PSCHEMA_PROPERTY_INFO; ////////////////////////////////////////////////////////////////////// typedef LPCWSTR *PCLASSPROPERTIES; typedef struct _SCHEMA_CLASS_INFO { LPCWSTR lpszClassId; PCLASSPROPERTIES pRequiredProperties; PCLASSPROPERTIES VAR_2; } SCHEMA_CLASS_INFO, *PSCHEMA_CLASS_INFO; ////////////////////////////////////////////////////////////////////// #define FUNC_0(x) \ static SCHEMA_PROPERTY_INFO x[] = { ////////////////////////////////////////////////////////////////////// #define FUNC_1(name, id, VAR_3, VAR_4, flags, minLength, VAR_5, VAR_6) \ { \ name, \ id, \ syntax, \ alias, \ flags, \ minLength, \ maxLength, \ displayName \ }, ////////////////////////////////////////////////////////////////////// #define END_SCHEMA_PROPERTY_MAP \ { \ NULL, \ NULL, \ 0, \ PROPERTY_SDO_RESERVED, \ 0, \ 0, \ 0, \ NULL \ } }; ////////////////////////////////////////////////////////////////////// #define BEGIN_SCHEMA_CLASS_MAP(x) \ static SCHEMA_CLASS_INFO x[] = { ////////////////////////////////////////////////////////////////////// #define DEFINE_SCHEMA_CLASS(id, VAR_7, VAR_8) \ { \ id, \ required, \ optional \ }, ////////////////////////////////////////////////////////////////////// #define END_SCHEMA_CLASS_MAP \ { \ NULL, \ NULL, \ NULL \ } }; ////////////////////////////////////////////////////////////////////// typedef enum CLASS_1 { SCHEMA_OBJECT_SHUTDOWN, SCHEMA_OBJECT_UNINITIALIZED, SCHEMA_OBJECT_INITIALIZED } SCHEMA_OBJECT_STATE; ////////////////////////////////////////// class CSdoSchema; // Forward declaration ////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // CSdoSchemaClass Declaration ///////////////////////////////////////////////////////////////////////////// #define SDO_SCHEMA_CLASS_ID L"ClassId" #define VAR_9 L"BaseClasses" #define SDO_SCHEMA_CLASS_REQUIRED_PROPERTIES L"RequiredProperties" #define VAR_10 L"OptionalProperties" //////////////////////////////////////////////////////////////////////////// class ATL_NO_VTABLE CSdoSchemaClass : public CComObjectRootEx<CComMultiThreadModel>, public VAR_11<VAR_12, &IID_ISdoClassInfo, &VAR_13> { friend CSdoSchema; public: CSdoSchemaClass(); virtual ~CSdoSchemaClass(); // ATL Interface Map BEGIN_COM_MAP(CSdoSchemaClass) FUNC_2(IDispatch) VAR_14(ID_1) FUNC_3() //////////////////////// // ISdoClassInfo Methods ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_Id)( /*[out]*/ CLASS_3* Id ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(GetProperty)( /*[in]*/ LONG VAR_4, /*[out]*/ CLASS_4** ppPropertyInfo ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_RequiredPropertyCount)( /*[out]*/ LONG* VAR_15 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_RequiredProperties)( /*[out]*/ CLASS_4** VAR_16 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_OptionalPropertyCount)( /*[out]*/ LONG* VAR_15 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_OptionalProperties)( /*[out]*/ CLASS_4** VAR_16 ); private: CSdoSchemaClass(const CSdoSchemaClass&); CSdoSchemaClass& VAR_17 = (CSdoSchemaClass&VAR_18); ///////////////////////////////////////////////////////////////////////////// HRESULT FUNC_4( /*[in]*/ IDataStoreObject* pDSClass, /*[in]*/ CLASS_5* pSchema ); ///////////////////////////////////////////////////////////////////////////// HRESULT FUNC_5( /*[in]*/ CLASS_5* pSchema ); ///////////////////////////////////////////////////////////////////////////// HRESULT FUNC_5( /*[in]*/ PSCHEMA_CLASS_INFO VAR_20, /*[in]*/ CLASS_5* pSchema ); ///////////////////////////////////////////////////////////////////////////// HRESULT FUNC_6( /*[in]*/ CLASSPROPERTYSET ePropertySet, /*[in]*/ ISdoPropertyInfo* pPropertyInfo ); ///////////////////////////////////////////////////////////////////////////// HRESULT AddBaseClassProperties( /*[in]*/ CLASS_2* VAR_21 ); ///////////////////////////////////////////////////////////////////////////// HRESULT ReadClassProperties( /*[in]*/ IDataStoreObject* pDSClass ); ////////////////////////////////////////////////////////////////////////////// void FUNC_7(void); CLASS_6 map<LONG, ISdoPropertyInfo*> ClassPropertyMap; CLASS_6 ClassPropertyMap::VAR_22 ClassPropertyMapIterator; enum { VARIANT_BASES = 0, VAR_23, VARIANT_OPTIONAL, VARIANT_MAX }VAR_18; SCHEMA_OBJECT_STATE VAR_24; StdWString m_id; _variant_t VAR_25[VARIANT_MAX]; ClassPropertyMap m_requiredProperties; ClassPropertyMap m_optionalProperties; }; // End of class cSdoSchemaClass typedef CComObjectNoLock<CSdoSchemaClass> SDO_CLASS_OBJ; CLASS_6 CComObjectNoLock<CSdoSchemaClass>* PSDO_CLASS_OBJ; ///////////////////////////////////////////////////////////////////////////// // CSdoSchemaProperty Declaration ///////////////////////////////////////////////////////////////////////////// #define SDO_SCHEMA_PROPERTY_NAME SDO_STOCK_PROPERTY_NAME #define SDO_SCHEMA_PROPERTY_ID L"VAR_26" #define SDO_SCHEMA_PROPERTY_TYPE L"Syntax" #define SDO_SCHEMA_PROPERTY_ALIAS L"Alias" #define SDO_SCHEMA_PROPERTY_FLAGS L"Flags" #define VAR_27 L"VAR_28" #define VAR_29 L"MinValue" #define SDO_SCHEMA_PROPERTY_MAXVAL L"MaxValue" #define SDO_SCHEMA_PROPERTY_MINLENGTH L"MinLength" #define SDO_SCHEMA_PROPERTY_MAXLENGTH L"MaxLength" #define SDO_SCHEMA_PROPERTY_DEFAULTVAL L"DefaultValue" #define SDO_SCHEMA_PROPERTY_FORMAT L"Format" class ATL_NO_VTABLE CSdoSchemaProperty : public CComObjectRootEx<CComMultiThreadModel>, public VAR_11<ISdoPropertyInfo, &IID_ISdoPropertyInfo, &VAR_13> { friend CSdoSchema; public: CSdoSchemaProperty(); virtual ~CSdoSchemaProperty(); // ATL Interface Map BEGIN_COM_MAP(CSdoSchemaProperty) FUNC_2(IDispatch) VAR_14(ISdoPropertyInfo) FUNC_3() // ISdoPropertyInfo Methods ////////////////////////////////////////////////////////////////////////////// STDMETHOD(VAR_30)( /*[out]*/ CLASS_3* VAR_31 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_Id)( /*[out]*/ CLASS_3* Id ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(VAR_32)( /*[out]*/ LONG* type ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_Alias)( /*[out]*/ LONG* VAR_4 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_Flags)( /*[out]*/ LONG* flags ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_DisplayName)( /*[out]*/ CLASS_3* VAR_6 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(VAR_33)( /*[out]*/ CLASS_7* VAR_34 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_MinLength)( /*[out]*/ LONG* length ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(HasMaxLength)( /*[out]*/ CLASS_7* VAR_34 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_MaxLength)( /*[out]*/ LONG* length ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(HasMinValue)( /*[out]*/ CLASS_7* VAR_34 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(VAR_35)( /*[out]*/ CLASS_8* value ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(VAR_36)( /*[out]*/ CLASS_7* VAR_34 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_MaxValue)( /*[out]*/ CLASS_8* value ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(VAR_37)( /*[out]*/ CLASS_7* VAR_34 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_DefaultValue)( /*[out]*/ CLASS_8* value ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(HasFormat)( /*[out]*/ CLASS_7* VAR_34 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(get_Format)( /*[out]*/ CLASS_3* VAR_6 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(IsRequired)( /*[out]*/ CLASS_7* VAR_34 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(VAR_38)( /*[out]*/ CLASS_7* VAR_34 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(IsMultiValued)( /*[out]*/ CLASS_7* VAR_34 ); ////////////////////////////////////////////////////////////////////////////// STDMETHOD(IsCollection)( /*[out]*/ CLASS_7* VAR_34 ); private: CSdoSchemaProperty(const CSdoSchemaProperty&); CSdoSchemaProperty& VAR_17 = (CSdoSchemaProperty&VAR_18); ////////////////////////////////////////////////////////////////////////////// HRESULT FUNC_5( /*[in]*/ IDataStoreObject* VAR_39 ); ////////////////////////////////////////////////////////////////////////////// HRESULT FUNC_5( /*[in]*/ PSCHEMA_PROPERTY_INFO pPropertyInfo ); ////////////////////////////////////////////////////////////////////////////// SCHEMA_OBJECT_STATE VAR_24; StdWString VAR_40; StdWString m_id; StdWString VAR_41; StdWString m_format; LONG m_type; LONG m_alias; DWORD m_flags; DWORD VAR_42; DWORD VAR_43; _variant_t m_minValue; _variant_t VAR_44; _variant_t m_defaultValue; }; // End of class CSdoSchemaProperty typedef CComObjectNoLock<CSdoSchemaProperty> VAR_45; CLASS_6 CComObjectNoLock<CSdoSchemaProperty>* VAR_46; ///////////////////////////////////////////////////////////////////////////// // CSdoSchema Declaration ///////////////////////////////////////////////////////////////////////////// #define SDO_SCHEMA_ROOT_OBJECT VAR_47"VAR_48 Schema" #define SDO_SCHEMA_PROPERTIES_CONTAINER VAR_47"SDO Schema Properties" #define VAR_49 L"SDO Schema Classes" class ATL_NO_VTABLE CSdoSchema : public CComObjectRootEx<CComMultiThreadModel>, public VAR_11<VAR_19, &IID_ISdoSchema, &VAR_13> { friend HRESULT FUNC_8( /*[in]*/ IDataStoreContainer* pDSRootContainer, /*[out*/ CLASS_5** ppSdoSchema ); public: CSdoSchema(); ~CSdoSchema(); // Don't plan to derive from this class... // ATL Interface Map BEGIN_COM_MAP(CSdoSchema) FUNC_2(IDispatch) VAR_14(ID_2) FUNC_3() ///////////////////////////////////////////////////////////////////////////// HRESULT FUNC_5( /*[in]*/ IDataStoreObject* pSchemaDataStore ); /////////////////////////// // ISdoPropertyInfo Methods ///////////////////////////////////////////////////////////////////////////// STDMETHOD(VAR_50)( /*[in]*/ CLASS_3* VAR_51 ); ///////////////////////////////////////////////////////////////////////////// STDMETHOD(VAR_52)( /*[in]*/ CLASS_3 VAR_53, /*[out]*/ CLASS_4** sdoClassInfo ); ///////////////////////////////////////////////////////////////////////////// STDMETHOD(GetProperty)( /*[in]*/ CLASS_3 propertyId, /*[out]*/ CLASS_4** VAR_54 ); private: CSdoSchema(const CSdoSchema&); // No copy CSdoSchema& VAR_17 = (CSdoSchema&VAR_18); // No assignment ///////////////////////////////////////////////////////////////////////////// SCHEMA_OBJECT_STATE GetState() const { return VAR_24; } ///////////////////////////////////////////////////////////////////////////// HRESULT FUNC_6( /*[in]*/ CLASS_9 pPropertyObj ); ///////////////////////////////////////////////////////////////////////////// HRESULT FUNC_9( /*[in]*/ PSDO_CLASS_OBJ pClassObj ); ///////////////////////////////////////////////////////////////////////////// HRESULT InitializeClasses(void); ///////////////////////////////////////////////////////////////////////////// void DestroyProperties(void); ///////////////////////////////////////////////////////////////////////////// void FUNC_10(void); ///////////////////////////////////////////////////////////////////////////// HRESULT BuildInternalProperties(void); ///////////////////////////////////////////////////////////////////////////// HRESULT BuildInternalClasses(void); ///////////////////////////////////////////////////////////////////////////// HRESULT FUNC_11( /*[in]*/ IDataStoreObject* pSchema ); ///////////////////////////////////////////////////////////////////////////// HRESULT BuildSchemaClasses( /*[in]*/ IDataStoreObject* pSchema ); CLASS_6 map<StdWString, VAR_12*> ClassMap; CLASS_6 ClassMap::VAR_22 ClassMapIterator; CLASS_6 map<StdWString, ISdoPropertyInfo*> PropertyMap; CLASS_6 PropertyMap::VAR_22 PropertyMapIterator; SCHEMA_OBJECT_STATE VAR_24; bool m_fInternalObjsInitialized; bool VAR_55; CRITICAL_SECTION m_critSec; StdWString m_version; ClassMap VAR_56; PropertyMap VAR_57; }; // End of class CSdoSchema typedef CComObjectNoLock<CSdoSchema> VAR_58; CLASS_6 CComObjectNoLock<CSdoSchema>* PSDO_SCHEMA_OBJ; #endif // _INC_SDO_SCHEMA_H_
0.375143
{'VAR_0': '_INC_SDO_SCHEMA_H_', 'IMPORT_0': 'ias.h', 'IMPORT_1': 'sdohelperfuncs.h', 'IMPORT_2': 'sdo.h', 'CLASS_0': '_SCHEMA_PROPERTY_INFO', 'VAR_1': 'lpszDisplayName', 'ID_0': 'SCHEMA_PROPERTY_INFO', 'VAR_2': 'pOptionalProperties', 'FUNC_0': 'BEGIN_SCHEMA_PROPERTY_MAP', 'FUNC_1': 'DEFINE_SCHEMA_PROPERTY', 'VAR_3': 'syntax', 'VAR_4': 'alias', 'VAR_5': 'maxLength', 'VAR_6': 'displayName', 'VAR_7': 'required', 'VAR_8': 'optional', 'CLASS_1': '_SCHEMA_OBJECT_STATE', 'VAR_9': 'SDO_SCHEMA_CLASS_BASE_CLASSES', 'VAR_10': 'SDO_SCHEMA_CLASS_OPTIONAL_PROPERTIES', 'VAR_11': 'IDispatchImpl', 'VAR_12': 'ISdoClassInfo', 'ID_1': 'ISdoClassInfo', 'CLASS_2': 'ISdoClassInfo', 'VAR_13': 'LIBID_SDOIASLibPrivate', 'FUNC_2': 'COM_INTERFACE_ENTRY', 'VAR_14': 'COM_INTERFACE_ENTRY', 'FUNC_3': 'END_COM_MAP', 'CLASS_3': 'BSTR', 'CLASS_4': 'IUnknown', 'VAR_15': 'count', 'VAR_16': 'ppUnknown', 'VAR_17': 'operator', 'VAR_18': '', 'FUNC_4': 'InitNew', 'CLASS_5': 'ISdoSchema', 'VAR_19': 'ISdoSchema', 'ID_2': 'ISdoSchema', 'FUNC_5': 'Initialize', 'VAR_20': 'pClassInfo', 'FUNC_6': 'AddProperty', 'VAR_21': 'pSdoClassInfo', 'FUNC_7': 'FreeProperties', 'CLASS_6': 'typedef', 'VAR_22': 'iterator', 'VAR_23': 'VARIANT_REQUIRED', 'VAR_24': 'm_state', 'VAR_25': 'm_variants', 'VAR_26': 'PropertyId', 'VAR_27': 'SDO_SCHEMA_PROPERTY_DISPLAYNAME', 'VAR_28': 'DisplayName', 'VAR_29': 'SDO_SCHEMA_PROPERTY_MINVAL', 'VAR_30': 'get_Name', 'VAR_31': 'Name', 'VAR_32': 'get_Type', 'VAR_33': 'HasMinLength', 'CLASS_7': 'VARIANT_BOOL', 'VAR_34': 'pBool', 'VAR_35': 'get_MinValue', 'CLASS_8': 'VARIANT', 'VAR_36': 'HasMaxValue', 'VAR_37': 'HasDefaultValue', 'VAR_38': 'IsReadOnly', 'VAR_39': 'pDSObject', 'VAR_40': 'm_name', 'VAR_41': 'm_displayName', 'VAR_42': 'm_minLength', 'VAR_43': 'm_maxLength', 'VAR_44': 'm_maxValue', 'VAR_45': 'SDO_PROPERTY_OBJ', 'VAR_46': 'PSDO_PROPERTY_OBJ', 'CLASS_9': 'PSDO_PROPERTY_OBJ', 'VAR_47': 'L', 'VAR_48': 'SDO', 'VAR_49': 'SDO_SCHEMA_CLASSES_CONTAINER', 'FUNC_8': 'MakeSDOSchema', 'VAR_50': 'GetVersion', 'VAR_51': 'version', 'VAR_52': 'GetClass', 'VAR_53': 'classId', 'VAR_54': 'sdoPropertyInfo', 'FUNC_9': 'AddClass', 'FUNC_10': 'DestroyClasses', 'FUNC_11': 'BuildSchemaProperties', 'VAR_55': 'm_fSchemaObjsInitialized', 'VAR_56': 'm_classMap', 'VAR_57': 'm_propertyMap', 'VAR_58': 'SDO_SCHEMA_OBJ'}
/* * Pseudoknot Class * Pseudoknot class stores and accesses pseudoknotted pairs. * Files with Pseudoknot class are: basepair.cpp, basepair.h, Pseudoknot.cpp, Pseudoknot.h * * (c) 2013 * Mathews Lab, University of Rochester Medical Center */ #include "basepair.h" #include <vector> #include <algorithm> using namespace std; //Class to keep track of pairs in a pseudoknot //Pairs are in lists called broken and intact //where broken are those pairs removed by a breakpseudoknot routine //and intact are the crossing pairs to those from broken class Pseudoknot { public: //Empty constructor Pseudoknot(); //Return the number of broken pairs int GetNumberBroken(); //return the number of intact pairs int GetNumberIntact(); //Get the broken basepair at index i basepair GetBroken(const int i); //Get the intact basepair at index i basepair GetIntact(const int i); //Set a new broken pair, with i paired to j and i<j //return true when it works, return false if i > j bool SetBroken(const int i, const int j); //Set a new intact pair, with i paired to j and i<j //return true when it works, return false if i > j bool SetIntact(const int i, const int j); //Sort nucleotides void Sort(); private: //store the broken pairs vector<basepair> broken; //store the intact pairs vector<basepair> intact; };
/* * Pseudoknot Class * Pseudoknot class stores and accesses pseudoknotted pairs. * Files with Pseudoknot class are: basepair.cpp, basepair.h, Pseudoknot.cpp, Pseudoknot.h * * (c) 2013 * Mathews Lab, University of Rochester Medical Center */ #include "IMPORT_0" #include <IMPORT_1> #include <IMPORT_2> CLASS_0 VAR_0 std; //Class to keep track of pairs in a pseudoknot //Pairs are in lists called broken and intact //where broken are those pairs removed by a breakpseudoknot routine //and intact are the crossing pairs to those from broken class Pseudoknot { public: //Empty constructor Pseudoknot(); //Return the number of broken pairs int GetNumberBroken(); //return the number of intact pairs int GetNumberIntact(); //Get the broken basepair at index i CLASS_1 FUNC_0(const int i); //Get the intact basepair at index i CLASS_1 GetIntact(const int i); //Set a new broken pair, with i paired to j and i<j //return true when it works, return false if i > j bool SetBroken(const int i, const int VAR_2); //Set a new intact pair, with i paired to j and i<j //return true when it works, return false if i > j bool FUNC_1(const int i, const int VAR_2); //Sort nucleotides void Sort(); private: //store the broken pairs IMPORT_1<VAR_1> broken; //store the intact pairs IMPORT_1<VAR_1> VAR_3; };
0.531977
{'IMPORT_0': 'basepair.h', 'IMPORT_1': 'vector', 'IMPORT_2': 'algorithm', 'CLASS_0': 'using', 'VAR_0': 'namespace', 'CLASS_1': 'basepair', 'VAR_1': 'basepair', 'FUNC_0': 'GetBroken', 'VAR_2': 'j', 'FUNC_1': 'SetIntact', 'VAR_3': 'intact'}
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <unistd.h> #include <qthread/qthread.h> #include "argparsing.h" static syncvar_t x = SYNCVAR_STATIC_INITIALIZER; static syncvar_t id = SYNCVAR_STATIC_INITIALIZER; static uint64_t readout = 0; static aligned_t consumer(void *arg) { uint64_t me; iprintf("consumer locking id(%p)\n", &id); qthread_syncvar_readFE(&me, &id); iprintf("consumer id's status became: %u\n", qthread_syncvar_status(&id)); iprintf("consumer unlocking id(%p), result is %lu\n", &id, (unsigned long)me); me++; qthread_syncvar_writeEF(&id, &me); iprintf("consumer readFF on x\n"); qthread_syncvar_readFF(&readout, &x); return 0; } static aligned_t producer(void *arg) { uint64_t me; uint64_t res = 55; iprintf("producer locking id(%p)\n", &id); qthread_syncvar_readFE(&me, &id); iprintf("producer unlocking id(%p), result is %lu\n", &id, (unsigned long)me); me++; qthread_syncvar_writeEF(&id, &me); iprintf("producer x's status is: %s (expect empty)\n", qthread_syncvar_status(&x) ? "full" : "empty"); iprintf("producer filling x(%p)\n", &x); qthread_syncvar_writeEF(&x, &res); return 0; } int main(int argc, char *argv[]) { aligned_t t; uint64_t x_value; assert(qthread_initialize() == 0); CHECK_VERBOSE(); iprintf("%i threads...\n", qthread_num_shepherds()); iprintf("Initial value of x: %lu\n", (unsigned long)x.u.w); qthread_syncvar_writeF_const(&id, 1); iprintf("id = 0x%lx\n", (unsigned long)id.u.w); { uint64_t tmp = 0; qthread_syncvar_readFF(&tmp, &id); assert(tmp == 1); } iprintf("x's status is: %s (want full (and nowait))\n", qthread_syncvar_status(&x) ? "full" : "empty"); assert(qthread_syncvar_status(&x) == 1); qthread_syncvar_readFE(NULL, &x); iprintf("x's status became: %s (want empty (and nowait))\n", qthread_syncvar_status(&x) ? "full" : "empty"); assert(qthread_syncvar_status(&x) == 0); qthread_fork(consumer, NULL, &t); qthread_fork(producer, NULL, NULL); qthread_readFF(NULL, &t); iprintf("shouldn't be blocking on x (current status: %s)\n", qthread_syncvar_status(&x) ? "full" : "empty"); qthread_syncvar_readFF(&x_value, &x); assert(qthread_syncvar_status(&x) == 1); if (x_value == 55) { iprintf("Success! x==55\n"); return 0; } else { fprintf(stderr, "Final value of x=%lu\n", (unsigned long)x_value); return -1; } } /* vim:set expandtab */
#include <IMPORT_0> #include <stdio.h> #include <IMPORT_1> #include <assert.h> #include <IMPORT_2> #include <IMPORT_3> #include "IMPORT_4" static syncvar_t VAR_0 = VAR_1; static syncvar_t VAR_2 = VAR_1; static uint64_t VAR_3 = 0; static CLASS_0 FUNC_0(void *arg) { uint64_t VAR_5; iprintf("consumer locking id(%p)\n", &VAR_2); FUNC_1(&VAR_5, &VAR_2); iprintf("consumer id's status became: %u\n", qthread_syncvar_status(&VAR_2)); iprintf("consumer unlocking id(%p), result is %lu\n", &VAR_2, (unsigned long)VAR_5); VAR_5++; qthread_syncvar_writeEF(&VAR_2, &VAR_5); iprintf("consumer readFF on x\n"); FUNC_2(&VAR_3, &VAR_0); return 0; } static CLASS_0 producer(void *arg) { uint64_t VAR_5; uint64_t VAR_6 = 55; iprintf("producer locking id(%p)\n", &VAR_2); FUNC_1(&VAR_5, &VAR_2); iprintf("producer unlocking id(%p), result is %lu\n", &VAR_2, (unsigned long)VAR_5); VAR_5++; qthread_syncvar_writeEF(&VAR_2, &VAR_5); iprintf("producer x's status is: %s (expect empty)\n", qthread_syncvar_status(&VAR_0) ? "full" : "empty"); iprintf("producer filling x(%p)\n", &VAR_0); qthread_syncvar_writeEF(&VAR_0, &VAR_6); return 0; } int FUNC_3(int VAR_7, char *VAR_8[]) { CLASS_0 t; uint64_t VAR_9; FUNC_4(FUNC_5() == 0); FUNC_6(); iprintf("%i threads...\n", FUNC_7()); iprintf("Initial value of x: %lu\n", (unsigned long)VAR_0.u.w); FUNC_8(&VAR_2, 1); iprintf("id = 0x%lx\n", (unsigned long)VAR_2.u.w); { uint64_t VAR_10 = 0; FUNC_2(&VAR_10, &VAR_2); FUNC_4(VAR_10 == 1); } iprintf("x's status is: %s (want full (and nowait))\n", qthread_syncvar_status(&VAR_0) ? "full" : "empty"); FUNC_4(qthread_syncvar_status(&VAR_0) == 1); FUNC_1(NULL, &VAR_0); iprintf("x's status became: %s (want empty (and nowait))\n", qthread_syncvar_status(&VAR_0) ? "full" : "empty"); FUNC_4(qthread_syncvar_status(&VAR_0) == 0); qthread_fork(VAR_4, NULL, &t); qthread_fork(producer, NULL, NULL); FUNC_9(NULL, &t); iprintf("shouldn't be blocking on x (current status: %s)\n", qthread_syncvar_status(&VAR_0) ? "full" : "empty"); FUNC_2(&VAR_9, &VAR_0); FUNC_4(qthread_syncvar_status(&VAR_0) == 1); if (VAR_9 == 55) { iprintf("Success! x==55\n"); return 0; } else { FUNC_10(stderr, "Final value of x=%lu\n", (unsigned long)VAR_9); return -1; } } /* vim:set expandtab */
0.452501
{'IMPORT_0': 'math.h', 'IMPORT_1': 'stdlib.h', 'IMPORT_2': 'unistd.h', 'IMPORT_3': 'qthread/qthread.h', 'IMPORT_4': 'argparsing.h', 'VAR_0': 'x', 'VAR_1': 'SYNCVAR_STATIC_INITIALIZER', 'VAR_2': 'id', 'VAR_3': 'readout', 'CLASS_0': 'aligned_t', 'FUNC_0': 'consumer', 'VAR_4': 'consumer', 'VAR_5': 'me', 'FUNC_1': 'qthread_syncvar_readFE', 'FUNC_2': 'qthread_syncvar_readFF', 'VAR_6': 'res', 'FUNC_3': 'main', 'VAR_7': 'argc', 'VAR_8': 'argv', 'VAR_9': 'x_value', 'FUNC_4': 'assert', 'FUNC_5': 'qthread_initialize', 'FUNC_6': 'CHECK_VERBOSE', 'FUNC_7': 'qthread_num_shepherds', 'FUNC_8': 'qthread_syncvar_writeF_const', 'VAR_10': 'tmp', 'FUNC_9': 'qthread_readFF', 'FUNC_10': 'fprintf'}
/** * @file main.c * @author <NAME> (<EMAIL>) * @brief Sample usage for gas sensor * @date 2021-10-06 * * @copyright Copyright (C) 2021 LION * * SPDX-License-Identifier: Apache-2.0 * */ #include <zephyr.h> #include <drivers/sensor.h> #include <drivers/sensor/mics4514.h> #define GAS_SENSOR DT_LABEL(DT_NODELABEL(gas_sensor)) void main(void) { const struct device *gas; int ret; gas = device_get_binding(GAS_SENSOR); if (gas == NULL) { printk("Error getting gas sensor device: %s\n", GAS_SENSOR); } while (1) { struct sensor_value co = {0}; struct sensor_value no2 = {0}; if (gas != NULL){ if ((ret = sensor_sample_fetch(gas)) != 0){ printk("gas sensor fetch error: %d\n", ret); } else{ sensor_channel_get(gas, SENSOR_CHAN_MICS4514_CO, &co); sensor_channel_get(gas, SENSOR_CHAN_MICS4514_NO2, &no2); } } printk("CO(ppm)=%d.%d, NO2(ppm)=%d.%d\n", co.val1, co.val2, no2.val1, no2.val2); k_msleep(1000); } }
/** * @file main.c * @author <NAME> (<EMAIL>) * @brief Sample usage for gas sensor * @date 2021-10-06 * * @copyright Copyright (C) 2021 LION * * SPDX-License-Identifier: Apache-2.0 * */ #include <IMPORT_0> #include <IMPORT_1> #include <IMPORT_2> #define VAR_0 DT_LABEL(DT_NODELABEL(gas_sensor)) void FUNC_0(void) { const struct CLASS_0 *VAR_1; int ret; VAR_1 = device_get_binding(VAR_0); if (VAR_1 == NULL) { printk("Error getting gas sensor device: %s\n", VAR_0); } while (1) { struct CLASS_1 VAR_2 = {0}; struct CLASS_1 VAR_3 = {0}; if (VAR_1 != NULL){ if ((ret = FUNC_1(VAR_1)) != 0){ printk("gas sensor fetch error: %d\n", ret); } else{ FUNC_2(VAR_1, SENSOR_CHAN_MICS4514_CO, &VAR_2); FUNC_2(VAR_1, VAR_4, &VAR_3); } } printk("CO(ppm)=%d.%d, NO2(ppm)=%d.%d\n", VAR_2.VAR_5, VAR_2.val2, VAR_3.VAR_5, VAR_3.val2); FUNC_3(1000); } }
0.650551
{'IMPORT_0': 'zephyr.h', 'IMPORT_1': 'drivers/sensor.h', 'IMPORT_2': 'drivers/sensor/mics4514.h', 'VAR_0': 'GAS_SENSOR', 'FUNC_0': 'main', 'CLASS_0': 'device', 'VAR_1': 'gas', 'CLASS_1': 'sensor_value', 'VAR_2': 'co', 'VAR_3': 'no2', 'FUNC_1': 'sensor_sample_fetch', 'FUNC_2': 'sensor_channel_get', 'VAR_4': 'SENSOR_CHAN_MICS4514_NO2', 'VAR_5': 'val1', 'FUNC_3': 'k_msleep'}
/** \brief This module implements the gnocl::scroll widget. \authors <NAME>, <NAME> \date 2009-12: */ /** \page page_scroll gnocl::scroll \htmlinclude scroll.html **/ /** \par Modification History \verbatim 2013-07: added commands, options, commands 2008-10: added command, class 2004-02: added -data 2003-09: added cget removed getValue 12: switched from GnoclWidgetOptions to GnoclOption 02: removed "invoke" 2002-01: new command "invoke" 2001-10: Begin of developement \endverbatim **/ /* * $Id: scroll.c,v 1.9 2005/01/01 15:27:54 baum Exp $ * * This file implements the scroll widget * * Copyright (c) 2001 - 2005 <NAME> http://www.dr-baum.net * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * */ #include "gnocl.h" //#include "gnoclparams.h" /* static function declarations */ static int optUpdatePolicy ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret ); static int setValue ( GtkScrollbar *scroll, double d ); static void changedFunc ( GtkWidget *widget, gpointer data ); /* compare with spinButton widget which is very similar */ GnoclOption scrollOptions[] = { { "-orientation", GNOCL_OBJ, NULL }, /* 0 */ { "-variable", GNOCL_STRING, NULL }, /* 1 */ { "-onValueChanged", GNOCL_STRING, NULL }, /* 2 */ { "-lower", GNOCL_DOUBLE, NULL }, /* 3 */ { "-upper", GNOCL_DOUBLE, NULL }, /* 4 */ { "-stepInc", GNOCL_DOUBLE, NULL }, /* 5 */ { "-pageInc", GNOCL_DOUBLE, NULL }, /* 6 */ { "-value", GNOCL_DOUBLE, NULL }, /* 7 */ { "-data", GNOCL_OBJ, "", gnoclOptData }, { "-digits", GNOCL_INT, "digits" }, { "-drawValue", GNOCL_BOOL, "draw-value" }, { "-hasFocus", GNOCL_BOOL, "has-focus" }, { "-inverted", GNOCL_BOOL, "inverted" }, { "-name", GNOCL_STRING, "name" }, { "-onRealize", GNOCL_OBJ, "realize", gnoclOptCommand }, { "-onShowHelp", GNOCL_OBJ, "", gnoclOptOnShowHelp }, { "-sensitive", GNOCL_BOOL, "sensitive" }, { "-tooltip", GNOCL_OBJ, "", gnoclOptTooltip }, { "-updatePolicy", GNOCL_OBJ, "update-policy", optUpdatePolicy }, { "-valuePos", GNOCL_OBJ, "value-pos", gnoclOptPosition }, { "-visible", GNOCL_BOOL, "visible" }, { NULL } }; static const int orientationIdx = 0; static const int variableIdx = 1; static const int onValueChangedIdx = 2; static const int lowerIdx = 3; static const int upperIdx = 4; static const int stepIncIdx = 5; static const int pageIncIdx = 6; static const int valueIdx = 7; /* moved to gnocl.h */ /* typedef struct { char *name; Tcl_Interp *interp; Gtkscroll *scroll; char *onValueChanged; char *variable; int inSetVar; } ScrollParams; */ /** \brief **/ static int optUpdatePolicy ( Tcl_Interp *interp, GnoclOption *opt, GObject *obj, Tcl_Obj **ret ) { const char *txt[] = { "continuous", "discontinuous", "delayed", NULL }; const int types[] = { GTK_UPDATE_CONTINUOUS, GTK_UPDATE_DISCONTINUOUS, GTK_UPDATE_DELAYED }; assert ( sizeof ( GTK_UPDATE_DELAYED ) == sizeof ( int ) ); return gnoclOptGeneric ( interp, opt, obj, "updatePolicy", txt, types, ret ); } /** \brief **/ static Tcl_Obj *getObjValue ( GtkScrollbar *scroll ) { GtkAdjustment *adjust = gtk_range_get_adjustment ( GTK_RANGE ( scroll ) ); double d = gtk_adjustment_get_value ( adjust ); /* scroll has no digits, only the scale */ /* if ( gtk_scroll_get_digits ( scroll ) < 1 ) return Tcl_NewIntObj ( ( int ) ( d + 0.5 ) ); */ return Tcl_NewDoubleObj ( d ); } /** \brief **/ static int doCommand ( ScrollParams *para, Tcl_Obj *val, int background ) { if ( para->onValueChanged ) { GnoclPercSubst ps[] = { { 'w', GNOCL_STRING }, /* widget */ { 'v', GNOCL_OBJ }, /* value */ { 0 } }; ps[0].val.str = para->name; ps[1].val.obj = val; return gnoclPercentSubstAndEval ( para->interp, ps, para->onValueChanged, background ); } return TCL_OK; } /** \brief **/ static int setValue ( GtkScrollbar *scroll, double d ) { GtkAdjustment *adjust = gtk_range_get_adjustment ( GTK_RANGE ( scroll ) ); int blocked = g_signal_handlers_block_matched ( G_OBJECT ( adjust ), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, ( gpointer * ) changedFunc, NULL ); gtk_adjustment_set_value ( adjust, d ); if ( blocked ) g_signal_handlers_unblock_matched ( G_OBJECT ( adjust ), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, ( gpointer * ) changedFunc, NULL ); return TCL_OK; } /** \brief **/ static char *traceFunc ( ClientData data, Tcl_Interp *interp, const char *name1, const char *name2, int flags ) { ScrollParams *para = ( ScrollParams * ) data; if ( para->inSetVar == 0 && name1 != NULL ) { Tcl_Obj *val = Tcl_GetVar2Ex ( interp, name1, name2, flags ); double d; if ( val && Tcl_GetDoubleFromObj ( NULL, val, &d ) == TCL_OK ) { setValue ( para->scroll, d ); doCommand ( para, getObjValue ( para->scroll ), 1 ); } } return NULL; } /** \brief **/ static void destroyFunc ( GtkWidget *widget, gpointer data ) { ScrollParams *para = ( ScrollParams * ) data; gnoclAttachOptCmdAndVar ( NULL, &para->onValueChanged, NULL, &para->variable, "value-changed", G_OBJECT ( gtk_range_get_adjustment ( GTK_RANGE ( para->scroll ) ) ), G_CALLBACK ( changedFunc ), para->interp, traceFunc, para ); gnoclForgetWidgetFromName ( para->name ); Tcl_DeleteCommand ( para->interp, para->name ); g_free ( para->name ); g_free ( para ); } /** \brief **/ static int setVariable ( ScrollParams *para, Tcl_Obj *val ) { if ( para->variable && para->inSetVar == 0 ) { Tcl_Obj *ret; para->inSetVar = 1; ret = Tcl_SetVar2Ex ( para->interp, para->variable, NULL, val, TCL_GLOBAL_ONLY ); para->inSetVar = 0; return ret == NULL ? TCL_ERROR : TCL_OK; } return TCL_OK; } /** \brief **/ static void changedFunc ( GtkWidget *widget, gpointer data ) { ScrollParams *para = ( ScrollParams * ) data; Tcl_Obj *val = getObjValue ( para->scroll ); setVariable ( para, val ); doCommand ( para, val, 1 ); } /** \brief **/ static int configure ( Tcl_Interp *interp, ScrollParams *para, GnoclOption options[] ) { #ifdef DEBUG printf ( "scroll configure\n" ); #endif int ret = TCL_ERROR; int setAdjust = 0; GtkAdjustment *adjust = gtk_range_get_adjustment ( GTK_RANGE ( para->scroll ) ); if ( gnoclSetOptions ( interp, options, G_OBJECT ( para->scroll ), -1 ) != TCL_OK ) goto cleanExit; gnoclAttachOptCmdAndVar ( options + onValueChangedIdx, &para->onValueChanged, options + variableIdx, &para->variable, "value-changed", G_OBJECT ( adjust ), G_CALLBACK ( changedFunc ), interp, traceFunc, para ); /* if variable is set, synchronize variable and widget */ if ( options[variableIdx].status == GNOCL_STATUS_CHANGED && para->variable != NULL && options[valueIdx].status != GNOCL_STATUS_CHANGED ) { Tcl_Obj *var = Tcl_GetVar2Ex ( interp, para->variable, NULL, TCL_GLOBAL_ONLY ); assert ( strcmp ( options[variableIdx].optName, "-variable" ) == 0 ); if ( var == NULL ) /* variable does not yet exist */ { setVariable ( para, getObjValue ( para->scroll ) ); } else { double d; if ( Tcl_GetDoubleFromObj ( interp, var, &d ) != TCL_OK ) goto cleanExit; setValue ( para->scroll, d ); } } if ( options[valueIdx].status == GNOCL_STATUS_CHANGED ) { assert ( strcmp ( options[valueIdx].optName, "-value" ) == 0 ); setValue ( para->scroll, options[valueIdx].val.d ); setVariable ( para, getObjValue ( para->scroll ) ); } if ( options[lowerIdx].status == GNOCL_STATUS_CHANGED ) { assert ( strcmp ( options[lowerIdx].optName, "-lower" ) == 0 ); adjust->lower = options[lowerIdx].val.d; setAdjust = 1; } if ( options[upperIdx].status == GNOCL_STATUS_CHANGED ) { assert ( strcmp ( options[upperIdx].optName, "-upper" ) == 0 ); adjust->upper = options[upperIdx].val.d; setAdjust = 1; } if ( options[stepIncIdx].status == GNOCL_STATUS_CHANGED ) { assert ( strcmp ( options[stepIncIdx].optName, "-stepInc" ) == 0 ); adjust->step_increment = options[stepIncIdx].val.d; setAdjust = 1; } if ( options[pageIncIdx].status == GNOCL_STATUS_CHANGED ) { assert ( strcmp ( options[pageIncIdx].optName, "-pageInc" ) == 0 ); adjust->page_increment = options[pageIncIdx].val.d; setAdjust = 1; } if ( setAdjust ) gtk_adjustment_changed ( adjust ); /* spinButtonTraceFunc( para, interp, para->variable, NULL, 0 ); */ ret = TCL_OK; cleanExit: return ret; } /** \brief **/ static int cget ( Tcl_Interp *interp, ScrollParams *para, GnoclOption options[], int idx ) { GtkAdjustment *adjust = gtk_range_get_adjustment ( GTK_RANGE ( para->scroll ) ); Tcl_Obj *obj = NULL; if ( idx == orientationIdx ) { if ( GTK_CHECK_TYPE ( para->scroll, GTK_TYPE_HSCROLLBAR ) ) obj = Tcl_NewStringObj ( "horizontal", -1 ); else obj = Tcl_NewStringObj ( "vertical", -1 ); } else if ( idx == variableIdx ) obj = Tcl_NewStringObj ( para->variable, -1 ); else if ( idx == onValueChangedIdx ) { obj = Tcl_NewStringObj ( para->onValueChanged ? para->onValueChanged : "", -1 ); } else if ( idx == lowerIdx ) obj = Tcl_NewDoubleObj ( adjust->lower ); else if ( idx == upperIdx ) obj = Tcl_NewDoubleObj ( adjust->upper ); else if ( idx == stepIncIdx ) obj = Tcl_NewDoubleObj ( adjust->step_increment ); else if ( idx == pageIncIdx ) obj = Tcl_NewDoubleObj ( adjust->page_increment ); else if ( idx == valueIdx ) obj = getObjValue ( para->scroll ); if ( obj != NULL ) { Tcl_SetObjResult ( interp, obj ); return TCL_OK; } return gnoclCgetNotImplemented ( interp, options + idx ); } static const char *cmds[] = { "delete", "configure", "cget", "onValueChanged", "class", NULL }; /** \brief **/ int scrollFunc ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] ) { enum cmdIdx { DeleteIdx, ConfigureIdx, CgetIdx, OnValueChangedIdx, ClassIdx }; ScrollParams *para = ( ScrollParams * ) data; GtkWidget *widget = GTK_WIDGET ( para->scroll ); int idx; if ( objc < 2 ) { Tcl_WrongNumArgs ( interp, 1, objv, "command" ); return TCL_ERROR; } if ( Tcl_GetIndexFromObj ( interp, objv[1], cmds, "command", TCL_EXACT, &idx ) != TCL_OK ) { return TCL_ERROR; } switch ( idx ) { case ClassIdx: Tcl_SetObjResult ( interp, Tcl_NewStringObj ( "scroll", -1 ) ); break; case DeleteIdx: return gnoclDelete ( interp, widget, objc, objv ); case ConfigureIdx: { int ret = TCL_ERROR; if ( gnoclParseOptions ( interp, objc - 1, objv + 1, scrollOptions ) == TCL_OK ) { ret = configure ( interp, para, scrollOptions ); } gnoclClearOptions ( scrollOptions ); return ret; } break; case CgetIdx: { int idx; switch ( gnoclCget ( interp, objc, objv, G_OBJECT ( para->scroll ), scrollOptions, &idx ) ) { case GNOCL_CGET_ERROR: return TCL_ERROR; case GNOCL_CGET_HANDLED: return TCL_OK; case GNOCL_CGET_NOTHANDLED: return cget ( interp, para, scrollOptions, idx ); } } case OnValueChangedIdx: { if ( objc != 2 ) { Tcl_WrongNumArgs ( interp, 2, objv, NULL ); return TCL_ERROR; } return doCommand ( para, getObjValue ( para->scroll ), 0 ); } } return TCL_OK; } /** \brief **/ int gnoclscrollCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] ) { if ( gnoclGetCmdsAndOpts ( interp, cmds, scrollOptions, objv, objc ) == TCL_OK ) { return TCL_OK; } GtkOrientation orient = GTK_ORIENTATION_VERTICAL; GtkAdjustment *adjust; ScrollParams *para; if ( gnoclParseOptions ( interp, objc, objv, scrollOptions ) != TCL_OK ) { gnoclClearOptions ( scrollOptions ); return TCL_ERROR; } if ( scrollOptions[orientationIdx].status == GNOCL_STATUS_CHANGED ) { if ( gnoclGetOrientationType ( interp, scrollOptions[orientationIdx].val.obj, &orient ) != TCL_OK ) { gnoclClearOptions ( scrollOptions ); return TCL_ERROR; } } para = g_new ( ScrollParams, 1 ); adjust = GTK_ADJUSTMENT ( gtk_adjustment_new ( 0, 0, 100, 1, 10, 0 ) ); if ( orient == GTK_ORIENTATION_HORIZONTAL ) para->scroll = GTK_SCROLLBAR ( gtk_hscrollbar_new ( adjust ) ); else para->scroll = GTK_SCROLLBAR ( gtk_vscrollbar_new ( adjust ) ); para->interp = interp; para->variable = NULL; para->onValueChanged = NULL; para->inSetVar = 0; gtk_widget_show ( GTK_WIDGET ( para->scroll ) ); if ( configure ( interp, para, scrollOptions ) != TCL_OK ) { g_free ( para ); gtk_widget_destroy ( GTK_WIDGET ( para->scroll ) ); return TCL_ERROR; } para->name = gnoclGetAutoWidgetId(); g_signal_connect ( G_OBJECT ( para->scroll ), "destroy", G_CALLBACK ( destroyFunc ), para ); gnoclMemNameAndWidget ( para->name, GTK_WIDGET ( para->scroll ) ); Tcl_CreateObjCommand ( interp, para->name, scrollFunc, para, NULL ); Tcl_SetObjResult ( interp, Tcl_NewStringObj ( para->name, -1 ) ); return TCL_OK; }
/** \brief This module implements the gnocl::scroll widget. \authors <NAME>, <NAME> \date 2009-12: */ /** \page page_scroll gnocl::scroll \htmlinclude scroll.html **/ /** \par Modification History \verbatim 2013-07: added commands, options, commands 2008-10: added command, class 2004-02: added -data 2003-09: added cget removed getValue 12: switched from GnoclWidgetOptions to GnoclOption 02: removed "invoke" 2002-01: new command "invoke" 2001-10: Begin of developement \endverbatim **/ /* * $Id: scroll.c,v 1.9 2005/01/01 15:27:54 baum Exp $ * * This file implements the scroll widget * * Copyright (c) 2001 - 2005 <NAME> http://www.dr-baum.net * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * */ #include "gnocl.h" //#include "gnoclparams.h" /* static function declarations */ static int optUpdatePolicy ( Tcl_Interp *interp, GnoclOption *VAR_0, GObject *obj, Tcl_Obj **VAR_1 ); static int setValue ( GtkScrollbar *scroll, double VAR_2 ); static void changedFunc ( GtkWidget *VAR_3, CLASS_0 data ); /* compare with spinButton widget which is very similar */ GnoclOption scrollOptions[] = { { "-orientation", GNOCL_OBJ, NULL }, /* 0 */ { "-variable", GNOCL_STRING, NULL }, /* 1 */ { "-onValueChanged", GNOCL_STRING, NULL }, /* 2 */ { "-lower", GNOCL_DOUBLE, NULL }, /* 3 */ { "-upper", GNOCL_DOUBLE, NULL }, /* 4 */ { "-stepInc", GNOCL_DOUBLE, NULL }, /* 5 */ { "-pageInc", GNOCL_DOUBLE, NULL }, /* 6 */ { "-value", GNOCL_DOUBLE, NULL }, /* 7 */ { "-data", GNOCL_OBJ, "", VAR_4 }, { "-digits", VAR_5, "digits" }, { "-drawValue", VAR_6, "draw-value" }, { "-hasFocus", VAR_6, "has-focus" }, { "-inverted", VAR_6, "inverted" }, { "-name", GNOCL_STRING, "name" }, { "-onRealize", GNOCL_OBJ, "realize", gnoclOptCommand }, { "-onShowHelp", GNOCL_OBJ, "", gnoclOptOnShowHelp }, { "-sensitive", VAR_6, "sensitive" }, { "-tooltip", GNOCL_OBJ, "", gnoclOptTooltip }, { "-updatePolicy", GNOCL_OBJ, "update-policy", optUpdatePolicy }, { "-valuePos", GNOCL_OBJ, "value-pos", VAR_7 }, { "-visible", VAR_6, "visible" }, { NULL } }; static const int orientationIdx = 0; static const int variableIdx = 1; static const int VAR_8 = 2; static const int lowerIdx = 3; static const int upperIdx = 4; static const int stepIncIdx = 5; static const int pageIncIdx = 6; static const int valueIdx = 7; /* moved to gnocl.h */ /* typedef struct { char *name; Tcl_Interp *interp; Gtkscroll *scroll; char *onValueChanged; char *variable; int inSetVar; } ScrollParams; */ /** \brief **/ static int optUpdatePolicy ( Tcl_Interp *interp, GnoclOption *VAR_0, GObject *obj, Tcl_Obj **VAR_1 ) { const char *txt[] = { "continuous", "discontinuous", "delayed", NULL }; const int VAR_9[] = { GTK_UPDATE_CONTINUOUS, GTK_UPDATE_DISCONTINUOUS, GTK_UPDATE_DELAYED }; assert ( sizeof ( GTK_UPDATE_DELAYED ) == sizeof ( int ) ); return FUNC_0 ( interp, VAR_0, obj, "updatePolicy", txt, VAR_9, VAR_1 ); } /** \brief **/ static Tcl_Obj *getObjValue ( GtkScrollbar *scroll ) { GtkAdjustment *adjust = FUNC_1 ( GTK_RANGE ( scroll ) ); double VAR_2 = gtk_adjustment_get_value ( adjust ); /* scroll has no digits, only the scale */ /* if ( gtk_scroll_get_digits ( scroll ) < 1 ) return Tcl_NewIntObj ( ( int ) ( d + 0.5 ) ); */ return Tcl_NewDoubleObj ( VAR_2 ); } /** \brief **/ static int doCommand ( ScrollParams *VAR_10, Tcl_Obj *val, int VAR_11 ) { if ( VAR_10->onValueChanged ) { CLASS_1 ps[] = { { 'w', GNOCL_STRING }, /* widget */ { 'v', GNOCL_OBJ }, /* value */ { 0 } }; ps[0].val.str = VAR_10->VAR_12; ps[1].val.obj = val; return gnoclPercentSubstAndEval ( VAR_10->interp, ps, VAR_10->onValueChanged, VAR_11 ); } return VAR_13; } /** \brief **/ static int setValue ( GtkScrollbar *scroll, double VAR_2 ) { GtkAdjustment *adjust = FUNC_1 ( GTK_RANGE ( scroll ) ); int blocked = g_signal_handlers_block_matched ( G_OBJECT ( adjust ), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, ( CLASS_0 * ) changedFunc, NULL ); gtk_adjustment_set_value ( adjust, VAR_2 ); if ( blocked ) g_signal_handlers_unblock_matched ( G_OBJECT ( adjust ), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, ( CLASS_0 * ) changedFunc, NULL ); return VAR_13; } /** \brief **/ static char *traceFunc ( ClientData data, Tcl_Interp *interp, const char *name1, const char *name2, int VAR_14 ) { ScrollParams *VAR_10 = ( ScrollParams * ) data; if ( VAR_10->inSetVar == 0 && name1 != NULL ) { Tcl_Obj *val = Tcl_GetVar2Ex ( interp, name1, name2, VAR_14 ); double VAR_2; if ( val && Tcl_GetDoubleFromObj ( NULL, val, &VAR_2 ) == VAR_13 ) { setValue ( VAR_10->scroll, VAR_2 ); doCommand ( VAR_10, getObjValue ( VAR_10->scroll ), 1 ); } } return NULL; } /** \brief **/ static void destroyFunc ( GtkWidget *VAR_3, CLASS_0 data ) { ScrollParams *VAR_10 = ( ScrollParams * ) data; gnoclAttachOptCmdAndVar ( NULL, &VAR_10->onValueChanged, NULL, &VAR_10->variable, "value-changed", G_OBJECT ( FUNC_1 ( GTK_RANGE ( VAR_10->scroll ) ) ), G_CALLBACK ( changedFunc ), VAR_10->interp, traceFunc, VAR_10 ); gnoclForgetWidgetFromName ( VAR_10->VAR_12 ); Tcl_DeleteCommand ( VAR_10->interp, VAR_10->VAR_12 ); g_free ( VAR_10->VAR_12 ); g_free ( VAR_10 ); } /** \brief **/ static int setVariable ( ScrollParams *VAR_10, Tcl_Obj *val ) { if ( VAR_10->variable && VAR_10->inSetVar == 0 ) { Tcl_Obj *VAR_1; VAR_10->inSetVar = 1; VAR_1 = FUNC_2 ( VAR_10->interp, VAR_10->variable, NULL, val, TCL_GLOBAL_ONLY ); VAR_10->inSetVar = 0; return VAR_1 == NULL ? TCL_ERROR : VAR_13; } return VAR_13; } /** \brief **/ static void changedFunc ( GtkWidget *VAR_3, CLASS_0 data ) { ScrollParams *VAR_10 = ( ScrollParams * ) data; Tcl_Obj *val = getObjValue ( VAR_10->scroll ); setVariable ( VAR_10, val ); doCommand ( VAR_10, val, 1 ); } /** \brief **/ static int FUNC_3 ( Tcl_Interp *interp, ScrollParams *VAR_10, GnoclOption options[] ) { #ifdef VAR_15 printf ( "scroll configure\n" ); #endif int VAR_1 = TCL_ERROR; int setAdjust = 0; GtkAdjustment *adjust = FUNC_1 ( GTK_RANGE ( VAR_10->scroll ) ); if ( gnoclSetOptions ( interp, options, G_OBJECT ( VAR_10->scroll ), -1 ) != VAR_13 ) goto cleanExit; gnoclAttachOptCmdAndVar ( options + VAR_8, &VAR_10->onValueChanged, options + variableIdx, &VAR_10->variable, "value-changed", G_OBJECT ( adjust ), G_CALLBACK ( changedFunc ), interp, traceFunc, VAR_10 ); /* if variable is set, synchronize variable and widget */ if ( options[variableIdx].VAR_16 == GNOCL_STATUS_CHANGED && VAR_10->variable != NULL && options[valueIdx].VAR_16 != GNOCL_STATUS_CHANGED ) { Tcl_Obj *var = Tcl_GetVar2Ex ( interp, VAR_10->variable, NULL, TCL_GLOBAL_ONLY ); assert ( FUNC_4 ( options[variableIdx].optName, "-variable" ) == 0 ); if ( var == NULL ) /* variable does not yet exist */ { setVariable ( VAR_10, getObjValue ( VAR_10->scroll ) ); } else { double VAR_2; if ( Tcl_GetDoubleFromObj ( interp, var, &VAR_2 ) != VAR_13 ) goto cleanExit; setValue ( VAR_10->scroll, VAR_2 ); } } if ( options[valueIdx].VAR_16 == GNOCL_STATUS_CHANGED ) { assert ( FUNC_4 ( options[valueIdx].optName, "-value" ) == 0 ); setValue ( VAR_10->scroll, options[valueIdx].val.VAR_2 ); setVariable ( VAR_10, getObjValue ( VAR_10->scroll ) ); } if ( options[lowerIdx].VAR_16 == GNOCL_STATUS_CHANGED ) { assert ( FUNC_4 ( options[lowerIdx].optName, "-lower" ) == 0 ); adjust->lower = options[lowerIdx].val.VAR_2; setAdjust = 1; } if ( options[upperIdx].VAR_16 == GNOCL_STATUS_CHANGED ) { assert ( FUNC_4 ( options[upperIdx].optName, "-upper" ) == 0 ); adjust->upper = options[upperIdx].val.VAR_2; setAdjust = 1; } if ( options[stepIncIdx].VAR_16 == GNOCL_STATUS_CHANGED ) { assert ( FUNC_4 ( options[stepIncIdx].optName, "-stepInc" ) == 0 ); adjust->step_increment = options[stepIncIdx].val.VAR_2; setAdjust = 1; } if ( options[pageIncIdx].VAR_16 == GNOCL_STATUS_CHANGED ) { assert ( FUNC_4 ( options[pageIncIdx].optName, "-pageInc" ) == 0 ); adjust->VAR_17 = options[pageIncIdx].val.VAR_2; setAdjust = 1; } if ( setAdjust ) FUNC_5 ( adjust ); /* spinButtonTraceFunc( para, interp, para->variable, NULL, 0 ); */ VAR_1 = VAR_13; cleanExit: return VAR_1; } /** \brief **/ static int cget ( Tcl_Interp *interp, ScrollParams *VAR_10, GnoclOption options[], int idx ) { GtkAdjustment *adjust = FUNC_1 ( GTK_RANGE ( VAR_10->scroll ) ); Tcl_Obj *obj = NULL; if ( idx == orientationIdx ) { if ( FUNC_6 ( VAR_10->scroll, GTK_TYPE_HSCROLLBAR ) ) obj = Tcl_NewStringObj ( "horizontal", -1 ); else obj = Tcl_NewStringObj ( "vertical", -1 ); } else if ( idx == variableIdx ) obj = Tcl_NewStringObj ( VAR_10->variable, -1 ); else if ( idx == VAR_8 ) { obj = Tcl_NewStringObj ( VAR_10->onValueChanged ? VAR_10->onValueChanged : "", -1 ); } else if ( idx == lowerIdx ) obj = Tcl_NewDoubleObj ( adjust->lower ); else if ( idx == upperIdx ) obj = Tcl_NewDoubleObj ( adjust->upper ); else if ( idx == stepIncIdx ) obj = Tcl_NewDoubleObj ( adjust->step_increment ); else if ( idx == pageIncIdx ) obj = Tcl_NewDoubleObj ( adjust->VAR_17 ); else if ( idx == valueIdx ) obj = getObjValue ( VAR_10->scroll ); if ( obj != NULL ) { Tcl_SetObjResult ( interp, obj ); return VAR_13; } return gnoclCgetNotImplemented ( interp, options + idx ); } static const char *cmds[] = { "delete", "configure", "cget", "onValueChanged", "class", NULL }; /** \brief **/ int scrollFunc ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const VAR_18[] ) { enum cmdIdx { DeleteIdx, ConfigureIdx, CgetIdx, OnValueChangedIdx, ClassIdx }; ScrollParams *VAR_10 = ( ScrollParams * ) data; GtkWidget *VAR_3 = GTK_WIDGET ( VAR_10->scroll ); int idx; if ( objc < 2 ) { Tcl_WrongNumArgs ( interp, 1, VAR_18, "command" ); return TCL_ERROR; } if ( Tcl_GetIndexFromObj ( interp, VAR_18[1], cmds, "command", VAR_19, &idx ) != VAR_13 ) { return TCL_ERROR; } switch ( idx ) { case ClassIdx: Tcl_SetObjResult ( interp, Tcl_NewStringObj ( "scroll", -1 ) ); break; case DeleteIdx: return gnoclDelete ( interp, VAR_3, objc, VAR_18 ); case ConfigureIdx: { int VAR_1 = TCL_ERROR; if ( FUNC_7 ( interp, objc - 1, VAR_18 + 1, scrollOptions ) == VAR_13 ) { VAR_1 = FUNC_3 ( interp, VAR_10, scrollOptions ); } gnoclClearOptions ( scrollOptions ); return VAR_1; } break; case CgetIdx: { int idx; switch ( gnoclCget ( interp, objc, VAR_18, G_OBJECT ( VAR_10->scroll ), scrollOptions, &idx ) ) { case GNOCL_CGET_ERROR: return TCL_ERROR; case VAR_20: return VAR_13; case GNOCL_CGET_NOTHANDLED: return cget ( interp, VAR_10, scrollOptions, idx ); } } case OnValueChangedIdx: { if ( objc != 2 ) { Tcl_WrongNumArgs ( interp, 2, VAR_18, NULL ); return TCL_ERROR; } return doCommand ( VAR_10, getObjValue ( VAR_10->scroll ), 0 ); } } return VAR_13; } /** \brief **/ int gnoclscrollCmd ( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const VAR_18[] ) { if ( FUNC_8 ( interp, cmds, scrollOptions, VAR_18, objc ) == VAR_13 ) { return VAR_13; } GtkOrientation orient = GTK_ORIENTATION_VERTICAL; GtkAdjustment *adjust; ScrollParams *VAR_10; if ( FUNC_7 ( interp, objc, VAR_18, scrollOptions ) != VAR_13 ) { gnoclClearOptions ( scrollOptions ); return TCL_ERROR; } if ( scrollOptions[orientationIdx].VAR_16 == GNOCL_STATUS_CHANGED ) { if ( FUNC_9 ( interp, scrollOptions[orientationIdx].val.obj, &orient ) != VAR_13 ) { gnoclClearOptions ( scrollOptions ); return TCL_ERROR; } } VAR_10 = g_new ( ScrollParams, 1 ); adjust = GTK_ADJUSTMENT ( FUNC_10 ( 0, 0, 100, 1, 10, 0 ) ); if ( orient == VAR_21 ) VAR_10->scroll = GTK_SCROLLBAR ( gtk_hscrollbar_new ( adjust ) ); else VAR_10->scroll = GTK_SCROLLBAR ( gtk_vscrollbar_new ( adjust ) ); VAR_10->interp = interp; VAR_10->variable = NULL; VAR_10->onValueChanged = NULL; VAR_10->inSetVar = 0; gtk_widget_show ( GTK_WIDGET ( VAR_10->scroll ) ); if ( FUNC_3 ( interp, VAR_10, scrollOptions ) != VAR_13 ) { g_free ( VAR_10 ); gtk_widget_destroy ( GTK_WIDGET ( VAR_10->scroll ) ); return TCL_ERROR; } VAR_10->VAR_12 = gnoclGetAutoWidgetId(); g_signal_connect ( G_OBJECT ( VAR_10->scroll ), "destroy", G_CALLBACK ( destroyFunc ), VAR_10 ); gnoclMemNameAndWidget ( VAR_10->VAR_12, GTK_WIDGET ( VAR_10->scroll ) ); Tcl_CreateObjCommand ( interp, VAR_10->VAR_12, scrollFunc, VAR_10, NULL ); Tcl_SetObjResult ( interp, Tcl_NewStringObj ( VAR_10->VAR_12, -1 ) ); return VAR_13; }
0.220204
{'VAR_0': 'opt', 'VAR_1': 'ret', 'VAR_2': 'd', 'VAR_3': 'widget', 'CLASS_0': 'gpointer', 'VAR_4': 'gnoclOptData', 'VAR_5': 'GNOCL_INT', 'VAR_6': 'GNOCL_BOOL', 'VAR_7': 'gnoclOptPosition', 'VAR_8': 'onValueChangedIdx', 'VAR_9': 'types', 'FUNC_0': 'gnoclOptGeneric', 'FUNC_1': 'gtk_range_get_adjustment', 'VAR_10': 'para', 'VAR_11': 'background', 'CLASS_1': 'GnoclPercSubst', 'VAR_12': 'name', 'VAR_13': 'TCL_OK', 'VAR_14': 'flags', 'FUNC_2': 'Tcl_SetVar2Ex', 'FUNC_3': 'configure', 'VAR_15': 'DEBUG', 'VAR_16': 'status', 'FUNC_4': 'strcmp', 'VAR_17': 'page_increment', 'FUNC_5': 'gtk_adjustment_changed', 'FUNC_6': 'GTK_CHECK_TYPE', 'VAR_18': 'objv', 'VAR_19': 'TCL_EXACT', 'FUNC_7': 'gnoclParseOptions', 'VAR_20': 'GNOCL_CGET_HANDLED', 'FUNC_8': 'gnoclGetCmdsAndOpts', 'FUNC_9': 'gnoclGetOrientationType', 'FUNC_10': 'gtk_adjustment_new', 'VAR_21': 'GTK_ORIENTATION_HORIZONTAL'}
#include <iostream> #include <utility> #include "tddFuncs.h" #include <map> #include <vector> #include <string> #include <cstring> // for http://en.cppreference.com/w/cpp/container/priority_queue #include <queue> using std::cout; using std::cerr; using std::endl; class WordItem { public: WordItem() : // Required to exist by WordHeap class, but should not be used count(-1), word("invalid"), metadata("default constructor for WordItem") {} WordItem( const int count, const std::string word, const std::string metadata ) : count(count), word(word), metadata(metadata) {} int count; std::string word; std::string metadata; bool operator()( const WordItem & lhs, const WordItem & rhs ) const { // Sort on count. Break ties with lexicographic order if (lhs.count != rhs.count) return (lhs.count < rhs.count); return lhs.word < rhs.word; } }; class WordHeap { public: WordHeap() {} void push( const WordItem & item ) { heap.push(item); } WordItem popMax() { WordItem item = heap.top(); heap.pop(); return item; } size_t size() { return heap.size(); } private: std::priority_queue<WordItem, std::vector<WordItem>,WordItem> heap; };
#include <IMPORT_0> #include <utility> #include "tddFuncs.h" #include <map> #include <vector> #include <string> #include <cstring> // for http://en.cppreference.com/w/cpp/container/priority_queue #include <queue> using std::cout; using std::cerr; using std::VAR_0; class WordItem { public: WordItem() : // Required to exist by WordHeap class, but should not be used count(-1), FUNC_0("invalid"), metadata("default constructor for WordItem") {} WordItem( const int count, const std::string VAR_1, const std::string metadata ) : count(count), FUNC_0(VAR_1), metadata(metadata) {} int count; std::string VAR_1; std::string metadata; bool operator()( const WordItem & lhs, const WordItem & rhs ) const { // Sort on count. Break ties with lexicographic order if (lhs.count != rhs.count) return (lhs.count < rhs.count); return lhs.VAR_1 < rhs.VAR_1; } }; class WordHeap { public: WordHeap() {} void push( const WordItem & item ) { heap.push(item); } WordItem popMax() { WordItem item = heap.top(); heap.FUNC_1(); return item; } size_t size() { return heap.size(); } private: std::priority_queue<WordItem, std::vector<WordItem>,WordItem> heap; };
0.074267
{'IMPORT_0': 'iostream', 'VAR_0': 'endl', 'FUNC_0': 'word', 'VAR_1': 'word', 'FUNC_1': 'pop'}
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #include <assert.h> #include <stdio.h> #include <sys/inotify.h> #include <unistd.h> int main(int argc, const char* argv[]) { int fd; int wd1; int wd2; int wd3; assert((fd = inotify_init1(0)) >= 0); assert((wd1 = inotify_add_watch(fd, "/", IN_ACCESS)) >= 0); assert((wd2 = inotify_add_watch(fd, "/", IN_ACCESS)) >= 0); assert(wd1 == wd2); assert((wd3 = inotify_add_watch(fd, "/tmp", IN_ACCESS)) >= 0); assert(wd1 != wd3); assert(inotify_rm_watch(fd, wd1) == 0); assert(inotify_rm_watch(fd, wd3) == 0); assert(close(fd) == 0); printf("=== passed test (%s)\n", argv[0]); return 0; }
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #include <IMPORT_0> #include <IMPORT_1> #include <IMPORT_2> #include <IMPORT_3> int main(int VAR_0, const char* VAR_1[]) { int VAR_2; int VAR_3; int VAR_4; int VAR_5; FUNC_0((VAR_2 = FUNC_1(0)) >= 0); FUNC_0((VAR_3 = FUNC_2(VAR_2, "/", VAR_6)) >= 0); FUNC_0((VAR_4 = FUNC_2(VAR_2, "/", VAR_6)) >= 0); FUNC_0(VAR_3 == VAR_4); FUNC_0((VAR_5 = FUNC_2(VAR_2, "/tmp", VAR_6)) >= 0); FUNC_0(VAR_3 != VAR_5); FUNC_0(FUNC_3(VAR_2, VAR_3) == 0); FUNC_0(FUNC_3(VAR_2, VAR_5) == 0); FUNC_0(FUNC_4(VAR_2) == 0); FUNC_5("=== passed test (%s)\n", VAR_1[0]); return 0; }
0.846372
{'IMPORT_0': 'assert.h', 'IMPORT_1': 'stdio.h', 'IMPORT_2': 'sys/inotify.h', 'IMPORT_3': 'unistd.h', 'VAR_0': 'argc', 'VAR_1': 'argv', 'VAR_2': 'fd', 'VAR_3': 'wd1', 'VAR_4': 'wd2', 'VAR_5': 'wd3', 'FUNC_0': 'assert', 'FUNC_1': 'inotify_init1', 'FUNC_2': 'inotify_add_watch', 'VAR_6': 'IN_ACCESS', 'FUNC_3': 'inotify_rm_watch', 'FUNC_4': 'close', 'FUNC_5': 'printf'}
// Original version from https://github.com/adafruit/Adafruit_NeoPixel // Modifications by dpgeorge to support auto-CPU-frequency detection // This is a mash-up of the Due show() code + insights from <NAME>'s // ESP8266 work for the NeoPixelBus library: github.com/Makuna/NeoPixelBus // Needs to be a separate .c file to enforce ICACHE_RAM_ATTR execution. #include "py/mpconfig.h" #if MICROPY_NEOPIXEL #include "py/mphal.h" #include "modesp.h" void IRAM_ATTR esp_neopixel_write(uint8_t pin, uint8_t *pixels, uint32_t numBytes, uint8_t timing) { uint8_t *p, *end, pix, mask; uint32_t t, time0, time1, period, c, startTime, pinMask; pinMask = 1 << pin; p = pixels; end = p + numBytes; pix = *p++; mask = 0x80; startTime = 0; uint32_t fcpu = ets_get_cpu_frequency() * 1000000; if (timing == 1) { // 800 KHz time0 = (fcpu * 0.35) / 1000000; // 0.35us time1 = (fcpu * 0.8) / 1000000; // 0.8us period = (fcpu * 1.25) / 1000000; // 1.25us per bit } else { // 400 KHz time0 = (fcpu * 0.5) / 1000000; // 0.35us time1 = (fcpu * 1.2) / 1000000; // 0.8us period = (fcpu * 2.5) / 1000000; // 1.25us per bit } uint32_t irq_state = mp_hal_quiet_timing_enter(); for (t = time0;; t = time0) { if (pix & mask) { t = time1; // Bit high duration } while (((c = mp_hal_ticks_cpu()) - startTime) < period) { ; // Wait for bit start } GPIO_REG_WRITE(GPIO_OUT_W1TS_REG, pinMask); // Set high startTime = c; // Save start time while (((c = mp_hal_ticks_cpu()) - startTime) < t) { ; // Wait high duration } GPIO_REG_WRITE(GPIO_OUT_W1TC_REG, pinMask); // Set low if (!(mask >>= 1)) { // Next bit/byte if (p >= end) { break; } pix = *p++; mask = 0x80; } } while ((mp_hal_ticks_cpu() - startTime) < period) { ; // Wait for last bit } mp_hal_quiet_timing_exit(irq_state); } #endif // MICROPY_NEOPIXEL
// Original version from https://github.com/adafruit/Adafruit_NeoPixel // Modifications by dpgeorge to support auto-CPU-frequency detection // This is a mash-up of the Due show() code + insights from <NAME>'s // ESP8266 work for the NeoPixelBus library: github.com/Makuna/NeoPixelBus // Needs to be a separate .c file to enforce ICACHE_RAM_ATTR execution. #include "IMPORT_0" #if MICROPY_NEOPIXEL #include "IMPORT_1" #include "IMPORT_2" void VAR_0 FUNC_0(uint8_t VAR_1, uint8_t *VAR_2, uint32_t VAR_3, uint8_t VAR_4) { uint8_t *p, *VAR_5, VAR_6, VAR_7; uint32_t VAR_8, time0, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13; VAR_13 = 1 << VAR_1; p = VAR_2; VAR_5 = p + VAR_3; VAR_6 = *p++; VAR_7 = 0x80; VAR_12 = 0; uint32_t VAR_14 = FUNC_1() * 1000000; if (VAR_4 == 1) { // 800 KHz time0 = (VAR_14 * 0.35) / 1000000; // 0.35us VAR_9 = (VAR_14 * 0.8) / 1000000; // 0.8us VAR_10 = (VAR_14 * 1.25) / 1000000; // 1.25us per bit } else { // 400 KHz time0 = (VAR_14 * 0.5) / 1000000; // 0.35us VAR_9 = (VAR_14 * 1.2) / 1000000; // 0.8us VAR_10 = (VAR_14 * 2.5) / 1000000; // 1.25us per bit } uint32_t VAR_15 = FUNC_2(); for (VAR_8 = time0;; VAR_8 = time0) { if (VAR_6 & VAR_7) { VAR_8 = VAR_9; // Bit high duration } while (((VAR_11 = mp_hal_ticks_cpu()) - VAR_12) < VAR_10) { ; // Wait for bit start } GPIO_REG_WRITE(VAR_16, VAR_13); // Set high VAR_12 = VAR_11; // Save start time while (((VAR_11 = mp_hal_ticks_cpu()) - VAR_12) < VAR_8) { ; // Wait high duration } GPIO_REG_WRITE(GPIO_OUT_W1TC_REG, VAR_13); // Set low if (!(VAR_7 >>= 1)) { // Next bit/byte if (p >= VAR_5) { break; } VAR_6 = *p++; VAR_7 = 0x80; } } while ((mp_hal_ticks_cpu() - VAR_12) < VAR_10) { ; // Wait for last bit } mp_hal_quiet_timing_exit(VAR_15); } #endif // MICROPY_NEOPIXEL
0.745984
{'IMPORT_0': 'py/mpconfig.h', 'IMPORT_1': 'py/mphal.h', 'IMPORT_2': 'modesp.h', 'VAR_0': 'IRAM_ATTR', 'FUNC_0': 'esp_neopixel_write', 'VAR_1': 'pin', 'VAR_2': 'pixels', 'VAR_3': 'numBytes', 'VAR_4': 'timing', 'VAR_5': 'end', 'VAR_6': 'pix', 'VAR_7': 'mask', 'VAR_8': 't', 'VAR_9': 'time1', 'VAR_10': 'period', 'VAR_11': 'c', 'VAR_12': 'startTime', 'VAR_13': 'pinMask', 'VAR_14': 'fcpu', 'FUNC_1': 'ets_get_cpu_frequency', 'VAR_15': 'irq_state', 'FUNC_2': 'mp_hal_quiet_timing_enter', 'VAR_16': 'GPIO_OUT_W1TS_REG'}
/* Netvideo version 3.2 Written by <NAME> <<EMAIL>> Common definitions */ /* * Copyright (c) Xerox Corporation 1992. All rights reserved. * * License is granted to copy, to use, and to make and to use derivative * works for research and evaluation purposes, provided that Xerox is * acknowledged in all documentation pertaining to any such copy or derivative * work. Xerox grants no other licenses expressed or implied. The Xerox trade * name should not be used in any advertising without its written permission. * * XEROX CORPORATION MAKES NO REPRESENTATIONS CONCERNING EITHER THE * MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE * FOR ANY PARTICULAR PURPOSE. The software is provided "as is" without * express or implied warranty of any kind. * * These notices must be retained in any copies of any part of this software. */ #define NV_DEFAULT_ADDR "192.168.3.11" #define NV_DEFAULT_PORT "4444" #define NV_ICON_WIDTH 96 #define NV_ICON_HEIGHT 72 #define NV_MIN_FLOW 32 /* Hack to distinguish new nv */ #define MAX_NAMELEN 64 #define MAX_VID_PACKLEN (1024-sizeof(struct rtphdr)) #define MAX_SOURCES 32 #define MAX_RECEIVERS 256 #define GRAB_ERROR_TIME 100 #define EST_FRAME_TIME 250 #define IDLEPOLL_TIME 1 #define NAME_XMIT_TIME 5 #define MAXIDLE_TIME 15 #define NOTIFY_TIME 60 #ifndef INADDR_LOOPBACK #define INADDR_LOOPBACK ((u_long)0x7f000001) #endif
/* Netvideo version 3.2 Written by <NAME> <<EMAIL>> Common definitions */ /* * Copyright (c) Xerox Corporation 1992. All rights reserved. * * License is granted to copy, to use, and to make and to use derivative * works for research and evaluation purposes, provided that Xerox is * acknowledged in all documentation pertaining to any such copy or derivative * work. Xerox grants no other licenses expressed or implied. The Xerox trade * name should not be used in any advertising without its written permission. * * XEROX CORPORATION MAKES NO REPRESENTATIONS CONCERNING EITHER THE * MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE * FOR ANY PARTICULAR PURPOSE. The software is provided "as is" without * express or implied warranty of any kind. * * These notices must be retained in any copies of any part of this software. */ #define VAR_0 "192.168.3.11" #define VAR_1 "4444" #define VAR_2 96 #define VAR_3 72 #define VAR_4 32 /* Hack to distinguish new nv */ #define VAR_5 64 #define VAR_6 (1024-sizeof(struct rtphdr)) #define VAR_7 32 #define VAR_8 256 #define VAR_9 100 #define VAR_10 250 #define VAR_11 1 #define VAR_12 5 #define VAR_13 15 #define VAR_14 60 #ifndef VAR_15 #define VAR_15 ((u_long)0x7f000001) #endif
0.94046
{'VAR_0': 'NV_DEFAULT_ADDR', 'VAR_1': 'NV_DEFAULT_PORT', 'VAR_2': 'NV_ICON_WIDTH', 'VAR_3': 'NV_ICON_HEIGHT', 'VAR_4': 'NV_MIN_FLOW', 'VAR_5': 'MAX_NAMELEN', 'VAR_6': 'MAX_VID_PACKLEN', 'VAR_7': 'MAX_SOURCES', 'VAR_8': 'MAX_RECEIVERS', 'VAR_9': 'GRAB_ERROR_TIME', 'VAR_10': 'EST_FRAME_TIME', 'VAR_11': 'IDLEPOLL_TIME', 'VAR_12': 'NAME_XMIT_TIME', 'VAR_13': 'MAXIDLE_TIME', 'VAR_14': 'NOTIFY_TIME', 'VAR_15': 'INADDR_LOOPBACK'}
/* Copyright 2015 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #import <Foundation/Foundation.h> #import "MatrixKit.h" #import "JSQMessages.h" /** `MXKSampleJSQMessageMediaData` is a connector between `MXKRoomBubbleCellData` data and the `JSQMessageMediaData` protocol required by JSQMessages in order to display media like images. */ @interface MXKSampleJSQMessageMediaData : NSObject <JSQMessageMediaData> /** Initialize a data connector to a `MXKRoomBubbleCellData` object. @param cellData the `MXKRoomBubbleCellData` object. @return the newly created instance. */ - (instancetype)initWithCellData:(MXKRoomBubbleCellData*)cellData; @end
/* Copyright 2015 OpenMarket Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #import <Foundation/Foundation.h> #import "MatrixKit.h" #import "JSQMessages.h" /** `MXKSampleJSQMessageMediaData` is a connector between `MXKRoomBubbleCellData` data and the `JSQMessageMediaData` protocol required by JSQMessages in order to display media like images. */ @CLASS_0 MXKSampleJSQMessageMediaData : NSObject <VAR_0> /** Initialize a data connector to a `MXKRoomBubbleCellData` object. @param cellData the `MXKRoomBubbleCellData` object. @return the newly created instance. */ - (ID_0)VAR_1:(VAR_2*)cellData; @end
0.50352
{'CLASS_0': 'interface', 'VAR_0': 'JSQMessageMediaData', 'ID_0': 'instancetype', 'VAR_1': 'initWithCellData', 'VAR_2': 'MXKRoomBubbleCellData'}
#ifndef C0P_PARAM_OBJECTS_SURFER__US_1O0__SURFTIMECONST_8O0__REORIENTATIONTIME_1O0_GROUP_HOMOGENEOUS_MEMBER_AGENT_BEHAVIOUR_NAVIGATOR_BEHAVIOUR_DIRECTION_SURF_CHOICE_H #define C0P_PARAM_OBJECTS_SURFER__US_1O0__SURFTIMECONST_8O0__REORIENTATIONTIME_1O0_GROUP_HOMOGENEOUS_MEMBER_AGENT_BEHAVIOUR_NAVIGATOR_BEHAVIOUR_DIRECTION_SURF_CHOICE_H #pragma once // THIS FILE SHOULD NOT BE EDITED DIRECTLY BY THE USERS. // THIS FILE WILL BE AUTOMATICALLY EDITED WHEN THE // CHOOSE COMMAND IS USED // behaviour time horizon choice #include "param/env/objects/surfer__us_1o0__surftimeconst_8o0__reorientationtime_1o0/group/homogeneous/_member/agent/_behaviour/navigator/_behaviour_direction/surf/_behaviour_time_horizon/choice.h" // choose your behaviour #include "core/env/objects/object/agent/behaviour/navigator/behaviour_direction/surf/exp/core.h" #include "param/env/objects/surfer__us_1o0__surftimeconst_8o0__reorientationtime_1o0/group/homogeneous/_member/agent/_behaviour/navigator/_behaviour_direction/surf/exp/parameters.h" namespace c0p { template<typename SurferUs1O0Surftimeconst8O0Reorientationtime1O0GroupHomogeneousMemberAgentActiveStep> using SurferUs1O0Surftimeconst8O0Reorientationtime1O0GroupHomogeneousMemberAgentBehaviourNavigatorBehaviourDirectionSurf = AgentBehaviourNavigatorBehaviourDirectionSurfExp<SurferUs1O0Surftimeconst8O0Reorientationtime1O0GroupHomogeneousMemberAgentBehaviourNavigatorBehaviourDirectionSurfExpParameters, SurferUs1O0Surftimeconst8O0Reorientationtime1O0GroupHomogeneousMemberAgentActiveStep, SurferUs1O0Surftimeconst8O0Reorientationtime1O0GroupHomogeneousMemberAgentBehaviourNavigatorBehaviourDirectionSurfBehaviourTimeHorizon<SurferUs1O0Surftimeconst8O0Reorientationtime1O0GroupHomogeneousMemberAgentActiveStep>>; } #endif
#ifndef VAR_0 #define VAR_0 #pragma once // THIS FILE SHOULD NOT BE EDITED DIRECTLY BY THE USERS. // THIS FILE WILL BE AUTOMATICALLY EDITED WHEN THE // CHOOSE COMMAND IS USED // behaviour time horizon choice #include "IMPORT_0" // choose your behaviour #include "IMPORT_1" #include "IMPORT_2" CLASS_0 VAR_1 { VAR_2<VAR_3 SurferUs1O0Surftimeconst8O0Reorientationtime1O0GroupHomogeneousMemberAgentActiveStep> using VAR_4 = VAR_5<VAR_6, SurferUs1O0Surftimeconst8O0Reorientationtime1O0GroupHomogeneousMemberAgentActiveStep, VAR_7<SurferUs1O0Surftimeconst8O0Reorientationtime1O0GroupHomogeneousMemberAgentActiveStep>>; } #endif
0.735929
{'VAR_0': 'C0P_PARAM_OBJECTS_SURFER__US_1O0__SURFTIMECONST_8O0__REORIENTATIONTIME_1O0_GROUP_HOMOGENEOUS_MEMBER_AGENT_BEHAVIOUR_NAVIGATOR_BEHAVIOUR_DIRECTION_SURF_CHOICE_H', 'IMPORT_0': 'param/env/objects/surfer__us_1o0__surftimeconst_8o0__reorientationtime_1o0/group/homogeneous/_member/agent/_behaviour/navigator/_behaviour_direction/surf/_behaviour_time_horizon/choice.h', 'IMPORT_1': 'core/env/objects/object/agent/behaviour/navigator/behaviour_direction/surf/exp/core.h', 'IMPORT_2': 'param/env/objects/surfer__us_1o0__surftimeconst_8o0__reorientationtime_1o0/group/homogeneous/_member/agent/_behaviour/navigator/_behaviour_direction/surf/exp/parameters.h', 'CLASS_0': 'namespace', 'VAR_1': 'c0p', 'VAR_2': 'template', 'VAR_3': 'typename', 'VAR_4': 'SurferUs1O0Surftimeconst8O0Reorientationtime1O0GroupHomogeneousMemberAgentBehaviourNavigatorBehaviourDirectionSurf', 'VAR_5': 'AgentBehaviourNavigatorBehaviourDirectionSurfExp', 'VAR_6': 'SurferUs1O0Surftimeconst8O0Reorientationtime1O0GroupHomogeneousMemberAgentBehaviourNavigatorBehaviourDirectionSurfExpParameters', 'VAR_7': 'SurferUs1O0Surftimeconst8O0Reorientationtime1O0GroupHomogeneousMemberAgentBehaviourNavigatorBehaviourDirectionSurfBehaviourTimeHorizon'}
// // Common.h // // // Created by <NAME> on 05/02/2015. // // // Common definitions etc. #ifndef GUARD_COMMON_H #define GUARD_COMMON_H //======================= MPI / Petsc HEADER FILES ===================== #include "mpi.h" #include "petscdmda.h" #include "petscsys.h" #include "petscksp.h" #include "petsctime.h" //======================= DEFINITIONS ================================= // SIGN function #define SIGN(x) ((x > 0) - (x < 0)) #define DOF_3D 3 // Number of degrees of freedom per node #define NUM_NEIGHBRS 27 // Max number of neighbours (element or nodes) #define NUM_TERMS 81 // DOF_3D x NUM_NEIGHBRS #define NODES_PER_ELEMENT 8 //======================== TYPEDEF UNITS ================================ typedef unsigned int xyzType; typedef unsigned int midxType; typedef uint64_t idxType; //======================= ENUMS ========================================= #endif /** (defined GUARD_COMMON_H) */
// // Common.h // // // Created by <NAME> on 05/02/2015. // // // Common definitions etc. #ifndef GUARD_COMMON_H #define GUARD_COMMON_H //======================= MPI / Petsc HEADER FILES ===================== #include "mpi.h" #include "petscdmda.h" #include "petscsys.h" #include "IMPORT_0" #include "IMPORT_1" //======================= DEFINITIONS ================================= // SIGN function #define FUNC_0(x) ((x > 0) - (x < 0)) #define DOF_3D 3 // Number of degrees of freedom per node #define VAR_0 27 // Max number of neighbours (element or nodes) #define VAR_1 81 // DOF_3D x NUM_NEIGHBRS #define NODES_PER_ELEMENT 8 //======================== TYPEDEF UNITS ================================ typedef unsigned int xyzType; typedef unsigned int ID_0; typedef uint64_t ID_1; //======================= ENUMS ========================================= #endif /** (defined GUARD_COMMON_H) */
0.444441
{'IMPORT_0': 'petscksp.h', 'IMPORT_1': 'petsctime.h', 'FUNC_0': 'SIGN', 'VAR_0': 'NUM_NEIGHBRS', 'VAR_1': 'NUM_TERMS', 'ID_0': 'midxType', 'ID_1': 'idxType'}
// // LFBaseEditingController.h // LFMediaEditingController // // Created by LamTsanFeng on 2017/6/9. // Copyright © 2017年 LamTsanFeng. All rights reserved. // #import <UIKit/UIKit.h> @interface LFBaseEditingController : UIViewController /** 是否隐藏状态栏 默认YES */ @property (nonatomic, assign) BOOL isHiddenStatusBar; /// 自定义外观颜色 @property (nonatomic, strong) UIColor *oKButtonTitleColorNormal; @property (nonatomic, strong) UIColor *cancelButtonTitleColorNormal; /// 自定义文字 @property (nonatomic, copy) NSString *oKButtonTitle __deprecated_msg("Property deprecated. Use `LFMediaEditingController.strings`"); @property (nonatomic, copy) NSString *cancelButtonTitle __deprecated_msg("Property deprecated. Use `LFMediaEditingController.strings`"); @property (nonatomic, copy) NSString *processHintStr __deprecated_msg("Property deprecated. Use `LFMediaEditingController.strings`"); //- (void)showProgressHUDText:(NSString *)text; - (void)showProgressHUD; - (void)hideProgressHUD; - (void)showProgressVideoHUD; - (void)setProgress:(float)progress; /** 初始化 */ - (instancetype)initWithOrientation:(UIInterfaceOrientation)orientation; @end
// // LFBaseEditingController.h // LFMediaEditingController // // Created by LamTsanFeng on 2017/6/9. // Copyright © 2017年 LamTsanFeng. All rights reserved. // #import <UIKit/UIKit.h> @interface VAR_0 : UIViewController /** 是否隐藏状态栏 默认YES */ @property (VAR_1, assign) CLASS_1 isHiddenStatusBar; /// 自定义外观颜色 @property (ID_0, VAR_2) UIColor *VAR_3; @property (ID_0, VAR_2) UIColor *VAR_4; /// 自定义文字 @property (ID_0, copy) VAR_5 *VAR_6 __deprecated_msg("Property VAR_7. Use `LFMediaEditingController.VAR_8`"); @property (CLASS_0, copy) CLASS_2 *cancelButtonTitle __deprecated_msg("Property VAR_7. Use `LFMediaEditingController.VAR_8`"); @property (CLASS_0, copy) CLASS_2 *processHintStr __deprecated_msg("Property VAR_7. Use `LFMediaEditingController.VAR_8`"); //- (void)showProgressHUDText:(NSString *)text; - (void)VAR_9; - (void)VAR_10; - (void)VAR_11; - (void)setProgress:(float)VAR_12; /** 初始化 */ - (CLASS_3)VAR_13:(UIInterfaceOrientation)VAR_14; @VAR_15
0.47536
{'VAR_0': 'LFBaseEditingController', 'VAR_1': 'nonatomic', 'ID_0': 'nonatomic', 'CLASS_0': 'nonatomic', 'CLASS_1': 'BOOL', 'VAR_2': 'strong', 'VAR_3': 'oKButtonTitleColorNormal', 'VAR_4': 'cancelButtonTitleColorNormal', 'VAR_5': 'NSString', 'CLASS_2': 'NSString', 'VAR_6': 'oKButtonTitle', 'VAR_7': 'deprecated', 'VAR_8': 'strings', 'VAR_9': 'showProgressHUD', 'VAR_10': 'hideProgressHUD', 'VAR_11': 'showProgressVideoHUD', 'VAR_12': 'progress', 'CLASS_3': 'instancetype', 'VAR_13': 'initWithOrientation', 'VAR_14': 'orientation', 'VAR_15': 'end'}
/**************************************************************************** * examples/bg96_task/bg96_task.c * * Copyright (C) 2008, 2011-2012 <NAME>. All rights reserved. * Author: <NAME> <<EMAIL>> * * 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. * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER 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. * ****************************************************************************/ /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <termios.h> #include <time.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/select.h> #include <sys/ioctl.h> #include <fcntl.h> #include <syslog.h> #include <errno.h> #include <sys/time.h> #include <unistd.h> #include <arpa/inet.h> #include <arch/board/boardctl.h> #include <nuttx/crypto/blake2s.h> #include <nuttx/ioexpander/gpio.h> #include <nuttx/leds/tca6507.h> #include "gpsutils/minmea.h" #include "libadc.h" #include "libserial.h" #include "configuration.h" #include "misc.h" #define BUFSIZE 1024 static char buffer[BUFSIZE]; static int gps_reset_count = 0; #ifndef max # define max(a,b) (((a) > (b)) ? (a) : (b)) #endif typedef enum urc { URC_CLOSED = 1, URC_RECEIVED, URC_INCOING_FULL, URC_CONNECTED, URC_DEACTIVATED, } urc_t; struct urc_closed { int connect_id; }; struct urc_received { int connect_id; }; struct urc_deactivated { int context_id; }; struct urc_info { urc_t code; union { struct urc_closed closed; struct urc_received received; struct urc_deactivated deactivated; } info; }; typedef enum task_state { STAT_SETUP = 1, STAT_IDLE, STAT_MEASURE, STAT_CONNECT, STAT_UPLOAD, STAT_WAIT_RESPONSE, STAT_RECEIVE_RESPONSE, STAT_DISCONNECT, } task_state_t; typedef struct xg50_stat { char iccid[20]; uint16_t id; uint16_t valid; int16_t rssi; int16_t rsrq; int16_t rsrp; int16_t sinr; uint8_t antenna; uint8_t area; uint8_t attach; uint16_t battery; struct tm tm; int lat; int lon; } xg50_stat_t; #define NSOCKS 12 typedef struct bg96_state_t { int sockets[NSOCKS]; } bg96_state_t; typedef struct { serial_t *ser; serial_t *ser_gps; config_t config; struct xg50_stat info; int led_found; int sock_idx; uint16_t interval; task_state_t state; } task_t; /**************************************************************************** * Private Data ****************************************************************************/ static bg96_state_t _bg96_state; static int fd_led; /**************************************************************************** * External Functions ****************************************************************************/ extern int up_rtc_getdatetime_with_subseconds(FAR struct tm *tp, FAR long *nsec); extern unsigned char *base64_encode(const unsigned char *src, size_t len, unsigned char *dst, size_t *out_len); /**************************************************************************** * Private Functions ****************************************************************************/ static int chop(char *buf) { char *ptr; int count = 0; if (strlen(buf) <= 1) return 0; for (ptr = buf + strlen(buf) - 1; *ptr == '\r' || *ptr == '\n'; ptr--) { *ptr = '\0'; count++; } return count; } /**************************************************************************** * LED ON/OFF ****************************************************************************/ static void led_onoff(int idx, int onoff) { struct tca6507_onoff_s set; switch (idx) { case 0: set.led = LED_STATUS1_RED; break; case 1: set.led = LED_STATUS1_GREEN; break; case 2: set.led = LED_STATUS2_RED; break; case 3: set.led = LED_STATUS2_GREEN; break; case 4: set.led = LED_STATUS3_RED; break; case 5: set.led = LED_STATUS3_GREEN; break; default: return; } set.on = (onoff == 0) ? 0 : 1; ioctl(fd_led, LEDIOC_ONOFF, (intptr_t) &set); } /**************************************************************************** * Name: [BG96] Reset BG96 module ****************************************************************************/ static void bg96_reset(void) { boardctl(BIOC_RESET_B2B, 500); } /**************************************************************************** * Name: [BG96] Send AT command ****************************************************************************/ int bg96_send_AT_command(serial_t *ser, const char *cmd) { int res; //printf("** %s: write %s", __FUNCTION__, cmd); if (cmd) { if (ser_write(ser, cmd, strlen(cmd)) < 0) { printf("! %s: write failed, %s", __FUNCTION__, cmd); return -1; } } /* wait for 'OK' or 'ERROR' */ while (1) { memset(buffer, 0, 128); res = ser_readline(ser, buffer, 128, '\n', 3000); if (res <= 0) { printf("! %s: read timeouted.\n", __FUNCTION__); return -1; } chop(buffer); //printf("* %s: received: \"%s\"\n", __FUNCTION__, buffer); if (strlen(buffer) <= 0) continue; if (strncmp(buffer, "OK", 2) == 0) { res = 0; break; } else if (strncmp(buffer, "ERROR", 5) == 0) { res = -1; break; } } return res; } /**************************************************************************** * Name: [BG96] Signal Level ****************************************************************************/ static int bg96_get_qcsq(serial_t *ser, int16_t *rssi, int16_t *rsrq, int16_t *rsrp, int16_t *sinr) { int res; int v[4]; char buf[128], buf2[16], service[10]; *rsrq = *rsrp = *sinr = 0; sprintf(buf, "AT+QCSQ\r\n"); sprintf(buf2, "+QCSQ: "); if (ser_write(ser, buf, strlen(buf)) < 0) { return -1; } /* wait for 'OK' */ while (1) { res = ser_readline(ser, buf, 128, '\n', 1000); if (res <= 0) { res = -1; break; } chop(buf); if (strncmp(buf, buf2, strlen(buf2)) == 0) { res = sscanf(buf, "+QCSQ: \"%[A-Z1-]\",%d,%d,%d,%d", service, &v[0], &v[1], &v[2], &v[3]); if (res != 5) { printf("! %s: parse +QCSQ result failed, res: %d %s (\"%s\").\n", __FUNCTION__, res, service, buf); res = -1; } else { printf("* %s: buf: %s -->\n Service: %s, RSSI: %d," \ " RSRQ: %d, RSRP: %d, SINR: %d\n", __FUNCTION__, buf, service, v[0], v[3], v[1], v[2]); *rssi = (int16_t) v[0]; *rsrq = (int16_t) v[3]; *rsrp = (int16_t) v[1]; *sinr = (int16_t) v[2]; res = 0; } } else if (strncmp(buf, "OK", 2) == 0) { printf("* %s: 'OK' received.\n", __FUNCTION__); break; } } return res; } /**************************************************************************** * Name: [BG96] TCP/IP接続パラメータ設定 ****************************************************************************/ static int bg96_echo_off(serial_t *ser) { int res, retry = 3; while (retry--) { res = bg96_send_AT_command(ser, "ATE0\r\n"); if (res != 0) { printf("! %s: ATE0 failed (retry left: %d).\n", __FUNCTION__, retry); sleep(1); } else { break; } } res = bg96_send_AT_command(ser, "AT+QISDE=0\r\n"); return res; } /**************************************************************************** * Name: [BG96] TCP/IP接続パラメータ設定 ****************************************************************************/ static int bg96_setup_apn(serial_t *ser, int cid, char *apn, char *user, char *password) { int res, need_setup = 1; char buf2[64]; memset(buffer, 0, BUFSIZE); sprintf(buffer, "AT+QICSGP=1\r\n"); sprintf(buf2, "+QICSGP: %d,\"%s\",\"%s\",\"%s\",3", cid, apn, user, password); res = ser_write(ser, buffer, strlen(buffer)); chop(buffer); //printf("* %s: write '%s' -> %d\n", __FUNCTION__, buffer, res); if (res < 0) { syslog(LOG_ERR, "! %s: ser_write(\"%s\") failed -> RESET\n", __FUNCTION__, buffer); sleep(2); bg96_reset(); return -1; } /* wait for 'OK' */ while (1) { res = ser_readline(ser, buffer, 128, '\n', 5000); if (res <= 0) { syslog(LOG_ERR, "! %s: receive timeouted.\n", __FUNCTION__); res = -1; break; } chop(buffer); if (strlen(buffer) <= 0) continue; //printf("* %s: received: %s\n", __FUNCTION__, buffer); if (strncmp(buffer, buf2, strlen(buf2)) == 0) { //printf("* %s: received: \"%s\" (%d)\n", __FUNCTION__, // buffer, res); printf("* %s: do not need to setup APN\n", __FUNCTION__); need_setup = 0; } else if (strstr(buffer, "OK")) { //printf("* %s: 'OK' received.\n", __FUNCTION__); res = 0; break; } } if (res < 0 || need_setup == 0) { return res; } sprintf(buffer, "AT+QICSGP=%d,1,\"%s\",\"%s\",\"%s\",3\r\n", cid, apn, user, password); //printf("* write: '%s'\n", buffer); if (ser_write(ser, buffer, strlen(buffer)) < 0) { syslog(LOG_ERR, "!%s: ser_write(\"%s\") failed -> RESET\n", __FUNCTION__, buffer); sleep(2); bg96_reset(); return -1; } /* wait for 'OK' */ while (1) { res = ser_readline(ser, buffer, 128, '\n', 5000); if (res <= 0) { res = -1; break; } else if (strncmp(buffer, "OK", 2) == 0) { //printf("* %s: 'OK' received.\n", __FUNCTION__); res = 0; break; } } return res; } /**************************************************************************** * Name: [BG96] Check Connection Status ****************************************************************************/ static int bg96_get_connection_status(serial_t *ser) { int res; int connected = -1; const char * const res_connected = "+QIACT:"; sprintf(buffer, "AT+QIACT?\r\n"); //printf(" cmd: %s", buffer); if (ser_write(ser, buffer, strlen(buffer)) < 0) { printf("! %s: write failed.\n", __FUNCTION__); return -1; } /* wait for '+QIACT' */ while (1) { res = ser_readline(ser, buffer, 128, '\n', 30000); if (res <= 0) { printf("! read timeouted.\n"); break; } chop(buffer); //printf("* %s: received: \"%s\"\n", __FUNCTION__, buffer); if (strstr(buffer, res_connected)) { printf("* %s: stat: connected (\"%s\")\n", __FUNCTION__, buffer); connected = 0; } else if (strstr(buffer, "OK")) { //printf("* %s: 'OK' received.\n", __FUNCTION__); break; } else if (strncmp(buffer, "ERROR", 5) == 0) { //printf("! %s: 'ERROR' received.\n", __FUNCTION__); break; } } return connected; } /**************************************************************************** * Name: [BG96] Connect ****************************************************************************/ static int bg96_connect(serial_t *ser) { int res; res = bg96_get_connection_status(ser); if (res == 0) { /* already connected. */ return 0; } sprintf(buffer, "AT+QIACT=1\r\n"); printf(" cmd: %s", buffer); if (bg96_send_AT_command(ser, buffer) < 0) { printf("! %s: write failed.\n", __FUNCTION__); return -1; } return bg96_get_connection_status(ser); } /**************************************************************************** * Name: [BG96] Disconnect ****************************************************************************/ static int bg96_disconnect(serial_t *ser) { int res; res = bg96_get_connection_status(ser); if (res == -1) { /* already disconnected. */ return 0; } sprintf(buffer, "AT+QIDEACT=1\r\n"); printf(" cmd: %s", buffer); if (ser_write(ser, buffer, strlen(buffer)) < 0) { printf("! %s: write failed.\n", __FUNCTION__); return -1; } res = bg96_get_connection_status(ser); return (res == -1) ? 0 : -1; } /**************************************************************************** * Name: [BG96] Open TCP socket ****************************************************************************/ static int bg96_connect_tcp_udp(serial_t *ser, bool tcp, const char *host, uint16_t dest_port) { int i, res, stat, err = -1, idx = -1; const char *res_connected = "+QIOPEN:"; /* search for free socket index. */ for (i = 0; i < NSOCKS; i++) { if (_bg96_state.sockets[i] == 0) { idx = i; break; } } if (idx == -1) { printf("! %s: no free sockets.\n", __FUNCTION__); return -1; } sprintf(buffer, "AT+QIOPEN=1,%d,\"%s\",\"%s\",%d,0,0\r\n", idx, (tcp ? "TCP" : "UDP"), host, dest_port); if (ser_write(ser, buffer, strlen(buffer)) < 0) { printf("! %s: write failed.\n", __FUNCTION__); return -1; } /* wait for '+QIOPEN:' */ while (1) { res = ser_readline(ser, buffer, 128, '\n', 30000); if (res <= 0) { printf("! %s: read timeouted.\n", __FUNCTION__); break; } chop(buffer); if (strstr(buffer, res_connected)) { res = sscanf(buffer, "+QIOPEN: %d,%d", &stat, &err); if (res != 2) { printf("! %s: parse +QIOPEN result failed (%d).\n", __FUNCTION__, res); } else if (err == 0) { printf("* %s: connected (%s).\n", __FUNCTION__, (tcp ? "TCP" : "UDP")); _bg96_state.sockets[i] = 1; err = idx; } else { printf("! %s: connect failed (%d).\n", __FUNCTION__, err); _bg96_state.sockets[i] = 0; err = -err; } break; } } return err; } /**************************************************************************** * Name: [BG96] Open TCP socket ****************************************************************************/ static int bg96_connect_tcp(serial_t *ser, const char *host, uint16_t dest_port) { return bg96_connect_tcp_udp(ser, true, host, dest_port); } /**************************************************************************** * Name: [BG96] Open UDP socket ****************************************************************************/ static int bg96_connect_udp(serial_t *ser, const char *host, uint16_t dest_port) { return bg96_connect_tcp_udp(ser, false, host, dest_port); } /**************************************************************************** * Name: [BG96] Close TCP socket ****************************************************************************/ static int bg96_disconnect_tcp_udp(serial_t *ser, int idx) { int res; if (_bg96_state.sockets[idx] == 0) { /* not opened. */ return 0; } sprintf(buffer, "AT+QICLOSE=%d\r\n", idx); res = bg96_send_AT_command(ser, buffer); if (res < 0) { printf("! %s: close socket failed.\n", __FUNCTION__); } _bg96_state.sockets[idx] = 0; return 0; } /**************************************************************************** * Name: [BG96] Close TCP socket ****************************************************************************/ static int bg96_disconnect_tcp(serial_t *ser, int idx) { return bg96_disconnect_tcp_udp(ser, idx); } /**************************************************************************** * Name: [BG96] Close UDP socket ****************************************************************************/ static int bg96_disconnect_udp(serial_t *ser, int idx) { return bg96_disconnect_tcp_udp(ser, idx); } /**************************************************************************** * Name: [BG96] TCP/UDP send ****************************************************************************/ static int bg96_send_tcp(serial_t *ser, int sock, const char *wbuf, int buflen) { int res, writelen = 0; sprintf(buffer, "AT+QISEND=%d,%d\r\n", sock, buflen); if (ser_write(ser, buffer, strlen(buffer)) < 0) { printf("! %s: write failed.\n", __FUNCTION__); return -1; } /* wait for '>' */ while (1) { res = ser_read(ser, buffer, 1, 1000); if (res <= 0) { printf("! %s: read timeouted.\n", __FUNCTION__); return -1; } buffer[1] = '\0'; //printf("* %s: received: 0x%02x\n", __FUNCTION__, buffer[0]); if (buffer[0] == '>') { while (writelen < buflen) { res = ser_write(ser, wbuf + writelen, buflen - writelen); if (res <= 0) { printf("! %s: ser_write() failed.\n", __FUNCTION__); return -1; } writelen += res; } break; } } /* wait for result */ /* wait for '+QIOPEN:' */ while (1) { res = ser_readline(ser, buffer, 128, '\n', 30000); if (res <= 0) { printf("! %s: read timeouted.\n", __FUNCTION__); return -1; } chop(buffer); //printf("* %s: received: \"%s\"\n", __FUNCTION__, buffer); if (strstr(buffer, "SEND OK")) { printf(" -> send succeeded.\n"); break; } else if (strstr(buffer, "SEND FAIL")) { printf(" -> send failed.\n"); return -1; } else if (strstr(buffer, "ERROR")) { printf(" -> send error.\n"); return -1; } } printf("---> writelen: %d\n", writelen); return writelen; } /**************************************************************************** * Name: [BG96] polling URC ****************************************************************************/ static int bg96_handle_URC(serial_t *ser, struct urc_info *urc) { int res, code; char report[16]; /* wait for '+QIURC:' */ while (1) { res = ser_readline(ser, buffer, 256, '\n', 2000); if (res <= 0) { printf("! %s: read timeouted.\n", __FUNCTION__); return -1; } chop(buffer); if (strlen(buffer) > 0) { printf("* %s: received: \"%s\"\n", __FUNCTION__, buffer); } if (strstr(buffer, "+QIURC:")) { res = sscanf(buffer, "+QIURC: \"%[a-z]\",%d", &report, &code); if (res != 2) { printf("! %s: parse +QIURC result failed (%d), '%s'.\n", __FUNCTION__, res, report); return -1; } break; } } /* classify URC */ res = 0; if (strstr(report, "closed")) { urc->code = URC_CLOSED; urc->info.closed.connect_id = code; } else if (strstr(report, "recv")) { urc->code = URC_RECEIVED; urc->info.received.connect_id = code; } else if (strstr(report, "pdpdeact")) { urc->code = URC_DEACTIVATED; urc->info.deactivated.context_id = code; } else { /* ??? */ printf("! %s: unhandled URC received, \"%s\"\n", __FUNCTION__, report); res = -1; } return res; } /**************************************************************************** * Name: [BG96] TCP recv ****************************************************************************/ static int bg96_recv_tcp(serial_t *ser, int sock, char *rbuf, int buflen) { int res, restlen, readlen; sprintf(buffer, "AT+QIRD=0\r\n", sock, buflen); printf(" cmd: %s", buffer); if (ser_write(ser, buffer, strlen(buffer)) < 0) { printf("! %s: write failed.\n", __FUNCTION__); return -1; } /* wait for '+QIRD:' */ while (1) { res = ser_readline(ser, buffer, 128, '\n', 5000); if (res <= 0) { printf("! read timeouted.\n"); return -1; } chop(buffer); if (strlen(buffer) > 0) { printf("* %s: received: \"%s\"\n", __FUNCTION__, buffer); } if (strstr(buffer, "+QIRD:")) { res = sscanf(buffer, "+QIRD: %d", &restlen); if (res != 1) { printf("! %s: parse +QIRD result failed (%d).\n", __FUNCTION__, res); return -1; } readlen = ser_read(ser, rbuf, restlen, 3000); break; } } return readlen; } /**************************************************************************** * Name: [BG96] CCLK (get network clock) ****************************************************************************/ static int bg96_sync_clock(serial_t *ser) { int res, tz_offset, result = -1; struct tm now; time_t time_now; struct timeval tv; const char * const res_cclk = "+CCLK:"; sprintf(buffer, "AT+CCLK?\r\n"); if (ser_write(ser, buffer, strlen(buffer)) < 0) { printf("! %s: write failed.\n", __FUNCTION__); return -1; } /* wait for '+CCLK' response */ while (1) { res = ser_readline(ser, buffer, 128, '\n', 3000); if (res <= 0) { printf("! %s: read timeouted.\n", __FUNCTION__); return -1; } chop(buffer); //printf("* %s: received: '%s'\n", __FUNCTION__, buffer); if (strncmp(buffer, res_cclk, strlen(res_cclk)) == 0) { memset(&now, 0, sizeof(struct tm)); res = sscanf(buffer, "+CCLK: \"%02d/%02d/%02d,%02d:%02d:%02d+%02d\"", &now.tm_year, &now.tm_mon, &now.tm_mday, &now.tm_hour, &now.tm_min, &now.tm_sec, &tz_offset); if (res != 7) { printf("! %s: parse +CCLK result failed (%s -> %d).\n", __FUNCTION__, buffer, res); return -1; } printf("* %s: response: '%s'\n", __FUNCTION__, buffer); tz_offset /= 4; now.tm_year += 100; now.tm_mon -= 1; now.tm_hour += tz_offset; time_now = mktime(&now); printf("* %s: now: %d\n", __FUNCTION__, time_now); if (now.tm_year < 140) { syslog(LOG_INFO, "* %s: valid +CCLK response (%s)\n", __FUNCTION__, buffer); tv.tv_sec = time_now; tv.tv_usec = 0; settimeofday(&tv, NULL); result = 0; } else { printf("! %s: invalid +CCLK response (%s)\n", __FUNCTION__, buffer); } } else if (strstr(buffer, "OK")) { //printf("* %s: 'OK' received.\n", __FUNCTION__); break; } } return result; } /**************************************************************************** * Name: [BG96] get ICCID ****************************************************************************/ static int bg96_get_iccid(serial_t *ser, char *iccid) { int res, len, result = -1; const char *cmd = "AT+CCID\r\n"; const char *fmt = "+CCID: %s"; char _iccid[20]; res = ser_write(ser, cmd, strlen(cmd)); if (res < 0) { return -1; } /* wait for 'OK' */ while (1) { memset(buffer, 0, 128); res = ser_readline(ser, buffer, 128, '\n', 2000); if (res <= 0) { break; } else { if (strstr(buffer, "+CCID:")) { res = sscanf(buffer, fmt, &_iccid); if (res == 1) { len = strlen(_iccid); if (_iccid[len - 1] == 'F') { _iccid[len - 1] = '\0'; len--; } printf("* %s: ICCID: %s\n", __FUNCTION__, _iccid); if (len > 0) { strncpy(iccid, _iccid, len); result = 0; } } } else if (strstr(buffer, "OK")) { break; } } } return result; } /**************************************************************************** * Name: gen_payload ****************************************************************************/ static int gen_payload(struct xg50_stat *stat, char *buf) { int len; int coeff = 10000000; int lat_min, lon_min, lat_sec, lon_sec; lat_min = stat->lat / coeff; lat_sec = stat->lat % coeff; lat_sec /= 6; lon_min = stat->lon / coeff; lon_sec = stat->lon % coeff; lon_sec /= 6; len = sprintf(buf, "{\"lat\" : %d.%06d, \"lon\" : %d.%06d," \ " \"rssi\" : %d, \"rsrq\" : %d, \"rsrp\" : %d," \ " \"sinr\" : %d, \"battery\" : %d}", lat_min, lat_sec, lon_min, lon_sec, stat->rssi, stat->rsrq, stat->rsrp, stat->sinr, stat->battery); return len; } /**************************************************************************** * Name: initialize swtich gpio ****************************************************************************/ static int init_switch(task_t *task) { int fd, res; fd = open("/dev/gpout0", O_RDWR); if (fd < 0) { printf("! open GPOUT failed.\n"); return -1; } res = ioctl(fd, GPIOC_WRITE, (unsigned long) 0); close(fd); if (res < 0) { printf("! write GPIO failed.\n"); return -1; } return 0; } /**************************************************************************** * Name: wait for switch ****************************************************************************/ static int wait_switch(struct tm *tm_deadline) { int res, fd, value; struct tm tm_now; long nsec; time_t now, deadline; fd = open("/dev/gpin0", O_RDONLY); if (fd < 0) { printf("! open GPIN failed.\n"); return -1; } deadline = mktime(tm_deadline); while (1) { up_rtc_getdatetime_with_subseconds(&tm_now, &nsec); now = mktime(&tm_now); if (now >= deadline) { res = 0; break; } res = ioctl(fd, GPIOC_READ, (unsigned long)((uintptr_t) &value)); if (value == 0) { printf("### Switch ON detected!\n"); res = 1; break; } else { usleep(50 * 1000); } } close(fd); return res; } /**************************************************************************** * Name: Enable GPS ****************************************************************************/ static int bg96_enable_gps(serial_t *ser) { int res; if ((res = bg96_send_AT_command(ser, "AT+QGPSEND\r\n")) != 0) { printf("! %s: AT+QGPSEND failed.\n", __FUNCTION__); } if ((res = bg96_send_AT_command(ser, "AT+QGPS=1\r\n")) != 0) { printf("! %s: AT+QGPS=1 failed.\n", __FUNCTION__); return res; } if ((res = bg96_send_AT_command(ser, "AT+QGPSCFG=\"nmeasrc\",1\r\n")) != 0) { printf("! %s: AT+QGPSCFG=\"nmeasrc\",1 failed.\n", __FUNCTION__); } else { printf("* %s: Acquisition of NMEA via command succeeded.\n", __FUNCTION__); } return res; } /**************************************************************************** * Name: Get GPS location info ****************************************************************************/ static int bg96_get_gps_location(serial_t *ser, int *lat, int *lon) { int res; bool result; const char *nmearmc = "AT+QGPSGNMEA=\"RMC\"\r\n"; char rmc_buf[128]; struct minmea_sentence_rmc frame; rmc_buf[0] = '\0'; res = ser_write(ser, nmearmc, strlen(nmearmc)); if (res < 0) { printf("! write command failed.\n"); return -2; } while (1) { res = ser_readline(ser, buffer, 256, '\n', 1000); if (res > 0) { buffer[res] = '\0'; if (strncmp(buffer, "+QGPS", 5) == 0) { chop(buffer); strncpy(rmc_buf, &buffer[12], strlen(buffer) - 12); } } else { break; } if (strncmp(buffer, "OK", 2) == 0) { break; } } if (rmc_buf[0] == '\0') { syslog(LOG_ERR, "! %s: GPS read timeouted (%d).\n", __FUNCTION__, gps_reset_count); return -2; } printf("RMC: \"%s\"\n", rmc_buf); result = minmea_parse_rmc(&frame, (const char *) &rmc_buf); if (result == true && frame.valid) { struct timespec ts; struct timeval tv; *lat = minmea_rescale(&frame.latitude, 100000); *lon = minmea_rescale(&frame.longitude, 100000); printf("Fixed-point Latitude...........: %10d\n", *lat); printf("Fixed-point Longitude..........: %10d\n", *lon); minmea_gettime(&ts, &frame.date, &frame.time); printf("timestamp......................: %10d\n", ts.tv_sec); printf("GPS Reset count................: %10d\n", gps_reset_count); tv.tv_sec = ts.tv_sec + 9 * 60 * 60; tv.tv_usec = ts.tv_nsec / NSEC_PER_USEC; settimeofday(&tv, NULL); led_onoff(5, 1); led_onoff(4, 0); res = 0; } else { led_onoff(5, 0); led_onoff(4, 1); res = -1; } return res; } /**************************************************************************** * Name: Handler (SETUP) ****************************************************************************/ static task_state_t setup_bg96(task_t *task) { int res; config_t *config; struct xg50_stat *bg96; config = &task->config; bg96 = &task->info; bg96->id = config->id; bg96->valid = 0; /* STATUS2: RED */ led_onoff(3, 0); led_onoff(2, 1); res = bg96_echo_off(task->ser); if (res < 0) { printf("! %s: echo off failed.\n", __FUNCTION__); sleep(5); return STAT_SETUP; } res = bg96_setup_apn(task->ser, 1, config->apn, config->user, config->password); if (res < 0) { printf("! %s: setup_apn failed.\n", __FUNCTION__); sleep(5); return STAT_SETUP; } while (1) { res = bg96_enable_gps(task->ser); if (res == 0) { break; } sleep(5); } bg96_send_AT_command(task->ser, "AT+CFUN=4\r\n"); sleep(2); bg96_send_AT_command(task->ser, "AT+CFUN=1\r\n"); sleep(1); bg96_send_AT_command(task->ser, "AT+CGATT?\r\n"); sleep(1); res = bg96_get_iccid(task->ser, bg96->iccid); if (res < 0) { printf("! %s: get_iccid failed.\n", __FUNCTION__); sleep(5); return STAT_SETUP; } /* STATUS2: GREEN */ led_onoff(2, 0); led_onoff(3, 1); printf("* %s: ICCID: %s\n", __FUNCTION__, bg96->iccid); while (1) { res = bg96_sync_clock(task->ser); if (res == 0) { led_onoff(0, 0); led_onoff(1, 1); return STAT_IDLE; } led_onoff(0, 1); led_onoff(1, 0); sleep(5); } } /**************************************************************************** * Name: Handler (IDLE) ****************************************************************************/ static task_state_t wait_next_measurement_time(task_t *task) { struct tm tm, next_tm; time_t now, next; long nsec, sleeptime; useconds_t usec; uint16_t interval; up_rtc_getdatetime_with_subseconds(&tm, &nsec); now = mktime(&tm); interval = task->interval; if (interval < 10) { interval = 10; } next = ((now + 1 + interval) / interval) * interval; localtime_r(&next, &next_tm); sleeptime = (next - now) * 1000 - (nsec / 1000000); if (sleeptime < 0) { sleeptime = 0; } if (sleeptime > 0) { usec = sleeptime * 1000; printf("--- %s: next: %04d/%02d/%02d %02d:%02d:%02d -> " "sleep %d [msec] (%lu [usec])\n", __FUNCTION__, next_tm.tm_year + 1900, next_tm.tm_mon + 1, next_tm.tm_mday, next_tm.tm_hour, next_tm.tm_min, next_tm.tm_sec, sleeptime, usec); wait_switch(&next_tm); /* wakeup! */ up_rtc_getdatetime_with_subseconds(&tm, &nsec); now = mktime(&tm); localtime_r(&now, &next_tm); printf("--- %s: wakeup: %04d/%02d/%02d %02d:%02d:%02d\n", __FUNCTION__, next_tm.tm_year + 1900, next_tm.tm_mon + 1, next_tm.tm_mday, next_tm.tm_hour, next_tm.tm_min, next_tm.tm_sec); } return STAT_MEASURE; } /**************************************************************************** * Name: Handler (MEASURE) ****************************************************************************/ static task_state_t measurement(task_t *task) { struct xg50_stat *info = &task->info; int res, lat, lon; bg96_get_qcsq(task->ser, &info->rssi, &info->rsrq, &info->rsrp, &info->sinr); sleep(1); res = bg96_get_gps_location(task->ser, &lat, &lon); if (res == -2) { int idx; task->interval = 10; for (idx = 0; idx < 6; idx++) { led_onoff(idx, 0); } bg96_reset(); sleep(5); gps_reset_count++; return STAT_SETUP; } else if (res == -1) { task->interval = 10; return STAT_IDLE; } else { task->interval = 60; task->info.lat = lat; task->info.lon = lon; get_battery_level(&info->battery); return STAT_CONNECT; } } /**************************************************************************** * Name: Handler (CONNECT) ****************************************************************************/ static task_state_t connect_bg96(task_t *task) { int res; config_t *config; /* activate PDP context */ res = bg96_connect(task->ser); if (res < 0) { printf("! %s: Activate PDP context failed -> RESET\n", __FUNCTION__); sleep(2); bg96_reset(); return STAT_IDLE; } /* open socket */ config = &task->config; printf("* %s: try to connect to %s:%d ...\n", __FUNCTION__, config->host, config->port); res = bg96_connect_udp(task->ser, config->host, config->port); if (res < 0) { printf("! %s: open socket failed -> RESET\n", __FUNCTION__); bg96_disconnect(task->ser); sleep(2); bg96_reset(); return STAT_IDLE; } printf("* connected.\n"); task->sock_idx = res; return STAT_UPLOAD; } /**************************************************************************** * Name: Handler (UPLOAD) ****************************************************************************/ task_state_t upload_data(task_t *task) { int len, res; struct xg50_stat *stat = &task->info; char sendbuf[256]; len = gen_payload(stat, sendbuf); printf("* %s: payload '%s' (length: %d)\n", __FUNCTION__, sendbuf, len); res = bg96_send_tcp(task->ser, task->sock_idx, (const char *) sendbuf, len); if (res > 0) { printf(" -> send_tcp: %d bytes.\n", res); } return STAT_WAIT_RESPONSE; } /**************************************************************************** * Name: Handler (WAIT_RESPONSE) ****************************************************************************/ task_state_t wait_response(task_t *task) { int res, retry = 1; struct urc_info urc; task_state_t next = STAT_DISCONNECT; while (retry) { res = bg96_handle_URC(task->ser, &urc); if (res < 0) { /* timeouted ? */ break; } switch (urc.code) { case URC_CLOSED: next = STAT_DISCONNECT; retry = 0; break; case URC_DEACTIVATED: next = STAT_SETUP; retry = 0; break; case URC_RECEIVED: printf("* %s: packet received.\n", __FUNCTION__); next = STAT_RECEIVE_RESPONSE; retry = 0; break; default: break; } } return next; } /**************************************************************************** * Name: Handler (RECEIVE_RESPONSE) ****************************************************************************/ task_state_t receive_response(task_t *task) { int readlen; readlen = bg96_recv_tcp(task->ser, task->sock_idx, buffer, BUFSIZE); if (readlen < 0) { printf("! %s: TCP receive failed.\n", __FUNCTION__); return STAT_DISCONNECT; } return STAT_DISCONNECT; } /**************************************************************************** * Name: Handler (DISCONNECT) ****************************************************************************/ static task_state_t disconnect_bg96(task_t *task) { printf("---- %s start...\n", __FUNCTION__); bg96_disconnect_tcp(task->ser, task->sock_idx); bg96_disconnect(task->ser); return STAT_IDLE; } /**************************************************************************** * Name: ****************************************************************************/ static int mainloop(task_t *task) { task_state_t next; while (1) { switch (task->state) { case STAT_SETUP: printf("@@@@@ BG96: %s: STAT_SETUP\n", __FUNCTION__); next = setup_bg96(task); break; case STAT_IDLE: printf("@@@@@ BG96: %s: STAT_IDLE\n", __FUNCTION__); next = wait_next_measurement_time(task); break; case STAT_MEASURE: printf("@@@@@ BG96: %s: STAT_MEASURE\n", __FUNCTION__); next = measurement(task); break; case STAT_CONNECT: printf("@@@@@ BG96: %s: STAT_CONNECT\n", __FUNCTION__); next = connect_bg96(task); break; case STAT_UPLOAD: printf("@@@@@ BG96: %s: STAT_UPLOAD\n", __FUNCTION__); next = upload_data(task); break; case STAT_WAIT_RESPONSE: printf("@@@@@ BG96: %s: STAT_WAIT_RESPONSE\n", __FUNCTION__); next = wait_response(task); break; case STAT_RECEIVE_RESPONSE: printf("@@@@@ BG96: %s: STAT_RECEIVE_RESPONSE\n", __FUNCTION__); next = receive_response(task); break; case STAT_DISCONNECT: printf("@@@@@ BG96: %s: STAT_DISCONNECT\n", __FUNCTION__); next = disconnect_bg96(task); break; default: printf("@@@@@ BG96: %s: DEFAULT -> STAT_IDLE\n", __FUNCTION__); next = STAT_IDLE; break; } task->state = next; } return 0; } /**************************************************************************** * Name: task initialize ****************************************************************************/ static task_t *init_task(void) { task_t *task; char *bg96_path = "/dev/ttyS2"; char *gps_path = "/dev/ttyS1"; if (!(task = zalloc(sizeof(task_t)))) { return NULL; } load_config(&task->config); if (task->config.valid != 1) { strcpy(task->config.apn, "soracom.io"); strcpy(task->config.user, "sora"); strcpy(task->config.password, "<PASSWORD>"); strcpy(task->config.host, "harvest.soracom.io"); task->config.port = 8514; } printf("=== BG96 configurations ===\n"); printf(" * APN: %s\n", task->config.apn); printf(" * user: %s\n", task->config.user); printf(" * passowrd: %s\n", task->config.password); printf(" * host: %s\n", task->config.host); printf(" * port: %d\n", task->config.port); task->ser = serial_open(bg96_path, 115200, 0); task->ser_gps = serial_open(gps_path, 115200, 0); task->state = STAT_SETUP; init_switch(task); if ((find_i2c_device(I2C_ADDR_TCA6507) == 0) && (find_i2c_device(I2C_ADDR_PCA9534) == 0)) { task->led_found = 1; fd_led = open("/dev/leddrv0", O_RDONLY); } sleep(1); return task; } /**************************************************************************** * Name: boot task ****************************************************************************/ static int boot_main(int argc, char **argv) { task_t *task = init_task(); if (!task) { return -1; } return mainloop(task); } /**************************************************************************** * Name: setting or boot task ****************************************************************************/ static int select_mode(int argc, char **argv) { int sw_state; boardctl(BIOC_GET_LEDSW, (uintptr_t) &sw_state); if (sw_state == 0) { /* configuration mode */ return configuration(argc, argv); } return boot_main(argc, argv); } /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** * serial_relay_main ****************************************************************************/ #ifdef CONFIG_BUILD_KERNEL int main(int argc, FAR char *argv[]) #else int bg96_main(int argc, char *argv[]) #endif { return select_mode(argc, argv); }
/**************************************************************************** * examples/bg96_task/bg96_task.c * * Copyright (C) 2008, 2011-2012 <NAME>. All rights reserved. * Author: <NAME> <<EMAIL>> * * 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. * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER 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. * ****************************************************************************/ /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> #include <IMPORT_23> #include <IMPORT_24> #include <IMPORT_25> #include <IMPORT_26> #include <IMPORT_27> #include <IMPORT_28> #include <IMPORT_29> #include <sys/select.h> #include <IMPORT_30> #include <IMPORT_31> #include <syslog.h> #include <IMPORT_32> #include <sys/time.h> #include <IMPORT_33> #include <IMPORT_34> #include <IMPORT_35> #include <IMPORT_36> #include <nuttx/ioexpander/gpio.h> #include <IMPORT_37> #include "gpsutils/minmea.h" #include "libadc.h" #include "IMPORT_38" #include "configuration.h" #include "misc.h" #define VAR_151 1024 static char buffer[VAR_151]; static int gps_reset_count = 0; #ifndef VAR_152 # define FUNC_0(VAR_153,b) (((a) > (b)) ? (a) : (b)) #endif typedef enum CLASS_20 { URC_CLOSED = 1, URC_RECEIVED, URC_INCOING_FULL, URC_CONNECTED, URC_DEACTIVATED, } urc_t; struct urc_closed { int VAR_155; }; struct urc_received { int VAR_155; }; struct urc_deactivated { int VAR_156; }; struct urc_info { urc_t code; union { struct urc_closed closed; struct urc_received received; struct urc_deactivated VAR_157; } VAR_158; }; typedef enum task_state { VAR_159 = 1, STAT_IDLE, VAR_160, VAR_161, VAR_162, STAT_WAIT_RESPONSE, VAR_163, VAR_164, } task_state_t; typedef struct CLASS_21 { char VAR_165[20]; uint16_t id; uint16_t valid; int16_t rssi; int16_t VAR_166; int16_t VAR_167; int16_t VAR_168; uint8_t antenna; uint8_t area; uint8_t VAR_169; uint16_t battery; struct tm tm; int lat; int VAR_170; } ID_6; #define NSOCKS 12 typedef struct CLASS_22 { int sockets[NSOCKS]; } ID_7; typedef struct { serial_t *VAR_171; serial_t *VAR_172; config_t config; struct CLASS_21 VAR_158; int VAR_173; int VAR_174; uint16_t VAR_175; task_state_t VAR_176; } task_t; /**************************************************************************** * Private Data ****************************************************************************/ static CLASS_22 _bg96_state; static int fd_led; /**************************************************************************** * External Functions ****************************************************************************/ extern int up_rtc_getdatetime_with_subseconds(FAR VAR_177 tm *tp, FAR long *nsec); extern unsigned char *base64_encode(const unsigned char *VAR_178, size_t len, unsigned char *dst, size_t *out_len); /**************************************************************************** * Private Functions ****************************************************************************/ static int FUNC_3(char *buf) { char *ptr; int count = 0; if (FUNC_4(buf) <= 1) return 0; for (ptr = buf + FUNC_4(buf) - 1; *ptr == '\r' || *ptr == '\n'; ptr--) { *ptr = '\0'; count++; } return count; } /**************************************************************************** * LED ON/OFF ****************************************************************************/ static void led_onoff(int VAR_179, int VAR_180) { struct CLASS_23 set; switch (VAR_179) { case 0: set.led = LED_STATUS1_RED; break; case 1: set.led = LED_STATUS1_GREEN; break; case 2: set.led = LED_STATUS2_RED; break; case 3: set.led = LED_STATUS2_GREEN; break; case 4: set.led = LED_STATUS3_RED; break; case 5: set.led = VAR_181; break; default: return; } set.VAR_182 = (VAR_180 == 0) ? 0 : 1; ioctl(fd_led, LEDIOC_ONOFF, (intptr_t) &set); } /**************************************************************************** * Name: [BG96] Reset BG96 module ****************************************************************************/ static void bg96_reset(void) { boardctl(VAR_183, 500); } /**************************************************************************** * Name: [BG96] Send AT command ****************************************************************************/ int FUNC_9(serial_t *VAR_171, const char *VAR_184) { int res; //printf("** %s: write %s", __FUNCTION__, cmd); if (VAR_184) { if (ser_write(VAR_171, VAR_184, FUNC_4(VAR_184)) < 0) { FUNC_11("! %s: write failed, %s", __FUNCTION__, VAR_184); return -1; } } /* wait for 'OK' or 'ERROR' */ while (1) { memset(buffer, 0, 128); res = ser_readline(VAR_171, buffer, 128, '\n', 3000); if (res <= 0) { FUNC_11("! %s: read timeouted.\n", __FUNCTION__); return -1; } FUNC_3(buffer); //printf("* %s: received: \"%s\"\n", __FUNCTION__, buffer); if (FUNC_4(buffer) <= 0) continue; if (strncmp(buffer, "OK", 2) == 0) { res = 0; break; } else if (strncmp(buffer, "ERROR", 5) == 0) { res = -1; break; } } return res; } /**************************************************************************** * Name: [BG96] Signal Level ****************************************************************************/ static int FUNC_14(serial_t *VAR_171, int16_t *rssi, int16_t *VAR_166, int16_t *VAR_167, int16_t *VAR_168) { int res; int v[4]; char buf[128], VAR_185[16], VAR_186[10]; *VAR_166 = *VAR_167 = *VAR_168 = 0; sprintf(buf, "AT+QCSQ\r\n"); sprintf(VAR_185, "+QCSQ: "); if (ser_write(VAR_171, buf, FUNC_4(buf)) < 0) { return -1; } /* wait for 'OK' */ while (1) { res = ser_readline(VAR_171, buf, 128, '\n', 1000); if (res <= 0) { res = -1; break; } FUNC_3(buf); if (strncmp(buf, VAR_185, FUNC_4(VAR_185)) == 0) { res = FUNC_16(buf, "+QCSQ: \"%[A-Z1-]\",%d,%d,%d,%d", VAR_186, &v[0], &v[1], &v[2], &v[3]); if (res != 5) { FUNC_11("! %s: parse +QCSQ result failed, res: %d %s (\"%s\").\n", __FUNCTION__, res, VAR_186, buf); res = -1; } else { FUNC_11("* %s: buf: %s -->\n Service: %s, RSSI: %d," \ " RSRQ: %d, RSRP: %d, SINR: %d\n", __FUNCTION__, buf, VAR_186, v[0], v[3], v[1], v[2]); *rssi = (int16_t) v[0]; *VAR_166 = (int16_t) v[3]; *VAR_167 = (int16_t) v[1]; *VAR_168 = (int16_t) v[2]; res = 0; } } else if (strncmp(buf, "OK", 2) == 0) { FUNC_11("* %s: 'OK' received.\n", __FUNCTION__); break; } } return res; } /**************************************************************************** * Name: [BG96] TCP/IP接続パラメータ設定 ****************************************************************************/ static int FUNC_17(serial_t *VAR_171) { int res, VAR_187 = 3; while (VAR_187--) { res = FUNC_9(VAR_171, "ATE0\r\n"); if (res != 0) { FUNC_11("! %s: ATE0 failed (retry left: %d).\n", __FUNCTION__, VAR_187); FUNC_18(1); } else { break; } } res = FUNC_9(VAR_171, "AT+QISDE=0\r\n"); return res; } /**************************************************************************** * Name: [BG96] TCP/IP接続パラメータ設定 ****************************************************************************/ static int bg96_setup_apn(serial_t *VAR_171, int VAR_188, char *VAR_189, char *VAR_190, char *password) { int res, need_setup = 1; char VAR_185[64]; memset(buffer, 0, VAR_151); sprintf(buffer, "AT+QICSGP=1\r\n"); sprintf(VAR_185, "+QICSGP: %d,\"%s\",\"%s\",\"%s\",3", VAR_188, VAR_189, VAR_190, password); res = ser_write(VAR_171, buffer, FUNC_4(buffer)); FUNC_3(buffer); //printf("* %s: write '%s' -> %d\n", __FUNCTION__, buffer, res); if (res < 0) { syslog(VAR_191, "! %s: ser_write(\"%s\") failed -> RESET\n", __FUNCTION__, buffer); FUNC_18(2); bg96_reset(); return -1; } /* wait for 'OK' */ while (1) { res = ser_readline(VAR_171, buffer, 128, '\n', 5000); if (res <= 0) { syslog(VAR_191, "! %s: receive timeouted.\n", __FUNCTION__); res = -1; break; } FUNC_3(buffer); if (FUNC_4(buffer) <= 0) continue; //printf("* %s: received: %s\n", __FUNCTION__, buffer); if (strncmp(buffer, VAR_185, FUNC_4(VAR_185)) == 0) { //printf("* %s: received: \"%s\" (%d)\n", __FUNCTION__, // buffer, res); FUNC_11("* %s: do not need to setup APN\n", __FUNCTION__); need_setup = 0; } else if (FUNC_21(buffer, "OK")) { //printf("* %s: 'OK' received.\n", __FUNCTION__); res = 0; break; } } if (res < 0 || need_setup == 0) { return res; } sprintf(buffer, "AT+QICSGP=%d,1,\"%s\",\"%s\",\"%s\",3\r\n", VAR_188, VAR_189, VAR_190, password); //printf("* write: '%s'\n", buffer); if (ser_write(VAR_171, buffer, FUNC_4(buffer)) < 0) { syslog(VAR_191, "!%s: ser_write(\"%s\") failed -> RESET\n", __FUNCTION__, buffer); FUNC_18(2); bg96_reset(); return -1; } /* wait for 'OK' */ while (1) { res = ser_readline(VAR_171, buffer, 128, '\n', 5000); if (res <= 0) { res = -1; break; } else if (strncmp(buffer, "OK", 2) == 0) { //printf("* %s: 'OK' received.\n", __FUNCTION__); res = 0; break; } } return res; } /**************************************************************************** * Name: [BG96] Check Connection Status ****************************************************************************/ static int bg96_get_connection_status(serial_t *VAR_171) { int res; int VAR_192 = -1; const char * const res_connected = "+QIACT:"; sprintf(buffer, "AT+QIACT?\r\n"); //printf(" cmd: %s", buffer); if (ser_write(VAR_171, buffer, FUNC_4(buffer)) < 0) { FUNC_11("! %s: write failed.\n", __FUNCTION__); return -1; } /* wait for '+QIACT' */ while (1) { res = ser_readline(VAR_171, buffer, 128, '\n', 30000); if (res <= 0) { FUNC_11("! read timeouted.\n"); break; } FUNC_3(buffer); //printf("* %s: received: \"%s\"\n", __FUNCTION__, buffer); if (FUNC_21(buffer, res_connected)) { FUNC_11("* %s: stat: connected (\"%s\")\n", __FUNCTION__, buffer); VAR_192 = 0; } else if (FUNC_21(buffer, "OK")) { //printf("* %s: 'OK' received.\n", __FUNCTION__); break; } else if (strncmp(buffer, "ERROR", 5) == 0) { //printf("! %s: 'ERROR' received.\n", __FUNCTION__); break; } } return VAR_192; } /**************************************************************************** * Name: [BG96] Connect ****************************************************************************/ static int FUNC_23(serial_t *VAR_171) { int res; res = bg96_get_connection_status(VAR_171); if (res == 0) { /* already connected. */ return 0; } sprintf(buffer, "AT+QIACT=1\r\n"); FUNC_11(" cmd: %s", buffer); if (FUNC_9(VAR_171, buffer) < 0) { FUNC_11("! %s: write failed.\n", __FUNCTION__); return -1; } return bg96_get_connection_status(VAR_171); } /**************************************************************************** * Name: [BG96] Disconnect ****************************************************************************/ static int FUNC_24(serial_t *VAR_171) { int res; res = bg96_get_connection_status(VAR_171); if (res == -1) { /* already disconnected. */ return 0; } sprintf(buffer, "AT+QIDEACT=1\r\n"); FUNC_11(" cmd: %s", buffer); if (ser_write(VAR_171, buffer, FUNC_4(buffer)) < 0) { FUNC_11("! %s: write failed.\n", __FUNCTION__); return -1; } res = bg96_get_connection_status(VAR_171); return (res == -1) ? 0 : -1; } /**************************************************************************** * Name: [BG96] Open TCP socket ****************************************************************************/ static int FUNC_25(serial_t *VAR_171, bool VAR_193, const char *host, uint16_t VAR_194) { int VAR_195, res, stat, err = -1, VAR_179 = -1; const char *res_connected = "+QIOPEN:"; /* search for free socket index. */ for (VAR_195 = 0; VAR_195 < NSOCKS; VAR_195++) { if (_bg96_state.sockets[VAR_195] == 0) { VAR_179 = VAR_195; break; } } if (VAR_179 == -1) { FUNC_11("! %s: no free sockets.\n", __FUNCTION__); return -1; } sprintf(buffer, "AT+QIOPEN=1,%d,\"%s\",\"%s\",%d,0,0\r\n", VAR_179, (VAR_193 ? "TCP" : "UDP"), host, VAR_194); if (ser_write(VAR_171, buffer, FUNC_4(buffer)) < 0) { FUNC_11("! %s: write failed.\n", __FUNCTION__); return -1; } /* wait for '+QIOPEN:' */ while (1) { res = ser_readline(VAR_171, buffer, 128, '\n', 30000); if (res <= 0) { FUNC_11("! %s: read timeouted.\n", __FUNCTION__); break; } FUNC_3(buffer); if (FUNC_21(buffer, res_connected)) { res = FUNC_16(buffer, "+QIOPEN: %d,%d", &stat, &err); if (res != 2) { FUNC_11("! %s: parse +QIOPEN result failed (%d).\n", __FUNCTION__, res); } else if (err == 0) { FUNC_11("* %s: connected (%s).\n", __FUNCTION__, (VAR_193 ? "TCP" : "UDP")); _bg96_state.sockets[VAR_195] = 1; err = VAR_179; } else { FUNC_11("! %s: connect failed (%d).\n", __FUNCTION__, err); _bg96_state.sockets[VAR_195] = 0; err = -err; } break; } } return err; } /**************************************************************************** * Name: [BG96] Open TCP socket ****************************************************************************/ static int FUNC_26(serial_t *VAR_171, const char *host, uint16_t VAR_194) { return FUNC_25(VAR_171, true, host, VAR_194); } /**************************************************************************** * Name: [BG96] Open UDP socket ****************************************************************************/ static int FUNC_27(serial_t *VAR_171, const char *host, uint16_t VAR_194) { return FUNC_25(VAR_171, false, host, VAR_194); } /**************************************************************************** * Name: [BG96] Close TCP socket ****************************************************************************/ static int bg96_disconnect_tcp_udp(serial_t *VAR_171, int VAR_179) { int res; if (_bg96_state.sockets[VAR_179] == 0) { /* not opened. */ return 0; } sprintf(buffer, "AT+QICLOSE=%d\r\n", VAR_179); res = FUNC_9(VAR_171, buffer); if (res < 0) { FUNC_11("! %s: close socket failed.\n", __FUNCTION__); } _bg96_state.sockets[VAR_179] = 0; return 0; } /**************************************************************************** * Name: [BG96] Close TCP socket ****************************************************************************/ static int FUNC_29(serial_t *VAR_171, int VAR_179) { return bg96_disconnect_tcp_udp(VAR_171, VAR_179); } /**************************************************************************** * Name: [BG96] Close UDP socket ****************************************************************************/ static int bg96_disconnect_udp(serial_t *VAR_171, int VAR_179) { return bg96_disconnect_tcp_udp(VAR_171, VAR_179); } /**************************************************************************** * Name: [BG96] TCP/UDP send ****************************************************************************/ static int FUNC_31(serial_t *VAR_171, int sock, const char *VAR_196, int VAR_197) { int res, writelen = 0; sprintf(buffer, "AT+QISEND=%d,%d\r\n", sock, VAR_197); if (ser_write(VAR_171, buffer, FUNC_4(buffer)) < 0) { FUNC_11("! %s: write failed.\n", __FUNCTION__); return -1; } /* wait for '>' */ while (1) { res = FUNC_32(VAR_171, buffer, 1, 1000); if (res <= 0) { FUNC_11("! %s: read timeouted.\n", __FUNCTION__); return -1; } buffer[1] = '\0'; //printf("* %s: received: 0x%02x\n", __FUNCTION__, buffer[0]); if (buffer[0] == '>') { while (writelen < VAR_197) { res = ser_write(VAR_171, VAR_196 + writelen, VAR_197 - writelen); if (res <= 0) { FUNC_11("! %s: ser_write() failed.\n", __FUNCTION__); return -1; } writelen += res; } break; } } /* wait for result */ /* wait for '+QIOPEN:' */ while (1) { res = ser_readline(VAR_171, buffer, 128, '\n', 30000); if (res <= 0) { FUNC_11("! %s: read timeouted.\n", __FUNCTION__); return -1; } FUNC_3(buffer); //printf("* %s: received: \"%s\"\n", __FUNCTION__, buffer); if (FUNC_21(buffer, "SEND OK")) { FUNC_11(" -> send succeeded.\n"); break; } else if (FUNC_21(buffer, "SEND FAIL")) { FUNC_11(" -> send failed.\n"); return -1; } else if (FUNC_21(buffer, "ERROR")) { FUNC_11(" -> send error.\n"); return -1; } } FUNC_11("---> writelen: %d\n", writelen); return writelen; } /**************************************************************************** * Name: [BG96] polling URC ****************************************************************************/ static int FUNC_33(serial_t *VAR_171, struct urc_info *VAR_154) { int res, code; char VAR_198[16]; /* wait for '+QIURC:' */ while (1) { res = ser_readline(VAR_171, buffer, 256, '\n', 2000); if (res <= 0) { FUNC_11("! %s: read timeouted.\n", __FUNCTION__); return -1; } FUNC_3(buffer); if (FUNC_4(buffer) > 0) { FUNC_11("* %s: received: \"%s\"\n", __FUNCTION__, buffer); } if (FUNC_21(buffer, "+QIURC:")) { res = FUNC_16(buffer, "+QIURC: \"%[a-z]\",%d", &VAR_198, &code); if (res != 2) { FUNC_11("! %s: parse +QIURC result failed (%d), '%s'.\n", __FUNCTION__, res, VAR_198); return -1; } break; } } /* classify URC */ res = 0; if (FUNC_21(VAR_198, "closed")) { VAR_154->code = URC_CLOSED; VAR_154->VAR_158.closed.VAR_155 = code; } else if (FUNC_21(VAR_198, "recv")) { VAR_154->code = URC_RECEIVED; VAR_154->VAR_158.received.VAR_155 = code; } else if (FUNC_21(VAR_198, "pdpdeact")) { VAR_154->code = URC_DEACTIVATED; VAR_154->VAR_158.VAR_157.VAR_156 = code; } else { /* ??? */ FUNC_11("! %s: unhandled URC received, \"%s\"\n", __FUNCTION__, VAR_198); res = -1; } return res; } /**************************************************************************** * Name: [BG96] TCP recv ****************************************************************************/ static int FUNC_34(serial_t *VAR_171, int sock, char *VAR_199, int VAR_197) { int res, restlen, VAR_200; sprintf(buffer, "AT+QIRD=0\r\n", sock, VAR_197); FUNC_11(" cmd: %s", buffer); if (ser_write(VAR_171, buffer, FUNC_4(buffer)) < 0) { FUNC_11("! %s: write failed.\n", __FUNCTION__); return -1; } /* wait for '+QIRD:' */ while (1) { res = ser_readline(VAR_171, buffer, 128, '\n', 5000); if (res <= 0) { FUNC_11("! read timeouted.\n"); return -1; } FUNC_3(buffer); if (FUNC_4(buffer) > 0) { FUNC_11("* %s: received: \"%s\"\n", __FUNCTION__, buffer); } if (FUNC_21(buffer, "+QIRD:")) { res = FUNC_16(buffer, "+QIRD: %d", &restlen); if (res != 1) { FUNC_11("! %s: parse +QIRD result failed (%d).\n", __FUNCTION__, res); return -1; } VAR_200 = FUNC_32(VAR_171, VAR_199, restlen, 3000); break; } } return VAR_200; } /**************************************************************************** * Name: [BG96] CCLK (get network clock) ****************************************************************************/ static int FUNC_35(serial_t *VAR_171) { int res, tz_offset, VAR_201 = -1; struct tm VAR_202; time_t time_now; struct CLASS_24 tv; const char * const VAR_203 = "+CCLK:"; sprintf(buffer, "AT+CCLK?\r\n"); if (ser_write(VAR_171, buffer, FUNC_4(buffer)) < 0) { FUNC_11("! %s: write failed.\n", __FUNCTION__); return -1; } /* wait for '+CCLK' response */ while (1) { res = ser_readline(VAR_171, buffer, 128, '\n', 3000); if (res <= 0) { FUNC_11("! %s: read timeouted.\n", __FUNCTION__); return -1; } FUNC_3(buffer); //printf("* %s: received: '%s'\n", __FUNCTION__, buffer); if (strncmp(buffer, VAR_203, FUNC_4(VAR_203)) == 0) { memset(&VAR_202, 0, sizeof(struct tm)); res = FUNC_16(buffer, "+CCLK: \"%02d/%02d/%02d,%02d:%02d:%02d+%02d\"", &VAR_202.tm_year, &VAR_202.VAR_204, &VAR_202.VAR_205, &VAR_202.VAR_206, &VAR_202.tm_min, &VAR_202.tm_sec, &tz_offset); if (res != 7) { FUNC_11("! %s: parse +CCLK result failed (%s -> %d).\n", __FUNCTION__, buffer, res); return -1; } FUNC_11("* %s: response: '%s'\n", __FUNCTION__, buffer); tz_offset /= 4; VAR_202.tm_year += 100; VAR_202.VAR_204 -= 1; VAR_202.VAR_206 += tz_offset; time_now = FUNC_36(&VAR_202); FUNC_11("* %s: now: %d\n", __FUNCTION__, time_now); if (VAR_202.tm_year < 140) { syslog(LOG_INFO, "* %s: valid +CCLK response (%s)\n", __FUNCTION__, buffer); tv.tv_sec = time_now; tv.VAR_207 = 0; settimeofday(&tv, NULL); VAR_201 = 0; } else { FUNC_11("! %s: invalid +CCLK response (%s)\n", __FUNCTION__, buffer); } } else if (FUNC_21(buffer, "OK")) { //printf("* %s: 'OK' received.\n", __FUNCTION__); break; } } return VAR_201; } /**************************************************************************** * Name: [BG96] get ICCID ****************************************************************************/ static int FUNC_38(serial_t *VAR_171, char *VAR_165) { int res, len, VAR_201 = -1; const char *VAR_184 = "AT+CCID\r\n"; const char *fmt = "+CCID: %s"; char _iccid[20]; res = ser_write(VAR_171, VAR_184, FUNC_4(VAR_184)); if (res < 0) { return -1; } /* wait for 'OK' */ while (1) { memset(buffer, 0, 128); res = ser_readline(VAR_171, buffer, 128, '\n', 2000); if (res <= 0) { break; } else { if (FUNC_21(buffer, "+CCID:")) { res = FUNC_16(buffer, fmt, &_iccid); if (res == 1) { len = FUNC_4(_iccid); if (_iccid[len - 1] == 'F') { _iccid[len - 1] = '\0'; len--; } FUNC_11("* %s: ICCID: %s\n", __FUNCTION__, _iccid); if (len > 0) { FUNC_39(VAR_165, _iccid, len); VAR_201 = 0; } } } else if (FUNC_21(buffer, "OK")) { break; } } } return VAR_201; } /**************************************************************************** * Name: gen_payload ****************************************************************************/ static int gen_payload(struct CLASS_21 *stat, char *buf) { int len; int coeff = 10000000; int lat_min, VAR_208, lat_sec, VAR_209; lat_min = stat->lat / coeff; lat_sec = stat->lat % coeff; lat_sec /= 6; VAR_208 = stat->VAR_170 / coeff; VAR_209 = stat->VAR_170 % coeff; VAR_209 /= 6; len = sprintf(buf, "{\"lat\" : %d.%06d, \"lon\" : %d.%06d," \ " \"rssi\" : %d, \"rsrq\" : %d, \"rsrp\" : %d," \ " \"sinr\" : %d, \"battery\" : %d}", lat_min, lat_sec, VAR_208, VAR_209, stat->rssi, stat->VAR_166, stat->VAR_167, stat->VAR_168, stat->battery); return len; } /**************************************************************************** * Name: initialize swtich gpio ****************************************************************************/ static int FUNC_68(task_t *task) { int fd, res; fd = FUNC_41("/dev/gpout0", VAR_210); if (fd < 0) { FUNC_11("! open GPOUT failed.\n"); return -1; } res = ioctl(fd, GPIOC_WRITE, (unsigned long) 0); close(fd); if (res < 0) { FUNC_11("! write GPIO failed.\n"); return -1; } return 0; } /**************************************************************************** * Name: wait for switch ****************************************************************************/ static int wait_switch(struct tm *VAR_211) { int res, fd, value; struct tm tm_now; long nsec; time_t VAR_202, deadline; fd = FUNC_41("/dev/gpin0", O_RDONLY); if (fd < 0) { FUNC_11("! open GPIN failed.\n"); return -1; } deadline = FUNC_36(VAR_211); while (1) { up_rtc_getdatetime_with_subseconds(&tm_now, &nsec); VAR_202 = FUNC_36(&tm_now); if (VAR_202 >= deadline) { res = 0; break; } res = ioctl(fd, VAR_212, (unsigned long)((uintptr_t) &value)); if (value == 0) { FUNC_11("### Switch ON detected!\n"); res = 1; break; } else { usleep(50 * 1000); } } close(fd); return res; } /**************************************************************************** * Name: Enable GPS ****************************************************************************/ static int bg96_enable_gps(serial_t *VAR_171) { int res; if ((res = FUNC_9(VAR_171, "AT+QGPSEND\r\n")) != 0) { FUNC_11("! %s: AT+QGPSEND failed.\n", __FUNCTION__); } if ((res = FUNC_9(VAR_171, "AT+QGPS=1\r\n")) != 0) { FUNC_11("! %s: AT+QGPS=1 failed.\n", __FUNCTION__); return res; } if ((res = FUNC_9(VAR_171, "AT+QGPSCFG=\"nmeasrc\",1\r\n")) != 0) { FUNC_11("! %s: AT+QGPSCFG=\"nmeasrc\",1 failed.\n", __FUNCTION__); } else { FUNC_11("* %s: Acquisition of NMEA via command succeeded.\n", __FUNCTION__); } return res; } /**************************************************************************** * Name: Get GPS location info ****************************************************************************/ static int FUNC_46(serial_t *VAR_171, int *lat, int *VAR_170) { int res; bool VAR_201; const char *nmearmc = "AT+QGPSGNMEA=\"RMC\"\r\n"; char VAR_213[128]; struct minmea_sentence_rmc frame; VAR_213[0] = '\0'; res = ser_write(VAR_171, nmearmc, FUNC_4(nmearmc)); if (res < 0) { FUNC_11("! write command failed.\n"); return -2; } while (1) { res = ser_readline(VAR_171, buffer, 256, '\n', 1000); if (res > 0) { buffer[res] = '\0'; if (strncmp(buffer, "+QGPS", 5) == 0) { FUNC_3(buffer); FUNC_39(VAR_213, &buffer[12], FUNC_4(buffer) - 12); } } else { break; } if (strncmp(buffer, "OK", 2) == 0) { break; } } if (VAR_213[0] == '\0') { syslog(VAR_191, "! %s: GPS read timeouted (%d).\n", __FUNCTION__, gps_reset_count); return -2; } FUNC_11("RMC: \"%s\"\n", VAR_213); VAR_201 = minmea_parse_rmc(&frame, (const char *) &VAR_213); if (VAR_201 == true && frame.valid) { struct CLASS_25 ts; struct CLASS_24 tv; *lat = minmea_rescale(&frame.latitude, 100000); *VAR_170 = minmea_rescale(&frame.VAR_214, 100000); FUNC_11("Fixed-point Latitude...........: %10d\n", *lat); FUNC_11("Fixed-point Longitude..........: %10d\n", *VAR_170); minmea_gettime(&ts, &frame.date, &frame.time); FUNC_11("timestamp......................: %10d\n", ts.tv_sec); FUNC_11("GPS Reset count................: %10d\n", gps_reset_count); tv.tv_sec = ts.tv_sec + 9 * 60 * 60; tv.VAR_207 = ts.VAR_215 / NSEC_PER_USEC; settimeofday(&tv, NULL); led_onoff(5, 1); led_onoff(4, 0); res = 0; } else { led_onoff(5, 0); led_onoff(4, 1); res = -1; } return res; } /**************************************************************************** * Name: Handler (SETUP) ****************************************************************************/ static task_state_t FUNC_50(task_t *task) { int res; config_t *config; struct CLASS_21 *bg96; config = &task->config; bg96 = &task->VAR_158; bg96->id = config->id; bg96->valid = 0; /* STATUS2: RED */ led_onoff(3, 0); led_onoff(2, 1); res = FUNC_17(task->VAR_171); if (res < 0) { FUNC_11("! %s: echo off failed.\n", __FUNCTION__); FUNC_18(5); return VAR_159; } res = bg96_setup_apn(task->VAR_171, 1, config->VAR_189, config->VAR_190, config->password); if (res < 0) { FUNC_11("! %s: setup_apn failed.\n", __FUNCTION__); FUNC_18(5); return VAR_159; } while (1) { res = bg96_enable_gps(task->VAR_171); if (res == 0) { break; } FUNC_18(5); } FUNC_9(task->VAR_171, "AT+CFUN=4\r\n"); FUNC_18(2); FUNC_9(task->VAR_171, "AT+CFUN=1\r\n"); FUNC_18(1); FUNC_9(task->VAR_171, "AT+CGATT?\r\n"); FUNC_18(1); res = FUNC_38(task->VAR_171, bg96->VAR_165); if (res < 0) { FUNC_11("! %s: get_iccid failed.\n", __FUNCTION__); FUNC_18(5); return VAR_159; } /* STATUS2: GREEN */ led_onoff(2, 0); led_onoff(3, 1); FUNC_11("* %s: ICCID: %s\n", __FUNCTION__, bg96->VAR_165); while (1) { res = FUNC_35(task->VAR_171); if (res == 0) { led_onoff(0, 0); led_onoff(1, 1); return STAT_IDLE; } led_onoff(0, 1); led_onoff(1, 0); FUNC_18(5); } } /**************************************************************************** * Name: Handler (IDLE) ****************************************************************************/ static task_state_t FUNC_51(task_t *task) { struct tm tm, VAR_216; time_t VAR_202, VAR_217; long nsec, sleeptime; CLASS_26 VAR_218; uint16_t VAR_175; up_rtc_getdatetime_with_subseconds(&tm, &nsec); VAR_202 = FUNC_36(&tm); VAR_175 = task->VAR_175; if (VAR_175 < 10) { VAR_175 = 10; } VAR_217 = ((VAR_202 + 1 + VAR_175) / VAR_175) * VAR_175; localtime_r(&VAR_217, &VAR_216); sleeptime = (VAR_217 - VAR_202) * 1000 - (nsec / 1000000); if (sleeptime < 0) { sleeptime = 0; } if (sleeptime > 0) { VAR_218 = sleeptime * 1000; FUNC_11("--- %s: next: %04d/%02d/%02d %02d:%02d:%02d -> " "sleep %d [msec] (%lu [usec])\n", __FUNCTION__, VAR_216.tm_year + 1900, VAR_216.VAR_204 + 1, VAR_216.VAR_205, VAR_216.VAR_206, VAR_216.tm_min, VAR_216.tm_sec, sleeptime, VAR_218); wait_switch(&VAR_216); /* wakeup! */ up_rtc_getdatetime_with_subseconds(&tm, &nsec); VAR_202 = FUNC_36(&tm); localtime_r(&VAR_202, &VAR_216); FUNC_11("--- %s: wakeup: %04d/%02d/%02d %02d:%02d:%02d\n", __FUNCTION__, VAR_216.tm_year + 1900, VAR_216.VAR_204 + 1, VAR_216.VAR_205, VAR_216.VAR_206, VAR_216.tm_min, VAR_216.tm_sec); } return VAR_160; } /**************************************************************************** * Name: Handler (MEASURE) ****************************************************************************/ static task_state_t measurement(task_t *task) { struct CLASS_21 *VAR_158 = &task->VAR_158; int res, lat, VAR_170; FUNC_14(task->VAR_171, &VAR_158->rssi, &VAR_158->VAR_166, &VAR_158->VAR_167, &VAR_158->VAR_168); FUNC_18(1); res = FUNC_46(task->VAR_171, &lat, &VAR_170); if (res == -2) { int VAR_179; task->VAR_175 = 10; for (VAR_179 = 0; VAR_179 < 6; VAR_179++) { led_onoff(VAR_179, 0); } bg96_reset(); FUNC_18(5); gps_reset_count++; return VAR_159; } else if (res == -1) { task->VAR_175 = 10; return STAT_IDLE; } else { task->VAR_175 = 60; task->VAR_158.lat = lat; task->VAR_158.VAR_170 = VAR_170; FUNC_54(&VAR_158->battery); return VAR_161; } } /**************************************************************************** * Name: Handler (CONNECT) ****************************************************************************/ static task_state_t connect_bg96(task_t *task) { int res; config_t *config; /* activate PDP context */ res = FUNC_23(task->VAR_171); if (res < 0) { FUNC_11("! %s: Activate PDP context failed -> RESET\n", __FUNCTION__); FUNC_18(2); bg96_reset(); return STAT_IDLE; } /* open socket */ config = &task->config; FUNC_11("* %s: try to connect to %s:%d ...\n", __FUNCTION__, config->host, config->VAR_219); res = FUNC_27(task->VAR_171, config->host, config->VAR_219); if (res < 0) { FUNC_11("! %s: open socket failed -> RESET\n", __FUNCTION__); FUNC_24(task->VAR_171); FUNC_18(2); bg96_reset(); return STAT_IDLE; } FUNC_11("* connected.\n"); task->VAR_174 = res; return VAR_162; } /**************************************************************************** * Name: Handler (UPLOAD) ****************************************************************************/ task_state_t upload_data(task_t *task) { int len, res; struct CLASS_21 *stat = &task->VAR_158; char sendbuf[256]; len = gen_payload(stat, sendbuf); FUNC_11("* %s: payload '%s' (length: %d)\n", __FUNCTION__, sendbuf, len); res = FUNC_31(task->VAR_171, task->VAR_174, (const char *) sendbuf, len); if (res > 0) { FUNC_11(" -> send_tcp: %d bytes.\n", res); } return STAT_WAIT_RESPONSE; } /**************************************************************************** * Name: Handler (WAIT_RESPONSE) ****************************************************************************/ task_state_t wait_response(task_t *task) { int res, VAR_187 = 1; struct urc_info VAR_154; task_state_t VAR_217 = VAR_164; while (VAR_187) { res = FUNC_33(task->VAR_171, &VAR_154); if (res < 0) { /* timeouted ? */ break; } switch (VAR_154.code) { case URC_CLOSED: VAR_217 = VAR_164; VAR_187 = 0; break; case URC_DEACTIVATED: VAR_217 = VAR_159; VAR_187 = 0; break; case URC_RECEIVED: FUNC_11("* %s: packet received.\n", __FUNCTION__); VAR_217 = VAR_163; VAR_187 = 0; break; default: break; } } return VAR_217; } /**************************************************************************** * Name: Handler (RECEIVE_RESPONSE) ****************************************************************************/ task_state_t FUNC_57(task_t *task) { int VAR_200; VAR_200 = FUNC_34(task->VAR_171, task->VAR_174, buffer, VAR_151); if (VAR_200 < 0) { FUNC_11("! %s: TCP receive failed.\n", __FUNCTION__); return VAR_164; } return VAR_164; } /**************************************************************************** * Name: Handler (DISCONNECT) ****************************************************************************/ static task_state_t FUNC_58(task_t *task) { FUNC_11("---- %s start...\n", __FUNCTION__); FUNC_29(task->VAR_171, task->VAR_174); FUNC_24(task->VAR_171); return STAT_IDLE; } /**************************************************************************** * Name: ****************************************************************************/ static int mainloop(task_t *task) { task_state_t VAR_217; while (1) { switch (task->VAR_176) { case VAR_159: FUNC_11("@@@@@ BG96: %s: STAT_SETUP\n", __FUNCTION__); VAR_217 = FUNC_50(task); break; case STAT_IDLE: FUNC_11("@@@@@ BG96: %s: STAT_IDLE\n", __FUNCTION__); VAR_217 = FUNC_51(task); break; case VAR_160: FUNC_11("@@@@@ BG96: %s: STAT_MEASURE\n", __FUNCTION__); VAR_217 = measurement(task); break; case VAR_161: FUNC_11("@@@@@ BG96: %s: STAT_CONNECT\n", __FUNCTION__); VAR_217 = connect_bg96(task); break; case VAR_162: FUNC_11("@@@@@ BG96: %s: STAT_UPLOAD\n", __FUNCTION__); VAR_217 = upload_data(task); break; case STAT_WAIT_RESPONSE: FUNC_11("@@@@@ BG96: %s: STAT_WAIT_RESPONSE\n", __FUNCTION__); VAR_217 = wait_response(task); break; case VAR_163: FUNC_11("@@@@@ BG96: %s: STAT_RECEIVE_RESPONSE\n", __FUNCTION__); VAR_217 = FUNC_57(task); break; case VAR_164: FUNC_11("@@@@@ BG96: %s: STAT_DISCONNECT\n", __FUNCTION__); VAR_217 = FUNC_58(task); break; default: FUNC_11("@@@@@ BG96: %s: DEFAULT -> STAT_IDLE\n", __FUNCTION__); VAR_217 = STAT_IDLE; break; } task->VAR_176 = VAR_217; } return 0; } /**************************************************************************** * Name: task initialize ****************************************************************************/ static task_t *FUNC_60(void) { task_t *task; char *VAR_220 = "/dev/ttyS2"; char *VAR_221 = "/dev/ttyS1"; if (!(task = zalloc(sizeof(task_t)))) { return NULL; } FUNC_62(&task->config); if (task->config.valid != 1) { strcpy(task->config.VAR_189, "soracom.io"); strcpy(task->config.VAR_190, "sora"); strcpy(task->config.password, "<PASSWORD>"); strcpy(task->config.host, "harvest.soracom.io"); task->config.VAR_219 = 8514; } FUNC_11("=== BG96 configurations ===\n"); FUNC_11(" * APN: %s\n", task->config.VAR_189); FUNC_11(" * user: %s\n", task->config.VAR_190); FUNC_11(" * passowrd: %s\n", task->config.password); FUNC_11(" * host: %s\n", task->config.host); FUNC_11(" * port: %d\n", task->config.VAR_219); task->VAR_171 = FUNC_64(VAR_220, 115200, 0); task->VAR_172 = FUNC_64(VAR_221, 115200, 0); task->VAR_176 = VAR_159; FUNC_68(task); if ((find_i2c_device(VAR_222) == 0) && (find_i2c_device(VAR_223) == 0)) { task->VAR_173 = 1; fd_led = FUNC_41("/dev/leddrv0", O_RDONLY); } FUNC_18(1); return task; } /**************************************************************************** * Name: boot task ****************************************************************************/ static int FUNC_66(int argc, char **argv) { task_t *task = FUNC_60(); if (!task) { return -1; } return mainloop(task); } /**************************************************************************** * Name: setting or boot task ****************************************************************************/ static int select_mode(int argc, char **argv) { int VAR_224; boardctl(VAR_225, (uintptr_t) &VAR_224); if (VAR_224 == 0) { /* configuration mode */ return FUNC_69(argc, argv); } return FUNC_66(argc, argv); } /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** * serial_relay_main ****************************************************************************/ #ifdef CONFIG_BUILD_KERNEL int FUNC_70(int argc, FAR char *argv[]) #else int FUNC_71(int argc, char *argv[]) #endif { return select_mode(argc, argv); }
0.957343
{'IMPORT_23': 'stdio.h', 'IMPORT_24': 'stdlib.h', 'IMPORT_25': 'string.h', 'IMPORT_26': 'termios.h', 'IMPORT_27': 'time.h', 'IMPORT_28': 'sys/types.h', 'IMPORT_29': 'sys/stat.h', 'IMPORT_30': 'sys/ioctl.h', 'IMPORT_31': 'fcntl.h', 'IMPORT_32': 'errno.h', 'IMPORT_33': 'unistd.h', 'IMPORT_34': 'arpa/inet.h', 'IMPORT_35': 'arch/board/boardctl.h', 'IMPORT_36': 'nuttx/crypto/blake2s.h', 'IMPORT_37': 'nuttx/leds/tca6507.h', 'IMPORT_38': 'libserial.h', 'VAR_151': 'BUFSIZE', 'VAR_152': 'max', 'FUNC_0': 'max', 'VAR_153': 'a', 'CLASS_20': 'urc', 'VAR_154': 'urc', 'VAR_155': 'connect_id', 'VAR_156': 'context_id', 'VAR_157': 'deactivated', 'VAR_158': 'info', 'VAR_159': 'STAT_SETUP', 'VAR_160': 'STAT_MEASURE', 'VAR_161': 'STAT_CONNECT', 'VAR_162': 'STAT_UPLOAD', 'VAR_163': 'STAT_RECEIVE_RESPONSE', 'VAR_164': 'STAT_DISCONNECT', 'CLASS_21': 'xg50_stat', 'VAR_165': 'iccid', 'VAR_166': 'rsrq', 'VAR_167': 'rsrp', 'VAR_168': 'sinr', 'VAR_169': 'attach', 'VAR_170': 'lon', 'ID_6': 'xg50_stat_t', 'CLASS_22': 'bg96_state_t', 'ID_7': 'bg96_state_t', 'VAR_171': 'ser', 'VAR_172': 'ser_gps', 'VAR_173': 'led_found', 'VAR_174': 'sock_idx', 'VAR_175': 'interval', 'VAR_176': 'state', 'VAR_177': 'struct', 'VAR_178': 'src', 'FUNC_3': 'chop', 'FUNC_4': 'strlen', 'VAR_179': 'idx', 'VAR_180': 'onoff', 'CLASS_23': 'tca6507_onoff_s', 'VAR_181': 'LED_STATUS3_GREEN', 'VAR_182': 'on', 'VAR_183': 'BIOC_RESET_B2B', 'FUNC_9': 'bg96_send_AT_command', 'VAR_184': 'cmd', 'FUNC_11': 'printf', 'FUNC_14': 'bg96_get_qcsq', 'VAR_185': 'buf2', 'VAR_186': 'service', 'FUNC_16': 'sscanf', 'FUNC_17': 'bg96_echo_off', 'VAR_187': 'retry', 'FUNC_18': 'sleep', 'VAR_188': 'cid', 'VAR_189': 'apn', 'VAR_190': 'user', 'VAR_191': 'LOG_ERR', 'FUNC_21': 'strstr', 'VAR_192': 'connected', 'FUNC_23': 'bg96_connect', 'FUNC_24': 'bg96_disconnect', 'FUNC_25': 'bg96_connect_tcp_udp', 'VAR_193': 'tcp', 'VAR_194': 'dest_port', 'VAR_195': 'i', 'FUNC_26': 'bg96_connect_tcp', 'FUNC_27': 'bg96_connect_udp', 'FUNC_29': 'bg96_disconnect_tcp', 'FUNC_31': 'bg96_send_tcp', 'VAR_196': 'wbuf', 'VAR_197': 'buflen', 'FUNC_32': 'ser_read', 'FUNC_33': 'bg96_handle_URC', 'VAR_198': 'report', 'FUNC_34': 'bg96_recv_tcp', 'VAR_199': 'rbuf', 'VAR_200': 'readlen', 'FUNC_35': 'bg96_sync_clock', 'VAR_201': 'result', 'VAR_202': 'now', 'CLASS_24': 'timeval', 'VAR_203': 'res_cclk', 'VAR_204': 'tm_mon', 'VAR_205': 'tm_mday', 'VAR_206': 'tm_hour', 'FUNC_36': 'mktime', 'VAR_207': 'tv_usec', 'FUNC_38': 'bg96_get_iccid', 'FUNC_39': 'strncpy', 'VAR_208': 'lon_min', 'VAR_209': 'lon_sec', 'FUNC_68': 'init_switch', 'FUNC_41': 'open', 'VAR_210': 'O_RDWR', 'VAR_211': 'tm_deadline', 'VAR_212': 'GPIOC_READ', 'FUNC_46': 'bg96_get_gps_location', 'VAR_213': 'rmc_buf', 'CLASS_25': 'timespec', 'VAR_214': 'longitude', 'VAR_215': 'tv_nsec', 'FUNC_50': 'setup_bg96', 'FUNC_51': 'wait_next_measurement_time', 'VAR_216': 'next_tm', 'VAR_217': 'next', 'CLASS_26': 'useconds_t', 'VAR_218': 'usec', 'FUNC_54': 'get_battery_level', 'VAR_219': 'port', 'FUNC_57': 'receive_response', 'FUNC_58': 'disconnect_bg96', 'FUNC_60': 'init_task', 'VAR_220': 'bg96_path', 'VAR_221': 'gps_path', 'FUNC_62': 'load_config', 'FUNC_64': 'serial_open', 'VAR_222': 'I2C_ADDR_TCA6507', 'VAR_223': 'I2C_ADDR_PCA9534', 'FUNC_66': 'boot_main', 'VAR_224': 'sw_state', 'VAR_225': 'BIOC_GET_LEDSW', 'FUNC_69': 'configuration', 'FUNC_70': 'main', 'FUNC_71': 'bg96_main'}
// // Created by <NAME> on 26.06.2021. // #ifndef PLATFORM_IO_IRREMOTEBUTTON_H #define PLATFORM_IO_IRREMOTEBUTTON_H enum Button { BTN_NONE, BTN_0, BTN_1, BTN_2, BTN_3, BTN_4, BTN_5, BTN_6, BTN_7, BTN_8, BTN_9, BTN_UP, BTN_DOWN, BTN_LEFT, BTN_RIGHT, BTN_ENTER, BTN_START, BTN_HASHTAG, }; #endif //PLATFORM_IO_IRREMOTEBUTTON_H
// // Created by <NAME> on 26.06.2021. // #ifndef PLATFORM_IO_IRREMOTEBUTTON_H #define PLATFORM_IO_IRREMOTEBUTTON_H enum Button { BTN_NONE, BTN_0, BTN_1, BTN_2, BTN_3, BTN_4, BTN_5, BTN_6, BTN_7, BTN_8, BTN_9, BTN_UP, BTN_DOWN, BTN_LEFT, BTN_RIGHT, BTN_ENTER, BTN_START, BTN_HASHTAG, }; #endif //PLATFORM_IO_IRREMOTEBUTTON_H
0.018759
{}
/* * CGlib * * A Low-Level GPU Graphics and Utilities API * * Copyright (C) 2012 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * */ #include <cglib-config.h> #include "cg-output-private.h" #include <string.h> static void _cg_output_free(cg_output_t *output); CG_OBJECT_DEFINE(Output, output); cg_output_t * _cg_output_new(const char *name) { cg_output_t *output; output = c_slice_new0(cg_output_t); output->name = c_strdup(name); return _cg_output_object_new(output); } static void _cg_output_free(cg_output_t *output) { c_free(output->name); c_slice_free(cg_output_t, output); } bool _cg_output_values_equal(cg_output_t *output, cg_output_t *other) { return memcmp((const char *)output + C_STRUCT_OFFSET(cg_output_t, x), (const char *)other + C_STRUCT_OFFSET(cg_output_t, x), sizeof(cg_output_t) - C_STRUCT_OFFSET(cg_output_t, x)) == 0; } int cg_output_get_x(cg_output_t *output) { return output->x; } int cg_output_get_y(cg_output_t *output) { return output->y; } int cg_output_get_width(cg_output_t *output) { return output->width; } int cg_output_get_height(cg_output_t *output) { return output->height; } int cg_output_get_mm_width(cg_output_t *output) { return output->mm_width; } int cg_output_get_mm_height(cg_output_t *output) { return output->mm_height; } cg_subpixel_order_t cg_output_get_subpixel_order(cg_output_t *output) { return output->subpixel_order; } float cg_output_get_refresh_rate(cg_output_t *output) { return output->refresh_rate; }
/* * CGlib * * A Low-Level GPU Graphics and Utilities API * * Copyright (C) 2012 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * */ #include <cglib-config.h> #include "IMPORT_0" #include <string.h> static void _cg_output_free(cg_output_t *output); FUNC_0(VAR_0, output); cg_output_t * _cg_output_new(const char *VAR_1) { cg_output_t *output; output = c_slice_new0(cg_output_t); output->VAR_1 = c_strdup(VAR_1); return FUNC_1(output); } static void _cg_output_free(cg_output_t *output) { c_free(output->VAR_1); c_slice_free(cg_output_t, output); } bool _cg_output_values_equal(cg_output_t *output, cg_output_t *other) { return memcmp((const char *)output + FUNC_2(cg_output_t, x), (const char *)other + FUNC_2(cg_output_t, x), sizeof(cg_output_t) - FUNC_2(cg_output_t, x)) == 0; } int cg_output_get_x(cg_output_t *output) { return output->x; } int cg_output_get_y(cg_output_t *output) { return output->y; } int cg_output_get_width(cg_output_t *output) { return output->width; } int cg_output_get_height(cg_output_t *output) { return output->height; } int cg_output_get_mm_width(cg_output_t *output) { return output->mm_width; } int cg_output_get_mm_height(cg_output_t *output) { return output->mm_height; } CLASS_0 cg_output_get_subpixel_order(cg_output_t *output) { return output->VAR_2; } float FUNC_3(cg_output_t *output) { return output->refresh_rate; }
0.2313
{'IMPORT_0': 'cg-output-private.h', 'FUNC_0': 'CG_OBJECT_DEFINE', 'VAR_0': 'Output', 'VAR_1': 'name', 'FUNC_1': '_cg_output_object_new', 'FUNC_2': 'C_STRUCT_OFFSET', 'CLASS_0': 'cg_subpixel_order_t', 'VAR_2': 'subpixel_order', 'FUNC_3': 'cg_output_get_refresh_rate'}
/* Copyright (c) 1997-2020 <NAME> and others. */ /* < https://opensource.org/licenses/BSD-3-Clause > */ // ----------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------- // MARK: - #include "../../m_spaghettis.h" #include "../../m_core.h" #include "../../g_graphics.h" // ----------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------- /* Fetch the nth outlet of an object. */ /* Return its first connection. */ static t_outconnect *traverser_outletStart (t_object *x, t_outlet **ptr, int n) { t_outlet *o = object_getOutlets (x); while (n && o) { n--; o = outlet_getNext (o); } *ptr = o; if (o) { return (outlet_getConnections (o)); } return NULL; } /* Given a connection, fetch the object connected, the related inlet and its index. */ /* Return the next connection of the outlet (NULL if last). */ static t_outconnect *traverser_outletNext (t_outconnect *previous, t_object **dest, t_inlet **ptr, int *n) { t_pd *y = connection_getReceiver (previous); t_class *c = pd_class (y); if (c == inlet_class || c == pointerinlet_class || c == floatinlet_class || c == symbolinlet_class) { t_inlet *i1 = (t_inlet *)y; t_inlet *i2 = NULL; t_object *o = inlet_getOwner (i1); int k = class_hasFirstInlet (pd_class (o)); for (i2 = object_getInlets (o); i2 && i2 != i1; i2 = inlet_getNext (i2)) { k++; } *n = k; *ptr = i1; *dest = o; } else { *n = 0; *ptr = NULL; *dest = (cast_object (y)); } return connection_getNext (previous); } // ----------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------- // MARK: - void traverser_start (t_traverser *t, t_glist *glist) { t->tr_owner = glist; t->tr_connectionCached = NULL; t->tr_srcObject = NULL; t->tr_srcIndexOfNextOutlet = 0; t->tr_srcNumberOfOutlets = 0; } /* Get the cords outlet per outlet, object per object. */ /* Coordinates are set at the same time. */ t_outconnect *traverser_next (t_traverser *t) { t_outconnect *connection = t->tr_connectionCached; while (!connection) { // int n = t->tr_srcIndexOfNextOutlet; while (n == t->tr_srcNumberOfOutlets) { // t_gobj *y = NULL; t_object *o = NULL; if (!t->tr_srcObject) { y = t->tr_owner->gl_graphics; } else { y = cast_gobj (t->tr_srcObject)->g_next; } for (; y; y = y->g_next) { if ((o = cast_objectIfConnectable (y))) { break; } /* Only box objects are considered. */ } if (!o) { return NULL; } t->tr_srcObject = o; t->tr_srcNumberOfOutlets = object_getNumberOfOutlets (o); n = 0; // } t->tr_srcIndexOfOutlet = n; t->tr_srcIndexOfNextOutlet = n + 1; connection = traverser_outletStart (t->tr_srcObject, &t->tr_srcOutlet, n); // } t->tr_connectionCached = traverser_outletNext (connection, &t->tr_destObject, &t->tr_destInlet, &t->tr_destIndexOfInlet); t->tr_destNumberOfInlets = object_getNumberOfInlets (t->tr_destObject); PD_ASSERT (t->tr_destNumberOfInlets); if (!glist_isOnScreen (t->tr_owner)) { cord_init (&t->tr_cord, connection); } else { // cord_make (&t->tr_cord, connection, t->tr_srcObject, t->tr_srcIndexOfOutlet, t->tr_destObject, t->tr_destIndexOfInlet, t->tr_owner); // } return connection; } // ----------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------- // MARK: - t_error traverser_disconnect (t_traverser *t, t_glist *glist) { t_object *src = t->tr_srcObject; t_object *dest = t->tr_destObject; int m = t->tr_srcIndexOfOutlet; int n = t->tr_destIndexOfInlet; t_error err = object_disconnect (src, m, dest, n); if (!err && glist) { if (glist_undoIsOk (glist)) { glist_undoAppend (glist, undodisconnect_new (src, m, dest, n)); } } return err; } int traverser_isLineBetween (t_traverser *t, t_object *src, int m, t_object *dest, int n) { if (t->tr_srcObject == src && t->tr_destObject == dest) { // if (t->tr_srcIndexOfOutlet == m && t->tr_destIndexOfInlet == n) { return 1; } // } return 0; } // ----------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------
/* Copyright (c) 1997-2020 <NAME> and others. */ /* < https://opensource.org/licenses/BSD-3-Clause > */ // ----------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------- // MARK: - #include "IMPORT_0" #include "IMPORT_1" #include "IMPORT_2" // ----------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------- /* Fetch the nth outlet of an object. */ /* Return its first connection. */ static CLASS_0 *FUNC_0 (CLASS_1 *VAR_0, CLASS_2 **VAR_1, int VAR_2) { CLASS_2 *o = FUNC_1 (VAR_0); while (VAR_2 && o) { VAR_2--; o = outlet_getNext (o); } *VAR_1 = o; if (o) { return (FUNC_2 (o)); } return NULL; } /* Given a connection, fetch the object connected, the related inlet and its index. */ /* Return the next connection of the outlet (NULL if last). */ static CLASS_0 *FUNC_3 (CLASS_0 *previous, CLASS_1 **dest, CLASS_3 **VAR_1, int *VAR_2) { t_pd *VAR_3 = FUNC_4 (previous); CLASS_4 *VAR_4 = FUNC_5 (VAR_3); if (VAR_4 == VAR_5 || VAR_4 == VAR_6 || VAR_4 == VAR_7 || VAR_4 == VAR_8) { CLASS_3 *i1 = (CLASS_3 *)VAR_3; CLASS_3 *VAR_9 = NULL; CLASS_1 *o = inlet_getOwner (i1); int VAR_10 = FUNC_6 (FUNC_5 (o)); for (VAR_9 = FUNC_7 (o); VAR_9 && VAR_9 != i1; VAR_9 = FUNC_8 (VAR_9)) { VAR_10++; } *VAR_2 = VAR_10; *VAR_1 = i1; *dest = o; } else { *VAR_2 = 0; *VAR_1 = NULL; *dest = (FUNC_9 (VAR_3)); } return FUNC_10 (previous); } // ----------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------- // MARK: - void FUNC_11 (CLASS_5 *VAR_11, t_glist *VAR_12) { VAR_11->tr_owner = VAR_12; VAR_11->tr_connectionCached = NULL; VAR_11->VAR_13 = NULL; VAR_11->tr_srcIndexOfNextOutlet = 0; VAR_11->VAR_14 = 0; } /* Get the cords outlet per outlet, object per object. */ /* Coordinates are set at the same time. */ CLASS_0 *traverser_next (CLASS_5 *VAR_11) { CLASS_0 *connection = VAR_11->tr_connectionCached; while (!connection) { // int VAR_2 = VAR_11->tr_srcIndexOfNextOutlet; while (VAR_2 == VAR_11->VAR_14) { // t_gobj *VAR_3 = NULL; CLASS_1 *o = NULL; if (!VAR_11->VAR_13) { VAR_3 = VAR_11->tr_owner->VAR_15; } else { VAR_3 = cast_gobj (VAR_11->VAR_13)->g_next; } for (; VAR_3; VAR_3 = VAR_3->g_next) { if ((o = FUNC_12 (VAR_3))) { break; } /* Only box objects are considered. */ } if (!o) { return NULL; } VAR_11->VAR_13 = o; VAR_11->VAR_14 = FUNC_13 (o); VAR_2 = 0; // } VAR_11->tr_srcIndexOfOutlet = VAR_2; VAR_11->tr_srcIndexOfNextOutlet = VAR_2 + 1; connection = FUNC_0 (VAR_11->VAR_13, &VAR_11->tr_srcOutlet, VAR_2); // } VAR_11->tr_connectionCached = FUNC_3 (connection, &VAR_11->VAR_16, &VAR_11->VAR_17, &VAR_11->VAR_18); VAR_11->VAR_19 = FUNC_14 (VAR_11->VAR_16); PD_ASSERT (VAR_11->VAR_19); if (!FUNC_15 (VAR_11->tr_owner)) { FUNC_16 (&VAR_11->VAR_20, connection); } else { // FUNC_17 (&VAR_11->VAR_20, connection, VAR_11->VAR_13, VAR_11->tr_srcIndexOfOutlet, VAR_11->VAR_16, VAR_11->VAR_18, VAR_11->tr_owner); // } return connection; } // ----------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------- // MARK: - CLASS_6 FUNC_18 (CLASS_5 *VAR_11, t_glist *VAR_12) { CLASS_1 *src = VAR_11->VAR_13; CLASS_1 *dest = VAR_11->VAR_16; int m = VAR_11->tr_srcIndexOfOutlet; int VAR_2 = VAR_11->VAR_18; CLASS_6 VAR_21 = FUNC_19 (src, m, dest, VAR_2); if (!VAR_21 && VAR_12) { if (FUNC_20 (VAR_12)) { FUNC_21 (VAR_12, undodisconnect_new (src, m, dest, VAR_2)); } } return VAR_21; } int FUNC_22 (CLASS_5 *VAR_11, CLASS_1 *src, int m, CLASS_1 *dest, int VAR_2) { if (VAR_11->VAR_13 == src && VAR_11->VAR_16 == dest) { // if (VAR_11->tr_srcIndexOfOutlet == m && VAR_11->VAR_18 == VAR_2) { return 1; } // } return 0; } // ----------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------
0.676908
{'IMPORT_0': '../../m_spaghettis.h', 'IMPORT_1': '../../m_core.h', 'IMPORT_2': '../../g_graphics.h', 'CLASS_0': 't_outconnect', 'FUNC_0': 'traverser_outletStart', 'CLASS_1': 't_object', 'VAR_0': 'x', 'CLASS_2': 't_outlet', 'VAR_1': 'ptr', 'VAR_2': 'n', 'FUNC_1': 'object_getOutlets', 'FUNC_2': 'outlet_getConnections', 'FUNC_3': 'traverser_outletNext', 'CLASS_3': 't_inlet', 'VAR_3': 'y', 'FUNC_4': 'connection_getReceiver', 'CLASS_4': 't_class', 'VAR_4': 'c', 'FUNC_5': 'pd_class', 'VAR_5': 'inlet_class', 'VAR_6': 'pointerinlet_class', 'VAR_7': 'floatinlet_class', 'VAR_8': 'symbolinlet_class', 'VAR_9': 'i2', 'VAR_10': 'k', 'FUNC_6': 'class_hasFirstInlet', 'FUNC_7': 'object_getInlets', 'FUNC_8': 'inlet_getNext', 'FUNC_9': 'cast_object', 'FUNC_10': 'connection_getNext', 'FUNC_11': 'traverser_start', 'CLASS_5': 't_traverser', 'VAR_11': 't', 'VAR_12': 'glist', 'VAR_13': 'tr_srcObject', 'VAR_14': 'tr_srcNumberOfOutlets', 'VAR_15': 'gl_graphics', 'FUNC_12': 'cast_objectIfConnectable', 'FUNC_13': 'object_getNumberOfOutlets', 'VAR_16': 'tr_destObject', 'VAR_17': 'tr_destInlet', 'VAR_18': 'tr_destIndexOfInlet', 'VAR_19': 'tr_destNumberOfInlets', 'FUNC_14': 'object_getNumberOfInlets', 'FUNC_15': 'glist_isOnScreen', 'FUNC_16': 'cord_init', 'VAR_20': 'tr_cord', 'FUNC_17': 'cord_make', 'CLASS_6': 't_error', 'FUNC_18': 'traverser_disconnect', 'VAR_21': 'err', 'FUNC_19': 'object_disconnect', 'FUNC_20': 'glist_undoIsOk', 'FUNC_21': 'glist_undoAppend', 'FUNC_22': 'traverser_isLineBetween'}
#pragma once //------------------------------------------------------------------------------ // SimpsonIntegrator.h // Implement integration via Simpsons method // // Copyright (c) 2019 GlenSand // All rights reserved. // // Date: 27.09.2019 // Author: <NAME> //------------------------------------------------------------------------------ #include "OneDimensionalIntegrator.h" namespace CPhysics { class SimpsonIntegrator : public OneDimensionalIntegrator { public: SimpsonIntegrator() = default; virtual ~SimpsonIntegrator() = default; Real Integrate(const Params* params) const override; std::vector<std::vector<Real>> IntegrationGrid(const Params* params) const override; [[nodiscard]] std::string GetIntegratorType() const override; }; }
#pragma once //------------------------------------------------------------------------------ // SimpsonIntegrator.h // Implement integration via Simpsons method // // Copyright (c) 2019 GlenSand // All rights reserved. // // Date: 27.09.2019 // Author: <NAME> //------------------------------------------------------------------------------ #include "IMPORT_0" namespace CPhysics { CLASS_0 VAR_0 : public VAR_1 { public: FUNC_0() = VAR_2; CLASS_1 ~FUNC_0() = VAR_2; CLASS_2 FUNC_1(const CLASS_3* VAR_5) const override; std::VAR_7<VAR_6::VAR_7<VAR_3>> FUNC_2(const VAR_4* VAR_5) const override; [[VAR_8]] std::VAR_9 FUNC_3() const override; }; }
0.848757
{'IMPORT_0': 'OneDimensionalIntegrator.h', 'CLASS_0': 'class', 'VAR_0': 'SimpsonIntegrator', 'FUNC_0': 'SimpsonIntegrator', 'VAR_1': 'OneDimensionalIntegrator', 'VAR_2': 'default', 'CLASS_1': 'virtual', 'CLASS_2': 'Real', 'VAR_3': 'Real', 'FUNC_1': 'Integrate', 'CLASS_3': 'Params', 'VAR_4': 'Params', 'VAR_5': 'params', 'VAR_6': 'std', 'VAR_7': 'vector', 'FUNC_2': 'IntegrationGrid', 'VAR_8': 'nodiscard', 'VAR_9': 'string', 'FUNC_3': 'GetIntegratorType'}
/* * BP-DBSQLSGerators.h * * Created on: Nov 19, 2015 * Author: root */ #ifndef INCLUDE_DATABASES_BPDB_BP_DBSQLSYNTAXGENERATORS_H_ #define INCLUDE_DATABASES_BPDB_BP_DBSQLSYNTAXGENERATORS_H_ // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Open or Close Syntax Generation Session %%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // open a syntax generator session P_BPDB_SQLGEN BP_DBSGOpen(P_BPDB bpdb); // close the syntax generator BP_ERROR_T BP_DBSGClose(P_BPDB_SQLGEN syngen); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Query Modification Routines %%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Generates a CREATE TABLE sql query from the table specified by table_name. Table must // be found within the associated bpdb handle. // // finalizes query: yes // BP_ERROR_T BP_DBSGCreateTable(P_BPDB_SQLGEN syngen, char *table_name); // Generates a select query BP_ERROR_T BP_DBSGSelectFrom ( P_BPDB_SQLGEN syngen, P_BPDB_SQLGEN_SELECT select_info ); // Generates an insert query from the BP_ERROR_T BP_DBSGInsertInto(P_BPDB_SQLGEN syngen, BPDB_SELECTOR_TYPE out_db_selector, char *table_name, size_t max_records); // dispatch a select query BP_ERROR_T BP_DBSGDispatchSelect(P_BPDB_SQLGEN syngen, P_BPDB_SQLGEN_SELECT select_info); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Fetch Result %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Fetches a result, results are automatically destroyed on fetch so be careful // to copy data rather than reference it directly. The create_json_reg parameter // is used to create a registry of usable data which can be plugged into the JSON // subsystem. BP_ERROR_T BP_DBSGFetchResult ( P_BPDB_SQLGEN syngen, P_BPDB_SQLGEN_SELECT select_info, BP_BOOL create_json_reg = BP_TRUE ); // Get current result value by field name. Returned result is // standard mysql/mariadb bind structure. MYSQL_BIND * BP_DBSGLookupResultByFieldName ( P_BPDB_SQLGEN syngen, P_BPDB_SQLGEN_SELECT select_info, char * field_name ); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% JSON Registry %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Adds a json result value. DO NOT USE THIS OUTSIDE OF BP_DBSGUpdateJSONResultRegistry. This // is a utility macro and is intended only to make code within BP_DBSGUpdateJSONResultRegistry easier // to read/understand. #define BPDB_ADD_JSON_RES_VAL(path, name, value, value_len) \ BP_HashRegAddDataToTableByPath \ ( \ select_info->fetched_record_json_hreg, \ (char **) path, \ name, \ BP_HASH_TABLE_KEYED_ENTRY_TYPE_BINARY_BLOB, \ NULL, \ value_len \ ); \ memcpy(&lookup_stack, &path, sizeof(path)); \ lookup_stack[2] = name; \ data_lookup_entry = BP_HashRegLookupTableEntryByPath \ ( \ select_info->fetched_record_json_hreg, \ (char **) &lookup_stack \ ); \ if(!data_lookup_entry)\ break;\ memcpy(data_lookup_entry->data, value, value_len); \ BP_ZERO_STACK(lookup_stack); // Attempts to update the json result registry. BP_ERROR_T BP_DBSGUpdateJSONResultRegistry ( P_BPDB_SQLGEN syngen, P_BPDB_SQLGEN_SELECT select_info ); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Sanity / Check Functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // set maximum select fields count here (it's arbitrary but used when checking // field counts to determine if a developer is being ridiculous) #define BPDB_MAX_SELECT_FIELDS_COUNT 256 // -- begin edits --- // Checks a field name list and make sure elements match up BP_ERROR_T BP_DBCheckSelectFieldNameList ( P_BPDB bpdb, P_BP_LINKL field_name_list, P_BP_LINKL table_name_list ); // Checks joins to make sure they make sense from a logical perspective. BP_ERROR_T BP_DBCheckJoinElements ( P_BPDB bpdb, P_BPDB_SELECT_JOIN joins, size_t joins_n, P_BP_LINKL table_name_list ); // Checks "where" clause elements to make sure they make sense from a logical perspective. BP_ERROR_T BP_DBCheckSelectClauseElements ( P_BPDB bpdb, P_BPDB_SELECT_WHERE wheres, size_t wheres_n, P_BP_LINKL field_name_list ); // -- end edits 10/13 --- // This is a "master" routine that runs all checks necessary for // generating a select info. It analyzes all elements in a // BPDB_SQLGEN_SELECT item, and returns ERR_FAILURE on bad // values. You should only ever need to call this function // once to verify values. BP_ERROR_T BP_DBCheckSelectInfoAndGenerateMetadataLists ( P_BPDB_SQLGEN syngen, P_BPDB_SQLGEN_SELECT select_info ); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Schema Check Routines %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // attempt to check fieldnames against schema BP_ERROR_T BP_DBCheckFieldNamesAgainstSchema(P_BPDB_SQLGEN syngen, P_BP_LINKL field_name_list); // attempt to check tablenames against schema BP_ERROR_T BP_DBCheckTableNamesAgainstSchema(P_BPDB_SQLGEN syngen, P_BP_LINKL table_name_list); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Parameter Addition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Adds a select parameter to a select info query. This shouldn't be used directly. This is used internally // by BP_DBSGSelectFrom to add parameters inline. BP_ERROR_T BP_DBAddSelectWhereParameterToSelectInfo ( P_BPDB_SQLGEN syngen, P_BPDB_SQLGEN_SELECT select_info, P_BPDB_SELECT_WHERE select_where ); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Result Addition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Attempts to add a result to the select info structure. Used internally. BP_ERROR_T BP_DBAddSelectResultToSelectInfo ( P_BPDB_SQLGEN syngen, P_BPDB_SQLGEN_SELECT select_info, char * select_field_name ); // Attempts to create a hash table within the select_info structure by associating // potentially retrieved tables BP_ERROR_T BP_DBAddSelectResultReferences ( P_BPDB_SQLGEN syngen, P_BPDB_SQLGEN_SELECT select_info ); // Attempt to add a result entry to match with a result BP_ERROR_T BP_DBAddSelectResultReferenceToResultHashTable ( P_BPDB_SQLGEN syngen, P_BPDB_SQLGEN_SELECT select_info, char * select_field_name, MYSQL_BIND * result_entry ); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Dataset Generators %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Creates a searchable list of tables which represent ALL tables which could be selected // from in the query. P_BP_LINKL BP_DBGenerateTableListFromSelectInfo(P_BPDB_SQLGEN_SELECT select_info); // Generates a searchable list of all field names which represent all tables which could be selected P_BP_LINKL BP_DBGenerateFieldNameListFromSelectInfo ( P_BPDB_SQLGEN_SELECT select_info, P_BP_LINKL table_name_list ); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Destroy / Free Dangling Data Routines %%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // This cleans out all dangling data that could possibly be generated as a result of // the attempted or comleted prepare of a select statement. It should be noted that // all potentially dangling memory isn't allocated in the master hash table. This is // to prevent any need for contentious locking of the table itself. BP_ERROR_T BP_DBSelectInfoCleanResidualData ( P_BPDB_SQLGEN_SELECT select_info, BP_BOOL destroy_bind_results = BP_TRUE, BP_BOOL destroy_bind_parameters = BP_TRUE, BP_BOOL destroy_field_name_list = BP_TRUE, BP_BOOL destroy_table_name_list = BP_TRUE ); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Display Routines %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // display select info BP_ERROR_T BP_DBDisplaySelectInfo(P_BPDB_SQLGEN_SELECT select_info); // display select where info BP_ERROR_T BP_DBDisplaySelectInfoSelectWhere(P_BPDB_SELECT_WHERE select_where, size_t tab_depth); // display select join info BP_ERROR_T BP_DBDisplaySelectInfoSelectJoin(P_BPDB_SELECT_JOIN join_on, size_t tab_depth); // display mariadb parameters for a provided select info BP_ERROR_T BP_DBDisplaySelectInfoMariadbBindParameters(P_BPDB_SQLGEN_SELECT select_info); // display mariadb parameters for a provided select info BP_ERROR_T BP_DBDisplaySelectInfoMariadbBindParameter(MYSQL_BIND * bind_parameter, size_t tab_depth, size_t parameter_index = (size_t) -1); // display mariadb results for a provided select info BP_ERROR_T BP_DBDisplaySelectInfoMariadbBindResults(P_BPDB_SQLGEN_SELECT select_info); // display mariadb results for a provided select info BP_ERROR_T BP_DBDisplaySelectInfoMariadbBindResult(MYSQL_BIND * bind_result, size_t tab_depth, size_t result_index); #endif /* INCLUDE_DATABASES_BPDB_BP_DBSQLSYNTAXGENERATORS_H_ */
/* * BP-DBSQLSGerators.h * * Created on: Nov 19, 2015 * Author: root */ #ifndef INCLUDE_DATABASES_BPDB_BP_DBSQLSYNTAXGENERATORS_H_ #define INCLUDE_DATABASES_BPDB_BP_DBSQLSYNTAXGENERATORS_H_ // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Open or Close Syntax Generation Session %%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // open a syntax generator session P_BPDB_SQLGEN BP_DBSGOpen(CLASS_0 bpdb); // close the syntax generator BP_ERROR_T BP_DBSGClose(P_BPDB_SQLGEN VAR_0); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Query Modification Routines %%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Generates a CREATE TABLE sql query from the table specified by table_name. Table must // be found within the associated bpdb handle. // // finalizes query: yes // BP_ERROR_T BP_DBSGCreateTable(P_BPDB_SQLGEN VAR_0, char *table_name); // Generates a select query BP_ERROR_T BP_DBSGSelectFrom ( P_BPDB_SQLGEN VAR_0, CLASS_1 select_info ); // Generates an insert query from the BP_ERROR_T BP_DBSGInsertInto(P_BPDB_SQLGEN VAR_0, BPDB_SELECTOR_TYPE out_db_selector, char *table_name, size_t max_records); // dispatch a select query BP_ERROR_T BP_DBSGDispatchSelect(P_BPDB_SQLGEN VAR_0, CLASS_1 select_info); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Fetch Result %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Fetches a result, results are automatically destroyed on fetch so be careful // to copy data rather than reference it directly. The create_json_reg parameter // is used to create a registry of usable data which can be plugged into the JSON // subsystem. BP_ERROR_T BP_DBSGFetchResult ( P_BPDB_SQLGEN VAR_0, CLASS_1 select_info, CLASS_2 create_json_reg = BP_TRUE ); // Get current result value by field name. Returned result is // standard mysql/mariadb bind structure. MYSQL_BIND * BP_DBSGLookupResultByFieldName ( P_BPDB_SQLGEN VAR_0, CLASS_1 select_info, char * field_name ); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% JSON Registry %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Adds a json result value. DO NOT USE THIS OUTSIDE OF BP_DBSGUpdateJSONResultRegistry. This // is a utility macro and is intended only to make code within BP_DBSGUpdateJSONResultRegistry easier // to read/understand. #define BPDB_ADD_JSON_RES_VAL(VAR_1, name, value, value_len) \ BP_HashRegAddDataToTableByPath \ ( \ select_info->fetched_record_json_hreg, \ (char **) path, \ name, \ BP_HASH_TABLE_KEYED_ENTRY_TYPE_BINARY_BLOB, \ NULL, \ value_len \ ); \ memcpy(&lookup_stack, &path, sizeof(path)); \ lookup_stack[2] = name; \ data_lookup_entry = BP_HashRegLookupTableEntryByPath \ ( \ select_info->fetched_record_json_hreg, \ (char **) &lookup_stack \ ); \ if(!data_lookup_entry)\ break;\ memcpy(data_lookup_entry->data, value, value_len); \ BP_ZERO_STACK(lookup_stack); // Attempts to update the json result registry. BP_ERROR_T BP_DBSGUpdateJSONResultRegistry ( P_BPDB_SQLGEN VAR_0, CLASS_1 select_info ); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Sanity / Check Functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // set maximum select fields count here (it's arbitrary but used when checking // field counts to determine if a developer is being ridiculous) #define BPDB_MAX_SELECT_FIELDS_COUNT 256 // -- begin edits --- // Checks a field name list and make sure elements match up BP_ERROR_T BP_DBCheckSelectFieldNameList ( CLASS_0 bpdb, P_BP_LINKL field_name_list, P_BP_LINKL table_name_list ); // Checks joins to make sure they make sense from a logical perspective. BP_ERROR_T FUNC_0 ( CLASS_0 bpdb, P_BPDB_SELECT_JOIN joins, size_t joins_n, P_BP_LINKL table_name_list ); // Checks "where" clause elements to make sure they make sense from a logical perspective. BP_ERROR_T BP_DBCheckSelectClauseElements ( CLASS_0 bpdb, P_BPDB_SELECT_WHERE wheres, size_t wheres_n, P_BP_LINKL field_name_list ); // -- end edits 10/13 --- // This is a "master" routine that runs all checks necessary for // generating a select info. It analyzes all elements in a // BPDB_SQLGEN_SELECT item, and returns ERR_FAILURE on bad // values. You should only ever need to call this function // once to verify values. BP_ERROR_T BP_DBCheckSelectInfoAndGenerateMetadataLists ( P_BPDB_SQLGEN VAR_0, CLASS_1 select_info ); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Schema Check Routines %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // attempt to check fieldnames against schema BP_ERROR_T BP_DBCheckFieldNamesAgainstSchema(P_BPDB_SQLGEN VAR_0, P_BP_LINKL field_name_list); // attempt to check tablenames against schema BP_ERROR_T BP_DBCheckTableNamesAgainstSchema(P_BPDB_SQLGEN VAR_0, P_BP_LINKL table_name_list); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Parameter Addition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Adds a select parameter to a select info query. This shouldn't be used directly. This is used internally // by BP_DBSGSelectFrom to add parameters inline. BP_ERROR_T BP_DBAddSelectWhereParameterToSelectInfo ( P_BPDB_SQLGEN VAR_0, CLASS_1 select_info, P_BPDB_SELECT_WHERE select_where ); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Result Addition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Attempts to add a result to the select info structure. Used internally. BP_ERROR_T BP_DBAddSelectResultToSelectInfo ( P_BPDB_SQLGEN VAR_0, CLASS_1 select_info, char * select_field_name ); // Attempts to create a hash table within the select_info structure by associating // potentially retrieved tables BP_ERROR_T BP_DBAddSelectResultReferences ( P_BPDB_SQLGEN VAR_0, CLASS_1 select_info ); // Attempt to add a result entry to match with a result BP_ERROR_T BP_DBAddSelectResultReferenceToResultHashTable ( P_BPDB_SQLGEN VAR_0, CLASS_1 select_info, char * select_field_name, MYSQL_BIND * result_entry ); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Dataset Generators %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Creates a searchable list of tables which represent ALL tables which could be selected // from in the query. P_BP_LINKL BP_DBGenerateTableListFromSelectInfo(CLASS_1 select_info); // Generates a searchable list of all field names which represent all tables which could be selected P_BP_LINKL BP_DBGenerateFieldNameListFromSelectInfo ( CLASS_1 select_info, P_BP_LINKL table_name_list ); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Destroy / Free Dangling Data Routines %%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // This cleans out all dangling data that could possibly be generated as a result of // the attempted or comleted prepare of a select statement. It should be noted that // all potentially dangling memory isn't allocated in the master hash table. This is // to prevent any need for contentious locking of the table itself. BP_ERROR_T BP_DBSelectInfoCleanResidualData ( CLASS_1 select_info, CLASS_2 VAR_2 = BP_TRUE, CLASS_2 destroy_bind_parameters = BP_TRUE, CLASS_2 VAR_3 = BP_TRUE, CLASS_2 destroy_table_name_list = BP_TRUE ); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Display Routines %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // display select info BP_ERROR_T BP_DBDisplaySelectInfo(CLASS_1 select_info); // display select where info BP_ERROR_T BP_DBDisplaySelectInfoSelectWhere(P_BPDB_SELECT_WHERE select_where, size_t tab_depth); // display select join info BP_ERROR_T FUNC_1(P_BPDB_SELECT_JOIN join_on, size_t tab_depth); // display mariadb parameters for a provided select info BP_ERROR_T BP_DBDisplaySelectInfoMariadbBindParameters(CLASS_1 select_info); // display mariadb parameters for a provided select info BP_ERROR_T BP_DBDisplaySelectInfoMariadbBindParameter(MYSQL_BIND * bind_parameter, size_t tab_depth, size_t parameter_index = (size_t) -1); // display mariadb results for a provided select info BP_ERROR_T BP_DBDisplaySelectInfoMariadbBindResults(CLASS_1 select_info); // display mariadb results for a provided select info BP_ERROR_T BP_DBDisplaySelectInfoMariadbBindResult(MYSQL_BIND * bind_result, size_t tab_depth, size_t result_index); #endif /* INCLUDE_DATABASES_BPDB_BP_DBSQLSYNTAXGENERATORS_H_ */
0.214185
{'CLASS_0': 'P_BPDB', 'VAR_0': 'syngen', 'CLASS_1': 'P_BPDB_SQLGEN_SELECT', 'CLASS_2': 'BP_BOOL', 'VAR_1': 'path', 'FUNC_0': 'BP_DBCheckJoinElements', 'VAR_2': 'destroy_bind_results', 'VAR_3': 'destroy_field_name_list', 'FUNC_1': 'BP_DBDisplaySelectInfoSelectJoin'}
/* Decode a Pop Segment Register Instruction */ static int iApopSeg(IAinstInfoPtr info, BYTE dest) { if (StackAddrSize(info->mode) == IA16) info->srcRdFn = pop_spIARd; else info->srcRdFn = pop_espIARd; info->destRdFn = segRegUpdateIARd; info->destWrFn = segRegIAWr; info->cond_seg = dest; info->execFn = popIAEx; info->dasFn = pop_seg_das; return 1; }
/* Decode a Pop Segment Register Instruction */ static int iApopSeg(IAinstInfoPtr VAR_0, BYTE dest) { if (FUNC_0(VAR_0->mode) == IA16) VAR_0->srcRdFn = pop_spIARd; else VAR_0->srcRdFn = VAR_1; VAR_0->VAR_2 = VAR_3; VAR_0->VAR_4 = VAR_5; VAR_0->cond_seg = dest; VAR_0->execFn = VAR_6; VAR_0->VAR_7 = pop_seg_das; return 1; }
0.409401
{'VAR_0': 'info', 'FUNC_0': 'StackAddrSize', 'VAR_1': 'pop_espIARd', 'VAR_2': 'destRdFn', 'VAR_3': 'segRegUpdateIARd', 'VAR_4': 'destWrFn', 'VAR_5': 'segRegIAWr', 'VAR_6': 'popIAEx', 'VAR_7': 'dasFn'}
#ifndef PBRSpriteLayer_H #define PBRSpriteLayer_H #include <fastgfx.h> #include "PBRSpriteBuffer.h" #include <glm/glm.hpp> #include <vector> #include <map> #include <string> namespace fgfx { class PBRSpriteLayer : public fgfx::TypedLayer<PBRSpriteLayer> { protected: std::vector<PBRSpriteBuffer*> buffers; friend class PBRSpriteBuffer; static GLuint spriteProgram; static GLuint spriteProgramAttribPosition; static GLuint spriteProgramAttribNormal; static GLuint spriteProgramAttribColor; static GLuint spriteProgramAttribColorCoord; static GLuint spriteProgramAttribNormalCoord; static GLuint spriteProgramAttribMaterialCoord; static GLuint spriteProgramUniformCameraMatrix; static GLuint spriteProgramUniformSampler; public: static void initializeSpriteProgram(); static void destroySpriteProgram(); PBRSpriteLayer(fgfx::Engine* enginep); void bufferSprite(const std::shared_ptr<Sprite>& sprite, const glm::mat4 &mat, glm::vec4 color); void rawBufferSprite(const std::shared_ptr<Sprite>& sprite, const glm::mat4 &mat, glm::vec4 color); virtual void reset() override; virtual void upload() override; virtual void render(const fgfx::ModelViewProjection& mvp) override; void beginDraw(const fgfx::ModelViewProjection& mvp); void endDraw(); PBRSpriteBuffer* getBuffer(int textureId); PBRSpriteBuffer* getBuffer(std::shared_ptr<Sprite> sprite); }; } #endif // PBRSpriteLayer_H
#ifndef VAR_0 #define VAR_0 #include <IMPORT_0> #include "IMPORT_1" #include <glm/glm.hpp> #include <vector> #include <map> #include <string> namespace fgfx { class PBRSpriteLayer : VAR_1 fgfx::TypedLayer<PBRSpriteLayer> { protected: std::vector<PBRSpriteBuffer*> buffers; friend class PBRSpriteBuffer; static CLASS_0 spriteProgram; static CLASS_0 spriteProgramAttribPosition; static CLASS_0 spriteProgramAttribNormal; static CLASS_0 spriteProgramAttribColor; static CLASS_0 VAR_2; static CLASS_0 VAR_3; static CLASS_0 spriteProgramAttribMaterialCoord; static CLASS_0 spriteProgramUniformCameraMatrix; static CLASS_0 spriteProgramUniformSampler; public: VAR_4 void initializeSpriteProgram(); static void destroySpriteProgram(); PBRSpriteLayer(fgfx::VAR_5* enginep); void bufferSprite(const std::VAR_6<Sprite>& sprite, const glm::mat4 &mat, glm::VAR_7 color); void rawBufferSprite(const std::VAR_6<Sprite>& sprite, const glm::mat4 &mat, glm::VAR_7 color); virtual void reset() override; virtual void FUNC_0() override; virtual void render(const fgfx::ModelViewProjection& VAR_8) override; void beginDraw(const fgfx::ModelViewProjection& VAR_8); void endDraw(); PBRSpriteBuffer* getBuffer(int VAR_9); PBRSpriteBuffer* getBuffer(std::VAR_6<Sprite> sprite); }; } #endif // PBRSpriteLayer_H
0.160445
{'VAR_0': 'PBRSpriteLayer_H', 'IMPORT_0': 'fastgfx.h', 'IMPORT_1': 'PBRSpriteBuffer.h', 'VAR_1': 'public', 'CLASS_0': 'GLuint', 'VAR_2': 'spriteProgramAttribColorCoord', 'VAR_3': 'spriteProgramAttribNormalCoord', 'VAR_4': 'static', 'VAR_5': 'Engine', 'VAR_6': 'shared_ptr', 'VAR_7': 'vec4', 'FUNC_0': 'upload', 'VAR_8': 'mvp', 'VAR_9': 'textureId'}
/* * Function: sd_set_vers1_properties * * Description: Set version 1 device properties based on a property list * retrieved from the driver configuration file or static * configuration table. Version 1 properties have the format: * * <data-property-name>:=<version>,<flags>,<prop0>,<prop1>,.....<propN> * * where the prop0 value will be used to set prop0 if bit0 * is set in the flags * * Arguments: un - driver soft state (unit) structure * flags - integer mask indicating properties to be set * prop_list - integer list of property values */ static void sd_set_vers1_properties(struct sd_lun *un, int flags, sd_tunables *prop_list) { ASSERT(un != NULL); if (flags & SD_CONF_BSET_NOCACHE) { un->un_f_opt_disable_cache = TRUE; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: caching disabled flag set\n"); } if (flags & SD_CONF_BSET_PLAYMSF_BCD) { un->un_f_cfg_playmsf_bcd = TRUE; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: playmsf_bcd set\n"); } if (flags & SD_CONF_BSET_READSUB_BCD) { un->un_f_cfg_readsub_bcd = TRUE; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: readsub_bcd set\n"); } if (flags & SD_CONF_BSET_READ_TOC_TRK_BCD) { un->un_f_cfg_read_toc_trk_bcd = TRUE; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: read_toc_trk_bcd set\n"); } if (flags & SD_CONF_BSET_READ_TOC_ADDR_BCD) { un->un_f_cfg_read_toc_addr_bcd = TRUE; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: read_toc_addr_bcd set\n"); } if (flags & SD_CONF_BSET_NO_READ_HEADER) { un->un_f_cfg_no_read_header = TRUE; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: no_read_header set\n"); } if (flags & SD_CONF_BSET_READ_CD_XD4) { un->un_f_cfg_read_cd_xd4 = TRUE; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: read_cd_xd4 set\n"); } if (flags & SD_CONF_BSET_FAB_DEVID) { un->un_f_opt_fab_devid = TRUE; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: fab_devid bit set\n"); } if (flags & SD_CONF_BSET_THROTTLE) { ASSERT(prop_list != NULL); un->un_saved_throttle = un->un_throttle = prop_list->sdt_throttle; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: throttle set to %d\n", prop_list->sdt_throttle); } if (flags & SD_CONF_BSET_NRR_COUNT) { ASSERT(prop_list != NULL); if (prop_list->sdt_not_rdy_retries) { un->un_notready_retry_count = prop_list->sdt_not_rdy_retries; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: not ready retry count" " set to %d\n", un->un_notready_retry_count); } } if (flags & SD_CONF_BSET_CTYPE) { ASSERT(prop_list != NULL); switch (prop_list->sdt_ctype) { case CTYPE_CDROM: un->un_ctype = prop_list->sdt_ctype; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: ctype set to " "CTYPE_CDROM\n"); break; case CTYPE_CCS: un->un_ctype = prop_list->sdt_ctype; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: ctype set to " "CTYPE_CCS\n"); break; case CTYPE_ROD: un->un_ctype = prop_list->sdt_ctype; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: ctype set to " "CTYPE_ROD\n"); break; default: scsi_log(SD_DEVINFO(un), sd_label, CE_WARN, "sd_set_vers1_properties: Could not set " "invalid ctype value (%d)", prop_list->sdt_ctype); } } if (flags & SD_CONF_BSET_BSY_RETRY_COUNT) { ASSERT(prop_list != NULL); un->un_busy_retry_count = prop_list->sdt_busy_retries; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: " "busy retry count set to %d\n", un->un_busy_retry_count); } if (flags & SD_CONF_BSET_RST_RETRIES) { ASSERT(prop_list != NULL); un->un_reset_retry_count = prop_list->sdt_reset_retries; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: " "reset retry count set to %d\n", un->un_reset_retry_count); } if (flags & SD_CONF_BSET_RSV_REL_TIME) { ASSERT(prop_list != NULL); un->un_reserve_release_time = prop_list->sdt_reserv_rel_time; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: " "reservation release timeout set to %d\n", un->un_reserve_release_time); } if (flags & SD_CONF_BSET_TUR_CHECK) { un->un_f_cfg_tur_check = TRUE; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: tur queue check set\n"); } if (flags & SD_CONF_BSET_MIN_THROTTLE) { un->un_min_throttle = prop_list->sdt_min_throttle; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: min throttle set to %d\n", un->un_min_throttle); } if (flags & SD_CONF_BSET_DISKSORT_DISABLED) { un->un_f_disksort_disabled = (prop_list->sdt_disk_sort_dis != 0) ? TRUE : FALSE; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: disksort disabled " "flag set to %d\n", prop_list->sdt_disk_sort_dis); } if (flags & SD_CONF_BSET_LUN_RESET_ENABLED) { un->un_f_lun_reset_enabled = (prop_list->sdt_lun_reset_enable != 0) ? TRUE : FALSE; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: lun reset enabled " "flag set to %d\n", prop_list->sdt_lun_reset_enable); } if (flags & SD_CONF_BSET_CACHE_IS_NV) { un->un_f_suppress_cache_flush = (prop_list->sdt_suppress_cache_flush != 0) ? TRUE : FALSE; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: suppress_cache_flush " "flag set to %d\n", prop_list->sdt_suppress_cache_flush); } if (flags & SD_CONF_BSET_PC_DISABLED) { un->un_f_power_condition_disabled = (prop_list->sdt_power_condition_dis != 0) ? TRUE : FALSE; SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_vers1_properties: power_condition_disabled " "flag set to %d\n", prop_list->sdt_power_condition_dis); } if ((un->un_throttle < SD_LOWEST_VALID_THROTTLE) || (un->un_min_throttle < SD_LOWEST_VALID_THROTTLE) || (un->un_min_throttle > un->un_throttle)) { un->un_saved_throttle = un->un_throttle = sd_max_throttle; un->un_min_throttle = sd_min_throttle; } }
/* * Function: sd_set_vers1_properties * * Description: Set version 1 device properties based on a property list * retrieved from the driver configuration file or static * configuration table. Version 1 properties have the format: * * <data-property-name>:=<version>,<flags>,<prop0>,<prop1>,.....<propN> * * where the prop0 value will be used to set prop0 if bit0 * is set in the flags * * Arguments: un - driver soft state (unit) structure * flags - integer mask indicating properties to be set * prop_list - integer list of property values */ static void FUNC_0(struct CLASS_0 *VAR_0, int flags, CLASS_1 *VAR_1) { FUNC_1(VAR_0 != NULL); if (flags & VAR_2) { VAR_0->VAR_3 = TRUE; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: caching disabled flag set\n"); } if (flags & VAR_5) { VAR_0->VAR_6 = TRUE; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: playmsf_bcd set\n"); } if (flags & VAR_7) { VAR_0->un_f_cfg_readsub_bcd = TRUE; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: readsub_bcd set\n"); } if (flags & VAR_8) { VAR_0->VAR_9 = TRUE; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: read_toc_trk_bcd set\n"); } if (flags & VAR_10) { VAR_0->VAR_11 = TRUE; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: read_toc_addr_bcd set\n"); } if (flags & SD_CONF_BSET_NO_READ_HEADER) { VAR_0->VAR_12 = TRUE; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: no_read_header set\n"); } if (flags & SD_CONF_BSET_READ_CD_XD4) { VAR_0->VAR_13 = TRUE; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: read_cd_xd4 set\n"); } if (flags & VAR_14) { VAR_0->VAR_15 = TRUE; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: fab_devid bit set\n"); } if (flags & VAR_16) { FUNC_1(VAR_1 != NULL); VAR_0->VAR_17 = VAR_0->VAR_18 = VAR_1->VAR_19; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: throttle set to %d\n", VAR_1->VAR_19); } if (flags & VAR_20) { FUNC_1(VAR_1 != NULL); if (VAR_1->VAR_21) { VAR_0->VAR_22 = VAR_1->VAR_21; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: not ready retry count" " set to %d\n", VAR_0->VAR_22); } } if (flags & VAR_23) { FUNC_1(VAR_1 != NULL); switch (VAR_1->VAR_24) { case CTYPE_CDROM: VAR_0->VAR_25 = VAR_1->VAR_24; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: ctype set to " "CTYPE_CDROM\n"); break; case CTYPE_CCS: VAR_0->VAR_25 = VAR_1->VAR_24; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: ctype set to " "CTYPE_CCS\n"); break; case CTYPE_ROD: VAR_0->VAR_25 = VAR_1->VAR_24; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: ctype set to " "CTYPE_ROD\n"); break; default: FUNC_3(SD_DEVINFO(VAR_0), VAR_26, VAR_27, "sd_set_vers1_properties: Could not set " "invalid ctype value (%d)", VAR_1->VAR_24); } } if (flags & SD_CONF_BSET_BSY_RETRY_COUNT) { FUNC_1(VAR_1 != NULL); VAR_0->un_busy_retry_count = VAR_1->sdt_busy_retries; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: " "busy retry count set to %d\n", VAR_0->un_busy_retry_count); } if (flags & VAR_28) { FUNC_1(VAR_1 != NULL); VAR_0->un_reset_retry_count = VAR_1->VAR_29; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: " "reset retry count set to %d\n", VAR_0->un_reset_retry_count); } if (flags & SD_CONF_BSET_RSV_REL_TIME) { FUNC_1(VAR_1 != NULL); VAR_0->VAR_30 = VAR_1->VAR_31; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: " "reservation release timeout set to %d\n", VAR_0->VAR_30); } if (flags & VAR_32) { VAR_0->VAR_33 = TRUE; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: tur queue check set\n"); } if (flags & VAR_34) { VAR_0->un_min_throttle = VAR_1->VAR_35; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: min throttle set to %d\n", VAR_0->un_min_throttle); } if (flags & VAR_36) { VAR_0->VAR_37 = (VAR_1->VAR_38 != 0) ? TRUE : FALSE; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: disksort disabled " "flag set to %d\n", VAR_1->VAR_38); } if (flags & VAR_39) { VAR_0->VAR_40 = (VAR_1->VAR_41 != 0) ? TRUE : FALSE; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: lun reset enabled " "flag set to %d\n", VAR_1->VAR_41); } if (flags & VAR_42) { VAR_0->un_f_suppress_cache_flush = (VAR_1->VAR_43 != 0) ? TRUE : FALSE; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: suppress_cache_flush " "flag set to %d\n", VAR_1->VAR_43); } if (flags & VAR_44) { VAR_0->VAR_45 = (VAR_1->VAR_46 != 0) ? TRUE : FALSE; FUNC_2(VAR_4, VAR_0, "sd_set_vers1_properties: power_condition_disabled " "flag set to %d\n", VAR_1->VAR_46); } if ((VAR_0->VAR_18 < VAR_47) || (VAR_0->un_min_throttle < VAR_47) || (VAR_0->un_min_throttle > VAR_0->VAR_18)) { VAR_0->VAR_17 = VAR_0->VAR_18 = VAR_48; VAR_0->un_min_throttle = VAR_49; } }
0.91905
{'FUNC_0': 'sd_set_vers1_properties', 'CLASS_0': 'sd_lun', 'VAR_0': 'un', 'CLASS_1': 'sd_tunables', 'VAR_1': 'prop_list', 'FUNC_1': 'ASSERT', 'VAR_2': 'SD_CONF_BSET_NOCACHE', 'VAR_3': 'un_f_opt_disable_cache', 'FUNC_2': 'SD_INFO', 'VAR_4': 'SD_LOG_ATTACH_DETACH', 'VAR_5': 'SD_CONF_BSET_PLAYMSF_BCD', 'VAR_6': 'un_f_cfg_playmsf_bcd', 'VAR_7': 'SD_CONF_BSET_READSUB_BCD', 'VAR_8': 'SD_CONF_BSET_READ_TOC_TRK_BCD', 'VAR_9': 'un_f_cfg_read_toc_trk_bcd', 'VAR_10': 'SD_CONF_BSET_READ_TOC_ADDR_BCD', 'VAR_11': 'un_f_cfg_read_toc_addr_bcd', 'VAR_12': 'un_f_cfg_no_read_header', 'VAR_13': 'un_f_cfg_read_cd_xd4', 'VAR_14': 'SD_CONF_BSET_FAB_DEVID', 'VAR_15': 'un_f_opt_fab_devid', 'VAR_16': 'SD_CONF_BSET_THROTTLE', 'VAR_17': 'un_saved_throttle', 'VAR_18': 'un_throttle', 'VAR_19': 'sdt_throttle', 'VAR_20': 'SD_CONF_BSET_NRR_COUNT', 'VAR_21': 'sdt_not_rdy_retries', 'VAR_22': 'un_notready_retry_count', 'VAR_23': 'SD_CONF_BSET_CTYPE', 'VAR_24': 'sdt_ctype', 'VAR_25': 'un_ctype', 'FUNC_3': 'scsi_log', 'VAR_26': 'sd_label', 'VAR_27': 'CE_WARN', 'VAR_28': 'SD_CONF_BSET_RST_RETRIES', 'VAR_29': 'sdt_reset_retries', 'VAR_30': 'un_reserve_release_time', 'VAR_31': 'sdt_reserv_rel_time', 'VAR_32': 'SD_CONF_BSET_TUR_CHECK', 'VAR_33': 'un_f_cfg_tur_check', 'VAR_34': 'SD_CONF_BSET_MIN_THROTTLE', 'VAR_35': 'sdt_min_throttle', 'VAR_36': 'SD_CONF_BSET_DISKSORT_DISABLED', 'VAR_37': 'un_f_disksort_disabled', 'VAR_38': 'sdt_disk_sort_dis', 'VAR_39': 'SD_CONF_BSET_LUN_RESET_ENABLED', 'VAR_40': 'un_f_lun_reset_enabled', 'VAR_41': 'sdt_lun_reset_enable', 'VAR_42': 'SD_CONF_BSET_CACHE_IS_NV', 'VAR_43': 'sdt_suppress_cache_flush', 'VAR_44': 'SD_CONF_BSET_PC_DISABLED', 'VAR_45': 'un_f_power_condition_disabled', 'VAR_46': 'sdt_power_condition_dis', 'VAR_47': 'SD_LOWEST_VALID_THROTTLE', 'VAR_48': 'sd_max_throttle', 'VAR_49': 'sd_min_throttle'}
#ifndef Roomba_H #define Roomba_H #define LOWBYTE(v) ((unsigned char) (v)) #define HIGHBYTE(v) ((unsigned char) (((unsigned int) (v)) >> 8)) #include <stdio.h> #include <stdlib.h> #include <iostream> #include <string.h> #include <bitset> #include <ftdi.h> #include "RoombaSensors.h" using namespace std; //void delay( unsigned long ms ); /* -------------------- MY ROOMBA -------------------- */ /* enum class SENSOR : std::int8_t { WALL = 1, CLIFF_LEFT = 2, CLIFF_FRONT_LEFT = 3, CLIFF_FRONT_RIGHT = 3, CLIFF_RIGHT = 2, VIRTUAL_WALL = 2, }; enum class MODE : unsigned char { }; enum class MOTORS : std::int8_t { MAIN_BRUSH = 0, // BIT 2 VACUUM = 1, // BIT 1 SIDE_BRUSH = 2 // BIT 0 }; */ struct Opcode { enum LocalOpcode : unsigned char { START = 128, BAUD = 129, DRIVE = 137, LEDS = 139, SENSOR = 142, }; }; struct Baud { enum LocalBaud : unsigned char { B300 = 0, B600 = 1, B1200 = 2, B2400 = 3, B4800 = 4, B9600 = 5, B14400 = 6, B19200 = 7, B28800 = 8, B38400 = 9, B57600 = 10, B115200 = 11, }; }; struct Mode { enum LocalMode : unsigned char { CONTROL = 130, SAFE = 131, FULL = 132, POWER = 133, SPOT = 134, CLEAN = 135, MAX = 136, }; }; struct LED { enum LocalLED : int { DIRT_DETECT = 0, MAX = 1, CLEAN = 2, SPOT = 3, STATUS = 4, }; }; struct Sensor { enum LocalSensor : int { ALL = 0, ENVIRONMENT = 1, //cliff, bumper, dirt detectors, motor over-currents. PHYSICAL = 2, //distance, angle, buttons, remote control commands SYSTEM = 3, //voltage, current, battery charge, battery temperature) }; }; class Roomba { public: static const int BAUDRATE = 57600; //static const int BAUDRATE = 19200; Roomba(); //Roomba( BAUD ); ~Roomba(); //TODO It might be good to make a call to the Roomba when a sensor is wanting to be read. //However, it might cause problems for distance and angle. So, maybe not. (Look into it). RoombaSensors getSensor() { return sensors; } /* Roomba SCI Commands */ void start(); void setBaud(unsigned char baud); void setMode(unsigned char mode); bool getSensors(int sensor_pkt); // Velocity: -500 <> 500 mm/s // Radius: -2000 <> 2000 mm/s // Straight = 32768 // Zero-turn CW: -1 // Zero-turn CCW: 1 void drive(int16_t velocity, int16_t radius); void setLED(int led_id, bool state, int pwr_c = -1, int pwr_i = -1); void powerOn(); void powerOff(); void delay(unsigned int howLong); void write(unsigned char cmd); void read(int numBytes); //Set the Roomba operating mode. /* setMode( ENUM::MODE ); //Make the Roomba drive at a velocity (mm/s) at a specified radius. drive(int Velocity, int Radius); //A list of the motors to turn on or off. motors( ENUM::MOTORS [] ) //Set the state of the button LEDS on the Roomba leds(); //Write a song, play the song. song(); play(); //Request the sensor data. sensors(); //Force the Roomba to start hunting for its dock. forceSeekingDock(); */ /* Courtesy Functions */ /* //Read the value one of the Roomba sensors. bool/auto getSensor( ENUM::SENSOR ); //Turn the Roomba X degrees (zero-turn) turn(degrees); //Return the current battery voltage. float getBatteryVoltage(); //Calculate the percent power remaining and return. --Might not be possible. (translation. accurate enough to be useful) float getBatteryPercent(); */ private: static const int MAX_SENSOR_BYTES = 26; RoombaSensors sensors; struct ftdi_context *ftdi; bitset<8> led_bs; int led_pwr_c; int led_pwr_i; void setFTDIBaud(unsigned int baud); bool setDTR(const int state); //void sleep(unsigned int mseconds); }; /* -------------------- MY ROOMBA END -------------------- */ #endif
#ifndef VAR_0 #define VAR_0 #define LOWBYTE(v) ((unsigned char) (v)) #define HIGHBYTE(v) ((unsigned char) (((unsigned int) (v)) >> 8)) #include <stdio.h> #include <IMPORT_0> #include <IMPORT_1> #include <string.h> #include <bitset> #include <ftdi.h> #include "RoombaSensors.h" using namespace std; //void delay( unsigned long ms ); /* -------------------- MY ROOMBA -------------------- */ /* enum class SENSOR : std::int8_t { WALL = 1, CLIFF_LEFT = 2, CLIFF_FRONT_LEFT = 3, CLIFF_FRONT_RIGHT = 3, CLIFF_RIGHT = 2, VIRTUAL_WALL = 2, }; enum class MODE : unsigned char { }; enum class MOTORS : std::int8_t { MAIN_BRUSH = 0, // BIT 2 VACUUM = 1, // BIT 1 SIDE_BRUSH = 2 // BIT 0 }; */ struct CLASS_0 { enum LocalOpcode : unsigned char { START = 128, BAUD = 129, VAR_1 = 137, LEDS = 139, VAR_2 = 142, }; }; struct Baud { enum LocalBaud : unsigned char { VAR_3 = 0, VAR_4 = 1, B1200 = 2, VAR_5 = 3, B4800 = 4, B9600 = 5, VAR_6 = 6, B19200 = 7, B28800 = 8, B38400 = 9, VAR_7 = 10, B115200 = 11, }; }; struct Mode { enum LocalMode : unsigned char { VAR_8 = 130, SAFE = 131, FULL = 132, VAR_9 = 133, SPOT = 134, CLEAN = 135, MAX = 136, }; }; struct CLASS_1 { enum LocalLED : int { VAR_10 = 0, MAX = 1, CLEAN = 2, SPOT = 3, VAR_11 = 4, }; }; struct Sensor { enum LocalSensor : int { ALL = 0, ENVIRONMENT = 1, //cliff, bumper, dirt detectors, motor over-currents. PHYSICAL = 2, //distance, angle, buttons, remote control commands SYSTEM = 3, //voltage, current, battery charge, battery temperature) }; }; class Roomba { public: static const int BAUDRATE = 57600; //static const int BAUDRATE = 19200; Roomba(); //Roomba( BAUD ); ~Roomba(); //TODO It might be good to make a call to the Roomba when a sensor is wanting to be read. //However, it might cause problems for distance and angle. So, maybe not. (Look into it). RoombaSensors getSensor() { return sensors; } /* Roomba SCI Commands */ void FUNC_0(); void setBaud(unsigned char baud); void setMode(unsigned char VAR_12); bool FUNC_1(int sensor_pkt); // Velocity: -500 <> 500 mm/s // Radius: -2000 <> 2000 mm/s // Straight = 32768 // Zero-turn CW: -1 // Zero-turn CCW: 1 void drive(int16_t VAR_13, int16_t radius); void setLED(int led_id, bool state, int pwr_c = -1, int pwr_i = -1); void powerOn(); void powerOff(); void delay(unsigned int howLong); void write(unsigned char VAR_14); void read(int numBytes); //Set the Roomba operating mode. /* setMode( ENUM::MODE ); //Make the Roomba drive at a velocity (mm/s) at a specified radius. drive(int Velocity, int Radius); //A list of the motors to turn on or off. motors( ENUM::MOTORS [] ) //Set the state of the button LEDS on the Roomba leds(); //Write a song, play the song. song(); play(); //Request the sensor data. sensors(); //Force the Roomba to start hunting for its dock. forceSeekingDock(); */ /* Courtesy Functions */ /* //Read the value one of the Roomba sensors. bool/auto getSensor( ENUM::SENSOR ); //Turn the Roomba X degrees (zero-turn) turn(degrees); //Return the current battery voltage. float getBatteryVoltage(); //Calculate the percent power remaining and return. --Might not be possible. (translation. accurate enough to be useful) float getBatteryPercent(); */ private: static const int MAX_SENSOR_BYTES = 26; RoombaSensors sensors; struct CLASS_2 *ftdi; bitset<8> led_bs; int led_pwr_c; int led_pwr_i; void FUNC_2(unsigned int baud); bool setDTR(const int state); //void sleep(unsigned int mseconds); }; /* -------------------- MY ROOMBA END -------------------- */ #endif
0.296505
{'VAR_0': 'Roomba_H', 'IMPORT_0': 'stdlib.h', 'IMPORT_1': 'iostream', 'CLASS_0': 'Opcode', 'VAR_1': 'DRIVE', 'VAR_2': 'SENSOR', 'VAR_3': 'B300', 'VAR_4': 'B600', 'VAR_5': 'B2400', 'VAR_6': 'B14400', 'VAR_7': 'B57600', 'VAR_8': 'CONTROL', 'VAR_9': 'POWER', 'CLASS_1': 'LED', 'VAR_10': 'DIRT_DETECT', 'VAR_11': 'STATUS', 'FUNC_0': 'start', 'VAR_12': 'mode', 'FUNC_1': 'getSensors', 'VAR_13': 'velocity', 'VAR_14': 'cmd', 'CLASS_2': 'ftdi_context', 'FUNC_2': 'setFTDIBaud'}
/* * Convert a base64 string into raw byte array representation. */ static int t_fromb64(unsigned char *a, size_t alen, const char *src) { size_t size = strlen(src); if (size > INT_MAX || (size / 4) * 3 > alen) return -1; return EVP_DecodeBlock(a, (unsigned char *)src, (int)size); }
/* * Convert a base64 string into raw byte array representation. */ static int FUNC_0(unsigned char *a, size_t VAR_0, const char *src) { size_t VAR_1 = strlen(src); if (VAR_1 > INT_MAX || (VAR_1 / 4) * 3 > VAR_0) return -1; return EVP_DecodeBlock(a, (unsigned char *)src, (int)VAR_1); }
0.573987
{'FUNC_0': 't_fromb64', 'VAR_0': 'alen', 'VAR_1': 'size'}
/** * software initialize * * @param flash flash device * * @return result */ static sfud_err software_init(const sfud_flash *flash) { sfud_err result = SFUD_SUCCESS; SFUD_ASSERT(flash); return result; }
/** * software initialize * * @param flash flash device * * @return result */ static CLASS_0 software_init(const sfud_flash *flash) { CLASS_0 VAR_0 = VAR_1; FUNC_0(flash); return VAR_0; }
0.397568
{'CLASS_0': 'sfud_err', 'VAR_0': 'result', 'VAR_1': 'SFUD_SUCCESS', 'FUNC_0': 'SFUD_ASSERT'}
#pragma once #include <cctype> #include <cstdint> #include <cstring> #include <map> #include <string> #include <string_view> #include <unordered_map> #include <unordered_set> #include <common/identifier_ref.h> #include <common/UtilMacros.h> namespace caprica { void identifierToLower(std::string& str); bool caselessEq(std::string_view a, std::string_view b); bool pathEq(std::string_view a, std::string_view b); bool pathEq(std::string_view a, const identifier_ref& b); bool pathEq(const identifier_ref& a, const identifier_ref& b); bool pathEq(std::string_view a, const char* b); bool idEq(const char* a, const char* b); bool idEq(const char* a, const std::string& b); bool idEq(const std::string& a, const char* b); NEVER_INLINE bool idEq(const std::string& a, const std::string& b); NEVER_INLINE bool idEq(std::string_view a, std::string_view b); ALWAYS_INLINE bool idEq(const identifier_ref& a, const identifier_ref& b) { return a.identifierEquals(b); } struct CaselessStringHasher final { size_t operator()(const char* k) const = delete; size_t operator()(const std::string& k) const { return doCaselessHash(k.c_str(), k.size()); } private: friend struct CaselessPathHasher; NEVER_INLINE static size_t doCaselessHash(const char* k, size_t len); }; struct CaselessStringEqual final { bool operator()(const char* lhs, const char* rhs) const = delete; bool operator()(const std::string& lhs, const std::string& rhs) const { return caselessEq(lhs, rhs); } }; struct CaselessPathHasher final { size_t operator()(const std::string& k) const { return doPathHash(k.c_str(), k.size()); } private: NEVER_INLINE static size_t doPathHash(const char* k, size_t len); }; struct CaselessPathEqual final { bool operator()(const std::string& lhs, const std::string& rhs) const { return pathEq(std::string_view(lhs), std::string_view(rhs)); } }; struct CaselessIdentifierHasher final { template<bool isNullTerminated> static uint32_t hash(const char* s, size_t len); size_t operator()(const char* k) const = delete; NEVER_INLINE size_t operator()(const std::string& k) const; NEVER_INLINE size_t operator()(std::string_view k) const; size_t operator()(const identifier_ref& k) const { uint32_t r = k.identifierHash(); return ((size_t)r << 32) | r; } }; extern template uint32_t CaselessIdentifierHasher::hash<true>(const char*, size_t); extern template uint32_t CaselessIdentifierHasher::hash<false>(const char*, size_t); struct CaselessIdentifierEqual final { template<bool isNullTerminated> static bool equal(const char* a, const char* b, size_t len); bool operator()(const char* lhs, const char* rhs) const = delete; bool operator()(const std::string& lhs, const std::string& rhs) const { return idEq(lhs, rhs); } bool operator()(std::string_view lhs, std::string_view rhs) const { return idEq(lhs, rhs); } bool operator()(const identifier_ref& lhs, const identifier_ref& rhs) const { return idEq(lhs, rhs); } }; extern template bool CaselessIdentifierEqual::equal<true>(const char*, const char*, size_t); extern template bool CaselessIdentifierEqual::equal<false>(const char*, const char*, size_t); // These aren't as restricted as identifiers, but must be in the base-ascii // range, and must not contain control characters. using caseless_unordered_set = std::unordered_set<std::string, CaselessStringHasher, CaselessStringEqual>; // The path collections are for UTF-8 encoded strings, and when comparing two, // they are likely to have a long prefix in common. using caseless_unordered_path_set = std::unordered_set<std::string, CaselessPathHasher, CaselessPathEqual>; template<typename V> using caseless_unordered_path_map = typename std::unordered_map<std::string, V, CaselessPathHasher, CaselessPathEqual>; using caseless_unordered_identifier_set = std::unordered_set<std::string, CaselessIdentifierHasher, CaselessIdentifierEqual>; using caseless_unordered_identifier_ref_set = std::unordered_set<identifier_ref, CaselessIdentifierHasher, CaselessIdentifierEqual>; template<typename V> using caseless_unordered_identifier_map = typename std::unordered_map<std::string, V, CaselessIdentifierHasher, CaselessIdentifierEqual>; template<typename V> using caseless_unordered_identifier_ref_map = typename std::unordered_map<identifier_ref, V, CaselessIdentifierHasher, CaselessIdentifierEqual>; }
#pragma once #include <cctype> #include <IMPORT_0> #include <IMPORT_1> #include <map> #include <string> #include <string_view> #include <unordered_map> #include <unordered_set> #include <common/identifier_ref.h> #include <common/UtilMacros.h> namespace caprica { void FUNC_0(std::string& str); bool caselessEq(std::string_view a, std::string_view b); bool pathEq(std::string_view a, std::string_view b); bool pathEq(std::string_view a, const identifier_ref& b); bool pathEq(const identifier_ref& a, const identifier_ref& b); bool pathEq(std::string_view a, const char* b); bool FUNC_1(const char* a, const char* b); bool FUNC_1(const char* a, const std::string& b); bool FUNC_1(const std::string& a, const char* b); NEVER_INLINE VAR_0 FUNC_1(const std::string& a, const std::string& b); NEVER_INLINE VAR_0 FUNC_1(std::string_view a, std::string_view b); ALWAYS_INLINE VAR_0 FUNC_1(const identifier_ref& a, const identifier_ref& b) { return a.identifierEquals(b); } struct CaselessStringHasher final { size_t operator()(const char* k) const = delete; size_t operator()(const std::string& k) const { return doCaselessHash(k.c_str(), k.size()); } private: friend struct CaselessPathHasher; NEVER_INLINE static size_t doCaselessHash(const char* k, size_t len); }; struct CLASS_0 final { bool operator()(const char* lhs, const char* rhs) const = delete; bool operator()(const std::string& lhs, const std::string& rhs) const { return caselessEq(lhs, rhs); } }; struct CaselessPathHasher final { size_t operator()(const std::string& k) const { return doPathHash(k.c_str(), k.size()); } private: NEVER_INLINE static size_t doPathHash(const char* k, size_t len); }; struct CLASS_1 final { bool operator()(const std::string& lhs, const std::string& rhs) const { return pathEq(std::string_view(lhs), std::string_view(rhs)); } }; struct CaselessIdentifierHasher final { template<VAR_0 isNullTerminated> static uint32_t FUNC_2(const char* VAR_4, size_t len); size_t operator()(const char* k) const = delete; NEVER_INLINE size_t operator()(const std::string& k) const; NEVER_INLINE size_t operator()(std::string_view k) const; size_t operator()(const identifier_ref& k) const { uint32_t r = k.FUNC_3(); return ((size_t)r << 32) | r; } }; extern template uint32_t CaselessIdentifierHasher::VAR_3<true>(const char*, size_t)VAR_5; extern template uint32_t CaselessIdentifierHasher::VAR_3<false>(const char*, size_t)VAR_5; struct CaselessIdentifierEqual final { template<VAR_0 isNullTerminated> static bool equal(const char* a, const char* b, size_t len); bool operator()(const char* lhs, const char* rhs) const = delete; bool operator()(const std::string& lhs, const std::string& rhs) const { return FUNC_1(lhs, rhs); } bool operator()(std::string_view lhs, std::string_view rhs) const { return FUNC_1(lhs, rhs); } bool operator()(const identifier_ref& lhs, const identifier_ref& rhs) const { return FUNC_1(lhs, rhs); } }; extern template VAR_0 CaselessIdentifierEqual::equal<true>(const char*, const char*, size_t)VAR_5; extern template VAR_0 CaselessIdentifierEqual::equal<false>(const char*, const char*, size_t)VAR_5; // These aren't as restricted as identifiers, but must be in the base-ascii // range, and must not contain control characters. using caseless_unordered_set = std::unordered_set<std::string, CaselessStringHasher, VAR_1>; // The path collections are for UTF-8 encoded strings, and when comparing two, // they are likely to have a long prefix in common. using caseless_unordered_path_set = std::unordered_set<std::string, CaselessPathHasher, VAR_2>; template<typename V> using caseless_unordered_path_map = typename std::unordered_map<std::string, V, CaselessPathHasher, VAR_2>; using VAR_6 = std::unordered_set<std::string, CaselessIdentifierHasher, CaselessIdentifierEqual>; using VAR_7 = std::unordered_set<identifier_ref, CaselessIdentifierHasher, CaselessIdentifierEqual>; template<typename V> using caseless_unordered_identifier_map = typename std::unordered_map<std::string, V, CaselessIdentifierHasher, CaselessIdentifierEqual>; template<typename V> using caseless_unordered_identifier_ref_map = typename std::unordered_map<identifier_ref, V, CaselessIdentifierHasher, CaselessIdentifierEqual>; }
0.290402
{'IMPORT_0': 'cstdint', 'IMPORT_1': 'cstring', 'FUNC_0': 'identifierToLower', 'FUNC_1': 'idEq', 'VAR_0': 'bool', 'CLASS_0': 'CaselessStringEqual', 'VAR_1': 'CaselessStringEqual', 'CLASS_1': 'CaselessPathEqual', 'VAR_2': 'CaselessPathEqual', 'FUNC_2': 'hash', 'VAR_3': 'hash', 'VAR_4': 's', 'FUNC_3': 'identifierHash', 'VAR_5': '', 'VAR_6': 'caseless_unordered_identifier_set', 'VAR_7': 'caseless_unordered_identifier_ref_set'}
// // WMZFormDelegate.h // WMZForm // // Created by wmz on 2020/5/11. // Copyright © 2020 wmz. All rights reserved. // #import <Foundation/Foundation.h> @class WMZForm,WMZFormRowModel,WMZFormBaseCell; NS_ASSUME_NONNULL_BEGIN @protocol WMZFormDelegate <NSObject> @optional /* *formCell点击 @param cell 所在的cell (cell.model为model cell.indexPath 为其所在的indexPath) */ - (void)form:(WMZForm*)form didSelectRowAtCell:(WMZFormBaseCell*)cell; /* *form提交 @param commitInfo 提交的信息 为一个带value和key的字典 @param success 是否通过检验规则可以提交 */ - (void)form:(WMZForm*)form info:(NSDictionary*)commitInfo canCommit:(BOOL)success; /* *formCell上的view点击 用于cell上的控件的交互事件 @param clickView 点击的view @param cell 所在的cell @param action 根据action判断交互的事件 */ - (void)form:(WMZForm*)form subViewDidSelectRowAtCell:(WMZFormBaseCell*)cell view:(UIView*)clickView type:(id)action; @end NS_ASSUME_NONNULL_END
// // WMZFormDelegate.h // WMZForm // // Created by wmz on 2020/5/11. // Copyright © 2020 wmz. All rights reserved. // #import <Foundation/Foundation.h> @CLASS_0 VAR_0,WMZFormRowModel,VAR_1; NS_ASSUME_NONNULL_BEGIN @VAR_2 WMZFormDelegate <VAR_3> @optional /* *formCell点击 @param cell 所在的cell (cell.model为model cell.indexPath 为其所在的indexPath) */ - (void)VAR_4:(VAR_0*)VAR_4 VAR_5:(VAR_1*)cell; /* *form提交 @param commitInfo 提交的信息 为一个带value和key的字典 @param success 是否通过检验规则可以提交 */ - (void)VAR_4:(VAR_0*)VAR_4 VAR_6:(NSDictionary*)VAR_7 canCommit:(BOOL)VAR_8; /* *formCell上的view点击 用于cell上的控件的交互事件 @param clickView 点击的view @param cell 所在的cell @param action 根据action判断交互的事件 */ - (void)VAR_4:(VAR_0*)VAR_4 subViewDidSelectRowAtCell:(VAR_1*)cell view:(UIView*)VAR_9 VAR_10:(VAR_11)action; @VAR_12 NS_ASSUME_NONNULL_END
0.518725
{'CLASS_0': 'class', 'VAR_0': 'WMZForm', 'VAR_1': 'WMZFormBaseCell', 'VAR_2': 'protocol', 'VAR_3': 'NSObject', 'VAR_4': 'form', 'VAR_5': 'didSelectRowAtCell', 'VAR_6': 'info', 'VAR_7': 'commitInfo', 'VAR_8': 'success', 'VAR_9': 'clickView', 'VAR_10': 'type', 'VAR_11': 'id', 'VAR_12': 'end'}
#include <stdio.h> #define TEST 0 double A[1000][2] = {0}; int max_ratio(int n) { int max_idx = 0, i = 0; for(i = 0; i < n; ++i) { if(A[i][1] > 0) { max_idx = i; break; } } for(i = 0; i < n; ++i) { if( (A[i][1] > 0) && ((A[i][0] / A[i][1]) > (A[max_idx][0] / A[max_idx][1]))) { max_idx = i; } } return max_idx; } double solve(int n, int W) { double value = 0; int i = 0, j = 0, usable_weight = 0; for(; (j < n) && (W > 0); ++j) { i = max_ratio(n); usable_weight = (A[i][1] < W)?A[i][1]:W; value += usable_weight * (A[i][0] / A[i][1]); A[i][1] -= usable_weight; W -= usable_weight; //printf("%f %d %d\n", value, i, W); if(W <= 0) { break; } } return value; } int test() { } int main() { int n = 0, W = 0, res = 0; #if TEST == 0 res = scanf("%d %d", &n, &W); for(int i = 0; i < n; ++i) { res = scanf("%lf %lf", &A[i][0], &A[i][1]); } printf("%.4lf", solve(n, W)); #else test(); #endif return 0; }
#include <IMPORT_0> #define VAR_0 0 double VAR_1[1000][2] = {0}; int FUNC_0(int VAR_2) { int VAR_3 = 0, i = 0; for(i = 0; i < VAR_2; ++i) { if(VAR_1[i][1] > 0) { VAR_3 = i; break; } } for(i = 0; i < VAR_2; ++i) { if( (VAR_1[i][1] > 0) && ((VAR_1[i][0] / VAR_1[i][1]) > (VAR_1[VAR_3][0] / VAR_1[VAR_3][1]))) { VAR_3 = i; } } return VAR_3; } double FUNC_1(int VAR_2, int W) { double value = 0; int i = 0, j = 0, usable_weight = 0; for(; (j < VAR_2) && (W > 0); ++j) { i = FUNC_0(VAR_2); usable_weight = (VAR_1[i][1] < W)?VAR_1[i][1]:W; value += usable_weight * (VAR_1[i][0] / VAR_1[i][1]); VAR_1[i][1] -= usable_weight; W -= usable_weight; //printf("%f %d %d\n", value, i, W); if(W <= 0) { break; } } return value; } int test() { } int FUNC_2() { int VAR_2 = 0, W = 0, VAR_4 = 0; #if VAR_0 == 0 VAR_4 = FUNC_3("%d %d", &VAR_2, &W); for(int i = 0; i < VAR_2; ++i) { VAR_4 = FUNC_3("%lf %lf", &VAR_1[i][0], &VAR_1[i][1]); } printf("%.4lf", FUNC_1(VAR_2, W)); #else test(); #endif return 0; }
0.518286
{'IMPORT_0': 'stdio.h', 'VAR_0': 'TEST', 'VAR_1': 'A', 'FUNC_0': 'max_ratio', 'VAR_2': 'n', 'VAR_3': 'max_idx', 'FUNC_1': 'solve', 'FUNC_2': 'main', 'VAR_4': 'res', 'FUNC_3': 'scanf'}
/* * Intel(R) Processor Trace PMU driver for perf * Copyright (c) 2013-2014, 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. * * Intel PT is specified in the Intel Architecture Instruction Set Extensions * Programming Reference: * http://software.intel.com/en-us/intel-isa-extensions */ #ifndef __INTEL_PT_H__ #define __INTEL_PT_H__ /* * Single-entry ToPA: when this close to region boundary, switch * buffers to avoid losing data. */ #define TOPA_PMI_MARGIN 512 /* * Table of Physical Addresses bits */ enum topa_sz { TOPA_4K = 0, TOPA_8K, TOPA_16K, TOPA_32K, TOPA_64K, TOPA_128K, TOPA_256K, TOPA_512K, TOPA_1MB, TOPA_2MB, TOPA_4MB, TOPA_8MB, TOPA_16MB, TOPA_32MB, TOPA_64MB, TOPA_128MB, TOPA_SZ_END, }; static inline unsigned int sizes(enum topa_sz tsz) { return 1 << (tsz + 12); }; struct topa_entry { u64 end : 1; u64 rsvd0 : 1; u64 intr : 1; u64 rsvd1 : 1; u64 stop : 1; u64 rsvd2 : 1; u64 size : 4; u64 rsvd3 : 2; u64 base : 36; u64 rsvd4 : 16; }; #define TOPA_SHIFT 12 #define PT_CPUID_LEAVES 2 enum pt_capabilities { PT_CAP_max_subleaf = 0, PT_CAP_cr3_filtering, PT_CAP_topa_output, PT_CAP_topa_multiple_entries, PT_CAP_payloads_lip, }; struct pt_pmu { struct pmu pmu; u32 caps[4 * PT_CPUID_LEAVES]; }; /** * struct pt_buffer - buffer configuration; one buffer per task_struct or * cpu, depending on perf event configuration * @cpu: cpu for per-cpu allocation * @tables: list of ToPA tables in this buffer * @first: shorthand for first topa table * @last: shorthand for last topa table * @cur: current topa table * @nr_pages: buffer size in pages * @cur_idx: current output region's index within @cur table * @output_off: offset within the current output region * @data_size: running total of the amount of data in this buffer * @lost: if data was lost/truncated * @head: logical write offset inside the buffer * @snapshot: if this is for a snapshot/overwrite counter * @stop_pos: STOP topa entry in the buffer * @intr_pos: INT topa entry in the buffer * @data_pages: array of pages from perf * @topa_index: table of topa entries indexed by page offset */ struct pt_buffer { int cpu; struct list_head tables; struct topa *first, *last, *cur; unsigned int cur_idx; size_t output_off; unsigned long nr_pages; local_t data_size; local_t lost; local64_t head; bool snapshot; unsigned long stop_pos, intr_pos; void **data_pages; struct topa_entry *topa_index[0]; }; /** * struct pt - per-cpu pt context * @handle: perf output handle * @handle_nmi: do handle PT PMI on this cpu, there's an active event */ struct pt { struct perf_output_handle handle; int handle_nmi; }; #endif /* __INTEL_PT_H__ */
/* * Intel(R) Processor Trace PMU driver for perf * Copyright (c) 2013-2014, 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. * * Intel PT is specified in the Intel Architecture Instruction Set Extensions * Programming Reference: * http://software.intel.com/en-us/intel-isa-extensions */ #ifndef VAR_0 #define VAR_0 /* * Single-entry ToPA: when this close to region boundary, switch * buffers to avoid losing data. */ #define TOPA_PMI_MARGIN 512 /* * Table of Physical Addresses bits */ enum CLASS_0 { TOPA_4K = 0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, TOPA_256K, TOPA_512K, TOPA_1MB, VAR_6, TOPA_4MB, VAR_7, TOPA_16MB, VAR_8, VAR_9, VAR_10, VAR_11, }; static inline unsigned int FUNC_0(enum CLASS_0 VAR_12) { return 1 << (VAR_12 + 12); }; struct topa_entry { CLASS_1 VAR_13 : 1; CLASS_1 VAR_14 : 1; CLASS_1 VAR_15 : 1; CLASS_1 VAR_16 : 1; CLASS_1 VAR_17 : 1; CLASS_1 rsvd2 : 1; CLASS_1 VAR_18 : 4; CLASS_1 rsvd3 : 2; CLASS_1 VAR_19 : 36; CLASS_1 rsvd4 : 16; }; #define VAR_20 12 #define VAR_21 2 enum CLASS_2 { VAR_22 = 0, VAR_23, VAR_24, PT_CAP_topa_multiple_entries, VAR_25, }; struct CLASS_3 { struct CLASS_4 VAR_26; CLASS_5 VAR_27[4 * VAR_21]; }; /** * struct pt_buffer - buffer configuration; one buffer per task_struct or * cpu, depending on perf event configuration * @cpu: cpu for per-cpu allocation * @tables: list of ToPA tables in this buffer * @first: shorthand for first topa table * @last: shorthand for last topa table * @cur: current topa table * @nr_pages: buffer size in pages * @cur_idx: current output region's index within @cur table * @output_off: offset within the current output region * @data_size: running total of the amount of data in this buffer * @lost: if data was lost/truncated * @head: logical write offset inside the buffer * @snapshot: if this is for a snapshot/overwrite counter * @stop_pos: STOP topa entry in the buffer * @intr_pos: INT topa entry in the buffer * @data_pages: array of pages from perf * @topa_index: table of topa entries indexed by page offset */ struct CLASS_6 { int VAR_28; struct list_head VAR_29; struct CLASS_7 *VAR_30, *last, *VAR_31; unsigned int VAR_32; size_t VAR_33; unsigned long VAR_34; CLASS_8 VAR_35; CLASS_8 VAR_36; CLASS_9 VAR_37; bool snapshot; unsigned long VAR_38, VAR_39; void **VAR_40; struct topa_entry *topa_index[0]; }; /** * struct pt - per-cpu pt context * @handle: perf output handle * @handle_nmi: do handle PT PMI on this cpu, there's an active event */ struct CLASS_10 { struct CLASS_11 VAR_41; int VAR_42; }; #endif /* __INTEL_PT_H__ */
0.737393
{'VAR_0': '__INTEL_PT_H__', 'CLASS_0': 'topa_sz', 'VAR_1': 'TOPA_8K', 'VAR_2': 'TOPA_16K', 'VAR_3': 'TOPA_32K', 'VAR_4': 'TOPA_64K', 'VAR_5': 'TOPA_128K', 'VAR_6': 'TOPA_2MB', 'VAR_7': 'TOPA_8MB', 'VAR_8': 'TOPA_32MB', 'VAR_9': 'TOPA_64MB', 'VAR_10': 'TOPA_128MB', 'VAR_11': 'TOPA_SZ_END', 'FUNC_0': 'sizes', 'VAR_12': 'tsz', 'CLASS_1': 'u64', 'VAR_13': 'end', 'VAR_14': 'rsvd0', 'VAR_15': 'intr', 'VAR_16': 'rsvd1', 'VAR_17': 'stop', 'VAR_18': 'size', 'VAR_19': 'base', 'VAR_20': 'TOPA_SHIFT', 'VAR_21': 'PT_CPUID_LEAVES', 'CLASS_2': 'pt_capabilities', 'VAR_22': 'PT_CAP_max_subleaf', 'VAR_23': 'PT_CAP_cr3_filtering', 'VAR_24': 'PT_CAP_topa_output', 'VAR_25': 'PT_CAP_payloads_lip', 'CLASS_3': 'pt_pmu', 'CLASS_4': 'pmu', 'VAR_26': 'pmu', 'CLASS_5': 'u32', 'VAR_27': 'caps', 'CLASS_6': 'pt_buffer', 'VAR_28': 'cpu', 'VAR_29': 'tables', 'CLASS_7': 'topa', 'VAR_30': 'first', 'VAR_31': 'cur', 'VAR_32': 'cur_idx', 'VAR_33': 'output_off', 'VAR_34': 'nr_pages', 'CLASS_8': 'local_t', 'VAR_35': 'data_size', 'VAR_36': 'lost', 'CLASS_9': 'local64_t', 'VAR_37': 'head', 'VAR_38': 'stop_pos', 'VAR_39': 'intr_pos', 'VAR_40': 'data_pages', 'CLASS_10': 'pt', 'CLASS_11': 'perf_output_handle', 'VAR_41': 'handle', 'VAR_42': 'handle_nmi'}
// // yas_ui_strings.h // #pragma once #include <ui/yas_ui_font_atlas.h> #include <ui/yas_ui_layout_guide.h> #include <ui/yas_ui_layout_types.h> #include <ui/yas_ui_rect_plane.h> #include <ui/yas_ui_strings_types.h> namespace yas::ui { struct strings final { void set_text(std::string); void set_line_height(std::optional<float>); void set_alignment(ui::layout_alignment const); [[nodiscard]] std::string const &text() const; [[nodiscard]] std::shared_ptr<ui::font_atlas> const &font_atlas() const; [[nodiscard]] std::optional<float> const &line_height() const; [[nodiscard]] ui::layout_alignment const &alignment() const; [[nodiscard]] region actual_frame() const; [[nodiscard]] std::shared_ptr<layout_region_guide> const &preferred_layout_guide() const; [[nodiscard]] std::shared_ptr<layout_region_source> actual_layout_source() const; [[nodiscard]] std::shared_ptr<rect_plane> const &rect_plane(); [[nodiscard]] observing::syncable observe_text(observing::caller<std::string>::handler_f &&); [[nodiscard]] observing::syncable observe_line_height(observing::caller<std::optional<float>>::handler_f &&); [[nodiscard]] observing::syncable observe_alignment(observing::caller<ui::layout_alignment>::handler_f &&); [[nodiscard]] static std::shared_ptr<strings> make_shared(strings_args &&, std::shared_ptr<ui::font_atlas> const &); private: std::shared_ptr<ui::collection_layout> const _collection_layout; std::string _collection_text; std::shared_ptr<ui::rect_plane> const _rect_plane; observing::value::holder_ptr<std::string> const _text; std::shared_ptr<ui::font_atlas> const _font_atlas; observing::value::holder_ptr<std::optional<float>> const _line_height; std::size_t const _max_word_count = 0; observing::canceller_pool _pool; explicit strings(strings_args &&, std::shared_ptr<ui::font_atlas> const &); strings(strings const &) = delete; strings(strings &&) = delete; strings &operator=(strings const &) = delete; strings &operator=(strings &&) = delete; void _prepare_observings(); void _update_collection_layout(); void _update_vertices(); float _cell_height(); }; } // namespace yas::ui
// // yas_ui_strings.h // #pragma once #include <IMPORT_0> #include <IMPORT_1> #include <IMPORT_2> #include <IMPORT_3> #include <ui/yas_ui_strings_types.h> CLASS_0 VAR_0::VAR_1 { struct CLASS_2 VAR_3 { void FUNC_1(CLASS_3::VAR_5); void FUNC_2(CLASS_3::VAR_6<float>); void FUNC_3(CLASS_1::VAR_7 VAR_8); [[VAR_9]] std::VAR_5 VAR_8 &FUNC_4() VAR_8; [[VAR_9]] std::shared_ptr<VAR_1::VAR_10> VAR_8 &FUNC_5() VAR_8; [[VAR_9]] std::VAR_6<VAR_11> VAR_8 &FUNC_6() VAR_8; [[VAR_9]] ui::VAR_7 VAR_8 &FUNC_7() VAR_8; [[VAR_9]] CLASS_4 FUNC_8() const; [[VAR_9]] CLASS_3::shared_ptr<VAR_12> const &FUNC_9() VAR_8; [[VAR_9]] CLASS_3::shared_ptr<VAR_13> FUNC_10() VAR_8; [[VAR_9]] CLASS_3::shared_ptr<VAR_14> const &FUNC_11(); [[VAR_9]] CLASS_5::VAR_15 FUNC_12(CLASS_5::VAR_16<VAR_4::VAR_5>::VAR_17 &&); [[VAR_9]] CLASS_5::VAR_15 FUNC_13(CLASS_5::VAR_16<VAR_4::VAR_6<float>>::VAR_17 &&); [[VAR_9]] CLASS_5::VAR_15 FUNC_14(CLASS_5::VAR_16<VAR_1::VAR_7>::VAR_17 &&); [[VAR_9]] static CLASS_3::shared_ptr<VAR_2> FUNC_15(CLASS_6 &&, CLASS_3::shared_ptr<VAR_1::VAR_10> const &); CLASS_7: VAR_4::shared_ptr<VAR_1::VAR_18> const VAR_19; CLASS_3::VAR_5 VAR_20; CLASS_3::shared_ptr<VAR_1::VAR_14> const VAR_21; CLASS_5::VAR_22::VAR_23<VAR_4::VAR_5> const VAR_24; CLASS_3::shared_ptr<VAR_1::VAR_10> const VAR_25; CLASS_5::VAR_22::VAR_23<VAR_4::VAR_6<float>> const VAR_26; CLASS_3::size_t const VAR_27 = 0; CLASS_5::VAR_28 VAR_29; CLASS_8 FUNC_0(CLASS_6 &&, CLASS_3::shared_ptr<VAR_1::VAR_10> const &); VAR_2(CLASS_2 const &) = VAR_30; VAR_2(ID_0 &&) = VAR_30; CLASS_2 &VAR_31=(CLASS_2 const &) = VAR_30; CLASS_2 &VAR_31=(VAR_2 &&VAR_32) = VAR_30; void FUNC_16(); void FUNC_17(); void FUNC_18(); float FUNC_19(); }; } // namespace yas::ui
0.96067
{'IMPORT_0': 'ui/yas_ui_font_atlas.h', 'IMPORT_1': 'ui/yas_ui_layout_guide.h', 'IMPORT_2': 'ui/yas_ui_layout_types.h', 'IMPORT_3': 'ui/yas_ui_rect_plane.h', 'CLASS_0': 'namespace', 'VAR_0': 'yas', 'VAR_1': 'ui', 'CLASS_1': 'ui', 'CLASS_2': 'strings', 'VAR_2': 'strings', 'FUNC_0': 'strings', 'ID_0': 'strings', 'VAR_3': 'final', 'FUNC_1': 'set_text', 'CLASS_3': 'std', 'VAR_4': 'std', 'VAR_5': 'string', 'FUNC_2': 'set_line_height', 'VAR_6': 'optional', 'FUNC_3': 'set_alignment', 'VAR_7': 'layout_alignment', 'VAR_8': 'const', 'VAR_9': 'nodiscard', 'FUNC_4': 'text', 'VAR_10': 'font_atlas', 'FUNC_5': 'font_atlas', 'VAR_11': 'float', 'FUNC_6': 'line_height', 'FUNC_7': 'alignment', 'CLASS_4': 'region', 'FUNC_8': 'actual_frame', 'VAR_12': 'layout_region_guide', 'FUNC_9': 'preferred_layout_guide', 'VAR_13': 'layout_region_source', 'FUNC_10': 'actual_layout_source', 'VAR_14': 'rect_plane', 'FUNC_11': 'rect_plane', 'CLASS_5': 'observing', 'VAR_15': 'syncable', 'FUNC_12': 'observe_text', 'VAR_16': 'caller', 'VAR_17': 'handler_f', 'FUNC_13': 'observe_line_height', 'FUNC_14': 'observe_alignment', 'FUNC_15': 'make_shared', 'CLASS_6': 'strings_args', 'CLASS_7': 'private', 'VAR_18': 'collection_layout', 'VAR_19': '_collection_layout', 'VAR_20': '_collection_text', 'VAR_21': '_rect_plane', 'VAR_22': 'value', 'VAR_23': 'holder_ptr', 'VAR_24': '_text', 'VAR_25': '_font_atlas', 'VAR_26': '_line_height', 'VAR_27': '_max_word_count', 'VAR_28': 'canceller_pool', 'VAR_29': '_pool', 'CLASS_8': 'explicit', 'VAR_30': 'delete', 'VAR_31': 'operator', 'VAR_32': '', 'FUNC_16': '_prepare_observings', 'FUNC_17': '_update_collection_layout', 'FUNC_18': '_update_vertices', 'FUNC_19': '_cell_height'}