blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
721
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
57
| license_type
stringclasses 2
values | repo_name
stringlengths 5
91
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 321
values | visit_date
timestamp[ns]date 2016-08-12 09:31:09
2023-09-06 10:45:07
| revision_date
timestamp[ns]date 2010-09-28 14:01:40
2023-09-06 06:22:19
| committer_date
timestamp[ns]date 2010-09-28 14:01:40
2023-09-06 06:22:19
| github_id
int64 426
681M
| star_events_count
int64 101
243k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 23
values | gha_event_created_at
timestamp[ns]date 2012-06-28 18:51:49
2023-09-14 21:59:16
⌀ | gha_created_at
timestamp[ns]date 2008-02-11 22:55:26
2023-08-10 11:14:58
⌀ | gha_language
stringclasses 147
values | src_encoding
stringclasses 26
values | language
stringclasses 2
values | is_vendor
bool 2
classes | is_generated
bool 2
classes | length_bytes
int64 6
10.2M
| extension
stringclasses 115
values | filename
stringlengths 3
113
| content
stringlengths 6
10.2M
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2b533c4fae882446a05f794d5e57f95ea47ceab1
|
78297bc868d588dd7a16cfea059ef7365ba18622
|
/lib/api/include/irods/dataObjTruncate.h
|
a095bfd95f24f277f9e4656ae2340ad99fc7a818
|
[
"BSD-3-Clause"
] |
permissive
|
irods/irods
|
ab72a41fdf05a4a905c3e3a97bb7ba3c2a6ae52d
|
f3ccaa842218e477395ebcf553639134433b63ee
|
refs/heads/main
| 2023-09-01T20:12:33.322002
| 2023-08-23T18:22:59
| 2023-08-31T13:41:31
| 14,724,975
| 381
| 167
|
NOASSERTION
| 2023-09-11T18:18:14
| 2013-11-26T18:10:18
|
C++
|
UTF-8
|
C
| false
| false
| 613
|
h
|
dataObjTruncate.h
|
#ifndef DATA_OBJ_TRUNCATE_H__
#define DATA_OBJ_TRUNCATE_H__
#include "irods/rcConnect.h"
#include "irods/dataObjInpOut.h"
#include "irods/objInfo.h"
/* rcDataObjTruncate - Truncate a iRODS data object.
* Input -
* rcComm_t *conn - The client connection handle.
* dataObjInp_t *dataObjInp - generic dataObj input. Relevant items are:
* objPath - the path of the data object.
* dataSize - the size to truncate to
*
* OutPut -
* return value - The status of the operation.
*/
#ifdef __cplusplus
extern "C"
#endif
int rcDataObjTruncate( rcComm_t *conn, dataObjInp_t *dataObjInp );
#endif
|
326fe88d6d74c608aec6c9d4ea23631c099510da
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/arch/powerpc/include/asm/fadump.h
|
88dbf9659185f65725f403a885313c8ff278040f
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 6,053
|
h
|
fadump.h
|
/*
* Firmware Assisted dump header file.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright 2011 IBM Corporation
* Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
*/
#ifndef __PPC64_FA_DUMP_H__
#define __PPC64_FA_DUMP_H__
#ifdef CONFIG_FA_DUMP
/*
* The RMA region will be saved for later dumping when kernel crashes.
* RMA is Real Mode Area, the first block of logical memory address owned
* by logical partition, containing the storage that may be accessed with
* translate off.
*/
#define RMA_START 0x0
#define RMA_END (ppc64_rma_size)
/*
* On some Power systems where RMO is 128MB, it still requires minimum of
* 256MB for kernel to boot successfully. When kdump infrastructure is
* configured to save vmcore over network, we run into OOM issue while
* loading modules related to network setup. Hence we need aditional 64M
* of memory to avoid OOM issue.
*/
#define MIN_BOOT_MEM (((RMA_END < (0x1UL << 28)) ? (0x1UL << 28) : RMA_END) \
+ (0x1UL << 26))
#define memblock_num_regions(memblock_type) (memblock.memblock_type.cnt)
#ifndef ELF_CORE_EFLAGS
#define ELF_CORE_EFLAGS 0
#endif
/* Firmware provided dump sections */
#define FADUMP_CPU_STATE_DATA 0x0001
#define FADUMP_HPTE_REGION 0x0002
#define FADUMP_REAL_MODE_REGION 0x0011
/* Dump request flag */
#define FADUMP_REQUEST_FLAG 0x00000001
/* FAD commands */
#define FADUMP_REGISTER 1
#define FADUMP_UNREGISTER 2
#define FADUMP_INVALIDATE 3
/* Dump status flag */
#define FADUMP_ERROR_FLAG 0x2000
#define FADUMP_CPU_ID_MASK ((1UL << 32) - 1)
#define CPU_UNKNOWN (~((u32)0))
/* Utility macros */
#define SKIP_TO_NEXT_CPU(reg_entry) \
({ \
while (reg_entry->reg_id != REG_ID("CPUEND")) \
reg_entry++; \
reg_entry++; \
})
/* Kernel Dump section info */
struct fadump_section {
u32 request_flag;
u16 source_data_type;
u16 error_flags;
u64 source_address;
u64 source_len;
u64 bytes_dumped;
u64 destination_address;
};
/* ibm,configure-kernel-dump header. */
struct fadump_section_header {
u32 dump_format_version;
u16 dump_num_sections;
u16 dump_status_flag;
u32 offset_first_dump_section;
/* Fields for disk dump option. */
u32 dd_block_size;
u64 dd_block_offset;
u64 dd_num_blocks;
u32 dd_offset_disk_path;
/* Maximum time allowed to prevent an automatic dump-reboot. */
u32 max_time_auto;
};
/*
* Firmware Assisted dump memory structure. This structure is required for
* registering future kernel dump with power firmware through rtas call.
*
* No disk dump option. Hence disk dump path string section is not included.
*/
struct fadump_mem_struct {
struct fadump_section_header header;
/* Kernel dump sections */
struct fadump_section cpu_state_data;
struct fadump_section hpte_region;
struct fadump_section rmr_region;
};
/* Firmware-assisted dump configuration details. */
struct fw_dump {
unsigned long cpu_state_data_size;
unsigned long hpte_region_size;
unsigned long boot_memory_size;
unsigned long reserve_dump_area_start;
unsigned long reserve_dump_area_size;
/* cmd line option during boot */
unsigned long reserve_bootvar;
unsigned long fadumphdr_addr;
unsigned long cpu_notes_buf;
unsigned long cpu_notes_buf_size;
int ibm_configure_kernel_dump;
unsigned long fadump_enabled:1;
unsigned long fadump_supported:1;
unsigned long dump_active:1;
unsigned long dump_registered:1;
};
/*
* Copy the ascii values for first 8 characters from a string into u64
* variable at their respective indexes.
* e.g.
* The string "FADMPINF" will be converted into 0x4641444d50494e46
*/
static inline u64 str_to_u64(const char *str)
{
u64 val = 0;
int i;
for (i = 0; i < sizeof(val); i++)
val = (*str) ? (val << 8) | *str++ : val << 8;
return val;
}
#define STR_TO_HEX(x) str_to_u64(x)
#define REG_ID(x) str_to_u64(x)
#define FADUMP_CRASH_INFO_MAGIC STR_TO_HEX("FADMPINF")
#define REGSAVE_AREA_MAGIC STR_TO_HEX("REGSAVE")
/* The firmware-assisted dump format.
*
* The register save area is an area in the partition's memory used to preserve
* the register contents (CPU state data) for the active CPUs during a firmware
* assisted dump. The dump format contains register save area header followed
* by register entries. Each list of registers for a CPU starts with
* "CPUSTRT" and ends with "CPUEND".
*/
/* Register save area header. */
struct fadump_reg_save_area_header {
u64 magic_number;
u32 version;
u32 num_cpu_offset;
};
/* Register entry. */
struct fadump_reg_entry {
u64 reg_id;
u64 reg_value;
};
/* fadump crash info structure */
struct fadump_crash_info_header {
u64 magic_number;
u64 elfcorehdr_addr;
u32 crashing_cpu;
struct pt_regs regs;
struct cpumask cpu_online_mask;
};
/* Crash memory ranges */
#define INIT_CRASHMEM_RANGES (INIT_MEMBLOCK_REGIONS + 2)
struct fad_crash_memory_ranges {
unsigned long long base;
unsigned long long size;
};
extern int early_init_dt_scan_fw_dump(unsigned long node,
const char *uname, int depth, void *data);
extern int fadump_reserve_mem(void);
extern int setup_fadump(void);
extern int is_fadump_active(void);
extern void crash_fadump(struct pt_regs *, const char *);
extern void fadump_cleanup(void);
extern void vmcore_cleanup(void);
#else /* CONFIG_FA_DUMP */
static inline int is_fadump_active(void) { return 0; }
static inline void crash_fadump(struct pt_regs *regs, const char *str) { }
#endif
#endif
|
9316f57d024659131cacb8965b391189fb7d816b
|
92b628fb4c7a927fb95298b9da7ef3727ed1fce0
|
/autotest/api/apiTestInMemoryDem.c
|
f4177e26e94e2138fe5ba69c51ddb5fc7e62bd32
|
[
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] |
permissive
|
firelab/windninja
|
a7e2cf65a128ad36d471db77cafdbd6cf1553edc
|
2c971aeeaa66b7f2614d895eaac23f9cd537d974
|
refs/heads/master
| 2023-08-09T18:05:17.322838
| 2023-07-24T18:47:44
| 2023-07-24T18:47:44
| 23,202,166
| 102
| 40
|
NOASSERTION
| 2023-07-24T18:41:21
| 2014-08-21T20:36:33
|
C++
|
UTF-8
|
C
| false
| false
| 9,633
|
c
|
apiTestInMemoryDem.c
|
/******************************************************************************
*
* Project: WindNinja
* Purpose: C API testing
* Author: Natalie Wagenbrenner <nwagenbrenner@gmail.com>
*
* g++ -g -Wall -o test_dem apiTestInMemoryDem.c -lninja -lgdal
*
******************************************************************************
*
* THIS SOFTWARE WAS DEVELOPED AT THE ROCKY MOUNTAIN RESEARCH STATION (RMRS)
* MISSOULA FIRE SCIENCES LABORATORY BY EMPLOYEES OF THE FEDERAL GOVERNMENT
* IN THE COURSE OF THEIR OFFICIAL DUTIES. PURSUANT TO TITLE 17 SECTION 105
* OF THE UNITED STATES CODE, THIS SOFTWARE IS NOT SUBJECT TO COPYRIGHT
* PROTECTION AND IS IN THE PUBLIC DOMAIN. RMRS MISSOULA FIRE SCIENCES
* LABORATORY ASSUMES NO RESPONSIBILITY WHATSOEVER FOR ITS USE BY OTHER
* PARTIES, AND MAKES NO GUARANTEES, EXPRESSED OR IMPLIED, ABOUT ITS QUALITY,
* RELIABILITY, OR ANY OTHER CHARACTERISTIC.
*
* 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 "windninja.h"
#include <stdio.h>
#include "gdal.h"
#include "cpl_conv.h"
int main()
{
NinjaH* ninjaArmy = NULL;
int numNinjas = 2;
const char* comType = "quiet";
char** papszOptions = NULL;
NinjaErr err = 0;
/* inputs that apply to the whole army (must be the same for all ninjas) */
const int nCPUs = 1;
int momentumFlag = 0;
const char* demFile = "/home/natalie/src/windninja/api_testing/big_butte_small.tif";
const char* outputPath = "/home/natalie/src/windninja/api_testing/";
const char* initializationMethod = "domain_average";
const int diurnalFlag = 0;
const char* meshChoice = "coarse";
const char* vegetation = "grass";
const int nLayers = 20; //layers in the mesh
const int meshCount = 100000; //number of cells in the mesh (cfd runs only)
const char* speedUnits = "mps";
const double height = 5.0;
const char* heightUnits = "m";
const int googOutFlag = 1;
const double* outputSpeedGrid = NULL;
const double* outputDirectionGrid = NULL;
const char* outputGridProjection = NULL;
const int nIndex = 0;
/* inputs that can vary among ninjas in an army */
const double speed[2] = {5.5, 5.5};
const double direction[2] = {220, 300};
/* output grid data */
double cellSize;
double xllCorner;
double yllCorner;
int nCols;
int nRows;
/* for setting the in-memory DEM */
GDALDatasetH hDataset;
int nXSize;
int nYSize;
double adfGeoTransform[6];
const char* prj = NULL;
double adfCorner[2];
double* padfScanline;
double* demValues = NULL;
/*-------------set an in-memory DEM-------------*/
GDALAllRegister();
hDataset = GDALOpen( demFile, GA_ReadOnly );
nXSize = GDALGetRasterXSize( hDataset );
nYSize = GDALGetRasterYSize( hDataset );
GDALGetGeoTransform( hDataset, adfGeoTransform );
prj = GDALGetProjectionRef( hDataset );
//find llcorner
adfCorner[0] = adfGeoTransform[0];
adfCorner[1] = adfGeoTransform[3] + ( nYSize * adfGeoTransform[5] );
printf("llcorner = %f, %f\n", adfCorner[0], adfCorner[1]);
printf("prj = %s\n", prj);
GDALRasterBandH hBand;
hBand = GDALGetRasterBand( hDataset, 1 );
padfScanline = (double *) CPLMalloc(sizeof(double)*nXSize);
demValues = new double[nXSize * nYSize];
for(int i = nYSize - 1; i >= 0; i--)
{
GDALRasterIO( hBand, GF_Read, 0, i, nXSize, 1,
padfScanline, nXSize, 1, GDT_Float64,
0, 0 );
for(int j = 0; j < nXSize; j++)
{
demValues[ j + nXSize*(nYSize-i-1) ] = padfScanline[j];
}
}
printf("demValues = %f, %f, %f\n", demValues[0], demValues[1], demValues[300]);
printf("nXSize, nYSize = %d, %d\n", nXSize, nYSize);
/*-------------create the army-------------*/
ninjaArmy = NinjaCreateArmy(numNinjas, momentumFlag, papszOptions);
if( NULL == ninjaArmy )
{
printf("NinjaCreateArmy: ninjaArmy = NULL\n");
}
err = NinjaInit();
if(err != NINJA_SUCCESS)
{
printf("NinjaInit: err = %d\n", err);
}
/*-------------set up the runs-------------*/
for(int i=0; i<numNinjas; i++)
{
err = NinjaSetCommunication(ninjaArmy, i, comType);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetCommunication: err = %d\n", err);
}
err = NinjaSetNumberCPUs(ninjaArmy, i, nCPUs);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetNumberCPUs: err = %d\n", err);
}
err = NinjaSetInitializationMethod(ninjaArmy, i, initializationMethod);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetInitializationMethod: err = %d\n", err);
}
//outputPath must be set if writing output to disk and using an in-memory DEM
err = NinjaSetOutputPath(ninjaArmy, i, outputPath);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetOutputPath: err = %d\n", err);
}
err = NinjaSetInMemoryDem(ninjaArmy, i, demValues, nXSize, nYSize, adfGeoTransform, prj);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetInMemoryDem: err = %d\n", err);
}
// err = NinjaSetDem(ninjaArmy, i, demFile);
// if(err != NINJA_SUCCESS)
// {
// printf("NinjaSetDem: err = %d\n", err);
// }
// err = NinjaSetPosition(ninjaArmy, i);
// if(err != NINJA_SUCCESS)
// {
// printf("NinjaSetPosition: err = %d\n", err);
// }
err = NinjaSetInputSpeed(ninjaArmy, i, speed[i], speedUnits);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetInputSpeed: err = %d\n", err);
}
err = NinjaSetInputDirection(ninjaArmy, i, direction[i]);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetInputDirection: err = %d\n", err);
}
err = NinjaSetInputWindHeight(ninjaArmy, i, height, heightUnits);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetInputWindHeight: err = %d\n", err);
}
err = NinjaSetOutputWindHeight(ninjaArmy, i, height, heightUnits);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetOutputWindHeight: err = %d\n", err);
}
err = NinjaSetOutputSpeedUnits(ninjaArmy, i, speedUnits);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetOutputSpeedUnits: err = %d\n", err);
}
err = NinjaSetDiurnalWinds(ninjaArmy, i, diurnalFlag);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetDiurnalWinds: err = %d\n", err);
}
err = NinjaSetUniVegetation(ninjaArmy, i, vegetation);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetUniVegetation: err = %d\n", err);
}
err = NinjaSetMeshResolutionChoice(ninjaArmy, i, meshChoice);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetMeshResolutionChoice: err = %d\n", err);
}
err = NinjaSetGoogOutFlag(ninjaArmy, i, googOutFlag);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetGoogOutFlag: err = %d\n", err);
}
err = NinjaSetNumVertLayers(ninjaArmy, i, nLayers);
if(err != NINJA_SUCCESS)
{
printf("NinjaSetNumVertLayers: err = %d\n", err);
}
}
/*-------------start the runs-------------*/
err = NinjaStartRuns(ninjaArmy, nCPUs);
if(err != 1) //NinjaStartRuns returns 1 on success
{
printf("NinjaStartRuns: err = %d\n", err);
}
/*-------------get the output wind speed and direction data-------------*/
outputSpeedGrid = NinjaGetOutputSpeedGrid(ninjaArmy, nIndex);
if( NULL == outputSpeedGrid )
{
printf("Error in NinjaGetOutputSpeedGrid");
}
outputDirectionGrid = NinjaGetOutputDirectionGrid(ninjaArmy, nIndex);
if( NULL == outputDirectionGrid )
{
printf("Error in NinjaGetOutputDirectionGrid");
}
outputGridProjection = NinjaGetOutputGridProjection(ninjaArmy, nIndex);
if( NULL == outputGridProjection )
{
printf("Error in NinjaGetOutputGridProjection");
}
prj = NinjaGetOutputGridProjection(ninjaArmy, nIndex);
cellSize = NinjaGetOutputGridCellSize(ninjaArmy, nIndex);
xllCorner = NinjaGetOutputGridxllCorner(ninjaArmy, nIndex);
yllCorner = NinjaGetOutputGridyllCorner(ninjaArmy, nIndex);
nCols = NinjaGetOutputGridnCols(ninjaArmy, nIndex);
nRows = NinjaGetOutputGridnRows(ninjaArmy, nIndex);
printf("outputspeed[0] = %f\n", outputSpeedGrid[0]);
printf("cellSize = %f\n", cellSize);
printf("xllCorner = %f\n", xllCorner);
printf("yllCorner = %f\n", yllCorner);
printf("nCols = %d\n", nCols);
printf("nRows = %d\n", nRows);
/*-------------clean up-------------*/
err = NinjaDestroyArmy(ninjaArmy);
if(err != NINJA_SUCCESS)
{
printf("NinjaDestroyRuns: err = %d\n", err);
}
delete [] demValues;
demValues = NULL;
CPLFree( padfScanline );
GDALClose( hDataset );
return NINJA_SUCCESS;
}
|
e4c4ef98486c73dc5785c7554339801000382f74
|
9c79cdcc17728f366a83c56be89fb4611d7cfa2e
|
/Bluefruit/External Tools/iOSMagick-6.8.8-9-libs/include/magick/option.h
|
1440cffffaff71f5263ff8364f3c8baf88d50776
|
[
"MIT"
] |
permissive
|
adafruit/Bluefruit_LE_Connect_v2
|
af5dfa9710a9b794fad824b604be3db716b8e763
|
8b903826607730ebd2df45b6aef5944297ef4cfe
|
refs/heads/master
| 2023-05-11T00:46:33.375446
| 2023-05-09T11:14:37
| 2023-05-09T11:14:37
| 50,661,324
| 168
| 75
|
MIT
| 2023-05-09T11:14:39
| 2016-01-29T12:33:47
|
Swift
|
UTF-8
|
C
| false
| false
| 5,240
|
h
|
option.h
|
/*
Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization
dedicated to making software imaging solutions freely available.
You may not use this file except in compliance with the License.
obtain a copy of the License at
http://www.imagemagick.org/script/license.php
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.
MagickCore option methods.
*/
#ifndef _MAGICKCORE_OPTION_H
#define _MAGICKCORE_OPTION_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
typedef enum
{
MagickUndefinedOptions = -1,
MagickAlignOptions = 0,
MagickAlphaOptions,
MagickBooleanOptions,
MagickCacheOptions,
MagickChannelOptions,
MagickClassOptions,
MagickClipPathOptions,
MagickCoderOptions,
MagickColorOptions,
MagickColorspaceOptions,
MagickCommandOptions,
MagickComposeOptions,
MagickCompressOptions,
MagickConfigureOptions,
MagickDataTypeOptions,
MagickDebugOptions,
MagickDecorateOptions,
MagickDelegateOptions,
MagickDirectionOptions,
MagickDisposeOptions,
MagickDistortOptions,
MagickDitherOptions,
MagickEndianOptions,
MagickEvaluateOptions,
MagickFillRuleOptions,
MagickFilterOptions,
MagickFontOptions,
MagickFontsOptions,
MagickFormatOptions,
MagickFunctionOptions,
MagickGravityOptions,
MagickIntentOptions,
MagickInterlaceOptions,
MagickInterpolateOptions,
MagickKernelOptions,
MagickLayerOptions,
MagickLineCapOptions,
MagickLineJoinOptions,
MagickListOptions,
MagickLocaleOptions,
MagickLogEventOptions,
MagickLogOptions,
MagickMagicOptions,
MagickMethodOptions,
MagickMetricOptions,
MagickMimeOptions,
MagickModeOptions,
MagickModuleOptions,
MagickMorphologyOptions,
MagickNoiseOptions,
MagickOrientationOptions,
MagickPixelIntensityOptions,
MagickPolicyOptions,
MagickPolicyDomainOptions,
MagickPolicyRightsOptions,
MagickPreviewOptions,
MagickPrimitiveOptions,
MagickQuantumFormatOptions,
MagickResolutionOptions,
MagickResourceOptions,
MagickSparseColorOptions,
MagickStatisticOptions,
MagickStorageOptions,
MagickStretchOptions,
MagickStyleOptions,
MagickThresholdOptions,
MagickTypeOptions,
MagickValidateOptions,
MagickVirtualPixelOptions,
MagickComplexOptions,
MagickIntensityOptions
} CommandOption;
typedef enum
{
UndefinedValidate,
NoValidate = 0x00000,
ColorspaceValidate = 0x00001,
CompareValidate = 0x00002,
CompositeValidate = 0x00004,
ConvertValidate = 0x00008,
FormatsDiskValidate = 0x00010,
FormatsMapValidate = 0x00020,
FormatsMemoryValidate = 0x00040,
IdentifyValidate = 0x00080,
ImportExportValidate = 0x00100,
MontageValidate = 0x00200,
StreamValidate = 0x00400,
AllValidate = 0x7fffffff
} ValidateType;
typedef struct _OptionInfo
{
const char
*mnemonic;
ssize_t
type,
flags;
MagickBooleanType
stealth;
} OptionInfo;
/*
Flags to describe classes of image processing options.
*/
typedef enum
{
UndefinedOptionFlag = 0x0000,
FireOptionFlag = 0x0001, /* Option sequence firing point */
ImageInfoOptionFlag = 0x0002, /* Sets ImageInfo, no image needed */
DrawInfoOptionFlag = 0x0004, /* Sets DrawInfo, no image needed */
QuantizeInfoOptionFlag = 0x0008, /* Sets QuantizeInfo, no image needed */
GlobalOptionFlag = 0x0010, /* Sets Global Option, no image needed */
SimpleOperatorOptionFlag = 0x0100, /* Simple Image processing operator */
ListOperatorOptionFlag = 0x0200, /* Multi-Image List processing operator */
SpecialOperatorOptionFlag = 0x0400, /* Specially handled Operator Option */
GenesisOptionFlag = 0x0400, /* Genesis Command Wrapper Option */
NonConvertOptionFlag = 0x4000, /* Option not used by Convert */
DeprecateOptionFlag = 0x8000 /* Deprecate option, give warning */
} CommandOptionFlags;
extern MagickExport char
**GetCommandOptions(const CommandOption),
*GetNextImageOption(const ImageInfo *),
*RemoveImageOption(ImageInfo *,const char *);
extern MagickExport const char
*CommandOptionToMnemonic(const CommandOption,const ssize_t),
*GetImageOption(const ImageInfo *,const char *);
extern MagickExport MagickBooleanType
CloneImageOptions(ImageInfo *,const ImageInfo *),
DefineImageOption(ImageInfo *,const char *),
DeleteImageOption(ImageInfo *,const char *),
IsCommandOption(const char *),
ListCommandOptions(FILE *,const CommandOption,ExceptionInfo *),
SetImageOption(ImageInfo *,const char *,const char *);
extern MagickExport ssize_t
GetCommandOptionFlags(const CommandOption,const MagickBooleanType,
const char *),
ParseChannelOption(const char *),
ParseCommandOption(const CommandOption,const MagickBooleanType,const char *);
extern MagickExport void
DestroyImageOptions(ImageInfo *),
ResetImageOptions(const ImageInfo *),
ResetImageOptionIterator(const ImageInfo *);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif
|
f3cb7ca701320b0eb06e9c56ac8f3feccf415f44
|
c6759b857e55991fea3ef0b465dbcee53fa38714
|
/examples/gap8/basic/bsp/wifi/nina_b112_example/ImgIO.h
|
38697916ddb443e1e61e025f5356c4f87562e637
|
[
"Apache-2.0"
] |
permissive
|
GreenWaves-Technologies/gap_sdk
|
1b343bba97b7a5ce62a24162bd72eef5cc67e269
|
3fea306d52ee33f923f2423c5a75d9eb1c07e904
|
refs/heads/master
| 2023-09-01T14:38:34.270427
| 2023-08-10T09:04:44
| 2023-08-10T09:04:44
| 133,324,605
| 145
| 96
|
Apache-2.0
| 2023-08-27T19:03:52
| 2018-05-14T07:50:29
|
C
|
UTF-8
|
C
| false
| false
| 503
|
h
|
ImgIO.h
|
/*
* Copyright (C) 2017 GreenWaves Technologies
* All rights reserved.
*
* This software may be modified and distributed under the terms
* of the BSD license. See the LICENSE file for details.
*
*/
#ifndef __IMG_IO_H__
#define __IMG_IO_H__
unsigned char *ReadImageFromFile(char *ImageName, unsigned int *W, unsigned int *H, unsigned char *InBuffer, unsigned int BuffSize);
int WriteImageToFile(char *ImageName, unsigned int W, unsigned int H, unsigned char *InBuffer);
#endif //__IMG_IO_H__
|
e38fdcf9fd93659545382425ef14a4e5aa97cef7
|
3f55217e912141e04815bc8bcb6fbd5638d0896e
|
/src/px/pict.h
|
7f1be59099967d5a589b11a4e3d773edd14afa28
|
[
"BSD-2-Clause"
] |
permissive
|
NREL/Radiance
|
bfbb93c99d86368ad0f27052a2a5504aeced47f8
|
2fcca99ace2f2435f32a09525ad31f2b3be3c1bc
|
refs/heads/master
| 2021-12-26T12:42:04.586614
| 2021-12-18T00:43:56
| 2021-12-18T00:43:56
| 8,210,805
| 164
| 68
|
NOASSERTION
| 2019-06-06T19:57:11
| 2013-02-15T00:47:56
|
C
|
UTF-8
|
C
| false
| false
| 473
|
h
|
pict.h
|
/* RCSid: $Id: pict.h,v 2.4 2003/07/14 22:24:00 schorsch Exp $ */
/*
Header file for ra_pict.h
*/
#ifndef _RAD_PICT_H_
#define _RAD_PICT_H_
#ifdef __cplusplus
extern "C" {
#endif
#define HEADER_SIZE 512
#define PICT_picVersion 0x0011
#define PICT_reservedHeader 0x0C00
#define PICT_clipRgn 0x0001
#define PICT_EndOfPicture 0x00FF
#define PICT_PackBitsRect 0x0098
#define PICT_Pack32BitsRect 0x009A
#ifdef __cplusplus
}
#endif
#endif /* _RAD_PICT_H_ */
|
70e99febce686e9c59a5a66c18c7a7d4d54f2fb3
|
73fbb7c1c93f53c9499e83f13c5ed8e4d4ce9d4a
|
/tests/kvasir-tests/bc/libmath.h
|
bf48f4b690acefb45cc472aebe1285a1dd6cb213
|
[
"MIT"
] |
permissive
|
codespecs/daikon
|
8cccbaa7cce77d88160ae368054d9ef74043d465
|
62109d49852676657ce3205283cebbb46456425c
|
refs/heads/master
| 2023-09-01T19:45:13.280344
| 2023-08-22T03:21:40
| 2023-08-22T03:21:40
| 37,424,689
| 183
| 56
|
NOASSERTION
| 2023-08-22T03:21:41
| 2015-06-14T18:40:55
|
C
|
UTF-8
|
C
| false
| false
| 2,431
|
h
|
libmath.h
|
{"@iK20:s2:p@r",
"@iF1,5.6,7,8,9,10,11,12,13,14[l5:0<Z1:1s11:pl5:ns5:pN1:l2:s14:",
"pK6:l14:+K.44:l5:*+s12:pl5:cS1+s2:pN2:l5:1>Z3:l9:1+s9:pl5:K2:",
"/s5:pl2:1+s2:pJ2:N3:l12:s2:p1l5:+s13:pl5:s6:p1s7:pK2:s10:pN5:",
"1B6:J4:N7:l10:i10:pJ5:N6:l6:l5:*s6:l7:l10:*s7:/s8:pl8:0=Z8:l9:",
"0>Z9:N10:l9:d9:Z11:l13:l13:*s13:pJ10:N11:N9:l14:s2:pl11:Z12:1",
"l13:/RN12:l13:1/RN8:l13:l8:+s13:pJ7:N4:0R]@r",
"@iF2,5.8,9,10,11,12,13,14[l5:0{Z1:1K10:l2:^-1/RN1:l2:s14:pK6:",
"l2:+s2:pK2:s9:p0s10:pN2:l5:K2:}Z3:l9:K2:*s9:pl5:cRs5:pJ2:N3:N4:",
"l5:K.5:{Z5:l9:K2:*s9:pl5:cRs5:pJ4:N5:l5:1-l5:1+/s12:s13:pl12:",
"l12:*s11:pK3:s10:pN7:1B8:J6:N9:l10:K2:+s10:pJ7:N8:l12:l11:*s12:",
"l10:/s8:pl8:0=Z10:l9:l13:*s13:pl14:s2:pl13:1/RN10:l13:l8:+s13:",
"pJ9:N6:0R]@r",
"@iF3,5.8,10,11,12,15,13,14[l2:s14:pK1.1:l14:*K2:+s2:p1C4,0:s13:",
"pl5:0<Z1:1s11:pl5:ns5:pN1:0s2:pl5:l13:/K2:+K4:/s12:pl5:K4:l12:",
"*l13:*-s5:pl12:K2:%Z2:l5:ns5:pN2:l14:K2:+s2:pl5:s8:s13:pl5:nl5:",
"*s15:pK3:s10:pN4:1B5:J3:N6:l10:K2:+s10:pJ4:N5:l8:l15:l10:l10:",
"1-*/*s8:pl8:0=Z7:l14:s2:pl11:Z8:l13:n1/RN8:l13:1/RN7:l13:l8:+",
"s13:pJ6:N3:0R]@r",
"@iF5,5.13,14[l2:s14:pl2:K1.2:*s2:pl5:1C4,0:K2:*+C3,0:s13:pl14:",
"s2:pl13:1/R0R]@r",
"@iF4,5.6,8,9,10,11,12,15,13,14[1s11:pl5:0<Z1:1ns11:pl5:ns5:pN1:",
"l5:1=Z2:l2:K25:{Z3:K.7853981633974483096156608:l11:/RN3:l2:K40",
":{Z4:K.7853981633974483096156608458198757210492:l11:/RN4:l2:K",
"60:{Z5:K.785398163397448309615660845819875721049292349843776455243736",
":l11:/RN5:N2:l5:K.2:=Z6:l2:K25:{Z7:K.1973955598498807583700497",
":l11:/RN7:l2:K40:{Z8:K.1973955598498807583700497651947902934475",
":l11:/RN8:l2:K60:{Z9:K.197395559849880758370049765194790293447585103787852101517688",
":l11:/RN9:N6:l2:s14:pl5:K.2:>Z10:l14:K5:+s2:pK.2:C4,0:s6:pN10:",
"l14:K3:+s2:pN11:l5:K.2:>Z12:l9:1+s9:pl5:K.2:-1l5:K.2:*+/s5:pJ11:N12:",
"l5:s12:s13:pl5:nl5:*s15:pK3:s10:pN14:1B15:J13:N16:l10:K2:+s10:",
"pJ14:N15:l12:l15:*s12:l10:/s8:pl8:0=Z17:l14:s2:pl9:l6:*l13:+l11:",
"/RN17:l13:l8:+s13:pJ16:N13:0R]@r",
"@iF6,12,5.6,16,7,8,9,10,11,15,13,14[l2:s14:p0s2:pl12:1/s12:pl12:",
"0<Z1:l12:ns12:pl12:K2:%1=Z2:1s11:pN2:N1:l0:s16:pKA:s0:p1s9:pK",
"2:s10:pN4:l10:l12:{B5:J3:N6:l10:i10:pJ4:N5:l9:l10:*s9:pJ6:N3:",
"K1.5:l14:*s2:pl5:l12:^K2:l12:^/l9:/s9:p1s8:s13:pl5:nl5:*K4:/s15:",
"pK1.5:l14:*l9:cL+l9:cS-s2:p1s10:pN8:1B9:J7:N10:l10:i10:pJ8:N9:",
"l8:l15:*l10:/l12:l10:+/s8:pl8:0=Z11:l16:s0:pl14:s2:pl11:Z12:l9:",
"nl13:*1/RN12:l9:l13:*1/RN11:l13:l8:+s13:pJ10:N7:0R]@r",0}
|
0d11a3bc483a9d6ffef612e8d87924c7dab63a85
|
5eff7a36d9a9917dce9111f0c3074375fe6f7656
|
/app/bitmap/Bitmap.c
|
d074058e1140de44626d3d77a149f93ca11cf7e1
|
[
"MIT-open-group"
] |
permissive
|
openbsd/xenocara
|
cb392d02ebba06f6ff7d826fd8a89aa3b8401779
|
a012b5de33ea0b977095d77316a521195b26cc6b
|
refs/heads/master
| 2023-08-25T12:16:58.862008
| 2023-08-12T16:16:25
| 2023-08-12T16:16:25
| 66,967,384
| 177
| 66
| null | 2023-07-22T18:12:37
| 2016-08-30T18:36:01
|
C
|
UTF-8
|
C
| false
| false
| 51,617
|
c
|
Bitmap.c
|
/*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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 OPEN GROUP 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.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
/*
* Author: Davor Matic, MIT X Consortium
*/
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/XawInit.h>
#include <X11/Xmu/CharSet.h>
#include <X11/Xmu/Drawing.h>
#include <X11/Xatom.h>
#include <X11/Xfuncs.h>
#include <X11/Xos.h>
#include "BitmapP.h"
#include "Bitmap.h"
#include <assert.h>
#include <stdio.h>
#include <math.h>
#define min(x, y) ((((int)(x)) < (int)(y)) ? (x) : (y))
#define max(x, y) ((((int)(x)) > (int)(y)) ? (x) : (y))
Boolean DEBUG;
#define DefaultGridTolerance 8
#define DefaultBitmapSize "16x16"
#define FallbackBitmapWidth 16
#define FallbackBitmapHeight 16
#define DefaultGrid TRUE
#define DefaultDashed TRUE
#define DefaultStippled TRUE
#define DefaultProportional TRUE
#define DefaultAxes FALSE
#define DefaultMargin 16
#define DefaultSquareWidth 16
#define DefaultSquareHeight 16
#define DefaultFilename ""
#define Offset(field) XtOffsetOf(BitmapRec, bitmap.field)
static XtResource resources[] = {
{XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
Offset(foreground_pixel), XtRString, XtDefaultForeground},
{XtNhighlight, XtCHighlight, XtRPixel, sizeof(Pixel),
Offset(highlight_pixel), XtRString, XtDefaultForeground},
{XtNframe, XtCFrame, XtRPixel, sizeof(Pixel),
Offset(frame_pixel), XtRString, XtDefaultForeground},
{XtNgridTolerance, XtCGridTolerance, XtRDimension, sizeof(Dimension),
Offset(grid_tolerance), XtRImmediate, (XtPointer) DefaultGridTolerance},
{XtNsize, XtCSize, XtRString, sizeof(String),
Offset(size), XtRImmediate, (XtPointer) DefaultBitmapSize},
{XtNdashed, XtCDashed, XtRBoolean, sizeof(Boolean),
Offset(dashed), XtRImmediate, (XtPointer) DefaultDashed},
{XtNgrid, XtCGrid, XtRBoolean, sizeof(Boolean),
Offset(grid), XtRImmediate, (XtPointer) DefaultGrid},
{XtNstippled, XtCStippled, XtRBoolean, sizeof(Boolean),
Offset(stippled), XtRImmediate, (XtPointer) DefaultStippled},
{XtNproportional, XtCProportional, XtRBoolean, sizeof(Boolean),
Offset(proportional), XtRImmediate, (XtPointer) DefaultProportional},
{XtNaxes, XtCAxes, XtRBoolean, sizeof(Boolean),
Offset(axes), XtRImmediate, (XtPointer) DefaultAxes},
{XtNsquareWidth, XtCSquareWidth, XtRDimension, sizeof(Dimension),
Offset(squareW), XtRImmediate, (XtPointer) DefaultSquareWidth},
{XtNsquareHeight, XtCSquareHeight, XtRDimension, sizeof(Dimension),
Offset(squareH), XtRImmediate, (XtPointer) DefaultSquareHeight},
{XtNmargin, XtCMargin, XtRDimension, sizeof(Dimension),
Offset(margin), XtRImmediate, (XtPointer) DefaultMargin},
{XtNxHot, XtCXHot, XtRPosition, sizeof(Position),
Offset(hot.x), XtRImmediate, (XtPointer) NotSet},
{XtNyHot, XtCYHot, XtRPosition, sizeof(Position),
Offset(hot.y), XtRImmediate, (XtPointer) NotSet},
{XtNbutton1Function, XtCButton1Function, XtRButtonFunction, sizeof(int),
Offset(button_function[0]), XtRImmediate, (XtPointer) Set},
{XtNbutton2Function, XtCButton2Function, XtRButtonFunction, sizeof(int),
Offset(button_function[1]), XtRImmediate, (XtPointer) Invert},
{XtNbutton3Function, XtCButton3Function, XtRButtonFunction, sizeof(int),
Offset(button_function[2]), XtRImmediate, (XtPointer) Clear},
{XtNbutton4Function, XtCButton4Function, XtRButtonFunction, sizeof(int),
Offset(button_function[3]), XtRImmediate, (XtPointer) Clear},
{XtNbutton5Function, XtCButton5Function, XtRButtonFunction, sizeof(int),
Offset(button_function[4]), XtRImmediate, (XtPointer) Clear},
{XtNfilename, XtCFilename, XtRString, sizeof(String),
Offset(filename), XtRImmediate, (XtPointer) DefaultFilename},
{XtNbasename, XtCBasename, XtRString, sizeof(String),
Offset(basename), XtRImmediate, (XtPointer) DefaultFilename},
{XtNdashes, XtCDashes, XtRBitmap, sizeof(Pixmap),
Offset(dashes), XtRImmediate, (XtPointer) XtUnspecifiedPixmap},
{XtNstipple, XtCStipple, XtRBitmap, sizeof(Pixmap),
Offset(stipple), XtRImmediate, (XtPointer) XtUnspecifiedPixmap},
};
#undef Offset
static XtActionsRec actions[] =
{
{"mark", (XtActionProc)BWTMark},
{"mark-all", (XtActionProc)BWTMarkAll},
{"unmark", (XtActionProc)BWTUnmark},
{"paste", (XtActionProc)BWTPaste},
{"bw-debug", (XtActionProc)BWDebug},
{"abort", (XtActionProc)BWAbort},
{"store-to-buffer", (XtActionProc)BWStoreToBuffer},
{"change-notify", (XtActionProc)BWChangeNotify},
{"set-changed", (XtActionProc)BWSetChanged},
{"up", (XtActionProc)BWUp},
{"down", (XtActionProc)BWDown},
{"left", (XtActionProc)BWLeft},
{"right", (XtActionProc)BWRight},
{"fold", (XtActionProc)BWFold},
{"flip-horiz", (XtActionProc)BWFlipHoriz},
{"flip-vert", (XtActionProc)BWFlipVert},
{"rotate-right", (XtActionProc)BWRotateRight},
{"rotate-left", (XtActionProc)BWRotateLeft},
{"set", (XtActionProc)BWSet},
{"clear", (XtActionProc)BWClear},
{"invert", (XtActionProc)BWInvert},
{"undo", (XtActionProc)BWUndo},
{"redraw", (XtActionProc)BWRedraw},
};
static char translations1[] =
"\
Shift<Btn1Down>: mark()\n\
Shift<Btn2Down>: mark-all()\n\
Shift<Btn3Down>: unmark()\n\
Ctrl<BtnDown>: paste()\n\
Ctrl<Key>l: redraw()\n\
<Key>d: bw-debug()\n\
<Key>a: abort()\n\
<Key>Up: store-to-buffer()\
up()\
change-notify()\
set-changed()\n\
<Key>KP_Up: store-to-buffer()\
up()\
change-notify()\
set-changed()\n\
<Key>Down: store-to-buffer()\
down()\
change-notify()\
set-changed()\n\
<Key>KP_Down: store-to-buffer()\
down()\
change-notify()\
set-changed()\n\
<Key>Left: store-to-buffer()\
left()\
change-notify()\
set-changed()\n\
<Key>KP_Left: store-to-buffer()\
left()\
change-notify()\
set-changed()\n\
<Key>Right: store-to-buffer()\
right()\
change-notify()\
set-changed()\n\
<Key>KP_Right: store-to-buffer()\
right()\
change-notify()\
set-changed()\n\
<Key>f: store-to-buffer()\
fold()\
change-notify()\
set-changed()\n\
<Key>h: store-to-buffer()\
flip-horiz()\
change-notify()\
set-changed()\n\
";
static char translations2[] =
"<Key>v: store-to-buffer()\
flip-vert()\
change-notify()\
set-changed()\n\
<Key>r: store-to-buffer()\
rotate-right()\
change-notify()\
set-changed()\n\
<Key>l: store-to-buffer()\
rotate-left()\
change-notify()\
set-changed()\n\
<Key>s: store-to-buffer()\
set()\
change-notify()\
set-changed()\n\
<Key>c: store-to-buffer()\
clear()\
change-notify()\
set-changed()\n\
<Key>i: store-to-buffer()\
invert()\
change-notify()\
set-changed()\n\
<Key>u: undo()\
change-notify()\
set-changed()\n\
";
static Atom targets[] = {
XA_BITMAP,
XA_PIXMAP
};
#include "Requests.h"
static BWRequestRec requests[] =
{
{MarkRequest, sizeof(BWStatus),
TwoPointsEngage, (XtPointer) BWDrawRectangle,
TwoPointsTerminateTimed, (XtPointer) BWSelect,
NULL, (XtPointer) NULL},
{RestoreRequest, sizeof(BWStatus),
OnePointEngage, (XtPointer) BWDragStored,
OnePointTerminate, (XtPointer) BWRestore,
NULL, (XtPointer) NULL},
{ImmediateCopyRequest, sizeof(BWStatus),
OnePointEngage, (XtPointer) BWDragMarked,
OnePointTerminate, (XtPointer) BWCopy,
NULL, (XtPointer) NULL},
{ImmediateMoveRequest, sizeof(BWStatus),
OnePointEngage, (XtPointer) BWDragMarked,
OnePointTerminate, (XtPointer) BWMove,
NULL, (XtPointer) NULL},
{CopyRequest, sizeof(BWStatus),
DragOnePointEngage, (XtPointer) Paste,
DragOnePointTerminate, (XtPointer) ImmediateCopyRequest,
Interface, (XtPointer) BWUnmark},
{MoveRequest, sizeof(BWStatus),
DragOnePointEngage, (XtPointer) Paste,
DragOnePointTerminate, (XtPointer) ImmediateMoveRequest,
Interface, (XtPointer) BWUnmark},
{PointRequest, sizeof(BWStatus),
DragOnePointEngage, (XtPointer) BWDrawPoint,
DragOnePointTerminate, (XtPointer) BWDrawPoint,
NULL, (XtPointer) NULL},
{CurveRequest, sizeof(BWStatus),
DragTwoPointsEngage, (XtPointer) BWBlindLine,
DragTwoPointsTerminate, (XtPointer) BWBlindLine,
NULL, (XtPointer) NULL},
{LineRequest, sizeof(BWStatus),
TwoPointsEngage, (XtPointer) BWDrawLine,
TwoPointsTerminate, (XtPointer) BWDrawLine,
NULL, (XtPointer) NULL},
{RectangleRequest, sizeof(BWStatus),
TwoPointsEngage, (XtPointer) BWDrawRectangle,
TwoPointsTerminate, (XtPointer) BWDrawRectangle,
NULL, (XtPointer) NULL},
{FilledRectangleRequest, sizeof(BWStatus),
TwoPointsEngage, (XtPointer) BWDrawRectangle,
TwoPointsTerminate, (XtPointer) BWDrawFilledRectangle,
NULL, (XtPointer) NULL},
{CircleRequest, sizeof(BWStatus),
TwoPointsEngage, (XtPointer) BWDrawCircle,
TwoPointsTerminate, (XtPointer) BWDrawCircle,
NULL, (XtPointer) NULL},
{FilledCircleRequest, sizeof(BWStatus),
TwoPointsEngage, (XtPointer) BWDrawCircle,
TwoPointsTerminate, (XtPointer) BWDrawFilledCircle,
NULL, (XtPointer) NULL},
{FloodFillRequest, sizeof(BWStatus),
OnePointEngage, (XtPointer) NULL,
OnePointTerminate, (XtPointer) BWFloodFill,
NULL, (XtPointer) NULL},
{HotSpotRequest, sizeof(BWStatus),
OnePointEngage, (XtPointer) BWDrawHotSpot,
OnePointTerminate, (XtPointer) BWDrawHotSpot,
NULL, (XtPointer) NULL},
{ZoomInRequest, sizeof(BWStatus),
TwoPointsEngage, (XtPointer) BWDrawRectangle,
TwoPointsTerminate, (XtPointer) BWZoomIn,
NULL, (XtPointer) NULL},
};
static void ClassInitialize(void);
static void Initialize(Widget wrequest, Widget wnew,
ArgList argv, Cardinal *argc);
static void Redisplay(Widget w, XEvent *event, Region region);
static void Resize(Widget w);
static void Destroy(Widget w);
static void Refresh(BitmapWidget BW, Position x, Position y,
Dimension width, Dimension height);
static Boolean SetValues(Widget old, Widget request, Widget new,
ArgList args, Cardinal *num_args);
BitmapClassRec bitmapClassRec = {
{ /* core fields */
/* superclass */ (WidgetClass) &simpleClassRec,
/* class_name */ "Bitmap",
/* widget_size */ sizeof(BitmapRec),
/* class_initialize */ ClassInitialize,
/* class_part_initialize */ NULL,
/* class_inited */ FALSE,
/* initialize */ Initialize,
/* initialize_hook */ NULL,
/* realize */ XtInheritRealize,
/* actions */ actions,
/* num_actions */ XtNumber(actions),
/* resources */ resources,
/* num_resources */ XtNumber(resources),
/* xrm_class */ NULLQUARK,
/* compress_motion */ TRUE,
/* compress_exposure */ FALSE,
/* compress_enterleave */ TRUE,
/* visible_interest */ TRUE,
/* destroy */ Destroy,
/* resize */ Resize,
/* expose */ Redisplay,
/* set_values */ SetValues,
/* set_values_hook */ NULL,
/* set_values_almost */ XtInheritSetValuesAlmost,
/* get_values_hook */ NULL,
/* accept_focus */ NULL,
/* version */ XtVersion,
/* callback_private */ NULL,
/* tm_table */ NULL , /* set in code */
/* query_geometry */ XtInheritQueryGeometry,
/* display_accelerator */ XtInheritDisplayAccelerator,
/* extension */ NULL,
},
{
/* empty */ XtInheritChangeSensitive,
},
{
/* targets */ targets,
/* num_trets */ XtNumber(targets),
/* requests */ requests,
/* num_requests */ XtNumber(requests),
}
};
WidgetClass bitmapWidgetClass = (WidgetClass) &bitmapClassRec;
/* ARGSUSED */
void
BWDebug(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
DEBUG ^= True;
}
Pixmap
BWGetPixmap(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
return GetPixmap(BW, BW->bitmap.zoom.image);
}
Pixmap
BWGetUnzoomedPixmap(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
GC gc;
Pixmap pix;
if (BW->bitmap.zooming) {
pix = XCreatePixmap(XtDisplay(w), XtWindow(w),
BW->bitmap.zoom.image->width,
BW->bitmap.zoom.image->height, 1);
if (!(gc = XCreateGC(XtDisplay(w), pix,
(unsigned long) 0, (XGCValues *) 0))) {
XFreePixmap(XtDisplay(w), pix);
return (Pixmap) None;
}
XPutImage(XtDisplay(w), pix, gc,
BW->bitmap.zoom.image,
0, 0, 0, 0,
BW->bitmap.zoom.image->width,
BW->bitmap.zoom.image->height);
XPutImage(XtDisplay(w), pix, gc,
BW->bitmap.image,
0, 0,
BW->bitmap.zoom.at_x,
BW->bitmap.zoom.at_y,
BW->bitmap.image->width,
BW->bitmap.image->height);
}
else {
pix = XCreatePixmap(XtDisplay(w), XtWindow(w),
BW->bitmap.image->width,
BW->bitmap.image->height, 1);
if (! (gc = XCreateGC(XtDisplay(w), pix,
(unsigned long) 0, (XGCValues *) 0))){
XFreePixmap(XtDisplay(w), pix);
return (Pixmap) None;
}
XPutImage(XtDisplay(w), pix, gc,
BW->bitmap.image,
0, 0, 0, 0,
BW->bitmap.image->width,
BW->bitmap.image->height);
}
XFreeGC(XtDisplay(w), gc);
return(pix);
}
XImage *
GetImage(BitmapWidget BW, Pixmap pixmap)
{
Window root;
int x, y;
unsigned int width, height, border_width, depth;
XImage *source, *image;
XGetGeometry(XtDisplay(BW), pixmap, &root, &x, &y,
&width, &height, &border_width, &depth);
source = XGetImage(XtDisplay(BW), pixmap, x, y, width, height,
1, XYPixmap);
image = ConvertToBitmapImage(BW, source);
return image;
}
XImage *
CreateBitmapImage(BitmapWidget BW, char *data,
Dimension width, Dimension height)
{
XImage *image = XCreateImage(XtDisplay(BW),
DefaultVisual(XtDisplay(BW),
DefaultScreen(XtDisplay(BW))),
1, XYBitmap, 0,
data, width, height,
8, ((int)width + 7) / 8);
image->height = height;
image->width = width;
image->depth = 1;
image->xoffset = 0;
image->format = XYBitmap;
image->data = (char *)data;
image->byte_order = LSBFirst;
image->bitmap_unit = 8;
image->bitmap_bit_order = LSBFirst;
image->bitmap_pad = 8;
image->bytes_per_line = ((int)width + 7) / 8;
return image;
}
void
DestroyBitmapImage(XImage **image)
{
/*XDestroyImage(*image);*/
if (image) {
if (*image) {
if ((*image)->data)
XtFree((*image)->data);
XtFree((char *)*image);
}
*image = NULL;
}
}
#if 0
XImage *
BWGetImage(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
BitmapWidget BW = (BitmapWidget) w;
return BW->bitmap.image;
}
#endif
void
BWChangeNotify(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
if (BW->bitmap.notify)
(*BW->bitmap.notify)(w, NULL, NULL, NULL);
}
void
BWNotify(Widget w, XtActionProc proc)
{
BitmapWidget BW = (BitmapWidget) w;
BW->bitmap.notify = proc;
}
void
BWSetChanged(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
BW->bitmap.changed = True;
}
Boolean
BWQueryChanged(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
return BW->bitmap.changed;
}
void
BWClearChanged(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
BW->bitmap.changed = False;
}
Boolean
BWQueryStored(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
return (BW->bitmap.storage != NULL);
}
Boolean
BWQueryStippled(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
return BW->bitmap.stippled;
}
static void
RedrawStippled(BitmapWidget BW)
{
XExposeEvent event;
event.type = Expose;
event.display = XtDisplay((Widget)BW);
event.window = XtWindow((Widget)BW);
event.x = 0;
event.y = 0;
event.width = BW->core.width;
event.height = BW->core.height;
event.count = 0;
BWRedrawMark((Widget)BW);
BW->bitmap.stipple_change_expose_event = True;
XtDispatchEvent((XEvent *)&event);
BW->bitmap.stipple_change_expose_event = False;
}
void
BWSwitchStippled(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
RedrawStippled(BW);
BW->bitmap.stippled ^= True;
XSetFillStyle(XtDisplay(BW), BW->bitmap.highlighting_gc,
(BW->bitmap.stippled ? FillStippled : FillSolid));
RedrawStippled(BW);
}
void
BWSelect(Widget w, Position from_x, Position from_y,
Position to_x, Position to_y, Time btime)
{
BWMark(w, from_x, from_y, to_x, to_y);
BWGrabSelection(w, btime);
}
Boolean
BWQueryAxes(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
return BW->bitmap.axes;
}
void
BWSwitchAxes(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
BW->bitmap.axes ^= True;
BWHighlightAxes(w);
}
void
BWAxes(Widget w, Boolean _switch)
{
BitmapWidget BW = (BitmapWidget) w;
if (BW->bitmap.axes != _switch)
BWSwitchAxes(w);
}
void
BWRedrawAxes(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
if (BW->bitmap.axes)
BWHighlightAxes(w);
}
#if 0
void
BWPutImage(BitmapWidget w, Display *display, Drawable drawable, GC gc,
Position x, Position y)
{
BitmapWidget BW = (BitmapWidget) w;
XPutImage(display, drawable, gc, BW->bitmap.image,
0, 0, x, y, BW->bitmap.image->width, BW->bitmap.image->height);
}
#endif
static char *
StripFilename(_Xconst _XtString filename)
{
const char *begin = strrchr(filename, '/');
const char *end;
char *result;
int length;
if (filename) {
begin = (begin ? begin + 1 : filename);
end = strchr(begin, '.'); /* change to strrchr to allow longer names */
length = (end ? (end - begin) : strlen (begin));
result = (char *) XtMalloc (length + 1);
strncpy (result, begin, length);
result [length] = '\0';
return (result);
}
else
return (NULL);
}
static int
XmuWriteBitmapDataToFile(_Xconst _XtString filename,
_Xconst _XtString basename,
int width, int height, char *datap,
int x_hot, int y_hot)
{
FILE *file;
int i, data_length;
data_length = Length(width, height);
if(!filename || !strcmp(filename, "") || !strcmp(filename, "-")) {
file = stdout;
filename = "dummy";
}
else
file = fopen(filename, "w+");
if (file) {
char *new_basename;
if (!basename || !strcmp(basename, "") || !strcmp(basename, "-"))
basename = new_basename = StripFilename(filename);
else
new_basename = NULL;
fprintf(file, "#define %s_width %d\n", basename, width);
fprintf(file, "#define %s_height %d\n", basename, height);
if (QuerySet(x_hot, y_hot)) {
fprintf(file, "#define %s_x_hot %d\n", basename, x_hot);
fprintf(file, "#define %s_y_hot %d\n", basename, y_hot);
}
fprintf(file, "static unsigned char %s_bits[] = {\n 0x%02x",
basename, (unsigned char) datap[0]);
for(i = 1; i < data_length; i++) {
fprintf(file, ",");
fprintf(file, (i % 12) ? " " : "\n ");
fprintf(file, "0x%02x", (unsigned char) datap[i]);
}
fprintf(file, "};\n");
if (file != stdout)
fclose(file);
XtFree(new_basename);
return BitmapSuccess;
}
return 1;
}
/*
*
*/
/* ARGSUSED */
static void
CvtStringToButtonFunction(XrmValuePtr args, /* not used */
Cardinal *num_args, /* not used */
XrmValuePtr from_val,
XrmValuePtr to_val)
{
static int button_function;
char lower_name[80];
XmuCopyISOLatin1Lowered (lower_name, (char*)from_val->addr);
if (!strcmp(lower_name, XtClear)) {
button_function = Clear;
to_val->addr = (XPointer) &button_function;
to_val->size = sizeof(button_function);
return;
}
if (!strcmp(lower_name, XtSet)) {
button_function = Set;
to_val->addr = (XPointer) &button_function;
to_val->size = sizeof(button_function);
return;
}
if (!strcmp(lower_name, XtInvert)) {
button_function = Invert;
to_val->addr = (XPointer) &button_function;
to_val->size = sizeof(button_function);
return;
}
XtStringConversionWarning(from_val->addr, XtRButtonFunction);
button_function = Clear;
to_val->addr = (XPointer) &button_function;
to_val->size = sizeof(button_function);
}
static void
ClassInitialize(void)
{
char *tm_table = XtMalloc(strlen(translations1) + strlen(translations2) + 1);
strcpy(tm_table, translations1);
strcat(tm_table, translations2);
bitmapClassRec.core_class.tm_table = tm_table;
XawInitializeWidgetSet();
XtAddConverter(XtRString, XtRButtonFunction, CvtStringToButtonFunction,
NULL, 0);
DEBUG = False;
}
static void
SetSizeFromSizeResource(BitmapWidget bw)
{
if (BWParseSize(bw->bitmap.size,
&bw->bitmap.width,
&bw->bitmap.height)
==
False) {
bw->bitmap.width = FallbackBitmapWidth;
bw->bitmap.height = FallbackBitmapHeight;
XtWarning("Cannot parse the size resource. BitmapWidget");
}
}
/* ARGSUSED */
static void
Initialize(Widget wrequest, Widget wnew, ArgList argv, Cardinal *argc)
{
BitmapWidget new = (BitmapWidget) wnew;
XGCValues values;
XtGCMask mask;
char *image_data, *buffer_data;
new->bitmap.stipple_change_expose_event = False;
new->bitmap.notify = NULL;
new->bitmap.cardinal = 0;
new->bitmap.current = 0;
new->bitmap.fold = False;
new->bitmap.changed = False;
new->bitmap.zooming = False;
new->bitmap.selection.own = False;
new->bitmap.selection.limbo = False;
new->bitmap.request_stack = (BWRequestStack *)
XtMalloc(sizeof(BWRequestStack));
new->bitmap.request_stack[0].request = NULL;
new->bitmap.request_stack[0].call_data = NULL;
new->bitmap.request_stack[0].trap = False;
SetSizeFromSizeResource(new);
new->core.width = new->bitmap.width * new->bitmap.squareW +
2 * new->bitmap.margin;
new->core.height = new->bitmap.height * new->bitmap.squareH +
2 * new->bitmap.margin;
new->bitmap.hot.x = new->bitmap.hot.y = NotSet;
new->bitmap.buffer_hot.x = new->bitmap.buffer_hot.y = NotSet;
new->bitmap.mark.from_x = new->bitmap.mark.from_y = NotSet;
new->bitmap.mark.to_x = new->bitmap.mark.to_y = NotSet;
new->bitmap.buffer_mark.from_x = new->bitmap.buffer_mark.from_y = NotSet;
new->bitmap.buffer_mark.to_x = new->bitmap.buffer_mark.to_y = NotSet;
values.foreground = new->bitmap.foreground_pixel;
values.background = new->core.background_pixel;
values.foreground ^= values.background;
values.function = GXxor;
mask = GCForeground | GCBackground | GCFunction;
new->bitmap.drawing_gc = XCreateGC(XtDisplay(new),
RootWindow(XtDisplay(new),
DefaultScreen(XtDisplay(new))),
mask, &values);
values.foreground = new->bitmap.highlight_pixel;
values.background = new->core.background_pixel;
values.foreground ^= values.background;
values.function = GXxor;
mask = GCForeground | GCBackground | GCFunction;
if (new->bitmap.stipple != XtUnspecifiedPixmap)
{
values.stipple = new->bitmap.stipple;
mask |= GCStipple | GCFillStyle;
}
values.fill_style = (new->bitmap.stippled ? FillStippled : FillSolid);
new->bitmap.highlighting_gc = XCreateGC(XtDisplay(new),
RootWindow(XtDisplay(new),
DefaultScreen(XtDisplay(new))),
mask, &values);
values.foreground = new->bitmap.frame_pixel;
values.background = new->core.background_pixel;
values.foreground ^= values.background;
mask = GCForeground | GCBackground | GCFunction;
if (new->bitmap.dashes != XtUnspecifiedPixmap)
{
values.stipple = new->bitmap.dashes;
mask |= GCStipple | GCFillStyle;
}
values.fill_style = (new->bitmap.dashed ? FillStippled : FillSolid);
new->bitmap.frame_gc = XCreateGC(XtDisplay(new),
RootWindow(XtDisplay(new),
DefaultScreen(XtDisplay(new))),
mask, &values);
values.foreground = new->bitmap.highlight_pixel;
values.background = new->core.background_pixel;
values.foreground ^= values.background;
mask = GCForeground | GCBackground | GCFunction;
new->bitmap.axes_gc = XCreateGC(XtDisplay(new),
RootWindow(XtDisplay(new),
DefaultScreen(XtDisplay(new))),
mask, &values);
image_data = CreateCleanData(Length(new->bitmap.width,
new->bitmap.height));
buffer_data = CreateCleanData(Length(new->bitmap.width,
new->bitmap.height));
new->bitmap.storage = NULL;
new->bitmap.image = CreateBitmapImage(new,
image_data,
new->bitmap.width,
new->bitmap.height);
new->bitmap.buffer = CreateBitmapImage(new,
buffer_data,
new->bitmap.width,
new->bitmap.height);
/* Read file */
{
int status;
XImage *image, *buffer;
unsigned char *image_data2;
char *buffer_data2;
unsigned int width, height;
int x_hot, y_hot;
status = XmuReadBitmapDataFromFile(new->bitmap.filename,
&width, &height, &image_data2,
&x_hot, &y_hot);
if (status == BitmapSuccess) {
buffer_data2 = CreateCleanData(Length(width, height));
image = CreateBitmapImage(new, (char *)image_data2, width, height);
buffer = CreateBitmapImage(new, buffer_data2, width, height);
TransferImageData(new->bitmap.image, buffer);
DestroyBitmapImage(&new->bitmap.image);
DestroyBitmapImage(&new->bitmap.buffer);
new->bitmap.image = image;
new->bitmap.buffer = buffer;
new->bitmap.width = width;
new->bitmap.height = height;
new->bitmap.hot.x = x_hot;
new->bitmap.hot.y = y_hot;
new->bitmap.changed = False;
new->bitmap.zooming = False;
}
new->bitmap.filename = XtNewString(new->bitmap.filename);
if (!strcmp(new->bitmap.basename, "")) {
new->bitmap.basename = StripFilename(new->bitmap.filename);
}
else
new->bitmap.basename = XtNewString(new->bitmap.basename);
}
Resize((Widget)new);
}
/* returns False if the format is wrong */
Boolean
BWParseSize(String size, Dimension *width, Dimension *height)
{
int x, y;
unsigned int w, h;
int status;
status = XParseGeometry(size, &x, &y, &w, &h);
if (status & WidthValue) {
*width = (Dimension) w;
if (status & HeightValue) {
*height = (Dimension) h;
return True;
}
}
return False;
}
Boolean
BWQueryMarked(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
return QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y);
}
static void
FixMark(BitmapWidget BW)
{
if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y)) {
BW->bitmap.mark.from_x = min(BW->bitmap.mark.from_x,
BW->bitmap.image->width);
BW->bitmap.mark.from_y = min(BW->bitmap.mark.from_y,
BW->bitmap.image->height);
BW->bitmap.mark.to_x = min(BW->bitmap.mark.to_x,
BW->bitmap.image->width);
BW->bitmap.mark.to_y = min(BW->bitmap.mark.to_y,
BW->bitmap.image->height);
if((BW->bitmap.mark.from_x == BW->bitmap.mark.from_y) &&
(BW->bitmap.mark.to_x == BW->bitmap.mark.to_y))
BW->bitmap.mark.from_x =
BW->bitmap.mark.from_y =
BW->bitmap.mark.to_x =
BW->bitmap.mark.to_y = NotSet;
}
}
/* ARGSUSED */
int
BWStoreFile(Widget w, _Xconst _XtString filename, _Xconst _XtString *basename)
{
BitmapWidget BW = (BitmapWidget) w;
int status;
unsigned char *storage_data;
unsigned int width, height;
int x_hot, y_hot;
status = XmuReadBitmapDataFromFile(filename, &width, &height,
&storage_data, &x_hot, &y_hot);
if (status == BitmapSuccess) {
DestroyBitmapImage(&BW->bitmap.storage);
BW->bitmap.storage = CreateBitmapImage(BW, (char *)storage_data, width, height);
return BitmapSuccess;
}
else
XtWarning(" read file failed. BitmapWidget");
return status;
}
String
BWUnparseStatus(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
snprintf(BW->bitmap.status, sizeof(BW->bitmap.status),
"Filename: %s Basename: %s Size: %dx%d",
(strcmp(BW->bitmap.filename, "") ? BW->bitmap.filename : "<none>"),
(strcmp(BW->bitmap.basename, "") ? BW->bitmap.basename : "<none>"),
BW->bitmap.width, BW->bitmap.height);
return BW->bitmap.status;
}
void
BWChangeFilename(Widget w, _Xconst _XtString str)
{
BitmapWidget BW = (BitmapWidget) w;
if (str) {
XtFree(BW->bitmap.filename);
BW->bitmap.filename = XtNewString( str);
}
}
void
BWChangeBasename(Widget w, _Xconst _XtString str)
{
BitmapWidget BW = (BitmapWidget) w;
if (str) {
XtFree(BW->bitmap.basename);
BW->bitmap.basename = XtNewString(str);
}
}
int
BWReadFile(Widget w, _Xconst _XtString filename, _Xconst _XtString basename) /* ARGSUSED */
{
BitmapWidget BW = (BitmapWidget) w;
int status;
XImage *image, *buffer;
unsigned char *image_data;
char *buffer_data;
unsigned int width, height;
int x_hot, y_hot;
if (!filename)
filename = BW->bitmap.filename;
status = XmuReadBitmapDataFromFile(filename, &width, &height, &image_data,
&x_hot, &y_hot);
if (status == BitmapSuccess) {
buffer_data = CreateCleanData(Length(width, height));
image = CreateBitmapImage(BW, (char *)image_data, width, height);
buffer = CreateBitmapImage(BW, buffer_data, width, height);
TransferImageData(BW->bitmap.image, buffer);
DestroyBitmapImage(&BW->bitmap.image);
DestroyBitmapImage(&BW->bitmap.buffer);
BW->bitmap.image = image;
BW->bitmap.buffer = buffer;
BW->bitmap.width = width;
BW->bitmap.height = height;
BW->bitmap.hot.x = x_hot;
BW->bitmap.hot.y = y_hot;
BW->bitmap.changed = False;
BW->bitmap.zooming = False;
XtFree(BW->bitmap.filename);
BW->bitmap.filename = XtNewString(filename);
XtFree(BW->bitmap.basename);
BW->bitmap.basename = StripFilename(filename);
BWUnmark(w);
Resize((Widget)BW);
if (BW->core.visible) {
XClearArea(XtDisplay(BW), XtWindow(BW),
0, 0,
BW->core.width, BW->core.height,
True);
}
return BitmapSuccess;
}
else
XtWarning(" read file failed. BitmapWidget");
return status;
}
#if 0
void
BWSetImage(Widget w, XImage *image)
{
BitmapWidget BW = (BitmapWidget) w;
XImage *buffer;
char *buffer_data;
buffer_data = CreateCleanData(Length(image->width, image->height));
buffer = CreateBitmapImage(BW, buffer_data,
(Dimension) image->width,
(Dimension) image->height);
TransferImageData(BW->bitmap.image, buffer);
DestroyBitmapImage(&BW->bitmap.image);
DestroyBitmapImage(&BW->bitmap.buffer);
BW->bitmap.image = image;
BW->bitmap.buffer = buffer;
BW->bitmap.width = image->width;
BW->bitmap.height = image->height;
Resize((Widget)BW);
if (BW->core.visible) {
XClearArea(XtDisplay(BW), XtWindow(BW),
0, 0,
BW->core.width, BW->core.height,
True);
}
}
#endif
int
BWWriteFile(Widget w, _Xconst _XtString filename, _Xconst _XtString basename)
{
BitmapWidget BW = (BitmapWidget) w;
char *data;
XImage *image;
XPoint hot;
int status;
if (BW->bitmap.zooming) {
data = XtMalloc(Length(BW->bitmap.zoom.image->width,
BW->bitmap.zoom.image->height));
memmove( data, BW->bitmap.zoom.image->data,
Length(BW->bitmap.zoom.image->width,
BW->bitmap.zoom.image->height));
image = CreateBitmapImage(BW, data,
(Dimension) BW->bitmap.zoom.image->width,
(Dimension) BW->bitmap.zoom.image->height);
CopyImageData(BW->bitmap.image, image,
0, 0,
BW->bitmap.image->width - 1,
BW->bitmap.image->height - 1,
BW->bitmap.zoom.at_x, BW->bitmap.zoom.at_y);
if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)) {
hot.x = BW->bitmap.hot.x + BW->bitmap.zoom.at_x;
hot.y = BW->bitmap.hot.y + BW->bitmap.zoom.at_y;
}
else
hot = BW->bitmap.zoom.hot;
}
else {
image = BW->bitmap.image;
hot = BW->bitmap.hot;
}
if (!filename) filename = BW->bitmap.filename;
else {
XtFree(BW->bitmap.filename);
BW->bitmap.filename = XtNewString(filename);
XtFree(BW->bitmap.basename);
BW->bitmap.basename = StripFilename(filename);
}
if (!basename) basename = BW->bitmap.basename;
else {
XtFree(BW->bitmap.basename);
BW->bitmap.basename = XtNewString(basename);
}
if (DEBUG)
fprintf(stderr, "Saving filename: %s %s\n", filename, basename);
status = XmuWriteBitmapDataToFile(filename, basename,
image->width, image->height, image->data,
hot.x, hot.y);
if (BW->bitmap.zooming)
DestroyBitmapImage(&image);
if (status == BitmapSuccess)
BW->bitmap.changed = False;
return status;
}
_XtString
BWGetFilename(Widget w, _XtString *str)
{
BitmapWidget BW = (BitmapWidget) w;
*str = XtNewString(BW->bitmap.filename);
return *str;
}
_XtString
BWGetFilepath(Widget w, _XtString *str)
{
BitmapWidget BW = (BitmapWidget) w;
_XtString end;
*str = XtNewString(BW->bitmap.filename);
assert(*str);
end = strrchr(*str, '/');
if (end)
*(end + 1) = '\0';
else
**str = '\0';
return *str;
}
_XtString
BWGetBasename(Widget w, _XtString *str)
{
BitmapWidget BW = (BitmapWidget) w;
*str = XtNewString(BW->bitmap.basename);
return *str;
}
static void
FixHotSpot(BitmapWidget BW)
{
if (!QueryInBitmap(BW, BW->bitmap.hot.x, BW->bitmap.hot.y))
BW->bitmap.hot.x = BW->bitmap.hot.y = NotSet;
}
static void
ZoomOut(BitmapWidget BW)
{
CopyImageData(BW->bitmap.image, BW->bitmap.zoom.image,
0, 0,
BW->bitmap.image->width - 1,
BW->bitmap.image->height - 1,
BW->bitmap.zoom.at_x, BW->bitmap.zoom.at_y);
DestroyBitmapImage(&BW->bitmap.image);
DestroyBitmapImage(&BW->bitmap.buffer);
BW->bitmap.image = BW->bitmap.zoom.image;
BW->bitmap.buffer = BW->bitmap.zoom.buffer;
BW->bitmap.width = BW->bitmap.image->width;
BW->bitmap.height = BW->bitmap.image->height;
BW->bitmap.fold = BW->bitmap.zoom.fold;
BW->bitmap.changed |= BW->bitmap.zoom.changed;
BW->bitmap.grid = BW->bitmap.zoom.grid;
if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)) {
BW->bitmap.hot.x += BW->bitmap.zoom.at_x;
BW->bitmap.hot.y += BW->bitmap.zoom.at_y;
}
else
BW->bitmap.hot = BW->bitmap.zoom.hot;
BW->bitmap.mark.from_x = NotSet;
BW->bitmap.mark.from_y = NotSet;
BW->bitmap.mark.to_x = NotSet;
BW->bitmap.mark.to_y = NotSet;
BW->bitmap.zooming = False;
}
void
BWZoomOut(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
if (BW->bitmap.zooming) {
ZoomOut(BW);
Resize((Widget)BW);
if (BW->core.visible)
XClearArea(XtDisplay(BW), XtWindow(BW),
0, 0,
BW->core.width, BW->core.height,
True);
}
}
void
BWZoomMarked(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
BWZoomIn(w,
BW->bitmap.mark.from_x, BW->bitmap.mark.from_y,
BW->bitmap.mark.to_x, BW->bitmap.mark.to_y);
}
void
BWZoomIn(Widget w,
Position from_x, Position from_y,
Position to_x, Position to_y)
{
BitmapWidget BW = (BitmapWidget) w;
XImage *image, *buffer;
Dimension width, height;
char *image_data, *buffer_data;
if (BW->bitmap.zooming)
ZoomOut(BW);
QuerySwap(from_x, to_x);
QuerySwap(from_y, to_y);
from_x = max(0, from_x);
from_y = max(0, from_y);
to_x = min(BW->bitmap.width - 1, to_x);
to_y = min(BW->bitmap.height - 1, to_y);
width = to_x - from_x + 1;
height = to_y - from_y + 1;
image_data = CreateCleanData(Length(width, height));
buffer_data = CreateCleanData(Length(width, height));
image = CreateBitmapImage(BW, image_data, width, height);
buffer = CreateBitmapImage(BW, buffer_data, width, height);
CopyImageData(BW->bitmap.image, image, from_x, from_y, to_x, to_y, 0, 0);
CopyImageData(BW->bitmap.buffer, buffer, from_x, from_y, to_x, to_y, 0, 0);
BW->bitmap.zoom.image = BW->bitmap.image;
BW->bitmap.zoom.buffer = BW->bitmap.buffer;
BW->bitmap.zoom.at_x = from_x;
BW->bitmap.zoom.at_y = from_y;
BW->bitmap.zoom.fold = BW->bitmap.fold;
BW->bitmap.zoom.changed = BW->bitmap.changed;
BW->bitmap.zoom.hot = BW->bitmap.hot;
BW->bitmap.zoom.grid = BW->bitmap.grid;
BW->bitmap.image = image;
BW->bitmap.buffer = buffer;
BW->bitmap.width = width;
BW->bitmap.height = height;
BW->bitmap.changed = False;
BW->bitmap.hot.x -= from_x;
BW->bitmap.hot.y -= from_y;
BW->bitmap.mark.from_x = NotSet;
BW->bitmap.mark.from_y = NotSet;
BW->bitmap.mark.to_x = NotSet;
BW->bitmap.mark.to_y = NotSet;
BW->bitmap.zooming = True;
BW->bitmap.grid = True; /* potentially true, could use a resource here */
FixHotSpot(BW);
Resize((Widget)BW);
if (BW->core.visible)
XClearArea(XtDisplay(BW), XtWindow(BW),
0, 0,
BW->core.width, BW->core.height,
True);
}
void
BWRescale(Widget w, Dimension width, Dimension height)
{
BitmapWidget BW = (BitmapWidget) w;
XImage *image, *buffer;
char *buffer_data;
if (BW->bitmap.zooming)
ZoomOut(BW);
image = ScaleBitmapImage(BW, BW->bitmap.image,
(double) width / (double) BW->bitmap.image->width,
(double) height / (double) BW->bitmap.image->height);
buffer_data = CreateCleanData(Length(image->width, image->height));
buffer = CreateBitmapImage(BW, buffer_data,
(Dimension) image->width,
(Dimension) image->height);
TransferImageData(BW->bitmap.buffer, buffer);
DestroyBitmapImage(&BW->bitmap.image);
DestroyBitmapImage(&BW->bitmap.buffer);
BW->bitmap.image = image;
BW->bitmap.buffer = buffer;
BW->bitmap.width = image->width;
BW->bitmap.height = image->height;
FixHotSpot(BW);
FixMark(BW);
Resize((Widget)BW);
if (BW->core.visible)
XClearArea(XtDisplay(BW), XtWindow(BW),
0, 0,
BW->core.width, BW->core.height,
True);
}
Boolean
BWQueryZooming(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
return BW->bitmap.zooming;
}
static void
ResizeGrid(BitmapWidget BW, Dimension width, Dimension height)
{
XImage *image, *buffer;
char *image_data, *buffer_data;
if (BW->bitmap.zooming)
ZoomOut(BW);
image_data = CreateCleanData(Length(width, height));
buffer_data = CreateCleanData(Length(width, height));
image = CreateBitmapImage(BW, image_data, width, height);
buffer = CreateBitmapImage(BW, buffer_data, width, height);
TransferImageData(BW->bitmap.image, image);
TransferImageData(BW->bitmap.buffer, buffer);
DestroyBitmapImage(&BW->bitmap.image);
DestroyBitmapImage(&BW->bitmap.buffer);
BW->bitmap.image = image;
BW->bitmap.buffer = buffer;
BW->bitmap.width = width;
BW->bitmap.height = height;
FixHotSpot(BW);
FixMark(BW);
}
void
BWResize(Widget w, Dimension width, Dimension height)
{
BitmapWidget BW = (BitmapWidget) w;
ResizeGrid(BW, width, height);
Resize((Widget)BW);
if (BW->core.visible)
XClearArea(XtDisplay(BW), XtWindow(BW),
0, 0,
BW->core.width, BW->core.height,
True);
}
static void
Destroy(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
XFreeGC(XtDisplay(w), BW->bitmap.drawing_gc);
XFreeGC(XtDisplay(w), BW->bitmap.highlighting_gc);
XFreeGC(XtDisplay(w), BW->bitmap.frame_gc);
XFreeGC(XtDisplay(w), BW->bitmap.axes_gc);
BWRemoveAllRequests(w);
XtFree(BW->bitmap.filename);
XtFree(BW->bitmap.basename);
}
static void
Resize(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
Dimension squareW, squareH;
squareW = max(1, ((int)BW->core.width - 2 * (int)BW->bitmap.margin) /
(int)BW->bitmap.width);
squareH = max(1, ((int)BW->core.height - 2 * (int)BW->bitmap.margin) /
(int)BW->bitmap.height);
if (BW->bitmap.proportional)
BW->bitmap.squareW = BW->bitmap.squareH = min(squareW, squareH);
else {
BW->bitmap.squareW = squareW;
BW->bitmap.squareH = squareH;
}
BW->bitmap.horizOffset = max((Position)BW->bitmap.margin,
(Position)(BW->core.width -
BW->bitmap.width *
BW->bitmap.squareW) / 2);
BW->bitmap.vertOffset = max((Position)BW->bitmap.margin,
(Position)(BW->core.height -
BW->bitmap.height *
BW->bitmap.squareH) / 2);
BW->bitmap.grid &= ((BW->bitmap.squareW > BW->bitmap.grid_tolerance) &&
(BW->bitmap.squareH > BW->bitmap.grid_tolerance));
}
/* ARGSUSED */
static void
Redisplay(Widget w, XEvent *event, Region region)
{
BitmapWidget BW = (BitmapWidget) w;
if(event->type == Expose
&&
BW->core.visible)
if (BW->bitmap.stipple_change_expose_event == False)
Refresh(BW,
event->xexpose.x, event->xexpose.y,
event->xexpose.width, event->xexpose.height);
}
void
BWClip(Widget w, Position x, Position y, Dimension width, Dimension height)
{
Position from_x, from_y,
to_x, to_y;
BitmapWidget BW = (BitmapWidget) w;
XRectangle rectangle;
from_x = InBitmapX(BW, x);
from_y = InBitmapY(BW, y);
to_x = InBitmapX(BW, x + width);
to_y = InBitmapY(BW, y + height);
QuerySwap(from_x, to_x);
QuerySwap(from_y, to_y);
from_x = max(0, from_x);
from_y = max(0, from_y);
to_x = min(BW->bitmap.width - 1, to_x);
to_y = min(BW->bitmap.height - 1, to_y);
rectangle.x = InWindowX(BW, from_x);
rectangle.y = InWindowY(BW, from_y);
rectangle.width = InWindowX(BW, to_x + 1) - InWindowX(BW, from_x);
rectangle.height = InWindowY(BW, to_y + 1) - InWindowY(BW, from_y);
XSetClipRectangles(XtDisplay(BW),
BW->bitmap.highlighting_gc,
0, 0,
&rectangle, 1,
Unsorted);
XSetClipRectangles(XtDisplay(BW),
BW->bitmap.drawing_gc,
0, 0,
&rectangle, 1,
Unsorted);
XSetClipRectangles(XtDisplay(BW),
BW->bitmap.frame_gc,
0, 0,
&rectangle, 1,
Unsorted);
XSetClipRectangles(XtDisplay(BW),
BW->bitmap.axes_gc,
0, 0,
&rectangle, 1,
Unsorted);
}
void
BWUnclip(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
XRectangle rectangle;
rectangle.x = InWindowX(BW, 0);
rectangle.y = InWindowY(BW, 0);
rectangle.width = InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0);
rectangle.height = InWindowY(BW, BW->bitmap.height) - InWindowY(BW, 0);
XSetClipRectangles(XtDisplay(BW),
BW->bitmap.highlighting_gc,
0, 0,
&rectangle, 1,
Unsorted);
XSetClipRectangles(XtDisplay(BW),
BW->bitmap.drawing_gc,
0, 0,
&rectangle, 1,
Unsorted);
XSetClipRectangles(XtDisplay(BW),
BW->bitmap.frame_gc,
0, 0,
&rectangle, 1,
Unsorted);
XSetClipRectangles(XtDisplay(BW),
BW->bitmap.axes_gc,
0, 0,
&rectangle, 1,
Unsorted);
}
static void
Refresh(BitmapWidget BW, Position x, Position y,
Dimension width, Dimension height)
{
XRectangle rectangle;
rectangle.x = min(x, InWindowX(BW, InBitmapX(BW, x)));
rectangle.y = min(y, InWindowY(BW, InBitmapY(BW, y)));
rectangle.width = max(x + width,
InWindowX(BW, InBitmapX(BW, x + width)+1)) - rectangle.x;
rectangle.height = max(y + height,
InWindowY(BW, InBitmapY(BW, y + height)+1)) - rectangle.y;
XClearArea(XtDisplay(BW), XtWindow(BW),
rectangle.x, rectangle.y,
rectangle.width, rectangle.height,
False);
XSetClipRectangles(XtDisplay(BW),
BW->bitmap.frame_gc,
0, 0,
&rectangle, 1,
Unsorted);
XDrawRectangle(XtDisplay(BW), XtWindow(BW),
BW->bitmap.frame_gc,
InWindowX(BW, 0) - 1, InWindowY(BW, 0) - 1,
InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0) + 1,
InWindowY(BW, BW->bitmap.height) - InWindowY(BW, 0) + 1);
BWClip((Widget) BW, x, y, width, height);
BWRedrawGrid((Widget) BW, x, y, width, height);
BWRedrawSquares((Widget) BW, x, y, width, height);
BWRedrawMark((Widget) BW);
BWRedrawHotSpot((Widget) BW);
BWRedrawAxes((Widget) BW);
BWUnclip((Widget) BW);
}
Boolean
BWQueryGrid(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
return BW->bitmap.grid;
}
void
BWSwitchGrid(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
BW->bitmap.grid ^= TRUE;
BWDrawGrid(w,
0, 0,
BW->bitmap.image->width - 1, BW->bitmap.image->height - 1);
}
void
BWGrid(Widget w, Boolean _switch)
{
BitmapWidget BW = (BitmapWidget) w;
if (BW->bitmap.grid != _switch)
BWSwitchGrid(w);
}
Boolean
BWQueryDashed(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
return (BW->bitmap.dashed);
}
void
BWSwitchDashed(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
XRectangle rectangle;
BWRedrawGrid(w, 0, 0, BW->bitmap.width - 1, BW->bitmap.height - 1);
rectangle.x = 0;
rectangle.y = 0;
rectangle.width = BW->core.width;
rectangle.height = BW->core.height;
XSetClipRectangles(XtDisplay(BW),
BW->bitmap.frame_gc,
0, 0,
&rectangle, 1,
Unsorted);
XDrawRectangle(XtDisplay(BW), XtWindow(BW),
BW->bitmap.frame_gc,
InWindowX(BW, 0) - 1, InWindowY(BW, 0) - 1,
InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0) + 1,
InWindowY(BW, BW->bitmap.height) - InWindowY(BW, 0) + 1);
BW->bitmap.dashed ^= True;
XSetFillStyle(XtDisplay(BW), BW->bitmap.frame_gc,
(BW->bitmap.dashed ? FillStippled : FillSolid));
XDrawRectangle(XtDisplay(BW), XtWindow(BW),
BW->bitmap.frame_gc,
InWindowX(BW, 0) - 1, InWindowY(BW, 0) - 1,
InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0) + 1,
InWindowY(BW, BW->bitmap.height) - InWindowY(BW, 0) + 1);
BWUnclip(w);
BWRedrawGrid(w, 0, 0, BW->bitmap.width - 1, BW->bitmap.height - 1);
}
void
BWDashed(Widget w, Boolean _switch)
{
BitmapWidget BW = (BitmapWidget) w;
if (BW->bitmap.dashed != _switch)
BWSwitchDashed(w);
}
static Boolean
SetValues(Widget old, Widget request, Widget new,
ArgList args, Cardinal *num_args) /* ARGSUSED */
{
BitmapWidget oldbw = (BitmapWidget) old;
BitmapWidget newbw = (BitmapWidget) new;
Boolean resize = False;
Boolean redisplay = False;
#define NE(field) (oldbw->field != newbw->field)
if (NE(bitmap.grid))
BWSwitchGrid(old);
if (NE(bitmap.dashed))
BWSwitchDashed(old);
if (NE(bitmap.axes))
BWSwitchAxes(old);
if (NE(bitmap.stippled))
BWSwitchStippled(old);
if (NE(bitmap.proportional))
resize = True;
if (NE(bitmap.filename) || NE(bitmap.basename) || NE(bitmap.size))
BWChangeNotify(old);
if (NE(bitmap.filename)) {
if (newbw->bitmap.filename) {
XtFree(oldbw->bitmap.filename);
newbw->bitmap.filename = XtNewString(newbw->bitmap.filename);
}
else
newbw->bitmap.filename = oldbw->bitmap.filename;
}
if (NE(bitmap.basename)) {
if (newbw->bitmap.basename) {
XtFree(oldbw->bitmap.basename);
newbw->bitmap.basename = XtNewString(newbw->bitmap.basename);
}
else
newbw->bitmap.basename = oldbw->bitmap.basename;
}
if (NE(bitmap.size)) {
Dimension width, height;
if (BWParseSize(newbw->bitmap.size, &width, &height)) {
ResizeGrid(newbw, width, height);
resize = True;
}
}
if (NE(bitmap.margin) ||
NE(bitmap.grid_tolerance) ||
NE(bitmap.squareW) ||
NE(bitmap.squareH) ||
NE(core.height) ||
NE(core.width))
resize = True;
if (NE(bitmap.hot.x) || NE(bitmap.hot.y))
BWSetHotSpot(old, newbw->bitmap.hot.x, newbw->bitmap.hot.y);
if (NE(bitmap.foreground_pixel) || NE(core.background_pixel)) {
XSetForeground(XtDisplay(new),
newbw->bitmap.drawing_gc,
newbw->bitmap.foreground_pixel
^
newbw->core.background_pixel);
redisplay = True;
}
if (NE(bitmap.frame_pixel) || NE(core.background_pixel)) {
XSetForeground(XtDisplay(new),
newbw->bitmap.frame_gc,
newbw->bitmap.frame_pixel
^
newbw->core.background_pixel);
redisplay = True;
}
if (NE(bitmap.dashes)) {
XSetStipple(XtDisplay(new),
newbw->bitmap.frame_gc,
newbw->bitmap.dashes);
redisplay = True;
}
if (NE(bitmap.highlight_pixel) || NE(core.background_pixel)) {
RedrawStippled(newbw);
XSetForeground(XtDisplay(new),
newbw->bitmap.highlighting_gc,
newbw->bitmap.highlight_pixel
^
newbw->core.background_pixel);
RedrawStippled(newbw);
}
if (NE(bitmap.stipple)) {
RedrawStippled(newbw);
XSetStipple(XtDisplay(new),
newbw->bitmap.highlighting_gc,
newbw->bitmap.stipple);
RedrawStippled(newbw);
}
if (resize) Resize((Widget)newbw);
return (redisplay || resize);
#undef NE
}
Boolean
BWQueryProportional(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
return (BW->bitmap.proportional);
}
void
BWSwitchProportional(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
BW->bitmap.proportional ^= True;
Resize((Widget)BW);
if (BW->core.visible)
XClearArea(XtDisplay(BW), XtWindow(BW),
0, 0,
BW->core.width, BW->core.height,
True);
}
#if 0
void
BWProportional(Widget w, Boolean _switch)
{
BitmapWidget BW = (BitmapWidget) w;
if (BW->bitmap.proportional != _switch)
BWSwitchProportional(w);
}
#endif
void
BWTPaste(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
BitmapWidget BW = (BitmapWidget) w;
BWRequestSelection(w, event->xbutton.time, TRUE);
if (!BWQueryStored(w))
return;
BWEngageRequest(w, RestoreRequest, False,
(char *)&(event->xbutton.state), sizeof(int));
OnePointHandler(w,
(BWStatus*) BW->bitmap.request_stack[BW->bitmap.current].status,
event, NULL);
}
void
BWTMark(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
BitmapWidget BW = (BitmapWidget) w;
BWEngageRequest(w, MarkRequest, False,
(char *)&(event->xbutton.state), sizeof(int));
TwoPointsHandler(w,
(BWStatus*) BW->bitmap.request_stack[BW->bitmap.current].status,
event, NULL);
}
void
BWTMarkAll(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
BWMarkAll(w);
BWGrabSelection(w, event->xkey.time);
}
void
BWTUnmark(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
BWUnmark(w);
}
/*****************************************************************************/
|
8ba842a630d31d1c55bcb7b097e61d9aa60b427e
|
3f4d0b56aa1c544e14e527d41d8bc588e5a5810c
|
/include/duda/duda_event.h
|
a1d47040e324844d7beaceeaa70dac083086f095
|
[
"Apache-2.0"
] |
permissive
|
monkey/duda
|
0ddfbba07dae5cdcb8248dbb35a515da3ac98a93
|
c162b5761836f7bd9e333b36658d1b949fad63ed
|
refs/heads/master
| 2021-01-18T23:25:54.145293
| 2016-07-29T15:07:05
| 2016-07-29T15:07:05
| 6,199,206
| 105
| 23
| null | 2015-04-27T13:31:49
| 2012-10-13T03:01:34
|
C
|
UTF-8
|
C
| false
| false
| 4,272
|
h
|
duda_event.h
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* Duda I/O
* --------
* Copyright (C) 2012-2016, Eduardo Silva P. <eduardo@monkey.io>
*
* 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 DUDA_EVENT_H
#define DUDA_EVENT_H
#include <monkey/mk_api.h>
#include <monkey/mk_core.h>
#include "duda.h"
#define DUDA_EVENT_READ MK_EVENT_READ
#define DUDA_EVENT_WRITE MK_EVENT_WRITE
#define DUDA_EVENT_RW (MK_EVENT_READ | MK_EVENT_WRITE)
#define DUDA_EVENT_SLEEP MK_EVENT_SLEEP
#define DUDA_EVENT_WAKEUP -1
#define DUDA_EVENT_HANGUP MK_EPOLL_HANGUP
#define DUDA_EVENT_LEVEL_TRIGGERED MK_EVENT_LEVEL
#define DUDA_EVENT_EDGE_TRIGGERED MK_EVENT_EDGE
/* Return values for a given callback through events interface */
#define DUDA_EVENT_OWNED MK_PLUGIN_RET_EVENT_OWNED
#define DUDA_EVENT_CLOSE MK_PLUGIN_RET_EVENT_CLOSE
#define DUDA_EVENT_CONTINUE MK_PLUGIN_RET_EVENT_CONTINUE
/* Thread key to map the event lists per worker */
extern __thread struct mk_list *duda_events_list;
struct duda_event_signal_channel {
int fd_r;
int fd_w;
struct mk_list _head;
};
struct mk_list duda_event_signals_list;
struct duda_event_handler {
int sockfd;
int mode;
int behavior;
int (*cb_on_read) (int, void *);
int (*cb_on_write) (int, void *);
int (*cb_on_error) (int, void *);
int (*cb_on_close) (int, void *);
int (*cb_on_timeout) (int, void *);
void *cb_data;
struct mk_list _head;
};
struct duda_api_event {
int (*add) (int,
int, int,
int (*cb_on_read) (int, void *),
int (*cb_on_write) (int, void *),
int (*cb_on_error) (int, void *),
int (*cb_on_close) (int, void *),
int (*cb_on_timeout) (int, void *),
void *);
struct duda_event_handler *(*lookup) (int);
int (*mode) (int, int, int);
int (*delete) (int);
int (*signal) (uint64_t);
int (*create_signal_fd) ();
/* Loop based calls */
struct mk_event_loop *(*loop_create) (int);
int (*loop_add) (struct mk_event_loop *, int, int, uint32_t, void *);
int (*loop_delete) (struct mk_event_loop *, struct mk_event *);
int (*loop_timeout_create) (struct mk_event_loop *, int, void *);
int (*loop_channel_create) (struct mk_event_loop *, int *, int *, void *);
int (*loop_wait) (struct mk_event_loop *);
char *(*loop_backend) ();
};
/* Export an API object */
struct duda_api_event *duda_event_object();
/* Register a new event into Duda events handler */
int duda_event_add(int sockfd,
int mode, int behavior,
int (*cb_on_read) (int sockfd, void *data),
int (*cb_on_write) (int sockfd, void *data),
int (*cb_on_error) (int sockfd, void *data),
int (*cb_on_close) (int sockfd, void *data),
int (*cb_on_timeout) (int sockfd, void *data),
void *cb_data);
/* Lookup a specific event_handler through it socket descriptor */
struct duda_event_handler *duda_event_lookup(int sockfd);
/* Change the file descriptor mode and behavior */
int duda_event_mode(int sockfd, int mode, int behavior);
/* Delete an event_handler from the thread list */
int duda_event_delete(int sockfd);
/* Emit a signal to all workers */
int duda_event_signal(uint64_t val);
int duda_event_create_signal_fd();
static inline void duda_event_set_signal_callback(void (*func) (int, uint64_t))
{
(void) func;
/* FIXME
_setup.event_signal_cb = func;
*/
}
/* internal functions */
int duda_event_fd_read(int fd, void *data);
#endif
|
f66c01e76029fa39598321c89f0811fb5abb5667
|
9de0cec678bc4a3bec2b4adabef9f39ff5b4afac
|
/PWGJE/EMCALJetTasks/macros/AddTaskChargedParticlesRefMC.C
|
66f08125ce5d2054bf10d6b8cceb16bbc0547811
|
[] |
permissive
|
alisw/AliPhysics
|
91bf1bd01ab2af656a25ff10b25e618a63667d3e
|
5df28b2b415e78e81273b0d9bf5c1b99feda3348
|
refs/heads/master
| 2023-08-31T20:41:44.927176
| 2023-08-31T14:51:12
| 2023-08-31T14:51:12
| 61,661,378
| 129
| 1,150
|
BSD-3-Clause
| 2023-09-14T18:48:45
| 2016-06-21T19:31:29
|
C++
|
UTF-8
|
C
| false
| false
| 241
|
c
|
AddTaskChargedParticlesRefMC.C
|
PWGJE::EMCALJetTasks::AliAnalysisTaskChargedParticlesRefMC *AddTaskChargedParticlesRefMC(const char *cutname = "standard"){
return PWGJE::EMCALJetTasks::AliAnalysisTaskChargedParticlesRefMC::AddTaskChargedParticlesRefMCDefault(cutname);
}
|
7be9df7255701333925e5983c1f1e346e6cf7713
|
bcb62f36caa6ab1f92715cffae29cf4353d247e8
|
/include/course_offsets.h
|
5b10a89402be10db64e7a16e37267ac1e2a6e9ae
|
[] |
no_license
|
n64decomp/mk64
|
4b74ffb8c896e739b908534b74bc1cb79a21ae60
|
c4c00f159845fddd1eced906c14cc25a0cb7a10b
|
refs/heads/master
| 2023-09-01T02:48:30.111868
| 2023-09-01T02:28:49
| 2023-09-01T02:28:49
| 304,205,548
| 476
| 88
| null | 2023-09-14T04:36:28
| 2020-10-15T04:01:57
|
C
|
UTF-8
|
C
| false
| false
| 320
|
h
|
course_offsets.h
|
#ifndef COURSE_OFFSETS_H
#define COURSE_OFFSETS_H
#include <PR/ultratypes.h>
typedef struct
{
u8 *addr; // segmented address texture file
u32 file_size; // compressed file size
u32 data_size; // uncompressed texture size
u32 padding; // always zero
} course_texture;
#endif // COURSE_OFFSETS_H
|
7578332e1e7ec6e73bfa5279aef237fe047d2150
|
07aeb5740a8dae36edf24e2686ff67e2959758fe
|
/programs/subprojects/net/callback.c
|
f7d4d8a3a2282045cded903de1eb4c03ba27c71e
|
[
"MIT"
] |
permissive
|
codyd51/axle
|
59e992987bb871296aeadc69fc7244798090f3b1
|
96ae8852f15ad5c0a77c621c323ba47b4a7bdc69
|
refs/heads/paging-demo
| 2023-06-08T11:31:19.429032
| 2023-05-30T06:45:30
| 2023-05-30T06:45:30
| 58,590,685
| 597
| 61
|
MIT
| 2023-02-21T06:02:34
| 2016-05-11T23:41:08
|
C
|
UTF-8
|
C
| false
| false
| 2,479
|
c
|
callback.c
|
#include "callback.h"
#include <libutils/array.h>
#include <stdlib.h>
#define CALLBACK_LIST_MAX_CALLBACKS 64
typedef struct callback {
void* ctx;
bool (*is_callback_satisfied)(void*);
void (*complete_callback)(void*);
} callback_t;
void* callback_list_init(void) {
array_t* callbacks = array_create(CALLBACK_LIST_MAX_CALLBACKS);
return callbacks;
}
void* callback_list_destroy(void* callback_list) {
array_destroy(callback_list);
}
void callback_list_add_callback(
void* callback_list_opaque,
void* callback_info,
cb_is_satisfied_func is_satisfied,
cb_complete_func complete
) {
array_t* callback_list = (array_t*)callback_list_opaque;
callback_t* cb = calloc(1, sizeof(callback_t));
cb->ctx = callback_info;
cb->is_callback_satisfied = is_satisfied;
cb->complete_callback = complete;
array_insert(callback_list, cb);
}
void callback_list_invoke_ready_callbacks(void* callback_list_opaque) {
array_t* callback_list = (array_t*)callback_list_opaque;
int callback_indexes_to_complete[callback_list->size];
int completed_callback_count = 0;
for (int i = 0; i < callback_list->size; i++) {
callback_t* cb = array_lookup(callback_list, i);
if (cb->is_callback_satisfied(cb->ctx)) {
callback_indexes_to_complete[completed_callback_count++] = i;
}
}
// Go from high indexes to low indexes to keep the indexes the same as we remove elements
for (int i = completed_callback_count-1; i >= 0; i--) {
int idx = callback_indexes_to_complete[i];
callback_t* cb = array_lookup(callback_list, idx);
array_remove(callback_list, idx);
// Dispatch the callback
cb->complete_callback(cb->ctx);
free(cb);
}
}
bool callback_list_invoke_callback_if_ready(void* callback_list_opaque, void* ctx) {
array_t* callback_list = (array_t*)callback_list_opaque;
// First, find the mentioned callback
for (int i = 0; i < callback_list->size; i++) {
callback_t* cb = array_lookup(callback_list, i);
if (cb->ctx == ctx) {
if (cb->is_callback_satisfied(cb->ctx)) {
array_remove(callback_list, i);
// Dispatch the callback
cb->complete_callback(cb->ctx);
free(cb);
return true;
}
return false;
}
}
// We didn't find the provided callback at all
return false;
}
|
ab66cea446cb8648e89fe5fe3ef0a30394f938a7
|
c26d7b0ed875357278e61627da2da0650da77986
|
/sys/include/fs.h
|
339d96da3a06eed87a1d72fd236f9845cfe76e6d
|
[
"BSD-3-Clause"
] |
permissive
|
RetroBSD/retrobsd
|
5343d9e3c424637fc3ad5b03fe720b2744490025
|
486f81f6abff01c7dcc207235cd2979b226a95ff
|
refs/heads/master
| 2023-09-02T23:12:05.110883
| 2023-07-07T18:41:40
| 2023-07-07T18:41:40
| 18,598,087
| 282
| 59
|
BSD-3-Clause
| 2023-07-18T07:35:36
| 2014-04-09T13:25:46
|
C
|
UTF-8
|
C
| false
| false
| 5,605
|
h
|
fs.h
|
/*
* Copyright (c) 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#ifndef _SYS_FS_H_
#define _SYS_FS_H_
/*
* The root inode is the root of the file system.
* Inode 0 can't be used for normal purposes and
* historically bad blocks were linked to inode 1,
* thus the root inode is 2. (inode 1 is no longer used for
* this purpose, however numerous dump tapes make this
* assumption, so we are stuck with it)
* The lost+found directory is given the next available
* inode when it is created by ``mkfs''.
*/
#define SBSIZE DEV_BSIZE
#define SUPERB ((daddr_t)0) /* block number of the super block */
#define ROOTINO ((ino_t)2) /* i number of all roots */
#define LOSTFOUNDINO (ROOTINO + 1)
#define NICINOD 32 /* number of superblock inodes */
#define NICFREE 200 /* number of superblock free blocks */
/*
* The path name on which the file system is mounted is maintained
* in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
* the super block for this name.
*/
#define MAXMNTLEN 28
/*
* Super block for a file system. NOTE: The 'fs_flock' and 'fs_ilock'
* fields MUST be on an even byte boundary because they are used as sleep()
* channels and odd values specify a network sleep().
*/
struct fs
{
u_int fs_magic1; /* magic word */
u_int fs_isize; /* first block after i-list */
u_int fs_fsize; /* size in blocks of entire volume */
u_int fs_swapsz; /* size in blocks of swap area */
int fs_nfree; /* number of addresses in fs_free */
daddr_t fs_free [NICFREE]; /* free block list */
int fs_ninode; /* number of inodes in fs_inode */
ino_t fs_inode [NICINOD]; /* free inode list */
int fs_flock; /* lock during free list manipulation */
int fs_fmod; /* super block modified flag */
int fs_ilock; /* lock during i-list manipulation */
int fs_ronly; /* mounted read-only flag */
time_t fs_time; /* last super block update */
u_int fs_tfree; /* total free blocks */
ino_t fs_tinode; /* total free inodes */
char fs_fsmnt [MAXMNTLEN]; /* ordinary file mounted on */
ino_t fs_lasti; /* start place for circular search */
ino_t fs_nbehind; /* est # free inodes before s_lasti */
u_int fs_flags; /* mount time flags */
u_int fs_magic2; /* magic word */
/* actually longer */
};
struct fblk {
int df_nfree; /* number of addresses in df_free */
daddr_t df_free [NICFREE]; /* free block list */
};
#define FSMAGIC1 ('F' | 'S'<<8 | '<'<<16 | '<'<<24)
#define FSMAGIC2 ('>' | '>'<<8 | 'F'<<16 | 'S'<<24)
/*
* Turn file system block numbers into disk block addresses.
* This maps file system blocks to device size blocks.
*/
#define fsbtodb(b) ((daddr_t) (b))
#define dbtofsb(b) ((daddr_t) (b))
/*
* Macros for handling inode numbers:
* inode number to file system block offset.
* inode number to file system block address.
*/
#define itoo(x) ((int)(((x) + INOPB - 1) % INOPB))
#define itod(x) ((daddr_t)((((u_int)(x) + INOPB - 1) / INOPB)))
/*
* The following macros optimize certain frequently calculated
* quantities by using shifts and masks in place of divisions
* modulos and multiplications.
*/
#define blkoff(loc) /* calculates (loc % fs->fs_bsize) */ \
((loc) & DEV_BMASK)
#define lblkno(loc) /* calculates (loc / fs->fs_bsize) */ \
((unsigned) (loc) >> DEV_BSHIFT)
/*
* Determine the number of available blocks given a
* percentage to hold in reserve
*/
#define freespace(fs, percentreserved) \
((fs)->fs_tfree - ((fs)->fs_fsize - \
(fs)->fs_isize) * (percentreserved) / 100)
/*
* INOPB is the number of inodes in a secondary storage block.
*/
#define INOPB 16 /* MAXBSIZE / sizeof(dinode) */
/*
* NINDIR is the number of indirects in a file system block.
*/
#define NINDIR (DEV_BSIZE / sizeof(daddr_t))
#define NSHIFT 8 /* log2(NINDIR) */
#define NMASK 0377L /* NINDIR - 1 */
/*
* We continue to implement pipes within the file system because it would
* be pretty tough for us to handle 10 4K blocked pipes on a 1M machine.
*
* 4K is the allowable buffering per write on a pipe. This is also roughly
* the max size of the file created to implement the pipe. If this size is
* bigger than 4096, pipes will be implemented with large files, which is
* probably not good.
*/
#define MAXPIPSIZ (NDADDR * MAXBSIZE)
#ifdef KERNEL
struct inode;
/*
* Map a device number into a pointer to the incore super block.
*/
struct fs *getfs (dev_t dev);
/*
* Mount a filesystem on the given directory inode.
*/
struct fs *mountfs (dev_t dev, int flags, struct inode *ip);
void mount_updname (struct fs *fs, char *on, char *from,
int lenon, int lenfrom);
/*
* Sync a single filesystem.
*/
struct mount;
int ufs_sync (struct mount *mp);
/*
* Check that a specified block number is in range.
*/
int badblock (struct fs *fp, daddr_t bn);
/*
* Print the name of a file system with an error diagnostic.
*/
void fserr (struct fs *fp, char *message);
#endif /* KERNEL */
#endif /* _SYS_FS_H_ */
|
f3681db7eec3dead9ebd3c6a4660b349780fdaa9
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/s390/cio/css.h
|
b1de6033523806e8fa58e1f2ed87b31c0ca950d2
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 4,456
|
h
|
css.h
|
#ifndef _CSS_H
#define _CSS_H
#include <linux/mutex.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
#include <linux/device.h>
#include <linux/types.h>
#include <asm/cio.h>
#include <asm/chpid.h>
#include <asm/schid.h>
#include "cio.h"
/*
* path grouping stuff
*/
#define SPID_FUNC_SINGLE_PATH 0x00
#define SPID_FUNC_MULTI_PATH 0x80
#define SPID_FUNC_ESTABLISH 0x00
#define SPID_FUNC_RESIGN 0x40
#define SPID_FUNC_DISBAND 0x20
#define SNID_STATE1_RESET 0
#define SNID_STATE1_UNGROUPED 2
#define SNID_STATE1_GROUPED 3
#define SNID_STATE2_NOT_RESVD 0
#define SNID_STATE2_RESVD_ELSE 2
#define SNID_STATE2_RESVD_SELF 3
#define SNID_STATE3_MULTI_PATH 1
#define SNID_STATE3_SINGLE_PATH 0
struct path_state {
__u8 state1 : 2; /* path state value 1 */
__u8 state2 : 2; /* path state value 2 */
__u8 state3 : 1; /* path state value 3 */
__u8 resvd : 3; /* reserved */
} __attribute__ ((packed));
struct extended_cssid {
u8 version;
u8 cssid;
} __attribute__ ((packed));
struct pgid {
union {
__u8 fc; /* SPID function code */
struct path_state ps; /* SNID path state */
} __attribute__ ((packed)) inf;
union {
__u32 cpu_addr : 16; /* CPU address */
struct extended_cssid ext_cssid;
} __attribute__ ((packed)) pgid_high;
__u32 cpu_id : 24; /* CPU identification */
__u32 cpu_model : 16; /* CPU model */
__u32 tod_high; /* high word TOD clock */
} __attribute__ ((packed));
struct subchannel;
struct chp_link;
/**
* struct css_driver - device driver for subchannels
* @subchannel_type: subchannel type supported by this driver
* @drv: embedded device driver structure
* @irq: called on interrupts
* @chp_event: called for events affecting a channel path
* @sch_event: called for events affecting the subchannel
* @probe: function called on probe
* @remove: function called on remove
* @shutdown: called at device shutdown
* @prepare: prepare for pm state transition
* @complete: undo work done in @prepare
* @freeze: callback for freezing during hibernation snapshotting
* @thaw: undo work done in @freeze
* @restore: callback for restoring after hibernation
* @settle: wait for asynchronous work to finish
*/
struct css_driver {
struct css_device_id *subchannel_type;
struct device_driver drv;
void (*irq)(struct subchannel *);
int (*chp_event)(struct subchannel *, struct chp_link *, int);
int (*sch_event)(struct subchannel *, int);
int (*probe)(struct subchannel *);
int (*remove)(struct subchannel *);
void (*shutdown)(struct subchannel *);
int (*prepare) (struct subchannel *);
void (*complete) (struct subchannel *);
int (*freeze)(struct subchannel *);
int (*thaw) (struct subchannel *);
int (*restore)(struct subchannel *);
int (*settle)(void);
};
#define to_cssdriver(n) container_of(n, struct css_driver, drv)
extern int css_driver_register(struct css_driver *);
extern void css_driver_unregister(struct css_driver *);
extern void css_sch_device_unregister(struct subchannel *);
extern int css_register_subchannel(struct subchannel *);
extern struct subchannel *css_alloc_subchannel(struct subchannel_id);
extern struct subchannel *get_subchannel_by_schid(struct subchannel_id);
extern int css_init_done;
extern int max_ssid;
int for_each_subchannel_staged(int (*fn_known)(struct subchannel *, void *),
int (*fn_unknown)(struct subchannel_id,
void *), void *data);
extern int for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *);
void css_update_ssd_info(struct subchannel *sch);
struct channel_subsystem {
u8 cssid;
int valid;
struct channel_path *chps[__MAX_CHPID + 1];
struct device device;
struct pgid global_pgid;
struct mutex mutex;
/* channel measurement related */
int cm_enabled;
void *cub_addr1;
void *cub_addr2;
/* for orphaned ccw devices */
struct subchannel *pseudo_subchannel;
};
#define to_css(dev) container_of(dev, struct channel_subsystem, device)
extern struct channel_subsystem *channel_subsystems[];
void channel_subsystem_reinit(void);
/* Helper functions to build lists for the slow path. */
void css_schedule_eval(struct subchannel_id schid);
void css_schedule_eval_all(void);
int css_complete_work(void);
int sch_is_pseudo_sch(struct subchannel *);
struct schib;
int css_sch_is_valid(struct schib *);
extern struct workqueue_struct *cio_work_q;
void css_wait_for_slow_path(void);
void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo);
#endif
|
a338eb45970a4e1364729ed46d0d2d899b71602c
|
275af38f3b87e907d65b02fa351ddde714836451
|
/src/unix/unix_c/unix_lockf_job.c
|
a0449d80fd1e423831bedeee606566addab9e6b0
|
[
"MIT"
] |
permissive
|
ocsigen/lwt
|
e8fd425b1925308b95ae36a76408b236f8c7161c
|
2eee2a1b9e386cc0eacf455a5a9356150f920edb
|
refs/heads/master
| 2023-08-08T23:37:48.176938
| 2023-08-04T13:08:55
| 2023-08-04T13:08:55
| 11,749,475
| 672
| 199
|
MIT
| 2023-08-23T06:58:15
| 2013-07-29T20:47:51
|
OCaml
|
UTF-8
|
C
| false
| false
| 2,980
|
c
|
unix_lockf_job.c
|
/* This file is part of Lwt, released under the MIT license. See LICENSE.md for
details, or visit https://github.com/ocsigen/lwt/blob/master/LICENSE.md. */
#include "lwt_config.h"
#if !defined(LWT_ON_WINDOWS)
#include <caml/mlvalues.h>
#include <caml/unixsupport.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include "lwt_unix.h"
struct job_lockf {
struct lwt_unix_job job;
int fd;
int command;
long length;
int result;
int error_code;
};
#if defined(F_GETLK) && defined(F_SETLK) && defined(F_SETLKW)
static void worker_lockf(struct job_lockf *job)
{
struct flock l;
l.l_whence = 1;
if (job->length < 0) {
l.l_start = job->length;
l.l_len = -job->length;
} else {
l.l_start = 0L;
l.l_len = job->length;
}
switch (job->command) {
case 0: /* F_ULOCK */
l.l_type = F_UNLCK;
job->result = fcntl(job->fd, F_SETLK, &l);
job->error_code = errno;
break;
case 1: /* F_LOCK */
l.l_type = F_WRLCK;
job->result = fcntl(job->fd, F_SETLKW, &l);
job->error_code = errno;
break;
case 2: /* F_TLOCK */
l.l_type = F_WRLCK;
job->result = fcntl(job->fd, F_SETLK, &l);
job->error_code = errno;
break;
case 3: /* F_TEST */
l.l_type = F_WRLCK;
job->result = fcntl(job->fd, F_GETLK, &l);
if (job->result != -1) {
if (l.l_type == F_UNLCK) {
job->result = 0;
} else {
job->result = -1;
job->error_code = EACCES;
}
}
break;
case 4: /* F_RLOCK */
l.l_type = F_RDLCK;
job->result = fcntl(job->fd, F_SETLKW, &l);
job->error_code = errno;
break;
case 5: /* F_TRLOCK */
l.l_type = F_RDLCK;
job->result = fcntl(job->fd, F_SETLK, &l);
job->error_code = errno;
break;
default:
job->result = -1;
job->error_code = EINVAL;
}
}
#else
static int lock_command_table[] = {F_ULOCK, F_LOCK, F_TLOCK,
F_TEST, F_LOCK, F_TLOCK};
static void worker_lockf(struct job_lockf *job)
{
job->result = lockf(job->fd, lock_command_table[job->command], job->length);
job->error_code = errno;
}
#endif
static value result_lockf(struct job_lockf *job)
{
LWT_UNIX_CHECK_JOB(job, job->result < 0, "lockf");
lwt_unix_free_job(&job->job);
return Val_unit;
}
CAMLprim value lwt_unix_lockf_job(value val_fd, value val_command,
value val_length)
{
LWT_UNIX_INIT_JOB(job, lockf, 0);
job->fd = Int_val(val_fd);
job->command = Int_val(val_command);
job->length = Long_val(val_length);
return lwt_unix_alloc_job(&job->job);
}
#endif
|
acf68300f22d345518443fa8d3811c82274a383c
|
64e25c9d67db2ce4b5abe1a980a070fb59a2f938
|
/clang/lib/Headers/cm/include/cm/cm_threads.h
|
0a374b00fbfb5f0eb1c9b050b24e96ce8ac34f20
|
[
"NCSA",
"MIT"
] |
permissive
|
intel/cm-compiler
|
22d8b56baefc26d5576572f5aab6b3ecb3033300
|
9b2e628b788344088d8fcfd97d406db576f608af
|
refs/heads/cmc_monorepo_80
| 2023-08-28T13:09:41.523730
| 2023-08-04T23:23:23
| 2023-08-04T23:23:23
| 111,158,121
| 141
| 60
| null | 2023-05-01T21:17:30
| 2017-11-17T22:50:46
|
C++
|
UTF-8
|
C
| false
| false
| 1,821
|
h
|
cm_threads.h
|
/*========================== begin_copyright_notice ============================
Copyright (C) 2022 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/
#if (__INCLUDE_LEVEL__ == 1)
static_assert(0, "CM:w:cm_threads.h should not be included explicitly - only "
"<cm/cm.h> is required");
#endif
#ifndef _CLANG_CM_THREADS_H_
#define _CLANG_CM_THREADS_H_
#include "spirv/builtins.h"
CM_NODEBUG CM_INLINE uint cm_local_id(uint dim) {
return __spirv_BuiltInLocalInvocationId(dim);
}
CM_NODEBUG CM_INLINE uint cm_local_size(uint dim) {
return __spirv_BuiltInWorkgroupSize(dim);
}
CM_NODEBUG CM_INLINE uint cm_group_id(uint dim) {
return __spirv_BuiltInWorkgroupId(dim);
}
CM_NODEBUG CM_INLINE uint cm_group_count(uint dim) {
return __spirv_BuiltInNumWorkgroups(dim);
}
CM_NODEBUG CM_INLINE uint cm_linear_local_id() {
return __spirv_BuiltInLocalInvocationIndex();
}
CM_NODEBUG CM_INLINE uint cm_linear_local_size() {
return cm_local_size(0) * cm_local_size(1) * cm_local_size(2);
}
CM_NODEBUG CM_INLINE uint cm_linear_group_id() {
return cm_group_count(0) * cm_group_count(1) * cm_group_id(2) +
cm_group_count(0) * cm_group_id(1) + cm_group_id(0);
}
CM_NODEBUG CM_INLINE uint cm_linear_group_count() {
return cm_group_count(0) * cm_group_count(1) * cm_group_count(2);
}
CM_NODEBUG CM_INLINE uint cm_linear_global_id() {
return __spirv_BuiltInGlobalLinearId();
}
CM_NODEBUG CM_INLINE uint cm_linear_global_size() {
return cm_linear_group_count() * cm_linear_local_size();
}
CM_NODEBUG CM_INLINE uint cm_get_hwid() {
return __spirv_BuiltInGlobalHWThreadIDINTEL();
}
CM_NODEBUG CM_INLINE uint cm_get_tileid() {
return __spirv_BuiltInSubDeviceIDINTEL();
}
#endif // _CLANG_CM_THREADS_H_
|
8b685f77d43238fb9960bcdba1a85329950c40cb
|
d38ed5f31d74a79a054ed55dd9123a8d615283b9
|
/third_party/libgit2/src/clone.h
|
864b59029e73fbf25909635ab83b4e0dcc8889e4
|
[
"GPL-2.0-only",
"LicenseRef-scancode-public-domain",
"GCC-exception-2.0",
"LGPL-2.0-or-later",
"Zlib",
"LGPL-2.1-or-later",
"LGPL-2.1-only",
"ISC",
"MIT",
"Apache-2.0"
] |
permissive
|
chigraph/chigraph
|
8ff76a14337da29fa2b2a84d5c35f2eac4156c6e
|
6981bdd6763db54edfe284c1f7d223193584c69a
|
refs/heads/master
| 2022-12-21T13:46:57.273039
| 2022-12-17T18:41:19
| 2022-12-17T18:41:19
| 60,776,831
| 364
| 65
|
Apache-2.0
| 2019-12-13T14:46:43
| 2016-06-09T13:27:37
|
C++
|
UTF-8
|
C
| false
| false
| 406
|
h
|
clone.h
|
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_clone_h__
#define INCLUDE_clone_h__
#include "common.h"
#include "git2/clone.h"
extern int git_clone__should_clone_local(const char *url, git_clone_local_t local);
#endif
|
127e169fb65520d1d1997b2dfb2f4634dd931e6a
|
83372fce92c9088ee5c1e1c13bc67385a3b02a36
|
/src/common/xsprintf.c
|
556e4f35989dc8af05a54ade80b795c68982bd83
|
[
"Zlib"
] |
permissive
|
cc65/cc65
|
2cd1b20b61ddd0691cd4601b4da37a9200a50afb
|
16e90187e8e80c6e2fcfcc04f068ac865d2290e5
|
refs/heads/master
| 2023-09-03T17:16:46.027934
| 2023-09-02T22:30:44
| 2023-09-02T22:30:44
| 8,932,489
| 2,103
| 526
|
Zlib
| 2023-09-13T06:19:01
| 2013-03-21T15:56:48
|
C
|
UTF-8
|
C
| false
| false
| 20,832
|
c
|
xsprintf.c
|
/*****************************************************************************/
/* */
/* xsprintf.c */
/* */
/* Replacement sprintf function */
/* */
/* */
/* */
/* (C) 2000-2004 Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
#include <inttypes.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <limits.h>
/* common */
#include "chartype.h"
#include "check.h"
#include "strbuf.h"
#include "va_copy.h"
#include "xsprintf.h"
/*****************************************************************************/
/* vsnprintf */
/*****************************************************************************/
/* The following is a very basic vsnprintf like function called xvsnprintf. It
** features only the basic format specifiers (especially the floating point
** stuff is missing), but may be extended if required. Reason for supplying
** my own implementation is that vsnprintf is standard but not implemented by
** older compilers, and some that implement it, don't adhere to the standard
** (for example Microsoft with its _vsnprintf).
*/
typedef struct {
/* Variable argument list pointer */
va_list ap;
/* Output buffer */
char* Buf;
size_t BufSize;
size_t BufFill;
/* Argument string buffer and string buffer pointer. The string buffer
** must be big enough to hold a converted integer of the largest type
** including an optional sign and terminating zero.
*/
char ArgBuf[256];
int ArgLen;
/* Flags */
enum {
fNone = 0x0000,
fMinus = 0x0001,
fPlus = 0x0002,
fSpace = 0x0004,
fHash = 0x0008,
fZero = 0x0010,
fWidth = 0x0020,
fPrec = 0x0040,
fUnsigned = 0x0080,
fUpcase = 0x0100
} Flags;
/* Conversion base and table */
unsigned Base;
const char* CharTable;
/* Field width */
int Width;
/* Precision */
int Prec;
/* Length modifier */
enum {
lmChar,
lmShort,
lmInt,
lmLong,
lmIntMax,
lmSizeT,
lmPtrDiffT,
lmLongDouble,
/* Unsupported modifiers */
lmLongLong = lmLong,
/* Default length is integer */
lmDefault = lmInt
} LengthMod;
} PrintfCtrl;
static void AddChar (PrintfCtrl* P, char C)
/* Store one character in the output buffer if there's enough room. */
{
if (++P->BufFill <= P->BufSize) {
*P->Buf++ = C;
}
}
static void AddPadding (PrintfCtrl* P, char C, unsigned Count)
/* Add some amount of padding */
{
while (Count--) {
AddChar (P, C);
}
}
static intmax_t NextIVal (PrintfCtrl*P)
/* Read the next integer value from the variable argument list */
{
switch (P->LengthMod) {
case lmChar: return (char) va_arg (P->ap, int);
case lmShort: return (short) va_arg (P->ap, int);
case lmInt: return (int) va_arg (P->ap, int);
case lmLong: return (long) va_arg (P->ap, long);
case lmIntMax: return va_arg (P->ap, intmax_t);
case lmSizeT: return (uintmax_t) va_arg (P->ap, size_t);
case lmPtrDiffT: return (long) va_arg (P->ap, ptrdiff_t);
default:
FAIL ("Invalid type size in NextIVal");
return 0;
}
}
static uintmax_t NextUVal (PrintfCtrl*P)
/* Read the next unsigned integer value from the variable argument list */
{
switch (P->LengthMod) {
case lmChar: return (unsigned char) va_arg (P->ap, unsigned);
case lmShort: return (unsigned short) va_arg (P->ap, unsigned);
case lmInt: return (unsigned int) va_arg (P->ap, unsigned int);
case lmLong: return (unsigned long) va_arg (P->ap, unsigned long);
case lmIntMax: return va_arg (P->ap, uintmax_t);
case lmSizeT: return va_arg (P->ap, size_t);
case lmPtrDiffT: return (intmax_t) va_arg (P->ap, ptrdiff_t);
default:
FAIL ("Invalid type size in NextUVal");
return 0;
}
}
static void ToStr (PrintfCtrl* P, uintmax_t Val)
/* Convert the given value to a (reversed) string */
{
char* S = P->ArgBuf;
while (Val) {
*S++ = P->CharTable[Val % P->Base];
Val /= P->Base;
}
P->ArgLen = S - P->ArgBuf;
}
static void FormatInt (PrintfCtrl* P, uintmax_t Val)
/* Convert the integer value */
{
char Lead[5];
unsigned LeadCount = 0;
unsigned PrecPadding;
unsigned WidthPadding;
unsigned I;
/* Determine the translation table */
P->CharTable = (P->Flags & fUpcase)? "0123456789ABCDEF" : "0123456789abcdef";
/* Check if the value is negative */
if ((P->Flags & fUnsigned) == 0 && ((intmax_t) Val) < 0) {
Val = -((intmax_t) Val);
Lead[LeadCount++] = '-';
} else if ((P->Flags & fPlus) != 0) {
Lead[LeadCount++] = '+';
} else if ((P->Flags & fSpace) != 0) {
Lead[LeadCount++] = ' ';
}
/* Convert the value into a (reversed string). */
ToStr (P, Val);
/* The default precision for all integer conversions is one. This means
** that the fPrec flag is always set and does not need to be checked
** later on.
*/
if ((P->Flags & fPrec) == 0) {
P->Flags |= fPrec;
P->Prec = 1;
}
/* Determine the leaders for alternative forms */
if ((P->Flags & fHash) != 0) {
if (P->Base == 16) {
/* Start with 0x */
Lead[LeadCount++] = '0';
Lead[LeadCount++] = (P->Flags & fUpcase)? 'X' : 'x';
} else if (P->Base == 8) {
/* Alternative form for 'o': always add a leading zero. */
if (P->Prec <= P->ArgLen) {
Lead[LeadCount++] = '0';
}
}
}
/* Determine the amount of precision padding needed */
if (P->ArgLen < P->Prec) {
PrecPadding = P->Prec - P->ArgLen;
} else {
PrecPadding = 0;
}
/* Determine the width padding needed */
if ((P->Flags & fWidth) != 0) {
int CurWidth = LeadCount + PrecPadding + P->ArgLen;
if (CurWidth < P->Width) {
WidthPadding = P->Width - CurWidth;
} else {
WidthPadding = 0;
}
} else {
WidthPadding = 0;
}
/* Output left space padding if any */
if ((P->Flags & (fMinus | fZero)) == 0 && WidthPadding > 0) {
AddPadding (P, ' ', WidthPadding);
WidthPadding = 0;
}
/* Leader */
for (I = 0; I < LeadCount; ++I) {
AddChar (P, Lead[I]);
}
/* Left zero padding if any */
if ((P->Flags & fZero) != 0 && WidthPadding > 0) {
AddPadding (P, '0', WidthPadding);
WidthPadding = 0;
}
/* Precision padding */
if (PrecPadding > 0) {
AddPadding (P, '0', PrecPadding);
}
/* The number itself. Beware: It's reversed! */
while (P->ArgLen > 0) {
AddChar (P, P->ArgBuf[--P->ArgLen]);
}
/* Right width padding if any */
if (WidthPadding > 0) {
AddPadding (P, ' ', WidthPadding);
}
}
static void FormatStr (PrintfCtrl* P, const char* Val)
/* Convert the string */
{
unsigned WidthPadding;
/* Get the string length limited to the precision. Beware: We cannot use
** strlen here, because if a precision is given, the string may not be
** zero terminated.
*/
int Len;
if ((P->Flags & fPrec) != 0) {
const char* S = memchr (Val, '\0', P->Prec);
if (S == 0) {
/* Not zero terminated */
Len = P->Prec;
} else {
/* Terminating zero found */
Len = S - Val;
}
} else {
Len = strlen (Val);
}
/* Determine the width padding needed */
if ((P->Flags & fWidth) != 0 && P->Width > Len) {
WidthPadding = P->Width - Len;
} else {
WidthPadding = 0;
}
/* Output left padding */
if ((P->Flags & fMinus) != 0 && WidthPadding > 0) {
AddPadding (P, ' ', WidthPadding);
WidthPadding = 0;
}
/* Output the string */
while (Len--) {
AddChar (P, *Val++);
}
/* Output right padding if any */
if (WidthPadding > 0) {
AddPadding (P, ' ', WidthPadding);
}
}
static void StoreOffset (PrintfCtrl* P)
/* Store the current output offset (%n format spec) */
{
switch (P->LengthMod) {
case lmChar: *va_arg (P->ap, int*) = P->BufFill; break;
case lmShort: *va_arg (P->ap, int*) = P->BufFill; break;
case lmInt: *va_arg (P->ap, int*) = P->BufFill; break;
case lmLong: *va_arg (P->ap, long*) = P->BufFill; break;
case lmIntMax: *va_arg (P->ap, intmax_t*) = P->BufFill; break;
case lmSizeT: *va_arg (P->ap, size_t*) = P->BufFill; break;
case lmPtrDiffT: *va_arg (P->ap, ptrdiff_t*) = P->BufFill; break;
default: FAIL ("Invalid size modifier for %n format spec. in xvsnprintf()");
}
}
int xvsnprintf (char* Buf, size_t Size, const char* Format, va_list ap)
/* A basic vsnprintf implementation. Does currently only support integer
** formats.
*/
{
PrintfCtrl P;
int Done;
char F;
char SBuf[2];
const char* SPtr;
int UseStrBuf = 0;
/* Initialize the control structure */
va_copy (P.ap, ap);
P.Buf = Buf;
P.BufSize = Size;
P.BufFill = 0;
/* Parse the format string */
while ((F = *Format++) != '\0') {
if (F != '%') {
/* Not a format specifier, just copy */
AddChar (&P, F);
continue;
}
/* Check for %% */
if (*Format == '%') {
++Format;
AddChar (&P, '%');
continue;
}
/* It's a format specifier. Check for flags. */
F = *Format++;
P.Flags = fNone;
Done = 0;
while (F != '\0' && !Done) {
switch (F) {
case '-': P.Flags |= fMinus; F = *Format++; break;
case '+': P.Flags |= fPlus; F = *Format++; break;
case ' ': P.Flags |= fSpace; F = *Format++; break;
case '#': P.Flags |= fHash; F = *Format++; break;
case '0': P.Flags |= fZero; F = *Format++; break;
default: Done = 1; break;
}
}
/* Optional field width */
if (F == '*') {
P.Width = va_arg (P.ap, int);
/* A negative field width argument is taken as a - flag followed
** by a positive field width.
*/
if (P.Width < 0) {
P.Flags |= fMinus;
P.Width = -P.Width;
}
F = *Format++;
P.Flags |= fWidth;
} else if (IsDigit (F)) {
P.Width = F - '0';
while (1) {
F = *Format++;
if (!IsDigit (F)) {
break;
}
P.Width = P.Width * 10 + (F - '0');
}
P.Flags |= fWidth;
}
/* Optional precision */
if (F == '.') {
F = *Format++;
P.Flags |= fPrec;
if (F == '*') {
P.Prec = va_arg (P.ap, int);
/* A negative precision argument is taken as if the precision
** were omitted.
*/
if (P.Prec < 0) {
P.Flags &= ~fPrec;
}
F = *Format++; /* Skip the '*' */
} else if (IsDigit (F)) {
P.Prec = F - '0';
while (1) {
F = *Format++;
if (!IsDigit (F)) {
break;
}
P.Prec = P.Prec * 10 + (F - '0');
}
} else if (F == '-') {
/* A negative precision argument is taken as if the precision
** were omitted.
*/
F = *Format++; /* Skip the minus */
while (IsDigit (F = *Format++)) ;
P.Flags &= ~fPrec;
} else {
P.Prec = 0;
}
}
/* Optional length modifier */
P.LengthMod = lmDefault;
switch (F) {
case 'h':
F = *Format++;
if (F == 'h') {
F = *Format++;
P.LengthMod = lmChar;
} else {
P.LengthMod = lmShort;
}
break;
/* support the MSVC specific I64 for long long */
case 'I':
F = *Format++;
if (F == '6') {
F = *Format++;
if (F == '4') {
F = *Format++;
P.LengthMod = lmLongLong;
}
}
break;
case 'l':
F = *Format++;
if (F == 'l') {
F = *Format++;
P.LengthMod = lmLongLong;
} else {
P.LengthMod = lmLong;
}
break;
case 'j':
P.LengthMod = lmIntMax;
F = *Format++;
break;
case 'z':
P.LengthMod = lmSizeT;
F = *Format++;
break;
case 't':
P.LengthMod = lmPtrDiffT;
F = *Format++;
break;
case 'L':
P.LengthMod = lmLongDouble;
F = *Format++;
break;
}
/* If the space and + flags both appear, the space flag is ignored */
if ((P.Flags & (fSpace | fPlus)) == (fSpace | fPlus)) {
P.Flags &= ~fSpace;
}
/* If the 0 and - flags both appear, the 0 flag is ignored */
if ((P.Flags & (fZero | fMinus)) == (fZero | fMinus)) {
P.Flags &= ~fZero;
}
/* If a precision is specified, the 0 flag is ignored */
if (P.Flags & fPrec) {
P.Flags &= ~fZero;
}
/* Conversion specifier */
switch (F) {
case 'd':
case 'i':
P.Base = 10;
FormatInt (&P, NextIVal (&P));
break;
case 'o':
P.Flags |= fUnsigned;
P.Base = 8;
FormatInt (&P, NextUVal (&P));
break;
case 'u':
P.Flags |= fUnsigned;
P.Base = 10;
FormatInt (&P, NextUVal (&P));
break;
case 'X':
P.Flags |= (fUnsigned | fUpcase);
/* FALLTHROUGH */
case 'x':
P.Base = 16;
FormatInt (&P, NextUVal (&P));
break;
case 'c':
SBuf[0] = (char) va_arg (P.ap, int);
SBuf[1] = '\0';
FormatStr (&P, SBuf);
break;
case 's':
SPtr = va_arg (P.ap, const char*);
CHECK (SPtr != 0);
FormatStr (&P, SPtr);
break;
case 'p':
/* See comment at top of header file */
if (UseStrBuf) {
/* Argument is StrBuf */
const StrBuf* S = va_arg (P.ap, const StrBuf*);
CHECK (S != 0);
/* Handle the length by using a precision */
if ((P.Flags & fPrec) != 0) {
/* Precision already specified, use length of string
** if less.
*/
if ((unsigned) P.Prec > SB_GetLen (S)) {
P.Prec = SB_GetLen (S);
}
} else {
/* No precision, add it */
P.Flags |= fPrec;
P.Prec = SB_GetLen (S);
}
FormatStr (&P, SB_GetConstBuf (S));
UseStrBuf = 0; /* Reset flag */
} else {
/* Use hex format for pointers */
P.Flags |= (fUnsigned | fPrec);
P.Prec = ((sizeof (void*) * CHAR_BIT) + 3) / 4;
P.Base = 16;
FormatInt (&P, (uintptr_t) va_arg (P.ap, void*));
}
break;
case 'm':
/* See comment at top of header file */
UseStrBuf = 1;
break;
case 'n':
StoreOffset (&P);
break;
default:
/* Invalid format spec */
FAIL ("Invalid format specifier in xvsnprintf");
}
}
/* We don't need P.ap any longer */
va_end (P.ap);
/* Terminate the output string and return the number of chars that had
** been written if the buffer was large enough.
** Beware: The terminating zero is not counted for the function result!
*/
AddChar (&P, '\0');
return P.BufFill - 1;
}
int xsnprintf (char* Buf, size_t Size, const char* Format, ...)
/* A basic snprintf implementation. Does currently only support integer
** formats.
*/
{
int Res;
va_list ap;
va_start (ap, Format);
Res = xvsnprintf (Buf, Size, Format, ap);
va_end (ap);
return Res;
}
/*****************************************************************************/
/* Code */
/*****************************************************************************/
int xsprintf (char* Buf, size_t BufSize, const char* Format, ...)
/* Replacement function for sprintf */
{
int Res;
va_list ap;
va_start (ap, Format);
Res = xvsprintf (Buf, BufSize, Format, ap);
va_end (ap);
return Res;
}
int xvsprintf (char* Buf, size_t BufSize, const char* Format, va_list ap)
/* Replacement function for sprintf */
{
int Res = xvsnprintf (Buf, BufSize, Format, ap);
CHECK (Res >= 0 && (unsigned) (Res+1) < BufSize);
return Res;
}
|
5e02e204869e033ffdebeef997a4dae88bb71522
|
8a87f5b889a9ce7d81421515f06d9c9cbf6ce64a
|
/3rdParty/boost/1.78.0/boost/stacktrace/detail/push_options.h
|
6d7e46b7ae957aa0e088c9386e1c1153e9ea6ff3
|
[
"BSL-1.0",
"Apache-2.0",
"BSD-3-Clause",
"ICU",
"Zlib",
"GPL-1.0-or-later",
"OpenSSL",
"ISC",
"LicenseRef-scancode-gutenberg-2020",
"MIT",
"GPL-2.0-only",
"CC0-1.0",
"LicenseRef-scancode-autoconf-simple-exception",
"LicenseRef-scancode-pcre",
"Bison-exception-2.2",
"LicenseRef-scancode-public-domain",
"JSON",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense",
"BSD-4-Clause",
"Python-2.0",
"LGPL-2.1-or-later"
] |
permissive
|
arangodb/arangodb
|
0980625e76c56a2449d90dcb8d8f2c485e28a83b
|
43c40535cee37fc7349a21793dc33b1833735af5
|
refs/heads/devel
| 2023-08-31T09:34:47.451950
| 2023-08-31T07:25:02
| 2023-08-31T07:25:02
| 2,649,214
| 13,385
| 982
|
Apache-2.0
| 2023-09-14T17:02:16
| 2011-10-26T06:42:00
|
C++
|
UTF-8
|
C
| false
| false
| 967
|
h
|
push_options.h
|
// Copyright Antony Polukhin, 2016-2021.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// No include guards! Intentionally.
// Link or header only
#if !defined(BOOST_STACKTRACE_LINK) && defined(BOOST_STACKTRACE_DYN_LINK)
# define BOOST_STACKTRACE_LINK
#endif
#if defined(BOOST_STACKTRACE_LINK) && !defined(BOOST_STACKTRACE_DYN_LINK) && defined(BOOST_ALL_DYN_LINK)
# define BOOST_STACKTRACE_DYN_LINK
#endif
#ifdef BOOST_STACKTRACE_LINK
# if defined(BOOST_STACKTRACE_DYN_LINK)
# ifdef BOOST_STACKTRACE_INTERNAL_BUILD_LIBS
# define BOOST_STACKTRACE_FUNCTION BOOST_SYMBOL_EXPORT
# else
# define BOOST_STACKTRACE_FUNCTION BOOST_SYMBOL_IMPORT
# endif
# else
# define BOOST_STACKTRACE_FUNCTION
# endif
#elif !defined(BOOST_STACKTRACE_DOXYGEN_INVOKED)
# define BOOST_STACKTRACE_FUNCTION inline
#endif
|
f42aac62f03e49285539fe0d38fe99b55c969dad
|
00659b20252e5f06c4ebfdf437e6a00b560f37a7
|
/extras/ignorecase.c
|
5f0f35b8ceba73f3132ecd2e3f8419021094ddc6
|
[
"Zlib",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
icculus/physfs
|
5f1090164ce3307757027d56831f6126e2057f8e
|
7931b9b3f4ca3b0685fe35f105a3e5c2a1e0d1ed
|
refs/heads/main
| 2023-08-25T18:27:45.447105
| 2023-08-04T05:33:50
| 2023-08-04T05:33:50
| 381,228,368
| 403
| 74
|
Zlib
| 2023-08-12T09:44:05
| 2021-06-29T03:33:29
|
C
|
UTF-8
|
C
| false
| false
| 5,501
|
c
|
ignorecase.c
|
/** \file ignorecase.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "physfs.h"
#include "ignorecase.h"
/**
* Please see ignorecase.h for details.
*
* License: this code is public domain. I make no warranty that it is useful,
* correct, harmless, or environmentally safe.
*
* This particular file may be used however you like, including copying it
* verbatim into a closed-source project, exploiting it commercially, and
* removing any trace of my name from the source (although I hope you won't
* do that). I welcome enhancements and corrections to this file, but I do
* not require you to send me patches if you make changes. This code has
* NO WARRANTY.
*
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
* Please see LICENSE.txt in the root of the source tree.
*
* \author Ryan C. Gordon.
*/
static int locateOneElement(char *buf)
{
char *ptr;
char **rc;
char **i;
if (PHYSFS_exists(buf))
return 1; /* quick rejection: exists in current case. */
ptr = strrchr(buf, '/'); /* find entry at end of path. */
if (ptr == NULL)
{
rc = PHYSFS_enumerateFiles("/");
ptr = buf;
} /* if */
else
{
*ptr = '\0';
rc = PHYSFS_enumerateFiles(buf);
*ptr = '/';
ptr++; /* point past dirsep to entry itself. */
} /* else */
if (rc != NULL)
{
for (i = rc; *i != NULL; i++)
{
if (PHYSFS_utf8stricmp(*i, ptr) == 0)
{
strcpy(ptr, *i); /* found a match. Overwrite with this case. */
PHYSFS_freeList(rc);
return 1;
} /* if */
} /* for */
PHYSFS_freeList(rc);
} /* if */
/* no match at all... */
return 0;
} /* locateOneElement */
int PHYSFSEXT_locateCorrectCase(char *buf)
{
int rc;
char *ptr;
while (*buf == '/') /* skip any '/' at start of string... */
buf++;
ptr = buf;
if (*ptr == '\0')
return 0; /* Uh...I guess that's success. */
while ( (ptr = strchr(ptr + 1, '/')) != NULL )
{
*ptr = '\0'; /* block this path section off */
rc = locateOneElement(buf);
*ptr = '/'; /* restore path separator */
if (!rc)
return -2; /* missing element in path. */
} /* while */
/* check final element... */
return locateOneElement(buf) ? 0 : -1;
} /* PHYSFSEXT_locateCorrectCase */
#ifdef TEST_PHYSFSEXT_LOCATECORRECTCASE
int main(int argc, char **argv)
{
int rc;
char buf[128];
PHYSFS_File *f;
if (!PHYSFS_init(argv[0]))
{
fprintf(stderr, "PHYSFS_init(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
return 1;
} /* if */
if (!PHYSFS_addToSearchPath(".", 1))
{
fprintf(stderr, "PHYSFS_addToSearchPath(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return 1;
} /* if */
if (!PHYSFS_setWriteDir("."))
{
fprintf(stderr, "PHYSFS_setWriteDir(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return 1;
} /* if */
if (!PHYSFS_mkdir("/a/b/c"))
{
fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return 1;
} /* if */
if (!PHYSFS_mkdir("/a/b/C"))
{
fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return 1;
} /* if */
f = PHYSFS_openWrite("/a/b/c/x.txt");
PHYSFS_close(f);
if (f == NULL)
{
fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return 1;
} /* if */
f = PHYSFS_openWrite("/a/b/C/X.txt");
PHYSFS_close(f);
if (f == NULL)
{
fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
PHYSFS_deinit();
return 1;
} /* if */
strcpy(buf, "/a/b/c/x.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != 0) || (strcmp(buf, "/a/b/c/x.txt") != 0))
printf("test 1 failed\n");
strcpy(buf, "/a/B/c/x.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != 0) || (strcmp(buf, "/a/b/c/x.txt") != 0))
printf("test 2 failed\n");
strcpy(buf, "/a/b/C/x.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != 0) || (strcmp(buf, "/a/b/C/X.txt") != 0))
printf("test 3 failed\n");
strcpy(buf, "/a/b/c/X.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != 0) || (strcmp(buf, "/a/b/c/x.txt") != 0))
printf("test 4 failed\n");
strcpy(buf, "/a/b/c/z.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != -1) || (strcmp(buf, "/a/b/c/z.txt") != 0))
printf("test 5 failed\n");
strcpy(buf, "/A/B/Z/z.txt");
rc = PHYSFSEXT_locateCorrectCase(buf);
if ((rc != -2) || (strcmp(buf, "/a/b/Z/z.txt") != 0))
printf("test 6 failed\n");
printf("Testing completed.\n");
printf(" If no errors were reported, you're good to go.\n");
PHYSFS_delete("/a/b/c/x.txt");
PHYSFS_delete("/a/b/C/X.txt");
PHYSFS_delete("/a/b/c");
PHYSFS_delete("/a/b/C");
PHYSFS_delete("/a/b");
PHYSFS_delete("/a");
PHYSFS_deinit();
return 0;
} /* main */
#endif
/* end of ignorecase.c ... */
|
d81253207231aa67a267c59185b1693a22fbd060
|
2573fc9a0131c2ca6cb7121a8ec06a561dc31f57
|
/test/C/common.h
|
1496c500f591a31bcb00af809e210c63a2112308
|
[
"MIT"
] |
permissive
|
vnmakarov/yaep
|
0a840c39cc026b003de4c7881a6f8a825671b8bc
|
7aba93e1b49b3f1db0e20ba7d4e4158e2a0a8bb9
|
refs/heads/master
| 2022-03-17T18:31:55.347080
| 2020-04-23T18:46:23
| 2020-04-23T18:46:23
| 43,922,630
| 141
| 17
|
NOASSERTION
| 2022-03-11T20:47:32
| 2015-10-08T23:57:52
|
SWIG
|
UTF-8
|
C
| false
| false
| 5,293
|
h
|
common.h
|
/*
YAEP (Yet Another Earley Parser)
Copyright (c) 1997-2018 Vladimir Makarov <vmakarov@gcc.gnu.org>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef YAEP_TEST_C_COMMON_H_
#define YAEP_TEST_C_COMMON_H_
#include<assert.h>
#include<stdio.h>
#include<stdlib.h>
#include"yaep.h"
static void *
test_parse_alloc (int size)
{
void * result;
assert ((size > 0) && ((unsigned int) size == (size_t) size));
result = malloc (size);
assert (result != NULL);
return result;
}
static void
test_parse_free (void * mem)
{
free( mem );
}
/* Printing syntax error. */
static void
test_syntax_error (int err_tok_num, void *err_tok_attr,
int start_ignored_tok_num, void *start_ignored_tok_attr,
int start_recovered_tok_num, void *start_recovered_tok_attr)
{
if (start_ignored_tok_num < 0)
fprintf (stderr, "Syntax error on token %d\n", err_tok_num);
else
fprintf
(stderr,
"Syntax error on token %d:ignore %d tokens starting with token = %d\n",
err_tok_num, start_recovered_tok_num - start_ignored_tok_num,
start_ignored_tok_num);
}
static const char *input;
static const char *description;
/* The following function imported by YAEP (see comments in the interface file). */
static int
test_read_token (void **attr)
{
static int ntok = 0;
*attr = NULL;
if (input [ntok])
{
return input [ntok++];
}
else
{
return -1;
}
}
static void
test_standard_parse (void)
{
struct grammar *g;
struct yaep_tree_node *root;
int ambiguous_p;
if ((g = yaep_create_grammar ()) == NULL)
{
fprintf (stderr, "yaep_create_grammar: No memory\n");
exit (1);
}
if (yaep_parse_grammar (g, 1, description) != 0)
{
fprintf (stderr, "%s\n", yaep_error_message (g));
exit (1);
}
if (yaep_parse
(g, test_read_token, test_syntax_error, test_parse_alloc,
test_parse_free, &root, &ambiguous_p))
{
fprintf (stderr, "yaep parse: %s\n", yaep_error_message (g));
exit (1);
}
yaep_free_grammar (g);
}
static void
test_standard_read
(const char *(*read_terminal) (int *),
const char *(*read_rule) (const char ***, const char **, int *, int **))
{
struct grammar *g;
struct yaep_tree_node *root;
int ambiguous_p;
if ((g = yaep_create_grammar ()) == NULL)
{
fprintf (stderr, "yaep_create_grammar: No memory\n");
exit (1);
}
if (yaep_read_grammar (g, 1, read_terminal, read_rule) != 0)
{
fprintf (stderr, "%s\n", yaep_error_message (g));
exit (1);
}
if (yaep_parse
(g, test_read_token, test_syntax_error, test_parse_alloc,
test_parse_free, &root, &ambiguous_p))
{
fprintf (stderr, "yaep parse: %s\n", yaep_error_message (g));
exit (1);
}
yaep_free_grammar (g);
}
static void
test_complex_parse
(int one_parse, int ambiguous, int print_cost, int recovery_match,
int argc, char **argv)
{
struct grammar *g;
struct yaep_tree_node *root;
int ambiguous_p;
if ((g = yaep_create_grammar ()) == NULL)
{
fprintf (stderr, "yaep_create_grammar: No memory\n");
exit (1);
}
yaep_set_one_parse_flag (g, one_parse);
if (print_cost)
{
yaep_set_cost_flag (g, 1);
}
if (argc > 1)
yaep_set_lookahead_level (g, atoi (argv [1]));
if (argc > 2)
yaep_set_debug_level (g, atoi (argv [2]));
else
yaep_set_debug_level (g, 3);
if (argc > 3)
yaep_set_error_recovery_flag (g, atoi (argv [3]));
if (argc > 4)
yaep_set_one_parse_flag (g, atoi (argv [4]));
if (recovery_match)
{
yaep_set_recovery_match (g, recovery_match);
}
if (yaep_parse_grammar (g, 1, description) != 0)
{
fprintf (stderr, "%s\n", yaep_error_message (g));
exit (1);
}
if (yaep_parse (g, test_read_token, test_syntax_error, test_parse_alloc,
test_parse_free, &root, &ambiguous_p))
{
fprintf (stderr, "yaep parse: %s\n", yaep_error_message (g));
exit (1);
}
if (ambiguous != ambiguous_p)
{
fprintf (stderr, "Grammar should be %sambiguous\n", ambiguous ? "" : "un");
exit (1);
}
if (print_cost)
{
fprintf (stderr, "cost = %d\n", root->val.anode.cost);
}
yaep_free_grammar (g);
}
#endif
|
eb168f442f3db55216557d1124d1970f47888ca8
|
3cd3872acbc8b1a79a70b89b2fd58a171e7adc82
|
/vpx_dsp/mips/common_dspr2.c
|
b22f084a02319a79f626f86b760797d903e10fc5
|
[] |
permissive
|
webmproject/libvpx
|
58ab97861063cb521ec0d00ef9cb222ca97873b1
|
6fd360c684736e351160b131827dfbb207841164
|
refs/heads/main
| 2023-04-09T15:32:34.688724
| 2023-04-07T22:19:18
| 2023-04-07T22:19:18
| 22,927,608
| 889
| 376
|
BSD-3-Clause
| 2023-03-24T13:37:34
| 2014-08-13T19:03:21
|
C
|
UTF-8
|
C
| false
| false
| 836
|
c
|
common_dspr2.c
|
/*
* Copyright (c) 2015 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "vpx_dsp/mips/common_dspr2.h"
#if HAVE_DSPR2
uint8_t vpx_ff_cropTbl_a[256 + 2 * CROP_WIDTH];
uint8_t *vpx_ff_cropTbl;
void vpx_dsputil_static_init(void) {
int i;
for (i = 0; i < 256; i++) vpx_ff_cropTbl_a[i + CROP_WIDTH] = i;
for (i = 0; i < CROP_WIDTH; i++) {
vpx_ff_cropTbl_a[i] = 0;
vpx_ff_cropTbl_a[i + CROP_WIDTH + 256] = 255;
}
vpx_ff_cropTbl = &vpx_ff_cropTbl_a[CROP_WIDTH];
}
#endif
|
a00861bd7ac955aabda6ff37b2877abdcf062884
|
abbd5e415b921ae0acf1d36912878f698ad93caf
|
/meka/srcs/fskipper.h
|
fa52c1ca19ecd5d5e703f76f6c25514ae9e642cc
|
[] |
no_license
|
ocornut/meka
|
c82cec459a4d2baf6d20ceaa079e7ba5ee1dc89e
|
88c2965632d81567faeb306bdf3891aa310f6276
|
refs/heads/master
| 2023-09-04T16:35:54.800980
| 2023-08-27T17:21:09
| 2023-08-27T17:24:27
| 31,816,255
| 294
| 61
| null | 2023-08-27T17:18:44
| 2015-03-07T15:29:40
|
C++
|
UTF-8
|
C
| false
| false
| 1,735
|
h
|
fskipper.h
|
//-----------------------------------------------------------------------------
// MEKA - fskipper.h
// Frame Skipper - Headers
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Definitions
//-----------------------------------------------------------------------------
#define FRAMESKIP_MODE_THROTTLED (0)
#define FRAMESKIP_MODE_UNTHROTTLED (1)
//-----------------------------------------------------------------------------
// Functions
//-----------------------------------------------------------------------------
bool Frame_Skipper (void);
void Frame_Skipper_Configure (int v);
void Frame_Skipper_Switch (void);
void Frame_Skipper_Switch_FPS_Counter (void);
void Frame_Skipper_Show (void);
void Frame_Skipper_Init (void);
void Frame_Skipper_Init_Values (void);
//-----------------------------------------------------------------------------
// Data
//-----------------------------------------------------------------------------
struct t_fskipper
{
// Frame skipper
int Mode; // Automatic (sync) or standard
int Throttled_Speed;
volatile int Throttled_Frame_Elapsed;
int Unthrottled_Frameskip;
int Unthrottled_Counter;
bool Show_Current_Frame;
// FPS Counter
float FPS;
bool FPS_Display;
int FPS_SecondsElapsed;
int FPS_FrameCountAccumulator; // Number of frames rendered (this second)
};
extern t_fskipper fskipper;
//-----------------------------------------------------------------------------
|
4e8347516490ff6e739a2e0706e43929cda55f32
|
aa3befea459382dc5c01c925653d54f435b3fb0f
|
/arch/arm/src/stm32l5/hardware/stm32l5_pwr.h
|
ba4e851cca1ac22dfe9cbef7a56e69484bac8d90
|
[
"MIT-open-group",
"BSD-3-Clause",
"HPND-sell-variant",
"BSD-4-Clause-UC",
"LicenseRef-scancode-warranty-disclaimer",
"MIT-0",
"LicenseRef-scancode-bsd-atmel",
"LicenseRef-scancode-gary-s-brown",
"LicenseRef-scancode-proprietary-license",
"SunPro",
"MIT",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-other-permissive",
"HPND",
"ISC",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"GPL-1.0-or-later",
"CC-BY-2.0",
"CC-BY-4.0"
] |
permissive
|
apache/nuttx
|
14519a7bff4a87935d94fb8fb2b19edb501c7cec
|
606b6d9310fb25c7d92c6f95bf61737e3c79fa0f
|
refs/heads/master
| 2023-08-25T06:55:45.822534
| 2023-08-23T16:03:31
| 2023-08-24T21:25:47
| 228,103,273
| 407
| 241
|
Apache-2.0
| 2023-09-14T18:26:05
| 2019-12-14T23:27:55
|
C
|
UTF-8
|
C
| false
| false
| 14,312
|
h
|
stm32l5_pwr.h
|
/****************************************************************************
* arch/arm/src/stm32l5/hardware/stm32l5_pwr.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_STM32L5_HARDWARE_STM32L5_PWR_H
#define __ARCH_ARM_SRC_STM32L5_HARDWARE_STM32L5_PWR_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "chip.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Register Offsets *********************************************************/
#define STM32L5_PWR_CR1_OFFSET 0x0000 /* Power control register 1 */
#define STM32L5_PWR_CR2_OFFSET 0x0004 /* Power control register 2 */
#define STM32L5_PWR_CR3_OFFSET 0x0008 /* Power control register 3 */
#define STM32L5_PWR_CR4_OFFSET 0x000C /* Power control register 4 */
#define STM32L5_PWR_SR1_OFFSET 0x0010 /* Power status register 1 */
#define STM32L5_PWR_SR2_OFFSET 0x0014 /* Power status register 2 */
#define STM32L5_PWR_SCR_OFFSET 0x0018 /* Power status clear register */
#define STM32L5_PWR_PUCRA_OFFSET 0x0020 /* Power Port A pull-up control register */
#define STM32L5_PWR_PDCRA_OFFSET 0x0024 /* Power Port A pull-down control register */
#define STM32L5_PWR_PUCRB_OFFSET 0x0028 /* Power Port B pull-up control register */
#define STM32L5_PWR_PDCRB_OFFSET 0x002C /* Power Port B pull-down control register */
#define STM32L5_PWR_PUCRC_OFFSET 0x0030 /* Power Port C pull-up control register */
#define STM32L5_PWR_PDCRC_OFFSET 0x0034 /* Power Port C pull-down control register */
#define STM32L5_PWR_PUCRD_OFFSET 0x0038 /* Power Port D pull-up control register */
#define STM32L5_PWR_PDCRD_OFFSET 0x003C /* Power Port D pull-down control register */
#define STM32L5_PWR_PUCRE_OFFSET 0x0040 /* Power Port E pull-up control register */
#define STM32L5_PWR_PDCRE_OFFSET 0x0044 /* Power Port E pull-down control register */
#define STM32L5_PWR_PUCRF_OFFSET 0x0048 /* Power Port F pull-up control register */
#define STM32L5_PWR_PDCRF_OFFSET 0x004C /* Power Port F pull-down control register */
#define STM32L5_PWR_PUCRG_OFFSET 0x0050 /* Power Port G pull-up control register */
#define STM32L5_PWR_PDCRG_OFFSET 0x0054 /* Power Port G pull-down control register */
#define STM32L5_PWR_PUCRH_OFFSET 0x0058 /* Power Port H pull-up control register */
#define STM32L5_PWR_PDCRH_OFFSET 0x005C /* Power Port H pull-down control register */
#define STM32L5_PWR_SECCFGR_OFFSET 0x0078 /* Power secure configuration register */
#define STM32L5_PWR_PRIVCFGR_OFFSET 0x0078 /* Power privilege configuration register */
/* Register Addresses *******************************************************/
#define STM32L5_PWR_CR1 (STM32L5_PWR_BASE + STM32L5_PWR_CR1_OFFSET)
#define STM32L5_PWR_CR2 (STM32L5_PWR_BASE + STM32L5_PWR_CR2_OFFSET)
#define STM32L5_PWR_CR3 (STM32L5_PWR_BASE + STM32L5_PWR_CR3_OFFSET)
#define STM32L5_PWR_CR4 (STM32L5_PWR_BASE + STM32L5_PWR_CR4_OFFSET)
#define STM32L5_PWR_SR1 (STM32L5_PWR_BASE + STM32L5_PWR_SR1_OFFSET)
#define STM32L5_PWR_SR2 (STM32L5_PWR_BASE + STM32L5_PWR_SR2_OFFSET)
#define STM32L5_PWR_SCR (STM32L5_PWR_BASE + STM32L5_PWR_SCR_OFFSET)
#define STM32L5_PWR_PUCRA (STM32L5_PWR_BASE + STM32L5_PWR_PUCRA_OFFSET)
#define STM32L5_PWR_PDCRA (STM32L5_PWR_BASE + STM32L5_PWR_PDCRA_OFFSET)
#define STM32L5_PWR_PUCRB (STM32L5_PWR_BASE + STM32L5_PWR_PUCRB_OFFSET)
#define STM32L5_PWR_PDCRB (STM32L5_PWR_BASE + STM32L5_PWR_PDCRB_OFFSET)
#define STM32L5_PWR_PUCRC (STM32L5_PWR_BASE + STM32L5_PWR_PUCRC_OFFSET)
#define STM32L5_PWR_PDCRC (STM32L5_PWR_BASE + STM32L5_PWR_PDCRC_OFFSET)
#define STM32L5_PWR_PUCRD (STM32L5_PWR_BASE + STM32L5_PWR_PUCRD_OFFSET)
#define STM32L5_PWR_PDCRD (STM32L5_PWR_BASE + STM32L5_PWR_PDCRD_OFFSET)
#define STM32L5_PWR_PUCRE (STM32L5_PWR_BASE + STM32L5_PWR_PUCRE_OFFSET)
#define STM32L5_PWR_PDCRE (STM32L5_PWR_BASE + STM32L5_PWR_PDCRE_OFFSET)
#define STM32L5_PWR_PUCRF (STM32L5_PWR_BASE + STM32L5_PWR_PUCRF_OFFSET)
#define STM32L5_PWR_PDCRF (STM32L5_PWR_BASE + STM32L5_PWR_PDCRF_OFFSET)
#define STM32L5_PWR_PUCRG (STM32L5_PWR_BASE + STM32L5_PWR_PUCRG_OFFSET)
#define STM32L5_PWR_PDCRG (STM32L5_PWR_BASE + STM32L5_PWR_PDCRG_OFFSET)
#define STM32L5_PWR_PUCRH (STM32L5_PWR_BASE + STM32L5_PWR_PUCRH_OFFSET)
#define STM32L5_PWR_PDCRH (STM32L5_PWR_BASE + STM32L5_PWR_PDCRH_OFFSET)
#define STM32L5_PWR_SECCFGR (STM32L5_PWR_BASE + STM32L5_PWR_SECCFGR_OFFSET)
#define STM32L5_PWR_PRIVCFGR (STM32L5_PWR_BASE + STM32L5_PWR_PRIVCFGR_OFFSET)
/* Register Bitfield Definitions ********************************************/
/* Power control register 1 */
#define PWR_CR1_LPMS_SHIFT 0
#define PWR_CR1_LPMS_MASK (7 << PWR_CR1_LPMS_SHIFT) /* Bits 0-2: Low-power mode selection */
# define PWR_CR1_LPMS_STOP0 (0 << PWR_CR1_LPMS_SHIFT) /* 000: Stop 0 mode */
# define PWR_CR1_LPMS_STOP1 (1 << PWR_CR1_LPMS_SHIFT) /* 001:Stop 1 mode */
# define PWR_CR1_LPMS_STOP2 (2 << PWR_CR1_LPMS_SHIFT) /* 010: Stop 2 mode */
# define PWR_CR1_LPMS_STANDBY (3 << PWR_CR1_LPMS_SHIFT) /* 011: Standby mode */
# define PWR_CR1_LPMS_SHUTDOWN (4 << PWR_CR1_LPMS_SHIFT) /* 1xx: Shutdown mode */
#define PWR_CR1_DBP (1 << 8) /* Bit 8: Disable Backup domain write protection */
#define PWR_CR1_VOS_SHIFT 9
#define PWR_CR1_VOS_MASK (3 << PWR_CR1_VOS_SHIFT) /* Bits 9-10: Voltage scaling range selection */
#define PWR_CR1_VOS_RANGE0 (0 << PWR_CR1_VOS_SHIFT) /* 00: Range 0 */
#define PWR_CR1_VOS_RANGE1 (1 << PWR_CR1_VOS_SHIFT) /* 01: Range 1 */
#define PWR_CR1_VOS_RANGE2 (2 << PWR_CR1_VOS_SHIFT) /* 10: Range 2 */
#define PWR_CR1_LPR (1 << 14) /* Bit 14: Low-power run */
/* Power control register 2 */
#define PWR_CR2_PVDE (1 << 0) /* Bit 0: Power voltage detector enable */
#define PWR_CR2_PLS_SHIFT 1
#define PWR_CR2_PLS_MASK (7 << PWR_CR2_PLS_SHIFT) /* Bits 1-3: Power voltage detector level selection */
# define PWR_CR2_PLS_2000mv (0 << PWR_CR2_PLS_SHIFT) /* 000: VPVD0 around 2.0V */
# define PWR_CR2_PLS_2200mv (1 << PWR_CR2_PLS_SHIFT) /* 001: VPVD1 around 2.2V */
# define PWR_CR2_PLS_2400mv (2 << PWR_CR2_PLS_SHIFT) /* 010: VPVD2 around 2.4V */
# define PWR_CR2_PLS_2500mv (3 << PWR_CR2_PLS_SHIFT) /* 011: VPVD3 around 2.5V */
# define PWR_CR2_PLS_2600mv (4 << PWR_CR2_PLS_SHIFT) /* 100: VPVD4 around 2.6V */
# define PWR_CR2_PLS_2800mv (5 << PWR_CR2_PLS_SHIFT) /* 101: VPVD5 around 2.8V */
# define PWR_CR2_PLS_2900mv (6 << PWR_CR2_PLS_SHIFT) /* 110: VPVD6 around 2.9V */
# define PWR_CR2_PLS_EXT (7 << PWR_CR2_PLS_SHIFT) /* 111: External input analog voltage PVD_IN */
#define PWR_CR2_PVME1 (1 << 4) /* Bit 4: Peripheral voltage monitoring 1 enable (VDDUSB vs 1.2V) */
#define PWR_CR2_PVME2 (1 << 5) /* Bit 5: Peripheral voltage monitoring 2 enable (VDDIO2 vs 0.9V) */
#define PWR_CR2_PVME3 (1 << 6) /* Bit 6: Peripheral voltage monitoring 3 enable (VDDA vs 1.62V) */
#define PWR_CR2_PVME4 (1 << 7) /* Bit 7: Peripheral voltage monitoring 4 enable (VDDA vs 2.2V) */
#define PWR_CR2_IOSV (1 << 9) /* Bit 9: VDDIO2 Independent I/Os supply valid */
#define PWR_CR2_USV (1 << 10) /* Bit 10: VDDUSB USB supply valid */
/* Power control register 3 */
#define PWR_CR3_EWUP1 (1 << 0) /* Bit 0: Enable Wakeup pin WKUP1 */
#define PWR_CR3_EWUP2 (1 << 1) /* Bit 1: Enable Wakeup pin WKUP2 */
#define PWR_CR3_EWUP3 (1 << 2) /* Bit 2: Enable Wakeup pin WKUP3 */
#define PWR_CR3_EWUP4 (1 << 3) /* Bit 3: Enable Wakeup pin WKUP4 */
#define PWR_CR3_EWUP5 (1 << 4) /* Bit 4: Enable Wakeup pin WKUP5 */
#define PWR_CR3_RRS_SHIFT 8
#define PWR_CR3_RRS_MASK (3 << PWR_CR3_RRS_SHIFT) /* Bits 8-9: SRAM2 retention in Standby-mode */
# define PWR_CR3_RRS_OFF (0 << PWR_CR3_RRS_SHIFT) /* 00: SRAM2 is powered off in Standby-mode */
# define PWR_CR3_RRS_ON (1 << PWR_CR3_RRS_SHIFT) /* 01: SRAM2 is powered on in Standby-mode */
# define PWR_CR3_RRS_4K_ON (2 << PWE_CR3_RRS_SHIFT) /* 10: Upper 4KB of SRAM2 powered on in Standby-mode */
#define PWR_CR3_APC (1 << 10) /* Bit 10: Apply pull-up and pull-down configuration */
#define PWR_CR3_ULPMEN (1 << 11) /* Bit 11: Ultra-low-power mode enable */
#define PWR_CR3_UCPD_STBY (1 << 13) /* Bit 13: USB Type-C power delivery Standby-mode */
#define PWR_CR3_UCPD_DBDIS (1 << 14) /* Bit 14: USB Type-C power delivery dead battery disable */
/* Power control register 4 */
#define PWR_CR4_WP1 (1 << 0) /* Bit 0: Wakeup pin WKUP1 polarity */
#define PWR_CR4_WP2 (1 << 1) /* Bit 1: Wakeup pin WKUP2 polarity */
#define PWR_CR4_WP3 (1 << 2) /* Bit 2: Wakeup pin WKUP3 polarity */
#define PWR_CR4_WP4 (1 << 3) /* Bit 3: Wakeup pin WKUP4 polarity */
#define PWR_CR4_WP5 (1 << 4) /* Bit 4: Wakeup pin WKUP5 polarity */
#define PWR_CR4_VBE (1 << 8) /* Bit 8: Vbat battery charging enable */
#define PWR_CR4_VBRS (1 << 9) /* Bit 9: Vbat battery charging resistor selection */
# define PWR_CR4_VBRS_5k 0 /* 0: 5k resistor */
# define PWR_CR4_VBRS_1k5 PWR_CR4_VBRS /* 1: 1k5 resistor */
#define PWR_CR4_SMPSBYP (1 << 12) /* Bit 12: SMPS Bypass mode */
#define PWR_CR4_EXTSMPSEN (1 << 13) /* Bit 13: Enable external SMPS mode */
#define PWR_CR4_SMPSFSTEN (1 << 14) /* Bit 14: Enable SMPS fast soft start */
#define PWR_CR4_SMPSLPEN (1 << 15) /* Bit 15: Enable SMPS low-power mode */
/* Power status register 1 */
#define PWR_SR1_WUF1 (1 << 0) /* Bit 0: Wakeup flag 1 */
#define PWR_SR1_WUF2 (1 << 1) /* Bit 1: Wakeup flag 2 */
#define PWR_SR1_WUF3 (1 << 2) /* Bit 2: Wakeup flag 3 */
#define PWR_SR1_WUF4 (1 << 3) /* Bit 3: Wakeup flag 4 */
#define PWR_SR1_WUF5 (1 << 4) /* Bit 4: Wakeup flag 5 */
#define PWR_SR1_SBF (1 << 8) /* Bit 8: Standby flag */
#define PWR_SR1_SMPSBYPRDY (1 << 12) /* Bit 12: SMPS BYPASS ready */
#define PWR_SR1_EXTSMPSRDY (1 << 13) /* Bit 13: External SMPS mode ready */
#define PWR_SR1_SMPSHPRDY (1 << 15) /* Bit 15: SMPS high-power mode ready */
/* Power status register 2 */
#define PWR_SR2_REGLPS (1 << 8) /* Bit 8: Low power regulator started */
#define PWR_SR2_REGLPF (1 << 9) /* Bit 9: Low power regulator flag */
#define PWR_SR2_VOSF (1 << 10) /* Bit 10: Voltage scaling flag */
#define PWR_SR2_PVDO (1 << 11) /* Bit 11: Power voltage detector output */
#define PWR_SR2_PVMO1 (1 << 12) /* Bit 12: Peripheral voltage monitoring output 1 (VDDUSB vs 1.2V) */
#define PWR_SR2_PVMO2 (1 << 13) /* Bit 13: Peripheral voltage monitoring output 2 (VDDIO2 vs 0.9V) */
#define PWR_SR2_PVMO3 (1 << 14) /* Bit 14: Peripheral voltage monitoring output 3 (VDDA vs 1.62V) */
#define PWR_SR2_PVMO4 (1 << 15) /* Bit 15: Peripheral voltage monitoring output 4 (VDDA vs 2.2V) */
/* Power status clear register */
#define PWR_SCR_CWUF1 (1 << 0) /* Bit 0: Clear wakeup flag 1 */
#define PWR_SCR_CWUF2 (1 << 1) /* Bit 1: Clear wakeup flag 2 */
#define PWR_SCR_CWUF3 (1 << 2) /* Bit 2: Clear wakeup flag 3 */
#define PWR_SCR_CWUF4 (1 << 3) /* Bit 3: Clear wakeup flag 4 */
#define PWR_SCR_CWUF5 (1 << 4) /* Bit 4: Clear wakeup flag 5 */
#define PWR_SCR_CSBF (1 << 8) /* Bit 8: Clear standby flag */
/* Port X pull-up/down registers have one bit per port line, with a few
* exceptions.
*/
/* Power secure configuration register */
#define PWR_SECCFGR_WUP1SEC (1 << 0) /* Bit 0: WKUP1 pin security */
#define PWR_SECCFGR_WUP2SEC (1 << 1) /* Bit 1: WKUP2 pin security */
#define PWR_SECCFGR_WUP3SEC (1 << 2) /* Bit 2: WKUP3 pin security */
#define PWR_SECCFGR_WUP4SEC (1 << 3) /* Bit 3: WKUP4 pin security */
#define PWR_SECCFGR_WUP5SEC (1 << 4) /* Bit 4: WKUP5 pin security */
#define PWR_SECCFGR_LPMSEC (1 << 8) /* Bit 8: Low-power mode security */
#define PWR_SECCFGR_VDMSEC (1 << 9) /* Bit 9: Voltage detection and monitoring security */
#define PWR_SECCFGR_VBSEC (1 << 10) /* Bit 10: Voltage battery security */
#define PWR_SECCFGR_APCSEC (1 << 11) /* Bit 11: APC security */
/* Power privilege configuration register */
#define PWR_PRIVCFGR_PRIV (1 << 0) /* Bit 0: Privilege protection */
#endif /* __ARCH_ARM_SRC_STM32L5_HARDWARE_STM32L5_PWR_H */
|
1165c32a7ec2a71a29cc5ff1b7ef5c4d2e95000c
|
6e1cde66aa5a649138babe297293962cdf97743e
|
/src/libtai/tai.h
|
43545be1e7bfdad8cf40fc1a9f1a7e691d7f94a4
|
[
"BSD-2-Clause"
] |
permissive
|
SWI-Prolog/swipl-devel
|
db56676481984addc09f4f228bc1c41f7f53759f
|
41ac4a569c8e6c3d3b93a21449403962e3de1ece
|
refs/heads/master
| 2023-09-01T03:49:40.696481
| 2023-08-30T18:12:56
| 2023-08-30T18:12:56
| 17,516,793
| 935
| 328
|
NOASSERTION
| 2023-08-26T14:32:33
| 2014-03-07T14:43:14
|
C
|
UTF-8
|
C
| false
| false
| 914
|
h
|
tai.h
|
#ifndef TAI_H
#define TAI_H
#ifdef _MSC_VER
#pragma warning(disable : 4996) /* C4996: deprecate open() etc */
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#ifdef _WIN64
typedef long long ssize_t;
#else
typedef long ssize_t;
#endif
#else
#include <inttypes.h> /* more portable than stdint.h */
#endif
#ifdef _MSC_VER
#define LL(x) x ## i64
#define ULL(x) x ## ui64
#else
#define LL(x) x ## LL
#define ULL(x) x ## ULL
#endif
struct tai {
uint64_t x;
} ;
extern void tai_now(struct tai *t);
/* JW: MSVC cannot convert unsigned to double :-( */
#define tai_approx(t) ((double) ((int64_t)(t)->x))
extern void tai_add(struct tai *t, struct tai *u, struct tai *v);
extern void tai_sub(struct tai *t, struct tai *u, struct tai *v);
#define tai_less(t,u) ((t)->x < (u)->x)
#define TAI_PACK 8
extern void tai_pack(char *s, struct tai *t);
extern void tai_unpack(char *s, struct tai *t);
#endif
|
21836b6a96f35fdf7d122475414b80be575e0b15
|
100d31faf4b459bafe51a7f1cc3cbbe694011f91
|
/examples/libc/malloc_aligned.c
|
ce0d60c3a16552a65f2f128fc16255499e8c5629
|
[
"CC0-1.0"
] |
permissive
|
embeddedartistry/embedded-resources
|
aabbc962ab9354f773caadae5e3945e5c4e364bf
|
1b25c30902fd34a69ed1001af741d564e8df0df1
|
refs/heads/master
| 2023-04-29T22:08:01.069233
| 2023-04-21T03:32:28
| 2023-04-21T16:25:23
| 76,132,197
| 569
| 412
|
CC0-1.0
| 2023-04-21T16:25:24
| 2016-12-10T19:11:21
|
Makefile
|
UTF-8
|
C
| false
| false
| 2,283
|
c
|
malloc_aligned.c
|
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
// contains aligned_malloc and aligned_free prototypes
#include "memory.h"
/**
* Definitions
*/
#pragma mark - Definitions -
/**
* Simple macro for making sure memory addresses are aligned
* to the nearest power of two
*/
#ifndef align_up
#define align_up(num, align) (((num) + ((align)-1)) & ~((align)-1))
#endif
// Number of bytes we're using for storing the aligned pointer offset
typedef uint16_t offset_t;
#define PTR_OFFSET_SZ sizeof(offset_t)
/**
* APIs
*/
#pragma mark - APIs -
/**
* aligned_malloc takes in the requested alignment and size
* We will call malloc with extra bytes for our header and the offset
* required to guarantee the desired alignment.
*/
void* aligned_malloc(size_t align, size_t size)
{
void* ptr = NULL;
// We want it to be a power of two since align_up operates on powers of two
assert((align & (align - 1)) == 0);
if(align && size)
{
/*
* We know we have to fit an offset value
* We also allocate extra bytes to ensure we can meet the alignment
*/
uint32_t hdr_size = PTR_OFFSET_SZ + (align - 1);
void* p = malloc(size + hdr_size);
if(p)
{
/*
* Add the offset size to malloc's pointer (we will always store that)
* Then align the resulting value to the arget alignment
*/
ptr = (void*)align_up(((uintptr_t)p + PTR_OFFSET_SZ), align);
// Calculate the offset and store it behind our aligned pointer
*((offset_t*)ptr - 1) = (offset_t)((uintptr_t)ptr - (uintptr_t)p);
} // else NULL, could not malloc
} // else NULL, invalid arguments
return ptr;
}
/**
* aligned_free works like free(), but we work backwards from the returned
* pointer to find the correct offset and pointer location to return to free()
* Note that it is VERY BAD to call free() on an aligned_malloc() pointer.
*/
void aligned_free(void* ptr)
{
assert(ptr);
/*
* Walk backwards from the passed-in pointer to get the pointer offset
* We convert to an offset_t pointer and rely on pointer math to get the data
*/
offset_t offset = *((offset_t*)ptr - 1);
/*
* Once we have the offset, we can get our original pointer and call free
*/
void* p = (void*)((uint8_t*)ptr - offset);
free(p);
}
|
eaa0632272e20248b03d716177081d714c21d20c
|
badb70a0b235c98ac034cfe5b4bfafda36647831
|
/Include/Intel/Protocol/FirmwareVolume.h
|
a09e77c45fce9a52a598a5d777d3c437f37588ce
|
[
"BSD-3-Clause"
] |
permissive
|
acidanthera/OpenCorePkg
|
f34a7d67b22c74fb5ab559e48519e5f5855b6751
|
1d5b1736fe5a5ef7662b5c076c6d11aac96fd5d6
|
refs/heads/master
| 2023-08-30T21:03:02.993659
| 2023-08-28T23:30:43
| 2023-08-28T23:30:43
| 179,354,282
| 13,212
| 2,999
|
BSD-3-Clause
| 2023-09-10T18:29:53
| 2019-04-03T19:14:29
|
C
|
UTF-8
|
C
| false
| false
| 14,793
|
h
|
FirmwareVolume.h
|
/** @file
This file declares the Firmware Volume Protocol.
The Firmware Volume Protocol provides file-level access to the firmware volume.
Each firmware volume driver must produce an instance of the Firmware Volume
Protocol if the firmware volume is to be visible to the system. The Firmware
Volume Protocol also provides mechanisms for determining and modifying some
attributes of the firmware volume.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This protocol is defined in Firmware Volume specification.
Version 0.9.
**/
#ifndef _FIRMWARE_VOLUME_H_
#define _FIRMWARE_VOLUME_H_
//
// Firmware Volume Protocol GUID definition
//
#define EFI_FIRMWARE_VOLUME_PROTOCOL_GUID \
{ \
0x389F751F, 0x1838, 0x4388, {0x83, 0x90, 0xCD, 0x81, 0x54, 0xBD, 0x27, 0xF8 } \
}
#define FV_DEVICE_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', '_')
typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL EFI_FIRMWARE_VOLUME_PROTOCOL;
//
// FRAMEWORK_EFI_FV_ATTRIBUTES bit definitions
//
typedef UINT64 FRAMEWORK_EFI_FV_ATTRIBUTES;
//
// ************************************************************
// FRAMEWORK_EFI_FV_ATTRIBUTES bit definitions
// ************************************************************
//
#define EFI_FV_READ_DISABLE_CAP 0x0000000000000001ULL
#define EFI_FV_READ_ENABLE_CAP 0x0000000000000002ULL
#define EFI_FV_READ_STATUS 0x0000000000000004ULL
#define EFI_FV_WRITE_DISABLE_CAP 0x0000000000000008ULL
#define EFI_FV_WRITE_ENABLE_CAP 0x0000000000000010ULL
#define EFI_FV_WRITE_STATUS 0x0000000000000020ULL
#define EFI_FV_LOCK_CAP 0x0000000000000040ULL
#define EFI_FV_LOCK_STATUS 0x0000000000000080ULL
#define EFI_FV_WRITE_POLICY_RELIABLE 0x0000000000000100ULL
#define EFI_FV_ALIGNMENT_CAP 0x0000000000008000ULL
#define EFI_FV_ALIGNMENT_2 0x0000000000010000ULL
#define EFI_FV_ALIGNMENT_4 0x0000000000020000ULL
#define EFI_FV_ALIGNMENT_8 0x0000000000040000ULL
#define EFI_FV_ALIGNMENT_16 0x0000000000080000ULL
#define EFI_FV_ALIGNMENT_32 0x0000000000100000ULL
#define EFI_FV_ALIGNMENT_64 0x0000000000200000ULL
#define EFI_FV_ALIGNMENT_128 0x0000000000400000ULL
#define EFI_FV_ALIGNMENT_256 0x0000000000800000ULL
#define EFI_FV_ALIGNMENT_512 0x0000000001000000ULL
#define EFI_FV_ALIGNMENT_1K 0x0000000002000000ULL
#define EFI_FV_ALIGNMENT_2K 0x0000000004000000ULL
#define EFI_FV_ALIGNMENT_4K 0x0000000008000000ULL
#define EFI_FV_ALIGNMENT_8K 0x0000000010000000ULL
#define EFI_FV_ALIGNMENT_16K 0x0000000020000000ULL
#define EFI_FV_ALIGNMENT_32K 0x0000000040000000ULL
#define EFI_FV_ALIGNMENT_64K 0x0000000080000000ULL
//
// Protocol API definitions
//
/**
Retrieves attributes, insures positive polarity of attribute bits, and returns
resulting attributes in an output parameter.
@param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
@param Attributes Output buffer containing attributes.
@retval EFI_SUCCESS The firmware volume attributes were returned.
**/
typedef
EFI_STATUS
(EFIAPI *FRAMEWORK_EFI_FV_GET_ATTRIBUTES)(
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes
);
/**
Sets volume attributes
@param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
@param Attributes On input, Attributes is a pointer to an
EFI_FV_ATTRIBUTES containing the desired firmware
volume settings. On successful return, it contains
the new settings of the firmware volume. On
unsuccessful return, Attributes is not modified
and the firmware volume settings are not changed.
@retval EFI_INVALID_PARAMETER A bit in Attributes was invalid.
@retval EFI_SUCCESS The requested firmware volume attributes were set
and the resulting EFI_FV_ATTRIBUTES is returned in
Attributes.
@retval EFI_ACCESS_DENIED The Device is locked and does not permit modification.
**/
typedef
EFI_STATUS
(EFIAPI *FRAMEWORK_EFI_FV_SET_ATTRIBUTES)(
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes
);
/**
Read the requested file (NameGuid) or file information from the firmware volume
and returns data in Buffer.
@param This The EFI_FIRMWARE_VOLUME_PROTOCOL instance.
@param NameGuid The pointer to EFI_GUID, which is the filename of
the file to read.
@param Buffer The pointer to pointer to buffer in which contents of file are returned.
<br>
If Buffer is NULL, only type, attributes, and size
are returned as there is no output buffer.
<br>
If Buffer != NULL and *Buffer == NULL, the output
buffer is allocated from BS pool by ReadFile.
<br>
If Buffer != NULL and *Buffer != NULL, the output
buffer has been allocated by the caller and is being
passed in.
@param BufferSize On input: The buffer size. On output: The size
required to complete the read.
@param FoundType The pointer to the type of the file whose data
is returned.
@param FileAttributes The pointer to attributes of the file whose data
is returned.
@param AuthenticationStatus The pointer to the authentication status of the data.
@retval EFI_SUCCESS The call completed successfully.
@retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to contain the requested output.
The buffer filled, and the output is truncated.
@retval EFI_NOT_FOUND NameGuid was not found in the firmware volume.
@retval EFI_DEVICE_ERROR A hardware error occurred when attempting to
access the firmware volume.
@retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.
@retval EFI_OUT_OF_RESOURCES An allocation failure occurred.
**/
typedef
EFI_STATUS
(EFIAPI *FRAMEWORK_EFI_FV_READ_FILE)(
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN EFI_GUID *NameGuid,
IN OUT VOID **Buffer,
IN OUT UINTN *BufferSize,
OUT EFI_FV_FILETYPE *FoundType,
OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,
OUT UINT32 *AuthenticationStatus
);
/**
Read the requested section from the specified file and returns data in Buffer.
@param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
@param NameGuid Filename identifying the file from which to read.
@param SectionType The section type to retrieve.
@param SectionInstance The instance of SectionType to retrieve.
@param Buffer Pointer to pointer to buffer in which contents of
a file are returned.
<br>
If Buffer is NULL, only type, attributes, and size
are returned as there is no output buffer.
<br>
If Buffer != NULL and *Buffer == NULL, the output
buffer is allocated from BS pool by ReadFile.
<br>
If Buffer != NULL and *Buffer != NULL, the output
buffer has been allocated by the caller and is being
passed in.
@param BufferSize The pointer to the buffer size passed in, and on
output the size required to complete the read.
@param AuthenticationStatus The pointer to the authentication status of the data.
@retval EFI_SUCCESS The call completed successfully.
@retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to contain the requested output.
The buffer is filled and the output is truncated.
@retval EFI_OUT_OF_RESOURCES An allocation failure occurred.
@retval EFI_NOT_FOUND The name was not found in the firmware volume.
@retval EFI_DEVICE_ERROR A hardware error occurred when attempting to
access the firmware volume.
@retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.
**/
typedef
EFI_STATUS
(EFIAPI *FRAMEWORK_EFI_FV_READ_SECTION)(
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN EFI_GUID *NameGuid,
IN EFI_SECTION_TYPE SectionType,
IN UINTN SectionInstance,
IN OUT VOID **Buffer,
IN OUT UINTN *BufferSize,
OUT UINT32 *AuthenticationStatus
);
typedef UINT32 FRAMEWORK_EFI_FV_WRITE_POLICY;
#define FRAMEWORK_EFI_FV_UNRELIABLE_WRITE 0x00000000
#define FRAMEWORK_EFI_FV_RELIABLE_WRITE 0x00000001
typedef struct {
EFI_GUID *NameGuid;
EFI_FV_FILETYPE Type;
EFI_FV_FILE_ATTRIBUTES FileAttributes;
VOID *Buffer;
UINT32 BufferSize;
} FRAMEWORK_EFI_FV_WRITE_FILE_DATA;
/**
Write the supplied file (NameGuid) to the FV.
@param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
@param NumberOfFiles Indicates the number of file records pointed to
by FileData.
@param WritePolicy Indicates the level of reliability of the write
with respect to things like power failure events.
@param FileData A pointer to an array of EFI_FV_WRITE_FILE_DATA
structures. Each element in the array indicates
a file to write, and there are NumberOfFiles
elements in the input array.
@retval EFI_SUCCESS The write completed successfully.
@retval EFI_OUT_OF_RESOURCES The firmware volume does not have enough free
space to store file(s).
@retval EFI_DEVICE_ERROR A hardware error occurred when attempting to
access the firmware volume.
@retval EFI_WRITE_PROTECTED The firmware volume is configured to disallow writes.
@retval EFI_NOT_FOUND A delete was requested, but the requested file was
not found in the firmware volume.
@retval EFI_INVALID_PARAMETER A delete was requested with a multiple file write.
An unsupported WritePolicy was requested.
An unknown file type was specified.
A file system specific error has occurred.
**/
typedef
EFI_STATUS
(EFIAPI *FRAMEWORK_EFI_FV_WRITE_FILE)(
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN UINT32 NumberOfFiles,
IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy,
IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA *FileData
);
/**
Given the input key, search for the next matching file in the volume.
@param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.
@param Key Pointer to a caller allocated buffer that contains
an implementation-specific key that is used to track
where to begin searching on successive calls.
@param FileType The pointer to the file type to filter for.
@param NameGuid The pointer to Guid filename of the file found.
@param Attributes The pointer to Attributes of the file found.
@param Size The pointer to Size in bytes of the file found.
@retval EFI_SUCCESS The output parameters are filled with data obtained from
the first matching file that was found.
@retval EFI_NOT_FOUND No files of type FileType were found.
@retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access
the firmware volume.
@retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.
**/
typedef
EFI_STATUS
(EFIAPI *FRAMEWORK_EFI_FV_GET_NEXT_FILE)(
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN OUT VOID *Key,
IN OUT EFI_FV_FILETYPE *FileType,
OUT EFI_GUID *NameGuid,
OUT EFI_FV_FILE_ATTRIBUTES *Attributes,
OUT UINTN *Size
);
//
// Protocol interface structure
//
struct _EFI_FIRMWARE_VOLUME_PROTOCOL {
///
/// Retrieves volume capabilities and current settings.
///
FRAMEWORK_EFI_FV_GET_ATTRIBUTES GetVolumeAttributes;
///
/// Modifies the current settings of the firmware volume.
///
FRAMEWORK_EFI_FV_SET_ATTRIBUTES SetVolumeAttributes;
///
/// Reads an entire file from the firmware volume.
///
FRAMEWORK_EFI_FV_READ_FILE ReadFile;
///
/// Reads a single section from a file into a buffer.
///
FRAMEWORK_EFI_FV_READ_SECTION ReadSection;
///
/// Writes an entire file into the firmware volume.
///
FRAMEWORK_EFI_FV_WRITE_FILE WriteFile;
///
/// Provides service to allow searching the firmware volume.
///
FRAMEWORK_EFI_FV_GET_NEXT_FILE GetNextFile;
///
/// Data field that indicates the size in bytes of the Key input buffer for
/// the GetNextFile() API.
///
UINT32 KeySize;
///
/// Handle of the parent firmware volume.
///
EFI_HANDLE ParentHandle;
};
extern EFI_GUID gEfiFirmwareVolumeProtocolGuid;
#endif
|
cad22406eb6c2fa58eae38d483d3296f79ac3806
|
46f7cb7150697037d4b5f434dde423a1eeb8e422
|
/ncnn-20210525-full-source/src/layer/x86/convolution_1x1_int8.h
|
d35bf282b966a3260ed6a68045ea40d05d34b573
|
[
"BSD-3-Clause",
"Zlib",
"BSD-2-Clause",
"MIT"
] |
permissive
|
MirrorYuChen/ncnn_example
|
d856f732e031b0e069fed7e30759e1c6c7947aaf
|
82a84d79c96e908f46b7e7cac6c8365c83b0f896
|
refs/heads/master
| 2023-08-18T06:31:06.113775
| 2022-05-14T17:38:01
| 2022-05-14T17:38:01
| 183,336,202
| 362
| 108
|
MIT
| 2022-06-22T04:17:14
| 2019-04-25T01:53:37
|
C++
|
UTF-8
|
C
| false
| false
| 5,937
|
h
|
convolution_1x1_int8.h
|
// BUG1989 is pleased to support the open source community by supporting ncnn available.
//
// Copyright (C) 2019 BUG1989. All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// https://opensource.org/licenses/BSD-3-Clause
//
// 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.
static void conv1x1s1_int8_sse(const Mat& bottom_blob, Mat& top_blob, const Mat& _kernel, const Option& opt)
{
int inch = bottom_blob.c;
int outw = top_blob.w;
int outh = top_blob.h;
int outch = top_blob.c;
const float* kernel = _kernel;
#pragma omp parallel for num_threads(opt.num_threads)
for (int p = 0; p < outch; p++)
{
Mat out0 = top_blob.channel(p);
out0.fill(0);
int q = 0;
for (; q + 7 < inch; q += 8)
{
int* outptr0 = out0;
const signed char* kernel0 = (const signed char*)kernel + p * inch + q;
const signed char* r0 = bottom_blob.channel(q);
const signed char* r1 = bottom_blob.channel(q + 1);
const signed char* r2 = bottom_blob.channel(q + 2);
const signed char* r3 = bottom_blob.channel(q + 3);
const signed char* r4 = bottom_blob.channel(q + 4);
const signed char* r5 = bottom_blob.channel(q + 5);
const signed char* r6 = bottom_blob.channel(q + 6);
const signed char* r7 = bottom_blob.channel(q + 7);
int size = outw * outh;
int remain = size;
for (; remain > 0; remain--)
{
//ToDo Neon
int sum0 = (int)*r0 * (int)kernel0[0] + (int)*r1 * (int)kernel0[1] + (int)*r2 * (int)kernel0[2] + (int)*r3 * (int)kernel0[3] + (int)*r4 * (int)kernel0[4] + (int)*r5 * (int)kernel0[5] + (int)*r6 * (int)kernel0[6] + (int)*r7 * (int)kernel0[7];
*outptr0 += sum0;
r0++;
r1++;
r2++;
r3++;
r4++;
r5++;
r6++;
r7++;
outptr0++;
}
}
for (; q < inch; q++)
{
int* outptr0 = out0;
const signed char* r0 = bottom_blob.channel(q);
const signed char* kernel0 = (const signed char*)kernel + p * inch + q;
const signed char k0 = kernel0[0];
int size = outw * outh;
int remain = size;
for (; remain > 0; remain--)
{
int sum0 = (int)(*r0) * (int)k0;
*outptr0 += sum0;
r0++;
outptr0++;
}
}
}
}
static void conv1x1s2_int8_sse(const Mat& bottom_blob, Mat& top_blob, const Mat& _kernel, const Option& opt)
{
int w = bottom_blob.w;
int inch = bottom_blob.c;
int outw = top_blob.w;
int outh = top_blob.h;
int outch = top_blob.c;
const int tailstep = w - 2 * outw + w;
const signed char* kernel = _kernel;
#pragma omp parallel for num_threads(opt.num_threads)
for (int p = 0; p < outch; p++)
{
Mat out0 = top_blob.channel(p);
out0.fill(0);
int q = 0;
for (; q + 7 < inch; q += 8)
{
int* outptr0 = out0;
const signed char* kernel0 = (const signed char*)kernel + p * inch + q;
const signed char* r0 = bottom_blob.channel(q);
const signed char* r1 = bottom_blob.channel(q + 1);
const signed char* r2 = bottom_blob.channel(q + 2);
const signed char* r3 = bottom_blob.channel(q + 3);
const signed char* r4 = bottom_blob.channel(q + 4);
const signed char* r5 = bottom_blob.channel(q + 5);
const signed char* r6 = bottom_blob.channel(q + 6);
const signed char* r7 = bottom_blob.channel(q + 7);
for (int i = 0; i < outh; i++)
{
int remain = outw;
for (; remain > 0; remain--)
{
//ToDo Neon
int sum0 = (int)*r0 * (int)kernel0[0] + (int)*r1 * (int)kernel0[1] + (int)*r2 * (int)kernel0[2] + (int)*r3 * (int)kernel0[3] + (int)*r4 * (int)kernel0[4] + (int)*r5 * (int)kernel0[5] + (int)*r6 * (int)kernel0[6] + (int)*r7 * (int)kernel0[7];
*outptr0 += sum0;
r0 += 2;
r1 += 2;
r2 += 2;
r3 += 2;
r4 += 2;
r5 += 2;
r6 += 2;
r7 += 2;
outptr0++;
}
r0 += tailstep;
r1 += tailstep;
r2 += tailstep;
r3 += tailstep;
r4 += tailstep;
r5 += tailstep;
r6 += tailstep;
r7 += tailstep;
}
}
for (; q < inch; q++)
{
int* outptr0 = out0;
const signed char* r0 = bottom_blob.channel(q);
const signed char* kernel0 = (const signed char*)kernel + p * inch + q;
for (int i = 0; i < outh; i++)
{
int remain = outw;
for (; remain > 0; remain--)
{
//ToDo Neon
int sum0 = (int)*r0 * (int)kernel0[0];
*outptr0 += sum0;
r0 += 2;
outptr0++;
}
r0 += tailstep;
}
}
}
}
|
0cb9e97a85d86ffc79b9fc54383a673ec7e394bd
|
376e1818d427b5e4d32fa6dd6c7b71e9fd88afdb
|
/wm/olvwm/patches/patch-winpush.c
|
22cb78ed78a04c76715f8d75f62312a0e65cbb48
|
[] |
no_license
|
NetBSD/pkgsrc
|
a0732c023519650ef821ab89c23ab6ab59e25bdb
|
d042034ec4896cc5b47ed6f2e5b8802d9bc5c556
|
refs/heads/trunk
| 2023-09-01T07:40:12.138283
| 2023-09-01T05:25:19
| 2023-09-01T05:25:19
| 88,439,572
| 321
| 138
| null | 2023-07-12T22:34:14
| 2017-04-16T20:04:15
| null |
UTF-8
|
C
| false
| false
| 907
|
c
|
patch-winpush.c
|
$NetBSD: patch-winpush.c,v 1.1 2013/03/28 21:40:12 joerg Exp $
--- winpush.c.orig 2013-03-28 19:49:07.000000000 +0000
+++ winpush.c
@@ -95,11 +95,8 @@ WinPushPin *winInfo;
/*
* eventButtonRelease - handle button release events on the pushpin window
*/
-static int
-eventButtonRelease(dpy, event, winInfo)
-Display *dpy;
-XEvent *event;
-WinPushPin *winInfo;
+static void
+eventButtonRelease(Display *dpy, XEvent *event, WinPushPin *winInfo)
{
FrameAllowEvents(winInfo->core.client, event->xbutton.time);
if (!AllButtonsUp(event))
@@ -121,11 +118,8 @@ WinPushPin *winInfo;
/*
* eventMotionNotify - handle pointer moves
*/
-static int
-eventMotionNotify(dpy, event, winInfo)
-Display *dpy;
-XEvent *event;
-WinPushPin *winInfo;
+static void
+eventMotionNotify(Display *dpy, XEvent *event, WinPushPin *winInfo)
{
Bool fInWindow;
Graphics_info *gisNormal = WinGI(winInfo,NORMAL_GINFO);
|
c841ceddad80b636bc38a1d6d2b2738a98659d08
|
5afa01fb706bc29154491c441ec801585622e38c
|
/verification/cbmc/proofs/aws_byte_buf_write_from_whole_string/aws_byte_buf_write_from_whole_string_harness.c
|
86893d52319df56a7f798960b86aea1fd669999d
|
[
"Apache-2.0",
"BSD-3-Clause",
"GPL-2.0-only"
] |
permissive
|
awslabs/aws-c-common
|
5af461d3b3586a569a1809c7b8f32091eec1a151
|
4dcc41cf4d1f868dcdd622c65c09bda972f75ad2
|
refs/heads/main
| 2023-08-29T14:07:10.856557
| 2023-08-25T07:40:54
| 2023-08-25T07:40:54
| 117,142,517
| 249
| 159
|
Apache-2.0
| 2023-09-12T19:02:25
| 2018-01-11T19:17:12
|
C
|
UTF-8
|
C
| false
| false
| 1,489
|
c
|
aws_byte_buf_write_from_whole_string_harness.c
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/common/string.h>
#include <proof_helpers/make_common_data_structures.h>
#include <proof_helpers/utils.h>
#include <stddef.h>
void aws_byte_buf_write_from_whole_string_harness() {
struct aws_string *str = nondet_allocate_string_bounded_length(MAX_STRING_LEN);
struct aws_byte_buf buf;
ensure_byte_buf_has_allocated_buffer_member(&buf);
__CPROVER_assume(aws_byte_buf_is_valid(&buf));
/* save current state of the data structure */
struct aws_byte_buf old_buf = buf;
struct store_byte_from_buffer old_byte_from_buf;
save_byte_from_array(buf.buffer, buf.len, &old_byte_from_buf);
size_t available_cap = buf.capacity - buf.len;
bool nondet_parameter;
if (aws_byte_buf_write_from_whole_string(nondet_parameter ? &buf : NULL, str) && str) {
assert(aws_string_is_valid(str));
assert(available_cap >= str->len);
if (nondet_parameter) {
assert(buf.len == old_buf.len + str->len);
assert(old_buf.capacity == buf.capacity);
assert(old_buf.allocator == buf.allocator);
if (str->len > 0 && buf.len > 0) {
assert_bytes_match(buf.buffer + old_buf.len, str->bytes, str->len);
}
}
} else {
assert_byte_buf_equivalence(&buf, &old_buf, &old_byte_from_buf);
}
assert(aws_byte_buf_is_valid(&buf));
}
|
1dc95a5d599a660350b3bb196e0b4130c340be7d
|
35c04ea32351dc95bc18d46e5c70dda9c1e08668
|
/Examples/RaspberryPiPico/pico_W_BLE/src/udp_server_shell.h
|
723065c88862c5ddcbed35b66e1f39bf766fb7f2
|
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
ErichStyger/mcuoneclipse
|
0f8e7a2056a26ed79d9d4a0afd64777ff0b2b2fe
|
04ad311b11860ae5f8285316010961a87fa06d0c
|
refs/heads/master
| 2023-08-28T22:54:08.501719
| 2023-08-25T15:11:44
| 2023-08-25T15:11:44
| 7,446,094
| 620
| 1,191
|
NOASSERTION
| 2020-10-16T03:13:28
| 2013-01-04T19:38:12
|
Batchfile
|
UTF-8
|
C
| false
| false
| 735
|
h
|
udp_server_shell.h
|
/*
* Copyright (c) 2021, Erich Styger
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef UDP_SERVER_SHELL_H_
#define UDP_SERVER_SHELL_H_
#include "platform.h"
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#if PL_CONFIG_USE_SHELL
#include "McuShell.h"
/*!
* \brief Command line and shell handler
* \param cmd The command to be parsed
* \param handled If command has been recognized and handled
* \param io I/O handler to be used
* \return error code, otherwise ERR_OK
*/
uint8_t UdpServer_ParseCommand(const unsigned char* cmd, bool *handled, const McuShell_StdIOType *io);
#endif /* PL_CONFIG_USE_SHELL */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* UDP_SERVER_SHELL_H_ */
|
b143f225b31143d05a48606b0a224eac32143b29
|
9ceacf33fd96913cac7ef15492c126d96cae6911
|
/sys/dev/fdt/sdhc_fdt.c
|
e71e00cb85eac1a05bdb101a9e94970c6eaa4f55
|
[] |
no_license
|
openbsd/src
|
ab97ef834fd2d5a7f6729814665e9782b586c130
|
9e79f3a0ebd11a25b4bff61e900cb6de9e7795e9
|
refs/heads/master
| 2023-09-02T18:54:56.624627
| 2023-09-02T15:16:12
| 2023-09-02T15:16:12
| 66,966,208
| 3,394
| 1,235
| null | 2023-08-08T02:42:25
| 2016-08-30T18:18:25
|
C
|
UTF-8
|
C
| false
| false
| 16,010
|
c
|
sdhc_fdt.c
|
/* $OpenBSD: sdhc_fdt.c,v 1.20 2023/04/08 05:40:54 jsg Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/param.h>
#include <sys/malloc.h>
#include <sys/systm.h>
#include <machine/bus.h>
#include <machine/fdt.h>
#include <machine/intr.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_clock.h>
#include <dev/ofw/ofw_gpio.h>
#include <dev/ofw/ofw_misc.h>
#include <dev/ofw/ofw_pinctrl.h>
#include <dev/ofw/ofw_regulator.h>
#include <dev/ofw/fdt.h>
#include <dev/sdmmc/sdhcreg.h>
#include <dev/sdmmc/sdhcvar.h>
#include <dev/sdmmc/sdmmcvar.h>
/* RK3399 */
#define GRF_EMMCCORE_CON0_BASECLOCK 0xf000
#define GRF_EMMCCORE_CON0_BASECLOCK_CLR (0xff << 24)
#define GRF_EMMCCORE_CON0_BASECLOCK_VAL(x) (((x) & 0xff) << 8)
#define GRF_EMMCCORE_CON11 0xf02c
#define GRF_EMMCCORE_CON11_CLOCKMULT_CLR (0xff << 16)
#define GRF_EMMCCORE_CON11_CLOCKMULT_VAL(x) (((x) & 0xff) << 0)
/* Marvell Xenon */
#define XENON_SYS_OP_CTRL 0x108
#define XENON_SYS_OP_CTRL_SLOT_ENABLE(x) (1 << (x))
#define XENON_SYS_OP_CTRL_SDCLK_IDLEOFF_ENABLE(x) (1 << ((x) + 8))
#define XENON_SYS_OP_CTRL_AUTO_CLKGATE_DISABLE (1 << 20)
#define XENON_SYS_EXT_OP_CTRL 0x10c
#define XENON_SYS_EXT_OP_CTRL_PARALLEL_TRAN(x) (1 << (x))
#define XENON_SYS_EXT_OP_CTRL_MASK_CMD_CONFLICT_ERR (1 << 8)
#define XENON_SLOT_EMMC_CTRL 0x130
#define XENON_SLOT_EMMC_CTRL_ENABLE_DATA_STROBE (1 << 24)
#define XENON_SLOT_EMMC_CTRL_ENABLE_RESP_STROBE (1 << 25)
#define XENON_EMMC_PHY_TIMING_ADJUST 0x170
#define XENON_EMMC_PHY_TIMING_ADJUST_SAMPL_INV_QSP_PHASE_SELECT (1 << 18)
#define XENON_EMMC_PHY_TIMING_ADJUST_SDIO_MODE (1 << 28)
#define XENON_EMMC_PHY_TIMING_ADJUST_SLOW_MODE (1 << 29)
#define XENON_EMMC_PHY_TIMING_ADJUST_INIT (1U << 31)
#define XENON_EMMC_PHY_FUNC_CONTROL 0x174
#define XENON_EMMC_PHY_FUNC_CONTROL_DQ_ASYNC_MODE (1 << 4)
#define XENON_EMMC_PHY_FUNC_CONTROL_DQ_DDR_MODE (0xff << 8)
#define XENON_EMMC_PHY_FUNC_CONTROL_CMD_DDR_MODE (1 << 16)
#define XENON_EMMC_PHY_PAD_CONTROL 0x178
#define XENON_EMMC_PHY_PAD_CONTROL_FC_DQ_RECEN (1 << 24)
#define XENON_EMMC_PHY_PAD_CONTROL_FC_CMD_RECEN (1 << 25)
#define XENON_EMMC_PHY_PAD_CONTROL_FC_QSP_RECEN (1 << 26)
#define XENON_EMMC_PHY_PAD_CONTROL_FC_QSN_RECEN (1 << 27)
#define XENON_EMMC_PHY_PAD_CONTROL_FC_ALL_CMOS_RECVR 0xf000
#define XENON_EMMC_PHY_PAD_CONTROL1 0x17c
#define XENON_EMMC_PHY_PAD_CONTROL1_FC_CMD_PD (1 << 8)
#define XENON_EMMC_PHY_PAD_CONTROL1_FC_QSP_PD (1 << 9)
#define XENON_EMMC_PHY_PAD_CONTROL1_FC_CMD_PU (1 << 24)
#define XENON_EMMC_PHY_PAD_CONTROL1_FC_QSP_PU (1 << 25)
#define XENON_EMMC_PHY_PAD_CONTROL1_FC_DQ_PD 0xff
#define XENON_EMMC_PHY_PAD_CONTROL1_FC_DQ_PU (0xff << 16)
#define XENON_EMMC_PHY_PAD_CONTROL2 0x180
#define XENON_EMMC_PHY_PAD_CONTROL2_ZPR_SHIFT 0
#define XENON_EMMC_PHY_PAD_CONTROL2_ZPR_MASK 0x1f
#define XENON_EMMC_PHY_PAD_CONTROL2_ZNR_SHIFT 8
#define XENON_EMMC_PHY_PAD_CONTROL2_ZNR_MASK 0x1f
#define ARMADA_3700_SOC_PAD_CTL 0
#define ARMADA_3700_SOC_PAD_CTL_3_3V 0
#define ARMADA_3700_SOC_PAD_CTL_1_8V 1
struct sdhc_fdt_softc {
struct sdhc_softc sc;
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
bus_space_handle_t sc_pad_ioh;
bus_size_t sc_size;
void *sc_ih;
int sc_node;
uint32_t sc_gpio[3];
uint32_t sc_vqmmc;
/* Marvell Xenon */
int sc_sdhc_id;
int sc_slow_mode;
uint32_t sc_znr;
uint32_t sc_zpr;
struct sdhc_host *sc_host;
struct clock_device sc_cd;
};
int sdhc_fdt_match(struct device *, void *, void *);
void sdhc_fdt_attach(struct device *, struct device *, void *);
const struct cfattach sdhc_fdt_ca = {
sizeof(struct sdhc_fdt_softc), sdhc_fdt_match, sdhc_fdt_attach
};
int sdhc_fdt_card_detect(struct sdhc_softc *);
int sdhc_fdt_signal_voltage(struct sdhc_softc *, int);
uint32_t sdhc_fdt_get_frequency(void *, uint32_t *);
void sdhc_fdt_xenon_bus_clock_post(struct sdhc_softc *, int, int);
int
sdhc_fdt_match(struct device *parent, void *match, void *aux)
{
struct fdt_attach_args *faa = aux;
return (OF_is_compatible(faa->fa_node, "arasan,sdhci-5.1") ||
OF_is_compatible(faa->fa_node, "arasan,sdhci-8.9a") ||
OF_is_compatible(faa->fa_node, "brcm,bcm2711-emmc2") ||
OF_is_compatible(faa->fa_node, "brcm,bcm2835-sdhci") ||
OF_is_compatible(faa->fa_node, "marvell,armada-3700-sdhci") ||
OF_is_compatible(faa->fa_node, "marvell,armada-ap806-sdhci") ||
OF_is_compatible(faa->fa_node, "marvell,armada-cp110-sdhci"));
}
void
sdhc_fdt_attach(struct device *parent, struct device *self, void *aux)
{
struct sdhc_fdt_softc *sc = (struct sdhc_fdt_softc *)self;
struct fdt_attach_args *faa = aux;
struct regmap *rm = NULL;
uint64_t capmask = 0, capset = 0;
uint32_t reg, phandle, freq;
char pad_type[16] = { 0 };
if (faa->fa_nreg < 1) {
printf(": no registers\n");
return;
}
sc->sc_iot = faa->fa_iot;
sc->sc_size = faa->fa_reg[0].size;
sc->sc_node = faa->fa_node;
if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr,
faa->fa_reg[0].size, 0, &sc->sc_ioh)) {
printf(": can't map registers\n");
return;
}
pinctrl_byname(faa->fa_node, "default");
clock_set_assigned(faa->fa_node);
clock_enable_all(faa->fa_node);
reset_deassert_all(faa->fa_node);
sc->sc_ih = fdt_intr_establish(faa->fa_node, IPL_BIO,
sdhc_intr, sc, sc->sc.sc_dev.dv_xname);
if (sc->sc_ih == NULL) {
printf(": can't establish interrupt\n");
goto unmap;
}
if (OF_getproplen(faa->fa_node, "cd-gpios") > 0 ||
OF_getproplen(faa->fa_node, "non-removable") == 0) {
OF_getpropintarray(faa->fa_node, "cd-gpios", sc->sc_gpio,
sizeof(sc->sc_gpio));
gpio_controller_config_pin(sc->sc_gpio, GPIO_CONFIG_INPUT);
sc->sc.sc_card_detect = sdhc_fdt_card_detect;
}
sc->sc_vqmmc = OF_getpropint(sc->sc_node, "vqmmc-supply", 0);
printf("\n");
sc->sc.sc_host = &sc->sc_host;
sc->sc.sc_dmat = faa->fa_dmat;
/*
* Arasan controller always uses 1.8V and doesn't like an
* explicit switch.
*/
if (OF_is_compatible(faa->fa_node, "arasan,sdhci-5.1"))
sc->sc.sc_signal_voltage = sdhc_fdt_signal_voltage;
/*
* Rockchip RK3399 PHY doesn't like being powered down at low
* clock speeds and needs to be powered up explicitly.
*/
if (OF_is_compatible(faa->fa_node, "rockchip,rk3399-sdhci-5.1")) {
/*
* The eMMC core's clock multiplier is of no use, so we just
* clear it. Also make sure to set the base clock frequency.
*/
freq = clock_get_frequency(faa->fa_node, "clk_xin");
freq /= 1000 * 1000; /* in MHz */
phandle = OF_getpropint(faa->fa_node,
"arasan,soc-ctl-syscon", 0);
if (phandle)
rm = regmap_byphandle(phandle);
if (rm) {
regmap_write_4(rm, GRF_EMMCCORE_CON11,
GRF_EMMCCORE_CON11_CLOCKMULT_CLR |
GRF_EMMCCORE_CON11_CLOCKMULT_VAL(0));
regmap_write_4(rm, GRF_EMMCCORE_CON0_BASECLOCK,
GRF_EMMCCORE_CON0_BASECLOCK_CLR |
GRF_EMMCCORE_CON0_BASECLOCK_VAL(freq));
}
/* Provide base clock frequency for the PHY driver. */
sc->sc_cd.cd_node = faa->fa_node;
sc->sc_cd.cd_cookie = sc;
sc->sc_cd.cd_get_frequency = sdhc_fdt_get_frequency;
clock_register(&sc->sc_cd);
/*
* Enable the PHY. The PHY should be powered on/off in
* the bus_clock function, but it's good enough to just
* enable it here right away and to keep it powered on.
*/
phy_enable(faa->fa_node, "phy_arasan");
sc->sc.sc_flags |= SDHC_F_NOPWR0;
/* XXX Doesn't work on Rockchip RK3399. */
capmask |= (uint64_t)SDHC_DDR50_SUPP << 32;
}
if (OF_is_compatible(faa->fa_node, "arasan,sdhci-8.9a")) {
freq = clock_get_frequency(faa->fa_node, "clk_xin");
sc->sc.sc_clkbase = freq / 1000;
}
if (OF_is_compatible(faa->fa_node, "brcm,bcm2711-emmc2"))
sc->sc.sc_flags |= SDHC_F_NOPWR0;
if (OF_is_compatible(faa->fa_node, "brcm,bcm2835-sdhci")) {
capmask = 0xffffffff;
capset = SDHC_VOLTAGE_SUPP_3_3V | SDHC_HIGH_SPEED_SUPP;
capset |= SDHC_MAX_BLK_LEN_1024 << SDHC_MAX_BLK_LEN_SHIFT;
freq = clock_get_frequency(faa->fa_node, NULL);
sc->sc.sc_clkbase = freq / 1000;
sc->sc.sc_flags |= SDHC_F_32BIT_ACCESS;
sc->sc.sc_flags |= SDHC_F_NO_HS_BIT;
}
if (OF_is_compatible(faa->fa_node, "marvell,armada-3700-sdhci") ||
OF_is_compatible(faa->fa_node, "marvell,armada-ap806-sdhci") ||
OF_is_compatible(faa->fa_node, "marvell,armada-cp110-sdhci")) {
if (OF_is_compatible(faa->fa_node,
"marvell,armada-3700-sdhci")) {
KASSERT(faa->fa_nreg > 1);
if (bus_space_map(sc->sc_iot, faa->fa_reg[1].addr,
faa->fa_reg[1].size, 0, &sc->sc_pad_ioh)) {
printf("%s: can't map registers\n",
sc->sc.sc_dev.dv_xname);
return;
}
OF_getprop(faa->fa_node, "marvell,pad-type",
pad_type, sizeof(pad_type));
if (!strcmp(pad_type, "fixed-1-8v")) {
bus_space_write_4(sc->sc_iot, sc->sc_pad_ioh,
ARMADA_3700_SOC_PAD_CTL,
ARMADA_3700_SOC_PAD_CTL_1_8V);
} else {
bus_space_write_4(sc->sc_iot, sc->sc_pad_ioh,
ARMADA_3700_SOC_PAD_CTL,
ARMADA_3700_SOC_PAD_CTL_3_3V);
regulator_set_voltage(sc->sc_vqmmc, 3300000);
}
}
if (OF_getpropint(faa->fa_node, "bus-width", 1) != 8)
capmask |= SDHC_8BIT_MODE_SUPP;
if (OF_getproplen(faa->fa_node, "no-1-8-v") == 0) {
capmask |= SDHC_VOLTAGE_SUPP_1_8V;
capmask |= (uint64_t)SDHC_DDR50_SUPP << 32;
}
if (OF_getproplen(faa->fa_node,
"marvell,xenon-phy-slow-mode") == 0)
sc->sc_slow_mode = 1;
sc->sc_znr = OF_getpropint(faa->fa_node,
"marvell,xenon-phy-znr", 0xf);
sc->sc_znr &= XENON_EMMC_PHY_PAD_CONTROL2_ZNR_MASK;
sc->sc_zpr = OF_getpropint(faa->fa_node,
"marvell,xenon-phy-zpr", 0xf);
sc->sc_zpr &= XENON_EMMC_PHY_PAD_CONTROL2_ZPR_MASK;
sc->sc_sdhc_id = OF_getpropint(faa->fa_node,
"marvell,xenon-sdhc-id", 0);
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
XENON_SYS_OP_CTRL);
reg |= XENON_SYS_OP_CTRL_SLOT_ENABLE(sc->sc_sdhc_id);
reg &= ~XENON_SYS_OP_CTRL_SDCLK_IDLEOFF_ENABLE(sc->sc_sdhc_id);
reg &= ~XENON_SYS_OP_CTRL_AUTO_CLKGATE_DISABLE;
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
XENON_SYS_OP_CTRL, reg);
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
XENON_SYS_EXT_OP_CTRL);
reg |= XENON_SYS_EXT_OP_CTRL_PARALLEL_TRAN(sc->sc_sdhc_id);
reg |= XENON_SYS_EXT_OP_CTRL_MASK_CMD_CONFLICT_ERR;
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
XENON_SYS_EXT_OP_CTRL, reg);
freq = clock_get_frequency(faa->fa_node, NULL);
sc->sc.sc_clkbase = freq / 1000;
sc->sc.sc_bus_clock_post = sdhc_fdt_xenon_bus_clock_post;
}
sdhc_host_found(&sc->sc, sc->sc_iot, sc->sc_ioh, sc->sc_size, 1,
capmask, capset);
return;
unmap:
bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_size);
}
int
sdhc_fdt_card_detect(struct sdhc_softc *ssc)
{
struct sdhc_fdt_softc *sc = (struct sdhc_fdt_softc *)ssc;
if (OF_getproplen(sc->sc_node, "non-removable") == 0)
return 1;
return gpio_controller_get_pin(sc->sc_gpio);
}
int
sdhc_fdt_signal_voltage(struct sdhc_softc *sc, int signal_voltage)
{
switch (signal_voltage) {
case SDMMC_SIGNAL_VOLTAGE_180:
return 0;
default:
return EINVAL;
}
}
uint32_t
sdhc_fdt_get_frequency(void *cookie, uint32_t *cells)
{
struct sdhc_fdt_softc *sc = cookie;
return clock_get_frequency(sc->sc_cd.cd_node, "clk_xin");
}
/* Marvell Xenon */
void
sdhc_fdt_xenon_bus_clock_post(struct sdhc_softc *ssc, int freq, int timing)
{
struct sdhc_fdt_softc *sc = (struct sdhc_fdt_softc *)ssc;
uint32_t reg;
int i;
if (freq == 0)
return;
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_PAD_CONTROL);
reg |= (XENON_EMMC_PHY_PAD_CONTROL_FC_DQ_RECEN |
XENON_EMMC_PHY_PAD_CONTROL_FC_CMD_RECEN |
XENON_EMMC_PHY_PAD_CONTROL_FC_QSP_RECEN |
XENON_EMMC_PHY_PAD_CONTROL_FC_QSN_RECEN |
XENON_EMMC_PHY_PAD_CONTROL_FC_ALL_CMOS_RECVR);
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_PAD_CONTROL, reg);
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_PAD_CONTROL1);
reg &= ~(XENON_EMMC_PHY_PAD_CONTROL1_FC_CMD_PD |
XENON_EMMC_PHY_PAD_CONTROL1_FC_DQ_PD);
reg |= (XENON_EMMC_PHY_PAD_CONTROL1_FC_CMD_PU |
XENON_EMMC_PHY_PAD_CONTROL1_FC_DQ_PU);
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_PAD_CONTROL1, reg);
if (timing == SDMMC_TIMING_LEGACY)
goto phy_init;
/* TODO: check for SMF_IO_MODE and set flag */
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_TIMING_ADJUST);
reg &= ~XENON_EMMC_PHY_TIMING_ADJUST_SDIO_MODE;
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_TIMING_ADJUST, reg);
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_PAD_CONTROL2);
reg &= ~(XENON_EMMC_PHY_PAD_CONTROL2_ZPR_MASK <<
XENON_EMMC_PHY_PAD_CONTROL2_ZPR_SHIFT |
XENON_EMMC_PHY_PAD_CONTROL2_ZNR_MASK <<
XENON_EMMC_PHY_PAD_CONTROL2_ZNR_SHIFT);
reg |= sc->sc_zpr << XENON_EMMC_PHY_PAD_CONTROL2_ZPR_SHIFT |
sc->sc_znr << XENON_EMMC_PHY_PAD_CONTROL2_ZNR_SHIFT;
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_PAD_CONTROL2, reg);
reg = bus_space_read_2(sc->sc_iot, sc->sc_ioh, SDHC_CLOCK_CTL);
reg &= ~SDHC_SDCLK_ENABLE;
bus_space_write_2(sc->sc_iot, sc->sc_ioh, SDHC_CLOCK_CTL, reg);
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_FUNC_CONTROL);
reg &= ~(XENON_EMMC_PHY_FUNC_CONTROL_DQ_DDR_MODE |
XENON_EMMC_PHY_FUNC_CONTROL_CMD_DDR_MODE);
reg |= XENON_EMMC_PHY_FUNC_CONTROL_DQ_ASYNC_MODE;
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_FUNC_CONTROL, reg);
reg = bus_space_read_2(sc->sc_iot, sc->sc_ioh, SDHC_CLOCK_CTL);
reg |= SDHC_SDCLK_ENABLE;
bus_space_write_2(sc->sc_iot, sc->sc_ioh, SDHC_CLOCK_CTL, reg);
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
XENON_SLOT_EMMC_CTRL);
reg &= ~(XENON_SLOT_EMMC_CTRL_ENABLE_DATA_STROBE |
XENON_SLOT_EMMC_CTRL_ENABLE_RESP_STROBE);
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
XENON_SLOT_EMMC_CTRL, reg);
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_PAD_CONTROL1);
reg &= ~(XENON_EMMC_PHY_PAD_CONTROL1_FC_QSP_PD |
XENON_EMMC_PHY_PAD_CONTROL1_FC_QSP_PU);
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_PAD_CONTROL1, reg);
phy_init:
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_TIMING_ADJUST);
reg |= XENON_EMMC_PHY_TIMING_ADJUST_SAMPL_INV_QSP_PHASE_SELECT;
reg &= ~XENON_EMMC_PHY_TIMING_ADJUST_SLOW_MODE;
if (timing == SDMMC_TIMING_LEGACY ||
timing == SDMMC_TIMING_HIGHSPEED || sc->sc_slow_mode)
reg |= XENON_EMMC_PHY_TIMING_ADJUST_SLOW_MODE;
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_TIMING_ADJUST, reg);
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_TIMING_ADJUST);
reg |= XENON_EMMC_PHY_TIMING_ADJUST_INIT;
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_TIMING_ADJUST, reg);
for (i = 1000; i > 0; i--) {
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
XENON_EMMC_PHY_TIMING_ADJUST);
if (!(reg & XENON_EMMC_PHY_TIMING_ADJUST_INIT))
break;
delay(10);
}
if (i == 0)
printf("%s: phy initialization timeout\n",
sc->sc.sc_dev.dv_xname);
if (freq > SDMMC_SDCLK_400KHZ) {
reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
XENON_SYS_OP_CTRL);
reg |= XENON_SYS_OP_CTRL_SDCLK_IDLEOFF_ENABLE(sc->sc_sdhc_id);
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
XENON_SYS_OP_CTRL, reg);
}
}
|
f998d3c6f2971ddc9b04d3a4c934fcd31520083b
|
03b2c80dbc41e904b167d504666e27d798da5447
|
/src/scope_object.h
|
e384708f6a044ecf53cad5cfd6344c1fe68e7a62
|
[
"Unlicense"
] |
permissive
|
nptcl/npt
|
7c1570b497cdce0b8971cb445fbc04cb500232d3
|
aa714a2370ac9fa5348c2fc96159b40b9de3de07
|
refs/heads/master
| 2023-03-20T09:13:54.669118
| 2022-07-02T11:17:44
| 2022-07-02T11:17:44
| 171,985,905
| 160
| 12
|
Unlicense
| 2023-03-11T01:36:37
| 2019-02-22T03:11:34
|
C
|
UTF-8
|
C
| false
| false
| 4,941
|
h
|
scope_object.h
|
#ifndef __SCOPE_OBJECT_HEADER__
#define __SCOPE_OBJECT_HEADER__
#include "declare.h"
#include "execute.h"
#include "hold.h"
#include "parse.h"
#include "scope_typedef.h"
#include "typedef.h"
#define eval_scope_heap_ _n(eval_scope_heap_)
#define eval_scope_size_ _n(eval_scope_size_)
#define make_eval_scope_ _n(make_eval_scope_)
#define structevalscope _n(structevalscope)
#define refevalscopetype _n(refevalscopetype)
#define getevalscopetype _n(getevalscopetype)
#define setevalscopetype _n(setevalscopetype)
#define refevalscopethe _n(refevalscopethe)
#define getevalscopethe _n(getevalscopethe)
#define setevalscopethe _n(setevalscopethe)
#define refevalscopevalue _n(refevalscopevalue)
#define getevalscopevalue _n(getevalscopevalue)
#define setevalscopevalue _n(setevalscopevalue)
#define refevalscopeindex _n(refevalscopeindex)
#define getevalscopeindex _n(getevalscopeindex)
#define setevalscopeindex _n(setevalscopeindex)
#define EvalScopeTable _n(EvalScopeTable)
#define scope_eval _n(scope_eval)
#define scope_allcons _n(scope_allcons)
#define localhold_scope_eval _n(localhold_scope_eval)
#define localhold_scope_allcons _n(localhold_scope_allcons)
#define scope_eval_lexical_ _n(scope_eval_lexical_)
#define scope_step_p _n(scope_step_p)
#define StructEvalScope_Low(x) ((struct scope_struct *)PtrEvalBodyAny(x))
#define RefEvalScopeType_Low(x) (StructEvalScope(x)->type)
#define GetEvalScopeType_Low(x,v) (*(v) = RefEvalScopeType_Low(x))
#define SetEvalScopeType_Low(x,v) (RefEvalScopeType_Low(x) = (v))
#define RefEvalScopeThe_Low(p) RefEval((p),EVAL_SCOPE_THE)
#define GetEvalScopeThe_Low(p,v) GetEval((p),EVAL_SCOPE_THE,(v))
#define SetEvalScopeThe_Low(p,v) SetEval((p),EVAL_SCOPE_THE,(v))
#define RefEvalScopeValue_Low(p) RefEval((p),EVAL_SCOPE_VALUE)
#define GetEvalScopeValue_Low(p,v) GetEval((p),EVAL_SCOPE_VALUE,(v))
#define SetEvalScopeValue_Low(p,v) SetEval((p),EVAL_SCOPE_VALUE,(v))
#define RefEvalScopeIndex_Low(p,i) RefEval((p),(2UL+(i)))
#define GetEvalScopeIndex_Low(p,i,v) GetEval((p),(2UL+(i)),(v))
#define SetEvalScopeIndex_Low(p,i,v) SetEval((p),(2UL+(i)),(v))
#ifdef LISP_DEBUG
#define StructEvalScope(x) structevalscope(x)
#define RefEvalScopeType(x) refevalscopetype(x)
#define GetEvalScopeType(x,v) getevalscopetype(x,v)
#define SetEvalScopeType(x,v) setevalscopetype(x,v)
#define RefEvalScopeThe(p) refevalscopethe(p)
#define GetEvalScopeThe(p,v) getevalscopethe(p,v)
#define SetEvalScopeThe(p,v) setevalscopethe(p,v)
#define RefEvalScopeValue(p) refevalscopevalue(p)
#define GetEvalScopeValue(p,v) getevalscopevalue(p,v)
#define SetEvalScopeValue(p,v) setevalscopevalue(p,v)
#define RefEvalScopeIndex(p,i) refevalscopeindex(p,i)
#define GetEvalScopeIndex(p,i,v) getevalscopeindex(p,i,v)
#define SetEvalScopeIndex(p,i,v) setevalscopeindex(p,i,v)
#else
#define StructEvalScope(x) StructEvalScope_Low(x)
#define RefEvalScopeType(x) RefEvalScopeType_Low(x)
#define GetEvalScopeType(x,v) GetEvalScopeType_Low(x,v)
#define SetEvalScopeType(x,v) SetEvalScopeType_Low(x,v)
#define RefEvalScopeThe(p) RefEvalScopeThe_Low(p)
#define GetEvalScopeThe(p,v) GetEvalScopeThe_Low(p,v)
#define SetEvalScopeThe(p,v) SetEvalScopeThe_Low(p,v)
#define RefEvalScopeValue(p) RefEvalScopeValue_Low(p)
#define GetEvalScopeValue(p,v) GetEvalScopeValue_Low(p,v)
#define SetEvalScopeValue(p,v) SetEvalScopeValue_Low(p,v)
#define RefEvalScopeIndex(p,i) RefEvalScopeIndex_Low(p,i)
#define GetEvalScopeIndex(p,i,v) GetEvalScopeIndex_Low(p,i,v)
#define SetEvalScopeIndex(p,i,v) SetEvalScopeIndex_Low(p,i,v)
#endif
int eval_scope_heap_(Execute ptr, addr *ret, size_t size);
int eval_scope_size_(Execute ptr, addr *ret, size_t size,
EvalParse parse, addr type, addr value);
int make_eval_scope_(Execute ptr,
addr *ret, EvalParse parse, addr type, addr value);
struct scope_struct *structevalscope(addr pos);
EvalParse refevalscopetype(addr pos);
void getevalscopetype(addr pos, EvalParse *ret);
void setevalscopetype(addr pos, EvalParse value);
addr refevalscopethe(addr pos);
void getevalscopethe(addr pos, addr *ret);
void setevalscopethe(addr pos, addr value);
addr refevalscopevalue(addr pos);
void getevalscopevalue(addr pos, addr *ret);
void setevalscopevalue(addr pos, addr value);
addr refevalscopeindex(addr pos, size_t size);
void getevalscopeindex(addr pos, size_t size, addr *ret);
void setevalscopeindex(addr pos, size_t size, addr value);
/* table */
typedef int (*eval_scope_calltype)(Execute, addr *, addr);
extern eval_scope_calltype EvalScopeTable[EVAL_PARSE_SIZE];
int scope_eval(Execute ptr, addr *ret, addr eval);
int scope_allcons(Execute ptr, addr *retcons, addr *rettype, addr cons);
int localhold_scope_eval(LocalHold hold, Execute ptr, addr *ret, addr eval);
int localhold_scope_allcons(LocalHold hold,
Execute ptr, addr *retcons, addr *rettype, addr cons);
int scope_eval_lexical_(Execute ptr, addr *ret, addr eval);
int scope_step_p(addr pos);
#endif
|
e6d6dd170f3adc75baa2f24d0450215f52c76ce3
|
03666e5f961946fc1a0ac67781ac1425562ef0d7
|
/src/viewer/rpc/ViewerState.C
|
b3d945cf542d7c4b49973f6e183ab248a94cf9ae
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
visit-dav/visit
|
e9f81b4d4b9b9930a0db9d5282cd1bcabf465e2e
|
601ae46e0bef2e18425b482a755d03490ade0493
|
refs/heads/develop
| 2023-09-06T08:19:38.397058
| 2023-09-05T21:29:32
| 2023-09-05T21:29:32
| 165,565,988
| 335
| 120
|
BSD-3-Clause
| 2023-09-14T00:53:37
| 2019-01-13T23:27:26
|
C
|
UTF-8
|
C
| false
| false
| 14,688
|
c
|
ViewerState.C
|
// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers. See the top-level LICENSE file for dates and other
// details. No copyright assignment is required to contribute to VisIt.
#include <ViewerState.h>
#include <avtDatabaseMetaData.h>
#include <AnimationAttributes.h>
#include <AnnotationAttributes.h>
#include <AnnotationObjectList.h>
#include <AppearanceAttributes.h>
#include <CinemaAttributes.h>
#include <ClientMethod.h>
#include <ClientInformation.h>
#include <ClientInformationList.h>
#include <ColorTableAttributes.h>
#include <ConstructDataBinningAttributes.h>
#include <DatabaseCorrelationList.h>
#include <DBPluginInfoAttributes.h>
#include <ExportDBAttributes.h>
#include <ExpressionList.h>
#include <EngineList.h>
#include <FileOpenOptions.h>
#include <GlobalAttributes.h>
#include <GlobalLineoutAttributes.h>
#include <HostProfileList.h>
#include <VisItInit.h>
#include <InteractorAttributes.h>
#include <KeyframeAttributes.h>
#include <LightList.h>
#include <MaterialAttributes.h>
#include <MeshManagementAttributes.h>
#include <MessageAttributes.h>
#include <MovieAttributes.h>
#include <ParentProcess.h>
#include <PickAttributes.h>
#include <PlotInfoAttributes.h>
#include <PlotList.h>
#include <PluginManagerAttributes.h>
#include <PostponedAction.h>
#include <PrinterAttributes.h>
#include <ProcessAttributes.h>
#include <QueryAttributes.h>
#include <QueryList.h>
#include <RenderingAttributes.h>
#include <SaveWindowAttributes.h>
#include <SelectionList.h>
#include <SelectionProperties.h>
#include <SimulationUIValues.h>
#include <StatusAttributes.h>
#include <SILRestrictionAttributes.h>
#include <SyncAttributes.h>
#include <QueryOverTimeAttributes.h>
#include <ViewAxisArrayAttributes.h>
#include <ViewCurveAttributes.h>
#include <View2DAttributes.h>
#include <View3DAttributes.h>
#include <WindowInformation.h>
#include <ViewerClientAttributes.h>
#include <ViewerClientInformation.h>
//
// Undefine the macro so we can redefine it for various purposes in this file.
//
#ifdef VIEWER_REGISTER_OBJECT
#undef VIEWER_REGISTER_OBJECT
#endif
// ****************************************************************************
// Method: ViewerState::ViewerState
//
// Purpose:
// Constructor for the ViewerState class.
//
// Programmer: Brad Whitlock
// Creation: Tue Feb 13 17:39:59 PST 2007
//
// Modifications:
//
// ****************************************************************************
ViewerState::ViewerState() : objVector()
{
#undef VIEWER_BEGIN_FREELY_EXCHANGED_STATE
#define VIEWER_BEGIN_FREELY_EXCHANGED_STATE freelyExchangedState = objVector.size();
#define VIEWER_REGISTER_OBJECT(Name, T, ps) ptr##Name = (T *)Register(new T(), true, ps);
VIEWER_OBJECT_CREATION
#undef VIEWER_REGISTER_OBJECT
nPlots = nOperators = 0;
}
// ****************************************************************************
// Method: ViewerState::ViewerState
//
// Purpose:
// Copy constructor for the ViewerState class.
//
// Arguments:
// vs : The ViewerState object that we're copying.
//
// Programmer: Brad Whitlock
// Creation: Tue Feb 13 17:39:59 PST 2007
//
// Modifications:
//
// ****************************************************************************
ViewerState::ViewerState(const ViewerState &vs) : objVector()
{
#define VIEWER_REGISTER_OBJECT(Name, T, ps) ptr##Name = (T *)Register(vs.ptr##Name->NewInstance(true), true, ps);
VIEWER_OBJECT_CREATION
#undef VIEWER_REGISTER_OBJECT
nPlots = vs.nPlots;
nOperators = vs.nOperators;
// Since the above VIEWER_OBJECT_CREATION macro exists to ensure that
// the static objects are copied, and their pointers get put into
// the local members, we must copy plot and operator attributes here.
size_t nObjects = objVector.size();
for(size_t i = nObjects; i < vs.objVector.size(); ++i)
{
ObjectRecord rec;
rec.object = vs.objVector[i].object->NewInstance(true);
rec.owns = vs.objVector[i].owns;
rec.partialSend = vs.objVector[i].partialSend;
rec.objPurpose = vs.objVector[i].objPurpose;
objVector.push_back(rec);
}
}
// ****************************************************************************
// Method: ViewerState::~ViewerState
//
// Purpose:
// Destructor for the ViewerState class.
//
// Note: It only destroys objects that it owns.
//
// Programmer: Brad Whitlock
// Creation: Fri Feb 23 11:39:23 PDT 2007
//
// Modifications:
//
// ****************************************************************************
ViewerState::~ViewerState()
{
// Delete the objects through the objVector.
for(size_t i = 0; i < objVector.size(); ++i)
{
if(objVector[i].owns)
delete objVector[i].object;
}
}
// ****************************************************************************
// Method: ViewerState::GetStateObject
//
// Purpose:
// Returns a pointer to the i'th state object.
//
// Arguments:
// i : The index of the state object that we want.
//
// Returns: A pointer to the i'th state object or 0.
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Fri Feb 23 11:39:51 PDT 2007
//
// Modifications:
//
// ****************************************************************************
AttributeSubject *
ViewerState::GetStateObject(int i)
{
return (i >= 0 && (size_t)i < objVector.size()) ?
objVector[i].object : 0;
}
const AttributeSubject *
ViewerState::GetStateObject(int i) const
{
return (i >= 0 && (size_t)i < objVector.size()) ?
objVector[i].object : 0;
}
// ****************************************************************************
// Method: ViewerState::GetPartialSendFlag
//
// Purpose:
// Gets the partial send flag for the i'th state object.
//
// Arguments:
// i : The index of the state object.
//
// Programmer: Brad Whitlock
// Creation: Fri Feb 23 11:40:30 PDT 2007
//
// Modifications:
//
// ****************************************************************************
bool
ViewerState::GetPartialSendFlag(int i) const
{
return (i >= 0 && (size_t)i < objVector.size()) ?
objVector[i].partialSend : false;
}
// ****************************************************************************
// Method: ViewerState::GetNumStateObjects
//
// Purpose:
// Returns the number of state objects.
//
// Returns: The number of state objects.
//
// Programmer: Brad Whitlock
// Creation: Fri Feb 23 11:40:58 PDT 2007
//
// Modifications:
//
// ****************************************************************************
int
ViewerState::GetNumStateObjects() const
{
return objVector.size();
}
// ****************************************************************************
// Method: ViewerState::GetNumPlotStateObjects
//
// Purpose:
// Returns the number of plot state objects.
//
// Returns: The number of plot state objects.
//
// Programmer: Brad Whitlock
// Creation: Fri Feb 23 11:41:25 PDT 2007
//
// Modifications:
//
// ****************************************************************************
int
ViewerState::GetNumPlotStateObjects() const
{
return nPlots;
}
// ****************************************************************************
// Method: ViewerState::GetNumOperatorStateObjects
//
// Purpose:
// Returns the number of operator state objects.
//
// Returns: The number of operator state objects.
//
// Programmer: Brad Whitlock
// Creation: Fri Feb 23 11:41:45 PDT 2007
//
// Modifications:
//
// ****************************************************************************
int
ViewerState::GetNumOperatorStateObjects() const
{
return nOperators;
}
// ****************************************************************************
// Method: ViewerState::FreelyExchangedState
//
// Purpose:
// Returns the index above which all state objects can be sent to the client
// without any hesitation.
//
// Returns: The index of the beginning of the freely exchanged state objects.
//
// Programmer: Brad Whitlock
// Creation: Fri Feb 23 11:42:07 PDT 2007
//
// Modifications:
//
// ****************************************************************************
int
ViewerState::FreelyExchangedState() const
{
return freelyExchangedState;
}
// ****************************************************************************
// Method: ViewerState::UpdatePointer
//
// Purpose:
// Updates the pointer to a state object.
//
// Arguments:
// oldValue : The pointer to replace.
// newValue : The new pointer value.
// owns : True if the ViewerState object will own the new pointer.
//
// Programmer: Brad Whitlock
// Creation: Fri Feb 23 11:42:54 PDT 2007
//
// Modifications:
//
// ****************************************************************************
void
ViewerState::UpdatePointer(AttributeSubject *oldValue, AttributeSubject *newValue,
bool owns)
{
for(size_t i = 0; i < objVector.size(); ++i)
{
if(objVector[i].object == oldValue)
{
if(objVector[i].owns)
delete objVector[i].object;
objVector[i].object = newValue;
objVector[i].owns = owns;
break;
}
}
}
// ****************************************************************************
// Method: ViewerState::Register
//
// Purpose:
// Registers a state object with ViewerState.
//
// Arguments:
// obj : The object to register.
// owns : True if the ViewerState object will own the object.
// partialSend : True if it is okay to send pieces of the object to the clients.
//
// Returns: The pointer to the object that was passed in.
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Fri Feb 23 11:44:53 PDT 2007
//
// Modifications:
//
// ****************************************************************************
AttributeSubject *
ViewerState::Register(AttributeSubject *obj, bool owns, bool partialSend)
{
ObjectRecord rec;
rec.object = obj;
rec.owns = owns;
rec.partialSend = partialSend;
rec.objPurpose = GeneralState;
objVector.push_back(rec);
return obj;
}
// ****************************************************************************
// Method: ViewerState::RegisterPlotAttributes
//
// Purpose:
// Registers a plot state object.
//
// Arguments:
// obj : The plot attributes to be associated with ViewerState.
//
// Returns: The pointer to the plot attributes
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Fri Feb 23 11:46:13 PDT 2007
//
// Modifications:
// Brad Whitlock, Wed Jan 7 15:00:58 PST 2009
// I added a plot info attributes for each plot that gets registered.
//
// ****************************************************************************
AttributeSubject *
ViewerState::RegisterPlotAttributes(AttributeSubject *obj)
{
ObjectRecord rec;
rec.object = obj;
rec.owns = true;
rec.partialSend = true;
rec.objPurpose = PlotState;
objVector.push_back(rec);
ObjectRecord rec2;
rec2.object = new PlotInfoAttributes;
rec2.owns = true;
rec2.partialSend = false;
rec2.objPurpose = PlotInformation;
objVector.push_back(rec2);
nPlots++;
return obj;
}
// ****************************************************************************
// Method: ViewerState::RegisterOperatorAttributes
//
// Purpose:
// Registers an operator state object.
//
// Arguments:
// obj : The operator attributes to be associated with ViewerState.
//
// Returns: The pointer to the operator attributes.
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Fri Feb 23 11:47:01 PDT 2007
//
// Modifications:
//
// ****************************************************************************
AttributeSubject *
ViewerState::RegisterOperatorAttributes(AttributeSubject *obj)
{
ObjectRecord rec;
rec.object = obj;
rec.owns = true;
rec.partialSend = true;
rec.objPurpose = OperatorState;
objVector.push_back(rec);
nOperators++;
return obj;
}
// ****************************************************************************
// Method: ViewerState::GetPlotAttributes
//
// Purpose:
// Get the n'th plot state object.
//
// Arguments:
// n : The index of the plot in the order they were registered.
//
// Returns: The pointer to the state object.
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Fri Feb 23 11:47:43 PDT 2007
//
// Modifications:
//
// ****************************************************************************
AttributeSubject *
ViewerState::GetPlotAttributes(int n) const
{
int count = 0;
for(size_t i = 0; i < objVector.size(); ++i)
{
if(objVector[i].objPurpose == PlotState)
{
if(count == n)
return objVector[i].object;
++count;
}
}
return 0;
}
// ****************************************************************************
// Method: ViewerState::GetPlotAttributes
//
// Purpose:
// Get the n'th plot information object.
//
// Arguments:
// n : The index of the plot in the order they were registered.
//
// Returns: The pointer to the plot information state object.
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Fri Feb 23 11:47:43 PDT 2007
//
// Modifications:
//
// ****************************************************************************
PlotInfoAttributes *
ViewerState::GetPlotInformation(int n) const
{
int count = 0;
for(size_t i = 0; i < objVector.size(); ++i)
{
if(objVector[i].objPurpose == PlotInformation)
{
if(count == n)
return (PlotInfoAttributes *)objVector[i].object;
++count;
}
}
return 0;
}
// ****************************************************************************
// Method: ViewerState::GetOperatorAttributes
//
// Purpose:
// Get the n'th operator state object.
//
// Arguments:
// n : The index of the operator in the order they were registered.
//
// Returns: The pointer to the state object.
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Fri Feb 23 11:47:43 PDT 2007
//
// Modifications:
//
// ****************************************************************************
AttributeSubject *
ViewerState::GetOperatorAttributes(int type) const
{
int count = 0;
for(size_t i = 0; i < objVector.size(); ++i)
{
if(objVector[i].objPurpose == OperatorState)
{
if(count == type)
return objVector[i].object;
++count;
}
}
return 0;
}
|
04515d1e1bb22f5b9edb4b61ae156bc29264f963
|
009956c413ac892b90d3cfadea05caa08086c193
|
/lang-server-backends/c/libreactor/main.c
|
9570943914110b868fdeae5873409218c7f71332
|
[] |
no_license
|
sumeetchhetri/ffead-cpp
|
b12c6389877c87acff88349456bde5758861d8eb
|
8072c7a0b4c81d1558e10e091d239fbf474993ce
|
refs/heads/master
| 2023-05-14T02:00:29.875099
| 2023-04-29T13:25:49
| 2023-04-29T13:25:49
| 4,089,214
| 611
| 135
| null | 2022-09-24T09:51:35
| 2012-04-20T17:19:47
|
C++
|
UTF-8
|
C
| false
| false
| 7,451
|
c
|
main.c
|
/*
Copyright 2009-2020, Sumeet Chhetri
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <err.h>
#include "ffead-cpp.h"
#include <time.h>
#include <dynamic.h>
#include <reactor.h>
#include "setup.h"
static reactor_vector reactor_http_message_date_1(reactor_http *http)
{
time_t t;
struct tm tm;
static const char *days[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
static const char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
static __thread uint64_t now, last = 0;
static __thread char date[30] = "Thu, 01 Jan 1970 00:00:00 GMT";
(void) http;
now = reactor_core_now();
if (now - last >= 1000000000)
{
last = now;
(void) time(&t);
(void) gmtime_r(&t, &tm);
(void) strftime(date, 30, "---, %d --- %Y %H:%M:%S GMT", &tm);
memcpy(date, days[tm.tm_wday], 3);
memcpy(date + 8, months[tm.tm_mon], 3);
}
return (reactor_vector){date, 29};
}
static reactor_status handle(reactor_event *event)
{
reactor_server_session *session = (reactor_server_session *) event->data;
ffead_request freq;
freq.server_str = "libreactor";
freq.server_str_len = 10;
freq.method = (const char*)session->request->method.base;
freq.method_len = session->request->method.size;
freq.path = (const char*)session->request->target.base;
freq.path_len = session->request->target.size;
freq.body_len = 0;
if(session->request->body.size>0) {
freq.body = (const char*)session->request->body.base;
freq.body_len = session->request->body.size;
}
freq.version = 1;
freq.headers_len = session->request->headers.count;
phr_header_fcp f_headers[session->request->headers.count];
for(int i=0;i<(int)session->request->headers.count;i++) {
f_headers[i].name = (const char*)session->request->headers.header[i].name.base;
f_headers[i].name_len = session->request->headers.header[i].name.size;
f_headers[i].value = (const char*)session->request->headers.header[i].value.base;
f_headers[i].value_len = session->request->headers.header[i].value.size;
}
freq.headers = f_headers;
int scode = 0;
const char* out_url;
size_t out_url_len;
const char* out_body;
size_t out_body_len;
phr_header_fcp out_headers[100];
size_t out_headers_len;
const char* smsg;
size_t smsg_len;
void* fres = ffead_cpp_handle_c_1(&freq, &scode, &smsg, &smsg_len, &out_url, &out_url_len, out_headers, &out_headers_len, &out_body, &out_body_len);
reactor_http_response response;
response.version = session->request->version;
if(scode>0) {
for(int i=0;i<(int)out_headers_len;i++) {
response.headers.header[i].name.base = (void*)out_headers[i].name;
response.headers.header[i].name.size = out_headers[i].name_len;
response.headers.header[i].value.base = (void*)out_headers[i].value;
response.headers.header[i].value.size = out_headers[i].value_len;
}
response.headers.header[out_headers_len].name = reactor_vector_string("Date");
response.headers.header[out_headers_len].value = reactor_http_message_date_1(NULL);
response.headers.header[out_headers_len+1].name = reactor_vector_string("Server");
response.headers.header[out_headers_len+1].value = reactor_vector_string("libreactor");
response.headers.count = out_headers_len+2;
response.code = scode;
response.reason.base = (void*)smsg;
response.reason.size = smsg_len;
if(out_body_len>0) {
response.body.base = (void*)out_body;
response.body.size = out_body_len;
}
reactor_server_respond(session, &response);
} else {
if(out_url_len>0 && access(out_url, F_OK) != -1 ) {
char * buffer = 0;
long length;
FILE * f = fopen (out_url, "rb");
if(f) {
fseek (f, 0, SEEK_END);
length = ftell (f);
fseek (f, 0, SEEK_SET);
buffer = malloc (length);
if (buffer)
{
fread (buffer, 1, length, f);
}
fclose (f);
char slen[10];
snprintf(slen, 9, "%ld", length);
response.body.base = (void*)buffer;
response.body.size = (size_t)length;
response.headers.header[0].name.base = (void*)"Content-Length";
response.headers.header[0].name.size = 14;
response.headers.header[0].value.base = slen;
response.headers.header[0].value.size = strlen(slen);
response.headers.header[1].name.base = (void*)out_headers[0].name;
response.headers.header[1].name.size = out_headers[0].name_len;
response.headers.header[1].value.base = (void*)out_headers[0].value;
response.headers.header[1].value.size = out_headers[0].value_len;
response.headers.header[2].name.base = (void*)out_headers[1].name;
response.headers.header[2].name.size = out_headers[1].name_len;
response.headers.header[2].value.base = (void*)out_headers[1].value;
response.headers.header[2].value.size = out_headers[1].value_len;
response.headers.header[3].name = reactor_vector_string("Date");
response.headers.header[3].value = reactor_http_message_date_1(NULL);
response.headers.header[4].name = reactor_vector_string("Server");
response.headers.header[4].value = reactor_vector_string("libreactor");
response.headers.count = 5;
response.code = 200;
response.reason.base = (void*)"OK";
response.reason.size = 2;
reactor_server_respond(session, &response);
free(buffer);
} else {
response.headers.header[0].name = reactor_vector_string("Date");
response.headers.header[0].value = reactor_http_message_date_1(NULL);
response.headers.header[1].name = reactor_vector_string("Server");
response.headers.header[1].value = reactor_vector_string("libreactor");
response.headers.count = 2;
reactor_server_not_found(session);
}
} else {
response.headers.header[0].name = reactor_vector_string("Date");
response.headers.header[0].value = reactor_http_message_date_1(NULL);
response.headers.header[1].name = reactor_vector_string("Server");
response.headers.header[1].value = reactor_vector_string("libreactor");
response.headers.count = 2;
reactor_server_not_found(session);
}
}
ffead_cpp_resp_cleanup(fres);
return REACTOR_OK;
}
int main(int argc, char *argv[])
{
if(argc < 3)
{
//cout << "No Server root directory specified, quitting..." << std::endl;
return 0;
}
printf("Bootstrapping ffead-cpp start...\n");
ffead_cpp_bootstrap(argv[1], strlen(argv[1]), 7);
printf("Bootstrapping ffead-cpp end...\n");
printf("Initializing ffead-cpp start...\n");
ffead_cpp_init();
printf("Initializing ffead-cpp end...\n");
reactor_server server;
setup();
reactor_construct();
reactor_server_construct(&server, NULL, NULL);
reactor_server_route(&server, handle, NULL);
(void) reactor_server_open(&server, "0.0.0.0", argv[2]);
printf("libreactor listening on port %s\n", argv[2]);
reactor_run();
reactor_destruct();
printf("Cleaning up ffead-cpp start...\n");
ffead_cpp_cleanup();
printf("Cleaning up ffead-cpp end...\n");
}
|
74b0c351be33e658b9bacf09984c4d2ed0fd3b52
|
3e8fbb570f7acb21de7d6ac250a6b11f126c3c90
|
/src/dsu/lib/dsulib.c
|
28850446c643196d3a31bc1c7b846acc447a6690
|
[
"LicenseRef-scancode-other-permissive"
] |
permissive
|
JohnWStockwellJr/SeisUnix
|
0868431b0ac2f463d858920e6fd72493817e9659
|
c222c39a2e1040ddf7a789c15276df1e7e520f5a
|
refs/heads/master
| 2023-09-04T13:13:39.535821
| 2023-08-31T03:07:11
| 2023-08-31T03:07:11
| 53,870,336
| 250
| 134
|
NOASSERTION
| 2023-08-31T02:52:20
| 2016-03-14T15:57:55
|
C
|
UTF-8
|
C
| false
| false
| 11,239
|
c
|
dsulib.c
|
/*
* dsulib.c
*
* 10 Oct 1994 Murillo: c
* Modified: 23 Feb 1995. A. Murillo
* Modified: 02 Nov 1995. A. Murillo
*/
#include "su.h"
#include "dsulib.h"
char *copy_str1( str )
char *str;
{
char *tmp;
tmp = (char *) malloc( (unsigned) (strlen(str) + 1)
* sizeof(char) );
if ( tmp == NULL )
{
fprintf( stderr, "\nError Allocating Memory in copy_str1\n");
return(NULL);
}
strcpy( tmp, str );
return( tmp );
}
int InitLog(DsuTask *node, char * name)
{
int INFO;
node -> fp_log = 0;
node -> DEBUG = 0;
node -> apl_name = name;
node -> machine = 0;
INFO = StartLog(node);
/*
Send back the log filename (set up in StartLog). 9/19/95
*/
SendStr(node -> log_file, pvm_parent(), MsgFile);
return(INFO);
} /* End of InitLog */
int CleanLog()
{
char command[512], *hd;
char *getenv();
/* Clean DSU log directory */
if ( !(hd = (char *)getenv("DSULOG")) ) {
hd = "/tmp"; /* Default value */
fprintf(stderr, "Warning: Variable DSULOG has not been set\n");
fprintf(stderr, "Warning: Using /tmp as log directory !! \n");
}
sprintf(command, "rm -rf %s/DSU*\0", hd);
system(command);
} /* end of CleanLog() */
int StartLog(DsuTask *node)
{
char log_file[256], myhost[256];
char *hd, *s1;
char *getenv();
if ((node -> NodeTid = pvm_mytid()) < 0) {
pvm_perror("Error enrolling");
return(-1);
}
/* Get host info */
(void) gethostname(myhost, sizeof(myhost));
node -> machine = (char *)malloc(strlen(myhost));
strcpy(node -> machine, myhost);
/* Open the log file */
if ( !(hd = (char *)getenv("DSULOG")) ) {
hd = "/tmp"; /* Default value */
fprintf(stderr, "Warning: Variable DSULOG has not been set\n");
}
if ( (s1 = strrchr(node -> apl_name, '/') ) == NULL)
s1 = node -> apl_name;
else
s1 = s1++;
/*
sprintf(log_file, "%s/DSU%s%d%s\0", hd, myhost, node -> NodeTid, s1);
*/
sprintf(log_file, "%s/DSU%d%s\0", hd, node -> NodeTid, s1);
node -> log_file = copy_str1(log_file);
/*
fprintf(stderr, "Opening: %s\n", log_file); fflush(stderr);
*/
if ( (node -> fp_log = freopen(log_file,"w", stderr)) == NULL) {
fprintf(stderr, "Error opening the log file: %s\n", log_file);
pvm_exit();
return(-1);
}
/* Redirect stderr to the above file */
/* close(2);
dup(node -> fd_log); */
/* Writea header in the log file */
fprintf(stderr, "%s\n", node -> apl_name);
fprintf(stderr,
"\tFile\t--> %s\n\tapl-tid\t--> %d\n\tMachine\t--> %s \n",
log_file, node -> NodeTid, node -> machine);
fflush(stderr);
return(0);
} /* end of StartLog() */
void MsgLog(DsuTask *node, char *msg)
{
fprintf(node -> fp_log, msg);
fflush(node -> fp_log);
}
void PrintInfoLog(DsuTask *zz) {
fprintf(zz -> fp_log, "\nProcess --> %s\n", zz -> apl_name);
fprintf(zz -> fp_log, "\tMachine %s\n", zz -> machine);
fprintf(zz -> fp_log, "\tapl_id <%d>\n", zz -> NodeTid);
fprintf(zz -> fp_log, "\n");
fflush(zz -> fp_log);
} /* End of PrintInfoLog */
/*
PVM functions
*/
int DsuExit( DsuTask *ThisDsuTask, int stat)
{
int tmp;
int i;
tmp = stat;
/* Send End of Data message to childrem */
for (i = 0; i < MAX_LINK; i++)
if (ThisDsuTask -> branch_tid[i] > 0)
SendInt(&tmp, 1, ThisDsuTask -> branch_tid[i], MsgHdrSize);
/* Notify completion to the GUI */
SendInt(&tmp, 1, pvm_parent(), stat);
fprintf(stderr, "End of application <%s>. Status (%d)\n",
ThisDsuTask -> apl_name, stat);
fclose (stderr);
pvm_exit();
return 0;
}
/*
int ParentAlive(int tid)
{
if (pvm_pstat(tid) == PvmNoTask) return (-1);
return 0;
}
*/
int SendBytes(void * buff, int n, int tid, int MsgType)
{
int info;
/* info = pvm_initsend(PvmDataDefault); */
info = pvm_initsend(PvmDataInPlace);
if ( info >= 0 ) {
pvm_pkbyte((void *)buff, n, 1);
pvm_send(tid, MsgType);
}
return(info);
}
int SendBBytes(void * buff, int n, int tid, int MsgType)
{
int info;
pvm_psend(tid, MsgType, buff, n, PVM_BYTE);
return(info);
}
void * RecvBytes(int tid, int MsgType)
{
int info, BufId, MsgLen, MsgTag, SenderTid;
void *s1;
BufId = pvm_recv(tid, MsgType);
info = pvm_bufinfo( BufId, &MsgLen, &MsgTag, &SenderTid);
s1 = (void *)malloc(MsgLen);
pvm_upkbyte(s1, MsgLen, 1);
return(s1);
}
int RecvBBytes(void *buf, int n, int tid, int MsgType)
{
int info, BufId, MsgLen, MsgTag, SenderTid;
pvm_precv(tid, MsgType, buf, n, PVM_BYTE, &SenderTid,
&MsgTag, &MsgLen);
/*
BufId = pvm_recv(tid, MsgType);
info = pvm_bufinfo( BufId, &NBytes, &MsgTag, &MasterTid);
pvm_upkbyte((void *)buf, n, 1);
*/
}
int BroadBytes(void * str, int size, int tid[], int ntid, int MsgType)
{
int info;
info = pvm_initsend(PvmDataRaw);
if ( info >= 0 ) {
pvm_pkbyte((char *)str, size, 1);
pvm_mcast(tid, ntid, MsgType);
}
return(info);
}
int SendStr(char * str, int tid, int MsgType)
{
int info;
info = pvm_initsend(PvmDataDefault);
if ( info >= 0 ) {
pvm_pkstr(str);
pvm_send(tid, MsgType);
}
return(info);
}
char * RecvStr(int tid, int MsgType)
{
int info, BufId, NBytes, MsgTag, MasterTid;
char *s1, tmp_char[512];
BufId = pvm_recv(tid, MsgType);
/* info = pvm_bufinfo( BufId, &NBytes, &MsgTag, &MasterTid); */
pvm_upkstr(tmp_char);
return(copy_str1(tmp_char));
/* AEM 9/19/95
s1 = (char *)malloc(strlen(tmp_char)+1);
strcpy(s1, tmp_char);
return(s1);
*/
}
int BroadInt(int IntBuf[], int n, int tid[], int ntid, int MsgType)
{
int info;
info = pvm_initsend(PvmDataDefault);
if ( info >= 0 ) {
pvm_pkint(IntBuf, n, 1);
pvm_mcast(tid, ntid, MsgType);
}
return(info);
}
int SendInt(int *IntBuf, int n, int tid, int MsgType)
{
int info;
info = pvm_initsend(PvmDataDefault);
if ( info >= 0 ) {
pvm_pkint(IntBuf, n, 1);
pvm_send(tid, MsgType);
}
return(info);
}
int RecvInt(int *IntBuf, int n, int tid, int MsgType)
{
int info, BufId, NBytes, MsgTag, SenderTid;
BufId = pvm_recv(-1, MsgType);
info = pvm_bufinfo( BufId, &NBytes, &MsgTag, &SenderTid);
pvm_upkint(IntBuf, n, 1);
return(SenderTid);
}
/*
Names switched to check if parent is alive (03/18/95)
*/
int RecvOneInt(int tid, int MsgType)
{
int info, BufId, NBytes, MsgTag, SenderTid;
int IntBuf;
/*
while ( 1) {
if ( (BufId = pvm_nrecv(tid, MsgType)) > 0 ) break;
if (pvm_pstat(tid) == PvmNoTask)
if ( (BufId = pvm_nrecv(tid, MsgType)) > 0 )
break;
else
return(0);
}
*/
BufId = pvm_recv(tid, MsgType);
/*
info = pvm_bufinfo( BufId, &NBytes, &MsgTag, &SenderTid);
*/
pvm_upkint(&IntBuf, 1, 1);
return(IntBuf);
}
int RecvOneIntNB(int tid, int MsgType)
{
int info, BufId, NBytes, MsgTag, SenderTid;
int IntBuf;
BufId = pvm_recv(-1, MsgType);
info = pvm_bufinfo( BufId, &NBytes, &MsgTag, &SenderTid);
pvm_upkint(&IntBuf, 1, 1);
return(IntBuf);
}
int BroadFI(float *FloatBuf, int nf, int *IntBuf, int ni,
int tid[], int ntid, int MsgType)
{
int i, info;
info = pvm_initsend(PvmDataDefault);
pvm_pkint(IntBuf, ni, 1);
pvm_pkbyte((char *)FloatBuf, nf*sizeof(float), 1);
pvm_mcast(tid, ntid, MsgType);
return(info);
}
int BroadFloat(float *FloatBuf, int n, int tid[], int ntid, int MsgType)
{
int info;
info = pvm_initsend(PvmDataDefault);
pvm_pkbyte((char *)FloatBuf, n*sizeof(float), 1);
pvm_mcast(tid, ntid, MsgType);
return(info);
}
int SendFloat(float *FloatBuf, int n, int tid, int MsgType)
{
int info;
pvm_psend(tid, MsgType, FloatBuf, n, PVM_FLOAT);
/* 3/15/96
info = pvm_initsend(PvmDataDefault);
pvm_pkbyte((char *)FloatBuf, n*sizeof(float), 1);
pvm_send(tid, MsgType);
return(info);
*/
return(0);
}
int RecvFloat(float *FloatBuf, int n, int tid, int MsgType)
{
int info, BufId, MsgLen, MsgTag, SenderTid;
pvm_precv(tid, MsgType, FloatBuf, n, PVM_FLOAT, &SenderTid,
&MsgTag, &MsgLen);
/* 3/15/96
BufId = pvm_recv(tid, MsgType);
info = pvm_bufinfo( BufId, &MsgLen, &MsgTag, &SenderTid);
pvm_upkbyte((char *)FloatBuf, n*sizeof(float), 1);
*/
return(SenderTid);
}
int SendCplx(complex *CplxBuf, int n, int tid, int MsgType)
{
int info;
info = pvm_initsend(PvmDataDefault);
pvm_pkbyte((char *)CplxBuf, n*sizeof(complex), 1);
pvm_send(tid, MsgType);
return(info);
}
int RecvCplx(complex *CplxBuf, int n, int tid, int MsgType)
{
int info, BufId, NBytes, MsgTag, SenderTid;
BufId = pvm_recv(-1, MsgType);
info = pvm_bufinfo( BufId, &NBytes, &MsgTag, &SenderTid);
pvm_upkbyte((char *)CplxBuf, n*sizeof(complex), 1);
return(SenderTid);
/* return(info); ADDED FOR WENECES CODE 4/21/96 */
}
int SendFI(float *FloatBuf, int nf, int *IntBuf, int ni, int tid, int MsgType)
{
int info;
info = pvm_initsend(PvmDataDefault);
pvm_pkint(IntBuf, ni, 1);
pvm_pkbyte((char *)FloatBuf, nf*sizeof(float), 1);
pvm_send(tid, MsgType);
return(info);
}
int RecvFI(float *FloatBuf, int nf, int *IntBuf, int ni, int tid, int MsgType)
{
int info, BufId, NBytes, MsgTag, SenderTid;
BufId = pvm_recv(-1, MsgType);
info = pvm_bufinfo( BufId, &NBytes, &MsgTag, &SenderTid);
pvm_upkint(IntBuf, ni, 1);
pvm_upkbyte((char *)FloatBuf, nf*sizeof(float), 1);
return(SenderTid);
}
int CreateSlaves1(int **SeisSlaves, char *SlaveName, int px, int py)
{
int info, i, j;
/*
int **SeisSlaves;
if ( (SeisSlaves = alloc2int(py,px) ) == NULL) {
fprintf(stderr, "Out of memory (creating processes)\n");
return(NULL);
}
*/
/*
for (i = 0; i < px; i++)
for (j = 0; j < py; j++) {
*/
info = pvm_spawn(SlaveName, (char **)0, 0,
(char *)0, px*py, SeisSlaves[0]);
if (info != px*py) {
fprintf(stderr, "Error starting pvm applications %s \n", SlaveName);
return(-1);
}
return(0);
} /* End of CreateSlaves */
int CreatePipe(int *SeisSlaves, char *SlaveName, int n)
{
int info, i;
int CntlInfo[2];
info = pvm_spawn(SlaveName, (char **)0, 0,
(char *)0, n, SeisSlaves);
if (info != n) {
fprintf(stderr,"\n\tError starting pvm applications: %s \n", SlaveName);
return(-1);
}
/* Setup the pipeline */
for (i = 0; i < n; ++i) {
CntlInfo[0] = i;
if (i != (n - 1)) CntlInfo[1] = SeisSlaves[i+1];
SendInt(CntlInfo, 2, SeisSlaves[i], MsgCntl);
}
return(0);
}
int CreateBin(int *SeisSlaves, char *SlaveName, int n)
{
int info, i;
int CntlInfo[2];
info = pvm_spawn(SlaveName, (char **)0, 0,
(char *)0, n, SeisSlaves);
if (info != n) {
fprintf(stderr,"\n\tError starting pvm applications: %s \n", SlaveName);
return(-1);
}
/* Send virtual ID to all of them */
for (i = 0; i < n; ++i) {
CntlInfo[0] = i;
CntlInfo[1] = n; /* Can be outside */
SendInt(CntlInfo, 2, SeisSlaves[i], MsgCntl);
SendInt(SeisSlaves, n, SeisSlaves[i], MsgCntl);
}
return(0);
}
int DsuSpawn(int *SeisSlaves, char *SlaveName, int pn)
{
int info;
info = pvm_spawn(SlaveName, (char **)0, 0,
(char *)0, pn, SeisSlaves);
if (info != pn) {
fprintf(stderr, "Error starting pvm applications %s \n", SlaveName);
return(-1);
}
return(pn);
} /* End of CreateSlaves */
|
c65a5c46dd711951fcda41e40a53f5c0ba398095
|
883bba35d3074b1836efe5f96e2682e2ae2d8cae
|
/UniversalWindowsPlatformSamples/CSharpProjectExample/bin/Il2CppOutputProject/IL2CPP/external/baselib/Platforms/WebGL/Include/C/Baselib_ThreadLocalStorage.inl.h
|
cdc1bf12bb996bc6df62598f171b629dbf611411
|
[
"MIT"
] |
permissive
|
Unity-Technologies/DesktopSamples
|
3dabe5cbafae64479d87c3ed993630f6a755e3a2
|
835e350c2517ddd65302159053447f35ad50666e
|
refs/heads/master
| 2023-07-18T19:45:01.327055
| 2022-03-04T00:42:41
| 2022-03-04T00:42:41
| 218,365,346
| 200
| 84
|
MIT
| 2020-02-12T01:05:53
| 2019-10-29T19:17:52
|
C++
|
UTF-8
|
C
| false
| false
| 2,303
|
h
|
Baselib_ThreadLocalStorage.inl.h
|
#pragma once
#if defined(__EMSCRIPTEN_PTHREADS__)
#include <pthread.h>
#include <libc/limits.h>
// Emscripten has a bug in its pthread thread-local implementation:
// Newly created values are not guaranteed to be zero.
// We work around this by introducing a generation counter.
// https://github.com/emscripten-core/emscripten/issues/8740
// Note that C++11 thread_local does not work at all.
// https://github.com/emscripten-core/emscripten/issues/3502
#ifdef __cplusplus
BASELIB_C_INTERFACE
{
#endif
BASELIB_API void* Baselib_Memory_Allocate(size_t size);
// Note that we use static data here in the expectation that webgl builds never use dynamic libraries
extern int32_t Baselib_Internal_Emscripten_TLS_SlotGenerations[PTHREAD_KEYS_MAX];
#ifdef __cplusplus
} // BASELIB_C_INTERFACE
#endif
#ifdef __cplusplus
BASELIB_C_INTERFACE
{
#endif
typedef struct Baselib_Internal_Emscripten_TLS_Slot
{
uintptr_t data;
int32_t generation;
} Baselib_Internal_Emscripten_TLS_Slot;
BASELIB_FORCEINLINE_API void Baselib_TLS_Set(Baselib_TLS_Handle handle, uintptr_t value)
{
Baselib_Internal_Emscripten_TLS_Slot* slot = (Baselib_Internal_Emscripten_TLS_Slot*)(pthread_getspecific((pthread_key_t)handle));
if (!slot)
{
slot = (Baselib_Internal_Emscripten_TLS_Slot*)(Baselib_Memory_Allocate(sizeof(Baselib_Internal_Emscripten_TLS_Slot)));
pthread_setspecific(handle, slot);
}
slot->data = value;
slot->generation = Baselib_Internal_Emscripten_TLS_SlotGenerations[handle];
}
BASELIB_FORCEINLINE_API uintptr_t Baselib_TLS_Get(Baselib_TLS_Handle handle)
{
Baselib_Internal_Emscripten_TLS_Slot* slot = (Baselib_Internal_Emscripten_TLS_Slot*)(pthread_getspecific((pthread_key_t)handle));
if (!slot)
return 0;
if (slot->generation != Baselib_Internal_Emscripten_TLS_SlotGenerations[handle])
return 0;
return slot->data;
}
#ifdef __cplusplus
} // BASELIB_C_INTERFACE
#endif
#else
#ifdef __cplusplus
BASELIB_C_INTERFACE
{
#endif
BASELIB_FORCEINLINE_API void Baselib_TLS_Set(Baselib_TLS_Handle handle, uintptr_t value)
{
*(uintptr_t*)handle = value;
}
BASELIB_FORCEINLINE_API uintptr_t Baselib_TLS_Get(Baselib_TLS_Handle handle)
{
return *(uintptr_t*)handle;
}
#ifdef __cplusplus
} // BASELIB_C_INTERFACE
#endif
#endif
|
65f9a3e4a8ab7b5438203904ebc5ecaf07af8843
|
9fc57e3b4077836826a41feb404848ad7d053e23
|
/myc/src/c.h
|
f0cb30c8ea7dcd3ae6f80c8e7ca664fb4650e1d9
|
[] |
no_license
|
sheisc/ucc162.3
|
56195e3b439620abac4013e2af32b4c46697203c
|
10658ca08af36aee9737b6087df27fda580e2c75
|
refs/heads/master
| 2023-02-22T23:59:47.056869
| 2023-02-10T15:13:58
| 2023-02-10T15:13:58
| 75,374,027
| 396
| 162
| null | 2021-05-10T05:00:24
| 2016-12-02T07:57:38
|
C
|
GB18030
|
C
| false
| false
| 6,182
|
h
|
c.h
|
#ifndef C_H
#define C_H
/////////////////////////////////////////////////////////////
#define CtrlInfoSize 3 //活动记录的控制信息的大小,
//包括:返回地址、上层活动记录的相对地址,返回值
#define MaxGSize 1024 //全局符号表最大长度
#define MaxLSize 1024 //局部符号表最大长度
#define DsSize 65536 //数据区大小
#define CsSize 65536 //代码区大小
#define MaxIdLen 20 //标志符的最大长度
#define KeyWordsCount 7 //语言关键字个数
#define HaltingPC -1 //若程序计数器值为-1,则停机
/////////////////////////////////////////////////////////////
//四元式
typedef struct {
int optr; //运算符
int arg1; //左操作数的地址
int arg2; //右操作数的地址
int result; //存放结果的地址
}Instruction;
//表达式 (采用C的风格,非0为真,0为假)
typedef struct {
int truelist; //真出口链
int falselist; //假出口链
int address; //存放表达式值的地址或常量的值
//若为负数,则存放全局变量的地址
//若为正数,则为局部变量的相对地址
bool isTemp; //是否为临时变量
}ExprNode;
//符号表表项
typedef struct {
int type; //类型 FUN 或 VAR
int address; //地址 全局为非正 局部为正
char lexeme[MaxIdLen+1]; //词素,变量名或函数名
int paramCount; //函数的参数个数
}SymbolEntry;
//符号表
struct SymbolTable{
SymbolEntry * entries; //各表项
int index; //符号表当前表尾的下标,表中第0项不用
};
//虚拟机指令集
enum InstrType{
InsJtrue, //为真则跳转 (InsJtrue, arg1, , dest)
InsJfalse, //为假则跳转 (InsJfalse,arg1, , dest)
InsJmp, //无条件跳转 (InsJmp, , , dest)
InsMov, //数据复制 (InsMov, arg1, ,dest)
InsInit, //初始化某单元 (InsInit,arg1,num, )
InsAdd, //加法 (InsAdd, arg1,arg2,dest)
InsSub, //减法 (InsSub, arg1,arg2,dest)
InsMul, //乘法 (InsMul, arg1,arg2,dest)
InsDiv, //除法 (InsDiv, arg1,arg2,dest)
InsMod, //取余
InsNop, //空操作 (InsNop, , , )
InsJlt, //判断是否< (InsLt,arg1,arg2,result)
InsJle, //判断是否<= (InsLe,arg1,arg2,result)
InsJgt, //判断是否> (InsGt,arg1,arg2,result)
InsJge, //判断是否>=
InsJeq, //判断是否==
InsJne, //判断是否!=
InsOr, //逻辑或运算
InsAnd, //逻辑与运算
InsNot, //逻辑非运算
InsIn, //读入一个整数到单元dest (InsIn,dest , ,);
InsOut, //输出一个整数 (InsOut,num, ,);
InsUminus, //负数 (InsUminus,oprn, ,dest)
InsCall, //过程调用 (InsCall,des, , ,);
InsRet, //过程返回 (InsRet,expr, , );
InsSetBx, //设置bx指针,指向活动记录首地址(InsSetBx,addr, , )
InsAddBx, //bx指针增加 (InsSetBx,addr);
};
//记号类型
enum SymType
{
OR , //或
AND, //与
RELOP, //关系运算符
ADDOP, //加减
MULOP, //乘除
NOT, //非
LP, //左括号
RP, //右括号
ID, //标志符
NUM, //数
ASSIGN, //赋值
LB, //左大括号
RB, //右大括号
COMMA, //逗号
SEMICOLON, //分号
UNDEFINED, //未定义
INT, //int
IF, //if
ELSE, //else
WHILE, //while
RETURN, //return
PRINTF, //printf
SCANF, //scanf
};
//
enum AddOp{
ADD, //加法
SUB //减法
};
//
enum MulOp{
MUL, //乘法
DIV, //除法
MOD, //取余
};
//标识符类型
enum IdType{
FUN, //函数
VAR //变量
};
//关系运算符类型
enum RelType{
GT, //大于 >
GE, //大于等于 >=
EQ, //等于 ==
LT, //小于 <
LE, //小于等于 <=
NE, //不等于 !=
NR //没有关系 用于优先关系表
};
//查找结果
struct SearchingResult{
int index; //在符号表中第几项 用0表示未找到
int tableType; //符号表的类型
int address; //找到的地址
};
//符号表类型
enum TableType{
GLOBAL,
LOCAL,
};
/////////////////////////////////////////////////////////////
extern int errorCount;
extern int ds[DsSize]; //数据段
extern Instruction cs[CsSize]; //代码段
extern int csIndex; //代码段下标 0号预留给跳转到main的指令
//extern int dsIndex; //数据段下标
extern FILE * infile; //输入文件
extern FILE * outfile; //输出文件
extern SymbolTable globalTable; //全局符号表
extern SymbolTable localTable; //局部符号表
extern char * instrs[];
extern int token; //当前记号(的类型)
extern int value; //当前记号的值
extern char id[MaxIdLen+1]; //当前符号串
extern int lineNumber; //当前行号
extern char * types[];
extern FILE * infile; //输入文件
/////////////////////////////////////////////////////////////////////
bool isExpressionStarting(int tok); //tok是否为表达式开始记号
void interpret(); //解释执行中间代码
int getGlobalMemSize();
void callExpr(char * func);
void setActiveTop(int top);
bool isStatementStarting(int tok);
SearchingResult mixingSearch(int idType,char * lexeme);
bool isGlobalState();
int getActiveTop();
void getToken();
int newtemp();
void freeTemp();
void syntaxError(char * info);
void gen(int instrType, int arg1,int arg2,int result); //产生一条四元式
void programBody(); //程序体
void varDeclare(); //变量声明列表
void funcBody(); //函数体
int paramDeclare(); //函数参数声明
int statement(); //语句
bool isCondition(ExprNode * node);
void decrementTopIfTemp(ExprNode * node);
void setExprNode(ExprNode * node, int tlist,int flist,int addr, bool isTemp);
int mergeList(int list1, int list2); //合并链表
void backpatch(int list, int cx); //回填链表
void changeConditionToArith(ExprNode * node);
void changeArithToCondition(ExprNode * node);
ExprNode expression(); //表达式
int enter(SymbolTable * table,int idType,char * lexeme);
int lookup(SymbolTable * table,int idType,char * lexeme);
////////////////////////////////////////////////////////////////////
#endif
|
ac6796263b19d234eba45ae36b63f8f578d10e2e
|
65c2c8cfebc4a8142cca21d941b1624a3c8d9990
|
/Pods/Headers/Private/MaterialControls/MDLinearProgressLayer.h
|
242d54a686841a1f4ef237b84f7f660553da3bd4
|
[
"Apache-2.0"
] |
permissive
|
czhen09/ZXKline
|
5ebf3421ef8db19db1714efbfd1db4bd377eaf44
|
0436a9371f04ba4a6adf379e9c085b1db4092987
|
refs/heads/master
| 2021-09-15T09:50:21.053279
| 2018-05-30T08:31:20
| 2018-05-30T08:31:20
| 108,262,630
| 232
| 59
| null | null | null | null |
UTF-8
|
C
| false
| false
| 83
|
h
|
MDLinearProgressLayer.h
|
../../../MaterialControls/MaterialControls/MaterialControls/MDLinearProgressLayer.h
|
1a524d3c499318a6d8f94a4fbe234b4c4a095e09
|
f42190636add23ead6a5022d706a124032d66f92
|
/src/Microsoft.DotNet.Wpf/src/PenImc/inc/peninc.h
|
c9ce0f799684d51f2a778d8e986368f59f42b86b
|
[
"MIT"
] |
permissive
|
dotnet/wpf
|
b8f73a99e03f87b4dee5db643e38e2c0704f707a
|
2ff355a607d79eef5fea7796de1f29cf9ea4fbed
|
refs/heads/main
| 2023-09-04T09:35:19.355384
| 2023-09-03T02:30:37
| 2023-09-03T02:30:37
| 153,711,945
| 6,927
| 1,397
|
MIT
| 2023-09-14T17:22:06
| 2018-10-19T01:55:23
|
C#
|
UTF-8
|
C
| false
| false
| 3,647
|
h
|
peninc.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#ifndef __PENINC_H_
#define __PENINC_H_
#define STRSAFE_NO_DEPRECATE
#include <strsafe.h>
#include <tabinc.h>
///////////////////////////////////////////////////////////////////////////////
#define MIN_SPACE64_X 0
#define MIN_SPACE64_Y 0
#define MAX_SPACE64_X 65535
#define MAX_SPACE64_Y 65535
///////////////////////////////////////////////////////////////////////////////
typedef unsigned (__stdcall *PTHREAD_START) (void *);
#define chBEGINTHREADEX(lpsa, cbStack, lpStartAddr, \
lpvThreadParm, fdwCreate, lpIDThread) \
((HANDLE)_beginthreadex( \
(void *) (lpsa), \
(unsigned) (cbStack), \
(PTHREAD_START) (lpStartAddr), \
(void *) (lpvThreadParm), \
(unsigned) (fdwCreate), \
(unsigned *) (lpIDThread)))
///////////////////////////////////////////////////////////////////////////////
#define MICROSOFT_TABLETPENSERVICE_PROPERTY _T("MicrosoftTabletPenServiceProperty")
#define WISPTIS_PRESS_AND_HOLD_DISABLE_MASK 0x01
#define WISPTIS_SYSTEM_GESTURE_WM_DISABLE_MASK 0x02
#define WISPTIS_FLICK_LEARNING_MODE_MASK 0x04
#define PENPROCESS_COMMANDLINE _T("/ProcessActivate:%p;%p; /ProcessDeActivate:%p;%p; /EndSessionInfo:%p;%p;")
#define PENPROCESS_ACTIVATEINFO _T("/ProcessActivate:")
#define PENPROCESS_DEACTIVATEINFO _T("/ProcessDeActivate:")
#define PENPROCESS_ENDSESSIONINFO _T("/EndSessionInfo:")
#define PENPROCESS_PATH _T("\\SYSTEM32\\WISPTIS.EXE")
#define WISPTIS_WITHNOINTEGRATEDDEVICE _T("/EndSessionInfo:%p;%p;")
#define WISPTIS_ENDSESSIONINFO _T("/EndSessionInfo:")
#define WISPTIS_DEBUGGING _T("/Debugging")
#define WISPTIS_DEBUGGING _T("/Debugging")
/////////////////////////////////////////////////////////////////////////////
//
// HR etc helpers
//
#define DHR \
HRESULT hr = S_OK;
#define RHR \
return hr;
#define CHR(hr_op) \
{ \
hr = hr_op; \
if (FAILED(hr)) \
goto CLEANUP; \
}
#define CHR_VERIFY(hr_op) \
{ \
CHR(hr_op); \
ASSERT (SUCCEEDED(hr)); \
}
#define CHR_MEMALLOC(pv_op) \
{ \
CHR((pv_op) != NULL ? S_OK : E_OUTOFMEMORY); \
}
#define CHR_WIN32(bool_or_handle_op) \
{ \
CHR((bool_or_handle_op) ? \
S_OK : \
HRESULT_FROM_WIN32(GetLastError())); \
}
// Shared by Wisptis and PenImc
#define WISPTIS_SM_MORE_DATA_EVENT_NAME _T("wisptis-1-%d-%u")
#define WISPTIS_SM_MUTEX_NAME _T("wisptis-2-%d-%u")
#define WISPTIS_SM_SECTION_NAME _T("wisptis-3-%d-%u")
#define WISPTIS_SM_THREAD_EVENT_NAME _T("wisptis-4-%u")
#endif // __PENINC_H_
|
399d44a1d5c063a56d18806573162a82b5f08729
|
7df190df28da7e4ff166e55dc8ce780f11236a9f
|
/src/router/services/networking/generic/iptable.c
|
d16ac3dfe27adc82b35c2590ee75d573d2496254
|
[] |
no_license
|
mirror/dd-wrt
|
25416946e6132aa54b35809de61834a1825a9a36
|
8f2934a5a2adfbb59b471375aa3a38de5d036531
|
refs/heads/master
| 2023-08-31T14:54:47.496685
| 2023-08-30T17:40:54
| 2023-08-30T17:40:54
| 7,470,282
| 520
| 281
| null | 2023-05-29T20:56:24
| 2013-01-06T17:21:29
| null |
UTF-8
|
C
| false
| false
| 5,116
|
c
|
iptable.c
|
/*
* iptable.c
*
* Copyright (C) 2007 Sebastian Gottschall <s.gottschall@dd-wrt.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id:
*/
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#include <shutils.h>
#ifndef cprintf
#define cprintf(fmt,...);
#endif
#define sameaddr(sin, ein) *((unsigned int *)sin)==*((unsigned int*)ein)
void getse(unsigned char *ip, unsigned char *nets, unsigned char *nete, int bitlen)
{
int i, j, len, remain;
unsigned char mask;
len = bitlen / 8;
remain = bitlen % 8;
for (i = 0; i < len; i++)
nets[i] = nete[i] = ip[i];
nets[i] = 0;
nete[i] = 0;
for (j = 0; j < 8; j++) {
mask = 0x80 >> j;
if (j < remain) {
if (mask & ip[i]) {
nets[i] |= mask;
nete[i] |= mask;
}
} else
nete[i] |= mask;
}
i++;
for (; i < 4; i++) {
nets[i] = 0x00;
nete[i] = 0xff;
}
}
int count_bits(unsigned char *sin, unsigned char *ein)
// return the same bits count from beginning
{
int i, j, sbit, ebit;
int len = 0;
unsigned char mask;
for (i = 0; i < 4; i++) {
if (sin[i] == ein[i])
len += 8;
else {
mask = 0x80;
for (j = 0; j < 8; j++) {
sbit = (mask & sin[i]);
ebit = (mask & ein[i]);
if (sbit == ebit)
len++;
else
break;
mask >>= 1;
}
break;
}
}
return len;
}
static void subrange(unsigned char *sin, unsigned char *ein, char *range_buf, size_t len)
// recursive function to divide ip range
{
unsigned char nets[4], nete[4];
int bitlen, nextlen;
bitlen = count_bits(sin, ein);
if (bitlen == 32) {
snprintf(range_buf + strlen(range_buf), len - strlen(range_buf), "%u.%u.%u.%u/32 ", sin[0], sin[1], sin[2], sin[3]);
cprintf("%u.%u.%u.%u/32\n", sin[0], sin[1], sin[2], sin[3]);
return;
} else if (bitlen == 31) {
snprintf(range_buf + strlen(range_buf), len - strlen(range_buf), "%u.%u.%u.%u/31 ", sin[0], sin[1], sin[2], sin[3]);
cprintf("%u.%u.%u.%u/31\n", sin[0], sin[1], sin[2], sin[3]);
return;
}
nextlen = bitlen + 1;
getse(sin, nets, nete, bitlen);
if (sameaddr(sin, nets) && sameaddr(ein, nete)) {
snprintf(range_buf + strlen(range_buf), len - strlen(range_buf), "%u.%u.%u.%u/%d ", nets[0], nets[1], nets[2], nets[3], bitlen);
cprintf("%u.%u.%u.%u/%d\n", nets[0], nets[1], nets[2], nets[3], bitlen);
return;
}
getse(sin, nets, nete, nextlen);
if (sameaddr(sin, nete)) {
snprintf(range_buf + strlen(range_buf), len - strlen(range_buf), "%u.%u.%u.%u/32 ", sin[0], sin[1], sin[2], sin[3]);
cprintf("%u.%u.%u.%u/32\n", sin[0], sin[1], sin[2], sin[3]);
} else if (sameaddr(sin, nets)) {
snprintf(range_buf + strlen(range_buf), len - strlen(range_buf), "%u.%u.%u.%u/%d ", nets[0], nets[1], nets[2], nets[3], nextlen);
cprintf("%u.%u.%u.%u/%d\n", nets[0], nets[1], nets[2], nets[3], nextlen);
} else // continue check
subrange(sin, nete, range_buf,len);
getse(ein, nets, nete, nextlen);
if (sameaddr(ein, nets)) {
snprintf(range_buf + strlen(range_buf), len - strlen(range_buf), "%u.%u.%u.%u/32 ", ein[0], ein[1], ein[2], ein[3]);
cprintf("%u.%u.%u.%u/32\n", ein[0], ein[1], ein[2], ein[3]);
} else if (sameaddr(ein, nete)) {
snprintf(range_buf + strlen(range_buf), len - strlen(range_buf), "%u.%u.%u.%u/%d ", nets[0], nets[1], nets[2], nets[3], nextlen);
cprintf("%u.%u.%u.%u/%d\n", nets[0], nets[1], nets[2], nets[3], nextlen);
} else // continue check
subrange(nets, ein, range_buf, len);
}
char *range(char *start, char *end, char *range_buf,size_t len)
{
unsigned char startipc[4], endipc[4];
unsigned int startip[4], endip[4];
int retcount = 0;
int i;
cprintf("start=[%s] end=[%s]\n", start, end);
bzero(range_buf, 1024);
retcount = sscanf(start, "%u.%u.%u.%u", &startip[0], &startip[1], &startip[2], &startip[3]);
retcount += sscanf(end, "%u.%u.%u.%u", &endip[0], &endip[1], &endip[2], &endip[3]);
if (retcount != 8) {
printf("Error ip address!\n");
}
for (i = 0; i < 4; i++) {
if ((startip[i] > 255) || (endip[i] > 255)
|| (startip[i] > endip[i])) {
printf("Out of range!\n");
}
startipc[i] = (unsigned char)startip[i];
endipc[i] = (unsigned char)endip[i];
}
subrange(startipc, endipc, range_buf,len);
cprintf("range_buf=[%s]\n", range_buf);
return (char *)range_buf;
}
#ifdef DEBUG_IPTABLE
int main(int argc, char *argv[])
{
char tmp[1024];
char *sub;
char var[500], *next;
sub = range("192.168.1.1", "192.169.2.100", tmp);
printf("%s\n", sub);
}
#endif
|
0b28ed6d150d9df9cdf4658f17f2b83ccafb0da7
|
7f6c235b0598353549959c18f69eefd20b766907
|
/include/features.h
|
ce73f8573b1e855a94410fb646db707c04da32f6
|
[
"ClArtistic"
] |
permissive
|
z88dk/z88dk
|
46dfd4905f36d99333173cadd0a660839befc9f0
|
8b07f37cc43c5d9ffe69b563c80763491d8faff7
|
refs/heads/master
| 2023-09-04T19:29:49.254958
| 2023-09-03T20:51:24
| 2023-09-03T20:51:24
| 54,035,569
| 820
| 263
|
NOASSERTION
| 2023-09-05T11:09:04
| 2016-03-16T13:48:16
|
Assembly
|
UTF-8
|
C
| false
| false
| 156,981
|
h
|
features.h
|
#ifndef __FEATURE_H__
#define __FEATURE_H__
// This file is autogenerated, do not edit
#if defined(__CPM__) && defined(__ATTACHE__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__AUSSIE__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__BEE__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 112
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 16
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__BIC__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__BONDWELL__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__BONDWELL2__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__COLECOADAM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX 2
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__CPC__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
#define __HAVE_PSG_AY_ARKOS 1
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__DMV__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__EINSTEIN256__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
#define __HAVE_VIDEO_V9938 1
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__EINSTEIN__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__EXCALI64__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__FP1100__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__KAYPROII__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__KAYPRO84__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__LYNX__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__MBC200__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__MBC1100__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__MBC1160__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__MBC2000__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__MSX__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__MZ2500__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__NABUPC__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__NASCOM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__OSBORNE1__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__PASOPIA__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__PCW__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__PX8__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__PX4__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__QX10__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__SHARPX1__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__SMC777__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__TIKI100__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__TIM011__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX 0
#define __HARDWARE_JOY2_INDEX 0
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__TRS80II__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
#define __HAVE_VIDEO_MC6845 1
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX 0
#define __HARDWARE_JOY2_INDEX 0
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__TRS80__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
#define __HAVE_VIDEO_MC6845 1
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX 0
#define __HARDWARE_JOY2_INDEX 0
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__V1050__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX 0
#define __HARDWARE_JOY2_INDEX 0
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 96
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 96
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__VECTOR06C__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__) && defined(__X820__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__ZENITH__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPM__) && defined(__ZXPLUS3__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__CPM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__ABC80__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__ABC800__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__ACE__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 32
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 32
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__AGON__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__ALPHATRO__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
#define __HAVE_VIDEO_MC6845 1
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__ALTAIR8800__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__AQUARIUSPLUS__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__AQUARIUSPLUS__) && defined(__ROM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__AQUARIUS__) && defined(__ROM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__AQUARIUS__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__BEE__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 112
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 16
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__C128__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__C7420__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__COLECO__) && defined(__ADAM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
// #define __HAVE_GETK 0
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX 2
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__COLECO__) && defined(__BIT90__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX 2
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__COLECO__)
// #define __HAVE_KEYBOARD 0
// #define __HAVE_FGETC_CONS 0
// #define __HAVE_GETK 0
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX 2
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__CPC__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
#define __HAVE_PSG_AY_ARKOS 1
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__DAI__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__ENTERPRISE__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
#define __HAVE_GFX_XORPLOT 1
#elif defined(__EXCALI64__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__FP1100__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__G800__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__GAL__) && defined(__GALPLUSHIRES__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__GAL__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__GAMEBOY__)
// #define __HAVE_KEYBOARD 0
#define __HAVE_FGETC_CONS 1
// #define __HAVE_GETK 0
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__GL__) && defined(GL_TARGET_GL2000)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__GL__) && defined(GL_TARGET_GL4000)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__GL__) && defined(GL_TARGET_GL6000)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__HEMC__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__HGMC__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__HOMELAB__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__HOMELAB2__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__KC__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__KRAMERMC__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__KROKHA__)
// #define __HAVE_KEYBOARD 0
// #define __HAVE_FGETC_CONS 0
// #define __HAVE_GETK 0
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__LAMBDA__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__LASER500__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__LM80C__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__LVIV__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__LYNX__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
#define __HAVE_VIDEO_MC6845 1
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__M100__) && defined(__ROM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__M100__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__M5__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__MC1000__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
#define __HAVE_VIDEO_MC6847 1
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__MICRO8085__)
// #define __HAVE_KEYBOARD 0
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
// #define __HAVE_FILEIO 0
#define __HAVE_TIME 1
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX 0
#define __HARDWARE_JOY2_INDEX 0
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__MIKRO80__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__MSX__) && defined(CLIB_MSXDOS1)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
#define __HAVE_PSG_AY_ARKOS 1
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
#define __HAVE_TIME 1
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__MSX__) && defined(CLIB_MSXDOS2)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
#define __HAVE_PSG_AY_ARKOS 1
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
#define __HAVE_TIME 1
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__MSX2__) && defined(__ROM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
#define __HAVE_PSG_AY_ARKOS 1
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
#define __HAVE_VIDEO_MC6845 1
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__MSX__) && defined(__ROM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
#define __HAVE_PSG_AY_ARKOS 1
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__MSX__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
#define __HAVE_PSG_AY_ARKOS 1
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__MTX__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__MULTI8__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__MYVISION__)
// #define __HAVE_KEYBOARD 0
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SHARPMZ__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__MZ2500__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__NABUPC__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX 2
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__NASCOM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__NC100__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__NEWBRAIN__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__ONDRA__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__OSCA__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__OZ__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__P2000__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__PACMAN__)
// #define __HAVE_KEYBOARD 0
// #define __HAVE_FGETC_CONS 0
// #define __HAVE_GETK 0
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
#define __HAVE_GFX_XORPLOT 1
#elif defined(__PASOPIA7__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
#define __HAVE_VIDEO_MC6845 1
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__PC6001__) && defined(__ROM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
#define __HAVE_VIDEO_MC6847 1
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__PC6001__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
#define __HAVE_VIDEO_MC6847 1
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__PC88__) && defined(__ALLRAM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__PC88__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__PENCIL2__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__PMD85__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SPRINTER__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
#define __HAVE_TIME 1
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__PRIMO__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__PV1000__)
// #define __HAVE_KEYBOARD 0
// #define __HAVE_FGETC_CONS 0
// #define __HAVE_GETK 0
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__PV2000__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__RADIO86__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__REX__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__RX78__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__S1MP3__)
// #define __HAVE_KEYBOARD 0
// #define __HAVE_FGETC_CONS 0
// #define __HAVE_GETK 0
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__SAM__) && defined(__ALLRAM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
#define __HAVE_PSG_AY_WYZ 1
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
#define __HAVE_PSG_SAA1099 1
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
#define __HAVE_TIME 1
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SAM__) && defined(__HIGHRAM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
#define __HAVE_PSG_AY_WYZ 1
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
#define __HAVE_PSG_SAA1099 1
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
#define __HAVE_TIME 1
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SAM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
#define __HAVE_PSG_AY_WYZ 1
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
#define __HAVE_PSG_SAA1099 1
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
#define __HAVE_TIME 1
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__SC3000__) && defined(__ROM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX 2
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SC3000__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX 2
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SMC777__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
#define __HAVE_VIDEO_MC6845 1
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SMS__) && defined(__GAMEGEAR__)
// #define __HAVE_KEYBOARD 0
// #define __HAVE_FGETC_CONS 0
// #define __HAVE_GETK 0
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SMS__)
// #define __HAVE_KEYBOARD 0
// #define __HAVE_FGETC_CONS 0
// #define __HAVE_GETK 0
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
#define __HAVE_PSG_SN76489 1
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SOL20__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX 0
#define __HARDWARE_JOY2_INDEX 0
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SOS__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__SPC1000__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
#define __HAVE_VIDEO_MC6847 1
// #define __HAVE_VIDEO_MC6845 0
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SPECIAL__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
// #define __HAVE_GETK 0
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SORCERER__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 16
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SUPER80__) && defined(__SUPER80_VDUEM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
#define __HAVE_VIDEO_MC6845 1
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 112
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 16
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SUPER80__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SV8000__)
// #define __HAVE_KEYBOARD 0
// #define __HAVE_FGETC_CONS 0
// #define __HAVE_GETK 0
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
#define __HAVE_VIDEO_MC6847 1
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX 2
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SVI__) && defined(__ROM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
#define __HAVE_VIDEO_MC6845 1
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX 2
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SVI318__) && defined(__ROM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
#define __HAVE_VIDEO_MC6845 1
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX 2
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SVI__) && defined(__RAM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
#define __HAVE_VIDEO_MC6845 1
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX 2
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SVI__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
#define __HAVE_VIDEO_MC6845 1
#define __HAVE_VIDEO_VDP 1
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX 2
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__TESTTARGET__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
#define __HAVE_TIME 1
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX 0
#define __HARDWARE_JOY2_INDEX 0
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__TI82__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__TI83__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__TI85__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__TI86__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__TI8x__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__TRS80__) && defined(__EG2000__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
#define __HAVE_VIDEO_MC6845 1
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 32
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__TRS80__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
#define __HAVE_VIDEO_MC6845 1
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__TS2068__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 1
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__TVC__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__VECTOR06C__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__VG5000__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX 2
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 96
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 96
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__VZ200__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
#define __HAVE_VIDEO_MC6847 1
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__X07__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__X1__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
#define __HAVE_PSG_AY 1
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
#define __HAVE_TIME 1
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__Z1013__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__EMBEDDED_Z80)
// #define __HAVE_KEYBOARD 0
// #define __HAVE_FGETC_CONS 0
// #define __HAVE_GETK 0
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
// #define __HAVE_JOYSTICK 0
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__Z80TVGAME__)
// #define __HAVE_KEYBOARD 0
// #define __HAVE_FGETC_CONS 0
// #define __HAVE_GETK 0
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__Z88__) && defined(__Z88_APPLICATION)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
#define __HAVE_FILEIO 1
#define __HAVE_TIME 1
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__Z88__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
#define __HAVE_FILEIO 1
#define __HAVE_TIME 1
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__Z9001__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
#define __HAVE_ONEBITSOUND 1
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX 1
#define __HARDWARE_JOY2_INDEX 2
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SPECTRUM__) && defined(__ROM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
#define __HAVE_PSG_AY_ARKOS 1
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__SPECTRUM__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
#define __HAVE_PSG_AY_ARKOS 1
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 1
#define __HAVE_RS232 1
#define __HAVE_FILEIO 1
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__ZX80__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
// #define __HAVE_INKEY 0
// #define __HAVE_ONEBITSOUND 0
// #define __HAVE_PSG_AY 0
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
// #define __HAVE_GFX 0
// #define __HAVE_GFX_COLOUR 0
// #define __HAVE_GFX_POINTXY 0
// #define __HAVE_GFX_XORPLOT 0
#elif defined(__ZX81__)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
// #define __HAVE_PSG_AY_WYZ 0
// #define __HAVE_PSG_AY_VT2 0
// #define __HAVE_PSG_AY_ARKOS 0
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
// #define __HAVE_RS232 0
// #define __HAVE_FILEIO 0
// #define __HAVE_TIME 0
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 0
#define __GENCON_MAX_UDGS 0
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 0
#define __HAVE_GFX 1
// #define __HAVE_GFX_COLOUR 0
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__ZXNEXT) && defined(__ESXDOS_DOT_COMMAND)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
#define __HAVE_PSG_AY_ARKOS 1
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
// #define __HAVE_INTERRUPTS 0
#define __NEED_INTERRUPT_INIT 0
#define __HAVE_RS232 1
#define __HAVE_FILEIO 1
#define __HAVE_TIME 1
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#elif defined(__ZXNEXT)
#define __HAVE_KEYBOARD 1
#define __HAVE_FGETC_CONS 1
#define __HAVE_GETK 1
#define __HAVE_INKEY 1
#define __HAVE_ONEBITSOUND 1
#define __HAVE_PSG_AY 1
#define __HAVE_PSG_AY_WYZ 1
#define __HAVE_PSG_AY_VT2 1
#define __HAVE_PSG_AY_ARKOS 1
// #define __HAVE_PSG_SN76489 0
// #define __HAVE_PSG_SAA1099 0
#define __HAVE_INTERRUPTS 1
#define __NEED_INTERRUPT_INIT 1
#define __HAVE_RS232 1
#define __HAVE_FILEIO 1
#define __HAVE_TIME 1
// #define __HAVE_VIDEO_MC6847 0
// #define __HAVE_VIDEO_MC6845 0
// #define __HAVE_VIDEO_VDP 0
// #define __HAVE_VIDEO_V9938 0
#define __HAVE_JOYSTICK 1
#define __HARDWARE_JOY1_INDEX -1
#define __HARDWARE_JOY2_INDEX -1
#define __GENCON_CUSTOM_FONT 1
#define __GENCON_MAX_UDGS 128
#define __GENCON_MAX_UDGS_WITH_CUSTOM_FONT 128
#define __HAVE_GFX 1
#define __HAVE_GFX_COLOUR 1
#define __HAVE_GFX_POINTXY 1
#define __HAVE_GFX_XORPLOT 1
#endif
#endif
|
fcd6d965a27530824be20852a14721a2a290f659
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/base/regmap/regcache-lzo.c
|
e210a6d1406a5798b60a49791ae8132cf4a8594a
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 9,277
|
c
|
regcache-lzo.c
|
/*
* Register cache access API - LZO caching support
*
* Copyright 2011 Wolfson Microelectronics plc
*
* Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/lzo.h>
#include "internal.h"
static int regcache_lzo_exit(struct regmap *map);
struct regcache_lzo_ctx {
void *wmem;
void *dst;
const void *src;
size_t src_len;
size_t dst_len;
size_t decompressed_size;
unsigned long *sync_bmp;
int sync_bmp_nbits;
};
#define LZO_BLOCK_NUM 8
static int regcache_lzo_block_count(struct regmap *map)
{
return LZO_BLOCK_NUM;
}
static int regcache_lzo_prepare(struct regcache_lzo_ctx *lzo_ctx)
{
lzo_ctx->wmem = kmalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL);
if (!lzo_ctx->wmem)
return -ENOMEM;
return 0;
}
static int regcache_lzo_compress(struct regcache_lzo_ctx *lzo_ctx)
{
size_t compress_size;
int ret;
ret = lzo1x_1_compress(lzo_ctx->src, lzo_ctx->src_len,
lzo_ctx->dst, &compress_size, lzo_ctx->wmem);
if (ret != LZO_E_OK || compress_size > lzo_ctx->dst_len)
return -EINVAL;
lzo_ctx->dst_len = compress_size;
return 0;
}
static int regcache_lzo_decompress(struct regcache_lzo_ctx *lzo_ctx)
{
size_t dst_len;
int ret;
dst_len = lzo_ctx->dst_len;
ret = lzo1x_decompress_safe(lzo_ctx->src, lzo_ctx->src_len,
lzo_ctx->dst, &dst_len);
if (ret != LZO_E_OK || dst_len != lzo_ctx->dst_len)
return -EINVAL;
return 0;
}
static int regcache_lzo_compress_cache_block(struct regmap *map,
struct regcache_lzo_ctx *lzo_ctx)
{
int ret;
lzo_ctx->dst_len = lzo1x_worst_compress(PAGE_SIZE);
lzo_ctx->dst = kmalloc(lzo_ctx->dst_len, GFP_KERNEL);
if (!lzo_ctx->dst) {
lzo_ctx->dst_len = 0;
return -ENOMEM;
}
ret = regcache_lzo_compress(lzo_ctx);
if (ret < 0)
return ret;
return 0;
}
static int regcache_lzo_decompress_cache_block(struct regmap *map,
struct regcache_lzo_ctx *lzo_ctx)
{
int ret;
lzo_ctx->dst_len = lzo_ctx->decompressed_size;
lzo_ctx->dst = kmalloc(lzo_ctx->dst_len, GFP_KERNEL);
if (!lzo_ctx->dst) {
lzo_ctx->dst_len = 0;
return -ENOMEM;
}
ret = regcache_lzo_decompress(lzo_ctx);
if (ret < 0)
return ret;
return 0;
}
static inline int regcache_lzo_get_blkindex(struct regmap *map,
unsigned int reg)
{
return ((reg / map->reg_stride) * map->cache_word_size) /
DIV_ROUND_UP(map->cache_size_raw,
regcache_lzo_block_count(map));
}
static inline int regcache_lzo_get_blkpos(struct regmap *map,
unsigned int reg)
{
return (reg / map->reg_stride) %
(DIV_ROUND_UP(map->cache_size_raw,
regcache_lzo_block_count(map)) /
map->cache_word_size);
}
static inline int regcache_lzo_get_blksize(struct regmap *map)
{
return DIV_ROUND_UP(map->cache_size_raw,
regcache_lzo_block_count(map));
}
static int regcache_lzo_init(struct regmap *map)
{
struct regcache_lzo_ctx **lzo_blocks;
size_t bmp_size;
int ret, i, blksize, blkcount;
const char *p, *end;
unsigned long *sync_bmp;
ret = 0;
blkcount = regcache_lzo_block_count(map);
map->cache = kzalloc(blkcount * sizeof *lzo_blocks,
GFP_KERNEL);
if (!map->cache)
return -ENOMEM;
lzo_blocks = map->cache;
/*
* allocate a bitmap to be used when syncing the cache with
* the hardware. Each time a register is modified, the corresponding
* bit is set in the bitmap, so we know that we have to sync
* that register.
*/
bmp_size = map->num_reg_defaults_raw;
sync_bmp = kmalloc(BITS_TO_LONGS(bmp_size) * sizeof(long),
GFP_KERNEL);
if (!sync_bmp) {
ret = -ENOMEM;
goto err;
}
bitmap_zero(sync_bmp, bmp_size);
/* allocate the lzo blocks and initialize them */
for (i = 0; i < blkcount; i++) {
lzo_blocks[i] = kzalloc(sizeof **lzo_blocks,
GFP_KERNEL);
if (!lzo_blocks[i]) {
kfree(sync_bmp);
ret = -ENOMEM;
goto err;
}
lzo_blocks[i]->sync_bmp = sync_bmp;
lzo_blocks[i]->sync_bmp_nbits = bmp_size;
/* alloc the working space for the compressed block */
ret = regcache_lzo_prepare(lzo_blocks[i]);
if (ret < 0)
goto err;
}
blksize = regcache_lzo_get_blksize(map);
p = map->reg_defaults_raw;
end = map->reg_defaults_raw + map->cache_size_raw;
/* compress the register map and fill the lzo blocks */
for (i = 0; i < blkcount; i++, p += blksize) {
lzo_blocks[i]->src = p;
if (p + blksize > end)
lzo_blocks[i]->src_len = end - p;
else
lzo_blocks[i]->src_len = blksize;
ret = regcache_lzo_compress_cache_block(map,
lzo_blocks[i]);
if (ret < 0)
goto err;
lzo_blocks[i]->decompressed_size =
lzo_blocks[i]->src_len;
}
return 0;
err:
regcache_lzo_exit(map);
return ret;
}
static int regcache_lzo_exit(struct regmap *map)
{
struct regcache_lzo_ctx **lzo_blocks;
int i, blkcount;
lzo_blocks = map->cache;
if (!lzo_blocks)
return 0;
blkcount = regcache_lzo_block_count(map);
/*
* the pointer to the bitmap used for syncing the cache
* is shared amongst all lzo_blocks. Ensure it is freed
* only once.
*/
if (lzo_blocks[0])
kfree(lzo_blocks[0]->sync_bmp);
for (i = 0; i < blkcount; i++) {
if (lzo_blocks[i]) {
kfree(lzo_blocks[i]->wmem);
kfree(lzo_blocks[i]->dst);
}
/* each lzo_block is a pointer returned by kmalloc or NULL */
kfree(lzo_blocks[i]);
}
kfree(lzo_blocks);
map->cache = NULL;
return 0;
}
static int regcache_lzo_read(struct regmap *map,
unsigned int reg, unsigned int *value)
{
struct regcache_lzo_ctx *lzo_block, **lzo_blocks;
int ret, blkindex, blkpos;
size_t blksize, tmp_dst_len;
void *tmp_dst;
/* index of the compressed lzo block */
blkindex = regcache_lzo_get_blkindex(map, reg);
/* register index within the decompressed block */
blkpos = regcache_lzo_get_blkpos(map, reg);
/* size of the compressed block */
blksize = regcache_lzo_get_blksize(map);
lzo_blocks = map->cache;
lzo_block = lzo_blocks[blkindex];
/* save the pointer and length of the compressed block */
tmp_dst = lzo_block->dst;
tmp_dst_len = lzo_block->dst_len;
/* prepare the source to be the compressed block */
lzo_block->src = lzo_block->dst;
lzo_block->src_len = lzo_block->dst_len;
/* decompress the block */
ret = regcache_lzo_decompress_cache_block(map, lzo_block);
if (ret >= 0)
/* fetch the value from the cache */
*value = regcache_get_val(map, lzo_block->dst, blkpos);
kfree(lzo_block->dst);
/* restore the pointer and length of the compressed block */
lzo_block->dst = tmp_dst;
lzo_block->dst_len = tmp_dst_len;
return ret;
}
static int regcache_lzo_write(struct regmap *map,
unsigned int reg, unsigned int value)
{
struct regcache_lzo_ctx *lzo_block, **lzo_blocks;
int ret, blkindex, blkpos;
size_t blksize, tmp_dst_len;
void *tmp_dst;
/* index of the compressed lzo block */
blkindex = regcache_lzo_get_blkindex(map, reg);
/* register index within the decompressed block */
blkpos = regcache_lzo_get_blkpos(map, reg);
/* size of the compressed block */
blksize = regcache_lzo_get_blksize(map);
lzo_blocks = map->cache;
lzo_block = lzo_blocks[blkindex];
/* save the pointer and length of the compressed block */
tmp_dst = lzo_block->dst;
tmp_dst_len = lzo_block->dst_len;
/* prepare the source to be the compressed block */
lzo_block->src = lzo_block->dst;
lzo_block->src_len = lzo_block->dst_len;
/* decompress the block */
ret = regcache_lzo_decompress_cache_block(map, lzo_block);
if (ret < 0) {
kfree(lzo_block->dst);
goto out;
}
/* write the new value to the cache */
if (regcache_set_val(map, lzo_block->dst, blkpos, value)) {
kfree(lzo_block->dst);
goto out;
}
/* prepare the source to be the decompressed block */
lzo_block->src = lzo_block->dst;
lzo_block->src_len = lzo_block->dst_len;
/* compress the block */
ret = regcache_lzo_compress_cache_block(map, lzo_block);
if (ret < 0) {
kfree(lzo_block->dst);
kfree(lzo_block->src);
goto out;
}
/* set the bit so we know we have to sync this register */
set_bit(reg / map->reg_stride, lzo_block->sync_bmp);
kfree(tmp_dst);
kfree(lzo_block->src);
return 0;
out:
lzo_block->dst = tmp_dst;
lzo_block->dst_len = tmp_dst_len;
return ret;
}
static int regcache_lzo_sync(struct regmap *map, unsigned int min,
unsigned int max)
{
struct regcache_lzo_ctx **lzo_blocks;
unsigned int val;
int i;
int ret;
lzo_blocks = map->cache;
i = min;
for_each_set_bit_from(i, lzo_blocks[0]->sync_bmp,
lzo_blocks[0]->sync_bmp_nbits) {
if (i > max)
continue;
ret = regcache_read(map, i, &val);
if (ret)
return ret;
/* Is this the hardware default? If so skip. */
ret = regcache_lookup_reg(map, i);
if (ret > 0 && val == map->reg_defaults[ret].def)
continue;
map->cache_bypass = 1;
ret = _regmap_write(map, i, val);
map->cache_bypass = 0;
if (ret)
return ret;
dev_dbg(map->dev, "Synced register %#x, value %#x\n",
i, val);
}
return 0;
}
struct regcache_ops regcache_lzo_ops = {
.type = REGCACHE_COMPRESSED,
.name = "lzo",
.init = regcache_lzo_init,
.exit = regcache_lzo_exit,
.read = regcache_lzo_read,
.write = regcache_lzo_write,
.sync = regcache_lzo_sync
};
|
cb7b14eea137346258acb5c5a3577e54834d2ad7
|
7c857119fe1505b1d80d6e62969661c06dc1a2f4
|
/ArmPlatformPkg/PrePi/MainMPCore.c
|
68a7c13298d0d17bd4ff4c2a4dfaf6928ffe4083
|
[
"BSD-2-Clause"
] |
permissive
|
CloverHackyColor/CloverBootloader
|
7042ca7dd6b513d22be591a295e49071ae1482ee
|
2711170df4f60b2ae5aa20add3e00f35cf57b7e5
|
refs/heads/master
| 2023-08-30T22:14:34.590134
| 2023-08-27T19:14:02
| 2023-08-27T19:14:02
| 205,810,121
| 4,734
| 770
|
BSD-2-Clause
| 2023-09-03T12:41:33
| 2019-09-02T08:22:14
|
C
|
UTF-8
|
C
| false
| false
| 3,135
|
c
|
MainMPCore.c
|
/** @file
Copyright (c) 2011-2014, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "PrePi.h"
#include <Library/ArmGicLib.h>
#include <Ppi/ArmMpCoreInfo.h>
VOID
PrimaryMain (
IN UINTN UefiMemoryBase,
IN UINTN StacksBase,
IN UINT64 StartTimeStamp
)
{
// Enable the GIC Distributor
ArmGicEnableDistributor (PcdGet64 (PcdGicDistributorBase));
// In some cases, the secondary cores are waiting for an SGI from the next stage boot loader to resume their initialization
if (!FixedPcdGet32 (PcdSendSgiToBringUpSecondaryCores)) {
// Sending SGI to all the Secondary CPU interfaces
ArmGicSendSgiTo (PcdGet64 (PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E, PcdGet32 (PcdGicSgiIntId));
}
PrePiMain (UefiMemoryBase, StacksBase, StartTimeStamp);
// We must never return
ASSERT (FALSE);
}
VOID
SecondaryMain (
IN UINTN MpId
)
{
EFI_STATUS Status;
ARM_MP_CORE_INFO_PPI *ArmMpCoreInfoPpi;
UINTN Index;
UINTN ArmCoreCount;
ARM_CORE_INFO *ArmCoreInfoTable;
UINT32 ClusterId;
UINT32 CoreId;
VOID (*SecondaryStart)(
VOID
);
UINTN SecondaryEntryAddr;
UINTN AcknowledgeInterrupt;
UINTN InterruptId;
ClusterId = GET_CLUSTER_ID (MpId);
CoreId = GET_CORE_ID (MpId);
// On MP Core Platform we must implement the ARM MP Core Info PPI (gArmMpCoreInfoPpiGuid)
Status = GetPlatformPpi (&gArmMpCoreInfoPpiGuid, (VOID **)&ArmMpCoreInfoPpi);
ASSERT_EFI_ERROR (Status);
ArmCoreCount = 0;
Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable);
ASSERT_EFI_ERROR (Status);
// Find the core in the ArmCoreTable
for (Index = 0; Index < ArmCoreCount; Index++) {
if ((GET_MPIDR_AFF1 (ArmCoreInfoTable[Index].Mpidr) == ClusterId) &&
(GET_MPIDR_AFF0 (ArmCoreInfoTable[Index].Mpidr) == CoreId))
{
break;
}
}
// The ARM Core Info Table must define every core
ASSERT (Index != ArmCoreCount);
// Clear Secondary cores MailBox
MmioWrite32 (ArmCoreInfoTable[Index].MailboxClearAddress, ArmCoreInfoTable[Index].MailboxClearValue);
do {
ArmCallWFI ();
// Read the Mailbox
SecondaryEntryAddr = MmioRead32 (ArmCoreInfoTable[Index].MailboxGetAddress);
// Acknowledge the interrupt and send End of Interrupt signal.
AcknowledgeInterrupt = ArmGicAcknowledgeInterrupt (PcdGet64 (PcdGicInterruptInterfaceBase), &InterruptId);
// Check if it is a valid interrupt ID
if (InterruptId < ArmGicGetMaxNumInterrupts (PcdGet64 (PcdGicDistributorBase))) {
// Got a valid SGI number hence signal End of Interrupt
ArmGicEndOfInterrupt (PcdGet64 (PcdGicInterruptInterfaceBase), AcknowledgeInterrupt);
}
} while (SecondaryEntryAddr == 0);
// Jump to secondary core entry point.
SecondaryStart = (VOID (*)()) SecondaryEntryAddr;
SecondaryStart ();
// The secondaries shouldn't reach here
ASSERT (FALSE);
}
|
900a93db38f5e0d35ee20434a0c3b2af2e5a4ba0
|
3f308bd1e45dc44276d57c089e7698b4fcda79a4
|
/x/valve/pctrl.h
|
d0a23cbe1ad1131d188aaf879fffeaaa257199f2
|
[] |
no_license
|
jhallen/joes-sandbox
|
b5b6d1acf3f66645c3a00757f217f7a8fe2cad27
|
0ec8c38756e4cdc40fc5f881b7c87e2628d15f24
|
refs/heads/master
| 2022-01-18T21:38:24.514745
| 2022-01-03T01:08:53
| 2022-01-03T01:08:53
| 25,269,713
| 760
| 42
| null | 2020-10-27T05:34:56
| 2014-10-15T19:21:16
|
C
|
UTF-8
|
C
| false
| false
| 700
|
h
|
pctrl.h
|
#ifndef _Ipctrl
#define _Ipctrl 1
typedef struct pctrlvars Pctrl;
struct program
{
int valves[64]; /* Valves to open */
int dwell; /* Seconds for each valve */
int repeat; /* Total repetition time. 0==execute only once */
int cycle; /* Time for each watering cycle- only valid if
* repeat is non-zero. */
int valid; /* Set if this program is valid */
};
extern struct program programs[];
#define PCTRLFUNCS \
WIDGETFUNCS \
void (*stfn)(); \
void (*sttext)(); \
void (*st)(); \
#define PCTRLVARS \
WIDGETVARS \
int name; \
TASK *fn; \
extern struct pctrlfuncs { PCTRLFUNCS } pctrlfuncs;
struct pctrlvars { struct pctrlfuncs *funcs; PCTRLVARS };
Pctrl *mkPctrl();
#endif
|
1f696a9fec823021e2d5895905ee368291f6f180
|
6829d1e3e6ec135fb303c33e5abdf82c26e19d8a
|
/jni/eyex/EyeXNotification.h
|
191346905907b936f0993b70179088bc7dbce8f5
|
[
"BSD-3-Clause"
] |
permissive
|
EsotericSoftware/clippy
|
eef7b0ecad22f9829d55b81fa2c967a93219cc33
|
5def0d8ef86bf5da0261ccb36a695a74e3f7aba2
|
refs/heads/master
| 2023-04-13T19:53:00.186436
| 2023-04-07T17:48:32
| 2023-04-07T17:48:32
| 25,866,170
| 117
| 22
|
BSD-3-Clause
| 2019-06-11T13:33:39
| 2014-10-28T11:29:50
|
C++
|
UTF-8
|
C
| false
| false
| 2,897
|
h
|
EyeXNotification.h
|
/*********************************************************************************************************************
* Copyright 2013-2014 Tobii Technology AB. All rights reserved.
* EyeXNotification.h
*********************************************************************************************************************/
#if !defined(__TOBII_TX_NOTIFICATIONS_API__H__)
#define __TOBII_TX_NOTIFICATIONS_API__H__
/*********************************************************************************************************************/
/**
txGetNotificationType
Gets the TX_NOTIFICATIONTYPE of a notification.
@param hNotification [in]:
A TX_CONSTHANDLE to the notification.
Must not be TX_EMPTY_HANDLE.
@param pNotificationType [out]:
A pointer to a TX_NOTIFICATIONTYPE which will be set to the type of the notification.
Must not be NULL.
@return
TX_RESULT_OK: The type of the notification was successfully retrieved.
TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized.
TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function.
*/
TX_C_BEGIN
TX_API TX_RESULT TX_CALLCONVENTION txGetNotificationType(
TX_CONSTHANDLE hNotification,
TX_NOTIFICATIONTYPE* pNotificationType
);
TX_C_END
typedef TX_RESULT (TX_CALLCONVENTION *GetNotificationTypeHook)(
TX_CONSTHANDLE hNotification,
TX_NOTIFICATIONTYPE* pNotificationType
);
/*********************************************************************************************************************/
/**
txGetNotificationData
Gets the data of a notification.
@param hNotification [in]:
A TX_CONSTHANDLE to the notification.
Must not be TX_EMPTY_HANDLE.
@param phObject [out]:
A pointer to a TX_HANDLE to which the handle of the object used as data will be copied.
This handle must be released using txReleaseObject to avoid leaks.
Must not be NULL.
The value of the pointer must be set to TX_EMPTY_HANDLE.
@return
TX_RESULT_OK: The data of the notification was successfully retrieved.
TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized.
TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function.
TX_RESULT_NOTFOUND: The notification does not have any data.
*/
TX_C_BEGIN
TX_API TX_RESULT TX_CALLCONVENTION txGetNotificationData(
TX_CONSTHANDLE hNotification,
TX_HANDLE* phObject
);
TX_C_END
typedef TX_RESULT (TX_CALLCONVENTION *GetNotificationDataHook)(
TX_CONSTHANDLE hNotification,
TX_HANDLE* phObject
);
/*********************************************************************************************************************/
#endif /* !defined(__TOBII_TX_NOTIFICATIONS_API__H__) */
/*********************************************************************************************************************/
|
319babd779888dfcdf89486a0965c6e8b1d32c0b
|
d61b532db0d3e08818338cfaac530a1ced1ffe3b
|
/lang/a68s/liba68s/powi.c
|
0e38c45caa92dc2d89ab735dc36071b7da2b5d5e
|
[
"LicenseRef-scancode-other-permissive"
] |
permissive
|
davidgiven/ack
|
61049c7a8e95ff61a77b1edd3c22bb290720e276
|
db5a32c68c4a60ca26a3927a799ea662b5b2b0e5
|
refs/heads/default
| 2023-08-29T07:33:12.771205
| 2023-07-08T20:17:27
| 2023-07-08T20:17:27
| 37,686,316
| 376
| 74
|
NOASSERTION
| 2023-07-08T20:17:28
| 2015-06-18T21:33:42
|
C
|
UTF-8
|
C
| false
| false
| 386
|
c
|
powi.c
|
POWI(statlink, pow , num)
int *statlink ;
int pow , num ;
{
if ( pow < 0 )
POWNEG() ;
else
{
int n , p , r ;
n = num ; p = pow ;
if ( ( p & 1 ) != 0 ) { r = n; } else { r = 1; }
p >>= 1 ;
while ( p != 0 ) {
n *= n ;
if ( ( p & 1 ) != 0 ) r *= n ;
p >>= 1 ;
}
return( r ) ;
}
}
|
51aca7a7c1eebb037ecabbbe0b9e1119c5c7a10b
|
1e21bfcd7a1a01e609be8ff4ecf959d3e7b048cb
|
/docs/examples/stream/stream_example.c
|
ad2c201c2ef75ce77e57a72d8b25a4ad5a59bd2a
|
[
"Apache-2.0"
] |
permissive
|
goatshriek/stumpless
|
f3720221824fad9e4b185d6304d82c1530e5317b
|
111796d0afbb75645058a5afe5313cf1a59ba44d
|
refs/heads/latest
| 2023-08-18T05:08:33.694065
| 2023-08-09T01:08:27
| 2023-08-09T01:08:27
| 20,359,440
| 428
| 394
|
Apache-2.0
| 2023-09-04T02:22:31
| 2014-05-31T16:06:34
|
C
|
UTF-8
|
C
| false
| false
| 2,856
|
c
|
stream_example.c
|
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2018-2019 Joel E. Anderson
*
* 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 <stdlib.h>
#include <stdio.h>
#include <stumpless.h>
int
main( int argc, char **argv ) {
FILE *logfile;
struct stumpless_target *stream_target;
struct stumpless_entry *basic_entry;
struct stumpless_element *element;
struct stumpless_element *element_result;
struct stumpless_param *param;
struct stumpless_entry *result;
int log_result;
// building the entry is done as usual
basic_entry = stumpless_new_entry( STUMPLESS_FACILITY_USER,
STUMPLESS_SEVERITY_INFO,
"stumpless-unit-test",
"basic-entry",
"basic test message" );
if( !basic_entry ) {
stumpless_perror( "could not create a basic entry" );
return EXIT_FAILURE;
}
element = stumpless_new_element( "basic-element" );
result = stumpless_add_element( basic_entry, element );
if( !result ) {
stumpless_perror( "could not create and add an element to the entry" );
return EXIT_FAILURE;
}
param = stumpless_new_param( "basic-param-name", "basic-param-value" );
element_result = stumpless_add_param( element, param );
if( !element_result ) {
stumpless_perror( "could not create and add a param to he element" );
return EXIT_FAILURE;
}
// if you want to log to a file, then the log file must be opened first
logfile = tmpfile();
if( !logfile ) {
stumpless_perror( "could not open a log file" );
return EXIT_FAILURE;
}
// opening the stream target with an open stream is straightforward:
stream_target = stumpless_open_stream_target( "stream-example", logfile );
// logging an entry is just like with any target
log_result = stumpless_add_entry( stream_target, basic_entry );
if( log_result < 0 ) {
stumpless_perror( "could not log an entry" );
return EXIT_FAILURE;
}
// closing the target is done as usual
stumpless_close_stream_target( stream_target );
// after closing the target, you need to close the stream
fclose( logfile );
// destroying all remaining resources
stumpless_destroy_entry_and_contents( basic_entry );
stumpless_free_all( );
return EXIT_SUCCESS;
}
|
f61029f8fcd9aee985843d776ab777dbf6645340
|
cdbc0478f7d630d7c7bbbd7cfce2499f0fe4689b
|
/C/middle.c
|
4a5d005988e04443950385db8d792d56556ed2f7
|
[
"MIT"
] |
permissive
|
sukritishah15/DS-Algo-Point
|
79bf3f7767592e5d6dd49b97a14a800b90c82e88
|
1b6040f7d9af5830882b53916e83d53a9c0d67d1
|
refs/heads/master
| 2023-08-28T18:17:55.003418
| 2022-10-08T12:53:58
| 2022-10-08T12:53:58
| 299,329,204
| 1,185
| 514
|
MIT
| 2023-01-22T07:12:14
| 2020-09-28T14:09:43
|
Java
|
UTF-8
|
C
| false
| false
| 1,142
|
c
|
middle.c
|
/*The C program to find middle element of linked list
The Time Complexity of this program is O(n)
The Space Complexity of this program is O(1)
*/
#include <stdio.h>
#include <stdlib.h>
typedef struct Node{
int data;
struct node* next;
}Node;
Node* head=NULL;
void append(int data)
{
Node* new=(Node*) malloc(sizeof(Node));
new->data=data;
if (head==NULL){
head=new;
return;
}
Node* temp=head;
while(temp->next!=NULL){
temp=temp->next;
}
temp->next=new;
return;
}
void print(){
Node* temp=head;
while(temp!=NULL){
printf("%d ",temp->data);
temp=temp->next;
}
printf("\n");
}
void middle() {
Node *slow=head;
Node *fast=head;
while (fast!=NULL && fast->next!=NULL){
fast=fast->next;
fast=fast->next;
slow=slow->next;
}
printf("%d\n", slow->data);
}
int main(int argc, char const *argv[])
{
/* code */
append(10);
append(20);
append(30);
append(40);
append(50);
append(60);
print();
middle();
return 0;
}
|
1badf08e5fbdc1e85d88c054b384144a7878e7b5
|
9ceacf33fd96913cac7ef15492c126d96cae6911
|
/sys/dev/sun/sunms.c
|
7f6ce608afdbf634d2bd23fe24e7688c934468ea
|
[] |
no_license
|
openbsd/src
|
ab97ef834fd2d5a7f6729814665e9782b586c130
|
9e79f3a0ebd11a25b4bff61e900cb6de9e7795e9
|
refs/heads/master
| 2023-09-02T18:54:56.624627
| 2023-09-02T15:16:12
| 2023-09-02T15:16:12
| 66,966,208
| 3,394
| 1,235
| null | 2023-08-08T02:42:25
| 2016-08-30T18:18:25
|
C
|
UTF-8
|
C
| false
| false
| 6,137
|
c
|
sunms.c
|
/* $OpenBSD: sunms.c,v 1.3 2022/01/09 05:43:00 jsg Exp $ */
/*
* Copyright (c) 2002, 2009, Miodrag Vallat
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Common Sun mouse handling code.
*
* This code supports 3- and 5- byte Mouse Systems protocols, and speeds of
* 1200, 4800 and 9600 bps.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/ioctl.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/time.h>
#include <sys/timeout.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsmousevar.h>
#include <dev/sun/sunmsvar.h>
void
sunms_attach(struct sunms_softc *sc, const struct wsmouse_accessops *ao)
{
struct wsmousedev_attach_args a;
printf("\n");
/* Initialize state machine. */
sc->sc_state = STATE_PROBING;
sc->sc_bps = INIT_SPEED;
timeout_set(&sc->sc_abort_tmo, sunms_abort_input, sc);
/*
* Note that it doesn't matter if a long time elapses between this
* and the moment interrupts are enabled, as we either have the
* right speed, and will switch to decode state, or get a break
* or a framing error, causing an immediate speed change.
*/
getmicrotime(&sc->sc_lastbpschange);
a.accessops = ao;
a.accesscookie = sc;
sc->sc_wsmousedev = config_found(&sc->sc_dev, &a, wsmousedevprint);
}
int
sunms_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
{
#if 0
struct sunms_softc *sc = v;
#endif
switch (cmd) {
case WSMOUSEIO_GTYPE:
*(u_int *)data = WSMOUSE_TYPE_SUN;
break;
default:
return -1;
}
return 0;
}
/*
* Reinitialize the line to a different speed. Invoked at spltty().
*/
void
sunms_speed_change(struct sunms_softc *sc)
{
uint bps;
switch (sc->sc_bps) {
default:
case 9600:
bps = 4800;
break;
case 4800:
bps = 1200;
break;
case 1200:
bps = 9600;
break;
}
#ifdef DEBUG
printf("%s: %d bps\n", sc->sc_dev.dv_xname, bps);
#endif
microtime(&sc->sc_lastbpschange);
(*sc->sc_speed_change)(sc, bps);
sc->sc_state = STATE_PROBING;
sc->sc_bps = bps;
sc->sc_brk = 0;
timeout_del(&sc->sc_abort_tmo);
}
/*
* Process actual mouse data. Invoked at spltty().
*/
void
sunms_input(struct sunms_softc *sc, int c)
{
struct timeval curtime;
if (sc->sc_wsmousedev == NULL)
return; /* why bother */
if (sc->sc_state == STATE_RATE_CHANGE)
return; /* not ready yet */
/*
* If we have changed speed recently, ignore data for a few
* milliseconds to make sure that either we'll detect the speed
* is still not correct, or discard potential noise resulting
* from the speed change.
*/
if (sc->sc_state == STATE_PROBING) {
microtime(&curtime);
timersub(&curtime, &sc->sc_lastbpschange, &curtime);
if (curtime.tv_sec != 0 ||
curtime.tv_usec >= 200 * 1000) {
sc->sc_state = STATE_DECODING;
sc->sc_byteno = -1;
} else
return;
}
/*
* The Sun mice use either 3 byte or 5 byte packets. The
* first byte of each packet has the topmost bit set;
* however motion parts of the packet may have the topmost
* bit set too; so we only check for a first byte pattern
* when we are not currently processing a packet.
*/
if (sc->sc_byteno < 0) {
if (ISSET(c, 0x80) && !ISSET(c, 0x30))
sc->sc_byteno = 0;
else
return;
}
switch (sc->sc_byteno) {
case 0:
/*
* First packet has bit 7 set; bits 0-2 are button states,
* and bit 3 is set if it is a short (3 byte) packet.
* On the Tadpole SPARCbook, mice connected to the external
* connector will also have bit 6 set to allow it to be
* differentiated from the onboard pointer.
*/
sc->sc_pktlen = ISSET(c, 0x08) ? 3 : 5;
sc->sc_mb = 0;
if (!ISSET(c, 1 << 2)) /* left button */
sc->sc_mb |= 1 << 0;
if (!ISSET(c, 1 << 1)) /* middle button */
sc->sc_mb |= 1 << 1;
if (!ISSET(c, 1 << 0)) /* right button */
sc->sc_mb |= 1 << 2;
sc->sc_byteno++;
/*
* In case we do not receive the whole packet, we need
* to be able to reset sc_byteno.
*
* At 1200bps 8N2, a five byte packet will span 50 bits
* and thus will transmit in 1/24 second, or about 42ms.
*
* A reset timeout of 100ms will be more than enough.
*/
timeout_add_msec(&sc->sc_abort_tmo, 100);
break;
case 1:
case 3:
/*
* Following bytes contain signed 7 bit X, then Y deltas.
* Short packets only have one set of deltas (and are
* thus usually used on 4800 baud mice).
*/
sc->sc_dx += (int8_t)c;
sc->sc_byteno++;
break;
case 2:
case 4:
sc->sc_dy += (int8_t)c;
sc->sc_byteno++;
break;
}
if (sc->sc_byteno == sc->sc_pktlen) {
timeout_del(&sc->sc_abort_tmo);
sc->sc_byteno = -1;
WSMOUSE_INPUT(sc->sc_wsmousedev,
sc->sc_mb, sc->sc_dx, sc->sc_dy, 0, 0);
sc->sc_dx = sc->sc_dy = 0;
}
}
void
sunms_abort_input(void *v)
{
struct sunms_softc *sc = v;
int s;
#ifdef DEBUG
printf("aborting incomplete packet\n");
#endif
s = spltty();
sc->sc_byteno = -1;
splx(s);
}
|
f9ce54a4e41e6dbc815fb584a1e150400e5978b4
|
94096248c1de2dcf46e69ca913cedfa290e44224
|
/tests/api/test-require-context.c
|
e5f0ed2f2bb3975148e41d16a3d103fa75e72666
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
svaarala/duktape
|
612110d1a6db46226c171cfd222974b1b3651ad5
|
5e169deafbbd12823665f5d30fb4c4c04e3dfa26
|
refs/heads/master
| 2023-08-06T16:43:33.014729
| 2022-11-17T21:02:08
| 2022-11-17T21:02:08
| 15,852,088
| 4,796
| 610
|
MIT
| 2023-09-11T17:13:01
| 2014-01-12T22:16:14
|
JavaScript
|
UTF-8
|
C
| false
| false
| 1,990
|
c
|
test-require-context.c
|
/*===
*** test_1 (duk_safe_call)
concat: foobarquux
still here
==> rc=0, result='undefined'
*** test_2 (duk_safe_call)
==> rc=1, result='TypeError: thread required, found 123 (stack index -1)'
*** test_3 (duk_safe_call)
==> rc=1, result='TypeError: thread required, found none (stack index 123)'
*** test_4 (duk_safe_call)
==> rc=1, result='TypeError: thread required, found none (stack index -2147483648)'
===*/
static duk_ret_t test_1(duk_context *ctx, void *udata) {
duk_context *new_ctx;
(void) udata;
duk_set_top(ctx, 0);
(void) duk_push_thread(ctx);
new_ctx = duk_require_context(ctx, -1);
duk_push_string(new_ctx, "foo");
duk_push_string(new_ctx, "bar");
duk_push_string(new_ctx, "quux");
duk_concat(new_ctx, 3);
printf("concat: %s\n", duk_get_string(new_ctx, -1));
/* This duk_pop() makes the new thread unreachable (assuming there
* is no other reference to it), so new_ctx is no longer valid
* afterwards.
*/
duk_pop(ctx);
printf("still here\n");
return 0;
}
static duk_ret_t test_2(duk_context *ctx, void *udata) {
duk_context *new_ctx;
(void) udata;
/* non-thread value */
duk_set_top(ctx, 0);
duk_push_int(ctx, 123);
new_ctx = duk_require_context(ctx, -1);
printf("new_ctx is NULL: %d\n", (new_ctx == NULL ? 1 : 0));
return 0;
}
static duk_ret_t test_3(duk_context *ctx, void *udata) {
duk_context *new_ctx;
(void) udata;
/* invalid index */
duk_set_top(ctx, 0);
duk_push_int(ctx, 123);
new_ctx = duk_require_context(ctx, 123);
printf("new_ctx is NULL: %d\n", (new_ctx == NULL ? 1 : 0));
return 0;
}
static duk_ret_t test_4(duk_context *ctx, void *udata) {
duk_context *new_ctx;
(void) udata;
/* invalid index */
duk_set_top(ctx, 0);
duk_push_int(ctx, 123);
new_ctx = duk_require_context(ctx, DUK_INVALID_INDEX);
printf("new_ctx is NULL: %d\n", (new_ctx == NULL ? 1 : 0));
return 0;
}
void test(duk_context *ctx) {
TEST_SAFE_CALL(test_1);
TEST_SAFE_CALL(test_2);
TEST_SAFE_CALL(test_3);
TEST_SAFE_CALL(test_4);
}
|
f187f2a6aadd92612a949e697d290b2245132c49
|
7d7900e1c25b729fc8c208673a449c0520ba466e
|
/lib/CL/clCreateSampler.c
|
b467d4f672438b4866a6150556b2743103cd3a7a
|
[
"MIT",
"BSD-2-Clause"
] |
permissive
|
pocl/pocl
|
384091e15c8f6abf29fd2c6deace34a7de5a6ac6
|
5a99e12d0bb78427ad948ac368589135507f1b59
|
refs/heads/main
| 2023-09-02T14:16:21.381680
| 2023-08-21T12:13:47
| 2023-08-21T12:13:47
| 12,292,999
| 775
| 250
|
MIT
| 2023-09-14T06:50:34
| 2013-08-22T09:26:12
|
C
|
UTF-8
|
C
| false
| false
| 5,922
|
c
|
clCreateSampler.c
|
/* OpenCL runtime library: clCreateSampler()
Copyright (c) 2012-2017 pocl developers
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 "devices.h"
#include "pocl_cl.h"
#include "pocl_util.h"
extern unsigned long sampler_c;
CL_API_ENTRY cl_sampler CL_API_CALL
POname(clCreateSampler)(cl_context context,
cl_bool normalized_coords,
cl_addressing_mode addressing_mode,
cl_filter_mode filter_mode,
cl_int * errcode_ret)
CL_API_SUFFIX__VERSION_1_0
{
int errcode = CL_SUCCESS;
cl_sampler sampler = NULL;
POCL_GOTO_ERROR_COND ((!IS_CL_OBJECT_VALID (context)), CL_INVALID_CONTEXT);
/* at least 1 device must support images */
size_t i, any_device_has_images = 0;
for (i = 0; i < context->num_devices; i++)
any_device_has_images += (size_t)context->devices[i]->image_support;
POCL_GOTO_ERROR_ON ((!any_device_has_images), CL_INVALID_OPERATION,
"None of the devices within context support images\n");
/* check requested sampler validity */
POCL_GOTO_ERROR_COND (
((normalized_coords != CL_TRUE) && (normalized_coords != CL_FALSE)),
CL_INVALID_VALUE);
POCL_GOTO_ERROR_COND (((normalized_coords != CL_TRUE)
&& (addressing_mode == CL_ADDRESS_MIRRORED_REPEAT)),
CL_INVALID_VALUE);
POCL_GOTO_ERROR_COND (((normalized_coords != CL_TRUE)
&& (addressing_mode == CL_ADDRESS_REPEAT)),
CL_INVALID_VALUE);
sampler = (cl_sampler)calloc (1, sizeof (struct _cl_sampler));
POCL_GOTO_ERROR_COND ((sampler == NULL), CL_OUT_OF_HOST_MEMORY);
POCL_INIT_OBJECT (sampler);
POname (clRetainContext) (context);
sampler->context = context;
sampler->normalized_coords = normalized_coords;
sampler->addressing_mode = addressing_mode;
sampler->filter_mode = filter_mode;
sampler->device_data = (void **)calloc (pocl_num_devices, sizeof (void *));
TP_CREATE_SAMPLER (context->id, sampler->id);
POCL_ATOMIC_INC (sampler_c);
for (i = 0; i < context->num_devices; ++i)
{
cl_device_id dev = context->devices[i];
if (dev->available != CL_TRUE)
continue;
if (dev->image_support == CL_TRUE && dev->ops->create_sampler)
dev->ops->create_sampler (dev, sampler, dev->dev_id);
}
ERROR:
if(errcode_ret)
{
*errcode_ret = errcode;
}
return sampler;
}
POsym (clCreateSampler)
CL_API_ENTRY cl_sampler CL_API_CALL
POname (clCreateSamplerWithProperties) (
cl_context context, const cl_sampler_properties *sampler_properties,
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_2_0
{
cl_bool normalized_coords = CL_TRUE;
cl_addressing_mode addressing_mode = CL_ADDRESS_CLAMP;
cl_filter_mode filter_mode = CL_FILTER_NEAREST;
int coords_set = 0, addr_set = 0, filter_set = 0;
int errcode;
POCL_GOTO_ERROR_COND ((sampler_properties == NULL), CL_INVALID_VALUE);
const cl_sampler_properties *p = sampler_properties;
while (*p != 0)
{
switch (*p)
{
case CL_SAMPLER_NORMALIZED_COORDS:
{
POCL_GOTO_ERROR_ON ((coords_set != 0), CL_INVALID_VALUE,
"CL_SAMPLER_NORMALIZED_COORDS property "
"has been already set");
normalized_coords = p[1];
coords_set = 1;
break;
}
case CL_SAMPLER_ADDRESSING_MODE:
{
POCL_GOTO_ERROR_ON ((addr_set != 0), CL_INVALID_VALUE,
"CL_SAMPLER_ADDRESSING_MODE property "
"has been already set");
addressing_mode = p[1];
addr_set = 1;
break;
}
case CL_SAMPLER_FILTER_MODE:
{
POCL_GOTO_ERROR_ON ((filter_set != 0), CL_INVALID_VALUE,
"CL_SAMPLER_FILTER_MODE property "
"has been already set");
filter_mode = p[1];
filter_set = 1;
break;
}
default:
POCL_GOTO_ERROR_ON (1, CL_INVALID_VALUE,
"Unknown value in properties: %lu\n",
(unsigned long)(*p));
}
p += 2;
}
unsigned num_props = (p - sampler_properties) + 1; /* include final 0 */
cl_sampler ret_sam = POname (clCreateSampler) (
context, normalized_coords, addressing_mode, filter_mode, errcode_ret);
if (ret_sam == NULL)
return NULL;
ret_sam->num_properties = num_props;
assert (num_props < 10);
memcpy (ret_sam->properties, sampler_properties,
num_props * sizeof (cl_sampler_properties));
return ret_sam;
ERROR:
if (errcode_ret)
{
*errcode_ret = errcode;
}
return NULL;
}
POsym (clCreateSamplerWithProperties)
|
648baae9df5ace7690e0fa6c7ba8e6d2f79e7219
|
963cb6c161842ef207ae0526a166e4bb1603397a
|
/ugui/icons/icons_4x.h
|
35cd7af30f8fef053830143f1e6f10c0ea53a445
|
[
"MIT",
"LGPL-2.0-or-later",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
ryankurte/micro-gui
|
9417e81ccc0bb1e4e1a311ce2394dbf0cfa6f45e
|
2f30aff2d4bcb63b10eee770d898171298c08602
|
refs/heads/master
| 2023-06-09T09:33:57.161058
| 2023-06-06T06:29:39
| 2023-06-06T06:29:39
| 45,529,092
| 171
| 36
|
MIT
| 2023-06-06T06:29:41
| 2015-11-04T09:39:23
|
C
|
UTF-8
|
C
| false
| false
| 7,650
|
h
|
icons_4x.h
|
/**
* Icon header template
* For use with the ugui python open-iconic -> sprite generator
* See build-iconic.py
*
* Template: ./scripts/icon-template.h
* Scale: 4
*/
#include <stdint.h>
#ifndef ICONS_4X_H
#define ICONS_4X_H
uint8_t icon_account_login_4x[1024];
uint8_t icon_account_logout_4x[1024];
uint8_t icon_action_redo_4x[1024];
uint8_t icon_action_undo_4x[1024];
uint8_t icon_align_center_4x[1024];
uint8_t icon_align_left_4x[1024];
uint8_t icon_align_right_4x[1024];
uint8_t icon_aperture_4x[1024];
uint8_t icon_arrow_bottom_4x[1024];
uint8_t icon_arrow_circle_bottom_4x[1024];
uint8_t icon_arrow_circle_left_4x[1024];
uint8_t icon_arrow_circle_right_4x[1024];
uint8_t icon_arrow_circle_top_4x[1024];
uint8_t icon_arrow_left_4x[1024];
uint8_t icon_arrow_right_4x[1024];
uint8_t icon_arrow_thick_bottom_4x[1024];
uint8_t icon_arrow_thick_left_4x[1024];
uint8_t icon_arrow_thick_right_4x[1024];
uint8_t icon_arrow_thick_top_4x[1024];
uint8_t icon_arrow_top_4x[1024];
uint8_t icon_audio_4x[1024];
uint8_t icon_audio_spectrum_4x[1024];
uint8_t icon_badge_4x[1024];
uint8_t icon_ban_4x[1024];
uint8_t icon_bar_chart_4x[1024];
uint8_t icon_basket_4x[1024];
uint8_t icon_battery_empty_4x[1024];
uint8_t icon_battery_full_4x[1024];
uint8_t icon_beaker_4x[1024];
uint8_t icon_bell_4x[1024];
uint8_t icon_bluetooth_4x[1024];
uint8_t icon_bold_4x[1024];
uint8_t icon_bolt_4x[1024];
uint8_t icon_book_4x[1024];
uint8_t icon_bookmark_4x[1024];
uint8_t icon_box_4x[1024];
uint8_t icon_briefcase_4x[1024];
uint8_t icon_british_pound_4x[1024];
uint8_t icon_browser_4x[1024];
uint8_t icon_brush_4x[1024];
uint8_t icon_bug_4x[1024];
uint8_t icon_bullhorn_4x[1024];
uint8_t icon_calculator_4x[1024];
uint8_t icon_calendar_4x[1024];
uint8_t icon_camera_slr_4x[1024];
uint8_t icon_caret_bottom_4x[1024];
uint8_t icon_caret_left_4x[1024];
uint8_t icon_caret_right_4x[1024];
uint8_t icon_caret_top_4x[1024];
uint8_t icon_cart_4x[1024];
uint8_t icon_chat_4x[1024];
uint8_t icon_check_4x[1024];
uint8_t icon_chevron_bottom_4x[1024];
uint8_t icon_chevron_left_4x[1024];
uint8_t icon_chevron_right_4x[1024];
uint8_t icon_chevron_top_4x[1024];
uint8_t icon_circle_check_4x[1024];
uint8_t icon_circle_x_4x[1024];
uint8_t icon_clipboard_4x[1024];
uint8_t icon_clock_4x[1024];
uint8_t icon_cloud_4x[1024];
uint8_t icon_cloud_download_4x[1024];
uint8_t icon_cloud_upload_4x[1024];
uint8_t icon_cloudy_4x[1024];
uint8_t icon_code_4x[1024];
uint8_t icon_cog_4x[1024];
uint8_t icon_collapse_down_4x[1024];
uint8_t icon_collapse_left_4x[1024];
uint8_t icon_collapse_right_4x[1024];
uint8_t icon_collapse_up_4x[1024];
uint8_t icon_command_4x[1024];
uint8_t icon_comment_square_4x[1024];
uint8_t icon_compass_4x[1024];
uint8_t icon_contrast_4x[1024];
uint8_t icon_copywriting_4x[1024];
uint8_t icon_credit_card_4x[1024];
uint8_t icon_crop_4x[1024];
uint8_t icon_dashboard_4x[1024];
uint8_t icon_data_transfer_download_4x[1024];
uint8_t icon_data_transfer_upload_4x[1024];
uint8_t icon_delete_4x[1024];
uint8_t icon_dial_4x[1024];
uint8_t icon_document_4x[1024];
uint8_t icon_dollar_4x[1024];
uint8_t icon_double_quote_sans_left_4x[1024];
uint8_t icon_double_quote_sans_right_4x[1024];
uint8_t icon_double_quote_serif_left_4x[1024];
uint8_t icon_double_quote_serif_right_4x[1024];
uint8_t icon_droplet_4x[1024];
uint8_t icon_eject_4x[1024];
uint8_t icon_elevator_4x[1024];
uint8_t icon_ellipses_4x[1024];
uint8_t icon_envelope_closed_4x[1024];
uint8_t icon_envelope_open_4x[1024];
uint8_t icon_euro_4x[1024];
uint8_t icon_excerpt_4x[1024];
uint8_t icon_expand_down_4x[1024];
uint8_t icon_expand_left_4x[1024];
uint8_t icon_expand_right_4x[1024];
uint8_t icon_expand_up_4x[1024];
uint8_t icon_external_link_4x[1024];
uint8_t icon_eye_4x[1024];
uint8_t icon_eyedropper_4x[1024];
uint8_t icon_file_4x[1024];
uint8_t icon_fire_4x[1024];
uint8_t icon_flag_4x[1024];
uint8_t icon_flash_4x[1024];
uint8_t icon_folder_4x[1024];
uint8_t icon_fork_4x[1024];
uint8_t icon_fullscreen_enter_4x[1024];
uint8_t icon_fullscreen_exit_4x[1024];
uint8_t icon_globe_4x[1024];
uint8_t icon_graph_4x[1024];
uint8_t icon_grid_four_up_4x[1024];
uint8_t icon_grid_three_up_4x[1024];
uint8_t icon_grid_two_up_4x[1024];
uint8_t icon_hard_drive_4x[1024];
uint8_t icon_header_4x[1024];
uint8_t icon_headphones_4x[1024];
uint8_t icon_heart_4x[1024];
uint8_t icon_home_4x[1024];
uint8_t icon_image_4x[1024];
uint8_t icon_inbox_4x[1024];
uint8_t icon_infinity_4x[1024];
uint8_t icon_info_4x[1024];
uint8_t icon_italic_4x[1024];
uint8_t icon_justify_center_4x[1024];
uint8_t icon_justify_left_4x[1024];
uint8_t icon_justify_right_4x[1024];
uint8_t icon_key_4x[1024];
uint8_t icon_laptop_4x[1024];
uint8_t icon_layers_4x[1024];
uint8_t icon_lightbulb_4x[1024];
uint8_t icon_link_broken_4x[1024];
uint8_t icon_link_intact_4x[1024];
uint8_t icon_list_4x[1024];
uint8_t icon_list_rich_4x[1024];
uint8_t icon_location_4x[1024];
uint8_t icon_lock_locked_4x[1024];
uint8_t icon_lock_unlocked_4x[1024];
uint8_t icon_loop_4x[1024];
uint8_t icon_loop_circular_4x[1024];
uint8_t icon_loop_square_4x[1024];
uint8_t icon_magnifying_glass_4x[1024];
uint8_t icon_map_4x[1024];
uint8_t icon_map_marker_4x[1024];
uint8_t icon_media_pause_4x[1024];
uint8_t icon_media_play_4x[1024];
uint8_t icon_media_record_4x[1024];
uint8_t icon_media_skip_backward_4x[1024];
uint8_t icon_media_skip_forward_4x[1024];
uint8_t icon_media_step_backward_4x[1024];
uint8_t icon_media_step_forward_4x[1024];
uint8_t icon_media_stop_4x[1024];
uint8_t icon_medical_cross_4x[1024];
uint8_t icon_menu_4x[1024];
uint8_t icon_microphone_4x[1024];
uint8_t icon_minus_4x[1024];
uint8_t icon_monitor_4x[1024];
uint8_t icon_moon_4x[1024];
uint8_t icon_move_4x[1024];
uint8_t icon_musical_note_4x[1024];
uint8_t icon_paperclip_4x[1024];
uint8_t icon_pencil_4x[1024];
uint8_t icon_people_4x[1024];
uint8_t icon_person_4x[1024];
uint8_t icon_phone_4x[1024];
uint8_t icon_pie_chart_4x[1024];
uint8_t icon_pin_4x[1024];
uint8_t icon_play_circle_4x[1024];
uint8_t icon_plus_4x[1024];
uint8_t icon_power_standby_4x[1024];
uint8_t icon_print_4x[1024];
uint8_t icon_project_4x[1024];
uint8_t icon_pulse_4x[1024];
uint8_t icon_puzzle_piece_4x[1024];
uint8_t icon_question_mark_4x[1024];
uint8_t icon_rain_4x[1024];
uint8_t icon_random_4x[1024];
uint8_t icon_reload_4x[1024];
uint8_t icon_resize_both_4x[1024];
uint8_t icon_resize_height_4x[1024];
uint8_t icon_resize_width_4x[1024];
uint8_t icon_rss_4x[1024];
uint8_t icon_rss_alt_4x[1024];
uint8_t icon_script_4x[1024];
uint8_t icon_share_4x[1024];
uint8_t icon_share_boxed_4x[1024];
uint8_t icon_shield_4x[1024];
uint8_t icon_signal_4x[1024];
uint8_t icon_signpost_4x[1024];
uint8_t icon_sort_ascending_4x[1024];
uint8_t icon_sort_descending_4x[1024];
uint8_t icon_spreadsheet_4x[1024];
uint8_t icon_star_4x[1024];
uint8_t icon_sun_4x[1024];
uint8_t icon_tablet_4x[1024];
uint8_t icon_tag_4x[1024];
uint8_t icon_tags_4x[1024];
uint8_t icon_target_4x[1024];
uint8_t icon_task_4x[1024];
uint8_t icon_terminal_4x[1024];
uint8_t icon_text_4x[1024];
uint8_t icon_thumb_down_4x[1024];
uint8_t icon_thumb_up_4x[1024];
uint8_t icon_timer_4x[1024];
uint8_t icon_transfer_4x[1024];
uint8_t icon_trash_4x[1024];
uint8_t icon_underline_4x[1024];
uint8_t icon_vertical_align_bottom_4x[1024];
uint8_t icon_vertical_align_center_4x[1024];
uint8_t icon_vertical_align_top_4x[1024];
uint8_t icon_video_4x[1024];
uint8_t icon_volume_high_4x[1024];
uint8_t icon_volume_low_4x[1024];
uint8_t icon_volume_off_4x[1024];
uint8_t icon_warning_4x[1024];
uint8_t icon_wifi_4x[1024];
uint8_t icon_wrench_4x[1024];
uint8_t icon_x_4x[1024];
uint8_t icon_yen_4x[1024];
uint8_t icon_zoom_in_4x[1024];
uint8_t icon_zoom_out_4x[1024];
#endif
|
96c52045bfd9a448cac14162b91307c73a21be0d
|
7c857119fe1505b1d80d6e62969661c06dc1a2f4
|
/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
|
c016b75f05ac0ab53164cae65add401a70baf158
|
[
"BSD-2-Clause"
] |
permissive
|
CloverHackyColor/CloverBootloader
|
7042ca7dd6b513d22be591a295e49071ae1482ee
|
2711170df4f60b2ae5aa20add3e00f35cf57b7e5
|
refs/heads/master
| 2023-08-30T22:14:34.590134
| 2023-08-27T19:14:02
| 2023-08-27T19:14:02
| 205,810,121
| 4,734
| 770
|
BSD-2-Clause
| 2023-09-03T12:41:33
| 2019-09-02T08:22:14
|
C
|
UTF-8
|
C
| false
| false
| 112,256
|
c
|
PrintInfo.c
|
/** @file
Module for clarifying the content of the smbios structure element information.
Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
(C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "UefiShellDebug1CommandsLib.h"
#include "PrintInfo.h"
#include "LibSmbiosView.h"
#include "QueryTable.h"
#include "EventLogInfo.h"
//
// Get the certain bit of 'value'
//
#define BIT(value, bit) ((value) & ((UINT64) 1) << (bit))
//
// Check if above or equal to version
//
#define AE_SMBIOS_VERSION(MajorVersion, MinorVersion) \
(SmbiosMajorVersion > (MajorVersion) || (SmbiosMajorVersion == (MajorVersion) && SmbiosMinorVersion >= (MinorVersion)))
//
//////////////////////////////////////////////////////////
// Macros of print structure element, simplify coding.
//
#define PRINT_PENDING_STRING(pStruct, type, element) \
do { \
CHAR8 *StringBuf; \
StringBuf = LibGetSmbiosString ((pStruct), (pStruct->type->element)); \
ShellPrintEx(-1,-1,L"%a",#element); \
ShellPrintEx(-1,-1,L": %a\n", (StringBuf != NULL) ? StringBuf: ""); \
} while (0);
#define PRINT_SMBIOS_STRING(pStruct, stringnumber, element) \
do { \
CHAR8 *StringBuf; \
StringBuf = LibGetSmbiosString ((pStruct), (stringnumber)); \
ShellPrintEx(-1,-1,L"%a",#element); \
ShellPrintEx(-1,-1,L": %a\n", (StringBuf != NULL) ? StringBuf: ""); \
} while (0);
#define PRINT_STRUCT_VALUE(pStruct, type, element) \
do { \
ShellPrintEx(-1,-1,L"%a",#element); \
ShellPrintEx(-1,-1,L": %d\n", (pStruct->type->element)); \
} while (0);
#define PRINT_STRUCT_VALUE_H(pStruct, type, element) \
do { \
ShellPrintEx(-1,-1,L"%a",#element); \
ShellPrintEx(-1,-1,L": 0x%x\n", (pStruct->type->element)); \
} while (0);
#define PRINT_STRUCT_VALUE_LH(pStruct, type, element) \
do { \
ShellPrintEx(-1,-1,L"%a",#element); \
ShellPrintEx(-1,-1,L": 0x%lx\n", (pStruct->type->element)); \
} while (0);
#define PRINT_BIT_FIELD(pStruct, type, element, size) \
do { \
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DUMP), gShellDebug1HiiHandle); \
ShellPrintEx(-1,-1,L"%a",#element); \
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SIZE), gShellDebug1HiiHandle, size); \
DumpHex (0, 0, size, &(pStruct->type->element)); \
} while (0);
#define PRINT_SMBIOS_BIT_FIELD(pStruct, startaddress, element, size) \
do { \
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DUMP), gShellDebug1HiiHandle); \
ShellPrintEx(-1,-1,L"%a",#element); \
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SIZE), gShellDebug1HiiHandle, size); \
DumpHex (0, 0, size, startaddress); \
} while (0);
//
/////////////////////////////////////////
//
/**
Copy Length of Src buffer to Dest buffer,
add a NULL termination to Dest buffer.
@param[in, out] Dest Destination buffer head.
@param[in] Src Source buffer head.
@param[in] Length Length of buffer to be copied.
**/
VOID
MemToString (
IN OUT VOID *Dest,
IN VOID *Src,
IN UINTN Length
)
{
UINT8 *SrcBuffer;
UINT8 *DestBuffer;
SrcBuffer = (UINT8 *) Src;
DestBuffer = (UINT8 *) Dest;
//
// copy byte by byte
//
while ((Length--)!=0) {
*DestBuffer++ = *SrcBuffer++;
}
//
// append a NULL terminator
//
*DestBuffer = '\0';
}
//
//////////////////////////////////////////////
//
// Functions below is to show the information
//
/**
Print the info of EPS(Entry Point Structure).
@param[in] SmbiosTable Pointer to the SMBIOS table entry point.
@param[in] Option Display option.
**/
VOID
SmbiosPrintEPSInfo (
IN SMBIOS_TABLE_ENTRY_POINT *SmbiosTable,
IN UINT8 Option
)
{
UINT8 Anchor[5];
UINT8 InAnchor[6];
if (SmbiosTable == NULL) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMBIOSTABLE_NULL), gShellDebug1HiiHandle);
return ;
}
if (Option == SHOW_NONE) {
return ;
}
if (Option >= SHOW_NORMAL) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_SIGN), gShellDebug1HiiHandle);
MemToString (Anchor, SmbiosTable->AnchorString, 4);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ANCHOR_STR), gShellDebug1HiiHandle, Anchor);
ShellPrintHiiEx(-1,-1,NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EPS_CHECKSUM),
gShellDebug1HiiHandle,
SmbiosTable->EntryPointStructureChecksum
);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_LEN), gShellDebug1HiiHandle, SmbiosTable->EntryPointLength);
ShellPrintHiiEx(-1,-1,NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VERSION),
gShellDebug1HiiHandle,
SmbiosTable->MajorVersion,
SmbiosTable->MinorVersion
);
ShellPrintHiiEx(-1,-1,NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NUMBER_STRUCT),
gShellDebug1HiiHandle,
SmbiosTable->NumberOfSmbiosStructures
);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MAX_STRUCT_SIZE), gShellDebug1HiiHandle, SmbiosTable->MaxStructureSize);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_ADDR), gShellDebug1HiiHandle, SmbiosTable->TableAddress);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_LENGTH), gShellDebug1HiiHandle, SmbiosTable->TableLength);
}
//
// If SHOW_ALL, also print followings.
//
if (Option >= SHOW_DETAIL) {
ShellPrintHiiEx(-1,-1,NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_REVISION),
gShellDebug1HiiHandle,
SmbiosTable->EntryPointRevision
);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BCD_REVISION), gShellDebug1HiiHandle, SmbiosTable->SmbiosBcdRevision);
//
// Since raw data is not string, add a NULL terminater.
//
MemToString (InAnchor, SmbiosTable->IntermediateAnchorString, 5);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTER_ACHOR), gShellDebug1HiiHandle, InAnchor);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTER_CHECKSUM), gShellDebug1HiiHandle, SmbiosTable->IntermediateChecksum);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FORMATTED_AREA), gShellDebug1HiiHandle);
DumpHex (2, 0, 5, SmbiosTable->FormattedArea);
}
Print (L"\n");
}
/**
Print the info of 64-bit EPS(Entry Point Structure).
@param[in] SmbiosTable Pointer to the SMBIOS table entry point.
@param[in] Option Display option.
**/
VOID
Smbios64BitPrintEPSInfo (
IN SMBIOS_TABLE_3_0_ENTRY_POINT *SmbiosTable,
IN UINT8 Option
)
{
UINT8 Anchor[5];
if (SmbiosTable == NULL) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMBIOSTABLE_NULL), gShellDebug1HiiHandle);
return ;
}
if (Option == SHOW_NONE) {
return ;
}
if (Option >= SHOW_NORMAL) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_64_BIT_ENTRY_POINT_SIGN), gShellDebug1HiiHandle);
MemToString (Anchor, SmbiosTable->AnchorString, 5);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ANCHOR_STR), gShellDebug1HiiHandle, Anchor);
ShellPrintHiiEx(-1,-1,NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EPS_CHECKSUM),
gShellDebug1HiiHandle,
SmbiosTable->EntryPointStructureChecksum
);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_LEN), gShellDebug1HiiHandle, SmbiosTable->EntryPointLength);
ShellPrintHiiEx(-1,-1,NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VERSION),
gShellDebug1HiiHandle,
SmbiosTable->MajorVersion,
SmbiosTable->MinorVersion
);
ShellPrintHiiEx(-1,-1,NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DOCREV),
gShellDebug1HiiHandle,
SmbiosTable->DocRev
);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_MAX_SIZE), gShellDebug1HiiHandle, SmbiosTable->TableMaximumSize);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_ADDR), gShellDebug1HiiHandle, SmbiosTable->TableAddress);
}
//
// If SHOW_ALL, also print followings.
//
if (Option >= SHOW_DETAIL) {
ShellPrintHiiEx(-1,-1,NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_REVISION),
gShellDebug1HiiHandle,
SmbiosTable->EntryPointRevision
);
}
Print (L"\n");
}
/**
This function print the content of the structure pointed by Struct.
@param[in] Struct Point to the structure to be printed.
@param[in] Option Print option of information detail.
@retval EFI_SUCCESS Successfully Printing this function.
@retval EFI_INVALID_PARAMETER Invalid Structure.
@retval EFI_UNSUPPORTED Unsupported.
**/
EFI_STATUS
SmbiosPrintStructure (
IN SMBIOS_STRUCTURE_POINTER *Struct,
IN UINT8 Option
)
{
UINT8 Index;
UINT8 *Buffer;
if (Struct == NULL) {
return EFI_INVALID_PARAMETER;
}
if (Option == SHOW_NONE) {
return EFI_SUCCESS;
}
Buffer = (UINT8 *) (UINTN) (Struct->Raw);
//
// Display structure header
//
DisplayStructureTypeInfo (Struct->Hdr->Type, SHOW_DETAIL);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FORMAT_PART_LEN), gShellDebug1HiiHandle, Struct->Hdr->Length);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, Struct->Hdr->Handle);
if (Option == SHOW_OUTLINE) {
return EFI_SUCCESS;
}
switch (Struct->Hdr->Type) {
//
// BIOS Information (Type 0)
//
case 0:
PRINT_PENDING_STRING (Struct, Type0, Vendor);
PRINT_PENDING_STRING (Struct, Type0, BiosVersion);
PRINT_STRUCT_VALUE_H (Struct, Type0, BiosSegment);
PRINT_PENDING_STRING (Struct, Type0, BiosReleaseDate);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * (Struct->Type0->BiosSize + 1));
DisplayBiosCharacteristics (ReadUnaligned64 ((UINT64 *) (UINTN) &(Struct->Type0->BiosCharacteristics)), Option);
if (Struct->Hdr->Length > 0x12) {
DisplayBiosCharacteristicsExt1 (Struct->Type0->BIOSCharacteristicsExtensionBytes[0], Option);
}
if (Struct->Hdr->Length > 0x13) {
DisplayBiosCharacteristicsExt2 (Struct->Type0->BIOSCharacteristicsExtensionBytes[1], Option);
}
if (AE_SMBIOS_VERSION (0x2, 0x4) && (Struct->Hdr->Length > 0x14)) {
PRINT_STRUCT_VALUE (Struct, Type0, SystemBiosMajorRelease);
PRINT_STRUCT_VALUE (Struct, Type0, SystemBiosMinorRelease);
PRINT_STRUCT_VALUE (Struct, Type0, EmbeddedControllerFirmwareMajorRelease);
PRINT_STRUCT_VALUE (Struct, Type0, EmbeddedControllerFirmwareMinorRelease);
}
if (AE_SMBIOS_VERSION (0x3, 0x1) && (Struct->Hdr->Length > 0x18)) {
ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EXTENDED_BIOS_SIZE),
gShellDebug1HiiHandle,
Struct->Type0->ExtendedBiosSize.Size,
(Struct->Type0->ExtendedBiosSize.Unit == 0x0) ? L"MB": L"GB"
);
}
break;
//
// System Information (Type 1)
//
case 1:
PRINT_PENDING_STRING (Struct, Type1, Manufacturer);
PRINT_PENDING_STRING (Struct, Type1, ProductName);
PRINT_PENDING_STRING (Struct, Type1, Version);
PRINT_PENDING_STRING (Struct, Type1, SerialNumber);
PRINT_BIT_FIELD (Struct, Type1, Uuid, 16);
DisplaySystemWakeupType (Struct->Type1->WakeUpType, Option);
if (AE_SMBIOS_VERSION (0x2, 0x4) && (Struct->Hdr->Length > 0x19)) {
PRINT_PENDING_STRING (Struct, Type1, SKUNumber);
PRINT_PENDING_STRING (Struct, Type1, Family);
}
break;
//
// Baseboard Information (Type 2)
//
case 2:
PRINT_PENDING_STRING (Struct, Type2, Manufacturer);
PRINT_PENDING_STRING (Struct, Type2, ProductName);
PRINT_PENDING_STRING (Struct, Type2, Version);
PRINT_PENDING_STRING (Struct, Type2, SerialNumber);
if (Struct->Hdr->Length > 0x8) {
PRINT_PENDING_STRING (Struct, Type2, AssetTag);
DisplayBaseBoardFeatureFlags (*(UINT8 *) &Struct->Type2->FeatureFlag, Option);
PRINT_PENDING_STRING (Struct, Type2, LocationInChassis);
PRINT_STRUCT_VALUE_H (Struct, Type2, ChassisHandle);
DisplayBaseBoardBoardType (Struct->Type2->BoardType, Option);
}
break;
//
// System Enclosure (Type 3)
//
case 3:
PRINT_PENDING_STRING (Struct, Type3, Manufacturer);
PRINT_STRUCT_VALUE (Struct, Type3, Type);
DisplaySystemEnclosureType (Struct->Type3->Type, Option);
PRINT_PENDING_STRING (Struct, Type3, Version);
PRINT_PENDING_STRING (Struct, Type3, SerialNumber);
PRINT_PENDING_STRING (Struct, Type3, AssetTag);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOTUP_STATE), gShellDebug1HiiHandle);
DisplaySystemEnclosureStatus (Struct->Type3->BootupState, Option);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_STATE), gShellDebug1HiiHandle);
DisplaySystemEnclosureStatus (Struct->Type3->PowerSupplyState, Option);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_THERMAL_STATE), gShellDebug1HiiHandle);
DisplaySystemEnclosureStatus (Struct->Type3->ThermalState, Option);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SECURITY_STATUS), gShellDebug1HiiHandle);
DisplaySESecurityStatus (Struct->Type3->SecurityStatus, Option);
if (AE_SMBIOS_VERSION (0x2, 0x3)) {
if (Struct->Hdr->Length > 0xD) {
PRINT_BIT_FIELD (Struct, Type3, OemDefined, 4);
}
if (Struct->Hdr->Length > 0x11) {
PRINT_STRUCT_VALUE (Struct, Type3, Height);
}
if (Struct->Hdr->Length > 0x12) {
PRINT_STRUCT_VALUE (Struct, Type3, NumberofPowerCords);
}
}
if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0x13)) {
if (Struct->Hdr->Length > (0x15 + (Struct->Type3->ContainedElementCount * Struct->Type3->ContainedElementRecordLength))) {
PRINT_SMBIOS_STRING (Struct, Buffer[0x15 + (Struct->Type3->ContainedElementCount * Struct->Type3->ContainedElementRecordLength)], SKUNumber);
}
}
break;
//
// Processor Information (Type 4)
//
case 4:
PRINT_SMBIOS_STRING (Struct, Struct->Type4->Socket, SocketDesignation)
DisplayProcessorType (Struct->Type4->ProcessorType, Option);
if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0x28) &&
(Struct->Type4->ProcessorFamily == 0xFE)) {
//
// Get family from ProcessorFamily2 field
//
DisplayProcessorFamily2 (Struct->Type4->ProcessorFamily2, Option);
} else {
DisplayProcessorFamily (Struct->Type4->ProcessorFamily, Option);
}
PRINT_PENDING_STRING (Struct, Type4, ProcessorManufacturer);
PRINT_BIT_FIELD (Struct, Type4, ProcessorId, 8);
PRINT_PENDING_STRING (Struct, Type4, ProcessorVersion);
DisplayProcessorVoltage (*(UINT8 *) &(Struct->Type4->Voltage), Option);
PRINT_STRUCT_VALUE (Struct, Type4, ExternalClock);
PRINT_STRUCT_VALUE (Struct, Type4, MaxSpeed);
PRINT_STRUCT_VALUE (Struct, Type4, CurrentSpeed);
DisplayProcessorStatus (Struct->Type4->Status, Option);
DisplayProcessorUpgrade (Struct->Type4->ProcessorUpgrade, Option);
PRINT_STRUCT_VALUE_H (Struct, Type4, L1CacheHandle);
PRINT_STRUCT_VALUE_H (Struct, Type4, L2CacheHandle);
PRINT_STRUCT_VALUE_H (Struct, Type4, L3CacheHandle);
if (AE_SMBIOS_VERSION (0x2, 0x3) && (Struct->Hdr->Length > 0x20)) {
PRINT_PENDING_STRING (Struct, Type4, SerialNumber);
PRINT_PENDING_STRING (Struct, Type4, AssetTag);
PRINT_PENDING_STRING (Struct, Type4, PartNumber);
}
if (AE_SMBIOS_VERSION (0x2, 0x5) && (Struct->Hdr->Length > 0x23)) {
PRINT_STRUCT_VALUE (Struct, Type4, CoreCount);
PRINT_STRUCT_VALUE (Struct, Type4, EnabledCoreCount);
PRINT_STRUCT_VALUE (Struct, Type4, ThreadCount);
DisplayProcessorCharacteristics (Struct->Type4->ProcessorCharacteristics, Option);
}
if ((SmbiosMajorVersion >= 0x3) && (Struct->Hdr->Length > 0x2A)) {
PRINT_STRUCT_VALUE (Struct, Type4, CoreCount2);
PRINT_STRUCT_VALUE (Struct, Type4, EnabledCoreCount2);
PRINT_STRUCT_VALUE (Struct, Type4, ThreadCount2);
}
break;
//
// Memory Controller Information (Type 5)
//
case 5:
{
UINT8 SlotNum;
SlotNum = Struct->Type5->AssociatedMemorySlotNum;
DisplayMcErrorDetectMethod (Struct->Type5->ErrDetectMethod, Option);
DisplayMcErrorCorrectCapability (*(UINT8 *) &(Struct->Type5->ErrCorrectCapability), Option);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SUPOPRT), gShellDebug1HiiHandle);
DisplayMcInterleaveSupport (Struct->Type5->SupportInterleave, Option);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CURRENT), gShellDebug1HiiHandle);
DisplayMcInterleaveSupport (Struct->Type5->CurrentInterleave, Option);
DisplayMaxMemoryModuleSize (Struct->Type5->MaxMemoryModuleSize, SlotNum, Option);
DisplayMcMemorySpeeds (*(UINT16 *) &(Struct->Type5->SupportSpeed), Option);
DisplayMmMemoryType (Struct->Type5->SupportMemoryType, Option);
DisplayMemoryModuleVoltage (Struct->Type5->MemoryModuleVoltage, Option);
PRINT_STRUCT_VALUE (Struct, Type5, AssociatedMemorySlotNum);
//
// According to SMBIOS Specification, offset 0x0F
//
DisplayMemoryModuleConfigHandles ((UINT16 *) (&Buffer[0x0F]), SlotNum, Option);
DisplayMcErrorCorrectCapability (Buffer[0x0F + 2 * SlotNum], Option);
}
break;
//
// Memory Module Information (Type 6)
//
case 6:
PRINT_PENDING_STRING (Struct, Type6, SocketDesignation);
DisplayMmBankConnections (Struct->Type6->BankConnections, Option);
PRINT_STRUCT_VALUE (Struct, Type6, CurrentSpeed);
DisplayMmMemoryType (*(UINT16 *) &(Struct->Type6->CurrentMemoryType), Option);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INSTALLED), gShellDebug1HiiHandle);
DisplayMmMemorySize (*(UINT8 *) &(Struct->Type6->InstalledSize), Option);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED), gShellDebug1HiiHandle);
DisplayMmMemorySize (*(UINT8 *) &(Struct->Type6->EnabledSize), Option);
DisplayMmErrorStatus (Struct->Type6->ErrorStatus, Option);
break;
//
// Cache Information (Type 7)
//
case 7:
PRINT_PENDING_STRING (Struct, Type7, SocketDesignation);
DisplayCacheConfiguration (Struct->Type7->CacheConfiguration, Option);
PRINT_STRUCT_VALUE_H (Struct, Type7, MaximumCacheSize);
PRINT_STRUCT_VALUE_H (Struct, Type7, InstalledSize);
PRINT_STRUCT_VALUE_H (Struct, Type7, SupportedSRAMType);
PRINT_STRUCT_VALUE_H (Struct, Type7, CurrentSRAMType);
DisplayCacheSRAMType (ReadUnaligned16 ((UINT16 *) (UINTN) &(Struct->Type7->CurrentSRAMType)), Option);
PRINT_STRUCT_VALUE_H (Struct, Type7, CacheSpeed);
DisplayCacheErrCorrectingType (Struct->Type7->ErrorCorrectionType, Option);
DisplayCacheSystemCacheType (Struct->Type7->SystemCacheType, Option);
DisplayCacheAssociativity (Struct->Type7->Associativity, Option);
if (AE_SMBIOS_VERSION (0x3, 0x1) && (Struct->Hdr->Length > 0x13)) {
PRINT_STRUCT_VALUE_H (Struct, Type7, MaximumCacheSize2);
PRINT_STRUCT_VALUE_H (Struct, Type7, InstalledSize2);
}
break;
//
// Port Connector Information (Type 8)
//
case 8:
PRINT_PENDING_STRING (Struct, Type8, InternalReferenceDesignator);
Print (L"Internal ");
DisplayPortConnectorType (Struct->Type8->InternalConnectorType, Option);
PRINT_PENDING_STRING (Struct, Type8, ExternalReferenceDesignator);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EXTERNAL), gShellDebug1HiiHandle);
DisplayPortConnectorType (Struct->Type8->ExternalConnectorType, Option);
DisplayPortType (Struct->Type8->PortType, Option);
break;
//
// System Slots (Type 9)
//
case 9:
PRINT_PENDING_STRING (Struct, Type9, SlotDesignation);
DisplaySystemSlotType (Struct->Type9->SlotType, Option);
DisplaySystemSlotDataBusWidth (Struct->Type9->SlotDataBusWidth, Option);
DisplaySystemSlotCurrentUsage (Struct->Type9->CurrentUsage, Option);
DisplaySystemSlotLength (Struct->Type9->SlotLength, Option);
DisplaySystemSlotId (
Struct->Type9->SlotID,
Struct->Type9->SlotType,
Option
);
DisplaySlotCharacteristics1 (*(UINT8 *) &(Struct->Type9->SlotCharacteristics1), Option);
DisplaySlotCharacteristics2 (*(UINT8 *) &(Struct->Type9->SlotCharacteristics2), Option);
if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0xD)) {
PRINT_STRUCT_VALUE_H (Struct, Type9, SegmentGroupNum);
PRINT_STRUCT_VALUE_H (Struct, Type9, BusNum);
PRINT_STRUCT_VALUE_H (Struct, Type9, DevFuncNum);
}
if (AE_SMBIOS_VERSION (0x3, 0x2)) {
MISC_SLOT_PEER_GROUP *PeerGroupPtr;
UINT8 PeerGroupCount;
if (Struct->Hdr->Length > 0x11) {
PRINT_STRUCT_VALUE (Struct, Type9, DataBusWidth);
}
if (Struct->Hdr->Length > 0x12) {
PRINT_STRUCT_VALUE (Struct, Type9, PeerGroupingCount);
PeerGroupCount = Struct->Type9->PeerGroupingCount;
PeerGroupPtr = Struct->Type9->PeerGroups;
for (Index = 0; Index < PeerGroupCount; Index++) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SLOT_PEER_GROUPS), gShellDebug1HiiHandle, Index + 1);
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SEGMENT_GROUP_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].SegmentGroupNum);
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BUS_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].BusNum);
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_FUNC_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].DevFuncNum);
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DATA_BUS_WIDTH), gShellDebug1HiiHandle, PeerGroupPtr[Index].DataBusWidth);
}
DisplaySystemSlotHeight (Struct->Type9->SlotHeight, Option);
DisplaySystemSlotPhysicalWidth (Struct->Type9->SlotPhysicalWidth, Option);
DisplaySystemSlotInformation (Struct->Type9->SlotInformation, Option);
}
}
break;
//
// On Board Devices Information (Type 10)
//
case 10:
{
UINTN NumOfDevice;
NumOfDevice = (Struct->Type10->Hdr.Length - sizeof (SMBIOS_STRUCTURE)) / (2 * sizeof (UINT8));
for (Index = 0; Index < NumOfDevice; Index++) {
ShellPrintEx(-1,-1,(((Struct->Type10->Device[Index].DeviceType) & 0x80) != 0) ? L"Device Enabled\n": L"Device Disabled\n");
DisplayOnboardDeviceTypes ((Struct->Type10->Device[Index].DeviceType) & 0x7F, Option);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DESC_STRING), gShellDebug1HiiHandle);
ShellPrintEx(-1,-1,L"%a\n",LibGetSmbiosString (Struct, Struct->Type10->Device[Index].DescriptionString));
}
}
break;
//
// Oem Strings (Type 11)
//
case 11:
PRINT_STRUCT_VALUE (Struct, Type11, StringCount);
for (Index = 1; Index <= Struct->Type11->StringCount; Index++) {
ShellPrintEx(-1,-1,L"%a\n", LibGetSmbiosString (Struct, Index));
}
break;
//
// System Configuration Options (Type 12)
//
case 12:
PRINT_STRUCT_VALUE (Struct, Type12, StringCount);
for (Index = 1; Index <= Struct->Type12->StringCount; Index++) {
ShellPrintEx(-1,-1,L"%a\n", LibGetSmbiosString (Struct, Index));
}
break;
//
// BIOS Language Information (Type 13)
//
case 13:
PRINT_STRUCT_VALUE (Struct, Type13, InstallableLanguages);
PRINT_STRUCT_VALUE (Struct, Type13, Flags);
PRINT_BIT_FIELD (Struct, Type13, Reserved, 15);
PRINT_PENDING_STRING (Struct, Type13, CurrentLanguages);
break;
//
// Group Associations (Type 14)
//
case 14:
{
UINT8 NumOfItem;
NumOfItem = (Struct->Type14->Hdr.Length - 5) / 3;
PRINT_PENDING_STRING (Struct, Type14, GroupName);
for (Index = 0; Index < NumOfItem; Index++) {
ShellPrintEx(-1,-1,L"ItemType %d: %d\n", Index + 1, Struct->Type14->Group[Index].ItemType);
ShellPrintEx(-1,-1,L"ItemHandle %d: %d\n", Index + 1, Struct->Type14->Group[Index].ItemHandle);
}
}
break;
//
// System Event Log (Type 15)
//
case 15:
{
EVENT_LOG_TYPE *Ptr;
UINT8 Count;
UINT8 *AccessMethodAddress;
PRINT_STRUCT_VALUE_H (Struct, Type15, LogAreaLength);
PRINT_STRUCT_VALUE_H (Struct, Type15, LogHeaderStartOffset);
PRINT_STRUCT_VALUE_H (Struct, Type15, LogDataStartOffset);
DisplaySELAccessMethod (Struct->Type15->AccessMethod, Option);
PRINT_STRUCT_VALUE_H (Struct, Type15, AccessMethodAddress);
DisplaySELLogStatus (Struct->Type15->LogStatus, Option);
PRINT_STRUCT_VALUE_H (Struct, Type15, LogChangeToken);
DisplaySysEventLogHeaderFormat (Struct->Type15->LogHeaderFormat, Option);
PRINT_STRUCT_VALUE_H (Struct, Type15, NumberOfSupportedLogTypeDescriptors);
PRINT_STRUCT_VALUE_H (Struct, Type15, LengthOfLogTypeDescriptor);
Count = Struct->Type15->NumberOfSupportedLogTypeDescriptors;
if (Count > 0) {
Ptr = Struct->Type15->EventLogTypeDescriptors;
//
// Display all Event Log type descriptors supported by system
//
for (Index = 0; Index < Count; Index++, Ptr++) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SUPOPRTED_EVENT), gShellDebug1HiiHandle, Index + 1);
DisplaySELTypes (Ptr->LogType, Option);
DisplaySELVarDataFormatType (Ptr->DataFormatType, Option);
}
if (Option >= SHOW_DETAIL) {
switch (Struct->Type15->AccessMethod) {
case 03:
AccessMethodAddress = (UINT8 *) (UINTN) (Struct->Type15->AccessMethodAddress);
break;
case 00:
case 01:
case 02:
case 04:
default:
ShellPrintHiiEx(-1,-1,NULL,
STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ACCESS_METHOD_NOT_SUPOPRTED),
gShellDebug1HiiHandle,
Struct->Type15->AccessMethod
);
return EFI_UNSUPPORTED;
}
//
// Display Event Log Header
//
// Starting offset (or index) within the nonvolatile storage
// of the event-log's header, from the Access Method Address
//
DisplaySysEventLogHeader (
Struct->Type15->LogHeaderFormat,
AccessMethodAddress + Struct->Type15->LogHeaderStartOffset
);
//
// Display all Event Log data
//
// Starting offset (or index) within the nonvolatile storage
// of the event-log's first data byte, from the Access Method Address(0x14)
//
DisplaySysEventLogData (
AccessMethodAddress + Struct->Type15->LogDataStartOffset,
(UINT16)
(
Struct->Type15->LogAreaLength -
(Struct->Type15->LogDataStartOffset - Struct->Type15->LogHeaderStartOffset)
)
);
}
}
}
break;
//
// Physical Memory Array (Type 16)
//
case 16:
DisplayPMALocation (Struct->Type16->Location, Option);
DisplayPMAUse (Struct->Type16->Use, Option);
DisplayPMAErrorCorrectionTypes (
Struct->Type16->MemoryErrorCorrection,
Option
);
PRINT_STRUCT_VALUE_H (Struct, Type16, MaximumCapacity);
PRINT_STRUCT_VALUE_H (Struct, Type16, MemoryErrorInformationHandle);
PRINT_STRUCT_VALUE_H (Struct, Type16, NumberOfMemoryDevices);
if (AE_SMBIOS_VERSION (0x2, 0x7) && Struct->Hdr->Length > 0xF) {
PRINT_STRUCT_VALUE_LH (Struct, Type16, ExtendedMaximumCapacity);
}
break;
//
// Memory Device (Type 17)
//
case 17:
PRINT_STRUCT_VALUE_H (Struct, Type17, MemoryArrayHandle);
PRINT_STRUCT_VALUE_H (Struct, Type17, MemoryErrorInformationHandle);
PRINT_STRUCT_VALUE (Struct, Type17, TotalWidth);
PRINT_STRUCT_VALUE (Struct, Type17, DataWidth);
PRINT_STRUCT_VALUE (Struct, Type17, Size);
DisplayMemoryDeviceFormFactor (Struct->Type17->FormFactor, Option);
PRINT_STRUCT_VALUE_H (Struct, Type17, DeviceSet);
PRINT_PENDING_STRING (Struct, Type17, DeviceLocator);
PRINT_PENDING_STRING (Struct, Type17, BankLocator);
DisplayMemoryDeviceType (Struct->Type17->MemoryType, Option);
DisplayMemoryDeviceTypeDetail (ReadUnaligned16 ((UINT16 *) (UINTN) &(Struct->Type17->TypeDetail)), Option);
PRINT_STRUCT_VALUE_H (Struct, Type17, Speed);
PRINT_PENDING_STRING (Struct, Type17, Manufacturer);
PRINT_PENDING_STRING (Struct, Type17, SerialNumber);
PRINT_PENDING_STRING (Struct, Type17, AssetTag);
PRINT_PENDING_STRING (Struct, Type17, PartNumber);
if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0x1B)) {
PRINT_STRUCT_VALUE_H (Struct, Type17, Attributes);
}
if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0x1C)) {
PRINT_STRUCT_VALUE (Struct, Type17, ExtendedSize);
PRINT_STRUCT_VALUE (Struct, Type17, ConfiguredMemoryClockSpeed);
}
if (AE_SMBIOS_VERSION (0x2, 0x8) && (Struct->Hdr->Length > 0x22)) {
PRINT_STRUCT_VALUE (Struct, Type17, MinimumVoltage);
PRINT_STRUCT_VALUE (Struct, Type17, MaximumVoltage);
PRINT_STRUCT_VALUE (Struct, Type17, ConfiguredVoltage);
}
break;
//
// 32-bit Memory Error Information (Type 18)
//
case 18:
DisplayMemoryErrorType (Struct->Type18->ErrorType, Option);
DisplayMemoryErrorGranularity (
Struct->Type18->ErrorGranularity,
Option
);
DisplayMemoryErrorOperation (Struct->Type18->ErrorOperation, Option);
PRINT_STRUCT_VALUE_H (Struct, Type18, VendorSyndrome);
PRINT_STRUCT_VALUE_H (Struct, Type18, MemoryArrayErrorAddress);
PRINT_STRUCT_VALUE_H (Struct, Type18, DeviceErrorAddress);
PRINT_STRUCT_VALUE_H (Struct, Type18, ErrorResolution);
break;
//
// Memory Array Mapped Address (Type 19)
//
case 19:
PRINT_STRUCT_VALUE_H (Struct, Type19, StartingAddress);
PRINT_STRUCT_VALUE_H (Struct, Type19, EndingAddress);
PRINT_STRUCT_VALUE_H (Struct, Type19, MemoryArrayHandle);
PRINT_STRUCT_VALUE_H (Struct, Type19, PartitionWidth);
if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0xF)) {
PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedStartingAddress);
PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedEndingAddress);
}
break;
//
// Memory Device Mapped Address (Type 20)
//
case 20:
PRINT_STRUCT_VALUE_H (Struct, Type20, StartingAddress);
PRINT_STRUCT_VALUE_H (Struct, Type20, EndingAddress);
PRINT_STRUCT_VALUE_H (Struct, Type20, MemoryDeviceHandle);
PRINT_STRUCT_VALUE_H (Struct, Type20, MemoryArrayMappedAddressHandle);
PRINT_STRUCT_VALUE_H (Struct, Type20, PartitionRowPosition);
PRINT_STRUCT_VALUE_H (Struct, Type20, InterleavePosition);
PRINT_STRUCT_VALUE_H (Struct, Type20, InterleavedDataDepth);
if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0x13)) {
PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedStartingAddress);
PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedEndingAddress);
}
break;
//
// Built-in Pointing Device (Type 21)
//
case 21:
DisplayPointingDeviceType (Struct->Type21->Type, Option);
DisplayPointingDeviceInterface (Struct->Type21->Interface, Option);
PRINT_STRUCT_VALUE (Struct, Type21, NumberOfButtons);
break;
//
// Portable Battery (Type 22)
//
case 22:
PRINT_PENDING_STRING (Struct, Type22, Location);
PRINT_PENDING_STRING (Struct, Type22, Manufacturer);
PRINT_PENDING_STRING (Struct, Type22, ManufactureDate);
PRINT_PENDING_STRING (Struct, Type22, SerialNumber);
PRINT_PENDING_STRING (Struct, Type22, DeviceName);
DisplayPBDeviceChemistry (
Struct->Type22->DeviceChemistry,
Option
);
PRINT_STRUCT_VALUE_H (Struct, Type22, DeviceCapacity);
PRINT_STRUCT_VALUE_H (Struct, Type22, DesignVoltage);
PRINT_PENDING_STRING (Struct, Type22, SBDSVersionNumber);
PRINT_STRUCT_VALUE_H (Struct, Type22, MaximumErrorInBatteryData);
PRINT_STRUCT_VALUE_H (Struct, Type22, SBDSSerialNumber);
DisplaySBDSManufactureDate (
Struct->Type22->SBDSManufactureDate,
Option
);
PRINT_PENDING_STRING (Struct, Type22, SBDSDeviceChemistry);
PRINT_STRUCT_VALUE_H (Struct, Type22, DesignCapacityMultiplier);
PRINT_STRUCT_VALUE_H (Struct, Type22, OEMSpecific);
break;
//
// System Reset (Type 23)
//
case 23:
DisplaySystemResetCapabilities (
Struct->Type23->Capabilities,
Option
);
PRINT_STRUCT_VALUE_H (Struct, Type23, ResetCount);
PRINT_STRUCT_VALUE_H (Struct, Type23, ResetLimit);
PRINT_STRUCT_VALUE_H (Struct, Type23, TimerInterval);
PRINT_STRUCT_VALUE_H (Struct, Type23, Timeout);
break;
//
// Hardware Security (Type 24)
//
case 24:
DisplayHardwareSecuritySettings (
Struct->Type24->HardwareSecuritySettings,
Option
);
break;
//
// System Power Controls (Type 25)
//
case 25:
PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnMonth);
PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnDayOfMonth);
PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnHour);
PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnMinute);
PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnSecond);
break;
//
// Voltage Probe (Type 26)
//
case 26:
PRINT_PENDING_STRING (Struct, Type26, Description);
DisplayVPLocation (*(UINT8 *) &(Struct->Type26->LocationAndStatus), Option);
DisplayVPStatus (*(UINT8 *) &(Struct->Type26->LocationAndStatus), Option);
PRINT_STRUCT_VALUE_H (Struct, Type26, MaximumValue);
PRINT_STRUCT_VALUE_H (Struct, Type26, MinimumValue);
PRINT_STRUCT_VALUE_H (Struct, Type26, Resolution);
PRINT_STRUCT_VALUE_H (Struct, Type26, Tolerance);
PRINT_STRUCT_VALUE_H (Struct, Type26, Accuracy);
PRINT_STRUCT_VALUE_H (Struct, Type26, OEMDefined);
PRINT_STRUCT_VALUE_H (Struct, Type26, NominalValue);
break;
//
// Cooling Device (Type 27)
//
case 27:
PRINT_STRUCT_VALUE_H (Struct, Type27, TemperatureProbeHandle);
DisplayCoolingDeviceStatus (*(UINT8 *) &(Struct->Type27->DeviceTypeAndStatus), Option);
DisplayCoolingDeviceType (*(UINT8 *) &(Struct->Type27->DeviceTypeAndStatus), Option);
PRINT_STRUCT_VALUE_H (Struct, Type27, CoolingUnitGroup);
PRINT_STRUCT_VALUE_H (Struct, Type27, OEMDefined);
PRINT_STRUCT_VALUE_H (Struct, Type27, NominalSpeed);
if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0xE)) {
PRINT_PENDING_STRING (Struct, Type27, Description);
}
break;
//
// Temperature Probe (Type 28)
//
case 28:
PRINT_PENDING_STRING (Struct, Type28, Description);
DisplayTemperatureProbeStatus (*(UINT8 *) &(Struct->Type28->LocationAndStatus), Option);
DisplayTemperatureProbeLoc (*(UINT8 *) &(Struct->Type28->LocationAndStatus), Option);
PRINT_STRUCT_VALUE_H (Struct, Type28, MaximumValue);
PRINT_STRUCT_VALUE_H (Struct, Type28, MinimumValue);
PRINT_STRUCT_VALUE_H (Struct, Type28, Resolution);
PRINT_STRUCT_VALUE_H (Struct, Type28, Tolerance);
PRINT_STRUCT_VALUE_H (Struct, Type28, Accuracy);
PRINT_STRUCT_VALUE_H (Struct, Type28, OEMDefined);
PRINT_STRUCT_VALUE_H (Struct, Type28, NominalValue);
break;
//
// Electrical Current Probe (Type 29)
//
case 29:
PRINT_PENDING_STRING (Struct, Type29, Description);
DisplayECPStatus (*(UINT8 *) &(Struct->Type29->LocationAndStatus), Option);
DisplayECPLoc (*(UINT8 *) &(Struct->Type29->LocationAndStatus), Option);
PRINT_STRUCT_VALUE_H (Struct, Type29, MaximumValue);
PRINT_STRUCT_VALUE_H (Struct, Type29, MinimumValue);
PRINT_STRUCT_VALUE_H (Struct, Type29, Resolution);
PRINT_STRUCT_VALUE_H (Struct, Type29, Tolerance);
PRINT_STRUCT_VALUE_H (Struct, Type29, Accuracy);
PRINT_STRUCT_VALUE_H (Struct, Type29, OEMDefined);
PRINT_STRUCT_VALUE_H (Struct, Type29, NominalValue);
break;
//
// Out-of-Band Remote Access (Type 30)
//
case 30:
PRINT_PENDING_STRING (Struct, Type30, ManufacturerName);
DisplayOBRAConnections (Struct->Type30->Connections, Option);
break;
//
// Boot Integrity Services (BIS) Entry Point (Type 31)
//
case 31:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE31), gShellDebug1HiiHandle);
break;
//
// System Boot Information (Type 32)
//
case 32:
PRINT_BIT_FIELD (Struct, Type32, Reserved, 6);
DisplaySystemBootStatus (Struct->Type32->BootStatus, Option);
break;
//
// 64-Bit Memory Error Information (Type 33)
//
case 33:
DisplayMemoryErrorType (Struct->Type33->ErrorType, Option);
DisplayMemoryErrorGranularity (
Struct->Type33->ErrorGranularity,
Option
);
DisplayMemoryErrorOperation (Struct->Type33->ErrorOperation, Option);
PRINT_STRUCT_VALUE_H (Struct, Type33, VendorSyndrome);
PRINT_STRUCT_VALUE_LH (Struct, Type33, MemoryArrayErrorAddress);
PRINT_STRUCT_VALUE_LH (Struct, Type33, DeviceErrorAddress);
PRINT_STRUCT_VALUE_H (Struct, Type33, ErrorResolution);
break;
//
// Management Device (Type 34)
//
case 34:
PRINT_PENDING_STRING (Struct, Type34, Description);
DisplayMDType (Struct->Type34->Type, Option);
PRINT_STRUCT_VALUE_H (Struct, Type34, Address);
DisplayMDAddressType (Struct->Type34->AddressType, Option);
break;
//
// Management Device Component (Type 35)
//
case 35:
PRINT_PENDING_STRING (Struct, Type35, Description);
PRINT_STRUCT_VALUE_H (Struct, Type35, ManagementDeviceHandle);
PRINT_STRUCT_VALUE_H (Struct, Type35, ComponentHandle);
PRINT_STRUCT_VALUE_H (Struct, Type35, ThresholdHandle);
break;
//
// Management Device Threshold Data (Type 36)
//
case 36:
PRINT_STRUCT_VALUE_H (Struct, Type36, LowerThresholdNonCritical);
PRINT_STRUCT_VALUE_H (Struct, Type36, UpperThresholdNonCritical);
PRINT_STRUCT_VALUE_H (Struct, Type36, LowerThresholdCritical);
PRINT_STRUCT_VALUE_H (Struct, Type36, UpperThresholdCritical);
PRINT_STRUCT_VALUE_H (Struct, Type36, LowerThresholdNonRecoverable);
PRINT_STRUCT_VALUE_H (Struct, Type36, UpperThresholdNonRecoverable);
break;
//
// Memory Channel (Type 37)
//
case 37:
{
UINT8 Count;
MEMORY_DEVICE *Ptr;
DisplayMemoryChannelType (Struct->Type37->ChannelType, Option);
PRINT_STRUCT_VALUE_H (Struct, Type37, MaximumChannelLoad);
PRINT_STRUCT_VALUE_H (Struct, Type37, MemoryDeviceCount);
Count = Struct->Type37->MemoryDeviceCount;
Ptr = Struct->Type37->MemoryDevice;
for (Index = 0; Index < Count; Index++) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_DEVICE), gShellDebug1HiiHandle, Index + 1);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_LOAD), gShellDebug1HiiHandle, Ptr[Index].DeviceLoad);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_HANDLE), gShellDebug1HiiHandle, Ptr[Index].DeviceHandle);
}
}
break;
//
// IPMI Device Information (Type 38)
//
case 38:
DisplayIPMIDIBMCInterfaceType (Struct->Type38->InterfaceType, Option);
PRINT_STRUCT_VALUE_H (Struct, Type38, IPMISpecificationRevision);
PRINT_STRUCT_VALUE_H (Struct, Type38, I2CSlaveAddress);
PRINT_STRUCT_VALUE_H (Struct, Type38, NVStorageDeviceAddress);
PRINT_STRUCT_VALUE_LH (Struct, Type38, BaseAddress);
break;
//
// System Power Supply (Type 39)
//
case 39:
PRINT_STRUCT_VALUE_H (Struct, Type39, PowerUnitGroup);
PRINT_PENDING_STRING (Struct, Type39, Location);
PRINT_PENDING_STRING (Struct, Type39, DeviceName);
PRINT_PENDING_STRING (Struct, Type39, Manufacturer);
PRINT_PENDING_STRING (Struct, Type39, SerialNumber);
PRINT_PENDING_STRING (Struct, Type39, AssetTagNumber);
PRINT_PENDING_STRING (Struct, Type39, ModelPartNumber);
PRINT_PENDING_STRING (Struct, Type39, RevisionLevel);
PRINT_STRUCT_VALUE_H (Struct, Type39, MaxPowerCapacity);
DisplaySPSCharacteristics (
*(UINT16 *) &(Struct->Type39->PowerSupplyCharacteristics),
Option
);
PRINT_STRUCT_VALUE_H (Struct, Type39, InputVoltageProbeHandle);
PRINT_STRUCT_VALUE_H (Struct, Type39, CoolingDeviceHandle);
PRINT_STRUCT_VALUE_H (Struct, Type39, InputCurrentProbeHandle);
break;
//
// Additional Information (Type 40)
//
case 40:
{
UINT8 NumberOfEntries;
UINT8 EntryLength;
ADDITIONAL_INFORMATION_ENTRY *Entries;
EntryLength = 0;
Entries = Struct->Type40->AdditionalInfoEntries;
NumberOfEntries = Struct->Type40->NumberOfAdditionalInformationEntries;
PRINT_STRUCT_VALUE_H (Struct, Type40, NumberOfAdditionalInformationEntries);
for (Index = 0; Index < NumberOfEntries; Index++) {
EntryLength = Entries->EntryLength;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTRYLEN), gShellDebug1HiiHandle, EntryLength);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_REFERENCEDHANDLE), gShellDebug1HiiHandle, Entries->ReferencedHandle);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_REFERENCEDOFFSET), gShellDebug1HiiHandle, Entries->ReferencedOffset);
PRINT_SMBIOS_STRING (Struct, Entries->EntryString, String);
PRINT_SMBIOS_BIT_FIELD (Struct, Entries->Value, Value, EntryLength - 5);
Entries = (ADDITIONAL_INFORMATION_ENTRY *) ((UINT8 *)Entries + EntryLength);
}
}
break;
//
// Onboard Devices Extended Information (Type 41)
//
case 41:
PRINT_PENDING_STRING (Struct, Type41, ReferenceDesignation);
ShellPrintEx(-1,-1,(((Struct->Type41->DeviceType) & 0x80) != 0) ? L"Device Enabled\n": L"Device Disabled\n");
DisplayOnboardDeviceTypes ((Struct->Type41->DeviceType) & 0x7F, Option);
PRINT_STRUCT_VALUE_H (Struct, Type41, DeviceTypeInstance);
PRINT_STRUCT_VALUE_H (Struct, Type41, SegmentGroupNum);
PRINT_STRUCT_VALUE_H (Struct, Type41, BusNum);
PRINT_STRUCT_VALUE_H (Struct, Type41, DevFuncNum);
break;
//
// Management Controller Host Interface (Type 42)
//
case 42:
DisplayMCHostInterfaceType (Struct->Type42->InterfaceType, Option);
break;
//
// TPM Device (Type 43)
//
case 43:
PRINT_BIT_FIELD (Struct, Type43, VendorID, 4);
PRINT_STRUCT_VALUE_H (Struct, Type43, MajorSpecVersion);
PRINT_STRUCT_VALUE_H (Struct, Type43, MinorSpecVersion);
PRINT_STRUCT_VALUE_H (Struct, Type43, FirmwareVersion1);
PRINT_STRUCT_VALUE_H (Struct, Type43, FirmwareVersion2);
PRINT_PENDING_STRING (Struct, Type43, Description);
DisplayTpmDeviceCharacteristics (ReadUnaligned64 ((UINT64 *) (UINTN) &(Struct->Type43->Characteristics)), Option);
PRINT_STRUCT_VALUE_H (Struct, Type43, OemDefined);
break;
//
// Inactive (Type 126)
//
case 126:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INACTIVE_STRUCT), gShellDebug1HiiHandle);
break;
//
// End-of-Table (Type 127)
//
case 127:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_THIS_STRUCT_END_TABLE), gShellDebug1HiiHandle);
break;
default:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE_UNDEFINED), gShellDebug1HiiHandle);
break;
}
return EFI_SUCCESS;
}
/**
Display BIOS Information (Type 0) information.
@param[in] Chara The information bits.
@param[in] Option The optional information.
**/
VOID
DisplayBiosCharacteristics (
IN UINT64 Chara,
IN UINT8 Option
)
{
//
// Print header
//
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR), gShellDebug1HiiHandle);
//
// print option
//
PRINT_INFO_OPTION (Chara, Option);
//
// Check all the bits and print information
// This function does not use Table because table of bits
// are designed not to deal with UINT64
//
if (BIT (Chara, 0) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 1) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 2) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN_BIT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 3) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_NOT_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 4) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ISA_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 5) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MSA_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 6) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EISA_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 7) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PCI_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 8) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PC_CARD_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 9) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PLUG_PLAY_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 10) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_APM_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 11) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_UPGRADEABLE), gShellDebug1HiiHandle);
}
if (BIT (Chara, 12) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SHADOWING), gShellDebug1HiiHandle);
}
if (BIT (Chara, 13) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VESA_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 14) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ECSD_SUPPORT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 15) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_FROM_CD_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 16) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SELECTED_BOOT_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 17) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_ROM_SOCKETED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 18) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_FROM_PC_CARD), gShellDebug1HiiHandle);
}
if (BIT (Chara, 19) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EDD_ENHANCED_DRIVER), gShellDebug1HiiHandle);
}
if (BIT (Chara, 20) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_NEC), gShellDebug1HiiHandle);
}
if (BIT (Chara, 21) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_TOSHIBA), gShellDebug1HiiHandle);
}
if (BIT (Chara, 22) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FLOPPY_SERVICES_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 23) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_POINT_TWO_MB), gShellDebug1HiiHandle);
}
if (BIT (Chara, 24) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_720_KB), gShellDebug1HiiHandle);
}
if (BIT (Chara, 25) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TWO_POINT_EIGHT_EIGHT_MB), gShellDebug1HiiHandle);
}
if (BIT (Chara, 26) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRINT_SCREEN_SUPPORT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 27) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_SERV_SUPPORT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 28) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SERIAL_SERVICES_SUPPORT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 29) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRINTER_SERVICES_SUPPORT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 30) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MONO_VIDEO_SUPPORT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 31) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NEC_PC_98), gShellDebug1HiiHandle);
}
//
// Just print the Reserved
//
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_32_47), gShellDebug1HiiHandle);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_48_64), gShellDebug1HiiHandle);
}
/**
Display Bios Characteristice extensions1 information.
@param[in] Byte1 The information.
@param[in] Option The optional information.
**/
VOID
DisplayBiosCharacteristicsExt1 (
IN UINT8 Byte1,
IN UINT8 Option
)
{
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION), gShellDebug1HiiHandle);
//
// Print option
//
PRINT_INFO_OPTION (Byte1, Option);
//
// check bit and print
//
if (BIT (Byte1, 0) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ACPI_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Byte1, 1) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_USB_LEGACY_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Byte1, 2) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AGP_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Byte1, 3) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_I2O_BOOT_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Byte1, 4) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LS_120_BOOT_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Byte1, 5) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ATAPI_ZIP_DRIVE), gShellDebug1HiiHandle);
}
if (BIT (Byte1, 6) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_1394_BOOT_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Byte1, 7) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMART_BATTERY_SUPPORTED), gShellDebug1HiiHandle);
}
}
/**
Display Bios Characteristice extensions2 information.
@param[in] byte2 The information.
@param[in] Option The optional information.
**/
VOID
DisplayBiosCharacteristicsExt2 (
IN UINT8 byte2,
IN UINT8 Option
)
{
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION_2), gShellDebug1HiiHandle);
//
// Print option
//
PRINT_INFO_OPTION (byte2, Option);
if (BIT (byte2, 0) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_BOOT_SPEC_SUPP), gShellDebug1HiiHandle);
}
if (BIT (byte2, 1) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FUNCTION_KEY_INIT), gShellDebug1HiiHandle);
}
if (AE_SMBIOS_VERSION (0x2, 0x4)) {
if (BIT (byte2, 2) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLE_TAR_CONT_DIST), gShellDebug1HiiHandle);
}
if (AE_SMBIOS_VERSION (0x2, 0x7)) {
if (BIT (byte2, 3) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UEFI_SPEC_SUPPORT), gShellDebug1HiiHandle);
}
if (BIT (byte2, 4) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VIRTUAL_MACHINE), gShellDebug1HiiHandle);
}
if (BIT (byte2, 5) != 0) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MCFG_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (byte2, 6) != 0) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MCFG_ENABLED), gShellDebug1HiiHandle);
}
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 5);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 3);
}
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 2);
}
}
/**
Display Processor Information (Type 4) information.
@param[in] Family The family value.
@param[in] Option The option value.
**/
VOID
DisplayProcessorFamily (
UINT8 Family,
UINT8 Option
)
{
//
// Print prompt message
//
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROCESSOR_FAMILY), gShellDebug1HiiHandle);
//
// Print option
//
PRINT_INFO_OPTION (Family, Option);
//
// Use switch to check
//
switch (Family) {
case 0x01:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER), gShellDebug1HiiHandle);
break;
case 0x02:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
break;
case 0x03:
Print (L"8086\n");
break;
case 0x04:
Print (L"80286\n");
break;
case 0x05:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL386_PROCESSOR), gShellDebug1HiiHandle);
break;
case 0x06:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL486_PROCESSOR), gShellDebug1HiiHandle);
break;
case 0x07:
Print (L"8087\n");
break;
case 0x08:
Print (L"80287\n");
break;
case 0x09:
Print (L"80387\n");
break;
case 0x0A:
Print (L"80487\n");
break;
case 0x0B:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PROC_FAMILY), gShellDebug1HiiHandle);
break;
case 0x0C:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PRO_PROC), gShellDebug1HiiHandle);
break;
case 0x0D:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_II_PROC), gShellDebug1HiiHandle);
break;
case 0x0E:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PROC_MMX), gShellDebug1HiiHandle);
break;
case 0x0F:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CELERON_PROC), gShellDebug1HiiHandle);
break;
case 0x10:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_XEON_PROC), gShellDebug1HiiHandle);
break;
case 0x11:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_III_PROC), gShellDebug1HiiHandle);
break;
case 0x12:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_M1_FAMILY), gShellDebug1HiiHandle);
break;
case 0x13:
Print (L"M2 Family\n");
break;
case 0x14:
Print (L"Intel Celeron M\n");
break;
case 0x15:
Print (L"Intel Pentium 4 HT\n");
break;
case 0x18:
Print (L"AMD Duron\n");
break;
case 0x19:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_K5_FAMILY), gShellDebug1HiiHandle);
break;
case 0x1A:
Print (L"K6 Family\n");
break;
case 0x1B:
Print (L"K6-2\n");
break;
case 0x1C:
Print (L"K6-3\n");
break;
case 0x1D:
Print (L"AMD Althon Processor Family\n");
break;
case 0x1E:
Print (L"AMD 29000 Family\n");
break;
case 0x1F:
Print (L"K6-2+\n");
break;
case 0x20:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_FAMILY), gShellDebug1HiiHandle);
break;
case 0x21:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_601), gShellDebug1HiiHandle);
break;
case 0x22:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_603), gShellDebug1HiiHandle);
break;
case 0x23:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_603_PLUS), gShellDebug1HiiHandle);
break;
case 0x24:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_604), gShellDebug1HiiHandle);
break;
case 0x25:
Print (L"Power PC 620\n");
break;
case 0x26:
Print (L"Power PC 704\n");
break;
case 0x27:
Print (L"Power PC 750\n");
break;
case 0x28:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_DUO), gShellDebug1HiiHandle);
break;
case 0x29:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_DUO_MOBILE), gShellDebug1HiiHandle);
break;
case 0x2A:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_SOLO_MOBILE), gShellDebug1HiiHandle);
break;
case 0x2B:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_ATOM), gShellDebug1HiiHandle);
break;
case 0x2C:
Print (L"Intel(R) Core(TM) M processor\n");
break;
case 0x2D:
Print (L"Intel(R) Core(TM) m3 processor\n");
break;
case 0x2E:
Print (L"Intel(R) Core(TM) m5 processor\n");
break;
case 0x2F:
Print (L"Intel(R) Core(TM) m7 processor\n");
break;
case 0x30:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ALPHA_FAMILY_2), gShellDebug1HiiHandle);
break;
case 0x31:
Print (L"Alpha 21064\n");
break;
case 0x32:
Print (L"Alpha 21066\n");
break;
case 0x33:
Print (L"Alpha 21164\n");
break;
case 0x34:
Print (L"Alpha 21164PC\n");
break;
case 0x35:
Print (L"Alpha 21164a\n");
break;
case 0x36:
Print (L"Alpha 21264\n");
break;
case 0x37:
Print (L"Alpha 21364\n");
break;
case 0x38:
Print (L"AMD Turion II Ultra Dual-Core Mobile M Processor Family\n");
break;
case 0x39:
Print (L"AMD Turion II Dual-Core Mobile M Processor Family\n");
break;
case 0x3A:
Print (L"AMD Althon II Dual-Core M Processor Family\n");
break;
case 0x3B:
Print (L"AMD Opteron 6100 Series Processor\n");
break;
case 0x3C:
Print (L"AMD Opteron 4100 Series Processor\n");
break;
case 0x3D:
Print (L"AMD Opteron 6200 Series Processor\n");
break;
case 0x3E:
Print (L"AMD Opteron 4200 Series Processor\n");
break;
case 0x3F:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_FX_SERIES), gShellDebug1HiiHandle);
break;
case 0x40:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MIPS_FAMILY), gShellDebug1HiiHandle);
break;
case 0x41:
Print (L"MIPS R4000\n");
break;
case 0x42:
Print (L"MIPS R4200\n");
break;
case 0x43:
Print (L"MIPS R4400\n");
break;
case 0x44:
Print (L"MIPS R4600\n");
break;
case 0x45:
Print (L"MIPS R10000\n");
break;
case 0x46:
Print (L"AMD C-Series Processor\n");
break;
case 0x47:
Print (L"AMD E-Series Processor\n");
break;
case 0x48:
Print (L"AMD A-Series Processor\n");
break;
case 0x49:
Print (L"AMD G-Series Processor\n");
break;
case 0x4A:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_Z_SERIES), gShellDebug1HiiHandle);
break;
case 0x4B:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_R_SERIES), gShellDebug1HiiHandle);
break;
case 0x4C:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_4300_SERIES), gShellDebug1HiiHandle);
break;
case 0x4D:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_6300_SERIES), gShellDebug1HiiHandle);
break;
case 0x4E:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_3300_SERIES), gShellDebug1HiiHandle);
break;
case 0x4F:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_FIREPRO_SERIES), gShellDebug1HiiHandle);
break;
case 0x50:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SPARC_FAMILY), gShellDebug1HiiHandle);
break;
case 0x51:
Print (L"SuperSparc\n");
break;
case 0x52:
Print (L"microSparc II\n");
break;
case 0x53:
Print (L"microSparc IIep\n");
break;
case 0x54:
Print (L"UltraSparc\n");
break;
case 0x55:
Print (L"UltraSparc II\n");
break;
case 0x56:
Print (L"UltraSparcIIi\n");
break;
case 0x57:
Print (L"UltraSparcIII\n");
break;
case 0x58:
Print (L"UltraSparcIIIi\n");
break;
case 0x60:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_68040_FAMILY), gShellDebug1HiiHandle);
break;
case 0x61:
Print (L"68xx\n");
break;
case 0x62:
Print (L"68000\n");
break;
case 0x63:
Print (L"68010\n");
break;
case 0x64:
Print (L"68020\n");
break;
case 0x65:
Print (L"68030\n");
break;
case 0x66:
Print (L"AMD Athlon(TM) X4 Quad-Core Processor Family\n");
break;
case 0x67:
Print (L"AMD Opteron(TM) X1000 Series Processor\n");
break;
case 0x68:
Print (L"AMD Opteron(TM) X2000 Series APU\n");
break;
case 0x69:
Print (L"AMD Opteron(TM) A-Series Processor\n");
break;
case 0x6A:
Print (L"AMD Opteron(TM) X3000 Series APU\n");
break;
case 0x6B:
Print (L"AMD Zen Processor Family\n");
break;
case 0x70:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HOBBIT_FAMILY), gShellDebug1HiiHandle);
break;
case 0x78:
Print (L"Crusoe TM5000\n");
break;
case 0x79:
Print (L"Crusoe TM3000\n");
break;
case 0x7A:
Print (L"Efficeon TM8000\n");
break;
case 0x80:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WEITEK), gShellDebug1HiiHandle);
break;
case 0x82:
Print (L"Itanium\n");
break;
case 0x83:
Print (L"AMD Athlon64\n");
break;
case 0x84:
Print (L"AMD Opteron\n");
break;
case 0x85:
Print (L"AMD Sempron\n");
break;
case 0x86:
Print (L"AMD Turion64 Mobile\n");
break;
case 0x87:
Print (L"Dual-Core AMD Opteron\n");
break;
case 0x88:
Print (L"AMD Athlon 64X2 DualCore\n");
break;
case 0x89:
Print (L"AMD Turion 64X2 Mobile\n");
break;
case 0x8A:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_QUAD_CORE), gShellDebug1HiiHandle);
break;
case 0x8B:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_THIRD_GENERATION), gShellDebug1HiiHandle);
break;
case 0x8C:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_FX_QUAD_CORE), gShellDebug1HiiHandle);
break;
case 0x8D:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_X4_QUAD_CORE), gShellDebug1HiiHandle);
break;
case 0x8E:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_X2_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0x8F:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_ATHLON_X2_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0x90:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PA_RISC_FAMILY), gShellDebug1HiiHandle);
break;
case 0x91:
Print (L"PA-RISC 8500\n");
break;
case 0x92:
Print (L"PA-RISC 8000\n");
break;
case 0x93:
Print (L"PA-RISC 7300LC\n");
break;
case 0x94:
Print (L"PA-RISC 7200\n");
break;
case 0x95:
Print (L"PA-RISC 7100LC\n");
break;
case 0x96:
Print (L"PA-RISC 7100\n");
break;
case 0xA0:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_V30_FAMILY), gShellDebug1HiiHandle);
break;
case 0xA1:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3200_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
break;
case 0xA2:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3000_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0xA3:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5300_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
break;
case 0xA4:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5100_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0xA5:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5000_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0xA6:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_LV_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0xA7:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_ULV_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0xA8:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7100_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0xA9:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5400_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
break;
case 0xAA:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_QUAD_CORE), gShellDebug1HiiHandle);
break;
case 0xAB:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5200_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0xAC:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7200_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0xAD:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7300_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
break;
case 0xAE:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7400_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
break;
case 0xAF:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7400_SERIES_MULTI_CORE), gShellDebug1HiiHandle);
break;
case 0xB0:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_III_XEON), gShellDebug1HiiHandle);
break;
case 0xB1:
Print (L"Pentium III Processorwith Intel SpeedStep Technology\n");
break;
case 0xB2:
Print (L"Pentium 4 processor\n");
break;
case 0xB3:
Print (L"Intel Xeon Processor\n");
break;
case 0xB4:
Print (L"AS400 Family\n");
break;
case 0xB5:
Print (L"Intel Xeon processor MP\n");
break;
case 0xB6:
Print (L"AMD Althon XP Processor Family\n");
break;
case 0xB7:
Print (L"AMD Althon MP Promcessor Family\n");
break;
case 0xB8:
Print (L"Intel Itanium 2 processor\n");
break;
case 0xB9:
Print (L"Intel Penium M processor\n");
break;
case 0xBA:
Print (L"Intel Celeron D processor\n");
break;
case 0xBB:
Print (L"Intel Pentium D processor\n");
break;
case 0xBC:
Print (L"Intel Pentium Processor Extreme Edition\n");
break;
case 0xBD:
Print (L"Intel Core Solo Processor\n");
break;
case 0xBF:
Print (L"Intel Core 2 Duo Processor\n");
break;
case 0xC0:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO), gShellDebug1HiiHandle);
break;
case 0xC1:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_EXTREME), gShellDebug1HiiHandle);
break;
case 0xC2:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_QUAD), gShellDebug1HiiHandle);
break;
case 0xC3:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_EXTREME), gShellDebug1HiiHandle);
break;
case 0xC4:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_DUO_MOBILE), gShellDebug1HiiHandle);
break;
case 0xC5:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO_MOBILE), gShellDebug1HiiHandle);
break;
case 0xC6:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_I7), gShellDebug1HiiHandle);
break;
case 0xC7:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CELERON_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0xC8:
Print (L"IBM 390\n");
break;
case 0xC9:
Print (L"G4\n");
break;
case 0xCA:
Print (L"G5\n");
break;
case 0xCB:
Print (L"G6\n");
break;
case 0xCC:
Print (L"zArchitecture\n");
break;
case 0xCD:
Print (L"Intel Core i5 processor\n");
break;
case 0xCE:
Print (L"Intel Core i3 processor\n");
break;
case 0xD2:
Print (L"ViaC7M\n");
break;
case 0xD3:
Print (L"ViaC7D\n");
break;
case 0xD4:
Print (L"ViaC7\n");
break;
case 0xD5:
Print (L"Eden\n");
break;
case 0xD6:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_MULTI_CORE), gShellDebug1HiiHandle);
break;
case 0xD7:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0xD8:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
break;
case 0xDA:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0xDB:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
break;
case 0xDD:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0xDE:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_QUAD_CORE), gShellDebug1HiiHandle);
break;
case 0xDF:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_MULTI_CORE), gShellDebug1HiiHandle);
break;
case 0xE0:
Print (L"Multi-Core Intel Xeon processor 3400 Series\n");
break;
case 0xE4:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_3000_SERIES), gShellDebug1HiiHandle);
break;
case 0xE5:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_SEMPRON_II), gShellDebug1HiiHandle);
break;
case 0xE6:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_EMBEDDED_OPTERON_QUAD_CORE), gShellDebug1HiiHandle);
break;
case 0xE7:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_TRIPLE_CORE), gShellDebug1HiiHandle);
break;
case 0xE8:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_TURION_ULTRA_DUAL_CORE_MOBILE), gShellDebug1HiiHandle);
break;
case 0xE9:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_TURION_DUAL_CORE_MOBILE), gShellDebug1HiiHandle);
break;
case 0xEA:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_ATHLON_DUAL_CORE), gShellDebug1HiiHandle);
break;
case 0xEB:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_SEMPRON_SI), gShellDebug1HiiHandle);
break;
case 0xEC:
Print (L"AMD Phenom II Processor Family\n");
break;
case 0xED:
Print (L"AMD Althon II Processor Family\n");
break;
case 0xEE:
Print (L"Six-Core AMD Opteron Processor Family\n");
break;
case 0xEF:
Print (L"AMD Sempron M Processor Family\n");
break;
case 0xFA:
Print (L"i860\n");
break;
case 0xFB:
Print (L"i960\n");
break;
default:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY), gShellDebug1HiiHandle);
}
//
// end switch
//
}
/**
Display processor family information.
@param[in] Family2 The family value.
@param[in] Option The option value.
**/
VOID
DisplayProcessorFamily2 (
IN UINT16 Family2,
IN UINT8 Option
)
{
//
// Print prompt message
//
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROCESSOR_FAMILY), gShellDebug1HiiHandle);
//
// Print option
//
PRINT_INFO_OPTION (Family2, Option);
//
// Use switch to check
//
switch (Family2) {
case 0x100:
Print (L"ARMv7\n");
break;
case 0x101:
Print (L"ARMv8\n");
break;
case 0x104:
Print (L"SH-3\n");
break;
case 0x105:
Print (L"SH-4\n");
break;
case 0x118:
Print (L"ARM\n");
break;
case 0x119:
Print (L"StrongARM\n");
break;
case 0x12C:
Print (L"6x86\n");
break;
case 0x12D:
Print (L"MediaGX\n");
break;
case 0x12E:
Print (L"MII\n");
break;
case 0x140:
Print (L"WinChip\n");
break;
case 0x15E:
Print (L"DSP\n");
break;
case 0x1F4:
Print (L"Video Processor\n");
break;
default:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY), gShellDebug1HiiHandle);
}
}
/**
Display processor voltage information.
@param[in] Voltage The Voltage.
Bit 7 Set to 0, indicating 'legacy' mode for processor voltage
Bits 6:4 Reserved, must be zero
Bits 3:0 Voltage Capability.
A Set bit indicates that the voltage is supported.
Bit 0 - 5V
Bit 1 - 3.3V
Bit 2 - 2.9V
Bit 3 - Reserved, must be zero.
Note:
Setting of multiple bits indicates the socket is configurable
If bit 7 is set to 1, the remaining seven bits of the field are set to
contain the processor's current voltage times 10.
For example, the field value for a processor voltage of 1.8 volts would be
92h = 80h + (1.8 * 10) = 80h + 18 = 80h +12h.
@param[in] Option The option.
**/
VOID
DisplayProcessorVoltage (
IN UINT8 Voltage,
IN UINT8 Option
)
{
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_INFO), gShellDebug1HiiHandle);
//
// Print option
//
PRINT_INFO_OPTION (Voltage, Option);
if (BIT (Voltage, 7) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_CURRENT_VOLTAGE), gShellDebug1HiiHandle, (Voltage - 0x80));
} else {
if (BIT (Voltage, 0) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_5V_SUPOPRTED), gShellDebug1HiiHandle);
}
if (BIT (Voltage, 1) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_33V_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Voltage, 2) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_29V_SUPPORTED), gShellDebug1HiiHandle);
}
//
// check the reserved zero bits:
//
if (BIT (Voltage, 3) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT3_NOT_ZERO), gShellDebug1HiiHandle);
}
if (BIT (Voltage, 4) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle);
}
if (BIT (Voltage, 5) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT5_NOT_ZERO), gShellDebug1HiiHandle);
}
if (BIT (Voltage, 6) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT6_NOT_ZERO), gShellDebug1HiiHandle);
}
}
}
/**
Display processor information.
@param[in] Status The status.
Bit 7 Reserved, must be 0
Bit 6 CPU Socket Populated
1 - CPU Socket Populated
0 - CPU Socket Unpopulated
Bits 5:3 Reserved, must be zero
Bits 2:0 CPU Status
0h - Unknown
1h - CPU Enabled
2h - CPU Disabled by User via BIOS Setup
3h - CPU Disabled By BIOS (POST Error)
4h - CPU is Idle, waiting to be enabled.
5-6h - Reserved
7h - Other
@param[in] Option The option
**/
VOID
DisplayProcessorStatus (
IN UINT8 Status,
IN UINT8 Option
)
{
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_STATUS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Status, Option);
if (BIT (Status, 7) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT7_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (Status, 5) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT5_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (Status, 4) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (Status, 3) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT3_NOT_ZERO), gShellDebug1HiiHandle);
}
//
// Check BIT 6
//
if (BIT (Status, 6) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_SOCKET_POPULATED), gShellDebug1HiiHandle);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_SOCKET_UNPOPULATED), gShellDebug1HiiHandle);
}
//
// Check BITs 2:0
//
switch (Status & 0x07) {
case 0:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
break;
case 1:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_ENABLED), gShellDebug1HiiHandle);
break;
case 2:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_DISABLED_BY_USER), gShellDebug1HiiHandle);
break;
case 3:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_DIABLED_BY_BIOS), gShellDebug1HiiHandle);
break;
case 4:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_IDLE), gShellDebug1HiiHandle);
break;
case 7:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHERS), gShellDebug1HiiHandle);
break;
default:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);
}
}
/**
Display information about Memory Controller Information (Type 5).
@param[in] Size Memory size.
@param[in] SlotNum Which slot is this about.
@param[in] Option Option for the level of detail output required.
**/
VOID
DisplayMaxMemoryModuleSize (
IN UINT8 Size,
IN UINT8 SlotNum,
IN UINT8 Option
)
{
UINTN MaxSize;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SIZE_LARGEST_MEM), gShellDebug1HiiHandle);
//
// MaxSize is determined by follow formula
//
MaxSize = (UINTN) 1 << Size;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB), gShellDebug1HiiHandle, MaxSize);
if (Option >= SHOW_DETAIL) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MAX_AMOUNT_MEM), gShellDebug1HiiHandle);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB), gShellDebug1HiiHandle, MaxSize, SlotNum, MaxSize * SlotNum);
}
}
/**
Display information about memory configuration handles.
@param[in] Handles The buffer of handles to output info on.
@param[in] SlotNum The number of handles in the above buffer.
@param[in] Option Option for the level of detail output required.
**/
VOID
DisplayMemoryModuleConfigHandles (
IN UINT16 *Handles,
IN UINT8 SlotNum,
IN UINT8 Option
)
{
UINT8 Index;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLES_CONTROLLED), gShellDebug1HiiHandle, SlotNum);
if (Option >= SHOW_DETAIL) {
//
// No handle, Handles is INVALID.
//
if (SlotNum == 0) {
return ;
}
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLES_LIST_CONTROLLED), gShellDebug1HiiHandle);
for (Index = 0; Index < SlotNum; Index++) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLE), gShellDebug1HiiHandle, Index + 1, Handles[Index]);
}
}
}
/**
Display Memory Module Information (Type 6).
@param[in] BankConnections
@param[in] Option
**/
VOID
DisplayMmBankConnections (
IN UINT8 BankConnections,
IN UINT8 Option
)
{
UINT8 High;
UINT8 Low;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_CONNECTIONS), gShellDebug1HiiHandle);
//
// Print option
//
PRINT_INFO_OPTION (BankConnections, Option);
//
// Divide it to high and low
//
High = (UINT8) (BankConnections & 0xF0);
Low = (UINT8) (BankConnections & 0x0F);
if (High != 0xF) {
if (Low != 0xF) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS), gShellDebug1HiiHandle, High, Low, High, Low);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS_2), gShellDebug1HiiHandle, High, High);
}
} else {
if (Low != 0xF) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS_2), gShellDebug1HiiHandle, Low, Low);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_BANKS_CONNECTED), gShellDebug1HiiHandle);
}
}
}
/**
Display memory informcation.
Bits 0:6 Size (n),
where 2**n is the size in MB with three special-case values:
7Dh Not determinable (Installed Size only)
7Eh Module is installed, but no memory has been enabled
7Fh Not installed
Bit 7 Defines whether the memory module has a single- (0)
or double-bank (1) connection.
@param[in] Size - The size
@param[in] Option - The option
**/
VOID
DisplayMmMemorySize (
IN UINT8 Size,
IN UINT8 Option
)
{
UINT8 Value;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEMORY_SIZE), gShellDebug1HiiHandle);
//
// Print option
//
PRINT_INFO_OPTION (Size, Option);
//
// Get the low bits(0-6 bit)
//
Value = (UINT8) (Size & 0x7F);
if (Value == 0x7D) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_SIZE_NOT_DETERMINABLE), gShellDebug1HiiHandle);
} else if (Value == 0x7E) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MODULE_INSTALLED), gShellDebug1HiiHandle);
} else if (Value == 0x7F) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_INSTALLED), gShellDebug1HiiHandle);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_SIZE), gShellDebug1HiiHandle, 1 << Value);
}
if (BIT (Size, 7) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_MODULE_DOUBLE_BANK), gShellDebug1HiiHandle);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_MODULE_SINGLE_BANK), gShellDebug1HiiHandle);
}
}
/**
Display Cache Configuration.
@param[in] CacheConfiguration Cache Configuration.
Bits 15:10 Reserved, must be 0
Bits 9:8 Operational Mode
0h - Write Through
1h - Write Back
2h - Varies with Memory Address
3h - Unknown
Bit 7 Enabled/Disabled
1 - Enabled
0 - Disabled
Bits 6:5 Location
0h - Internal
1h - External
2h - Reserved
3h - Unknown
Bit 4 Reserved, must be zero
Bit 3 Cache Socketed
1 - Socketed
0 - Unsocketed
Bits 2:0 Cache Level
1 through 8 (For example, an L1 cache would
use value 000b and an L3 cache would use 010b.)
@param[in] Option The option
**/
VOID
DisplayCacheConfiguration (
IN UINT16 CacheConfiguration,
IN UINT8 Option
)
{
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_CONFIGURATION), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (CacheConfiguration, Option);
if (BIT (CacheConfiguration, 15) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT15_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (CacheConfiguration, 14) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT14_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (CacheConfiguration, 13) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT13_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (CacheConfiguration, 12) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT12_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (CacheConfiguration, 11) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT11_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (CacheConfiguration, 10) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT10_NOT_ZERO), gShellDebug1HiiHandle);
} else if (BIT (CacheConfiguration, 4) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle);
}
//
// Check BITs 9:8
//
switch ((CacheConfiguration & 0x300) >> 8) {
case 0:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_WRITE_THROUGH), gShellDebug1HiiHandle);
break;
case 1:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_WRITE_BACK), gShellDebug1HiiHandle);
break;
case 2:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_VARIES_WITH_MEM_ADDR), gShellDebug1HiiHandle);
break;
case 3:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
break;
}
//
// Check BIT 7
//
if (BIT (CacheConfiguration, 7) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED), gShellDebug1HiiHandle);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
}
//
// Check BITs 6:5
//
switch ((CacheConfiguration & 0x60) >> 5) {
case 0:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_INTERNAL), gShellDebug1HiiHandle);
break;
case 1:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_EXTERNAL), gShellDebug1HiiHandle);
break;
case 2:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);
break;
case 3:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
break;
}
//
// Check BIT 3
//
if (BIT (CacheConfiguration, 3) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_SOCKETED), gShellDebug1HiiHandle);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_NOT_SOCKETED), gShellDebug1HiiHandle);
}
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_LEVEL), gShellDebug1HiiHandle, (CacheConfiguration & 0x07) + 1);
}
/**
The Slot ID field of the System Slot structure provides a mechanism to
correlate the physical attributes of the slot to its logical access method
(which varies based on the Slot Type field).
@param[in] SlotId - The slot ID
@param[in] SlotType - The slot type
@param[in] Option - The Option
**/
VOID
DisplaySystemSlotId (
IN UINT16 SlotId,
IN UINT8 SlotType,
IN UINT8 Option
)
{
//
// Display slot type first
//
DisplaySystemSlotType (SlotType, Option);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SLOT_ID), gShellDebug1HiiHandle);
//
// print option
//
PRINT_INFO_OPTION (SlotType, Option);
switch (SlotType) {
//
// Slot Type: MCA
//
case 0x04:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LOGICAL_MICRO_CHAN), gShellDebug1HiiHandle);
if (SlotId > 0 && SlotId < 15) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_D), gShellDebug1HiiHandle, SlotId);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_NOT_1_15), gShellDebug1HiiHandle);
}
break;
//
// EISA
//
case 0x05:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LOGICAL_EISA_NUM), gShellDebug1HiiHandle);
if (SlotId > 0 && SlotId < 15) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_D), gShellDebug1HiiHandle, SlotId);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_NOT_1_15), gShellDebug1HiiHandle);
}
break;
//
// Slot Type: PCI
//
case 0x06:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId);
break;
//
// PCMCIA
//
case 0x07:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_IDENTIFIES_ADAPTER_NUM), gShellDebug1HiiHandle, SlotId);
break;
//
// Slot Type: PCI-E
//
case 0xA5:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId);
break;
default:
if ((SlotType >= 0x0E && SlotType <= 0x12) || (SlotType >= 0xA6 && SlotType <= 0xB6)){
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_SLOT_ID), gShellDebug1HiiHandle);
}
}
}
/**
Display System Boot Information (Type 32) information.
@param[in] Parameter The parameter.
@param[in] Option The options.
**/
VOID
DisplaySystemBootStatus (
IN UINT8 Parameter,
IN UINT8 Option
)
{
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_BOOT_STATUS), gShellDebug1HiiHandle);
//
// Print option
//
PRINT_INFO_OPTION (Parameter, Option);
//
// Check value and print
//
if (Parameter == 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_ERRORS_DETECTED), gShellDebug1HiiHandle);
} else if (Parameter == 1) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_BOOTABLE_MEDIA), gShellDebug1HiiHandle);
} else if (Parameter == 2) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NORMAL_OP_SYSTEM), gShellDebug1HiiHandle);
} else if (Parameter == 3) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FIRMWARE_DETECTED), gShellDebug1HiiHandle);
} else if (Parameter == 4) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM), gShellDebug1HiiHandle);
} else if (Parameter == 5) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_USER_REQUESTED_BOOT), gShellDebug1HiiHandle);
} else if (Parameter == 6) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_SECURITY_VIOLATION), gShellDebug1HiiHandle);
} else if (Parameter == 7) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PREV_REQ_IMAGE), gShellDebug1HiiHandle);
} else if (Parameter == 8) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WATCHDOG_TIMER), gShellDebug1HiiHandle);
} else if (Parameter >= 9 && Parameter <= 127) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FUTURE_ASSIGNMENT), gShellDebug1HiiHandle);
} else if (Parameter >= 128 && Parameter <= 191) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VENDOR_OEM_SPECIFIC), gShellDebug1HiiHandle);
} else if (Parameter >= 192) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRODUCT_SPEC_IMPLMENTATION), gShellDebug1HiiHandle);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_VALUE), gShellDebug1HiiHandle);
}
}
/**
Display Portable Battery (Type 22) information.
The date the cell pack was manufactured, in packed format:
Bits 15:9 Year, biased by 1980, in the range 0 to 127.
Bits 8:5 Month, in the range 1 to 12.
Bits 4:0 Date, in the range 1 to 31.
For example, 01 February 2000 would be identified as
0010 1000 0100 0001b (0x2841).
@param[in] Date The date
@param[in] Option The option
**/
VOID
DisplaySBDSManufactureDate (
IN UINT16 Date,
IN UINT8 Option
)
{
UINTN Day;
UINTN Month;
UINTN Year;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SBDS_MANUFACTURE_DATE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Date, Option);
//
// Print date
//
Day = Date & 0x001F;
Month = (Date & 0x01E0) >> 5;
Year = ((Date & 0xFE00) >> 9) + 1980;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MONTH_DAY_YEAR), gShellDebug1HiiHandle, Day, Month, Year);
}
/**
Display System Reset (Type 23) information.
Identifies the system-reset capabilities for the system.
Bits 7:6 Reserved for future assignment via this specification, set to 00b.
Bit 5 System contains a watchdog timer, either True (1) or False (0).
Bits 4:3 Boot Option on Limit.
Identifies the system action to be taken when the Reset Limit is reached, one of:
00b Reserved, do not use.
01b Operating system
10b System utilities
11b Do not rebootBits
2:1 Boot Option. Indicates the action to be taken following a watchdog reset, one of:
00b Reserved, do not use.
01b Operating system
10b System utilities
11b Do not reboot
Bit 0 Status.
1b The system reset is enabled by the user
0b The system reset is not enabled by the user
@param[in] Reset Reset
@param[in] Option The option
**/
VOID
DisplaySystemResetCapabilities (
IN UINT8 Reset,
IN UINT8 Option
)
{
UINTN Temp;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_RESET_CAPABILITIES), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Reset, Option);
//
// Check reserved bits 7:6
//
if ((Reset & 0xC0) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RESERVED_ZERO), gShellDebug1HiiHandle);
}
//
// Watch dog
//
if (BIT (Reset, 5) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WATCHDOG_TIMER_2), gShellDebug1HiiHandle);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_NOT_CONTAIN_TIMER), gShellDebug1HiiHandle);
}
//
// Boot Option on Limit
//
Temp = (Reset & 0x18) >> 3;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_OPTION_LIMIT), gShellDebug1HiiHandle);
switch (Temp) {
case 0:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);
break;
case 1:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM_2), gShellDebug1HiiHandle);
break;
case 2:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_UTIL), gShellDebug1HiiHandle);
break;
case 3:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DO_NOT_REBOOT_BITS), gShellDebug1HiiHandle);
break;
}
//
// Boot Option
//
Temp = (Reset & 0x06) >> 1;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_OPTION), gShellDebug1HiiHandle);
switch (Temp) {
case 0:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);
break;
case 1:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM_2), gShellDebug1HiiHandle);
break;
case 2:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_UTIL), gShellDebug1HiiHandle);
break;
case 3:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DO_NOT_REBOOT), gShellDebug1HiiHandle);
break;
}
//
// Reset enable flag
//
if ((Reset & 0x01) != 0) {
Print (L"The system reset is enabled by the user\n");
} else {
Print (L"The system reset is disabled by the user\n");
}
}
/**
Display Hardware Security (Type 24) information.
Identifies the password and reset status for the system:
Bits 7:6 Power-on Password Status, one of:
00b Disabled
01b Enabled
10b Not Implemented
11b Unknown
Bits 5:4 Keyboard Password Status, one of:
00b Disabled
01b Enabled
10b Not Implemented
11b Unknown
Bits 3:2 Administrator Password Status, one of:
00b Disabled
01b Enabled
10b Not Implemented
11b Unknown
Bits 1:0 Front Panel Reset Status, one of:
00b Disabled
01b Enabled
10b Not Implemented
11b Unknown
@param[in] Settings The device settings.
@param[in] Option The device options.
**/
VOID
DisplayHardwareSecuritySettings (
IN UINT8 Settings,
IN UINT8 Option
)
{
UINTN Temp;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HARDWARE_SECURITY_SET), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Settings, Option);
//
// Power-on Password Status
//
Temp = (Settings & 0xC0) >> 6;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_ON_PASSWORD), gShellDebug1HiiHandle);
switch (Temp) {
case 0:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
break;
case 1:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);
break;
case 2:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);
break;
case 3:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
break;
}
//
// Keyboard Password Status
//
Temp = (Settings & 0x30) >> 4;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_PASSWORD), gShellDebug1HiiHandle);
switch (Temp) {
case 0:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
break;
case 1:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);
break;
case 2:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);
break;
case 3:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
break;
}
//
// Administrator Password Status
//
Temp = (Settings & 0x0C) >> 2;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ADMIN_PASSWORD_STATUS), gShellDebug1HiiHandle);
switch (Temp) {
case 0:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
break;
case 1:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);
break;
case 2:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);
break;
case 3:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
break;
}
//
// Front Panel Reset Status
//
Temp = Settings & 0x3;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FRONT_PANEL_RESET), gShellDebug1HiiHandle);
switch (Temp) {
case 0:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);
break;
case 1:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);
break;
case 2:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);
break;
case 3:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
break;
}
}
/**
Display Out-of-Band Remote Access (Type 30) information.
@param[in] Connections The device characteristics.
@param[in] Option The device options.
**/
VOID
DisplayOBRAConnections (
IN UINT8 Connections,
IN UINT8 Option
)
{
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CONNECTIONS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Connections, Option);
//
// Check reserved bits 7:2
//
if ((Connections & 0xFC) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RESERVED_ZERO_2), gShellDebug1HiiHandle);
}
//
// Outbound Connection
//
if (BIT (Connections, 1) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OUTBOUND_CONN_ENABLED), gShellDebug1HiiHandle);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTUBOUND_CONN_DISABLED), gShellDebug1HiiHandle);
}
//
// Inbound Connection
//
if (BIT (Connections, 0) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INBOIUND_CONN_ENABLED), gShellDebug1HiiHandle);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INBOUND_CONN_DISABLED), gShellDebug1HiiHandle);
}
}
/**
Display System Power Supply (Type 39) information.
@param[in] Characteristics The device characteristics.
@param[in] Option The device options.
**/
VOID
DisplaySPSCharacteristics (
IN UINT16 Characteristics,
IN UINT8 Option
)
{
UINTN Temp;
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_CHAR), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Characteristics, Option);
//
// Check reserved bits 15:14
//
if ((Characteristics & 0xC000) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_15_14_RSVD), gShellDebug1HiiHandle);
}
//
// Bits 13:10 - DMTF Power Supply Type
//
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TYPE), gShellDebug1HiiHandle);
Temp = (Characteristics & 0x1C00) >> 10;
switch (Temp) {
case 1:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle);
break;
case 2:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
break;
case 3:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LINEAR), gShellDebug1HiiHandle);
break;
case 4:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SWITCHING), gShellDebug1HiiHandle);
break;
case 5:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BATTERY), gShellDebug1HiiHandle);
break;
case 6:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UPS), gShellDebug1HiiHandle);
break;
case 7:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CONVERTER), gShellDebug1HiiHandle);
break;
case 8:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_REGULATOR), gShellDebug1HiiHandle);
break;
default:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_2), gShellDebug1HiiHandle);
}
//
// Bits 9:7 - Status
//
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STATUS_DASH), gShellDebug1HiiHandle);
Temp = (Characteristics & 0x380) >> 7;
switch (Temp) {
case 1:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle);
break;
case 2:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
break;
case 3:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OK), gShellDebug1HiiHandle);
break;
case 4:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NON_CRITICAL), gShellDebug1HiiHandle);
break;
case 5:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CRITICAL_POWER_SUPPLY), gShellDebug1HiiHandle);
break;
default:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED), gShellDebug1HiiHandle);
}
//
// Bits 6:3 - DMTF Input Voltage Range Switching
//
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INPUT_VOLTAGE_RANGE), gShellDebug1HiiHandle);
Temp = (Characteristics & 0x78) >> 3;
switch (Temp) {
case 1:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle);
break;
case 2:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);
break;
case 3:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MANUAL), gShellDebug1HiiHandle);
break;
case 4:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AUTO_SWITCH), gShellDebug1HiiHandle);
break;
case 5:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WIDE_RANGE), gShellDebug1HiiHandle);
break;
case 6:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_APPLICABLE), gShellDebug1HiiHandle);
break;
default:
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_3), gShellDebug1HiiHandle);
break;
}
//
// Power supply is unplugged from the wall
//
if (BIT (Characteristics, 2) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_UNPLUGGED), gShellDebug1HiiHandle);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_PLUGGED), gShellDebug1HiiHandle);
}
//
// Power supply is present
//
if (BIT (Characteristics, 1) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_PRESENT), gShellDebug1HiiHandle);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_PRESENT), gShellDebug1HiiHandle);
}
//
// hot replaceable
//
if (BIT (Characteristics, 0) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_REPLACE), gShellDebug1HiiHandle);
} else {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_REPLACE), gShellDebug1HiiHandle);
}
}
/**
Display TPM Device (Type 43) Characteristics.
@param[in] Chara The information bits.
@param[in] Option The optional information.
**/
VOID
DisplayTpmDeviceCharacteristics (
IN UINT64 Chara,
IN UINT8 Option
)
{
//
// Print header
//
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CHAR), gShellDebug1HiiHandle);
//
// print option
//
PRINT_INFO_OPTION (Chara, Option);
//
// Check all the bits and print information
// This function does not use Table because table of bits
// are designed not to deal with UINT64
//
if (BIT (Chara, 0) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 1) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle);
}
if (BIT (Chara, 2) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CHAR_NOT_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 3) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_FWU), gShellDebug1HiiHandle);
}
if (BIT (Chara, 4) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_PLAT_SW), gShellDebug1HiiHandle);
}
if (BIT (Chara, 5) != 0) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_OEM), gShellDebug1HiiHandle);
}
//
// Just print the Reserved
//
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_06_63), gShellDebug1HiiHandle);
}
|
971266931c28d13061b486d34f40a39a978b6e34
|
bed3ac926beac0f4e0293303d7b2a6031ee476c9
|
/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5HP.c
|
d1642237edae8d15678c424d9d50f4dc095f4cd6
|
[
"IJG",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"SMLNJ",
"BSD-3-Clause",
"BSD-4.3TAHOE",
"LicenseRef-scancode-free-unknown",
"Spencer-86",
"LicenseRef-scancode-llnl",
"FSFUL",
"Libpng",
"libtiff",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-hdf5",
"MIT",
"NTP",
"LicenseRef-scancode-mit-old-style",
"GPL-1.0-or-later",
"LicenseRef-scancode-unknown-license-reference",
"MPL-2.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] |
permissive
|
InsightSoftwareConsortium/ITK
|
ed9dbbc5b8b3f7511f007c0fc0eebb3ad37b88eb
|
3eb8fd7cdfbc5ac2d0c2e5e776848a4cbab3d7e1
|
refs/heads/master
| 2023-08-31T17:21:47.754304
| 2023-08-31T00:58:51
| 2023-08-31T14:12:21
| 800,928
| 1,229
| 656
|
Apache-2.0
| 2023-09-14T17:54:00
| 2010-07-27T15:48:04
|
C++
|
UTF-8
|
C
| false
| false
| 30,871
|
c
|
H5HP.c
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Purpose: Provides a heap abstract data type.
*
* (See chapter 11 - "Priority Queues" of _Algorithms_, by
* Sedgewick for additional information)
*
*/
/* Private headers needed */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5HPprivate.h" /* Heap routines */
#include "H5FLprivate.h" /* Memory management functions */
/* Local Macros */
#define H5HP_START_SIZE 16 /* Initial number of entries for heaps */
/* Private typedefs & structs */
/* Data structure for entries in the internal heap array */
typedef struct {
int val; /* Value to be used for heap condition */
H5HP_info_t *obj; /* Pointer to object stored in heap */
} H5HP_ent_t;
/* Main heap data structure */
struct H5HP_t {
H5HP_type_t type; /* Type of heap (minimum or maximum value at "top") */
size_t nobjs; /* Number of active objects in heap array */
size_t nalloc; /* Number of allocated locations in heap array */
H5HP_ent_t *heap; /* Pointer to array containing heap entries */
};
/* Static functions */
static herr_t H5HP__swim_max(H5HP_t *heap, size_t loc);
static herr_t H5HP__swim_min(H5HP_t *heap, size_t loc);
static herr_t H5HP__sink_max(H5HP_t *heap, size_t loc);
static herr_t H5HP__sink_min(H5HP_t *heap, size_t loc);
/* Declare a free list to manage the H5HP_t struct */
H5FL_DEFINE_STATIC(H5HP_t);
/* Declare a free list to manage sequences of H5HP_ent_t */
H5FL_SEQ_DEFINE_STATIC(H5HP_ent_t);
/*--------------------------------------------------------------------------
NAME
H5HP__swim_max
PURPOSE
Restore heap condition by moving an object upward
USAGE
herr_t H5HP__swim_max(heap, loc)
H5HP_t *heap; IN/OUT: Pointer to heap to modify
size_t loc; IN: Location to start from
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
Restore the heap condition for the heap's array by "swimming" the object
at a location upward.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
This routine is for "maximum" value heaps.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
H5HP__swim_max(H5HP_t *heap, size_t loc)
{
int val; /* Temporary copy value of object to move in heap */
H5HP_info_t *obj; /* Temporary pointer to object to move in heap */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Get copies of the information about the object to move in the heap */
val = heap->heap[loc].val;
obj = heap->heap[loc].obj;
/* Move object up in heap until it's reached the maximum location possible */
while (heap->heap[loc / 2].val < val) {
/* Move object "above" current location in heap down */
heap->heap[loc].val = heap->heap[loc / 2].val;
heap->heap[loc].obj = heap->heap[loc / 2].obj;
/* Update heap location for object which moved */
heap->heap[loc].obj->heap_loc = loc;
/* Move to location "above" current location */
loc = loc / 2;
} /* end while */
/* Put object into heap at correct location */
heap->heap[loc].val = val;
heap->heap[loc].obj = obj;
/* Update heap location for object */
heap->heap[loc].obj->heap_loc = loc;
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP__swim_max() */
/*--------------------------------------------------------------------------
NAME
H5HP__swim_min
PURPOSE
Restore heap condition by moving an object upward
USAGE
herr_t H5HP__swim_min(heap, loc)
H5HP_t *heap; IN/OUT: Pointer to heap to modify
size_t loc; IN: Location to start from
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
Restore the heap condition for the heap's array by "swimming" the object
at a location upward.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
This routine is for "minimum" value heaps.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
H5HP__swim_min(H5HP_t *heap, size_t loc)
{
int val; /* Temporary copy value of object to move in heap */
H5HP_info_t *obj; /* Temporary pointer to object to move in heap */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Get copies of the information about the object to move in the heap */
val = heap->heap[loc].val;
obj = heap->heap[loc].obj;
/* Move object up in heap until it's reached the minimum location possible */
while (heap->heap[loc / 2].val > val) {
/* Move object "above" current location in heap down */
heap->heap[loc].val = heap->heap[loc / 2].val;
heap->heap[loc].obj = heap->heap[loc / 2].obj;
/* Update heap location for object which moved */
heap->heap[loc].obj->heap_loc = loc;
/* Move to location "above" current location */
loc = loc / 2;
} /* end while */
/* Put object into heap at correct location */
heap->heap[loc].val = val;
heap->heap[loc].obj = obj;
/* Update heap location for object */
heap->heap[loc].obj->heap_loc = loc;
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP__swim_min() */
/*--------------------------------------------------------------------------
NAME
H5HP__sink_max
PURPOSE
Restore heap condition by moving an object downward
USAGE
herr_t H5HP__sink_max(heap, loc)
H5HP_t *heap; IN/OUT: Pointer to heap to modify
size_t loc; IN: Location to start from
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
Restore the heap condition for the heap's array by "sinking" the object
at a location downward.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
This routine is for "maximum" value heaps.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
H5HP__sink_max(H5HP_t *heap, size_t loc)
{
int val; /* Temporary copy value of object to move in heap */
void * obj; /* Temporary pointer to object to move in heap */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Get copies of the information about the object to move in the heap */
val = heap->heap[loc].val;
obj = heap->heap[loc].obj;
/* Move object up in heap until it's reached the maximum location possible */
while ((2 * loc) <= heap->nobjs) {
size_t new_loc = loc * 2; /* New object's potential location area */
/* Get the greater of the two objects below the location in heap */
if (new_loc < heap->nobjs && (heap->heap[new_loc].val < heap->heap[new_loc + 1].val))
new_loc++;
/* Check if the object is smaller than the larger of the objects below it */
/* If so, its in the correct location now, and we can get out */
if (val >= heap->heap[new_loc].val)
break;
/* Move the greater of the two objects below the current location up */
heap->heap[loc].val = heap->heap[new_loc].val;
heap->heap[loc].obj = heap->heap[new_loc].obj;
/* Update heap location for object which moved */
heap->heap[loc].obj->heap_loc = loc;
/* Move to location "below" current location */
loc = new_loc;
} /* end while */
/* Put object into heap at correct location */
heap->heap[loc].val = val;
heap->heap[loc].obj = (H5HP_info_t *)obj;
/* Update heap location for object */
heap->heap[loc].obj->heap_loc = loc;
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP__sink_max() */
/*--------------------------------------------------------------------------
NAME
H5HP__sink_min
PURPOSE
Restore heap condition by moving an object downward
USAGE
herr_t H5HP__sink_min(heap, loc)
H5HP_t *heap; IN/OUT: Pointer to heap to modify
size_t loc; IN: Location to start from
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
Restore the heap condition for the heap's array by "sinking" the object
at a location downward.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
This routine is for "minimum" value heaps.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
H5HP__sink_min(H5HP_t *heap, size_t loc)
{
int val; /* Temporary copy value of object to move in heap */
void * obj; /* Temporary pointer to object to move in heap */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Get copies of the information about the object to move in the heap */
val = heap->heap[loc].val;
obj = heap->heap[loc].obj;
/* Move object up in heap until it's reached the maximum location possible */
while ((2 * loc) <= heap->nobjs) {
size_t new_loc = loc * 2; /* New object's potential location area */
/* Get the lesser of the two objects below the location in heap */
if (new_loc < heap->nobjs && (heap->heap[new_loc].val > heap->heap[new_loc + 1].val))
new_loc++;
/* Check if the object is greater than the larger of the objects below it */
/* If so, its in the correct location now, and we can get out */
if (val <= heap->heap[new_loc].val)
break;
/* Move the greater of the two objects below the current location up */
heap->heap[loc].val = heap->heap[new_loc].val;
heap->heap[loc].obj = heap->heap[new_loc].obj;
/* Update heap location for object which moved */
heap->heap[loc].obj->heap_loc = loc;
/* Move to location "below" current location */
loc = new_loc;
} /* end while */
/* Put object into heap at correct location */
heap->heap[loc].val = val;
heap->heap[loc].obj = (H5HP_info_t *)obj;
/* Update heap location for object */
heap->heap[loc].obj->heap_loc = loc;
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP__sink_min() */
/*--------------------------------------------------------------------------
NAME
H5HP_create
PURPOSE
Create a heap
USAGE
H5HP_t *H5HP_create(heap_type)
H5HP_type_t heap_type; IN: Type of heap to create
RETURNS
Returns a pointer to a heap on success, NULL on failure.
DESCRIPTION
Create a priority queue. The SIZE is used to set the initial number of
entries allocated.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
H5HP_t *
H5HP_create(H5HP_type_t heap_type)
{
H5HP_t *new_heap = NULL; /* Pointer to new heap object created */
H5HP_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(NULL)
/* Check args */
HDassert(heap_type == H5HP_MIN_HEAP || heap_type == H5HP_MAX_HEAP);
/* Allocate ref-counted string structure */
if ((new_heap = H5FL_MALLOC(H5HP_t)) == NULL)
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed");
/* Allocate the array to store the heap entries */
if ((new_heap->heap = H5FL_SEQ_MALLOC(H5HP_ent_t, (size_t)(H5HP_START_SIZE + 1))) == NULL)
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed");
/* Set the internal fields */
new_heap->type = heap_type;
new_heap->nobjs = 0;
new_heap->nalloc = H5HP_START_SIZE + 1;
/* Set the information in the 0'th location based on the type of heap */
if (heap_type == H5HP_MIN_HEAP) {
/* Set the value in the '0' location to be the minimum value, to
* simplify the algorithms
*/
new_heap->heap[0].val = INT_MIN;
new_heap->heap[0].obj = NULL;
} /* end if */
else {
/* Set the value in the '0' location to be the maximum value, to
* simplify the algorithms
*/
new_heap->heap[0].val = INT_MAX;
new_heap->heap[0].obj = NULL;
} /* end else */
/* Set the return value */
ret_value = new_heap;
done:
/* Error cleanup */
if (NULL == ret_value) {
if (NULL != new_heap) {
if (NULL != new_heap->heap)
new_heap->heap = H5FL_SEQ_FREE(H5HP_ent_t, new_heap->heap);
new_heap = H5FL_FREE(H5HP_t, new_heap);
} /* end if */
} /* end if */
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_create() */
/*--------------------------------------------------------------------------
NAME
H5HP_count
PURPOSE
Check the number of elements in a heap
USAGE
ssize_t H5HP_count(heap)
const H5HP_t *heap; IN: Pointer to heap to query
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
Checks the number of elements in heap
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
ssize_t
H5HP_count(const H5HP_t *heap)
{
ssize_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(heap);
/* Check internal consistency */
/* (Pre-condition) */
HDassert(heap->nobjs < heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) ||
(heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN));
HDassert(heap->heap[0].obj == NULL);
/* Return the number of objects in the heap */
H5_CHECK_OVERFLOW(heap->nobjs, size_t, ssize_t);
ret_value = (ssize_t)heap->nobjs;
/* No post-condition check necessary, since heap is constant */
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_count() */
/*--------------------------------------------------------------------------
NAME
H5HP_insert
PURPOSE
Insert an object into a heap, with an initial value
USAGE
herr_t H5HP_insert(heap, val, obj)
H5HP_t *heap; IN/OUT: Pointer to heap to modify
int val; IN: Initial value for object in heap
void *obj; IN: Pointer to object to insert into heap
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
Inserts a OBJ into a HEAP, with an initial VALue.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5HP_insert(H5HP_t *heap, int val, void *obj)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(heap);
HDassert(obj);
/* Check internal consistency */
/* (Pre-condition) */
HDassert(heap->nobjs < heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) ||
(heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN));
HDassert(heap->heap[0].obj == NULL);
/* Increment number of objects in heap */
heap->nobjs++;
/* Check if we need to allocate more room for heap array */
if (heap->nobjs >= heap->nalloc) {
size_t n = MAX(H5HP_START_SIZE, 2 * (heap->nalloc - 1)) + 1;
H5HP_ent_t *new_heap = H5FL_SEQ_REALLOC(H5HP_ent_t, heap->heap, n);
if (!new_heap)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend heap array");
heap->heap = new_heap;
heap->nalloc = n;
} /* end if */
/* Insert new object at end of heap */
heap->heap[heap->nobjs].val = val;
heap->heap[heap->nobjs].obj = (H5HP_info_t *)obj;
heap->heap[heap->nobjs].obj->heap_loc = heap->nobjs;
/* Restore heap condition */
if (heap->type == H5HP_MAX_HEAP) {
if (H5HP__swim_max(heap, heap->nobjs) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to restore heap condition");
} /* end if */
else {
if (H5HP__swim_min(heap, heap->nobjs) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to restore heap condition");
} /* end else */
done:
/* Check internal consistency */
/* (Post-condition) */
HDassert(heap->nobjs < heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) ||
(heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN));
HDassert(heap->heap[0].obj == NULL);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_insert() */
/*--------------------------------------------------------------------------
NAME
H5HP_top
PURPOSE
Check the value of the top object in the heap
USAGE
herr_t H5HP_top(heap, val)
const H5HP_t *heap; IN: Pointer to heap to modify
int val; IN/OUT: Initial value for object in heap
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
Checks the value of the top object in a heap
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5HP_top(const H5HP_t *heap, int *val)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(heap);
HDassert(val);
/* Check internal consistency */
/* (Pre-condition) */
HDassert(heap->nobjs < heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) ||
(heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN));
HDassert(heap->heap[0].obj == NULL);
/* Get value of the top object in the heap */
*val = heap->heap[1].val;
/* No post-condition check necessary, since heap is constant */
FUNC_LEAVE_NOAPI(SUCCEED);
} /* end H5HP_top() */
/*--------------------------------------------------------------------------
NAME
H5HP_remove
PURPOSE
Remove an object into a heap
USAGE
herr_t H5HP_remove(heap, val, obj)
H5HP_t *heap; IN/OUT: Pointer to heap to modify
int *val; OUT: Pointer to value of object removed from heap
void **obj; OUT: Pointer to object removed from heap
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
Removes the top object on a heap, returning its value and object pointer
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5HP_remove(H5HP_t *heap, int *val, void **obj)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(heap);
HDassert(val);
HDassert(obj);
/* Check internal consistency */
/* (Pre-condition) */
HDassert(heap->nobjs < heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) ||
(heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN));
HDassert(heap->heap[0].obj == NULL);
/* Check if there are any objects on the heap to remove */
if (heap->nobjs == 0)
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "heap is empty");
/* Get the information for the top object on the heap */
HDassert(heap->heap[1].obj->heap_loc == 1);
*val = heap->heap[1].val;
*obj = heap->heap[1].obj;
/* Move the last element in the heap to the top */
heap->heap[1].val = heap->heap[heap->nobjs].val;
heap->heap[1].obj = heap->heap[heap->nobjs].obj;
heap->heap[1].obj->heap_loc = 1;
/* Decrement number of objects in heap */
heap->nobjs--;
/* Restore heap condition, if there are objects on the heap */
if (heap->nobjs > 0) {
if (heap->type == H5HP_MAX_HEAP) {
if (H5HP__sink_max(heap, (size_t)1) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "unable to restore heap condition");
} /* end if */
else {
if (H5HP__sink_min(heap, (size_t)1) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "unable to restore heap condition");
} /* end else */
} /* end if */
done:
/* Check internal consistency */
/* (Post-condition) */
HDassert(heap->nobjs < heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) ||
(heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN));
HDassert(heap->heap[0].obj == NULL);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_remove() */
/*--------------------------------------------------------------------------
NAME
H5HP_change
PURPOSE
Change the priority of an object on a heap
USAGE
herr_t H5HP_change(heap, val, obj)
H5HP_t *heap; IN/OUT: Pointer to heap to modify
int val; IN: New priority value for object
void *obj; IN: Pointer to object to modify
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
Changes the priority of an object on a heap.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5HP_change(H5HP_t *heap, int val, void *_obj)
{
H5HP_info_t *obj = (H5HP_info_t *)_obj; /* Alias for object */
size_t obj_loc; /* Location of object in heap */
int old_val; /* Object's old priority value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(heap);
HDassert(obj);
/* Check internal consistency */
/* (Pre-condition) */
HDassert(heap->nobjs < heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) ||
(heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN));
HDassert(heap->heap[0].obj == NULL);
/* Get the location of the object in the heap */
obj_loc = obj->heap_loc;
HDassert(obj_loc > 0 && obj_loc <= heap->nobjs);
/* Change the heap object's priority */
old_val = heap->heap[obj_loc].val;
heap->heap[obj_loc].val = val;
/* Restore heap condition */
if (val < old_val) {
if (heap->type == H5HP_MAX_HEAP) {
if (H5HP__sink_max(heap, obj_loc) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition");
} /* end if */
else {
if (H5HP__swim_min(heap, obj_loc) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition");
} /* end else */
} /* end if */
else {
if (heap->type == H5HP_MAX_HEAP) {
if (H5HP__swim_max(heap, obj_loc) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition");
} /* end if */
else {
if (H5HP__sink_min(heap, obj_loc) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition");
} /* end else */
} /* end else */
done:
/* Check internal consistency */
/* (Post-condition) */
HDassert(heap->nobjs < heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) ||
(heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN));
HDassert(heap->heap[0].obj == NULL);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_change() */
/*--------------------------------------------------------------------------
NAME
H5HP_incr
PURPOSE
Increment the priority of an object on a heap
USAGE
herr_t H5HP_incr(heap, amt, obj)
H5HP_t *heap; IN/OUT: Pointer to heap to modify
unsigned amt; IN: Amount to increase priority by
void *obj; IN: Pointer to object to modify
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
Increments the priority of an object on a heap by one.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5HP_incr(H5HP_t *heap, unsigned amt, void *_obj)
{
H5HP_info_t *obj = (H5HP_info_t *)_obj; /* Alias for object */
size_t obj_loc; /* Location of object in heap */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(heap);
HDassert(obj);
/* Check internal consistency */
/* (Pre-condition) */
HDassert(heap->nobjs < heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) ||
(heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN));
HDassert(heap->heap[0].obj == NULL);
/* Get the location of the object in the heap */
obj_loc = obj->heap_loc;
HDassert(obj_loc > 0 && obj_loc <= heap->nobjs);
/* Change the heap object's priority */
heap->heap[obj_loc].val += (int)amt;
/* Restore heap condition */
if (H5HP_MAX_HEAP == heap->type) {
if (H5HP__swim_max(heap, obj_loc) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition")
} /* end if */
else {
if (H5HP__sink_min(heap, obj_loc) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition")
} /* end else */
done:
/* Check internal consistency */
/* (Post-condition) */
HDassert(heap->nobjs < heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) ||
(heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN));
HDassert(heap->heap[0].obj == NULL);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_incr() */
/*--------------------------------------------------------------------------
NAME
H5HP_decr
PURPOSE
Decrement the priority of an object on a heap
USAGE
herr_t H5HP_dec(heap, amt, obj)
H5HP_t *heap; IN/OUT: Pointer to heap to modify
unsigned amt; IN: Amount to decrease priority by
void *obj; IN: Pointer to object to modify
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
Decrements the priority of an object on a heap by one.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5HP_decr(H5HP_t *heap, unsigned amt, void *_obj)
{
H5HP_info_t *obj = (H5HP_info_t *)_obj; /* Alias for object */
size_t obj_loc; /* Location of object in heap */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(heap);
HDassert(obj);
/* Check internal consistency */
/* (Pre-condition) */
HDassert(heap->nobjs < heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) ||
(heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN));
HDassert(heap->heap[0].obj == NULL);
/* Get the location of the object in the heap */
obj_loc = obj->heap_loc;
HDassert(obj_loc > 0 && obj_loc <= heap->nobjs);
/* Change the heap object's priority */
H5_CHECK_OVERFLOW(amt, unsigned, int);
heap->heap[obj_loc].val -= (int)amt;
/* Restore heap condition */
if (heap->type == H5HP_MAX_HEAP) {
if (H5HP__sink_max(heap, obj_loc) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition");
} /* end if */
else {
if (H5HP__swim_min(heap, obj_loc) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition");
} /* end else */
done:
/* Check internal consistency */
/* (Post-condition) */
HDassert(heap->nobjs < heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) ||
(heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN));
HDassert(heap->heap[0].obj == NULL);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_decr() */
/*--------------------------------------------------------------------------
NAME
H5HP_close
PURPOSE
Close a heap, deallocating it.
USAGE
herr_t H5HP_close(heap)
H5HP_t *heap; IN/OUT: Pointer to heap to close
RETURNS
Returns non-negative on success, negative on failure.
DESCRIPTION
Close a heap, freeing all internal information. Any objects left in
the heap are not deallocated.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5HP_close(H5HP_t *heap)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(heap);
/* Check internal consistency */
/* (Pre-condition) */
HDassert(heap->nobjs < heap->nalloc);
HDassert(heap->heap);
HDassert((heap->type == H5HP_MAX_HEAP && heap->heap[0].val == INT_MAX) ||
(heap->type == H5HP_MIN_HEAP && heap->heap[0].val == INT_MIN));
HDassert(NULL == heap->heap[0].obj);
/* Free internal structures for heap */
heap->heap = H5FL_SEQ_FREE(H5HP_ent_t, heap->heap);
/* Free actual heap object */
heap = H5FL_FREE(H5HP_t, heap);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HP_close() */
|
867bdd3b11795532f44eaddf06f612fe91d37d77
|
eb4d06c58aa902fe06055327b90b99a6dacb2ebc
|
/OHMySQL/lib/MySQL.xcframework/tvos-arm64_x86_64-simulator/MySQL.framework/Headers/psi_mdl_bits.h
|
7dd7ab4c50ac8b316498a4a247c89acb91183ca2
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-mysql-linking-exception-2018",
"Universal-FOSS-exception-1.0"
] |
permissive
|
oleghnidets/OHMySQL
|
5c3741afdd866910b473cc267749e017af1900ed
|
c6afc83187d9527933de016438024f8472aff768
|
refs/heads/master
| 2023-07-24T12:03:42.077178
| 2023-07-07T20:46:40
| 2023-07-07T20:46:40
| 41,176,216
| 250
| 53
|
MIT
| 2023-02-21T20:34:01
| 2015-08-21T20:31:41
|
C
|
UTF-8
|
C
| false
| false
| 3,863
|
h
|
psi_mdl_bits.h
|
/* Copyright (c) 2008, 2022, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is also distributed with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have included with MySQL.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef COMPONENTS_SERVICES_BITS_PSI_MDL_BITS_H
#define COMPONENTS_SERVICES_BITS_PSI_MDL_BITS_H
/**
@file mysql/components/services/bits/psi_mdl_bits.h
Performance schema instrumentation interface.
@defgroup psi_abi_mdl Metadata Lock Instrumentation (ABI)
@ingroup psi_abi
@{
*/
struct MDL_key;
/** @sa enum_mdl_type. */
typedef int opaque_mdl_type;
/** @sa enum_mdl_duration. */
typedef int opaque_mdl_duration;
/** @sa MDL_wait::enum_wait_status. */
typedef int opaque_mdl_status;
/**
Interface for an instrumented metadata lock.
This is an opaque structure.
*/
struct PSI_metadata_lock;
typedef struct PSI_metadata_lock PSI_metadata_lock;
/**
Interface for an instrumented MDL operation.
This is an opaque structure.
*/
struct PSI_metadata_locker;
typedef struct PSI_metadata_locker PSI_metadata_locker;
/**
State data storage for @c start_metadata_wait_v1_t.
This structure provide temporary storage to a metadata locker.
The content of this structure is considered opaque,
the fields are only hints of what an implementation
of the psi interface can use.
This memory is provided by the instrumented code for performance reasons.
@sa start_metadata_wait_v1_t
*/
struct PSI_metadata_locker_state_v1 {
/** Internal state. */
unsigned int m_flags;
/** Current metadata lock. */
struct PSI_metadata_lock *m_metadata_lock;
/** Current thread. */
struct PSI_thread *m_thread;
/** Timer start. */
unsigned long long m_timer_start;
/** Timer function. */
unsigned long long (*m_timer)(void);
/** Internal data. */
void *m_wait;
};
typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state_v1;
typedef PSI_metadata_lock *(*create_metadata_lock_v1_t)(
void *identity, const struct MDL_key *key, opaque_mdl_type mdl_type,
opaque_mdl_duration mdl_duration, opaque_mdl_status mdl_status,
const char *src_file, unsigned int src_line);
typedef void (*set_metadata_lock_status_v1_t)(PSI_metadata_lock *lock,
opaque_mdl_status mdl_status);
typedef void (*set_metadata_lock_duration_v2_t)(
PSI_metadata_lock *lock, opaque_mdl_duration mdl_duration);
typedef void (*destroy_metadata_lock_v1_t)(PSI_metadata_lock *lock);
typedef struct PSI_metadata_locker *(*start_metadata_wait_v1_t)(
struct PSI_metadata_locker_state_v1 *state, struct PSI_metadata_lock *mdl,
const char *src_file, unsigned int src_line);
typedef void (*end_metadata_wait_v1_t)(struct PSI_metadata_locker *locker,
int rc);
typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state;
/** @} (end of group psi_abi_mdl) */
#endif /* COMPONENTS_SERVICES_BITS_PSI_MDL_BITS_H */
|
2e1c12b5375ca516c03501b013b1e9da9d96e640
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/phytium/libraries/standalone/drivers/can/fcan/fcan_g.c
|
b1a59bf2bd1354d3dd6acf0ab771e359fcaaacf2
|
[
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 1,652
|
c
|
fcan_g.c
|
/*
* Copyright : (C) 2022 Phytium Information Technology, Inc.
* All Rights Reserved.
*
* This program is OPEN SOURCE software: you can redistribute it and/or modify it
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
* either version 1.0 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 Phytium Public License for more details.
*
*
* FilePath: fcan_g.c
* Date: 2022-02-10 14:53:42
* LastEditTime: 2022-02-18 08:28:45
* Description: This files is for the can default configuration
*
* Modify History:
* Ver Who Date Changes
* ----- ------ -------- --------------------------------------
* 1.0 wangxiaodong 2022/5/26 first release
*/
#include "sdkconfig.h"
#include "fcan.h"
#include "fparameters.h"
const FCanConfig FCanConfigTbl[FCAN_NUM] =
{
{
.instance_id = FCAN0_ID, /* Id of device */
.base_address = FCAN0_BASE_ADDR, /* Can base Address */
.irq_num = FCAN0_IRQ_NUM,
},
{
.instance_id = FCAN1_ID, /* Id of device */
.base_address = FCAN1_BASE_ADDR, /* Can base Address */
.irq_num = FCAN1_IRQ_NUM,
},
#if defined(CONFIG_TARGET_F2000_4) || defined(CONFIG_TARGET_D2000)
{
.instance_id = FCAN2_ID, /* Id of device */
.base_address = FCAN2_BASE_ADDR, /* Can base Address */
.irq_num = FCAN2_IRQNUM,
}
#endif
};
|
f74cc88b9d2a50db7e8f007681ac3501a3a3b431
|
65089dbc386e1184983c15fe3a2282763ae65960
|
/gear-lib/libbitmap/asm-generic/bitops/__fls.h
|
03f721a8a2b1993734e458399a68848637112c87
|
[
"MIT"
] |
permissive
|
gozfree/gear-lib
|
9f4db1bce799ded1cf1f3411cb51bdfbcbe7c7bc
|
bffbfd25af4ff7b04ebfafdab391b55270b0273e
|
refs/heads/master
| 2023-08-14T16:01:29.449910
| 2023-07-24T16:08:47
| 2023-07-24T16:09:41
| 40,359,871
| 1,771
| 488
|
MIT
| 2023-05-27T11:08:46
| 2015-08-07T12:41:05
|
C
|
UTF-8
|
C
| false
| false
| 920
|
h
|
__fls.h
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_GENERIC_BITOPS___FLS_H_
#define _ASM_GENERIC_BITOPS___FLS_H_
#include <asm/types.h>
/**
* __fls - find last (most-significant) set bit in a long word
* @word: the word to search
*
* Undefined if no set bit exists, so code should check against 0 first.
*/
static __always_inline unsigned long __fls(unsigned long word)
{
int num = BITS_PER_LONG - 1;
#if BITS_PER_LONG == 64
if (!(word & (~0ul << 32))) {
num -= 32;
word <<= 32;
}
#endif
if (!(word & (~0ul << (BITS_PER_LONG-16)))) {
num -= 16;
word <<= 16;
}
if (!(word & (~0ul << (BITS_PER_LONG-8)))) {
num -= 8;
word <<= 8;
}
if (!(word & (~0ul << (BITS_PER_LONG-4)))) {
num -= 4;
word <<= 4;
}
if (!(word & (~0ul << (BITS_PER_LONG-2)))) {
num -= 2;
word <<= 2;
}
if (!(word & (~0ul << (BITS_PER_LONG-1))))
num -= 1;
return num;
}
#endif /* _ASM_GENERIC_BITOPS___FLS_H_ */
|
d6e779455e79f5f92ad5f7029e86f23f80919196
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/net/wireless/iwlwifi/mvm/mac80211.c
|
ec0d32ad7592ad3ae9e6b22ced07cc69879009bd
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 40,389
|
c
|
mac80211.c
|
/******************************************************************************
*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
* USA
*
* The full GNU General Public License is included in this distribution
* in the file called COPYING.
*
* Contact Information:
* Intel Linux Wireless <ilw@linux.intel.com>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*
* BSD LICENSE
*
* Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name Intel Corporation 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.
*
*****************************************************************************/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ip.h>
#include <net/mac80211.h>
#include <net/tcp.h>
#include "iwl-op-mode.h"
#include "iwl-io.h"
#include "mvm.h"
#include "sta.h"
#include "time-event.h"
#include "iwl-eeprom-parse.h"
#include "fw-api-scan.h"
#include "iwl-phy-db.h"
static const struct ieee80211_iface_limit iwl_mvm_limits[] = {
{
.max = 1,
.types = BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_AP),
},
{
.max = 1,
.types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
BIT(NL80211_IFTYPE_P2P_GO),
},
{
.max = 1,
.types = BIT(NL80211_IFTYPE_P2P_DEVICE),
},
};
static const struct ieee80211_iface_combination iwl_mvm_iface_combinations[] = {
{
.num_different_channels = 1,
.max_interfaces = 3,
.limits = iwl_mvm_limits,
.n_limits = ARRAY_SIZE(iwl_mvm_limits),
},
};
#ifdef CONFIG_PM_SLEEP
static const struct nl80211_wowlan_tcp_data_token_feature
iwl_mvm_wowlan_tcp_token_feature = {
.min_len = 0,
.max_len = 255,
.bufsize = IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS,
};
static const struct wiphy_wowlan_tcp_support iwl_mvm_wowlan_tcp_support = {
.tok = &iwl_mvm_wowlan_tcp_token_feature,
.data_payload_max = IWL_WOWLAN_TCP_MAX_PACKET_LEN -
sizeof(struct ethhdr) -
sizeof(struct iphdr) -
sizeof(struct tcphdr),
.data_interval_max = 65535, /* __le16 in API */
.wake_payload_max = IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN -
sizeof(struct ethhdr) -
sizeof(struct iphdr) -
sizeof(struct tcphdr),
.seq = true,
};
#endif
int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
{
struct ieee80211_hw *hw = mvm->hw;
int num_mac, ret, i;
/* Tell mac80211 our characteristics */
hw->flags = IEEE80211_HW_SIGNAL_DBM |
IEEE80211_HW_SPECTRUM_MGMT |
IEEE80211_HW_REPORTS_TX_ACK_STATUS |
IEEE80211_HW_QUEUE_CONTROL |
IEEE80211_HW_WANT_MONITOR_VIF |
IEEE80211_HW_SUPPORTS_PS |
IEEE80211_HW_SUPPORTS_DYNAMIC_PS |
IEEE80211_HW_AMPDU_AGGREGATION |
IEEE80211_HW_TIMING_BEACON_ONLY;
hw->queues = IWL_MVM_FIRST_AGG_QUEUE;
hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE;
hw->rate_control_algorithm = "iwl-mvm-rs";
/*
* Enable 11w if advertised by firmware and software crypto
* is not enabled (as the firmware will interpret some mgmt
* packets, so enabling it with software crypto isn't safe)
*/
if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_MFP &&
!iwlwifi_mod_params.sw_crypto)
hw->flags |= IEEE80211_HW_MFP_CAPABLE;
hw->sta_data_size = sizeof(struct iwl_mvm_sta);
hw->vif_data_size = sizeof(struct iwl_mvm_vif);
hw->chanctx_data_size = sizeof(struct iwl_mvm_phy_ctxt);
hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_P2P_CLIENT) |
BIT(NL80211_IFTYPE_AP) |
BIT(NL80211_IFTYPE_P2P_GO) |
BIT(NL80211_IFTYPE_P2P_DEVICE);
hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY |
WIPHY_FLAG_DISABLE_BEACON_HINTS |
WIPHY_FLAG_IBSS_RSN;
hw->wiphy->iface_combinations = iwl_mvm_iface_combinations;
hw->wiphy->n_iface_combinations =
ARRAY_SIZE(iwl_mvm_iface_combinations);
hw->wiphy->max_remain_on_channel_duration = 10000;
hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL;
/* Extract MAC address */
memcpy(mvm->addresses[0].addr, mvm->nvm_data->hw_addr, ETH_ALEN);
hw->wiphy->addresses = mvm->addresses;
hw->wiphy->n_addresses = 1;
/* Extract additional MAC addresses if available */
num_mac = (mvm->nvm_data->n_hw_addrs > 1) ?
min(IWL_MVM_MAX_ADDRESSES, mvm->nvm_data->n_hw_addrs) : 1;
for (i = 1; i < num_mac; i++) {
memcpy(mvm->addresses[i].addr, mvm->addresses[i-1].addr,
ETH_ALEN);
mvm->addresses[i].addr[5]++;
hw->wiphy->n_addresses++;
}
/* we create the 802.11 header and a max-length SSID element */
hw->wiphy->max_scan_ie_len =
mvm->fw->ucode_capa.max_probe_length - 24 - 34;
hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX;
if (mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels)
hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
&mvm->nvm_data->bands[IEEE80211_BAND_2GHZ];
if (mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels)
hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
&mvm->nvm_data->bands[IEEE80211_BAND_5GHZ];
hw->wiphy->hw_version = mvm->trans->hw_id;
if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM)
hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
else
hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN |
NL80211_FEATURE_P2P_GO_OPPPS;
mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
#ifdef CONFIG_PM_SLEEP
if (mvm->fw->img[IWL_UCODE_WOWLAN].sec[0].len &&
mvm->trans->ops->d3_suspend &&
mvm->trans->ops->d3_resume &&
device_can_wakeup(mvm->trans->dev)) {
hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
WIPHY_WOWLAN_DISCONNECT |
WIPHY_WOWLAN_EAP_IDENTITY_REQ |
WIPHY_WOWLAN_RFKILL_RELEASE;
if (!iwlwifi_mod_params.sw_crypto)
hw->wiphy->wowlan.flags |=
WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
WIPHY_WOWLAN_GTK_REKEY_FAILURE |
WIPHY_WOWLAN_4WAY_HANDSHAKE;
hw->wiphy->wowlan.n_patterns = IWL_WOWLAN_MAX_PATTERNS;
hw->wiphy->wowlan.pattern_min_len = IWL_WOWLAN_MIN_PATTERN_LEN;
hw->wiphy->wowlan.pattern_max_len = IWL_WOWLAN_MAX_PATTERN_LEN;
hw->wiphy->wowlan.tcp = &iwl_mvm_wowlan_tcp_support;
}
#endif
ret = iwl_mvm_leds_init(mvm);
if (ret)
return ret;
ret = ieee80211_register_hw(mvm->hw);
if (ret)
iwl_mvm_leds_exit(mvm);
return ret;
}
static void iwl_mvm_mac_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_control *control,
struct sk_buff *skb)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
if (test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status)) {
IWL_DEBUG_DROP(mvm, "Dropping - RF KILL\n");
goto drop;
}
if (IEEE80211_SKB_CB(skb)->hw_queue == IWL_MVM_OFFCHANNEL_QUEUE &&
!test_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status))
goto drop;
if (control->sta) {
if (iwl_mvm_tx_skb(mvm, skb, control->sta))
goto drop;
return;
}
if (iwl_mvm_tx_skb_non_sta(mvm, skb))
goto drop;
return;
drop:
ieee80211_free_txskb(hw, skb);
}
static inline bool iwl_enable_rx_ampdu(const struct iwl_cfg *cfg)
{
if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG)
return false;
return true;
}
static inline bool iwl_enable_tx_ampdu(const struct iwl_cfg *cfg)
{
if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG)
return false;
if (iwlwifi_mod_params.disable_11n & IWL_ENABLE_HT_TXAGG)
return true;
/* enabled by default */
return true;
}
static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
enum ieee80211_ampdu_mlme_action action,
struct ieee80211_sta *sta, u16 tid,
u16 *ssn, u8 buf_size)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
int ret;
IWL_DEBUG_HT(mvm, "A-MPDU action on addr %pM tid %d: action %d\n",
sta->addr, tid, action);
if (!(mvm->nvm_data->sku_cap_11n_enable))
return -EACCES;
mutex_lock(&mvm->mutex);
switch (action) {
case IEEE80211_AMPDU_RX_START:
if (!iwl_enable_rx_ampdu(mvm->cfg)) {
ret = -EINVAL;
break;
}
ret = iwl_mvm_sta_rx_agg(mvm, sta, tid, *ssn, true);
break;
case IEEE80211_AMPDU_RX_STOP:
ret = iwl_mvm_sta_rx_agg(mvm, sta, tid, 0, false);
break;
case IEEE80211_AMPDU_TX_START:
if (!iwl_enable_tx_ampdu(mvm->cfg)) {
ret = -EINVAL;
break;
}
ret = iwl_mvm_sta_tx_agg_start(mvm, vif, sta, tid, ssn);
break;
case IEEE80211_AMPDU_TX_STOP_CONT:
ret = iwl_mvm_sta_tx_agg_stop(mvm, vif, sta, tid);
break;
case IEEE80211_AMPDU_TX_STOP_FLUSH:
case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
ret = iwl_mvm_sta_tx_agg_flush(mvm, vif, sta, tid);
break;
case IEEE80211_AMPDU_TX_OPERATIONAL:
ret = iwl_mvm_sta_tx_agg_oper(mvm, vif, sta, tid, buf_size);
break;
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
break;
}
mutex_unlock(&mvm->mutex);
return ret;
}
static void iwl_mvm_cleanup_iterator(void *data, u8 *mac,
struct ieee80211_vif *vif)
{
struct iwl_mvm *mvm = data;
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
mvmvif->uploaded = false;
mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT;
spin_lock_bh(&mvm->time_event_lock);
iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data);
spin_unlock_bh(&mvm->time_event_lock);
if (vif->type != NL80211_IFTYPE_P2P_DEVICE)
mvmvif->phy_ctxt = NULL;
}
static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm)
{
iwl_trans_stop_device(mvm->trans);
iwl_trans_stop_hw(mvm->trans, false);
mvm->scan_status = IWL_MVM_SCAN_NONE;
/* just in case one was running */
ieee80211_remain_on_channel_expired(mvm->hw);
ieee80211_iterate_active_interfaces_atomic(
mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
iwl_mvm_cleanup_iterator, mvm);
memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table));
memset(mvm->sta_drained, 0, sizeof(mvm->sta_drained));
ieee80211_wake_queues(mvm->hw);
mvm->vif_count = 0;
}
static int iwl_mvm_mac_start(struct ieee80211_hw *hw)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
int ret;
mutex_lock(&mvm->mutex);
/* Clean up some internal and mac80211 state on restart */
if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
iwl_mvm_restart_cleanup(mvm);
ret = iwl_mvm_up(mvm);
mutex_unlock(&mvm->mutex);
return ret;
}
static void iwl_mvm_mac_restart_complete(struct ieee80211_hw *hw)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
int ret;
mutex_lock(&mvm->mutex);
clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status);
ret = iwl_mvm_update_quotas(mvm, NULL);
if (ret)
IWL_ERR(mvm, "Failed to update quotas after restart (%d)\n",
ret);
mutex_unlock(&mvm->mutex);
}
static void iwl_mvm_mac_stop(struct ieee80211_hw *hw)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
flush_work(&mvm->async_handlers_wk);
mutex_lock(&mvm->mutex);
/* async_handlers_wk is now blocked */
/*
* The work item could be running or queued if the
* ROC time event stops just as we get here.
*/
cancel_work_sync(&mvm->roc_done_wk);
iwl_trans_stop_device(mvm->trans);
iwl_trans_stop_hw(mvm->trans, false);
iwl_mvm_async_handlers_purge(mvm);
/* async_handlers_list is empty and will stay empty: HW is stopped */
/* the fw is stopped, the aux sta is dead: clean up driver state */
iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta);
mutex_unlock(&mvm->mutex);
/*
* The worker might have been waiting for the mutex, let it run and
* discover that its list is now empty.
*/
cancel_work_sync(&mvm->async_handlers_wk);
}
static void iwl_mvm_pm_disable_iterator(void *data, u8 *mac,
struct ieee80211_vif *vif)
{
struct iwl_mvm *mvm = data;
int ret;
ret = iwl_mvm_power_disable(mvm, vif);
if (ret)
IWL_ERR(mvm, "failed to disable power management\n");
}
static void iwl_mvm_power_update_iterator(void *data, u8 *mac,
struct ieee80211_vif *vif)
{
struct iwl_mvm *mvm = data;
iwl_mvm_power_update_mode(mvm, vif);
}
static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
int ret;
/*
* Not much to do here. The stack will not allow interface
* types or combinations that we didn't advertise, so we
* don't really have to check the types.
*/
mutex_lock(&mvm->mutex);
/* Allocate resources for the MAC context, and add it the the fw */
ret = iwl_mvm_mac_ctxt_init(mvm, vif);
if (ret)
goto out_unlock;
/*
* The AP binding flow can be done only after the beacon
* template is configured (which happens only in the mac80211
* start_ap() flow), and adding the broadcast station can happen
* only after the binding.
* In addition, since modifying the MAC before adding a bcast
* station is not allowed by the FW, delay the adding of MAC context to
* the point where we can also add the bcast station.
* In short: there's not much we can do at this point, other than
* allocating resources :)
*/
if (vif->type == NL80211_IFTYPE_AP) {
u32 qmask = iwl_mvm_mac_get_queues_mask(mvm, vif);
ret = iwl_mvm_allocate_int_sta(mvm, &mvmvif->bcast_sta,
qmask);
if (ret) {
IWL_ERR(mvm, "Failed to allocate bcast sta\n");
goto out_release;
}
goto out_unlock;
}
/*
* TODO: remove this temporary code.
* Currently MVM FW supports power management only on single MAC.
* If new interface added, disable PM on existing interface.
* P2P device is a special case, since it is handled by FW similary to
* scan. If P2P deviced is added, PM remains enabled on existing
* interface.
* Note: the method below does not count the new interface being added
* at this moment.
*/
if (vif->type != NL80211_IFTYPE_P2P_DEVICE)
mvm->vif_count++;
if (mvm->vif_count > 1) {
IWL_DEBUG_MAC80211(mvm,
"Disable power on existing interfaces\n");
ieee80211_iterate_active_interfaces_atomic(
mvm->hw,
IEEE80211_IFACE_ITER_NORMAL,
iwl_mvm_pm_disable_iterator, mvm);
}
ret = iwl_mvm_mac_ctxt_add(mvm, vif);
if (ret)
goto out_release;
/*
* Update power state on the new interface. Admittedly, based on
* mac80211 logics this power update will disable power management
*/
iwl_mvm_power_update_mode(mvm, vif);
/*
* P2P_DEVICE interface does not have a channel context assigned to it,
* so a dedicated PHY context is allocated to it and the corresponding
* MAC context is bound to it at this stage.
*/
if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
struct ieee80211_channel *chan;
struct cfg80211_chan_def chandef;
mvmvif->phy_ctxt = &mvm->phy_ctxt_roc;
/*
* The channel used here isn't relevant as it's
* going to be overwritten as part of the ROC flow.
* For now use the first channel we have.
*/
chan = &mvm->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->channels[0];
cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT);
ret = iwl_mvm_phy_ctxt_add(mvm, mvmvif->phy_ctxt,
&chandef, 1, 1);
if (ret)
goto out_remove_mac;
ret = iwl_mvm_binding_add_vif(mvm, vif);
if (ret)
goto out_remove_phy;
ret = iwl_mvm_add_bcast_sta(mvm, vif, &mvmvif->bcast_sta);
if (ret)
goto out_unbind;
/* Save a pointer to p2p device vif, so it can later be used to
* update the p2p device MAC when a GO is started/stopped */
mvm->p2p_device_vif = vif;
}
iwl_mvm_vif_dbgfs_register(mvm, vif);
goto out_unlock;
out_unbind:
iwl_mvm_binding_remove_vif(mvm, vif);
out_remove_phy:
iwl_mvm_phy_ctxt_remove(mvm, mvmvif->phy_ctxt);
out_remove_mac:
mvmvif->phy_ctxt = NULL;
iwl_mvm_mac_ctxt_remove(mvm, vif);
out_release:
/*
* TODO: remove this temporary code.
* Currently MVM FW supports power management only on single MAC.
* Check if only one additional interface remains after releasing
* current one. Update power mode on the remaining interface.
*/
if (vif->type != NL80211_IFTYPE_P2P_DEVICE)
mvm->vif_count--;
IWL_DEBUG_MAC80211(mvm, "Currently %d interfaces active\n",
mvm->vif_count);
if (mvm->vif_count == 1) {
ieee80211_iterate_active_interfaces(
mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
iwl_mvm_power_update_iterator, mvm);
}
iwl_mvm_mac_ctxt_release(mvm, vif);
out_unlock:
mutex_unlock(&mvm->mutex);
return ret;
}
static void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm,
struct ieee80211_vif *vif)
{
u32 tfd_msk = 0, ac;
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
if (vif->hw_queue[ac] != IEEE80211_INVAL_HW_QUEUE)
tfd_msk |= BIT(vif->hw_queue[ac]);
if (vif->cab_queue != IEEE80211_INVAL_HW_QUEUE)
tfd_msk |= BIT(vif->cab_queue);
if (tfd_msk) {
mutex_lock(&mvm->mutex);
iwl_mvm_flush_tx_path(mvm, tfd_msk, true);
mutex_unlock(&mvm->mutex);
}
if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
/*
* Flush the ROC worker which will flush the OFFCHANNEL queue.
* We assume here that all the packets sent to the OFFCHANNEL
* queue are sent in ROC session.
*/
flush_work(&mvm->roc_done_wk);
} else {
/*
* By now, all the AC queues are empty. The AGG queues are
* empty too. We already got all the Tx responses for all the
* packets in the queues. The drain work can have been
* triggered. Flush it. This work item takes the mutex, so kill
* it before we take it.
*/
flush_work(&mvm->sta_drained_wk);
}
}
static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
iwl_mvm_prepare_mac_removal(mvm, vif);
mutex_lock(&mvm->mutex);
iwl_mvm_vif_dbgfs_clean(mvm, vif);
/*
* For AP/GO interface, the tear down of the resources allocated to the
* interface is be handled as part of the stop_ap flow.
*/
if (vif->type == NL80211_IFTYPE_AP) {
iwl_mvm_dealloc_int_sta(mvm, &mvmvif->bcast_sta);
goto out_release;
}
if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
mvm->p2p_device_vif = NULL;
iwl_mvm_rm_bcast_sta(mvm, &mvmvif->bcast_sta);
iwl_mvm_binding_remove_vif(mvm, vif);
iwl_mvm_phy_ctxt_remove(mvm, mvmvif->phy_ctxt);
mvmvif->phy_ctxt = NULL;
}
/*
* TODO: remove this temporary code.
* Currently MVM FW supports power management only on single MAC.
* Check if only one additional interface remains after removing
* current one. Update power mode on the remaining interface.
*/
if (mvm->vif_count && vif->type != NL80211_IFTYPE_P2P_DEVICE)
mvm->vif_count--;
IWL_DEBUG_MAC80211(mvm, "Currently %d interfaces active\n",
mvm->vif_count);
if (mvm->vif_count == 1) {
ieee80211_iterate_active_interfaces(
mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
iwl_mvm_power_update_iterator, mvm);
}
iwl_mvm_mac_ctxt_remove(mvm, vif);
out_release:
iwl_mvm_mac_ctxt_release(mvm, vif);
mutex_unlock(&mvm->mutex);
}
static int iwl_mvm_mac_config(struct ieee80211_hw *hw, u32 changed)
{
return 0;
}
static void iwl_mvm_configure_filter(struct ieee80211_hw *hw,
unsigned int changed_flags,
unsigned int *total_flags,
u64 multicast)
{
*total_flags = 0;
}
static int iwl_mvm_configure_mcast_filter(struct iwl_mvm *mvm,
struct ieee80211_vif *vif)
{
struct iwl_mcast_filter_cmd mcast_filter_cmd = {
.pass_all = 1,
};
memcpy(mcast_filter_cmd.bssid, vif->bss_conf.bssid, ETH_ALEN);
return iwl_mvm_send_cmd_pdu(mvm, MCAST_FILTER_CMD, CMD_SYNC,
sizeof(mcast_filter_cmd),
&mcast_filter_cmd);
}
static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *bss_conf,
u32 changes)
{
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
int ret;
ret = iwl_mvm_mac_ctxt_changed(mvm, vif);
if (ret)
IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr);
if (changes & BSS_CHANGED_ASSOC) {
if (bss_conf->assoc) {
/* add quota for this interface */
ret = iwl_mvm_update_quotas(mvm, vif);
if (ret) {
IWL_ERR(mvm, "failed to update quotas\n");
return;
}
iwl_mvm_bt_coex_vif_assoc(mvm, vif);
iwl_mvm_configure_mcast_filter(mvm, vif);
} else if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) {
/* remove AP station now that the MAC is unassoc */
ret = iwl_mvm_rm_sta_id(mvm, vif, mvmvif->ap_sta_id);
if (ret)
IWL_ERR(mvm, "failed to remove AP station\n");
mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT;
/* remove quota for this interface */
ret = iwl_mvm_update_quotas(mvm, NULL);
if (ret)
IWL_ERR(mvm, "failed to update quotas\n");
}
} else if (changes & BSS_CHANGED_DTIM_PERIOD) {
/*
* We received a beacon _after_ association so
* remove the session protection.
*/
iwl_mvm_remove_time_event(mvm, mvmvif,
&mvmvif->time_event_data);
} else if (changes & BSS_CHANGED_PS) {
/*
* TODO: remove this temporary code.
* Currently MVM FW supports power management only on single
* MAC. Avoid power mode update if more than one interface
* is active.
*/
IWL_DEBUG_MAC80211(mvm, "Currently %d interfaces active\n",
mvm->vif_count);
if (mvm->vif_count == 1) {
ret = iwl_mvm_power_update_mode(mvm, vif);
if (ret)
IWL_ERR(mvm, "failed to update power mode\n");
}
}
}
static int iwl_mvm_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
int ret;
mutex_lock(&mvm->mutex);
/* Send the beacon template */
ret = iwl_mvm_mac_ctxt_beacon_changed(mvm, vif);
if (ret)
goto out_unlock;
/* Add the mac context */
ret = iwl_mvm_mac_ctxt_add(mvm, vif);
if (ret)
goto out_unlock;
/* Perform the binding */
ret = iwl_mvm_binding_add_vif(mvm, vif);
if (ret)
goto out_remove;
mvmvif->ap_active = true;
/* Send the bcast station. At this stage the TBTT and DTIM time events
* are added and applied to the scheduler */
ret = iwl_mvm_send_bcast_sta(mvm, vif, &mvmvif->bcast_sta);
if (ret)
goto out_unbind;
ret = iwl_mvm_update_quotas(mvm, vif);
if (ret)
goto out_rm_bcast;
/* Need to update the P2P Device MAC */
if (vif->p2p && mvm->p2p_device_vif)
iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif);
mutex_unlock(&mvm->mutex);
return 0;
out_rm_bcast:
iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta);
out_unbind:
iwl_mvm_binding_remove_vif(mvm, vif);
out_remove:
iwl_mvm_mac_ctxt_remove(mvm, vif);
out_unlock:
mutex_unlock(&mvm->mutex);
return ret;
}
static void iwl_mvm_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
iwl_mvm_prepare_mac_removal(mvm, vif);
mutex_lock(&mvm->mutex);
mvmvif->ap_active = false;
/* Need to update the P2P Device MAC */
if (vif->p2p && mvm->p2p_device_vif)
iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif);
iwl_mvm_update_quotas(mvm, NULL);
iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta);
iwl_mvm_binding_remove_vif(mvm, vif);
iwl_mvm_mac_ctxt_remove(mvm, vif);
mutex_unlock(&mvm->mutex);
}
static void iwl_mvm_bss_info_changed_ap(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *bss_conf,
u32 changes)
{
/* Need to send a new beacon template to the FW */
if (changes & BSS_CHANGED_BEACON) {
if (iwl_mvm_mac_ctxt_beacon_changed(mvm, vif))
IWL_WARN(mvm, "Failed updating beacon data\n");
}
}
static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *bss_conf,
u32 changes)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
mutex_lock(&mvm->mutex);
switch (vif->type) {
case NL80211_IFTYPE_STATION:
iwl_mvm_bss_info_changed_station(mvm, vif, bss_conf, changes);
break;
case NL80211_IFTYPE_AP:
iwl_mvm_bss_info_changed_ap(mvm, vif, bss_conf, changes);
break;
default:
/* shouldn't happen */
WARN_ON_ONCE(1);
}
mutex_unlock(&mvm->mutex);
}
static int iwl_mvm_mac_hw_scan(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct cfg80211_scan_request *req)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
int ret;
if (req->n_channels == 0 || req->n_channels > MAX_NUM_SCAN_CHANNELS)
return -EINVAL;
mutex_lock(&mvm->mutex);
if (mvm->scan_status == IWL_MVM_SCAN_NONE)
ret = iwl_mvm_scan_request(mvm, vif, req);
else
ret = -EBUSY;
mutex_unlock(&mvm->mutex);
return ret;
}
static void iwl_mvm_mac_cancel_hw_scan(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
mutex_lock(&mvm->mutex);
iwl_mvm_cancel_scan(mvm);
mutex_unlock(&mvm->mutex);
}
static void
iwl_mvm_mac_allow_buffered_frames(struct ieee80211_hw *hw,
struct ieee80211_sta *sta, u16 tid,
int num_frames,
enum ieee80211_frame_release_type reason,
bool more_data)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
/* TODO: how do we tell the fw to send frames for a specific TID */
/*
* The fw will send EOSP notification when the last frame will be
* transmitted.
*/
iwl_mvm_sta_modify_sleep_tx_count(mvm, sta, reason, num_frames);
}
static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
enum sta_notify_cmd cmd,
struct ieee80211_sta *sta)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv;
switch (cmd) {
case STA_NOTIFY_SLEEP:
if (atomic_read(&mvm->pending_frames[mvmsta->sta_id]) > 0)
ieee80211_sta_block_awake(hw, sta, true);
/*
* The fw updates the STA to be asleep. Tx packets on the Tx
* queues to this station will not be transmitted. The fw will
* send a Tx response with TX_STATUS_FAIL_DEST_PS.
*/
break;
case STA_NOTIFY_AWAKE:
if (WARN_ON(mvmsta->sta_id == IWL_MVM_STATION_COUNT))
break;
iwl_mvm_sta_modify_ps_wake(mvm, sta);
break;
default:
break;
}
}
static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
enum ieee80211_sta_state old_state,
enum ieee80211_sta_state new_state)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
int ret;
IWL_DEBUG_MAC80211(mvm, "station %pM state change %d->%d\n",
sta->addr, old_state, new_state);
/* this would be a mac80211 bug ... but don't crash */
if (WARN_ON_ONCE(!mvmvif->phy_ctxt))
return -EINVAL;
/* if a STA is being removed, reuse its ID */
flush_work(&mvm->sta_drained_wk);
mutex_lock(&mvm->mutex);
if (old_state == IEEE80211_STA_NOTEXIST &&
new_state == IEEE80211_STA_NONE) {
/*
* Firmware bug - it'll crash if the beacon interval is less
* than 16. We can't avoid connecting at all, so refuse the
* station state change, this will cause mac80211 to abandon
* attempts to connect to this AP, and eventually wpa_s will
* blacklist the AP...
*/
if (vif->type == NL80211_IFTYPE_STATION &&
vif->bss_conf.beacon_int < 16) {
IWL_ERR(mvm,
"AP %pM beacon interval is %d, refusing due to firmware bug!\n",
sta->addr, vif->bss_conf.beacon_int);
ret = -EINVAL;
goto out_unlock;
}
ret = iwl_mvm_add_sta(mvm, vif, sta);
} else if (old_state == IEEE80211_STA_NONE &&
new_state == IEEE80211_STA_AUTH) {
ret = 0;
} else if (old_state == IEEE80211_STA_AUTH &&
new_state == IEEE80211_STA_ASSOC) {
ret = iwl_mvm_update_sta(mvm, vif, sta);
if (ret == 0)
iwl_mvm_rs_rate_init(mvm, sta,
mvmvif->phy_ctxt->channel->band);
} else if (old_state == IEEE80211_STA_ASSOC &&
new_state == IEEE80211_STA_AUTHORIZED) {
ret = 0;
} else if (old_state == IEEE80211_STA_AUTHORIZED &&
new_state == IEEE80211_STA_ASSOC) {
ret = 0;
} else if (old_state == IEEE80211_STA_ASSOC &&
new_state == IEEE80211_STA_AUTH) {
ret = 0;
} else if (old_state == IEEE80211_STA_AUTH &&
new_state == IEEE80211_STA_NONE) {
ret = 0;
} else if (old_state == IEEE80211_STA_NONE &&
new_state == IEEE80211_STA_NOTEXIST) {
ret = iwl_mvm_rm_sta(mvm, vif, sta);
} else {
ret = -EIO;
}
out_unlock:
mutex_unlock(&mvm->mutex);
return ret;
}
static int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
mvm->rts_threshold = value;
return 0;
}
static int iwl_mvm_mac_conf_tx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, u16 ac,
const struct ieee80211_tx_queue_params *params)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
mvmvif->queue_params[ac] = *params;
/*
* No need to update right away, we'll get BSS_CHANGED_QOS
* The exception is P2P_DEVICE interface which needs immediate update.
*/
if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
int ret;
mutex_lock(&mvm->mutex);
ret = iwl_mvm_mac_ctxt_changed(mvm, vif);
mutex_unlock(&mvm->mutex);
return ret;
}
return 0;
}
static void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
u32 duration = min(IWL_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS,
200 + vif->bss_conf.beacon_int);
u32 min_duration = min(IWL_MVM_TE_SESSION_PROTECTION_MIN_TIME_MS,
100 + vif->bss_conf.beacon_int);
if (WARN_ON_ONCE(vif->bss_conf.assoc))
return;
mutex_lock(&mvm->mutex);
/* Try really hard to protect the session and hear a beacon */
iwl_mvm_protect_session(mvm, vif, duration, min_duration);
mutex_unlock(&mvm->mutex);
}
static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
enum set_key_cmd cmd,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_key_conf *key)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
int ret;
if (iwlwifi_mod_params.sw_crypto) {
IWL_DEBUG_MAC80211(mvm, "leave - hwcrypto disabled\n");
return -EOPNOTSUPP;
}
switch (key->cipher) {
case WLAN_CIPHER_SUITE_TKIP:
key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
/* fall-through */
case WLAN_CIPHER_SUITE_CCMP:
key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
break;
case WLAN_CIPHER_SUITE_AES_CMAC:
WARN_ON_ONCE(!(hw->flags & IEEE80211_HW_MFP_CAPABLE));
break;
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
/*
* Support for TX only, at least for now, so accept
* the key and do nothing else. Then mac80211 will
* pass it for TX but we don't have to use it for RX.
*/
return 0;
default:
return -EOPNOTSUPP;
}
mutex_lock(&mvm->mutex);
switch (cmd) {
case SET_KEY:
if (vif->type == NL80211_IFTYPE_AP && !sta) {
/* GTK on AP interface is a TX-only key, return 0 */
ret = 0;
key->hw_key_idx = STA_KEY_IDX_INVALID;
break;
}
IWL_DEBUG_MAC80211(mvm, "set hwcrypto key\n");
ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, false);
if (ret) {
IWL_WARN(mvm, "set key failed\n");
/*
* can't add key for RX, but we don't need it
* in the device for TX so still return 0
*/
key->hw_key_idx = STA_KEY_IDX_INVALID;
ret = 0;
}
break;
case DISABLE_KEY:
if (key->hw_key_idx == STA_KEY_IDX_INVALID) {
ret = 0;
break;
}
IWL_DEBUG_MAC80211(mvm, "disable hwcrypto key\n");
ret = iwl_mvm_remove_sta_key(mvm, vif, sta, key);
break;
default:
ret = -EINVAL;
}
mutex_unlock(&mvm->mutex);
return ret;
}
static void iwl_mvm_mac_update_tkip_key(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_key_conf *keyconf,
struct ieee80211_sta *sta,
u32 iv32, u16 *phase1key)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
iwl_mvm_update_tkip_key(mvm, vif, keyconf, sta, iv32, phase1key);
}
static int iwl_mvm_roc(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_channel *channel,
int duration,
enum ieee80211_roc_type type)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct cfg80211_chan_def chandef;
int ret;
if (vif->type != NL80211_IFTYPE_P2P_DEVICE) {
IWL_ERR(mvm, "vif isn't a P2P_DEVICE: %d\n", vif->type);
return -EINVAL;
}
IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value,
duration, type);
mutex_lock(&mvm->mutex);
cfg80211_chandef_create(&chandef, channel, NL80211_CHAN_NO_HT);
ret = iwl_mvm_phy_ctxt_changed(mvm, &mvm->phy_ctxt_roc,
&chandef, 1, 1);
/* Schedule the time events */
ret = iwl_mvm_start_p2p_roc(mvm, vif, duration, type);
mutex_unlock(&mvm->mutex);
IWL_DEBUG_MAC80211(mvm, "leave\n");
return ret;
}
static int iwl_mvm_cancel_roc(struct ieee80211_hw *hw)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
IWL_DEBUG_MAC80211(mvm, "enter\n");
mutex_lock(&mvm->mutex);
iwl_mvm_stop_p2p_roc(mvm);
mutex_unlock(&mvm->mutex);
IWL_DEBUG_MAC80211(mvm, "leave\n");
return 0;
}
static int iwl_mvm_add_chanctx(struct ieee80211_hw *hw,
struct ieee80211_chanctx_conf *ctx)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_phy_ctxt *phy_ctxt = (void *)ctx->drv_priv;
int ret;
mutex_lock(&mvm->mutex);
IWL_DEBUG_MAC80211(mvm, "Add PHY context\n");
ret = iwl_mvm_phy_ctxt_add(mvm, phy_ctxt, &ctx->def,
ctx->rx_chains_static,
ctx->rx_chains_dynamic);
mutex_unlock(&mvm->mutex);
return ret;
}
static void iwl_mvm_remove_chanctx(struct ieee80211_hw *hw,
struct ieee80211_chanctx_conf *ctx)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_phy_ctxt *phy_ctxt = (void *)ctx->drv_priv;
mutex_lock(&mvm->mutex);
iwl_mvm_phy_ctxt_remove(mvm, phy_ctxt);
mutex_unlock(&mvm->mutex);
}
static void iwl_mvm_change_chanctx(struct ieee80211_hw *hw,
struct ieee80211_chanctx_conf *ctx,
u32 changed)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_phy_ctxt *phy_ctxt = (void *)ctx->drv_priv;
mutex_lock(&mvm->mutex);
iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->def,
ctx->rx_chains_static,
ctx->rx_chains_dynamic);
mutex_unlock(&mvm->mutex);
}
static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_chanctx_conf *ctx)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_phy_ctxt *phyctx = (void *)ctx->drv_priv;
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
int ret;
mutex_lock(&mvm->mutex);
mvmvif->phy_ctxt = phyctx;
switch (vif->type) {
case NL80211_IFTYPE_AP:
/*
* The AP binding flow is handled as part of the start_ap flow
* (in bss_info_changed).
*/
ret = 0;
goto out_unlock;
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_ADHOC:
case NL80211_IFTYPE_MONITOR:
break;
default:
ret = -EINVAL;
goto out_unlock;
}
ret = iwl_mvm_binding_add_vif(mvm, vif);
if (ret)
goto out_unlock;
/*
* Setting the quota at this stage is only required for monitor
* interfaces. For the other types, the bss_info changed flow
* will handle quota settings.
*/
if (vif->type == NL80211_IFTYPE_MONITOR) {
mvmvif->monitor_active = true;
ret = iwl_mvm_update_quotas(mvm, vif);
if (ret)
goto out_remove_binding;
}
goto out_unlock;
out_remove_binding:
iwl_mvm_binding_remove_vif(mvm, vif);
out_unlock:
mutex_unlock(&mvm->mutex);
if (ret)
mvmvif->phy_ctxt = NULL;
return ret;
}
static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_chanctx_conf *ctx)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
mutex_lock(&mvm->mutex);
iwl_mvm_remove_time_event(mvm, mvmvif, &mvmvif->time_event_data);
if (vif->type == NL80211_IFTYPE_AP)
goto out_unlock;
switch (vif->type) {
case NL80211_IFTYPE_MONITOR:
mvmvif->monitor_active = false;
iwl_mvm_update_quotas(mvm, NULL);
break;
default:
break;
}
iwl_mvm_binding_remove_vif(mvm, vif);
out_unlock:
mvmvif->phy_ctxt = NULL;
mutex_unlock(&mvm->mutex);
}
static int iwl_mvm_set_tim(struct ieee80211_hw *hw,
struct ieee80211_sta *sta,
bool set)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv;
if (!mvm_sta || !mvm_sta->vif) {
IWL_ERR(mvm, "Station is not associated to a vif\n");
return -EINVAL;
}
return iwl_mvm_mac_ctxt_beacon_changed(mvm, mvm_sta->vif);
}
static void iwl_mvm_mac_rssi_callback(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
enum ieee80211_rssi_event rssi_event)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
iwl_mvm_bt_rssi_event(mvm, vif, rssi_event);
}
struct ieee80211_ops iwl_mvm_hw_ops = {
.tx = iwl_mvm_mac_tx,
.ampdu_action = iwl_mvm_mac_ampdu_action,
.start = iwl_mvm_mac_start,
.restart_complete = iwl_mvm_mac_restart_complete,
.stop = iwl_mvm_mac_stop,
.add_interface = iwl_mvm_mac_add_interface,
.remove_interface = iwl_mvm_mac_remove_interface,
.config = iwl_mvm_mac_config,
.configure_filter = iwl_mvm_configure_filter,
.bss_info_changed = iwl_mvm_bss_info_changed,
.hw_scan = iwl_mvm_mac_hw_scan,
.cancel_hw_scan = iwl_mvm_mac_cancel_hw_scan,
.sta_state = iwl_mvm_mac_sta_state,
.sta_notify = iwl_mvm_mac_sta_notify,
.allow_buffered_frames = iwl_mvm_mac_allow_buffered_frames,
.set_rts_threshold = iwl_mvm_mac_set_rts_threshold,
.conf_tx = iwl_mvm_mac_conf_tx,
.mgd_prepare_tx = iwl_mvm_mac_mgd_prepare_tx,
.set_key = iwl_mvm_mac_set_key,
.update_tkip_key = iwl_mvm_mac_update_tkip_key,
.remain_on_channel = iwl_mvm_roc,
.cancel_remain_on_channel = iwl_mvm_cancel_roc,
.rssi_callback = iwl_mvm_mac_rssi_callback,
.add_chanctx = iwl_mvm_add_chanctx,
.remove_chanctx = iwl_mvm_remove_chanctx,
.change_chanctx = iwl_mvm_change_chanctx,
.assign_vif_chanctx = iwl_mvm_assign_vif_chanctx,
.unassign_vif_chanctx = iwl_mvm_unassign_vif_chanctx,
.start_ap = iwl_mvm_start_ap,
.stop_ap = iwl_mvm_stop_ap,
.set_tim = iwl_mvm_set_tim,
#ifdef CONFIG_PM_SLEEP
/* look at d3.c */
.suspend = iwl_mvm_suspend,
.resume = iwl_mvm_resume,
.set_wakeup = iwl_mvm_set_wakeup,
.set_rekey_data = iwl_mvm_set_rekey_data,
#if IS_ENABLED(CONFIG_IPV6)
.ipv6_addr_change = iwl_mvm_ipv6_addr_change,
#endif
.set_default_unicast_key = iwl_mvm_set_default_unicast_key,
#endif
};
|
b444a8096efc14f21b3d1b5e0a0f9d3a74e6e0b5
|
450916eee7580beb928ed8f387db4f0a8c1aa508
|
/src/amuse/community/smalln/src/f2c.c
|
5fb0d112d761c724daae448b9893a735f83b5e1a
|
[
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
amusecode/amuse
|
42095545893f5a86ea79c2a52ce54d3ce8eb204f
|
b57c1e2fda1457d5025307be105c2aa59b19b574
|
refs/heads/main
| 2023-08-31T04:50:48.880044
| 2023-08-30T12:00:20
| 2023-08-30T12:00:20
| 18,516,331
| 158
| 118
|
Apache-2.0
| 2023-08-30T12:00:22
| 2014-04-07T12:35:07
|
AMPL
|
UTF-8
|
C
| false
| false
| 19
|
c
|
f2c.c
|
../../ph4/src/f2c.c
|
6acd93b4fa12eec3d9eedb77d3364a448c7cfb60
|
5ff95ead314d795a89f45a674eb21f47c3e2aafd
|
/src/messages/notification_info.h
|
4497e25bb66c8aa210e76c57ccd0d700d8c7a60e
|
[
"LGPL-2.0-or-later",
"MIT",
"BSD-2-Clause"
] |
permissive
|
Tarsnap/tarsnap-gui
|
42d3b4f3a8013247be90afefefa8285c5824b78a
|
f0e369491a6516c13499b442a81d47ae4db09753
|
refs/heads/master
| 2023-03-07T04:46:33.949447
| 2023-02-28T03:54:41
| 2023-02-28T03:54:41
| 35,868,327
| 283
| 34
|
BSD-2-Clause
| 2022-10-26T19:08:41
| 2015-05-19T08:08:53
|
C++
|
UTF-8
|
C
| false
| false
| 530
|
h
|
notification_info.h
|
#ifndef NOTIFICATION_INFO_H
#define NOTIFICATION_INFO_H
//! Type of notification message.
enum message_type
{
NOTIFICATION_NONE,
NOTIFICATION_UNSPECIFIED,
NOTIFICATION_NOT_ONLINE,
NOTIFICATION_ARCHIVE_CREATING,
NOTIFICATION_ARCHIVE_CREATED,
NOTIFICATION_ARCHIVE_FAILED
};
//! Info about what a message is about.
struct message_info
{
//! What type of message?
message_type type;
//! Additional data (e.g., archive name), if applicable.
QString data;
};
#endif /* !NOTIFICATION_INFO_H */
|
b8474c6db42ad5c78c4ac6ed60601a319f70d942
|
24ed6f6bec90986e60641c991afcea9409df40af
|
/src/ft2_about.c
|
3db67e95ef5310c42823f960cb1ea32519b29b52
|
[
"BSD-3-Clause",
"CC-BY-NC-SA-4.0"
] |
permissive
|
8bitbubsy/ft2-clone
|
24b851b989ee0dd27d24041524c95c06a4648485
|
7c6a629b5407f0acfd1df7235903f475156051de
|
refs/heads/master
| 2023-09-04T12:34:02.982464
| 2023-08-16T10:01:41
| 2023-08-16T10:01:41
| 225,352,979
| 560
| 48
|
BSD-3-Clause
| 2023-05-09T17:26:38
| 2019-12-02T10:59:22
|
C
|
UTF-8
|
C
| false
| false
| 4,817
|
c
|
ft2_about.c
|
#include <stdio.h> // sprintf()
#include <math.h>
#include "ft2_header.h"
#include "ft2_gui.h"
#include "ft2_pattern_ed.h"
#include "ft2_bmp.h"
#include "ft2_video.h"
#include "ft2_structs.h"
#define NUM_STARS 2048
#define ALPHA_FADE_MILLISECS 2100 /* amount of milliseconds until content is fully faded in */
#define ABOUT_SCREEN_W 626
#define ABOUT_SCREEN_H 167
#define ABOUT_LOGO_W 449
#define ABOUT_LOGO_H 110
#define ABOUT_TEXT_W 349
#define ABOUT_TEXT_H 29
typedef struct
{
float x, y, z;
} vector_t;
typedef struct
{
vector_t x, y, z;
} matrix_t;
static char *customText1 = "Clone by Olav \"8bitbubsy\" S\025rensen";
static char *customText2 = "https://16-bits.org";
static char customText3[256];
static int16_t customText1Y, customText2Y, customText3Y, customText1X, customText2X, customText3X;
static uint32_t alphaValue, randSeed, frameCounter;
static vector_t starPoints[NUM_STARS], rotation;
static matrix_t matrix;
void seedAboutScreenRandom(uint32_t newseed)
{
randSeed = newseed;
}
static int32_t random32(void)
{
randSeed *= 134775813;
randSeed += 1;
return randSeed;
}
static void rotateMatrix(void)
{
#define MY_PI_FLOAT 3.141592653589793f
const float xx = rotation.x * MY_PI_FLOAT;
const float sa = sinf(xx);
const float ca = cosf(xx);
const float yy = rotation.y * MY_PI_FLOAT;
const float sb = sinf(yy);
const float cb = cosf(yy);
const float zz = rotation.z * MY_PI_FLOAT;
const float sc = sinf(zz);
const float cc = cosf(zz);
// x
matrix.x.x = (ca * cc) + (sc * sa * sb);
matrix.y.x = sa * cb;
matrix.z.x = (cc * sa * sb) - (ca * sc);
// y
matrix.x.y = (sc * ca * sb) - (sa * cc);
matrix.y.y = ca * cb;
matrix.z.y = (sa * sc) + (cc * ca * sb);
// z
matrix.x.z = cb * sc;
matrix.y.z = -sb;
matrix.z.z = cb * cc;
}
static void aboutInit(void)
{
vector_t *s = starPoints;
for (int32_t i = 0; i < NUM_STARS; i++, s++)
{
s->x = (float)(random32() * (1.0 / (UINT32_MAX+1.0)));
s->y = (float)(random32() * (1.0 / (UINT32_MAX+1.0)));
s->z = (float)(random32() * (1.0 / (UINT32_MAX+1.0)));
}
rotation.x = rotation.y = rotation.z = 0.0f;
alphaValue = 0;
frameCounter = 0;
}
static void starfield(void)
{
vector_t *star = starPoints;
for (int16_t i = 0; i < NUM_STARS; i++, star++)
{
star->z += 0.00015f;
if (star->z >= 0.5f)
star->z -= 1.0f;
const float z = (matrix.x.z * star->x) + (matrix.y.z * star->y) + (matrix.z.z * star->z) + 0.5f;
if (z <= 0.0f)
continue;
float y = (ABOUT_SCREEN_H/2.0f) + ((((matrix.x.y * star->x) + (matrix.y.y * star->y) + (matrix.z.y * star->z)) / z) * 400.0f);
const int32_t outY = (int32_t)y;
if (outY < 3 || outY >= 3+ABOUT_SCREEN_H)
continue;
float x = (ABOUT_SCREEN_W/2.0f) + ((((matrix.x.x * star->x) + (matrix.y.x * star->y) + (matrix.z.x * star->z)) / z) * 400.0f);
const int32_t outX = (int32_t)x;
if (outX < 3 || outX >= 3+ABOUT_SCREEN_W)
continue;
int32_t d = (int32_t)(z * 255.0f);
if (d > 255)
d = 255;
d ^= 255;
// add a tint of blue to the star pixel
int32_t r = d - 79;
if (r < 0)
r = 0;
int32_t g = d - 38;
if (g < 0)
g = 0;
int32_t b = d + 64;
if (b > 255)
b = 255;
video.frameBuffer[(outY * SCREEN_W) + outX] = RGB32(r, g, b);
}
}
void aboutFrame(void) // called every frame when the about screen is shown
{
clearRect(3, 3, ABOUT_SCREEN_W, ABOUT_SCREEN_H);
// 3D starfield
rotateMatrix();
starfield();
rotation.x -= 0.00011f;
rotation.z += 0.00006f;
// logo + text
blit32Alpha(91, 31, bmp.ft2AboutLogo, ABOUT_LOGO_W, ABOUT_LOGO_H, alphaValue);
textOutAlpha(customText1X, customText1Y, PAL_FORGRND, customText1, alphaValue);
textOutAlpha(customText2X, customText2Y, PAL_FORGRND, customText2, alphaValue);
textOutAlpha(customText3X, customText3Y, PAL_FORGRND, customText3, alphaValue);
alphaValue += (uint32_t)((65536.0 / (ALPHA_FADE_MILLISECS / (1000.0 / VBLANK_HZ))) + 0.5);
if (alphaValue > 65536)
alphaValue = 65536;
// the exit button has to be redrawn since it gets overwritten :)
showPushButton(PB_EXIT_ABOUT);
}
void showAboutScreen(void) // called once when about screen is opened
{
if (ui.extended)
exitPatternEditorExtended();
hideTopScreen();
drawFramework(0, 0, 632, 173, FRAMEWORK_TYPE1);
drawFramework(2, 2, 628, 169, FRAMEWORK_TYPE2);
showPushButton(PB_EXIT_ABOUT);
sprintf(customText3, "v%s (%s)", PROG_VER_STR, __DATE__);
customText1X = (SCREEN_W - textWidth(customText1)) / 2;
customText2X = (SCREEN_W-8) - textWidth(customText2);
customText3X = (SCREEN_W-8) - textWidth(customText3);
customText1Y = 157;
customText2Y = 157-12;
customText3Y = 157;
aboutInit();
ui.aboutScreenShown = true;
}
void hideAboutScreen(void)
{
hidePushButton(PB_EXIT_ABOUT);
ui.aboutScreenShown = false;
}
void exitAboutScreen(void)
{
hideAboutScreen();
showTopScreen(true);
}
|
41a265e548e90fdd9704410492967b262d5e0311
|
a3d6556180e74af7b555f8d47d3fea55b94bcbda
|
/net/third_party/quiche/overrides/quiche_platform_impl/quiche_iovec_impl.h
|
8765b142c5f1c019440dd53c5b2c2a493eb3214b
|
[
"BSD-3-Clause"
] |
permissive
|
chromium/chromium
|
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
|
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
|
refs/heads/main
| 2023-08-24T00:35:12.585945
| 2023-08-23T22:01:11
| 2023-08-23T22:01:11
| 120,360,765
| 17,408
| 7,102
|
BSD-3-Clause
| 2023-09-10T23:44:27
| 2018-02-05T20:55:32
| null |
UTF-8
|
C
| false
| false
| 717
|
h
|
quiche_iovec_impl.h
|
// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_IOVEC_IMPL_H_
#define NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_IOVEC_IMPL_H_
#include <stddef.h>
#include "build/build_config.h"
#if BUILDFLAG(IS_WIN)
/* Structure for scatter/gather I/O. */
struct iovec {
void* iov_base; /* Pointer to data. */
size_t iov_len; /* Length of data. */
};
#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
#include <sys/uio.h>
#endif // BUILDFLAG(IS_WIN)
#endif // NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_IOVEC_IMPL_H_
|
bbe32d7c4e0e57f8563c66148ea5617c6db96139
|
4fb44fd2eaa39a270897f6fe2da2b968efddf2a0
|
/src/t_rename_overwrite.c
|
c5cdd1db47afea36b5d082b288e96fabd80e7dbb
|
[] |
no_license
|
kdave/xfstests
|
75226d7dabd3de0c95bd768313852e8e9831c155
|
0ca1d4fbb2e9a492968f2951df101f24477f7991
|
refs/heads/master
| 2023-08-31T00:49:55.808164
| 2023-08-04T21:34:19
| 2023-08-05T13:53:09
| 8,715,288
| 103
| 65
| null | 2022-02-02T21:17:24
| 2013-03-11T23:05:35
|
Shell
|
UTF-8
|
C
| false
| false
| 704
|
c
|
t_rename_overwrite.c
|
#include <stdio.h>
#include <fcntl.h>
#include <err.h>
#include <sys/stat.h>
int main(int argc, char *argv[])
{
const char *path1;
const char *path2;
struct stat stbuf;
int res;
int fd;
if (argc != 3) {
fprintf(stderr, "usage: %s path1 path2\n", argv[0]);
return 1;
}
path1 = argv[1];
path2 = argv[2];
fd = open(path2, O_RDONLY);
if (fd == -1)
err(1, "open(\"%s\")", path2);
res = rename(path1, path2);
if (res == -1)
err(1, "rename(\"%s\", \"%s\")", path1, path2);
res = fstat(fd, &stbuf);
if (res == -1)
err(1, "fstat(%i)", fd);
if (stbuf.st_nlink != 0) {
fprintf(stderr, "nlink is %lu, should be 0\n",
(unsigned long) stbuf.st_nlink);
return 1;
}
return 0;
}
|
6446c286ba0e20f3b12849565c2afc57784fce77
|
a2e8dbe5310b2056653264ba7d23ccb53b47c86f
|
/Labs/LabOLED/SSD1306_OLED_CustomFont/font.h
|
01276ebd7cd4702cb7f4fc3dd2d9e26ed562d119
|
[] |
no_license
|
ITPNYU/physcomp
|
324429d5cc646a1056a6d3f559273f91c74e75f7
|
29bfa6e74e00fded2eec677f73ec2c1a5d1791d1
|
refs/heads/main
| 2023-01-12T22:24:02.487196
| 2022-12-23T13:26:35
| 2022-12-23T13:26:35
| 12,625,284
| 108
| 111
| null | 2023-08-02T18:40:00
| 2013-09-05T18:24:18
|
JavaScript
|
UTF-8
|
C
| false
| false
| 11,288
|
h
|
font.h
|
// Created by http://oleddisplay.squix.ch/ Consider a donation
// In case of problems make sure that you are using the font file with the correct version!
const uint8_t Open_Sans_Regular_16Bitmaps[] PROGMEM = {
// Bitmap Data:
0x00, // ' '
0xDB,0x6D,0x92,0x43,0x60, // '!'
0x94,0xA5,0x20, // '"'
0x09,0x01,0x20,0x64,0x08,0x87,0xFC,0x24,0x04,0x87,0xFC,0x22,0x04,0xC0,0x90,0x12,0x00, // '#'
0x10,0x7E,0xD0,0x90,0xD0,0x70,0x1C,0x16,0x12,0x16,0xF8,0x10,0x10, // '$'
0x60,0x89,0x10,0x91,0x09,0x20,0x92,0x09,0x5C,0x65,0x20,0x92,0x09,0x21,0x12,0x11,0x22,0x0C, // '%'
0x3C,0x06,0x60,0x46,0x06,0x60,0x2C,0x03,0x00,0x68,0x4C,0x4C,0x82,0x88,0x18,0xC3,0x87,0xC4, // '&'
0xDA,0x40, // '''
0x23,0x11,0x88,0x42,0x10,0x84,0x21,0x84,0x30,0x80, // '('
0x8C,0x46,0x22,0x22,0x22,0x26,0x4C,0x80, // ')'
0x10,0x10,0x92,0xFE,0x28,0x6C,0x44, // '*'
0x10,0x10,0x10,0xFE,0x10,0x10,0x10, // '+'
0xD2,0x40, // ','
0xE0, // '-'
0xD8, // '.'
0x0C,0x10,0x20,0xC1,0x02,0x08,0x10,0x60,0x81,0x06,0x00, // '/'
0x38,0x44,0xC6,0x82,0x82,0x82,0x82,0x82,0x82,0xC6,0x44,0x38, // '0'
0x19,0xE5,0x86,0x18,0x61,0x86,0x18,0x61,0x86, // '1'
0x78,0x84,0x06,0x06,0x04,0x04,0x08,0x18,0x30,0x60,0xC0,0xFE, // '2'
0x78,0x84,0x06,0x06,0x04,0x78,0x04,0x02,0x02,0x02,0x04,0xF8, // '3'
0x06,0x01,0x80,0xA0,0x68,0x12,0x08,0x86,0x21,0x08,0xFF,0x80,0x80,0x20,0x08, // '4'
0x7C,0x40,0x40,0xC0,0xC0,0xFC,0x06,0x02,0x02,0x02,0x04,0xF8, // '5'
0x1C,0x60,0x40,0xC0,0x80,0xBC,0xC6,0x82,0x82,0xC2,0x46,0x3C, // '6'
0xFE,0x02,0x06,0x04,0x0C,0x08,0x08,0x18,0x10,0x30,0x20,0x60, // '7'
0x7C,0xC6,0x82,0xC6,0x64,0x38,0x4C,0x82,0x82,0x82,0xC6,0x7C, // '8'
0x78,0xC4,0x82,0x82,0x82,0xC6,0x7A,0x02,0x06,0x04,0x0C,0x70, // '9'
0xD8,0x00,0x06,0xC0, // ':'
0x66,0x00,0x00,0x06,0x44,0x40, // ';'
0x02,0x0E,0x38,0xE0,0xC0,0x30,0x0E,0x02, // '<'
0xFE,0x00,0x00,0xFE, // '='
0x80,0xE0,0x38,0x0E,0x06,0x18,0xE0,0x80, // '>'
0x78,0x04,0x06,0x06,0x04,0x08,0x10,0x30,0x20,0x00,0x30,0x30, // '?'
0x0F,0x81,0x82,0x18,0x08,0x8F,0x28,0x99,0x48,0xCA,0x46,0x52,0x22,0x99,0xB4,0x77,0x10,0x00,0x41,0x01,0xF8,0x00, // '@'
0x0C,0x01,0x80,0x30,0x09,0x01,0x20,0x66,0x08,0x41,0xF8,0x61,0x88,0x11,0x02,0x60,0x60, // 'A'
0xF8,0x86,0x86,0x86,0x84,0xF8,0x86,0x82,0x82,0x82,0x86,0xFC, // 'B'
0x1F,0x08,0x04,0x03,0x00,0xC0,0x20,0x08,0x03,0x00,0xC0,0x10,0x06,0x00,0x7C, // 'C'
0xFC,0x21,0x88,0x12,0x06,0x81,0xA0,0x28,0x0A,0x06,0x81,0xA0,0x48,0x63,0xF0, // 'D'
0xFD,0x02,0x04,0x08,0x1F,0xA0,0x40,0x81,0x02,0x07,0xE0, // 'E'
0xFD,0x02,0x04,0x08,0x10,0x3E,0x40,0x81,0x02,0x04,0x00, // 'F'
0x1F,0x86,0x01,0x00,0x60,0x0C,0x01,0x00,0x20,0xF6,0x06,0xC0,0xC8,0x18,0xC3,0x0F,0xE0, // 'G'
0x81,0x40,0xA0,0x50,0x28,0x17,0xFA,0x05,0x02,0x81,0x40,0xA0,0x50,0x20, // 'H'
0xDB,0x6D,0xB6,0xDB,0x60, // 'I'
0x31,0x8C,0x63,0x18,0xC6,0x31,0x8C,0x63,0x13,0x80, // 'J'
0x82,0x42,0x23,0x13,0x0B,0x07,0x03,0xC1,0x30,0x88,0x42,0x21,0x90,0x60, // 'K'
0x81,0x02,0x04,0x08,0x10,0x20,0x40,0x81,0x02,0x07,0xE0, // 'L'
0xC0,0xD8,0x1B,0x03,0x70,0xAA,0x15,0x42,0xAC,0x94,0x92,0x92,0x51,0x8A,0x31,0x46,0x20, // 'M'
0x81,0x60,0xB8,0x54,0x2B,0x14,0x8A,0x25,0x1A,0x85,0x43,0xA0,0xD0,0x20, // 'N'
0x1E,0x0C,0x31,0x02,0x60,0x68,0x05,0x00,0xA0,0x14,0x02,0xC0,0xC8,0x11,0x86,0x0F,0x00, // 'O'
0xF8,0x86,0x82,0x82,0x82,0x84,0xF8,0x80,0x80,0x80,0x80,0x80, // 'P'
0x1E,0x0C,0x31,0x02,0x60,0x68,0x05,0x00,0xA0,0x14,0x02,0xC0,0xC8,0x11,0x86,0x0F,0x00,0x20,0x06,0x00,0x60, // 'Q'
0xF8,0x42,0x21,0x90,0x48,0x64,0x23,0xE1,0x10,0x8C,0x42,0x21,0x90,0x40, // 'R'
0x7E,0xC2,0x80,0x80,0xC0,0x70,0x1C,0x06,0x02,0x02,0x06,0xFC, // 'S'
0xFF,0x82,0x00,0x80,0x20,0x08,0x02,0x00,0x80,0x20,0x08,0x02,0x00,0x80,0x20, // 'T'
0x81,0xA0,0x68,0x1A,0x06,0x81,0xA0,0x68,0x1A,0x06,0x81,0x20,0x4C,0x30,0xF0, // 'U'
0xC0,0xC8,0x11,0x02,0x30,0xC2,0x10,0x42,0x0C,0xC0,0x90,0x16,0x03,0xC0,0x30,0x06,0x00, // 'V'
0xC1,0x06,0x43,0x84,0x42,0x84,0x62,0x8C,0x66,0x8C,0x24,0xC8,0x24,0x48,0x24,0x48,0x3C,0x78,0x18,0x30,0x18,0x30,0x18,0x30, // 'W'
0x41,0x18,0xC2,0x20,0xD8,0x14,0x02,0x01,0xC0,0x50,0x26,0x08,0x84,0x13,0x06, // 'X'
0xC1,0x90,0x46,0x30,0x88,0x36,0x05,0x01,0xC0,0x20,0x08,0x02,0x00,0x80,0x20, // 'Y'
0xFE,0x06,0x04,0x0C,0x18,0x18,0x30,0x20,0x60,0xC0,0xC0,0xFE, // 'Z'
0xF6,0x31,0x8C,0x63,0x18,0xC6,0x31,0x8C,0x63,0xC0, // '['
0xC0,0x81,0x03,0x02,0x04,0x04,0x08,0x18,0x10,0x20,0x60, // '\'
0xF1,0x8C,0x63,0x18,0xC6,0x31,0x8C,0x63,0x1B,0xC0, // ']'
0x08,0x06,0x01,0x40,0xD0,0x22,0x18,0x84,0x11,0x04, // '^'
0xFE, // '_'
0xC4,0x20, // '`'
0x7C,0x04,0x06,0x06,0x7E,0xC6,0x86,0x86,0x7A, // 'a'
0xC0,0x60,0x30,0x18,0x0D,0xC7,0x13,0x0D,0x82,0xC1,0x60,0xB0,0xDC,0x49,0xC0, // 'b'
0x3C,0x83,0x04,0x08,0x10,0x30,0x20,0x3C, // 'c'
0x03,0x01,0x80,0xC0,0x63,0xB2,0x3B,0x0D,0x06,0x83,0x41,0xB0,0xC8,0xE3,0xB0, // 'd'
0x3C,0x44,0xC2,0x82,0xFE,0x80,0xC0,0x40,0x3E, // 'e'
0x1C,0x40,0x81,0x0F,0x84,0x08,0x10,0x20,0x40,0x81,0x02,0x00, // 'f'
0x3F,0x98,0x84,0x31,0x0C,0x62,0x0F,0x02,0x01,0x80,0x3F,0x10,0x4C,0x13,0x0C,0x7E,0x00, // 'g'
0xC0,0x60,0x30,0x18,0x0D,0xE7,0x13,0x0D,0x86,0xC3,0x61,0xB0,0xD8,0x6C,0x30, // 'h'
0xD8,0x6D,0xB6,0xDB,0x60, // 'i'
0x31,0x80,0x63,0x18,0xC6,0x31,0x8C,0x63,0x18,0xDC, // 'j'
0xC0,0xC0,0xC0,0xC0,0xC4,0xC8,0xD0,0xF0,0xF0,0xD0,0xC8,0xCC,0xC6, // 'k'
0xDB,0x6D,0xB6,0xDB,0x6C, // 'l'
0xFC,0xF3,0x9C,0x4C,0x21,0xB0,0x86,0xC2,0x1B,0x08,0x6C,0x21,0xB0,0x86,0xC2,0x18, // 'm'
0xDE,0x71,0x30,0xD8,0x6C,0x36,0x1B,0x0D,0x86,0xC3,0x00, // 'n'
0x3C,0x21,0x30,0xD0,0x28,0x14,0x0B,0x0C,0x84,0x3C,0x00, // 'o'
0xDC,0x71,0x30,0xD8,0x2C,0x16,0x0B,0x0D,0xC4,0xDC,0x60,0x30,0x18,0x0C,0x00, // 'p'
0x3B,0x23,0xB0,0xD0,0x68,0x34,0x1B,0x0C,0x8E,0x3B,0x01,0x80,0xC0,0x60,0x30, // 'q'
0xDD,0xC3,0x06,0x0C,0x18,0x30,0x60,0xC0, // 'r'
0x7D,0x0A,0x06,0x03,0x81,0x81,0x42,0xF8, // 's'
0x20,0x43,0xF1,0x02,0x04,0x08,0x10,0x20,0x40,0xF0, // 't'
0xC3,0x61,0xB0,0xD8,0x6C,0x36,0x1B,0x0C,0x8E,0x7B,0x00, // 'u'
0xC3,0x21,0x10,0x8C,0xC2,0x41,0x20,0xF0,0x30,0x18,0x00, // 'v'
0xC6,0x32,0x31,0x11,0x88,0x96,0x46,0x96,0x14,0xA0,0xE7,0x06,0x18,0x30,0xC0, // 'w'
0x42,0x33,0x09,0x03,0x01,0x80,0xC0,0x90,0xCC,0xC2,0x00, // 'x'
0xC3,0x21,0x10,0x8C,0xC2,0x41,0x20,0xF0,0x30,0x18,0x0C,0x04,0x06,0x0E,0x00, // 'y'
0xF8,0x21,0x0C,0x21,0x84,0x20,0xF8, // 'z'
0x08,0x43,0x0C,0x30,0xC2,0x30,0x20,0xC3,0x0C,0x30,0x41,0x80, // '{'
0xAA,0xAA,0xAA,0xAA,0x80, // '|'
0x81,0x06,0x18,0x61,0x82,0x06,0x21,0x86,0x18,0x61,0x0C,0x00 // '}'
};
const GFXglyph Open_Sans_Regular_16Glyphs[] PROGMEM = {
// bitmapOffset, width, height, xAdvance, xOffset, yOffset
{ 0, 1, 1, 5, 0, 0 }, // ' '
{ 1, 3, 12, 5, 1, -12 }, // '!'
{ 6, 5, 4, 7, 1, -12 }, // '"'
{ 9, 11, 12, 11, 0, -12 }, // '#'
{ 26, 8, 13, 10, 1, -12 }, // '$'
{ 39, 12, 12, 14, 1, -12 }, // '%'
{ 57, 12, 12, 13, 1, -12 }, // '&'
{ 75, 3, 4, 5, 1, -12 }, // '''
{ 77, 5, 15, 6, 1, -12 }, // '('
{ 87, 4, 15, 6, 1, -12 }, // ')'
{ 95, 8, 7, 10, 1, -13 }, // '*'
{ 102, 8, 7, 10, 1, -9 }, // '+'
{ 109, 3, 4, 5, 1, -2 }, // ','
{ 111, 4, 1, 6, 1, -5 }, // '-'
{ 112, 3, 2, 5, 1, -2 }, // '.'
{ 113, 7, 12, 7, 0, -12 }, // '/'
{ 124, 8, 12, 10, 1, -12 }, // '0'
{ 136, 6, 12, 10, 1, -12 }, // '1'
{ 145, 8, 12, 10, 1, -12 }, // '2'
{ 157, 8, 12, 10, 1, -12 }, // '3'
{ 169, 10, 12, 10, 0, -12 }, // '4'
{ 184, 8, 12, 10, 1, -12 }, // '5'
{ 196, 8, 12, 10, 1, -12 }, // '6'
{ 208, 8, 12, 10, 1, -12 }, // '7'
{ 220, 8, 12, 10, 1, -12 }, // '8'
{ 232, 8, 12, 10, 1, -12 }, // '9'
{ 244, 3, 9, 5, 1, -9 }, // ':'
{ 248, 4, 11, 5, 0, -9 }, // ';'
{ 254, 8, 8, 10, 1, -10 }, // '<'
{ 262, 8, 4, 10, 1, -8 }, // '='
{ 266, 8, 8, 10, 1, -10 }, // '>'
{ 274, 8, 12, 8, 0, -12 }, // '?'
{ 286, 13, 13, 15, 1, -12 }, // '@'
{ 308, 11, 12, 11, 0, -12 }, // 'A'
{ 325, 8, 12, 11, 2, -12 }, // 'B'
{ 337, 10, 12, 11, 1, -12 }, // 'C'
{ 352, 10, 12, 13, 2, -12 }, // 'D'
{ 367, 7, 12, 10, 2, -12 }, // 'E'
{ 378, 7, 12, 9, 2, -12 }, // 'F'
{ 389, 11, 12, 13, 1, -12 }, // 'G'
{ 406, 9, 12, 13, 2, -12 }, // 'H'
{ 420, 3, 12, 5, 1, -12 }, // 'I'
{ 425, 5, 15, 5, -1, -12 }, // 'J'
{ 435, 9, 12, 11, 2, -12 }, // 'K'
{ 449, 7, 12, 9, 2, -12 }, // 'L'
{ 460, 11, 12, 15, 2, -12 }, // 'M'
{ 477, 9, 12, 13, 2, -12 }, // 'N'
{ 491, 11, 12, 13, 1, -12 }, // 'O'
{ 508, 8, 12, 11, 2, -12 }, // 'P'
{ 520, 11, 15, 13, 1, -12 }, // 'Q'
{ 541, 9, 12, 11, 2, -12 }, // 'R'
{ 555, 8, 12, 10, 1, -12 }, // 'S'
{ 567, 10, 12, 10, 0, -12 }, // 'T'
{ 582, 10, 12, 13, 2, -12 }, // 'U'
{ 597, 11, 12, 11, 0, -12 }, // 'V'
{ 614, 16, 12, 16, 0, -12 }, // 'W'
{ 638, 10, 12, 10, 0, -12 }, // 'X'
{ 653, 10, 12, 10, 0, -12 }, // 'Y'
{ 668, 8, 12, 10, 1, -12 }, // 'Z'
{ 680, 5, 15, 6, 1, -12 }, // '['
{ 690, 7, 12, 7, 0, -12 }, // '\'
{ 701, 5, 15, 6, 0, -12 }, // ']'
{ 711, 10, 8, 10, 0, -12 }, // '^'
{ 721, 8, 1, 8, 0, 1 }, // '_'
{ 722, 4, 3, 10, 3, -13 }, // '`'
{ 724, 8, 9, 10, 1, -9 }, // 'a'
{ 733, 9, 13, 11, 1, -13 }, // 'b'
{ 748, 7, 9, 9, 1, -9 }, // 'c'
{ 756, 9, 13, 11, 1, -13 }, // 'd'
{ 771, 8, 9, 10, 1, -9 }, // 'e'
{ 780, 7, 13, 6, 0, -13 }, // 'f'
{ 792, 10, 13, 10, 0, -9 }, // 'g'
{ 809, 9, 13, 11, 1, -13 }, // 'h'
{ 824, 3, 12, 5, 1, -12 }, // 'i'
{ 829, 5, 16, 5, -1, -12 }, // 'j'
{ 839, 8, 13, 9, 1, -13 }, // 'k'
{ 852, 3, 13, 5, 1, -13 }, // 'l'
{ 857, 14, 9, 16, 1, -9 }, // 'm'
{ 873, 9, 9, 11, 1, -9 }, // 'n'
{ 884, 9, 9, 11, 1, -9 }, // 'o'
{ 895, 9, 13, 11, 1, -9 }, // 'p'
{ 910, 9, 13, 11, 1, -9 }, // 'q'
{ 925, 7, 9, 8, 1, -9 }, // 'r'
{ 933, 7, 9, 9, 1, -9 }, // 's'
{ 941, 7, 11, 7, 0, -11 }, // 't'
{ 951, 9, 9, 11, 1, -9 }, // 'u'
{ 962, 9, 9, 9, 0, -9 }, // 'v'
{ 973, 13, 9, 13, 0, -9 }, // 'w'
{ 988, 9, 9, 9, 0, -9 }, // 'x'
{ 999, 9, 13, 9, 0, -9 }, // 'y'
{ 1014, 6, 9, 8, 1, -9 }, // 'z'
{ 1021, 6, 15, 7, 0, -12 }, // '{'
{ 1033, 2, 17, 10, 4, -13 }, // '|'
{ 1038, 6, 15, 7, 1, -12 } // '}'
};
const GFXfont Open_Sans_Regular_16 PROGMEM = {
(uint8_t *)Open_Sans_Regular_16Bitmaps,(GFXglyph *)Open_Sans_Regular_16Glyphs,0x20, 0x7E, 23};
|
6966a509e75dc42caaf20e5af7f7be65e8dd23e7
|
03666e5f961946fc1a0ac67781ac1425562ef0d7
|
/src/visitpy/visitpy/PySaveSubWindowsAttributes.C
|
d8123c0408346ed0af9ae3bf6d7c50fb5350be08
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
visit-dav/visit
|
e9f81b4d4b9b9930a0db9d5282cd1bcabf465e2e
|
601ae46e0bef2e18425b482a755d03490ade0493
|
refs/heads/develop
| 2023-09-06T08:19:38.397058
| 2023-09-05T21:29:32
| 2023-09-05T21:29:32
| 165,565,988
| 335
| 120
|
BSD-3-Clause
| 2023-09-14T00:53:37
| 2019-01-13T23:27:26
|
C
|
UTF-8
|
C
| false
| false
| 37,715
|
c
|
PySaveSubWindowsAttributes.C
|
// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers. See the top-level LICENSE file for dates and other
// details. No copyright assignment is required to contribute to VisIt.
#include <PySaveSubWindowsAttributes.h>
#include <ObserverToCallback.h>
#include <stdio.h>
#include <Py2and3Support.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
#include <PySaveSubWindowAttributes.h>
// ****************************************************************************
// Module: PySaveSubWindowsAttributes
//
// Purpose:
//
// Note: Autogenerated by xml2python. Do not modify by hand!
//
// Programmer: xml2python
// Creation: omitted
//
// ****************************************************************************
//
// This struct contains the Python type information and a SaveSubWindowsAttributes.
//
struct SaveSubWindowsAttributesObject
{
PyObject_HEAD
SaveSubWindowsAttributes *data;
bool owns;
PyObject *parent;
};
//
// Internal prototypes
//
static PyObject *NewSaveSubWindowsAttributes(int);
std::string
PySaveSubWindowsAttributes_ToString(const SaveSubWindowsAttributes *atts, const char *prefix, const bool forLogging)
{
std::string str;
char tmpStr[1000];
// To squelch a warning
(void)tmpStr;
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win1.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin1(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win2.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin2(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win3.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin3(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win4.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin4(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win5.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin5(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win6.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin6(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win7.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin7(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win8.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin8(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win9.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin9(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win10.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin10(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win11.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin11(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win12.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin12(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win13.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin13(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win14.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin14(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win15.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin15(), objPrefix.c_str(), forLogging);
}
{ // new scope
std::string objPrefix(prefix);
objPrefix += "win16.";
str += PySaveSubWindowAttributes_ToString(&atts->GetWin16(), objPrefix.c_str(), forLogging);
}
return str;
}
static PyObject *
SaveSubWindowsAttributes_Notify(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
obj->data->Notify();
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin1(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win1 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin1(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin1(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin1());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin2(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win2 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin2(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin2(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin2());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin3(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win3 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin3(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin3(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin3());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin4(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win4 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin4(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin4(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin4());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin5(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win5 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin5(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin5(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin5());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin6(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win6 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin6(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin6(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin6());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin7(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win7 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin7(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin7(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin7());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin8(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win8 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin8(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin8(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin8());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin9(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win9 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin9(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin9(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin9());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin10(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win10 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin10(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin10(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin10());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin11(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win11 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin11(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin11(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin11());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin12(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win12 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin12(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin12(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin12());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin13(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win13 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin13(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin13(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin13());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin14(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win14 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin14(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin14(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin14());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin15(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win15 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin15(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin15(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin15());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_SetWin16(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
PyObject *newValue = NULL;
if(!PyArg_ParseTuple(args, "O", &newValue))
return NULL;
if(!PySaveSubWindowAttributes_Check(newValue))
return PyErr_Format(PyExc_TypeError, "Field win16 can be set only with SaveSubWindowAttributes objects");
obj->data->SetWin16(*PySaveSubWindowAttributes_FromPyObject(newValue));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
SaveSubWindowsAttributes_GetWin16(PyObject *self, PyObject *args)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)self;
// Since the new object will point to data owned by this object,
// we need to increment the reference count.
Py_INCREF(self);
PyObject *retval = PySaveSubWindowAttributes_Wrap(&obj->data->GetWin16());
// Set the object's parent so the reference to the parent can be decref'd
// when the child goes out of scope.
PySaveSubWindowAttributes_SetParent(retval, self);
return retval;
}
PyMethodDef PySaveSubWindowsAttributes_methods[SAVESUBWINDOWSATTRIBUTES_NMETH] = {
{"Notify", SaveSubWindowsAttributes_Notify, METH_VARARGS},
{"SetWin1", SaveSubWindowsAttributes_SetWin1, METH_VARARGS},
{"GetWin1", SaveSubWindowsAttributes_GetWin1, METH_VARARGS},
{"SetWin2", SaveSubWindowsAttributes_SetWin2, METH_VARARGS},
{"GetWin2", SaveSubWindowsAttributes_GetWin2, METH_VARARGS},
{"SetWin3", SaveSubWindowsAttributes_SetWin3, METH_VARARGS},
{"GetWin3", SaveSubWindowsAttributes_GetWin3, METH_VARARGS},
{"SetWin4", SaveSubWindowsAttributes_SetWin4, METH_VARARGS},
{"GetWin4", SaveSubWindowsAttributes_GetWin4, METH_VARARGS},
{"SetWin5", SaveSubWindowsAttributes_SetWin5, METH_VARARGS},
{"GetWin5", SaveSubWindowsAttributes_GetWin5, METH_VARARGS},
{"SetWin6", SaveSubWindowsAttributes_SetWin6, METH_VARARGS},
{"GetWin6", SaveSubWindowsAttributes_GetWin6, METH_VARARGS},
{"SetWin7", SaveSubWindowsAttributes_SetWin7, METH_VARARGS},
{"GetWin7", SaveSubWindowsAttributes_GetWin7, METH_VARARGS},
{"SetWin8", SaveSubWindowsAttributes_SetWin8, METH_VARARGS},
{"GetWin8", SaveSubWindowsAttributes_GetWin8, METH_VARARGS},
{"SetWin9", SaveSubWindowsAttributes_SetWin9, METH_VARARGS},
{"GetWin9", SaveSubWindowsAttributes_GetWin9, METH_VARARGS},
{"SetWin10", SaveSubWindowsAttributes_SetWin10, METH_VARARGS},
{"GetWin10", SaveSubWindowsAttributes_GetWin10, METH_VARARGS},
{"SetWin11", SaveSubWindowsAttributes_SetWin11, METH_VARARGS},
{"GetWin11", SaveSubWindowsAttributes_GetWin11, METH_VARARGS},
{"SetWin12", SaveSubWindowsAttributes_SetWin12, METH_VARARGS},
{"GetWin12", SaveSubWindowsAttributes_GetWin12, METH_VARARGS},
{"SetWin13", SaveSubWindowsAttributes_SetWin13, METH_VARARGS},
{"GetWin13", SaveSubWindowsAttributes_GetWin13, METH_VARARGS},
{"SetWin14", SaveSubWindowsAttributes_SetWin14, METH_VARARGS},
{"GetWin14", SaveSubWindowsAttributes_GetWin14, METH_VARARGS},
{"SetWin15", SaveSubWindowsAttributes_SetWin15, METH_VARARGS},
{"GetWin15", SaveSubWindowsAttributes_GetWin15, METH_VARARGS},
{"SetWin16", SaveSubWindowsAttributes_SetWin16, METH_VARARGS},
{"GetWin16", SaveSubWindowsAttributes_GetWin16, METH_VARARGS},
{NULL, NULL}
};
//
// Type functions
//
static void
SaveSubWindowsAttributes_dealloc(PyObject *v)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)v;
if(obj->parent != 0)
Py_DECREF(obj->parent);
if(obj->owns)
delete obj->data;
}
static PyObject *SaveSubWindowsAttributes_richcompare(PyObject *self, PyObject *other, int op);
PyObject *
PySaveSubWindowsAttributes_getattr(PyObject *self, char *name)
{
if(strcmp(name, "win1") == 0)
return SaveSubWindowsAttributes_GetWin1(self, NULL);
if(strcmp(name, "win2") == 0)
return SaveSubWindowsAttributes_GetWin2(self, NULL);
if(strcmp(name, "win3") == 0)
return SaveSubWindowsAttributes_GetWin3(self, NULL);
if(strcmp(name, "win4") == 0)
return SaveSubWindowsAttributes_GetWin4(self, NULL);
if(strcmp(name, "win5") == 0)
return SaveSubWindowsAttributes_GetWin5(self, NULL);
if(strcmp(name, "win6") == 0)
return SaveSubWindowsAttributes_GetWin6(self, NULL);
if(strcmp(name, "win7") == 0)
return SaveSubWindowsAttributes_GetWin7(self, NULL);
if(strcmp(name, "win8") == 0)
return SaveSubWindowsAttributes_GetWin8(self, NULL);
if(strcmp(name, "win9") == 0)
return SaveSubWindowsAttributes_GetWin9(self, NULL);
if(strcmp(name, "win10") == 0)
return SaveSubWindowsAttributes_GetWin10(self, NULL);
if(strcmp(name, "win11") == 0)
return SaveSubWindowsAttributes_GetWin11(self, NULL);
if(strcmp(name, "win12") == 0)
return SaveSubWindowsAttributes_GetWin12(self, NULL);
if(strcmp(name, "win13") == 0)
return SaveSubWindowsAttributes_GetWin13(self, NULL);
if(strcmp(name, "win14") == 0)
return SaveSubWindowsAttributes_GetWin14(self, NULL);
if(strcmp(name, "win15") == 0)
return SaveSubWindowsAttributes_GetWin15(self, NULL);
if(strcmp(name, "win16") == 0)
return SaveSubWindowsAttributes_GetWin16(self, NULL);
// Add a __dict__ answer so that dir() works
if (!strcmp(name, "__dict__"))
{
PyObject *result = PyDict_New();
for (int i = 0; PySaveSubWindowsAttributes_methods[i].ml_meth; i++)
PyDict_SetItem(result,
PyString_FromString(PySaveSubWindowsAttributes_methods[i].ml_name),
PyString_FromString(PySaveSubWindowsAttributes_methods[i].ml_name));
return result;
}
return Py_FindMethod(PySaveSubWindowsAttributes_methods, self, name);
}
int
PySaveSubWindowsAttributes_setattr(PyObject *self, char *name, PyObject *args)
{
PyObject NULL_PY_OBJ;
PyObject *obj = &NULL_PY_OBJ;
if(strcmp(name, "win1") == 0)
obj = SaveSubWindowsAttributes_SetWin1(self, args);
else if(strcmp(name, "win2") == 0)
obj = SaveSubWindowsAttributes_SetWin2(self, args);
else if(strcmp(name, "win3") == 0)
obj = SaveSubWindowsAttributes_SetWin3(self, args);
else if(strcmp(name, "win4") == 0)
obj = SaveSubWindowsAttributes_SetWin4(self, args);
else if(strcmp(name, "win5") == 0)
obj = SaveSubWindowsAttributes_SetWin5(self, args);
else if(strcmp(name, "win6") == 0)
obj = SaveSubWindowsAttributes_SetWin6(self, args);
else if(strcmp(name, "win7") == 0)
obj = SaveSubWindowsAttributes_SetWin7(self, args);
else if(strcmp(name, "win8") == 0)
obj = SaveSubWindowsAttributes_SetWin8(self, args);
else if(strcmp(name, "win9") == 0)
obj = SaveSubWindowsAttributes_SetWin9(self, args);
else if(strcmp(name, "win10") == 0)
obj = SaveSubWindowsAttributes_SetWin10(self, args);
else if(strcmp(name, "win11") == 0)
obj = SaveSubWindowsAttributes_SetWin11(self, args);
else if(strcmp(name, "win12") == 0)
obj = SaveSubWindowsAttributes_SetWin12(self, args);
else if(strcmp(name, "win13") == 0)
obj = SaveSubWindowsAttributes_SetWin13(self, args);
else if(strcmp(name, "win14") == 0)
obj = SaveSubWindowsAttributes_SetWin14(self, args);
else if(strcmp(name, "win15") == 0)
obj = SaveSubWindowsAttributes_SetWin15(self, args);
else if(strcmp(name, "win16") == 0)
obj = SaveSubWindowsAttributes_SetWin16(self, args);
if (obj != NULL && obj != &NULL_PY_OBJ)
Py_DECREF(obj);
if (obj == &NULL_PY_OBJ)
{
obj = NULL;
PyErr_Format(PyExc_NameError, "name '%s' is not defined", name);
}
else if (obj == NULL && !PyErr_Occurred())
PyErr_Format(PyExc_RuntimeError, "unknown problem with '%s'", name);
return (obj != NULL) ? 0 : -1;
}
static int
SaveSubWindowsAttributes_print(PyObject *v, FILE *fp, int flags)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)v;
fprintf(fp, "%s", PySaveSubWindowsAttributes_ToString(obj->data, "",false).c_str());
return 0;
}
PyObject *
SaveSubWindowsAttributes_str(PyObject *v)
{
SaveSubWindowsAttributesObject *obj = (SaveSubWindowsAttributesObject *)v;
return PyString_FromString(PySaveSubWindowsAttributes_ToString(obj->data,"", false).c_str());
}
//
// The doc string for the class.
//
#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 5)
static const char *SaveSubWindowsAttributes_Purpose = "";
#else
static char *SaveSubWindowsAttributes_Purpose = "";
#endif
//
// Python Type Struct Def Macro from Py2and3Support.h
//
// VISIT_PY_TYPE_OBJ( VPY_TYPE,
// VPY_NAME,
// VPY_OBJECT,
// VPY_DEALLOC,
// VPY_PRINT,
// VPY_GETATTR,
// VPY_SETATTR,
// VPY_STR,
// VPY_PURPOSE,
// VPY_RICHCOMP,
// VPY_AS_NUMBER)
//
// The type description structure
//
VISIT_PY_TYPE_OBJ(SaveSubWindowsAttributesType, \
"SaveSubWindowsAttributes", \
SaveSubWindowsAttributesObject, \
SaveSubWindowsAttributes_dealloc, \
SaveSubWindowsAttributes_print, \
PySaveSubWindowsAttributes_getattr, \
PySaveSubWindowsAttributes_setattr, \
SaveSubWindowsAttributes_str, \
SaveSubWindowsAttributes_Purpose, \
SaveSubWindowsAttributes_richcompare, \
0); /* as_number*/
//
// Helper function for comparing.
//
static PyObject *
SaveSubWindowsAttributes_richcompare(PyObject *self, PyObject *other, int op)
{
// only compare against the same type
if ( Py_TYPE(self) != &SaveSubWindowsAttributesType
|| Py_TYPE(other) != &SaveSubWindowsAttributesType)
{
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
PyObject *res = NULL;
SaveSubWindowsAttributes *a = ((SaveSubWindowsAttributesObject *)self)->data;
SaveSubWindowsAttributes *b = ((SaveSubWindowsAttributesObject *)other)->data;
switch (op)
{
case Py_EQ:
res = (*a == *b) ? Py_True : Py_False;
break;
case Py_NE:
res = (*a != *b) ? Py_True : Py_False;
break;
default:
res = Py_NotImplemented;
break;
}
Py_INCREF(res);
return res;
}
//
// Helper functions for object allocation.
//
static SaveSubWindowsAttributes *defaultAtts = 0;
static SaveSubWindowsAttributes *currentAtts = 0;
static PyObject *
NewSaveSubWindowsAttributes(int useCurrent)
{
SaveSubWindowsAttributesObject *newObject;
newObject = PyObject_NEW(SaveSubWindowsAttributesObject, &SaveSubWindowsAttributesType);
if(newObject == NULL)
return NULL;
if(useCurrent && currentAtts != 0)
newObject->data = new SaveSubWindowsAttributes(*currentAtts);
else if(defaultAtts != 0)
newObject->data = new SaveSubWindowsAttributes(*defaultAtts);
else
newObject->data = new SaveSubWindowsAttributes;
newObject->owns = true;
newObject->parent = 0;
return (PyObject *)newObject;
}
static PyObject *
WrapSaveSubWindowsAttributes(const SaveSubWindowsAttributes *attr)
{
SaveSubWindowsAttributesObject *newObject;
newObject = PyObject_NEW(SaveSubWindowsAttributesObject, &SaveSubWindowsAttributesType);
if(newObject == NULL)
return NULL;
newObject->data = (SaveSubWindowsAttributes *)attr;
newObject->owns = false;
newObject->parent = 0;
return (PyObject *)newObject;
}
///////////////////////////////////////////////////////////////////////////////
//
// Interface that is exposed to the VisIt module.
//
///////////////////////////////////////////////////////////////////////////////
PyObject *
SaveSubWindowsAttributes_new(PyObject *self, PyObject *args)
{
int useCurrent = 0;
if (!PyArg_ParseTuple(args, "i", &useCurrent))
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
else
PyErr_Clear();
}
return (PyObject *)NewSaveSubWindowsAttributes(useCurrent);
}
//
// Plugin method table. These methods are added to the visitmodule's methods.
//
static PyMethodDef SaveSubWindowsAttributesMethods[] = {
{"SaveSubWindowsAttributes", SaveSubWindowsAttributes_new, METH_VARARGS},
{NULL, NULL} /* Sentinel */
};
static Observer *SaveSubWindowsAttributesObserver = 0;
std::string
PySaveSubWindowsAttributes_GetLogString()
{
std::string s("SaveSubWindowsAtts = SaveSubWindowsAttributes()\n");
if(currentAtts != 0)
s += PySaveSubWindowsAttributes_ToString(currentAtts, "SaveSubWindowsAtts.", true);
return s;
}
static void
PySaveSubWindowsAttributes_CallLogRoutine(Subject *subj, void *data)
{
typedef void (*logCallback)(const std::string &);
logCallback cb = (logCallback)data;
if(cb != 0)
{
std::string s("SaveSubWindowsAtts = SaveSubWindowsAttributes()\n");
s += PySaveSubWindowsAttributes_ToString(currentAtts, "SaveSubWindowsAtts.", true);
cb(s);
}
}
void
PySaveSubWindowsAttributes_StartUp(SaveSubWindowsAttributes *subj, void *data)
{
if(subj == 0)
return;
currentAtts = subj;
PySaveSubWindowsAttributes_SetDefaults(subj);
//
// Create the observer that will be notified when the attributes change.
//
if(SaveSubWindowsAttributesObserver == 0)
{
SaveSubWindowsAttributesObserver = new ObserverToCallback(subj,
PySaveSubWindowsAttributes_CallLogRoutine, (void *)data);
}
}
void
PySaveSubWindowsAttributes_CloseDown()
{
delete defaultAtts;
defaultAtts = 0;
delete SaveSubWindowsAttributesObserver;
SaveSubWindowsAttributesObserver = 0;
}
PyMethodDef *
PySaveSubWindowsAttributes_GetMethodTable(int *nMethods)
{
*nMethods = 1;
return SaveSubWindowsAttributesMethods;
}
bool
PySaveSubWindowsAttributes_Check(PyObject *obj)
{
return (obj->ob_type == &SaveSubWindowsAttributesType);
}
SaveSubWindowsAttributes *
PySaveSubWindowsAttributes_FromPyObject(PyObject *obj)
{
SaveSubWindowsAttributesObject *obj2 = (SaveSubWindowsAttributesObject *)obj;
return obj2->data;
}
PyObject *
PySaveSubWindowsAttributes_New()
{
return NewSaveSubWindowsAttributes(0);
}
PyObject *
PySaveSubWindowsAttributes_Wrap(const SaveSubWindowsAttributes *attr)
{
return WrapSaveSubWindowsAttributes(attr);
}
void
PySaveSubWindowsAttributes_SetParent(PyObject *obj, PyObject *parent)
{
SaveSubWindowsAttributesObject *obj2 = (SaveSubWindowsAttributesObject *)obj;
obj2->parent = parent;
}
void
PySaveSubWindowsAttributes_SetDefaults(const SaveSubWindowsAttributes *atts)
{
if(defaultAtts)
delete defaultAtts;
defaultAtts = new SaveSubWindowsAttributes(*atts);
}
|
9a3b9d508f141681cd45e404e9e2fcc38a08fe6b
|
f3eed0234b4d0ad2bbb2abd700cf1e2c7a0e8a1d
|
/AKWF-c/AKWF_stereo/AKWF_stereo_0131.h
|
76297ccd8d01a0e3c22877e1ea74ddec31a6e9b3
|
[
"CC0-1.0"
] |
permissive
|
KristofferKarlAxelEkstrand/AKWF-FREE
|
b2defa1a2d389d309be6dd2e9f968923daf80d1b
|
cf8171df36e9fec25416b5f568b72a6e2cb69194
|
refs/heads/master
| 2023-07-23T18:22:36.939705
| 2023-07-10T17:14:40
| 2023-07-10T17:14:40
| 145,817,187
| 359
| 59
|
CC0-1.0
| 2023-07-10T17:14:41
| 2018-08-23T07:26:56
| null |
UTF-8
|
C
| false
| false
| 6,478
|
h
|
AKWF_stereo_0131.h
|
/* Adventure Kid Waveforms (AKWF) converted for use with Teensy Audio Library
*
* Adventure Kid Waveforms(AKWF) Open waveforms library
* https://www.adventurekid.se/akrt/waveforms/adventure-kid-waveforms/
*
* This code is in the public domain, CC0 1.0 Universal (CC0 1.0)
* https://creativecommons.org/publicdomain/zero/1.0/
*
* Converted by Brad Roy, https://github.com/prosper00
*/
/* AKWF_stereo_0131 256 samples
+-----------------------------------------------------------------------------------------------------------------+
| ******* ******* |
| **** **** |
| **** **** |
| **** *** |
| *** **** |
| **** *** |
|*** *** |
|* *** *|
| *** ***|
| *** **** |
| **** *** |
| *** **** |
| **** **** |
| **** ***** |
| ***** ***** |
+-----------------------------------------------------------------------------------------------------------------+
*/
const uint16_t AKWF_stereo_0131 [] = {
32896, 38507, 33592, 42447, 34326, 42012, 35108, 43373, 35971, 43646, 36787, 44819, 37682, 45321, 38579, 46418,
39315, 46924, 40049, 47800, 40801, 48377, 41547, 49188, 42361, 49846, 43112, 50568, 43773, 51098, 44446, 51699,
45115, 52272, 45863, 52949, 46684, 53732, 47394, 54326, 48042, 54876, 48619, 55293, 49150, 55743, 49749, 56176,
50386, 56753, 51024, 57235, 51664, 57795, 52209, 58203, 52723, 58669, 53299, 59092, 53932, 59616, 54657, 60154,
55374, 60723, 56009, 61122, 56616, 61558, 57179, 61956, 57706, 62384, 58211, 62788, 58688, 63129, 59104, 63342,
59431, 63460, 59702, 63566, 59999, 63723, 60336, 63928, 60680, 64127, 61023, 64320, 61325, 64426, 61608, 64521,
61869, 64564, 62146, 64622, 62463, 64742, 62825, 64931, 63151, 65032, 63381, 65022, 63511, 64928, 63628, 64876,
63868, 64948, 64156, 65088, 64377, 65166, 64550, 65131, 64678, 64996, 64720, 64805, 64766, 64632, 64775, 64463,
64718, 64271, 64625, 64003, 64474, 63624, 64306, 63206, 64129, 62779, 63982, 62453, 63861, 62203, 63696, 61892,
63462, 61461, 63203, 60953, 62874, 60418, 62543, 59922, 62269, 59485, 61995, 59063, 61698, 58622, 61399, 58090,
61084, 57520, 60771, 56965, 60507, 56498, 60235, 56131, 59966, 55794, 59641, 55350, 59284, 54773, 58932, 54172,
58649, 53696, 58343, 53251, 57905, 52721, 57389, 52088, 56802, 51322, 56206, 50519, 55575, 49726, 55033, 49076,
54604, 48574, 54125, 48046, 53550, 47400, 52934, 46642, 52290, 45802, 51707, 45002, 51227, 44372, 50684, 43779,
50062, 43154, 49335, 42385, 48589, 41515, 47882, 40701, 47143, 39905, 46527, 39248, 45893, 38582, 45133, 37792,
44387, 36941, 43541, 35959, 42661, 34952, 41923, 34097, 41195, 33331, 40409, 32562, 39581, 31740, 38705, 30809,
37838, 29866, 37048, 29040, 36221, 28232, 35319, 27369, 34408, 26507, 33536, 25645, 32800, 24846, 32028, 24030,
31250, 23201, 30516, 22443, 29701, 21674, 28889, 20881, 28180, 20180, 27460, 19469, 26752, 18789, 26144, 18269,
25494, 17716, 24799, 17124, 24132, 16507, 23409, 15758, 22674, 15019, 22012, 14402, 21293, 13754, 20547, 13099,
19773, 12416, 19061, 11772, 18471, 11271, 17860, 10777, 17211, 10278, 16566, 9777, 15910, 9261, 15283, 8783,
14716, 8317, 14164, 7859, 13645, 7466, 13083, 7042, 12512, 6606, 11959, 6183, 11439, 5764, 11031, 5431,
10569, 5083, 9993, 4697, 9438, 4371, 8903, 4061, 8393, 3764, 7929, 3478, 7402, 3102, 6825, 2705,
6274, 2353, 5755, 2013, 5341, 1738, 5001, 1506, 4680, 1294, 4269, 1041, 3709, 703, 3160, 411,
2713, 191, 2392, 61, 2229, 43, 2125, 75, 1941, 78, 1705, 37, 1489, 0, 1356, 48,
1370, 223, 1511, 483, 1655, 781, 1668, 1012, 1589, 1190, 1481, 1316, 1389, 1436, 1375, 1610,
1433, 1828, 1469, 2076, 1423, 2309, 1326, 2486, 1308, 2672, 1494, 2993, 1822, 3426, 2197, 3900,
2457, 4353, 2569, 4735, 2654, 5113, 2805, 5516, 3107, 5988, 3553, 6535, 4037, 7120, 4473, 7710,
4821, 8244, 5125, 8715, 5541, 9227, 6061, 9864, 6624, 10540, 7119, 11220, 7486, 11830, 7836, 12465,
8190, 13043, 8609, 13693, 9145, 14324, 9673, 14977, 10099, 15564, 10508, 16210, 10878, 16755, 11324, 17321,
11904, 17965, 12496, 18617, 13066, 19260, 13505, 19817, 13865, 20347, 14294, 20920, 14774, 21599, 15345, 22283,
16032, 23096, 16583, 23708, 17156, 24439, 17814, 25155, 18472, 25979, 19235, 26708, 20074, 27624, 20841, 28312,
21584, 29244, 22334, 30025, 22948, 30807, 23567, 31376, 24213, 32175, 24902, 32795, 25642, 33659, 26366, 34378,
27124, 35233, 27949, 36040, 28680, 36794, 29391, 37556, 30034, 38076, 30692, 38972, 31392, 39356, 32191, 40960,
};
|
4a466c4f3256e5cb56222137e22c924d63e81e94
|
ffdc77394c5b5532b243cf3c33bd584cbdc65cb7
|
/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/fp16/winograd_utils_fp16.c
|
7757d2fb42cf868664d0a3048d0f285ee44030ca
|
[
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"MPL-1.0",
"OpenSSL",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause-Open-MPI",
"MIT",
"MPL-2.0-no-copyleft-exception",
"NTP",
"BSD-3-Clause",
"GPL-1.0-or-later",
"0BSD",
"MPL-2.0",
"LicenseRef-scancode-free-unknown",
"AGPL-3.0-only",
"Libpng",
"MPL-1.1",
"IJG",
"GPL-2.0-only",
"BSL-1.0",
"Zlib",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-python-cwi",
"BSD-2-Clause",
"LicenseRef-scancode-gary-s-brown",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"Python-2.0",
"LicenseRef-scancode-mit-nagy",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense"
] |
permissive
|
mindspore-ai/mindspore
|
ca7d5bb51a3451c2705ff2e583a740589d80393b
|
54acb15d435533c815ee1bd9f6dc0b56b4d4cf83
|
refs/heads/master
| 2023-07-29T09:17:11.051569
| 2023-07-17T13:14:15
| 2023-07-17T13:14:15
| 239,714,835
| 4,178
| 768
|
Apache-2.0
| 2023-07-26T22:31:11
| 2020-02-11T08:43:48
|
C++
|
UTF-8
|
C
| false
| false
| 153,545
|
c
|
winograd_utils_fp16.c
|
/**
* Copyright 2020 Huawei Technologies Co., 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.
*/
#include "nnacl/fp16/winograd_utils_fp16.h"
#include "nnacl/fp16/matrix_fp16.h"
#define MIN_UNIT_FP16 2
#define MAX_UNIT_FP16 4
#ifdef ENABLE_ARM64
void transpose8(float16x8_t *s0, float16x8_t *s1, float16x8_t *s2, float16x8_t *s3, float16x8_t *s4, float16x8_t *s5,
float16x8_t *s6, float16x8_t *s7) {
float32x4_t m0 = (float32x4_t)(vtrn1q_f16(*s0, *s1));
float32x4_t m1 = (float32x4_t)(vtrn2q_f16(*s0, *s1));
float32x4_t m2 = (float32x4_t)(vtrn1q_f16(*s2, *s3));
float32x4_t m3 = (float32x4_t)(vtrn2q_f16(*s2, *s3));
float32x4_t m4 = (float32x4_t)(vtrn1q_f16(*s4, *s5));
float32x4_t m5 = (float32x4_t)(vtrn2q_f16(*s4, *s5));
float32x4_t m6 = (float32x4_t)(vtrn1q_f16(*s6, *s7));
float32x4_t m7 = (float32x4_t)(vtrn2q_f16(*s6, *s7));
float64x2_t t0 = (float64x2_t)(vtrn1q_f32(m0, m2));
float64x2_t t2 = (float64x2_t)(vtrn2q_f32(m0, m2));
float64x2_t t1 = (float64x2_t)(vtrn1q_f32(m1, m3));
float64x2_t t3 = (float64x2_t)(vtrn2q_f32(m1, m3));
float64x2_t t4 = (float64x2_t)(vtrn1q_f32(m4, m6));
float64x2_t t6 = (float64x2_t)(vtrn2q_f32(m4, m6));
float64x2_t t5 = (float64x2_t)(vtrn1q_f32(m5, m7));
float64x2_t t7 = (float64x2_t)(vtrn2q_f32(m5, m7));
*s0 = (float16x8_t)(vtrn1q_f64(t0, t4));
*s4 = (float16x8_t)(vtrn2q_f64(t0, t4));
*s1 = (float16x8_t)(vtrn1q_f64(t1, t5));
*s5 = (float16x8_t)(vtrn2q_f64(t1, t5));
*s2 = (float16x8_t)(vtrn1q_f64(t2, t6));
*s6 = (float16x8_t)(vtrn2q_f64(t2, t6));
*s3 = (float16x8_t)(vtrn1q_f64(t3, t7));
*s7 = (float16x8_t)(vtrn2q_f64(t3, t7));
}
#endif
static InputTransFp16Func InputTransFp16FuncList[] = {
NULL, NULL, NULL, NULL, InputTransform4x4UnitFp16, NULL, InputTransform6x6UnitFp16, NULL, InputTransform8x8UnitFp16};
static OutputTransFp16Func OutputTransFp16FuncList4[] = {NULL, NULL, OutputTransform4x2UnitFp16,
OutputTransform4x3UnitFp16};
static OutputTransFp16Func OutputTransFp16FuncReluList4[] = {NULL, NULL, OutputTransform4x2ReluUnitFp16,
OutputTransform4x3ReluUnitFp16};
static OutputTransFp16Func OutputTransFp16FuncRelu6List4[] = {NULL, NULL, OutputTransform4x2Relu6UnitFp16,
OutputTransform4x3Relu6UnitFp16};
static OutputTransFp16Func OutputTransFp16FuncList6[] = {NULL,
NULL,
OutputTransform6x2UnitFp16,
OutputTransform6x3UnitFp16,
OutputTransform6x4UnitFp16,
OutputTransform6x5UnitFp16};
static OutputTransFp16Func OutputTransFp16FuncReluList6[] = {NULL,
NULL,
OutputTransform6x2ReluUnitFp16,
OutputTransform6x3ReluUnitFp16,
OutputTransform6x4ReluUnitFp16,
OutputTransform6x5ReluUnitFp16};
static OutputTransFp16Func OutputTransFp16FuncRelu6List6[] = {NULL,
NULL,
OutputTransform6x2Relu6UnitFp16,
OutputTransform6x3Relu6UnitFp16,
OutputTransform6x4Relu6UnitFp16,
OutputTransform6x5Relu6UnitFp16};
static OutputTransFp16Func OutputTransFp16FuncList8[] = {NULL,
NULL,
OutputTransform8x2UnitFp16,
OutputTransform8x3UnitFp16,
OutputTransform8x4UnitFp16,
OutputTransform8x5UnitFp16,
OutputTransform8x6UnitFp16,
OutputTransform8x7UnitFp16};
static OutputTransFp16Func OutputTransFp16FuncReluList8[] = {NULL,
NULL,
OutputTransform8x2ReluUnitFp16,
OutputTransform8x3ReluUnitFp16,
OutputTransform8x4ReluUnitFp16,
OutputTransform8x5ReluUnitFp16,
OutputTransform8x6ReluUnitFp16,
OutputTransform8x7ReluUnitFp16};
static OutputTransFp16Func OutputTransFp16FuncRelu6List8[] = {NULL,
NULL,
OutputTransform8x2Relu6UnitFp16,
OutputTransform8x3Relu6UnitFp16,
OutputTransform8x4Relu6UnitFp16,
OutputTransform8x5Relu6UnitFp16,
OutputTransform8x6Relu6UnitFp16,
OutputTransform8x7Relu6UnitFp16};
InputTransFp16Func GetInputTransFp16Func(int input_unit) { return InputTransFp16FuncList[input_unit]; }
#ifdef ENABLE_ARM64
static InputTransStepFp16Func InputTransStepFp16FuncList[] = {
NULL, NULL, NULL, NULL, InputTransform4x4StepFp16, NULL, InputTransform6x6StepFp16, NULL, InputTransform8x8StepFp16};
static InputTransPackFp16Func InputTransPackFp16FuncList[] = {NULL,
NULL,
NULL,
NULL,
InputTransform4x4Pack16Fp16,
NULL,
InputTransform6x6Pack16Fp16,
NULL,
InputTransform8x8Pack16Fp16};
InputTransStepFp16Func GetInputTransStepFp16Func(int input_unit) { return InputTransStepFp16FuncList[input_unit]; }
InputTransPackFp16Func GetInputTransPackFp16Func(int input_unit) { return InputTransPackFp16FuncList[input_unit]; }
#endif
void InputTransform4x4UnitFp16(const float16_t *src_data, float16_t *dst_data, int src_step, int dst_step, int real_c) {
int j = 0;
if (real_c == 8) {
float16x8_t src[16];
float16x8_t t[16];
float16x8_t m[16];
Load16DataFp16;
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
t[l] = vsubq_f16(src[offset], src[2 + offset]);
t[4 + l] = vaddq_f16(src[1 + offset], src[2 + offset]);
t[8 + l] = vsubq_f16(src[2 + offset], src[1 + offset]);
t[12 + l] = vsubq_f16(src[3 + offset], src[1 + offset]);
}
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
m[l] = vsubq_f16(t[offset], t[2 + offset]);
m[4 + l] = vaddq_f16(t[1 + offset], t[2 + offset]);
m[8 + l] = vsubq_f16(t[2 + offset], t[1 + offset]);
m[12 + l] = vsubq_f16(t[3 + offset], t[1 + offset]);
}
for (int i = 0; i < 16; i++) {
int dst_offset = i * dst_step;
vst1q_f16(dst_data + dst_offset, m[i]);
}
real_c -= 8;
} else if (real_c < 8 && real_c >= 4) {
float16x4_t src[16];
float16x4_t t[16];
float16x4_t m[16];
Load16DataC4Fp16;
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
t[l] = vsub_f16(src[offset], src[2 + offset]);
t[4 + l] = vadd_f16(src[1 + offset], src[2 + offset]);
t[8 + l] = vsub_f16(src[2 + offset], src[1 + offset]);
t[12 + l] = vsub_f16(src[3 + offset], src[1 + offset]);
}
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
m[l] = vsub_f16(t[offset], t[2 + offset]);
m[4 + l] = vadd_f16(t[1 + offset], t[2 + offset]);
m[8 + l] = vsub_f16(t[2 + offset], t[1 + offset]);
m[12 + l] = vsub_f16(t[3 + offset], t[1 + offset]);
}
for (int i = 0; i < 16; i++) {
int dst_offset = i * dst_step;
vst1_f16(dst_data + dst_offset, m[i]);
}
j = 4;
}
for (; j < real_c; ++j) {
float16_t src[16];
float16_t t[16];
float16_t m[16];
for (int k = 0; k < 16; ++k) {
src[k] = src_data[j + k * src_step];
}
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
t[l] = src[offset] - src[2 + offset];
t[4 + l] = src[1 + offset] + src[2 + offset];
t[8 + l] = src[2 + offset] - src[1 + offset];
t[12 + l] = src[3 + offset] - src[1 + offset];
}
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
m[l] = t[offset] - t[2 + offset];
m[4 + l] = t[1 + offset] + t[2 + offset];
m[8 + l] = t[2 + offset] - t[1 + offset];
m[12 + l] = t[3 + offset] - t[1 + offset];
}
for (int i = 0; i < 16; i++) {
int dst_offset = i * dst_step;
dst_data[j + dst_offset] = m[i];
}
}
}
void InputTransform4x4StepFp16(const float16_t *src_data, float16_t *dst_data, int src_step, int dst_step,
int dst_row_step) {
for (int l = 0; l < 4; ++l) {
const float16_t *src_ptr = src_data + l * 4 * src_step;
float16_t *dst_ptr = dst_data + l * dst_row_step;
float16x8_t s0 = vld1q_f16(src_ptr + 0 * src_step);
float16x8_t s1 = vld1q_f16(src_ptr + 1 * src_step);
float16x8_t s2 = vld1q_f16(src_ptr + 2 * src_step);
float16x8_t s3 = vld1q_f16(src_ptr + 3 * src_step);
float16x8_t m0 = vsubq_f16(s0, s2);
float16x8_t m1 = vaddq_f16(s1, s2);
float16x8_t m2 = vsubq_f16(s2, s1);
float16x8_t m3 = vsubq_f16(s3, s1);
vst1q_f16(dst_ptr + 0 * dst_step, m0);
vst1q_f16(dst_ptr + 1 * dst_step, m1);
vst1q_f16(dst_ptr + 2 * dst_step, m2);
vst1q_f16(dst_ptr + 3 * dst_step, m3);
}
}
#ifdef ENABLE_ARM64
void InputTransform4x4Pack16ChannelFp16(float16_t *src_ptr, float16_t *dst_ptr, int dst_step, int pack_tile,
int src_point_stride) {
LOAD_LINE_DATA_FP16(0);
LOAD_LINE_DATA_FP16(1);
LOAD_LINE_DATA_FP16(2);
LOAD_LINE_DATA_FP16(3);
float16x8_t m0 = vsubq_f16(s00, s20);
float16x8_t m1 = vsubq_f16(s01, s21);
vst1q_f16(dst_ptr + 0 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 0 * dst_step + 1 * pack_tile, m1);
m0 = vaddq_f16(s10, s20);
m1 = vaddq_f16(s11, s21);
vst1q_f16(dst_ptr + 1 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 1 * dst_step + 1 * pack_tile, m1);
m0 = vsubq_f16(s20, s10);
m1 = vsubq_f16(s21, s11);
vst1q_f16(dst_ptr + 2 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 2 * dst_step + 1 * pack_tile, m1);
m0 = vsubq_f16(s30, s10);
m1 = vsubq_f16(s31, s11);
vst1q_f16(dst_ptr + 3 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 3 * dst_step + 1 * pack_tile, m1);
}
void InputTransform4x4Pack16Fp16(float16_t *src_data, float16_t *dst_data, int src_step, int dst_step, int real_c) {
int block_tile = 16;
int pack_tile = src_step;
int src_point_stride = block_tile * pack_tile;
for (int l = 0; l < 4; ++l) {
float16_t *src_ptr = src_data + l * C8NUM * block_tile;
TRANSPOSE_16x8;
}
for (int c = 0; c < real_c; ++c) {
float16_t *src_ptr = src_data + c * block_tile;
float16_t *dst_ptr = dst_data + c * block_tile;
InputTransform4x4Pack16ChannelFp16(src_ptr, dst_ptr, dst_step, pack_tile, src_point_stride);
}
}
#endif
void InputTransform6x6UnitFp16(const float16_t *src_data, float16_t *dst_data, int src_step, int dst_step, int real_c) {
int j = 0;
if (real_c == 8) {
float16x8_t src[36];
float16x8_t t[36];
float16x8_t m[36];
Load36DataFp16;
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vsubq_f16(src[3 + offset], src[1 + offset]);
float16x8_t tmp2 = vsubq_f16(src[4 + offset], src[2 + offset]);
t[l] = vaddq_f16(vsubq_f16(vmulq_n_f16(src[offset], 4), vmulq_n_f16(src[2 + offset], 5)), src[4 + offset]);
t[6 + l] = vaddq_f16(vmulq_n_f16(vaddq_f16(src[1 + offset], src[2 + offset]), -4),
vaddq_f16(src[3 + offset], src[4 + offset]));
t[12 + l] = vaddq_f16(vmulq_n_f16(vsubq_f16(src[1 + offset], src[2 + offset]), 4),
vsubq_f16(src[4 + offset], src[3 + offset]));
t[18 + l] = vaddq_f16(vmulq_n_f16(tmp1, 2), tmp2);
t[24 + l] = vaddq_f16(vmulq_n_f16(tmp1, -2), tmp2);
t[30 + l] =
vaddq_f16(vsubq_f16(vmulq_n_f16(src[1 + offset], 4), vmulq_n_f16(src[3 + offset], 5)), src[5 + offset]);
}
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vsubq_f16(t[3 + offset], t[1 + offset]);
float16x8_t tmp2 = vsubq_f16(t[4 + offset], t[2 + offset]);
m[l] = vaddq_f16(vsubq_f16(vmulq_n_f16(t[offset], 4), vmulq_n_f16(t[2 + offset], 5)), t[4 + offset]);
m[6 + l] =
vaddq_f16(vmulq_n_f16(vaddq_f16(t[1 + offset], t[2 + offset]), -4), vaddq_f16(t[3 + offset], t[4 + offset]));
m[12 + l] =
vaddq_f16(vmulq_n_f16(vsubq_f16(t[1 + offset], t[2 + offset]), 4), vsubq_f16(t[4 + offset], t[3 + offset]));
m[18 + l] = vaddq_f16(vmulq_n_f16(tmp1, 2), tmp2);
m[24 + l] = vaddq_f16(vmulq_n_f16(tmp1, -2), tmp2);
m[30 + l] = vaddq_f16(vsubq_f16(vmulq_n_f16(t[1 + offset], 4), vmulq_n_f16(t[3 + offset], 5)), t[5 + offset]);
}
for (int i = 0; i < 36; i++) {
int dst_offset = i * dst_step;
vst1q_f16(dst_data + dst_offset, m[i]);
}
real_c -= 8;
} else if (real_c < 8 && real_c >= 4) {
float16x4_t src[36];
float16x4_t t[36];
float16x4_t m[36];
Load36DataC4Fp16;
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16x4_t tmp1 = vsub_f16(src[3 + offset], src[1 + offset]);
float16x4_t tmp2 = vsub_f16(src[4 + offset], src[2 + offset]);
t[l] = vadd_f16(vsub_f16(vmul_n_f16(src[offset], 4), vmul_n_f16(src[2 + offset], 5)), src[4 + offset]);
t[6 + l] = vadd_f16(vmul_n_f16(vadd_f16(src[1 + offset], src[2 + offset]), -4),
vadd_f16(src[3 + offset], src[4 + offset]));
t[12 + l] =
vadd_f16(vmul_n_f16(vsub_f16(src[1 + offset], src[2 + offset]), 4), vsub_f16(src[4 + offset], src[3 + offset]));
t[18 + l] = vadd_f16(vmul_n_f16(tmp1, 2), tmp2);
t[24 + l] = vadd_f16(vmul_n_f16(tmp1, -2), tmp2);
t[30 + l] = vadd_f16(vsub_f16(vmul_n_f16(src[1 + offset], 4), vmul_n_f16(src[3 + offset], 5)), src[5 + offset]);
}
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16x4_t tmp1 = vsub_f16(t[3 + offset], t[1 + offset]);
float16x4_t tmp2 = vsub_f16(t[4 + offset], t[2 + offset]);
m[l] = vadd_f16(vsub_f16(vmul_n_f16(t[offset], 4), vmul_n_f16(t[2 + offset], 5)), t[4 + offset]);
m[6 + l] =
vadd_f16(vmul_n_f16(vadd_f16(t[1 + offset], t[2 + offset]), -4), vadd_f16(t[3 + offset], t[4 + offset]));
m[12 + l] =
vadd_f16(vmul_n_f16(vsub_f16(t[1 + offset], t[2 + offset]), 4), vsub_f16(t[4 + offset], t[3 + offset]));
m[18 + l] = vadd_f16(vmul_n_f16(tmp1, 2), tmp2);
m[24 + l] = vadd_f16(vmul_n_f16(tmp1, -2), tmp2);
m[30 + l] = vadd_f16(vsub_f16(vmul_n_f16(t[1 + offset], 4), vmul_n_f16(t[3 + offset], 5)), t[5 + offset]);
}
for (int i = 0; i < 36; i++) {
int dst_offset = i * dst_step;
vst1_f16(dst_data + dst_offset, m[i]);
}
j = 4;
}
for (; j < real_c; ++j) {
float16_t src[36];
float16_t t[36];
float16_t m[36];
for (int k = 0; k < 36; ++k) {
src[k] = src_data[j + k * src_step];
}
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16_t tmp1 = src[3 + offset] - src[1 + offset];
float16_t tmp2 = src[4 + offset] - src[2 + offset];
t[l] = src[offset] * 4 - src[2 + offset] * 5 + src[4 + offset];
t[6 + l] = (src[1 + offset] + src[2 + offset]) * -4 + (src[3 + offset] + src[4 + offset]);
t[12 + l] = (src[1 + offset] - src[2 + offset]) * 4 + (src[4 + offset] - src[3 + offset]);
t[18 + l] = tmp1 * 2 + tmp2;
t[24 + l] = tmp1 * -2 + tmp2;
t[30 + l] = src[1 + offset] * 4 - src[3 + offset] * 5 + src[5 + offset];
}
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16_t tmp1 = t[3 + offset] - t[1 + offset];
float16_t tmp2 = t[4 + offset] - t[2 + offset];
m[l] = t[offset] * 4 - t[2 + offset] * 5 + t[4 + offset];
m[6 + l] = (t[1 + offset] + t[2 + offset]) * -4 + (t[3 + offset] + t[4 + offset]);
m[12 + l] = (t[1 + offset] - t[2 + offset]) * 4 + (t[4 + offset] - t[3 + offset]);
m[18 + l] = tmp1 * 2 + tmp2;
m[24 + l] = tmp1 * -2 + tmp2;
m[30 + l] = t[1 + offset] * 4 - t[3 + offset] * 5 + t[5 + offset];
}
for (int i = 0; i < 36; i++) {
int dst_offset = i * dst_step;
dst_data[j + dst_offset] = m[i];
}
}
}
void InputTransform6x6StepFp16(const float16_t *src_data, float16_t *dst_data, int src_step, int dst_step,
int dst_row_step) {
for (int l = 0; l < 6; ++l) {
const float16_t *src_ptr = src_data + l * 6 * src_step;
float16_t *dst_ptr = dst_data + l * dst_row_step;
float16x8_t s0 = vld1q_f16(src_ptr + 0 * src_step);
float16x8_t s1 = vld1q_f16(src_ptr + 1 * src_step);
float16x8_t s2 = vld1q_f16(src_ptr + 2 * src_step);
float16x8_t s3 = vld1q_f16(src_ptr + 3 * src_step);
float16x8_t s4 = vld1q_f16(src_ptr + 4 * src_step);
float16x8_t s5 = vld1q_f16(src_ptr + 5 * src_step);
float16x8_t tmp1 = vsubq_f16(s3, s1);
float16x8_t tmp2 = vsubq_f16(s4, s2);
float16x8_t m0 = vaddq_f16(vsubq_f16(vmulq_n_f16(s0, 4), vmulq_n_f16(s2, 5)), s4);
float16x8_t m1 = vaddq_f16(vmulq_n_f16(vaddq_f16(s1, s2), -4), vaddq_f16(s3, s4));
float16x8_t m2 = vaddq_f16(vmulq_n_f16(vsubq_f16(s1, s2), 4), vsubq_f16(s4, s3));
float16x8_t m3 = vaddq_f16(vmulq_n_f16(tmp1, 2), tmp2);
float16x8_t m4 = vaddq_f16(vmulq_n_f16(tmp1, -2), tmp2);
float16x8_t m5 = vaddq_f16(vsubq_f16(vmulq_n_f16(s1, 4), vmulq_n_f16(s3, 5)), s5);
vst1q_f16(dst_ptr + 0 * dst_step, m0);
vst1q_f16(dst_ptr + 1 * dst_step, m1);
vst1q_f16(dst_ptr + 2 * dst_step, m2);
vst1q_f16(dst_ptr + 3 * dst_step, m3);
vst1q_f16(dst_ptr + 4 * dst_step, m4);
vst1q_f16(dst_ptr + 5 * dst_step, m5);
}
}
#ifdef ENABLE_ARM64
void InputTransform6x6Pack16ChannelFp16(float16_t *src_ptr, float16_t *dst_ptr, int dst_step, int pack_tile,
int src_point_stride) {
LOAD_LINE_DATA_FP16(0);
LOAD_LINE_DATA_FP16(1);
LOAD_LINE_DATA_FP16(2);
LOAD_LINE_DATA_FP16(3);
LOAD_LINE_DATA_FP16(4);
LOAD_LINE_DATA_FP16(5);
float16x8_t m0 = vaddq_f16(vsubq_f16(vmulq_n_f16(s00, 4), vmulq_n_f16(s20, 5)), s40);
float16x8_t m1 = vaddq_f16(vsubq_f16(vmulq_n_f16(s01, 4), vmulq_n_f16(s21, 5)), s41);
vst1q_f16(dst_ptr + 0 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 0 * dst_step + 1 * pack_tile, m1);
m0 = vaddq_f16(vmulq_n_f16(vaddq_f16(s10, s20), -4), vaddq_f16(s30, s40));
m1 = vaddq_f16(vmulq_n_f16(vaddq_f16(s11, s21), -4), vaddq_f16(s31, s41));
vst1q_f16(dst_ptr + 1 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 1 * dst_step + 1 * pack_tile, m1);
m0 = vaddq_f16(vmulq_n_f16(vsubq_f16(s10, s20), 4), vsubq_f16(s40, s30));
m1 = vaddq_f16(vmulq_n_f16(vsubq_f16(s11, s21), 4), vsubq_f16(s41, s31));
vst1q_f16(dst_ptr + 2 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 2 * dst_step + 1 * pack_tile, m1);
m0 = vaddq_f16(vmulq_n_f16(vsubq_f16(s30, s10), 2), vsubq_f16(s40, s20));
m1 = vaddq_f16(vmulq_n_f16(vsubq_f16(s31, s11), 2), vsubq_f16(s41, s21));
vst1q_f16(dst_ptr + 3 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 3 * dst_step + 1 * pack_tile, m1);
m0 = vaddq_f16(vmulq_n_f16(vsubq_f16(s30, s10), -2), vsubq_f16(s40, s20));
m1 = vaddq_f16(vmulq_n_f16(vsubq_f16(s31, s11), -2), vsubq_f16(s41, s21));
vst1q_f16(dst_ptr + 4 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 4 * dst_step + 1 * pack_tile, m1);
m0 = vaddq_f16(vsubq_f16(vmulq_n_f16(s10, 4), vmulq_n_f16(s30, 5)), s50);
m1 = vaddq_f16(vsubq_f16(vmulq_n_f16(s11, 4), vmulq_n_f16(s31, 5)), s51);
vst1q_f16(dst_ptr + 5 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 5 * dst_step + 1 * pack_tile, m1);
}
void InputTransform6x6Pack16Fp16(float16_t *src_data, float16_t *dst_data, int src_step, int dst_step, int real_c) {
int block_tile = 16;
int pack_tile = src_step;
int src_point_stride = block_tile * pack_tile;
for (int l = 0; l < 6; ++l) {
float16_t *src_ptr = src_data + l * C8NUM * block_tile;
TRANSPOSE_16x8;
}
for (int c = 0; c < real_c; ++c) {
float16_t *src_ptr = src_data + c * block_tile;
float16_t *dst_ptr = dst_data + c * block_tile;
InputTransform6x6Pack16ChannelFp16(src_ptr, dst_ptr, dst_step, pack_tile, src_point_stride);
}
}
#endif
void InputTransform8x8UnitFp16(const float16_t *src_data, float16_t *dst_data, int src_step, int dst_step, int real_c) {
int j = 0;
if (real_c == 8) {
float16x8_t src[64];
float16x8_t t[64];
float16x8_t m[64];
Load64DataFp16;
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
t[l] = vsubq_f16(vaddq_f16(vsubq_f16(vmulq_n_f16(src[offset], 0.5625), vmulq_n_f16(src[2 + offset], 3.0625)),
vmulq_n_f16(src[4 + offset], 3.5)),
src[6 + offset]);
float16x8_t tmp1 = vaddq_f16(vmulq_n_f16(src[1 + offset], 1.125), vmulq_n_f16(src[5 + offset], 0.5));
float16x8_t tmp2 = vsubq_f16(vmulq_n_f16(src[2 + offset], 2.25), vmulq_n_f16(src[4 + offset], 3.25));
t[8 + l] = vaddq_f16(vsubq_f16(vaddq_f16(tmp1, tmp2), vmulq_n_f16(src[3 + offset], 1.625)), src[6 + offset]);
t[16 + l] = vaddq_f16(vaddq_f16(vsubq_f16(tmp2, tmp1), vmulq_n_f16(src[3 + offset], 1.625)), src[6 + offset]);
tmp1 = vaddq_f16(vmulq_n_f16(src[1 + offset], 0.5625), src[5 + offset]);
tmp2 = vsubq_f16(vmulq_n_f16(src[2 + offset], 0.5625), vmulq_n_f16(src[4 + offset], 2.5));
t[24 + l] = vaddq_f16(vsubq_f16(vaddq_f16(tmp1, tmp2), vmulq_n_f16(src[3 + offset], 2.5)), src[6 + offset]);
t[32 + l] = vaddq_f16(vaddq_f16(vsubq_f16(tmp2, tmp1), vmulq_n_f16(src[3 + offset], 2.5)), src[6 + offset]);
tmp1 = vaddq_f16(vmulq_n_f16(src[1 + offset], 0.375), vmulq_n_f16(src[5 + offset], 1.5));
tmp2 = vsubq_f16(vmulq_n_f16(src[2 + offset], 0.25), vmulq_n_f16(src[4 + offset], 1.25));
t[40 + l] = vaddq_f16(vsubq_f16(vaddq_f16(tmp1, tmp2), vmulq_n_f16(src[3 + offset], 1.875)), src[6 + offset]);
t[48 + l] = vaddq_f16(vaddq_f16(vsubq_f16(tmp2, tmp1), vmulq_n_f16(src[3 + offset], 1.875)), src[6 + offset]);
t[56 + l] =
vaddq_f16(vsubq_f16(vaddq_f16(vmulq_n_f16(src[1 + offset], -0.5625), vmulq_n_f16(src[3 + offset], 3.0625)),
vmulq_n_f16(src[5 + offset], 3.5)),
src[7 + offset]);
}
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
m[l] = vsubq_f16(vaddq_f16(vsubq_f16(vmulq_n_f16(t[offset], 0.5625), vmulq_n_f16(t[2 + offset], 3.0625)),
vmulq_n_f16(t[4 + offset], 3.5)),
t[6 + offset]);
float16x8_t tmp1 = vaddq_f16(vmulq_n_f16(t[1 + offset], 1.125), vmulq_n_f16(t[5 + offset], 0.5));
float16x8_t tmp2 = vsubq_f16(vmulq_n_f16(t[2 + offset], 2.25), vmulq_n_f16(t[4 + offset], 3.25));
m[8 + l] = vaddq_f16(vsubq_f16(vaddq_f16(tmp1, tmp2), vmulq_n_f16(t[3 + offset], 1.625)), t[6 + offset]);
m[16 + l] = vaddq_f16(vaddq_f16(vsubq_f16(tmp2, tmp1), vmulq_n_f16(t[3 + offset], 1.625)), t[6 + offset]);
tmp1 = vaddq_f16(vmulq_n_f16(t[1 + offset], 0.5625), t[5 + offset]);
tmp2 = vsubq_f16(vmulq_n_f16(t[2 + offset], 0.5625), vmulq_n_f16(t[4 + offset], 2.5));
m[24 + l] = vaddq_f16(vsubq_f16(vaddq_f16(tmp1, tmp2), vmulq_n_f16(t[3 + offset], 2.5)), t[6 + offset]);
m[32 + l] = vaddq_f16(vaddq_f16(vsubq_f16(tmp2, tmp1), vmulq_n_f16(t[3 + offset], 2.5)), t[6 + offset]);
tmp1 = vaddq_f16(vmulq_n_f16(t[1 + offset], 0.375), vmulq_n_f16(t[5 + offset], 1.5));
tmp2 = vsubq_f16(vmulq_n_f16(t[2 + offset], 0.25), vmulq_n_f16(t[4 + offset], 1.25));
m[40 + l] = vaddq_f16(vsubq_f16(vaddq_f16(tmp1, tmp2), vmulq_n_f16(t[3 + offset], 1.875)), t[6 + offset]);
m[48 + l] = vaddq_f16(vaddq_f16(vsubq_f16(tmp2, tmp1), vmulq_n_f16(t[3 + offset], 1.875)), t[6 + offset]);
m[56 + l] =
vaddq_f16(vsubq_f16(vaddq_f16(vmulq_n_f16(t[1 + offset], -0.5625), vmulq_n_f16(t[3 + offset], 3.0625)),
vmulq_n_f16(t[5 + offset], 3.5)),
t[7 + offset]);
}
for (int i = 0; i < 64; i++) {
int dst_offset = i * dst_step;
vst1q_f16(dst_data + dst_offset, m[i]);
}
real_c -= 8;
} else if (real_c < 8 && real_c >= 4) {
float16x4_t src[64];
float16x4_t t[64];
float16x4_t m[64];
Load64DataC4Fp16;
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
t[l] = vsub_f16(vadd_f16(vsub_f16(vmul_n_f16(src[offset], 0.5625), vmul_n_f16(src[2 + offset], 3.0625)),
vmul_n_f16(src[4 + offset], 3.5)),
src[6 + offset]);
float16x4_t tmp1 = vadd_f16(vmul_n_f16(src[1 + offset], 1.125), vmul_n_f16(src[5 + offset], 0.5));
float16x4_t tmp2 = vsub_f16(vmul_n_f16(src[2 + offset], 2.25), vmul_n_f16(src[4 + offset], 3.25));
t[8 + l] = vadd_f16(vsub_f16(vadd_f16(tmp1, tmp2), vmul_n_f16(src[3 + offset], 1.625)), src[6 + offset]);
t[16 + l] = vadd_f16(vadd_f16(vsub_f16(tmp2, tmp1), vmul_n_f16(src[3 + offset], 1.625)), src[6 + offset]);
tmp1 = vadd_f16(vmul_n_f16(src[1 + offset], 0.5625), src[5 + offset]);
tmp2 = vsub_f16(vmul_n_f16(src[2 + offset], 0.5625), vmul_n_f16(src[4 + offset], 2.5));
t[24 + l] = vadd_f16(vsub_f16(vadd_f16(tmp1, tmp2), vmul_n_f16(src[3 + offset], 2.5)), src[6 + offset]);
t[32 + l] = vadd_f16(vadd_f16(vsub_f16(tmp2, tmp1), vmul_n_f16(src[3 + offset], 2.5)), src[6 + offset]);
tmp1 = vadd_f16(vmul_n_f16(src[1 + offset], 0.375), vmul_n_f16(src[5 + offset], 1.5));
tmp2 = vsub_f16(vmul_n_f16(src[2 + offset], 0.25), vmul_n_f16(src[4 + offset], 1.25));
t[40 + l] = vadd_f16(vsub_f16(vadd_f16(tmp1, tmp2), vmul_n_f16(src[3 + offset], 1.875)), src[6 + offset]);
t[48 + l] = vadd_f16(vadd_f16(vsub_f16(tmp2, tmp1), vmul_n_f16(src[3 + offset], 1.875)), src[6 + offset]);
t[56 + l] = vadd_f16(vsub_f16(vadd_f16(vmul_n_f16(src[1 + offset], -0.5625), vmul_n_f16(src[3 + offset], 3.0625)),
vmul_n_f16(src[5 + offset], 3.5)),
src[7 + offset]);
}
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
m[l] = vsub_f16(vadd_f16(vsub_f16(vmul_n_f16(t[offset], 0.5625), vmul_n_f16(t[2 + offset], 3.0625)),
vmul_n_f16(t[4 + offset], 3.5)),
t[6 + offset]);
float16x4_t tmp1 = vadd_f16(vmul_n_f16(t[1 + offset], 1.125), vmul_n_f16(t[5 + offset], 0.5));
float16x4_t tmp2 = vsub_f16(vmul_n_f16(t[2 + offset], 2.25), vmul_n_f16(t[4 + offset], 3.25));
m[8 + l] = vadd_f16(vsub_f16(vadd_f16(tmp1, tmp2), vmul_n_f16(t[3 + offset], 1.625)), t[6 + offset]);
m[16 + l] = vadd_f16(vadd_f16(vsub_f16(tmp2, tmp1), vmul_n_f16(t[3 + offset], 1.625)), t[6 + offset]);
tmp1 = vadd_f16(vmul_n_f16(t[1 + offset], 0.5625), t[5 + offset]);
tmp2 = vsub_f16(vmul_n_f16(t[2 + offset], 0.5625), vmul_n_f16(t[4 + offset], 2.5));
m[24 + l] = vadd_f16(vsub_f16(vadd_f16(tmp1, tmp2), vmul_n_f16(t[3 + offset], 2.5)), t[6 + offset]);
m[32 + l] = vadd_f16(vadd_f16(vsub_f16(tmp2, tmp1), vmul_n_f16(t[3 + offset], 2.5)), t[6 + offset]);
tmp1 = vadd_f16(vmul_n_f16(t[1 + offset], 0.375), vmul_n_f16(t[5 + offset], 1.5));
tmp2 = vsub_f16(vmul_n_f16(t[2 + offset], 0.25), vmul_n_f16(t[4 + offset], 1.25));
m[40 + l] = vadd_f16(vsub_f16(vadd_f16(tmp1, tmp2), vmul_n_f16(t[3 + offset], 1.875)), t[6 + offset]);
m[48 + l] = vadd_f16(vadd_f16(vsub_f16(tmp2, tmp1), vmul_n_f16(t[3 + offset], 1.875)), t[6 + offset]);
m[56 + l] = vadd_f16(vsub_f16(vadd_f16(vmul_n_f16(t[1 + offset], -0.5625), vmul_n_f16(t[3 + offset], 3.0625)),
vmul_n_f16(t[5 + offset], 3.5)),
t[7 + offset]);
}
for (int i = 0; i < 64; i++) {
int dst_offset = i * dst_step;
vst1_f16(dst_data + dst_offset, m[i]);
}
j = 4;
}
for (; j < real_c; ++j) {
float16_t src[64];
float16_t t[64];
float16_t m[64];
for (int k = 0; k < 64; ++k) {
src[k] = src_data[j + k * src_step];
}
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
t[l] = src[offset] * 0.5625f - src[2 + offset] * 3.0625f + src[4 + offset] * 3.5f - src[6 + offset];
float16_t tmp1 = src[1 + offset] * 1.125f + src[5 + offset] * 0.5f;
float16_t tmp2 = src[2 + offset] * 2.25f - src[4 + offset] * 3.25f;
t[8 + l] = tmp1 + tmp2 - src[3 + offset] * 1.625f + src[6 + offset];
t[16 + l] = tmp2 - tmp1 + src[3 + offset] * 1.625f + src[6 + offset];
tmp1 = src[1 + offset] * 0.5625f + src[5 + offset];
tmp2 = src[2 + offset] * 0.5625f - src[4 + offset] * 2.5f;
t[24 + l] = tmp1 + tmp2 - src[3 + offset] * 2.5f + src[6 + offset];
t[32 + l] = tmp2 - tmp1 + src[3 + offset] * 2.5f + src[6 + offset];
tmp1 = src[1 + offset] * 0.375f + src[5 + offset] * 1.5f;
tmp2 = src[2 + offset] * 0.25f - src[4 + offset] * 1.25f;
t[40 + l] = tmp1 + tmp2 - src[3 + offset] * 1.875f + src[6 + offset];
t[48 + l] = tmp2 - tmp1 + src[3 + offset] * 1.875f + src[6 + offset];
t[56 + l] = src[1 + offset] * -0.5625 + src[3 + offset] * 3.0625f - src[5 + offset] * 3.5f + src[7 + offset];
}
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
m[l] = t[offset] * 0.5625f - t[2 + offset] * 3.0625f + t[4 + offset] * 3.5f - t[6 + offset];
float16_t tmp1 = t[1 + offset] * 1.125f + t[5 + offset] * 0.5f;
float16_t tmp2 = t[2 + offset] * 2.25f - t[4 + offset] * 3.25f;
m[8 + l] = tmp1 + tmp2 - t[3 + offset] * 1.625f + t[6 + offset];
m[16 + l] = tmp2 - tmp1 + t[3 + offset] * 1.625f + t[6 + offset];
tmp1 = t[1 + offset] * 0.5625f + t[5 + offset];
tmp2 = t[2 + offset] * 0.5625f - t[4 + offset] * 2.5f;
m[24 + l] = tmp1 + tmp2 - t[3 + offset] * 2.5f + t[6 + offset];
m[32 + l] = tmp2 - tmp1 + t[3 + offset] * 2.5f + t[6 + offset];
tmp1 = t[1 + offset] * 0.375f + t[5 + offset] * 1.5f;
tmp2 = t[2 + offset] * 0.25f - t[4 + offset] * 1.25f;
m[40 + l] = tmp1 + tmp2 - t[3 + offset] * 1.875f + t[6 + offset];
m[48 + l] = tmp2 - tmp1 + t[3 + offset] * 1.875f + t[6 + offset];
m[56 + l] = t[1 + offset] * -0.5625 + t[3 + offset] * 3.0625f - t[5 + offset] * 3.5f + t[7 + offset];
}
for (int i = 0; i < 64; i++) {
int dst_offset = i * dst_step;
dst_data[j + dst_offset] = m[i];
}
}
}
void InputTransform8x8StepFp16_uint(float16x8_t *s, float16x8_t *m) {
m[0] =
vsubq_f16(vaddq_f16(vsubq_f16(vmulq_n_f16(s[0], 0.5625), vmulq_n_f16(s[2], 3.0625)), vmulq_n_f16(s[4], 3.5)), s[6]);
float16x8_t tmp1 = vaddq_f16(vmulq_n_f16(s[1], 1.125), vmulq_n_f16(s[5], 0.5));
float16x8_t tmp2 = vsubq_f16(vmulq_n_f16(s[2], 2.25), vmulq_n_f16(s[4], 3.25));
m[1] = vaddq_f16(vsubq_f16(vaddq_f16(tmp1, tmp2), vmulq_n_f16(s[3], 1.625)), s[6]);
m[2] = vaddq_f16(vaddq_f16(vsubq_f16(tmp2, tmp1), vmulq_n_f16(s[3], 1.625)), s[6]);
tmp1 = vaddq_f16(vmulq_n_f16(s[1], 0.5625), s[5]);
tmp2 = vsubq_f16(vmulq_n_f16(s[2], 0.5625), vmulq_n_f16(s[4], 2.5));
m[3] = vaddq_f16(vsubq_f16(vaddq_f16(tmp1, tmp2), vmulq_n_f16(s[3], 2.5)), s[6]);
m[4] = vaddq_f16(vaddq_f16(vsubq_f16(tmp2, tmp1), vmulq_n_f16(s[3], 2.5)), s[6]);
tmp1 = vaddq_f16(vmulq_n_f16(s[1], 0.375), vmulq_n_f16(s[5], 1.5));
tmp2 = vsubq_f16(vmulq_n_f16(s[2], 0.25), vmulq_n_f16(s[4], 1.25));
m[5] = vaddq_f16(vsubq_f16(vaddq_f16(tmp1, tmp2), vmulq_n_f16(s[3], 1.875)), s[6]);
m[6] = vaddq_f16(vaddq_f16(vsubq_f16(tmp2, tmp1), vmulq_n_f16(s[3], 1.875)), s[6]);
m[7] = vaddq_f16(vsubq_f16(vaddq_f16(vmulq_n_f16(s[1], -0.5625), vmulq_n_f16(s[3], 3.0625)), vmulq_n_f16(s[5], 3.5)),
s[7]);
}
void InputTransform8x8StepFp16(const float16_t *src_data, float16_t *dst_data, int src_step, int dst_step,
int dst_row_step) {
for (int l = 0; l < 8; ++l) {
const float16_t *src_ptr = src_data + l * 8 * src_step;
float16_t *dst_ptr = dst_data + l * dst_row_step;
float16x8_t s[8];
float16x8_t m[8];
s[0] = vld1q_f16(src_ptr + 0 * src_step);
s[1] = vld1q_f16(src_ptr + 1 * src_step);
s[2] = vld1q_f16(src_ptr + 2 * src_step);
s[3] = vld1q_f16(src_ptr + 3 * src_step);
s[4] = vld1q_f16(src_ptr + 4 * src_step);
s[5] = vld1q_f16(src_ptr + 5 * src_step);
s[6] = vld1q_f16(src_ptr + 6 * src_step);
s[7] = vld1q_f16(src_ptr + 7 * src_step);
InputTransform8x8StepFp16_uint(s, m);
vst1q_f16(dst_ptr + 0 * dst_step, m[0]);
vst1q_f16(dst_ptr + 1 * dst_step, m[1]);
vst1q_f16(dst_ptr + 2 * dst_step, m[2]);
vst1q_f16(dst_ptr + 3 * dst_step, m[3]);
vst1q_f16(dst_ptr + 4 * dst_step, m[4]);
vst1q_f16(dst_ptr + 5 * dst_step, m[5]);
vst1q_f16(dst_ptr + 6 * dst_step, m[6]);
vst1q_f16(dst_ptr + 7 * dst_step, m[7]);
}
}
#ifdef ENABLE_ARM64
void InputTransform8x8Pack16ChannelFp16(float16_t *src_ptr, float16_t *dst_ptr, int dst_step, int pack_tile,
int src_point_stride) {
LOAD_LINE_DATA_FP16(0);
LOAD_LINE_DATA_FP16(1);
LOAD_LINE_DATA_FP16(2);
LOAD_LINE_DATA_FP16(3);
LOAD_LINE_DATA_FP16(4);
LOAD_LINE_DATA_FP16(5);
LOAD_LINE_DATA_FP16(6);
LOAD_LINE_DATA_FP16(7);
float16x8_t m0 =
vsubq_f16(vaddq_f16(vsubq_f16(vmulq_n_f16(s00, 0.5625), vmulq_n_f16(s20, 3.0625)), vmulq_n_f16(s40, 3.5)), s60);
float16x8_t m1 =
vsubq_f16(vaddq_f16(vsubq_f16(vmulq_n_f16(s01, 0.5625), vmulq_n_f16(s21, 3.0625)), vmulq_n_f16(s41, 3.5)), s61);
vst1q_f16(dst_ptr + 0 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 0 * dst_step + 1 * pack_tile, m1);
float16x8_t tmp10 = vaddq_f16(vmulq_n_f16(s10, 1.125), vmulq_n_f16(s50, 0.5));
float16x8_t tmp11 = vaddq_f16(vmulq_n_f16(s11, 1.125), vmulq_n_f16(s51, 0.5));
float16x8_t tmp20 = vsubq_f16(vmulq_n_f16(s20, 2.25), vmulq_n_f16(s40, 3.25));
float16x8_t tmp21 = vsubq_f16(vmulq_n_f16(s21, 2.25), vmulq_n_f16(s41, 3.25));
m0 = vaddq_f16(vsubq_f16(vaddq_f16(tmp10, tmp20), vmulq_n_f16(s30, 1.625)), s60);
m1 = vaddq_f16(vsubq_f16(vaddq_f16(tmp11, tmp21), vmulq_n_f16(s31, 1.625)), s61);
vst1q_f16(dst_ptr + 1 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 1 * dst_step + 1 * pack_tile, m1);
m0 = vaddq_f16(vaddq_f16(vsubq_f16(tmp20, tmp10), vmulq_n_f16(s30, 1.625)), s60);
m1 = vaddq_f16(vaddq_f16(vsubq_f16(tmp21, tmp11), vmulq_n_f16(s31, 1.625)), s61);
vst1q_f16(dst_ptr + 2 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 2 * dst_step + 1 * pack_tile, m1);
tmp10 = vaddq_f16(vmulq_n_f16(s10, 0.5625), s50);
tmp11 = vaddq_f16(vmulq_n_f16(s11, 0.5625), s51);
tmp20 = vsubq_f16(vmulq_n_f16(s20, 0.5625), vmulq_n_f16(s40, 2.5));
tmp21 = vsubq_f16(vmulq_n_f16(s21, 0.5625), vmulq_n_f16(s41, 2.5));
m0 = vaddq_f16(vsubq_f16(vaddq_f16(tmp10, tmp20), vmulq_n_f16(s30, 2.5)), s60);
m1 = vaddq_f16(vsubq_f16(vaddq_f16(tmp11, tmp21), vmulq_n_f16(s31, 2.5)), s61);
vst1q_f16(dst_ptr + 3 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 3 * dst_step + 1 * pack_tile, m1);
m0 = vaddq_f16(vaddq_f16(vsubq_f16(tmp20, tmp10), vmulq_n_f16(s30, 2.5)), s60);
m1 = vaddq_f16(vaddq_f16(vsubq_f16(tmp21, tmp11), vmulq_n_f16(s31, 2.5)), s61);
vst1q_f16(dst_ptr + 4 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 4 * dst_step + 1 * pack_tile, m1);
tmp10 = vaddq_f16(vmulq_n_f16(s10, 0.375), vmulq_n_f16(s50, 1.5));
tmp11 = vaddq_f16(vmulq_n_f16(s11, 0.375), vmulq_n_f16(s51, 1.5));
tmp20 = vsubq_f16(vmulq_n_f16(s20, 0.25), vmulq_n_f16(s40, 1.25));
tmp21 = vsubq_f16(vmulq_n_f16(s21, 0.25), vmulq_n_f16(s41, 1.25));
m0 = vaddq_f16(vsubq_f16(vaddq_f16(tmp10, tmp20), vmulq_n_f16(s30, 1.875)), s60);
m1 = vaddq_f16(vsubq_f16(vaddq_f16(tmp11, tmp21), vmulq_n_f16(s31, 1.875)), s61);
vst1q_f16(dst_ptr + 5 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 5 * dst_step + 1 * pack_tile, m1);
m0 = vaddq_f16(vaddq_f16(vsubq_f16(tmp20, tmp10), vmulq_n_f16(s30, 1.875)), s60);
m1 = vaddq_f16(vaddq_f16(vsubq_f16(tmp21, tmp11), vmulq_n_f16(s31, 1.875)), s61);
vst1q_f16(dst_ptr + 6 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 6 * dst_step + 1 * pack_tile, m1);
m0 = vaddq_f16(vsubq_f16(vaddq_f16(vmulq_n_f16(s10, -0.5625), vmulq_n_f16(s30, 3.0625)), vmulq_n_f16(s50, 3.5)), s70);
m1 = vaddq_f16(vsubq_f16(vaddq_f16(vmulq_n_f16(s11, -0.5625), vmulq_n_f16(s31, 3.0625)), vmulq_n_f16(s51, 3.5)), s71);
vst1q_f16(dst_ptr + 7 * dst_step + 0 * pack_tile, m0);
vst1q_f16(dst_ptr + 7 * dst_step + 1 * pack_tile, m1);
}
void InputTransform8x8Pack16Fp16(float16_t *src_data, float16_t *dst_data, int src_step, int dst_step, int real_c) {
int block_tile = 16;
int pack_tile = src_step;
int src_point_stride = block_tile * pack_tile;
for (int l = 0; l < 8; ++l) {
float16_t *src_ptr = src_data + l * C8NUM * block_tile;
TRANSPOSE_16x8;
}
for (int c = 0; c < real_c; ++c) {
float16_t *src_ptr = src_data + c * block_tile;
float16_t *dst_ptr = dst_data + c * block_tile;
InputTransform8x8Pack16ChannelFp16(src_ptr, dst_ptr, dst_step, pack_tile, src_point_stride);
}
}
#endif
OutputTransFp16Func GetOutputTransFp16Func(int input_unit, int output_unit, ActType act_type) {
if (input_unit == 4 && output_unit < 4) {
if (act_type == ActType_Relu) {
return OutputTransFp16FuncReluList4[output_unit];
} else if (act_type == ActType_Relu6) {
return OutputTransFp16FuncRelu6List4[output_unit];
} else {
return OutputTransFp16FuncList4[output_unit];
}
} else if (input_unit == 6 && output_unit < 6) {
if (act_type == ActType_Relu) {
return OutputTransFp16FuncReluList6[output_unit];
} else if (act_type == ActType_Relu6) {
return OutputTransFp16FuncRelu6List6[output_unit];
} else {
return OutputTransFp16FuncList6[output_unit];
}
} else if (input_unit == 8 && output_unit < 8) {
if (act_type == ActType_Relu) {
return OutputTransFp16FuncReluList8[output_unit];
} else if (act_type == ActType_Relu6) {
return OutputTransFp16FuncRelu6List8[output_unit];
} else {
return OutputTransFp16FuncList8[output_unit];
}
} else {
return NULL;
}
}
void OutputTransform4x2UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
int z = 0;
if (r_c == 8) {
float16x8_t src[16];
float16x8_t t[8];
float16x8_t m[4];
Load16DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
t[l] = vaddq_f16(vaddq_f16(src[offset], src[1 + offset]), src[2 + offset]);
t[l + 4] = vaddq_f16(vsubq_f16(src[1 + offset], src[2 + offset]), src[3 + offset]);
}
for (int l = 0; l < 2; ++l) {
int offset = l * 4;
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(t[offset], t[1 + offset]), t[2 + offset]), bias_ptr);
m[l + 2] = vaddq_f16(vaddq_f16(vsubq_f16(t[1 + offset], t[2 + offset]), t[3 + offset]), bias_ptr);
}
if (r_h == 2 && r_w == 2) {
Store4DataFp16;
} else {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
vst1q_f16(dst_data + dst_k_offset + k * out_c, m[k + m_k_offset]);
}
}
}
r_c -= 8;
} else if (r_c < 8 && r_c >= 4) {
float16x4_t src[16];
float16x4_t t[8];
float16x4_t m[4];
Load16DataC4Fp16;
float16x4_t bias_ptr = vld1_f16(bias_data);
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
t[l] = vadd_f16(vadd_f16(src[offset], src[1 + offset]), src[2 + offset]);
t[l + 4] = vadd_f16(vsub_f16(src[1 + offset], src[2 + offset]), src[3 + offset]);
}
for (int l = 0; l < 2; ++l) {
int offset = l * 4;
m[l] = vadd_f16(vadd_f16(vadd_f16(t[offset], t[1 + offset]), t[2 + offset]), bias_ptr);
m[l + 2] = vadd_f16(vadd_f16(vsub_f16(t[1 + offset], t[2 + offset]), t[3 + offset]), bias_ptr);
}
if (r_h == 2 && r_w == 2) {
Store4DataC4Fp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
z = 4;
}
for (; z < r_c; ++z) {
float16_t src[16];
float16_t t[8];
float16_t m[4];
for (int k = 0; k < 16; ++k) {
src[k] = src_data[z + k * src_step];
}
float16_t bias_ptr = bias_data[z];
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
t[l] = src[offset] + src[1 + offset] + src[2 + offset];
t[l + 4] = src[1 + offset] - src[2 + offset] + src[3 + offset];
}
for (int l = 0; l < 2; ++l) {
int offset = l * 4;
m[l] = t[offset] + t[1 + offset] + t[2 + offset] + bias_ptr;
m[l + 2] = t[1 + offset] - t[2 + offset] + t[3 + offset] + bias_ptr;
}
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
dst_data[z + dst_k_offset + k * out_c] = m[k + m_k_offset];
}
}
}
}
void OutputTransform4x2ReluUnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
int z = 0;
if (r_c == 8) {
float16x8_t src[16];
float16x8_t t[8];
float16x8_t m[4];
float16x8_t zero = vdupq_n_f16(0);
Load16DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
t[l] = vaddq_f16(vaddq_f16(src[offset], src[1 + offset]), src[2 + offset]);
t[l + 4] = vaddq_f16(vsubq_f16(src[1 + offset], src[2 + offset]), src[3 + offset]);
}
for (int l = 0; l < 2; ++l) {
int offset = l * 4;
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(t[offset], t[1 + offset]), t[2 + offset]), bias_ptr);
m[l + 2] = vaddq_f16(vaddq_f16(vsubq_f16(t[1 + offset], t[2 + offset]), t[3 + offset]), bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l + 2] = vmaxq_f16(zero, m[l + 2]);
}
if (r_h == 2 && r_w == 2) {
Store4DataFp16;
} else {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
vst1q_f16(dst_data + dst_k_offset + k * out_c, m[k + m_k_offset]);
}
}
}
r_c -= 8;
} else if (r_c < 8 && r_c >= 4) {
float16x4_t src[16];
float16x4_t t[8];
float16x4_t m[4];
float16x4_t zero = vdup_n_f16(0);
Load16DataC4Fp16;
float16x4_t bias_ptr = vld1_f16(bias_data);
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
t[l] = vadd_f16(vadd_f16(src[offset], src[1 + offset]), src[2 + offset]);
t[l + 4] = vadd_f16(vsub_f16(src[1 + offset], src[2 + offset]), src[3 + offset]);
}
for (int l = 0; l < 2; ++l) {
int offset = l * 4;
m[l] = vadd_f16(vadd_f16(vadd_f16(t[offset], t[1 + offset]), t[2 + offset]), bias_ptr);
m[l + 2] = vadd_f16(vadd_f16(vsub_f16(t[1 + offset], t[2 + offset]), t[3 + offset]), bias_ptr);
m[l] = vmax_f16(zero, m[l]);
m[l + 2] = vmax_f16(zero, m[l + 2]);
}
if (r_h == 2 && r_w == 2) {
Store4DataC4Fp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
z = 4;
}
for (; z < r_c; ++z) {
float16_t src[16];
float16_t t[8];
float16_t m[4];
for (int k = 0; k < 16; ++k) {
src[k] = src_data[z + k * src_step];
}
float16_t bias_ptr = bias_data[z];
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
t[l] = src[offset] + src[1 + offset] + src[2 + offset];
t[l + 4] = src[1 + offset] - src[2 + offset] + src[3 + offset];
}
for (int l = 0; l < 2; ++l) {
int offset = l * 4;
m[l] = t[offset] + t[1 + offset] + t[2 + offset] + bias_ptr;
m[l + 2] = t[1 + offset] - t[2 + offset] + t[3 + offset] + bias_ptr;
m[l] = m[l] > 0 ? m[l] : 0;
m[l + 2] = m[l + 2] > 0 ? m[l + 2] : 0;
}
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
dst_data[z + dst_k_offset + k * out_c] = m[k + m_k_offset];
}
}
}
}
void OutputTransform4x2Relu6UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
int z = 0;
if (r_c == 8) {
float16x8_t src[16];
float16x8_t t[8];
float16x8_t m[4];
float16x8_t zero = vdupq_n_f16(0);
float16x8_t six = vdupq_n_f16(6);
Load16DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
t[l] = vaddq_f16(vaddq_f16(src[offset], src[1 + offset]), src[2 + offset]);
t[l + 4] = vaddq_f16(vsubq_f16(src[1 + offset], src[2 + offset]), src[3 + offset]);
}
for (int l = 0; l < 2; ++l) {
int offset = l * 4;
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(t[offset], t[1 + offset]), t[2 + offset]), bias_ptr);
m[l + 2] = vaddq_f16(vaddq_f16(vsubq_f16(t[1 + offset], t[2 + offset]), t[3 + offset]), bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l] = vminq_f16(six, m[l]);
m[l + 2] = vmaxq_f16(zero, m[l + 2]);
m[l + 2] = vminq_f16(six, m[l + 2]);
}
if (r_h == 2 && r_w == 2) {
Store4DataFp16;
} else {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
vst1q_f16(dst_data + dst_k_offset + k * out_c, m[k + m_k_offset]);
}
}
}
r_c -= 8;
} else if (r_c < 8 && r_c >= 4) {
float16x4_t src[16];
float16x4_t t[8];
float16x4_t m[4];
float16x4_t zero = vdup_n_f16(0);
float16x4_t six = vdup_n_f16(6);
Load16DataC4Fp16;
float16x4_t bias_ptr = vld1_f16(bias_data);
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
t[l] = vadd_f16(vadd_f16(src[offset], src[1 + offset]), src[2 + offset]);
t[l + 4] = vadd_f16(vsub_f16(src[1 + offset], src[2 + offset]), src[3 + offset]);
}
for (int l = 0; l < 2; ++l) {
int offset = l * 4;
m[l] = vadd_f16(vadd_f16(vadd_f16(t[offset], t[1 + offset]), t[2 + offset]), bias_ptr);
m[l + 2] = vadd_f16(vadd_f16(vsub_f16(t[1 + offset], t[2 + offset]), t[3 + offset]), bias_ptr);
m[l] = vmax_f16(zero, m[l]);
m[l] = vmin_f16(six, m[l]);
m[l + 2] = vmax_f16(zero, m[l + 2]);
m[l + 2] = vmin_f16(six, m[l + 2]);
}
if (r_h == 2 && r_w == 2) {
Store4DataC4Fp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
z = 4;
}
for (; z < r_c; ++z) {
float16_t src[16];
float16_t t[8];
float16_t m[4];
for (int k = 0; k < 16; ++k) {
src[k] = src_data[z + k * src_step];
}
float16_t bias_ptr = bias_data[z];
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
t[l] = src[offset] + src[1 + offset] + src[2 + offset];
t[l + 4] = src[1 + offset] - src[2 + offset] + src[3 + offset];
}
for (int l = 0; l < 2; ++l) {
int offset = l * 4;
m[l] = t[offset] + t[1 + offset] + t[2 + offset] + bias_ptr;
m[l + 2] = t[1 + offset] - t[2 + offset] + t[3 + offset] + bias_ptr;
m[l] = m[l] > 0 ? m[l] : 0;
m[l] = m[l] < 6 ? m[l] : 6;
m[l + 2] = m[l + 2] > 0 ? m[l + 2] : 0;
m[l + 2] = m[l + 2] < 6 ? m[l + 2] : 6;
}
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
dst_data[z + dst_k_offset + k * out_c] = m[k + m_k_offset];
}
}
}
}
void OutputTransform4x3UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[16];
float16x8_t t[12];
float16x8_t m[9];
Load16DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
float16x8_t tmp = vaddq_f16(src[1 + offset], src[2 + offset]);
t[l] = vaddq_f16(src[offset], tmp);
t[l + 4] = vsubq_f16(src[1 + offset], src[2 + offset]);
t[l + 8] = vaddq_f16(tmp, src[3 + offset]);
}
for (int l = 0; l < 3; ++l) {
int offset = l * 4;
float16x8_t tmp = vaddq_f16(t[1 + offset], t[2 + offset]);
m[l] = vaddq_f16(vaddq_f16(t[offset], tmp), bias_ptr);
m[l + 3] = vaddq_f16(vsubq_f16(t[1 + offset], t[2 + offset]), bias_ptr);
m[l + 6] = vaddq_f16(vaddq_f16(tmp, t[3 + offset]), bias_ptr);
}
if (r_c == C8NUM && r_h == 3 && r_w == 3) {
Store9DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 3;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform4x3ReluUnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[16];
float16x8_t t[12];
float16x8_t m[9];
float16x8_t zero = vdupq_n_f16(0);
Load16DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
float16x8_t tmp = vaddq_f16(src[1 + offset], src[2 + offset]);
t[l] = vaddq_f16(src[offset], tmp);
t[l + 4] = vsubq_f16(src[1 + offset], src[2 + offset]);
t[l + 8] = vaddq_f16(tmp, src[3 + offset]);
}
for (int l = 0; l < 3; ++l) {
int offset = l * 4;
float16x8_t tmp = vaddq_f16(t[1 + offset], t[2 + offset]);
m[l] = vaddq_f16(vaddq_f16(t[offset], tmp), bias_ptr);
m[l + 3] = vaddq_f16(vsubq_f16(t[1 + offset], t[2 + offset]), bias_ptr);
m[l + 6] = vaddq_f16(vaddq_f16(tmp, t[3 + offset]), bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l + 3] = vmaxq_f16(zero, m[l + 3]);
m[l + 6] = vmaxq_f16(zero, m[l + 6]);
}
if (r_c == C8NUM && r_h == 3 && r_w == 3) {
Store9DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 3;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform4x3Relu6UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[16];
float16x8_t t[12];
float16x8_t m[9];
float16x8_t zero = vdupq_n_f16(0);
float16x8_t six = vdupq_n_f16(6);
Load16DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 4; ++l) {
int offset = l * 4;
float16x8_t tmp = vaddq_f16(src[1 + offset], src[2 + offset]);
t[l] = vaddq_f16(src[offset], tmp);
t[l + 4] = vsubq_f16(src[1 + offset], src[2 + offset]);
t[l + 8] = vaddq_f16(tmp, src[3 + offset]);
}
for (int l = 0; l < 3; ++l) {
int offset = l * 4;
float16x8_t tmp = vaddq_f16(t[1 + offset], t[2 + offset]);
m[l] = vaddq_f16(vaddq_f16(t[offset], tmp), bias_ptr);
m[l + 3] = vaddq_f16(vsubq_f16(t[1 + offset], t[2 + offset]), bias_ptr);
m[l + 6] = vaddq_f16(vaddq_f16(tmp, t[3 + offset]), bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l] = vminq_f16(six, m[l]);
m[l + 3] = vmaxq_f16(zero, m[l + 3]);
m[l + 3] = vminq_f16(six, m[l + 3]);
m[l + 6] = vmaxq_f16(zero, m[l + 6]);
m[l + 6] = vminq_f16(six, m[l + 6]);
}
if (r_c == C8NUM && r_h == 3 && r_w == 3) {
Store9DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 3;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform6x2UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[36];
float16x8_t t[12];
float16x8_t m[4];
Load36DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(src[offset], src[1 + offset]), src[2 + offset]), src[3 + offset]),
src[4 + offset]);
t[l + 6] = vaddq_f16(vaddq_f16(vsubq_f16(src[1 + offset], src[2 + offset]),
vmulq_n_f16(vsubq_f16(src[3 + offset], src[4 + offset]), 2)),
src[5 + offset]);
}
for (int l = 0; l < 2; ++l) {
int offset = l * 6;
m[l] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], t[1 + offset]), t[2 + offset]), t[3 + offset]), t[4 + offset]),
bias_ptr);
m[l + 2] = vaddq_f16(vaddq_f16(vaddq_f16(vsubq_f16(t[1 + offset], t[2 + offset]),
vmulq_n_f16(vsubq_f16(t[3 + offset], t[4 + offset]), 2)),
t[5 + offset]),
bias_ptr);
}
if (r_c == C8NUM && r_h == 2 && r_w == 2) {
Store4DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform6x2ReluUnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[36];
float16x8_t t[12];
float16x8_t m[4];
float16x8_t zero = vdupq_n_f16(0);
Load36DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(src[offset], src[1 + offset]), src[2 + offset]), src[3 + offset]),
src[4 + offset]);
t[l + 6] = vaddq_f16(vaddq_f16(vsubq_f16(src[1 + offset], src[2 + offset]),
vmulq_n_f16(vsubq_f16(src[3 + offset], src[4 + offset]), 2)),
src[5 + offset]);
}
for (int l = 0; l < 2; ++l) {
int offset = l * 6;
m[l] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], t[1 + offset]), t[2 + offset]), t[3 + offset]), t[4 + offset]),
bias_ptr);
m[l + 2] = vaddq_f16(vaddq_f16(vaddq_f16(vsubq_f16(t[1 + offset], t[2 + offset]),
vmulq_n_f16(vsubq_f16(t[3 + offset], t[4 + offset]), 2)),
t[5 + offset]),
bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l + 2] = vmaxq_f16(zero, m[l + 2]);
}
if (r_c == C8NUM && r_h == 2 && r_w == 2) {
Store4DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform6x2Relu6UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[36];
float16x8_t t[12];
float16x8_t m[4];
float16x8_t zero = vdupq_n_f16(0);
float16x8_t six = vdupq_n_f16(6);
Load36DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(src[offset], src[1 + offset]), src[2 + offset]), src[3 + offset]),
src[4 + offset]);
t[l + 6] = vaddq_f16(vaddq_f16(vsubq_f16(src[1 + offset], src[2 + offset]),
vmulq_n_f16(vsubq_f16(src[3 + offset], src[4 + offset]), 2)),
src[5 + offset]);
}
for (int l = 0; l < 2; ++l) {
int offset = l * 6;
m[l] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], t[1 + offset]), t[2 + offset]), t[3 + offset]), t[4 + offset]),
bias_ptr);
m[l + 2] = vaddq_f16(vaddq_f16(vaddq_f16(vsubq_f16(t[1 + offset], t[2 + offset]),
vmulq_n_f16(vsubq_f16(t[3 + offset], t[4 + offset]), 2)),
t[5 + offset]),
bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l] = vminq_f16(six, m[l]);
m[l + 2] = vmaxq_f16(zero, m[l + 2]);
m[l + 2] = vminq_f16(six, m[l + 2]);
}
if (r_c == C8NUM && r_h == 2 && r_w == 2) {
Store4DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform6x3UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[36];
float16x8_t t[18];
float16x8_t m[9];
Load36DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
t[l] = vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2);
t[l + 6] = vaddq_f16(vsubq_f16(src[1 + offset], src[2 + offset]),
vmulq_n_f16(vsubq_f16(src[3 + offset], src[4 + offset]), 2));
t[l + 12] = vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4)), src[5 + offset]);
}
for (int l = 0; l < 3; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), bias_ptr);
m[l + 3] = vaddq_f16(
vaddq_f16(vsubq_f16(t[1 + offset], t[2 + offset]), vmulq_n_f16(vsubq_f16(t[3 + offset], t[4 + offset]), 2)),
bias_ptr);
m[l + 6] = vaddq_f16(vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4)), t[5 + offset]), bias_ptr);
}
if (r_c == C8NUM && r_h == 3 && r_w == 3) {
Store9DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 3;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform6x3ReluUnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[36];
float16x8_t t[18];
float16x8_t m[9];
float16x8_t zero = vdupq_n_f16(0);
Load36DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
t[l] = vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2);
t[l + 6] = vaddq_f16(vsubq_f16(src[1 + offset], src[2 + offset]),
vmulq_n_f16(vsubq_f16(src[3 + offset], src[4 + offset]), 2));
t[l + 12] = vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4)), src[5 + offset]);
}
for (int l = 0; l < 3; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), bias_ptr);
m[l + 3] = vaddq_f16(
vaddq_f16(vsubq_f16(t[1 + offset], t[2 + offset]), vmulq_n_f16(vsubq_f16(t[3 + offset], t[4 + offset]), 2)),
bias_ptr);
m[l + 6] = vaddq_f16(vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4)), t[5 + offset]), bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l + 3] = vmaxq_f16(zero, m[l + 3]);
m[l + 6] = vmaxq_f16(zero, m[l + 6]);
}
if (r_c == C8NUM && r_h == 3 && r_w == 3) {
Store9DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 3;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform6x3Relu6UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[36];
float16x8_t t[18];
float16x8_t m[9];
float16x8_t zero = vdupq_n_f16(0);
float16x8_t six = vdupq_n_f16(6);
Load36DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
t[l] = vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2);
t[l + 6] = vaddq_f16(vsubq_f16(src[1 + offset], src[2 + offset]),
vmulq_n_f16(vsubq_f16(src[3 + offset], src[4 + offset]), 2));
t[l + 12] = vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4)), src[5 + offset]);
}
for (int l = 0; l < 3; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), bias_ptr);
m[l + 3] = vaddq_f16(
vaddq_f16(vsubq_f16(t[1 + offset], t[2 + offset]), vmulq_n_f16(vsubq_f16(t[3 + offset], t[4 + offset]), 2)),
bias_ptr);
m[l + 6] = vaddq_f16(vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4)), t[5 + offset]), bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l] = vminq_f16(six, m[l]);
m[l + 3] = vmaxq_f16(zero, m[l + 3]);
m[l + 3] = vminq_f16(six, m[l + 3]);
m[l + 6] = vmaxq_f16(zero, m[l + 6]);
m[l + 6] = vminq_f16(six, m[l + 6]);
}
if (r_c == C8NUM && r_h == 3 && r_w == 3) {
Store9DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 3;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform6x4UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[36];
float16x8_t t[24];
float16x8_t m[16];
Load36DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp4 = vsubq_f16(src[3 + offset], src[4 + offset]);
t[l] = vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2);
t[l + 6] = vaddq_f16(tmp3, vmulq_n_f16(tmp4, 2));
t[l + 12] = vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4));
t[l + 18] = vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 8)), src[5 + offset]);
}
for (int l = 0; l < 4; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp4 = vsubq_f16(t[3 + offset], t[4 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), bias_ptr);
m[l + 4] = vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 2)), bias_ptr);
m[l + 8] = vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4)), bias_ptr);
m[l + 12] = vaddq_f16(vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 8)), t[5 + offset]), bias_ptr);
}
if (r_c == C8NUM && r_h == 4 && r_w == 4) {
Store16DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 4;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform6x4ReluUnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[36];
float16x8_t t[24];
float16x8_t m[16];
float16x8_t zero = vdupq_n_f16(0);
Load36DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp4 = vsubq_f16(src[3 + offset], src[4 + offset]);
t[l] = vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2);
t[l + 6] = vaddq_f16(tmp3, vmulq_n_f16(tmp4, 2));
t[l + 12] = vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4));
t[l + 18] = vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 8)), src[5 + offset]);
}
for (int l = 0; l < 4; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp4 = vsubq_f16(t[3 + offset], t[4 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), bias_ptr);
m[l + 4] = vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 2)), bias_ptr);
m[l + 8] = vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4)), bias_ptr);
m[l + 12] = vaddq_f16(vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 8)), t[5 + offset]), bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l + 4] = vmaxq_f16(zero, m[l + 4]);
m[l + 8] = vmaxq_f16(zero, m[l + 8]);
m[l + 12] = vmaxq_f16(zero, m[l + 12]);
}
if (r_c == C8NUM && r_h == 4 && r_w == 4) {
Store16DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 4;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform6x4Relu6UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[36];
float16x8_t t[24];
float16x8_t m[16];
float16x8_t zero = vdupq_n_f16(0);
float16x8_t six = vdupq_n_f16(6);
Load36DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp4 = vsubq_f16(src[3 + offset], src[4 + offset]);
t[l] = vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2);
t[l + 6] = vaddq_f16(tmp3, vmulq_n_f16(tmp4, 2));
t[l + 12] = vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4));
t[l + 18] = vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 8)), src[5 + offset]);
}
for (int l = 0; l < 4; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp4 = vsubq_f16(t[3 + offset], t[4 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), bias_ptr);
m[l + 4] = vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 2)), bias_ptr);
m[l + 8] = vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4)), bias_ptr);
m[l + 12] = vaddq_f16(vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 8)), t[5 + offset]), bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l] = vminq_f16(six, m[l]);
m[l + 4] = vmaxq_f16(zero, m[l + 4]);
m[l + 4] = vminq_f16(six, m[l + 4]);
m[l + 8] = vmaxq_f16(zero, m[l + 8]);
m[l + 8] = vminq_f16(six, m[l + 8]);
m[l + 12] = vmaxq_f16(zero, m[l + 12]);
m[l + 12] = vminq_f16(six, m[l + 12]);
}
if (r_c == C8NUM && r_h == 4 && r_w == 4) {
Store16DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 4;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform6x5UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[36];
float16x8_t t[30];
float16x8_t m[25];
Load36DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp4 = vsubq_f16(src[3 + offset], src[4 + offset]);
t[l] = vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2);
t[l + 6] = vaddq_f16(tmp3, vmulq_n_f16(tmp4, 2));
t[l + 12] = vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4));
t[l + 18] = vaddq_f16(tmp3, vmulq_n_f16(tmp4, 8));
t[l + 24] = vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 16)), src[5 + offset]);
}
for (int l = 0; l < 5; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp4 = vsubq_f16(t[3 + offset], t[4 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), bias_ptr);
m[l + 5] = vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 2)), bias_ptr);
m[l + 10] = vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4)), bias_ptr);
m[l + 15] = vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 8)), bias_ptr);
m[l + 20] = vaddq_f16(vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 16)), t[5 + offset]), bias_ptr);
}
if (r_c == C8NUM && r_h == 5 && r_w == 5) {
Store25DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 5;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform6x5ReluUnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[36];
float16x8_t t[30];
float16x8_t m[25];
float16x8_t zero = vdupq_n_f16(0);
Load36DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp4 = vsubq_f16(src[3 + offset], src[4 + offset]);
t[l] = vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2);
t[l + 6] = vaddq_f16(tmp3, vmulq_n_f16(tmp4, 2));
t[l + 12] = vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4));
t[l + 18] = vaddq_f16(tmp3, vmulq_n_f16(tmp4, 8));
t[l + 24] = vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 16)), src[5 + offset]);
}
for (int l = 0; l < 5; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp4 = vsubq_f16(t[3 + offset], t[4 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), bias_ptr);
m[l + 5] = vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 2)), bias_ptr);
m[l + 10] = vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4)), bias_ptr);
m[l + 15] = vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 8)), bias_ptr);
m[l + 20] = vaddq_f16(vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 16)), t[5 + offset]), bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l + 5] = vmaxq_f16(zero, m[l + 5]);
m[l + 10] = vmaxq_f16(zero, m[l + 10]);
m[l + 15] = vmaxq_f16(zero, m[l + 15]);
m[l + 20] = vmaxq_f16(zero, m[l + 20]);
}
if (r_c == C8NUM && r_h == 5 && r_w == 5) {
Store25DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 5;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform6x5Relu6UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[36];
float16x8_t t[30];
float16x8_t m[25];
float16x8_t zero = vdupq_n_f16(0);
float16x8_t six = vdupq_n_f16(6);
Load36DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 6; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp4 = vsubq_f16(src[3 + offset], src[4 + offset]);
t[l] = vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2);
t[l + 6] = vaddq_f16(tmp3, vmulq_n_f16(tmp4, 2));
t[l + 12] = vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4));
t[l + 18] = vaddq_f16(tmp3, vmulq_n_f16(tmp4, 8));
t[l + 24] = vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 16)), src[5 + offset]);
}
for (int l = 0; l < 5; ++l) {
int offset = l * 6;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp4 = vsubq_f16(t[3 + offset], t[4 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), bias_ptr);
m[l + 5] = vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 2)), bias_ptr);
m[l + 10] = vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 4)), bias_ptr);
m[l + 15] = vaddq_f16(vaddq_f16(tmp3, vmulq_n_f16(tmp4, 8)), bias_ptr);
m[l + 20] = vaddq_f16(vaddq_f16(vaddq_f16(tmp1, vmulq_n_f16(tmp2, 16)), t[5 + offset]), bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l] = vminq_f16(six, m[l]);
m[l + 5] = vmaxq_f16(zero, m[l + 5]);
m[l + 5] = vminq_f16(six, m[l + 5]);
m[l + 10] = vmaxq_f16(zero, m[l + 10]);
m[l + 10] = vminq_f16(six, m[l + 10]);
m[l + 15] = vmaxq_f16(zero, m[l + 15]);
m[l + 15] = vminq_f16(six, m[l + 15]);
m[l + 20] = vmaxq_f16(zero, m[l + 20]);
m[l + 20] = vminq_f16(six, m[l + 20]);
}
if (r_c == C8NUM && r_h == 5 && r_w == 5) {
Store25DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 5;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x2UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[16];
float16x8_t m[4];
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), src[7 + offset]);
}
for (int l = 0; l < 2; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 2] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), t[7 + offset]), bias_ptr);
}
if (r_c == C8NUM && r_h == 2 && r_w == 2) {
Store4DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x2ReluUnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[16];
float16x8_t m[4];
float16x8_t zero = vdupq_n_f16(0);
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), src[7 + offset]);
}
for (int l = 0; l < 2; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 2] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), t[7 + offset]), bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l + 2] = vmaxq_f16(zero, m[l + 2]);
}
if (r_c == C8NUM && r_h == 2 && r_w == 2) {
Store4DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x2Relu6UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[16];
float16x8_t m[4];
float16x8_t zero = vdupq_n_f16(0);
float16x8_t six = vdupq_n_f16(6);
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), src[7 + offset]);
}
for (int l = 0; l < 2; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 2] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), t[7 + offset]), bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l] = vminq_f16(six, m[l]);
m[l + 2] = vmaxq_f16(zero, m[l + 2]);
m[l + 2] = vminq_f16(six, m[l + 2]);
}
if (r_c == C8NUM && r_h == 2 && r_w == 2) {
Store4DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 2;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x3UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[24];
float16x8_t m[9];
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), src[7 + offset]);
}
for (int l = 0; l < 3; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 3] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 6] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), t[7 + offset]), bias_ptr);
}
if (r_c == C8NUM && r_h == 3 && r_w == 3) {
Store9DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 3;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x3ReluUnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[24];
float16x8_t m[9];
float16x8_t zero = vdupq_n_f16(0);
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), src[7 + offset]);
}
for (int l = 0; l < 3; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 3] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 6] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), t[7 + offset]), bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l + 3] = vmaxq_f16(zero, m[l + 3]);
m[l + 6] = vmaxq_f16(zero, m[l + 6]);
}
if (r_c == C8NUM && r_h == 3 && r_w == 3) {
Store9DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 3;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x3Relu6UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[24];
float16x8_t m[9];
float16x8_t zero = vdupq_n_f16(0);
float16x8_t six = vdupq_n_f16(6);
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), src[7 + offset]);
}
for (int l = 0; l < 3; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 3] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 6] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), t[7 + offset]), bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l] = vminq_f16(six, m[l]);
m[l + 3] = vmaxq_f16(zero, m[l + 3]);
m[l + 3] = vminq_f16(six, m[l + 3]);
m[l + 6] = vmaxq_f16(zero, m[l + 6]);
m[l + 6] = vminq_f16(six, m[l + 6]);
}
if (r_c == C8NUM && r_h == 3 && r_w == 3) {
Store9DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 3;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x4UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[32];
float16x8_t m[16];
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25));
t[l + 24] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), src[7 + offset]);
}
for (int l = 0; l < 4; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 4] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 8] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 12] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), t[7 + offset]),
bias_ptr);
}
if (r_c == C8NUM && r_h == 4 && r_w == 4) {
Store16DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 4;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x4ReluUnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[32];
float16x8_t m[16];
float16x8_t zero = vdupq_n_f16(0);
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25));
t[l + 24] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), src[7 + offset]);
}
for (int l = 0; l < 4; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 4] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 8] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 12] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), t[7 + offset]),
bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l + 4] = vmaxq_f16(zero, m[l + 4]);
m[l + 8] = vmaxq_f16(zero, m[l + 8]);
m[l + 12] = vmaxq_f16(zero, m[l + 12]);
}
if (r_c == C8NUM && r_h == 4 && r_w == 4) {
Store16DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 4;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x4Relu6UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[32];
float16x8_t m[16];
float16x8_t zero = vdupq_n_f16(0);
float16x8_t six = vdupq_n_f16(6);
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25));
t[l + 24] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), src[7 + offset]);
}
for (int l = 0; l < 4; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 4] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 8] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 12] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), t[7 + offset]),
bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l] = vminq_f16(six, m[l]);
m[l + 4] = vmaxq_f16(zero, m[l + 4]);
m[l + 4] = vminq_f16(six, m[l + 4]);
m[l + 8] = vmaxq_f16(zero, m[l + 8]);
m[l + 8] = vminq_f16(six, m[l + 8]);
m[l + 12] = vmaxq_f16(zero, m[l + 12]);
m[l + 12] = vminq_f16(six, m[l + 12]);
}
if (r_c == C8NUM && r_h == 4 && r_w == 4) {
Store16DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 4;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x5UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[40];
float16x8_t m[25];
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25));
t[l + 24] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375));
t[l + 32] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625)), src[7 + offset]);
}
for (int l = 0; l < 5; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 5] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 10] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 15] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), bias_ptr);
m[l + 20] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625)), t[7 + offset]),
bias_ptr);
}
if (r_c == C8NUM && r_h == 5 && r_w == 5) {
Store25DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 5;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x5ReluUnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[40];
float16x8_t m[25];
float16x8_t zero = vdupq_n_f16(0);
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25));
t[l + 24] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375));
t[l + 32] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625)), src[7 + offset]);
}
for (int l = 0; l < 5; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 5] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 10] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 15] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), bias_ptr);
m[l + 20] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625)), t[7 + offset]),
bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l + 5] = vmaxq_f16(zero, m[l + 5]);
m[l + 10] = vmaxq_f16(zero, m[l + 10]);
m[l + 15] = vmaxq_f16(zero, m[l + 15]);
m[l + 20] = vmaxq_f16(zero, m[l + 20]);
}
if (r_c == C8NUM && r_h == 5 && r_w == 5) {
Store25DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 5;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x5Relu6UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[40];
float16x8_t m[25];
float16x8_t zero = vdupq_n_f16(0);
float16x8_t six = vdupq_n_f16(6);
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25));
t[l + 24] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375));
t[l + 32] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625)), src[7 + offset]);
}
for (int l = 0; l < 5; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 5] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 10] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 15] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), bias_ptr);
m[l + 20] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625)), t[7 + offset]),
bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l] = vminq_f16(six, m[l]);
m[l + 5] = vmaxq_f16(zero, m[l + 5]);
m[l + 5] = vminq_f16(six, m[l + 5]);
m[l + 10] = vmaxq_f16(zero, m[l + 10]);
m[l + 10] = vminq_f16(six, m[l + 10]);
m[l + 15] = vmaxq_f16(zero, m[l + 15]);
m[l + 15] = vminq_f16(six, m[l + 15]);
m[l + 20] = vmaxq_f16(zero, m[l + 20]);
m[l + 20] = vminq_f16(six, m[l + 20]);
}
if (r_c == C8NUM && r_h == 5 && r_w == 5) {
Store25DataFp16;
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 5;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x6UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
int z = 0;
if (r_c == 8) {
float16x8_t src[64];
float16x8_t t[48];
float16x8_t m[36];
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25));
t[l + 24] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375));
t[l + 32] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625));
t[l + 40] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.03125), tmp5), vmulq_n_f16(tmp6, 7.59375)), src[7 + offset]);
}
for (int l = 0; l < 6; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 6] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 12] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 18] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), bias_ptr);
m[l + 24] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625)), bias_ptr);
m[l + 30] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.03125), tmp5), vmulq_n_f16(tmp6, 7.59375)), t[7 + offset]),
bias_ptr);
}
if (r_h == 6 && r_w == 6) {
for (int i = 0; i < 6; i++) {
int dst_k_offset = i * dst_step * out_c;
int m_k_offset = i * 6;
vst1q_f16(dst_data + dst_k_offset + 0 * out_c, m[m_k_offset]);
vst1q_f16(dst_data + dst_k_offset + 1 * out_c, m[m_k_offset + 1]);
vst1q_f16(dst_data + dst_k_offset + 2 * out_c, m[m_k_offset + 2]);
vst1q_f16(dst_data + dst_k_offset + 3 * out_c, m[m_k_offset + 3]);
vst1q_f16(dst_data + dst_k_offset + 4 * out_c, m[m_k_offset + 4]);
vst1q_f16(dst_data + dst_k_offset + 5 * out_c, m[m_k_offset + 5]);
}
} else {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 6;
for (int k = 0; k < r_w; k++) {
vst1q_f16(dst_data + dst_k_offset + k * out_c, m[k + m_k_offset]);
}
}
}
r_c -= 8;
} else if (r_c < 8 && r_c >= 4) {
float16x4_t src[64];
float16x4_t t[48];
float16x4_t m[36];
Load64DataC4Fp16;
float16x4_t bias_ptr = vld1_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x4_t tmp1 = vadd_f16(src[1 + offset], src[2 + offset]);
float16x4_t tmp2 = vadd_f16(src[3 + offset], src[4 + offset]);
float16x4_t tmp3 = vadd_f16(src[5 + offset], src[6 + offset]);
float16x4_t tmp4 = vsub_f16(src[1 + offset], src[2 + offset]);
float16x4_t tmp5 = vsub_f16(src[3 + offset], src[4 + offset]);
float16x4_t tmp6 = vsub_f16(src[5 + offset], src[6 + offset]);
t[l] = vadd_f16(vadd_f16(vadd_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.5), tmp5), vmul_n_f16(tmp6, 1.5));
t[l + 16] = vadd_f16(vadd_f16(vmul_n_f16(tmp1, 0.25), tmp2), vmul_n_f16(tmp3, 2.25));
t[l + 24] = vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.125), tmp5), vmul_n_f16(tmp6, 3.375));
t[l + 32] = vadd_f16(vadd_f16(vmul_n_f16(tmp1, 0.0625), tmp2), vmul_n_f16(tmp3, 5.0625));
t[l + 40] =
vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.03125), tmp5), vmul_n_f16(tmp6, 7.59375)), src[7 + offset]);
}
for (int l = 0; l < 6; ++l) {
int offset = l * 8;
float16x4_t tmp1 = vadd_f16(t[1 + offset], t[2 + offset]);
float16x4_t tmp2 = vadd_f16(t[3 + offset], t[4 + offset]);
float16x4_t tmp3 = vadd_f16(t[5 + offset], t[6 + offset]);
float16x4_t tmp4 = vsub_f16(t[1 + offset], t[2 + offset]);
float16x4_t tmp5 = vsub_f16(t[3 + offset], t[4 + offset]);
float16x4_t tmp6 = vsub_f16(t[5 + offset], t[6 + offset]);
m[l] = vadd_f16(vadd_f16(vadd_f16(vadd_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 6] = vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.5), tmp5), vmul_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 12] = vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp1, 0.25), tmp2), vmul_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 18] = vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.125), tmp5), vmul_n_f16(tmp6, 3.375)), bias_ptr);
m[l + 24] = vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp1, 0.0625), tmp2), vmul_n_f16(tmp3, 5.0625)), bias_ptr);
m[l + 30] = vadd_f16(
vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.03125), tmp5), vmul_n_f16(tmp6, 7.59375)), t[7 + offset]),
bias_ptr);
}
if (r_h == 6 && r_w == 6) {
for (int i = 0; i < 6; i++) {
int dst_k_offset = i * dst_step * out_c;
int m_k_offset = i * 6;
vst1_f16(dst_data + dst_k_offset + 0 * out_c, m[m_k_offset]);
vst1_f16(dst_data + dst_k_offset + 1 * out_c, m[m_k_offset + 1]);
vst1_f16(dst_data + dst_k_offset + 2 * out_c, m[m_k_offset + 2]);
vst1_f16(dst_data + dst_k_offset + 3 * out_c, m[m_k_offset + 3]);
vst1_f16(dst_data + dst_k_offset + 4 * out_c, m[m_k_offset + 4]);
vst1_f16(dst_data + dst_k_offset + 5 * out_c, m[m_k_offset + 5]);
}
} else {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 6;
for (int k = 0; k < r_w; k++) {
vst1_f16(dst_data + dst_k_offset + k * out_c, m[k + m_k_offset]);
}
}
}
z = 4;
}
for (; z < r_c; ++z) {
float16_t src[64];
float16_t t[48];
float16_t m[36];
for (int k = 0; k < 16; ++k) {
src[k] = src_data[z + k * src_step];
}
float16_t bias_ptr = bias_data[z];
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16_t tmp1 = src[1 + offset] + src[2 + offset];
float16_t tmp2 = src[3 + offset] + src[4 + offset];
float16_t tmp3 = src[5 + offset] + src[6 + offset];
float16_t tmp4 = src[1 + offset] - src[2 + offset];
float16_t tmp5 = src[3 + offset] - src[4 + offset];
float16_t tmp6 = src[5 + offset] - src[6 + offset];
t[l] = src[offset] + tmp1 + tmp2 + tmp3;
t[l + 8] = tmp4 * 0.5f + tmp5 + tmp6 * 1.5f;
t[l + 16] = tmp1 * 0.25f + tmp2 + tmp3 * 2.25f;
t[l + 24] = tmp4 * 0.125f + tmp5 + tmp6 * 3.375f;
t[l + 32] = tmp1 * 0.0625f + tmp2 + tmp3 * 5.0625f;
t[l + 40] = tmp4 * 0.03125f + tmp5 + tmp6 * 7.59375f + src[7 + offset];
}
for (int l = 0; l < 6; ++l) {
int offset = l * 8;
float16_t tmp1 = t[1 + offset] + t[2 + offset];
float16_t tmp2 = t[3 + offset] + t[4 + offset];
float16_t tmp3 = t[5 + offset] + t[6 + offset];
float16_t tmp4 = t[1 + offset] - t[2 + offset];
float16_t tmp5 = t[3 + offset] - t[4 + offset];
float16_t tmp6 = t[5 + offset] - t[6 + offset];
m[l] = t[offset] + tmp1 + tmp2 + tmp3 + bias_ptr;
m[l + 6] = tmp4 * 0.5f + tmp5 + tmp6 * 1.5f + bias_ptr;
m[l + 12] = tmp1 * 0.25f + tmp2 + tmp3 * 2.25f + bias_ptr;
m[l + 18] = tmp4 * 0.125f + tmp5 + tmp6 * 3.375f + bias_ptr;
m[l + 24] = tmp1 * 0.0625f + tmp2 + tmp3 * 5.0625f + bias_ptr;
m[l + 30] = tmp4 * 0.03125f + tmp5 + tmp6 * 7.59375f + t[7 + offset] + bias_ptr;
}
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 6;
for (int k = 0; k < r_w; k++) {
dst_data[z + dst_k_offset + k * out_c] = m[k + m_k_offset];
}
}
}
}
void OutputTransform8x6ReluUnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
int z = 0;
if (r_c == 8) {
float16x8_t src[64];
float16x8_t t[48];
float16x8_t m[36];
float16x8_t zero = vdupq_n_f16(0);
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25));
t[l + 24] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375));
t[l + 32] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625));
t[l + 40] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.03125), tmp5), vmulq_n_f16(tmp6, 7.59375)), src[7 + offset]);
}
for (int l = 0; l < 6; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 6] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 12] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 18] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), bias_ptr);
m[l + 24] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625)), bias_ptr);
m[l + 30] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.03125), tmp5), vmulq_n_f16(tmp6, 7.59375)), t[7 + offset]),
bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l + 6] = vmaxq_f16(zero, m[l + 6]);
m[l + 12] = vmaxq_f16(zero, m[l + 12]);
m[l + 18] = vmaxq_f16(zero, m[l + 18]);
m[l + 24] = vmaxq_f16(zero, m[l + 24]);
m[l + 30] = vmaxq_f16(zero, m[l + 30]);
}
if (r_h == 6 && r_w == 6) {
for (int i = 0; i < 6; i++) {
int dst_k_offset = i * dst_step * out_c;
int m_k_offset = i * 6;
vst1q_f16(dst_data + dst_k_offset + 0 * out_c, m[m_k_offset]);
vst1q_f16(dst_data + dst_k_offset + 1 * out_c, m[m_k_offset + 1]);
vst1q_f16(dst_data + dst_k_offset + 2 * out_c, m[m_k_offset + 2]);
vst1q_f16(dst_data + dst_k_offset + 3 * out_c, m[m_k_offset + 3]);
vst1q_f16(dst_data + dst_k_offset + 4 * out_c, m[m_k_offset + 4]);
vst1q_f16(dst_data + dst_k_offset + 5 * out_c, m[m_k_offset + 5]);
}
} else {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 6;
for (int k = 0; k < r_w; k++) {
vst1q_f16(dst_data + dst_k_offset + k * out_c, m[k + m_k_offset]);
}
}
}
r_c -= 8;
} else if (r_c < 8 && r_c >= 4) {
float16x4_t src[64];
float16x4_t t[48];
float16x4_t m[36];
float16x4_t zero = vdup_n_f16(0);
Load64DataC4Fp16;
float16x4_t bias_ptr = vld1_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x4_t tmp1 = vadd_f16(src[1 + offset], src[2 + offset]);
float16x4_t tmp2 = vadd_f16(src[3 + offset], src[4 + offset]);
float16x4_t tmp3 = vadd_f16(src[5 + offset], src[6 + offset]);
float16x4_t tmp4 = vsub_f16(src[1 + offset], src[2 + offset]);
float16x4_t tmp5 = vsub_f16(src[3 + offset], src[4 + offset]);
float16x4_t tmp6 = vsub_f16(src[5 + offset], src[6 + offset]);
t[l] = vadd_f16(vadd_f16(vadd_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.5), tmp5), vmul_n_f16(tmp6, 1.5));
t[l + 16] = vadd_f16(vadd_f16(vmul_n_f16(tmp1, 0.25), tmp2), vmul_n_f16(tmp3, 2.25));
t[l + 24] = vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.125), tmp5), vmul_n_f16(tmp6, 3.375));
t[l + 32] = vadd_f16(vadd_f16(vmul_n_f16(tmp1, 0.0625), tmp2), vmul_n_f16(tmp3, 5.0625));
t[l + 40] =
vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.03125), tmp5), vmul_n_f16(tmp6, 7.59375)), src[7 + offset]);
}
for (int l = 0; l < 6; ++l) {
int offset = l * 8;
float16x4_t tmp1 = vadd_f16(t[1 + offset], t[2 + offset]);
float16x4_t tmp2 = vadd_f16(t[3 + offset], t[4 + offset]);
float16x4_t tmp3 = vadd_f16(t[5 + offset], t[6 + offset]);
float16x4_t tmp4 = vsub_f16(t[1 + offset], t[2 + offset]);
float16x4_t tmp5 = vsub_f16(t[3 + offset], t[4 + offset]);
float16x4_t tmp6 = vsub_f16(t[5 + offset], t[6 + offset]);
m[l] = vadd_f16(vadd_f16(vadd_f16(vadd_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 6] = vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.5), tmp5), vmul_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 12] = vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp1, 0.25), tmp2), vmul_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 18] = vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.125), tmp5), vmul_n_f16(tmp6, 3.375)), bias_ptr);
m[l + 24] = vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp1, 0.0625), tmp2), vmul_n_f16(tmp3, 5.0625)), bias_ptr);
m[l + 30] = vadd_f16(
vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.03125), tmp5), vmul_n_f16(tmp6, 7.59375)), t[7 + offset]),
bias_ptr);
m[l] = vmax_f16(zero, m[l]);
m[l + 6] = vmax_f16(zero, m[l + 6]);
m[l + 12] = vmax_f16(zero, m[l + 12]);
m[l + 18] = vmax_f16(zero, m[l + 18]);
m[l + 24] = vmax_f16(zero, m[l + 24]);
m[l + 30] = vmax_f16(zero, m[l + 30]);
}
if (r_h == 6 && r_w == 6) {
for (int i = 0; i < 6; i++) {
int dst_k_offset = i * dst_step * out_c;
int m_k_offset = i * 6;
vst1_f16(dst_data + dst_k_offset + 0 * out_c, m[m_k_offset]);
vst1_f16(dst_data + dst_k_offset + 1 * out_c, m[m_k_offset + 1]);
vst1_f16(dst_data + dst_k_offset + 2 * out_c, m[m_k_offset + 2]);
vst1_f16(dst_data + dst_k_offset + 3 * out_c, m[m_k_offset + 3]);
vst1_f16(dst_data + dst_k_offset + 4 * out_c, m[m_k_offset + 4]);
vst1_f16(dst_data + dst_k_offset + 5 * out_c, m[m_k_offset + 5]);
}
} else {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 6;
for (int k = 0; k < r_w; k++) {
vst1_f16(dst_data + dst_k_offset + k * out_c, m[k + m_k_offset]);
}
}
}
z = 4;
}
for (; z < r_c; ++z) {
float16_t src[64];
float16_t t[48];
float16_t m[36];
for (int k = 0; k < 16; ++k) {
src[k] = src_data[z + k * src_step];
}
float16_t bias_ptr = bias_data[z];
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16_t tmp1 = src[1 + offset] + src[2 + offset];
float16_t tmp2 = src[3 + offset] + src[4 + offset];
float16_t tmp3 = src[5 + offset] + src[6 + offset];
float16_t tmp4 = src[1 + offset] - src[2 + offset];
float16_t tmp5 = src[3 + offset] - src[4 + offset];
float16_t tmp6 = src[5 + offset] - src[6 + offset];
t[l] = src[offset] + tmp1 + tmp2 + tmp3;
t[l + 8] = tmp4 * 0.5f + tmp5 + tmp6 * 1.5f;
t[l + 16] = tmp1 * 0.25f + tmp2 + tmp3 * 2.25f;
t[l + 24] = tmp4 * 0.125f + tmp5 + tmp6 * 3.375f;
t[l + 32] = tmp1 * 0.0625f + tmp2 + tmp3 * 5.0625f;
t[l + 40] = tmp4 * 0.03125f + tmp5 + tmp6 * 7.59375f + src[7 + offset];
}
for (int l = 0; l < 6; ++l) {
int offset = l * 8;
float16_t tmp1 = t[1 + offset] + t[2 + offset];
float16_t tmp2 = t[3 + offset] + t[4 + offset];
float16_t tmp3 = t[5 + offset] + t[6 + offset];
float16_t tmp4 = t[1 + offset] - t[2 + offset];
float16_t tmp5 = t[3 + offset] - t[4 + offset];
float16_t tmp6 = t[5 + offset] - t[6 + offset];
m[l] = t[offset] + tmp1 + tmp2 + tmp3 + bias_ptr;
m[l + 6] = tmp4 * 0.5f + tmp5 + tmp6 * 1.5f + bias_ptr;
m[l + 12] = tmp1 * 0.25f + tmp2 + tmp3 * 2.25f + bias_ptr;
m[l + 18] = tmp4 * 0.125f + tmp5 + tmp6 * 3.375f + bias_ptr;
m[l + 24] = tmp1 * 0.0625f + tmp2 + tmp3 * 5.0625f + bias_ptr;
m[l + 30] = tmp4 * 0.03125f + tmp5 + tmp6 * 7.59375f + t[7 + offset] + bias_ptr;
m[l] = m[l] > 0 ? m[l] : 0;
m[l + 6] = m[l + 6] > 0 ? m[l + 6] : 0;
m[l + 12] = m[l + 12] > 0 ? m[l + 12] : 0;
m[l + 18] = m[l + 18] > 0 ? m[l + 18] : 0;
m[l + 24] = m[l + 24] > 0 ? m[l + 24] : 0;
m[l + 30] = m[l + 30] > 0 ? m[l + 30] : 0;
}
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 6;
for (int k = 0; k < r_w; k++) {
dst_data[z + dst_k_offset + k * out_c] = m[k + m_k_offset];
}
}
}
}
void OutputTransform8x6Relu6UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
int z = 0;
if (r_c == 8) {
float16x8_t src[64];
float16x8_t t[48];
float16x8_t m[36];
float16x8_t zero = vdupq_n_f16(0);
float16x8_t six = vdupq_n_f16(6);
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25));
t[l + 24] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375));
t[l + 32] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625));
t[l + 40] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.03125), tmp5), vmulq_n_f16(tmp6, 7.59375)), src[7 + offset]);
}
for (int l = 0; l < 6; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 6] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 12] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 18] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), bias_ptr);
m[l + 24] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625)), bias_ptr);
m[l + 30] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.03125), tmp5), vmulq_n_f16(tmp6, 7.59375)), t[7 + offset]),
bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l] = vminq_f16(six, m[l]);
m[l + 6] = vmaxq_f16(zero, m[l + 6]);
m[l + 6] = vminq_f16(six, m[l + 6]);
m[l + 12] = vmaxq_f16(zero, m[l + 12]);
m[l + 12] = vminq_f16(six, m[l + 12]);
m[l + 18] = vmaxq_f16(zero, m[l + 18]);
m[l + 18] = vminq_f16(six, m[l + 18]);
m[l + 24] = vmaxq_f16(zero, m[l + 24]);
m[l + 24] = vminq_f16(six, m[l + 24]);
m[l + 30] = vmaxq_f16(zero, m[l + 30]);
m[l + 30] = vminq_f16(six, m[l + 30]);
}
if (r_h == 6 && r_w == 6) {
for (int i = 0; i < 6; i++) {
int dst_k_offset = i * dst_step * out_c;
int m_k_offset = i * 6;
vst1q_f16(dst_data + dst_k_offset + 0 * out_c, m[m_k_offset]);
vst1q_f16(dst_data + dst_k_offset + 1 * out_c, m[m_k_offset + 1]);
vst1q_f16(dst_data + dst_k_offset + 2 * out_c, m[m_k_offset + 2]);
vst1q_f16(dst_data + dst_k_offset + 3 * out_c, m[m_k_offset + 3]);
vst1q_f16(dst_data + dst_k_offset + 4 * out_c, m[m_k_offset + 4]);
vst1q_f16(dst_data + dst_k_offset + 5 * out_c, m[m_k_offset + 5]);
}
} else {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 6;
for (int k = 0; k < r_w; k++) {
vst1q_f16(dst_data + dst_k_offset + k * out_c, m[k + m_k_offset]);
}
}
}
r_c -= 8;
} else if (r_c < 8 && r_c >= 4) {
float16x4_t src[64];
float16x4_t t[48];
float16x4_t m[36];
float16x4_t zero = vdup_n_f16(0);
float16x4_t six = vdup_n_f16(6);
Load64DataC4Fp16;
float16x4_t bias_ptr = vld1_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x4_t tmp1 = vadd_f16(src[1 + offset], src[2 + offset]);
float16x4_t tmp2 = vadd_f16(src[3 + offset], src[4 + offset]);
float16x4_t tmp3 = vadd_f16(src[5 + offset], src[6 + offset]);
float16x4_t tmp4 = vsub_f16(src[1 + offset], src[2 + offset]);
float16x4_t tmp5 = vsub_f16(src[3 + offset], src[4 + offset]);
float16x4_t tmp6 = vsub_f16(src[5 + offset], src[6 + offset]);
t[l] = vadd_f16(vadd_f16(vadd_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.5), tmp5), vmul_n_f16(tmp6, 1.5));
t[l + 16] = vadd_f16(vadd_f16(vmul_n_f16(tmp1, 0.25), tmp2), vmul_n_f16(tmp3, 2.25));
t[l + 24] = vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.125), tmp5), vmul_n_f16(tmp6, 3.375));
t[l + 32] = vadd_f16(vadd_f16(vmul_n_f16(tmp1, 0.0625), tmp2), vmul_n_f16(tmp3, 5.0625));
t[l + 40] =
vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.03125), tmp5), vmul_n_f16(tmp6, 7.59375)), src[7 + offset]);
}
for (int l = 0; l < 6; ++l) {
int offset = l * 8;
float16x4_t tmp1 = vadd_f16(t[1 + offset], t[2 + offset]);
float16x4_t tmp2 = vadd_f16(t[3 + offset], t[4 + offset]);
float16x4_t tmp3 = vadd_f16(t[5 + offset], t[6 + offset]);
float16x4_t tmp4 = vsub_f16(t[1 + offset], t[2 + offset]);
float16x4_t tmp5 = vsub_f16(t[3 + offset], t[4 + offset]);
float16x4_t tmp6 = vsub_f16(t[5 + offset], t[6 + offset]);
m[l] = vadd_f16(vadd_f16(vadd_f16(vadd_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 6] = vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.5), tmp5), vmul_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 12] = vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp1, 0.25), tmp2), vmul_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 18] = vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.125), tmp5), vmul_n_f16(tmp6, 3.375)), bias_ptr);
m[l + 24] = vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp1, 0.0625), tmp2), vmul_n_f16(tmp3, 5.0625)), bias_ptr);
m[l + 30] = vadd_f16(
vadd_f16(vadd_f16(vadd_f16(vmul_n_f16(tmp4, 0.03125), tmp5), vmul_n_f16(tmp6, 7.59375)), t[7 + offset]),
bias_ptr);
m[l] = vmax_f16(zero, m[l]);
m[l] = vmin_f16(six, m[l]);
m[l + 6] = vmax_f16(zero, m[l + 6]);
m[l + 6] = vmin_f16(six, m[l + 6]);
m[l + 12] = vmax_f16(zero, m[l + 12]);
m[l + 12] = vmin_f16(six, m[l + 12]);
m[l + 18] = vmax_f16(zero, m[l + 18]);
m[l + 18] = vmin_f16(six, m[l + 18]);
m[l + 24] = vmax_f16(zero, m[l + 24]);
m[l + 24] = vmin_f16(six, m[l + 24]);
m[l + 30] = vmax_f16(zero, m[l + 30]);
m[l + 30] = vmin_f16(six, m[l + 30]);
}
if (r_h == 6 && r_w == 6) {
for (int i = 0; i < 6; i++) {
int dst_k_offset = i * dst_step * out_c;
int m_k_offset = i * 6;
vst1_f16(dst_data + dst_k_offset + 0 * out_c, m[m_k_offset]);
vst1_f16(dst_data + dst_k_offset + 1 * out_c, m[m_k_offset + 1]);
vst1_f16(dst_data + dst_k_offset + 2 * out_c, m[m_k_offset + 2]);
vst1_f16(dst_data + dst_k_offset + 3 * out_c, m[m_k_offset + 3]);
vst1_f16(dst_data + dst_k_offset + 4 * out_c, m[m_k_offset + 4]);
vst1_f16(dst_data + dst_k_offset + 5 * out_c, m[m_k_offset + 5]);
}
} else {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 6;
for (int k = 0; k < r_w; k++) {
vst1_f16(dst_data + dst_k_offset + k * out_c, m[k + m_k_offset]);
}
}
}
z = 4;
}
for (; z < r_c; ++z) {
float16_t src[64];
float16_t t[48];
float16_t m[36];
for (int k = 0; k < 16; ++k) {
src[k] = src_data[z + k * src_step];
}
float16_t bias_ptr = bias_data[z];
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16_t tmp1 = src[1 + offset] + src[2 + offset];
float16_t tmp2 = src[3 + offset] + src[4 + offset];
float16_t tmp3 = src[5 + offset] + src[6 + offset];
float16_t tmp4 = src[1 + offset] - src[2 + offset];
float16_t tmp5 = src[3 + offset] - src[4 + offset];
float16_t tmp6 = src[5 + offset] - src[6 + offset];
t[l] = src[offset] + tmp1 + tmp2 + tmp3;
t[l + 8] = tmp4 * 0.5f + tmp5 + tmp6 * 1.5f;
t[l + 16] = tmp1 * 0.25f + tmp2 + tmp3 * 2.25f;
t[l + 24] = tmp4 * 0.125f + tmp5 + tmp6 * 3.375f;
t[l + 32] = tmp1 * 0.0625f + tmp2 + tmp3 * 5.0625f;
t[l + 40] = tmp4 * 0.03125f + tmp5 + tmp6 * 7.59375f + src[7 + offset];
}
for (int l = 0; l < 6; ++l) {
int offset = l * 8;
float16_t tmp1 = t[1 + offset] + t[2 + offset];
float16_t tmp2 = t[3 + offset] + t[4 + offset];
float16_t tmp3 = t[5 + offset] + t[6 + offset];
float16_t tmp4 = t[1 + offset] - t[2 + offset];
float16_t tmp5 = t[3 + offset] - t[4 + offset];
float16_t tmp6 = t[5 + offset] - t[6 + offset];
m[l] = t[offset] + tmp1 + tmp2 + tmp3 + bias_ptr;
m[l + 6] = tmp4 * 0.5f + tmp5 + tmp6 * 1.5f + bias_ptr;
m[l + 12] = tmp1 * 0.25f + tmp2 + tmp3 * 2.25f + bias_ptr;
m[l + 18] = tmp4 * 0.125f + tmp5 + tmp6 * 3.375f + bias_ptr;
m[l + 24] = tmp1 * 0.0625f + tmp2 + tmp3 * 5.0625f + bias_ptr;
m[l + 30] = tmp4 * 0.03125f + tmp5 + tmp6 * 7.59375f + t[7 + offset] + bias_ptr;
m[l] = m[l] > 0 ? m[l] : 0;
m[l] = m[l] > 0 ? m[l] : 0;
m[l + 6] = m[l + 6] > 0 ? m[l + 6] : 0;
m[l + 6] = m[l + 6] < 6 ? m[l + 6] : 6;
m[l + 12] = m[l + 12] > 0 ? m[l + 12] : 0;
m[l + 12] = m[l + 12] < 6 ? m[l + 12] : 6;
m[l + 18] = m[l + 18] > 0 ? m[l + 18] : 0;
m[l + 18] = m[l + 18] < 6 ? m[l + 18] : 6;
m[l + 24] = m[l + 24] > 0 ? m[l + 24] : 0;
m[l + 24] = m[l + 24] < 6 ? m[l + 24] : 6;
m[l + 30] = m[l + 30] > 0 ? m[l + 30] : 0;
m[l + 30] = m[l + 30] < 6 ? m[l + 30] : 6;
}
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 6;
for (int k = 0; k < r_w; k++) {
dst_data[z + dst_k_offset + k * out_c] = m[k + m_k_offset];
}
}
}
}
void OutputTransform8x7UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[56];
float16x8_t m[49];
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25));
t[l + 24] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375));
t[l + 32] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625));
t[l + 40] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.03125), tmp5), vmulq_n_f16(tmp6, 7.59375));
t[l + 48] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.015625), tmp2), vmulq_n_f16(tmp3, 11.390625)), src[7 + offset]);
}
for (int l = 0; l < 7; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 7] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 14] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 21] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), bias_ptr);
m[l + 28] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625)), bias_ptr);
m[l + 35] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.03125), tmp5), vmulq_n_f16(tmp6, 7.59375)), bias_ptr);
m[l + 42] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.015625), tmp2), vmulq_n_f16(tmp3, 11.390625)), t[7 + offset]),
bias_ptr);
}
if (r_c == C8NUM && r_h == 7 && r_w == 7) {
for (int i = 0; i < 7; i++) {
int dst_k_offset = i * dst_step * out_c;
int m_k_offset = i * 7;
vst1q_f16(dst_data + dst_k_offset + 0 * out_c, m[m_k_offset]);
vst1q_f16(dst_data + dst_k_offset + 1 * out_c, m[m_k_offset + 1]);
vst1q_f16(dst_data + dst_k_offset + 2 * out_c, m[m_k_offset + 2]);
vst1q_f16(dst_data + dst_k_offset + 3 * out_c, m[m_k_offset + 3]);
vst1q_f16(dst_data + dst_k_offset + 4 * out_c, m[m_k_offset + 4]);
vst1q_f16(dst_data + dst_k_offset + 5 * out_c, m[m_k_offset + 5]);
vst1q_f16(dst_data + dst_k_offset + 6 * out_c, m[m_k_offset + 6]);
}
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 7;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x7ReluUnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[56];
float16x8_t m[49];
float16x8_t zero = vdupq_n_f16(0);
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25));
t[l + 24] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375));
t[l + 32] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625));
t[l + 40] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.03125), tmp5), vmulq_n_f16(tmp6, 7.59375));
t[l + 48] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.015625), tmp2), vmulq_n_f16(tmp3, 11.390625)), src[7 + offset]);
}
for (int l = 0; l < 7; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 7] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 14] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 21] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), bias_ptr);
m[l + 28] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625)), bias_ptr);
m[l + 35] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.03125), tmp5), vmulq_n_f16(tmp6, 7.59375)), bias_ptr);
m[l + 42] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.015625), tmp2), vmulq_n_f16(tmp3, 11.390625)), t[7 + offset]),
bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l + 7] = vmaxq_f16(zero, m[l + 7]);
m[l + 14] = vmaxq_f16(zero, m[l + 14]);
m[l + 21] = vmaxq_f16(zero, m[l + 21]);
m[l + 28] = vmaxq_f16(zero, m[l + 28]);
m[l + 35] = vmaxq_f16(zero, m[l + 35]);
m[l + 42] = vmaxq_f16(zero, m[l + 42]);
}
if (r_c == C8NUM && r_h == 7 && r_w == 7) {
for (int i = 0; i < 7; i++) {
int dst_k_offset = i * dst_step * out_c;
int m_k_offset = i * 7;
vst1q_f16(dst_data + dst_k_offset + 0 * out_c, m[m_k_offset]);
vst1q_f16(dst_data + dst_k_offset + 1 * out_c, m[m_k_offset + 1]);
vst1q_f16(dst_data + dst_k_offset + 2 * out_c, m[m_k_offset + 2]);
vst1q_f16(dst_data + dst_k_offset + 3 * out_c, m[m_k_offset + 3]);
vst1q_f16(dst_data + dst_k_offset + 4 * out_c, m[m_k_offset + 4]);
vst1q_f16(dst_data + dst_k_offset + 5 * out_c, m[m_k_offset + 5]);
vst1q_f16(dst_data + dst_k_offset + 6 * out_c, m[m_k_offset + 6]);
}
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 7;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
void OutputTransform8x7Relu6UnitFp16(const float16_t *src_data, float16_t *dst_data, const float16_t *bias_data,
int src_step, int dst_step, int out_c, int r_w, int r_h, int r_c) {
float16x8_t src[64];
float16x8_t t[56];
float16x8_t m[49];
float16x8_t zero = vdupq_n_f16(0);
float16x8_t six = vdupq_n_f16(6);
Load64DataFp16;
float16x8_t bias_ptr = vld1q_f16(bias_data);
for (int l = 0; l < 8; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp2 = vaddq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp3 = vaddq_f16(src[5 + offset], src[6 + offset]);
float16x8_t tmp4 = vsubq_f16(src[1 + offset], src[2 + offset]);
float16x8_t tmp5 = vsubq_f16(src[3 + offset], src[4 + offset]);
float16x8_t tmp6 = vsubq_f16(src[5 + offset], src[6 + offset]);
t[l] = vaddq_f16(vaddq_f16(vaddq_f16(src[offset], tmp1), tmp2), tmp3);
t[l + 8] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5));
t[l + 16] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25));
t[l + 24] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375));
t[l + 32] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625));
t[l + 40] = vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.03125), tmp5), vmulq_n_f16(tmp6, 7.59375));
t[l + 48] =
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.015625), tmp2), vmulq_n_f16(tmp3, 11.390625)), src[7 + offset]);
}
for (int l = 0; l < 7; ++l) {
int offset = l * 8;
float16x8_t tmp1 = vaddq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp2 = vaddq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp3 = vaddq_f16(t[5 + offset], t[6 + offset]);
float16x8_t tmp4 = vsubq_f16(t[1 + offset], t[2 + offset]);
float16x8_t tmp5 = vsubq_f16(t[3 + offset], t[4 + offset]);
float16x8_t tmp6 = vsubq_f16(t[5 + offset], t[6 + offset]);
m[l] = vaddq_f16(vaddq_f16(vaddq_f16(vaddq_f16(t[offset], tmp1), tmp2), tmp3), bias_ptr);
m[l + 7] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.5), tmp5), vmulq_n_f16(tmp6, 1.5)), bias_ptr);
m[l + 14] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.25), tmp2), vmulq_n_f16(tmp3, 2.25)), bias_ptr);
m[l + 21] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.125), tmp5), vmulq_n_f16(tmp6, 3.375)), bias_ptr);
m[l + 28] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.0625), tmp2), vmulq_n_f16(tmp3, 5.0625)), bias_ptr);
m[l + 35] = vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp4, 0.03125), tmp5), vmulq_n_f16(tmp6, 7.59375)), bias_ptr);
m[l + 42] = vaddq_f16(
vaddq_f16(vaddq_f16(vaddq_f16(vmulq_n_f16(tmp1, 0.015625), tmp2), vmulq_n_f16(tmp3, 11.390625)), t[7 + offset]),
bias_ptr);
m[l] = vmaxq_f16(zero, m[l]);
m[l] = vminq_f16(six, m[l]);
m[l + 7] = vmaxq_f16(zero, m[l + 7]);
m[l + 7] = vminq_f16(six, m[l + 7]);
m[l + 14] = vmaxq_f16(zero, m[l + 14]);
m[l + 14] = vminq_f16(six, m[l + 14]);
m[l + 21] = vmaxq_f16(zero, m[l + 21]);
m[l + 21] = vminq_f16(six, m[l + 21]);
m[l + 28] = vmaxq_f16(zero, m[l + 28]);
m[l + 28] = vminq_f16(six, m[l + 28]);
m[l + 35] = vmaxq_f16(zero, m[l + 35]);
m[l + 35] = vminq_f16(six, m[l + 35]);
m[l + 42] = vmaxq_f16(zero, m[l + 42]);
m[l + 42] = vminq_f16(six, m[l + 42]);
}
if (r_c == C8NUM && r_h == 7 && r_w == 7) {
for (int i = 0; i < 7; i++) {
int dst_k_offset = i * dst_step * out_c;
int m_k_offset = i * 7;
vst1q_f16(dst_data + dst_k_offset + 0 * out_c, m[m_k_offset]);
vst1q_f16(dst_data + dst_k_offset + 1 * out_c, m[m_k_offset + 1]);
vst1q_f16(dst_data + dst_k_offset + 2 * out_c, m[m_k_offset + 2]);
vst1q_f16(dst_data + dst_k_offset + 3 * out_c, m[m_k_offset + 3]);
vst1q_f16(dst_data + dst_k_offset + 4 * out_c, m[m_k_offset + 4]);
vst1q_f16(dst_data + dst_k_offset + 5 * out_c, m[m_k_offset + 5]);
vst1q_f16(dst_data + dst_k_offset + 6 * out_c, m[m_k_offset + 6]);
}
} else {
for (int i = 0; i < r_c; i++) {
for (int j = 0; j < r_h; j++) {
int dst_k_offset = j * dst_step * out_c;
int m_k_offset = j * 7;
for (int k = 0; k < r_w; k++) {
dst_data[i + dst_k_offset + k * out_c] = m[k + m_k_offset][i];
}
}
}
}
}
int SelectOutputUnitFp16(const ConvParameter *conv_param) {
int kernel_h = conv_param->kernel_h_;
int kernel_w = conv_param->kernel_w_;
int in_c = conv_param->input_channel_;
int out_w = conv_param->output_w_;
int out_h = conv_param->output_h_;
int out_c = conv_param->output_channel_;
int unit2 = UP_DIV(out_w * out_h, C16NUM * conv_param->op_parameter_.thread_num_);
int max_out_unit = (int)(sqrtf((float)unit2));
max_out_unit = max_out_unit < MAX_UNIT_FP16 ? max_out_unit : MAX_UNIT_FP16;
max_out_unit = max_out_unit > MIN_UNIT_FP16 ? max_out_unit : MIN_UNIT_FP16;
int unit = 0;
float max_rate = 0.0f;
float common_cost = (float)out_h * out_w * in_c * out_c * kernel_h * kernel_w;
for (int i = MIN_UNIT_FP16; i <= max_out_unit; ++i) {
int input_unit = i + kernel_w - 1;
if (!GetOutputTransFp16Func(input_unit, i, ActType_No)) {
continue;
}
float penalty = ((float)input_unit * input_unit) / ((float)kernel_h * kernel_w) * 0.12f;
float wino_cost = ((2 + out_c) * (float)input_unit * input_unit * in_c + ((float)input_unit + i) * i * out_c) *
UP_DIV(out_w, i) * UP_DIV(out_h, i);
float reduce_rate = common_cost / wino_cost - penalty;
if (reduce_rate > max_rate) {
max_rate = reduce_rate;
unit = i;
}
}
if (max_rate < 1.0f) {
return 1;
}
// If output_unit is 1, then it is conventional convolution
return unit;
}
void CheckIfUseWinogradFp16(bool *use_winograd, int *output_unit, const ConvParameter *conv_param) {
if (conv_param->kernel_w_ == conv_param->kernel_h_ && conv_param->dilation_h_ == 1 && conv_param->dilation_w_ == 1 &&
conv_param->stride_h_ == 1 && conv_param->stride_w_ == 1) {
*output_unit = SelectOutputUnitFp16(conv_param);
if (*output_unit > 1) {
*use_winograd = true;
}
} else {
*use_winograd = false;
}
}
|
24b9041e60c32d2280175e8d933bdd1adb775c45
|
d84c7df450292867f8c7bb58d1507735479d746d
|
/tests/t111-vector.c
|
b5f742cd837c5a8005ed465c08a14c9b8905b830
|
[
"BSD-2-Clause",
"BSD-3-Clause"
] |
permissive
|
CEED/libCEED
|
c17e8b2f8e9ccfafc0505bb6db451e2f7cfed690
|
c6c10e0994b55ea1726a79024cd4c333c40de38a
|
refs/heads/main
| 2023-09-01T20:13:21.268643
| 2023-09-01T20:08:36
| 2023-09-01T20:08:36
| 113,349,904
| 167
| 54
|
BSD-2-Clause
| 2023-09-14T20:37:58
| 2017-12-06T17:57:40
|
C
|
UTF-8
|
C
| false
| false
| 781
|
c
|
t111-vector.c
|
/// @file
/// Test CeedVectorGetArray state counter
/// \test Test CeedVectorGetArray state counter
//TESTARGS(name="length 10") {ceed_resource} 10
//TESTARGS(name="length 0") {ceed_resource} 0
#include <ceed.h>
#include <stdlib.h>
int main(int argc, char **argv) {
Ceed ceed;
CeedVector x;
CeedInt len = 10;
CeedScalar *a, b[len];
CeedInit(argv[1], &ceed);
len = argc > 2 ? atoi(argv[2]) : len;
CeedVectorCreate(ceed, len, &x);
CeedVectorSetValue(x, 0.0);
// Two write accesses should generate an error
CeedVectorGetArray(x, CEED_MEM_HOST, &a);
CeedVectorSetArray(x, CEED_MEM_HOST, CEED_COPY_VALUES, b);
// LCOV_EXCL_START
CeedVectorRestoreArray(x, &a);
CeedVectorDestroy(&x);
CeedDestroy(&ceed);
return 0;
// LCOV_EXCL_STOP
}
|
32b619a5874227fb537ede0fdf4601f85e47c065
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/samd21/sam_d2x_asflib/common/services/ioport/sam/ioport_pio.h
|
f3005991df07e86eaa65d51995856b704d5c18f2
|
[
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 10,500
|
h
|
ioport_pio.h
|
/**
* \file
*
* \brief SAM architecture specific IOPORT service implementation header file.
*
* Copyright (c) 2012-2016 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* 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. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef IOPORT_SAM_H
#define IOPORT_SAM_H
#include <sysclk.h>
#define IOPORT_CREATE_PIN(port, pin) ((IOPORT_ ## port) * 32 + (pin))
#define IOPORT_BASE_ADDRESS (uintptr_t)PIOA
#define IOPORT_PIO_OFFSET ((uintptr_t)PIOB - (uintptr_t)PIOA)
#define IOPORT_PIOA 0
#define IOPORT_PIOB 1
#define IOPORT_PIOC 2
#define IOPORT_PIOD 3
#define IOPORT_PIOE 4
#define IOPORT_PIOF 5
/**
* \weakgroup ioport_group
* \section ioport_modes IOPORT Modes
*
* For details on these please see the SAM Manual.
*
* @{
*/
/** \name IOPORT Mode bit definitions */
/** @{ */
#define IOPORT_MODE_MUX_MASK (0x7 << 0) /*!< MUX bits mask */
#define IOPORT_MODE_MUX_BIT0 ( 1 << 0) /*!< MUX BIT0 mask */
#if SAM3N || SAM3S || SAM4S || SAM4E || SAM4N || SAM4C || SAM4CM || SAMG || SAM4CP || SAMV71 || SAMV70 || SAME70 || SAMS70
#define IOPORT_MODE_MUX_BIT1 ( 1 << 1) /*!< MUX BIT1 mask */
#endif
#define IOPORT_MODE_MUX_A ( 0 << 0) /*!< MUX function A */
#define IOPORT_MODE_MUX_B ( 1 << 0) /*!< MUX function B */
#if SAM3N || SAM3S || SAM4S || SAM4E || SAM4N || SAM4C || SAM4CM || SAMG || SAM4CP || SAMV71 || SAMV70 || SAME70 || SAMS70
#define IOPORT_MODE_MUX_C ( 2 << 0) /*!< MUX function C */
#define IOPORT_MODE_MUX_D ( 3 << 0) /*!< MUX function D */
#endif
#define IOPORT_MODE_PULLUP ( 1 << 3) /*!< Pull-up */
#if SAM3N || SAM3S || SAM4S || SAM4E || SAM4N || SAM4C || SAM4CM || SAMG || SAM4CP || SAMV71 || SAMV70 || SAME70 || SAMS70
#define IOPORT_MODE_PULLDOWN ( 1 << 4) /*!< Pull-down */
#endif
#define IOPORT_MODE_OPEN_DRAIN ( 1 << 5) /*!< Open drain */
#define IOPORT_MODE_GLITCH_FILTER ( 1 << 6) /*!< Glitch filter */
#define IOPORT_MODE_DEBOUNCE ( 1 << 7) /*!< Input debounce */
/** @} */
/** @} */
typedef uint32_t ioport_mode_t;
typedef uint32_t ioport_pin_t;
typedef uint32_t ioport_port_t;
typedef uint32_t ioport_port_mask_t;
__always_inline static ioport_port_t arch_ioport_pin_to_port_id(ioport_pin_t pin)
{
return pin >> 5;
}
__always_inline static Pio *arch_ioport_port_to_base(ioport_port_t port)
{
#if (SAM4C || SAM4CM || SAM4CP)
if (port == IOPORT_PIOC) {
return (Pio *)(uintptr_t)PIOC;
# ifdef ID_PIOD
} else if (port == IOPORT_PIOD) {
return (Pio *)(uintptr_t)PIOD;
# endif
} else {
return (Pio *)((uintptr_t)IOPORT_BASE_ADDRESS +
(IOPORT_PIO_OFFSET * port));
}
#else
return (Pio *)((uintptr_t)IOPORT_BASE_ADDRESS +
(IOPORT_PIO_OFFSET * port));
#endif
}
__always_inline static Pio *arch_ioport_pin_to_base(ioport_pin_t pin)
{
return arch_ioport_port_to_base(arch_ioport_pin_to_port_id(pin));
}
__always_inline static ioport_port_mask_t arch_ioport_pin_to_mask(ioport_pin_t pin)
{
return 1U << (pin & 0x1F);
}
__always_inline static void arch_ioport_init(void)
{
#ifdef ID_PIOA
sysclk_enable_peripheral_clock(ID_PIOA);
#endif
#ifdef ID_PIOB
sysclk_enable_peripheral_clock(ID_PIOB);
#endif
#ifdef ID_PIOC
sysclk_enable_peripheral_clock(ID_PIOC);
#endif
#ifdef ID_PIOD
sysclk_enable_peripheral_clock(ID_PIOD);
#endif
#ifdef ID_PIOE
sysclk_enable_peripheral_clock(ID_PIOE);
#endif
#ifdef ID_PIOF
sysclk_enable_peripheral_clock(ID_PIOF);
#endif
}
__always_inline static void arch_ioport_enable_port(ioport_port_t port,
ioport_port_mask_t mask)
{
arch_ioport_port_to_base(port)->PIO_PER = mask;
}
__always_inline static void arch_ioport_disable_port(ioport_port_t port,
ioport_port_mask_t mask)
{
arch_ioport_port_to_base(port)->PIO_PDR = mask;
}
__always_inline static void arch_ioport_enable_pin(ioport_pin_t pin)
{
arch_ioport_enable_port(arch_ioport_pin_to_port_id(pin),
arch_ioport_pin_to_mask(pin));
}
__always_inline static void arch_ioport_disable_pin(ioport_pin_t pin)
{
arch_ioport_disable_port(arch_ioport_pin_to_port_id(pin),
arch_ioport_pin_to_mask(pin));
}
__always_inline static void arch_ioport_set_port_mode(ioport_port_t port,
ioport_port_mask_t mask, ioport_mode_t mode)
{
Pio *base = arch_ioport_port_to_base(port);
if (mode & IOPORT_MODE_PULLUP) {
base->PIO_PUER = mask;
} else {
base->PIO_PUDR = mask;
}
#if defined(IOPORT_MODE_PULLDOWN)
if (mode & IOPORT_MODE_PULLDOWN) {
base->PIO_PPDER = mask;
} else {
base->PIO_PPDDR = mask;
}
#endif
if (mode & IOPORT_MODE_OPEN_DRAIN) {
base->PIO_MDER = mask;
} else {
base->PIO_MDDR = mask;
}
if (mode & (IOPORT_MODE_GLITCH_FILTER | IOPORT_MODE_DEBOUNCE)) {
base->PIO_IFER = mask;
} else {
base->PIO_IFDR = mask;
}
if (mode & IOPORT_MODE_DEBOUNCE) {
#if SAM3U || SAM3XA
base->PIO_DIFSR = mask;
#else
base->PIO_IFSCER = mask;
#endif
} else {
#if SAM3U || SAM3XA
base->PIO_SCIFSR = mask;
#else
base->PIO_IFSCDR = mask;
#endif
}
#if !defined(IOPORT_MODE_MUX_BIT1)
if (mode & IOPORT_MODE_MUX_BIT0) {
base->PIO_ABSR |= mask;
} else {
base->PIO_ABSR &= ~mask;
}
#else
if (mode & IOPORT_MODE_MUX_BIT0) {
base->PIO_ABCDSR[0] |= mask;
} else {
base->PIO_ABCDSR[0] &= ~mask;
}
if (mode & IOPORT_MODE_MUX_BIT1) {
base->PIO_ABCDSR[1] |= mask;
} else {
base->PIO_ABCDSR[1] &= ~mask;
}
#endif
}
__always_inline static void arch_ioport_set_pin_mode(ioport_pin_t pin,
ioport_mode_t mode)
{
arch_ioport_set_port_mode(arch_ioport_pin_to_port_id(pin),
arch_ioport_pin_to_mask(pin), mode);
}
__always_inline static void arch_ioport_set_port_dir(ioport_port_t port,
ioport_port_mask_t mask, enum ioport_direction group_direction)
{
Pio *base = arch_ioport_port_to_base(port);
if (group_direction == IOPORT_DIR_OUTPUT) {
base->PIO_OER = mask;
} else if (group_direction == IOPORT_DIR_INPUT) {
base->PIO_ODR = mask;
}
base->PIO_OWER = mask;
}
__always_inline static void arch_ioport_set_pin_dir(ioport_pin_t pin,
enum ioport_direction dir)
{
Pio *base = arch_ioport_pin_to_base(pin);
if (dir == IOPORT_DIR_OUTPUT) {
base->PIO_OER = arch_ioport_pin_to_mask(pin);
} else if (dir == IOPORT_DIR_INPUT) {
base->PIO_ODR = arch_ioport_pin_to_mask(pin);
}
base->PIO_OWER = arch_ioport_pin_to_mask(pin);
}
__always_inline static void arch_ioport_set_pin_level(ioport_pin_t pin,
bool level)
{
Pio *base = arch_ioport_pin_to_base(pin);
if (level) {
base->PIO_SODR = arch_ioport_pin_to_mask(pin);
} else {
base->PIO_CODR = arch_ioport_pin_to_mask(pin);
}
}
__always_inline static void arch_ioport_set_port_level(ioport_port_t port,
ioport_port_mask_t mask, enum ioport_value level)
{
Pio *base = arch_ioport_port_to_base(port);
if (level){
base->PIO_SODR = mask;
} else {
base->PIO_CODR = mask;
}
}
__always_inline static bool arch_ioport_get_pin_level(ioport_pin_t pin)
{
return arch_ioport_pin_to_base(pin)->PIO_PDSR & arch_ioport_pin_to_mask(pin);
}
__always_inline static ioport_port_mask_t arch_ioport_get_port_level(
ioport_port_t port, ioport_port_mask_t mask)
{
return arch_ioport_port_to_base(port)->PIO_PDSR & mask;
}
__always_inline static void arch_ioport_toggle_pin_level(ioport_pin_t pin)
{
Pio *port = arch_ioport_pin_to_base(pin);
ioport_port_mask_t mask = arch_ioport_pin_to_mask(pin);
if (port->PIO_PDSR & arch_ioport_pin_to_mask(pin)) {
port->PIO_CODR = mask;
} else {
port->PIO_SODR = mask;
}
}
__always_inline static void arch_ioport_toggle_port_level(ioport_port_t port,
ioport_port_mask_t mask)
{
arch_ioport_port_to_base(port)->PIO_ODSR ^= mask;
}
__always_inline static void arch_ioport_set_port_sense_mode(ioport_port_t port,
ioport_port_mask_t mask, enum ioport_sense pin_sense)
{
Pio *base = arch_ioport_port_to_base(port);
/* AIMMR ELSR FRLHSR
* 0 X X IOPORT_SENSE_BOTHEDGES (Default)
* 1 0 0 IOPORT_SENSE_FALLING
* 1 0 1 IOPORT_SENSE_RISING
* 1 1 0 IOPORT_SENSE_LEVEL_LOW
* 1 1 1 IOPORT_SENSE_LEVEL_HIGH
*/
switch(pin_sense) {
case IOPORT_SENSE_LEVEL_LOW:
base->PIO_LSR = mask;
base->PIO_FELLSR = mask;
break;
case IOPORT_SENSE_LEVEL_HIGH:
base->PIO_LSR = mask;
base->PIO_REHLSR = mask;
break;
case IOPORT_SENSE_FALLING:
base->PIO_ESR = mask;
base->PIO_FELLSR = mask;
break;
case IOPORT_SENSE_RISING:
base->PIO_ESR = mask;
base->PIO_REHLSR = mask;
break;
default:
base->PIO_AIMDR = mask;
return;
}
base->PIO_AIMER = mask;
}
__always_inline static void arch_ioport_set_pin_sense_mode(ioport_pin_t pin,
enum ioport_sense pin_sense)
{
arch_ioport_set_port_sense_mode(arch_ioport_pin_to_port_id(pin),
arch_ioport_pin_to_mask(pin), pin_sense);
}
#endif /* IOPORT_SAM_H */
|
0eb4931de61f660f068db3a159e9e27ab9520ab2
|
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
|
/lib/include/ppc_wrappers/bmi2intrin.h
|
0dc0d14ad480f9676757d9422b159d9b155d5b20
|
[
"MIT"
] |
permissive
|
ziglang/zig
|
4aa75d8d3bcc9e39bf61d265fd84b7f005623fc5
|
f4c9e19bc3213c2bc7e03d7b06d7129882f39f6c
|
refs/heads/master
| 2023-08-31T13:16:45.980913
| 2023-08-31T05:50:29
| 2023-08-31T05:50:29
| 40,276,274
| 25,560
| 2,399
|
MIT
| 2023-09-14T21:09:50
| 2015-08-06T00:51:28
|
Zig
|
UTF-8
|
C
| false
| false
| 4,671
|
h
|
bmi2intrin.h
|
/*===---- bmiintrin.h - Implementation of BMI2 intrinsics on PowerPC -------===
*
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
* See https://llvm.org/LICENSE.txt for license information.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
*===-----------------------------------------------------------------------===
*/
#if !defined X86GPRINTRIN_H_
#error "Never use <bmi2intrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef BMI2INTRIN_H_
#define BMI2INTRIN_H_
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_bzhi_u32(unsigned int __X, unsigned int __Y) {
return ((__X << (32 - __Y)) >> (32 - __Y));
}
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mulx_u32(unsigned int __X, unsigned int __Y, unsigned int *__P) {
unsigned long long __res = (unsigned long long)__X * __Y;
*__P = (unsigned int)(__res >> 32);
return (unsigned int)__res;
}
#ifdef __PPC64__
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_bzhi_u64(unsigned long long __X, unsigned long long __Y) {
return ((__X << (64 - __Y)) >> (64 - __Y));
}
/* __int128 requires base 64-bit. */
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mulx_u64(unsigned long long __X, unsigned long long __Y,
unsigned long long *__P) {
unsigned __int128 __res = (unsigned __int128)__X * __Y;
*__P = (unsigned long long)(__res >> 64);
return (unsigned long long)__res;
}
#ifdef _ARCH_PWR7
/* popcount and bpermd require power7 minimum. */
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_pdep_u64(unsigned long long __X, unsigned long long __M) {
unsigned long __result = 0x0UL;
const unsigned long __mask = 0x8000000000000000UL;
unsigned long __m = __M;
unsigned long __c, __t;
unsigned long __p;
/* The pop-count of the mask gives the number of the bits from
source to process. This is also needed to shift bits from the
source into the correct position for the result. */
__p = 64 - __builtin_popcountl(__M);
/* The loop is for the number of '1' bits in the mask and clearing
each mask bit as it is processed. */
while (__m != 0) {
__c = __builtin_clzl(__m);
__t = __X << (__p - __c);
__m ^= (__mask >> __c);
__result |= (__t & (__mask >> __c));
__p++;
}
return __result;
}
extern __inline unsigned long long
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_pext_u64(unsigned long long __X, unsigned long long __M) {
unsigned long __p = 0x4040404040404040UL; // initial bit permute control
const unsigned long __mask = 0x8000000000000000UL;
unsigned long __m = __M;
unsigned long __c;
unsigned long __result;
/* if the mask is constant and selects 8 bits or less we can use
the Power8 Bit permute instruction. */
if (__builtin_constant_p(__M) && (__builtin_popcountl(__M) <= 8)) {
/* Also if the pext mask is constant, then the popcount is
constant, we can evaluate the following loop at compile
time and use a constant bit permute vector. */
long __i;
for (__i = 0; __i < __builtin_popcountl(__M); __i++) {
__c = __builtin_clzl(__m);
__p = (__p << 8) | __c;
__m ^= (__mask >> __c);
}
__result = __builtin_bpermd(__p, __X);
} else {
__p = 64 - __builtin_popcountl(__M);
__result = 0;
/* We could a use a for loop here, but that combined with
-funroll-loops can expand to a lot of code. The while
loop avoids unrolling and the compiler commons the xor
from clearing the mask bit with the (m != 0) test. The
result is a more compact loop setup and body. */
while (__m != 0) {
unsigned long __t;
__c = __builtin_clzl(__m);
__t = (__X & (__mask >> __c)) >> (__p - __c);
__m ^= (__mask >> __c);
__result |= (__t);
__p++;
}
}
return __result;
}
/* these 32-bit implementations depend on 64-bit pdep/pext
which depend on _ARCH_PWR7. */
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_pdep_u32(unsigned int __X, unsigned int __Y) {
return _pdep_u64(__X, __Y);
}
extern __inline unsigned int
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_pext_u32(unsigned int __X, unsigned int __Y) {
return _pext_u64(__X, __Y);
}
#endif /* _ARCH_PWR7 */
#endif /* __PPC64__ */
#endif /* BMI2INTRIN_H_ */
|
1efa2fd292d5467af1d46d2e4883701aceae9ca6
|
76f7459a09acb9be2d52407132f5ff8955627da2
|
/frame/include/level0/bb/bli_scal2bbs_mxn.h
|
c4156713fee5feff4a6650f56c56fed6741c01ed
|
[
"BSD-3-Clause"
] |
permissive
|
flame/blis
|
448bc0ad139b726188129c5627c304274b41c3c1
|
6dcf7666eff14348e82fbc2750be4b199321e1b9
|
refs/heads/master
| 2023-09-01T14:56:11.920485
| 2023-08-27T19:18:57
| 2023-08-27T19:18:57
| 16,143,904
| 1,696
| 361
|
NOASSERTION
| 2023-08-27T19:18:58
| 2014-01-22T15:58:24
|
C
|
UTF-8
|
C
| false
| false
| 6,333
|
h
|
bli_scal2bbs_mxn.h
|
/*
BLIS
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2014, The University of Texas at Austin
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(s) of the copyright holder(s) 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
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BLIS_SCAL2BBS_MXN_H
#define BLIS_SCAL2BBS_MXN_H
// scal2bbs_mxn
#undef GENTFUNCRO
#define GENTFUNCRO( ctype, ch, opname ) \
\
BLIS_INLINE void PASTEMAC(ch,opname) \
( \
const conj_t conjx, \
const dim_t m, \
const dim_t n, \
ctype* restrict alpha, \
ctype* restrict x, const inc_t incx, const inc_t ldx, \
ctype* restrict y, const inc_t incy, const inc_t ldy \
) \
{ \
/* Assume that the duplication factor is the row stride of y. */ \
const dim_t d = incy; \
const dim_t ds_y = 1; \
\
if ( bli_is_conj( conjx ) ) \
{ \
for ( dim_t j = 0; j < n; ++j ) \
{ \
ctype* restrict xj = x + j*ldx; \
ctype* restrict yj = y + j*ldy; \
\
for ( dim_t i = 0; i < m; ++i ) \
{ \
ctype* restrict xij = xj + i*incx; \
ctype* restrict yij = yj + i*incy; \
\
PASTEMAC(ch,scal2js)( *alpha, *xij, *yij ); \
\
for ( dim_t p = 1; p < d; ++p ) \
{ \
ctype* restrict yijd = yij + p*ds_y; \
\
PASTEMAC(ch,copys)( *yij, *yijd ); \
} \
} \
} \
} \
else /* if ( bli_is_noconj( conjx ) ) */ \
{ \
for ( dim_t j = 0; j < n; ++j ) \
{ \
ctype* restrict xj = x + j*ldx; \
ctype* restrict yj = y + j*ldy; \
\
for ( dim_t i = 0; i < m; ++i ) \
{ \
ctype* restrict xij = xj + i*incx; \
ctype* restrict yij = yj + i*incy; \
\
PASTEMAC(ch,scal2s)( *alpha, *xij, *yij ); \
\
for ( dim_t p = 1; p < d; ++p ) \
{ \
ctype* restrict yijd = yij + p*ds_y; \
\
PASTEMAC(ch,copys)( *yij, *yijd ); \
} \
} \
} \
} \
}
INSERT_GENTFUNCRO_BASIC( scal2bbs_mxn )
#undef GENTFUNCCO
#define GENTFUNCCO( ctype, ctype_r, ch, chr, opname ) \
\
BLIS_INLINE void PASTEMAC(ch,opname) \
( \
const conj_t conjx, \
const dim_t m, \
const dim_t n, \
ctype* restrict alpha, \
ctype* restrict x, const inc_t incx, const inc_t ldx, \
ctype* restrict y, const inc_t incy, const inc_t ldy \
) \
{ \
/* Assume that the duplication factor is the row stride of y. */ \
const dim_t d = incy; \
const dim_t ds_y = 1; \
\
const inc_t incx2 = 2 * incx; \
const inc_t ldx2 = 2 * ldx; \
\
const inc_t incy2 = 2 * incy; \
const inc_t ldy2 = 2 * ldy; \
\
ctype_r* restrict alpha_r = ( ctype_r* )alpha; \
ctype_r* restrict alpha_i = ( ctype_r* )alpha + 1; \
ctype_r* restrict chi_r = ( ctype_r* )x; \
ctype_r* restrict chi_i = ( ctype_r* )x + 1; \
ctype_r* restrict psi_r = ( ctype_r* )y; \
ctype_r* restrict psi_i = ( ctype_r* )y + 1*d; \
\
if ( bli_is_conj( conjx ) ) \
{ \
for ( dim_t j = 0; j < n; ++j ) \
{ \
ctype_r* restrict chij_r = chi_r + j*ldx2; \
ctype_r* restrict chij_i = chi_i + j*ldx2; \
ctype_r* restrict psij_r = psi_r + j*ldy2; \
ctype_r* restrict psij_i = psi_i + j*ldy2; \
\
for ( dim_t i = 0; i < m; ++i ) \
{ \
ctype_r* restrict chiij_r = chij_r + i*incx2; \
ctype_r* restrict chiij_i = chij_i + i*incx2; \
ctype_r* restrict psiij_r = psij_r + i*incy2; \
ctype_r* restrict psiij_i = psij_i + i*incy2; \
\
PASTEMAC(ch,scal2jris)( *alpha_r, *alpha_i, \
*chiij_r, *chiij_i, \
*psiij_r, *psiij_i ); \
\
for ( dim_t p = 1; p < d; ++p ) \
{ \
ctype_r* restrict psiijd_r = psiij_r + p*ds_y; \
ctype_r* restrict psiijd_i = psiij_i + p*ds_y; \
\
PASTEMAC(ch,copyris)( *psiij_r, *psiij_i, \
*psiijd_r, *psiijd_i ); \
} \
} \
} \
} \
else /* if ( bli_is_noconj( conjx ) ) */ \
{ \
for ( dim_t j = 0; j < n; ++j ) \
{ \
ctype_r* restrict chij_r = chi_r + j*ldx2; \
ctype_r* restrict chij_i = chi_i + j*ldx2; \
ctype_r* restrict psij_r = psi_r + j*ldy2; \
ctype_r* restrict psij_i = psi_i + j*ldy2; \
\
for ( dim_t i = 0; i < m; ++i ) \
{ \
ctype_r* restrict chiij_r = chij_r + i*incx2; \
ctype_r* restrict chiij_i = chij_i + i*incx2; \
ctype_r* restrict psiij_r = psij_r + i*incy2; \
ctype_r* restrict psiij_i = psij_i + i*incy2; \
\
PASTEMAC(ch,scal2ris)( *alpha_r, *alpha_i, \
*chiij_r, *chiij_i, \
*psiij_r, *psiij_i ); \
\
for ( dim_t p = 1; p < d; ++p ) \
{ \
ctype_r* restrict psiijd_r = psiij_r + p*ds_y; \
ctype_r* restrict psiijd_i = psiij_i + p*ds_y; \
\
PASTEMAC(ch,copyris)( *psiij_r, *psiij_i, \
*psiijd_r, *psiijd_i ); \
} \
} \
} \
} \
}
INSERT_GENTFUNCCO( scal2bbs_mxn )
#endif
|
4b34cb10fd7587f0a53029a0dd32d7d717ab5be1
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/net/libfabric/files/patch-prov_rxm_src_rxm__domain.c
|
f631f8233700ecacda34586515720b9e14c0ed9b
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 918
|
c
|
patch-prov_rxm_src_rxm__domain.c
|
--- prov/rxm/src/rxm_domain.c.orig 2022-04-30 21:46:32 UTC
+++ prov/rxm/src/rxm_domain.c
@@ -567,7 +621,7 @@ static struct fi_ops_mr rxm_domain_mr_thru_ops = {
.regattr = rxm_mr_regattr_thru,
};
-static ssize_t rxm_send_credits(struct fid_ep *ep, size_t credits)
+static ssize_t rxm_send_credits(struct fid_ep *ep, uint64_t credits)
{
struct rxm_conn *rxm_conn = ep->fid.context;
struct rxm_ep *rxm_ep = rxm_conn->ep;
@@ -620,11 +674,11 @@ defer:
return FI_SUCCESS;
}
-static void rxm_no_add_credits(struct fid_ep *ep_fid, size_t credits)
+static void rxm_no_add_credits(struct fid_ep *ep_fid, uint64_t credits)
{ }
static void rxm_no_credit_handler(struct fid_domain *domain_fid,
- ssize_t (*credit_handler)(struct fid_ep *ep, size_t credits))
+ ssize_t (*credit_handler)(struct fid_ep *ep, uint64_t credits))
{ }
static int rxm_no_enable_flow_ctrl(struct fid_ep *ep_fid, uint64_t threshold)
|
36f1c769926407ac7f2a9ee64f538db8ba91820d
|
96df46515663aee49a753171fb3b07d74c8ef72f
|
/bindgen-tests/tests/headers/dynamic_loading_required.h
|
f9861e84ebd3c9d279c9dcb3abcaaa5ebcdcc2ef
|
[
"BSD-3-Clause"
] |
permissive
|
rust-lang/rust-bindgen
|
05273ad4d385ce0b5a2315859f8c7c453c150db6
|
820ca42982fe77d5504f7a0534a3de6db6a1d703
|
refs/heads/main
| 2023-08-30T19:59:33.017994
| 2023-08-15T18:01:02
| 2023-08-15T18:01:02
| 61,728,459
| 2,874
| 391
|
BSD-3-Clause
| 2023-09-12T20:32:46
| 2016-06-22T15:05:51
|
Rust
|
UTF-8
|
C
| false
| false
| 124
|
h
|
dynamic_loading_required.h
|
// bindgen-flags: --dynamic-loading TestLib --dynamic-link-require-all
int foo(int x, int y);
int bar(void *x);
int baz();
|
88470f5c109e97f1621e9e55ff14dda91d70ffc7
|
ecce427678ecff2a93a47f3b1b664202c7d27617
|
/levels/ttm/areas/1/6/2.inc.c
|
e898bceaef3a600c54420d9cbfed851d453dc14a
|
[] |
no_license
|
sm64pc/sm64ex
|
ecf37f31b3f7426c4874254660d856030d789714
|
54cd27ccee45a2403b45f07a00d6043c51149969
|
refs/heads/nightly
| 2023-08-11T12:14:34.424168
| 2023-07-01T11:45:50
| 2023-07-01T11:45:50
| 262,091,731
| 795
| 238
| null | 2023-07-01T11:45:51
| 2020-05-07T15:43:27
|
C
|
UTF-8
|
C
| false
| false
| 2,145
|
c
|
2.inc.c
|
// 0x0700BB30 - 0x0700BB48
static const Lights1 ttm_seg7_lights_0700BB30 = gdSPDefLights1(
0x4c, 0x4c, 0x4c,
0x99, 0x99, 0x99, 0x28, 0x28, 0x28
);
// 0x0700BB48 - 0x0700BBA8
static const Vtx ttm_seg7_vertex_0700BB48[] = {
{{{ -13, -1627, 28}, 0, { 990, 990}, {0xd3, 0x00, 0x76, 0xff}}},
{{{ -28, 1580, -57}, 0, { 510, 0}, {0xaf, 0x00, 0x9f, 0xff}}},
{{{ -28, -1627, -57}, 0, { 510, 990}, {0xaf, 0x00, 0x9f, 0xff}}},
{{{ -13, 1580, 28}, 0, { 990, 0}, {0xd3, 0x00, 0x76, 0xff}}},
{{{ 56, -1627, -26}, 0, { 0, 990}, {0x61, 0x00, 0xaf, 0xff}}},
{{{ 56, 1580, -26}, 0, { 0, 0}, {0x75, 0x00, 0x2f, 0xff}}},
};
// 0x0700BBA8 - 0x0700BC10
static const Gfx ttm_seg7_dl_0700BBA8[] = {
gsDPSetTextureImage(G_IM_FMT_IA, G_IM_SIZ_16b, 1, ttm_seg7_texture_07000000),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
gsSPLight(&ttm_seg7_lights_0700BB30.l, 1),
gsSPLight(&ttm_seg7_lights_0700BB30.a, 2),
gsSPVertex(ttm_seg7_vertex_0700BB48, 6, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 3, 1, 0x0),
gsSP2Triangles( 2, 1, 4, 0x0, 1, 5, 4, 0x0),
gsSP2Triangles( 4, 5, 0, 0x0, 5, 3, 0, 0x0),
gsSPEndDisplayList(),
};
// 0x0700BC10 - 0x0700BC70
const Gfx ttm_seg7_dl_0700BC10[] = {
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_MODULATEIA, G_CC_MODULATEIA),
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 8, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, 5, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (32 - 1) << G_TEXTURE_IMAGE_FRAC, (32 - 1) << G_TEXTURE_IMAGE_FRAC),
gsSPDisplayList(ttm_seg7_dl_0700BBA8),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF),
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
gsSPEndDisplayList(),
};
|
03a26b50abbfc2f31277245ceedaade6e6d5b33f
|
0ab34cafb4fce823bdb64588375a5e0320c4d5da
|
/src/profiler/configuration.c
|
26d139863b400f1fef4e71354f7314d7fd22a7d2
|
[
"Artistic-2.0",
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-public-domain"
] |
permissive
|
MoarVM/MoarVM
|
00eb8de04ef3eb43d8dd108a016a5fbd644f7cb7
|
2f8234c222dea886da28a9e369e34f3cff18ad8a
|
refs/heads/main
| 2023-08-24T03:30:58.906341
| 2023-08-23T03:28:20
| 2023-08-23T03:28:20
| 10,411,154
| 616
| 228
|
NOASSERTION
| 2023-08-23T03:28:33
| 2013-05-31T19:02:30
|
C
|
UTF-8
|
C
| false
| false
| 44,833
|
c
|
configuration.c
|
#include "moar.h"
/* This file contains the "confprog" validator and interpreter.
*
* It is there to allow users to give specific behaviour to a few internal
* systems of moarvm.
*
* At the start, it's for configuring for what static frames (or frames)
* the profiler should start profiling (if it isn't already profiling), and
* for configuring when the heap snapshot profiler should take a snapshot
*
* There is a Perl 6 module that offers a confprog compiler named
* App::MoarVM::ConfprogCompiler, and nqp's src/vm/moar/HLL/Backend.nqp
* has a corresponding loader. The nqp and perl6 commandline programs
* recognize a --confprog flag.
*/
#define CONFPROG_UNUSED_ENTRYPOINT 1
#define OUTPUT_LOTS_OF_JUNK 0
#if OUTPUT_LOTS_OF_JUNK
#define junkprint fprintf
#else
#define junkprint(fh, str, ...) do { } while (0)
#endif
#define CONFPROG_DEBUG_LEVEL_BARE 1
#define CONFPROG_DEBUG_LEVEL_TRACE 2
// see src/profiler/log.c for the define for debug level 4, which is PROFILER_RESULTS
static void debugprint(MVMuint8 active, MVMThreadContext *tc, const char *str, ...) {
va_list args;
va_start(args, str);
if (active) {
fprintf(stderr, "%p: ", tc);
vfprintf(stderr, str, args);
fprintf(stderr, "\n");
}
va_end(args);
}
#define DEBUG_LVL(level) ((debug_level) & CONFPROG_DEBUG_LEVEL_ ## level)
enum {
StructSel_Nothing,
StructSel_Root,
StructSel_MVMStaticFrame,
StructSel_MVMFrame,
StructSel_MVMCompUnit,
};
enum {
FieldSel_staticframe,
FieldSel_frame,
};
typedef struct {
MVMConfigurationProgram *confprog;
MVMuint8 *bytecode_root;
MVMuint8 *bc_pointer;
MVMuint32 jumptarget_count;
MVMuint32 *jumptarget_queue;
MVMuint16 register_count;
MVMuint16 register_alloc;
MVMuint8 *register_types;
const MVMOpInfo *cur_op;
const MVMOpInfo *prev_op;
MVMuint8 *prev_op_bc;
MVMuint8 selected_struct_source;
} validatorstate;
typedef union CPRegister {
MVMObject *o;
MVMString *s;
void *any;
MVMint8 i8;
MVMuint8 u8;
MVMint16 i16;
MVMuint16 u16;
MVMint32 i32;
MVMuint32 u32;
MVMint64 i64;
MVMuint64 u64;
MVMnum32 n32;
MVMnum64 n64;
} CPRegister;
/* special "fake" registers for the program that have very specific
* use cases for some select ops */
#define REGISTER_STRUCT_SELECT 0
#define REGISTER_STRUCT_ACCUMULATOR 1
#define REGISTER_FEATURE_TOGGLE 2
static MVMuint8 operand_size(MVMThreadContext *tc, MVMuint8 operand) {
MVMuint32 type = operand & MVM_operand_type_mask;
MVMuint32 kind = operand & MVM_operand_rw_mask;
MVMuint32 size;
if (kind == MVM_operand_literal) {
switch (type) {
case MVM_operand_int8: size = 1; break;
case MVM_operand_int16: size = 2; break;
case MVM_operand_int32: size = 4; break;
case MVM_operand_int64: size = 8; break;
case MVM_operand_num32: size = 4; break;
case MVM_operand_num64: size = 8; break;
case MVM_operand_callsite: size = 2; break;
case MVM_operand_coderef: size = 2; break;
case MVM_operand_str: size = 4; break;
case MVM_operand_ins: size = 4; break;
case MVM_operand_obj:
case MVM_operand_type_var:
MVM_exception_throw_adhoc(tc, "TODO: object or type var operands not allowed for literal");
/*fail(val, MSG(val, "operand type %"PRIu32" can't be a literal"), type);*/
default:
MVM_exception_throw_adhoc(tc, "TODO: unknown operand type");
/*fail(val, MSG(val, "unknown operand type %"PRIu32), type);*/
}
}
else if (kind == MVM_operand_read_reg || kind == MVM_operand_write_reg) {
switch (type) {
case MVM_operand_int8: size = 2; break;
case MVM_operand_int16: size = 2; break;
case MVM_operand_int32: size = 2; break;
case MVM_operand_int64: size = 2; break;
case MVM_operand_num32: size = 2; break;
case MVM_operand_num64: size = 2; break;
case MVM_operand_callsite: size = 2; break;
case MVM_operand_coderef: size = 2; break;
case MVM_operand_str: size = 2; break;
case MVM_operand_ins: size = 2; break;
case MVM_operand_obj:
case MVM_operand_type_var: size = 2; break;
default:
MVM_exception_throw_adhoc(tc, "TODO: unknown operand type");
/*fail(val, MSG(val, "unknown operand type %"PRIu32), type);*/
}
}
else {
MVM_exception_throw_adhoc(tc, "TODO: lexical operands NYI");
}
return size;
}
static void validate_reg_operand(MVMThreadContext *tc, validatorstate *state, MVMuint16 operand_idx, MVMuint8 operand) {
MVMuint8 size = operand_size(tc, operand);
MVMuint16 reg_num = *((MVMuint16 *)state->bc_pointer);
if (reg_num > state->register_alloc) {
MVMuint16 old_register_alloc = state->register_alloc;
state->register_alloc = (reg_num | 0x7) + 1;
state->register_types = MVM_recalloc(state->register_types, old_register_alloc, state->register_alloc);
}
junkprint(stderr, "encountered register operand of op %s for reg_num %d, current register count %d\n", state->cur_op->name, reg_num, state->register_count);
if (reg_num > state->register_count) {
state->register_count = reg_num + 1;
state->register_types[reg_num] = (operand << 1) | 1;
}
else {
if (state->register_types[reg_num] != ((operand << 1) | 1)) {
junkprint(stderr, "Invalid operand write; type of register %d was already seen as %d before, now supposed to be %d\n", reg_num, state->register_types[reg_num] >> 1, operand);
/*MVM_exception_throw_adhoc(tc, "Invalid operand write; type was already seen as %d before, now supposed to be %d", state->register_types[reg_num] >> 1, operand);*/
}
}
state->bc_pointer += size;
}
static void validate_literal_operand(MVMThreadContext *tc, validatorstate *state, MVMuint16 operand_idx, MVMuint8 operand) {
MVMuint8 size = operand_size(tc, operand);
state->bc_pointer += size;
}
static void validate_operand(MVMThreadContext *tc, validatorstate *state, MVMuint16 operand_idx, MVMuint8 operand) {
MVMuint8 rw = operand & MVM_operand_rw_mask;
switch (rw) {
case MVM_operand_literal:
validate_literal_operand(tc, state, operand_idx, operand);
break;
case MVM_operand_read_reg:
case MVM_operand_write_reg:
validate_reg_operand(tc, state, operand_idx, operand);
break;
default:
MVM_exception_throw_adhoc(tc, "TODO: invalid instruction rw flag");
/*fail(val, MSG(val, "invalid instruction rw flag %"PRIu32), rw);*/
}
}
static void validate_operands(MVMThreadContext *tc, validatorstate *state) {
const MVMuint8 *operands = state->cur_op->operands;
int i = 0;
for (i = 0; i < state->cur_op->num_operands; i++) {
validate_operand(tc, state, i, operands[i]);
}
}
static void validate_op(MVMThreadContext *tc, validatorstate *state) {
MVMuint16 opcode = *((MVMuint16 *)state->bc_pointer);
const MVMOpInfo *info;
MVMuint8 *prev_op_bc_ptr = state->bc_pointer;
junkprint(stderr, "validate op at %lx\n", state->bc_pointer - state->bytecode_root);
if (!MVM_op_is_allowed_in_confprog(opcode)) {
/*MVMuint16 op;*/
/*for (op = 0; op < 916; op++) {*/
/*if (MVM_op_is_allowed_in_confprog(op)) {*/
/*junkprint(stderr, "op %s (%d) is allowed\n", MVM_op_get_op(op)->name, op);*/
/*}*/
/*}*/
/* Sigh, so, pointer differences are ptrdiff_t, and (at least on some 32
* bit platforms) that's `int`,
* (even though on those platforms sizeof(int) == sizeof(long))
* and so compilers warn about format string mismatch.
* And sigh again, it's not until C11 that we get %tx to specify the
* size as that of ptrdiff_t, so we can't rely on on that here.
* So cast to unsigned long. */
MVM_exception_throw_adhoc(tc, "Invalid opcode detected in confprog: %d (%s) at position 0x%lx",
opcode, MVM_op_get_op(opcode)->name, (unsigned long) (state->bc_pointer - state->bytecode_root));
}
info = MVM_op_get_op(opcode);
if (!info)
MVM_exception_throw_adhoc(tc, "Invalid opcode detected in confprog: %d at position 0x%lx",
opcode, (unsigned long) (state->bc_pointer - state->bytecode_root));
state->prev_op = state->cur_op;
state->cur_op = info;
state->bc_pointer += 2;
/* const_s into the STRUCT_SELECT fake register influences how getattr
* behaves (a terrible hack, really), so we check what it does.
*
* Also, in this case it will turn into a const_i64_16 instead. To fill
* up empty space we put a no-op in front
*/
if (opcode == MVM_OP_const_s) {
MVMuint16 reg_num = *((MVMuint16 *)state->bc_pointer);
MVMuint32 string_idx;
validate_operand(tc, state, 0, state->cur_op->operands[0]);
string_idx = *((MVMuint32 *)state->bc_pointer);
validate_operand(tc, state, 1, state->cur_op->operands[1]);
junkprint(stderr, "after validating const_s, %x, before %x, diff %x\n", state->bc_pointer, prev_op_bc_ptr, state->bc_pointer - prev_op_bc_ptr);
if (reg_num == REGISTER_STRUCT_SELECT) {
MVMObject *string_at_position = (MVMObject *)MVM_repr_at_pos_s(tc, state->confprog->string_heap, string_idx);
MVMuint64 string_length;
if (MVM_is_null(tc, string_at_position)) {
MVM_exception_throw_adhoc(tc, "Invalid string put into STRUCT_SELECT register: index %d\n",
string_idx);
}
string_length = MVM_string_graphs(tc, (MVMString *)string_at_position);
switch (string_length) {
case 0:
state->selected_struct_source = StructSel_Root;
junkprint(stderr, "next getattr will operate on 'root' namespace\n");
break;
case 8:
/* TODO string comparison */
state->selected_struct_source = StructSel_MVMFrame;
junkprint(stderr, "next getattr will operate on an MVMFrame\n");
break;
case 11:
/* TODO string comparison */
state->selected_struct_source = StructSel_MVMCompUnit;
junkprint(stderr, "next getattr will operate on an MVMCompUnit\n");
break;
case 14:
/* TODO string comparison */
state->selected_struct_source = StructSel_MVMStaticFrame;
junkprint(stderr, "next getattr will operate on an MVMStaticFrame\n");
break;
default:
MVM_exception_throw_adhoc(tc, "STRUCT_SELECT string length %"PRIu64" (index %d) NYI or something", string_length, string_idx);
}
/* Now do a rewrite of const_s into const_i64_16 and noop */
*((MVMuint16 *)(prev_op_bc_ptr)) = MVM_OP_no_op;
*((MVMuint16 *)(prev_op_bc_ptr + 2)) = MVM_OP_const_i64_16;
*((MVMuint16 *)(prev_op_bc_ptr + 4)) = REGISTER_STRUCT_SELECT;
*((MVMuint16 *)(prev_op_bc_ptr + 6)) = state->selected_struct_source;
state->bc_pointer = prev_op_bc_ptr;
return;
}
}
else if (opcode == MVM_OP_getattr_o) {
MVMuint8 selected_struct_source = state->selected_struct_source;
MVMuint16 source_reg_num;
MVMuint32 string_idx;
MVMuint16 *hintptr;
validate_operand(tc, state, 0, state->cur_op->operands[0]);
source_reg_num = *((MVMuint16 *)state->bc_pointer);
validate_operand(tc, state, 1, state->cur_op->operands[1]);
validate_operand(tc, state, 2, state->cur_op->operands[2]);
string_idx = *((MVMuint32 *)state->bc_pointer);
validate_operand(tc, state, 3, state->cur_op->operands[3]);
hintptr = (MVMuint16 *)state->bc_pointer;
validate_operand(tc, state, 4, state->cur_op->operands[4]);
junkprint(stderr, "currently on %d struct source, string index is %d\n", selected_struct_source, string_idx);
if (source_reg_num == REGISTER_STRUCT_ACCUMULATOR) {
MVMObject *string_at_position = (MVMObject *)MVM_repr_at_pos_s(tc, state->confprog->string_heap, string_idx);
MVMuint64 string_length = MVM_string_graphs(tc, (MVMString *)string_at_position);
/* Special "fake" getattr */
if (selected_struct_source == StructSel_Root) {
junkprint(stderr, "hint pointer will select a root struct entry\n");
/* staticframe; TODO string comparison */
if (string_length == 11) { /* staticframe */
*hintptr = FieldSel_staticframe;
}
else if (string_length == 5) { /* frame */
*hintptr = FieldSel_frame;
}
}
else if (selected_struct_source == StructSel_MVMStaticFrame) {
if (string_length == 2) { /* cu */
*hintptr = offsetof(MVMStaticFrame, body.cu);
}
else if (string_length == 4) { /* name */
*hintptr = offsetof(MVMStaticFrame, body.name);
}
else if (string_length == 5) { /* cuuid, outer */
if (MVM_string_ord_at(tc, (MVMString *)string_at_position, 0) == 'c') {
*hintptr = offsetof(MVMStaticFrame, body.cuuid);
}
else if (MVM_string_ord_at(tc, (MVMString *)string_at_position, 0) == 'o') {
*hintptr = offsetof(MVMStaticFrame, body.outer);
}
else {
MVM_exception_throw_adhoc(tc, "STRUCT_SELECT string NYI or something");
}
}
else {
MVM_exception_throw_adhoc(tc, "STRUCT_SELECT is MVMStaticFrame, no field with length %"PRIu64" (string heap index %d) implemented", string_length, string_idx);
}
}
else if (selected_struct_source == StructSel_MVMCompUnit) {
if (string_length == 8) { /* filename or hll_name */
if (MVM_string_ord_at(tc, (MVMString *)string_at_position, 0) == 'f') {
*hintptr = offsetof(MVMCompUnit, body.filename);
}
else if (MVM_string_ord_at(tc, (MVMString *)string_at_position, 0) == 'h') {
*hintptr = offsetof(MVMCompUnit, body.hll_name);
}
else {
MVM_exception_throw_adhoc(tc, "STRUCT_SELECT is MVMCompUnit, no field with length %"PRIu64" (string heap index %d) implemented", string_length, string_idx);
}
}
}
junkprint(stderr, "set hint pointer value to %d\n", *hintptr);
}
else {
/* Totally regular getattr call */
}
state->selected_struct_source = StructSel_Nothing;
}
else if (opcode == MVM_OP_getcodelocation) {
MVMuint16 new_opcode;
const MVMOpInfo *new_info;
validate_operand(tc, state, 0, state->cur_op->operands[0]);
validate_operand(tc, state, 1, state->cur_op->operands[1]);
new_opcode = *((MVMuint16 *)state->bc_pointer);
state->bc_pointer += 2;
new_info = MVM_op_get_op(new_opcode);
if (!new_info)
MVM_exception_throw_adhoc(tc, "Invalid opcode detected in confprog: %d at position 0x%lx",
opcode, (unsigned long) (state->bc_pointer - state->bytecode_root));
state->prev_op = state->cur_op;
state->cur_op = new_info;
if (new_opcode == MVM_OP_unbox_s) {
validate_operand(tc, state, 0, state->cur_op->operands[0]);
validate_operand(tc, state, 1, state->cur_op->operands[1]);
}
else if (new_opcode == MVM_OP_unbox_i) {
validate_operand(tc, state, 0, state->cur_op->operands[0]);
validate_operand(tc, state, 1, state->cur_op->operands[1]);
}
else {
MVM_exception_throw_adhoc(tc, "Confprog: invalid opcode %s followed getcodelocation; only unbox_s and unbox_i are allowed.", MVM_op_get_op(new_opcode)->name);
}
}
else {
validate_operands(tc, state);
}
state->prev_op_bc = prev_op_bc_ptr;
}
void MVM_confprog_validate(MVMThreadContext *tc, MVMConfigurationProgram *prog) {
validatorstate state;
state.confprog = prog;
state.bytecode_root = prog->bytecode;
state.bc_pointer = prog->bytecode;
state.prev_op_bc = prog->bytecode;
state.jumptarget_count = 0;
state.jumptarget_queue = NULL;
state.register_count = 3;
state.register_alloc = 4;
state.register_types = MVM_calloc(4, 1);
state.register_types[0] = 117;
state.register_types[1] = 21;
state.register_types[2] = 117;
state.cur_op = NULL;
state.prev_op = NULL;
state.selected_struct_source = 0;
junkprint(stderr, "going to validate program\n");
while (state.bc_pointer < state.bytecode_root + prog->bytecode_length) {
junkprint(stderr, "\nvalidating bytecode at position 0x%x\n", state.bc_pointer - state.bytecode_root);
validate_op(tc, &state);
}
prog->reg_types = state.register_types;
prog->reg_count = state.register_count;
}
#define CHECK_CONC(obj, type, purpose) do { if (MVM_UNLIKELY(MVM_is_null(tc, obj) == 1 || IS_CONCRETE((MVMObject *)(obj)) == 0 || REPR((MVMObject *)(obj))->ID != MVM_REPR_ID_ ## type)) { error_concreteness(tc, (MVMObject *)(obj), MVM_REPR_ID_ ## type, purpose); } } while (0)
static void error_concreteness(MVMThreadContext *tc, MVMObject *object, MVMuint16 reprid, char *purpose) {
if (!object)
MVM_exception_throw_adhoc(tc, "installconfprog requires a %s for %s (got null instead)",
MVM_repr_get_by_id(tc, reprid)->name, purpose);
if (REPR(object)-> ID != reprid)
MVM_exception_throw_adhoc(tc, "installconfprog requires a %s for %s (got a %s of type %s instead)",
MVM_repr_get_by_id(tc, reprid)->name, purpose, REPR(object)->name, MVM_6model_get_debug_name(tc, object));
else
MVM_exception_throw_adhoc(tc, "installconfprog requires a concrete %s for %s (got a type objecd %s (a %s) instead)",
MVM_repr_get_by_id(tc, reprid)->name, purpose, MVM_6model_get_debug_name(tc, object), REPR(object)->name);
}
static MVMint16 stats_position_for_value(MVMThreadContext *tc, MVMuint8 entrypoint, MVMuint64 return_value) {
switch (entrypoint) {
case MVM_PROGRAM_ENTRYPOINT_PROFILER_STATIC:
if (return_value == MVM_CONFPROG_SF_RESULT_TO_BE_DETERMINED
|| return_value == MVM_CONFPROG_SF_RESULT_NEVER
|| return_value == MVM_CONFPROG_SF_RESULT_DYNAMIC_SUGGEST_NO
|| return_value == MVM_CONFPROG_SF_RESULT_DYNAMIC_SUGGEST_YES
|| return_value == MVM_CONFPROG_SF_RESULT_ALWAYS
) {
return return_value;
}
if (tc)
MVM_exception_throw_adhoc(tc, "Can't get stats for out-of-bounds entrypoint number %d", entrypoint);
return -1;
case MVM_PROGRAM_ENTRYPOINT_PROFILER_DYNAMIC:
if (return_value == 0 || return_value == 1)
return MVM_CONFPROG_SF_RESULT_ALWAYS + 1 + return_value;
MVM_exception_throw_adhoc(tc, "Can't get stats for out-of-bounds value %"PRIu64" for dynamic profiler entrypoint", return_value);
return -1;
case MVM_PROGRAM_ENTRYPOINT_HEAPSNAPSHOT:
if (return_value <= 2)
return MVM_CONFPROG_SF_RESULT_ALWAYS + 1 + 1 + 1 + return_value;
MVM_exception_throw_adhoc(tc, "Can't get stats for out-of-bounds value %"PRIu64" for heapsnapshot entrypoint", return_value);
return -1;
default:
if (tc)
MVM_exception_throw_adhoc(tc, "Can't get stats for out-of-bounds entrypoint number %d", entrypoint);
return -1;
}
}
void MVM_confprog_install(MVMThreadContext *tc, MVMObject *bytecode, MVMObject *string_array, MVMObject *entrypoints) {
MVMuint64 bytecode_size;
MVMuint8 *array_contents;
MVMConfigurationProgram *confprog;
MVMint16 entrypoint_array[MVM_PROGRAM_ENTRYPOINT_COUNT];
MVMuint8 debug_level = getenv("MVM_CONFPROG_DEBUG") != NULL ? atoi(getenv("MVM_CONFPROG_DEBUG")) : 0;
CHECK_CONC(bytecode, VMArray, "the bytecode");
CHECK_CONC(string_array, VMArray, "the string heap");
CHECK_CONC(entrypoints, VMArray, "the entrypoints list");
{
MVMObject *arr = bytecode;
MVMArrayREPRData *reprdata = (MVMArrayREPRData *)STABLE(arr)->REPR_data;
if (reprdata->slot_type != MVM_ARRAY_U8) {
MVM_exception_throw_adhoc(tc, "installconfprog requires the bytecode array to be a native array of uint8 (got a %s)",
MVM_6model_get_debug_name(tc, bytecode));
}
bytecode_size = MVM_repr_elems(tc, bytecode);
junkprint(stderr, "got a bytecode array with %d (%x) entries\n", bytecode_size, bytecode_size);
if (bytecode_size % 2 == 1) {
MVM_exception_throw_adhoc(tc, "installconfprog expected bytecode array to be a multiple of 2 bytes big (got a %"PRIu64")",
bytecode_size);
}
if (bytecode_size > 4096) {
MVM_exception_throw_adhoc(tc, "confprog too big. maximum 4096, this one has %"PRIu64"", bytecode_size);
}
array_contents = ((MVMArray *)bytecode)->body.slots.u8;
}
{
MVMObject *arr = string_array;
MVMArrayREPRData *reprdata = (MVMArrayREPRData *)STABLE(arr)->REPR_data;
if (reprdata->slot_type != MVM_ARRAY_STR) {
MVM_exception_throw_adhoc(tc, "installconfprog requires the string heap array to be a native array of strings (got a %s)",
MVM_6model_get_debug_name(tc, bytecode));
}
}
{
MVMObject *arr = entrypoints;
MVMArrayREPRData *reprdata = (MVMArrayREPRData *)STABLE(arr)->REPR_data;
MVMuint64 index;
MVMuint64 count;
if (reprdata->slot_type != MVM_ARRAY_I64) {
MVM_exception_throw_adhoc(tc, "installconfprog requires the entrypoints array to be a native array of 64-bit integers (got a %s)",
MVM_6model_get_debug_name(tc, bytecode));
}
count = MVM_repr_elems(tc, arr);
/* Initialize with sentry value */
for (index = 0; index < MVM_PROGRAM_ENTRYPOINT_COUNT; index++) {
entrypoint_array[index] = CONFPROG_UNUSED_ENTRYPOINT;
}
junkprint(stderr, "copying over %d entrypoints\n", count);
for (index = 0; index < count && index < MVM_PROGRAM_ENTRYPOINT_COUNT; index++) {
entrypoint_array[index] = MVM_repr_at_pos_i(tc, arr, index);
junkprint(stderr, " - %d == %d\n", index, entrypoint_array[index]);
}
}
confprog = MVM_calloc(1, sizeof(MVMConfigurationProgram));
confprog->debugging_level = debug_level;
junkprint(stderr, "copying %d (%x) bytecode entries\n", bytecode_size, bytecode_size);
confprog->bytecode = MVM_malloc(bytecode_size);
memcpy(confprog->bytecode, array_contents, bytecode_size);
memcpy(confprog->entrypoints, entrypoint_array, sizeof(entrypoint_array));
confprog->bytecode_length = bytecode_size;
confprog->string_heap = string_array;
MVM_confprog_validate(tc, confprog);
tc->instance->confprog = confprog;
}
MVMuint8 MVM_confprog_has_entrypoint(MVMThreadContext *tc, MVMuint8 entrypoint) {
return tc->instance->confprog && entrypoint < MVM_PROGRAM_ENTRYPOINT_COUNT && tc->instance->confprog->entrypoints[entrypoint] != CONFPROG_UNUSED_ENTRYPOINT;
}
/* Stolen from interp.c */
#define OP(name) case MVM_OP_ ## name
#define NEXT runloop
#define GET_REG(pc, idx) reg_base[*((MVMuint16 *)(pc + idx))]
#define GET_UI32(pc, idx) *((MVMuint32 *)(pc + idx))
#define GET_UI16(pc, idx) *((MVMuint16 *)(pc + idx))
#define GET_I16(pc, idx) *((MVMint16 *)(pc + idx))
#define STRING_OR_EMPTY(input) ((input) == 0 ? tc->instance->str_consts.empty : (input))
MVMint64 MVM_confprog_run(MVMThreadContext *tc, void *subject, MVMuint8 entrypoint, MVMint64 initial_feature_value) {
MVMConfigurationProgram *prog = tc->instance->confprog;
MVMuint8 *cur_op;
MVMuint8 *last_op;
MVMint64 result;
MVMint16 stats_slot;
MVMuint8 *bytecode_start;
MVMuint8 debug_level = prog->debugging_level;
CPRegister *reg_base = MVM_calloc(prog->reg_count + 1, sizeof(CPRegister));
reg_base[REGISTER_FEATURE_TOGGLE].i64 = initial_feature_value;
bytecode_start = prog->bytecode;
cur_op = bytecode_start + prog->entrypoints[entrypoint];
last_op = bytecode_start + prog->bytecode_length;
MVM_incr(&prog->invoke_counts[entrypoint]);
debugprint(DEBUG_LVL(BARE), tc, " running confprog for entrypoint %d (at position 0x%x) (this entrypoint run for the %dth time)\n", entrypoint, prog->entrypoints[entrypoint], MVM_load(&prog->invoke_counts[entrypoint]));
/*junkprint(stderr, "confprog is 0x%x (%d) bytes big", last_op - bytecode_start, last_op - bytecode_start);*/
runloop: {
MVMuint16 ins;
if (cur_op >= last_op) {
junkprint(stderr, "end of program: %p > %p\n", cur_op, last_op);
goto finish_main_loop;
}
ins = *((MVMuint16 *)cur_op);
cur_op += 2;
junkprint(stderr, "evaluating a %s at position %x (%d)\n", MVM_op_get_op(ins)->name, cur_op - 2 - bytecode_start, cur_op - 2 - bytecode_start);
switch (ins) {
OP(no_op):
debugprint(DEBUG_LVL(TRACE), tc, "noop");
goto NEXT;
OP(const_i64):
GET_REG(cur_op, 0).i64 = MVM_BC_get_I64(cur_op, 2);
debugprint(DEBUG_LVL(TRACE), tc, "const_i64 %ld into %d", MVM_BC_get_I64(cur_op, 2), GET_UI16(cur_op, 0));
cur_op += 10;
goto NEXT;
OP(const_n64):
GET_REG(cur_op, 0).n64 = MVM_BC_get_N64(cur_op, 2);
debugprint(DEBUG_LVL(TRACE), tc, "const_n64 %f into %d", MVM_BC_get_N64(cur_op, 2), GET_UI16(cur_op, 0));
cur_op += 10;
goto NEXT;
OP(const_i64_16):
GET_REG(cur_op, 0).i64 = GET_I16(cur_op, 2);
debugprint(DEBUG_LVL(TRACE), tc, "const_i64_16 %d into %d", GET_I16(cur_op, 2), GET_UI16(cur_op, 0));
cur_op += 4;
goto NEXT;
OP(const_s):
GET_REG(cur_op, 0).s = MVM_repr_at_pos_s(tc, prog->string_heap, GET_UI32(cur_op, 2));
debugprint(DEBUG_LVL(TRACE), tc, "const_s into reg %d", GET_UI16(cur_op, 0));
cur_op += 6;
goto NEXT;
OP(set):
GET_REG(cur_op, 0) = GET_REG(cur_op, 2);
debugprint(DEBUG_LVL(TRACE), tc, "set %d <- %d", GET_UI16(cur_op, 0), GET_UI16(cur_op, 2));
cur_op += 4;
goto NEXT;
OP(say): {
MVMString *s = GET_REG(cur_op, 0).s;
debugprint(DEBUG_LVL(TRACE), tc, "say %d", GET_UI16(cur_op, 0));
if (s && IS_CONCRETE(s))
MVM_string_say(tc, s);
cur_op += 2;
goto NEXT;
}
OP(getattr_o):
debugprint(DEBUG_LVL(TRACE), tc, "struct select: %lx", (unsigned long)reg_base[REGISTER_STRUCT_SELECT].i64);
if (reg_base[REGISTER_STRUCT_SELECT].i64 == StructSel_Nothing) {
debugprint(DEBUG_LVL(TRACE), tc, "getattr_o into %d", GET_UI16(cur_op, 0));
}
else if (reg_base[REGISTER_STRUCT_SELECT].i64 == StructSel_Root) {
MVMuint16 field_select = GET_UI16(cur_op, 10);
if (field_select == FieldSel_staticframe) {
reg_base[REGISTER_STRUCT_ACCUMULATOR].any = tc->cur_frame->static_info;
debugprint(DEBUG_LVL(TRACE), tc, "get a static frame into the struct accumulator: %p", (void *)tc->cur_frame->static_info);
}
else if (field_select == FieldSel_frame) {
reg_base[REGISTER_STRUCT_ACCUMULATOR].any = tc->cur_frame;
debugprint(DEBUG_LVL(TRACE), tc, "get a frame into the struct accumulator: %p", (void *)tc->cur_frame);
}
else {
fprintf(stderr, "NYI case of getattr_o on root struct hit\n");
goto finish_main_loop;
}
}
else {
debugprint(DEBUG_LVL(TRACE), tc, "getting the struct accumulator's field at offset 0x%x into register %d",
GET_UI16(cur_op, 10), GET_UI16(cur_op, 0));
debugprint(DEBUG_LVL(TRACE), tc, "register %d contents before: 0x%p", GET_UI16(cur_op, 0), reg_base[GET_UI16(cur_op, 0)].any);
debugprint(DEBUG_LVL(TRACE), tc, "register %d contents before: 0x%p", REGISTER_STRUCT_ACCUMULATOR, reg_base[REGISTER_STRUCT_ACCUMULATOR].any);
reg_base[GET_UI16(cur_op, 0)].any =
*((void **)(((char *)reg_base[REGISTER_STRUCT_ACCUMULATOR].any) + GET_UI16(cur_op, 10)));
debugprint(DEBUG_LVL(TRACE), tc, "register %d contents now: 0x%p", GET_UI16(cur_op, 0), reg_base[GET_UI16(cur_op, 0)].any);
/*(char *)(®_base[REGISTER_STRUCT_ACCUMULATOR]) = (char *)*/
}
cur_op += 12;
goto NEXT;
OP(eq_s):
debugprint(DEBUG_LVL(TRACE), tc, "eq_s with %d and %d", GET_UI16(cur_op, 2), GET_UI16(cur_op, 4));
GET_REG(cur_op, 0).i64 = MVM_string_equal(tc,
GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s);
cur_op += 6;
goto NEXT;
OP(ne_s):
GET_REG(cur_op, 0).i64 = (MVMint64)(MVM_string_equal(tc,
GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s)? 0 : 1);
cur_op += 6;
goto NEXT;
OP(gt_s):
GET_REG(cur_op, 0).i64 = MVM_string_compare(tc,
GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s) == 1;
cur_op += 6;
goto NEXT;
OP(ge_s):
GET_REG(cur_op, 0).i64 = MVM_string_compare(tc,
GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s) >= 0;
cur_op += 6;
goto NEXT;
OP(lt_s):
GET_REG(cur_op, 0).i64 = MVM_string_compare(tc,
GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s) == -1;
cur_op += 6;
goto NEXT;
OP(le_s):
GET_REG(cur_op, 0).i64 = MVM_string_compare(tc,
GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s) <= 0;
cur_op += 6;
goto NEXT;
OP(cmp_s):
GET_REG(cur_op, 0).i64 = MVM_string_compare(tc,
GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s);
cur_op += 6;
goto NEXT;
OP(add_n):
GET_REG(cur_op, 0).n64 = GET_REG(cur_op, 2).n64 + GET_REG(cur_op, 4).n64;
cur_op += 6;
goto NEXT;
OP(sub_n):
GET_REG(cur_op, 0).n64 = GET_REG(cur_op, 2).n64 - GET_REG(cur_op, 4).n64;
cur_op += 6;
goto NEXT;
OP(mul_n):
GET_REG(cur_op, 0).n64 = GET_REG(cur_op, 2).n64 * GET_REG(cur_op, 4).n64;
cur_op += 6;
goto NEXT;
OP(div_n):
GET_REG(cur_op, 0).n64 = GET_REG(cur_op, 2).n64 / GET_REG(cur_op, 4).n64;
cur_op += 6;
goto NEXT;
OP(mod_n): {
MVMnum64 a = GET_REG(cur_op, 2).n64;
MVMnum64 b = GET_REG(cur_op, 4).n64;
GET_REG(cur_op, 0).n64 = b == 0 ? a : a - b * floor(a / b);
cur_op += 6;
goto NEXT;
}
OP(neg_n):
GET_REG(cur_op, 0).n64 = -GET_REG(cur_op, 2).n64;
cur_op += 4;
goto NEXT;
OP(abs_n):
GET_REG(cur_op, 0).n64 = fabs(GET_REG(cur_op, 2).n64);
cur_op += 4;
goto NEXT;
OP(pow_n):
GET_REG(cur_op, 0).n64 = pow(GET_REG(cur_op, 2).n64, GET_REG(cur_op, 4).n64);
cur_op += 6;
goto NEXT;
OP(ceil_n):
GET_REG(cur_op, 0).n64 = ceil(GET_REG(cur_op, 2).n64);
cur_op += 4;
goto NEXT;
OP(floor_n):
GET_REG(cur_op, 0).n64 = floor(GET_REG(cur_op, 2).n64);
cur_op += 4;
goto NEXT;
OP(coerce_in):
GET_REG(cur_op, 0).n64 = (MVMnum64)GET_REG(cur_op, 2).i64;
cur_op += 4;
goto NEXT;
OP(coerce_ni):
GET_REG(cur_op, 0).i64 = (MVMint64)GET_REG(cur_op, 2).n64;
cur_op += 4;
goto NEXT;
OP(coerce_is):
GET_REG(cur_op, 0).s = MVM_coerce_i_s(tc, GET_REG(cur_op, 2).i64);
cur_op += 4;
goto NEXT;
OP(coerce_ns):
GET_REG(cur_op, 0).s = MVM_coerce_n_s(tc, GET_REG(cur_op, 2).n64);
cur_op += 4;
goto NEXT;
OP(coerce_si):
GET_REG(cur_op, 0).i64 = MVM_coerce_s_i(tc, GET_REG(cur_op, 2).s);
cur_op += 4;
goto NEXT;
OP(coerce_sn):
GET_REG(cur_op, 0).n64 = MVM_coerce_s_n(tc, GET_REG(cur_op, 2).s);
cur_op += 4;
goto NEXT;
OP(gt_n):
debugprint(DEBUG_LVL(TRACE), tc, "%f > %f into %d", GET_REG(cur_op, 2).n64, GET_REG(cur_op, 4).n64, GET_UI16(cur_op, 0));
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).n64 > GET_REG(cur_op, 4).n64;
cur_op += 6;
goto NEXT;
OP(ge_n):
debugprint(DEBUG_LVL(TRACE), tc, "%f >= %f into %d", GET_REG(cur_op, 2).n64, GET_REG(cur_op, 4).n64, GET_UI16(cur_op, 0));
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).n64 >= GET_REG(cur_op, 4).n64;
cur_op += 6;
goto NEXT;
OP(rand_n):
GET_REG(cur_op, 0).n64 = MVM_proc_rand_n(tc);
debugprint(DEBUG_LVL(TRACE), tc, "rand_n result %f into %d", GET_REG(cur_op, 0).n64, GET_UI16(cur_op, 0));
cur_op += 2;
goto NEXT;
OP(goto):
cur_op = bytecode_start + GET_UI32(cur_op, 0);
goto NEXT;
OP(if_i):
if (GET_REG(cur_op, 0).i64)
cur_op = bytecode_start + GET_UI32(cur_op, 2);
else
cur_op += 6;
goto NEXT;
OP(time):
GET_REG(cur_op, 0).u64 = MVM_proc_time(tc);
cur_op += 2;
goto NEXT;
OP(exit): {
goto finish_main_loop;
OP(index_s):
debugprint(DEBUG_LVL(TRACE), tc, "index_s into %d with %d and %d starting at %d",
GET_UI16(cur_op, 0), GET_UI16(cur_op, 2), GET_UI16(cur_op, 4), GET_UI16(cur_op, 6));
debugprint(DEBUG_LVL(TRACE), tc, "values %p and %p starting at %ld",
GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s, GET_REG(cur_op, 6).i64);
GET_REG(cur_op, 0).i64 = MVM_string_index(tc,
STRING_OR_EMPTY(GET_REG(cur_op, 2).s), STRING_OR_EMPTY(GET_REG(cur_op, 4).s), GET_REG(cur_op, 6).i64);
debugprint(DEBUG_LVL(TRACE), tc, "index_s result: %ld", GET_REG(cur_op, 0).i64);
cur_op += 8;
goto NEXT;
OP(eqat_s):
GET_REG(cur_op, 0).i64 = MVM_string_equal_at(tc,
GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s,
GET_REG(cur_op, 6).i64);
cur_op += 8;
goto NEXT;
}
OP(eqatic_s):
GET_REG(cur_op, 0).i64 = MVM_string_equal_at_ignore_case(tc,
GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s,
GET_REG(cur_op, 6).i64);
cur_op += 8;
goto NEXT;
OP(eq_i):
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 == GET_REG(cur_op, 4).i64;
cur_op += 6;
goto NEXT;
OP(ne_i):
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 != GET_REG(cur_op, 4).i64;
cur_op += 6;
goto NEXT;
OP(lt_i):
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 < GET_REG(cur_op, 4).i64;
cur_op += 6;
goto NEXT;
OP(le_i):
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 <= GET_REG(cur_op, 4).i64;
cur_op += 6;
goto NEXT;
OP(gt_i):
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 > GET_REG(cur_op, 4).i64;
cur_op += 6;
goto NEXT;
OP(ge_i):
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 >= GET_REG(cur_op, 4).i64;
cur_op += 6;
goto NEXT;
OP(add_i):
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 + GET_REG(cur_op, 4).i64;
cur_op += 6;
goto NEXT;
OP(sub_i):
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 - GET_REG(cur_op, 4).i64;
cur_op += 6;
goto NEXT;
OP(mul_i):
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 * GET_REG(cur_op, 4).i64;
cur_op += 6;
goto NEXT;
OP(div_i): {
MVMint64 num = GET_REG(cur_op, 2).i64;
MVMint64 denom = GET_REG(cur_op, 4).i64;
/* if we have a negative result, make sure we floor rather
* than rounding towards zero. */
if (denom == 0) {
fprintf(stderr, "division by zero in confprog\n");
goto finish_main_loop;
}
if ((num < 0) ^ (denom < 0)) {
if ((num % denom) != 0) {
GET_REG(cur_op, 0).i64 = num / denom - 1;
} else {
GET_REG(cur_op, 0).i64 = num / denom;
}
} else {
GET_REG(cur_op, 0).i64 = num / denom;
}
cur_op += 6;
goto NEXT;
}
OP(not_i): {
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 ? 0 : 1;
cur_op += 4;
goto NEXT;
}
OP(band_i):
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 & GET_REG(cur_op, 4).i64;
cur_op += 6;
goto NEXT;
OP(bor_i):
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 | GET_REG(cur_op, 4).i64;
cur_op += 6;
goto NEXT;
OP(bxor_i):
GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 ^ GET_REG(cur_op, 4).i64;
cur_op += 6;
goto NEXT;
OP(getcodelocation): {
MVMint32 line_out = 0;
MVMString *file_out = NULL;
MVMObject *code_obj = (MVMObject *)((MVMStaticFrame *)reg_base[REGISTER_STRUCT_ACCUMULATOR].any)->body.static_code;
cur_op += 4;
/* The verifier will have made sure the code doesn't end yet */
ins = *((MVMuint16 *)cur_op);
cur_op += 2;
MVM_code_location_out(tc, code_obj, &file_out, &line_out);
MVM_exception_throw_adhoc(tc, "getcodelocation in conf prog needs updates after new-disp");
if (ins == MVM_OP_unbox_s) {
GET_REG(cur_op, 0).s = file_out ? file_out : tc->instance->str_consts.empty;
}
else {
GET_REG(cur_op, 0).i64 = line_out;
}
cur_op += 4;
goto NEXT;
}
OP(chars):
GET_REG(cur_op, 0).i64 = MVM_string_graphs(tc, GET_REG(cur_op, 2).s);
cur_op += 4;
goto NEXT;
default:
fprintf(stderr, "operation %s (%d, 0x%x) NYI\n", MVM_op_get_op(ins)->name, ins, ins);
goto finish_main_loop;
}
}
finish_main_loop:
result = reg_base[REGISTER_FEATURE_TOGGLE].i64;
MVM_free(reg_base);
stats_slot = stats_position_for_value(NULL, entrypoint, result);
if (stats_slot != -1) {
MVM_store(&prog->last_return_time[stats_slot], AO_CAST(MVM_proc_time(tc)));
MVM_incr(&prog->return_counts[stats_slot]);
}
{
const char *resultname = "unknown result meaning";
switch (entrypoint) {
case MVM_PROGRAM_ENTRYPOINT_PROFILER_STATIC:
case MVM_PROGRAM_ENTRYPOINT_PROFILER_DYNAMIC:
switch (result) {
case MVM_CONFPROG_SF_RESULT_TO_BE_DETERMINED:
resultname = "RESULT_TO_BE_DETERMINED";
break;
case MVM_CONFPROG_SF_RESULT_NEVER:
resultname = "RESULT_NEVER";
break;
case MVM_CONFPROG_SF_RESULT_DYNAMIC_SUGGEST_NO:
resultname = "RESULT_DYNAMIC_SUGGEST_NO";
break;
case MVM_CONFPROG_SF_RESULT_DYNAMIC_SUGGEST_YES:
resultname = "RESULT_DYNAMIC_SUGGEST_YES";
break;
case MVM_CONFPROG_SF_RESULT_ALWAYS:
resultname = "RESULT_ALWAYS";
break;
}
break;
case MVM_PROGRAM_ENTRYPOINT_HEAPSNAPSHOT:
switch (result) {
case MVM_CONFPROG_HEAPSNAPSHOT_RESULT_NOTHING:
resultname = "RESULT_NOTHING";
break;
case MVM_CONFPROG_HEAPSNAPSHOT_RESULT_SNAPSHOT:
resultname = "RESULT_SNAPSHOT";
break;
case MVM_CONFPROG_HEAPSNAPSHOT_RESULT_STATS:
resultname = "RESULT_STATS";
break;
case MVM_CONFPROG_HEAPSNAPSHOT_RESULT_SNAPSHOT_WITH_STATS:
resultname = "RESULT_SNAPSHOT_WITH_STATS";
break;
}
break;
}
debugprint(DEBUG_LVL(BARE), tc, "confprog result value: %"PRIi64" (%s)\n", result, resultname);
}
return result;
}
#define add_collectable(tc, worklist, snapshot, col, desc) \
do { \
if (worklist) { \
MVM_gc_worklist_add(tc, worklist, &(col)); \
} \
else { \
MVM_profile_heap_add_collectable_rel_const_cstr(tc, snapshot, \
(MVMCollectable *)col, desc); \
} \
} while (0)
void MVM_confprog_mark(MVMThreadContext *tc, MVMGCWorklist *worklist, MVMHeapSnapshotState *snapshot) {
MVMConfigurationProgram *confprog = tc->instance->confprog;
add_collectable(tc, worklist, snapshot, confprog->string_heap,
"Configuration Program String Heap");
}
|
71cea44f3225d28be83f416ea46acec0e7175f52
|
46f7cb7150697037d4b5f434dde423a1eeb8e422
|
/ncnn-20210525-full-source/src/layer/arm/neon_mathfun_fp16s.h
|
4dcb5814aebdc29a47005c5404d3b47013b18a50
|
[
"BSD-3-Clause",
"Zlib",
"BSD-2-Clause",
"MIT"
] |
permissive
|
MirrorYuChen/ncnn_example
|
d856f732e031b0e069fed7e30759e1c6c7947aaf
|
82a84d79c96e908f46b7e7cac6c8365c83b0f896
|
refs/heads/master
| 2023-08-18T06:31:06.113775
| 2022-05-14T17:38:01
| 2022-05-14T17:38:01
| 183,336,202
| 362
| 108
|
MIT
| 2022-06-22T04:17:14
| 2019-04-25T01:53:37
|
C++
|
UTF-8
|
C
| false
| false
| 22,238
|
h
|
neon_mathfun_fp16s.h
|
// Tencent is pleased to support the open source community by making ncnn available.
//
// Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// https://opensource.org/licenses/BSD-3-Clause
//
// 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.
/* NEON implementation of sin, cos, exp and log
*
* Inspired by Intel Approximate Math library, and based on the
* corresponding algorithms of the cephes math library
*/
/* Copyright (C) 2011 Julien Pommier
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
* (this is the zlib license)
*/
#ifndef NEON_MATHFUN_FP16S_H
#define NEON_MATHFUN_FP16S_H
#include <arm_neon.h>
#define c_inv_mant_mask_f16 -31745 // ~0x7c00u
#define c_cephes_SQRTHF 0.707106781186547524
#define c_cephes_log_p0 7.0376836292E-2
#define c_cephes_log_p1 -1.1514610310E-1
#define c_cephes_log_p2 1.1676998740E-1
#define c_cephes_log_p3 -1.2420140846E-1
#define c_cephes_log_p4 +1.4249322787E-1
#define c_cephes_log_p5 -1.6668057665E-1
#define c_cephes_log_p6 +2.0000714765E-1
#define c_cephes_log_p7 -2.4999993993E-1
#define c_cephes_log_p8 +3.3333331174E-1
#define c_cephes_log_q1 -2.12194440e-4
#define c_cephes_log_q2 0.693359375
/* natural logarithm computed for 4 simultaneous float
* return NaN for x <= 0
*/
static inline float16x4_t log_ps(float16x4_t x)
{
float16x4_t one = vdup_n_f16(1);
x = vmax_f16(x, vdup_n_f16(0)); /* force flush to zero on denormal values */
uint16x4_t invalid_mask = vcle_f16(x, vdup_n_f16(0));
int16x4_t ux = vreinterpret_s16_f16(x);
int16x4_t emm0 = vshr_n_s16(ux, 10);
/* keep only the fractional part */
ux = vand_s16(ux, vdup_n_s16(c_inv_mant_mask_f16));
ux = vorr_s16(ux, vreinterpret_s16_f16(vdup_n_f16(0.5f)));
x = vreinterpret_f16_s16(ux);
emm0 = vsub_s16(emm0, vdup_n_s16(0xf));
float16x4_t e = vcvt_f16_s16(emm0);
e = vadd_f16(e, one);
/* part2:
* if( x < SQRTHF ) {
* e -= 1;
* x = x + x - 1.0;
* } else { x = x - 1.0; }
*/
uint16x4_t mask = vclt_f16(x, vdup_n_f16(c_cephes_SQRTHF));
float16x4_t tmp = vreinterpret_f16_u16(vand_u16(vreinterpret_u16_f16(x), mask));
x = vsub_f16(x, one);
e = vsub_f16(e, vreinterpret_f16_u16(vand_u16(vreinterpret_u16_f16(one), mask)));
x = vadd_f16(x, tmp);
float16x4_t z = vmul_f16(x, x);
float16x4_t y = vdup_n_f16(c_cephes_log_p0);
y = vmul_f16(y, x);
y = vadd_f16(y, vdup_n_f16(c_cephes_log_p1));
y = vmul_f16(y, x);
y = vadd_f16(y, vdup_n_f16(c_cephes_log_p2));
y = vmul_f16(y, x);
y = vadd_f16(y, vdup_n_f16(c_cephes_log_p3));
y = vmul_f16(y, x);
y = vadd_f16(y, vdup_n_f16(c_cephes_log_p4));
y = vmul_f16(y, x);
y = vadd_f16(y, vdup_n_f16(c_cephes_log_p5));
y = vmul_f16(y, x);
y = vadd_f16(y, vdup_n_f16(c_cephes_log_p6));
y = vmul_f16(y, x);
y = vadd_f16(y, vdup_n_f16(c_cephes_log_p7));
y = vmul_f16(y, x);
y = vadd_f16(y, vdup_n_f16(c_cephes_log_p8));
y = vmul_f16(y, x);
y = vmul_f16(y, z);
tmp = vmul_f16(e, vdup_n_f16(c_cephes_log_q1));
y = vadd_f16(y, tmp);
tmp = vmul_f16(z, vdup_n_f16(0.5f));
y = vsub_f16(y, tmp);
tmp = vmul_f16(e, vdup_n_f16(c_cephes_log_q2));
x = vadd_f16(x, y);
x = vadd_f16(x, tmp);
x = vreinterpret_f16_u16(vorr_u16(vreinterpret_u16_f16(x), invalid_mask)); // negative arg will be NAN
return x;
}
static inline float16x8_t log_ps(float16x8_t x)
{
float16x8_t one = vdupq_n_f16(1);
x = vmaxq_f16(x, vdupq_n_f16(0)); /* force flush to zero on denormal values */
uint16x8_t invalid_mask = vcleq_f16(x, vdupq_n_f16(0));
int16x8_t ux = vreinterpretq_s16_f16(x);
int16x8_t emm0 = vshrq_n_s16(ux, 10);
/* keep only the fractional part */
ux = vandq_s16(ux, vdupq_n_s16(c_inv_mant_mask_f16));
ux = vorrq_s16(ux, vreinterpretq_s16_f16(vdupq_n_f16(0.5f)));
x = vreinterpretq_f16_s16(ux);
emm0 = vsubq_s16(emm0, vdupq_n_s16(0xf));
float16x8_t e = vcvtq_f16_s16(emm0);
e = vaddq_f16(e, one);
/* part2:
* if( x < SQRTHF ) {
* e -= 1;
* x = x + x - 1.0;
* } else { x = x - 1.0; }
*/
uint16x8_t mask = vcltq_f16(x, vdupq_n_f16(c_cephes_SQRTHF));
float16x8_t tmp = vreinterpretq_f16_u16(vandq_u16(vreinterpretq_u16_f16(x), mask));
x = vsubq_f16(x, one);
e = vsubq_f16(e, vreinterpretq_f16_u16(vandq_u16(vreinterpretq_u16_f16(one), mask)));
x = vaddq_f16(x, tmp);
float16x8_t z = vmulq_f16(x, x);
float16x8_t y = vdupq_n_f16(c_cephes_log_p0);
y = vmulq_f16(y, x);
y = vaddq_f16(y, vdupq_n_f16(c_cephes_log_p1));
y = vmulq_f16(y, x);
y = vaddq_f16(y, vdupq_n_f16(c_cephes_log_p2));
y = vmulq_f16(y, x);
y = vaddq_f16(y, vdupq_n_f16(c_cephes_log_p3));
y = vmulq_f16(y, x);
y = vaddq_f16(y, vdupq_n_f16(c_cephes_log_p4));
y = vmulq_f16(y, x);
y = vaddq_f16(y, vdupq_n_f16(c_cephes_log_p5));
y = vmulq_f16(y, x);
y = vaddq_f16(y, vdupq_n_f16(c_cephes_log_p6));
y = vmulq_f16(y, x);
y = vaddq_f16(y, vdupq_n_f16(c_cephes_log_p7));
y = vmulq_f16(y, x);
y = vaddq_f16(y, vdupq_n_f16(c_cephes_log_p8));
y = vmulq_f16(y, x);
y = vmulq_f16(y, z);
tmp = vmulq_f16(e, vdupq_n_f16(c_cephes_log_q1));
y = vaddq_f16(y, tmp);
tmp = vmulq_f16(z, vdupq_n_f16(0.5f));
y = vsubq_f16(y, tmp);
tmp = vmulq_f16(e, vdupq_n_f16(c_cephes_log_q2));
x = vaddq_f16(x, y);
x = vaddq_f16(x, tmp);
x = vreinterpretq_f16_u16(vorrq_u16(vreinterpretq_u16_f16(x), invalid_mask)); // negative arg will be NAN
return x;
}
#define c_exp_hi_f16 10.7421875f
#define c_exp_lo_f16 -10.7421875f
#define c_cephes_LOG2EF 1.44269504088896341
#define c_cephes_exp_C1 0.693359375
#define c_cephes_exp_C2 -2.12194440e-4
#define c_cephes_exp_p0 1.9875691500E-4
#define c_cephes_exp_p1 1.3981999507E-3
#define c_cephes_exp_p2 8.3334519073E-3
#define c_cephes_exp_p3 4.1665795894E-2
#define c_cephes_exp_p4 1.6666665459E-1
#define c_cephes_exp_p5 5.0000001201E-1
/* exp() computed for 4 float at once */
static inline float16x4_t exp_ps(float16x4_t x)
{
float16x4_t tmp, fx;
float16x4_t one = vdup_n_f16(1);
x = vmin_f16(x, vdup_n_f16(c_exp_hi_f16));
x = vmax_f16(x, vdup_n_f16(c_exp_lo_f16));
/* express exp(x) as exp(g + n*log(2)) */
fx = vfma_f16(vdup_n_f16(0.5f), x, vdup_n_f16(c_cephes_LOG2EF));
/* perform a floorf */
tmp = vcvt_f16_s16(vcvt_s16_f16(fx));
/* if greater, substract 1 */
uint16x4_t mask = vcgt_f16(tmp, fx);
mask = vand_u16(mask, vreinterpret_u16_f16(one));
fx = vsub_f16(tmp, vreinterpret_f16_u16(mask));
tmp = vmul_f16(fx, vdup_n_f16(c_cephes_exp_C1));
float16x4_t z = vmul_f16(fx, vdup_n_f16(c_cephes_exp_C2));
x = vsub_f16(x, tmp);
x = vsub_f16(x, z);
static const __fp16 cephes_exp_p[6] = {c_cephes_exp_p0, c_cephes_exp_p1, c_cephes_exp_p2, c_cephes_exp_p3, c_cephes_exp_p4, c_cephes_exp_p5};
float16x4_t y = vld1_dup_f16(cephes_exp_p + 0);
float16x4_t c1 = vld1_dup_f16(cephes_exp_p + 1);
float16x4_t c2 = vld1_dup_f16(cephes_exp_p + 2);
float16x4_t c3 = vld1_dup_f16(cephes_exp_p + 3);
float16x4_t c4 = vld1_dup_f16(cephes_exp_p + 4);
float16x4_t c5 = vld1_dup_f16(cephes_exp_p + 5);
y = vmul_f16(y, x);
z = vmul_f16(x, x);
y = vadd_f16(y, c1);
y = vmul_f16(y, x);
y = vadd_f16(y, c2);
y = vmul_f16(y, x);
y = vadd_f16(y, c3);
y = vmul_f16(y, x);
y = vadd_f16(y, c4);
y = vmul_f16(y, x);
y = vadd_f16(y, c5);
y = vmul_f16(y, z);
y = vadd_f16(y, x);
y = vadd_f16(y, one);
/* build 2^n */
int16x4_t mm;
mm = vcvt_s16_f16(fx);
mm = vadd_s16(mm, vdup_n_s16(0xf));
mm = vshl_n_s16(mm, 10);
float16x4_t pow2n = vreinterpret_f16_s16(mm);
y = vmul_f16(y, pow2n);
return y;
}
static inline float16x8_t exp_ps(float16x8_t x)
{
float16x8_t tmp, fx;
float16x8_t one = vdupq_n_f16(1);
x = vminq_f16(x, vdupq_n_f16(c_exp_hi_f16));
x = vmaxq_f16(x, vdupq_n_f16(c_exp_lo_f16));
/* express exp(x) as exp(g + n*log(2)) */
fx = vfmaq_f16(vdupq_n_f16(0.5f), x, vdupq_n_f16(c_cephes_LOG2EF));
/* perform a floorf */
tmp = vcvtq_f16_s16(vcvtq_s16_f16(fx));
/* if greater, substract 1 */
uint16x8_t mask = vcgtq_f16(tmp, fx);
mask = vandq_u16(mask, vreinterpretq_u16_f16(one));
fx = vsubq_f16(tmp, vreinterpretq_f16_u16(mask));
tmp = vmulq_f16(fx, vdupq_n_f16(c_cephes_exp_C1));
float16x8_t z = vmulq_f16(fx, vdupq_n_f16(c_cephes_exp_C2));
x = vsubq_f16(x, tmp);
x = vsubq_f16(x, z);
static const __fp16 cephes_exp_p[6] = {c_cephes_exp_p0, c_cephes_exp_p1, c_cephes_exp_p2, c_cephes_exp_p3, c_cephes_exp_p4, c_cephes_exp_p5};
float16x8_t y = vld1q_dup_f16(cephes_exp_p + 0);
float16x8_t c1 = vld1q_dup_f16(cephes_exp_p + 1);
float16x8_t c2 = vld1q_dup_f16(cephes_exp_p + 2);
float16x8_t c3 = vld1q_dup_f16(cephes_exp_p + 3);
float16x8_t c4 = vld1q_dup_f16(cephes_exp_p + 4);
float16x8_t c5 = vld1q_dup_f16(cephes_exp_p + 5);
y = vmulq_f16(y, x);
z = vmulq_f16(x, x);
y = vaddq_f16(y, c1);
y = vmulq_f16(y, x);
y = vaddq_f16(y, c2);
y = vmulq_f16(y, x);
y = vaddq_f16(y, c3);
y = vmulq_f16(y, x);
y = vaddq_f16(y, c4);
y = vmulq_f16(y, x);
y = vaddq_f16(y, c5);
y = vmulq_f16(y, z);
y = vaddq_f16(y, x);
y = vaddq_f16(y, one);
/* build 2^n */
int16x8_t mm;
mm = vcvtq_s16_f16(fx);
mm = vaddq_s16(mm, vdupq_n_s16(0xf));
mm = vshlq_n_s16(mm, 10);
float16x8_t pow2n = vreinterpretq_f16_s16(mm);
y = vmulq_f16(y, pow2n);
return y;
}
#define c_minus_cephes_DP1 -0.78515625
#define c_minus_cephes_DP2 -2.4187564849853515625e-4
#define c_minus_cephes_DP3 -3.77489497744594108e-8
#define c_sincof_p0 -1.9515295891E-4
#define c_sincof_p1 8.3321608736E-3
#define c_sincof_p2 -1.6666654611E-1
#define c_coscof_p0 2.443315711809948E-005
#define c_coscof_p1 -1.388731625493765E-003
#define c_coscof_p2 4.166664568298827E-002
#define c_cephes_FOPI 1.27323954473516 // 4 / M_PI
/* evaluation of 4 sines & cosines at once.
*
* The code is the exact rewriting of the cephes sinf function.
* Precision is excellent as long as x < 8192 (I did not bother to
* take into account the special handling they have for greater values
* -- it does not return garbage for arguments over 8192, though, but
* the extra precision is missing).
*
* Note that it is such that sinf((float)M_PI) = 8.74e-8, which is the
* surprising but correct result.
*
* Note also that when you compute sin(x), cos(x) is available at
* almost no extra price so both sin_ps and cos_ps make use of
* sincos_ps..
*/
static inline void sincos_ps(float16x4_t x, float16x4_t* ysin, float16x4_t* ycos)
{
// any x
float16x4_t xmm1, xmm2, xmm3, y;
uint16x4_t emm2;
uint16x4_t sign_mask_sin, sign_mask_cos;
sign_mask_sin = vclt_f16(x, vdup_n_f16(0));
x = vabs_f16(x);
/* scale by 4/Pi */
y = vmul_f16(x, vdup_n_f16(c_cephes_FOPI));
/* store the integer part of y in mm0 */
emm2 = vcvt_u16_f16(y);
/* j=(j+1) & (~1) (see the cephes sources) */
emm2 = vadd_u16(emm2, vdup_n_u16(1));
emm2 = vand_u16(emm2, vdup_n_u16(~1));
y = vcvt_f16_u16(emm2);
/* get the polynom selection mask
* there is one polynom for 0 <= x <= Pi/4
* and another one for Pi/4<x<=Pi/2
*
* Both branches will be computed.
*/
uint16x4_t poly_mask = vtst_u16(emm2, vdup_n_u16(2));
/* The magic pass: "Extended precision modular arithmetic"
* x = ((x - y * DP1) - y * DP2) - y * DP3; */
xmm1 = vmul_n_f16(y, c_minus_cephes_DP1);
xmm2 = vmul_n_f16(y, c_minus_cephes_DP2);
xmm3 = vmul_n_f16(y, c_minus_cephes_DP3);
x = vadd_f16(x, xmm1);
x = vadd_f16(x, xmm2);
x = vadd_f16(x, xmm3);
sign_mask_sin = veor_u16(sign_mask_sin, vtst_u16(emm2, vdup_n_u16(4)));
sign_mask_cos = vtst_u16(vsub_u16(emm2, vdup_n_u16(2)), vdup_n_u16(4));
/* Evaluate the first polynom (0 <= x <= Pi/4) in y1,
* and the second polynom (Pi/4 <= x <= 0) in y2 */
float16x4_t z = vmul_f16(x, x);
float16x4_t y1, y2;
y1 = vmul_n_f16(z, c_coscof_p0);
y2 = vmul_n_f16(z, c_sincof_p0);
y1 = vadd_f16(y1, vdup_n_f16(c_coscof_p1));
y2 = vadd_f16(y2, vdup_n_f16(c_sincof_p1));
y1 = vmul_f16(y1, z);
y2 = vmul_f16(y2, z);
y1 = vadd_f16(y1, vdup_n_f16(c_coscof_p2));
y2 = vadd_f16(y2, vdup_n_f16(c_sincof_p2));
y1 = vmul_f16(y1, z);
y2 = vmul_f16(y2, z);
y1 = vmul_f16(y1, z);
y2 = vmul_f16(y2, x);
y1 = vsub_f16(y1, vmul_f16(z, vdup_n_f16(0.5f)));
y2 = vadd_f16(y2, x);
y1 = vadd_f16(y1, vdup_n_f16(1));
/* select the correct result from the two polynoms */
float16x4_t ys = vbsl_f16(poly_mask, y1, y2);
float16x4_t yc = vbsl_f16(poly_mask, y2, y1);
*ysin = vbsl_f16(sign_mask_sin, vneg_f16(ys), ys);
*ycos = vbsl_f16(sign_mask_cos, yc, vneg_f16(yc));
}
static inline void sincos_ps(float16x8_t x, float16x8_t* ysin, float16x8_t* ycos)
{
// any x
float16x8_t xmm1, xmm2, xmm3, y;
uint16x8_t emm2;
uint16x8_t sign_mask_sin, sign_mask_cos;
sign_mask_sin = vcltq_f16(x, vdupq_n_f16(0));
x = vabsq_f16(x);
/* scale by 4/Pi */
y = vmulq_f16(x, vdupq_n_f16(c_cephes_FOPI));
/* store the integer part of y in mm0 */
emm2 = vcvtq_u16_f16(y);
/* j=(j+1) & (~1) (see the cephes sources) */
emm2 = vaddq_u16(emm2, vdupq_n_u16(1));
emm2 = vandq_u16(emm2, vdupq_n_u16(~1));
y = vcvtq_f16_u16(emm2);
/* get the polynom selection mask
* there is one polynom for 0 <= x <= Pi/4
* and another one for Pi/4<x<=Pi/2
*
* Both branches will be computed.
*/
uint16x8_t poly_mask = vtstq_u16(emm2, vdupq_n_u16(2));
/* The magic pass: "Extended precision modular arithmetic"
* x = ((x - y * DP1) - y * DP2) - y * DP3; */
xmm1 = vmulq_n_f16(y, c_minus_cephes_DP1);
xmm2 = vmulq_n_f16(y, c_minus_cephes_DP2);
xmm3 = vmulq_n_f16(y, c_minus_cephes_DP3);
x = vaddq_f16(x, xmm1);
x = vaddq_f16(x, xmm2);
x = vaddq_f16(x, xmm3);
sign_mask_sin = veorq_u16(sign_mask_sin, vtstq_u16(emm2, vdupq_n_u16(4)));
sign_mask_cos = vtstq_u16(vsubq_u16(emm2, vdupq_n_u16(2)), vdupq_n_u16(4));
/* Evaluate the first polynom (0 <= x <= Pi/4) in y1,
* and the second polynom (Pi/4 <= x <= 0) in y2 */
float16x8_t z = vmulq_f16(x, x);
float16x8_t y1, y2;
y1 = vmulq_n_f16(z, c_coscof_p0);
y2 = vmulq_n_f16(z, c_sincof_p0);
y1 = vaddq_f16(y1, vdupq_n_f16(c_coscof_p1));
y2 = vaddq_f16(y2, vdupq_n_f16(c_sincof_p1));
y1 = vmulq_f16(y1, z);
y2 = vmulq_f16(y2, z);
y1 = vaddq_f16(y1, vdupq_n_f16(c_coscof_p2));
y2 = vaddq_f16(y2, vdupq_n_f16(c_sincof_p2));
y1 = vmulq_f16(y1, z);
y2 = vmulq_f16(y2, z);
y1 = vmulq_f16(y1, z);
y2 = vmulq_f16(y2, x);
y1 = vsubq_f16(y1, vmulq_f16(z, vdupq_n_f16(0.5f)));
y2 = vaddq_f16(y2, x);
y1 = vaddq_f16(y1, vdupq_n_f16(1));
/* select the correct result from the two polynoms */
float16x8_t ys = vbslq_f16(poly_mask, y1, y2);
float16x8_t yc = vbslq_f16(poly_mask, y2, y1);
*ysin = vbslq_f16(sign_mask_sin, vnegq_f16(ys), ys);
*ycos = vbslq_f16(sign_mask_cos, yc, vnegq_f16(yc));
}
static inline float16x4_t sin_ps(float16x4_t x)
{
float16x4_t ysin, ycos;
sincos_ps(x, &ysin, &ycos);
return ysin;
}
static inline float16x8_t sin_ps(float16x8_t x)
{
float16x8_t ysin, ycos;
sincos_ps(x, &ysin, &ycos);
return ysin;
}
static inline float16x4_t cos_ps(float16x4_t x)
{
float16x4_t ysin, ycos;
sincos_ps(x, &ysin, &ycos);
return ycos;
}
static inline float16x8_t cos_ps(float16x8_t x)
{
float16x8_t ysin, ycos;
sincos_ps(x, &ysin, &ycos);
return ycos;
}
// tanh neon vector version
// refer the scalar version from Cephes Math Library
#define c_cephes_HALFMAXLOGF_f16 4.5078125f
#define c_cephes_tanh_C1 0.625f
#define c_cephes_tanh_p0 -5.70498872745E-3
#define c_cephes_tanh_p1 +2.06390887954E-2
#define c_cephes_tanh_p2 -5.37397155531E-2
#define c_cephes_tanh_p3 +1.33314422036E-1
#define c_cephes_tanh_p4 -3.33332819422E-1
/* Single precision hyperbolic tangent computed for 4 simultaneous float */
static inline float16x4_t tanh_ps(float16x4_t x)
{
float16x4_t x2 = vabs_f16(x);
uint16x4_t mask_l = vcge_f16(x2, vdup_n_f16(c_cephes_tanh_C1));
uint16x4_t mask_l2 = vcgt_f16(x2, vdup_n_f16(c_cephes_HALFMAXLOGF_f16));
// abs(x) >= 0.625
// tanh(x) = 1 − 2 / (exp(2x) + 1)
float16x4_t _one = vdup_n_f16(1.f);
float16x4_t _two = vdup_n_f16(2.f);
float16x4_t exp_x_x = exp_ps(vadd_f16(x, x));
float16x4_t y0 = vsub_f16(_one, vdiv_f16(_two, vadd_f16(exp_x_x, _one)));
// abs(x) < 0.625
/*
z = x2 * x2;
z =
(((( -5.70498872745E-3 * z
+ 2.06390887954E-2) * z
- 5.37397155531E-2) * z
+ 1.33314422036E-1) * z
- 3.33332819422E-1) * z * x
+ x;
*/
static const __fp16 cephes_tanh_p[5] = {c_cephes_tanh_p0, c_cephes_tanh_p1, c_cephes_tanh_p2, c_cephes_tanh_p3, c_cephes_tanh_p4};
float16x4_t y = vld1_dup_f16(cephes_tanh_p + 0);
float16x4_t c1 = vld1_dup_f16(cephes_tanh_p + 1);
float16x4_t c2 = vld1_dup_f16(cephes_tanh_p + 2);
float16x4_t c3 = vld1_dup_f16(cephes_tanh_p + 3);
float16x4_t c4 = vld1_dup_f16(cephes_tanh_p + 4);
float16x4_t z = vmul_f16(x, x);
y = vmul_f16(y, z);
y = vadd_f16(y, c1);
y = vmul_f16(y, z);
y = vadd_f16(y, c2);
y = vmul_f16(y, z);
y = vadd_f16(y, c3);
y = vmul_f16(y, z);
y = vadd_f16(y, c4);
y = vmul_f16(y, z);
y = vmul_f16(y, x);
y = vadd_f16(y, x);
// abs(x) > HALFMAXLOGF
// return 1.0 or -1.0
uint16x4_t mask_pos = vcgt_f16(x, vdup_n_f16(0.f));
float16x4_t y1 = vreinterpret_f16_u16(vbsl_u16(mask_pos, vreinterpret_u16_f16(vdup_n_f16(1.f)), vreinterpret_u16_f16(vdup_n_f16(-1.f))));
y = vreinterpret_f16_u16(vbsl_u16(mask_l, vreinterpret_u16_f16(y0), vreinterpret_u16_f16(y)));
y = vreinterpret_f16_u16(vbsl_u16(mask_l2, vreinterpret_u16_f16(y1), vreinterpret_u16_f16(y)));
return y;
}
static inline float16x8_t tanh_ps(float16x8_t x)
{
float16x8_t x2 = vabsq_f16(x);
uint16x8_t mask_l = vcgeq_f16(x2, vdupq_n_f16(c_cephes_tanh_C1));
uint16x8_t mask_l2 = vcgtq_f16(x2, vdupq_n_f16(c_cephes_HALFMAXLOGF_f16));
// abs(x) >= 0.625
// tanh(x) = 1 − 2 / (exp(2x) + 1)
float16x8_t _one = vdupq_n_f16(1.f);
float16x8_t _two = vdupq_n_f16(2.f);
float16x8_t exp_x_x = exp_ps(vaddq_f16(x, x));
float16x8_t y0 = vsubq_f16(_one, vdivq_f16(_two, vaddq_f16(exp_x_x, _one)));
// abs(x) < 0.625
/*
* z = x2 * x2;
* z =
* (((( -5.70498872745E-3 * z
* + 2.06390887954E-2) * z
* - 5.37397155531E-2) * z
* + 1.33314422036E-1) * z
* - 3.33332819422E-1) * z * x
* + x;
*/
static const __fp16 cephes_tanh_p[5] = {c_cephes_tanh_p0, c_cephes_tanh_p1, c_cephes_tanh_p2, c_cephes_tanh_p3, c_cephes_tanh_p4};
float16x8_t y = vld1q_dup_f16(cephes_tanh_p + 0);
float16x8_t c1 = vld1q_dup_f16(cephes_tanh_p + 1);
float16x8_t c2 = vld1q_dup_f16(cephes_tanh_p + 2);
float16x8_t c3 = vld1q_dup_f16(cephes_tanh_p + 3);
float16x8_t c4 = vld1q_dup_f16(cephes_tanh_p + 4);
float16x8_t z = vmulq_f16(x, x);
y = vmulq_f16(y, z);
y = vaddq_f16(y, c1);
y = vmulq_f16(y, z);
y = vaddq_f16(y, c2);
y = vmulq_f16(y, z);
y = vaddq_f16(y, c3);
y = vmulq_f16(y, z);
y = vaddq_f16(y, c4);
y = vmulq_f16(y, z);
y = vmulq_f16(y, x);
y = vaddq_f16(y, x);
// abs(x) > HALFMAXLOGF
// return 1.0 or -1.0
uint16x8_t mask_pos = vcgtq_f16(x, vdupq_n_f16(0.f));
float16x8_t y1 = vreinterpretq_f16_u16(vbslq_u16(mask_pos, vreinterpretq_u16_f16(vdupq_n_f16(1.f)), vreinterpretq_u16_f16(vdupq_n_f16(-1.f))));
y = vreinterpretq_f16_u16(vbslq_u16(mask_l, vreinterpretq_u16_f16(y0), vreinterpretq_u16_f16(y)));
y = vreinterpretq_f16_u16(vbslq_u16(mask_l2, vreinterpretq_u16_f16(y1), vreinterpretq_u16_f16(y)));
return y;
}
static inline float16x4_t sigmoid_ps(float16x4_t _v)
{
float16x4_t _one = vdup_n_f16(1.f);
_v = vneg_f16(_v);
_v = exp_ps(_v);
_v = vadd_f16(_v, _one);
return vdiv_f16(_one, _v);
}
static inline float16x8_t sigmoid_ps(float16x8_t _v)
{
float16x8_t _one = vdupq_n_f16(1.f);
_v = vnegq_f16(_v);
_v = exp_ps(_v);
_v = vaddq_f16(_v, _one);
return vdivq_f16(_one, _v);
}
#endif // NEON_MATHFUN_FP16S_H
|
df0dc34ab070a2bee7abe3fd0d27aeb3a19e3fa5
|
75196819c910f3fd523f1a4d28e5d0fe12570ab1
|
/src/bdb53/util/db_sql_codegen/generate_verification.c
|
d6daf24f4b740a030c3beb2f043bf1a65aeb2c45
|
[
"MIT",
"BSD-3-Clause",
"Sleepycat"
] |
permissive
|
gridcoin-community/Gridcoin-Research
|
889967579b5b05bcc3ae836697a0f173b5ae91ea
|
21414dd0f63c9a34060f7f762f08d1a52aeb9e87
|
refs/heads/development
| 2023-09-04T09:21:55.006935
| 2023-09-03T17:45:20
| 2023-09-03T17:45:20
| 23,332,350
| 292
| 117
|
MIT
| 2023-09-11T10:22:10
| 2014-08-25T23:41:04
|
HTML
|
UTF-8
|
C
| false
| false
| 26,142
|
c
|
generate_verification.c
|
/*
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996, 2013 Oracle and/or its affiliates. All rights reserved.
*
*/
/*
* This compilation unit contains functions related to the generation
* of a test for the generated storage layer.
*/
#include "generation.h"
extern int maxbinsz; /* defined in buildpt.c */
#define CASENUM 19
#define CTYPENUM 4
char * data_set[CASENUM][CTYPENUM] = {
{"\"0\"", "\"zero\"", "0", "0"},
{"\"1\"", "\"one\"", "1", "1.1"},
{"\"2\"", "\"two\"", "2", "2.2"},
{"\"3\"", "\"three\"", "3", "3.3"},
{"\"4\"", "\"four\"", "4", "4.4"},
{"\"5\"", "\"five\"", "5", "5.5"},
{"\"6\"", "\"six\"", "6", "6.6"},
{"\"7\"", "\"seven\"", "7", "7.7"},
{"\"8\"", "\"eight\"", "8", "8.8"},
{"\"9\"", "\"nine\"", "9", "9.9"},
{"\"A\"", "\"eleven\"", "11", "11.1"},
{"\"B\"", "\"twenty-two\"", "22", "22.2"},
{"\"C\"", "\"thirty-three\"", "33", "33.3"},
{"\"D\"", "\"forty-four\"", "44", "44.4"},
{"\"E\"", "\"fifty-five\"", "55", "55.5"},
{"\"F\"", "\"sixty-six\"", "66", "66.6"},
{"\"G\"", "\"seventy-seven\"", "77", "77.7"},
{"\"H\"", "\"eighty-eight\"", "88", "88.8"},
{"\"I\"", "\"ninety-nine\"", "99", "99.9"}};
static FILE *test_file; /* stream for generated test code */
static int round = 0;
static int test_indent_level = 0;
void generate_verification(FILE *, char *);
static void pr_test(char *, ...);
static void pr_test_comment(char *, ...);
static void callback_function_enter_entop(ENTITY *);
static void callback_function_exit_entop(ENTITY *);
static void callback_function_attrop(ENTITY *, ATTRIBUTE *, int, int);
static void declare_record_instances_enter_entop(ENTITY *);
static void define_records_enter_entop(ENTITY *);
static void define_records_exit_entop(ENTITY *);
static void define_records_fields_attrop(ENTITY *, ATTRIBUTE *, int, int);
static void initialize_database_enter_entop(ENTITY *);
static void initialize_index_enter_entop(DB_INDEX *);
static void insertion_test_enter_entop(ENTITY *);
static void insertion_test_exit_entop(ENTITY *);
static void insertion_test_attrop(ENTITY *, ATTRIBUTE *, int, int);
static void retrieval_test_enter_entop(ENTITY *);
static void retrieval_test_exit_entop(ENTITY *);
static void retrieval_test_attrop(ENTITY *, ATTRIBUTE *, int, int);
static void invoke_full_iteration_enter_entop(ENTITY *);
static void invoke_full_iteration_exit_entop(ENTITY *);
static void invoke_query_iteration_idxop(DB_INDEX *);
static void deletion_test_enter_entop(ENTITY *);
static void deletion_test_exit_entop(ENTITY *);
static void close_secondary_test_idxop(DB_INDEX *);
static void close_primary_test_enter_entop(ENTITY *);
static void remove_secondary_test_idxop(DB_INDEX *);
static void remove_primary_test_enter_entop(ENTITY *);
/*
* generate_verification is the test entry point in this module. It
* orchestrates the generation of the C code for tests.
*/
void
generate_verification(vfile, hfilename)
FILE *vfile;
char *hfilename;
{
test_file = vfile;
pr_test_comment(
"Simple test for a Berkeley DB implementation \n\
generated from SQL DDL by db_sql \n\
");
pr_test("#include <assert.h>\n");
pr_test("#include <math.h>\n\n");
pr_test("\n#include \"%s\"\n\n", hfilename);
if (maxbinsz != 0) {
pr_test_comment("Test data for raw binary types");
pr_test("#define MAXBINSZ %d\n\n", maxbinsz);
pr_test("char binary_data[%d][MAXBINSZ];\n", CASENUM);
}
pr_test("int count_iteration;\n\n");
pr_test_comment("Test data for input record");
iterate_over_entities(&define_records_enter_entop,
&define_records_exit_entop,
NULL);
if (maxbinsz != 0) {
pr_test_comment("A very simple binary comparison function");
pr_test(
"int compare_binary(char *p, int len, int dem) \n\
{ \n\
if (memcmp(p, binary_data[dem], len) == 0) { \n\
return 0; \n\
} else { \n\
return 1; \n\
} \n\
} \n\
\n\
");
}
pr_test_comment(
"These are the iteration callback functions. One is defined per \n\
database(table). They are used for both full iterations and for \n\
secondary index queries. When a retrieval returns multiple records, \n\
as in full iteration over an entire database, one of these functions \n\
is called for each record found");
iterate_over_entities(&callback_function_enter_entop,
&callback_function_exit_entop,
&callback_function_attrop);
pr_test(
" \n\
main(int argc, char **argv) \n\
{ \n\
int i; \n\
int j; \n\
int ret; \n\
int occurence; \n\
\n\
");
test_indent_level++;
iterate_over_entities(&declare_record_instances_enter_entop,
NULL,
NULL);
iterate_over_entities(&initialize_database_enter_entop,
NULL,
NULL);
iterate_over_indexes(&initialize_index_enter_entop);
pr_test("\n");
if (maxbinsz != 0) {
pr_test_comment("Fill the binary test data with random values");
pr_test(
"for (i = 0; i < %d; i++) \n\
for (j = 0; j < MAXBINSZ; j++) \n\
binary_data[i][j] = rand(); \n\
\n\
",
CASENUM);
}
pr_test_comment(
"Use the convenience method to initialize the environment. \n\
The initializations for each entity and environment can be \n\
done discretely if you prefer, but this is the easy way.");
pr_test(
"ret = initialize_%s_environment(); \n\
if (ret != 0) { \n\
printf(\"Initialize error\"); \n\
return ret; \n\
} \n\
\n\
",
the_schema.environment.name);
pr_test("\n");
pr_test_comment(
"Now that everything is initialized, insert some records \n\
into each database, retrieve and verify them");
pr_test("for (i = 0; i < %d; i++) {\n", CASENUM);
test_indent_level++;
pr_test_comment(
"First, insert some records into each database using \n\
the ...insert_fields functions. These functions take \n\
each field of the record as a separate argument");
iterate_over_entities(&insertion_test_enter_entop,
&insertion_test_exit_entop,
&insertion_test_attrop);
pr_test("\n");
pr_test_comment(
"Next, retrieve the records just inserted, looking them up \n\
by their key values");
iterate_over_entities(&retrieval_test_enter_entop,
&retrieval_test_exit_entop,
&retrieval_test_attrop);
test_indent_level--;
pr_test("}\n");
pr_test("\n");
pr_test_comment(
"Now try iterating over every record, using the ...full_iteration \n\
functions for each database. For each record found, the \n\
appropriate ...iteration_callback_test function will be invoked \n\
(these are defined above).");
iterate_over_entities(&invoke_full_iteration_enter_entop,
&invoke_full_iteration_exit_entop,
NULL);
pr_test("\n");
pr_test_comment(
"For the secondary indexes, query for the known keys. This also \n\
results in the ...iteration_callback_test function's being called \n\
for each record found.");
iterate_over_indexes(&invoke_query_iteration_idxop);
pr_test("\n");
pr_test_comment(
"Now delete a record from each database using its primary key.");
for (round = 0; round < CASENUM; round++) {
iterate_over_entities(&deletion_test_enter_entop,
&deletion_test_exit_entop,
NULL);
}
pr_test("\n");
test_indent_level--;
pr_test("exit_error:\n");
test_indent_level++;
pr_test_comment("Close the secondary index databases");
iterate_over_indexes(&close_secondary_test_idxop);
pr_test("\n");
pr_test_comment("Close the primary databases");
iterate_over_entities(&close_primary_test_enter_entop,
NULL,
NULL);
pr_test("\n");
pr_test_comment("Delete the secondary index databases");
iterate_over_indexes(&remove_secondary_test_idxop);
pr_test("\n");
pr_test_comment("Delete the primary databases");
iterate_over_entities(&remove_primary_test_enter_entop,
NULL,
NULL);
if (the_schema.environment.transactional) {
pr_test(
" \n\
if (ret != 0) \n\
%s_txnp->abort(%s_txnp); \n\
else \n\
%s_txnp->commit(%s_txnp, 0); \n\
",
the_schema.environment.name,
the_schema.environment.name,
the_schema.environment.name,
the_schema.environment.name);
}
pr_test("\n");
pr_test_comment("Finally, close the environment");
pr_test(
"if (ret = %s_envp->close(%s_envp, 0)) \n\
return ret;\n",
the_schema.environment.name, the_schema.environment.name);
pr_test("\n");
pr_test(
"if (ret == 0) \n\
printf(\"*****WELL DONE!*****\\n\"); \n\
");
pr_test("return ret;\n");
test_indent_level--;
pr_test("}\n");
}
/*
* Emit a printf-formatted string into the test code file.
*/
static void
pr_test(char *fmt, ...)
{
va_list ap;
char *s;
static int enable_indent = 1;
s = prepare_string(fmt,
enable_indent ? test_indent_level : 0,
0);
va_start(ap, fmt);
vfprintf(test_file, s, ap);
va_end(ap);
/*
* If the last char emitted was a newline, enable indentation
* for the next time.
*/
if (s[strlen(s) - 1] == '\n')
enable_indent = 1;
else
enable_indent = 0;
}
/*
* Emit a formatted comment into the test file.
*/
static void
pr_test_comment(char *fmt, ...)
{
va_list ap;
char *s;
s = prepare_string(fmt, test_indent_level, 1);
va_start(ap, fmt);
vfprintf(test_file, s, ap);
va_end(ap);
}
/*
* Return a data literal appropriate for the given type, to use as test value.
* No duplicate values will be got in this function.
*/
static char *
data_value_for_type(ATTR_TYPE *t)
{
char *c_type = t->c_type;
char *bin_array = NULL;
const char *bin_name = "binary_data[";
size_t bin_len = 0;
int count_bit;
int quote;
if (is_string(t)) {
/* If the field is really short, use a tiny string */
if (t->array_dim < 12)
return (data_set[round][0]);
return (data_set[round][1]);
} else if (is_array(t)) {
for (quote = round, count_bit = 1; quote > 0;
quote/=10, count_bit++);
bin_len = strlen(bin_name) + count_bit + 2;
bin_array = (char *)malloc(bin_len);
memset(bin_array, 0, bin_len);
snprintf(bin_array, bin_len, "%s%d%c", bin_name, round, ']');
return (bin_array);
} else if (strcmp(c_type, "char") == 0 ||
strcmp(c_type, "short") == 0 ||
strcmp(c_type, "int") == 0 ||
strcmp(c_type, "long") == 0) {
return (data_set[round][2]);
} else if (strcmp(c_type, "float") == 0 ||
strcmp(c_type, "double") == 0) {
return (data_set[round][3]);
} else {
fprintf(stderr,
"Unexpected C type in schema: %s", c_type);
assert(0);
}
return NULL; /*NOTREACHED*/
}
/*
* This entity operation function is called by the attribute iterator
* when producing test code that defines record instances.
*/
static void
define_records_enter_entop(ENTITY *e)
{
pr_test("%s_data %s_record_array[] = {\n",
e->name, e->name);
test_indent_level++;
for (round = 0; round < CASENUM; round++) {
pr_test("{");
iterate_over_attributes(e, &define_records_fields_attrop);
pr_test("}");
if (round < CASENUM -1)
pr_test(",");
pr_test("\n");
}
test_indent_level--;
}
static void
define_records_exit_entop(ENTITY *e)
{
COMPQUIET(e, NULL);
pr_test("};\n\n");
}
static void
define_records_fields_attrop(ENTITY *e, ATTRIBUTE *a, int first, int last)
{
int get_row_num;
COMPQUIET(first, 0);
if ((e->primary_key != a) && round > 9)
get_row_num = round - 10;
else
get_row_num = round;
if (is_array(a->type) && !is_string(a->type)) {
pr_test("{0}");
} else if (is_string(a->type)) {
if (a->type->array_dim < 12)
pr_test(data_set[get_row_num][0]);
else
pr_test(data_set[get_row_num][1]);
} else if (strcmp(a->type->c_type, "char") == 0 ||
strcmp(a->type->c_type, "short") == 0 ||
strcmp(a->type->c_type, "int") == 0 ||
strcmp(a->type->c_type, "long") == 0) {
pr_test(data_set[get_row_num][2]);
} else if (strcmp(a->type->c_type, "float") == 0 ||
strcmp(a->type->c_type, "double") == 0) {
pr_test(data_set[get_row_num][3]);
} else {
fprintf(stderr,
"Unexpected C type in schema: %s", a->type->c_type);
assert(0);
}
if (!last)
pr_test(", ");
}
/*
* This entity operation function is called by the attribute iterator
* when producing test code that declares record instances.
*/
static void
declare_record_instances_enter_entop(ENTITY *e)
{
pr_test("%s_data %s_record;\n", e->name, e->name);
}
/*
* This entity operation function is called by the attribute iterator
* when producing test code that initialized database handle.
*/
static void
initialize_database_enter_entop(ENTITY *e)
{
pr_test("%s_dbp = NULL;\n", e->name);
}
/*
* This entity operation function is called by the attribute iterator
* when producing test code that initialized index handle.
*/
static void
initialize_index_enter_entop(DB_INDEX *idx)
{
pr_test("%s_dbp = NULL;\n", idx->name);
}
static void
invoke_full_iteration_enter_entop(ENTITY *e)
{
pr_test("count_iteration = 0;\n");
pr_test(
"ret = %s_full_iteration(%s_dbp, %s%s&%s_iteration_callback_test, \n\
\"retrieval of %s record through full iteration\");\n",
e->name, e->name,
e->transactional ? the_schema.environment.name : "",
e->transactional ? "_txnp, " : "",
e->name, e->name);
}
static void
invoke_full_iteration_exit_entop(ENTITY *e)
{
pr_test(
"if (ret != 0) { \n\
printf(\"Full Iteration Error\\n\"); \n\
goto exit_error; \n\
} \n\
printf(\"%s full iteration: %%d\\n\", count_iteration); \n\
assert(count_iteration == %d); \n\
\n\
",
e->name, CASENUM);
}
/*
* This index operation function is called by the attribute iterator
* when producing test code that creates the secondary databases.
*/
static void
invoke_query_iteration_idxop(DB_INDEX *idx)
{
ATTRIBUTE *a = idx->attribute;
pr_test("for (i = 0; i < %d; i++) {\n", CASENUM);
test_indent_level++;
pr_test("count_iteration = 0;\n");
pr_test("%s_query_iteration(%s_dbp, %s%s",
idx->name, idx->name,
idx->primary->transactional ? the_schema.environment.name : "",
idx->primary->transactional ? "_txnp, " : "");
pr_test("%s_record_array[i].%s",
idx->primary->name, a->name);
pr_test(
",\n &%s_iteration_callback_test, \n\
\"retrieval of %s record through %s query\");\n\n",
idx->primary->name, idx->primary->name, idx->name);
pr_test(
"printf(\"%s_record_array[%%d].%s: %%d\\n\", i, count_iteration);\n",
idx->primary->name, a->name,
idx->primary->name, a->name);
if (is_array(a->type) && !is_string(a->type)) {
pr_test("assert(count_iteration == 1);\n");
} else {
pr_test("occurence = 0;\n");
pr_test("for (j = 0; j < %d; j++) {\n", CASENUM);
test_indent_level++;
if (is_string(a->type)) {
pr_test(
"if (strcmp(%s_record_array[j].%s, %s_record_array[i].%s) == 0) {\n",
idx->primary->name, a->name,
idx->primary->name, a->name);
} else if ((strcmp(a->type->c_type, "float") == 0) ||
(strcmp(a->type->c_type, "double") == 0)) {
pr_test(
"if (fabs(%s_record_array[j].%s - %s_record_array[i].%s) <= 0.00001) {\n",
idx->primary->name, a->name,
idx->primary->name, a->name);
} else {
pr_test(
"if (%s_record_array[j].%s == %s_record_array[i].%s) {\n",
idx->primary->name, a->name,
idx->primary->name, a->name);
}
test_indent_level++;
pr_test("occurence++;\n");
test_indent_level--;
pr_test("}\n");
test_indent_level--;
pr_test("}\n");
pr_test("assert(count_iteration == occurence);\n");
}
test_indent_level--;
pr_test("}\n\n");
}
/*
* This next group of entity and attribute operation functions are
* called by the attribute iterator when generating insertion test code.
*/
static void
insertion_test_enter_entop(ENTITY *e)
{
pr_test("ret = %s_insert_fields( %s_dbp, %s%s",
e->name, e->name,
e->transactional ? the_schema.environment.name : "",
e->transactional ? "_txnp, " : "");
}
static void
insertion_test_exit_entop(ENTITY *e)
{
pr_test(
"if (ret != 0) { \n\
printf(\"ERROR IN INSERT NO.%%d record in %s_dbp\\n\", i); \n\
goto exit_error; \n\
} \n\
\n\
",
e->name);
}
static void
insertion_test_attrop(ENTITY *e, ATTRIBUTE *a, int first, int last)
{
if (first)
test_indent_level++;
if (is_array(a->type) && !is_string(a->type))
pr_test("binary_data[i]");
else
pr_test("%s_record_array[i].%s", e->name, a->name);
if (!last)
pr_test(", \n");
else {
pr_test(");\n");
test_indent_level--;
}
}
/*
* This next group of index and attribute operation functions are
* called by the attribute iterator when generating the iteration
* callback function.
*/
static void
callback_function_enter_entop(ENTITY *e)
{
pr_test(
"void %s_iteration_callback_test(void *msg, %s_data *%s_record) \n\
{ \n\
",
e->name, e->name, e->name);
test_indent_level++;
pr_test(
"int i; \n\
int same = 0; \n\
\n\
for (i = 0; i < %d; i++) { \n\
",
CASENUM);
test_indent_level++;
}
static void
callback_function_exit_entop(ENTITY *e)
{
COMPQUIET(e, NULL);
pr_test(") {\n");
test_indent_level--;
pr_test(
"same = 1; \n\
break; \n\
");
test_indent_level--;
pr_test("}\n");
test_indent_level--;
pr_test("}\n\n");
pr_test(
"if (same == 0) \n\
assert(0); \n\
else \n\
count_iteration++; \n\
");
test_indent_level--;
pr_test("}\n\n");
}
static void
callback_function_attrop(ENTITY *e, ATTRIBUTE *a, int first, int last)
{
if (first)
pr_test("if (");
if (is_array(a->type) && !is_string(a->type)) {
pr_test("(compare_binary(%s_record->%s, %s, i) == 0) ",
e->name, a->name, array_dim_name(e, a), a->name);
} else if (is_string(a->type)) {
pr_test(
"(strcmp(%s_record->%s, %s_record_array[i].%s) == 0) ",
e->name, a->name, e->name, a->name);
} else if ((strcmp(a->type->c_type, "float") == 0) ||
(strcmp(a->type->c_type, "double") == 0)) {
pr_test(
"(fabs(%s_record->%s - %s_record_array[i].%s) <= 0.00001) ",
e->name, a->name, e->name, a->name);
} else {
pr_test("(%s_record->%s == %s_record_array[i].%s) ",
e->name, a->name, e->name, a->name);
}
if (!last)
pr_test("&&\n");
if (first)
test_indent_level += 2;
}
/*
* This next group of entity and attribute operation functions are
* called by the attribute iterator when generating retrieval test code
*/
static void
retrieval_test_enter_entop(ENTITY *e)
{
pr_test("ret = get_%s_data( %s_dbp, ", e->name, e->name);
if (e->transactional)
pr_test("%s_txnp, ", the_schema.environment.name);
if (is_array(e->primary_key->type) && !is_string(e->primary_key->type))
pr_test("binary_data[i], ");
else
pr_test("%s_record_array[i].%s, ",
e->name, e->primary_key->name);
pr_test("&%s_record);\n", e->name);
pr_test(
"if (ret != 0) { \n\
printf(\"ERROR IN RETRIEVE NO.%%d record in %s_dbp\\n\", i); \n\
goto exit_error; \n\
} \n\
\n\
",
e->name);
}
static void
retrieval_test_exit_entop(ENTITY *e)
{
COMPQUIET(e, NULL);
pr_test("\n");
}
static void
retrieval_test_attrop(ENTITY *e, ATTRIBUTE *a, int first, int last)
{
COMPQUIET(first, 0);
COMPQUIET(last, 0);
pr_test("assert(");
if (is_array(a->type) && !is_string(a->type)) {
pr_test("compare_binary(%s_record.%s, %s, i) == 0);\n",
e->name, a->name, array_dim_name(e, a));
} else if (is_string(a->type)) {
pr_test(
"strcmp(%s_record.%s, %s_record_array[i].%s) == 0);\n",
e->name, a->name, e->name, a->name);
} else if ((strcmp(a->type->c_type, "float") == 0) ||
(strcmp(a->type->c_type, "double") == 0)) {
pr_test(
"(fabs(%s_record.%s - %s_record_array[i].%s) <= 0.00001));\n",
e->name, a->name, e->name, a->name);
} else {
pr_test("%s_record.%s == %s_record_array[i].%s);\n",
e->name, a->name, e->name, a->name);
}
}
/*
* This entity operation function is
* called by the attribute iterator when generating deletion test code.
*/
static void
deletion_test_enter_entop(ENTITY *e)
{
pr_test("ret = delete_%s_key( %s_dbp, %s%s%s);\n",
e->name, e->name,
e->transactional ? the_schema.environment.name : "",
e->transactional ? "_txnp, " : "",
data_value_for_type(e->primary_key->type));
}
static void
deletion_test_exit_entop(ENTITY *e)
{
ATTRIBUTE *a = e->primary_key;
char *key;
char * return_value;
int i, column;
key = data_value_for_type(a->type);
return_value = "0";
i = 0;
column = 0;
if (is_string(a->type)) {
if (a->type->array_dim < 12)
column = 0;
else
column = 1;
} else if (is_array(a->type)) {
column = CTYPENUM;
} else if (strcmp(a->type->c_type, "char") == 0 ||
strcmp(a->type->c_type, "short") == 0 ||
strcmp(a->type->c_type, "int") == 0 ||
strcmp(a->type->c_type, "long") == 0) {
column = 2;
} else if (strcmp(a->type->c_type, "float") == 0 ||
strcmp(a->type->c_type, "double") == 0) {
column = 3;
} else {
fprintf(stderr,
"Unexpected C type in schema: %s", a->type->c_type);
assert(0);
}
if (column != CTYPENUM) {
while (i < round) {
if (strcmp(data_set[i][column], key) == 0) {
return_value = "DB_NOTFOUND";
break;
}
i++;
}
}
pr_test(
"if (ret == %s) \n\
ret = 0; \n\
else { \n\
printf(\"ERROR IN DELETE NO.%d record in %s_dbp\\n\"); \n\
goto exit_error; \n\
}\n\n",
return_value, round + 1, e->name);
}
/* This entity operation function generates primary database closures. */
static void
close_primary_test_enter_entop(ENTITY *e)
{
pr_test(
"if (%s_dbp != NULL) \n\
%s_dbp->close(%s_dbp, 0); \n\
\n\
",
e->name, e->name, e->name);
}
/* This entity operation function generates secondary database closures. */
static void
close_secondary_test_idxop(DB_INDEX *idx)
{
pr_test(
"if (%s_dbp != NULL) \n\
%s_dbp->close(%s_dbp, 0); \n\
\n\
",
idx->name, idx->name, idx->name);
}
/* This entity operation function generates primary database closures. */
static void
remove_primary_test_enter_entop(ENTITY *e)
{
pr_test("remove_%s_database(%s_envp%s%s%s);\n", e->name,
the_schema.environment.name,
e->transactional ? ", " : "",
e->transactional ? the_schema.environment.name : "",
e->transactional ? "_txnp" : "");
}
/* This entity operation function generates secondary database closures. */
static void
remove_secondary_test_idxop(DB_INDEX *idx)
{
pr_test("remove_%s_index(%s_envp%s%s%s);\n", idx->name,
the_schema.environment.name,
idx->primary->transactional ? ", " : "",
idx->primary->transactional ? the_schema.environment.name : "",
idx->primary->transactional ? "_txnp" : "");
}
|
684a2e84fc07072d0698f0597025d4981ca2e7c8
|
771b8d391585df59d8c7438e21e54976c4180011
|
/include/circuits/Config.h
|
24e7d9b7ef6c9f3f573ee9db298fc3e4473b916e
|
[
"MIT"
] |
permissive
|
cryptobiu/libscapi
|
1f11f92065c1cea418e73b932c9810d374bac060
|
1f70a88548501eaca5fb635194443e7a2b871088
|
refs/heads/master
| 2023-08-10T08:34:21.304797
| 2022-08-16T16:48:20
| 2022-08-16T16:48:20
| 53,246,303
| 186
| 74
|
MIT
| 2023-07-20T11:01:17
| 2016-03-06T08:59:43
|
C++
|
UTF-8
|
C
| false
| false
| 2,498
|
h
|
Config.h
|
/**
* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
* Copyright (c) 2016 LIBSCAPI (http://crypto.biu.ac.il/SCAPI)
* This file is part of the SCAPI project.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*
* We request that any publication and/or code referring to and/or based on SCAPI contain an appropriate citation to SCAPI, including a reference to
* http://crypto.biu.ac.il/SCAPI.
*
* Libscapi uses several open source libraries. Please see these projects for any further licensing issues.
* For more information , See https://github.com/cryptobiu/libscapi/blob/master/LICENSE.MD
*
* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifdef __x86_64__
#include <emmintrin.h>
#elif __aarch64__
#include "../infra/sse2neon.h"
#endif
/**
* A configuration file that uses defines used by other files in the project.
*
* author: Cryptography and Computer Security Research Group Department of Computer Science Bar-Ilan University (Meital Levy)
*/
typedef __m128i block;
#define SIZE_OF_BLOCK 16//size in bytes
#define XOR_GATE 6//the truth table is 0110
#define XOR_NOT_GATE 9// the truth table is 1001, can also use the optimization of FreeXor
#define ONE_GATE 15//the truth table is 1111
#define ZERO_BLOCK _mm_setzero_si128()//a zero block used in many cases
#define is_aligned(POINTER, BYTE_COUNT) (((uintptr_t)(const void *)(POINTER)) % (BYTE_COUNT) == 0)
|
306d7fac3b4a62e9a988f9857b8cccccc50c3160
|
2ef0e696b0b8d1b762a3df21a258406f1e0c73e2
|
/include/EASTL/internal/atomic/compiler/msvc/compiler_msvc_cpu_pause.h
|
5f436b8b73d888cc1f38884d819210cde62f2fff
|
[
"BSD-3-Clause"
] |
permissive
|
electronicarts/EASTL
|
3fdf65152aaadae7c86e94aa482b950494f31c2f
|
05f4b4aef33f2f3ded08f19fa97f5a27ff35ff9f
|
refs/heads/master
| 2023-08-30T16:35:49.267717
| 2023-08-16T17:55:47
| 2023-08-16T17:55:47
| 48,068,902
| 7,952
| 1,216
|
BSD-3-Clause
| 2023-08-16T17:55:48
| 2015-12-15T21:04:13
|
C++
|
UTF-8
|
C
| false
| false
| 783
|
h
|
compiler_msvc_cpu_pause.h
|
/////////////////////////////////////////////////////////////////////////////////
// copyright (c) electronic arts inc. all rights reserved.
/////////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_ATOMIC_INTERNAL_COMPILER_MSVC_CPU_PAUSE_H
#define EASTL_ATOMIC_INTERNAL_COMPILER_MSVC_CPU_PAUSE_H
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
#pragma once
#endif
#if defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)
#define EASTL_COMPILER_ATOMIC_CPU_PAUSE() _mm_pause()
#elif defined(EA_PROCESSOR_ARM32) || defined(EA_PROCESSOR_ARM64)
#define EASTL_COMPILER_ATOMIC_CPU_PAUSE() __yield()
#else
#error Unsupported CPU architecture for EASTL_COMPILER_ATOMIC_CPU_PAUSE
#endif
#endif /* EASTL_ATOMIC_INTERNAL_COMPILER_MSVC_CPU_PAUSE_H */
|
f89a1f9c3ff36f0366c04b997c1cd8c1657eb397
|
a411a55762de11dc2c9d913ff33d2f1477ac02cf
|
/lte/gateway/c/core/oai/tasks/ngap/ngap_amf_handlers.h
|
9dd7837cc976304d7bf1f882212ec378ac696a7b
|
[
"BSD-3-Clause"
] |
permissive
|
magma/magma
|
0dc48c1513d9968bd05fb7589f302c192b7c0f94
|
0e1d895dfe625681229e181fbc2dbad83e13c5cb
|
refs/heads/master
| 2023-09-04T09:31:56.140395
| 2023-08-29T13:54:49
| 2023-08-29T13:54:49
| 170,803,235
| 1,219
| 525
|
NOASSERTION
| 2023-09-07T17:45:42
| 2019-02-15T04:46:24
|
C++
|
UTF-8
|
C
| false
| false
| 6,869
|
h
|
ngap_amf_handlers.h
|
/**
* Copyright 2020 The Magma Authors.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*
* 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.
*/
#pragma once
#include <stdbool.h>
#include "Ngap_Cause.h"
#include "lte/gateway/c/core/common/common_defs.h"
#include "lte/gateway/c/core/oai/common/common_types.h"
#include "lte/gateway/c/core/oai/include/ngap_messages_types.h"
#include "lte/gateway/c/core/oai/include/sctp_messages_types.hpp"
#include "lte/gateway/c/core/oai/lib/itti/intertask_interface.h"
#include "lte/gateway/c/core/oai/tasks/ngap/ngap_amf.h"
#define MAX_NUM_PARTIAL_NG_CONN_RESET 256
const char* ng_gnb_state2str(enum amf_ng_gnb_state_s state);
const char* ngap_direction2str(uint8_t dir);
/** \brief Handle decoded incoming messages from SCTP
* \param assoc_id SCTP association ID
* \param stream Stream number
* \param message_p The message decoded by the ASN1C decoder
* @returns int
**/
status_code_e ngap_amf_handle_message(ngap_state_t* state,
const sctp_assoc_id_t assoc_id,
const sctp_stream_id_t stream,
Ngap_NGAP_PDU_t* message_p);
/** \brief Handle an Ng Setup request message.
* Typically add the gNB in the list of served gNB if not present, simply reset
* UEs association otherwise. NgSetupResponse message is sent in case of success
* or NgSetupFailure if the AMF cannot accept the configuration received.
* \param assoc_id SCTP association ID
* \param stream Stream number
* \param message_p The message decoded by the ASN1C decoder
* @returns int
**/
status_code_e ngap_amf_handle_ng_setup_request(ngap_state_t* state,
const sctp_assoc_id_t assoc_id,
const sctp_stream_id_t stream,
Ngap_NGAP_PDU_t* message_p);
status_code_e ngap_amf_generate_ng_setup_failure(const sctp_assoc_id_t assoc_id,
const Ngap_Cause_PR cause_type,
const long cause_value,
const long time_to_wait);
/** \brief handler to process InitialContextSetup failure
* \param state ngap state
* \param assoc_id SCTP association ID
* \param stream Stream number
* \param message_p message will be encoded by ASN1C encoder
* @returns int
**/
status_code_e ngap_amf_handle_initial_context_setup_failure(
ngap_state_t* state, const sctp_assoc_id_t assoc_id,
const sctp_stream_id_t stream, Ngap_NGAP_PDU_t* message_p);
/** \brief handler to process InitialContextSetup response
* \param state ngap state
* \param assoc_id SCTP association ID
* \param stream Stream number
* \param message_p message will be encoded by ASN1C encoder
* @returns int
**/
status_code_e ngap_amf_handle_initial_context_setup_response(
ngap_state_t* state, const sctp_assoc_id_t assoc_id,
const sctp_stream_id_t stream, Ngap_NGAP_PDU_t* message_p);
/** \brief SCTP layer notifies NGAP of disconnection of a peer
* \param state ngap state
* \param assoc_id SCTP association ID
* \param reset Flag for reset
* @returns int
**/
status_code_e ngap_handle_sctp_disconnection(ngap_state_t* state,
const sctp_assoc_id_t assoc_id,
bool reset);
/** \brief SCTP layer notifies NGAP of new association
* \param state ngap state
* \param sctp_new_peer_p new peer info
* @returns int
**/
status_code_e ngap_handle_new_association(ngap_state_t* state,
sctp_new_peer_t* sctp_new_peer_p);
/** \brief sets the cause for NgSetup Failure
* \param cause_p cause value
* \param cause_type cause type
* @returns int
**/
status_code_e ngap_amf_set_cause(Ngap_Cause_t* cause_p,
const Ngap_Cause_PR cause_type,
const long cause_value);
status_code_e ngap_amf_handle_error_ind_message(ngap_state_t* state,
const sctp_assoc_id_t assoc_id,
const sctp_stream_id_t stream,
Ngap_NGAP_PDU_t* message);
void amf_app_handle_gnb_deregister_ind(
const itti_ngap_gNB_deregistered_ind_t* gNB_deregistered_ind);
void ngap_amf_release_ue_context(ngap_state_t* state,
m5g_ue_description_t* ue_ref_p,
imsi64_t imsi64);
status_code_e ngap_handle_paging_request(
ngap_state_t* state, const itti_ngap_paging_request_t* paging_request,
imsi64_t imsi64);
status_code_e ngap_amf_handle_ue_context_release_request(
ngap_state_t* state, const sctp_assoc_id_t assoc_id,
const sctp_stream_id_t stream, Ngap_NGAP_PDU_t* message_p);
status_code_e ngap_handle_ue_context_release_command(
ngap_state_t* state,
const itti_ngap_ue_context_release_command_t* const
ue_context_release_command_pP,
imsi64_t imsi64);
status_code_e ngap_amf_handle_ue_context_release_complete(
ngap_state_t* state, const sctp_assoc_id_t assoc_id,
const sctp_stream_id_t stream, Ngap_NGAP_PDU_t* message_p);
int ngap_amf_handle_pduSession_setup_response(ngap_state_t* state,
const sctp_assoc_id_t assoc_id,
const sctp_stream_id_t stream,
Ngap_NGAP_PDU_t* pdu);
int ngap_amf_handle_pduSession_modify_response(ngap_state_t* state,
const sctp_assoc_id_t assoc_id,
const sctp_stream_id_t stream,
Ngap_NGAP_PDU_t* pdu);
status_code_e ngap_amf_handle_gnb_reset(ngap_state_t* state,
const sctp_assoc_id_t assoc_id,
const sctp_stream_id_t stream,
Ngap_NGAP_PDU_t* message);
status_code_e ngap_handle_gnb_initiated_reset_ack(
const itti_ngap_gnb_initiated_reset_ack_t* const gnb_reset_ack_p);
bool construct_ngap_amf_full_reset_req(const hash_key_t keyP,
const uint64_t dataP, void* argP,
void** resultP);
|
10522cf0bc95a9d2719810089fa45865016c88a5
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/www/middleman/files/patch-pcre-internal.h
|
cee3c3cf4af4ae66178867dafdb39b8ff66d9253
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 420
|
h
|
patch-pcre-internal.h
|
--- pcre/internal.h.orig Thu Sep 18 21:59:10 2003
+++ pcre/internal.h Thu Sep 18 21:59:30 2003
@@ -38,6 +38,9 @@
/* Get the definitions provided by running "configure" */
#include "config.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
/* To cope with SunOS4 and other systems that lack memmove() but have bcopy(),
define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY
|
8758156ed133eaeb00820a3dee1bafe41b6c2a16
|
31f5cddb9885fc03b5c05fba5f9727b2f775cf47
|
/thirdparty/libicns/config.h
|
6ffe549b2663b826ffd75be044f3be761dabbe50
|
[
"MIT"
] |
permissive
|
timi-liuliang/echo
|
2935a34b80b598eeb2c2039d686a15d42907d6f7
|
d6e40d83c86431a819c6ef4ebb0f930c1b4d0f24
|
refs/heads/master
| 2023-08-17T05:35:08.104918
| 2023-08-11T18:10:35
| 2023-08-11T18:10:35
| 124,620,874
| 822
| 102
|
MIT
| 2021-06-11T14:29:03
| 2018-03-10T04:07:35
|
C++
|
UTF-8
|
C
| false
| false
| 45
|
h
|
config.h
|
#ifndef _CONFIG_H_
#define _CONFIG_H_
#endif
|
911dd3de67c2244b550fef06475a3e1d847a313d
|
e3a97b316fdf07b170341da206163a865f9e812c
|
/vital/bindings/c/error_handle.h
|
30bf5d8d2cf9c6a902f44726b510fde3c15aca8f
|
[
"BSD-3-Clause"
] |
permissive
|
Kitware/kwiver
|
09133ede9d05c33212839cc29d396aa8ca21baaf
|
a422409b83f78f31cda486e448e8009513e75427
|
refs/heads/master
| 2023-08-28T10:41:58.077148
| 2023-07-28T21:18:52
| 2023-07-28T21:18:52
| 23,229,909
| 191
| 92
|
NOASSERTION
| 2023-06-26T17:18:20
| 2014-08-22T15:22:20
|
C++
|
UTF-8
|
C
| false
| false
| 1,541
|
h
|
error_handle.h
|
// This file is part of KWIVER, and is distributed under the
// OSI-approved BSD 3-Clause License. See top-level LICENSE file or
// https://github.com/Kitware/kwiver/blob/master/LICENSE for details.
/**
* \file
* \brief C interface common error handle structure
*/
#ifndef VITAL_C_ERROR_HANDLE_H_
#define VITAL_C_ERROR_HANDLE_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include <vital/bindings/c/vital_c_export.h>
/// Common error handle structure
/**
* When an instance of this structure is passed into a Vital API and an error
* occurs a new string (char*) is allocated for ``message`` and the error_code
* is set to a non-zero value.
*
* If ``message`` is already allocated then the previous memory is first freed.
*
* A single error handle can be reused between multiple API calls, but one
* should check the status between calls and copy the message string before
* reusing the error handle to avoid losing the message.
*/
typedef struct vital_error_handle_s {
int error_code;
char *message;
} vital_error_handle_t;
/// Return a new, empty error handle object.
/**
* \returns New error handle whose error code is set to 0 and message to NULL.
*/
VITAL_C_EXPORT
vital_error_handle_t* vital_eh_new();
/// Destroy the given error handle structure pointer
/**
* This function does nothing if passed a NULL pointer.
*
* \param eh Pointer to the error handle instance to destroy.
*/
VITAL_C_EXPORT
void vital_eh_destroy( vital_error_handle_t *eh );
#ifdef __cplusplus
}
#endif
#endif // VITAL_C_ERROR_HANDLE_H_
|
1bdc5fcc3667283a01ff65a5e467ab8eef4205fe
|
67305fcba68fdf469862aed2959ad1dd5b22a536
|
/examples/28_iot_cloud_ms_azure/packages/azure-iot-sdk-v1.2.9/azure/c-utility/src/sastoken.c
|
389cc6325a7f9faf8203a94a66a5690cabd81a96
|
[
"Apache-2.0",
"MIT",
"GPL-1.0-or-later"
] |
permissive
|
RT-Thread/IoT_Board
|
cdabf100a8d515fbcaa65ab0b72ec67acb0d2c9a
|
2d218a4e06f06dbb356ec00767904f91d00db7cc
|
refs/heads/master
| 2023-09-04T16:51:34.485240
| 2022-01-19T01:26:16
| 2022-01-19T01:26:16
| 161,133,933
| 344
| 238
|
Apache-2.0
| 2023-06-06T04:10:57
| 2018-12-10T07:21:46
|
C
|
UTF-8
|
C
| false
| false
| 15,034
|
c
|
sastoken.c
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "azure_c_shared_utility/gballoc.h"
#include "azure_c_shared_utility/sastoken.h"
#include "azure_c_shared_utility/urlencode.h"
#include "azure_c_shared_utility/hmacsha256.h"
#include "azure_c_shared_utility/base64.h"
#include "azure_c_shared_utility/agenttime.h"
#include "azure_c_shared_utility/strings.h"
#include "azure_c_shared_utility/buffer_.h"
#include "azure_c_shared_utility/xlogging.h"
#include "azure_c_shared_utility/crt_abstractions.h"
static double getExpiryValue(const char* expiryASCII)
{
double value = 0;
size_t i = 0;
for (i = 0; expiryASCII[i] != '\0'; i++)
{
if (expiryASCII[i] >= '0' && expiryASCII[i] <= '9')
{
value = value * 10 + (expiryASCII[i] - '0');
}
else
{
value = 0;
break;
}
}
return value;
}
bool SASToken_Validate(STRING_HANDLE sasToken)
{
bool result;
/*Codes_SRS_SASTOKEN_25_025: [**SASToken_Validate shall get the SASToken value by invoking STRING_c_str on the handle.**]***/
const char* sasTokenArray = STRING_c_str(sasToken);
/* Codes_SRS_SASTOKEN_25_024: [**If handle is NULL then SASToken_Validate shall return false.**] */
/* Codes_SRS_SASTOKEN_25_026: [**If STRING_c_str on handle return NULL then SASToken_Validate shall return false.**] */
if (sasToken == NULL || sasTokenArray == NULL)
{
result = false;
}
else
{
int seStart = -1, seStop = -1;
int srStart = -1, srStop = -1;
int sigStart = -1, sigStop = -1;
int tokenLength = (int)STRING_length(sasToken);
int i;
for (i = 0; i < tokenLength; i++)
{
if (sasTokenArray[i] == 's' && sasTokenArray[i + 1] == 'e' && sasTokenArray[i + 2] == '=') // Look for se=
{
seStart = i + 3;
if (srStart > 0 && srStop < 0)
{
if (sasTokenArray[i - 1] != '&' && sasTokenArray[i - 1] == ' ') // look for either & or space
srStop = i - 1;
else if (sasTokenArray[i - 1] == '&')
srStop = i - 2;
else
seStart = -1; // as the format is not either "&se=" or " se="
}
else if (sigStart > 0 && sigStop < 0)
{
if (sasTokenArray[i - 1] != '&' && sasTokenArray[i - 1] == ' ')
sigStop = i - 1;
else if (sasTokenArray[i - 1] == '&')
sigStop = i - 2;
else
seStart = -1;
}
}
else if (sasTokenArray[i] == 's' && sasTokenArray[i + 1] == 'r' && sasTokenArray[i + 2] == '=') // Look for sr=
{
srStart = i + 3;
if (seStart > 0 && seStop < 0)
{
if (sasTokenArray[i - 1] != '&' && sasTokenArray[i - 1] == ' ')
seStop = i - 1;
else if (sasTokenArray[i - 1] == '&')
seStop = i - 2;
else
srStart = -1;
}
else if (sigStart > 0 && sigStop < 0)
{
if (sasTokenArray[i - 1] != '&' && sasTokenArray[i - 1] == ' ')
sigStop = i - 1;
else if (sasTokenArray[i - 1] == '&')
sigStop = i - 2;
else
srStart = -1;
}
}
else if (sasTokenArray[i] == 's' && sasTokenArray[i + 1] == 'i' && sasTokenArray[i + 2] == 'g' && sasTokenArray[i + 3] == '=') // Look for sig=
{
sigStart = i + 4;
if (srStart > 0 && srStop < 0)
{
if (sasTokenArray[i - 1] != '&' && sasTokenArray[i - 1] == ' ')
srStop = i - 1;
else if (sasTokenArray[i - 1] == '&')
srStop = i - 2;
else
sigStart = -1;
}
else if (seStart > 0 && seStop < 0)
{
if (sasTokenArray[i - 1] != '&' && sasTokenArray[i - 1] == ' ')
seStop = i - 1;
else if (sasTokenArray[i - 1] == '&')
seStop = i - 2;
else
sigStart = -1;
}
}
}
/*Codes_SRS_SASTOKEN_25_027: [**If SASTOKEN does not obey the SASToken format then SASToken_Validate shall return false.**]***/
/*Codes_SRS_SASTOKEN_25_028: [**SASToken_validate shall check for the presence of sr, se and sig from the token and return false if not found**]***/
if (seStart < 0 || srStart < 0 || sigStart < 0)
{
result = false;
}
else
{
if (seStop < 0)
{
seStop = tokenLength;
}
else if (srStop < 0)
{
srStop = tokenLength;
}
else if (sigStop < 0)
{
sigStop = tokenLength;
}
if ((seStop <= seStart) ||
(srStop <= srStart) ||
(sigStop <= sigStart))
{
result = false;
}
else
{
char* expiryASCII = (char*)malloc(seStop - seStart + 1);
/*Codes_SRS_SASTOKEN_25_031: [**If malloc fails during validation then SASToken_Validate shall return false.**]***/
if (expiryASCII == NULL)
{
result = false;
}
else
{
double expiry;
// Add the Null terminator here
memset(expiryASCII, 0, seStop - seStart + 1);
for (i = seStart; i < seStop; i++)
{
// The se contains the expiration values, if a & token is encountered then
// the se field is complete.
if (sasTokenArray[i] == '&')
{
break;
}
expiryASCII[i - seStart] = sasTokenArray[i];
}
expiry = getExpiryValue(expiryASCII);
/*Codes_SRS_SASTOKEN_25_029: [**SASToken_validate shall check for expiry time from token and if token has expired then would return false **]***/
if (expiry <= 0)
{
result = false;
}
else
{
double secSinceEpoch = get_difftime(get_time(NULL), (time_t)0);
if (expiry < secSinceEpoch)
{
/*Codes_SRS_SASTOKEN_25_029: [**SASToken_validate shall check for expiry time from token and if token has expired then would return false **]***/
result = false;
}
else
{
/*Codes_SRS_SASTOKEN_25_030: [**SASToken_validate shall return true only if the format is obeyed and the token has not yet expired **]***/
result = true;
}
}
free(expiryASCII);
}
}
}
}
return result;
}
static STRING_HANDLE construct_sas_token(const char* key, const char* scope, const char* keyname, size_t expiry)
{
STRING_HANDLE result;
char tokenExpirationTime[32] = { 0 };
BUFFER_HANDLE decodedKey;
/*Codes_SRS_SASTOKEN_06_029: [The key parameter is decoded from base64.]*/
if ((decodedKey = Base64_Decoder(key)) == NULL)
{
/*Codes_SRS_SASTOKEN_06_030: [If there is an error in the decoding then SASToken_Create shall return NULL.]*/
LogError("Unable to decode the key for generating the SAS.");
result = NULL;
}
else
{
/*Codes_SRS_SASTOKEN_06_026: [If the conversion to string form fails for any reason then SASToken_Create shall return NULL.]*/
if (size_tToString(tokenExpirationTime, sizeof(tokenExpirationTime), expiry) != 0)
{
LogError("For some reason converting seconds to a string failed. No SAS can be generated.");
result = NULL;
}
else
{
STRING_HANDLE toBeHashed = NULL;
BUFFER_HANDLE hash = NULL;
if (((hash = BUFFER_new()) == NULL) ||
((toBeHashed = STRING_new()) == NULL) ||
((result = STRING_new()) == NULL))
{
LogError("Unable to allocate memory to prepare SAS token.");
result = NULL;
}
else
{
/*Codes_SRS_SASTOKEN_06_009: [The scope is the basis for creating a STRING_HANDLE.]*/
/*Codes_SRS_SASTOKEN_06_010: [A "\n" is appended to that string.]*/
/*Codes_SRS_SASTOKEN_06_011: [tokenExpirationTime is appended to that string.]*/
if ((STRING_concat(toBeHashed, scope) != 0) ||
(STRING_concat(toBeHashed, "\n") != 0) ||
(STRING_concat(toBeHashed, tokenExpirationTime) != 0))
{
LogError("Unable to build the input to the HMAC to prepare SAS token.");
STRING_delete(result);
result = NULL;
}
else
{
STRING_HANDLE base64Signature = NULL;
STRING_HANDLE urlEncodedSignature = NULL;
size_t inLen = STRING_length(toBeHashed);
const unsigned char* inBuf = (const unsigned char*)STRING_c_str(toBeHashed);
size_t outLen = BUFFER_length(decodedKey);
unsigned char* outBuf = BUFFER_u_char(decodedKey);
/*Codes_SRS_SASTOKEN_06_013: [If an error is returned from the HMAC256 function then NULL is returned from SASToken_Create.]*/
/*Codes_SRS_SASTOKEN_06_012: [An HMAC256 hash is calculated using the decodedKey, over toBeHashed.]*/
/*Codes_SRS_SASTOKEN_06_014: [If there are any errors from the following operations then NULL shall be returned.]*/
/*Codes_SRS_SASTOKEN_06_015: [The hash is base 64 encoded.]*/
/*Codes_SRS_SASTOKEN_06_028: [base64Signature shall be url encoded.]*/
/*Codes_SRS_SASTOKEN_06_016: [The string "SharedAccessSignature sr=" is the first part of the result of SASToken_Create.]*/
/*Codes_SRS_SASTOKEN_06_017: [The scope parameter is appended to result.]*/
/*Codes_SRS_SASTOKEN_06_018: [The string "&sig=" is appended to result.]*/
/*Codes_SRS_SASTOKEN_06_019: [The string urlEncodedSignature shall be appended to result.]*/
/*Codes_SRS_SASTOKEN_06_020: [The string "&se=" shall be appended to result.]*/
/*Codes_SRS_SASTOKEN_06_021: [tokenExpirationTime is appended to result.]*/
/*Codes_SRS_SASTOKEN_06_022: [If keyName is non-NULL, the string "&skn=" is appended to result.]*/
/*Codes_SRS_SASTOKEN_06_023: [If keyName is non-NULL, the argument keyName is appended to result.]*/
if ((HMACSHA256_ComputeHash(outBuf, outLen, inBuf, inLen, hash) != HMACSHA256_OK) ||
((base64Signature = Base64_Encoder(hash)) == NULL) ||
((urlEncodedSignature = URL_Encode(base64Signature)) == NULL) ||
(STRING_copy(result, "SharedAccessSignature sr=") != 0) ||
(STRING_concat(result, scope) != 0) ||
(STRING_concat(result, "&sig=") != 0) ||
(STRING_concat_with_STRING(result, urlEncodedSignature) != 0) ||
(STRING_concat(result, "&se=") != 0) ||
(STRING_concat(result, tokenExpirationTime) != 0) ||
((keyname != NULL) && (STRING_concat(result, "&skn=") != 0)) ||
((keyname != NULL) && (STRING_concat(result, keyname) != 0)))
{
LogError("Unable to build the SAS token.");
STRING_delete(result);
result = NULL;
}
else
{
/* everything OK */
}
STRING_delete(base64Signature);
STRING_delete(urlEncodedSignature);
}
}
STRING_delete(toBeHashed);
BUFFER_delete(hash);
}
BUFFER_delete(decodedKey);
}
return result;
}
STRING_HANDLE SASToken_Create(STRING_HANDLE key, STRING_HANDLE scope, STRING_HANDLE keyName, size_t expiry)
{
STRING_HANDLE result;
/*Codes_SRS_SASTOKEN_06_001: [If key is NULL then SASToken_Create shall return NULL.]*/
/*Codes_SRS_SASTOKEN_06_003: [If scope is NULL then SASToken_Create shall return NULL.]*/
/*Codes_SRS_SASTOKEN_06_007: [keyName is optional and can be set to NULL.]*/
if ((key == NULL) ||
(scope == NULL))
{
LogError("Invalid Parameter to SASToken_Create. handle key: %p, handle scope: %p, handle keyName: %p", key, scope, keyName);
result = NULL;
}
else
{
const char* string_key = STRING_c_str(key);
const char* string_scope = STRING_c_str(scope);
const char* string_name = STRING_c_str(keyName);
result = construct_sas_token(string_key, string_scope, string_name, expiry);
}
return result;
}
STRING_HANDLE SASToken_CreateString(const char* key, const char* scope, const char* keyName, size_t expiry)
{
STRING_HANDLE result;
/*Codes_SRS_SASTOKEN_06_001: [If key is NULL then SASToken_Create shall return NULL.]*/
/*Codes_SRS_SASTOKEN_06_003: [If scope is NULL then SASToken_Create shall return NULL.]*/
/*Codes_SRS_SASTOKEN_06_007: [keyName is optional and can be set to NULL.]*/
if ((key == NULL) ||
(scope == NULL))
{
LogError("Invalid Parameter to SASToken_Create. handle key: %p, handle scope: %p, handle keyName: %p", key, scope, keyName);
result = NULL;
}
else
{
result = construct_sas_token(key, scope, keyName, expiry);
}
return result;
}
|
5dda9cb104fc6dc337e227e1e2b2cd8e47eea145
|
376e1818d427b5e4d32fa6dd6c7b71e9fd88afdb
|
/databases/freetds/patches/patch-include_freetds_thread.h
|
6a4d8e9d92eb36ed6345356f97cb3573a5eb378a
|
[] |
no_license
|
NetBSD/pkgsrc
|
a0732c023519650ef821ab89c23ab6ab59e25bdb
|
d042034ec4896cc5b47ed6f2e5b8802d9bc5c556
|
refs/heads/trunk
| 2023-09-01T07:40:12.138283
| 2023-09-01T05:25:19
| 2023-09-01T05:25:19
| 88,439,572
| 321
| 138
| null | 2023-07-12T22:34:14
| 2017-04-16T20:04:15
| null |
UTF-8
|
C
| false
| false
| 423
|
h
|
patch-include_freetds_thread.h
|
$NetBSD: patch-include_freetds_thread.h,v 1.1 2017/09/17 14:57:59 taca Exp $
* Check _REENTRANT, too.
--- include/freetds/thread.h.orig 2016-05-18 20:02:15.000000000 +0000
+++ include/freetds/thread.h
@@ -24,7 +24,7 @@
#undef TDS_HAVE_MUTEX
-#if defined(_THREAD_SAFE) && defined(TDS_HAVE_PTHREAD_MUTEX)
+#if (defined(_REENTRANT) || defined(_THREAD_SAFE)) && defined(TDS_HAVE_PTHREAD_MUTEX)
#include <pthread.h>
|
2c38fd42c55de190af397f3a9620b8728c47b37f
|
f0b6cc929911630ff689d265bca7ef1961a10087
|
/src/index/cfg_index.c
|
1dd8a6345d9b456d244160b41206a93a7e5918f6
|
[
"MIT"
] |
permissive
|
aerospike/act
|
18b63fa351c1513a1092a828a2faee94c07c95c9
|
bb9b87b0ef4a5867d126f237a969bef08e483ed5
|
refs/heads/master
| 2022-11-25T12:23:54.394413
| 2022-11-15T18:42:58
| 2022-11-15T18:42:58
| 6,917,623
| 156
| 50
|
NOASSERTION
| 2022-11-17T21:12:31
| 2012-11-29T08:29:07
|
C
|
UTF-8
|
C
| false
| false
| 9,640
|
c
|
cfg_index.c
|
/*
* cfg_index.c
*
* Copyright (c) 2018-2020 Aerospike, Inc. All rights reserved.
*
* 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.
*/
//==========================================================
// Includes.
//
#include "cfg_index.h"
#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "common/cfg.h"
#include "common/hardware.h"
#include "common/trace.h"
//==========================================================
// Typedefs & constants.
//
static const char TAG_DEVICE_NAMES[] = "device-names";
static const char TAG_FILE_SIZE_MBYTES[] = "file-size-mbytes";
static const char TAG_SERVICE_THREADS[] = "service-threads";
static const char TAG_CACHE_THREADS[] = "cache-threads";
static const char TAG_TEST_DURATION_SEC[] = "test-duration-sec";
static const char TAG_REPORT_INTERVAL_SEC[] = "report-interval-sec";
static const char TAG_MICROSECOND_HISTOGRAMS[] = "microsecond-histograms";
static const char TAG_READ_REQS_PER_SEC[] = "read-reqs-per-sec";
static const char TAG_WRITE_REQS_PER_SEC[] = "write-reqs-per-sec";
static const char TAG_REPLICATION_FACTOR[] = "replication-factor";
static const char TAG_DEFRAG_LWM_PCT[] = "defrag-lwm-pct";
static const char TAG_DISABLE_ODSYNC[] = "disable-odsync";
static const char TAG_MAX_LAG_SEC[] = "max-lag-sec";
static const char TAG_SCHEDULER_MODE[] = "scheduler-mode";
//==========================================================
// Forward declarations.
//
static bool check_configuration();
static bool derive_configuration();
static void echo_configuration();
//==========================================================
// Globals.
//
// Configuration instance, showing non-zero defaults.
index_cfg g_icfg = {
.cache_threads = 8,
.report_interval_us = 1000000,
.replication_factor = 1,
.defrag_lwm_pct = 50,
.max_lag_usec = 1000000 * 10,
.scheduler_mode = "noop"
};
//==========================================================
// Public API.
//
bool
index_configure(int argc, char* argv[])
{
if (argc != 2) {
printf("usage: act_index [config filename]\n");
return false;
}
FILE* config_file = fopen(argv[1], "r");
if (config_file == NULL) {
printf("ERROR: couldn't open config file %s errno %d '%s'\n", argv[1],
errno, act_strerror(errno));
return false;
}
char line[1024];
while (fgets(line, sizeof(line), config_file) != NULL) {
char* comment = strchr(line, '#');
if (comment != NULL) {
*comment = '\0';
}
const char* tag = strtok(line, ":" WHITE_SPACE);
if (tag == NULL) {
continue;
}
if (strcmp(tag, TAG_DEVICE_NAMES) == 0) {
parse_device_names(MAX_NUM_INDEX_DEVICES, g_icfg.device_names,
&g_icfg.num_devices);
}
else if (strcmp(tag, TAG_FILE_SIZE_MBYTES) == 0) {
g_icfg.file_size = (uint64_t)parse_uint32() << 20;
}
else if (strcmp(tag, TAG_SERVICE_THREADS) == 0) {
g_icfg.service_threads = parse_uint32();
}
else if (strcmp(tag, TAG_CACHE_THREADS) == 0) {
g_icfg.cache_threads = parse_uint32();
}
else if (strcmp(tag, TAG_TEST_DURATION_SEC) == 0) {
g_icfg.run_us = (uint64_t)parse_uint32() * 1000000;
}
else if (strcmp(tag, TAG_REPORT_INTERVAL_SEC) == 0) {
g_icfg.report_interval_us = (uint64_t)parse_uint32() * 1000000;
}
else if (strcmp(tag, TAG_MICROSECOND_HISTOGRAMS) == 0) {
g_icfg.us_histograms = parse_yes_no();
}
else if (strcmp(tag, TAG_READ_REQS_PER_SEC) == 0) {
g_icfg.read_reqs_per_sec = parse_uint32();
}
else if (strcmp(tag, TAG_WRITE_REQS_PER_SEC) == 0) {
g_icfg.write_reqs_per_sec = parse_uint32();
}
else if (strcmp(tag, TAG_REPLICATION_FACTOR) == 0) {
g_icfg.replication_factor = parse_uint32();
}
else if (strcmp(tag, TAG_DEFRAG_LWM_PCT) == 0) {
g_icfg.defrag_lwm_pct = parse_uint32();
}
else if (strcmp(tag, TAG_DISABLE_ODSYNC) == 0) {
g_icfg.disable_odsync = parse_yes_no();
}
else if (strcmp(tag, TAG_MAX_LAG_SEC) == 0) {
g_icfg.max_lag_usec = (uint64_t)parse_uint32() * 1000000;
}
else if (strcmp(tag, TAG_SCHEDULER_MODE) == 0) {
g_icfg.scheduler_mode = parse_scheduler_mode();
}
else {
printf("ERROR: ignoring unknown config item '%s'\n", tag);
return false;
}
}
fclose(config_file);
if (! check_configuration() || ! derive_configuration()) {
return false;
}
echo_configuration();
return true;
}
//==========================================================
// Local helpers.
//
static bool
check_configuration()
{
if (g_icfg.num_devices == 0) {
configuration_error(TAG_DEVICE_NAMES);
return false;
}
if (g_icfg.service_threads == 0 &&
(g_icfg.service_threads = 5 * num_cpus()) == 0) {
configuration_error(TAG_SERVICE_THREADS);
return false;
}
if (g_icfg.cache_threads == 0) {
configuration_error(TAG_CACHE_THREADS);
return false;
}
if (g_icfg.run_us == 0) {
configuration_error(TAG_TEST_DURATION_SEC);
return false;
}
if (g_icfg.report_interval_us == 0) {
configuration_error(TAG_REPORT_INTERVAL_SEC);
return false;
}
if (g_icfg.replication_factor == 0) {
configuration_error(TAG_REPLICATION_FACTOR);
return false;
}
if (g_icfg.defrag_lwm_pct >= 100) {
configuration_error(TAG_DEFRAG_LWM_PCT);
return false;
}
return true;
}
static bool
derive_configuration()
{
if (g_icfg.read_reqs_per_sec + g_icfg.write_reqs_per_sec == 0) {
printf("ERROR: %s and %s can't both be zero\n", TAG_READ_REQS_PER_SEC,
TAG_WRITE_REQS_PER_SEC);
return false;
}
// 'replication-factor' > 1 causes replica writes.
uint32_t effective_write_reqs_per_sec =
g_icfg.replication_factor * g_icfg.write_reqs_per_sec;
// On the service threads, we'll have 1 4K device read per read request, and
// 1 4K device read per write request (including replica writes).
g_icfg.service_thread_reads_per_sec =
g_icfg.read_reqs_per_sec + effective_write_reqs_per_sec;
// Load must be enough to calculate service thread rates safely.
if (g_icfg.service_thread_reads_per_sec / g_icfg.service_threads == 0) {
printf("ERROR: load config too small\n");
return false;
}
// On the cache threads, we'll have extra 4K device reads per write request
// due to defrag. We'll also have 1 4K device write per write request, plus
// extras due to defrag. The total 4K device writes is equal to the extra
// 4K device reads (really!), so just keep one number for both.
double cache_thread_reads_and_writes_per_write =
100.0 / (double)(100 - g_icfg.defrag_lwm_pct);
// For example:
// defrag-lwm-pct = 50: r/w-per-write = 100/(100 - 50) = 2.0 (default)
// defrag-lwm-pct = 60: r/w-per-write = 100/(100 - 60) = 2.5
// defrag-lwm-pct = 40: r/w-per-write = 100/(100 - 40) = 1.666...
g_icfg.cache_thread_reads_and_writes_per_sec =
effective_write_reqs_per_sec *
cache_thread_reads_and_writes_per_write;
return true;
}
static void
echo_configuration()
{
printf("ACT-INDEX CONFIGURATION\n");
printf("%s:", TAG_DEVICE_NAMES);
for (uint32_t d = 0; d < g_icfg.num_devices; d++) {
printf(" %s", g_icfg.device_names[d]);
}
printf("\nnum-devices: %" PRIu32 "\n", g_icfg.num_devices);
if (g_icfg.file_size != 0) { // undocumented - don't always expose
printf("%s: %" PRIu64 "\n", TAG_FILE_SIZE_MBYTES,
g_icfg.file_size >> 20);
}
printf("%s: %" PRIu32 "\n", TAG_SERVICE_THREADS,
g_icfg.service_threads);
printf("%s: %" PRIu32 "\n", TAG_CACHE_THREADS,
g_icfg.cache_threads);
printf("%s: %" PRIu64 "\n", TAG_TEST_DURATION_SEC,
g_icfg.run_us / 1000000);
printf("%s: %" PRIu64 "\n", TAG_REPORT_INTERVAL_SEC,
g_icfg.report_interval_us / 1000000);
printf("%s: %s\n", TAG_MICROSECOND_HISTOGRAMS,
g_icfg.us_histograms ? "yes" : "no");
printf("%s: %" PRIu32 "\n", TAG_READ_REQS_PER_SEC,
g_icfg.read_reqs_per_sec);
printf("%s: %" PRIu32 "\n", TAG_WRITE_REQS_PER_SEC,
g_icfg.write_reqs_per_sec);
printf("%s: %" PRIu32 "\n", TAG_REPLICATION_FACTOR,
g_icfg.replication_factor);
printf("%s: %" PRIu32 "\n", TAG_DEFRAG_LWM_PCT,
g_icfg.defrag_lwm_pct);
printf("%s: %s\n", TAG_DISABLE_ODSYNC,
g_icfg.disable_odsync ? "yes" : "no");
printf("%s: %" PRIu64 "\n", TAG_MAX_LAG_SEC,
g_icfg.max_lag_usec / 1000000);
printf("%s: %s\n", TAG_SCHEDULER_MODE,
g_icfg.scheduler_mode);
printf("\nDERIVED CONFIGURATION\n");
printf("service-thread-reads-per-sec: %" PRIu64 "\n",
g_icfg.service_thread_reads_per_sec);
printf("cache-thread-reads-and-writes-per-sec: %" PRIu64 "\n",
g_icfg.cache_thread_reads_and_writes_per_sec);
printf("\n");
}
|
94b770fe15ae82b27b5de72aa990a75ed820702e
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/net/wireless/mwifiex/ie.c
|
e38342f86c515e6e574fbae572e7c51dbe7c8fa8
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 12,872
|
c
|
ie.c
|
/*
* Marvell Wireless LAN device driver: management IE handling- setting and
* deleting IE.
*
* Copyright (C) 2012, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modify this File in
* accordance with the terms and conditions of the License, a copy of which
* is available by writing to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
*
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
* this warranty disclaimer.
*/
#include "main.h"
/* This function checks if current IE index is used by any on other interface.
* Return: -1: yes, current IE index is used by someone else.
* 0: no, current IE index is NOT used by other interface.
*/
static int
mwifiex_ie_index_used_by_other_intf(struct mwifiex_private *priv, u16 idx)
{
int i;
struct mwifiex_adapter *adapter = priv->adapter;
struct mwifiex_ie *ie;
for (i = 0; i < adapter->priv_num; i++) {
if (adapter->priv[i] != priv) {
ie = &adapter->priv[i]->mgmt_ie[idx];
if (ie->mgmt_subtype_mask && ie->ie_length)
return -1;
}
}
return 0;
}
/* Get unused IE index. This index will be used for setting new IE */
static int
mwifiex_ie_get_autoidx(struct mwifiex_private *priv, u16 subtype_mask,
struct mwifiex_ie *ie, u16 *index)
{
u16 mask, len, i;
for (i = 0; i < priv->adapter->max_mgmt_ie_index; i++) {
mask = le16_to_cpu(priv->mgmt_ie[i].mgmt_subtype_mask);
len = le16_to_cpu(ie->ie_length);
if (mask == MWIFIEX_AUTO_IDX_MASK)
continue;
if (mask == subtype_mask) {
if (len > IEEE_MAX_IE_SIZE)
continue;
*index = i;
return 0;
}
if (!priv->mgmt_ie[i].ie_length) {
if (mwifiex_ie_index_used_by_other_intf(priv, i))
continue;
*index = i;
return 0;
}
}
return -1;
}
/* This function prepares IE data buffer for command to be sent to FW */
static int
mwifiex_update_autoindex_ies(struct mwifiex_private *priv,
struct mwifiex_ie_list *ie_list)
{
u16 travel_len, index, mask;
s16 input_len;
struct mwifiex_ie *ie;
u8 *tmp;
input_len = le16_to_cpu(ie_list->len);
travel_len = sizeof(struct host_cmd_tlv);
ie_list->len = 0;
while (input_len > 0) {
ie = (struct mwifiex_ie *)(((u8 *)ie_list) + travel_len);
input_len -= le16_to_cpu(ie->ie_length) + MWIFIEX_IE_HDR_SIZE;
travel_len += le16_to_cpu(ie->ie_length) + MWIFIEX_IE_HDR_SIZE;
index = le16_to_cpu(ie->ie_index);
mask = le16_to_cpu(ie->mgmt_subtype_mask);
if (index == MWIFIEX_AUTO_IDX_MASK) {
/* automatic addition */
if (mwifiex_ie_get_autoidx(priv, mask, ie, &index))
return -1;
if (index == MWIFIEX_AUTO_IDX_MASK)
return -1;
tmp = (u8 *)&priv->mgmt_ie[index].ie_buffer;
memcpy(tmp, &ie->ie_buffer, le16_to_cpu(ie->ie_length));
priv->mgmt_ie[index].ie_length = ie->ie_length;
priv->mgmt_ie[index].ie_index = cpu_to_le16(index);
priv->mgmt_ie[index].mgmt_subtype_mask =
cpu_to_le16(mask);
ie->ie_index = cpu_to_le16(index);
} else {
if (mask != MWIFIEX_DELETE_MASK)
return -1;
/*
* Check if this index is being used on any
* other interface.
*/
if (mwifiex_ie_index_used_by_other_intf(priv, index))
return -1;
ie->ie_length = 0;
memcpy(&priv->mgmt_ie[index], ie,
sizeof(struct mwifiex_ie));
}
le16_add_cpu(&ie_list->len,
le16_to_cpu(priv->mgmt_ie[index].ie_length) +
MWIFIEX_IE_HDR_SIZE);
}
if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP)
return mwifiex_send_cmd_async(priv, HostCmd_CMD_UAP_SYS_CONFIG,
HostCmd_ACT_GEN_SET,
UAP_CUSTOM_IE_I, ie_list);
return 0;
}
/* Copy individual custom IEs for beacon, probe response and assoc response
* and prepare single structure for IE setting.
* This function also updates allocated IE indices from driver.
*/
static int
mwifiex_update_uap_custom_ie(struct mwifiex_private *priv,
struct mwifiex_ie *beacon_ie, u16 *beacon_idx,
struct mwifiex_ie *pr_ie, u16 *probe_idx,
struct mwifiex_ie *ar_ie, u16 *assoc_idx)
{
struct mwifiex_ie_list *ap_custom_ie;
u8 *pos;
u16 len;
int ret;
ap_custom_ie = kzalloc(sizeof(*ap_custom_ie), GFP_KERNEL);
if (!ap_custom_ie)
return -ENOMEM;
ap_custom_ie->type = cpu_to_le16(TLV_TYPE_MGMT_IE);
pos = (u8 *)ap_custom_ie->ie_list;
if (beacon_ie) {
len = sizeof(struct mwifiex_ie) - IEEE_MAX_IE_SIZE +
le16_to_cpu(beacon_ie->ie_length);
memcpy(pos, beacon_ie, len);
pos += len;
le16_add_cpu(&ap_custom_ie->len, len);
}
if (pr_ie) {
len = sizeof(struct mwifiex_ie) - IEEE_MAX_IE_SIZE +
le16_to_cpu(pr_ie->ie_length);
memcpy(pos, pr_ie, len);
pos += len;
le16_add_cpu(&ap_custom_ie->len, len);
}
if (ar_ie) {
len = sizeof(struct mwifiex_ie) - IEEE_MAX_IE_SIZE +
le16_to_cpu(ar_ie->ie_length);
memcpy(pos, ar_ie, len);
pos += len;
le16_add_cpu(&ap_custom_ie->len, len);
}
ret = mwifiex_update_autoindex_ies(priv, ap_custom_ie);
pos = (u8 *)(&ap_custom_ie->ie_list[0].ie_index);
if (beacon_ie && *beacon_idx == MWIFIEX_AUTO_IDX_MASK) {
/* save beacon ie index after auto-indexing */
*beacon_idx = le16_to_cpu(ap_custom_ie->ie_list[0].ie_index);
len = sizeof(*beacon_ie) - IEEE_MAX_IE_SIZE +
le16_to_cpu(beacon_ie->ie_length);
pos += len;
}
if (pr_ie && le16_to_cpu(pr_ie->ie_index) == MWIFIEX_AUTO_IDX_MASK) {
/* save probe resp ie index after auto-indexing */
*probe_idx = *((u16 *)pos);
len = sizeof(*pr_ie) - IEEE_MAX_IE_SIZE +
le16_to_cpu(pr_ie->ie_length);
pos += len;
}
if (ar_ie && le16_to_cpu(ar_ie->ie_index) == MWIFIEX_AUTO_IDX_MASK)
/* save assoc resp ie index after auto-indexing */
*assoc_idx = *((u16 *)pos);
kfree(ap_custom_ie);
return ret;
}
/* This function checks if the vendor specified IE is present in passed buffer
* and copies it to mwifiex_ie structure.
* Function takes pointer to struct mwifiex_ie pointer as argument.
* If the vendor specified IE is present then memory is allocated for
* mwifiex_ie pointer and filled in with IE. Caller should take care of freeing
* this memory.
*/
static int mwifiex_update_vs_ie(const u8 *ies, int ies_len,
struct mwifiex_ie **ie_ptr, u16 mask,
unsigned int oui, u8 oui_type)
{
struct ieee_types_header *vs_ie;
struct mwifiex_ie *ie = *ie_ptr;
const u8 *vendor_ie;
vendor_ie = cfg80211_find_vendor_ie(oui, oui_type, ies, ies_len);
if (vendor_ie) {
if (!*ie_ptr) {
*ie_ptr = kzalloc(sizeof(struct mwifiex_ie),
GFP_KERNEL);
if (!*ie_ptr)
return -ENOMEM;
ie = *ie_ptr;
}
vs_ie = (struct ieee_types_header *)vendor_ie;
memcpy(ie->ie_buffer + le16_to_cpu(ie->ie_length),
vs_ie, vs_ie->len + 2);
le16_add_cpu(&ie->ie_length, vs_ie->len + 2);
ie->mgmt_subtype_mask = cpu_to_le16(mask);
ie->ie_index = cpu_to_le16(MWIFIEX_AUTO_IDX_MASK);
}
*ie_ptr = ie;
return 0;
}
/* This function parses beacon IEs, probe response IEs, association response IEs
* from cfg80211_ap_settings->beacon and sets these IE to FW.
*/
static int mwifiex_set_mgmt_beacon_data_ies(struct mwifiex_private *priv,
struct cfg80211_beacon_data *data)
{
struct mwifiex_ie *beacon_ie = NULL, *pr_ie = NULL, *ar_ie = NULL;
u16 beacon_idx = MWIFIEX_AUTO_IDX_MASK, pr_idx = MWIFIEX_AUTO_IDX_MASK;
u16 ar_idx = MWIFIEX_AUTO_IDX_MASK;
int ret = 0;
if (data->beacon_ies && data->beacon_ies_len) {
mwifiex_update_vs_ie(data->beacon_ies, data->beacon_ies_len,
&beacon_ie, MGMT_MASK_BEACON,
WLAN_OUI_MICROSOFT,
WLAN_OUI_TYPE_MICROSOFT_WPS);
mwifiex_update_vs_ie(data->beacon_ies, data->beacon_ies_len,
&beacon_ie, MGMT_MASK_BEACON,
WLAN_OUI_WFA, WLAN_OUI_TYPE_WFA_P2P);
}
if (data->proberesp_ies && data->proberesp_ies_len) {
mwifiex_update_vs_ie(data->proberesp_ies,
data->proberesp_ies_len, &pr_ie,
MGMT_MASK_PROBE_RESP, WLAN_OUI_MICROSOFT,
WLAN_OUI_TYPE_MICROSOFT_WPS);
mwifiex_update_vs_ie(data->proberesp_ies,
data->proberesp_ies_len, &pr_ie,
MGMT_MASK_PROBE_RESP,
WLAN_OUI_WFA, WLAN_OUI_TYPE_WFA_P2P);
}
if (data->assocresp_ies && data->assocresp_ies_len) {
mwifiex_update_vs_ie(data->assocresp_ies,
data->assocresp_ies_len, &ar_ie,
MGMT_MASK_ASSOC_RESP |
MGMT_MASK_REASSOC_RESP,
WLAN_OUI_MICROSOFT,
WLAN_OUI_TYPE_MICROSOFT_WPS);
mwifiex_update_vs_ie(data->assocresp_ies,
data->assocresp_ies_len, &ar_ie,
MGMT_MASK_ASSOC_RESP |
MGMT_MASK_REASSOC_RESP, WLAN_OUI_WFA,
WLAN_OUI_TYPE_WFA_P2P);
}
if (beacon_ie || pr_ie || ar_ie) {
ret = mwifiex_update_uap_custom_ie(priv, beacon_ie,
&beacon_idx, pr_ie,
&pr_idx, ar_ie, &ar_idx);
if (ret)
goto done;
}
priv->beacon_idx = beacon_idx;
priv->proberesp_idx = pr_idx;
priv->assocresp_idx = ar_idx;
done:
kfree(beacon_ie);
kfree(pr_ie);
kfree(ar_ie);
return ret;
}
/* This function parses different IEs-tail IEs, beacon IEs, probe response IEs,
* association response IEs from cfg80211_ap_settings function and sets these IE
* to FW.
*/
int mwifiex_set_mgmt_ies(struct mwifiex_private *priv,
struct cfg80211_beacon_data *info)
{
struct mwifiex_ie *gen_ie;
struct ieee_types_header *rsn_ie, *wpa_ie = NULL;
u16 rsn_idx = MWIFIEX_AUTO_IDX_MASK, ie_len = 0;
const u8 *vendor_ie;
if (info->tail && info->tail_len) {
gen_ie = kzalloc(sizeof(struct mwifiex_ie), GFP_KERNEL);
if (!gen_ie)
return -ENOMEM;
gen_ie->ie_index = cpu_to_le16(rsn_idx);
gen_ie->mgmt_subtype_mask = cpu_to_le16(MGMT_MASK_BEACON |
MGMT_MASK_PROBE_RESP |
MGMT_MASK_ASSOC_RESP);
rsn_ie = (void *)cfg80211_find_ie(WLAN_EID_RSN,
info->tail, info->tail_len);
if (rsn_ie) {
memcpy(gen_ie->ie_buffer, rsn_ie, rsn_ie->len + 2);
ie_len = rsn_ie->len + 2;
gen_ie->ie_length = cpu_to_le16(ie_len);
}
vendor_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
WLAN_OUI_TYPE_MICROSOFT_WPA,
info->tail,
info->tail_len);
if (vendor_ie) {
wpa_ie = (struct ieee_types_header *)vendor_ie;
memcpy(gen_ie->ie_buffer + ie_len,
wpa_ie, wpa_ie->len + 2);
ie_len += wpa_ie->len + 2;
gen_ie->ie_length = cpu_to_le16(ie_len);
}
if (rsn_ie || wpa_ie) {
if (mwifiex_update_uap_custom_ie(priv, gen_ie, &rsn_idx,
NULL, NULL,
NULL, NULL)) {
kfree(gen_ie);
return -1;
}
priv->rsn_idx = rsn_idx;
}
kfree(gen_ie);
}
return mwifiex_set_mgmt_beacon_data_ies(priv, info);
}
/* This function removes management IE set */
int mwifiex_del_mgmt_ies(struct mwifiex_private *priv)
{
struct mwifiex_ie *beacon_ie = NULL, *pr_ie = NULL;
struct mwifiex_ie *ar_ie = NULL, *rsn_ie = NULL;
int ret = 0;
if (priv->rsn_idx != MWIFIEX_AUTO_IDX_MASK) {
rsn_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL);
if (!rsn_ie)
return -ENOMEM;
rsn_ie->ie_index = cpu_to_le16(priv->rsn_idx);
rsn_ie->mgmt_subtype_mask = cpu_to_le16(MWIFIEX_DELETE_MASK);
rsn_ie->ie_length = 0;
if (mwifiex_update_uap_custom_ie(priv, rsn_ie, &priv->rsn_idx,
NULL, &priv->proberesp_idx,
NULL, &priv->assocresp_idx)) {
ret = -1;
goto done;
}
priv->rsn_idx = MWIFIEX_AUTO_IDX_MASK;
}
if (priv->beacon_idx != MWIFIEX_AUTO_IDX_MASK) {
beacon_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL);
if (!beacon_ie) {
ret = -ENOMEM;
goto done;
}
beacon_ie->ie_index = cpu_to_le16(priv->beacon_idx);
beacon_ie->mgmt_subtype_mask = cpu_to_le16(MWIFIEX_DELETE_MASK);
beacon_ie->ie_length = 0;
}
if (priv->proberesp_idx != MWIFIEX_AUTO_IDX_MASK) {
pr_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL);
if (!pr_ie) {
ret = -ENOMEM;
goto done;
}
pr_ie->ie_index = cpu_to_le16(priv->proberesp_idx);
pr_ie->mgmt_subtype_mask = cpu_to_le16(MWIFIEX_DELETE_MASK);
pr_ie->ie_length = 0;
}
if (priv->assocresp_idx != MWIFIEX_AUTO_IDX_MASK) {
ar_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL);
if (!ar_ie) {
ret = -ENOMEM;
goto done;
}
ar_ie->ie_index = cpu_to_le16(priv->assocresp_idx);
ar_ie->mgmt_subtype_mask = cpu_to_le16(MWIFIEX_DELETE_MASK);
ar_ie->ie_length = 0;
}
if (beacon_ie || pr_ie || ar_ie)
ret = mwifiex_update_uap_custom_ie(priv,
beacon_ie, &priv->beacon_idx,
pr_ie, &priv->proberesp_idx,
ar_ie, &priv->assocresp_idx);
done:
kfree(beacon_ie);
kfree(pr_ie);
kfree(ar_ie);
kfree(rsn_ie);
return ret;
}
|
aed18cb15ed11f44afc77e257420fd2f0ae0c81e
|
7ca8ffcdfb39ab4ffc2d8ff291e46ffabc8db6a2
|
/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jclasses.h
|
0b174e1fecc56146973fb5729da72e495d3fe9b2
|
[
"CC-PDDC",
"CC0-1.0",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"CDDL-1.0",
"GCC-exception-3.1",
"MIT",
"EPL-1.0",
"Classpath-exception-2.0",
"BSD-3-Clause",
"GPL-2.0-only",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-jdom",
"CDDL-1.1",
"BSD-2-Clause",
"LicenseRef-scancode-unknown"
] |
permissive
|
apache/hadoop
|
ea2a4a370dd00d4a3806dd38df5b3cf6fd5b2c64
|
42b4525f75b828bf58170187f030b08622e238ab
|
refs/heads/trunk
| 2023-08-18T07:29:26.346912
| 2023-08-17T16:56:34
| 2023-08-17T16:56:34
| 23,418,517
| 16,088
| 10,600
|
Apache-2.0
| 2023-09-14T16:59:38
| 2014-08-28T07:00:08
|
Java
|
UTF-8
|
C
| false
| false
| 4,509
|
h
|
jclasses.h
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef LIBHDFS_JCLASSES_H
#define LIBHDFS_JCLASSES_H
#include <jni.h>
/**
* Encapsulates logic to cache jclass objects so they can re-used across
* calls to FindClass. Creating jclass objects every time libhdfs has to
* invoke a method can hurt performance. By cacheing jclass objects we avoid
* this overhead.
*
* We use the term "cached" here loosely; jclasses are not truly cached,
* instead they are created once during JVM load and are kept alive until the
* process shutdowns. There is no eviction of jclass objects.
*
* @see https://www.ibm.com/developerworks/library/j-jni/index.html#notc
*/
/**
* Each enum value represents one jclass that is cached. Enum values should
* be passed to getJclass or getName to get the jclass object or class name
* represented by the enum value.
*/
typedef enum {
JC_CONFIGURATION,
JC_PATH,
JC_FILE_SYSTEM,
JC_FS_STATUS,
JC_FILE_UTIL,
JC_BLOCK_LOCATION,
JC_DFS_HEDGED_READ_METRICS,
JC_DISTRIBUTED_FILE_SYSTEM,
JC_FS_DATA_INPUT_STREAM,
JC_FS_DATA_OUTPUT_STREAM,
JC_FILE_STATUS,
JC_FS_PERMISSION,
JC_READ_STATISTICS,
JC_HDFS_DATA_INPUT_STREAM,
JC_FUTURE_DATA_IS_BUILDER,
JC_DOMAIN_SOCKET,
JC_URI,
JC_BYTE_BUFFER,
JC_ENUM_SET,
JC_EXCEPTION_UTILS,
JC_CFUTURE,
// A special marker enum that counts the number of cached jclasses
NUM_CACHED_CLASSES
} CachedJavaClass;
/**
* Internally initializes all jclass objects listed in the CachedJavaClass
* enum. This method is idempotent and thread-safe.
*/
jthrowable initCachedClasses(JNIEnv* env);
/**
* Return the jclass object represented by the given CachedJavaClass
*/
jclass getJclass(CachedJavaClass cachedJavaClass);
/**
* Return the class name represented by the given CachedJavaClass
*/
const char *getClassName(CachedJavaClass cachedJavaClass);
/* Some frequently used HDFS class names */
#define HADOOP_CONF "org/apache/hadoop/conf/Configuration"
#define HADOOP_PATH "org/apache/hadoop/fs/Path"
#define HADOOP_LOCALFS "org/apache/hadoop/fs/LocalFileSystem"
#define HADOOP_FS "org/apache/hadoop/fs/FileSystem"
#define HADOOP_FSSTATUS "org/apache/hadoop/fs/FsStatus"
#define HADOOP_FILEUTIL "org/apache/hadoop/fs/FileUtil"
#define HADOOP_BLK_LOC "org/apache/hadoop/fs/BlockLocation"
#define HADOOP_DFS_HRM "org/apache/hadoop/hdfs/DFSHedgedReadMetrics"
#define HADOOP_DFS "org/apache/hadoop/hdfs/DistributedFileSystem"
#define HADOOP_FSDISTRM "org/apache/hadoop/fs/FSDataInputStream"
#define HADOOP_FSDOSTRM "org/apache/hadoop/fs/FSDataOutputStream"
#define HADOOP_FILESTAT "org/apache/hadoop/fs/FileStatus"
#define HADOOP_FSPERM "org/apache/hadoop/fs/permission/FsPermission"
#define HADOOP_RSTAT "org/apache/hadoop/hdfs/ReadStatistics"
#define HADOOP_HDISTRM "org/apache/hadoop/hdfs/client/HdfsDataInputStream"
#define HADOOP_FDISB "org/apache/hadoop/fs/FutureDataInputStreamBuilder"
#define HADOOP_FS_BLDR "org/apache/hadoop/fs/FSBuilder"
#define HADOOP_RO "org/apache/hadoop/fs/ReadOption"
#define HADOOP_DS "org/apache/hadoop/net/unix/DomainSocket"
/* Some frequently used Java class names */
#define JAVA_NET_ISA "java/net/InetSocketAddress"
#define JAVA_NET_URI "java/net/URI"
#define JAVA_BYTEBUFFER "java/nio/ByteBuffer"
#define JAVA_STRING "java/lang/String"
#define JAVA_ENUMSET "java/util/EnumSet"
#define JAVA_CFUTURE "java/util/concurrent/CompletableFuture"
#define JAVA_TIMEUNIT "java/util/concurrent/TimeUnit"
#define JAVA_OBJECT "java/lang/Object"
/* Some frequently used third-party class names */
#define EXCEPTION_UTILS "org/apache/commons/lang3/exception/ExceptionUtils"
#endif /*LIBHDFS_JCLASSES_H*/
|
268e2f7be315b0bbf8551b0083305591dc458d5b
|
35eeffd7c7b0567d58cbd38738935e5e21c4ffa4
|
/src/main.c
|
85bb9475d4d262c3b0b51208e18d5b9198a1c281
|
[
"LicenseRef-scancode-unknown-license-reference",
"ISC"
] |
permissive
|
francma/wob
|
8b6643295700c073e7feeee759420be4939cd046
|
75a65e6c33e916a5453d705ed5b3b21335587631
|
refs/heads/master
| 2023-04-05T05:08:20.969574
| 2023-02-02T13:30:44
| 2023-02-02T13:30:44
| 196,771,545
| 795
| 63
|
ISC
| 2023-03-17T14:37:26
| 2019-07-13T22:26:59
|
C
|
UTF-8
|
C
| false
| false
| 2,835
|
c
|
main.c
|
#define WOB_FILE "main.c"
#define _POSIX_C_SOURCE 200809L
#include <getopt.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "config.h"
#include "log.h"
#include "wob.h"
int
main(int argc, char **argv)
{
wob_log_use_colors(isatty(STDERR_FILENO));
wob_log_level_warn();
// libc is doing fstat syscall to determine the optimal buffer size and that can be problematic to wob_pledge()
// to solve this problem we can just pass the optimal buffer ourselves
static char stdin_buffer[INPUT_BUFFER_LENGTH];
if (setvbuf(stdin, stdin_buffer, _IOFBF, sizeof(stdin_buffer)) != 0) {
wob_log_error("Failed to set stdin buffer size to %zu", sizeof(stdin_buffer));
return EXIT_FAILURE;
}
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
static struct option long_options[] = {
{"config", required_argument, NULL, 'c'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{"verbose", no_argument, NULL, 'v'},
{0, 0, 0, 0},
};
const char *usage =
"Usage: wob [options]\n"
" -c, --config <config> Specify a config file.\n"
" -v, --verbose Increase verbosity of messages, defaults to errors and warnings only.\n"
" -h, --help Show help message and quit.\n"
" -V, --version Show the version number and quit.\n"
"\n";
int c;
int option_index = 0;
char *wob_config_path = NULL;
while ((c = getopt_long(argc, argv, "hvVc:", long_options, &option_index)) != -1) {
switch (c) {
case 'V':
printf("wob version " WOB_VERSION "\n");
free(wob_config_path);
return EXIT_SUCCESS;
case 'h':
printf("%s", usage);
free(wob_config_path);
return EXIT_SUCCESS;
case 'v':
wob_log_inc_verbosity();
break;
case 'c':
// fail if -c option is given multiple times
if (wob_config_path != NULL) {
free(wob_config_path);
fprintf(stderr, "%s", usage);
return EXIT_FAILURE;
}
free(wob_config_path);
wob_config_path = strdup(optarg);
break;
default:
fprintf(stderr, "%s", usage);
free(wob_config_path);
return EXIT_FAILURE;
}
}
if (wob_config_path == NULL) {
wob_config_path = wob_config_default_path();
}
struct wob_config *config = wob_config_create();
if (wob_config_path != NULL) {
wob_log_info("Using configuration file at %s", wob_config_path);
if (!wob_config_load(config, wob_config_path)) {
wob_config_destroy(config);
free(wob_config_path);
return EXIT_FAILURE;
}
}
char *disable_pledge_env = getenv("WOB_DISABLE_PLEDGE");
if (disable_pledge_env != NULL && strcmp(disable_pledge_env, "0") != 0) {
config->sandbox = false;
}
wob_config_debug(config);
free(wob_config_path);
wob_log_info("wob version %s started", WOB_VERSION);
return wob_run(config);
}
|
a64df030b1f7c4c316774b1334958dbf543022bb
|
62c8d47803da82bc6b7a276e0c54796601c66276
|
/packages/go/protos/update.proto.h
|
ccd0bc58017854e69d46f3757edb99f75f660b65
|
[
"MIT",
"GPL-2.0-or-later",
"GPL-1.0-or-later",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
autc04/executor
|
a01d1c5081251a331067596141422568159a7596
|
ada40683c14d9dfb2a660e52378e9864e0d51357
|
refs/heads/master
| 2023-07-21T14:33:48.612380
| 2023-05-07T21:33:31
| 2023-05-07T21:33:31
| 106,850,181
| 125
| 9
|
MIT
| 2023-07-07T14:12:07
| 2017-10-13T16:48:51
|
C++
|
UTF-8
|
C
| false
| false
| 310
|
h
|
update.proto.h
|
/* update.c */
void drawpartialgrowicon (WindowPtr wp, int update_flag);
void doactivate (EventRecord * ev);
void doupdate (EventRecord * ev);
void changewindow (Str255 s, long dirid, short vrefnum,
void (*f) (WindowPeek, Str255, long, short));
void changehot (ControlHandle c, long todir, short tovol);
|
970d86d6ae8e4cce606a40e1c18bea8c34d1acab
|
035660e8cc10571ebbd0d4393fef063bb7eb98f6
|
/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h
|
e2f739adaf437b54aa2fd698022cbca8de2eb7a9
|
[] |
no_license
|
zeldaret/mm
|
f163a5e7c4314105777369fa7671ce9c2a99922a
|
4ae00e909e74044f05155683b49d2561f91de7ba
|
refs/heads/master
| 2023-08-06T07:22:04.912966
| 2023-08-04T20:36:03
| 2023-08-04T20:36:03
| 247,875,852
| 915
| 328
| null | 2023-09-14T11:48:59
| 2020-03-17T04:03:07
|
C
|
UTF-8
|
C
| false
| false
| 342
|
h
|
z_en_mnk.h
|
#ifndef Z_EN_MNK_H
#define Z_EN_MNK_H
#include "global.h"
#include "z64snap.h"
struct EnMnk;
typedef void (*EnMnkActionFunc)(struct EnMnk*, PlayState*);
typedef struct EnMnk {
/* 0x000 */ PictoActor picto;
/* 0x148 */ char unk_148[0x2A0];
/* 0x3E8 */ EnMnkActionFunc actionFunc;
} EnMnk; // size = 0x3EC
#endif // Z_EN_MNK_H
|
f2e42ef9fc010d26f46da5f6b322611202299f32
|
7d66226a9f5d4585aa068d031f467a620ec42464
|
/solutions/c/spreadsheet/spreadsheet.c
|
8540238dffc3838814411bb8461bc51e68c1edc9
|
[
"MIT"
] |
permissive
|
blakeembrey/code-problems
|
1b96bd0c8be6e072e532d2d291a5cd3e9dffc9bc
|
c473ac5125b9510f859d2619de08cf4277828e46
|
refs/heads/master
| 2023-09-03T00:05:30.763034
| 2022-03-17T00:12:28
| 2022-03-17T00:12:28
| 10,227,799
| 1,577
| 648
|
MIT
| 2023-01-03T12:26:17
| 2013-05-22T19:19:29
|
JavaScript
|
UTF-8
|
C
| false
| false
| 5,483
|
c
|
spreadsheet.c
|
#define _XOPEN_SOURCE 700
#define PCRE2_CODE_UNIT_WIDTH 8
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <pcre2.h>
#include "regex.h"
#include "matrix.h"
#include "stackcalc.h"
static void matrix_size(char *line, int *row, int *col);
static void matrix_readinput(Worksheet *w, char *file);
static void matrix_evaluate_worksheet(Worksheet *w);
static double matrix_evaluate_expression(const Worksheet *w, char *expression, int row, int col);
static int matrix_is_operator(char *val);
int main(int argc, char *argv[])
{
if (argc != 2)
{
printf("Usage: spreadsheet <input file>\n");
exit(1);
}
Worksheet *w = malloc(sizeof(Worksheet));
matrix_readinput(w, argv[1]);
matrix_evaluate_worksheet(w);
closeWorksheet(w);
}
static void matrix_readinput(Worksheet *w, char *file)
{
FILE *fp = fopen(file, "r");
if (fp == NULL)
{
fprintf(stderr, "Cant open input file\n");
exit(1);
}
int colCounter = -1, rowCounter = 0;
char *line = NULL;
size_t read = 0, len = 0;
while((read = getline(&line, &len, fp)) != -1)
{
if(colCounter == -1)
{
int r = 0, c = 0;
// reads the matrix size from the
// first line of the input file
matrix_size(line, &r, &c);
// initilizes the matrix of size r * c
initWorksheet(w, r, c);
}
else
{
setValue(w, rowCounter, colCounter, line);
if (isCyclicRefError(w, rowCounter, colCounter))
{
printf("Cycling dependency starting at row: %d, col: %d\n", rowCounter, colCounter);
exit(1);
}
}
colCounter++;
if (colCounter > 0 && (colCounter % w->cols) == 0)
{
colCounter = 0;
rowCounter++;
}
}
free(line);
fclose(fp);
}
/**
* Reads the matrix size given in the line and stores it in the
* row and col parameters
*/
static void matrix_size(char *line, int *row, int *col)
{
char *token = strtok(line, " ");
*col = atoi(token);
token = strtok(NULL, " ");
*row = atoi(token);
}
static void matrix_evaluate_worksheet(Worksheet *w)
{
for(int i = 0; i < w->rows; i++)
{
for(int j = 0; j< w->cols; j++)
{
char *expression = NULL;
getValue2(w, &expression, i, j);
double d = matrix_evaluate_expression(w, expression, i, j);
printf("Row: %d; Col: %d; Value: %.5f\n", i, j, d);
free(expression);
}
}
}
static double matrix_evaluate_expression(const Worksheet *w, char *expression, int row, int col)
{
if (expression == NULL) return 0;
pcre2_code *re = getCellReferencePattern();
Stack *stack = malloc(sizeof(Stack));
pcre2_match_data *match_data = NULL;
int rc = 0;
char *saveptr = NULL;
char *token = NULL;
expression[strlen(expression) - 1] = '\0';
token = strtok_r(expression, " ", &saveptr);
while(token != NULL)
{
int len = strlen(token);
match_data = pcre2_match_data_create(20, NULL);
rc = pcre2_match(re, (PCRE2_SPTR) token, len, 0, 0, match_data, NULL);
if (rc > 0)
{
CellReference *cellRef = malloc(sizeof(CellReference));
cellRef->cellReference = malloc((sizeof(char) * strlen(token)) + 1);
strcpy(cellRef->cellReference, token);
MatrixLocation *loc = convertToMatrixLocation(cellRef);
char *cellExpression = NULL;
getValue2(w, &cellExpression, loc->row, loc->col);
double result = matrix_evaluate_expression(w, cellExpression, loc->row, loc->col);
Node *node = malloc(sizeof(Node));
node->value = result;
push(stack, node);
free(cellExpression);
free(cellRef->cellReference);
free(cellRef);
free(loc);
}
else
{
if (matrix_is_operator(token))
{
Node *op1 = pop(stack);
Node *op2 = pop(stack);
double val1 = op1->value;
double val2 = op2->value;
double result = 0.0;
if (strcmp(token, "+") == 0) result = val1 + val2;
if (strcmp(token, "-") == 0) result = val2 - val1;
if (strcmp(token, "*") == 0) result = val1 * val2;
if (strcmp(token, "/") == 0) result = val2 / val1;
free(op1);
free(op2);
Node *newValue = malloc(sizeof(Node));
newValue->value = result;
push(stack, newValue);
}
else
{
Node *newValue = malloc(sizeof(Node));
newValue->value = atoi(token);
push(stack, newValue);
}
}
token = strtok_r(NULL, " ", &saveptr);
free(match_data);
}
Node *node = pop(stack);
double retVal = node->value;
free(stack);
free(node);
free(re);
return retVal;
}
static int matrix_is_operator(char *val)
{
if (strcmp(val, "+") == 0 ||
strcmp(val, "-") == 0 ||
strcmp(val, "*") == 0 ||
strcmp(val, "/") == 0)
{
return 1;
}
return 0;
}
|
2f1cca3af4ee15c1b0192e75bc68774a299638ec
|
fdbb74a95924e2677466614f6ab6e2bb13b2a95a
|
/libc/x/xspawn.h
|
e2ad9f6e8041fb0a9ee87b9546e411cc96f57c68
|
[
"ISC"
] |
permissive
|
jart/cosmopolitan
|
fb11b5658939023977060a7c6c71a74093d9cb44
|
0d748ad58e1063dd1f8560f18a0c75293b9415b7
|
refs/heads/master
| 2023-09-06T09:17:29.303607
| 2023-09-02T03:49:13
| 2023-09-02T03:50:18
| 272,457,606
| 11,887
| 435
|
ISC
| 2023-09-14T17:47:58
| 2020-06-15T14:16:13
|
C
|
UTF-8
|
C
| false
| false
| 384
|
h
|
xspawn.h
|
#ifndef COSMOPOLITAN_LIBC_X_XSPAWN_H_
#define COSMOPOLITAN_LIBC_X_XSPAWN_H_
#include "libc/calls/struct/rusage.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int xspawn(struct rusage *);
int xvspawn(void (*)(void *), void *, struct rusage *) returnstwice;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_X_XSPAWN_H_ */
|
896dde7591720ac02b53aa58bcaa7d6ed060ae20
|
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
|
/games/warp/weapon.c
|
33134ca3d7e981d360ab964dde333aae7c6e1582
|
[
"BSD-2-Clause"
] |
permissive
|
NetBSD/src
|
1a9cbc22ed778be638b37869ed4fb5c8dd616166
|
23ee83f7c0aea0777bd89d8ebd7f0cde9880d13c
|
refs/heads/trunk
| 2023-08-31T13:24:58.105962
| 2023-08-27T15:50:47
| 2023-08-27T15:50:47
| 88,439,547
| 656
| 348
| null | 2023-07-20T20:07:24
| 2017-04-16T20:03:43
| null |
UTF-8
|
C
| false
| false
| 16,318
|
c
|
weapon.c
|
/* Header: weapon.c,v 7.0.1.2 86/10/20 14:36:33 lwall Exp */
/* Log: weapon.c,v
* Revision 7.0.1.2 86/10/20 14:36:33 lwall
* Picked some lint.
*
* Revision 7.0.1.1 86/10/16 10:54:42 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:18:08 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "bang.h"
#include "object.h"
#include "move.h"
#include "score.h"
#include "sig.h"
#include "term.h"
#include "them.h"
#include "us.h"
#include "util.h"
#include "INTERN.h"
#include "weapon.h"
void
weapon_init(void)
{
;
}
void
fire_torp(OBJECT *from, int ydir, int xdir)
{
OBJECT *to;
if (from->type == Enemy ||
(from == ent && etorp > 0) ||
(from == base && btorp > 0)) {
to = occupant[(from->posy+from->vely+ydir+YSIZE00)%YSIZE]
[(from->posx+from->velx+xdir+XSIZE00)%XSIZE];
if (from->type != Enemy || !to || to->vely || to->velx) {
if (from->type != Enemy &&
(to = isatorp[from==base][ydir+1][xdir+1])) {
to->vely += ydir;
to->velx += xdir;
}
else {
if (from == ent) {
to = make_object(Torp, '+', from->posy,from->posx,
from->vely+ydir,from->velx+xdir, 0L, 1L,&root);
aretorps++;
isatorp[0][ydir+1][xdir+1] = to;
etorp--;
}
else if (from == base) {
to = make_object(Torp, '+', from->posy,from->posx,
from->vely+ydir,from->velx+xdir, 0L, 1L,&root);
aretorps++;
isatorp[1][ydir+1][xdir+1] = to;
btorp--;
}
else if (from->image == 'G') {
numos++;
to = make_object(Torp, 'o', from->posy,from->posx,
from->vely+ydir,from->velx+xdir, 100L, 1L,&root);
if (madgorns) {
possiblescore += 35;
to->image = '0';
to->mass = 2000;
to->energy = 2000;
}
else if (rand_mod(120)+10 > smarts)
possiblescore += 100;
else {
possiblescore += 200;
to->image = 'O';
}
}
else {
to = make_object(Torp, 'x', from->posy,from->posx,
from->vely+ydir,from->velx+xdir, 0L, 1L,&root);
if (rand_mod(160)+10 > smarts)
possiblescore += 10;
else {
possiblescore += 100;
to->image = 'X';
to->mass = 1000+super*20;
numxes++;
}
}
}
}
}
}
void
attack(OBJECT *attackee)
{
int dx;
int dy;
int curx;
int cury;
int prob;
OBJECT *obj;
bool torps;
bool webnear = false;
bool thru_stars;
int nukey;
int nukex;
int nukedist;
if (attackee) {
if (attackee == nuke) {
if (amb[attackee->posy][attackee->posx] != '~')
return;
nukey = nukex = 0;
nukedist = 100;
}
for (dx= -1; dx<=1 ; dx++) {
for (dy= -1; dy<=1; dy++) {
if (dx||dy) {
cury = attackee->posy;
curx = attackee->posx;
torps = thru_stars = false;
if (massacre || madgorns || !rand_mod(53-super) )
webnear += rand_mod(2);
else
webnear = false;
for (prob = scandist;prob;prob--) {
cury = (cury + dy + YSIZE00) % YSIZE;
curx = (curx + dx + XSIZE00) % XSIZE;
if ((obj = occupant[cury][curx]) != NULL) {
switch (obj->image) {
case 'P': case 'K': case 'R': case ' ':
pot_shot:
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/40+1))
tract(nuke,dy,dx,rand_mod(3)?1:-1);
}
if (rand_mod(51 - sm50) <= prob) {
switch (obj->strategy||thru_stars?0:
rand_mod(ent?4:2)) {
case 1: case 2:
if (-dy + attackee->vely == obj->vely
&& -dx + attackee->velx == obj->velx)
fire_torp(obj,
-dy + attackee->vely,
-dx + attackee->velx);
else
fire_torp(obj,
-dy + attackee->vely - obj->vely,
-dx + attackee->velx - obj->velx);
if (obj->image == ' ')
setimage(obj,
obj->flags & PIRATE ? 'P' : 'R');
break;
case 3: {
int newspeed =
rand_mod(prob<5&&smarts>70?4:3)-1;
obj->vely = -dy * newspeed;
obj->velx = -dx * newspeed;
if (newspeed >= 0 &&
!rand_mod(82-sm80)) {
obj->vely += attackee->vely;
obj->velx += attackee->velx;
}
break;
}
case 0:
if (!torps && obj->energy > 1000) {
fire_phaser(obj, -dy, -dx);
if (smarts > 40 &&
(scandist-prob > 5
|| attackee==base) &&
(massacre || obj->strategy ||
rand_mod(2)))
while (rand_mod(2))
fire_phaser(obj, -dy, -dx);
if (obj->image == ' ')
setimage(obj,
obj->flags&PIRATE ? 'P':'R');
}
if (obj->strategy) {
obj->velx = obj->vely = 0;
if (obj->energy < 1000 ||
bvely || bvelx)
obj->strategy = 0;
}
else if ((attackee==base ||
(cloaking && attackee==ent)
) &&
scandist-prob > 5 &&
!(rand_mod(
ent?antibase*2:antibase)) )
obj->strategy = 1;
break;
}
}
goto bombout;
case 'G':
if (thru_stars && obj->strategy < 7)
goto bombout;
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/40+1))
tract(nuke,dy,dx,rand_mod(3)?1:-1);
goto bombout;
}
if (obj->strategy) {
if (madgorns || !rand_mod(4)) {
obj->vely = attackee->vely;
obj->velx = attackee->velx;
}
obj->strategy += (!torps && deados > 10);
if (obj->strategy > 4)
madgorns = true;
if (!torps && obj->strategy > 5) {
do {
fire_phaser(obj, -dy, -dx);
} while (rand_mod(2));
}
}
else if (numgorns >= numenemies-1 &&
deados > 15+numgorns*5)
obj->strategy = 1;
if (madgorns || rand_mod(51 - sm50) <= prob) {
if (-dy + attackee->vely == obj->vely
&& -dx + attackee->velx == obj->velx)
fire_torp(obj,
-dy + attackee->vely,
-dx + attackee->velx);
else
fire_torp(obj,
-dy + attackee->vely - obj->vely,
-dx + attackee->velx - obj->velx);
}
goto bombout;
case 'T':
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/40+1))
tract(nuke,dy,dx,rand_mod(3)?1:-1);
}
if (thru_stars)
goto bombout;
if (webnear && scandist-prob > 5) {
if (massacre || rand_mod(50) < super) {
if (!torps && obj->energy > 1000) {
fire_phaser(obj, -dy, -dx);
while (!rand_mod(57-sm55))
fire_phaser(obj, -dy, -dx);
}
}
}
goto bombout;
case 'C': case 'c':
if (thru_stars)
goto bombout;
break;
case 'Q': case 'W': case 'Y': case 'U':
case 'I': case 'S': case 'D': case 'H': case 'J':
case 'L': case 'Z': case 'V': case 'M': case 'F':
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/40+1))
tract(nuke,dy,dx,rand_mod(3)?1:-1);
if (rand_mod(2))
goto pot_shot;
}
if (madfriends > 1000) {
madfriends -= 200;
goto pot_shot;
}
/* FALL THROUGH */
case '+':
if (attackee == nuke) {
if (smarts > 70) {
if (
(obj->posx + obj->velx + XSIZE00)%XSIZE
== attackee->posx &&
(obj->posy + obj->vely + YSIZE00)%YSIZE
== attackee->posy ) {
tract(nuke,dy,dx,-1);
}
else
while (!rand_mod(82-sm80))
tract(nuke,dy,dx,-1);
}
else if (smarts > 60 ||
rand_mod(2+scandist-prob) <
rand_mod(smarts/20+1))
tract(nuke,dy,dx,rand_mod(3)?1:-1);
}
torps = false;
thru_stars = false;
break;
case '|': case '-': case '/': case '\\':
if (thru_stars)
goto bombout;
webnear = (scandist-prob < 3);
torps = false;
break;
case 'x':
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/20+1))
tract(nuke,dy,dx,rand_mod(3)?1:-1);
}
if (thru_stars)
goto bombout;
torps = true;
break;
case 'o': case 'O': case '0':
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/20+1))
tract(nuke,dy,dx,rand_mod(3)?1:-1);
}
if (thru_stars)
goto bombout;
torps = true;
if (rand_mod(99+3*scandist) < smarts+3*prob) {
obj->vely = -dy + attackee->vely;
obj->velx = -dx + attackee->velx;
if (obj->flags & STATIC) {/* not a mover? */
obj->flags &= ~STATIC;
obj->prev->next = obj->next;
obj->next->prev = obj->prev;
root.prev->next = obj;
obj->prev = root.prev;
root.prev = obj;
obj->next = &root;
}
}
if (obj->image != '0')
break;
/*FALLTHROUGH*/
case 'X':
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/20+1))
tract(nuke,dy,dx,rand_mod(3)?1:-1);
}
torps = true;
if (thru_stars)
goto bombout;
if (prob == scandist) {
int y, x;
blast[y=(obj->posy+obj->vely+YSIZE00)%YSIZE]
[x=(obj->posx+obj->velx+XSIZE00)%XSIZE]
+= (obj->image == '0' ? 2000 : 200);
yblasted[y] |= 1;
xblasted[x] |= 1;
blasted = true;
}
break;
case 'A':
if (attackee != nuke) {
if (scandist-prob>1 && !rand_mod(51-super))
tract(obj,-dy,-dx,1);
}
/* FALL THROUGH */
case '*': case '@':
if (attackee == nuke) {
if (amb[cury][curx] != '~') {
if (scandist-prob < nukedist) {
nukedist = scandist-prob;
nukey = dy; /* nearest food in */
nukex = dx; /* this direction */
}
if (smarts > 55 && scandist-prob > 8) {
if (rand_mod(30+scandist-prob) <
rand_mod(smarts/20+1))
tract(nuke,dy,dx,1);
}
}
else if (obj->vely || obj->velx) {
tract(nuke,dy,dx,1); /* for looks */
obj->vely = obj->velx = 0;
}
}
if (!thru_stars) {
if (rand_mod(97-sm95))
goto bombout;
else
thru_stars = true;
}
break;
case '<': case '>':
if (attackee == nuke) {
if ((!dy && scandist-prob < 8) ||
rand_mod(2+scandist-prob) <
rand_mod(smarts/20+1) ) {
nuke->mass += 10000;
tract(nuke,dy,dx,-1);
nuke->mass -= 10000;
}
}
goto bombout;
case 'E': case 'B':
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/40+1))
tract(nuke,dy,dx,rand_mod(3)?1:-1);
}
goto bombout;
default:
goto bombout;
}
}
else {
if (thru_stars)
goto bombout;
}
}
bombout: ; /* end of loop */
}
}
}
if (attackee == nuke && nukedist < 100) {/* aim amoeba at nearest */
if (nukey < 0) /* free star */
nukey = 2;
if (nukex < 0)
nukex = 2;
nuke->strategy = nukey + (nukex << 2);
}
}
}
void
fire_phaser(OBJECT *obj, int dy, int dx)
{
int y;
int x;
int skipping;
int size=5000;
int decr = 50, oldy, oldx;
static char curchar[] = "@* ";
if (obj == ent)
decr = 100;
else if (obj == base) {
decr = 1000;
size = 200;
}
if (!dy)
curchar[2] = '-';
else if (!dx)
curchar[2] = '!';
else if (dy == dx)
curchar[2] = '\\';
else
curchar[2] = '/';
if (obj->energy >= decr) {
obj->energy -= decr;
for (
/* initialize */
skipping = (obj != base),
y = (obj->posy+(obj==base?dy*2:dy)+YSIZE00)%YSIZE,
x = (obj->posx+(obj==base?dx*2:dx)+XSIZE00)%XSIZE;
/* while */
size && (!occupant[y][x]||(skipping && occupant[y][x]->type==Star));
/* at end of loop */
y = (y+dy+YSIZE00) % YSIZE,
x = (x+dx+XSIZE00) % XSIZE,
size = size * 3 / 4 ) {
move(y+1,x*2,0);
beg_qwrite();
if (obj == base || obj->image == 'T') {
*filler = '@';
qwrite();
*filler = '#';
qwrite();
*filler = '~';
qwrite();
*filler = '%';
qwrite();
*filler = ':';
qwrite();
*filler = '@';
}
else {
*filler = size >= 500 ?
*curchar : (size >= 50 ?
curchar[1] :
curchar[2]);
}
qwrite();
if (occupant[y][x])
qaddc(occupant[y][x]->image);
else {
if (numamoebas)
qaddc(amb[y][x]);
else
qaddspace();
if (skipping)
skipping = 0;
}
end_qwrite();
}
if (size) {
char img;
assert(occupant[y][x]);
img = occupant[y][x]->image;
if (occupant[y][x]->type == Crusher) {
if (dy)
return;
if (dx==(img == '<' ? 1 : -1) ) {
occupant[y][x]->image =
(occupant[y][x]->velx *= -1) < 0 ? '>' : '<';
return;
}
}
else if (occupant[y][x]->flags & FRIENDLY)
madfriends += 200;
if (numamoebas && amb[y][x] == '~' && smarts % 3 &&
(smarts > 70 || rand_mod(smarts) > rand_mod(20)) ) {
if (size > 10000)
modify_amoeba(y,x,1,'~',10);
else if (size > 1000)
modify_amoeba(y,x,1,'~',7);
else if (size > 50)
modify_amoeba(y,x,1,'~',5);
else
modify_amoeba(y,x,1,'~',2);
if (occupant[y][x] == nuke) {
nuke->strategy = rand_mod(30);
nuke->flags |= COUNTDOWN;
}
return;
}
else {
move(y+1,x*2,0);
beg_qwrite();
if (img == ' ') {
*filler = occupant[y][x]->flags & PIRATE ? 'P' : 'R';
occupant[y][x]->image = *filler;
occupant[y][x]->strategy = 0;
qwrite();
qwrite();
}
else if (img == 'C' || img == 'c') {
cloaked = 0;
img += 2;
occupant[y][x]->image = img;
*filler = img;
qwrite();
qwrite();
}
else if (img == 'K' && size > 50)
occupant[y][x]->strategy = 0;
*filler = '@';
qwrite();
*filler = '#';
qwrite();
*filler = '@';
qwrite();
*filler = '#';
qwrite();
*filler = '@';
qwrite();
qaddc(img);
end_qwrite();
oldy = y;
oldx = x;
y = (occupant[oldy][oldx]->posy + occupant[oldy][oldx]->vely +
YSIZE00) % YSIZE;
x = (occupant[oldy][oldx]->posx + occupant[oldy][oldx]->velx +
XSIZE00) % XSIZE;
if (occupant[y][x] && occupant[y][x]->type == Star) {
y = occupant[oldy][oldx]->posy;
x = occupant[oldy][oldx]->posx;
}
if (obj==base)
blast[y][x] += size>50 ? 15000 : (size>15 ? 1500 : 150);
else if (obj==ent)
blast[y][x] += size*4;
else if (obj->image=='T')
blast[y][x] += 15000;
else
blast[y][x] += size*smarts/25;
yblasted[y] |= 1;
xblasted[x] |= 1;
blasted = true;
}
}
}
}
int
tract(OBJECT *obj, int dy, int dx, int to_or_fro)
{
int y;
int x;
int size=10;
static char ch;
OBJECT *tractee;
if (!dy)
ch = '|';
else if (!dx)
ch = '-';
else if (dy == dx)
ch = '/';
else
ch = '\\';
{
for (
y = (obj->posy+dy+YSIZE00)%YSIZE,
x = (obj->posx+dx+XSIZE00)%XSIZE;
size && (!occupant[y][x]);
y = (y+dy+YSIZE00) % YSIZE, x = (x+dx+XSIZE00) % XSIZE, size--) {
move(y+1,x*2,0);
beg_qwrite();
*filler = ch;
qwrite();
qwrite();
if (numamoebas)
qaddch(amb[y][x]);
else
qaddspace();
end_qwrite();
}
tractee = occupant[y][x];
if (size) {
assert(tractee);
if (numamoebas && obj != nuke && amb[y][x] == '~') {
if (to_or_fro > 0)
modify_amoeba(y,x,2,'~',size);
else
modify_amoeba(y,x,1,' ',size);
}
if (tractee->type != Web &&
(tractee->mass < obj->mass * 5 ||
(tractee->type == Crusher && !dx) ) ) {
if (tractee == ent) {
evely -= dy * to_or_fro;
evelx -= dx * to_or_fro;
}
else if (tractee == base) {
bvely -= dy * to_or_fro;
bvelx -= dx * to_or_fro;
}
else {
tractee->vely -= dy * to_or_fro;
tractee->velx -= dx * to_or_fro;
}
if (tractee->type == Torp ||
tractee->type == Star) {
if (tractee->flags & STATIC) { /* not a mover? */
tractee->flags &= ~STATIC;
tractee->prev->next = tractee->next;
tractee->next->prev = tractee->prev;
root.prev->next = tractee;
tractee->prev = root.prev;
root.prev = tractee;
tractee->next = &root;
}
}
}
else if (tractee->type == Crusher && !dy &&
dx==(tractee->image == '<' ? 1 : -1) ) {
setimage(tractee, (tractee->velx *= -1) < 0 ? '>' : '<');
}
if (tractee->mass * 5 > obj->mass)
return(1);
}
}
return(0);
}
|
f22f0e8cdfd4bc8cf9dfc115e22d4b6ed117f366
|
7b425379c2d00c0cb327d0f4924b0e1afdc6647f
|
/include/caffe/cc/import/import-cuda-lib.h
|
f7c24f712ce389d09eba4a417e53967075fece13
|
[] |
no_license
|
dlunion/CC4.0
|
4f1e07bd724adaebe50f7872ccc73c87e25bc217
|
6fb51e494b6a88f0987b9dd99117ec21766e3aee
|
refs/heads/master
| 2021-04-26T23:10:38.427504
| 2020-01-15T13:11:23
| 2020-01-15T13:11:23
| 123,939,618
| 171
| 76
| null | 2020-01-15T13:11:25
| 2018-03-05T15:29:43
|
C++
|
UTF-8
|
C
| false
| false
| 187
|
h
|
import-cuda-lib.h
|
#pragma once
#pragma comment(lib, "cublas.lib")
#pragma comment(lib, "cuda.lib")
#pragma comment(lib, "curand.lib")
#pragma comment(lib, "cudart.lib")
#pragma comment(lib, "cudnn.lib")
|
c3d9ad53ec85b86fa132a14fe4ab974e12d5cb08
|
bece8b97cdb15988562c8c8dc27a5b58cd3acb90
|
/wizard_spider/Resources/Mimikatz/mimikatz/mimilib/sekurlsadbg/kuhl_m_sekurlsa_nt6.c
|
dc8ab7546a239f16de24d0511a904ec9528658ac
|
[
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
center-for-threat-informed-defense/adversary_emulation_library
|
4382e78f56faa635d5a6cc89bce5b36f3b74476c
|
4b1d1327ebfbd550ba7e5f1b5562c1f3db61311e
|
refs/heads/master
| 2023-08-12T20:08:57.078612
| 2023-07-17T16:54:16
| 2023-07-17T16:54:16
| 259,753,257
| 1,220
| 243
|
Apache-2.0
| 2023-09-06T16:23:00
| 2020-04-28T21:16:54
|
C
|
UTF-8
|
C
| false
| false
| 5,051
|
c
|
kuhl_m_sekurlsa_nt6.c
|
/* Benjamin DELPY `gentilkiwi`
https://blog.gentilkiwi.com
benjamin@gentilkiwi.com
Licence : https://creativecommons.org/licenses/by/4.0/
*/
#include "kuhl_m_sekurlsa_nt6.h"
NTSTATUS kuhl_m_sekurlsa_nt6_KeyInit = STATUS_NOT_FOUND;
KIWI_BCRYPT_GEN_KEY k3Des, kAes;
BYTE InitializationVector[16];
NTSTATUS kuhl_m_sekurlsa_nt6_init()
{
if(!NT_SUCCESS(kuhl_m_sekurlsa_nt6_KeyInit))
kuhl_m_sekurlsa_nt6_KeyInit = kuhl_m_sekurlsa_nt6_LsaInitializeProtectedMemory();
return kuhl_m_sekurlsa_nt6_KeyInit;
}
NTSTATUS kuhl_m_sekurlsa_nt6_clean()
{
if(NT_SUCCESS(kuhl_m_sekurlsa_nt6_KeyInit))
kuhl_m_sekurlsa_nt6_LsaCleanupProtectedMemory();
return STATUS_SUCCESS;
}
NTSTATUS kuhl_m_sekurlsa_nt6_LsaInitializeProtectedMemory()
{
NTSTATUS status = STATUS_NOT_FOUND;
ULONG dwSizeNeeded;
__try
{
status = BCryptOpenAlgorithmProvider(&k3Des.hProvider, BCRYPT_3DES_ALGORITHM, NULL, 0);
if(NT_SUCCESS(status))
{
status = BCryptSetProperty(k3Des.hProvider, BCRYPT_CHAINING_MODE, (PBYTE) BCRYPT_CHAIN_MODE_CBC, sizeof(BCRYPT_CHAIN_MODE_CBC), 0);
if(NT_SUCCESS(status))
{
status = BCryptGetProperty(k3Des.hProvider, BCRYPT_OBJECT_LENGTH, (PBYTE) &k3Des.cbKey, sizeof(k3Des.cbKey), &dwSizeNeeded, 0);
if(NT_SUCCESS(status))
k3Des.pKey = (PBYTE) LocalAlloc(LPTR, k3Des.cbKey);
}
}
if(NT_SUCCESS(status))
{
status = BCryptOpenAlgorithmProvider(&kAes.hProvider, BCRYPT_AES_ALGORITHM, NULL, 0);
if(NT_SUCCESS(status))
{
status = BCryptSetProperty(kAes.hProvider, BCRYPT_CHAINING_MODE, (PBYTE) BCRYPT_CHAIN_MODE_CFB, sizeof(BCRYPT_CHAIN_MODE_CFB), 0);
if(NT_SUCCESS(status))
{
status = BCryptGetProperty(kAes.hProvider, BCRYPT_OBJECT_LENGTH, (PBYTE) &kAes.cbKey, sizeof(kAes.cbKey), &dwSizeNeeded, 0);
if(NT_SUCCESS(status))
kAes.pKey = (PBYTE) LocalAlloc(LPTR, kAes.cbKey);
}
}
}
}
__except(GetExceptionCode() == ERROR_DLL_NOT_FOUND){}
return status;
}
VOID kuhl_m_sekurlsa_nt6_LsaCleanupProtectedMemory()
{
__try
{
if (k3Des.hProvider)
BCryptCloseAlgorithmProvider(k3Des.hProvider, 0);
if (k3Des.hKey)
{
BCryptDestroyKey(k3Des.hKey);
LocalFree(k3Des.pKey);
}
if (kAes.hProvider)
BCryptCloseAlgorithmProvider(kAes.hProvider, 0);
if (kAes.hKey)
{
BCryptDestroyKey(kAes.hKey);
LocalFree(kAes.pKey);
}
}
__except(GetExceptionCode() == ERROR_DLL_NOT_FOUND){}
kuhl_m_sekurlsa_nt6_KeyInit = STATUS_NOT_FOUND;
}
VOID WINAPI kuhl_m_sekurlsa_nt6_LsaUnprotectMemory (IN PVOID Buffer, IN ULONG BufferSize)
{
BCRYPT_KEY_HANDLE *hKey;
BYTE LocalInitializationVector[16];
ULONG cbIV, cbResult;
RtlCopyMemory(LocalInitializationVector, InitializationVector, sizeof(InitializationVector));
if (BufferSize % 8)
{
hKey = &kAes.hKey;
cbIV = sizeof(InitializationVector);
}
else
{
hKey = &k3Des.hKey;
cbIV = sizeof(InitializationVector) / 2;
}
__try
{
BCryptDecrypt(*hKey, (PUCHAR) Buffer, BufferSize, 0, LocalInitializationVector, cbIV, (PUCHAR) Buffer, BufferSize, &cbResult, 0);
}
__except(GetExceptionCode() == ERROR_DLL_NOT_FOUND){}
}
NTSTATUS kuhl_m_sekurlsa_nt6_acquireKeys(ULONG_PTR pInitializationVector, ULONG_PTR phAesKey, ULONG_PTR ph3DesKey)
{
NTSTATUS status = STATUS_NOT_FOUND;
if(ReadMemory(pInitializationVector, InitializationVector, sizeof(InitializationVector), NULL))
if(kuhl_m_sekurlsa_nt6_acquireKey(ph3DesKey, &k3Des) && kuhl_m_sekurlsa_nt6_acquireKey(phAesKey, &kAes))
status = STATUS_SUCCESS;
return status;
}
BOOL kuhl_m_sekurlsa_nt6_acquireKey(ULONG_PTR phKey, PKIWI_BCRYPT_GEN_KEY pGenKey)
{
BOOL status = FALSE;
KIWI_BCRYPT_HANDLE_KEY hKey; PKIWI_HARD_KEY pHardKey;
PVOID ptr, buffer, bufferHardKey;
ULONG taille; LONG offset;
if(NtBuildNumber < KULL_M_WIN_MIN_BUILD_8)
{
taille = sizeof(KIWI_BCRYPT_KEY);
offset = FIELD_OFFSET(KIWI_BCRYPT_KEY, hardkey);
}
else if(NtBuildNumber < KULL_M_WIN_MIN_BUILD_BLUE)
{
taille = sizeof(KIWI_BCRYPT_KEY8);
offset = FIELD_OFFSET(KIWI_BCRYPT_KEY8, hardkey);
}
else
{
taille = sizeof(KIWI_BCRYPT_KEY81);
offset = FIELD_OFFSET(KIWI_BCRYPT_KEY81, hardkey);
}
if(buffer = LocalAlloc(LPTR, taille))
{
if(ReadMemory(phKey, &ptr, sizeof(PVOID), NULL))
{
if(ReadMemory((ULONG_PTR) ptr, &hKey, sizeof(KIWI_BCRYPT_HANDLE_KEY), NULL) && hKey.tag == 'UUUR')
{
if(ReadMemory((ULONG_PTR) hKey.key, buffer, taille, NULL) && ((PKIWI_BCRYPT_KEY) buffer)->tag == 'MSSK') // same as 8
{
pHardKey = (PKIWI_HARD_KEY) ((PBYTE) buffer + offset);
if(bufferHardKey = LocalAlloc(LPTR, pHardKey->cbSecret))
{
if(ReadMemory((ULONG_PTR) hKey.key + offset + FIELD_OFFSET(KIWI_HARD_KEY, data), bufferHardKey, pHardKey->cbSecret, NULL))
{
__try
{
status = NT_SUCCESS(BCryptGenerateSymmetricKey(pGenKey->hProvider, &pGenKey->hKey, pGenKey->pKey, pGenKey->cbKey, (PUCHAR) bufferHardKey, pHardKey->cbSecret, 0));
}
__except(GetExceptionCode() == ERROR_DLL_NOT_FOUND){}
}
LocalFree(bufferHardKey);
}
}
}
}
LocalFree(buffer);
}
return status;
}
|
c54b72f648084d3936bc4b009580858922e539b0
|
35e28d7705773eed54345af4440700522c9d1863
|
/deps/libgdal/gdal/frmts/pcraster/libcsf/putallmv.c
|
a856e0288a204806292d5d3b0f7339a76bed372c
|
[
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"MIT",
"SunPro",
"LicenseRef-scancode-info-zip-2005-02",
"BSD-3-Clause"
] |
permissive
|
naturalatlas/node-gdal
|
0ee3447861bf2d1abc48d4fbdbcf15aba5473a27
|
c83e7858a9ec566cc91d65db74fd07b99789c0f0
|
refs/heads/master
| 2023-09-03T00:11:41.576937
| 2022-03-12T20:41:59
| 2022-03-12T20:41:59
| 19,504,824
| 522
| 122
|
Apache-2.0
| 2022-06-04T20:03:43
| 2014-05-06T18:02:34
|
C++
|
UTF-8
|
C
| false
| false
| 962
|
c
|
putallmv.c
|
#include <stdlib.h>
#include "csf.h"
#include "csfimpl.h"
/* make all cells missing value in map
* RputAllMV writes a missing values to all the cells in a
* map. For this is allocates a buffer to hold one row at a
* time.
* returns 1 if successfully, 0 in case of an error
*/
int RputAllMV(
MAP *m)
{
size_t i,nc,nr;
void *buffer;
CSF_CR cr;
CHECKHANDLE_GOTO(m, error);
if(! WRITE_ENABLE(m))
{
M_ERROR(NOACCESS);
goto error;
}
cr = RgetCellRepr(m);
nc = RgetNrCols(m);
buffer = Rmalloc(m,nc);
if(buffer == NULL)
{
M_ERROR(NOCORE);
goto error;
}
/* Fill buffer with determined Missingvalue*/
SetMemMV(buffer, nc, cr);
nr = RgetNrRows(m);
for(i = 0 ; i < nr; i++)
if (RputRow(m, i, buffer) != nc)
{
M_ERROR(WRITE_ERROR);
goto error_f;
}
CSF_FREE(buffer);
CsfSetVarTypeMV( &(m->raster.minVal), cr);
CsfSetVarTypeMV( &(m->raster.maxVal), cr);
return(1);
error_f:
CSF_FREE(buffer);
error:
return(0);
}
|
800533e80b5f76d4a04bde25b91f6f8a9d038aeb
|
9467e2502183e843a67736800199e31674b1d8f6
|
/HybridCLRData/LocalIl2CppData-OSXEditor/il2cpp/external/mono/mono/utils/mach-support-x86.c
|
d1e0a73492f58934903f4e8e7a220199541d0b41
|
[
"Apache-2.0"
] |
permissive
|
yimengfan/BDFramework.Core
|
3a046fcd755a84ba55d648dd3ad52c37a1cc1a04
|
81380fce8e84367f912777717665b53f074ab617
|
refs/heads/master
| 2023-09-04T10:08:47.644992
| 2023-07-05T16:22:11
| 2023-07-05T16:22:11
| 85,928,537
| 2,421
| 497
|
Apache-2.0
| 2023-03-21T06:56:21
| 2017-03-23T09:03:48
|
C#
|
UTF-8
|
C
| false
| false
| 6,153
|
c
|
mach-support-x86.c
|
/**
* \file
* mach support for x86
*
* Authors:
* Geoff Norton (gnorton@novell.com)
*
* (C) 2010 Novell, Inc.
*/
#include <config.h>
#if defined(__MACH__)
#include <stdint.h>
#include <glib.h>
#include <pthread.h>
#include "utils/mono-sigcontext.h"
#include "mach-support.h"
// For reg numbers
#include <mono/arch/amd64/amd64-codegen.h>
/* Known offsets used for TLS storage*/
/* All OSX versions up to 10.8 */
#define TLS_VECTOR_OFFSET_CATS 0x48
#define TLS_VECTOR_OFFSET_10_9 0xb0
#define TLS_VECTOR_OFFSET_10_11 0x100
/* This is 2 slots less than the known low */
#define TLS_PROBE_LOW_WATERMARK 0x40
/* This is 28 slots above the know high, which is more than the known high-low*/
#define TLS_PROBE_HIGH_WATERMARK 0x120
static int tls_vector_offset;
void *
mono_mach_arch_get_ip (thread_state_t state)
{
x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
return (void *) arch_state->__eip;
}
void *
mono_mach_arch_get_sp (thread_state_t state)
{
x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
return (void *) arch_state->__esp;
}
int
mono_mach_arch_get_mcontext_size ()
{
return sizeof (struct __darwin_mcontext32);
}
void
mono_mach_arch_thread_states_to_mcontext (thread_state_t state, thread_state_t fpstate, void *context)
{
x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
x86_float_state32_t *arch_fpstate = (x86_float_state32_t *) fpstate;
struct __darwin_mcontext32 *ctx = (struct __darwin_mcontext32 *) context;
ctx->__ss = *arch_state;
ctx->__fs = *arch_fpstate;
}
void
mono_mach_arch_mcontext_to_thread_states (void *context, thread_state_t state, thread_state_t fpstate)
{
x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
x86_float_state32_t *arch_fpstate = (x86_float_state32_t *) fpstate;
struct __darwin_mcontext32 *ctx = (struct __darwin_mcontext32 *) context;
*arch_state = ctx->__ss;
*arch_fpstate = ctx->__fs;
}
void
mono_mach_arch_thread_states_to_mono_context (thread_state_t state, thread_state_t fpstate, MonoContext *context)
{
x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
x86_float_state32_t *arch_fpstate = (x86_float_state32_t *) state;
context->eax = arch_state->__eax;
context->ebx = arch_state->__ebx;
context->ecx = arch_state->__ecx;
context->edx = arch_state->__edx;
context->ebp = arch_state->__ebp;
context->esp = arch_state->__esp;
context->esi = arch_state->__edi;
context->edi = arch_state->__esi;
context->eip = arch_state->__eip;
context->fregs [X86_XMM0] = arch_fpstate->__fpu_xmm0;
context->fregs [X86_XMM1] = arch_fpstate->__fpu_xmm1;
context->fregs [X86_XMM2] = arch_fpstate->__fpu_xmm2;
context->fregs [X86_XMM3] = arch_fpstate->__fpu_xmm3;
context->fregs [X86_XMM4] = arch_fpstate->__fpu_xmm4;
context->fregs [X86_XMM5] = arch_fpstate->__fpu_xmm5;
context->fregs [X86_XMM6] = arch_fpstate->__fpu_xmm6;
context->fregs [X86_XMM7] = arch_fpstate->__fpu_xmm7;
}
int
mono_mach_arch_get_thread_state_size ()
{
return sizeof (x86_thread_state32_t);
}
int
mono_mach_arch_get_thread_fpstate_size ()
{
return sizeof (x86_float_state32_t);
}
kern_return_t
mono_mach_arch_get_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count, thread_state_t fpstate, mach_msg_type_number_t *fpcount)
{
#if defined(HOST_WATCHOS)
g_error ("thread_get_state() is not supported by this platform");
#else
x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
x86_float_state32_t *arch_fpstate = (x86_float_state32_t *) fpstate;
kern_return_t ret;
*count = x86_THREAD_STATE32_COUNT;
*fpcount = x86_FLOAT_STATE32_COUNT;
ret = thread_get_state (thread, x86_THREAD_STATE32, (thread_state_t)arch_state, count);
if (ret != KERN_SUCCESS)
return ret;
ret = thread_get_state (thread, x86_FLOAT_STATE32, (thread_state_t)arch_fpstate, fpcount);
return ret;
#endif
}
kern_return_t
mono_mach_arch_set_thread_states (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count, thread_state_t fpstate, mach_msg_type_number_t fpcount)
{
#if defined(HOST_WATCHOS)
g_error ("thread_set_state() is not supported by this platform");
#else
kern_return_t ret;
ret = thread_set_state (thread, x86_THREAD_STATE32, state, count);
if (ret != KERN_SUCCESS)
return ret;
ret = thread_set_state (thread, x86_FLOAT_STATE32, fpstate, fpcount);
return ret;
#endif
}
void *
mono_mach_get_tls_address_from_thread (pthread_t thread, pthread_key_t key)
{
/* OSX stores TLS values in a hidden array inside the pthread_t structure
* They are keyed off a giant array from a known offset into the pointer. This value
* is baked into their pthread_getspecific implementation
*/
intptr_t *p = (intptr_t *) thread;
intptr_t **tsd = (intptr_t **) ((char*)p + tls_vector_offset);
g_assert (tls_vector_offset != -1);
return (void *) &tsd [key];
}
void *
mono_mach_arch_get_tls_value_from_thread (pthread_t thread, guint32 key)
{
return *(void**)mono_mach_get_tls_address_from_thread (thread, key);
}
void
mono_mach_init (pthread_key_t key)
{
int i;
void *old_value = pthread_getspecific (key);
void *canary = (void*)0xDEADBEEFu;
pthread_key_create (&key, NULL);
g_assert (old_value != canary);
pthread_setspecific (key, canary);
/*First we probe for cats*/
tls_vector_offset = TLS_VECTOR_OFFSET_CATS;
if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
goto ok;
tls_vector_offset = TLS_VECTOR_OFFSET_10_9;
if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
goto ok;
tls_vector_offset = TLS_VECTOR_OFFSET_10_11;
if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
goto ok;
/*Fallback to scanning a large range of offsets*/
for (i = TLS_PROBE_LOW_WATERMARK; i <= TLS_PROBE_HIGH_WATERMARK; i += 4) {
tls_vector_offset = i;
if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary) {
g_warning ("Found new TLS offset at %d", i);
goto ok;
}
}
tls_vector_offset = -1;
g_warning ("could not discover the mach TLS offset");
ok:
pthread_setspecific (key, old_value);
}
#endif
|
d66e153db0cd5d4a2aafb6f8447bdc7f1c7145ef
|
3ebe3b35ae141d5fe72ee3a7ad4903552de414c8
|
/src/codeEss.h
|
b06d82a7e66cc578e8f1b38a972f0225d0645721
|
[
"MIT"
] |
permissive
|
LucasMW/Headache
|
570f08682526d8d629b3419ee638dcb59daa03b0
|
3cdadaeb340673c198bf82df8be5c244c972cde0
|
refs/heads/master
| 2022-11-05T01:32:35.038110
| 2022-11-03T15:59:52
| 2022-11-03T15:59:52
| 93,011,882
| 146
| 8
|
MIT
| 2021-09-27T14:59:23
| 2017-06-01T03:17:38
|
C
|
UTF-8
|
C
| false
| false
| 79
|
h
|
codeEss.h
|
#include <stdio.h>
void setOutput(FILE* output);
void codeStr(const char* str);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.