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
5c9169409b6a65c2f9c2d4e4fe2879f8a7579656
eecd5e4c50d8b78a769bcc2675250576bed34066
/src/ksp/pc/interface/ftn-custom/zpcsetf.c
bdedda264477c29a73c701518af4acb11d7803b2
[ "BSD-2-Clause" ]
permissive
petsc/petsc
3b1a04fea71858e0292f9fd4d04ea11618c50969
9c5460f9064ca60dd71a234a1f6faf93e7a6b0c9
refs/heads/main
2023-08-17T20:51:16.507070
2023-08-17T16:08:06
2023-08-17T16:08:06
8,691,401
341
169
NOASSERTION
2023-03-29T11:02:58
2013-03-10T20:55:21
C
UTF-8
C
false
false
731
c
zpcsetf.c
#include <petsc/private/fortranimpl.h> #include <petscpc.h> #if defined(PETSC_HAVE_FORTRAN_CAPS) #define pcsettype_ PCSETTYPE #define pcgettype_ PCGETTYPE #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) #define pcsettype_ pcsettype #define pcgettype_ pcgettype #endif PETSC_EXTERN void pcsettype_(PC *pc, char *type, PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T len) { char *t; FIXCHAR(type, len, t); *ierr = PCSetType(*pc, t); FREECHAR(type, t); } PETSC_EXTERN void pcgettype_(PC *pc, char *name, PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T len) { const char *tname; *ierr = PCGetType(*pc, &tname); *ierr = PetscStrncpy(name, tname, len); if (*ierr) return; FIXRETURNCHAR(PETSC_TRUE, name, len); }
44ef1831f46d8150ceacc3de373d754b67c18226
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
/sys/arch/algor/include/signal.h
e085235cf3d8897759abf7b9234dfa368924d3df
[]
no_license
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
90
h
signal.h
/* $NetBSD: signal.h,v 1.1 2001/05/28 16:22:20 thorpej Exp $ */ #include <mips/signal.h>
eb3157d22a1d7f0ac364fedfe87e1dd048672a60
2a0c1f85790223c74ca97252296d9d269b147b2a
/include/shellanything/sa_action.h
f1d925f987cf02c961d67bb9e07c1d9173ecb281
[ "MIT" ]
permissive
end2endzone/ShellAnything
70fbd7e44a4d22045b5a86e6dc8542c033326d57
5d1cf7d4de6ce6fb039beb2292b73bdd9fc921f5
refs/heads/master
2023-07-07T07:13:05.544789
2023-07-03T16:04:02
2023-07-03T16:04:02
174,607,487
129
24
MIT
2021-09-20T15:19:35
2019-03-08T20:50:10
C++
UTF-8
C
false
false
2,188
h
sa_action.h
/********************************************************************************** * MIT License * * Copyright (c) 2018 Antoine Beauchamp * * 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 SA_API_ACTION_H #define SA_API_ACTION_H #include "shellanything/sa_error.h" #include "shellanything/sa_selection_context.h" #ifdef __cplusplus extern "C" { #if 0 } // do not indent code inside extern C #endif #endif /// <summary> /// Converts a mutable action to an immutable action. /// </summary> /// <param name="action">The mutable object to convert.</param> /// <returns>Returns an immutable action</returns> sa_action_immutable_t sa_action_to_immutable(sa_action_t* action); /// <summary> /// Execute the given action. /// </summary> /// <param name="action">The action structure object.</param> /// <param name="ctx">The context for executing the action.</param> sa_error_t sa_action_execute(sa_action_immutable_t* action, sa_selection_context_immutable_t* ctx); #ifdef __cplusplus #if 0 { // do not indent code inside extern C #endif } // extern "C" #endif #endif //SA_API_CONTEXT_H
816054bde5f79e0b9e860308c7f23310bd3e67f7
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
/SOFTWARE/A64-TERES/linux-a64/drivers/macintosh/therm_adt746x.c
f433521a6f9d91d9ad6c5563866b3b3f30ee09ac
[ "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
16,662
c
therm_adt746x.c
/* * Device driver for the i2c thermostat found on the iBook G4, Albook G4 * * Copyright (C) 2003, 2004 Colin Leroy, Rasmus Rohde, Benjamin Herrenschmidt * * Documentation from 115254175ADT7467_pra.pdf and 3686221171167ADT7460_b.pdf * http://www.onsemi.com/PowerSolutions/product.do?id=ADT7467 * http://www.onsemi.com/PowerSolutions/product.do?id=ADT7460 * */ #include <linux/types.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/delay.h> #include <linux/sched.h> #include <linux/i2c.h> #include <linux/slab.h> #include <linux/init.h> #include <linux/spinlock.h> #include <linux/wait.h> #include <linux/suspend.h> #include <linux/kthread.h> #include <linux/moduleparam.h> #include <linux/freezer.h> #include <linux/of_platform.h> #include <asm/prom.h> #include <asm/machdep.h> #include <asm/io.h> #include <asm/sections.h> #undef DEBUG #define CONFIG_REG 0x40 #define MANUAL_MASK 0xe0 #define AUTO_MASK 0x20 #define INVERT_MASK 0x10 static u8 TEMP_REG[3] = {0x26, 0x25, 0x27}; /* local, sensor1, sensor2 */ static u8 LIMIT_REG[3] = {0x6b, 0x6a, 0x6c}; /* local, sensor1, sensor2 */ static u8 MANUAL_MODE[2] = {0x5c, 0x5d}; static u8 REM_CONTROL[2] = {0x00, 0x40}; static u8 FAN_SPEED[2] = {0x28, 0x2a}; static u8 FAN_SPD_SET[2] = {0x30, 0x31}; static u8 default_limits_local[3] = {70, 50, 70}; /* local, sensor1, sensor2 */ static u8 default_limits_chip[3] = {80, 65, 80}; /* local, sensor1, sensor2 */ static const char *sensor_location[3] = { "?", "?", "?" }; static int limit_adjust; static int fan_speed = -1; static bool verbose; MODULE_AUTHOR("Colin Leroy <colin@colino.net>"); MODULE_DESCRIPTION("Driver for ADT746x thermostat in iBook G4 and " "Powerbook G4 Alu"); MODULE_LICENSE("GPL"); module_param(limit_adjust, int, 0644); MODULE_PARM_DESC(limit_adjust,"Adjust maximum temperatures (50 sensor1, 70 sensor2) " "by N degrees."); module_param(fan_speed, int, 0644); MODULE_PARM_DESC(fan_speed,"Specify starting fan speed (0-255) " "(default 64)"); module_param(verbose, bool, 0); MODULE_PARM_DESC(verbose,"Verbose log operations " "(default 0)"); struct thermostat { struct i2c_client *clt; u8 temps[3]; u8 cached_temp[3]; u8 initial_limits[3]; u8 limits[3]; int last_speed[2]; int last_var[2]; int pwm_inv[2]; struct task_struct *thread; struct platform_device *pdev; enum { ADT7460, ADT7467 } type; }; static void write_both_fan_speed(struct thermostat *th, int speed); static void write_fan_speed(struct thermostat *th, int speed, int fan); static int write_reg(struct thermostat* th, int reg, u8 data) { u8 tmp[2]; int rc; tmp[0] = reg; tmp[1] = data; rc = i2c_master_send(th->clt, (const char *)tmp, 2); if (rc < 0) return rc; if (rc != 2) return -ENODEV; return 0; } static int read_reg(struct thermostat* th, int reg) { u8 reg_addr, data; int rc; reg_addr = (u8)reg; rc = i2c_master_send(th->clt, &reg_addr, 1); if (rc < 0) return rc; if (rc != 1) return -ENODEV; rc = i2c_master_recv(th->clt, (char *)&data, 1); if (rc < 0) return rc; return data; } static int read_fan_speed(struct thermostat *th, u8 addr) { u8 tmp[2]; u16 res; /* should start with low byte */ tmp[1] = read_reg(th, addr); tmp[0] = read_reg(th, addr + 1); res = tmp[1] + (tmp[0] << 8); /* "a value of 0xffff means that the fan has stopped" */ return (res == 0xffff ? 0 : (90000*60)/res); } static void write_both_fan_speed(struct thermostat *th, int speed) { write_fan_speed(th, speed, 0); if (th->type == ADT7460) write_fan_speed(th, speed, 1); } static void write_fan_speed(struct thermostat *th, int speed, int fan) { u8 manual; if (speed > 0xff) speed = 0xff; else if (speed < -1) speed = 0; if (th->type == ADT7467 && fan == 1) return; if (th->last_speed[fan] != speed) { if (verbose) { if (speed == -1) printk(KERN_DEBUG "adt746x: Setting speed to automatic " "for %s fan.\n", sensor_location[fan+1]); else printk(KERN_DEBUG "adt746x: Setting speed to %d " "for %s fan.\n", speed, sensor_location[fan+1]); } } else return; if (speed >= 0) { manual = read_reg(th, MANUAL_MODE[fan]); manual &= ~INVERT_MASK; write_reg(th, MANUAL_MODE[fan], manual | MANUAL_MASK | th->pwm_inv[fan]); write_reg(th, FAN_SPD_SET[fan], speed); } else { /* back to automatic */ if(th->type == ADT7460) { manual = read_reg(th, MANUAL_MODE[fan]) & (~MANUAL_MASK); manual &= ~INVERT_MASK; manual |= th->pwm_inv[fan]; write_reg(th, MANUAL_MODE[fan], manual|REM_CONTROL[fan]); } else { manual = read_reg(th, MANUAL_MODE[fan]); manual &= ~INVERT_MASK; manual |= th->pwm_inv[fan]; write_reg(th, MANUAL_MODE[fan], manual&(~AUTO_MASK)); } } th->last_speed[fan] = speed; } static void read_sensors(struct thermostat *th) { int i = 0; for (i = 0; i < 3; i++) th->temps[i] = read_reg(th, TEMP_REG[i]); } #ifdef DEBUG static void display_stats(struct thermostat *th) { if (th->temps[0] != th->cached_temp[0] || th->temps[1] != th->cached_temp[1] || th->temps[2] != th->cached_temp[2]) { printk(KERN_INFO "adt746x: Temperature infos:" " thermostats: %d,%d,%d;" " limits: %d,%d,%d;" " fan speed: %d RPM\n", th->temps[0], th->temps[1], th->temps[2], th->limits[0], th->limits[1], th->limits[2], read_fan_speed(th, FAN_SPEED[0])); } th->cached_temp[0] = th->temps[0]; th->cached_temp[1] = th->temps[1]; th->cached_temp[2] = th->temps[2]; } #endif static void update_fans_speed (struct thermostat *th) { int lastvar = 0; /* last variation, for iBook */ int i = 0; /* we don't care about local sensor, so we start at sensor 1 */ for (i = 1; i < 3; i++) { int started = 0; int fan_number = (th->type == ADT7460 && i == 2); int var = th->temps[i] - th->limits[i]; if (var > -1) { int step = (255 - fan_speed) / 7; int new_speed = 0; /* hysteresis : change fan speed only if variation is * more than two degrees */ if (abs(var - th->last_var[fan_number]) < 2) continue; started = 1; new_speed = fan_speed + ((var-1)*step); if (new_speed < fan_speed) new_speed = fan_speed; if (new_speed > 255) new_speed = 255; if (verbose) printk(KERN_DEBUG "adt746x: Setting fans speed to %d " "(limit exceeded by %d on %s)\n", new_speed, var, sensor_location[fan_number+1]); write_both_fan_speed(th, new_speed); th->last_var[fan_number] = var; } else if (var < -2) { /* don't stop fan if sensor2 is cold and sensor1 is not * so cold (lastvar >= -1) */ if (i == 2 && lastvar < -1) { if (th->last_speed[fan_number] != 0) if (verbose) printk(KERN_DEBUG "adt746x: Stopping " "fans.\n"); write_both_fan_speed(th, 0); } } lastvar = var; if (started) return; /* we don't want to re-stop the fan * if sensor1 is heating and sensor2 is not */ } } static int monitor_task(void *arg) { struct thermostat* th = arg; set_freezable(); while(!kthread_should_stop()) { try_to_freeze(); msleep_interruptible(2000); #ifndef DEBUG if (fan_speed != -1) read_sensors(th); #else read_sensors(th); #endif if (fan_speed != -1) update_fans_speed(th); #ifdef DEBUG display_stats(th); #endif } return 0; } static void set_limit(struct thermostat *th, int i) { /* Set sensor1 limit higher to avoid powerdowns */ th->limits[i] = default_limits_chip[i] + limit_adjust; write_reg(th, LIMIT_REG[i], th->limits[i]); /* set our limits to normal */ th->limits[i] = default_limits_local[i] + limit_adjust; } #define BUILD_SHOW_FUNC_INT(name, data) \ static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct thermostat *th = dev_get_drvdata(dev); \ return sprintf(buf, "%d\n", data); \ } #define BUILD_SHOW_FUNC_INT_LITE(name, data) \ static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ { \ return sprintf(buf, "%d\n", data); \ } #define BUILD_SHOW_FUNC_STR(name, data) \ static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ { \ return sprintf(buf, "%s\n", data); \ } #define BUILD_SHOW_FUNC_FAN(name, data) \ static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct thermostat *th = dev_get_drvdata(dev); \ return sprintf(buf, "%d (%d rpm)\n", \ th->last_speed[data], \ read_fan_speed(th, FAN_SPEED[data]) \ ); \ } #define BUILD_STORE_FUNC_DEG(name, data) \ static ssize_t store_##name(struct device *dev, struct device_attribute *attr, const char *buf, size_t n) \ { \ struct thermostat *th = dev_get_drvdata(dev); \ int val; \ int i; \ val = simple_strtol(buf, NULL, 10); \ printk(KERN_INFO "Adjusting limits by %d degrees\n", val); \ limit_adjust = val; \ for (i=0; i < 3; i++) \ set_limit(th, i); \ return n; \ } #define BUILD_STORE_FUNC_INT(name, data) \ static ssize_t store_##name(struct device *dev, struct device_attribute *attr, const char *buf, size_t n) \ { \ int val; \ val = simple_strtol(buf, NULL, 10); \ if (val < 0 || val > 255) \ return -EINVAL; \ printk(KERN_INFO "Setting specified fan speed to %d\n", val); \ data = val; \ return n; \ } BUILD_SHOW_FUNC_INT(sensor1_temperature, (read_reg(th, TEMP_REG[1]))) BUILD_SHOW_FUNC_INT(sensor2_temperature, (read_reg(th, TEMP_REG[2]))) BUILD_SHOW_FUNC_INT(sensor1_limit, th->limits[1]) BUILD_SHOW_FUNC_INT(sensor2_limit, th->limits[2]) BUILD_SHOW_FUNC_STR(sensor1_location, sensor_location[1]) BUILD_SHOW_FUNC_STR(sensor2_location, sensor_location[2]) BUILD_SHOW_FUNC_INT_LITE(specified_fan_speed, fan_speed) BUILD_STORE_FUNC_INT(specified_fan_speed,fan_speed) BUILD_SHOW_FUNC_FAN(sensor1_fan_speed, 0) BUILD_SHOW_FUNC_FAN(sensor2_fan_speed, 1) BUILD_SHOW_FUNC_INT_LITE(limit_adjust, limit_adjust) BUILD_STORE_FUNC_DEG(limit_adjust, th) static DEVICE_ATTR(sensor1_temperature, S_IRUGO, show_sensor1_temperature,NULL); static DEVICE_ATTR(sensor2_temperature, S_IRUGO, show_sensor2_temperature,NULL); static DEVICE_ATTR(sensor1_limit, S_IRUGO, show_sensor1_limit, NULL); static DEVICE_ATTR(sensor2_limit, S_IRUGO, show_sensor2_limit, NULL); static DEVICE_ATTR(sensor1_location, S_IRUGO, show_sensor1_location, NULL); static DEVICE_ATTR(sensor2_location, S_IRUGO, show_sensor2_location, NULL); static DEVICE_ATTR(specified_fan_speed, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, show_specified_fan_speed,store_specified_fan_speed); static DEVICE_ATTR(sensor1_fan_speed, S_IRUGO, show_sensor1_fan_speed, NULL); static DEVICE_ATTR(sensor2_fan_speed, S_IRUGO, show_sensor2_fan_speed, NULL); static DEVICE_ATTR(limit_adjust, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, show_limit_adjust, store_limit_adjust); static void thermostat_create_files(struct thermostat *th) { struct device_node *np = th->clt->dev.of_node; struct device *dev; int err; /* To maintain ABI compatibility with userspace, create * the old style platform driver and attach the attributes * to it here */ th->pdev = of_platform_device_create(np, "temperatures", NULL); if (!th->pdev) return; dev = &th->pdev->dev; dev_set_drvdata(dev, th); err = device_create_file(dev, &dev_attr_sensor1_temperature); err |= device_create_file(dev, &dev_attr_sensor2_temperature); err |= device_create_file(dev, &dev_attr_sensor1_limit); err |= device_create_file(dev, &dev_attr_sensor2_limit); err |= device_create_file(dev, &dev_attr_sensor1_location); err |= device_create_file(dev, &dev_attr_sensor2_location); err |= device_create_file(dev, &dev_attr_limit_adjust); err |= device_create_file(dev, &dev_attr_specified_fan_speed); err |= device_create_file(dev, &dev_attr_sensor1_fan_speed); if(th->type == ADT7460) err |= device_create_file(dev, &dev_attr_sensor2_fan_speed); if (err) printk(KERN_WARNING "Failed to create temperature attribute file(s).\n"); } static void thermostat_remove_files(struct thermostat *th) { struct device *dev; if (!th->pdev) return; dev = &th->pdev->dev; device_remove_file(dev, &dev_attr_sensor1_temperature); device_remove_file(dev, &dev_attr_sensor2_temperature); device_remove_file(dev, &dev_attr_sensor1_limit); device_remove_file(dev, &dev_attr_sensor2_limit); device_remove_file(dev, &dev_attr_sensor1_location); device_remove_file(dev, &dev_attr_sensor2_location); device_remove_file(dev, &dev_attr_limit_adjust); device_remove_file(dev, &dev_attr_specified_fan_speed); device_remove_file(dev, &dev_attr_sensor1_fan_speed); if (th->type == ADT7460) device_remove_file(dev, &dev_attr_sensor2_fan_speed); of_device_unregister(th->pdev); } static int probe_thermostat(struct i2c_client *client, const struct i2c_device_id *id) { struct device_node *np = client->dev.of_node; struct thermostat* th; const __be32 *prop; int i, rc, vers, offset = 0; if (!np) return -ENXIO; prop = of_get_property(np, "hwsensor-params-version", NULL); if (!prop) return -ENXIO; vers = be32_to_cpup(prop); printk(KERN_INFO "adt746x: version %d (%ssupported)\n", vers, vers == 1 ? "" : "un"); if (vers != 1) return -ENXIO; if (of_get_property(np, "hwsensor-location", NULL)) { for (i = 0; i < 3; i++) { sensor_location[i] = of_get_property(np, "hwsensor-location", NULL) + offset; if (sensor_location[i] == NULL) sensor_location[i] = ""; printk(KERN_INFO "sensor %d: %s\n", i, sensor_location[i]); offset += strlen(sensor_location[i]) + 1; } } th = kzalloc(sizeof(struct thermostat), GFP_KERNEL); if (!th) return -ENOMEM; i2c_set_clientdata(client, th); th->clt = client; th->type = id->driver_data; rc = read_reg(th, CONFIG_REG); if (rc < 0) { dev_err(&client->dev, "Thermostat failed to read config!\n"); kfree(th); return -ENODEV; } /* force manual control to start the fan quieter */ if (fan_speed == -1) fan_speed = 64; if (th->type == ADT7460) { printk(KERN_INFO "adt746x: ADT7460 initializing\n"); /* The 7460 needs to be started explicitly */ write_reg(th, CONFIG_REG, 1); } else printk(KERN_INFO "adt746x: ADT7467 initializing\n"); for (i = 0; i < 3; i++) { th->initial_limits[i] = read_reg(th, LIMIT_REG[i]); set_limit(th, i); } printk(KERN_INFO "adt746x: Lowering max temperatures from %d, %d, %d" " to %d, %d, %d\n", th->initial_limits[0], th->initial_limits[1], th->initial_limits[2], th->limits[0], th->limits[1], th->limits[2]); /* record invert bit status because fw can corrupt it after suspend */ th->pwm_inv[0] = read_reg(th, MANUAL_MODE[0]) & INVERT_MASK; th->pwm_inv[1] = read_reg(th, MANUAL_MODE[1]) & INVERT_MASK; /* be sure to really write fan speed the first time */ th->last_speed[0] = -2; th->last_speed[1] = -2; th->last_var[0] = -80; th->last_var[1] = -80; if (fan_speed != -1) { /* manual mode, stop fans */ write_both_fan_speed(th, 0); } else { /* automatic mode */ write_both_fan_speed(th, -1); } th->thread = kthread_run(monitor_task, th, "kfand"); if (th->thread == ERR_PTR(-ENOMEM)) { printk(KERN_INFO "adt746x: Kthread creation failed\n"); th->thread = NULL; return -ENOMEM; } thermostat_create_files(th); return 0; } static int remove_thermostat(struct i2c_client *client) { struct thermostat *th = i2c_get_clientdata(client); int i; thermostat_remove_files(th); if (th->thread != NULL) kthread_stop(th->thread); printk(KERN_INFO "adt746x: Putting max temperatures back from " "%d, %d, %d to %d, %d, %d\n", th->limits[0], th->limits[1], th->limits[2], th->initial_limits[0], th->initial_limits[1], th->initial_limits[2]); for (i = 0; i < 3; i++) write_reg(th, LIMIT_REG[i], th->initial_limits[i]); write_both_fan_speed(th, -1); kfree(th); return 0; } static const struct i2c_device_id therm_adt746x_id[] = { { "MAC,adt7460", ADT7460 }, { "MAC,adt7467", ADT7467 }, { } }; MODULE_DEVICE_TABLE(i2c, therm_adt746x_id); static struct i2c_driver thermostat_driver = { .driver = { .name = "therm_adt746x", }, .probe = probe_thermostat, .remove = remove_thermostat, .id_table = therm_adt746x_id, }; static int __init thermostat_init(void) { #ifndef CONFIG_I2C_POWERMAC request_module("i2c-powermac"); #endif return i2c_add_driver(&thermostat_driver); } static void __exit thermostat_exit(void) { i2c_del_driver(&thermostat_driver); } module_init(thermostat_init); module_exit(thermostat_exit);
9e520aca4c8c5e358785d4f9ab38a3cd7fbe0b5f
4b2625fcedffb033b62182b36dc0ee083abee2bd
/contrib/librdns/parse.c
1a9c01838d8f64bac59621f3b49982f89da900df
[ "Apache-2.0" ]
permissive
norbusan/rspamd-debian
00b8d669f1ec68ce43eb2833f34eeedf0aea0d48
e0fa56c74c3101f1328eb4e4361e4e34cdc8ce9e
refs/heads/master
2021-11-06T19:15:32.257224
2021-11-03T22:29:51
2021-11-03T23:12:12
241,289,270
232
2
null
null
null
null
UTF-8
C
false
false
12,244
c
parse.c
/* Copyright (c) 2014, Vsevolod Stakhov * 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. * * THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL 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. */ #include "rdns.h" #include "dns_private.h" #include "parse.h" #include "logger.h" static uint8_t * rdns_decompress_label (uint8_t *begin, uint16_t *len, uint16_t max) { uint16_t offset = (*len); if (offset > max) { return NULL; } *len = *(begin + offset); return begin + offset; } #define UNCOMPRESS_DNS_OFFSET(p) (((*(p)) ^ DNS_COMPRESSION_BITS) << 8) + *((p) + 1) uint8_t * rdns_request_reply_cmp (struct rdns_request *req, uint8_t *in, int len) { uint8_t *p, *c, *l1, *l2; uint16_t len1, len2; int decompressed = 0; struct rdns_resolver *resolver = req->resolver; /* QR format: * labels - len:octets * null label - 0 * class - 2 octets * type - 2 octets */ /* In p we would store current position in reply and in c - position in request */ p = in; c = req->packet + req->pos; for (;;) { /* Get current label */ len1 = *p; len2 = *c; if (p - in > len) { rdns_info ("invalid dns reply"); return NULL; } /* This may be compressed, so we need to decompress it */ if (len1 & DNS_COMPRESSION_BITS) { len1 = UNCOMPRESS_DNS_OFFSET(p); l1 = rdns_decompress_label (in, &len1, len); if (l1 == NULL) { return NULL; } decompressed ++; l1 ++; p += 2; } else { l1 = ++p; p += len1; } if (len2 & DNS_COMPRESSION_BITS) { len2 = UNCOMPRESS_DNS_OFFSET(c); l2 = rdns_decompress_label (c, &len2, len); if (l2 == NULL) { rdns_info ("invalid DNS pointer, cannot decompress"); return NULL; } decompressed ++; l2 ++; c += 2; } else { l2 = ++c; c += len2; } if (len1 != len2) { return NULL; } if (len1 == 0) { break; } if (memcmp (l1, l2, len1) != 0) { return NULL; } if (decompressed == 2) { break; } } /* p now points to the end of QR section */ /* Compare class and type */ if (memcmp (p, c, sizeof (uint16_t) * 2) == 0) { req->pos = c - req->packet + sizeof (uint16_t) * 2; return p + sizeof (uint16_t) * 2; } return NULL; } #define MAX_RECURSION_LEVEL 10 bool rdns_parse_labels (struct rdns_resolver *resolver, uint8_t *in, char **target, uint8_t **pos, struct rdns_reply *rep, int *remain, bool make_name) { uint16_t namelen = 0; uint8_t *p = *pos, *begin = *pos, *l, *t, *end = *pos + *remain, *new_pos = *pos; uint16_t llen; int length = *remain, new_remain = *remain; int ptrs = 0, labels = 0; bool got_compression = false; /* First go through labels and calculate name length */ while (p - begin < length) { if (ptrs > MAX_RECURSION_LEVEL) { rdns_info ("dns pointers are nested too much"); return false; } llen = *p; if (llen == 0) { if (!got_compression) { /* In case of compression we have already decremented the processing position */ new_remain -= sizeof (uint8_t); new_pos += sizeof (uint8_t); } break; } else if ((llen & DNS_COMPRESSION_BITS)) { if (end - p > 1) { ptrs ++; llen = UNCOMPRESS_DNS_OFFSET(p); l = rdns_decompress_label (in, &llen, end - in); if (l == NULL) { rdns_info ("invalid DNS pointer"); return false; } if (!got_compression) { /* Our label processing is finished actually */ new_remain -= sizeof (uint16_t); new_pos += sizeof (uint16_t); got_compression = true; } if (l < in || l > begin + length) { rdns_info ("invalid pointer in DNS packet"); return false; } begin = l; length = end - begin; p = l + *l + 1; namelen += *l; labels ++; } else { rdns_info ("DNS packet has incomplete compressed label, input length: %d bytes, remain: %d", *remain, new_remain); return false; } } else { namelen += llen; p += llen + 1; labels ++; if (!got_compression) { new_remain -= llen + 1; new_pos += llen + 1; } } } if (!make_name) { goto end; } *target = malloc (namelen + labels + 3); t = (uint8_t *)*target; p = *pos; begin = *pos; length = *remain; /* Now copy labels to name */ while (p - begin < length) { llen = *p; if (llen == 0) { break; } else if (llen & DNS_COMPRESSION_BITS) { llen = UNCOMPRESS_DNS_OFFSET(p); l = rdns_decompress_label (in, &llen, end - in); if (l == NULL) { goto end; } begin = l; length = end - begin; p = l + *l + 1; memcpy (t, l + 1, *l); t += *l; *t ++ = '.'; } else { memcpy (t, p + 1, *p); t += *p; *t ++ = '.'; p += *p + 1; } } if (t > (uint8_t *)*target) { *(t - 1) = '\0'; } else { /* Handle empty labels */ **target = '\0'; } end: *remain = new_remain; *pos = new_pos; return true; } #define GET8(x) do {(x) = ((*p)); p += sizeof (uint8_t); *remain -= sizeof (uint8_t); } while(0) #define GET16(x) do {(x) = ((*p) << 8) + *(p + 1); p += sizeof (uint16_t); *remain -= sizeof (uint16_t); } while(0) #define GET32(x) do {(x) = ((*p) << 24) + ((*(p + 1)) << 16) + ((*(p + 2)) << 8) + *(p + 3); p += sizeof (uint32_t); *remain -= sizeof (uint32_t); } while(0) #define SKIP(type) do { p += sizeof(type); *remain -= sizeof(type); } while (0) int rdns_parse_rr (struct rdns_resolver *resolver, uint8_t *in, struct rdns_reply_entry *elt, uint8_t **pos, struct rdns_reply *rep, int *remain) { uint8_t *p = *pos, parts; uint16_t type, datalen, txtlen, copied; int32_t ttl; bool parsed = false; /* Skip the whole name */ if (!rdns_parse_labels (resolver, in, NULL, &p, rep, remain, false)) { rdns_info ("bad RR name"); return -1; } if (*remain < (int)sizeof (uint16_t) * 6) { rdns_info ("stripped dns reply: %d bytes remain; domain %s", *remain, rep->requested_name); return -1; } GET16 (type); /* Skip class */ SKIP (uint16_t); GET32 (ttl); GET16 (datalen); elt->type = type; /* Now p points to RR data */ switch (type) { case DNS_T_A: if (!(datalen & 0x3) && datalen <= *remain) { memcpy (&elt->content.a.addr, p, sizeof (struct in_addr)); p += datalen; *remain -= datalen; parsed = true; } else { rdns_info ("corrupted A record; domain: %s", rep->requested_name); return -1; } break; case DNS_T_AAAA: if (datalen == sizeof (struct in6_addr) && datalen <= *remain) { memcpy (&elt->content.aaa.addr, p, sizeof (struct in6_addr)); p += datalen; *remain -= datalen; parsed = true; } else { rdns_info ("corrupted AAAA record; domain %s", rep->requested_name); return -1; } break; case DNS_T_PTR: if (! rdns_parse_labels (resolver, in, &elt->content.ptr.name, &p, rep, remain, true)) { rdns_info ("invalid labels in PTR record; domain %s", rep->requested_name); return -1; } parsed = true; break; case DNS_T_NS: if (! rdns_parse_labels (resolver, in, &elt->content.ns.name, &p, rep, remain, true)) { rdns_info ("invalid labels in NS record; domain %s", rep->requested_name); return -1; } parsed = true; break; case DNS_T_SOA: if (! rdns_parse_labels (resolver, in, &elt->content.soa.mname, &p, rep, remain, true)) { rdns_info ("invalid labels in SOA record; domain %s", rep->requested_name); return -1; } if (! rdns_parse_labels (resolver, in, &elt->content.soa.admin, &p, rep, remain, true)) { rdns_info ("invalid labels in SOA record; domain %s", rep->requested_name); return -1; } if (*remain >= sizeof(int32_t) * 5) { GET32 (elt->content.soa.serial); GET32 (elt->content.soa.refresh); GET32 (elt->content.soa.retry); GET32 (elt->content.soa.expire); GET32 (elt->content.soa.minimum); } else { rdns_info ("invalid data in SOA record; domain %s", rep->requested_name); return -1; } parsed = true; break; case DNS_T_MX: GET16 (elt->content.mx.priority); if (! rdns_parse_labels (resolver, in, &elt->content.mx.name, &p, rep, remain, true)) { rdns_info ("invalid labels in MX record; domain %s", rep->requested_name); return -1; } parsed = true; break; case DNS_T_TXT: case DNS_T_SPF: if (datalen <= *remain) { if (datalen > UINT16_MAX / 2) { rdns_info ("too large datalen; domain %s", rep->requested_name); return -1; } elt->content.txt.data = malloc(datalen + 1); if (elt->content.txt.data == NULL) { rdns_err ("failed to allocate %d bytes for TXT record; domain %s", (int) datalen + 1, rep->requested_name); return -1; } /* Now we should compose data from parts */ copied = 0; parts = 0; while (copied + parts < datalen && *remain > 0) { txtlen = *p; if (txtlen + copied + parts <= datalen && *remain >= txtlen + 1) { parts++; memcpy (elt->content.txt.data + copied, p + 1, txtlen); copied += txtlen; p += txtlen + 1; *remain -= txtlen + 1; } else { if (txtlen + copied + parts > datalen) { /* Incorrect datalen reported ! */ rdns_err ("incorrect txtlen (%d) > datalen (%d) reported; domain %s", (txtlen + copied + parts), datalen, rep->requested_name); return -1; } /* Reported equal to the actual data copied */ break; } } *(elt->content.txt.data + copied) = '\0'; parsed = true; elt->type = RDNS_REQUEST_TXT; } else { rdns_info ("stripped data in TXT record (%d bytes available, %d requested); " "domain %s", (int)*remain, (int)datalen, rep->requested_name); return -1; } break; case DNS_T_SRV: if (p - *pos > (int)(*remain - sizeof (uint16_t) * 3)) { rdns_info ("stripped dns reply while reading SRV record; domain %s", rep->requested_name); return -1; } GET16 (elt->content.srv.priority); GET16 (elt->content.srv.weight); GET16 (elt->content.srv.port); if (! rdns_parse_labels (resolver, in, &elt->content.srv.target, &p, rep, remain, true)) { rdns_info ("invalid labels in SRV record; domain %s", rep->requested_name); return -1; } parsed = true; break; case DNS_T_TLSA: if (p - *pos > (int)(*remain - sizeof (uint8_t) * 3) || datalen <= 3) { rdns_info ("stripped dns reply while reading TLSA record; domain %s", rep->requested_name); return -1; } if (datalen > UINT16_MAX / 2) { rdns_info ("too large datalen; domain %s", rep->requested_name); return -1; } GET8 (elt->content.tlsa.usage); GET8 (elt->content.tlsa.selector); GET8 (elt->content.tlsa.match_type); datalen -= 3; elt->content.tlsa.data = malloc (datalen); if (elt->content.tlsa.data == NULL) { rdns_err ("failed to allocate %d bytes for TLSA record; domain %s", (int)datalen + 1, rep->requested_name); return -1; } elt->content.tlsa.datalen = datalen; memcpy (elt->content.tlsa.data, p, datalen); p += datalen; *remain -= datalen; parsed = true; break; case DNS_T_CNAME: /* Skip cname records */ p += datalen; *remain -= datalen; break; default: rdns_info ("unexpected RR type: %d; domain %s", type, rep->requested_name); p += datalen; *remain -= datalen; break; } *pos = p; if (parsed) { elt->ttl = ttl; return 1; } return 0; }
b44982731c0469ce631837396e2c18990d4629f5
c8b39acfd4a857dc15ed3375e0d93e75fa3f1f64
/Engine/Source/Runtime/ApplicationCore/Public/Linux/LinuxPlatformApplicationMisc.h
a7e4a318c95690411a62d9a76f3a39dc9ebacfd8
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
windystrife/UnrealEngine_NVIDIAGameWorks
c3c7863083653caf1bc67d3ef104fb4b9f302e2a
b50e6338a7c5b26374d66306ebc7807541ff815e
refs/heads/4.18-GameWorks
2023-03-11T02:50:08.471040
2022-01-13T20:50:29
2022-01-13T20:50:29
124,100,479
262
179
MIT
2022-12-16T05:36:38
2018-03-06T15:44:09
C++
UTF-8
C
false
false
1,036
h
LinuxPlatformApplicationMisc.h
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. #pragma once #include "GenericPlatform/GenericPlatformApplicationMisc.h" struct APPLICATIONCORE_API FLinuxPlatformApplicationMisc : public FGenericPlatformApplicationMisc { static void PreInit(); static void Init(); static bool InitSDL(); static void TearDown(); static void LoadPreInitModules(); static void LoadStartupModules(); static uint32 WindowStyle(); static class FOutputDeviceConsole* CreateConsoleOutputDevice(); static class FOutputDeviceError* GetErrorOutputDevice(); static class FFeedbackContext* GetFeedbackContext(); static class GenericApplication* CreateApplication(); static bool IsThisApplicationForeground(); static void PumpMessages(bool bFromMainLoop); static bool ControlScreensaver(EScreenSaverAction Action); static float GetDPIScaleFactorAtPoint(float X, float Y); static void ClipboardCopy(const TCHAR* Str); static void ClipboardPaste(class FString& Dest); }; typedef FLinuxPlatformApplicationMisc FPlatformApplicationMisc;
93629c8bfab02041e0b2be6886ad3d09c785d916
3b1223e5259c580cbf107d1f45960d9f08aff27f
/OS2/tests/test222/test222.c
c2b69f7f747cb9915c51a1ba4924e0d4bd354ed5
[ "BSD-3-Clause" ]
permissive
osfree-project/osfree
6be0fe3e2fb5ef577650b7a3a9eee1f38fb2eb8b
04ba405e346948ef0ae1a1b483aeb76f044c50a0
refs/heads/master
2023-09-02T21:38:29.849765
2023-08-30T05:21:33
2023-08-30T05:21:33
122,781,887
105
11
null
2023-01-24T08:36:57
2018-02-24T21:36:31
C
UTF-8
C
false
false
708
c
test222.c
#define INCL_GPISEGEDITING /* GPI Segment Edit functions */ #include <os2.h> int main(VOID) { HPS hps; POINTL ptlStart = { 0, 0 }; /* first vertex */ POINTL ptlTriangle[] = { 100, 100, 200, 0, 0, 0 }; /* vertices */ GpiBeginElement(hps, /* start element bracket */ 1L, /* element type is 1 */ "Triangle"); /* element description */ GpiMove(hps, &ptlStart); /* move to start point (0, 0) */ GpiPolyLine(hps, 3L, ptlTriangle); /* draw triangle */ GpiEndElement(hps); /* end element bracket */ return 0; }
9407b6a268bacc2f649328b8361d4080d734da21
30b736259b38c916e96f8e1517f92231070f5464
/babblesim/core/include/cmsis.h
8f9a6a3d4c4e2d90dd2bc0d7c26031ed05d65be7
[ "Apache-2.0", "LicenseRef-scancode-gary-s-brown", "BSD-3-Clause" ]
permissive
apache/mynewt-nimble
5bcc87df4482705c5a6542467bab028c8fd4e5fe
b5e107e9c55f32d18b16e5afc0a7e1720b901b68
refs/heads/master
2023-09-01T19:28:57.874159
2023-08-31T09:07:59
2023-08-31T14:46:07
113,086,218
606
354
Apache-2.0
2023-09-14T12:14:19
2017-12-04T19:34:47
C
UTF-8
C
false
false
868
h
cmsis.h
/* * Copyright (c) 2020 Oticon A/S * Copyright (c) 2021 Codecoup * * SPDX-License-Identifier: Apache-2.0 */ /** * This header defines replacements for inline * ARM Cortex-M CMSIS intrinsics. */ #ifndef BOARDS_POSIX_NRF52_BSIM_CMSIS_H #define BOARDS_POSIX_NRF52_BSIM_CMSIS_H #ifdef __cplusplus extern "C" { #endif /* Implement the following ARM intrinsics as no-op: * - ARM Data Synchronization Barrier * - ARM Data Memory Synchronization Barrier * - ARM Instruction Synchronization Barrier * - ARM No Operation */ #ifndef __DMB #define __DMB() #endif #ifndef __DSB #define __DSB() #endif #ifndef __ISB #define __ISB() #endif #ifndef __NOP #define __NOP() #endif void NVIC_SystemReset(void); void __disable_irq(void); void __enable_irq(void); uint32_t __get_PRIMASK(void); #ifdef __cplusplus } #endif #endif /* BOARDS_POSIX_NRF52_BSIM_CMSIS_H */
7473c92efa238af8574a9d79d1b504a6982530b3
6923f79f1eaaba0ab28b25337ba6cb56be97d32d
/GPU-Gems-Book-Source-Code/GPU-Gems-3-CD-Content/content/06/demo/Src/Cfg.h
382e50dd7008da890070f309f2fa797b463dcfa2
[]
no_license
burakbayramli/books
9fe7ba0cabf06e113eb125d62fe16d4946f4a4f0
5e9a0e03aa7ddf5e5ddf89943ccc68d94b539e95
refs/heads/master
2023-08-17T05:31:08.885134
2023-08-14T10:05:37
2023-08-14T10:05:37
72,460,321
223
174
null
2022-10-24T12:15:06
2016-10-31T17:24:00
Jupyter Notebook
UTF-8
C
false
false
173
h
Cfg.h
#ifndef __CFG_H #define __CFG_H #pragma warning (disable : 4324) #pragma warning (disable : 4530) #pragma warning (disable : 4995) #pragma warning (disable : 4996) #endif
fd8fd53c9603038a31279fa72ab24cd89036aaa9
b01b4365ab6c9afeb6664563dd314df4f269014f
/crt/string.c
ab2ee152eb7f05daac7a739ab5b6fe568f5439a3
[ "MIT" ]
permissive
malxau/yori
6208011ca60485cfbf141c7639e9f941a160e002
027f9b42c08cc5fcc682ecb7fb67e6de5363b8de
refs/heads/master
2023-09-01T13:11:19.083028
2023-08-28T00:00:02
2023-08-28T00:00:02
127,679,677
1,234
31
MIT
2023-04-23T04:54:56
2018-04-01T23:29:17
C
UTF-8
C
false
false
21,726
c
string.c
/** * @file crt/string.c * * Implementations of the str* library functions. * * Copyright (c) 2014-2017 Malcolm J. Smith * * 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 WIN32_LEAN_AND_MEAN /** Standard define to include somewhat less of the Windows headers. Command line software doesn't need much. */ #define WIN32_LEAN_AND_MEAN 1 #endif #pragma warning(disable: 4001) /* Single line comment */ #pragma warning(disable: 4127) // conditional expression constant #pragma warning(disable: 4201) // nameless struct/union #pragma warning(disable: 4214) // bit field type other than int #pragma warning(disable: 4514) // unreferenced inline function #if defined(_MSC_VER) && (_MSC_VER >= 1910) #pragma warning(disable: 5045) // spectre mitigation #endif #if defined(_MSC_VER) && (_MSC_VER >= 1200) #pragma warning(push) #endif #if defined(_MSC_VER) && (_MSC_VER >= 1500) #pragma warning(disable: 4668) // preprocessor conditional with nonexistent macro, SDK bug #pragma warning(disable: 4255) // no function prototype given. 8.1 and earlier SDKs exhibit this. #pragma warning(disable: 4820) // implicit padding added in structure #endif /** Indicate support for compiling for ARM32 if an SDK is available. */ #define _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE 1 #include <windows.h> #if defined(_MSC_VER) && (_MSC_VER >= 1200) #pragma warning(pop) #endif /** Indicate to the standard CRT header that we're compiling the CRT itself. */ #define MINICRT_BUILD #include "yoricrt.h" #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_ttoi. */ #define mini_ttoi mini_wtoi #else /** Indicate this compilation should generate the ansi form of @ref mini_ttoi. */ #define mini_ttoi mini_atoi #endif /** Convert a NULL terminated string into a number. This function is compiled seperately to generate an ANSI and Unicode form, and is available in the header as both of these plus a conditional form. @param str The string to convert to a number @return The number form of the string, which may be zero if no numeric characters were in the string. */ int MCRT_FN mini_ttoi (TCHAR * str) { int ret = 0; while (*str >= '0' && *str <= '9') { ret *= 10; ret += *str - '0'; str++; } return ret; } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcscat_s. */ #define mini_tcscat_s mini_wcscat_s #else /** Indicate this compilation should generate the ansi form of @ref mini_tcscat_s. */ #define mini_tcscat_s mini_strcat_s #endif /** Append one NULL terminated string to another NULL terminated string, with a maximum length specified for the writable string. @param dest The NULL terminated string that should have new characters written to the end. @param len The number of bytes available in the dest allocation. No writes should occur beyond this value. @param src A NULL terminated string to append to dest. @return Pointer to dest for some unknown reason. */ TCHAR * MCRT_FN mini_tcscat_s(TCHAR * dest, unsigned int len, const TCHAR * src) { unsigned int i,j; for (i = 0; dest[i] != '\0' && i < len; i++); for (j = 0; src[j] != '\0' && i < len - 1; ) { dest[i++] = src[j++]; } dest[i++] = '\0'; return dest; } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcsncat. */ #define mini_tcsncat mini_wcsncat #else /** Indicate this compilation should generate the ansi form of @ref mini_tcsncat. */ #define mini_tcsncat mini_strncat #endif /** Append one NULL terminated string to another NULL terminated string, with a maximum length specified for the characters to read from the source string. @param dest The NULL terminated string that should have new characters written to the end. @param src A NULL terminated string to append to dest. @param len The maximum number of bytes to copy from the source string. @return Pointer to dest for some unknown reason. */ TCHAR * MCRT_FN mini_tcsncat(TCHAR * dest, const TCHAR * src, unsigned int len) { unsigned int i,j; for (i = 0; dest[i] != '\0'; i++); for (j = 0; src[j] != '\0' && j < len; ) { dest[i++] = src[j++]; } dest[i++] = '\0'; return dest; } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcschr. */ #define mini_tcschr mini_wcschr #else /** Indicate this compilation should generate the ansi form of @ref mini_tcschr. */ #define mini_tcschr mini_strchr #endif /** Find the leftmost occurrence of a character within a NULL terminated string. @param str Pointer to the string to search through. @param ch The character to look for. @return Pointer to the first occurrence of the character if found, or NULL if not found. */ TCHAR * MCRT_FN mini_tcschr(const TCHAR * str, TCHAR ch) { const TCHAR * ptr = str; while (*ptr != '\0' && *ptr != ch) ptr++; if (*ptr == ch) return (TCHAR *)ptr; return NULL; } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcsrchr. */ #define mini_tcsrchr mini_wcsrchr #else /** Indicate this compilation should generate the ansi form of @ref mini_tcsrchr. */ #define mini_tcsrchr mini_strrchr #endif /** Find the rightmost occurrence of a character within a NULL terminated string. @param str Pointer to the string to search through. @param ch The character to look for. @return Pointer to the last occurrence of the character if found, or NULL if not found. */ TCHAR * MCRT_FN mini_tcsrchr(const TCHAR * str, TCHAR ch) { const TCHAR * ptr = str; while (*ptr != '\0') ptr++; while (*ptr != ch && ptr > str) ptr--; if (*ptr == ch) return (TCHAR *)ptr; return NULL; } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcslen. */ #define mini_tcslen mini_wcslen #else /** Indicate this compilation should generate the ansi form of @ref mini_tcslen. */ #define mini_tcslen mini_strlen #endif /** Return the number of characters in the specified NULL terminated string, excluding the terminating NULL character. @param str The string to count characters in. @return The number of characters in the string. */ int MCRT_FN mini_tcslen(const TCHAR * str) { int i = 0; while (str[i] != '\0') { i++; } return i; } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcsstr. */ #define mini_tcsstr mini_wcsstr #else /** Indicate this compilation should generate the ansi form of @ref mini_tcsstr. */ #define mini_tcsstr mini_strstr #endif /** Find the leftmost occurrence of a string within a NULL terminated string. @param str Pointer to the string to search through. @param search The string to search for. @return Pointer to the first occurrence of the search string if found, or NULL if not found. */ TCHAR * MCRT_FN mini_tcsstr(const TCHAR * str, TCHAR * search) { const TCHAR * ptr = str; int i; while (*ptr != '\0') { for (i=0;ptr[i]==search[i]&&search[i]!='\0'&&ptr[i]!='\0';i++); if (search[i]=='\0') return (TCHAR*)ptr; ptr++; } return NULL; } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_ttoupper. */ #define mini_ttoupper mini_towupper #else /** Indicate this compilation should generate the ansi form of @ref mini_ttoupper. */ #define mini_ttoupper mini_toupper #endif /** Convert a single character to its uppercase form. This function only handles the base 26 english characters. @param c The character to uppercase. @return The resulting character, which may either be converted to uppercase or may be the same as the input character. */ int MCRT_FN mini_ttoupper(int c) { if (c >= 'a' && c <= 'z') { return c - 'a' + 'A'; } return c; } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_ttolower. */ #define mini_ttolower mini_towlower #else /** Indicate this compilation should generate the ansi form of @ref mini_ttolower. */ #define mini_ttolower mini_tolower #endif /** Convert a single character to its lowercase form. This function only handles the base 26 english characters. @param c The character to lowercase. @return The resulting character, which may either be converted to lowercase or may be the same as the input character. */ int MCRT_FN mini_ttolower(int c) { if (c >= 'A' && c <= 'Z') { return c - 'A' + 'a'; } return c; } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcsupr. */ #define mini_tcsupr mini_wcsupr #else /** Indicate this compilation should generate the ansi form of @ref mini_tcsupr. */ #define mini_tcsupr mini_strupr #endif /** Convert a string to its uppercase form. This function only handles the base 26 english characters. @param str The string to uppercase. @return Pointer to the input string for some unknown reason. */ TCHAR * MCRT_FN mini_tcsupr(TCHAR * str) { TCHAR * ptr = str; while (*ptr != '\0') { *ptr = (TCHAR)mini_ttoupper(*ptr); ptr++; } return str; } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcslwr. */ #define mini_tcslwr mini_wcslwr #else /** Indicate this compilation should generate the ansi form of @ref mini_tcslwr. */ #define mini_tcslwr mini_strlwr #endif /** Convert a string to its lowercase form. This function only handles the base 26 english characters. @param str The string to lowercase. @return Pointer to the input string for some unknown reason. */ TCHAR * MCRT_FN mini_tcslwr(TCHAR * str) { TCHAR * ptr = str; while (*ptr != '\0') { *ptr = (TCHAR)mini_ttolower(*ptr); ptr++; } return str; } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcsncmp. */ #define mini_tcsncmp mini_wcsncmp #else /** Indicate this compilation should generate the ansi form of @ref mini_tcsncmp. */ #define mini_tcsncmp mini_strncmp #endif /** Compare two strings up to a maximum specified number of characters, and indicate which string is lexicographically less than the other or if the two strings are equal. @param str1 Pointer to the first NULL terminated string to compare. @param str2 Pointer to the second NULL terminated string to compare. @param count Specifies the maximum number of characters to compare. @return -1 if the first string is less than the second; 1 if the first string is greater than the second; or 0 if the two are identical up to the specified number of characters. */ int MCRT_FN mini_tcsncmp(const TCHAR * str1, const TCHAR * str2, unsigned int count) { const TCHAR * ptr1 = str1; const TCHAR * ptr2 = str2; unsigned int remaining = count; while(remaining > 0) { if (*ptr1 < *ptr2) { return -1; } else if (*ptr1 > *ptr2) { return 1; } else if (*ptr1 == '\0') { return 0; } ptr1++; ptr2++; remaining--; } return 0; } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcscmp. */ #define mini_tcscmp mini_wcscmp #else /** Indicate this compilation should generate the ansi form of @ref mini_tcscmp. */ #define mini_tcscmp mini_strcmp #endif /** Compare two strings and indicate which string is lexicographically less than the other or if the two strings are equal. @param str1 Pointer to the first NULL terminated string to compare. @param str2 Pointer to the second NULL terminated string to compare. @return -1 if the first string is less than the second; 1 if the first string is greater than the second; or 0 if the two are identical. */ int MCRT_FN mini_tcscmp(const TCHAR * str1, const TCHAR * str2) { return mini_tcsncmp(str1, str2, (unsigned int)-1); } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcsnicmp. */ #define mini_tcsnicmp mini_wcsnicmp #else /** Indicate this compilation should generate the ansi form of @ref mini_tcsnicmp. */ #define mini_tcsnicmp mini_strnicmp #endif /** Compare two strings up to a maximum specified number of characters without regard to case and indicate which string is lexicographically less than the other or if the two strings are equal. This function only handles case insensitivity of the 26 base english characters. @param str1 Pointer to the first NULL terminated string to compare. @param str2 Pointer to the second NULL terminated string to compare. @param count Specifies the maximum number of characters to compare. @return -1 if the first string is less than the second; 1 if the first string is greater than the second; or 0 if the two are identical up to the specified number of characters. */ int MCRT_FN mini_tcsnicmp(const TCHAR * str1, const TCHAR * str2, unsigned int count) { const TCHAR * ptr1 = str1; const TCHAR * ptr2 = str2; unsigned int remaining = count; while(remaining > 0) { if (mini_ttoupper(*ptr1) < mini_ttoupper(*ptr2)) { return -1; } else if (mini_ttoupper(*ptr1) > mini_ttoupper(*ptr2)) { return 1; } else if (*ptr1 == '\0') { return 0; } ptr1++; ptr2++; remaining--; } return 0; } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcsicmp. */ #define mini_tcsicmp mini_wcsicmp #else /** Indicate this compilation should generate the ansi form of @ref mini_tcsicmp. */ #define mini_tcsicmp mini_stricmp #endif /** Compare two strings without regard to case and indicate which string is lexicographically less than the other or if the two strings are equal. This function only handles case insensitivity of the 26 base english characters. @param str1 Pointer to the first NULL terminated string to compare. @param str2 Pointer to the second NULL terminated string to compare. @return -1 if the first string is less than the second; 1 if the first string is greater than the second; or 0 if the two are identical. */ int MCRT_FN mini_tcsicmp(const TCHAR * str1, const TCHAR * str2) { return mini_tcsnicmp(str1, str2, (unsigned int)-1); } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcstok_s. */ #define mini_tcstok_s mini_wcstok_s #else /** Indicate this compilation should generate the ansi form of @ref mini_tcstok_s. */ #define mini_tcstok_s mini_strtok_s #endif /** Tokenize an incoming string by searching for a token, substituting the token with a NULL character, and returning the resulting substring. This can be called multiple times on the same base string to continue returning matches until the entire base string has been returned as tokens. @param str Pointer to the base string to tokenize. If NULL, continue tokenizing the previously specified base string. @param match A string that points to a single character used to indicate a seperator value between string parts. @param context Pointer to a block of memory which is read and written by this function to track its progress through a base string. When the caller no longer wishes to continue enumerating, this memory can be forgotten (ie., there is no explicit free action for it.) @return Pointer to the next substring delimited by the match seperator, or NULL if no more substrings are available. */ TCHAR * MCRT_FN mini_tcstok_s(TCHAR * str, TCHAR * match, TCHAR ** context) { TCHAR * next; if (str != NULL) { *context = str; } next = *context; if (next == NULL) { return NULL; } while (*next != match[0] && *next != '\0') next++; if (*next == match[0]) { TCHAR * ret = *context; *next = '\0'; *context = ++next; return ret; } else { TCHAR * ret = *context; *context = NULL; return ret; } } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcstok. */ #define mini_tcstok mini_wcstok /** A private context for the unicode form of @ref mini_tcstok which is equivalent to the context explicitly specified in @ref mini_tcstok_s . */ #define STRTOK_CTX wcstok_context #else /** Indicate this compilation should generate the ansi form of @ref mini_tcstok. */ #define mini_tcstok mini_strtok /** A private context for the unicode form of @ref mini_tcstok which is equivalent to the context explicitly specified in @ref mini_tcstok_s . */ #define STRTOK_CTX strtok_context #endif /** Storage for the global context used by @ref mini_tcstok . */ TCHAR * STRTOK_CTX; /** Tokenize an incoming string by searching for a token, substituting the token with a NULL character, and returning the resulting substring. This can be called multiple times on the same base string to continue returning matches until the entire base string has been returned as tokens. @param str Pointer to the base string to tokenize. If NULL, continue tokenizing the previously specified base string. @param match A string that points to a single character used to indicate a seperator value between string parts. @return Pointer to the next substring delimited by the match seperator, or NULL if no more substrings are available. */ TCHAR * MCRT_FN mini_tcstok(TCHAR * str, TCHAR * match) { return mini_tcstok_s(str, match, &STRTOK_CTX); } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcsspn. */ #define mini_tcsspn mini_wcsspn #else /** Indicate this compilation should generate the ansi form of @ref mini_tcsspn. */ #define mini_tcsspn mini_strspn #endif /** Return the number of characters in a string that consist of characters specified in a second string. @param str The base string to count matching characters in. @param chars A string containing a set of characters which should be considered matching characters. @return The number of consecutive characters in str that are contained within the chars array. */ int MCRT_FN mini_tcsspn(TCHAR * str, TCHAR * chars) { DWORD len = 0; DWORD i; for (len = 0; str[len] != '\0'; len++) { for (i = 0; chars[i] != '\0'; i++) { if (str[len] == chars[i]) { break; } } if (chars[i] == '\0') { return len; } } return len; } #ifdef UNICODE /** Indicate this compilation should generate the unicode form of @ref mini_tcscspn. */ #define mini_tcscspn mini_wcscspn #else /** Indicate this compilation should generate the ansi form of @ref mini_tcscspn. */ #define mini_tcscspn mini_strcspn #endif /** Return the number of characters in a string that consist of characters not specified in a second string. @param str The base string to count matching characters in. @param match A string containing a set of characters which should be considered mismatching characters. @return The number of consecutive characters in str that are not contained within the chars array. */ int MCRT_FN mini_tcscspn(TCHAR * str, TCHAR * match) { DWORD len = 0; DWORD i; for (len = 0; str[len] != '\0'; len++) { for (i = 0; match[i] != '\0'; i++) { if (str[len] == match[i]) { return len; } } } return len; } // vim:sw=4:ts=4:et:
4360f70e5152e32b00a6391224dfa9a2f3d78b5d
03666e5f961946fc1a0ac67781ac1425562ef0d7
/src/tools/third_party/qtssh/utils/seat_dialog_text.c
03890b9307fbe070338cc222ca267e78f12091c4
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
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
991
c
seat_dialog_text.c
/* * Helper routines for dealing with SeatDialogText structures. */ #include <stdarg.h> #include "putty.h" SeatDialogText *seat_dialog_text_new(void) { SeatDialogText *sdt = snew(SeatDialogText); sdt->nitems = sdt->itemsize = 0; sdt->items = NULL; return sdt; } void seat_dialog_text_free(SeatDialogText *sdt) { for (size_t i = 0; i < sdt->nitems; i++) sfree(sdt->items[i].text); sfree(sdt->items); sfree(sdt); } static void seat_dialog_text_append_v( SeatDialogText *sdt, SeatDialogTextType type, const char *fmt, va_list ap) { sgrowarray(sdt->items, sdt->itemsize, sdt->nitems); SeatDialogTextItem *item = &sdt->items[sdt->nitems++]; item->type = type; item->text = dupvprintf(fmt, ap); } void seat_dialog_text_append(SeatDialogText *sdt, SeatDialogTextType type, const char *fmt, ...) { va_list ap; va_start(ap, fmt); seat_dialog_text_append_v(sdt, type, fmt, ap); va_end(ap); }
0020024e5a20b234c12213433b6890071dd5b8c5
fbe68d84e97262d6d26dd65c704a7b50af2b3943
/third_party/virtualbox/src/VBox/Devices/Network/slirp/bsd/amd64/in_cksum.c
e99fa67fe09fb8d75064d6ca4a81ca430ebda220
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "GPL-2.0-only", "LicenseRef-scancode-unknown-license-reference", "CDDL-1.0", "GPL-1.0-or-later", "LGPL-2.1-or-later", "GPL-2.0-or-later", "MPL-1.0", "LicenseRef-scancode-generic-exception", "Apache-2.0", "OpenSSL" ]
permissive
thalium/icebox
c4e6573f2b4f0973b6c7bb0bf068fe9e795fdcfb
6f78952d58da52ea4f0e55b2ab297f28e80c1160
refs/heads/master
2022-08-14T00:19:36.984579
2022-02-22T13:10:31
2022-02-22T13:10:31
190,019,914
585
109
MIT
2022-01-13T20:58:15
2019-06-03T14:18:12
C++
UTF-8
C
false
false
6,549
c
in_cksum.c
/* $NetBSD: in_cksum.c,v 1.7 1997/09/02 13:18:15 thorpej Exp $ */ /*- * Copyright (c) 1988, 1992, 1993 * The Regents of the University of California. All rights reserved. * Copyright (c) 1996 * Matt Thomas <matt@3am-software.com> * * 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. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. * * @(#)in_cksum.c 8.1 (Berkeley) 6/10/93 */ #ifndef VBOX #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ __FBSDID("$FreeBSD: src/sys/amd64/amd64/in_cksum.c,v 1.5.20.1 2009/04/15 03:14:26 kensmith Exp $"); #include <sys/param.h> #include <sys/mbuf.h> #include <sys/systm.h> #include <netinet/in_systm.h> #include <netinet/in.h> #include <netinet/ip.h> #include <machine/in_cksum.h> #else # include "in_cksum.h" # include "slirp.h" #endif /* * Checksum routine for Internet Protocol family headers * (Portable Alpha version). * * This routine is very heavily used in the network * code and should be modified for each CPU to be as fast as possible. */ #define ADDCARRY(x) (x > 65535 ? x -= 65535 : x) #define REDUCE32 \ { \ q_util.q = sum; \ sum = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \ } #define REDUCE16 \ { \ q_util.q = sum; \ l_util.l = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \ sum = l_util.s[0] + l_util.s[1]; \ ADDCARRY(sum); \ } static const u_int32_t in_masks[] = { /*0 bytes*/ /*1 byte*/ /*2 bytes*/ /*3 bytes*/ 0x00000000, 0x000000FF, 0x0000FFFF, 0x00FFFFFF, /* offset 0 */ 0x00000000, 0x0000FF00, 0x00FFFF00, 0xFFFFFF00, /* offset 1 */ 0x00000000, 0x00FF0000, 0xFFFF0000, 0xFFFF0000, /* offset 2 */ 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, /* offset 3 */ }; union l_util { u_int16_t s[2]; u_int32_t l; }; union q_util { u_int16_t s[4]; u_int32_t l[2]; u_int64_t q; }; static u_int64_t in_cksumdata(const void *buf, int len) { const u_int32_t *lw = (const u_int32_t *) buf; u_int64_t sum = 0; u_int64_t prefilled; int offset; union q_util q_util; if ((3 & (intptr_t) lw) == 0 && len == 20) { sum = (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3] + lw[4]; REDUCE32; return sum; } if ((offset = 3 & (intptr_t) lw) != 0) { const u_int32_t *masks = in_masks + (offset << 2); lw = (u_int32_t *) (((RTHCUINTPTR) lw) - offset); sum = *lw++ & masks[len >= 3 ? 3 : len]; len -= 4 - offset; if (len <= 0) { REDUCE32; return sum; } } #if 0 /* * Force to cache line boundary. */ offset = 32 - (0x1f & (long) lw); if (offset < 32 && len > offset) { len -= offset; if (4 & offset) { sum += (u_int64_t) lw[0]; lw += 1; } if (8 & offset) { sum += (u_int64_t) lw[0] + lw[1]; lw += 2; } if (16 & offset) { sum += (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3]; lw += 4; } } #endif /* * access prefilling to start load of next cache line. * then add current cache line * save result of prefilling for loop iteration. */ prefilled = lw[0]; while ((len -= 32) >= 4) { u_int64_t prefilling = lw[8]; sum += prefilled + lw[1] + lw[2] + lw[3] + lw[4] + lw[5] + lw[6] + lw[7]; lw += 8; prefilled = prefilling; } if (len >= 0) { sum += prefilled + lw[1] + lw[2] + lw[3] + lw[4] + lw[5] + lw[6] + lw[7]; lw += 8; } else { len += 32; } while ((len -= 16) >= 0) { sum += (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3]; lw += 4; } len += 16; while ((len -= 4) >= 0) { sum += (u_int64_t) *lw++; } len += 4; if (len > 0) sum += (u_int64_t) (in_masks[len] & *lw); REDUCE32; return sum; } u_short in_addword(u_short a, u_short b) { u_int64_t sum = a + b; ADDCARRY(sum); return (sum); } u_short in_pseudo(u_int32_t a, u_int32_t b, u_int32_t c) { u_int64_t sum; union q_util q_util; union l_util l_util; sum = (u_int64_t) a + b + c; REDUCE16; return (sum); } u_short in_cksum_skip(struct mbuf *m, int len, int skip) { u_int64_t sum = 0; int mlen = 0; int clen = 0; caddr_t addr; union q_util q_util; union l_util l_util; len -= skip; for (; skip && m; m = m->m_next) { if (m->m_len > skip) { mlen = m->m_len - skip; addr = mtod(m, caddr_t) + skip; goto skip_start; } else { skip -= m->m_len; } } for (; m && len; m = m->m_next) { if (m->m_len == 0) continue; mlen = m->m_len; addr = mtod(m, caddr_t); skip_start: if (len < mlen) mlen = len; if ((clen ^ (intptr_t) addr) & 1) sum += in_cksumdata(addr, mlen) << 8; else sum += in_cksumdata(addr, mlen); clen += mlen; len -= mlen; } REDUCE16; return (~sum & 0xffff); } u_int in_cksum_hdr(const struct ip *ip) { u_int64_t sum = in_cksumdata(ip, sizeof(struct ip)); union q_util q_util; union l_util l_util; REDUCE16; return (~sum & 0xffff); }
cd9c58f2db238031b2d3564be32c093913e2f943
9de0cec678bc4a3bec2b4adabef9f39ff5b4afac
/PWGLF/totEt/macros/hadEt/CorrBkgdErrors.C
e8a9a691d12316b66749c644ddfb86585293ccae
[]
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
18,673
c
CorrBkgdErrors.C
TH1D *GetHisto(float etacut = 0.12, bool eta = true, char *name, bool TPC,bool ITS, int mycase = 0, int color=1, int marker = 20, char *filename="Et.ESD.new.sim.merged.root",bool reweight = false,float kaonFactor=1.0, float lambdaFactor = 1.0, float baryonEnhancement = 1.0){ TFile *file = new TFile(filename); TList *list = file->FindObject("out2"); char *reweightname = ""; if(reweight) reweightname = "Reweighted"; char *myname = "ITS"; if(TPC){ if(ITS) myname = "TPCITS"; else{ myname = "TPC";} } //cout<<"Using "<<myname<<" tracks"<<endl; TH2F *signal = ((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedPiPlus",myname)))->Clone("signal"); signal->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedPiMinus",myname))); signal->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedKMinus",myname)),kaonFactor); signal->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedKPlus",myname)),kaonFactor); signal->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedProton",myname)),baryonEnhancement); signal->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedAntiProton",myname)),baryonEnhancement); signal->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sUnidentifiedAssumingPion",myname))); //Et of all unidentified hadrons (plus hadrons identified as pions) calculated assuming their true mass TH2F *bkgd; switch(mycase){ case 0: bkgd = (TH2F*)((TH2F*) out2->FindObject(Form("EtReconstructed%sMisidentifiedElectrons",myname)))->Clone("bkgd"); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sLambdaDaughters%s",myname,reweightname)),baryonEnhancement*lambdaFactor); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sAntiLambdaDaughters%s",myname,reweightname)),baryonEnhancement*lambdaFactor); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sK0SDaughters%s",myname,reweightname)),kaonFactor); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sXiDaughters",myname)),baryonEnhancement); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sAntiXiDaughters",myname)),baryonEnhancement); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sOmegaDaughters",myname)),baryonEnhancement); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sAntiOmegaDaughters",myname)),baryonEnhancement); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sConversionElectrons",myname)) ); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sSecondaryMuons",myname)) ); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sSecondaryPions",myname)) ); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sSecondaryProtons",myname)) ); break; case 1: bkgd = (TH2F*)((TH2F*) out2->FindObject(Form("EtReconstructed%sMisidentifiedElectrons",myname)))->Clone("bkgd"); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sConversionElectrons",myname)) ); break; case 2: bkgd = (TH2F*)((TH2F*) out2->FindObject(Form("EtReconstructed%sLambdaDaughters%s",myname,reweightname)))->Clone("bkgd"); bkgd->Scale(baryonEnhancement*lambdaFactor); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sAntiLambdaDaughters%s",myname,reweightname)),baryonEnhancement*lambdaFactor); break; case 3: bkgd = (TH2F*)((TH2F*) out2->FindObject(Form("EtReconstructed%sK0SDaughters%s",myname,reweightname)))->Clone("bkgd"); bkgd->Scale(kaonFactor); break; case 4: bkgd = (TH2F*)((TH2F*) out2->FindObject(Form("EtReconstructed%sLambdaDaughters%s",myname,reweightname)))->Clone("bkgd"); bkgd->Scale(baryonEnhancement*lambdaFactor); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sAntiLambdaDaughters%s",myname,reweightname)),baryonEnhancement*lambdaFactor); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sK0SDaughters%s",myname,reweightname)),kaonFactor); break; case 5: bkgd = (TH2F*)((TH2F*) out2->FindObject(Form("EtReconstructed%sXiDaughters",myname)))->Clone("bkgd"); bkgd->Scale(baryonEnhancement); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sAntiXiDaughters",myname)),baryonEnhancement); break; case 6: bkgd = (TH2F*)((TH2F*) out2->FindObject(Form("EtReconstructed%sOmegaDaughters",myname)))->Clone("bkgd"); bkgd->Scale(baryonEnhancement); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sAntiOmegaDaughters",myname)),baryonEnhancement); break; case 7: bkgd = (TH2F*)((TH2F*) out2->FindObject(Form("EtReconstructed%sXiDaughters",myname)))->Clone("bkgd"); bkgd->Scale(baryonEnhancement); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sAntiXiDaughters",myname)),baryonEnhancement); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sOmegaDaughters",myname)),baryonEnhancement); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sAntiOmegaDaughters",myname)),baryonEnhancement); break; case 8: bkgd = (TH2F*)((TH2F*) out2->FindObject(Form("EtReconstructed%sLambdaDaughters%s",myname,reweightname)))->Clone("bkgd"); bkgd->Scale(baryonEnhancement*lambdaFactor); break; case 9: bkgd = (TH2F*)((TH2F*) out2->FindObject(Form("EtReconstructed%sAntiLambdaDaughters%s",myname,reweightname)))->Clone("bkgd"); bkgd->Scale(baryonEnhancement*lambdaFactor); break; case 10: bkgd = (TH2F*) ((TH2F*) out2->FindObject(Form("EtReconstructed%sSecondaryMuons",myname)) )->Clone("bkgdOther"); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sSecondaryPions",myname)) ); bkgd->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sSecondaryProtons",myname)) ); break; } TH1D *denominator; TH1D *numerator; if(eta){ int lowbin = bkgd->GetXaxis()->FindBin(etacut+.001);//make sure we don't accidentally get the wrong bin int highbin = bkgd->GetXaxis()->GetNbins(); //cout<<"Projecting from "<<bkgd->GetXaxis()->GetBinLowEdge(lowbin)<<" to "<<bkgd->GetXaxis()->GetBinLowEdge(highbin+1)<<endl; denominator = signal->ProjectionY("name",lowbin,highbin); numerator = bkgd->ProjectionY(name,lowbin,highbin); } else{ int lowbin = bkgd->GetYaxis()->FindBin(-etacut+.001);//make sure we don't accidentally get the wrong bin int highbin = bkgd->GetYaxis()->FindBin(etacut-.001); //cout<<"Projecting from "<<bkgd->GetYaxis()->GetBinLowEdge(lowbin)<<" to "<<bkgd->GetYaxis()->GetBinLowEdge(highbin+1)<<endl; denominator = signal->ProjectionX("name",lowbin,highbin); numerator = bkgd->ProjectionX(name,lowbin,highbin); } denominator->Add(numerator); numerator->Divide(denominator); numerator->SetYTitle("Ratio of E_{T}^{background}/E_{T}^{had, meas.}"); numerator->GetYaxis()->SetTitleOffset(1.2); numerator->SetLineColor(color); numerator->SetMarkerColor(color); numerator->SetMarkerStyle(marker); return numerator; } void CorrBkgdErrors(char *prodname = "LHC11a4_bis HIJING 2.76 TeV Pb+Pb",char *shortprodname= "LHC11a4_bis", char *filename = "rootFiles/LHC11a10a_bis/Et.ESD.sim.LHC11a10a_bis.Run139465.root",bool alt = false,bool TPC = true, bool ITS=true, bool reweight = false, int scale = -1,float kaonFactor=1.0, float lambdaFactor = 1.0, float baryonEnhancement = 1.0){ gStyle->SetOptTitle(0); gStyle->SetOptStat(0); gStyle->SetOptFit(0); TCanvas *c = new TCanvas("c","c",400,400); c->SetTopMargin(0.04); c->SetRightMargin(0.04); c->SetBorderSize(0); c->SetFillColor(0); c->SetFillColor(0); c->SetBorderMode(0); c->SetFrameFillColor(0); c->SetFrameBorderMode(0); c->SetLeftMargin(0.159091); //char * filename = "Et.ESD.new.sim.LHC10d4.pp.merged.root"; // char * filename = "rootFiles/LHC11a4_bis/Et.ESD.new.sim.LHC11a4_bis.root"; //char *filename = "rootFiles/LHC11a4_bis/Et.ESD.new.sim.LHC11a4_bis.root"; //char *filename = "rootFiles/LHC11a4_bis/Et.ESD.new.sim.LHC11a4_bis.effFromPtReco.root"; //char *filename = "rootFiles/LHC11a4_bis23Apr11/Et.ESD.new.sim.LHC11a4_bis.root"; TH1D *All = GetHisto(0.1,true,"All",TPC,ITS,0,1,20,filename,reweight,kaonFactor,lambdaFactor,baryonEnhancement); TH1D *Electrons = GetHisto(0.1,true,"Electrons",TPC,ITS,1,2,21,filename,reweight,kaonFactor,lambdaFactor,baryonEnhancement); TH1D *V0s = GetHisto(0.1,true,"V0s",TPC,ITS,4,4,22,filename,reweight,kaonFactor,lambdaFactor,baryonEnhancement); //case, color, marker TH1D *K0S = GetHisto(0.1,true,"K0S",TPC,ITS,3,TColor::kOrange+8,33,filename,reweight,kaonFactor,lambdaFactor,baryonEnhancement); TH1D *Lambda = GetHisto(0.1,true,"K0S",TPC,ITS,8,TColor::kMagenta+3,29,filename,reweight,kaonFactor,lambdaFactor,baryonEnhancement); TH1D *AntiLambda = GetHisto(0.1,true,"K0S",TPC,ITS,9,TColor::kMagenta+3,30,filename,reweight,kaonFactor,lambdaFactor,baryonEnhancement); TH1D *Multistrange = GetHisto(0.1,true,"Multistrange",TPC,ITS,7,TColor::kGreen+2,23,filename,reweight,kaonFactor,lambdaFactor,baryonEnhancement); TH1D *Allpt = GetHisto(0.7,false,"Allpt",TPC,ITS,0,1,20,filename,reweight,kaonFactor,lambdaFactor,baryonEnhancement); TH1D *Electronspt = GetHisto(0.7,false,"Electronspt",TPC,ITS,1,2,21,filename,reweight,kaonFactor,lambdaFactor,baryonEnhancement); TH1D *V0spt = GetHisto(0.7,false,"V0spt",TPC,ITS,4,4,22,filename,reweight,kaonFactor,lambdaFactor,baryonEnhancement); TH1D *K0Spt = GetHisto(0.1,false,"K0S",TPC,ITS,3,TColor::kOrange+8,33,filename,reweight,kaonFactor,lambdaFactor,baryonEnhancement); TH1D *Lambdapt = GetHisto(0.1,false,"K0S",TPC,ITS,8,TColor::kMagenta+3,29,filename,reweight,kaonFactor,lambdaFactor,baryonEnhancement); TH1D *AntiLambdapt = GetHisto(0.1,false,"K0S",TPC,ITS,9,TColor::kMagenta+3,30,filename,reweight,kaonFactor,lambdaFactor,baryonEnhancement); TH1D *Multistrangept = GetHisto(0.7,false,"Multistrangept",TPC,ITS,7,TColor::kGreen+2,23,filename,reweight,kaonFactor,lambdaFactor,baryonEnhancement); if(ITS){ if(TPC) All->SetMaximum(0.15); else{All->SetMaximum(0.025);} } else{ All->SetMaximum(0.2); } All->SetMinimum(0.0); All->SetMarkerStyle(20); All->GetYaxis()->SetTitleOffset(1.8); TF1 *func = new TF1("func","[0]",-.7,.7); func->SetParameter(0,0.02); TF1 *funcLam = new TF1("funcLam","[0]",-.7,.7); funcLam->SetParameter(0,0.001); funcLam->SetLineColor(Lambda->GetMarkerColor()); TF1 *funcAlam = new TF1("funcAlam","[0]",-.7,.7); funcAlam->SetParameter(0,0.003); funcAlam->SetLineColor(AntiLambda->GetMarkerColor()); TF1 *funcK0 = new TF1("funcK0","[0]",-.7,.7); funcK0->SetParameter(0,0.013); funcK0->SetLineColor(K0S->GetMarkerColor()); TF1 *funcElectrons = new TF1("funcElectrons","[0]",-.7,.7); funcElectrons->SetParameter(0,0.013); funcElectrons->SetLineColor(Electrons->GetMarkerColor()); All->Fit(func); Lambda->Fit(funcLam); AntiLambda->Fit(funcAlam); K0S->Fit(funcK0); Electrons->Fit(funcElectrons); float k0Err900 = 0.07/0.184; float lamErr900 = 0.005/0.048; float alamErr900 = 0.006/0.047; float k0Err7 = 0.03/0.347; float lamErr7 = 0.02/0.182; float alamErr7 = lamErr7; float lambda = funcLam->GetParameter(0); cout<<"Lambda contribution 900: "; cout<<Form("%2.2f $\\pm$ %2.2f",lambda*100.0,lambda*lamErr900*100.0)<<endl; cout<<"Lambda contribution 7 "; cout<<Form("%2.2f $\\pm$ %2.2f",lambda*100.0,lambda*lamErr7*100.0)<<endl; float antilambda = funcAlam->GetParameter(0); cout<<"AntiLambda contribution 900: "; cout<<Form("%2.2f $\\pm$ %2.2f",antilambda*100.0,antilambda*alamErr900*100.0)<<endl; cout<<"AntiLambda contribution 7 "; cout<<Form("%2.2f $\\pm$ %2.2f",antilambda*100.0,antilambda*alamErr7*100.0)<<endl; float k0 = funcK0->GetParameter(0); cout<<"K0 contribution 900: "; cout<<Form("%2.2f $\\pm$ %2.2f",k0*100.0,k0*k0Err900*100.0)<<endl; cout<<"K0 contribution 7 "; cout<<Form("%2.2f $\\pm$ %2.2f",k0*100.0,k0*k0Err7*100.0)<<endl; cout<<"Total 900: "; float totalerr900 = 100.0*TMath::Sqrt(lambda*lamErr900*lambda*lamErr900+antilambda*alamErr900*antilambda*alamErr900+k0*k0Err900*k0*k0Err900); float total900 = lambda*100.0+antilambda*100.0+k0*100.0; cout<<Form("%2.2f $\\pm$ %2.2f",total900,totalerr900)<<endl; cout<<"Total 7: "; float totalerr7 = 100.0*TMath::Sqrt(lambda*lamErr7*lambda*lamErr7+antilambda*alamErr7*antilambda*alamErr7+k0*k0Err7*k0*k0Err7); float total7 = lambda*100.0+antilambda*100.0+k0*100.0; cout<<Form("%2.2f $\\pm$ %2.2f",total7,totalerr7)<<endl; //cout<<funcLam->GetParameter(0)<<" +/- "<<funcLam->GetParError(0)<<endl; cout<<"AntiLambda contribution "; //cout<<funcAlam->GetParameter(0)<<" +/- "<<funcAlam->GetParError(0)<<endl; cout<<"K0 contribution "; //cout<<funcK0->GetParameter(0)<<" +/- "<<funcK0->GetParError(0)<<endl; cout<<"Electron contribution "; //cout<<funcElectrons->GetParameter(0)<<" +/- "<<funcElectrons->GetParError(0)<<endl; All->Draw(); Electrons->Draw("same"); V0s->Draw("same"); Multistrange->Draw("same"); K0S->Draw("same"); Lambda->Draw("same"); AntiLambda->Draw("same"); TLatex *tex = new TLatex(0.161478,1.0835,"LHC10d15: p+p, Pythia6 Perugia-0"); tex->SetTextSize(0.0537634); tex->Draw(); TLegend *leg = new TLegend(0.636364,0.612903,0.893939,0.962366); leg->AddEntry(All,"All"); leg->AddEntry(Electrons,"Electrons"); leg->AddEntry(V0s,"V0s"); leg->AddEntry(K0S,"K_{S}^{0}"); leg->AddEntry(Lambda,"#Lambda"); leg->AddEntry(AntiLambda,"#bar{#Lambda}"); leg->AddEntry(Multistrange,"Multistrange"); leg->SetFillStyle(0); leg->SetFillColor(0); leg->SetBorderSize(0); leg->Draw(); TLatex *tex = new TLatex(-0.711139,0.0157696,Form("%2.5f#pm%2.5f",func->GetParameter(0),func->GetParError(0))); tex->Draw(); TLatex *texLam = new TLatex(-0.711139,0.00201613,Form("%2.5f#pm%2.5f",funcLam->GetParameter(0),funcLam->GetParError(0))); texLam->SetTextColor(Lambda->GetMarkerColor()); texLam->Draw(); TLatex *texAlam = new TLatex(-0.711139,0.00365716,Form("%2.5f#pm%2.5f",funcAlam->GetParameter(0),funcAlam->GetParError(0))); texAlam->SetTextColor(AntiLambda->GetMarkerColor()); texAlam->Draw(); TLatex *texK0 = new TLatex(-0.711139,0.008,Form("%2.5f#pm%2.5f",funcK0->GetParameter(0),funcK0->GetParError(0))); texK0->SetTextColor(K0S->GetMarkerColor()); texK0->Draw(); TCanvas *c1 = new TCanvas("c1","c1",600,400); c1->SetTopMargin(0.04); c1->SetRightMargin(0.04); c1->SetBorderSize(0); c1->SetFillColor(0); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetFrameFillColor(0); c1->SetFrameBorderMode(0); if(TPC && ITS){ Allpt->SetMaximum(0.15); Allpt->GetXaxis()->SetRange(Allpt->GetXaxis()->FindBin(0.15),Allpt->GetXaxis()->FindBin(1.)); } else{ Allpt->GetXaxis()->SetRange(Allpt->GetXaxis()->FindBin(0.1),Allpt->GetXaxis()->FindBin(0.3)); } Allpt->SetMinimum(0.0); Allpt->SetMarkerStyle(20); Allpt->Draw(); Electronspt->Draw("same"); V0spt->Draw("same"); K0Spt->Draw("same"); Lambdapt->Draw("same"); AntiLambdapt->Draw("same"); Multistrangept->Draw("same"); TLatex *texpt = new TLatex(0.161478,1.0835,"LHC10d15: p+p, Pythia6 Perugia-0"); texpt->SetTextSize(0.0537634); texpt->Draw(); TLegend *legpt = new TLegend(0.634228,0.430108,0.892617,0.905914); legpt->AddEntry(Allpt,"All"); legpt->AddEntry(Electronspt,"Electrons"); legpt->AddEntry(V0spt,"V0s"); legpt->AddEntry(K0Spt,"K_{S}^{0}"); legpt->AddEntry(Lambdapt,"#Lambda"); legpt->AddEntry(AntiLambdapt,"#bar{#Lambda}"); legpt->AddEntry(Multistrangept,"Multistrange"); legpt->SetFillStyle(0); legpt->SetFillColor(0); legpt->SetBorderSize(0); legpt->Draw(); float x = 0.399919; if(reweight) x = 0.18332; TLatex *texprod = new TLatex(x,0.140566,prodname); texprod->SetTextSize(0.0537634); texprod->Draw(); if(scale!=-1){ TString scale900 = "Using scaling from 900 GeV p+p"; TString scale7 = "Using scaling from 7 TeV p+p"; TString scaleString; if(scale==2009) scaleString = scale900; else{scaleString = scale7;} TLatex *texscale = new TLatex(0.190421,0.129782,scaleString.Data()); texscale->SetTextSize(0.0537634); texscale->Draw(); } char TPCnameeps[200]; char TPCnamepng[200]; char ITSnameeps[200]; char ITSnamepng[200]; TString *None = new TString(""); TString *Factors = None; if(kaonFactor!=1.0||lambdaFactor!=1.0||baryonEnhancement!=1.0){ Factors = new TString(Form("Lambda%2.1fKaon%2.1fBaryon%2.1f",lambdaFactor,kaonFactor,baryonEnhancement)); } TString dir = "/home/madscientistgirl/UTK/Et/aliceet/AN/pics/hadEt"; TString detector = "TPC"; if(!TPC) detector = "ITS"; TString altName = ""; if(alt) altName = "Alt"; TString bary = ""; if(reweight) bary = "Enhanced"; gSystem->MakeDirectory(Form("%s/%s",dir.Data(),shortprodname)); sprintf(TPCnameeps,"%s/%s/bkgdComponentsErrors%s%s%s%s.eps",dir.Data(),shortprodname,detector.Data(),Factors->Data(),altName.Data(),bary.Data()); sprintf(TPCnamepng,"%s/%s/bkgdComponentsErrors%s%s%s%s.png",dir.Data(),shortprodname,detector.Data(),Factors->Data(),altName.Data(),bary.Data()); c->SaveAs(TPCnameeps); //c->SaveAs(TPCnamepng); sprintf(TPCnameeps,"%s/%s/bkgdComponents%s%s%s%s.eps",dir.Data(),shortprodname,detector.Data(),Factors->Data(),altName.Data(),bary.Data()); sprintf(TPCnamepng,"%s/%s/bkgdComponents%s%s%s%s.png",dir.Data(),shortprodname,detector.Data(),Factors->Data(),altName.Data(),bary.Data()); c1->SaveAs(TPCnameeps); //c1->SaveAs(TPCnamepng); // if(TPC){ // sprintf(TPCnameeps,"pics/bkgdComponentsErrorsTPC%s.eps",Factors->Data()); // sprintf(TPCnamepng,"pics/bkgdComponentsErrorsTPC%s.png",Factors->Data()); // c->SaveAs(TPCnameeps); // c->SaveAs(TPCnamepng); // sprintf(TPCnameeps,"pics/bkgdComponentsTPC%s.eps",Factors->Data()); // sprintf(TPCnamepng,"pics/bkgdComponentsTPC%s.png",Factors->Data()); // c1->SaveAs(TPCnameeps); // c1->SaveAs(TPCnamepng); // } // else{ // sprintf(ITSnameeps,"pics/bkgdComponentsErrorsITS%s.eps",Factors->Data()); // sprintf(ITSnamepng,"pics/bkgdComponentsErrorsITS%s.png",Factors->Data()); // c->SaveAs(ITSnameeps); // c->SaveAs(ITSnamepng); // sprintf(ITSnameeps,"pics/bkgdComponentsITS%s.eps",Factors->Data()); // sprintf(ITSnamepng,"pics/bkgdComponentsITS%s.png",Factors->Data()); // c1->SaveAs(ITSnameeps); // c1->SaveAs(ITSnamepng); // } // TCanvas *c4 = new TCanvas("c4","c4",600,400); // c4->SetTopMargin(0.04); // c4->SetRightMargin(0.04); // c4->SetBorderSize(0); // c4->SetFillColor(0); // c4->SetFillColor(0); // c4->SetBorderMode(0); // c4->SetFrameFillColor(0); // c4->SetFrameBorderMode(0); // Allpt->Draw(); // c4->SaveAs("pics/bkgd276ppV07TeVITS.C"); }
b4f3ee8a2a97301115c89c43585ce080ee0d1169
eecd5e4c50d8b78a769bcc2675250576bed34066
/src/mat/impls/sbaij/mpi/mpiaijsbaij.c
1fc9b0bc5b20e5f6f2121e9e938dcc933ef1b816
[ "BSD-2-Clause" ]
permissive
petsc/petsc
3b1a04fea71858e0292f9fd4d04ea11618c50969
9c5460f9064ca60dd71a234a1f6faf93e7a6b0c9
refs/heads/main
2023-08-17T20:51:16.507070
2023-08-17T16:08:06
2023-08-17T16:08:06
8,691,401
341
169
NOASSERTION
2023-03-29T11:02:58
2013-03-10T20:55:21
C
UTF-8
C
false
false
4,003
c
mpiaijsbaij.c
#include <../src/mat/impls/sbaij/mpi/mpisbaij.h> /*I "petscmat.h" I*/ #include <../src/mat/impls/aij/mpi/mpiaij.h> #include <petsc/private/matimpl.h> #include <petscmat.h> PETSC_INTERN PetscErrorCode MatConvert_SeqAIJ_SeqBAIJ_Preallocate(Mat, PetscInt **); PETSC_INTERN PetscErrorCode MatConvert_SeqAIJ_SeqSBAIJ_Preallocate(Mat, PetscInt **); /* The code is virtually identical to MatConvert_MPIAIJ_MPIBAIJ() */ PETSC_INTERN PetscErrorCode MatConvert_MPIAIJ_MPISBAIJ(Mat A, MatType newtype, MatReuse reuse, Mat *newmat) { Mat M; Mat_MPIAIJ *mpimat = (Mat_MPIAIJ *)A->data; PetscInt *d_nnz, *o_nnz; PetscInt m, n, lm, ln, bs = PetscAbs(A->rmap->bs); PetscFunctionBegin; if (reuse != MAT_REUSE_MATRIX) { PetscCall(MatDisAssemble_MPIAIJ(A)); PetscCall(MatGetSize(A, &m, &n)); PetscCall(MatGetLocalSize(A, &lm, &ln)); PetscCall(MatConvert_SeqAIJ_SeqSBAIJ_Preallocate(mpimat->A, &d_nnz)); PetscCall(MatConvert_SeqAIJ_SeqBAIJ_Preallocate(mpimat->B, &o_nnz)); PetscCall(MatCreate(PetscObjectComm((PetscObject)A), &M)); PetscCall(MatSetSizes(M, lm, ln, m, n)); PetscCall(MatSetType(M, MATMPISBAIJ)); PetscCall(MatSeqSBAIJSetPreallocation(M, bs, 0, d_nnz)); PetscCall(MatMPISBAIJSetPreallocation(M, bs, 0, d_nnz, 0, o_nnz)); PetscCall(PetscFree(d_nnz)); PetscCall(PetscFree(o_nnz)); PetscCall(MatAssemblyBegin(A, MAT_FINAL_ASSEMBLY)); PetscCall(MatAssemblyEnd(A, MAT_FINAL_ASSEMBLY)); } else M = *newmat; /* reuse may not be equal to MAT_REUSE_MATRIX, but the basic converter will reallocate or replace newmat if this value is not used */ /* if reuse is equal to MAT_INITIAL_MATRIX, it has been appropriately preallocated before */ /* MAT_INPLACE_MATRIX, it will be replaced with MatHeaderReplace below */ PetscCall(MatConvert_Basic(A, newtype, MAT_REUSE_MATRIX, &M)); if (reuse == MAT_INPLACE_MATRIX) { PetscCall(MatHeaderReplace(A, &M)); } else *newmat = M; PetscFunctionReturn(PETSC_SUCCESS); } /* contributed by Dahai Guo <dhguo@ncsa.uiuc.edu> April 2011 */ PETSC_INTERN PetscErrorCode MatConvert_MPIBAIJ_MPISBAIJ(Mat A, MatType newtype, MatReuse reuse, Mat *newmat) { Mat M; Mat_MPIBAIJ *mpimat = (Mat_MPIBAIJ *)A->data; Mat_SeqBAIJ *Aa = (Mat_SeqBAIJ *)mpimat->A->data, *Ba = (Mat_SeqBAIJ *)mpimat->B->data; PetscInt *d_nnz, *o_nnz; PetscInt i, nz; PetscInt m, n, lm, ln; PetscInt rstart, rend; const PetscScalar *vwork; const PetscInt *cwork; PetscInt bs = A->rmap->bs; PetscFunctionBegin; if (reuse != MAT_REUSE_MATRIX) { PetscCall(MatGetSize(A, &m, &n)); PetscCall(MatGetLocalSize(A, &lm, &ln)); PetscCall(PetscMalloc2(lm / bs, &d_nnz, lm / bs, &o_nnz)); PetscCall(MatMarkDiagonal_SeqBAIJ(mpimat->A)); for (i = 0; i < lm / bs; i++) { d_nnz[i] = Aa->i[i + 1] - Aa->diag[i]; o_nnz[i] = Ba->i[i + 1] - Ba->i[i]; } PetscCall(MatCreate(PetscObjectComm((PetscObject)A), &M)); PetscCall(MatSetSizes(M, lm, ln, m, n)); PetscCall(MatSetType(M, MATMPISBAIJ)); PetscCall(MatSeqSBAIJSetPreallocation(M, bs, 0, d_nnz)); PetscCall(MatMPISBAIJSetPreallocation(M, bs, 0, d_nnz, 0, o_nnz)); PetscCall(PetscFree2(d_nnz, o_nnz)); } else M = *newmat; PetscCall(MatGetOwnershipRange(A, &rstart, &rend)); PetscCall(MatSetOption(M, MAT_IGNORE_LOWER_TRIANGULAR, PETSC_TRUE)); for (i = rstart; i < rend; i++) { PetscCall(MatGetRow(A, i, &nz, &cwork, &vwork)); PetscCall(MatSetValues(M, 1, &i, nz, cwork, vwork, INSERT_VALUES)); PetscCall(MatRestoreRow(A, i, &nz, &cwork, &vwork)); } PetscCall(MatAssemblyBegin(M, MAT_FINAL_ASSEMBLY)); PetscCall(MatAssemblyEnd(M, MAT_FINAL_ASSEMBLY)); if (reuse == MAT_INPLACE_MATRIX) { PetscCall(MatHeaderReplace(A, &M)); } else *newmat = M; PetscFunctionReturn(PETSC_SUCCESS); }
bf71c62e9d8611a3d00af47c593062f75a062105
a209da157b4911a999eaab36ab007dc1e788a77d
/src/grow-array.c
dd66180c0d599e5a19a8c836e4366cf2cbc16fa4
[ "MIT" ]
permissive
ianh/owl
dccdde2bd34405236a52f96c877138e5d837bdd1
27fca39aa8d2e4c40e5d6f13170463bb21e3acaa
refs/heads/master
2023-08-15T21:28:28.522128
2023-07-19T23:00:15
2023-07-19T23:00:15
142,875,118
715
32
MIT
2023-06-13T21:41:01
2018-07-30T12:51:28
C
UTF-8
C
false
false
555
c
grow-array.c
#include "grow-array.h" #include "alloc.h" #include <stdlib.h> #include <string.h> void *grow_array_using_realloc(void *a, uint32_t *size, size_t target_size) { if (target_size > UINT32_MAX) abort(); uint32_t n = *size; while (target_size > n) { uint32_t m = (n + 1) * 3 / 2; if (m < n) n = 0xffffffff; else n = m; if (n < 16) n = 16; } char *next_array = realloc(a, n); memset(next_array + *size, 0, n - *size); *size = n; return next_array; }
4bf8b2fc2890fd9a216d1fc361874fa8c0691c06
62bf09400de89c1aa77d8c2570d7f66cec0b5d36
/fnet_stack/stack/fnet_checksum.c
aea042db7f06633a68276ca4c70d1e5f5f579778
[ "Apache-2.0" ]
permissive
butok/FNET
41b1d2ec4cc683c1b5c188a17ab6a4bb890a6af6
ea43715752e6f6823bfcc8bdc94e440443112e7c
refs/heads/master
2023-08-03T16:32:09.317085
2023-07-20T07:01:55
2023-07-20T07:01:55
50,664,554
115
40
Apache-2.0
2023-07-20T07:01:56
2016-01-29T13:39:30
C
UTF-8
C
false
false
8,832
c
fnet_checksum.c
/************************************************************************** * * Copyright 2008-2018 by Andrey Butok. FNET Community. * *************************************************************************** * * 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. * *************************************************************************** * * Internet checksum implementation. * ***************************************************************************/ #include "fnet.h" #include "fnet_checksum.h" #include "fnet_checksum_prv.h" #include "fnet_ip4.h" static fnet_uint32_t _fnet_checksum32_nb(fnet_netbuf_t *nb, fnet_size_t length); #if !FNET_CFG_OVERLOAD_CHECKSUM_LOW static fnet_uint32_t _fnet_checksum32_low(fnet_uint32_t sum, fnet_size_t length, const fnet_uint16_t *d_ptr); #endif /*RFC: The checksum field is the 16 bit one's complement of the one's complement sum of all 16 bit words in the header and text. If a segment contains an odd number of header and text octets to be checksummed, the last octet is padded on the right with zeros to form a 16 bit word for checksum purposes. The pad is not transmitted as part of the segment. While computing the checksum, the checksum field itself is replaced with zeros. */ /************************************************************************ * DESCRIPTION: Calculates Internet checksum of nb chain. *************************************************************************/ #if !FNET_CFG_OVERLOAD_CHECKSUM_LOW static fnet_uint32_t _fnet_checksum32_low(fnet_uint32_t sum, fnet_size_t length, const fnet_uint16_t *d_ptr) { fnet_uint16_t p_byte1; fnet_int32_t current_length = (fnet_int32_t)length; while((current_length -= 32) >= 0) { sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; } current_length += 32; while((current_length -= 8) >= 0) { sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; sum += *d_ptr++; } current_length += 8; while((current_length -= 2) >= 0) { sum += *d_ptr++; } current_length += 2; if(current_length) { p_byte1 = (fnet_uint16_t)((*((const fnet_uint16_t *)d_ptr)) & FNET_NTOHS(0xFF00u)); sum += (fnet_uint16_t)p_byte1; } return sum; } #else extern fnet_uint32_t _fnet_checksum32_low(fnet_uint32_t sum, fnet_size_t length, const fnet_uint16_t *d_ptr); #endif static fnet_uint32_t _fnet_checksum32_nb(fnet_netbuf_t *nb, fnet_size_t length) { fnet_netbuf_t *tmp_nb; fnet_uint16_t *d_ptr; fnet_uint16_t p_byte2; fnet_uint32_t sum = 0U; fnet_int32_t current_length; fnet_int32_t len = (fnet_int32_t)length; tmp_nb = nb; d_ptr = (fnet_uint16_t *)tmp_nb->data_ptr; /* Store the data pointer of the 1st net_buf.*/ if(nb->length > (fnet_size_t)len) { current_length = len; /* If no more net_bufs to proceed.*/ } else { current_length = (fnet_int32_t)nb->length; /* Or full first net_buf.*/ } while(len) { len -= current_length; /* current_length bytes should be proceeded.*/ sum = _fnet_checksum32_low(sum, (fnet_size_t)current_length, d_ptr); if(len) { tmp_nb = tmp_nb->next; d_ptr = (fnet_uint16_t *)tmp_nb->data_ptr; if(((fnet_size_t)current_length & 1u) != 0u) { /* If previous fragment was odd, add in first byte in lower 8 bits. */ p_byte2 = fnet_ntohs(((fnet_uint16_t)(*((fnet_uint8_t *)d_ptr)) & 0x00FFU)); d_ptr = (fnet_uint16_t *)((fnet_uint8_t *)d_ptr + 1); sum += (fnet_uint16_t)p_byte2; len--; /* len still > 0, no check is needed */ current_length = -1; } else { current_length = 0; } if(tmp_nb->length > (fnet_size_t)len) { current_length = len; } else { current_length += (fnet_int32_t)tmp_nb->length; } } } return sum; } /************************************************************************ * DESCRIPTION: Calculates one's complement (Internet) checksum. *************************************************************************/ fnet_uint16_t _fnet_checksum_netbuf(fnet_netbuf_t *nb, fnet_size_t len) { fnet_uint32_t sum = _fnet_checksum32_nb(nb, len); /* Add potential carries - no branches. */ sum += 0xffffU; /* + 0xffff acording to RFC1624*/ /* Add accumulated carries */ while ((sum >> 16) != 0u) { sum = (sum & 0xffffu) + (sum >> 16); } return (fnet_uint16_t)(0xffffu & ~sum); } /************************************************************************ * DESCRIPTION: Calculates one's complement (Internet) checksum * for a buffer. *************************************************************************/ fnet_uint16_t fnet_checksum(fnet_uint8_t *buf, fnet_size_t buf_len) { fnet_uint32_t sum = _fnet_checksum32_low(0U, buf_len, (fnet_uint16_t *)buf); sum += 0xffffU; /* + 0xffff acording to RFC1624*/ /* Add accumulated carries */ while ((sum >> 16) != 0u) { sum = (sum & 0xffffu) + (sum >> 16); } return (fnet_uint16_t)(0xffffu & ~sum); } /************************************************************************ * DESCRIPTION: Calculates one's complement (Internet) checksum of * the IP pseudo header, for a buffer. *************************************************************************/ fnet_uint16_t fnet_checksum_pseudo(fnet_uint8_t *buf, fnet_uint16_t buf_len, fnet_uint16_t protocol, const fnet_uint8_t *ip_src, const fnet_uint8_t *ip_dest, fnet_size_t addr_size ) { fnet_uint32_t sum = _fnet_checksum32_low(0U, (fnet_size_t)buf_len, (fnet_uint16_t *)buf); sum += (fnet_uint32_t)protocol + (fnet_uint32_t)fnet_htons(buf_len); sum = _fnet_checksum32_low(sum, addr_size, (const fnet_uint16_t *)ip_src); sum = _fnet_checksum32_low(sum, addr_size, (const fnet_uint16_t *)ip_dest); /* Add accumulated carries */ while ((sum >> 16) != 0u) { sum = (sum & 0xffffu) + (sum >> 16); } return (fnet_uint16_t)(0xffffu & ~sum); } /************************************************************************ * DESCRIPTION: Calculates one's complement (Internet) checksum of * the IP pseudo header *************************************************************************/ fnet_uint16_t _fnet_checksum_pseudo_netbuf_start( fnet_netbuf_t *nb, fnet_uint16_t protocol, fnet_uint16_t protocol_len ) { fnet_uint32_t sum = _fnet_checksum32_nb(nb, (fnet_size_t)protocol_len); sum += (fnet_uint32_t)protocol + (fnet_uint32_t)fnet_htons(protocol_len); sum += 0xffffu; /* + 0xffff acording to RFC1624*/ /* Add in accumulated carries */ while ( (sum >> 16) != 0u) { sum = (sum & 0xffffu) + (sum >> 16); } return (fnet_uint16_t)(sum); } /************************************************************************ * DESCRIPTION: Calculates one's complement (Internet) checksum of * the IP pseudo header *************************************************************************/ fnet_uint16_t _fnet_checksum_pseudo_netbuf_end( fnet_uint16_t sum_s, const fnet_uint8_t *ip_src, const fnet_uint8_t *ip_dest, fnet_size_t addr_size ) { fnet_uint32_t sum = 0U; sum = sum_s; sum = _fnet_checksum32_low(sum, addr_size, (const fnet_uint16_t *)ip_src); sum = _fnet_checksum32_low(sum, addr_size, (const fnet_uint16_t *)ip_dest); sum += 0xffffU; /* Add in accumulated carries + 0xffff acording to RFC1624*/ /* Add accumulated carries */ while ( (sum >> 16) != 0u) { sum = (sum & 0xffffu) + (sum >> 16); } return (fnet_uint16_t)(0xffffu & ~sum); }
951e6b319899ec3a307baf703f7aade61d276b40
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
/SOFTWARE/A64-TERES/linux-a64/drivers/net/wireless/rtl8723cs/hal/phydm/txbf/haltxbf8822b.h
d9bc960d5cbbc3326e87cde0f7faa464ecb2c291
[ "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
787
h
haltxbf8822b.h
#ifndef __HAL_TXBF_8822B_H__ #define __HAL_TXBF_8822B_H__ #if (BEAMFORMING_SUPPORT == 1) #if (RTL8822B_SUPPORT == 1) VOID HalTxbf8822B_Init( IN PVOID pDM_VOID ); VOID HalTxbf8822B_Enter( IN PVOID pDM_VOID, IN u1Byte Idx ); VOID HalTxbf8822B_Leave( IN PVOID pDM_VOID, IN u1Byte Idx ); VOID HalTxbf8822B_Status( IN PVOID pDM_VOID, IN u1Byte Idx ); VOID HalTxbf8822B_ConfigGtab( IN PVOID pDM_VOID ); VOID HalTxbf8822B_FwTxBF( IN PVOID pDM_VOID, IN u1Byte Idx ); #else #define HalTxbf8822B_Init(pDM_VOID) #define HalTxbf8822B_Enter(pDM_VOID, Idx) #define HalTxbf8822B_Leave(pDM_VOID, Idx) #define HalTxbf8822B_Status(pDM_VOID, Idx) #define HalTxbf8822B_FwTxBF(pDM_VOID, Idx) #define HalTxbf8822B_ConfigGtab(pDM_VOID) #endif #endif #endif
da249e38ab39468c46b5bcc29553c4981e19a08d
62c8d47803da82bc6b7a276e0c54796601c66276
/src/include/rsys/noreturn.h
12aba556c9109593ce6884701f126d57878a44e9
[ "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
460
h
noreturn.h
#if !defined(_RSYS_NORETURN_H_) #define _RSYS_NORETURN_H_ /* Macros to declare a function as not returning. Put _NORET_1_ * before the function declaration (but after the extern), and *_NORET_2_ after the end. */ #ifdef __GNUC__ #define _NORET_1_ #define _NORET_2_ __attribute__((noreturn)) #elif defined(_MSC_VER) #define _NORET_1_ __declspec(noreturn) #define _NORET_2_ #else #define _NORET_1_ #define _NORET_2_ #endif #endif /* !_RSYS_NORETURN_H_ */
4b0dad516e0b53fa229b86646a89aba7fcbb987e
c9bc99866cfab223c777cfb741083be3e9439d81
/product/n1sdp/module/n1sdp_mcp_system/src/mod_n1sdp_mcp_system.c
5fd271c0778d27e71f5a9d3ab95f1db5c7bf6927
[ "BSD-3-Clause" ]
permissive
ARM-software/SCP-firmware
4738ca86ce42d82588ddafc2226a1f353ff2c797
f6bcca436768359ffeadd84d65e8ea0c3efc7ef1
refs/heads/master
2023-09-01T16:13:36.962036
2023-08-17T13:00:20
2023-08-31T07:43:37
134,399,880
211
165
NOASSERTION
2023-09-13T14:27:10
2018-05-22T10:35:56
C
UTF-8
C
false
false
10,860
c
mod_n1sdp_mcp_system.c
/* * Arm SCP/MCP Software * Copyright (c) 2018-2023, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * * Description: * N1SDP MCP System Support. */ #include "config_clock.h" #include "n1sdp_mcp_scp.h" #include "n1sdp_mcp_software_mmap.h" #include <mod_clock.h> #include <mod_n1sdp_mcp_system.h> #include <mod_pik_clock.h> #include <mod_power_domain.h> #include <mod_scmi_agent.h> #include <mod_timer.h> #include <fwk_core.h> #include <fwk_event.h> #include <fwk_id.h> #include <fwk_log.h> #include <fwk_module.h> #include <fwk_module_idx.h> #include <fwk_status.h> #include <inttypes.h> #include <stdint.h> /* Module context */ struct n1sdp_mcp_system_ctx { /* SCMI agent API pointer */ const struct mod_scmi_agent_api *scmi_agent_api; /* PIK clock API - MCP core clock */ const struct mod_clock_drv_api *pik_coreclk_api; /* PIK clock API - MCP AXI clock */ const struct mod_clock_drv_api *pik_axiclk_api; /* Timer API */ struct mod_timer_api *timer_api; /* Timer alarm API pointer */ const struct mod_timer_alarm_api *alarm_api; /* Module configuration data */ struct mod_n1sdp_mcp_system_module_config *module_config; }; static struct n1sdp_mcp_system_ctx n1sdp_mcp_system_ctx; static int put_self_event(enum mcp_system_event event_type) { struct fwk_event event = { .source_id = FWK_ID_MODULE(FWK_MODULE_IDX_N1SDP_MCP_SYSTEM), .target_id = FWK_ID_MODULE(FWK_MODULE_IDX_N1SDP_MCP_SYSTEM), .id = FWK_ID_EVENT(FWK_MODULE_IDX_N1SDP_MCP_SYSTEM, event_type), }; return fwk_put_event(&event); } static void alarm_callback(uintptr_t param) { #if FWK_LOG_LEVEL < FWK_LOG_LEVEL_CRIT enum mcp_system_event event_id_type = (enum mcp_system_event)param; #endif FWK_LOG_ERR( "[MCP SYSTEM] For event ID - %d, No response received. Timing Out!", (int)event_id_type); } static void set_alarm(int alarm_delay, enum mcp_system_event event_id_type) { n1sdp_mcp_system_ctx.alarm_api->start( n1sdp_mcp_system_ctx.module_config->alarm_id, alarm_delay, MOD_TIMER_ALARM_TYPE_ONCE, alarm_callback, event_id_type); } static void disable_alarm(void) { n1sdp_mcp_system_ctx.alarm_api->stop( n1sdp_mcp_system_ctx.module_config->alarm_id); } static bool scp_handshake_wait_condition(void *unused) { return ( *(FWK_R uint32_t *)SCMI_PAYLOAD_SCP_TO_MCP_S == N1SDP_SCP_MCP_HANDSHAKE_PATTERN); } static int get_protocol_version_response_handler(const struct fwk_event *event) { uint32_t protocol_version = 0; struct mod_scmi_agent_protocol_version_event_param *event_param; event_param = (struct mod_scmi_agent_protocol_version_event_param *)event->params; disable_alarm(); protocol_version = event_param->protocol_version; if (protocol_version != SCMI_PROTOCOL_VERSION_MANAGEMENT) { FWK_LOG_ERR( "Invalid protocol version - 0x%x received!", (unsigned int)protocol_version); return FWK_E_DATA; } FWK_LOG_INFO( "[MCP SYSTEM] Found management protocol version: 0x%x", (unsigned int)protocol_version); return put_self_event(MOD_MCP_SYSTEM_EVENT_CLOCK_STATUS_GET); } static int get_clock_status_response_handler(const struct fwk_event *event) { int status; uint32_t clock_status = 0; struct mod_scmi_agent_clock_status_event_param *event_param; event_param = (struct mod_scmi_agent_clock_status_event_param *)event->params; disable_alarm(); clock_status = event_param->clock_status; if (clock_status != SCP_CLOCK_STATUS_INITIALIZED) { FWK_LOG_ERR( "Invalid clock status - 0x%x received!", (unsigned int)clock_status); return FWK_E_DATA; } FWK_LOG_INFO( "[MCP SYSTEM] SCP clock status: 0x%x", (unsigned int)clock_status); status = n1sdp_mcp_system_ctx.pik_coreclk_api->process_power_transition( FWK_ID_ELEMENT(FWK_MODULE_IDX_PIK_CLOCK, CLOCK_PIK_IDX_MCP_CORECLK), MOD_PD_STATE_ON); if (status != FWK_SUCCESS) { return status; } status = n1sdp_mcp_system_ctx.pik_coreclk_api->process_power_transition( FWK_ID_ELEMENT(FWK_MODULE_IDX_PIK_CLOCK, CLOCK_PIK_IDX_MCP_AXICLK), MOD_PD_STATE_ON); if (status != FWK_SUCCESS) { return status; } FWK_LOG_INFO("[MCP SYSTEM] MCP PIK clocks configured"); return put_self_event(MOD_MCP_SYSTEM_EVENT_CHIPID_INFO_GET); } static int get_chipid_info_response_handler(const struct fwk_event *event) { uint8_t multichip_mode = 0; uint8_t chipid = 0; struct mod_scmi_agent_chipid_info_event_param *event_param; event_param = (struct mod_scmi_agent_chipid_info_event_param *)event->params; disable_alarm(); multichip_mode = event_param->multichip_mode; chipid = event_param->chipid; if ((chipid != 0) && (multichip_mode != 1)) { FWK_LOG_ERR( "Invalid combination chipid - 0x%x multichip_mode - 0x%x received!", chipid, multichip_mode); return FWK_E_DATA; } FWK_LOG_INFO( "[MCP SYSTEM] MC Mode: 0x%x CHIPID: 0x%x", multichip_mode, chipid); return put_self_event(MOD_MCP_SYSTEM_EVENT_INITIALIZATION_COMPLETE); } /* * Functions fulfilling the framework's module interface */ static int n1sdp_mcp_system_init( fwk_id_t module_id, unsigned int unused, const void *data) { n1sdp_mcp_system_ctx.module_config = (struct mod_n1sdp_mcp_system_module_config *)data; return FWK_SUCCESS; } static int n1sdp_mcp_system_bind(fwk_id_t id, unsigned int round) { int status; if (round == 0) { status = fwk_module_bind( FWK_ID_MODULE(FWK_MODULE_IDX_SCMI_AGENT), FWK_ID_API( FWK_MODULE_IDX_SCMI_AGENT, MOD_SCMI_AGENT_API_IDX_SYSTEM), &n1sdp_mcp_system_ctx.scmi_agent_api); if (status != FWK_SUCCESS) { return status; } status = fwk_module_bind(FWK_ID_ELEMENT(FWK_MODULE_IDX_PIK_CLOCK, CLOCK_PIK_IDX_MCP_CORECLK), FWK_ID_API(FWK_MODULE_IDX_PIK_CLOCK, MOD_PIK_CLOCK_API_TYPE_CLOCK), &n1sdp_mcp_system_ctx.pik_coreclk_api); if (status != FWK_SUCCESS) { return status; } status = fwk_module_bind( FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), FWK_ID_API(FWK_MODULE_IDX_TIMER, MOD_TIMER_API_IDX_TIMER), &n1sdp_mcp_system_ctx.timer_api); if (status != FWK_SUCCESS) { return status; } status = fwk_module_bind( n1sdp_mcp_system_ctx.module_config->alarm_id, MOD_TIMER_API_ID_ALARM, &n1sdp_mcp_system_ctx.alarm_api); if (status != FWK_SUCCESS) { return status; } return fwk_module_bind(FWK_ID_ELEMENT(FWK_MODULE_IDX_PIK_CLOCK, CLOCK_PIK_IDX_MCP_AXICLK), FWK_ID_API(FWK_MODULE_IDX_PIK_CLOCK, MOD_PIK_CLOCK_API_TYPE_CLOCK), &n1sdp_mcp_system_ctx.pik_axiclk_api); } return FWK_SUCCESS; } static int n1sdp_mcp_system_start(fwk_id_t id) { return put_self_event(MOD_MCP_SYSTEM_EVENT_SCP_HANDSHAKE); } static int n1sdp_mcp_system_process_event( const struct fwk_event *event, struct fwk_event *resp) { int status = FWK_SUCCESS; enum mcp_system_event event_id_type = fwk_id_get_event_idx(event->id); switch (event_id_type) { case MOD_MCP_SYSTEM_EVENT_SCP_HANDSHAKE: FWK_LOG_INFO("[MCP SYSTEM] Waiting for handshake pattern from SCP..."); status = n1sdp_mcp_system_ctx.timer_api->wait( FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), N1SDP_SCP_MCP_HANDSHAKE_TIMEOUT_MICROSEC, scp_handshake_wait_condition, NULL); if (status == FWK_SUCCESS) { FWK_LOG_INFO("[MCP SYSTEM] Handshake pattern received from SCP."); status = put_self_event(MOD_MCP_SYSTEM_EVENT_PROTOCOL_VERSION_GET); } else if (status == FWK_E_TIMEOUT) { FWK_LOG_ERR( "[MCP SYSTEM] No handhshake pattern received from SCP. Timing " "out!"); } else { FWK_LOG_ERR("[MCP SYSTEM] Timer initiation failed!"); } break; case MOD_MCP_SYSTEM_EVENT_PROTOCOL_VERSION_GET: if (fwk_id_is_equal( event->source_id, FWK_ID_MODULE(FWK_MODULE_IDX_N1SDP_MCP_SYSTEM))) { status = n1sdp_mcp_system_ctx.scmi_agent_api->get_protocol_version( FWK_ID_ELEMENT(FWK_MODULE_IDX_SCMI_AGENT, 0)); set_alarm( N1SDP_SCP_AGENT_SCMI_RESPONSE_TIMEOUT_MILLISEC, MOD_MCP_SYSTEM_EVENT_PROTOCOL_VERSION_GET); } else { status = get_protocol_version_response_handler(event); } break; case MOD_MCP_SYSTEM_EVENT_CLOCK_STATUS_GET: if (fwk_id_is_equal( event->source_id, FWK_ID_MODULE(FWK_MODULE_IDX_N1SDP_MCP_SYSTEM))) { status = n1sdp_mcp_system_ctx.scmi_agent_api->get_clock_status( FWK_ID_ELEMENT(FWK_MODULE_IDX_SCMI_AGENT, 0)); set_alarm( N1SDP_SCP_AGENT_SCMI_RESPONSE_TIMEOUT_MILLISEC, MOD_MCP_SYSTEM_EVENT_CLOCK_STATUS_GET); } else { status = get_clock_status_response_handler(event); } break; case MOD_MCP_SYSTEM_EVENT_CHIPID_INFO_GET: if (fwk_id_is_equal( event->source_id, FWK_ID_MODULE(FWK_MODULE_IDX_N1SDP_MCP_SYSTEM))) { status = n1sdp_mcp_system_ctx.scmi_agent_api->get_chipid_info( FWK_ID_ELEMENT(FWK_MODULE_IDX_SCMI_AGENT, 0)); set_alarm( N1SDP_SCP_AGENT_SCMI_RESPONSE_TIMEOUT_MILLISEC, MOD_MCP_SYSTEM_EVENT_CHIPID_INFO_GET); } else { status = get_chipid_info_response_handler(event); } break; case MOD_MCP_SYSTEM_EVENT_INITIALIZATION_COMPLETE: FWK_LOG_INFO("[MCP SYSTEM] MCP Initialization completed"); break; default: break; } return status; } const struct fwk_module module_n1sdp_mcp_system = { .type = FWK_MODULE_TYPE_DRIVER, .api_count = 0, .event_count = MOD_MCP_SYSTEM_EVENT_COUNT, .init = n1sdp_mcp_system_init, .bind = n1sdp_mcp_system_bind, .process_event = n1sdp_mcp_system_process_event, .start = n1sdp_mcp_system_start, };
73d883f058b1434f4ddb2dba0d9e2ec227a590b4
a398c5d782f7dc59d7fc43a67bfefdd1872f13c6
/ScriptExtender/GameDefinitions/GameObjects/Controllers.h
386f7c1771c6ad588c65ee1c152811bd59a090b4
[ "MIT" ]
permissive
Norbyte/ositools
b11f82221000f0a8be6dc85bfe6c40645746524e
e2d351a5503f8660c5c40fc4a68570373befc7d9
refs/heads/master
2023-08-14T16:31:00.481306
2023-07-28T16:11:30
2023-07-28T16:11:30
120,127,571
351
41
MIT
2023-08-30T10:32:44
2018-02-03T20:37:56
C++
UTF-8
C
false
false
9,384
h
Controllers.h
#pragma once #include <GameDefinitions/Base/Base.h> #include <GameDefinitions/Enumerations.h> #include <GameDefinitions/TurnManager.h> BEGIN_NS(esv) struct BaseController : public ProtectedGameObject<BaseController> { virtual ~BaseController() = 0; virtual void Update() = 0; virtual void UpdateCombat(eoc::CombatTeamId& teamId) = 0; virtual uint64_t GetPriority(bool&) = 0; virtual uint64_t Unkn18() = 0; virtual uint64_t Unkn20() = 0; virtual uint64_t Unkn28() = 0; virtual char const* GetName() = 0; virtual uint64_t Unkn38() = 0; int TypeId; ComponentHandle Character; }; struct StatusController : public BaseController { StatusControllerFlags Flags; int SummoningTransactionId; int PolymorphingTransactionId; int ActionTransactionId; int TeleportFallingTransactionId; int DeathAnimationTransactionId; int SteerToEnemyTransactionId; int field_34; uint32_t Flags2; glm::vec3 CombatStartPosition; bool KnockDownQueued; bool CombatStartPositionFloodDone; FixedString ResurrectedEvent; }; struct Task { virtual ~Task() = 0; virtual bool Update(GameTime const& t) = 0; virtual void SyncData(void* buf) = 0; virtual void SavegameVisit(ObjectVisitor& visitor) = 0; virtual void OnStart(GameTime const& t) = 0; virtual void Exit() = 0; virtual void Finish() = 0; virtual uint64_t Ret0() = 0; virtual void RequestExit() = 0; virtual uint64_t Ret02() = 0; virtual void* CreateBehavior() = 0; virtual bool GetTarget(uint64_t targetHandle, float& minDistance, float& maxDistance, eoc::Ai** ai, int& targetCheckType) = 0; ComponentHandle Character; TaskType TaskTypeId; uint32_t TaskState; bool Failed; uint32_t Flags; }; struct OsirisTaskFactory { using CreateTaskProc = Task * (OsirisTaskFactory* self, TaskType type, uint64_t characterHandle); using ReleaseTaskProc = void (OsirisTaskFactory* self, Task* task); Pool Pools[19]; }; struct TaskController : public BaseController { Queue<Task*> Tasks; bool RemoveNextTask_M; bool UpdateInProgress; bool FlushRequested; void PurgeQueue(); void FlushQueue(); void QueueTask(Task* task); }; struct OsirisTeleportToLocationTask : public Task { glm::vec3 Position; int field_2C; FixedString PreviousLevel; FixedString Level; bool SetRotation; bool LeaveCombat; bool FindPosition; bool FindFleePosition; bool Executed; bool field_45; bool UnchainFollowers; glm::mat3 Rotation; STDString ArriveEvent; }; struct MoveTask : public Task { uint32_t MoveTransactionId; glm::vec3 CurrentTarget; STDString ArriveEvent; ObjectSet<eoc::AiPathCheckpoint> Checkpoints; float TimeSpent; float TimeTargetFound; }; struct OsirisMoveToObjectTask : public MoveTask { float MinDistance; float MaxDistance; ComponentHandle Target; float SpeedMultiplier; float DefaultSpeed; bool IncreaseSpeed; }; struct OsirisMoveInRangeTask : public MoveTask { ComponentHandle Target; glm::vec3 TargetPos; float MinRange; float WantedRange; float MaxRange; glm::vec3 CachedTargetPos; glm::vec3 CachedTarget; float CachedCloseEnough; bool CachedResult; bool MustBeInTrigger; bool FallbackMoveCloser; bool AttackMove; ObjectSet<AIHintAreaTrigger*> HintTriggers; GameObjectTemplate* ProjectileTemplate; stats::SkillPrototype* Skill; }; struct OsirisMoveToLocationTask : public MoveTask { float TargetRotation; float MinDistance; float MaxDistance; ComponentHandle TargetToIgnore; bool TargetRotationSet; }; struct OsirisFleeTask : public MoveTask { int FleeFromRelation; float FleeFromRelationRange; glm::vec3 StartPosition; // TODO - AiFlags? uint64_t FleeFromTileStates; ObjectSet<SurfacePathInfluence> SurfacePathInfluences; bool OutOfSight; bool StartedMoving; uint64_t FindFleePositionFlood[16]; }; struct OsirisPlayAnimationTask : public Task { FixedString OriginalAnimation; FixedString Animation; FixedString EndAnimation; STDString FinishedEvent; bool WaitForCompletion; bool ExitOnFinish; bool NoBlend; uint32_t ActionTransactionId; float Time; float Timer; float AnimationDuration; ObjectSet<FixedString> AnimationNames; float CurrentTime; }; struct OsirisAttackTask : public Task { ComponentHandle Target; glm::vec3 TargetPos; STDString ArriveEvent; uint32_t BehaviorTransactionId; bool WithoutMove; bool AlwaysHit; }; struct OsirisUseSkillTask : public Task { FixedString Skill; bool Force; ComponentHandle Target; glm::vec3 TargetPos; uint32_t BehaviorTransactionId; bool Success; bool IgnoreHasSkill; bool IgnoreChecks; }; struct OsirisAppearTask : public Task { ComponentHandle Target; glm::vec3 TargetPos; float Angle; uint32_t SpawnState; bool PlayerSpawn; bool OutOfSight; bool OnTrail; STDString FinishedEvent; FixedString Animation; }; struct OsirisDisappearTask : public Task { ComponentHandle Target; float Angle; bool OutOfSight; bool OffStage; bool Running; bool ValidTarget; glm::vec3 TargetPos; STDString FinishedEvent; float SpeedMultiplier; float DefaultSpeed; bool IncreaseSpeed; int DisappearCount; }; struct OsirisFollowNPCTask : public Task { ComponentHandle Target; }; struct OsirisWanderTask : public Task { float Range; ComponentHandle Trigger; ComponentHandle Anchor; float Duration; bool Running; glm::vec3 Start; }; struct OsirisSteerTask : public Task { ComponentHandle Target; glm::vec3 TargetPos; float AngleTolerance; bool LookAt; bool SnapToTarget; uint32_t SteeringTransactionId; }; struct OsirisDropTask : public Task { ComponentHandle Item; glm::vec3 TargetPos; }; struct OsirisPickupItemTask : public Task { ComponentHandle Item; STDString ArriveEvent; uint32_t BehaviorTransactionId; }; struct OsirisUseItemTask : public Task { ComponentHandle Item; STDString ArriveEvent; uint32_t BehaviorTransactionId; }; struct OsirisMoveItemTask : public Task { ComponentHandle Item; glm::vec3 Position; int Amount; STDString ArriveEvent; uint32_t BehaviorTransactionId; }; struct OsirisResurrectTask : public Task { int HPPercentage; bool IsResurrected; FixedString Animation; }; struct OsirisMoveToAndTalkTask : public Task { ComponentHandle Target; uint32_t BehaviorTransactionId; FixedString Movement; FixedString DialogInstanceID; bool IsAutomatedDialog; float Timeout; }; END_NS() BEGIN_NS(ecl) struct CursorControl : public ProtectedGameObject<CursorControl> { void* InputEventListenerVMT; void* InputDeviceListenerVMT; bool CursorShown; bool HasTextDisplay; float HideTimer; float InputHideTimer; FixedString HWMouseCursor; uint32_t Flags; CursorType MouseCursor; uint32_t RequestedFlags; uint32_t field_34; ComponentHandle TextDisplayUIHandle; }; struct CharacterTask { virtual ~CharacterTask() {} virtual CharacterTask* CreateNew() = 0; virtual void RaiseFlags(CharacterTaskFlags flags) = 0; virtual void ClearFlags(CharacterTaskFlags flags) = 0; virtual void SetCharacter(Character* c) = 0; virtual void Start() = 0; virtual void Stop() = 0; virtual bool CanEnter() = 0; virtual int GetPriority(int previousPriority) = 0; virtual int GetExecutePriority(int previousPriority) = 0; virtual int GetActionCost() = 0; virtual int GetTotalAPCost() = 0; virtual uint64_t GetAPWarning() = 0; virtual uint64_t GetError() = 0; virtual void SetCursor() = 0; virtual void GetTaskInfo(eoc::Text& taskInfo, bool showAll) = 0; virtual WORD* HandleInputEvent(WORD& result, InputEvent* e) = 0; virtual void EnterPreview() = 0; virtual void UpdatePreview() = 0; virtual void ExitPreview() = 0; virtual bool IsInPreview() = 0; virtual bool GetAbilityAndFlags(uint32_t*) = 0; virtual float GetSightRange() = 0; virtual void ClearAIColliding() = 0; virtual void SetAIColliding() = 0; virtual int ValidateTargetRange() = 0; virtual bool Enter() = 0; virtual bool Update() = 0; virtual void Exit() = 0; virtual bool CanExit() = 0; virtual bool CanExit2() = 0; virtual void GetDescription(eoc::Text& desc) = 0; virtual bool SyncSurfaceCells(ObjectSet<SurfaceCell>*) = 0; virtual ComponentHandle* CreatePreviewEffect(ComponentHandle& pEffect) = 0; virtual void GetAPDescription(eoc::Text& desc) = 0; struct Context { glm::vec3 Position{.0f, .0f, .0f}; int CurrentAP{0}; int RemainingMoveDistance{0}; ObjectSet<ComponentHandle> field_18; }; Character *BoundCharacter{nullptr}; int ActionTypeId{ 0 }; CharacterTaskFlags Flags{ 0 }; Context CurrentContext; Context SavedContext; bool IsInPreviewMode{false}; bool RequestRun{false}; }; struct BaseController : public ProtectedGameObject<BaseController> { void* VMT; int TypeId; ComponentHandle Character; }; struct InputController : public BaseController { bool IsActive; bool HasExited; float TimeElapsed; bool IsDragging; bool field_21; bool IsPicking; bool PickedNoObject; glm::vec2 MousePos; int field_2C; ObjectSet<CharacterTask*> TaskPrototypes; ComponentHandle DraggingObjectHandle; uint8_t Flags; CharacterTask* CurrentTask; CharacterTask* PreviewTask; ObjectSet<CharacterTask*> ChosenTasks; uint8_t TaskFlags; }; struct StatusController : public BaseController { ecl::StatusControllerFlags Flags; uint32_t SummoningTransactionId; uint32_t PolymorphingTransactionId; uint32_t KnockedDownTransactionId; uint32_t TeleportFallTransactionId; bool SetKnockedDown; }; struct DialogController : public BaseController { bool IsSteering; }; END_NS()
5ea0d8204a58029f1ac978a037440af22d406e3b
21c92afbd7fd022a206fb31294c523aebb770104
/SuiteSparse/CHOLMOD/GPU/cholmod_gpu_kernels.c
95d1378c4c23e1c46775bb515ee8b42cab698373
[ "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference", "GPL-2.0-or-later", "GPL-3.0-only", "LGPL-2.1-or-later", "LGPL-2.0-or-later", "GPL-1.0-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
jlblancoc/suitesparse-metis-for-windows
70e6bcab2b525afb41758d61f823efa0618f67cf
5ee2eb4bc7bfd6d27af2f7fb027b1545cfc0fa3f
refs/heads/master
2023-08-30T21:15:39.624300
2023-03-09T10:16:48
2023-03-09T10:16:48
16,236,582
423
251
BSD-3-Clause
2023-03-09T10:18:08
2014-01-25T18:06:21
C
UTF-8
C
false
false
312
c
cholmod_gpu_kernels.c
/* ========================================================================== */ /* === cholmod_gpu_kernels.c ================================================ */ /* ========================================================================== */ /* a dummy file to satisfy 'make' when the GPU is not available */
c087290ff914eaf9d3655e82a0dc73b9ebd06fad
d411dcad6fe4f3753a9f3c4308b05afcfc616861
/tests/mf_json_save.c
c0072bb62aca50dea0d64a832ca825f70f602aab
[ "MIT" ]
permissive
alexanderchuranov/Metaresc
488abc039f6243dbe22cbb0a2247b6c34b6c3082
3c4e281f7d29d8bba4ace4fff9bfecdf5c604840
refs/heads/master
2023-08-18T01:02:14.081253
2023-08-02T20:48:33
2023-08-02T20:48:33
1,439,401
134
20
NOASSERTION
2023-07-24T05:15:14
2011-03-04T13:29:04
C
UTF-8
C
false
false
54
c
mf_json_save.c
#include <mem_failures.h> TEST_MF_SAVE_METHOD (JSON)
a705241408b952cfae9e22157bcc4abbfe0f6e19
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
/lib/libc/mingw/stdio/snprintf.c
2e43a67aeee4252d78cd5adf4e14dfea4d598e84
[ "LGPL-2.0-or-later", "ZPL-2.1", "LicenseRef-scancode-public-domain", "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
494
c
snprintf.c
/** * This file has no copyright assigned and is placed in the Public Domain. * This file is part of the mingw-w64 runtime package. * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ #include <stdarg.h> #include <stdio.h> int __cdecl __ms_snprintf(char* buffer, size_t n, const char *format, ...) { int retval; va_list argptr; va_start(argptr, format); retval = __ms_vsnprintf(buffer, n, format, argptr); va_end(argptr); return retval; }
5cd31c83d2ea85c93b1a76fb460d56c1161beb35
7f82fd0f96c8d9c056a196bb957ed44a4d55a96d
/chap06/web_get.c
25cc2633c7c5756fe54df8f2ace425dcdfe8b70e
[ "MIT" ]
permissive
codeplea/Hands-On-Network-Programming-with-C
f84c94f48d37b9601f5eff2a5be7ea42d0236c62
54be3edbd4a0f4b16ab858a04b621616339ddb04
refs/heads/master
2023-06-21T09:36:30.223479
2023-06-10T18:19:35
2023-06-10T18:19:35
183,856,462
410
168
MIT
2023-06-10T18:19:36
2019-04-28T04:42:36
C
UTF-8
C
false
false
8,006
c
web_get.c
/* * MIT License * * Copyright (c) 2018 Lewis Van Winkle * * 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 "chap06.h" #define TIMEOUT 5.0 void parse_url(char *url, char **hostname, char **port, char** path) { printf("URL: %s\n", url); char *p; p = strstr(url, "://"); char *protocol = 0; if (p) { protocol = url; *p = 0; p += 3; } else { p = url; } if (protocol) { if (strcmp(protocol, "http")) { fprintf(stderr, "Unknown protocol '%s'. Only 'http' is supported.\n", protocol); exit(1); } } *hostname = p; while (*p && *p != ':' && *p != '/' && *p != '#') ++p; *port = "80"; if (*p == ':') { *p++ = 0; *port = p; } while (*p && *p != '/' && *p != '#') ++p; *path = p; if (*p == '/') { *path = p + 1; } *p = 0; ++p; while (*p && *p != '#') ++p; if (*p == '#') *p = 0; printf("hostname: %s\n", *hostname); printf("port: %s\n", *port); printf("path: %s\n", *path); } void send_request(SOCKET s, char *hostname, char *port, char *path) { char buffer[2048]; sprintf(buffer, "GET /%s HTTP/1.1\r\n", path); sprintf(buffer + strlen(buffer), "Host: %s:%s\r\n", hostname, port); sprintf(buffer + strlen(buffer), "Connection: close\r\n"); sprintf(buffer + strlen(buffer), "User-Agent: honpwc web_get 1.0\r\n"); sprintf(buffer + strlen(buffer), "\r\n"); send(s, buffer, strlen(buffer), 0); printf("Sent Headers:\n%s", buffer); } SOCKET connect_to_host(char *hostname, char *port) { printf("Configuring remote address...\n"); struct addrinfo hints; memset(&hints, 0, sizeof(hints)); hints.ai_socktype = SOCK_STREAM; struct addrinfo *peer_address; if (getaddrinfo(hostname, port, &hints, &peer_address)) { fprintf(stderr, "getaddrinfo() failed. (%d)\n", GETSOCKETERRNO()); exit(1); } printf("Remote address is: "); char address_buffer[100]; char service_buffer[100]; getnameinfo(peer_address->ai_addr, peer_address->ai_addrlen, address_buffer, sizeof(address_buffer), service_buffer, sizeof(service_buffer), NI_NUMERICHOST); printf("%s %s\n", address_buffer, service_buffer); printf("Creating socket...\n"); SOCKET server; server = socket(peer_address->ai_family, peer_address->ai_socktype, peer_address->ai_protocol); if (!ISVALIDSOCKET(server)) { fprintf(stderr, "socket() failed. (%d)\n", GETSOCKETERRNO()); exit(1); } printf("Connecting...\n"); if (connect(server, peer_address->ai_addr, peer_address->ai_addrlen)) { fprintf(stderr, "connect() failed. (%d)\n", GETSOCKETERRNO()); exit(1); } freeaddrinfo(peer_address); printf("Connected.\n\n"); return server; } int main(int argc, char *argv[]) { #if defined(_WIN32) WSADATA d; if (WSAStartup(MAKEWORD(2, 2), &d)) { fprintf(stderr, "Failed to initialize.\n"); return 1; } #endif if (argc < 2) { fprintf(stderr, "usage: web_get url\n"); return 1; } char *url = argv[1]; char *hostname, *port, *path; parse_url(url, &hostname, &port, &path); SOCKET server = connect_to_host(hostname, port); send_request(server, hostname, port, path); const clock_t start_time = clock(); #define RESPONSE_SIZE 32768 char response[RESPONSE_SIZE+1]; char *p = response, *q; char *end = response + RESPONSE_SIZE; char *body = 0; enum {length, chunked, connection}; int encoding = 0; int remaining = 0; while(1) { if ((clock() - start_time) / CLOCKS_PER_SEC > TIMEOUT) { fprintf(stderr, "timeout after %.2f seconds\n", TIMEOUT); return 1; } if (p == end) { fprintf(stderr, "out of buffer space\n"); return 1; } fd_set reads; FD_ZERO(&reads); FD_SET(server, &reads); struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 200000; if (select(server+1, &reads, 0, 0, &timeout) < 0) { fprintf(stderr, "select() failed. (%d)\n", GETSOCKETERRNO()); return 1; } if (FD_ISSET(server, &reads)) { int bytes_received = recv(server, p, end - p, 0); if (bytes_received < 1) { if (encoding == connection && body) { printf("%.*s", (int)(end - body), body); } printf("\nConnection closed by peer.\n"); break; } /*printf("Received (%d bytes): '%.*s'", bytes_received, bytes_received, p);*/ p += bytes_received; *p = 0; if (!body && (body = strstr(response, "\r\n\r\n"))) { *body = 0; body += 4; printf("Received Headers:\n%s\n", response); q = strstr(response, "\nContent-Length: "); if (q) { encoding = length; q = strchr(q, ' '); q += 1; remaining = strtol(q, 0, 10); } else { q = strstr(response, "\nTransfer-Encoding: chunked"); if (q) { encoding = chunked; remaining = 0; } else { encoding = connection; } } printf("\nReceived Body:\n"); } if (body) { if (encoding == length) { if (p - body >= remaining) { printf("%.*s", remaining, body); break; } } else if (encoding == chunked) { do { if (remaining == 0) { if ((q = strstr(body, "\r\n"))) { remaining = strtol(body, 0, 16); if (!remaining) goto finish; body = q + 2; } else { break; } } if (remaining && p - body >= remaining) { printf("%.*s", remaining, body); body += remaining + 2; remaining = 0; } } while (!remaining); } } //if (body) } //if FDSET } //end while(1) finish: printf("\nClosing socket...\n"); CLOSESOCKET(server); #if defined(_WIN32) WSACleanup(); #endif printf("Finished.\n"); return 0; }
c462e2b5958b72a7f6dab6db6f9a928c50f2ce07
985145be0e9bc5c66b02007f5d7fe867e899ee0f
/src/yaml/convert_yaml_to_json.c
cc4454d129af6c4074fbe5b988dcf335ead00bf5
[ "BSD-3-Clause" ]
permissive
getdnsapi/stubby
e7d396f115886874fa991d3b7160b28b0cb5f4a9
9292e28f60e2377a977a52a69ee0436a19141443
refs/heads/develop
2023-07-07T05:21:19.079499
2023-06-26T14:45:28
2023-06-26T14:45:28
95,496,457
1,208
129
BSD-3-Clause
2023-09-12T23:01:58
2017-06-26T22:58:14
C
UTF-8
C
false
false
13,534
c
convert_yaml_to_json.c
/* * Copyright (c) 2017, 2019, 2020, Sinodun Internet Technologies Ltd. * 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 names of the copyright holders 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 Verisign, Inc. 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 <stdint.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <assert.h> #include "config.h" #include <yaml.h> #ifndef yaml_string_to_json_string #include "gldns/gbuffer.h" #else #include "sldns/sbuffer.h" #endif #include "convert_yaml_to_json.h" static int process_yaml_stream(yaml_parser_t *, yaml_event_t *, gldns_buffer *); static int process_yaml_document(yaml_parser_t *, yaml_event_t *, gldns_buffer *); static int process_yaml_mapping(yaml_parser_t *, yaml_event_t *, gldns_buffer *); static int process_yaml_sequence(yaml_parser_t *, yaml_event_t *, gldns_buffer *); static int process_yaml_value(yaml_parser_t *, yaml_event_t *, gldns_buffer *); static int output_scalar(yaml_event_t *, gldns_buffer *); static void report_parser_error(yaml_parser_t *); static char* event_type_string(yaml_event_type_t); static int quote_next_scalar; static const char* QUOTE_KEY_VALUES[] = { "tls_ca_path", "tls_ca_file", "tls_cipher_list", "tls_ciphersuites", "tls_curves_list", "appdata_dir", "dnssec_trust_anchors", "tls_auth_name", "digest", "resolvconf", NULL }; static void quote_key_values(const char *key) { quote_next_scalar = 0; for ( const char** p = QUOTE_KEY_VALUES; *p; p++ ) if ( !strcmp(key, *p) ) { quote_next_scalar = 1; break; } } /* public functions */ char * yaml_string_to_json_string(const char *instr) { assert(instr); gldns_buffer *buf; char* json = NULL; buf = gldns_buffer_new(8192); if (!buf) { fprintf(stderr, "Could not assign buffer for json output"); return NULL; } yaml_parser_t parser; yaml_event_t event; memset(&parser, 0, sizeof(parser)); memset(&event, 0, sizeof(event)); quote_next_scalar = 0; if (!yaml_parser_initialize(&parser)) { fprintf(stderr, "Could not initialize the parser object\n"); goto return_error; } /* Set the parser parameters. */ yaml_parser_set_input_string(&parser, (const unsigned char *) instr, strlen(instr)); /* Get the first event. */ if (!yaml_parser_parse(&parser, &event)) { report_parser_error(&parser); goto return_error; } /* First event should be stream start. */ if (event.type != YAML_STREAM_START_EVENT) { fprintf(stderr, "Event error: wrong type of event: %d\n", event.type); goto return_error; } if (process_yaml_stream(&parser, &event, buf) != 0) { goto return_error; } yaml_event_delete(&event); yaml_parser_delete(&parser); /* * gldns_buffer_export() returns a pointer to the data and * sets a flag to prevent it from being deleted by * gldns_buffer_free() */ json = (char *) gldns_buffer_export(buf); gldns_buffer_free(buf); return json; return_error: yaml_event_delete(&event); yaml_parser_delete(&parser); gldns_buffer_free(buf); return NULL; } /* local functions */ int process_yaml_stream(yaml_parser_t *parser, yaml_event_t *event, gldns_buffer *buf) { assert(parser); assert(event); assert(buf); int done = 0; while (!done) { /* Delete the event that brought us here */ yaml_event_delete(event); /* Get the next event. */ if (!yaml_parser_parse(parser, event)) { report_parser_error(parser); return -1; } switch (event->type) { case YAML_STREAM_END_EVENT: done = 1; break; case YAML_DOCUMENT_START_EVENT: if (process_yaml_document(parser, event, buf) != 0) { return -1; } break; case YAML_STREAM_START_EVENT: case YAML_DOCUMENT_END_EVENT: case YAML_ALIAS_EVENT: case YAML_SCALAR_EVENT: case YAML_SEQUENCE_START_EVENT: case YAML_SEQUENCE_END_EVENT: case YAML_MAPPING_START_EVENT: case YAML_MAPPING_END_EVENT: fprintf(stderr, "Event error: %s. Expected YAML_DOCUMENT_START_EVENT or YAML_STREAM_END_EVENT.\n", event_type_string(event->type)); return -1; default: /* NOTREACHED */ break; } } return 0; } int process_yaml_document(yaml_parser_t *parser, yaml_event_t *event, gldns_buffer *buf) { assert(parser); assert(event); assert(buf); int done = 0; while (!done) { /* Delete the event that brought us here */ yaml_event_delete(event); /* Get the next event. */ if (!yaml_parser_parse(parser, event)) { report_parser_error(parser); return -1; } switch (event->type) { case YAML_DOCUMENT_END_EVENT: done = 1; break; case YAML_MAPPING_START_EVENT: if (process_yaml_mapping(parser, event, buf) != 0) { return -1; } break; case YAML_SEQUENCE_START_EVENT: if (process_yaml_sequence(parser, event, buf) != 0) { return -1; } break; case YAML_SCALAR_EVENT: if (output_scalar(event, buf) != 0) { fprintf(stderr, "Value error: Error outputting scalar\n"); return -1; } break; case YAML_STREAM_START_EVENT: case YAML_STREAM_END_EVENT: case YAML_DOCUMENT_START_EVENT: case YAML_ALIAS_EVENT: case YAML_SEQUENCE_END_EVENT: case YAML_MAPPING_END_EVENT: fprintf(stderr, "Event error: %s. Expected YAML_MAPPING_START_EVENT or YAML_DOCUMENT_END_EVENT.\n", event_type_string(event->type)); return -1; default: /* NOTREACHED */ break; } } return 0; } int process_yaml_mapping(yaml_parser_t *parser, yaml_event_t *event, gldns_buffer *buf) { assert(parser); assert(event); assert(buf); int done = 0; int members = 0; if ( gldns_buffer_printf(buf, "{ ") == -1 ) return -1; while (!done) { /* Delete the event that brought us here */ yaml_event_delete(event); /* Get the next event. */ if (!yaml_parser_parse(parser, event)) { report_parser_error(parser); return -1; } if (event->type == YAML_SCALAR_EVENT) { if (members) if (gldns_buffer_printf(buf, ", ") == -1) return -1; quote_next_scalar = 0; if (output_scalar(event, buf) != 0) { fprintf(stderr, "Mapping error: Error outputting key\n"); return -1; } if (gldns_buffer_printf(buf, ": ") == -1) return -1; members = 1; quote_key_values((const char*)event->data.scalar.value); } else if (event->type == YAML_MAPPING_END_EVENT) { if (gldns_buffer_printf(buf, " }") == -1) return -1; done = 1; continue; } else { fprintf(stderr, "Event error: %s. Expected YAML_SCALAR_EVENT or YAML_MAPPING_END_EVENT.\n", event_type_string(event->type)); return -1; } /* Delete the event that brought us here */ yaml_event_delete(event); /* Get the next event. */ if (!yaml_parser_parse(parser, event)) { report_parser_error(parser); return -1; } switch (event->type) { case YAML_SCALAR_EVENT: case YAML_SEQUENCE_START_EVENT: case YAML_MAPPING_START_EVENT: if (process_yaml_value(parser, event, buf) != 0) { return -1; } break; case YAML_STREAM_START_EVENT: case YAML_STREAM_END_EVENT: case YAML_DOCUMENT_START_EVENT: case YAML_DOCUMENT_END_EVENT: case YAML_ALIAS_EVENT: case YAML_SEQUENCE_END_EVENT: case YAML_MAPPING_END_EVENT: fprintf(stderr, "Event error: %s. Expected YAML_MAPPING_START_EVENT, YAML_SEQUENCE_START_EVENT or YAML_SCALAR_EVENT.\n", event_type_string(event->type)); return -1; default: /* NOTREACHED */ break; } } return 0; } int process_yaml_sequence(yaml_parser_t *parser, yaml_event_t *event, gldns_buffer *buf) { assert(parser); assert(event); assert(buf); int done = 0; int elements = 0; if ( gldns_buffer_printf(buf, "[ ") == -1 ) return -1; while (!done) { /* Delete the event that brought us here */ yaml_event_delete(event); /* Get the next event. */ if (!yaml_parser_parse(parser, event)) { report_parser_error(parser); return -1; } switch (event->type) { case YAML_SCALAR_EVENT: case YAML_SEQUENCE_START_EVENT: case YAML_MAPPING_START_EVENT: if (elements) if (gldns_buffer_printf(buf, ", ") == -1) return -1; if (process_yaml_value(parser, event, buf) != 0) return -1; elements = 1; break; case YAML_SEQUENCE_END_EVENT: if (gldns_buffer_printf(buf, " ]") == -1) return -1; done = 1; break; case YAML_STREAM_START_EVENT: case YAML_STREAM_END_EVENT: case YAML_DOCUMENT_START_EVENT: case YAML_DOCUMENT_END_EVENT: case YAML_ALIAS_EVENT: case YAML_MAPPING_END_EVENT: fprintf(stderr, "Event error: %s. Expected YAML_MAPPING_START_EVENT, YAML_SEQUENCE_START_EVENT, YAML_SCALAR_EVENT or YAML_SEQUENCE_END_EVENT.\n", event_type_string(event->type)); return -1; default: /* NOTREACHED */ break; } } return 0; } int process_yaml_value(yaml_parser_t *parser, yaml_event_t *event, gldns_buffer *buf) { assert(parser); assert(event); assert(buf); switch (event->type) { case YAML_SCALAR_EVENT: if (output_scalar(event, buf) != 0) { fprintf(stderr, "Value error: Error outputting scalar\n"); return -1; } break; case YAML_SEQUENCE_START_EVENT: if (process_yaml_sequence(parser, event, buf) != 0) { return -1; } break; case YAML_MAPPING_START_EVENT: if (process_yaml_mapping(parser, event, buf) != 0) { return -1; } break; default: fprintf(stderr, "Bug: calling process_yaml_value() in the wrong context"); return -1; } return 0; } int output_scalar(yaml_event_t *event, gldns_buffer *buf) { const char *fmt = "%s"; assert(event); assert(buf); assert(event->data.scalar.length > 0); if (quote_next_scalar) fmt = "\"%s\""; if ( gldns_buffer_printf(buf, fmt, event->data.scalar.value) == -1 ) return -1; return 0; } void report_parser_error(yaml_parser_t *parser) { assert(parser); /* Display a parser error message. */ switch (parser->error) { case YAML_MEMORY_ERROR: fprintf(stderr, "Memory error: Not enough memory for parsing\n"); break; case YAML_READER_ERROR: if (parser->problem_value != -1) { fprintf(stderr, "Reader error: %s: #%X at %"PRIsz"\n", parser->problem, parser->problem_value, parser->problem_offset); } else { fprintf(stderr, "Reader error: %s at %"PRIsz"\n", parser->problem, parser->problem_offset); } break; case YAML_SCANNER_ERROR: if (parser->context) { fprintf(stderr, "Scanner error: %s at line %"PRIsz", column %"PRIsz"\n" "%s at line %"PRIsz", column %"PRIsz"\n", parser->context, parser->context_mark.line+1, parser->context_mark.column+1, parser->problem, parser->problem_mark.line+1, parser->problem_mark.column+1); } else { fprintf(stderr, "Scanner error: %s at line %"PRIsz", column %"PRIsz"\n", parser->problem, parser->problem_mark.line+1, parser->problem_mark.column+1); } break; case YAML_PARSER_ERROR: if (parser->context) { fprintf(stderr, "Parser error: %s at line %"PRIsz", column %"PRIsz"\n" "%s at line %"PRIsz", column %"PRIsz"\n", parser->context, parser->context_mark.line+1, parser->context_mark.column+1, parser->problem, parser->problem_mark.line+1, parser->problem_mark.column+1); } else { fprintf(stderr, "Parser error: %s at line %"PRIsz", column %"PRIsz"\n", parser->problem, parser->problem_mark.line+1, parser->problem_mark.column+1); } break; default: /* Couldn't happen. */ fprintf(stderr, "Internal error\n"); break; } return; } /* TODO - improve this */ char* event_type_string(yaml_event_type_t type) { switch (type) { case YAML_STREAM_START_EVENT: return "YAML_STREAM_START_EVENT"; case YAML_STREAM_END_EVENT: return "YAML_STREAM_END_EVENT"; case YAML_DOCUMENT_START_EVENT: return "YAML_DOCUMENT_START_EVENT"; case YAML_DOCUMENT_END_EVENT: return "YAML_DOCUMENT_END_EVENT"; case YAML_ALIAS_EVENT: return "YAML_ALIAS_EVENT"; case YAML_SCALAR_EVENT: return "YAML_SCALAR_EVENT"; case YAML_SEQUENCE_START_EVENT: return "YAML_SEQUENCE_START_EVENT"; case YAML_SEQUENCE_END_EVENT: return "YAML_SEQUENCE_END_EVENT"; case YAML_MAPPING_START_EVENT: return "YAML_MAPPING_START_EVENT"; case YAML_MAPPING_END_EVENT: return "YAML_MAPPING_END_EVENT"; default: /* NOTREACHED */ return NULL; } return NULL; }
52d5d1846e6cca82f288f68156e1ac216a83a3fb
549f66608f0cb4e50cee2e51c53206e798ab82cd
/test/Feature/ubsan/ubsan_implicit_signed_integer_truncation.c
d2ff1e765ac75773dcf70e0c63da7561c82ea244
[ "NCSA" ]
permissive
klee/klee
c8da2f9668ee199af47cd2c784cea979017d7704
7082eafd05b4f268132ab94772c0243dbebf5087
refs/heads/master
2023-08-04T08:10:38.619540
2023-06-23T21:34:12
2023-07-21T09:00:02
11,568,417
2,339
679
NOASSERTION
2023-09-11T10:23:26
2013-07-21T22:03:03
C++
UTF-8
C
false
false
748
c
ubsan_implicit_signed_integer_truncation.c
// RUN: %clang %s -fsanitize=implicit-signed-integer-truncation -emit-llvm -g %O0opt -c -o %t.bc // RUN: rm -rf %t.klee-out // RUN: %klee --output-dir=%t.klee-out --emit-all-errors --ubsan-runtime %t.bc 2>&1 | FileCheck %s // RUN: ls %t.klee-out/ | grep .ktest | wc -l | grep 2 // RUN: ls %t.klee-out/ | grep .implicit_truncation.err | wc -l | grep 1 #include "klee/klee.h" unsigned char convert_signed_int_to_unsigned_char(signed int x) { // CHECK: KLEE: ERROR: {{.*}}runtime/Sanitizer/ubsan/ubsan_handlers.cpp:{{[0-9]+}}: implicit-signed-integer-truncation return x; } int main() { signed int x; volatile unsigned char result; klee_make_symbolic(&x, sizeof(x), "x"); result = convert_signed_int_to_unsigned_char(x); return 0; }
c814d1a703e5a7bf12d2c2f1876e8af1d46dbc7e
06e63eafe97e0d887efd3b9ff51e3f0885fed9eb
/wdoc/spanish_index_htm.h
db0bc674829a5373ef28c5ea91bfaa41bcc0e391
[]
no_license
vitotai/BrewPiLess
a63b79e10b52cd325e4b4d38b9f2776531b0ba21
2bad79f370eafc6f3d0df393277b5985ced1155e
refs/heads/master
2023-07-26T16:05:52.656689
2023-07-24T07:49:32
2023-07-24T07:49:32
63,991,508
332
165
null
2023-02-24T18:56:43
2016-07-23T00:34:53
C
UTF-8
C
false
false
163,150
h
spanish_index_htm.h
const unsigned char data_index_htm_gz[] PROGMEM = { 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xec, 0xbd, 0xed, 0x76, 0xdb, 0xb8, 0xb2, 0x20, 0xfa, 0x7b, 0xf2, 0x14, 0x34, 0x7b, 0xda, 0x21, 0x63, 0x4a, 0x96, 0x64, 0xd9, 0x71, 0xa4, 0xd0, 0x9e, 0xc4, 0x49, 0x3a, 0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x99, 0x03, 0x4e, 0x36, 0x4d, 0xf9, 0x42, 0xca, 0x51, 0x1f, 0x65, 0xf7, 0x0d, 0x87, 0x4a, 0x03, 0x15, 0x23, 0x43, 0xc5, 0x08, 0xec, 0xe0, 0x39, 0xcd, 0xd6, 0x54, 0xda, 0x68, 0x28, 0x0d, 0x9e, 0x16, 0x47, 0x8f, 0x7b, 0x43, 0x7b, 0x72, 0x3b, 0x79, 0x4f, 0xb0, 0x11, 0x8a, 0xdf, 0x0f, 0xe6, 0x41, 0x33, 0x46, 0x78, 0x84, 0xc9, 0x2a, 0x98, 0x1b, 0xd0, 0xef, 0xca, 0xf8, 0x0f, 0xd5, 0xb9, 0xc6, 0xca, 0x44, 0xb6, 0x01, 0x00 }; unsigned int dist_spanish_index_s_htm_gz_len = 26439;
7a7c33ae9643e38cbe5dce1e3368853226a9f85f
52c8ed39b32ccc7c0673278c1adea3638797c9ff
/src/external/cairo-1.17.4/cairo-base85-stream.c
3202f1e5fb478089d4be4964f45d0c40665e54a8
[ "MIT" ]
permissive
xboot/xboot
0cab7b440b612aa0a4c366025598a53a7ec3adf1
6d6b93947b7fcb8c3924fedb0715c23877eedd5e
refs/heads/master
2023-08-20T05:56:25.149388
2023-07-12T07:38:29
2023-07-12T07:38:29
471,539
765
296
MIT
2023-05-25T09:39:01
2010-01-14T08:25:12
C
UTF-8
C
false
false
4,204
c
cairo-base85-stream.c
/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */ /* cairo - a vector graphics library with display and print output * * Copyright © 2005 Red Hat, Inc * * This library is free software; you can redistribute it and/or * modify it either under the terms of the GNU Lesser General Public * License version 2.1 as published by the Free Software Foundation * (the "LGPL") or, at your option, under the terms of the Mozilla * Public License Version 1.1 (the "MPL"). If you do not alter this * notice, a recipient may use your version of this file under either * the MPL or the LGPL. * * You should have received a copy of the LGPL along with this library * in the file COPYING-LGPL-2.1; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA * You should have received a copy of the MPL along with this library * in the file COPYING-MPL-1.1 * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY * OF ANY KIND, either express or implied. See the LGPL or the MPL for * the specific language governing rights and limitations. * * The Original Code is the cairo graphics library. * * The Initial Developer of the Original Code is Red Hat, Inc. * * Author(s): * Kristian Høgsberg <krh@redhat.com> */ #include "cairoint.h" #include "cairo-error-private.h" #include "cairo-output-stream-private.h" typedef struct _cairo_base85_stream { cairo_output_stream_t base; cairo_output_stream_t *output; unsigned char four_tuple[4]; int pending; } cairo_base85_stream_t; static void _expand_four_tuple_to_five (unsigned char four_tuple[4], unsigned char five_tuple[5], cairo_bool_t *all_zero) { uint32_t value; int digit, i; value = four_tuple[0] << 24 | four_tuple[1] << 16 | four_tuple[2] << 8 | four_tuple[3]; if (all_zero) *all_zero = TRUE; for (i = 0; i < 5; i++) { digit = value % 85; if (digit != 0 && all_zero) *all_zero = FALSE; five_tuple[4-i] = digit + 33; value = value / 85; } } static cairo_status_t _cairo_base85_stream_write (cairo_output_stream_t *base, const unsigned char *data, unsigned int length) { cairo_base85_stream_t *stream = (cairo_base85_stream_t *) base; const unsigned char *ptr = data; unsigned char five_tuple[5]; cairo_bool_t is_zero; while (length) { stream->four_tuple[stream->pending++] = *ptr++; length--; if (stream->pending == 4) { _expand_four_tuple_to_five (stream->four_tuple, five_tuple, &is_zero); if (is_zero) _cairo_output_stream_write (stream->output, "z", 1); else _cairo_output_stream_write (stream->output, five_tuple, 5); stream->pending = 0; } } return _cairo_output_stream_get_status (stream->output); } static cairo_status_t _cairo_base85_stream_close (cairo_output_stream_t *base) { cairo_base85_stream_t *stream = (cairo_base85_stream_t *) base; unsigned char five_tuple[5]; if (stream->pending) { memset (stream->four_tuple + stream->pending, 0, 4 - stream->pending); _expand_four_tuple_to_five (stream->four_tuple, five_tuple, NULL); _cairo_output_stream_write (stream->output, five_tuple, stream->pending + 1); } return _cairo_output_stream_get_status (stream->output); } cairo_output_stream_t * _cairo_base85_stream_create (cairo_output_stream_t *output) { cairo_base85_stream_t *stream; if (output->status) return _cairo_output_stream_create_in_error (output->status); stream = _cairo_malloc (sizeof (cairo_base85_stream_t)); if (unlikely (stream == NULL)) { _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); return (cairo_output_stream_t *) &_cairo_output_stream_nil; } _cairo_output_stream_init (&stream->base, _cairo_base85_stream_write, NULL, _cairo_base85_stream_close); stream->output = output; stream->pending = 0; return &stream->base; }
e4763a461c4757317bf6e1a997905dc2065149f9
41eb0837713f297134529591b66f3d4d82bcf98e
/src/Raine/source/video/blit_x2.h
c2cd8abbcf3bfc9f31df46762905080b39f9578e
[]
no_license
AlexxandreFS/Batocera.PLUS
27b196b3cbb781b6fc99e62cad855396d1d5f8f2
997ee763ae7135fdf0c34a081e789918bd2eb169
refs/heads/master
2023-08-17T21:52:39.083687
2023-08-17T15:03:44
2023-08-17T15:03:44
215,869,486
135
57
null
2023-08-14T14:46:14
2019-10-17T19:23:42
C
UTF-8
C
false
false
1,321
h
blit_x2.h
#ifdef __cplusplus extern "C" { #endif /******************************************************************************/ /* */ /* RAINE PIXEL DOUBLE BLITTING */ /* */ /******************************************************************************/ #include "raine.h" void raine_blit_x2_y1(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h); void raine_blit_x2_y2(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h); void raine_blit_x2_y1_16(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h); void raine_blit_x2_y2_16(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h); void raine_blit_x2_y1_24(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h); void raine_blit_x2_y2_24(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h); void raine_blit_x2_y1_32(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h); void raine_blit_x2_y2_32(BITMAP *src, BITMAP *dest, int s_x, int s_y, int d_x, int d_y, int w, int h); #ifdef __cplusplus } #endif
3cec3fec7135d556c83b20ef80558de65bfb7dc1
f79dec3c4033ca3cbb55d8a51a748cc7b8b6fbab
/editors/emacs24/patches/patch-src_inotify.c
5c00a19b52ecfaea28804f0a47980909b2ab97f8
[]
no_license
jsonn/pkgsrc
fb34c4a6a2d350e8e415f3c4955d4989fcd86881
c1514b5f4a3726d90e30aa16b0c209adbc276d17
refs/heads/trunk
2021-01-24T09:10:01.038867
2017-07-07T15:49:43
2017-07-07T15:49:43
2,095,004
106
47
null
2016-09-19T09:26:01
2011-07-23T23:49:04
Makefile
UTF-8
C
false
false
450
c
patch-src_inotify.c
$NetBSD: patch-src_inotify.c,v 1.1 2015/01/31 23:40:09 jperkin Exp $ SunOS inotify requires sys/filio.h for FIONREAD. --- src/inotify.c.orig 2014-03-21 05:34:40.000000000 +0000 +++ src/inotify.c @@ -59,6 +59,9 @@ static Lisp_Object Qunmount; /* IN #include <sys/inotify.h> #include <sys/ioctl.h> +#ifdef __sun +#include <sys/filio.h> +#endif /* Ignore bits that might be undefined on old GNU/Linux systems. */ #ifndef IN_EXCL_UNLINK
0d5bd243fd32ae8b85a8f9b31790c8d4181e11a0
e099fa4fc311757d7dd6cdc164cd7e2b476cef0f
/fuzzer-code/datatemp/cflow/rc.c
37cd74b79cadfa984c55c3b68dafa92c74b8d233
[ "Apache-2.0" ]
permissive
vusec/vuzzer64
08a04c8d972142855c6537d41e381c4cefc855c6
635ed48549b4a137a0d30a18b89310ce76d27cc6
refs/heads/master
2022-06-12T16:50:19.322193
2022-03-29T10:06:31
2022-03-29T10:06:31
126,505,785
173
53
NOASSERTION
2021-12-10T08:16:34
2018-03-23T15:39:46
C++
UTF-8
C
false
false
3,803
c
rc.c
/* This file is part of GNU cflow Copyright (C) 1997, 2005, 2007, 2010, 2014-2016 Sergey Poznyakoff GNU cflow is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. GNU cflow is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <cflow.h> #include <parser.h> #include <sys/stat.h> #include <ctype.h> #include <wordsplit.h> #ifndef LOCAL_RC # define LOCAL_RC ".cflowrc" #endif static void expand_argcv(int *argc_ptr, char ***argv_ptr, int argc, char **argv) { int i; *argv_ptr = xrealloc(*argv_ptr, (*argc_ptr + argc + 1) * sizeof **argv_ptr); for (i = 0; i < argc; i++) (*argv_ptr)[*argc_ptr + i] = xstrdup(argv[i]); (*argv_ptr)[*argc_ptr + i] = NULL; *argc_ptr += argc; } /* Parse rc file */ void parse_rc(int *argc_ptr, char ***argv_ptr, char *name) { struct stat st; FILE *rcfile; int size; char *buf, *p; struct wordsplit ws; int wsflags; int line; if (stat(name, &st)) return; buf = xmalloc(st.st_size+1); rcfile = fopen(name, "r"); if (!rcfile) { error(EX_FATAL, errno, _("cannot open `%s'"), name); return; } size = fread(buf, 1, st.st_size, rcfile); buf[size] = 0; fclose(rcfile); ws.ws_comment = "#"; wsflags = WRDSF_DEFFLAGS | WRDSF_COMMENT; line = 0; for (p = strtok(buf, "\n"); p; p = strtok(NULL, "\n")) { ++line; if (wordsplit(p, &ws, wsflags)) error(EX_FATAL, 0, "%s:%d: %s", name, line, wordsplit_strerror(&ws)); wsflags |= WRDSF_REUSE; if (ws.ws_wordc) expand_argcv(argc_ptr, argv_ptr, ws.ws_wordc, ws.ws_wordv); } if (wsflags & WRDSF_REUSE) wordsplit_free(&ws); free(buf); } /* Process the value of the environment variable CFLOW_OPTIONS * and of the rc file. * Split the value into words and add them between (*ARGV_PTR)[0] and * (*ARGV_PTR[1]) modifying *ARGC_PTR accordingly. * NOTE: Since sourcerc() is not meant to take all SH command line processing * burden, only word splitting is performed and no kind of expansion * takes place. */ void sourcerc(int *argc_ptr, char ***argv_ptr) { char *env; int xargc = 1; char **xargv; xargv = xmalloc(2*sizeof *xargv); xargv[0] = **argv_ptr; xargv[1] = NULL; env = getenv("CFLOW_OPTIONS"); if (env) { struct wordsplit ws; ws.ws_comment = "#"; if (wordsplit(env, &ws, WRDSF_DEFFLAGS | WRDSF_COMMENT)) error(EX_FATAL, 0, "failed to parse CFLOW_OPTIONS: %s", wordsplit_strerror(&ws)); if (ws.ws_wordc) expand_argcv(&xargc, &xargv, ws.ws_wordc, ws.ws_wordv); wordsplit_free(&ws); } env = getenv("CFLOWRC"); if (env) parse_rc(&xargc, &xargv, env); else { char *home = getenv("HOME"); if (home) { int len = strlen(home); char *buf = malloc(len + sizeof(LOCAL_RC) + (home[len-1] != '/') ); if (!buf) return; strcpy(buf, home); if (home[len-1] != '/') buf[len++] = '/'; strcpy(buf+len, LOCAL_RC); parse_rc(&xargc, &xargv, buf); free(buf); } } if (xargc > 1) { expand_argcv(&xargc, &xargv, *argc_ptr-1, *argv_ptr+1); *argc_ptr = xargc; *argv_ptr = xargv; } }
1ddc4d993a725ab8a6f9907987de5c061237baa7
ecce427678ecff2a93a47f3b1b664202c7d27617
/levels/bits/areas/1/18/model.inc.c
177efbf9290810a4cdfc56bc425d2f16ff2b7a4e
[]
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
40,954
c
model.inc.c
// 0x0700DD98 - 0x0700DE98 static const Vtx bits_seg7_vertex_0700DD98[] = { {{{ 1132, 1009, -922}, 0, { -5320, 1468}, {0x90, 0x92, 0xee, 0xff}}}, {{{ 1183, 1009, -973}, 0, { -5086, 1410}, {0x90, 0x92, 0xee, 0xff}}}, {{{ 1132, 1009, -1025}, 0, { -5320, 1468}, {0x90, 0x92, 0xee, 0xff}}}, {{{ 1080, 1009, -973}, 0, { -5552, 1528}, {0x90, 0x92, 0xee, 0xff}}}, {{{ 1183, 958, -922}, 0, { -4872, 1390}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 56, 907, -973}, 0, { -9796, 2656}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1183, 907, -973}, 0, { -4658, 1372}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1971, -19, -979}, 0, { 2816, 122}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1050, 31, -1030}, 0, { -1602, 1190}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1971, 31, -1030}, 0, { 2602, 142}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1050, -19, -979}, 0, { -1388, 1170}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1971, 31, -927}, 0, { 2602, 142}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1050, 31, -927}, 0, { -1602, 1190}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 159, 907, -666}, 0, { -2974, 1724}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 210, 958, -973}, 0, { 3892, -808}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 210, 958, -666}, 0, { -3300, 1806}, {0x3d, 0x3c, 0x76, 0xff}}}, }; // 0x0700DE98 - 0x0700DF98 static const Vtx bits_seg7_vertex_0700DE98[] = { {{{ 159, 907, -666}, 0, { -2974, 1724}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 159, 907, -973}, 0, { 4220, -890}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 210, 958, -973}, 0, { 3892, -808}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 108, 958, -666}, 0, { -3300, 1806}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 108, 958, -973}, 0, { 3892, -808}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1183, 907, -973}, 0, { -4658, 1372}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 56, 958, -1025}, 0, {-10010, 2676}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1183, 958, -1025}, 0, { -4872, 1390}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1183, 958, -922}, 0, { -4872, 1390}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 56, 958, -922}, 0, {-10010, 2676}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 56, 907, -973}, 0, { -9796, 2656}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1203, -173, -927}, 0, { -44, 940}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1050, -173, -927}, 0, { -744, 1112}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1050, -224, -979}, 0, { -530, 1092}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1203, -224, -979}, 0, { 168, 920}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1050, -173, -1030}, 0, { -744, 1112}, {0x3d, 0x3c, 0x76, 0xff}}}, }; // 0x0700DF98 - 0x0700E078 static const Vtx bits_seg7_vertex_0700DF98[] = { {{{ 1203, -224, -979}, 0, { 168, 920}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1050, -173, -1030}, 0, { -744, 1112}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1203, -173, -1030}, 0, { -44, 940}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1080, -255, -973}, 0, { -264, 1046}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1132, -255, -1025}, 0, { 0, 990}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1183, -255, -973}, 0, { 202, 932}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1132, -255, -922}, 0, { 0, 990}, {0x3d, 0x3c, 0x76, 0xff}}}, {{{ 1971, 31, -1030}, 0, { 2602, 142}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1050, 82, -979}, 0, { -1816, 1210}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1971, 82, -979}, 0, { 2388, 160}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1050, 31, -1030}, 0, { -1602, 1190}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1050, -19, -979}, 0, { -1388, 1170}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1050, 31, -927}, 0, { -1602, 1190}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1971, 31, -927}, 0, { 2602, 142}, {0x6b, 0x72, 0xb5, 0xff}}}, }; // 0x0700E078 - 0x0700E178 static const Vtx bits_seg7_vertex_0700E078[] = { {{{ 159, 1009, -666}, 0, { -3628, 1888}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 159, 1009, -973}, 0, { 3566, -726}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 108, 958, -973}, 0, { 3892, -808}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 108, 958, -666}, 0, { -3300, 1806}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1183, 958, -1025}, 0, { -4872, 1390}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 56, 958, -1025}, 0, {-10010, 2676}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 56, 1009, -973}, 0, {-10224, 2696}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1183, 1009, -973}, 0, { -5086, 1410}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 56, 958, -922}, 0, {-10010, 2676}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1183, 958, -922}, 0, { -4872, 1390}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1203, -122, -979}, 0, { -258, 958}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1050, -173, -927}, 0, { -744, 1112}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1203, -173, -927}, 0, { -44, 940}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1050, -122, -979}, 0, { -958, 1132}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1203, -173, -1030}, 0, { -44, 940}, {0x6b, 0x72, 0xb5, 0xff}}}, {{{ 1050, -173, -1030}, 0, { -744, 1112}, {0x6b, 0x72, 0xb5, 0xff}}}, }; // 0x0700E178 - 0x0700E268 static const Vtx bits_seg7_vertex_0700E178[] = { {{{ 159, 1009, -973}, 0, { -9758, 2578}, {0x73, 0xb0, 0xd3, 0xff}}}, {{{ 210, 958, -973}, 0, { -9310, 2500}, {0x73, 0xb0, 0xd3, 0xff}}}, {{{ 159, 907, -973}, 0, { -9330, 2540}, {0x73, 0xb0, 0xd3, 0xff}}}, {{{ 108, 958, -973}, 0, { -9776, 2618}, {0x73, 0xb0, 0xd3, 0xff}}}, {{{ 56, 1009, -973}, 0, {-10224, 2696}, {0x73, 0xb0, 0xd3, 0xff}}}, {{{ 56, 958, -1025}, 0, {-10010, 2676}, {0x73, 0xb0, 0xd3, 0xff}}}, {{{ 56, 907, -973}, 0, { -9796, 2656}, {0x73, 0xb0, 0xd3, 0xff}}}, {{{ 56, 958, -922}, 0, {-10010, 2676}, {0x73, 0xb0, 0xd3, 0xff}}}, {{{ 1183, 1009, -973}, 0, { -5086, 1410}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 1183, 958, -922}, 0, { -4872, 1390}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 1183, 907, -973}, 0, { -4658, 1372}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 1971, 31, -927}, 0, { 2602, 142}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 1971, 31, -1030}, 0, { 2602, 142}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 1971, 82, -979}, 0, { 2388, 160}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 1971, -19, -979}, 0, { 2816, 122}, {0x52, 0x52, 0xac, 0xff}}}, }; // 0x0700E268 - 0x0700E358 static const Vtx bits_seg7_vertex_0700E268[] = { {{{ 159, 1009, -666}, 0, { -3628, 1888}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 108, 958, -666}, 0, { -3300, 1806}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 159, 907, -666}, 0, { -2974, 1724}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 210, 958, -666}, 0, { -3300, 1806}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 1203, -173, -927}, 0, { -44, 940}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 1203, -173, -1030}, 0, { -44, 940}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 1203, -122, -979}, 0, { -258, 958}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 1203, -224, -979}, 0, { 168, 920}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 1183, 1009, -973}, 0, { -5086, 1410}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 1183, 907, -973}, 0, { -4658, 1372}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 1183, 958, -1025}, 0, { -4872, 1390}, {0x52, 0x52, 0xac, 0xff}}}, {{{ 1183, 1009, -973}, 0, { -5086, 1410}, {0x61, 0x52, 0xac, 0xff}}}, {{{ 1132, -255, -1025}, 0, { 0, 990}, {0x61, 0x52, 0xac, 0xff}}}, {{{ 1132, 1009, -1025}, 0, { -5320, 1468}, {0x61, 0x52, 0xac, 0xff}}}, {{{ 1183, -255, -973}, 0, { 202, 932}, {0x61, 0x52, 0xac, 0xff}}}, }; // 0x0700E358 - 0x0700E458 static const Vtx bits_seg7_vertex_0700E358[] = { {{{ 1132, 1009, -922}, 0, { -5320, 1468}, {0x41, 0x43, 0x8c, 0xff}}}, {{{ 1132, -255, -922}, 0, { 0, 990}, {0x41, 0x43, 0x8c, 0xff}}}, {{{ 1183, -255, -973}, 0, { 202, 932}, {0x41, 0x43, 0x8c, 0xff}}}, {{{ 1183, 1009, -973}, 0, { -5086, 1410}, {0x41, 0x43, 0x8c, 0xff}}}, {{{ 1132, 1009, -1025}, 0, { -5320, 1468}, {0x41, 0x43, 0x8c, 0xff}}}, {{{ 1132, -255, -1025}, 0, { 0, 990}, {0x41, 0x43, 0x8c, 0xff}}}, {{{ 1080, -255, -973}, 0, { -264, 1046}, {0x41, 0x43, 0x8c, 0xff}}}, {{{ 1080, 1009, -973}, 0, { -5552, 1528}, {0x41, 0x43, 0x8c, 0xff}}}, {{{ 1080, 1009, -973}, 0, { -5552, 1528}, {0x66, 0x5b, 0xa3, 0xff}}}, {{{ 1080, -255, -973}, 0, { -264, 1046}, {0x66, 0x5b, 0xa3, 0xff}}}, {{{ 1132, -255, -922}, 0, { 0, 990}, {0x66, 0x5b, 0xa3, 0xff}}}, {{{ 1132, 1009, -922}, 0, { -5320, 1468}, {0x66, 0x5b, 0xa3, 0xff}}}, {{{ 210, 958, -666}, 0, { -3300, 1806}, {0x66, 0x5b, 0xa3, 0xff}}}, {{{ 159, 1009, -973}, 0, { 3566, -726}, {0x66, 0x5b, 0xa3, 0xff}}}, {{{ 159, 1009, -666}, 0, { -3628, 1888}, {0x66, 0x5b, 0xa3, 0xff}}}, {{{ 210, 958, -973}, 0, { 3892, -808}, {0x66, 0x5b, 0xa3, 0xff}}}, }; // 0x0700E458 - 0x0700E548 static const Vtx bits_seg7_vertex_0700E458[] = { {{{ -434, -460, -1279}, 0, { -94, 4118}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -434, -460, -1228}, 0, { 0, 4054}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ 333, -50, -1279}, 0, { 862, 5076}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ 384, -153, -1893}, 0, { 160, 5906}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -434, -562, -1893}, 0, { -860, 4884}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -485, -562, -1279}, 0, { -158, 4054}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ 384, -153, -1279}, 0, { 926, 5140}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -1202, -869, -767}, 0, { -414, 2522}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -485, -562, -1228}, 0, { -94, 3990}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -1202, -562, -1535}, 0, { -1372, 3480}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -485, -869, -409}, 0, { 926, 2968}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -1253, -460, -1535}, 0, { -1436, 3416}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -1253, -767, -818}, 0, { -542, 2522}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -1202, -767, -818}, 0, { -478, 2584}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -1202, -460, -1535}, 0, { -1372, 3480}, {0xb9, 0xb9, 0xb9, 0xff}}}, }; // 0x0700E548 - 0x0700E628 static const Vtx bits_seg7_vertex_0700E548[] = { {{{ -434, -767, -409}, 0, { 990, 3032}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -434, -460, -1228}, 0, { 0, 4054}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -485, -460, -1228}, 0, { -94, 3990}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ 333, -50, -1228}, 0, { 926, 5012}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ 333, -50, -1279}, 0, { 862, 5076}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ 333, -50, -1893}, 0, { 96, 5842}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ 333, -50, -1945}, 0, { 32, 5906}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -434, -460, -1893}, 0, { -860, 4884}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -434, -460, -1945}, 0, { -924, 4948}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -485, -767, -409}, 0, { 926, 2968}, {0xb9, 0xb9, 0xb9, 0xff}}}, {{{ -1663, -767, 0}, 0, { 0, 990}, {0x8c, 0x8c, 0x8c, 0xff}}}, {{{ -1663, -767, -50}, 0, { -94, 1052}, {0x8c, 0x8c, 0x8c, 0xff}}}, {{{ -1663, -869, -50}, 0, { -94, 1052}, {0x8c, 0x8c, 0x8c, 0xff}}}, {{{ -1663, -869, 0}, 0, { 0, 990}, {0x8c, 0x8c, 0x8c, 0xff}}}, }; // 0x0700E628 - 0x0700E718 static const Vtx bits_seg7_vertex_0700E628[] = { {{{ -1663, -869, -818}, 0, { -1052, 2010}, {0x8c, 0x8c, 0x8c, 0xff}}}, {{{ -1663, -767, -767}, 0, { -988, 1946}, {0x8c, 0x8c, 0x8c, 0xff}}}, {{{ -1663, -767, -818}, 0, { -1052, 2010}, {0x8c, 0x8c, 0x8c, 0xff}}}, {{{ -1663, -869, -767}, 0, { -988, 1946}, {0x8c, 0x8c, 0x8c, 0xff}}}, {{{ -434, -562, -1228}, 0, { 0, 4054}, {0x96, 0x96, 0x96, 0xff}}}, {{{ -434, -460, -1228}, 0, { 0, 4054}, {0x96, 0x96, 0x96, 0xff}}}, {{{ -485, -460, -1228}, 0, { -94, 3990}, {0x96, 0x96, 0x96, 0xff}}}, {{{ -485, -562, -1228}, 0, { -94, 3990}, {0x96, 0x96, 0x96, 0xff}}}, {{{ -1202, -562, -1535}, 0, { -1372, 3480}, {0x96, 0x96, 0x96, 0xff}}}, {{{ -1202, -460, -1535}, 0, { -1372, 3480}, {0x96, 0x96, 0x96, 0xff}}}, {{{ -1253, -460, -1535}, 0, { -1436, 3416}, {0x96, 0x96, 0x96, 0xff}}}, {{{ -1253, -562, -1535}, 0, { -1436, 3416}, {0x96, 0x96, 0x96, 0xff}}}, {{{ 1050, -50, 197}, 0, { 3600, 4128}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 998, -50, 146}, 0, { 3472, 4128}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 384, -50, 146}, 0, { 2704, 3362}, {0xc8, 0xc8, 0xc8, 0xff}}}, }; // 0x0700E718 - 0x0700E808 static const Vtx bits_seg7_vertex_0700E718[] = { {{{ 998, -153, -1893}, 0, { 926, 6672}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 384, -153, -1893}, 0, { 160, 5906}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 998, -153, 146}, 0, { 3472, 4128}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 384, -153, 146}, 0, { 2704, 3362}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 998, -153, -211}, 0, { 3026, 4574}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 1050, -153, -825}, 0, { 2322, 5404}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 998, -153, -825}, 0, { 2260, 5340}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 1050, -153, -211}, 0, { 3090, 4638}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 1050, -50, -211}, 0, { 3090, 4638}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 998, -50, -211}, 0, { 3026, 4574}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 1050, -50, 197}, 0, { 3600, 4128}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 998, -50, 146}, 0, { 3472, 4128}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -875, -869, -50}, 0, { 888, 2036}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -485, -869, -409}, 0, { 926, 2968}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1202, -869, -767}, 0, { -414, 2522}, {0xc8, 0xc8, 0xc8, 0xff}}}, }; // 0x0700E808 - 0x0700E908 static const Vtx bits_seg7_vertex_0700E808[] = { {{{ 1050, -50, 197}, 0, { 3600, 4128}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 384, -50, 146}, 0, { 2704, 3362}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 333, -50, 197}, 0, { 2704, 3234}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 384, -50, -1279}, 0, { 926, 5140}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 333, -50, -1279}, 0, { 862, 5076}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -485, -562, -1228}, 0, { -94, 3990}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -434, -562, -1893}, 0, { -860, 4884}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1202, -562, -1535}, 0, { -1372, 3480}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -793, -562, -1893}, 0, { -1308, 4438}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1663, -869, -50}, 0, { -94, 1052}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -875, -869, -50}, 0, { 888, 2036}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1202, -869, -767}, 0, { -414, 2522}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1663, -767, -818}, 0, { -1052, 2010}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1663, -767, -767}, 0, { -988, 1946}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1253, -767, -818}, 0, { -542, 2522}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1663, -869, -767}, 0, { -988, 1946}, {0xc8, 0xc8, 0xc8, 0xff}}}, }; // 0x0700E908 - 0x0700EA08 static const Vtx bits_seg7_vertex_0700E908[] = { {{{ -1202, -767, -818}, 0, { -478, 2584}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1253, -767, -818}, 0, { -542, 2520}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1202, -767, -767}, 0, { -414, 2520}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1253, -767, -767}, 0, { -478, 2458}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -434, -460, -1279}, 0, { -94, 4118}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -485, -460, -1279}, 0, { -158, 4054}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -485, -460, -1228}, 0, { -94, 3990}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -434, -460, -1228}, 0, { 0, 4054}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1663, -767, -767}, 0, { -988, 1946}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1253, -767, -818}, 0, { -542, 2522}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 998, -50, -1893}, 0, { 926, 6672}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 998, -50, -825}, 0, { 2260, 5340}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 1050, -50, -825}, 0, { 2322, 5404}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 333, -50, -1945}, 0, { 32, 5906}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 333, -50, -1893}, 0, { 96, 5842}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 1050, -50, -1945}, 0, { 926, 6800}, {0xc8, 0xc8, 0xc8, 0xff}}}, }; // 0x0700EA08 - 0x0700EB08 static const Vtx bits_seg7_vertex_0700EA08[] = { {{{ -844, -460, -1944}, 0, { -1434, 4436}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -793, -460, -1893}, 0, { -1308, 4438}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -434, -460, -1893}, 0, { -860, 4884}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -434, -460, -1945}, 0, { -924, 4948}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1253, -460, -1535}, 0, { -1436, 3416}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1202, -460, -1535}, 0, { -1372, 3480}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -844, -460, -1945}, 0, { -1436, 4438}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -844, -767, 0}, 0, { 990, 2010}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -434, -767, -409}, 0, { 990, 3032}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -485, -767, -409}, 0, { 926, 2968}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -875, -767, -50}, 0, { 888, 2036}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1663, -767, -50}, 0, { -94, 1052}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ -1663, -767, 0}, 0, { 0, 990}, {0xc8, 0xc8, 0xc8, 0xff}}}, {{{ 998, -153, -825}, 0, { 24, 3104}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 998, -50, -1893}, 0, { -1180, 4566}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 998, -153, -1893}, 0, { -1308, 4438}, {0x7d, 0x7d, 0x7d, 0xff}}}, }; // 0x0700EB08 - 0x0700EBF8 static const Vtx bits_seg7_vertex_0700EB08[] = { {{{ 384, -153, -1279}, 0, { -2394, 160}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 384, -50, 146}, 0, { -742, 2064}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 384, -153, 146}, 0, { -614, 1936}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 384, -50, -1279}, 0, { -2522, 288}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 384, -50, 146}, 0, { 3418, 2648}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 998, -153, 146}, 0, { 4056, 3544}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 384, -153, 146}, 0, { 3290, 2776}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 998, -50, 146}, 0, { 4184, 3416}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 998, -153, 146}, 0, { 1236, 1892}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 998, -50, 146}, 0, { 1364, 2020}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 998, -50, -211}, 0, { 918, 2466}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 998, -153, -211}, 0, { 790, 2338}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -1202, -869, -818}, 0, { -924, -160}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -1202, -562, -1535}, 0, { -2202, -670}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -1202, -460, -1535}, 0, { -2330, -544}, {0x7d, 0x7d, 0x7d, 0xff}}}, }; // 0x0700EBF8 - 0x0700ECD8 static const Vtx bits_seg7_vertex_0700EBF8[] = { {{{ 998, -153, -825}, 0, { 24, 3104}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 998, -50, -825}, 0, { 152, 3232}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 998, -50, -1893}, 0, { -1180, 4566}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -485, -562, -1228}, 0, { -1818, -288}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -485, -460, -1279}, 0, { -2010, -224}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -485, -562, -1279}, 0, { -1882, -352}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -485, -460, -1228}, 0, { -1946, -160}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -1202, -869, -818}, 0, { -478, 2584}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -1202, -767, -818}, 0, { -478, 2584}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -1202, -869, -767}, 0, { -414, 2520}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -1202, -767, -767}, 0, { -414, 2520}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -1202, -767, -818}, 0, { -1052, 0}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -1202, -869, -818}, 0, { -924, -160}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -1202, -460, -1535}, 0, { -2330, -544}, {0x7d, 0x7d, 0x7d, 0xff}}}, }; // 0x0700ECD8 - 0x0700EDC8 static const Vtx bits_seg7_vertex_0700ECD8[] = { {{{ 333, -255, -1228}, 0, { -604, 3480}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 333, -50, 197}, 0, { 1428, 1956}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 333, -50, -1228}, 0, { -350, 3734}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -485, -767, -409}, 0, { -222, 1818}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -485, -460, -1228}, 0, { -860, 3224}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -485, -562, -1228}, 0, { -988, 3096}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -485, -869, -409}, 0, { -350, 1690}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -434, -1023, -409}, 0, { -542, 1500}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -434, -716, -1228}, 0, { -1180, 2904}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -434, -767, -409}, 0, { -222, 1818}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -434, -460, -1228}, 0, { -860, 3224}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -1253, -767, -818}, 0, { -732, 2330}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -1253, -460, -1535}, 0, { -1244, 3606}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -1253, -716, -1535}, 0, { -1562, 3288}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ -1232, -1023, -818}, 0, { -1052, 2010}, {0x7d, 0x7d, 0x7d, 0xff}}}, }; // 0x0700EDC8 - 0x0700EEC8 static const Vtx bits_seg7_vertex_0700EDC8[] = { {{{ 1050, -255, -211}, 0, { -932, 1362}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 1050, -50, 197}, 0, { -678, 2128}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 1050, -255, 197}, 0, { -424, 1872}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 333, -255, -1228}, 0, { -604, 3480}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 333, -255, 197}, 0, { 1172, 1700}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 333, -50, 197}, 0, { 1428, 1956}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 1050, -255, -1945}, 0, { -3096, -798}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 1050, -50, -1945}, 0, { -3352, -542}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 1050, -50, -825}, 0, { -1954, 854}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 1050, -255, -825}, 0, { -1700, 598}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 1050, -153, -825}, 0, { -1826, 726}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 1050, -153, -211}, 0, { -1060, 1490}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 1050, -50, -211}, 0, { -1188, 1618}, {0x7d, 0x7d, 0x7d, 0xff}}}, {{{ 333, -255, -1945}, 0, { 32, 5906}, {0x44, 0x44, 0x44, 0xff}}}, {{{ 1050, -255, -1945}, 0, { 926, 6800}, {0x44, 0x44, 0x44, 0xff}}}, {{{ 1050, -255, 197}, 0, { 3600, 4128}, {0x44, 0x44, 0x44, 0xff}}}, }; // 0x0700EEC8 - 0x0700EFC8 static const Vtx bits_seg7_vertex_0700EEC8[] = { {{{ -1253, -716, -1535}, 0, { -1436, 3416}, {0x44, 0x44, 0x44, 0xff}}}, {{{ -434, -665, -1945}, 0, { -924, 4948}, {0x44, 0x44, 0x44, 0xff}}}, {{{ -434, -716, -1228}, 0, { 0, 4054}, {0x44, 0x44, 0x44, 0xff}}}, {{{ -844, -665, -1945}, 0, { -1436, 4438}, {0x44, 0x44, 0x44, 0xff}}}, {{{ -844, -1023, 0}, 0, { 990, 2010}, {0x44, 0x44, 0x44, 0xff}}}, {{{ -1663, -1023, 0}, 0, { 0, 990}, {0x44, 0x44, 0x44, 0xff}}}, {{{ -434, -1023, -409}, 0, { 990, 3032}, {0x44, 0x44, 0x44, 0xff}}}, {{{ -1663, -1023, -818}, 0, { -1052, 2010}, {0x44, 0x44, 0x44, 0xff}}}, {{{ -1232, -1023, -818}, 0, { -514, 2548}, {0x44, 0x44, 0x44, 0xff}}}, {{{ 333, -255, -1945}, 0, { 32, 5906}, {0x44, 0x44, 0x44, 0xff}}}, {{{ 1050, -255, 197}, 0, { 3600, 4128}, {0x44, 0x44, 0x44, 0xff}}}, {{{ 333, -255, 197}, 0, { 2704, 3234}, {0x44, 0x44, 0x44, 0xff}}}, {{{ -1253, -716, -1535}, 0, { -1436, 3416}, {0x50, 0x50, 0x50, 0xff}}}, {{{ -434, -716, -1228}, 0, { 0, 4054}, {0x50, 0x50, 0x50, 0xff}}}, {{{ -434, -1023, -409}, 0, { 990, 3032}, {0x50, 0x50, 0x50, 0xff}}}, {{{ -1232, -1023, -818}, 0, { -514, 2548}, {0x50, 0x50, 0x50, 0xff}}}, }; // 0x0700EFC8 - 0x0700F0B8 static const Vtx bits_seg7_vertex_0700EFC8[] = { {{{ -434, -665, -1945}, 0, { -924, 4948}, {0x50, 0x50, 0x50, 0xff}}}, {{{ 333, -255, -1945}, 0, { 32, 5906}, {0x50, 0x50, 0x50, 0xff}}}, {{{ -434, -716, -1228}, 0, { 0, 4054}, {0x50, 0x50, 0x50, 0xff}}}, {{{ 333, -255, -1228}, 0, { 926, 5012}, {0x50, 0x50, 0x50, 0xff}}}, {{{ -1253, -460, -1535}, 0, { 160, 2202}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -844, -460, -1945}, 0, { -350, 2712}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -844, -665, -1945}, 0, { -604, 2458}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -1202, -460, -1534}, 0, { -1348, 3058}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -793, -562, -1893}, 0, { -2154, 3610}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -793, -460, -1893}, 0, { -2028, 3738}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -1202, -562, -1535}, 0, { -1476, 2932}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -875, -767, -50}, 0, { -808, 1774}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -485, -767, -409}, 0, { -1468, 2434}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -485, -869, -409}, 0, { -1596, 2306}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -875, -869, -50}, 0, { -936, 1646}, {0x73, 0x73, 0x73, 0xff}}}, }; // 0x0700F0B8 - 0x0700F198 static const Vtx bits_seg7_vertex_0700F0B8[] = { {{{ -434, -1023, -409}, 0, { -1564, 2520}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -434, -767, -409}, 0, { -1244, 2840}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -844, -1023, 0}, 0, { -1052, 2010}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -844, -767, 0}, 0, { -732, 2330}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -1253, -460, -1535}, 0, { 160, 2202}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -844, -665, -1945}, 0, { -604, 2458}, {0x73, 0x73, 0x73, 0xff}}}, {{{ -1253, -716, -1535}, 0, { -158, 1882}, {0x73, 0x73, 0x73, 0xff}}}, {{{ 333, -50, -1279}, 0, { 3354, 2584}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 333, -204, -1279}, 0, { 3162, 2776}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -434, -562, -1279}, 0, { 1756, 2266}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 1050, -153, -211}, 0, { -2330, 5460}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 998, -153, -211}, 0, { -2266, 5396}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 998, -50, -211}, 0, { -2138, 5524}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 1050, -50, -211}, 0, { -2202, 5588}, {0x64, 0x64, 0x64, 0xff}}}, }; // 0x0700F198 - 0x0700F298 static const Vtx bits_seg7_vertex_0700F198[] = { {{{ 1050, -50, -825}, 0, { -2202, 5588}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 998, -50, -825}, 0, { -2138, 5524}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 998, -153, -825}, 0, { -2266, 5396}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 1050, -153, -825}, 0, { -2330, 5460}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 333, -50, -1279}, 0, { 3354, 2584}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 384, -50, -1279}, 0, { 3418, 2648}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 384, -204, -1279}, 0, { 3226, 2840}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 333, -204, -1279}, 0, { 3162, 2776}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -434, -562, -1279}, 0, { 1756, 2266}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -485, -562, -1279}, 0, { 1692, 2202}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -485, -460, -1279}, 0, { 1820, 2074}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 333, -50, -1893}, 0, { -1308, 4692}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 384, -153, -1893}, 0, { -1500, 4628}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 998, -153, -1893}, 0, { -2266, 5396}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 998, -50, -1893}, 0, { -2138, 5524}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -434, -460, -1893}, 0, { -860, 3224}, {0x64, 0x64, 0x64, 0xff}}}, }; // 0x0700F298 - 0x0700F398 static const Vtx bits_seg7_vertex_0700F298[] = { {{{ -434, -460, -1893}, 0, { -860, 3224}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -434, -562, -1893}, 0, { -988, 3096}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 384, -153, -1893}, 0, { -1500, 4628}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -793, -562, -1893}, 0, { -540, 2648}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -793, -460, -1893}, 0, { -414, 2776}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 333, -50, -1279}, 0, { 3354, 2584}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -434, -562, -1279}, 0, { 1756, 2266}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -434, -460, -1279}, 0, { 1884, 2138}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -485, -460, -1279}, 0, { 1820, 2074}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -875, -767, -50}, 0, { -694, 2292}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -875, -869, -50}, 0, { -822, 2164}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1663, -869, -50}, 0, { 160, 1180}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1663, -767, -50}, 0, { 288, 1308}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1202, -869, -767}, 0, { -414, 1754}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1202, -767, -767}, 0, { -286, 1882}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1663, -767, -767}, 0, { 288, 1308}, {0x64, 0x64, 0x64, 0xff}}}, }; // 0x0700F398 - 0x0700F478 static const Vtx bits_seg7_vertex_0700F398[] = { {{{ -1663, -869, -767}, 0, { 160, 1180}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1202, -869, -767}, 0, { -414, 1754}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1663, -767, -767}, 0, { 288, 1308}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -844, -665, -1945}, 0, { -604, 2458}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -434, -460, -1945}, 0, { -860, 3224}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -434, -665, -1945}, 0, { -1116, 2968}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -844, -460, -1945}, 0, { -350, 2712}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 333, -50, -1945}, 0, { -1308, 4692}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 333, -255, -1945}, 0, { -1562, 4438}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1232, -1023, -818}, 0, { -568, 1526}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1663, -1023, -818}, 0, { 0, 990}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1253, -767, -818}, 0, { -222, 1818}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 1050, -50, -1945}, 0, { -2202, 5586}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 1050, -255, -1945}, 0, { -2458, 5332}, {0x64, 0x64, 0x64, 0xff}}}, }; // 0x0700F478 - 0x0700F568 static const Vtx bits_seg7_vertex_0700F478[] = { {{{ -434, -716, -1228}, 0, { -1180, 2904}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 333, -255, -1228}, 0, { -1562, 4438}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 333, -50, -1228}, 0, { -1308, 4692}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -434, -460, -1228}, 0, { -860, 3224}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 333, -255, 197}, 0, { -1562, 4438}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 1050, -50, 197}, 0, { -2202, 5588}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 333, -50, 197}, 0, { -1308, 4692}, {0x64, 0x64, 0x64, 0xff}}}, {{{ 1050, -255, 197}, 0, { -2458, 5332}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -844, -767, 0}, 0, { -732, 2330}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1663, -767, 0}, 0, { 288, 1308}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -844, -1023, 0}, 0, { -1052, 2010}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1663, -1023, -818}, 0, { 0, 990}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1663, -767, -818}, 0, { 288, 1308}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1253, -767, -818}, 0, { -222, 1818}, {0x64, 0x64, 0x64, 0xff}}}, {{{ -1663, -1023, 0}, 0, { 0, 990}, {0x64, 0x64, 0x64, 0xff}}}, }; // 0x0700F568 - 0x0700F790 static const Gfx bits_seg7_dl_0700F568[] = { gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, sky_09007000), gsDPLoadSync(), gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)), gsSPVertex(bits_seg7_vertex_0700DD98, 16, 0), gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0), gsSP2Triangles( 4, 5, 6, 0x0, 7, 8, 9, 0x0), gsSP2Triangles( 7, 10, 8, 0x0, 11, 10, 7, 0x0), gsSP2Triangles(11, 12, 10, 0x0, 13, 14, 15, 0x0), gsSPVertex(bits_seg7_vertex_0700DE98, 16, 0), gsSP2Triangles( 0, 1, 2, 0x0, 3, 1, 0, 0x0), gsSP2Triangles( 3, 4, 1, 0x0, 5, 6, 7, 0x0), gsSP2Triangles( 8, 9, 10, 0x0, 5, 10, 6, 0x0), gsSP2Triangles(11, 12, 13, 0x0, 11, 13, 14, 0x0), gsSP1Triangle(14, 13, 15, 0x0), gsSPVertex(bits_seg7_vertex_0700DF98, 14, 0), gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0), gsSP2Triangles( 3, 5, 6, 0x0, 7, 8, 9, 0x0), gsSP2Triangles( 7, 10, 8, 0x0, 8, 10, 11, 0x0), gsSP2Triangles( 8, 11, 12, 0x0, 9, 8, 12, 0x0), gsSP1Triangle( 9, 12, 13, 0x0), gsSPVertex(bits_seg7_vertex_0700E078, 16, 0), gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0), gsSP2Triangles( 4, 5, 6, 0x0, 4, 6, 7, 0x0), gsSP2Triangles( 7, 6, 8, 0x0, 7, 8, 9, 0x0), gsSP2Triangles(10, 11, 12, 0x0, 10, 13, 11, 0x0), gsSP2Triangles(14, 13, 10, 0x0, 14, 15, 13, 0x0), gsSPVertex(bits_seg7_vertex_0700E178, 15, 0), gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0), gsSP2Triangles( 4, 5, 6, 0x0, 4, 6, 7, 0x0), gsSP2Triangles( 8, 9, 10, 0x0, 11, 12, 13, 0x0), gsSP1Triangle(11, 14, 12, 0x0), gsSPVertex(bits_seg7_vertex_0700E268, 15, 0), gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0), gsSP2Triangles( 4, 5, 6, 0x0, 4, 7, 5, 0x0), gsSP2Triangles( 8, 9, 10, 0x0, 11, 12, 13, 0x0), gsSP1Triangle(11, 14, 12, 0x0), gsSPVertex(bits_seg7_vertex_0700E358, 16, 0), gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0), gsSP2Triangles( 4, 5, 6, 0x0, 4, 6, 7, 0x0), gsSP2Triangles( 8, 9, 10, 0x0, 8, 10, 11, 0x0), gsSP2Triangles(12, 13, 14, 0x0, 12, 15, 13, 0x0), gsSPEndDisplayList(), }; // 0x0700F790 - 0x0700FC70 static const Gfx bits_seg7_dl_0700F790[] = { gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, sky_09001800), gsDPLoadSync(), gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)), gsSPVertex(bits_seg7_vertex_0700E458, 15, 0), gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0), gsSP2Triangles( 3, 5, 6, 0x0, 7, 8, 9, 0x0), gsSP2Triangles( 7, 10, 8, 0x0, 11, 12, 13, 0x0), gsSP1Triangle(14, 11, 13, 0x0), gsSPVertex(bits_seg7_vertex_0700E548, 14, 0), gsSP2Triangles( 0, 1, 2, 0x0, 1, 3, 4, 0x0), gsSP2Triangles( 5, 6, 7, 0x0, 6, 8, 7, 0x0), gsSP2Triangles( 9, 0, 2, 0x0, 10, 11, 12, 0x0), gsSP1Triangle(10, 12, 13, 0x0), gsSPVertex(bits_seg7_vertex_0700E628, 15, 0), gsSP2Triangles( 0, 1, 2, 0x0, 0, 3, 1, 0x0), gsSP2Triangles( 4, 5, 6, 0x0, 7, 4, 6, 0x0), gsSP2Triangles( 8, 9, 10, 0x0, 11, 8, 10, 0x0), gsSP1Triangle(12, 13, 14, 0x0), gsSPVertex(bits_seg7_vertex_0700E718, 15, 0), gsSP2Triangles( 0, 1, 2, 0x0, 1, 3, 2, 0x0), gsSP2Triangles( 4, 5, 6, 0x0, 4, 7, 5, 0x0), gsSP2Triangles( 8, 9, 10, 0x0, 9, 11, 10, 0x0), gsSP1Triangle(12, 13, 14, 0x0), gsSPVertex(bits_seg7_vertex_0700E808, 16, 0), gsSP2Triangles( 0, 1, 2, 0x0, 3, 2, 1, 0x0), gsSP2Triangles( 3, 4, 2, 0x0, 5, 6, 7, 0x0), gsSP2Triangles( 6, 8, 7, 0x0, 9, 10, 11, 0x0), gsSP2Triangles(12, 13, 14, 0x0, 15, 9, 11, 0x0), gsSPVertex(bits_seg7_vertex_0700E908, 16, 0), gsSP2Triangles( 0, 1, 2, 0x0, 1, 3, 2, 0x0), gsSP2Triangles( 4, 5, 6, 0x0, 4, 6, 7, 0x0), gsSP2Triangles( 8, 3, 9, 0x0, 10, 11, 12, 0x0), gsSP2Triangles(13, 14, 10, 0x0, 13, 10, 15, 0x0), gsSP1Triangle(15, 10, 12, 0x0), gsSPVertex(bits_seg7_vertex_0700EA08, 16, 0), gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0), gsSP2Triangles( 4, 5, 1, 0x0, 4, 1, 6, 0x0), gsSP2Triangles( 7, 8, 9, 0x0, 10, 11, 7, 0x0), gsSP2Triangles( 9, 10, 7, 0x0, 11, 12, 7, 0x0), gsSP1Triangle(13, 14, 15, 0x0), gsSPVertex(bits_seg7_vertex_0700EB08, 15, 0), gsSP2Triangles( 0, 1, 2, 0x0, 0, 3, 1, 0x0), gsSP2Triangles( 4, 5, 6, 0x0, 4, 7, 5, 0x0), gsSP2Triangles( 8, 9, 10, 0x0, 8, 10, 11, 0x0), gsSP1Triangle(12, 13, 14, 0x0), gsSPVertex(bits_seg7_vertex_0700EBF8, 14, 0), gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0), gsSP2Triangles( 3, 6, 4, 0x0, 7, 8, 9, 0x0), gsSP2Triangles( 8, 10, 9, 0x0, 11, 12, 13, 0x0), gsSPVertex(bits_seg7_vertex_0700ECD8, 15, 0), gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0), gsSP2Triangles( 6, 3, 5, 0x0, 7, 8, 9, 0x0), gsSP2Triangles( 8, 10, 9, 0x0, 11, 12, 13, 0x0), gsSP1Triangle(11, 13, 14, 0x0), gsSPVertex(bits_seg7_vertex_0700EDC8, 16, 0), gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0), gsSP2Triangles( 6, 7, 8, 0x0, 6, 8, 9, 0x0), gsSP2Triangles( 9, 10, 11, 0x0, 9, 11, 0, 0x0), gsSP2Triangles( 0, 12, 1, 0x0, 13, 14, 15, 0x0), gsSPVertex(bits_seg7_vertex_0700EEC8, 16, 0), gsSP2Triangles( 0, 1, 2, 0x0, 0, 3, 1, 0x0), gsSP2Triangles( 4, 5, 6, 0x0, 5, 7, 6, 0x0), gsSP2Triangles( 7, 8, 6, 0x0, 9, 10, 11, 0x0), gsSP2Triangles(12, 13, 14, 0x0, 15, 12, 14, 0x0), gsSPVertex(bits_seg7_vertex_0700EFC8, 15, 0), gsSP2Triangles( 0, 1, 2, 0x0, 1, 3, 2, 0x0), gsSP2Triangles( 4, 5, 6, 0x0, 7, 8, 9, 0x0), gsSP2Triangles( 7, 10, 8, 0x0, 11, 12, 13, 0x0), gsSP1Triangle(14, 11, 13, 0x0), gsSPVertex(bits_seg7_vertex_0700F0B8, 14, 0), gsSP2Triangles( 0, 1, 2, 0x0, 1, 3, 2, 0x0), gsSP2Triangles( 4, 5, 6, 0x0, 7, 8, 9, 0x0), gsSP2Triangles(10, 11, 12, 0x0, 10, 12, 13, 0x0), gsSPVertex(bits_seg7_vertex_0700F198, 16, 0), gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0), gsSP2Triangles( 4, 5, 6, 0x0, 4, 6, 7, 0x0), gsSP2Triangles( 8, 9, 10, 0x0, 11, 12, 13, 0x0), gsSP2Triangles(11, 13, 14, 0x0, 15, 12, 11, 0x0), gsSPVertex(bits_seg7_vertex_0700F298, 16, 0), gsSP2Triangles( 0, 1, 2, 0x0, 3, 0, 4, 0x0), gsSP2Triangles( 3, 1, 0, 0x0, 5, 6, 7, 0x0), gsSP2Triangles( 6, 8, 7, 0x0, 9, 10, 11, 0x0), gsSP2Triangles(12, 9, 11, 0x0, 13, 14, 15, 0x0), gsSPVertex(bits_seg7_vertex_0700F398, 14, 0), gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0), gsSP2Triangles( 3, 6, 4, 0x0, 4, 7, 8, 0x0), gsSP2Triangles( 4, 8, 5, 0x0, 9, 10, 11, 0x0), gsSP2Triangles( 7, 12, 13, 0x0, 7, 13, 8, 0x0), gsSPVertex(bits_seg7_vertex_0700F478, 15, 0), gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0), gsSP2Triangles( 4, 5, 6, 0x0, 4, 7, 5, 0x0), gsSP2Triangles( 8, 9, 10, 0x0, 11, 12, 13, 0x0), gsSP1Triangle( 9, 14, 10, 0x0), gsSPEndDisplayList(), }; // 0x0700FC70 - 0x0700FCE8 const Gfx bits_seg7_dl_0700FC70[] = { gsDPPipeSync(), gsDPSetCombineMode(G_CC_MODULATERGB, G_CC_MODULATERGB), gsSPClearGeometryMode(G_LIGHTING), gsDPSetTile(G_IM_FMT_RGBA, 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_RGBA, G_IM_SIZ_16b, 8, 0, G_TX_RENDERTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, 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(bits_seg7_dl_0700F568), gsSPDisplayList(bits_seg7_dl_0700F790), gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF), gsDPPipeSync(), gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE), gsSPSetGeometryMode(G_LIGHTING), gsSPEndDisplayList(), };
73d90b214b5904966f9f2cfa1c4b69cbd109b2bf
b70023ec7ab57952e8667264303b3bac59eef20e
/ravicomp/src/lexer.c
8e5d5b8e4597f80013ea65557d5012370203de19
[ "MIT" ]
permissive
dibyendumajumdar/ravi
9ab0bd3d047d904440f5d5a639c2eb89b2ad2309
d0f5d4b2dc596bf25e3153d5accc1b45e714bb99
refs/heads/master
2023-08-04T11:55:08.547858
2023-08-01T19:19:24
2023-08-01T19:19:24
28,688,657
1,167
79
NOASSERTION
2023-07-27T14:43:30
2015-01-01T15:03:24
C
UTF-8
C
false
false
29,550
c
lexer.c
/****************************************************************************** * Copyright (C) 2020-2023 Dibyendu Majumdar * * 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. ******************************************************************************/ /** * The lexer is basically a hacked version of Lua 5.3 lexer. * Copyright (C) 1994-2019 Lua.org, PUC-Rio. */ #include "fnv_hash.h" #include "parser.h" #include <limits.h> #include <locale.h> #include <math.h> enum { EOZ = -1 }; /* end of stream */ #define cast(t, v) ((t)v) #define cast_int(v) cast(int, v) #define cast_uchar(c) cast(unsigned char, c) #define cast_num(n) cast(lua_Number, n) #define l_castU2S(i) ((lua_Integer)(i)) static inline int zgetc(LexerState *z) { return z->n-- > 0 ? cast_uchar(*z->p++) : EOZ; } static inline void next(LexerState *ls) { ls->current = zgetc(ls); } static inline bool currIsNewline(LexerState *ls) { return ls->current == '\n' || ls->current == '\r'; } static inline char lua_getlocaledecpoint(void) { return localeconv()->decimal_point[0]; } #define ARRAY_SIZE(array) ((int)(sizeof(array) / sizeof(array[0]))) /*Note: Following array was generated using utils/tokenstr.h */ static const char *const luaX_tokens[] = { "and", "break", "do", "else", "elseif", "end", "false", "for", "function", "goto", "if", "in", "local", "defer", "C__decl", "C__unsafe", "C__new", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while", "/" "/", "..", "...", "==", ">=", "<=", "~=", "<<", ">>", "::", "@integer", "@number", "@integer[]", "@number[]", "@table", "@string", "@closure", "<eof>", "<number>", "<integer>", "<name>", "<string>", }; /* Says whether the given string represents a Lua/Ravi keyword i.e. reserved word */ static inline int is_reserved(const StringObject *s) { return s->reserved; } enum { ALPHABIT = 0, DIGITBIT = 1, PRINTBIT = 2, SPACEBIT = 3, XDIGITBIT = 4 }; #define MASK(B) (1 << (B)) static const lu_byte luai_ctype_[UCHAR_MAX + 2] = { 0x00, /* EOZ */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0. */ 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* 2. */ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, /* 3. */ 0x16, 0x16, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 4. */ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 5. */ 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 6. */ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 7. */ 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 9. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* f. */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; /* ** add 1 to char to allow index -1 (EOZ) */ #define testprop(c, p) (luai_ctype_[(c) + 1] & (p)) /* ** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_' */ static inline bool lislalpha(int c) { return testprop(c, MASK(ALPHABIT)); } static inline bool lislalnum(int c) { return testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))); } static inline bool lisdigit(int c) { return testprop(c, MASK(DIGITBIT)); } static inline bool lisspace(int c) { return testprop(c, MASK(SPACEBIT)); } // static inline bool lisprint(int c) { return testprop(c, MASK(PRINTBIT)); } static inline bool lisxdigit(int c) { return testprop(c, MASK(XDIGITBIT)); } /* ** this 'ltolower' only works for alphabetic characters */ static inline int ltolower(int c) { return ((c) | ('A' ^ 'a')); } /* Creates a new string object. string objects are interned in a hash set. If the string matches a keyword then the reserved attribute will be set to the token id associated with the keyword else this attribute will be -1. The hash value of the string is stored the 'hash' attribute. Note that we need to allow strings that have embedded 0 character hence the length is explicit. But all tokens and reserved keywords are expected to be standard C strings. */ const StringObject *raviX_create_string(CompilerState *compiler_state, const char *input, uint32_t len) { StringObject temp = {.len = len, .reserved = -1, .hash = fnv1_hash_data(input, len), .str = input, }; SetEntry *entry = raviX_set_search_pre_hashed(compiler_state->strings, temp.hash, &temp); if (entry != NULL) /* found the string */ return (StringObject *)entry->key; else { C_MemoryAllocator *allocator = compiler_state->allocator; StringObject *new_string = (StringObject *) allocator->calloc(allocator->arena, 1, sizeof(StringObject)); char *s = (char* )allocator->calloc(allocator->arena, len + 1, sizeof(char)); /* allow for 0 terminator */ memcpy(s, input, len); s[len] = 0; /* 0 terminate string, however string may contain embedded 0 characters */ new_string->str = s; new_string->len = len; new_string->hash = temp.hash; new_string->reserved = -1; /* Check if this is a keyword, linear search is okay as we do this only when we first * encounter a keyword */ for (int i = 0; i < ARRAY_SIZE(luaX_tokens); i++) { if (lislalpha(luaX_tokens[i][0]) || luaX_tokens[i][0] == '@') { if (strcmp(luaX_tokens[i], s) == 0) { new_string->reserved = i; /* save index of the keyword */ break; } } } raviX_set_add_pre_hashed(compiler_state->strings, temp.hash, new_string); return new_string; } } #define lua_str2number(s, p) ((lua_Number)strtod((s), (p))) static void save(LexerState *ls, int c); void raviX_token2str(int token, TextBuffer *mb) { if (token < FIRST_RESERVED) { /* single-byte symbols? */ assert(token == cast_uchar(token)); raviX_buffer_add_fstring(mb, "'%c'", token); } else { const char *s = luaX_tokens[token - FIRST_RESERVED]; if (token < TOK_EOS) /* fixed format - reserved keywords */ raviX_buffer_add_fstring(mb, "'%s'", s); else /* names, strings, and numerals - note that @<usertype> is covered here */ raviX_buffer_add_string(mb, s); } } static void txtToken(LexerState *ls, int token) { switch (token) { case TOK_NAME: case TOK_STRING: case TOK_FLT: case TOK_INT: save(ls, '\0'); raviX_buffer_add_fstring(&ls->compiler_state->error_message, "'%s'", raviX_buffer_data(ls->buff)); break; default: raviX_token2str(token, &ls->compiler_state->error_message); } } static void lexerror(LexerState *ls, const char *msg, int token) { raviX_buffer_add_fstring(&ls->compiler_state->error_message, "%s(%d): %s", ls->source, ls->linenumber, msg); if (token) { raviX_buffer_add_string(&ls->compiler_state->error_message, " near "); txtToken(ls, token); } longjmp(ls->compiler_state->env, 1); } void raviX_syntaxerror(LexerState *ls, const char *msg) { lexerror(ls, msg, ls->t.token); } static void save(LexerState *ls, int c) { TextBuffer *b = ls->buff; if (raviX_buffer_len(b) + 1 > raviX_buffer_size(b)) { size_t newsize; if (raviX_buffer_size(b) >= INT_MAX / 2) lexerror(ls, "lexical element too long", 0); size_t oldsize = raviX_buffer_size(b); if (oldsize == 0) newsize = 32; else newsize = oldsize * 2; raviX_buffer_resize(b, newsize); } raviX_buffer_addc(b, c); } static inline void save_and_next(LexerState *ls) { save(ls, ls->current); next(ls); } /* ** creates a new interned string. */ static const StringObject *luaX_newstring(LexerState *ls, const char *str, uint32_t l) { return raviX_create_string(ls->compiler_state, str, l); } /* ** increment line number and skips newline sequence (any of ** \n, \r, \n\r, or \r\n) */ static void inclinenumber(LexerState *ls) { int old = ls->current; assert(currIsNewline(ls)); next(ls); /* skip '\n' or '\r' */ if (currIsNewline(ls) && ls->current != old) next(ls); /* skip '\n\r' or '\r\n' */ if (++ls->linenumber >= INT_MAX) lexerror(ls, "chunk has too many lines", 0); } LexerState *raviX_init_lexer(CompilerState *compiler_state, const char *buf, size_t buflen, const char *source) { LexerState *ls = (LexerState *)raviX_calloc(1, sizeof(LexerState)); ls->compiler_state = compiler_state; ls->t.token = 0; ls->buf = buf; ls->bufsize = buflen; ls->n = ls->bufsize; ls->p = ls->buf; ls->current = zgetc(ls); ls->lookahead.token = TOK_EOS; /* no look-ahead token */ ls->linenumber = 1; ls->lastline = 1; ls->source = source; ls->envn = raviX_create_string(ls->compiler_state, LUA_ENV, (uint32_t)strlen(LUA_ENV))->str; /* get env name */ ls->buff = &compiler_state->buff; for (int i = 0; i < NUM_RESERVED; i++) { raviX_create_string(ls->compiler_state, luaX_tokens[i], (uint32_t)strlen(luaX_tokens[i])); } return ls; } void raviX_destroy_lexer(LexerState *ls) { if (ls == NULL) return; raviX_free(ls); } const LexerInfo *raviX_get_lexer_info(LexerState *ls) { return (LexerInfo *)ls; } /* ** ======================================================= ** LEXICAL ANALYZER ** ======================================================= */ static int check_next1(LexerState *ls, int c) { if (ls->current == c) { next(ls); return 1; } else return 0; } static int check_save_next1(LexerState *ls, int c) { if (ls->current == c) { save_and_next(ls); return 1; } else return 0; } /* ** Check whether current char is in set 'set' (with two chars) and ** saves it */ static int check_next2(LexerState *ls, const char *set) { assert(set[2] == '\0'); if (ls->current == set[0] || ls->current == set[1]) { save_and_next(ls); return 1; } else return 0; } static int luaO_hexavalue(int c) { if (lisdigit(c)) return c - '0'; else return (ltolower(c) - 'a') + 10; } static int isneg(const char **s) { if (**s == '-') { (*s)++; return 1; } else if (**s == '+') (*s)++; return 0; } /* ** {================================================================== ** Lua's implementation for 'lua_strx2number' ** =================================================================== */ #if !defined(lua_strx2number) /* maximum number of significant digits to read (to avoid overflows even with single floats) */ #define MAXSIGDIG 30 /* ** convert an hexadecimal numeric string to a number, following ** C99 specification for 'strtod' */ static lua_Number lua_strx2number(const char *s, char **endptr) { int dot = lua_getlocaledecpoint(); lua_Number r = 0.0; /* result (accumulator) */ int sigdig = 0; /* number of significant digits */ int nosigdig = 0; /* number of non-significant digits */ int e = 0; /* exponent correction */ int neg; /* 1 if number is negative */ int hasdot = 0; /* true after seen a dot */ *endptr = (char *)s; /* nothing is valid yet */ while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ neg = isneg(&s); /* check signal */ if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */ return 0.0; /* invalid format (no '0x') */ for (s += 2;; s++) { /* skip '0x' and read numeral */ if (*s == dot) { if (hasdot) break; /* second dot? stop loop */ else hasdot = 1; } else if (lisxdigit(cast_uchar(*s))) { if (sigdig == 0 && *s == '0') /* non-significant digit (zero)? */ nosigdig++; else if (++sigdig <= MAXSIGDIG) /* can read it without overflow? */ r = (r * cast_num(16.0)) + luaO_hexavalue(*s); else e++; /* too many digits; ignore, but still count for exponent */ if (hasdot) e--; /* decimal digit? correct exponent */ } else break; /* neither a dot nor a digit */ } if (nosigdig + sigdig == 0) /* no digits? */ return 0.0; /* invalid format */ *endptr = (char *)s; /* valid up to here */ e *= 4; /* each digit multiplies/divides value by 2^4 */ if (*s == 'p' || *s == 'P') { /* exponent part? */ int exp1 = 0; /* exponent value */ int neg1; /* exponent signal */ s++; /* skip 'p' */ neg1 = isneg(&s); /* signal */ if (!lisdigit(cast_uchar(*s))) return 0.0; /* invalid; must have at least one digit */ while (lisdigit(cast_uchar(*s))) /* read exponent */ exp1 = exp1 * 10 + *(s++) - '0'; if (neg1) exp1 = -exp1; e += exp1; *endptr = (char *)s; /* valid up to here */ } if (neg) r = -r; return (lua_Number)ldexp(r, e); } #endif /* }====================================================== */ /* maximum length of a numeral */ #if !defined(L_MAXLENNUM) #define L_MAXLENNUM 200 #endif static const char *l_str2dloc(const char *s, lua_Number *result, int mode) { char *endptr; *result = (mode == 'x') ? lua_strx2number(s, &endptr) /* try to convert */ : lua_str2number(s, &endptr); if (endptr == s) return NULL; /* nothing recognized? */ while (lisspace(cast_uchar(*endptr))) endptr++; /* skip trailing spaces */ return (*endptr == '\0') ? endptr : NULL; /* OK if no trailing characters */ } /* ** Convert string 's' to a Lua number (put in 'result'). Return NULL ** on fail or the address of the ending '\0' on success. ** 'pmode' points to (and 'mode' contains) special things in the string: ** - 'x'/'X' means an hexadecimal numeral ** - 'n'/'N' means 'inf' or 'nan' (which should be rejected) ** - '.' just optimizes the search for the common case (nothing special) ** This function accepts both the current locale or a dot as the radix ** mark. If the convertion fails, it may mean number has a dot but ** locale accepts something else. In that case, the code copies 's' ** to a buffer (because 's' is read-only), changes the dot to the ** current locale radix mark, and tries to convert again. */ static const char *l_str2d(const char *s, lua_Number *result) { const char *endptr; const char *pmode = strpbrk(s, ".xXnN"); int mode = pmode ? ltolower(cast_uchar(*pmode)) : 0; if (mode == 'n') /* reject 'inf' and 'nan' */ return NULL; endptr = l_str2dloc(s, result, mode); /* try to convert */ if (endptr == NULL) { /* failed? may be a different locale */ char buff[L_MAXLENNUM + 1]; const char *pdot = strchr(s, '.'); if (strlen(s) > L_MAXLENNUM || pdot == NULL) return NULL; /* string too long or no dot; fail */ strcpy(buff, s); /* copy string to buffer */ buff[pdot - s] = lua_getlocaledecpoint(); /* correct decimal point */ endptr = l_str2dloc(buff, result, mode); /* try again */ if (endptr != NULL) endptr = s + (endptr - buff); /* make relative to 's' */ } return endptr; } #define MAXBY10 cast(lua_Unsigned, LUA_MAXINTEGER / 10) #define MAXLASTD cast_int(LUA_MAXINTEGER % 10) static const char *l_str2int(const char *s, lua_Integer *result) { lua_Unsigned a = 0; int empty = 1; int neg; while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ neg = isneg(&s); if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) { /* hex? */ s += 2; /* skip '0x' */ for (; lisxdigit(cast_uchar(*s)); s++) { a = a * 16 + luaO_hexavalue(*s); empty = 0; } } else { /* decimal */ for (; lisdigit(cast_uchar(*s)); s++) { int d = *s - '0'; if (a >= MAXBY10 && (a > MAXBY10 || d > MAXLASTD + neg)) /* overflow? */ return NULL; /* do not accept it (as integer) */ a = a * 10 + d; empty = 0; } } while (lisspace(cast_uchar(*s))) s++; /* skip trailing spaces */ if (empty || *s != '\0') return NULL; /* something wrong in the numeral */ else { *result = l_castU2S((neg) ? 0u - a : a); return s; } } struct konst { uint8_t type; union { lua_Integer i; lua_Number n; }; }; static size_t luaO_str2num(const char *s, struct konst *o) { lua_Integer i; lua_Number n; const char *e; if ((e = l_str2int(s, &i)) != NULL) { /* try as an integer */ o->i = i; o->type = 1; } else if ((e = l_str2d(s, &n)) != NULL) { /* else try as a float */ o->n = n; o->type = 2; } else return 0; /* conversion failed */ return (e - s) + 1; /* success; return string size */ } /* LUA_NUMBER */ /* ** this function is quite liberal in what it accepts, as 'luaO_str2num' ** will reject ill-formed numerals. */ static int read_numeral(LexerState *ls, SemInfo *seminfo) { struct konst obj; const char *expo = "Ee"; int first = ls->current; assert(lisdigit(ls->current)); save_and_next(ls); if (first == '0' && check_next2(ls, "xX")) /* hexadecimal? */ expo = "Pp"; for (;;) { if (check_next2(ls, expo)) /* exponent part? */ check_next2(ls, "-+"); /* optional exponent sign */ if (lisxdigit(ls->current)) save_and_next(ls); else if (ls->current == '.') save_and_next(ls); else break; } save(ls, '\0'); if (luaO_str2num(raviX_buffer_data(ls->buff), &obj) == 0) /* format error? */ lexerror(ls, "malformed number", TOK_FLT); if (obj.type == 1) { seminfo->i = obj.i; return TOK_INT; } else { assert(obj.type == 2); seminfo->r = obj.n; return TOK_FLT; } } /* ** skip a sequence '[=*[' or ']=*]'; if sequence is well formed, return ** its number of '='s; otherwise, return a negative number (-1 iff there ** are no '='s after initial bracket) */ static int skip_sep(LexerState *ls) { int count = 0; int s = ls->current; assert(s == '[' || s == ']'); save_and_next(ls); while (ls->current == '=') { save_and_next(ls); count++; } return (ls->current == s) ? count : (-count) - 1; } static void read_long_string(LexerState *ls, SemInfo *seminfo, int sep) { int line = ls->linenumber; /* initial line (for error message) */ (void)line; save_and_next(ls); /* skip 2nd '[' */ if (currIsNewline(ls)) /* string starts with a newline? */ inclinenumber(ls); /* skip it */ for (;;) { switch (ls->current) { case EOZ: { /* error */ const char *what = (seminfo ? "string" : "comment"); const char *msg = ""; (void)what; // luaO_pushfstring(ls->L, "unfinished long %s (starting at line %d)", // what, line); lexerror(ls, msg, TOK_EOS); break; /* to avoid warnings */ } case ']': { if (skip_sep(ls) == sep) { save_and_next(ls); /* skip 2nd ']' */ goto endloop; } break; } case '\n': case '\r': { save(ls, '\n'); inclinenumber(ls); if (!seminfo) raviX_buffer_reset(ls->buff); /* avoid wasting space */ break; } default: { if (seminfo) save_and_next(ls); else next(ls); } } } endloop: if (seminfo) seminfo->ts = luaX_newstring(ls, raviX_buffer_data(ls->buff) + (2 + sep), (uint32_t)(raviX_buffer_len(ls->buff) - 2 * (2 + sep))); } static void esccheck(LexerState *ls, int c, const char *msg) { if (!c) { if (ls->current != EOZ) save_and_next(ls); /* add current to buffer for error message */ lexerror(ls, msg, TOK_STRING); } } static int gethexa(LexerState *ls) { save_and_next(ls); esccheck(ls, lisxdigit(ls->current), "hexadecimal digit expected"); return luaO_hexavalue(ls->current); } static int readhexaesc(LexerState *ls) { int r = gethexa(ls); r = (r << 4) + gethexa(ls); raviX_buffer_remove(ls->buff, 2); /* remove saved chars from buffer */ return r; } // static unsigned long readutf8esc (LexerState *ls) { // unsigned long r; // int i = 4; /* chars to be removed: '\', 'u', '{', and first digit */ // save_and_next(ls); /* skip 'u' */ // esccheck(ls, ls->current == '{', "missing '{'"); // r = gethexa(ls); /* must have at least one digit */ // while ((save_and_next(ls), lisxdigit(ls->current))) { // i++; // r = (r << 4) + luaO_hexavalue(ls->current); // esccheck(ls, r <= 0x10FFFF, "UTF-8 value too large"); // } // esccheck(ls, ls->current == '}', "missing '}'"); // next(ls); /* skip '}' */ // raviX_buffer_remove(ls->buff, i); /* remove saved chars from buffer */ // return r; //} // // // static void utf8esc (LexerState *ls) { // char buff[UTF8BUFFSZ]; // int n = luaO_utf8esc(buff, readutf8esc(ls)); // for (; n > 0; n--) /* add 'buff' to string */ // save(ls, buff[UTF8BUFFSZ - n]); //} static int readdecesc(LexerState *ls) { int i; int r = 0; /* result accumulator */ for (i = 0; i < 3 && lisdigit(ls->current); i++) { /* read up to 3 digits */ r = 10 * r + ls->current - '0'; save_and_next(ls); } esccheck(ls, r <= UCHAR_MAX, "decimal escape too large"); raviX_buffer_remove(ls->buff, i); /* remove read digits from buffer */ return r; } static void read_string(LexerState *ls, int del, SemInfo *seminfo) { save_and_next(ls); /* keep delimiter (for error messages) */ while (ls->current != del) { switch (ls->current) { case EOZ: lexerror(ls, "unfinished string", TOK_EOS); break; /* to avoid warnings */ case '\n': case '\r': lexerror(ls, "unfinished string", TOK_STRING); break; /* to avoid warnings */ case '\\': { /* escape sequences */ int c; /* final character to be saved */ save_and_next(ls); /* keep '\\' for error messages */ switch (ls->current) { case 'a': c = '\a'; goto read_save; case 'b': c = '\b'; goto read_save; case 'f': c = '\f'; goto read_save; case 'n': c = '\n'; goto read_save; case 'r': c = '\r'; goto read_save; case 't': c = '\t'; goto read_save; case 'v': c = '\v'; goto read_save; case 'x': c = readhexaesc(ls); goto read_save; // TODO - FIXME // case 'u': utf8esc(ls); goto no_save; case '\n': case '\r': inclinenumber(ls); c = '\n'; goto only_save; case '\\': case '\"': case '\'': c = ls->current; goto read_save; case EOZ: goto no_save; /* will raise an error next loop */ case 'z': { /* zap following span of spaces */ raviX_buffer_remove(ls->buff, 1); /* remove '\\' */ next(ls); /* skip the 'z' */ while (lisspace(ls->current)) { if (currIsNewline(ls)) inclinenumber(ls); else next(ls); } goto no_save; } default: { esccheck(ls, lisdigit(ls->current), "invalid escape sequence"); c = readdecesc(ls); /* digital escape '\ddd' */ goto only_save; } } read_save: next(ls); /* go through */ only_save: raviX_buffer_remove(ls->buff, 1); /* remove '\\' */ save(ls, c); /* go through */ no_save: break; } default: save_and_next(ls); } } save_and_next(ls); /* skip delimiter */ seminfo->ts = luaX_newstring(ls, raviX_buffer_data(ls->buff) + 1, (uint32_t)(raviX_buffer_len(ls->buff) - 2)); } /* ** RAVI extension: generate a token for the cast operators - ** @number, @number[], @integer, @integer[], @table, @string, @closure */ static int casttoken(LexerState *ls, SemInfo *seminfo) { size_t n = raviX_buffer_len(ls->buff); const char *s = raviX_buffer_data(ls->buff); int tok; /* @integer or @integer[] */ if (strncmp(s, "@integer", n) == 0) tok = TOK_TO_INTEGER; else if (strncmp(s, "@integer[]", n) == 0) tok = TOK_TO_INTARRAY; /* @number or @number[] */ else if (strncmp(s, "@number", n) == 0) tok = TOK_TO_NUMBER; else if (strncmp(s, "@number[]", n) == 0) tok = TOK_TO_NUMARRAY; /* @table */ else if (strncmp(s, "@table", n) == 0) tok = TOK_TO_TABLE; else if (strncmp(s, "@string", n) == 0) tok = TOK_TO_STRING; else if (strncmp(s, "@closure", n) == 0) tok = TOK_TO_CLOSURE; else { seminfo->ts = luaX_newstring(ls, s + 1, (uint32_t)(n - 1)); /* omit @ */ tok = '@'; } raviX_buffer_remove(ls->buff, (int)n); /* rewind but buffer still holds the saved characters */ return tok; } static int llex(LexerState *ls, SemInfo *seminfo) { raviX_buffer_reset(ls->buff); for (;;) { switch (ls->current) { case '\n': case '\r': { /* line breaks */ inclinenumber(ls); break; } case ' ': case '\f': case '\t': case '\v': { /* spaces */ next(ls); break; } case '-': { /* '-' or '--' (comment) */ next(ls); if (ls->current != '-') return '-'; /* else is a comment */ next(ls); if (ls->current == '[') { /* long comment? */ int sep = skip_sep(ls); raviX_buffer_reset(ls->buff); /* 'skip_sep' may dirty the buffer */ if (sep >= 0) { read_long_string(ls, NULL, sep); /* skip long comment */ raviX_buffer_reset(ls->buff); /* previous call may dirty the buff. */ break; } } /* else short comment */ while (!currIsNewline(ls) && ls->current != EOZ) next(ls); /* skip until end of line (or end of file) */ break; } case '[': { /* long string or simply '[' */ int sep = skip_sep(ls); if (sep >= 0) { read_long_string(ls, seminfo, sep); return TOK_STRING; } else if (sep != -1) /* '[=...' missing second bracket */ lexerror(ls, "invalid long string delimiter", TOK_STRING); return '['; } case '=': { next(ls); if (check_next1(ls, '=')) return TOK_EQ; else return '='; } case '<': { next(ls); if (check_next1(ls, '=')) return TOK_LE; else if (check_next1(ls, '<')) return TOK_SHL; else return '<'; } case '>': { next(ls); if (check_next1(ls, '=')) return TOK_GE; else if (check_next1(ls, '>')) return TOK_SHR; else return '>'; } case '/': { next(ls); if (check_next1(ls, '/')) return TOK_IDIV; else return '/'; } case '~': { next(ls); if (check_next1(ls, '=')) return TOK_NE; else return '~'; } case ':': { next(ls); if (check_next1(ls, ':')) return TOK_DBCOLON; else return ':'; } case '"': case '\'': { /* short literal strings */ read_string(ls, ls->current, seminfo); return TOK_STRING; } case '.': { /* '.', '..', '...', or number */ save_and_next(ls); if (check_next1(ls, '.')) { if (check_next1(ls, '.')) return TOK_DOTS; /* '...' */ else return TOK_CONCAT; /* '..' */ } else if (!lisdigit(ls->current)) return '.'; else return read_numeral(ls, seminfo); } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { return read_numeral(ls, seminfo); } case EOZ: { return TOK_EOS; } case '@': { /* RAVI change: @ introduces a type assertion operator */ save_and_next(ls); while (lislalnum(ls->current)) { save_and_next(ls); } check_save_next1(ls, '['); check_save_next1(ls, ']'); return casttoken(ls, seminfo); } default: { if (lislalpha(ls->current)) { /* identifier or reserved word? */ const StringObject *ts; do { save_and_next(ls); } while (lislalnum(ls->current)); ts = raviX_create_string(ls->compiler_state, raviX_buffer_data(ls->buff), (int32_t)raviX_buffer_len(ls->buff)); seminfo->ts = ts; int tok = is_reserved(ts); if (tok != -1) /* reserved word? */ return tok + FIRST_RESERVED; else { return TOK_NAME; } } else { /* single-char tokens (+ - / ...) */ int c = ls->current; next(ls); return c; } } } } } void raviX_next(LexerState *ls) { ls->lastline = ls->linenumber; if (ls->lookahead.token != TOK_EOS) { /* is there a look-ahead token? */ ls->t = ls->lookahead; /* use this one */ ls->lookahead.token = TOK_EOS; /* and discharge it */ } else ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */ } int raviX_lookahead(LexerState *ls) { assert(ls->lookahead.token == TOK_EOS); ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); return ls->lookahead.token; } const char *raviX_get_last_error(CompilerState *compiler_state) { return compiler_state->error_message.buf; }
96144f6d5411b5d575d563e49976ea7f1b0429df
f3eed0234b4d0ad2bbb2abd700cf1e2c7a0e8a1d
/AKWF-c/AKWF_oscchip/AKWF_oscchip_0110.h
d17e30c096509042e3d98b974f0cdcec75596320
[ "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
4,688
h
AKWF_oscchip_0110.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_oscchip_0110 256 samples +-----------------------------------------------------------------------------------------------------------------+ | * * * | | * **** **** | | **** * * ***** * | | * * * ******** **** ******** * | |*** * * * * * ******** * | | ************************** * * **** * | | * * * | | * * * | | **** * * | | * * * | | **** * * | | * * * | | ***** * **************| | * ******** | | * **** | +-----------------------------------------------------------------------------------------------------------------+ */ const uint16_t AKWF_oscchip_0110 [] = { 39089, 42385, 41242, 41970, 41446, 41845, 41537, 42014, 47143, 48382, 48042, 48173, 48187, 48015, 48449, 46645, 39389, 39252, 39254, 39216, 39288, 39176, 39319, 39089, 38577, 38325, 38521, 38329, 38517, 38329, 38508, 38334, 38498, 38339, 38483, 38347, 38468, 38356, 38453, 38365, 38438, 38374, 38421, 38387, 38402, 38401, 38375, 38476, 39119, 39243, 39146, 39250, 39124, 39270, 39098, 39290, 39069, 39313, 39040, 39335, 39010, 39358, 38981, 39379, 38955, 39400, 38926, 39425, 38882, 39502, 38644, 41089, 58278, 60646, 59861, 60403, 59955, 60331, 60009, 60093, 54659, 53457, 53812, 53516, 53830, 53423, 53993, 52493, 47562, 46964, 47374, 46924, 47413, 46869, 47462, 46603, 44511, 43544, 44215, 43598, 44157, 43646, 44099, 43254, 30203, 25900, 27551, 26370, 27349, 26451, 27398, 25481, 18436, 17868, 18078, 17966, 18018, 18009, 18014, 17758, 13583, 13102, 13182, 13150, 13222, 13070, 13350, 13483, 40058, 47983, 45368, 46985, 45814, 46693, 46121, 45758, 39730, 40116, 39620, 40046, 39690, 39981, 39737, 40018, 41259, 41534, 41427, 41479, 41452, 41458, 41459, 41465, 42106, 42313, 42212, 42306, 42194, 42329, 42142, 42539, 43716, 43947, 43771, 43945, 43763, 43942, 43750, 44071, 45941, 46358, 46212, 46271, 46271, 46200, 46333, 46164, 48311, 48618, 48780, 48485, 48846, 48439, 48805, 49069, 55131, 54760, 55480, 54685, 55506, 54620, 55735, 51891, 8164, 0, 2163, 0, 1735, 200, 1573, 364, 3332, 3041, 3672, 3083, 3601, 3183, 3490, 3508, 5781, 5778, 5835, 5837, 5792, 5899, 5759, 5950, 5738, 5995, 5724, 6033, 5707, 6094, 5606, 6796, 9885, 9989, 9930, 10010, 9941, 10023, 9944, 10115, 10751, 10847, 10803, 10864, 10808, 10889, 10802, 10923, 10786, 10967, 10762, 11020, 10729, 11081, 10685, 11155, 10628, 11245, 10548, 11374, 10394, 11662, 9782, 15043, };
6e78be394e7dce80fdff48cf7fa316882fbacfd0
b91a6cc4c7ee18d33d92d171c4473a5df66b6d9b
/exercises/practice/hello-world/hello_world.c
237889799435ca2ce5a6542fa91278597eb5baee
[ "MIT" ]
permissive
exercism/c
b26171da41cf032fcee9ddf3736c6ed571bf3ad5
c76ccd0a34b8ebfcf448fb95d7b90e9f040461de
refs/heads/main
2023-07-25T18:04:49.202518
2023-07-22T19:39:08
2023-07-22T19:39:08
24,443,186
305
242
MIT
2023-09-05T11:33:28
2014-09-25T04:07:05
C
UTF-8
C
false
false
445
c
hello_world.c
// Include the standard definitions header from the standard library, so that we // have access to 'NULL'. This can be removed if your changes remove the need // for 'NULL'. #include <stddef.h> #include "hello_world.h" // Define the function itself. const char *hello(void) { // To fix this function, change the return statement here to instead return // a string equivalent to the string expected by the failing test. return NULL; }
e96a4fd980d9362000dacc4c9ace39b406555028
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
/SOFTWARE/A64-TERES/linux-a64/drivers/gpu/drm/drm_edid_load.c
fa445dd4dc006e5c1ec2f079b206cdd72cecf7e6
[ "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
8,951
c
drm_edid_load.c
/* drm_edid_load.c: use a built-in EDID data set or load it via the firmware interface Copyright (C) 2012 Carsten Emde <C.Emde@osadl.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <linux/module.h> #include <linux/firmware.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_edid.h> static char edid_firmware[PATH_MAX]; module_param_string(edid_firmware, edid_firmware, sizeof(edid_firmware), 0644); MODULE_PARM_DESC(edid_firmware, "Do not probe monitor, use specified EDID blob " "from built-in data or /lib/firmware instead. "); #define GENERIC_EDIDS 5 static char *generic_edid_name[GENERIC_EDIDS] = { "edid/1024x768.bin", "edid/1280x1024.bin", "edid/1600x1200.bin", "edid/1680x1050.bin", "edid/1920x1080.bin", }; static u8 generic_edid[GENERIC_EDIDS][128] = { { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x31, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x16, 0x01, 0x03, 0x6d, 0x23, 0x1a, 0x78, 0xea, 0x5e, 0xc0, 0xa4, 0x59, 0x4a, 0x98, 0x25, 0x20, 0x50, 0x54, 0x00, 0x08, 0x00, 0x61, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x64, 0x19, 0x00, 0x40, 0x41, 0x00, 0x26, 0x30, 0x08, 0x90, 0x36, 0x00, 0x63, 0x0a, 0x11, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xff, 0x00, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x20, 0x23, 0x30, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x3b, 0x3d, 0x2f, 0x31, 0x07, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x20, 0x58, 0x47, 0x41, 0x0a, 0x20, 0x20, 0x20, 0x00, 0x55, }, { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x31, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x16, 0x01, 0x03, 0x6d, 0x2c, 0x23, 0x78, 0xea, 0x5e, 0xc0, 0xa4, 0x59, 0x4a, 0x98, 0x25, 0x20, 0x50, 0x54, 0x00, 0x00, 0x00, 0x81, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x30, 0x2a, 0x00, 0x98, 0x51, 0x00, 0x2a, 0x40, 0x30, 0x70, 0x13, 0x00, 0xbc, 0x63, 0x11, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xff, 0x00, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x20, 0x23, 0x30, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x3b, 0x3d, 0x3e, 0x40, 0x0b, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x20, 0x53, 0x58, 0x47, 0x41, 0x0a, 0x20, 0x20, 0x00, 0xa0, }, { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x31, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x16, 0x01, 0x03, 0x6d, 0x37, 0x29, 0x78, 0xea, 0x5e, 0xc0, 0xa4, 0x59, 0x4a, 0x98, 0x25, 0x20, 0x50, 0x54, 0x00, 0x00, 0x00, 0xa9, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x48, 0x3f, 0x40, 0x30, 0x62, 0xb0, 0x32, 0x40, 0x40, 0xc0, 0x13, 0x00, 0x2b, 0xa0, 0x21, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xff, 0x00, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x20, 0x23, 0x30, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x3b, 0x3d, 0x4a, 0x4c, 0x11, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x20, 0x55, 0x58, 0x47, 0x41, 0x0a, 0x20, 0x20, 0x00, 0x9d, }, { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x31, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x16, 0x01, 0x03, 0x6d, 0x2b, 0x1b, 0x78, 0xea, 0x5e, 0xc0, 0xa4, 0x59, 0x4a, 0x98, 0x25, 0x20, 0x50, 0x54, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x21, 0x39, 0x90, 0x30, 0x62, 0x1a, 0x27, 0x40, 0x68, 0xb0, 0x36, 0x00, 0xb5, 0x11, 0x11, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xff, 0x00, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x20, 0x23, 0x30, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x3b, 0x3d, 0x40, 0x42, 0x0f, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x20, 0x57, 0x53, 0x58, 0x47, 0x41, 0x0a, 0x20, 0x00, 0x26, }, { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x31, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x16, 0x01, 0x03, 0x6d, 0x32, 0x1c, 0x78, 0xea, 0x5e, 0xc0, 0xa4, 0x59, 0x4a, 0x98, 0x25, 0x20, 0x50, 0x54, 0x00, 0x00, 0x00, 0xd1, 0xc0, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3a, 0x80, 0x18, 0x71, 0x38, 0x2d, 0x40, 0x58, 0x2c, 0x45, 0x00, 0xf4, 0x19, 0x11, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xff, 0x00, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x20, 0x23, 0x30, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x3b, 0x3d, 0x42, 0x44, 0x0f, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x20, 0x46, 0x48, 0x44, 0x0a, 0x20, 0x20, 0x20, 0x00, 0x05, }, }; static u8 *edid_load(struct drm_connector *connector, char *name, char *connector_name) { const struct firmware *fw; struct platform_device *pdev; u8 *fwdata = NULL, *edid, *new_edid; int fwsize, expected; int builtin = 0, err = 0; int i, valid_extensions = 0; bool print_bad_edid = !connector->bad_edid_counter || (drm_debug & DRM_UT_KMS); pdev = platform_device_register_simple(connector_name, -1, NULL, 0); if (IS_ERR(pdev)) { DRM_ERROR("Failed to register EDID firmware platform device " "for connector \"%s\"\n", connector_name); err = -EINVAL; goto out; } err = request_firmware(&fw, name, &pdev->dev); platform_device_unregister(pdev); if (err) { i = 0; while (i < GENERIC_EDIDS && strcmp(name, generic_edid_name[i])) i++; if (i < GENERIC_EDIDS) { err = 0; builtin = 1; fwdata = generic_edid[i]; fwsize = sizeof(generic_edid[i]); } } if (err) { DRM_ERROR("Requesting EDID firmware \"%s\" failed (err=%d)\n", name, err); goto out; } if (fwdata == NULL) { fwdata = (u8 *) fw->data; fwsize = fw->size; } expected = (fwdata[0x7e] + 1) * EDID_LENGTH; if (expected != fwsize) { DRM_ERROR("Size of EDID firmware \"%s\" is invalid " "(expected %d, got %d)\n", name, expected, (int) fwsize); err = -EINVAL; goto relfw_out; } edid = kmalloc(fwsize, GFP_KERNEL); if (edid == NULL) { err = -ENOMEM; goto relfw_out; } memcpy(edid, fwdata, fwsize); if (!drm_edid_block_valid(edid, 0, print_bad_edid)) { connector->bad_edid_counter++; DRM_ERROR("Base block of EDID firmware \"%s\" is invalid ", name); kfree(edid); err = -EINVAL; goto relfw_out; } for (i = 1; i <= edid[0x7e]; i++) { if (i != valid_extensions + 1) memcpy(edid + (valid_extensions + 1) * EDID_LENGTH, edid + i * EDID_LENGTH, EDID_LENGTH); if (drm_edid_block_valid(edid + i * EDID_LENGTH, i, print_bad_edid)) valid_extensions++; } if (valid_extensions != edid[0x7e]) { edid[EDID_LENGTH-1] += edid[0x7e] - valid_extensions; DRM_INFO("Found %d valid extensions instead of %d in EDID data " "\"%s\" for connector \"%s\"\n", valid_extensions, edid[0x7e], name, connector_name); edid[0x7e] = valid_extensions; new_edid = krealloc(edid, (valid_extensions + 1) * EDID_LENGTH, GFP_KERNEL); if (new_edid == NULL) { err = -ENOMEM; kfree(edid); goto relfw_out; } edid = new_edid; } DRM_INFO("Got %s EDID base block and %d extension%s from " "\"%s\" for connector \"%s\"\n", builtin ? "built-in" : "external", valid_extensions, valid_extensions == 1 ? "" : "s", name, connector_name); relfw_out: release_firmware(fw); out: if (err) return ERR_PTR(err); return edid; } int drm_load_edid_firmware(struct drm_connector *connector) { char *connector_name = drm_get_connector_name(connector); char *edidname = edid_firmware, *last, *colon; int ret; struct edid *edid; if (*edidname == '\0') return 0; colon = strchr(edidname, ':'); if (colon != NULL) { if (strncmp(connector_name, edidname, colon - edidname)) return 0; edidname = colon + 1; if (*edidname == '\0') return 0; } last = edidname + strlen(edidname) - 1; if (*last == '\n') *last = '\0'; edid = (struct edid *) edid_load(connector, edidname, connector_name); if (IS_ERR_OR_NULL(edid)) return 0; drm_mode_connector_update_edid_property(connector, edid); ret = drm_add_edid_modes(connector, edid); kfree(edid); return ret; }
8d4629694bb40ce5a3ce9f63b2ef55c2f1c39dca
9ceacf33fd96913cac7ef15492c126d96cae6911
/lib/libc/arch/powerpc/gen/_atomic_lock.c
a90231c802cd75d7a30b8f8aaa38a02124b6cb01
[]
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
1,852
c
_atomic_lock.c
/* $OpenBSD: _atomic_lock.c,v 1.1 2017/08/15 06:13:24 guenther Exp $ */ /* * Copyright (c) 1998 Dale Rahn <drahn@openbsd.org> * * 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. */ /* * Atomic lock for powerpc */ #include <machine/spinlock.h> int _atomic_lock(volatile _atomic_lock_t *lock) { _atomic_lock_t old; __asm__("1: lwarx 0,0,%1 \n" " stwcx. %2,0,%1 \n" " bne- 1b \n" " mr %0, 0 \n" : "=r" (old), "=r" (lock) : "r" (_ATOMIC_LOCK_LOCKED), "1" (lock) : "0" ); return (old != _ATOMIC_LOCK_UNLOCKED); /* * Dale <drahn@openbsd.org> says: * Side note. to prevent two processes from accessing * the same address with the lwarx in one instruction * and the stwcx in another process, the current powerpc * kernel uses a stwcx instruction without the corresponding * lwarx which causes any reservation of a process * to be removed. if a context switch occurs * between the two accesses the store will not occur * and the condition code will cause it to loop. If on * a dual processor machine, the reserve will cause * appropriate bus cycle accesses to notify other * processors. */ }
ca284bd1c5934a5323cb90988f502e357761a81c
8838eb997879add5759b6dfb23f9a646464e53ca
/src/lib/elf/libelf.h
419eb509e4954cf7d3e47b9f5d4502a760db8fce
[ "BSD-2-Clause" ]
permissive
embox/embox
d6aacec876978522f01cdc4b8de37a668c6f4c80
98e3c06e33f3fdac10a29c069c20775568e0a6d1
refs/heads/master
2023-09-04T03:02:20.165042
2023-09-02T14:55:31
2023-09-02T14:55:31
33,078,138
1,087
325
BSD-2-Clause
2023-09-14T16:58:34
2015-03-29T15:27:48
C
UTF-8
C
false
false
746
h
libelf.h
/** * @file * @brief ELF (Executable and Linkable Format) reader. * * @date 15.02.2013 * @author Anton Bulychev */ #ifndef LIB_ELF_H_ #define LIB_ELF_H_ #include <lib/elf_consts.h> #include <lib/elf_types.h> extern int elf_read_header(int fd, Elf32_Ehdr *header); int elf_read_sh_table(int fd, Elf32_Ehdr *header, Elf32_Shdr *sh_table); int elf_read_section(int fd, Elf32_Shdr *sh, void *addr); int elf_read_section_by_index(int fd, Elf32_Ehdr *header, Elf32_Shdr *s_header, unsigned short index); extern int elf_read_ph_table(int fd, Elf32_Ehdr *header, Elf32_Phdr *ph_table); extern int elf_read_segment(int fd, Elf32_Phdr *ph, void *addr); extern int elf_read_interp(int fd, Elf32_Phdr *ph, char *interp); #endif /* LIB_ELF_H_ */
957dc61f08af1099c300266893885ada91ce7b6f
d2de6f54bae55578f9d6f6d621b1892efe7eb076
/gluecodium/src/test/resources/smoke/nesting/output/dart/ffi/ffi_smoke_OuterStruct.h
fac74c7252ae9ab0a699d8949745e50b89a58e2a
[ "Apache-2.0" ]
permissive
heremaps/gluecodium
812f4b8a6a0f01979d6902b5e0cfe003a5b82347
92e6a514dc8bdb786ad949f79df249da277c6e88
refs/heads/master
2023-08-24T19:34:55.818503
2023-08-24T06:02:15
2023-08-24T06:02:15
139,735,719
172
17
Apache-2.0
2023-09-01T11:49:28
2018-07-04T14:55:33
Dart
UTF-8
C
false
false
4,760
h
ffi_smoke_OuterStruct.h
#pragma once #include "Export.h" #include "OpaqueHandle.h" #include "dart_api_dl.h" #include <stdint.h> #ifdef __cplusplus extern "C" { #endif _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_doNothing_return_release_handle(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT uint32_t library_smoke_OuterStruct_doNothing_return_get_error(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT bool library_smoke_OuterStruct_doNothing_return_has_error(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_doNothing(FfiOpaqueHandle _self, int32_t _isolate_id); _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_InnerStruct_doSomething(FfiOpaqueHandle _self, int32_t _isolate_id); _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_InnerLambda_call(FfiOpaqueHandle _self, int32_t _isolate_id); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerClass_fooBar(FfiOpaqueHandle _self, int32_t _isolate_id); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerInterface_barBaz(FfiOpaqueHandle _self, int32_t _isolate_id); _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_InnerClass_register_finalizer(FfiOpaqueHandle ffi_handle, int32_t isolate_id, Dart_Handle dart_handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerClass_copy_handle(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_InnerClass_release_handle(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_InnerInterface_register_finalizer(FfiOpaqueHandle ffi_handle, int32_t isolate_id, Dart_Handle dart_handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerInterface_copy_handle(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_InnerInterface_release_handle(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_InnerLambda_register_finalizer(FfiOpaqueHandle ffi_handle, int32_t isolate_id, Dart_Handle dart_handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerLambda_copy_handle(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_InnerLambda_release_handle(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerLambda_create_handle_nullable(FfiOpaqueHandle value); _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_InnerLambda_release_handle_nullable(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerLambda_get_value_nullable(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerInterface_create_proxy(uint64_t token, int32_t isolate_id, Dart_Handle dart_handle, FfiOpaqueHandle f0); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerLambda_create_proxy(uint64_t token, int32_t isolate_id, Dart_Handle dart_handle, FfiOpaqueHandle f0); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_create_handle(FfiOpaqueHandle field); _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_release_handle(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_get_field_field(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_create_handle_nullable(FfiOpaqueHandle value); _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_release_handle_nullable(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_get_value_nullable(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerStruct_create_handle(FfiOpaqueHandle otherField); _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_InnerStruct_release_handle(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerStruct_get_field_otherField(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerStruct_create_handle_nullable(FfiOpaqueHandle value); _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_InnerStruct_release_handle_nullable(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerStruct_get_value_nullable(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerEnum_create_handle_nullable(uint32_t value); _GLUECODIUM_FFI_EXPORT void library_smoke_OuterStruct_InnerEnum_release_handle_nullable(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT uint32_t library_smoke_OuterStruct_InnerEnum_get_value_nullable(FfiOpaqueHandle handle); _GLUECODIUM_FFI_EXPORT FfiOpaqueHandle library_smoke_OuterStruct_InnerInterface_get_type_id(FfiOpaqueHandle handle); #ifdef __cplusplus } #endif
8d83a2304a033dfc6b84a756324b5dff15ed6330
59bc6f245c1c8f1b65afdbde959db281d5747e63
/Examples/English/1. License system/GetKeyInteger - custom integer values/C/console/console.c
18e264d047a5fd4851d4d15b68259fe14acc1da2
[]
no_license
PELock/PELock-Software-Protection-and-Licensing-SDK
70fc8cf20681b5799c7a016773851da5bfe258b6
45c3ee1f8d6f489f8abfbe8b4bb7a476d4d1c001
refs/heads/master
2023-06-24T13:35:18.095564
2023-03-11T14:35:50
2023-03-11T14:35:50
63,718,533
184
57
null
2018-08-30T18:51:48
2016-07-19T18:32:23
C++
WINDOWS-1250
C
false
false
1,008
c
console.c
//////////////////////////////////////////////////////////////////////////////// // // Example of how to read custom integer values stored in the keyfile // // Version : PELock v2.0 // Language : C/C++ // Author : Bartosz Wójcik (support@pelock.com) // Web page : https://www.pelock.com // //////////////////////////////////////////////////////////////////////////////// #include <windows.h> #include <stdio.h> #include <conio.h> #include "pelock.h" int main(int argc, char *argv[]) { unsigned int nNumberOfItems = 0; // code between DEMO_START and DEMO_END will be encrypted // in protected file and will not be available without license key DEMO_START printf("Hello world from the full version of my software!\n"); // read key integer value, you can use it however you want nNumberOfItems = GetKeyInteger(5); printf("You can store up to %u items in the database\n", nNumberOfItems); DEMO_END printf("\n\nPress any key to exit . . ."); getch(); return 0; }
1380711998acaf339d0d1963acdb9ad65a21ebcd
07327b5e8b2831b12352bf7c6426bfda60129da7
/Include/10.0.14393.0/km/crt/armintr.h
ec2de51a0da9f1cdd6d633bb4efed15d16adbaa9
[]
no_license
tpn/winsdk-10
ca279df0fce03f92036e90fb04196d6282a264b7
9b69fd26ac0c7d0b83d378dba01080e93349c2ed
refs/heads/master
2021-01-10T01:56:18.586459
2018-02-19T21:26:31
2018-02-19T21:29:50
44,352,845
218
432
null
null
null
null
UTF-8
C
false
false
30,793
h
armintr.h
/*** * armintr.h - definitions and declarations for ARM specific intrinsics * * Copyright (c) Microsoft Corporation. All rights reserved. * *Purpose: * This file contains constant definitions and external subroutine * declarations for the ARM specific intriniscs * ****/ #pragma once #if !defined (_M_ARM) #error This header is specific to ARM targets #endif /* !defined (_M_ARM) */ #if defined (__cplusplus) extern "C" { #endif /* defined (__cplusplus) */ typedef enum _tag_ARMINTR_SHIFT_T { _ARM_LSR = 0, _ARM_LSL = 1, _ARM_ASR = 2, _ARM_ROR = 3 } _ARMINTR_SHIFT_T; int __arm_gen_s_Rd_Rd (const unsigned int, int); int __arm_gen_s_Rd_RdRn (const unsigned int, int, int); int __arm_gen_s_Rd_RdRm (const unsigned int, int, int); int __arm_gen_s_Rd_RnRm_g (const unsigned int, int, int); int __arm_gen_s_Rd_RnRm_q (const unsigned int, int, int); int __arm_gen_s_Rd_Rn (const unsigned int, int); int __arm_gen_s_Rd_Rn_q (const unsigned int, int); int __arm_gen_s_Rd_RnRm (const unsigned int, int, int); int __arm_gen_s_Rd_Rm (const unsigned int, int); int __arm_gen_s_Rd_Rm_q (const unsigned int, int); int __arm_gen_s_Rd_Rm2 (const unsigned int, int); __int64 __arm_gen_s_Rdn_RdnRmRs(const unsigned int, __int64, int, int); __int64 __arm_gen_s_Rdn_RmRs (const unsigned int, int, int); int __arm_gen_s_Rn_RmRs (const unsigned int, int, int); int __arm_gen_s_Rn_RmRsRd (const unsigned int, int, int, int); unsigned int __arm_gen_u_Rd_Rd (const unsigned int, unsigned int); unsigned int __arm_gen_u_Rd_RdRn (const unsigned int, unsigned int, unsigned int); unsigned int __arm_gen_u_Rd_RdRm (const unsigned int, unsigned int, unsigned int); unsigned int __arm_gen_u_Rd_RnRm_g (const unsigned int, unsigned int, unsigned int); unsigned int __arm_gen_u_Rd_Rn (const unsigned int, unsigned int); unsigned int __arm_gen_u_Rd_RnRm (const unsigned int, unsigned int, unsigned int); unsigned int __arm_gen_u_Rd_Rm (const unsigned int, unsigned int); unsigned int __arm_gen_u_Rd_Rm2 (const unsigned int, unsigned int); unsigned __int64 __arm_gen_u_Rdn_RdnRmRs(const unsigned int, unsigned __int64, unsigned int, unsigned int); unsigned __int64 __arm_gen_u_Rdn_RmRs (const unsigned int, unsigned int, unsigned int); unsigned int __arm_gen_u_Rn_RmRs (const unsigned int, unsigned int, unsigned int); unsigned int __arm_gen_u_Rn_RmRsRd (const unsigned int, unsigned int, unsigned int, unsigned int); #define _ARMINTR_ASSERT(exp, msg) __static_assert(exp, msg) #define _ARMINTR_IN_RANGE(val, low, high) (((val) >= low) && ((val) <= high)) #define _ARMINTR_ASSERT_RANGE(val, low, high, name) \ (_ARMINTR_ASSERT(_ARMINTR_IN_RANGE((val), (low), (high)), name " is out of range '" #low " - " #high "'")) #define _ARMINTR_ASSERT_ROT(rot) \ (_ARMINTR_ASSERT(((rot) & ~0x18U) == 0, "rotation must be 0, 8, 16, or 24")) #define _ARMINTR_ASSERT_SAT_BIT(sat_bit, low, high) \ (_ARMINTR_ASSERT_RANGE((sat_bit), low, high, "saturation bit position")) // low, high intentionally not in (parentheses) #if defined (_M_THUMB) #define _ARMINTR_ASSERT_SAT_SHIFT(type, amt) \ (_ARMINTR_ASSERT(((type) == _ARM_LSL) || ((type) == _ARM_ASR), "shift type must be _ARM_LSL or _ARM_ASR"), \ _ARMINTR_ASSERT(((type) != _ARM_LSL) || _ARMINTR_IN_RANGE((amt), 0, 31), "shift is out of range '0 - 31'"), \ _ARMINTR_ASSERT(((type) != _ARM_ASR) || _ARMINTR_IN_RANGE((amt), 1, 31), "shift is out of range '1 - 31'")) #else /* defined (_M_THUMB) */ #define _ARMINTR_ASSERT_SAT_SHIFT(type, amt) \ (_ARMINTR_ASSERT(((type) == _ARM_LSL) || ((type) == _ARM_ASR), "shift type must be _ARM_LSL or _ARM_ASR"), \ _ARMINTR_ASSERT(((type) != _ARM_LSL) || _ARMINTR_IN_RANGE((amt), 0, 31), "shift is out of range '0 - 31'"), \ _ARMINTR_ASSERT(((type) != _ARM_ASR) || _ARMINTR_IN_RANGE((amt), 1, 32), "shift is out of range '1 - 32'")) #endif /* defined (_M_THUMB) */ #if defined (_M_THUMB) #define _ARMINTR_ENCODE_XTROT(rot) (((rot) & 0x18U) << 17) #define _ARMINTR_ENCODE_PKHSHIFT(shift) ((((shift) & 0x1CU) << 26) | (((shift) & 0x3U) << 22)) #define _ARMINTR_ENCODE_IMM5_16(imm) (((imm) & 0x1FU) << 16) #define _ARMINTR_ENCODE_IMM5_7(imm) ((((imm) & 0x1CU) << 26) | (((imm) & 0x3U) << 22)) #define _ARMINTR_ENCODE_SAT_SH(type, amt) ((((type) & 2U) << 4) | _ARMINTR_ENCODE_IMM5_7(amt)) #define _ARMINTR_ENCODE_IMM4_16(bit) (((bit) & 0xFU) << 16) #define _ARMINTR_BFC 0x0000F36FU #define _ARMINTR_BFI 0x0000F360U #define _ARMINTR_SBFX 0x0000F340U #define _ARMINTR_UBFX 0x0000F3C0U #define _ARMINTR_QADD 0xF080FA80U #define _ARMINTR_QDADD 0xF090FA80U #define _ARMINTR_QDSUB 0xF0B0FA80U #define _ARMINTR_QSUB 0xF0A0FA80U #define _ARMINTR_QADD16 0xF010FA90U #define _ARMINTR_QADD8 0xF010FA80U #define _ARMINTR_QASX 0xF010FAA0U #define _ARMINTR_QSAX 0xF010FAE0U #define _ARMINTR_QSUB16 0xF010FAD0U #define _ARMINTR_QSUB8 0xF010FAC0U #define _ARMINTR_SHADD16 0xF020FA90U #define _ARMINTR_SHADD8 0xF020FA80U #define _ARMINTR_SHASX 0xF020FAA0U #define _ARMINTR_SHSAX 0xF020FAE0U #define _ARMINTR_SHSUB16 0xF020FAD0U #define _ARMINTR_SHSUB8 0xF020FAC0U #define _ARMINTR_UHADD16 0xF060FA90U #define _ARMINTR_UHADD8 0xF060FA80U #define _ARMINTR_UHASX 0xF060FAA0U #define _ARMINTR_UHSAX 0xF060FAE0U #define _ARMINTR_UHSUB16 0xF060FAD0U #define _ARMINTR_UHSUB8 0xF060FAC0U #define _ARMINTR_UQADD16 0xF050FA90U #define _ARMINTR_UQADD8 0xF050FA80U #define _ARMINTR_UQASX 0xF050FAA0U #define _ARMINTR_UQSAX 0xF050FAE0U #define _ARMINTR_UQSUB16 0xF050FAD0U #define _ARMINTR_UQSUB8 0xF050FAC0U #define _ARMINTR_SXTAB 0xF080FA40U #define _ARMINTR_SXTAB16 0xF080FA20U #define _ARMINTR_SXTAH 0xF080FA00U #define _ARMINTR_UXTAB 0xF080FA50U #define _ARMINTR_UXTAB16 0xF080FA30U #define _ARMINTR_UXTAH 0xF080FA10U #define _ARMINTR_SXTB 0xF080FA4FU #define _ARMINTR_SXTB16 0xF080FA2FU #define _ARMINTR_SXTH 0xF080FA0FU #define _ARMINTR_UXTB 0xF080FA5FU #define _ARMINTR_UXTB16 0xF080FA3FU #define _ARMINTR_UXTBH 0xF080FA1FU #define _ARMINTR_PKHBT 0x0000EAC0U #define _ARMINTR_PKHTB 0x0020EAC0U #define _ARMINTR_USAD8 0xF000FB70U #define _ARMINTR_USADA8 0x0000FB70U #define _ARMINTR_SADD16 0xF000FA90U #define _ARMINTR_SADD8 0xF000FA80U #define _ARMINTR_SASX 0xF000FAA0U #define _ARMINTR_SSAX 0xF000FAE0U #define _ARMINTR_SSUB16 0xF000FAD0U #define _ARMINTR_SSUB8 0xF000FAC0U #define _ARMINTR_UADD16 0xF040FA90U #define _ARMINTR_UADD8 0xF040FA80U #define _ARMINTR_UASX 0xF040FAA0U #define _ARMINTR_USAX 0xF040FAE0U #define _ARMINTR_USUB16 0xF040FAD0U #define _ARMINTR_USUB8 0xF040FAC0U #define _ARMINTR_SSAT 0x0000F300U #define _ARMINTR_USAT 0x0000F380U #define _ARMINTR_SSAT16 0x0000F320U #define _ARMINTR_USAT16 0x0000F3A0U #define _ARMINTR_CLZ 0xF080FAB0U #define _ARMINTR_RBIT 0xF0A0FA90U #define _ARMINTR_REV 0xF080FA90U #define _ARMINTR_REV16 0xF090FA90U #define _ARMINTR_REVSH 0xF0B0FA90U #define _ARMINTR_SMLAD 0x0000FB20U #define _ARMINTR_SMLADX 0x0010FB20U #define _ARMINTR_SMLSD 0x0000FB40U #define _ARMINTR_SMLSDX 0x0010FB40U #define _ARMINTR_SMMLA 0x0000FB50U #define _ARMINTR_SMMLAR 0x0010FB50U #define _ARMINTR_SMMLS 0x0000FB60U #define _ARMINTR_SMMLSR 0x0010FB60U #define _ARMINTR_SMLABB 0x0000FB10U #define _ARMINTR_SMLABT 0x0010FB10U #define _ARMINTR_SMLATB 0x0020FB10U #define _ARMINTR_SMLATT 0x0030FB10U #define _ARMINTR_SMLAWB 0x0000FB30U #define _ARMINTR_SMLAWT 0x0010FB30U #define _ARMINTR_SMULWB 0xF000FB30U #define _ARMINTR_SMULWT 0xF010FB30U #define _ARMINTR_SMULBB 0xF000FB10U #define _ARMINTR_SMULBT 0xF010FB10U #define _ARMINTR_SMULTB 0xF020FB10U #define _ARMINTR_SMULTT 0xF030FB10U #define _ARMINTR_SMULL 0x0000FB80U #define _ARMINTR_SMMUL 0xF000FB50U #define _ARMINTR_SMMULR 0xF010FB50U #define _ARMINTR_SMUAD 0xF000FB20U #define _ARMINTR_SMUADX 0xF010FB20U #define _ARMINTR_SMUSD 0xF000FB40U #define _ARMINTR_SMUSDX 0xF010FB40U #define _ARMINTR_SMLALBB 0x0080FBC0U #define _ARMINTR_SMLALBT 0x0090FBC0U #define _ARMINTR_SMLALTB 0x00A0FBC0U #define _ARMINTR_SMLALTT 0x00B0FBC0U #define _ARMINTR_SMLALD 0x00C0FBC0U #define _ARMINTR_SMLALDX 0x00D0FBC0U #define _ARMINTR_SMLSLD 0x00C0FBD0U #define _ARMINTR_SMLSLDX 0x00D0FBD0U #define _ARMINTR_SMLAL 0x0000FBC0U #define _ARMINTR_UMLAL 0x0000FBE0U #define _ARMINTR_UMAAL 0x0060FBE0U #define _ARMINTR_UMULL 0x0000FBA0U #define _ARMINTR_SDIV 0xF0F0FB90U #define _ARMINTR_UDIV 0xF0F0FBB0U #define _ARMINTR_U_DDMx __arm_gen_u_Rd_RdRn #define _ARMINTR_U_DMx __arm_gen_u_Rd_Rn #define _ARMINTR_S_DMx __arm_gen_s_Rd_Rn #else /* defined (_M_THUMB) */ #define _ARMINTR_ENCODE_XTROT(rot) (((rot) & 0x18U) << 7) #define _ARMINTR_ENCODE_PKHSHIFT(shift) (((shift) & 0x1FU) << 7) #define _ARMINTR_ENCODE_IMM5_16(imm) (((imm) & 0x1FU) << 16) #define _ARMINTR_ENCODE_IMM5_7(imm) (((imm) & 0x1FU) << 7) #define _ARMINTR_ENCODE_SAT_SH(type, amt) ((((type) & 2U) << 5) | _ARMINTR_ENCODE_IMM5_7(amt)) #define _ARMINTR_ENCODE_IMM4_16(bit) (((bit) & 0xFU) << 16) #define _ARMINTR_BFC 0x07C0001FU #define _ARMINTR_BFI 0x07C00010U #define _ARMINTR_SBFX 0x07A00050U #define _ARMINTR_UBFX 0x07E00050U #define _ARMINTR_QADD 0x01000050U #define _ARMINTR_QDADD 0x01400050U #define _ARMINTR_QDSUB 0x01600050U #define _ARMINTR_QSUB 0x01200050U #define _ARMINTR_QADD16 0x06200F10U #define _ARMINTR_QADD8 0x06200F90U #define _ARMINTR_QASX 0x06200F30U #define _ARMINTR_QSAX 0x06200F50U #define _ARMINTR_QSUB16 0x06200F70U #define _ARMINTR_QSUB8 0x06200FF0U #define _ARMINTR_SHADD16 0x06300F10U #define _ARMINTR_SHADD8 0x06300F90U #define _ARMINTR_SHASX 0x06300F30U #define _ARMINTR_SHSAX 0x06300F50U #define _ARMINTR_SHSUB16 0x06300F70U #define _ARMINTR_SHSUB8 0x06300FF0U #define _ARMINTR_UHADD16 0x06700F10U #define _ARMINTR_UHADD8 0x06700F90U #define _ARMINTR_UHASX 0x06700F30U #define _ARMINTR_UHSAX 0x06700F50U #define _ARMINTR_UHSUB16 0x06700F70U #define _ARMINTR_UHSUB8 0x06700FF0U #define _ARMINTR_UQADD16 0x06600F10U #define _ARMINTR_UQADD8 0x06600F90U #define _ARMINTR_UQASX 0x06600F30U #define _ARMINTR_UQSAX 0x06600F50U #define _ARMINTR_UQSUB16 0x06600F70U #define _ARMINTR_UQSUB8 0x06600FF0U #define _ARMINTR_SXTAB 0x06A00070U #define _ARMINTR_SXTAB16 0x06800070U #define _ARMINTR_SXTAH 0x06B00070U #define _ARMINTR_UXTAB 0x06E00070U #define _ARMINTR_UXTAB16 0x06C00070U #define _ARMINTR_UXTAH 0x06F00070U #define _ARMINTR_SXTB 0x06AF0070U #define _ARMINTR_SXTB16 0x068F0070U #define _ARMINTR_SXTH 0x06BF0070U #define _ARMINTR_UXTB 0x06EF0070U #define _ARMINTR_UXTB16 0x06CF0070U #define _ARMINTR_UXTBH 0x06FF0070U #define _ARMINTR_PKHBT 0x06800010U #define _ARMINTR_PKHTB 0x06800050U #define _ARMINTR_USAD8 0x0780F010U #define _ARMINTR_USADA8 0x07800010U #define _ARMINTR_SADD16 0x06100F10U #define _ARMINTR_SADD8 0x06100F90U #define _ARMINTR_SASX 0x06100F30U #define _ARMINTR_SSAX 0x06100F50U #define _ARMINTR_SSUB16 0x06100F70U #define _ARMINTR_SSUB8 0x06100FF0U #define _ARMINTR_UADD16 0x06500F10U #define _ARMINTR_UADD8 0x06500F90U #define _ARMINTR_UASX 0x06500F30U #define _ARMINTR_USAX 0x06500F50U #define _ARMINTR_USUB16 0x06500F70U #define _ARMINTR_USUB8 0x06500FF0U #define _ARMINTR_SSAT 0x06A00010U #define _ARMINTR_USAT 0x06E00010U #define _ARMINTR_SSAT16 0x06A00F30U #define _ARMINTR_USAT16 0x06E00F30U #define _ARMINTR_CLZ 0x016F0F10U #define _ARMINTR_RBIT 0x06FF0F30U #define _ARMINTR_REV 0x06BF0F30U #define _ARMINTR_REV16 0x06BF0FB0U #define _ARMINTR_REVSH 0x06FF0FB0U #define _ARMINTR_SMLAD 0x07000010U #define _ARMINTR_SMLADX 0x07000030U #define _ARMINTR_SMLSD 0x07000050U #define _ARMINTR_SMLSDX 0x07000070U #define _ARMINTR_SMMLA 0x07500010U #define _ARMINTR_SMMLAR 0x07500030U #define _ARMINTR_SMMLS 0x075000D0U #define _ARMINTR_SMMLSR 0x075000F0U #define _ARMINTR_SMLABB 0x01000080U #define _ARMINTR_SMLABT 0x010000C0U #define _ARMINTR_SMLATB 0x010000A0U #define _ARMINTR_SMLATT 0x010000E0U #define _ARMINTR_SMLAWB 0x01200080U #define _ARMINTR_SMLAWT 0x012000C0U #define _ARMINTR_SMULWB 0x012000A0U #define _ARMINTR_SMULWT 0x012000E0U #define _ARMINTR_SMULBB 0x01600080U #define _ARMINTR_SMULBT 0x016000C0U #define _ARMINTR_SMULTB 0x016000A0U #define _ARMINTR_SMULTT 0x016000E0U #define _ARMINTR_SMULL 0x00C00090U #define _ARMINTR_SMMUL 0x0750F010U #define _ARMINTR_SMMULR 0x0750F030U #define _ARMINTR_SMUAD 0x0700F010U #define _ARMINTR_SMUADX 0x0700F030U #define _ARMINTR_SMUSD 0x0700F050U #define _ARMINTR_SMUSDX 0x0700F070U #define _ARMINTR_SMLALBB 0x01400080U #define _ARMINTR_SMLALBT 0x014000C0U #define _ARMINTR_SMLALTB 0x014000A0U #define _ARMINTR_SMLALTT 0x014000E0U #define _ARMINTR_SMLALD 0x07400010U #define _ARMINTR_SMLALDX 0x07400030U #define _ARMINTR_SMLSLD 0x07400050U #define _ARMINTR_SMLSLDX 0x07400070U #define _ARMINTR_SMLAL 0x00E00090U #define _ARMINTR_UMLAL 0x00A00090U #define _ARMINTR_UMAAL 0x00400090U #define _ARMINTR_UMULL 0x00800090U #define _ARMINTR_U_DDMx __arm_gen_u_Rd_RdRm #define _ARMINTR_U_DMx __arm_gen_u_Rd_Rm #define _ARMINTR_S_DMx __arm_gen_s_Rd_Rm #endif /* defined (_M_THUMB) */ /* ARMv4 */ #define _arm_smlal(_RdHiLo, _Rn, _Rm) (__arm_gen_s_Rdn_RdnRmRs(_ARMINTR_SMLAL, (_RdHiLo), (_Rn), (_Rm))) #define _arm_umlal(_RdHiLo, _Rn, _Rm) (__arm_gen_u_Rdn_RdnRmRs(_ARMINTR_UMLAL, (_RdHiLo), (_Rn), (_Rm))) /* ARMv5E */ #define _arm_clz(_Rm) (__arm_gen_u_Rd_Rm2(_ARMINTR_CLZ, (_Rm))) #define _arm_qadd(_Rm, _Rn) (__arm_gen_s_Rd_RnRm_q(_ARMINTR_QADD, (_Rn), (_Rm))) #define _arm_qdadd(_Rm, _Rn) (__arm_gen_s_Rd_RnRm_q(_ARMINTR_QDADD, (_Rn), (_Rm))) #define _arm_qdsub(_Rm, _Rn) (__arm_gen_s_Rd_RnRm_q(_ARMINTR_QDSUB, (_Rn), (_Rm))) #define _arm_qsub(_Rm, _Rn) (__arm_gen_s_Rd_RnRm_q(_ARMINTR_QSUB, (_Rn), (_Rm))) #define _arm_smlabb(_Rn, _Rm, _Ra) (__arm_gen_s_Rn_RmRsRd(_ARMINTR_SMLABB, (_Rn), (_Rm), (_Ra))) #define _arm_smlabt(_Rn, _Rm, _Ra) (__arm_gen_s_Rn_RmRsRd(_ARMINTR_SMLABT, (_Rn), (_Rm), (_Ra))) #define _arm_smlatb(_Rn, _Rm, _Ra) (__arm_gen_s_Rn_RmRsRd(_ARMINTR_SMLATB, (_Rn), (_Rm), (_Ra))) #define _arm_smlatt(_Rn, _Rm, _Ra) (__arm_gen_s_Rn_RmRsRd(_ARMINTR_SMLATT, (_Rn), (_Rm), (_Ra))) #define _arm_smlalbb(_RdHiLo, _Rn, _Rm) (__arm_gen_s_Rdn_RdnRmRs(_ARMINTR_SMLALBB, (_RdHiLo), (_Rn), (_Rm))) #define _arm_smlalbt(_RdHiLo, _Rn, _Rm) (__arm_gen_s_Rdn_RdnRmRs(_ARMINTR_SMLALBT, (_RdHiLo), (_Rn), (_Rm))) #define _arm_smlaltb(_RdHiLo, _Rn, _Rm) (__arm_gen_s_Rdn_RdnRmRs(_ARMINTR_SMLALTB, (_RdHiLo), (_Rn), (_Rm))) #define _arm_smlaltt(_RdHiLo, _Rn, _Rm) (__arm_gen_s_Rdn_RdnRmRs(_ARMINTR_SMLALTT, (_RdHiLo), (_Rn), (_Rm))) #define _arm_smlawb(_Rn, _Rm, _Ra) (__arm_gen_s_Rn_RmRsRd(_ARMINTR_SMLAWB, (_Rn), (_Rm), (_Ra))) #define _arm_smlawt(_Rn, _Rm, _Ra) (__arm_gen_s_Rn_RmRsRd(_ARMINTR_SMLAWT, (_Rn), (_Rm), (_Ra))) #define _arm_smulbb(_Rn, _Rm) (__arm_gen_s_Rn_RmRs(_ARMINTR_SMULBB, (_Rn), (_Rm))) #define _arm_smulbt(_Rn, _Rm) (__arm_gen_s_Rn_RmRs(_ARMINTR_SMULBT, (_Rn), (_Rm))) #define _arm_smultb(_Rn, _Rm) (__arm_gen_s_Rn_RmRs(_ARMINTR_SMULTB, (_Rn), (_Rm))) #define _arm_smultt(_Rn, _Rm) (__arm_gen_s_Rn_RmRs(_ARMINTR_SMULTT, (_Rn), (_Rm))) #define _arm_smulwb(_Rn, _Rm) (__arm_gen_s_Rn_RmRs(_ARMINTR_SMULWB, (_Rn), (_Rm))) #define _arm_smulwt(_Rn, _Rm) (__arm_gen_s_Rn_RmRs(_ARMINTR_SMULWT, (_Rn), (_Rm))) /* ARMv6 */ #define _arm_sadd16(_Rn, _Rm) (__arm_gen_s_Rd_RnRm_g(_ARMINTR_SADD16, (_Rn), (_Rm))) #define _arm_sadd8(_Rn, _Rm) (__arm_gen_s_Rd_RnRm_g(_ARMINTR_SADD8, (_Rn), (_Rm))) #define _arm_sasx(_Rn, _Rm) (__arm_gen_s_Rd_RnRm_g(_ARMINTR_SASX, (_Rn), (_Rm))) #define _arm_ssax(_Rn, _Rm) (__arm_gen_s_Rd_RnRm_g(_ARMINTR_SSAX, (_Rn), (_Rm))) #define _arm_ssub16(_Rn, _Rm) (__arm_gen_s_Rd_RnRm_g(_ARMINTR_SSUB16, (_Rn), (_Rm))) #define _arm_ssub8(_Rn, _Rm) (__arm_gen_s_Rd_RnRm_g(_ARMINTR_SSUB8, (_Rn), (_Rm))) #define _arm_shadd16(_Rn, _Rm) (__arm_gen_s_Rd_RnRm(_ARMINTR_SHADD16, (_Rn), (_Rm))) #define _arm_shadd8(_Rn, _Rm) (__arm_gen_s_Rd_RnRm(_ARMINTR_SHADD8, (_Rn), (_Rm))) #define _arm_shasx(_Rn, _Rm) (__arm_gen_s_Rd_RnRm(_ARMINTR_SHASX, (_Rn), (_Rm))) #define _arm_shsax(_Rn, _Rm) (__arm_gen_s_Rd_RnRm(_ARMINTR_SHSAX, (_Rn), (_Rm))) #define _arm_shsub16(_Rn, _Rm) (__arm_gen_s_Rd_RnRm(_ARMINTR_SHSUB16, (_Rn), (_Rm))) #define _arm_shsub8(_Rn, _Rm) (__arm_gen_s_Rd_RnRm(_ARMINTR_SHSUB8, (_Rn), (_Rm))) #define _arm_qadd16(_Rn, _Rm) (__arm_gen_s_Rd_RnRm(_ARMINTR_QADD16, (_Rn), (_Rm))) #define _arm_qadd8(_Rn, _Rm) (__arm_gen_s_Rd_RnRm(_ARMINTR_QADD8, (_Rn), (_Rm))) #define _arm_qasx(_Rn, _Rm) (__arm_gen_s_Rd_RnRm(_ARMINTR_QASX, (_Rn), (_Rm))) #define _arm_qsax(_Rn, _Rm) (__arm_gen_s_Rd_RnRm(_ARMINTR_QSAX, (_Rn), (_Rm))) #define _arm_qsub16(_Rn, _Rm) (__arm_gen_s_Rd_RnRm(_ARMINTR_QSUB16, (_Rn), (_Rm))) #define _arm_qsub8(_Rn, _Rm) (__arm_gen_s_Rd_RnRm(_ARMINTR_QSUB8, (_Rn), (_Rm))) #define _arm_uadd16(_Rn, _Rm) (__arm_gen_u_Rd_RnRm_g(_ARMINTR_UADD16, (_Rn), (_Rm))) #define _arm_uadd8(_Rn, _Rm) (__arm_gen_u_Rd_RnRm_g(_ARMINTR_UADD8, (_Rn), (_Rm))) #define _arm_uasx(_Rn, _Rm) (__arm_gen_u_Rd_RnRm_g(_ARMINTR_UASX, (_Rn), (_Rm))) #define _arm_usax(_Rn, _Rm) (__arm_gen_u_Rd_RnRm_g(_ARMINTR_USAX, (_Rn), (_Rm))) #define _arm_usub16(_Rn, _Rm) (__arm_gen_u_Rd_RnRm_g(_ARMINTR_USUB16, (_Rn), (_Rm))) #define _arm_usub8(_Rn, _Rm) (__arm_gen_u_Rd_RnRm_g(_ARMINTR_USUB8, (_Rn), (_Rm))) #define _arm_uhadd16(_Rn, _Rm) (__arm_gen_u_Rd_RnRm(_ARMINTR_UHADD16, (_Rn), (_Rm))) #define _arm_uhadd8(_Rn, _Rm) (__arm_gen_u_Rd_RnRm(_ARMINTR_UHADD8, (_Rn), (_Rm))) #define _arm_uhasx(_Rn, _Rm) (__arm_gen_u_Rd_RnRm(_ARMINTR_UHASX, (_Rn), (_Rm))) #define _arm_uhsax(_Rn, _Rm) (__arm_gen_u_Rd_RnRm(_ARMINTR_UHSAX, (_Rn), (_Rm))) #define _arm_uhsub16(_Rn, _Rm) (__arm_gen_u_Rd_RnRm(_ARMINTR_UHSUB16, (_Rn), (_Rm))) #define _arm_uhsub8(_Rn, _Rm) (__arm_gen_u_Rd_RnRm(_ARMINTR_UHSUB8, (_Rn), (_Rm))) #define _arm_uqadd16(_Rn, _Rm) (__arm_gen_u_Rd_RnRm(_ARMINTR_UQADD16, (_Rn), (_Rm))) #define _arm_uqadd8(_Rn, _Rm) (__arm_gen_u_Rd_RnRm(_ARMINTR_UQADD8, (_Rn), (_Rm))) #define _arm_uqasx(_Rn, _Rm) (__arm_gen_u_Rd_RnRm(_ARMINTR_UQASX, (_Rn), (_Rm))) #define _arm_uqsax(_Rn, _Rm) (__arm_gen_u_Rd_RnRm(_ARMINTR_UQSAX, (_Rn), (_Rm))) #define _arm_uqsub16(_Rn, _Rm) (__arm_gen_u_Rd_RnRm(_ARMINTR_UQSUB16, (_Rn), (_Rm))) #define _arm_uqsub8(_Rn, _Rm) (__arm_gen_u_Rd_RnRm(_ARMINTR_UQSUB8, (_Rn), (_Rm))) #define _arm_sxtab(_Rn, _Rm, _Rotation) (_ARMINTR_ASSERT_ROT(_Rotation), __arm_gen_s_Rd_RnRm(_ARMINTR_SXTAB | _ARMINTR_ENCODE_XTROT(_Rotation), (_Rn), (_Rm))) #define _arm_sxtab16(_Rn, _Rm, _Rotation) (_ARMINTR_ASSERT_ROT(_Rotation), __arm_gen_s_Rd_RnRm(_ARMINTR_SXTAB16 | _ARMINTR_ENCODE_XTROT(_Rotation), (_Rn), (_Rm))) #define _arm_sxtah(_Rn, _Rm, _Rotation) (_ARMINTR_ASSERT_ROT(_Rotation), __arm_gen_s_Rd_RnRm(_ARMINTR_SXTAH | _ARMINTR_ENCODE_XTROT(_Rotation), (_Rn), (_Rm))) #define _arm_uxtab(_Rn, _Rm, _Rotation) (_ARMINTR_ASSERT_ROT(_Rotation), __arm_gen_u_Rd_RnRm(_ARMINTR_UXTAB | _ARMINTR_ENCODE_XTROT(_Rotation), (_Rn), (_Rm))) #define _arm_uxtab16(_Rn, _Rm, _Rotation) (_ARMINTR_ASSERT_ROT(_Rotation), __arm_gen_u_Rd_RnRm(_ARMINTR_UXTAB16 | _ARMINTR_ENCODE_XTROT(_Rotation), (_Rn), (_Rm))) #define _arm_uxtah(_Rn, _Rm, _Rotation) (_ARMINTR_ASSERT_ROT(_Rotation), __arm_gen_u_Rd_RnRm(_ARMINTR_UXTAH | _ARMINTR_ENCODE_XTROT(_Rotation), (_Rn), (_Rm))) #define _arm_sxtb(_Rn, _Rotation) (_ARMINTR_ASSERT_ROT(_Rotation), __arm_gen_s_Rd_Rm(_ARMINTR_SXTB | _ARMINTR_ENCODE_XTROT(_Rotation), (_Rn))) #define _arm_sxtb16(_Rn, _Rotation) (_ARMINTR_ASSERT_ROT(_Rotation), __arm_gen_s_Rd_Rm(_ARMINTR_SXTB16 | _ARMINTR_ENCODE_XTROT(_Rotation), (_Rn))) #define _arm_sxth(_Rn, _Rotation) (_ARMINTR_ASSERT_ROT(_Rotation), __arm_gen_s_Rd_Rm(_ARMINTR_SXTH | _ARMINTR_ENCODE_XTROT(_Rotation), (_Rn))) #define _arm_uxtb(_Rn, _Rotation) (_ARMINTR_ASSERT_ROT(_Rotation), __arm_gen_u_Rd_Rm(_ARMINTR_UXTB | _ARMINTR_ENCODE_XTROT(_Rotation), (_Rn))) #define _arm_uxtb16(_Rn, _Rotation) (_ARMINTR_ASSERT_ROT(_Rotation), __arm_gen_u_Rd_Rm(_ARMINTR_UXTB16 | _ARMINTR_ENCODE_XTROT(_Rotation), (_Rn))) #define _arm_uxth(_Rn, _Rotation) (_ARMINTR_ASSERT_ROT(_Rotation), __arm_gen_u_Rd_Rm(_ARMINTR_UXTBH | _ARMINTR_ENCODE_XTROT(_Rotation), (_Rn))) #define _arm_pkhbt(_Rn, _Rm, _Lsl_imm) (_ARMINTR_ASSERT_RANGE((_Lsl_imm), 0, 31, "logical left shift"), \ __arm_gen_s_Rd_RnRm(_ARMINTR_PKHBT | _ARMINTR_ENCODE_PKHSHIFT(_Lsl_imm), (_Rn), (_Rm))) #define _arm_pkhtb(_Rn, _Rm, _Asr_imm) (_ARMINTR_ASSERT_RANGE((_Asr_imm), 1, 32, "arithmetic right shift"), \ __arm_gen_s_Rd_RnRm(_ARMINTR_PKHTB | _ARMINTR_ENCODE_PKHSHIFT(_Asr_imm), (_Rn), (_Rm))) #define _arm_usad8(_Rn, _Rm) (__arm_gen_u_Rn_RmRs(_ARMINTR_USAD8, (_Rn), (_Rm))) #define _arm_usada8(_Rn, _Rm, _Ra) (__arm_gen_u_Rn_RmRsRd(_ARMINTR_USADA8, (_Rn), (_Rm), (_Ra))) #define _arm_ssat(_Sat_imm, _Rn, _Shift_type, _Shift_imm) (_ARMINTR_ASSERT_SAT_BIT((_Sat_imm), 1, 32), _ARMINTR_ASSERT_SAT_SHIFT((_Shift_type), (_Shift_imm)), \ _ARMINTR_S_DMx(_ARMINTR_SSAT | _ARMINTR_ENCODE_IMM5_16((_Sat_imm) - 1) | _ARMINTR_ENCODE_SAT_SH((_Shift_type), (_Shift_imm)), (_Rn))) #define _arm_usat(_Sat_imm, _Rn, _Shift_type, _Shift_imm) (_ARMINTR_ASSERT_SAT_BIT((_Sat_imm), 0, 31), _ARMINTR_ASSERT_SAT_SHIFT((_Shift_type), (_Shift_imm)), \ _ARMINTR_S_DMx(_ARMINTR_USAT | _ARMINTR_ENCODE_IMM5_16(_Sat_imm) | _ARMINTR_ENCODE_SAT_SH((_Shift_type), (_Shift_imm)), (_Rn))) #define _arm_ssat16(_Sat_imm, _Rn) (_ARMINTR_ASSERT_SAT_BIT((_Sat_imm), 1, 16), \ _ARMINTR_S_DMx(_ARMINTR_SSAT16 | _ARMINTR_ENCODE_IMM4_16((_Sat_imm) - 1), (_Rn))) #define _arm_usat16(_Sat_imm, _Rn) (_ARMINTR_ASSERT_SAT_BIT((_Sat_imm), 0, 15), \ _ARMINTR_S_DMx(_ARMINTR_USAT16 | _ARMINTR_ENCODE_IMM4_16(_Sat_imm), (_Rn))) #define _arm_rev(_Rm) (__arm_gen_u_Rd_Rm2(_ARMINTR_REV, (_Rm))) #define _arm_rev16(_Rm) (__arm_gen_u_Rd_Rm2(_ARMINTR_REV16, (_Rm))) #define _arm_revsh(_Rm) (__arm_gen_s_Rd_Rm2(_ARMINTR_REVSH, (_Rm))) #define _arm_smlad(_Rn, _Rm, _Ra) (__arm_gen_s_Rn_RmRsRd(_ARMINTR_SMLAD, (_Rn), (_Rm), (_Ra))) #define _arm_smladx(_Rn, _Rm, _Ra) (__arm_gen_s_Rn_RmRsRd(_ARMINTR_SMLADX, (_Rn), (_Rm), (_Ra))) #define _arm_smlsd(_Rn, _Rm, _Ra) (__arm_gen_s_Rn_RmRsRd(_ARMINTR_SMLSD, (_Rn), (_Rm), (_Ra))) #define _arm_smlsdx(_Rn, _Rm, _Ra) (__arm_gen_s_Rn_RmRsRd(_ARMINTR_SMLSDX, (_Rn), (_Rm), (_Ra))) #define _arm_smmla(_Rn, _Rm, _Ra) (__arm_gen_s_Rn_RmRsRd(_ARMINTR_SMMLA, (_Rn), (_Rm), (_Ra))) #define _arm_smmlar(_Rn, _Rm, _Ra) (__arm_gen_s_Rn_RmRsRd(_ARMINTR_SMMLAR, (_Rn), (_Rm), (_Ra))) #define _arm_smmls(_Rn, _Rm, _Ra) (__arm_gen_s_Rn_RmRsRd(_ARMINTR_SMMLS, (_Rn), (_Rm), (_Ra))) #define _arm_smmlsr(_Rn, _Rm, _Ra) (__arm_gen_s_Rn_RmRsRd(_ARMINTR_SMMLSR, (_Rn), (_Rm), (_Ra))) #define _arm_smmul(_Rn, _Rm) (__arm_gen_s_Rn_RmRs(_ARMINTR_SMMUL, (_Rn), (_Rm))) #define _arm_smmulr(_Rn, _Rm) (__arm_gen_s_Rn_RmRs(_ARMINTR_SMMULR, (_Rn), (_Rm))) #define _arm_smlald(_RdHiLo, _Rn, _Rm) (__arm_gen_s_Rdn_RdnRmRs(_ARMINTR_SMLALD, (_RdHiLo), (_Rn), (_Rm))) #define _arm_smlaldx(_RdHiLo, _Rn, _Rm) (__arm_gen_s_Rdn_RdnRmRs(_ARMINTR_SMLALDX, (_RdHiLo), (_Rn), (_Rm))) #define _arm_smlsld(_RdHiLo, _Rn, _Rm) (__arm_gen_s_Rdn_RdnRmRs(_ARMINTR_SMLSLD, (_RdHiLo), (_Rn), (_Rm))) #define _arm_smlsldx(_RdHiLo, _Rn, _Rm) (__arm_gen_s_Rdn_RdnRmRs(_ARMINTR_SMLSLDX, (_RdHiLo), (_Rn), (_Rm))) #define _arm_smuad(_Rn, _Rm) (__arm_gen_s_Rn_RmRs(_ARMINTR_SMUAD, (_Rn), (_Rm))) #define _arm_smuadx(_Rn, _Rm) (__arm_gen_s_Rn_RmRs(_ARMINTR_SMUADX, (_Rn), (_Rm))) #define _arm_smusd(_Rn, _Rm) (__arm_gen_s_Rn_RmRs(_ARMINTR_SMUSD, (_Rn), (_Rm))) #define _arm_smusdx(_Rn, _Rm) (__arm_gen_s_Rn_RmRs(_ARMINTR_SMUSDX, (_Rn), (_Rm))) #define _arm_smull(_Rn, _Rm) (__arm_gen_s_Rdn_RmRs(_ARMINTR_SMULL, (_Rn), (_Rm))) #define _arm_umull(_Rn, _Rm) (__arm_gen_u_Rdn_RmRs(_ARMINTR_UMULL, (_Rn), (_Rm))) #define _arm_umaal(_RdLo, _RdHi, _Rn, _Rm) (__arm_gen_u_Rdn_RdnRmRs(_ARMINTR_UMAAL, ((unsigned __int64)(_RdHi) << 32) | (_RdLo), (_Rn), (_Rm))) /* ARMv6T2 */ #define _arm_bfc(_Rd, _Lsb, _Width) (_ARMINTR_ASSERT_RANGE((_Lsb), 0, 31, "least significant bit"), _ARMINTR_ASSERT_RANGE((_Width), 1, 32-(_Lsb), "width"), \ __arm_gen_u_Rd_Rd(_ARMINTR_BFC | _ARMINTR_ENCODE_IMM5_7(_Lsb) | _ARMINTR_ENCODE_IMM5_16((_Lsb) + (_Width) - 1), (_Rd))) #define _arm_bfi(_Rd, _Rn, _Lsb, _Width) (_ARMINTR_ASSERT_RANGE((_Lsb), 0, 31, "least significant bit"), _ARMINTR_ASSERT_RANGE((_Width), 1, 32-(_Lsb), "width"), \ _ARMINTR_U_DDMx(_ARMINTR_BFI | _ARMINTR_ENCODE_IMM5_7(_Lsb) | _ARMINTR_ENCODE_IMM5_16((_Lsb) + (_Width) - 1), (_Rd), (_Rn))) #define _arm_rbit(_Rm) (__arm_gen_u_Rd_Rm2(_ARMINTR_RBIT, (_Rm))) #define _arm_sbfx(_Rn, _Lsb, _Width) (_ARMINTR_ASSERT_RANGE((_Lsb), 0, 31, "least significant bit"), _ARMINTR_ASSERT_RANGE((_Width), 1, 32-(_Lsb), "width"), \ _ARMINTR_S_DMx(_ARMINTR_SBFX | _ARMINTR_ENCODE_IMM5_7(_Lsb) | _ARMINTR_ENCODE_IMM5_16((_Width) - 1), (_Rn))) #define _arm_ubfx(_Rn, _Lsb, _Width) (_ARMINTR_ASSERT_RANGE((_Lsb), 0, 31, "least significant bit"), _ARMINTR_ASSERT_RANGE((_Width), 1, 32-(_Lsb), "width"), \ _ARMINTR_U_DMx(_ARMINTR_UBFX | _ARMINTR_ENCODE_IMM5_7(_Lsb) | _ARMINTR_ENCODE_IMM5_16((_Width) - 1), (_Rn))) /* ARMv7 */ #if defined (_M_THUMB) #define _arm_sdiv(_Rn, _Rm) (__arm_gen_s_Rd_RnRm(_ARMINTR_SDIV, (_Rn), (_Rm))) #define _arm_udiv(_Rn, _Rm) (__arm_gen_u_Rd_RnRm(_ARMINTR_UDIV, (_Rn), (_Rm))) #endif /* defined (_M_THUMB) */ typedef enum _tag_ARMINTR_CPS_OP { _ARM_CPS_ENABLE_INTERRUPTS = 1, _ARM_CPS_DISABLE_INTERRUPTS = 2, _ARM_CPS_CHANGE_MODE = 4 } _ARMINTR_CPS_OP; typedef enum _tag_ARMINTR_CPS_FLAG { _ARM_CPS_INTERRUPT_FLAG_F = 1, _ARM_CPS_INTERRUPT_FLAG_I = 2, _ARM_CPS_INTERRUPT_FLAG_A = 4 } _ARMINTR_CPS_FLAG; void __cps(unsigned int _Ops, unsigned int _Flags, unsigned int _Mode); typedef enum _tag_ARMINTR_BARRIER_TYPE { _ARM_BARRIER_SY = 0xF, _ARM_BARRIER_ST = 0xE, _ARM_BARRIER_ISH = 0xB, _ARM_BARRIER_ISHST = 0xA, _ARM_BARRIER_NSH = 0x7, _ARM_BARRIER_NSHST = 0x6, _ARM_BARRIER_OSH = 0x3, _ARM_BARRIER_OSHST = 0x2 } _ARMINTR_BARRIER_TYPE; void __dmb(unsigned int _Type); void __dsb(unsigned int _Type); void __isb(unsigned int _Type); /* ARMv7VE */ typedef enum _tag_ARMINTR_BANKED_REG { _ARM_BANKED_R8_USR = 0x0, _ARM_BANKED_R9_USR = 0x1, _ARM_BANKED_R10_USR = 0x2, _ARM_BANKED_R11_USR = 0x3, _ARM_BANKED_R12_USR = 0x4, _ARM_BANKED_R13_USR = 0x5, _ARM_BANKED_SP_USR = 0x5, _ARM_BANKED_R14_USR = 0x6, _ARM_BANKED_LR_USR = 0x6, _ARM_BANKED_R8_FIQ = 0x8, _ARM_BANKED_R9_FIQ = 0x9, _ARM_BANKED_R10_FIQ = 0xA, _ARM_BANKED_R11_FIQ = 0xB, _ARM_BANKED_R12_FIQ = 0xC, _ARM_BANKED_R13_FIQ = 0xD, _ARM_BANKED_SP_FIQ = 0xD, _ARM_BANKED_R14_FIQ = 0xE, _ARM_BANKED_LR_FIQ = 0xE, _ARM_BANKED_R14_IRQ = 0x10, _ARM_BANKED_LR_IRQ = 0x10, _ARM_BANKED_R13_IRQ = 0x11, _ARM_BANKED_SP_IRQ = 0x11, _ARM_BANKED_R14_SVC = 0x12, _ARM_BANKED_LR_SVC = 0x12, _ARM_BANKED_R13_SVC = 0x13, _ARM_BANKED_SP_SVC = 0x13, _ARM_BANKED_R14_ABT = 0x14, _ARM_BANKED_LR_ABT = 0x14, _ARM_BANKED_R13_ABT = 0x15, _ARM_BANKED_SP_ABT = 0x15, _ARM_BANKED_R14_UND = 0x16, _ARM_BANKED_LR_UND = 0x16, _ARM_BANKED_R13_UND = 0x17, _ARM_BANKED_SP_UND = 0x17, _ARM_BANKED_R14_MON = 0x1C, _ARM_BANKED_LR_MON = 0x1C, _ARM_BANKED_R13_MON = 0x1D, _ARM_BANKED_SP_MON = 0x1D, _ARM_BANKED_ELR_HYP = 0x1E, _ARM_BANKED_R13_HYP = 0x1F, _ARM_BANKED_SP_HYP = 0x1F, _ARM_BANKED_SPSR_FIQ = 0x2E, _ARM_BANKED_SPSR_IRQ = 0x30, _ARM_BANKED_SPSR_SVC = 0x32, _ARM_BANKED_SPSR_ABT = 0x34, _ARM_BANKED_SPSR_UND = 0x36, _ARM_BANKED_SPSR_MON = 0x3C, _ARM_BANKED_SPSR_HYP = 0x3E } _ARMINTR_BANKED_REG; void _WriteBankedReg(int _Value, int _Reg); int _ReadBankedReg(int _Reg); #ifdef __cplusplus } #endif /* __cplusplus */ /* 88bf0570-3001-4e78-a5f2-be5765546192 */
2c9a6b79566ac89d6a4c6583852339754fbda4e0
e8cf6493fee2383f31e77d30c78e47e694dd298f
/examples/debugging/appcall/test_programs/simple_appcall/simple_appcall.c
691d59a3690c9aaf9cd670eaec72e5567817f423
[ "BSD-3-Clause" ]
permissive
idapython/src
30b5af8e819e2d86736cd63527dcda0e4696c680
e1c108a7df4b5d80d14d8b0c14ae73b924bff6f4
refs/heads/master
2023-09-04T08:27:09.228901
2023-07-31T14:26:58
2023-07-31T14:26:58
32,229,857
1,371
298
NOASSERTION
2023-07-28T12:34:06
2015-03-14T20:09:27
Python
UTF-8
C
false
false
486
c
simple_appcall.c
#include <stdio.h> typedef int int32; int ref4(int32 *a) { if (a == NULL) { printf("ref4: no number passed!"); return -1; } printf("ref4: entered with %d\n", *a); (*a)++; return 1; } typedef long long int int64; int ref8(int64 *a) { if (a == NULL) { printf("ref8: no number passed!"); return -1; } printf("ref8: entered with %lld\n", *a); (*a)++; return 1; } int main() { int32 x; int res = ref4(&x); int64 y; return res + ref8(&y); }
1ca142c6db436e0b842c1815283b015d440b7ee8
317410b28757af216145d23259d63fc96d07f613
/apps/spp_and_le/examples/at_com/at_cmds.c
211d2f7312c4103c89c1870186a7be17f6a16795
[ "Apache-2.0" ]
permissive
Jieli-Tech/fw-AC63_BT_SDK
48c757dca7e8000ec763bf5466583a4cd8c4a11c
393d63758081d56f0bf0a39ac596bee32c33d493
refs/heads/master
2023-07-18T02:14:56.187266
2023-06-21T03:14:20
2023-06-21T03:14:20
272,586,610
113
76
Apache-2.0
2022-10-20T23:07:31
2020-06-16T02:02:15
C
UTF-8
C
false
false
21,714
c
at_cmds.c
#include "system/app_core.h" #include "system/includes.h" #include "server/server_core.h" #include "app_config.h" #include "app_action.h" #include "os/os_api.h" #include "btcontroller_config.h" #include "btctrler/btctrler_task.h" #include "config/config_transport.h" #include "btstack/avctp_user.h" #include "btstack/btstack_task.h" #include "bt_common.h" #include "at.h" #include "spp_at_trans.h" #include "ble_at_com.h" #include "ble_at_client.h" #define LOG_TAG_CONST AT_COM #define LOG_TAG "[AT_CMD]" #define LOG_ERROR_ENABLE #define LOG_DEBUG_ENABLE #define LOG_INFO_ENABLE /* #define LOG_DUMP_ENABLE */ #define LOG_CLI_ENABLE #include "debug.h" #if CONFIG_APP_AT_COM static struct at_layer { void *config; //ci transport config u8 *pAT_buffer; //ci data path memory // transport component with configuration ci_transport_t *dev_transport; }; #define AT_BUFFER_SIZE 0x100 #ifdef HAVE_MALLOC static struct at_layer *hdl; #define __this (hdl) #else static struct at_layer hdl; #define __this (&hdl) static u8 pAT_buffer_static[AT_BUFFER_SIZE]; //ci data path memory #endif static u8 respond_buffer_static[32]; //ci data path memory void at_send_event(u8 opcode, const u8 *packet, int size); extern void at_set_soft_poweroff(void); extern void bt_max_pwr_set(u8 pwr, u8 pg_pwr, u8 iq_pwr, u8 ble_pwr); void bredr_set_fix_pwr(u8 fix); void ble_set_fix_pwr(u8 fix); void at_set_atcom_low_power_mode(u8 enable); static u8 at_uart_fifo_buffer[AT_UART_FIFIO_BUFFER_SIZE]; cbuffer_t at_to_uart_cbuf; //=========================================================== static u8 event_buffer[64 + 4]; static void at_send_event_cmd_complete(u8 opcode, u8 status, u8 *packet, u8 size) { if (size > 64) { log_error("EVT payload overflow"); return; } event_buffer[0] = opcode; event_buffer[1] = status; memcpy(event_buffer + 2, packet, size); at_send_event(AT_EVT_CMD_COMPLETE, event_buffer, 2 + size); } static void at_send_event_update(u8 event_type, const u8 *packet, int size) { at_send_event(event_type, packet, size); } static void at_send_event_uart_exception() { at_send_event(AT_EVT_UART_EXCEPTION, 0, 0); } #if TRANS_AT_COM static void at_com_packet_handler(const u8 *packet, int size) { struct at_format *cmd = packet; u8 status; if (cmd->type != AT_PACKET_TYPE_CMD) { log_info("AT CMD TYPE Mismatch"); return; } switch (cmd->opcode) { case AT_CMD_SET_BT_ADDR: { log_info("AT_CMD_SET_BT_ADDR"); /* struct cmd_set_bt_addr *payload = cmd->payload; */ /* lmp_hci_write_local_address(payload->addr); */ edr_at_set_address(cmd->payload); status = 0; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SET_BLE_ADDR: { log_info("AT_CMD_SET_BLE_ADDR"); struct cmd_set_ble_addr *payload = cmd->payload; ble_at_set_address(payload->addr); status = 0; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SET_VISIBILITY: { log_info("AT_CMD_SET_VISIBILITY"); struct cmd_set_bt_visbility *payload = cmd->payload; edr_at_set_visibility(payload->discovery, payload->connect); ble_at_set_visibility(payload->adv); status = 0; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SET_BT_NAME: { log_info("AT_CMD_SET_BT_NAME"); /* struct cmd_set_bt_name *payload = cmd->payload; */ /* lmp_hci_write_local_name(payload->name); */ edr_at_set_name(cmd->payload, cmd->length); status = 0; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SET_BLE_NAME: { log_info("AT_CMD_SET_BLE_NAME"); ble_at_set_name(cmd->payload, cmd->length); status = 0; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SEND_SPP_DATA: { log_info("AT_CMD_SEND_SPP_DATA"); status = edr_at_send_spp_data(cmd->payload, cmd->length); status = !!status; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SEND_BLE_DATA: { log_info("AT_CMD_SEND_BLE_DATA"); /* struct cmd_send_ble_data *payload = cmd->payload; */ /* log_info("GATT handle : 0x%x", payload->att_handle); */ /* log_info_hexdump(payload->att_data, cmd->length - 2); */ status = ble_at_send_data(cmd->payload, cmd->length); status = !!status; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SEND_DATA: { log_info("AT_CMD_SEND_DATA"); if (edr_at_get_staus() & BIT(ST_BIT_SPP_CONN)) { status = edr_at_send_spp_data(cmd->payload, cmd->length); } else { status = ble_at_send_data_default(cmd->payload, cmd->length); } status = !!status; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_STATUS_REQUEST: { log_info("AT_CMD_STATUS_REQUEST"); status = ble_at_get_staus(); status |= edr_at_get_staus(); at_send_event(AT_EVT_STATUS_RESPONSE, &status, 1); } break; case AT_CMD_SET_PAIRING_MODE: { log_info("AT_CMD_SET_PAIRING_MODE"); /* edr_at_set_pair_mode(cmd->payload[0]); */ /* ble_at_set_pair_mode(cmd->payload[0]); */ /* status = 0; */ status = 1; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SET_PINCODE: { log_info("AT_CMD_SET_PINCODE"); edr_at_set_pincode(cmd->payload); status = 0; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SET_UART_FLOW: { log_info("AT_CMD_SET_UART_FLOW"); /*-TODO-*/ status = 1; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SET_UART_BAUD: { log_info("AT_CMD_SET_UART_BAUD"); /*-TODO-*/ status = 1; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_VERSION_REQUEST: { log_info("AT_CMD_VERSION_REQUEST"); /*-TODO-*/ u32 version = 0x20190601; status = 0; at_send_event_cmd_complete(cmd->opcode, status, &version, 4); } break; case AT_CMD_BT_DISCONNECT: { log_info("AT_CMD_BT_DISCONNECT"); status = 0; edr_at_disconnect(); at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_BLE_DISCONNECT: { log_info("AT_CMD_BLE_DISCONNECT"); status = 0; ble_at_disconnect(); at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SET_COD: log_info("AT_CMD_SET_COD"); status = 0; edr_at_set_cod(cmd->payload); at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); break; case AT_CMD_SET_RF_MAX_TXPOWER: log_info("AT_CMD_SET_RF_MAX_TXPOWER"); if ((cmd->payload[0] < 10) && (cmd->payload[1] < 10) && (cmd->payload[2] < 10) && (cmd->payload[3] < 10)) { put_buf(cmd->payload, 4); status = 0; bt_max_pwr_set(cmd->payload[0], cmd->payload[1], cmd->payload[2], cmd->payload[3]); } else { status = 1; } at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); break; case AT_CMD_SET_EDR_TXPOWER: log_info("AT_CMD_SET_EDR_TXPOWER,%d", cmd->payload[0]); if (cmd->payload[0] < 10) { status = 0; bredr_set_fix_pwr(cmd->payload[0]); } else { status = 1; } at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); break; case AT_CMD_SET_BLE_TXPOWER: log_info("AT_CMD_SET_BLE_TXPOWER,%d", cmd->payload[0]); if (cmd->payload[0] < 10) { status = 0; ble_set_fix_pwr(cmd->payload[0]); } else { status = 1; } at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); break; case AT_CMD_ENTER_SLEEP_MODE: { log_info("AT_CMD_ENTER_SLEEP_MODE"); at_set_soft_poweroff(); } break; case AT_CMD_SET_LOW_POWER_MODE : { status = 0; log_info("AT_CMD_SET_LOW_POWER_MODE: %d", cmd->payload[0]); at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); #if (defined CONFIG_CPU_BD19) extern void board_at_uart_wakeup_enalbe(u8 enalbe); board_at_uart_wakeup_enalbe(cmd->payload[0]); at_set_atcom_low_power_mode(cmd->payload[0]); #endif } break; case AT_CMD_SET_CONFIRM_GKEY: log_info("AT_CMD_SET_CONFIRM_GKEY"); status = 0; ble_at_confirm_gkey(cmd->payload); at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); break; case AT_CMD_SET_ADV_DATA: { log_info("AT_CMD_SET_ADV_DATA"); ble_at_set_adv_data(cmd->payload, cmd->length); status = 0; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SET_SCAN_DATA: { log_info("AT_CMD_SET_RSP_DATA"); ble_at_set_rsp_data(cmd->payload, cmd->length); status = 0; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SET_XTAL: log_info("AT_CMD_SET_XTAL"); break; case AT_CMD_SET_DCDC: { log_info("AT_CMD_SET_DCDC"); struct cmd_set_dcdc *payload = cmd->payload; power_set_mode(payload->enable ? PWR_DCDC15 : PWR_LDO15); status = 0; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_GET_BT_ADDR: { log_info("AT_CMD_GET_BT_ADDR"); status = 0; edr_at_get_address(respond_buffer_static); at_send_event_cmd_complete(cmd->opcode, status, respond_buffer_static, 6); } break; case AT_CMD_GET_BLE_ADDR: { log_info("AT_CMD_GET_BLE_ADDR"); status = 0; ble_at_get_address(respond_buffer_static); at_send_event_cmd_complete(cmd->opcode, status, respond_buffer_static, 6); } break; case AT_CMD_GET_BT_NAME: { log_info("AT_CMD_GET_BT_NAME"); status = 0; respond_buffer_static[0] = edr_at_get_name(&respond_buffer_static[1]); at_send_event_cmd_complete(cmd->opcode, status, &respond_buffer_static[1], respond_buffer_static[0]); } break; case AT_CMD_GET_BLE_NAME: { log_info("AT_CMD_GET_BLE_NAME"); status = 0; respond_buffer_static[0] = ble_at_get_name(&respond_buffer_static[1]); at_send_event_cmd_complete(cmd->opcode, status, &respond_buffer_static[1], respond_buffer_static[0]); } break; case AT_CMD_GET_PINCODE: log_info("AT_CMD_GET_PINCODE"); status = 1; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); break; case AT_CMD_BLE_CONN_PARAM_REQUEST: log_info("AT_CMD_BLE_CONN_PARAM_REQUEST"); status = 0; { u16 interval_min, interval_max, latency, timeout, check = 0; interval_min = cmd->payload[1] * 0x100 + cmd->payload[0]; interval_max = cmd->payload[3] * 0x100 + cmd->payload[2]; latency = cmd->payload[5] * 0x100 + cmd->payload[4]; timeout = cmd->payload[7] * 0x100 + cmd->payload[6]; check = (0x06 <= interval_min) && (interval_min <= interval_max) && (interval_max <= 0xc80) && (latency <= 0x1f3) && (0xa <= timeout) && (timeout <= 0xc80); if (check) { slave_connect_param_update(interval_min, interval_max, latency, timeout); } else { status = 1; } } at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); break; default: at_send_event_uart_exception(); /* ASSERT(0, "AT CMD Opcode Mismatch"); */ break; } } #endif #if TRANS_AT_CLIENT static void at_client_packet_handler(const u8 *packet, int size) { struct at_format *cmd = packet; u8 status; if (cmd->type != AT_PACKET_TYPE_CMD) { log_info("AT CMD TYPE Mismatch"); return; } switch (cmd->opcode) { case AT_CMD_SET_BLE_ADDR: { log_info("AT_CMD_SET_BLE_ADDR"); struct cmd_set_ble_addr *payload = cmd->payload; ble_at_set_address(payload->addr); status = 0; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SET_BLE_NAME: { log_info("AT_CMD_SET_BLE_NAME"); ble_at_set_name(cmd->payload, cmd->length); status = 0; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_STATUS_REQUEST: { log_info("AT_CMD_STATUS_REQUEST"); status = ble_at_get_staus(); at_send_event(AT_EVT_STATUS_RESPONSE, &status, 1); } break; case AT_CMD_VERSION_REQUEST: { log_info("AT_CMD_VERSION_REQUEST"); /*-TODO-*/ u32 version = 0x20190601; status = 0; at_send_event_cmd_complete(cmd->opcode, status, &version, 4); } break; case AT_CMD_BLE_DISCONNECT: { log_info("AT_CMD_BLE_DISCONNECT"); status = 0; ble_at_disconnect(); at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_SET_RF_MAX_TXPOWER: log_info("AT_CMD_SET_RF_MAX_TXPOWER"); if ((cmd->payload[0] < 10) && (cmd->payload[1] < 10) && (cmd->payload[2] < 10) && (cmd->payload[3] < 10)) { put_buf(cmd->payload, 4); status = 0; bt_max_pwr_set(cmd->payload[0], cmd->payload[1], cmd->payload[2], cmd->payload[3]); } else { status = 1; } at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); break; case AT_CMD_SET_BLE_TXPOWER: log_info("AT_CMD_SET_BLE_TXPOWER,%d", cmd->payload[0]); if (cmd->payload[0] < 10) { status = 0; ble_set_fix_pwr(cmd->payload[0]); } else { status = 1; } at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); break; case AT_CMD_ENTER_SLEEP_MODE: { log_info("AT_CMD_ENTER_SLEEP_MODE"); at_set_soft_poweroff(); } break; case AT_CMD_SET_DCDC: { log_info("AT_CMD_SET_DCDC"); struct cmd_set_dcdc *payload = cmd->payload; power_set_mode(payload->enable ? PWR_DCDC15 : PWR_LDO15); status = 0; at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; case AT_CMD_GET_BLE_ADDR: { log_info("AT_CMD_GET_BLE_ADDR"); status = 0; ble_at_get_address(respond_buffer_static); at_send_event_cmd_complete(cmd->opcode, status, respond_buffer_static, 6); } break; case AT_CMD_GET_BLE_NAME: { log_info("AT_CMD_GET_BLE_NAME"); status = 0; respond_buffer_static[0] = ble_at_get_name(&respond_buffer_static[1]); at_send_event_cmd_complete(cmd->opcode, status, &respond_buffer_static[1], respond_buffer_static[0]); } break; //TODO参数安全判断 /** 请求 BLE 更新连接参数 */ case AT_CMD_BLE_CONN_PARAM_REQUEST: { log_info("AT_CMD_BLE_CONN_PARAM_REQUEST"); status = 0; { u16 interval_min, interval_max, latency, timeout, check = 0; interval_min = cmd->payload[1] * 0x100 + cmd->payload[0]; interval_max = cmd->payload[3] * 0x100 + cmd->payload[2]; latency = cmd->payload[5] * 0x100 + cmd->payload[4]; timeout = cmd->payload[7] * 0x100 + cmd->payload[6]; check = (0x06 <= interval_min) && (interval_min <= interval_max) && (interval_max <= 0xc80) && (latency <= 0x1f3) && (0xa <= timeout) && (timeout <= 0xc80); if (check) { client_connect_param_update(interval_min, interval_max, latency, timeout); } else { status = 1; } } at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; /** 扫描参数配置 */ case AT_CMD_SET_BLE_SCAN_PARAM : { log_info("AT_CMD_SET_BLE_SCAN_PARAM"); status = 0; { u16 scan_interval, scan_window, check = 0; scan_interval = cmd->payload[1] * 0x100 + cmd->payload[0]; scan_window = cmd->payload[3] * 0x100 + cmd->payload[2]; check = (0x04 <= scan_window) && (scan_window <= scan_interval) && (scan_interval <= 0x4000) ; if (check) { ble_at_scan_param(scan_interval, scan_window); } else { status = 1; } } at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; /** 设置蓝牙 BLE 主机 SCAN 使能 */ case AT_CMD_SET_BLE_SCAN_ENABLE : { status = 0; log_info("AT_CMD_SET_BLE_SCAN"); bt_ble_scan_enable(0, cmd->payload[0]); at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; /*** 蓝牙 BLE 主机创建连接连接监听 ***/ case AT_CMD_BLE_CREAT_CONNECT : { log_info("AT_CMD_BLE_CREAT_CONNECT"); status = 0; client_create_connection(cmd->payload + 1, cmd->payload[0]); at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; /*** 蓝牙 BLE 主机取消连接监听 ***/ case AT_CMD_BLE_CREAT_CONNECT_CANNEL : { log_info("AT_CMD_BLE_CREAT_CONNECT_CANNEL"); status = 0; client_create_connection_cancel(); at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; /** BLE 主机搜索 profile */ case AT_CMD_BLE_PROFILE_SEARCH : { log_info("AT_CMD_BLE_PROFILE_SEARCH"); status = 0; client_search_profile(cmd->payload[0], cmd->payload + 1); at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; /** 开启对从机数据的监听 , 即开启接收CCCD,从机可以通过CCCD发送数据 **/ case AT_CMD_BLE_ATT_ENABLE_CCC : { log_info("AT_CMD_BLE_ATT_ENABLE_CCC"); status = 0; { u16 value_handle = cmd->payload[1] * 0x100 + cmd->payload[0]; client_receive_ccc(value_handle, cmd->payload[2]); } at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; /** 读ATT **/ case AT_CMD_BLE_ATT_READ : { log_info("AT_CMD_BLE_ATT_READ"); status = 0; client_read_long_value(cmd->payload); at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; /** 写ATT,带响应 */ case AT_CMD_BLE_ATT_WRITE : { log_info("AT_CMD_BLE_ATT_WRITE"); status = 0; { u16 write_handle = cmd->payload[1] * 0x100 + cmd->payload[0]; client_write(write_handle, cmd->payload + 2, cmd->length - 2); } at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; /** 写ATT不带响应 */ case AT_CMD_BLE_ATT_WRITE_NO_RSP : { log_info("AT_CMD_BLE_ATT_WRITE_NO_RSP"); status = 0; { u16 write_handle = cmd->payload[1] * 0x100 + cmd->payload[0]; client_write_without_respond(write_handle, cmd->payload + 2, cmd->length - 2); } at_send_event_cmd_complete(cmd->opcode, status, NULL, 0); } break; default: at_send_event_uart_exception(); /* ASSERT(0, "AT CMD Opcode Mismatch"); */ break; } } #endif void at_send_event(u8 opcode, const u8 *packet, int size) { struct at_format *evt; evt = (struct at_format *)__this->pAT_buffer; evt->type = AT_PACKET_TYPE_EVT; evt->opcode = opcode; evt->length = size; ASSERT(AT_FORMAT_HEAD + size <= AT_BUFFER_SIZE, "AT_BUFFER, Fatal Error"); if (size) { memcpy(evt->payload, packet, size); } int packet_len = evt->length + AT_FORMAT_HEAD; u16 ret = cbuf_write(&at_to_uart_cbuf, evt, packet_len); if (ret < packet_len) { log_info("bt so fast, uart lose data,%d!!", packet_len); return; } struct sys_event e; e.type = SYS_BT_EVENT; e.arg = (void *)SYS_BT_EVENT_FORM_AT; e.u.dev.event = 0; e.u.dev.value = 0; sys_event_notify(&e); } void at_cmd_init(void) { log_info("%s,%d\n", __func__, __LINE__); #ifdef HAVE_MALLOC __this = malloc(sizeof(struct at_layer)); ASSERT(__this, "Fatal Error"); memset(__this, 0x0, sizeof(struct at_layer)); __this->pAT_buffer = malloc(AT_BUFFER_SIZE); ASSERT(__this, "Fatal Error"); memset(__this->pAT_buffer, 0x0, CI_BUFFER_SIZE); #else log_info("Static"); __this->pAT_buffer = pAT_buffer_static; #endif /* __this->config = config; */ /* at_transport_setup(void); */ #if TRANS_AT_COM at_uart_init(at_com_packet_handler); edr_at_register_event_cbk(at_send_event_update); ble_at_register_event_cbk(at_send_event_update); #endif #if TRANS_AT_CLIENT at_uart_init(at_client_packet_handler); #endif cbuf_init(&at_to_uart_cbuf, at_uart_fifo_buffer, AT_UART_FIFIO_BUFFER_SIZE); log_info("at com is ready"); at_send_event(AT_EVT_SYSTEM_READY, 0, 0); } #endif
8375dd2d95f43ce550a6b67c1fd4bf1b87d59750
1b6222f79e5c3a80c224eaa8c656c87a778d57f5
/src/ImageData.h
97a359e33c5102f16cdd2fb98ab16edf162c4ee2
[ "BSD-3-Clause-LBNL" ]
permissive
NERSC/shifter
beebfd66d9f36ea5509cff5031316d654d89f0ba
0784ae5b34537c5ca35f464249070f90c6884ca2
refs/heads/master
2023-05-30T06:07:25.121789
2022-10-22T00:07:54
2022-10-22T00:07:54
52,631,494
374
89
NOASSERTION
2023-01-31T00:37:09
2016-02-26T20:42:28
C
UTF-8
C
false
false
6,652
h
ImageData.h
/* Shifter, Copyright (c) 2015, The Regents of the University of California, ## through Lawrence Berkeley National Laboratory (subject to receipt of any ## required approvals from the U.S. Dept. of Energy). All rights reserved. ## ## Redistribution and use in source and binary forms, with or without ## modification, are permitted provided that the following conditions are met: ## 1. Redistributions of source code must retain the above copyright notice, ## this list of conditions and the following disclaimer. ## 2. Redistributions in binary form must reproduce the above copyright notice, ## this list of conditions and the following disclaimer in the documentation ## and/or other materials provided with the distribution. ## 3. Neither the name of the University of California, Lawrence Berkeley ## National Laboratory, U.S. Dept. of Energy 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. ## ## You are under no obligation whatsoever to provide any bug fixes, patches, or ## upgrades to the features, functionality or performance of the source code ## ("Enhancements") to anyone; however, if you choose to make your Enhancements ## available either publicly, or directly to Lawrence Berkeley National ## Laboratory, without imposing a separate written license agreement for such ## Enhancements, then you hereby grant the following license: a non-exclusive, ## royalty-free perpetual license to install, use, modify, prepare derivative ## works, incorporate into other computer software, distribute, and sublicense ## such enhancements or derivative works thereof, in binary and source code ## form. */ #ifndef __IMAGEDATA_INCLUDE #define __IMAGEDATA_INCLUDE #include "UdiRootConfig.h" #ifdef __cplusplus extern "C" { #endif typedef enum _ImageFormat { FORMAT_VFS = 0, FORMAT_EXT4, FORMAT_SQUASHFS, FORMAT_CRAMFS, FORMAT_XFS, FORMAT_INVALID } ImageFormat; typedef struct _ImageData { ImageFormat format; /*!< image format */ char *filename; /*!< path to image */ char **env; /*!< array of environment variables */ char **entryPoint; /*!< default entrypoint used */ char **cmd; /*!< default command used */ char *workdir; /*!< working dir of entrypoint */ char **volume; /*!< array of volume mounts */ int useLoopMount; /*!< flag if image requires loop mount */ char *identifier; /*!< Image identifier string */ char *tag; /*!< Image tag */ char *type; /*!< Image type */ char *status; /*!< Image status from gateway */ uid_t *uids; /*!< list of user ids */ gid_t *gids; /*!< list of group ids */ size_t n_uids; size_t n_gids; size_t env_capacity; /*!< Current # of allocated char* in env */ size_t volume_capacity; /*!< Current # of allocated char* in volumes */ size_t env_size; /*!< Number of elements in env array */ size_t volume_size; /*!< Number of elements in volume array */ } ImageData; char *lookup_ImageIdentifier(const char *imageType, const char *imageTag, int verbose, UdiRootConfig *); int parse_ImageData(char *type, char *identifier, UdiRootConfig *, ImageData *); void free_ImageData(ImageData *, int); size_t fprint_ImageData(FILE *, ImageData *); /** * parse_ImageDescriptor parses user-provided image descriptor strings * The fully formalized format for this is: * imageType:imageIdentifyingTag * for example: * docker:ubuntu:14.04 * docker:privateRegistry/repo:latest * docker:someSpecificDockerUser/someRepo:1.4.2.3.4 * id:23429387329872... * local:/ * * or * ubuntu:14.04 * in which case no image type is specified which leads to the defaultImageType * from udiRoot.conf to be assumed. * * Once parsed these data are useful to either fully determine which image to * load (if type == id or type == local), or perform a lookup using from the * image manager via shifterimg (if type is anything else, but particularly * docker). * * The calling function will provide pointers to uninitialized char* instances * which are used to store the resulting type and tag values. The calling * function is responsible to free the stored strings for imageType and * imageTag. * * \param userinput user-provided string in above format for desired image * \param imageType string pointer to store calculated image type * \param imageTag string pointer to store calucated image tag * \param udiConfig UdiRootConfig configuration structure * \returns 0 upon success, -1 upon error, any error should be fatal */ int parse_ImageDescriptor(char *userinput, char **imageType, char **imageTag, UdiRootConfig *); /** * imageDesc_filterString screens out disallowed characters from user input * * Allowed characters are [A-Za-z0-9_:.+-] * Depending on image type '/' is sometimes allowed * * Any other characters are simply screened out (removed and skipped over) * * \param target the user-input to filter * \param type if not-NULL can adjust the allowed characters based on avlue * \returns newly allocated filtered string */ char *imageDesc_filterString(const char *target, const char *type); /** * check_image_permissions checks if an image can be used by a user * * \param uid the numeric user id of the user * \param gid the numeric group id of the user * \param aux_gids array of auxiliary gids the user has access to * \param naux_gids number of elements in aux_gids * \param imageData image meta-data */ int check_image_permissions(uid_t uid, gid_t gid, gid_t *aux_gids, int naux_gids, ImageData *imageData); #ifdef __cplusplus } #endif #endif
e16d59fe72709ffc733449df67391c32b3d01356
321d11eaee885ceb3a74db0a062f9bbdf282148c
/crypto/armcap.c
3b1447456d71ed058ea7d873d8e3fdbb2282d640
[ "Apache-2.0", "OpenSSL", "LicenseRef-scancode-proprietary-license" ]
permissive
openssl/openssl
75691ebaae957793f2ff0673f77545277dfb3988
5318c012885a5382eadbf95aa9c1d35664bca819
refs/heads/master
2023-09-03T15:22:52.727123
2023-09-01T07:10:49
2023-09-02T14:30:01
7,634,677
24,148
11,569
Apache-2.0
2023-09-14T19:48:11
2013-01-15T22:34:48
C
UTF-8
C
false
false
14,064
c
armcap.c
/* * Copyright 2011-2023 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <openssl/crypto.h> #ifdef __APPLE__ #include <sys/sysctl.h> #else #include <setjmp.h> #include <signal.h> #endif #include "internal/cryptlib.h" #ifdef _WIN32 #include <windows.h> #else #include <unistd.h> #endif #include "arm_arch.h" unsigned int OPENSSL_armcap_P = 0; unsigned int OPENSSL_arm_midr = 0; unsigned int OPENSSL_armv8_rsa_neonized = 0; #ifdef _WIN32 void OPENSSL_cpuid_setup(void) { OPENSSL_armcap_P |= ARMV7_NEON; OPENSSL_armv8_rsa_neonized = 1; if (IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE)) { // These are all covered by one call in Windows OPENSSL_armcap_P |= ARMV8_AES; OPENSSL_armcap_P |= ARMV8_PMULL; OPENSSL_armcap_P |= ARMV8_SHA1; OPENSSL_armcap_P |= ARMV8_SHA256; } } uint32_t OPENSSL_rdtsc(void) { return 0; } #elif __ARM_MAX_ARCH__ < 7 void OPENSSL_cpuid_setup(void) { } uint32_t OPENSSL_rdtsc(void) { return 0; } #else /* !_WIN32 && __ARM_MAX_ARCH__ >= 7 */ /* 3 ways of handling things here: __APPLE__, getauxval() or SIGILL detect */ /* First determine if getauxval() is available (OSSL_IMPLEMENT_GETAUXVAL) */ # if defined(__GNUC__) && __GNUC__>=2 void OPENSSL_cpuid_setup(void) __attribute__ ((constructor)); # endif # if defined(__GLIBC__) && defined(__GLIBC_PREREQ) # if __GLIBC_PREREQ(2, 16) # include <sys/auxv.h> # define OSSL_IMPLEMENT_GETAUXVAL # endif # elif defined(__ANDROID_API__) /* see https://developer.android.google.cn/ndk/guides/cpu-features */ # if __ANDROID_API__ >= 18 # include <sys/auxv.h> # define OSSL_IMPLEMENT_GETAUXVAL # endif # endif # if defined(__FreeBSD__) # include <sys/param.h> # if __FreeBSD_version >= 1200000 # include <sys/auxv.h> # define OSSL_IMPLEMENT_GETAUXVAL static unsigned long getauxval(unsigned long key) { unsigned long val = 0ul; if (elf_aux_info((int)key, &val, sizeof(val)) != 0) return 0ul; return val; } # endif # endif /* * Android: according to https://developer.android.com/ndk/guides/cpu-features, * getauxval is supported starting with API level 18 */ # if defined(__ANDROID__) && defined(__ANDROID_API__) && __ANDROID_API__ >= 18 # include <sys/auxv.h> # define OSSL_IMPLEMENT_GETAUXVAL # endif /* * ARM puts the feature bits for Crypto Extensions in AT_HWCAP2, whereas * AArch64 used AT_HWCAP. */ # ifndef AT_HWCAP # define AT_HWCAP 16 # endif # ifndef AT_HWCAP2 # define AT_HWCAP2 26 # endif # if defined(__arm__) || defined (__arm) # define OSSL_HWCAP AT_HWCAP # define OSSL_HWCAP_NEON (1 << 12) # define OSSL_HWCAP_CE AT_HWCAP2 # define OSSL_HWCAP_CE_AES (1 << 0) # define OSSL_HWCAP_CE_PMULL (1 << 1) # define OSSL_HWCAP_CE_SHA1 (1 << 2) # define OSSL_HWCAP_CE_SHA256 (1 << 3) # elif defined(__aarch64__) # define OSSL_HWCAP AT_HWCAP # define OSSL_HWCAP_NEON (1 << 1) # define OSSL_HWCAP_CE AT_HWCAP # define OSSL_HWCAP_CE_AES (1 << 3) # define OSSL_HWCAP_CE_PMULL (1 << 4) # define OSSL_HWCAP_CE_SHA1 (1 << 5) # define OSSL_HWCAP_CE_SHA256 (1 << 6) # define OSSL_HWCAP_CPUID (1 << 11) # define OSSL_HWCAP_SHA3 (1 << 17) # define OSSL_HWCAP_CE_SM3 (1 << 18) # define OSSL_HWCAP_CE_SM4 (1 << 19) # define OSSL_HWCAP_CE_SHA512 (1 << 21) # define OSSL_HWCAP_SVE (1 << 22) /* AT_HWCAP2 */ # define OSSL_HWCAP2 26 # define OSSL_HWCAP2_SVE2 (1 << 1) # define OSSL_HWCAP2_RNG (1 << 16) # endif uint32_t _armv7_tick(void); uint32_t OPENSSL_rdtsc(void) { if (OPENSSL_armcap_P & ARMV7_TICK) return _armv7_tick(); else return 0; } # ifdef __aarch64__ size_t OPENSSL_rndr_asm(unsigned char *buf, size_t len); size_t OPENSSL_rndrrs_asm(unsigned char *buf, size_t len); size_t OPENSSL_rndr_bytes(unsigned char *buf, size_t len); size_t OPENSSL_rndrrs_bytes(unsigned char *buf, size_t len); static size_t OPENSSL_rndr_wrapper(size_t (*func)(unsigned char *, size_t), unsigned char *buf, size_t len) { size_t buffer_size = 0; int i; for (i = 0; i < 8; i++) { buffer_size = func(buf, len); if (buffer_size == len) break; usleep(5000); /* 5000 microseconds (5 milliseconds) */ } return buffer_size; } size_t OPENSSL_rndr_bytes(unsigned char *buf, size_t len) { return OPENSSL_rndr_wrapper(OPENSSL_rndr_asm, buf, len); } size_t OPENSSL_rndrrs_bytes(unsigned char *buf, size_t len) { return OPENSSL_rndr_wrapper(OPENSSL_rndrrs_asm, buf, len); } # endif # if !defined(__APPLE__) && !defined(OSSL_IMPLEMENT_GETAUXVAL) static sigset_t all_masked; static sigjmp_buf ill_jmp; static void ill_handler(int sig) { siglongjmp(ill_jmp, sig); } /* * Following subroutines could have been inlined, but not all * ARM compilers support inline assembler, and we'd then have to * worry about the compiler optimising out the detection code... */ void _armv7_neon_probe(void); void _armv8_aes_probe(void); void _armv8_sha1_probe(void); void _armv8_sha256_probe(void); void _armv8_pmull_probe(void); # ifdef __aarch64__ void _armv8_sm3_probe(void); void _armv8_sm4_probe(void); void _armv8_sha512_probe(void); void _armv8_eor3_probe(void); void _armv8_sve_probe(void); void _armv8_sve2_probe(void); void _armv8_rng_probe(void); # endif # endif /* !__APPLE__ && !OSSL_IMPLEMENT_GETAUXVAL */ /* We only call _armv8_cpuid_probe() if (OPENSSL_armcap_P & ARMV8_CPUID) != 0 */ unsigned int _armv8_cpuid_probe(void); # if defined(__APPLE__) /* * Checks the specified integer sysctl, returning `value` if it's 1, otherwise returning 0. */ static unsigned int sysctl_query(const char *name, unsigned int value) { unsigned int sys_value = 0; size_t len = sizeof(sys_value); return (sysctlbyname(name, &sys_value, &len, NULL, 0) == 0 && sys_value == 1) ? value : 0; } # elif !defined(OSSL_IMPLEMENT_GETAUXVAL) /* * Calls a provided probe function, which may SIGILL. If it doesn't, return `value`, otherwise return 0. */ static unsigned int arm_probe_for(void (*probe)(void), volatile unsigned int value) { if (sigsetjmp(ill_jmp, 1) == 0) { probe(); return value; } else { /* The probe function gave us SIGILL */ return 0; } } # endif void OPENSSL_cpuid_setup(void) { const char *e; # if !defined(__APPLE__) && !defined(OSSL_IMPLEMENT_GETAUXVAL) struct sigaction ill_oact, ill_act; sigset_t oset; # endif static int trigger = 0; if (trigger) return; trigger = 1; OPENSSL_armcap_P = 0; if ((e = getenv("OPENSSL_armcap"))) { OPENSSL_armcap_P = (unsigned int)strtoul(e, NULL, 0); return; } # if defined(__APPLE__) # if !defined(__aarch64__) /* * Capability probing by catching SIGILL appears to be problematic * on iOS. But since Apple universe is "monocultural", it's actually * possible to simply set pre-defined processor capability mask. */ if (1) { OPENSSL_armcap_P = ARMV7_NEON; return; } # else { /* * From * https://github.com/llvm/llvm-project/blob/412237dcd07e5a2afbb1767858262a5f037149a3/llvm/lib/Target/AArch64/AArch64.td#L719 * all of these have been available on 64-bit Apple Silicon from the * beginning (the A7). */ OPENSSL_armcap_P |= ARMV7_NEON | ARMV8_PMULL | ARMV8_AES | ARMV8_SHA1 | ARMV8_SHA256; /* More recent extensions are indicated by sysctls */ OPENSSL_armcap_P |= sysctl_query("hw.optional.armv8_2_sha512", ARMV8_SHA512); OPENSSL_armcap_P |= sysctl_query("hw.optional.armv8_2_sha3", ARMV8_SHA3); if (OPENSSL_armcap_P & ARMV8_SHA3) { char uarch[64]; size_t len = sizeof(uarch); if ((sysctlbyname("machdep.cpu.brand_string", uarch, &len, NULL, 0) == 0) && ((strncmp(uarch, "Apple M1", 8) == 0) || (strncmp(uarch, "Apple M2", 8) == 0))) { OPENSSL_armcap_P |= ARMV8_UNROLL8_EOR3; OPENSSL_armcap_P |= ARMV8_HAVE_SHA3_AND_WORTH_USING; } } } # endif /* __aarch64__ */ # elif defined(OSSL_IMPLEMENT_GETAUXVAL) if (getauxval(OSSL_HWCAP) & OSSL_HWCAP_NEON) { unsigned long hwcap = getauxval(OSSL_HWCAP_CE); OPENSSL_armcap_P |= ARMV7_NEON; if (hwcap & OSSL_HWCAP_CE_AES) OPENSSL_armcap_P |= ARMV8_AES; if (hwcap & OSSL_HWCAP_CE_PMULL) OPENSSL_armcap_P |= ARMV8_PMULL; if (hwcap & OSSL_HWCAP_CE_SHA1) OPENSSL_armcap_P |= ARMV8_SHA1; if (hwcap & OSSL_HWCAP_CE_SHA256) OPENSSL_armcap_P |= ARMV8_SHA256; # ifdef __aarch64__ if (hwcap & OSSL_HWCAP_CE_SM4) OPENSSL_armcap_P |= ARMV8_SM4; if (hwcap & OSSL_HWCAP_CE_SHA512) OPENSSL_armcap_P |= ARMV8_SHA512; if (hwcap & OSSL_HWCAP_CPUID) OPENSSL_armcap_P |= ARMV8_CPUID; if (hwcap & OSSL_HWCAP_CE_SM3) OPENSSL_armcap_P |= ARMV8_SM3; if (hwcap & OSSL_HWCAP_SHA3) OPENSSL_armcap_P |= ARMV8_SHA3; # endif } # ifdef __aarch64__ if (getauxval(OSSL_HWCAP) & OSSL_HWCAP_SVE) OPENSSL_armcap_P |= ARMV8_SVE; if (getauxval(OSSL_HWCAP2) & OSSL_HWCAP2_SVE2) OPENSSL_armcap_P |= ARMV8_SVE2; if (getauxval(OSSL_HWCAP2) & OSSL_HWCAP2_RNG) OPENSSL_armcap_P |= ARMV8_RNG; # endif # else /* !__APPLE__ && !OSSL_IMPLEMENT_GETAUXVAL */ /* If all else fails, do brute force SIGILL-based feature detection */ sigfillset(&all_masked); sigdelset(&all_masked, SIGILL); sigdelset(&all_masked, SIGTRAP); sigdelset(&all_masked, SIGFPE); sigdelset(&all_masked, SIGBUS); sigdelset(&all_masked, SIGSEGV); memset(&ill_act, 0, sizeof(ill_act)); ill_act.sa_handler = ill_handler; ill_act.sa_mask = all_masked; sigprocmask(SIG_SETMASK, &ill_act.sa_mask, &oset); sigaction(SIGILL, &ill_act, &ill_oact); OPENSSL_armcap_P |= arm_probe_for(_armv7_neon_probe, ARMV7_NEON); if (OPENSSL_armcap_P & ARMV7_NEON) { OPENSSL_armcap_P |= arm_probe_for(_armv8_pmull_probe, ARMV8_PMULL | ARMV8_AES); if (!(OPENSSL_armcap_P & ARMV8_AES)) { OPENSSL_armcap_P |= arm_probe_for(_armv8_aes_probe, ARMV8_AES); } OPENSSL_armcap_P |= arm_probe_for(_armv8_sha1_probe, ARMV8_SHA1); OPENSSL_armcap_P |= arm_probe_for(_armv8_sha256_probe, ARMV8_SHA256); # if defined(__aarch64__) OPENSSL_armcap_P |= arm_probe_for(_armv8_sm3_probe, ARMV8_SM3); OPENSSL_armcap_P |= arm_probe_for(_armv8_sm4_probe, ARMV8_SM4); OPENSSL_armcap_P |= arm_probe_for(_armv8_sha512_probe, ARMV8_SHA512); OPENSSL_armcap_P |= arm_probe_for(_armv8_eor3_probe, ARMV8_SHA3); # endif } # ifdef __aarch64__ OPENSSL_armcap_P |= arm_probe_for(_armv8_sve_probe, ARMV8_SVE); OPENSSL_armcap_P |= arm_probe_for(_armv8_sve2_probe, ARMV8_SVE2); OPENSSL_armcap_P |= arm_probe_for(_armv8_rng_probe, ARMV8_RNG); # endif /* * Probing for ARMV7_TICK is known to produce unreliable results, * so we only use the feature when the user explicitly enables it * with OPENSSL_armcap. */ sigaction(SIGILL, &ill_oact, NULL); sigprocmask(SIG_SETMASK, &oset, NULL); # endif /* __APPLE__, OSSL_IMPLEMENT_GETAUXVAL */ # ifdef __aarch64__ if (OPENSSL_armcap_P & ARMV8_CPUID) OPENSSL_arm_midr = _armv8_cpuid_probe(); if ((MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A72) || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM, ARM_CPU_PART_N1)) && (OPENSSL_armcap_P & ARMV7_NEON)) { OPENSSL_armv8_rsa_neonized = 1; } if ((MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM, ARM_CPU_PART_V1) || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM, ARM_CPU_PART_N2) || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM, ARM_CPU_PART_V2)) && (OPENSSL_armcap_P & ARMV8_SHA3)) OPENSSL_armcap_P |= ARMV8_UNROLL8_EOR3; if ((MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM) || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM) || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM_PRO) || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM_PRO) || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM_MAX) || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM_MAX) || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M2_AVALANCHE) || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M2_BLIZZARD) || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M2_AVALANCHE_PRO) || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M2_BLIZZARD_PRO) || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M2_AVALANCHE_MAX) || MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M2_BLIZZARD_MAX)) && (OPENSSL_armcap_P & ARMV8_SHA3)) OPENSSL_armcap_P |= ARMV8_HAVE_SHA3_AND_WORTH_USING; # endif } #endif /* _WIN32, __ARM_MAX_ARCH__ >= 7 */
8a0cc53d12594763e64affb5ed24266ae2f52fb3
89ac799bd004042f913c9205abd22feaf847f5be
/src/Game/GM_SeSet_80032858.c
193cac434fca63bee73af551cb10770d6508a2eb
[]
no_license
FoxdieTeam/mgs_reversing
de0b501e9a6318bf817e0d0f03af34c836a2f0b6
d057e3eb8bebeb645ca23db6ce690577268f59d5
refs/heads/master
2023-07-21T02:31:57.827478
2023-07-17T10:50:39
2023-07-17T10:50:39
223,033,157
270
35
null
2023-09-14T21:49:31
2019-11-20T21:44:13
C
UTF-8
C
false
false
881
c
GM_SeSet_80032858.c
#include "game.h" #include "unknown.h" // play sound effect at pos by id void GM_SeSet_80032858(SVECTOR *pos, unsigned int sound_id) { DVECTOR point; if (pos) { if (sound_id == 41) { if (sub_80032748(&point, pos) < 0) { return; } } else if (sound_id - 160 < 8) { if (sub_800327BC(&point, pos) < 0) { return; } } else if (sound_id == 29) { if (sub_80032820(&point, pos) < 0) { return; } } else { if (sub_800326D4(&point, pos) < 0) { return; } } } else { point.vy = 63; point.vx = 0; } GM_Sound(point.vx, point.vy, sound_id); }
a1a501c1ffc4dc390b450fcbda5887b20c079ca9
0744dcc5394cebf57ebcba343747af6871b67017
/external/wpa_supplicant/src/eap_common/eap_sake_common.c
71c07460bdeaeb357bcab445c056ddcf464be778
[ "BSD-3-Clause", "Apache-2.0", "MIT" ]
permissive
Samsung/TizenRT
96abf62f1853f61fcf91ff14671a5e0c6ca48fdb
1a5c2e00a4b1bbf4c505bbf5cc6a8259e926f686
refs/heads/master
2023-08-31T08:59:33.327998
2023-08-08T06:09:20
2023-08-31T04:38:20
82,517,252
590
719
Apache-2.0
2023-09-14T06:54:49
2017-02-20T04:38:30
C
UTF-8
C
false
false
10,374
c
eap_sake_common.c
/* * EAP server/peer: EAP-SAKE shared routines * Copyright (c) 2006-2007, Jouni Malinen <j@w1.fi> * * This software may be distributed under the terms of the BSD license. * See README for more details. */ #include "includes.h" #include "common.h" #include "wpabuf.h" #include "crypto/sha1.h" #include "eap_defs.h" #include "eap_sake_common.h" static int eap_sake_parse_add_attr(struct eap_sake_parse_attr *attr, u8 attr_id, u8 len, const u8 *data) { size_t i; switch (attr_id) { case EAP_SAKE_AT_RAND_S: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_RAND_S"); if (len != EAP_SAKE_RAND_LEN) { wpa_printf(MSG_DEBUG, "EAP-SAKE: AT_RAND_S with " "invalid payload length %d", len); return -1; } attr->rand_s = data; break; case EAP_SAKE_AT_RAND_P: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_RAND_P"); if (len != EAP_SAKE_RAND_LEN) { wpa_printf(MSG_DEBUG, "EAP-SAKE: AT_RAND_P with " "invalid payload length %d", len); return -1; } attr->rand_p = data; break; case EAP_SAKE_AT_MIC_S: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_MIC_S"); if (len != EAP_SAKE_MIC_LEN) { wpa_printf(MSG_DEBUG, "EAP-SAKE: AT_MIC_S with " "invalid payload length %d", len); return -1; } attr->mic_s = data; break; case EAP_SAKE_AT_MIC_P: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_MIC_P"); if (len != EAP_SAKE_MIC_LEN) { wpa_printf(MSG_DEBUG, "EAP-SAKE: AT_MIC_P with " "invalid payload length %d", len); return -1; } attr->mic_p = data; break; case EAP_SAKE_AT_SERVERID: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_SERVERID"); attr->serverid = data; attr->serverid_len = len; break; case EAP_SAKE_AT_PEERID: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_PEERID"); attr->peerid = data; attr->peerid_len = len; break; case EAP_SAKE_AT_SPI_S: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_SPI_S"); attr->spi_s = data; attr->spi_s_len = len; break; case EAP_SAKE_AT_SPI_P: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_SPI_P"); attr->spi_p = data; attr->spi_p_len = len; break; case EAP_SAKE_AT_ANY_ID_REQ: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_ANY_ID_REQ"); if (len != 2) { wpa_printf(MSG_DEBUG, "EAP-SAKE: Invalid AT_ANY_ID_REQ" " payload length %d", len); return -1; } attr->any_id_req = data; break; case EAP_SAKE_AT_PERM_ID_REQ: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_PERM_ID_REQ"); if (len != 2) { wpa_printf(MSG_DEBUG, "EAP-SAKE: Invalid " "AT_PERM_ID_REQ payload length %d", len); return -1; } attr->perm_id_req = data; break; case EAP_SAKE_AT_ENCR_DATA: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_ENCR_DATA"); attr->encr_data = data; attr->encr_data_len = len; break; case EAP_SAKE_AT_IV: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_IV"); attr->iv = data; attr->iv_len = len; break; case EAP_SAKE_AT_PADDING: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_PADDING"); for (i = 0; i < len; i++) { if (data[i]) { wpa_printf(MSG_DEBUG, "EAP-SAKE: AT_PADDING " "with non-zero pad byte"); return -1; } } break; case EAP_SAKE_AT_NEXT_TMPID: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_NEXT_TMPID"); attr->next_tmpid = data; attr->next_tmpid_len = len; break; case EAP_SAKE_AT_MSK_LIFE: wpa_printf(MSG_DEBUG, "EAP-SAKE: Parse: AT_IV"); if (len != 4) { wpa_printf(MSG_DEBUG, "EAP-SAKE: Invalid " "AT_MSK_LIFE payload length %d", len); return -1; } attr->msk_life = data; break; default: if (attr_id < 128) { wpa_printf(MSG_DEBUG, "EAP-SAKE: Unknown non-skippable" " attribute %d", attr_id); return -1; } wpa_printf(MSG_DEBUG, "EAP-SAKE: Ignoring unknown skippable " "attribute %d", attr_id); break; } if (attr->iv && !attr->encr_data) { wpa_printf(MSG_DEBUG, "EAP-SAKE: AT_IV included without " "AT_ENCR_DATA"); return -1; } return 0; } /** * eap_sake_parse_attributes - Parse EAP-SAKE attributes * @buf: Packet payload (starting with the first attribute) * @len: Payload length * @attr: Structure to be filled with found attributes * Returns: 0 on success or -1 on failure */ int eap_sake_parse_attributes(const u8 *buf, size_t len, struct eap_sake_parse_attr *attr) { const u8 *pos = buf, *end = buf + len; os_memset(attr, 0, sizeof(*attr)); while (pos < end) { if (end - pos < 2) { wpa_printf(MSG_DEBUG, "EAP-SAKE: Too short attribute"); return -1; } if (pos[1] < 2) { wpa_printf(MSG_DEBUG, "EAP-SAKE: Invalid attribute " "length (%d)", pos[1]); return -1; } if (pos + pos[1] > end) { wpa_printf(MSG_DEBUG, "EAP-SAKE: Attribute underflow"); return -1; } if (eap_sake_parse_add_attr(attr, pos[0], pos[1] - 2, pos + 2)) { return -1; } pos += pos[1]; } return 0; } /** * eap_sake_kdf - EAP-SAKE Key Derivation Function (KDF) * @key: Key for KDF * @key_len: Length of the key in bytes * @label: A unique label for each purpose of the KDF * @data: Extra data (start) to bind into the key * @data_len: Length of the data * @data2: Extra data (end) to bind into the key * @data2_len: Length of the data2 * @buf: Buffer for the generated pseudo-random key * @buf_len: Number of bytes of key to generate * * This function is used to derive new, cryptographically separate keys from a * given key (e.g., SMS). This is identical to the PRF used in IEEE 802.11i. */ static void eap_sake_kdf(const u8 *key, size_t key_len, const char *label, const u8 *data, size_t data_len, const u8 *data2, size_t data2_len, u8 *buf, size_t buf_len) { u8 counter = 0; size_t pos, plen; u8 hash[SHA1_MAC_LEN]; size_t label_len = os_strlen(label) + 1; const unsigned char *addr[4]; size_t len[4]; addr[0] = (u8 *)label; /* Label | Y */ len[0] = label_len; addr[1] = data; /* Msg[start] */ len[1] = data_len; addr[2] = data2; /* Msg[end] */ len[2] = data2_len; addr[3] = &counter; /* Length */ len[3] = 1; pos = 0; while (pos < buf_len) { plen = buf_len - pos; if (plen >= SHA1_MAC_LEN) { hmac_sha1_vector(key, key_len, 4, addr, len, &buf[pos]); pos += SHA1_MAC_LEN; } else { hmac_sha1_vector(key, key_len, 4, addr, len, hash); os_memcpy(&buf[pos], hash, plen); break; } counter++; } } /** * eap_sake_derive_keys - Derive EAP-SAKE keys * @root_secret_a: 16-byte Root-Secret-A * @root_secret_b: 16-byte Root-Secret-B * @rand_s: 16-byte RAND_S * @rand_p: 16-byte RAND_P * @tek: Buffer for Temporary EAK Keys (TEK-Auth[16] | TEK-Cipher[16]) * @msk: Buffer for 64-byte MSK * @emsk: Buffer for 64-byte EMSK * * This function derives EAP-SAKE keys as defined in RFC 4763, section 3.2.6. */ void eap_sake_derive_keys(const u8 *root_secret_a, const u8 *root_secret_b, const u8 *rand_s, const u8 *rand_p, u8 *tek, u8 *msk, u8 *emsk) { u8 sms_a[EAP_SAKE_SMS_LEN]; u8 sms_b[EAP_SAKE_SMS_LEN]; u8 key_buf[EAP_MSK_LEN + EAP_EMSK_LEN]; wpa_printf(MSG_DEBUG, "EAP-SAKE: Deriving keys"); wpa_hexdump_key(MSG_DEBUG, "EAP-SAKE: Root-Secret-A", root_secret_a, EAP_SAKE_ROOT_SECRET_LEN); eap_sake_kdf(root_secret_a, EAP_SAKE_ROOT_SECRET_LEN, "SAKE Master Secret A", rand_p, EAP_SAKE_RAND_LEN, rand_s, EAP_SAKE_RAND_LEN, sms_a, EAP_SAKE_SMS_LEN); wpa_hexdump_key(MSG_DEBUG, "EAP-SAKE: SMS-A", sms_a, EAP_SAKE_SMS_LEN); eap_sake_kdf(sms_a, EAP_SAKE_SMS_LEN, "Transient EAP Key", rand_s, EAP_SAKE_RAND_LEN, rand_p, EAP_SAKE_RAND_LEN, tek, EAP_SAKE_TEK_LEN); wpa_hexdump_key(MSG_DEBUG, "EAP-SAKE: TEK-Auth", tek, EAP_SAKE_TEK_AUTH_LEN); wpa_hexdump_key(MSG_DEBUG, "EAP-SAKE: TEK-Cipher", tek + EAP_SAKE_TEK_AUTH_LEN, EAP_SAKE_TEK_CIPHER_LEN); wpa_hexdump_key(MSG_DEBUG, "EAP-SAKE: Root-Secret-B", root_secret_b, EAP_SAKE_ROOT_SECRET_LEN); eap_sake_kdf(root_secret_b, EAP_SAKE_ROOT_SECRET_LEN, "SAKE Master Secret B", rand_p, EAP_SAKE_RAND_LEN, rand_s, EAP_SAKE_RAND_LEN, sms_b, EAP_SAKE_SMS_LEN); wpa_hexdump_key(MSG_DEBUG, "EAP-SAKE: SMS-B", sms_b, EAP_SAKE_SMS_LEN); eap_sake_kdf(sms_b, EAP_SAKE_SMS_LEN, "Master Session Key", rand_s, EAP_SAKE_RAND_LEN, rand_p, EAP_SAKE_RAND_LEN, key_buf, sizeof(key_buf)); os_memcpy(msk, key_buf, EAP_MSK_LEN); os_memcpy(emsk, key_buf + EAP_MSK_LEN, EAP_EMSK_LEN); wpa_hexdump_key(MSG_DEBUG, "EAP-SAKE: MSK", msk, EAP_MSK_LEN); wpa_hexdump_key(MSG_DEBUG, "EAP-SAKE: EMSK", emsk, EAP_EMSK_LEN); } /** * eap_sake_compute_mic - Compute EAP-SAKE MIC for an EAP packet * @tek_auth: 16-byte TEK-Auth * @rand_s: 16-byte RAND_S * @rand_p: 16-byte RAND_P * @serverid: SERVERID * @serverid_len: SERVERID length * @peerid: PEERID * @peerid_len: PEERID length * @peer: MIC calculation for 0 = Server, 1 = Peer message * @eap: EAP packet * @eap_len: EAP packet length * @mic_pos: MIC position in the EAP packet (must be [eap .. eap + eap_len]) * @mic: Buffer for the computed 16-byte MIC */ int eap_sake_compute_mic(const u8 *tek_auth, const u8 *rand_s, const u8 *rand_p, const u8 *serverid, size_t serverid_len, const u8 *peerid, size_t peerid_len, int peer, const u8 *eap, size_t eap_len, const u8 *mic_pos, u8 *mic) { u8 _rand[2 * EAP_SAKE_RAND_LEN]; u8 *tmp, *pos; size_t tmplen; tmplen = serverid_len + 1 + peerid_len + 1 + eap_len; tmp = os_malloc(tmplen); if (tmp == NULL) { return -1; } pos = tmp; if (peer) { if (peerid) { os_memcpy(pos, peerid, peerid_len); pos += peerid_len; } *pos++ = 0x00; if (serverid) { os_memcpy(pos, serverid, serverid_len); pos += serverid_len; } *pos++ = 0x00; os_memcpy(_rand, rand_s, EAP_SAKE_RAND_LEN); os_memcpy(_rand + EAP_SAKE_RAND_LEN, rand_p, EAP_SAKE_RAND_LEN); } else { if (serverid) { os_memcpy(pos, serverid, serverid_len); pos += serverid_len; } *pos++ = 0x00; if (peerid) { os_memcpy(pos, peerid, peerid_len); pos += peerid_len; } *pos++ = 0x00; os_memcpy(_rand, rand_p, EAP_SAKE_RAND_LEN); os_memcpy(_rand + EAP_SAKE_RAND_LEN, rand_s, EAP_SAKE_RAND_LEN); } os_memcpy(pos, eap, eap_len); os_memset(pos + (mic_pos - eap), 0, EAP_SAKE_MIC_LEN); eap_sake_kdf(tek_auth, EAP_SAKE_TEK_AUTH_LEN, peer ? "Peer MIC" : "Server MIC", _rand, 2 * EAP_SAKE_RAND_LEN, tmp, tmplen, mic, EAP_SAKE_MIC_LEN); os_free(tmp); return 0; } void eap_sake_add_attr(struct wpabuf *buf, u8 type, const u8 *data, size_t len) { wpabuf_put_u8(buf, type); wpabuf_put_u8(buf, 2 + len); /* Length; including attr header */ if (data) { wpabuf_put_data(buf, data, len); } else { os_memset(wpabuf_put(buf, len), 0, len); } }
0172b5c64c666ce883a77cec5437636dd9776598
b8969d48bbb69227db21f8446a3be4955363b694
/ntvdmpatch/src/pifprop/priv.h
dc968749f94f520394da89620406fe2fde6df430
[]
no_license
leecher1337/ntvdmx64
dc0e6428e531b661836dd9543016016d98bf7b24
0f7f33e295024b81681d506cc86b8606960ef713
refs/heads/master
2023-07-26T13:52:27.549799
2023-07-09T14:33:29
2023-07-09T14:33:29
60,649,860
696
91
null
2020-08-23T19:41:36
2016-06-07T22:09:12
C
UTF-8
C
false
false
45
h
priv.h
#include <windows.h> #include "uastrfnc.h"
a2ed339e0164c356d7a3cc822d2b0bf695f211cd
4ffa1c9e0e6ba8b74793e77f7eca4f4dcb4fa44d
/sokol_args.h
4d37907c5005299dad37e0768ffbff4e42cadd4d
[ "LicenseRef-scancode-proprietary-license", "Zlib" ]
permissive
floooh/sokol
dda4d23a6c3b65fc0031953995a972784357cf7d
f418b98a8c8e0286fadd65c804a2edfa54e935e6
refs/heads/master
2023-09-04T20:30:12.217800
2023-08-28T12:01:56
2023-08-28T12:01:56
97,212,490
5,373
525
Zlib
2023-09-14T13:32:08
2017-07-14T08:38:25
C
UTF-8
C
false
false
25,646
h
sokol_args.h
#if defined(SOKOL_IMPL) && !defined(SOKOL_ARGS_IMPL) #define SOKOL_ARGS_IMPL #endif #ifndef SOKOL_ARGS_INCLUDED /* sokol_args.h -- cross-platform key/value arg-parsing for web and native Project URL: https://github.com/floooh/sokol Do this: #define SOKOL_IMPL or #define SOKOL_ARGS_IMPL before you include this file in *one* C or C++ file to create the implementation. Optionally provide the following defines with your own implementations: SOKOL_ASSERT(c) - your own assert macro (default: assert(c)) SOKOL_ARGS_API_DECL - public function declaration prefix (default: extern) SOKOL_API_DECL - same as SOKOL_ARGS_API_DECL SOKOL_API_IMPL - public function implementation prefix (default: -) If sokol_args.h is compiled as a DLL, define the following before including the declaration or implementation: SOKOL_DLL On Windows, SOKOL_DLL will define SOKOL_ARGS_API_DECL as __declspec(dllexport) or __declspec(dllimport) as needed. OVERVIEW ======== sokol_args.h provides a simple unified argument parsing API for WebAssembly and native apps. When running as WebAssembly app, arguments are taken from the page URL: https://floooh.github.io/tiny8bit/kc85.html?type=kc85_3&mod=m022&snapshot=kc85/jungle.kcc The same arguments provided to a command line app: kc85 type=kc85_3 mod=m022 snapshot=kc85/jungle.kcc ARGUMENT FORMATTING =================== On the web platform, arguments must be formatted as a valid URL query string with 'percent encoding' used for special characters. Strings are expected to be UTF-8 encoded (although sokol_args.h doesn't contain any special UTF-8 handling). See below on how to obtain UTF-8 encoded argc/argv values on Windows when using WinMain() as entry point. On native platforms the following rules must be followed: Arguments have the general form key=value Key/value pairs are separated by 'whitespace', valid whitespace characters are space and tab. Whitespace characters in front and after the separating '=' character are ignored: key = value ...is the same as key=value The 'key' string must be a simple string without escape sequences or whitespace. Currently 'single keys' without values are not allowed, but may be in the future. The 'value' string can be quoted, and quoted value strings can contain whitespace: key = 'single-quoted value' key = "double-quoted value" Single-quoted value strings can contain double quotes, and vice-versa: key = 'single-quoted value "can contain double-quotes"' key = "double-quoted value 'can contain single-quotes'" Note that correct quoting can be tricky on some shells, since command shells may remove quotes, unless they're escaped. Value strings can contain a small selection of escape sequences: \n - newline \r - carriage return \t - tab \\ - escaped backslash (more escape codes may be added in the future). CODE EXAMPLE ============ int main(int argc, char* argv[]) { // initialize sokol_args with default parameters sargs_setup(&(sargs_desc){ .argc = argc, .argv = argv }); // check if a key exists... if (sargs_exists("bla")) { ... } // get value string for key, if not found, return empty string "" const char* val0 = sargs_value("bla"); // get value string for key, or default string if key not found const char* val1 = sargs_value_def("bla", "default_value"); // check if a key matches expected value if (sargs_equals("type", "kc85_4")) { ... } // check if a key's value is "true", "yes" or "on" if (sargs_boolean("joystick_enabled")) { ... } // iterate over keys and values for (int i = 0; i < sargs_num_args(); i++) { printf("key: %s, value: %s\n", sargs_key_at(i), sargs_value_at(i)); } // lookup argument index by key string, will return -1 if key // is not found, sargs_key_at() and sargs_value_at() will return // an empty string for invalid indices int index = sargs_find("bla"); printf("key: %s, value: %s\n", sargs_key_at(index), sargs_value_at(index)); // shutdown sokol-args sargs_shutdown(); } WINMAIN AND ARGC / ARGV ======================= On Windows with WinMain() based apps, getting UTF8-encoded command line arguments is a bit more complicated: First call GetCommandLineW(), this returns the entire command line as UTF-16 string. Then call CommandLineToArgvW(), this parses the command line string into the usual argc/argv format (but in UTF-16). Finally convert the UTF-16 strings in argv[] into UTF-8 via WideCharToMultiByte(). See the function _sapp_win32_command_line_to_utf8_argv() in sokol_app.h for example code how to do this (if you're using sokol_app.h, it will already convert the command line arguments to UTF-8 for you of course, so you can plug them directly into sokol_app.h). API DOCUMENTATION ================= void sargs_setup(const sargs_desc* desc) Initialize sokol_args, desc contains the following configuration parameters: int argc - the main function's argc parameter char** argv - the main function's argv parameter int max_args - max number of key/value pairs, default is 16 int buf_size - size of the internal string buffer, default is 16384 Note that on the web, argc and argv will be ignored and the arguments will be taken from the page URL instead. sargs_setup() will allocate 2 memory chunks: one for keeping track of the key/value args of size 'max_args*8', and a string buffer of size 'buf_size'. void sargs_shutdown(void) Shutdown sokol-args and free any allocated memory. bool sargs_isvalid(void) Return true between sargs_setup() and sargs_shutdown() bool sargs_exists(const char* key) Test if a key arg exists. const char* sargs_value(const char* key) Return value associated with key. Returns an empty string ("") if the key doesn't exist. const char* sargs_value_def(const char* key, const char* default) Return value associated with key, or the provided default value if the value doesn't exist. bool sargs_equals(const char* key, const char* val); Return true if the value associated with key matches the 'val' argument. bool sargs_boolean(const char* key) Return true if the value string of 'key' is one of 'true', 'yes', 'on'. int sargs_find(const char* key) Find argument by key name and return its index, or -1 if not found. int sargs_num_args(void) Return number of key/value pairs. const char* sargs_key_at(int index) Return the key name of argument at index. Returns empty string if is index is outside range. const char* sargs_value_at(int index) Return the value of argument at index. Returns empty string if index is outside range. MEMORY ALLOCATION OVERRIDE ========================== You can override the memory allocation functions at initialization time like this: void* my_alloc(size_t size, void* user_data) { return malloc(size); } void my_free(void* ptr, void* user_data) { free(ptr); } ... sargs_setup(&(sargs_desc){ // ... .allocator = { .alloc = my_alloc, .free = my_free, .user_data = ..., } }); ... If no overrides are provided, malloc and free will be used. This only affects memory allocation calls done by sokol_args.h itself though, not any allocations in OS libraries. TODO ==== - parsing errors? LICENSE ======= zlib/libpng license Copyright (c) 2018 Andre Weissflog 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. */ #define SOKOL_ARGS_INCLUDED (1) #include <stdint.h> #include <stdbool.h> #include <stddef.h> // size_t #if defined(SOKOL_API_DECL) && !defined(SOKOL_ARGS_API_DECL) #define SOKOL_ARGS_API_DECL SOKOL_API_DECL #endif #ifndef SOKOL_ARGS_API_DECL #if defined(_WIN32) && defined(SOKOL_DLL) && defined(SOKOL_ARGS_IMPL) #define SOKOL_ARGS_API_DECL __declspec(dllexport) #elif defined(_WIN32) && defined(SOKOL_DLL) #define SOKOL_ARGS_API_DECL __declspec(dllimport) #else #define SOKOL_ARGS_API_DECL extern #endif #endif #ifdef __cplusplus extern "C" { #endif /* sargs_allocator Used in sargs_desc to provide custom memory-alloc and -free functions to sokol_args.h. If memory management should be overridden, both the alloc and free function must be provided (e.g. it's not valid to override one function but not the other). */ typedef struct sargs_allocator { void* (*alloc)(size_t size, void* user_data); void (*free)(void* ptr, void* user_data); void* user_data; } sargs_allocator; typedef struct sargs_desc { int argc; char** argv; int max_args; int buf_size; sargs_allocator allocator; } sargs_desc; /* setup sokol-args */ SOKOL_ARGS_API_DECL void sargs_setup(const sargs_desc* desc); /* shutdown sokol-args */ SOKOL_ARGS_API_DECL void sargs_shutdown(void); /* true between sargs_setup() and sargs_shutdown() */ SOKOL_ARGS_API_DECL bool sargs_isvalid(void); /* test if an argument exists by key name */ SOKOL_ARGS_API_DECL bool sargs_exists(const char* key); /* get value by key name, return empty string if key doesn't exist */ SOKOL_ARGS_API_DECL const char* sargs_value(const char* key); /* get value by key name, return provided default if key doesn't exist */ SOKOL_ARGS_API_DECL const char* sargs_value_def(const char* key, const char* def); /* return true if val arg matches the value associated with key */ SOKOL_ARGS_API_DECL bool sargs_equals(const char* key, const char* val); /* return true if key's value is "true", "yes" or "on" */ SOKOL_ARGS_API_DECL bool sargs_boolean(const char* key); /* get index of arg by key name, return -1 if not exists */ SOKOL_ARGS_API_DECL int sargs_find(const char* key); /* get number of parsed arguments */ SOKOL_ARGS_API_DECL int sargs_num_args(void); /* get key name of argument at index, or empty string */ SOKOL_ARGS_API_DECL const char* sargs_key_at(int index); /* get value string of argument at index, or empty string */ SOKOL_ARGS_API_DECL const char* sargs_value_at(int index); #ifdef __cplusplus } /* extern "C" */ /* reference-based equivalents for c++ */ inline void sargs_setup(const sargs_desc& desc) { return sargs_setup(&desc); } #endif #endif // SOKOL_ARGS_INCLUDED /*--- IMPLEMENTATION ---------------------------------------------------------*/ #ifdef SOKOL_ARGS_IMPL #define SOKOL_ARGS_IMPL_INCLUDED (1) #if defined(SOKOL_MALLOC) || defined(SOKOL_CALLOC) || defined(SOKOL_FREE) #error "SOKOL_MALLOC/CALLOC/FREE macros are no longer supported, please use sargs_desc.allocator to override memory allocation functions" #endif #include <string.h> // memset, strcmp #include <stdlib.h> // malloc, free #if defined(__EMSCRIPTEN__) #include <emscripten/emscripten.h> #endif #ifndef SOKOL_API_IMPL #define SOKOL_API_IMPL #endif #ifndef SOKOL_DEBUG #ifndef NDEBUG #define SOKOL_DEBUG #endif #endif #ifndef SOKOL_ASSERT #include <assert.h> #define SOKOL_ASSERT(c) assert(c) #endif #ifndef _SOKOL_PRIVATE #if defined(__GNUC__) || defined(__clang__) #define _SOKOL_PRIVATE __attribute__((unused)) static #else #define _SOKOL_PRIVATE static #endif #endif #define _sargs_def(val, def) (((val) == 0) ? (def) : (val)) #define _SARGS_MAX_ARGS_DEF (16) #define _SARGS_BUF_SIZE_DEF (16*1024) /* parser state */ #define _SARGS_EXPECT_KEY (1<<0) #define _SARGS_EXPECT_SEP (1<<1) #define _SARGS_EXPECT_VAL (1<<2) #define _SARGS_PARSING_KEY (1<<3) #define _SARGS_PARSING_VAL (1<<4) #define _SARGS_ERROR (1<<5) /* a key/value pair struct */ typedef struct { int key; /* index to start of key string in buf */ int val; /* index to start of value string in buf */ } _sargs_kvp_t; /* sokol-args state */ typedef struct { int max_args; /* number of key/value pairs in args array */ int num_args; /* number of valid items in args array */ _sargs_kvp_t* args; /* key/value pair array */ int buf_size; /* size of buffer in bytes */ int buf_pos; /* current buffer position */ char* buf; /* character buffer, first char is reserved and zero for 'empty string' */ bool valid; uint32_t parse_state; char quote; /* current quote char, 0 if not in a quote */ bool in_escape; /* currently in an escape sequence */ sargs_allocator allocator; } _sargs_state_t; static _sargs_state_t _sargs; /*== PRIVATE IMPLEMENTATION FUNCTIONS ========================================*/ _SOKOL_PRIVATE void _sargs_clear(void* ptr, size_t size) { SOKOL_ASSERT(ptr && (size > 0)); memset(ptr, 0, size); } _SOKOL_PRIVATE void* _sargs_malloc(size_t size) { SOKOL_ASSERT(size > 0); void* ptr; if (_sargs.allocator.alloc) { ptr = _sargs.allocator.alloc(size, _sargs.allocator.user_data); } else { ptr = malloc(size); } SOKOL_ASSERT(ptr); return ptr; } _SOKOL_PRIVATE void* _sargs_malloc_clear(size_t size) { void* ptr = _sargs_malloc(size); _sargs_clear(ptr, size); return ptr; } _SOKOL_PRIVATE void _sargs_free(void* ptr) { if (_sargs.allocator.free) { _sargs.allocator.free(ptr, _sargs.allocator.user_data); } else { free(ptr); } } _SOKOL_PRIVATE void _sargs_putc(char c) { if ((_sargs.buf_pos+2) < _sargs.buf_size) { _sargs.buf[_sargs.buf_pos++] = c; } } _SOKOL_PRIVATE const char* _sargs_str(int index) { SOKOL_ASSERT((index >= 0) && (index < _sargs.buf_size)); return &_sargs.buf[index]; } /*-- argument parser functions ------------------*/ _SOKOL_PRIVATE void _sargs_expect_key(void) { _sargs.parse_state = _SARGS_EXPECT_KEY; } _SOKOL_PRIVATE bool _sargs_key_expected(void) { return 0 != (_sargs.parse_state & _SARGS_EXPECT_KEY); } _SOKOL_PRIVATE void _sargs_expect_val(void) { _sargs.parse_state = _SARGS_EXPECT_VAL; } _SOKOL_PRIVATE bool _sargs_val_expected(void) { return 0 != (_sargs.parse_state & _SARGS_EXPECT_VAL); } _SOKOL_PRIVATE void _sargs_expect_sep(void) { _sargs.parse_state = _SARGS_EXPECT_SEP; } _SOKOL_PRIVATE bool _sargs_any_expected(void) { return 0 != (_sargs.parse_state & (_SARGS_EXPECT_KEY | _SARGS_EXPECT_VAL | _SARGS_EXPECT_SEP)); } _SOKOL_PRIVATE bool _sargs_is_separator(char c) { return c == '='; } _SOKOL_PRIVATE bool _sargs_is_quote(char c) { if (0 == _sargs.quote) { return (c == '\'') || (c == '"'); } else { return c == _sargs.quote; } } _SOKOL_PRIVATE void _sargs_begin_quote(char c) { _sargs.quote = c; } _SOKOL_PRIVATE void _sargs_end_quote(void) { _sargs.quote = 0; } _SOKOL_PRIVATE bool _sargs_in_quotes(void) { return 0 != _sargs.quote; } _SOKOL_PRIVATE bool _sargs_is_whitespace(char c) { return !_sargs_in_quotes() && ((c == ' ') || (c == '\t')); } _SOKOL_PRIVATE void _sargs_start_key(void) { SOKOL_ASSERT(_sargs.num_args < _sargs.max_args); _sargs.parse_state = _SARGS_PARSING_KEY; _sargs.args[_sargs.num_args].key = _sargs.buf_pos; } _SOKOL_PRIVATE void _sargs_end_key(void) { SOKOL_ASSERT(_sargs.num_args < _sargs.max_args); _sargs_putc(0); _sargs.parse_state = 0; } _SOKOL_PRIVATE bool _sargs_parsing_key(void) { return 0 != (_sargs.parse_state & _SARGS_PARSING_KEY); } _SOKOL_PRIVATE void _sargs_start_val(void) { SOKOL_ASSERT(_sargs.num_args < _sargs.max_args); _sargs.parse_state = _SARGS_PARSING_VAL; _sargs.args[_sargs.num_args].val = _sargs.buf_pos; } _SOKOL_PRIVATE void _sargs_end_val(void) { SOKOL_ASSERT(_sargs.num_args < _sargs.max_args); _sargs_putc(0); _sargs.num_args++; _sargs.parse_state = 0; } _SOKOL_PRIVATE bool _sargs_is_escape(char c) { return '\\' == c; } _SOKOL_PRIVATE void _sargs_start_escape(void) { _sargs.in_escape = true; } _SOKOL_PRIVATE bool _sargs_in_escape(void) { return _sargs.in_escape; } _SOKOL_PRIVATE char _sargs_escape(char c) { switch (c) { case 'n': return '\n'; case 't': return '\t'; case 'r': return '\r'; case '\\': return '\\'; default: return c; } } _SOKOL_PRIVATE void _sargs_end_escape(void) { _sargs.in_escape = false; } _SOKOL_PRIVATE bool _sargs_parsing_val(void) { return 0 != (_sargs.parse_state & _SARGS_PARSING_VAL); } _SOKOL_PRIVATE bool _sargs_parse_carg(const char* src) { char c; while (0 != (c = *src++)) { if (_sargs_in_escape()) { c = _sargs_escape(c); _sargs_end_escape(); } else if (_sargs_is_escape(c)) { _sargs_start_escape(); continue; } if (_sargs_any_expected()) { if (!_sargs_is_whitespace(c)) { /* start of key, value or separator */ if (_sargs_key_expected()) { /* start of new key */ _sargs_start_key(); } else if (_sargs_val_expected()) { /* start of value */ if (_sargs_is_quote(c)) { _sargs_begin_quote(c); continue; } _sargs_start_val(); } else { /* separator */ if (_sargs_is_separator(c)) { _sargs_expect_val(); continue; } } } else { /* skip white space */ continue; } } else if (_sargs_parsing_key()) { if (_sargs_is_whitespace(c) || _sargs_is_separator(c)) { /* end of key string */ _sargs_end_key(); if (_sargs_is_separator(c)) { _sargs_expect_val(); } else { _sargs_expect_sep(); } continue; } } else if (_sargs_parsing_val()) { if (_sargs_in_quotes()) { /* when in quotes, whitespace is a normal character and a matching quote ends the value string */ if (_sargs_is_quote(c)) { _sargs_end_quote(); _sargs_end_val(); _sargs_expect_key(); continue; } } else if (_sargs_is_whitespace(c)) { /* end of value string (no quotes) */ _sargs_end_val(); _sargs_expect_key(); continue; } } _sargs_putc(c); } if (_sargs_parsing_key()) { _sargs_end_key(); _sargs_expect_sep(); } else if (_sargs_parsing_val() && !_sargs_in_quotes()) { _sargs_end_val(); _sargs_expect_key(); } return true; } _SOKOL_PRIVATE bool _sargs_parse_cargs(int argc, const char** argv) { _sargs_expect_key(); bool retval = true; for (int i = 1; i < argc; i++) { retval &= _sargs_parse_carg(argv[i]); } _sargs.parse_state = 0; return retval; } /*-- EMSCRIPTEN IMPLEMENTATION -----------------------------------------------*/ #if defined(__EMSCRIPTEN__) #ifdef __cplusplus extern "C" { #endif #if defined(EM_JS_DEPS) EM_JS_DEPS(sokol_audio, "$withStackSave,$allocateUTF8OnStack"); #endif EMSCRIPTEN_KEEPALIVE void _sargs_add_kvp(const char* key, const char* val) { SOKOL_ASSERT(_sargs.valid && key && val); if (_sargs.num_args >= _sargs.max_args) { return; } /* copy key string */ char c; _sargs.args[_sargs.num_args].key = _sargs.buf_pos; const char* ptr = key; while (0 != (c = *ptr++)) { _sargs_putc(c); } _sargs_putc(0); /* copy value string */ _sargs.args[_sargs.num_args].val = _sargs.buf_pos; ptr = val; while (0 != (c = *ptr++)) { _sargs_putc(c); } _sargs_putc(0); _sargs.num_args++; } #ifdef __cplusplus } /* extern "C" */ #endif /* JS function to extract arguments from the page URL */ EM_JS(void, sargs_js_parse_url, (void), { const params = new URLSearchParams(window.location.search).entries(); for (let p = params.next(); !p.done; p = params.next()) { const key = p.value[0]; const val = p.value[1]; withStackSave(() => { const key_cstr = allocateUTF8OnStack(key); const val_cstr = allocateUTF8OnStack(val); __sargs_add_kvp(key_cstr, val_cstr) }); } }); #endif /* EMSCRIPTEN */ /*== PUBLIC IMPLEMENTATION FUNCTIONS =========================================*/ SOKOL_API_IMPL void sargs_setup(const sargs_desc* desc) { SOKOL_ASSERT(desc); _sargs_clear(&_sargs, sizeof(_sargs)); _sargs.max_args = _sargs_def(desc->max_args, _SARGS_MAX_ARGS_DEF); _sargs.buf_size = _sargs_def(desc->buf_size, _SARGS_BUF_SIZE_DEF); SOKOL_ASSERT(_sargs.buf_size > 8); _sargs.args = (_sargs_kvp_t*) _sargs_malloc_clear((size_t)_sargs.max_args * sizeof(_sargs_kvp_t)); _sargs.buf = (char*) _sargs_malloc_clear((size_t)_sargs.buf_size * sizeof(char)); /* the first character in buf is reserved and always zero, this is the 'empty string' */ _sargs.buf_pos = 1; _sargs.allocator = desc->allocator; _sargs.valid = true; /* parse argc/argv */ _sargs_parse_cargs(desc->argc, (const char**) desc->argv); #if defined(__EMSCRIPTEN__) /* on emscripten, also parse the page URL*/ sargs_js_parse_url(); #endif } SOKOL_API_IMPL void sargs_shutdown(void) { SOKOL_ASSERT(_sargs.valid); if (_sargs.args) { _sargs_free(_sargs.args); _sargs.args = 0; } if (_sargs.buf) { _sargs_free(_sargs.buf); _sargs.buf = 0; } _sargs.valid = false; } SOKOL_API_IMPL bool sargs_isvalid(void) { return _sargs.valid; } SOKOL_API_IMPL int sargs_find(const char* key) { SOKOL_ASSERT(_sargs.valid && key); for (int i = 0; i < _sargs.num_args; i++) { if (0 == strcmp(_sargs_str(_sargs.args[i].key), key)) { return i; } } return -1; } SOKOL_API_IMPL int sargs_num_args(void) { SOKOL_ASSERT(_sargs.valid); return _sargs.num_args; } SOKOL_API_IMPL const char* sargs_key_at(int index) { SOKOL_ASSERT(_sargs.valid); if ((index >= 0) && (index < _sargs.num_args)) { return _sargs_str(_sargs.args[index].key); } else { /* index 0 is always the empty string */ return _sargs_str(0); } } SOKOL_API_IMPL const char* sargs_value_at(int index) { SOKOL_ASSERT(_sargs.valid); if ((index >= 0) && (index < _sargs.num_args)) { return _sargs_str(_sargs.args[index].val); } else { /* index 0 is always the empty string */ return _sargs_str(0); } } SOKOL_API_IMPL bool sargs_exists(const char* key) { SOKOL_ASSERT(_sargs.valid && key); return -1 != sargs_find(key); } SOKOL_API_IMPL const char* sargs_value(const char* key) { SOKOL_ASSERT(_sargs.valid && key); return sargs_value_at(sargs_find(key)); } SOKOL_API_IMPL const char* sargs_value_def(const char* key, const char* def) { SOKOL_ASSERT(_sargs.valid && key && def); int arg_index = sargs_find(key); if (-1 != arg_index) { return sargs_value_at(arg_index); } else { return def; } } SOKOL_API_IMPL bool sargs_equals(const char* key, const char* val) { SOKOL_ASSERT(_sargs.valid && key && val); return 0 == strcmp(sargs_value(key), val); } SOKOL_API_IMPL bool sargs_boolean(const char* key) { const char* val = sargs_value(key); return (0 == strcmp("true", val)) || (0 == strcmp("yes", val)) || (0 == strcmp("on", val)); } #endif /* SOKOL_ARGS_IMPL */
4ab551a6126f6e003d7ea6ba85adfa779c528ee9
6b288a71553cf3d8701fe7179701d100c656a53c
/c/number.c
61c0cf29d27fec8efcc8fd724d42741a22f89124
[ "Apache-2.0" ]
permissive
cisco/ChezScheme
03e2edb655f8f686630f31ba2574f47f29853b6f
c048ad8423791de4bf650fca00519d5c2059d66e
refs/heads/main
2023-08-26T16:11:15.338552
2023-08-25T14:17:54
2023-08-25T14:17:54
56,263,501
7,763
1,410
Apache-2.0
2023-08-28T22:45:52
2016-04-14T19:10:25
Scheme
UTF-8
C
false
false
56,104
c
number.c
/* number.c * Copyright 1984-2017 Cisco Systems, Inc. * * 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. */ /* *** * assumptions: * bigits are unsigned * uptr is either one or two bigits wide *** */ #include "system.h" /* locally defined functions */ static ptr copy_normalize(ptr tc, const bigit *p, iptr len, IBOOL sign); static IBOOL abs_big_lt(ptr x, ptr y, iptr xl, iptr yl); static IBOOL abs_big_eq(ptr x, ptr y, iptr xl, iptr yl); static ptr big_negate(ptr tc, ptr x); static ptr big_add_pos(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL sign); static ptr big_add_neg(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL sign); static ptr big_add(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL xs, IBOOL ys); static ptr big_mul(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL sign); static void big_short_trunc(ptr tc, ptr x, bigit s, iptr xl, IBOOL qs, IBOOL rs, ptr *q, ptr *r); static void big_trunc(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL qs, IBOOL rs, ptr *q, ptr *r); static INT normalize(bigit *xp, bigit *yp, iptr xl, iptr yl); static bigit quotient_digit(bigit *xp, bigit *yp, iptr yl); static bigit qhat(bigit *xp, bigit *yp); static ptr big_short_gcd(ptr tc, ptr x, bigit y, iptr xl); static ptr big_gcd(ptr tc, ptr x, ptr y, iptr xl, iptr yl); static ptr s_big_ash(ptr tc, bigit *xp, iptr xl, IBOOL sign, iptr cnt); static double big_short_floatify(ptr tc, ptr x, bigit s, iptr xl, IBOOL sign); static double big_floatify(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL sign); static double floatify_normalize(bigit *p, iptr e, IBOOL sign, IBOOL sticky); static double floatify_ratnum(ptr tc, ptr x); static ptr big_logbitp(iptr n, ptr x, iptr xl, IBOOL xs); static ptr big_logbit0(ptr tc, ptr origx, iptr n, ptr x, iptr xl, IBOOL xs); static ptr big_logbit1(ptr tc, ptr origx, iptr n, ptr x, iptr xl, IBOOL xs); static ptr big_logtest(ptr x, ptr y, iptr xl, iptr yl, IBOOL xs, IBOOL ys); static ptr big_logand(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL xs, IBOOL ys); static ptr big_logor(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL xs, IBOOL ys); static ptr big_logxor(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL xs, IBOOL ys); /* use w/o trailing semicolon */ #define PREPARE_BIGNUM(tc,x,l)\ {if (x == FIX(0) || BIGLEN(x) < (l)) x = S_bignum(tc, (l)*2, 0);} #define bigit_mask (~(bigit)0) #define IBIGIT_TO_BIGNUM(tc,B,x,cnt,sign) {\ ibigit _i_ = x;\ PREPARE_BIGNUM(tc, B, 1)\ *cnt = 1;\ BIGIT(B,0) = (*sign = (_i_ < 0)) ? -_i_ : _i_;\ } #define UBIGIT_TO_BIGNUM(tc,B,u,cnt) {\ PREPARE_BIGNUM(tc, B, 1)\ *cnt = 1;\ BIGIT(B,0) = u;\ } #define IBIGITBIGIT_TO_BIGNUM(tc,B,x,cnt,sign) {\ ibigitbigit _i_ = x; bigitbigit _u_; bigit _b_;\ PREPARE_BIGNUM(tc, B, 2)\ _u_ = (*sign = (_i_ < 0)) ? -_i_ : _i_;\ if ((_b_ = (_u_ & (bigitbigit)bigit_mask)) == _u_) {\ *cnt = 1;\ BIGIT(B,0) = (bigit)_u_;\ } else {\ *cnt = 2;\ BIGIT(B,0) = (bigit)(_u_ >> bigit_bits);\ BIGIT(B,1) = _b_;\ }\ } #define UBIGITBIGIT_TO_BIGNUM(tc,B,x,cnt) {\ bigitbigit _u_ = x; bigit _b_;\ PREPARE_BIGNUM(tc, B, 2)\ if ((_b_ = (_u_ & (bigitbigit)bigit_mask)) == _u_) {\ *cnt = 1;\ BIGIT(B,0) = (bigit)_u_;\ } else {\ *cnt = 2;\ BIGIT(B,0) = (bigit)(_u_ >> bigit_bits);\ BIGIT(B,1) = _b_;\ }\ } #define U32_bigits (32 / bigit_bits) #if (U32_bigits == 1) #define I32_TO_BIGNUM(tc,B,x,cnt,sign) IBIGIT_TO_BIGNUM(tc,B,x,cnt,sign) #define U32_TO_BIGNUM(tc,B,x,cnt) UBIGIT_TO_BIGNUM(tc,B,x,cnt) #endif #if (U32_bigits == 2) #define I32_TO_BIGNUM(tc,B,x,cnt,sign) IBIGITBIGIT_TO_BIGNUM(tc,B,x,cnt,sign) #define U32_TO_BIGNUM(tc,B,x,cnt) UBIGITBIGIT_TO_BIGNUM(tc,B,x,cnt) #endif #define U64_bigits (64 / bigit_bits) #if (U64_bigits == 2) #define I64_TO_BIGNUM(tc,B,x,cnt,sign) IBIGITBIGIT_TO_BIGNUM(tc,B,x,cnt,sign) #define U64_TO_BIGNUM(tc,B,x,cnt) UBIGITBIGIT_TO_BIGNUM(tc,B,x,cnt) #endif #if (U64_bigits == 4) see v7.4 number.c for U64_TO_BIGNUM w/U64_bigits == 4 #endif #define ptr_bigits (ptr_bits / bigit_bits) #if (ptr_bigits == 1) #define IPTR_TO_BIGNUM(tc,B,x,cnt,sign) IBIGIT_TO_BIGNUM(tc,B,x,cnt,sign) #define UPTR_TO_BIGNUM(tc,B,x,cnt) UBIGIT_TO_BIGNUM(tc,B,x,cnt) #endif #if (ptr_bigits == 2) #define IPTR_TO_BIGNUM(tc,B,x,cnt,sign) IBIGITBIGIT_TO_BIGNUM(tc,B,x,cnt,sign) #define UPTR_TO_BIGNUM(tc,B,x,cnt) UBIGITBIGIT_TO_BIGNUM(tc,B,x,cnt) #endif #define FIXNUM_TO_BIGNUM(tc,B,p,cnt,sign) IPTR_TO_BIGNUM(tc,B,UNFIX(p),cnt,sign) ptr S_normalize_bignum(ptr x) { uptr n = BIGIT(x, 0); iptr len = BIGLEN(x); IBOOL sign = BIGSIGN(x); #if (ptr_bigits == 1) if (len == 1) { if (sign) { if (n <= -most_negative_fixnum) return FIX(-(iptr)n); } else { if (n <= most_positive_fixnum) return FIX(n); } } #elif (ptr_bigits == 2) if (len == 1) return sign ? FIX(-(iptr)n) : FIX(n); else if (len == 2) { n = (n << bigit_bits) | BIGIT(x, 1); if (sign) { /* avoid -most-negative-fixnum to avoid bogus Sun compiler warning */ if (n <= most_positive_fixnum+1) return FIX(-(iptr)n); } else { if (n <= most_positive_fixnum) return FIX(n); } } #endif return x; } static ptr copy_normalize(ptr tc, const bigit *p, iptr len, IBOOL sign) { bigit *p1; uptr n; ptr b; for (;;) { if ((n = *p) != 0) break; else if (--len == 0) return FIX(0); else p++; } #if (ptr_bigits == 1) if (len == 1) { if (sign) { if (n <= -most_negative_fixnum) return FIX(-(iptr)n); } else { if (n <= most_positive_fixnum) return FIX(n); } } #elif (ptr_bigits == 2) if (len == 1) return sign ? FIX(-(iptr)n) : FIX(n); else if (len == 2) { n = (n << bigit_bits) | *(p+1); if (sign) { /* avoid -most-negative-fixnum to avoid bogus Sun compiler warning */ if (n <= most_positive_fixnum+1) return FIX(-(iptr)n); } else { if (n <= most_positive_fixnum) return FIX(n); } } #endif b = S_bignum(tc, len, sign); for (p1 = &BIGIT(b, 0); len--;) *p1++ = *p++; return b; } /* -2^(b-1) <= x <= 2^b-1, where b = number of bits in a uptr */ iptr S_integer_value(const char *who, ptr x) { if (Sfixnump(x)) return UNFIX(x); if (Sbignump(x)) { iptr xl; uptr u; if ((xl = BIGLEN(x)) > ptr_bigits) S_error1(who, "~s is out of range", x); u = BIGIT(x,0); #if (ptr_bigits == 2) if (xl == 2) u = (u << bigit_bits) | BIGIT(x,1); #endif if (!BIGSIGN(x)) return (iptr)u; if (u < ((uptr)1 << (ptr_bits - 1))) return -(iptr)u; if (u > ((uptr)1 << (ptr_bits - 1))) S_error1(who, "~s is out of range", x); #if (fixnum_bits > 32) return (iptr)0x8000000000000000; #else return (iptr)0x80000000; #endif } S_error1(who, "~s is not an integer", x); return 0 /* not reached */; } /* -2^(b-1) <= x <= 2^b-1, where b = number of bits in a uptr */ IBOOL S_integer_valuep(ptr x) { if (Sfixnump(x)) return 1; if (Sbignump(x)) { iptr xl; uptr u; if ((xl = BIGLEN(x)) > ptr_bigits) return 0; u = BIGIT(x,0); #if (ptr_bigits == 2) if (xl == 2) u = (u << bigit_bits) | BIGIT(x,1); #endif if (!BIGSIGN(x)) return 1; return u <= ((uptr)1 << (ptr_bits - 1)); } return 0; } iptr Sinteger_value(ptr x) { return S_integer_value("Sinteger_value", x); } /* -2^31 <= x <= 2^32-1 */ I32 S_int32_value(char *who, ptr x) { #if (fixnum_bits > 32) if (Sfixnump(x)) { iptr n = UNFIX(x); if (n < 0) { I32 m = (I32)n; if ((iptr)m == UNFIX(x)) return m; } else { U32 m = (U32)n; if ((uptr)m == (uptr)UNFIX(x)) return (I32)m; } S_error1(who, "~s is out of range", x); } if (Sbignump(x)) S_error1(who, "~s is out of range", x); #else /* (fixnum_bits > 32) */ if (Sfixnump(x)) return UNFIX(x); if (Sbignump(x)) { iptr xl; U32 u; if ((xl = BIGLEN(x)) > U32_bigits) S_error1(who, "~s is out of range", x); u = BIGIT(x,0); #if (U32_bigits == 2) if (xl == 2) u = (u << bigit_bits) | BIGIT(x,1); #endif if (!BIGSIGN(x)) return (I32)u; if (u < ((U32)1 << 31)) return -(I32)u; if (u > ((U32)1 << 31)) S_error1(who, "~s is out of range", x); return (I32)0x80000000; } #endif /* (fixnum_bits > 32) */ S_error1(who, "~s is not an integer", x); return 0 /* not reached */; } I32 Sinteger32_value(ptr x) { return S_int32_value("Sinteger32_value", x); } /* -2^63 <= x <= 2^64-1 */ I64 S_int64_value(char *who, ptr x) { if (Sfixnump(x)) return UNFIX(x); if (Sbignump(x)) { iptr xl; U64 u; if ((xl = BIGLEN(x)) > U64_bigits) S_error1(who, "~s is out of range", x); u = BIGIT(x,0); #if (U64_bigits == 2) if (xl == 2) u = (u << bigit_bits) | BIGIT(x,1); #endif if (!BIGSIGN(x)) return (I64)u; if (u < ((U64)1 << 63)) return -(I64)u; if (u > ((U64)1 << 63)) S_error1(who, "~s is out of range", x); return (I64)0x8000000000000000; } S_error1(who, "~s is not an integer", x); return 0 /* not reached */; } I64 Sinteger64_value(ptr x) { return S_int64_value("Sinteger64_value", x); } ptr Sunsigned(uptr u) { /* convert arg to Scheme integer */ if (u <= most_positive_fixnum) return FIX(u); else { ptr x = FIX(0); iptr xl; UPTR_TO_BIGNUM(get_thread_context(), x, u, &xl) SETBIGLENANDSIGN(x, xl, 0); return x; } } ptr Sinteger(iptr i) { /* convert arg to Scheme integer */ if (FIXRANGE(i)) return FIX(i); else { ptr x = FIX(0); iptr xl; IBOOL xs; IPTR_TO_BIGNUM(get_thread_context(), x, i, &xl, &xs) SETBIGLENANDSIGN(x, xl, xs); return x; } } ptr Sunsigned32(U32 u) { /* convert arg to Scheme integer */ #if (fixnum_bits > 32) return FIX((uptr)u); #else if (u <= most_positive_fixnum) return FIX((uptr)u); else { ptr x = FIX(0); iptr xl; U32_TO_BIGNUM(get_thread_context(), x, u, &xl) SETBIGLENANDSIGN(x, xl, 0); return x; } #endif } ptr Sinteger32(I32 i) { /* convert arg to Scheme integer */ #if (fixnum_bits > 32) return FIX((iptr)i); #else if (i > most_negative_fixnum && i <= most_positive_fixnum) return FIX((iptr)i); else { ptr x = FIX(0); iptr xl; IBOOL xs; I32_TO_BIGNUM(get_thread_context(), x, i, &xl, &xs) SETBIGLENANDSIGN(x, xl, xs); return x; } #endif } ptr Sunsigned64(U64 u) { /* convert arg to Scheme integer */ if (u <= most_positive_fixnum) return FIX((uptr)u); else { ptr x = FIX(0); iptr xl; U64_TO_BIGNUM(get_thread_context(), x, u, &xl) SETBIGLENANDSIGN(x, xl, 0); return x; } } ptr Sinteger64(I64 i) { /* convert arg to Scheme integer */ if (i > most_negative_fixnum && i <= most_positive_fixnum) return FIX((iptr)i); else { ptr x = FIX(0); iptr xl; IBOOL xs; I64_TO_BIGNUM(get_thread_context(), x, i, &xl, &xs) SETBIGLENANDSIGN(x, xl, xs); return x; } } /* extended arithmetic macros: use w/o trailing semicolon */ #define ELSH(n,x,k) { /* undefined when n == 0 */\ INT _n_ = (INT)(n); bigit _b_ = *(x), _newk_ = _b_>>(bigit_bits-_n_);\ *(x) = _b_<<_n_ | *(k);\ *(k) = _newk_;} #define ERSH(n,x,k) { /* undefined when n == 0 */\ INT _n_ = (INT)(n); bigit _b_ = *(x), _newk_ = _b_<<(bigit_bits-_n_);\ *(x) = _b_>>_n_ | *(k);\ *(k) = _newk_;} #define ERSH2(n,x,y,k) { /* undefined when n == 0 */\ INT _n_ = (INT)(n); bigit _b_ = (x), _newk_ = _b_<<(bigit_bits-_n_);\ *(y) = _b_>>_n_ | *(k);\ *(k) = _newk_;} #define EADDC(a1, a2, sum, k) {\ bigit _tmp1_, _tmp2_, _tmpk_;\ _tmp1_ = (a1);\ _tmp2_ = _tmp1_ + (a2);\ _tmpk_ = _tmp2_ < _tmp1_;\ _tmp1_ = _tmp2_ + *(k);\ *k = _tmpk_ + (_tmp1_ < _tmp2_);\ *sum = _tmp1_;} #define ESUBC(s1, s2, diff, b) {\ bigit _tmp1_, _tmp2_, tmpb;\ _tmp1_ = (s1);\ _tmp2_ = _tmp1_ - (s2);\ tmpb = _tmp2_ > _tmp1_;\ _tmp1_ = _tmp2_ - *(b);\ *b = tmpb + (_tmp1_ > _tmp2_);\ *diff = _tmp1_;} /* bigit x bigit -> bigitbigit */ #define EMUL(m1,m2,a1,low,high) {\ bigitbigit _tmp_;\ _tmp_ = (bigitbigit)m1 * m2 + a1;\ *low = (bigit)(_tmp_ & (bigitbigit)bigit_mask);\ *high = (bigit)(_tmp_ >> bigit_bits);} /* bigitbigit / bigit -> bigit */ #define EDIV(high,low,divr,quo,rem) {\ bigit _tmpr_; bigitbigit _tmp_;\ _tmp_ = ((bigitbigit)high << bigit_bits) | low;\ _tmpr_ = divr;\ *quo = (bigit)(_tmp_ / _tmpr_);\ *rem = (bigit)(_tmp_ % _tmpr_);} /* *** comparison *** */ IBOOL S_big_lt(ptr x, ptr y) { if (BIGSIGN(x)) if (BIGSIGN(y)) return abs_big_lt(y, x, BIGLEN(y), BIGLEN(x)); /* both negative */ else return 1; /* x negative, y positive */ else if (BIGSIGN(y)) return 0; /* x positive, y negative */ else return abs_big_lt(x, y, BIGLEN(x), BIGLEN(y)); /* both positive */ } IBOOL S_big_eq(ptr x, ptr y) { return (BIGSIGN(x) == BIGSIGN(y)) && abs_big_eq(x, y, BIGLEN(x), BIGLEN(y)); } static IBOOL abs_big_lt(ptr x, ptr y, iptr xl, iptr yl) { if (xl != yl) return xl < yl; else { bigit *xp, *yp; for (xp = &BIGIT(x,0), yp = &BIGIT(y,0); xl-- > 0; xp++, yp++) if (*xp != *yp) return (*xp < *yp); return 0; } } static IBOOL abs_big_eq(ptr x, ptr y, iptr xl, iptr yl) { if (xl != yl) return 0; else { bigit *xp, *yp; for (xp = &BIGIT(x,0), yp = &BIGIT(y,0); xl-- > 0; xp++, yp++) if (*xp != *yp) return 0; return 1; } } /* *** addition/subtraction *** */ static ptr big_negate(ptr tc, ptr x) { return copy_normalize(tc, &BIGIT(x,0),BIGLEN(x),!BIGSIGN(x)); } ptr S_big_negate(ptr x) { return big_negate(get_thread_context(), x); } /* assumptions: BIGLEN(x) >= BIGLEN(y) */ static ptr big_add_pos(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL sign) { iptr i; bigit *xp, *yp, *zp; bigit k = 0; PREPARE_BIGNUM(tc, W(tc),xl+1) xp = &BIGIT(x,xl-1); yp = &BIGIT(y,yl-1); zp = &BIGIT(W(tc),xl); for (i = yl; i-- > 0; ) EADDC(*xp--, *yp--, zp--, &k) for (i = xl - yl; k != 0 && i-- > 0; ) EADDC(*xp--, 0, zp--, &k) for (; i-- > 0; ) *zp-- = *xp--; *zp = k; return copy_normalize(tc, zp,xl+1,sign); } /* assumptions: x >= y */ static ptr big_add_neg(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL sign) { iptr i; bigit *xp, *yp, *zp; bigit b = 0; PREPARE_BIGNUM(tc, W(tc),xl) xp = &BIGIT(x,xl-1); yp = &BIGIT(y,yl-1); zp = &BIGIT(W(tc),xl-1); for (i = yl; i-- > 0; ) ESUBC(*xp--, *yp--, zp--, &b) for (i = xl-yl; b != 0 && i-- > 0; ) ESUBC(*xp--, 0, zp--, &b) for (; i-- > 0; ) *zp-- = *xp--; return copy_normalize(tc, zp+1,xl,sign); } static ptr big_add(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL xs, IBOOL ys) { if (xs == ys) if (xl < yl) return big_add_pos(tc, y, x, yl, xl, xs); else return big_add_pos(tc, x, y, xl, yl, xs); else if (abs_big_lt(x, y, xl, yl)) return big_add_neg(tc, y, x, yl, xl, ys); else return big_add_neg(tc, x, y, xl, yl, xs); } /* arguments must be integers, fixnums or bignums */ ptr S_add(ptr x, ptr y) { ptr tc = get_thread_context(); if (Sfixnump(x)) { if (Sfixnump(y)) { iptr n = UNFIX(x) + UNFIX(y); return FIXRANGE(n) ? FIX(n) : Sinteger(n); } else { iptr xl; IBOOL xs; FIXNUM_TO_BIGNUM(tc,X(tc),x,&xl,&xs) return big_add(tc, X(tc), y, xl, BIGLEN(y), xs, BIGSIGN(y)); } } else { if (Sfixnump(y)) { iptr yl; IBOOL ys; FIXNUM_TO_BIGNUM(tc,Y(tc),y,&yl,&ys) return big_add(tc, x, Y(tc), BIGLEN(x), yl, BIGSIGN(x), ys); } else { return big_add(tc, x, y, BIGLEN(x), BIGLEN(y), BIGSIGN(x), BIGSIGN(y)); } } } /* arguments must be integers, fixnums or bignums */ ptr S_sub(ptr x, ptr y) { ptr tc = get_thread_context(); if (Sfixnump(x)) { if (Sfixnump(y)) { iptr n = UNFIX(x) - UNFIX(y); return FIXRANGE(n) ? FIX(n) : Sinteger(n); } else { iptr xl; IBOOL xs; FIXNUM_TO_BIGNUM(tc,X(tc),x,&xl,&xs) return big_add(tc, X(tc), y, xl, BIGLEN(y), xs, !BIGSIGN(y)); } } else { if (Sfixnump(y)) { iptr yl; IBOOL ys; FIXNUM_TO_BIGNUM(tc,Y(tc),y,&yl,&ys) return big_add(tc, x, Y(tc), BIGLEN(x), yl, BIGSIGN(x), !ys); } else { return big_add(tc, x, y, BIGLEN(x), BIGLEN(y), BIGSIGN(x), !BIGSIGN(y)); } } } /* *** multiplication *** */ static ptr big_mul(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL sign) { iptr xi, yi; bigit *xp, *yp, *zp, *zpa; bigit k, k1, prod; PREPARE_BIGNUM(tc, W(tc),xl+yl) for (xi = xl, zp = &BIGIT(W(tc),xl+yl-1); xi-- > 0; ) *zp-- = 0; for (yi=yl,yp= &BIGIT(y,yl-1),zp= &BIGIT(W(tc),xl+yl-1); yi-- > 0; yp--, zp--) if (*yp == 0) *(zp-xl) = 0; else { for (xi=xl,k=0,zpa=zp,xp= &BIGIT(x,xl-1); xi-- > 0; xp--,zpa--) { EMUL(*xp, *yp, *zpa, &prod, &k1) EADDC(prod, 0, zpa, &k) k += k1; } *zpa = k; } return copy_normalize(tc, &BIGIT(W(tc),0),xl+yl,sign); } /* SHORTRANGE is -floor(sqrt(most_positive_fixnum))..floor(sqrt(most_positive_fixnum)). We don't use sqrt because it rounds up for fixnum_bits = 61 */ #if (fixnum_bits == 30) #define SHORTRANGE(x) (-23170 <= (x) && (x) <= 23170) #elif (fixnum_bits == 61) #define SHORTRANGE(x) (-0x3FFFFFFF <= (x) && (x) <= 0x3FFFFFFF) #endif ptr S_mul(ptr x, ptr y) { ptr tc = get_thread_context(); iptr xl, yl; IBOOL xs, ys; if (Sfixnump(x)) { if (Sfixnump(y)) { iptr xn = UNFIX(x); iptr yn = UNFIX(y); if (SHORTRANGE(xn) && SHORTRANGE(yn)) return FIX(xn * yn); else { FIXNUM_TO_BIGNUM(tc, X(tc),x,&xl,&xs) x = X(tc); FIXNUM_TO_BIGNUM(tc, Y(tc),y,&yl,&ys) y = Y(tc); } } else { FIXNUM_TO_BIGNUM(tc,X(tc),x,&xl,&xs) x = X(tc); yl = BIGLEN(y); ys = BIGSIGN(y); } } else { if (Sfixnump(y)) { xl = BIGLEN(x); xs = BIGSIGN(x); FIXNUM_TO_BIGNUM(tc,Y(tc),y,&yl,&ys) y = Y(tc); } else { xl = BIGLEN(x); xs = BIGSIGN(x); yl = BIGLEN(y); ys = BIGSIGN(y); } } return big_mul(tc, x, y, xl, yl, xs ^ ys); } /* *** division *** */ /* arguments must be integers (fixnums or bignums), y must be nonzero */ ptr S_div(ptr x, ptr y) { ptr g, n, d; ptr tc = get_thread_context(); g = S_gcd(x,y); if (Sfixnump(y) ? UNFIX(y) < 0 : BIGSIGN(y)) { g = Sfixnump(g) ? Sinteger(-UNFIX(g)) : big_negate(tc, g); } S_trunc_rem(tc, x, g, &n, (ptr *)NULL); S_trunc_rem(tc, y, g, &d, (ptr *)NULL); return S_rational(n, d); } ptr S_trunc(ptr x, ptr y) { ptr q; S_trunc_rem(get_thread_context(), x, y, &q, (ptr *)NULL); return q; } ptr S_rem(ptr x, ptr y) { ptr r; S_trunc_rem(get_thread_context(), x, y, (ptr *)NULL, &r); return r; } /* arguments must be integers (fixnums or bignums), y must be nonzero */ void S_trunc_rem(ptr tc, ptr origx, ptr y, ptr *q, ptr *r) { iptr xl, yl; IBOOL xs, ys; ptr x = origx; if (Sfixnump(x)) { if (Sfixnump(y)) { if (x == FIX(most_negative_fixnum) && y == FIX(-1)) { iptr m = most_negative_fixnum /* pull out to avoid bogus Sun C warning */; if (q != (ptr)NULL) *q = Sinteger(-m); if (r != (ptr)NULL) *r = FIX(0); return; } else { if (q != (ptr)NULL) *q = FIX((iptr)x / (iptr)y); if (r != (ptr)NULL) *r = (ptr)((iptr)x % (iptr)y); return; } } else { FIXNUM_TO_BIGNUM(tc, X(tc),x,&xl,&xs) x = X(tc); yl = BIGLEN(y); ys = BIGSIGN(y); } } else { if (Sfixnump(y)) { xl = BIGLEN(x); xs = BIGSIGN(x); FIXNUM_TO_BIGNUM(tc, Y(tc),y,&yl,&ys) y = Y(tc); } else { xl = BIGLEN(x); xs = BIGSIGN(x); yl = BIGLEN(y); ys = BIGSIGN(y); } } if (xl < yl) { if (q != (ptr *)NULL) *q = FIX(0); if (r != (ptr *)NULL) *r = origx; } else if (yl == 1) /* must have two bigits for full algorithm */ big_short_trunc(tc, x, BIGIT(y,0), xl, xs^ys, xs, q, r); else big_trunc(tc, x, y, xl, yl, xs^ys, xs, q, r); } /* sparc C compiler barfs w/o full declaration */ static void big_short_trunc(ptr tc, ptr x, bigit s, iptr xl, IBOOL qs, IBOOL rs, ptr *q, ptr *r) { iptr i; bigit *xp, *zp; bigit k; PREPARE_BIGNUM(tc, W(tc),xl) for (i = xl, k = 0, xp = &BIGIT(x,0), zp = &BIGIT(W(tc),0); i-- > 0; ) EDIV(k, *xp++, s, zp++, &k) if (q != (ptr *)NULL) *q = copy_normalize(tc, &BIGIT(W(tc),0),xl,qs); if (r != (ptr *)NULL) *r = copy_normalize(tc, &k,1,rs); } static void big_trunc(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL qs, IBOOL rs, ptr *q, ptr *r) { iptr i; bigit *p, *xp, *yp; iptr m = xl-yl+1; INT d; bigit k; PREPARE_BIGNUM(tc, U(tc), xl+1) for (i = xl, xp = &BIGIT(U(tc),xl+1), p = &BIGIT(x,xl); i-- > 0;) *--xp = *--p; *--xp = 0; PREPARE_BIGNUM(tc, V(tc), yl) for (i = yl, yp = &BIGIT(V(tc),yl), p = &BIGIT(y,yl); i-- > 0;) *--yp = *--p; d = normalize(xp, yp, xl, yl); if (q == (ptr *)NULL) { for (i = m; i-- > 0 ; xp++) (void) quotient_digit(xp, yp, yl); } else { PREPARE_BIGNUM(tc, W(tc),m) p = &BIGIT(W(tc),0); for (i = m; i-- > 0 ; xp++) *p++ = quotient_digit(xp, yp, yl); *q = copy_normalize(tc, &BIGIT(W(tc),0),m,qs); } if (r != (ptr *)NULL) { /* unnormalize the remainder */ if (d != 0) { for (i = yl, p = xp, k = 0; i-- > 0; p++) ERSH(d,p,&k) } *r = copy_normalize(tc, xp, yl, rs); } } static INT normalize(bigit *xp, bigit *yp, iptr xl, iptr yl) { iptr i; bigit *p, k, b; INT shft; for (shft = bigit_bits-1, b = *yp; b >>= 1; shft -= 1); if (shft != 0) { for (i = yl, p = yp+yl-1, k = 0; i-- > 0; p--) ELSH(shft,p,&k) for (i = xl, p = xp+xl, k = 0; i-- > 0; p--) ELSH(shft,p,&k) *xp = k; } return shft; } static bigit quotient_digit(bigit *xp, bigit *yp, iptr yl) { bigit *p1, *p2, q, k, b, prod; iptr i; q = qhat(xp, yp); for (i = yl, p1 = xp+yl, p2 = yp+yl-1, k = 0, b = 0; i-- > 0; p1--, p2--) { EMUL(*p2, q, k, &prod, &k) ESUBC(*p1, prod, p1, &b) } ESUBC(*p1, k, p1, &b) if (b != 0) { for (i = yl, p1 = xp+yl, p2 = yp+yl-1, k = 0; i-- > 0; p1--, p2--) { EADDC(*p2, *p1, p1, &k) } EADDC(0,*p1,p1,&k) q--; } return q; } static bigit qhat(bigit *xp, bigit *yp) { bigit q, r, high, low, k; k = 0; if (*xp == *yp) { q = bigit_mask; EADDC(*(xp+1), *yp, &r, &k) } else { EDIV(*xp, *(xp+1), *yp, &q, &r) } for (; k == 0; q--) { EMUL(*(yp+1), q, 0, &low, &high) if (high < r || (high == r && low <= *(xp+2))) break; EADDC(r, *yp, &r, &k) } return q; } /* *** gcd *** */ static ptr uptr_gcd(uptr x, uptr y) { uptr r; while (y != 0) { r = x % y; x = y; y = r; } return Sunsigned(x); } /* sparc C compiler barfs w/o full declaration */ static ptr big_short_gcd(ptr tc, ptr x, bigit y, iptr xl) { bigit *xp; iptr i; bigit r, q; if (y == 0) return BIGSIGN(x) ? big_negate(tc, x) : x; for (i = xl, r = 0, xp = &BIGIT(x,0); i-- > 0; ) EDIV(r, *xp++, y, &q, &r) return uptr_gcd((uptr)y,(uptr)r); } static ptr big_gcd(ptr tc, ptr x, ptr y, iptr xl, iptr yl) { iptr i; INT shft, asc; bigit *p, *xp, *yp, k, b; /* Copy x to scratch bignum, with a leading zero */ PREPARE_BIGNUM(tc, U(tc),xl+1) xp = &BIGIT(U(tc),xl+1); for (i = xl, p = &BIGIT(x,xl); i-- > 0; ) *--xp = *--p; *--xp = 0; /* leave xp pointing at leading 0-bigit */ /* Copy y to scratch bignum, with a leading zero */ PREPARE_BIGNUM(tc, V(tc),yl+1) yp = &BIGIT(V(tc),yl+1); for (i = yl, p = &BIGIT(y,yl); i-- > 0; ) *--yp = *--p; *(yp-1) = 0; /* leave yp pointing just after leading 0-bigit */ /* initialize aggregate shift count (asc) */ asc = 0; for (;;) { /* find number of leading zeros in first bigit of y */ for (shft = bigit_bits - 1, b = *yp; b >>= 1; shft--); /* find directed distance to shift and new asc */ if (asc+shft >= bigit_bits) shft -= bigit_bits; asc += shft; /* shift left or right; adjust lengths, xp and yp */ if (shft < 0) { /* shift right */ for (i = yl--, p = yp++, k = 0; i-- > 0; p++) ERSH(-shft,p,&k) for (i = xl+1, p = xp, k = 0; i-- > 0; p++) ERSH(-shft,p,&k) /* don't need two leading zeros */ if (*(xp+1) == 0) xp++, xl--; /* we have shrunk y, so test the length here */ if (yl == 1) break; } else if (shft > 0) { /* left shift */ for (i=yl, p=yp+yl-1, k=0; i-- > 0; p--) ELSH(shft,p,&k) for (i=xl+1, p=xp+xl, k=0; i-- > 0; p--) ELSH(shft,p,&k) } /* destructive remainder x = x rem y */ for (i = xl-yl+1; i-- > 0; xp++) (void) quotient_digit(xp, yp, yl); /* strip leading zero bigits. remainder is at most yl bigits long */ for (i = yl ; *xp == 0 && i > 0; xp++, i--); /* swap x and y */ p = yp; /* leading bigit of y */ yp = xp; /* remainder */ xp = p-1; /* new dividend w/leading zero */ xl = yl; yl = i; /* may have lopped off all or all but one bigit of the remainder */ if (yl <= 1) break; } /* point xp after the leading zero */ xp += 1; /* if y is already zero, shift x and leave */ if (yl == 0) { if (asc != 0) { for (i = xl, p = xp, k = 0; i-- > 0; p++) ERSH(asc,p,&k) } return copy_normalize(tc, xp,xl,0); } else { bigit d, r; d = *yp; for (r = 0; xl-- > 0; xp++) EDIV(r, *xp, d, xp, &r) return uptr_gcd((uptr)(d>>asc), (uptr)(r>>asc)); } } ptr S_gcd(ptr x, ptr y) { ptr tc = get_thread_context(); iptr xl, yl; IBOOL xs, ys; if (Sfixnump(x)) if (Sfixnump(y)) { iptr xi = UNFIX(x), yi = UNFIX(y); if (xi < 0) xi = -xi; if (yi < 0) yi = -yi; return xi >= yi ? uptr_gcd((uptr)xi, (uptr)yi) : uptr_gcd((uptr)yi, (uptr)xi); } else { FIXNUM_TO_BIGNUM(tc, X(tc),x,&xl,&xs) x = X(tc); yl = BIGLEN(y); ys = BIGSIGN(y); } else if (Sfixnump(y)) { xl = BIGLEN(x); xs = BIGSIGN(x); FIXNUM_TO_BIGNUM(tc, Y(tc),y,&yl,&ys) y = Y(tc); } else { xl = BIGLEN(x); xs = BIGSIGN(x); yl = BIGLEN(y); ys = BIGSIGN(y); } if (xl == 1) if (yl == 1) { uptr xu = BIGIT(x,0), yu = BIGIT(y,0); return xu >= yu ? uptr_gcd(xu, yu) : uptr_gcd(yu, xu); } else return big_short_gcd(tc, y, BIGIT(x,0), yl); else if (yl == 1) return big_short_gcd(tc, x, BIGIT(y,0), xl); else if (abs_big_lt(x, y, xl, yl)) return big_gcd(tc, y, x, yl, xl); else return big_gcd(tc, x, y, xl, yl); } /* *** floating-point operations *** */ #ifdef IEEE_DOUBLE /* exponent stored + 1024, hidden bit to left of decimal point */ #define bias 1023 #define bitstoright 52 #define m1mask 0xf #ifdef WIN32 #define hidden_bit 0x10000000000000 #else #define hidden_bit 0x10000000000000ULL #endif #ifdef LITTLE_ENDIAN_IEEE_DOUBLE struct dblflt { UINT m4: 16; UINT m3: 16; UINT m2: 16; UINT m1: 4; UINT e: 11; UINT sign: 1; }; #else struct dblflt { UINT sign: 1; UINT e: 11; UINT m1: 4; UINT m2: 16; UINT m3: 16; UINT m4: 16; }; #endif #endif double S_random_double(U32 m1, U32 m2, U32 m3, U32 m4, double scale) { /* helper for s_fldouble in prim5.c */ union dxunion { double d; struct dblflt x; } dx; dx.x.m1 = m1 >> 16 & m1mask; dx.x.m2 = m2 >> 16; dx.x.m3 = m3 >> 16; dx.x.m4 = m4 >> 16; dx.x.sign = 0; dx.x.e = bias; return (dx.d - 1.0) * scale; } /* number of quotient bigits to guarantee at least 64 bits */ /* +2 since first bigit may be zero and second may not be full */ #define enough (64 / bigit_bits + 2) /* sparc C compiler barfs w/o full declaration */ static double big_short_floatify(ptr tc, ptr x, bigit s, iptr xl, IBOOL sign) { iptr i; bigit *xp, *zp, k; PREPARE_BIGNUM(tc, W(tc),enough+1) /* compute only as much of quotient as we need */ for (i = 0, k = 0, xp = &BIGIT(x,0), zp = &BIGIT(W(tc),0); i < enough; i++) if (i < xl) EDIV(k, *xp++, s, zp++, &k) else EDIV(k, 0, s, zp++, &k) /* then see if there's a bit set somewhere beyond */ while (k == 0 && i++ < xl) k = *xp++; return floatify_normalize(&BIGIT(W(tc),0), xl*bigit_bits, sign, k != 0); } static double big_floatify(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL sign) { iptr i, ul; bigit *p, *xp, *yp, k; /* copy x to U(tc), scaling with added zero bigits as necessary */ ul = xl < yl + enough-1 ? yl + enough-1 : xl; PREPARE_BIGNUM(tc, U(tc), ul+1) for (i = ul - xl, xp = &BIGIT(U(tc),ul+1); i-- > 0;) *--xp = 0; for (i = xl, p = &BIGIT(x,xl); i-- > 0;) *--xp = *--p; *--xp = 0; /* copy y to V(tc) */ PREPARE_BIGNUM(tc, V(tc), yl) for (i = yl, yp = &BIGIT(V(tc),yl), p = &BIGIT(y,yl); i-- > 0;) *--yp = *--p; (void) normalize(xp, yp, ul, yl); PREPARE_BIGNUM(tc, W(tc),4) p = &BIGIT(W(tc),0); /* compute 'enough' bigits of the quotient */ for (i = enough; i-- > 0; xp++) *p++ = quotient_digit(xp, yp, yl); /* set k if remainder is nonzero */ k = 0; for (i = ul + 1, xp = &BIGIT(U(tc),ul); k == 0 && i-- > 0; xp--) k = *xp; return floatify_normalize(&BIGIT(W(tc),0), (xl-yl+1)*bigit_bits, sign, k != 0); } /* come in with exactly 'enough' bigits */ static double floatify_normalize(bigit *p, iptr e, IBOOL sign, IBOOL sticky) { /* *p: first bigit; e: exponent; sign: sign; sticky: sticky bit */ union dxunion { double d; struct dblflt x; } dx; bigit mhigh; U64 mlow; IBOOL cutbit = 0; INT n; /* shift in what we need, plus at least one bit */ mhigh = 0; mlow = 0; n = enough; while (mhigh == 0 && mlow < hidden_bit * 2) { mhigh = (bigit)(mlow >> (64-bigit_bits)); mlow = (mlow << bigit_bits) | *p++; n -= 1; e -= bigit_bits; } /* back up to align high bit on hidden bit, setting cut bit to last loser */ do { sticky = sticky || cutbit; cutbit = (bigit)(mlow & 1); mlow = (U64)mhigh << 63 | mlow >> 1; mhigh = mhigh >> 1; e = e + 1; } while (mhigh != 0 || mlow >= hidden_bit * 2); e = e + bitstoright + bias; /* back up further if denormalized */ if (e <= 0) { for (;;) { sticky = sticky || cutbit; cutbit = (bigit)(mlow & 1); mlow = mlow >> 1; if (e == 0 || mlow == 0) break; e = e + 1; } } if (e < 0) { e = 0; /* NB: e < 0 => mlow == 0 */ } else { /* round up if necessary */ if (cutbit) { IBOOL round; /* cutbit = 1 => at least half way to next number. round up if odd or if there are any bits set to the right of cutbit */ round = (mlow & 1) || sticky; while (!round && n-- > 0) round = *p++ != 0; if (round) { mlow += 1; if (e == 0 && mlow == hidden_bit) { e = 1; /* squeaking into lowest normalized spot */ } else if (mlow == hidden_bit * 2) { /* don't bother with mlow = mlow >> 1 since hidden bit and up are ignored after this */ e += 1; } } } if (e > 2046) { /* infinity */ e = 2047; mlow = 0; } } /* fill in the fields */ dx.x.sign = sign; dx.x.e = (UINT)e; dx.x.m1 = (UINT)(mlow >> 48 & m1mask); dx.x.m2 = (UINT)(mlow >> 32 & 0xffff); dx.x.m3 = (UINT)(mlow >> 16 & 0xffff); dx.x.m4 = (UINT)(mlow & 0xffff); return dx.d; } static double floatify_ratnum(ptr tc, ptr p) { ptr x, y; iptr xl, yl; IBOOL xs; x = RATNUM(p); y = RATDEN(p); if (fixnum_bits <= bitstoright && Sfixnump(x) && Sfixnump(y)) return (double)UNFIX(x) / (double)UNFIX(y); /* make sure we are dealing with bignums */ if (Sfixnump(x)) { FIXNUM_TO_BIGNUM(tc,X(tc),x,&xl,&xs) x = X(tc); } else { xl = BIGLEN(x); xs = BIGSIGN(x); } if (Sfixnump(y)) { IBOOL ys; FIXNUM_TO_BIGNUM(tc,Y(tc),y,&yl,&ys) y = Y(tc); } else { yl = BIGLEN(y); } /* need second bignum to be at least two bigits for full algorithm */ if (yl == 1) return big_short_floatify(tc, x, BIGIT(y,0), xl, xs); else return big_floatify(tc, x, y, xl, yl, xs); } double S_floatify(ptr x) { ptr tc = get_thread_context(); if (Sflonump(x)) return FLODAT(x); else if (Sfixnump(x)) return (double)UNFIX(x); else if (Sbignump(x)) return big_short_floatify(tc, x, 1, BIGLEN(x), BIGSIGN(x)); else if (Sratnump(x)) return floatify_ratnum(tc, x); else S_error1("", "~s is not a real number", x); return 0.0 /* not reached */; } #ifdef IEEE_DOUBLE ptr S_decode_float(double d) { union dxunion { double d; struct dblflt x; } dx; IBOOL s; INT e; U64 m; ptr x, p; /* pick apart the fields */ dx.d = d; s = dx.x.sign; e = dx.x.e; m = (U64)dx.x.m1 << 48 | (U64)dx.x.m2 << 32 | (U64)dx.x.m3 << 16 | (U64)dx.x.m4; if (e != 0) { e = e - bias - bitstoright; m |= hidden_bit; } else if (m != 0) { /* denormalized */ e = 1 - bias - bitstoright; } /* compute significand */ if (m <= most_positive_fixnum) x = FIX((uptr)m); else { iptr xl; x = FIX(0); U64_TO_BIGNUM(get_thread_context(), x, m, &xl) SETBIGLENANDSIGN(x, xl, 0); } /* construct return vector */ p = S_vector(3); INITVECTIT(p,0) = x; INITVECTIT(p, 1) = FIX(e); INITVECTIT(p, 2) = s ? FIX(-1) : FIX(1); return p; } #endif /* *** logical operations *** */ static ptr s_big_ash(ptr tc, bigit *xp, iptr xl, IBOOL sign, iptr cnt) { iptr i; bigit *p1, *p2, k; if (cnt < 0) { /* shift to the right */ iptr whole_bigits; /* decrement length to shift by whole bigits */ if ((xl -= (whole_bigits = (cnt = -cnt) / bigit_bits)) <= 0) return sign ? FIX(-1) : FIX(0); cnt -= whole_bigits * bigit_bits; /* shift by remaining count to scratch bignum, tracking bits shifted off to the right; prepare a bignum one larger than probably needed, in case we have to deal with a carry bit when rounding down for a negative number */ PREPARE_BIGNUM(tc, W(tc),xl+1) p1 = &BIGIT(W(tc), 0); p2 = xp; k = 0; i = xl; if (cnt == 0) { do { *p1++ = *p2++; } while (--i > 0); } else { do { ERSH2(cnt,*p2,p1,&k); p1++; p2++; } while (--i > 0); } if (sign) { if (k == 0) { /* check for one bits in the shifted-off bigits, looking */ /* from both ends in an attempt to get out more quickly for what */ /* seem like the most likely patterns. of course, there might */ /* be no one bits (in which case this won't help) or they might be */ /* only in the middle (in which case this will be slower) */ p2 = (p1 = xp + xl) + whole_bigits; while (p1 != p2) { if ((k = *p1++) || p1 == p2 || (k = *--p2)) break; } } /* round down negative numbers by incrementing the magnitude if any one bits were shifted off to the right */ if (k) { p1 = &BIGIT(W(tc), xl - 1); for (i = xl, k = 1; k != 0 && i-- > 0; p1 -= 1) EADDC(0, *p1, p1, &k) if (k) { /* add carry bit back; we prepared a large enough bignum, and since all of the middle are zero, we don't have to reshift */ BIGIT(W(tc), xl) = 0; BIGIT(W(tc), 0) = 1; xl++; } } } return copy_normalize(tc, &BIGIT(W(tc), 0), xl, sign); } else { /* shift to the left */ iptr xlplus, newxl; /* determine how many zero bigits to add on the end */ xlplus = 0; while (cnt >= bigit_bits) { xlplus += 1; cnt -= bigit_bits; } /* maximum total length includes +1 for shift out of top bigit */ newxl = xl + xlplus + 1; PREPARE_BIGNUM(tc, W(tc),newxl) /* fill bigits to right with zero */ for (i = xlplus, p1 = &BIGIT(W(tc), newxl); i-- > 0; ) *--p1 = 0; /* shift to the left */ for (i = xl, p2 = xp + xl, k = 0; i-- > 0; ) { *--p1 = *--p2; if (cnt != 0) ELSH(cnt, p1, &k); } *--p1 = k; return copy_normalize(tc, p1, newxl, sign); } } /* x is a bignum or fixnum, n is a fixnum */ ptr S_ash(ptr x, ptr n) { ptr tc = get_thread_context(); iptr cnt = UNFIX(n); if (Sfixnump(x)) { /* when we get here with a fixnum, we've done what we could in Scheme code to avoid use of bignums, so go straight to it. it's difficult to do much here anyway since semantics of signed >> are undefined in C */ iptr xl; IBOOL xs; FIXNUM_TO_BIGNUM(tc,X(tc),x,&xl,&xs); return s_big_ash(tc, &BIGIT(X(tc),0), xl, xs, cnt); } else return s_big_ash(tc, &BIGIT(x,0), BIGLEN(x), BIGSIGN(x), cnt); } /* x is a bignum */ ptr S_integer_length(ptr x) { iptr a; bigit b; if (BIGSIGN(x)) x = S_sub(FIX(-1), x); b = BIGIT(x, 0); a = 1; while (b >>= 1) a += 1; return S_add(S_mul(FIX(BIGLEN(x) - 1), FIX(bigit_bits)), FIX(a)); } /* x is a bignum */ ptr S_big_first_bit_set(ptr x) { iptr xl = BIGLEN(x); bigit *xp = &BIGIT(x, xl); bigit b; iptr zbigits = 0; INT zbits = 0; /* first bit set in signed magnitude is same as for two's complement, since if x ends with k zeros, ~x+1 also ends with k zeros. */ while ((b = *--xp) == 0) zbigits += 1; while ((b & 1) == 0) { zbits += 1; b >>= 1; } return S_add(S_mul(FIX(zbigits), FIX(bigit_bits)), FIX(zbits)); } /* assumes fxstart - fxend > 0 */ ptr S_big_positive_bit_field(ptr x, ptr fxstart, ptr fxend) { ptr tc = get_thread_context(); bigit *xp = &BIGIT(x, 0); iptr start = UNFIX(fxstart), end = UNFIX(fxend), xl = BIGLEN(x); iptr wl, bigits, i; bigit *p1, *p2, k; uptr bits, maskbits; /* shift by whole bigits by decrementing length */ bigits = (unsigned)start / bigit_bits; xl -= bigits; if (xl <= 0) return FIX(0); bits = (unsigned)bigits * bigit_bits; start -= bits; end -= bits; /* compute maximum length of result */ bigits = (unsigned)end / bigit_bits; if (xl <= bigits) { wl = xl; maskbits = 0; } else { end -= (unsigned)bigits * bigit_bits; if (end != 0) { wl = bigits + 1; maskbits = bigit_bits - end; } else { wl = bigits; maskbits = 0; } } /* copy to scratch bignum */ PREPARE_BIGNUM(tc, W(tc),wl) p1 = &BIGIT(W(tc), wl); for (i = wl, p2 = xp + xl; i-- > 0; ) *--p1 = *--p2; /* kill unwanted bits at the top of the first bigit */ if (maskbits != 0) *p1 = (*p1 << maskbits) >> maskbits; /* shift by remaining start bits */ if (start != 0) { k = 0; for (i = wl; i > 0; i -= 1, p1 += 1) ERSH(start,p1,&k) } return copy_normalize(tc, &BIGIT(W(tc), 0), wl, 0); } /* logical operations simulate two's complement operations using the following general strategy: 1. break into cases based on signs of operands 2. convert negative operands to two's complement 3. operate 4. convert negative results to two's complement and set sign bit. sign of result is known based on signs of operands simplifications are made where possible to reduce number of operations. # = 2's complement; #x = ~x + 1 = ~(x - 1) if x > 0 */ ptr S_logand(ptr x, ptr y) { ptr tc = get_thread_context(); if (Sfixnump(x)) { if (Sfixnump(y)) { return (ptr)((iptr)x & (iptr)y); } else { iptr xl; IBOOL xs; FIXNUM_TO_BIGNUM(tc,X(tc),x,&xl,&xs) return big_logand(tc, y, X(tc), BIGLEN(y), xl, BIGSIGN(y), xs); } } else { if (Sfixnump(y)) { iptr yl; IBOOL ys; FIXNUM_TO_BIGNUM(tc,Y(tc),y,&yl,&ys) return big_logand(tc, x, Y(tc), BIGLEN(x), yl, BIGSIGN(x), ys); } else { if (BIGLEN(x) >= BIGLEN(y)) return big_logand(tc, x, y, BIGLEN(x), BIGLEN(y), BIGSIGN(x), BIGSIGN(y)); else return big_logand(tc, y, x, BIGLEN(y), BIGLEN(x), BIGSIGN(y), BIGSIGN(x)); } } } /* logand on signed-magnitude bignums # = 2's complement; #x = ~x + 1 = ~(x - 1) if x > 0 s&(x,y) = x&y know result >= 0 s&(x,-y) = x&#y know result >= 0 = x&~(y-1) s&(-x,y) = s&(y,-x) s&(-x,-y) = -(#(#x&#y)) know result < 0 = -(~(~(x-1)&~(y-1))+1) = -(((x-1)|(y-1))+1) de morgan's law */ /* assumes xl >= yl */ static ptr big_logand(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL xs, IBOOL ys) { iptr i; bigit *xp, *yp, *zp; if (xs == 0) { if (ys == 0) { PREPARE_BIGNUM(tc, W(tc),yl); xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); zp = &BIGIT(W(tc),yl); for (i = yl; i > 0; i -= 1) *--zp = *--xp & *--yp; return copy_normalize(tc, zp, yl, 0); } else { bigit yb; PREPARE_BIGNUM(tc, W(tc),xl); xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); zp = &BIGIT(W(tc),xl); yb = 1; for (i = yl; i > 0; i -= 1) { bigit t1 = *--yp, t2 = t1 - yb; yb = t2 > t1; *--zp = *--xp & ~t2; } /* yb must be 0, since high-order bigit >= 1. effectively, this means ~t2 would be all 1's from here on out. */ for (i = xl - yl; i > 0; i -= 1) *--zp = *--xp; return copy_normalize(tc, zp, xl, 0); } } else { if (ys == 0) { bigit xb; PREPARE_BIGNUM(tc, W(tc),yl); xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); zp = &BIGIT(W(tc),yl); xb = 1; for (i = yl; i > 0; i -= 1) { bigit t1 = *--xp, t2 = t1 - xb; xb = t2 > t1; *--zp = *--yp & ~t2; } return copy_normalize(tc, zp, yl, 0); } else { bigit xb, yb, k; PREPARE_BIGNUM(tc, W(tc),xl+1); xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); zp = &BIGIT(W(tc),xl+1); k = yb = xb = 1; for (i = yl; i > 0; i -= 1) { bigit x1, x2, y1, y2, z1, z2; x1 = *--xp; x2 = x1 - xb; xb = x2 > x1; y1 = *--yp; y2 = y1 - yb; yb = y2 > y1; z1 = x2 | y2; z2 = z1 + k; k = z2 < z1; *--zp = z2; } for (i = xl - yl; i > 0; i -= 1) { bigit x1, x2, z1, z2; x1 = *--xp; x2 = x1 - xb; xb = x2 > x1; z1 = x2; z2 = z1 + k; k = z2 < z1; *--zp = z2; } *--zp = k; return copy_normalize(tc, zp, xl+1, 1); } } } /* logtest is like logand but returns a boolean value */ ptr S_logtest(ptr x, ptr y) { ptr tc = get_thread_context(); if (Sfixnump(x)) { if (Sfixnump(y)) { return Sboolean((iptr)x & (iptr)y); } else { iptr xl; IBOOL xs; FIXNUM_TO_BIGNUM(tc,X(tc),x,&xl,&xs) return big_logtest(y, X(tc), BIGLEN(y), xl, BIGSIGN(y), xs); } } else { if (Sfixnump(y)) { iptr yl; IBOOL ys; FIXNUM_TO_BIGNUM(tc,Y(tc),y,&yl,&ys) return big_logtest(x, Y(tc), BIGLEN(x), yl, BIGSIGN(x), ys); } else { if (BIGLEN(x) >= BIGLEN(y)) return big_logtest(x, y, BIGLEN(x), BIGLEN(y), BIGSIGN(x), BIGSIGN(y)); else return big_logtest(y, x, BIGLEN(y), BIGLEN(x), BIGSIGN(y), BIGSIGN(x)); } } } /* essentially the same logic as big_logand, but just produces true iff logand would return a nonzero value */ /* assumes xl >= yl */ static ptr big_logtest(ptr x, ptr y, iptr xl, iptr yl, IBOOL xs, IBOOL ys) { iptr i; bigit *xp, *yp; if (xs == 0) { if (ys == 0) { xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); for (i = yl; i > 0; i -= 1) if (*--xp & *--yp) return Strue; return Sfalse; } else { bigit yb; if (xl > yl) return Strue; xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); yb = 1; i = yl; for (;;) { bigit t1 = *--yp, t2 = t1 - yb; if (*--xp & ~t2) return Strue; if (--i == 0) return Sfalse; yb = t2 > t1; } } } else { if (ys == 0) { bigit xb; xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); xb = 1; i = yl; for (;;) { bigit t1 = *--xp, t2 = t1 - xb; if (*--yp & ~t2) return Strue; if (--i == 0) return Sfalse; xb = t2 > t1; } } else { /* logand of two negative bignums is always nonzero */ return Strue; } } } /* k must be a nonnegative fixnum. x may be a bignum or fixnum */ ptr S_logbitp(ptr k, ptr x) { uptr n = UNFIX(k); if (Sfixnump(x)) { if (n >= fixnum_bits) return Sboolean((iptr)x < 0); else return Sboolean((iptr)x & ((iptr)FIX(1) << n)); } else { return big_logbitp(n, x, BIGLEN(x), BIGSIGN(x)); } } /* similar logic to big_logand */ static ptr big_logbitp(iptr n, ptr x, iptr xl, IBOOL xs) { iptr i; bigit *xp; if (xs == 0) { i = xl - (n / bigit_bits + 1); if (i < 0) return Sfalse; n = n % bigit_bits; return Sboolean(BIGIT(x,i) & (1 << n)); } else { bigit xb; /* get out quick when 2^n has more bigits than x */ if (n / bigit_bits >= xl) return Strue; xp = &BIGIT(x,xl); xb = 1; for (i = xl; ; i -= 1) { bigit t1 = *--xp, t2 = t1 - xb; if (n < bigit_bits) return Sboolean(~t2 & (1 << n)); xb = t2 > t1; n -= bigit_bits; } } } /* k must be a nonnegative fixnum. x may be a bignum or fixnum */ ptr S_logbit0(ptr k, ptr x) { ptr tc = get_thread_context(); iptr n = UNFIX(k); if (Sfixnump(x)) { if (n < fixnum_bits - 1) { return FIX(UNFIX(x) & ~(1 << n)); } else { iptr xl; IBOOL xs; FIXNUM_TO_BIGNUM(tc,X(tc),x,&xl,&xs); return big_logbit0(tc, x, n, X(tc), xl, xs); } } else { return big_logbit0(tc, x, n, x, BIGLEN(x), BIGSIGN(x)); } } /* logbit0 on signed-magnitude bignums y = 1 << n s&(x,~y) = x&~y know result >= 0 s&(-x,~y) = -#(#x&~y) know result < 0 = -(~(~(x-1)&~y)+1) = -(((x-1)|y)+1) */ /* adapted from big_logor algorithm */ static ptr big_logbit0(ptr tc, ptr origx, iptr n, ptr x, iptr xl, IBOOL xs) { iptr i; bigit *xp, *zp; iptr yl = (n / bigit_bits) + 1; if (xs == 0) { if (yl > xl) { /* we'd just be clearing a bit that's already (virtually) cleared */ return origx; } else { PREPARE_BIGNUM(tc, W(tc),xl); xp = &BIGIT(x,xl); zp = &BIGIT(W(tc),xl); for (;;) { if (n < bigit_bits) break; *--zp = *--xp; n -= bigit_bits; } *--zp = *--xp & ~(1 << n); for (i = xl - yl; i > 0; i -= 1) *--zp = *--xp; return copy_normalize(tc, zp,xl,0); } } else { bigit xb, k, x1, x2, z1, z2; iptr zl = (yl > xl ? yl : xl) + 1; PREPARE_BIGNUM(tc, W(tc),zl); xp = &BIGIT(x,xl); zp = &BIGIT(W(tc),zl); k = xb = 1; i = xl; for (;;) { if (i > 0) { x1 = *--xp; i -= 1; } else x1 = 0; x2 = x1 - xb; xb = x2 > x1; if (n < bigit_bits) break; z1 = x2; z2 = z1 + k; k = z2 < z1; *--zp = z2; n -= bigit_bits; } z1 = x2 | (1 << n); z2 = z1 + k; k = z2 < z1; *--zp = z2; for (; i > 0; i -= 1) { x1 = *--xp; x2 = x1 - xb; xb = x2 > x1; z1 = x2; z2 = z1 + k; k = z2 < z1; *--zp = z2; } *--zp = k; return copy_normalize(tc, zp, zl, 1); } } /* k must be a nonnegative fixnum. x may be a bignum or fixnum */ ptr S_logbit1(ptr k, ptr x) { ptr tc = get_thread_context(); iptr n = UNFIX(k); if (Sfixnump(x)) { if (n < fixnum_bits - 1) { return FIX(UNFIX(x) | ((uptr)1 << n)); } else { iptr xl; IBOOL xs; FIXNUM_TO_BIGNUM(tc,X(tc),x,&xl,&xs); return big_logbit1(tc, x, n, X(tc), xl, xs); } } else { return big_logbit1(tc, x, n, x, BIGLEN(x), BIGSIGN(x)); } } /* adapted from big_logor algorithm */ static ptr big_logbit1(ptr tc, ptr origx, iptr n, ptr x, iptr xl, IBOOL xs) { iptr i; bigit *xp, *zp; iptr yl = (n / bigit_bits) + 1; if (xs == 0) { bigit x1; iptr zl = yl > xl ? yl : xl; PREPARE_BIGNUM(tc, W(tc),zl); xp = &BIGIT(x,xl); zp = &BIGIT(W(tc),zl); i = xl; for (;;) { if (i > 0) { x1 = *--xp; i -= 1; } else x1 = 0; if (n < bigit_bits) break; *--zp = x1; n -= bigit_bits; } *--zp = x1 | (1 << n); for (; i > 0; i -= 1) *--zp = *--xp; return copy_normalize(tc, zp, zl, 0); } else if (yl > xl) { /* we'd just be setting a bit that's already (virtually) set */ return origx; } else { /* xl >= yl */ bigit xb, k, x1, x2, z1, z2; iptr zl = xl + 1; PREPARE_BIGNUM(tc, W(tc),zl); xp = &BIGIT(x,xl); zp = &BIGIT(W(tc),zl); k = xb = 1; for (;;) { x1 = *--xp; x2 = x1 - xb; xb = x2 > x1; if (n < bigit_bits) break; z1 = x2; z2 = z1 + k; k = z2 < z1; *--zp = z2; n -= bigit_bits; } z1 = x2 & ~(1 << n); z2 = z1 + k; k = z2 < z1; *--zp = z2; for (i = xl - yl; i > 0; i -= 1) { x1 = *--xp; x2 = x1 - xb; xb = x2 > x1; z1 = x2; z2 = z1 + k; k = z2 < z1; *--zp = z2; } *--zp = k; return copy_normalize(tc, zp, zl, 1); } } ptr S_logor(ptr x, ptr y) { ptr tc = get_thread_context(); if (Sfixnump(x)) { if (Sfixnump(y)) { return (ptr)((iptr)x | (iptr)(y)); } else { iptr xl; IBOOL xs; FIXNUM_TO_BIGNUM(tc,X(tc),x,&xl,&xs) return big_logor(tc, y, X(tc), BIGLEN(y), xl, BIGSIGN(y), xs); } } else { if (Sfixnump(y)) { iptr yl; IBOOL ys; FIXNUM_TO_BIGNUM(tc,Y(tc),y,&yl,&ys) return big_logor(tc, x, Y(tc), BIGLEN(x), yl, BIGSIGN(x), ys); } else { if (BIGLEN(x) >= BIGLEN(y)) return big_logor(tc, x, y, BIGLEN(x), BIGLEN(y), BIGSIGN(x), BIGSIGN(y)); else return big_logor(tc, y, x, BIGLEN(y), BIGLEN(x), BIGSIGN(y), BIGSIGN(x)); } } } /* logor on signed-magnitude bignums s|(x,y) = x|y know result >= 0 s|(x,-y) = -(#(x|#y)) know result < 0 = -(~(x|~(y-1))+1) = -(((y-1)&~x)+1) s|(-x,y) = -(((x-1)&~y)+1) s|(-x,-y) = -(#(#x|#y)) know result < 0 = -(~(~(x-1)|~(y-1))+1) = -(((x-1)&(y-1))+1) de morgan's law */ /* assumes xl >= yl */ static ptr big_logor(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL xs, IBOOL ys) { iptr i; bigit *xp, *yp, *zp; if (xs == 0) { if (ys == 0) { PREPARE_BIGNUM(tc, W(tc),xl); xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); zp = &BIGIT(W(tc),xl); for (i = yl; i > 0; i -= 1) *--zp = *--xp | *--yp; for (i = xl - yl; i > 0; i -= 1) *--zp = *--xp; return copy_normalize(tc, zp, xl, 0); } else { bigit yb, k; PREPARE_BIGNUM(tc, W(tc),yl+1); xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); zp = &BIGIT(W(tc),yl+1); k = yb = 1; for (i = yl; i > 0; i -= 1) { bigit y1, y2, z1, z2; y1 = *--yp; y2 = y1 - yb; yb = y2 > y1; z1 = y2 & ~*--xp; z2 = z1 + k; k = z2 < z1; *--zp = z2; } *--zp = k; return copy_normalize(tc, zp, yl+1, 1); } } else { if (ys == 0) { bigit xb, k; PREPARE_BIGNUM(tc, W(tc),xl+1); xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); zp = &BIGIT(W(tc),xl+1); k = xb = 1; for (i = yl; i > 0; i -= 1) { bigit x1, x2, z1, z2; x1 = *--xp; x2 = x1 - xb; xb = x2 > x1; z1 = x2 & ~*--yp; z2 = z1 + k; k = z2 < z1; *--zp = z2; } for (i = xl - yl; i > 0; i -= 1) { bigit x1, x2, z1, z2; x1 = *--xp; x2 = x1 - xb; xb = x2 > x1; z1 = x2; z2 = z1 + k; k = z2 < z1; *--zp = z2; } *--zp = k; return copy_normalize(tc, zp, xl+1, 1); } else { bigit xb, yb, k; PREPARE_BIGNUM(tc, W(tc),yl+1); xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); zp = &BIGIT(W(tc),yl+1); k = yb = xb = 1; for (i = yl; i > 0; i -= 1) { bigit x1, x2, y1, y2, z1, z2; x1 = *--xp; x2 = x1 - xb; xb = x2 > x1; y1 = *--yp; y2 = y1 - yb; yb = y2 > y1; z1 = x2 & y2; z2 = z1 + k; k = z2 < z1; *--zp = z2; } *--zp = k; return copy_normalize(tc, zp, yl+1, 1); } } } ptr S_logxor(ptr x, ptr y) { ptr tc = get_thread_context(); if (Sfixnump(x)) { if (Sfixnump(y)) { return (ptr)((iptr)x ^ (iptr)(y)); } else { iptr xl; IBOOL xs; FIXNUM_TO_BIGNUM(tc,X(tc),x,&xl,&xs) return big_logxor(tc, y, X(tc), BIGLEN(y), xl, BIGSIGN(y), xs); } } else { if (Sfixnump(y)) { iptr yl; IBOOL ys; FIXNUM_TO_BIGNUM(tc,Y(tc),y,&yl,&ys) return big_logxor(tc, x, Y(tc), BIGLEN(x), yl, BIGSIGN(x), ys); } else { if (BIGLEN(x) >= BIGLEN(y)) return big_logxor(tc, x, y, BIGLEN(x), BIGLEN(y), BIGSIGN(x), BIGSIGN(y)); else return big_logxor(tc, y, x, BIGLEN(y), BIGLEN(x), BIGSIGN(y), BIGSIGN(x)); } } } /* logxor on signed-magnitude bignums s^(x,y) = x^y know result >= 0 s^(x,-y) = -(#(x^#y)) know result < 0 = -(~(x^~(y-1))+1) = -((x^(y-1))+1) since ~(a^~b) = a^b s^(-x,y) = -((y^(x-1))+1) s^(-x,-y) = #x^#y know result >= 0 = ~(x-1)^~(y-1) = (x-1)^(y-1) since ~a^~b = a^b */ /* assumes xl >= yl */ static ptr big_logxor(ptr tc, ptr x, ptr y, iptr xl, iptr yl, IBOOL xs, IBOOL ys) { iptr i; bigit *xp, *yp, *zp; if (xs == 0) { if (ys == 0) { PREPARE_BIGNUM(tc, W(tc),xl); xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); zp = &BIGIT(W(tc),xl); for (i = yl; i > 0; i -= 1) *--zp = *--xp ^ *--yp; for (i = xl - yl; i > 0; i -= 1) *--zp = *--xp; return copy_normalize(tc, zp, xl, 0); } else { bigit yb, k; PREPARE_BIGNUM(tc, W(tc),xl+1); xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); zp = &BIGIT(W(tc),xl+1); k = yb = 1; for (i = yl; i > 0; i -= 1) { bigit y1, y2, z1, z2; y1 = *--yp; y2 = y1 - yb; yb = y2 > y1; z1 = *--xp ^ y2; z2 = z1 + k; k = z2 < z1; *--zp = z2; } for (i = xl - yl; i > 0; i -= 1) { bigit z1, z2; z1 = *--xp; z2 = z1 + k; k = z2 < z1; *--zp = z2; } *--zp = k; return copy_normalize(tc, zp, xl+1, 1); } } else { if (ys == 0) { bigit xb, k; PREPARE_BIGNUM(tc, W(tc),xl+1); xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); zp = &BIGIT(W(tc),xl+1); k = xb = 1; for (i = yl; i > 0; i -= 1) { bigit x1, x2, z1, z2; x1 = *--xp; x2 = x1 - xb; xb = x2 > x1; z1 = *--yp ^ x2; z2 = z1 + k; k = z2 < z1; *--zp = z2; } for (i = xl - yl; i > 0; i -= 1) { bigit x1, x2, z1, z2; x1 = *--xp; x2 = x1 - xb; xb = x2 > x1; z1 = x2; z2 = z1 + k; k = z2 < z1; *--zp = z2; } *--zp = k; return copy_normalize(tc, zp, xl+1, 1); } else { bigit xb, yb; PREPARE_BIGNUM(tc, W(tc),xl); xp = &BIGIT(x,xl); yp = &BIGIT(y,yl); zp = &BIGIT(W(tc),xl); yb = xb = 1; for (i = yl; i > 0; i -= 1) { bigit x1, x2, y1, y2; x1 = *--xp; x2 = x1 - xb; xb = x2 > x1; y1 = *--yp; y2 = y1 - yb; yb = y2 > y1; *--zp = x2 ^ y2; } for (i = xl - yl; i > 0; i -= 1) { bigit x1, x2; x1 = *--xp; x2 = x1 - xb; xb = x2 > x1; *--zp = x2; } return copy_normalize(tc, zp, xl, 0); } } } /* lognot on signed-magnitude bignums: s~(x) = -#~x = -(~~x+1) = -(x+1) s~(-x) = ~#x = ~~(x-1) = x-1 therefore: (define (lognot x) (if (< x 0) (- (- x) 1) (- (+ x 1)))) simplifying: (define (lognot x) (- -1 x)) */ ptr S_lognot(ptr x) { if (Sfixnump(x)) { return FIX(~UNFIX(x)); } else { return S_sub(FIX(-1), x); } } void S_number_init(void) { if ((int)(hidden_bit >> 22) != 0x40000000) { fprintf(stderr, "hidden_bit >> 22 = %x\n", (int)(hidden_bit >> 22)); S_abnormal_exit(); } }
1c269cc677a8822e4c3032cd2a5085437de588cb
85b4bbde9e0ec36b0db29463281c36b24e1f161d
/cond/x_cast_qcqp.c
5bcc4ae5d0946ccfe1a4e7dbeca3d0b02e4101ad
[ "BSD-2-Clause" ]
permissive
giaf/hpipm
9617000b88c3a65842154e86209a09a067fe34ac
b5239f756181918f97deca39884d12dc6286dc73
refs/heads/master
2023-08-17T01:13:25.056738
2023-08-15T15:02:11
2023-08-15T15:02:11
91,068,419
398
120
NOASSERTION
2023-08-15T20:51:27
2017-05-12T08:20:10
C
UTF-8
C
false
false
7,242
c
x_cast_qcqp.c
/************************************************************************************************** * * * This file is part of HPIPM. * * * * HPIPM -- High-Performance Interior Point Method. * * Copyright (C) 2019 by Gianluca Frison. * * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * * All rights reserved. * * * * The 2-Clause BSD 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. * * * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * * * **************************************************************************************************/ void CAST_QCQP_COMPUTE_DIM(struct OCP_QCQP_DIM *ocp_dim, struct DENSE_QCQP_DIM *dense_dim) { int N = ocp_dim->N; int *nx = ocp_dim->nx; int *nu = ocp_dim->nu; int *nbx = ocp_dim->nbx; int *nbu = ocp_dim->nbu; int *ng = ocp_dim->ng; int *nq = ocp_dim->nq; int *ns = ocp_dim->ns; int *nsbx = ocp_dim->nsbx; int *nsbu = ocp_dim->nsbu; int *nsg = ocp_dim->nsg; int *nsq = ocp_dim->nsq; int ii; int nvc = 0; int nec = 0; int nbc = 0; int ngc = 0; int nqc = 0; int nsc = 0; int nsbc = 0; int nsgc = 0; int nsqc = 0; // first stage nvc += nx[0]+nu[0]; nec = 0; nbc += nbx[0]+nbu[0]; ngc += ng[0]; nqc += nq[0]; nsc += ns[0]; nsbc += nsbx[0]+nsbu[0]; nsgc += nsg[0]; nsqc += nsq[0]; // remaining stages for(ii=1; ii<=N; ii++) { nvc += nx[ii]+nu[ii]; nec += nx[ii]; nbc += nbx[ii]+nbu[ii]; ngc += ng[ii]; nqc += nq[ii]; nsc += ns[ii]; nsbc += nsbx[ii]+nsbu[ii]; nsgc += nsg[ii]; nsqc += nsq[ii]; } // XXX must use setters to correctly set qp ones too ! DENSE_QCQP_DIM_SET_NV(nvc, dense_dim); DENSE_QCQP_DIM_SET_NE(nec, dense_dim); DENSE_QCQP_DIM_SET_NB(nbc, dense_dim); DENSE_QCQP_DIM_SET_NG(ngc, dense_dim); DENSE_QCQP_DIM_SET_NQ(nqc, dense_dim); DENSE_QCQP_DIM_SET_NS(nsc, dense_dim); DENSE_QCQP_DIM_SET_NSB(nsbc, dense_dim); DENSE_QCQP_DIM_SET_NSG(nsgc, dense_dim); DENSE_QCQP_DIM_SET_NSQ(nsqc, dense_dim); return; } void CAST_QCQP_COND(struct OCP_QCQP *ocp_qp, struct DENSE_QCQP *dense_qp) { int ii, jj; int N = ocp_qp->dim->N; int *nu = ocp_qp->dim->nu; int *nx = ocp_qp->dim->nx; int *nb = ocp_qp->dim->nb; int *ng = ocp_qp->dim->ng; int *nq = ocp_qp->dim->nq; // int nvc = dense_qp->dim->nv; // int nec = dense_qp->dim->ne; int nbc = dense_qp->dim->nb; int ngc = dense_qp->dim->ng; int nqc = dense_qp->dim->nq; int idxc, idxr, idxq; // cost idxr = 0; idxc = 0; for(ii=0; ii<=N; ii++) { GECP(nu[ii]+nx[ii], nu[ii]+nx[ii], ocp_qp->RSQrq+ii, 0, 0, dense_qp->Hv, idxr, idxc); VECCP(nu[ii]+nx[ii], ocp_qp->rqz+ii, 0, dense_qp->gz, idxr); idxr += nu[ii]+nx[ii]; idxc += nu[ii]+nx[ii]; } // dynamics idxr = 0; idxc = 0; for(ii=0; ii<N; ii++) { GETR(nu[ii]+nx[ii], nx[ii+1], ocp_qp->BAbt+ii, 0, 0, dense_qp->A, idxr, idxc); DIARE(nx[ii+1], -1.0, dense_qp->A, idxr, idxc+nu[ii]+nx[ii]+nu[ii+1]); VECCP(nx[ii+1], ocp_qp->b+ii, 0, dense_qp->b, idxr); idxr += nx[ii+1]; idxc += nu[ii]+nx[ii]; } // box constraints idxr = 0; idxc = 0; for(ii=0; ii<=N; ii++) { VECCP(nb[ii], ocp_qp->d+ii, 0, dense_qp->d, idxr); VECCP(nb[ii], ocp_qp->d+ii, nb[ii]+ng[ii]+nq[ii], dense_qp->d, idxr+nbc+ngc+nqc); for(jj=0; jj<nb[ii]; jj++) dense_qp->idxb[idxr+jj] = ocp_qp->idxb[ii][jj] + idxc; idxr += nb[ii]; idxc += nu[ii]+nx[ii]; } // general constraints idxr = 0; idxc = 0; for(ii=0; ii<=N; ii++) { VECCP(ng[ii], ocp_qp->d+ii, nb[ii], dense_qp->d, idxr+nbc); VECCP(ng[ii], ocp_qp->d+ii, 2*nb[ii]+ng[ii]+nq[ii], dense_qp->d, idxr+2*nbc+ngc+nqc); GECP(nu[ii]+nx[ii], ng[ii], ocp_qp->DCt+ii, 0, 0, dense_qp->Ct, idxc, idxr); idxr += ng[ii]; idxc += nu[ii]+nx[ii]; } // quadratic constraints idxr = 0; idxc = 0; idxq = 0; for(ii=0; ii<=N; ii++) { for(jj=0; jj<nq[ii]; jj++) { GECP(nu[ii]+nx[ii], nu[ii]+nx[ii], ocp_qp->Hq[ii]+jj, 0, 0, dense_qp->Hq+idxq, idxr, idxc); idxq++; } idxr += nu[ii]+nx[ii]; idxc += nu[ii]+nx[ii]; } idxr = 0; idxc = 0; for(ii=0; ii<=N; ii++) { GECP(nu[ii]+nx[ii], nq[ii], ocp_qp->DCt+ii, 0, ng[ii], dense_qp->Ct, idxr, ngc+idxc); idxr += nu[ii]+nx[ii]; idxc += nq[ii]; } idxr = 0; idxc = 0; for(ii=0; ii<=N; ii++) { // VECCP(nb[ii], ocp_qp->d+ii, 0, dense_qp->d, idxr); VECCP(nq[ii], ocp_qp->d+ii, 2*nb[ii]+2*ng[ii]+nq[ii], dense_qp->d, idxr+2*nbc+2*ngc+nqc); idxr += nq[ii]; } // TODO soft constraints return; }
b4a07b985a9ad411be7fbabb7b913367471f4d11
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
/security/wpa_supplicant29/files/patch-src_radius_radius__client.c
de86947f57b251039e7535bede6add4e8c8c5d36
[ "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
486
c
patch-src_radius_radius__client.c
--- src/radius/radius_client.c.orig 2019-08-07 06:25:25.000000000 -0700 +++ src/radius/radius_client.c 2021-01-11 08:35:20.860835000 -0800 @@ -814,6 +814,9 @@ { struct radius_client_data *radius = eloop_ctx; struct hostapd_radius_servers *conf = radius->conf; +#if defined(__clang_major__) && __clang_major__ >= 11 +#pragma GCC diagnostic ignored "-Wvoid-pointer-to-enum-cast" +#endif RadiusType msg_type = (RadiusType) sock_ctx; int len, roundtrip; unsigned char buf[3000];
a254ff7d73774d0cca431b2d58a503879f84d70a
336d3942e52ba91604d479e590a1e35d6d7c14a4
/deps/jemalloc/include/jemalloc/internal/sec.h
fa863382db97ffa4526af53e99c0a81f2ae9c0dd
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
redis/redis
8fb932a09677ed8854c94d81c941655eceda2138
e792653753dc62b5a00822121e585511542a024b
refs/heads/unstable
2023-08-29T14:53:21.757052
2023-08-27T08:42:55
2023-08-27T08:42:55
156,018
19,822
6,754
BSD-3-Clause
2023-09-14T18:06:48
2009-03-21T22:32:25
C
UTF-8
C
false
false
4,172
h
sec.h
#ifndef JEMALLOC_INTERNAL_SEC_H #define JEMALLOC_INTERNAL_SEC_H #include "jemalloc/internal/atomic.h" #include "jemalloc/internal/pai.h" /* * Small extent cache. * * This includes some utilities to cache small extents. We have a per-pszind * bin with its own list of extents of that size. We don't try to do any * coalescing of extents (since it would in general require cross-shard locks or * knowledge of the underlying PAI implementation). */ /* * For now, this is just one field; eventually, we'll probably want to get more * fine-grained data out (like per-size class statistics). */ typedef struct sec_stats_s sec_stats_t; struct sec_stats_s { /* Sum of bytes_cur across all shards. */ size_t bytes; }; static inline void sec_stats_accum(sec_stats_t *dst, sec_stats_t *src) { dst->bytes += src->bytes; } /* A collections of free extents, all of the same size. */ typedef struct sec_bin_s sec_bin_t; struct sec_bin_s { /* * When we fail to fulfill an allocation, we do a batch-alloc on the * underlying allocator to fill extra items, as well. We drop the SEC * lock while doing so, to allow operations on other bins to succeed. * That introduces the possibility of other threads also trying to * allocate out of this bin, failing, and also going to the backing * allocator. To avoid a thundering herd problem in which lots of * threads do batch allocs and overfill this bin as a result, we only * allow one batch allocation at a time for a bin. This bool tracks * whether or not some thread is already batch allocating. * * Eventually, the right answer may be a smarter sharding policy for the * bins (e.g. a mutex per bin, which would also be more scalable * generally; the batch-allocating thread could hold it while * batch-allocating). */ bool being_batch_filled; /* * Number of bytes in this particular bin (as opposed to the * sec_shard_t's bytes_cur. This isn't user visible or reported in * stats; rather, it allows us to quickly determine the change in the * centralized counter when flushing. */ size_t bytes_cur; edata_list_active_t freelist; }; typedef struct sec_shard_s sec_shard_t; struct sec_shard_s { /* * We don't keep per-bin mutexes, even though that would allow more * sharding; this allows global cache-eviction, which in turn allows for * better balancing across free lists. */ malloc_mutex_t mtx; /* * A SEC may need to be shut down (i.e. flushed of its contents and * prevented from further caching). To avoid tricky synchronization * issues, we just track enabled-status in each shard, guarded by a * mutex. In practice, this is only ever checked during brief races, * since the arena-level atomic boolean tracking HPA enabled-ness means * that we won't go down these pathways very often after custom extent * hooks are installed. */ bool enabled; sec_bin_t *bins; /* Number of bytes in all bins in the shard. */ size_t bytes_cur; /* The next pszind to flush in the flush-some pathways. */ pszind_t to_flush_next; }; typedef struct sec_s sec_t; struct sec_s { pai_t pai; pai_t *fallback; sec_opts_t opts; sec_shard_t *shards; pszind_t npsizes; }; bool sec_init(tsdn_t *tsdn, sec_t *sec, base_t *base, pai_t *fallback, const sec_opts_t *opts); void sec_flush(tsdn_t *tsdn, sec_t *sec); void sec_disable(tsdn_t *tsdn, sec_t *sec); /* * Morally, these two stats methods probably ought to be a single one (and the * mutex_prof_data ought to live in the sec_stats_t. But splitting them apart * lets them fit easily into the pa_shard stats framework (which also has this * split), which simplifies the stats management. */ void sec_stats_merge(tsdn_t *tsdn, sec_t *sec, sec_stats_t *stats); void sec_mutex_stats_read(tsdn_t *tsdn, sec_t *sec, mutex_prof_data_t *mutex_prof_data); /* * We use the arena lock ordering; these are acquired in phase 2 of forking, but * should be acquired before the underlying allocator mutexes. */ void sec_prefork2(tsdn_t *tsdn, sec_t *sec); void sec_postfork_parent(tsdn_t *tsdn, sec_t *sec); void sec_postfork_child(tsdn_t *tsdn, sec_t *sec); #endif /* JEMALLOC_INTERNAL_SEC_H */
3d47a407075408f022711ad7cb71d8ab7bbad317
676acab8ff535019faff7da3afb8eecc3fa127f5
/src/lib/mavlink/v2.0/common/mavlink_msg_safety_set_allowed_area.h
4fc862b40d5947b77591248672fd3cb53f63c1a1
[ "Apache-2.0" ]
permissive
Firmament-Autopilot/FMT-Firmware
f8c324577245bd7e91af436954b4ce9421acbb41
0212fe89820376bfbedaded519552f6b011a7b8a
refs/heads/master
2023-09-01T11:37:46.194145
2023-08-29T06:33:10
2023-08-29T06:33:10
402,557,689
351
143
Apache-2.0
2023-09-12T05:28:39
2021-09-02T20:42:56
C
UTF-8
C
false
false
21,285
h
mavlink_msg_safety_set_allowed_area.h
#pragma once // MESSAGE SAFETY_SET_ALLOWED_AREA PACKING #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA 54 typedef struct __mavlink_safety_set_allowed_area_t { float p1x; /*< [m] x position 1 / Latitude 1*/ float p1y; /*< [m] y position 1 / Longitude 1*/ float p1z; /*< [m] z position 1 / Altitude 1*/ float p2x; /*< [m] x position 2 / Latitude 2*/ float p2y; /*< [m] y position 2 / Longitude 2*/ float p2z; /*< [m] z position 2 / Altitude 2*/ uint8_t target_system; /*< System ID*/ uint8_t target_component; /*< Component ID*/ uint8_t frame; /*< Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.*/ } mavlink_safety_set_allowed_area_t; #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN 27 #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN 27 #define MAVLINK_MSG_ID_54_LEN 27 #define MAVLINK_MSG_ID_54_MIN_LEN 27 #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC 15 #define MAVLINK_MSG_ID_54_CRC 15 #if MAVLINK_COMMAND_24BIT #define MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA \ { \ 54, \ "SAFETY_SET_ALLOWED_AREA", \ 9, \ { \ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_set_allowed_area_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_safety_set_allowed_area_t, target_component) }, \ { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_safety_set_allowed_area_t, frame) }, \ { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_set_allowed_area_t, p1x) }, \ { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_set_allowed_area_t, p1y) }, \ { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_set_allowed_area_t, p1z) }, \ { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_set_allowed_area_t, p2x) }, \ { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_set_allowed_area_t, p2y) }, \ { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_set_allowed_area_t, p2z) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA \ { \ "SAFETY_SET_ALLOWED_AREA", \ 9, \ { \ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_set_allowed_area_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_safety_set_allowed_area_t, target_component) }, \ { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_safety_set_allowed_area_t, frame) }, \ { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_set_allowed_area_t, p1x) }, \ { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_set_allowed_area_t, p1y) }, \ { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_set_allowed_area_t, p1z) }, \ { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_set_allowed_area_t, p2x) }, \ { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_set_allowed_area_t, p2y) }, \ { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_set_allowed_area_t, p2z) }, \ } \ } #endif /** * @brief Pack a safety_set_allowed_area message * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * * @param target_system System ID * @param target_component Component ID * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. * @param p1x [m] x position 1 / Latitude 1 * @param p1y [m] y position 1 / Longitude 1 * @param p1z [m] z position 1 / Altitude 1 * @param p2x [m] x position 2 / Latitude 2 * @param p2y [m] y position 2 / Longitude 2 * @param p2z [m] z position 2 / Altitude 2 * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_safety_set_allowed_area_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN]; _mav_put_float(buf, 0, p1x); _mav_put_float(buf, 4, p1y); _mav_put_float(buf, 8, p1z); _mav_put_float(buf, 12, p2x); _mav_put_float(buf, 16, p2y); _mav_put_float(buf, 20, p2z); _mav_put_uint8_t(buf, 24, target_system); _mav_put_uint8_t(buf, 25, target_component); _mav_put_uint8_t(buf, 26, frame); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN); #else mavlink_safety_set_allowed_area_t packet; packet.p1x = p1x; packet.p1y = p1y; packet.p1z = p1z; packet.p2x = p2x; packet.p2y = p2y; packet.p2z = p2z; packet.target_system = target_system; packet.target_component = target_component; packet.frame = frame; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN); #endif msg->msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA; return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC); } /** * @brief Pack a safety_set_allowed_area message on a channel * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param target_system System ID * @param target_component Component ID * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. * @param p1x [m] x position 1 / Latitude 1 * @param p1y [m] y position 1 / Longitude 1 * @param p1z [m] z position 1 / Altitude 1 * @param p2x [m] x position 2 / Latitude 2 * @param p2y [m] y position 2 / Longitude 2 * @param p2z [m] z position 2 / Altitude 2 * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_safety_set_allowed_area_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN]; _mav_put_float(buf, 0, p1x); _mav_put_float(buf, 4, p1y); _mav_put_float(buf, 8, p1z); _mav_put_float(buf, 12, p2x); _mav_put_float(buf, 16, p2y); _mav_put_float(buf, 20, p2z); _mav_put_uint8_t(buf, 24, target_system); _mav_put_uint8_t(buf, 25, target_component); _mav_put_uint8_t(buf, 26, frame); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN); #else mavlink_safety_set_allowed_area_t packet; packet.p1x = p1x; packet.p1y = p1y; packet.p1z = p1z; packet.p2x = p2x; packet.p2y = p2y; packet.p2z = p2z; packet.target_system = target_system; packet.target_component = target_component; packet.frame = frame; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN); #endif msg->msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA; return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC); } /** * @brief Encode a safety_set_allowed_area struct * * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * @param safety_set_allowed_area C-struct to read the message contents from */ static inline uint16_t mavlink_msg_safety_set_allowed_area_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_safety_set_allowed_area_t* safety_set_allowed_area) { return mavlink_msg_safety_set_allowed_area_pack(system_id, component_id, msg, safety_set_allowed_area->target_system, safety_set_allowed_area->target_component, safety_set_allowed_area->frame, safety_set_allowed_area->p1x, safety_set_allowed_area->p1y, safety_set_allowed_area->p1z, safety_set_allowed_area->p2x, safety_set_allowed_area->p2y, safety_set_allowed_area->p2z); } /** * @brief Encode a safety_set_allowed_area struct on a channel * * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param safety_set_allowed_area C-struct to read the message contents from */ static inline uint16_t mavlink_msg_safety_set_allowed_area_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_safety_set_allowed_area_t* safety_set_allowed_area) { return mavlink_msg_safety_set_allowed_area_pack_chan(system_id, component_id, chan, msg, safety_set_allowed_area->target_system, safety_set_allowed_area->target_component, safety_set_allowed_area->frame, safety_set_allowed_area->p1x, safety_set_allowed_area->p1y, safety_set_allowed_area->p1z, safety_set_allowed_area->p2x, safety_set_allowed_area->p2y, safety_set_allowed_area->p2z); } /** * @brief Send a safety_set_allowed_area message * @param chan MAVLink channel to send the message * * @param target_system System ID * @param target_component Component ID * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. * @param p1x [m] x position 1 / Latitude 1 * @param p1y [m] y position 1 / Longitude 1 * @param p1z [m] z position 1 / Altitude 1 * @param p2x [m] x position 2 / Latitude 2 * @param p2y [m] y position 2 / Longitude 2 * @param p2z [m] z position 2 / Altitude 2 */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS static inline void mavlink_msg_safety_set_allowed_area_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN]; _mav_put_float(buf, 0, p1x); _mav_put_float(buf, 4, p1y); _mav_put_float(buf, 8, p1z); _mav_put_float(buf, 12, p2x); _mav_put_float(buf, 16, p2y); _mav_put_float(buf, 20, p2z); _mav_put_uint8_t(buf, 24, target_system); _mav_put_uint8_t(buf, 25, target_component); _mav_put_uint8_t(buf, 26, frame); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC); #else mavlink_safety_set_allowed_area_t packet; packet.p1x = p1x; packet.p1y = p1y; packet.p1z = p1z; packet.p2x = p2x; packet.p2y = p2y; packet.p2z = p2z; packet.target_system = target_system; packet.target_component = target_component; packet.frame = frame; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, (const char*)&packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC); #endif } /** * @brief Send a safety_set_allowed_area message * @param chan MAVLink channel to send the message * @param struct The MAVLink struct to serialize */ static inline void mavlink_msg_safety_set_allowed_area_send_struct(mavlink_channel_t chan, const mavlink_safety_set_allowed_area_t* safety_set_allowed_area) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS mavlink_msg_safety_set_allowed_area_send(chan, safety_set_allowed_area->target_system, safety_set_allowed_area->target_component, safety_set_allowed_area->frame, safety_set_allowed_area->p1x, safety_set_allowed_area->p1y, safety_set_allowed_area->p1z, safety_set_allowed_area->p2x, safety_set_allowed_area->p2y, safety_set_allowed_area->p2z); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, (const char*)safety_set_allowed_area, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC); #endif } #if MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* This varient of _send() can be used to save stack space by re-using memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ static inline void mavlink_msg_safety_set_allowed_area_send_buf(mavlink_message_t* msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char* buf = (char*)msgbuf; _mav_put_float(buf, 0, p1x); _mav_put_float(buf, 4, p1y); _mav_put_float(buf, 8, p1z); _mav_put_float(buf, 12, p2x); _mav_put_float(buf, 16, p2y); _mav_put_float(buf, 20, p2z); _mav_put_uint8_t(buf, 24, target_system); _mav_put_uint8_t(buf, 25, target_component); _mav_put_uint8_t(buf, 26, frame); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC); #else mavlink_safety_set_allowed_area_t* packet = (mavlink_safety_set_allowed_area_t*)msgbuf; packet->p1x = p1x; packet->p1y = p1y; packet->p1z = p1z; packet->p2x = p2x; packet->p2y = p2y; packet->p2z = p2z; packet->target_system = target_system; packet->target_component = target_component; packet->frame = frame; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, (const char*)packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC); #endif } #endif #endif // MESSAGE SAFETY_SET_ALLOWED_AREA UNPACKING /** * @brief Get field target_system from safety_set_allowed_area message * * @return System ID */ static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_system(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 24); } /** * @brief Get field target_component from safety_set_allowed_area message * * @return Component ID */ static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_component(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 25); } /** * @brief Get field frame from safety_set_allowed_area message * * @return Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. */ static inline uint8_t mavlink_msg_safety_set_allowed_area_get_frame(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 26); } /** * @brief Get field p1x from safety_set_allowed_area message * * @return [m] x position 1 / Latitude 1 */ static inline float mavlink_msg_safety_set_allowed_area_get_p1x(const mavlink_message_t* msg) { return _MAV_RETURN_float(msg, 0); } /** * @brief Get field p1y from safety_set_allowed_area message * * @return [m] y position 1 / Longitude 1 */ static inline float mavlink_msg_safety_set_allowed_area_get_p1y(const mavlink_message_t* msg) { return _MAV_RETURN_float(msg, 4); } /** * @brief Get field p1z from safety_set_allowed_area message * * @return [m] z position 1 / Altitude 1 */ static inline float mavlink_msg_safety_set_allowed_area_get_p1z(const mavlink_message_t* msg) { return _MAV_RETURN_float(msg, 8); } /** * @brief Get field p2x from safety_set_allowed_area message * * @return [m] x position 2 / Latitude 2 */ static inline float mavlink_msg_safety_set_allowed_area_get_p2x(const mavlink_message_t* msg) { return _MAV_RETURN_float(msg, 12); } /** * @brief Get field p2y from safety_set_allowed_area message * * @return [m] y position 2 / Longitude 2 */ static inline float mavlink_msg_safety_set_allowed_area_get_p2y(const mavlink_message_t* msg) { return _MAV_RETURN_float(msg, 16); } /** * @brief Get field p2z from safety_set_allowed_area message * * @return [m] z position 2 / Altitude 2 */ static inline float mavlink_msg_safety_set_allowed_area_get_p2z(const mavlink_message_t* msg) { return _MAV_RETURN_float(msg, 20); } /** * @brief Decode a safety_set_allowed_area message into a struct * * @param msg The message to decode * @param safety_set_allowed_area C-struct to decode the message contents into */ static inline void mavlink_msg_safety_set_allowed_area_decode(const mavlink_message_t* msg, mavlink_safety_set_allowed_area_t* safety_set_allowed_area) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS safety_set_allowed_area->p1x = mavlink_msg_safety_set_allowed_area_get_p1x(msg); safety_set_allowed_area->p1y = mavlink_msg_safety_set_allowed_area_get_p1y(msg); safety_set_allowed_area->p1z = mavlink_msg_safety_set_allowed_area_get_p1z(msg); safety_set_allowed_area->p2x = mavlink_msg_safety_set_allowed_area_get_p2x(msg); safety_set_allowed_area->p2y = mavlink_msg_safety_set_allowed_area_get_p2y(msg); safety_set_allowed_area->p2z = mavlink_msg_safety_set_allowed_area_get_p2z(msg); safety_set_allowed_area->target_system = mavlink_msg_safety_set_allowed_area_get_target_system(msg); safety_set_allowed_area->target_component = mavlink_msg_safety_set_allowed_area_get_target_component(msg); safety_set_allowed_area->frame = mavlink_msg_safety_set_allowed_area_get_frame(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN ? msg->len : MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN; memset(safety_set_allowed_area, 0, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN); memcpy(safety_set_allowed_area, _MAV_PAYLOAD(msg), len); #endif }
34e747e54aeaa972d88fc9448efd3a8e2306582c
010279e2ba272d09e9d2c4e903722e5faba2cf7a
/contrib/tools/python/src/Modules/posixmodule.c
25b0ddf668d51707793fce9d36a7f72049dfa0e6
[ "Apache-2.0" ]
permissive
catboost/catboost
854c1a1f439a96f1ae6b48e16644be20aa04dba2
f5042e35b945aded77b23470ead62d7eacefde92
refs/heads/master
2023-09-01T12:14:14.174108
2023-09-01T10:01:01
2023-09-01T10:22:12
97,556,265
8,012
1,425
Apache-2.0
2023-09-11T03:32:32
2017-07-18T05:29:04
Python
UTF-8
C
false
false
271,988
c
posixmodule.c
/* POSIX module implementation */ /* This file is also used for Windows NT/MS-Win and OS/2. In that case the module actually calls itself 'nt' or 'os2', not 'posix', and a few functions are either unimplemented or implemented differently. The source assumes that for Windows NT, the macro 'MS_WINDOWS' is defined independent of the compiler used. Different compilers define their own feature test macro, e.g. '__BORLANDC__' or '_MSC_VER'. For OS/2, the compiler independent macro PYOS_OS2 should be defined. On OS/2 the default compiler is assumed to be IBM's VisualAge C++ (VACPP). PYCC_GCC is used as the compiler specific macro for the EMX port of gcc to OS/2. */ #ifdef __APPLE__ /* * Step 1 of support for weak-linking a number of symbols existing on * OSX 10.4 and later, see the comment in the #ifdef __APPLE__ block * at the end of this file for more information. */ # pragma weak lchown # pragma weak statvfs # pragma weak fstatvfs #endif /* __APPLE__ */ #define PY_SSIZE_T_CLEAN #include "Python.h" #include "structseq.h" #ifndef MS_WINDOWS #include "posixmodule.h" #endif #if defined(__VMS) # include <unixio.h> #endif /* defined(__VMS) */ #ifdef __cplusplus extern "C" { #endif PyDoc_STRVAR(posix__doc__, "This module provides access to operating system functionality that is\n\ standardized by the C Standard and the POSIX standard (a thinly\n\ disguised Unix interface). Refer to the library manual and\n\ corresponding Unix manual entries for more information on calls."); #ifndef Py_USING_UNICODE /* This is used in signatures of functions. */ #define Py_UNICODE void #endif #if defined(PYOS_OS2) #define INCL_DOS #define INCL_DOSERRORS #define INCL_DOSPROCESS #define INCL_NOPMAPI #include <os2.h> #if defined(PYCC_GCC) #include <ctype.h> #include <io.h> #include <stdio.h> #include <process.h> #endif #include "osdefs.h" #endif #ifdef HAVE_SYS_SYSMACROS_H /* GNU C Library: major(), minor(), makedev() */ #include <sys/sysmacros.h> #endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif /* HAVE_SYS_TYPES_H */ #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #endif /* HAVE_SYS_STAT_H */ #ifdef HAVE_SYS_WAIT_H #include <sys/wait.h> /* For WNOHANG */ #endif #ifdef HAVE_SIGNAL_H #include <signal.h> #endif #ifdef HAVE_FCNTL_H #include <fcntl.h> #endif /* HAVE_FCNTL_H */ #ifdef HAVE_GRP_H #include <grp.h> #endif #ifdef HAVE_SYSEXITS_H #include <sysexits.h> #endif /* HAVE_SYSEXITS_H */ #ifdef HAVE_SYS_LOADAVG_H #include <sys/loadavg.h> #endif /* Various compilers have only certain posix functions */ /* XXX Gosh I wish these were all moved into pyconfig.h */ #if defined(PYCC_VACPP) && defined(PYOS_OS2) #include <process.h> #else #if defined(__WATCOMC__) && !defined(__QNX__) /* Watcom compiler */ #define HAVE_GETCWD 1 #define HAVE_OPENDIR 1 #define HAVE_SYSTEM 1 #if defined(__OS2__) #define HAVE_EXECV 1 #define HAVE_WAIT 1 #endif #include <process.h> #else #ifdef __BORLANDC__ /* Borland compiler */ #define HAVE_EXECV 1 #define HAVE_GETCWD 1 #define HAVE_OPENDIR 1 #define HAVE_PIPE 1 #define HAVE_POPEN 1 #define HAVE_SYSTEM 1 #define HAVE_WAIT 1 #else #ifdef _MSC_VER /* Microsoft compiler */ #define HAVE_GETCWD 1 #define HAVE_SPAWNV 1 #define HAVE_EXECV 1 #define HAVE_PIPE 1 #define HAVE_POPEN 1 #define HAVE_SYSTEM 1 #define HAVE_CWAIT 1 #define HAVE_FSYNC 1 #define fsync _commit #else #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS) /* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */ #else /* all other compilers */ /* Unix functions that the configure script doesn't check for */ #define HAVE_EXECV 1 #define HAVE_FORK 1 #if defined(__USLC__) && defined(__SCO_VERSION__) /* SCO UDK Compiler */ #define HAVE_FORK1 1 #endif #define HAVE_GETCWD 1 #define HAVE_GETEGID 1 #define HAVE_GETEUID 1 #define HAVE_GETGID 1 #define HAVE_GETPPID 1 #define HAVE_GETUID 1 #define HAVE_KILL 1 #define HAVE_OPENDIR 1 #define HAVE_PIPE 1 #ifndef __rtems__ #define HAVE_POPEN 1 #endif #define HAVE_SYSTEM 1 #define HAVE_WAIT 1 #define HAVE_TTYNAME 1 #endif /* PYOS_OS2 && PYCC_GCC && __VMS */ #endif /* _MSC_VER */ #endif /* __BORLANDC__ */ #endif /* ! __WATCOMC__ || __QNX__ */ #endif /* ! __IBMC__ */ #ifndef _MSC_VER #if defined(__sgi)&&_COMPILER_VERSION>=700 /* declare ctermid_r if compiling with MIPSPro 7.x in ANSI C mode (default) */ extern char *ctermid_r(char *); #endif #ifndef HAVE_UNISTD_H #if defined(PYCC_VACPP) extern int mkdir(char *); #else #if ( defined(__WATCOMC__) || defined(_MSC_VER) ) && !defined(__QNX__) extern int mkdir(const char *); #else extern int mkdir(const char *, mode_t); #endif #endif #if defined(__IBMC__) || defined(__IBMCPP__) extern int chdir(char *); extern int rmdir(char *); #else extern int chdir(const char *); extern int rmdir(const char *); #endif #ifdef __BORLANDC__ extern int chmod(const char *, int); #else extern int chmod(const char *, mode_t); #endif /*#ifdef HAVE_FCHMOD extern int fchmod(int, mode_t); #endif*/ /*#ifdef HAVE_LCHMOD extern int lchmod(const char *, mode_t); #endif*/ extern int chown(const char *, uid_t, gid_t); extern char *getcwd(char *, int); extern char *strerror(int); extern int link(const char *, const char *); extern int rename(const char *, const char *); extern int stat(const char *, struct stat *); extern int unlink(const char *); extern int pclose(FILE *); #ifdef HAVE_SYMLINK extern int symlink(const char *, const char *); #endif /* HAVE_SYMLINK */ #ifdef HAVE_LSTAT extern int lstat(const char *, struct stat *); #endif /* HAVE_LSTAT */ #endif /* !HAVE_UNISTD_H */ #endif /* !_MSC_VER */ #ifdef HAVE_UTIME_H #include <utime.h> #endif /* HAVE_UTIME_H */ #ifdef HAVE_SYS_UTIME_H #include <sys/utime.h> #define HAVE_UTIME_H /* pretend we do for the rest of this file */ #endif /* HAVE_SYS_UTIME_H */ #ifdef HAVE_SYS_TIMES_H #include <sys/times.h> #endif /* HAVE_SYS_TIMES_H */ #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif /* HAVE_SYS_PARAM_H */ #ifdef HAVE_SYS_UTSNAME_H #include <sys/utsname.h> #endif /* HAVE_SYS_UTSNAME_H */ #ifdef HAVE_DIRENT_H #include <dirent.h> #define NAMLEN(dirent) strlen((dirent)->d_name) #else #if defined(__WATCOMC__) && !defined(__QNX__) #include <direct.h> #define NAMLEN(dirent) strlen((dirent)->d_name) #else #define dirent direct #define NAMLEN(dirent) (dirent)->d_namlen #endif #ifdef HAVE_SYS_NDIR_H #include <sys/ndir.h> #endif #ifdef HAVE_SYS_DIR_H #include <sys/dir.h> #endif #ifdef HAVE_NDIR_H #include <ndir.h> #endif #endif #ifdef _MSC_VER #ifdef HAVE_DIRECT_H #include <direct.h> #endif #ifdef HAVE_IO_H #include <io.h> #endif #ifdef HAVE_PROCESS_H #include <process.h> #endif #include "osdefs.h" #include <malloc.h> #include <windows.h> #include <shellapi.h> /* for ShellExecute() */ #define popen _popen #define pclose _pclose #endif /* _MSC_VER */ #if defined(PYCC_VACPP) && defined(PYOS_OS2) #include <io.h> #endif /* OS2 */ #ifndef MAXPATHLEN #if defined(PATH_MAX) && PATH_MAX > 1024 #define MAXPATHLEN PATH_MAX #else #define MAXPATHLEN 1024 #endif #endif /* MAXPATHLEN */ #ifdef UNION_WAIT /* Emulate some macros on systems that have a union instead of macros */ #ifndef WIFEXITED #define WIFEXITED(u_wait) (!(u_wait).w_termsig && !(u_wait).w_coredump) #endif #ifndef WEXITSTATUS #define WEXITSTATUS(u_wait) (WIFEXITED(u_wait)?((u_wait).w_retcode):-1) #endif #ifndef WTERMSIG #define WTERMSIG(u_wait) ((u_wait).w_termsig) #endif #define WAIT_TYPE union wait #define WAIT_STATUS_INT(s) (s.w_status) #else /* !UNION_WAIT */ #define WAIT_TYPE int #define WAIT_STATUS_INT(s) (s) #endif /* UNION_WAIT */ /* Issue #1983: pid_t can be longer than a C long on some systems */ #if !defined(SIZEOF_PID_T) || SIZEOF_PID_T == SIZEOF_INT #define PARSE_PID "i" #define PyLong_FromPid PyInt_FromLong #define PyLong_AsPid PyInt_AsLong #elif SIZEOF_PID_T == SIZEOF_LONG #define PARSE_PID "l" #define PyLong_FromPid PyInt_FromLong #define PyLong_AsPid PyInt_AsLong #elif defined(SIZEOF_LONG_LONG) && SIZEOF_PID_T == SIZEOF_LONG_LONG #define PARSE_PID "L" #define PyLong_FromPid PyLong_FromLongLong #define PyLong_AsPid PyInt_AsLongLong #else #error "sizeof(pid_t) is neither sizeof(int), sizeof(long) or sizeof(long long)" #endif /* SIZEOF_PID_T */ /* Don't use the "_r" form if we don't need it (also, won't have a prototype for it, at least on Solaris -- maybe others as well?). */ #if defined(HAVE_CTERMID_R) && defined(WITH_THREAD) #define USE_CTERMID_R #endif #if defined(HAVE_TMPNAM_R) && defined(WITH_THREAD) && !defined(_musl_) #define USE_TMPNAM_R #endif #if defined(MAJOR_IN_MKDEV) #include <sys/mkdev.h> #else #if defined(MAJOR_IN_SYSMACROS) #include <sys/sysmacros.h> #endif #if defined(HAVE_MKNOD) && defined(HAVE_SYS_MKDEV_H) #include <sys/mkdev.h> #endif #endif #ifndef MS_WINDOWS PyObject * _PyInt_FromUid(uid_t uid) { if (uid <= LONG_MAX) return PyInt_FromLong(uid); return PyLong_FromUnsignedLong(uid); } PyObject * _PyInt_FromGid(gid_t gid) { if (gid <= LONG_MAX) return PyInt_FromLong(gid); return PyLong_FromUnsignedLong(gid); } int _Py_Uid_Converter(PyObject *obj, void *p) { int overflow; long result; if (PyFloat_Check(obj)) { PyErr_SetString(PyExc_TypeError, "integer argument expected, got float"); return 0; } result = PyLong_AsLongAndOverflow(obj, &overflow); if (overflow < 0) goto OverflowDown; if (!overflow && result == -1) { /* error or -1 */ if (PyErr_Occurred()) return 0; *(uid_t *)p = (uid_t)-1; } else { /* unsigned uid_t */ unsigned long uresult; if (overflow > 0) { uresult = PyLong_AsUnsignedLong(obj); if (PyErr_Occurred()) { if (PyErr_ExceptionMatches(PyExc_OverflowError)) goto OverflowUp; return 0; } } else { if (result < 0) goto OverflowDown; uresult = result; } if (sizeof(uid_t) < sizeof(long) && (unsigned long)(uid_t)uresult != uresult) goto OverflowUp; *(uid_t *)p = (uid_t)uresult; } return 1; OverflowDown: PyErr_SetString(PyExc_OverflowError, "user id is less than minimum"); return 0; OverflowUp: PyErr_SetString(PyExc_OverflowError, "user id is greater than maximum"); return 0; } int _Py_Gid_Converter(PyObject *obj, void *p) { int overflow; long result; if (PyFloat_Check(obj)) { PyErr_SetString(PyExc_TypeError, "integer argument expected, got float"); return 0; } result = PyLong_AsLongAndOverflow(obj, &overflow); if (overflow < 0) goto OverflowDown; if (!overflow && result == -1) { /* error or -1 */ if (PyErr_Occurred()) return 0; *(gid_t *)p = (gid_t)-1; } else { /* unsigned gid_t */ unsigned long uresult; if (overflow > 0) { uresult = PyLong_AsUnsignedLong(obj); if (PyErr_Occurred()) { if (PyErr_ExceptionMatches(PyExc_OverflowError)) goto OverflowUp; return 0; } } else { if (result < 0) goto OverflowDown; uresult = result; } if (sizeof(gid_t) < sizeof(long) && (unsigned long)(gid_t)uresult != uresult) goto OverflowUp; *(gid_t *)p = (gid_t)uresult; } return 1; OverflowDown: PyErr_SetString(PyExc_OverflowError, "group id is less than minimum"); return 0; OverflowUp: PyErr_SetString(PyExc_OverflowError, "group id is greater than maximum"); return 0; } #endif /* MS_WINDOWS */ #if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV) static int _Py_Dev_Converter(PyObject *obj, void *p) { PyObject *index = PyNumber_Index(obj); if (index == NULL) return 0; if (PyInt_Check(index)) { long x = PyInt_AS_LONG(index); Py_DECREF(index); if (x == -1 && PyErr_Occurred()) return 0; if (x < 0) { PyErr_SetString(PyExc_OverflowError, "can't convert negative number to unsigned long"); return 0; } *((dev_t *)p) = (unsigned long)x; } else if (PyLong_Check(index)) { #ifdef HAVE_LONG_LONG *((dev_t *)p) = PyLong_AsUnsignedLongLong(index); #else *((dev_t *)p) = PyLong_AsUnsignedLong(index); #endif Py_DECREF(index); if (PyErr_Occurred()) return 0; } else { Py_DECREF(index); PyErr_Format(PyExc_TypeError, "expected int/long, %s found", Py_TYPE(obj)->tp_name); return 0; } return 1; } #endif #ifdef HAVE_LONG_LONG static PyObject * _PyInt_FromDev(PY_LONG_LONG v) { if (LONG_MIN <= v && v <= LONG_MAX) return PyInt_FromLong((long)v); else return PyLong_FromLongLong(v); } #else # define _PyInt_FromDev PyInt_FromLong #endif #if defined _MSC_VER && _MSC_VER >= 1400 /* Microsoft CRT in VS2005 and higher will verify that a filehandle is * valid and raise an assertion if it isn't. * Normally, an invalid fd is likely to be a C program error and therefore * an assertion can be useful, but it does contradict the POSIX standard * which for write(2) states: * "Otherwise, -1 shall be returned and errno set to indicate the error." * "[EBADF] The fildes argument is not a valid file descriptor open for * writing." * Furthermore, python allows the user to enter any old integer * as a fd and should merely raise a python exception on error. * The Microsoft CRT doesn't provide an official way to check for the * validity of a file descriptor, but we can emulate its internal behaviour * by using the exported __pinfo data member and knowledge of the * internal structures involved. * The structures below must be updated for each version of visual studio * according to the file internal.h in the CRT source, until MS comes * up with a less hacky way to do this. * (all of this is to avoid globally modifying the CRT behaviour using * _set_invalid_parameter_handler() and _CrtSetReportMode()) */ /* The actual size of the structure is determined at runtime. * Only the first items must be present. */ /// From crt\src\internal.h #if _MSC_VER >= 1400 /* VS 2005 */ typedef struct { intptr_t osfhnd; /* underlying OS file HANDLE */ char osfile; /* attributes of file (e.g., open in text mode?) */ char pipech; /* one char buffer for handles opened on pipes */ int lockinitflag; CRITICAL_SECTION lock; #ifndef _SAFECRT_IMPL /* Not used in the safecrt downlevel. We do not define them, so we cannot use them accidentally */ char textmode : 7; /* __IOINFO_TM_ANSI or __IOINFO_TM_UTF8 or __IOINFO_TM_UTF16LE */ char unicode : 1; /* Was the file opened as unicode? */ char pipech2[2]; /* 2 more peak ahead chars for UNICODE mode */ __int64 startpos; /* File position that matches buffer start */ BOOL utf8translations; /* Buffer contains translations other than CRLF*/ #if _MSC_VER >= 1500 /* VS 2008 */ char dbcsBuffer; /* Buffer for the lead byte of dbcs when converting from dbcs to unicode */ BOOL dbcsBufferUsed; /* Bool for the lead byte buffer is used or not */ #endif #endif /* _SAFECRT_IMPL */ } my_ioinfo; #endif extern char * __pioinfo[]; #define IOINFO_L2E 5 #define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) #define IOINFO_ARRAYS 64 #define _NHANDLE_ (IOINFO_ARRAYS * IOINFO_ARRAY_ELTS) #define FOPEN 0x01 #define _NO_CONSOLE_FILENO (intptr_t)-2 // Visual C++ 2015 uses new CRT. Latest python implements _PyVerify_fd as no-op: // https://hg.python.org/cpython/file/100315/Include/fileutils.h#l133 #if defined _MSC_VER && _MSC_VER >= 1400 && _MSC_VER < 1900 /* This function emulates what the windows CRT does to validate file handles */ int _PyVerify_fd(int fd) { const int i1 = fd >> IOINFO_L2E; const int i2 = fd & ((1 << IOINFO_L2E) - 1); static int sizeof_ioinfo = 0; #if 0 /* Determine the actual size of the ioinfo structure, * as used by the CRT loaded in memory */ if (sizeof_ioinfo == 0 && __pioinfo[0] != NULL) { sizeof_ioinfo = _msize(__pioinfo[0]) / IOINFO_ARRAY_ELTS; } if (sizeof_ioinfo == 0) { /* This should not happen... */ goto fail; } #else sizeof_ioinfo = sizeof(my_ioinfo); #endif /* See that it isn't a special CLEAR fileno */ if (fd != _NO_CONSOLE_FILENO) { /* Microsoft CRT would check that 0<=fd<_nhandle but we can't do that. Instead * we check pointer validity and other info */ if (0 <= i1 && i1 < IOINFO_ARRAYS && __pioinfo[i1] != NULL) { /* finally, check that the file is open */ my_ioinfo* info = (my_ioinfo*)(__pioinfo[i1] + i2 * sizeof_ioinfo); if (info->osfile & FOPEN) { return 1; } } } fail: errno = EBADF; return 0; } #else int _PyVerify_fd(int fd) { return 1; } #endif /* the special case of checking dup2. The target fd must be in a sensible range */ static int _PyVerify_fd_dup2(int fd1, int fd2) { if (!_PyVerify_fd(fd1)) return 0; if (fd2 == _NO_CONSOLE_FILENO) return 0; if ((unsigned)fd2 < _NHANDLE_) return 1; else return 0; } #else /* dummy version. _PyVerify_fd() is already defined in fileobject.h */ #define _PyVerify_fd_dup2(A, B) (1) #endif /* Return a dictionary corresponding to the POSIX environment table */ #if defined(WITH_NEXT_FRAMEWORK) || (defined(__APPLE__) && defined(Py_ENABLE_SHARED)) /* On Darwin/MacOSX a shared library or framework has no access to ** environ directly, we must obtain it with _NSGetEnviron(). See also ** man environ(7). */ #include <crt_externs.h> static char **environ; #elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) ) extern char **environ; #endif /* !_MSC_VER */ static PyObject * convertenviron(void) { PyObject *d; char **e; #if defined(PYOS_OS2) APIRET rc; char buffer[1024]; /* OS/2 Provides a Documented Max of 1024 Chars */ #endif d = PyDict_New(); if (d == NULL) return NULL; #if defined(WITH_NEXT_FRAMEWORK) || (defined(__APPLE__) && defined(Py_ENABLE_SHARED)) if (environ == NULL) environ = *_NSGetEnviron(); #endif if (environ == NULL) return d; /* This part ignores errors */ for (e = environ; *e != NULL; e++) { PyObject *k; PyObject *v; char *p = strchr(*e, '='); if (p == NULL) continue; k = PyString_FromStringAndSize(*e, (int)(p-*e)); if (k == NULL) { PyErr_Clear(); continue; } v = PyString_FromString(p+1); if (v == NULL) { PyErr_Clear(); Py_DECREF(k); continue; } if (PyDict_GetItem(d, k) == NULL) { if (PyDict_SetItem(d, k, v) != 0) PyErr_Clear(); } Py_DECREF(k); Py_DECREF(v); } #if defined(PYOS_OS2) rc = DosQueryExtLIBPATH(buffer, BEGIN_LIBPATH); if (rc == NO_ERROR) { /* (not a type, envname is NOT 'BEGIN_LIBPATH') */ PyObject *v = PyString_FromString(buffer); PyDict_SetItemString(d, "BEGINLIBPATH", v); Py_DECREF(v); } rc = DosQueryExtLIBPATH(buffer, END_LIBPATH); if (rc == NO_ERROR) { /* (not a typo, envname is NOT 'END_LIBPATH') */ PyObject *v = PyString_FromString(buffer); PyDict_SetItemString(d, "ENDLIBPATH", v); Py_DECREF(v); } #endif return d; } /* Set a POSIX-specific error from errno, and return NULL */ static PyObject * posix_error(void) { return PyErr_SetFromErrno(PyExc_OSError); } static PyObject * posix_error_with_filename(char* name) { return PyErr_SetFromErrnoWithFilename(PyExc_OSError, name); } #ifdef MS_WINDOWS static PyObject * posix_error_with_unicode_filename(Py_UNICODE* name) { return PyErr_SetFromErrnoWithUnicodeFilename(PyExc_OSError, name); } #endif /* MS_WINDOWS */ static PyObject * posix_error_with_allocated_filename(char* name) { PyObject *rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError, name); PyMem_Free(name); return rc; } #ifdef MS_WINDOWS static PyObject * win32_error(char* function, char* filename) { /* XXX We should pass the function name along in the future. (_winreg.c also wants to pass the function name.) This would however require an additional param to the Windows error object, which is non-trivial. */ errno = GetLastError(); if (filename) return PyErr_SetFromWindowsErrWithFilename(errno, filename); else return PyErr_SetFromWindowsErr(errno); } static PyObject * win32_error_unicode(char* function, Py_UNICODE* filename) { /* XXX - see win32_error for comments on 'function' */ errno = GetLastError(); if (filename) return PyErr_SetFromWindowsErrWithUnicodeFilename(errno, filename); else return PyErr_SetFromWindowsErr(errno); } static int convert_to_unicode(PyObject **param) { if (PyUnicode_CheckExact(*param)) Py_INCREF(*param); else if (PyUnicode_Check(*param)) /* For a Unicode subtype that's not a Unicode object, return a true Unicode object with the same data. */ *param = PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(*param), PyUnicode_GET_SIZE(*param)); else *param = PyUnicode_FromEncodedObject(*param, Py_FileSystemDefaultEncoding, "strict"); return (*param) != NULL; } #endif /* MS_WINDOWS */ #if defined(PYOS_OS2) /********************************************************************** * Helper Function to Trim and Format OS/2 Messages **********************************************************************/ static void os2_formatmsg(char *msgbuf, int msglen, char *reason) { msgbuf[msglen] = '\0'; /* OS/2 Doesn't Guarantee a Terminator */ if (strlen(msgbuf) > 0) { /* If Non-Empty Msg, Trim CRLF */ char *lastc = &msgbuf[ strlen(msgbuf)-1 ]; while (lastc > msgbuf && isspace(Py_CHARMASK(*lastc))) *lastc-- = '\0'; /* Trim Trailing Whitespace (CRLF) */ } /* Add Optional Reason Text */ if (reason) { strcat(msgbuf, " : "); strcat(msgbuf, reason); } } /********************************************************************** * Decode an OS/2 Operating System Error Code * * A convenience function to lookup an OS/2 error code and return a * text message we can use to raise a Python exception. * * Notes: * The messages for errors returned from the OS/2 kernel reside in * the file OSO001.MSG in the \OS2 directory hierarchy. * **********************************************************************/ static char * os2_strerror(char *msgbuf, int msgbuflen, int errorcode, char *reason) { APIRET rc; ULONG msglen; /* Retrieve Kernel-Related Error Message from OSO001.MSG File */ Py_BEGIN_ALLOW_THREADS rc = DosGetMessage(NULL, 0, msgbuf, msgbuflen, errorcode, "oso001.msg", &msglen); Py_END_ALLOW_THREADS if (rc == NO_ERROR) os2_formatmsg(msgbuf, msglen, reason); else PyOS_snprintf(msgbuf, msgbuflen, "unknown OS error #%d", errorcode); return msgbuf; } /* Set an OS/2-specific error and return NULL. OS/2 kernel errors are not in a global variable e.g. 'errno' nor are they congruent with posix error numbers. */ static PyObject * os2_error(int code) { char text[1024]; PyObject *v; os2_strerror(text, sizeof(text), code, ""); v = Py_BuildValue("(is)", code, text); if (v != NULL) { PyErr_SetObject(PyExc_OSError, v); Py_DECREF(v); } return NULL; /* Signal to Python that an Exception is Pending */ } #endif /* OS2 */ /* POSIX generic methods */ static PyObject * posix_fildes(PyObject *fdobj, int (*func)(int)) { int fd; int res; fd = PyObject_AsFileDescriptor(fdobj); if (fd < 0) return NULL; if (!_PyVerify_fd(fd)) return posix_error(); Py_BEGIN_ALLOW_THREADS res = (*func)(fd); Py_END_ALLOW_THREADS if (res < 0) return posix_error(); Py_INCREF(Py_None); return Py_None; } static PyObject * posix_1str(PyObject *args, char *format, int (*func)(const char*)) { char *path1 = NULL; int res; if (!PyArg_ParseTuple(args, format, Py_FileSystemDefaultEncoding, &path1)) return NULL; Py_BEGIN_ALLOW_THREADS res = (*func)(path1); Py_END_ALLOW_THREADS if (res < 0) return posix_error_with_allocated_filename(path1); PyMem_Free(path1); Py_INCREF(Py_None); return Py_None; } static PyObject * posix_2str(PyObject *args, char *format, int (*func)(const char *, const char *)) { char *path1 = NULL, *path2 = NULL; int res; if (!PyArg_ParseTuple(args, format, Py_FileSystemDefaultEncoding, &path1, Py_FileSystemDefaultEncoding, &path2)) return NULL; Py_BEGIN_ALLOW_THREADS res = (*func)(path1, path2); Py_END_ALLOW_THREADS PyMem_Free(path1); PyMem_Free(path2); if (res != 0) /* XXX how to report both path1 and path2??? */ return posix_error(); Py_INCREF(Py_None); return Py_None; } #ifdef MS_WINDOWS static PyObject* win32_1str(PyObject* args, char* func, char* format, BOOL (__stdcall *funcA)(LPCSTR), char* wformat, BOOL (__stdcall *funcW)(LPWSTR)) { PyObject *uni; char *ansi; BOOL result; if (!PyArg_ParseTuple(args, wformat, &uni)) PyErr_Clear(); else { Py_BEGIN_ALLOW_THREADS result = funcW(PyUnicode_AsUnicode(uni)); Py_END_ALLOW_THREADS if (!result) return win32_error_unicode(func, PyUnicode_AsUnicode(uni)); Py_INCREF(Py_None); return Py_None; } if (!PyArg_ParseTuple(args, format, &ansi)) return NULL; Py_BEGIN_ALLOW_THREADS result = funcA(ansi); Py_END_ALLOW_THREADS if (!result) return win32_error(func, ansi); Py_INCREF(Py_None); return Py_None; } /* This is a reimplementation of the C library's chdir function, but one that produces Win32 errors instead of DOS error codes. chdir is essentially a wrapper around SetCurrentDirectory; however, it also needs to set "magic" environment variables indicating the per-drive current directory, which are of the form =<drive>: */ static BOOL __stdcall win32_chdir(LPCSTR path) { char new_path[MAX_PATH+1]; int result; char env[4] = "=x:"; if(!SetCurrentDirectoryA(path)) return FALSE; result = GetCurrentDirectoryA(MAX_PATH+1, new_path); if (!result) return FALSE; /* In the ANSI API, there should not be any paths longer than MAX_PATH. */ assert(result <= MAX_PATH+1); if (strncmp(new_path, "\\\\", 2) == 0 || strncmp(new_path, "//", 2) == 0) /* UNC path, nothing to do. */ return TRUE; env[1] = new_path[0]; return SetEnvironmentVariableA(env, new_path); } /* The Unicode version differs from the ANSI version since the current directory might exceed MAX_PATH characters */ static BOOL __stdcall win32_wchdir(LPCWSTR path) { wchar_t _new_path[MAX_PATH+1], *new_path = _new_path; int result; wchar_t env[4] = L"=x:"; int is_unc_like_path; if(!SetCurrentDirectoryW(path)) return FALSE; result = GetCurrentDirectoryW(MAX_PATH+1, new_path); if (!result) return FALSE; if (result > MAX_PATH+1) { new_path = malloc(result * sizeof(wchar_t)); if (!new_path) { SetLastError(ERROR_OUTOFMEMORY); return FALSE; } result = GetCurrentDirectoryW(result, new_path); if (!result) { free(new_path); return FALSE; } } is_unc_like_path = (wcsncmp(new_path, L"\\\\", 2) == 0 || wcsncmp(new_path, L"//", 2) == 0); if (!is_unc_like_path) { env[1] = new_path[0]; result = SetEnvironmentVariableW(env, new_path); } if (new_path != _new_path) free(new_path); return result ? TRUE : FALSE; } #endif /* choose the appropriate stat and fstat functions and return structs */ #undef STAT #undef FSTAT #undef STRUCT_STAT #if defined(MS_WIN64) || defined(MS_WINDOWS) # define STAT win32_stat # define FSTAT win32_fstat # define STRUCT_STAT struct win32_stat #else # define STAT stat # define FSTAT fstat # define STRUCT_STAT struct stat #endif #ifdef MS_WINDOWS /* The CRT of Windows has a number of flaws wrt. its stat() implementation: - time stamps are restricted to second resolution - file modification times suffer from forth-and-back conversions between UTC and local time Therefore, we implement our own stat, based on the Win32 API directly. */ #define HAVE_STAT_NSEC 1 struct win32_stat{ int st_dev; __int64 st_ino; unsigned short st_mode; int st_nlink; int st_uid; int st_gid; int st_rdev; __int64 st_size; time_t st_atime; int st_atime_nsec; time_t st_mtime; int st_mtime_nsec; time_t st_ctime; int st_ctime_nsec; }; static __int64 secs_between_epochs = 11644473600; /* Seconds between 1.1.1601 and 1.1.1970 */ static void FILE_TIME_to_time_t_nsec(FILETIME *in_ptr, time_t *time_out, int* nsec_out) { /* XXX endianness. Shouldn't matter, as all Windows implementations are little-endian */ /* Cannot simply cast and dereference in_ptr, since it might not be aligned properly */ __int64 in; memcpy(&in, in_ptr, sizeof(in)); *nsec_out = (int)(in % 10000000) * 100; /* FILETIME is in units of 100 nsec. */ *time_out = Py_SAFE_DOWNCAST((in / 10000000) - secs_between_epochs, __int64, time_t); } static void time_t_to_FILE_TIME(time_t time_in, int nsec_in, FILETIME *out_ptr) { /* XXX endianness */ __int64 out; out = time_in + secs_between_epochs; out = out * 10000000 + nsec_in / 100; memcpy(out_ptr, &out, sizeof(out)); } /* Below, we *know* that ugo+r is 0444 */ #if _S_IREAD != 0400 #error Unsupported C library #endif static int attributes_to_mode(DWORD attr) { int m = 0; if (attr & FILE_ATTRIBUTE_DIRECTORY) m |= _S_IFDIR | 0111; /* IFEXEC for user,group,other */ else m |= _S_IFREG; if (attr & FILE_ATTRIBUTE_READONLY) m |= 0444; else m |= 0666; return m; } static int attribute_data_to_stat(WIN32_FILE_ATTRIBUTE_DATA *info, struct win32_stat *result) { memset(result, 0, sizeof(*result)); result->st_mode = attributes_to_mode(info->dwFileAttributes); result->st_size = (((__int64)info->nFileSizeHigh)<<32) + info->nFileSizeLow; FILE_TIME_to_time_t_nsec(&info->ftCreationTime, &result->st_ctime, &result->st_ctime_nsec); FILE_TIME_to_time_t_nsec(&info->ftLastWriteTime, &result->st_mtime, &result->st_mtime_nsec); FILE_TIME_to_time_t_nsec(&info->ftLastAccessTime, &result->st_atime, &result->st_atime_nsec); return 0; } static BOOL attributes_from_dir(LPCSTR pszFile, LPWIN32_FILE_ATTRIBUTE_DATA pfad) { HANDLE hFindFile; WIN32_FIND_DATAA FileData; hFindFile = FindFirstFileA(pszFile, &FileData); if (hFindFile == INVALID_HANDLE_VALUE) return FALSE; FindClose(hFindFile); pfad->dwFileAttributes = FileData.dwFileAttributes; pfad->ftCreationTime = FileData.ftCreationTime; pfad->ftLastAccessTime = FileData.ftLastAccessTime; pfad->ftLastWriteTime = FileData.ftLastWriteTime; pfad->nFileSizeHigh = FileData.nFileSizeHigh; pfad->nFileSizeLow = FileData.nFileSizeLow; return TRUE; } static BOOL attributes_from_dir_w(LPCWSTR pszFile, LPWIN32_FILE_ATTRIBUTE_DATA pfad) { HANDLE hFindFile; WIN32_FIND_DATAW FileData; hFindFile = FindFirstFileW(pszFile, &FileData); if (hFindFile == INVALID_HANDLE_VALUE) return FALSE; FindClose(hFindFile); pfad->dwFileAttributes = FileData.dwFileAttributes; pfad->ftCreationTime = FileData.ftCreationTime; pfad->ftLastAccessTime = FileData.ftLastAccessTime; pfad->ftLastWriteTime = FileData.ftLastWriteTime; pfad->nFileSizeHigh = FileData.nFileSizeHigh; pfad->nFileSizeLow = FileData.nFileSizeLow; return TRUE; } static int win32_stat(const char* path, struct win32_stat *result) { WIN32_FILE_ATTRIBUTE_DATA info; int code; char *dot; if (!GetFileAttributesExA(path, GetFileExInfoStandard, &info)) { if (GetLastError() != ERROR_SHARING_VIOLATION) { /* Protocol violation: we explicitly clear errno, instead of setting it to a POSIX error. Callers should use GetLastError. */ errno = 0; return -1; } else { /* Could not get attributes on open file. Fall back to reading the directory. */ if (!attributes_from_dir(path, &info)) { /* Very strange. This should not fail now */ errno = 0; return -1; } } } code = attribute_data_to_stat(&info, result); if (code != 0) return code; /* Set S_IFEXEC if it is an .exe, .bat, ... */ dot = strrchr(path, '.'); if (dot) { if (stricmp(dot, ".bat") == 0 || stricmp(dot, ".cmd") == 0 || stricmp(dot, ".exe") == 0 || stricmp(dot, ".com") == 0) result->st_mode |= 0111; } return code; } static int win32_wstat(const wchar_t* path, struct win32_stat *result) { int code; const wchar_t *dot; WIN32_FILE_ATTRIBUTE_DATA info; if (!GetFileAttributesExW(path, GetFileExInfoStandard, &info)) { if (GetLastError() != ERROR_SHARING_VIOLATION) { /* Protocol violation: we explicitly clear errno, instead of setting it to a POSIX error. Callers should use GetLastError. */ errno = 0; return -1; } else { /* Could not get attributes on open file. Fall back to reading the directory. */ if (!attributes_from_dir_w(path, &info)) { /* Very strange. This should not fail now */ errno = 0; return -1; } } } code = attribute_data_to_stat(&info, result); if (code < 0) return code; /* Set IFEXEC if it is an .exe, .bat, ... */ dot = wcsrchr(path, '.'); if (dot) { if (_wcsicmp(dot, L".bat") == 0 || _wcsicmp(dot, L".cmd") == 0 || _wcsicmp(dot, L".exe") == 0 || _wcsicmp(dot, L".com") == 0) result->st_mode |= 0111; } return code; } static int win32_fstat(int file_number, struct win32_stat *result) { BY_HANDLE_FILE_INFORMATION info; HANDLE h; int type; h = (HANDLE)_get_osfhandle(file_number); /* Protocol violation: we explicitly clear errno, instead of setting it to a POSIX error. Callers should use GetLastError. */ errno = 0; if (h == INVALID_HANDLE_VALUE) { /* This is really a C library error (invalid file handle). We set the Win32 error to the closes one matching. */ SetLastError(ERROR_INVALID_HANDLE); return -1; } memset(result, 0, sizeof(*result)); type = GetFileType(h); if (type == FILE_TYPE_UNKNOWN) { DWORD error = GetLastError(); if (error != 0) { return -1; } /* else: valid but unknown file */ } if (type != FILE_TYPE_DISK) { if (type == FILE_TYPE_CHAR) result->st_mode = _S_IFCHR; else if (type == FILE_TYPE_PIPE) result->st_mode = _S_IFIFO; return 0; } if (!GetFileInformationByHandle(h, &info)) { return -1; } /* similar to stat() */ result->st_mode = attributes_to_mode(info.dwFileAttributes); result->st_size = (((__int64)info.nFileSizeHigh)<<32) + info.nFileSizeLow; FILE_TIME_to_time_t_nsec(&info.ftCreationTime, &result->st_ctime, &result->st_ctime_nsec); FILE_TIME_to_time_t_nsec(&info.ftLastWriteTime, &result->st_mtime, &result->st_mtime_nsec); FILE_TIME_to_time_t_nsec(&info.ftLastAccessTime, &result->st_atime, &result->st_atime_nsec); /* specific to fstat() */ result->st_nlink = info.nNumberOfLinks; result->st_ino = (((__int64)info.nFileIndexHigh)<<32) + info.nFileIndexLow; return 0; } #endif /* MS_WINDOWS */ PyDoc_STRVAR(stat_result__doc__, "stat_result: Result from stat or lstat.\n\n\ This object may be accessed either as a tuple of\n\ (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)\n\ or via the attributes st_mode, st_ino, st_dev, st_nlink, st_uid, and so on.\n\ \n\ Posix/windows: If your platform supports st_blksize, st_blocks, st_rdev,\n\ or st_flags, they are available as attributes only.\n\ \n\ See os.stat for more information."); static PyStructSequence_Field stat_result_fields[] = { {"st_mode", "protection bits"}, {"st_ino", "inode"}, {"st_dev", "device"}, {"st_nlink", "number of hard links"}, {"st_uid", "user ID of owner"}, {"st_gid", "group ID of owner"}, {"st_size", "total size, in bytes"}, /* The NULL is replaced with PyStructSequence_UnnamedField later. */ {NULL, "integer time of last access"}, {NULL, "integer time of last modification"}, {NULL, "integer time of last change"}, {"st_atime", "time of last access"}, {"st_mtime", "time of last modification"}, {"st_ctime", "time of last change"}, #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE {"st_blksize", "blocksize for filesystem I/O"}, #endif #ifdef HAVE_STRUCT_STAT_ST_BLOCKS {"st_blocks", "number of blocks allocated"}, #endif #ifdef HAVE_STRUCT_STAT_ST_RDEV {"st_rdev", "device type (if inode device)"}, #endif #ifdef HAVE_STRUCT_STAT_ST_FLAGS {"st_flags", "user defined flags for file"}, #endif #ifdef HAVE_STRUCT_STAT_ST_GEN {"st_gen", "generation number"}, #endif #ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME {"st_birthtime", "time of creation"}, #endif {0} }; #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE #define ST_BLKSIZE_IDX 13 #else #define ST_BLKSIZE_IDX 12 #endif #ifdef HAVE_STRUCT_STAT_ST_BLOCKS #define ST_BLOCKS_IDX (ST_BLKSIZE_IDX+1) #else #define ST_BLOCKS_IDX ST_BLKSIZE_IDX #endif #ifdef HAVE_STRUCT_STAT_ST_RDEV #define ST_RDEV_IDX (ST_BLOCKS_IDX+1) #else #define ST_RDEV_IDX ST_BLOCKS_IDX #endif #ifdef HAVE_STRUCT_STAT_ST_FLAGS #define ST_FLAGS_IDX (ST_RDEV_IDX+1) #else #define ST_FLAGS_IDX ST_RDEV_IDX #endif #ifdef HAVE_STRUCT_STAT_ST_GEN #define ST_GEN_IDX (ST_FLAGS_IDX+1) #else #define ST_GEN_IDX ST_FLAGS_IDX #endif #ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME #define ST_BIRTHTIME_IDX (ST_GEN_IDX+1) #else #define ST_BIRTHTIME_IDX ST_GEN_IDX #endif static PyStructSequence_Desc stat_result_desc = { "stat_result", /* name */ stat_result__doc__, /* doc */ stat_result_fields, 10 }; PyDoc_STRVAR(statvfs_result__doc__, "statvfs_result: Result from statvfs or fstatvfs.\n\n\ This object may be accessed either as a tuple of\n\ (bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax),\n\ or via the attributes f_bsize, f_frsize, f_blocks, f_bfree, and so on.\n\ \n\ See os.statvfs for more information."); static PyStructSequence_Field statvfs_result_fields[] = { {"f_bsize", }, {"f_frsize", }, {"f_blocks", }, {"f_bfree", }, {"f_bavail", }, {"f_files", }, {"f_ffree", }, {"f_favail", }, {"f_flag", }, {"f_namemax",}, {0} }; static PyStructSequence_Desc statvfs_result_desc = { "statvfs_result", /* name */ statvfs_result__doc__, /* doc */ statvfs_result_fields, 10 }; static int initialized; static PyTypeObject StatResultType; static PyTypeObject StatVFSResultType; static newfunc structseq_new; static PyObject * statresult_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { PyStructSequence *result; int i; result = (PyStructSequence*)structseq_new(type, args, kwds); if (!result) return NULL; /* If we have been initialized from a tuple, st_?time might be set to None. Initialize it from the int slots. */ for (i = 7; i <= 9; i++) { if (result->ob_item[i+3] == Py_None) { Py_DECREF(Py_None); Py_INCREF(result->ob_item[i]); result->ob_item[i+3] = result->ob_item[i]; } } return (PyObject*)result; } /* If true, st_?time is float. */ static int _stat_float_times = 1; PyDoc_STRVAR(stat_float_times__doc__, "stat_float_times([newval]) -> oldval\n\n\ Determine whether os.[lf]stat represents time stamps as float objects.\n\ If newval is True, future calls to stat() return floats, if it is False,\n\ future calls return ints. \n\ If newval is omitted, return the current setting.\n"); static PyObject* stat_float_times(PyObject* self, PyObject *args) { int newval = -1; if (!PyArg_ParseTuple(args, "|i:stat_float_times", &newval)) return NULL; if (newval == -1) /* Return old value */ return PyBool_FromLong(_stat_float_times); _stat_float_times = newval; Py_INCREF(Py_None); return Py_None; } static void fill_time(PyObject *v, int index, time_t sec, unsigned long nsec) { PyObject *fval,*ival; #if SIZEOF_TIME_T > SIZEOF_LONG ival = PyLong_FromLongLong((PY_LONG_LONG)sec); #else ival = PyInt_FromLong((long)sec); #endif if (!ival) return; if (_stat_float_times) { fval = PyFloat_FromDouble(sec + 1e-9*nsec); } else { fval = ival; Py_INCREF(fval); } PyStructSequence_SET_ITEM(v, index, ival); PyStructSequence_SET_ITEM(v, index+3, fval); } /* pack a system stat C structure into the Python stat tuple (used by posix_stat() and posix_fstat()) */ static PyObject* _pystat_fromstructstat(STRUCT_STAT *st) { unsigned long ansec, mnsec, cnsec; PyObject *v = PyStructSequence_New(&StatResultType); if (v == NULL) return NULL; PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long)st->st_mode)); #ifdef HAVE_LARGEFILE_SUPPORT PyStructSequence_SET_ITEM(v, 1, PyLong_FromLongLong((PY_LONG_LONG)st->st_ino)); #else PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st->st_ino)); #endif #ifdef MS_WINDOWS PyStructSequence_SET_ITEM(v, 2, PyLong_FromUnsignedLong(st->st_dev)); #else PyStructSequence_SET_ITEM(v, 2, _PyInt_FromDev(st->st_dev)); #endif PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long)st->st_nlink)); #if defined(MS_WINDOWS) PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong(0)); PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong(0)); #else PyStructSequence_SET_ITEM(v, 4, _PyInt_FromUid(st->st_uid)); PyStructSequence_SET_ITEM(v, 5, _PyInt_FromGid(st->st_gid)); #endif #ifdef HAVE_LARGEFILE_SUPPORT PyStructSequence_SET_ITEM(v, 6, PyLong_FromLongLong((PY_LONG_LONG)st->st_size)); #else PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong(st->st_size)); #endif #if defined(HAVE_STAT_TV_NSEC) ansec = st->st_atim.tv_nsec; mnsec = st->st_mtim.tv_nsec; cnsec = st->st_ctim.tv_nsec; #elif defined(HAVE_STAT_TV_NSEC2) ansec = st->st_atimespec.tv_nsec; mnsec = st->st_mtimespec.tv_nsec; cnsec = st->st_ctimespec.tv_nsec; #elif defined(HAVE_STAT_NSEC) ansec = st->st_atime_nsec; mnsec = st->st_mtime_nsec; cnsec = st->st_ctime_nsec; #else ansec = mnsec = cnsec = 0; #endif fill_time(v, 7, st->st_atime, ansec); fill_time(v, 8, st->st_mtime, mnsec); fill_time(v, 9, st->st_ctime, cnsec); #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE PyStructSequence_SET_ITEM(v, ST_BLKSIZE_IDX, PyInt_FromLong((long)st->st_blksize)); #endif #ifdef HAVE_STRUCT_STAT_ST_BLOCKS PyStructSequence_SET_ITEM(v, ST_BLOCKS_IDX, PyInt_FromLong((long)st->st_blocks)); #endif #ifdef HAVE_STRUCT_STAT_ST_RDEV PyStructSequence_SET_ITEM(v, ST_RDEV_IDX, PyInt_FromLong((long)st->st_rdev)); #endif #ifdef HAVE_STRUCT_STAT_ST_GEN PyStructSequence_SET_ITEM(v, ST_GEN_IDX, PyInt_FromLong((long)st->st_gen)); #endif #ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME { PyObject *val; unsigned long bsec,bnsec; bsec = (long)st->st_birthtime; #ifdef HAVE_STAT_TV_NSEC2 bnsec = st->st_birthtimespec.tv_nsec; #else bnsec = 0; #endif if (_stat_float_times) { val = PyFloat_FromDouble(bsec + 1e-9*bnsec); } else { val = PyInt_FromLong((long)bsec); } PyStructSequence_SET_ITEM(v, ST_BIRTHTIME_IDX, val); } #endif #ifdef HAVE_STRUCT_STAT_ST_FLAGS PyStructSequence_SET_ITEM(v, ST_FLAGS_IDX, PyInt_FromLong((long)st->st_flags)); #endif if (PyErr_Occurred()) { Py_DECREF(v); return NULL; } return v; } #ifdef MS_WINDOWS /* IsUNCRoot -- test whether the supplied path is of the form \\SERVER\SHARE\, where / can be used in place of \ and the trailing slash is optional. Both SERVER and SHARE must have at least one character. */ #define ISSLASHA(c) ((c) == '\\' || (c) == '/') #define ISSLASHW(c) ((c) == L'\\' || (c) == L'/') #ifndef ARRAYSIZE #define ARRAYSIZE(a) (sizeof(a) / sizeof(a[0])) #endif static BOOL IsUNCRootA(char *path, int pathlen) { #define ISSLASH ISSLASHA int i, share; if (pathlen < 5 || !ISSLASH(path[0]) || !ISSLASH(path[1])) /* minimum UNCRoot is \\x\y */ return FALSE; for (i = 2; i < pathlen ; i++) if (ISSLASH(path[i])) break; if (i == 2 || i == pathlen) /* do not allow \\\SHARE or \\SERVER */ return FALSE; share = i+1; for (i = share; i < pathlen; i++) if (ISSLASH(path[i])) break; return (i != share && (i == pathlen || i == pathlen-1)); #undef ISSLASH } static BOOL IsUNCRootW(Py_UNICODE *path, int pathlen) { #define ISSLASH ISSLASHW int i, share; if (pathlen < 5 || !ISSLASH(path[0]) || !ISSLASH(path[1])) /* minimum UNCRoot is \\x\y */ return FALSE; for (i = 2; i < pathlen ; i++) if (ISSLASH(path[i])) break; if (i == 2 || i == pathlen) /* do not allow \\\SHARE or \\SERVER */ return FALSE; share = i+1; for (i = share; i < pathlen; i++) if (ISSLASH(path[i])) break; return (i != share && (i == pathlen || i == pathlen-1)); #undef ISSLASH } #endif /* MS_WINDOWS */ static PyObject * posix_do_stat(PyObject *self, PyObject *args, char *format, #ifdef __VMS int (*statfunc)(const char *, STRUCT_STAT *, ...), #else int (*statfunc)(const char *, STRUCT_STAT *), #endif char *wformat, int (*wstatfunc)(const Py_UNICODE *, STRUCT_STAT *)) { STRUCT_STAT st; char *path = NULL; /* pass this to stat; do not free() it */ char *pathfree = NULL; /* this memory must be free'd */ int res; PyObject *result; #ifdef MS_WINDOWS Py_UNICODE *wpath; if (PyArg_ParseTuple(args, wformat, &wpath)) { Py_BEGIN_ALLOW_THREADS res = wstatfunc(wpath, &st); Py_END_ALLOW_THREADS if (res != 0) return win32_error_unicode("stat", wpath); return _pystat_fromstructstat(&st); } /* Drop the argument parsing error as narrow strings are also valid. */ PyErr_Clear(); #endif if (!PyArg_ParseTuple(args, format, Py_FileSystemDefaultEncoding, &path)) return NULL; pathfree = path; Py_BEGIN_ALLOW_THREADS res = (*statfunc)(path, &st); Py_END_ALLOW_THREADS if (res != 0) { #ifdef MS_WINDOWS result = win32_error("stat", pathfree); #else result = posix_error_with_filename(pathfree); #endif } else result = _pystat_fromstructstat(&st); PyMem_Free(pathfree); return result; } /* POSIX methods */ PyDoc_STRVAR(posix_access__doc__, "access(path, mode) -> True if granted, False otherwise\n\n\ Use the real uid/gid to test for access to a path. Note that most\n\ operations will use the effective uid/gid, therefore this routine can\n\ be used in a suid/sgid environment to test if the invoking user has the\n\ specified access to the path. The mode argument can be F_OK to test\n\ existence, or the inclusive-OR of R_OK, W_OK, and X_OK."); static PyObject * posix_access(PyObject *self, PyObject *args) { char *path; int mode; #ifdef MS_WINDOWS DWORD attr; Py_UNICODE *wpath; if (PyArg_ParseTuple(args, "ui:access", &wpath, &mode)) { Py_BEGIN_ALLOW_THREADS attr = GetFileAttributesW(wpath); Py_END_ALLOW_THREADS goto finish; } /* Drop the argument parsing error as narrow strings are also valid. */ PyErr_Clear(); if (!PyArg_ParseTuple(args, "eti:access", Py_FileSystemDefaultEncoding, &path, &mode)) return NULL; Py_BEGIN_ALLOW_THREADS attr = GetFileAttributesA(path); Py_END_ALLOW_THREADS PyMem_Free(path); finish: if (attr == 0xFFFFFFFF) /* File does not exist, or cannot read attributes */ return PyBool_FromLong(0); /* Access is possible if either write access wasn't requested, or the file isn't read-only, or if it's a directory, as there are no read-only directories on Windows. */ return PyBool_FromLong(!(mode & 2) || !(attr & FILE_ATTRIBUTE_READONLY) || (attr & FILE_ATTRIBUTE_DIRECTORY)); #else /* MS_WINDOWS */ int res; if (!PyArg_ParseTuple(args, "eti:access", Py_FileSystemDefaultEncoding, &path, &mode)) return NULL; Py_BEGIN_ALLOW_THREADS res = access(path, mode); Py_END_ALLOW_THREADS PyMem_Free(path); return PyBool_FromLong(res == 0); #endif /* MS_WINDOWS */ } #ifndef F_OK #define F_OK 0 #endif #ifndef R_OK #define R_OK 4 #endif #ifndef W_OK #define W_OK 2 #endif #ifndef X_OK #define X_OK 1 #endif #ifdef HAVE_TTYNAME PyDoc_STRVAR(posix_ttyname__doc__, "ttyname(fd) -> string\n\n\ Return the name of the terminal device connected to 'fd'."); static PyObject * posix_ttyname(PyObject *self, PyObject *args) { int id; char *ret; if (!PyArg_ParseTuple(args, "i:ttyname", &id)) return NULL; #if defined(__VMS) /* file descriptor 0 only, the default input device (stdin) */ if (id == 0) { ret = ttyname(); } else { ret = NULL; } #else ret = ttyname(id); #endif if (ret == NULL) return posix_error(); return PyString_FromString(ret); } #endif #ifdef HAVE_CTERMID PyDoc_STRVAR(posix_ctermid__doc__, "ctermid() -> string\n\n\ Return the name of the controlling terminal for this process."); static PyObject * posix_ctermid(PyObject *self, PyObject *noargs) { char *ret; char buffer[L_ctermid]; #ifdef USE_CTERMID_R ret = ctermid_r(buffer); #else ret = ctermid(buffer); #endif if (ret == NULL) return posix_error(); return PyString_FromString(buffer); } #endif PyDoc_STRVAR(posix_chdir__doc__, "chdir(path)\n\n\ Change the current working directory to the specified path."); static PyObject * posix_chdir(PyObject *self, PyObject *args) { #ifdef MS_WINDOWS return win32_1str(args, "chdir", "s:chdir", win32_chdir, "U:chdir", win32_wchdir); #elif defined(PYOS_OS2) && defined(PYCC_GCC) return posix_1str(args, "et:chdir", _chdir2); #elif defined(__VMS) return posix_1str(args, "et:chdir", (int (*)(const char *))chdir); #else return posix_1str(args, "et:chdir", chdir); #endif } #ifdef HAVE_FCHDIR PyDoc_STRVAR(posix_fchdir__doc__, "fchdir(fildes)\n\n\ Change to the directory of the given file descriptor. fildes must be\n\ opened on a directory, not a file."); static PyObject * posix_fchdir(PyObject *self, PyObject *fdobj) { return posix_fildes(fdobj, fchdir); } #endif /* HAVE_FCHDIR */ PyDoc_STRVAR(posix_chmod__doc__, "chmod(path, mode)\n\n\ Change the access permissions of a file."); static PyObject * posix_chmod(PyObject *self, PyObject *args) { char *path = NULL; int i; int res; #ifdef MS_WINDOWS DWORD attr; Py_UNICODE *wpath; if (PyArg_ParseTuple(args, "ui|:chmod", &wpath, &i)) { Py_BEGIN_ALLOW_THREADS attr = GetFileAttributesW(wpath); if (attr != 0xFFFFFFFF) { if (i & _S_IWRITE) attr &= ~FILE_ATTRIBUTE_READONLY; else attr |= FILE_ATTRIBUTE_READONLY; res = SetFileAttributesW(wpath, attr); } else res = 0; Py_END_ALLOW_THREADS if (!res) return win32_error_unicode("chmod", wpath); Py_INCREF(Py_None); return Py_None; } /* Drop the argument parsing error as narrow strings are also valid. */ PyErr_Clear(); if (!PyArg_ParseTuple(args, "eti:chmod", Py_FileSystemDefaultEncoding, &path, &i)) return NULL; Py_BEGIN_ALLOW_THREADS attr = GetFileAttributesA(path); if (attr != 0xFFFFFFFF) { if (i & _S_IWRITE) attr &= ~FILE_ATTRIBUTE_READONLY; else attr |= FILE_ATTRIBUTE_READONLY; res = SetFileAttributesA(path, attr); } else res = 0; Py_END_ALLOW_THREADS if (!res) { win32_error("chmod", path); PyMem_Free(path); return NULL; } PyMem_Free(path); Py_INCREF(Py_None); return Py_None; #else /* MS_WINDOWS */ if (!PyArg_ParseTuple(args, "eti:chmod", Py_FileSystemDefaultEncoding, &path, &i)) return NULL; Py_BEGIN_ALLOW_THREADS res = chmod(path, i); Py_END_ALLOW_THREADS if (res < 0) return posix_error_with_allocated_filename(path); PyMem_Free(path); Py_INCREF(Py_None); return Py_None; #endif } #ifdef HAVE_FCHMOD PyDoc_STRVAR(posix_fchmod__doc__, "fchmod(fd, mode)\n\n\ Change the access permissions of the file given by file\n\ descriptor fd."); static PyObject * posix_fchmod(PyObject *self, PyObject *args) { int fd, mode, res; if (!PyArg_ParseTuple(args, "ii:fchmod", &fd, &mode)) return NULL; Py_BEGIN_ALLOW_THREADS res = fchmod(fd, mode); Py_END_ALLOW_THREADS if (res < 0) return posix_error(); Py_RETURN_NONE; } #endif /* HAVE_FCHMOD */ #ifdef HAVE_LCHMOD PyDoc_STRVAR(posix_lchmod__doc__, "lchmod(path, mode)\n\n\ Change the access permissions of a file. If path is a symlink, this\n\ affects the link itself rather than the target."); static PyObject * posix_lchmod(PyObject *self, PyObject *args) { char *path = NULL; int i; int res; if (!PyArg_ParseTuple(args, "eti:lchmod", Py_FileSystemDefaultEncoding, &path, &i)) return NULL; Py_BEGIN_ALLOW_THREADS res = lchmod(path, i); Py_END_ALLOW_THREADS if (res < 0) return posix_error_with_allocated_filename(path); PyMem_Free(path); Py_RETURN_NONE; } #endif /* HAVE_LCHMOD */ #ifdef HAVE_CHFLAGS PyDoc_STRVAR(posix_chflags__doc__, "chflags(path, flags)\n\n\ Set file flags."); static PyObject * posix_chflags(PyObject *self, PyObject *args) { char *path; unsigned long flags; int res; if (!PyArg_ParseTuple(args, "etk:chflags", Py_FileSystemDefaultEncoding, &path, &flags)) return NULL; Py_BEGIN_ALLOW_THREADS res = chflags(path, flags); Py_END_ALLOW_THREADS if (res < 0) return posix_error_with_allocated_filename(path); PyMem_Free(path); Py_INCREF(Py_None); return Py_None; } #endif /* HAVE_CHFLAGS */ #ifdef HAVE_LCHFLAGS PyDoc_STRVAR(posix_lchflags__doc__, "lchflags(path, flags)\n\n\ Set file flags.\n\ This function will not follow symbolic links."); static PyObject * posix_lchflags(PyObject *self, PyObject *args) { char *path; unsigned long flags; int res; if (!PyArg_ParseTuple(args, "etk:lchflags", Py_FileSystemDefaultEncoding, &path, &flags)) return NULL; Py_BEGIN_ALLOW_THREADS res = lchflags(path, flags); Py_END_ALLOW_THREADS if (res < 0) return posix_error_with_allocated_filename(path); PyMem_Free(path); Py_INCREF(Py_None); return Py_None; } #endif /* HAVE_LCHFLAGS */ #ifdef HAVE_CHROOT PyDoc_STRVAR(posix_chroot__doc__, "chroot(path)\n\n\ Change root directory to path."); static PyObject * posix_chroot(PyObject *self, PyObject *args) { return posix_1str(args, "et:chroot", chroot); } #endif #ifdef HAVE_FSYNC PyDoc_STRVAR(posix_fsync__doc__, "fsync(fildes)\n\n\ force write of file with filedescriptor to disk."); static PyObject * posix_fsync(PyObject *self, PyObject *fdobj) { return posix_fildes(fdobj, fsync); } #endif /* HAVE_FSYNC */ #ifdef HAVE_FDATASYNC #ifdef __hpux extern int fdatasync(int); /* On HP-UX, in libc but not in unistd.h */ #endif PyDoc_STRVAR(posix_fdatasync__doc__, "fdatasync(fildes)\n\n\ force write of file with filedescriptor to disk.\n\ does not force update of metadata."); static PyObject * posix_fdatasync(PyObject *self, PyObject *fdobj) { return posix_fildes(fdobj, fdatasync); } #endif /* HAVE_FDATASYNC */ #ifdef HAVE_CHOWN PyDoc_STRVAR(posix_chown__doc__, "chown(path, uid, gid)\n\n\ Change the owner and group id of path to the numeric uid and gid."); static PyObject * posix_chown(PyObject *self, PyObject *args) { char *path = NULL; uid_t uid; gid_t gid; int res; if (!PyArg_ParseTuple(args, "etO&O&:chown", Py_FileSystemDefaultEncoding, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) return NULL; Py_BEGIN_ALLOW_THREADS res = chown(path, uid, gid); Py_END_ALLOW_THREADS if (res < 0) return posix_error_with_allocated_filename(path); PyMem_Free(path); Py_INCREF(Py_None); return Py_None; } #endif /* HAVE_CHOWN */ #ifdef HAVE_FCHOWN PyDoc_STRVAR(posix_fchown__doc__, "fchown(fd, uid, gid)\n\n\ Change the owner and group id of the file given by file descriptor\n\ fd to the numeric uid and gid."); static PyObject * posix_fchown(PyObject *self, PyObject *args) { int fd; uid_t uid; gid_t gid; int res; if (!PyArg_ParseTuple(args, "iO&O&:fchown", &fd, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) return NULL; Py_BEGIN_ALLOW_THREADS res = fchown(fd, uid, gid); Py_END_ALLOW_THREADS if (res < 0) return posix_error(); Py_RETURN_NONE; } #endif /* HAVE_FCHOWN */ #ifdef HAVE_LCHOWN PyDoc_STRVAR(posix_lchown__doc__, "lchown(path, uid, gid)\n\n\ Change the owner and group id of path to the numeric uid and gid.\n\ This function will not follow symbolic links."); static PyObject * posix_lchown(PyObject *self, PyObject *args) { char *path = NULL; uid_t uid; gid_t gid; int res; if (!PyArg_ParseTuple(args, "etO&O&:lchown", Py_FileSystemDefaultEncoding, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) return NULL; Py_BEGIN_ALLOW_THREADS res = lchown(path, uid, gid); Py_END_ALLOW_THREADS if (res < 0) return posix_error_with_allocated_filename(path); PyMem_Free(path); Py_INCREF(Py_None); return Py_None; } #endif /* HAVE_LCHOWN */ #ifdef HAVE_GETCWD PyDoc_STRVAR(posix_getcwd__doc__, "getcwd() -> path\n\n\ Return a string representing the current working directory."); #if (defined(__sun) && defined(__SVR4)) || \ defined(__OpenBSD__) || \ defined(__NetBSD__) /* Issue 9185: getcwd() returns NULL/ERANGE indefinitely. */ static PyObject * posix_getcwd(PyObject *self, PyObject *noargs) { char buf[PATH_MAX+2]; char *res; Py_BEGIN_ALLOW_THREADS res = getcwd(buf, sizeof buf); Py_END_ALLOW_THREADS if (res == NULL) return posix_error(); return PyString_FromString(buf); } #else static PyObject * posix_getcwd(PyObject *self, PyObject *noargs) { int bufsize_incr = 1024; int bufsize = 0; char *tmpbuf = NULL; char *res = NULL; PyObject *dynamic_return; Py_BEGIN_ALLOW_THREADS do { bufsize = bufsize + bufsize_incr; tmpbuf = malloc(bufsize); if (tmpbuf == NULL) { break; } #if defined(PYOS_OS2) && defined(PYCC_GCC) res = _getcwd2(tmpbuf, bufsize); #else res = getcwd(tmpbuf, bufsize); #endif if (res == NULL) { free(tmpbuf); } } while ((res == NULL) && (errno == ERANGE)); Py_END_ALLOW_THREADS if (res == NULL) return posix_error(); dynamic_return = PyString_FromString(tmpbuf); free(tmpbuf); return dynamic_return; } #endif /* getcwd() NULL/ERANGE workaround. */ #ifdef Py_USING_UNICODE PyDoc_STRVAR(posix_getcwdu__doc__, "getcwdu() -> path\n\n\ Return a unicode string representing the current working directory."); static PyObject * posix_getcwdu(PyObject *self, PyObject *noargs) { char buf[1026]; char *res; #ifdef MS_WINDOWS DWORD len; wchar_t wbuf[1026]; wchar_t *wbuf2 = wbuf; PyObject *resobj; Py_BEGIN_ALLOW_THREADS len = GetCurrentDirectoryW(sizeof wbuf/ sizeof wbuf[0], wbuf); /* If the buffer is large enough, len does not include the terminating \0. If the buffer is too small, len includes the space needed for the terminator. */ if (len >= sizeof wbuf/ sizeof wbuf[0]) { wbuf2 = malloc(len * sizeof(wchar_t)); if (wbuf2) len = GetCurrentDirectoryW(len, wbuf2); } Py_END_ALLOW_THREADS if (!wbuf2) { PyErr_NoMemory(); return NULL; } if (!len) { if (wbuf2 != wbuf) free(wbuf2); return win32_error("getcwdu", NULL); } resobj = PyUnicode_FromWideChar(wbuf2, len); if (wbuf2 != wbuf) free(wbuf2); return resobj; #endif /* MS_WINDOWS */ Py_BEGIN_ALLOW_THREADS #if defined(PYOS_OS2) && defined(PYCC_GCC) res = _getcwd2(buf, sizeof buf); #else res = getcwd(buf, sizeof buf); #endif Py_END_ALLOW_THREADS if (res == NULL) return posix_error(); return PyUnicode_Decode(buf, strlen(buf), Py_FileSystemDefaultEncoding,"strict"); } #endif /* Py_USING_UNICODE */ #endif /* HAVE_GETCWD */ #ifdef HAVE_LINK PyDoc_STRVAR(posix_link__doc__, "link(src, dst)\n\n\ Create a hard link to a file."); static PyObject * posix_link(PyObject *self, PyObject *args) { return posix_2str(args, "etet:link", link); } #endif /* HAVE_LINK */ PyDoc_STRVAR(posix_listdir__doc__, "listdir(path) -> list_of_strings\n\n\ Return a list containing the names of the entries in the directory.\n\ \n\ path: path of directory to list\n\ \n\ The list is in arbitrary order. It does not include the special\n\ entries '.' and '..' even if they are present in the directory."); static PyObject * posix_listdir(PyObject *self, PyObject *args) { /* XXX Should redo this putting the (now four) versions of opendir in separate files instead of having them all here... */ #if defined(MS_WINDOWS) && !defined(HAVE_OPENDIR) PyObject *d, *v; HANDLE hFindFile; BOOL result; WIN32_FIND_DATA FileData; char namebuf[MAX_PATH+5]; /* Overallocate for \\*.*\0 */ char *bufptr = namebuf; Py_ssize_t len = sizeof(namebuf)-5; /* only claim to have space for MAX_PATH */ Py_UNICODE *wpath; if (PyArg_ParseTuple(args, "u:listdir", &wpath)) { WIN32_FIND_DATAW wFileData; Py_UNICODE *wnamebuf; /* Overallocate for \\*.*\0 */ len = wcslen(wpath); wnamebuf = malloc((len + 5) * sizeof(wchar_t)); if (!wnamebuf) { PyErr_NoMemory(); return NULL; } wcscpy(wnamebuf, wpath); if (len > 0) { Py_UNICODE wch = wnamebuf[len-1]; if (wch != L'/' && wch != L'\\' && wch != L':') wnamebuf[len++] = L'\\'; wcscpy(wnamebuf + len, L"*.*"); } if ((d = PyList_New(0)) == NULL) { free(wnamebuf); return NULL; } Py_BEGIN_ALLOW_THREADS hFindFile = FindFirstFileW(wnamebuf, &wFileData); Py_END_ALLOW_THREADS if (hFindFile == INVALID_HANDLE_VALUE) { int error = GetLastError(); if (error == ERROR_FILE_NOT_FOUND) { free(wnamebuf); return d; } Py_DECREF(d); win32_error_unicode("FindFirstFileW", wnamebuf); free(wnamebuf); return NULL; } do { /* Skip over . and .. */ if (wcscmp(wFileData.cFileName, L".") != 0 && wcscmp(wFileData.cFileName, L"..") != 0) { v = PyUnicode_FromUnicode(wFileData.cFileName, wcslen(wFileData.cFileName)); if (v == NULL) { Py_DECREF(d); d = NULL; break; } if (PyList_Append(d, v) != 0) { Py_DECREF(v); Py_DECREF(d); d = NULL; break; } Py_DECREF(v); } Py_BEGIN_ALLOW_THREADS result = FindNextFileW(hFindFile, &wFileData); Py_END_ALLOW_THREADS /* FindNextFile sets error to ERROR_NO_MORE_FILES if it got to the end of the directory. */ if (!result && GetLastError() != ERROR_NO_MORE_FILES) { Py_DECREF(d); win32_error_unicode("FindNextFileW", wnamebuf); FindClose(hFindFile); free(wnamebuf); return NULL; } } while (result == TRUE); if (FindClose(hFindFile) == FALSE) { Py_DECREF(d); win32_error_unicode("FindClose", wnamebuf); free(wnamebuf); return NULL; } free(wnamebuf); return d; } /* Drop the argument parsing error as narrow strings are also valid. */ PyErr_Clear(); if (!PyArg_ParseTuple(args, "et#:listdir", Py_FileSystemDefaultEncoding, &bufptr, &len)) return NULL; if (len > 0) { char ch = namebuf[len-1]; if (ch != SEP && ch != ALTSEP && ch != ':') namebuf[len++] = SEP; strcpy(namebuf + len, "*.*"); } if ((d = PyList_New(0)) == NULL) return NULL; Py_BEGIN_ALLOW_THREADS hFindFile = FindFirstFile(namebuf, &FileData); Py_END_ALLOW_THREADS if (hFindFile == INVALID_HANDLE_VALUE) { int error = GetLastError(); if (error == ERROR_FILE_NOT_FOUND) return d; Py_DECREF(d); return win32_error("FindFirstFile", namebuf); } do { /* Skip over . and .. */ if (strcmp(FileData.cFileName, ".") != 0 && strcmp(FileData.cFileName, "..") != 0) { v = PyString_FromString(FileData.cFileName); if (v == NULL) { Py_DECREF(d); d = NULL; break; } if (PyList_Append(d, v) != 0) { Py_DECREF(v); Py_DECREF(d); d = NULL; break; } Py_DECREF(v); } Py_BEGIN_ALLOW_THREADS result = FindNextFile(hFindFile, &FileData); Py_END_ALLOW_THREADS /* FindNextFile sets error to ERROR_NO_MORE_FILES if it got to the end of the directory. */ if (!result && GetLastError() != ERROR_NO_MORE_FILES) { Py_DECREF(d); win32_error("FindNextFile", namebuf); FindClose(hFindFile); return NULL; } } while (result == TRUE); if (FindClose(hFindFile) == FALSE) { Py_DECREF(d); return win32_error("FindClose", namebuf); } return d; #elif defined(PYOS_OS2) #ifndef MAX_PATH #define MAX_PATH CCHMAXPATH #endif char *name, *pt; Py_ssize_t len; PyObject *d, *v; char namebuf[MAX_PATH+5]; HDIR hdir = 1; ULONG srchcnt = 1; FILEFINDBUF3 ep; APIRET rc; if (!PyArg_ParseTuple(args, "t#:listdir", &name, &len)) return NULL; if (len >= MAX_PATH) { PyErr_SetString(PyExc_ValueError, "path too long"); return NULL; } strcpy(namebuf, name); for (pt = namebuf; *pt; pt++) if (*pt == ALTSEP) *pt = SEP; if (namebuf[len-1] != SEP) namebuf[len++] = SEP; strcpy(namebuf + len, "*.*"); if ((d = PyList_New(0)) == NULL) return NULL; rc = DosFindFirst(namebuf, /* Wildcard Pattern to Match */ &hdir, /* Handle to Use While Search Directory */ FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY, &ep, sizeof(ep), /* Structure to Receive Directory Entry */ &srchcnt, /* Max and Actual Count of Entries Per Iteration */ FIL_STANDARD); /* Format of Entry (EAs or Not) */ if (rc != NO_ERROR) { errno = ENOENT; return posix_error_with_filename(name); } if (srchcnt > 0) { /* If Directory is NOT Totally Empty, */ do { if (ep.achName[0] == '.' && (ep.achName[1] == '\0' || (ep.achName[1] == '.' && ep.achName[2] == '\0'))) continue; /* Skip Over "." and ".." Names */ strcpy(namebuf, ep.achName); /* Leave Case of Name Alone -- In Native Form */ /* (Removed Forced Lowercasing Code) */ v = PyString_FromString(namebuf); if (v == NULL) { Py_DECREF(d); d = NULL; break; } if (PyList_Append(d, v) != 0) { Py_DECREF(v); Py_DECREF(d); d = NULL; break; } Py_DECREF(v); } while (DosFindNext(hdir, &ep, sizeof(ep), &srchcnt) == NO_ERROR && srchcnt > 0); } return d; #else char *name = NULL; PyObject *d, *v; DIR *dirp; struct dirent *ep; int arg_is_unicode = 1; errno = 0; if (!PyArg_ParseTuple(args, "U:listdir", &v)) { arg_is_unicode = 0; PyErr_Clear(); } if (!PyArg_ParseTuple(args, "et:listdir", Py_FileSystemDefaultEncoding, &name)) return NULL; Py_BEGIN_ALLOW_THREADS dirp = opendir(name); Py_END_ALLOW_THREADS if (dirp == NULL) { return posix_error_with_allocated_filename(name); } if ((d = PyList_New(0)) == NULL) { Py_BEGIN_ALLOW_THREADS closedir(dirp); Py_END_ALLOW_THREADS PyMem_Free(name); return NULL; } for (;;) { errno = 0; Py_BEGIN_ALLOW_THREADS ep = readdir(dirp); Py_END_ALLOW_THREADS if (ep == NULL) { if (errno == 0) { break; } else { Py_BEGIN_ALLOW_THREADS closedir(dirp); Py_END_ALLOW_THREADS Py_DECREF(d); return posix_error_with_allocated_filename(name); } } if (ep->d_name[0] == '.' && (NAMLEN(ep) == 1 || (ep->d_name[1] == '.' && NAMLEN(ep) == 2))) continue; v = PyString_FromStringAndSize(ep->d_name, NAMLEN(ep)); if (v == NULL) { Py_DECREF(d); d = NULL; break; } #ifdef Py_USING_UNICODE if (arg_is_unicode) { PyObject *w; w = PyUnicode_FromEncodedObject(v, Py_FileSystemDefaultEncoding, "strict"); if (w != NULL) { Py_DECREF(v); v = w; } else { /* fall back to the original byte string, as discussed in patch #683592 */ PyErr_Clear(); } } #endif if (PyList_Append(d, v) != 0) { Py_DECREF(v); Py_DECREF(d); d = NULL; break; } Py_DECREF(v); } Py_BEGIN_ALLOW_THREADS closedir(dirp); Py_END_ALLOW_THREADS PyMem_Free(name); return d; #endif /* which OS */ } /* end of posix_listdir */ #ifdef MS_WINDOWS /* A helper function for abspath on win32 */ static PyObject * posix__getfullpathname(PyObject *self, PyObject *args) { /* assume encoded strings won't more than double no of chars */ char inbuf[MAX_PATH*2]; char *inbufp = inbuf; Py_ssize_t insize = sizeof(inbuf); char outbuf[MAX_PATH*2]; char *temp; Py_UNICODE *wpath; if (PyArg_ParseTuple(args, "u|:_getfullpathname", &wpath)) { Py_UNICODE woutbuf[MAX_PATH*2], *woutbufp = woutbuf; Py_UNICODE *wtemp; DWORD result; PyObject *v; result = GetFullPathNameW(wpath, sizeof(woutbuf)/sizeof(woutbuf[0]), woutbuf, &wtemp); if (result > sizeof(woutbuf)/sizeof(woutbuf[0])) { woutbufp = malloc(result * sizeof(Py_UNICODE)); if (!woutbufp) return PyErr_NoMemory(); result = GetFullPathNameW(wpath, result, woutbufp, &wtemp); } if (result) v = PyUnicode_FromUnicode(woutbufp, wcslen(woutbufp)); else v = win32_error_unicode("GetFullPathNameW", wpath); if (woutbufp != woutbuf) free(woutbufp); return v; } /* Drop the argument parsing error as narrow strings are also valid. */ PyErr_Clear(); if (!PyArg_ParseTuple (args, "et#:_getfullpathname", Py_FileSystemDefaultEncoding, &inbufp, &insize)) return NULL; if (!GetFullPathName(inbuf, sizeof(outbuf)/sizeof(outbuf[0]), outbuf, &temp)) return win32_error("GetFullPathName", inbuf); if (PyUnicode_Check(PyTuple_GetItem(args, 0))) { return PyUnicode_Decode(outbuf, strlen(outbuf), Py_FileSystemDefaultEncoding, NULL); } return PyString_FromString(outbuf); } /* end of posix__getfullpathname */ #endif /* MS_WINDOWS */ PyDoc_STRVAR(posix_mkdir__doc__, "mkdir(path [, mode=0777])\n\n\ Create a directory."); static PyObject * posix_mkdir(PyObject *self, PyObject *args) { int res; char *path = NULL; int mode = 0777; #ifdef MS_WINDOWS Py_UNICODE *wpath; if (PyArg_ParseTuple(args, "u|i:mkdir", &wpath, &mode)) { Py_BEGIN_ALLOW_THREADS res = CreateDirectoryW(wpath, NULL); Py_END_ALLOW_THREADS if (!res) return win32_error_unicode("mkdir", wpath); Py_INCREF(Py_None); return Py_None; } /* Drop the argument parsing error as narrow strings are also valid. */ PyErr_Clear(); if (!PyArg_ParseTuple(args, "et|i:mkdir", Py_FileSystemDefaultEncoding, &path, &mode)) return NULL; Py_BEGIN_ALLOW_THREADS res = CreateDirectoryA(path, NULL); Py_END_ALLOW_THREADS if (!res) { win32_error("mkdir", path); PyMem_Free(path); return NULL; } PyMem_Free(path); Py_INCREF(Py_None); return Py_None; #else /* MS_WINDOWS */ if (!PyArg_ParseTuple(args, "et|i:mkdir", Py_FileSystemDefaultEncoding, &path, &mode)) return NULL; Py_BEGIN_ALLOW_THREADS #if ( defined(__WATCOMC__) || defined(PYCC_VACPP) ) && !defined(__QNX__) res = mkdir(path); #else res = mkdir(path, mode); #endif Py_END_ALLOW_THREADS if (res < 0) return posix_error_with_allocated_filename(path); PyMem_Free(path); Py_INCREF(Py_None); return Py_None; #endif /* MS_WINDOWS */ } /* sys/resource.h is needed for at least: wait3(), wait4(), broken nice. */ #if defined(HAVE_SYS_RESOURCE_H) #include <sys/resource.h> #endif #ifdef HAVE_NICE PyDoc_STRVAR(posix_nice__doc__, "nice(inc) -> new_priority\n\n\ Decrease the priority of process by inc and return the new priority."); static PyObject * posix_nice(PyObject *self, PyObject *args) { int increment, value; if (!PyArg_ParseTuple(args, "i:nice", &increment)) return NULL; /* There are two flavours of 'nice': one that returns the new priority (as required by almost all standards out there) and the Linux/FreeBSD/BSDI one, which returns '0' on success and advices the use of getpriority() to get the new priority. If we are of the nice family that returns the new priority, we need to clear errno before the call, and check if errno is filled before calling posix_error() on a returnvalue of -1, because the -1 may be the actual new priority! */ errno = 0; value = nice(increment); #if defined(HAVE_BROKEN_NICE) && defined(HAVE_GETPRIORITY) if (value == 0) value = getpriority(PRIO_PROCESS, 0); #endif if (value == -1 && errno != 0) /* either nice() or getpriority() returned an error */ return posix_error(); return PyInt_FromLong((long) value); } #endif /* HAVE_NICE */ PyDoc_STRVAR(posix_rename__doc__, "rename(old, new)\n\n\ Rename a file or directory."); static PyObject * posix_rename(PyObject *self, PyObject *args) { #ifdef MS_WINDOWS PyObject *o1, *o2; char *p1, *p2; BOOL result; if (!PyArg_ParseTuple(args, "OO:rename", &o1, &o2)) goto error; if (!convert_to_unicode(&o1)) goto error; if (!convert_to_unicode(&o2)) { Py_DECREF(o1); goto error; } Py_BEGIN_ALLOW_THREADS result = MoveFileW(PyUnicode_AsUnicode(o1), PyUnicode_AsUnicode(o2)); Py_END_ALLOW_THREADS Py_DECREF(o1); Py_DECREF(o2); if (!result) return win32_error("rename", NULL); Py_INCREF(Py_None); return Py_None; error: PyErr_Clear(); if (!PyArg_ParseTuple(args, "ss:rename", &p1, &p2)) return NULL; Py_BEGIN_ALLOW_THREADS result = MoveFileA(p1, p2); Py_END_ALLOW_THREADS if (!result) return win32_error("rename", NULL); Py_INCREF(Py_None); return Py_None; #else return posix_2str(args, "etet:rename", rename); #endif } PyDoc_STRVAR(posix_rmdir__doc__, "rmdir(path)\n\n\ Remove a directory."); static PyObject * posix_rmdir(PyObject *self, PyObject *args) { #ifdef MS_WINDOWS return win32_1str(args, "rmdir", "s:rmdir", RemoveDirectoryA, "U:rmdir", RemoveDirectoryW); #else return posix_1str(args, "et:rmdir", rmdir); #endif } PyDoc_STRVAR(posix_stat__doc__, "stat(path) -> stat result\n\n\ Perform a stat system call on the given path."); static PyObject * posix_stat(PyObject *self, PyObject *args) { #ifdef MS_WINDOWS return posix_do_stat(self, args, "et:stat", STAT, "u:stat", win32_wstat); #else return posix_do_stat(self, args, "et:stat", STAT, NULL, NULL); #endif } #ifdef HAVE_SYSTEM PyDoc_STRVAR(posix_system__doc__, "system(command) -> exit_status\n\n\ Execute the command (a string) in a subshell."); #ifdef __IOS__ #include <spawn.h> static int _system (const char *cmd) { extern char **environ; pid_t pid; const char *argv[] = {"sh", "-c", (cmd == NULL) ? "echo" : cmd, NULL}; return posix_spawn(&pid, "/bin/sh", NULL, NULL, (char* const*)argv, environ); } #endif static PyObject * posix_system(PyObject *self, PyObject *args) { char *command; long sts; if (!PyArg_ParseTuple(args, "s:system", &command)) return NULL; Py_BEGIN_ALLOW_THREADS #ifdef __IOS__ sts = _system(command); #else sts = system(command); #endif Py_END_ALLOW_THREADS return PyInt_FromLong(sts); } #endif PyDoc_STRVAR(posix_umask__doc__, "umask(new_mask) -> old_mask\n\n\ Set the current numeric umask and return the previous umask."); static PyObject * posix_umask(PyObject *self, PyObject *args) { int i; if (!PyArg_ParseTuple(args, "i:umask", &i)) return NULL; i = (int)umask(i); if (i < 0) return posix_error(); return PyInt_FromLong((long)i); } PyDoc_STRVAR(posix_unlink__doc__, "unlink(path)\n\n\ Remove a file (same as remove(path))."); PyDoc_STRVAR(posix_remove__doc__, "remove(path)\n\n\ Remove a file (same as unlink(path))."); static PyObject * posix_unlink(PyObject *self, PyObject *args) { #ifdef MS_WINDOWS return win32_1str(args, "remove", "s:remove", DeleteFileA, "U:remove", DeleteFileW); #else return posix_1str(args, "et:remove", unlink); #endif } #ifdef HAVE_UNAME PyDoc_STRVAR(posix_uname__doc__, "uname() -> (sysname, nodename, release, version, machine)\n\n\ Return a tuple identifying the current operating system."); static PyObject * posix_uname(PyObject *self, PyObject *noargs) { struct utsname u; int res; Py_BEGIN_ALLOW_THREADS res = uname(&u); Py_END_ALLOW_THREADS if (res < 0) return posix_error(); return Py_BuildValue("(sssss)", u.sysname, u.nodename, u.release, u.version, u.machine); } #endif /* HAVE_UNAME */ static int extract_time(PyObject *t, time_t* sec, long* usec) { time_t intval; if (PyFloat_Check(t)) { double tval = PyFloat_AsDouble(t); PyObject *intobj = PyNumber_Long(t); if (!intobj) return -1; #if SIZEOF_TIME_T > SIZEOF_LONG intval = PyInt_AsUnsignedLongLongMask(intobj); #else intval = PyInt_AsLong(intobj); #endif Py_DECREF(intobj); if (intval == -1 && PyErr_Occurred()) return -1; *sec = intval; *usec = (long)((tval - intval) * 1e6); /* can't exceed 1000000 */ if (*usec < 0) /* If rounding gave us a negative number, truncate. */ *usec = 0; return 0; } #if SIZEOF_TIME_T > SIZEOF_LONG intval = PyInt_AsUnsignedLongLongMask(t); #else intval = PyInt_AsLong(t); #endif if (intval == -1 && PyErr_Occurred()) return -1; *sec = intval; *usec = 0; return 0; } PyDoc_STRVAR(posix_utime__doc__, "utime(path, (atime, mtime))\n\ utime(path, None)\n\n\ Set the access and modified time of the file to the given values. If the\n\ second form is used, set the access and modified times to the current time."); static PyObject * posix_utime(PyObject *self, PyObject *args) { #ifdef MS_WINDOWS PyObject *arg; wchar_t *wpath = NULL; char *apath = NULL; HANDLE hFile; time_t atimesec, mtimesec; long ausec, musec; FILETIME atime, mtime; PyObject *result = NULL; if (PyArg_ParseTuple(args, "uO|:utime", &wpath, &arg)) { Py_BEGIN_ALLOW_THREADS hFile = CreateFileW(wpath, FILE_WRITE_ATTRIBUTES, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); Py_END_ALLOW_THREADS if (hFile == INVALID_HANDLE_VALUE) return win32_error_unicode("utime", wpath); } else /* Drop the argument parsing error as narrow strings are also valid. */ PyErr_Clear(); if (!wpath) { if (!PyArg_ParseTuple(args, "etO:utime", Py_FileSystemDefaultEncoding, &apath, &arg)) return NULL; Py_BEGIN_ALLOW_THREADS hFile = CreateFileA(apath, FILE_WRITE_ATTRIBUTES, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); Py_END_ALLOW_THREADS if (hFile == INVALID_HANDLE_VALUE) { win32_error("utime", apath); PyMem_Free(apath); return NULL; } PyMem_Free(apath); } if (arg == Py_None) { SYSTEMTIME now; GetSystemTime(&now); if (!SystemTimeToFileTime(&now, &mtime) || !SystemTimeToFileTime(&now, &atime)) { win32_error("utime", NULL); goto done; } } else if (!PyTuple_Check(arg) || PyTuple_Size(arg) != 2) { PyErr_SetString(PyExc_TypeError, "utime() arg 2 must be a tuple (atime, mtime)"); goto done; } else { if (extract_time(PyTuple_GET_ITEM(arg, 0), &atimesec, &ausec) == -1) goto done; time_t_to_FILE_TIME(atimesec, 1000*ausec, &atime); if (extract_time(PyTuple_GET_ITEM(arg, 1), &mtimesec, &musec) == -1) goto done; time_t_to_FILE_TIME(mtimesec, 1000*musec, &mtime); } if (!SetFileTime(hFile, NULL, &atime, &mtime)) { /* Avoid putting the file name into the error here, as that may confuse the user into believing that something is wrong with the file, when it also could be the time stamp that gives a problem. */ win32_error("utime", NULL); goto done; } Py_INCREF(Py_None); result = Py_None; done: CloseHandle(hFile); return result; #else /* MS_WINDOWS */ char *path = NULL; time_t atime, mtime; long ausec, musec; int res; PyObject* arg; #if defined(HAVE_UTIMES) struct timeval buf[2]; #define ATIME buf[0].tv_sec #define MTIME buf[1].tv_sec #elif defined(HAVE_UTIME_H) /* XXX should define struct utimbuf instead, above */ struct utimbuf buf; #define ATIME buf.actime #define MTIME buf.modtime #define UTIME_ARG &buf #else /* HAVE_UTIMES */ time_t buf[2]; #define ATIME buf[0] #define MTIME buf[1] #define UTIME_ARG buf #endif /* HAVE_UTIMES */ if (!PyArg_ParseTuple(args, "etO:utime", Py_FileSystemDefaultEncoding, &path, &arg)) return NULL; if (arg == Py_None) { /* optional time values not given */ Py_BEGIN_ALLOW_THREADS res = utime(path, NULL); Py_END_ALLOW_THREADS } else if (!PyTuple_Check(arg) || PyTuple_Size(arg) != 2) { PyErr_SetString(PyExc_TypeError, "utime() arg 2 must be a tuple (atime, mtime)"); PyMem_Free(path); return NULL; } else { if (extract_time(PyTuple_GET_ITEM(arg, 0), &atime, &ausec) == -1) { PyMem_Free(path); return NULL; } if (extract_time(PyTuple_GET_ITEM(arg, 1), &mtime, &musec) == -1) { PyMem_Free(path); return NULL; } ATIME = atime; MTIME = mtime; #ifdef HAVE_UTIMES buf[0].tv_usec = ausec; buf[1].tv_usec = musec; Py_BEGIN_ALLOW_THREADS res = utimes(path, buf); Py_END_ALLOW_THREADS #else Py_BEGIN_ALLOW_THREADS res = utime(path, UTIME_ARG); Py_END_ALLOW_THREADS #endif /* HAVE_UTIMES */ } if (res < 0) { return posix_error_with_allocated_filename(path); } PyMem_Free(path); Py_INCREF(Py_None); return Py_None; #undef UTIME_ARG #undef ATIME #undef MTIME #endif /* MS_WINDOWS */ } /* Process operations */ PyDoc_STRVAR(posix__exit__doc__, "_exit(status)\n\n\ Exit to the system with specified status, without normal exit processing."); static PyObject * posix__exit(PyObject *self, PyObject *args) { int sts; if (!PyArg_ParseTuple(args, "i:_exit", &sts)) return NULL; _exit(sts); return NULL; /* Make gcc -Wall happy */ } #if defined(HAVE_EXECV) || defined(HAVE_SPAWNV) static void free_string_array(char **array, Py_ssize_t count) { Py_ssize_t i; for (i = 0; i < count; i++) PyMem_Free(array[i]); PyMem_DEL(array); } #endif #ifdef HAVE_EXECV PyDoc_STRVAR(posix_execv__doc__, "execv(path, args)\n\n\ Execute an executable path with arguments, replacing current process.\n\ \n\ path: path of executable file\n\ args: tuple or list of strings"); static PyObject * posix_execv(PyObject *self, PyObject *args) { char *path; PyObject *argv; char **argvlist; Py_ssize_t i, argc; PyObject *(*getitem)(PyObject *, Py_ssize_t); /* execv has two arguments: (path, argv), where argv is a list or tuple of strings. */ if (!PyArg_ParseTuple(args, "etO:execv", Py_FileSystemDefaultEncoding, &path, &argv)) return NULL; if (PyList_Check(argv)) { argc = PyList_Size(argv); getitem = PyList_GetItem; } else if (PyTuple_Check(argv)) { argc = PyTuple_Size(argv); getitem = PyTuple_GetItem; } else { PyErr_SetString(PyExc_TypeError, "execv() arg 2 must be a tuple or list"); PyMem_Free(path); return NULL; } if (argc < 1) { PyErr_SetString(PyExc_ValueError, "execv() arg 2 must not be empty"); PyMem_Free(path); return NULL; } argvlist = PyMem_NEW(char *, argc+1); if (argvlist == NULL) { PyMem_Free(path); return PyErr_NoMemory(); } for (i = 0; i < argc; i++) { if (!PyArg_Parse((*getitem)(argv, i), "et", Py_FileSystemDefaultEncoding, &argvlist[i])) { free_string_array(argvlist, i); PyErr_SetString(PyExc_TypeError, "execv() arg 2 must contain only strings"); PyMem_Free(path); return NULL; } } argvlist[argc] = NULL; execv(path, argvlist); /* If we get here it's definitely an error */ free_string_array(argvlist, argc); PyMem_Free(path); return posix_error(); } PyDoc_STRVAR(posix_execve__doc__, "execve(path, args, env)\n\n\ Execute a path with arguments and environment, replacing current process.\n\ \n\ path: path of executable file\n\ args: tuple or list of arguments\n\ env: dictionary of strings mapping to strings"); static PyObject * posix_execve(PyObject *self, PyObject *args) { char *path; PyObject *argv, *env; char **argvlist; char **envlist; PyObject *key, *val, *keys=NULL, *vals=NULL; Py_ssize_t i, pos, argc, envc; PyObject *(*getitem)(PyObject *, Py_ssize_t); Py_ssize_t lastarg = 0; /* execve has three arguments: (path, argv, env), where argv is a list or tuple of strings and env is a dictionary like posix.environ. */ if (!PyArg_ParseTuple(args, "etOO:execve", Py_FileSystemDefaultEncoding, &path, &argv, &env)) return NULL; if (PyList_Check(argv)) { argc = PyList_Size(argv); getitem = PyList_GetItem; } else if (PyTuple_Check(argv)) { argc = PyTuple_Size(argv); getitem = PyTuple_GetItem; } else { PyErr_SetString(PyExc_TypeError, "execve() arg 2 must be a tuple or list"); goto fail_0; } if (!PyMapping_Check(env)) { PyErr_SetString(PyExc_TypeError, "execve() arg 3 must be a mapping object"); goto fail_0; } argvlist = PyMem_NEW(char *, argc+1); if (argvlist == NULL) { PyErr_NoMemory(); goto fail_0; } for (i = 0; i < argc; i++) { if (!PyArg_Parse((*getitem)(argv, i), "et;execve() arg 2 must contain only strings", Py_FileSystemDefaultEncoding, &argvlist[i])) { lastarg = i; goto fail_1; } } lastarg = argc; argvlist[argc] = NULL; i = PyMapping_Size(env); if (i < 0) goto fail_1; envlist = PyMem_NEW(char *, i + 1); if (envlist == NULL) { PyErr_NoMemory(); goto fail_1; } envc = 0; keys = PyMapping_Keys(env); vals = PyMapping_Values(env); if (!keys || !vals) goto fail_2; if (!PyList_Check(keys) || !PyList_Check(vals)) { PyErr_SetString(PyExc_TypeError, "execve(): env.keys() or env.values() is not a list"); goto fail_2; } for (pos = 0; pos < i; pos++) { char *p, *k, *v; size_t len; key = PyList_GetItem(keys, pos); val = PyList_GetItem(vals, pos); if (!key || !val) goto fail_2; if (!PyArg_Parse( key, "s;execve() arg 3 contains a non-string key", &k) || !PyArg_Parse( val, "s;execve() arg 3 contains a non-string value", &v)) { goto fail_2; } /* Search from index 1 because on Windows starting '=' is allowed for defining hidden environment variables. */ if (*k == '\0' || strchr(k + 1, '=') != NULL) { PyErr_SetString(PyExc_ValueError, "illegal environment variable name"); goto fail_2; } #if defined(PYOS_OS2) /* Omit Pseudo-Env Vars that Would Confuse Programs if Passed On */ if (stricmp(k, "BEGINLIBPATH") != 0 && stricmp(k, "ENDLIBPATH") != 0) { #endif len = PyString_Size(key) + PyString_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); goto fail_2; } PyOS_snprintf(p, len, "%s=%s", k, v); envlist[envc++] = p; #if defined(PYOS_OS2) } #endif } envlist[envc] = 0; execve(path, argvlist, envlist); /* If we get here it's definitely an error */ (void) posix_error(); fail_2: while (--envc >= 0) PyMem_DEL(envlist[envc]); PyMem_DEL(envlist); fail_1: free_string_array(argvlist, lastarg); Py_XDECREF(vals); Py_XDECREF(keys); fail_0: PyMem_Free(path); return NULL; } #endif /* HAVE_EXECV */ #ifdef HAVE_SPAWNV PyDoc_STRVAR(posix_spawnv__doc__, "spawnv(mode, path, args)\n\n\ Execute the program 'path' in a new process.\n\ \n\ mode: mode of process creation\n\ path: path of executable file\n\ args: tuple or list of strings"); static PyObject * posix_spawnv(PyObject *self, PyObject *args) { char *path; PyObject *argv; char **argvlist; int mode, i; Py_ssize_t argc; Py_intptr_t spawnval; PyObject *(*getitem)(PyObject *, Py_ssize_t); /* spawnv has three arguments: (mode, path, argv), where argv is a list or tuple of strings. */ if (!PyArg_ParseTuple(args, "ietO:spawnv", &mode, Py_FileSystemDefaultEncoding, &path, &argv)) return NULL; if (PyList_Check(argv)) { argc = PyList_Size(argv); getitem = PyList_GetItem; } else if (PyTuple_Check(argv)) { argc = PyTuple_Size(argv); getitem = PyTuple_GetItem; } else { PyErr_SetString(PyExc_TypeError, "spawnv() arg 2 must be a tuple or list"); PyMem_Free(path); return NULL; } argvlist = PyMem_NEW(char *, argc+1); if (argvlist == NULL) { PyMem_Free(path); return PyErr_NoMemory(); } for (i = 0; i < argc; i++) { if (!PyArg_Parse((*getitem)(argv, i), "et", Py_FileSystemDefaultEncoding, &argvlist[i])) { free_string_array(argvlist, i); PyErr_SetString( PyExc_TypeError, "spawnv() arg 2 must contain only strings"); PyMem_Free(path); return NULL; } } argvlist[argc] = NULL; #if defined(PYOS_OS2) && defined(PYCC_GCC) Py_BEGIN_ALLOW_THREADS spawnval = spawnv(mode, path, argvlist); Py_END_ALLOW_THREADS #else if (mode == _OLD_P_OVERLAY) mode = _P_OVERLAY; Py_BEGIN_ALLOW_THREADS spawnval = _spawnv(mode, path, argvlist); Py_END_ALLOW_THREADS #endif free_string_array(argvlist, argc); PyMem_Free(path); if (spawnval == -1) return posix_error(); else #if SIZEOF_LONG == SIZEOF_VOID_P return Py_BuildValue("l", (long) spawnval); #else return Py_BuildValue("L", (PY_LONG_LONG) spawnval); #endif } PyDoc_STRVAR(posix_spawnve__doc__, "spawnve(mode, path, args, env)\n\n\ Execute the program 'path' in a new process.\n\ \n\ mode: mode of process creation\n\ path: path of executable file\n\ args: tuple or list of arguments\n\ env: dictionary of strings mapping to strings"); static PyObject * posix_spawnve(PyObject *self, PyObject *args) { char *path; PyObject *argv, *env; char **argvlist; char **envlist; PyObject *key, *val, *keys=NULL, *vals=NULL, *res=NULL; int mode, pos, envc; Py_ssize_t argc, i; Py_intptr_t spawnval; PyObject *(*getitem)(PyObject *, Py_ssize_t); Py_ssize_t lastarg = 0; /* spawnve has four arguments: (mode, path, argv, env), where argv is a list or tuple of strings and env is a dictionary like posix.environ. */ if (!PyArg_ParseTuple(args, "ietOO:spawnve", &mode, Py_FileSystemDefaultEncoding, &path, &argv, &env)) return NULL; if (PyList_Check(argv)) { argc = PyList_Size(argv); getitem = PyList_GetItem; } else if (PyTuple_Check(argv)) { argc = PyTuple_Size(argv); getitem = PyTuple_GetItem; } else { PyErr_SetString(PyExc_TypeError, "spawnve() arg 2 must be a tuple or list"); goto fail_0; } if (!PyMapping_Check(env)) { PyErr_SetString(PyExc_TypeError, "spawnve() arg 3 must be a mapping object"); goto fail_0; } argvlist = PyMem_NEW(char *, argc+1); if (argvlist == NULL) { PyErr_NoMemory(); goto fail_0; } for (i = 0; i < argc; i++) { if (!PyArg_Parse((*getitem)(argv, i), "et;spawnve() arg 2 must contain only strings", Py_FileSystemDefaultEncoding, &argvlist[i])) { lastarg = i; goto fail_1; } } lastarg = argc; argvlist[argc] = NULL; i = PyMapping_Size(env); if (i < 0) goto fail_1; envlist = PyMem_NEW(char *, i + 1); if (envlist == NULL) { PyErr_NoMemory(); goto fail_1; } envc = 0; keys = PyMapping_Keys(env); vals = PyMapping_Values(env); if (!keys || !vals) goto fail_2; if (!PyList_Check(keys) || !PyList_Check(vals)) { PyErr_SetString(PyExc_TypeError, "spawnve(): env.keys() or env.values() is not a list"); goto fail_2; } for (pos = 0; pos < i; pos++) { char *p, *k, *v; size_t len; key = PyList_GetItem(keys, pos); val = PyList_GetItem(vals, pos); if (!key || !val) goto fail_2; if (!PyArg_Parse( key, "s;spawnve() arg 3 contains a non-string key", &k) || !PyArg_Parse( val, "s;spawnve() arg 3 contains a non-string value", &v)) { goto fail_2; } /* Search from index 1 because on Windows starting '=' is allowed for defining hidden environment variables. */ if (*k == '\0' || strchr(k + 1, '=') != NULL) { PyErr_SetString(PyExc_ValueError, "illegal environment variable name"); goto fail_2; } len = PyString_Size(key) + PyString_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); goto fail_2; } PyOS_snprintf(p, len, "%s=%s", k, v); envlist[envc++] = p; } envlist[envc] = 0; #if defined(PYOS_OS2) && defined(PYCC_GCC) Py_BEGIN_ALLOW_THREADS spawnval = spawnve(mode, path, argvlist, envlist); Py_END_ALLOW_THREADS #else if (mode == _OLD_P_OVERLAY) mode = _P_OVERLAY; Py_BEGIN_ALLOW_THREADS spawnval = _spawnve(mode, path, argvlist, envlist); Py_END_ALLOW_THREADS #endif if (spawnval == -1) (void) posix_error(); else #if SIZEOF_LONG == SIZEOF_VOID_P res = Py_BuildValue("l", (long) spawnval); #else res = Py_BuildValue("L", (PY_LONG_LONG) spawnval); #endif fail_2: while (--envc >= 0) PyMem_DEL(envlist[envc]); PyMem_DEL(envlist); fail_1: free_string_array(argvlist, lastarg); Py_XDECREF(vals); Py_XDECREF(keys); fail_0: PyMem_Free(path); return res; } /* OS/2 supports spawnvp & spawnvpe natively */ #if defined(PYOS_OS2) PyDoc_STRVAR(posix_spawnvp__doc__, "spawnvp(mode, file, args)\n\n\ Execute the program 'file' in a new process, using the environment\n\ search path to find the file.\n\ \n\ mode: mode of process creation\n\ file: executable file name\n\ args: tuple or list of strings"); static PyObject * posix_spawnvp(PyObject *self, PyObject *args) { char *path; PyObject *argv; char **argvlist; int mode, i, argc; Py_intptr_t spawnval; PyObject *(*getitem)(PyObject *, Py_ssize_t); /* spawnvp has three arguments: (mode, path, argv), where argv is a list or tuple of strings. */ if (!PyArg_ParseTuple(args, "ietO:spawnvp", &mode, Py_FileSystemDefaultEncoding, &path, &argv)) return NULL; if (PyList_Check(argv)) { argc = PyList_Size(argv); getitem = PyList_GetItem; } else if (PyTuple_Check(argv)) { argc = PyTuple_Size(argv); getitem = PyTuple_GetItem; } else { PyErr_SetString(PyExc_TypeError, "spawnvp() arg 2 must be a tuple or list"); PyMem_Free(path); return NULL; } argvlist = PyMem_NEW(char *, argc+1); if (argvlist == NULL) { PyMem_Free(path); return PyErr_NoMemory(); } for (i = 0; i < argc; i++) { if (!PyArg_Parse((*getitem)(argv, i), "et", Py_FileSystemDefaultEncoding, &argvlist[i])) { free_string_array(argvlist, i); PyErr_SetString( PyExc_TypeError, "spawnvp() arg 2 must contain only strings"); PyMem_Free(path); return NULL; } } argvlist[argc] = NULL; Py_BEGIN_ALLOW_THREADS #if defined(PYCC_GCC) spawnval = spawnvp(mode, path, argvlist); #else spawnval = _spawnvp(mode, path, argvlist); #endif Py_END_ALLOW_THREADS free_string_array(argvlist, argc); PyMem_Free(path); if (spawnval == -1) return posix_error(); else return Py_BuildValue("l", (long) spawnval); } PyDoc_STRVAR(posix_spawnvpe__doc__, "spawnvpe(mode, file, args, env)\n\n\ Execute the program 'file' in a new process, using the environment\n\ search path to find the file.\n\ \n\ mode: mode of process creation\n\ file: executable file name\n\ args: tuple or list of arguments\n\ env: dictionary of strings mapping to strings"); static PyObject * posix_spawnvpe(PyObject *self, PyObject *args) { char *path; PyObject *argv, *env; char **argvlist; char **envlist; PyObject *key, *val, *keys=NULL, *vals=NULL, *res=NULL; int mode, i, pos, argc, envc; Py_intptr_t spawnval; PyObject *(*getitem)(PyObject *, Py_ssize_t); int lastarg = 0; /* spawnvpe has four arguments: (mode, path, argv, env), where argv is a list or tuple of strings and env is a dictionary like posix.environ. */ if (!PyArg_ParseTuple(args, "ietOO:spawnvpe", &mode, Py_FileSystemDefaultEncoding, &path, &argv, &env)) return NULL; if (PyList_Check(argv)) { argc = PyList_Size(argv); getitem = PyList_GetItem; } else if (PyTuple_Check(argv)) { argc = PyTuple_Size(argv); getitem = PyTuple_GetItem; } else { PyErr_SetString(PyExc_TypeError, "spawnvpe() arg 2 must be a tuple or list"); goto fail_0; } if (!PyMapping_Check(env)) { PyErr_SetString(PyExc_TypeError, "spawnvpe() arg 3 must be a mapping object"); goto fail_0; } argvlist = PyMem_NEW(char *, argc+1); if (argvlist == NULL) { PyErr_NoMemory(); goto fail_0; } for (i = 0; i < argc; i++) { if (!PyArg_Parse((*getitem)(argv, i), "et;spawnvpe() arg 2 must contain only strings", Py_FileSystemDefaultEncoding, &argvlist[i])) { lastarg = i; goto fail_1; } } lastarg = argc; argvlist[argc] = NULL; i = PyMapping_Size(env); if (i < 0) goto fail_1; envlist = PyMem_NEW(char *, i + 1); if (envlist == NULL) { PyErr_NoMemory(); goto fail_1; } envc = 0; keys = PyMapping_Keys(env); vals = PyMapping_Values(env); if (!keys || !vals) goto fail_2; if (!PyList_Check(keys) || !PyList_Check(vals)) { PyErr_SetString(PyExc_TypeError, "spawnvpe(): env.keys() or env.values() is not a list"); goto fail_2; } for (pos = 0; pos < i; pos++) { char *p, *k, *v; size_t len; key = PyList_GetItem(keys, pos); val = PyList_GetItem(vals, pos); if (!key || !val) goto fail_2; if (!PyArg_Parse( key, "s;spawnvpe() arg 3 contains a non-string key", &k) || !PyArg_Parse( val, "s;spawnvpe() arg 3 contains a non-string value", &v)) { goto fail_2; } /* Search from index 1 because on Windows starting '=' is allowed for defining hidden environment variables. */ if (*k == '\0' || strchr(k + 1, '=') != NULL) { PyErr_SetString(PyExc_ValueError, "illegal environment variable name"); goto fail_2; } len = PyString_Size(key) + PyString_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); goto fail_2; } PyOS_snprintf(p, len, "%s=%s", k, v); envlist[envc++] = p; } envlist[envc] = 0; Py_BEGIN_ALLOW_THREADS #if defined(PYCC_GCC) spawnval = spawnvpe(mode, path, argvlist, envlist); #else spawnval = _spawnvpe(mode, path, argvlist, envlist); #endif Py_END_ALLOW_THREADS if (spawnval == -1) (void) posix_error(); else res = Py_BuildValue("l", (long) spawnval); fail_2: while (--envc >= 0) PyMem_DEL(envlist[envc]); PyMem_DEL(envlist); fail_1: free_string_array(argvlist, lastarg); Py_XDECREF(vals); Py_XDECREF(keys); fail_0: PyMem_Free(path); return res; } #endif /* PYOS_OS2 */ #endif /* HAVE_SPAWNV */ #ifdef HAVE_FORK1 PyDoc_STRVAR(posix_fork1__doc__, "fork1() -> pid\n\n\ Fork a child process with a single multiplexed (i.e., not bound) thread.\n\ \n\ Return 0 to child process and PID of child to parent process."); static PyObject * posix_fork1(PyObject *self, PyObject *noargs) { pid_t pid; int result = 0; _PyImport_AcquireLock(); pid = fork1(); if (pid == 0) { /* child: this clobbers and resets the import lock. */ PyOS_AfterFork(); } else { /* parent: release the import lock. */ result = _PyImport_ReleaseLock(); } if (pid == -1) return posix_error(); if (result < 0) { /* Don't clobber the OSError if the fork failed. */ PyErr_SetString(PyExc_RuntimeError, "not holding the import lock"); return NULL; } return PyLong_FromPid(pid); } #endif #ifdef HAVE_FORK PyDoc_STRVAR(posix_fork__doc__, "fork() -> pid\n\n\ Fork a child process.\n\ Return 0 to child process and PID of child to parent process."); static PyObject * posix_fork(PyObject *self, PyObject *noargs) { pid_t pid; int result = 0; _PyImport_AcquireLock(); pid = fork(); if (pid == 0) { /* child: this clobbers and resets the import lock. */ PyOS_AfterFork(); } else { /* parent: release the import lock. */ result = _PyImport_ReleaseLock(); } if (pid == -1) return posix_error(); if (result < 0) { /* Don't clobber the OSError if the fork failed. */ PyErr_SetString(PyExc_RuntimeError, "not holding the import lock"); return NULL; } return PyLong_FromPid(pid); } #endif /* AIX uses /dev/ptc but is otherwise the same as /dev/ptmx */ /* IRIX has both /dev/ptc and /dev/ptmx, use ptmx */ #if defined(HAVE_DEV_PTC) && !defined(HAVE_DEV_PTMX) #define DEV_PTY_FILE "/dev/ptc" #define HAVE_DEV_PTMX #else #define DEV_PTY_FILE "/dev/ptmx" #endif #if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(HAVE_DEV_PTMX) #ifdef HAVE_PTY_H #include <pty.h> #else #ifdef HAVE_LIBUTIL_H #include <libutil.h> #else #ifdef HAVE_UTIL_H #include <util.h> #endif /* HAVE_UTIL_H */ #endif /* HAVE_LIBUTIL_H */ #endif /* HAVE_PTY_H */ #ifdef HAVE_STROPTS_H #include <stropts.h> #endif #endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(HAVE_DEV_PTMX) */ #if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX) PyDoc_STRVAR(posix_openpty__doc__, "openpty() -> (master_fd, slave_fd)\n\n\ Open a pseudo-terminal, returning open fd's for both master and slave end.\n"); static PyObject * posix_openpty(PyObject *self, PyObject *noargs) { int master_fd, slave_fd; #ifndef HAVE_OPENPTY char * slave_name; #endif #if defined(HAVE_DEV_PTMX) && !defined(HAVE_OPENPTY) && !defined(HAVE__GETPTY) PyOS_sighandler_t sig_saved; #ifdef sun extern char *ptsname(int fildes); #endif #endif #ifdef HAVE_OPENPTY if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0) return posix_error(); #elif defined(HAVE__GETPTY) slave_name = _getpty(&master_fd, O_RDWR, 0666, 0); if (slave_name == NULL) return posix_error(); slave_fd = open(slave_name, O_RDWR); if (slave_fd < 0) return posix_error(); #else master_fd = open(DEV_PTY_FILE, O_RDWR | O_NOCTTY); /* open master */ if (master_fd < 0) return posix_error(); sig_saved = PyOS_setsig(SIGCHLD, SIG_DFL); /* change permission of slave */ if (grantpt(master_fd) < 0) { PyOS_setsig(SIGCHLD, sig_saved); return posix_error(); } /* unlock slave */ if (unlockpt(master_fd) < 0) { PyOS_setsig(SIGCHLD, sig_saved); return posix_error(); } PyOS_setsig(SIGCHLD, sig_saved); slave_name = ptsname(master_fd); /* get name of slave */ if (slave_name == NULL) return posix_error(); slave_fd = open(slave_name, O_RDWR | O_NOCTTY); /* open slave */ if (slave_fd < 0) return posix_error(); #if !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC) ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */ ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */ #ifndef __hpux ioctl(slave_fd, I_PUSH, "ttcompat"); /* push ttcompat */ #endif /* __hpux */ #endif /* HAVE_CYGWIN */ #endif /* HAVE_OPENPTY */ return Py_BuildValue("(ii)", master_fd, slave_fd); } #endif /* defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX) */ #ifdef HAVE_FORKPTY PyDoc_STRVAR(posix_forkpty__doc__, "forkpty() -> (pid, master_fd)\n\n\ Fork a new process with a new pseudo-terminal as controlling tty.\n\n\ Like fork(), return 0 as pid to child process, and PID of child to parent.\n\ To both, return fd of newly opened pseudo-terminal.\n"); static PyObject * posix_forkpty(PyObject *self, PyObject *noargs) { int master_fd = -1, result = 0; pid_t pid; _PyImport_AcquireLock(); pid = forkpty(&master_fd, NULL, NULL, NULL); if (pid == 0) { /* child: this clobbers and resets the import lock. */ PyOS_AfterFork(); } else { /* parent: release the import lock. */ result = _PyImport_ReleaseLock(); } if (pid == -1) return posix_error(); if (result < 0) { /* Don't clobber the OSError if the fork failed. */ PyErr_SetString(PyExc_RuntimeError, "not holding the import lock"); return NULL; } return Py_BuildValue("(Ni)", PyLong_FromPid(pid), master_fd); } #endif #ifdef HAVE_GETEGID PyDoc_STRVAR(posix_getegid__doc__, "getegid() -> egid\n\n\ Return the current process's effective group id."); static PyObject * posix_getegid(PyObject *self, PyObject *noargs) { return _PyInt_FromGid(getegid()); } #endif #ifdef HAVE_GETEUID PyDoc_STRVAR(posix_geteuid__doc__, "geteuid() -> euid\n\n\ Return the current process's effective user id."); static PyObject * posix_geteuid(PyObject *self, PyObject *noargs) { return _PyInt_FromUid(geteuid()); } #endif #ifdef HAVE_GETGID PyDoc_STRVAR(posix_getgid__doc__, "getgid() -> gid\n\n\ Return the current process's group id."); static PyObject * posix_getgid(PyObject *self, PyObject *noargs) { return _PyInt_FromGid(getgid()); } #endif PyDoc_STRVAR(posix_getpid__doc__, "getpid() -> pid\n\n\ Return the current process id"); static PyObject * posix_getpid(PyObject *self, PyObject *noargs) { return PyLong_FromPid(getpid()); } #ifdef HAVE_GETGROUPS PyDoc_STRVAR(posix_getgroups__doc__, "getgroups() -> list of group IDs\n\n\ Return list of supplemental group IDs for the process."); static PyObject * posix_getgroups(PyObject *self, PyObject *noargs) { PyObject *result = NULL; #ifdef NGROUPS_MAX #define MAX_GROUPS NGROUPS_MAX #else /* defined to be 16 on Solaris7, so this should be a small number */ #define MAX_GROUPS 64 #endif gid_t grouplist[MAX_GROUPS]; /* On MacOSX getgroups(2) can return more than MAX_GROUPS results * This is a helper variable to store the intermediate result when * that happens. * * To keep the code readable the OSX behaviour is unconditional, * according to the POSIX spec this should be safe on all unix-y * systems. */ gid_t* alt_grouplist = grouplist; int n; #ifdef __APPLE__ /* Issue #17557: As of OS X 10.8, getgroups(2) no longer raises EINVAL if * there are more groups than can fit in grouplist. Therefore, on OS X * always first call getgroups with length 0 to get the actual number * of groups. */ n = getgroups(0, NULL); if (n < 0) { return posix_error(); } else if (n <= MAX_GROUPS) { /* groups will fit in existing array */ alt_grouplist = grouplist; } else { alt_grouplist = PyMem_Malloc(n * sizeof(gid_t)); if (alt_grouplist == NULL) { errno = EINVAL; return posix_error(); } } n = getgroups(n, alt_grouplist); if (n == -1) { if (alt_grouplist != grouplist) { PyMem_Free(alt_grouplist); } return posix_error(); } #else n = getgroups(MAX_GROUPS, grouplist); if (n < 0) { if (errno == EINVAL) { n = getgroups(0, NULL); if (n == -1) { return posix_error(); } if (n == 0) { /* Avoid malloc(0) */ alt_grouplist = grouplist; } else { alt_grouplist = PyMem_Malloc(n * sizeof(gid_t)); if (alt_grouplist == NULL) { errno = EINVAL; return posix_error(); } n = getgroups(n, alt_grouplist); if (n == -1) { PyMem_Free(alt_grouplist); return posix_error(); } } } else { return posix_error(); } } #endif result = PyList_New(n); if (result != NULL) { int i; for (i = 0; i < n; ++i) { PyObject *o = _PyInt_FromGid(alt_grouplist[i]); if (o == NULL) { Py_DECREF(result); result = NULL; break; } PyList_SET_ITEM(result, i, o); } } if (alt_grouplist != grouplist) { PyMem_Free(alt_grouplist); } return result; } #endif #ifdef HAVE_INITGROUPS PyDoc_STRVAR(posix_initgroups__doc__, "initgroups(username, gid) -> None\n\n\ Call the system initgroups() to initialize the group access list with all of\n\ the groups of which the specified username is a member, plus the specified\n\ group id."); static PyObject * posix_initgroups(PyObject *self, PyObject *args) { char *username; #ifdef __APPLE__ int gid; #else gid_t gid; #endif #ifdef __APPLE__ if (!PyArg_ParseTuple(args, "si:initgroups", &username, &gid)) #else if (!PyArg_ParseTuple(args, "sO&:initgroups", &username, _Py_Gid_Converter, &gid)) #endif return NULL; if (initgroups(username, gid) == -1) return PyErr_SetFromErrno(PyExc_OSError); Py_INCREF(Py_None); return Py_None; } #endif #ifdef HAVE_GETPGID PyDoc_STRVAR(posix_getpgid__doc__, "getpgid(pid) -> pgid\n\n\ Call the system call getpgid()."); static PyObject * posix_getpgid(PyObject *self, PyObject *args) { pid_t pid, pgid; if (!PyArg_ParseTuple(args, PARSE_PID ":getpgid", &pid)) return NULL; pgid = getpgid(pid); if (pgid < 0) return posix_error(); return PyLong_FromPid(pgid); } #endif /* HAVE_GETPGID */ #ifdef HAVE_GETPGRP PyDoc_STRVAR(posix_getpgrp__doc__, "getpgrp() -> pgrp\n\n\ Return the current process group id."); static PyObject * posix_getpgrp(PyObject *self, PyObject *noargs) { #ifdef GETPGRP_HAVE_ARG return PyLong_FromPid(getpgrp(0)); #else /* GETPGRP_HAVE_ARG */ return PyLong_FromPid(getpgrp()); #endif /* GETPGRP_HAVE_ARG */ } #endif /* HAVE_GETPGRP */ #ifdef HAVE_SETPGRP PyDoc_STRVAR(posix_setpgrp__doc__, "setpgrp()\n\n\ Make this process the process group leader."); static PyObject * posix_setpgrp(PyObject *self, PyObject *noargs) { #ifdef SETPGRP_HAVE_ARG if (setpgrp(0, 0) < 0) #else /* SETPGRP_HAVE_ARG */ if (setpgrp() < 0) #endif /* SETPGRP_HAVE_ARG */ return posix_error(); Py_INCREF(Py_None); return Py_None; } #endif /* HAVE_SETPGRP */ #ifdef HAVE_GETPPID PyDoc_STRVAR(posix_getppid__doc__, "getppid() -> ppid\n\n\ Return the parent's process id."); static PyObject * posix_getppid(PyObject *self, PyObject *noargs) { return PyLong_FromPid(getppid()); } #endif #ifdef HAVE_GETLOGIN PyDoc_STRVAR(posix_getlogin__doc__, "getlogin() -> string\n\n\ Return the actual login name."); static PyObject * posix_getlogin(PyObject *self, PyObject *noargs) { PyObject *result = NULL; char *name; int old_errno = errno; errno = 0; name = getlogin(); if (name == NULL) { if (errno) posix_error(); else PyErr_SetString(PyExc_OSError, "unable to determine login name"); } else result = PyString_FromString(name); errno = old_errno; return result; } #endif #ifdef HAVE_GETUID PyDoc_STRVAR(posix_getuid__doc__, "getuid() -> uid\n\n\ Return the current process's user id."); static PyObject * posix_getuid(PyObject *self, PyObject *noargs) { return _PyInt_FromUid(getuid()); } #endif #ifdef HAVE_KILL PyDoc_STRVAR(posix_kill__doc__, "kill(pid, sig)\n\n\ Kill a process with a signal."); static PyObject * posix_kill(PyObject *self, PyObject *args) { pid_t pid; int sig; if (!PyArg_ParseTuple(args, PARSE_PID "i:kill", &pid, &sig)) return NULL; #if defined(PYOS_OS2) && !defined(PYCC_GCC) if (sig == XCPT_SIGNAL_INTR || sig == XCPT_SIGNAL_BREAK) { APIRET rc; if ((rc = DosSendSignalException(pid, sig)) != NO_ERROR) return os2_error(rc); } else if (sig == XCPT_SIGNAL_KILLPROC) { APIRET rc; if ((rc = DosKillProcess(DKP_PROCESS, pid)) != NO_ERROR) return os2_error(rc); } else return NULL; /* Unrecognized Signal Requested */ #else if (kill(pid, sig) == -1) return posix_error(); #endif Py_INCREF(Py_None); return Py_None; } #endif #ifdef HAVE_KILLPG PyDoc_STRVAR(posix_killpg__doc__, "killpg(pgid, sig)\n\n\ Kill a process group with a signal."); static PyObject * posix_killpg(PyObject *self, PyObject *args) { int sig; pid_t pgid; /* XXX some man pages make the `pgid` parameter an int, others a pid_t. Since getpgrp() returns a pid_t, we assume killpg should take the same type. Moreover, pid_t is always at least as wide as int (else compilation of this module fails), which is safe. */ if (!PyArg_ParseTuple(args, PARSE_PID "i:killpg", &pgid, &sig)) return NULL; if (killpg(pgid, sig) == -1) return posix_error(); Py_INCREF(Py_None); return Py_None; } #endif #ifdef MS_WINDOWS PyDoc_STRVAR(win32_kill__doc__, "kill(pid, sig)\n\n\ Kill a process with a signal."); static PyObject * win32_kill(PyObject *self, PyObject *args) { PyObject *result; DWORD pid, sig, err; HANDLE handle; if (!PyArg_ParseTuple(args, "kk:kill", &pid, &sig)) return NULL; /* Console processes which share a common console can be sent CTRL+C or CTRL+BREAK events, provided they handle said events. */ if (sig == CTRL_C_EVENT || sig == CTRL_BREAK_EVENT) { if (GenerateConsoleCtrlEvent(sig, pid) == 0) { err = GetLastError(); return PyErr_SetFromWindowsErr(err); } else Py_RETURN_NONE; } /* If the signal is outside of what GenerateConsoleCtrlEvent can use, attempt to open and terminate the process. */ handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid); if (handle == NULL) { err = GetLastError(); return PyErr_SetFromWindowsErr(err); } if (TerminateProcess(handle, sig) == 0) { err = GetLastError(); result = PyErr_SetFromWindowsErr(err); } else { Py_INCREF(Py_None); result = Py_None; } CloseHandle(handle); return result; } PyDoc_STRVAR(posix__isdir__doc__, "Return true if the pathname refers to an existing directory."); static PyObject * posix__isdir(PyObject *self, PyObject *args) { char *path; Py_UNICODE *wpath; DWORD attributes; if (PyArg_ParseTuple(args, "u|:_isdir", &wpath)) { attributes = GetFileAttributesW(wpath); if (attributes == INVALID_FILE_ATTRIBUTES) Py_RETURN_FALSE; goto check; } /* Drop the argument parsing error as narrow strings are also valid. */ PyErr_Clear(); if (!PyArg_ParseTuple(args, "et:_isdir", Py_FileSystemDefaultEncoding, &path)) return NULL; attributes = GetFileAttributesA(path); PyMem_Free(path); if (attributes == INVALID_FILE_ATTRIBUTES) Py_RETURN_FALSE; check: if (attributes & FILE_ATTRIBUTE_DIRECTORY) Py_RETURN_TRUE; else Py_RETURN_FALSE; } #endif /* MS_WINDOWS */ #ifdef HAVE_PLOCK #ifdef HAVE_SYS_LOCK_H #include <sys/lock.h> #endif PyDoc_STRVAR(posix_plock__doc__, "plock(op)\n\n\ Lock program segments into memory."); static PyObject * posix_plock(PyObject *self, PyObject *args) { int op; if (!PyArg_ParseTuple(args, "i:plock", &op)) return NULL; if (plock(op) == -1) return posix_error(); Py_INCREF(Py_None); return Py_None; } #endif #ifdef HAVE_POPEN PyDoc_STRVAR(posix_popen__doc__, "popen(command [, mode='r' [, bufsize]]) -> pipe\n\n\ Open a pipe to/from a command returning a file object."); #if defined(PYOS_OS2) #if defined(PYCC_VACPP) static int async_system(const char *command) { char errormsg[256], args[1024]; RESULTCODES rcodes; APIRET rc; char *shell = getenv("COMSPEC"); if (!shell) shell = "cmd"; /* avoid overflowing the argument buffer */ if (strlen(shell) + 3 + strlen(command) >= 1024) return ERROR_NOT_ENOUGH_MEMORY args[0] = '\0'; strcat(args, shell); strcat(args, "/c "); strcat(args, command); /* execute asynchronously, inheriting the environment */ rc = DosExecPgm(errormsg, sizeof(errormsg), EXEC_ASYNC, args, NULL, &rcodes, shell); return rc; } static FILE * popen(const char *command, const char *mode, int pipesize, int *err) { int oldfd, tgtfd; HFILE pipeh[2]; APIRET rc; /* mode determines which of stdin or stdout is reconnected to * the pipe to the child */ if (strchr(mode, 'r') != NULL) { tgt_fd = 1; /* stdout */ } else if (strchr(mode, 'w')) { tgt_fd = 0; /* stdin */ } else { *err = ERROR_INVALID_ACCESS; return NULL; } /* setup the pipe */ if ((rc = DosCreatePipe(&pipeh[0], &pipeh[1], pipesize)) != NO_ERROR) { *err = rc; return NULL; } /* prevent other threads accessing stdio */ DosEnterCritSec(); /* reconnect stdio and execute child */ oldfd = dup(tgtfd); close(tgtfd); if (dup2(pipeh[tgtfd], tgtfd) == 0) { DosClose(pipeh[tgtfd]); rc = async_system(command); } /* restore stdio */ dup2(oldfd, tgtfd); close(oldfd); /* allow other threads access to stdio */ DosExitCritSec(); /* if execution of child was successful return file stream */ if (rc == NO_ERROR) return fdopen(pipeh[1 - tgtfd], mode); else { DosClose(pipeh[1 - tgtfd]); *err = rc; return NULL; } } static PyObject * posix_popen(PyObject *self, PyObject *args) { char *name; char *mode = "r"; int err, bufsize = -1; FILE *fp; PyObject *f; if (!PyArg_ParseTuple(args, "s|si:popen", &name, &mode, &bufsize)) return NULL; Py_BEGIN_ALLOW_THREADS fp = popen(name, mode, (bufsize > 0) ? bufsize : 4096, &err); Py_END_ALLOW_THREADS if (fp == NULL) return os2_error(err); f = PyFile_FromFile(fp, name, mode, fclose); if (f != NULL) PyFile_SetBufSize(f, bufsize); return f; } #elif defined(PYCC_GCC) /* standard posix version of popen() support */ static PyObject * posix_popen(PyObject *self, PyObject *args) { char *name; char *mode = "r"; int bufsize = -1; FILE *fp; PyObject *f; if (!PyArg_ParseTuple(args, "s|si:popen", &name, &mode, &bufsize)) return NULL; Py_BEGIN_ALLOW_THREADS fp = popen(name, mode); Py_END_ALLOW_THREADS if (fp == NULL) return posix_error(); f = PyFile_FromFile(fp, name, mode, pclose); if (f != NULL) PyFile_SetBufSize(f, bufsize); return f; } /* fork() under OS/2 has lots'o'warts * EMX supports pipe() and spawn*() so we can synthesize popen[234]() * most of this code is a ripoff of the win32 code, but using the * capabilities of EMX's C library routines */ /* These tell _PyPopen() whether to return 1, 2, or 3 file objects. */ #define POPEN_1 1 #define POPEN_2 2 #define POPEN_3 3 #define POPEN_4 4 static PyObject *_PyPopen(char *, int, int, int); static int _PyPclose(FILE *file); /* * Internal dictionary mapping popen* file pointers to process handles, * for use when retrieving the process exit code. See _PyPclose() below * for more information on this dictionary's use. */ static PyObject *_PyPopenProcs = NULL; /* os2emx version of popen2() * * The result of this function is a pipe (file) connected to the * process's stdin, and a pipe connected to the process's stdout. */ static PyObject * os2emx_popen2(PyObject *self, PyObject *args) { PyObject *f; int tm=0; char *cmdstring; char *mode = "t"; int bufsize = -1; if (!PyArg_ParseTuple(args, "s|si:popen2", &cmdstring, &mode, &bufsize)) return NULL; if (*mode == 't') tm = O_TEXT; else if (*mode != 'b') { PyErr_SetString(PyExc_ValueError, "mode must be 't' or 'b'"); return NULL; } else tm = O_BINARY; f = _PyPopen(cmdstring, tm, POPEN_2, bufsize); return f; } /* * Variation on os2emx.popen2 * * The result of this function is 3 pipes - the process's stdin, * stdout and stderr */ static PyObject * os2emx_popen3(PyObject *self, PyObject *args) { PyObject *f; int tm = 0; char *cmdstring; char *mode = "t"; int bufsize = -1; if (!PyArg_ParseTuple(args, "s|si:popen3", &cmdstring, &mode, &bufsize)) return NULL; if (*mode == 't') tm = O_TEXT; else if (*mode != 'b') { PyErr_SetString(PyExc_ValueError, "mode must be 't' or 'b'"); return NULL; } else tm = O_BINARY; f = _PyPopen(cmdstring, tm, POPEN_3, bufsize); return f; } /* * Variation on os2emx.popen2 * * The result of this function is 2 pipes - the processes stdin, * and stdout+stderr combined as a single pipe. */ static PyObject * os2emx_popen4(PyObject *self, PyObject *args) { PyObject *f; int tm = 0; char *cmdstring; char *mode = "t"; int bufsize = -1; if (!PyArg_ParseTuple(args, "s|si:popen4", &cmdstring, &mode, &bufsize)) return NULL; if (*mode == 't') tm = O_TEXT; else if (*mode != 'b') { PyErr_SetString(PyExc_ValueError, "mode must be 't' or 'b'"); return NULL; } else tm = O_BINARY; f = _PyPopen(cmdstring, tm, POPEN_4, bufsize); return f; } /* a couple of structures for convenient handling of multiple * file handles and pipes */ struct file_ref { int handle; int flags; }; struct pipe_ref { int rd; int wr; }; /* The following code is derived from the win32 code */ static PyObject * _PyPopen(char *cmdstring, int mode, int n, int bufsize) { struct file_ref stdio[3]; struct pipe_ref p_fd[3]; FILE *p_s[3]; int file_count, i, pipe_err; pid_t pipe_pid; char *shell, *sh_name, *opt, *rd_mode, *wr_mode; PyObject *f, *p_f[3]; /* file modes for subsequent fdopen's on pipe handles */ if (mode == O_TEXT) { rd_mode = "rt"; wr_mode = "wt"; } else { rd_mode = "rb"; wr_mode = "wb"; } /* prepare shell references */ if ((shell = getenv("EMXSHELL")) == NULL) if ((shell = getenv("COMSPEC")) == NULL) { errno = ENOENT; return posix_error(); } sh_name = _getname(shell); if (stricmp(sh_name, "cmd.exe") == 0 || stricmp(sh_name, "4os2.exe") == 0) opt = "/c"; else opt = "-c"; /* save current stdio fds + their flags, and set not inheritable */ i = pipe_err = 0; while (pipe_err >= 0 && i < 3) { pipe_err = stdio[i].handle = dup(i); stdio[i].flags = fcntl(i, F_GETFD, 0); fcntl(stdio[i].handle, F_SETFD, stdio[i].flags | FD_CLOEXEC); i++; } if (pipe_err < 0) { /* didn't get them all saved - clean up and bail out */ int saved_err = errno; while (i-- > 0) { close(stdio[i].handle); } errno = saved_err; return posix_error(); } /* create pipe ends */ file_count = 2; if (n == POPEN_3) file_count = 3; i = pipe_err = 0; while ((pipe_err == 0) && (i < file_count)) pipe_err = pipe((int *)&p_fd[i++]); if (pipe_err < 0) { /* didn't get them all made - clean up and bail out */ while (i-- > 0) { close(p_fd[i].wr); close(p_fd[i].rd); } errno = EPIPE; return posix_error(); } /* change the actual standard IO streams over temporarily, * making the retained pipe ends non-inheritable */ pipe_err = 0; /* - stdin */ if (dup2(p_fd[0].rd, 0) == 0) { close(p_fd[0].rd); i = fcntl(p_fd[0].wr, F_GETFD, 0); fcntl(p_fd[0].wr, F_SETFD, i | FD_CLOEXEC); if ((p_s[0] = fdopen(p_fd[0].wr, wr_mode)) == NULL) { close(p_fd[0].wr); pipe_err = -1; } } else { pipe_err = -1; } /* - stdout */ if (pipe_err == 0) { if (dup2(p_fd[1].wr, 1) == 1) { close(p_fd[1].wr); i = fcntl(p_fd[1].rd, F_GETFD, 0); fcntl(p_fd[1].rd, F_SETFD, i | FD_CLOEXEC); if ((p_s[1] = fdopen(p_fd[1].rd, rd_mode)) == NULL) { close(p_fd[1].rd); pipe_err = -1; } } else { pipe_err = -1; } } /* - stderr, as required */ if (pipe_err == 0) switch (n) { case POPEN_3: { if (dup2(p_fd[2].wr, 2) == 2) { close(p_fd[2].wr); i = fcntl(p_fd[2].rd, F_GETFD, 0); fcntl(p_fd[2].rd, F_SETFD, i | FD_CLOEXEC); if ((p_s[2] = fdopen(p_fd[2].rd, rd_mode)) == NULL) { close(p_fd[2].rd); pipe_err = -1; } } else { pipe_err = -1; } break; } case POPEN_4: { if (dup2(1, 2) != 2) { pipe_err = -1; } break; } } /* spawn the child process */ if (pipe_err == 0) { pipe_pid = spawnlp(P_NOWAIT, shell, shell, opt, cmdstring, (char *)0); if (pipe_pid == -1) { pipe_err = -1; } else { /* save the PID into the FILE structure * NOTE: this implementation doesn't actually * take advantage of this, but do it for * completeness - AIM Apr01 */ for (i = 0; i < file_count; i++) p_s[i]->_pid = pipe_pid; } } /* reset standard IO to normal */ for (i = 0; i < 3; i++) { dup2(stdio[i].handle, i); fcntl(i, F_SETFD, stdio[i].flags); close(stdio[i].handle); } /* if any remnant problems, clean up and bail out */ if (pipe_err < 0) { for (i = 0; i < 3; i++) { close(p_fd[i].rd); close(p_fd[i].wr); } errno = EPIPE; return posix_error_with_filename(cmdstring); } /* build tuple of file objects to return */ if ((p_f[0] = PyFile_FromFile(p_s[0], cmdstring, wr_mode, _PyPclose)) != NULL) PyFile_SetBufSize(p_f[0], bufsize); if ((p_f[1] = PyFile_FromFile(p_s[1], cmdstring, rd_mode, _PyPclose)) != NULL) PyFile_SetBufSize(p_f[1], bufsize); if (n == POPEN_3) { if ((p_f[2] = PyFile_FromFile(p_s[2], cmdstring, rd_mode, _PyPclose)) != NULL) PyFile_SetBufSize(p_f[0], bufsize); f = PyTuple_Pack(3, p_f[0], p_f[1], p_f[2]); } else f = PyTuple_Pack(2, p_f[0], p_f[1]); /* * Insert the files we've created into the process dictionary * all referencing the list with the process handle and the * initial number of files (see description below in _PyPclose). * Since if _PyPclose later tried to wait on a process when all * handles weren't closed, it could create a deadlock with the * child, we spend some energy here to try to ensure that we * either insert all file handles into the dictionary or none * at all. It's a little clumsy with the various popen modes * and variable number of files involved. */ if (!_PyPopenProcs) { _PyPopenProcs = PyDict_New(); } if (_PyPopenProcs) { PyObject *procObj, *pidObj, *intObj, *fileObj[3]; int ins_rc[3]; fileObj[0] = fileObj[1] = fileObj[2] = NULL; ins_rc[0] = ins_rc[1] = ins_rc[2] = 0; procObj = PyList_New(2); pidObj = PyLong_FromPid(pipe_pid); intObj = PyInt_FromLong((long) file_count); if (procObj && pidObj && intObj) { PyList_SetItem(procObj, 0, pidObj); PyList_SetItem(procObj, 1, intObj); fileObj[0] = PyLong_FromVoidPtr(p_s[0]); if (fileObj[0]) { ins_rc[0] = PyDict_SetItem(_PyPopenProcs, fileObj[0], procObj); } fileObj[1] = PyLong_FromVoidPtr(p_s[1]); if (fileObj[1]) { ins_rc[1] = PyDict_SetItem(_PyPopenProcs, fileObj[1], procObj); } if (file_count >= 3) { fileObj[2] = PyLong_FromVoidPtr(p_s[2]); if (fileObj[2]) { ins_rc[2] = PyDict_SetItem(_PyPopenProcs, fileObj[2], procObj); } } if (ins_rc[0] < 0 || !fileObj[0] || ins_rc[1] < 0 || (file_count > 1 && !fileObj[1]) || ins_rc[2] < 0 || (file_count > 2 && !fileObj[2])) { /* Something failed - remove any dictionary * entries that did make it. */ if (!ins_rc[0] && fileObj[0]) { PyDict_DelItem(_PyPopenProcs, fileObj[0]); } if (!ins_rc[1] && fileObj[1]) { PyDict_DelItem(_PyPopenProcs, fileObj[1]); } if (!ins_rc[2] && fileObj[2]) { PyDict_DelItem(_PyPopenProcs, fileObj[2]); } } } /* * Clean up our localized references for the dictionary keys * and value since PyDict_SetItem will Py_INCREF any copies * that got placed in the dictionary. */ Py_XDECREF(procObj); Py_XDECREF(fileObj[0]); Py_XDECREF(fileObj[1]); Py_XDECREF(fileObj[2]); } /* Child is launched. */ return f; } /* * Wrapper for fclose() to use for popen* files, so we can retrieve the * exit code for the child process and return as a result of the close. * * This function uses the _PyPopenProcs dictionary in order to map the * input file pointer to information about the process that was * originally created by the popen* call that created the file pointer. * The dictionary uses the file pointer as a key (with one entry * inserted for each file returned by the original popen* call) and a * single list object as the value for all files from a single call. * The list object contains the Win32 process handle at [0], and a file * count at [1], which is initialized to the total number of file * handles using that list. * * This function closes whichever handle it is passed, and decrements * the file count in the dictionary for the process handle pointed to * by this file. On the last close (when the file count reaches zero), * this function will wait for the child process and then return its * exit code as the result of the close() operation. This permits the * files to be closed in any order - it is always the close() of the * final handle that will return the exit code. * * NOTE: This function is currently called with the GIL released. * hence we use the GILState API to manage our state. */ static int _PyPclose(FILE *file) { int result; int exit_code; pid_t pipe_pid; PyObject *procObj, *pidObj, *intObj, *fileObj; int file_count; #ifdef WITH_THREAD PyGILState_STATE state; #endif /* Close the file handle first, to ensure it can't block the * child from exiting if it's the last handle. */ result = fclose(file); #ifdef WITH_THREAD state = PyGILState_Ensure(); #endif if (_PyPopenProcs) { if ((fileObj = PyLong_FromVoidPtr(file)) != NULL && (procObj = PyDict_GetItem(_PyPopenProcs, fileObj)) != NULL && (pidObj = PyList_GetItem(procObj,0)) != NULL && (intObj = PyList_GetItem(procObj,1)) != NULL) { pipe_pid = (pid_t) PyLong_AsPid(pidObj); file_count = (int) PyInt_AsLong(intObj); if (file_count > 1) { /* Still other files referencing process */ file_count--; PyList_SetItem(procObj,1, PyInt_FromLong((long) file_count)); } else { /* Last file for this process */ if (result != EOF && waitpid(pipe_pid, &exit_code, 0) == pipe_pid) { /* extract exit status */ if (WIFEXITED(exit_code)) { result = WEXITSTATUS(exit_code); } else { errno = EPIPE; result = -1; } } else { /* Indicate failure - this will cause the file object * to raise an I/O error and translate the last * error code from errno. We do have a problem with * last errors that overlap the normal errno table, * but that's a consistent problem with the file object. */ result = -1; } } /* Remove this file pointer from dictionary */ PyDict_DelItem(_PyPopenProcs, fileObj); if (PyDict_Size(_PyPopenProcs) == 0) { Py_DECREF(_PyPopenProcs); _PyPopenProcs = NULL; } } /* if object retrieval ok */ Py_XDECREF(fileObj); } /* if _PyPopenProcs */ #ifdef WITH_THREAD PyGILState_Release(state); #endif return result; } #endif /* PYCC_??? */ #elif defined(MS_WINDOWS) /* * Portable 'popen' replacement for Win32. * * Written by Bill Tutt <billtut@microsoft.com>. Minor tweaks * and 2.0 integration by Fredrik Lundh <fredrik@pythonware.com> * Return code handling by David Bolen <db3l@fitlinxx.com>. */ #include <malloc.h> #include <io.h> #include <fcntl.h> /* These tell _PyPopen() wether to return 1, 2, or 3 file objects. */ #define POPEN_1 1 #define POPEN_2 2 #define POPEN_3 3 #define POPEN_4 4 static PyObject *_PyPopen(char *, int, int); static int _PyPclose(FILE *file); /* * Internal dictionary mapping popen* file pointers to process handles, * for use when retrieving the process exit code. See _PyPclose() below * for more information on this dictionary's use. */ static PyObject *_PyPopenProcs = NULL; /* popen that works from a GUI. * * The result of this function is a pipe (file) connected to the * processes stdin or stdout, depending on the requested mode. */ static PyObject * posix_popen(PyObject *self, PyObject *args) { PyObject *f; int tm = 0; char *cmdstring; char *mode = "r"; int bufsize = -1; if (!PyArg_ParseTuple(args, "s|si:popen", &cmdstring, &mode, &bufsize)) return NULL; if (*mode == 'r') tm = _O_RDONLY; else if (*mode != 'w') { PyErr_SetString(PyExc_ValueError, "popen() arg 2 must be 'r' or 'w'"); return NULL; } else tm = _O_WRONLY; if (bufsize != -1) { PyErr_SetString(PyExc_ValueError, "popen() arg 3 must be -1"); return NULL; } if (*(mode+1) == 't') f = _PyPopen(cmdstring, tm | _O_TEXT, POPEN_1); else if (*(mode+1) == 'b') f = _PyPopen(cmdstring, tm | _O_BINARY, POPEN_1); else f = _PyPopen(cmdstring, tm | _O_TEXT, POPEN_1); return f; } /* Variation on win32pipe.popen * * The result of this function is a pipe (file) connected to the * process's stdin, and a pipe connected to the process's stdout. */ static PyObject * win32_popen2(PyObject *self, PyObject *args) { PyObject *f; int tm=0; char *cmdstring; char *mode = "t"; int bufsize = -1; if (!PyArg_ParseTuple(args, "s|si:popen2", &cmdstring, &mode, &bufsize)) return NULL; if (*mode == 't') tm = _O_TEXT; else if (*mode != 'b') { PyErr_SetString(PyExc_ValueError, "popen2() arg 2 must be 't' or 'b'"); return NULL; } else tm = _O_BINARY; if (bufsize != -1) { PyErr_SetString(PyExc_ValueError, "popen2() arg 3 must be -1"); return NULL; } f = _PyPopen(cmdstring, tm, POPEN_2); return f; } /* * Variation on <om win32pipe.popen> * * The result of this function is 3 pipes - the process's stdin, * stdout and stderr */ static PyObject * win32_popen3(PyObject *self, PyObject *args) { PyObject *f; int tm = 0; char *cmdstring; char *mode = "t"; int bufsize = -1; if (!PyArg_ParseTuple(args, "s|si:popen3", &cmdstring, &mode, &bufsize)) return NULL; if (*mode == 't') tm = _O_TEXT; else if (*mode != 'b') { PyErr_SetString(PyExc_ValueError, "popen3() arg 2 must be 't' or 'b'"); return NULL; } else tm = _O_BINARY; if (bufsize != -1) { PyErr_SetString(PyExc_ValueError, "popen3() arg 3 must be -1"); return NULL; } f = _PyPopen(cmdstring, tm, POPEN_3); return f; } /* * Variation on win32pipe.popen * * The result of this function is 2 pipes - the processes stdin, * and stdout+stderr combined as a single pipe. */ static PyObject * win32_popen4(PyObject *self, PyObject *args) { PyObject *f; int tm = 0; char *cmdstring; char *mode = "t"; int bufsize = -1; if (!PyArg_ParseTuple(args, "s|si:popen4", &cmdstring, &mode, &bufsize)) return NULL; if (*mode == 't') tm = _O_TEXT; else if (*mode != 'b') { PyErr_SetString(PyExc_ValueError, "popen4() arg 2 must be 't' or 'b'"); return NULL; } else tm = _O_BINARY; if (bufsize != -1) { PyErr_SetString(PyExc_ValueError, "popen4() arg 3 must be -1"); return NULL; } f = _PyPopen(cmdstring, tm, POPEN_4); return f; } static BOOL _PyPopenCreateProcess(char *cmdstring, HANDLE hStdin, HANDLE hStdout, HANDLE hStderr, HANDLE *hProcess) { PROCESS_INFORMATION piProcInfo; STARTUPINFO siStartInfo; DWORD dwProcessFlags = 0; /* no NEW_CONSOLE by default for Ctrl+C handling */ char *s1,*s2, *s3 = " /c "; const char *szConsoleSpawn = "w9xpopen.exe"; int i; Py_ssize_t x; if (i = GetEnvironmentVariable("COMSPEC",NULL,0)) { char *comshell; s1 = (char *)alloca(i); if (!(x = GetEnvironmentVariable("COMSPEC", s1, i))) /* x < i, so x fits into an integer */ return (int)x; /* Explicitly check if we are using COMMAND.COM. If we are * then use the w9xpopen hack. */ comshell = s1 + x; while (comshell >= s1 && *comshell != '\\') --comshell; ++comshell; if (GetVersion() < 0x80000000 && _stricmp(comshell, "command.com") != 0) { /* NT/2000 and not using command.com. */ x = i + strlen(s3) + strlen(cmdstring) + 1; s2 = (char *)alloca(x); ZeroMemory(s2, x); PyOS_snprintf(s2, x, "%s%s%s", s1, s3, cmdstring); } else { /* * Oh gag, we're on Win9x or using COMMAND.COM. Use * the workaround listed in KB: Q150956 */ char modulepath[_MAX_PATH]; struct stat statinfo; GetModuleFileName(NULL, modulepath, sizeof(modulepath)); for (x = i = 0; modulepath[i]; i++) if (modulepath[i] == SEP) x = i+1; modulepath[x] = '\0'; /* Create the full-name to w9xpopen, so we can test it exists */ strncat(modulepath, szConsoleSpawn, (sizeof(modulepath)/sizeof(modulepath[0])) -strlen(modulepath)); if (stat(modulepath, &statinfo) != 0) { size_t mplen = sizeof(modulepath)/sizeof(modulepath[0]); /* Eeek - file-not-found - possibly an embedding situation - see if we can locate it in sys.prefix */ strncpy(modulepath, Py_GetExecPrefix(), mplen); modulepath[mplen-1] = '\0'; if (modulepath[strlen(modulepath)-1] != '\\') strcat(modulepath, "\\"); strncat(modulepath, szConsoleSpawn, mplen-strlen(modulepath)); /* No where else to look - raise an easily identifiable error, rather than leaving Windows to report "file not found" - as the user is probably blissfully unaware this shim EXE is used, and it will confuse them. (well, it confused me for a while ;-) */ if (stat(modulepath, &statinfo) != 0) { PyErr_Format(PyExc_RuntimeError, "Can not locate '%s' which is needed " "for popen to work with your shell " "or platform.", szConsoleSpawn); return FALSE; } } x = i + strlen(s3) + strlen(cmdstring) + 1 + strlen(modulepath) + strlen(szConsoleSpawn) + 1; s2 = (char *)alloca(x); ZeroMemory(s2, x); /* To maintain correct argument passing semantics, we pass the command-line as it stands, and allow quoting to be applied. w9xpopen.exe will then use its argv vector, and re-quote the necessary args for the ultimate child process. */ PyOS_snprintf( s2, x, "\"%s\" %s%s%s", modulepath, s1, s3, cmdstring); /* Not passing CREATE_NEW_CONSOLE has been known to cause random failures on win9x. Specifically a dialog: "Your program accessed mem currently in use at xxx" and a hopeful warning about the stability of your system. Cost is Ctrl+C won't kill children, but anyone who cares can have a go! */ dwProcessFlags |= CREATE_NEW_CONSOLE; } } /* Could be an else here to try cmd.exe / command.com in the path Now we'll just error out.. */ else { PyErr_SetString(PyExc_RuntimeError, "Cannot locate a COMSPEC environment variable to " "use as the shell"); return FALSE; } ZeroMemory(&siStartInfo, sizeof(STARTUPINFO)); siStartInfo.cb = sizeof(STARTUPINFO); siStartInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; siStartInfo.hStdInput = hStdin; siStartInfo.hStdOutput = hStdout; siStartInfo.hStdError = hStderr; siStartInfo.wShowWindow = SW_HIDE; if (CreateProcess(NULL, s2, NULL, NULL, TRUE, dwProcessFlags, NULL, NULL, &siStartInfo, &piProcInfo) ) { /* Close the handles now so anyone waiting is woken. */ CloseHandle(piProcInfo.hThread); /* Return process handle */ *hProcess = piProcInfo.hProcess; return TRUE; } win32_error("CreateProcess", s2); return FALSE; } /* The following code is based off of KB: Q190351 */ static PyObject * _PyPopen(char *cmdstring, int mode, int n) { HANDLE hChildStdinRd, hChildStdinWr, hChildStdoutRd, hChildStdoutWr, hChildStderrRd, hChildStderrWr, hChildStdinWrDup, hChildStdoutRdDup, hChildStderrRdDup, hProcess; /* hChildStdoutWrDup; */ SECURITY_ATTRIBUTES saAttr; BOOL fSuccess; int fd1, fd2, fd3; FILE *f1, *f2, *f3; long file_count; PyObject *f; saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); saAttr.bInheritHandle = TRUE; saAttr.lpSecurityDescriptor = NULL; if (!CreatePipe(&hChildStdinRd, &hChildStdinWr, &saAttr, 0)) return win32_error("CreatePipe", NULL); /* Create new output read handle and the input write handle. Set * the inheritance properties to FALSE. Otherwise, the child inherits * these handles; resulting in non-closeable handles to the pipes * being created. */ fSuccess = DuplicateHandle(GetCurrentProcess(), hChildStdinWr, GetCurrentProcess(), &hChildStdinWrDup, 0, FALSE, DUPLICATE_SAME_ACCESS); if (!fSuccess) return win32_error("DuplicateHandle", NULL); /* Close the inheritable version of ChildStdin that we're using. */ CloseHandle(hChildStdinWr); if (!CreatePipe(&hChildStdoutRd, &hChildStdoutWr, &saAttr, 0)) return win32_error("CreatePipe", NULL); fSuccess = DuplicateHandle(GetCurrentProcess(), hChildStdoutRd, GetCurrentProcess(), &hChildStdoutRdDup, 0, FALSE, DUPLICATE_SAME_ACCESS); if (!fSuccess) return win32_error("DuplicateHandle", NULL); /* Close the inheritable version of ChildStdout that we're using. */ CloseHandle(hChildStdoutRd); if (n != POPEN_4) { if (!CreatePipe(&hChildStderrRd, &hChildStderrWr, &saAttr, 0)) return win32_error("CreatePipe", NULL); fSuccess = DuplicateHandle(GetCurrentProcess(), hChildStderrRd, GetCurrentProcess(), &hChildStderrRdDup, 0, FALSE, DUPLICATE_SAME_ACCESS); if (!fSuccess) return win32_error("DuplicateHandle", NULL); /* Close the inheritable version of ChildStdErr that we're using. */ CloseHandle(hChildStderrRd); } switch (n) { case POPEN_1: switch (mode & (_O_RDONLY | _O_TEXT | _O_BINARY | _O_WRONLY)) { case _O_WRONLY | _O_TEXT: /* Case for writing to child Stdin in text mode. */ fd1 = _open_osfhandle((Py_intptr_t)hChildStdinWrDup, mode); f1 = _fdopen(fd1, "w"); f = PyFile_FromFile(f1, cmdstring, "w", _PyPclose); PyFile_SetBufSize(f, 0); /* We don't care about these pipes anymore, so close them. */ CloseHandle(hChildStdoutRdDup); CloseHandle(hChildStderrRdDup); break; case _O_RDONLY | _O_TEXT: /* Case for reading from child Stdout in text mode. */ fd1 = _open_osfhandle((Py_intptr_t)hChildStdoutRdDup, mode); f1 = _fdopen(fd1, "r"); f = PyFile_FromFile(f1, cmdstring, "r", _PyPclose); PyFile_SetBufSize(f, 0); /* We don't care about these pipes anymore, so close them. */ CloseHandle(hChildStdinWrDup); CloseHandle(hChildStderrRdDup); break; case _O_RDONLY | _O_BINARY: /* Case for readinig from child Stdout in binary mode. */ fd1 = _open_osfhandle((Py_intptr_t)hChildStdoutRdDup, mode); f1 = _fdopen(fd1, "rb"); f = PyFile_FromFile(f1, cmdstring, "rb", _PyPclose); PyFile_SetBufSize(f, 0); /* We don't care about these pipes anymore, so close them. */ CloseHandle(hChildStdinWrDup); CloseHandle(hChildStderrRdDup); break; case _O_WRONLY | _O_BINARY: /* Case for writing to child Stdin in binary mode. */ fd1 = _open_osfhandle((Py_intptr_t)hChildStdinWrDup, mode); f1 = _fdopen(fd1, "wb"); f = PyFile_FromFile(f1, cmdstring, "wb", _PyPclose); PyFile_SetBufSize(f, 0); /* We don't care about these pipes anymore, so close them. */ CloseHandle(hChildStdoutRdDup); CloseHandle(hChildStderrRdDup); break; } file_count = 1; break; case POPEN_2: case POPEN_4: { char *m1, *m2; PyObject *p1, *p2; if (mode & _O_TEXT) { m1 = "r"; m2 = "w"; } else { m1 = "rb"; m2 = "wb"; } fd1 = _open_osfhandle((Py_intptr_t)hChildStdinWrDup, mode); f1 = _fdopen(fd1, m2); fd2 = _open_osfhandle((Py_intptr_t)hChildStdoutRdDup, mode); f2 = _fdopen(fd2, m1); p1 = PyFile_FromFile(f1, cmdstring, m2, _PyPclose); PyFile_SetBufSize(p1, 0); p2 = PyFile_FromFile(f2, cmdstring, m1, _PyPclose); PyFile_SetBufSize(p2, 0); if (n != 4) CloseHandle(hChildStderrRdDup); f = PyTuple_Pack(2,p1,p2); Py_XDECREF(p1); Py_XDECREF(p2); file_count = 2; break; } case POPEN_3: { char *m1, *m2; PyObject *p1, *p2, *p3; if (mode & _O_TEXT) { m1 = "r"; m2 = "w"; } else { m1 = "rb"; m2 = "wb"; } fd1 = _open_osfhandle((Py_intptr_t)hChildStdinWrDup, mode); f1 = _fdopen(fd1, m2); fd2 = _open_osfhandle((Py_intptr_t)hChildStdoutRdDup, mode); f2 = _fdopen(fd2, m1); fd3 = _open_osfhandle((Py_intptr_t)hChildStderrRdDup, mode); f3 = _fdopen(fd3, m1); p1 = PyFile_FromFile(f1, cmdstring, m2, _PyPclose); p2 = PyFile_FromFile(f2, cmdstring, m1, _PyPclose); p3 = PyFile_FromFile(f3, cmdstring, m1, _PyPclose); PyFile_SetBufSize(p1, 0); PyFile_SetBufSize(p2, 0); PyFile_SetBufSize(p3, 0); f = PyTuple_Pack(3,p1,p2,p3); Py_XDECREF(p1); Py_XDECREF(p2); Py_XDECREF(p3); file_count = 3; break; } } if (n == POPEN_4) { if (!_PyPopenCreateProcess(cmdstring, hChildStdinRd, hChildStdoutWr, hChildStdoutWr, &hProcess)) return NULL; } else { if (!_PyPopenCreateProcess(cmdstring, hChildStdinRd, hChildStdoutWr, hChildStderrWr, &hProcess)) return NULL; } /* * Insert the files we've created into the process dictionary * all referencing the list with the process handle and the * initial number of files (see description below in _PyPclose). * Since if _PyPclose later tried to wait on a process when all * handles weren't closed, it could create a deadlock with the * child, we spend some energy here to try to ensure that we * either insert all file handles into the dictionary or none * at all. It's a little clumsy with the various popen modes * and variable number of files involved. */ if (!_PyPopenProcs) { _PyPopenProcs = PyDict_New(); } if (_PyPopenProcs) { PyObject *procObj, *hProcessObj, *intObj, *fileObj[3]; int ins_rc[3]; fileObj[0] = fileObj[1] = fileObj[2] = NULL; ins_rc[0] = ins_rc[1] = ins_rc[2] = 0; procObj = PyList_New(2); hProcessObj = PyLong_FromVoidPtr(hProcess); intObj = PyInt_FromLong(file_count); if (procObj && hProcessObj && intObj) { PyList_SetItem(procObj,0,hProcessObj); PyList_SetItem(procObj,1,intObj); fileObj[0] = PyLong_FromVoidPtr(f1); if (fileObj[0]) { ins_rc[0] = PyDict_SetItem(_PyPopenProcs, fileObj[0], procObj); } if (file_count >= 2) { fileObj[1] = PyLong_FromVoidPtr(f2); if (fileObj[1]) { ins_rc[1] = PyDict_SetItem(_PyPopenProcs, fileObj[1], procObj); } } if (file_count >= 3) { fileObj[2] = PyLong_FromVoidPtr(f3); if (fileObj[2]) { ins_rc[2] = PyDict_SetItem(_PyPopenProcs, fileObj[2], procObj); } } if (ins_rc[0] < 0 || !fileObj[0] || ins_rc[1] < 0 || (file_count > 1 && !fileObj[1]) || ins_rc[2] < 0 || (file_count > 2 && !fileObj[2])) { /* Something failed - remove any dictionary * entries that did make it. */ if (!ins_rc[0] && fileObj[0]) { PyDict_DelItem(_PyPopenProcs, fileObj[0]); } if (!ins_rc[1] && fileObj[1]) { PyDict_DelItem(_PyPopenProcs, fileObj[1]); } if (!ins_rc[2] && fileObj[2]) { PyDict_DelItem(_PyPopenProcs, fileObj[2]); } } } /* * Clean up our localized references for the dictionary keys * and value since PyDict_SetItem will Py_INCREF any copies * that got placed in the dictionary. */ Py_XDECREF(procObj); Py_XDECREF(fileObj[0]); Py_XDECREF(fileObj[1]); Py_XDECREF(fileObj[2]); } /* Child is launched. Close the parents copy of those pipe * handles that only the child should have open. You need to * make sure that no handles to the write end of the output pipe * are maintained in this process or else the pipe will not close * when the child process exits and the ReadFile will hang. */ if (!CloseHandle(hChildStdinRd)) return win32_error("CloseHandle", NULL); if (!CloseHandle(hChildStdoutWr)) return win32_error("CloseHandle", NULL); if ((n != 4) && (!CloseHandle(hChildStderrWr))) return win32_error("CloseHandle", NULL); return f; } /* * Wrapper for fclose() to use for popen* files, so we can retrieve the * exit code for the child process and return as a result of the close. * * This function uses the _PyPopenProcs dictionary in order to map the * input file pointer to information about the process that was * originally created by the popen* call that created the file pointer. * The dictionary uses the file pointer as a key (with one entry * inserted for each file returned by the original popen* call) and a * single list object as the value for all files from a single call. * The list object contains the Win32 process handle at [0], and a file * count at [1], which is initialized to the total number of file * handles using that list. * * This function closes whichever handle it is passed, and decrements * the file count in the dictionary for the process handle pointed to * by this file. On the last close (when the file count reaches zero), * this function will wait for the child process and then return its * exit code as the result of the close() operation. This permits the * files to be closed in any order - it is always the close() of the * final handle that will return the exit code. * * NOTE: This function is currently called with the GIL released. * hence we use the GILState API to manage our state. */ static int _PyPclose(FILE *file) { int result; DWORD exit_code; HANDLE hProcess; PyObject *procObj, *hProcessObj, *intObj, *fileObj; long file_count; #ifdef WITH_THREAD PyGILState_STATE state; #endif /* Close the file handle first, to ensure it can't block the * child from exiting if it's the last handle. */ result = fclose(file); #ifdef WITH_THREAD state = PyGILState_Ensure(); #endif if (_PyPopenProcs) { if ((fileObj = PyLong_FromVoidPtr(file)) != NULL && (procObj = PyDict_GetItem(_PyPopenProcs, fileObj)) != NULL && (hProcessObj = PyList_GetItem(procObj,0)) != NULL && (intObj = PyList_GetItem(procObj,1)) != NULL) { hProcess = PyLong_AsVoidPtr(hProcessObj); file_count = PyInt_AsLong(intObj); if (file_count > 1) { /* Still other files referencing process */ file_count--; PyList_SetItem(procObj,1, PyInt_FromLong(file_count)); } else { /* Last file for this process */ if (result != EOF && WaitForSingleObject(hProcess, INFINITE) != WAIT_FAILED && GetExitCodeProcess(hProcess, &exit_code)) { /* Possible truncation here in 16-bit environments, but * real exit codes are just the lower byte in any event. */ result = exit_code; } else { /* Indicate failure - this will cause the file object * to raise an I/O error and translate the last Win32 * error code from errno. We do have a problem with * last errors that overlap the normal errno table, * but that's a consistent problem with the file object. */ if (result != EOF) { /* If the error wasn't from the fclose(), then * set errno for the file object error handling. */ errno = GetLastError(); } result = -1; } /* Free up the native handle at this point */ CloseHandle(hProcess); } /* Remove this file pointer from dictionary */ PyDict_DelItem(_PyPopenProcs, fileObj); if (PyDict_Size(_PyPopenProcs) == 0) { Py_DECREF(_PyPopenProcs); _PyPopenProcs = NULL; } } /* if object retrieval ok */ Py_XDECREF(fileObj); } /* if _PyPopenProcs */ #ifdef WITH_THREAD PyGILState_Release(state); #endif return result; } #else /* which OS? */ static PyObject * posix_popen(PyObject *self, PyObject *args) { char *name; char *mode = "r"; int bufsize = -1; FILE *fp; PyObject *f; if (!PyArg_ParseTuple(args, "s|si:popen", &name, &mode, &bufsize)) return NULL; /* Strip mode of binary or text modifiers */ if (strcmp(mode, "rb") == 0 || strcmp(mode, "rt") == 0) mode = "r"; else if (strcmp(mode, "wb") == 0 || strcmp(mode, "wt") == 0) mode = "w"; Py_BEGIN_ALLOW_THREADS fp = popen(name, mode); Py_END_ALLOW_THREADS if (fp == NULL) return posix_error(); f = PyFile_FromFile(fp, name, mode, pclose); if (f != NULL) PyFile_SetBufSize(f, bufsize); return f; } #endif /* PYOS_??? */ #endif /* HAVE_POPEN */ #ifdef HAVE_SETUID PyDoc_STRVAR(posix_setuid__doc__, "setuid(uid)\n\n\ Set the current process's user id."); static PyObject * posix_setuid(PyObject *self, PyObject *args) { uid_t uid; if (!PyArg_ParseTuple(args, "O&:setuid", _Py_Uid_Converter, &uid)) return NULL; if (setuid(uid) < 0) return posix_error(); Py_INCREF(Py_None); return Py_None; } #endif /* HAVE_SETUID */ #ifdef HAVE_SETEUID PyDoc_STRVAR(posix_seteuid__doc__, "seteuid(uid)\n\n\ Set the current process's effective user id."); static PyObject * posix_seteuid (PyObject *self, PyObject *args) { uid_t euid; if (!PyArg_ParseTuple(args, "O&:seteuid", _Py_Uid_Converter, &euid)) return NULL; if (seteuid(euid) < 0) { return posix_error(); } else { Py_INCREF(Py_None); return Py_None; } } #endif /* HAVE_SETEUID */ #ifdef HAVE_SETEGID PyDoc_STRVAR(posix_setegid__doc__, "setegid(gid)\n\n\ Set the current process's effective group id."); static PyObject * posix_setegid (PyObject *self, PyObject *args) { gid_t egid; if (!PyArg_ParseTuple(args, "O&:setegid", _Py_Gid_Converter, &egid)) return NULL; if (setegid(egid) < 0) { return posix_error(); } else { Py_INCREF(Py_None); return Py_None; } } #endif /* HAVE_SETEGID */ #ifdef HAVE_SETREUID PyDoc_STRVAR(posix_setreuid__doc__, "setreuid(ruid, euid)\n\n\ Set the current process's real and effective user ids."); static PyObject * posix_setreuid (PyObject *self, PyObject *args) { uid_t ruid, euid; if (!PyArg_ParseTuple(args, "O&O&:setreuid", _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid)) return NULL; if (setreuid(ruid, euid) < 0) { return posix_error(); } else { Py_INCREF(Py_None); return Py_None; } } #endif /* HAVE_SETREUID */ #ifdef HAVE_SETREGID PyDoc_STRVAR(posix_setregid__doc__, "setregid(rgid, egid)\n\n\ Set the current process's real and effective group ids."); static PyObject * posix_setregid (PyObject *self, PyObject *args) { gid_t rgid, egid; if (!PyArg_ParseTuple(args, "O&O&:setregid", _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid)) return NULL; if (setregid(rgid, egid) < 0) { return posix_error(); } else { Py_INCREF(Py_None); return Py_None; } } #endif /* HAVE_SETREGID */ #ifdef HAVE_SETGID PyDoc_STRVAR(posix_setgid__doc__, "setgid(gid)\n\n\ Set the current process's group id."); static PyObject * posix_setgid(PyObject *self, PyObject *args) { gid_t gid; if (!PyArg_ParseTuple(args, "O&:setgid", _Py_Gid_Converter, &gid)) return NULL; if (setgid(gid) < 0) return posix_error(); Py_INCREF(Py_None); return Py_None; } #endif /* HAVE_SETGID */ #ifdef HAVE_SETGROUPS PyDoc_STRVAR(posix_setgroups__doc__, "setgroups(list)\n\n\ Set the groups of the current process to list."); static PyObject * posix_setgroups(PyObject *self, PyObject *groups) { Py_ssize_t i, len; gid_t grouplist[MAX_GROUPS]; if (!PySequence_Check(groups)) { PyErr_SetString(PyExc_TypeError, "setgroups argument must be a sequence"); return NULL; } len = PySequence_Size(groups); if (len < 0) { return NULL; } if (len > MAX_GROUPS) { PyErr_SetString(PyExc_ValueError, "too many groups"); return NULL; } for(i = 0; i < len; i++) { PyObject *elem; elem = PySequence_GetItem(groups, i); if (!elem) return NULL; if (!_PyAnyInt_Check(elem)) { PyErr_SetString(PyExc_TypeError, "groups must be integers"); Py_DECREF(elem); return NULL; } else { if (!_Py_Gid_Converter(elem, &grouplist[i])) { Py_DECREF(elem); return NULL; } } Py_DECREF(elem); } if (setgroups(len, grouplist) < 0) return posix_error(); Py_INCREF(Py_None); return Py_None; } #endif /* HAVE_SETGROUPS */ #if defined(HAVE_WAIT3) || defined(HAVE_WAIT4) static PyObject * wait_helper(pid_t pid, int status, struct rusage *ru) { PyObject *result; static PyObject *struct_rusage; if (pid == -1) return posix_error(); if (struct_rusage == NULL) { PyObject *m = PyImport_ImportModuleNoBlock("resource"); if (m == NULL) return NULL; struct_rusage = PyObject_GetAttrString(m, "struct_rusage"); Py_DECREF(m); if (struct_rusage == NULL) return NULL; } /* XXX(nnorwitz): Copied (w/mods) from resource.c, there should be only one. */ result = PyStructSequence_New((PyTypeObject*) struct_rusage); if (!result) return NULL; #ifndef doubletime #define doubletime(TV) ((double)(TV).tv_sec + (TV).tv_usec * 0.000001) #endif PyStructSequence_SET_ITEM(result, 0, PyFloat_FromDouble(doubletime(ru->ru_utime))); PyStructSequence_SET_ITEM(result, 1, PyFloat_FromDouble(doubletime(ru->ru_stime))); #define SET_INT(result, index, value)\ PyStructSequence_SET_ITEM(result, index, PyInt_FromLong(value)) SET_INT(result, 2, ru->ru_maxrss); SET_INT(result, 3, ru->ru_ixrss); SET_INT(result, 4, ru->ru_idrss); SET_INT(result, 5, ru->ru_isrss); SET_INT(result, 6, ru->ru_minflt); SET_INT(result, 7, ru->ru_majflt); SET_INT(result, 8, ru->ru_nswap); SET_INT(result, 9, ru->ru_inblock); SET_INT(result, 10, ru->ru_oublock); SET_INT(result, 11, ru->ru_msgsnd); SET_INT(result, 12, ru->ru_msgrcv); SET_INT(result, 13, ru->ru_nsignals); SET_INT(result, 14, ru->ru_nvcsw); SET_INT(result, 15, ru->ru_nivcsw); #undef SET_INT if (PyErr_Occurred()) { Py_DECREF(result); return NULL; } return Py_BuildValue("NiN", PyLong_FromPid(pid), status, result); } #endif /* HAVE_WAIT3 || HAVE_WAIT4 */ #ifdef HAVE_WAIT3 PyDoc_STRVAR(posix_wait3__doc__, "wait3(options) -> (pid, status, rusage)\n\n\ Wait for completion of a child process."); static PyObject * posix_wait3(PyObject *self, PyObject *args) { pid_t pid; int options; struct rusage ru; WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; if (!PyArg_ParseTuple(args, "i:wait3", &options)) return NULL; Py_BEGIN_ALLOW_THREADS pid = wait3(&status, options, &ru); Py_END_ALLOW_THREADS return wait_helper(pid, WAIT_STATUS_INT(status), &ru); } #endif /* HAVE_WAIT3 */ #ifdef HAVE_WAIT4 PyDoc_STRVAR(posix_wait4__doc__, "wait4(pid, options) -> (pid, status, rusage)\n\n\ Wait for completion of a given child process."); static PyObject * posix_wait4(PyObject *self, PyObject *args) { pid_t pid; int options; struct rusage ru; WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; if (!PyArg_ParseTuple(args, PARSE_PID "i:wait4", &pid, &options)) return NULL; Py_BEGIN_ALLOW_THREADS pid = wait4(pid, &status, options, &ru); Py_END_ALLOW_THREADS return wait_helper(pid, WAIT_STATUS_INT(status), &ru); } #endif /* HAVE_WAIT4 */ #ifdef HAVE_WAITPID PyDoc_STRVAR(posix_waitpid__doc__, "waitpid(pid, options) -> (pid, status)\n\n\ Wait for completion of a given child process."); static PyObject * posix_waitpid(PyObject *self, PyObject *args) { pid_t pid; int options; WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; if (!PyArg_ParseTuple(args, PARSE_PID "i:waitpid", &pid, &options)) return NULL; Py_BEGIN_ALLOW_THREADS pid = waitpid(pid, &status, options); Py_END_ALLOW_THREADS if (pid == -1) return posix_error(); return Py_BuildValue("Ni", PyLong_FromPid(pid), WAIT_STATUS_INT(status)); } #elif defined(HAVE_CWAIT) /* MS C has a variant of waitpid() that's usable for most purposes. */ PyDoc_STRVAR(posix_waitpid__doc__, "waitpid(pid, options) -> (pid, status << 8)\n\n" "Wait for completion of a given process. options is ignored on Windows."); static PyObject * posix_waitpid(PyObject *self, PyObject *args) { Py_intptr_t pid; int status, options; if (!PyArg_ParseTuple(args, PARSE_PID "i:waitpid", &pid, &options)) return NULL; Py_BEGIN_ALLOW_THREADS pid = _cwait(&status, pid, options); Py_END_ALLOW_THREADS if (pid == -1) return posix_error(); /* shift the status left a byte so this is more like the POSIX waitpid */ return Py_BuildValue("Ni", PyLong_FromPid(pid), status << 8); } #endif /* HAVE_WAITPID || HAVE_CWAIT */ #ifdef HAVE_WAIT PyDoc_STRVAR(posix_wait__doc__, "wait() -> (pid, status)\n\n\ Wait for completion of a child process."); static PyObject * posix_wait(PyObject *self, PyObject *noargs) { pid_t pid; WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; Py_BEGIN_ALLOW_THREADS pid = wait(&status); Py_END_ALLOW_THREADS if (pid == -1) return posix_error(); return Py_BuildValue("Ni", PyLong_FromPid(pid), WAIT_STATUS_INT(status)); } #endif PyDoc_STRVAR(posix_lstat__doc__, "lstat(path) -> stat result\n\n\ Like stat(path), but do not follow symbolic links."); static PyObject * posix_lstat(PyObject *self, PyObject *args) { #ifdef HAVE_LSTAT return posix_do_stat(self, args, "et:lstat", lstat, NULL, NULL); #else /* !HAVE_LSTAT */ #ifdef MS_WINDOWS return posix_do_stat(self, args, "et:lstat", STAT, "u:lstat", win32_wstat); #else return posix_do_stat(self, args, "et:lstat", STAT, NULL, NULL); #endif #endif /* !HAVE_LSTAT */ } #ifdef HAVE_READLINK PyDoc_STRVAR(posix_readlink__doc__, "readlink(path) -> path\n\n\ Return a string representing the path to which the symbolic link points."); static PyObject * posix_readlink(PyObject *self, PyObject *args) { PyObject* v; char buf[MAXPATHLEN]; char *path; int n; #ifdef Py_USING_UNICODE int arg_is_unicode = 0; #endif if (!PyArg_ParseTuple(args, "et:readlink", Py_FileSystemDefaultEncoding, &path)) return NULL; #ifdef Py_USING_UNICODE v = PySequence_GetItem(args, 0); if (v == NULL) { PyMem_Free(path); return NULL; } if (PyUnicode_Check(v)) { arg_is_unicode = 1; } Py_DECREF(v); #endif Py_BEGIN_ALLOW_THREADS n = readlink(path, buf, (int) sizeof buf); Py_END_ALLOW_THREADS if (n < 0) return posix_error_with_allocated_filename(path); PyMem_Free(path); v = PyString_FromStringAndSize(buf, n); #ifdef Py_USING_UNICODE if (arg_is_unicode) { PyObject *w; w = PyUnicode_FromEncodedObject(v, Py_FileSystemDefaultEncoding, "strict"); if (w != NULL) { Py_DECREF(v); v = w; } else { /* fall back to the original byte string, as discussed in patch #683592 */ PyErr_Clear(); } } #endif return v; } #endif /* HAVE_READLINK */ #ifdef HAVE_SYMLINK PyDoc_STRVAR(posix_symlink__doc__, "symlink(src, dst)\n\n\ Create a symbolic link pointing to src named dst."); static PyObject * posix_symlink(PyObject *self, PyObject *args) { return posix_2str(args, "etet:symlink", symlink); } #endif /* HAVE_SYMLINK */ #ifdef HAVE_TIMES #if defined(PYCC_VACPP) && defined(PYOS_OS2) static long system_uptime(void) { ULONG value = 0; Py_BEGIN_ALLOW_THREADS DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &value, sizeof(value)); Py_END_ALLOW_THREADS return value; } static PyObject * posix_times(PyObject *self, PyObject *noargs) { /* Currently Only Uptime is Provided -- Others Later */ return Py_BuildValue("ddddd", (double)0 /* t.tms_utime / HZ */, (double)0 /* t.tms_stime / HZ */, (double)0 /* t.tms_cutime / HZ */, (double)0 /* t.tms_cstime / HZ */, (double)system_uptime() / 1000); } #else /* not OS2 */ #define NEED_TICKS_PER_SECOND static long ticks_per_second = -1; static PyObject * posix_times(PyObject *self, PyObject *noargs) { struct tms t; clock_t c; errno = 0; c = times(&t); if (c == (clock_t) -1) return posix_error(); return Py_BuildValue("ddddd", (double)t.tms_utime / ticks_per_second, (double)t.tms_stime / ticks_per_second, (double)t.tms_cutime / ticks_per_second, (double)t.tms_cstime / ticks_per_second, (double)c / ticks_per_second); } #endif /* not OS2 */ #endif /* HAVE_TIMES */ #ifdef MS_WINDOWS #define HAVE_TIMES /* so the method table will pick it up */ static PyObject * posix_times(PyObject *self, PyObject *noargs) { FILETIME create, exit, kernel, user; HANDLE hProc; hProc = GetCurrentProcess(); GetProcessTimes(hProc, &create, &exit, &kernel, &user); /* The fields of a FILETIME structure are the hi and lo part of a 64-bit value expressed in 100 nanosecond units. 1e7 is one second in such units; 1e-7 the inverse. 429.4967296 is 2**32 / 1e7 or 2**32 * 1e-7. */ return Py_BuildValue( "ddddd", (double)(user.dwHighDateTime*429.4967296 + user.dwLowDateTime*1e-7), (double)(kernel.dwHighDateTime*429.4967296 + kernel.dwLowDateTime*1e-7), (double)0, (double)0, (double)0); } #endif /* MS_WINDOWS */ #ifdef HAVE_TIMES PyDoc_STRVAR(posix_times__doc__, "times() -> (utime, stime, cutime, cstime, elapsed_time)\n\n\ Return a tuple of floating point numbers indicating process times."); #endif #ifdef HAVE_GETSID PyDoc_STRVAR(posix_getsid__doc__, "getsid(pid) -> sid\n\n\ Call the system call getsid()."); static PyObject * posix_getsid(PyObject *self, PyObject *args) { pid_t pid; int sid; if (!PyArg_ParseTuple(args, PARSE_PID ":getsid", &pid)) return NULL; sid = getsid(pid); if (sid < 0) return posix_error(); return PyInt_FromLong((long)sid); } #endif /* HAVE_GETSID */ #ifdef HAVE_SETSID PyDoc_STRVAR(posix_setsid__doc__, "setsid()\n\n\ Call the system call setsid()."); static PyObject * posix_setsid(PyObject *self, PyObject *noargs) { if (setsid() < 0) return posix_error(); Py_INCREF(Py_None); return Py_None; } #endif /* HAVE_SETSID */ #ifdef HAVE_SETPGID PyDoc_STRVAR(posix_setpgid__doc__, "setpgid(pid, pgrp)\n\n\ Call the system call setpgid()."); static PyObject * posix_setpgid(PyObject *self, PyObject *args) { pid_t pid; int pgrp; if (!PyArg_ParseTuple(args, PARSE_PID "i:setpgid", &pid, &pgrp)) return NULL; if (setpgid(pid, pgrp) < 0) return posix_error(); Py_INCREF(Py_None); return Py_None; } #endif /* HAVE_SETPGID */ #ifdef HAVE_TCGETPGRP PyDoc_STRVAR(posix_tcgetpgrp__doc__, "tcgetpgrp(fd) -> pgid\n\n\ Return the process group associated with the terminal given by a fd."); static PyObject * posix_tcgetpgrp(PyObject *self, PyObject *args) { int fd; pid_t pgid; if (!PyArg_ParseTuple(args, "i:tcgetpgrp", &fd)) return NULL; pgid = tcgetpgrp(fd); if (pgid < 0) return posix_error(); return PyLong_FromPid(pgid); } #endif /* HAVE_TCGETPGRP */ #ifdef HAVE_TCSETPGRP PyDoc_STRVAR(posix_tcsetpgrp__doc__, "tcsetpgrp(fd, pgid)\n\n\ Set the process group associated with the terminal given by a fd."); static PyObject * posix_tcsetpgrp(PyObject *self, PyObject *args) { int fd; pid_t pgid; if (!PyArg_ParseTuple(args, "i" PARSE_PID ":tcsetpgrp", &fd, &pgid)) return NULL; if (tcsetpgrp(fd, pgid) < 0) return posix_error(); Py_INCREF(Py_None); return Py_None; } #endif /* HAVE_TCSETPGRP */ /* Functions acting on file descriptors */ PyDoc_STRVAR(posix_open__doc__, "open(filename, flag [, mode=0777]) -> fd\n\n\ Open a file (for low level IO)."); static PyObject * posix_open(PyObject *self, PyObject *args) { char *file = NULL; int flag; int mode = 0777; int fd; #ifdef MS_WINDOWS Py_UNICODE *wpath; if (PyArg_ParseTuple(args, "ui|i:mkdir", &wpath, &flag, &mode)) { Py_BEGIN_ALLOW_THREADS fd = _wopen(wpath, flag, mode); Py_END_ALLOW_THREADS if (fd < 0) return posix_error(); return PyInt_FromLong((long)fd); } /* Drop the argument parsing error as narrow strings are also valid. */ PyErr_Clear(); #endif if (!PyArg_ParseTuple(args, "eti|i", Py_FileSystemDefaultEncoding, &file, &flag, &mode)) return NULL; Py_BEGIN_ALLOW_THREADS fd = open(file, flag, mode); Py_END_ALLOW_THREADS if (fd < 0) return posix_error_with_allocated_filename(file); PyMem_Free(file); return PyInt_FromLong((long)fd); } PyDoc_STRVAR(posix_close__doc__, "close(fd)\n\n\ Close a file descriptor (for low level IO)."); /* The underscore at end of function name avoids a name clash with the libc function posix_close. */ static PyObject * posix_close_(PyObject *self, PyObject *args) { int fd, res; if (!PyArg_ParseTuple(args, "i:close", &fd)) return NULL; if (!_PyVerify_fd(fd)) return posix_error(); Py_BEGIN_ALLOW_THREADS res = close(fd); Py_END_ALLOW_THREADS if (res < 0) return posix_error(); Py_INCREF(Py_None); return Py_None; } PyDoc_STRVAR(posix_closerange__doc__, "closerange(fd_low, fd_high)\n\n\ Closes all file descriptors in [fd_low, fd_high), ignoring errors."); static PyObject * posix_closerange(PyObject *self, PyObject *args) { int fd_from, fd_to, i; if (!PyArg_ParseTuple(args, "ii:closerange", &fd_from, &fd_to)) return NULL; Py_BEGIN_ALLOW_THREADS for (i = fd_from; i < fd_to; i++) if (_PyVerify_fd(i)) close(i); Py_END_ALLOW_THREADS Py_RETURN_NONE; } PyDoc_STRVAR(posix_dup__doc__, "dup(fd) -> fd2\n\n\ Return a duplicate of a file descriptor."); static PyObject * posix_dup(PyObject *self, PyObject *args) { int fd; if (!PyArg_ParseTuple(args, "i:dup", &fd)) return NULL; if (!_PyVerify_fd(fd)) return posix_error(); Py_BEGIN_ALLOW_THREADS fd = dup(fd); Py_END_ALLOW_THREADS if (fd < 0) return posix_error(); return PyInt_FromLong((long)fd); } PyDoc_STRVAR(posix_dup2__doc__, "dup2(old_fd, new_fd)\n\n\ Duplicate file descriptor."); static PyObject * posix_dup2(PyObject *self, PyObject *args) { int fd, fd2, res; if (!PyArg_ParseTuple(args, "ii:dup2", &fd, &fd2)) return NULL; if (!_PyVerify_fd_dup2(fd, fd2)) return posix_error(); Py_BEGIN_ALLOW_THREADS res = dup2(fd, fd2); Py_END_ALLOW_THREADS if (res < 0) return posix_error(); Py_INCREF(Py_None); return Py_None; } PyDoc_STRVAR(posix_lseek__doc__, "lseek(fd, pos, how) -> newpos\n\n\ Set the current position of a file descriptor.\n\ Return the new cursor position in bytes, starting from the beginning."); static PyObject * posix_lseek(PyObject *self, PyObject *args) { int fd, how; #if defined(MS_WIN64) || defined(MS_WINDOWS) PY_LONG_LONG pos, res; #else off_t pos, res; #endif PyObject *posobj; if (!PyArg_ParseTuple(args, "iOi:lseek", &fd, &posobj, &how)) return NULL; #ifdef SEEK_SET /* Turn 0, 1, 2 into SEEK_{SET,CUR,END} */ switch (how) { case 0: how = SEEK_SET; break; case 1: how = SEEK_CUR; break; case 2: how = SEEK_END; break; } #endif /* SEEK_END */ #if !defined(HAVE_LARGEFILE_SUPPORT) pos = PyInt_AsLong(posobj); #else pos = PyLong_Check(posobj) ? PyLong_AsLongLong(posobj) : PyInt_AsLong(posobj); #endif if (PyErr_Occurred()) return NULL; if (!_PyVerify_fd(fd)) return posix_error(); Py_BEGIN_ALLOW_THREADS #if defined(MS_WIN64) || defined(MS_WINDOWS) res = _lseeki64(fd, pos, how); #else res = lseek(fd, pos, how); #endif Py_END_ALLOW_THREADS if (res < 0) return posix_error(); #if !defined(HAVE_LARGEFILE_SUPPORT) return PyInt_FromLong(res); #else return PyLong_FromLongLong(res); #endif } PyDoc_STRVAR(posix_read__doc__, "read(fd, buffersize) -> string\n\n\ Read a file descriptor."); static PyObject * posix_read(PyObject *self, PyObject *args) { int fd, size, n; PyObject *buffer; if (!PyArg_ParseTuple(args, "ii:read", &fd, &size)) return NULL; if (size < 0) { errno = EINVAL; return posix_error(); } buffer = PyString_FromStringAndSize((char *)NULL, size); if (buffer == NULL) return NULL; if (!_PyVerify_fd(fd)) { Py_DECREF(buffer); return posix_error(); } Py_BEGIN_ALLOW_THREADS n = read(fd, PyString_AsString(buffer), size); Py_END_ALLOW_THREADS if (n < 0) { Py_DECREF(buffer); return posix_error(); } if (n != size) _PyString_Resize(&buffer, n); return buffer; } PyDoc_STRVAR(posix_write__doc__, "write(fd, string) -> byteswritten\n\n\ Write a string to a file descriptor."); static PyObject * posix_write(PyObject *self, PyObject *args) { Py_buffer pbuf; int fd; Py_ssize_t size, len; if (!PyArg_ParseTuple(args, "is*:write", &fd, &pbuf)) return NULL; if (!_PyVerify_fd(fd)) { PyBuffer_Release(&pbuf); return posix_error(); } len = pbuf.len; Py_BEGIN_ALLOW_THREADS #if defined(MS_WIN64) || defined(MS_WINDOWS) if (len > INT_MAX) len = INT_MAX; size = write(fd, pbuf.buf, (int)len); #else size = write(fd, pbuf.buf, len); #endif Py_END_ALLOW_THREADS PyBuffer_Release(&pbuf); if (size < 0) return posix_error(); return PyInt_FromSsize_t(size); } PyDoc_STRVAR(posix_fstat__doc__, "fstat(fd) -> stat result\n\n\ Like stat(), but for an open file descriptor."); static PyObject * posix_fstat(PyObject *self, PyObject *args) { int fd; STRUCT_STAT st; int res; if (!PyArg_ParseTuple(args, "i:fstat", &fd)) return NULL; #ifdef __VMS /* on OpenVMS we must ensure that all bytes are written to the file */ fsync(fd); #endif if (!_PyVerify_fd(fd)) return posix_error(); Py_BEGIN_ALLOW_THREADS res = FSTAT(fd, &st); Py_END_ALLOW_THREADS if (res != 0) { #ifdef MS_WINDOWS return win32_error("fstat", NULL); #else return posix_error(); #endif } return _pystat_fromstructstat(&st); } PyDoc_STRVAR(posix_fdopen__doc__, "fdopen(fd [, mode='r' [, bufsize]]) -> file_object\n\n\ Return an open file object connected to a file descriptor."); static PyObject * posix_fdopen(PyObject *self, PyObject *args) { int fd; char *orgmode = "r"; int bufsize = -1; FILE *fp; PyObject *f; char *mode; if (!PyArg_ParseTuple(args, "i|si", &fd, &orgmode, &bufsize)) return NULL; /* Sanitize mode. See fileobject.c */ mode = PyMem_MALLOC(strlen(orgmode)+3); if (!mode) { PyErr_NoMemory(); return NULL; } strcpy(mode, orgmode); if (_PyFile_SanitizeMode(mode)) { PyMem_FREE(mode); return NULL; } if (!_PyVerify_fd(fd)) { PyMem_FREE(mode); return posix_error(); } #if defined(HAVE_FSTAT) && defined(S_IFDIR) && defined(EISDIR) { struct stat buf; const char *msg; PyObject *exc; if (fstat(fd, &buf) == 0 && S_ISDIR(buf.st_mode)) { PyMem_FREE(mode); msg = strerror(EISDIR); exc = PyObject_CallFunction(PyExc_IOError, "(iss)", EISDIR, msg, "<fdopen>"); if (exc) { PyErr_SetObject(PyExc_IOError, exc); Py_DECREF(exc); } return NULL; } } #endif /* The dummy filename used here must be kept in sync with the value tested against in gzip.GzipFile.__init__() - see issue #13781. */ f = PyFile_FromFile(NULL, "<fdopen>", orgmode, fclose); if (f == NULL) { PyMem_FREE(mode); return NULL; } Py_BEGIN_ALLOW_THREADS #if !defined(MS_WINDOWS) && defined(HAVE_FCNTL_H) if (mode[0] == 'a') { /* try to make sure the O_APPEND flag is set */ int flags; flags = fcntl(fd, F_GETFL); if (flags != -1) fcntl(fd, F_SETFL, flags | O_APPEND); fp = fdopen(fd, mode); if (fp == NULL && flags != -1) /* restore old mode if fdopen failed */ fcntl(fd, F_SETFL, flags); } else { fp = fdopen(fd, mode); } #else fp = fdopen(fd, mode); #endif Py_END_ALLOW_THREADS PyMem_FREE(mode); if (fp == NULL) { Py_DECREF(f); return posix_error(); } /* We now know we will succeed, so initialize the file object. */ ((PyFileObject *)f)->f_fp = fp; PyFile_SetBufSize(f, bufsize); return f; } PyDoc_STRVAR(posix_isatty__doc__, "isatty(fd) -> bool\n\n\ Return True if the file descriptor 'fd' is an open file descriptor\n\ connected to the slave end of a terminal."); static PyObject * posix_isatty(PyObject *self, PyObject *args) { int fd; if (!PyArg_ParseTuple(args, "i:isatty", &fd)) return NULL; if (!_PyVerify_fd(fd)) return PyBool_FromLong(0); return PyBool_FromLong(isatty(fd)); } #ifdef HAVE_PIPE PyDoc_STRVAR(posix_pipe__doc__, "pipe() -> (read_end, write_end)\n\n\ Create a pipe."); static PyObject * posix_pipe(PyObject *self, PyObject *noargs) { #if defined(PYOS_OS2) HFILE read, write; APIRET rc; Py_BEGIN_ALLOW_THREADS rc = DosCreatePipe( &read, &write, 4096); Py_END_ALLOW_THREADS if (rc != NO_ERROR) return os2_error(rc); return Py_BuildValue("(ii)", read, write); #else #if !defined(MS_WINDOWS) int fds[2]; int res; Py_BEGIN_ALLOW_THREADS res = pipe(fds); Py_END_ALLOW_THREADS if (res != 0) return posix_error(); return Py_BuildValue("(ii)", fds[0], fds[1]); #else /* MS_WINDOWS */ HANDLE read, write; int read_fd, write_fd; BOOL ok; Py_BEGIN_ALLOW_THREADS ok = CreatePipe(&read, &write, NULL, 0); Py_END_ALLOW_THREADS if (!ok) return win32_error("CreatePipe", NULL); read_fd = _open_osfhandle((Py_intptr_t)read, 0); write_fd = _open_osfhandle((Py_intptr_t)write, 1); return Py_BuildValue("(ii)", read_fd, write_fd); #endif /* MS_WINDOWS */ #endif } #endif /* HAVE_PIPE */ #ifdef HAVE_MKFIFO PyDoc_STRVAR(posix_mkfifo__doc__, "mkfifo(filename [, mode=0666])\n\n\ Create a FIFO (a POSIX named pipe)."); static PyObject * posix_mkfifo(PyObject *self, PyObject *args) { char *filename; int mode = 0666; int res; if (!PyArg_ParseTuple(args, "s|i:mkfifo", &filename, &mode)) return NULL; Py_BEGIN_ALLOW_THREADS res = mkfifo(filename, mode); Py_END_ALLOW_THREADS if (res < 0) return posix_error(); Py_INCREF(Py_None); return Py_None; } #endif #if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV) PyDoc_STRVAR(posix_mknod__doc__, "mknod(filename [, mode=0600, device])\n\n\ Create a filesystem node (file, device special file or named pipe)\n\ named filename. mode specifies both the permissions to use and the\n\ type of node to be created, being combined (bitwise OR) with one of\n\ S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO. For S_IFCHR and S_IFBLK,\n\ device defines the newly created device special file (probably using\n\ os.makedev()), otherwise it is ignored."); static PyObject * posix_mknod(PyObject *self, PyObject *args) { char *filename; int mode = 0600; dev_t device = 0; int res; if (!PyArg_ParseTuple(args, "s|iO&:mknod", &filename, &mode, _Py_Dev_Converter, &device)) return NULL; Py_BEGIN_ALLOW_THREADS res = mknod(filename, mode, device); Py_END_ALLOW_THREADS if (res < 0) return posix_error(); Py_INCREF(Py_None); return Py_None; } #endif #ifdef HAVE_DEVICE_MACROS PyDoc_STRVAR(posix_major__doc__, "major(device) -> major number\n\ Extracts a device major number from a raw device number."); static PyObject * posix_major(PyObject *self, PyObject *args) { dev_t device; if (!PyArg_ParseTuple(args, "O&:major", _Py_Dev_Converter, &device)) return NULL; return PyInt_FromLong((long)major(device)); } PyDoc_STRVAR(posix_minor__doc__, "minor(device) -> minor number\n\ Extracts a device minor number from a raw device number."); static PyObject * posix_minor(PyObject *self, PyObject *args) { dev_t device; if (!PyArg_ParseTuple(args, "O&:minor", _Py_Dev_Converter, &device)) return NULL; return PyInt_FromLong((long)minor(device)); } PyDoc_STRVAR(posix_makedev__doc__, "makedev(major, minor) -> device number\n\ Composes a raw device number from the major and minor device numbers."); static PyObject * posix_makedev(PyObject *self, PyObject *args) { int major, minor; if (!PyArg_ParseTuple(args, "ii:makedev", &major, &minor)) return NULL; return _PyInt_FromDev(makedev(major, minor)); } #endif /* device macros */ #ifdef HAVE_FTRUNCATE PyDoc_STRVAR(posix_ftruncate__doc__, "ftruncate(fd, length)\n\n\ Truncate a file to a specified length."); static PyObject * posix_ftruncate(PyObject *self, PyObject *args) { int fd; off_t length; int res; PyObject *lenobj; if (!PyArg_ParseTuple(args, "iO:ftruncate", &fd, &lenobj)) return NULL; #if !defined(HAVE_LARGEFILE_SUPPORT) length = PyInt_AsLong(lenobj); #else length = PyLong_Check(lenobj) ? PyLong_AsLongLong(lenobj) : PyInt_AsLong(lenobj); #endif if (PyErr_Occurred()) return NULL; Py_BEGIN_ALLOW_THREADS res = ftruncate(fd, length); Py_END_ALLOW_THREADS if (res < 0) return posix_error(); Py_INCREF(Py_None); return Py_None; } #endif #ifdef HAVE_PUTENV PyDoc_STRVAR(posix_putenv__doc__, "putenv(key, value)\n\n\ Change or add an environment variable."); /* Save putenv() parameters as values here, so we can collect them when they * get re-set with another call for the same key. */ static PyObject *posix_putenv_garbage; static PyObject * posix_putenv(PyObject *self, PyObject *args) { char *s1, *s2; char *newenv; PyObject *newstr; size_t len; if (!PyArg_ParseTuple(args, "ss:putenv", &s1, &s2)) return NULL; #if defined(PYOS_OS2) if (stricmp(s1, "BEGINLIBPATH") == 0) { APIRET rc; rc = DosSetExtLIBPATH(s2, BEGIN_LIBPATH); if (rc != NO_ERROR) return os2_error(rc); } else if (stricmp(s1, "ENDLIBPATH") == 0) { APIRET rc; rc = DosSetExtLIBPATH(s2, END_LIBPATH); if (rc != NO_ERROR) return os2_error(rc); } else { #endif /* Search from index 1 because on Windows starting '=' is allowed for defining hidden environment variables. */ if (*s1 == '\0' || strchr(s1 + 1, '=') != NULL) { PyErr_SetString(PyExc_ValueError, "illegal environment variable name"); return NULL; } /* XXX This can leak memory -- not easy to fix :-( */ len = strlen(s1) + strlen(s2) + 2; #ifdef MS_WINDOWS if (_MAX_ENV < (len - 1)) { PyErr_Format(PyExc_ValueError, "the environment variable is longer than %u bytes", _MAX_ENV); return NULL; } #endif /* len includes space for a trailing \0; the size arg to PyString_FromStringAndSize does not count that */ newstr = PyString_FromStringAndSize(NULL, (int)len - 1); if (newstr == NULL) return PyErr_NoMemory(); newenv = PyString_AS_STRING(newstr); PyOS_snprintf(newenv, len, "%s=%s", s1, s2); if (putenv(newenv)) { Py_DECREF(newstr); posix_error(); return NULL; } /* Install the first arg and newstr in posix_putenv_garbage; * this will cause previous value to be collected. This has to * happen after the real putenv() call because the old value * was still accessible until then. */ if (PyDict_SetItem(posix_putenv_garbage, PyTuple_GET_ITEM(args, 0), newstr)) { /* really not much we can do; just leak */ PyErr_Clear(); } else { Py_DECREF(newstr); } #if defined(PYOS_OS2) } #endif Py_INCREF(Py_None); return Py_None; } #endif /* putenv */ #ifdef HAVE_UNSETENV PyDoc_STRVAR(posix_unsetenv__doc__, "unsetenv(key)\n\n\ Delete an environment variable."); static PyObject * posix_unsetenv(PyObject *self, PyObject *args) { char *s1; #ifndef HAVE_BROKEN_UNSETENV int err; #endif if (!PyArg_ParseTuple(args, "s:unsetenv", &s1)) return NULL; #ifdef HAVE_BROKEN_UNSETENV unsetenv(s1); #else err = unsetenv(s1); if (err) return posix_error(); #endif /* Remove the key from posix_putenv_garbage; * this will cause it to be collected. This has to * happen after the real unsetenv() call because the * old value was still accessible until then. */ if (PyDict_DelItem(posix_putenv_garbage, PyTuple_GET_ITEM(args, 0))) { /* really not much we can do; just leak */ PyErr_Clear(); } Py_INCREF(Py_None); return Py_None; } #endif /* unsetenv */ PyDoc_STRVAR(posix_strerror__doc__, "strerror(code) -> string\n\n\ Translate an error code to a message string."); static PyObject * posix_strerror(PyObject *self, PyObject *args) { int code; char *message; if (!PyArg_ParseTuple(args, "i:strerror", &code)) return NULL; message = strerror(code); if (message == NULL) { PyErr_SetString(PyExc_ValueError, "strerror() argument out of range"); return NULL; } return PyString_FromString(message); } #ifdef HAVE_SYS_WAIT_H #ifdef WCOREDUMP PyDoc_STRVAR(posix_WCOREDUMP__doc__, "WCOREDUMP(status) -> bool\n\n\ Return True if the process returning 'status' was dumped to a core file."); static PyObject * posix_WCOREDUMP(PyObject *self, PyObject *args) { WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; if (!PyArg_ParseTuple(args, "i:WCOREDUMP", &WAIT_STATUS_INT(status))) return NULL; return PyBool_FromLong(WCOREDUMP(status)); } #endif /* WCOREDUMP */ #ifdef WIFCONTINUED PyDoc_STRVAR(posix_WIFCONTINUED__doc__, "WIFCONTINUED(status) -> bool\n\n\ Return True if the process returning 'status' was continued from a\n\ job control stop."); static PyObject * posix_WIFCONTINUED(PyObject *self, PyObject *args) { WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; if (!PyArg_ParseTuple(args, "i:WCONTINUED", &WAIT_STATUS_INT(status))) return NULL; return PyBool_FromLong(WIFCONTINUED(status)); } #endif /* WIFCONTINUED */ #ifdef WIFSTOPPED PyDoc_STRVAR(posix_WIFSTOPPED__doc__, "WIFSTOPPED(status) -> bool\n\n\ Return True if the process returning 'status' was stopped."); static PyObject * posix_WIFSTOPPED(PyObject *self, PyObject *args) { WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; if (!PyArg_ParseTuple(args, "i:WIFSTOPPED", &WAIT_STATUS_INT(status))) return NULL; return PyBool_FromLong(WIFSTOPPED(status)); } #endif /* WIFSTOPPED */ #ifdef WIFSIGNALED PyDoc_STRVAR(posix_WIFSIGNALED__doc__, "WIFSIGNALED(status) -> bool\n\n\ Return True if the process returning 'status' was terminated by a signal."); static PyObject * posix_WIFSIGNALED(PyObject *self, PyObject *args) { WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; if (!PyArg_ParseTuple(args, "i:WIFSIGNALED", &WAIT_STATUS_INT(status))) return NULL; return PyBool_FromLong(WIFSIGNALED(status)); } #endif /* WIFSIGNALED */ #ifdef WIFEXITED PyDoc_STRVAR(posix_WIFEXITED__doc__, "WIFEXITED(status) -> bool\n\n\ Return true if the process returning 'status' exited using the exit()\n\ system call."); static PyObject * posix_WIFEXITED(PyObject *self, PyObject *args) { WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; if (!PyArg_ParseTuple(args, "i:WIFEXITED", &WAIT_STATUS_INT(status))) return NULL; return PyBool_FromLong(WIFEXITED(status)); } #endif /* WIFEXITED */ #ifdef WEXITSTATUS PyDoc_STRVAR(posix_WEXITSTATUS__doc__, "WEXITSTATUS(status) -> integer\n\n\ Return the process return code from 'status'."); static PyObject * posix_WEXITSTATUS(PyObject *self, PyObject *args) { WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; if (!PyArg_ParseTuple(args, "i:WEXITSTATUS", &WAIT_STATUS_INT(status))) return NULL; return Py_BuildValue("i", WEXITSTATUS(status)); } #endif /* WEXITSTATUS */ #ifdef WTERMSIG PyDoc_STRVAR(posix_WTERMSIG__doc__, "WTERMSIG(status) -> integer\n\n\ Return the signal that terminated the process that provided the 'status'\n\ value."); static PyObject * posix_WTERMSIG(PyObject *self, PyObject *args) { WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; if (!PyArg_ParseTuple(args, "i:WTERMSIG", &WAIT_STATUS_INT(status))) return NULL; return Py_BuildValue("i", WTERMSIG(status)); } #endif /* WTERMSIG */ #ifdef WSTOPSIG PyDoc_STRVAR(posix_WSTOPSIG__doc__, "WSTOPSIG(status) -> integer\n\n\ Return the signal that stopped the process that provided\n\ the 'status' value."); static PyObject * posix_WSTOPSIG(PyObject *self, PyObject *args) { WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; if (!PyArg_ParseTuple(args, "i:WSTOPSIG", &WAIT_STATUS_INT(status))) return NULL; return Py_BuildValue("i", WSTOPSIG(status)); } #endif /* WSTOPSIG */ #endif /* HAVE_SYS_WAIT_H */ #if defined(HAVE_FSTATVFS) && defined(HAVE_SYS_STATVFS_H) #ifdef _SCO_DS /* SCO OpenServer 5.0 and later requires _SVID3 before it reveals the needed definitions in sys/statvfs.h */ #define _SVID3 #endif #include <sys/statvfs.h> static PyObject* _pystatvfs_fromstructstatvfs(struct statvfs st) { PyObject *v = PyStructSequence_New(&StatVFSResultType); if (v == NULL) return NULL; #if !defined(HAVE_LARGEFILE_SUPPORT) PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize)); PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize)); PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long) st.f_blocks)); PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long) st.f_bfree)); PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long) st.f_bavail)); PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long) st.f_files)); PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong((long) st.f_ffree)); PyStructSequence_SET_ITEM(v, 7, PyInt_FromLong((long) st.f_favail)); PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag)); PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax)); #else PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize)); PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize)); PyStructSequence_SET_ITEM(v, 2, PyLong_FromLongLong((PY_LONG_LONG) st.f_blocks)); PyStructSequence_SET_ITEM(v, 3, PyLong_FromLongLong((PY_LONG_LONG) st.f_bfree)); PyStructSequence_SET_ITEM(v, 4, PyLong_FromLongLong((PY_LONG_LONG) st.f_bavail)); PyStructSequence_SET_ITEM(v, 5, PyLong_FromLongLong((PY_LONG_LONG) st.f_files)); PyStructSequence_SET_ITEM(v, 6, PyLong_FromLongLong((PY_LONG_LONG) st.f_ffree)); PyStructSequence_SET_ITEM(v, 7, PyLong_FromLongLong((PY_LONG_LONG) st.f_favail)); PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag)); PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax)); #endif return v; } PyDoc_STRVAR(posix_fstatvfs__doc__, "fstatvfs(fd) -> statvfs result\n\n\ Perform an fstatvfs system call on the given fd."); static PyObject * posix_fstatvfs(PyObject *self, PyObject *args) { int fd, res; struct statvfs st; if (!PyArg_ParseTuple(args, "i:fstatvfs", &fd)) return NULL; Py_BEGIN_ALLOW_THREADS res = fstatvfs(fd, &st); Py_END_ALLOW_THREADS if (res != 0) return posix_error(); return _pystatvfs_fromstructstatvfs(st); } #endif /* HAVE_FSTATVFS && HAVE_SYS_STATVFS_H */ #if defined(HAVE_STATVFS) && defined(HAVE_SYS_STATVFS_H) #include <sys/statvfs.h> PyDoc_STRVAR(posix_statvfs__doc__, "statvfs(path) -> statvfs result\n\n\ Perform a statvfs system call on the given path."); static PyObject * posix_statvfs(PyObject *self, PyObject *args) { char *path; int res; struct statvfs st; if (!PyArg_ParseTuple(args, "s:statvfs", &path)) return NULL; Py_BEGIN_ALLOW_THREADS res = statvfs(path, &st); Py_END_ALLOW_THREADS if (res != 0) return posix_error_with_filename(path); return _pystatvfs_fromstructstatvfs(st); } #endif /* HAVE_STATVFS */ #ifdef HAVE_TEMPNAM PyDoc_STRVAR(posix_tempnam__doc__, "tempnam([dir[, prefix]]) -> string\n\n\ Return a unique name for a temporary file.\n\ The directory and a prefix may be specified as strings; they may be omitted\n\ or None if not needed."); static PyObject * posix_tempnam(PyObject *self, PyObject *args) { PyObject *result = NULL; char *dir = NULL; char *pfx = NULL; char *name; if (!PyArg_ParseTuple(args, "|zz:tempnam", &dir, &pfx)) return NULL; if (PyErr_Warn(PyExc_RuntimeWarning, "tempnam is a potential security risk to your program") < 0) return NULL; if (PyErr_WarnPy3k("tempnam has been removed in 3.x; " "use the tempfile module", 1) < 0) return NULL; #ifdef MS_WINDOWS name = _tempnam(dir, pfx); #else name = tempnam(dir, pfx); #endif if (name == NULL) return PyErr_NoMemory(); result = PyString_FromString(name); free(name); return result; } #endif #ifdef HAVE_TMPFILE PyDoc_STRVAR(posix_tmpfile__doc__, "tmpfile() -> file object\n\n\ Create a temporary file with no directory entries."); static PyObject * posix_tmpfile(PyObject *self, PyObject *noargs) { FILE *fp; if (PyErr_WarnPy3k("tmpfile has been removed in 3.x; " "use the tempfile module", 1) < 0) return NULL; fp = tmpfile(); if (fp == NULL) return posix_error(); return PyFile_FromFile(fp, "<tmpfile>", "w+b", fclose); } #endif #ifdef HAVE_TMPNAM PyDoc_STRVAR(posix_tmpnam__doc__, "tmpnam() -> string\n\n\ Return a unique name for a temporary file."); static PyObject * posix_tmpnam(PyObject *self, PyObject *noargs) { char buffer[L_tmpnam]; char *name; if (PyErr_Warn(PyExc_RuntimeWarning, "tmpnam is a potential security risk to your program") < 0) return NULL; if (PyErr_WarnPy3k("tmpnam has been removed in 3.x; " "use the tempfile module", 1) < 0) return NULL; #ifdef USE_TMPNAM_R name = tmpnam_r(buffer); #else name = tmpnam(buffer); #endif if (name == NULL) { PyObject *err = Py_BuildValue("is", 0, #ifdef USE_TMPNAM_R "unexpected NULL from tmpnam_r" #else "unexpected NULL from tmpnam" #endif ); PyErr_SetObject(PyExc_OSError, err); Py_XDECREF(err); return NULL; } return PyString_FromString(buffer); } #endif /* This is used for fpathconf(), pathconf(), confstr() and sysconf(). * It maps strings representing configuration variable names to * integer values, allowing those functions to be called with the * magic names instead of polluting the module's namespace with tons of * rarely-used constants. There are three separate tables that use * these definitions. * * This code is always included, even if none of the interfaces that * need it are included. The #if hackery needed to avoid it would be * sufficiently pervasive that it's not worth the loss of readability. */ struct constdef { char *name; long value; }; static int conv_confname(PyObject *arg, int *valuep, struct constdef *table, size_t tablesize) { if (PyInt_Check(arg)) { *valuep = PyInt_AS_LONG(arg); return 1; } if (PyString_Check(arg)) { /* look up the value in the table using a binary search */ size_t lo = 0; size_t mid; size_t hi = tablesize; int cmp; char *confname = PyString_AS_STRING(arg); while (lo < hi) { mid = (lo + hi) / 2; cmp = strcmp(confname, table[mid].name); if (cmp < 0) hi = mid; else if (cmp > 0) lo = mid + 1; else { *valuep = table[mid].value; return 1; } } PyErr_SetString(PyExc_ValueError, "unrecognized configuration name"); } else PyErr_SetString(PyExc_TypeError, "configuration names must be strings or integers"); return 0; } #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) static struct constdef posix_constants_pathconf[] = { #ifdef _PC_ABI_AIO_XFER_MAX {"PC_ABI_AIO_XFER_MAX", _PC_ABI_AIO_XFER_MAX}, #endif #ifdef _PC_ABI_ASYNC_IO {"PC_ABI_ASYNC_IO", _PC_ABI_ASYNC_IO}, #endif #ifdef _PC_ASYNC_IO {"PC_ASYNC_IO", _PC_ASYNC_IO}, #endif #ifdef _PC_CHOWN_RESTRICTED {"PC_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED}, #endif #ifdef _PC_FILESIZEBITS {"PC_FILESIZEBITS", _PC_FILESIZEBITS}, #endif #ifdef _PC_LAST {"PC_LAST", _PC_LAST}, #endif #ifdef _PC_LINK_MAX {"PC_LINK_MAX", _PC_LINK_MAX}, #endif #ifdef _PC_MAX_CANON {"PC_MAX_CANON", _PC_MAX_CANON}, #endif #ifdef _PC_MAX_INPUT {"PC_MAX_INPUT", _PC_MAX_INPUT}, #endif #ifdef _PC_NAME_MAX {"PC_NAME_MAX", _PC_NAME_MAX}, #endif #ifdef _PC_NO_TRUNC {"PC_NO_TRUNC", _PC_NO_TRUNC}, #endif #ifdef _PC_PATH_MAX {"PC_PATH_MAX", _PC_PATH_MAX}, #endif #ifdef _PC_PIPE_BUF {"PC_PIPE_BUF", _PC_PIPE_BUF}, #endif #ifdef _PC_PRIO_IO {"PC_PRIO_IO", _PC_PRIO_IO}, #endif #ifdef _PC_SOCK_MAXBUF {"PC_SOCK_MAXBUF", _PC_SOCK_MAXBUF}, #endif #ifdef _PC_SYNC_IO {"PC_SYNC_IO", _PC_SYNC_IO}, #endif #ifdef _PC_VDISABLE {"PC_VDISABLE", _PC_VDISABLE}, #endif }; static int conv_path_confname(PyObject *arg, int *valuep) { return conv_confname(arg, valuep, posix_constants_pathconf, sizeof(posix_constants_pathconf) / sizeof(struct constdef)); } #endif #ifdef HAVE_FPATHCONF PyDoc_STRVAR(posix_fpathconf__doc__, "fpathconf(fd, name) -> integer\n\n\ Return the configuration limit name for the file descriptor fd.\n\ If there is no limit, return -1."); static PyObject * posix_fpathconf(PyObject *self, PyObject *args) { PyObject *result = NULL; int name, fd; if (PyArg_ParseTuple(args, "iO&:fpathconf", &fd, conv_path_confname, &name)) { long limit; errno = 0; limit = fpathconf(fd, name); if (limit == -1 && errno != 0) posix_error(); else result = PyInt_FromLong(limit); } return result; } #endif #ifdef HAVE_PATHCONF PyDoc_STRVAR(posix_pathconf__doc__, "pathconf(path, name) -> integer\n\n\ Return the configuration limit name for the file or directory path.\n\ If there is no limit, return -1."); static PyObject * posix_pathconf(PyObject *self, PyObject *args) { PyObject *result = NULL; int name; char *path; if (PyArg_ParseTuple(args, "sO&:pathconf", &path, conv_path_confname, &name)) { long limit; errno = 0; limit = pathconf(path, name); if (limit == -1 && errno != 0) { if (errno == EINVAL) /* could be a path or name problem */ posix_error(); else posix_error_with_filename(path); } else result = PyInt_FromLong(limit); } return result; } #endif #ifdef HAVE_CONFSTR static struct constdef posix_constants_confstr[] = { #ifdef _CS_ARCHITECTURE {"CS_ARCHITECTURE", _CS_ARCHITECTURE}, #endif #ifdef _CS_HOSTNAME {"CS_HOSTNAME", _CS_HOSTNAME}, #endif #ifdef _CS_HW_PROVIDER {"CS_HW_PROVIDER", _CS_HW_PROVIDER}, #endif #ifdef _CS_HW_SERIAL {"CS_HW_SERIAL", _CS_HW_SERIAL}, #endif #ifdef _CS_INITTAB_NAME {"CS_INITTAB_NAME", _CS_INITTAB_NAME}, #endif #ifdef _CS_LFS64_CFLAGS {"CS_LFS64_CFLAGS", _CS_LFS64_CFLAGS}, #endif #ifdef _CS_LFS64_LDFLAGS {"CS_LFS64_LDFLAGS", _CS_LFS64_LDFLAGS}, #endif #ifdef _CS_LFS64_LIBS {"CS_LFS64_LIBS", _CS_LFS64_LIBS}, #endif #ifdef _CS_LFS64_LINTFLAGS {"CS_LFS64_LINTFLAGS", _CS_LFS64_LINTFLAGS}, #endif #ifdef _CS_LFS_CFLAGS {"CS_LFS_CFLAGS", _CS_LFS_CFLAGS}, #endif #ifdef _CS_LFS_LDFLAGS {"CS_LFS_LDFLAGS", _CS_LFS_LDFLAGS}, #endif #ifdef _CS_LFS_LIBS {"CS_LFS_LIBS", _CS_LFS_LIBS}, #endif #ifdef _CS_LFS_LINTFLAGS {"CS_LFS_LINTFLAGS", _CS_LFS_LINTFLAGS}, #endif #ifdef _CS_MACHINE {"CS_MACHINE", _CS_MACHINE}, #endif #ifdef _CS_PATH {"CS_PATH", _CS_PATH}, #endif #ifdef _CS_RELEASE {"CS_RELEASE", _CS_RELEASE}, #endif #ifdef _CS_SRPC_DOMAIN {"CS_SRPC_DOMAIN", _CS_SRPC_DOMAIN}, #endif #ifdef _CS_SYSNAME {"CS_SYSNAME", _CS_SYSNAME}, #endif #ifdef _CS_VERSION {"CS_VERSION", _CS_VERSION}, #endif #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS {"CS_XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS}, #endif #ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS {"CS_XBS5_ILP32_OFF32_LDFLAGS", _CS_XBS5_ILP32_OFF32_LDFLAGS}, #endif #ifdef _CS_XBS5_ILP32_OFF32_LIBS {"CS_XBS5_ILP32_OFF32_LIBS", _CS_XBS5_ILP32_OFF32_LIBS}, #endif #ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS {"CS_XBS5_ILP32_OFF32_LINTFLAGS", _CS_XBS5_ILP32_OFF32_LINTFLAGS}, #endif #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS {"CS_XBS5_ILP32_OFFBIG_CFLAGS", _CS_XBS5_ILP32_OFFBIG_CFLAGS}, #endif #ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS {"CS_XBS5_ILP32_OFFBIG_LDFLAGS", _CS_XBS5_ILP32_OFFBIG_LDFLAGS}, #endif #ifdef _CS_XBS5_ILP32_OFFBIG_LIBS {"CS_XBS5_ILP32_OFFBIG_LIBS", _CS_XBS5_ILP32_OFFBIG_LIBS}, #endif #ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS {"CS_XBS5_ILP32_OFFBIG_LINTFLAGS", _CS_XBS5_ILP32_OFFBIG_LINTFLAGS}, #endif #ifdef _CS_XBS5_LP64_OFF64_CFLAGS {"CS_XBS5_LP64_OFF64_CFLAGS", _CS_XBS5_LP64_OFF64_CFLAGS}, #endif #ifdef _CS_XBS5_LP64_OFF64_LDFLAGS {"CS_XBS5_LP64_OFF64_LDFLAGS", _CS_XBS5_LP64_OFF64_LDFLAGS}, #endif #ifdef _CS_XBS5_LP64_OFF64_LIBS {"CS_XBS5_LP64_OFF64_LIBS", _CS_XBS5_LP64_OFF64_LIBS}, #endif #ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS {"CS_XBS5_LP64_OFF64_LINTFLAGS", _CS_XBS5_LP64_OFF64_LINTFLAGS}, #endif #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS {"CS_XBS5_LPBIG_OFFBIG_CFLAGS", _CS_XBS5_LPBIG_OFFBIG_CFLAGS}, #endif #ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS {"CS_XBS5_LPBIG_OFFBIG_LDFLAGS", _CS_XBS5_LPBIG_OFFBIG_LDFLAGS}, #endif #ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS {"CS_XBS5_LPBIG_OFFBIG_LIBS", _CS_XBS5_LPBIG_OFFBIG_LIBS}, #endif #ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS {"CS_XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS}, #endif #ifdef _MIPS_CS_AVAIL_PROCESSORS {"MIPS_CS_AVAIL_PROCESSORS", _MIPS_CS_AVAIL_PROCESSORS}, #endif #ifdef _MIPS_CS_BASE {"MIPS_CS_BASE", _MIPS_CS_BASE}, #endif #ifdef _MIPS_CS_HOSTID {"MIPS_CS_HOSTID", _MIPS_CS_HOSTID}, #endif #ifdef _MIPS_CS_HW_NAME {"MIPS_CS_HW_NAME", _MIPS_CS_HW_NAME}, #endif #ifdef _MIPS_CS_NUM_PROCESSORS {"MIPS_CS_NUM_PROCESSORS", _MIPS_CS_NUM_PROCESSORS}, #endif #ifdef _MIPS_CS_OSREL_MAJ {"MIPS_CS_OSREL_MAJ", _MIPS_CS_OSREL_MAJ}, #endif #ifdef _MIPS_CS_OSREL_MIN {"MIPS_CS_OSREL_MIN", _MIPS_CS_OSREL_MIN}, #endif #ifdef _MIPS_CS_OSREL_PATCH {"MIPS_CS_OSREL_PATCH", _MIPS_CS_OSREL_PATCH}, #endif #ifdef _MIPS_CS_OS_NAME {"MIPS_CS_OS_NAME", _MIPS_CS_OS_NAME}, #endif #ifdef _MIPS_CS_OS_PROVIDER {"MIPS_CS_OS_PROVIDER", _MIPS_CS_OS_PROVIDER}, #endif #ifdef _MIPS_CS_PROCESSORS {"MIPS_CS_PROCESSORS", _MIPS_CS_PROCESSORS}, #endif #ifdef _MIPS_CS_SERIAL {"MIPS_CS_SERIAL", _MIPS_CS_SERIAL}, #endif #ifdef _MIPS_CS_VENDOR {"MIPS_CS_VENDOR", _MIPS_CS_VENDOR}, #endif }; static int conv_confstr_confname(PyObject *arg, int *valuep) { return conv_confname(arg, valuep, posix_constants_confstr, sizeof(posix_constants_confstr) / sizeof(struct constdef)); } PyDoc_STRVAR(posix_confstr__doc__, "confstr(name) -> string\n\n\ Return a string-valued system configuration variable."); static PyObject * posix_confstr(PyObject *self, PyObject *args) { PyObject *result = NULL; int name; char buffer[256]; if (PyArg_ParseTuple(args, "O&:confstr", conv_confstr_confname, &name)) { int len; errno = 0; len = confstr(name, buffer, sizeof(buffer)); if (len == 0) { if (errno) { posix_error(); } else { result = Py_None; Py_INCREF(Py_None); } } else { if ((unsigned int)len >= sizeof(buffer)) { result = PyString_FromStringAndSize(NULL, len-1); if (result != NULL) confstr(name, PyString_AS_STRING(result), len); } else result = PyString_FromStringAndSize(buffer, len-1); } } return result; } #endif #ifdef HAVE_SYSCONF static struct constdef posix_constants_sysconf[] = { #ifdef _SC_2_CHAR_TERM {"SC_2_CHAR_TERM", _SC_2_CHAR_TERM}, #endif #ifdef _SC_2_C_BIND {"SC_2_C_BIND", _SC_2_C_BIND}, #endif #ifdef _SC_2_C_DEV {"SC_2_C_DEV", _SC_2_C_DEV}, #endif #ifdef _SC_2_C_VERSION {"SC_2_C_VERSION", _SC_2_C_VERSION}, #endif #ifdef _SC_2_FORT_DEV {"SC_2_FORT_DEV", _SC_2_FORT_DEV}, #endif #ifdef _SC_2_FORT_RUN {"SC_2_FORT_RUN", _SC_2_FORT_RUN}, #endif #ifdef _SC_2_LOCALEDEF {"SC_2_LOCALEDEF", _SC_2_LOCALEDEF}, #endif #ifdef _SC_2_SW_DEV {"SC_2_SW_DEV", _SC_2_SW_DEV}, #endif #ifdef _SC_2_UPE {"SC_2_UPE", _SC_2_UPE}, #endif #ifdef _SC_2_VERSION {"SC_2_VERSION", _SC_2_VERSION}, #endif #ifdef _SC_ABI_ASYNCHRONOUS_IO {"SC_ABI_ASYNCHRONOUS_IO", _SC_ABI_ASYNCHRONOUS_IO}, #endif #ifdef _SC_ACL {"SC_ACL", _SC_ACL}, #endif #ifdef _SC_AIO_LISTIO_MAX {"SC_AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX}, #endif #ifdef _SC_AIO_MAX {"SC_AIO_MAX", _SC_AIO_MAX}, #endif #ifdef _SC_AIO_PRIO_DELTA_MAX {"SC_AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX}, #endif #ifdef _SC_ARG_MAX {"SC_ARG_MAX", _SC_ARG_MAX}, #endif #ifdef _SC_ASYNCHRONOUS_IO {"SC_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO}, #endif #ifdef _SC_ATEXIT_MAX {"SC_ATEXIT_MAX", _SC_ATEXIT_MAX}, #endif #ifdef _SC_AUDIT {"SC_AUDIT", _SC_AUDIT}, #endif #ifdef _SC_AVPHYS_PAGES {"SC_AVPHYS_PAGES", _SC_AVPHYS_PAGES}, #endif #ifdef _SC_BC_BASE_MAX {"SC_BC_BASE_MAX", _SC_BC_BASE_MAX}, #endif #ifdef _SC_BC_DIM_MAX {"SC_BC_DIM_MAX", _SC_BC_DIM_MAX}, #endif #ifdef _SC_BC_SCALE_MAX {"SC_BC_SCALE_MAX", _SC_BC_SCALE_MAX}, #endif #ifdef _SC_BC_STRING_MAX {"SC_BC_STRING_MAX", _SC_BC_STRING_MAX}, #endif #ifdef _SC_CAP {"SC_CAP", _SC_CAP}, #endif #ifdef _SC_CHARCLASS_NAME_MAX {"SC_CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX}, #endif #ifdef _SC_CHAR_BIT {"SC_CHAR_BIT", _SC_CHAR_BIT}, #endif #ifdef _SC_CHAR_MAX {"SC_CHAR_MAX", _SC_CHAR_MAX}, #endif #ifdef _SC_CHAR_MIN {"SC_CHAR_MIN", _SC_CHAR_MIN}, #endif #ifdef _SC_CHILD_MAX {"SC_CHILD_MAX", _SC_CHILD_MAX}, #endif #ifdef _SC_CLK_TCK {"SC_CLK_TCK", _SC_CLK_TCK}, #endif #ifdef _SC_COHER_BLKSZ {"SC_COHER_BLKSZ", _SC_COHER_BLKSZ}, #endif #ifdef _SC_COLL_WEIGHTS_MAX {"SC_COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX}, #endif #ifdef _SC_DCACHE_ASSOC {"SC_DCACHE_ASSOC", _SC_DCACHE_ASSOC}, #endif #ifdef _SC_DCACHE_BLKSZ {"SC_DCACHE_BLKSZ", _SC_DCACHE_BLKSZ}, #endif #ifdef _SC_DCACHE_LINESZ {"SC_DCACHE_LINESZ", _SC_DCACHE_LINESZ}, #endif #ifdef _SC_DCACHE_SZ {"SC_DCACHE_SZ", _SC_DCACHE_SZ}, #endif #ifdef _SC_DCACHE_TBLKSZ {"SC_DCACHE_TBLKSZ", _SC_DCACHE_TBLKSZ}, #endif #ifdef _SC_DELAYTIMER_MAX {"SC_DELAYTIMER_MAX", _SC_DELAYTIMER_MAX}, #endif #ifdef _SC_EQUIV_CLASS_MAX {"SC_EQUIV_CLASS_MAX", _SC_EQUIV_CLASS_MAX}, #endif #ifdef _SC_EXPR_NEST_MAX {"SC_EXPR_NEST_MAX", _SC_EXPR_NEST_MAX}, #endif #ifdef _SC_FSYNC {"SC_FSYNC", _SC_FSYNC}, #endif #ifdef _SC_GETGR_R_SIZE_MAX {"SC_GETGR_R_SIZE_MAX", _SC_GETGR_R_SIZE_MAX}, #endif #ifdef _SC_GETPW_R_SIZE_MAX {"SC_GETPW_R_SIZE_MAX", _SC_GETPW_R_SIZE_MAX}, #endif #ifdef _SC_ICACHE_ASSOC {"SC_ICACHE_ASSOC", _SC_ICACHE_ASSOC}, #endif #ifdef _SC_ICACHE_BLKSZ {"SC_ICACHE_BLKSZ", _SC_ICACHE_BLKSZ}, #endif #ifdef _SC_ICACHE_LINESZ {"SC_ICACHE_LINESZ", _SC_ICACHE_LINESZ}, #endif #ifdef _SC_ICACHE_SZ {"SC_ICACHE_SZ", _SC_ICACHE_SZ}, #endif #ifdef _SC_INF {"SC_INF", _SC_INF}, #endif #ifdef _SC_INT_MAX {"SC_INT_MAX", _SC_INT_MAX}, #endif #ifdef _SC_INT_MIN {"SC_INT_MIN", _SC_INT_MIN}, #endif #ifdef _SC_IOV_MAX {"SC_IOV_MAX", _SC_IOV_MAX}, #endif #ifdef _SC_IP_SECOPTS {"SC_IP_SECOPTS", _SC_IP_SECOPTS}, #endif #ifdef _SC_JOB_CONTROL {"SC_JOB_CONTROL", _SC_JOB_CONTROL}, #endif #ifdef _SC_KERN_POINTERS {"SC_KERN_POINTERS", _SC_KERN_POINTERS}, #endif #ifdef _SC_KERN_SIM {"SC_KERN_SIM", _SC_KERN_SIM}, #endif #ifdef _SC_LINE_MAX {"SC_LINE_MAX", _SC_LINE_MAX}, #endif #ifdef _SC_LOGIN_NAME_MAX {"SC_LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX}, #endif #ifdef _SC_LOGNAME_MAX {"SC_LOGNAME_MAX", _SC_LOGNAME_MAX}, #endif #ifdef _SC_LONG_BIT {"SC_LONG_BIT", _SC_LONG_BIT}, #endif #ifdef _SC_MAC {"SC_MAC", _SC_MAC}, #endif #ifdef _SC_MAPPED_FILES {"SC_MAPPED_FILES", _SC_MAPPED_FILES}, #endif #ifdef _SC_MAXPID {"SC_MAXPID", _SC_MAXPID}, #endif #ifdef _SC_MB_LEN_MAX {"SC_MB_LEN_MAX", _SC_MB_LEN_MAX}, #endif #ifdef _SC_MEMLOCK {"SC_MEMLOCK", _SC_MEMLOCK}, #endif #ifdef _SC_MEMLOCK_RANGE {"SC_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE}, #endif #ifdef _SC_MEMORY_PROTECTION {"SC_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION}, #endif #ifdef _SC_MESSAGE_PASSING {"SC_MESSAGE_PASSING", _SC_MESSAGE_PASSING}, #endif #ifdef _SC_MMAP_FIXED_ALIGNMENT {"SC_MMAP_FIXED_ALIGNMENT", _SC_MMAP_FIXED_ALIGNMENT}, #endif #ifdef _SC_MQ_OPEN_MAX {"SC_MQ_OPEN_MAX", _SC_MQ_OPEN_MAX}, #endif #ifdef _SC_MQ_PRIO_MAX {"SC_MQ_PRIO_MAX", _SC_MQ_PRIO_MAX}, #endif #ifdef _SC_NACLS_MAX {"SC_NACLS_MAX", _SC_NACLS_MAX}, #endif #ifdef _SC_NGROUPS_MAX {"SC_NGROUPS_MAX", _SC_NGROUPS_MAX}, #endif #ifdef _SC_NL_ARGMAX {"SC_NL_ARGMAX", _SC_NL_ARGMAX}, #endif #ifdef _SC_NL_LANGMAX {"SC_NL_LANGMAX", _SC_NL_LANGMAX}, #endif #ifdef _SC_NL_MSGMAX {"SC_NL_MSGMAX", _SC_NL_MSGMAX}, #endif #ifdef _SC_NL_NMAX {"SC_NL_NMAX", _SC_NL_NMAX}, #endif #ifdef _SC_NL_SETMAX {"SC_NL_SETMAX", _SC_NL_SETMAX}, #endif #ifdef _SC_NL_TEXTMAX {"SC_NL_TEXTMAX", _SC_NL_TEXTMAX}, #endif #ifdef _SC_NPROCESSORS_CONF {"SC_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF}, #endif #ifdef _SC_NPROCESSORS_ONLN {"SC_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN}, #endif #ifdef _SC_NPROC_CONF {"SC_NPROC_CONF", _SC_NPROC_CONF}, #endif #ifdef _SC_NPROC_ONLN {"SC_NPROC_ONLN", _SC_NPROC_ONLN}, #endif #ifdef _SC_NZERO {"SC_NZERO", _SC_NZERO}, #endif #ifdef _SC_OPEN_MAX {"SC_OPEN_MAX", _SC_OPEN_MAX}, #endif #ifdef _SC_PAGESIZE {"SC_PAGESIZE", _SC_PAGESIZE}, #endif #ifdef _SC_PAGE_SIZE {"SC_PAGE_SIZE", _SC_PAGE_SIZE}, #endif #ifdef _SC_PASS_MAX {"SC_PASS_MAX", _SC_PASS_MAX}, #endif #ifdef _SC_PHYS_PAGES {"SC_PHYS_PAGES", _SC_PHYS_PAGES}, #endif #ifdef _SC_PII {"SC_PII", _SC_PII}, #endif #ifdef _SC_PII_INTERNET {"SC_PII_INTERNET", _SC_PII_INTERNET}, #endif #ifdef _SC_PII_INTERNET_DGRAM {"SC_PII_INTERNET_DGRAM", _SC_PII_INTERNET_DGRAM}, #endif #ifdef _SC_PII_INTERNET_STREAM {"SC_PII_INTERNET_STREAM", _SC_PII_INTERNET_STREAM}, #endif #ifdef _SC_PII_OSI {"SC_PII_OSI", _SC_PII_OSI}, #endif #ifdef _SC_PII_OSI_CLTS {"SC_PII_OSI_CLTS", _SC_PII_OSI_CLTS}, #endif #ifdef _SC_PII_OSI_COTS {"SC_PII_OSI_COTS", _SC_PII_OSI_COTS}, #endif #ifdef _SC_PII_OSI_M {"SC_PII_OSI_M", _SC_PII_OSI_M}, #endif #ifdef _SC_PII_SOCKET {"SC_PII_SOCKET", _SC_PII_SOCKET}, #endif #ifdef _SC_PII_XTI {"SC_PII_XTI", _SC_PII_XTI}, #endif #ifdef _SC_POLL {"SC_POLL", _SC_POLL}, #endif #ifdef _SC_PRIORITIZED_IO {"SC_PRIORITIZED_IO", _SC_PRIORITIZED_IO}, #endif #ifdef _SC_PRIORITY_SCHEDULING {"SC_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING}, #endif #ifdef _SC_REALTIME_SIGNALS {"SC_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS}, #endif #ifdef _SC_RE_DUP_MAX {"SC_RE_DUP_MAX", _SC_RE_DUP_MAX}, #endif #ifdef _SC_RTSIG_MAX {"SC_RTSIG_MAX", _SC_RTSIG_MAX}, #endif #ifdef _SC_SAVED_IDS {"SC_SAVED_IDS", _SC_SAVED_IDS}, #endif #ifdef _SC_SCHAR_MAX {"SC_SCHAR_MAX", _SC_SCHAR_MAX}, #endif #ifdef _SC_SCHAR_MIN {"SC_SCHAR_MIN", _SC_SCHAR_MIN}, #endif #ifdef _SC_SELECT {"SC_SELECT", _SC_SELECT}, #endif #ifdef _SC_SEMAPHORES {"SC_SEMAPHORES", _SC_SEMAPHORES}, #endif #ifdef _SC_SEM_NSEMS_MAX {"SC_SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX}, #endif #ifdef _SC_SEM_VALUE_MAX {"SC_SEM_VALUE_MAX", _SC_SEM_VALUE_MAX}, #endif #ifdef _SC_SHARED_MEMORY_OBJECTS {"SC_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS}, #endif #ifdef _SC_SHRT_MAX {"SC_SHRT_MAX", _SC_SHRT_MAX}, #endif #ifdef _SC_SHRT_MIN {"SC_SHRT_MIN", _SC_SHRT_MIN}, #endif #ifdef _SC_SIGQUEUE_MAX {"SC_SIGQUEUE_MAX", _SC_SIGQUEUE_MAX}, #endif #ifdef _SC_SIGRT_MAX {"SC_SIGRT_MAX", _SC_SIGRT_MAX}, #endif #ifdef _SC_SIGRT_MIN {"SC_SIGRT_MIN", _SC_SIGRT_MIN}, #endif #ifdef _SC_SOFTPOWER {"SC_SOFTPOWER", _SC_SOFTPOWER}, #endif #ifdef _SC_SPLIT_CACHE {"SC_SPLIT_CACHE", _SC_SPLIT_CACHE}, #endif #ifdef _SC_SSIZE_MAX {"SC_SSIZE_MAX", _SC_SSIZE_MAX}, #endif #ifdef _SC_STACK_PROT {"SC_STACK_PROT", _SC_STACK_PROT}, #endif #ifdef _SC_STREAM_MAX {"SC_STREAM_MAX", _SC_STREAM_MAX}, #endif #ifdef _SC_SYNCHRONIZED_IO {"SC_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO}, #endif #ifdef _SC_THREADS {"SC_THREADS", _SC_THREADS}, #endif #ifdef _SC_THREAD_ATTR_STACKADDR {"SC_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR}, #endif #ifdef _SC_THREAD_ATTR_STACKSIZE {"SC_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE}, #endif #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS {"SC_THREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS}, #endif #ifdef _SC_THREAD_KEYS_MAX {"SC_THREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX}, #endif #ifdef _SC_THREAD_PRIORITY_SCHEDULING {"SC_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING}, #endif #ifdef _SC_THREAD_PRIO_INHERIT {"SC_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT}, #endif #ifdef _SC_THREAD_PRIO_PROTECT {"SC_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT}, #endif #ifdef _SC_THREAD_PROCESS_SHARED {"SC_THREAD_PROCESS_SHARED", _SC_THREAD_PROCESS_SHARED}, #endif #ifdef _SC_THREAD_SAFE_FUNCTIONS {"SC_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS}, #endif #ifdef _SC_THREAD_STACK_MIN {"SC_THREAD_STACK_MIN", _SC_THREAD_STACK_MIN}, #endif #ifdef _SC_THREAD_THREADS_MAX {"SC_THREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX}, #endif #ifdef _SC_TIMERS {"SC_TIMERS", _SC_TIMERS}, #endif #ifdef _SC_TIMER_MAX {"SC_TIMER_MAX", _SC_TIMER_MAX}, #endif #ifdef _SC_TTY_NAME_MAX {"SC_TTY_NAME_MAX", _SC_TTY_NAME_MAX}, #endif #ifdef _SC_TZNAME_MAX {"SC_TZNAME_MAX", _SC_TZNAME_MAX}, #endif #ifdef _SC_T_IOV_MAX {"SC_T_IOV_MAX", _SC_T_IOV_MAX}, #endif #ifdef _SC_UCHAR_MAX {"SC_UCHAR_MAX", _SC_UCHAR_MAX}, #endif #ifdef _SC_UINT_MAX {"SC_UINT_MAX", _SC_UINT_MAX}, #endif #ifdef _SC_UIO_MAXIOV {"SC_UIO_MAXIOV", _SC_UIO_MAXIOV}, #endif #ifdef _SC_ULONG_MAX {"SC_ULONG_MAX", _SC_ULONG_MAX}, #endif #ifdef _SC_USHRT_MAX {"SC_USHRT_MAX", _SC_USHRT_MAX}, #endif #ifdef _SC_VERSION {"SC_VERSION", _SC_VERSION}, #endif #ifdef _SC_WORD_BIT {"SC_WORD_BIT", _SC_WORD_BIT}, #endif #ifdef _SC_XBS5_ILP32_OFF32 {"SC_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32}, #endif #ifdef _SC_XBS5_ILP32_OFFBIG {"SC_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG}, #endif #ifdef _SC_XBS5_LP64_OFF64 {"SC_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64}, #endif #ifdef _SC_XBS5_LPBIG_OFFBIG {"SC_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG}, #endif #ifdef _SC_XOPEN_CRYPT {"SC_XOPEN_CRYPT", _SC_XOPEN_CRYPT}, #endif #ifdef _SC_XOPEN_ENH_I18N {"SC_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N}, #endif #ifdef _SC_XOPEN_LEGACY {"SC_XOPEN_LEGACY", _SC_XOPEN_LEGACY}, #endif #ifdef _SC_XOPEN_REALTIME {"SC_XOPEN_REALTIME", _SC_XOPEN_REALTIME}, #endif #ifdef _SC_XOPEN_REALTIME_THREADS {"SC_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS}, #endif #ifdef _SC_XOPEN_SHM {"SC_XOPEN_SHM", _SC_XOPEN_SHM}, #endif #ifdef _SC_XOPEN_UNIX {"SC_XOPEN_UNIX", _SC_XOPEN_UNIX}, #endif #ifdef _SC_XOPEN_VERSION {"SC_XOPEN_VERSION", _SC_XOPEN_VERSION}, #endif #ifdef _SC_XOPEN_XCU_VERSION {"SC_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION}, #endif #ifdef _SC_XOPEN_XPG2 {"SC_XOPEN_XPG2", _SC_XOPEN_XPG2}, #endif #ifdef _SC_XOPEN_XPG3 {"SC_XOPEN_XPG3", _SC_XOPEN_XPG3}, #endif #ifdef _SC_XOPEN_XPG4 {"SC_XOPEN_XPG4", _SC_XOPEN_XPG4}, #endif }; static int conv_sysconf_confname(PyObject *arg, int *valuep) { return conv_confname(arg, valuep, posix_constants_sysconf, sizeof(posix_constants_sysconf) / sizeof(struct constdef)); } PyDoc_STRVAR(posix_sysconf__doc__, "sysconf(name) -> integer\n\n\ Return an integer-valued system configuration variable."); static PyObject * posix_sysconf(PyObject *self, PyObject *args) { PyObject *result = NULL; int name; if (PyArg_ParseTuple(args, "O&:sysconf", conv_sysconf_confname, &name)) { int value; errno = 0; value = sysconf(name); if (value == -1 && errno != 0) posix_error(); else result = PyInt_FromLong(value); } return result; } #endif /* This code is used to ensure that the tables of configuration value names * are in sorted order as required by conv_confname(), and also to build * the exported dictionaries that are used to publish information about the * names available on the host platform. * * Sorting the table at runtime ensures that the table is properly ordered * when used, even for platforms we're not able to test on. It also makes * it easier to add additional entries to the tables. */ static int cmp_constdefs(const void *v1, const void *v2) { const struct constdef *c1 = (const struct constdef *) v1; const struct constdef *c2 = (const struct constdef *) v2; return strcmp(c1->name, c2->name); } static int setup_confname_table(struct constdef *table, size_t tablesize, char *tablename, PyObject *module) { PyObject *d = NULL; size_t i; qsort(table, tablesize, sizeof(struct constdef), cmp_constdefs); d = PyDict_New(); if (d == NULL) return -1; for (i=0; i < tablesize; ++i) { PyObject *o = PyInt_FromLong(table[i].value); if (o == NULL || PyDict_SetItemString(d, table[i].name, o) == -1) { Py_XDECREF(o); Py_DECREF(d); return -1; } Py_DECREF(o); } return PyModule_AddObject(module, tablename, d); } /* Return -1 on failure, 0 on success. */ static int setup_confname_tables(PyObject *module) { #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) if (setup_confname_table(posix_constants_pathconf, sizeof(posix_constants_pathconf) / sizeof(struct constdef), "pathconf_names", module)) return -1; #endif #ifdef HAVE_CONFSTR if (setup_confname_table(posix_constants_confstr, sizeof(posix_constants_confstr) / sizeof(struct constdef), "confstr_names", module)) return -1; #endif #ifdef HAVE_SYSCONF if (setup_confname_table(posix_constants_sysconf, sizeof(posix_constants_sysconf) / sizeof(struct constdef), "sysconf_names", module)) return -1; #endif return 0; } PyDoc_STRVAR(posix_abort__doc__, "abort() -> does not return!\n\n\ Abort the interpreter immediately. This 'dumps core' or otherwise fails\n\ in the hardest way possible on the hosting operating system."); static PyObject * posix_abort(PyObject *self, PyObject *noargs) { abort(); /*NOTREACHED*/ Py_FatalError("abort() called from Python code didn't abort!"); return NULL; } #ifdef MS_WINDOWS PyDoc_STRVAR(win32_startfile__doc__, "startfile(filepath [, operation]) - Start a file with its associated\n\ application.\n\ \n\ When \"operation\" is not specified or \"open\", this acts like\n\ double-clicking the file in Explorer, or giving the file name as an\n\ argument to the DOS \"start\" command: the file is opened with whatever\n\ application (if any) its extension is associated.\n\ When another \"operation\" is given, it specifies what should be done with\n\ the file. A typical operation is \"print\".\n\ \n\ startfile returns as soon as the associated application is launched.\n\ There is no option to wait for the application to close, and no way\n\ to retrieve the application's exit status.\n\ \n\ The filepath is relative to the current directory. If you want to use\n\ an absolute path, make sure the first character is not a slash (\"/\");\n\ the underlying Win32 ShellExecute function doesn't work if it is."); static PyObject * win32_startfile(PyObject *self, PyObject *args) { char *filepath; Py_UNICODE *wpath; char *operation = NULL; HINSTANCE rc; PyObject *woperation = NULL; if (!PyArg_ParseTuple(args, "u|s:startfile", &wpath, &operation)) { PyErr_Clear(); goto normal; } if (operation) { woperation = PyUnicode_DecodeASCII(operation, strlen(operation), NULL); if (!woperation) { PyErr_Clear(); operation = NULL; goto normal; } } Py_BEGIN_ALLOW_THREADS rc = ShellExecuteW((HWND)0, woperation ? PyUnicode_AS_UNICODE(woperation) : 0, wpath, NULL, NULL, SW_SHOWNORMAL); Py_END_ALLOW_THREADS Py_XDECREF(woperation); if (rc <= (HINSTANCE)32) { PyObject *errval = win32_error_unicode("startfile", wpath); return errval; } Py_INCREF(Py_None); return Py_None; normal: if (!PyArg_ParseTuple(args, "et|s:startfile", Py_FileSystemDefaultEncoding, &filepath, &operation)) return NULL; Py_BEGIN_ALLOW_THREADS rc = ShellExecute((HWND)0, operation, filepath, NULL, NULL, SW_SHOWNORMAL); Py_END_ALLOW_THREADS if (rc <= (HINSTANCE)32) { PyObject *errval = win32_error("startfile", filepath); PyMem_Free(filepath); return errval; } PyMem_Free(filepath); Py_INCREF(Py_None); return Py_None; } #endif /* MS_WINDOWS */ #ifdef HAVE_GETLOADAVG PyDoc_STRVAR(posix_getloadavg__doc__, "getloadavg() -> (float, float, float)\n\n\ Return the number of processes in the system run queue averaged over\n\ the last 1, 5, and 15 minutes or raises OSError if the load average\n\ was unobtainable"); static PyObject * posix_getloadavg(PyObject *self, PyObject *noargs) { double loadavg[3]; if (getloadavg(loadavg, 3)!=3) { PyErr_SetString(PyExc_OSError, "Load averages are unobtainable"); return NULL; } else return Py_BuildValue("ddd", loadavg[0], loadavg[1], loadavg[2]); } #endif PyDoc_STRVAR(posix_urandom__doc__, "urandom(n) -> str\n\n\ Return n random bytes suitable for cryptographic use."); static PyObject * posix_urandom(PyObject *self, PyObject *args) { Py_ssize_t size; PyObject *result; int ret; /* Read arguments */ if (!PyArg_ParseTuple(args, "n:urandom", &size)) return NULL; if (size < 0) return PyErr_Format(PyExc_ValueError, "negative argument not allowed"); result = PyBytes_FromStringAndSize(NULL, size); if (result == NULL) return NULL; ret = _PyOS_URandom(PyBytes_AS_STRING(result), PyBytes_GET_SIZE(result)); if (ret == -1) { Py_DECREF(result); return NULL; } return result; } #ifdef HAVE_SETRESUID PyDoc_STRVAR(posix_setresuid__doc__, "setresuid(ruid, euid, suid)\n\n\ Set the current process's real, effective, and saved user ids."); static PyObject* posix_setresuid (PyObject *self, PyObject *args) { uid_t ruid, euid, suid; if (!PyArg_ParseTuple(args, "O&O&O&:setresuid", _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid, _Py_Uid_Converter, &suid)) return NULL; if (setresuid(ruid, euid, suid) < 0) return posix_error(); Py_RETURN_NONE; } #endif #ifdef HAVE_SETRESGID PyDoc_STRVAR(posix_setresgid__doc__, "setresgid(rgid, egid, sgid)\n\n\ Set the current process's real, effective, and saved group ids."); static PyObject* posix_setresgid (PyObject *self, PyObject *args) { gid_t rgid, egid, sgid; if (!PyArg_ParseTuple(args, "O&O&O&:setresgid", _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid, _Py_Gid_Converter, &sgid)) return NULL; if (setresgid(rgid, egid, sgid) < 0) return posix_error(); Py_RETURN_NONE; } #endif #ifdef HAVE_GETRESUID PyDoc_STRVAR(posix_getresuid__doc__, "getresuid() -> (ruid, euid, suid)\n\n\ Get tuple of the current process's real, effective, and saved user ids."); static PyObject* posix_getresuid (PyObject *self, PyObject *noargs) { uid_t ruid, euid, suid; if (getresuid(&ruid, &euid, &suid) < 0) return posix_error(); return Py_BuildValue("(NNN)", _PyInt_FromUid(ruid), _PyInt_FromUid(euid), _PyInt_FromUid(suid)); } #endif #ifdef HAVE_GETRESGID PyDoc_STRVAR(posix_getresgid__doc__, "getresgid() -> (rgid, egid, sgid)\n\n\ Get tuple of the current process's real, effective, and saved group ids."); static PyObject* posix_getresgid (PyObject *self, PyObject *noargs) { uid_t rgid, egid, sgid; if (getresgid(&rgid, &egid, &sgid) < 0) return posix_error(); return Py_BuildValue("(NNN)", _PyInt_FromGid(rgid), _PyInt_FromGid(egid), _PyInt_FromGid(sgid)); } #endif static PyMethodDef posix_methods[] = { {"access", posix_access, METH_VARARGS, posix_access__doc__}, #ifdef HAVE_TTYNAME {"ttyname", posix_ttyname, METH_VARARGS, posix_ttyname__doc__}, #endif {"chdir", posix_chdir, METH_VARARGS, posix_chdir__doc__}, #ifdef HAVE_CHFLAGS {"chflags", posix_chflags, METH_VARARGS, posix_chflags__doc__}, #endif /* HAVE_CHFLAGS */ {"chmod", posix_chmod, METH_VARARGS, posix_chmod__doc__}, #ifdef HAVE_FCHMOD {"fchmod", posix_fchmod, METH_VARARGS, posix_fchmod__doc__}, #endif /* HAVE_FCHMOD */ #ifdef HAVE_CHOWN {"chown", posix_chown, METH_VARARGS, posix_chown__doc__}, #endif /* HAVE_CHOWN */ #ifdef HAVE_LCHMOD {"lchmod", posix_lchmod, METH_VARARGS, posix_lchmod__doc__}, #endif /* HAVE_LCHMOD */ #ifdef HAVE_FCHOWN {"fchown", posix_fchown, METH_VARARGS, posix_fchown__doc__}, #endif /* HAVE_FCHOWN */ #ifdef HAVE_LCHFLAGS {"lchflags", posix_lchflags, METH_VARARGS, posix_lchflags__doc__}, #endif /* HAVE_LCHFLAGS */ #ifdef HAVE_LCHOWN {"lchown", posix_lchown, METH_VARARGS, posix_lchown__doc__}, #endif /* HAVE_LCHOWN */ #ifdef HAVE_CHROOT {"chroot", posix_chroot, METH_VARARGS, posix_chroot__doc__}, #endif #ifdef HAVE_CTERMID {"ctermid", posix_ctermid, METH_NOARGS, posix_ctermid__doc__}, #endif #ifdef HAVE_GETCWD {"getcwd", posix_getcwd, METH_NOARGS, posix_getcwd__doc__}, #ifdef Py_USING_UNICODE {"getcwdu", posix_getcwdu, METH_NOARGS, posix_getcwdu__doc__}, #endif #endif #ifdef HAVE_LINK {"link", posix_link, METH_VARARGS, posix_link__doc__}, #endif /* HAVE_LINK */ {"listdir", posix_listdir, METH_VARARGS, posix_listdir__doc__}, {"lstat", posix_lstat, METH_VARARGS, posix_lstat__doc__}, {"mkdir", posix_mkdir, METH_VARARGS, posix_mkdir__doc__}, #ifdef HAVE_NICE {"nice", posix_nice, METH_VARARGS, posix_nice__doc__}, #endif /* HAVE_NICE */ #ifdef HAVE_READLINK {"readlink", posix_readlink, METH_VARARGS, posix_readlink__doc__}, #endif /* HAVE_READLINK */ {"rename", posix_rename, METH_VARARGS, posix_rename__doc__}, {"rmdir", posix_rmdir, METH_VARARGS, posix_rmdir__doc__}, {"stat", posix_stat, METH_VARARGS, posix_stat__doc__}, {"stat_float_times", stat_float_times, METH_VARARGS, stat_float_times__doc__}, #ifdef HAVE_SYMLINK {"symlink", posix_symlink, METH_VARARGS, posix_symlink__doc__}, #endif /* HAVE_SYMLINK */ #ifdef HAVE_SYSTEM {"system", posix_system, METH_VARARGS, posix_system__doc__}, #endif {"umask", posix_umask, METH_VARARGS, posix_umask__doc__}, #ifdef HAVE_UNAME {"uname", posix_uname, METH_NOARGS, posix_uname__doc__}, #endif /* HAVE_UNAME */ {"unlink", posix_unlink, METH_VARARGS, posix_unlink__doc__}, {"remove", posix_unlink, METH_VARARGS, posix_remove__doc__}, {"utime", posix_utime, METH_VARARGS, posix_utime__doc__}, #ifdef HAVE_TIMES {"times", posix_times, METH_NOARGS, posix_times__doc__}, #endif /* HAVE_TIMES */ {"_exit", posix__exit, METH_VARARGS, posix__exit__doc__}, #ifdef HAVE_EXECV {"execv", posix_execv, METH_VARARGS, posix_execv__doc__}, {"execve", posix_execve, METH_VARARGS, posix_execve__doc__}, #endif /* HAVE_EXECV */ #ifdef HAVE_SPAWNV {"spawnv", posix_spawnv, METH_VARARGS, posix_spawnv__doc__}, {"spawnve", posix_spawnve, METH_VARARGS, posix_spawnve__doc__}, #if defined(PYOS_OS2) {"spawnvp", posix_spawnvp, METH_VARARGS, posix_spawnvp__doc__}, {"spawnvpe", posix_spawnvpe, METH_VARARGS, posix_spawnvpe__doc__}, #endif /* PYOS_OS2 */ #endif /* HAVE_SPAWNV */ #ifdef HAVE_FORK1 {"fork1", posix_fork1, METH_NOARGS, posix_fork1__doc__}, #endif /* HAVE_FORK1 */ #ifdef HAVE_FORK {"fork", posix_fork, METH_NOARGS, posix_fork__doc__}, #endif /* HAVE_FORK */ #if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX) {"openpty", posix_openpty, METH_NOARGS, posix_openpty__doc__}, #endif /* HAVE_OPENPTY || HAVE__GETPTY || HAVE_DEV_PTMX */ #ifdef HAVE_FORKPTY {"forkpty", posix_forkpty, METH_NOARGS, posix_forkpty__doc__}, #endif /* HAVE_FORKPTY */ #ifdef HAVE_GETEGID {"getegid", posix_getegid, METH_NOARGS, posix_getegid__doc__}, #endif /* HAVE_GETEGID */ #ifdef HAVE_GETEUID {"geteuid", posix_geteuid, METH_NOARGS, posix_geteuid__doc__}, #endif /* HAVE_GETEUID */ #ifdef HAVE_GETGID {"getgid", posix_getgid, METH_NOARGS, posix_getgid__doc__}, #endif /* HAVE_GETGID */ #ifdef HAVE_GETGROUPS {"getgroups", posix_getgroups, METH_NOARGS, posix_getgroups__doc__}, #endif {"getpid", posix_getpid, METH_NOARGS, posix_getpid__doc__}, #ifdef HAVE_GETPGRP {"getpgrp", posix_getpgrp, METH_NOARGS, posix_getpgrp__doc__}, #endif /* HAVE_GETPGRP */ #ifdef HAVE_GETPPID {"getppid", posix_getppid, METH_NOARGS, posix_getppid__doc__}, #endif /* HAVE_GETPPID */ #ifdef HAVE_GETUID {"getuid", posix_getuid, METH_NOARGS, posix_getuid__doc__}, #endif /* HAVE_GETUID */ #ifdef HAVE_GETLOGIN {"getlogin", posix_getlogin, METH_NOARGS, posix_getlogin__doc__}, #endif #ifdef HAVE_KILL {"kill", posix_kill, METH_VARARGS, posix_kill__doc__}, #endif /* HAVE_KILL */ #ifdef HAVE_KILLPG {"killpg", posix_killpg, METH_VARARGS, posix_killpg__doc__}, #endif /* HAVE_KILLPG */ #ifdef HAVE_PLOCK {"plock", posix_plock, METH_VARARGS, posix_plock__doc__}, #endif /* HAVE_PLOCK */ #ifdef HAVE_POPEN {"popen", posix_popen, METH_VARARGS, posix_popen__doc__}, #ifdef MS_WINDOWS {"popen2", win32_popen2, METH_VARARGS}, {"popen3", win32_popen3, METH_VARARGS}, {"popen4", win32_popen4, METH_VARARGS}, {"startfile", win32_startfile, METH_VARARGS, win32_startfile__doc__}, {"kill", win32_kill, METH_VARARGS, win32_kill__doc__}, #else #if defined(PYOS_OS2) && defined(PYCC_GCC) {"popen2", os2emx_popen2, METH_VARARGS}, {"popen3", os2emx_popen3, METH_VARARGS}, {"popen4", os2emx_popen4, METH_VARARGS}, #endif #endif #endif /* HAVE_POPEN */ #ifdef HAVE_SETUID {"setuid", posix_setuid, METH_VARARGS, posix_setuid__doc__}, #endif /* HAVE_SETUID */ #ifdef HAVE_SETEUID {"seteuid", posix_seteuid, METH_VARARGS, posix_seteuid__doc__}, #endif /* HAVE_SETEUID */ #ifdef HAVE_SETEGID {"setegid", posix_setegid, METH_VARARGS, posix_setegid__doc__}, #endif /* HAVE_SETEGID */ #ifdef HAVE_SETREUID {"setreuid", posix_setreuid, METH_VARARGS, posix_setreuid__doc__}, #endif /* HAVE_SETREUID */ #ifdef HAVE_SETREGID {"setregid", posix_setregid, METH_VARARGS, posix_setregid__doc__}, #endif /* HAVE_SETREGID */ #ifdef HAVE_SETGID {"setgid", posix_setgid, METH_VARARGS, posix_setgid__doc__}, #endif /* HAVE_SETGID */ #ifdef HAVE_SETGROUPS {"setgroups", posix_setgroups, METH_O, posix_setgroups__doc__}, #endif /* HAVE_SETGROUPS */ #ifdef HAVE_INITGROUPS {"initgroups", posix_initgroups, METH_VARARGS, posix_initgroups__doc__}, #endif /* HAVE_INITGROUPS */ #ifdef HAVE_GETPGID {"getpgid", posix_getpgid, METH_VARARGS, posix_getpgid__doc__}, #endif /* HAVE_GETPGID */ #ifdef HAVE_SETPGRP {"setpgrp", posix_setpgrp, METH_NOARGS, posix_setpgrp__doc__}, #endif /* HAVE_SETPGRP */ #ifdef HAVE_WAIT {"wait", posix_wait, METH_NOARGS, posix_wait__doc__}, #endif /* HAVE_WAIT */ #ifdef HAVE_WAIT3 {"wait3", posix_wait3, METH_VARARGS, posix_wait3__doc__}, #endif /* HAVE_WAIT3 */ #ifdef HAVE_WAIT4 {"wait4", posix_wait4, METH_VARARGS, posix_wait4__doc__}, #endif /* HAVE_WAIT4 */ #if defined(HAVE_WAITPID) || defined(HAVE_CWAIT) {"waitpid", posix_waitpid, METH_VARARGS, posix_waitpid__doc__}, #endif /* HAVE_WAITPID */ #ifdef HAVE_GETSID {"getsid", posix_getsid, METH_VARARGS, posix_getsid__doc__}, #endif /* HAVE_GETSID */ #ifdef HAVE_SETSID {"setsid", posix_setsid, METH_NOARGS, posix_setsid__doc__}, #endif /* HAVE_SETSID */ #ifdef HAVE_SETPGID {"setpgid", posix_setpgid, METH_VARARGS, posix_setpgid__doc__}, #endif /* HAVE_SETPGID */ #ifdef HAVE_TCGETPGRP {"tcgetpgrp", posix_tcgetpgrp, METH_VARARGS, posix_tcgetpgrp__doc__}, #endif /* HAVE_TCGETPGRP */ #ifdef HAVE_TCSETPGRP {"tcsetpgrp", posix_tcsetpgrp, METH_VARARGS, posix_tcsetpgrp__doc__}, #endif /* HAVE_TCSETPGRP */ {"open", posix_open, METH_VARARGS, posix_open__doc__}, {"close", posix_close_, METH_VARARGS, posix_close__doc__}, {"closerange", posix_closerange, METH_VARARGS, posix_closerange__doc__}, {"dup", posix_dup, METH_VARARGS, posix_dup__doc__}, {"dup2", posix_dup2, METH_VARARGS, posix_dup2__doc__}, {"lseek", posix_lseek, METH_VARARGS, posix_lseek__doc__}, {"read", posix_read, METH_VARARGS, posix_read__doc__}, {"write", posix_write, METH_VARARGS, posix_write__doc__}, {"fstat", posix_fstat, METH_VARARGS, posix_fstat__doc__}, {"fdopen", posix_fdopen, METH_VARARGS, posix_fdopen__doc__}, {"isatty", posix_isatty, METH_VARARGS, posix_isatty__doc__}, #ifdef HAVE_PIPE {"pipe", posix_pipe, METH_NOARGS, posix_pipe__doc__}, #endif #ifdef HAVE_MKFIFO {"mkfifo", posix_mkfifo, METH_VARARGS, posix_mkfifo__doc__}, #endif #if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV) {"mknod", posix_mknod, METH_VARARGS, posix_mknod__doc__}, #endif #ifdef HAVE_DEVICE_MACROS {"major", posix_major, METH_VARARGS, posix_major__doc__}, {"minor", posix_minor, METH_VARARGS, posix_minor__doc__}, {"makedev", posix_makedev, METH_VARARGS, posix_makedev__doc__}, #endif #ifdef HAVE_FTRUNCATE {"ftruncate", posix_ftruncate, METH_VARARGS, posix_ftruncate__doc__}, #endif #ifdef HAVE_PUTENV {"putenv", posix_putenv, METH_VARARGS, posix_putenv__doc__}, #endif #ifdef HAVE_UNSETENV {"unsetenv", posix_unsetenv, METH_VARARGS, posix_unsetenv__doc__}, #endif {"strerror", posix_strerror, METH_VARARGS, posix_strerror__doc__}, #ifdef HAVE_FCHDIR {"fchdir", posix_fchdir, METH_O, posix_fchdir__doc__}, #endif #ifdef HAVE_FSYNC {"fsync", posix_fsync, METH_O, posix_fsync__doc__}, #endif #ifdef HAVE_FDATASYNC {"fdatasync", posix_fdatasync, METH_O, posix_fdatasync__doc__}, #endif #ifdef HAVE_SYS_WAIT_H #ifdef WCOREDUMP {"WCOREDUMP", posix_WCOREDUMP, METH_VARARGS, posix_WCOREDUMP__doc__}, #endif /* WCOREDUMP */ #ifdef WIFCONTINUED {"WIFCONTINUED",posix_WIFCONTINUED, METH_VARARGS, posix_WIFCONTINUED__doc__}, #endif /* WIFCONTINUED */ #ifdef WIFSTOPPED {"WIFSTOPPED", posix_WIFSTOPPED, METH_VARARGS, posix_WIFSTOPPED__doc__}, #endif /* WIFSTOPPED */ #ifdef WIFSIGNALED {"WIFSIGNALED", posix_WIFSIGNALED, METH_VARARGS, posix_WIFSIGNALED__doc__}, #endif /* WIFSIGNALED */ #ifdef WIFEXITED {"WIFEXITED", posix_WIFEXITED, METH_VARARGS, posix_WIFEXITED__doc__}, #endif /* WIFEXITED */ #ifdef WEXITSTATUS {"WEXITSTATUS", posix_WEXITSTATUS, METH_VARARGS, posix_WEXITSTATUS__doc__}, #endif /* WEXITSTATUS */ #ifdef WTERMSIG {"WTERMSIG", posix_WTERMSIG, METH_VARARGS, posix_WTERMSIG__doc__}, #endif /* WTERMSIG */ #ifdef WSTOPSIG {"WSTOPSIG", posix_WSTOPSIG, METH_VARARGS, posix_WSTOPSIG__doc__}, #endif /* WSTOPSIG */ #endif /* HAVE_SYS_WAIT_H */ #if defined(HAVE_FSTATVFS) && defined(HAVE_SYS_STATVFS_H) {"fstatvfs", posix_fstatvfs, METH_VARARGS, posix_fstatvfs__doc__}, #endif #if defined(HAVE_STATVFS) && defined(HAVE_SYS_STATVFS_H) {"statvfs", posix_statvfs, METH_VARARGS, posix_statvfs__doc__}, #endif #ifdef HAVE_TMPFILE {"tmpfile", posix_tmpfile, METH_NOARGS, posix_tmpfile__doc__}, #endif #ifdef HAVE_TEMPNAM {"tempnam", posix_tempnam, METH_VARARGS, posix_tempnam__doc__}, #endif #ifdef HAVE_TMPNAM {"tmpnam", posix_tmpnam, METH_NOARGS, posix_tmpnam__doc__}, #endif #ifdef HAVE_CONFSTR {"confstr", posix_confstr, METH_VARARGS, posix_confstr__doc__}, #endif #ifdef HAVE_SYSCONF {"sysconf", posix_sysconf, METH_VARARGS, posix_sysconf__doc__}, #endif #ifdef HAVE_FPATHCONF {"fpathconf", posix_fpathconf, METH_VARARGS, posix_fpathconf__doc__}, #endif #ifdef HAVE_PATHCONF {"pathconf", posix_pathconf, METH_VARARGS, posix_pathconf__doc__}, #endif {"abort", posix_abort, METH_NOARGS, posix_abort__doc__}, #ifdef MS_WINDOWS {"_getfullpathname", posix__getfullpathname, METH_VARARGS, NULL}, {"_isdir", posix__isdir, METH_VARARGS, posix__isdir__doc__}, #endif #ifdef HAVE_GETLOADAVG {"getloadavg", posix_getloadavg, METH_NOARGS, posix_getloadavg__doc__}, #endif #ifdef HAVE_SETRESUID {"setresuid", posix_setresuid, METH_VARARGS, posix_setresuid__doc__}, #endif #ifdef HAVE_SETRESGID {"setresgid", posix_setresgid, METH_VARARGS, posix_setresgid__doc__}, #endif #ifdef HAVE_GETRESUID {"getresuid", posix_getresuid, METH_NOARGS, posix_getresuid__doc__}, #endif #ifdef HAVE_GETRESGID {"getresgid", posix_getresgid, METH_NOARGS, posix_getresgid__doc__}, #endif {"urandom", posix_urandom, METH_VARARGS, posix_urandom__doc__}, {NULL, NULL} /* Sentinel */ }; static int ins(PyObject *module, char *symbol, long value) { return PyModule_AddIntConstant(module, symbol, value); } #if defined(PYOS_OS2) /* Insert Platform-Specific Constant Values (Strings & Numbers) of Common Use */ static int insertvalues(PyObject *module) { APIRET rc; ULONG values[QSV_MAX+1]; PyObject *v; char *ver, tmp[50]; Py_BEGIN_ALLOW_THREADS rc = DosQuerySysInfo(1L, QSV_MAX, &values[1], sizeof(ULONG) * QSV_MAX); Py_END_ALLOW_THREADS if (rc != NO_ERROR) { os2_error(rc); return -1; } if (ins(module, "meminstalled", values[QSV_TOTPHYSMEM])) return -1; if (ins(module, "memkernel", values[QSV_TOTRESMEM])) return -1; if (ins(module, "memvirtual", values[QSV_TOTAVAILMEM])) return -1; if (ins(module, "maxpathlen", values[QSV_MAX_PATH_LENGTH])) return -1; if (ins(module, "maxnamelen", values[QSV_MAX_COMP_LENGTH])) return -1; if (ins(module, "revision", values[QSV_VERSION_REVISION])) return -1; if (ins(module, "timeslice", values[QSV_MIN_SLICE])) return -1; switch (values[QSV_VERSION_MINOR]) { case 0: ver = "2.00"; break; case 10: ver = "2.10"; break; case 11: ver = "2.11"; break; case 30: ver = "3.00"; break; case 40: ver = "4.00"; break; case 50: ver = "5.00"; break; default: PyOS_snprintf(tmp, sizeof(tmp), "%d-%d", values[QSV_VERSION_MAJOR], values[QSV_VERSION_MINOR]); ver = &tmp[0]; } /* Add Indicator of the Version of the Operating System */ if (PyModule_AddStringConstant(module, "version", tmp) < 0) return -1; /* Add Indicator of Which Drive was Used to Boot the System */ tmp[0] = 'A' + values[QSV_BOOT_DRIVE] - 1; tmp[1] = ':'; tmp[2] = '\0'; return PyModule_AddStringConstant(module, "bootdrive", tmp); } #endif static int all_ins(PyObject *d) { #ifdef F_OK if (ins(d, "F_OK", (long)F_OK)) return -1; #endif #ifdef R_OK if (ins(d, "R_OK", (long)R_OK)) return -1; #endif #ifdef W_OK if (ins(d, "W_OK", (long)W_OK)) return -1; #endif #ifdef X_OK if (ins(d, "X_OK", (long)X_OK)) return -1; #endif #ifdef NGROUPS_MAX if (ins(d, "NGROUPS_MAX", (long)NGROUPS_MAX)) return -1; #endif #ifdef TMP_MAX if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1; #endif #ifdef WCONTINUED if (ins(d, "WCONTINUED", (long)WCONTINUED)) return -1; #endif #ifdef WNOHANG if (ins(d, "WNOHANG", (long)WNOHANG)) return -1; #endif #ifdef WUNTRACED if (ins(d, "WUNTRACED", (long)WUNTRACED)) return -1; #endif #ifdef O_RDONLY if (ins(d, "O_RDONLY", (long)O_RDONLY)) return -1; #endif #ifdef O_WRONLY if (ins(d, "O_WRONLY", (long)O_WRONLY)) return -1; #endif #ifdef O_RDWR if (ins(d, "O_RDWR", (long)O_RDWR)) return -1; #endif #ifdef O_NDELAY if (ins(d, "O_NDELAY", (long)O_NDELAY)) return -1; #endif #ifdef O_NONBLOCK if (ins(d, "O_NONBLOCK", (long)O_NONBLOCK)) return -1; #endif #ifdef O_APPEND if (ins(d, "O_APPEND", (long)O_APPEND)) return -1; #endif #ifdef O_DSYNC if (ins(d, "O_DSYNC", (long)O_DSYNC)) return -1; #endif #ifdef O_RSYNC if (ins(d, "O_RSYNC", (long)O_RSYNC)) return -1; #endif #ifdef O_SYNC if (ins(d, "O_SYNC", (long)O_SYNC)) return -1; #endif #ifdef O_NOCTTY if (ins(d, "O_NOCTTY", (long)O_NOCTTY)) return -1; #endif #ifdef O_CREAT if (ins(d, "O_CREAT", (long)O_CREAT)) return -1; #endif #ifdef O_EXCL if (ins(d, "O_EXCL", (long)O_EXCL)) return -1; #endif #ifdef O_TRUNC if (ins(d, "O_TRUNC", (long)O_TRUNC)) return -1; #endif #ifdef O_BINARY if (ins(d, "O_BINARY", (long)O_BINARY)) return -1; #endif #ifdef O_TEXT if (ins(d, "O_TEXT", (long)O_TEXT)) return -1; #endif #ifdef O_LARGEFILE if (ins(d, "O_LARGEFILE", (long)O_LARGEFILE)) return -1; #endif #ifdef O_SHLOCK if (ins(d, "O_SHLOCK", (long)O_SHLOCK)) return -1; #endif #ifdef O_EXLOCK if (ins(d, "O_EXLOCK", (long)O_EXLOCK)) return -1; #endif /* MS Windows */ #ifdef O_NOINHERIT /* Don't inherit in child processes. */ if (ins(d, "O_NOINHERIT", (long)O_NOINHERIT)) return -1; #endif #ifdef _O_SHORT_LIVED /* Optimize for short life (keep in memory). */ /* MS forgot to define this one with a non-underscore form too. */ if (ins(d, "O_SHORT_LIVED", (long)_O_SHORT_LIVED)) return -1; #endif #ifdef O_TEMPORARY /* Automatically delete when last handle is closed. */ if (ins(d, "O_TEMPORARY", (long)O_TEMPORARY)) return -1; #endif #ifdef O_RANDOM /* Optimize for random access. */ if (ins(d, "O_RANDOM", (long)O_RANDOM)) return -1; #endif #ifdef O_SEQUENTIAL /* Optimize for sequential access. */ if (ins(d, "O_SEQUENTIAL", (long)O_SEQUENTIAL)) return -1; #endif /* GNU extensions. */ #ifdef O_ASYNC /* Send a SIGIO signal whenever input or output becomes available on file descriptor */ if (ins(d, "O_ASYNC", (long)O_ASYNC)) return -1; #endif #ifdef O_DIRECT /* Direct disk access. */ if (ins(d, "O_DIRECT", (long)O_DIRECT)) return -1; #endif #ifdef O_DIRECTORY /* Must be a directory. */ if (ins(d, "O_DIRECTORY", (long)O_DIRECTORY)) return -1; #endif #ifdef O_NOFOLLOW /* Do not follow links. */ if (ins(d, "O_NOFOLLOW", (long)O_NOFOLLOW)) return -1; #endif #ifdef O_NOATIME /* Do not update the access time. */ if (ins(d, "O_NOATIME", (long)O_NOATIME)) return -1; #endif /* These come from sysexits.h */ #ifdef EX_OK if (ins(d, "EX_OK", (long)EX_OK)) return -1; #endif /* EX_OK */ #ifdef EX_USAGE if (ins(d, "EX_USAGE", (long)EX_USAGE)) return -1; #endif /* EX_USAGE */ #ifdef EX_DATAERR if (ins(d, "EX_DATAERR", (long)EX_DATAERR)) return -1; #endif /* EX_DATAERR */ #ifdef EX_NOINPUT if (ins(d, "EX_NOINPUT", (long)EX_NOINPUT)) return -1; #endif /* EX_NOINPUT */ #ifdef EX_NOUSER if (ins(d, "EX_NOUSER", (long)EX_NOUSER)) return -1; #endif /* EX_NOUSER */ #ifdef EX_NOHOST if (ins(d, "EX_NOHOST", (long)EX_NOHOST)) return -1; #endif /* EX_NOHOST */ #ifdef EX_UNAVAILABLE if (ins(d, "EX_UNAVAILABLE", (long)EX_UNAVAILABLE)) return -1; #endif /* EX_UNAVAILABLE */ #ifdef EX_SOFTWARE if (ins(d, "EX_SOFTWARE", (long)EX_SOFTWARE)) return -1; #endif /* EX_SOFTWARE */ #ifdef EX_OSERR if (ins(d, "EX_OSERR", (long)EX_OSERR)) return -1; #endif /* EX_OSERR */ #ifdef EX_OSFILE if (ins(d, "EX_OSFILE", (long)EX_OSFILE)) return -1; #endif /* EX_OSFILE */ #ifdef EX_CANTCREAT if (ins(d, "EX_CANTCREAT", (long)EX_CANTCREAT)) return -1; #endif /* EX_CANTCREAT */ #ifdef EX_IOERR if (ins(d, "EX_IOERR", (long)EX_IOERR)) return -1; #endif /* EX_IOERR */ #ifdef EX_TEMPFAIL if (ins(d, "EX_TEMPFAIL", (long)EX_TEMPFAIL)) return -1; #endif /* EX_TEMPFAIL */ #ifdef EX_PROTOCOL if (ins(d, "EX_PROTOCOL", (long)EX_PROTOCOL)) return -1; #endif /* EX_PROTOCOL */ #ifdef EX_NOPERM if (ins(d, "EX_NOPERM", (long)EX_NOPERM)) return -1; #endif /* EX_NOPERM */ #ifdef EX_CONFIG if (ins(d, "EX_CONFIG", (long)EX_CONFIG)) return -1; #endif /* EX_CONFIG */ #ifdef EX_NOTFOUND if (ins(d, "EX_NOTFOUND", (long)EX_NOTFOUND)) return -1; #endif /* EX_NOTFOUND */ #ifdef HAVE_SPAWNV #if defined(PYOS_OS2) && defined(PYCC_GCC) if (ins(d, "P_WAIT", (long)P_WAIT)) return -1; if (ins(d, "P_NOWAIT", (long)P_NOWAIT)) return -1; if (ins(d, "P_OVERLAY", (long)P_OVERLAY)) return -1; if (ins(d, "P_DEBUG", (long)P_DEBUG)) return -1; if (ins(d, "P_SESSION", (long)P_SESSION)) return -1; if (ins(d, "P_DETACH", (long)P_DETACH)) return -1; if (ins(d, "P_PM", (long)P_PM)) return -1; if (ins(d, "P_DEFAULT", (long)P_DEFAULT)) return -1; if (ins(d, "P_MINIMIZE", (long)P_MINIMIZE)) return -1; if (ins(d, "P_MAXIMIZE", (long)P_MAXIMIZE)) return -1; if (ins(d, "P_FULLSCREEN", (long)P_FULLSCREEN)) return -1; if (ins(d, "P_WINDOWED", (long)P_WINDOWED)) return -1; if (ins(d, "P_FOREGROUND", (long)P_FOREGROUND)) return -1; if (ins(d, "P_BACKGROUND", (long)P_BACKGROUND)) return -1; if (ins(d, "P_NOCLOSE", (long)P_NOCLOSE)) return -1; if (ins(d, "P_NOSESSION", (long)P_NOSESSION)) return -1; if (ins(d, "P_QUOTE", (long)P_QUOTE)) return -1; if (ins(d, "P_TILDE", (long)P_TILDE)) return -1; if (ins(d, "P_UNRELATED", (long)P_UNRELATED)) return -1; if (ins(d, "P_DEBUGDESC", (long)P_DEBUGDESC)) return -1; #else if (ins(d, "P_WAIT", (long)_P_WAIT)) return -1; if (ins(d, "P_NOWAIT", (long)_P_NOWAIT)) return -1; if (ins(d, "P_OVERLAY", (long)_OLD_P_OVERLAY)) return -1; if (ins(d, "P_NOWAITO", (long)_P_NOWAITO)) return -1; if (ins(d, "P_DETACH", (long)_P_DETACH)) return -1; #endif #endif #if defined(PYOS_OS2) if (insertvalues(d)) return -1; #endif return 0; } #if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__) #define INITFUNC initnt #define MODNAME "nt" #elif defined(PYOS_OS2) #define INITFUNC initos2 #define MODNAME "os2" #else #define INITFUNC initposix #define MODNAME "posix" #endif PyMODINIT_FUNC INITFUNC(void) { PyObject *m, *v; m = Py_InitModule3(MODNAME, posix_methods, posix__doc__); if (m == NULL) return; /* Initialize environ dictionary */ v = convertenviron(); Py_XINCREF(v); if (v == NULL || PyModule_AddObject(m, "environ", v) != 0) return; Py_DECREF(v); if (all_ins(m)) return; if (setup_confname_tables(m)) return; Py_INCREF(PyExc_OSError); PyModule_AddObject(m, "error", PyExc_OSError); #ifdef HAVE_PUTENV if (posix_putenv_garbage == NULL) posix_putenv_garbage = PyDict_New(); #endif if (!initialized) { stat_result_desc.name = MODNAME ".stat_result"; stat_result_desc.fields[7].name = PyStructSequence_UnnamedField; stat_result_desc.fields[8].name = PyStructSequence_UnnamedField; stat_result_desc.fields[9].name = PyStructSequence_UnnamedField; PyStructSequence_InitType(&StatResultType, &stat_result_desc); structseq_new = StatResultType.tp_new; StatResultType.tp_new = statresult_new; statvfs_result_desc.name = MODNAME ".statvfs_result"; PyStructSequence_InitType(&StatVFSResultType, &statvfs_result_desc); #ifdef NEED_TICKS_PER_SECOND # if defined(HAVE_SYSCONF) && defined(_SC_CLK_TCK) ticks_per_second = sysconf(_SC_CLK_TCK); # elif defined(HZ) ticks_per_second = HZ; # else ticks_per_second = 60; /* magic fallback value; may be bogus */ # endif #endif } Py_INCREF((PyObject*) &StatResultType); PyModule_AddObject(m, "stat_result", (PyObject*) &StatResultType); Py_INCREF((PyObject*) &StatVFSResultType); PyModule_AddObject(m, "statvfs_result", (PyObject*) &StatVFSResultType); initialized = 1; #ifdef __APPLE__ /* * Step 2 of weak-linking support on Mac OS X. * * The code below removes functions that are not available on the * currently active platform. * * This block allow one to use a python binary that was build on * OSX 10.4 on OSX 10.3, without loosing access to new APIs on * OSX 10.4. */ #ifdef HAVE_FSTATVFS if (fstatvfs == NULL) { if (PyObject_DelAttrString(m, "fstatvfs") == -1) { return; } } #endif /* HAVE_FSTATVFS */ #ifdef HAVE_STATVFS if (statvfs == NULL) { if (PyObject_DelAttrString(m, "statvfs") == -1) { return; } } #endif /* HAVE_STATVFS */ # ifdef HAVE_LCHOWN if (lchown == NULL) { if (PyObject_DelAttrString(m, "lchown") == -1) { return; } } #endif /* HAVE_LCHOWN */ #endif /* __APPLE__ */ } #ifdef __cplusplus } #endif
365145fdb2b591cf6addf93f7ee8d6aa3c0c4842
c8b39acfd4a857dc15ed3375e0d93e75fa3f1f64
/Engine/Source/Editor/Matinee/Private/MatineeViewSaveData.h
cbd012f643b3da66b387d485aff8e5cd70aa1557
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
windystrife/UnrealEngine_NVIDIAGameWorks
c3c7863083653caf1bc67d3ef104fb4b9f302e2a
b50e6338a7c5b26374d66306ebc7807541ff815e
refs/heads/4.18-GameWorks
2023-03-11T02:50:08.471040
2022-01-13T20:50:29
2022-01-13T20:50:29
124,100,479
262
179
MIT
2022-12-16T05:36:38
2018-03-06T15:44:09
C++
UTF-8
C
false
false
323
h
MatineeViewSaveData.h
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" struct FMatineeViewSaveData { FMatineeViewSaveData() : ViewIndex( INDEX_NONE ) , ViewLocation( 0.0f, 0.0f, 0.0f ) , ViewRotation( 0, 0, 0) { } int32 ViewIndex; FVector ViewLocation; FRotator ViewRotation; };
dde9b843251d2331af0d217538a3163df36635b7
0744dcc5394cebf57ebcba343747af6871b67017
/os/board/rtl8721csm/src/component/soc/realtek/amebad/fwlib/include/rtl8721dlp_rcc.h
2ed834fee6f79c3f5ada4026fd4a563694a97e55
[ "GPL-1.0-or-later", "BSD-3-Clause", "ISC", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-permissive", "Apache-2.0" ]
permissive
Samsung/TizenRT
96abf62f1853f61fcf91ff14671a5e0c6ca48fdb
1a5c2e00a4b1bbf4c505bbf5cc6a8259e926f686
refs/heads/master
2023-08-31T08:59:33.327998
2023-08-08T06:09:20
2023-08-31T04:38:20
82,517,252
590
719
Apache-2.0
2023-09-14T06:54:49
2017-02-20T04:38:30
C
UTF-8
C
false
false
7,360
h
rtl8721dlp_rcc.h
/** ****************************************************************************** * @file rtl8721dlp_rcc.h * @author * @version V1.0.0 * @date 2016-05-17 * @brief This file contains all the functions prototypes for peripheral reset and clock control driver. ****************************************************************************** * @attention * * This module is a confidential and proprietary property of RealTek and * possession or use of this module requires written permission of RealTek. * * Copyright(c) 2015, Realtek Semiconductor Corporation. All rights reserved. ****************************************************************************** */ #ifndef _RTL8721D_LP_RCC_H_ #define _RTL8721D_LP_RCC_H_ /** @addtogroup AmebaD_Platform * @{ */ /** @defgroup RCC * @brief RCC driver modules * @{ */ /** @defgroup LP_RCC * @verbatim ***************************************************************************************** * Introduction ***************************************************************************************** * - functions prototypes for peripheral reset and clock control driver. * ***************************************************************************************** * ***************************************************************************************** * how to use ***************************************************************************************** * use UART0 as example: * RCC_PeriphClockCmd(APBPeriph_UART0, APBPeriph_UART0_CLOCK, ENABLE); * ***************************************************************************************** * @endverbatim */ /** @addtogroup LP_RCC * @brief LP_RCC driver modules * @{ */ /* Exported constants --------------------------------------------------------*/ /** @defgroup LP_RCC_CLK_Exported_Constants LP_RCC CLK Exported Constants * @{ */ #define SYS_CLK_CTRL0 0x00U //0x210 #define SYS_CLK_CTRL1 0x01U //0x214 #define SYS_CLK_CTRL2 0x02U //0x004 AON #define SYS_CLK_CTRL3 0x03U //TODO #define APBPeriph_CLOCK_NULL 0 //if you dont want to set any clock, you can use this #define APBPeriph_WLON_CLOCK (SYS_CLK_CTRL0 << 30 | BIT_LSYS_WLON_CKE) #define APBPeriph_FLASH_CLOCK (SYS_CLK_CTRL0 << 30 | BIT_FLASH_CKE) #define APBPeriph_GDMA0_CLOCK (SYS_CLK_CTRL0 << 30 | BIT_LSYS_GDMA0_CKE) #define APBPeriph_EFUSE_CLOCK (SYS_CLK_CTRL0 << 30 | BIT_SYSON_CK_EELDR_EN) #define APBPeriph_GPIO_CLOCK (SYS_CLK_CTRL1 << 30 | BIT_LSYS_GPIO0_CKE) #define APBPeriph_QDEC0_CLOCK (SYS_CLK_CTRL1 << 30 | BIT_LSYS_QDEC0_CKE) #define APBPeriph_SGPIO_CLOCK (SYS_CLK_CTRL1 << 30 | BIT_LSYS_SPGIO0_CKE) #define APBPeriph_I2C0_CLOCK (SYS_CLK_CTRL1 << 30 | BIT_LSYS_I2C0_CKE) #define APBPeriph_ADC_CLOCK (SYS_CLK_CTRL1 << 30 | BIT_LSYS_ADC_CKE) #define APBPeriph_UART1_CLOCK (SYS_CLK_CTRL1 << 30 | BIT_LSYS_UART1_CKE) #define APBPeriph_LOGUART_CLOCK (SYS_CLK_CTRL1 << 30 | BIT_LSYS_UART0_CKE) #define APBPeriph_GTIMER_CLOCK (SYS_CLK_CTRL1 << 30 | BIT_LSYS_TIMER0_CKE) #define APBPeriph_IPC_CLOCK (SYS_CLK_CTRL1 << 30 | BIT_LSYS_IPC_CKE) #define APBPeriph_VENDOR_REG_CLOCK (SYS_CLK_CTRL1 << 30 | BIT_VENDOR_CKE) #define APBPeriph_RTC_CLOCK (SYS_CLK_CTRL2 << 30 | BIT_AON_RTC_CKE) #define APBPeriph_CTOUCH_CLOCK (SYS_CLK_CTRL2 << 30 | BIT_AON_CTOUCH_CKE) #define APBPeriph_CK32KGEN_CLOCK (SYS_CLK_CTRL2 << 30 | BIT_AON_CK32KGEN_CKE) #define APBPeriph_KEYSCAN_CLOCK (SYS_CLK_CTRL2 << 30 | BIT_AON_KEYSCAN_CKE) #define APBPeriph_TSF_CLOCK (SYS_CLK_CTRL2 << 30 | BIT_AON_TSF_CKE) /* Switch SPIC clock using RCC_PeriphClockSource_SPIC(), don't use the following macro. Because SPIC has RCC_PeriphClockCmd has bug. */ #define APBPeriph_FLASH_CLOCK_ANA4M (SYS_CLK_CTRL0 << 30 | BIT_FLASH_CKE | BIT_SHIFT_FLASH_CLK_ANA4M) #define APBPeriph_FLASH_CLOCK_XTAL (SYS_CLK_CTRL0 << 30 | BIT_FLASH_CKE | BIT_SHIFT_FLASH_CLK_XTAL) #define APBPeriph_FLASH_CLOCK_PLL (SYS_CLK_CTRL0 << 30 | BIT_FLASH_CKE | BIT_SHIFT_FLASH_CLK_PLL) /** * @} */ /** @defgroup LP_RCC_FUNC_Exported_Constants LP_RCC FUNC Exported Constants * @{ */ #define SYS_FUNC_EN0 0x03U //0x208 #define SYS_FUNC_EN1 0x02U //0x20C #define SYS_FUNC_EN2 0x01U //0x004 AON #define SYS_FUNC_EN3 0x00U //TODO #define APBPeriph_NULL 0 //if you dont want to set any function, you can use this #define APBPeriph_WLON (SYS_FUNC_EN0 << 30 | BIT_LSYS_WLON_FEN) #define APBPeriph_FLASH (SYS_FUNC_EN0 << 30 | BIT_FLASH_FUN_EN) #define APBPeriph_GDMA0 (SYS_FUNC_EN0 << 30 | BIT_LSYS_GDMA0_FEN) #define APBPeriph_EFUSE (SYS_FUNC_EN0 << 30 | BIT_SYS_FEN_EELDR) #define APBPeriph_GPIO (SYS_FUNC_EN1 << 30 | BIT_LSYS_GPIO0_FEN) #define APBPeriph_QDEC0 (SYS_FUNC_EN1 << 30 | BIT_LSYS_QDEC0_FEN) #define APBPeriph_SGPIO (SYS_FUNC_EN1 << 30 | BIT_LSYS_SPGIO0_FEN) #define APBPeriph_I2C0 (SYS_FUNC_EN1 << 30 | BIT_LSYS_I2C0_FEN) #define APBPeriph_ADC (SYS_FUNC_EN1 << 30 | BIT_LSYS_ADC_FEN) #define APBPeriph_UART1 (SYS_FUNC_EN1 << 30 | BIT_LSYS_UART1_FEN_GLB | BIT_LSYS_UART1_FEN_FUN) #define APBPeriph_LOGUART (SYS_FUNC_EN1 << 30 | BIT_LSYS_UART0_FEN_GLB | BIT_LSYS_UART0_FEN_FUN) #define APBPeriph_GTIMER (SYS_FUNC_EN1 << 30 | BIT_LSYS_TIMER0_FEN) #define APBPeriph_IPC (SYS_FUNC_EN1 << 30 | BIT_LSYS_IPC_FEN) #define APBPeriph_VENDOR_REG (SYS_FUNC_EN1 << 30 | BIT_VENDOR_EN) #define APBPeriph_RTC (SYS_FUNC_EN2 << 30 | BIT_AON_RTC_FEN) #define APBPeriph_CTOUCH (SYS_FUNC_EN2 << 30 | BIT_AON_CTOUCH_FEN) #define APBPeriph_CK32KGEN (SYS_FUNC_EN2 << 30 | BIT_AON_CK32KGEN_FEN) #define APBPeriph_KEYSCAN (SYS_FUNC_EN2 << 30 | BIT_AON_KEYSCAN_FEN) #define APBPeriph_TSF (SYS_FUNC_EN2 << 30 | BIT_AON_TSF_FEN) /** * @} */ /* Exported functions --------------------------------------------------------*/ /** @defgroup LP_RCC_Exported_Functions LP_RCC Exported Functions * @{ */ _LONG_CALL_ void RCC_PeriphClockCmd(u32 APBPeriph, u32 APBPeriph_Clock, u8 NewState); _LONG_CALL_ void RCC_PeriphClockSource_RTC(u32 Xtal); _LONG_CALL_ void RCC_PeriphClockSource_I2C(UNUSED_WARN_DIS u32 Idx, u32 Source); _LONG_CALL_ void RCC_PeriphClockSource_QDEC(UNUSED_WARN_DIS u32 Idx, u32 Source); _LONG_CALL_ void RCC_PeriphClockSource_UART (UART_TypeDef* UARTx, u32 Source); /** * @brief Configure SPIC Clock. * @param Source: This parameter can be one of the following values: * @arg BIT_SHIFT_FLASH_CLK_ANA4M * @arg BIT_SHIFT_FLASH_CLK_XTAL * @arg BIT_SHIFT_FLASH_CLK_PLL * @retval None * @note Used to switch SPIC clock */ __STATIC_INLINE void RCC_PeriphClockSource_SPIC (u32 Source) { u32 Temp = 0; Temp = HAL_READ32(SYSTEM_CTRL_BASE_LP, REG_LP_CLK_CTRL0); Temp &= ~ (BIT_MASK_FLASH_CLK_SEL << BIT_SHIFT_FLASH_CLK_SEL); Temp |= Source; HAL_WRITE32(SYSTEM_CTRL_BASE_LP, REG_LP_CLK_CTRL0, Temp); } /** * @} */ /** * @} */ /** * @} */ /** * @} */ /* Registers Definitions --------------------------------------------------------*/ /* Other definations --------------------------------------------------------*/ #endif /* _RTL8721D_LP_RCC_H_ */ /******************* (C) COPYRIGHT 2016 Realtek Semiconductor *****END OF FILE****/
3593616420013fbf62f89f7286ab04eda1d4c0f6
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
/sys/external/bsd/compiler_rt/dist/lib/profile/GCDAProfiling.c
9bcdccb65e214998f8b142cec3cbe2b4de615471
[ "NCSA", "MIT" ]
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
15,043
c
GCDAProfiling.c
/*===- GCDAProfiling.c - Support library for GCDA file emission -----------===*\ |* |* The LLVM Compiler Infrastructure |* |* This file is distributed under the University of Illinois Open Source |* License. See LICENSE.TXT for details. |* |*===----------------------------------------------------------------------===*| |* |* This file implements the call back routines for the gcov profiling |* instrumentation pass. Link against this library when running code through |* the -insert-gcov-profiling LLVM pass. |* |* We emit files in a corrupt version of GCOV's "gcda" file format. These files |* are only close enough that LCOV will happily parse them. Anything that lcov |* ignores is missing. |* |* TODO: gcov is multi-process safe by having each exit open the existing file |* and append to it. We'd like to achieve that and be thread-safe too. |* \*===----------------------------------------------------------------------===*/ #ifdef _LIBC #include "namespace.h" #endif #include "InstrProfilingUtil.h" #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #if defined(_WIN32) #include "WindowsMMap.h" #else #include <sys/mman.h> #include <sys/file.h> #endif #if defined(__FreeBSD__) && defined(__i386__) #define I386_FREEBSD 1 #else #define I386_FREEBSD 0 #endif #if !defined(_MSC_VER) && !I386_FREEBSD #include <stdint.h> #endif #if defined(_MSC_VER) typedef unsigned char uint8_t; typedef unsigned int uint32_t; typedef unsigned long long uint64_t; #elif I386_FREEBSD /* System headers define 'size_t' incorrectly on x64 FreeBSD (prior to * FreeBSD 10, r232261) when compiled in 32-bit mode. */ typedef unsigned char uint8_t; typedef unsigned int uint32_t; typedef unsigned long long uint64_t; #endif /* #define DEBUG_GCDAPROFILING */ /* * --- GCOV file format I/O primitives --- */ /* * The current file name we're outputting. Used primarily for error logging. */ static char *filename = NULL; /* * The current file we're outputting. */ static FILE *output_file = NULL; /* * Buffer that we write things into. */ #define WRITE_BUFFER_SIZE (128 * 1024) static char *write_buffer = NULL; static uint64_t cur_buffer_size = 0; static uint64_t cur_pos = 0; static uint64_t file_size = 0; static int new_file = 0; static int fd = -1; /* * A list of functions to write out the data. */ typedef void (*writeout_fn)(); struct writeout_fn_node { writeout_fn fn; struct writeout_fn_node *next; }; static struct writeout_fn_node *writeout_fn_head = NULL; static struct writeout_fn_node *writeout_fn_tail = NULL; /* * A list of flush functions that our __gcov_flush() function should call. */ typedef void (*flush_fn)(); struct flush_fn_node { flush_fn fn; struct flush_fn_node *next; }; static struct flush_fn_node *flush_fn_head = NULL; static struct flush_fn_node *flush_fn_tail = NULL; static void resize_write_buffer(uint64_t size) { if (!new_file) return; size += cur_pos; if (size <= cur_buffer_size) return; size = (size - 1) / WRITE_BUFFER_SIZE + 1; size *= WRITE_BUFFER_SIZE; write_buffer = realloc(write_buffer, size); cur_buffer_size = size; } static void write_bytes(const char *s, size_t len) { resize_write_buffer(len); memcpy(&write_buffer[cur_pos], s, len); cur_pos += len; } static void write_32bit_value(uint32_t i) { write_bytes((char*)&i, 4); } static void write_64bit_value(uint64_t i) { write_bytes((char*)&i, 8); } static uint32_t length_of_string(const char *s) { return (strlen(s) / 4) + 1; } static void write_string(const char *s) { uint32_t len = length_of_string(s); write_32bit_value(len); write_bytes(s, strlen(s)); write_bytes("\0\0\0\0", 4 - (strlen(s) % 4)); } static uint32_t read_32bit_value() { uint32_t val; if (new_file) return (uint32_t)-1; val = *(uint32_t*)&write_buffer[cur_pos]; cur_pos += 4; return val; } static uint64_t read_64bit_value() { uint64_t val; if (new_file) return (uint64_t)-1; val = *(uint64_t*)&write_buffer[cur_pos]; cur_pos += 8; return val; } static char *mangle_filename(const char *orig_filename) { char *new_filename; size_t filename_len, prefix_len; int prefix_strip; int level = 0; const char *fname, *ptr; const char *prefix = getenv("GCOV_PREFIX"); const char *prefix_strip_str = getenv("GCOV_PREFIX_STRIP"); if (prefix == NULL || prefix[0] == '\0') return strdup(orig_filename); if (prefix_strip_str) { prefix_strip = atoi(prefix_strip_str); /* Negative GCOV_PREFIX_STRIP values are ignored */ if (prefix_strip < 0) prefix_strip = 0; } else { prefix_strip = 0; } fname = orig_filename; for (level = 0, ptr = fname + 1; level < prefix_strip; ++ptr) { if (*ptr == '\0') break; if (*ptr != '/') continue; fname = ptr; ++level; } filename_len = strlen(fname); prefix_len = strlen(prefix); new_filename = malloc(prefix_len + 1 + filename_len + 1); memcpy(new_filename, prefix, prefix_len); if (prefix[prefix_len - 1] != '/') new_filename[prefix_len++] = '/'; memcpy(new_filename + prefix_len, fname, filename_len + 1); return new_filename; } static int map_file() { fseek(output_file, 0L, SEEK_END); file_size = ftell(output_file); /* A size of 0 is invalid to `mmap'. Return a fail here, but don't issue an * error message because it should "just work" for the user. */ if (file_size == 0) return -1; write_buffer = mmap(0, file_size, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0); if (write_buffer == (void *)-1) { int errnum = errno; fprintf(stderr, "profiling: %s: cannot map: %s\n", filename, strerror(errnum)); return -1; } return 0; } static void unmap_file() { if (msync(write_buffer, file_size, MS_SYNC) == -1) { int errnum = errno; fprintf(stderr, "profiling: %s: cannot msync: %s\n", filename, strerror(errnum)); } /* We explicitly ignore errors from unmapping because at this point the data * is written and we don't care. */ (void)munmap(write_buffer, file_size); write_buffer = NULL; file_size = 0; } /* * --- LLVM line counter API --- */ /* A file in this case is a translation unit. Each .o file built with line * profiling enabled will emit to a different file. Only one file may be * started at a time. */ void llvm_gcda_start_file(const char *orig_filename, const char version[4], uint32_t checksum) { const char *mode = "r+b"; filename = mangle_filename(orig_filename); /* Try just opening the file. */ new_file = 0; fd = open(filename, O_RDWR); if (fd == -1) { /* Try opening the file, creating it if necessary. */ new_file = 1; mode = "w+b"; fd = open(filename, O_RDWR | O_CREAT, 0644); if (fd == -1) { /* Try creating the directories first then opening the file. */ __llvm_profile_recursive_mkdir(filename); fd = open(filename, O_RDWR | O_CREAT, 0644); if (fd == -1) { /* Bah! It's hopeless. */ int errnum = errno; fprintf(stderr, "profiling: %s: cannot open: %s\n", filename, strerror(errnum)); return; } } } /* Try to flock the file to serialize concurrent processes writing out to the * same GCDA. This can fail if the filesystem doesn't support it, but in that * case we'll just carry on with the old racy behaviour and hope for the best. */ flock(fd, LOCK_EX); output_file = fdopen(fd, mode); /* Initialize the write buffer. */ write_buffer = NULL; cur_buffer_size = 0; cur_pos = 0; if (new_file) { resize_write_buffer(WRITE_BUFFER_SIZE); memset(write_buffer, 0, WRITE_BUFFER_SIZE); } else { if (map_file() == -1) { /* mmap failed, try to recover by clobbering */ new_file = 1; write_buffer = NULL; cur_buffer_size = 0; resize_write_buffer(WRITE_BUFFER_SIZE); memset(write_buffer, 0, WRITE_BUFFER_SIZE); } } /* gcda file, version, stamp checksum. */ write_bytes("adcg", 4); write_bytes(version, 4); write_32bit_value(checksum); #ifdef DEBUG_GCDAPROFILING fprintf(stderr, "llvmgcda: [%s]\n", orig_filename); #endif } /* Given an array of pointers to counters (counters), increment the n-th one, * where we're also given a pointer to n (predecessor). */ void llvm_gcda_increment_indirect_counter(uint32_t *predecessor, uint64_t **counters) { uint64_t *counter; uint32_t pred; pred = *predecessor; if (pred == 0xffffffff) return; counter = counters[pred]; /* Don't crash if the pred# is out of sync. This can happen due to threads, or because of a TODO in GCOVProfiling.cpp buildEdgeLookupTable(). */ if (counter) ++*counter; #ifdef DEBUG_GCDAPROFILING else fprintf(stderr, "llvmgcda: increment_indirect_counter counters=%08llx, pred=%u\n", *counter, *predecessor); #endif } void llvm_gcda_emit_function(uint32_t ident, const char *function_name, uint32_t func_checksum, uint8_t use_extra_checksum, uint32_t cfg_checksum) { uint32_t len = 2; if (use_extra_checksum) len++; #ifdef DEBUG_GCDAPROFILING fprintf(stderr, "llvmgcda: function id=0x%08x name=%s\n", ident, function_name ? function_name : "NULL"); #endif if (!output_file) return; /* function tag */ write_bytes("\0\0\0\1", 4); if (function_name) len += 1 + length_of_string(function_name); write_32bit_value(len); write_32bit_value(ident); write_32bit_value(func_checksum); if (use_extra_checksum) write_32bit_value(cfg_checksum); if (function_name) write_string(function_name); } void llvm_gcda_emit_arcs(uint32_t num_counters, uint64_t *counters) { uint32_t i; uint64_t *old_ctrs = NULL; uint32_t val = 0; uint64_t save_cur_pos = cur_pos; if (!output_file) return; val = read_32bit_value(); if (val != (uint32_t)-1) { /* There are counters present in the file. Merge them. */ if (val != 0x01a10000) { fprintf(stderr, "profiling: %s: cannot merge previous GCDA file: " "corrupt arc tag (0x%08x)\n", filename, val); return; } val = read_32bit_value(); if (val == (uint32_t)-1 || val / 2 != num_counters) { fprintf(stderr, "profiling: %s: cannot merge previous GCDA file: " "mismatched number of counters (%d)\n", filename, val); return; } old_ctrs = malloc(sizeof(uint64_t) * num_counters); for (i = 0; i < num_counters; ++i) old_ctrs[i] = read_64bit_value(); } cur_pos = save_cur_pos; /* Counter #1 (arcs) tag */ write_bytes("\0\0\xa1\1", 4); write_32bit_value(num_counters * 2); for (i = 0; i < num_counters; ++i) { counters[i] += (old_ctrs ? old_ctrs[i] : 0); write_64bit_value(counters[i]); } free(old_ctrs); #ifdef DEBUG_GCDAPROFILING fprintf(stderr, "llvmgcda: %u arcs\n", num_counters); for (i = 0; i < num_counters; ++i) fprintf(stderr, "llvmgcda: %llu\n", (unsigned long long)counters[i]); #endif } void llvm_gcda_summary_info() { const uint32_t obj_summary_len = 9; /* Length for gcov compatibility. */ uint32_t i; uint32_t runs = 1; uint32_t val = 0; uint64_t save_cur_pos = cur_pos; if (!output_file) return; val = read_32bit_value(); if (val != (uint32_t)-1) { /* There are counters present in the file. Merge them. */ if (val != 0xa1000000) { fprintf(stderr, "profiling: %s: cannot merge previous run count: " "corrupt object tag (0x%08x)\n", filename, val); return; } val = read_32bit_value(); /* length */ if (val != obj_summary_len) { fprintf(stderr, "profiling: %s: cannot merge previous run count: " "mismatched object length (%d)\n", filename, val); return; } read_32bit_value(); /* checksum, unused */ read_32bit_value(); /* num, unused */ runs += read_32bit_value(); /* Add previous run count to new counter. */ } cur_pos = save_cur_pos; /* Object summary tag */ write_bytes("\0\0\0\xa1", 4); write_32bit_value(obj_summary_len); write_32bit_value(0); /* checksum, unused */ write_32bit_value(0); /* num, unused */ write_32bit_value(runs); for (i = 3; i < obj_summary_len; ++i) write_32bit_value(0); /* Program summary tag */ write_bytes("\0\0\0\xa3", 4); /* tag indicates 1 program */ write_32bit_value(0); /* 0 length */ #ifdef DEBUG_GCDAPROFILING fprintf(stderr, "llvmgcda: %u runs\n", runs); #endif } void llvm_gcda_end_file() { /* Write out EOF record. */ if (output_file) { write_bytes("\0\0\0\0\0\0\0\0", 8); if (new_file) { fwrite(write_buffer, cur_pos, 1, output_file); free(write_buffer); } else { unmap_file(); } fclose(output_file); flock(fd, LOCK_UN); output_file = NULL; write_buffer = NULL; } free(filename); #ifdef DEBUG_GCDAPROFILING fprintf(stderr, "llvmgcda: -----\n"); #endif } void llvm_register_writeout_function(writeout_fn fn) { struct writeout_fn_node *new_node = malloc(sizeof(struct writeout_fn_node)); new_node->fn = fn; new_node->next = NULL; if (!writeout_fn_head) { writeout_fn_head = writeout_fn_tail = new_node; } else { writeout_fn_tail->next = new_node; writeout_fn_tail = new_node; } } void llvm_writeout_files() { struct writeout_fn_node *curr = writeout_fn_head; while (curr) { curr->fn(); curr = curr->next; } } void llvm_delete_writeout_function_list() { while (writeout_fn_head) { struct writeout_fn_node *node = writeout_fn_head; writeout_fn_head = writeout_fn_head->next; free(node); } writeout_fn_head = writeout_fn_tail = NULL; } void llvm_register_flush_function(flush_fn fn) { struct flush_fn_node *new_node = malloc(sizeof(struct flush_fn_node)); new_node->fn = fn; new_node->next = NULL; if (!flush_fn_head) { flush_fn_head = flush_fn_tail = new_node; } else { flush_fn_tail->next = new_node; flush_fn_tail = new_node; } } void __gcov_flush() { struct flush_fn_node *curr = flush_fn_head; while (curr) { curr->fn(); curr = curr->next; } } void llvm_delete_flush_function_list() { while (flush_fn_head) { struct flush_fn_node *node = flush_fn_head; flush_fn_head = flush_fn_head->next; free(node); } flush_fn_head = flush_fn_tail = NULL; } void llvm_gcov_init(writeout_fn wfn, flush_fn ffn) { static int atexit_ran = 0; if (wfn) llvm_register_writeout_function(wfn); if (ffn) llvm_register_flush_function(ffn); if (atexit_ran == 0) { atexit_ran = 1; /* Make sure we write out the data and delete the data structures. */ atexit(llvm_delete_flush_function_list); atexit(llvm_delete_writeout_function_list); atexit(llvm_writeout_files); } }
87816212432e267cdca5feeaa02780948711caee
e1cddfd754d952134e72dfd03522c5ea4fb6008e
/src/plugins/srv6-mobile/gtp6_d.c
79549276c2cfcdd9bc38e260421d870816b1c451
[ "Apache-2.0" ]
permissive
FDio/vpp
0ad30fa1bec2975ffa6b66b45c9f4f32163123b6
f234b0d4626d7e686422cc9dfd25958584f4931e
refs/heads/master
2023-08-31T16:09:04.068646
2022-03-14T09:49:15
2023-08-31T09:50:00
96,556,718
1,048
630
Apache-2.0
2023-06-21T05:39:17
2017-07-07T16:29:40
C
UTF-8
C
false
false
6,780
c
gtp6_d.c
/* * srv6_end_m_gtp6_d.c * * Copyright (c) 2019 Arrcus Inc and/or its affiliates. * 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 <vnet/vnet.h> #include <vnet/adj/adj.h> #include <vnet/plugin/plugin.h> #include <vpp/app/version.h> #include <srv6-mobile/mobile.h> srv6_end_main_v6_decap_t srv6_end_main_v6_decap; static void clb_dpo_lock_srv6_end_m_gtp6_d (dpo_id_t * dpo) { } static void clb_dpo_unlock_srv6_end_m_gtp6_d (dpo_id_t * dpo) { } static u8 * clb_dpo_format_srv6_end_m_gtp6_d (u8 * s, va_list * args) { index_t index = va_arg (*args, index_t); CLIB_UNUSED (u32 indent) = va_arg (*args, u32); return (format (s, "SR: dynamic_proxy_index:[%u]", index)); } const static dpo_vft_t dpo_vft = { .dv_lock = clb_dpo_lock_srv6_end_m_gtp6_d, .dv_unlock = clb_dpo_unlock_srv6_end_m_gtp6_d, .dv_format = clb_dpo_format_srv6_end_m_gtp6_d, }; const static char *const srv6_end_m_gtp6_d_nodes[] = { "srv6-end-m-gtp6-d", NULL, }; const static char *const *const dpo_nodes[DPO_PROTO_NUM] = { [DPO_PROTO_IP6] = srv6_end_m_gtp6_d_nodes, }; static u8 fn_name[] = "SRv6-End.M.GTP6.D-plugin"; static u8 keyword_str[] = "end.m.gtp6.d"; static u8 def_str[] = "Endpoint function with dencapsulation for IPv6/GTP tunnel"; static u8 param_str[] = "<sr-prefix>/<sr-prefixlen> [nhtype <nhtype>] fib-table <id>"; static u8 * clb_format_srv6_end_m_gtp6_d (u8 * s, va_list * args) { srv6_end_gtp6_d_param_t *ls_mem = va_arg (*args, void *); s = format (s, "SRv6 End gtp6.d\n\t"); s = format (s, "SR Prefix: %U/%d", format_ip6_address, &ls_mem->sr_prefix, ls_mem->sr_prefixlen); if (ls_mem->nhtype != SRV6_NHTYPE_NONE) { if (ls_mem->nhtype == SRV6_NHTYPE_IPV4) s = format (s, ", NHType IPv4"); else if (ls_mem->nhtype == SRV6_NHTYPE_IPV6) s = format (s, ", NHType IPv6"); else if (ls_mem->nhtype == SRV6_NHTYPE_NON_IP) s = format (s, ", NHType Non-IP"); else s = format (s, ", NHType Unknow(%d)", ls_mem->nhtype); } s = format (s, " FIB table %d", ls_mem->fib_table); s = format (s, " Drop In %d", ls_mem->drop_in); return s; } static uword clb_unformat_srv6_end_m_gtp6_d (unformat_input_t * input, va_list * args) { void **plugin_mem_p = va_arg (*args, void **); srv6_end_gtp6_d_param_t *ls_mem; ip6_address_t sr_prefix; u32 sr_prefixlen; u8 nhtype = SRV6_NHTYPE_NONE; bool drop_in = false; bool config = false; u32 fib_table = 0; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "end.m.gtp6.d %U/%d nh-type ipv4 fib-table %d", unformat_ip6_address, &sr_prefix, &sr_prefixlen, &fib_table)) { config = true; nhtype = SRV6_NHTYPE_IPV4; } else if (unformat (input, "end.m.gtp6.d %U/%d nh-type ipv6 fib-table %d", unformat_ip6_address, &sr_prefix, &sr_prefixlen, &fib_table)) { config = true; nhtype = SRV6_NHTYPE_IPV6; } else if (unformat (input, "end.m.gtp6.d %U/%d nh-type none", unformat_ip6_address, &sr_prefix, &sr_prefixlen)) { config = true; nhtype = SRV6_NHTYPE_NON_IP; } else if (unformat (input, "end.m.gtp6.d %U/%d fib-table %d", unformat_ip6_address, &sr_prefix, &sr_prefixlen, &fib_table)) { config = true; nhtype = SRV6_NHTYPE_NONE; } else if (unformat (input, "drop-in")) { drop_in = true; } else { return 0; } } if (!config) { return 0; } ls_mem = clib_mem_alloc (sizeof *ls_mem); clib_memset (ls_mem, 0, sizeof *ls_mem); *plugin_mem_p = ls_mem; ls_mem->sr_prefix = sr_prefix; ls_mem->sr_prefixlen = sr_prefixlen; ls_mem->nhtype = nhtype; ls_mem->drop_in = drop_in; ls_mem->fib_table = fib_table; ls_mem->fib4_index = ip4_fib_index_from_table_id (fib_table); ls_mem->fib6_index = ip6_fib_index_from_table_id (fib_table); return 1; } static int clb_creation_srv6_end_m_gtp6_d (ip6_sr_localsid_t * localsid) { return 0; } static int clb_creation_srv6_end_m_gtp6_d_2 (ip6_sr_policy_t *sr_policy) { return 0; } static int clb_removal_srv6_end_m_gtp6_d (ip6_sr_localsid_t * localsid) { srv6_end_gtp6_d_param_t *ls_mem; ls_mem = localsid->plugin_mem; clib_mem_free (ls_mem); return 0; } static int clb_removal_srv6_end_m_gtp6_d_2 (ip6_sr_policy_t *sr_policy) { srv6_end_gtp6_d_param_t *ls_mem; ls_mem = sr_policy->plugin_mem; clib_mem_free (ls_mem); return 0; } static clib_error_t * srv6_end_m_gtp6_d_init (vlib_main_t * vm) { srv6_end_main_v6_decap_t *sm = &srv6_end_main_v6_decap; ip6_header_t *ip6; dpo_type_t dpo_type; vlib_node_t *node; int rc; sm->vlib_main = vm; sm->vnet_main = vnet_get_main (); node = vlib_get_node_by_name (vm, (u8 *) "srv6-end-m-gtp6-d"); sm->end_m_gtp6_d_node_index = node->index; node = vlib_get_node_by_name (vm, (u8 *) "error-drop"); sm->error_node_index = node->index; ip6 = &sm->cache_hdr; clib_memset_u8 (ip6, 0, sizeof (ip6_header_t)); // IPv6 header (default) ip6->ip_version_traffic_class_and_flow_label = 0x60; ip6->hop_limit = 64; ip6->protocol = IP_PROTOCOL_IPV6; dpo_type = dpo_register_new_type (&dpo_vft, dpo_nodes); rc = sr_localsid_register_function (vm, fn_name, keyword_str, def_str, param_str, 128, //prefix len &dpo_type, clb_format_srv6_end_m_gtp6_d, clb_unformat_srv6_end_m_gtp6_d, clb_creation_srv6_end_m_gtp6_d, clb_removal_srv6_end_m_gtp6_d); if (rc < 0) clib_error_return (0, "SRv6 Endpoint GTP6.D LocalSID function" "couldn't be registered"); rc = sr_policy_register_function ( vm, fn_name, keyword_str, def_str, param_str, 128, // prefix len &dpo_type, clb_format_srv6_end_m_gtp6_d, clb_unformat_srv6_end_m_gtp6_d, clb_creation_srv6_end_m_gtp6_d_2, clb_removal_srv6_end_m_gtp6_d_2); if (rc < 0) clib_error_return (0, "SRv6 GTP6.D Steering function" "couldn't be registered"); return 0; } /* *INDENT-OFF* */ VNET_FEATURE_INIT (srv6_end_m_gtp6_d, static) = { .arc_name = "ip6-unicast", .node_name = "srv6-end-m-gtp6-d", .runs_before = 0, }; VLIB_INIT_FUNCTION (srv6_end_m_gtp6_d_init); /* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */
3a343dcda0e9a5c14575f3b08ef5510bdd47a336
d29af0b8935a3690c00dcb7d81c8dbfdb71ecef2
/src/core/VerifyFormat.h
da4da18264243d31ba8f9cdd3f88bfc31dd6392c
[ "Artistic-2.0", "MIT" ]
permissive
pwsafe/pwsafe
fde24362cb54f1266feb83348e880f65a90b5ff9
0a4a8870b040eebed63907be6fbf2222fef096b3
refs/heads/master
2023-08-08T17:14:38.584897
2023-07-17T00:12:48
2023-08-07T09:32:17
40,989,540
713
197
NOASSERTION
2023-09-06T12:44:11
2015-08-18T18:16:11
C++
UTF-8
C
false
false
1,603
h
VerifyFormat.h
/* * Copyright (c) 2003-2023 Rony Shapiro <ronys@pwsafe.org>. * All rights reserved. Use of the code is allowed under the * Artistic License 2.0 terms, as specified in the LICENSE file * distributed with this code, or available from * http://www.opensource.org/licenses/artistic-license-2.0.php */ #ifndef __VERIFYFORMAT_H #define __VERIFYFORMAT_H // VerifyFormat.h //----------------------------------------------------------------------------- #include "StringX.h" #include "PwsPlatform.h" #include "os/typedefs.h" // Verify PWHistory String return codes enum {PWH_OK = 0, PWH_IGNORE, PWH_INVALID_HDR, PWH_INVALID_STATUS, PWH_INVALID_NUM, PWH_INVALID_DATETIME, PWH_PSWD_LENGTH_NOTHEX, PWH_INVALID_PSWD_LENGTH, PWH_TOO_SHORT, PWH_TOO_LONG, PWH_INVALID_FIELD_LENGTH, PWH_INVALID_CHARACTER}; bool VerifyASCDateTimeString(const stringT &time_str, time_t &t); bool VerifyXMLDateTimeString(const stringT &time_str, time_t &t); bool VerifyXMLDateString(const stringT &time_str, time_t &t); bool VerifyImportDateTimeString(const stringT &time_str, time_t &t); int VerifyTextImportPWHistoryString(const StringX &PWHistory, StringX &newPWHistory, stringT &strErrors); int VerifyXMLImportPWHistoryString(const StringX &PWHistory, StringX &newPWHistory, stringT &strErrors); bool verifyDTvalues(int yyyy, int mon, int dd, int hh, int min, int ss); #endif /* __VERIFYFORMAT_H */ //----------------------------------------------------------------------------- // Local variables: // mode: c++ // End:
d4cb3e91af768b4b8ff3c87a5b0373b9c87450a1
caa3fd7b505b9f374d67716d838fc9657135f06d
/libgo/misc/cgo/test/issue8811.c
41b3c7c8ea3e62e9005f976273e3fed287a64fc2
[ "LicenseRef-scancode-google-patent-license-golang", "BSD-3-Clause", "LicenseRef-scancode-generic-cla" ]
permissive
golang/gofrontend
674700d5e4682daf09e3f27be4e0f2844c0e1dd2
d04b024021bb7dbaa434a6d902bd12beb08e315f
refs/heads/master
2023-08-18T00:26:59.887760
2023-07-20T18:21:13
2023-07-20T19:28:09
28,939,900
874
155
BSD-3-Clause
2023-07-26T00:00:24
2015-01-07T23:54:58
Go
UTF-8
C
false
false
216
c
issue8811.c
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. int issue8811Initialized = 0; void issue8811Init() { }
ec6e4473f270edc9a5f5d9c995c6801f304cafb9
06f183c47dcc99aa5a7c1eb9e907b254f8d85996
/K-File-IO/io_demo/io_tools.c
46024d44657874ae99688acd9d1c956170b808d2
[]
no_license
cs3157/recitations
12ff0de6e820c164577052cd5e489bd1c251f2a0
a815e6900e2eb3d5209b989cfaf3a1c054d571ec
refs/heads/master
2023-08-28T18:24:19.605266
2022-09-12T14:59:00
2022-09-12T14:59:00
7,848,510
310
253
null
2022-08-07T18:01:14
2013-01-27T05:18:04
C
UTF-8
C
false
false
262
c
io_tools.c
#include <stdio.h> #include "io_tools.h" void print_test_name(const char *test_name) { for (int i = 0; i < 20; ++i) { printf("-"); } printf("%s", test_name); for (int i = 0; i < 20; ++i) { printf("-"); } printf("\n"); }
2c1d6ea48091dba8e741aa71fa4e8f0b48785771
aa3befea459382dc5c01c925653d54f435b3fb0f
/arch/sparc/src/s698pm/s698pm_tim_lowerhalf.c
bdce6920331d4c8727301e8407b38e9561472303
[ "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
13,949
c
s698pm_tim_lowerhalf.c
/**************************************************************************** * arch/sparc/src/s698pm/s698pm_tim_lowerhalf.c * * 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. * ****************************************************************************/ /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> #include <sys/types.h> #include <stdint.h> #include <string.h> #include <errno.h> #include <nuttx/irq.h> #include <nuttx/timers/timer.h> #include <arch/board/board.h> #include "s698pm_tim.h" #if defined(CONFIG_TIMER) && \ (defined(CONFIG_S698PM_TIM1) || defined(CONFIG_S698PM_TIM2)) || \ defined(CONFIG_S698PM_TIM3) || defined(CONFIG_S698PM_TIM4)) /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ #define S698PM_TIM1_RES 32 #define S698PM_TIM2_RES 32 #define S698PM_TIM3_RES 32 #define S698PM_TIM4_RES 32 /**************************************************************************** * Private Types ****************************************************************************/ /* This structure provides the private representation of the "lower-half" * driver state structure. This structure must be cast-compatible with the * timer_lowerhalf_s structure. */ struct s698pm_lowerhalf_s { const struct timer_ops_s *ops; /* Lower half operations */ struct s698pm_tim_dev_s *tim; /* stm32 timer driver */ tccb_t callback; /* Current upper half interrupt * callback */ void *arg; /* Argument passed to upper half * callback */ bool started; /* True: Timer has been started */ const uint8_t resolution; /* Number of bits in the timer * (16 or 32 bits) */ }; /**************************************************************************** * Private Function Prototypes ****************************************************************************/ /* Interrupt handling *******************************************************/ static int s698pm_timer_handler(int irq, void *context, void *arg); /* "Lower half" driver methods **********************************************/ static int s698pm_start(struct timer_lowerhalf_s *lower); static int s698pm_stop(struct timer_lowerhalf_s *lower); static int s698pm_getstatus(struct timer_lowerhalf_s *lower, struct timer_status_s *status); static int s698pm_settimeout(struct timer_lowerhalf_s *lower, uint32_t timeout); static void s698pm_setcallback(struct timer_lowerhalf_s *lower, tccb_t callback, void *arg); /**************************************************************************** * Private Data ****************************************************************************/ /* "Lower half" driver methods */ static const struct timer_ops_s g_timer_ops = { .start = s698pm_start, .stop = s698pm_stop, .getstatus = s698pm_getstatus, .settimeout = s698pm_settimeout, .setcallback = s698pm_setcallback, .ioctl = NULL, }; #ifdef CONFIG_S698PM_TIM1 static struct s698pm_lowerhalf_s g_tim1_lowerhalf = { .ops = &g_timer_ops, .resolution = S698PM_TIM1_RES, }; #endif #ifdef CONFIG_S698PM_TIM2 static struct s698pm_lowerhalf_s g_tim2_lowerhalf = { .ops = &g_timer_ops, .resolution = S698PM_TIM2_RES, }; #endif #ifdef CONFIG_S698PM_TIM3 static struct s698pm_lowerhalf_s g_tim3_lowerhalf = { .ops = &g_timer_ops, .resolution = S698PM_TIM3_RES, }; #endif #ifdef CONFIG_S698PM_TIM4 static struct s698pm_lowerhalf_s g_tim4_lowerhalf = { .ops = &g_timer_ops, .resolution = S698PM_TIM4_RES, }; #endif /**************************************************************************** * Private Functions ****************************************************************************/ /**************************************************************************** * Name: s698pm_timer_handler * * Description: * timer interrupt handler * * Input Parameters: * * Returned Value: * ****************************************************************************/ static int s698pm_timer_handler(int irq, void *context, void *arg) { struct s698pm_lowerhalf_s *lower = (struct s698pm_lowerhalf_s *)arg; uint32_t next_interval_us = 0; S698PM_TIM_ACKINT(lower->tim, 0); if (lower->callback(&next_interval_us, lower->arg)) { if (next_interval_us > 0) { S698PM_TIM_SETPERIOD(lower->tim, next_interval_us); } } else { s698pm_stop((struct timer_lowerhalf_s *)lower); } return OK; } /**************************************************************************** * Name: s698pm_start * * Description: * Start the timer, resetting the time to the current timeout, * * Input Parameters: * lower- A pointer the publicly visible representation of the "lower-half" * driver state structure. * * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ static int s698pm_start(struct timer_lowerhalf_s *lower) { struct s698pm_lowerhalf_s *priv = (struct s698pm_lowerhalf_s *)lower; if (!priv->started) { S698PM_TIM_SETMODE(priv->tim, S698PM_TIM_MODE_DOWN); if (priv->callback != NULL) { S698PM_TIM_SETISR(priv->tim, s698pm_timer_handler, priv, 0); } priv->started = true; return OK; } /* Return EBUSY to indicate that the timer was already running */ return -EBUSY; } /**************************************************************************** * Name: s698pm_stop * * Description: * Stop the timer * * Input Parameters: * lower- A pointer the publicly visible representation of the "lower-half" * driver state structure. * * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ static int s698pm_stop(struct timer_lowerhalf_s *lower) { struct s698pm_lowerhalf_s *priv = (struct s698pm_lowerhalf_s *)lower; if (priv->started) { S698PM_TIM_SETMODE(priv->tim, S698PM_TIM_MODE_DISABLED); S698PM_TIM_SETISR(priv->tim, NULL, NULL, 0); priv->started = false; return OK; } /* Return ENODEV to indicate that the timer was not running */ return -ENODEV; } /**************************************************************************** * Name: s698pm_getstatus * * Description: * get timer status * * Input Parameters: * lower - A pointer the publicly visible representation of the "lower- * half" driver state structure. * status - The location to return the status information. * * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ static int s698pm_getstatus(struct timer_lowerhalf_s *lower, struct timer_status_s *status) { struct s698pm_lowerhalf_s *priv = (struct s698pm_lowerhalf_s *)lower; uint64_t maxtimeout; uint32_t timeout; uint32_t clock; uint32_t period; uint32_t clock_factor; DEBUGASSERT(priv); /* Return the status bit */ status->flags = 0; if (priv->started) { status->flags |= TCFLAGS_ACTIVE; } if (priv->callback) { status->flags |= TCFLAGS_HANDLER; } /* Get timeout */ maxtimeout = (1 << priv->resolution) - 1; clock = S698PM_TIM_GETCLOCK(priv->tim); period = S698PM_TIM_GETPERIOD(priv->tim); if (clock == 1000000) { timeout = period; } else { timeout = (maxtimeout * 1000000) / clock; } status->timeout = timeout; /* Get the time remaining until the timer expires (in microseconds) */ clock_factor = (clock == 1000000) ? 1 : (clock / 1000000); status->timeleft = (timeout - S698PM_TIM_GETCOUNTER(priv->tim)) * clock_factor; return OK; } /**************************************************************************** * Name: s698pm_settimeout * * Description: * Set a new timeout value (and reset the timer) * * Input Parameters: * lower- A pointer the publicly visible representation of the "lower-half" * driver state structure. * timeout - The new timeout value in microseconds. * * Returned Value: * Zero on success; a negated errno value on failure. * ****************************************************************************/ static int s698pm_settimeout(struct timer_lowerhalf_s *lower, uint32_t timeout) { struct s698pm_lowerhalf_s *priv = (struct s698pm_lowerhalf_s *)lower; uint64_t maxtimeout; if (priv->started) { return -EPERM; } maxtimeout = (1 << priv->resolution) - 1; if (timeout > maxtimeout) { uint64_t freq = (maxtimeout * 1000000) / timeout; S698PM_TIM_SETCLOCK(priv->tim, freq); S698PM_TIM_SETPERIOD(priv->tim, maxtimeout); } else { S698PM_TIM_SETCLOCK(priv->tim, 1000000); S698PM_TIM_SETPERIOD(priv->tim, timeout); } return OK; } /**************************************************************************** * Name: s698pm_sethandler * * Description: * Call this user provided timeout handler. * * Input Parameters: * lower- A pointer the publicly visible representation of the "lower-half" * driver state structure. * callback - The new timer expiration function pointer. If this * function pointer is NULL, then the reset-on-expiration * behavior is restored, * arg - Argument that will be provided in the callback * * Returned Value: * The previous timer expiration function pointer or NULL is there was * no previous function pointer. * ****************************************************************************/ static void s698pm_setcallback(struct timer_lowerhalf_s *lower, tccb_t callback, void *arg) { struct s698pm_lowerhalf_s *priv = (struct s698pm_lowerhalf_s *)lower; irqstate_t flags = enter_critical_section(); /* Save the new callback */ priv->callback = callback; priv->arg = arg; if (callback != NULL && priv->started) { S698PM_TIM_SETISR(priv->tim, s698pm_timer_handler, priv, 0); } else { S698PM_TIM_SETISR(priv->tim, NULL, NULL, 0); } leave_critical_section(flags); } /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** * Name: s698pm_timer_initialize * * Description: * Bind the configuration timer to a timer lower half instance and * register the timer drivers at 'devpath' * * Input Parameters: * devpath - The full path to the timer device. This should be of the * form /dev/timer0 * timer - the timer's number. * * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. * ****************************************************************************/ int s698pm_timer_initialize(const char *devpath, int timer) { struct s698pm_lowerhalf_s *lower; switch (timer) { #ifdef CONFIG_S698PM_TIM1 case 1: lower = &g_tim1_lowerhalf; break; #endif #ifdef CONFIG_S698PM_TIM2 case 2: lower = &g_tim2_lowerhalf; break; #endif #ifdef CONFIG_S698PM_TIM3 case 3: lower = &g_tim3_lowerhalf; break; #endif #ifdef CONFIG_S698PM_TIM4 case 4: lower = &g_tim4_lowerhalf; break; #endif default: return -ENODEV; } /* Initialize the elements of lower half state structure */ lower->started = false; lower->callback = NULL; lower->tim = s698pm_tim_init(timer); if (lower->tim == NULL) { return -EINVAL; } /* Register the timer driver as /dev/timerX. The returned value from * timer_register is a handle that could be used with timer_unregister(). * REVISIT: The returned handle is discard here. */ void *drvr = timer_register(devpath, (struct timer_lowerhalf_s *)lower); if (drvr == NULL) { /* The actual cause of the failure may have been a failure to allocate * perhaps a failure to register the timer driver (such as if the * 'depath' were not unique). We know here but we return EEXIST to * indicate the failure (implying the non-unique devpath). */ return -EEXIST; } return OK; } #endif /* CONFIG_TIMER */
ae106c7d09844f13a29d98e835ac566afe23e6f5
22506f26940deb3916b9a320e7d4485f2f58ecc1
/libass/ass_bitmap_engine.h
1644919f62c7144cf6013e04832f9a722dc28c24
[ "ISC" ]
permissive
libass/libass
92b865e13ccd897212960b57b1c68ab00a452d91
5c15c883a4783641f7e71a6a1f440209965eb64f
refs/heads/master
2023-09-04T20:40:39.928295
2023-08-06T01:57:20
2023-08-21T01:11:57
11,696,642
828
234
ISC
2023-09-05T21:52:57
2013-07-26T23:11:51
C
UTF-8
C
false
false
3,917
h
ass_bitmap_engine.h
/* * Copyright (C) 2021-2022 libass contributors * * This file is part of libass. * * 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. */ #ifndef LIBASS_BITMAP_ENGINE_H #define LIBASS_BITMAP_ENGINE_H #include <stddef.h> #include <stdint.h> struct segment; typedef void FillSolidTileFunc(uint8_t *buf, ptrdiff_t stride, int set); typedef void FillHalfplaneTileFunc(uint8_t *buf, ptrdiff_t stride, int32_t a, int32_t b, int64_t c, int32_t scale); typedef void FillGenericTileFunc(uint8_t *buf, ptrdiff_t stride, const struct segment *line, size_t n_lines, int winding); typedef void MergeTileFunc(uint8_t *buf, ptrdiff_t stride, const uint8_t *tile); typedef void BitmapBlendFunc(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src, ptrdiff_t src_stride, size_t width, size_t height); typedef void BitmapMulFunc(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src1, ptrdiff_t src1_stride, const uint8_t *src2, ptrdiff_t src2_stride, size_t width, size_t height); typedef void BeBlurFunc(uint8_t *buf, ptrdiff_t stride, size_t width, size_t height, uint16_t *tmp); // intermediate bitmaps represented as sets of verical stripes of int16_t[alignment / 2] typedef void Convert8to16Func(int16_t *dst, const uint8_t *src, ptrdiff_t src_stride, size_t width, size_t height); typedef void Convert16to8Func(uint8_t *dst, ptrdiff_t dst_stride, const int16_t *src, size_t width, size_t height); typedef void FilterFunc(int16_t *dst, const int16_t *src, size_t src_width, size_t src_height); typedef void ParamFilterFunc(int16_t *dst, const int16_t *src, size_t src_width, size_t src_height, const int16_t *param); typedef struct { int align_order; // log2(alignment) // rasterizer functions int tile_order; // log2(tile_size) FillSolidTileFunc *fill_solid; FillHalfplaneTileFunc *fill_halfplane; FillGenericTileFunc *fill_generic; MergeTileFunc *merge; // blend functions BitmapBlendFunc *add_bitmaps, *imul_bitmaps; BitmapMulFunc *mul_bitmaps; // be blur function BeBlurFunc *be_blur; // gaussian blur functions Convert8to16Func *stripe_unpack; Convert16to8Func *stripe_pack; FilterFunc *shrink_horz, *shrink_vert; FilterFunc *expand_horz, *expand_vert; ParamFilterFunc *blur_horz[5], *blur_vert[5]; } BitmapEngine; enum { ASS_CPU_FLAG_NONE = 0x0000, #if ARCH_X86 ASS_CPU_FLAG_X86_SSE2 = 0x0001, ASS_CPU_FLAG_X86_SSSE3 = 0x0002, ASS_CPU_FLAG_X86_AVX2 = 0x0004, #elif ARCH_AARCH64 ASS_CPU_FLAG_ARM_NEON = 0x0001, #endif ASS_CPU_FLAG_ALL = 0x0FFF, ASS_FLAG_LARGE_TILES = 0x1000, ASS_FLAG_WIDE_STRIPE = 0x2000, // for C version only }; unsigned ass_get_cpu_flags(unsigned mask); BitmapEngine ass_bitmap_engine_init(unsigned mask); #endif /* LIBASS_BITMAP_ENGINE_H */
e172f55de3e6d24c767babda31096f536e5bdcf1
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
/sys/dev/hyperv/genfb_vmbus.c
849835aa87a093232518d198fce421e69a55138f
[]
no_license
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
4,571
c
genfb_vmbus.c
/* $NetBSD: genfb_vmbus.c,v 1.3 2021/08/07 16:19:11 thorpej Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <sys/cdefs.h> __KERNEL_RCSID(0, "$NetBSD: genfb_vmbus.c,v 1.3 2021/08/07 16:19:11 thorpej Exp $"); #include "opt_wsfb.h" #include "opt_genfb.h" #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/device.h> #include <sys/proc.h> #include <sys/mutex.h> #include <sys/ioctl.h> #include <sys/systm.h> #include <sys/kauth.h> #include <dev/wsfb/genfbvar.h> #include <dev/hyperv/vmbusvar.h> #include <dev/hyperv/genfb_vmbusvar.h> static int genfb_vmbus_match(device_t, cfdata_t, void *); static void genfb_vmbus_attach(device_t, device_t, void *); static int genfb_vmbus_ioctl(void *, void *, u_long, void *, int, struct lwp *); static paddr_t genfb_vmbus_mmap(void *, void *, off_t, int); static int genfb_vmbus_drm_print(void *, const char *); static bool genfb_vmbus_shutdown(device_t, int); CFATTACH_DECL_NEW(genfb_vmbus, sizeof(struct genfb_vmbus_softc), genfb_vmbus_match, genfb_vmbus_attach, NULL, NULL); static int genfb_vmbus_match(device_t parent, cfdata_t match, void *aux) { struct vmbus_attach_args *aa = aux; if (memcmp(aa->aa_type, &hyperv_guid_video, sizeof(*aa->aa_type)) != 0) return 0; if (!genfb_is_enabled()) return 0; /* explicitly disabled by MD code */ /* Use genfb(4) at pci in Gen.1 VM. */ if (hyperv_is_gen1()) return 0; return 1; } static void genfb_vmbus_attach(device_t parent, device_t self, void *aux) { static const struct genfb_ops zero_ops; struct genfb_vmbus_softc *sc = device_private(self); struct vmbus_attach_args *aa = aux; struct genfb_ops ops = zero_ops; aprint_naive("\n"); aprint_normal(": Hyper-V Synthetic Video\n"); sc->sc_gen.sc_dev = self; sc->sc_memt = aa->aa_memt; genfb_init(&sc->sc_gen); /* firmware / MD code responsible for restoring the display */ if (sc->sc_gen.sc_pmfcb == NULL) pmf_device_register1(self, NULL, NULL, genfb_vmbus_shutdown); else pmf_device_register1(self, sc->sc_gen.sc_pmfcb->gpc_suspend, sc->sc_gen.sc_pmfcb->gpc_resume, genfb_vmbus_shutdown); if ((sc->sc_gen.sc_width == 0) || (sc->sc_gen.sc_fbsize == 0)) { aprint_debug_dev(self, "not configured by firmware\n"); return; } ops.genfb_ioctl = genfb_vmbus_ioctl; ops.genfb_mmap = genfb_vmbus_mmap; if (genfb_attach(&sc->sc_gen, &ops) != 0) return; /* now try to attach a DRM */ config_found(self, aux, genfb_vmbus_drm_print, CFARGS(.iattr = "drm")); } static int genfb_vmbus_drm_print(void *aux, const char *pnp) { if (pnp) aprint_normal("drm at %s", pnp); return UNCONF; } static int genfb_vmbus_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l) { switch (cmd) { case WSDISPLAYIO_GTYPE: *(u_int *)data = WSDISPLAY_TYPE_GENFB; return 0; } return EPASSTHROUGH; } static paddr_t genfb_vmbus_mmap(void *v, void *vs, off_t offset, int prot) { struct genfb_vmbus_softc *sc = v; return bus_space_mmap(sc->sc_memt, sc->sc_gen.sc_fboffset, offset, prot, BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE); } static bool genfb_vmbus_shutdown(device_t self, int flags) { genfb_enable_polling(self); return true; }
3cb4c11162088fe60980fc027223fbed6dd40780
8a51a96f61699f0318315ccc89cef39f6866f2b5
/src/backend/access/rmgrdesc/tblspcdesc.c
b8c89f8c543c311de498cda00dfcb242b711d12a
[ "PostgreSQL" ]
permissive
postgres/postgres
979febf2b41c00090d1256228f768f33e7ef3b6f
b5934bfd6071fed3a38cea0cfaa93afda63d9c0c
refs/heads/master
2023-08-31T00:10:01.373472
2023-08-30T23:07:48
2023-08-30T23:07:48
927,442
13,691
4,807
NOASSERTION
2023-09-09T13:59:15
2010-09-21T11:35:45
C
UTF-8
C
false
false
1,213
c
tblspcdesc.c
/*------------------------------------------------------------------------- * * tblspcdesc.c * rmgr descriptor routines for commands/tablespace.c * * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION * src/backend/access/rmgrdesc/tblspcdesc.c * *------------------------------------------------------------------------- */ #include "postgres.h" #include "commands/tablespace.h" void tblspc_desc(StringInfo buf, XLogReaderState *record) { char *rec = XLogRecGetData(record); uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; if (info == XLOG_TBLSPC_CREATE) { xl_tblspc_create_rec *xlrec = (xl_tblspc_create_rec *) rec; appendStringInfo(buf, "%u \"%s\"", xlrec->ts_id, xlrec->ts_path); } else if (info == XLOG_TBLSPC_DROP) { xl_tblspc_drop_rec *xlrec = (xl_tblspc_drop_rec *) rec; appendStringInfo(buf, "%u", xlrec->ts_id); } } const char * tblspc_identify(uint8 info) { const char *id = NULL; switch (info & ~XLR_INFO_MASK) { case XLOG_TBLSPC_CREATE: id = "CREATE"; break; case XLOG_TBLSPC_DROP: id = "DROP"; break; } return id; }
e13129317c70ef6517374c3182e8c4ec63fb1e6f
7be8e3636bf08ebdc6662879dc5afec548705537
/ios/Pods/Headers/Private/Flipper-Folly/folly/detail/AtFork.h
fe3b3e78571c56a02f1827a93c489a30defc5fee
[ "MIT" ]
permissive
rdhox/react-native-smooth-picker
3c7384f1fed0e37f076361cce96071d01b70e209
ae9316c49512f7ed9824c5a3ad50cdf5e80fffa9
refs/heads/master
2023-01-08T16:59:40.709147
2021-07-03T14:13:21
2021-07-03T14:13:21
160,224,312
230
31
MIT
2023-01-06T01:46:04
2018-12-03T16:54:10
TypeScript
UTF-8
C
false
false
50
h
AtFork.h
../../../../../Flipper-Folly/folly/detail/AtFork.h
475b74bff7d7a8cf738778f0a1c4ca7de9bdb7d1
e9454d56c6fdd3389b7590aa0cbe96eef716d8f4
/SimTKmath/Integrators/src/CPodes/sundials/tests/cpsAdvDiff_bnd.c
9eca6d74b902256248a10b6d50b0e9fdc85c7cfe
[ "Apache-2.0" ]
permissive
simbody/simbody
b2ca134c6d91e5fe4da93fc22aaf86cdbdeff658
0d671660c4e97f26566da040eaa57089fab81192
refs/heads/master
2023-09-01T09:33:29.968397
2023-08-31T16:51:49
2023-08-31T16:51:49
12,146,969
2,186
539
Apache-2.0
2023-09-05T17:15:38
2013-08-16T00:21:53
C++
UTF-8
C
false
false
7,196
c
cpsAdvDiff_bnd.c
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <cpodes/cpodes.h> #include <cpodes/cpodes_band.h> #include <nvector/nvector_serial.h> #include <sundials/sundials_math.h> /* Problem Constants */ #define XMAX RCONST(2.0) /* domain boundaries */ #define YMAX RCONST(1.0) #define MX 10 /* mesh dimensions */ #define MY 5 #define NEQ MX*MY /* number of equations */ #define ATOL RCONST(1.0e-5) /* scalar absolute tolerance */ #define T0 RCONST(0.0) /* initial time */ #define T1 RCONST(0.1) /* first output time */ #define DTOUT RCONST(0.1) /* output time increment */ #define NOUT 10 /* number of output times */ #define ZERO RCONST(0.0) #define HALF RCONST(0.5) #define ONE RCONST(1.0) #define TWO RCONST(2.0) #define FIVE RCONST(5.0) #define IJth(vdata,i,j) (vdata[(j-1) + (i-1)*MY]) typedef struct { realtype dx, dy, hdcoef, hacoef, vdcoef; } *UserData; /* Private Helper Functions */ static void SetIC(N_Vector u, UserData data); static void PrintHeader(realtype reltol, realtype abstol, realtype umax); static void PrintOutput(realtype t, realtype umax, long int nst); static void PrintFinalStats(void *cvode_mem); /* Functions Called by the Solver */ static int f(realtype t, N_Vector u, N_Vector udot, void *f_data); static int Jac(int N, int mu, int ml, realtype t, N_Vector u, N_Vector fu, DlsMat J, void *jac_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3); /* *------------------------------- * Main Program *------------------------------- */ int main(void) { realtype dx, dy, reltol, abstol, t, tout, umax; N_Vector u, up; UserData data; void *cvode_mem; int iout, flag; long int nst; u = NULL; data = NULL; cvode_mem = NULL; u = N_VNew_Serial(NEQ); up = N_VNew_Serial(NEQ); reltol = ZERO; abstol = ATOL; data = (UserData) malloc(sizeof *data); dx = data->dx = XMAX/(MX+1); dy = data->dy = YMAX/(MY+1); data->hdcoef = ONE/(dx*dx); data->hacoef = HALF/(TWO*dx); data->vdcoef = ONE/(dy*dy); SetIC(u, data); cvode_mem = CPodeCreate(CP_EXPL, CP_BDF, CP_NEWTON); flag = CPodeInit(cvode_mem, (void *)f, data, T0, u, NULL, CP_SS, reltol, &abstol); flag = CPBand(cvode_mem, NEQ, MY, MY); flag = CPDlsSetJacFn(cvode_mem, (void *)Jac, data); /* In loop over output points: call CPode, print results, test for errors */ umax = N_VMaxNorm(u); PrintHeader(reltol, abstol, umax); for(iout=1, tout=T1; iout <= NOUT; iout++, tout += DTOUT) { flag = CPode(cvode_mem, tout, &t, u, up, CP_NORMAL); umax = N_VMaxNorm(u); flag = CPodeGetNumSteps(cvode_mem, &nst); PrintOutput(t, umax, nst); } PrintFinalStats(cvode_mem); N_VDestroy_Serial(u); CPodeFree(&cvode_mem); free(data); return(0); } /* f routine. Compute f(t,u). */ static int f(realtype t, N_Vector u,N_Vector udot, void *f_data) { realtype uij, udn, uup, ult, urt, hordc, horac, verdc, hdiff, hadv, vdiff; realtype *udata, *dudata; int i, j; UserData data; udata = NV_DATA_S(u); dudata = NV_DATA_S(udot); /* Extract needed constants from data */ data = (UserData) f_data; hordc = data->hdcoef; horac = data->hacoef; verdc = data->vdcoef; /* Loop over all grid points. */ for (j=1; j <= MY; j++) { for (i=1; i <= MX; i++) { /* Extract u at x_i, y_j and four neighboring points */ uij = IJth(udata, i, j); udn = (j == 1) ? ZERO : IJth(udata, i, j-1); uup = (j == MY) ? ZERO : IJth(udata, i, j+1); ult = (i == 1) ? ZERO : IJth(udata, i-1, j); urt = (i == MX) ? ZERO : IJth(udata, i+1, j); /* Set diffusion and advection terms and load into udot */ hdiff = hordc*(ult - TWO*uij + urt); hadv = horac*(urt - ult); vdiff = verdc*(uup - TWO*uij + udn); IJth(dudata, i, j) = hdiff + hadv + vdiff; } } return(0); } /* Jacobian routine. Compute J(t,u). */ static int Jac(int N, int mu, int ml, realtype t, N_Vector u, N_Vector fu, DlsMat J, void *jac_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3) { long int i, j, k; realtype *kthCol, hordc, horac, verdc; UserData data; /* The components of f = udot that depend on u(i,j) are f(i,j), f(i-1,j), f(i+1,j), f(i,j-1), f(i,j+1), with df(i,j)/du(i,j) = -2 (1/dx^2 + 1/dy^2) df(i-1,j)/du(i,j) = 1/dx^2 + .25/dx (if i > 1) df(i+1,j)/du(i,j) = 1/dx^2 - .25/dx (if i < MX) df(i,j-1)/du(i,j) = 1/dy^2 (if j > 1) df(i,j+1)/du(i,j) = 1/dy^2 (if j < MY) */ data = (UserData) jac_data; hordc = data->hdcoef; horac = data->hacoef; verdc = data->vdcoef; for (j=1; j <= MY; j++) { for (i=1; i <= MX; i++) { k = j-1 + (i-1)*MY; kthCol = BAND_COL(J,k); /* set the kth column of J */ BAND_COL_ELEM(kthCol,k,k) = -TWO*(verdc+hordc); if (i != 1) BAND_COL_ELEM(kthCol,k-MY,k) = hordc + horac; if (i != MX) BAND_COL_ELEM(kthCol,k+MY,k) = hordc - horac; if (j != 1) BAND_COL_ELEM(kthCol,k-1,k) = verdc; if (j != MY) BAND_COL_ELEM(kthCol,k+1,k) = verdc; } } return(0); } /* Set initial conditions in u vector */ static void SetIC(N_Vector u, UserData data) { int i, j; realtype x, y, dx, dy; realtype *udata; /* Extract needed constants from data */ dx = data->dx; dy = data->dy; /* Set pointer to data array in vector u. */ udata = NV_DATA_S(u); /* Load initial profile into u vector */ for (j=1; j <= MY; j++) { y = j*dy; for (i=1; i <= MX; i++) { x = i*dx; IJth(udata,i,j) = x*(XMAX - x)*y*(YMAX - y)*EXP(FIVE*x*y); } } } /* Print first lines of output (problem description) */ static void PrintHeader(realtype reltol, realtype abstol, realtype umax) { printf("\n2-D Advection-Diffusion Equation\n"); printf("Mesh dimensions = %d X %d\n", MX, MY); printf("Total system size = %d\n", NEQ); printf("Tolerance parameters: reltol = %lg abstol = %lg\n\n", reltol, abstol); printf("At t = %lg max.norm(u) =%14.6le \n", T0, umax); return; } /* Print current value */ static void PrintOutput(realtype t, realtype umax, long int nst) { printf("At t = %4.2f max.norm(u) =%14.6le nst = %4ld\n", t, umax, nst); return; } /* Get and print some final statistics */ static void PrintFinalStats(void *cvode_mem) { int flag; long int nst, nfe, nsetups, netf, nni, ncfn, nje, nfeLS; flag = CPodeGetNumSteps(cvode_mem, &nst); flag = CPodeGetNumFctEvals(cvode_mem, &nfe); flag = CPodeGetNumLinSolvSetups(cvode_mem, &nsetups); flag = CPodeGetNumErrTestFails(cvode_mem, &netf); flag = CPodeGetNumNonlinSolvIters(cvode_mem, &nni); flag = CPodeGetNumNonlinSolvConvFails(cvode_mem, &ncfn); flag = CPDlsGetNumJacEvals(cvode_mem, &nje); flag = CPDlsGetNumFctEvals(cvode_mem, &nfeLS); printf("\nFinal Statistics:\n"); printf("nst = %-6ld nfe = %-6ld nsetups = %-6ld nfeLS = %-6ld nje = %ld\n", nst, nfe, nsetups, nfeLS, nje); printf("nni = %-6ld ncfn = %-6ld netf = %ld\n \n", nni, ncfn, netf); return; }
45b3ceb45c0c292b29162fd4a5a74f13421ab1da
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
/sysutils/upsdaemon/files/patch-upsdaemon.c
005167245b0f8eaa3327717a375fdd56448dff4d
[ "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
808
c
patch-upsdaemon.c
--- src/upsdaemon.c.orig 2006-06-20 01:50:23.000000000 +0100 +++ src/upsdaemon.c 2009-04-12 15:48:34.000000000 +0100 @@ -32,6 +32,7 @@ #include <errno.h> /* Error number definitions */ #include <termios.h> /* POSIX terminal control definitions */ #include <syslog.h> /* Definitions for system error logging */ +#include <stdlib.h> /* exit() definition */ #define PROG " UpsDaemon" #define VERSION " 1.0" @@ -50,6 +51,7 @@ #define SH_RECOVERY "/usr/local/libexec/upsdaemon/upsdaemon-alerts -recovery" int makepid(char *s); +static void runcommand(); int main(int argc, char **argv) { @@ -71,7 +73,6 @@ char *failed = SH_FAILED; char *recovery = SH_RECOVERY; - static void runcommand(); if(argc > 2) { errx(1,"Usage: upsdaemon <port serial open>: %s\n", strerror(errno));
d116ff3041981c0e7fa4967cbb4221120ce81d2b
e7e2ee02a1cd3e0229346855c9aa6d931e3ca1c4
/src/log/sink/log_sink_support.c
ff4cf83fa4ad1ea4217e26e54bce76a860ef5e5d
[ "BSD-3-Clause" ]
permissive
danielealbano/cachegrand
7c2dd00424596796e52b62ca2e9eb107d06e0e5b
eb2df00feab7639a0327492c11a334a22dec7e60
refs/heads/main
2023-08-19T11:04:18.418711
2023-06-11T22:44:49
2023-06-11T22:44:49
125,234,630
904
33
BSD-3-Clause
2023-06-11T22:44:51
2018-03-14T15:33:02
C
UTF-8
C
false
false
2,544
c
log_sink_support.c
/** * Copyright (C) 2018-2023 Daniele Salvatore Albano * All rights reserved. * * This software may be modified and distributed under the terms * of the BSD license. See the LICENSE file for details. **/ #include <stdio.h> #include <string.h> #include <stdbool.h> #include <time.h> #include "misc.h" #include "log/log.h" #include "log_sink_support.h" size_t log_sink_support_printer_str_len( const char* tag, const char* early_prefix_thread, size_t message_len) { size_t log_message_len; log_message_len = 1 + LOG_MESSAGE_TIMESTAMP_MAX_LENGTH + 1 + // timestamp 1 + 11 + 1 + // log level padded with up to 11 spaces (early_prefix_thread != NULL ? strlen(early_prefix_thread) : 0) + // early_prefix_thread 1 + strlen(tag) + 1 + // tag with brackets 1 + // space message_len + // message 1; // \n return log_message_len; } size_t log_sink_support_printer_simple_str( char* message_out, size_t message_out_len, const char* tag, const char* early_prefix_thread, const char* message, size_t message_len) { size_t message_out_len_res; message_out_len_res = snprintf( message_out, message_out_len, "%s[%s] ", early_prefix_thread != NULL ? early_prefix_thread : "", tag); strcpy(message_out + message_out_len_res, message); message_out_len_res += message_len; message_out[message_out_len_res] = '\n'; message_out_len_res++; return message_out_len_res; } size_t log_sink_support_printer_str( char* message_out, size_t message_out_len, const char* tag, time_t timestamp, log_level_t level, const char* early_prefix_thread, const char* message, size_t message_len) { size_t message_out_len_res; char timestamp_str[LOG_MESSAGE_TIMESTAMP_MAX_LENGTH + 1] = { 0 }; message_out_len_res = snprintf( message_out, message_out_len, "[%s][%-11s]%s[%s] ", log_message_timestamp_str(timestamp, timestamp_str, sizeof(timestamp_str)), log_level_to_string(level), early_prefix_thread != NULL ? early_prefix_thread : "", tag); strcpy(message_out + message_out_len_res, message); message_out_len_res += message_len; message_out[message_out_len_res] = '\n'; message_out_len_res++; return message_out_len_res; }
f87e680096471809c73b7ec985ea139c351be6ef
f79dec3c4033ca3cbb55d8a51a748cc7b8b6fbab
/x11/modular-xorg-server112/patches/patch-glx_singlepixswap.c
3060fb460c27dc853537f3cbb1119a9fba5aa186
[]
no_license
jsonn/pkgsrc
fb34c4a6a2d350e8e415f3c4955d4989fcd86881
c1514b5f4a3726d90e30aa16b0c209adbc276d17
refs/heads/trunk
2021-01-24T09:10:01.038867
2017-07-07T15:49:43
2017-07-07T15:49:43
2,095,004
106
47
null
2016-09-19T09:26:01
2011-07-23T23:49:04
Makefile
UTF-8
C
false
false
5,242
c
patch-glx_singlepixswap.c
$NetBSD: patch-glx_singlepixswap.c,v 1.1 2015/04/03 09:46:18 tnn Exp $ X.Org Security Advisory: Dec. 9, 2014 Protocol handling issues in X Window System servers --- glx/singlepixswap.c.orig 2012-05-17 17:09:02.000000000 +0000 +++ glx/singlepixswap.c @@ -57,6 +57,8 @@ __glXDispSwap_ReadPixels(__GLXclientStat int error; char *answer, answerBuffer[200]; + REQUEST_FIXED_SIZE(xGLXSingleReq, 28); + __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -122,6 +124,8 @@ __glXDispSwap_GetTexImage(__GLXclientSta char *answer, answerBuffer[200]; GLint width = 0, height = 0, depth = 1; + REQUEST_FIXED_SIZE(xGLXSingleReq, 20); + __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -197,6 +201,8 @@ __glXDispSwap_GetPolygonStipple(__GLXcli __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_FIXED_SIZE(xGLXSingleReq, 4); + __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -266,15 +272,13 @@ GetSeparableFilter(__GLXclientState * cl compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); compsize2 = __glGetTexImage_size(target, 1, format, type, height, 1, 1); - if (compsize < 0) + if ((compsize = safe_pad(compsize)) < 0) compsize = 0; - if (compsize2 < 0) + if ((compsize2 = safe_pad(compsize2)) < 0) compsize2 = 0; - compsize = __GLX_PAD(compsize); - compsize2 = __GLX_PAD(compsize2); CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes)); - __GLX_GET_ANSWER_BUFFER(answer, cl, compsize + compsize2, 1); + __GLX_GET_ANSWER_BUFFER(answer, cl, safe_add(compsize, compsize2), 1); __glXClearErrorOccured(); CALL_GetSeparableFilter(GET_DISPATCH(), (*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), @@ -302,7 +306,9 @@ int __glXDispSwap_GetSeparableFilter(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); + ClientPtr client = cl->client; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetSeparableFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } @@ -310,7 +316,9 @@ int __glXDispSwap_GetSeparableFilterEXT(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); + ClientPtr client = cl->client; + REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetSeparableFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); } @@ -388,7 +396,9 @@ int __glXDispSwap_GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); + ClientPtr client = cl->client; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetConvolutionFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } @@ -396,7 +406,9 @@ int __glXDispSwap_GetConvolutionFilterEXT(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); + ClientPtr client = cl->client; + REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetConvolutionFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); } @@ -463,7 +475,9 @@ int __glXDispSwap_GetHistogram(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); + ClientPtr client = cl->client; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetHistogram(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } @@ -471,7 +485,9 @@ int __glXDispSwap_GetHistogramEXT(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); + ClientPtr client = cl->client; + REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetHistogram(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); } @@ -529,7 +545,9 @@ int __glXDispSwap_GetMinmax(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); + ClientPtr client = cl->client; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetMinmax(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } @@ -537,7 +555,9 @@ int __glXDispSwap_GetMinmaxEXT(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); + ClientPtr client = cl->client; + REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetMinmax(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); } @@ -605,7 +625,9 @@ int __glXDispSwap_GetColorTable(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc); + ClientPtr client = cl->client; + REQUEST_FIXED_SIZE(xGLXSingleReq, 16); return GetColorTable(cl, pc + __GLX_SINGLE_HDR_SIZE, tag); } @@ -613,6 +635,8 @@ int __glXDispSwap_GetColorTableSGI(__GLXclientState * cl, GLbyte * pc) { const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc); + ClientPtr client = cl->client; + REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16); return GetColorTable(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag); }
947f96f07111eb937f81793dfd39c76c8f1e89d7
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
/SOFTWARE/A64-TERES/u-boot_new/include/aes.h
6315c02aa93d9fc6a4cda3f52f4912c8ebe2e5a0
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "GPL-2.0-or-later" ]
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
2,474
h
aes.h
/* * Copyright (c) 2011 The Chromium OS Authors. * (C) Copyright 2010 - 2011 NVIDIA Corporation <www.nvidia.com> * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _AES_REF_H_ #define _AES_REF_H_ #ifdef USE_HOSTCC /* Define compat stuff for use in fw_* tools. */ typedef unsigned char u8; typedef unsigned int u32; #define debug(...) do {} while (0) #endif /* * AES encryption library, with small code size, supporting only 128-bit AES * * AES is a stream cipher which works a block at a time, with each block * in this case being AES_KEY_LENGTH bytes. */ enum { AES_STATECOLS = 4, /* columns in the state & expanded key */ AES_KEYCOLS = 4, /* columns in a key */ AES_ROUNDS = 10, /* rounds in encryption */ AES_KEY_LENGTH = 128 / 8, AES_EXPAND_KEY_LENGTH = 4 * AES_STATECOLS * (AES_ROUNDS + 1), }; /** * aes_expand_key() - Expand the AES key * * Expand a key into a key schedule, which is then used for the other * operations. * * @key Key, of length AES_KEY_LENGTH bytes * @expkey Buffer to place expanded key, AES_EXPAND_KEY_LENGTH */ void aes_expand_key(u8 *key, u8 *expkey); /** * aes_encrypt() - Encrypt single block of data with AES 128 * * @in Input data * @expkey Expanded key to use for encryption (from aes_expand_key()) * @out Output data */ void aes_encrypt(u8 *in, u8 *expkey, u8 *out); /** * aes_decrypt() - Decrypt single block of data with AES 128 * * @in Input data * @expkey Expanded key to use for decryption (from aes_expand_key()) * @out Output data */ void aes_decrypt(u8 *in, u8 *expkey, u8 *out); /** * Apply chain data to the destination using EOR * * Each array is of length AES_KEY_LENGTH. * * @cbc_chain_data Chain data * @src Source data * @dst Destination data, which is modified here */ void aes_apply_cbc_chain_data(u8 *cbc_chain_data, u8 *src, u8 *dst); /** * aes_cbc_encrypt_blocks() - Encrypt multiple blocks of data with AES CBC. * * @key_exp Expanded key to use * @src Source data to encrypt * @dst Destination buffer * @num_aes_blocks Number of AES blocks to encrypt */ void aes_cbc_encrypt_blocks(u8 *key_exp, u8 *src, u8 *dst, u32 num_aes_blocks); /** * Decrypt multiple blocks of data with AES CBC. * * @key_exp Expanded key to use * @src Source data to decrypt * @dst Destination buffer * @num_aes_blocks Number of AES blocks to decrypt */ void aes_cbc_decrypt_blocks(u8 *key_exp, u8 *src, u8 *dst, u32 num_aes_blocks); #endif /* _AES_REF_H_ */
93dfb6f93d9dbd6247ca7b1cc81283d06feae3e3
7157f5e6ae4f8b2fe999ddb62fd99146ec12c123
/core/test/AutoDistributedTest/TCPMassiveConnectionsTest/CommonConstant.h
74be91c1616c8c432d7c204266c95cf2b77d6029
[]
no_license
highras/fpnn
22c42fd8f02077b3362f56614532800682641aae
cbb4c0d6ff9a74b4937710d92f474f2cf9c2607d
refs/heads/master
2022-11-15T00:04:11.304568
2022-10-28T08:43:35
2022-10-28T08:43:35
125,346,359
307
87
null
2018-07-03T03:58:10
2018-03-15T09:52:33
C++
UTF-8
C
false
false
187
h
CommonConstant.h
#ifndef FPNN_Massive_Connections_Common_Constant_h #define FPNN_Massive_Connections_Common_Constant_h #define FPNN_Massive_Connections_Actor_Name "FPNNTCPMassiveConnectionsActor" #endif
1611c493302e529ac91369292f4f76d42e1822e4
6f57761c60582c546423a2a08c769f18236fd153
/src/ccl_utils.c
db26e2015909065ef8698d1186194d5e65ba1a0b
[ "BSD-3-Clause", "LGPL-2.0-or-later", "BSD-2-Clause" ]
permissive
LSSTDESC/CCL
30644922fead0b017c1056e628bec23cf6bc4dfb
29d46978445678d86a4bee485cb29d30246ff64a
refs/heads/master
2023-09-03T17:03:17.012019
2023-08-08T11:01:33
2023-08-08T11:01:33
57,389,367
118
68
BSD-3-Clause
2023-08-30T13:25:25
2016-04-29T14:08:38
C
UTF-8
C
false
false
9,590
c
ccl_utils.c
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <gsl/gsl_errno.h> #ifdef _OPENMP #include "omp.h" #endif #include "ccl.h" /* ------- ROUTINE: ccl_linear spacing ------ INPUTS: [xmin,xmax] of the interval to be divided in N bins OUTPUT: bin edges in range [xmin,xmax] */ double * ccl_linear_spacing(double xmin, double xmax, int N) { double dx = (xmax-xmin)/(N -1.); double * x = malloc(sizeof(double)*N); if (x==NULL) { ccl_raise_warning( CCL_ERROR_MEMORY, "ccl_utils.c: ccl_linear_spacing(): " "Could not allocate memory for linear-spaced array (N=%d)\n", N); return x; } for (int i=0; i<N; i++) { x[i] = xmin + dx*i; } x[0]=xmin; //Make sure roundoff errors don't spoil edges x[N-1]=xmax; //Make sure roundoff errors don't spoil edges return x; } /* ------- ROUTINE: ccl_linlog spacing ------ * INPUTS: [xminlog,xmax] of the interval to be divided in bins * xmin when linear spacing starts * Nlog number of logarithmically spaced bins * Nlin number of linearly spaced bins * OUTPUT: bin edges in range [xminlog,xmax] * */ double * ccl_linlog_spacing(double xminlog, double xmin, double xmax, int Nlog, int Nlin) { if (Nlog<2) { ccl_raise_warning( CCL_ERROR_LINLOGSPACE, "ccl_utils.c: ccl_linlog_spacing(): " "Cannot make log-spaced array with %d points - need at least 2\n", Nlog); return NULL; } if (!(xminlog>0 && xmin>0)) { ccl_raise_warning( CCL_ERROR_LINLOGSPACE, "ccl_utils.c: ccl_linlog_spacing(): " "Cannot make log-spaced array xminlog or xmin non-positive (had %le, %le)\n", xminlog, xmin); return NULL; } if (xminlog>xmin){ ccl_raise_warning(CCL_ERROR_LINLOGSPACE, "ERROR: xminlog must be smaller as xmin"); return NULL; } if (xmin>xmax){ ccl_raise_warning(CCL_ERROR_LINLOGSPACE, "ERROR: xmin must be smaller as xmax"); return NULL; } double * x = malloc(sizeof(double)*(Nlin+Nlog-1)); if (x==NULL) { ccl_raise_warning( CCL_ERROR_MEMORY, "ccl_utils.c: ccl_linlog_spacing(): " "Could not allocate memory for array of size (Nlin+Nlog-1)=%d)\n", (Nlin+Nlog-1)); return x; } double dx = (xmax-xmin)/(Nlin -1.); double log_xchange = log(xmin); double log_xmin = log(xminlog); double dlog_x = (log_xchange - log_xmin) / (Nlog-1.); for (int i=0; i<Nlin+Nlog-1; i++) { if (i<Nlog) x[i] = exp(log_xmin + dlog_x*i); if (i>=Nlog) x[i] = xmin + dx*(i-Nlog+1); } x[0]=xminlog; //Make sure roundoff errors don't spoil edges x[Nlog-1]=xmin; //Make sure roundoff errors don't spoil edges x[Nlin+Nlog-2]=xmax; //Make sure roundoff errors don't spoil edges return x; } /* ------- ROUTINE: ccl_log spacing ------ INPUTS: [xmin,xmax] of the interval to be divided logarithmically in N bins TASK: divide an interval in N logarithmic bins OUTPUT: bin edges in range [xmin,xmax] */ double * ccl_log_spacing(double xmin, double xmax, int N) { if (N<2) { ccl_raise_warning( CCL_ERROR_LOGSPACE, "ccl_utils.c: ccl_log_spacing(): " "Cannot make log-spaced array with %d points - need at least 2\n", N); return NULL; } if (!(xmin>0 && xmax>0)) { ccl_raise_warning( CCL_ERROR_LOGSPACE, "ccl_utils.c: ccl_log_spacing(): " "Cannot make log-spaced array xmax or xmax non-positive (had %le, %le)\n", xmin, xmax); return NULL; } double log_xmax = log(xmax); double log_xmin = log(xmin); double dlog_x = (log_xmax - log_xmin) / (N-1.); double * x = malloc(sizeof(double)*N); if (x==NULL) { ccl_raise_warning( CCL_ERROR_MEMORY, "ccl_utils.c: ccl_linlog_spacing(): " "Could not allocate memory for log-spaced array (N=%d)\n", N); return x; } double xratio = exp(dlog_x); x[0] = xmin; //Make sure roundoff errors don't spoil edges for (int i=1; i<N-1; i++) { x[i] = x[i-1] * xratio; } x[N-1]=xmax; //Make sure roundoff errors don't spoil edges return x; } #define CCL_GAMMA1 2.6789385347077476336556 //Gamma(1/3) #define CCL_GAMMA2 1.3541179394264004169452 //Gamma(2/3) #define CCL_ROOTPI12 21.269446210866192327578 //12*sqrt(pi) double ccl_j_bessel(int l,double x) { double jl; double ax=fabs(x); double ax2=x*x; if(l<7) { if(l==0) { if(ax<0.1) jl=1-ax2*(1-ax2/20.)/6.; else jl=sin(x)/x; } else if(l==1) { if(ax<0.2) jl=ax*(1-ax2*(1-ax2/28)/10)/3; else jl=(sin(x)/ax-cos(x))/ax; } else if(l==2) { if(ax<0.3) jl=ax2*(1-ax2*(1-ax2/36)/14)/15; else jl=(-3*cos(x)/ax-sin(x)*(1-3/ax2))/ax; } else if(l==3) { if(ax<0.4) jl=ax*ax2*(1-ax2*(1-ax2/44)/18)/105; else jl=(cos(x)*(1-15/ax2)-sin(x)*(6-15/ax2)/ax)/ax; } else if(l==4) { if(ax<0.6) jl=ax2*ax2*(1-ax2*(1-ax2/52)/22)/945; else jl=(sin(x)*(1-(45-105/ax2)/ax2)+cos(x)*(10-105/ax2)/ax)/ax; } else if(l==5) { if(ax<1.0) jl=ax2*ax2*ax*(1-ax2*(1-ax2/60)/26)/10395; else { jl=(sin(x)*(15-(420-945/ax2)/ax2)/ax- cos(x)*(1-(105-945/ax2)/ax2))/ax; } } else { if(ax<1.0) jl=ax2*ax2*ax2*(1-ax2*(1-ax2/68)/30)/135135; else { jl=(sin(x)*(-1+(210-(4725-10395/ax2)/ax2)/ax2)+ cos(x)*(-21+(1260-10395/ax2)/ax2)/ax)/ax; } } } else { double nu=l+0.5; double nu2=nu*nu; if(ax<1.0E-40) jl=0; else if((ax2/l)<0.5) { jl=(exp(l*log(ax/nu)-M_LN2+nu*(1-M_LN2)-(1-(1-3.5/nu2)/(30*nu2))/(12*nu))/nu)* (1-ax2/(4*nu+4)*(1-ax2/(8*nu+16)*(1-ax2/(12*nu+36)))); } else if((l*l/ax)<0.5) { double beta=ax-0.5*M_PI*(l+1); jl=(cos(beta)*(1-(nu2-0.25)*(nu2-2.25)/(8*ax2)*(1-(nu2-6.25)*(nu2-12.25)/(48*ax2)))- sin(beta)*(nu2-0.25)/(2*ax)*(1-(nu2-2.25)*(nu2-6.25)/(24*ax2)* (1-(nu2-12.25)*(nu2-20.25)/(80*ax2))))/ax; } else { double l3=pow(nu,0.325); if(ax<nu-1.31*l3) { double cosb=nu/ax; double sx=sqrt(nu2-ax2); double cotb=nu/sx; double secb=ax/nu; double beta=log(cosb+sx/ax); double cot3b=cotb*cotb*cotb; double cot6b=cot3b*cot3b; double sec2b=secb*secb; double expterm=((2+3*sec2b)*cot3b/24 -((4+sec2b)*sec2b*cot6b/16 +((16-(1512+(3654+375*sec2b)*sec2b)*sec2b)*cot3b/5760 +(32+(288+(232+13*sec2b)*sec2b)*sec2b)*sec2b*cot6b/(128*nu))* cot6b/nu)/nu)/nu; jl=sqrt(cotb*cosb)/(2*nu)*exp(-nu*beta+nu/cotb-expterm); } else if(ax>nu+1.48*l3) { double cosb=nu/ax; double sx=sqrt(ax2-nu2); double cotb=nu/sx; double secb=ax/nu; double beta=acos(cosb); double cot3b=cotb*cotb*cotb; double cot6b=cot3b*cot3b; double sec2b=secb*secb; double trigarg=nu/cotb-nu*beta-0.25*M_PI- ((2+3*sec2b)*cot3b/24+(16-(1512+(3654+375*sec2b)*sec2b)*sec2b)* cot3b*cot6b/(5760*nu2))/nu; double expterm=((4+sec2b)*sec2b*cot6b/16- (32+(288+(232+13*sec2b)*sec2b)*sec2b)* sec2b*cot6b*cot6b/(128*nu2))/nu2; jl=sqrt(cotb*cosb)/nu*exp(-expterm)*cos(trigarg); } else { double beta=ax-nu; double beta2=beta*beta; double sx=6/ax; double sx2=sx*sx; double secb=pow(sx,0.3333333333333333333333); double sec2b=secb*secb; jl=(CCL_GAMMA1*secb+beta*CCL_GAMMA2*sec2b -(beta2/18-1.0/45.0)*beta*sx*secb*CCL_GAMMA1 -((beta2-1)*beta2/36+1.0/420.0)*sx*sec2b*CCL_GAMMA2 +(((beta2/1620-7.0/3240.0)*beta2+1.0/648.0)*beta2-1.0/8100.0)*sx2*secb*CCL_GAMMA1 +(((beta2/4536-1.0/810.0)*beta2+19.0/11340.0)*beta2-13.0/28350.0)*beta*sx2*sec2b*CCL_GAMMA2 -((((beta2/349920-1.0/29160.0)*beta2+71.0/583200.0)*beta2-121.0/874800.0)* beta2+7939.0/224532000.0)*beta*sx2*sx*secb*CCL_GAMMA1)*sqrt(sx)/CCL_ROOTPI12; } } } if((x<0)&&(l%2!=0)) jl=-jl; return jl; } void ccl_integ_spline(int ny, int nx,double *x,double **y, double a, double b, double *result, const gsl_interp_type *T, int *status) { if(b==a) { int iyy; for(iyy=0; iyy<ny; iyy++) result[iyy]=0; return; } if(b<a) { b=x[nx-1]; a=x[0]; } if((b>x[nx-1]) || (a<x[0])) { ccl_raise_warning(CCL_ERROR_SPLINE, "ccl_utils.c: ccl_integ_spline(): " "integration limits beyond interpolated range\n"); *status = CCL_ERROR_SPLINE; return; } if(*status==0) { #pragma omp parallel default(none) \ shared(nx, ny, x, y, a, b, result, T, status) { int iy; int local_status=0; gsl_interp_accel *ia = NULL; gsl_spline *s = NULL; s = gsl_spline_alloc(T, nx); if(s == NULL) local_status = CCL_ERROR_MEMORY; if(!local_status) { ia = gsl_interp_accel_alloc(); if(ia == NULL) local_status = CCL_ERROR_MEMORY; } if(!local_status) { #pragma omp for for(iy=0; iy<ny; iy++) { if(!local_status) { if(gsl_spline_init(s, x, y[iy], nx)) { local_status = CCL_ERROR_SPLINE; result[iy] = NAN; } } if(!local_status) { int sstat = gsl_spline_eval_integ_e(s, a, b, ia, &(result[iy])); if(sstat) { local_status = CCL_ERROR_SPLINE_EV; result[iy] = NAN; } } } } gsl_spline_free(s); gsl_interp_accel_free(ia); if (local_status) { #pragma omp atomic write *status = local_status; } } //end omp parallel } } int ccl_openmp_version() { #ifdef _OPENMP return _OPENMP; #else return 0; #endif } int ccl_openmp_threads() { #ifdef _OPENMP return omp_get_num_procs(); #else return 0; #endif }
c831840303af1119de9448345f16900806171b38
fa1ad2e2ac7e376fc7cb3b3a6e1bb88eed3e80be
/govern/data-security/krb-1.2.1/src/tests/plugorder.c
f03450b65a1f07811d62ccdf87e80e4ca6d52a47
[ "BSD-4-Clause", "LicenseRef-scancode-generic-export-compliance", "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-mit-old-style", "BSD-4-Clause-UC", "LicenseRef-scancode-rsa-1990", "BSD-3-Clause", "MIT-CMU", "LicenseRef-scancode-mit-no-advert-export-control", "CC-BY-SA-3.0", "LicenseRef-scancode-mit-modification-obligations", "LicenseRef-scancode-proprietary-license", "GPL-2.0-or-later", "LicenseRef-scancode-michigan-disclaimer", "ISC", "LicenseRef-scancode-nrl-permission", "FreeBSD-DOC", "LicenseRef-scancode-rsa-md4", "RSA-MD", "OLDAP-2.8", "FSFULLRWD", "BSD-2-Clause", "LicenseRef-scancode-brian-gladman", "MIT", "Apache-2.0" ]
permissive
alldatacenter/alldata
7bc7713c9f1d56ad6b8e59ea03206d1073b7e047
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
refs/heads/master
2023-08-05T07:32:25.442740
2023-08-03T13:17:24
2023-08-03T13:17:24
213,321,771
774
250
Apache-2.0
2023-09-06T17:35:32
2019-10-07T07:36:18
null
UTF-8
C
false
false
3,423
c
plugorder.c
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* tests/plugorder.c - Test harness to display the order of loaded plugins */ /* * Copyright (C) 2013 by the Massachusetts Institute of Technology. * 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. * * 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. */ /* * This file registers a few dummy built-in pwqual modules, then prints out the * order of pwqual modules returned by k5_plugin_load_all. The choice of the * pwqual interface is mostly arbitrary; it is an interface which libkrb5 * itself doesn't use, for which we have a test module. */ #include "k5-int.h" #include <krb5/pwqual_plugin.h> static krb5_context ctx; static void check(krb5_error_code code) { const char *errmsg; if (code) { errmsg = krb5_get_error_message(ctx, code); fprintf(stderr, "%s\n", errmsg); krb5_free_error_message(ctx, errmsg); exit(1); } } static krb5_error_code blt1(krb5_context context, int maj_ver, int min_ver, krb5_plugin_vtable vtable) { ((krb5_pwqual_vtable)vtable)->name = "blt1"; return 0; } static krb5_error_code blt2(krb5_context context, int maj_ver, int min_ver, krb5_plugin_vtable vtable) { ((krb5_pwqual_vtable)vtable)->name = "blt2"; return 0; } static krb5_error_code blt3(krb5_context context, int maj_ver, int min_ver, krb5_plugin_vtable vtable) { ((krb5_pwqual_vtable)vtable)->name = "blt3"; return 0; } int main() { krb5_plugin_initvt_fn *modules = NULL, *mod; struct krb5_pwqual_vtable_st vt; check(krb5_init_context(&ctx)); check(k5_plugin_register(ctx, PLUGIN_INTERFACE_PWQUAL, "blt1", blt1)); check(k5_plugin_register(ctx, PLUGIN_INTERFACE_PWQUAL, "blt2", blt2)); check(k5_plugin_register(ctx, PLUGIN_INTERFACE_PWQUAL, "blt3", blt3)); check(k5_plugin_load_all(ctx, PLUGIN_INTERFACE_PWQUAL, &modules)); for (mod = modules; *mod != NULL; mod++) { check((*mod)(ctx, 1, 1, (krb5_plugin_vtable)&vt)); printf("%s\n", vt.name); } k5_plugin_free_modules(ctx, modules); return 0; }
d186db4501d58353454f1e3fb42f9b86bfe6a601
9823f12bbe144dae3c9decaba2bc38d3a2e94e90
/ebox/core/enum.h
a58c38118174f21f8027e51d77baa38156aa7f43
[ "MIT" ]
permissive
eboxmaker/eBox_Framework
e8512fe26ecd729df97fdf38c875567677954858
b6c19c526568ac68df3032295c46cbd26212e111
refs/heads/master
2023-08-15T10:41:53.584433
2023-07-23T04:10:52
2023-07-23T04:10:52
95,169,842
133
68
MIT
2020-10-31T01:02:41
2017-06-23T01:07:19
C
WINDOWS-1252
C
false
false
508
h
enum.h
/* * enum.h * * Created on: 2019Äê5ÔÂ13ÈÕ * Author: shentq */ #ifndef __ENUM_H #define __ENUM_H #define DECLARE_ENUM(E) \ struct E \ { \ public: \ E(int value = 0) : _value((__Enum)value) { \ } \ E& operator=(int value) { \ this->_value = (__Enum)value; \ return *this; \ } \ operator int() const { \ return this->_value; \ } \ \ enum __Enum { #define END_ENUM() \ }; \ \ private: \ __Enum _value; \ }; #endif /* __ENUM_H */
7456b0b35be814aec3bee7908201d4be60272480
f051d9a41613334e4ba6a5747028fef3a11ac70d
/src/hsp3dish/win32/lib/include/d3dxcore.h
da1e9893ff75fa648a2ec57690b27cf74ad2122c
[ "BSD-3-Clause" ]
permissive
onitama/OpenHSP
d93b50b230234c4792a5199539403ab91f91740a
ba6b92a40c4bc6716208ad4961f11bbd1c7fbd04
refs/heads/master
2023-09-04T09:55:03.935733
2023-08-21T06:52:49
2023-08-21T06:52:49
107,995,606
159
26
BSD-3-Clause
2022-06-18T02:42:50
2017-10-23T14:42:26
C
UTF-8
C
false
false
45,420
h
d3dxcore.h
/////////////////////////////////////////////////////////////////////////// // // Copyright (C) Microsoft Corporation. All Rights Reserved. // // File: d3dxcore.h // Content: D3DX core types and functions // /////////////////////////////////////////////////////////////////////////// #ifndef __D3DXCORE_H__ #define __D3DXCORE_H__ #include <d3d.h> #include <limits.h> #include "d3dxerr.h" typedef struct ID3DXContext *LPD3DXCONTEXT; // {9B74ED7A-BBEF-11d2-9F8E-0000F8080835} DEFINE_GUID(IID_ID3DXContext, 0x9b74ed7a, 0xbbef, 0x11d2, 0x9f, 0x8e, 0x0, 0x0, 0xf8, 0x8, 0x8, 0x35); /////////////////////////////////////////////////////////////////////////// // Defines and Enumerators used below: /////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------- // D3DX_DEFAULT: // --------- // A predefined value that could be used for any parameter in D3DX APIs or // member functions that is an enumerant or a handle. The D3DX // documentation indicates wherever D3DX_DEFAULT may be used, // and how it will be interpreted in each situation. //------------------------------------------------------------------------- #define D3DX_DEFAULT ULONG_MAX //------------------------------------------------------------------------- // D3DX_DEFAULT_FLOAT: // ------------------ // Similar to D3DX_DEFAULT, but used for floating point parameters. // The D3DX documentation indicates wherever D3DX_DEFAULT_FLOAT may be used, // and how it will be interpreted in each situation. //------------------------------------------------------------------------- #define D3DX_DEFAULT_FLOAT FLT_MAX //------------------------------------------------------------------------- // Hardware Acceleration Level: // --------------------------- // These constants represent pre-defined hardware acceleration levels, // and may be used as a default anywhere a (DWORD) deviceIndex is required. // Each pre-define indicates a different level of hardware acceleration. // They are an alternative to using explicit deviceIndices retrieved by // D3DXGetDeviceDescription(). // // The only case these pre-defines should be used as device indices is if // a particular level of acceleration is required, and given more than // one capable device on the computer, it does not matter which one // is used. // // The method of selection is as follows: If one of the D3DX devices on // the primary DDraw device supports a requested hardware acceleration // level, it will be used. Otherwise, the first matching device discovered // by D3DX will be used. // // Of course, it is possible for no match to exist for any of the // pre-defines on a particular computer. Passing such a value into the // D3DX apis will simply cause them to fail, reporting that no match // is available. // // D3DX_HWLEVEL_NULL: Null implementation (draws nothing) // D3DX_HWLEVEL_REFERENCE: Reference implementation (slowest) // D3DX_HWLEVEL_2D: 2D acceleration only (RGB rasterizer used) // D3DX_HWLEVEL_RASTER: Rasterization acceleration (likely most useful) // D3DX_HWLEVEL_TL: Transform and lighting acceleration // D3DX_DEFAULT: The highest level of acceleration available // on the primary DDraw device. //------------------------------------------------------------------------- #define D3DX_HWLEVEL_NULL (D3DX_DEFAULT - 1) #define D3DX_HWLEVEL_REFERENCE (D3DX_DEFAULT - 2) #define D3DX_HWLEVEL_2D (D3DX_DEFAULT - 3) #define D3DX_HWLEVEL_RASTER (D3DX_DEFAULT - 4) #define D3DX_HWLEVEL_TL (D3DX_DEFAULT - 5) //------------------------------------------------------------------------- // Surface Class: // ------------- // These are the various types of 2D-surfaces classified according to their // usage. Note that a number of them overlap. e.g. STENCILBUFFERS and // DEPTHBUFFERS overlap (since in DX7 implementation the stencil and depth // bits are part of the same pixel format). // // Mapping to the DX7 DDPIXELFORMAT concepts: // ----------------------------------------- // D3DX_SC_DEPTHBUFFER: All ddpfs which have the DDPF_ZPIXELS or the // DDPF_ZBUFFER flags set. // D3DX_SC_STENCILBUFFER: All ddpfs which have the DDPF_STENCILBUFFER // flag set. // D3DX_SC_BUMPMAP: All ddpfs which have the DDPF_BUMPLUMINANCE // or the DDPF_BUMPDUDV flags set. // D3DX_SC_LUMINANCEMAP: All ddpfs which have the DDPF_BUMPLUMINANCE // or the DDPF_LUMINANCE flags set. // D3DX_SC_COLORTEXTURE: All the surfaces that have color information in // them and can be used for texturing. // D3DX_SC_COLORRENDERTGT: All the surfaces that contain color // information and can be used as render targets. //------------------------------------------------------------------------- #define D3DX_SC_DEPTHBUFFER 0x01 #define D3DX_SC_STENCILBUFFER 0x02 #define D3DX_SC_COLORTEXTURE 0x04 #define D3DX_SC_BUMPMAP 0x08 #define D3DX_SC_LUMINANCEMAP 0x10 #define D3DX_SC_COLORRENDERTGT 0x20 //------------------------------------------------------------------------- // Surface Formats: // --------------- // These are the various types of surface formats that can be enumerated, // there is no DDPIXELFORMAT structure in D3DX, the enums carry the meaning // (like FOURCCs). // // All the surface classes are represented here. // //------------------------------------------------------------------------- typedef enum _D3DX_SURFACEFORMAT { D3DX_SF_UNKNOWN = 0, D3DX_SF_R8G8B8 = 1, D3DX_SF_A8R8G8B8 = 2, D3DX_SF_X8R8G8B8 = 3, D3DX_SF_R5G6B5 = 4, D3DX_SF_R5G5B5 = 5, D3DX_SF_PALETTE4 = 6, D3DX_SF_PALETTE8 = 7, D3DX_SF_A1R5G5B5 = 8, D3DX_SF_X4R4G4B4 = 9, D3DX_SF_A4R4G4B4 =10, D3DX_SF_L8 =11, // 8 bit luminance-only D3DX_SF_A8L8 =12, // 16 bit alpha-luminance D3DX_SF_U8V8 =13, // 16 bit bump map format D3DX_SF_U5V5L6 =14, // 16 bit bump map format with luminance D3DX_SF_U8V8L8 =15, // 24 bit bump map format with luminance D3DX_SF_UYVY =16, // UYVY format (PC98 compliance) D3DX_SF_YUY2 =17, // YUY2 format (PC98 compliance) D3DX_SF_DXT1 =18, // S3 texture compression technique 1 D3DX_SF_DXT3 =19, // S3 texture compression technique 3 D3DX_SF_DXT5 =20, // S3 texture compression technique 5 D3DX_SF_R3G3B2 =21, // 8 bit RGB texture format D3DX_SF_A8 =22, // 8 bit alpha-only D3DX_SF_TEXTUREMAX =23, // Last texture format D3DX_SF_Z16S0 =256, D3DX_SF_Z32S0 =257, D3DX_SF_Z15S1 =258, D3DX_SF_Z24S8 =259, D3DX_SF_S1Z15 =260, D3DX_SF_S8Z24 =261, D3DX_SF_DEPTHMAX =262, // Last depth format D3DX_SF_FORCEMAX = (DWORD)(-1) } D3DX_SURFACEFORMAT; //------------------------------------------------------------------------- // Filtering types for Texture APIs // // ------------- // These are the various filter types for generation of mip-maps // // D3DX_FILTERTYPE // ----------------------------------------- // D3DX_FT_POINT: Point sampling only - no filtering // D3DX_FT_LINEAR: Bi-linear filtering // //------------------------------------------------------------------------- typedef enum _D3DX_FILTERTYPE { D3DX_FT_POINT = 0x01, D3DX_FT_LINEAR = 0x02, D3DX_FT_DEFAULT = D3DX_DEFAULT } D3DX_FILTERTYPE; /////////////////////////////////////////////////////////////////////////// // Structures used below: /////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------- // D3DX_VIDMODEDESC: Display mode description. // ---------------- // width: Screen Width // height: Screen Height // bpp: Bits per pixel // refreshRate: Refresh rate //------------------------------------------------------------------------- typedef struct _D3DX_VIDMODEDESC { DWORD width; DWORD height; DWORD bpp; DWORD refreshRate; } D3DX_VIDMODEDESC; //------------------------------------------------------------------------- // D3DX_DEVICEDESC: Description of a device that can do 3D // --------------- // deviceIndex: Unique (DWORD) number for the device. // hwLevel: Level of acceleration afforded. This is one of the // predefined Device Indices, and exists in this // structure for informational purposes only. More than // one device on the system may have the same hwLevel. // To refer to a particular device with the D3DX apis, // use the value in the deviceIndex member instead. // ddGuid: The ddraw GUID // d3dDeviceGuid: Direct3D Device GUID // ddDeviceID: DDraw's GetDeviceIdentifier GUID. This GUID is unique to // a particular driver revision on a particular video card. // driverDesc: String describing the driver // monitor: Handle to the video monitor used by this device (multimon // specific). Devices that use different monitors on a // multimon system report different values in this field. // Therefore, to test for a multimon system, an application // should look for more than one different monitor handle in // the list of D3DX devices. // onPrimary: Indicates if this device is on the primary monitor // (multimon specific). //------------------------------------------------------------------------- #define D3DX_DRIVERDESC_LENGTH 256 typedef struct _D3DX_DEVICEDESC { DWORD deviceIndex; DWORD hwLevel; GUID ddGuid; GUID d3dDeviceGuid; GUID ddDeviceID; char driverDesc[D3DX_DRIVERDESC_LENGTH]; HMONITOR monitor; BOOL onPrimary; } D3DX_DEVICEDESC; /////////////////////////////////////////////////////////////////////////// // APIs: /////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus extern "C" { #endif //__cplusplus //------------------------------------------------------------------------- // D3DXInitialize: The very first call a D3DX app must make. //------------------------------------------------------------------------- HRESULT WINAPI D3DXInitialize(); //------------------------------------------------------------------------- // D3DXUninitialize: The very last call a D3DX app must make. //------------------------------------------------------------------------- HRESULT WINAPI D3DXUninitialize(); //------------------------------------------------------------------------- // D3DXGetDeviceCount: Returns the maximum number of D3DXdevices // ------------------ available. // // D3DXGetDeviceDescription: Lists the 2D and 3D capabilities of the devices. // ------------------------ Also, the various guids needed by ddraw and d3d. // // Params: // [in] DWORD deviceIndex: Which device? Starts at 0. // [in] D3DX_DEVICEDESC* pd3dxDevice: Pointer to the D3DX_DEVICEDESC // structure to be filled in. //------------------------------------------------------------------------- DWORD WINAPI D3DXGetDeviceCount(); HRESULT WINAPI D3DXGetDeviceDescription(DWORD deviceIndex, D3DX_DEVICEDESC* pd3dxDeviceDesc); //------------------------------------------------------------------------- // D3DXGetMaxNumVideoModes: Returns the maximum number of video-modes . // ----------------------- // // Params: // [in] DWORD deviceIndex: The device being referred to. // [in] DWORD flags: If D3DX_GVM_REFRESHRATE is set, then the refresh // rates are not ignored. // // D3DXGetVideoMode: Describes a particular video mode for this device // ---------------- // // Note: These queries will simply give you a list of modes that the // display adapter tells DirectX that it supports. // There is no guarantee that D3DXCreateContext(Ex) will succeed // with all listed video modes. This is a fundamental limitation // of the current DirectX architecture which D3DX cannot hide in // any clean way. // // Params: // [in] DWORD deviceIndex: The device being referred to. // [in] DWORD flags: If D3DX_GVM_REFRESHRATE is set, then the refresh // rates are returned // [in] DWORD which: Which VideoMode ? Starts at 0. // [out] D3DX_VIDMODEDESC* pModeList: Pointer to the D3DX_VIDMODEDESC // structure that will be filled in. //------------------------------------------------------------------------- DWORD WINAPI D3DXGetMaxNumVideoModes(DWORD deviceIndex, DWORD flags); HRESULT WINAPI D3DXGetVideoMode(DWORD deviceIndex, DWORD flags, DWORD modeIndex, D3DX_VIDMODEDESC* pModeDesc); #define D3DX_GVM_REFRESHRATE 0x00000001 //------------------------------------------------------------------------- // D3DXGetMaxSurfaceFormats: Returns the maximum number of surface // ------------------------ formats supported by the device at that // video mode. // // D3DXGetSurfaceFormat: Describes one of the supported surface formats. // --------------------- // // Params: // [in] DWORD deviceIndex: The device being referred to. // [in] D3DX_VIDMODEDESC* pDesc: The display mode at which the supported // surface formats are requested. If it is // NULL, the current display mode is // assumed. // [in] DWORD surfClassFlags: Required surface classes. Only surface // formats which support all specified // surface classes will be returned. // (Multiple surface classes may be specified // using bitwise OR.) // [in] DWORD which: Which surface formats to retrieve. Starts at 0. // [out] D3DX_SURFACEFORMAT* pFormat: The surface format //------------------------------------------------------------------------- DWORD WINAPI D3DXGetMaxSurfaceFormats(DWORD deviceIndex, D3DX_VIDMODEDESC* pDesc, DWORD surfClassFlags); HRESULT WINAPI D3DXGetSurfaceFormat(DWORD deviceIndex, D3DX_VIDMODEDESC* pDesc, DWORD surfClassFlags, DWORD surfaceIndex, D3DX_SURFACEFORMAT* pFormat); //------------------------------------------------------------------------- // D3DXGetCurrentVideoMode: Retrieves the current video mode for this device. // ------------------- // // Params: // [in] DWORD deviceIndex: The device being referred to. // [out] D3DX_VIDMODEDESC* pVidMode: The current video mode //------------------------------------------------------------------------- HRESULT WINAPI D3DXGetCurrentVideoMode(DWORD deviceIndex, D3DX_VIDMODEDESC* pVidMode); //------------------------------------------------------------------------- // D3DXGetDeviceCaps: Lists all the capabilities of a device at a display // mode. // ---------------- // // Params: // [in] DWORD deviceIndex: The device being referred to. // [in] D3DX_VIDMODEDESC* pDesc: If this is NULL, we will return the // caps at the current display mode of // the device. // [out] D3DDEVICEDESC7* pD3DDeviceDesc7: D3D Caps ( NULL to ignore // parameter) // [out] DDCAPS7* pDDHalCaps: DDraw HAL Caps (NULL to ignore parameter) // [out] DDCAPS7* pDDHelCaps: DDraw HEL Caps (NULL to ignore paramter) //------------------------------------------------------------------------- HRESULT WINAPI D3DXGetDeviceCaps(DWORD deviceIndex, D3DX_VIDMODEDESC* pVidMode, D3DDEVICEDESC7* pD3DCaps, DDCAPS* pDDHALCaps, DDCAPS* pDDHELCaps); //------------------------------------------------------------------------- // D3DXCreateContext: Initializes the chosen device. It is the simplest init // ----------------- function available. Parameters are treated the same // as the matching subset of parameters in // D3DXCreateContextEx, documented below. // Remaining D3DXCreateContextEx parameters that are // not present in D3DXCreateContext are treated as // D3DX_DEFAULT. Note that multimon is not supported // with D3DXCreateContext. // // D3DXCreateContextEx: A more advanced function to initialize the device. // ------------------- Also accepts D3DX_DEFAULT for most of the parameters // and then will do what D3DXCreateContext did. // // Note: Do not expect D3DXCreateContext(Ex) to be fail-safe (as with any // API). Supported device capablilites should be used as a guide // for choosing parameter values. Keep in mind that there will // inevitably be some combinations of parameters that just do not work. // // Params: // [in] DWORD deviceIndex: The device being referred to. // [in] DWORD flags: The valid flags are D3DX_CONTEXT_FULLSCREEN, and // D3DX_CONTEXT_OFFSCREEN. These flags cannot both // be specified. If no flags are specified, the // context defaults to windowed mode. // // [in] HWND hwnd: Device window. See note. // [in] HWND hwndFocus: Window which receives keyboard messages from // the device window. The device window should be // a child of focus window. Useful for multimon // applications. See note. // NOTE: // windowed: // hwnd must be a valid window. hwndFocus must be NULL or // D3DX_DEFAULT. // // fullscreen: // Either hwnd or hwndFocus must be a valid window. (Both cannot // be NULL or D3DX_DEFAULT). If hwnd is NULL or D3DX_DEFAULT, // a default device window will be created as a child of hwndFocus. // // offscreen: // Both hwnd and hwndFocus must be NULL or D3DX_DEFAULT // // [in] DWORD numColorBits: If D3DX_DEFAULT is passed for windowed mode, // the current desktop's color depth is chosen. // For full screen mode, D3DX_DEFAULT causes 16 // bit color to be used. // [in] DWORD numAlphaBits: If D3DX_DEFAULT is passed, 0 is chosen. // [in] DWORD numDepthbits: If D3DX_DEFAULT is passed, // the highest available number of depth bits // is chosen. See note. // [in] DWORD numStencilBits: If D3DX_DEFAULT is passed, the highest // available number of stencil bits is chosen. // See note. // // NOTE: If both numDepthBits and numStencilBits are D3DX_DEFAULT, // D3DX first picks the highest available number of stencil // bits. Then, for the chosen number of stencil bits, // the highest available number of depth bits is chosen. // If only one of numStencilBits or numDepthBits // is D3DX_DEFAULT, the highest number of bits available // for this parameter is chosen out of only the formats // that support the number of bits requested for the // fixed parameter. // // [in] DWORD numBackBuffers: Number of back buffers, or D3DX_DEFAULT. // See note. // // NOTE: // windowed: D3DX_DEFAULT means 1. You must specify one back buffer. // // fullscreen: D3DX_DEFAULT means 1. Any number of back buffers can be // specified. // // offscreen: D3DX_DEFAULT means 0. You cannot specify additional back // buffers. // // [in] DWORD width: Width, in pixels, or D3DX_DEFAULT. See note. // [in] DWORD height: Height, in pixels, or D3DX_DEFAULT. See note. // // NOTE: // windowed: If either width or height is D3DX_DEFAULT, both values // default to the dimensions of the client area of hwnd. // // fullscreen: If either width or height is D3DX_DEFAULT, width // defaults to 640, and height defaults to 480. // // offscreen: An error is returned if either width or height is // D3DX_DEFAULT. // // [in] DWORD refreshRate: D3DX_DEFAULT means we let ddraw choose for // us. Ignored for windowed and offscreen modes. // [out] LPD3DXCONTEXT* ppCtx: This is the Context object that is used for // rendering on that device. // //------------------------------------------------------------------------- HRESULT WINAPI D3DXCreateContext(DWORD deviceIndex, DWORD flags, HWND hwnd, DWORD width, DWORD height, LPD3DXCONTEXT* ppCtx); HRESULT WINAPI D3DXCreateContextEx(DWORD deviceIndex, DWORD flags, HWND hwnd, HWND hwndFocus, DWORD numColorBits, DWORD numAlphaBits, DWORD numDepthbits, DWORD numStencilBits, DWORD numBackBuffers, DWORD width, DWORD height, DWORD refreshRate, LPD3DXCONTEXT* ppCtx); // The D3DXCreateContext(Ex) flags are: #define D3DX_CONTEXT_FULLSCREEN 0x00000001 #define D3DX_CONTEXT_OFFSCREEN 0x00000002 //------------------------------------------------------------------------- // D3DXGetErrorString: Prints out the error string given an hresult. Prints // ------------------ Win32 as well as DX6 error messages besides the D3DX // messages. // // Params: // [in] HRESULT hr: The error code to be deciphered. // [in] DWORD strLength: Length of the string passed in. // [out] LPSTR pStr: The string output. This string of appropriate // size needs to be passed in. //------------------------------------------------------------------------- void WINAPI D3DXGetErrorString(HRESULT hr, DWORD strLength, LPSTR pStr); //------------------------------------------------------------------------- // D3DXMakeDDPixelFormat: Fills in a DDPIXELFORMAT structure based on the // --------------------- D3DX surface format requested. // // Params: // [in] D3DX_SURFACEFORMAT d3dxFormat: Surface format. // [out] DDPIXELFORMAT* pddpf: Pixel format matching the given // surface format. //------------------------------------------------------------------------- HRESULT WINAPI D3DXMakeDDPixelFormat(D3DX_SURFACEFORMAT d3dxFormat, DDPIXELFORMAT* pddpf); //------------------------------------------------------------------------- // D3DXMakeSurfaceFormat: Determines the surface format corresponding to // --------------------- a given DDPIXELFORMAT. // // Params: // [in] DDPIXELFORMAT* pddpf: Pixel format. // Return Value: // D3DX_SURFACEFORMAT: Surface format matching the given pixel format. // D3DX_SF_UNKNOWN if the format is not supported //------------------------------------------------------------------------- D3DX_SURFACEFORMAT WINAPI D3DXMakeSurfaceFormat(DDPIXELFORMAT* pddpf); #ifdef __cplusplus } #endif //__cplusplus /////////////////////////////////////////////////////////////////////////// // Interfaces: /////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------- // ID3DXContext interface: // // This encapsulates all the stuff that the app might // want to do at initialization time and any global control over d3d and // ddraw. //------------------------------------------------------------------------- DECLARE_INTERFACE_(ID3DXContext, IUnknown) { // // IUnknown methods // STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* ppvObj) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; // Get the DDraw and Direct3D objects to call DirectDraw or // Direct3D Immediate Mode functions. // If the objects don't exist (because they have not // been created for some reason) NULL is returned. // All the objects returned in the following Get* functions // are addref'ed. It is the application's responsibility to // release them when no longer needed. STDMETHOD_(LPDIRECTDRAW7,GetDD)(THIS) PURE; STDMETHOD_(LPDIRECT3D7,GetD3D)(THIS) PURE; STDMETHOD_(LPDIRECT3DDEVICE7,GetD3DDevice)(THIS) PURE; // Get the various buffers that get created at the init time // These are addref'ed as well. It is the application's responsibility // to release them before the app quits or when it needs a resize. STDMETHOD_(LPDIRECTDRAWSURFACE7,GetPrimary)(THIS) PURE; STDMETHOD_(LPDIRECTDRAWSURFACE7,GetZBuffer)(THIS) PURE; STDMETHOD_(LPDIRECTDRAWSURFACE7,GetBackBuffer)(THIS_ DWORD which) PURE; // Get the associated window handles STDMETHOD_(HWND,GetWindow)(THIS) PURE; STDMETHOD_(HWND,GetFocusWindow)(THIS) PURE; // // Various Get methods, in case the user had specified default // parameters // STDMETHOD(GetDeviceIndex)(THIS_ LPDWORD pDeviceIndex, LPDWORD pHwLevel) PURE; STDMETHOD_(DWORD, GetNumBackBuffers)(THIS) PURE; STDMETHOD(GetNumBits)(THIS_ LPDWORD pColorBits, LPDWORD pDepthBits, LPDWORD pAlphaBits, LPDWORD pStencilBits) PURE; STDMETHOD(GetBufferSize)(THIS_ LPDWORD pWidth, LPDWORD pHeight) PURE; // Get the flags that were used to create this context STDMETHOD_(DWORD, GetCreationFlags)(THIS) PURE; STDMETHOD_(DWORD, GetRefreshRate)(THIS) PURE; // Restoring surfaces in case stuff is lost STDMETHOD(RestoreSurfaces)(THIS) PURE; // Resize all the buffers to the new width and height STDMETHOD(Resize)(THIS_ DWORD width, DWORD height) PURE; // Update the frame using a flip or a blit, // If the D3DX_UPDATE_NOVSYNC flag is set, blit is used if the // driver cannot flip without waiting for vsync in full-screen mode. STDMETHOD(UpdateFrame)(THIS_ DWORD flags) PURE; // Render a string at the specified coordinates, with the specified // colour. This is only provided as a convenience for // debugging/information during development. // topLeftX and topLeftY represent the location of the top left corner // of the string, on the render target. // The coordinate and color parameters each have a range of 0.0-1.0 STDMETHOD(DrawDebugText)(THIS_ float topLeftX, float topLeftY, D3DCOLOR color, LPSTR pString) PURE; // Clears to the current viewport // The following are the valid flags: // D3DCLEAR_TARGET (to clear the render target ) // D3DCLEAR_ZBUFFER (to clear the depth-buffer ) // D3DCLEAR_STENCIL (to clear the stencil-buffer ) STDMETHOD(Clear)(THIS_ DWORD ClearFlags) PURE; STDMETHOD(SetClearColor)(THIS_ D3DCOLOR color ) PURE; STDMETHOD(SetClearDepth)(THIS_ float z) PURE; STDMETHOD(SetClearStencil)(THIS_ DWORD stencil) PURE; }; //------------------------------------------------------------------------- // Flags for Update member function: // // Flag to indicate that blit should be used instead of a flip // for full-screen rendering. #define D3DX_UPDATE_NOVSYNC (1<<0) /////////////////////////////////////////////////////////////////////////// // Texturing APIs: /////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus extern "C" { #endif //__cplusplus //------------------------------------------------------------------------- // D3DXCheckTextureRequirements: Return information about texture creation // ---------------------------- (used by CreateTexture, CreateTextureFromFile // and CreateCubeMapTexture) // // Parameters: // // pd3dDevice // The D3D device with which the texture is going to be used. // pFlags // allows specification of D3DX_TEXTURE_NOMIPMAP // D3DX_TEXTURE_NOMIPMAP may be returned in the case where mipmap creation // is not supported. // pWidth // width in pixels or NULL // returns corrected width // pHeight // height in pixels or NULL // returns corrected height // pPixelFormat // surface format // returns best match to input format // // Notes: 1. Unless the flags is set to specifically prevent creating // mipmaps, mipmaps are generated all the way till 1x1 surface. // 2. width, height and pixelformat are altered based on available // hardware. For example: // a. Texture dimensions may be required to be powers of 2 // b. We may require width == height for some devices // c. If PixelFormat is unavailable, a best fit is made //------------------------------------------------------------------------- HRESULT WINAPI D3DXCheckTextureRequirements( LPDIRECT3DDEVICE7 pd3dDevice, LPDWORD pFlags, LPDWORD pWidth, LPDWORD pHeight, D3DX_SURFACEFORMAT* pPixelFormat); //------------------------------------------------------------------------- // D3DXCreateTexture: Create an empty texture object // ----------------- // // Parameters: // // pd3dDevice // The D3D device with which the texture is going to be used. // pFlags // allows specification of D3DX_TEXTURE_NOMIPMAP // D3DX_TEXTURE_NOMIPMAP may be returned in the case where mipmap creation // is not supported. Additionally, D3DX_TEXTURE_STAGE<n> can be specified // to indicate which texture stage the texture is for e.g. // D3D_TEXTURE_STAGE1 indicates that the texture is for use with texture // stage one. Stage Zero is the default if no TEXTURE_STAGE flags are // set. // pWidth // width in pixels; 0 or NULL is unacceptable // returns corrected width // pHeight // height in pixels; 0 or NULL is unacceptable // returns corrected height // pPixelFormat // surface format. D3DX_DEFAULT is unacceptable. // returns actual format that was used // pDDPal // DDraw palette that is set (if present) on paletted surfaces. // It is ignored even if it is set, for non-paletted surfaces. // ppDDSurf // The ddraw surface that will be created // pNumMipMaps // the number of mipmaps actually generated // // Notes: See notes for D3DXCheckTextureRequirements. //------------------------------------------------------------------------- HRESULT WINAPI D3DXCreateTexture( LPDIRECT3DDEVICE7 pd3dDevice, LPDWORD pFlags, LPDWORD pWidth, LPDWORD pHeight, D3DX_SURFACEFORMAT* pPixelFormat, LPDIRECTDRAWPALETTE pDDPal, LPDIRECTDRAWSURFACE7* ppDDSurf, LPDWORD pNumMipMaps); //------------------------------------------------------------------------- // D3DXCreateCubeMapTexture: Create blank cube-map texture // ------------------------ // // Parameters: // // pd3dDevice // The D3D device with which the texture is going to be used. // pFlags // allows specification of D3DX_TEXTURE_NOMIPMAP // D3DX_TEXTURE_NOMIPMAP may be returned in the case where mipmap creation // is not supported. Additionally, D3DX_TEXTURE_STAGE<n> can be specified // to indicate which texture stage the texture is for e.g. // D3D_TEXTURE_STAGE1 indicates that the texture is for use with texture // stage one. Stage Zero is the default if no TEXTURE_STAGE flags are // set. // cubefaces // allows specification of which faces of the cube-map to generate. // D3DX_DEFAULT, 0, and DDSCAPS2_CUBEMAP_ALLFACES all mean // "create all 6 faces of the cubemap". Any combination of // DDSCAPS2_CUBEMAP_POSITIVEX, DDSCAPS2_CUBEMAP_NEGATIVEX, // DDSCAPS2_CUBEMAP_POSITIVEY, DDSCAPS2_CUBEMAP_NEGATIVEY, // DDSCAPS2_CUBEMAP_POSITIVEZ, or DDSCAPS2_CUBEMAP_NEGATIVEZ, is // valid. // colorEmptyFaces // allows specification of the color to use for the faces that were not // specified in the cubefaces parameter. // pWidth // width in pixels; 0 or NULL is unacceptable // returns corrected width // pHeight // height in pixels; 0 or NULL is unacceptable // returns corrected height // pPixelFormat // surface format. D3DX_DEFAULT is unacceptable. // returns actual format that was used // pDDPal // DDraw palette that is set (if present) on paletted surfaces. // It is ignored even if it is set, for non-paletted surfaces. // ppDDSurf // the ddraw surface that will be created // pNumMipMaps // the number of mipmaps generated for a particular face of the // cubemap. // // Notes: See notes for D3DXCheckTextureRequirements. //------------------------------------------------------------------------- HRESULT WINAPI D3DXCreateCubeMapTexture( LPDIRECT3DDEVICE7 pd3dDevice, LPDWORD pFlags, DWORD cubefaces, D3DCOLOR colorEmptyFaces, LPDWORD pWidth, LPDWORD pHeight, D3DX_SURFACEFORMAT *pPixelFormat, LPDIRECTDRAWPALETTE pDDPal, LPDIRECTDRAWSURFACE7* ppDDSurf, LPDWORD pNumMipMaps); //------------------------------------------------------------------------- // D3DXCreateTextureFromFile: Create a texture object from a file or from the // ------------------------- resource. Only BMP and DIB are supported from the // resource portion of the executable. // // Parameters: // // pd3dDevice // The D3D device with which the texture is going to be used. // pFlags // allows specification of D3DX_TEXTURE_NOMIPMAP // D3DX_TEXTURE_NOMIPMAP may be returned in the case where mipmap creation // is not supported. Additionally, D3DX_TEXTURE_STAGE<n> can be specified // to indicate which texture stage the texture is for e.g. // D3D_TEXTURE_STAGE1 indicates that the texture is for use with texture // stage one. Stage Zero is the default if no TEXTURE_STAGE flags are // set. // pWidth // Width in pixels. If 0 or D3DX_DEFAULT, the width will be taken // from the file // returns corrected width // pHeight // Height in pixels. If 0 or D3DX_DEFAULT, the height will be taken // from the file // returns corrected height // pPixelFormat // If D3DX_SF_UNKNOWN is passed in, pixel format closest to the bitmap // will be chosen // returns actual format that was used // pDDPal // DDraw palette that is set (if present) on paletted surfaces. // It is ignored even if it is set, for non-paletted surfaces. // ppDDSurf // The ddraw surface that will be created. // pNumMipMaps // The number of mipmaps generated. // pSrcName // File name. BMP, DIB, DDS, are supported. // // TGA is supported for the following cases: 16, 24, 32bpp direct color and 8bpp palettized. // Also, 8, 16bpp grayscale is supported. RLE versions of the above // TGA formats are also supported. ColorKey and Premultiplied Alpha // are not currently supported for TGA files. // returns created format // // Notes: See notes for D3DXCheckTextureRequirements. //------------------------------------------------------------------------- HRESULT WINAPI D3DXCreateTextureFromFile( LPDIRECT3DDEVICE7 pd3dDevice, LPDWORD pFlags, LPDWORD pWidth, LPDWORD pHeight, D3DX_SURFACEFORMAT* pPixelFormat, LPDIRECTDRAWPALETTE pDDPal, LPDIRECTDRAWSURFACE7* ppDDSurf, LPDWORD pNumMipMaps, LPSTR pSrcName, D3DX_FILTERTYPE filterType); //------------------------------------------------------------------------- // D3DXLoadTextureFromFile: Load from a file into a mipmap level. Doing the // ----------------------- necessary color conversion and rescaling. File // format support is identical to // D3DXCreateTextureFromFile's. // // pd3dDevice // The D3D device with which the texture is going to be used. // pTexture // a pointer to a DD7Surface which was created with either // CreateTextureFromFile or CreateTexture. // mipMapLevel // indicates mipmap level // Note: // 1. Error if mipmap level doesn't exist // 2. If D3DX_DEFAULT and equal number of mipmap levels exist // then all the source mip-levels are loaded // 3. If the source has mipmaps and the dest doesn't, use the top one // 4. If the dest has miplevels and source doesn't, we expand // 5. If there are unequal numbers of miplevels, we expand // pSrcName // File name. BMP, DIB, DDS, are supported. // For details on TGA support, refer to the comments for // D3DXCreateTextureFromFile // pSrcRect // the source rectangle or null (whole surface) // pDestRect // the destination rectangle or null (whole surface) // filterType // filter used for mipmap generation //------------------------------------------------------------------------- HRESULT WINAPI D3DXLoadTextureFromFile( LPDIRECT3DDEVICE7 pd3dDevice, LPDIRECTDRAWSURFACE7 pTexture, DWORD mipMapLevel, LPSTR pSrcName, RECT* pSrcRect, RECT* pDestRect, D3DX_FILTERTYPE filterType); //------------------------------------------------------------------------- // D3DXLoadTextureFromSurface: Load from a DDraw Surface into a mipmap level. // -------------------------- Doing the necessary color conversion. // // pd3dDevice // The D3D device with which the texture is going to be used. // pTexture // a pointer to a DD7Surface which was created with either // CreateTextureFromFile or CreateTexture. // mipMapLevel // indicates mipmap level // Note: // 1. Error if mipmap level doesn't exist // 2. If D3DX_DEFAULT and equal number of mipmap levels exist // then all the source mip-levels are loaded // 3. If the source has mipmaps and the dest doesn't, use the top one // 4. If the dest has miplevels and source doesn't, we expand // 5. If there are unequal numbers of miplevels, we expand // pSurfaceSrc // the source surface // pSrcRect // the source rectangle or null (whole surface) // pDestRect // the destination rectangle or null (whole surface) // filterType // filter used for mipmap generation //------------------------------------------------------------------------- HRESULT WINAPI D3DXLoadTextureFromSurface( LPDIRECT3DDEVICE7 pd3dDevice, LPDIRECTDRAWSURFACE7 pTexture, DWORD mipMapLevel, LPDIRECTDRAWSURFACE7 pSurfaceSrc, RECT* pSrcRect, RECT* pDestRect, D3DX_FILTERTYPE filterType); //------------------------------------------------------------------------- // D3DXLoadTextureFromMemory: Load a mip level from memory. Doing the necessary // ------------------------- color conversion. // // pd3dDevice // The D3D device with which the texture is going to be used. // pTexture // a pointer to a DD7Surface which was created with either // CreateTextureFromFile or CreateTexture. // mipMapLevel // indicates mipmap level // Note: // 1. Error if mipmap level doesn't exist // 2. If D3DX_DEFAULT and equal number of mipmap levels exist // then all the source mip-levels are loaded // 3. If the source has mipmaps and the dest doesn't, use the top one // 4. If the dest has miplevels and source doesn't, we expand // 5. If there are unequal numbers of miplevels, we expand // pMemory // pointer to source memory from which the texture will be loaded // pDDPal // DirectDraw Palette, that the app passes in optionally if the memory is // supposed to be paletteized. // srcPixelFormat // PixelFormat of the source. // srcPitch // The pitch of the memory or D3DX_DEFAULT (based on srcPixelFormat) // pDestRect // The destination rectangle or null (whole surface) // filterType // filter used for mipmap generation // // Assumptions: The source (memory) is loaded in full //------------------------------------------------------------------------- HRESULT WINAPI D3DXLoadTextureFromMemory( LPDIRECT3DDEVICE7 pd3dDevice, LPDIRECTDRAWSURFACE7 pTexture, DWORD mipMapLevel, LPVOID pMemory, LPDIRECTDRAWPALETTE pDDPal, D3DX_SURFACEFORMAT srcPixelFormat, DWORD srcPitch, RECT* pDestRect, D3DX_FILTERTYPE filterType); #ifdef __cplusplus } #endif //__cplusplus //------------------------------------------------------------------------- // Flags for texture create functions; applies to // D3DXCreateTexture, D3DXCreateCubeMapTexture and D3DXCreateTextureFromFile. // // Flag to indicate that mipmap generation is not desired. #define D3DX_TEXTURE_NOMIPMAP (1 << 8) // Flags to indicate which texture stage the texture is // intended for use with. Specifying the stage is necessary at // texture creation time for HW devices that expose the // D3DDEVCAPS_SEPARATETEXTUREMEMORIES bit in their D3DDEVICEDESC // structure. #define D3DX_TEXTURE_STAGE0 (0) #define D3DX_TEXTURE_STAGE1 (1) #define D3DX_TEXTURE_STAGE2 (2) #define D3DX_TEXTURE_STAGE3 (3) #define D3DX_TEXTURE_STAGE4 (4) #define D3DX_TEXTURE_STAGE5 (5) #define D3DX_TEXTURE_STAGE6 (6) #define D3DX_TEXTURE_STAGE7 (7) // Mask to extract the texture stage value out of the flags to // the texture create functions. #define D3DX_TEXTURE_STAGE_MASK (0x7) #endif //__D3DXCORE_H__
94cba2283f884cc03272e205e4a4eb29aa1d0a54
376e1818d427b5e4d32fa6dd6c7b71e9fd88afdb
/devel/mgdiff/patches/patch-modal.c
262d6959bdf097e4ffe8dd47e6f6fea1f01cc3f2
[]
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
364
c
patch-modal.c
$NetBSD: patch-modal.c,v 1.1 2023/03/01 23:48:00 vins Exp $ Pull patches from Debian. --- modal.c.orig 1994-05-19 02:01:20.000000000 +0000 +++ modal.c @@ -1,5 +1,5 @@ -#ifndef lint -static char rcsid[] = "modal.c,v 2.0 1994/05/19 02:01:20 dan Exp"; +#if 0 +static char rcsid[] __attribute__((unused)) = "modal.c,v 2.0 1994/05/19 02:01:20 dan Exp"; #endif /*
c2e84807f5c211bfae1d8cd9e00463e0455816e3
d975a74c5efe4d9790566818c3ca43a70c6ce817
/clang_delta/tests/simple-inliner/alias-crash.c
3cb95b31ef0318cf37436c04307eaad0ab3f6800
[ "NCSA", "LicenseRef-scancode-unknown-license-reference" ]
permissive
marxin/cvise
cd24ce051a90b709b5a8e919ff8db2805734981d
594573e041cc2e906c1a81a4aca81ede93efee4a
refs/heads/master
2023-08-31T13:24:35.500801
2023-08-20T13:16:15
2023-08-20T13:16:15
256,755,439
164
17
NOASSERTION
2023-09-14T14:41:58
2020-04-18T13:04:05
C++
UTF-8
C
false
false
117
c
alias-crash.c
a[6]; b; c() __attribute__((alias("func_53"))); d() { c(); } func_53() { for (;; b--) return; } e; main() { d(); }
0688eec58684eed4c5420689297830aaa44a0095
a2440dbe95b034784aa940ddc0ee0faae7869e76
/modules/lwjgl/opengl/src/generated/c/org_lwjgl_opengl_NVVertexBufferUnifiedMemory.c
a13df4d6b7238277126f7a622cacad89afbfa654
[ "LicenseRef-scancode-khronos", "LGPL-2.0-or-later", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
LWJGL/lwjgl3
8972338303520c5880d4a705ddeef60472a3d8e5
67b64ad33bdeece7c09b0f533effffb278c3ecf7
refs/heads/master
2023-08-26T16:21:38.090410
2023-08-26T16:05:52
2023-08-26T16:05:52
7,296,244
4,835
1,004
BSD-3-Clause
2023-09-10T12:03:24
2012-12-23T15:40:04
Java
UTF-8
C
false
false
5,080
c
org_lwjgl_opengl_NVVertexBufferUnifiedMemory.c
/* * Copyright LWJGL. All rights reserved. * License terms: https://www.lwjgl.org/license * MACHINE GENERATED FILE, DO NOT EDIT */ #include "common_tools.h" #include "opengl.h" typedef void (APIENTRY *glBufferAddressRangeNVPROC) (jint, jint, jlong, uintptr_t); typedef void (APIENTRY *glVertexFormatNVPROC) (jint, jint, jint); typedef void (APIENTRY *glNormalFormatNVPROC) (jint, jint); typedef void (APIENTRY *glColorFormatNVPROC) (jint, jint, jint); typedef void (APIENTRY *glIndexFormatNVPROC) (jint, jint); typedef void (APIENTRY *glTexCoordFormatNVPROC) (jint, jint, jint); typedef void (APIENTRY *glEdgeFlagFormatNVPROC) (jint); typedef void (APIENTRY *glSecondaryColorFormatNVPROC) (jint, jint, jint); typedef void (APIENTRY *glFogCoordFormatNVPROC) (jint, jint); typedef void (APIENTRY *glVertexAttribFormatNVPROC) (jint, jint, jint, jboolean, jint); typedef void (APIENTRY *glVertexAttribIFormatNVPROC) (jint, jint, jint, jint); typedef void (APIENTRY *glGetIntegerui64i_vNVPROC) (jint, jint, uintptr_t); EXTERN_C_ENTER JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVVertexBufferUnifiedMemory_glBufferAddressRangeNV(JNIEnv *__env, jclass clazz, jint pname, jint index, jlong address, jlong length) { glBufferAddressRangeNVPROC glBufferAddressRangeNV = (glBufferAddressRangeNVPROC)tlsGetFunction(2198); UNUSED_PARAM(clazz) glBufferAddressRangeNV(pname, index, address, (uintptr_t)length); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVVertexBufferUnifiedMemory_glVertexFormatNV(JNIEnv *__env, jclass clazz, jint size, jint type, jint stride) { glVertexFormatNVPROC glVertexFormatNV = (glVertexFormatNVPROC)tlsGetFunction(2199); UNUSED_PARAM(clazz) glVertexFormatNV(size, type, stride); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVVertexBufferUnifiedMemory_glNormalFormatNV(JNIEnv *__env, jclass clazz, jint type, jint stride) { glNormalFormatNVPROC glNormalFormatNV = (glNormalFormatNVPROC)tlsGetFunction(2200); UNUSED_PARAM(clazz) glNormalFormatNV(type, stride); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVVertexBufferUnifiedMemory_glColorFormatNV(JNIEnv *__env, jclass clazz, jint size, jint type, jint stride) { glColorFormatNVPROC glColorFormatNV = (glColorFormatNVPROC)tlsGetFunction(2201); UNUSED_PARAM(clazz) glColorFormatNV(size, type, stride); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVVertexBufferUnifiedMemory_glIndexFormatNV(JNIEnv *__env, jclass clazz, jint type, jint stride) { glIndexFormatNVPROC glIndexFormatNV = (glIndexFormatNVPROC)tlsGetFunction(2202); UNUSED_PARAM(clazz) glIndexFormatNV(type, stride); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVVertexBufferUnifiedMemory_glTexCoordFormatNV(JNIEnv *__env, jclass clazz, jint size, jint type, jint stride) { glTexCoordFormatNVPROC glTexCoordFormatNV = (glTexCoordFormatNVPROC)tlsGetFunction(2203); UNUSED_PARAM(clazz) glTexCoordFormatNV(size, type, stride); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVVertexBufferUnifiedMemory_glEdgeFlagFormatNV(JNIEnv *__env, jclass clazz, jint stride) { glEdgeFlagFormatNVPROC glEdgeFlagFormatNV = (glEdgeFlagFormatNVPROC)tlsGetFunction(2204); UNUSED_PARAM(clazz) glEdgeFlagFormatNV(stride); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVVertexBufferUnifiedMemory_glSecondaryColorFormatNV(JNIEnv *__env, jclass clazz, jint size, jint type, jint stride) { glSecondaryColorFormatNVPROC glSecondaryColorFormatNV = (glSecondaryColorFormatNVPROC)tlsGetFunction(2205); UNUSED_PARAM(clazz) glSecondaryColorFormatNV(size, type, stride); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVVertexBufferUnifiedMemory_glFogCoordFormatNV(JNIEnv *__env, jclass clazz, jint type, jint stride) { glFogCoordFormatNVPROC glFogCoordFormatNV = (glFogCoordFormatNVPROC)tlsGetFunction(2206); UNUSED_PARAM(clazz) glFogCoordFormatNV(type, stride); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVVertexBufferUnifiedMemory_glVertexAttribFormatNV(JNIEnv *__env, jclass clazz, jint index, jint size, jint type, jboolean normalized, jint stride) { glVertexAttribFormatNVPROC glVertexAttribFormatNV = (glVertexAttribFormatNVPROC)tlsGetFunction(2207); UNUSED_PARAM(clazz) glVertexAttribFormatNV(index, size, type, normalized, stride); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVVertexBufferUnifiedMemory_glVertexAttribIFormatNV(JNIEnv *__env, jclass clazz, jint index, jint size, jint type, jint stride) { glVertexAttribIFormatNVPROC glVertexAttribIFormatNV = (glVertexAttribIFormatNVPROC)tlsGetFunction(2208); UNUSED_PARAM(clazz) glVertexAttribIFormatNV(index, size, type, stride); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVVertexBufferUnifiedMemory_nglGetIntegerui64i_1vNV__IIJ(JNIEnv *__env, jclass clazz, jint value, jint index, jlong resultAddress) { glGetIntegerui64i_vNVPROC glGetIntegerui64i_vNV = (glGetIntegerui64i_vNVPROC)tlsGetFunction(2209); uintptr_t result = (uintptr_t)resultAddress; UNUSED_PARAM(clazz) glGetIntegerui64i_vNV(value, index, result); } EXTERN_C_EXIT
b0017169567c76eb17b18c2266dacc40855d19cf
e2990cde74213c8858d1b56adb64fa7e479ec7bc
/auto-gen/builder/animal_builder_kitten.h
c6c57d9d856f7591929e1a9baf96499e17a42fcd
[ "MIT" ]
permissive
huawenyu/Design-Patterns-in-C
2b0c23c16460d2b220f74b23eab64c5defbce3b5
e18e87d39ea894d24f77b2d1e6ca37db231f1908
refs/heads/master
2023-04-10T13:10:39.251309
2023-04-05T16:38:18
2023-04-05T16:38:18
18,507,912
382
123
MIT
2022-08-01T14:08:10
2014-04-07T06:12:51
C
UTF-8
C
false
false
705
h
animal_builder_kitten.h
/** * animal_builder_kitten.h 2014-04-28 16:14:06 * anonymouse(anonymouse@email) * * Copyright (C) 2000-2014 All Right Reserved * * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A * PARTICULAR PURPOSE. * * Auto generate to show Design Pattern in C */ #ifndef __ANIMAL_BUILDER_KITTEN_H__ #define __ANIMAL_BUILDER_KITTEN_H__ #include "animal_builder.h" struct animal_builder_kitten { struct animal_builder animal_builder; }; void animal_builder_kitten_init(struct animal_builder_kitten *); #endif /* __ANIMAL_BUILDER_KITTEN_H__ */
0e5c31bea7a172284311f49dbc7a37ec60b488fc
4b15f318ba3332ee946cb0b2838c93e7935b9b89
/tests/unit/tests/header.c
1fd26429dab2e84ef5a97ed8730b686756d0dd00
[ "BSD-3-Clause" ]
permissive
Open-CAS/ocf
c4f8a5c9c1b254a905fda75be2c19bd7c8ebd450
016d7a8ee2822d672c308264e79bae4081e7930e
refs/heads/master
2023-05-28T08:40:51.328181
2023-05-11T08:11:57
2023-05-11T08:11:57
152,160,836
168
94
BSD-3-Clause
2023-09-14T08:01:50
2018-10-08T23:46:10
C
UTF-8
C
false
false
93
c
header.c
/* * Copyright(c) 2012-2021 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */
7f49234397499f6ec3dc31df05f9beacec957847
131b6d5381fc3bb4403682135b77f9bce91e79f1
/nx/source/services/service_guard.h
4f4620b4b6bdaa1d5dd0389c09830a6e2b968f04
[ "ISC" ]
permissive
switchbrew/libnx
53deb695b9ee6f3981c559125e8fce3bce6852b7
4fcdb6eb34b20f1f65eb9791fe513a710a001bea
refs/heads/master
2023-08-28T17:00:22.025929
2023-08-11T04:11:38
2023-08-12T14:51:58
103,794,142
1,286
299
ISC
2023-09-09T12:08:36
2017-09-17T01:12:38
C
UTF-8
C
false
false
1,374
h
service_guard.h
#pragma once #include "types.h" #include "result.h" #include "kernel/mutex.h" #include "sf/service.h" #include "services/sm.h" typedef struct ServiceGuard { Mutex mutex; u32 refCount; } ServiceGuard; NX_INLINE bool serviceGuardBeginInit(ServiceGuard* g) { mutexLock(&g->mutex); return (g->refCount++) == 0; } NX_INLINE Result serviceGuardEndInit(ServiceGuard* g, Result rc, void (*cleanupFunc)(void)) { if (R_FAILED(rc)) { cleanupFunc(); --g->refCount; } mutexUnlock(&g->mutex); return rc; } NX_INLINE void serviceGuardExit(ServiceGuard* g, void (*cleanupFunc)(void)) { mutexLock(&g->mutex); if (g->refCount && (--g->refCount) == 0) cleanupFunc(); mutexUnlock(&g->mutex); } #define NX_GENERATE_SERVICE_GUARD_PARAMS(name, _paramdecl, _parampass) \ \ static ServiceGuard g_##name##Guard; \ NX_INLINE Result _##name##Initialize _paramdecl; \ static void _##name##Cleanup(void); \ \ Result name##Initialize _paramdecl \ { \ Result rc = 0; \ if (serviceGuardBeginInit(&g_##name##Guard)) \ rc = _##name##Initialize _parampass; \ return serviceGuardEndInit(&g_##name##Guard, rc, _##name##Cleanup); \ } \ \ void name##Exit(void) \ { \ serviceGuardExit(&g_##name##Guard, _##name##Cleanup); \ } #define NX_GENERATE_SERVICE_GUARD(name) NX_GENERATE_SERVICE_GUARD_PARAMS(name, (void), ())
8e8b983e59908073b42271483118e491a7318a10
50dd46b8ece33f3cdd174284b15d1d51f89669d4
/third_party/edk2/SecurityPkg/HddPassword/HddPasswordHiiDataStruc.h
608b92d7975611f5c42ebafebf05f13a1e780006
[ "LicenseRef-scancode-generic-cla", "Apache-2.0", "BSD-2-Clause", "OpenSSL" ]
permissive
google/google-ctf
f99da1ee07729bbccb869fff1cbaed6a80e43bcc
df02323eaf945d15e124801c74abaadca2749dc7
refs/heads/master
2023-08-31T14:30:27.548081
2023-08-29T13:04:20
2023-08-29T13:04:20
131,317,137
4,136
607
Apache-2.0
2023-08-30T22:17:02
2018-04-27T15:56:03
Go
UTF-8
C
false
false
1,730
h
HddPasswordHiiDataStruc.h
/** @file HddPassword HII data structure used by the driver. Copyright (c) 2019, 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 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. **/ #ifndef _HDD_PASSWORD_HII_DATASTRUC_H_ #define _HDD_PASSWORD_HII_DATASTRUC_H_ #include <Guid/HiiPlatformSetupFormset.h> #define HDD_PASSWORD_CONFIG_GUID \ { \ 0x737cded7, 0x448b, 0x4801, { 0xb5, 0x7d, 0xb1, 0x94, 0x83, 0xec, 0x60, 0x6f } \ } #define FORMID_HDD_MAIN_FORM 1 #define FORMID_HDD_DEVICE_FORM 2 #define HDD_DEVICE_ENTRY_LABEL 0x1234 #define HDD_DEVICE_LABEL_END 0xffff #define KEY_HDD_DEVICE_ENTRY_BASE 0x1000 #define KEY_HDD_USER_PASSWORD 0x101 #define KEY_HDD_MASTER_PASSWORD 0x102 #pragma pack(1) typedef struct { UINT8 Supported:1; UINT8 Enabled:1; UINT8 Locked:1; UINT8 Frozen:1; UINT8 UserPasswordStatus:1; UINT8 MasterPasswordStatus:1; UINT8 Reserved:2; } HDD_PASSWORD_SECURITY_STATUS; typedef struct { UINT8 UserPassword:1; UINT8 MasterPassword:1; UINT8 Reserved:6; } HDD_PASSWORD_REQUEST; typedef struct _HDD_PASSWORD_CONFIG { HDD_PASSWORD_SECURITY_STATUS SecurityStatus; HDD_PASSWORD_REQUEST Request; } HDD_PASSWORD_CONFIG; #pragma pack() #endif
b358de242c55e6a620a5ade9ceb481d84994ff86
21c92afbd7fd022a206fb31294c523aebb770104
/SuiteSparse/CHOLMOD/Cholesky/cholmod_postorder.c
fe06a2b7f9ec0da31a0f7b01ace0076ee126fb32
[ "BSD-3-Clause", "LGPL-2.1-only", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference", "GPL-2.0-or-later", "GPL-3.0-only", "LGPL-2.1-or-later", "LGPL-2.0-or-later", "GPL-1.0-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
jlblancoc/suitesparse-metis-for-windows
70e6bcab2b525afb41758d61f823efa0618f67cf
5ee2eb4bc7bfd6d27af2f7fb027b1545cfc0fa3f
refs/heads/master
2023-08-30T21:15:39.624300
2023-03-09T10:16:48
2023-03-09T10:16:48
16,236,582
423
251
BSD-3-Clause
2023-03-09T10:18:08
2014-01-25T18:06:21
C
UTF-8
C
false
false
9,475
c
cholmod_postorder.c
/* ========================================================================== */ /* === Cholesky/cholmod_postorder =========================================== */ /* ========================================================================== */ /* ----------------------------------------------------------------------------- * CHOLMOD/Cholesky Module. Copyright (C) 2005-2006, Timothy A. Davis * -------------------------------------------------------------------------- */ /* Compute the postorder of a tree. */ #ifndef NCHOLESKY #include "cholmod_internal.h" #include "cholmod_cholesky.h" /* ========================================================================== */ /* === dfs ================================================================== */ /* ========================================================================== */ /* The code below includes both a recursive and non-recursive depth-first-search * of a tree. The recursive code is simpler, but can lead to stack overflow. * It is left here for reference, to understand what the non-recursive code * is computing. To try the recursive version, uncomment the following * #define, or compile the code with -DRECURSIVE. Be aware that stack * overflow may occur. #define RECURSIVE */ #ifdef RECURSIVE /* recursive version: a working code for reference only, not actual use */ static Int dfs /* return the new value of k */ ( Int p, /* start a DFS at node p */ Int k, /* start the node numbering at k */ Int Post [ ], /* Post ordering, modified on output */ Int Head [ ], /* Head [p] = youngest child of p; EMPTY on output */ Int Next [ ], /* Next [j] = sibling of j; unmodified */ Int Pstack [ ] /* unused */ ) { Int j ; /* start a DFS at each child of node p */ for (j = Head [p] ; j != EMPTY ; j = Next [j]) { /* start a DFS at child node j */ k = dfs (j, k, Post, Head, Next, Pstack) ; } Post [k++] = p ; /* order node p as the kth node */ Head [p] = EMPTY ; /* link list p no longer needed */ return (k) ; /* the next node will be numbered k */ } #else /* non-recursive version for actual use */ static Int dfs /* return the new value of k */ ( Int p, /* start the DFS at a root node p */ Int k, /* start the node numbering at k */ Int Post [ ], /* Post ordering, modified on output */ Int Head [ ], /* Head [p] = youngest child of p; EMPTY on output */ Int Next [ ], /* Next [j] = sibling of j; unmodified */ Int Pstack [ ] /* workspace of size n, undefined on input or output */ ) { Int j, phead ; /* put the root node on the stack */ Pstack [0] = p ; phead = 0 ; /* while the stack is not empty, do: */ while (phead >= 0) { /* grab the node p from top of the stack and get its youngest child j */ p = Pstack [phead] ; j = Head [p] ; if (j == EMPTY) { /* all children of p ordered. remove p from stack and order it */ phead-- ; Post [k++] = p ; /* order node p as the kth node */ } else { /* leave p on the stack. Start a DFS at child node j by putting * j on the stack and removing j from the list of children of p. */ Head [p] = Next [j] ; Pstack [++phead] = j ; } } return (k) ; /* the next node will be numbered k */ } #endif /* ========================================================================== */ /* === cholmod_postorder ==================================================== */ /* ========================================================================== */ /* Postorder a tree. The tree is either an elimination tree (the output from * from cholmod_etree) or a component tree (from cholmod_nested_dissection). * * An elimination tree is a complete tree of n nodes with Parent [j] > j or * Parent [j] = EMPTY if j is a root. On output Post [0..n-1] is a complete * permutation vector. * * A component tree is a subset of 0..n-1. Parent [j] = -2 if node j is not * in the component tree. Parent [j] = EMPTY if j is a root of the component * tree, and Parent [j] is in the range 0 to n-1 if j is in the component * tree but not a root. On output, Post [k] is defined only for nodes in * the component tree. Post [k] = j if node j is the kth node in the * postordered component tree, where k is in the range 0 to the number of * components minus 1. * * Node j is ignored and not included in the postorder if Parent [j] < EMPTY. * * As a result, check_parent (Parent, n,...) may fail on input, since * cholmod_check_parent assumes Parent is an elimination tree. Similarly, * cholmod_check_perm (Post, ...) may fail on output, since Post is a partial * permutation if Parent is a component tree. * * An optional node weight can be given. When starting a postorder at node j, * the children of j are ordered in increasing order of their weight. * If no weights are given (Weight is NULL) then children are ordered in * increasing order of their node number. The weight of a node must be in the * range 0 to n-1. Weights outside that range are silently converted to that * range (weights < 0 are treated as zero, and weights >= n are treated as n-1). * * * workspace: Head (n), Iwork (2*n) */ SuiteSparse_long CHOLMOD(postorder) /* return # of nodes postordered */ ( /* ---- input ---- */ Int *Parent, /* size n. Parent [j] = p if p is the parent of j */ size_t n, Int *Weight, /* size n, optional. Weight [j] is weight of node j */ /* ---- output --- */ Int *Post, /* size n. Post [k] = j is kth in postordered tree */ /* --------------- */ cholmod_common *Common ) { Int *Head, *Next, *Pstack, *Iwork ; Int j, p, k, w, nextj ; size_t s ; int ok = TRUE ; /* ---------------------------------------------------------------------- */ /* check inputs */ /* ---------------------------------------------------------------------- */ RETURN_IF_NULL_COMMON (EMPTY) ; RETURN_IF_NULL (Parent, EMPTY) ; RETURN_IF_NULL (Post, EMPTY) ; Common->status = CHOLMOD_OK ; /* ---------------------------------------------------------------------- */ /* allocate workspace */ /* ---------------------------------------------------------------------- */ /* s = 2*n */ s = CHOLMOD(mult_size_t) (n, 2, &ok) ; if (!ok) { ERROR (CHOLMOD_TOO_LARGE, "problem too large") ; return (EMPTY) ; } CHOLMOD(allocate_work) (n, s, 0, Common) ; if (Common->status < CHOLMOD_OK) { return (EMPTY) ; } ASSERT (CHOLMOD(dump_work) (TRUE, TRUE, 0, Common)) ; /* ---------------------------------------------------------------------- */ /* get inputs */ /* ---------------------------------------------------------------------- */ Head = Common->Head ; /* size n+1, initially all EMPTY */ Iwork = Common->Iwork ; Next = Iwork ; /* size n (i/i/l) */ Pstack = Iwork + n ; /* size n (i/i/l) */ /* ---------------------------------------------------------------------- */ /* construct a link list of children for each node */ /* ---------------------------------------------------------------------- */ if (Weight == NULL) { /* in reverse order so children are in ascending order in each list */ for (j = n-1 ; j >= 0 ; j--) { p = Parent [j] ; if (p >= 0 && p < ((Int) n)) { /* add j to the list of children for node p */ Next [j] = Head [p] ; Head [p] = j ; } } /* Head [p] = j if j is the youngest (least-numbered) child of p */ /* Next [j1] = j2 if j2 is the next-oldest sibling of j1 */ } else { /* First, construct a set of link lists according to Weight. * * Whead [w] = j if node j is the first node in bucket w. * Next [j1] = j2 if node j2 follows j1 in a link list. */ Int *Whead = Pstack ; /* use Pstack as workspace for Whead [ */ for (w = 0 ; w < ((Int) n) ; w++) { Whead [w] = EMPTY ; } /* do in forward order, so nodes that ties are ordered by node index */ for (j = 0 ; j < ((Int) n) ; j++) { p = Parent [j] ; if (p >= 0 && p < ((Int) n)) { w = Weight [j] ; w = MAX (0, w) ; w = MIN (w, ((Int) n) - 1) ; /* place node j at the head of link list for weight w */ Next [j] = Whead [w] ; Whead [w] = j ; } } /* traverse weight buckets, placing each node in its parent's list */ for (w = n-1 ; w >= 0 ; w--) { for (j = Whead [w] ; j != EMPTY ; j = nextj) { nextj = Next [j] ; /* put node j in the link list of its parent */ p = Parent [j] ; ASSERT (p >= 0 && p < ((Int) n)) ; Next [j] = Head [p] ; Head [p] = j ; } } /* Whead no longer needed ] */ /* Head [p] = j if j is the lightest child of p */ /* Next [j1] = j2 if j2 is the next-heaviest sibling of j1 */ } /* ---------------------------------------------------------------------- */ /* start a DFS at each root node of the etree */ /* ---------------------------------------------------------------------- */ k = 0 ; for (j = 0 ; j < ((Int) n) ; j++) { if (Parent [j] == EMPTY) { /* j is the root of a tree; start a DFS here */ k = dfs (j, k, Post, Head, Next, Pstack) ; } } /* this would normally be EMPTY already, unless Parent is invalid */ for (j = 0 ; j < ((Int) n) ; j++) { Head [j] = EMPTY ; } PRINT1 (("postordered "ID" nodes\n", k)) ; ASSERT (CHOLMOD(dump_work) (TRUE, TRUE, 0, Common)) ; return (k) ; } #endif
8ac0e4d7560f1fc165a7b771b4f02634d2b76c57
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
/lib/libc/mingw/misc/fetestexcept.c
da073e6d03a1c7b1d4f4c52a68decc18186fd83b
[ "LGPL-2.0-or-later", "ZPL-2.1", "LicenseRef-scancode-public-domain", "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
1,517
c
fetestexcept.c
/** * This file has no copyright assigned and is placed in the Public Domain. * This file is part of the mingw-w64 runtime package. * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ #include <fenv.h> #if !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) extern int __mingw_has_sse (void); #endif /* !(defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) */ /* 7.6.2.5 The fetestexcept function determines which of a specified subset of the exception flags are currently set. The excepts argument specifies the exception flags to be queried. The fetestexcept function returns the value of the bitwise OR of the exception macros corresponding to the currently set exceptions included in excepts. */ int fetestexcept (int excepts) { #if defined(_ARM_) || defined(__arm__) fenv_t _env; __asm__ volatile ("fmrx %0, FPSCR" : "=r" (_env)); return _env.__cw & excepts & FE_ALL_EXCEPT; #elif defined(_ARM64_) || defined(__aarch64__) unsigned __int64 fpcr; __asm__ volatile ("mrs %0, fpcr" : "=r" (fpcr)); return fpcr & excepts & FE_ALL_EXCEPT; #else unsigned short _sw; __asm__ __volatile__ ("fnstsw %%ax" : "=a" (_sw)); if (__mingw_has_sse ()) { int sse_sw; __asm__ __volatile__ ("stmxcsr %0;" : "=m" (sse_sw)); _sw |= sse_sw; } return _sw & excepts & FE_ALL_EXCEPT; #endif /* defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__) */ }
e5dc1bb667b39a434907d63c94940a1ac7e3c5bb
50dd46b8ece33f3cdd174284b15d1d51f89669d4
/third_party/edk2/OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.c
74c393e5462f0abb223f9a293425113979b5f419
[ "MIT", "BSD-2-Clause", "LicenseRef-scancode-generic-cla", "Apache-2.0", "OpenSSL" ]
permissive
google/google-ctf
f99da1ee07729bbccb869fff1cbaed6a80e43bcc
df02323eaf945d15e124801c74abaadca2749dc7
refs/heads/master
2023-08-31T14:30:27.548081
2023-08-29T13:04:20
2023-08-29T13:04:20
131,317,137
4,136
607
Apache-2.0
2023-08-30T22:17:02
2018-04-27T15:56:03
Go
UTF-8
C
false
false
8,094
c
TlsAuthConfigLib.c
/** @file A hook-in library for NetworkPkg/TlsAuthConfigDxe, in order to set volatile variables related to TLS configuration, before TlsAuthConfigDxe or HttpDxe (which is a UEFI_DRIVER) consume them. Copyright (C) 2013, 2015, 2018, Red Hat, Inc. Copyright (c) 2008 - 2012, 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 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 <Uefi/UefiBaseType.h> #include <Uefi/UefiSpec.h> #include <Guid/HttpTlsCipherList.h> #include <Guid/TlsAuthentication.h> #include <Library/BaseLib.h> #include <Library/DebugLib.h> #include <Library/MemoryAllocationLib.h> #include <Library/QemuFwCfgLib.h> #include <Library/UefiRuntimeServicesTableLib.h> /** Read the list of trusted CA certificates from the fw_cfg file "etc/edk2/https/cacerts", and store it to gEfiTlsCaCertificateGuid:EFI_TLS_CA_CERTIFICATE_VARIABLE. The contents are validated (for well-formedness) by NetworkPkg/HttpDxe. **/ STATIC VOID SetCaCerts ( VOID ) { EFI_STATUS Status; FIRMWARE_CONFIG_ITEM HttpsCaCertsItem; UINTN HttpsCaCertsSize; VOID *HttpsCaCerts; Status = QemuFwCfgFindFile ("etc/edk2/https/cacerts", &HttpsCaCertsItem, &HttpsCaCertsSize); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_VERBOSE, "%a:%a: not touching CA cert list\n", gEfiCallerBaseName, __FUNCTION__)); return; } // // Delete the current EFI_TLS_CA_CERTIFICATE_VARIABLE if it exists. This // serves two purposes: // // (a) If the variable exists with EFI_VARIABLE_NON_VOLATILE attribute, we // cannot make it volatile without deleting it first. // // (b) If we fail to recreate the variable later, deleting the current one is // still justified if the fw_cfg file exists. Emptying the set of trusted // CA certificates will fail HTTPS boot, which is better than trusting // any certificate that's possibly missing from the fw_cfg file. // Status = gRT->SetVariable ( EFI_TLS_CA_CERTIFICATE_VARIABLE, // VariableName &gEfiTlsCaCertificateGuid, // VendorGuid 0, // Attributes 0, // DataSize NULL // Data ); if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { // // This is fatal. // DEBUG ((DEBUG_ERROR, "%a:%a: failed to delete %g:\"%s\"\n", gEfiCallerBaseName, __FUNCTION__, &gEfiTlsCaCertificateGuid, EFI_TLS_CA_CERTIFICATE_VARIABLE)); ASSERT_EFI_ERROR (Status); CpuDeadLoop (); } if (HttpsCaCertsSize == 0) { DEBUG ((DEBUG_VERBOSE, "%a:%a: applied empty CA cert list\n", gEfiCallerBaseName, __FUNCTION__)); return; } HttpsCaCerts = AllocatePool (HttpsCaCertsSize); if (HttpsCaCerts == NULL) { DEBUG ((DEBUG_ERROR, "%a:%a: failed to allocate HttpsCaCerts\n", gEfiCallerBaseName, __FUNCTION__)); return; } QemuFwCfgSelectItem (HttpsCaCertsItem); QemuFwCfgReadBytes (HttpsCaCertsSize, HttpsCaCerts); Status = gRT->SetVariable ( EFI_TLS_CA_CERTIFICATE_VARIABLE, // VariableName &gEfiTlsCaCertificateGuid, // VendorGuid EFI_VARIABLE_BOOTSERVICE_ACCESS, // Attributes HttpsCaCertsSize, // DataSize HttpsCaCerts // Data ); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a:%a: failed to set %g:\"%s\": %r\n", gEfiCallerBaseName, __FUNCTION__, &gEfiTlsCaCertificateGuid, EFI_TLS_CA_CERTIFICATE_VARIABLE, Status)); goto FreeHttpsCaCerts; } DEBUG ((DEBUG_VERBOSE, "%a:%a: stored CA cert list (%Lu byte(s))\n", gEfiCallerBaseName, __FUNCTION__, (UINT64)HttpsCaCertsSize)); FreeHttpsCaCerts: FreePool (HttpsCaCerts); } /** Read the list of trusted cipher suites from the fw_cfg file "etc/edk2/https/ciphers", and store it to gEdkiiHttpTlsCipherListGuid:EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE. The contents are propagated by NetworkPkg/HttpDxe to NetworkPkg/TlsDxe; the list is processed by the latter. **/ STATIC VOID SetCipherSuites ( VOID ) { EFI_STATUS Status; FIRMWARE_CONFIG_ITEM HttpsCiphersItem; UINTN HttpsCiphersSize; VOID *HttpsCiphers; Status = QemuFwCfgFindFile ("etc/edk2/https/ciphers", &HttpsCiphersItem, &HttpsCiphersSize); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_VERBOSE, "%a:%a: not touching cipher suites\n", gEfiCallerBaseName, __FUNCTION__)); return; } // // From this point on, any failure is fatal. An ordered cipher preference // list is available from QEMU, thus we cannot let the firmware attempt HTTPS // boot with either pre-existent or non-existent preferences. An empty set of // cipher suites does not fail HTTPS boot automatically; the default cipher // suite preferences would take effect, and we must prevent that. // // Delete the current EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE if it exists. If // the variable exists with EFI_VARIABLE_NON_VOLATILE attribute, we cannot // make it volatile without deleting it first. // Status = gRT->SetVariable ( EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE, // VariableName &gEdkiiHttpTlsCipherListGuid, // VendorGuid 0, // Attributes 0, // DataSize NULL // Data ); if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { DEBUG ((DEBUG_ERROR, "%a:%a: failed to delete %g:\"%s\"\n", gEfiCallerBaseName, __FUNCTION__, &gEdkiiHttpTlsCipherListGuid, EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE)); goto Done; } if (HttpsCiphersSize == 0) { DEBUG ((DEBUG_ERROR, "%a:%a: list of cipher suites must not be empty\n", gEfiCallerBaseName, __FUNCTION__)); Status = EFI_INVALID_PARAMETER; goto Done; } HttpsCiphers = AllocatePool (HttpsCiphersSize); if (HttpsCiphers == NULL) { DEBUG ((DEBUG_ERROR, "%a:%a: failed to allocate HttpsCiphers\n", gEfiCallerBaseName, __FUNCTION__)); Status = EFI_OUT_OF_RESOURCES; goto Done; } QemuFwCfgSelectItem (HttpsCiphersItem); QemuFwCfgReadBytes (HttpsCiphersSize, HttpsCiphers); Status = gRT->SetVariable ( EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE, // VariableName &gEdkiiHttpTlsCipherListGuid, // VendorGuid EFI_VARIABLE_BOOTSERVICE_ACCESS, // Attributes HttpsCiphersSize, // DataSize HttpsCiphers // Data ); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a:%a: failed to set %g:\"%s\"\n", gEfiCallerBaseName, __FUNCTION__, &gEdkiiHttpTlsCipherListGuid, EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE)); goto FreeHttpsCiphers; } DEBUG ((DEBUG_VERBOSE, "%a:%a: stored list of cipher suites (%Lu byte(s))\n", gEfiCallerBaseName, __FUNCTION__, (UINT64)HttpsCiphersSize)); FreeHttpsCiphers: FreePool (HttpsCiphers); Done: if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); CpuDeadLoop (); } } RETURN_STATUS EFIAPI TlsAuthConfigInit ( VOID ) { SetCaCerts (); SetCipherSuites (); return RETURN_SUCCESS; }
b5ccfe06dcb71d08a81466a4ca52867de4420041
88ae8695987ada722184307301e221e1ba3cc2fa
/third_party/ffmpeg/libavformat/rtpdec_mpegts.c
405271f744aa7b7f098e7072de77a07771aea621
[ "Apache-2.0", "LGPL-2.0-or-later", "MIT", "GPL-1.0-or-later", "BSD-3-Clause", "LGPL-2.1-only", "LGPL-3.0-only", "GPL-2.0-only", "LGPL-2.1-or-later", "GPL-3.0-or-later", "LGPL-3.0-or-later", "IJG", "LicenseRef-scancode-other-permissive", "GPL-2.0-or-later", "GPL-3.0-only", "BSD-2-Clause" ]
permissive
iridium-browser/iridium-browser
71d9c5ff76e014e6900b825f67389ab0ccd01329
5ee297f53dc7f8e70183031cff62f37b0f19d25f
refs/heads/master
2023-08-03T16:44:16.844552
2023-07-20T15:17:00
2023-07-23T16:09:30
220,016,632
341
40
BSD-3-Clause
2021-08-13T13:54:45
2019-11-06T14:32:31
null
UTF-8
C
false
false
3,368
c
rtpdec_mpegts.c
/* * RTP MPEG2TS depacketizer * Copyright (c) 2003 Fabrice Bellard * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "libavutil/attributes.h" #include "mpegts.h" #include "rtpdec_formats.h" struct PayloadContext { struct MpegTSContext *ts; int read_buf_index; int read_buf_size; uint8_t buf[RTP_MAX_PACKET_LENGTH]; }; static void mpegts_close_context(PayloadContext *data) { if (!data) return; if (data->ts) avpriv_mpegts_parse_close(data->ts); } static av_cold int mpegts_init(AVFormatContext *ctx, int st_index, PayloadContext *data) { data->ts = avpriv_mpegts_parse_open(ctx); if (!data->ts) return AVERROR(ENOMEM); return 0; } static int mpegts_handle_packet(AVFormatContext *ctx, PayloadContext *data, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags) { int ret; // We don't want to use the RTP timestamps at all. If the mpegts demuxer // doesn't set any pts/dts, the generic rtpdec code shouldn't try to // fill it in either, since the mpegts and RTP timestamps are in totally // different ranges. *timestamp = RTP_NOTS_VALUE; if (!buf) { if (data->read_buf_index >= data->read_buf_size) return AVERROR(EAGAIN); ret = avpriv_mpegts_parse_packet(data->ts, pkt, data->buf + data->read_buf_index, data->read_buf_size - data->read_buf_index); if (ret < 0) return AVERROR(EAGAIN); data->read_buf_index += ret; if (data->read_buf_index < data->read_buf_size) return 1; else return 0; } ret = avpriv_mpegts_parse_packet(data->ts, pkt, buf, len); /* The only error that can be returned from avpriv_mpegts_parse_packet * is "no more data to return from the provided buffer", so return * AVERROR(EAGAIN) for all errors */ if (ret < 0) return AVERROR(EAGAIN); if (ret < len) { data->read_buf_size = FFMIN(len - ret, sizeof(data->buf)); memcpy(data->buf, buf + ret, data->read_buf_size); data->read_buf_index = 0; return 1; } return 0; } const RTPDynamicProtocolHandler ff_mpegts_dynamic_handler = { .codec_type = AVMEDIA_TYPE_DATA, .priv_data_size = sizeof(PayloadContext), .parse_packet = mpegts_handle_packet, .init = mpegts_init, .close = mpegts_close_context, .static_payload_id = 33, };
79ac5103fdae9620f3eef90ff99a2d80c1ca232b
f25847541dd3dd87d42d78eba81a351b72a4d0af
/libavo/src/render/opengl/opengl_render.c
4c753240f591a39eaf6ab5276b82a12ace013823
[ "MIT" ]
permissive
ireader/avcodec
a287e7905560d889e930e7a04865317fa00ef9cc
f3142ef12b5987d2f4c33ac3f073074798adf131
refs/heads/master
2023-09-05T16:56:48.006399
2023-08-26T10:35:48
2023-08-26T10:35:48
66,046,851
162
108
MIT
2023-02-03T10:32:36
2016-08-19T02:40:48
C
UTF-8
C
false
false
4,377
c
opengl_render.c
#if defined(OS_IOS) || defined(OS_ANDROID) #include <GLES2/gl2.h> #elif defined(OS_MAC) #include <OpenGL/gl3.h> #endif #include "../yuv_color.h" #include "opengl_render.h" #include "opengl_matrix.h" #include "opengl_shader.h" #include "opengl_vertex.h" #include "opengl_texture.h" #include <stdio.h> #include <stdlib.h> struct opengl_render_t { struct opengl_shader_t shader; struct opengl_vertex_t vertex;// buffer struct opengl_texture_t texture; // shader location GLint loc_mvpMatrix; // model-view-project matrix GLint loc_texMatrix; // texture matrix GLint loc_color; }; const static GLfloat s_vertex[] = { -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, }; const static GLushort s_indices[] = { 0, 1, 2, 3, }; static void opengl_check_error(const char* api) { GLenum err; for(err = glGetError(); GL_NO_ERROR != err; err = glGetError()) { printf("opengl %s error: %d\n", api, (int)err); } } static int opengl_matrix_mvp(struct opengl_render_t* render, int x, int y, int w, int h) { GLfloat matrix[16]; opengl_matrix_identity(matrix); glUniformMatrix4fv(render->loc_mvpMatrix, 1, GL_FALSE, matrix); return 0; } static int opengl_matrix_tex(struct opengl_render_t* render, int x, int y, int w, int h) { GLfloat matrix[16]; opengl_matrix_identity(matrix); glUniformMatrix4fv(render->loc_texMatrix, 1, GL_FALSE, matrix); return 0; } static int opengl_get_location(struct opengl_render_t* render) { render->vertex.loc_position = glGetAttribLocation(render->shader.program, "v_position"); render->vertex.loc_texture = glGetAttribLocation(render->shader.program, "v_texture"); render->loc_mvpMatrix = glGetUniformLocation(render->shader.program, "v_mvpMatrix"); render->loc_texMatrix = glGetUniformLocation(render->shader.program, "v_texMatrix"); render->loc_color = glGetUniformLocation(render->shader.program, "v_ColorConversion"); render->texture.loc_sampler[0] = glGetUniformLocation(render->shader.program, "y_sampler"); render->texture.loc_sampler[1] = glGetUniformLocation(render->shader.program, "u_sampler"); render->texture.loc_sampler[2] = glGetUniformLocation(render->shader.program, "v_sampler"); return 0; } struct opengl_render_t* opengl_render_open(const char* vertex_shader, const char* fragment_shader) { struct opengl_render_t* render; render = (struct opengl_render_t*)calloc(1, sizeof(*render)); if(!render) return NULL; if (0 != opengl_shader_create(&render->shader, vertex_shader, fragment_shader) || 0 != opengl_get_location(render) || 0 != opengl_texture_create(&render->texture, 3) || 0 != opengl_vertex_create(&render->vertex, s_vertex, sizeof(s_vertex)/sizeof(s_vertex[0]), s_indices, sizeof(s_indices)/sizeof(s_indices[0]))) { opengl_check_error("opengl_render_open"); opengl_render_close(render); return NULL; } //glViewport(0, 0, width, height); return render; } int opengl_render_close(struct opengl_render_t* render) { if(render) { opengl_vertex_destroy(&render->vertex); opengl_texture_destroy(&render->texture); opengl_shader_destroy(&render->shader); free(render); } return 0; } int opengl_render_write(struct opengl_render_t* render, const struct avframe_t* pic, int src_x, int src_y, int src_w, int src_h, int tgt_x, int tgt_y, int tgt_w, int tgt_h) { glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glUseProgram(render->shader.program); //glEnable(GL_CULL_FACE); // opengl_matrix_mvp(render, tgt_x, tgt_y, tgt_w, tgt_h); // opengl_matrix_tex(render, src_x, src_y, src_w, src_h); glUniformMatrix3fv(render->loc_color, 1, GL_FALSE, s_bt709); opengl_vertex_bind(&render->vertex); opengl_texture_yv12(&render->texture, pic); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, render->vertex.buffers[1]); glDrawElements(GL_TRIANGLE_STRIP, sizeof(s_indices)/sizeof(s_indices[0]), GL_UNSIGNED_SHORT, (const void*)0); glFlush(); //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); //opengl_buffer_unbind(render); opengl_check_error("opengl_render_write"); return 0; }
d958689744ca9f08bf41f76319592c2cb6bd738f
03b2c80dbc41e904b167d504666e27d798da5447
/src/type.c
98735a203464ac7e6e921d6ba6e80c83eedb3080
[ "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
3,244
c
type.c
#include <stdarg.h> #include "type_coerce.h" #include "type_copy.h" #include "type_delay.h" #include "type_memory.h" #include "type_name.h" #include "type_object.h" #include "type_parse.h" #include "type_symbol.h" #include "type_table.h" #include "type_typep.h" #include "type_upgraded.h" #include "type_value.h" #include "typedef.h" /* * check */ int decl_function_p(LispDecl type) { return type == LISPDECL_FUNCTION || type == LISPDECL_COMPILED_FUNCTION; } static int decl_astert_p(LispDecl type) { return type == LISPDECL_ASTERISK || type == LISPDECL_T; } int decl_character_p(LispDecl type) { return type == LISPDECL_CHARACTER || type == LISPDECL_BASE_CHAR || type == LISPDECL_STANDARD_CHAR || type == LISPDECL_EXTENDED_CHAR; } int decl_float_p(LispDecl type) { return type == LISPDECL_FLOAT || type == LISPDECL_SINGLE_FLOAT || type == LISPDECL_DOUBLE_FLOAT || type == LISPDECL_LONG_FLOAT || type == LISPDECL_SHORT_FLOAT; } int decl_range_p(LispDecl type) { return type == LISPDECL_INTEGER || type == LISPDECL_RATIONAL || type == LISPDECL_REAL || decl_float_p(type); } int decl_subtypep_real(LispDecl left, LispDecl right) { switch (right) { case LISPDECL_INTEGER: return left == LISPDECL_INTEGER; case LISPDECL_RATIONAL: return left == LISPDECL_INTEGER || left == LISPDECL_RATIONAL; case LISPDECL_REAL: return left == LISPDECL_INTEGER || left == LISPDECL_RATIONAL || left == LISPDECL_REAL || decl_float_p(left); case LISPDECL_FLOAT: return decl_float_p(left); case LISPDECL_SINGLE_FLOAT: case LISPDECL_DOUBLE_FLOAT: case LISPDECL_LONG_FLOAT: case LISPDECL_SHORT_FLOAT: return left == right; default: break; } return 0; } int type_delay_p(addr pos) { return GetType(pos) == LISPTYPE_TYPE && RefLispDecl(pos) == LISPDECL_DELAY; } int type_function_p(addr pos) { return GetType(pos) == LISPTYPE_TYPE && decl_function_p(LowLispDecl(pos)); } int type_astert_p(addr pos) { return GetType(pos) == LISPTYPE_TYPE && decl_astert_p(LowLispDecl(pos)); } int type_function_aster_p(addr pos) { LispDecl type; addr args, values; if (GetType(pos) != LISPTYPE_TYPE) return 0; type = LowLispDecl(pos); if (type != LISPDECL_FUNCTION && type != LISPDECL_COMPILED_FUNCTION) return 0; GetArrayType(pos, 0, &args); GetArrayType(pos, 1, &values); return type_asterisk_p(args) && type_asterisk_p(values); } int type_asterisk_p(addr pos) { return GetType(pos) == LISPTYPE_TYPE && LowLispDecl(pos) == LISPDECL_ASTERISK; } int type_range_p(addr pos) { CheckType(pos, LISPTYPE_TYPE); return decl_range_p(LowLispDecl(pos)); } int type_string_p(addr pos) { CheckType(pos, LISPTYPE_TYPE); switch (LowLispDecl(pos)) { case LISPDECL_STRING: case LISPDECL_BASE_STRING: case LISPDECL_SIMPLE_STRING: case LISPDECL_SIMPLE_BASE_STRING: return 1; default: return 0; } } /* * init */ void init_type(void) { init_type_coerce(); init_type_copy(); init_type_delay(); init_type_name(); init_type_object(); init_type_parse(); init_type_symbol(); init_type_typep(); init_type_value(); } void build_type(void) { build_type_table(); build_type_constant(); build_type_upgraded(); build_type_symbol(); build_type_parse(); }
c51908ea5a99344ef99dceaaf7e72cc0cc994eed
88ae8695987ada722184307301e221e1ba3cc2fa
/third_party/libdrm/src/freedreno/freedreno_ringbuffer.c
8f0093ae62a51de906d163c20306629bc4fc2ed0
[ "Apache-2.0", "LGPL-2.0-or-later", "MIT", "GPL-1.0-or-later", "BSD-3-Clause", "GPL-2.0-or-later" ]
permissive
iridium-browser/iridium-browser
71d9c5ff76e014e6900b825f67389ab0ccd01329
5ee297f53dc7f8e70183031cff62f37b0f19d25f
refs/heads/master
2023-08-03T16:44:16.844552
2023-07-20T15:17:00
2023-07-23T16:09:30
220,016,632
341
40
BSD-3-Clause
2021-08-13T13:54:45
2019-11-06T14:32:31
null
UTF-8
C
false
false
5,297
c
freedreno_ringbuffer.c
/* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */ /* * Copyright (C) 2012 Rob Clark <robclark@freedesktop.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 (including the next * paragraph) 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. * * Authors: * Rob Clark <robclark@freedesktop.org> */ #include <assert.h> #include "freedreno_drmif.h" #include "freedreno_priv.h" #include "freedreno_ringbuffer.h" drm_public struct fd_ringbuffer * fd_ringbuffer_new_flags(struct fd_pipe *pipe, uint32_t size, enum fd_ringbuffer_flags flags) { struct fd_ringbuffer *ring; /* we can't really support "growable" rb's in general for * stateobj's since we need a single gpu addr (ie. can't * do the trick of a chain of IB packets): */ if (flags & FD_RINGBUFFER_OBJECT) assert(size); ring = pipe->funcs->ringbuffer_new(pipe, size, flags); if (!ring) return NULL; ring->flags = flags; ring->pipe = pipe; ring->start = ring->funcs->hostptr(ring); ring->end = &(ring->start[ring->size/4]); ring->cur = ring->last_start = ring->start; return ring; } drm_public struct fd_ringbuffer * fd_ringbuffer_new(struct fd_pipe *pipe, uint32_t size) { return fd_ringbuffer_new_flags(pipe, size, 0); } drm_public struct fd_ringbuffer * fd_ringbuffer_new_object(struct fd_pipe *pipe, uint32_t size) { return fd_ringbuffer_new_flags(pipe, size, FD_RINGBUFFER_OBJECT); } drm_public void fd_ringbuffer_del(struct fd_ringbuffer *ring) { if (!atomic_dec_and_test(&ring->refcnt)) return; fd_ringbuffer_reset(ring); ring->funcs->destroy(ring); } drm_public struct fd_ringbuffer * fd_ringbuffer_ref(struct fd_ringbuffer *ring) { STATIC_ASSERT(sizeof(ring->refcnt) <= sizeof(ring->__pad)); atomic_inc(&ring->refcnt); return ring; } /* ringbuffers which are IB targets should set the toplevel rb (ie. * the IB source) as it's parent before emitting reloc's, to ensure * the bookkeeping works out properly. */ drm_public void fd_ringbuffer_set_parent(struct fd_ringbuffer *ring, struct fd_ringbuffer *parent) { /* state objects should not be parented! */ assert(!(ring->flags & FD_RINGBUFFER_OBJECT)); ring->parent = parent; } drm_public void fd_ringbuffer_reset(struct fd_ringbuffer *ring) { uint32_t *start = ring->start; if (ring->pipe->id == FD_PIPE_2D) start = &ring->start[0x140]; ring->cur = ring->last_start = start; if (ring->funcs->reset) ring->funcs->reset(ring); } drm_public int fd_ringbuffer_flush(struct fd_ringbuffer *ring) { return ring->funcs->flush(ring, ring->last_start, -1, NULL); } drm_public int fd_ringbuffer_flush2(struct fd_ringbuffer *ring, int in_fence_fd, int *out_fence_fd) { return ring->funcs->flush(ring, ring->last_start, in_fence_fd, out_fence_fd); } drm_public void fd_ringbuffer_grow(struct fd_ringbuffer *ring, uint32_t ndwords) { assert(ring->funcs->grow); /* unsupported on kgsl */ /* there is an upper bound on IB size, which appears to be 0x100000 */ if (ring->size < 0x100000) ring->size *= 2; ring->funcs->grow(ring, ring->size); ring->start = ring->funcs->hostptr(ring); ring->end = &(ring->start[ring->size/4]); ring->cur = ring->last_start = ring->start; } drm_public uint32_t fd_ringbuffer_timestamp(struct fd_ringbuffer *ring) { return ring->last_timestamp; } drm_public void fd_ringbuffer_reloc(struct fd_ringbuffer *ring, const struct fd_reloc *reloc) { assert(ring->pipe->gpu_id < 500); ring->funcs->emit_reloc(ring, reloc); } drm_public void fd_ringbuffer_reloc2(struct fd_ringbuffer *ring, const struct fd_reloc *reloc) { ring->funcs->emit_reloc(ring, reloc); } drm_public uint32_t fd_ringbuffer_cmd_count(struct fd_ringbuffer *ring) { if (!ring->funcs->cmd_count) return 1; return ring->funcs->cmd_count(ring); } drm_public uint32_t fd_ringbuffer_emit_reloc_ring_full(struct fd_ringbuffer *ring, struct fd_ringbuffer *target, uint32_t cmd_idx) { return ring->funcs->emit_reloc_ring(ring, target, cmd_idx); } drm_public uint32_t fd_ringbuffer_size(struct fd_ringbuffer *ring) { /* only really needed for stateobj ringbuffers, and won't really * do what you expect for growable rb's.. so lets just restrict * this to stateobj's for now: */ assert(ring->flags & FD_RINGBUFFER_OBJECT); return offset_bytes(ring->cur, ring->start); }
8d1e92081dc7b25cfee2222a768b087683a311ec
1efb2283837c9b70bc6449cec877799e4efa3268
/src/mpid/common/shm/mpidu_init_shm_alloc.c
f90e8fe92f00ae499176c091b9ae0c0cf7a1b9df
[ "mpich2" ]
permissive
pmodels/mpich
d2392e8e30536cad3e500c16aa1e71211101d83f
2d265f9f5f93ebdd07ad547423bc6212868262a4
refs/heads/main
2023-09-04T05:50:15.041823
2023-09-01T23:07:33
2023-09-01T23:07:33
70,918,679
506
313
NOASSERTION
2023-09-14T14:38:36
2016-10-14T14:39:42
C
UTF-8
C
false
false
6,752
c
mpidu_init_shm_alloc.c
/* * Copyright (C) by Argonne National Laboratory * See COPYRIGHT in top-level directory */ #include <mpidimpl.h> #include "mpl_shm.h" #include "mpidu_init_shm.h" #include "mpidu_shm_seg.h" #include <stdlib.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #include <errno.h> #if defined (HAVE_SYSV_SHARED_MEM) #include <sys/ipc.h> #include <sys/shm.h> #endif typedef struct memory_list { void *ptr; MPIDU_shm_seg_t *memory; struct memory_list *next; } memory_list_t; static memory_list_t *memory_head = NULL; static memory_list_t *memory_tail = NULL; static int check_alloc(MPIDU_shm_seg_t * memory); /* MPIDU_Init_shm_alloc(len, ptr_p) This function allocates a shared memory segment */ int MPIDU_Init_shm_alloc(size_t len, void **ptr) { int mpi_errno = MPI_SUCCESS, mpl_err = 0; void *current_addr; size_t segment_len = len; int local_rank = MPIR_Process.local_rank; int num_local = MPIR_Process.local_size; MPIDU_shm_seg_t *memory = NULL; memory_list_t *memory_node = NULL; MPIR_CHKPMEM_DECL(3); MPIR_FUNC_ENTER; MPIR_Assert(segment_len > 0); MPIR_CHKPMEM_MALLOC(memory, MPIDU_shm_seg_t *, sizeof(*memory), mpi_errno, "memory_handle", MPL_MEM_OTHER); MPIR_CHKPMEM_MALLOC(memory_node, memory_list_t *, sizeof(*memory_node), mpi_errno, "memory_node", MPL_MEM_OTHER); mpl_err = MPL_shm_hnd_init(&(memory->hnd)); MPIR_ERR_CHKANDJUMP(mpl_err, mpi_errno, MPI_ERR_OTHER, "**alloc_shar_mem"); memory->segment_len = segment_len; char *serialized_hnd = NULL; int serialized_hnd_size = 0; /* if there is only one process on this processor, don't use shared memory */ if (num_local == 1) { char *addr; MPIR_CHKPMEM_MALLOC(addr, char *, segment_len + MPIDU_SHM_CACHE_LINE_LEN, mpi_errno, "segment", MPL_MEM_SHM); memory->base_addr = addr; current_addr = (char *) (((uintptr_t) addr + (uintptr_t) MPIDU_SHM_CACHE_LINE_LEN - 1) & (~((uintptr_t) MPIDU_SHM_CACHE_LINE_LEN - 1))); memory->symmetrical = 1; } else { if (local_rank == 0) { /* root prepare shm segment */ mpl_err = MPL_shm_seg_create_and_attach(memory->hnd, memory->segment_len, (void **) &(memory->base_addr), 0); MPIR_ERR_CHKANDJUMP(mpl_err, mpi_errno, MPI_ERR_OTHER, "**alloc_shar_mem"); MPIR_Assert(MPIR_Process.node_local_map[0] == MPIR_Process.rank); mpl_err = MPL_shm_hnd_get_serialized_by_ref(memory->hnd, &serialized_hnd); MPIR_ERR_CHKANDJUMP(mpl_err, mpi_errno, MPI_ERR_OTHER, "**alloc_shar_mem"); serialized_hnd_size = strlen(serialized_hnd) + 1; /* add 1 for null char */ MPIDU_Init_shm_put(serialized_hnd, serialized_hnd_size); MPIDU_Init_shm_barrier(); } else { MPIDU_Init_shm_barrier(); MPIDU_Init_shm_query(0, (void **) &serialized_hnd); mpl_err = MPL_shm_hnd_deserialize(memory->hnd, serialized_hnd, strlen(serialized_hnd)); MPIR_ERR_CHKANDJUMP(mpl_err, mpi_errno, MPI_ERR_OTHER, "**alloc_shar_mem"); mpl_err = MPL_shm_seg_attach(memory->hnd, memory->segment_len, (void **) &memory->base_addr, 0); MPIR_ERR_CHKANDJUMP(mpl_err, mpi_errno, MPI_ERR_OTHER, "**attach_shar_mem"); } MPIDU_Init_shm_barrier(); if (local_rank == 0) { /* memory->hnd no longer needed */ mpl_err = MPL_shm_seg_remove(memory->hnd); MPIR_ERR_CHKANDJUMP(mpl_err, mpi_errno, MPI_ERR_OTHER, "**remove_shar_mem"); } current_addr = memory->base_addr; memory->symmetrical = 0; mpi_errno = check_alloc(memory); MPIR_ERR_CHECK(mpi_errno); } /* assign sections of the shared memory segment to their pointers */ *ptr = current_addr; memory_node->ptr = *ptr; memory_node->memory = memory; LL_APPEND(memory_head, memory_tail, memory_node); MPIR_CHKPMEM_COMMIT(); fn_exit: MPIR_FUNC_EXIT; return mpi_errno; fn_fail: /* --BEGIN ERROR HANDLING-- */ MPL_shm_seg_remove(memory->hnd); MPL_shm_hnd_finalize(&(memory->hnd)); MPIR_CHKPMEM_REAP(); goto fn_exit; /* --END ERROR HANDLING-- */ } /* MPIDU_SHM_Seg_free() free the shared memory segment */ int MPIDU_Init_shm_free(void *ptr) { int mpi_errno = MPI_SUCCESS, mpl_err = 0; MPIDU_shm_seg_t *memory = NULL; memory_list_t *el = NULL; MPIR_FUNC_ENTER; /* retrieve memory handle for baseaddr */ LL_FOREACH(memory_head, el) { if (el->ptr == ptr) { memory = el->memory; LL_DELETE(memory_head, memory_tail, el); MPL_free(el); break; } } MPIR_Assert(memory != NULL); if (MPIR_Process.local_size == 1) MPL_free(memory->base_addr); else { mpl_err = MPL_shm_seg_detach(memory->hnd, (void **) &(memory->base_addr), memory->segment_len); MPIR_ERR_CHKANDJUMP(mpl_err, mpi_errno, MPI_ERR_OTHER, "**detach_shar_mem"); } fn_exit: MPL_shm_hnd_finalize(&(memory->hnd)); MPL_free(memory); MPIR_FUNC_EXIT; return mpi_errno; fn_fail: goto fn_exit; } int MPIDU_Init_shm_is_symm(void *ptr) { int ret = -1; memory_list_t *el; /* retrieve memory handle for baseaddr */ LL_FOREACH(memory_head, el) { if (el->ptr == ptr) { ret = (el->memory->symmetrical) ? 1 : 0; break; } } return ret; } /* check_alloc() checks to see whether the shared memory segment is allocated at the same virtual memory address at each process. */ static int check_alloc(MPIDU_shm_seg_t * memory) { int mpi_errno = MPI_SUCCESS; int is_sym; void *baseaddr; MPIR_FUNC_ENTER; if (MPIR_Process.local_rank == 0) { MPIDU_Init_shm_put(memory->base_addr, sizeof(void *)); } MPIDU_Init_shm_barrier(); MPIDU_Init_shm_get(0, sizeof(void *), &baseaddr); if (baseaddr == memory->base_addr) { is_sym = 1; MPIDU_Init_shm_put(&is_sym, sizeof(int)); } else { is_sym = 0; MPIDU_Init_shm_put(&is_sym, sizeof(int)); } MPIDU_Init_shm_barrier(); for (int i = 0; i < MPIR_Process.local_size; i++) { MPIDU_Init_shm_get(i, sizeof(int), &is_sym); if (is_sym == 0) break; } if (is_sym) { memory->symmetrical = 1; } else { memory->symmetrical = 0; } MPIR_FUNC_EXIT; return mpi_errno; }
fb3c4443b7d3621a05c87f50af1059351752f772
8838eb997879add5759b6dfb23f9a646464e53ca
/src/compat/posix/net/getservbyname.c
ab9050fff10dafb0dbd46eddee8c3c85e5441632
[ "BSD-2-Clause" ]
permissive
embox/embox
d6aacec876978522f01cdc4b8de37a668c6f4c80
98e3c06e33f3fdac10a29c069c20775568e0a6d1
refs/heads/master
2023-09-04T03:02:20.165042
2023-09-02T14:55:31
2023-09-02T14:55:31
33,078,138
1,087
325
BSD-2-Clause
2023-09-14T16:58:34
2015-03-29T15:27:48
C
UTF-8
C
false
false
819
c
getservbyname.c
/** * @file * @brief * * @date 29.03.13 * @author Ilia Vaprol */ #include <stddef.h> #include <string.h> #include <netdb.h> struct servent * getservbyname(const char *name, const char *proto) { struct servent *se; char **aliases; if ((name == NULL) || (proto == NULL)) { return NULL; } setservent(1); while ((se = getservent()) != NULL) { /* same protocol? */ if (strcmp(proto, se->s_proto) != 0) { continue; /* not same. try again */ } /* mb it's the official name? */ if (strcmp(name, se->s_name) == 0) { break; } /* mb it's one of the alternative name? */ for (aliases = se->s_aliases; *aliases != NULL; ++aliases) { if (strcmp(name, *aliases) == 0) { break; } } if (*aliases != NULL) { break; } /* nope. try again */ } endservent(); return se; }
25728064634a9b1ac88ff567617f3aacd97cb3f3
2b4867ce106d3068b67f2244019247df9cf6f341
/tests/runner-tests/expr/xor/3.c
e44100fa55e5da0660a553012de4c3e264eaa14c
[ "BSD-3-Clause" ]
permissive
jyn514/saltwater
d22b29ac40a4e3deb6128d904759d9183f081ab4
097c72d30e325de57fbed8a506431754a0560374
refs/heads/master
2023-05-09T05:44:43.147928
2021-06-03T02:53:32
2021-06-03T02:53:32
190,940,981
131
25
BSD-3-Clause
2021-04-07T22:58:39
2019-06-08T22:26:45
Rust
UTF-8
C
false
false
41
c
3.c
// fail int main() { return 5.2 ^ 1.2; }
4f530369b284f06918f881d34199b3fbb4d71c03
3bd385b466cb035fecd2b0c11ae054d42bf44fc2
/src/core/queue_api.h
8d5e595fd081de4863e60dc6ce1af65a4213167c
[ "LicenseRef-scancode-unknown-license-reference", "ISC", "BSD-2-Clause", "LicenseRef-scancode-mit-old-style", "Zlib", "MIT", "BSD-3-Clause", "bzip2-1.0.6" ]
permissive
genometools/genometools
c366dff04f6baa887f6b3be3ec55bce824b2bae1
df1df94b8c05a9c9bf848ffc6755c87b58573da5
refs/heads/master
2023-04-13T13:57:18.748796
2023-04-09T21:29:53
2023-04-09T21:29:53
11,177,980
237
63
NOASSERTION
2023-04-09T21:29:54
2013-07-04T13:39:38
C
UTF-8
C
false
false
2,080
h
queue_api.h
/* Copyright (c) 2008, 2011 Gordon Gremme <gordon@gremme.org> Copyright (c) 2008 Center for Bioinformatics, University of Hamburg 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. */ #ifndef QUEUE_API_H #define QUEUE_API_H #include <stdio.h> #include "core/error_api.h" #include "core/types_api.h" /* <GtQueue> objects are generic queues which can be used to process objects of any type in an First-In-First-Out (FIFO) fashion. */ typedef struct GtQueue GtQueue; /* Return a new <GtQueue> object. */ GtQueue* gt_queue_new(void); /* Add <elem> to <queue> (__enqueue__ in computer science terminology). */ void gt_queue_add(GtQueue *queue, void *elem); /* Remove the first element from non-empty <queue> and return it (__dequeue__ in computer science terminology). */ void* gt_queue_get(GtQueue *queue); /* Return the first element in non-empty <queue> without removing it. */ void* gt_queue_head(GtQueue *queue); /* Remove <elem> from <queue> (<elem> has to be in <queue>). Thereby <queue> is traversed in reverse order, leading to O(<gt_queue_size(queue)>) worst-case running time. */ void gt_queue_remove(GtQueue *queue, void *elem); /* Return the number of elements in <queue>. */ GtUword gt_queue_size(const GtQueue *queue); /* Delete <queue>. Elements contained in <queue> are not freed! */ void gt_queue_delete(GtQueue *queue); #endif
f5fad628e8bac0543f3bcc495913508c82301cf1
673b3a4e8be3cc5e6997cd215cb5b9e2eaeca8b6
/core/cmd_continue.c
7f863286c853d501299f2a516aba7648b7db26dd
[ "Apache-2.0" ]
permissive
adamgreen/mri
c0bf4c1610003fd216fe506e8cb79a735442daa4
5d7e4dfcef0f5c59d78844bf63ae11136cd1656e
refs/heads/master
2023-08-19T18:22:30.128341
2023-08-14T20:56:29
2023-08-14T20:56:29
4,280,328
124
47
Apache-2.0
2023-07-01T07:40:30
2012-05-10T04:40:49
C
UTF-8
C
false
false
4,219
c
cmd_continue.c
/* Copyright 2020 Adam Green (https://github.com/adamgreen/) 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. */ /* Handler for continue gdb command. */ #include <core/buffer.h> #include <core/core.h> #include <core/platforms.h> #include <core/mri.h> #include <core/cmd_common.h> #include <core/cmd_continue.h> static int shouldSkipHardcodedBreakpoint(void); static int isCurrentInstructionHardcodedBreakpoint(void); uint32_t ContinueExecution(int setPC, uint32_t newPC) { if (Platform_RtosIsSetThreadStateSupported()) Platform_RtosSetThreadState(MRI_PLATFORM_ALL_THREADS, MRI_PLATFORM_THREAD_THAWED); uint32_t returnValue = SkipHardcodedBreakpoint(); if (setPC) Platform_SetProgramCounter(newPC); return (returnValue | HANDLER_RETURN_RESUME_PROGRAM | HANDLER_RETURN_RETURN_IMMEDIATELY); } uint32_t SkipHardcodedBreakpoint(void) { if (shouldSkipHardcodedBreakpoint()) { Platform_AdvanceProgramCounterToNextInstruction(); return HANDLER_RETURN_SKIPPED_OVER_BREAK; } return 0; } static int shouldSkipHardcodedBreakpoint(void) { return !Platform_WasProgramCounterModifiedByUser() && isCurrentInstructionHardcodedBreakpoint(); } static int isCurrentInstructionHardcodedBreakpoint(void) { return Platform_TypeOfCurrentInstruction() == MRI_PLATFORM_INSTRUCTION_HARDCODED_BREAKPOINT; } /* Handle the 'c' command which is sent from gdb to tell the debugger to continue execution of the currently halted program. Command Format: cAAAAAAAA Response Format: Blank until the next exception, at which time a 'T' stop response packet will be sent. Where AAAAAAAA is an optional value to be used for the Program Counter when restarting the program. */ uint32_t HandleContinueCommand(void) { Buffer* pBuffer = GetBuffer(); int setPC = 0; uint32_t newPC = 0; /* New program counter value is optional parameter. */ __try { __throwing_func( newPC = ReadUIntegerArgument(pBuffer) ); setPC = 1; } __catch { clearExceptionCode(); } return ContinueExecution(setPC, newPC); } /* Handle the 'C' command which is sent from gdb to tell the debugger to continue execution of the currently halted program. It is similar to the 'c' command but it also provides a signal level, which MRI ignores. Command Format: cAA;BBBBBBBB Response Format: Blank until the next exception, at which time a 'T' stop response packet will be sent. Where AA is the signal to be set, and BBBBBBBB is an optional value to be used for the Program Counter when restarting the program. */ uint32_t HandleContinueWithSignalCommand(void) { Buffer* pBuffer = GetBuffer(); int setPC = 0; uint32_t newPC = 0; __try { /* Fetch signal value but ignore it. */ __throwing_func( ReadUIntegerArgument(pBuffer) ); if (Buffer_BytesLeft(pBuffer) && Buffer_IsNextCharEqualTo(pBuffer, ';')) { __throwing_func( newPC = ReadUIntegerArgument(pBuffer) ); setPC = 1; } } __catch { PrepareStringResponse(MRI_ERROR_INVALID_ARGUMENT); return 0; } return ContinueExecution(setPC, newPC); } /* Handle the 'D' command which is sent from gdb to resume execution before it detaches and exits. Command Format: D Response Format: OK */ uint32_t HandleDetachCommand(void) { if (Platform_RtosIsSetThreadStateSupported()) Platform_RtosSetThreadState(MRI_PLATFORM_ALL_THREADS, MRI_PLATFORM_THREAD_THAWED); SkipHardcodedBreakpoint(); PrepareStringResponse("OK"); return HANDLER_RETURN_RESUME_PROGRAM; }
921c86e5c3c6c09b06a3f821b175f25b9a48f8b8
bf29e10264b10d4b1846f6eb2505f4980bb6c69e
/edk2-rockchip/Platform/Rockchip/Rk356x/Drivers/FdtDxe/FdtDxe.c
8bc8d3fb769a4b411a338233d0844eee22bf74df
[]
no_license
jaredmcneill/quartz64_uefi
580527186654bb81e0d831234a716c18988ac46a
b6eb13d46bf9b9c5cf2d98f153cf27da50355363
refs/heads/main
2023-07-07T23:11:08.530886
2023-06-02T08:55:32
2023-06-02T08:55:32
432,544,722
110
53
null
2023-09-03T10:48:27
2021-11-27T19:07:03
C
UTF-8
C
false
false
4,970
c
FdtDxe.c
/** @file * * Copyright (c) 2021, Jared McNeill <jmcneill@invisible.ca> * Copyright (c) 2017,2021 Andrey Warkentin <andrey.warkentin@gmail.com> * Copyright (c) 2016, Linaro, Ltd. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * **/ #include <PiDxe.h> #include <Library/BaseLib.h> #include <Library/DebugLib.h> #include <Library/PrintLib.h> #include <Library/DxeServicesLib.h> #include <Library/MemoryAllocationLib.h> #include <Library/UefiBootServicesTableLib.h> #include <Library/UefiLib.h> #include <IndustryStandard/Rk356x.h> #include <libfdt.h> #include <Guid/Fdt.h> #include <ConfigVars.h> STATIC VOID *mFdtImage; STATIC EFI_STATUS CleanMemoryNodes ( VOID ) { INTN Node; INT32 Retval; Node = fdt_path_offset (mFdtImage, "/memory"); if (Node < 0) { return EFI_SUCCESS; } /* * Remove bogus memory nodes which can make the booted * OS go crazy and ignore the UEFI map. */ DEBUG ((DEBUG_INFO, "Removing bogus /memory\n")); Retval = fdt_del_node (mFdtImage, Node); if (Retval != 0) { DEBUG ((DEBUG_ERROR, "Failed to remove /memory\n")); return EFI_NOT_FOUND; } return EFI_SUCCESS; } STATIC EFI_STATUS FixUartSpeed ( VOID ) { INTN Node; const char *StdOutPath; char Buf[80]; UINT8 UartIndex; Node = fdt_path_offset (mFdtImage, "/chosen"); if (Node < 0) { return EFI_SUCCESS; } StdOutPath = fdt_getprop (mFdtImage, Node, "stdout-path", NULL); if (StdOutPath == NULL) { return EFI_SUCCESS; } if (FixedPcdGet64 (PcdSerialRegisterBase) == UART_BASE (0)) { UartIndex = 0; } else { UartIndex = 1 + (FixedPcdGet64 (PcdSerialRegisterBase) - UART_BASE (1)) / 0x10000; } AsciiSPrint (Buf, sizeof (Buf), "serial%u:%lun8", UartIndex, FixedPcdGet64 (PcdUartDefaultBaudRate)); fdt_setprop_string (mFdtImage, Node, "stdout-path", Buf); return EFI_SUCCESS; } #ifdef QUARTZ64 STATIC EFI_STATUS FixMultiPhy1Mode ( VOID ) { INTN Node; Node = fdt_path_offset (mFdtImage, "/sata@fc400000"); if (Node < 0) { DEBUG ((DEBUG_ERROR, "Node /sata@fc400000 not found")); return EFI_SUCCESS; } fdt_setprop_string (mFdtImage, Node, "status", PcdGet32 (PcdMultiPhy1Mode) == MULTIPHY_MODE_SEL_SATA ? "okay" : "disabled"); Node = fdt_path_offset (mFdtImage, "/usb@fd000000"); if (Node < 0) { DEBUG ((DEBUG_ERROR, "Node /usb@fd000000 not found")); return EFI_SUCCESS; } fdt_setprop_string (mFdtImage, Node, "status", PcdGet32 (PcdMultiPhy1Mode) == MULTIPHY_MODE_SEL_USB3 ? "okay" : "disabled"); return EFI_SUCCESS; } #endif /** @param ImageHandle of the loaded driver @param SystemTable Pointer to the System Table @retval EFI_SUCCESS Protocol registered @retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure @retval EFI_DEVICE_ERROR Hardware problems **/ EFI_STATUS EFIAPI FdtDxeInitialize ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { INT32 Retval; EFI_STATUS Status; UINTN FdtSize; VOID *FdtImage = NULL; switch (PcdGet32 (PcdSystemTableMode)) { case SYSTEM_TABLE_MODE_BOTH: case SYSTEM_TABLE_MODE_DT: break; default: DEBUG ((DEBUG_ERROR, "Not installing FDT (user config)\n")); return EFI_SUCCESS; } FdtImage = (VOID*)(UINTN)PcdGet64 (PcdFdtBaseAddress); Retval = fdt_check_header (FdtImage); if (Retval != 0) { DEBUG ((DEBUG_ERROR, "No devicetree passed from loader.\n")); return EFI_NOT_FOUND; } FdtSize = fdt_totalsize (FdtImage); /* * Probably overkill. */ FdtSize += EFI_PAGE_SIZE * 2; Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesData, EFI_SIZE_TO_PAGES (FdtSize), (EFI_PHYSICAL_ADDRESS*)&mFdtImage); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "Failed to allocate devicetree: %r\n", Status)); goto out; } Retval = fdt_open_into (FdtImage, mFdtImage, FdtSize); if (Retval != 0) { DEBUG ((DEBUG_ERROR, "fdt_open_into failed: %d\n", Retval)); goto out; } /* * These are all best-effort. */ Status = CleanMemoryNodes (); if (EFI_ERROR (Status)) { Print (L"Failed to clean memory nodes: %r\n", Status); } Status = FixUartSpeed (); if (EFI_ERROR (Status)) { Print (L"Failed to fix UART speed: %r\n", Status); } #ifdef QUARTZ64 Status = FixMultiPhy1Mode (); if (EFI_ERROR (Status)) { Print (L"Failed to fix MULTI-PHY1 mode: %r\n", Status); } #endif DEBUG ((DEBUG_INFO, "Installed devicetree at address %p\n", mFdtImage)); Status = gBS->InstallConfigurationTable (&gFdtTableGuid, mFdtImage); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "Couldn't register devicetree: %r\n", Status)); goto out; } out: if (EFI_ERROR(Status)) { if (mFdtImage != NULL) { gBS->FreePages ((EFI_PHYSICAL_ADDRESS) mFdtImage, EFI_SIZE_TO_PAGES (FdtSize)); } } return Status; }
82990239487d5d0c33eaf53c2ad0561cb02c8e57
7664f318ed04bd0680f3d82321c18896e3ef6ad5
/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c
d720145e2e579a2fb8fd3d5d74417adae37f9dee
[]
no_license
zeldaret/oot
9c80ce17f2d8fd61514b375f92ee4739b5ce9d4e
2875ab4fcf5c5f81d76353d1ee0024c9ea8d0b23
refs/heads/master
2023-08-29T05:29:31.356427
2023-08-28T22:48:52
2023-08-28T22:48:52
247,875,738
4,401
802
null
2023-09-14T13:34:38
2020-03-17T04:02:19
C
UTF-8
C
false
false
12,604
c
z_obj_tsubo.c
/* * File: z_obj_tsubo.c * Overlay: ovl_Obj_Tsubo * Description: Breakable pot */ #include "z_obj_tsubo.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "assets/objects/object_tsubo/object_tsubo.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_23) void ObjTsubo_Init(Actor* thisx, PlayState* play); void ObjTsubo_Destroy(Actor* thisx, PlayState* play2); void ObjTsubo_Update(Actor* thisx, PlayState* play); void ObjTsubo_Draw(Actor* thisx, PlayState* play); void ObjTsubo_SpawnCollectible(ObjTsubo* this, PlayState* play); void ObjTsubo_ApplyGravity(ObjTsubo* this); s32 ObjTsubo_SnapToFloor(ObjTsubo* this, PlayState* play); void ObjTsubo_InitCollider(Actor* thisx, PlayState* play); void ObjTsubo_AirBreak(ObjTsubo* this, PlayState* play); void ObjTsubo_WaterBreak(ObjTsubo* this, PlayState* play); void ObjTsubo_SetupWaitForObject(ObjTsubo* this); void ObjTsubo_WaitForObject(ObjTsubo* this, PlayState* play); void ObjTsubo_SetupIdle(ObjTsubo* this); void ObjTsubo_Idle(ObjTsubo* this, PlayState* play); void ObjTsubo_SetupLiftedUp(ObjTsubo* this); void ObjTsubo_LiftedUp(ObjTsubo* this, PlayState* play); void ObjTsubo_SetupThrown(ObjTsubo* this); void ObjTsubo_Thrown(ObjTsubo* this, PlayState* play); static s16 D_80BA1B50 = 0; static s16 D_80BA1B54 = 0; static s16 D_80BA1B58 = 0; static s16 D_80BA1B5C = 0; ActorInit Obj_Tsubo_InitVars = { ACTOR_OBJ_TSUBO, ACTORCAT_PROP, FLAGS, OBJECT_GAMEPLAY_KEEP, sizeof(ObjTsubo), (ActorFunc)ObjTsubo_Init, (ActorFunc)ObjTsubo_Destroy, (ActorFunc)ObjTsubo_Update, NULL, }; static s16 sObjectIds[] = { OBJECT_GAMEPLAY_DANGEON_KEEP, OBJECT_TSUBO }; static Gfx* D_80BA1B84[] = { gPotDL, object_tsubo_DL_0017C0 }; static Gfx* D_80BA1B8C[] = { gPotFragmentDL, object_tsubo_DL_001960 }; static ColliderCylinderInit sCylinderInit = { { COLTYPE_HARD, AT_ON | AT_TYPE_PLAYER, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_2, COLSHAPE_CYLINDER, }, { ELEMTYPE_UNK0, { 0x00000002, 0x00, 0x01 }, { 0x4FC1FFFE, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, { 9, 26, 0, { 0, 0, 0 } }, }; static CollisionCheckInfoInit sColChkInfoInit[] = { 0, 12, 60, MASS_IMMOVABLE }; static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -1200, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(minVelocityY, -20000, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 150, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 900, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), }; void ObjTsubo_SpawnCollectible(ObjTsubo* this, PlayState* play) { s16 dropParams = this->actor.params & 0x1F; if ((dropParams >= 0) && (dropParams < ITEM00_MAX)) { Item_DropCollectible(play, &this->actor.world.pos, (dropParams | (((this->actor.params >> 9) & 0x3F) << 8))); } } void ObjTsubo_ApplyGravity(ObjTsubo* this) { this->actor.velocity.y += this->actor.gravity; if (this->actor.velocity.y < this->actor.minVelocityY) { this->actor.velocity.y = this->actor.minVelocityY; } } s32 ObjTsubo_SnapToFloor(ObjTsubo* this, PlayState* play) { CollisionPoly* groundPoly; Vec3f pos; s32 bgId; f32 groundY; pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 20.0f; pos.z = this->actor.world.pos.z; groundY = BgCheck_EntityRaycastDown4(&play->colCtx, &groundPoly, &bgId, &this->actor, &pos); if (groundY > BGCHECK_Y_MIN) { this->actor.world.pos.y = groundY; Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); return true; } else { osSyncPrintf("地面に付着失敗\n"); return false; } } void ObjTsubo_InitCollider(Actor* thisx, PlayState* play) { ObjTsubo* this = (ObjTsubo*)thisx; Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); } void ObjTsubo_Init(Actor* thisx, PlayState* play) { ObjTsubo* this = (ObjTsubo*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ObjTsubo_InitCollider(&this->actor, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, sColChkInfoInit); if (!ObjTsubo_SnapToFloor(this, play)) { Actor_Kill(&this->actor); return; } this->objTsuboBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[(this->actor.params >> 8) & 1]); if (this->objTsuboBankIndex < 0) { osSyncPrintf("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", this->actor.params, "../z_obj_tsubo.c", 410); Actor_Kill(&this->actor); } else { ObjTsubo_SetupWaitForObject(this); osSyncPrintf("(dungeon keep 壷)(arg_data 0x%04x)\n", this->actor.params); } } void ObjTsubo_Destroy(Actor* thisx, PlayState* play2) { PlayState* play = play2; ObjTsubo* this = (ObjTsubo*)thisx; Collider_DestroyCylinder(play, &this->collider); } void ObjTsubo_AirBreak(ObjTsubo* this, PlayState* play) { s32 pad; f32 rand; s16 angle; Vec3f pos; Vec3f velocity; f32 sins; f32 coss; s32 arg5; s32 i; for (i = 0, angle = 0; i < 15; i++, angle += 0x4E20) { sins = Math_SinS(angle); coss = Math_CosS(angle); pos.x = sins * 8.0f; pos.y = (Rand_ZeroOne() * 5.0f) + 2.0f; pos.z = coss * 8.0f; velocity.x = pos.x * 0.23f; velocity.y = (Rand_ZeroOne() * 5.0f) + 2.0f; velocity.z = pos.z * 0.23f; Math_Vec3f_Sum(&pos, &this->actor.world.pos, &pos); rand = Rand_ZeroOne(); if (rand < 0.2f) { arg5 = 96; } else if (rand < 0.6f) { arg5 = 64; } else { arg5 = 32; } EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -240, arg5, 10, 10, 0, (Rand_ZeroOne() * 95.0f) + 15.0f, 0, 32, 60, KAKERA_COLOR_NONE, sObjectIds[(this->actor.params >> 8) & 1], D_80BA1B8C[(this->actor.params >> 8) & 1]); } func_80033480(play, &this->actor.world.pos, 30.0f, 4, 20, 50, 1); } void ObjTsubo_WaterBreak(ObjTsubo* this, PlayState* play) { s32 pad[2]; s16 angle; Vec3f pos = this->actor.world.pos; Vec3f velocity; s32 phi_s0; s32 i; pos.y += this->actor.yDistToWater; EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 400); for (i = 0, angle = 0; i < 15; i++, angle += 0x4E20) { f32 sins = Math_SinS(angle); f32 coss = Math_CosS(angle); pos.x = sins * 8.0f; pos.y = (Rand_ZeroOne() * 5.0f) + 2.0f; pos.z = coss * 8.0f; velocity.x = pos.x * 0.2f; velocity.y = (Rand_ZeroOne() * 4.0f) + 2.0f; velocity.z = pos.z * 0.2f; Math_Vec3f_Sum(&pos, &this->actor.world.pos, &pos); phi_s0 = (Rand_ZeroOne() < .2f) ? 64 : 32; EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -180, phi_s0, 30, 30, 0, (Rand_ZeroOne() * 95.0f) + 15.0f, 0, 32, 70, KAKERA_COLOR_NONE, sObjectIds[(this->actor.params >> 8) & 1], D_80BA1B8C[(this->actor.params >> 8) & 1]); } } void ObjTsubo_SetupWaitForObject(ObjTsubo* this) { this->actionFunc = ObjTsubo_WaitForObject; } void ObjTsubo_WaitForObject(ObjTsubo* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->objTsuboBankIndex)) { this->actor.draw = ObjTsubo_Draw; this->actor.objBankIndex = this->objTsuboBankIndex; ObjTsubo_SetupIdle(this); this->actor.flags &= ~ACTOR_FLAG_4; } } void ObjTsubo_SetupIdle(ObjTsubo* this) { this->actionFunc = ObjTsubo_Idle; } void ObjTsubo_Idle(ObjTsubo* this, PlayState* play) { s32 pad; s16 temp_v0; s32 phi_v1; if (Actor_HasParent(&this->actor, play)) { ObjTsubo_SetupLiftedUp(this); } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.yDistToWater > 15.0f)) { ObjTsubo_WaterBreak(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); ObjTsubo_SpawnCollectible(this, play); Actor_Kill(&this->actor); } else if ((this->collider.base.acFlags & AC_HIT) && (this->collider.info.acHitInfo->toucher.dmgFlags & (DMG_SWORD | DMG_RANGED | DMG_HAMMER | DMG_BOOMERANG | DMG_EXPLOSIVE))) { ObjTsubo_AirBreak(this, play); ObjTsubo_SpawnCollectible(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); Actor_Kill(&this->actor); } else { if (this->actor.xzDistToPlayer < 600.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.base.acFlags &= ~AC_HIT; CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 150.0f) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } if (this->actor.xzDistToPlayer < 100.0f) { temp_v0 = this->actor.yawTowardsPlayer - GET_PLAYER(play)->actor.world.rot.y; phi_v1 = ABS(temp_v0); if (phi_v1 >= 0x5556) { // GI_NONE in this case allows the player to lift the actor Actor_OfferGetItem(&this->actor, play, GI_NONE, 30.0f, 30.0f); } } } } void ObjTsubo_SetupLiftedUp(ObjTsubo* this) { this->actionFunc = ObjTsubo_LiftedUp; this->actor.room = -1; //! @bug: This is an unsafe cast, although the sound effect will still play Player_PlaySfx((Player*)&this->actor, NA_SE_PL_PULL_UP_POT); this->actor.flags |= ACTOR_FLAG_4; } void ObjTsubo_LiftedUp(ObjTsubo* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { this->actor.room = play->roomCtx.curRoom.num; ObjTsubo_SetupThrown(this); ObjTsubo_ApplyGravity(this); Actor_UpdatePos(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 15.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_7); } } void ObjTsubo_SetupThrown(ObjTsubo* this) { this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speed; this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speed; this->actor.colChkInfo.mass = 240; D_80BA1B50 = (Rand_ZeroOne() - 0.7f) * 2800.0f; D_80BA1B58 = (Rand_ZeroOne() - 0.5f) * 2000.0f; D_80BA1B54 = 0; D_80BA1B5C = 0; this->actionFunc = ObjTsubo_Thrown; } void ObjTsubo_Thrown(ObjTsubo* this, PlayState* play) { s32 pad[2]; if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) || (this->collider.base.atFlags & AT_HIT)) { ObjTsubo_AirBreak(this, play); ObjTsubo_SpawnCollectible(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); Actor_Kill(&this->actor); } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { ObjTsubo_WaterBreak(this, play); ObjTsubo_SpawnCollectible(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); Actor_Kill(&this->actor); } else { ObjTsubo_ApplyGravity(this); Actor_UpdatePos(&this->actor); Math_StepToS(&D_80BA1B54, D_80BA1B50, 0x64); Math_StepToS(&D_80BA1B5C, D_80BA1B58, 0x64); this->actor.shape.rot.x += D_80BA1B54; this->actor.shape.rot.y += D_80BA1B5C; Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 15.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_7); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } void ObjTsubo_Update(Actor* thisx, PlayState* play) { ObjTsubo* this = (ObjTsubo*)thisx; this->actionFunc(this, play); } void ObjTsubo_Draw(Actor* thisx, PlayState* play) { Gfx_DrawDListOpa(play, D_80BA1B84[(thisx->params >> 8) & 1]); }
95fa21d5c9f7bee446d95db6eaa27f2a5653fa05
d98fabe043b9affe6162714b7fef77213d92391d
/src/hex_dump.h
4984fc932b201db312d77099671449c18ab9ba01
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "Zlib", "MIT", "BSD-3-Clause" ]
permissive
eBay/Jungle
567c32d0b676b8c8e25c0d20931e458706b94832
596733e370186c3319238a10f1f033ac840e4dcb
refs/heads/master
2023-09-02T12:20:44.607754
2023-08-23T21:06:28
2023-08-23T21:06:28
230,492,612
188
45
Apache-2.0
2023-09-05T23:24:12
2019-12-27T18:09:50
C++
UTF-8
C
false
false
7,957
h
hex_dump.h
/************************************************************************ Modifications Copyright 2017-2019 eBay Inc. Original Copyright: See URL: https://github.com/greensky00/hex-dump (v0.1.8) 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 https://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. **************************************************************************/ #pragma once #include <inttypes.h> #include <stdio.h> #include <stdint.h> #include <string.h> #ifndef _CLM_DEFINED #define _CLM_DEFINED (1) #ifdef HEX_DUMP_NO_COLOR #define _CLM_D_GRAY "" #define _CLM_GREEN "" #define _CLM_B_GREEN "" #define _CLM_RED "" #define _CLM_B_RED "" #define _CLM_BROWN "" #define _CLM_B_BROWN "" #define _CLM_BLUE "" #define _CLM_B_BLUE "" #define _CLM_MAGENTA "" #define _CLM_B_MAGENTA "" #define _CLM_CYAN "" #define _CLM_END "" #define _CLM_WHITE_FG_RED_BG "" #else #define _CLM_D_GRAY "\033[1;30m" #define _CLM_GREEN "\033[32m" #define _CLM_B_GREEN "\033[1;32m" #define _CLM_RED "\033[31m" #define _CLM_B_RED "\033[1;31m" #define _CLM_BROWN "\033[33m" #define _CLM_B_BROWN "\033[1;33m" #define _CLM_BLUE "\033[34m" #define _CLM_B_BLUE "\033[1;34m" #define _CLM_MAGENTA "\033[35m" #define _CLM_B_MAGENTA "\033[1;35m" #define _CLM_CYAN "\033[36m" #define _CLM_B_GREY "\033[1;37m" #define _CLM_END "\033[0m" #define _CLM_WHITE_FG_RED_BG "\033[37;41m" #endif #define _CL_D_GRAY(str) _CLM_D_GRAY str _CLM_END #define _CL_GREEN(str) _CLM_GREEN str _CLM_END #define _CL_RED(str) _CLM_RED str _CLM_END #define _CL_B_RED(str) _CLM_B_RED str _CLM_END #define _CL_MAGENTA(str) _CLM_MAGENTA str _CLM_END #define _CL_BROWN(str) _CLM_BROWN str _CLM_END #define _CL_B_BROWN(str) _CLM_B_BROWN str _CLM_END #define _CL_B_BLUE(str) _CLM_B_BLUE str _CLM_END #define _CL_B_MAGENTA(str) _CLM_B_MAGENTA str _CLM_END #define _CL_CYAN(str) _CLM_CYAN str _CLM_END #define _CL_B_GRAY(str) _CLM_B_GREY str _CLM_END #define _CL_WHITE_FG_RED_BG(str) _CLM_WHITE_FG_RED_BG str _CLM_END #endif // LCOV_EXCL_START struct print_hex_options { // If set, print colorful hex dump using ANSI color codes. int enable_colors; // If set, print actual memory address. int actual_address; // The number of bytes per line. int align; }; #define PRINT_HEX_OPTIONS_INITIALIZER \ (struct print_hex_options){1, 1, 16} static void _print_white_space(FILE* stream, size_t len) { for (size_t i=0; i<len; ++i) { fprintf(stream, " "); } } static void __attribute__((unused)) print_hex_stream(FILE* stream, const void* buf, size_t buflen, struct print_hex_options options) { size_t i, j; size_t max_addr_len; char str_buffer[256]; // Check if buffer is empty. if (!buf || buflen == 0) { fprintf(stream, "%p, %zu\n", buf, buflen); return; } // Get the longest address string length if (options.actual_address) { sprintf(str_buffer, "%p", (char*)buf + buflen); } else { sprintf(str_buffer, "0x%zx", buflen); } max_addr_len = strlen(str_buffer); // Header (address, length) fprintf(stream, (options.enable_colors) ? _CL_B_RED("%p") " -- " _CL_B_RED("%p") : "%p -- %p", buf, (char*)buf + buflen - 1); fprintf(stream, ", %zu (0x%zx) bytes\n", buflen, buflen); // Legend _print_white_space(stream, max_addr_len); fprintf(stream, " "); for (i = 0; i < (size_t)options.align; ++i) { if (options.align <= 16) { fprintf(stream, (options.enable_colors) ? _CL_CYAN(" %x ") : " %x ", (int)i); } else { fprintf(stream, (options.enable_colors) ? _CL_CYAN("%02x ") : "%02x ", (int)i); } if ((i + 1) % 8 == 0) { fprintf(stream, " "); } } fprintf(stream, "\n"); size_t surplus_bytes = 0; uint64_t start_address = (uint64_t)buf; if (options.actual_address) { // In actual address mode, we do not start from the // leftmost spot as address might not be aligned. // In this case, calculate the 'surplus_bytes', // which denotes the number of bytes to be skipped. start_address /= options.align; start_address *= options.align; surplus_bytes = (uint64_t)buf - start_address; } for (i = 0; i < buflen + surplus_bytes; i += options.align) { // Address if (options.actual_address) { sprintf(str_buffer, "%p", (char*)start_address + i); } else { sprintf(str_buffer, "0x%x", (int)i); } _print_white_space(stream, max_addr_len - strlen(str_buffer)); fprintf(stream, (options.enable_colors) ? _CL_CYAN("%s ") : "%s ", str_buffer); // Hex part for (j = i; j < i+options.align; ++j){ if (j < buflen + surplus_bytes && start_address + j >= (uint64_t)buf && start_address + j < (uint64_t)buf + buflen) { uint64_t idx = j - surplus_bytes; fprintf(stream, (options.enable_colors) ? _CL_GREEN("%02x ") : "%02x ", ((uint8_t*)buf)[idx]); } else { fprintf(stream, " "); } if ((j + 1) % 8 == 0) { fprintf(stream, " "); } } // Ascii character part fprintf(stream, " "); for (j = i; j < i+options.align; ++j){ if (j < buflen + surplus_bytes && start_address + j >= (uint64_t)buf && start_address + j < (uint64_t)buf + buflen) { uint64_t idx = j - surplus_bytes; // print only readable ascii character if (0x20 <= ((char*)buf)[idx] && ((char*)buf)[idx] <= 0x7d) { // Printable character fprintf(stream, (options.enable_colors) ? _CL_B_BLUE("%c") : "%c", ((char*)buf)[idx]); } else { // Otherwise fprintf(stream, "."); } } else { fprintf(stream, " "); } } fprintf(stream, "\n"); } } static void __attribute__((unused)) print_hex_to_buf(char** output_buf, size_t* output_buf_len, const void* buf, size_t buflen, struct print_hex_options options) { FILE* stream; stream = open_memstream(output_buf, output_buf_len); print_hex_stream(stream, buf, buflen, options); fflush(stream); fclose(stream); } // LCOV_EXCL_STOP
7124095115da4b891a3e76a62e55efed5bb4ccf7
e8b04bef9aa1ac8e2c109dd315f133c8f4d28ae6
/projects/samples/devices/controllers/encoders/encoders.c
485c9e24830737934987cfea970c5a5684b8b4d3
[ "Apache-2.0" ]
permissive
cyberbotics/webots
f075dacf4067e8dcebbfd89e8690df8525f6d745
8aba6eaae76989facf3442305c8089d3cc366bcf
refs/heads/master
2023-08-31T09:41:13.205940
2023-08-18T10:48:30
2023-08-18T10:48:30
156,228,018
2,495
1,525
Apache-2.0
2023-08-28T16:30:33
2018-11-05T14:09:10
C++
UTF-8
C
false
false
3,217
c
encoders.c
/* * Copyright 1996-2023 Cyberbotics 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 * * https://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. */ /* * Description: An example of use of the encoders of a differential wheel */ #include <stdio.h> #include <stdlib.h> #include <webots/motor.h> #include <webots/position_sensor.h> #include <webots/robot.h> #define TIME_STEP 64 #define SPEED_UNIT 0.1 #define ENCODER_UNIT 0.25 int main(void) { int goal[2] = {0, 0}; WbDeviceTag left_motor, right_motor, left_position_sensor, right_position_sensor; double left_encoder_offset = 0.0; double right_encoder_offset = 0.0; wb_robot_init(); /* get a handler to the motors and set target position to infinity (speed control). */ left_motor = wb_robot_get_device("left wheel motor"); right_motor = wb_robot_get_device("right wheel motor"); wb_motor_set_position(left_motor, INFINITY); wb_motor_set_position(right_motor, INFINITY); wb_motor_set_velocity(left_motor, 0.0); wb_motor_set_velocity(right_motor, 0.0); /* get a handler to the position sensors and enable them. */ left_position_sensor = wb_robot_get_device("left wheel sensor"); right_position_sensor = wb_robot_get_device("right wheel sensor"); wb_position_sensor_enable(left_position_sensor, TIME_STEP); wb_position_sensor_enable(right_position_sensor, TIME_STEP); while (wb_robot_step(TIME_STEP) != -1) { int i; int encoder_value[2]; float speed[2]; encoder_value[0] = ENCODER_UNIT * (wb_position_sensor_get_value(left_position_sensor) - left_encoder_offset); encoder_value[1] = ENCODER_UNIT * (wb_position_sensor_get_value(right_position_sensor) - right_encoder_offset); /* * simply turn the wheels in the direction corresponding to the * objectif position, when it is reached, stop the wheel. */ if (encoder_value[0] != goal[0] || encoder_value[1] != goal[1]) { for (i = 0; i < 2; i++) { speed[i] = goal[i] - encoder_value[i]; if (speed[i] != 0) speed[i] = speed[i] > 0 ? 40 : -40; } /* set the motor speeds */ wb_motor_set_velocity(left_motor, SPEED_UNIT * speed[0]); wb_motor_set_velocity(right_motor, SPEED_UNIT * speed[1]); } else { /* * When both wheels are in place, we choose randomly new objectif * positions and we reset the encoders. */ for (i = 0; i < 2; i++) goal[i] = (int)(20 * ((float)rand() / RAND_MAX)) - 10; left_encoder_offset = wb_position_sensor_get_value(left_position_sensor); right_encoder_offset = wb_position_sensor_get_value(right_position_sensor); printf("Goal position for the encoders: %d %d\n", goal[0], goal[1]); } } wb_robot_cleanup(); return 0; }