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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d4eb5fd7a8a0c93c716498eded1a43502535b6a8
|
8838eb997879add5759b6dfb23f9a646464e53ca
|
/src/net/socket/uapi_linux_netlink.h
|
c472e62ff80ba1c8c71e90bb94c6f5c123278a38
|
[
"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
| 1,931
|
h
|
uapi_linux_netlink.h
|
/**
* @file
*
* @brif It's similar like uapi/linux/netlink.h (linux/rtnetlink.h)
*
* @date Oct 4, 2020
* @author Anton Bondarev
*/
#ifndef SRC_NET_SOCKET_UAPI_LINUX_NETLINK_H_
#define SRC_NET_SOCKET_UAPI_LINUX_NETLINK_H_
#include <stdint.h>
#include <sys/socket.h>
#define NETLINK_ROUTE 0 /* Routing/device hook */
struct sockaddr_nl {
sa_family_t nl_family; /* AF_NETLINK */
unsigned short nl_pad; /* zero */
uint32_t nl_pid; /* port ID */
uint32_t nl_groups; /* multicast groups mask */
};
struct nlmsghdr {
uint32_t nlmsg_len; /* Length of message including header */
uint16_t nlmsg_type; /* Message content */
uint16_t nlmsg_flags; /* Additional flags */
uint32_t nlmsg_seq; /* Sequence number */
uint32_t nlmsg_pid; /* Sending process port ID */
};
#define NLMSG_ALIGNTO 4U
#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
#define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN)
#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
(struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
#define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
(nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
(nlh)->nlmsg_len <= (len))
#define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
#define NLMSG_NOOP 0x1 /* Nothing. */
#define NLMSG_ERROR 0x2 /* Error */
#define NLMSG_DONE 0x3 /* End of a dump */
#define NLMSG_OVERRUN 0x4 /* Data lost */
#define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */
#endif /* SRC_NET_SOCKET_UAPI_LINUX_NETLINK_H_ */
|
8d3e3fe848b6d732650af96b9040ac09107d0f9f
|
d9cb0274eef7367641a5aa4b631c6940626638ec
|
/_16_WI-FI_AP_to_STS/_16_1_switching_wifi_modes/main/connect.c
|
879aed84871682e5d08186a63556be2ce1a97f3a
|
[] |
no_license
|
Mair/esp32-course
|
b1392c60c827698685f7b853899746bf33be845e
|
d9b1c92d6c24382a390ce89edfec000990e6832e
|
refs/heads/master
| 2023-08-30T18:40:34.341468
| 2023-08-27T23:40:06
| 2023-08-27T23:40:06
| 208,529,208
| 232
| 122
| null | 2023-08-27T23:40:07
| 2019-09-15T02:06:13
|
C
|
UTF-8
|
C
| false
| false
| 3,265
|
c
|
connect.c
|
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_event_loop.h"
#include "esp_wifi.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include "cJSON.h"
#include "string.h"
#include "connect.h"
#define SSID CONFIG_WIFI_SSID
#define PASSWORD CONFIG_WIFI_PASSWORD
char *TAG = "CONNECTION";
extern xSemaphoreHandle connectionSemaphore;
static esp_err_t event_handler(void *ctx, system_event_t *event)
{
switch (event->event_id)
{
case SYSTEM_EVENT_STA_START:
esp_wifi_connect();
ESP_LOGI(TAG, "connecting...\n");
break;
case SYSTEM_EVENT_STA_CONNECTED:
ESP_LOGI(TAG, "connected\n");
break;
case SYSTEM_EVENT_STA_GOT_IP:
ESP_LOGI(TAG, "got ip\n");
break;
case SYSTEM_EVENT_STA_DISCONNECTED:
ESP_LOGI(TAG, "disconnected\n");
break;
default:
break;
}
return ESP_OK;
}
void connectSTA(char *ssid, char *pass)
{
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
// wifi_config_t wifi_config =
// {
// .sta = {
// .ssid = CONFIG_WIFI_SSID,
// .password = CONFIG_WIFI_PASSWORD}};
wifi_config_t wifi_config;
memset(&wifi_config, 0, sizeof(wifi_config));
strcpy((char *)wifi_config.sta.ssid, ssid);
strcpy((char *)wifi_config.sta.password, pass);
esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config);
}
void connectAP()
{
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP));
wifi_config_t wifi_config =
{
.ap = {
.ssid = "my esp32",
.password = "P@ssword",
.max_connection = 4,
.authmode = WIFI_AUTH_WPA_WPA2_PSK}};
esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config);
}
void wifiInit(void *params)
{
ESP_ERROR_CHECK(nvs_flash_init());
// **** these 2 lines have moved from within the while loop to here. Its better here to ensure it only initializes once
tcpip_adapter_init();
ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL));
while (true)
{
//*******the below 2 lines should be moved before the while loop
//tcpip_adapter_init();
//ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL));
if (xSemaphoreTake(initSemaphore, portMAX_DELAY))
{
nvs_handle_t nvs;
nvs_open("wifiCreds", NVS_READWRITE, &nvs);
size_t ssidLen, passLen;
char *ssid = NULL, *pass = NULL;
if (nvs_get_str(nvs, "ssid", NULL, &ssidLen) == ESP_OK)
{
if (ssidLen > 0)
{
ssid = malloc(ssidLen);
nvs_get_str(nvs, "ssid", ssid, &ssidLen);
}
}
if (nvs_get_str(nvs, "pass", NULL, &passLen) == ESP_OK)
{
if (passLen > 0)
{
pass = malloc(passLen);
nvs_get_str(nvs, "pass", pass, &passLen);
}
}
wifi_init_config_t wifi_init_config = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&wifi_init_config));
if (ssid != NULL && pass != NULL)
{
connectSTA(ssid, pass);
}
else
{
connectAP();
}
ESP_ERROR_CHECK(esp_wifi_start());
xSemaphoreGive(connectionSemaphore);
if (ssid != NULL)
free(ssid);
if (pass != NULL)
free(pass);
}
}
}
|
9b5aded0f46de74ca45da7d3018f2b06d4b055ef
|
03666e5f961946fc1a0ac67781ac1425562ef0d7
|
/src/gui/QvisPostableMainWindow.C
|
f1dcd985727c065af9594fe527ccc5778b61824f
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
visit-dav/visit
|
e9f81b4d4b9b9930a0db9d5282cd1bcabf465e2e
|
601ae46e0bef2e18425b482a755d03490ade0493
|
refs/heads/develop
| 2023-09-06T08:19:38.397058
| 2023-09-05T21:29:32
| 2023-09-05T21:29:32
| 165,565,988
| 335
| 120
|
BSD-3-Clause
| 2023-09-14T00:53:37
| 2019-01-13T23:27:26
|
C
|
UTF-8
|
C
| false
| false
| 3,337
|
c
|
QvisPostableMainWindow.C
|
// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers. See the top-level LICENSE file for dates and other
// details. No copyright assignment is required to contribute to VisIt.
#include <QvisPostableMainWindow.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qlabel.h>
// ****************************************************************************
// Method: QvisPostableMainWindow::QvisPostableMainWindow
//
// Purpose:
// Constructor.
//
// Arguments:
// captionString : The window caption.
// shortName : The window name that appears in the notepad title.
// n : The notepad.
//
// Programmer: Brad Whitlock
// Creation: Fri Jul 24 09:39:38 PDT 2009
//
// Modifications:
//
// ****************************************************************************
QvisPostableMainWindow::QvisPostableMainWindow(const QString &captionString,
const QString &shortName, QvisNotepadArea *n) : QvisPostableWindow(captionString, shortName, n)
{
contentsWidget = 0;
contentsLayout = 0;
addLayoutStretch = false;
CreateEntireWindow();
dismissButton->setEnabled(false);
isCreated = true;
}
// ****************************************************************************
// Method: QvisPostableMainWindow::~QvisPostableMainWindow
//
// Purpose:
// Destructor
//
// Programmer: Brad Whitlock
// Creation: Fri Jul 24 09:40:24 PDT 2009
//
// Modifications:
//
// ****************************************************************************
QvisPostableMainWindow::~QvisPostableMainWindow()
{
}
// ****************************************************************************
// Method: QvisPostableMainWindow::CreateWindowContents
//
// Purpose:
// Creates a widget that we'll use for the parent of the main window stuff.
//
// Programmer: Brad Whitlock
// Creation: Fri Jul 24 09:40:38 PDT 2009
//
// Modifications:
//
// ****************************************************************************
void
QvisPostableMainWindow::CreateWindowContents()
{
topLayout->setContentsMargins(0,0,0,0);
contentsWidget = new QWidget(central);
topLayout->addWidget(contentsWidget);
contentsLayout = new QVBoxLayout(contentsWidget);
contentsLayout->setContentsMargins(0,0,0,0);
}
void
QvisPostableMainWindow::CreateNode(DataNode *)
{
}
void
QvisPostableMainWindow::SetFromNode(DataNode *, const int *borders)
{
}
// ****************************************************************************
// Method: QvisPostableMainWindow::ContentsWidget
//
// Purpose:
// Return the contents widget.
//
// Programmer: Brad Whitlock
// Creation: Fri Jul 24 09:41:03 PDT 2009
//
// Modifications:
//
// ****************************************************************************
QWidget *
QvisPostableMainWindow::ContentsWidget()
{
return contentsWidget;
}
// ****************************************************************************
// Method: QvisPostableMainWindow::ContentsLayout
//
// Purpose:
// Return the contents layout.
//
// Programmer: Brad Whitlock
// Creation: Fri Jul 24 09:41:46 PDT 2009
//
// Modifications:
//
// ****************************************************************************
QVBoxLayout *
QvisPostableMainWindow::ContentsLayout()
{
return contentsLayout;
}
|
697a5aaa07d31ee7fb5c8d158ee5e3a210d2f389
|
382a4dacbf7d6e6da096ddac660ba7a40af350cf
|
/src/libraries/GxEPD2/src/bitmaps/Bitmaps176x264.h
|
0ddaae3c82788c848e8462638e1649a792ea8d48
|
[
"MIT",
"GPL-3.0-only"
] |
permissive
|
Xinyuan-LilyGO/TTGO_TWatch_Library
|
84b1a580ad931caac7407bf110fde5b9248be3c4
|
6a07f3762a4d11c8e5c0c2d6f9340ee4fdaa5fcb
|
refs/heads/master
| 2023-08-18T15:36:22.029944
| 2023-07-03T01:27:29
| 2023-07-03T01:27:29
| 202,286,916
| 776
| 293
|
MIT
| 2023-08-31T05:18:44
| 2019-08-14T06:17:29
|
C
|
UTF-8
|
C
| false
| false
| 147,484
|
h
|
Bitmaps176x264.h
|
#ifndef _GxBitmaps176x264_H_
#define _GxBitmaps176x264_H_
#if defined(ESP8266) || defined(ES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E0,0X07,
0X01,0XFF,0XFF,0X80,0X00,0X0F,0XFE,0X00,0X00,0X00,0X01,0X80,0X00,0X00,0X00,0X00,
0X00,0X00,0X78,0X1F,0XE0,0X07,0X01,0XFF,0XFF,0XC0,0X00,0X0F,0XFC,0X00,0X00,0X00,
0X01,0X80,0X00,0X00,0X00,0X00,0X00,0X00,0X30,0X07,0XE0,0X07,0X01,0XFF,0XFF,0XC0,
0X00,0X0F,0XF8,0X7F,0XFC,0X07,0XC1,0X80,0X00,0X00,0X00,0X00,0X00,0X00,0X37,0XB3,
0XE0,0X00,0X01,0XFF,0XFF,0X08,0X00,0X07,0XF8,0XFF,0XFC,0X0F,0XE1,0XC0,0X00,0X00,
0X00,0X00,0X00,0X00,0X77,0XB3,0XE0,0X00,0X01,0XFF,0XFF,0X1C,0X00,0X07,0XF0,0XFF,
0XFC,0X1F,0XF1,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF3,0X33,0XE1,0X80,0X61,0XFF,
0XFF,0X1E,0X00,0X03,0XF1,0XFF,0XFC,0X18,0X31,0X80,0X00,0X00,0X00,0X00,0X00,0X00,
0X78,0X73,0XE1,0X8C,0X61,0XFF,0XFF,0XF8,0X80,0X03,0XF1,0XFF,0XFC,0X18,0X31,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE1,0X8C,0X61,0XFF,0XFF,0XF0,0XE0,0X04,
0XF0,0XFF,0XFC,0X1F,0XF1,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE1,0X8C,
0X61,0XFF,0XFF,0XF1,0XE0,0X0C,0X78,0XFF,0XF8,0X0F,0XE1,0XC0,0X00,0X00,0X00,0X00,
0X00,0X00,0X78,0X0F,0XE1,0X8C,0X61,0XFF,0XFF,0XF9,0X08,0X08,0X38,0X7F,0X80,0X07,
0XC1,0X80,0X00,0X00,0X00,0X00,0X00,0X00,0X31,0XC7,0XE1,0X8C,0X61,0XFF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,0X00,0X00,0X00,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFE,0X00,0X00,0X00,0X99,0X90,0X00,0X00,0X00,0X00,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFC,0X00,0X00,0X00,0X99,0X90,0X00,0X00,0X00,0X00,
0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,0X00,0X00,0X00,
0X99,0X90,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XE0,0X00,0X00,0X00,0X99,0X90,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,0X99,0X90,0X00,0X00,
0X00,0X00,0X00,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,
0X00,0X00,0X99,0X90,0X00,0X00,0X00,0X00,0X00,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFE,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X00,0X00,0X00,0X00,0X1F,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF8,0X00,0X00,0X00,0X00,0X99,0X90,
0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,
0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X00,0X00,0X00,
0X00,0X00,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,
0X99,0X90,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFC,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X33,
0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X00,0X99,0X90,0X00,0X33,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X1F,0XFF,0XFF,0XFF,0XFF,0XFF,0XF8,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,
0X00,0X1F,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XC0,0X00,0X00,
0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X3F,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0XFF,
0XFF,0XFF,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X20,0X00,0X00,
0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X99,0X90,0X00,0X20,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XE0,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X3F,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X3F,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X99,0X90,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X1E,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,
0X00,0X3F,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X21,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X21,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X99,0X90,0X00,0X3F,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X1E,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X99,0X90,0X00,0XBF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0XBF,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X21,0X04,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0XFF,0X0D,0XF0,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X99,0X90,0X00,0X7E,0X09,0X10,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X20,0X0F,0XF0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X3F,
0X07,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X99,0X90,0X00,0X3F,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X01,0X0C,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,
0X00,0X01,0X0F,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X3F,0X0B,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X3E,0X08,0XF0,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X99,0X90,0X00,0X00,0X08,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0XFF,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X99,0X90,0X00,0X00,0X0F,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X1E,0X0F,0XF0,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,
0X00,0X3F,0X06,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X21,0X03,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X21,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X99,0X90,0X00,0X3F,0X03,0X30,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X1E,0X03,0XF0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X00,
0X00,0XC0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X99,0X90,0X00,0X16,0X03,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X37,0X03,0X30,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,
0X00,0X2D,0X00,0X40,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X2D,0X0F,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X3B,0X0F,0XF0,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X99,0X90,0X00,0X1A,0X04,0X40,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X00,0X03,0X40,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X1A,
0X00,0XC0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X99,0X90,0X00,0X3B,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X29,0X04,0XE0,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,
0X00,0X29,0X0D,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X3F,0X09,0X10,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X1E,0X0F,0XF0,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X99,0X90,0X00,0X01,0X07,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X73,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0XFE,
0X07,0X10,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X99,0X90,0X00,0X8C,0X0F,0X90,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X88,0X08,0XD0,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,
0X00,0XFF,0X0C,0X70,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X99,0X90,0X00,0XFF,0X04,0X30,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X99,0X90,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X99,0X90,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,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F,
0XFF,0XF0,0X00,0X00,0X00,0X01,0XFF,0XE0,0X03,0XFF,0XFF,0XFF,0XFC,0X00,0X1F,0XF0,
0X00,0X00,0X00,0X00,0X0F,0XFF,0XFF,0XF0,0X00,0X00,0X00,0X01,0XFF,0XE0,0X03,0XFF,
0XFF,0XFF,0XFC,0X00,0X1F,0XF0,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XF0,0X00,0X00,
0X00,0X01,0XFF,0XE0,0X03,0XFF,0XFF,0XFF,0XFC,0X00,0X1F,0XE0,0X00,0X07,0XF0,0X00,
0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFC,0X00,
0X1F,0XE0,0X00,0X1F,0XFC,0X00,0X07,0XFF,0XFF,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,
0X03,0XFF,0XFF,0XFF,0XFC,0X00,0X1F,0XE0,0X00,0X7F,0XFE,0X00,0X03,0XFF,0XFF,0XF0,
0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFC,0X00,0X1F,0XE0,0X00,0X7F,
0XFF,0X00,0X03,0XFF,0XFF,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,
0XFC,0X00,0X1F,0XE0,0X00,0XFF,0XFF,0X80,0X03,0XFF,0XFF,0XF0,0X00,0X00,0X00,0X00,
0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFC,0X00,0X1F,0XE0,0X00,0XFF,0XFF,0X80,0X03,0XFF,
0XFF,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFC,0X00,0X1F,0XE0,
0X01,0XFF,0XFF,0XC0,0X03,0XFF,0XFF,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,
0XFF,0XFF,0XFC,0X00,0X1F,0XE0,0X01,0XFF,0XFF,0XC0,0X03,0XFF,0XFF,0XF0,0X00,0X00,
0X00,0X00,0X3F,0X00,0X03,0XFF,0XFF,0XFF,0XFC,0X00,0X1F,0XE0,0X01,0XFF,0XFF,0XC0,
0X03,0XFF,0XFF,0XF0,0X00,0X00,0X00,0X00,0XFF,0XC0,0X03,0XFF,0XFF,0XFF,0XFC,0X00,
0X1F,0XE0,0X01,0XFF,0XFF,0XC0,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0XFF,0XC0,
0X03,0XFF,0XFF,0XFF,0XFC,0X00,0X03,0XF0,0X00,0XFF,0XFF,0X80,0X03,0XFF,0XFF,0XFF,
0XFF,0XFF,0X00,0X01,0XC0,0XE0,0X03,0XFF,0XFF,0XFF,0XFC,0X00,0X00,0X10,0X00,0XFF,
0XFF,0X80,0X03,0XFF,0XFF,0XF0,0X00,0X00,0X00,0X01,0X80,0X60,0X03,0XFF,0XFF,0XFF,
0XFC,0X00,0X00,0X00,0X00,0X7F,0XFF,0X00,0X03,0XFF,0XFF,0XF0,0X00,0X00,0X00,0X01,
0X80,0X60,0X03,0XFF,0XFF,0XFF,0XFC,0X00,0X00,0X00,0X00,0X3F,0XFE,0X00,0X03,0XFF,
0XFF,0XF0,0X00,0X00,0X00,0X01,0X80,0X60,0X03,0XFF,0XFF,0XFF,0XFC,0X00,0X00,0X00,
0X00,0X1F,0XF8,0X00,0X07,0XFF,0XFF,0XF0,0X00,0X00,0X00,0X01,0XFF,0XE0,0X03,0XFF,
0XFF,0XFF,0XFC,0X00,0X00,0X00,0X00,0X0F,0XE0,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,
0X00,0X01,0XFF,0XE0,0X03,0XFF,0XFF,0XFF,0XFC,0X00,0X00,0X00,0X00,0X0F,0X00,0X00,
0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X01,0XFF,0XE0,0X03,0XFF,0XFF,0XFF,0XFC,0X00,
0X00,0X00,0X00,0X0F,0X00,0X00,0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0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XF8,0XFF,0XFF,0X00,0X18,0X30,0X00,
0X00,0X00,0X0C,0X03,0XCF,0X8F,0X3C,0X07,0XFF,0XFF,0XFF,0XE1,0XC0,0X01,0XFF,0XF8,
0XFF,0XFF,0X00,0X18,0X30,0X00,0X00,0X00,0X0C,0X03,0XE7,0X8F,0X38,0X03,0XFF,0XFF,
0XFF,0XE1,0XC0,0X00,0X00,0X00,0XFF,0XFF,0X00,0X1F,0XF0,0X00,0X00,0X00,0X0E,0XFF,
0XE0,0X0F,0X38,0X03,0XFF,0XFF,0XFF,0XE0,0X00,0X00,0X03,0X80,0XFF,0XFF,0X00,0X0F,
0XE0,0X00,0X00,0X00,0X0F,0XFF,0XE0,0X0F,0X38,0X07,0XFF,0XFF,0XFF,0XE0,0X00,0X00,
0X03,0X80,0XFF,0XFF,0X00,0X07,0XC0,0X00,0X00,0X00,0X0F,0XFF,0XF3,0X8F,0X3C,0X07,
0XFF,0XFF,0XFF,0XE0,0X00,0X78,0X03,0X80,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,
0X0F,0XF3,0X83,0X8F,0X3E,0X0F,0XFF,0XFF,0XFF,0XE0,0X00,0X78,0X03,0X80,0XFF,0XFF,
0X00,0X00,0X00,0X00,0X00,0X00,0X0E,0X03,0X83,0X8F,0X3F,0X1F,0XFF,0XFF,0XFF,0XE0,
0X00,0X78,0X03,0X80,0XFF,0XFF,0X00,0X0D,0XE0,0X00,0X00,0X00,0X06,0X03,0X81,0X8F,
0X3F,0XFF,0XFF,0XFF,0XFF,0XE0,0X00,0X78,0X03,0X80,0XFF,0XFF,0X00,0X1D,0XF0,0X00,
0X00,0X00,0X06,0X03,0X81,0X8F,0X3F,0XFF,0XFF,0XFF,0XFF,0XE0,0X00,0X00,0X00,0X00,
0XFF,0XFF,0X00,0X1D,0XF0,0X00,0X00,0X00,0X06,0X03,0XD8,0X0F,0X3F,0XFF,0XFF,0XFF,
0XFF,0XE0,0X00,0X00,0X00,0X00,0XFF,0XFF,0X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X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0XFF,0XFF,
0XFF,0XFF,0XFF,0XE0,0X30,0X19,0XFF,0XF8,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X1F,0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,0X00,0X00,0X00,0X00,0XFF,0XFF,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,
0X00,0X00,0X00,0X00,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,
0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,0X00,0X00,0X00,0X00,0XFF,0XFF,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0X00,0X00,0X00,0X00,0X00,0X00,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F,0XFF,0XFF,
0X00,0X00,0X00,0X03,0XFF,0XFF,0X80,0X00,0X00,0X00,0X00,0X0F,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X03,0XFF,0XFF,0X80,0X00,0X00,0X00,
0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF3,0X07,0XFF,0XFF,0X00,0X00,0X00,0X03,
0XFF,0XFF,0X80,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE2,0X03,
0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XE2,0X03,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE7,0X73,0XFF,0XFF,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XE0,0X03,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,0X07,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X01,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF8,0X0F,0XFF,0XFF,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0XFF,0XFF,0XFC,0X0F,0XFF,0XFF,
0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0XC0,0X00,0X00,0X00,0XFF,0XFF,
0XFF,0XFF,0XF8,0X0F,0XE7,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,
0XF0,0X00,0X00,0X00,0XFF,0XFF,0XFF,0XFF,0XFB,0XFF,0XE1,0XFF,0XFF,0XFF,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X3F,0XF8,0X00,0X00,0X00,0X7F,0XFF,0XFF,0XFF,0XFD,0XFF,
0XE0,0X3F,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XFC,0X00,0X00,0X00,
0X7F,0XFF,0XFF,0XFF,0XF8,0X0F,0XE4,0X03,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X7F,0XFC,0X00,0X00,0X00,0X7F,0XFF,0XFF,0XFF,0XF8,0X0F,0XE7,0X03,0XFF,0XFF,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XFC,0X00,0X00,0X00,0X3F,0XFF,0XFF,0XFF,
0XFF,0XFF,0XE7,0XE3,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XFC,0X00,
0X00,0X00,0X3F,0XFF,0XFF,0XFF,0XFC,0X1F,0XE7,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X7F,0XFC,0X00,0X00,0X00,0X3F,0XFF,0XFF,0XFF,0XF8,0X0F,0XFF,0XFF,
0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XFC,0X00,0X00,0X00,0X1F,0XFF,
0XFF,0XFF,0XFB,0XCF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,
0XFC,0X00,0X00,0X00,0X1F,0XFF,0XFF,0XFF,0XFB,0XEF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X3F,0XF8,0X00,0X00,0X00,0X1F,0XFF,0XFF,0XFF,0XF8,0X0F,
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0XF8,0X00,0X00,0X00,
0X0F,0XFF,0XFF,0XFF,0XF8,0X1F,0XE0,0X03,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X1F,0XF0,0X00,0X00,0X00,0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,0X03,0XFF,0XFF,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XC0,0X00,0X00,0X00,0X0F,0XFF,0XFF,0XFF,
0XFB,0XDF,0XE0,0X03,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X07,0XFF,0XFF,0XFF,0XE8,0X0F,0XF1,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFD,0XFF,0XF9,0XFF,
0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFC,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XE3,0XCF,0XFC,0XFF,0XFF,0XFF,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XE0,0X1F,
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X01,0XFF,0XFF,0XFF,0XF0,0X3F,0XFD,0XFB,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XFF,0XFF,0XFF,0XFB,0XFF,0XFC,0XF3,0XFF,0XFF,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XFF,0XFF,0XFF,
0XF8,0X0F,0XFC,0X03,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0XFF,0XFF,0XFF,0XF8,0X1F,0XFE,0X07,0XFF,0XFF,0X00,0X00,0X00,0X00,
0X00,0X00,0X0F,0XF0,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0XFF,0XFF,0XDF,0XFF,0X1F,
0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XFC,0X00,0X00,0X00,0X00,0X00,0XFF,
0XFF,0XFF,0XFF,0XEF,0XFE,0X07,0XFF,0XFF,0X00,0X00,0X00,0X07,0XC0,0X00,0XFF,0XFF,
0X00,0X00,0X00,0X00,0X00,0X7F,0XFF,0XFF,0XF8,0X0F,0XFC,0X03,0XFF,0XFF,0X00,0X00,
0X00,0X07,0XE0,0X03,0XFF,0XFF,0X80,0X00,0X00,0X00,0X00,0X7F,0XFF,0XFF,0XF8,0X1F,
0XFC,0XF3,0XFF,0XFF,0X00,0X00,0X00,0X07,0XF0,0X03,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X7F,0XFF,0XFF,0XFF,0XFF,0XFD,0XFB,0XFF,0XFF,0X00,0X00,0X00,0X07,0XF8,0X07,
0XFF,0XFF,0XC0,0X00,0X00,0X00,0X00,0X3F,0XFF,0XFF,0XE0,0X0F,0XFF,0XFF,0XFF,0XFF,
0X00,0X00,0X00,0X07,0XF8,0X0F,0XFF,0XFF,0XE0,0X00,0X00,0X00,0X00,0X3F,0XFF,0XFF,
0XE0,0X0F,0XF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0XFF,0XFF,
0XFF,0XFF,0X00,0X00,0X00,0X03,0XFF,0X3F,0XC0,0X07,0XFC,0X00,0X00,0X00,0X00,0X03,
0XFF,0XFF,0XFB,0X2F,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X03,0XFF,0X3F,0XC0,0X03,
0XFC,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFA,0X6F,0XF3,0X07,0XFF,0XFF,0X00,0X00,
0X00,0X03,0XFF,0X3F,0X80,0X03,0XFC,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XF8,0X4F,
0XE2,0X03,0XFF,0XFF,0X00,0X00,0X00,0X03,0XFF,0X3F,0X80,0X01,0XFC,0X00,0X00,0X00,
0X00,0X01,0XFF,0XFF,0XF8,0XDF,0XE2,0X03,0XFF,0XFF,0X00,0X00,0X00,0X03,0XFF,0X3F,
0X80,0X01,0XFC,0X00,0X00,0X00,0X00,0X01,0XFF,0XFF,0XFF,0XFF,0XE7,0X73,0XFF,0XFF,
0X00,0X00,0X00,0X03,0XFF,0X3F,0X80,0XF9,0XFC,0X00,0X00,0X00,0X00,0X01,0XFF,0XFF,
0XFC,0XFF,0XE4,0X43,0XFF,0XFF,0X00,0X00,0X00,0X03,0XFF,0X1F,0XC3,0XFD,0XFC,0X00,
0X00,0X00,0X00,0X00,0XFF,0XFF,0XF8,0X5F,0XE0,0X07,0XFF,0XFF,0X00,0X00,0X00,0X03,
0XFF,0X1F,0XC3,0XFF,0XFC,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0XFA,0X4F,0XF0,0X0F,
0XFF,0XFF,0X00,0X00,0X00,0X03,0XFF,0XFF,0XE7,0XFF,0XFC,0X00,0X00,0X00,0X00,0X00,
0XFF,0XFF,0XFB,0X6F,0XF8,0X1F,0XFF,0XFF,0X00,0X00,0X00,0X03,0XFF,0XFF,0XE7,0XFF,
0XFC,0X00,0X00,0X00,0X00,0X00,0X7F,0XFF,0XFA,0X4F,0XFF,0XFF,0XFF,0XFF,0X00,0X00,
0X00,0X03,0XFF,0XFF,0XE7,0XFF,0XF8,0X00,0X00,0X00,0X00,0X00,0X7F,0XFF,0XF8,0X1F,
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X03,0XFF,0XFF,0XE7,0XFF,0XF8,0X00,0X00,0X00,
0X00,0X00,0X3F,0XFF,0XFC,0X3F,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X03,0XFF,0XFF,
0XE7,0XFF,0XF8,0X00,0X00,0X00,0X00,0X00,0X3F,0XFF,0XFF,0XEF,0XF8,0XF3,0XFF,0XFF,
0X00,0X00,0X00,0X07,0XFF,0XFF,0XE7,0XFF,0XF0,0X00,0X00,0X00,0X00,0X00,0X3F,0XFF,
0XE1,0X1F,0XF0,0X33,0XFF,0XFF,0X00,0X00,0X00,0X07,0XFF,0XFF,0XE7,0XFF,0XF0,0X00,
0X00,0X00,0X00,0X00,0X1F,0XFF,0XE0,0X1F,0XE0,0X13,0XFF,0XFF,0X00,0X00,0X00,0X07,
0XFF,0XFF,0XE7,0XFF,0XE0,0X00,0X00,0X00,0X00,0X00,0X1F,0XFF,0XEE,0X7F,0XE7,0X03,
0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X7F,0XE3,0XFF,0XE0,0X00,0X00,0X00,0X00,0X00,
0X1F,0XFF,0XEE,0XFF,0XE1,0XC3,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,
0XC0,0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0XEE,0XFF,0XE1,0XE3,0XFF,0XFF,0X00,0X00,
0X00,0X00,0X00,0X00,0X01,0XFF,0X80,0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0XE0,0X0F,
0XF1,0XF3,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X0F,0XFF,0XE0,0X0F,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0X80,0X00,0X00,0X00,0X00,0X00,
0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0XF8,0X3F,
0XE0,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,
0X00,0X00,0X00,0X01,0XFC,0X7F,0XF0,0X00,0X00,0X00,0X00,0X00,0X01,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X03,0XFE,0XFF,0XF8,0X00,0X00,0X00,
0X00,0X00,0X01,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X03,
0XFE,0XFF,0XF8,0X00,0X00,0X00,0X00,0X00,0X01,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XF8,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFC,0X00,
0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,
0X00,0X07,0XFF,0XFF,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFE,0X7C,0X00,0X00,0X00,0X00,0X00,
0X00,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X07,0X83,0XFC,
0X3C,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,
0X00,0X00,0X00,0X3F,0XFF,0XFF,0XFF,0XE0,0X00,0X00,0X00,0X00,0X00,0X7F,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X3F,0XFF,0XFF,0XFF,0XE0,0X00,0X00,
0X00,0X00,0X00,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X3F,
0XFF,0XFF,0XFF,0XE0,0X00,0X00,0X00,0X00,0X00,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0X00,0X00,0X00,0X00,0X00,0X3F,0XFF,0XFF,0XFF,0XE0,0X00,0X00,0X00,0X00,0X00,0X3F,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X07,0XC7,0XF8,0X3C,0X00,
0X00,0X00,0X00,0X00,0X00,0X1F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,
0X00,0X07,0XFF,0XFF,0XBC,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFC,0X00,0X00,0X00,0X00,0X00,
0X00,0X1F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,
0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,
0X00,0X00,0X00,0X03,0XFF,0XFF,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X01,0XFF,0XEF,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X01,
0XFF,0XEF,0XF8,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XC7,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X07,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0X83,0XE0,0X00,
0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X01,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
};
#endif
|
be2ea9c487d2bd259babb1507255c839ab9e6209
|
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
|
/sys/arch/riscv/riscv/db_trace.c
|
e768756e254b03c8601a7f93ee2dcb4c9a3506ff
|
[] |
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
| 7,602
|
c
|
db_trace.c
|
/* $NetBSD: db_trace.c,v 1.4 2023/05/07 12:41:48 skrll Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* 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>
__RCSID("$NetBSD: db_trace.c,v 1.4 2023/05/07 12:41:48 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <riscv/db_machdep.h>
#include <uvm/uvm_extern.h>
#include <ddb/db_access.h>
#include <ddb/db_command.h>
#include <ddb/db_output.h>
#include <ddb/db_variables.h>
#include <ddb/db_sym.h>
#include <ddb/db_proc.h>
#include <ddb/db_lwp.h>
#include <ddb/db_extern.h>
#include <ddb/db_interface.h>
#define MAXBACKTRACE 128 /* against infinite loop */
#define TRACEFLAG_LOOKUPLWP 0x00000001
#define IN_USER_VM_ADDRESS(addr) \
(VM_MIN_ADDRESS <= (addr) && (addr) < VM_MAX_ADDRESS)
#define IN_KERNEL_VM_ADDRESS(addr) \
(VM_MIN_KERNEL_ADDRESS <= (addr) && (addr) < VM_MAX_KERNEL_ADDRESS)
static bool __unused
is_lwp(void *p)
{
lwp_t *lwp;
for (lwp = db_lwp_first(); lwp != NULL; lwp = db_lwp_next(lwp)) {
if (lwp == p)
return true;
}
return false;
}
static const char *
getlwpnamebysp(uint64_t sp)
{
#if defined(_KERNEL)
lwp_t *lwp;
for (lwp = db_lwp_first(); lwp != NULL; lwp = db_lwp_next(lwp)) {
uint64_t uarea = uvm_lwp_getuarea(lwp);
if ((uarea <= sp) && (sp < (uarea + USPACE))) {
return lwp->l_name;
}
}
#endif
return "unknown";
}
static void
pr_traceaddr(const char *prefix, uint64_t frame, uint64_t pc, int flags,
void (*pr)(const char *, ...) __printflike(1, 2))
{
db_expr_t offset;
db_sym_t sym;
const char *name;
sym = db_search_symbol(pc, DB_STGY_ANY, &offset);
if (sym != DB_SYM_NULL) {
db_symbol_values(sym, &name, NULL);
if (flags & TRACEFLAG_LOOKUPLWP) {
(*pr)("%s %016" PRIx64 " %s %s() at %016" PRIx64,
prefix, frame, getlwpnamebysp(frame), name, pc);
} else {
(*pr)("%s %016" PRIx64 " %s() at %016" PRIx64 " ",
prefix, frame, name, pc);
}
db_printsym(pc, DB_STGY_PROC, pr);
(*pr)("\n");
} else {
if (flags & TRACEFLAG_LOOKUPLWP) {
(*pr)("%s %016" PRIx64 " %s ?() at %016" PRIx64 "\n",
prefix, frame, getlwpnamebysp(frame), pc);
} else {
(*pr)("%s %016" PRIx64 " ?() at %016" PRIx64 "\n", prefix, frame, pc);
}
}
}
void
db_stack_trace_print(db_expr_t addr, bool have_addr, db_expr_t count,
const char *modif, void (*pr)(const char *, ...) __printflike(1, 2))
{
register_t ra, fp, lastra, lastfp;
struct trapframe *tf = NULL;
int flags = 0;
bool trace_user = false;
bool trace_thread = false;
bool trace_lwp = false;
printf("have_addr: %s\n", have_addr ? "true" : "false");
if (have_addr)
printf("addr: %lx\n", addr);
printf("count: %ld\n", count);
printf("modif: %s\n", modif);
for (; *modif != '\0'; modif++) {
switch (*modif) {
case 'a':
trace_lwp = true;
trace_thread = false;
break;
case 'l':
break;
case 't':
trace_thread = true;
trace_lwp = false;
break;
case 'u':
trace_user = true;
break;
case 'x':
flags |= TRACEFLAG_LOOKUPLWP;
break;
default:
pr("usage: bt[/ulx] [frame-address][,count]\n");
pr(" bt/t[ulx] [pid][,count]\n");
pr(" bt/a[ulx] [lwpaddr][,count]\n");
pr("\n");
pr(" /x reverse lookup lwp name from sp\n");
return;
}
}
#if defined(_KERNEL)
if (!have_addr) {
if (trace_lwp) {
addr = (db_expr_t)curlwp;
} else if (trace_thread) {
addr = curlwp->l_proc->p_pid;
} else {
tf = DDB_REGS;
}
}
#endif
if (trace_thread) {
proc_t *pp, p;
if ((pp = db_proc_find((pid_t)addr)) == 0) {
(*pr)("trace: pid %d: not found\n", (int)addr);
return;
}
db_read_bytes((db_addr_t)pp, sizeof(p), (char *)&p);
addr = (db_addr_t)p.p_lwps.lh_first;
trace_thread = false;
trace_lwp = true;
}
#if 0
/* "/a" is abbreviated? */
if (!trace_lwp && is_lwp(addr))
trace_lwp = true;
#endif
if (trace_lwp) {
proc_t p;
struct lwp l;
db_read_bytes(addr, sizeof(l), (char *)&l);
db_read_bytes((db_addr_t)l.l_proc, sizeof(p), (char *)&p);
#if defined(_KERNEL)
if (addr == (db_expr_t)curlwp) {
fp = (register_t)&DDB_REGS->tf_s0; /* s0 = fp */
tf = DDB_REGS;
(*pr)("trace: pid %d lid %d (curlwp) at tf %p\n",
p.p_pid, l.l_lid, tf);
} else
#endif
{
tf = l.l_md.md_ktf;
db_read_bytes((db_addr_t)&tf->tf_s0, sizeof(fp), (char *)&fp);
(*pr)("trace: pid %d lid %d at tf %p\n",
p.p_pid, l.l_lid, tf);
}
} else if (tf == NULL) {
fp = addr;
pr("trace fp %016" PRIxREGISTER "\n", fp);
} else {
pr("trace tf %p\n", tf);
}
if (count > MAXBACKTRACE)
count = MAXBACKTRACE;
if (tf != NULL) {
#if defined(_KERNEL)
(*pr)("---- trapframe %p (%zu bytes) ----\n",
tf, sizeof(*tf));
dump_trapframe(tf, pr);
(*pr)("------------------------"
"------------------------\n");
#endif
lastfp = lastra = ra = fp = 0;
db_read_bytes((db_addr_t)&tf->tf_ra, sizeof(ra), (char *)&ra);
db_read_bytes((db_addr_t)&tf->tf_s0, sizeof(fp), (char *)&fp);
pr_traceaddr("fp", fp, ra - 4, flags, pr);
}
for (; (count > 0) && (fp != 0); count--) {
lastfp = fp;
fp = ra = 0;
/*
* normal stack frame
* fp[-1] saved fp(s0) value
* fp[-2] saved ra value
*/
db_read_bytes(lastfp - 1 * sizeof(register_t), sizeof(ra), (char *)&ra);
db_read_bytes(lastfp - 2 * sizeof(register_t), sizeof(fp), (char *)&fp);
if (!trace_user && (IN_USER_VM_ADDRESS(ra) || IN_USER_VM_ADDRESS(fp)))
break;
#if defined(_KERNEL)
extern char exception_kernexit[];
if (((char *)ra == (char *)exception_kernexit)) {
tf = (struct trapframe *)lastfp;
lastra = ra;
ra = fp = 0;
db_read_bytes((db_addr_t)&tf->tf_pc, sizeof(ra), (char *)&ra);
db_read_bytes((db_addr_t)&tf->tf_s0, sizeof(fp), (char *)&fp);
pr_traceaddr("tf", (db_addr_t)tf, lastra, flags, pr);
(*pr)("---- trapframe %p (%zu bytes) ----\n",
tf, sizeof(*tf));
dump_trapframe(tf, pr);
(*pr)("------------------------"
"------------------------\n");
if (ra == 0)
break;
tf = NULL;
if (!trace_user && IN_USER_VM_ADDRESS(ra))
break;
pr_traceaddr("fp", fp, ra, flags, pr);
} else
#endif
{
pr_traceaddr("fp", fp, ra - 4, flags, pr);
}
}
}
|
0e8360d7a0a1c3e0243d42024962ae76e4d9ac3e
|
321d11eaee885ceb3a74db0a062f9bbdf282148c
|
/providers/implementations/ciphers/ciphercommon_ccm.c
|
ce3f7527f31e4bd458fe8a47fd72f43f72738d96
|
[
"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
| 12,992
|
c
|
ciphercommon_ccm.c
|
/*
* Copyright 2019-2021 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
*/
/* Dispatch functions for ccm mode */
#include <openssl/proverr.h>
#include "prov/ciphercommon.h"
#include "prov/ciphercommon_ccm.h"
#include "prov/providercommon.h"
static int ccm_cipher_internal(PROV_CCM_CTX *ctx, unsigned char *out,
size_t *padlen, const unsigned char *in,
size_t len);
static int ccm_tls_init(PROV_CCM_CTX *ctx, unsigned char *aad, size_t alen)
{
size_t len;
if (!ossl_prov_is_running() || alen != EVP_AEAD_TLS1_AAD_LEN)
return 0;
/* Save the aad for later use. */
memcpy(ctx->buf, aad, alen);
ctx->tls_aad_len = alen;
len = ctx->buf[alen - 2] << 8 | ctx->buf[alen - 1];
if (len < EVP_CCM_TLS_EXPLICIT_IV_LEN)
return 0;
/* Correct length for explicit iv. */
len -= EVP_CCM_TLS_EXPLICIT_IV_LEN;
if (!ctx->enc) {
if (len < ctx->m)
return 0;
/* Correct length for tag. */
len -= ctx->m;
}
ctx->buf[alen - 2] = (unsigned char)(len >> 8);
ctx->buf[alen - 1] = (unsigned char)(len & 0xff);
/* Extra padding: tag appended to record. */
return ctx->m;
}
static int ccm_tls_iv_set_fixed(PROV_CCM_CTX *ctx, unsigned char *fixed,
size_t flen)
{
if (flen != EVP_CCM_TLS_FIXED_IV_LEN)
return 0;
/* Copy to first part of the iv. */
memcpy(ctx->iv, fixed, flen);
return 1;
}
static size_t ccm_get_ivlen(PROV_CCM_CTX *ctx)
{
return 15 - ctx->l;
}
int ossl_ccm_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
PROV_CCM_CTX *ctx = (PROV_CCM_CTX *)vctx;
const OSSL_PARAM *p;
size_t sz;
if (params == NULL)
return 1;
p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_AEAD_TAG);
if (p != NULL) {
if (p->data_type != OSSL_PARAM_OCTET_STRING) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
return 0;
}
if ((p->data_size & 1) || (p->data_size < 4) || p->data_size > 16) {
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_TAG_LENGTH);
return 0;
}
if (p->data != NULL) {
if (ctx->enc) {
ERR_raise(ERR_LIB_PROV, PROV_R_TAG_NOT_NEEDED);
return 0;
}
memcpy(ctx->buf, p->data, p->data_size);
ctx->tag_set = 1;
}
ctx->m = p->data_size;
}
p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_AEAD_IVLEN);
if (p != NULL) {
size_t ivlen;
if (!OSSL_PARAM_get_size_t(p, &sz)) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
return 0;
}
ivlen = 15 - sz;
if (ivlen < 2 || ivlen > 8) {
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_IV_LENGTH);
return 0;
}
ctx->l = ivlen;
}
p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_AEAD_TLS1_AAD);
if (p != NULL) {
if (p->data_type != OSSL_PARAM_OCTET_STRING) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
return 0;
}
sz = ccm_tls_init(ctx, p->data, p->data_size);
if (sz == 0) {
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DATA);
return 0;
}
ctx->tls_aad_pad_sz = sz;
}
p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED);
if (p != NULL) {
if (p->data_type != OSSL_PARAM_OCTET_STRING) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
return 0;
}
if (ccm_tls_iv_set_fixed(ctx, p->data, p->data_size) == 0) {
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_IV_LENGTH);
return 0;
}
}
return 1;
}
int ossl_ccm_get_ctx_params(void *vctx, OSSL_PARAM params[])
{
PROV_CCM_CTX *ctx = (PROV_CCM_CTX *)vctx;
OSSL_PARAM *p;
p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_IVLEN);
if (p != NULL && !OSSL_PARAM_set_size_t(p, ccm_get_ivlen(ctx))) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
return 0;
}
p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_AEAD_TAGLEN);
if (p != NULL) {
size_t m = ctx->m;
if (!OSSL_PARAM_set_size_t(p, m)) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
return 0;
}
}
p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_IV);
if (p != NULL) {
if (ccm_get_ivlen(ctx) > p->data_size) {
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_IV_LENGTH);
return 0;
}
if (!OSSL_PARAM_set_octet_string(p, ctx->iv, p->data_size)
&& !OSSL_PARAM_set_octet_ptr(p, &ctx->iv, p->data_size)) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
return 0;
}
}
p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_UPDATED_IV);
if (p != NULL) {
if (ccm_get_ivlen(ctx) > p->data_size) {
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_IV_LENGTH);
return 0;
}
if (!OSSL_PARAM_set_octet_string(p, ctx->iv, p->data_size)
&& !OSSL_PARAM_set_octet_ptr(p, &ctx->iv, p->data_size)) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
return 0;
}
}
p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_KEYLEN);
if (p != NULL && !OSSL_PARAM_set_size_t(p, ctx->keylen)) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
return 0;
}
p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD);
if (p != NULL && !OSSL_PARAM_set_size_t(p, ctx->tls_aad_pad_sz)) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
return 0;
}
p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_AEAD_TAG);
if (p != NULL) {
if (!ctx->enc || !ctx->tag_set) {
ERR_raise(ERR_LIB_PROV, PROV_R_TAG_NOT_SET);
return 0;
}
if (p->data_type != OSSL_PARAM_OCTET_STRING) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
return 0;
}
if (!ctx->hw->gettag(ctx, p->data, p->data_size))
return 0;
ctx->tag_set = 0;
ctx->iv_set = 0;
ctx->len_set = 0;
}
return 1;
}
static int ccm_init(void *vctx, const unsigned char *key, size_t keylen,
const unsigned char *iv, size_t ivlen,
const OSSL_PARAM params[], int enc)
{
PROV_CCM_CTX *ctx = (PROV_CCM_CTX *)vctx;
if (!ossl_prov_is_running())
return 0;
ctx->enc = enc;
if (iv != NULL) {
if (ivlen != ccm_get_ivlen(ctx)) {
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_IV_LENGTH);
return 0;
}
memcpy(ctx->iv, iv, ivlen);
ctx->iv_set = 1;
}
if (key != NULL) {
if (keylen != ctx->keylen) {
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
return 0;
}
if (!ctx->hw->setkey(ctx, key, keylen))
return 0;
}
return ossl_ccm_set_ctx_params(ctx, params);
}
int ossl_ccm_einit(void *vctx, const unsigned char *key, size_t keylen,
const unsigned char *iv, size_t ivlen,
const OSSL_PARAM params[])
{
return ccm_init(vctx, key, keylen, iv, ivlen, params, 1);
}
int ossl_ccm_dinit(void *vctx, const unsigned char *key, size_t keylen,
const unsigned char *iv, size_t ivlen,
const OSSL_PARAM params[])
{
return ccm_init(vctx, key, keylen, iv, ivlen, params, 0);
}
int ossl_ccm_stream_update(void *vctx, unsigned char *out, size_t *outl,
size_t outsize, const unsigned char *in,
size_t inl)
{
PROV_CCM_CTX *ctx = (PROV_CCM_CTX *)vctx;
if (outsize < inl) {
ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
return 0;
}
if (!ccm_cipher_internal(ctx, out, outl, in, inl)) {
ERR_raise(ERR_LIB_PROV, PROV_R_CIPHER_OPERATION_FAILED);
return 0;
}
return 1;
}
int ossl_ccm_stream_final(void *vctx, unsigned char *out, size_t *outl,
size_t outsize)
{
PROV_CCM_CTX *ctx = (PROV_CCM_CTX *)vctx;
int i;
if (!ossl_prov_is_running())
return 0;
i = ccm_cipher_internal(ctx, out, outl, NULL, 0);
if (i <= 0)
return 0;
*outl = 0;
return 1;
}
int ossl_ccm_cipher(void *vctx, unsigned char *out, size_t *outl, size_t outsize,
const unsigned char *in, size_t inl)
{
PROV_CCM_CTX *ctx = (PROV_CCM_CTX *)vctx;
if (!ossl_prov_is_running())
return 0;
if (outsize < inl) {
ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
return 0;
}
if (ccm_cipher_internal(ctx, out, outl, in, inl) <= 0)
return 0;
*outl = inl;
return 1;
}
/* Copy the buffered iv */
static int ccm_set_iv(PROV_CCM_CTX *ctx, size_t mlen)
{
const PROV_CCM_HW *hw = ctx->hw;
if (!hw->setiv(ctx, ctx->iv, ccm_get_ivlen(ctx), mlen))
return 0;
ctx->len_set = 1;
return 1;
}
static int ccm_tls_cipher(PROV_CCM_CTX *ctx,
unsigned char *out, size_t *padlen,
const unsigned char *in, size_t len)
{
int rv = 0;
size_t olen = 0;
if (!ossl_prov_is_running())
goto err;
/* Encrypt/decrypt must be performed in place */
if (in == NULL || out != in || len < EVP_CCM_TLS_EXPLICIT_IV_LEN + ctx->m)
goto err;
/* If encrypting set explicit IV from sequence number (start of AAD) */
if (ctx->enc)
memcpy(out, ctx->buf, EVP_CCM_TLS_EXPLICIT_IV_LEN);
/* Get rest of IV from explicit IV */
memcpy(ctx->iv + EVP_CCM_TLS_FIXED_IV_LEN, in, EVP_CCM_TLS_EXPLICIT_IV_LEN);
/* Correct length value */
len -= EVP_CCM_TLS_EXPLICIT_IV_LEN + ctx->m;
if (!ccm_set_iv(ctx, len))
goto err;
/* Use saved AAD */
if (!ctx->hw->setaad(ctx, ctx->buf, ctx->tls_aad_len))
goto err;
/* Fix buffer to point to payload */
in += EVP_CCM_TLS_EXPLICIT_IV_LEN;
out += EVP_CCM_TLS_EXPLICIT_IV_LEN;
if (ctx->enc) {
if (!ctx->hw->auth_encrypt(ctx, in, out, len, out + len, ctx->m))
goto err;
olen = len + EVP_CCM_TLS_EXPLICIT_IV_LEN + ctx->m;
} else {
if (!ctx->hw->auth_decrypt(ctx, in, out, len,
(unsigned char *)in + len, ctx->m))
goto err;
olen = len;
}
rv = 1;
err:
*padlen = olen;
return rv;
}
static int ccm_cipher_internal(PROV_CCM_CTX *ctx, unsigned char *out,
size_t *padlen, const unsigned char *in,
size_t len)
{
int rv = 0;
size_t olen = 0;
const PROV_CCM_HW *hw = ctx->hw;
/* If no key set, return error */
if (!ctx->key_set)
return 0;
if (ctx->tls_aad_len != UNINITIALISED_SIZET)
return ccm_tls_cipher(ctx, out, padlen, in, len);
/* EVP_*Final() doesn't return any data */
if (in == NULL && out != NULL)
goto finish;
if (!ctx->iv_set)
goto err;
if (out == NULL) {
if (in == NULL) {
if (!ccm_set_iv(ctx, len))
goto err;
} else {
/* If we have AAD, we need a message length */
if (!ctx->len_set && len)
goto err;
if (!hw->setaad(ctx, in, len))
goto err;
}
} else {
/* If not set length yet do it */
if (!ctx->len_set && !ccm_set_iv(ctx, len))
goto err;
if (ctx->enc) {
if (!hw->auth_encrypt(ctx, in, out, len, NULL, 0))
goto err;
ctx->tag_set = 1;
} else {
/* The tag must be set before actually decrypting data */
if (!ctx->tag_set)
goto err;
if (!hw->auth_decrypt(ctx, in, out, len, ctx->buf, ctx->m))
goto err;
/* Finished - reset flags so calling this method again will fail */
ctx->iv_set = 0;
ctx->tag_set = 0;
ctx->len_set = 0;
}
}
olen = len;
finish:
rv = 1;
err:
*padlen = olen;
return rv;
}
void ossl_ccm_initctx(PROV_CCM_CTX *ctx, size_t keybits, const PROV_CCM_HW *hw)
{
ctx->keylen = keybits / 8;
ctx->key_set = 0;
ctx->iv_set = 0;
ctx->tag_set = 0;
ctx->len_set = 0;
ctx->l = 8;
ctx->m = 12;
ctx->tls_aad_len = UNINITIALISED_SIZET;
ctx->hw = hw;
}
|
ee5a735a3f3c882e9b59f82a552cd82a0bb1543d
|
642ba1746fed0b722a127b8426eca987df6efc61
|
/src/ivos/InterViews/boolean.h
|
4175c55e7ec149041479f4c4537e1233c1ce0890
|
[
"BSD-3-Clause"
] |
permissive
|
neuronsimulator/nrn
|
23781d978fe9253b0e3543f41e27252532b35459
|
b786c36d715ba0f6da1ba8bdf5d2338c939ecf51
|
refs/heads/master
| 2023-08-09T00:13:11.123525
| 2023-08-04T13:11:02
| 2023-08-04T13:11:02
| 71,627,569
| 313
| 171
|
NOASSERTION
| 2023-09-14T17:48:03
| 2016-10-22T08:47:37
|
C++
|
UTF-8
|
C
| false
| false
| 66
|
h
|
boolean.h
|
/* backward compatibility */
#include <InterViews/enter-scope.h>
|
39b640c6b162d9b638268fbaf6ae6ed0ce5a4904
|
b789af461bba8acc7f1ac60e5971890c28385e0d
|
/redis-3.2.4/src/version.h
|
2fdedd3445df61ee830b1cb84c4a37d6f992ae57
|
[
"BSD-3-Clause",
"Apache-2.0"
] |
permissive
|
asdgh1000/demo
|
5688f579eecc6abb22160e6486c1af84fb49da3c
|
b2fe60b99e97b3b75d3b3c1ada16d8ea89ea6a00
|
refs/heads/master
| 2022-12-23T19:08:20.503691
| 2020-02-18T14:38:17
| 2020-02-18T14:38:17
| 65,529,838
| 103
| 112
|
Apache-2.0
| 2022-12-16T09:45:33
| 2016-08-12T06:41:52
|
HTML
|
UTF-8
|
C
| false
| false
| 30
|
h
|
version.h
|
#define REDIS_VERSION "3.2.4"
|
2d729e04491e3c4a8811becaed839b70cd95909b
|
192f6a4c9d934be58bca0e610ec1a75e7777fcd1
|
/src/string/sprintf.c
|
a1b5ba81fc7d304fe4c02325dfe105e8bb99eac5
|
[
"Artistic-2.0"
] |
permissive
|
parrot/parrot
|
39a74fbb015829cef901211d6d173b71eea475ea
|
f89a111c06ad0367817c52fda6ff5c24165c005b
|
refs/heads/master
| 2023-07-20T07:41:40.386067
| 2021-08-25T17:59:15
| 2021-08-25T17:59:15
| 1,071,734
| 450
| 134
| null | 2016-11-09T10:57:41
| 2010-11-11T15:14:10
|
C
|
UTF-8
|
C
| false
| false
| 7,630
|
c
|
sprintf.c
|
/*
Copyright (C) 2001-2014, Parrot Foundation.
=head1 NAME
src/string/sprintf.c - sprintf API routines
=head1 DESCRIPTION
This file implements the sprintf family of API routines. These routines
take different forms, but all redirect to a common generalized formatting
algorithm in F<src/spf_render.c> with a specialized vtables in
F<src/spf_vtable.c> to handle argument extraction.
=head2 Functions
The naming convention used is:
=over 4
=item C<Parrot_v?n?sprintf>
A (nearly) drop-in replacement for v?n?sprintf.
=item C<Parrot_v?sprintf_c>
Takes a C-string format, returns a Parrot string.
=item C<Parrot_v?sprintf_s>
Takes a Parrot string format, returns a Parrot string.
So the C<_> means "returns Parrot string" and the other letter indicates
the type for the format.
=cut
*/
#include "parrot/parrot.h"
#include "spf_private.h"
/* HEADERIZER HFILE: include/parrot/string_funcs.h */
/*
=item C<STRING * Parrot_vsprintf_s(PARROT_INTERP, STRING *pat, va_list args)>
Almost all the other sprintf variants in this file are implemented in
terms of this function (see C<Parrot_psprintf()> for the exception). It
in turn calls C<Parrot_sprintf_format()> (see F<src/string/spf_render.c>).
=cut
*/
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
STRING *
Parrot_vsprintf_s(PARROT_INTERP, ARGIN(STRING *pat), va_list args)
{
ASSERT_ARGS(Parrot_vsprintf_s)
SPRINTF_OBJ obj = va_core;
obj.data = PARROT_VA_TO_VAPTR(args);
return Parrot_sprintf_format(interp, pat, &obj);
}
/*
=item C<STRING * Parrot_vsprintf_c(PARROT_INTERP, ARGIN_FORMAT(const char *pat),
va_list args)>
C string version of C<Parrot_vsprintf_s()>.
=cut
*/
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
STRING *
Parrot_vsprintf_c(PARROT_INTERP, ARGIN_FORMAT(const char *pat), va_list args)
{
ASSERT_ARGS(Parrot_vsprintf_c)
STRING * const realpat = Parrot_str_new_init(interp, pat, strlen(pat),
Parrot_default_encoding_ptr, PObj_external_FLAG);
STRING * const ret = Parrot_vsprintf_s(interp, realpat, args);
return ret;
}
/*
=item C<void Parrot_vsnprintf(PARROT_INTERP, char *targ, size_t len,
ARGIN_FORMAT(const char *pat), va_list args)>
Similar to C<Parrot_vsprintf()> but with an option to specify the length
(C<len>) of the returned C string.
If len is zero, then C<targ> is unchanged.
=cut
*/
PARROT_EXPORT
void
Parrot_vsnprintf(PARROT_INTERP, ARGMOD(char *targ),
size_t len, ARGIN_FORMAT(const char *pat), va_list args)
{
ASSERT_ARGS(Parrot_vsnprintf)
if (len == 0)
return;
--len;
if (len) {
const STRING * const ret = Parrot_vsprintf_c(interp, pat, args);
/* string_transcode(interp, ret, NULL, NULL, &ret); */
char * const str_ret = Parrot_str_to_cstring(interp, ret);
const size_t str_len = strlen(str_ret);
if (len > str_len) {
len = str_len;
}
if (len)
memcpy(targ, str_ret, len);
Parrot_str_free_cstring(str_ret);
}
targ[len] = 0;
}
/*
=item C<STRING * Parrot_sprintf_s(PARROT_INTERP, STRING *pat, ...)>
Calls C<Parrot_vsprintf_s()> with the C<va_list> obtained from C<...>.
=cut
*/
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
STRING *
Parrot_sprintf_s(PARROT_INTERP, ARGIN(STRING *pat), ...)
{
ASSERT_ARGS(Parrot_sprintf_s)
STRING *ret;
va_list args;
va_start(args, pat);
ret = Parrot_vsprintf_s(interp, pat, args);
va_end(args);
return ret;
}
/*
=item C<STRING * Parrot_sprintf_c(PARROT_INTERP, ARGIN_FORMAT(const char *pat),
...)>
C string version of C<Parrot_sprintf_s()>.
=cut
*/
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
STRING *
Parrot_sprintf_c(PARROT_INTERP, ARGIN_FORMAT(const char *pat), ...)
{
ASSERT_ARGS(Parrot_sprintf_c)
STRING *ret;
va_list args;
va_start(args, pat);
ret = Parrot_vsprintf_c(interp, pat, args);
va_end(args);
return ret;
}
/*
=item C<void Parrot_snprintf(PARROT_INTERP, char *targ, size_t len,
ARGIN_FORMAT(const char *pat), ...)>
Similar to C<Parrot_sprintf()> but with an option to specify the length
(C<len>) of the returned C string.
=cut
*/
PARROT_EXPORT
void
Parrot_snprintf(PARROT_INTERP, ARGOUT(char *targ), size_t len,
ARGIN_FORMAT(const char *pat), ...)
{
ASSERT_ARGS(Parrot_snprintf)
va_list args;
va_start(args, pat);
Parrot_vsnprintf(interp, targ, len, pat, args);
va_end(args);
}
/*
=item C<STRING * Parrot_psprintf(PARROT_INTERP, STRING *pat, PMC *ary)>
Calls C<Parrot_sprintf_format()> with the insertion arguments in an
C<Array> PMC.
=cut
*/
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
STRING *
Parrot_psprintf(PARROT_INTERP, ARGIN(STRING *pat), ARGOUT(PMC *ary))
{
ASSERT_ARGS(Parrot_psprintf)
SPRINTF_OBJ obj = pmc_core;
obj.data = ary;
return Parrot_sprintf_format(interp, pat, &obj);
}
/*
=item C<int Parrot_secret_snprintf(char *buffer, size_t len, ARGIN_FORMAT(const
char *format), ...)>
A simulation of C<snprintf> for systems that do not support it.
=cut
*/
PARROT_EXPORT
PARROT_IGNORABLE_RESULT
int
Parrot_secret_snprintf(ARGOUT(char *buffer), SHIM(size_t len),
ARGIN_FORMAT(const char *format), ...)
{
ASSERT_ARGS(Parrot_secret_snprintf)
int retval;
va_list ap;
va_start(ap, format);
retval = vsprintf(buffer, format, ap);
va_end(ap);
return retval;
}
/*
=item C<int Parrot_vfprintf(PARROT_INTERP, Parrot_PMC pio, ARGIN_FORMAT(const
char *s), va_list args)>
Writes a C string format with a varargs list to a PIO.
=item C<int Parrot_fprintf(PARROT_INTERP, Parrot_PMC pio, ARGIN_FORMAT(const
char *s), ...)>
Writes a C string format with varargs to a PIO.
=item C<int Parrot_printf(NULLOK_INTERP, ARGIN_FORMAT(const char *s), ...)>
Writes a C string format with varargs to C<stdout>
=item C<int Parrot_eprintf(NULLOK_INTERP, ARGIN_FORMAT(const char *s), ...)>
Writes a C string format with varargs to C<stderr>.
=cut
*/
PARROT_EXPORT
int
Parrot_vfprintf(PARROT_INTERP, ARGIN(Parrot_PMC pio),
ARGIN_FORMAT(const char *s), va_list args)
{
ASSERT_ARGS(Parrot_vfprintf)
STRING * str = Parrot_vsprintf_c(interp, s, args);
return Parrot_io_write_s(interp, pio, str);
}
PARROT_EXPORT
int
Parrot_fprintf(PARROT_INTERP, ARGIN(Parrot_PMC pio),
ARGIN_FORMAT(const char *s), ...)
{
ASSERT_ARGS(Parrot_fprintf)
va_list args;
INTVAL retval;
va_start(args, s);
retval = Parrot_vfprintf(interp, pio, s, args);
va_end(args);
return retval;
}
PARROT_EXPORT
int
Parrot_printf(NULLOK_INTERP, ARGIN_FORMAT(const char *s), ...)
{
ASSERT_ARGS(Parrot_printf)
va_list args;
INTVAL retval;
va_start(args, s);
if (interp)
retval = Parrot_vfprintf(interp, Parrot_io_STDOUT(interp), s, args);
else
retval = vfprintf(stdout, s, args);
va_end(args);
return retval;
}
PARROT_EXPORT
int
Parrot_eprintf(NULLOK_INTERP, ARGIN_FORMAT(const char *s), ...)
{
ASSERT_ARGS(Parrot_eprintf)
va_list args;
INTVAL retval;
va_start(args, s);
if (interp)
retval = Parrot_vfprintf(interp, Parrot_io_STDERR(interp), s, args);
else
retval = vfprintf(stderr, s, args);
va_end(args);
return retval;
}
/*
=back
=head1 SEE ALSO
F<src/string/spf_vtable.c>, F<src/string/spf_render.c>, F<include/parrot/misc.h>
=cut
*/
/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
*/
|
a19ae78805a9d92e2eb49115cb8f971daa235ec4
|
9de0cec678bc4a3bec2b4adabef9f39ff5b4afac
|
/PWGDQ/dielectron/macrosJPSI/AddTask_sweber_jpsiSEm.C
|
aed33a5754dea1076f1ca137d74ed774b5fec3b9
|
[] |
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
| 3,492
|
c
|
AddTask_sweber_jpsiSEm.C
|
AliAnalysisTask *AddTask_sweber_jpsiSEm(
TString cfg = "ConfigJpsiTriggerSE",
Bool_t gridconf = kTRUE,
TString prod = "",
Bool_t isMC = kFALSE,
Bool_t rejectPileup = kTRUE){
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
Error("AddTask_sweber_jpsiSEm", "No analysis manager found.");
return 0;
}
AliAnalysisTaskMultiDielectron *task = new AliAnalysisTaskMultiDielectron("sweberTaskTRD");
Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);
if (!hasMC) task->UsePhysicsSelection( );
task->SetTriggerMask(AliVEvent::kTRD);
// task->SetTriggerMask(AliVEvent::kINT7);
// if (!hasMC) task->SelectCollisionCandidates(AliVEvent::kTRD);
task->SetRequireTRDTrigger( kTRUE);
task->SetTRDTriggerClass(AliDielectronEventCuts::kSE);
task->SetRequireMatchedTrack(1);
/**
*
* train config
*
**/
// set config file name
TString configFile("");
TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
if(cfg.IsNull()) cfg="ConfigJpsiTriggerSE";
// the different paths
TString gsiPath("$TRAIN_ROOT/sweber_chic");
TString alienPath("alien:///alice/cern.ch/user/s/sgweber/macrosJPSI");
TString alirootPath("$ALICE_PHYSICS/PWGDQ/dielectron/macrosJPSI");
// >>> gsi config
if (!trainRoot.IsNull()){
configFile=gsiPath.Data();
}
// >>> aliroot config
else if(!gridconf && trainRoot.IsNull()){
configFile=alirootPath.Data();
}
// >>> alien config
else{
if(!gSystem->Exec(Form("alien_cp %s/%s.C .",alienPath.Data(),cfg.Data()))) {
configFile=gSystem->pwd();
}
else {
printf("ERROR: couldn't copy file %s/%s.C from grid \n", alienPath.Data(),cfg.Data() );
return;
}
}
// add config to path
configFile+="/";
configFile+=cfg.Data();
configFile+=".C";
// load dielectron configuration file (only once)
//if (!gROOT->GetListOfGlobalFunctions()->FindObject("ConfigJpsi")){
gROOT->LoadMacro(configFile.Data());
//}
ConfigJpsi(task);
// task->SetTriggerOnV0AND();
if(rejectPileup) task->SetRejectPileup();
mgr->AddTask(task);
AliAnalysisDataContainer *coutput1 =
mgr->CreateContainer("sweber_treeSEm",
TTree::Class(),
AliAnalysisManager::kExchangeContainer,
"sweber_defaultSEm");
AliAnalysisDataContainer *cOutputHist1 =
mgr->CreateContainer("jpsiQA_SEm",
TList::Class(),
AliAnalysisManager::kOutputContainer,
"JPSI.root");
AliAnalysisDataContainer *cOutputHist2 =
mgr->CreateContainer("jpsiCF_SEm",
TList::Class(),
AliAnalysisManager::kOutputContainer,
"JPSI.root");
AliAnalysisDataContainer *cOutputHist3 =
mgr->CreateContainer("jpsiEventStat_SEm",
TH1D::Class(),
AliAnalysisManager::kOutputContainer,
"JPSI.root");
AliAnalysisDataContainer *cOutputHist4 =
mgr->CreateContainer("jpsiEventStatTRDtrigger_SEm",
TH1D::Class(),
AliAnalysisManager::kOutputContainer,
"JPSI.root");
mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
mgr->ConnectOutput(task, 0, coutput1 );
mgr->ConnectOutput(task, 1, cOutputHist1);
mgr->ConnectOutput(task, 2, cOutputHist2);
mgr->ConnectOutput(task, 3, cOutputHist3);
mgr->ConnectOutput(task, 4, cOutputHist4);
return task;
}
|
504956a5ad5057af656ae0b960048c8df36cecdd
|
d48e09166db1ff0dae2c8a4ddbbe453606689081
|
/selfdrive/common/version.h
|
2c4cfa6a842cf7b284df783030940604158d71d9
|
[
"MIT"
] |
permissive
|
Gernby/raspberry-pilot
|
a8857fdb2a50ade237d657ccd9d1049c5aa65515
|
0909e7594dff1c6fb524b5502ce3258f1969b6a5
|
refs/heads/resonant-rails
| 2023-04-06T10:09:35.457160
| 2023-01-06T01:57:31
| 2023-01-06T01:57:31
| 242,575,807
| 141
| 62
|
MIT
| 2023-03-05T05:22:49
| 2020-02-23T19:15:12
|
C
|
UTF-8
|
C
| false
| false
| 38
|
h
|
version.h
|
#define COMMA_VERSION "0.6.5-release"
|
fb19d72077ea5318efc7494118ad02d23da35880
|
4d317369bd7de599e0364e9097e50f381845e22c
|
/C Programs/C Programs 24/Where_Do_I_Turn.c
|
8e8d47534657148dcdfd5de50c7fa6e53351f892
|
[] |
no_license
|
MathProgrammer/CodeForces
|
4865f0bad799c674ff9e6fde9a008b988af2aed0
|
e3483c1ac4a7c81662f6a0bc8af20be69e0c0a98
|
refs/heads/master
| 2023-04-07T11:27:31.766011
| 2023-04-01T06:29:19
| 2023-04-01T06:29:19
| 84,833,335
| 256
| 114
| null | 2021-10-02T21:14:47
| 2017-03-13T14:02:57
|
C++
|
UTF-8
|
C
| false
| false
| 433
|
c
|
Where_Do_I_Turn.c
|
#include <stdio.h>
int main()
{
int a_x, a_y, b_x, b_y, c_x, c_y;
scanf("%d %d %d %d %d %d", &a_x, &a_y, &b_x, &b_y, &c_x, &c_y);
//Cross_product
if( (c_y - b_y)*1LL*(b_x - a_x) - (b_y - a_y)*1LL*(c_x - b_x) == 0 )
printf("TOWARDS\n");
else if( (c_y - b_y)*1LL*(b_x - a_x) - (b_y - a_y)*1LL*(c_x - b_x) > 0 )
printf("LEFT\n");
else
printf("RIGHT\n");
return 0;
}
|
e05e2eb65d52cd37b699ce50e1869aaca36b6d3a
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/gpu/drm/nouveau/core/engine/crypt/nv84.c
|
5bc021f471f9f494ce6e30511afde19a50426b23
|
[
"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
| 5,558
|
c
|
nv84.c
|
/*
* Copyright 2012 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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: Ben Skeggs
*/
#include <core/client.h>
#include <core/os.h>
#include <core/enum.h>
#include <core/class.h>
#include <core/engctx.h>
#include <core/gpuobj.h>
#include <subdev/fb.h>
#include <engine/fifo.h>
#include <engine/crypt.h>
struct nv84_crypt_priv {
struct nouveau_engine base;
};
/*******************************************************************************
* Crypt object classes
******************************************************************************/
static int
nv84_crypt_object_ctor(struct nouveau_object *parent,
struct nouveau_object *engine,
struct nouveau_oclass *oclass, void *data, u32 size,
struct nouveau_object **pobject)
{
struct nouveau_gpuobj *obj;
int ret;
ret = nouveau_gpuobj_create(parent, engine, oclass, 0, parent,
16, 16, 0, &obj);
*pobject = nv_object(obj);
if (ret)
return ret;
nv_wo32(obj, 0x00, nv_mclass(obj));
nv_wo32(obj, 0x04, 0x00000000);
nv_wo32(obj, 0x08, 0x00000000);
nv_wo32(obj, 0x0c, 0x00000000);
return 0;
}
static struct nouveau_ofuncs
nv84_crypt_ofuncs = {
.ctor = nv84_crypt_object_ctor,
.dtor = _nouveau_gpuobj_dtor,
.init = _nouveau_gpuobj_init,
.fini = _nouveau_gpuobj_fini,
.rd32 = _nouveau_gpuobj_rd32,
.wr32 = _nouveau_gpuobj_wr32,
};
static struct nouveau_oclass
nv84_crypt_sclass[] = {
{ 0x74c1, &nv84_crypt_ofuncs },
{}
};
/*******************************************************************************
* PCRYPT context
******************************************************************************/
static struct nouveau_oclass
nv84_crypt_cclass = {
.handle = NV_ENGCTX(CRYPT, 0x84),
.ofuncs = &(struct nouveau_ofuncs) {
.ctor = _nouveau_engctx_ctor,
.dtor = _nouveau_engctx_dtor,
.init = _nouveau_engctx_init,
.fini = _nouveau_engctx_fini,
.rd32 = _nouveau_engctx_rd32,
.wr32 = _nouveau_engctx_wr32,
},
};
/*******************************************************************************
* PCRYPT engine/subdev functions
******************************************************************************/
static const struct nouveau_bitfield nv84_crypt_intr_mask[] = {
{ 0x00000001, "INVALID_STATE" },
{ 0x00000002, "ILLEGAL_MTHD" },
{ 0x00000004, "ILLEGAL_CLASS" },
{ 0x00000080, "QUERY" },
{ 0x00000100, "FAULT" },
{}
};
static void
nv84_crypt_intr(struct nouveau_subdev *subdev)
{
struct nouveau_fifo *pfifo = nouveau_fifo(subdev);
struct nouveau_engine *engine = nv_engine(subdev);
struct nouveau_object *engctx;
struct nv84_crypt_priv *priv = (void *)subdev;
u32 stat = nv_rd32(priv, 0x102130);
u32 mthd = nv_rd32(priv, 0x102190);
u32 data = nv_rd32(priv, 0x102194);
u32 inst = nv_rd32(priv, 0x102188) & 0x7fffffff;
int chid;
engctx = nouveau_engctx_get(engine, inst);
chid = pfifo->chid(pfifo, engctx);
if (stat) {
nv_error(priv, "%s", "");
nouveau_bitfield_print(nv84_crypt_intr_mask, stat);
pr_cont(" ch %d [0x%010llx %s] mthd 0x%04x data 0x%08x\n",
chid, (u64)inst << 12, nouveau_client_name(engctx),
mthd, data);
}
nv_wr32(priv, 0x102130, stat);
nv_wr32(priv, 0x10200c, 0x10);
nouveau_engctx_put(engctx);
}
static int
nv84_crypt_tlb_flush(struct nouveau_engine *engine)
{
nv50_vm_flush_engine(&engine->base, 0x0a);
return 0;
}
static int
nv84_crypt_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
struct nouveau_oclass *oclass, void *data, u32 size,
struct nouveau_object **pobject)
{
struct nv84_crypt_priv *priv;
int ret;
ret = nouveau_engine_create(parent, engine, oclass, true,
"PCRYPT", "crypt", &priv);
*pobject = nv_object(priv);
if (ret)
return ret;
nv_subdev(priv)->unit = 0x00004000;
nv_subdev(priv)->intr = nv84_crypt_intr;
nv_engine(priv)->cclass = &nv84_crypt_cclass;
nv_engine(priv)->sclass = nv84_crypt_sclass;
nv_engine(priv)->tlb_flush = nv84_crypt_tlb_flush;
return 0;
}
static int
nv84_crypt_init(struct nouveau_object *object)
{
struct nv84_crypt_priv *priv = (void *)object;
int ret;
ret = nouveau_engine_init(&priv->base);
if (ret)
return ret;
nv_wr32(priv, 0x102130, 0xffffffff);
nv_wr32(priv, 0x102140, 0xffffffbf);
nv_wr32(priv, 0x10200c, 0x00000010);
return 0;
}
struct nouveau_oclass
nv84_crypt_oclass = {
.handle = NV_ENGINE(CRYPT, 0x84),
.ofuncs = &(struct nouveau_ofuncs) {
.ctor = nv84_crypt_ctor,
.dtor = _nouveau_engine_dtor,
.init = nv84_crypt_init,
.fini = _nouveau_engine_fini,
},
};
|
537cbab51ae429ff9035e84166da821cbdcda5d2
|
d61b532db0d3e08818338cfaac530a1ced1ffe3b
|
/util/LLgen/src/sets.c
|
10bf7dca8a73455f8f8829a5de72ac0caccb497f
|
[
"LicenseRef-scancode-other-permissive"
] |
permissive
|
davidgiven/ack
|
61049c7a8e95ff61a77b1edd3c22bb290720e276
|
db5a32c68c4a60ca26a3927a799ea662b5b2b0e5
|
refs/heads/default
| 2023-08-29T07:33:12.771205
| 2023-07-08T20:17:27
| 2023-07-08T20:17:27
| 37,686,316
| 376
| 74
|
NOASSERTION
| 2023-07-08T20:17:28
| 2015-06-18T21:33:42
|
C
|
UTF-8
|
C
| false
| false
| 3,614
|
c
|
sets.c
|
/* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
* For full copyright and restrictions on use see the file COPYING in the top
* level of the LLgen tree.
*/
/*
* L L G E N
*
* An Extended LL(1) Parser Generator
*
* Author : Ceriel J.H. Jacobs
*/
/*
* sets.c
* Set manipulation and allocation routines.
*/
#include <stdio.h>
# include <assert.h>
# include "types.h"
# include "extern.h"
# include "sets.h"
# ifndef NORCSID
static string rcsid9 = "$Id$";
# endif
int nbytes;
static int setsize;
int tsetsize;
p_set *setptr, *maxptr;
static t_info set_info;
p_mem alloc();
/*
* Initialises some variables needed for setcomputations
*/
void setinit(int nt_needed)
{
register int bitset;
nbytes = NBYTES(ntokens);
bitset = ALIGN(nbytes);
tsetsize = NINTS(bitset);
if (nt_needed) {
/* nonterminals must be included in the sets */
bitset += NBYTES(nnonterms);
}
setsize = NINTS(bitset);
set_info.i_esize = sizeof(p_set);
set_info.i_incr = 20;
}
p_set get_set(void)
{
/*
* Allocate a set that cannot be freed
*/
register p_set p, q;
static p_set sets, maxsets;
if ((p = sets) >= maxsets) {
q = p = (p_set) alloc(50*setsize*sizeof(*sets));
maxsets = p + 50 * setsize;
do {
*q++ = 0;
} while (q < maxsets);
}
sets = p + setsize;;
return p;
}
p_set setalloc(void)
{
/*
* Allocate a set which can later be freed.
*/
register p_set p;
register int size = setsize;
p = (p_set) alloc(size * sizeof(*p)) + size;
do {
*--p = 0;
} while (--size);
return p;
}
int setunion(register p_set a,register p_set b)
{
/*
* a = a union b.
* Return 1 if the set a changed
*/
register int i;
register int j;
register int nsub = 0;
i = setsize;
do {
*a = (j = *a) | *b++;
if (*a++ != j) {
nsub = 1;
}
} while (--i);
return nsub;
}
int setintersect(register p_set a,register p_set b)
{
/*
* a = a intersect b.
* return 1 if the result is empty
*/
register int i;
register int nempty;
nempty = 1;
i = setsize;
do {
if (*a++ &= *b++) nempty = 0;
} while (--i);
return nempty;
}
void setminus(register p_set a,register p_set b)
{
/*
* a = a setminus b
*/
register int i;
i = setsize;
do {
*a++ &= ~(*b++);
} while (--i);
}
int setempty(register p_set p)
{
/*
* Return 1 if the set p is empty
*/
register int i;
i = tsetsize;
do {
if (*p++) return 0;
} while (--i);
return 1;
}
int findindex(p_set set)
{
/*
* The set "set" will serve as a recovery set.
* Search for it in the table. If not present, enter it.
* Here is room for improvement. At the moment, the list of
* sets is examined with linear search.
*/
register p_set *t;
p_mem new_mem();
register p_set a;
register p_set b;
register int i;
int saved;
/*
* First search for the set in the table
*/
for (t = setptr; t < maxptr; t++) {
a = *t;
b = set;
i = tsetsize;
do {
if (*a++ != *b++) break;
} while (--i);
if (i) continue;
/*
* Here, the sets are equal.
*/
return nbytes * (t - setptr);
}
/*
* Now check if the set consists of only one element.
* It would be a waste to use a set for that
*/
if (setcount(set, &saved) == 1) return -(saved + 1);
/*
* If it does, return its number as a negative number.
*/
maxptr = (p_set *) new_mem(&set_info);
setptr = (p_set *) set_info.i_ptr;
*maxptr = setalloc();
setunion(*maxptr, set);
return nbytes * (maxptr++ - setptr);
}
int setcount(register p_set set, int *saved)
{
register int i, j;
for (j = 0, i = 0; i < ntokens; i++) {
if (IN(set,i)) {
j++;
*saved = i;
}
}
return j;
}
|
8217080ef358bcc5f4933a4fb773d3ed1c4568a8
|
bb7a80648bf830c2fb813cdb335032142cbee06d
|
/mod/mpp/3519/inc/hisisdk/hi_spi.h
|
85b68017b636b4e2afdc2f287ddfb2c8e2303480
|
[] |
no_license
|
openhisilicon/HIVIEW
|
44574a29da60e3bb400c7ce97c722dfc9f2959e6
|
60bbfa5cb66cc82f0cdc0bba1242dbc9491b0f37
|
refs/heads/master
| 2023-09-01T01:42:19.069724
| 2023-08-31T09:57:39
| 2023-08-31T09:57:39
| 189,036,134
| 336
| 121
| null | 2023-01-07T14:10:22
| 2019-05-28T13:41:40
|
C
|
UTF-8
|
C
| false
| false
| 292
|
h
|
hi_spi.h
|
#ifndef __HI_SPI_H__
#define __HI_SPI_H__
typedef unsigned long long __u64;
typedef unsigned int __u32;
typedef unsigned short __u16;
typedef unsigned char __u8;
#ifdef __HuaweiLite__
#include <spi.h>
#else
#include <linux/spi/spidev.h>
#endif
#endif /* __HI_SPI_H__ */
|
c39f42017da16c205569532499974852592bba94
|
cfb4ef8f59dd82ca3eee3dde025a0083e7f75041
|
/core/lite_test.c
|
33aa2bd3f4a112797b8d73d569a6b001356e8507
|
[] |
no_license
|
WukLab/LITE
|
c9905059bafa6b8222443c7b52ec46baaf5f21ee
|
bf8231d47cd5412a1cc946de97f6764d69799b58
|
refs/heads/master
| 2021-06-03T23:49:54.312448
| 2020-07-09T22:41:52
| 2020-07-09T22:41:52
| 103,061,012
| 108
| 23
| null | 2018-11-15T16:15:50
| 2017-09-10T20:52:38
|
Objective-C
|
UTF-8
|
C
| false
| false
| 498
|
c
|
lite_test.c
|
#include <rdma/ib_verbs.h>
#include <rdma/ib_umem.h>
#include <rdma/ib_user_verbs.h>
#include "lite_test.h"
MODULE_AUTHOR("yiying, shinyeh");
MODULE_LICENSE("GPL");
static int __init lite_test_init_module(void)
{
int node_id;
node_id = liteapi_establish_conn("192.168.0.1", LISTEN_PORT, 1);
return node_id;
}
static void __exit lite_test_cleanup_module(void)
{
printk(KERN_INFO "Ready to remove test module\n");
}
module_init(lite_test_init_module);
module_exit(lite_test_cleanup_module);
|
5ddf805dbe6409e607c95b7c66eaaad91e8d5f81
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/tm4c129x/libraries/inc/hw_ints.h
|
7ecd162e7c8f5bd2235d1c3ca5145d14085a855b
|
[
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 29,314
|
h
|
hw_ints.h
|
//*****************************************************************************
//
// hw_ints.h - Macros that define the interrupt assignment on Tiva C Series
// MCUs.
//
// Copyright (c) 2005-2020 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated 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.
//
// This is part of revision 2.2.0.295 of the Tiva Firmware Development Package.
//
//*****************************************************************************
#ifndef __HW_INTS_H__
#define __HW_INTS_H__
//*****************************************************************************
//
// The following are defines for the fault assignments.
//
//*****************************************************************************
#define FAULT_NMI 2 // NMI fault
#define FAULT_HARD 3 // Hard fault
#define FAULT_MPU 4 // MPU fault
#define FAULT_BUS 5 // Bus fault
#define FAULT_USAGE 6 // Usage fault
#define FAULT_SVCALL 11 // SVCall
#define FAULT_DEBUG 12 // Debug monitor
#define FAULT_PENDSV 14 // PendSV
#define FAULT_SYSTICK 15 // System Tick
//*****************************************************************************
//
// TM4C123 Class Interrupts
//
//*****************************************************************************
#define INT_GPIOA_TM4C123 16 // GPIO Port A
#define INT_GPIOB_TM4C123 17 // GPIO Port B
#define INT_GPIOC_TM4C123 18 // GPIO Port C
#define INT_GPIOD_TM4C123 19 // GPIO Port D
#define INT_GPIOE_TM4C123 20 // GPIO Port E
#define INT_UART0_TM4C123 21 // UART0
#define INT_UART1_TM4C123 22 // UART1
#define INT_SSI0_TM4C123 23 // SSI0
#define INT_I2C0_TM4C123 24 // I2C0
#define INT_PWM0_FAULT_TM4C123 25 // PWM0 Fault
#define INT_PWM0_0_TM4C123 26 // PWM0 Generator 0
#define INT_PWM0_1_TM4C123 27 // PWM0 Generator 1
#define INT_PWM0_2_TM4C123 28 // PWM0 Generator 2
#define INT_QEI0_TM4C123 29 // QEI0
#define INT_ADC0SS0_TM4C123 30 // ADC0 Sequence 0
#define INT_ADC0SS1_TM4C123 31 // ADC0 Sequence 1
#define INT_ADC0SS2_TM4C123 32 // ADC0 Sequence 2
#define INT_ADC0SS3_TM4C123 33 // ADC0 Sequence 3
#define INT_WATCHDOG_TM4C123 34 // Watchdog Timers 0 and 1
#define INT_TIMER0A_TM4C123 35 // 16/32-Bit Timer 0A
#define INT_TIMER0B_TM4C123 36 // 16/32-Bit Timer 0B
#define INT_TIMER1A_TM4C123 37 // 16/32-Bit Timer 1A
#define INT_TIMER1B_TM4C123 38 // 16/32-Bit Timer 1B
#define INT_TIMER2A_TM4C123 39 // 16/32-Bit Timer 2A
#define INT_TIMER2B_TM4C123 40 // 16/32-Bit Timer 2B
#define INT_COMP0_TM4C123 41 // Analog Comparator 0
#define INT_COMP1_TM4C123 42 // Analog Comparator 1
#define INT_COMP2_TM4C123 43 // Analog Comparator 2
#define INT_SYSCTL_TM4C123 44 // System Control
#define INT_FLASH_TM4C123 45 // Flash Memory Control and EEPROM
// Control
#define INT_GPIOF_TM4C123 46 // GPIO Port F
#define INT_GPIOG_TM4C123 47 // GPIO Port G
#define INT_GPIOH_TM4C123 48 // GPIO Port H
#define INT_UART2_TM4C123 49 // UART2
#define INT_SSI1_TM4C123 50 // SSI1
#define INT_TIMER3A_TM4C123 51 // 16/32-Bit Timer 3A
#define INT_TIMER3B_TM4C123 52 // Timer 3B
#define INT_I2C1_TM4C123 53 // I2C1
#define INT_QEI1_TM4C123 54 // QEI1
#define INT_CAN0_TM4C123 55 // CAN0
#define INT_CAN1_TM4C123 56 // CAN1
#define INT_HIBERNATE_TM4C123 59 // Hibernation Module
#define INT_USB0_TM4C123 60 // USB
#define INT_PWM0_3_TM4C123 61 // PWM Generator 3
#define INT_UDMA_TM4C123 62 // uDMA Software
#define INT_UDMAERR_TM4C123 63 // uDMA Error
#define INT_ADC1SS0_TM4C123 64 // ADC1 Sequence 0
#define INT_ADC1SS1_TM4C123 65 // ADC1 Sequence 1
#define INT_ADC1SS2_TM4C123 66 // ADC1 Sequence 2
#define INT_ADC1SS3_TM4C123 67 // ADC1 Sequence 3
#define INT_GPIOJ_TM4C123 70 // GPIO Port J
#define INT_GPIOK_TM4C123 71 // GPIO Port K
#define INT_GPIOL_TM4C123 72 // GPIO Port L
#define INT_SSI2_TM4C123 73 // SSI2
#define INT_SSI3_TM4C123 74 // SSI3
#define INT_UART3_TM4C123 75 // UART3
#define INT_UART4_TM4C123 76 // UART4
#define INT_UART5_TM4C123 77 // UART5
#define INT_UART6_TM4C123 78 // UART6
#define INT_UART7_TM4C123 79 // UART7
#define INT_I2C2_TM4C123 84 // I2C2
#define INT_I2C3_TM4C123 85 // I2C3
#define INT_TIMER4A_TM4C123 86 // 16/32-Bit Timer 4A
#define INT_TIMER4B_TM4C123 87 // 16/32-Bit Timer 4B
#define INT_TIMER5A_TM4C123 108 // 16/32-Bit Timer 5A
#define INT_TIMER5B_TM4C123 109 // 16/32-Bit Timer 5B
#define INT_WTIMER0A_TM4C123 110 // 32/64-Bit Timer 0A
#define INT_WTIMER0B_TM4C123 111 // 32/64-Bit Timer 0B
#define INT_WTIMER1A_TM4C123 112 // 32/64-Bit Timer 1A
#define INT_WTIMER1B_TM4C123 113 // 32/64-Bit Timer 1B
#define INT_WTIMER2A_TM4C123 114 // 32/64-Bit Timer 2A
#define INT_WTIMER2B_TM4C123 115 // 32/64-Bit Timer 2B
#define INT_WTIMER3A_TM4C123 116 // 32/64-Bit Timer 3A
#define INT_WTIMER3B_TM4C123 117 // 32/64-Bit Timer 3B
#define INT_WTIMER4A_TM4C123 118 // 32/64-Bit Timer 4A
#define INT_WTIMER4B_TM4C123 119 // 32/64-Bit Timer 4B
#define INT_WTIMER5A_TM4C123 120 // 32/64-Bit Timer 5A
#define INT_WTIMER5B_TM4C123 121 // 32/64-Bit Timer 5B
#define INT_SYSEXC_TM4C123 122 // System Exception (imprecise)
#define INT_I2C4_TM4C123 125 // I2C4
#define INT_I2C5_TM4C123 126 // I2C5
#define INT_GPIOM_TM4C123 127 // GPIO Port M
#define INT_GPION_TM4C123 128 // GPIO Port N
#define INT_GPIOP0_TM4C123 132 // GPIO Port P (Summary or P0)
#define INT_GPIOP1_TM4C123 133 // GPIO Port P1
#define INT_GPIOP2_TM4C123 134 // GPIO Port P2
#define INT_GPIOP3_TM4C123 135 // GPIO Port P3
#define INT_GPIOP4_TM4C123 136 // GPIO Port P4
#define INT_GPIOP5_TM4C123 137 // GPIO Port P5
#define INT_GPIOP6_TM4C123 138 // GPIO Port P6
#define INT_GPIOP7_TM4C123 139 // GPIO Port P7
#define INT_GPIOQ0_TM4C123 140 // GPIO Port Q (Summary or Q0)
#define INT_GPIOQ1_TM4C123 141 // GPIO Port Q1
#define INT_GPIOQ2_TM4C123 142 // GPIO Port Q2
#define INT_GPIOQ3_TM4C123 143 // GPIO Port Q3
#define INT_GPIOQ4_TM4C123 144 // GPIO Port Q4
#define INT_GPIOQ5_TM4C123 145 // GPIO Port Q5
#define INT_GPIOQ6_TM4C123 146 // GPIO Port Q6
#define INT_GPIOQ7_TM4C123 147 // GPIO Port Q7
#define INT_PWM1_0_TM4C123 150 // PWM1 Generator 0
#define INT_PWM1_1_TM4C123 151 // PWM1 Generator 1
#define INT_PWM1_2_TM4C123 152 // PWM1 Generator 2
#define INT_PWM1_3_TM4C123 153 // PWM1 Generator 3
#define INT_PWM1_FAULT_TM4C123 154 // PWM1 Fault
#define NUM_INTERRUPTS_TM4C123 155
//*****************************************************************************
//
// TM4C129 Class Interrupts
//
//*****************************************************************************
#define INT_GPIOA_TM4C129 16 // GPIO Port A
#define INT_GPIOB_TM4C129 17 // GPIO Port B
#define INT_GPIOC_TM4C129 18 // GPIO Port C
#define INT_GPIOD_TM4C129 19 // GPIO Port D
#define INT_GPIOE_TM4C129 20 // GPIO Port E
#define INT_UART0_TM4C129 21 // UART0
#define INT_UART1_TM4C129 22 // UART1
#define INT_SSI0_TM4C129 23 // SSI0
#define INT_I2C0_TM4C129 24 // I2C0
#define INT_PWM0_FAULT_TM4C129 25 // PWM Fault
#define INT_PWM0_0_TM4C129 26 // PWM Generator 0
#define INT_PWM0_1_TM4C129 27 // PWM Generator 1
#define INT_PWM0_2_TM4C129 28 // PWM Generator 2
#define INT_QEI0_TM4C129 29 // QEI0
#define INT_ADC0SS0_TM4C129 30 // ADC0 Sequence 0
#define INT_ADC0SS1_TM4C129 31 // ADC0 Sequence 1
#define INT_ADC0SS2_TM4C129 32 // ADC0 Sequence 2
#define INT_ADC0SS3_TM4C129 33 // ADC0 Sequence 3
#define INT_WATCHDOG_TM4C129 34 // Watchdog Timers 0 and 1
#define INT_TIMER0A_TM4C129 35 // 16/32-Bit Timer 0A
#define INT_TIMER0B_TM4C129 36 // 16/32-Bit Timer 0B
#define INT_TIMER1A_TM4C129 37 // 16/32-Bit Timer 1A
#define INT_TIMER1B_TM4C129 38 // 16/32-Bit Timer 1B
#define INT_TIMER2A_TM4C129 39 // 16/32-Bit Timer 2A
#define INT_TIMER2B_TM4C129 40 // 16/32-Bit Timer 2B
#define INT_COMP0_TM4C129 41 // Analog Comparator 0
#define INT_COMP1_TM4C129 42 // Analog Comparator 1
#define INT_COMP2_TM4C129 43 // Analog Comparator 2
#define INT_SYSCTL_TM4C129 44 // System Control
#define INT_FLASH_TM4C129 45 // Flash Memory Control
#define INT_GPIOF_TM4C129 46 // GPIO Port F
#define INT_GPIOG_TM4C129 47 // GPIO Port G
#define INT_GPIOH_TM4C129 48 // GPIO Port H
#define INT_UART2_TM4C129 49 // UART2
#define INT_SSI1_TM4C129 50 // SSI1
#define INT_TIMER3A_TM4C129 51 // 16/32-Bit Timer 3A
#define INT_TIMER3B_TM4C129 52 // 16/32-Bit Timer 3B
#define INT_I2C1_TM4C129 53 // I2C1
#define INT_CAN0_TM4C129 54 // CAN 0
#define INT_CAN1_TM4C129 55 // CAN1
#define INT_EMAC0_TM4C129 56 // Ethernet MAC
#define INT_HIBERNATE_TM4C129 57 // HIB
#define INT_USB0_TM4C129 58 // USB MAC
#define INT_PWM0_3_TM4C129 59 // PWM Generator 3
#define INT_UDMA_TM4C129 60 // uDMA 0 Software
#define INT_UDMAERR_TM4C129 61 // uDMA 0 Error
#define INT_ADC1SS0_TM4C129 62 // ADC1 Sequence 0
#define INT_ADC1SS1_TM4C129 63 // ADC1 Sequence 1
#define INT_ADC1SS2_TM4C129 64 // ADC1 Sequence 2
#define INT_ADC1SS3_TM4C129 65 // ADC1 Sequence 3
#define INT_EPI0_TM4C129 66 // EPI 0
#define INT_GPIOJ_TM4C129 67 // GPIO Port J
#define INT_GPIOK_TM4C129 68 // GPIO Port K
#define INT_GPIOL_TM4C129 69 // GPIO Port L
#define INT_SSI2_TM4C129 70 // SSI 2
#define INT_SSI3_TM4C129 71 // SSI 3
#define INT_UART3_TM4C129 72 // UART 3
#define INT_UART4_TM4C129 73 // UART 4
#define INT_UART5_TM4C129 74 // UART 5
#define INT_UART6_TM4C129 75 // UART 6
#define INT_UART7_TM4C129 76 // UART 7
#define INT_I2C2_TM4C129 77 // I2C 2
#define INT_I2C3_TM4C129 78 // I2C 3
#define INT_TIMER4A_TM4C129 79 // Timer 4A
#define INT_TIMER4B_TM4C129 80 // Timer 4B
#define INT_TIMER5A_TM4C129 81 // Timer 5A
#define INT_TIMER5B_TM4C129 82 // Timer 5B
#define INT_SYSEXC_TM4C129 83 // Floating-Point Exception
// (imprecise)
#define INT_I2C4_TM4C129 86 // I2C 4
#define INT_I2C5_TM4C129 87 // I2C 5
#define INT_GPIOM_TM4C129 88 // GPIO Port M
#define INT_GPION_TM4C129 89 // GPIO Port N
#define INT_TAMPER0_TM4C129 91 // Tamper
#define INT_GPIOP0_TM4C129 92 // GPIO Port P (Summary or P0)
#define INT_GPIOP1_TM4C129 93 // GPIO Port P1
#define INT_GPIOP2_TM4C129 94 // GPIO Port P2
#define INT_GPIOP3_TM4C129 95 // GPIO Port P3
#define INT_GPIOP4_TM4C129 96 // GPIO Port P4
#define INT_GPIOP5_TM4C129 97 // GPIO Port P5
#define INT_GPIOP6_TM4C129 98 // GPIO Port P6
#define INT_GPIOP7_TM4C129 99 // GPIO Port P7
#define INT_GPIOQ0_TM4C129 100 // GPIO Port Q (Summary or Q0)
#define INT_GPIOQ1_TM4C129 101 // GPIO Port Q1
#define INT_GPIOQ2_TM4C129 102 // GPIO Port Q2
#define INT_GPIOQ3_TM4C129 103 // GPIO Port Q3
#define INT_GPIOQ4_TM4C129 104 // GPIO Port Q4
#define INT_GPIOQ5_TM4C129 105 // GPIO Port Q5
#define INT_GPIOQ6_TM4C129 106 // GPIO Port Q6
#define INT_GPIOQ7_TM4C129 107 // GPIO Port Q7
#define INT_GPIOR_TM4C129 108 // GPIO Port R
#define INT_GPIOS_TM4C129 109 // GPIO Port S
#define INT_SHA0_TM4C129 110 // SHA/MD5
#define INT_AES0_TM4C129 111 // AES
#define INT_DES0_TM4C129 112 // DES
#define INT_LCD0_TM4C129 113 // LCD
#define INT_TIMER6A_TM4C129 114 // 16/32-Bit Timer 6A
#define INT_TIMER6B_TM4C129 115 // 16/32-Bit Timer 6B
#define INT_TIMER7A_TM4C129 116 // 16/32-Bit Timer 7A
#define INT_TIMER7B_TM4C129 117 // 16/32-Bit Timer 7B
#define INT_I2C6_TM4C129 118 // I2C 6
#define INT_I2C7_TM4C129 119 // I2C 7
#define INT_ONEWIRE0_TM4C129 121 // 1-Wire
#define INT_I2C8_TM4C129 125 // I2C 8
#define INT_I2C9_TM4C129 126 // I2C 9
#define INT_GPIOT_TM4C129 127 // GPIO T
#define NUM_INTERRUPTS_TM4C129 129
//*****************************************************************************
//
// TM4C123 Interrupt Class Definition
//
//*****************************************************************************
#if defined(TARGET_IS_TM4C123_RA1) || defined(TARGET_IS_TM4C123_RA2) || \
defined(TARGET_IS_TM4C123_RA3) || defined(TARGET_IS_TM4C123_RB0) || \
defined(TARGET_IS_TM4C123_RB1) || defined(PART_TM4C1230C3PM) || \
defined(PART_TM4C1230D5PM) || defined(PART_TM4C1230E6PM) || \
defined(PART_TM4C1230H6PM) || defined(PART_TM4C1231C3PM) || \
defined(PART_TM4C1231D5PM) || defined(PART_TM4C1231D5PZ) || \
defined(PART_TM4C1231E6PM) || defined(PART_TM4C1231E6PZ) || \
defined(PART_TM4C1231H6PM) || defined(PART_TM4C1231H6PZ) || \
defined(PART_TM4C1232C3PM) || defined(PART_TM4C1232D5PM) || \
defined(PART_TM4C1232E6PM) || defined(PART_TM4C1232H6PM) || \
defined(PART_TM4C1233C3PM) || defined(PART_TM4C1233D5PM) || \
defined(PART_TM4C1233D5PZ) || defined(PART_TM4C1233E6PM) || \
defined(PART_TM4C1233E6PZ) || defined(PART_TM4C1233H6PM) || \
defined(PART_TM4C1233H6PZ) || defined(PART_TM4C1236D5PM) || \
defined(PART_TM4C1236E6PM) || defined(PART_TM4C1236H6PM) || \
defined(PART_TM4C1237D5PM) || defined(PART_TM4C1237D5PZ) || \
defined(PART_TM4C1237E6PM) || defined(PART_TM4C1237E6PZ) || \
defined(PART_TM4C1237H6PM) || defined(PART_TM4C1237H6PZ) || \
defined(PART_TM4C123AE6PM) || defined(PART_TM4C123AH6PM) || \
defined(PART_TM4C123BE6PM) || defined(PART_TM4C123BE6PZ) || \
defined(PART_TM4C123BH6PM) || defined(PART_TM4C123BH6PZ) || \
defined(PART_TM4C123FE6PM) || defined(PART_TM4C123FH6PM) || \
defined(PART_TM4C123GE6PM) || defined(PART_TM4C123GE6PZ) || \
defined(PART_TM4C123GH6PM) || defined(PART_TM4C123GH6PZ) || \
defined(PART_TM4C1231H6PGE) || defined(PART_TM4C1233H6PGE) || \
defined(PART_TM4C1237H6PGE) || defined(PART_TM4C123BH6PGE) || \
defined(PART_TM4C123BH6ZRB) || defined(PART_TM4C123GH6PGE) || \
defined(PART_TM4C123GH6ZRB) || defined(PART_TM4C123GH6ZXR)
#define INT_RESOLVE(intname, class) intname##TM4C123
//*****************************************************************************
//
// TM4C129 Interrupt Class Definition
//
//*****************************************************************************
#elif defined(TARGET_IS_TM4C129_RA0) || defined(PART_TM4C1290NCPDT) || \
defined(PART_TM4C1290NCZAD) || defined(PART_TM4C1292NCPDT) || \
defined(PART_TM4C1292NCZAD) || defined(PART_TM4C1294KCPDT) || \
defined(PART_TM4C1294NCPDT) || defined(PART_TM4C1294NCZAD) || \
defined(PART_TM4C1297NCZAD) || defined(PART_TM4C1299KCZAD) || \
defined(PART_TM4C1299NCZAD) || defined(PART_TM4C129CNCPDT) || \
defined(PART_TM4C129CNCZAD) || defined(PART_TM4C129DNCPDT) || \
defined(PART_TM4C129DNCZAD) || defined(PART_TM4C129EKCPDT) || \
defined(PART_TM4C129ENCPDT) || defined(PART_TM4C129ENCZAD) || \
defined(PART_TM4C129LNCZAD) || defined(PART_TM4C129XKCZAD) || \
defined(PART_TM4C129XNCZAD)
#define INT_RESOLVE(intname, class) intname##TM4C129
#else
#define INT_DEVICE_CLASS "UNKNOWN"
#endif
//*****************************************************************************
//
// Macros to resolve the INT_PERIPH_CLASS name to a common INT_PERIPH name.
//
//*****************************************************************************
#define INT_CONCAT(intname, class) INT_RESOLVE(intname, class)
//*****************************************************************************
//
// The following are defines for the interrupt assignments.
//
//*****************************************************************************
#define INT_ADC0SS0 INT_CONCAT(INT_ADC0SS0_, INT_DEVICE_CLASS)
#define INT_ADC0SS1 INT_CONCAT(INT_ADC0SS1_, INT_DEVICE_CLASS)
#define INT_ADC0SS2 INT_CONCAT(INT_ADC0SS2_, INT_DEVICE_CLASS)
#define INT_ADC0SS3 INT_CONCAT(INT_ADC0SS3_, INT_DEVICE_CLASS)
#define INT_ADC1SS0 INT_CONCAT(INT_ADC1SS0_, INT_DEVICE_CLASS)
#define INT_ADC1SS1 INT_CONCAT(INT_ADC1SS1_, INT_DEVICE_CLASS)
#define INT_ADC1SS2 INT_CONCAT(INT_ADC1SS2_, INT_DEVICE_CLASS)
#define INT_ADC1SS3 INT_CONCAT(INT_ADC1SS3_, INT_DEVICE_CLASS)
#define INT_AES0 INT_CONCAT(INT_AES0_, INT_DEVICE_CLASS)
#define INT_CAN0 INT_CONCAT(INT_CAN0_, INT_DEVICE_CLASS)
#define INT_CAN1 INT_CONCAT(INT_CAN1_, INT_DEVICE_CLASS)
#define INT_COMP0 INT_CONCAT(INT_COMP0_, INT_DEVICE_CLASS)
#define INT_COMP1 INT_CONCAT(INT_COMP1_, INT_DEVICE_CLASS)
#define INT_COMP2 INT_CONCAT(INT_COMP2_, INT_DEVICE_CLASS)
#define INT_DES0 INT_CONCAT(INT_DES0_, INT_DEVICE_CLASS)
#define INT_EMAC0 INT_CONCAT(INT_EMAC0_, INT_DEVICE_CLASS)
#define INT_EPI0 INT_CONCAT(INT_EPI0_, INT_DEVICE_CLASS)
#define INT_FLASH INT_CONCAT(INT_FLASH_, INT_DEVICE_CLASS)
#define INT_GPIOA INT_CONCAT(INT_GPIOA_, INT_DEVICE_CLASS)
#define INT_GPIOB INT_CONCAT(INT_GPIOB_, INT_DEVICE_CLASS)
#define INT_GPIOC INT_CONCAT(INT_GPIOC_, INT_DEVICE_CLASS)
#define INT_GPIOD INT_CONCAT(INT_GPIOD_, INT_DEVICE_CLASS)
#define INT_GPIOE INT_CONCAT(INT_GPIOE_, INT_DEVICE_CLASS)
#define INT_GPIOF INT_CONCAT(INT_GPIOF_, INT_DEVICE_CLASS)
#define INT_GPIOG INT_CONCAT(INT_GPIOG_, INT_DEVICE_CLASS)
#define INT_GPIOH INT_CONCAT(INT_GPIOH_, INT_DEVICE_CLASS)
#define INT_GPIOJ INT_CONCAT(INT_GPIOJ_, INT_DEVICE_CLASS)
#define INT_GPIOK INT_CONCAT(INT_GPIOK_, INT_DEVICE_CLASS)
#define INT_GPIOL INT_CONCAT(INT_GPIOL_, INT_DEVICE_CLASS)
#define INT_GPIOM INT_CONCAT(INT_GPIOM_, INT_DEVICE_CLASS)
#define INT_GPION INT_CONCAT(INT_GPION_, INT_DEVICE_CLASS)
#define INT_GPIOP0 INT_CONCAT(INT_GPIOP0_, INT_DEVICE_CLASS)
#define INT_GPIOP1 INT_CONCAT(INT_GPIOP1_, INT_DEVICE_CLASS)
#define INT_GPIOP2 INT_CONCAT(INT_GPIOP2_, INT_DEVICE_CLASS)
#define INT_GPIOP3 INT_CONCAT(INT_GPIOP3_, INT_DEVICE_CLASS)
#define INT_GPIOP4 INT_CONCAT(INT_GPIOP4_, INT_DEVICE_CLASS)
#define INT_GPIOP5 INT_CONCAT(INT_GPIOP5_, INT_DEVICE_CLASS)
#define INT_GPIOP6 INT_CONCAT(INT_GPIOP6_, INT_DEVICE_CLASS)
#define INT_GPIOP7 INT_CONCAT(INT_GPIOP7_, INT_DEVICE_CLASS)
#define INT_GPIOQ0 INT_CONCAT(INT_GPIOQ0_, INT_DEVICE_CLASS)
#define INT_GPIOQ1 INT_CONCAT(INT_GPIOQ1_, INT_DEVICE_CLASS)
#define INT_GPIOQ2 INT_CONCAT(INT_GPIOQ2_, INT_DEVICE_CLASS)
#define INT_GPIOQ3 INT_CONCAT(INT_GPIOQ3_, INT_DEVICE_CLASS)
#define INT_GPIOQ4 INT_CONCAT(INT_GPIOQ4_, INT_DEVICE_CLASS)
#define INT_GPIOQ5 INT_CONCAT(INT_GPIOQ5_, INT_DEVICE_CLASS)
#define INT_GPIOQ6 INT_CONCAT(INT_GPIOQ6_, INT_DEVICE_CLASS)
#define INT_GPIOQ7 INT_CONCAT(INT_GPIOQ7_, INT_DEVICE_CLASS)
#define INT_GPIOR INT_CONCAT(INT_GPIOR_, INT_DEVICE_CLASS)
#define INT_GPIOS INT_CONCAT(INT_GPIOS_, INT_DEVICE_CLASS)
#define INT_GPIOT INT_CONCAT(INT_GPIOT_, INT_DEVICE_CLASS)
#define INT_HIBERNATE INT_CONCAT(INT_HIBERNATE_, INT_DEVICE_CLASS)
#define INT_I2C0 INT_CONCAT(INT_I2C0_, INT_DEVICE_CLASS)
#define INT_I2C1 INT_CONCAT(INT_I2C1_, INT_DEVICE_CLASS)
#define INT_I2C2 INT_CONCAT(INT_I2C2_, INT_DEVICE_CLASS)
#define INT_I2C3 INT_CONCAT(INT_I2C3_, INT_DEVICE_CLASS)
#define INT_I2C4 INT_CONCAT(INT_I2C4_, INT_DEVICE_CLASS)
#define INT_I2C5 INT_CONCAT(INT_I2C5_, INT_DEVICE_CLASS)
#define INT_I2C6 INT_CONCAT(INT_I2C6_, INT_DEVICE_CLASS)
#define INT_I2C7 INT_CONCAT(INT_I2C7_, INT_DEVICE_CLASS)
#define INT_I2C8 INT_CONCAT(INT_I2C8_, INT_DEVICE_CLASS)
#define INT_I2C9 INT_CONCAT(INT_I2C9_, INT_DEVICE_CLASS)
#define INT_LCD0 INT_CONCAT(INT_LCD0_, INT_DEVICE_CLASS)
#define INT_ONEWIRE0 INT_CONCAT(INT_ONEWIRE0_, INT_DEVICE_CLASS)
#define INT_PWM0_0 INT_CONCAT(INT_PWM0_0_, INT_DEVICE_CLASS)
#define INT_PWM0_1 INT_CONCAT(INT_PWM0_1_, INT_DEVICE_CLASS)
#define INT_PWM0_2 INT_CONCAT(INT_PWM0_2_, INT_DEVICE_CLASS)
#define INT_PWM0_3 INT_CONCAT(INT_PWM0_3_, INT_DEVICE_CLASS)
#define INT_PWM0_FAULT INT_CONCAT(INT_PWM0_FAULT_, INT_DEVICE_CLASS)
#define INT_PWM1_0 INT_CONCAT(INT_PWM1_0_, INT_DEVICE_CLASS)
#define INT_PWM1_1 INT_CONCAT(INT_PWM1_1_, INT_DEVICE_CLASS)
#define INT_PWM1_2 INT_CONCAT(INT_PWM1_2_, INT_DEVICE_CLASS)
#define INT_PWM1_3 INT_CONCAT(INT_PWM1_3_, INT_DEVICE_CLASS)
#define INT_PWM1_FAULT INT_CONCAT(INT_PWM1_FAULT_, INT_DEVICE_CLASS)
#define INT_QEI0 INT_CONCAT(INT_QEI0_, INT_DEVICE_CLASS)
#define INT_QEI1 INT_CONCAT(INT_QEI1_, INT_DEVICE_CLASS)
#define INT_SHA0 INT_CONCAT(INT_SHA0_, INT_DEVICE_CLASS)
#define INT_SSI0 INT_CONCAT(INT_SSI0_, INT_DEVICE_CLASS)
#define INT_SSI1 INT_CONCAT(INT_SSI1_, INT_DEVICE_CLASS)
#define INT_SSI2 INT_CONCAT(INT_SSI2_, INT_DEVICE_CLASS)
#define INT_SSI3 INT_CONCAT(INT_SSI3_, INT_DEVICE_CLASS)
#define INT_SYSCTL INT_CONCAT(INT_SYSCTL_, INT_DEVICE_CLASS)
#define INT_SYSEXC INT_CONCAT(INT_SYSEXC_, INT_DEVICE_CLASS)
#define INT_TAMPER0 INT_CONCAT(INT_TAMPER0_, INT_DEVICE_CLASS)
#define INT_TIMER0A INT_CONCAT(INT_TIMER0A_, INT_DEVICE_CLASS)
#define INT_TIMER0B INT_CONCAT(INT_TIMER0B_, INT_DEVICE_CLASS)
#define INT_TIMER1A INT_CONCAT(INT_TIMER1A_, INT_DEVICE_CLASS)
#define INT_TIMER1B INT_CONCAT(INT_TIMER1B_, INT_DEVICE_CLASS)
#define INT_TIMER2A INT_CONCAT(INT_TIMER2A_, INT_DEVICE_CLASS)
#define INT_TIMER2B INT_CONCAT(INT_TIMER2B_, INT_DEVICE_CLASS)
#define INT_TIMER3A INT_CONCAT(INT_TIMER3A_, INT_DEVICE_CLASS)
#define INT_TIMER3B INT_CONCAT(INT_TIMER3B_, INT_DEVICE_CLASS)
#define INT_TIMER4A INT_CONCAT(INT_TIMER4A_, INT_DEVICE_CLASS)
#define INT_TIMER4B INT_CONCAT(INT_TIMER4B_, INT_DEVICE_CLASS)
#define INT_TIMER5A INT_CONCAT(INT_TIMER5A_, INT_DEVICE_CLASS)
#define INT_TIMER5B INT_CONCAT(INT_TIMER5B_, INT_DEVICE_CLASS)
#define INT_TIMER6A INT_CONCAT(INT_TIMER6A_, INT_DEVICE_CLASS)
#define INT_TIMER6B INT_CONCAT(INT_TIMER6B_, INT_DEVICE_CLASS)
#define INT_TIMER7A INT_CONCAT(INT_TIMER7A_, INT_DEVICE_CLASS)
#define INT_TIMER7B INT_CONCAT(INT_TIMER7B_, INT_DEVICE_CLASS)
#define INT_UART0 INT_CONCAT(INT_UART0_, INT_DEVICE_CLASS)
#define INT_UART1 INT_CONCAT(INT_UART1_, INT_DEVICE_CLASS)
#define INT_UART2 INT_CONCAT(INT_UART2_, INT_DEVICE_CLASS)
#define INT_UART3 INT_CONCAT(INT_UART3_, INT_DEVICE_CLASS)
#define INT_UART4 INT_CONCAT(INT_UART4_, INT_DEVICE_CLASS)
#define INT_UART5 INT_CONCAT(INT_UART5_, INT_DEVICE_CLASS)
#define INT_UART6 INT_CONCAT(INT_UART6_, INT_DEVICE_CLASS)
#define INT_UART7 INT_CONCAT(INT_UART7_, INT_DEVICE_CLASS)
#define INT_UDMA INT_CONCAT(INT_UDMA_, INT_DEVICE_CLASS)
#define INT_UDMAERR INT_CONCAT(INT_UDMAERR_, INT_DEVICE_CLASS)
#define INT_USB0 INT_CONCAT(INT_USB0_, INT_DEVICE_CLASS)
#define INT_WATCHDOG INT_CONCAT(INT_WATCHDOG_, INT_DEVICE_CLASS)
#define INT_WTIMER0A INT_CONCAT(INT_WTIMER0A_, INT_DEVICE_CLASS)
#define INT_WTIMER0B INT_CONCAT(INT_WTIMER0B_, INT_DEVICE_CLASS)
#define INT_WTIMER1A INT_CONCAT(INT_WTIMER1A_, INT_DEVICE_CLASS)
#define INT_WTIMER1B INT_CONCAT(INT_WTIMER1B_, INT_DEVICE_CLASS)
#define INT_WTIMER2A INT_CONCAT(INT_WTIMER2A_, INT_DEVICE_CLASS)
#define INT_WTIMER2B INT_CONCAT(INT_WTIMER2B_, INT_DEVICE_CLASS)
#define INT_WTIMER3A INT_CONCAT(INT_WTIMER3A_, INT_DEVICE_CLASS)
#define INT_WTIMER3B INT_CONCAT(INT_WTIMER3B_, INT_DEVICE_CLASS)
#define INT_WTIMER4A INT_CONCAT(INT_WTIMER4A_, INT_DEVICE_CLASS)
#define INT_WTIMER4B INT_CONCAT(INT_WTIMER4B_, INT_DEVICE_CLASS)
#define INT_WTIMER5A INT_CONCAT(INT_WTIMER5A_, INT_DEVICE_CLASS)
#define INT_WTIMER5B INT_CONCAT(INT_WTIMER5B_, INT_DEVICE_CLASS)
//*****************************************************************************
//
// The following are defines for the total number of interrupts.
//
//*****************************************************************************
#define NUM_INTERRUPTS INT_CONCAT(NUM_INTERRUPTS_, INT_DEVICE_CLASS)
//*****************************************************************************
//
// The following are defines for the total number of priority levels.
//
//*****************************************************************************
#define NUM_PRIORITY 8
#define NUM_PRIORITY_BITS 3
#endif // __HW_INTS_H__
|
c10097721e80ec1a988b1264bdaa477317b79ba2
|
7d232f51e2330a4f537c50ede9c6bc023d656fd4
|
/src/core/ext/upb-generated/google/api/http.upb.c
|
1f687da44f99acc1f861b65b1683ed1db5ffd764
|
[
"BSD-3-Clause",
"MPL-2.0",
"Apache-2.0"
] |
permissive
|
grpc/grpc
|
6975af3ba6f07a6fe965b875a0c09abf18999a52
|
e4d598ab64aa54f1da78c6ed6133b741742d11d4
|
refs/heads/master
| 2023-08-31T01:10:22.666618
| 2023-08-30T22:35:17
| 2023-08-30T22:35:17
| 27,729,880
| 42,330
| 13,022
|
Apache-2.0
| 2023-09-14T21:54:19
| 2014-12-08T18:58:53
|
C++
|
UTF-8
|
C
| false
| false
| 4,744
|
c
|
http.upb.c
|
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* google/api/http.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/generated_code_support.h"
#include "google/api/http.upb.h"
// Must be last.
#include "upb/port/def.inc"
static const upb_MiniTableSub google_api_Http_submsgs[1] = {
{.submsg = &google_api_HttpRule_msg_init},
};
static const upb_MiniTableField google_api_Http__fields[2] = {
{1, UPB_SIZE(0, 8), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
{2, UPB_SIZE(4, 0), 0, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
};
const upb_MiniTable google_api_Http_msg_init = {
&google_api_Http_submsgs[0],
&google_api_Http__fields[0],
UPB_SIZE(8, 16), 2, kUpb_ExtMode_NonExtendable, 2, UPB_FASTTABLE_MASK(24), 0,
UPB_FASTTABLE_INIT({
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
{0x000800003f00000a, &upb_prm_1bt_max128b},
{0x000000003f000010, &upb_psb1_1bt},
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
})
};
static const upb_MiniTableSub google_api_HttpRule_submsgs[2] = {
{.submsg = &google_api_CustomHttpPattern_msg_init},
{.submsg = &google_api_HttpRule_msg_init},
};
static const upb_MiniTableField google_api_HttpRule__fields[10] = {
{1, UPB_SIZE(16, 24), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
{2, 8, -1, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
{3, 8, -1, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
{4, 8, -1, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
{5, 8, -1, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
{6, 8, -1, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
{7, UPB_SIZE(24, 40), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
{8, 8, -1, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
{11, UPB_SIZE(4, 56), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
{12, UPB_SIZE(32, 64), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
};
const upb_MiniTable google_api_HttpRule_msg_init = {
&google_api_HttpRule_submsgs[0],
&google_api_HttpRule__fields[0],
UPB_SIZE(40, 80), 10, kUpb_ExtMode_NonExtendable, 8, UPB_FASTTABLE_MASK(120), 0,
UPB_FASTTABLE_INIT({
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
{0x001800003f00000a, &upb_pss_1bt},
{0x0008000002000012, &upb_pos_1bt},
{0x000800000300001a, &upb_pos_1bt},
{0x0008000004000022, &upb_pos_1bt},
{0x000800000500002a, &upb_pos_1bt},
{0x0008000006000032, &upb_pos_1bt},
{0x002800003f00003a, &upb_pss_1bt},
{0x0008000008000042, &upb_pom_1bt_max64b},
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
{0x003800003f01005a, &upb_prm_1bt_max128b},
{0x004000003f000062, &upb_pss_1bt},
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
})
};
static const upb_MiniTableField google_api_CustomHttpPattern__fields[2] = {
{1, 0, 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
{2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
};
const upb_MiniTable google_api_CustomHttpPattern_msg_init = {
NULL,
&google_api_CustomHttpPattern__fields[0],
UPB_SIZE(16, 32), 2, kUpb_ExtMode_NonExtendable, 2, UPB_FASTTABLE_MASK(24), 0,
UPB_FASTTABLE_INIT({
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
{0x000000003f00000a, &upb_pss_1bt},
{0x001000003f000012, &upb_pss_1bt},
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
})
};
static const upb_MiniTable *messages_layout[3] = {
&google_api_Http_msg_init,
&google_api_HttpRule_msg_init,
&google_api_CustomHttpPattern_msg_init,
};
const upb_MiniTableFile google_api_http_proto_upb_file_layout = {
messages_layout,
NULL,
NULL,
3,
0,
0,
};
#include "upb/port/undef.inc"
|
e3a18db3e34e9fb5af59b04151a0f70c75656655
|
a831bb046bdc40567682f01f2dc8e73a3803120e
|
/platforms/libasr-client/include/asr_engine.h
|
43fe23346f872cb53ffc8a405008904ae6ed64ab
|
[
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"LGPL-2.1-or-later"
] |
permissive
|
unispeech/unimrcp
|
5d9567c63d849c0e50bf0ee7b11259a798648d3e
|
9913f23691b3a1b8a7e84be5ba25478031352158
|
refs/heads/master
| 2023-08-05T08:22:40.918060
| 2023-08-01T17:35:29
| 2023-08-01T17:35:29
| 38,894,063
| 363
| 159
|
Apache-2.0
| 2023-05-17T12:50:27
| 2015-07-10T17:49:42
|
C
|
UTF-8
|
C
| false
| false
| 7,934
|
h
|
asr_engine.h
|
/*
* Copyright 2009-2015 Arsen Chaloyan
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ASR_ENGINE_H
#define ASR_ENGINE_H
/**
* @file asr_engine.h
* @brief Basic ASR engine on top of UniMRCP client library
*/
/* APT includes */
#include "apt_log.h"
/* APR includes */
#include <apr_thread_cond.h>
/* Common includes */
#include "unimrcp_client.h"
#include "mrcp_application.h"
/* Recognizer includes */
#include "mrcp_recog_header.h"
#include "mrcp_recog_resource.h"
/* MPF includes */
#include <mpf_frame_buffer.h>
#include "asr_engine_common.h"
/** Lib export/import defines (win32) */
#ifdef WIN32
#ifdef ASR_CLIENT_STATIC_LIB
#define ASR_CLIENT_DECLARE(type) type __stdcall
#else
#ifdef ASR_CLIENT_LIB_EXPORT
#define ASR_CLIENT_DECLARE(type) __declspec(dllexport) type __stdcall
#else
#define ASR_CLIENT_DECLARE(type) __declspec(dllimport) type __stdcall
#endif
#endif
#else
#define ASR_CLIENT_DECLARE(type) type
#endif
APT_BEGIN_EXTERN_C
/** Opaque ASR engine */
typedef struct asr_engine_t asr_engine_t;
/** Opaque ASR session */
typedef struct asr_session_t asr_session_t;
typedef enum {
INPUT_MODE_NONE,
INPUT_MODE_FILE,
INPUT_MODE_STREAM
} input_mode_e;
#define MAX_URIS 10
/** ASR engine on top of UniMRCP client stack */
struct asr_engine_t {
/** MRCP client stack */
mrcp_client_t *mrcp_client;
/** MRCP client stack */
mrcp_application_t *mrcp_app;
/** Memory pool */
apr_pool_t *pool;
};
/** ASR session on top of UniMRCP session/channel */
struct asr_session_t {
/** Back pointer to engine */
asr_engine_t *engine;
/** MRCP session */
mrcp_session_t *mrcp_session;
/** MRCP channel */
mrcp_channel_t *mrcp_channel;
/** RECOGNITION-COMPLETE message */
mrcp_message_t *recog_complete;
/** Input mode (either file or stream) */
input_mode_e input_mode;
/** File to read media frames from */
FILE *audio_in;
/* Buffer of media frames */
mpf_frame_buffer_t *media_buffer;
/** Streaming is in-progress */
apt_bool_t streaming;
/** Conditional wait object */
apr_thread_cond_t *wait_object;
/** Mutex of the wait object */
apr_thread_mutex_t *mutex;
/** Message sent from client stack */
const mrcp_app_message_t *app_message;
};
/**
* Create ASR engine.
* @param root_dir_path the path to root directory
* @param log_priority the log priority level
* @param log_output the log output mode
*/
ASR_CLIENT_DECLARE(asr_engine_t*) asr_engine_create(
const char *root_dir_path,
apt_log_priority_e log_priority,
apt_log_output_e log_output);
/**
* Destroy ASR engine.
* @param engine the engine to destroy
*/
ASR_CLIENT_DECLARE(apt_bool_t) asr_engine_destroy(asr_engine_t *engine);
/**
* Create ASR session.
* @param engine the engine session belongs to
* @param profile the name of UniMRCP profile to use
*/
ASR_CLIENT_DECLARE(asr_session_t*) asr_session_create(asr_engine_t *engine, const char *profile);
/**
* Initiate recognition based on specified grammar and input file.
* @param session the session to run recognition in the scope of
* @param grammar_file the name of the grammar file to use (path is relative to data dir)
* @param input_file the name of the audio input file to use (path is relative to data dir)
* @param set_params_file the name of the parameters file to use (path is relative to data dir)
* @param send_set_params whether or not to use a separate SET-PARAMS request
* @return the recognition result (input element of NLSML content)
*/
ASR_CLIENT_DECLARE(const char*) asr_session_file_recognize(
asr_session_t *session,
const char *grammar_file,
const char *input_file,
const char *set_params_file,
apt_bool_t send_set_params);
/**
* Initiate recognition based on specified grammar and input stream.
* @param session the session to run recognition in the scope of
* @param grammar_file the name of the grammar file to use (path is relative to data dir)
* @return the recognition result (input element of NLSML content)
*
* @remark Audio data should be streamed through asr_session_stream_write() function calls
*/
ASR_CLIENT_DECLARE(const char*) asr_session_stream_recognize(
asr_session_t *session,
const char *grammar_file);
/**
* Write audio data to recognize.
* @param session the session to write audio data for
* @param data the audio data
* @param size the size of data
*/
ASR_CLIENT_DECLARE(apt_bool_t) asr_session_stream_write(
asr_session_t *session,
char *data,
int size);
/**
* Send SET-PARAM request.
* @param session the session to send SET-PARAM in the scope of
* @param set_params_file the name of the parameters file to use (path is relative to data dir)
* @param param_name the name of the individual parameter to set
* @param param_value the value of the individual parameter to set
*
* @remark Either param_name/param_value or set_param_file is supposed to be specified
*/
ASR_CLIENT_DECLARE(apt_bool_t) asr_session_set_param(
asr_session_t *session,
const char *set_params_file,
const char *param_name,
const char *param_value);
/**
* Send GET-PARAM request.
* @param session the session to send GET-PARAM in the scope of
*/
ASR_CLIENT_DECLARE(ParameterSet*) asr_session_get_all_params(asr_session_t *session);
/**
* Destroy ASR session.
* @param session the session to destroy
*/
ASR_CLIENT_DECLARE(apt_bool_t) asr_session_destroy(asr_session_t *session);
/**
* Set log priority.
* @param priority the priority to set
*/
ASR_CLIENT_DECLARE(apt_bool_t) asr_engine_log_priority_set(apt_log_priority_e log_priority);
/**
* Send DEFINE-GRAMMAR request.
* @param session the session to send DEFINE-GRAMMAR in the scope of
* @param grammar_uri the grammar URI to use
* @param grammar_id the identifier of the grammar to use in Content-Id
*/
ASR_CLIENT_DECLARE(apt_bool_t) asr_session_define_grammar(
asr_session_t *session,
const char *grammar_uri,
int grammar_id);
/**
* Send RECOGNIZE request.
* @param session the session to send DEFINE-GRAMMAR in the scope of
* @param grammar_file the name of the grammar file to use (path is relative to data dir)
* @param input_file the name of the audio input file to use (path is relative to data dir)
* @param uri_count the number of grammar URIs to use
* @param weights the array of grammar weights to use
* @param set_params_file the name of the parameters file to use (path is relative to data dir)
* @param send_set_params whether or not to use a separate SET-PARAMS request
*/
ASR_CLIENT_DECLARE(apt_bool_t) asr_session_file_recognize_send(
asr_session_t *session,
const char *grammar_file,
const char *input_file,
int uri_count,
float weights[],
const char *set_params_file,
apt_bool_t send_set_params);
/**
* Receive MRCP event.
* @param session the session to receive an event in the scope of
*/
ASR_CLIENT_DECLARE(mrcp_recognizer_event_id) asr_session_file_recognize_receive(asr_session_t *session);
/**
* Get NLSML instance.
* @param message the message to retreive NSLML results from
*/
ASR_CLIENT_DECLARE(const char*) nlsml_result_get(mrcp_message_t *message);
APT_END_EXTERN_C
#endif /* ASR_ENGINE_H */
|
64b74b815dc7e3ca8f3e864ab67719b5366871d1
|
31e7295f722c6db44dade2bdf7f85036d443f972
|
/test/ffi008/ffi008.c
|
28cbc708c8d4f006fa740b0c8eac077b17bf50d9
|
[
"BSD-2-Clause"
] |
permissive
|
idris-lang/Idris-dev
|
75f3197c5015157143984d903a179aeed2a2a135
|
80fa67e719d9ae69cec01ca94cb0183268d0eb72
|
refs/heads/master
| 2023-03-11T05:14:52.326880
| 2023-03-04T17:59:32
| 2023-03-04T17:59:32
| 2,386,778
| 3,289
| 800
|
NOASSERTION
| 2023-03-04T17:59:34
| 2011-09-14T16:55:49
|
Haskell
|
UTF-8
|
C
| false
| false
| 457
|
c
|
ffi008.c
|
#include <stdio.h>
#include <stdlib.h>
#include "ffi008.h"
int size1(void) {
return sizeof(struct test1);
}
int size2(void) {
return sizeof(struct test2);
}
struct test2 mystruct;
void print_mystruct(void) {
printf("a: %d b: %d\n", mystruct.a, mystruct.b);
}
struct test2* calc_struct(struct test1 *in)
{
struct test2 *out = malloc(sizeof(struct test2));
out->a = in->a * in->a;
out->b = in->b & 0x0000FFFF;
return out;
}
|
b80c9554eecb3b15d44f25a39453890aa477a4ed
|
bf57c754fc521bb21a497241a630862814687aea
|
/src/shared/gravity_value.c
|
f002e2f2d3d836ad471b28cc84a8a5b4d3de065d
|
[
"MIT"
] |
permissive
|
marcobambini/gravity
|
5986370f1ce4006a3d511914a0817044421565c5
|
1eb6d5ab98b9df4909513612a2bb9238a8304422
|
refs/heads/master
| 2023-09-01T03:17:11.493607
| 2023-08-18T12:57:34
| 2023-08-18T12:57:34
| 83,052,165
| 4,724
| 333
|
MIT
| 2023-08-05T08:28:09
| 2017-02-24T14:57:37
|
C
|
UTF-8
|
C
| false
| false
| 89,667
|
c
|
gravity_value.c
|
//
// gravity_value.c
// gravity
//
// Created by Marco Bambini on 11/12/14.
// Copyright (c) 2014 CreoLabs. All rights reserved.
//
#include <inttypes.h>
#include "gravity_hash.h"
#include "gravity_core.h"
#include "gravity_value.h"
#include "gravity_utils.h"
#include "gravity_memory.h"
#include "gravity_macros.h"
#include "gravity_opcodes.h"
#include "gravity_vmmacros.h"
// mark object visited to avoid infinite loop
#define SET_OBJECT_VISITED_FLAG(_obj, _flag) (((gravity_object_t *)_obj)->gc.visited = _flag)
// MARK: -
static void gravity_function_special_serialize (gravity_function_t *f, const char *key, json_t *json);
static gravity_map_t *gravity_map_deserialize (gravity_vm *vm, json_value *json);
static void gravity_hash_serialize (gravity_hash_t *table, gravity_value_t key, gravity_value_t value, void *data) {
#pragma unused(table)
json_t *json = (json_t *)data;
if (VALUE_ISA_CLOSURE(value)) value = VALUE_FROM_OBJECT(VALUE_AS_CLOSURE(value)->f);
if (VALUE_ISA_FUNCTION(value)) {
gravity_function_t *f = VALUE_AS_FUNCTION(value);
if (f->tag == EXEC_TYPE_SPECIAL) gravity_function_special_serialize(f, VALUE_AS_CSTRING(key), json);
else {
// there was an issue here due to the fact that when a subclass needs to use a $init from a superclass
// internally it has a unique name (key) but f->identifier continue to be called $init
// without this fix the subclass would continue to have 2 or more $init functions
gravity_string_t *s = VALUE_AS_STRING(key);
bool is_super_function = ((s->len > 5) && (string_casencmp(s->s, CLASS_INTERNAL_INIT_NAME, 5) == 0));
const char *saved = f->identifier;
if (is_super_function) f->identifier = s->s;
gravity_function_serialize(f, json);
if (is_super_function) f->identifier = saved;
}
}
else if (VALUE_ISA_CLASS(value)) {
gravity_class_serialize(VALUE_AS_CLASS(value), json);
}
else
assert(0);
}
static void gravity_hash_internalsize (gravity_hash_t *table, gravity_value_t key, gravity_value_t value, void *data1, void *data2) {
#pragma unused(table)
uint32_t *size = (uint32_t *)data1;
gravity_vm *vm = (gravity_vm *)data2;
*size = gravity_value_size(vm, key);
*size += gravity_value_size(vm, value);
}
static void gravity_hash_gray (gravity_hash_t *table, gravity_value_t key, gravity_value_t value, void *data1) {
#pragma unused(table)
gravity_vm *vm = (gravity_vm *)data1;
gravity_gray_value(vm, key);
gravity_gray_value(vm, value);
}
// MARK: -
gravity_module_t *gravity_module_new (gravity_vm *vm, const char *identifier) {
gravity_module_t *m = (gravity_module_t *)mem_alloc(NULL, sizeof(gravity_module_t));
assert(m);
m->isa = gravity_class_module;
m->identifier = string_dup(identifier);
m->htable = gravity_hash_create(0, gravity_value_hash, gravity_value_equals, gravity_hash_keyvaluefree, (void*)vm);
if (vm) gravity_vm_transfer(vm, (gravity_object_t*)m);
return m;
}
void gravity_module_free (gravity_vm *vm, gravity_module_t *m) {
#pragma unused(vm)
if (m->identifier) mem_free(m->identifier);
gravity_hash_free(m->htable);
mem_free(m);
}
uint32_t gravity_module_size (gravity_vm *vm, gravity_module_t *m) {
SET_OBJECT_VISITED_FLAG(m, true);
uint32_t hash_size = 0;
gravity_hash_iterate2(m->htable, gravity_hash_internalsize, (void*)&hash_size, (void*)vm);
uint32_t module_size = (sizeof(gravity_module_t)) + string_size(m->identifier) + hash_size + gravity_hash_memsize(m->htable);
SET_OBJECT_VISITED_FLAG(m, false);
return module_size;
}
void gravity_module_blacken (gravity_vm *vm, gravity_module_t *m) {
gravity_vm_memupdate(vm, gravity_module_size(vm, m));
gravity_hash_iterate(m->htable, gravity_hash_gray, (void*)vm);
}
// MARK: -
void gravity_class_bind (gravity_class_t *c, const char *key, gravity_value_t value) {
if (VALUE_ISA_CLASS(value)) {
// set has_outer when bind a class inside another class
gravity_class_t *obj = VALUE_AS_CLASS(value);
obj->has_outer = true;
}
gravity_hash_insert(c->htable, VALUE_FROM_CSTRING(NULL, key), value);
}
gravity_class_t *gravity_class_getsuper (gravity_class_t *c) {
return c->superclass;
}
bool gravity_class_grow (gravity_class_t *c, uint32_t n) {
if (c->ivars) mem_free(c->ivars);
if (c->nivars + n >= MAX_IVARS) return false;
c->nivars += n;
c->ivars = (gravity_value_t *)mem_alloc(NULL, c->nivars * sizeof(gravity_value_t));
for (uint32_t i=0; i<c->nivars; ++i) c->ivars[i] = VALUE_FROM_NULL;
return true;
}
bool gravity_class_setsuper (gravity_class_t *baseclass, gravity_class_t *superclass) {
if (!superclass) return true;
baseclass->superclass = superclass;
// check meta class first
gravity_class_t *supermeta = (superclass) ? gravity_class_get_meta(superclass) : NULL;
uint32_t n1 = (supermeta) ? supermeta->nivars : 0;
if (n1) if (!gravity_class_grow (gravity_class_get_meta(baseclass), n1)) return false;
// then check real class
uint32_t n2 = (superclass) ? superclass->nivars : 0;
if (n2) if (!gravity_class_grow (baseclass, n2)) return false;
return true;
}
bool gravity_class_setsuper_extern (gravity_class_t *baseclass, const char *identifier) {
if (identifier) baseclass->superlook = string_dup(identifier);
return true;
}
gravity_class_t *gravity_class_new_single (gravity_vm *vm, const char *identifier, uint32_t nivar) {
gravity_class_t *c = (gravity_class_t *)mem_alloc(NULL, sizeof(gravity_class_t));
assert(c);
c->isa = gravity_class_class;
c->identifier = string_dup(identifier);
c->superclass = NULL;
c->nivars = nivar;
c->htable = gravity_hash_create(0, gravity_value_hash, gravity_value_equals, gravity_hash_keyfree, NULL);
if (nivar) {
c->ivars = (gravity_value_t *)mem_alloc(NULL, nivar * sizeof(gravity_value_t));
for (uint32_t i=0; i<nivar; ++i) c->ivars[i] = VALUE_FROM_NULL;
}
if (vm) gravity_vm_transfer(vm, (gravity_object_t*) c);
return c;
}
gravity_class_t *gravity_class_new_pair (gravity_vm *vm, const char *identifier, gravity_class_t *superclass, uint32_t nivar, uint32_t nsvar) {
// each class must have a valid identifier
if (!identifier) return NULL;
char buffer[512];
snprintf(buffer, sizeof(buffer), "%s meta", identifier);
// ivar count/grow is managed by gravity_class_setsuper
gravity_class_t *meta = gravity_class_new_single(vm, buffer, nsvar);
meta->objclass = gravity_class_object;
gravity_class_setsuper(meta, gravity_class_class);
gravity_class_t *c = gravity_class_new_single(vm, identifier, nivar);
c->objclass = meta;
// a class without a superclass in a subclass of Object
gravity_class_setsuper(c, (superclass) ? superclass : gravity_class_object);
return c;
}
gravity_class_t *gravity_class_get_meta (gravity_class_t *c) {
// meta classes have objclass set to class object
if (c->objclass == gravity_class_object) return c;
return c->objclass;
}
bool gravity_class_is_meta (gravity_class_t *c) {
// meta classes have objclass set to class object
return (c->objclass == gravity_class_object);
}
bool gravity_class_is_anon (gravity_class_t *c) {
return (string_casencmp(c->identifier, GRAVITY_VM_ANONYMOUS_PREFIX, strlen(GRAVITY_VM_ANONYMOUS_PREFIX)) == 0);
}
uint32_t gravity_class_count_ivars (gravity_class_t *c) {
return (uint32_t)c->nivars;
}
int16_t gravity_class_add_ivar (gravity_class_t *c, const char *identifier) {
#pragma unused(identifier)
// TODO: add identifier in array (for easier debugging)
++c->nivars;
return c->nivars-1; // its a C array so index is 0 based
}
void gravity_class_dump (gravity_class_t *c) {
gravity_hash_dump(c->htable);
}
void gravity_class_setxdata (gravity_class_t *c, void *xdata) {
c->xdata = xdata;
}
void gravity_class_serialize (gravity_class_t *c, json_t *json) {
const char *label = json_get_label(json, c->identifier);
json_begin_object(json, label);
json_add_cstring(json, GRAVITY_JSON_LABELTYPE, GRAVITY_JSON_CLASS); // MANDATORY 1st FIELD
json_add_cstring(json, GRAVITY_JSON_LABELIDENTIFIER, c->identifier); // MANDATORY 2nd FIELD
// avoid write superclass name if it is the default Object one
if ((c->superclass) && (c->superclass->identifier) && (strcmp(c->superclass->identifier, GRAVITY_CLASS_OBJECT_NAME) != 0)) {
json_add_cstring(json, GRAVITY_JSON_LABELSUPER, c->superclass->identifier);
} else if (c->superlook) {
json_add_cstring(json, GRAVITY_JSON_LABELSUPER, c->superlook);
}
// get c meta class
gravity_class_t *meta = gravity_class_get_meta(c);
// number of instance (and static) variables
json_add_int(json, GRAVITY_JSON_LABELNIVAR, c->nivars);
if ((c != meta) && (meta->nivars > 0)) json_add_int(json, GRAVITY_JSON_LABELSIVAR, meta->nivars);
// struct flag
if (c->is_struct) json_add_bool(json, GRAVITY_JSON_LABELSTRUCT, true);
// serialize htable
if (c->htable) {
gravity_hash_iterate(c->htable, gravity_hash_serialize, (void *)json);
}
// serialize meta class
if (c != meta) {
// further proceed only if it has something to be serialized
if ((meta->htable) && (gravity_hash_count(meta->htable) > 0)) {
json_begin_array(json, GRAVITY_JSON_LABELMETA);
gravity_hash_iterate(meta->htable, gravity_hash_serialize, (void *)json);
json_end_array(json);
}
}
json_end_object(json);
}
gravity_class_t *gravity_class_deserialize (gravity_vm *vm, json_value *json) {
// sanity check
if (json->type != json_object) return NULL;
if (json->u.object.length < 3) return NULL;
// scan identifier
json_value *value = json->u.object.values[1].value;
const char *key = json->u.object.values[1].name;
// sanity check identifier
if (string_casencmp(key, GRAVITY_JSON_LABELIDENTIFIER, strlen(key)) != 0) return NULL;
assert(value->type == json_string);
// create class and meta
gravity_class_t *c = gravity_class_new_pair(vm, value->u.string.ptr, NULL, 0, 0);
DEBUG_DESERIALIZE("DESERIALIZE CLASS: %p %s\n", c, value->u.string.ptr);
// get its meta class
gravity_class_t *meta = gravity_class_get_meta(c);
uint32_t n = json->u.object.length;
for (uint32_t i=2; i<n; ++i) { // from 2 to skip type and identifier
// parse values
value = json->u.object.values[i].value;
key = json->u.object.values[i].name;
if (value->type != json_object) {
// super
if (string_casencmp(key, GRAVITY_JSON_LABELSUPER, strlen(key)) == 0) {
// the trick here is to re-use a runtime field to store a temporary static data like superclass name
// (only if different than the default Object one)
if (strcmp(value->u.string.ptr, GRAVITY_CLASS_OBJECT_NAME) != 0) {
c->xdata = (void *)string_dup(value->u.string.ptr);
}
continue;
}
// nivar
if (string_casencmp(key, GRAVITY_JSON_LABELNIVAR, strlen(key)) == 0) {
gravity_class_grow(c, (uint32_t)value->u.integer);
continue;
}
// sivar
if (string_casencmp(key, GRAVITY_JSON_LABELSIVAR, strlen(key)) == 0) {
gravity_class_grow(meta, (uint32_t)value->u.integer);
continue;
}
// struct
if (string_casencmp(key, GRAVITY_JSON_LABELSTRUCT, strlen(key)) == 0) {
c->is_struct = true;
continue;
}
// meta
if (string_casencmp(key, GRAVITY_JSON_LABELMETA, strlen(key)) == 0) {
uint32_t m = value->u.array.length;
for (uint32_t j=0; j<m; ++j) {
json_value *r = value->u.array.values[j];
if (r->type != json_object) continue;
gravity_object_t *obj = gravity_object_deserialize(vm, r);
if (!obj) goto abort_load;
const char *identifier = obj->identifier;
if (OBJECT_ISA_FUNCTION(obj)) obj = (gravity_object_t *)gravity_closure_new(vm, (gravity_function_t *)obj);
if (obj) gravity_class_bind(meta, identifier, VALUE_FROM_OBJECT(obj));
else goto abort_load;
}
continue;
}
// error here
goto abort_load;
}
if (value->type == json_object) {
gravity_object_t *obj = gravity_object_deserialize(vm, value);
if (!obj) goto abort_load;
const char *identifier = obj->identifier;
if (OBJECT_ISA_FUNCTION(obj)) obj = (gravity_object_t *)gravity_closure_new(vm, (gravity_function_t *)obj);
gravity_class_bind(c, identifier, VALUE_FROM_OBJECT(obj));
}
}
return c;
abort_load:
// do not free c here because it is already garbage collected
return NULL;
}
static void gravity_class_free_internal (gravity_vm *vm, gravity_class_t *c, bool skip_base) {
if (skip_base && (gravity_iscore_class(c) || gravity_isopt_class(c))) return;
DEBUG_FREE("FREE %s", gravity_object_debug((gravity_object_t *)c, true));
// check if bridged data needs to be freed too
if (c->xdata && vm) {
gravity_delegate_t *delegate = gravity_vm_delegate(vm);
if (delegate->bridge_free) delegate->bridge_free(vm, (gravity_object_t *)c);
}
if (c->identifier) mem_free((void *)c->identifier);
if (c->superlook) mem_free((void *)c->superlook);
if (!skip_base) {
// base classes have functions not registered inside VM so manually free all of them
gravity_hash_iterate(c->htable, gravity_hash_interalfree, NULL);
gravity_hash_iterate(c->htable, gravity_hash_valuefree, NULL);
}
gravity_hash_free(c->htable);
if (c->ivars) mem_free((void *)c->ivars);
mem_free((void *)c);
}
void gravity_class_free_core (gravity_vm *vm, gravity_class_t *c) {
gravity_class_free_internal(vm, c, false);
}
void gravity_class_free (gravity_vm *vm, gravity_class_t *c) {
gravity_class_free_internal(vm, c, true);
}
inline gravity_object_t *gravity_class_lookup (gravity_class_t *c, gravity_value_t key) {
while (c) {
gravity_value_t *v = gravity_hash_lookup(c->htable, key);
if (v) return (gravity_object_t *)v->p;
c = c->superclass;
}
return NULL;
}
gravity_class_t *gravity_class_lookup_class_identifier (gravity_class_t *c, const char *identifier) {
while (c) {
if (string_cmp(c->identifier, identifier) == 0) return c;
c = c->superclass;
}
return NULL;
}
inline gravity_closure_t *gravity_class_lookup_closure (gravity_class_t *c, gravity_value_t key) {
gravity_object_t *obj = gravity_class_lookup(c, key);
if (obj && OBJECT_ISA_CLOSURE(obj)) return (gravity_closure_t *)obj;
return NULL;
}
inline gravity_closure_t *gravity_class_lookup_constructor (gravity_class_t *c, uint32_t nparams) {
if (c->xdata) {
// bridged class so check for special $initN function
if (nparams == 0) {
STATICVALUE_FROM_STRING(key, CLASS_INTERNAL_INIT_NAME, strlen(CLASS_INTERNAL_INIT_NAME));
return (gravity_closure_t *)gravity_class_lookup(c, key);
}
// for bridged classed (which can have more than one init constructor like in objc) the convention is
// to map each bridged init with a special $initN function (where N>0 is num params)
char name[256]; snprintf(name, sizeof(name), "%s%d", CLASS_INTERNAL_INIT_NAME, nparams);
STATICVALUE_FROM_STRING(key, name, strlen(name));
return (gravity_closure_t *)gravity_class_lookup(c, key);
}
// for non bridge classes just check for constructor
STATICVALUE_FROM_STRING(key, CLASS_CONSTRUCTOR_NAME, strlen(CLASS_CONSTRUCTOR_NAME));
return (gravity_closure_t *)gravity_class_lookup(c, key);
}
uint32_t gravity_class_size (gravity_vm *vm, gravity_class_t *c) {
SET_OBJECT_VISITED_FLAG(c, true);
uint32_t class_size = sizeof(gravity_class_t) + (c->nivars * sizeof(gravity_value_t)) + string_size(c->identifier);
uint32_t hash_size = 0;
gravity_hash_iterate2(c->htable, gravity_hash_internalsize, (void *)&hash_size, (void *)vm);
hash_size += gravity_hash_memsize(c->htable);
gravity_delegate_t *delegate = gravity_vm_delegate(vm);
if (c->xdata && delegate->bridge_size)
class_size += delegate->bridge_size(vm, c->xdata);
SET_OBJECT_VISITED_FLAG(c, false);
return class_size;
}
void gravity_class_blacken (gravity_vm *vm, gravity_class_t *c) {
gravity_vm_memupdate(vm, gravity_class_size(vm, c));
// metaclass
gravity_gray_object(vm, (gravity_object_t *)c->objclass);
// superclass
gravity_gray_object(vm, (gravity_object_t *)c->superclass);
// internals
gravity_hash_iterate(c->htable, gravity_hash_gray, (void *)vm);
// ivars
for (uint32_t i=0; i<c->nivars; ++i) {
gravity_gray_value(vm, c->ivars[i]);
}
}
// MARK: -
gravity_function_t *gravity_function_new (gravity_vm *vm, const char *identifier, uint16_t nparams, uint16_t nlocals, uint16_t ntemps, void *code) {
gravity_function_t *f = (gravity_function_t *)mem_alloc(NULL, sizeof(gravity_function_t));
assert(f);
f->isa = gravity_class_function;
f->identifier = (identifier) ? string_dup(identifier) : NULL;
f->tag = EXEC_TYPE_NATIVE;
f->nparams = nparams;
f->nlocals = nlocals;
f->ntemps = ntemps;
f->nupvalues = 0;
// only available in EXEC_TYPE_NATIVE case
// code is != NULL when EXEC_TYPE_NATIVE
if (code != NULL) {
f->useargs = false;
f->bytecode = (uint32_t *)code;
marray_init(f->cpool);
marray_init(f->pvalue);
marray_init(f->pname);
}
if (vm) gravity_vm_transfer(vm, (gravity_object_t*)f);
return f;
}
gravity_function_t *gravity_function_new_internal (gravity_vm *vm, const char *identifier, gravity_c_internal exec, uint16_t nparams) {
gravity_function_t *f = gravity_function_new(vm, identifier, nparams, 0, 0, NULL);
f->tag = EXEC_TYPE_INTERNAL;
f->internal = exec;
return f;
}
gravity_function_t *gravity_function_new_special (gravity_vm *vm, const char *identifier, uint16_t index, void *getter, void *setter) {
gravity_function_t *f = gravity_function_new(vm, identifier, 0, 0, 0, NULL);
f->tag = EXEC_TYPE_SPECIAL;
f->index = index;
f->special[0] = getter;
f->special[1] = setter;
return f;
}
gravity_function_t *gravity_function_new_bridged (gravity_vm *vm, const char *identifier, void *xdata) {
gravity_function_t *f = gravity_function_new(vm, identifier, 0, 0, 0, NULL);
f->tag = EXEC_TYPE_BRIDGED;
f->xdata = xdata;
return f;
}
uint16_t gravity_function_cpool_add (gravity_vm *vm, gravity_function_t *f, gravity_value_t v) {
assert(f->tag == EXEC_TYPE_NATIVE);
size_t n = marray_size(f->cpool);
for (size_t i=0; i<n; i++) {
gravity_value_t v2 = marray_get(f->cpool, i);
if (gravity_value_equals(v,v2)) {
gravity_value_free(NULL, v);
return (uint16_t)i;
}
}
// vm is required here because I cannot know in advance if v is already in the pool or not
// and value object v must be added to the VM only once
if ((vm) && (gravity_value_isobject(v))) gravity_vm_transfer(vm, VALUE_AS_OBJECT(v));
marray_push(gravity_value_t, f->cpool, v);
return (uint16_t)marray_size(f->cpool)-1;
}
gravity_value_t gravity_function_cpool_get (gravity_function_t *f, uint16_t i) {
assert(f->tag == EXEC_TYPE_NATIVE);
return marray_get(f->cpool, i);
}
gravity_list_t *gravity_function_params_get (gravity_vm *vm, gravity_function_t *f) {
#pragma unused(vm)
gravity_list_t *list = NULL;
if (f->tag == EXEC_TYPE_NATIVE) {
// written by user in Gravity
} else if (f->tag == EXEC_TYPE_BRIDGED && f->xdata) {
// ask bridge
} else if (f->tag == EXEC_TYPE_INTERNAL) {
// native C function
}
return list;
}
void gravity_function_setxdata (gravity_function_t *f, void *xdata) {
f->xdata = xdata;
}
static void gravity_function_array_serialize (gravity_function_t *f, json_t *json, gravity_value_r r) {
assert(f->tag == EXEC_TYPE_NATIVE);
size_t n = marray_size(r);
for (size_t i=0; i<n; i++) {
gravity_value_t v = marray_get(r, i);
gravity_value_serialize(NULL, v, json);
}
}
static void gravity_function_array_dump (gravity_function_t *f, gravity_value_r r) {
assert(f->tag == EXEC_TYPE_NATIVE);
size_t n = marray_size(r);
for (size_t i=0; i<n; i++) {
gravity_value_t v = marray_get(r, i);
if (VALUE_ISA_NULL(v)) {
printf("%05zu\tNULL\n", i);
continue;
}
if (VALUE_ISA_UNDEFINED(v)) {
printf("%05zu\tUNDEFINED\n", i);
continue;
}
if (VALUE_ISA_BOOL(v)) {
printf("%05zu\tBOOL: %d\n", i, (v.n == 0) ? 0 : 1);
continue;
}
if (VALUE_ISA_INT(v)) {
printf("%05zu\tINT: %" PRId64 "\n", i, (int64_t)v.n);
continue;
}
if (VALUE_ISA_FLOAT(v)) {
printf("%05zu\tFLOAT: %g\n", i, (double)v.f);
continue;
}
if (VALUE_ISA_FUNCTION(v)) {
gravity_function_t *vf = VALUE_AS_FUNCTION(v);
printf("%05zu\tFUNC: %s\n", i, (vf->identifier) ? vf->identifier : "$anon");
continue;
}
if (VALUE_ISA_CLASS(v)) {
gravity_class_t *c = VALUE_AS_CLASS(v);
printf("%05zu\tCLASS: %s\n", i, (c->identifier) ? c->identifier: "$anon");
continue;
}
if (VALUE_ISA_STRING(v)) {
printf("%05zu\tSTRING: %s\n", i, VALUE_AS_CSTRING(v));
continue;
}
if (VALUE_ISA_LIST(v)) {
gravity_list_t *value = VALUE_AS_LIST(v);
size_t count = marray_size(value->array);
printf("%05zu\tLIST: %zu items\n", i, count);
continue;
}
if (VALUE_ISA_MAP(v)) {
gravity_map_t *map = VALUE_AS_MAP(v);
printf("%05zu\tMAP: %u items\n", i, gravity_hash_count(map->hash));
continue;
}
// should never reach this point
assert(0);
}
}
static void gravity_function_bytecode_serialize (gravity_function_t *f, json_t *json) {
if (!f->bytecode || !f->ninsts) {
json_add_null(json, GRAVITY_JSON_LABELBYTECODE);
return;
}
// bytecode
uint32_t ninst = f->ninsts;
uint32_t length = ninst * 2 * sizeof(uint32_t);
uint8_t *hexchar = (uint8_t*) mem_alloc(NULL, sizeof(uint8_t) * length);
for (uint32_t k=0, i=0; i < ninst; ++i) {
uint32_t value = f->bytecode[i];
for (int32_t j=2*sizeof(value)-1; j>=0; --j) {
uint8_t c = "0123456789ABCDEF"[((value >> (j*4)) & 0xF)];
hexchar[k++] = c;
}
}
json_add_string(json, GRAVITY_JSON_LABELBYTECODE, (const char *)hexchar, length);
mem_free(hexchar);
// debug lineno
if (!f->lineno) return;
ninst = f->ninsts;
length = ninst * 2 * sizeof(uint32_t);
hexchar = (uint8_t*) mem_alloc(NULL, sizeof(uint8_t) * length);
for (uint32_t k=0, i=0; i < ninst; ++i) {
uint32_t value = f->lineno[i];
for (int32_t j=2*sizeof(value)-1; j>=0; --j) {
uint8_t c = "0123456789ABCDEF"[((value >> (j*4)) & 0xF)];
hexchar[k++] = c;
}
}
json_add_string(json, GRAVITY_JSON_LABELLINENO, (const char *)hexchar, length);
mem_free(hexchar);
}
uint32_t *gravity_bytecode_deserialize (const char *buffer, size_t len, uint32_t *n) {
uint32_t ninst = (uint32_t)len / 8;
uint32_t *bytecode = (uint32_t *)mem_alloc(NULL, sizeof(uint32_t) * (ninst + 1)); // +1 to get a 0 terminated bytecode (0 is opcode RET0)
for (uint32_t j=0; j<ninst; ++j) {
register uint32_t v = 0;
for (uint32_t i=(j*8); i<=(j*8)+7; ++i) {
// I was using a conversion code from
// https://code.google.com/p/yara-project/source/browse/trunk/libyara/xtoi.c?r=150
// but it caused issues under ARM processor so I decided to switch to an easier to read/maintain code
// http://codereview.stackexchange.com/questions/42976/hexadecimal-to-integer-conversion-function
// no needs to have also the case:
// if (c >= 'a' && c <= 'f') {
// c = c - 'a' + 10;
// }
// because bytecode is always uppercase
register uint32_t c = buffer[i];
if (c >= 'A' && c <= 'F') {
c = c - 'A' + 10;
} else if (c >= '0' && c <= '9') {
c -= '0';
} else goto abort_conversion;
v = v << 4 | c;
}
bytecode[j] = v;
}
*n = ninst;
return bytecode;
abort_conversion:
*n = 0;
if (bytecode) mem_free(bytecode);
return NULL;
}
void gravity_function_dump (gravity_function_t *f, code_dump_function codef) {
printf("Function: %s\n", (f->identifier) ? f->identifier : "$anon");
printf("Params:%d Locals:%d Temp:%d Upvalues:%d Tag:%d xdata:%p\n", f->nparams, f->nlocals, f->ntemps, f->nupvalues, f->tag, f->xdata);
if (f->tag == EXEC_TYPE_NATIVE) {
if (marray_size(f->cpool)) printf("======= CONST POOL =======\n");
gravity_function_array_dump(f, f->cpool);
if (marray_size(f->pname)) printf("======= PARAM NAMES =======\n");
gravity_function_array_dump(f, f->pname);
if (marray_size(f->pvalue)) printf("======= PARAM VALUES =======\n");
gravity_function_array_dump(f, f->pvalue);
printf("======= BYTECODE =======\n");
if ((f->bytecode) && (codef)) codef(f->bytecode);
}
printf("\n");
}
void gravity_function_special_serialize (gravity_function_t *f, const char *key, json_t *json) {
const char *label = json_get_label(json, key);
json_begin_object(json, label);
json_add_cstring(json, GRAVITY_JSON_LABELTYPE, GRAVITY_JSON_FUNCTION); // MANDATORY 1st FIELD
json_add_cstring(json, GRAVITY_JSON_LABELIDENTIFIER, key); // MANDATORY 2nd FIELD
json_add_int(json, GRAVITY_JSON_LABELTAG, f->tag);
// common fields
json_add_int(json, GRAVITY_JSON_LABELNPARAM, f->nparams);
json_add_bool(json, GRAVITY_JSON_LABELARGS, f->useargs);
json_add_int(json, GRAVITY_JSON_LABELINDEX, f->index);
if (f->special[0]) {
gravity_function_t *f2 = (gravity_function_t*)f->special[0];
f2->identifier = GRAVITY_JSON_GETTER;
gravity_function_serialize(f2, json);
f2->identifier = NULL;
}
if (f->special[1]) {
gravity_function_t *f2 = (gravity_function_t*)f->special[1];
f2->identifier = GRAVITY_JSON_SETTER;
gravity_function_serialize(f2, json);
f2->identifier = NULL;
}
json_end_object(json);
}
void gravity_function_serialize (gravity_function_t *f, json_t *json) {
// special functions need a special serialization
if (f->tag == EXEC_TYPE_SPECIAL) {
gravity_function_special_serialize(f, f->identifier, json);
return;
}
// compute identifier (cannot be NULL)
const char *identifier = f->identifier;
char temp[256];
if (!identifier) {snprintf(temp, sizeof(temp), "$anon_%p", f); identifier = temp;}
const char *label = json_get_label(json, identifier);
json_begin_object(json, label);
json_add_cstring(json, GRAVITY_JSON_LABELTYPE, GRAVITY_JSON_FUNCTION); // MANDATORY 1st FIELD
json_add_cstring(json, GRAVITY_JSON_LABELIDENTIFIER, identifier); // MANDATORY 2nd FIELD (not for getter/setter)
json_add_int(json, GRAVITY_JSON_LABELTAG, f->tag);
// common fields
json_add_int(json, GRAVITY_JSON_LABELNPARAM, f->nparams);
json_add_bool(json, GRAVITY_JSON_LABELARGS, f->useargs);
if (f->tag == EXEC_TYPE_NATIVE) {
// native only fields
json_add_int(json, GRAVITY_JSON_LABELNLOCAL, f->nlocals);
json_add_int(json, GRAVITY_JSON_LABELNTEMP, f->ntemps);
json_add_int(json, GRAVITY_JSON_LABELNUPV, f->nupvalues);
json_add_double(json, GRAVITY_JSON_LABELPURITY, f->purity);
// bytecode
gravity_function_bytecode_serialize(f, json);
// constant pool
json_begin_array(json, GRAVITY_JSON_LABELPOOL);
gravity_function_array_serialize(f, json, f->cpool);
json_end_array(json);
// default values (if any)
if (marray_size(f->pvalue)) {
json_begin_array(json, GRAVITY_JSON_LABELPVALUES);
gravity_function_array_serialize(f, json, f->pvalue);
json_end_array(json);
}
// arg names (if any)
if (marray_size(f->pname)) {
json_begin_array(json, GRAVITY_JSON_LABELPNAMES);
gravity_function_array_serialize(f, json, f->pname);
json_end_array(json);
}
}
json_end_object(json);
}
gravity_function_t *gravity_function_deserialize (gravity_vm *vm, json_value *json) {
gravity_function_t *f = gravity_function_new(vm, NULL, 0, 0, 0, NULL);
DEBUG_DESERIALIZE("DESERIALIZE FUNCTION: %p\n", f);
bool identifier_parsed = false;
bool getter_parsed = false;
bool setter_parsed = false;
bool index_parsed = false;
bool bytecode_parsed = false;
bool cpool_parsed = false;
bool nparams_parsed = false;
bool nlocals_parsed = false;
bool ntemp_parsed = false;
bool nupvalues_parsed = false;
bool nargs_parsed = false;
bool tag_parsed = false;
uint32_t n = json->u.object.length;
for (uint32_t i=1; i<n; ++i) { // from 1 to skip type
const char *label = json->u.object.values[i].name;
json_value *value = json->u.object.values[i].value;
size_t label_size = strlen(label);
// identifier
if (string_casencmp(label, GRAVITY_JSON_LABELIDENTIFIER, label_size) == 0) {
if (value->type != json_string) goto abort_load;
if (identifier_parsed) goto abort_load;
if (strncmp(value->u.string.ptr, "$anon", 5) != 0) {
f->identifier = string_dup(value->u.string.ptr);
DEBUG_DESERIALIZE("IDENTIFIER: %s\n", value->u.string.ptr);
}
identifier_parsed = true;
continue;
}
// tag
if (string_casencmp(label, GRAVITY_JSON_LABELTAG, label_size) == 0) {
if (value->type != json_integer) goto abort_load;
if (tag_parsed) goto abort_load;
f->tag = (uint16_t)value->u.integer;
tag_parsed = true;
continue;
}
// index (only in special functions)
if (string_casencmp(label, GRAVITY_JSON_LABELINDEX, label_size) == 0) {
if (value->type != json_integer) goto abort_load;
if (f->tag != EXEC_TYPE_SPECIAL) goto abort_load;
if (index_parsed) goto abort_load;
f->index = (uint16_t)value->u.integer;
index_parsed = true;
continue;
}
// getter (only in special functions)
if (string_casencmp(label, GRAVITY_JSON_GETTER, strlen(GRAVITY_JSON_GETTER)) == 0) {
if (f->tag != EXEC_TYPE_SPECIAL) goto abort_load;
if (getter_parsed) goto abort_load;
gravity_function_t *getter = gravity_function_deserialize(vm, value);
if (!getter) goto abort_load;
f->special[0] = gravity_closure_new(vm, getter);
getter_parsed = true;
continue;
}
// setter (only in special functions)
if (string_casencmp(label, GRAVITY_JSON_SETTER, strlen(GRAVITY_JSON_SETTER)) == 0) {
if (f->tag != EXEC_TYPE_SPECIAL) goto abort_load;
if (setter_parsed) goto abort_load;
gravity_function_t *setter = gravity_function_deserialize(vm, value);
if (!setter) goto abort_load;
f->special[1] = gravity_closure_new(vm, setter);
setter_parsed = true;
continue;
}
// nparams
if (string_casencmp(label, GRAVITY_JSON_LABELNPARAM, label_size) == 0) {
if (value->type != json_integer) goto abort_load;
if (nparams_parsed) goto abort_load;
f->nparams = (uint16_t)value->u.integer;
nparams_parsed = true;
continue;
}
// nlocals
if (string_casencmp(label, GRAVITY_JSON_LABELNLOCAL, label_size) == 0) {
if (value->type != json_integer) goto abort_load;
if (nlocals_parsed) goto abort_load;
f->nlocals = (uint16_t)value->u.integer;
nlocals_parsed = true;
continue;
}
// ntemps
if (string_casencmp(label, GRAVITY_JSON_LABELNTEMP, label_size) == 0) {
if (value->type != json_integer) goto abort_load;
if (ntemp_parsed) goto abort_load;
f->ntemps = (uint16_t)value->u.integer;
ntemp_parsed = true;
continue;
}
// nupvalues
if (string_casencmp(label, GRAVITY_JSON_LABELNUPV, label_size) == 0) {
if (value->type != json_integer) goto abort_load;
if (nupvalues_parsed) goto abort_load;
f->nupvalues = (uint16_t)value->u.integer;
nupvalues_parsed = true;
continue;
}
// args
if (string_casencmp(label, GRAVITY_JSON_LABELARGS, label_size) == 0) {
if (value->type != json_boolean) goto abort_load;
if (nargs_parsed) goto abort_load;
f->useargs = (bool)value->u.boolean;
nargs_parsed = true;
continue;
}
// bytecode
if (string_casencmp(label, GRAVITY_JSON_LABELBYTECODE, label_size) == 0) {
if (bytecode_parsed) goto abort_load;
if (value->type == json_null) {
// if function is empty then just one RET0 implicit bytecode instruction
f->ninsts = 0;
f->bytecode = (uint32_t *)mem_alloc(NULL, sizeof(uint32_t) * (f->ninsts + 1));
} else {
if (value->type != json_string) goto abort_load;
if (f->tag != EXEC_TYPE_NATIVE) goto abort_load;
f->bytecode = gravity_bytecode_deserialize(value->u.string.ptr, value->u.string.length, &f->ninsts);
}
bytecode_parsed = true;
continue;
}
// lineno debug info
if (string_casencmp(label, GRAVITY_JSON_LABELLINENO, label_size) == 0) {
if (value->type == json_string) f->lineno = gravity_bytecode_deserialize(value->u.string.ptr, value->u.string.length, &f->ninsts);
}
// arguments names
if (string_casencmp(label, GRAVITY_JSON_LABELPNAMES, label_size) == 0) {
if (value->type != json_array) goto abort_load;
if (f->tag != EXEC_TYPE_NATIVE) goto abort_load;
uint32_t m = value->u.array.length;
for (uint32_t j=0; j<m; ++j) {
json_value *r = value->u.array.values[j];
if (r->type != json_string) goto abort_load;
marray_push(gravity_value_t, f->pname, VALUE_FROM_STRING(NULL, r->u.string.ptr, r->u.string.length));
}
}
// arguments default values
if (string_casencmp(label, GRAVITY_JSON_LABELPVALUES, label_size) == 0) {
if (value->type != json_array) goto abort_load;
if (f->tag != EXEC_TYPE_NATIVE) goto abort_load;
uint32_t m = value->u.array.length;
for (uint32_t j=0; j<m; ++j) {
json_value *r = value->u.array.values[j];
switch (r->type) {
case json_integer:
marray_push(gravity_value_t, f->pvalue, VALUE_FROM_INT((gravity_int_t)r->u.integer));
break;
case json_double:
marray_push(gravity_value_t, f->pvalue, VALUE_FROM_FLOAT((gravity_float_t)r->u.dbl));
break;
case json_boolean:
marray_push(gravity_value_t, f->pvalue, VALUE_FROM_BOOL(r->u.boolean));
break;
case json_string:
marray_push(gravity_value_t, f->pvalue, VALUE_FROM_STRING(NULL, r->u.string.ptr, r->u.string.length));
break;
case json_object:
marray_push(gravity_value_t, f->pvalue, VALUE_FROM_UNDEFINED);
break;
case json_null:
marray_push(gravity_value_t, f->pvalue, VALUE_FROM_NULL);
break;
case json_none:
case json_array:
marray_push(gravity_value_t, f->pvalue, VALUE_FROM_NULL);
break;
}
}
}
// cpool
if (string_casencmp(label, GRAVITY_JSON_LABELPOOL, label_size) == 0) {
if (value->type != json_array) goto abort_load;
if (f->tag != EXEC_TYPE_NATIVE) goto abort_load;
if (cpool_parsed) goto abort_load;
cpool_parsed = true;
uint32_t m = value->u.array.length;
for (uint32_t j=0; j<m; ++j) {
json_value *r = value->u.array.values[j];
switch (r->type) {
case json_integer:
gravity_function_cpool_add(NULL, f, VALUE_FROM_INT((gravity_int_t)r->u.integer));
break;
case json_double:
gravity_function_cpool_add(NULL, f, VALUE_FROM_FLOAT((gravity_float_t)r->u.dbl));
break;
case json_boolean:
gravity_function_cpool_add(NULL, f, VALUE_FROM_BOOL(r->u.boolean));
break;
case json_string:
gravity_function_cpool_add(vm, f, VALUE_FROM_STRING(NULL, r->u.string.ptr, r->u.string.length));
break;
case json_object: {
gravity_object_t *obj = gravity_object_deserialize(vm, r);
if (!obj) goto abort_load;
gravity_function_cpool_add(NULL, f, VALUE_FROM_OBJECT(obj));
break;
}
case json_array: {
uint32_t count = r->u.array.length;
gravity_list_t *list = gravity_list_new (NULL, count);
if (!list) continue;
for (uint32_t k=0; k<count; ++k) {
json_value *jsonv = r->u.array.values[k];
gravity_value_t v;
// only literals allowed here
switch (jsonv->type) {
case json_integer: v = VALUE_FROM_INT((gravity_int_t)jsonv->u.integer); break;
case json_double: v = VALUE_FROM_FLOAT((gravity_float_t)jsonv->u.dbl); break;
case json_boolean: v = VALUE_FROM_BOOL(jsonv->u.boolean); break;
case json_string: v = VALUE_FROM_STRING(vm, jsonv->u.string.ptr, jsonv->u.string.length); break;
default: goto abort_load;
}
marray_push(gravity_value_t, list->array, v);
}
gravity_function_cpool_add(vm, f, VALUE_FROM_OBJECT(list));
break;
}
case json_none:
case json_null:
gravity_function_cpool_add(NULL, f, VALUE_FROM_NULL);
break;
}
}
}
}
return f;
abort_load:
// do not free f here because it is already garbage collected
return NULL;
}
void gravity_function_free (gravity_vm *vm, gravity_function_t *f) {
if (!f) return;
DEBUG_FREE("FREE %s", gravity_object_debug((gravity_object_t *)f, true));
// check if bridged data needs to be freed too
if (f->xdata && vm) {
gravity_delegate_t *delegate = gravity_vm_delegate(vm);
if (delegate->bridge_free) delegate->bridge_free(vm, (gravity_object_t *)f);
}
if (f->identifier) mem_free((void *)f->identifier);
if (f->tag == EXEC_TYPE_NATIVE) {
if (f->bytecode) mem_free((void *)f->bytecode);
if (f->lineno) mem_free((void *)f->lineno);
// FREE EACH DEFAULT value
size_t n = marray_size(f->pvalue);
for (size_t i=0; i<n; i++) {
gravity_value_t v = marray_get(f->pvalue, i);
gravity_value_free(NULL, v);
}
marray_destroy(f->pvalue);
// FREE EACH PARAM name
n = marray_size(f->pname);
for (size_t i=0; i<n; i++) {
gravity_value_t v = marray_get(f->pname, i);
gravity_value_free(NULL, v);
}
marray_destroy(f->pname);
// DO NOT FREE EACH INDIVIDUAL CPOOL ITEM HERE
marray_destroy(f->cpool);
}
mem_free((void *)f);
}
uint32_t gravity_function_size (gravity_vm *vm, gravity_function_t *f) {
SET_OBJECT_VISITED_FLAG(f, true);
uint32_t func_size = sizeof(gravity_function_t) + string_size(f->identifier);
if (f->tag == EXEC_TYPE_NATIVE) {
if (f->bytecode) func_size += f->ninsts * sizeof(uint32_t);
// cpool size
size_t n = marray_size(f->cpool);
for (size_t i=0; i<n; i++) {
gravity_value_t v = marray_get(f->cpool, i);
func_size += gravity_value_size(vm, v);
}
} else if (f->tag == EXEC_TYPE_SPECIAL) {
if (f->special[0]) func_size += gravity_closure_size(vm, (gravity_closure_t *)f->special[0]);
if ((f->special[1]) && (f->special[0] != f->special[1])) func_size += gravity_closure_size(vm, (gravity_closure_t *)f->special[1]);
} else if (f->tag == EXEC_TYPE_BRIDGED) {
gravity_delegate_t *delegate = gravity_vm_delegate(vm);
if (f->xdata && delegate->bridge_size)
func_size += delegate->bridge_size(vm, f->xdata);
}
SET_OBJECT_VISITED_FLAG(f, false);
return func_size;
}
void gravity_function_blacken (gravity_vm *vm, gravity_function_t *f) {
gravity_vm_memupdate(vm, gravity_function_size(vm, f));
if (f->tag == EXEC_TYPE_SPECIAL) {
if (f->special[0]) gravity_gray_object(vm, (gravity_object_t *)f->special[0]);
if (f->special[1]) gravity_gray_object(vm, (gravity_object_t *)f->special[1]);
}
if (f->tag == EXEC_TYPE_NATIVE) {
// constant pool
size_t n = marray_size(f->cpool);
for (size_t i=0; i<n; i++) {
gravity_value_t v = marray_get(f->cpool, i);
gravity_gray_value(vm, v);
}
}
}
// MARK: -
gravity_closure_t *gravity_closure_new (gravity_vm *vm, gravity_function_t *f) {
gravity_closure_t *closure = (gravity_closure_t *)mem_alloc(NULL, sizeof(gravity_closure_t));
assert(closure);
closure->isa = gravity_class_closure;
closure->vm = vm;
closure->f = f;
// allocate upvalue array (+1 so I can simplify the iterator without the needs to access closure->f->nupvalues)
uint16_t nupvalues = (f) ? f->nupvalues : 0;
closure->upvalue = (nupvalues) ? (gravity_upvalue_t **)mem_alloc(NULL, sizeof(gravity_upvalue_t*) * (f->nupvalues + 1)) : NULL;
if (vm) gravity_vm_transfer(vm, (gravity_object_t*)closure);
return closure;
}
void gravity_closure_free (gravity_vm *vm, gravity_closure_t *closure) {
#pragma unused(vm)
if (closure->refcount > 0) return;
DEBUG_FREE("FREE %s", gravity_object_debug((gravity_object_t *)closure, true));
if (closure->upvalue) mem_free(closure->upvalue);
mem_free(closure);
}
uint32_t gravity_closure_size (gravity_vm *vm, gravity_closure_t *closure) {
#pragma unused(vm)
SET_OBJECT_VISITED_FLAG(closure, true);
uint32_t closure_size = sizeof(gravity_closure_t);
gravity_upvalue_t **upvalue = closure->upvalue;
while (upvalue && upvalue[0]) {
closure_size += sizeof(gravity_upvalue_t*);
++upvalue;
}
SET_OBJECT_VISITED_FLAG(closure, false);
return closure_size;
}
void gravity_closure_inc_refcount (gravity_vm *vm, gravity_closure_t *closure) {
if (closure->refcount == 0) gravity_gc_temppush(vm, (gravity_object_t *)closure);
++closure->refcount;
}
void gravity_closure_dec_refcount (gravity_vm *vm, gravity_closure_t *closure) {
if (closure->refcount == 1) gravity_gc_tempnull(vm, (gravity_object_t *)closure);
if (closure->refcount >= 1) --closure->refcount;
}
void gravity_closure_blacken (gravity_vm *vm, gravity_closure_t *closure) {
gravity_vm_memupdate(vm, gravity_closure_size(vm, closure));
// mark function
gravity_gray_object(vm, (gravity_object_t*)closure->f);
// mark each upvalue
gravity_upvalue_t **upvalue = closure->upvalue;
while (upvalue && upvalue[0]) {
gravity_gray_object(vm, (gravity_object_t*)upvalue[0]);
++upvalue;
}
// mark context (if any)
if (closure->context) gravity_gray_object(vm, closure->context);
}
// MARK: -
gravity_upvalue_t *gravity_upvalue_new (gravity_vm *vm, gravity_value_t *value) {
gravity_upvalue_t *upvalue = (gravity_upvalue_t *)mem_alloc(NULL, sizeof(gravity_upvalue_t));
upvalue->isa = gravity_class_upvalue;
upvalue->value = value;
upvalue->closed = VALUE_FROM_NULL;
upvalue->next = NULL;
if (vm) gravity_vm_transfer(vm, (gravity_object_t*) upvalue);
return upvalue;
}
void gravity_upvalue_free(gravity_vm *vm, gravity_upvalue_t *upvalue) {
#pragma unused(vm)
DEBUG_FREE("FREE %s", gravity_object_debug((gravity_object_t *)upvalue, true));
mem_free(upvalue);
}
uint32_t gravity_upvalue_size (gravity_vm *vm, gravity_upvalue_t *upvalue) {
#pragma unused(vm, upvalue)
SET_OBJECT_VISITED_FLAG(upvalue, true);
uint32_t upvalue_size = sizeof(gravity_upvalue_t);
SET_OBJECT_VISITED_FLAG(upvalue, false);
return upvalue_size;
}
void gravity_upvalue_blacken (gravity_vm *vm, gravity_upvalue_t *upvalue) {
gravity_vm_memupdate(vm, gravity_upvalue_size(vm, upvalue));
// gray both closed and still opened values
gravity_gray_value(vm, *upvalue->value);
gravity_gray_value(vm, upvalue->closed);
}
// MARK: -
gravity_fiber_t *gravity_fiber_new (gravity_vm *vm, gravity_closure_t *closure, uint32_t nstack, uint32_t nframes) {
gravity_fiber_t *fiber = (gravity_fiber_t *)mem_alloc(NULL, sizeof(gravity_fiber_t));
assert(fiber);
fiber->isa = gravity_class_fiber;
fiber->caller = NULL;
fiber->result = VALUE_FROM_NULL;
if (nstack < DEFAULT_MINSTACK_SIZE) nstack = DEFAULT_MINSTACK_SIZE;
fiber->stack = (gravity_value_t *)mem_alloc(NULL, sizeof(gravity_value_t) * nstack);
fiber->stacktop = fiber->stack;
fiber->stackalloc = nstack;
if (nframes < DEFAULT_MINCFRAME_SIZE) nframes = DEFAULT_MINCFRAME_SIZE;
fiber->frames = (gravity_callframe_t *)mem_alloc(NULL, sizeof(gravity_callframe_t) * nframes);
fiber->framesalloc = nframes;
fiber->nframes = 1;
fiber->upvalues = NULL;
gravity_callframe_t *frame = &fiber->frames[0];
if (closure) {
frame->closure = closure;
frame->ip = (closure->f->tag == EXEC_TYPE_NATIVE) ? closure->f->bytecode : NULL;
}
frame->dest = 0;
frame->stackstart = fiber->stack;
// replace self with fiber instance
frame->stackstart[0] = VALUE_FROM_OBJECT(fiber);
if (vm) gravity_vm_transfer(vm, (gravity_object_t*) fiber);
return fiber;
}
void gravity_fiber_free (gravity_vm *vm, gravity_fiber_t *fiber) {
#pragma unused(vm)
DEBUG_FREE("FREE %s", gravity_object_debug((gravity_object_t *)fiber, true));
if (fiber->error) mem_free(fiber->error);
mem_free(fiber->stack);
mem_free(fiber->frames);
mem_free(fiber);
}
void gravity_fiber_reassign (gravity_fiber_t *fiber, gravity_closure_t *closure, uint16_t nargs) {
gravity_callframe_t *frame = &fiber->frames[0];
frame->closure = closure;
frame->ip = (closure->f->tag == EXEC_TYPE_NATIVE) ? closure->f->bytecode : NULL;
frame->dest = 0;
frame->stackstart = fiber->stack;
fiber->nframes = 1;
fiber->upvalues = NULL;
// update stacktop in order to be GC friendly
fiber->stacktop += FN_COUNTREG(closure->f, nargs);
}
void gravity_fiber_reset (gravity_fiber_t *fiber) {
fiber->caller = NULL;
fiber->result = VALUE_FROM_NULL;
fiber->nframes = 0;
fiber->upvalues = NULL;
fiber->stacktop = fiber->stack;
}
void gravity_fiber_seterror (gravity_fiber_t *fiber, const char *error) {
if (fiber->error) mem_free(fiber->error);
fiber->error = (char *)string_dup(error);
}
uint32_t gravity_fiber_size (gravity_vm *vm, gravity_fiber_t *fiber) {
SET_OBJECT_VISITED_FLAG(fiber, true);
// internal size
uint32_t fiber_size = sizeof(gravity_fiber_t);
fiber_size += fiber->stackalloc * sizeof(gravity_value_t);
fiber_size += fiber->framesalloc * sizeof(gravity_callframe_t);
// stack size
for (gravity_value_t* slot = fiber->stack; slot < fiber->stacktop; ++slot) {
fiber_size += gravity_value_size(vm, *slot);
}
fiber_size += string_size(fiber->error);
fiber_size += gravity_object_size(vm, (gravity_object_t *)fiber->caller);
SET_OBJECT_VISITED_FLAG(fiber, false);
return fiber_size;
}
void gravity_fiber_blacken (gravity_vm *vm, gravity_fiber_t *fiber) {
gravity_vm_memupdate(vm, gravity_fiber_size(vm, fiber));
// gray call frame functions
for (uint32_t i=0; i < fiber->nframes; ++i) {
gravity_gray_object(vm, (gravity_object_t *)fiber->frames[i].closure);
gravity_gray_object(vm, (gravity_object_t *)fiber->frames[i].args);
}
// gray stack variables
for (gravity_value_t *slot = fiber->stack; slot < fiber->stacktop; ++slot) {
gravity_gray_value(vm, *slot);
}
// gray upvalues
gravity_upvalue_t *upvalue = fiber->upvalues;
while (upvalue) {
gravity_gray_object(vm, (gravity_object_t *)upvalue);
upvalue = upvalue->next;
}
gravity_gray_object(vm, (gravity_object_t *)fiber->caller);
}
// MARK: -
void gravity_object_serialize (gravity_object_t *obj, json_t *json) {
if (obj->isa == gravity_class_function)
gravity_function_serialize((gravity_function_t *)obj, json);
else if (obj->isa == gravity_class_class)
gravity_class_serialize((gravity_class_t *)obj, json);
else assert(0);
}
gravity_object_t *gravity_object_deserialize (gravity_vm *vm, json_value *entry) {
// this function is able to deserialize ONLY objects with a type label
// sanity check
if (entry->type != json_object) return NULL;
if (entry->u.object.length == 0) return NULL;
// the first entry value must specify gravity object type
const char *label = entry->u.object.values[0].name;
json_value *value = entry->u.object.values[0].value;
if (string_casencmp(label, GRAVITY_JSON_LABELTYPE, 4) != 0) {
// if no label type found then assume it is a map object
gravity_map_t *m = gravity_map_deserialize(vm, entry);
return (gravity_object_t *)m;
}
// sanity check
if (value->type != json_string) return NULL;
// FUNCTION case
if (string_casencmp(value->u.string.ptr, GRAVITY_JSON_FUNCTION, value->u.string.length) == 0) {
gravity_function_t *f = gravity_function_deserialize(vm, entry);
return (gravity_object_t *)f;
}
// CLASS case
if (string_casencmp(value->u.string.ptr, GRAVITY_JSON_CLASS, value->u.string.length) == 0) {
gravity_class_t *c = gravity_class_deserialize(vm, entry);
return (gravity_object_t *)c;
}
// MAP/ENUM case
if ((string_casencmp(value->u.string.ptr, GRAVITY_JSON_MAP, value->u.string.length) == 0) ||
(string_casencmp(value->u.string.ptr, GRAVITY_JSON_ENUM, value->u.string.length) == 0)) {
gravity_map_t *m = gravity_map_deserialize(vm, entry);
return (gravity_object_t *)m;
}
// RANGE case
if (string_casencmp(value->u.string.ptr, GRAVITY_JSON_RANGE, value->u.string.length) == 0) {
gravity_range_t *range = gravity_range_deserialize(vm, entry);
return (gravity_object_t *)range;
}
// unhandled case
DEBUG_DESERIALIZE("gravity_object_deserialize unknown type");
return NULL;
}
#undef REPORT_JSON_ERROR
const char *gravity_object_debug (gravity_object_t *obj, bool is_free) {
if ((!obj) || (!OBJECT_IS_VALID(obj))) return "";
if (OBJECT_ISA_INT(obj)) return "INT";
if (OBJECT_ISA_FLOAT(obj)) return "FLOAT";
if (OBJECT_ISA_BOOL(obj)) return "BOOL";
if (OBJECT_ISA_NULL(obj)) return "NULL";
static char buffer[512];
if (OBJECT_ISA_FUNCTION(obj)) {
const char *name = ((gravity_function_t*)obj)->identifier;
if (!name) name = "ANONYMOUS";
snprintf(buffer, sizeof(buffer), "FUNCTION %p %s", obj, name);
return buffer;
}
if (OBJECT_ISA_CLOSURE(obj)) {
// cannot guarantee ptr validity during a free
const char *name = (is_free) ? NULL : ((gravity_closure_t*)obj)->f->identifier;
if (!name) name = "ANONYMOUS";
snprintf(buffer, sizeof(buffer), "CLOSURE %p %s", obj, name);
return buffer;
}
if (OBJECT_ISA_CLASS(obj)) {
const char *name = ((gravity_class_t*)obj)->identifier;
if (!name) name = "ANONYMOUS";
snprintf(buffer, sizeof(buffer), "CLASS %p %s", obj, name);
return buffer;
}
if (OBJECT_ISA_STRING(obj)) {
snprintf(buffer, sizeof(buffer), "STRING %p %s", obj, ((gravity_string_t*)obj)->s);
return buffer;
}
if (OBJECT_ISA_INSTANCE(obj)) {
// cannot guarantee ptr validity during a free
gravity_class_t *c = (is_free) ? NULL : ((gravity_instance_t*)obj)->objclass;
const char *name = (c && c->identifier) ? c->identifier : "ANONYMOUS";
snprintf(buffer, sizeof(buffer), "INSTANCE %p OF %s", obj, name);
return buffer;
}
if (OBJECT_ISA_RANGE(obj)) {
snprintf(buffer, sizeof(buffer), "RANGE %p %ld %ld", obj, (long)((gravity_range_t*)obj)->from, (long)((gravity_range_t*)obj)->to);
return buffer;
}
if (OBJECT_ISA_LIST(obj)) {
snprintf(buffer, sizeof(buffer), "LIST %p (%ld items)", obj, (long)marray_size(((gravity_list_t*)obj)->array));
return buffer;
}
if (OBJECT_ISA_MAP(obj)) {
snprintf(buffer, sizeof(buffer), "MAP %p (%ld items)", obj, (long)gravity_hash_count(((gravity_map_t*)obj)->hash));
return buffer;
}
if (OBJECT_ISA_FIBER(obj)) {
snprintf(buffer, sizeof(buffer), "FIBER %p", obj);
return buffer;
}
if (OBJECT_ISA_UPVALUE(obj)) {
snprintf(buffer, sizeof(buffer), "UPVALUE %p", obj);
return buffer;
}
return "N/A";
}
void gravity_object_free (gravity_vm *vm, gravity_object_t *obj) {
if ((!obj) || (!OBJECT_IS_VALID(obj))) return;
if (obj->gc.free) obj->gc.free(vm, obj);
else if (OBJECT_ISA_CLASS(obj)) gravity_class_free(vm, (gravity_class_t *)obj);
else if (OBJECT_ISA_FUNCTION(obj)) gravity_function_free(vm, (gravity_function_t *)obj);
else if (OBJECT_ISA_CLOSURE(obj)) gravity_closure_free(vm, (gravity_closure_t *)obj);
else if (OBJECT_ISA_INSTANCE(obj)) gravity_instance_free(vm, (gravity_instance_t *)obj);
else if (OBJECT_ISA_LIST(obj)) gravity_list_free(vm, (gravity_list_t *)obj);
else if (OBJECT_ISA_MAP(obj)) gravity_map_free(vm, (gravity_map_t *)obj);
else if (OBJECT_ISA_FIBER(obj)) gravity_fiber_free(vm, (gravity_fiber_t *)obj);
else if (OBJECT_ISA_RANGE(obj)) gravity_range_free(vm, (gravity_range_t *)obj);
else if (OBJECT_ISA_MODULE(obj)) gravity_module_free(vm, (gravity_module_t *)obj);
else if (OBJECT_ISA_STRING(obj)) gravity_string_free(vm, (gravity_string_t *)obj);
else if (OBJECT_ISA_UPVALUE(obj)) gravity_upvalue_free(vm, (gravity_upvalue_t *)obj);
else assert(0); // should never reach this point
}
uint32_t gravity_object_size (gravity_vm *vm, gravity_object_t *obj) {
if ((!obj) || (!OBJECT_IS_VALID(obj))) return 0;
// check if object has already been visited (to avoid infinite loop)
if (obj->gc.visited) return 0;
if (obj->gc.size) return obj->gc.size(vm, obj);
else if (OBJECT_ISA_CLASS(obj)) return gravity_class_size(vm, (gravity_class_t *)obj);
else if (OBJECT_ISA_FUNCTION(obj)) return gravity_function_size(vm, (gravity_function_t *)obj);
else if (OBJECT_ISA_CLOSURE(obj)) return gravity_closure_size(vm, (gravity_closure_t *)obj);
else if (OBJECT_ISA_INSTANCE(obj)) return gravity_instance_size(vm, (gravity_instance_t *)obj);
else if (OBJECT_ISA_LIST(obj)) return gravity_list_size(vm, (gravity_list_t *)obj);
else if (OBJECT_ISA_MAP(obj)) return gravity_map_size(vm, (gravity_map_t *)obj);
else if (OBJECT_ISA_FIBER(obj)) return gravity_fiber_size(vm, (gravity_fiber_t *)obj);
else if (OBJECT_ISA_RANGE(obj)) return gravity_range_size(vm, (gravity_range_t *)obj);
else if (OBJECT_ISA_MODULE(obj)) return gravity_module_size(vm, (gravity_module_t *)obj);
else if (OBJECT_ISA_STRING(obj)) return gravity_string_size(vm, (gravity_string_t *)obj);
else if (OBJECT_ISA_UPVALUE(obj)) return gravity_upvalue_size(vm, (gravity_upvalue_t *)obj);
return 0;
}
void gravity_object_blacken (gravity_vm *vm, gravity_object_t *obj) {
if ((!obj) || (!OBJECT_IS_VALID(obj))) return;
if (obj->gc.blacken) obj->gc.blacken(vm, obj);
else if (OBJECT_ISA_CLASS(obj)) gravity_class_blacken(vm, (gravity_class_t *)obj);
else if (OBJECT_ISA_FUNCTION(obj)) gravity_function_blacken(vm, (gravity_function_t *)obj);
else if (OBJECT_ISA_CLOSURE(obj)) gravity_closure_blacken(vm, (gravity_closure_t *)obj);
else if (OBJECT_ISA_INSTANCE(obj)) gravity_instance_blacken(vm, (gravity_instance_t *)obj);
else if (OBJECT_ISA_LIST(obj)) gravity_list_blacken(vm, (gravity_list_t *)obj);
else if (OBJECT_ISA_MAP(obj)) gravity_map_blacken(vm, (gravity_map_t *)obj);
else if (OBJECT_ISA_FIBER(obj)) gravity_fiber_blacken(vm, (gravity_fiber_t *)obj);
else if (OBJECT_ISA_RANGE(obj)) gravity_range_blacken(vm, (gravity_range_t *)obj);
else if (OBJECT_ISA_MODULE(obj)) gravity_module_blacken(vm, (gravity_module_t *)obj);
else if (OBJECT_ISA_STRING(obj)) gravity_string_blacken(vm, (gravity_string_t *)obj);
else if (OBJECT_ISA_UPVALUE(obj)) gravity_upvalue_blacken(vm, (gravity_upvalue_t *)obj);
//else assert(0); // should never reach this point
}
// MARK: -
gravity_instance_t *gravity_instance_new (gravity_vm *vm, gravity_class_t *c) {
gravity_instance_t *instance = (gravity_instance_t *)mem_alloc(NULL, sizeof(gravity_instance_t));
instance->isa = gravity_class_instance;
instance->objclass = c;
if (c->nivars) instance->ivars = (gravity_value_t *)mem_alloc(NULL, c->nivars * sizeof(gravity_value_t));
for (uint32_t i=0; i<c->nivars; ++i) instance->ivars[i] = VALUE_FROM_NULL;
if (vm) gravity_vm_transfer(vm, (gravity_object_t*) instance);
return instance;
}
gravity_instance_t *gravity_instance_clone (gravity_vm *vm, gravity_instance_t *src_instance) {
gravity_class_t *c = src_instance->objclass;
gravity_instance_t *instance = (gravity_instance_t *)mem_alloc(NULL, sizeof(gravity_instance_t));
instance->isa = gravity_class_instance;
instance->objclass = c;
// if c is an anonymous class then it must be deeply copied
if (gravity_class_is_anon(c)) {
// clone class c and all its closures
}
gravity_delegate_t *delegate = gravity_vm_delegate(vm);
instance->xdata = (src_instance->xdata && delegate->bridge_clone) ? delegate->bridge_clone(vm, src_instance->xdata) : NULL;
if (c->nivars) instance->ivars = (gravity_value_t *)mem_alloc(NULL, c->nivars * sizeof(gravity_value_t));
for (uint32_t i=0; i<c->nivars; ++i) instance->ivars[i] = src_instance->ivars[i];
if (vm) gravity_vm_transfer(vm, (gravity_object_t*) instance);
return instance;
}
void gravity_instance_setivar (gravity_instance_t *instance, uint32_t idx, gravity_value_t value) {
if (idx < instance->objclass->nivars) instance->ivars[idx] = value;
}
void gravity_instance_setxdata (gravity_instance_t *i, void *xdata) {
i->xdata = xdata;
}
void gravity_instance_deinit (gravity_vm *vm, gravity_instance_t *i) {
STATICVALUE_FROM_STRING(key, CLASS_DESTRUCTOR_NAME, strlen(CLASS_DESTRUCTOR_NAME));
// check for destructor
gravity_closure_t *closure = gravity_class_lookup_closure(i->objclass, key);
if (closure) gravity_vm_runclosure(vm, closure, VALUE_FROM_OBJECT(i), NULL, 0);
}
void gravity_instance_free (gravity_vm *vm, gravity_instance_t *i) {
DEBUG_FREE("FREE %s", gravity_object_debug((gravity_object_t *)i, true));
// check if bridged data needs to be freed too
if (i->xdata && vm) {
gravity_delegate_t *delegate = gravity_vm_delegate(vm);
if (delegate->bridge_free) delegate->bridge_free(vm, (gravity_object_t *)i);
}
if (i->ivars) mem_free(i->ivars);
mem_free((void *)i);
}
gravity_closure_t *gravity_instance_lookup_event (gravity_instance_t *i, const char *name) {
// TODO: implemented as gravity_class_lookup but should be the exact opposite
STATICVALUE_FROM_STRING(key, name, strlen(name));
gravity_class_t *c = i->objclass;
while (c) {
gravity_value_t *v = gravity_hash_lookup(c->htable, key);
// NOTE: there could be events (like InitContainer) which are empty (bytecode NULL) should I handle them here?
if ((v) && (OBJECT_ISA_CLOSURE(v->p))) return (gravity_closure_t *)v->p;
c = c->superclass;
}
return NULL;
}
gravity_value_t gravity_instance_lookup_property (gravity_vm *vm, gravity_instance_t *i, gravity_value_t key) {
gravity_closure_t *closure = gravity_class_lookup_closure(i->objclass, key);
if (!closure) return VALUE_NOT_VALID;
// check if it is a real property
gravity_function_t *func = closure->f;
if (!func || func->tag != EXEC_TYPE_SPECIAL) return VALUE_NOT_VALID;
// check if it a computed property with a getter
if (FUNCTION_ISA_GETTER(func)) {
gravity_closure_t *getter = (gravity_closure_t *)func->special[EXEC_TYPE_SPECIAL_GETTER];
if (gravity_vm_runclosure(vm, getter, VALUE_FROM_NULL, NULL, 0)) return gravity_vm_result(vm);
}
// now I am sure that it is a real property (non-computed)
return i->ivars[func->index];
}
uint32_t gravity_instance_size (gravity_vm *vm, gravity_instance_t *i) {
SET_OBJECT_VISITED_FLAG(i, true);
uint32_t instance_size = sizeof(gravity_instance_t) + (i->objclass->nivars * sizeof(gravity_value_t));
gravity_delegate_t *delegate = gravity_vm_delegate(vm);
if (i->xdata && delegate->bridge_size)
instance_size += delegate->bridge_size(vm, i->xdata);
SET_OBJECT_VISITED_FLAG(i, false);
return instance_size;
}
void gravity_instance_blacken (gravity_vm *vm, gravity_instance_t *i) {
gravity_vm_memupdate(vm, gravity_instance_size(vm, i));
// instance class
gravity_gray_object(vm, (gravity_object_t *)i->objclass);
// ivars
for (uint32_t j=0; j<i->objclass->nivars; ++j) {
gravity_gray_value(vm, i->ivars[j]);
}
// xdata
if (i->xdata) {
gravity_delegate_t *delegate = gravity_vm_delegate(vm);
if (delegate->bridge_blacken) delegate->bridge_blacken(vm, i->xdata);
}
}
void gravity_instance_serialize (gravity_instance_t *instance, json_t *json) {
gravity_class_t *c = instance->objclass;
const char *label = json_get_label(json, NULL);
json_begin_object(json, label);
json_add_cstring(json, GRAVITY_JSON_LABELTYPE, GRAVITY_JSON_INSTANCE);
json_add_cstring(json, GRAVITY_JSON_CLASS, c->identifier);
if (c->nivars) {
json_begin_array(json, GRAVITY_JSON_LABELIVAR);
for (uint32_t i=0; i<c->nivars; ++i) {
gravity_value_serialize(NULL, instance->ivars[i], json);
}
json_end_array(json);
}
json_end_object(json);
}
bool gravity_instance_isstruct (gravity_instance_t *i) {
return i->objclass->is_struct;
}
// MARK: -
static bool hash_value_compare_cb (gravity_value_t v1, gravity_value_t v2, void *data) {
#pragma unused (data)
return gravity_value_equals(v1, v2);
}
bool gravity_value_vm_equals (gravity_vm *vm, gravity_value_t v1, gravity_value_t v2) {
bool result = gravity_value_equals(v1, v2);
if (result || !vm) return result;
// sanity check
if (!(VALUE_ISA_INSTANCE(v1) && VALUE_ISA_INSTANCE(v2))) return false;
// if here means that they are two heap allocated objects
gravity_instance_t *obj1 = (gravity_instance_t *)VALUE_AS_OBJECT(v1);
gravity_instance_t *obj2 = (gravity_instance_t *)VALUE_AS_OBJECT(v2);
gravity_delegate_t *delegate = gravity_vm_delegate(vm);
if (obj1->xdata && obj2->xdata && delegate->bridge_equals) {
return delegate->bridge_equals(vm, obj1->xdata, obj2->xdata);
}
return false;
}
bool gravity_value_equals (gravity_value_t v1, gravity_value_t v2) {
// check same class
if (v1.isa != v2.isa) return false;
// check same value for value types
if ((v1.isa == gravity_class_int) || (v1.isa == gravity_class_bool) || (v1.isa == gravity_class_null)) {
return (v1.n == v2.n);
} else if (v1.isa == gravity_class_float) {
#if GRAVITY_ENABLE_DOUBLE
return (fabs(v1.f - v2.f) < EPSILON);
#else
return (fabsf(v1.f - v2.f) < EPSILON);
#endif
} else if (v1.isa == gravity_class_string) {
gravity_string_t *s1 = VALUE_AS_STRING(v1);
gravity_string_t *s2 = VALUE_AS_STRING(v2);
if (s1->hash != s2->hash) return false;
if (s1->len != s2->len) return false;
// same hash and same len so let's compare bytes
return (memcmp(s1->s, s2->s, s1->len) == 0);
} else if (v1.isa == gravity_class_range) {
gravity_range_t *r1 = VALUE_AS_RANGE(v1);
gravity_range_t *r2 = VALUE_AS_RANGE(v2);
return ((r1->from == r2->from) && (r1->to == r2->to));
} else if (v1.isa == gravity_class_list) {
gravity_list_t *list1 = VALUE_AS_LIST(v1);
gravity_list_t *list2 = VALUE_AS_LIST(v2);
if (marray_size(list1->array) != marray_size(list2->array)) return false;
size_t count = marray_size(list1->array);
for (size_t i=0; i<count; ++i) {
gravity_value_t value1 = marray_get(list1->array, i);
gravity_value_t value2 = marray_get(list2->array, i);
if (!gravity_value_equals(value1, value2)) return false;
}
return true;
} else if (v1.isa == gravity_class_map) {
gravity_map_t *map1 = VALUE_AS_MAP(v1);
gravity_map_t *map2 = VALUE_AS_MAP(v2);
return gravity_hash_compare(map1->hash, map2->hash, hash_value_compare_cb, NULL);
}
// if here means that they are two heap allocated objects
gravity_object_t *obj1 = VALUE_AS_OBJECT(v1);
gravity_object_t *obj2 = VALUE_AS_OBJECT(v2);
if (obj1->isa != obj2->isa) return false;
return (obj1 == obj2);
}
uint32_t gravity_value_hash (gravity_value_t value) {
if (value.isa == gravity_class_string)
return VALUE_AS_STRING(value)->hash;
if ((value.isa == gravity_class_int) || (value.isa == gravity_class_bool) || (value.isa == gravity_class_null))
return gravity_hash_compute_int(value.n);
if (value.isa == gravity_class_float)
return gravity_hash_compute_float(value.f);
return gravity_hash_compute_buffer((const char *)value.p, sizeof(gravity_object_t*));
}
inline gravity_class_t *gravity_value_getclass (gravity_value_t v) {
if ((v.isa == gravity_class_class) && (v.p->objclass == gravity_class_object)) return (gravity_class_t *)v.p;
if ((v.isa == gravity_class_instance) || (v.isa == gravity_class_class)) return (v.p) ? v.p->objclass : NULL;
return v.isa;
}
inline gravity_class_t *gravity_value_getsuper (gravity_value_t v) {
gravity_class_t *c = gravity_value_getclass(v);
return (c && c->superclass) ? c->superclass : NULL;
}
void gravity_value_free (gravity_vm *vm, gravity_value_t v) {
if (!gravity_value_isobject(v)) return;
gravity_object_free(vm, VALUE_AS_OBJECT(v));
}
static void gravity_map_serialize_iterator (gravity_hash_t *hashtable, gravity_value_t key, gravity_value_t v, void *data) {
#pragma unused(hashtable)
assert(key.isa == gravity_class_string);
json_t *json = (json_t *)data;
const char *key_value = VALUE_AS_STRING(key)->s;
gravity_value_serialize(key_value, v, json);
}
void gravity_value_serialize (const char *key, gravity_value_t v, json_t *json) {
// NULL
if (VALUE_ISA_NULL(v)) {
json_add_null(json, key);
return;
}
// UNDEFINED (convention used to represent an UNDEFINED value)
if (VALUE_ISA_UNDEFINED(v)) {
if (json_option_isset(json, json_opt_no_undef)) {
json_add_null(json, key);
} else {
json_begin_object(json, key);
json_end_object(json);
}
return;
}
// BOOL
if (VALUE_ISA_BOOL(v)) {
json_add_bool(json, key, (v.n == 0) ? false : true);
return;
}
// INT
if (VALUE_ISA_INT(v)) {
json_add_int(json, key, (int64_t)v.n);
return;
}
// FLOAT
if (VALUE_ISA_FLOAT(v)) {
json_add_double(json, key, (double)v.f);
return;
}
// FUNCTION
if (VALUE_ISA_FUNCTION(v)) {
json_set_label(json, key);
gravity_function_serialize(VALUE_AS_FUNCTION(v), json);
return;
}
// CLOSURE
if (VALUE_ISA_CLOSURE(v)) {
json_set_label(json, key);
gravity_function_serialize(VALUE_AS_CLOSURE(v)->f, json);
return;
}
// CLASS
if (VALUE_ISA_CLASS(v)) {
json_set_label(json, key);
gravity_class_serialize(VALUE_AS_CLASS(v), json);
return;
}
// STRING
if (VALUE_ISA_STRING(v)) {
gravity_string_t *value = VALUE_AS_STRING(v);
json_add_string(json, key, value->s, value->len);
return;
}
// LIST (ARRAY)
if (VALUE_ISA_LIST(v)) {
gravity_list_t *value = VALUE_AS_LIST(v);
json_begin_array(json, key);
size_t count = marray_size(value->array);
for (size_t j=0; j<count; j++) {
gravity_value_t item = marray_get(value->array, j);
// here I am sure that value is a literal value
gravity_value_serialize(NULL, item, json);
}
json_end_array(json);
return;
}
// MAP (HASH)
// a map is serialized only if it contains only literals, otherwise it is computed at runtime
if (VALUE_ISA_MAP(v)) {
gravity_map_t *value = VALUE_AS_MAP(v);
json_begin_object(json, key);
if (!json_option_isset(json, json_opt_no_maptype)) json_add_cstring(json, GRAVITY_JSON_LABELTYPE, GRAVITY_JSON_MAP);
gravity_hash_iterate(value->hash, gravity_map_serialize_iterator, json);
json_end_object(json);
return;
}
// RANGE
if (VALUE_ISA_RANGE(v)) {
json_set_label(json, key);
gravity_range_serialize(VALUE_AS_RANGE(v), json);
return;
}
// INSTANCE
if (VALUE_ISA_INSTANCE(v)) {
json_set_label(json, key);
gravity_instance_serialize(VALUE_AS_INSTANCE(v), json);
return;
}
// FIBER
if (VALUE_ISA_FIBER(v)) {
return;
}
// should never reach this point
assert(0);
}
bool gravity_value_isobject (gravity_value_t v) {
// was:
// if (VALUE_ISA_NOTVALID(v)) return false;
// if (VALUE_ISA_INT(v)) return false;
// if (VALUE_ISA_FLOAT(v)) return false;
// if (VALUE_ISA_BOOL(v)) return false;
// if (VALUE_ISA_NULL(v)) return false;
// if (VALUE_ISA_UNDEFINED(v)) return false;
// return true;
if ((v.isa == NULL) || (v.isa == gravity_class_int) || (v.isa == gravity_class_float) ||
(v.isa == gravity_class_bool) || (v.isa == gravity_class_null) || (v.p == NULL)) return false;
// extra check to allow ONLY known objects
if ((v.isa == gravity_class_string) || (v.isa == gravity_class_object) || (v.isa == gravity_class_function) ||
(v.isa == gravity_class_closure) || (v.isa == gravity_class_fiber) || (v.isa == gravity_class_class) ||
(v.isa == gravity_class_instance) || (v.isa == gravity_class_module) || (v.isa == gravity_class_list) ||
(v.isa == gravity_class_map) || (v.isa == gravity_class_range) || (v.isa == gravity_class_upvalue)) return true;
return false;
}
uint32_t gravity_value_size (gravity_vm *vm, gravity_value_t v) {
return (gravity_value_isobject(v)) ? gravity_object_size(vm, (gravity_object_t*)v.p) : 0;
}
void *gravity_value_xdata (gravity_value_t value) {
if (VALUE_ISA_INSTANCE(value)) {
gravity_instance_t *i = VALUE_AS_INSTANCE(value);
return i->xdata;
} else if (VALUE_ISA_CLASS(value)) {
gravity_class_t *c = VALUE_AS_CLASS(value);
return c->xdata;
}
return NULL;
}
const char *gravity_value_name (gravity_value_t value) {
if (VALUE_ISA_INSTANCE(value)) {
gravity_instance_t *instance = VALUE_AS_INSTANCE(value);
return instance->objclass->identifier;
} else if (VALUE_ISA_CLASS(value)) {
gravity_class_t *c = VALUE_AS_CLASS(value);
return c->identifier;
}
return NULL;
}
void gravity_value_dump (gravity_vm *vm, gravity_value_t v, char *buffer, uint16_t len) {
const char *type = NULL;
const char *value = NULL;
char sbuffer[1024];
if (buffer == NULL) buffer = sbuffer;
if (len == 0) len = sizeof(sbuffer);
if (v.isa == NULL) {
type = "INVALID!";
snprintf(buffer, len, "%s", type);
value = buffer;
} else if (v.isa == gravity_class_bool) {
type = "BOOL";
value = (v.n == 0) ? "false" : "true";
snprintf(buffer, len, "(%s) %s", type, value);
value = buffer;
} else if (v.isa == gravity_class_null) {
type = (v.n == 0) ? "NULL" : "UNDEFINED";
snprintf(buffer, len, "%s", type);
value = buffer;
} else if (v.isa == gravity_class_int) {
type = "INT";
snprintf(buffer, len, "(%s) %" PRId64, type, v.n);
value = buffer;
} else if (v.isa == gravity_class_float) {
type = "FLOAT";
snprintf(buffer, len, "(%s) %g", type, v.f);
value = buffer;
} else if (v.isa == gravity_class_function) {
type = "FUNCTION";
value = VALUE_AS_FUNCTION(v)->identifier;
snprintf(buffer, len, "(%s) %s (%p)", type, value, VALUE_AS_FUNCTION(v));
value = buffer;
} else if (v.isa == gravity_class_closure) {
type = "CLOSURE";
gravity_function_t *f = VALUE_AS_CLOSURE(v)->f;
value = (f->identifier) ? (f->identifier) : "anon";
snprintf(buffer, len, "(%s) %s (%p)", type, value, VALUE_AS_CLOSURE(v));
value = buffer;
} else if (v.isa == gravity_class_class) {
type = "CLASS";
value = VALUE_AS_CLASS(v)->identifier;
snprintf(buffer, len, "(%s) %s (%p)", type, value, VALUE_AS_CLASS(v));
value = buffer;
} else if (v.isa == gravity_class_string) {
type = "STRING";
gravity_string_t *s = VALUE_AS_STRING(v);
snprintf(buffer, len, "(%s) %.*s (%p)", type, s->len, s->s, s);
value = buffer;
} else if (v.isa == gravity_class_instance) {
type = "INSTANCE";
gravity_instance_t *i = VALUE_AS_INSTANCE(v);
gravity_class_t *c = i->objclass;
value = c->identifier;
snprintf(buffer, len, "(%s) %s (%p)", type, value, i);
value = buffer;
} else if (v.isa == gravity_class_list) {
type = "LIST";
gravity_value_t sval = convert_value2string(vm, v);
gravity_string_t *s = VALUE_AS_STRING(sval);
snprintf(buffer, len, "(%s) %.*s (%p)", type, s->len, s->s, s);
value = buffer;
} else if (v.isa == gravity_class_map) {
type = "MAP";
gravity_value_t sval = convert_value2string(vm, v);
gravity_string_t *s = VALUE_AS_STRING(sval);
snprintf(buffer, len, "(%s) %.*s (%p)", type, s->len, s->s, s);
value = buffer;
} else if (v.isa == gravity_class_range) {
type = "RANGE";
gravity_range_t *r = VALUE_AS_RANGE(v);
snprintf(buffer, len, "(%s) from %" PRId64 " to %" PRId64, type, r->from, r->to);
value = buffer;
} else if (v.isa == gravity_class_object) {
type = "OBJECT";
value = "N/A";
snprintf(buffer, len, "(%s) %s", type, value);
value = buffer;
} else if (v.isa == gravity_class_fiber) {
type = "FIBER";
snprintf(buffer, len, "(%s) %p", type, v.p);
value = buffer;
} else {
type = "N/A";
value = "N/A";
snprintf(buffer, len, "(%s) %s", type, value);
value = buffer;
}
if (buffer == sbuffer) printf("%s\n", value);
}
// MARK: -
gravity_list_t *gravity_list_new (gravity_vm *vm, uint32_t n) {
if (n > MAX_ALLOCATION) return NULL;
gravity_list_t *list = (gravity_list_t *)mem_alloc(NULL, sizeof(gravity_list_t));
list->isa = gravity_class_list;
marray_init(list->array);
marray_resize(gravity_value_t, list->array, n + MARRAY_DEFAULT_SIZE);
if (vm) gravity_vm_transfer(vm, (gravity_object_t*) list);
return list;
}
gravity_list_t *gravity_list_from_array (gravity_vm *vm, uint32_t n, gravity_value_t *p) {
gravity_list_t *list = (gravity_list_t *)mem_alloc(NULL, sizeof(gravity_list_t));
list->isa = gravity_class_list;
marray_init(list->array);
// elements must be copied because for the compiler their registers are TEMP
// and could be reused by other successive operations
for (size_t i=0; i<n; ++i) marray_push(gravity_value_t, list->array, p[i]);
if (vm) gravity_vm_transfer(vm, (gravity_object_t*) list);
return list;
}
void gravity_list_free (gravity_vm *vm, gravity_list_t *list) {
#pragma unused(vm)
DEBUG_FREE("FREE %s", gravity_object_debug((gravity_object_t *)list, true));
marray_destroy(list->array);
mem_free((void *)list);
}
void gravity_list_append_list (gravity_vm *vm, gravity_list_t *list1, gravity_list_t *list2) {
#pragma unused(vm)
// append list2 to list1
size_t count = marray_size(list2->array);
for (size_t i=0; i<count; ++i) {
marray_push(gravity_value_t, list1->array, marray_get(list2->array, i));
}
}
uint32_t gravity_list_size (gravity_vm *vm, gravity_list_t *list) {
SET_OBJECT_VISITED_FLAG(list, true);
uint32_t internal_size = 0;
size_t count = marray_size(list->array);
for (size_t i=0; i<count; ++i) {
internal_size += gravity_value_size(vm, marray_get(list->array, i));
}
internal_size += sizeof(gravity_list_t);
SET_OBJECT_VISITED_FLAG(list, false);
return internal_size;
}
void gravity_list_blacken (gravity_vm *vm, gravity_list_t *list) {
gravity_vm_memupdate(vm, gravity_list_size(vm, list));
size_t count = marray_size(list->array);
for (size_t i=0; i<count; ++i) {
gravity_gray_value(vm, marray_get(list->array, i));
}
}
// MARK: -
gravity_map_t *gravity_map_new (gravity_vm *vm, uint32_t n) {
gravity_map_t *map = (gravity_map_t *)mem_alloc(NULL, sizeof(gravity_map_t));
map->isa = gravity_class_map;
map->hash = gravity_hash_create(n, gravity_value_hash, gravity_value_equals, NULL, NULL);
if (vm) gravity_vm_transfer(vm, (gravity_object_t*) map);
return map;
}
void gravity_map_free (gravity_vm *vm, gravity_map_t *map) {
#pragma unused(vm)
DEBUG_FREE("FREE %s", gravity_object_debug((gravity_object_t *)map, true));
gravity_hash_free(map->hash);
mem_free((void *)map);
}
void gravity_map_append_map (gravity_vm *vm, gravity_map_t *map1, gravity_map_t *map2) {
#pragma unused(vm)
// append map2 to map1
gravity_hash_append(map1->hash, map2->hash);
}
void gravity_map_insert (gravity_vm *vm, gravity_map_t *map, gravity_value_t key, gravity_value_t value) {
#pragma unused(vm)
gravity_hash_insert(map->hash, key, value);
}
static gravity_map_t *gravity_map_deserialize (gravity_vm *vm, json_value *json) {
uint32_t n = json->u.object.length;
gravity_map_t *map = gravity_map_new(vm, n);
DEBUG_DESERIALIZE("DESERIALIZE MAP: %p\n", map);
for (uint32_t i=0; i<n; ++i) { // from 1 to skip type
const char *label = json->u.object.values[i].name;
json_value *jsonv = json->u.object.values[i].value;
gravity_value_t key = VALUE_FROM_CSTRING(vm, label);
gravity_value_t value;
switch (jsonv->type) {
case json_integer:
value = VALUE_FROM_INT((gravity_int_t)jsonv->u.integer); break;
case json_double:
value = VALUE_FROM_FLOAT((gravity_float_t)jsonv->u.dbl); break;
case json_boolean:
value = VALUE_FROM_BOOL(jsonv->u.boolean); break;
case json_string:
value = VALUE_FROM_STRING(vm, jsonv->u.string.ptr, jsonv->u.string.length); break;
case json_null:
value = VALUE_FROM_NULL; break;
case json_object: {
gravity_object_t *obj = gravity_object_deserialize(vm, jsonv);
value = (obj) ? VALUE_FROM_OBJECT(obj) : VALUE_FROM_NULL;
break;
}
case json_array: {
}
default:
goto abort_load;
}
gravity_map_insert(NULL, map, key, value);
}
return map;
abort_load:
// do not free map here because it is already garbage collected
return NULL;
}
uint32_t gravity_map_size (gravity_vm *vm, gravity_map_t *map) {
SET_OBJECT_VISITED_FLAG(map, true);
uint32_t hash_size = 0;
gravity_hash_iterate2(map->hash, gravity_hash_internalsize, (void *)&hash_size, (void *)vm);
hash_size += gravity_hash_memsize(map->hash);
hash_size += sizeof(gravity_map_t);
SET_OBJECT_VISITED_FLAG(map, false);
return hash_size;
}
void gravity_map_blacken (gravity_vm *vm, gravity_map_t *map) {
gravity_vm_memupdate(vm, gravity_map_size(vm, map));
gravity_hash_iterate(map->hash, gravity_hash_gray, (void *)vm);
}
// MARK: -
gravity_range_t *gravity_range_new (gravity_vm *vm, gravity_int_t from_range, gravity_int_t to_range, bool inclusive) {
gravity_range_t *range = mem_alloc(NULL, sizeof(gravity_range_t));
range->isa = gravity_class_range;
range->from = from_range;
range->to = (inclusive) ? to_range : --to_range;
if (vm) gravity_vm_transfer(vm, (gravity_object_t*) range);
return range;
}
void gravity_range_free (gravity_vm *vm, gravity_range_t *range) {
#pragma unused(vm)
DEBUG_FREE("FREE %s", gravity_object_debug((gravity_object_t *)range, true));
mem_free((void *)range);
}
uint32_t gravity_range_size (gravity_vm *vm, gravity_range_t *range) {
#pragma unused(vm, range)
SET_OBJECT_VISITED_FLAG(range, true);
uint32_t range_size = sizeof(gravity_range_t);
SET_OBJECT_VISITED_FLAG(range, false);
return range_size;
}
void gravity_range_serialize (gravity_range_t *r, json_t *json) {
const char *label = json_get_label(json, NULL);
json_begin_object(json, label);
json_add_cstring(json, GRAVITY_JSON_LABELTYPE, GRAVITY_JSON_RANGE); // MANDATORY 1st FIELD
json_add_int(json, GRAVITY_JSON_LABELFROM, r->from);
json_add_int(json, GRAVITY_JSON_LABELTO, r->to);
json_end_object(json);
}
gravity_range_t *gravity_range_deserialize (gravity_vm *vm, json_value *json) {
json_int_t from = 0;
json_int_t to = 0;
uint32_t n = json->u.object.length;
for (uint32_t i=1; i<n; ++i) { // from 1 to skip type
const char *label = json->u.object.values[i].name;
json_value *value = json->u.object.values[i].value;
size_t label_size = strlen(label);
// from
if (string_casencmp(label, GRAVITY_JSON_LABELFROM, label_size) == 0) {
if (value->type != json_integer) goto abort_load;
from = value->u.integer;
continue;
}
// to
if (string_casencmp(label, GRAVITY_JSON_LABELTO, label_size) == 0) {
if (value->type != json_integer) goto abort_load;
to = value->u.integer;
continue;
}
}
return gravity_range_new(vm, (gravity_int_t)from, (gravity_int_t)to, true);
abort_load:
return NULL;
}
void gravity_range_blacken (gravity_vm *vm, gravity_range_t *range) {
gravity_vm_memupdate(vm, gravity_range_size(vm, range));
}
// MARK: -
inline gravity_value_t gravity_string_to_value (gravity_vm *vm, const char *s, uint32_t len) {
gravity_string_t *obj = mem_alloc(NULL, sizeof(gravity_string_t));
if (len == AUTOLENGTH) len = (uint32_t)strlen(s);
uint32_t alloc = MAXNUM(len+1, DEFAULT_MINSTRING_SIZE);
char *ptr = mem_alloc(NULL, alloc);
memcpy(ptr, s, len);
obj->isa = gravity_class_string;
obj->s = ptr;
obj->len = len;
obj->alloc = alloc;
obj->hash = gravity_hash_compute_buffer((const char *)ptr, len);
gravity_value_t value;
value.isa = gravity_class_string;
value.p = (gravity_object_t *)obj;
if (vm) gravity_vm_transfer(vm, (gravity_object_t*) obj);
return value;
}
inline gravity_string_t *gravity_string_new (gravity_vm *vm, char *s, uint32_t len, uint32_t alloc) {
gravity_string_t *obj = mem_alloc(NULL, sizeof(gravity_string_t));
if (len == AUTOLENGTH) len = (uint32_t)strlen(s);
obj->isa = gravity_class_string;
obj->s = (char *)s;
obj->len = len;
obj->alloc = (alloc) ? alloc : len;
if (s && len) obj->hash = gravity_hash_compute_buffer((const char *)s, len);
if (vm) gravity_vm_transfer(vm, (gravity_object_t*) obj);
return obj;
}
inline void gravity_string_set (gravity_string_t *obj, char *s, uint32_t len) {
obj->s = (char *)s;
obj->len = len;
obj->hash = gravity_hash_compute_buffer((const char *)s, len);
}
inline void gravity_string_free (gravity_vm *vm, gravity_string_t *value) {
#pragma unused(vm)
DEBUG_FREE("FREE %s", gravity_object_debug((gravity_object_t *)value, true));
if (value->alloc) mem_free(value->s);
mem_free(value);
}
uint32_t gravity_string_size (gravity_vm *vm, gravity_string_t *string) {
#pragma unused(vm)
SET_OBJECT_VISITED_FLAG(string, true);
uint32_t string_size = (sizeof(gravity_string_t)) + string->alloc;
SET_OBJECT_VISITED_FLAG(string, false);
return string_size;
}
void gravity_string_blacken (gravity_vm *vm, gravity_string_t *string) {
gravity_vm_memupdate(vm, gravity_string_size(vm, string));
}
inline gravity_value_t gravity_value_from_error(const char* msg) {
return ((gravity_value_t){.isa = NULL, .p = ((gravity_object_t *)msg)});
}
inline gravity_value_t gravity_value_from_object(void *obj) {
return ((gravity_value_t){.isa = (((gravity_object_t *)(obj))->isa), .p = (gravity_object_t *)(obj)});
}
inline gravity_value_t gravity_value_from_int(gravity_int_t n) {
return ((gravity_value_t){.isa = gravity_class_int, .n = (n)});
}
inline gravity_value_t gravity_value_from_float(gravity_float_t f) {
return ((gravity_value_t){.isa = gravity_class_float, .f = (f)});
}
inline gravity_value_t gravity_value_from_null(void) {
return ((gravity_value_t){.isa = gravity_class_null, .n = 0});
}
inline gravity_value_t gravity_value_from_undefined(void) {
return ((gravity_value_t){.isa = gravity_class_null, .n = 1});
}
inline gravity_value_t gravity_value_from_bool(bool b) {
return ((gravity_value_t){.isa = gravity_class_bool, .n = (b)});
}
|
0777d2c8e35cf79711cd25d1b0376225189c0002
|
2148c987c4b008453d5034ef33cbce886c241a3b
|
/firmware/device_bootloader/main.c
|
f7106808710c13d37e5dc27988b63733d03f58dc
|
[
"Apache-2.0"
] |
permissive
|
ytai/ioio
|
94cebdb9b97163be2fefb6d9a362d184b2d157c2
|
42f156cd676f14c6a503464bb33feb83353484f6
|
refs/heads/master
| 2023-08-30T23:36:00.823993
| 2023-08-24T05:00:03
| 2023-08-24T05:00:03
| 2,272,409
| 477
| 201
|
Apache-2.0
| 2023-09-11T03:26:53
| 2011-08-26T04:59:57
|
C
|
UTF-8
|
C
| false
| false
| 7,688
|
c
|
main.c
|
/*
* Copyright 2011 Ytai Ben-Tsvi. 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 "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 ARSHAN POURSOHI 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.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied.
*/
// Bootloader main
#include <string.h>
#include <stdint.h>
#include "HardwareProfile.h"
#include <libpic30.h>
#include "GenericTypeDefs.h"
#include "board.h"
#include "boot_protocol.h"
#include "bootloader_defs.h"
#include "flash.h"
#include "logging.h"
#include "ioio_file.h"
#include "USB/usb_common.h"
#include "USB/usb_function_cdc.h"
#include "USB/usb_device.h"
#include "boot_features.h"
// Desired behavior:
// 1. Read the status of the "boot" pin (LED). If high, skip the bootloader
// and run the app.
// 2. Wait for the "boot" pin to go high.
// 3. Initialize USB device.
// 4. Wait for an incoming connection and run the bootloader protocol. Repeat
// forever (although one of the protocol commands forces a reset, which will
// kick us out).
////////////////////////////////////////////////////////////////////////////////
// Configuration Bits
#if defined(__PIC24FJ256GB206__)
_CONFIG1(FWDTEN_OFF & ICS_PGx2 & GWRP_OFF & GCP_OFF & JTAGEN_OFF)
_CONFIG2(POSCMOD_NONE & IOL1WAY_ON & OSCIOFNC_ON & FCKSM_CSDCMD & FNOSC_FRCPLL & PLL96MHZ_ON & PLLDIV_NODIV & IESO_OFF)
_CONFIG3(WPDIS_WPEN & WPFP_WPFP19 & WPCFG_WPCFGEN & WPEND_WPSTARTMEM & SOSCSEL_EC)
#else
#error Unsupported target
#endif
// When IOIO gets reset for an unexpected reason, its default behavior is to
// restart normally. This is desired in most cases.
// For debug purposes, however, we want to know what went wrong. With defining
// SIGANAL_AFTER_BAD_RESET, on any reset other than power-on, IOIO will blink
// a 16-bit code (long-1 short-0) to designtae the error.
// One very useful case is catching failed asserts. Their blink code will start
// with short-long-...
#ifdef SIGNAL_AFTER_BAD_RESET
static void SignalBit(int bit) {
led_on();
__delay_ms(bit ? 900 : 100);
led_off();
__delay_ms(bit ? 100 : 900);
}
static void SignalWord(unsigned int word) {
int i;
for (i = 0; i < 16; ++i) {
SignalBit(word & 0x8000);
word <<= 1;
}
}
static void SignalRcon() {
log_printf("RCON = 0x%x", RCON);
while (1) {
SignalWord(RCON);
Delay(8000000UL);
}
}
#endif
static void Blink(int times) {
while (times-- > 0) {
led_on();
__delay_ms(100);
led_off();
__delay_ms(200);
}
}
// Measures the period of one USB frame, based on SOF interrupts.
// Depends on timer2/3 running in 32-bit configuration.
uint32_t MeasureSOF() {
USBSOFIF = 1; // Clear.
while (!USBSOFIF);
const uint32_t start = TMR2 | (((uint32_t) TMR3HLD) << 16);
USBSOFIF = 1; // Clear.
while (!USBSOFIF);
const uint32_t end = TMR2 | (((uint32_t) TMR3HLD) << 16);
return end - start;
}
// Calibrate the oscillar according to the SOF clock coming from a USB host.
// This function will first block until a USB connection has been established.
// Then it will wait for 32 SOF's for the tuning process (will hang if they do
// not arrive!). Then, if will disconnect from the USB bus and wait 2 seconds.
// Upon exit, the _TUN register will hold the correct value.
static void OscCalibrate() {
int i;
led_init();
USBInitialize();
// Start timer2/3 as 32-bit, system clock (16MHz).
T2CON = 0x0008;
PR2 = PR3 = 0xFFFF;
T2CON = 0x8008;
// Wait for a USB connection. Blink meanwhile.
int led_counter = 0;
while (USBGetDeviceState() < POWERED_STATE) {
USBTasks();
if ((led_counter++ & 0x3FFF) == 0) led_toggle();
}
led_off();
log_printf("Connected to host. Starting calibration.");
// Start from 0 (redundant, but better be explicit).
_TUN = 0;
for (i = 0; i < 32; ++i) {
uint32_t duration;
// Repeat for sanity: if for some reason the SOF is too long or too short,
// ignore it.
do {
duration = MeasureSOF();
} while (duration < 15000 || duration > 17000);
if (duration < 16000 && _TUN != 31) {
// We're running too slow.
_TUN++;
} else if (duration > 16000 && _TUN != 32) {
// We're running too fast.
_TUN--;
}
}
log_printf("Duration: %lu, TUN=%d", MeasureSOF(), _TUN);
// Undo side-effects.
T2CON = 0x0000;
// Detach, wait.
USBShutdown();
__delay_ms(2000);
}
// Tune the oscillator by reading the value from configuration, or otherwise
// start the tuning process and store the result.
void OscCalibrateCached() {
BYTE tun = ReadOscTun();
log_printf("Read tune value 0x%X.", tun);
if (tun > 0x3F) {
log_printf("Entering oscillator calibration process.");
OscCalibrate();
WriteOscTun(_TUN); // Write result to flash.
} else {
_TUN = tun;
}
}
static bool IsPin1Grounded() {
bool result;
pin1_pullup = 1;
result = !pin1_read();
pin1_pullup = 0;
return result;
}
static bool ShouldEnterBootloader() {
#ifdef BOOTLOADER_ON_ILLEGAL_OPCODE
bool const result = !led_read() || _IOPUWR;
_IOPUWR = 0;
return result;
#else
return !led_read();
#endif
}
int main() {
log_init();
// If bootloader mode not requested, go immediately to app.
if (!ShouldEnterBootloader()) {
OscCalibrateCached();
log_printf("Running app...");
__asm__("goto __APP_RESET");
}
// We need to enter bootloader mode, wait for the boot pin to be released.
while (!led_read());
// Now we can start!
led_init();
#ifdef SIGNAL_AFTER_BAD_RESET
if (RCON & 0b1100001001000000) {
SignalRcon();
}
#endif
log_printf("Hello from Bootloader!!!");
if (IsPin1Grounded()) {
log_printf("Erasing config.");
EraseConfig();
}
OscCalibrateCached();
Blink(5);
USBInitialize();
while (1) {
// Wait for connection
while (!(USBGetDeviceState() == CONFIGURED_STATE
&& CDCIsDtePresent())) USBTasks();
log_printf("Connected!");
BootProtocolInit();
while (USBGetDeviceState() == CONFIGURED_STATE && CDCIsDtePresent()) {
static char in_buf[64];
USBTasks();
BYTE size = getsUSBUSART(in_buf, sizeof(in_buf));
if (!BootProtocolProcess(in_buf, size)) {
log_printf("Protocol error. Will detach / re-attach.");
USBSoftDetach();
__delay_ms(2000);
USBDeviceAttach();
break;
}
BootProtocolTasks();
}
log_printf("Disconnected!");
}
return 0;
}
|
2a32b8c0d2e148e2cdbda5ab42409fbb37e9bf40
|
376e1818d427b5e4d32fa6dd6c7b71e9fd88afdb
|
/lang/erlang/patches/patch-erts_etc_unix_run__erl.c
|
6a6ab8f74e414729fd53db7161e5e9a22480666d
|
[] |
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
| 695
|
c
|
patch-erts_etc_unix_run__erl.c
|
$NetBSD: patch-erts_etc_unix_run__erl.c,v 1.3 2023/01/11 21:58:43 nikita Exp $
Fix SunOS/C99.
Fix NetBSD.
--- erts/etc/unix/run_erl.c.orig 2022-12-12 08:30:54.000000000 +0100
+++ erts/etc/unix/run_erl.c 2023-01-11 22:30:49.938119650 +0100
@@ -41,6 +41,9 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
+#ifdef __sun
+#define __EXTENSIONS__
+#endif
#ifdef HAVE_WORKING_POSIX_OPENPT
# ifndef _XOPEN_SOURCE
/* On OS X, BSD and Solaris, we must leave _XOPEN_SOURCE undefined in order
@@ -81,7 +84,7 @@
#ifdef HAVE_LIBUTIL_H
# include <libutil.h>
#endif
-#ifdef HAVE_UTIL_H
+#if defined(HAVE_UTIL_H) || defined(__NetBSD__)
# include <util.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
|
3ecaff3833775b354a2a2096ccedb549b0db6a98
|
ea401c3e792a50364fe11f7cea0f35f99e8f4bde
|
/released_plugins/v3d_plugins/bigneuron_AmosSironi_PrzemyslawGlowacki_SQBTree_plugin/libs/ITK_include/vcl_exception.h
|
d4f6db9255ea5e2551ab6d39ae8b93a92be5556d
|
[
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
Vaa3D/vaa3d_tools
|
edb696aa3b9b59acaf83d6d27c6ae0a14bf75fe9
|
e6974d5223ae70474efaa85e1253f5df1814fae8
|
refs/heads/master
| 2023-08-03T06:12:01.013752
| 2023-08-02T07:26:01
| 2023-08-02T07:26:01
| 50,527,925
| 107
| 86
|
MIT
| 2023-05-22T23:43:48
| 2016-01-27T18:19:17
|
C++
|
UTF-8
|
C
| false
| false
| 1,121
|
h
|
vcl_exception.h
|
#ifndef vcl_exception_h_
#define vcl_exception_h_
#include "vcl_compiler.h"
#if !defined(VCL_HAS_EXCEPTIONS)
#if defined(VCL_WIN32) || defined(__EXCEPTIONS) || _COMPILER_VERSION == 721
# define VCL_HAS_EXCEPTIONS 1
#else
# define VCL_HAS_EXCEPTIONS 0
#endif
#endif
// This is just syntax at the moment. I can't figure out how to
// cover (...) and (char* e) yet...
#if VCL_HAS_EXCEPTIONS
# define vcl_throw throw
# define vcl_try try
# define vcl_catch catch
# define vcl_catch_all catch (...)
# include "iso/vcl_exception.h"
#else
//
#include "vcl_cstdlib.h"
#include "vcl_iostream.h"
struct vcl_throw_handler {
vcl_throw_handler(int line, char const* file) {
vcl_cerr << file << ":" << line << ": EXCEPTION: ";
}
~vcl_throw_handler() { vcl_abort (); }
vcl_ostream& s() { return vcl_cerr; }
};
# define vcl_throw vcl_throw_handler(__LINE__,__FILE__).s() <<
# define vcl_try if (0/* setjmp(buf) */) { /* handle longjmp */ } else
# define vcl_catch(x) for ( x = 0; false; )
# define vcl_catch_all if (1) /* nothing */ ; else
#endif
#endif // vcl_exception_h_
|
eb41fbfd36d51036335db0e176d325743eab7f0f
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/u-boot_new/board/amcc/sequoia/sequoia.c
|
53f9b3419faa4961d3eb10a60471ae69edd4cdc4
|
[
"GPL-2.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
| 11,864
|
c
|
sequoia.c
|
/*
* (C) Copyright 2006-2009
* Stefan Roese, DENX Software Engineering, sr@denx.de.
*
* (C) Copyright 2006
* Jacqueline Pira-Ferriol, AMCC/IBM, jpira-ferriol@fr.ibm.com
* Alain Saurel, AMCC/IBM, alain.saurel@fr.ibm.com
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <libfdt.h>
#include <fdt_support.h>
#include <asm/ppc4xx.h>
#include <asm/ppc4xx-gpio.h>
#include <asm/processor.h>
#include <asm/io.h>
#include <asm/bitops.h>
DECLARE_GLOBAL_DATA_PTR;
#if !defined(CONFIG_SYS_NO_FLASH)
extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */
#endif
extern void __ft_board_setup(void *blob, bd_t *bd);
ulong flash_get_size(ulong base, int banknum);
static inline u32 get_async_pci_freq(void)
{
if (in_8((void *)(CONFIG_SYS_BCSR_BASE + 5)) &
CONFIG_SYS_BCSR5_PCI66EN)
return 66666666;
else
return 33333333;
}
int board_early_init_f(void)
{
u32 sdr0_cust0;
u32 sdr0_pfc1, sdr0_pfc2;
u32 reg;
mtdcr(EBC0_CFGADDR, EBC0_CFG);
mtdcr(EBC0_CFGDATA, 0xb8400000);
/*
* Setup the interrupt controller polarities, triggers, etc.
*/
mtdcr(UIC0SR, 0xffffffff); /* clear all */
mtdcr(UIC0ER, 0x00000000); /* disable all */
mtdcr(UIC0CR, 0x00000005); /* ATI & UIC1 crit are critical */
mtdcr(UIC0PR, 0xfffff7ff); /* per ref-board manual */
mtdcr(UIC0TR, 0x00000000); /* per ref-board manual */
mtdcr(UIC0VR, 0x00000000); /* int31 highest, base=0x000 */
mtdcr(UIC0SR, 0xffffffff); /* clear all */
mtdcr(UIC1SR, 0xffffffff); /* clear all */
mtdcr(UIC1ER, 0x00000000); /* disable all */
mtdcr(UIC1CR, 0x00000000); /* all non-critical */
mtdcr(UIC1PR, 0xffffffff); /* per ref-board manual */
mtdcr(UIC1TR, 0x00000000); /* per ref-board manual */
mtdcr(UIC1VR, 0x00000000); /* int31 highest, base=0x000 */
mtdcr(UIC1SR, 0xffffffff); /* clear all */
mtdcr(UIC2SR, 0xffffffff); /* clear all */
mtdcr(UIC2ER, 0x00000000); /* disable all */
mtdcr(UIC2CR, 0x00000000); /* all non-critical */
mtdcr(UIC2PR, 0xffffffff); /* per ref-board manual */
mtdcr(UIC2TR, 0x00000000); /* per ref-board manual */
mtdcr(UIC2VR, 0x00000000); /* int31 highest, base=0x000 */
mtdcr(UIC2SR, 0xffffffff); /* clear all */
/* Check and reconfigure the PCI sync clock if necessary */
ppc4xx_pci_sync_clock_config(get_async_pci_freq());
/* 50MHz tmrclk */
out_8((u8 *) CONFIG_SYS_BCSR_BASE + 0x04, 0x00);
/* clear write protects */
out_8((u8 *) CONFIG_SYS_BCSR_BASE + 0x07, 0x00);
/* enable Ethernet */
out_8((u8 *) CONFIG_SYS_BCSR_BASE + 0x08, 0x00);
/* enable USB device */
out_8((u8 *) CONFIG_SYS_BCSR_BASE + 0x09, 0x20);
/* select Ethernet (and optionally IIC1) pins */
mfsdr(SDR0_PFC1, sdr0_pfc1);
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SELECT_MASK) |
SDR0_PFC1_SELECT_CONFIG_4;
#ifdef CONFIG_I2C_MULTI_BUS
sdr0_pfc1 |= ((sdr0_pfc1 & ~SDR0_PFC1_SIS_MASK) | SDR0_PFC1_SIS_IIC1_SEL);
#endif
/* Two UARTs, so we need 4-pin mode. Also, we want CTS/RTS mode. */
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U0IM_MASK) | SDR0_PFC1_U0IM_4PINS;
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U0ME_MASK) | SDR0_PFC1_U0ME_CTS_RTS;
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U1ME_MASK) | SDR0_PFC1_U1ME_CTS_RTS;
mfsdr(SDR0_PFC2, sdr0_pfc2);
sdr0_pfc2 = (sdr0_pfc2 & ~SDR0_PFC2_SELECT_MASK) |
SDR0_PFC2_SELECT_CONFIG_4;
mtsdr(SDR0_PFC2, sdr0_pfc2);
mtsdr(SDR0_PFC1, sdr0_pfc1);
/* PCI arbiter enabled */
mfsdr(SDR0_PCI0, reg);
mtsdr(SDR0_PCI0, 0x80000000 | reg);
/* setup NAND FLASH */
mfsdr(SDR0_CUST0, sdr0_cust0);
sdr0_cust0 = SDR0_CUST0_MUX_NDFC_SEL |
SDR0_CUST0_NDFC_ENABLE |
SDR0_CUST0_NDFC_BW_8_BIT |
SDR0_CUST0_NDFC_ARE_MASK |
(0x80000000 >> (28 + CONFIG_SYS_NAND_CS));
mtsdr(SDR0_CUST0, sdr0_cust0);
return 0;
}
int misc_init_r(void)
{
#if !defined(CONFIG_SYS_NO_FLASH)
uint pbcr;
int size_val = 0;
#endif
#ifdef CONFIG_440EPX
unsigned long usb2d0cr = 0;
unsigned long usb2phy0cr, usb2h0cr = 0;
unsigned long sdr0_pfc1;
char *act = getenv("usbact");
#endif
u32 reg;
#if !defined(CONFIG_SYS_NO_FLASH)
/* Re-do flash sizing to get full correct info */
/* adjust flash start and offset */
gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
gd->bd->bi_flashoffset = 0;
#if defined(CONFIG_SYS_RAMBOOT)
mtdcr(EBC0_CFGADDR, PB3CR);
#else
mtdcr(EBC0_CFGADDR, PB0CR);
#endif
pbcr = mfdcr(EBC0_CFGDATA);
size_val = ffs(gd->bd->bi_flashsize) - 21;
pbcr = (pbcr & 0x0001ffff) | gd->bd->bi_flashstart | (size_val << 17);
#if defined(CONFIG_SYS_RAMBOOT)
mtdcr(EBC0_CFGADDR, PB3CR);
#else
mtdcr(EBC0_CFGADDR, PB0CR);
#endif
mtdcr(EBC0_CFGDATA, pbcr);
/*
* Re-check to get correct base address
*/
flash_get_size(gd->bd->bi_flashstart, 0);
#ifdef CONFIG_ENV_IS_IN_FLASH
/* Monitor protection ON by default */
(void)flash_protect(FLAG_PROTECT_SET,
-CONFIG_SYS_MONITOR_LEN,
0xffffffff,
&flash_info[0]);
/* Env protection ON by default */
(void)flash_protect(FLAG_PROTECT_SET,
CONFIG_ENV_ADDR_REDUND,
CONFIG_ENV_ADDR_REDUND + 2*CONFIG_ENV_SECT_SIZE - 1,
&flash_info[0]);
#endif
#endif /* CONFIG_SYS_NO_FLASH */
/*
* USB suff...
*/
#ifdef CONFIG_440EPX
if (act == NULL || strcmp(act, "hostdev") == 0) {
/* SDR Setting */
mfsdr(SDR0_PFC1, sdr0_pfc1);
mfsdr(SDR0_USB2D0CR, usb2d0cr);
mfsdr(SDR0_USB2PHY0CR, usb2phy0cr);
mfsdr(SDR0_USB2H0CR, usb2h0cr);
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_XOCLK_MASK;
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL;
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_WDINT_MASK;
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_WDINT_16BIT_30MHZ;
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DVBUS_MASK;
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PURDIS;
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DWNSTR_MASK;
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_HOST;
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_UTMICN_MASK;
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_HOST;
/*
* An 8-bit/60MHz interface is the only possible alternative
* when connecting the Device to the PHY
*/
usb2h0cr = usb2h0cr &~SDR0_USB2H0CR_WDINT_MASK;
usb2h0cr = usb2h0cr | SDR0_USB2H0CR_WDINT_16BIT_30MHZ;
/*
* To enable the USB 2.0 Device function
* through the UTMI interface
*/
usb2d0cr = usb2d0cr &~SDR0_USB2D0CR_USB2DEV_EBC_SEL_MASK;
usb2d0cr = usb2d0cr | SDR0_USB2D0CR_USB2DEV_SELECTION;
sdr0_pfc1 = sdr0_pfc1 &~SDR0_PFC1_UES_MASK;
sdr0_pfc1 = sdr0_pfc1 | SDR0_PFC1_UES_USB2D_SEL;
mtsdr(SDR0_PFC1, sdr0_pfc1);
mtsdr(SDR0_USB2D0CR, usb2d0cr);
mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
mtsdr(SDR0_USB2H0CR, usb2h0cr);
/*clear resets*/
udelay (1000);
mtsdr(SDR0_SRST1, 0x00000000);
udelay (1000);
mtsdr(SDR0_SRST0, 0x00000000);
printf("USB: Host(int phy) Device(ext phy)\n");
} else if (strcmp(act, "dev") == 0) {
/*-------------------PATCH-------------------------------*/
mfsdr(SDR0_USB2PHY0CR, usb2phy0cr);
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_XOCLK_MASK;
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL;
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DVBUS_MASK;
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PURDIS;
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DWNSTR_MASK;
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_HOST;
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_UTMICN_MASK;
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_HOST;
mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
udelay (1000);
mtsdr(SDR0_SRST1, 0x672c6000);
udelay (1000);
mtsdr(SDR0_SRST0, 0x00000080);
udelay (1000);
mtsdr(SDR0_SRST1, 0x60206000);
*(unsigned int *)(0xe0000350) = 0x00000001;
udelay (1000);
mtsdr(SDR0_SRST1, 0x60306000);
/*-------------------PATCH-------------------------------*/
/* SDR Setting */
mfsdr(SDR0_USB2PHY0CR, usb2phy0cr);
mfsdr(SDR0_USB2H0CR, usb2h0cr);
mfsdr(SDR0_USB2D0CR, usb2d0cr);
mfsdr(SDR0_PFC1, sdr0_pfc1);
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_XOCLK_MASK;
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL;
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_WDINT_MASK;
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_WDINT_8BIT_60MHZ;
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DVBUS_MASK;
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PUREN;
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DWNSTR_MASK;
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_DEV;
usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_UTMICN_MASK;
usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_DEV;
usb2h0cr = usb2h0cr &~SDR0_USB2H0CR_WDINT_MASK;
usb2h0cr = usb2h0cr | SDR0_USB2H0CR_WDINT_8BIT_60MHZ;
usb2d0cr = usb2d0cr &~SDR0_USB2D0CR_USB2DEV_EBC_SEL_MASK;
usb2d0cr = usb2d0cr | SDR0_USB2D0CR_EBC_SELECTION;
sdr0_pfc1 = sdr0_pfc1 &~SDR0_PFC1_UES_MASK;
sdr0_pfc1 = sdr0_pfc1 | SDR0_PFC1_UES_EBCHR_SEL;
mtsdr(SDR0_USB2H0CR, usb2h0cr);
mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
mtsdr(SDR0_USB2D0CR, usb2d0cr);
mtsdr(SDR0_PFC1, sdr0_pfc1);
/* clear resets */
udelay (1000);
mtsdr(SDR0_SRST1, 0x00000000);
udelay (1000);
mtsdr(SDR0_SRST0, 0x00000000);
printf("USB: Device(int phy)\n");
}
#endif /* CONFIG_440EPX */
mfsdr(SDR0_SRST1, reg); /* enable security/kasumi engines */
reg &= ~(SDR0_SRST1_CRYP0 | SDR0_SRST1_KASU0);
mtsdr(SDR0_SRST1, reg);
/*
* Clear PLB4A0_ACR[WRP]
* This fix will make the MAL burst disabling patch for the Linux
* EMAC driver obsolete.
*/
reg = mfdcr(PLB4A0_ACR) & ~PLB4Ax_ACR_WRP_MASK;
mtdcr(PLB4A0_ACR, reg);
return 0;
}
int checkboard(void)
{
char buf[64];
int i = getenv_f("serial#", buf, sizeof(buf));
u8 rev;
u32 clock = get_async_pci_freq();
#ifdef CONFIG_440EPX
printf("Board: Sequoia - AMCC PPC440EPx Evaluation Board");
#else
printf("Board: Rainier - AMCC PPC440GRx Evaluation Board");
#endif
rev = in_8((void *)(CONFIG_SYS_BCSR_BASE + 0));
printf(", Rev. %X, PCI-Async=%d MHz", rev, clock / 1000000);
if (i > 0) {
puts(", serial# ");
puts(buf);
}
putc('\n');
/*
* Reconfiguration of the PCI sync clock is already done,
* now check again if everything is in range:
*/
if (ppc4xx_pci_sync_clock_config(clock)) {
printf("ERROR: PCI clocking incorrect (async=%d "
"sync=%ld)!\n", clock, get_PCI_freq());
}
return (0);
}
#if defined(CONFIG_PCI) && defined(CONFIG_PCI_PNP)
/*
* Assign interrupts to PCI devices.
*/
void board_pci_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
{
pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, VECNUM_EIRQ2);
}
#endif
#if defined(CONFIG_SYS_RAMBOOT)
/*
* On NAND-booting sequoia, we need to patch the chips select numbers
* in the dtb (CS0 - NAND, CS3 - NOR)
*/
void ft_board_setup(void *blob, bd_t *bd)
{
int rc;
int len;
int nodeoffset;
struct fdt_property *prop;
u32 *reg;
char path[32];
/* First do common fdt setup */
__ft_board_setup(blob, bd);
/* And now configure NOR chip select to 3 instead of 0 */
strcpy(path, "/plb/opb/ebc/nor_flash@0,0");
nodeoffset = fdt_path_offset(blob, path);
prop = fdt_get_property_w(blob, nodeoffset, "reg", &len);
if (prop == NULL) {
printf("Unable to update NOR chip select for NAND booting\n");
return;
}
reg = (u32 *)&prop->data[0];
reg[0] = 3;
rc = fdt_find_and_setprop(blob, path, "reg", reg, 3 * sizeof(u32), 1);
if (rc) {
printf("Unable to update property NOR mappings, err=%s\n",
fdt_strerror(rc));
return;
}
/* And now configure NAND chip select to 0 instead of 3 */
strcpy(path, "/plb/opb/ebc/ndfc@3,0");
nodeoffset = fdt_path_offset(blob, path);
prop = fdt_get_property_w(blob, nodeoffset, "reg", &len);
if (prop == NULL) {
printf("Unable to update NDFC chip select for NAND booting\n");
return;
}
reg = (u32 *)&prop->data[0];
reg[0] = 0;
rc = fdt_find_and_setprop(blob, path, "reg", reg, 3 * sizeof(u32), 1);
if (rc) {
printf("Unable to update property NDFC mappings, err=%s\n",
fdt_strerror(rc));
return;
}
}
#endif /* CONFIG_SYS_RAMBOOT */
|
a7bb52587360570015fcdb95072d64695ad1c2d2
|
8838eb997879add5759b6dfb23f9a646464e53ca
|
/src/lib/cpu_info/cpu_info_funcs.c
|
e4d706d2fffe0b777e7af7dbd47593939c2dd96c
|
[
"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
| 478
|
c
|
cpu_info_funcs.c
|
/**
* @file
* @brief
*
* @date 19.03.2020
* @author Archit Checker
*/
#include <lib/libcpu_info.h>
#include <string.h>
#include <assert.h>
void set_feature_val(struct cpu_info *info, const char *name, unsigned int val) {
int current_feature = info->feature_count;
assert((current_feature < MAX_NUM_FEATURES) && "Exceeded Number of Features!");
strcpy(info->feature[current_feature].name, name);
info->feature[current_feature].val = val;
info->feature_count += 1;
}
|
3cbbff6f1f84eb31df959bd183a9398dcb76aa1b
|
33377c4d113cf9ea1338077af6bd645f3c5796b3
|
/extensions/tutorial/stringpointer/mylib.c
|
19087b1fb6bec792f5db55158299a9d6c2853472
|
[
"LicenseRef-scancode-free-unknown",
"MIT"
] |
permissive
|
ring-lang/ring
|
56f55111f751b0274d4f588871f806a8c2734dea
|
2081d2efb41c9dacd49b7a6944b9ca332638ba64
|
refs/heads/master
| 2023-09-04T16:54:44.309452
| 2023-09-03T10:28:57
| 2023-09-03T10:28:57
| 54,633,811
| 1,360
| 555
|
MIT
| 2023-08-03T01:48:24
| 2016-03-24T10:29:27
|
C
|
UTF-8
|
C
| false
| false
| 442
|
c
|
mylib.c
|
#include "ring.h"
#include "stdlib.h"
void changeValue(char *var)
{
strcpy(var,"Hello from C Code");
}
RING_FUNC(ring_changevalue)
{
if (RING_API_PARACOUNT != 1)
{
RING_API_ERROR(RING_API_BADPARACOUNT);
return;
}
if (!RING_API_ISSTRING(1))
{
RING_API_ERROR(RING_API_BADPARATYPE);
return;
}
char *p1 = RING_API_GETCHARPOINTER(1);
changeValue(p1);
}
RING_LIBINIT
{
RING_API_REGISTER("changevalue",ring_changevalue);
}
|
b6f3c5762f31bad772572216b45c4cd1a0ddfcf5
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/arch/arm/mach-kirkwood/board-km_kirkwood.c
|
44e4605ba0bfbcb70b1ef1827acdeeffc03cbcd1
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.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
| 1,405
|
c
|
board-km_kirkwood.c
|
/*
* Copyright 2012 2012 KEYMILE AG, CH-3097 Bern
* Valentin Longchamp <valentin.longchamp@keymile.com>
*
* arch/arm/mach-kirkwood/board-km_kirkwood.c
*
* Keymile km_kirkwood Reference Desing Init for drivers not converted to
* flattened device tree yet.
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/mv643xx_eth.h>
#include <linux/clk.h>
#include <linux/clk-private.h>
#include "common.h"
static struct mv643xx_eth_platform_data km_kirkwood_ge00_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(0),
};
void __init km_kirkwood_init(void)
{
struct clk *sata_clk;
/*
* Our variant of kirkwood (integrated in the Bobcat) hangs on accessing
* SATA bits (14-15) of the Clock Gating Control Register. Since these
* devices are also not present in this variant, their clocks get
* disabled because unused when clk_disable_unused() gets called.
* That's why we change the flags to these clocks to CLK_IGNORE_UNUSED
*/
sata_clk = clk_get_sys("sata_mv.0", "0");
if (!IS_ERR(sata_clk))
sata_clk->flags |= CLK_IGNORE_UNUSED;
sata_clk = clk_get_sys("sata_mv.0", "1");
if (!IS_ERR(sata_clk))
sata_clk->flags |= CLK_IGNORE_UNUSED;
kirkwood_ge00_init(&km_kirkwood_ge00_data);
}
|
b1c6107bfc1bf291d29f10301c78cd58bba388dd
|
6ff85b80c6fe1b3ad5416a304b93551a5e80de10
|
/C/Syntax/BitFieldUnion.c
|
3cd9606c63f0e0b8f19bd234d376d41fe420dd5d
|
[
"MIT"
] |
permissive
|
maniero/SOpt
|
c600cc2333e0a47ce013be3516bbb8080502ff2a
|
5d17e1a9cbf115eaea6d30af2079d0c92ffff7a3
|
refs/heads/master
| 2023-08-10T16:48:46.058739
| 2023-08-10T13:42:17
| 2023-08-10T13:42:17
| 78,631,930
| 1,002
| 136
|
MIT
| 2023-01-28T12:10:01
| 2017-01-11T11:19:24
|
C#
|
UTF-8
|
C
| false
| false
| 509
|
c
|
BitFieldUnion.c
|
#include <stdio.h>
typedef union {
char valor;
struct {
unsigned char a : 1;
unsigned char b : 1;
unsigned char c : 1;
unsigned char d : 1;
unsigned char e : 1;
unsigned char f : 1;
unsigned char g : 1;
unsigned char : 1;
} bits;
} Tipo;
int main(void) {
Tipo x = { .valor = 87 };
printf("%d %d %d %d %d %d %d", x.bits.a, x.bits.b, x.bits.c, x.bits.d, x.bits.e, x.bits.f, x.bits.g);
}
//http://pt.stackoverflow.com/q/178733/101
|
7b3a01a6737725908f36a66a9366c1b9810b4fe6
|
8d7d6f609ba65eb2650e5f04ab7b2d6db8a192d4
|
/src/colOrderStats.c
|
b05557debc5e73ffaf110b87cdee2b062681b507
|
[] |
no_license
|
HenrikBengtsson/matrixStats
|
78e0edb5e23265b39a0ceb14f59e317fde401a79
|
3e8f9ddafc0de61e870534b75fb5f90429a7bd31
|
refs/heads/develop
| 2023-07-26T10:52:03.035332
| 2023-07-10T20:20:44
| 2023-07-10T20:20:44
| 20,844,530
| 196
| 41
| null | 2023-05-26T22:51:17
| 2014-06-14T23:59:10
|
R
|
UTF-8
|
C
| false
| false
| 3,180
|
c
|
colOrderStats.c
|
/***************************************************************************
Public methods:
SEXP colOrderStats(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP which, SEXP useNames)
Authors: Henrik Bengtsson
To do: Add support for missing values.
Copyright Henrik Bengtsson, 2007-2014
**************************************************************************/
#include <Rdefines.h>
#include "000.types.h"
#include "colOrderStats_lowlevel.h"
#include "naming.h"
SEXP colOrderStats(SEXP x, SEXP dim, SEXP rows, SEXP cols, SEXP which, SEXP useNames) {
SEXP ans = NILSXP;
R_xlen_t nrow, ncol, qq;
/* Coercion moved down to C */
PROTECT(dim = coerceVector(dim, INTSXP));
/* Argument 'x' and 'dim': */
assertArgMatrix(x, dim, (R_TYPE_INT | R_TYPE_REAL), "x");
nrow = asR_xlen_t(dim, 0);
ncol = asR_xlen_t(dim, 1);
/* Argument 'which': */
if (length(which) != 1)
error("Argument 'which' must be a single number.");
if (!isNumeric(which))
error("Argument 'which' must be a numeric number.");
/* Argument 'rows' and 'cols': */
R_xlen_t nrows, ncols;
int rowsHasna, colsHasna;
R_xlen_t *crows = validateIndicesCheckNA(rows, nrow, 0, &nrows, &rowsHasna);
R_xlen_t *ccols = validateIndicesCheckNA(cols, ncol, 0, &ncols, &colsHasna);
/* Argument 'useNames': */
int usenames = asLogical(useNames);
// Check missing rows
if (rowsHasna && ncols > 0) {
error("Argument 'rows' must not contain missing value");
}
// Check missing cols
if (colsHasna && nrows > 0) {
error("Argument 'cols' must not contain missing value");
}
/* Subtract one here, since rPsort does zero based addressing */
qq = asInteger(which) - 1;
/* Assert that 'qq' is a valid index */
if (qq < 0 || qq >= nrows) {
error("Argument 'which' is out of range: %d", qq + 1);
}
/* Double matrices are more common to use. */
if (isReal(x)) {
PROTECT(ans = allocVector(REALSXP, ncols));
colOrderStats_dbl(REAL(x), nrow, ncol, crows, nrows, ccols, ncols, qq, REAL(ans));
if (usenames != NA_LOGICAL && usenames) {
SEXP dimnames = getAttrib(x, R_DimNamesSymbol);
if (dimnames != R_NilValue) {
SEXP namesVec = VECTOR_ELT(dimnames, 1);
if (namesVec != R_NilValue) {
setNames(ans, namesVec, ncols, ccols);
}
}
}
UNPROTECT(1);
} else if (isInteger(x)) {
PROTECT(ans = allocVector(INTSXP, ncols));
colOrderStats_int(INTEGER(x), nrow, ncol, crows, nrows, ccols, ncols, qq, INTEGER(ans));
if (usenames != NA_LOGICAL && usenames) {
SEXP dimnames = getAttrib(x, R_DimNamesSymbol);
if (dimnames != R_NilValue) {
SEXP namesVec = VECTOR_ELT(dimnames, 1);
if (namesVec != R_NilValue) {
setNames(ans, namesVec, ncols, ccols);
}
}
}
UNPROTECT(1);
}
UNPROTECT(1); /* PROTECT(dim = ...) */
return(ans);
} // colOrderStats()
/***************************************************************************
HISTORY:
2015-07-08 [DJ]
o Supported subsetted computation.
2014-11-16 [HB]
o Created from rowOrderStats.c.
**************************************************************************/
|
0f2c9305a7517bfcf6ce72ecf81c78782814b167
|
4bfd0ac356308fce892cdfb9084ebb2945aeb2fd
|
/Config/I2C_MultiSlave_Config.h
|
8f273dc6d2a2a06d662cc86c0a5b5e3eb0c2059d
|
[
"Apache-2.0"
] |
permissive
|
ARM-software/CMSIS-Driver
|
6f20854bb7b8294e35c37b1330a37688dc51fa52
|
b91908d907b647bd212920e30b383b03809d68e0
|
refs/heads/main
| 2023-03-16T17:58:43.403214
| 2022-09-27T06:29:48
| 2022-09-27T06:29:48
| 118,799,834
| 138
| 64
|
Apache-2.0
| 2022-09-27T06:29:49
| 2018-01-24T17:42:10
|
C
|
UTF-8
|
C
| false
| false
| 3,670
|
h
|
I2C_MultiSlave_Config.h
|
/*
* Copyright (c) 2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* 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
*
* 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.
*
* -----------------------------------------------------------------------
*
* $Date: 20. February 2018
* $Revision: V1.0.0
*
* Driver: Driver_I2C# (default: Driver_I2C0)
* Project: I2C Master to Multi-Slave Wrapper Configuration
* -----------------------------------------------------------------------
* Use the following configuration settings in the middleware component
* to connect to this driver.
*
* Configuration Setting Value
* --------------------- -----
* Connect to hardware via Driver_I2C# = n (default: 0)
* -------------------------------------------------------------------- */
//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
// <h>I2C Multi-Slave Driver Configuration
// <o>Connect to hardware via Driver_I2C# <0-255>
// <i>Select driver control block for hardware interface
#define I2C_DRIVER 0
// <e0>Slave Device 0
// <i>Enable or disable slave device
// <o1>Export control block Driver_I2C# <0-255>
// <i>Define exported driver control block number
// </e>
#define I2C_ENABLE_SLAVE_0 1
#define I2C_DRIVER_SLAVE_0 10
// <e0>Slave Device 1
// <i>Enable or disable slave device
// <o1>Export control block Driver_I2C# <0-255>
// <i>Define exported driver control block number
// </e>
#define I2C_ENABLE_SLAVE_1 1
#define I2C_DRIVER_SLAVE_1 11
// <e0>Slave Device 2
// <i>Enable or disable slave device
// <o1>Export control block Driver_I2C# <0-255>
// <i>Define exported driver control block number
// </e>
#define I2C_ENABLE_SLAVE_2 0
#define I2C_DRIVER_SLAVE_2 12
// <e0>Slave Device 3
// <i>Enable or disable slave device
// <o1>Export control block Driver_I2C# <0-255>
// <i>Define exported driver control block number
// </e>
#define I2C_ENABLE_SLAVE_3 0
#define I2C_DRIVER_SLAVE_3 13
// <e0>Slave Device 4
// <i>Enable or disable slave device
// <o1>Export control block Driver_I2C# <0-255>
// <i>Define exported driver control block number
// </e>
#define I2C_ENABLE_SLAVE_4 0
#define I2C_DRIVER_SLAVE_4 14
// <e0>Slave Device 5
// <i>Enable or disable slave device
// <o1>Export control block Driver_I2C# <0-255>
// <i>Define exported driver control block number
// </e>
#define I2C_ENABLE_SLAVE_5 0
#define I2C_DRIVER_SLAVE_5 15
// <e0>Slave Device 6
// <i>Enable or disable slave device
// <o1>Export control block Driver_I2C# <0-255>
// <i>Define exported driver control block number
// </e>
#define I2C_ENABLE_SLAVE_6 0
#define I2C_DRIVER_SLAVE_6 16
// <e0>Slave Device 7
// <i>Enable or disable slave device
// <o1>Export control block Driver_I2C# <0-255>
// <i>Define exported driver control block number
// </e>
#define I2C_ENABLE_SLAVE_7 0
#define I2C_DRIVER_SLAVE_7 17
// </h>
//------------- <<< end of configuration section >>> -------------------------
|
dcb84af942cf70fa5626d9683effd9791654b2bd
|
7e41167bfae6d2c38689b7e0993b308e045cbd05
|
/libarchive/libarchive/cpio/test/main.c
|
a8b68146eb7af98eba767e0b77ffd19e70f77766
|
[
"BSD-3-Clause",
"curl",
"GPL-1.0-or-later",
"MIT",
"Python-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-bsd-unchanged"
] |
permissive
|
holzschu/ios_system
|
7b18993dbcb33331c353e0257ca54847a5d1b1bb
|
6a83eb1c6c383a562fbe33a7e97677e88d305b51
|
refs/heads/master
| 2023-08-14T09:11:40.627903
| 2023-04-18T15:12:29
| 2023-04-18T15:12:29
| 113,187,304
| 882
| 155
|
BSD-3-Clause
| 2023-08-19T19:15:35
| 2017-12-05T13:42:50
|
C
|
UTF-8
|
C
| false
| false
| 53,595
|
c
|
main.c
|
/*
* Copyright (c) 2003-2009 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) 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 "test.h"
#include <errno.h>
#include <locale.h>
#include <stdarg.h>
#include <time.h>
/*
* This same file is used pretty much verbatim for all test harnesses.
*
* The next few lines are the only differences.
* TODO: Move this into a separate configuration header, have all test
* suites share one copy of this file.
*/
__FBSDID("$FreeBSD: src/usr.bin/cpio/test/main.c,v 1.3 2008/08/24 04:58:22 kientzle Exp $");
#define KNOWNREF "test_option_f.cpio.uu"
#define ENVBASE "BSDCPIO" /* Prefix for environment variables. */
#define PROGRAM "bsdcpio" /* Name of program being tested. */
#undef LIBRARY /* Not testing a library. */
#undef EXTRA_DUMP /* How to dump extra data */
/* How to generate extra version info. */
#define EXTRA_VERSION (systemf("%s --version", testprog) ? "" : "")
/*
*
* Windows support routines
*
* Note: Configuration is a tricky issue. Using HAVE_* feature macros
* in the test harness is dangerous because they cover up
* configuration errors. The classic example of this is omitting a
* configure check. If libarchive and libarchive_test both look for
* the same feature macro, such errors are hard to detect. Platform
* macros (e.g., _WIN32 or __GNUC__) are a little better, but can
* easily lead to very messy code. It's best to limit yourself
* to only the most generic programming techniques in the test harness
* and thus avoid conditionals altogether. Where that's not possible,
* try to minimize conditionals by grouping platform-specific tests in
* one place (e.g., test_acl_freebsd) or by adding new assert()
* functions (e.g., assertMakeHardlink()) to cover up platform
* differences. Platform-specific coding in libarchive_test is often
* a symptom that some capability is missing from libarchive itself.
*/
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <io.h>
#include <windows.h>
#ifndef F_OK
#define F_OK (0)
#endif
#ifndef S_ISDIR
#define S_ISDIR(m) ((m) & _S_IFDIR)
#endif
#ifndef S_ISREG
#define S_ISREG(m) ((m) & _S_IFREG)
#endif
#if !defined(__BORLANDC__)
#define access _access
#define chdir _chdir
#endif
#ifndef fileno
#define fileno _fileno
#endif
/*#define fstat _fstat64*/
#if !defined(__BORLANDC__)
#define getcwd _getcwd
#endif
#define lstat stat
/*#define lstat _stat64*/
/*#define stat _stat64*/
#define rmdir _rmdir
#if !defined(__BORLANDC__)
#define strdup _strdup
#define umask _umask
#endif
#define int64_t __int64
#endif
#if defined(HAVE__CrtSetReportMode)
# include <crtdbg.h>
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
void *GetFunctionKernel32(const char *name)
{
static HINSTANCE lib;
static int set;
if (!set) {
set = 1;
lib = LoadLibrary("kernel32.dll");
}
if (lib == NULL) {
fprintf(stderr, "Can't load kernel32.dll?!\n");
exit(1);
}
return (void *)GetProcAddress(lib, name);
}
static int
my_CreateSymbolicLinkA(const char *linkname, const char *target, int flags)
{
static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, DWORD);
static int set;
if (!set) {
set = 1;
f = GetFunctionKernel32("CreateSymbolicLinkA");
}
return f == NULL ? 0 : (*f)(linkname, target, flags);
}
static int
my_CreateHardLinkA(const char *linkname, const char *target)
{
static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES);
static int set;
if (!set) {
set = 1;
f = GetFunctionKernel32("CreateHardLinkA");
}
return f == NULL ? 0 : (*f)(linkname, target, NULL);
}
int
my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi)
{
HANDLE h;
int r;
memset(bhfi, 0, sizeof(*bhfi));
h = CreateFile(path, FILE_READ_ATTRIBUTES, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE)
return (0);
r = GetFileInformationByHandle(h, bhfi);
CloseHandle(h);
return (r);
}
#endif
#if defined(HAVE__CrtSetReportMode)
static void
invalid_parameter_handler(const wchar_t * expression,
const wchar_t * function, const wchar_t * file,
unsigned int line, uintptr_t pReserved)
{
/* nop */
}
#endif
/*
*
* OPTIONS FLAGS
*
*/
/* Enable core dump on failure. */
static int dump_on_failure = 0;
/* Default is to remove temp dirs and log data for successful tests. */
static int keep_temp_files = 0;
/* Default is to just report pass/fail for each test. */
static int verbosity = 0;
#define VERBOSITY_SUMMARY_ONLY -1 /* -q */
#define VERBOSITY_PASSFAIL 0 /* Default */
#define VERBOSITY_LIGHT_REPORT 1 /* -v */
#define VERBOSITY_FULL 2 /* -vv */
/* A few places generate even more output for verbosity > VERBOSITY_FULL,
* mostly for debugging the test harness itself. */
/* Cumulative count of assertion failures. */
static int failures = 0;
/* Cumulative count of reported skips. */
static int skips = 0;
/* Cumulative count of assertions checked. */
static int assertions = 0;
/* Directory where uuencoded reference files can be found. */
static const char *refdir;
/*
* Report log information selectively to console and/or disk log.
*/
static int log_console = 0;
static FILE *logfile;
static void
vlogprintf(const char *fmt, va_list ap)
{
#ifdef va_copy
va_list lfap;
va_copy(lfap, ap);
#endif
if (log_console)
vfprintf(stdout, fmt, ap);
if (logfile != NULL)
#ifdef va_copy
vfprintf(logfile, fmt, lfap);
va_end(lfap);
#else
vfprintf(logfile, fmt, ap);
#endif
}
static void
logprintf(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vlogprintf(fmt, ap);
va_end(ap);
}
/* Set up a message to display only if next assertion fails. */
static char msgbuff[4096];
static const char *msg, *nextmsg;
void
failure(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vsprintf(msgbuff, fmt, ap);
va_end(ap);
nextmsg = msgbuff;
}
/*
* Copy arguments into file-local variables.
* This was added to permit vararg assert() functions without needing
* variadic wrapper macros. Turns out that the vararg capability is almost
* never used, so almost all of the vararg assertions can be simplified
* by removing the vararg capability and reworking the wrapper macro to
* pass __FILE__, __LINE__ directly into the function instead of using
* this hook. I suspect this machinery is used so rarely that we
* would be better off just removing it entirely. That would simplify
* the code here noticably.
*/
static const char *test_filename;
static int test_line;
static void *test_extra;
void assertion_setup(const char *filename, int line)
{
test_filename = filename;
test_line = line;
}
/* Called at the beginning of each assert() function. */
static void
assertion_count(const char *file, int line)
{
(void)file; /* UNUSED */
(void)line; /* UNUSED */
++assertions;
/* Proper handling of "failure()" message. */
msg = nextmsg;
nextmsg = NULL;
/* Uncomment to print file:line after every assertion.
* Verbose, but occasionally useful in tracking down crashes. */
/* printf("Checked %s:%d\n", file, line); */
}
/*
* For each test source file, we remember how many times each
* assertion was reported. Cleared before each new test,
* used by test_summarize().
*/
static struct line {
int count;
int skip;
} failed_lines[10000];
/* Count this failure, setup up log destination and handle initial report. */
static void
failure_start(const char *filename, int line, const char *fmt, ...)
{
va_list ap;
/* Record another failure for this line. */
++failures;
/* test_filename = filename; */
failed_lines[line].count++;
/* Determine whether to log header to console. */
switch (verbosity) {
case VERBOSITY_FULL:
log_console = 1;
break;
case VERBOSITY_LIGHT_REPORT:
log_console = (failed_lines[line].count < 2);
break;
default:
log_console = 0;
}
/* Log file:line header for this failure */
va_start(ap, fmt);
#if _MSC_VER
logprintf("%s(%d): ", filename, line);
#else
logprintf("%s:%d: ", filename, line);
#endif
vlogprintf(fmt, ap);
va_end(ap);
logprintf("\n");
if (msg != NULL && msg[0] != '\0') {
logprintf(" Description: %s\n", msg);
msg = NULL;
}
/* Determine whether to log details to console. */
if (verbosity == VERBOSITY_LIGHT_REPORT)
log_console = 0;
}
/* Complete reporting of failed tests. */
/*
* The 'extra' hook here is used by libarchive to include libarchive
* error messages with assertion failures. It could also be used
* to add strerror() output, for example. Just define the EXTRA_DUMP()
* macro appropriately.
*/
static void
failure_finish(void *extra)
{
(void)extra; /* UNUSED (maybe) */
#ifdef EXTRA_DUMP
if (extra != NULL)
logprintf(" detail: %s\n", EXTRA_DUMP(extra));
#endif
if (dump_on_failure) {
fprintf(stderr,
" *** forcing core dump so failure can be debugged ***\n");
*(char *)(NULL) = 0;
exit(1);
}
}
/* Inform user that we're skipping some checks. */
void
test_skipping(const char *fmt, ...)
{
char buff[1024];
va_list ap;
va_start(ap, fmt);
vsprintf(buff, fmt, ap);
va_end(ap);
/* failure_start() isn't quite right, but is awfully convenient. */
failure_start(test_filename, test_line, "SKIPPING: %s", buff);
--failures; /* Undo failures++ in failure_start() */
/* Don't failure_finish() here. */
/* Mark as skip, so doesn't count as failed test. */
failed_lines[test_line].skip = 1;
++skips;
}
/*
*
* ASSERTIONS
*
*/
/* Generic assert() just displays the failed condition. */
int
assertion_assert(const char *file, int line, int value,
const char *condition, void *extra)
{
assertion_count(file, line);
if (!value) {
failure_start(file, line, "Assertion failed: %s", condition);
failure_finish(extra);
}
return (value);
}
/* chdir() and report any errors */
int
assertion_chdir(const char *file, int line, const char *pathname)
{
assertion_count(file, line);
if (chdir(pathname) == 0)
return (1);
failure_start(file, line, "chdir(\"%s\")", pathname);
failure_finish(NULL);
return (0);
}
/* Verify two integers are equal. */
int
assertion_equal_int(const char *file, int line,
long long v1, const char *e1, long long v2, const char *e2, void *extra)
{
assertion_count(file, line);
if (v1 == v2)
return (1);
failure_start(file, line, "%s != %s", e1, e2);
logprintf(" %s=%lld (0x%llx, 0%llo)\n", e1, v1, v1, v1);
logprintf(" %s=%lld (0x%llx, 0%llo)\n", e2, v2, v2, v2);
failure_finish(extra);
return (0);
}
static void strdump(const char *e, const char *p)
{
const char *q = p;
logprintf(" %s = ", e);
if (p == NULL) {
logprintf("NULL");
return;
}
logprintf("\"");
while (*p != '\0') {
unsigned int c = 0xff & *p++;
switch (c) {
case '\a': printf("\a"); break;
case '\b': printf("\b"); break;
case '\n': printf("\n"); break;
case '\r': printf("\r"); break;
default:
if (c >= 32 && c < 127)
logprintf("%c", c);
else
logprintf("\\x%02X", c);
}
}
logprintf("\"");
logprintf(" (length %d)\n", q == NULL ? -1 : (int)strlen(q));
}
/* Verify two strings are equal, dump them if not. */
int
assertion_equal_string(const char *file, int line,
const char *v1, const char *e1,
const char *v2, const char *e2,
void *extra)
{
assertion_count(file, line);
if (v1 == v2 || (v1 != NULL && v2 != NULL && strcmp(v1, v2) == 0))
return (1);
failure_start(file, line, "%s != %s", e1, e2);
strdump(e1, v1);
strdump(e2, v2);
failure_finish(extra);
return (0);
}
static void
wcsdump(const char *e, const wchar_t *w)
{
logprintf(" %s = ", e);
if (w == NULL) {
logprintf("(null)");
return;
}
logprintf("\"");
while (*w != L'\0') {
unsigned int c = *w++;
if (c >= 32 && c < 127)
logprintf("%c", c);
else if (c < 256)
logprintf("\\x%02X", c);
else if (c < 0x10000)
logprintf("\\u%04X", c);
else
logprintf("\\U%08X", c);
}
logprintf("\"\n");
}
/* Verify that two wide strings are equal, dump them if not. */
int
assertion_equal_wstring(const char *file, int line,
const wchar_t *v1, const char *e1,
const wchar_t *v2, const char *e2,
void *extra)
{
assertion_count(file, line);
if (v1 == v2 || wcscmp(v1, v2) == 0)
return (1);
failure_start(file, line, "%s != %s", e1, e2);
wcsdump(e1, v1);
wcsdump(e2, v2);
failure_finish(extra);
return (0);
}
/*
* Pretty standard hexdump routine. As a bonus, if ref != NULL, then
* any bytes in p that differ from ref will be highlighted with '_'
* before and after the hex value.
*/
static void
hexdump(const char *p, const char *ref, size_t l, size_t offset)
{
size_t i, j;
char sep;
if (p == NULL) {
logprintf("(null)\n");
return;
}
for(i=0; i < l; i+=16) {
logprintf("%04x", (unsigned)(i + offset));
sep = ' ';
for (j = 0; j < 16 && i + j < l; j++) {
if (ref != NULL && p[i + j] != ref[i + j])
sep = '_';
logprintf("%c%02x", sep, 0xff & (int)p[i+j]);
if (ref != NULL && p[i + j] == ref[i + j])
sep = ' ';
}
for (; j < 16; j++) {
logprintf("%c ", sep);
sep = ' ';
}
logprintf("%c", sep);
for (j=0; j < 16 && i + j < l; j++) {
int c = p[i + j];
if (c >= ' ' && c <= 126)
logprintf("%c", c);
else
logprintf(".");
}
logprintf("\n");
}
}
/* Verify that two blocks of memory are the same, display the first
* block of differences if they're not. */
int
assertion_equal_mem(const char *file, int line,
const void *_v1, const char *e1,
const void *_v2, const char *e2,
size_t l, const char *ld, void *extra)
{
const char *v1 = (const char *)_v1;
const char *v2 = (const char *)_v2;
size_t offset;
assertion_count(file, line);
if (v1 == v2 || (v1 != NULL && v2 != NULL && memcmp(v1, v2, l) == 0))
return (1);
failure_start(file, line, "%s != %s", e1, e2);
logprintf(" size %s = %d\n", ld, (int)l);
/* Dump 48 bytes (3 lines) so that the first difference is
* in the second line. */
offset = 0;
while (l > 64 && memcmp(v1, v2, 32) == 0) {
/* Two lines agree, so step forward one line. */
v1 += 16;
v2 += 16;
l -= 16;
offset += 16;
}
logprintf(" Dump of %s\n", e1);
hexdump(v1, v2, l < 64 ? l : 64, offset);
logprintf(" Dump of %s\n", e2);
hexdump(v2, v1, l < 64 ? l : 64, offset);
logprintf("\n");
failure_finish(extra);
return (0);
}
/* Verify that the named file exists and is empty. */
int
assertion_empty_file(const char *f1fmt, ...)
{
char buff[1024];
char f1[1024];
struct stat st;
va_list ap;
ssize_t s;
FILE *f;
assertion_count(test_filename, test_line);
va_start(ap, f1fmt);
vsprintf(f1, f1fmt, ap);
va_end(ap);
if (stat(f1, &st) != 0) {
failure_start(test_filename, test_line, "Stat failed: %s", f1);
failure_finish(NULL);
return (0);
}
if (st.st_size == 0)
return (1);
failure_start(test_filename, test_line, "File should be empty: %s", f1);
logprintf(" File size: %d\n", (int)st.st_size);
logprintf(" Contents:\n");
f = fopen(f1, "rb");
if (f == NULL) {
logprintf(" Unable to open %s\n", f1);
} else {
s = ((off_t)sizeof(buff) < st.st_size) ?
(ssize_t)sizeof(buff) : (ssize_t)st.st_size;
s = fread(buff, 1, s, f);
hexdump(buff, NULL, s, 0);
fclose(f);
}
failure_finish(NULL);
return (0);
}
/* Verify that the named file exists and is not empty. */
int
assertion_non_empty_file(const char *f1fmt, ...)
{
char f1[1024];
struct stat st;
va_list ap;
assertion_count(test_filename, test_line);
va_start(ap, f1fmt);
vsprintf(f1, f1fmt, ap);
va_end(ap);
if (stat(f1, &st) != 0) {
failure_start(test_filename, test_line, "Stat failed: %s", f1);
failure_finish(NULL);
return (0);
}
if (st.st_size == 0) {
failure_start(test_filename, test_line, "File empty: %s", f1);
failure_finish(NULL);
return (0);
}
return (1);
}
/* Verify that two files have the same contents. */
/* TODO: hexdump the first bytes that actually differ. */
int
assertion_equal_file(const char *fn1, const char *f2pattern, ...)
{
char fn2[1024];
va_list ap;
char buff1[1024];
char buff2[1024];
FILE *f1, *f2;
int n1, n2;
assertion_count(test_filename, test_line);
va_start(ap, f2pattern);
vsprintf(fn2, f2pattern, ap);
va_end(ap);
f1 = fopen(fn1, "rb");
f2 = fopen(fn2, "rb");
for (;;) {
n1 = fread(buff1, 1, sizeof(buff1), f1);
n2 = fread(buff2, 1, sizeof(buff2), f2);
if (n1 != n2)
break;
if (n1 == 0 && n2 == 0) {
fclose(f1);
fclose(f2);
return (1);
}
if (memcmp(buff1, buff2, n1) != 0)
break;
}
fclose(f1);
fclose(f2);
failure_start(test_filename, test_line, "Files not identical");
logprintf(" file1=\"%s\"\n", fn1);
logprintf(" file2=\"%s\"\n", fn2);
failure_finish(test_extra);
return (0);
}
/* Verify that the named file does exist. */
int
assertion_file_exists(const char *fpattern, ...)
{
char f[1024];
va_list ap;
assertion_count(test_filename, test_line);
va_start(ap, fpattern);
vsprintf(f, fpattern, ap);
va_end(ap);
#if defined(_WIN32) && !defined(__CYGWIN__)
if (!_access(f, 0))
return (1);
#else
if (!access(f, F_OK))
return (1);
#endif
failure_start(test_filename, test_line, "File should exist: %s", f);
failure_finish(test_extra);
return (0);
}
/* Verify that the named file doesn't exist. */
int
assertion_file_not_exists(const char *fpattern, ...)
{
char f[1024];
va_list ap;
assertion_count(test_filename, test_line);
va_start(ap, fpattern);
vsprintf(f, fpattern, ap);
va_end(ap);
#if defined(_WIN32) && !defined(__CYGWIN__)
if (_access(f, 0))
return (1);
#else
if (access(f, F_OK))
return (1);
#endif
failure_start(test_filename, test_line, "File should not exist: %s", f);
failure_finish(test_extra);
return (0);
}
/* Compare the contents of a file to a block of memory. */
int
assertion_file_contents(const void *buff, int s, const char *fpattern, ...)
{
char fn[1024];
va_list ap;
char *contents;
FILE *f;
int n;
assertion_count(test_filename, test_line);
va_start(ap, fpattern);
vsprintf(fn, fpattern, ap);
va_end(ap);
f = fopen(fn, "rb");
if (f == NULL) {
failure_start(test_filename, test_line,
"File should exist: %s", fn);
failure_finish(test_extra);
return (0);
}
contents = malloc(s * 2);
n = fread(contents, 1, s * 2, f);
fclose(f);
if (n == s && memcmp(buff, contents, s) == 0) {
free(contents);
return (1);
}
failure_start(test_filename, test_line, "File contents don't match");
logprintf(" file=\"%s\"\n", fn);
if (n > 0)
hexdump(contents, buff, n > 512 ? 512 : n, 0);
else {
logprintf(" File empty, contents should be:\n");
hexdump(buff, NULL, s > 512 ? 512 : n, 0);
}
failure_finish(test_extra);
free(contents);
return (0);
}
/* Check the contents of a text file, being tolerant of line endings. */
int
assertion_text_file_contents(const char *buff, const char *fn)
{
char *contents;
const char *btxt, *ftxt;
FILE *f;
int n, s;
assertion_count(test_filename, test_line);
f = fopen(fn, "r");
if (f == NULL) {
failure_start(test_filename, test_line,
"File doesn't exist: %s", fn);
failure_finish(test_extra);
return (0);
}
s = strlen(buff);
contents = malloc(s * 2 + 128);
n = fread(contents, 1, s * 2 + 128 - 1, f);
if (n >= 0)
contents[n] = '\0';
fclose(f);
/* Compare texts. */
btxt = buff;
ftxt = (const char *)contents;
while (*btxt != '\0' && *ftxt != '\0') {
if (*btxt == *ftxt) {
++btxt;
++ftxt;
continue;
}
if (btxt[0] == '\n' && ftxt[0] == '\r' && ftxt[1] == '\n') {
/* Pass over different new line characters. */
++btxt;
ftxt += 2;
continue;
}
break;
}
if (*btxt == '\0' && *ftxt == '\0') {
free(contents);
return (1);
}
failure_start(test_filename, test_line, "Contents don't match");
logprintf(" file=\"%s\"\n", fn);
if (n > 0)
hexdump(contents, buff, n, 0);
else {
logprintf(" File empty, contents should be:\n");
hexdump(buff, NULL, s, 0);
}
failure_finish(test_extra);
free(contents);
return (0);
}
/* Test that two paths point to the same file. */
/* As a side-effect, asserts that both files exist. */
static int
is_hardlink(const char *file, int line,
const char *path1, const char *path2)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
BY_HANDLE_FILE_INFORMATION bhfi1, bhfi2;
int r;
assertion_count(file, line);
r = my_GetFileInformationByName(path1, &bhfi1);
if (r == 0) {
failure_start(file, line, "File %s can't be inspected?", path1);
failure_finish(NULL);
return (0);
}
r = my_GetFileInformationByName(path2, &bhfi2);
if (r == 0) {
failure_start(file, line, "File %s can't be inspected?", path2);
failure_finish(NULL);
return (0);
}
return (bhfi1.dwVolumeSerialNumber == bhfi2.dwVolumeSerialNumber
&& bhfi1.nFileIndexHigh == bhfi2.nFileIndexHigh
&& bhfi1.nFileIndexLow == bhfi2.nFileIndexLow);
#else
struct stat st1, st2;
int r;
assertion_count(file, line);
r = lstat(path1, &st1);
if (r != 0) {
failure_start(file, line, "File should exist: %s", path1);
failure_finish(NULL);
return (0);
}
r = lstat(path2, &st2);
if (r != 0) {
failure_start(file, line, "File should exist: %s", path2);
failure_finish(NULL);
return (0);
}
return (st1.st_ino == st2.st_ino && st1.st_dev == st2.st_dev);
#endif
}
int
assertion_is_hardlink(const char *file, int line,
const char *path1, const char *path2)
{
if (is_hardlink(file, line, path1, path2))
return (1);
failure_start(file, line,
"Files %s and %s are not hardlinked", path1, path2);
failure_finish(NULL);
return (0);
}
int
assertion_is_not_hardlink(const char *file, int line,
const char *path1, const char *path2)
{
if (!is_hardlink(file, line, path1, path2))
return (1);
failure_start(file, line,
"Files %s and %s should not be hardlinked", path1, path2);
failure_finish(NULL);
return (0);
}
/* Verify a/b/mtime of 'pathname'. */
/* If 'recent', verify that it's within last 10 seconds. */
static int
assertion_file_time(const char *file, int line,
const char *pathname, long t, long nsec, char type, int recent)
{
long long filet, filet_nsec;
int r;
#if defined(_WIN32) && !defined(__CYGWIN__)
#define EPOC_TIME (116444736000000000ULL)
FILETIME ftime, fbirthtime, fatime, fmtime;
ULARGE_INTEGER wintm;
HANDLE h;
ftime.dwLowDateTime = 0;
ftime.dwHighDateTime = 0;
assertion_count(file, line);
h = CreateFile(pathname, FILE_READ_ATTRIBUTES, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE) {
failure_start(file, line, "Can't access %s\n", pathname);
failure_finish(NULL);
return (0);
}
r = GetFileTime(h, &fbirthtime, &fatime, &fmtime);
switch (type) {
case 'a': ftime = fatime; break;
case 'b': ftime = fbirthtime; break;
case 'm': ftime = fmtime; break;
}
CloseHandle(h);
if (r == 0) {
failure_start(file, line, "Can't GetFileTime %s\n", pathname);
failure_finish(NULL);
return (0);
}
wintm.LowPart = ftime.dwLowDateTime;
wintm.HighPart = ftime.dwHighDateTime;
filet = (wintm.QuadPart - EPOC_TIME) / 10000000;
filet_nsec = ((wintm.QuadPart - EPOC_TIME) % 10000000) * 100;
nsec = (nsec / 100) * 100; /* Round the request */
#else
struct stat st;
assertion_count(file, line);
r = lstat(pathname, &st);
if (r != 0) {
failure_start(file, line, "Can't stat %s\n", pathname);
failure_finish(NULL);
return (0);
}
switch (type) {
case 'a': filet = st.st_atime; break;
case 'm': filet = st.st_mtime; break;
case 'b': filet = 0; break;
default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type);
exit(1);
}
#if defined(__FreeBSD__)
switch (type) {
case 'a': filet_nsec = st.st_atimespec.tv_nsec; break;
case 'b': filet = st.st_birthtime;
filet_nsec = st.st_birthtimespec.tv_nsec; break;
case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break;
default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type);
exit(1);
}
/* FreeBSD generally only stores to microsecond res, so round. */
filet_nsec = (filet_nsec / 1000) * 1000;
nsec = (nsec / 1000) * 1000;
#else
filet_nsec = nsec = 0; /* Generic POSIX only has whole seconds. */
if (type == 'b') return (1); /* Generic POSIX doesn't have birthtime */
#if defined(__HAIKU__)
if (type == 'a') return (1); /* Haiku doesn't have atime. */
#endif
#endif
#endif
if (recent) {
/* Check that requested time is up-to-date. */
time_t now = time(NULL);
if (filet < now - 10 || filet > now + 1) {
failure_start(file, line,
"File %s has %ctime %ld, %ld seconds ago\n",
pathname, type, filet, now - filet);
failure_finish(NULL);
return (0);
}
} else if (filet != t || filet_nsec != nsec) {
failure_start(file, line,
"File %s has %ctime %ld.%09ld, expected %ld.%09ld",
pathname, type, filet, filet_nsec, t, nsec);
failure_finish(NULL);
return (0);
}
return (1);
}
/* Verify atime of 'pathname'. */
int
assertion_file_atime(const char *file, int line,
const char *pathname, long t, long nsec)
{
return assertion_file_time(file, line, pathname, t, nsec, 'a', 0);
}
/* Verify atime of 'pathname' is up-to-date. */
int
assertion_file_atime_recent(const char *file, int line, const char *pathname)
{
return assertion_file_time(file, line, pathname, 0, 0, 'a', 1);
}
/* Verify birthtime of 'pathname'. */
int
assertion_file_birthtime(const char *file, int line,
const char *pathname, long t, long nsec)
{
return assertion_file_time(file, line, pathname, t, nsec, 'b', 0);
}
/* Verify birthtime of 'pathname' is up-to-date. */
int
assertion_file_birthtime_recent(const char *file, int line,
const char *pathname)
{
return assertion_file_time(file, line, pathname, 0, 0, 'b', 1);
}
/* Verify mtime of 'pathname'. */
int
assertion_file_mtime(const char *file, int line,
const char *pathname, long t, long nsec)
{
return assertion_file_time(file, line, pathname, t, nsec, 'm', 0);
}
/* Verify mtime of 'pathname' is up-to-date. */
int
assertion_file_mtime_recent(const char *file, int line, const char *pathname)
{
return assertion_file_time(file, line, pathname, 0, 0, 'm', 1);
}
/* Verify number of links to 'pathname'. */
int
assertion_file_nlinks(const char *file, int line,
const char *pathname, int nlinks)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
BY_HANDLE_FILE_INFORMATION bhfi;
int r;
assertion_count(file, line);
r = my_GetFileInformationByName(pathname, &bhfi);
if (r != 0 && bhfi.nNumberOfLinks == (DWORD)nlinks)
return (1);
failure_start(file, line, "File %s has %d links, expected %d",
pathname, bhfi.nNumberOfLinks, nlinks);
failure_finish(NULL);
return (0);
#else
struct stat st;
int r;
assertion_count(file, line);
r = lstat(pathname, &st);
if (r == 0 && st.st_nlink == nlinks)
return (1);
failure_start(file, line, "File %s has %d links, expected %d",
pathname, st.st_nlink, nlinks);
failure_finish(NULL);
return (0);
#endif
}
/* Verify size of 'pathname'. */
int
assertion_file_size(const char *file, int line, const char *pathname, long size)
{
int64_t filesize;
int r;
assertion_count(file, line);
#if defined(_WIN32) && !defined(__CYGWIN__)
{
BY_HANDLE_FILE_INFORMATION bhfi;
r = !my_GetFileInformationByName(pathname, &bhfi);
filesize = ((int64_t)bhfi.nFileSizeHigh << 32) + bhfi.nFileSizeLow;
}
#else
{
struct stat st;
r = lstat(pathname, &st);
filesize = st.st_size;
}
#endif
if (r == 0 && filesize == size)
return (1);
failure_start(file, line, "File %s has size %ld, expected %ld",
pathname, (long)filesize, (long)size);
failure_finish(NULL);
return (0);
}
/* Assert that 'pathname' is a dir. If mode >= 0, verify that too. */
int
assertion_is_dir(const char *file, int line, const char *pathname, int mode)
{
struct stat st;
int r;
#if defined(_WIN32) && !defined(__CYGWIN__)
(void)mode; /* UNUSED */
#endif
assertion_count(file, line);
r = lstat(pathname, &st);
if (r != 0) {
failure_start(file, line, "Dir should exist: %s", pathname);
failure_finish(NULL);
return (0);
}
if (!S_ISDIR(st.st_mode)) {
failure_start(file, line, "%s is not a dir", pathname);
failure_finish(NULL);
return (0);
}
#if !defined(_WIN32) || defined(__CYGWIN__)
/* Windows doesn't handle permissions the same way as POSIX,
* so just ignore the mode tests. */
/* TODO: Can we do better here? */
if (mode >= 0 && mode != (st.st_mode & 07777)) {
failure_start(file, line, "Dir %s has wrong mode", pathname);
logprintf(" Expected: 0%3o\n", mode);
logprintf(" Found: 0%3o\n", st.st_mode & 07777);
failure_finish(NULL);
return (0);
}
#endif
return (1);
}
/* Verify that 'pathname' is a regular file. If 'mode' is >= 0,
* verify that too. */
int
assertion_is_reg(const char *file, int line, const char *pathname, int mode)
{
struct stat st;
int r;
#if defined(_WIN32) && !defined(__CYGWIN__)
(void)mode; /* UNUSED */
#endif
assertion_count(file, line);
r = lstat(pathname, &st);
if (r != 0 || !S_ISREG(st.st_mode)) {
failure_start(file, line, "File should exist: %s", pathname);
failure_finish(NULL);
return (0);
}
#if !defined(_WIN32) || defined(__CYGWIN__)
/* Windows doesn't handle permissions the same way as POSIX,
* so just ignore the mode tests. */
/* TODO: Can we do better here? */
if (mode >= 0 && mode != (st.st_mode & 07777)) {
failure_start(file, line, "File %s has wrong mode", pathname);
logprintf(" Expected: 0%3o\n", mode);
logprintf(" Found: 0%3o\n", st.st_mode & 07777);
failure_finish(NULL);
return (0);
}
#endif
return (1);
}
/* Check whether 'pathname' is a symbolic link. If 'contents' is
* non-NULL, verify that the symlink has those contents. */
static int
is_symlink(const char *file, int line,
const char *pathname, const char *contents)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
(void)pathname; /* UNUSED */
(void)contents; /* UNUSED */
assertion_count(file, line);
/* Windows sort-of has real symlinks, but they're only usable
* by privileged users and are crippled even then, so there's
* really not much point in bothering with this. */
return (0);
#else
char buff[300];
struct stat st;
ssize_t linklen;
int r;
assertion_count(file, line);
r = lstat(pathname, &st);
if (r != 0) {
failure_start(file, line,
"Symlink should exist: %s", pathname);
failure_finish(NULL);
return (0);
}
if (!S_ISLNK(st.st_mode))
return (0);
if (contents == NULL)
return (1);
linklen = readlink(pathname, buff, sizeof(buff));
if (linklen < 0) {
failure_start(file, line, "Can't read symlink %s", pathname);
failure_finish(NULL);
return (0);
}
buff[linklen] = '\0';
if (strcmp(buff, contents) != 0)
return (0);
return (1);
#endif
}
/* Assert that path is a symlink that (optionally) contains contents. */
int
assertion_is_symlink(const char *file, int line,
const char *path, const char *contents)
{
if (is_symlink(file, line, path, contents))
return (1);
if (contents)
failure_start(file, line, "File %s is not a symlink to %s",
path, contents);
else
failure_start(file, line, "File %s is not a symlink", path);
failure_finish(NULL);
return (0);
}
/* Create a directory and report any errors. */
int
assertion_make_dir(const char *file, int line, const char *dirname, int mode)
{
assertion_count(file, line);
#if defined(_WIN32) && !defined(__CYGWIN__)
(void)mode; /* UNUSED */
if (0 == _mkdir(dirname))
return (1);
#else
if (0 == mkdir(dirname, mode))
return (1);
#endif
failure_start(file, line, "Could not create directory %s", dirname);
failure_finish(NULL);
return(0);
}
/* Create a file with the specified contents and report any failures. */
int
assertion_make_file(const char *file, int line,
const char *path, int mode, const char *contents)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
/* TODO: Rework this to set file mode as well. */
FILE *f;
(void)mode; /* UNUSED */
assertion_count(file, line);
f = fopen(path, "wb");
if (f == NULL) {
failure_start(file, line, "Could not create file %s", path);
failure_finish(NULL);
return (0);
}
if (contents != NULL) {
if (strlen(contents)
!= fwrite(contents, 1, strlen(contents), f)) {
fclose(f);
failure_start(file, line,
"Could not write file %s", path);
failure_finish(NULL);
return (0);
}
}
fclose(f);
return (1);
#else
int fd;
assertion_count(file, line);
fd = open(path, O_CREAT | O_WRONLY, mode >= 0 ? mode : 0644);
if (fd < 0) {
failure_start(file, line, "Could not create %s", path);
failure_finish(NULL);
return (0);
}
if (contents != NULL) {
if ((ssize_t)strlen(contents)
!= write(fd, contents, strlen(contents))) {
close(fd);
failure_start(file, line, "Could not write to %s", path);
failure_finish(NULL);
return (0);
}
}
close(fd);
return (1);
#endif
}
/* Create a hardlink and report any failures. */
int
assertion_make_hardlink(const char *file, int line,
const char *newpath, const char *linkto)
{
int succeeded;
assertion_count(file, line);
#if defined(_WIN32) && !defined(__CYGWIN__)
succeeded = my_CreateHardLinkA(newpath, linkto);
#elif HAVE_LINK
succeeded = !link(linkto, newpath);
#else
succeeded = 0;
#endif
if (succeeded)
return (1);
failure_start(file, line, "Could not create hardlink");
logprintf(" New link: %s\n", newpath);
logprintf(" Old name: %s\n", linkto);
failure_finish(NULL);
return(0);
}
/* Create a symlink and report any failures. */
int
assertion_make_symlink(const char *file, int line,
const char *newpath, const char *linkto)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
int targetIsDir = 0; /* TODO: Fix this */
assertion_count(file, line);
if (my_CreateSymbolicLinkA(newpath, linkto, targetIsDir))
return (1);
#elif HAVE_SYMLINK
assertion_count(file, line);
if (0 == symlink(linkto, newpath))
return (1);
#endif
failure_start(file, line, "Could not create symlink");
logprintf(" New link: %s\n", newpath);
logprintf(" Old name: %s\n", linkto);
failure_finish(NULL);
return(0);
}
/* Set umask, report failures. */
int
assertion_umask(const char *file, int line, int mask)
{
assertion_count(file, line);
(void)file; /* UNUSED */
(void)line; /* UNUSED */
umask(mask);
return (1);
}
/*
*
* UTILITIES for use by tests.
*
*/
/*
* Check whether platform supports symlinks. This is intended
* for tests to use in deciding whether to bother testing symlink
* support; if the platform doesn't support symlinks, there's no point
* in checking whether the program being tested can create them.
*
* Note that the first time this test is called, we actually go out to
* disk to create and verify a symlink. This is necessary because
* symlink support is actually a property of a particular filesystem
* and can thus vary between directories on a single system. After
* the first call, this returns the cached result from memory, so it's
* safe to call it as often as you wish.
*/
int
canSymlink(void)
{
/* Remember the test result */
static int value = 0, tested = 0;
if (tested)
return (value);
++tested;
assertion_make_file(__FILE__, __LINE__, "canSymlink.0", 0644, "a");
/* Note: Cygwin has its own symlink() emulation that does not
* use the Win32 CreateSymbolicLink() function. */
#if defined(_WIN32) && !defined(__CYGWIN__)
value = my_CreateSymbolicLinkA("canSymlink.1", "canSymlink.0", 0)
&& is_symlink(__FILE__, __LINE__, "canSymlink.1", "canSymlink.0");
#elif HAVE_SYMLINK
value = (0 == symlink("canSymlink.0", "canSymlink.1"))
&& is_symlink(__FILE__, __LINE__, "canSymlink.1","canSymlink.0");
#endif
return (value);
}
/*
* Can this platform run the gzip program?
*/
/* Platform-dependent options for hiding the output of a subcommand. */
#if defined(_WIN32) && !defined(__CYGWIN__)
static const char *redirectArgs = ">NUL 2>NUL"; /* Win32 cmd.exe */
#else
static const char *redirectArgs = ">/dev/null 2>/dev/null"; /* POSIX 'sh' */
#endif
int
canGzip(void)
{
static int tested = 0, value = 0;
if (!tested) {
tested = 1;
if (systemf("gzip -V %s", redirectArgs) == 0)
value = 1;
}
return (value);
}
/*
* Can this platform run the gunzip program?
*/
int
canGunzip(void)
{
static int tested = 0, value = 0;
if (!tested) {
tested = 1;
if (systemf("gunzip -V %s", redirectArgs) == 0)
value = 1;
}
return (value);
}
/*
* Sleep as needed; useful for verifying disk timestamp changes by
* ensuring that the wall-clock time has actually changed before we
* go back to re-read something from disk.
*/
void
sleepUntilAfter(time_t t)
{
while (t >= time(NULL))
#if defined(_WIN32) && !defined(__CYGWIN__)
Sleep(500);
#else
sleep(1);
#endif
}
/*
* Call standard system() call, but build up the command line using
* sprintf() conventions.
*/
int
systemf(const char *fmt, ...)
{
char buff[8192];
va_list ap;
int r;
va_start(ap, fmt);
vsprintf(buff, fmt, ap);
if (verbosity > VERBOSITY_FULL)
logprintf("Cmd: %s\n", buff);
r = system(buff);
va_end(ap);
return (r);
}
/*
* Slurp a file into memory for ease of comparison and testing.
* Returns size of file in 'sizep' if non-NULL, null-terminates
* data in memory for ease of use.
*/
char *
slurpfile(size_t * sizep, const char *fmt, ...)
{
char filename[8192];
struct stat st;
va_list ap;
char *p;
ssize_t bytes_read;
FILE *f;
int r;
va_start(ap, fmt);
vsprintf(filename, fmt, ap);
va_end(ap);
f = fopen(filename, "rb");
if (f == NULL) {
/* Note: No error; non-existent file is okay here. */
return (NULL);
}
r = fstat(fileno(f), &st);
if (r != 0) {
logprintf("Can't stat file %s\n", filename);
fclose(f);
return (NULL);
}
p = malloc((size_t)st.st_size + 1);
if (p == NULL) {
logprintf("Can't allocate %ld bytes of memory to read file %s\n",
(long int)st.st_size, filename);
fclose(f);
return (NULL);
}
bytes_read = fread(p, 1, (size_t)st.st_size, f);
if (bytes_read < st.st_size) {
logprintf("Can't read file %s\n", filename);
fclose(f);
free(p);
return (NULL);
}
p[st.st_size] = '\0';
if (sizep != NULL)
*sizep = (size_t)st.st_size;
fclose(f);
return (p);
}
/* Read a uuencoded file from the reference directory, decode, and
* write the result into the current directory. */
#define UUDECODE(c) (((c) - 0x20) & 0x3f)
void
extract_reference_file(const char *name)
{
char buff[1024];
FILE *in, *out;
sprintf(buff, "%s/%s.uu", refdir, name);
in = fopen(buff, "r");
failure("Couldn't open reference file %s", buff);
assert(in != NULL);
if (in == NULL)
return;
/* Read up to and including the 'begin' line. */
for (;;) {
if (fgets(buff, sizeof(buff), in) == NULL) {
/* TODO: This is a failure. */
return;
}
if (memcmp(buff, "begin ", 6) == 0)
break;
}
/* Now, decode the rest and write it. */
/* Not a lot of error checking here; the input better be right. */
out = fopen(name, "wb");
while (fgets(buff, sizeof(buff), in) != NULL) {
char *p = buff;
int bytes;
if (memcmp(buff, "end", 3) == 0)
break;
bytes = UUDECODE(*p++);
while (bytes > 0) {
int n = 0;
/* Write out 1-3 bytes from that. */
if (bytes > 0) {
n = UUDECODE(*p++) << 18;
n |= UUDECODE(*p++) << 12;
fputc(n >> 16, out);
--bytes;
}
if (bytes > 0) {
n |= UUDECODE(*p++) << 6;
fputc((n >> 8) & 0xFF, out);
--bytes;
}
if (bytes > 0) {
n |= UUDECODE(*p++);
fputc(n & 0xFF, out);
--bytes;
}
}
}
fclose(out);
fclose(in);
}
/*
*
* TEST management
*
*/
/*
* "list.h" is simply created by "grep DEFINE_TEST test_*.c"; it has
* a line like
* DEFINE_TEST(test_function)
* for each test.
*/
/* Use "list.h" to declare all of the test functions. */
#undef DEFINE_TEST
#define DEFINE_TEST(name) void name(void);
#include "list.h"
/* Use "list.h" to create a list of all tests (functions and names). */
#undef DEFINE_TEST
#define DEFINE_TEST(n) { n, #n, 0 },
struct { void (*func)(void); const char *name; int failures; } tests[] = {
#include "list.h"
};
/*
* Summarize repeated failures in the just-completed test.
*/
static void
test_summarize(const char *filename, int failed)
{
unsigned int i;
switch (verbosity) {
case VERBOSITY_SUMMARY_ONLY:
printf(failed ? "E" : ".");
fflush(stdout);
break;
case VERBOSITY_PASSFAIL:
printf(failed ? "FAIL\n" : "ok\n");
break;
}
log_console = (verbosity == VERBOSITY_LIGHT_REPORT);
for (i = 0; i < sizeof(failed_lines)/sizeof(failed_lines[0]); i++) {
if (failed_lines[i].count > 1 && !failed_lines[i].skip)
logprintf("%s:%d: Summary: Failed %d times\n",
filename, i, failed_lines[i].count);
}
/* Clear the failure history for the next file. */
memset(failed_lines, 0, sizeof(failed_lines));
}
/*
* Actually run a single test, with appropriate setup and cleanup.
*/
static int
test_run(int i, const char *tmpdir)
{
char logfilename[64];
int failures_before = failures;
int oldumask;
switch (verbosity) {
case VERBOSITY_SUMMARY_ONLY: /* No per-test reports at all */
break;
case VERBOSITY_PASSFAIL: /* rest of line will include ok/FAIL marker */
printf("%3d: %-50s", i, tests[i].name);
fflush(stdout);
break;
default: /* Title of test, details will follow */
printf("%3d: %s\n", i, tests[i].name);
}
/* Chdir to the top-level work directory. */
if (!assertChdir(tmpdir)) {
fprintf(stderr,
"ERROR: Can't chdir to top work dir %s\n", tmpdir);
exit(1);
}
/* Create a log file for this test. */
sprintf(logfilename, "%s.log", tests[i].name);
logfile = fopen(logfilename, "w");
fprintf(logfile, "%s\n\n", tests[i].name);
/* Chdir() to a work dir for this specific test. */
if (!assertMakeDir(tests[i].name, 0755)
|| !assertChdir(tests[i].name)) {
fprintf(stderr,
"ERROR: Can't chdir to work dir %s/%s\n",
tmpdir, tests[i].name);
exit(1);
}
/* Explicitly reset the locale before each test. */
setlocale(LC_ALL, "C");
/* Record the umask before we run the test. */
umask(oldumask = umask(0));
/*
* Run the actual test.
*/
(*tests[i].func)();
/*
* Clean up and report afterwards.
*/
/* Restore umask */
umask(oldumask);
/* Reset locale. */
setlocale(LC_ALL, "C");
/* Reset directory. */
if (!assertChdir(tmpdir)) {
fprintf(stderr, "ERROR: Couldn't chdir to temp dir %s\n",
tmpdir);
exit(1);
}
/* Report per-test summaries. */
tests[i].failures = failures - failures_before;
test_summarize(test_filename, tests[i].failures);
/* Close the per-test log file. */
fclose(logfile);
logfile = NULL;
/* If there were no failures, we can remove the work dir and logfile. */
if (tests[i].failures == 0) {
if (!keep_temp_files && assertChdir(tmpdir)) {
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Make sure not to leave empty directories.
* Sometimes a processing of closing files used by tests
* is not done, then rmdir will be failed and it will
* leave a empty test directory. So we should wait a few
* seconds and retry rmdir. */
int r, t;
for (t = 0; t < 10; t++) {
if (t > 0)
Sleep(1000);
r = systemf("rmdir /S /Q %s", tests[i].name);
if (r == 0)
break;
}
systemf("del %s", logfilename);
#else
systemf("rm -rf %s", tests[i].name);
systemf("rm %s", logfilename);
#endif
}
}
/* Return appropriate status. */
return (tests[i].failures);
}
/*
*
*
* MAIN and support routines.
*
*
*/
static void
usage(const char *program)
{
static const int limit = sizeof(tests) / sizeof(tests[0]);
int i;
printf("Usage: %s [options] <test> <test> ...\n", program);
printf("Default is to run all tests.\n");
printf("Otherwise, specify the numbers of the tests you wish to run.\n");
printf("Options:\n");
printf(" -d Dump core after any failure, for debugging.\n");
printf(" -k Keep all temp files.\n");
printf(" Default: temp files for successful tests deleted.\n");
#ifdef PROGRAM
printf(" -p <path> Path to executable to be tested.\n");
printf(" Default: path taken from " ENVBASE " environment variable.\n");
#endif
printf(" -q Quiet.\n");
printf(" -r <dir> Path to dir containing reference files.\n");
printf(" Default: Current directory.\n");
printf(" -v Verbose.\n");
printf("Available tests:\n");
for (i = 0; i < limit; i++)
printf(" %d: %s\n", i, tests[i].name);
exit(1);
}
static char *
get_refdir(const char *d)
{
char tried[512] = { '\0' };
char buff[128];
char *pwd, *p;
/* If a dir was specified, try that */
if (d != NULL) {
pwd = NULL;
snprintf(buff, sizeof(buff), "%s", d);
p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
if (p != NULL) goto success;
strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
goto failure;
}
/* Get the current dir. */
pwd = getcwd(NULL, 0);
while (pwd[strlen(pwd) - 1] == '\n')
pwd[strlen(pwd) - 1] = '\0';
/* Look for a known file. */
snprintf(buff, sizeof(buff), "%s", pwd);
p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
if (p != NULL) goto success;
strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
snprintf(buff, sizeof(buff), "%s/test", pwd);
p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
if (p != NULL) goto success;
strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
#if defined(LIBRARY)
snprintf(buff, sizeof(buff), "%s/%s/test", pwd, LIBRARY);
#else
snprintf(buff, sizeof(buff), "%s/%s/test", pwd, PROGRAM);
#endif
p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
if (p != NULL) goto success;
strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
if (memcmp(pwd, "/usr/obj", 8) == 0) {
snprintf(buff, sizeof(buff), "%s", pwd + 8);
p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
if (p != NULL) goto success;
strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
snprintf(buff, sizeof(buff), "%s/test", pwd + 8);
p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
if (p != NULL) goto success;
strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
}
failure:
printf("Unable to locate known reference file %s\n", KNOWNREF);
printf(" Checked following directories:\n%s\n", tried);
#if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG)
DebugBreak();
#endif
exit(1);
success:
free(p);
free(pwd);
return strdup(buff);
}
int
main(int argc, char **argv)
{
static const int limit = sizeof(tests) / sizeof(tests[0]);
int i, tests_run = 0, tests_failed = 0, option;
time_t now;
char *refdir_alloc = NULL;
const char *progname;
const char *tmp, *option_arg, *p;
char tmpdir[256];
char tmpdir_timestamp[256];
(void)argc; /* UNUSED */
#if defined(HAVE__CrtSetReportMode)
/* To stop to run the default invalid parameter handler. */
_set_invalid_parameter_handler(invalid_parameter_handler);
/* Disable annoying assertion message box. */
_CrtSetReportMode(_CRT_ASSERT, 0);
#endif
/*
* Name of this program, used to build root of our temp directory
* tree.
*/
progname = p = argv[0];
while (*p != '\0') {
/* Support \ or / dir separators for Windows compat. */
if (*p == '/' || *p == '\\')
progname = p + 1;
++p;
}
#ifdef PROGRAM
/* Get the target program from environment, if available. */
testprogfile = getenv(ENVBASE);
#endif
if (getenv("TMPDIR") != NULL)
tmp = getenv("TMPDIR");
else if (getenv("TMP") != NULL)
tmp = getenv("TMP");
else if (getenv("TEMP") != NULL)
tmp = getenv("TEMP");
else if (getenv("TEMPDIR") != NULL)
tmp = getenv("TEMPDIR");
else
tmp = "/tmp";
/* Allow -d to be controlled through the environment. */
if (getenv(ENVBASE "_DEBUG") != NULL)
dump_on_failure = 1;
/* Get the directory holding test files from environment. */
refdir = getenv(ENVBASE "_TEST_FILES");
/*
* Parse options, without using getopt(), which isn't available
* on all platforms.
*/
++argv; /* Skip program name */
while (*argv != NULL) {
if (**argv != '-')
break;
p = *argv++;
++p; /* Skip '-' */
while (*p != '\0') {
option = *p++;
option_arg = NULL;
/* If 'opt' takes an argument, parse that. */
if (option == 'p' || option == 'r') {
if (*p != '\0')
option_arg = p;
else if (*argv == NULL) {
fprintf(stderr,
"Option -%c requires argument.\n",
option);
usage(progname);
} else
option_arg = *argv++;
p = ""; /* End of this option word. */
}
/* Now, handle the option. */
switch (option) {
case 'd':
dump_on_failure = 1;
break;
case 'k':
keep_temp_files = 1;
break;
case 'p':
#ifdef PROGRAM
testprogfile = option_arg;
#else
usage(progname);
#endif
break;
case 'q':
verbosity--;
break;
case 'r':
refdir = option_arg;
break;
case 'v':
verbosity++;
break;
default:
usage(progname);
}
}
}
/*
* Sanity-check that our options make sense.
*/
#ifdef PROGRAM
if (testprogfile == NULL)
usage(progname);
{
char *testprg;
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Command.com sometimes rejects '/' separators. */
testprg = strdup(testprogfile);
for (i = 0; testprg[i] != '\0'; i++) {
if (testprg[i] == '/')
testprg[i] = '\\';
}
testprogfile = testprg;
#endif
/* Quote the name that gets put into shell command lines. */
testprg = malloc(strlen(testprogfile) + 3);
strcpy(testprg, "\"");
strcat(testprg, testprogfile);
strcat(testprg, "\"");
testprog = testprg;
}
#endif
/*
* Create a temp directory for the following tests.
* Include the time the tests started as part of the name,
* to make it easier to track the results of multiple tests.
*/
now = time(NULL);
for (i = 0; ; i++) {
strftime(tmpdir_timestamp, sizeof(tmpdir_timestamp),
"%Y-%m-%dT%H.%M.%S",
localtime(&now));
sprintf(tmpdir, "%s/%s.%s-%03d", tmp, progname,
tmpdir_timestamp, i);
if (assertMakeDir(tmpdir,0755))
break;
if (i >= 999) {
fprintf(stderr,
"ERROR: Unable to create temp directory %s\n",
tmpdir);
exit(1);
}
}
/*
* If the user didn't specify a directory for locating
* reference files, try to find the reference files in
* the "usual places."
*/
refdir = refdir_alloc = get_refdir(refdir);
/*
* Banner with basic information.
*/
printf("\n");
printf("If tests fail or crash, details will be in:\n");
printf(" %s\n", tmpdir);
printf("\n");
if (verbosity > VERBOSITY_SUMMARY_ONLY) {
printf("Reference files will be read from: %s\n", refdir);
#ifdef PROGRAM
printf("Running tests on: %s\n", testprog);
#endif
printf("Exercising: ");
fflush(stdout);
printf("%s\n", EXTRA_VERSION);
} else {
printf("Running ");
fflush(stdout);
}
/*
* Run some or all of the individual tests.
*/
if (*argv == NULL) {
/* Default: Run all tests. */
for (i = 0; i < limit; i++) {
if (test_run(i, tmpdir))
tests_failed++;
tests_run++;
}
} else {
while (*(argv) != NULL) {
if (**argv >= '0' && **argv <= '9') {
i = atoi(*argv);
if (i < 0 || i >= limit) {
printf("*** INVALID Test %s\n", *argv);
free(refdir_alloc);
usage(progname);
/* usage() never returns */
}
} else {
for (i = 0; i < limit; ++i) {
if (strcmp(*argv, tests[i].name) == 0)
break;
}
if (i >= limit) {
printf("*** INVALID Test ``%s''\n",
*argv);
free(refdir_alloc);
usage(progname);
/* usage() never returns */
}
}
if (test_run(i, tmpdir))
tests_failed++;
tests_run++;
argv++;
}
}
/*
* Report summary statistics.
*/
if (verbosity > VERBOSITY_SUMMARY_ONLY) {
printf("\n");
printf("Totals:\n");
printf(" Tests run: %8d\n", tests_run);
printf(" Tests failed: %8d\n", tests_failed);
printf(" Assertions checked:%8d\n", assertions);
printf(" Assertions failed: %8d\n", failures);
printf(" Skips reported: %8d\n", skips);
}
if (failures) {
printf("\n");
printf("Failing tests:\n");
for (i = 0; i < limit; ++i) {
if (tests[i].failures)
printf(" %d: %s (%d failures)\n", i,
tests[i].name, tests[i].failures);
}
printf("\n");
printf("Details for failing tests: %s\n", tmpdir);
printf("\n");
} else {
if (verbosity == VERBOSITY_SUMMARY_ONLY)
printf("\n");
printf("%d tests passed, no failures\n", tests_run);
}
free(refdir_alloc);
/* If the final tmpdir is empty, we can remove it. */
/* This should be the usual case when all tests succeed. */
assertChdir("..");
rmdir(tmpdir);
return (tests_failed ? 1 : 0);
}
|
52e41c56eaa8a1840630680a564d4bde81cf2c6a
|
b8906afecca06f48f2cd289a9997f670b26c4721
|
/platform/shared/shttpd/src/io_cgi.c
|
b41c6002525fe8d3f6690aa81c62a25540a1c865
|
[
"MIT",
"Beerware"
] |
permissive
|
rhomobile/rhodes
|
51bd88921c51bd618948f9a557de17fc297e7cc2
|
fc8409c9c281684a49d7ff6805ddc565de09a6d5
|
refs/heads/master
| 2023-09-01T17:45:36.149868
| 2023-08-31T20:56:06
| 2023-08-31T20:56:06
| 54,084
| 504
| 155
|
MIT
| 2023-09-12T00:14:29
| 2008-09-18T21:55:16
|
C
|
UTF-8
|
C
| false
| false
| 3,537
|
c
|
io_cgi.c
|
/*
* Copyright (c) 2004-2005 Sergey Lyubka <valenok@gmail.com>
* All rights reserved
*
* "THE BEER-WARE LICENSE" (Revision 42):
* Sergey Lyubka wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return.
*/
#include "defs.h"
static int
write_cgi(struct stream *stream, const void *buf, size_t len)
{
assert(stream->chan.sock != -1);
assert(stream->flags & FLAG_W);
return (send(stream->chan.sock, buf, len, 0));
}
static int
read_cgi(struct stream *stream, void *buf, size_t len)
{
struct headers parsed;
char status[4];
int n;
assert(stream->chan.sock != -1);
assert(stream->flags & FLAG_R);
stream->flags &= ~FLAG_DONT_CLOSE;
n = recv(stream->chan.sock, buf, len, 0);
if (stream->flags & FLAG_HEADERS_PARSED)
return (n);
if (n <= 0 && ERRNO != EWOULDBLOCK) {
_shttpd_send_server_error(stream->conn, 500,
"Error running CGI");
return (n);
}
/*
* CGI script may output Status: and Location: headers, which
* may alter the status code. Buffer in headers, parse
* them, send correct status code and then forward all data
* from CGI script back to the remote end.
* Reply line was alredy appended to the IO buffer in
* decide_what_to_do(), with blank status code.
*/
stream->flags |= FLAG_DONT_CLOSE;
io_inc_head(&stream->io, n);
stream->headers_len = _shttpd_get_headers_len(stream->io.buf,
stream->io.head);
if (stream->headers_len < 0) {
stream->flags &= ~FLAG_DONT_CLOSE;
_shttpd_send_server_error(stream->conn, 500,
"Bad headers sent");
_shttpd_elog(E_LOG, stream->conn,
"CGI script sent invalid headers: "
"[%.*s]", stream->io.head - CGI_REPLY_LEN,
stream->io.buf + CGI_REPLY_LEN);
return (0);
}
/*
* If we did not received full headers yet, we must not send any
* data read from the CGI back to the client. Suspend sending by
* setting tail = head, which tells that there is no data in IO buffer
*/
if (stream->headers_len == 0) {
stream->io.tail = stream->io.head;
return (0);
}
/* Received all headers. Set status code for the connection. */
(void) memset(&parsed, 0, sizeof(parsed));
_shttpd_parse_headers(stream->io.buf, stream->headers_len, &parsed);
stream->content_len = parsed.cl.v_big_int;
stream->conn->status = (int) parsed.status.v_big_int;
/* If script outputs 'Location:' header, set status code to 302 */
if (parsed.location.v_vec.len > 0)
stream->conn->status = 302;
/*
* If script did not output neither 'Location:' nor 'Status' headers,
* set the default status code 200, which means 'success'.
*/
if (stream->conn->status == 0)
stream->conn->status = 200;
/* Append the status line to the beginning of the output */
(void) _shttpd_snprintf(status,
sizeof(status), "%3d", stream->conn->status);
(void) memcpy(stream->io.buf + 9, status, 3);
DBG(("read_cgi: content len %lu status %s",
stream->content_len, status));
/* Next time, pass output directly back to the client */
assert((big_int_t) stream->headers_len <= stream->io.total);
stream->io.total -= stream->headers_len;
stream->io.tail = 0;
stream->flags |= FLAG_HEADERS_PARSED;
/* Return 0 because we've already shifted the head */
return (0);
}
static void
close_cgi(struct stream *stream)
{
assert(stream->chan.sock != -1);
(void) closesocket(stream->chan.sock);
}
const struct io_class _shttpd_io_cgi = {
"cgi",
read_cgi,
write_cgi,
close_cgi
};
|
eb380bd5c31a5a956c89ee387ba00734b73b41c4
|
1994b15441624ad5b7f484f007083986cd846b13
|
/cyclone_objects/binaries/control/prob.c
|
e6386e83e57a0f051a2c4a7ad1251b9dafd1d0f9
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
porres/pd-cyclone
|
7e7912d5d1a7ebe00e29a643c17ebcb6f50b3747
|
dfb7b8ad4dddde3ff3320d8d32baefbebdff3cf9
|
refs/heads/master
| 2023-09-03T20:28:51.715146
| 2023-08-30T00:03:45
| 2023-08-30T00:03:45
| 51,787,562
| 186
| 26
|
BSD-3-Clause
| 2023-08-30T00:03:46
| 2016-02-15T21:38:34
|
C
|
UTF-8
|
C
| false
| false
| 9,964
|
c
|
prob.c
|
/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
#include <stdio.h>
#include "m_pd.h"
#include <common/api.h>
#include "common/file.h"
#include "control/rand.h"
/* CHECKED: no preallocation. It looks like if new state-entries
were added to the list's head, and new transition-entries
were added to the sublist's head. No sorting of any kind. */
typedef struct _probtrans{
int tr_value; /* state (if a header trans), or suffix value (otherwise) */
int tr_count; /* (a total in case of a header trans) */
struct _probtrans *tr_suffix; /* header trans of a suffix state */
struct _probtrans *tr_nexttrans; /* next trans of this state */
struct _probtrans *tr_nextstate; /* header trans of a next state */
}t_probtrans;
typedef struct _prob{
t_object x_ob;
t_probtrans *x_translist;
t_probtrans *x_state;
t_probtrans *x_default;
int x_embedmode;
unsigned int x_seed;
t_outlet *x_bangout;
t_file *x_filehandle;
}t_prob;
static t_class *prob_class;
static t_probtrans *prob_findstate(t_prob *x, int value, int complain){
t_probtrans *state;
for(state = x->x_translist; state; state = state->tr_nextstate)
if(state->tr_value == value)
break;
if(!state && complain)
pd_error(x, "[prob]: no state %d", value); /* CHECKED */
return(state);
}
static void prob_update(t_prob *x){
t_probtrans *state;
char buf[64];
sys_vgui(" if {[winfo exists .%lx]} {\n", (unsigned long)x->x_filehandle);
sys_vgui(" .%lx.text delete 1.0 end\n", (unsigned long)x->x_filehandle);
sys_gui(" }\n");
for(state = x->x_translist; state; state = state->tr_nextstate){
t_probtrans *trans;
for(trans = state->tr_nexttrans; trans; trans = trans->tr_nexttrans){
sprintf(buf, "%d %d %d\n", state->tr_value, trans->tr_value, trans->tr_count);
editor_append(x->x_filehandle, buf);
}
}
}
static void prob_click(t_prob *x, t_floatarg xpos, t_floatarg ypos,
t_floatarg shift, t_floatarg ctrl, t_floatarg alt){ // CHECKED not available, LATER full editing
xpos = ypos = shift = ctrl = alt = 0;
t_probtrans *state;
char buf[64];
editor_open(x->x_filehandle, 0, 0);
for(state = x->x_translist; state; state = state->tr_nextstate){
t_probtrans *trans;
for(trans = state->tr_nexttrans; trans; trans = trans->tr_nexttrans){
sprintf(buf, "%d %d %d\n", state->tr_value, trans->tr_value, trans->tr_count);
editor_append(x->x_filehandle, buf);
}
}
sys_vgui(" if {[winfo exists .%lx]} {\n", (unsigned long)x->x_filehandle);
sys_vgui(" wm deiconify .%lx\n", (unsigned long)x->x_filehandle);
sys_vgui(" raise .%lx\n", (unsigned long)x->x_filehandle);
sys_vgui(" focus .%lx.text\n", (unsigned long)x->x_filehandle);
sys_gui(" }\n");
}
static void prob_embedhook(t_pd *z, t_binbuf *bb, t_symbol *bindsym){
t_prob *x = (t_prob *)z;
if(x->x_embedmode){
t_probtrans *pfx, *sfx;
for(pfx = x->x_translist; pfx; pfx = pfx->tr_nextstate)
for(sfx = pfx->tr_nexttrans; sfx; sfx = sfx->tr_nexttrans)
binbuf_addv(bb, "siii;", bindsym, pfx->tr_value, sfx->tr_value, sfx->tr_count);
binbuf_addv(bb, "ssi;", bindsym, gensym("embed"), 1);
if(x->x_default)
binbuf_addv(bb, "ssi;", bindsym, gensym("reset"),
x->x_default->tr_value);
};
obj_saveformat((t_object *)x, bb);
}
static void prob_embed(t_prob *x, t_floatarg f){
x->x_embedmode = ((int)f != 0);
}
static void prob_reset(t_prob *x, t_floatarg f){
int value = (int)f; /* CHECKED: float converted to int */
t_probtrans *state = prob_findstate(x, value, 1);
if(state){ /* CHECKED */
x->x_default = state;
/* CHECKED (sort of): */
if(!x->x_state->tr_nexttrans)
x->x_state = state;
}
}
static void prob_clear(t_prob *x){
t_probtrans *state, *nextstate;
for(state = x->x_translist; state; state = nextstate){
t_probtrans *trans, *nexttrans;
for(trans = state->tr_nexttrans; trans; trans = nexttrans){
nexttrans = trans->tr_nexttrans;
freebytes(trans, sizeof(*trans));
}
nextstate = state->tr_nextstate;
freebytes(state, sizeof(*state));
}
x->x_translist = 0;
x->x_state = 0;
x->x_default = 0; // CHECKED: default number is not kept
prob_update(x);
}
static void prob_list(t_prob *x, t_symbol *s, int ac, t_atom *av){
s = NULL;
int prefval, suffval, count;
if (ac == 3 && av->a_type == A_FLOAT
&& av[1].a_type == A_FLOAT && av[2].a_type == A_FLOAT
&& (prefval = (int)av->a_w.w_float) == av->a_w.w_float
&& (suffval = (int)av[1].a_w.w_float) == av[1].a_w.w_float
&& (count = (int)av[2].a_w.w_float) == av[2].a_w.w_float){
t_probtrans *prefix = prob_findstate(x, prefval, 0);
t_probtrans *suffix = prob_findstate(x, suffval, 0);
t_probtrans *trans;
if(prefix && suffix){
for(trans = prefix->tr_nexttrans; trans;
trans = trans->tr_nexttrans)
if(trans->tr_suffix == suffix)
break;
if(trans){ // transition already exists
prefix->tr_count += (count - trans->tr_count);
trans->tr_count = count;
return;
}
}
if(!prefix){
if(!(prefix = getbytes(sizeof(*prefix))))
return;
prefix->tr_value = prefval;
prefix->tr_count = 0;
prefix->tr_suffix = 0;
prefix->tr_nexttrans = 0;
prefix->tr_nextstate = x->x_translist;
x->x_translist = prefix;
if(suffval == prefval)
suffix = prefix;
}
if(!suffix){
if(!(suffix = getbytes(sizeof(*suffix))))
return;
suffix->tr_value = suffval;
suffix->tr_count = 0;
suffix->tr_suffix = 0;
suffix->tr_nexttrans = 0;
suffix->tr_nextstate = x->x_translist;
x->x_translist = suffix;
}
if((trans = getbytes(sizeof(*trans)))){
trans->tr_value = suffval;
trans->tr_count = count;
trans->tr_suffix = suffix;
trans->tr_nexttrans = prefix->tr_nexttrans;
trans->tr_nextstate = prefix->tr_nextstate;
prefix->tr_count += count;
prefix->tr_nexttrans = trans;
}
if(!x->x_state) /* CHECKED */
x->x_state = prefix; /* CHECKED */
prob_update(x);
}
else
pd_error(x, "[prob]: bad list message format"); /* CHECKED */
}
static void prob_dump(t_prob *x){ // CHECKED
t_probtrans *state;
post("transition probabilities:");
for(state = x->x_translist; state; state = state->tr_nextstate){
t_probtrans *trans;
for(trans = state->tr_nexttrans; trans; trans = trans->tr_nexttrans)
post(" from %3d to %3d: %d", state->tr_value, trans->tr_value, trans->tr_count);
post("total weights for state %d: %d", state->tr_value, state->tr_count);
}
}
static void prob_bang(t_prob *x){
if(x->x_state){ // no output after clear
int rnd = rand_int(&x->x_seed, x->x_state->tr_count);
t_probtrans *trans = x->x_state->tr_nexttrans;
if(trans){
for(trans = x->x_state->tr_nexttrans; trans; trans = trans->tr_nexttrans)
if((rnd -= trans->tr_count) < 0)
break;
if(trans){
t_probtrans *nextstate = trans->tr_suffix;
if(nextstate){
outlet_float(((t_object *)x)->ob_outlet, nextstate->tr_value);
x->x_state = nextstate;
}
else
pd_error(x, "[prob] bug; prob_bang: void suffix");
}
else
pd_error(x, "[prob] bug; prob_bang: search overflow");
}
else{
outlet_bang(x->x_bangout);
if(x->x_default) // CHECKED: stays at dead-end if no default
x->x_state = x->x_default;
}
}
}
static void prob_float(t_prob *x, t_float f){
int value = (int)f;
if(f == value){ // CHECKED
t_probtrans *state = prob_findstate(x, value, 1);
if(state) // CHECKED
x->x_state = state;
}
else
pd_error(x, "[prob]: doesn't understand \"noninteger float\"");
}
static void prob_free(t_prob *x){
prob_clear(x);
file_free(x->x_filehandle);
}
static void *prob_new(void){
t_prob *x = (t_prob *)pd_new(prob_class);
x->x_translist = 0;
x->x_state = 0;
x->x_default = 0;
x->x_embedmode = 0; // CHECKED
rand_seed(&x->x_seed, 0);
outlet_new((t_object *)x, &s_float);
x->x_bangout = outlet_new((t_object *)x, &s_bang);
x->x_filehandle = file_new((t_pd *)x, prob_embedhook, 0, 0, 0);
return (x);
}
CYCLONE_OBJ_API void prob_setup(void){
prob_class = class_new(gensym("prob"), (t_newmethod)prob_new,
(t_method)prob_free, sizeof(t_prob), 0, 0);
class_addbang(prob_class, prob_bang);
class_addfloat(prob_class, prob_float);
class_addlist(prob_class, prob_list);
class_addmethod(prob_class, (t_method)prob_embed, gensym("embed"), A_FLOAT, 0);
class_addmethod(prob_class, (t_method)prob_reset, gensym("reset"), A_FLOAT, 0);
class_addmethod(prob_class, (t_method)prob_clear, gensym("clear"), 0);
class_addmethod(prob_class, (t_method)prob_dump, gensym("dump"), 0);
class_addmethod(prob_class, (t_method)prob_click, gensym("click"),
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
file_setup(prob_class, 1);
}
|
cc7a784396a50a85f8d3e35c7bb97bfc8dc6bb76
|
0ec5caf3d1fd25d9863dbe275bfadcd7b117a3e6
|
/2020_03_31/3rdParty/Pkware/Source/implode.c
|
c27c4a97fa7683e961f2e49867fee49fbdabbb7c
|
[
"LicenseRef-scancode-public-domain",
"Unlicense"
] |
permissive
|
galaxyhaxz/devilution
|
11923308131e172cd7b50cb357f0c2839cd7d5f4
|
28d71e3f1233ce3a27b48aaa2a07c56be19c39c3
|
refs/heads/master
| 2023-06-29T21:13:06.627943
| 2022-04-09T02:02:59
| 2022-04-09T02:02:59
| 150,687,332
| 346
| 58
|
Unlicense
| 2020-03-29T22:47:43
| 2018-09-28T04:49:38
|
C++
|
UTF-8
|
C
| false
| false
| 14,567
|
c
|
implode.c
|
#include "tables.inc"
#include "implode.h"
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef NULL
#define NULL ((void *)0)
#endif
//#define DEBUG_COPY
//#define DEBUG_LIT
//#include <stdio.h>
static char Copyright[] = { \
"PKWARE Data Compression Library for Win32\r\n" \
"Copyright 1989-1995 PKWARE Inc. All Rights Reserved\r\n" \
"Patent No. 5,051,745\r\n" \
"PKWARE Data Compression Library Reg. U.S. Pat. and Tm. Off.\r\n" \
"Version 1.11" };
#define VOID void
#define CHAR char /* 8 bits, signed */
#define UCHAR unsigned char /* 8 bits, unsigned */
#define SHORT signed short /* 16 bits, signed */
#define USHORT unsigned short /* 16 bits, unsigned */
#define UINT unsigned int
#define INT int
#define LONG signed long /* 32 bits, signed */
#define ULONG unsigned long /* 32 bits, unsigned */
#define MAX_DICT_SIZE 4096
#define EXP_BUFSIZE 4096
#define OUT_SIZE 2048
#define FOO_SIZE 2304
#define MINREP 2
#define SIZE_DIST 64
#define SIZE_LEN 16
#define MAXREP (MINREP+(8*1)+2+4+8+16+32+64+128+256-4)
#define SIZE_LIT (256+MAXREP+2)
#define EOF_CODE (SIZE_LIT-1)
#define ABORT_CODE (EOF_CODE+1)
typedef struct CMP_DATA
{
UINT Distance;
UINT OutPtr;
UINT OutPos;
UINT ExtDistBits;
UINT ExtDistMask;
UINT Mode;
UINT DictSize;
UCHAR DistBits[SIZE_DIST];
UCHAR DistCode[SIZE_DIST];
UCHAR LitBits[SIZE_LIT];
USHORT LitCode[SIZE_LIT];
VOID *Param;
#ifdef SYSLINK
UINT (* _System GetBuf)(UCHAR *buffer, UINT *size, VOID *Param);
VOID (* _System PutBuf)(UCHAR *buffer, UINT *size, VOID *Param);
#else
UINT (*GetBuf)(UCHAR *buffer, UINT *size, VOID *Param);
VOID (*PutBuf)(UCHAR *buffer, UINT *size, VOID *Param);
#endif
SHORT Next[MAXREP+2];
USHORT Index[FOO_SIZE+1];
UCHAR OutBuf[OUT_SIZE+2];
UCHAR Buffer[(MAX_DICT_SIZE*2)+MAXREP];
USHORT SortBuf[(MAX_DICT_SIZE*2)+MAXREP];
};
#define FOO(x) (4*(x)[0] + 5*(x)[1])
/****************************************************
Function Declarations
****************************************************/
static VOID WriteCmpData(struct CMP_DATA *Cmp);
static VOID SortBuffer(struct CMP_DATA *Cmp, UCHAR *low, UCHAR *hi);
static UINT FindRep(struct CMP_DATA *Cmp, UCHAR *Start);
static VOID OutputBits(struct CMP_DATA *Cmp, UINT Cnt, UINT Code);
static VOID lmemcpy(VOID *Dest, VOID *Source, UINT Size);
static VOID lmemset(VOID *Buf, UCHAR ch, UINT Size);
static VOID FlushBuf(struct CMP_DATA *Cmp);
/*******************************************
Function: Implode
********************************************
*/
#ifdef SYSLINK
UINT _System implode_sys(
UINT (* _System ReadBuf)(UCHAR *buffer, UINT *size, VOID *Param),
VOID (* _System WriteBuf)(UCHAR *buffer,UINT *size, VOID *Param),
#else
UINT implode(
UINT (*ReadBuf)(CHAR *buffer, UINT *size, VOID *Param),
VOID (*WriteBuf)(CHAR *buffer,UINT *size, VOID *Param),
#endif
CHAR *WorkBuf, VOID *Param, UINT *Mode, UINT *DictSize)
{
UINT i, j, k;
struct CMP_DATA *Cmp = (struct CMP_DATA *)WorkBuf;
Cmp->GetBuf = ReadBuf;
Cmp->PutBuf = WriteBuf;
Cmp->DictSize = *DictSize;
Cmp->Mode = *Mode;
Cmp->Param = Param;
Cmp->ExtDistBits = 4;
Cmp->ExtDistMask = 0xF;
switch (*DictSize)
{
case 4096:
Cmp->ExtDistBits++;
Cmp->ExtDistMask |= 0x20;
case 2048:
Cmp->ExtDistBits++;
Cmp->ExtDistMask |= 0x10;
case 1024:
break;
default:
return CMP_INVALID_DICTSIZE;
}
switch (*Mode)
{
case CMP_ASCII:
for (k=0; k<256; k++)
{
Cmp->LitBits[k] = (UCHAR)(ChBitsAsc[k] + 1);
Cmp->LitCode[k] = (USHORT)(ChCodeAsc[k] << 1);
}
break;
case CMP_BINARY:
for (k=0; k<256; k++)
{
Cmp->LitBits[k] = 9;
Cmp->LitCode[k] = (USHORT)(k << 1);
}
break;
default:
return CMP_INVALID_MODE;
}
for (i=0; i<16; i++)
{
for (j=0; j < ( 1U<<ExLenBits[i]); j++, k++)
{
Cmp->LitBits[k] = (UCHAR)(LenBits[i] + ExLenBits[i] + 1);
Cmp->LitCode[k] = (USHORT)((j<<(LenBits[i]+1)) | (LenCode[i]<<1) | 1);
}
}
lmemcpy(Cmp->DistCode,DistCode,sizeof(DistCode));
lmemcpy(Cmp->DistBits,DistBits,sizeof(DistBits));
WriteCmpData(Cmp);
return CMP_NO_ERROR;
}
/*************************************************
Function: WriteCmpData
**************************************************
*/
static VOID WriteCmpData(struct CMP_DATA *Cmp)
{
UINT Len, Pass=0, InCnt, CmpEnd = FALSE, i;
UINT Request, PassReq;
UCHAR *Cur, *Lim;
Cur = (UCHAR *)&Cmp->Buffer[Cmp->DictSize+MAXREP];
Cmp->OutBuf[0] = (UCHAR)Cmp->Mode;
Cmp->OutBuf[1] = (UCHAR)Cmp->ExtDistBits;
Cmp->OutPtr = 2;
lmemset(Cmp->OutBuf+2,0,OUT_SIZE);
Cmp->OutPos = 0;
do
{
Request = MAX_DICT_SIZE;
InCnt = 0;
do
{
PassReq = Request;
if ((i = (*Cmp->GetBuf)((VOID *)(Cmp->Buffer+Cmp->DictSize+MAXREP+InCnt),
&PassReq, Cmp->Param)) == 0)
{
if (InCnt == 0 && Pass == 0)
{
OutputBits(Cmp, Cmp->LitBits[EOF_CODE], Cmp->LitCode[EOF_CODE]);
if (Cmp->OutPos != 0)
++Cmp->OutPtr;
(*Cmp->PutBuf)(Cmp->OutBuf, &Cmp->OutPtr, Cmp->Param);
return;
}
CmpEnd = TRUE;
break;
}
InCnt += i;
Request -= i;
} while (Request);
Lim = (UCHAR *)&Cmp->Buffer[Cmp->DictSize+InCnt];
if (CmpEnd)
Lim += MAXREP;
switch (Pass)
{
case 0:
SortBuffer(Cmp, Cur,Lim+1);
++Pass;
if (Cmp->DictSize != 4096) // Added: 12-14-94
++Pass;
break;
case 1:
SortBuffer(Cmp, Cur-Cmp->DictSize+MAXREP,Lim+1); ++Pass; break;
default:
SortBuffer(Cmp, Cur-Cmp->DictSize, Lim+1); break;
}
while (Cur < Lim)
{
Len = FindRep(Cmp, Cur);
SkipFindRep:
if (Len == 0 || (Len == MINREP && Cmp->Distance >= 256))
{
#ifdef DEBUG_LIT
printf("Ch=%02x\n",*Cur);
#endif
OutputBits(Cmp, Cmp->LitBits[*Cur],Cmp->LitCode[*Cur]);
Cur++;
continue;
}
if (CmpEnd && Cur+Len > Lim)
{
Len = (unsigned)(Lim - Cur);
if (Len < MINREP || (Len == MINREP && Cmp->Distance >= 256))
{
#ifdef DEBUG_LIT
printf("Ch=%02x\n",*Cur);
#endif
OutputBits(Cmp, Cmp->LitBits[*Cur],Cmp->LitCode[*Cur]);
Cur++;
continue;
}
}
else if (Len < 8 && Cur+1 < Lim)
{
unsigned savd,savl;
savd=Cmp->Distance;
savl=Len;
Len=FindRep(Cmp, Cur + 1);
if (Len > savl && (Len > savl+1 || savd > 128))
{
#ifdef DEBUG_LIT
printf("Ch=%02x\n",*Cur);
#endif
OutputBits(Cmp, Cmp->LitBits[*Cur], Cmp->LitCode[*Cur]);
++Cur;
goto SkipFindRep;
}
Len=savl;
Cmp->Distance=savd;
}
#ifdef DEBUG_COPY
printf("Copy-%d %d\n",Len,Cmp->Distance+1);
#endif
OutputBits(Cmp, Cmp->LitBits[Len - MINREP + 256],
Cmp->LitCode[Len - MINREP + 256]);
if (Len == MINREP)
{
OutputBits(Cmp, Cmp->DistBits[Cmp->Distance>>2],
Cmp->DistCode[Cmp->Distance>>2]);
OutputBits(Cmp, 2, Cmp->Distance & 3);
}
else
{
OutputBits(Cmp, Cmp->DistBits[Cmp->Distance>>Cmp->ExtDistBits],
Cmp->DistCode[Cmp->Distance>>Cmp->ExtDistBits]);
OutputBits(Cmp, Cmp->ExtDistBits, Cmp->Distance & Cmp->ExtDistMask);
}
Cur+=Len;
}
if (CmpEnd == FALSE)
{
lmemcpy(Cmp->Buffer, Cmp->Buffer+MAX_DICT_SIZE,
Cmp->DictSize+MAXREP);
Cur -= MAX_DICT_SIZE;
}
} while (CmpEnd == FALSE);
OutputBits(Cmp, Cmp->LitBits[EOF_CODE], Cmp->LitCode[EOF_CODE]);
if (Cmp->OutPos != 0)
++Cmp->OutPtr;
(* Cmp->PutBuf)(Cmp->OutBuf, &Cmp->OutPtr, Cmp->Param);
}
/**************************************************
Function: FindRep
***************************************************
*/
#define KMP_THRESHOLD 10
static UINT FindRep(struct CMP_DATA *Cmp, UCHAR *Start)
{
INT CurLen=1;
register INT Len;
UCHAR *Pat;
register UCHAR *Ptr;
UINT ind;
UCHAR *Lim;
UINT HashVal;
UINT MinIndex;
ind=Cmp->Index[HashVal=FOO(Start)];
MinIndex = (UINT)(Start - Cmp->DictSize + 1 - Cmp->Buffer);
if (MinIndex > Cmp->SortBuf[ind])
{
do {
++ind;
} while (MinIndex > Cmp->SortBuf[ind]); /* enddo */
Cmp->Index[HashVal] = (USHORT)ind;
}
Lim=Start-1;
if ((Ptr = &Cmp->Buffer[Cmp->SortBuf[ind]]) >= Lim)
return 0;
Pat=Start;
do
{
if (*(Ptr+CurLen-1) == *(Pat+CurLen-1) && *Ptr == *Pat)
{
++Ptr; ++Pat; Len=2;
while (*++Ptr==*++Pat && ++Len<MAXREP);
Pat = Start;
if (Len >= CurLen)
{
Cmp->Distance = (unsigned)(Pat-Ptr+Len-1);
if ((CurLen=Len) > KMP_THRESHOLD)
{
if (Len == MAXREP)
{
--(Cmp->Distance);
return Len;
}
goto DoKMP;
}
}
}
}
while ((Ptr = &Cmp->Buffer[Cmp->SortBuf[++ind]]) < Lim);
return CurLen >= MINREP ? CurLen : 0;
{
SHORT i1, j1;
UCHAR *BasePtr;
DoKMP:
if (&Cmp->Buffer[Cmp->SortBuf[ind+1]] >= Lim)
return CurLen;
j1 = Cmp->Next[1] = 0;
Cmp->Next[0] = -1;
i1 = 1;
do
{ if (Pat[i1] == Pat[j1] || (j1 = Cmp->Next[j1]) == -1)
Cmp->Next[++i1] = ++j1;
}
while (i1 < CurLen);
Len = CurLen;
Ptr = &Cmp->Buffer[Cmp->SortBuf[ind]+CurLen];
while (TRUE)
{ if ((Len = Cmp->Next[Len]) == -1)
Len = 0;
do
{ if ((BasePtr=&Cmp->Buffer[Cmp->SortBuf[++ind]]) >= Lim)
return CurLen;
} while (BasePtr+Len < Ptr);
if (*(BasePtr+CurLen-2) != *(Pat+CurLen-2))
{
do {
if ((BasePtr=&Cmp->Buffer[Cmp->SortBuf[++ind]]) >= Lim)
return CurLen;
} while (*(BasePtr+CurLen-2) != *(Pat+CurLen-2) || *BasePtr != *Pat);
Len = 2;
Ptr = BasePtr+Len;
}
else if (BasePtr+Len != Ptr)
{ Len = 0;
Ptr = BasePtr;
}
while (*Ptr == Pat[Len] && ++Len < MAXREP)
Ptr++;
if (Len >= CurLen)
{ Cmp->Distance = (UINT)(Start-BasePtr-1);
if (Len > CurLen)
{ if (Len == MAXREP)
return Len;
CurLen = Len;
do
{ if (Pat[i1] == Pat[j1] || (j1 = Cmp->Next[j1]) == -1)
Cmp->Next[++i1] = ++j1;
}
while (i1 < CurLen);
}
}
}
}
}
/***************************************************
Function: OutputBits
****************************************************
*/
static VOID OutputBits(struct CMP_DATA *Cmp, UINT Cnt, UINT Code)
{
unsigned p;
if (Cnt > 8)
{
OutputBits(Cmp, 8,Code);
Cnt -= 8;
Code >>= 8;
}
*(Cmp->OutBuf+Cmp->OutPtr) |= Code << (p = Cmp->OutPos);
if ((Cmp->OutPos = p + Cnt) > 8)
{
++Cmp->OutPtr;
*(Cmp->OutBuf+Cmp->OutPtr) = (UCHAR)(Code >> (8 - p));
Cmp->OutPos &= 7;
}
else if ((Cmp->OutPos &= 7) == 0)
++Cmp->OutPtr;
if (Cmp->OutPtr >= OUT_SIZE)
FlushBuf(Cmp);
}
/***************************************************
Function: lmemcpy
****************************************************
*/
static VOID lmemcpy(VOID *Dest, VOID *Source, UINT Size)
{
UCHAR *s=(UCHAR *)Source, *t=(UCHAR *)Dest;
#ifndef _ALPHA
UINT count=Size/4;
if (count)
{ do
{ *(ULONG *)t = *(ULONG *)s;
s+=4;
t+=4;
}
while (--count);
}
if (Size %= 4)
#endif
do
{
*t++=*s++;
} while (--Size);
}
/**************************************************
Function: lmemset
***************************************************
*/
static VOID lmemset(VOID *Buf, UCHAR ch, UINT Size)
{
UCHAR *s=(UCHAR *)Buf;
#ifndef _ALPHA
UINT count=Size/4;
ULONG Ch2=ch;
ULONG LongCh = (((((Ch2 << 8) | Ch2) << 8) | Ch2) << 8) | Ch2;
if (count)
{ do
{ *(ULONG *)s = LongCh;
s+=4;
}
while (--count);
}
if (Size %= 4)
#endif
do {
*s++=(UCHAR)ch;
} while (--Size);
}
/**************************************************
Function: FlushBuf
***************************************************
*/
static VOID FlushBuf(struct CMP_DATA *Cmp)
{
UCHAR s1, s2;
UINT i = OUT_SIZE;
(* Cmp->PutBuf)(Cmp->OutBuf, &i, Cmp->Param);
s1 = Cmp->OutBuf[Cmp->OutPtr];
s2 = Cmp->OutBuf[OUT_SIZE];
Cmp->OutPtr -= OUT_SIZE;
lmemset(Cmp->OutBuf,0,OUT_SIZE+2);
if (Cmp->OutPtr > 0)
Cmp->OutBuf[0] = s2;
if (Cmp->OutPos != 0)
Cmp->OutBuf[Cmp->OutPtr] = s1;
}
/****************************************************
Function: SortBuffer
*****************************************************
Do a distribution sort on a 3 character hash value of the passed buffer.
*/
static VOID SortBuffer(struct CMP_DATA *Cmp, UCHAR *low, UCHAR *hi)
{
UINT *Ptr;
USHORT Accum = 0, *IndexPtr;
UCHAR *p;
Ptr = (UINT *)Cmp->Index;
do { /* Zero all index values */
*Ptr = 0;
} while (++Ptr < (UINT *)&Cmp->Index[FOO_SIZE]);
p = low; /* Get hash counts */
do
{
++(Cmp->Index[FOO(p)]);
} while (++p < hi);
IndexPtr = Cmp->Index;
do /* Accumulate counts */
{
Accum += *IndexPtr;
*IndexPtr = Accum;
} while (++IndexPtr < &Cmp->Index[FOO_SIZE]);
p = hi - 1; /* Complete sort buffer */
do {
IndexPtr = &Cmp->Index[FOO(p)];
--(*IndexPtr);
Cmp->SortBuf[*IndexPtr] = (USHORT)(p - Cmp->Buffer);
} while (--p >= low);
}
|
9976cc950c7e30c23cc4b5d11124fed5651318c7
|
7664f318ed04bd0680f3d82321c18896e3ef6ad5
|
/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c
|
bf3964d9cdb78b61b84ae248a931c74722e2dc60
|
[] |
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
| 3,285
|
c
|
z_bg_spot05_soko.c
|
/*
* File: z_bg_spot05_soko.c
* Overlay: ovl_Bg_Spot05_Soko
* Description: Sacred Forest Meadow Entities
*/
#include "z_bg_spot05_soko.h"
#include "assets/objects/object_spot05_objects/object_spot05_objects.h"
#define FLAGS 0
void BgSpot05Soko_Init(Actor* thisx, PlayState* play);
void BgSpot05Soko_Destroy(Actor* thisx, PlayState* play);
void BgSpot05Soko_Update(Actor* thisx, PlayState* play);
void BgSpot05Soko_Draw(Actor* thisx, PlayState* play);
void func_808AE5A8(BgSpot05Soko* this, PlayState* play);
void func_808AE5B4(BgSpot05Soko* this, PlayState* play);
void func_808AE630(BgSpot05Soko* this, PlayState* play);
ActorInit Bg_Spot05_Soko_InitVars = {
ACTOR_BG_SPOT05_SOKO,
ACTORCAT_PROP,
FLAGS,
OBJECT_SPOT05_OBJECTS,
sizeof(BgSpot05Soko),
(ActorFunc)BgSpot05Soko_Init,
(ActorFunc)BgSpot05Soko_Destroy,
(ActorFunc)BgSpot05Soko_Update,
(ActorFunc)BgSpot05Soko_Draw,
};
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
static Gfx* sDLists[] = {
object_spot05_objects_DL_000840,
object_spot05_objects_DL_001190,
};
void BgSpot05Soko_Init(Actor* thisx, PlayState* play) {
s32 pad1;
BgSpot05Soko* this = (BgSpot05Soko*)thisx;
CollisionHeader* colHeader = NULL;
s32 pad2;
Actor_ProcessInitChain(thisx, sInitChain);
this->switchFlag = (thisx->params >> 8) & 0xFF;
thisx->params &= 0xFF;
DynaPolyActor_Init(&this->dyna, 0);
if (thisx->params == 0) {
CollisionHeader_GetVirtual(&object_spot05_objects_Col_000918, &colHeader);
if (LINK_IS_ADULT) {
Actor_Kill(thisx);
} else {
this->actionFunc = func_808AE5A8;
}
} else {
CollisionHeader_GetVirtual(&object_spot05_objects_Col_0012C0, &colHeader);
if (Flags_GetSwitch(play, this->switchFlag) != 0) {
Actor_Kill(thisx);
} else {
this->actionFunc = func_808AE5B4;
thisx->flags |= ACTOR_FLAG_4;
}
}
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
}
void BgSpot05Soko_Destroy(Actor* thisx, PlayState* play) {
BgSpot05Soko* this = (BgSpot05Soko*)thisx;
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
void func_808AE5A8(BgSpot05Soko* this, PlayState* play) {
}
void func_808AE5B4(BgSpot05Soko* this, PlayState* play) {
if (Flags_GetSwitch(play, this->switchFlag)) {
SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 30, NA_SE_EV_METALDOOR_CLOSE);
Actor_SetFocus(&this->dyna.actor, 50.0f);
OnePointCutscene_Attention(play, &this->dyna.actor);
this->actionFunc = func_808AE630;
this->dyna.actor.speed = 0.5f;
}
}
void func_808AE630(BgSpot05Soko* this, PlayState* play) {
this->dyna.actor.speed *= 1.5f;
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 120.0f, this->dyna.actor.speed) !=
0) {
Actor_Kill(&this->dyna.actor);
}
}
void BgSpot05Soko_Update(Actor* thisx, PlayState* play) {
BgSpot05Soko* this = (BgSpot05Soko*)thisx;
this->actionFunc(this, play);
}
void BgSpot05Soko_Draw(Actor* thisx, PlayState* play) {
Gfx_DrawDListOpa(play, sDLists[thisx->params]);
}
|
b393f275bf170f1e067f44f7819652899c0c02d3
|
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
|
/sys/arch/arm/include/ansi.h
|
499d1c3b190da7c1b463f764d13075ca35c66a1e
|
[] |
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
| 91
|
h
|
ansi.h
|
/* $NetBSD: ansi.h,v 1.18 2019/05/07 03:49:26 kamil Exp $ */
#include <sys/common_ansi.h>
|
6961b03b6242fdf2c1c8e37b92e796b8cff4d82f
|
468cd559cb5374e737bb1b5f42f5fe73dd98dd8b
|
/source/backend/rmt_pool.h
|
8814f2b770be820d5d31e74c38d837041f2dafa6
|
[
"MIT"
] |
permissive
|
GPUOpen-Tools/radeon_memory_visualizer
|
31b84ceeb44573e654876df7af9cbf0063015898
|
87d9ca84492432f384e1cc8e93e59c3700ef0e3f
|
refs/heads/master
| 2023-09-01T00:41:37.480829
| 2023-07-12T15:02:57
| 2023-08-16T18:44:26
| 245,466,905
| 117
| 17
| null | null | null | null |
UTF-8
|
C
| false
| false
| 3,159
|
h
|
rmt_pool.h
|
//=============================================================================
// Copyright (c) 2019-2023 Advanced Micro Devices, Inc. All rights reserved.
/// @author AMD Developer Tools Team
/// @file
/// @brief Definition of structures and functions for a fixed-size pool
/// memory allocator.
//=============================================================================
#ifndef RMV_BACKEND_RMT_ALLOC_POOL_H_
#define RMV_BACKEND_RMT_ALLOC_POOL_H_
#include "rmt_error.h"
#ifdef __cplusplus
extern "C" {
#endif // #ifdef __cplusplus
/// A structure encapsulating state for a pool allocator.
///
/// A pool allocate allocates blocks of a fixed size with a single,
/// contiguous buffer. No guarantee is made about the order that blocks
/// are not allocated within the buffer, they are not always allocated
/// contiguously.
///
/// Allocating and freeing is a relatively cheap, fixed cost operation.
///
/// The contents of freed memory blocks is not changed when blocks are
/// returned to the pool, other than the first sizeof(uintptr_t) bytes.
///
/// NOTE: The minimum supported size of a block in this pool allocator is
/// the same as the sizeof(uintptr_t). This limitation is so the additional
/// memory overhead for the pool allocator is kept to a minimum as no
/// free block list is required. The memory for this is unioned with free
/// blocks in the memory buffer.
///
typedef struct RmtPool
{
void* head;
void* buffer;
size_t buffer_size;
size_t block_size;
size_t allocated;
} RmtPool;
/// Initialize the pool allocator.
///
/// @param [in,out] pool A pointer to a <c><i>RmtPool</i></c> structure.
/// @param [in] buffer A pointer to a memory buffer to manage allocations for.
/// @param [in] buffer_size The size (in bytes) of the buffer pointed to by <c><i>buffer</i></c>.
/// @param [in] block_size The size of a single block to allocate. Must be >= sizeof(uintptr_t).
///
/// @retval
/// kRmtOk The operation completed succesfully.
/// @retval
/// kRmtErrorInvalidPointer The operation failed because either <c><i>pool</i></c> or <c><i>buffer</i></c> was NULL.
/// @retval
/// kRmtErrorInvalidSize The operation failed because <c><i>chunkSize</i></c> was not greater than or equal to sizeof(uintptr_t).
///
RmtErrorCode RmtPoolInitialize(RmtPool* pool, void* buffer, size_t buffer_size, size_t block_size);
/// Allocate the next free block from the pool.
///
/// @param [in,out] pool A pointer to a <c><i>RmtPool</i></c> structure.
///
/// @returns
/// A pointer to the next block. If the pool is empty then <c><i>NULL</i></c> is returned.
///
void* RmtPoolAllocate(RmtPool* pool);
/// Free a block that was previously allocated from the pool.
///
/// @param [in,out] pool A pointer to a <c><i>RmtPool</i></c> structure.
/// @param [in] address The address of the block to free back to the pool.
///
void RmtPoolFree(RmtPool* pool, void* address);
#ifdef __cplusplus
}
#endif // #ifdef __cplusplus
#endif // #ifndef RMV_BACKEND_RMT_ALLOC_POOL_H_
|
df042aa1b3098ff4b581f9bd1d4eedc74f2ff57f
|
cf60f9591fef521d3092f81785de7942d0ca568e
|
/PubNub/include/PNStateAuditAPICallBuilder.h
|
6523c66ba0c3cc35be613b46452666de1e5fcdb7
|
[
"MIT"
] |
permissive
|
pubnub/objective-c
|
a49e2e5c7898eb893b601ae31a098361fb8b4406
|
eef06ae76fd45931ea09900e3b3ce50133870eca
|
refs/heads/master
| 2023-04-07T08:28:47.174178
| 2023-01-05T11:15:57
| 2023-01-05T11:15:57
| 8,490,984
| 137
| 145
|
NOASSERTION
| 2023-03-30T08:47:36
| 2013-03-01T00:10:41
|
Objective-C
|
UTF-8
|
C
| false
| false
| 60
|
h
|
PNStateAuditAPICallBuilder.h
|
../Data/Builders/API Call/State/PNStateAuditAPICallBuilder.h
|
b6e293d079f567e3d8de81b2f91892e90643ca38
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/sysutils/fusefs-sqlfs/files/patch-fuse_main.c
|
2e9fff3146e23ca65195cfb7041d00e9ba1ce258
|
[
"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
| 1,215
|
c
|
patch-fuse_main.c
|
--- fuse_main.c.orig 2006-10-25 15:28:26 UTC
+++ fuse_main.c
@@ -17,12 +17,60 @@ Foundation, Inc., 51 Franklin Street, Fi
*****************************************************************************/
+#include <stdlib.h>
+#include <stdio.h>
+#include <sysexits.h>
#include "sqlfs.h"
+void usage() __dead2;
+
+void usage()
+{
+ fprintf(stderr, "Usage: %s -o dbname [-h] dir\n", getprogname());
+
+ exit(EX_USAGE);
+}
int main(int argc, char **argv)
{
- sqlfs_init("/tmp/fsdata");
+ char c;
+ int ret;
+ char *dbname = NULL;
+ char *args[2];
+ char *prog = argv[0];
+
+ while ((c = getopt(argc, argv, "o:h")) != -1)
+ switch (c) {
+ case 'o':
+ dbname = strdup(optarg);
+ break;
+ case 'h':
+ /* FALLTHROUGH */
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (dbname == NULL) {
+ dbname = getenv("SQLFS_DBNAME");
+ }
+
+ if (dbname == NULL || argc < 1)
+ usage();
+ /* NOTREACHED */
+
+ ret = sqlfs_init(dbname);
+ if (ret != 0)
+ return ret;
+
+ fprintf(stderr, "init\n");
+
+ args[0] = strdup(getprogname());
+ args[1] = strdup(argv[0]);
- return sqlfs_fuse_main(argc, argv);
+ ret = sqlfs_fuse_main(2, args);
+
+ return ret;
}
|
75d7a5a095661e3abb81ba82829fd779d63179a3
|
88aca3340574f733b9ecd6f76708ecd2d57cb07e
|
/vendor/bundle/ruby/2.6.0/gems/ffi-1.15.5/ext/ffi_c/MappedType.c
|
d1a41894b69235f80fcbb55cabb0cd9e77a33659
|
[
"Apache-2.0",
"MIT",
"BSD-3-Clause"
] |
permissive
|
collabnix/dockerlabs
|
65c63a8424d34120bddc0fc8d6fd54a688953491
|
0f2a6b906a8ca0ebc28561236d4d6516f93b184c
|
refs/heads/master
| 2023-09-05T07:30:30.601797
| 2023-09-05T07:25:53
| 2023-09-05T07:25:53
| 153,069,455
| 5,239
| 1,854
|
Apache-2.0
| 2023-09-03T05:51:41
| 2018-10-15T07:19:18
|
PHP
|
UTF-8
|
C
| false
| false
| 5,237
|
c
|
MappedType.c
|
/*
* Copyright (c) 2010, Wayne Meissner
*
* Copyright (c) 2008-2013, Ruby FFI project contributors
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Ruby FFI project 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 <COPYRIGHT HOLDER> 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 <ruby.h>
#include <ffi.h>
#include "rbffi.h"
#include "Type.h"
#include "MappedType.h"
static VALUE mapped_allocate(VALUE);
static VALUE mapped_initialize(VALUE, VALUE);
static void mapped_mark(MappedType *);
static ID id_native_type, id_to_native, id_from_native;
VALUE rbffi_MappedTypeClass = Qnil;
static VALUE
mapped_allocate(VALUE klass)
{
MappedType* m;
VALUE obj = Data_Make_Struct(klass, MappedType, mapped_mark, -1, m);
m->rbConverter = Qnil;
m->rbType = Qnil;
m->type = NULL;
m->base.nativeType = NATIVE_MAPPED;
m->base.ffiType = &ffi_type_void;
return obj;
}
/*
* call-seq: initialize(converter)
* @param [#native_type, #to_native, #from_native] converter +converter+ must respond to
* all these methods
* @return [self]
*/
static VALUE
mapped_initialize(VALUE self, VALUE rbConverter)
{
MappedType* m = NULL;
if (!rb_respond_to(rbConverter, id_native_type)) {
rb_raise(rb_eNoMethodError, "native_type method not implemented");
}
if (!rb_respond_to(rbConverter, id_to_native)) {
rb_raise(rb_eNoMethodError, "to_native method not implemented");
}
if (!rb_respond_to(rbConverter, id_from_native)) {
rb_raise(rb_eNoMethodError, "from_native method not implemented");
}
Data_Get_Struct(self, MappedType, m);
m->rbType = rb_funcall2(rbConverter, id_native_type, 0, NULL);
if (!(rb_obj_is_kind_of(m->rbType, rbffi_TypeClass))) {
rb_raise(rb_eTypeError, "native_type did not return instance of FFI::Type");
}
m->rbConverter = rbConverter;
Data_Get_Struct(m->rbType, Type, m->type);
m->base.ffiType = m->type->ffiType;
return self;
}
static void
mapped_mark(MappedType* m)
{
rb_gc_mark(m->rbType);
rb_gc_mark(m->rbConverter);
}
/*
* call-seq: mapped_type.native_type
* @return [Type]
* Get native type of mapped type.
*/
static VALUE
mapped_native_type(VALUE self)
{
MappedType*m = NULL;
Data_Get_Struct(self, MappedType, m);
return m->rbType;
}
/*
* call-seq: mapped_type.to_native(*args)
* @param args depends on {FFI::DataConverter} used to initialize +self+
*/
static VALUE
mapped_to_native(int argc, VALUE* argv, VALUE self)
{
MappedType*m = NULL;
Data_Get_Struct(self, MappedType, m);
return rb_funcall2(m->rbConverter, id_to_native, argc, argv);
}
/*
* call-seq: mapped_type.from_native(*args)
* @param args depends on {FFI::DataConverter} used to initialize +self+
*/
static VALUE
mapped_from_native(int argc, VALUE* argv, VALUE self)
{
MappedType*m = NULL;
Data_Get_Struct(self, MappedType, m);
return rb_funcall2(m->rbConverter, id_from_native, argc, argv);
}
void
rbffi_MappedType_Init(VALUE moduleFFI)
{
/*
* Document-class: FFI::Type::Mapped < FFI::Type
*/
rbffi_MappedTypeClass = rb_define_class_under(rbffi_TypeClass, "Mapped", rbffi_TypeClass);
rb_global_variable(&rbffi_MappedTypeClass);
id_native_type = rb_intern("native_type");
id_to_native = rb_intern("to_native");
id_from_native = rb_intern("from_native");
rb_define_alloc_func(rbffi_MappedTypeClass, mapped_allocate);
rb_define_method(rbffi_MappedTypeClass, "initialize", mapped_initialize, 1);
rb_define_method(rbffi_MappedTypeClass, "type", mapped_native_type, 0);
rb_define_method(rbffi_MappedTypeClass, "native_type", mapped_native_type, 0);
rb_define_method(rbffi_MappedTypeClass, "to_native", mapped_to_native, -1);
rb_define_method(rbffi_MappedTypeClass, "from_native", mapped_from_native, -1);
}
|
0f8aca6d395c0269a3c3b62e5e867ab1572d36e9
|
6f8f706e13170c840ce38712693cd9a11ca3ccc4
|
/ArtilleryOfItaly/ArtilleryOfItaly/ArtilleryOfItaly/Source Files/dwarf_global.c
|
03ee0cd22dbcf1bc4fd6cc10eab57e0495e77129
|
[] |
permissive
|
wuba/WBBlades
|
80321e24414a9290f40512d809c79d8592b10439
|
c8af6d595fa4fa0aaa5d35447dd2fc048ec59705
|
refs/heads/master
| 2023-08-16T17:43:42.181515
| 2023-08-16T06:21:18
| 2023-08-16T06:21:18
| 247,865,662
| 1,353
| 207
|
BSD-3-Clause
| 2023-09-07T06:39:25
| 2020-03-17T02:56:07
|
Objective-C
|
UTF-8
|
C
| false
| false
| 35,847
|
c
|
dwarf_global.c
|
/*
Copyright (C) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright (C) 2007-2011 David Anderson. All Rights Reserved.
This program is free software; you can redistribute it
and/or modify it under the terms of version 2.1 of the
GNU Lesser General Public License as published by the Free
Software Foundation.
This program is distributed in the hope that it would be
useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
Further, this software is distributed without any warranty
that it is free of the rightful claim of any third person
regarding infringement or the like. Any license provided
herein, whether implied or otherwise, applies only to this
software file. Patent licenses, if any, provided herein
do not apply to combinations of this program with other
software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General
Public License along with this program; if not, write the
Free Software Foundation, Inc., 51 Franklin Street - Fifth
Floor, Boston MA 02110-1301, USA.
*/
#include <config.h>
#include <string.h> /* strlen() */
#if defined(_WIN32) && defined(HAVE_STDAFX_H)
#include "stdafx.h"
#endif /* HAVE_STDAFX_H */
#include "dwarf.h"
#include "libdwarf.h"
#include "libdwarf_private.h"
#include "dwarf_base_types.h"
#include "dwarf_opaque.h"
#include "dwarf_alloc.h"
#include "dwarf_error.h"
#include "dwarf_util.h"
#include "dwarf_string.h"
#include "dwarf_global.h"
#ifdef __sgi /* __sgi should only be defined for IRIX/MIPS. */
/* The 'fixup' here intended for IRIX targets only.
With a 2+GB Elf64 IRIX executable (under 4GB in size),
some DIE offsets wrongly
got the 32bit upper bit sign extended. For the cu-header
offset in the .debug_pubnames section and in the
.debug_aranges section.
the 'varp' here is a pointer to an offset into .debug_info.
We fix up the offset here if it seems advisable..
As of June 2005 we have identified a series of mistakes
in ldx64 that can cause this (64 bit values getting passed
thru 32-bit signed knothole).
*/
void
_dwarf_fix_up_offset_irix(Dwarf_Debug dbg,
Dwarf_Unsigned * varp, char *caller_site_name)
{
Dwarf_Unsigned var = *varp;
#define UPPER33 0xffffffff80000000LL
#define LOWER32 0xffffffffLL
/* Restrict the hack to the known case. Upper 32 bits erroneously
sign extended from lower 32 upper bit. */
if ((var & UPPER33) == UPPER33) {
var &= LOWER32;
/* Apply the fix. Dreadful hack. */
*varp = var;
}
#undef UPPER33
#undef LOWER32
return;
}
#endif /* __sgi */
static void
dealloc_globals_chain(Dwarf_Debug dbg,
Dwarf_Chain head_chain)
{
Dwarf_Chain curr_chain = 0;
int chaintype = DW_DLA_CHAIN;
Dwarf_Global_Context lastcontext = 0;
Dwarf_Global_Context curcontext = 0;
curr_chain = head_chain;
for (; curr_chain; ) {
Dwarf_Global item = 0;
int itemtype = 0;
Dwarf_Chain prev = 0;
item = (Dwarf_Global)curr_chain->ch_item;
itemtype = curr_chain->ch_itemtype;
curcontext = item->gl_context;
if (curcontext && curcontext != lastcontext) {
/* First time we see a context, dealloc it. */
lastcontext = curcontext;
dwarf_dealloc(dbg,curcontext,curcontext->pu_alloc_type);
}
prev = curr_chain;
dwarf_dealloc(dbg, item,itemtype);
prev->ch_item = 0;
curr_chain = curr_chain->ch_next;
dwarf_dealloc(dbg, prev, chaintype);
}
}
int
dwarf_get_globals(Dwarf_Debug dbg,
Dwarf_Global ** globals,
Dwarf_Signed * return_count, Dwarf_Error * error)
{
int res = 0;
if (!dbg || dbg->de_magic != DBG_IS_VALID) {
_dwarf_error_string(NULL, error, DW_DLE_DBG_NULL,
"DW_DLE_DBG_NULL: "
"calling dwarf_get_globals "
"Dwarf_Debug either null or it is"
"a stale Dwarf_Debug pointer");
return DW_DLV_ERROR;
}
res = _dwarf_load_section(dbg, &dbg->de_debug_pubnames,error);
if (res != DW_DLV_OK) {
return res;
}
if (!dbg->de_debug_pubnames.dss_size) {
return DW_DLV_NO_ENTRY;
}
res = _dwarf_internal_get_pubnames_like_data(dbg,
".debug_pubnames",
dbg->de_debug_pubnames.dss_data,
dbg->de_debug_pubnames.dss_size,
globals,
return_count,
error,
DW_DLA_GLOBAL_CONTEXT,
DW_DLA_GLOBAL,
DW_DLE_PUBNAMES_LENGTH_BAD,
DW_DLE_PUBNAMES_VERSION_ERROR);
return res;
}
/* Deallocating fully requires deallocating the list
and all entries. But some internal data is
not exposed, so we need a function with internal knowledge.
*/
void
dwarf_globals_dealloc(Dwarf_Debug dbg, Dwarf_Global * dwgl,
Dwarf_Signed count)
{
_dwarf_internal_globals_dealloc(dbg, dwgl, count);
return;
}
void
_dwarf_internal_globals_dealloc(Dwarf_Debug dbg,
Dwarf_Global * dwgl,
Dwarf_Signed count)
{
Dwarf_Signed i = 0;
struct Dwarf_Global_Context_s *glcp = 0;
struct Dwarf_Global_Context_s *lastglcp = 0;
if (!dwgl) {
return;
}
for (i = 0; i < count; i++) {
Dwarf_Global dgd = dwgl[i];
if (!dgd) {
continue;
}
/* Avoids duplicate frees of repeated
use of contexts (while assuming that
all uses of a particular gl_context
will appear next to each other. */
glcp = dgd->gl_context;
if (glcp && lastglcp != glcp) {
lastglcp = glcp;
dwarf_dealloc(dbg, glcp, glcp->pu_alloc_type);
}
dwarf_dealloc(dbg, dgd, dgd->gl_alloc_type);
}
dwarf_dealloc(dbg, dwgl, DW_DLA_LIST);
return;
}
static void
pubnames_error_length(Dwarf_Debug dbg,
Dwarf_Error *error,
Dwarf_Unsigned spaceneeded,
const char *secname,
const char *specificloc)
{
dwarfstring m;
dwarfstring_constructor(&m);
dwarfstring_append(&m,"DW_DLE_PUBNAMES_LENGTH_BAD: "
" In section ");
dwarfstring_append(&m,(char *)secname);
dwarfstring_append_printf_u(&m,
" %u bytes of space needed "
"but the section is out of space ",
spaceneeded);
dwarfstring_append(&m, "reading ");
dwarfstring_append(&m, (char *)specificloc);
dwarfstring_append(&m, ".");
_dwarf_error_string(dbg,error,DW_DLE_PUBNAMES_LENGTH_BAD,
dwarfstring_string(&m));
dwarfstring_destructor(&m);
}
/* INVARIANTS:
1) on error does not leak Dwarf_Global
2) glname is not malloc space. Never free.
*/
static int
_dwarf_make_global_add_to_chain(Dwarf_Debug dbg,
Dwarf_Unsigned global_DLA_code,
Dwarf_Global_Context pubnames_context,
Dwarf_Off die_offset_in_cu,
unsigned char * glname,
Dwarf_Unsigned *global_count,
Dwarf_Bool *pubnames_context_on_list,
Dwarf_Chain **plast_chain,
Dwarf_Error *error)
{
Dwarf_Chain curr_chain = 0;
Dwarf_Global global = 0;
global = (Dwarf_Global)
_dwarf_get_alloc(dbg, global_DLA_code, 1);
if (!global) {
_dwarf_error(dbg, error, DW_DLE_ALLOC_FAIL);
return DW_DLV_ERROR;
}
(*global_count)++;
/* Recording the same context in another Dwarf_Global */
global->gl_context = pubnames_context;
global->gl_alloc_type = global_DLA_code;
global->gl_named_die_offset_within_cu = die_offset_in_cu;
global->gl_name = glname;
/* Finish off current entry chain */
curr_chain =
(Dwarf_Chain) _dwarf_get_alloc(dbg, DW_DLA_CHAIN, 1);
if (!curr_chain) {
dwarf_dealloc(dbg,global,global_DLA_code);
_dwarf_error(dbg, error, DW_DLE_ALLOC_FAIL);
return DW_DLV_ERROR;
}
/* Put current global on singly_linked list. */
curr_chain->ch_item = (Dwarf_Global) global;
curr_chain->ch_itemtype = global_DLA_code;
(**plast_chain) = curr_chain;
*plast_chain = &(curr_chain->ch_next);
*pubnames_context_on_list = TRUE;
return DW_DLV_OK;
}
/* Sweeps the complete section. */
int
_dwarf_internal_get_pubnames_like_data(Dwarf_Debug dbg,
const char *secname,
Dwarf_Small * section_data_ptr,
Dwarf_Unsigned section_length,
Dwarf_Global ** globals,
Dwarf_Signed * return_count,
Dwarf_Error * error,
int context_DLA_code,
int global_DLA_code,
int length_err_num,
int version_err_num)
{
Dwarf_Small *pubnames_like_ptr = 0;
Dwarf_Off pubnames_section_offset = 0;
Dwarf_Small *section_end_ptr = section_data_ptr +section_length;
/* Points to the context for the current set of global names, and
contains information to identify the compilation-unit that the
set refers to. */
Dwarf_Global_Context pubnames_context = 0;
Dwarf_Bool pubnames_context_on_list = FALSE;
Dwarf_Unsigned version = 0;
/* Offset from the start of compilation-unit for the current
global. */
Dwarf_Off die_offset_in_cu = 0;
Dwarf_Unsigned global_count = 0;
/* Used to chain the Dwarf_Global_s structs for
creating contiguous list of pointers to the structs. */
Dwarf_Chain head_chain = 0;
Dwarf_Chain *plast_chain = &head_chain;
/* Points to contiguous block of Dwarf_Global to be returned. */
Dwarf_Global *ret_globals = 0;
int mres = 0;
/* Temporary counter. */
Dwarf_Unsigned i = 0;
if (!dbg || dbg->de_magic != DBG_IS_VALID) {
_dwarf_error_string(NULL, error, DW_DLE_DBG_NULL,
"DW_DLE_DBG_NULL: "
"calling for pubnames-like data Dwarf_Debug "
"either null or it contains"
"a stale Dwarf_Debug pointer");
return DW_DLV_ERROR;
}
/* We will eventually need the .debug_info data. Load it now. */
if (!dbg->de_debug_info.dss_data) {
int res = _dwarf_load_debug_info(dbg, error);
if (res != DW_DLV_OK) {
return res;
}
}
if (section_data_ptr == NULL) {
return DW_DLV_NO_ENTRY;
}
pubnames_like_ptr = section_data_ptr;
do {
Dwarf_Unsigned length = 0;
int local_extension_size = 0;
int local_length_size = 0;
/* Some compilers emit padding at the end of each cu's area.
pubnames_ptr_past_end_cu records the true area end for the
pubnames(like) content of a cu.
Essentially the length in the header and the 0
terminator of the data are redundant information. The
dwarf2/3 spec does not mention what to do if the length is
past the 0 terminator. So we take any bytes left
after the 0 as padding and ignore them. */
Dwarf_Small *pubnames_ptr_past_end_cu = 0;
pubnames_context_on_list = FALSE;
pubnames_context = (Dwarf_Global_Context)
_dwarf_get_alloc(dbg, context_DLA_code, 1);
if (pubnames_context == NULL) {
dealloc_globals_chain(dbg,head_chain);
_dwarf_error(dbg, error, DW_DLE_ALLOC_FAIL);
return DW_DLV_ERROR;
}
/* ========pubnames_context not recorded anywhere yet. */
/* READ_AREA_LENGTH updates pubnames_like_ptr for consumed
bytes. */
if ((pubnames_like_ptr + DWARF_32BIT_SIZE +
DWARF_HALF_SIZE + DWARF_32BIT_SIZE) >
/* A minimum size needed */
section_end_ptr) {
pubnames_error_length(dbg,error,
DWARF_32BIT_SIZE + DWARF_HALF_SIZE + DWARF_32BIT_SIZE,
secname,
"header-record");
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,context_DLA_code);
}
return DW_DLV_ERROR;
}
mres = _dwarf_read_area_length_ck_wrapper(dbg,
&length,&pubnames_like_ptr,&local_length_size,
&local_extension_size,section_length,section_end_ptr,
error);
if (mres != DW_DLV_OK) {
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,context_DLA_code);
}
return mres;
}
pubnames_context->pu_alloc_type = context_DLA_code;
pubnames_context->pu_length_size = local_length_size;
pubnames_context->pu_length = length;
pubnames_context->pu_extension_size = local_extension_size;
pubnames_context->pu_dbg = dbg;
pubnames_context->pu_pub_offset = pubnames_section_offset;
pubnames_ptr_past_end_cu = pubnames_like_ptr + length;
pubnames_context->pu_pub_entries_end_ptr =
pubnames_ptr_past_end_cu;
if ((pubnames_like_ptr + (DWARF_HALF_SIZE) ) >
/* A minimum size needed */
section_end_ptr) {
pubnames_error_length(dbg,error,
DWARF_HALF_SIZE,
secname,"version-number");
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,context_DLA_code);
}
return DW_DLV_ERROR;
}
mres = _dwarf_read_unaligned_ck_wrapper(dbg,
&version,pubnames_like_ptr,DWARF_HALF_SIZE,
section_end_ptr,error);
if (mres != DW_DLV_OK) {
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,context_DLA_code);
}
return mres;
}
pubnames_context->pu_version = version;
pubnames_like_ptr += DWARF_HALF_SIZE;
/* ASSERT: DW_PUBNAMES_VERSION2 == DW_PUBTYPES_VERSION2 */
if (version != DW_PUBNAMES_VERSION2) {
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,context_DLA_code);
}
_dwarf_error(dbg, error, version_err_num);
return DW_DLV_ERROR;
}
/* Offset of CU header in debug section. */
if ((pubnames_like_ptr + 3*pubnames_context->pu_length_size)>
section_end_ptr) {
pubnames_error_length(dbg,error,
3*pubnames_context->pu_length_size,
secname,
"header/DIE offsets");
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,context_DLA_code);
}
return DW_DLV_ERROR;
}
mres = _dwarf_read_unaligned_ck_wrapper(dbg,
&pubnames_context->pu_offset_of_cu_header,
pubnames_like_ptr,
pubnames_context->pu_length_size,
section_end_ptr,error);
if (mres != DW_DLV_OK) {
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,context_DLA_code);
}
return mres;
}
pubnames_like_ptr += pubnames_context->pu_length_size;
FIX_UP_OFFSET_IRIX_BUG(dbg,
pubnames_context->pu_offset_of_cu_header,
"pubnames cu header offset");
mres = _dwarf_read_unaligned_ck_wrapper(dbg,
&pubnames_context->pu_info_length,
pubnames_like_ptr,
pubnames_context->pu_length_size,
section_end_ptr,error);
if (mres != DW_DLV_OK) {
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,context_DLA_code);
}
return mres;
}
pubnames_like_ptr += pubnames_context->pu_length_size;
if (pubnames_like_ptr > (section_data_ptr + section_length)) {
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,context_DLA_code);
}
_dwarf_error(dbg, error, length_err_num);
return DW_DLV_ERROR;
}
/* ====begin pubname */
/* Read initial offset (of DIE within CU) of a pubname, final
entry is not a pair, just a zero offset. */
mres = _dwarf_read_unaligned_ck_wrapper(dbg,
&die_offset_in_cu,
pubnames_like_ptr,
pubnames_context->pu_length_size,
pubnames_context->pu_pub_entries_end_ptr,error);
if (mres != DW_DLV_OK) {
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,context_DLA_code);
}
return mres;
}
pubnames_like_ptr += pubnames_context->pu_length_size;
FIX_UP_OFFSET_IRIX_BUG(dbg,
die_offset_in_cu, "offset of die in cu");
if (pubnames_like_ptr > (section_data_ptr + section_length)) {
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,context_DLA_code);
}
_dwarf_error(dbg, error, length_err_num);
return DW_DLV_ERROR;
}
/* Loop thru pairs. DIE off with CU followed by string. */
if (!die_offset_in_cu) {
if (dbg->de_return_empty_pubnames) {
int res = 0;
/* Here we have a pubnames CU with no actual
entries so we fake up an entry to hold the
header data. There are no 'pairs' here,
just the end of list zero value. We do this
only if de_return_empty_pubnames is set
so that we by default return exactly the same
data this always returned, yet dwarfdump can
request the empty-cu records get created
to test that feature.
see dwarf_get_globals_header() */
res = _dwarf_make_global_add_to_chain(dbg,
global_DLA_code,
pubnames_context,
die_offset_in_cu,
/* It is a fake global, so empty name */
(unsigned char *)"",
&global_count,
&pubnames_context_on_list,
&plast_chain,
error);
if (res != DW_DLV_OK) {
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,
context_DLA_code);
}
return res;
}
/* ========pubnames_context recorded in chain. */
} else {
/* The section is empty.
Nowhere to record pubnames_context); */
dwarf_dealloc(dbg,pubnames_context,context_DLA_code);
pubnames_context = 0;
continue;
}
}
while (die_offset_in_cu) {
int res = 0;
unsigned char *glname = 0;
/* non-zero die_offset_in_cu already read, so
pubnames_like_ptr points to a string. */
res = _dwarf_check_string_valid(dbg,section_data_ptr,
pubnames_like_ptr,
pubnames_context->pu_pub_entries_end_ptr,
DW_DLE_STRING_OFF_END_PUBNAMES_LIKE,error);
if (res != DW_DLV_OK) {
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,
context_DLA_code);
}
return res;
}
glname = (unsigned char *)pubnames_like_ptr;
pubnames_like_ptr = pubnames_like_ptr +
strlen((char *) pubnames_like_ptr) + 1;
/* Already read offset and verified string, glname
now points to the string. */
res = _dwarf_make_global_add_to_chain(dbg,
global_DLA_code,
pubnames_context,
die_offset_in_cu,
glname,
&global_count,
&pubnames_context_on_list,
&plast_chain,
error);
if (res != DW_DLV_OK) {
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,
context_DLA_code);
}
return res;
}
/* ========pubnames_context recorded in chain. */
/* Ensure room for a next entry to exist. */
if ((pubnames_like_ptr +
pubnames_context->pu_length_size ) >
section_end_ptr) {
pubnames_error_length(dbg,error,
2*pubnames_context->pu_length_size,
secname,
"global record offset");
dealloc_globals_chain(dbg,head_chain);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,
context_DLA_code);
}
return DW_DLV_ERROR;
}
/* Read die offset for the *next* entry */
mres = _dwarf_read_unaligned_ck_wrapper(dbg,
&die_offset_in_cu,
pubnames_like_ptr,
pubnames_context->pu_length_size,
pubnames_context->pu_pub_entries_end_ptr,
error);
if (mres != DW_DLV_OK) {
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,
context_DLA_code);
}
dealloc_globals_chain(dbg,head_chain);
return mres;
}
pubnames_like_ptr += pubnames_context->pu_length_size;
FIX_UP_OFFSET_IRIX_BUG(dbg,
die_offset_in_cu, "offset of next die in cu");
if (pubnames_like_ptr >
(section_data_ptr + section_length)) {
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,
context_DLA_code);
}
dealloc_globals_chain(dbg,head_chain);
_dwarf_error(dbg, error, length_err_num);
return DW_DLV_ERROR;
}
}
/* ASSERT: die_offset_in_cu == 0 */
if (pubnames_like_ptr > pubnames_ptr_past_end_cu) {
/* This is some kind of error. This simply cannot happen.
The encoding is wrong or the length in the header for
this cu's contribution is wrong. */
_dwarf_error(dbg, error, length_err_num);
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,context_DLA_code);
}
dealloc_globals_chain(dbg,head_chain);
return DW_DLV_ERROR;
}
/* If there is some kind of padding at the end of
the section,
as emitted by some compilers, skip over that padding and
simply ignore the bytes thus passed-over. With most
compilers, pubnames_like_ptr ==
pubnames_ptr_past_end_cu at this point */
{
Dwarf_Unsigned increment =
pubnames_context->pu_length_size +
pubnames_context->pu_length +
pubnames_context->pu_extension_size;
pubnames_section_offset += increment;
}
pubnames_like_ptr = pubnames_ptr_past_end_cu;
} while (pubnames_like_ptr < section_end_ptr);
/* Points to contiguous block of Dwarf_Global. */
ret_globals = (Dwarf_Global *)
_dwarf_get_alloc(dbg, DW_DLA_LIST, global_count);
if (ret_globals == NULL) {
if (!pubnames_context_on_list) {
dwarf_dealloc(dbg,pubnames_context,context_DLA_code);
}
dealloc_globals_chain(dbg,head_chain);
_dwarf_error(dbg, error, DW_DLE_ALLOC_FAIL);
return DW_DLV_ERROR;
}
/* Store pointers to Dwarf_Global_s structs in contiguous block,
and deallocate the chain. This ignores the various
headers */
{
Dwarf_Chain curr_chain = 0;
curr_chain = head_chain;
for (i = 0; i < global_count; i++) {
Dwarf_Chain prev = 0;
*(ret_globals + i) = curr_chain->ch_item;
prev = curr_chain;
curr_chain = curr_chain->ch_next;
prev->ch_item = 0; /* Not actually necessary. */
dwarf_dealloc(dbg, prev, DW_DLA_CHAIN);
}
}
*globals = ret_globals;
*return_count = (Dwarf_Signed) global_count;
return DW_DLV_OK;
}
/* Given a pubnames entry (or other like section entry)
return thru the ret_name pointer
a pointer to the string which is the entry name. */
int
dwarf_globname(Dwarf_Global glob,
char **ret_name,
Dwarf_Error * error)
{
if (glob == NULL) {
_dwarf_error(NULL, error, DW_DLE_GLOBAL_NULL);
return DW_DLV_ERROR;
}
*ret_name = (char *) (glob->gl_name);
return DW_DLV_OK;
}
/* Given a pubnames entry (or other like section entry)
return thru the ret_off pointer the
global offset of the DIE for this entry.
The global offset is the offset within the .debug_info
section as a whole. */
int
dwarf_global_die_offset(Dwarf_Global global,
Dwarf_Off * ret_off, Dwarf_Error * error)
{
if (global == NULL) {
_dwarf_error(NULL, error, DW_DLE_GLOBAL_NULL);
return DW_DLV_ERROR;
}
if (global->gl_context == NULL) {
_dwarf_error(NULL, error, DW_DLE_GLOBAL_CONTEXT_NULL);
return DW_DLV_ERROR;
}
*ret_off = (global->gl_named_die_offset_within_cu +
global->gl_context->pu_offset_of_cu_header);
return DW_DLV_OK;
}
/* Given a pubnames entry (or other like section entry)
return thru the ret_off pointer the
offset of the compilation unit header of the
compilation unit the global is part of.
*/
int
dwarf_global_cu_offset(Dwarf_Global global,
Dwarf_Off * cu_header_offset,
Dwarf_Error * error)
{
Dwarf_Global_Context con = 0;
if (global == NULL) {
_dwarf_error(NULL, error, DW_DLE_GLOBAL_NULL);
return DW_DLV_ERROR;
}
con = global->gl_context;
if (con == NULL) {
_dwarf_error(NULL, error, DW_DLE_GLOBAL_CONTEXT_NULL);
return DW_DLV_ERROR;
}
*cu_header_offset = con->pu_offset_of_cu_header;
return DW_DLV_OK;
}
static void
build_off_end_msg(Dwarf_Unsigned offval,
Dwarf_Unsigned withincr,
Dwarf_Unsigned secsize,
dwarfstring *m)
{
const char *msg = "past";
if (offval < secsize){
msg = "too near";
}
dwarfstring_append_printf_u(m,"DW_DLE_OFFSET_BAD: "
"The CU header offset of %u in a pubnames-like entry ",
withincr);
dwarfstring_append_printf_s(m,
"would put us %s the end of .debug_info. "
"No room for a DIE there... "
"Corrupt Dwarf.",(char *)msg);
return;
}
/*
Give back the pubnames entry (or any other like section)
name, symbol DIE offset, and the cu-DIE offset.
Various errors are possible.
The string pointer returned thru ret_name is not
dwarf_get_alloc()ed, so no dwarf_dealloc()
DW_DLA_STRING should be applied to it.
*/
int
dwarf_global_name_offsets(Dwarf_Global global,
char **ret_name,
Dwarf_Off * die_offset,
Dwarf_Off * cu_die_offset,
Dwarf_Error * error)
{
Dwarf_Global_Context con = 0;
Dwarf_Debug dbg = 0;
Dwarf_Off cuhdr_off = 0;
if (global == NULL) {
_dwarf_error(NULL, error, DW_DLE_GLOBAL_NULL);
return DW_DLV_ERROR;
}
con = global->gl_context;
if (con == NULL) {
_dwarf_error(NULL, error, DW_DLE_GLOBAL_CONTEXT_NULL);
return DW_DLV_ERROR;
}
cuhdr_off = con->pu_offset_of_cu_header;
/* The offset had better not be too close to the end. If it is,
_dwarf_length_of_cu_header() will step off the end
and therefore
must not be used. 10 is a meaningless heuristic, but no CU
header is that small so it is safe. An erroneous offset is due
to a bug in the tool chain. A bug like this has been seen on
IRIX with MIPSpro 7.3.1.3 and an executable > 2GB in size and
with 2 million pubnames entries. */
#define MIN_CU_HDR_SIZE 10
dbg = con->pu_dbg;
if (!dbg || dbg->de_magic != DBG_IS_VALID) {
_dwarf_error_string(NULL, error, DW_DLE_DBG_NULL,
"DW_DLE_DBG_NULL: Either null or it contains"
"a stale Dwarf_Debug pointer");
return DW_DLV_ERROR;
}
/* Cannot refer to debug_types */
if (dbg->de_debug_info.dss_size &&
((cuhdr_off + MIN_CU_HDR_SIZE) >=
dbg->de_debug_info.dss_size)) {
dwarfstring m;
dwarfstring_constructor(&m);
build_off_end_msg(cuhdr_off,cuhdr_off+MIN_CU_HDR_SIZE,
dbg->de_debug_info.dss_size,&m);
_dwarf_error_string(dbg, error, DW_DLE_OFFSET_BAD,
dwarfstring_string(&m));
dwarfstring_destructor(&m);
return DW_DLV_ERROR;
}
#undef MIN_CU_HDR_SIZE
/* If global->gl_named_die_offset_within_cu
is zero then this is a fake global for
a pubnames CU with no pubnames. The offset is from the
start of the CU header, so no die can have a zero
offset, all valid offsets are positive numbers */
if (die_offset) {
if (global->gl_named_die_offset_within_cu) {
*die_offset = global->gl_named_die_offset_within_cu +
cuhdr_off;
} else {
*die_offset = 0;
}
}
*ret_name = (char *) global->gl_name;
if (cu_die_offset) {
/* Globals cannot refer to debug_types */
int cres = 0;
Dwarf_Unsigned headerlen = 0;
int res = _dwarf_load_debug_info(dbg, error);
if (res != DW_DLV_OK) {
return res;
}
/* The offset had better not be too close to the end.
If it is,
_dwarf_length_of_cu_header() will step off the end and
therefore must not be used. 10 is a meaningless heuristic,
but no CU header is that small so it is safe. */
/* Globals cannot refer to debug_types */
if ((cuhdr_off + 10) >= dbg->de_debug_info.dss_size) {
dwarfstring m;
dwarfstring_constructor(&m);
build_off_end_msg(cuhdr_off,cuhdr_off+10,
dbg->de_debug_info.dss_size,&m);
_dwarf_error_string(dbg, error, DW_DLE_OFFSET_BAD,
dwarfstring_string(&m));
dwarfstring_destructor(&m);
return DW_DLV_ERROR;
}
cres = _dwarf_length_of_cu_header(dbg, cuhdr_off,true,
&headerlen,error);
if (cres != DW_DLV_OK) {
return cres;
}
*cu_die_offset = cuhdr_off + headerlen;
}
return DW_DLV_OK;
}
/* New February 2019 from better dwarfdump printing
of debug_pubnames and pubtypes.
For ao the Dwarf_Global records in one pubnames
CU group exactly the same data will be returned.
*/
int
dwarf_get_globals_header(Dwarf_Global global,
Dwarf_Off *pub_section_hdr_offset,
Dwarf_Unsigned *pub_offset_size,
Dwarf_Unsigned *pub_cu_length,
Dwarf_Unsigned *version,
Dwarf_Off *info_header_offset,
Dwarf_Unsigned *info_length,
Dwarf_Error* error)
{
Dwarf_Global_Context con = 0;
Dwarf_Debug dbg = 0;
if (global == NULL) {
_dwarf_error(NULL, error, DW_DLE_GLOBAL_NULL);
return DW_DLV_ERROR;
}
con = global->gl_context;
if (con == NULL) {
_dwarf_error(NULL, error, DW_DLE_GLOBAL_CONTEXT_NULL);
return DW_DLV_ERROR;
}
dbg = con->pu_dbg;
if (!dbg || dbg->de_magic != DBG_IS_VALID) {
_dwarf_error_string(NULL, error, DW_DLE_DBG_NULL,
"DW_DLE_DBG_NULL: "
"calling dwarf_get_globals_header() "
"either null or it contains"
"a stale Dwarf_Debug pointer");
return DW_DLV_ERROR;
}
if (pub_section_hdr_offset) {
*pub_section_hdr_offset = con->pu_pub_offset;
}
if (pub_offset_size) {
*pub_offset_size = con->pu_length_size;
}
if (pub_cu_length) {
*pub_cu_length = con->pu_length;
}
if (version) {
*version = con->pu_version;
}
if (info_header_offset) {
*info_header_offset = con->pu_offset_of_cu_header;
}
if (info_length) {
*info_length = con->pu_info_length;
}
return DW_DLV_OK;
}
/* We have the offset to a CU header.
Return thru outFileOffset the offset of the CU DIE.
New June, 2001.
Used by SGI IRIX debuggers.
No error used to be possible.
As of May 2016 an error is possible if the DWARF is
corrupted! (IRIX debuggers are no longer built ...)
See also dwarf_CU_dieoffset_given_die().
This is assumed to never apply to data in .debug_types, it
only refers to .debug_info.
*/
/* ARGSUSED */
/* The following version new in October 2011, does allow finding
the offset if one knows whether debug_info or debug_types
or any .debug_info type including the DWARF5 flavors.
It indirectly calls _dwarf_length_of_cu_header()
which knows all the varieties of header. */
int
dwarf_get_cu_die_offset_given_cu_header_offset_b(Dwarf_Debug dbg,
Dwarf_Off in_cu_header_offset,
Dwarf_Bool is_info,
Dwarf_Off * out_cu_die_offset,
Dwarf_Error * error)
{
Dwarf_Off headerlen = 0;
int cres = 0;
if (!dbg || dbg->de_magic != DBG_IS_VALID) {
_dwarf_error_string(NULL, error, DW_DLE_DBG_NULL,
"DW_DLE_DBG_NULL: "
"calling dwarf_get_cu_die_offset_given"
"cu_header_offset_b Dwarf_Debug is"
"either null or it is"
"a stale Dwarf_Debug pointer");
return DW_DLV_ERROR;
}
cres = _dwarf_length_of_cu_header(dbg,
in_cu_header_offset,is_info, &headerlen,error);
if (cres != DW_DLV_OK) {
return cres;
}
*out_cu_die_offset = in_cu_header_offset + headerlen;
return DW_DLV_OK;
}
/* dwarf_CU_dieoffset_given_die returns
the global debug_info section offset of the CU die
that is the CU containing the given (passed-in) die.
This information makes it possible for a consumer to
find and print context information for any die.
Use dwarf_offdie_b() passing in the offset this returns
to get a die pointer to the CU die. */
int
dwarf_CU_dieoffset_given_die(Dwarf_Die die,
Dwarf_Off* return_offset,
Dwarf_Error* error)
{
Dwarf_Off dieoff = 0;
Dwarf_CU_Context cucontext = 0;
CHECK_DIE(die, DW_DLV_ERROR);
cucontext = die->di_cu_context;
dieoff = cucontext->cc_debug_offset;
/* The following call cannot fail, so no error check. */
dwarf_get_cu_die_offset_given_cu_header_offset_b(
cucontext->cc_dbg, dieoff,
die->di_is_info, return_offset,error);
return DW_DLV_OK;
}
int dwarf_return_empty_pubnames(Dwarf_Debug dbg, int flag)
{
if (dbg == NULL) {
return DW_DLV_OK;
}
if (flag && flag != 1) {
return DW_DLV_OK;
}
dbg->de_return_empty_pubnames = (unsigned char)flag;
return DW_DLV_OK;
}
|
b1c2e93ebb270866092e11605ab889fc50ee8225
|
d2253070a3a64b14dee5ca0b3d311919178e590c
|
/src/data/text/gift_ribbon_descriptions.h
|
0ba7a33d508032385f0a29ca54bc25ca6e81a353
|
[] |
no_license
|
pret/pokeemerald
|
ce232eccdde78502f3c251d672b26af3e1d7e508
|
d67914e114c937c4c80ce128ddc5523d4dc2cd40
|
refs/heads/master
| 2023-08-31T11:23:13.877932
| 2023-08-27T23:40:59
| 2023-08-27T23:40:59
| 43,677,244
| 1,944
| 1,903
| null | 2023-09-12T22:48:06
| 2015-10-05T10:09:22
|
C
|
UTF-8
|
C
| false
| false
| 10,172
|
h
|
gift_ribbon_descriptions.h
|
const u8 gGiftRibbonDescriptionPart1_2003RegionalTourney[] = _("2003 REGIONAL TOURNEY");
const u8 gGiftRibbonDescriptionPart2_Champion[] = _("CHAMPION RIBBON");
const u8 gGiftRibbonDescriptionPart1_2003NationalTourney[] = _("2003 NATIONAL TOURNEY");
const u8 gGiftRibbonDescriptionPart1_2003GlobalCup[] = _("2003 GLOBAL CUP");
const u8 gGiftRibbonDescriptionPart2_RunnerUp[] = _("Runner-up RIBBON");
const u8 gGiftRibbonDescriptionPart2_Semifinalist[] = _("Semifinalist RIBBON");
const u8 gGiftRibbonDescriptionPart1_2004RegionalTourney[] = _("2004 REGIONAL TOURNEY");
const u8 gGiftRibbonDescriptionPart1_2004NationalTourney[] = _("2004 NATIONAL TOURNEY");
const u8 gGiftRibbonDescriptionPart1_2004GlobalCup[] = _("2004 GLOBAL CUP");
const u8 gGiftRibbonDescriptionPart1_2005RegionalTourney[] = _("2005 REGIONAL TOURNEY");
const u8 gGiftRibbonDescriptionPart1_2005NationalTourney[] = _("2005 NATIONAL TOURNEY");
const u8 gGiftRibbonDescriptionPart1_2005GlobalCup[] = _("2005 GLOBAL CUP");
const u8 gGiftRibbonDescriptionPart1_PokemonBattleCup[] = _("POKéMON BATTLE CUP");
const u8 gGiftRibbonDescriptionPart2_Participation[] = _("Participation RIBBON");
const u8 gGiftRibbonDescriptionPart1_PokemonLeague[] = _("POKéMON LEAGUE");
const u8 gGiftRibbonDescriptionPart1_AdvanceCup[] = _("ADVANCE CUP");
const u8 gGiftRibbonDescriptionPart1_PokemonTournament[] = _("POKéMON Tournament");
const u8 gGiftRibbonDescriptionPart2_Participation2[] = _("Participation RIBBON");
const u8 gGiftRibbonDescriptionPart1_PokemonEvent[] = _("POKéMON Event");
const u8 gGiftRibbonDescriptionPart1_PokemonFestival[] = _("POKéMON Festival");
const u8 gGiftRibbonDescriptionPart1_DifficultyClearing[] = _("Difficulty-clearing");
const u8 gGiftRibbonDescriptionPart2_Commemorative[] = _("Commemorative RIBBON");
const u8 gGiftRibbonDescriptionPart1_ClearingAllChallenges[] = _("RIBBON awarded for");
const u8 gGiftRibbonDescriptionPart2_ClearingAllChallenges[] = _("clearing all challenges.");
const u8 gGiftRibbonDescriptionPart1_100StraightWin[] = _("100-straight Win");
const u8 gGiftRibbonDescriptionPart1_DarknessTower[] = _("DARKNESS TOWER Clear");
const u8 gGiftRibbonDescriptionPart1_RedTower[] = _("RED TOWER Clear");
const u8 gGiftRibbonDescriptionPart1_BlackironTower[] = _("BLACKIRON TOWER Clear");
const u8 gGiftRibbonDescriptionPart1_FinalTower[] = _("FINAL TOWER Clear");
const u8 gGiftRibbonDescriptionPart1_LegendMaking[] = _("Legend-making");
const u8 gGiftRibbonDescriptionPart1_PokemonCenterTokyo[] = _("POKéMON CENTER TOKYO");
const u8 gGiftRibbonDescriptionPart1_PokemonCenterOsaka[] = _("POKéMON CENTER OSAKA");
const u8 gGiftRibbonDescriptionPart1_PokemonCenterNagoya[] = _("POKéMON CENTER NAGOYA");
const u8 gGiftRibbonDescriptionPart1_PokemonCenterNY[] = _("POKéMON CENTER NY");
const u8 gGiftRibbonDescriptionPart1_SummerHolidays[] = _("Summer Holidays RIBBON");
const u8 gGiftRibbonDescriptionPart2_EmptyString[] = _("");
const u8 gGiftRibbonDescriptionPart1_WinterHolidays[] = _("Winter Holidays RIBBON");
const u8 gGiftRibbonDescriptionPart1_SpringHolidays[] = _("Spring Holidays RIBBON");
const u8 gGiftRibbonDescriptionPart1_Evergreen[] = _("Evergreen RIBBON");
const u8 gGiftRibbonDescriptionPart1_SpecialHoliday[] = _("Special Holiday RIBBON");
const u8 gGiftRibbonDescriptionPart1_HardWorker[] = _("Hard Worker RIBBON");
const u8 gGiftRibbonDescriptionPart1_LotsOfFriends[] = _("Lots of Friends RIBBON");
const u8 gGiftRibbonDescriptionPart1_FullOfEnergy[] = _("Full of Energy RIBBON");
const u8 gGiftRibbonDescriptionPart1_LovedPokemon[] = _("A commemorative RIBBON");
const u8 gGiftRibbonDescriptionPart2_LovedPokemon[] = _("for a loved POKéMON.");
const u8 gGiftRibbonDescriptionPart1_LoveForPokemon[] = _("RIBBON that shows");
const u8 gGiftRibbonDescriptionPart2_LoveForPokemon[] = _("love for POKéMON.");
const u8 *const gGiftRibbonDescriptionPointers[MAX_GIFT_RIBBON][2] =
{
{gGiftRibbonDescriptionPart1_2003RegionalTourney, gGiftRibbonDescriptionPart2_Champion},
{gGiftRibbonDescriptionPart1_2003NationalTourney, gGiftRibbonDescriptionPart2_Champion},
{gGiftRibbonDescriptionPart1_2003GlobalCup, gGiftRibbonDescriptionPart2_Champion},
{gGiftRibbonDescriptionPart1_2003RegionalTourney, gGiftRibbonDescriptionPart2_RunnerUp},
{gGiftRibbonDescriptionPart1_2003NationalTourney, gGiftRibbonDescriptionPart2_RunnerUp},
{gGiftRibbonDescriptionPart1_2003GlobalCup, gGiftRibbonDescriptionPart2_RunnerUp},
{gGiftRibbonDescriptionPart1_2003RegionalTourney, gGiftRibbonDescriptionPart2_Semifinalist},
{gGiftRibbonDescriptionPart1_2003NationalTourney, gGiftRibbonDescriptionPart2_Semifinalist},
{gGiftRibbonDescriptionPart1_2003GlobalCup, gGiftRibbonDescriptionPart2_Semifinalist},
{gGiftRibbonDescriptionPart1_2004RegionalTourney, gGiftRibbonDescriptionPart2_Champion},
{gGiftRibbonDescriptionPart1_2004NationalTourney, gGiftRibbonDescriptionPart2_Champion},
{gGiftRibbonDescriptionPart1_2004GlobalCup, gGiftRibbonDescriptionPart2_Champion},
{gGiftRibbonDescriptionPart1_2004RegionalTourney, gGiftRibbonDescriptionPart2_RunnerUp},
{gGiftRibbonDescriptionPart1_2004NationalTourney, gGiftRibbonDescriptionPart2_RunnerUp},
{gGiftRibbonDescriptionPart1_2004GlobalCup, gGiftRibbonDescriptionPart2_RunnerUp},
{gGiftRibbonDescriptionPart1_2004RegionalTourney, gGiftRibbonDescriptionPart2_Semifinalist},
{gGiftRibbonDescriptionPart1_2004NationalTourney, gGiftRibbonDescriptionPart2_Semifinalist},
{gGiftRibbonDescriptionPart1_2004GlobalCup, gGiftRibbonDescriptionPart2_Semifinalist},
{gGiftRibbonDescriptionPart1_2005RegionalTourney, gGiftRibbonDescriptionPart2_Champion},
{gGiftRibbonDescriptionPart1_2005NationalTourney, gGiftRibbonDescriptionPart2_Champion},
{gGiftRibbonDescriptionPart1_2005GlobalCup, gGiftRibbonDescriptionPart2_Champion},
{gGiftRibbonDescriptionPart1_2005RegionalTourney, gGiftRibbonDescriptionPart2_RunnerUp},
{gGiftRibbonDescriptionPart1_2005NationalTourney, gGiftRibbonDescriptionPart2_RunnerUp},
{gGiftRibbonDescriptionPart1_2005GlobalCup, gGiftRibbonDescriptionPart2_RunnerUp},
{gGiftRibbonDescriptionPart1_2005RegionalTourney, gGiftRibbonDescriptionPart2_Semifinalist},
{gGiftRibbonDescriptionPart1_2005NationalTourney, gGiftRibbonDescriptionPart2_Semifinalist},
{gGiftRibbonDescriptionPart1_2005GlobalCup, gGiftRibbonDescriptionPart2_Semifinalist},
{gGiftRibbonDescriptionPart1_PokemonBattleCup, gGiftRibbonDescriptionPart2_Champion},
{gGiftRibbonDescriptionPart1_PokemonBattleCup, gGiftRibbonDescriptionPart2_RunnerUp},
{gGiftRibbonDescriptionPart1_PokemonBattleCup, gGiftRibbonDescriptionPart2_Semifinalist},
{gGiftRibbonDescriptionPart1_PokemonBattleCup, gGiftRibbonDescriptionPart2_Participation},
{gGiftRibbonDescriptionPart1_PokemonLeague, gGiftRibbonDescriptionPart2_Champion},
{gGiftRibbonDescriptionPart1_PokemonLeague, gGiftRibbonDescriptionPart2_RunnerUp},
{gGiftRibbonDescriptionPart1_PokemonLeague, gGiftRibbonDescriptionPart2_Semifinalist},
{gGiftRibbonDescriptionPart1_PokemonLeague, gGiftRibbonDescriptionPart2_Participation},
{gGiftRibbonDescriptionPart1_AdvanceCup, gGiftRibbonDescriptionPart2_Champion},
{gGiftRibbonDescriptionPart1_AdvanceCup, gGiftRibbonDescriptionPart2_RunnerUp},
{gGiftRibbonDescriptionPart1_AdvanceCup, gGiftRibbonDescriptionPart2_Semifinalist},
{gGiftRibbonDescriptionPart1_AdvanceCup, gGiftRibbonDescriptionPart2_Participation},
{gGiftRibbonDescriptionPart1_PokemonTournament, gGiftRibbonDescriptionPart2_Participation2},
{gGiftRibbonDescriptionPart1_PokemonEvent, gGiftRibbonDescriptionPart2_Participation2},
{gGiftRibbonDescriptionPart1_PokemonFestival, gGiftRibbonDescriptionPart2_Participation2},
{gGiftRibbonDescriptionPart1_DifficultyClearing, gGiftRibbonDescriptionPart2_Commemorative},
{gGiftRibbonDescriptionPart1_ClearingAllChallenges, gGiftRibbonDescriptionPart2_ClearingAllChallenges},
{gGiftRibbonDescriptionPart1_100StraightWin, gGiftRibbonDescriptionPart2_Commemorative},
{gGiftRibbonDescriptionPart1_DarknessTower, gGiftRibbonDescriptionPart2_Commemorative},
{gGiftRibbonDescriptionPart1_RedTower, gGiftRibbonDescriptionPart2_Commemorative},
{gGiftRibbonDescriptionPart1_BlackironTower, gGiftRibbonDescriptionPart2_Commemorative},
{gGiftRibbonDescriptionPart1_FinalTower, gGiftRibbonDescriptionPart2_Commemorative},
{gGiftRibbonDescriptionPart1_LegendMaking, gGiftRibbonDescriptionPart2_Commemorative},
{gGiftRibbonDescriptionPart1_PokemonCenterTokyo, gGiftRibbonDescriptionPart2_Commemorative},
{gGiftRibbonDescriptionPart1_PokemonCenterOsaka, gGiftRibbonDescriptionPart2_Commemorative},
{gGiftRibbonDescriptionPart1_PokemonCenterNagoya, gGiftRibbonDescriptionPart2_Commemorative},
{gGiftRibbonDescriptionPart1_PokemonCenterNY, gGiftRibbonDescriptionPart2_Commemorative},
{gGiftRibbonDescriptionPart1_SummerHolidays, gGiftRibbonDescriptionPart2_EmptyString},
{gGiftRibbonDescriptionPart1_WinterHolidays, gGiftRibbonDescriptionPart2_EmptyString},
{gGiftRibbonDescriptionPart1_SpringHolidays, gGiftRibbonDescriptionPart2_EmptyString},
{gGiftRibbonDescriptionPart1_Evergreen, gGiftRibbonDescriptionPart2_EmptyString},
{gGiftRibbonDescriptionPart1_SpecialHoliday, gGiftRibbonDescriptionPart2_EmptyString},
{gGiftRibbonDescriptionPart1_HardWorker, gGiftRibbonDescriptionPart2_EmptyString},
{gGiftRibbonDescriptionPart1_LotsOfFriends, gGiftRibbonDescriptionPart2_EmptyString},
{gGiftRibbonDescriptionPart1_FullOfEnergy, gGiftRibbonDescriptionPart2_EmptyString},
{gGiftRibbonDescriptionPart1_LovedPokemon, gGiftRibbonDescriptionPart2_LovedPokemon},
{gGiftRibbonDescriptionPart1_LoveForPokemon, gGiftRibbonDescriptionPart2_LoveForPokemon}
};
|
eeefa72e7c2032014e742e1379f871201f12cac0
|
ddd2fea89ad2a0fff3ab03196bd587a1a507b484
|
/src/pathUtilities.c
|
d8349644715045bc2d1cfeb8299fcbab92b62ce4
|
[
"MIT"
] |
permissive
|
pharo-project/pharo-vm
|
b66806f84c389f1115be007414a8ed1f2581b2cb
|
b67609b953ba847c1c2f1e9c857fd22ed48ce566
|
refs/heads/pharo-10
| 2023-09-04T02:37:09.190132
| 2023-08-16T16:51:13
| 2023-08-16T16:51:13
| 11,979,155
| 110
| 45
|
NOASSERTION
| 2019-04-30T13:41:12
| 2013-08-08T15:03:53
|
C
|
UTF-8
|
C
| false
| false
| 6,556
|
c
|
pathUtilities.c
|
#include "pharovm/pathUtilities.h"
#include "pharovm/stringUtilities.h"
#include <string.h>
#include <stdio.h>
#ifdef _WIN32
# include <windows.h>
#elif defined(__unix__) || defined(__MACH__) || defined(__APPLE__)
# include <unistd.h>
# include <dirent.h>
#else
# define getcwd(target, targetSize) strcpy(target, ".") // Assume target size is always greater than one.
#endif
EXPORT(VMErrorCode)
vm_path_get_current_working_dir_into(char *target, size_t targetSize)
{
#ifdef _WIN32
DWORD tempBufferSize = GetCurrentDirectoryW(0, NULL) + 1; // for \0
WCHAR *tempBuffer = (WCHAR*)calloc(tempBufferSize, sizeof(WCHAR));
if(!tempBuffer) {
return VM_ERROR_OUT_OF_MEMORY;
}
GetCurrentDirectoryW(tempBufferSize, tempBuffer);
WideCharToMultiByte(CP_UTF8, 0, tempBuffer, tempBufferSize, target, targetSize, NULL, FALSE);
target[targetSize - 1] = 0; // CHECK ME: Is this really needed?
#else
if(getcwd(target, targetSize) == NULL) {
return VM_ERROR;
}
#endif
return VM_SUCCESS;
}
EXPORT(bool)
vm_path_is_absolute_path(const char *path)
{
#ifdef _WIN32
return path && (path[0] != 0 && path[1] == ':');
#else
/* Assume UNIX style path. */
return path && (*path == '/');
#endif
}
EXPORT(VMErrorCode)
vm_path_make_absolute_into(char *target, size_t targetSize, const char *src)
{
VMErrorCode error;
if (vm_path_is_absolute_path(src))
{
strncpy(target, src, targetSize - 1);
target[targetSize-1] = 0;
}
else
{
error = vm_path_get_current_working_dir_into(target, targetSize);
if(error) {
return error;
}
size_t workDirSize = strlen(target);
#ifdef _WIN32
if(workDirSize > 0 && target[workDirSize - 1] != '\\')
{
vm_string_append_into(target, "\\", targetSize);
}
if (src[0] == '.' && (src[1] == '/' || src[1] == '\\'))
{
vm_string_append_into(target, src + 2, targetSize);
}
else {
vm_string_append_into(target, src, targetSize);
}
#else
if(workDirSize > 0 && target[workDirSize - 1] != '/')
{
vm_string_append_into(target, "/", targetSize);
}
if(src[0] == '.' && src[1] == '/')
{
vm_string_append_into(target, src + 2, targetSize);
}
else
{
vm_string_append_into(target, src, targetSize);
}
#endif
}
return VM_SUCCESS;
}
EXPORT(VMErrorCode)
vm_path_extract_dirname_into(char *target, size_t targetSize, const char *src)
{
size_t copySize;
const char *lastSeparator = strrchr(src, '/');
#ifdef _WIN32
const char *lastSeparator2 = strrchr(src, '\\');
if (!lastSeparator || lastSeparator < lastSeparator2)
lastSeparator = lastSeparator2;
#endif
copySize = targetSize - 1;
if (lastSeparator && lastSeparator - src < copySize)
{
// FIXME: raise an error code, and handle this case.
size_t newCopySize = lastSeparator - src;
if(newCopySize < copySize)
copySize = newCopySize;
}
strncpy(target, src, copySize);
target[copySize] = 0;
return VM_SUCCESS;
}
EXPORT(VMErrorCode)
vm_path_extract_basename_into(char *target, size_t targetSize, const char *src)
{
const char *lastSeparator = strrchr(src, '/');
#ifdef _WIN32
const char *lastSeparator2 = strrchr(src, '\\');
if (!lastSeparator || lastSeparator < lastSeparator2)
lastSeparator = lastSeparator2;
#endif
if (lastSeparator)
{
strncpy(target, lastSeparator, targetSize - 1);
target[targetSize - 1] = 0;
}
else
{
strcpy(target, "");
}
return VM_SUCCESS;
}
#ifdef _WIN32
# define SEPARATOR_STRING "\\"
# define SEPARATOR_CHAR '\\'
#else
# define SEPARATOR_STRING "/"
# define SEPARATOR_CHAR '/'
#endif
EXPORT(VMErrorCode)
vm_path_join_into(char *target, size_t targetSize, const char *first, const char *second)
{
strncpy(target, first, targetSize - 1);
target[targetSize - 1] = 0;
if(first[strlen(first)-1] != SEPARATOR_CHAR) {
vm_string_append_into(target, SEPARATOR_STRING, targetSize);
}
vm_string_append_into(target, second, targetSize);
return VM_SUCCESS;
}
#ifdef _WIN32
EXPORT(size_t)
vm_path_find_files_with_extension_in_folder(const char *searchPath, const char *extension, char *imagePathBuffer, size_t imagePathBufferSize)
{
WIN32_FIND_DATAW findFileData;
HANDLE findHandle;
WCHAR *searchPathW = vm_string_convert_utf8_to_utf16(searchPath);
WCHAR *searchPathPattern = (WCHAR*)calloc(FILENAME_MAX, 2);
lstrcpyW(searchPathPattern, searchPathW);
lstrcatW(searchPathPattern, L"\\*.image");
findHandle = FindFirstFileW(searchPathPattern, &findFileData);
if(findHandle == INVALID_HANDLE_VALUE)
{
free(searchPathW);
return 0;
}
bool hasPreviousOutput = *imagePathBuffer != 0;
int result = 0;
WCHAR *pathConversionBuffer = (WCHAR*)calloc(FILENAME_MAX, 2);
do
{
if(!hasPreviousOutput)
{
lstrcpyW(pathConversionBuffer, searchPathW);
lstrcatW(pathConversionBuffer, L"\\");
lstrcatW(pathConversionBuffer, findFileData.cFileName);
WideCharToMultiByte(CP_UTF8, 0, pathConversionBuffer, -1, imagePathBuffer, imagePathBufferSize, NULL, FALSE);
imagePathBuffer[imagePathBufferSize - 1] = 0; // CHECK ME: Is this really needed?
}
hasPreviousOutput = true;
++result;
} while(FindNextFileW(findHandle, &findFileData));
FindClose(findHandle);
free(pathConversionBuffer);
free(searchPathPattern);
free(searchPathW);
return result;
}
#else
EXPORT(size_t)
vm_path_find_files_with_extension_in_folder(const char *searchPath, const char *extension, char *imagePathBuffer, size_t imagePathBufferSize)
{
struct dirent *entry;
int result = 0;
bool hasPreviousOutput = *imagePathBuffer != 0;
DIR *dir = opendir(searchPath);
if(!dir)
return 0;
while((entry = readdir(dir)) != NULL)
{
char *name = entry->d_name;
char *fileExtension = strrchr(name, '.');
if(!extension)
continue;
if(strcmp(fileExtension, extension) != 0)
continue;
if(!hasPreviousOutput)
snprintf(imagePathBuffer, imagePathBufferSize, "%s/%s", searchPath, name);
++result;
hasPreviousOutput = true;
}
closedir(dir);
return result;
}
#endif
|
6bfc00d36f461b67d861a8166c1ccde8c546b23a
|
52f4f5a3de2cae7299275a87ec71a0bfc35dd37c
|
/firmware/keyboards/megatreus/config/single/keyboard_config.h
|
ed14a94e768c451bb8a65697d9b2ed800be68955
|
[
"BSD-3-Clause"
] |
permissive
|
jpconstantineau/BlueMicro_BLE
|
ea50469a8343461a34efe184db82584296f2f5a2
|
2fedd92a6778418bd65974244574fc6de230eadb
|
refs/heads/master
| 2023-03-16T14:10:04.066863
| 2023-03-14T18:38:09
| 2023-03-14T18:38:09
| 132,757,098
| 363
| 195
|
BSD-3-Clause
| 2023-03-14T18:38:42
| 2018-05-09T12:57:35
|
C++
|
UTF-8
|
C
| false
| false
| 2,768
|
h
|
keyboard_config.h
|
/*
Copyright (C) 2020-2021 Jocelyn Turcotte <turcotte.j@gmail.com>
3-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.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef KEYBOARD_CONFIG_H
#define KEYBOARD_CONFIG_H
#include "hardware_config.h"
#define DEVICE_NAME_M "Megatreus" /**< Name of device. Will be included in the advertising data. */
#define DEVICE_MODEL "Megatreus - The Original" /**< Name of device. Will be included in the advertising data. */
#define MANUFACTURER_NAME "jturcotte" /**< Manufacturer. Will be passed to Device Information Service. */
#define KEYBOARD_SIDE SINGLE
#define KEYMAP( \
A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, \
B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, \
C1, C2, C3, C4, C5, C6, D7, D8, C9, C10, C11, C12, C13, C14, \
D1, D2, D3, D4, D5, D6, D9, D10, D11, D12, D13, D14, \
E1, E2, E4, E5, E6, E10, E11, E12, E13, E14, \
F12 \
) { \
{A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14}, \
{B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14}, \
{C1, C2, C3, C4, C5, C6, KC_NO, KC_NO, C9, C10, C11, C12, C13, C14}, \
{D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14}, \
{E1, E2, KC_NO, E4, E5, E6, KC_NO, KC_NO, E10, E11, F12, E12, E13, E14} \
}
#endif /* KEYBOARD_CONFIG_H */
|
e5d9e3a91b56d59b18ffc799236c015f68bb1cb3
|
db292254f2a4bb2a9f5c36e9f094dd403da24db8
|
/Include/listdefs.h
|
cd68f30de1e2802ee362b211af58e75226051cde
|
[
"MIT"
] |
permissive
|
9176324/Shark
|
778874aee7c3c00b30677ff556f5ac1a4ede3be6
|
adec00d72247fc198348539c9ec7dc19456067fc
|
refs/heads/master
| 2023-08-13T03:19:27.411743
| 2022-04-21T06:41:06
| 2022-04-21T06:41:06
| 153,141,222
| 952
| 317
|
MIT
| 2019-02-11T02:31:16
| 2018-10-15T15:52:38
|
C
|
UTF-8
|
C
| false
| false
| 2,559
|
h
|
listdefs.h
|
/*
*
* Copyright (c) 2015 - 2021 by blindtiger. All rights reserved.
*
* The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. SEe the License
* for the specific language governing rights and limitations under the
* License.
*
* The Initial Developer of the Original Code is blindtiger.
*
*/
#ifndef _LISTDEFS_H_
#define _LISTDEFS_H_
#include <typesdefs.h>
#ifdef __cplusplus
/* Assume byte packing throughout */
extern "C" {
#endif /* __cplusplus */
typedef struct _list {
struct _list * front;
struct _list * back;
} list;
#define __is_list_empty(head) \
((head)->front == (head))
__inline
void
__empty_list(
list * head
)
{
head->front = head->back = head;
}
__inline
u8
__remove_node(
list * node
)
{
list * back;
list * front;
front = node->front;
back = node->back;
back->front = front;
front->back = back;
return (u8)(front == back);
}
__inline
void
__insert_head(
list * head,
list * node
)
{
list * front;
front = head->front;
node->front = front;
node->back = head;
head->front = node;
front->back = node;
}
__inline
list *
__remove_head(
list * head
)
{
list * front;
list * node;
node = head->front;
front = node->front;
head->front = front;
front->back = head;
return node;
}
__inline
void
__insert_tail(
list * head,
list * node
)
{
list * back;
back = head->back;
node->front = head;
node->back = back;
back->front = node;
head->back = node;
}
__inline
list *
__remove_tail(
list * head
)
{
list * back;
list * node;
node = head->back;
back = node->back;
head->back = back;
back->front = head;
return node;
}
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif // !_LISTDEFS_H_
|
fc1ac9dc16e1c670aabaedb5f01670bccd0ce5e0
|
84f1ce4838c39cec710818d69005f8919ec39994
|
/src/arch/riscv/inc/arch/opcodes.h
|
1bc81eacce6fed059ac905e19414e654f3737bf7
|
[
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] |
permissive
|
bao-project/bao-hypervisor
|
adb2689fdd690d10ea11fa693375c4043a9f9309
|
291cac3df9d5e0b4704006376196cd2231105704
|
refs/heads/main
| 2023-08-31T05:50:21.845457
| 2023-07-25T19:46:28
| 2023-08-22T12:09:57
| 233,099,706
| 231
| 78
|
Apache-2.0
| 2023-09-14T13:58:26
| 2020-01-10T17:42:11
|
C
|
UTF-8
|
C
| false
| false
| 43,556
|
h
|
opcodes.h
|
/**
* SPDX-License-Identifier: Apache-2.0
* Copyright (c) Bao Project and Contributors. All rights reserved.
*/
/* Automatically generated by parse_opcodes. */
#ifndef RISCV_ENCODING_H
#define RISCV_ENCODING_H
#define MATCH_BEQ 0x63
#define MASK_BEQ 0x707f
#define MATCH_BNE 0x1063
#define MASK_BNE 0x707f
#define MATCH_BLT 0x4063
#define MASK_BLT 0x707f
#define MATCH_BGE 0x5063
#define MASK_BGE 0x707f
#define MATCH_BLTU 0x6063
#define MASK_BLTU 0x707f
#define MATCH_BGEU 0x7063
#define MASK_BGEU 0x707f
#define MATCH_JALR 0x67
#define MASK_JALR 0x707f
#define MATCH_JAL 0x6f
#define MASK_JAL 0x7f
#define MATCH_LUI 0x37
#define MASK_LUI 0x7f
#define MATCH_AUIPC 0x17
#define MASK_AUIPC 0x7f
#define MATCH_ADDI 0x13
#define MASK_ADDI 0x707f
#define MATCH_SLLI 0x1013
#define MASK_SLLI 0xfc00707f
#define MATCH_SLTI 0x2013
#define MASK_SLTI 0x707f
#define MATCH_SLTIU 0x3013
#define MASK_SLTIU 0x707f
#define MATCH_XORI 0x4013
#define MASK_XORI 0x707f
#define MATCH_SRLI 0x5013
#define MASK_SRLI 0xfc00707f
#define MATCH_SRAI 0x40005013
#define MASK_SRAI 0xfc00707f
#define MATCH_ORI 0x6013
#define MASK_ORI 0x707f
#define MATCH_ANDI 0x7013
#define MASK_ANDI 0x707f
#define MATCH_ADD 0x33
#define MASK_ADD 0xfe00707f
#define MATCH_SUB 0x40000033
#define MASK_SUB 0xfe00707f
#define MATCH_SLL 0x1033
#define MASK_SLL 0xfe00707f
#define MATCH_SLT 0x2033
#define MASK_SLT 0xfe00707f
#define MATCH_SLTU 0x3033
#define MASK_SLTU 0xfe00707f
#define MATCH_XOR 0x4033
#define MASK_XOR 0xfe00707f
#define MATCH_SRL 0x5033
#define MASK_SRL 0xfe00707f
#define MATCH_SRA 0x40005033
#define MASK_SRA 0xfe00707f
#define MATCH_OR 0x6033
#define MASK_OR 0xfe00707f
#define MATCH_AND 0x7033
#define MASK_AND 0xfe00707f
#define MATCH_ADDIW 0x1b
#define MASK_ADDIW 0x707f
#define MATCH_SLLIW 0x101b
#define MASK_SLLIW 0xfe00707f
#define MATCH_SRLIW 0x501b
#define MASK_SRLIW 0xfe00707f
#define MATCH_SRAIW 0x4000501b
#define MASK_SRAIW 0xfe00707f
#define MATCH_ADDW 0x3b
#define MASK_ADDW 0xfe00707f
#define MATCH_SUBW 0x4000003b
#define MASK_SUBW 0xfe00707f
#define MATCH_SLLW 0x103b
#define MASK_SLLW 0xfe00707f
#define MATCH_SRLW 0x503b
#define MASK_SRLW 0xfe00707f
#define MATCH_SRAW 0x4000503b
#define MASK_SRAW 0xfe00707f
#define MATCH_LB 0x3
#define MASK_LB 0x707f
#define MATCH_LH 0x1003
#define MASK_LH 0x707f
#define MATCH_LW 0x2003
#define MASK_LW 0x707f
#define MATCH_LD 0x3003
#define MASK_LD 0x707f
#define MATCH_LBU 0x4003
#define MASK_LBU 0x707f
#define MATCH_LHU 0x5003
#define MASK_LHU 0x707f
#define MATCH_LWU 0x6003
#define MASK_LWU 0x707f
#define MATCH_SB 0x23
#define MASK_SB 0x707f
#define MATCH_SH 0x1023
#define MASK_SH 0x707f
#define MATCH_SW 0x2023
#define MASK_SW 0x707f
#define MATCH_SD 0x3023
#define MASK_SD 0x707f
#define MATCH_FENCE 0xf
#define MASK_FENCE 0x707f
#define MATCH_FENCE_I 0x100f
#define MASK_FENCE_I 0x707f
#define MATCH_MUL 0x2000033
#define MASK_MUL 0xfe00707f
#define MATCH_MULH 0x2001033
#define MASK_MULH 0xfe00707f
#define MATCH_MULHSU 0x2002033
#define MASK_MULHSU 0xfe00707f
#define MATCH_MULHU 0x2003033
#define MASK_MULHU 0xfe00707f
#define MATCH_DIV 0x2004033
#define MASK_DIV 0xfe00707f
#define MATCH_DIVU 0x2005033
#define MASK_DIVU 0xfe00707f
#define MATCH_REM 0x2006033
#define MASK_REM 0xfe00707f
#define MATCH_REMU 0x2007033
#define MASK_REMU 0xfe00707f
#define MATCH_MULW 0x200003b
#define MASK_MULW 0xfe00707f
#define MATCH_DIVW 0x200403b
#define MASK_DIVW 0xfe00707f
#define MATCH_DIVUW 0x200503b
#define MASK_DIVUW 0xfe00707f
#define MATCH_REMW 0x200603b
#define MASK_REMW 0xfe00707f
#define MATCH_REMUW 0x200703b
#define MASK_REMUW 0xfe00707f
#define MATCH_AMOADD_W 0x202f
#define MASK_AMOADD_W 0xf800707f
#define MATCH_AMOXOR_W 0x2000202f
#define MASK_AMOXOR_W 0xf800707f
#define MATCH_AMOOR_W 0x4000202f
#define MASK_AMOOR_W 0xf800707f
#define MATCH_AMOAND_W 0x6000202f
#define MASK_AMOAND_W 0xf800707f
#define MATCH_AMOMIN_W 0x8000202f
#define MASK_AMOMIN_W 0xf800707f
#define MATCH_AMOMAX_W 0xa000202f
#define MASK_AMOMAX_W 0xf800707f
#define MATCH_AMOMINU_W 0xc000202f
#define MASK_AMOMINU_W 0xf800707f
#define MATCH_AMOMAXU_W 0xe000202f
#define MASK_AMOMAXU_W 0xf800707f
#define MATCH_AMOSWAP_W 0x800202f
#define MASK_AMOSWAP_W 0xf800707f
#define MATCH_LR_W 0x1000202f
#define MASK_LR_W 0xf9f0707f
#define MATCH_SC_W 0x1800202f
#define MASK_SC_W 0xf800707f
#define MATCH_AMOADD_D 0x302f
#define MASK_AMOADD_D 0xf800707f
#define MATCH_AMOXOR_D 0x2000302f
#define MASK_AMOXOR_D 0xf800707f
#define MATCH_AMOOR_D 0x4000302f
#define MASK_AMOOR_D 0xf800707f
#define MATCH_AMOAND_D 0x6000302f
#define MASK_AMOAND_D 0xf800707f
#define MATCH_AMOMIN_D 0x8000302f
#define MASK_AMOMIN_D 0xf800707f
#define MATCH_AMOMAX_D 0xa000302f
#define MASK_AMOMAX_D 0xf800707f
#define MATCH_AMOMINU_D 0xc000302f
#define MASK_AMOMINU_D 0xf800707f
#define MATCH_AMOMAXU_D 0xe000302f
#define MASK_AMOMAXU_D 0xf800707f
#define MATCH_AMOSWAP_D 0x800302f
#define MASK_AMOSWAP_D 0xf800707f
#define MATCH_LR_D 0x1000302f
#define MASK_LR_D 0xf9f0707f
#define MATCH_SC_D 0x1800302f
#define MASK_SC_D 0xf800707f
#define MATCH_ECALL 0x73
#define MASK_ECALL 0xffffffff
#define MATCH_EBREAK 0x100073
#define MASK_EBREAK 0xffffffff
#define MATCH_URET 0x200073
#define MASK_URET 0xffffffff
#define MATCH_SRET 0x10200073
#define MASK_SRET 0xffffffff
#define MATCH_MRET 0x30200073
#define MASK_MRET 0xffffffff
#define MATCH_DRET 0x7b200073
#define MASK_DRET 0xffffffff
#define MATCH_SFENCE_VMA 0x12000073
#define MASK_SFENCE_VMA 0xfe007fff
#define MATCH_WFI 0x10500073
#define MASK_WFI 0xffffffff
#define MATCH_CSRRW 0x1073
#define MASK_CSRRW 0x707f
#define MATCH_CSRRS 0x2073
#define MASK_CSRRS 0x707f
#define MATCH_CSRRC 0x3073
#define MASK_CSRRC 0x707f
#define MATCH_CSRRWI 0x5073
#define MASK_CSRRWI 0x707f
#define MATCH_CSRRSI 0x6073
#define MASK_CSRRSI 0x707f
#define MATCH_CSRRCI 0x7073
#define MASK_CSRRCI 0x707f
#define MATCH_HFENCE_VVMA 0x22000073
#define MASK_HFENCE_VVMA 0xfe007fff
#define MATCH_HFENCE_GVMA 0x62000073
#define MASK_HFENCE_GVMA 0xfe007fff
#define MATCH_FADD_S 0x53
#define MASK_FADD_S 0xfe00007f
#define MATCH_FSUB_S 0x8000053
#define MASK_FSUB_S 0xfe00007f
#define MATCH_FMUL_S 0x10000053
#define MASK_FMUL_S 0xfe00007f
#define MATCH_FDIV_S 0x18000053
#define MASK_FDIV_S 0xfe00007f
#define MATCH_FSGNJ_S 0x20000053
#define MASK_FSGNJ_S 0xfe00707f
#define MATCH_FSGNJN_S 0x20001053
#define MASK_FSGNJN_S 0xfe00707f
#define MATCH_FSGNJX_S 0x20002053
#define MASK_FSGNJX_S 0xfe00707f
#define MATCH_FMIN_S 0x28000053
#define MASK_FMIN_S 0xfe00707f
#define MATCH_FMAX_S 0x28001053
#define MASK_FMAX_S 0xfe00707f
#define MATCH_FSQRT_S 0x58000053
#define MASK_FSQRT_S 0xfff0007f
#define MATCH_FADD_D 0x2000053
#define MASK_FADD_D 0xfe00007f
#define MATCH_FSUB_D 0xa000053
#define MASK_FSUB_D 0xfe00007f
#define MATCH_FMUL_D 0x12000053
#define MASK_FMUL_D 0xfe00007f
#define MATCH_FDIV_D 0x1a000053
#define MASK_FDIV_D 0xfe00007f
#define MATCH_FSGNJ_D 0x22000053
#define MASK_FSGNJ_D 0xfe00707f
#define MATCH_FSGNJN_D 0x22001053
#define MASK_FSGNJN_D 0xfe00707f
#define MATCH_FSGNJX_D 0x22002053
#define MASK_FSGNJX_D 0xfe00707f
#define MATCH_FMIN_D 0x2a000053
#define MASK_FMIN_D 0xfe00707f
#define MATCH_FMAX_D 0x2a001053
#define MASK_FMAX_D 0xfe00707f
#define MATCH_FCVT_S_D 0x40100053
#define MASK_FCVT_S_D 0xfff0007f
#define MATCH_FCVT_D_S 0x42000053
#define MASK_FCVT_D_S 0xfff0007f
#define MATCH_FSQRT_D 0x5a000053
#define MASK_FSQRT_D 0xfff0007f
#define MATCH_FADD_Q 0x6000053
#define MASK_FADD_Q 0xfe00007f
#define MATCH_FSUB_Q 0xe000053
#define MASK_FSUB_Q 0xfe00007f
#define MATCH_FMUL_Q 0x16000053
#define MASK_FMUL_Q 0xfe00007f
#define MATCH_FDIV_Q 0x1e000053
#define MASK_FDIV_Q 0xfe00007f
#define MATCH_FSGNJ_Q 0x26000053
#define MASK_FSGNJ_Q 0xfe00707f
#define MATCH_FSGNJN_Q 0x26001053
#define MASK_FSGNJN_Q 0xfe00707f
#define MATCH_FSGNJX_Q 0x26002053
#define MASK_FSGNJX_Q 0xfe00707f
#define MATCH_FMIN_Q 0x2e000053
#define MASK_FMIN_Q 0xfe00707f
#define MATCH_FMAX_Q 0x2e001053
#define MASK_FMAX_Q 0xfe00707f
#define MATCH_FCVT_S_Q 0x40300053
#define MASK_FCVT_S_Q 0xfff0007f
#define MATCH_FCVT_Q_S 0x46000053
#define MASK_FCVT_Q_S 0xfff0007f
#define MATCH_FCVT_D_Q 0x42300053
#define MASK_FCVT_D_Q 0xfff0007f
#define MATCH_FCVT_Q_D 0x46100053
#define MASK_FCVT_Q_D 0xfff0007f
#define MATCH_FSQRT_Q 0x5e000053
#define MASK_FSQRT_Q 0xfff0007f
#define MATCH_FLE_S 0xa0000053
#define MASK_FLE_S 0xfe00707f
#define MATCH_FLT_S 0xa0001053
#define MASK_FLT_S 0xfe00707f
#define MATCH_FEQ_S 0xa0002053
#define MASK_FEQ_S 0xfe00707f
#define MATCH_FLE_D 0xa2000053
#define MASK_FLE_D 0xfe00707f
#define MATCH_FLT_D 0xa2001053
#define MASK_FLT_D 0xfe00707f
#define MATCH_FEQ_D 0xa2002053
#define MASK_FEQ_D 0xfe00707f
#define MATCH_FLE_Q 0xa6000053
#define MASK_FLE_Q 0xfe00707f
#define MATCH_FLT_Q 0xa6001053
#define MASK_FLT_Q 0xfe00707f
#define MATCH_FEQ_Q 0xa6002053
#define MASK_FEQ_Q 0xfe00707f
#define MATCH_FCVT_W_S 0xc0000053
#define MASK_FCVT_W_S 0xfff0007f
#define MATCH_FCVT_WU_S 0xc0100053
#define MASK_FCVT_WU_S 0xfff0007f
#define MATCH_FCVT_L_S 0xc0200053
#define MASK_FCVT_L_S 0xfff0007f
#define MATCH_FCVT_LU_S 0xc0300053
#define MASK_FCVT_LU_S 0xfff0007f
#define MATCH_FMV_X_W 0xe0000053
#define MASK_FMV_X_W 0xfff0707f
#define MATCH_FCLASS_S 0xe0001053
#define MASK_FCLASS_S 0xfff0707f
#define MATCH_FCVT_W_D 0xc2000053
#define MASK_FCVT_W_D 0xfff0007f
#define MATCH_FCVT_WU_D 0xc2100053
#define MASK_FCVT_WU_D 0xfff0007f
#define MATCH_FCVT_L_D 0xc2200053
#define MASK_FCVT_L_D 0xfff0007f
#define MATCH_FCVT_LU_D 0xc2300053
#define MASK_FCVT_LU_D 0xfff0007f
#define MATCH_FMV_X_D 0xe2000053
#define MASK_FMV_X_D 0xfff0707f
#define MATCH_FCLASS_D 0xe2001053
#define MASK_FCLASS_D 0xfff0707f
#define MATCH_FCVT_W_Q 0xc6000053
#define MASK_FCVT_W_Q 0xfff0007f
#define MATCH_FCVT_WU_Q 0xc6100053
#define MASK_FCVT_WU_Q 0xfff0007f
#define MATCH_FCVT_L_Q 0xc6200053
#define MASK_FCVT_L_Q 0xfff0007f
#define MATCH_FCVT_LU_Q 0xc6300053
#define MASK_FCVT_LU_Q 0xfff0007f
#define MATCH_FMV_X_Q 0xe6000053
#define MASK_FMV_X_Q 0xfff0707f
#define MATCH_FCLASS_Q 0xe6001053
#define MASK_FCLASS_Q 0xfff0707f
#define MATCH_FCVT_S_W 0xd0000053
#define MASK_FCVT_S_W 0xfff0007f
#define MATCH_FCVT_S_WU 0xd0100053
#define MASK_FCVT_S_WU 0xfff0007f
#define MATCH_FCVT_S_L 0xd0200053
#define MASK_FCVT_S_L 0xfff0007f
#define MATCH_FCVT_S_LU 0xd0300053
#define MASK_FCVT_S_LU 0xfff0007f
#define MATCH_FMV_W_X 0xf0000053
#define MASK_FMV_W_X 0xfff0707f
#define MATCH_FCVT_D_W 0xd2000053
#define MASK_FCVT_D_W 0xfff0007f
#define MATCH_FCVT_D_WU 0xd2100053
#define MASK_FCVT_D_WU 0xfff0007f
#define MATCH_FCVT_D_L 0xd2200053
#define MASK_FCVT_D_L 0xfff0007f
#define MATCH_FCVT_D_LU 0xd2300053
#define MASK_FCVT_D_LU 0xfff0007f
#define MATCH_FMV_D_X 0xf2000053
#define MASK_FMV_D_X 0xfff0707f
#define MATCH_FCVT_Q_W 0xd6000053
#define MASK_FCVT_Q_W 0xfff0007f
#define MATCH_FCVT_Q_WU 0xd6100053
#define MASK_FCVT_Q_WU 0xfff0007f
#define MATCH_FCVT_Q_L 0xd6200053
#define MASK_FCVT_Q_L 0xfff0007f
#define MATCH_FCVT_Q_LU 0xd6300053
#define MASK_FCVT_Q_LU 0xfff0007f
#define MATCH_FMV_Q_X 0xf6000053
#define MASK_FMV_Q_X 0xfff0707f
#define MATCH_FLW 0x2007
#define MASK_FLW 0x707f
#define MATCH_FLD 0x3007
#define MASK_FLD 0x707f
#define MATCH_FLQ 0x4007
#define MASK_FLQ 0x707f
#define MATCH_FSW 0x2027
#define MASK_FSW 0x707f
#define MATCH_FSD 0x3027
#define MASK_FSD 0x707f
#define MATCH_FSQ 0x4027
#define MASK_FSQ 0x707f
#define MATCH_FMADD_S 0x43
#define MASK_FMADD_S 0x600007f
#define MATCH_FMSUB_S 0x47
#define MASK_FMSUB_S 0x600007f
#define MATCH_FNMSUB_S 0x4b
#define MASK_FNMSUB_S 0x600007f
#define MATCH_FNMADD_S 0x4f
#define MASK_FNMADD_S 0x600007f
#define MATCH_FMADD_D 0x2000043
#define MASK_FMADD_D 0x600007f
#define MATCH_FMSUB_D 0x2000047
#define MASK_FMSUB_D 0x600007f
#define MATCH_FNMSUB_D 0x200004b
#define MASK_FNMSUB_D 0x600007f
#define MATCH_FNMADD_D 0x200004f
#define MASK_FNMADD_D 0x600007f
#define MATCH_FMADD_Q 0x6000043
#define MASK_FMADD_Q 0x600007f
#define MATCH_FMSUB_Q 0x6000047
#define MASK_FMSUB_Q 0x600007f
#define MATCH_FNMSUB_Q 0x600004b
#define MASK_FNMSUB_Q 0x600007f
#define MATCH_FNMADD_Q 0x600004f
#define MASK_FNMADD_Q 0x600007f
#define MATCH_C_ADDI4SPN 0x0
#define MASK_C_ADDI4SPN 0xe003
#define MATCH_C_FLD 0x2000
#define MASK_C_FLD 0xe003
#define MATCH_C_LW 0x4000
#define MASK_C_LW 0xe003
#define MATCH_C_FLW 0x6000
#define MASK_C_FLW 0xe003
#define MATCH_C_FSD 0xa000
#define MASK_C_FSD 0xe003
#define MATCH_C_SW 0xc000
#define MASK_C_SW 0xe003
#define MATCH_C_FSW 0xe000
#define MASK_C_FSW 0xe003
#define MATCH_C_ADDI 0x1
#define MASK_C_ADDI 0xe003
#define MATCH_C_JAL 0x2001
#define MASK_C_JAL 0xe003
#define MATCH_C_LI 0x4001
#define MASK_C_LI 0xe003
#define MATCH_C_LUI 0x6001
#define MASK_C_LUI 0xe003
#define MATCH_C_SRLI 0x8001
#define MASK_C_SRLI 0xec03
#define MATCH_C_SRAI 0x8401
#define MASK_C_SRAI 0xec03
#define MATCH_C_ANDI 0x8801
#define MASK_C_ANDI 0xec03
#define MATCH_C_SUB 0x8c01
#define MASK_C_SUB 0xfc63
#define MATCH_C_XOR 0x8c21
#define MASK_C_XOR 0xfc63
#define MATCH_C_OR 0x8c41
#define MASK_C_OR 0xfc63
#define MATCH_C_AND 0x8c61
#define MASK_C_AND 0xfc63
#define MATCH_C_SUBW 0x9c01
#define MASK_C_SUBW 0xfc63
#define MATCH_C_ADDW 0x9c21
#define MASK_C_ADDW 0xfc63
#define MATCH_C_J 0xa001
#define MASK_C_J 0xe003
#define MATCH_C_BEQZ 0xc001
#define MASK_C_BEQZ 0xe003
#define MATCH_C_BNEZ 0xe001
#define MASK_C_BNEZ 0xe003
#define MATCH_C_SLLI 0x2
#define MASK_C_SLLI 0xe003
#define MATCH_C_FLDSP 0x2002
#define MASK_C_FLDSP 0xe003
#define MATCH_C_LWSP 0x4002
#define MASK_C_LWSP 0xe003
#define MATCH_C_FLWSP 0x6002
#define MASK_C_FLWSP 0xe003
#define MATCH_C_MV 0x8002
#define MASK_C_MV 0xf003
#define MATCH_C_ADD 0x9002
#define MASK_C_ADD 0xf003
#define MATCH_C_FSDSP 0xa002
#define MASK_C_FSDSP 0xe003
#define MATCH_C_SWSP 0xc002
#define MASK_C_SWSP 0xe003
#define MATCH_C_FSWSP 0xe002
#define MASK_C_FSWSP 0xe003
#define CSR_FFLAGS 0x1
#define CSR_FRM 0x2
#define CSR_FCSR 0x3
#define CSR_USTATUS 0x0
#define CSR_UIE 0x4
#define CSR_UTVEC 0x5
#define CSR_VSTART 0x8
#define CSR_VXSAT 0x9
#define CSR_VXRM 0xa
#define CSR_USCRATCH 0x40
#define CSR_UEPC 0x41
#define CSR_UCAUSE 0x42
#define CSR_UTVAL 0x43
#define CSR_UIP 0x44
#define CSR_CYCLE 0xc00
#define CSR_TIME 0xc01
#define CSR_INSTRET 0xc02
#define CSR_HPMCOUNTER3 0xc03
#define CSR_HPMCOUNTER4 0xc04
#define CSR_HPMCOUNTER5 0xc05
#define CSR_HPMCOUNTER6 0xc06
#define CSR_HPMCOUNTER7 0xc07
#define CSR_HPMCOUNTER8 0xc08
#define CSR_HPMCOUNTER9 0xc09
#define CSR_HPMCOUNTER10 0xc0a
#define CSR_HPMCOUNTER11 0xc0b
#define CSR_HPMCOUNTER12 0xc0c
#define CSR_HPMCOUNTER13 0xc0d
#define CSR_HPMCOUNTER14 0xc0e
#define CSR_HPMCOUNTER15 0xc0f
#define CSR_HPMCOUNTER16 0xc10
#define CSR_HPMCOUNTER17 0xc11
#define CSR_HPMCOUNTER18 0xc12
#define CSR_HPMCOUNTER19 0xc13
#define CSR_HPMCOUNTER20 0xc14
#define CSR_HPMCOUNTER21 0xc15
#define CSR_HPMCOUNTER22 0xc16
#define CSR_HPMCOUNTER23 0xc17
#define CSR_HPMCOUNTER24 0xc18
#define CSR_HPMCOUNTER25 0xc19
#define CSR_HPMCOUNTER26 0xc1a
#define CSR_HPMCOUNTER27 0xc1b
#define CSR_HPMCOUNTER28 0xc1c
#define CSR_HPMCOUNTER29 0xc1d
#define CSR_HPMCOUNTER30 0xc1e
#define CSR_HPMCOUNTER31 0xc1f
#define CSR_VL 0xc20
#define CSR_VTYPE 0xc21
#define CSR_VLENB 0xc22
#define CSR_SSTATUS 0x100
#define CSR_SIE 0x104
#define CSR_STVEC 0x105
#define CSR_SCOUNTEREN 0x106
#define CSR_SSCRATCH 0x140
#define CSR_SEPC 0x141
#define CSR_SCAUSE 0x142
#define CSR_STVAL 0x143
#define CSR_SIP 0x144
#define CSR_SATP 0x180
#define CSR_VSSTATUS 0x200
#define CSR_VSIE 0x204
#define CSR_VSTVEC 0x205
#define CSR_VSSCRATCH 0x240
#define CSR_VSEPC 0x241
#define CSR_VSCAUSE 0x242
#define CSR_VSTVAL 0x243
#define CSR_VSIP 0x244
#define CSR_VSATP 0x280
#define CSR_HSTATUS 0x600
#define CSR_HEDELEG 0x602
#define CSR_HIDELEG 0x603
#define CSR_HCOUNTEREN 0x606
#define CSR_HGATP 0x680
#define CSR_UTVT 0x7
#define CSR_UNXTI 0x45
#define CSR_UINTSTATUS 0x46
#define CSR_USCRATCHCSW 0x48
#define CSR_USCRATCHCSWL 0x49
#define CSR_STVT 0x107
#define CSR_SNXTI 0x145
#define CSR_SINTSTATUS 0x146
#define CSR_SSCRATCHCSW 0x148
#define CSR_SSCRATCHCSWL 0x149
#define CSR_MTVT 0x307
#define CSR_MNXTI 0x345
#define CSR_MINTSTATUS 0x346
#define CSR_MSCRATCHCSW 0x348
#define CSR_MSCRATCHCSWL 0x349
#define CSR_MSTATUS 0x300
#define CSR_MISA 0x301
#define CSR_MEDELEG 0x302
#define CSR_MIDELEG 0x303
#define CSR_MIE 0x304
#define CSR_MTVEC 0x305
#define CSR_MCOUNTEREN 0x306
#define CSR_MSCRATCH 0x340
#define CSR_MEPC 0x341
#define CSR_MCAUSE 0x342
#define CSR_MTVAL 0x343
#define CSR_MIP 0x344
#define CSR_PMPCFG0 0x3a0
#define CSR_PMPCFG1 0x3a1
#define CSR_PMPCFG2 0x3a2
#define CSR_PMPCFG3 0x3a3
#define CSR_PMPADDR0 0x3b0
#define CSR_PMPADDR1 0x3b1
#define CSR_PMPADDR2 0x3b2
#define CSR_PMPADDR3 0x3b3
#define CSR_PMPADDR4 0x3b4
#define CSR_PMPADDR5 0x3b5
#define CSR_PMPADDR6 0x3b6
#define CSR_PMPADDR7 0x3b7
#define CSR_PMPADDR8 0x3b8
#define CSR_PMPADDR9 0x3b9
#define CSR_PMPADDR10 0x3ba
#define CSR_PMPADDR11 0x3bb
#define CSR_PMPADDR12 0x3bc
#define CSR_PMPADDR13 0x3bd
#define CSR_PMPADDR14 0x3be
#define CSR_PMPADDR15 0x3bf
#define CSR_TSELECT 0x7a0
#define CSR_TDATA1 0x7a1
#define CSR_TDATA2 0x7a2
#define CSR_TDATA3 0x7a3
#define CSR_DCSR 0x7b0
#define CSR_DPC 0x7b1
#define CSR_DSCRATCH 0x7b2
#define CSR_MCYCLE 0xb00
#define CSR_MINSTRET 0xb02
#define CSR_MHPMCOUNTER3 0xb03
#define CSR_MHPMCOUNTER4 0xb04
#define CSR_MHPMCOUNTER5 0xb05
#define CSR_MHPMCOUNTER6 0xb06
#define CSR_MHPMCOUNTER7 0xb07
#define CSR_MHPMCOUNTER8 0xb08
#define CSR_MHPMCOUNTER9 0xb09
#define CSR_MHPMCOUNTER10 0xb0a
#define CSR_MHPMCOUNTER11 0xb0b
#define CSR_MHPMCOUNTER12 0xb0c
#define CSR_MHPMCOUNTER13 0xb0d
#define CSR_MHPMCOUNTER14 0xb0e
#define CSR_MHPMCOUNTER15 0xb0f
#define CSR_MHPMCOUNTER16 0xb10
#define CSR_MHPMCOUNTER17 0xb11
#define CSR_MHPMCOUNTER18 0xb12
#define CSR_MHPMCOUNTER19 0xb13
#define CSR_MHPMCOUNTER20 0xb14
#define CSR_MHPMCOUNTER21 0xb15
#define CSR_MHPMCOUNTER22 0xb16
#define CSR_MHPMCOUNTER23 0xb17
#define CSR_MHPMCOUNTER24 0xb18
#define CSR_MHPMCOUNTER25 0xb19
#define CSR_MHPMCOUNTER26 0xb1a
#define CSR_MHPMCOUNTER27 0xb1b
#define CSR_MHPMCOUNTER28 0xb1c
#define CSR_MHPMCOUNTER29 0xb1d
#define CSR_MHPMCOUNTER30 0xb1e
#define CSR_MHPMCOUNTER31 0xb1f
#define CSR_MHPMEVENT3 0x323
#define CSR_MHPMEVENT4 0x324
#define CSR_MHPMEVENT5 0x325
#define CSR_MHPMEVENT6 0x326
#define CSR_MHPMEVENT7 0x327
#define CSR_MHPMEVENT8 0x328
#define CSR_MHPMEVENT9 0x329
#define CSR_MHPMEVENT10 0x32a
#define CSR_MHPMEVENT11 0x32b
#define CSR_MHPMEVENT12 0x32c
#define CSR_MHPMEVENT13 0x32d
#define CSR_MHPMEVENT14 0x32e
#define CSR_MHPMEVENT15 0x32f
#define CSR_MHPMEVENT16 0x330
#define CSR_MHPMEVENT17 0x331
#define CSR_MHPMEVENT18 0x332
#define CSR_MHPMEVENT19 0x333
#define CSR_MHPMEVENT20 0x334
#define CSR_MHPMEVENT21 0x335
#define CSR_MHPMEVENT22 0x336
#define CSR_MHPMEVENT23 0x337
#define CSR_MHPMEVENT24 0x338
#define CSR_MHPMEVENT25 0x339
#define CSR_MHPMEVENT26 0x33a
#define CSR_MHPMEVENT27 0x33b
#define CSR_MHPMEVENT28 0x33c
#define CSR_MHPMEVENT29 0x33d
#define CSR_MHPMEVENT30 0x33e
#define CSR_MHPMEVENT31 0x33f
#define CSR_MVENDORID 0xf11
#define CSR_MARCHID 0xf12
#define CSR_MIMPID 0xf13
#define CSR_MHARTID 0xf14
#define CSR_CYCLEH 0xc80
#define CSR_TIMEH 0xc81
#define CSR_INSTRETH 0xc82
#define CSR_HPMCOUNTER3H 0xc83
#define CSR_HPMCOUNTER4H 0xc84
#define CSR_HPMCOUNTER5H 0xc85
#define CSR_HPMCOUNTER6H 0xc86
#define CSR_HPMCOUNTER7H 0xc87
#define CSR_HPMCOUNTER8H 0xc88
#define CSR_HPMCOUNTER9H 0xc89
#define CSR_HPMCOUNTER10H 0xc8a
#define CSR_HPMCOUNTER11H 0xc8b
#define CSR_HPMCOUNTER12H 0xc8c
#define CSR_HPMCOUNTER13H 0xc8d
#define CSR_HPMCOUNTER14H 0xc8e
#define CSR_HPMCOUNTER15H 0xc8f
#define CSR_HPMCOUNTER16H 0xc90
#define CSR_HPMCOUNTER17H 0xc91
#define CSR_HPMCOUNTER18H 0xc92
#define CSR_HPMCOUNTER19H 0xc93
#define CSR_HPMCOUNTER20H 0xc94
#define CSR_HPMCOUNTER21H 0xc95
#define CSR_HPMCOUNTER22H 0xc96
#define CSR_HPMCOUNTER23H 0xc97
#define CSR_HPMCOUNTER24H 0xc98
#define CSR_HPMCOUNTER25H 0xc99
#define CSR_HPMCOUNTER26H 0xc9a
#define CSR_HPMCOUNTER27H 0xc9b
#define CSR_HPMCOUNTER28H 0xc9c
#define CSR_HPMCOUNTER29H 0xc9d
#define CSR_HPMCOUNTER30H 0xc9e
#define CSR_HPMCOUNTER31H 0xc9f
#define CSR_MCYCLEH 0xb80
#define CSR_MINSTRETH 0xb82
#define CSR_MHPMCOUNTER3H 0xb83
#define CSR_MHPMCOUNTER4H 0xb84
#define CSR_MHPMCOUNTER5H 0xb85
#define CSR_MHPMCOUNTER6H 0xb86
#define CSR_MHPMCOUNTER7H 0xb87
#define CSR_MHPMCOUNTER8H 0xb88
#define CSR_MHPMCOUNTER9H 0xb89
#define CSR_MHPMCOUNTER10H 0xb8a
#define CSR_MHPMCOUNTER11H 0xb8b
#define CSR_MHPMCOUNTER12H 0xb8c
#define CSR_MHPMCOUNTER13H 0xb8d
#define CSR_MHPMCOUNTER14H 0xb8e
#define CSR_MHPMCOUNTER15H 0xb8f
#define CSR_MHPMCOUNTER16H 0xb90
#define CSR_MHPMCOUNTER17H 0xb91
#define CSR_MHPMCOUNTER18H 0xb92
#define CSR_MHPMCOUNTER19H 0xb93
#define CSR_MHPMCOUNTER20H 0xb94
#define CSR_MHPMCOUNTER21H 0xb95
#define CSR_MHPMCOUNTER22H 0xb96
#define CSR_MHPMCOUNTER23H 0xb97
#define CSR_MHPMCOUNTER24H 0xb98
#define CSR_MHPMCOUNTER25H 0xb99
#define CSR_MHPMCOUNTER26H 0xb9a
#define CSR_MHPMCOUNTER27H 0xb9b
#define CSR_MHPMCOUNTER28H 0xb9c
#define CSR_MHPMCOUNTER29H 0xb9d
#define CSR_MHPMCOUNTER30H 0xb9e
#define CSR_MHPMCOUNTER31H 0xb9f
#define CAUSE_MISALIGNED_FETCH 0x0
#define CAUSE_FETCH_ACCESS 0x1
#define CAUSE_ILLEGAL_INSTRUCTION 0x2
#define CAUSE_BREAKPOINT 0x3
#define CAUSE_MISALIGNED_LOAD 0x4
#define CAUSE_LOAD_ACCESS 0x5
#define CAUSE_MISALIGNED_STORE 0x6
#define CAUSE_STORE_ACCESS 0x7
#define CAUSE_USER_ECALL 0x8
#define CAUSE_SUPERVISOR_ECALL 0x9
#define CAUSE_HYPERVISOR_ECALL 0xa
#define CAUSE_MACHINE_ECALL 0xb
#define CAUSE_FETCH_PAGE_FAULT 0xc
#define CAUSE_LOAD_PAGE_FAULT 0xd
#define CAUSE_STORE_PAGE_FAULT 0xf
#endif
#ifdef DECLARE_INSN
DECLARE_INSN(beq, MATCH_BEQ, MASK_BEQ)
DECLARE_INSN(bne, MATCH_BNE, MASK_BNE)
DECLARE_INSN(blt, MATCH_BLT, MASK_BLT)
DECLARE_INSN(bge, MATCH_BGE, MASK_BGE)
DECLARE_INSN(bltu, MATCH_BLTU, MASK_BLTU)
DECLARE_INSN(bgeu, MATCH_BGEU, MASK_BGEU)
DECLARE_INSN(jalr, MATCH_JALR, MASK_JALR)
DECLARE_INSN(jal, MATCH_JAL, MASK_JAL)
DECLARE_INSN(lui, MATCH_LUI, MASK_LUI)
DECLARE_INSN(auipc, MATCH_AUIPC, MASK_AUIPC)
DECLARE_INSN(addi, MATCH_ADDI, MASK_ADDI)
DECLARE_INSN(slli, MATCH_SLLI, MASK_SLLI)
DECLARE_INSN(slti, MATCH_SLTI, MASK_SLTI)
DECLARE_INSN(sltiu, MATCH_SLTIU, MASK_SLTIU)
DECLARE_INSN(xori, MATCH_XORI, MASK_XORI)
DECLARE_INSN(srli, MATCH_SRLI, MASK_SRLI)
DECLARE_INSN(srai, MATCH_SRAI, MASK_SRAI)
DECLARE_INSN(ori, MATCH_ORI, MASK_ORI)
DECLARE_INSN(andi, MATCH_ANDI, MASK_ANDI)
DECLARE_INSN(add, MATCH_ADD, MASK_ADD)
DECLARE_INSN(sub, MATCH_SUB, MASK_SUB)
DECLARE_INSN(sll, MATCH_SLL, MASK_SLL)
DECLARE_INSN(slt, MATCH_SLT, MASK_SLT)
DECLARE_INSN(sltu, MATCH_SLTU, MASK_SLTU)
DECLARE_INSN (xor, MATCH_XOR, MASK_XOR)
DECLARE_INSN(srl, MATCH_SRL, MASK_SRL)
DECLARE_INSN(sra, MATCH_SRA, MASK_SRA)
DECLARE_INSN(or, MATCH_OR, MASK_OR)
DECLARE_INSN(and, MATCH_AND, MASK_AND)
DECLARE_INSN(addiw, MATCH_ADDIW, MASK_ADDIW)
DECLARE_INSN(slliw, MATCH_SLLIW, MASK_SLLIW)
DECLARE_INSN(srliw, MATCH_SRLIW, MASK_SRLIW)
DECLARE_INSN(sraiw, MATCH_SRAIW, MASK_SRAIW)
DECLARE_INSN(addw, MATCH_ADDW, MASK_ADDW)
DECLARE_INSN(subw, MATCH_SUBW, MASK_SUBW)
DECLARE_INSN(sllw, MATCH_SLLW, MASK_SLLW)
DECLARE_INSN(srlw, MATCH_SRLW, MASK_SRLW)
DECLARE_INSN(sraw, MATCH_SRAW, MASK_SRAW)
DECLARE_INSN(lb, MATCH_LB, MASK_LB)
DECLARE_INSN(lh, MATCH_LH, MASK_LH)
DECLARE_INSN(lw, MATCH_LW, MASK_LW)
DECLARE_INSN(ld, MATCH_LD, MASK_LD)
DECLARE_INSN(lbu, MATCH_LBU, MASK_LBU)
DECLARE_INSN(lhu, MATCH_LHU, MASK_LHU)
DECLARE_INSN(lwu, MATCH_LWU, MASK_LWU)
DECLARE_INSN(sb, MATCH_SB, MASK_SB)
DECLARE_INSN(sh, MATCH_SH, MASK_SH)
DECLARE_INSN(sw, MATCH_SW, MASK_SW)
DECLARE_INSN(sd, MATCH_SD, MASK_SD)
DECLARE_INSN(fence, MATCH_FENCE, MASK_FENCE)
DECLARE_INSN(fence_i, MATCH_FENCE_I, MASK_FENCE_I)
DECLARE_INSN(mul, MATCH_MUL, MASK_MUL)
DECLARE_INSN(mulh, MATCH_MULH, MASK_MULH)
DECLARE_INSN(mulhsu, MATCH_MULHSU, MASK_MULHSU)
DECLARE_INSN(mulhu, MATCH_MULHU, MASK_MULHU)
DECLARE_INSN(div, MATCH_DIV, MASK_DIV)
DECLARE_INSN(divu, MATCH_DIVU, MASK_DIVU)
DECLARE_INSN(rem, MATCH_REM, MASK_REM)
DECLARE_INSN(remu, MATCH_REMU, MASK_REMU)
DECLARE_INSN(mulw, MATCH_MULW, MASK_MULW)
DECLARE_INSN(divw, MATCH_DIVW, MASK_DIVW)
DECLARE_INSN(divuw, MATCH_DIVUW, MASK_DIVUW)
DECLARE_INSN(remw, MATCH_REMW, MASK_REMW)
DECLARE_INSN(remuw, MATCH_REMUW, MASK_REMUW)
DECLARE_INSN(amoadd_w, MATCH_AMOADD_W, MASK_AMOADD_W)
DECLARE_INSN(amoxor_w, MATCH_AMOXOR_W, MASK_AMOXOR_W)
DECLARE_INSN(amoor_w, MATCH_AMOOR_W, MASK_AMOOR_W)
DECLARE_INSN(amoand_w, MATCH_AMOAND_W, MASK_AMOAND_W)
DECLARE_INSN(amomin_w, MATCH_AMOMIN_W, MASK_AMOMIN_W)
DECLARE_INSN(amomax_w, MATCH_AMOMAX_W, MASK_AMOMAX_W)
DECLARE_INSN(amominu_w, MATCH_AMOMINU_W, MASK_AMOMINU_W)
DECLARE_INSN(amomaxu_w, MATCH_AMOMAXU_W, MASK_AMOMAXU_W)
DECLARE_INSN(amoswap_w, MATCH_AMOSWAP_W, MASK_AMOSWAP_W)
DECLARE_INSN(lr_w, MATCH_LR_W, MASK_LR_W)
DECLARE_INSN(sc_w, MATCH_SC_W, MASK_SC_W)
DECLARE_INSN(amoadd_d, MATCH_AMOADD_D, MASK_AMOADD_D)
DECLARE_INSN(amoxor_d, MATCH_AMOXOR_D, MASK_AMOXOR_D)
DECLARE_INSN(amoor_d, MATCH_AMOOR_D, MASK_AMOOR_D)
DECLARE_INSN(amoand_d, MATCH_AMOAND_D, MASK_AMOAND_D)
DECLARE_INSN(amomin_d, MATCH_AMOMIN_D, MASK_AMOMIN_D)
DECLARE_INSN(amomax_d, MATCH_AMOMAX_D, MASK_AMOMAX_D)
DECLARE_INSN(amominu_d, MATCH_AMOMINU_D, MASK_AMOMINU_D)
DECLARE_INSN(amomaxu_d, MATCH_AMOMAXU_D, MASK_AMOMAXU_D)
DECLARE_INSN(amoswap_d, MATCH_AMOSWAP_D, MASK_AMOSWAP_D)
DECLARE_INSN(lr_d, MATCH_LR_D, MASK_LR_D)
DECLARE_INSN(sc_d, MATCH_SC_D, MASK_SC_D)
DECLARE_INSN(ecall, MATCH_ECALL, MASK_ECALL)
DECLARE_INSN(ebreak, MATCH_EBREAK, MASK_EBREAK)
DECLARE_INSN(uret, MATCH_URET, MASK_URET)
DECLARE_INSN(sret, MATCH_SRET, MASK_SRET)
DECLARE_INSN(mret, MATCH_MRET, MASK_MRET)
DECLARE_INSN(dret, MATCH_DRET, MASK_DRET)
DECLARE_INSN(sfence_vma, MATCH_SFENCE_VMA, MASK_SFENCE_VMA)
DECLARE_INSN(wfi, MATCH_WFI, MASK_WFI)
DECLARE_INSN(csrrw, MATCH_CSRRW, MASK_CSRRW)
DECLARE_INSN(csrrs, MATCH_CSRRS, MASK_CSRRS)
DECLARE_INSN(csrrc, MATCH_CSRRC, MASK_CSRRC)
DECLARE_INSN(csrrwi, MATCH_CSRRWI, MASK_CSRRWI)
DECLARE_INSN(csrrsi, MATCH_CSRRSI, MASK_CSRRSI)
DECLARE_INSN(csrrci, MATCH_CSRRCI, MASK_CSRRCI)
DECLARE_INSN(hfence_vvma, MATCH_HFENCE_VVMA, MASK_HFENCE_VVMA)
DECLARE_INSN(hfence_gvma, MATCH_HFENCE_GVMA, MASK_HFENCE_GVMA)
DECLARE_INSN(fadd_s, MATCH_FADD_S, MASK_FADD_S)
DECLARE_INSN(fsub_s, MATCH_FSUB_S, MASK_FSUB_S)
DECLARE_INSN(fmul_s, MATCH_FMUL_S, MASK_FMUL_S)
DECLARE_INSN(fdiv_s, MATCH_FDIV_S, MASK_FDIV_S)
DECLARE_INSN(fsgnj_s, MATCH_FSGNJ_S, MASK_FSGNJ_S)
DECLARE_INSN(fsgnjn_s, MATCH_FSGNJN_S, MASK_FSGNJN_S)
DECLARE_INSN(fsgnjx_s, MATCH_FSGNJX_S, MASK_FSGNJX_S)
DECLARE_INSN(fmin_s, MATCH_FMIN_S, MASK_FMIN_S)
DECLARE_INSN(fmax_s, MATCH_FMAX_S, MASK_FMAX_S)
DECLARE_INSN(fsqrt_s, MATCH_FSQRT_S, MASK_FSQRT_S)
DECLARE_INSN(fadd_d, MATCH_FADD_D, MASK_FADD_D)
DECLARE_INSN(fsub_d, MATCH_FSUB_D, MASK_FSUB_D)
DECLARE_INSN(fmul_d, MATCH_FMUL_D, MASK_FMUL_D)
DECLARE_INSN(fdiv_d, MATCH_FDIV_D, MASK_FDIV_D)
DECLARE_INSN(fsgnj_d, MATCH_FSGNJ_D, MASK_FSGNJ_D)
DECLARE_INSN(fsgnjn_d, MATCH_FSGNJN_D, MASK_FSGNJN_D)
DECLARE_INSN(fsgnjx_d, MATCH_FSGNJX_D, MASK_FSGNJX_D)
DECLARE_INSN(fmin_d, MATCH_FMIN_D, MASK_FMIN_D)
DECLARE_INSN(fmax_d, MATCH_FMAX_D, MASK_FMAX_D)
DECLARE_INSN(fcvt_s_d, MATCH_FCVT_S_D, MASK_FCVT_S_D)
DECLARE_INSN(fcvt_d_s, MATCH_FCVT_D_S, MASK_FCVT_D_S)
DECLARE_INSN(fsqrt_d, MATCH_FSQRT_D, MASK_FSQRT_D)
DECLARE_INSN(fadd_q, MATCH_FADD_Q, MASK_FADD_Q)
DECLARE_INSN(fsub_q, MATCH_FSUB_Q, MASK_FSUB_Q)
DECLARE_INSN(fmul_q, MATCH_FMUL_Q, MASK_FMUL_Q)
DECLARE_INSN(fdiv_q, MATCH_FDIV_Q, MASK_FDIV_Q)
DECLARE_INSN(fsgnj_q, MATCH_FSGNJ_Q, MASK_FSGNJ_Q)
DECLARE_INSN(fsgnjn_q, MATCH_FSGNJN_Q, MASK_FSGNJN_Q)
DECLARE_INSN(fsgnjx_q, MATCH_FSGNJX_Q, MASK_FSGNJX_Q)
DECLARE_INSN(fmin_q, MATCH_FMIN_Q, MASK_FMIN_Q)
DECLARE_INSN(fmax_q, MATCH_FMAX_Q, MASK_FMAX_Q)
DECLARE_INSN(fcvt_s_q, MATCH_FCVT_S_Q, MASK_FCVT_S_Q)
DECLARE_INSN(fcvt_q_s, MATCH_FCVT_Q_S, MASK_FCVT_Q_S)
DECLARE_INSN(fcvt_d_q, MATCH_FCVT_D_Q, MASK_FCVT_D_Q)
DECLARE_INSN(fcvt_q_d, MATCH_FCVT_Q_D, MASK_FCVT_Q_D)
DECLARE_INSN(fsqrt_q, MATCH_FSQRT_Q, MASK_FSQRT_Q)
DECLARE_INSN(fle_s, MATCH_FLE_S, MASK_FLE_S)
DECLARE_INSN(flt_s, MATCH_FLT_S, MASK_FLT_S)
DECLARE_INSN(feq_s, MATCH_FEQ_S, MASK_FEQ_S)
DECLARE_INSN(fle_d, MATCH_FLE_D, MASK_FLE_D)
DECLARE_INSN(flt_d, MATCH_FLT_D, MASK_FLT_D)
DECLARE_INSN(feq_d, MATCH_FEQ_D, MASK_FEQ_D)
DECLARE_INSN(fle_q, MATCH_FLE_Q, MASK_FLE_Q)
DECLARE_INSN(flt_q, MATCH_FLT_Q, MASK_FLT_Q)
DECLARE_INSN(feq_q, MATCH_FEQ_Q, MASK_FEQ_Q)
DECLARE_INSN(fcvt_w_s, MATCH_FCVT_W_S, MASK_FCVT_W_S)
DECLARE_INSN(fcvt_wu_s, MATCH_FCVT_WU_S, MASK_FCVT_WU_S)
DECLARE_INSN(fcvt_l_s, MATCH_FCVT_L_S, MASK_FCVT_L_S)
DECLARE_INSN(fcvt_lu_s, MATCH_FCVT_LU_S, MASK_FCVT_LU_S)
DECLARE_INSN(fmv_x_w, MATCH_FMV_X_W, MASK_FMV_X_W)
DECLARE_INSN(fclass_s, MATCH_FCLASS_S, MASK_FCLASS_S)
DECLARE_INSN(fcvt_w_d, MATCH_FCVT_W_D, MASK_FCVT_W_D)
DECLARE_INSN(fcvt_wu_d, MATCH_FCVT_WU_D, MASK_FCVT_WU_D)
DECLARE_INSN(fcvt_l_d, MATCH_FCVT_L_D, MASK_FCVT_L_D)
DECLARE_INSN(fcvt_lu_d, MATCH_FCVT_LU_D, MASK_FCVT_LU_D)
DECLARE_INSN(fmv_x_d, MATCH_FMV_X_D, MASK_FMV_X_D)
DECLARE_INSN(fclass_d, MATCH_FCLASS_D, MASK_FCLASS_D)
DECLARE_INSN(fcvt_w_q, MATCH_FCVT_W_Q, MASK_FCVT_W_Q)
DECLARE_INSN(fcvt_wu_q, MATCH_FCVT_WU_Q, MASK_FCVT_WU_Q)
DECLARE_INSN(fcvt_l_q, MATCH_FCVT_L_Q, MASK_FCVT_L_Q)
DECLARE_INSN(fcvt_lu_q, MATCH_FCVT_LU_Q, MASK_FCVT_LU_Q)
DECLARE_INSN(fmv_x_q, MATCH_FMV_X_Q, MASK_FMV_X_Q)
DECLARE_INSN(fclass_q, MATCH_FCLASS_Q, MASK_FCLASS_Q)
DECLARE_INSN(fcvt_s_w, MATCH_FCVT_S_W, MASK_FCVT_S_W)
DECLARE_INSN(fcvt_s_wu, MATCH_FCVT_S_WU, MASK_FCVT_S_WU)
DECLARE_INSN(fcvt_s_l, MATCH_FCVT_S_L, MASK_FCVT_S_L)
DECLARE_INSN(fcvt_s_lu, MATCH_FCVT_S_LU, MASK_FCVT_S_LU)
DECLARE_INSN(fmv_w_x, MATCH_FMV_W_X, MASK_FMV_W_X)
DECLARE_INSN(fcvt_d_w, MATCH_FCVT_D_W, MASK_FCVT_D_W)
DECLARE_INSN(fcvt_d_wu, MATCH_FCVT_D_WU, MASK_FCVT_D_WU)
DECLARE_INSN(fcvt_d_l, MATCH_FCVT_D_L, MASK_FCVT_D_L)
DECLARE_INSN(fcvt_d_lu, MATCH_FCVT_D_LU, MASK_FCVT_D_LU)
DECLARE_INSN(fmv_d_x, MATCH_FMV_D_X, MASK_FMV_D_X)
DECLARE_INSN(fcvt_q_w, MATCH_FCVT_Q_W, MASK_FCVT_Q_W)
DECLARE_INSN(fcvt_q_wu, MATCH_FCVT_Q_WU, MASK_FCVT_Q_WU)
DECLARE_INSN(fcvt_q_l, MATCH_FCVT_Q_L, MASK_FCVT_Q_L)
DECLARE_INSN(fcvt_q_lu, MATCH_FCVT_Q_LU, MASK_FCVT_Q_LU)
DECLARE_INSN(fmv_q_x, MATCH_FMV_Q_X, MASK_FMV_Q_X)
DECLARE_INSN(flw, MATCH_FLW, MASK_FLW)
DECLARE_INSN(fld, MATCH_FLD, MASK_FLD)
DECLARE_INSN(flq, MATCH_FLQ, MASK_FLQ)
DECLARE_INSN(fsw, MATCH_FSW, MASK_FSW)
DECLARE_INSN(fsd, MATCH_FSD, MASK_FSD)
DECLARE_INSN(fsq, MATCH_FSQ, MASK_FSQ)
DECLARE_INSN(fmadd_s, MATCH_FMADD_S, MASK_FMADD_S)
DECLARE_INSN(fmsub_s, MATCH_FMSUB_S, MASK_FMSUB_S)
DECLARE_INSN(fnmsub_s, MATCH_FNMSUB_S, MASK_FNMSUB_S)
DECLARE_INSN(fnmadd_s, MATCH_FNMADD_S, MASK_FNMADD_S)
DECLARE_INSN(fmadd_d, MATCH_FMADD_D, MASK_FMADD_D)
DECLARE_INSN(fmsub_d, MATCH_FMSUB_D, MASK_FMSUB_D)
DECLARE_INSN(fnmsub_d, MATCH_FNMSUB_D, MASK_FNMSUB_D)
DECLARE_INSN(fnmadd_d, MATCH_FNMADD_D, MASK_FNMADD_D)
DECLARE_INSN(fmadd_q, MATCH_FMADD_Q, MASK_FMADD_Q)
DECLARE_INSN(fmsub_q, MATCH_FMSUB_Q, MASK_FMSUB_Q)
DECLARE_INSN(fnmsub_q, MATCH_FNMSUB_Q, MASK_FNMSUB_Q)
DECLARE_INSN(fnmadd_q, MATCH_FNMADD_Q, MASK_FNMADD_Q)
DECLARE_INSN(c_addi4spn, MATCH_C_ADDI4SPN, MASK_C_ADDI4SPN)
DECLARE_INSN(c_fld, MATCH_C_FLD, MASK_C_FLD)
DECLARE_INSN(c_lw, MATCH_C_LW, MASK_C_LW)
DECLARE_INSN(c_flw, MATCH_C_FLW, MASK_C_FLW)
DECLARE_INSN(c_fsd, MATCH_C_FSD, MASK_C_FSD)
DECLARE_INSN(c_sw, MATCH_C_SW, MASK_C_SW)
DECLARE_INSN(c_fsw, MATCH_C_FSW, MASK_C_FSW)
DECLARE_INSN(c_addi, MATCH_C_ADDI, MASK_C_ADDI)
DECLARE_INSN(c_jal, MATCH_C_JAL, MASK_C_JAL)
DECLARE_INSN(c_li, MATCH_C_LI, MASK_C_LI)
DECLARE_INSN(c_lui, MATCH_C_LUI, MASK_C_LUI)
DECLARE_INSN(c_srli, MATCH_C_SRLI, MASK_C_SRLI)
DECLARE_INSN(c_srai, MATCH_C_SRAI, MASK_C_SRAI)
DECLARE_INSN(c_andi, MATCH_C_ANDI, MASK_C_ANDI)
DECLARE_INSN(c_sub, MATCH_C_SUB, MASK_C_SUB)
DECLARE_INSN(c_xor, MATCH_C_XOR, MASK_C_XOR)
DECLARE_INSN(c_or, MATCH_C_OR, MASK_C_OR)
DECLARE_INSN(c_and, MATCH_C_AND, MASK_C_AND)
DECLARE_INSN(c_subw, MATCH_C_SUBW, MASK_C_SUBW)
DECLARE_INSN(c_addw, MATCH_C_ADDW, MASK_C_ADDW)
DECLARE_INSN(c_j, MATCH_C_J, MASK_C_J)
DECLARE_INSN(c_beqz, MATCH_C_BEQZ, MASK_C_BEQZ)
DECLARE_INSN(c_bnez, MATCH_C_BNEZ, MASK_C_BNEZ)
DECLARE_INSN(c_slli, MATCH_C_SLLI, MASK_C_SLLI)
DECLARE_INSN(c_fldsp, MATCH_C_FLDSP, MASK_C_FLDSP)
DECLARE_INSN(c_lwsp, MATCH_C_LWSP, MASK_C_LWSP)
DECLARE_INSN(c_flwsp, MATCH_C_FLWSP, MASK_C_FLWSP)
DECLARE_INSN(c_mv, MATCH_C_MV, MASK_C_MV)
DECLARE_INSN(c_add, MATCH_C_ADD, MASK_C_ADD)
DECLARE_INSN(c_fsdsp, MATCH_C_FSDSP, MASK_C_FSDSP)
DECLARE_INSN(c_swsp, MATCH_C_SWSP, MASK_C_SWSP)
DECLARE_INSN(c_fswsp, MATCH_C_FSWSP, MASK_C_FSWSP)
#endif
#ifdef DECLARE_CSR
DECLARE_CSR(fflags, CSR_FFLAGS)
DECLARE_CSR(frm, CSR_FRM)
DECLARE_CSR(fcsr, CSR_FCSR)
DECLARE_CSR(ustatus, CSR_USTATUS)
DECLARE_CSR(uie, CSR_UIE)
DECLARE_CSR(utvec, CSR_UTVEC)
DECLARE_CSR(vstart, CSR_VSTART)
DECLARE_CSR(vxsat, CSR_VXSAT)
DECLARE_CSR(vxrm, CSR_VXRM)
DECLARE_CSR(uscratch, CSR_USCRATCH)
DECLARE_CSR(uepc, CSR_UEPC)
DECLARE_CSR(ucause, CSR_UCAUSE)
DECLARE_CSR(utval, CSR_UTVAL)
DECLARE_CSR(uip, CSR_UIP)
DECLARE_CSR(cycle, CSR_CYCLE)
DECLARE_CSR(time, CSR_TIME)
DECLARE_CSR(instret, CSR_INSTRET)
DECLARE_CSR(hpmcounter3, CSR_HPMCOUNTER3)
DECLARE_CSR(hpmcounter4, CSR_HPMCOUNTER4)
DECLARE_CSR(hpmcounter5, CSR_HPMCOUNTER5)
DECLARE_CSR(hpmcounter6, CSR_HPMCOUNTER6)
DECLARE_CSR(hpmcounter7, CSR_HPMCOUNTER7)
DECLARE_CSR(hpmcounter8, CSR_HPMCOUNTER8)
DECLARE_CSR(hpmcounter9, CSR_HPMCOUNTER9)
DECLARE_CSR(hpmcounter10, CSR_HPMCOUNTER10)
DECLARE_CSR(hpmcounter11, CSR_HPMCOUNTER11)
DECLARE_CSR(hpmcounter12, CSR_HPMCOUNTER12)
DECLARE_CSR(hpmcounter13, CSR_HPMCOUNTER13)
DECLARE_CSR(hpmcounter14, CSR_HPMCOUNTER14)
DECLARE_CSR(hpmcounter15, CSR_HPMCOUNTER15)
DECLARE_CSR(hpmcounter16, CSR_HPMCOUNTER16)
DECLARE_CSR(hpmcounter17, CSR_HPMCOUNTER17)
DECLARE_CSR(hpmcounter18, CSR_HPMCOUNTER18)
DECLARE_CSR(hpmcounter19, CSR_HPMCOUNTER19)
DECLARE_CSR(hpmcounter20, CSR_HPMCOUNTER20)
DECLARE_CSR(hpmcounter21, CSR_HPMCOUNTER21)
DECLARE_CSR(hpmcounter22, CSR_HPMCOUNTER22)
DECLARE_CSR(hpmcounter23, CSR_HPMCOUNTER23)
DECLARE_CSR(hpmcounter24, CSR_HPMCOUNTER24)
DECLARE_CSR(hpmcounter25, CSR_HPMCOUNTER25)
DECLARE_CSR(hpmcounter26, CSR_HPMCOUNTER26)
DECLARE_CSR(hpmcounter27, CSR_HPMCOUNTER27)
DECLARE_CSR(hpmcounter28, CSR_HPMCOUNTER28)
DECLARE_CSR(hpmcounter29, CSR_HPMCOUNTER29)
DECLARE_CSR(hpmcounter30, CSR_HPMCOUNTER30)
DECLARE_CSR(hpmcounter31, CSR_HPMCOUNTER31)
DECLARE_CSR(vl, CSR_VL)
DECLARE_CSR(vtype, CSR_VTYPE)
DECLARE_CSR(vlenb, CSR_VLENB)
DECLARE_CSR(sstatus, CSR_SSTATUS)
DECLARE_CSR(sie, CSR_SIE)
DECLARE_CSR(stvec, CSR_STVEC)
DECLARE_CSR(scounteren, CSR_SCOUNTEREN)
DECLARE_CSR(sscratch, CSR_SSCRATCH)
DECLARE_CSR(sepc, CSR_SEPC)
DECLARE_CSR(scause, CSR_SCAUSE)
DECLARE_CSR(stval, CSR_STVAL)
DECLARE_CSR(sip, CSR_SIP)
DECLARE_CSR(satp, CSR_SATP)
DECLARE_CSR(vsstatus, CSR_VSSTATUS)
DECLARE_CSR(vsie, CSR_VSIE)
DECLARE_CSR(vstvec, CSR_VSTVEC)
DECLARE_CSR(vsscratch, CSR_VSSCRATCH)
DECLARE_CSR(vsepc, CSR_VSEPC)
DECLARE_CSR(vscause, CSR_VSCAUSE)
DECLARE_CSR(vstval, CSR_VSTVAL)
DECLARE_CSR(vsip, CSR_VSIP)
DECLARE_CSR(vsatp, CSR_VSATP)
DECLARE_CSR(hstatus, CSR_HSTATUS)
DECLARE_CSR(hedeleg, CSR_HEDELEG)
DECLARE_CSR(hideleg, CSR_HIDELEG)
DECLARE_CSR(hcounteren, CSR_HCOUNTEREN)
DECLARE_CSR(hgatp, CSR_HGATP)
DECLARE_CSR(utvt, CSR_UTVT)
DECLARE_CSR(unxti, CSR_UNXTI)
DECLARE_CSR(uintstatus, CSR_UINTSTATUS)
DECLARE_CSR(uscratchcsw, CSR_USCRATCHCSW)
DECLARE_CSR(uscratchcswl, CSR_USCRATCHCSWL)
DECLARE_CSR(stvt, CSR_STVT)
DECLARE_CSR(snxti, CSR_SNXTI)
DECLARE_CSR(sintstatus, CSR_SINTSTATUS)
DECLARE_CSR(sscratchcsw, CSR_SSCRATCHCSW)
DECLARE_CSR(sscratchcswl, CSR_SSCRATCHCSWL)
DECLARE_CSR(mtvt, CSR_MTVT)
DECLARE_CSR(mnxti, CSR_MNXTI)
DECLARE_CSR(mintstatus, CSR_MINTSTATUS)
DECLARE_CSR(mscratchcsw, CSR_MSCRATCHCSW)
DECLARE_CSR(mscratchcswl, CSR_MSCRATCHCSWL)
DECLARE_CSR(mstatus, CSR_MSTATUS)
DECLARE_CSR(misa, CSR_MISA)
DECLARE_CSR(medeleg, CSR_MEDELEG)
DECLARE_CSR(mideleg, CSR_MIDELEG)
DECLARE_CSR(mie, CSR_MIE)
DECLARE_CSR(mtvec, CSR_MTVEC)
DECLARE_CSR(mcounteren, CSR_MCOUNTEREN)
DECLARE_CSR(mscratch, CSR_MSCRATCH)
DECLARE_CSR(mepc, CSR_MEPC)
DECLARE_CSR(mcause, CSR_MCAUSE)
DECLARE_CSR(mtval, CSR_MTVAL)
DECLARE_CSR(mip, CSR_MIP)
DECLARE_CSR(pmpcfg0, CSR_PMPCFG0)
DECLARE_CSR(pmpcfg1, CSR_PMPCFG1)
DECLARE_CSR(pmpcfg2, CSR_PMPCFG2)
DECLARE_CSR(pmpcfg3, CSR_PMPCFG3)
DECLARE_CSR(pmpaddr0, CSR_PMPADDR0)
DECLARE_CSR(pmpaddr1, CSR_PMPADDR1)
DECLARE_CSR(pmpaddr2, CSR_PMPADDR2)
DECLARE_CSR(pmpaddr3, CSR_PMPADDR3)
DECLARE_CSR(pmpaddr4, CSR_PMPADDR4)
DECLARE_CSR(pmpaddr5, CSR_PMPADDR5)
DECLARE_CSR(pmpaddr6, CSR_PMPADDR6)
DECLARE_CSR(pmpaddr7, CSR_PMPADDR7)
DECLARE_CSR(pmpaddr8, CSR_PMPADDR8)
DECLARE_CSR(pmpaddr9, CSR_PMPADDR9)
DECLARE_CSR(pmpaddr10, CSR_PMPADDR10)
DECLARE_CSR(pmpaddr11, CSR_PMPADDR11)
DECLARE_CSR(pmpaddr12, CSR_PMPADDR12)
DECLARE_CSR(pmpaddr13, CSR_PMPADDR13)
DECLARE_CSR(pmpaddr14, CSR_PMPADDR14)
DECLARE_CSR(pmpaddr15, CSR_PMPADDR15)
DECLARE_CSR(tselect, CSR_TSELECT)
DECLARE_CSR(tdata1, CSR_TDATA1)
DECLARE_CSR(tdata2, CSR_TDATA2)
DECLARE_CSR(tdata3, CSR_TDATA3)
DECLARE_CSR(dcsr, CSR_DCSR)
DECLARE_CSR(dpc, CSR_DPC)
DECLARE_CSR(dscratch, CSR_DSCRATCH)
DECLARE_CSR(mcycle, CSR_MCYCLE)
DECLARE_CSR(minstret, CSR_MINSTRET)
DECLARE_CSR(mhpmcounter3, CSR_MHPMCOUNTER3)
DECLARE_CSR(mhpmcounter4, CSR_MHPMCOUNTER4)
DECLARE_CSR(mhpmcounter5, CSR_MHPMCOUNTER5)
DECLARE_CSR(mhpmcounter6, CSR_MHPMCOUNTER6)
DECLARE_CSR(mhpmcounter7, CSR_MHPMCOUNTER7)
DECLARE_CSR(mhpmcounter8, CSR_MHPMCOUNTER8)
DECLARE_CSR(mhpmcounter9, CSR_MHPMCOUNTER9)
DECLARE_CSR(mhpmcounter10, CSR_MHPMCOUNTER10)
DECLARE_CSR(mhpmcounter11, CSR_MHPMCOUNTER11)
DECLARE_CSR(mhpmcounter12, CSR_MHPMCOUNTER12)
DECLARE_CSR(mhpmcounter13, CSR_MHPMCOUNTER13)
DECLARE_CSR(mhpmcounter14, CSR_MHPMCOUNTER14)
DECLARE_CSR(mhpmcounter15, CSR_MHPMCOUNTER15)
DECLARE_CSR(mhpmcounter16, CSR_MHPMCOUNTER16)
DECLARE_CSR(mhpmcounter17, CSR_MHPMCOUNTER17)
DECLARE_CSR(mhpmcounter18, CSR_MHPMCOUNTER18)
DECLARE_CSR(mhpmcounter19, CSR_MHPMCOUNTER19)
DECLARE_CSR(mhpmcounter20, CSR_MHPMCOUNTER20)
DECLARE_CSR(mhpmcounter21, CSR_MHPMCOUNTER21)
DECLARE_CSR(mhpmcounter22, CSR_MHPMCOUNTER22)
DECLARE_CSR(mhpmcounter23, CSR_MHPMCOUNTER23)
DECLARE_CSR(mhpmcounter24, CSR_MHPMCOUNTER24)
DECLARE_CSR(mhpmcounter25, CSR_MHPMCOUNTER25)
DECLARE_CSR(mhpmcounter26, CSR_MHPMCOUNTER26)
DECLARE_CSR(mhpmcounter27, CSR_MHPMCOUNTER27)
DECLARE_CSR(mhpmcounter28, CSR_MHPMCOUNTER28)
DECLARE_CSR(mhpmcounter29, CSR_MHPMCOUNTER29)
DECLARE_CSR(mhpmcounter30, CSR_MHPMCOUNTER30)
DECLARE_CSR(mhpmcounter31, CSR_MHPMCOUNTER31)
DECLARE_CSR(mhpmevent3, CSR_MHPMEVENT3)
DECLARE_CSR(mhpmevent4, CSR_MHPMEVENT4)
DECLARE_CSR(mhpmevent5, CSR_MHPMEVENT5)
DECLARE_CSR(mhpmevent6, CSR_MHPMEVENT6)
DECLARE_CSR(mhpmevent7, CSR_MHPMEVENT7)
DECLARE_CSR(mhpmevent8, CSR_MHPMEVENT8)
DECLARE_CSR(mhpmevent9, CSR_MHPMEVENT9)
DECLARE_CSR(mhpmevent10, CSR_MHPMEVENT10)
DECLARE_CSR(mhpmevent11, CSR_MHPMEVENT11)
DECLARE_CSR(mhpmevent12, CSR_MHPMEVENT12)
DECLARE_CSR(mhpmevent13, CSR_MHPMEVENT13)
DECLARE_CSR(mhpmevent14, CSR_MHPMEVENT14)
DECLARE_CSR(mhpmevent15, CSR_MHPMEVENT15)
DECLARE_CSR(mhpmevent16, CSR_MHPMEVENT16)
DECLARE_CSR(mhpmevent17, CSR_MHPMEVENT17)
DECLARE_CSR(mhpmevent18, CSR_MHPMEVENT18)
DECLARE_CSR(mhpmevent19, CSR_MHPMEVENT19)
DECLARE_CSR(mhpmevent20, CSR_MHPMEVENT20)
DECLARE_CSR(mhpmevent21, CSR_MHPMEVENT21)
DECLARE_CSR(mhpmevent22, CSR_MHPMEVENT22)
DECLARE_CSR(mhpmevent23, CSR_MHPMEVENT23)
DECLARE_CSR(mhpmevent24, CSR_MHPMEVENT24)
DECLARE_CSR(mhpmevent25, CSR_MHPMEVENT25)
DECLARE_CSR(mhpmevent26, CSR_MHPMEVENT26)
DECLARE_CSR(mhpmevent27, CSR_MHPMEVENT27)
DECLARE_CSR(mhpmevent28, CSR_MHPMEVENT28)
DECLARE_CSR(mhpmevent29, CSR_MHPMEVENT29)
DECLARE_CSR(mhpmevent30, CSR_MHPMEVENT30)
DECLARE_CSR(mhpmevent31, CSR_MHPMEVENT31)
DECLARE_CSR(mvendorid, CSR_MVENDORID)
DECLARE_CSR(marchid, CSR_MARCHID)
DECLARE_CSR(mimpid, CSR_MIMPID)
DECLARE_CSR(mhartid, CSR_MHARTID)
DECLARE_CSR(cycleh, CSR_CYCLEH)
DECLARE_CSR(timeh, CSR_TIMEH)
DECLARE_CSR(instreth, CSR_INSTRETH)
DECLARE_CSR(hpmcounter3h, CSR_HPMCOUNTER3H)
DECLARE_CSR(hpmcounter4h, CSR_HPMCOUNTER4H)
DECLARE_CSR(hpmcounter5h, CSR_HPMCOUNTER5H)
DECLARE_CSR(hpmcounter6h, CSR_HPMCOUNTER6H)
DECLARE_CSR(hpmcounter7h, CSR_HPMCOUNTER7H)
DECLARE_CSR(hpmcounter8h, CSR_HPMCOUNTER8H)
DECLARE_CSR(hpmcounter9h, CSR_HPMCOUNTER9H)
DECLARE_CSR(hpmcounter10h, CSR_HPMCOUNTER10H)
DECLARE_CSR(hpmcounter11h, CSR_HPMCOUNTER11H)
DECLARE_CSR(hpmcounter12h, CSR_HPMCOUNTER12H)
DECLARE_CSR(hpmcounter13h, CSR_HPMCOUNTER13H)
DECLARE_CSR(hpmcounter14h, CSR_HPMCOUNTER14H)
DECLARE_CSR(hpmcounter15h, CSR_HPMCOUNTER15H)
DECLARE_CSR(hpmcounter16h, CSR_HPMCOUNTER16H)
DECLARE_CSR(hpmcounter17h, CSR_HPMCOUNTER17H)
DECLARE_CSR(hpmcounter18h, CSR_HPMCOUNTER18H)
DECLARE_CSR(hpmcounter19h, CSR_HPMCOUNTER19H)
DECLARE_CSR(hpmcounter20h, CSR_HPMCOUNTER20H)
DECLARE_CSR(hpmcounter21h, CSR_HPMCOUNTER21H)
DECLARE_CSR(hpmcounter22h, CSR_HPMCOUNTER22H)
DECLARE_CSR(hpmcounter23h, CSR_HPMCOUNTER23H)
DECLARE_CSR(hpmcounter24h, CSR_HPMCOUNTER24H)
DECLARE_CSR(hpmcounter25h, CSR_HPMCOUNTER25H)
DECLARE_CSR(hpmcounter26h, CSR_HPMCOUNTER26H)
DECLARE_CSR(hpmcounter27h, CSR_HPMCOUNTER27H)
DECLARE_CSR(hpmcounter28h, CSR_HPMCOUNTER28H)
DECLARE_CSR(hpmcounter29h, CSR_HPMCOUNTER29H)
DECLARE_CSR(hpmcounter30h, CSR_HPMCOUNTER30H)
DECLARE_CSR(hpmcounter31h, CSR_HPMCOUNTER31H)
DECLARE_CSR(mcycleh, CSR_MCYCLEH)
DECLARE_CSR(minstreth, CSR_MINSTRETH)
DECLARE_CSR(mhpmcounter3h, CSR_MHPMCOUNTER3H)
DECLARE_CSR(mhpmcounter4h, CSR_MHPMCOUNTER4H)
DECLARE_CSR(mhpmcounter5h, CSR_MHPMCOUNTER5H)
DECLARE_CSR(mhpmcounter6h, CSR_MHPMCOUNTER6H)
DECLARE_CSR(mhpmcounter7h, CSR_MHPMCOUNTER7H)
DECLARE_CSR(mhpmcounter8h, CSR_MHPMCOUNTER8H)
DECLARE_CSR(mhpmcounter9h, CSR_MHPMCOUNTER9H)
DECLARE_CSR(mhpmcounter10h, CSR_MHPMCOUNTER10H)
DECLARE_CSR(mhpmcounter11h, CSR_MHPMCOUNTER11H)
DECLARE_CSR(mhpmcounter12h, CSR_MHPMCOUNTER12H)
DECLARE_CSR(mhpmcounter13h, CSR_MHPMCOUNTER13H)
DECLARE_CSR(mhpmcounter14h, CSR_MHPMCOUNTER14H)
DECLARE_CSR(mhpmcounter15h, CSR_MHPMCOUNTER15H)
DECLARE_CSR(mhpmcounter16h, CSR_MHPMCOUNTER16H)
DECLARE_CSR(mhpmcounter17h, CSR_MHPMCOUNTER17H)
DECLARE_CSR(mhpmcounter18h, CSR_MHPMCOUNTER18H)
DECLARE_CSR(mhpmcounter19h, CSR_MHPMCOUNTER19H)
DECLARE_CSR(mhpmcounter20h, CSR_MHPMCOUNTER20H)
DECLARE_CSR(mhpmcounter21h, CSR_MHPMCOUNTER21H)
DECLARE_CSR(mhpmcounter22h, CSR_MHPMCOUNTER22H)
DECLARE_CSR(mhpmcounter23h, CSR_MHPMCOUNTER23H)
DECLARE_CSR(mhpmcounter24h, CSR_MHPMCOUNTER24H)
DECLARE_CSR(mhpmcounter25h, CSR_MHPMCOUNTER25H)
DECLARE_CSR(mhpmcounter26h, CSR_MHPMCOUNTER26H)
DECLARE_CSR(mhpmcounter27h, CSR_MHPMCOUNTER27H)
DECLARE_CSR(mhpmcounter28h, CSR_MHPMCOUNTER28H)
DECLARE_CSR(mhpmcounter29h, CSR_MHPMCOUNTER29H)
DECLARE_CSR(mhpmcounter30h, CSR_MHPMCOUNTER30H)
DECLARE_CSR(mhpmcounter31h, CSR_MHPMCOUNTER31H)
#endif
#ifdef DECLARE_CAUSE
DECLARE_CAUSE("misaligned fetch", CAUSE_MISALIGNED_FETCH)
DECLARE_CAUSE("fetch access", CAUSE_FETCH_ACCESS)
DECLARE_CAUSE("illegal instruction", CAUSE_ILLEGAL_INSTRUCTION)
DECLARE_CAUSE("breakpoint", CAUSE_BREAKPOINT)
DECLARE_CAUSE("misaligned load", CAUSE_MISALIGNED_LOAD)
DECLARE_CAUSE("load access", CAUSE_LOAD_ACCESS)
DECLARE_CAUSE("misaligned store", CAUSE_MISALIGNED_STORE)
DECLARE_CAUSE("store access", CAUSE_STORE_ACCESS)
DECLARE_CAUSE("user_ecall", CAUSE_USER_ECALL)
DECLARE_CAUSE("supervisor_ecall", CAUSE_SUPERVISOR_ECALL)
DECLARE_CAUSE("hypervisor_ecall", CAUSE_HYPERVISOR_ECALL)
DECLARE_CAUSE("machine_ecall", CAUSE_MACHINE_ECALL)
DECLARE_CAUSE("fetch page fault", CAUSE_FETCH_PAGE_FAULT)
DECLARE_CAUSE("load page fault", CAUSE_LOAD_PAGE_FAULT)
DECLARE_CAUSE("store page fault", CAUSE_STORE_PAGE_FAULT)
#endif
|
b46fc92ef78c7fa0e2106313d19e50630c7c4f77
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/components/libc/posix/libdl/dlmodule.c
|
eebc5be0f9ea4569e6f9db5345aff539660c6a0d
|
[
"Apache-2.0"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 22,866
|
c
|
dlmodule.c
|
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018/08/29 Bernard first version
*/
#include <rthw.h>
#include "dlfcn.h"
#include "dlmodule.h"
#include "dlelf.h"
#ifdef RT_USING_POSIX_FS
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#endif
#define DBG_TAG "DLMD"
#define DBG_LVL DBG_INFO
#include <rtdbg.h> // must after of DEBUG_ENABLE or some other options
static struct rt_module_symtab *_rt_module_symtab_begin = RT_NULL;
static struct rt_module_symtab *_rt_module_symtab_end = RT_NULL;
#if defined(__IAR_SYSTEMS_ICC__) /* for IAR compiler */
#pragma section="RTMSymTab"
#endif
/* set the name of module */
static void _dlmodule_set_name(struct rt_dlmodule *module, const char *path)
{
int size;
struct rt_object *object;
const char *first, *end, *ptr;
object = &(module->parent);
ptr = first = (char *)path;
end = path + rt_strlen(path);
while (*ptr != '\0')
{
if (*ptr == '/')
first = ptr + 1;
if (*ptr == '.')
end = ptr - 1;
ptr ++;
}
size = end - first + 1;
if (size > RT_NAME_MAX) size = RT_NAME_MAX;
rt_strncpy(object->name, first, size);
object->name[size] = '\0';
}
#define RT_MODULE_ARG_MAX 8
static int _rt_module_split_arg(char *cmd, rt_size_t length, char *argv[])
{
int argc = 0;
char *ptr = cmd;
while ((ptr - cmd) < length)
{
/* strip bank and tab */
while ((*ptr == ' ' || *ptr == '\t') && (ptr - cmd) < length)
*ptr++ = '\0';
/* check whether it's the end of line */
if ((ptr - cmd) >= length) break;
/* handle string with quote */
if (*ptr == '"')
{
argv[argc++] = ++ptr;
/* skip this string */
while (*ptr != '"' && (ptr - cmd) < length)
if (*ptr ++ == '\\') ptr ++;
if ((ptr - cmd) >= length) break;
/* skip '"' */
*ptr ++ = '\0';
}
else
{
argv[argc++] = ptr;
while ((*ptr != ' ' && *ptr != '\t') && (ptr - cmd) < length)
ptr ++;
}
if (argc >= RT_MODULE_ARG_MAX) break;
}
return argc;
}
/* invoked by main thread for exit */
static void _dlmodule_exit(void)
{
struct rt_dlmodule *module;
module = dlmodule_self();
if (!module) return; /* not a module thread */
rt_enter_critical();
if (module->stat == RT_DLMODULE_STAT_RUNNING)
{
struct rt_object *object = RT_NULL;
struct rt_list_node *node = RT_NULL;
/* set stat to closing */
module->stat = RT_DLMODULE_STAT_CLOSING;
/* suspend all threads in this module */
for (node = module->object_list.next; node != &(module->object_list); node = node->next)
{
object = rt_list_entry(node, struct rt_object, list);
if ((object->type & ~RT_Object_Class_Static) == RT_Object_Class_Thread)
{
rt_thread_t thread = (rt_thread_t)object;
/* stop timer and suspend thread*/
if ((thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_CLOSE &&
(thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_INIT)
{
rt_timer_stop(&(thread->thread_timer));
rt_thread_suspend(thread);
}
}
}
}
rt_exit_critical();
return;
}
static void _dlmodule_thread_entry(void* parameter)
{
int argc = 0;
char *argv[RT_MODULE_ARG_MAX];
struct rt_dlmodule *module = (struct rt_dlmodule*)parameter;
if (module == RT_NULL || module->cmd_line == RT_NULL)
/* malloc for module_cmd_line failed. */
return;
if (module->cmd_line)
{
rt_memset(argv, 0x00, sizeof(argv));
argc = _rt_module_split_arg((char *)module->cmd_line, rt_strlen(module->cmd_line), argv);
if (argc == 0) goto __exit;
}
/* set status of module */
module->stat = RT_DLMODULE_STAT_RUNNING;
LOG_D("run main entry: 0x%p with %s",
module->entry_addr,
module->cmd_line);
if (module->entry_addr)
module->entry_addr(argc, argv);
__exit:
_dlmodule_exit();
return ;
}
struct rt_dlmodule *dlmodule_create(void)
{
struct rt_dlmodule *module = RT_NULL;
module = (struct rt_dlmodule*) rt_object_allocate(RT_Object_Class_Module, "module");
if (module)
{
module->stat = RT_DLMODULE_STAT_INIT;
/* set initial priority and stack size */
module->priority = RT_THREAD_PRIORITY_MAX - 1;
module->stack_size = 2048;
rt_list_init(&(module->object_list));
}
return module;
}
void dlmodule_destroy_subthread(struct rt_dlmodule *module, rt_thread_t thread)
{
RT_ASSERT(thread->parent.module_id== module);
/* lock scheduler to prevent scheduling in cleanup function. */
rt_enter_critical();
/* remove thread from thread_list (ready or defunct thread list) */
rt_list_remove(&(thread->tlist));
if ((thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_CLOSE &&
(thread->thread_timer.parent.type == (RT_Object_Class_Static | RT_Object_Class_Timer)))
{
/* release thread timer */
rt_timer_detach(&(thread->thread_timer));
}
/* change stat */
thread->stat = RT_THREAD_CLOSE;
/* invoke thread cleanup */
if (thread->cleanup != RT_NULL)
thread->cleanup(thread);
rt_exit_critical();
#ifdef RT_USING_SIGNALS
rt_thread_free_sig(thread);
#endif
if (thread->parent.type & RT_Object_Class_Static)
{
/* detach object */
rt_object_detach((rt_object_t)thread);
}
#ifdef RT_USING_HEAP
else
{
/* release thread's stack */
RT_KERNEL_FREE(thread->stack_addr);
/* delete thread object */
rt_object_delete((rt_object_t)thread);
}
#endif
}
rt_err_t dlmodule_destroy(struct rt_dlmodule* module)
{
int i;
RT_DEBUG_NOT_IN_INTERRUPT;
/* check parameter */
if (module == RT_NULL)
return -RT_ERROR;
/* can not destroy a running module */
if (module->stat == RT_DLMODULE_STAT_RUNNING)
return -RT_EBUSY;
/* do module cleanup */
if (module->cleanup_func)
{
rt_enter_critical();
module->cleanup_func(module);
rt_exit_critical();
}
// list_object(&(module->object_list));
/* cleanup for all kernel objects inside module*/
{
struct rt_object *object = RT_NULL;
struct rt_list_node *node = RT_NULL;
/* detach/delete all threads in this module */
for (node = module->object_list.next; node != &(module->object_list); )
{
int object_type;
object = rt_list_entry(node, struct rt_object, list);
object_type = object->type & ~RT_Object_Class_Static;
/* to next node */
node = node->next;
if (object->type & RT_Object_Class_Static)
{
switch (object_type)
{
case RT_Object_Class_Thread:
dlmodule_destroy_subthread(module, (rt_thread_t)object);
break;
#ifdef RT_USING_SEMAPHORE
case RT_Object_Class_Semaphore:
rt_sem_detach((rt_sem_t)object);
break;
#endif
#ifdef RT_USING_MUTEX
case RT_Object_Class_Mutex:
rt_mutex_detach((rt_mutex_t)object);
break;
#endif
#ifdef RT_USING_EVENT
case RT_Object_Class_Event:
rt_event_detach((rt_event_t)object);
break;
#endif
#ifdef RT_USING_MAILBOX
case RT_Object_Class_MailBox:
rt_mb_detach((rt_mailbox_t)object);
break;
#endif
#ifdef RT_USING_MESSAGEQUEUE
case RT_Object_Class_MessageQueue:
rt_mq_detach((rt_mq_t)object);
break;
#endif
#ifdef RT_USING_MEMHEAP
case RT_Object_Class_MemHeap:
rt_memheap_detach((struct rt_memheap*)object);
break;
#endif
#ifdef RT_USING_MEMPOOL
case RT_Object_Class_MemPool:
rt_mp_detach((struct rt_mempool*)object);
break;
#endif
case RT_Object_Class_Timer:
rt_timer_detach((rt_timer_t)object);
break;
default:
LOG_E("Unsupported oject type in module.");
break;
}
}
else
{
switch (object_type)
{
case RT_Object_Class_Thread:
dlmodule_destroy_subthread(module, (rt_thread_t)object);
break;
#ifdef RT_USING_SEMAPHORE
case RT_Object_Class_Semaphore:
rt_sem_delete((rt_sem_t)object);
break;
#endif
#ifdef RT_USING_MUTEX
case RT_Object_Class_Mutex:
rt_mutex_delete((rt_mutex_t)object);
break;
#endif
#ifdef RT_USING_EVENT
case RT_Object_Class_Event:
rt_event_delete((rt_event_t)object);
break;
#endif
#ifdef RT_USING_MAILBOX
case RT_Object_Class_MailBox:
rt_mb_delete((rt_mailbox_t)object);
break;
#endif
#ifdef RT_USING_MESSAGEQUEUE
case RT_Object_Class_MessageQueue:
rt_mq_delete((rt_mq_t)object);
break;
#endif
#ifdef RT_USING_MEMHEAP
/* no delete operation */
#endif
#ifdef RT_USING_MEMPOOL
case RT_Object_Class_MemPool:
rt_mp_delete((struct rt_mempool*)object);
break;
#endif
case RT_Object_Class_Timer:
rt_timer_delete((rt_timer_t)object);
break;
default:
LOG_E("Unsupported oject type in module.");
break;
}
}
}
}
if (module->cmd_line) rt_free(module->cmd_line);
/* release module symbol table */
for (i = 0; i < module->nsym; i ++)
{
rt_free((void *)module->symtab[i].name);
}
if (module->symtab != RT_NULL)
{
rt_free(module->symtab);
}
/* destory module */
rt_free(module->mem_space);
/* delete module object */
rt_object_delete((rt_object_t)module);
return RT_EOK;
}
struct rt_dlmodule *dlmodule_self(void)
{
rt_thread_t tid;
struct rt_dlmodule *ret = RT_NULL;
tid = rt_thread_self();
if (tid)
{
ret = (struct rt_dlmodule*) tid->parent.module_id;
}
return ret;
}
/*
* Compatible with old API
*/
struct rt_dlmodule *rt_module_self(void)
{
return dlmodule_self();
}
struct rt_dlmodule* dlmodule_load(const char* filename)
{
#ifdef RT_USING_POSIX_FS
int fd = -1, length = 0;
#endif
rt_err_t ret = RT_EOK;
rt_uint8_t *module_ptr = RT_NULL;
struct rt_dlmodule *module = RT_NULL;
#ifdef RT_USING_POSIX_FS
fd = open(filename, O_RDONLY, 0);
if (fd >= 0)
{
length = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
if (length == 0) goto __exit;
module_ptr = (uint8_t*) rt_malloc (length);
if (!module_ptr) goto __exit;
if (read(fd, module_ptr, length) != length)
goto __exit;
/* close file and release fd */
close(fd);
fd = -1;
}
else
{
goto __exit;
}
#endif
if (!module_ptr) goto __exit;
/* check ELF header */
if (rt_memcmp(elf_module->e_ident, RTMMAG, SELFMAG) != 0 &&
rt_memcmp(elf_module->e_ident, ELFMAG, SELFMAG) != 0)
{
rt_kprintf("Module: magic error\n");
goto __exit;
}
/* check ELF class */
if ((elf_module->e_ident[EI_CLASS] != ELFCLASS32)&&(elf_module->e_ident[EI_CLASS] != ELFCLASS64))
{
rt_kprintf("Module: ELF class error\n");
goto __exit;
}
module = dlmodule_create();
if (!module) goto __exit;
/* set the name of module */
_dlmodule_set_name(module, filename);
LOG_D("rt_module_load: %.*s", RT_NAME_MAX, module->parent.name);
if (elf_module->e_type == ET_REL)
{
ret = dlmodule_load_relocated_object(module, module_ptr);
}
else if (elf_module->e_type == ET_DYN)
{
ret = dlmodule_load_shared_object(module, module_ptr);
}
else
{
rt_kprintf("Module: unsupported elf type\n");
goto __exit;
}
/* check return value */
if (ret != RT_EOK) goto __exit;
/* release module data */
rt_free(module_ptr);
/* increase module reference count */
module->nref ++;
/* deal with cache */
#ifdef RT_USING_CACHE
rt_hw_cpu_dcache_ops(RT_HW_CACHE_FLUSH, module->mem_space, module->mem_size);
rt_hw_cpu_icache_ops(RT_HW_CACHE_INVALIDATE, module->mem_space, module->mem_size);
#endif
/* set module initialization and cleanup function */
module->init_func = dlsym(module, "module_init");
module->cleanup_func = dlsym(module, "module_cleanup");
module->stat = RT_DLMODULE_STAT_INIT;
/* do module initialization */
if (module->init_func)
{
module->init_func(module);
}
return module;
__exit:
#ifdef RT_USING_POSIX_FS
if (fd >= 0) close(fd);
#endif
if (module_ptr) rt_free(module_ptr);
if (module) dlmodule_destroy(module);
return RT_NULL;
}
struct rt_dlmodule* dlmodule_exec(const char* pgname, const char* cmd, int cmd_size)
{
struct rt_dlmodule *module = RT_NULL;
module = dlmodule_load(pgname);
if (module)
{
if (module->entry_addr)
{
/* exec this module */
rt_thread_t tid;
module->cmd_line = rt_strdup(cmd);
/* check stack size and priority */
if (module->priority > RT_THREAD_PRIORITY_MAX) module->priority = RT_THREAD_PRIORITY_MAX - 1;
if (module->stack_size < 2048 || module->stack_size > (1024 * 32)) module->stack_size = 2048;
tid = rt_thread_create(module->parent.name, _dlmodule_thread_entry, (void*)module,
module->stack_size, module->priority, 10);
if (tid)
{
tid->parent.module_id= module;
module->main_thread = tid;
rt_thread_startup(tid);
}
else
{
/* destory dl module */
dlmodule_destroy(module);
module = RT_NULL;
}
}
}
return module;
}
#if defined(RT_USING_CUSTOM_DLMODULE)
struct rt_dlmodule* dlmodule_load_custom(const char* filename, struct rt_dlmodule_ops* ops)
{
#ifdef RT_USING_POSIX_FS
int fd = -1, length = 0;
#endif
rt_err_t ret = RT_EOK;
rt_uint8_t *module_ptr = RT_NULL;
struct rt_dlmodule *module = RT_NULL;
if (ops)
{
RT_ASSERT(ops->load);
RT_ASSERT(ops->unload);
module_ptr = ops->load(filename);
}
#ifdef RT_USING_POSIX_FS
else
{
fd = open(filename, O_RDONLY, 0);
if (fd >= 0)
{
length = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
if (length == 0) goto __exit;
module_ptr = (uint8_t*) rt_malloc (length);
if (!module_ptr) goto __exit;
if (read(fd, module_ptr, length) != length)
goto __exit;
/* close file and release fd */
close(fd);
fd = -1;
}
else
{
goto __exit;
}
}
#endif
if (!module_ptr) goto __exit;
/* check ELF header */
if (rt_memcmp(elf_module->e_ident, RTMMAG, SELFMAG) != 0 &&
rt_memcmp(elf_module->e_ident, ELFMAG, SELFMAG) != 0)
{
rt_kprintf("Module: magic error\n");
goto __exit;
}
/* check ELF class */
if (elf_module->e_ident[EI_CLASS] != ELFCLASS32)
{
rt_kprintf("Module: ELF class error\n");
goto __exit;
}
module = dlmodule_create();
if (!module) goto __exit;
/* set the name of module */
_dlmodule_set_name(module, filename);
LOG_D("rt_module_load: %.*s", RT_NAME_MAX, module->parent.name);
if (elf_module->e_type == ET_REL)
{
ret = dlmodule_load_relocated_object(module, module_ptr);
}
else if (elf_module->e_type == ET_DYN)
{
ret = dlmodule_load_shared_object(module, module_ptr);
}
else
{
rt_kprintf("Module: unsupported elf type\n");
goto __exit;
}
/* check return value */
if (ret != RT_EOK) goto __exit;
/* release module data */
if (ops)
{
ops->unload(module_ptr);
}
else
{
rt_free(module_ptr);
}
/* increase module reference count */
module->nref ++;
/* deal with cache */
#ifdef RT_USING_CACHE
rt_hw_cpu_dcache_ops(RT_HW_CACHE_FLUSH, module->mem_space, module->mem_size);
rt_hw_cpu_icache_ops(RT_HW_CACHE_INVALIDATE, module->mem_space, module->mem_size);
#endif
/* set module initialization and cleanup function */
module->init_func = dlsym(module, "module_init");
module->cleanup_func = dlsym(module, "module_cleanup");
module->stat = RT_DLMODULE_STAT_INIT;
/* do module initialization */
if (module->init_func)
{
module->init_func(module);
}
return module;
__exit:
#ifdef RT_USING_POSIX_FS
if (fd >= 0) close(fd);
#endif
if (module_ptr)
{
if (ops)
{
ops->unload(module_ptr);
}
else
{
rt_free(module_ptr);
}
}
if (module) dlmodule_destroy(module);
return RT_NULL;
}
struct rt_dlmodule* dlmodule_exec_custom(const char* pgname, const char* cmd, int cmd_size, struct rt_dlmodule_ops* ops)
{
struct rt_dlmodule *module = RT_NULL;
module = dlmodule_load_custom(pgname, ops);
if (module)
{
if (module->entry_addr)
{
/* exec this module */
rt_thread_t tid;
module->cmd_line = rt_strdup(cmd);
/* check stack size and priority */
if (module->priority > RT_THREAD_PRIORITY_MAX) module->priority = RT_THREAD_PRIORITY_MAX - 1;
if (module->stack_size < 2048 || module->stack_size > (1024 * 32)) module->stack_size = 2048;
tid = rt_thread_create(module->parent.name, _dlmodule_thread_entry, (void*)module,
module->stack_size, module->priority, 10);
if (tid)
{
tid->parent.module_id= module;
module->main_thread = tid;
rt_thread_startup(tid);
}
else
{
/* destory dl module */
dlmodule_destroy(module);
module = RT_NULL;
}
}
}
return module;
}
#endif
void dlmodule_exit(int ret_code)
{
rt_thread_t thread;
struct rt_dlmodule *module;
module = dlmodule_self();
if (!module) return;
/* disable scheduling */
rt_enter_critical();
/* module is not running */
if (module->stat != RT_DLMODULE_STAT_RUNNING)
{
/* restore scheduling */
rt_exit_critical();
return;
}
/* set return code */
module->ret_code = ret_code;
/* do exit for this module */
_dlmodule_exit();
/* the stat of module was changed to CLOSING in _dlmodule_exit */
thread = module->main_thread;
if ((thread->stat & RT_THREAD_STAT_MASK) == RT_THREAD_CLOSE)
{
/* main thread already closed */
rt_exit_critical();
return ;
}
/* delete thread: insert to defunct thread list */
rt_thread_delete(thread);
/* enable scheduling */
rt_exit_critical();
}
rt_uint32_t dlmodule_symbol_find(const char *sym_str)
{
/* find in kernel symbol table */
struct rt_module_symtab *index;
for (index = _rt_module_symtab_begin; index != _rt_module_symtab_end; index ++)
{
if (rt_strcmp(index->name, sym_str) == 0)
return (rt_uint32_t)index->addr;
}
return 0;
}
int rt_system_dlmodule_init(void)
{
#if defined(__GNUC__) && !defined(__CC_ARM)
extern int __rtmsymtab_start;
extern int __rtmsymtab_end;
_rt_module_symtab_begin = (struct rt_module_symtab *)&__rtmsymtab_start;
_rt_module_symtab_end = (struct rt_module_symtab *)&__rtmsymtab_end;
#elif defined (__CC_ARM)
extern int RTMSymTab$$Base;
extern int RTMSymTab$$Limit;
_rt_module_symtab_begin = (struct rt_module_symtab *)&RTMSymTab$$Base;
_rt_module_symtab_end = (struct rt_module_symtab *)&RTMSymTab$$Limit;
#elif defined (__IAR_SYSTEMS_ICC__)
_rt_module_symtab_begin = __section_begin("RTMSymTab");
_rt_module_symtab_end = __section_end("RTMSymTab");
#endif
return 0;
}
INIT_COMPONENT_EXPORT(rt_system_dlmodule_init);
/**
* This function will find the specified module.
*
* @param name the name of module finding
*
* @return the module
*/
struct rt_dlmodule *dlmodule_find(const char *name)
{
rt_object_t object;
struct rt_dlmodule *ret = RT_NULL;
object = rt_object_find(name, RT_Object_Class_Module);
if (object)
{
ret = (struct rt_dlmodule*) object;
}
return ret;
}
RTM_EXPORT(dlmodule_find);
int list_symbols(void)
{
extern int __rtmsymtab_start;
extern int __rtmsymtab_end;
/* find in kernel symbol table */
struct rt_module_symtab *index;
for (index = _rt_module_symtab_begin;
index != _rt_module_symtab_end;
index ++)
{
rt_kprintf("%s => 0x%08x\n", index->name, index->addr);
}
return 0;
}
MSH_CMD_EXPORT(list_symbols, list symbols information);
int list_module(void)
{
struct rt_dlmodule *module;
struct rt_list_node *list, *node;
struct rt_object_information *info;
info = rt_object_get_information(RT_Object_Class_Module);
list = &info->object_list;
rt_kprintf("module ref address \n");
rt_kprintf("-------- -------- ------------\n");
for (node = list->next; node != list; node = node->next)
{
module = (struct rt_dlmodule *)(rt_list_entry(node, struct rt_object, list));
rt_kprintf("%-*.*s %-04d 0x%08x\n",
RT_NAME_MAX, RT_NAME_MAX, module->parent.name, module->nref, module->mem_space);
}
return 0;
}
MSH_CMD_EXPORT(list_module, list modules in system);
|
4c8326f284a1ae231e46f6e808df79512504008d
|
69db0de8c61c7cba691193edd3f087fdb54351c2
|
/src/credits.c
|
c0b449b6d53b19a9fac44d9194cbc910c6d53fdc
|
[] |
no_license
|
pret/pokefirered
|
5363c332321c7650d4c85be6aa2e8baf3acda162
|
f8741615bfa0123e38680f30103f217c269ec96a
|
refs/heads/master
| 2023-08-31T15:22:19.498797
| 2023-08-31T15:15:29
| 2023-08-31T15:15:29
| 115,841,713
| 847
| 709
| null | 2023-09-12T22:48:38
| 2017-12-31T04:07:51
|
C
|
UTF-8
|
C
| false
| false
| 49,980
|
c
|
credits.c
|
#include "global.h"
#include "gflib.h"
#include "credits.h"
#include "task.h"
#include "overworld.h"
#include "event_data.h"
#include "new_menu_helpers.h"
#include "decompress.h"
#include "graphics.h"
#include "strings.h"
#include "trainer_pokemon_sprites.h"
#include "menu.h"
#include "field_weather.h"
#include "quest_log.h"
#include "constants/maps.h"
#include "constants/field_weather.h"
#include "constants/sound.h"
#if defined(FIRERED)
#define TITLE_TEXT gString_PokemonFireRed_Staff
#elif defined(LEAFGREEN)
#define TITLE_TEXT gString_PokemonLeafGreen_Staff
#endif
enum CreditsSceneIdx
{
CREDITSSCENE_INIT_WIN0 = 0,
CREDITSSCENE_SETUP_DARKEN_EFFECT,
CREDITSSCENE_OPEN_WIN0,
CREDITSSCENE_LOAD_PLAYER_SPRITE_AT_INDIGO,
CREDITSSCENE_PRINT_TITLE_STAFF,
CREDITSSCENE_WAIT_TITLE_STAFF,
CREDITSSCENE_EXEC_CMD,
CREDITSSCENE_PRINT_ADDPRINTER1,
CREDITSSCENE_PRINT_ADDPRINTER2,
CREDITSSCENE_PRINT_DELAY,
CREDITSSCENE_MAPNEXT_DESTROYWINDOW,
CREDITSSCENE_MAPNEXT_LOADMAP,
CREDITSSCENE_MAP_LOADMAP_CREATESPRITES,
CREDITSSCENE_MON_DESTROY_ASSETS,
CREDITSSCENE_MON_SHOW,
CREDITSSCENE_THEEND_DESTROY_ASSETS,
CREDITSSCENE_THEEND_SHOW,
CREDITSSCENE_WAITBUTTON,
CREDITSSCENE_TERMINATE,
};
enum CreditsScrCmd
{
CREDITSSCRCMD_PRINT = 0,
CREDITSSCRCMD_MAPNEXT,
CREDITSSCRCMD_MAP,
CREDITSSCRCMD_MON,
CREDITSSCRCMD_THEENDGFX,
CREDITSSCRCMD_WAITBUTTON
};
enum CreditsMon
{
CREDITSMON_CHARIZARD = 0,
CREDITSMON_VENUSAUR,
CREDITSMON_BLASTOISE,
CREDITSMON_PIKACHU
};
enum CreditsClosingText
{
CREDITSCLOSING_ALLRIGHTSRESERVED = 0,
CREDITSCLOSING_THEEND
};
enum CreditsString
{
CREDITS_STRING_DIRECTOR = 0,
CREDITS_STRING_ART_DIRECTOR_BATTLE_DIRECTOR,
CREDITS_STRING_PROGRAM_LEADER_PLANNING_LEADER_GRAPHIC_DESIGN_LEADER,
CREDITS_STRING_PROGRAMMERS,
CREDITS_STRING_SYSTEM_PROGRAMMERS,
CREDITS_STRING_GRAPHIC_DESIGNERS,
CREDITS_STRING_GRAPHIC_DESIGNERS_2,
CREDITS_STRING_MUSIC_COMPOSITION,
CREDITS_STRING_SOUND_EFFECTS,
CREDITS_STRING_GAME_DESIGNERS,
CREDITS_STRING_GAME_DESIGNERS_2,
CREDITS_STRING_GAME_SCENARIO,
CREDITS_STRING_SCRIPT_DESIGNER_MAP_DESIGNER,
CREDITS_STRING_PARAMETRIC_DESIGNERS,
CREDITS_STRING_POKEDEX_TEXT,
CREDITS_STRING_POKEMON_DESIGNERS,
CREDITS_STRING_POKEMON_DESIGNERS_2,
CREDITS_STRING_POKEMON_DESIGNERS_3,
CREDITS_STRING_SUPPORTING_PROGRAMMERS,
CREDITS_STRING_NCL_PRODUCT_TESTING,
CREDITS_STRING_SPECIAL_THANKS,
CREDITS_STRING_SPECIAL_THANKS_2,
CREDITS_STRING_SPECIAL_THANKS_3,
CREDITS_STRING_BRAILLE_CODE_CHECK,
CREDITS_STRING_INFORMATION_SUPERVISORS,
CREDITS_STRING_COORDINATORS,
CREDITS_STRING_TASK_MANAGERS,
CREDITS_STRING_PRODUCERS,
CREDITS_STRING_EXECUTIVE_DIRECTOR,
CREDITS_STRING_EXECUTIVE_PRODUCER,
CREDITS_STRING_EXECUTIVE_PRODUCER_2,
CREDITS_STRING_ENGLISH_VERSION_COORDINATORS,
CREDITS_STRING_TRANSLATOR_TEXT_EDITOR,
CREDITS_STRING_PROGRAMMERS_2,
CREDITS_STRING_ENVIRONMENT_TOOL_PROGRAMMERS,
CREDITS_STRING_NOA_PRODUCT_TESTING,
CREDITS_STRING_BRAILLE_CODE_CHECK_2,
CREDITS_STRING_BRAILLE_CODE_CHECK_3,
CREDITS_STRING_SPECIAL_THANKS_4,
CREDITS_STRING_SPECIAL_THANKS_5,
CREDITS_STRING_BRAILLE_CODE_CHECK_4,
CREDITS_STRING_GRAPHIC_DESIGNER,
CREDITS_STRING_DUMMY
};
enum CreditsMap
{
CREDITS_MAP_ROUTE23 = 0,
CREDITS_MAP_VIRIDIAN_CITY,
CREDITS_MAP_PEWTER_CITY,
CREDITS_MAP_CERULEAN_CITY,
CREDITS_MAP_ROUTE25,
CREDITS_MAP_VERMILION_CITY,
CREDITS_MAP_ROUTE10,
CREDITS_MAP_CELADON_CITY,
CREDITS_MAP_SAFFRON_CITY,
CREDITS_MAP_ROUTE17,
CREDITS_MAP_FUCHSIA_CITY,
CREDITS_MAP_CINNABAR_ISLAND,
CREDITS_MAP_ROUTE21_NORTH
};
enum {
GFXTAG_CHARACTER = 0x2000, // Player/Rival
GFXTAG_GROUND,
};
struct CreditsResources
{
u8 mainseqno;
u8 subseqno;
u8 taskId;
u16 timer;
u16 scrcmdidx;
u8 canSpeedThrough;
u8 whichMon;
u8 windowId;
bool8 windowIsActive;
u16 creditsMonTimer;
u16 unk_0E;
u8 filler_10[12];
u8 ovwldseqno;
u8 unk_1D;
};
struct CreditsScrcmd
{
u8 cmd;
u8 param;
u16 duration;
};
struct CreditsTextHeader
{
const u8 * title;
const u8 * names;
bool8 unused;
};
struct CompressedGraphicsHeader
{
const u8 * tiles;
const u8 * map;
const u16 * palette;
};
struct CreditsTaskData
{
u8 spriteMoveCmd;
u8 characterSpriteId; // Player or rival
u16 characterTilesTag;
u16 characterPalTag;
u8 groundSpriteId;
u16 groundTilesTag;
u16 groundPalTag;
};
static EWRAM_DATA struct CreditsResources * sCreditsMgr = NULL;
EWRAM_DATA bool8 gHasHallOfFameRecords = FALSE;
static void CB2_Credits(void);
static s32 RollCredits(void);
static bool32 DoCreditsMonScene(void);
static bool32 DoCopyrightOrTheEndGfxScene(void);
static void DestroyPlayerOrRivalSprite(void);
static void LoadPlayerOrRivalSprite(u8 a0);
static const struct BgTemplate sBgTemplates_MonSceneOrTheEnd[] = {
{
.bg = 0,
.charBaseIndex = 0,
.mapBaseIndex = 15,
.screenSize = 0,
.paletteMode = FALSE,
.priority = 0,
.baseTile = 0x0
}, {
.bg = 1,
.charBaseIndex = 2,
.mapBaseIndex = 23,
.screenSize = 0,
.paletteMode = FALSE,
.priority = 1,
.baseTile = 0x0
}, {
.bg = 2,
.charBaseIndex = 3,
.mapBaseIndex = 31,
.screenSize = 1,
.paletteMode = TRUE,
.priority = 2,
.baseTile = 0x0
}
};
static const struct WindowTemplate sWindowTemplates_Charizard[] = {
{
.bg = 0,
.tilemapLeft = 11,
.tilemapTop = 6,
.width = 8,
.height = 8,
.paletteNum = 10,
.baseBlock = 0x0008
}, {
.bg = 0,
.tilemapLeft = 10,
.tilemapTop = 5,
.width = 10,
.height = 10,
.paletteNum = 10,
.baseBlock = 0x0048
}, {
.bg = 0,
.tilemapLeft = 9,
.tilemapTop = 3,
.width = 12,
.height = 13,
.paletteNum = 10,
.baseBlock = 0x00ac
}, DUMMY_WIN_TEMPLATE
};
static const struct WindowTemplate sWindowTemplates_Venusaur[] = {
{
.bg = 0,
.tilemapLeft = 11,
.tilemapTop = 6,
.width = 8,
.height = 8,
.paletteNum = 10,
.baseBlock = 0x0008
}, {
.bg = 0,
.tilemapLeft = 10,
.tilemapTop = 5,
.width = 10,
.height = 10,
.paletteNum = 10,
.baseBlock = 0x0048
}, {
.bg = 0,
.tilemapLeft = 9,
.tilemapTop = 5,
.width = 12,
.height = 10,
.paletteNum = 10,
.baseBlock = 0x00ac
}, DUMMY_WIN_TEMPLATE
};
static const struct WindowTemplate sWindowTemplates_Blastoise[] = {
{
.bg = 0,
.tilemapLeft = 11,
.tilemapTop = 6,
.width = 8,
.height = 8,
.paletteNum = 10,
.baseBlock = 0x0008
}, {
.bg = 0,
.tilemapLeft = 10,
.tilemapTop = 5,
.width = 10,
.height = 10,
.paletteNum = 10,
.baseBlock = 0x0048
}, {
.bg = 0,
.tilemapLeft = 10,
.tilemapTop = 4,
.width = 10,
.height = 12,
.paletteNum = 10,
.baseBlock = 0x00ac
}, DUMMY_WIN_TEMPLATE
};
static const struct WindowTemplate sWindowTemplates_Pikachu[] = {
{
.bg = 0,
.tilemapLeft = 11,
.tilemapTop = 6,
.width = 8,
.height = 8,
.paletteNum = 10,
.baseBlock = 0x0008
}, {
.bg = 0,
.tilemapLeft = 10,
.tilemapTop = 5,
.width = 10,
.height = 10,
.paletteNum = 10,
.baseBlock = 0x0048
}, {
.bg = 0,
.tilemapLeft = 9,
.tilemapTop = 4,
.width = 12,
.height = 12,
.paletteNum = 10,
.baseBlock = 0x00ac
}, DUMMY_WIN_TEMPLATE
};
static const u16 sCreditsMonCircle_Pal[] = INCBIN_U16("graphics/credits/white_circle.gbapal");
static const u32 sCreditsMonCircle_Tiles[] = INCBIN_U32("graphics/credits/white_circle.8bpp.lz");
static const u32 sCreditsMonCircle_Tilemap[] = INCBIN_U32("graphics/credits/white_circle.bin.lz");
static const u32 sCharizard1_Tiles[] = INCBIN_U32("graphics/credits/charizard_1.4bpp.lz");
static const u32 sCharizard2_Tiles[] = INCBIN_U32("graphics/credits/charizard_2.4bpp.lz");
static const u32 sVenusaurUnused_Tiles[] = INCBIN_U32("graphics/credits/venusaur_unused.4bpp.lz");
static const u32 sVenusaur1_Tiles[] = INCBIN_U32("graphics/credits/venusaur_1.4bpp.lz");
static const u32 sVenusaur2_Tiles[] = INCBIN_U32("graphics/credits/venusaur_2.4bpp.lz");
static const u32 sBlastoise1_Tiles[] = INCBIN_U32("graphics/credits/blastoise_1.4bpp.lz");
static const u32 sBlastoise2_Tiles[] = INCBIN_U32("graphics/credits/blastoise_2.4bpp.lz");
static const u32 sPikachu1_Tiles[] = INCBIN_U32("graphics/credits/pikachu_1.4bpp.lz");
static const u32 sPikachu2_Tiles[] = INCBIN_U32("graphics/credits/pikachu_2.4bpp.lz");
static const u32 sUnused = 0xF0;
static const u16 sTheEnd_Pal[] = INCBIN_U16("graphics/credits/the_end.gbapal");
static const u8 sTheEnd_Tiles[] = INCBIN_U8("graphics/credits/the_end.4bpp.lz");
static const u8 sTheEnd_Tilemap[] = INCBIN_U8("graphics/credits/the_end.bin.lz");
static const struct CompressedGraphicsHeader sCopyrightOrTheEndGfxHeaders[] = {
{
.tiles = gCreditsCopyright_Tiles,
.map = gCreditsCopyright_Tilemap,
.palette = gCreditsCopyright_Pal
}, {
.tiles = sTheEnd_Tiles,
.map = sTheEnd_Tilemap,
.palette = sTheEnd_Pal
}
};
#define CREDITS_PRINT(text, duration) { CREDITSSCRCMD_PRINT, CREDITS_STRING_##text, duration }
#define CREDITS_MAPNEXT(map, duration) { CREDITSSCRCMD_MAPNEXT, CREDITS_MAP_##map, duration }
#define CREDITS_MAP(map, duration) { CREDITSSCRCMD_MAP, CREDITS_MAP_##map, duration }
#define CREDITS_MON(mon) { CREDITSSCRCMD_MON, CREDITSMON_##mon }
#define CREDITS_THEENDGFX(idx, duration) { CREDITSSCRCMD_THEENDGFX, CREDITSCLOSING_##idx, duration }
#define CREDITS_WAITBUTTON(time) { CREDITSSCRCMD_WAITBUTTON, .duration = time }
static const struct CreditsScrcmd sCreditsScript[] = {
CREDITS_MAPNEXT(ROUTE23, 16),
CREDITS_PRINT(DIRECTOR, 300),
CREDITS_PRINT(ART_DIRECTOR_BATTLE_DIRECTOR, 300),
CREDITS_PRINT(PROGRAM_LEADER_PLANNING_LEADER_GRAPHIC_DESIGN_LEADER, 300),
CREDITS_PRINT(DUMMY, 60),
CREDITS_MAPNEXT(VIRIDIAN_CITY, 0),
CREDITS_PRINT(PROGRAMMERS, 211),
CREDITS_PRINT(SYSTEM_PROGRAMMERS, 211),
CREDITS_PRINT(GRAPHIC_DESIGNERS, 211),
CREDITS_MAPNEXT(PEWTER_CITY, 0),
CREDITS_PRINT(GRAPHIC_DESIGNERS_2, 211),
CREDITS_PRINT(MUSIC_COMPOSITION, 210),
CREDITS_PRINT(SOUND_EFFECTS, 210),
CREDITS_MON(CHARIZARD),
CREDITS_MAP(CERULEAN_CITY, 16),
CREDITS_PRINT(GAME_DESIGNERS, 211),
CREDITS_PRINT(GAME_DESIGNERS_2, 210),
CREDITS_PRINT(GAME_SCENARIO, 210),
CREDITS_MAPNEXT(ROUTE25, 16),
CREDITS_PRINT(SCRIPT_DESIGNER_MAP_DESIGNER, 211),
CREDITS_PRINT(PARAMETRIC_DESIGNERS, 210),
CREDITS_PRINT(POKEDEX_TEXT, 210),
CREDITS_MAPNEXT(VERMILION_CITY, 16),
CREDITS_PRINT(POKEMON_DESIGNERS, 211),
CREDITS_PRINT(POKEMON_DESIGNERS_2, 210),
CREDITS_PRINT(POKEMON_DESIGNERS_3, 210),
CREDITS_MON(VENUSAUR),
CREDITS_MAP(ROUTE10, 16),
CREDITS_PRINT(SUPPORTING_PROGRAMMERS, 211),
CREDITS_PRINT(NCL_PRODUCT_TESTING, 210),
CREDITS_PRINT(SPECIAL_THANKS, 210),
CREDITS_MAPNEXT(CELADON_CITY, 16),
CREDITS_PRINT(SPECIAL_THANKS_2, 221),
CREDITS_PRINT(SPECIAL_THANKS_3, 221),
CREDITS_PRINT(BRAILLE_CODE_CHECK, 221),
CREDITS_PRINT(INFORMATION_SUPERVISORS, 221),
CREDITS_PRINT(DUMMY, 51),
CREDITS_MAPNEXT(SAFFRON_CITY, 16),
CREDITS_PRINT(COORDINATORS, 211),
CREDITS_PRINT(TASK_MANAGERS, 210),
CREDITS_PRINT(PRODUCERS, 210),
CREDITS_MON(BLASTOISE),
CREDITS_MAP(ROUTE17, 16),
CREDITS_PRINT(EXECUTIVE_DIRECTOR, 331),
CREDITS_PRINT(EXECUTIVE_PRODUCER, 331),
CREDITS_PRINT(EXECUTIVE_PRODUCER_2, 331),
CREDITS_MAPNEXT(FUCHSIA_CITY, 16),
CREDITS_PRINT(ENGLISH_VERSION_COORDINATORS, 221),
CREDITS_PRINT(TRANSLATOR_TEXT_EDITOR, 221),
CREDITS_PRINT(PROGRAMMERS_2, 221),
CREDITS_PRINT(ENVIRONMENT_TOOL_PROGRAMMERS, 221),
CREDITS_PRINT(DUMMY, 52),
CREDITS_MAPNEXT(CINNABAR_ISLAND, 16),
CREDITS_PRINT(GRAPHIC_DESIGNER, 210),
CREDITS_PRINT(NOA_PRODUCT_TESTING, 210),
CREDITS_PRINT(BRAILLE_CODE_CHECK_2, 211),
CREDITS_MON(PIKACHU),
CREDITS_MAP(ROUTE21_NORTH, 16),
CREDITS_PRINT(BRAILLE_CODE_CHECK_3, 221),
CREDITS_PRINT(BRAILLE_CODE_CHECK_4, 221),
CREDITS_PRINT(SPECIAL_THANKS_4, 221),
CREDITS_PRINT(SPECIAL_THANKS_5, 221),
CREDITS_PRINT(DUMMY, 52),
CREDITS_THEENDGFX(ALLRIGHTSRESERVED, 224),
CREDITS_THEENDGFX(THEEND, 240),
CREDITS_WAITBUTTON(600)
};
static const ALIGNED(4) u8 sTextColor_Unused[3] = {0, 1, 2};
static const ALIGNED(4) u8 sTextColor_Header[3] = {0, 5, 2};
static const ALIGNED(4) u8 sTextColor_Regular[3] = {0, 1, 2};
static const struct WindowTemplate sCreditsWindowTemplate = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 4,
.width = 30,
.height = 12,
.paletteNum = 15,
.baseBlock = 0x008
};
static const u16 sPlayerMale_Pal[] = INCBIN_U16("graphics/credits/player_male.gbapal");
static const u32 sPlayerMale_Tiles[] = INCBIN_U32("graphics/credits/player_male.4bpp.lz");
static const u16 sPlayerFemale_Pal[] = INCBIN_U16("graphics/credits/player_female.gbapal");
static const u32 sPlayerFemale_Tiles[] = INCBIN_U32("graphics/credits/player_female.4bpp.lz");
static const u16 sRival_Pal[] = INCBIN_U16("graphics/credits/rival.gbapal");
static const u32 sRival_Tiles[] = INCBIN_U32("graphics/credits/rival.4bpp.lz");
static const u16 sGround_Grass_Pal[] = INCBIN_U16("graphics/credits/ground_grass.gbapal");
static const u32 sGround_Grass_Tiles[] = INCBIN_U32("graphics/credits/ground_grass.4bpp.lz");
static const u16 sGround_Dirt_Pal[] = INCBIN_U16("graphics/credits/ground_dirt.gbapal");
static const u32 sGround_Dirt_Tiles[] = INCBIN_U32("graphics/credits/ground_dirt.4bpp.lz");
static const u16 sGround_City_Pal[] = INCBIN_U16("graphics/credits/ground_city.gbapal");
static const u32 sGround_City_Tiles[] = INCBIN_U32("graphics/credits/ground_city.4bpp.lz");
static const u16 sPlayerRivalSpriteParams[][3] = {
{ 0, 3, 1 },
{ 0, 2, 0 },
{ 0, 3, 0 },
{ 1, 1, 2 },
{ 0, 0, 3 }
};
static const struct OamData sOamData_PlayerOrRival = {
.affineMode = ST_OAM_AFFINE_OFF,
.mosaic = FALSE,
.objMode = ST_OAM_OBJ_NORMAL,
.bpp = ST_OAM_4BPP,
.shape = ST_OAM_SQUARE,
.size = ST_OAM_SIZE_3,
.tileNum = 0x000,
.priority = 0,
.paletteNum = 15
};
const union AnimCmd sAnimCmds_PlayerOrRival[] = {
ANIMCMD_FRAME(0x000, 8),
ANIMCMD_FRAME(0x040, 8),
ANIMCMD_FRAME(0x080, 8),
ANIMCMD_FRAME(0x0C0, 8),
ANIMCMD_FRAME(0x100, 8),
ANIMCMD_FRAME(0x140, 8),
ANIMCMD_JUMP(0)
};
const union AnimCmd *const sAnimCmdTable_PlayerOrRival[] = {
sAnimCmds_PlayerOrRival
};
static const struct SpriteTemplate sPlayerOrRivalSpriteTemplate = {
.oam = &sOamData_PlayerOrRival,
.anims = sAnimCmdTable_PlayerOrRival,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const struct OamData sOamData_Ground = {
.affineMode = ST_OAM_AFFINE_OFF,
.mosaic = FALSE,
.objMode = ST_OAM_OBJ_NORMAL,
.bpp = ST_OAM_4BPP,
.shape = ST_OAM_H_RECTANGLE,
.size = ST_OAM_SIZE_3,
.tileNum = 0x000,
.priority = 0,
.paletteNum = 14
};
const union AnimCmd sAnimCmds_GroundRunning[] = {
ANIMCMD_FRAME(0x00, 8),
ANIMCMD_FRAME(0x20, 8),
ANIMCMD_FRAME(0x40, 8),
ANIMCMD_FRAME(0x60, 8),
ANIMCMD_FRAME(0x80, 8),
ANIMCMD_FRAME(0xA0, 8),
ANIMCMD_FRAME(0xC0, 8),
ANIMCMD_FRAME(0xE0, 8),
ANIMCMD_JUMP(0)
};
const union AnimCmd sAnimCmds_GroundStatic[] = {
ANIMCMD_FRAME(0x00, 8),
ANIMCMD_JUMP(0)
};
const union AnimCmd *const sAnimCmdTable_GroundRunning[] = {
sAnimCmds_GroundRunning
};
const union AnimCmd *const sAnimCmdTable_GroundStatic[] = {
sAnimCmds_GroundStatic
};
static const struct SpriteTemplate sGroundSpriteTemplate_Running = {
.oam = &sOamData_Ground,
.anims = sAnimCmdTable_GroundRunning,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const struct SpriteTemplate sGroundSpriteTemplate_Static = {
.oam = &sOamData_Ground,
.anims = sAnimCmdTable_GroundStatic,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const struct CreditsOverworldCmd sOverworldCmd_Route23[] = {
CREDITSOVWLDLOADMAP(ROUTE23, 11, 107, 1),
CREDITSOVWLDSCROLL(0, 1, 0x0500), // Scroll down
CREDITSOVWLDEND
};
static const struct CreditsOverworldCmd sOverworldCmd_ViridianCity[] = {
CREDITSOVWLDLOADMAP(VIRIDIAN_CITY, 30, 34, 1),
CREDITSOVWLDSCROLL(0, -1, 0x0500), // Scroll up
CREDITSOVWLDEND
};
static const struct CreditsOverworldCmd sOverworldCmd_PewterCity[] = {
CREDITSOVWLDLOADMAP(PEWTER_CITY, 20, 26, 1),
CREDITSOVWLDSCROLL(0, -1, 0x0500), // Scroll up
CREDITSOVWLDEND
};
static const struct CreditsOverworldCmd sOverworldCmd_CeruleanCity[] = {
CREDITSOVWLDLOADMAP(CERULEAN_CITY, 8, 6, 1),
CREDITSOVWLDSCROLL(1, 1, 0x0500), // Scroll right and down
CREDITSOVWLDEND
};
static const struct CreditsOverworldCmd sOverworldCmd_Route25[] = {
CREDITSOVWLDLOADMAP(ROUTE25, 25, 6, 1),
CREDITSOVWLDSCROLL(1, 0, 0x0500), // Scroll right
CREDITSOVWLDEND
};
static const struct CreditsOverworldCmd sOverworldCmd_VermilionCity[] = {
CREDITSOVWLDLOADMAP(VERMILION_CITY, 9, 7, 1),
CREDITSOVWLDSCROLL(1, 1, 0x0500), // Scroll right and down
CREDITSOVWLDEND
};
static const struct CreditsOverworldCmd sOverworldCmd_Route10[] = {
CREDITSOVWLDLOADMAP(ROUTE10, 11, 68, 1),
CREDITSOVWLDSCROLL(0, 1, 0x0500), // Scroll down
CREDITSOVWLDEND
};
static const struct CreditsOverworldCmd sOverworldCmd_CeladonCity[] = {
CREDITSOVWLDLOADMAP(CELADON_CITY, 48, 16, 1),
CREDITSOVWLDSCROLL(-1, 0, 0x0500), // Scroll left
CREDITSOVWLDEND
};
static const struct CreditsOverworldCmd sOverworldCmd_SaffronCity[] = {
CREDITSOVWLDLOADMAP(SAFFRON_CITY, 39, 5, 1),
CREDITSOVWLDSCROLL(0, 1, 0x0500), // Scroll down
CREDITSOVWLDEND
};
static const struct CreditsOverworldCmd sOverworldCmd_Route17[] = {
CREDITSOVWLDLOADMAP(ROUTE17, 7, 43, 1),
CREDITSOVWLDSCROLL(0, 1, 0x0500), // Scroll down
CREDITSOVWLDEND
};
static const struct CreditsOverworldCmd sOverworldCmd_FuchsiaCity[] = {
CREDITSOVWLDLOADMAP(FUCHSIA_CITY, 28, 5, 1),
CREDITSOVWLDSCROLL(0, 1, 0x0500), // Scroll down
CREDITSOVWLDEND
};
static const struct CreditsOverworldCmd sOverworldCmd_CinnabarIsland[] = {
CREDITSOVWLDLOADMAP(CINNABAR_ISLAND, 13, 17, 1),
CREDITSOVWLDSCROLL(0, -1, 0x0500), // Scroll up
CREDITSOVWLDEND
};
static const struct CreditsOverworldCmd sOverworldCmd_Route21[] = {
CREDITSOVWLDLOADMAP(ROUTE21_NORTH, 8, 20, 1),
CREDITSOVWLDSCROLL(0, -1, 0x0500), // Scroll up
CREDITSOVWLDEND,
};
static const struct CreditsOverworldCmd *const sOverworldMapScenes[] = {
sOverworldCmd_Route23,
sOverworldCmd_ViridianCity,
sOverworldCmd_PewterCity,
sOverworldCmd_CeruleanCity,
sOverworldCmd_Route25,
sOverworldCmd_VermilionCity,
sOverworldCmd_Route10,
sOverworldCmd_CeladonCity,
sOverworldCmd_SaffronCity,
sOverworldCmd_Route17,
sOverworldCmd_FuchsiaCity,
sOverworldCmd_CinnabarIsland,
sOverworldCmd_Route21
};
static const struct CreditsTextHeader sCreditsTexts[] = {
{ gCreditsString_Director, gCreditsString_Junichi_Masuda, FALSE },
{ gCreditsString_Art_Director_Battle_Director, gCreditsString_Ken_Sugimori_Shigeki_Morimoto, FALSE },
{ gCreditsString_Program_Leader_Planning_Leader_Graphic_Design_Leader, gCreditsString_Tetsuya_Watanabe_Koji_Nishino_Takao_Unno, FALSE },
{ gCreditsString_Programmers, gCreditsString_Hiroyuki_Nakamura_Masao_Taya_Satoshi_Nohara_Miyuki_Iwasawa_Daisuke_Goto, FALSE },
{ gCreditsString_System_Programmers, gCreditsString_Tetsuya_Watanabe_Akito_Mori_Hisashi_Sogabe_Sousuke_Tamada, TRUE },
{ gCreditsString_Graphic_Designers, gCreditsString_Takao_Unno_Asuka_Iwashita_Kanako_Eo_Hiroki_Fuchino, TRUE },
{ gCreditsString_Graphic_Designers_2, gCreditsString_Ken_Sugimori_Hironobu_Yoshida, TRUE },
{ gCreditsString_Music_Composition, gCreditsString_Go_Ichinose_Junichi_Masuda, TRUE },
{ gCreditsString_Sound_Effects, gCreditsString_Go_Ichinose, FALSE },
{ gCreditsString_Game_Designers, gCreditsString_Junichi_Masuda_Koji_Nishino_Tetsuji_Ohta, FALSE },
{ gCreditsString_Game_Designers_2, gCreditsString_Hitomi_Sato_Shigeru_Ohmori_Tadashi_Takahashi, FALSE },
{ gCreditsString_Game_Scenario, gCreditsString_Hitomi_Sato_Satoshi_Tajiri, TRUE },
{ gCreditsString_Script_Designer_Map_Designer, gCreditsString_Satoshi_Nohara_Shigeru_Ohmori, FALSE },
{ gCreditsString_Parametric_Designers, gCreditsString_Koji_Nishino_Tetsuji_Ohta_Shigeki_Morimoto, FALSE },
{ gCreditsString_POKeDEX_Text, gCreditsString_Kenji_Matsushima, FALSE },
{ gCreditsString_POKeMON_Designers, gCreditsString_Ken_Sugimori_Motofumi_Fujiwara_Shigeki_Morimoto_Hironobu_Yoshida, TRUE },
{ gCreditsString_POKeMON_Designers_2, gCreditsString_Satoshi_Ohta_Asuka_Iwashita_Takao_Unno_Kanako_Eo_Aimi_Tomita, FALSE },
{ gCreditsString_POKeMON_Designers_3, gCreditsString_Atsuko_Nishida_Muneo_Saito_Rena_Yoshikawa_Jun_Okutani, TRUE },
{ gCreditsString_Supporting_Programmers, gCreditsString_Teruyuki_Yoshioka_Takao_Nakano_Satoshi_Mitsuhara_Daisuke_Hoshino, FALSE },
{ gCreditsString_NCL_Product_Testing, gCreditsString_NCL_Super_Mario_Club, FALSE },
{ gCreditsString_Special_Thanks, gCreditsString_Hiro_Nakamura_Hiroyuki_Uesugi_Teruki_Murakawa_Kazuya_Suyama, FALSE },
{ gCreditsString_Special_Thanks_2, gCreditsString_Kenji_Tominaga_Kenjiro_Ito_Tomotaka_Komura_Michiko_Takizawa, FALSE },
{ gCreditsString_Special_Thanks_3, gCreditsString_Makiko_Takada_Mikiko_Ohashi_Shusaku_Egami_Takanao_Kondo_Rui_Kawaguchi, FALSE },
{ gCreditsString_Braille_Code_Check, gCreditsString_Japan_Braille_Library, FALSE },
{ gCreditsString_Information_Supervisors, gCreditsString_Hiroki_Enomoto_Kazuyuki_Terada_Yuri_Sakurai_Yumi_Funasaka_Naoko_Yanase, FALSE },
{ gCreditsString_Coordinators, gCreditsString_Azusa_Tajima_Akira_Kinashi_Kazuki_Yoshihara_Retsuji_Nomoto, FALSE },
{ gCreditsString_Task_Managers, gCreditsString_Hitoshi_Yamagami_Gakuji_Nomoto, TRUE },
{ gCreditsString_Producers, gCreditsString_Hiroyuki_Jinnai_Takehiro_Izushi_Hiroaki_Tsuru, FALSE },
{ gCreditsString_Executive_Director, gCreditsString_Satoshi_Tajiri, FALSE },
{ gCreditsString_Executive_Producer, gCreditsString_Satoru_Iwata, FALSE },
{ gCreditsString_Executive_Producer_2, gCreditsString_Tsunekaz_Ishihara, FALSE },
{ gCreditsString_English_Version_Coordinators, gCreditsString_Hiro_Nakamura_Seth_McMahill, FALSE },
{ gCreditsString_Translator_Text_Editor, gCreditsString_Nob_Ogasawara_Teresa_Lillygren, FALSE },
{ gCreditsString_Programmers_2, gCreditsString_Teruki_Murakawa_Souichi_Yamamoto_Yuichiro_Ito_Akira_Kinashi, FALSE },
{ gCreditsString_Environment_Tool_Programmers, gCreditsString_Teruki_Murakawa_Souichi_Yamamoto_Kimiko_Nakamichi, TRUE },
{ gCreditsString_NOA_Product_Testing, gCreditsString_Thomas_Hertzog_Kathy_Huguenard_Mika_Kurosawa, TRUE },
{ gCreditsString_Braille_Code_Check_2, gCreditsString_National_Federation_of_the_Blind_Patricia_A_Maurer_Japan_Braille_Library_European_Blind_Union, TRUE },
{ gCreditsString_Braille_Code_Check_3, gCreditsString_National_Information_Library_Service_Margaret_Campion, TRUE },
{ gCreditsString_Special_Thanks_4, gCreditsString_Takehiro_Izushi_Motoyasu_Tojima_Hitoshi_Yamagami_Hiroyuki_Uesugi, FALSE },
{ gCreditsString_Special_Thanks_5, gCreditsString_Nicola_Pratt_Barlow_Shellie_Dow_Anthony_Howitt_Naoko_Saeki_Kyoko_Onishi, FALSE },
{ gCreditsString_Braille_Code_Check_4, gCreditsString_The_Royal_New_Zealand_Foundation_of_the_Blind_Greg_Moran, FALSE },
{ gCreditsString_Graphic_Designer, gCreditsString_Akira_Kinashi, FALSE },
{ gString_Dummy, gString_Dummy, FALSE }
};
void DoCredits(void)
{
sCreditsMgr = AllocZeroed(sizeof(*sCreditsMgr));
ResetTasks();
sCreditsMgr->taskId = TASK_NONE;
sCreditsMgr->unk_1D = 0;
ResetSpriteData();
SetMainCallback2(CB2_Credits);
}
static void CB2_Credits(void)
{
switch (RollCredits())
{
case 0:
RunTasks();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
break;
case 1:
if (sCreditsMgr->unk_1D & 1)
{
Overworld_CreditsMainCB();
}
else
{
RunTasks();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
}
sCreditsMgr->unk_1D++;
break;
case 2:
FlagClear(FLAG_DONT_SHOW_MAP_NAME_POPUP);
gDisableMapMusicChangeOnMapLoad = MUSIC_DISABLE_OFF;
Free(sCreditsMgr);
SoftReset(RESET_ALL);
// noreturn
}
}
static void SwitchWin1OffWin0On(void)
{
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN1_ON);
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
SetGpuReg(REG_OFFSET_WININ, 0x1F3F);
SetGpuReg(REG_OFFSET_WINOUT, 0x000E);
}
static void InitBgDarkenEffect(void)
{
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT1_BG2 | BLDCNT_TGT1_BG3 | BLDCNT_EFFECT_DARKEN);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 4));
SetGpuReg(REG_OFFSET_BLDY, 10);
}
static void CreateCreditsWindow(void)
{
sCreditsMgr->windowId = AddWindow(&sCreditsWindowTemplate);
FillWindowPixelBuffer(sCreditsMgr->windowId, PIXEL_FILL(0));
PutWindowTilemap(sCreditsMgr->windowId);
CopyWindowToVram(sCreditsMgr->windowId, COPYWIN_FULL);
sCreditsMgr->windowIsActive = TRUE;
}
static void DestroyCreditsWindow(void)
{
if (sCreditsMgr->windowIsActive)
{
RemoveWindow(sCreditsMgr->windowId);
CleanupOverworldWindowsAndTilemaps();
sCreditsMgr->windowIsActive = FALSE;
}
}
static bool32 DoOverworldMapScrollScene(u8 whichMon)
{
switch (sCreditsMgr->subseqno)
{
case 0:
FlagSet(FLAG_DONT_SHOW_MAP_NAME_POPUP);
gDisableMapMusicChangeOnMapLoad = MUSIC_DISABLE_KEEP;
sCreditsMgr->ovwldseqno = 0;
sCreditsMgr->subseqno++;
// fallthrough
case 1:
if (!Overworld_DoScrollSceneForCredits(&sCreditsMgr->ovwldseqno, sOverworldMapScenes[sCreditsMgr->whichMon], QL_TINT_NONE))
return FALSE;
CreateCreditsWindow();
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, DISPLAY_WIDTH));
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(36, DISPLAY_HEIGHT - 36));
SwitchWin1OffWin0On();
InitBgDarkenEffect();
Menu_LoadStdPalAt(BG_PLTT_ID(15));
gPlttBufferUnfaded[BG_PLTT_ID(15) + 15] = RGB_BLACK;
gPlttBufferFaded[BG_PLTT_ID(15) + 15] = RGB_BLACK;
return TRUE;
default:
return FALSE;
}
}
static s32 RollCredits(void)
{
u16 win0v[8];
switch (sCreditsMgr->mainseqno)
{
case CREDITSSCENE_INIT_WIN0:
SwitchWin1OffWin0On();
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, DISPLAY_WIDTH));
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(DISPLAY_HEIGHT / 2 - 1, DISPLAY_HEIGHT / 2 + 1));
sCreditsMgr->mainseqno = CREDITSSCENE_SETUP_DARKEN_EFFECT;
return 0;
case CREDITSSCENE_SETUP_DARKEN_EFFECT:
InitBgDarkenEffect();
CreateCreditsWindow();
Menu_LoadStdPalAt(BG_PLTT_ID(15));
gPlttBufferUnfaded[BG_PLTT_ID(15) + 15] = RGB_BLACK;
gPlttBufferFaded[BG_PLTT_ID(15) + 15] = RGB_BLACK;
sCreditsMgr->mainseqno = CREDITSSCENE_OPEN_WIN0;
return 0;
case CREDITSSCENE_OPEN_WIN0:
win0v[0] = GetGpuReg(REG_OFFSET_WIN0V) >> 8;
win0v[1] = GetGpuReg(REG_OFFSET_WIN0V) & 0xFF;
if (win0v[0] == 0x24)
{
sCreditsMgr->timer = 0;
sCreditsMgr->mainseqno = CREDITSSCENE_LOAD_PLAYER_SPRITE_AT_INDIGO;
}
else
{
win0v[0]--;
win0v[1]++;
SetGpuReg(REG_OFFSET_WIN0V, (win0v[0] << 8) + win0v[1]);
}
return 0;
case CREDITSSCENE_LOAD_PLAYER_SPRITE_AT_INDIGO:
if (sCreditsMgr->timer)
{
sCreditsMgr->timer--;
return 0;
}
LoadPlayerOrRivalSprite(0);
sCreditsMgr->timer = 100;
sCreditsMgr->mainseqno = CREDITSSCENE_PRINT_TITLE_STAFF;
return 0;
case CREDITSSCENE_PRINT_TITLE_STAFF:
if (sCreditsMgr->timer)
{
sCreditsMgr->timer--;
return 0;
}
sCreditsMgr->timer = 360;
AddTextPrinterParameterized4(sCreditsMgr->windowId, FONT_NORMAL_COPY_1, 0x08, 0x29, 1, 2, sTextColor_Header, 0, TITLE_TEXT);
sCreditsMgr->mainseqno = CREDITSSCENE_WAIT_TITLE_STAFF;
return 0;
case CREDITSSCENE_WAIT_TITLE_STAFF:
if (sCreditsMgr->timer)
{
sCreditsMgr->timer--;
return 0;
}
DestroyCreditsWindow();
sCreditsMgr->mainseqno = CREDITSSCENE_EXEC_CMD;
sCreditsMgr->timer = 0;
sCreditsMgr->scrcmdidx = 0;
return 0;
case CREDITSSCENE_EXEC_CMD:
if (sCreditsMgr->timer != 0)
{
sCreditsMgr->timer--;
return sCreditsMgr->canSpeedThrough;
}
switch (sCreditsScript[sCreditsMgr->scrcmdidx].cmd)
{
case CREDITSSCRCMD_PRINT:
BeginNormalPaletteFade(0x00008000, 0, 0, 16, RGB_BLACK);
sCreditsMgr->mainseqno = CREDITSSCENE_PRINT_ADDPRINTER1;
FillWindowPixelBuffer(sCreditsMgr->windowId, PIXEL_FILL(0));
return sCreditsMgr->canSpeedThrough;
case CREDITSSCRCMD_MAPNEXT:
sCreditsMgr->mainseqno = CREDITSSCENE_MAPNEXT_DESTROYWINDOW;
sCreditsMgr->whichMon = sCreditsScript[sCreditsMgr->scrcmdidx].param;
FadeSelectedPals(1, 0, 0x3FFFFFFF);
break;
case CREDITSSCRCMD_MAP:
sCreditsMgr->mainseqno = CREDITSSCENE_MAP_LOADMAP_CREATESPRITES;
sCreditsMgr->whichMon = sCreditsScript[sCreditsMgr->scrcmdidx].param;
break;
case CREDITSSCRCMD_MON:
sCreditsMgr->mainseqno = CREDITSSCENE_MON_DESTROY_ASSETS;
sCreditsMgr->whichMon = sCreditsScript[sCreditsMgr->scrcmdidx].param;
FadeScreen(FADE_TO_BLACK, 0);
break;
case CREDITSSCRCMD_THEENDGFX:
sCreditsMgr->mainseqno = CREDITSSCENE_THEEND_DESTROY_ASSETS;
sCreditsMgr->whichMon = sCreditsScript[sCreditsMgr->scrcmdidx].param;
BeginNormalPaletteFade(PALETTES_ALL, 4, 0, 16, RGB_BLACK);
break;
case CREDITSSCRCMD_WAITBUTTON:
sCreditsMgr->mainseqno = CREDITSSCENE_WAITBUTTON;
break;
}
sCreditsMgr->timer = sCreditsScript[sCreditsMgr->scrcmdidx].duration;
sCreditsMgr->scrcmdidx++;
return 0;
case CREDITSSCENE_PRINT_ADDPRINTER1:
if (gPaletteFade.active)
return sCreditsMgr->canSpeedThrough;
win0v[0] = sCreditsTexts[sCreditsScript[sCreditsMgr->scrcmdidx].param].unused;
AddTextPrinterParameterized4(sCreditsMgr->windowId, FONT_NORMAL_COPY_1, 2, 6, 0, 0, sTextColor_Header, -1, sCreditsTexts[sCreditsScript[sCreditsMgr->scrcmdidx].param].title);
sCreditsMgr->mainseqno = CREDITSSCENE_PRINT_ADDPRINTER2;
return sCreditsMgr->canSpeedThrough;
case CREDITSSCENE_PRINT_ADDPRINTER2:
win0v[0] = sCreditsTexts[sCreditsScript[sCreditsMgr->scrcmdidx].param].unused;
AddTextPrinterParameterized4(sCreditsMgr->windowId, FONT_NORMAL, 8, 6, 0, 0, sTextColor_Regular, -1, sCreditsTexts[sCreditsScript[sCreditsMgr->scrcmdidx].param].names);
sCreditsMgr->mainseqno = CREDITSSCENE_PRINT_DELAY;
return sCreditsMgr->canSpeedThrough;
case CREDITSSCENE_PRINT_DELAY:
CopyWindowToVram(sCreditsMgr->windowId, COPYWIN_GFX);
sCreditsMgr->timer = sCreditsScript[sCreditsMgr->scrcmdidx].duration;
sCreditsMgr->scrcmdidx++;
BeginNormalPaletteFade(0x00008000, 0, 16, 0, RGB_BLACK);
sCreditsMgr->mainseqno = CREDITSSCENE_EXEC_CMD;
return sCreditsMgr->canSpeedThrough;
case CREDITSSCENE_MAPNEXT_DESTROYWINDOW:
if (!gPaletteFade.active)
{
DestroyCreditsWindow();
sCreditsMgr->subseqno = 0;
sCreditsMgr->mainseqno = CREDITSSCENE_MAPNEXT_LOADMAP;
}
return 0;
case CREDITSSCENE_MAPNEXT_LOADMAP:
if (DoOverworldMapScrollScene(sCreditsMgr->whichMon))
{
sCreditsMgr->canSpeedThrough = 1;
sCreditsMgr->mainseqno = CREDITSSCENE_EXEC_CMD;
}
return 0;
case CREDITSSCENE_MAP_LOADMAP_CREATESPRITES:
if (!gPaletteFade.active)
{
DestroyCreditsWindow();
sCreditsMgr->subseqno = 0;
while (!DoOverworldMapScrollScene(sCreditsMgr->whichMon))
{}
switch (sCreditsMgr->whichMon)
{
case 3:
default:
win0v[0] = 1;
break;
case 6:
win0v[0] = 2;
break;
case 9:
win0v[0] = 3;
break;
case 12:
win0v[0] = 4;
break;
}
LoadPlayerOrRivalSprite(win0v[0]);
sCreditsMgr->canSpeedThrough = 1;
sCreditsMgr->mainseqno = CREDITSSCENE_EXEC_CMD;
}
return 0;
case CREDITSSCENE_MON_DESTROY_ASSETS:
if (!gPaletteFade.active)
{
DestroyPlayerOrRivalSprite();
DestroyCreditsWindow();
sCreditsMgr->subseqno = 0;
sCreditsMgr->canSpeedThrough = 0;
sCreditsMgr->mainseqno = CREDITSSCENE_MON_SHOW;
}
return 0;
case CREDITSSCENE_MON_SHOW:
if (DoCreditsMonScene())
{
sCreditsMgr->mainseqno = CREDITSSCENE_EXEC_CMD;
}
return 0;
case CREDITSSCENE_THEEND_DESTROY_ASSETS:
if (!gPaletteFade.active)
{
DestroyCreditsWindow();
sCreditsMgr->subseqno = 0;
sCreditsMgr->canSpeedThrough = 0;
sCreditsMgr->mainseqno = CREDITSSCENE_THEEND_SHOW;
}
return 0;
case CREDITSSCENE_THEEND_SHOW:
if (DoCopyrightOrTheEndGfxScene())
{
sCreditsMgr->mainseqno = CREDITSSCENE_EXEC_CMD;
}
return 0;
case CREDITSSCENE_WAITBUTTON:
if (JOY_NEW(A_BUTTON))
{
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_WHITE);
sCreditsMgr->mainseqno = CREDITSSCENE_TERMINATE;
return 0;
}
if (sCreditsMgr->timer)
{
sCreditsMgr->timer--;
}
else
{
sCreditsMgr->mainseqno = CREDITSSCENE_TERMINATE;
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_WHITE);
}
return 0;
case CREDITSSCENE_TERMINATE:
if (!gPaletteFade.active)
DestroyCreditsWindow();
break;
}
return 2;
}
static void VBlankCB(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
static void LoadCreditsMonPic(u8 whichMon)
{
switch (whichMon)
{
case CREDITSMON_CHARIZARD:
InitWindows(sWindowTemplates_Charizard);
FillWindowPixelBuffer(0, PIXEL_FILL(0));
LoadMonPicInWindow(SPECIES_CHARIZARD, SHINY_ODDS, 0, TRUE, 10, 0);
CopyToWindowPixelBuffer(1, (const void *)sCharizard1_Tiles, 0, 0);
CopyToWindowPixelBuffer(2, (const void *)sCharizard2_Tiles, 0, 0);
break;
case CREDITSMON_VENUSAUR:
InitWindows(sWindowTemplates_Venusaur);
FillWindowPixelBuffer(0, PIXEL_FILL(0));
LoadMonPicInWindow(SPECIES_VENUSAUR, SHINY_ODDS, 0, TRUE, 10, 0);
CopyToWindowPixelBuffer(1, (const void *)sVenusaur1_Tiles, 0, 0);
CopyToWindowPixelBuffer(2, (const void *)sVenusaur2_Tiles, 0, 0);
break;
case CREDITSMON_BLASTOISE:
InitWindows(sWindowTemplates_Blastoise);
FillWindowPixelBuffer(0, PIXEL_FILL(0));
LoadMonPicInWindow(SPECIES_BLASTOISE, SHINY_ODDS, 0, TRUE, 10, 0);
CopyToWindowPixelBuffer(1, (const void *)sBlastoise1_Tiles, 0, 0);
CopyToWindowPixelBuffer(2, (const void *)sBlastoise2_Tiles, 0, 0);
break;
case CREDITSMON_PIKACHU:
InitWindows(sWindowTemplates_Pikachu);
FillWindowPixelBuffer(0, PIXEL_FILL(0));
LoadMonPicInWindow(SPECIES_PIKACHU, SHINY_ODDS, 0, TRUE, 10, 0);
CopyToWindowPixelBuffer(1, (const void *)sPikachu1_Tiles, 0, 0);
CopyToWindowPixelBuffer(2, (const void *)sPikachu2_Tiles, 0, 0);
break;
}
CopyWindowToVram(0, COPYWIN_GFX);
CopyWindowToVram(1, COPYWIN_GFX);
CopyWindowToVram(2, COPYWIN_GFX);
}
static u16 GetCreditsMonSpecies(u8 whichMon)
{
switch (whichMon)
{
case CREDITSMON_CHARIZARD:
return SPECIES_CHARIZARD;
case CREDITSMON_VENUSAUR:
return SPECIES_VENUSAUR;
case CREDITSMON_BLASTOISE:
return SPECIES_BLASTOISE;
case CREDITSMON_PIKACHU:
return SPECIES_PIKACHU;
default:
return SPECIES_NONE;
}
}
static bool32 DoCreditsMonScene(void)
{
switch (sCreditsMgr->subseqno)
{
case 0:
SetVBlankCallback(NULL);
SetHBlankCallback(NULL);
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON);
SetGpuReg(REG_OFFSET_WININ, 0);
SetGpuReg(REG_OFFSET_WINOUT, 0);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
ResetPaletteFade();
ResetSpriteData();
ResetTasks();
ResetBgsAndClearDma3BusyFlags(1);
InitBgsFromTemplates(1, sBgTemplates_MonSceneOrTheEnd, NELEMS(sBgTemplates_MonSceneOrTheEnd));
SetBgTilemapBuffer(0, Alloc(BG_SCREEN_SIZE));
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
sCreditsMgr->creditsMonTimer = 0;
sCreditsMgr->unk_0E = 0;
SetBgAffine(2, 0x8000, 0x8000, 0x78, 0x50, sCreditsMgr->creditsMonTimer, sCreditsMgr->creditsMonTimer, 0);
DecompressAndLoadBgGfxUsingHeap(1, gCreditsMonPokeball_Tiles, 0x2000, 0, 0);
DecompressAndLoadBgGfxUsingHeap(2, sCreditsMonCircle_Tiles, 0x2000, 0, 0);
DecompressAndLoadBgGfxUsingHeap(1, gCreditsMonPokeball_Tilemap, 0x500, 0, 1);
DecompressAndLoadBgGfxUsingHeap(2, sCreditsMonCircle_Tilemap, 0x400, 0, 1);
LoadPalette(gCreditsMonPokeball_Pals[sCreditsMgr->whichMon], BG_PLTT_ID(0), PLTT_SIZE_4BPP);
LoadPalette(sCreditsMonCircle_Pal, BG_PLTT_ID(15), sizeof(sCreditsMonCircle_Pal));
LoadCreditsMonPic(sCreditsMgr->whichMon);
SetVBlankCallback(VBlankCB);
EnableInterrupts(INTR_FLAG_VBLANK);
sCreditsMgr->subseqno++;
break;
case 1:
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 17);
PutWindowTilemap(0);
CopyBgTilemapBufferToVram(2);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(0);
sCreditsMgr->subseqno++;
break;
case 2:
ShowBg(2);
ShowBg(0);
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK);
sCreditsMgr->creditsMonTimer = 40;
sCreditsMgr->subseqno++;
break;
case 3:
if (sCreditsMgr->creditsMonTimer != 0)
sCreditsMgr->creditsMonTimer--;
else
sCreditsMgr->subseqno++;
break;
case 4:
if (!gPaletteFade.active)
{
sCreditsMgr->creditsMonTimer = 8;
sCreditsMgr->unk_0E = 1;
sCreditsMgr->subseqno++;
}
break;
case 5:
if (sCreditsMgr->creditsMonTimer != 0)
sCreditsMgr->creditsMonTimer--;
else
{
if (sCreditsMgr->unk_0E < 3)
{
PutWindowTilemap(sCreditsMgr->unk_0E);
CopyBgTilemapBufferToVram(0);
sCreditsMgr->creditsMonTimer = 4;
sCreditsMgr->unk_0E++;
}
else
sCreditsMgr->subseqno++;
}
break;
case 6:
if (sCreditsMgr->creditsMonTimer < 256)
{
sCreditsMgr->creditsMonTimer += 16;
SetBgAffine(2, 0x8000, 0x8000, 0x78, 0x50, sCreditsMgr->creditsMonTimer, sCreditsMgr->creditsMonTimer, 0);
}
else
{
SetBgAffine(2, 0x8000, 0x8000, 0x78, 0x50, 0x100, 0x100, 0);
sCreditsMgr->creditsMonTimer = 32;
sCreditsMgr->subseqno++;
}
break;
case 7:
if (sCreditsMgr->creditsMonTimer != 0)
sCreditsMgr->creditsMonTimer--;
else
{
HideBg(2);
ShowBg(1);
PlayCry_NormalNoDucking(GetCreditsMonSpecies(sCreditsMgr->whichMon), 0, CRY_VOLUME_RS, CRY_PRIORITY_NORMAL);
sCreditsMgr->creditsMonTimer = 128;
sCreditsMgr->subseqno++;
}
break;
case 8:
if (sCreditsMgr->creditsMonTimer != 0)
sCreditsMgr->creditsMonTimer--;
else
{
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
sCreditsMgr->subseqno++;
}
break;
case 9:
if (!gPaletteFade.active)
{
FreeAllWindowBuffers();
Free(GetBgTilemapBuffer(0));
sCreditsMgr->subseqno = 0;
return TRUE;
}
break;
}
return FALSE;
}
static bool32 DoCopyrightOrTheEndGfxScene(void)
{
switch (sCreditsMgr->subseqno)
{
case 0:
SetVBlankCallback(NULL);
SetHBlankCallback(NULL);
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON);
SetGpuReg(REG_OFFSET_WININ, 0);
SetGpuReg(REG_OFFSET_WINOUT, 0);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
ResetPaletteFade();
ResetSpriteData();
ResetTasks();
ResetBgsAndClearDma3BusyFlags(1);
InitBgsFromTemplates(0, sBgTemplates_MonSceneOrTheEnd, 1);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
DecompressAndLoadBgGfxUsingHeap(0, sCopyrightOrTheEndGfxHeaders[sCreditsMgr->whichMon].tiles, 0x2000, 0, 0);
DecompressAndLoadBgGfxUsingHeap(0, sCopyrightOrTheEndGfxHeaders[sCreditsMgr->whichMon].map, 0x800, 0, 1);
LoadPalette(sCopyrightOrTheEndGfxHeaders[sCreditsMgr->whichMon].palette, BG_PLTT_ID(0), 16 * PLTT_SIZE_4BPP);
SetVBlankCallback(VBlankCB);
EnableInterrupts(INTR_FLAG_VBLANK);
sCreditsMgr->subseqno++;
break;
case 1:
CopyBgTilemapBufferToVram(0);
sCreditsMgr->subseqno++;
break;
case 2:
ShowBg(0);
if (sCreditsMgr->whichMon != 0)
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0, RGB_BLACK);
else
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK);
sCreditsMgr->subseqno++;
break;
case 3:
if (!gPaletteFade.active)
{
sCreditsMgr->subseqno = 0;
return TRUE;
}
break;
}
return FALSE;
}
static void Task_MovePlayerAndGroundSprites(u8 taskId)
{
struct CreditsTaskData * data = (void *)gTasks[taskId].data;
switch (data->spriteMoveCmd)
{
case 0:
break;
case 1:
if (gSprites[data->characterSpriteId].x != 0xD0)
{
gSprites[data->characterSpriteId].x--;
gSprites[data->groundSpriteId].x--;
}
else
{
data->spriteMoveCmd = 0;
}
break;
case 2:
if (sCreditsMgr->unk_1D & 1)
{
if (gSprites[data->characterSpriteId].y != 0x50)
{
gSprites[data->characterSpriteId].y--;
gSprites[data->groundSpriteId].y--;
}
else
{
data->spriteMoveCmd = 0;
}
}
break;
case 3:
if (sCreditsMgr->mainseqno == 15)
{
gSprites[data->characterSpriteId].x--;
gSprites[data->groundSpriteId].x--;
}
break;
}
}
static void DestroyPlayerOrRivalSprite(void)
{
if (sCreditsMgr->taskId != TASK_NONE)
{
struct CreditsTaskData * data = (void *)gTasks[sCreditsMgr->taskId].data;
FreeSpriteTilesByTag(data->characterTilesTag);
DestroySprite(&gSprites[data->characterSpriteId]);
FreeSpriteTilesByTag(data->groundTilesTag);
DestroySprite(&gSprites[data->groundSpriteId]);
DestroyTask(sCreditsMgr->taskId);
sCreditsMgr->taskId = TASK_NONE;
}
}
static void LoadPlayerOrRivalSprite(u8 whichScene)
{
u8 taskId;
struct CreditsTaskData * data;
s32 x, y;
struct SpriteTemplate sprTemplate;
struct CompressedSpriteSheet sprSheet;
if (sCreditsMgr->taskId == TASK_NONE)
{
taskId = CreateTask(Task_MovePlayerAndGroundSprites, 0);
data = (void *)gTasks[taskId].data;
sCreditsMgr->taskId = taskId;
switch (sPlayerRivalSpriteParams[whichScene][2])
{
default:
case 0:
x = DISPLAY_WIDTH - 32;
y = DISPLAY_HEIGHT / 2;
break;
case 1:
x = DISPLAY_WIDTH + 32;
y = DISPLAY_HEIGHT / 2;
break;
case 2:
x = DISPLAY_WIDTH - 32;
y = DISPLAY_HEIGHT;
break;
}
data->spriteMoveCmd = sPlayerRivalSpriteParams[whichScene][2];
data->characterTilesTag = GFXTAG_CHARACTER;
data->characterPalTag = TAG_NONE;
switch (sPlayerRivalSpriteParams[whichScene][0])
{
case 0:
// Player
if (gSaveBlock2Ptr->playerGender == MALE)
{
sprSheet.data = sPlayerMale_Tiles;
sprSheet.size = 0x3000;
sprSheet.tag = data->characterTilesTag;
LoadCompressedSpriteSheet(&sprSheet);
LoadPalette(sPlayerMale_Pal, OBJ_PLTT_ID(15), sizeof(sPlayerMale_Pal));
}
else
{
sprSheet.data = sPlayerFemale_Tiles;
sprSheet.size = 0x3000;
sprSheet.tag = data->characterTilesTag;
LoadCompressedSpriteSheet(&sprSheet);
LoadPalette(sPlayerFemale_Pal, OBJ_PLTT_ID(15), sizeof(sPlayerFemale_Pal));
}
break;
case 1:
// Rival
sprSheet.data = sRival_Tiles;
sprSheet.size = 0x3000;
sprSheet.tag = data->characterTilesTag;
LoadCompressedSpriteSheet(&sprSheet);
LoadPalette(sRival_Pal, OBJ_PLTT_ID(15), sizeof(sRival_Pal));
break;
}
sprTemplate = sPlayerOrRivalSpriteTemplate;
sprTemplate.tileTag = data->characterTilesTag;
data->characterSpriteId = CreateSprite(&sprTemplate, x, y, 0);
gSprites[data->characterSpriteId].oam.paletteNum = 15;
gSprites[data->characterSpriteId].subpriority = 0;
data->groundTilesTag = GFXTAG_GROUND;
data->groundPalTag = TAG_NONE;
switch (sPlayerRivalSpriteParams[whichScene][1])
{
case 0:
sprSheet.data = sGround_Grass_Tiles;
sprSheet.size = 0x3000;
sprSheet.tag = data->groundTilesTag;
LoadCompressedSpriteSheet(&sprSheet);
LoadPalette(sGround_Grass_Pal, OBJ_PLTT_ID(14), sizeof(sGround_Grass_Pal));
sprTemplate = sGroundSpriteTemplate_Running;
break;
case 1:
sprSheet.data = sGround_Grass_Tiles;
sprSheet.size = 0x3000;
sprSheet.tag = data->groundTilesTag;
LoadCompressedSpriteSheet(&sprSheet);
LoadPalette(sGround_Grass_Pal, OBJ_PLTT_ID(14), sizeof(sGround_Grass_Pal));
sprTemplate = sGroundSpriteTemplate_Static;
break;
case 2:
sprSheet.data = sGround_Dirt_Tiles;
sprSheet.size = 0x3000;
sprSheet.tag = data->groundTilesTag;
LoadCompressedSpriteSheet(&sprSheet);
LoadPalette(sGround_Dirt_Pal, OBJ_PLTT_ID(14), sizeof(sGround_Dirt_Pal));
sprTemplate = sGroundSpriteTemplate_Running;
break;
case 3:
sprSheet.data = sGround_City_Tiles;
sprSheet.size = 0x3000;
sprSheet.tag = data->groundTilesTag;
LoadCompressedSpriteSheet(&sprSheet);
LoadPalette(sGround_City_Pal, OBJ_PLTT_ID(14), sizeof(sGround_City_Pal));
sprTemplate = sGroundSpriteTemplate_Running;
break;
}
sprTemplate.tileTag = data->groundTilesTag;
data->groundSpriteId = CreateSprite(&sprTemplate, x, y + 38, 0);
gSprites[data->groundSpriteId].oam.paletteNum = 14;
gSprites[data->groundSpriteId].subpriority = 1;
}
}
|
3998fa7df70de242d954ffcb36aa468c5e9c445e
|
c6759b857e55991fea3ef0b465dbcee53fa38714
|
/rtos/pmsis/tests/api/quick/cluster/multiple-tasks/test.c
|
43e29d515b2391d0a925f1264a59ce1aa1319eb6
|
[
"Apache-2.0"
] |
permissive
|
GreenWaves-Technologies/gap_sdk
|
1b343bba97b7a5ce62a24162bd72eef5cc67e269
|
3fea306d52ee33f923f2423c5a75d9eb1c07e904
|
refs/heads/master
| 2023-09-01T14:38:34.270427
| 2023-08-10T09:04:44
| 2023-08-10T09:04:44
| 133,324,605
| 145
| 96
|
Apache-2.0
| 2023-08-27T19:03:52
| 2018-05-14T07:50:29
|
C
|
UTF-8
|
C
| false
| false
| 4,385
|
c
|
test.c
|
#include "pmsis.h"
#include "stdio.h"
#define NB_ITER 200
#define NB_HIGH_PRIO_TASKS 10
#define NB_LOW_PRIO_TASKS 3
#define STACK_SIZE 1024
static int nb_fork;
static int nb_callback_exec;
static PI_CL_L1 int current_iter[NB_LOW_PRIO_TASKS];
static int nb_yield;
static pi_cluster_task_t low_prio_cluster_task[NB_LOW_PRIO_TASKS], high_prio_cluster_task;
static pi_task_t low_prio_task[NB_LOW_PRIO_TASKS], high_prio_task, end_task;
static PI_CL_L1 int low_prio_errors = 0;
static void pe_entry(void *arg)
{
int *var = (int *)arg;
pi_cl_team_critical_enter();
*var |= 1 << (pi_core_id());
pi_cl_team_critical_exit();
}
static int check_fork(int nb_cores)
{
int var = 0;
nb_fork++;
pi_cl_team_fork(nb_cores, pe_entry, (void *)&var);
return (1<<pi_cl_team_nb_cores()) - 1 != var;
}
static void low_prio_cluster_entry(void *arg)
{
int *current_iter = (int *)arg;
if (pi_cl_cluster_nb_pe_cores() != NB_PE)
low_prio_errors += 1;
while ((*current_iter) < NB_ITER)
{
for (int i=0; i<=pi_cl_cluster_nb_pe_cores(); i++)
{
low_prio_errors += check_fork(i);
if (i != 0)
low_prio_errors += check_fork(0);
}
(*current_iter)++;
if (pi_cl_task_yield())
{
nb_yield++;
return;
}
}
}
static void high_prio_cluster_entry(void *arg)
{
}
static void low_prio_callback(void *arg)
{
if (arg)
{
pi_task_push((pi_task_t *)arg);
}
}
static int test_task_sync()
{
struct pi_device cluster_dev;
struct pi_cluster_conf conf;
int high_prio_errors = 0, errors = 0;
int stacks_size = STACK_SIZE * pi_cl_cluster_nb_pe_cores();
pi_cluster_conf_init(&conf);
conf.id = 0;
conf.scratch_size = stacks_size + 0x8000;
pi_open_from_conf(&cluster_dev, &conf);
pi_cluster_open(&cluster_dev);
for (int j=0; j<1; j++)
{
nb_fork = 0;
pi_task_block(&end_task);
for (int i=0; i<NB_LOW_PRIO_TASKS; i++)
{
// Init the task. We give it a stack from stack area to share it with other tasks
pi_cluster_task(&low_prio_cluster_task[i], &low_prio_cluster_entry, (void *)¤t_iter[i]);
void *stacks = pi_cl_l1_scratch_alloc(&cluster_dev, &low_prio_cluster_task[i], stacks_size);
pi_cluster_task_stacks(&low_prio_cluster_task[i], stacks, STACK_SIZE);
// Enqueue task
pi_cluster_enqueue_task_async(&cluster_dev,
&low_prio_cluster_task[i],
pi_task_callback(&low_prio_task[i], low_prio_callback, i==NB_LOW_PRIO_TASKS-1 ? (void *)&end_task : NULL)
);
}
// Init the prio task only once since we send it in sequence.
// Also give it a stack from scratch area to share it with low prio tasks.
// We give it priority 1 so that low prio tasks are preempted
pi_cluster_task(&high_prio_cluster_task, &high_prio_cluster_entry, (void *)&high_prio_errors);
void *stacks = pi_cl_l1_scratch_alloc(&cluster_dev, &high_prio_cluster_task, stacks_size);
pi_cluster_task_stacks(&high_prio_cluster_task, stacks, STACK_SIZE);
pi_cluster_task_priority(&high_prio_cluster_task, 1);
for (int i=0; i<NB_HIGH_PRIO_TASKS; i++)
{
// Send a prio task from time to time to let low prio tasks execute a bit
pi_time_wait_us(200);
pi_cluster_enqueue_task(&cluster_dev, &high_prio_cluster_task);
}
pi_task_wait_on(&end_task);
// Check that low prio tasks has always been preempted by high prio tasks
if (nb_yield != NB_HIGH_PRIO_TASKS)
{
errors++;
}
// Check that the task were correctly resumed by checking the total number of forks
if (nb_fork != 17*NB_ITER*NB_LOW_PRIO_TASKS)
errors++;
}
pi_cluster_close(&cluster_dev);
return errors + high_prio_errors + low_prio_errors;
}
int test_entry()
{
int errors = 0;
printf("Starting test\n");
errors += test_task_sync();
if (errors)
printf("Test failure\n");
else
printf("Test success\n");
return errors;
}
void test_kickoff(void *arg)
{
int ret = test_entry();
pmsis_exit(ret);
}
int main()
{
return pmsis_kickoff((void *)test_kickoff);
}
|
4d758a7d24554fd30bb73c4a7c2f752d6b8a42ed
|
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
|
/lib/libc/include/aarch64-macos.12-none/mach/arm/vm_param.h
|
b80ab26df04b818051fffdbd79ccceea6127859b
|
[
"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
| 3,682
|
h
|
vm_param.h
|
/*
* Copyright (c) 2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* FILE_ID: vm_param.h
*/
/*
* ARM machine dependent virtual memory parameters.
*/
#ifndef _MACH_ARM_VM_PARAM_H_
#define _MACH_ARM_VM_PARAM_H_
#if defined (__arm__) || defined (__arm64__)
#if !defined (KERNEL) && !defined (__ASSEMBLER__)
#include <mach/vm_page_size.h>
#endif
#define BYTE_SIZE 8 /* byte size in bits */
#define PAGE_SHIFT vm_page_shift
#define PAGE_SIZE vm_page_size
#define PAGE_MASK vm_page_mask
#define VM_PAGE_SIZE vm_page_size
#define machine_ptob(x) ((x) << PAGE_SHIFT)
#define PAGE_MAX_SHIFT 14
#define PAGE_MAX_SIZE (1 << PAGE_MAX_SHIFT)
#define PAGE_MAX_MASK (PAGE_MAX_SIZE-1)
#define PAGE_MIN_SHIFT 12
#define PAGE_MIN_SIZE (1 << PAGE_MIN_SHIFT)
#define PAGE_MIN_MASK (PAGE_MIN_SIZE-1)
#define VM_MAX_PAGE_ADDRESS MACH_VM_MAX_ADDRESS
#ifndef __ASSEMBLER__
#if defined (__arm__)
#define VM_MIN_ADDRESS ((vm_address_t) 0x00000000)
#define VM_MAX_ADDRESS ((vm_address_t) 0x80000000)
/* system-wide values */
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) 0)
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) VM_MAX_ADDRESS)
#elif defined (__arm64__)
#define VM_MIN_ADDRESS ((vm_address_t) 0x0000000000000000ULL)
#define VM_MAX_ADDRESS ((vm_address_t) 0x0000000080000000ULL)
/* system-wide values */
#define MACH_VM_MIN_ADDRESS_RAW 0x0ULL
#define MACH_VM_MAX_ADDRESS_RAW 0x00007FFFFE000000ULL
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_ADDRESS_RAW)
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_ADDRESS_RAW)
#define MACH_VM_MIN_GPU_CARVEOUT_ADDRESS_RAW 0x0000001000000000ULL
#define MACH_VM_MAX_GPU_CARVEOUT_ADDRESS_RAW 0x0000007000000000ULL
#define MACH_VM_MIN_GPU_CARVEOUT_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_GPU_CARVEOUT_ADDRESS_RAW)
#define MACH_VM_MAX_GPU_CARVEOUT_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_GPU_CARVEOUT_ADDRESS_RAW)
#else /* defined(__arm64__) */
#error architecture not supported
#endif
#define VM_MAP_MIN_ADDRESS VM_MIN_ADDRESS
#define VM_MAP_MAX_ADDRESS VM_MAX_ADDRESS
#endif /* !__ASSEMBLER__ */
#define SWI_SYSCALL 0x80
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_VM_PARAM_H_ */
|
1c2de504525323fb66b2d7cb2aed0efb544f633e
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/u-boot_new/include/compiler.h
|
0734ed494274558a0656925220d7e4861da7231e
|
[
"GPL-2.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
| 3,341
|
h
|
compiler.h
|
/*
* Keep all the ugly #ifdef for system stuff here
*/
#ifndef __COMPILER_H__
#define __COMPILER_H__
#include <stddef.h>
#ifdef USE_HOSTCC
#if defined(__BEOS__) || \
defined(__NetBSD__) || \
defined(__FreeBSD__) || \
defined(__sun__) || \
defined(__APPLE__)
# include <inttypes.h>
#elif defined(__linux__) || defined(__WIN32__) || defined(__MINGW32__)
# include <stdint.h>
#endif
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#if !defined(__WIN32__) && !defined(__MINGW32__)
# include <sys/mman.h>
#endif
/* Not all systems (like Windows) has this define, and yes
* we do replace/emulate mmap() on those systems ...
*/
#ifndef MAP_FAILED
# define MAP_FAILED ((void *)-1)
#endif
#include <fcntl.h>
#ifndef O_BINARY /* should be define'd on __WIN32__ */
#define O_BINARY 0
#endif
#ifdef __linux__
# include <endian.h>
# include <byteswap.h>
#elif defined(__MACH__) || defined(__FreeBSD__)
# include <machine/endian.h>
typedef unsigned long ulong;
#endif
typedef uint8_t __u8;
typedef uint16_t __u16;
typedef uint32_t __u32;
typedef unsigned int uint;
#define uswap_16(x) \
((((x) & 0xff00) >> 8) | \
(((x) & 0x00ff) << 8))
#define uswap_32(x) \
((((x) & 0xff000000) >> 24) | \
(((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | \
(((x) & 0x000000ff) << 24))
#define _uswap_64(x, sfx) \
((((x) & 0xff00000000000000##sfx) >> 56) | \
(((x) & 0x00ff000000000000##sfx) >> 40) | \
(((x) & 0x0000ff0000000000##sfx) >> 24) | \
(((x) & 0x000000ff00000000##sfx) >> 8) | \
(((x) & 0x00000000ff000000##sfx) << 8) | \
(((x) & 0x0000000000ff0000##sfx) << 24) | \
(((x) & 0x000000000000ff00##sfx) << 40) | \
(((x) & 0x00000000000000ff##sfx) << 56))
#if defined(__GNUC__)
# define uswap_64(x) _uswap_64(x, ull)
#else
# define uswap_64(x) _uswap_64(x, )
#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN
# define cpu_to_le16(x) (x)
# define cpu_to_le32(x) (x)
# define cpu_to_le64(x) (x)
# define le16_to_cpu(x) (x)
# define le32_to_cpu(x) (x)
# define le64_to_cpu(x) (x)
# define cpu_to_be16(x) uswap_16(x)
# define cpu_to_be32(x) uswap_32(x)
# define cpu_to_be64(x) uswap_64(x)
# define be16_to_cpu(x) uswap_16(x)
# define be32_to_cpu(x) uswap_32(x)
# define be64_to_cpu(x) uswap_64(x)
#else
# define cpu_to_le16(x) uswap_16(x)
# define cpu_to_le32(x) uswap_32(x)
# define cpu_to_le64(x) uswap_64(x)
# define le16_to_cpu(x) uswap_16(x)
# define le32_to_cpu(x) uswap_32(x)
# define le64_to_cpu(x) uswap_64(x)
# define cpu_to_be16(x) (x)
# define cpu_to_be32(x) (x)
# define cpu_to_be64(x) (x)
# define be16_to_cpu(x) (x)
# define be32_to_cpu(x) (x)
# define be64_to_cpu(x) (x)
#endif
#else /* !USE_HOSTCC */
#include <linux/string.h>
#include <linux/types.h>
#include <asm/byteorder.h>
#if __SIZEOF_LONG__ == 8
# define __WORDSIZE 64
#elif __SIZEOF_LONG__ == 4
# define __WORDSIZE 32
#else
/*
* Assume 32-bit for now - only newer toolchains support this feature and
* this is only required for sandbox support at present.
*/
#define __WORDSIZE 32
#endif
/* Type for `void *' pointers. */
typedef unsigned long int uintptr_t;
#endif /* USE_HOSTCC */
/* compiler options */
#define uninitialized_var(x) x = x
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
|
c5e1ccc615a82c0f43105dcaa96a8d275862e293
|
e025bf79689b2ce3319a8b0b37b3395d0baf4c74
|
/ksw2_extd.c
|
2cdd4e43b42999ea6ee3b8c92558f84386fe5f16
|
[
"MIT"
] |
permissive
|
lh3/ksw2
|
083e3410af8cbaacb427327ccb8ebaeefbd0bbc9
|
289609bd9e5381a13b16239d0a7703f1ff03f9ca
|
refs/heads/master
| 2023-07-10T05:04:26.800325
| 2023-06-27T17:21:11
| 2023-06-27T17:21:11
| 95,136,066
| 122
| 30
|
NOASSERTION
| 2023-06-27T17:21:12
| 2017-06-22T16:37:15
|
C
|
UTF-8
|
C
| false
| false
| 5,496
|
c
|
ksw2_extd.c
|
#include <stdio.h> // for debugging only
#include "ksw2.h"
typedef struct { int32_t h, e, e2; } eh_t;
void ksw_extd(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
int8_t gapo, int8_t gape, int8_t gapo2, int8_t gape2, int w, int zdrop, int flag, ksw_extz_t *ez)
{
eh_t *eh;
int8_t *qp; // query profile
int32_t i, j, k, max_j = 0, gapoe = gapo + gape, gapoe2 = gapo2 + gape2, n_col, *off = 0, with_cigar = !(flag&KSW_EZ_SCORE_ONLY);
uint8_t *z = 0; // backtrack matrix; in each cell: f<<4|e<<2|h; in principle, we can halve the memory, but backtrack will be more complex
ksw_reset_extz(ez);
// allocate memory
if (w < 0) w = tlen > qlen? tlen : qlen;
n_col = qlen < 2*w+1? qlen : 2*w+1; // maximum #columns of the backtrack matrix
qp = (int8_t*)kmalloc(km, qlen * m);
eh = (eh_t*)kcalloc(km, qlen + 1, sizeof(eh_t));
if (with_cigar) {
z = (uint8_t*)kmalloc(km, (size_t)n_col * tlen);
off = (int32_t*)kcalloc(km, tlen, 4);
}
// generate the query profile
for (k = i = 0; k < m; ++k) {
const int8_t *p = &mat[k * m];
for (j = 0; j < qlen; ++j) qp[i++] = p[query[j]];
}
// fill the first row
eh[0].h = 0, eh[0].e = -gapoe - gapoe, eh[0].e2 = -gapoe2 - gapoe2;
for (j = 1; j <= qlen && j <= w; ++j) {
int tmp;
eh[j].h = -(gapo + gape * j) > -(gapo2 + gape2 * j)? -(gapo + gape * j) : -(gapo2 + gape2 * j);
tmp = -(gapoe + gape * j) > -(gapoe2 + gape2 * j)? -(gapoe + gape * j) : -(gapoe2 + gape2 * j);
eh[j].e = tmp - gapoe;
eh[j].e2 = tmp - gapoe2;
}
for (; j <= qlen; ++j) eh[j].h = eh[j].e = eh[j].e2 = KSW_NEG_INF; // everything is -inf outside the band
// DP loop
for (i = 0; i < tlen; ++i) { // target sequence is in the outer loop
int32_t f, f2, h1, st, en, max = KSW_NEG_INF, tmp;
int8_t *q = &qp[target[i] * qlen];
st = i > w? i - w : 0;
en = i + w < qlen - 1? i + w : qlen - 1;
tmp = -(gapoe + gape * i) > -(gapoe2 + gape2 * i)? -(gapoe + gape * i) : -(gapoe2 + gape2 * i);
h1 = st > 0? KSW_NEG_INF : tmp;
f = st > 0? KSW_NEG_INF : tmp - gapoe;
f2 = st > 0? KSW_NEG_INF : tmp - gapoe2;
if (!with_cigar) {
for (j = st; j <= en; ++j) {
eh_t *p = &eh[j];
int32_t h = p->h, h2, e = p->e, e2 = p->e2;
p->h = h1;
h += q[j];
h = h >= e? h : e;
h = h >= f? h : f;
h = h >= e2? h : e2;
h = h >= f2? h : f2;
h1 = h;
max_j = max > h? max_j : j;
max = max > h? max : h;
h -= gapoe;
e -= gape;
e = e > h? e : h;
p->e = e;
f -= gape;
f = f > h? f : h;
h2 = h1 - gapoe2;
e2-= gape2;
e2 = e2 > h2? e2 : h2;
p->e2 = e2;
f2-= gape2;
f2 = f2 > h2? f2 : h2;
}
} else if (!(flag&KSW_EZ_RIGHT)) {
uint8_t *zi = &z[(long)i * n_col];
off[i] = st;
for (j = st; j <= en; ++j) {
eh_t *p = &eh[j];
int32_t h = p->h, h2, e = p->e, e2 = p->e2;
uint8_t d; // direction
p->h = h1;
h += q[j];
d = h >= e? 0 : 1;
h = h >= e? h : e;
d = h >= f? d : 2;
h = h >= f? h : f;
d = h >= e2? d : 3;
h = h >= e2? h : e2;
d = h >= f2? d : 4;
h = h >= f2? h : f2;
h1 = h;
max_j = max > h? max_j : j;
max = max > h? max : h;
h -= gapoe;
e -= gape;
d |= e > h? 1<<3 : 0;
e = e > h? e : h;
p->e = e;
f -= gape;
d |= f > h? 1<<4 : 0; // if we want to halve the memory, use one bit only, instead of two
f = f > h? f : h;
h2 = h1 - gapoe2;
e2-= gape2;
d |= e2 > h2? 1<<5 : 0;
e2 = e2 > h2? e2 : h2;
p->e2 = e2;
f2-= gape2;
d |= f2 > h2? 1<<6 : 0;
f2 = f2 > h2? f2 : h2;
zi[j - st] = d; // z[i,j] keeps h for the current cell and e/f for the next cell
}
} else {
uint8_t *zi = &z[(long)i * n_col];
off[i] = st;
for (j = st; j <= en; ++j) {
eh_t *p = &eh[j];
int32_t h = p->h, h2, e = p->e, e2 = p->e2;
uint8_t d; // direction
p->h = h1;
h += q[j];
d = h > e? 0 : 1;
h = h > e? h : e;
d = h > f? d : 2;
h = h > f? h : f;
d = h > e2? d : 3;
h = h > e2? h : e2;
d = h > f2? d : 4;
h = h > f2? h : f2;
h1 = h;
max_j = max > h? max_j : j;
max = max > h? max : h;
h -= gapoe;
e -= gape;
d |= e >= h? 1<<3 : 0;
e = e >= h? e : h;
p->e = e;
f -= gape;
d |= f >= h? 1<<4 : 0; // if we want to halve the memory, use one bit only, instead of two
f = f >= h? f : h;
h2 = h1 - gapoe2;
e2-= gape2;
d |= e2 >= h2? 1<<5 : 0;
e2 = e2 >= h2? e2 : h2;
p->e2 = e2;
f2-= gape2;
d |= f2 >= h2? 1<<6 : 0;
f2 = f2 >= h2? f2 : h2;
zi[j - st] = d; // z[i,j] keeps h for the current cell and e/f for the next cell
}
}
eh[j].h = h1, eh[j].e = KSW_NEG_INF;
// update ez
if (en == qlen - 1 && eh[qlen].h > ez->mqe)
ez->mqe = eh[qlen].h, ez->mqe_t = i;
if (i == tlen - 1)
ez->mte = max, ez->mte_q = max_j;
if (ksw_apply_zdrop(ez, 0, max, i, max_j, zdrop, gape2)) break;
if (i == tlen - 1 && en == qlen - 1)
ez->score = eh[qlen].h;
}
kfree(km, qp); kfree(km, eh);
if (with_cigar) {
int rev_cigar = !!(flag & KSW_EZ_REV_CIGAR);
if (!ez->zdropped && !(flag&KSW_EZ_EXTZ_ONLY))
ksw_backtrack(km, 0, rev_cigar, 0, z, off, 0, n_col, tlen-1, qlen-1, &ez->m_cigar, &ez->n_cigar, &ez->cigar);
else if (ez->max_t >= 0 && ez->max_q >= 0)
ksw_backtrack(km, 0, rev_cigar, 0, z, off, 0, n_col, ez->max_t, ez->max_q, &ez->m_cigar, &ez->n_cigar, &ez->cigar);
kfree(km, z); kfree(km, off);
}
}
|
44134182ddac693cf59e2d09bc0e7e5c6cfc1f4f
|
c8b39acfd4a857dc15ed3375e0d93e75fa3f1f64
|
/Engine/Source/ThirdParty/CEF3/pristine/cef_source/libcef/browser/thread_util.h
|
49bc0bf8ba8903315e31da7b766e621b59663087
|
[
"MIT",
"LicenseRef-scancode-proprietary-license",
"BSD-3-Clause"
] |
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
| 3,304
|
h
|
thread_util.h
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_THREAD_UTIL_H_
#define CEF_LIBCEF_BROWSER_THREAD_UTIL_H_
#pragma once
#include "base/location.h"
#include "base/logging.h"
#include "content/public/browser/browser_thread.h"
#define CEF_UIT content::BrowserThread::UI
#define CEF_IOT content::BrowserThread::IO
#define CEF_FILET content::BrowserThread::FILE
#define CEF_CURRENTLY_ON(id) content::BrowserThread::CurrentlyOn(id)
#define CEF_CURRENTLY_ON_UIT() CEF_CURRENTLY_ON(CEF_UIT)
#define CEF_CURRENTLY_ON_IOT() CEF_CURRENTLY_ON(CEF_IOT)
#define CEF_CURRENTLY_ON_FILET() CEF_CURRENTLY_ON(CEF_FILET)
#define CEF_REQUIRE(id) DCHECK(CEF_CURRENTLY_ON(id))
#define CEF_REQUIRE_UIT() CEF_REQUIRE(CEF_UIT)
#define CEF_REQUIRE_IOT() CEF_REQUIRE(CEF_IOT)
#define CEF_REQUIRE_FILET() CEF_REQUIRE(CEF_FILET)
#define CEF_REQUIRE_RETURN(id, var) \
if (!CEF_CURRENTLY_ON(id)) { \
NOTREACHED() << "called on invalid thread"; \
return var; \
}
#define CEF_REQUIRE_UIT_RETURN(var) CEF_REQUIRE_RETURN(CEF_UIT, var)
#define CEF_REQUIRE_IOT_RETURN(var) CEF_REQUIRE_RETURN(CEF_IOT, var)
#define CEF_REQUIRE_RETURN_VOID(id) \
if (!CEF_CURRENTLY_ON(id)) { \
NOTREACHED() << "called on invalid thread"; \
return; \
}
#define CEF_REQUIRE_UIT_RETURN_VOID() CEF_REQUIRE_RETURN_VOID(CEF_UIT)
#define CEF_REQUIRE_IOT_RETURN_VOID() CEF_REQUIRE_RETURN_VOID(CEF_IOT)
#define CEF_POST_TASK(id, task) \
content::BrowserThread::PostTask(id, FROM_HERE, task)
#define CEF_POST_DELAYED_TASK(id, task, delay_ms) \
content::BrowserThread::PostDelayedTask(id, FROM_HERE, task, \
base::TimeDelta::FromMilliseconds(delay_ms))
// Same as IMPLEMENT_REFCOUNTING() but using the specified Destructor.
#define IMPLEMENT_REFCOUNTING_EX(ClassName, Destructor) \
public: \
void AddRef() const OVERRIDE { \
ref_count_.AddRef(); \
} \
bool Release() const OVERRIDE { \
if (ref_count_.Release()) { \
Destructor::Destruct(this); \
return true; \
} \
return false; \
} \
bool HasOneRef() const OVERRIDE { \
return ref_count_.HasOneRef(); \
} \
private: \
CefRefCount ref_count_;
#define IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(ClassName) \
IMPLEMENT_REFCOUNTING_EX(ClassName, \
content::BrowserThread::DeleteOnUIThread)
#define IMPLEMENT_REFCOUNTING_DELETE_ON_IOT(ClassName) \
IMPLEMENT_REFCOUNTING_EX(ClassName, \
content::BrowserThread::DeleteOnIOThread)
#endif // CEF_LIBCEF_BROWSER_THREAD_UTIL_H_
|
caad2b46976d39332bcf0dc483e5e58c8bb268c0
|
ed98b77f3f09b392e68a0d59c48eec299e883bb9
|
/src/scip/dialog_default.h
|
c25949d0c4b91857766b8be3333fa300022ded67
|
[
"Apache-2.0"
] |
permissive
|
scipopt/scip
|
c8ddbe7cdec0a3af5a230c04b74b76ffacbdcc33
|
dc856a4c966ea50bd5f52c58d7be4fea33706f4c
|
refs/heads/master
| 2023-08-19T11:39:12.578790
| 2023-08-15T20:05:58
| 2023-08-15T20:05:58
| 342,522,859
| 262
| 46
|
NOASSERTION
| 2023-08-03T07:37:45
| 2021-02-26T09:16:17
|
C
|
UTF-8
|
C
| false
| false
| 14,187
|
h
|
dialog_default.h
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* This file is part of the program and library */
/* SCIP --- Solving Constraint Integer Programs */
/* */
/* Copyright (c) 2002-2023 Zuse Institute Berlin (ZIB) */
/* */
/* 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. */
/* */
/* You should have received a copy of the Apache-2.0 license */
/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**@file dialog_default.h
* @ingroup DIALOGS
* @brief default user interface dialog
* @author Tobias Achterberg
*/
/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
#ifndef __SCIP_DIALOG_DEFAULT_H__
#define __SCIP_DIALOG_DEFAULT_H__
#include "scip/def.h"
#include "scip/type_dialog.h"
#include "scip/type_retcode.h"
#include "scip/type_scip.h"
#ifdef __cplusplus
extern "C" {
#endif
/**@addtogroup DIALOGS
*
* @{
*/
/** standard menu dialog execution method, that displays it's help screen if the remaining command line is empty */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecMenu);
/** standard menu dialog execution method, that doesn't display it's help screen */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecMenuLazy);
/** dialog execution method for the change add constraint */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecChangeAddCons);
/** dialog execution method for the change bounds command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecChangeBounds);
/** dialog execution method for the freetransproblem command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecChangeFreetransproblem);
/** dialog execution method for the changing the objective sense */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecChangeObjSense);
/** dialog execution method for the checksol command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecChecksol);
/** dialog execution method for the cliquegraph command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecCliquegraph);
/** dialog execution method for the display benders command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayBenders);
/** dialog execution method for the display branching command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayBranching);
/** dialog execution method for the display compression command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayCompression);
/** dialog execution method for the display conflict command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayConflict);
/** dialog execution method for the display conshdlrs command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayConshdlrs);
/** dialog execution method for the display displaycols command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayDisplaycols);
/** dialog execution method for the display exprhdlrs command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayExprhdlrs);
/** dialog execution method for the display cutselectors command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayCutselectors);
/** dialog execution method for the display heuristics command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayHeuristics);
/** dialog execution method for the display memory command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayMemory);
/** dialog execution method for the display nodeselectors command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayNodeselectors);
/** dialog execution method for the display nlpi command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayNlpi);
/** dialog execution method for the display parameters command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayParameters);
/** dialog execution method for the display presolvers command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayPresolvers);
/** dialog execution method for the display pricer command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayPricers);
/** dialog execution method for the display problem command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayProblem);
/** dialog execution method for the display propagators command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayPropagators);
/** dialog execution method for the display readers command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayReaders);
/** dialog execution method for the display relaxators command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayRelaxators);
/** dialog execution method for the display separators command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplaySeparators);
/** dialog execution method for the display solution command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplaySolution);
/** dialog execution method for the display finitesolution command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayFiniteSolution);
/** dialog execution method for the display dual solution command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayDualSolution);
/** dialog execution method for the display of solutions in the pool command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplaySolutionPool);
/** dialog execution method for the display subproblem command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplaySubproblem);
/** dialog execution method for the display subsolution command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplaySubSolution);
/** dialog execution method for the display statistics command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayStatistics);
/** dialog execution method for the display reoptstatistics command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayReoptStatistics);
/** dialog execution method for the display transproblem command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayTransproblem);
/** dialog execution method for the display value command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayValue);
/** dialog execution method for the display varbranchstatistics command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayVarbranchstatistics);
/** dialog execution method for the display LP solution quality command */
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayLPSolutionQuality);
/** dialog execution method for the display transsolution command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayTranssolution);
/** dialog execution method for the help command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecHelp);
/** dialog execution method for the free command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecFree);
/** dialog execution method for the newstart command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecNewstart);
/** dialog execution method for the transform command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecTransform);
/** dialog execution method for the optimize command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecOptimize);
/** dialog execution method for the parallelopt command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecConcurrentOpt);
/** dialog execution method for the presolve command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecPresolve);
/** dialog execution method for the quit command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecQuit);
/** dialog execution method for the read command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecRead);
/** dialog execution method for the set default command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetDefault);
/** dialog execution method for the set load command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetLoad);
/** dialog execution method for the set save command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSave);
/** dialog execution method for the set diffsave command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetDiffsave);
/** dialog execution method for the set parameter command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetParam);
/** dialog description method for the set parameter command */
SCIP_EXPORT
SCIP_DECL_DIALOGDESC(SCIPdialogDescSetParam);
/** dialog execution method for the fix parameter command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecFixParam);
/** dialog description method for the fix parameter command */
SCIP_EXPORT
SCIP_DECL_DIALOGDESC(SCIPdialogDescFixParam);
/** dialog execution method for the set branching direction command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetBranchingDirection);
/** dialog execution method for the set branching priority command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetBranchingPriority);
/** dialog execution method for the set heuristics aggressive command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsAggressive);
/** dialog execution method for the set heuristics default command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsDefault);
/** dialog execution method for the set heuristics fast command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsFast);
/** dialog execution method for the set heuristics off command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsOff);
/** dialog execution method for the set presolving aggressive command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingAggressive);
/** dialog execution method for the set presolving default command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingDefault);
/** dialog execution method for the set presolving fast command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingFast);
/** dialog execution method for the set presolving off command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingOff);
/** dialog execution method for the set separating aggressive command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingAggressive);
/** dialog execution method for the set separating default command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingDefault);
/** dialog execution method for the set separating fast command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingFast);
/** dialog execution method for the set separating off command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingOff);
/** dialog execution method for the set emphasis counter command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisCounter);
/** dialog execution method for the set emphasis cpsolver command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisCpsolver);
/** dialog execution method for the set emphasis easy CIP command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisEasycip);
/** dialog execution method for the set emphasis feasibility command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisFeasibility);
/** dialog execution method for the set emphasis hard LP command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisHardlp);
/** dialog execution method for the set emphasis optimality command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisOptimality);
/** dialog execution method for the set emphasis numerics command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisNumerics);
/** dialog execution method for the set emphasis benchmark command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisBenchmark);
/** dialog execution method for the set limits objective command */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetLimitsObjective);
/** dialog execution method for linear constraint type classification */
SCIP_EXPORT
SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayLinearConsClassification);
/** creates a root dialog */
SCIP_EXPORT
SCIP_RETCODE SCIPcreateRootDialog(
SCIP* scip, /**< SCIP data structure */
SCIP_DIALOG** root /**< pointer to store the root dialog */
);
/** @} */
/**@addtogroup DialogIncludes
*
* @{
*/
/** includes or updates the default dialog menus in SCIP except for menus "fix" and "set" */
SCIP_EXPORT
SCIP_RETCODE SCIPincludeDialogDefaultBasic(
SCIP* scip /**< SCIP data structure */
);
/** includes or updates the "set" menu for each available parameter setting */
SCIP_EXPORT
SCIP_RETCODE SCIPincludeDialogDefaultSet(
SCIP* scip /**< SCIP data structure */
);
/** includes or updates the "fix" menu for each available parameter setting */
SCIP_EXPORT
SCIP_RETCODE SCIPincludeDialogDefaultFix(
SCIP* scip /**< SCIP data structure */
);
/** @} */
#ifdef __cplusplus
}
#endif
#endif
|
433c11916b4d9939798cb664ec7017984b7b035f
|
fe05f22c9e6be4ab8d7e1e3971c1b69102f31d1c
|
/dep/adflib/src/prefix.h
|
51a9e81ac6d6775a3e490ffccd47f1c14f467e78
|
[
"GPL-2.0-only",
"MIT",
"LicenseRef-scancode-public-domain",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense"
] |
permissive
|
davidgiven/fluxengine
|
53b3d5447c69b8fa9d04ccc5481f662e2554dc5a
|
9e61670116f6ececa3e51acfc50b196f74df5bb3
|
refs/heads/master
| 2023-09-01T08:05:34.560835
| 2023-08-20T20:00:51
| 2023-08-20T20:00:51
| 149,908,319
| 309
| 70
|
MIT
| 2023-08-20T20:01:44
| 2018-09-22T19:05:57
|
C++
|
UTF-8
|
C
| false
| false
| 1,019
|
h
|
prefix.h
|
#ifndef _PREFIX_H
#define _PREFIX_H 1
/*
* prefix.h
*
* $Id$
*
* adds symbol export directive under windows
* does nothing under Linux
*
* This file is part of ADFLib.
*
* ADFLib 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.
*
* ADFLib 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 Foobar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef WIN32DLL
#define PREFIX __declspec(dllexport)
#else
#define PREFIX
#endif /* WIN32DLL */
#endif /* _PREFIX_H */
|
3a7c90ed2ef84386c6896920ffe48662ad592b7d
|
76f9898ff7a555f4a729d725056a317af818375d
|
/src/code/sys_cfb.c
|
804f72b0894a730372ccdb44367eaa796921e833
|
[] |
no_license
|
z64proto/sw97
|
0b65837ab2f2a4073faca5670761d7fe0e74d29d
|
f571505ade2cefd4a5b5d19da06d33e7c6b02c60
|
refs/heads/master
| 2023-08-01T02:47:42.895871
| 2022-05-15T20:29:08
| 2022-05-15T20:29:08
| 430,216,978
| 208
| 29
| null | 2021-11-22T12:23:50
| 2021-11-20T21:52:59
|
C
|
UTF-8
|
C
| false
| false
| 691
|
c
|
sys_cfb.c
|
#include "global.h"
u32 sSysCfbFbPtr[2];
u32 sSysCfbEnd;
void SysCfb_Init(s32 n64dd) {
u32 screenSize;
u32 tmpFbEnd;
// Set Frame Buffer end depending on how much RAM exists
sSysCfbEnd = (osMemSize >= 0x800000U) ? 0x80800000 : 0x80400000;
screenSize = SCREEN_WIDTH * SCREEN_HEIGHT;
sSysCfbEnd &= ~0x3f;
sSysCfbFbPtr[0] = sSysCfbEnd - (screenSize * 4);
sSysCfbFbPtr[1] = sSysCfbEnd - (screenSize * 2);
}
void SysCfb_Reset() {
sSysCfbFbPtr[0] = 0;
sSysCfbFbPtr[1] = 0;
sSysCfbEnd = 0;
}
u32 SysCfb_GetFbPtr(s32 idx) {
if (idx < 2) {
return sSysCfbFbPtr[idx];
}
return 0;
}
u32 SysCfb_GetFbEnd() {
return sSysCfbEnd;
}
|
cf7e7c8a823627755a383720622dac6dd9dbd8d0
|
04e6c4b166e5c096ee06ae6bc1490e598fd7475c
|
/src/plugins/services.h
|
748ea9b0ffa6f82e3ecb1e764f76582ebd090bc6
|
[
"MIT"
] |
permissive
|
ardera/flutter-pi
|
42096385cb34fb334a96ef075448643c74623d6c
|
11c4fdc9d064c22e0f27a78de4adb5d6e19d56c4
|
refs/heads/master
| 2023-09-03T15:49:58.871337
| 2023-08-22T11:43:47
| 2023-08-22T11:44:17
| 190,380,053
| 1,301
| 155
|
MIT
| 2023-09-07T18:10:34
| 2019-06-05T11:10:56
|
C
|
UTF-8
|
C
| false
| false
| 874
|
h
|
services.h
|
#ifndef _SERVICES_PLUGIN_H
#define _SERVICES_PLUGIN_H
#include <stdio.h>
#include <string.h>
#define ORIENTATION_FROM_STRING(str) \
(streq(str, "DeviceOrientation.portraitUp") ? kPortraitUp : \
streq(str, "DeviceOrientation.landscapeLeft") ? kLandscapeLeft : \
streq(str, "DeviceOrientation.portraitDown") ? kPortraitDown : \
streq(str, "DeviceOrientation.landscapeRight") ? kLandscapeRight : \
-1)
#define FLUTTER_NAVIGATION_CHANNEL "flutter/navigation"
#define FLUTTER_ISOLATE_CHANNEL "flutter/isolate"
#define FLUTTER_PLATFORM_CHANNEL "flutter/platform"
#define FLUTTER_ACCESSIBILITY_CHANNEL "flutter/accessibility"
#define FLUTTER_PLATFORM_VIEWS_CHANNEL "flutter/platform_views"
#define FLUTTER_MOUSECURSOR_CHANNEL "flutter/mousecursor"
#endif
|
80d1e3c5e398a04c84dc231bbf5664be54ce9b9c
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/Infineon/libraries/IFX_PSOC6_HAL/mtb-pdl-cat1/drivers/source/cy_flash.c
|
f28589a30b30afc2cc9476cdb9601d923b58e91f
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LicenseRef-scancode-proprietary-license",
"Zlib",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 57,255
|
c
|
cy_flash.c
|
/***************************************************************************//**
* \file cy_flash.c
* \version 3.70
*
* \brief
* Provides the public functions for the API for the PSoC 6 Flash Driver.
*
********************************************************************************
* \copyright
* Copyright 2016-2021 Cypress Semiconductor Corporation
* SPDX-License-Identifier: Apache-2.0
*
* 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 "cy_device.h"
#if defined (CY_IP_M4CPUSS)
#include "cy_flash.h"
#include "cy_sysclk.h"
#include "cy_sysint.h"
#include "cy_ipc_drv.h"
#include "cy_ipc_sema.h"
#include "cy_ipc_pipe.h"
#include "cy_syslib.h"
#if defined (CY_DEVICE_SECURE)
#include "cy_pra.h"
#endif /* defined (CY_DEVICE_SECURE) */
CY_MISRA_DEVIATE_BLOCK_START('MISRA C-2012 Rule 11.3', 2, \
'IPC_STRUCT_Type will typecast to either IPC_STRUCT_V1_Type or IPC_STRUCT_V2_Type but not both on PDL initialization based on the target device at compile time.');
/***************************************
* Data Structure definitions
***************************************/
/* Flash driver context */
typedef struct
{
uint32_t opcode; /**< Specifies the code of flash operation */
uint32_t arg1; /**< Specifies the configuration of flash operation */
uint32_t arg2; /**< Specifies the configuration of flash operation */
uint32_t arg3; /**< Specifies the configuration of flash operation */
} cy_stc_flash_context_t;
/***************************************
* Macro definitions
***************************************/
/** \cond INTERNAL */
/** Set SROM API in blocking mode */
#define CY_FLASH_BLOCKING_MODE ((0x01UL) << 8UL)
/** Set SROM API in non blocking mode */
#define CY_FLASH_NON_BLOCKING_MODE (0UL)
/** SROM API flash region ID shift for flash row information */
#define CY_FLASH_REGION_ID_SHIFT (16U)
#define CY_FLASH_REGION_ID_MASK (3U)
#define CY_FLASH_ROW_ID_MASK (0xFFFFU)
/** SROM API flash region IDs */
#define CY_FLASH_REGION_ID_MAIN (0UL)
#define CY_FLASH_REGION_ID_EM_EEPROM (1UL)
#define CY_FLASH_REGION_ID_SFLASH (2UL)
/** SROM API opcode mask */
#define CY_FLASH_OPCODE_Msk ((0xFFUL) << 24UL)
/** SROM API opcode for flash write operation */
#define CY_FLASH_OPCODE_WRITE_ROW ((0x05UL) << 24UL)
/** SROM API opcode for flash program operation */
#define CY_FLASH_OPCODE_PROGRAM_ROW ((0x06UL) << 24UL)
/** SROM API opcode for row erase operation */
#define CY_FLASH_OPCODE_ERASE_ROW ((0x1CUL) << 24UL)
/** SROM API opcode for sub sector erase operation */
#define CY_FLASH_OPCODE_ERASE_SUB_SECTOR ((0x1DUL) << 24UL)
/** SROM API opcode for sector erase operation */
#define CY_FLASH_OPCODE_ERASE_SECTOR ((0x14UL) << 24UL)
/** SROM API opcode for flash checksum operation */
#define CY_FLASH_OPCODE_CHECKSUM ((0x0BUL) << 24UL)
/** SROM API opcode for flash hash operation */
#define CY_FLASH_OPCODE_HASH ((0x0DUL) << 24UL)
/** SROM API flash row shift for flash checksum operation */
#define CY_FLASH_OPCODE_CHECKSUM_ROW_SHIFT (8UL)
/** SROM API flash row shift for flash checksum operation */
#define CY_FLASH_OPCODE_CHECKSUM_REGION_SHIFT (22UL)
/** Data to be programmed to flash is located in SRAM memory region */
#define CY_FLASH_DATA_LOC_SRAM (0x100UL)
/** SROM API flash verification option for flash write operation */
#define CY_FLASH_CONFIG_VERIFICATION_EN ((0x01UL) << 16u)
/** Command completed with no errors */
#define CY_FLASH_ROMCODE_SUCCESS (0xA0000000UL)
/** Invalid device protection state */
#define CY_FLASH_ROMCODE_INVALID_PROTECTION (0xF0000001UL)
/** Invalid flash page latch address */
#define CY_FLASH_ROMCODE_INVALID_FM_PL (0xF0000003UL)
/** Invalid flash address */
#define CY_FLASH_ROMCODE_INVALID_FLASH_ADDR (0xF0000004UL)
/** Row is write protected */
#define CY_FLASH_ROMCODE_ROW_PROTECTED (0xF0000005UL)
/** Comparison between Page Latches and FM row failed */
#define CY_FLASH_ROMCODE_PL_ROW_COMP_FA (0xF0000022UL)
/** Command in progress; no error */
#define CY_FLASH_ROMCODE_IN_PROGRESS_NO_ERROR (0xA0000009UL)
/** Flash operation is successfully initiated */
#define CY_FLASH_IS_OPERATION_STARTED (0x00000010UL)
/** Flash is under operation */
#define CY_FLASH_IS_BUSY (0x00000040UL)
/** IPC structure is already locked by another process */
#define CY_FLASH_IS_IPC_BUSY (0x00000080UL)
/** Input parameters passed to Flash API are not valid */
#define CY_FLASH_IS_INVALID_INPUT_PARAMETERS (0x00000100UL)
/** Result mask */
#define CY_FLASH_RESULT_MASK (0x0FFFFFFFUL)
/** Error shift */
#define CY_FLASH_ERROR_SHIFT (28UL)
/** No error */
#define CY_FLASH_ERROR_NO_ERROR (0xAUL)
/** CM4 Flash Proxy address */
#define CY_FLASH_CM4_FLASH_PROXY_ADDR (*(Cy_Flash_Proxy *)(0x00000D1CUL))
typedef cy_en_flashdrv_status_t (*Cy_Flash_Proxy)(cy_stc_flash_context_t *context);
/** IPC notify bit for IPC0 structure (dedicated to flash operation) */
#define CY_FLASH_IPC_NOTIFY_STRUCT0 (0x1UL << CY_IPC_INTR_SYSCALL1)
/** Disable delay */
#define CY_FLASH_NO_DELAY (0U)
#if !defined (CY_FLASH_RWW_DRV_SUPPORT_DISABLED)
/** Number of ticks to wait 1 uS */
#define CY_FLASH_TICKS_FOR_1US (8U)
/** Define to set the IMO to perform a delay after the flash operation started */
#define CY_FLASH_TST_DDFT_SLOW_CTL_MASK (0x00001F1EUL)
/** Fast control register */
#define CY_FLASH_TST_DDFT_FAST_CTL_MASK (62U)
/** Slow output register - output disabled */
#define CY_FLASH_CLK_OUTPUT_DISABLED (0U)
/* The default delay time value */
#define CY_FLASH_DEFAULT_DELAY (150UL)
/* Calculates the time in microseconds to wait for the number of the CM0P ticks */
#define CY_FLASH_DELAY_CORRECTIVE(ticks) (((ticks) * 1000UL) / (Cy_SysClk_ClkSlowGetFrequency() / 1000UL))
/* Number of the CM0P ticks for StartProgram function delay corrective time */
#define CY_FLASH_START_PROGRAM_DELAY_TICKS (6000UL)
/* Delay time for StartProgram function in us */
#define CY_FLASH_START_PROGRAM_DELAY_TIME (900UL + CY_FLASH_DELAY_CORRECTIVE(CY_FLASH_START_PROGRAM_DELAY_TICKS))
/* Number of the CM0P ticks for StartErase functions delay corrective time */
#define CY_FLASH_START_ERASE_DELAY_TICKS (9500UL)
/* Delay time for StartErase functions in us */
#define CY_FLASH_START_ERASE_DELAY_TIME (2200UL + CY_FLASH_DELAY_CORRECTIVE(CY_FLASH_START_ERASE_DELAY_TICKS))
/* Number of the CM0P ticks for StartWrite function delay corrective time */
#define CY_FLASH_START_WRITE_DELAY_TICKS (19000UL)
/* Delay time for StartWrite function in us */
#define CY_FLASH_START_WRITE_DELAY_TIME (9800UL + CY_FLASH_DELAY_CORRECTIVE(CY_FLASH_START_WRITE_DELAY_TICKS))
/** Delay time for Start Write function in us with corrective time */
#define CY_FLASH_START_WRITE_DELAY (CY_FLASH_START_WRITE_DELAY_TIME)
/** Delay time for Start Program function in us with corrective time */
#define CY_FLASH_START_PROGRAM_DELAY (CY_FLASH_START_PROGRAM_DELAY_TIME)
/** Delay time for Start Erase function in uS with corrective time */
#define CY_FLASH_START_ERASE_DELAY (CY_FLASH_START_ERASE_DELAY_TIME)
#define CY_FLASH_ENTER_WAIT_LOOP (0xFFU)
#define CY_FLASH_IPC_CLIENT_ID (2U)
/** Semaphore number reserved for flash driver */
#define CY_FLASH_WAIT_SEMA (0UL)
/* Semaphore check timeout (in tries) */
#define CY_FLASH_SEMA_WAIT_MAX_TRIES (150000UL)
static void Cy_Flash_RAMDelay(uint32_t microseconds);
#if (CY_CPU_CORTEX_M0P)
#define IS_CY_PIPE_FREE(...) (!Cy_IPC_Drv_IsLockAcquired(Cy_IPC_Drv_GetIpcBaseAddress(CY_IPC_CHAN_CYPIPE_EP1)))
#define NOTIFY_PEER_CORE(a) Cy_IPC_Pipe_SendMessage(CY_IPC_EP_CYPIPE_CM4_ADDR, CY_IPC_EP_CYPIPE_CM0_ADDR, (a), NULL)
#else
#define IS_CY_PIPE_FREE(...) (!Cy_IPC_Drv_IsLockAcquired(Cy_IPC_Drv_GetIpcBaseAddress(CY_IPC_CHAN_CYPIPE_EP0)))
#define NOTIFY_PEER_CORE(a) Cy_IPC_Pipe_SendMessage(CY_IPC_EP_CYPIPE_CM0_ADDR, CY_IPC_EP_CYPIPE_CM4_ADDR, (a), NULL)
#endif
static void Cy_Flash_NotifyHandler(uint32_t * msgPtr);
static cy_stc_flash_notify_t * ipcWaitMessage;
#else
/** Delay time for Start Write function in us with corrective time */
#define CY_FLASH_START_WRITE_DELAY (CY_FLASH_NO_DELAY)
/** Delay time for Start Program function in us with corrective time */
#define CY_FLASH_START_PROGRAM_DELAY (CY_FLASH_NO_DELAY)
/** Delay time for Start Erase function in uS with corrective time */
#define CY_FLASH_START_ERASE_DELAY (CY_FLASH_NO_DELAY)
#endif /* !defined (CY_FLASH_RWW_DRV_SUPPORT_DISABLED) */
/** \endcond */
/* Static functions */
static bool Cy_Flash_BoundsCheck(uint32_t flashAddr);
static uint32_t Cy_Flash_GetRowNum(uint32_t flashAddr);
static cy_en_flashdrv_status_t Cy_Flash_ProcessOpcode(uint32_t opcode);
static cy_en_flashdrv_status_t Cy_Flash_OperationStatus(void);
static cy_en_flashdrv_status_t Cy_Flash_SendCmd(uint32_t mode, uint32_t microseconds);
static volatile cy_stc_flash_context_t flashContext;
#if !defined (CY_FLASH_RWW_DRV_SUPPORT_DISABLED)
/*******************************************************************************
* Function Name: Cy_Flash_InitExt
****************************************************************************//**
*
* Initiates all needed prerequisites to support flash erase/write.
* Should be called from each core. Defines the address of the message structure.
*
* Requires a call to Cy_IPC_Sema_Init(), Cy_IPC_Pipe_Config() and
* Cy_IPC_Pipe_Init() functions before use.
*
* This function is called in the Cy_Flash_Init() function - see the
* Cy_Flash_Init usage considerations.
*
*******************************************************************************/
void Cy_Flash_InitExt(cy_stc_flash_notify_t *ipcWaitMessageAddr)
{
ipcWaitMessage = ipcWaitMessageAddr;
if(ipcWaitMessage != NULL)
{
ipcWaitMessage->clientID = CY_FLASH_IPC_CLIENT_ID;
ipcWaitMessage->pktType = CY_FLASH_ENTER_WAIT_LOOP;
ipcWaitMessage->intrRelMask = 0U;
}
if (cy_device->flashRwwRequired != 0U)
{
#if (CY_CPU_CORTEX_M4)
cy_stc_sysint_t flashIntConfig =
{
(IRQn_Type)cy_device->cpussFmIrq, /* .intrSrc */
0U /* .intrPriority */
};
(void)Cy_SysInt_Init(&flashIntConfig, &Cy_Flash_ResumeIrqHandler);
NVIC_EnableIRQ(flashIntConfig.intrSrc);
#endif
if (cy_device->flashPipeRequired != 0U)
{
(void)Cy_IPC_Pipe_RegisterCallback(CY_IPC_EP_CYPIPE_ADDR, &Cy_Flash_NotifyHandler,
(uint32_t)CY_FLASH_IPC_CLIENT_ID);
}
}
}
/*******************************************************************************
* Function Name: Cy_Flash_NotifyHandler
****************************************************************************//**
*
* This is the interrupt service routine for the pipe notifications.
*
*******************************************************************************/
CY_SECTION_RAMFUNC_BEGIN
#if !defined (__ICCARM__)
CY_NOINLINE
#endif
static void Cy_Flash_NotifyHandler(uint32_t * msgPtr)
{
#if !((CY_CPU_CORTEX_M0P) && (defined (CY_DEVICE_SECURE)))
uint32_t intr;
#endif /* !((CY_CPU_CORTEX_M0P) && (defined (CY_DEVICE_SECURE))) */
static uint32_t semaIndex;
static uint32_t semaMask;
static volatile uint32_t *semaPtr;
static cy_stc_ipc_sema_t *semaStruct;
cy_stc_flash_notify_t *ipcMsgPtr = (cy_stc_flash_notify_t *) (void *) msgPtr;
if (CY_FLASH_ENTER_WAIT_LOOP == ipcMsgPtr->pktType)
{
#if !((CY_CPU_CORTEX_M0P) && (defined (CY_DEVICE_SECURE)))
intr = Cy_SysLib_EnterCriticalSection();
#endif /* !((CY_CPU_CORTEX_M0P) && (defined (CY_DEVICE_SECURE))) */
/* Get pointer to structure */
semaStruct = (cy_stc_ipc_sema_t *)Cy_IPC_Drv_ReadDataValue(Cy_IPC_Drv_GetIpcBaseAddress(CY_IPC_CHAN_SEMA));
/* Get the index into the semaphore array and calculate the mask */
semaIndex = CY_FLASH_WAIT_SEMA / CY_IPC_SEMA_PER_WORD;
semaMask = (uint32_t)(1UL << (CY_FLASH_WAIT_SEMA - (semaIndex * CY_IPC_SEMA_PER_WORD) ));
semaPtr = &semaStruct->arrayPtr[semaIndex];
/* Notification to the Flash driver to start the current operation */
*semaPtr |= semaMask;
/* Check a notification from other core to end of waiting */
while (((*semaPtr) & semaMask) != 0UL)
{
}
#if !((CY_CPU_CORTEX_M0P) && (defined (CY_DEVICE_SECURE)))
Cy_SysLib_ExitCriticalSection(intr);
#endif /* !((CY_CPU_CORTEX_M0P) && (defined (CY_DEVICE_SECURE))) */
}
}
CY_SECTION_RAMFUNC_END
#endif /* !defined(CY_FLASH_RWW_DRV_SUPPORT_DISABLED) */
/*******************************************************************************
* Function Name: Cy_Flash_Init
****************************************************************************//**
*
* Initiates all needed prerequisites to support flash erase/write.
* Should be called from each core.
*
* Requires a call to Cy_IPC_Sema_Init(), Cy_IPC_Pipe_Config() and
* Cy_IPC_Pipe_Init() functions before use.
*
* This function is called in the SystemInit() function, for proper flash write
* and erase operations. If the default startup file is not used, or the function
* SystemInit() is not called in your project, ensure to perform the following steps
* before any flash or EmEEPROM write/erase operations:
*
*******************************************************************************/
void Cy_Flash_Init(void)
{
#if !defined (CY_FLASH_RWW_DRV_SUPPORT_DISABLED)
CY_SECTION_SHAREDMEM
static cy_stc_flash_notify_t ipcWaitMessageStc CY_ALIGN(4);
Cy_Flash_InitExt(&ipcWaitMessageStc);
#endif /* !defined (CY_FLASH_RWW_DRV_SUPPORT_DISABLED) */
}
/*******************************************************************************
* Function Name: Cy_Flash_SendCmd
****************************************************************************//**
*
* Sends a command to the SROM via the IPC channel. The function is placed to the
* SRAM memory to guarantee successful operation. After an IPC message is sent,
* the function waits for a defined time before exiting the function.
*
*******************************************************************************/
CY_SECTION_RAMFUNC_BEGIN
#if !defined (__ICCARM__)
CY_NOINLINE
#endif
static cy_en_flashdrv_status_t Cy_Flash_SendCmd(uint32_t mode, uint32_t microseconds)
{
cy_en_flashdrv_status_t result = CY_FLASH_DRV_IPC_BUSY;
IPC_STRUCT_Type * locIpcBase = Cy_IPC_Drv_GetIpcBaseAddress(CY_IPC_CHAN_SYSCALL);
volatile uint32_t *ipcLockStatus = ®_IPC_STRUCT_LOCK_STATUS(locIpcBase);
#if !defined (CY_FLASH_RWW_DRV_SUPPORT_DISABLED)
uint32_t intr;
uint32_t semaTryCount = 0uL;
if (cy_device->flashRwwRequired != 0U)
{
/* Check for active core is CM0+, or CM4 on single core device */
#if (CY_CPU_CORTEX_M0P)
bool isPeerCoreEnabled = (CY_SYS_CM4_STATUS_ENABLED == Cy_SysGetCM4Status());
#else
bool isPeerCoreEnabled = false;
if (SFLASH_SINGLE_CORE == 0U)
{
isPeerCoreEnabled = true;
}
#endif
if (!isPeerCoreEnabled)
{
result = CY_FLASH_DRV_SUCCESS;
}
else
{
if (IS_CY_PIPE_FREE())
{
if (CY_IPC_SEMA_STATUS_LOCKED != Cy_IPC_Sema_Status(CY_FLASH_WAIT_SEMA))
{
if (CY_IPC_PIPE_SUCCESS == NOTIFY_PEER_CORE(ipcWaitMessage))
{
/* Wait for SEMA lock by peer core */
while ((CY_IPC_SEMA_STATUS_LOCKED != Cy_IPC_Sema_Status(CY_FLASH_WAIT_SEMA)) && ((semaTryCount < CY_FLASH_SEMA_WAIT_MAX_TRIES)))
{
/* check for timeout (as maximum tries count) */
++semaTryCount;
}
if (semaTryCount < CY_FLASH_SEMA_WAIT_MAX_TRIES)
{
result = CY_FLASH_DRV_SUCCESS;
}
}
}
}
}
if (CY_FLASH_DRV_SUCCESS == result)
{
/* Notifier is ready, start of the operation */
intr = Cy_SysLib_EnterCriticalSection();
if (0UL != _FLD2VAL(SRSS_CLK_CAL_CNT1_CAL_COUNTER_DONE, SRSS_CLK_CAL_CNT1))
{
/* Tries to acquire the IPC structure and pass the arguments to SROM API */
if (Cy_IPC_Drv_SendMsgPtr(locIpcBase, CY_FLASH_IPC_NOTIFY_STRUCT0, (void*)&flashContext) == CY_IPC_DRV_SUCCESS)
{
Cy_Flash_RAMDelay(microseconds);
if (mode == CY_FLASH_NON_BLOCKING_MODE)
{
/* The Flash operation is successfully initiated */
result = CY_FLASH_DRV_OPERATION_STARTED;
}
else
{
while (0U != _FLD2VAL(IPC_STRUCT_ACQUIRE_SUCCESS, *ipcLockStatus))
{
/* Polls whether the IPC is released and the Flash operation is performed */
}
result = Cy_Flash_OperationStatus();
}
}
else
{
/* The IPC structure is already locked by another process */
result = CY_FLASH_DRV_IPC_BUSY;
}
}
else
{
/* SysClk measurement counter is busy */
result = CY_FLASH_DRV_IPC_BUSY;
}
if (isPeerCoreEnabled)
{
while (CY_IPC_SEMA_SUCCESS != Cy_IPC_Sema_Clear(CY_FLASH_WAIT_SEMA, true))
{
/* Clear SEMA lock */
}
}
Cy_SysLib_ExitCriticalSection(intr);
/* End of the flash operation */
}
}
else
#endif /* !defined (CY_FLASH_RWW_DRV_SUPPORT_DISABLED) */
{
#if !defined (CY_FLASH_RWW_DRV_SUPPORT_DISABLED)
intr = Cy_SysLib_EnterCriticalSection();
#endif /* !defined (CY_FLASH_RWW_DRV_SUPPORT_DISABLED) */
/* Tries to acquire the IPC structure and pass the arguments to SROM API */
if (Cy_IPC_Drv_SendMsgPtr(locIpcBase, CY_FLASH_IPC_NOTIFY_STRUCT0, (void*)&flashContext) == CY_IPC_DRV_SUCCESS)
{
if (mode == CY_FLASH_NON_BLOCKING_MODE)
{
/* The Flash operation is successfully initiated */
result = CY_FLASH_DRV_OPERATION_STARTED;
}
else
{
while (0U != _FLD2VAL(IPC_STRUCT_ACQUIRE_SUCCESS, *ipcLockStatus))
{
/* Polls whether the IPC is released and the Flash operation is performed */
}
result = Cy_Flash_OperationStatus();
}
}
else
{
/* The IPC structure is already locked by another process */
result = CY_FLASH_DRV_IPC_BUSY;
}
#if !defined (CY_FLASH_RWW_DRV_SUPPORT_DISABLED)
Cy_SysLib_ExitCriticalSection(intr);
#endif /* !defined (CY_FLASH_RWW_DRV_SUPPORT_DISABLED) */
}
return (result);
}
CY_SECTION_RAMFUNC_END
#if !defined (CY_FLASH_RWW_DRV_SUPPORT_DISABLED)
/*******************************************************************************
* Function Name: Cy_Flash_RAMDelay
****************************************************************************//**
*
* Wait for a defined time in the SRAM memory region.
*
*******************************************************************************/
CY_SECTION_RAMFUNC_BEGIN
#if !defined (__ICCARM__)
CY_NOINLINE
#endif
static void Cy_Flash_RAMDelay(uint32_t microseconds)
{
uint32_t ticks = (microseconds & 0xFFFFUL) * CY_FLASH_TICKS_FOR_1US;
if (ticks != CY_FLASH_NO_DELAY)
{
/* Acquire the IPC to prevent changing of the shared resources at the same time */
while(0U == _FLD2VAL(IPC_STRUCT_ACQUIRE_SUCCESS, REG_IPC_STRUCT_ACQUIRE(CY_IPC_STRUCT_PTR(CY_IPC_CHAN_DDFT))))
{
/* Wait until the IPC structure is released by another process */
}
SRSS_TST_DDFT_FAST_CTL_REG = SRSS_TST_DDFT_FAST_CTL_MASK;
SRSS_TST_DDFT_SLOW_CTL_REG = SRSS_TST_DDFT_SLOW_CTL_MASK;
SRSS_CLK_OUTPUT_SLOW = _VAL2FLD(SRSS_CLK_OUTPUT_SLOW_SLOW_SEL0, CY_SYSCLK_MEAS_CLK_IMO) |
_VAL2FLD(SRSS_CLK_OUTPUT_SLOW_SLOW_SEL1, CY_FLASH_CLK_OUTPUT_DISABLED);
/* Load the down-counter without status bit value */
SRSS_CLK_CAL_CNT1 = _VAL2FLD(SRSS_CLK_CAL_CNT1_CAL_COUNTER1, ticks);
/* Make sure that the counter is started */
ticks = _FLD2VAL(SRSS_CLK_CAL_CNT1_CAL_COUNTER_DONE, SRSS_CLK_CAL_CNT1);
/* Release the IPC */
REG_IPC_STRUCT_RELEASE(CY_IPC_STRUCT_PTR(CY_IPC_CHAN_DDFT)) = 0U;
while (0UL == _FLD2VAL(SRSS_CLK_CAL_CNT1_CAL_COUNTER_DONE, SRSS_CLK_CAL_CNT1))
{
/* Wait until the counter stops counting */
}
}
}
CY_SECTION_RAMFUNC_END
#if (CY_CPU_CORTEX_M4)
/* Based on bookmark codes of mxs40srompsoc BROS,002-03298 */
#define CY_FLASH_PROGRAM_ROW_BOOKMARK (0x00000001UL)
#define CY_FLASH_ERASE_ROW_BOOKMARK (0x00000002UL)
#define CY_FLASH_WRITE_ROW_ERASE_BOOKMARK (0x00000003UL)
#define CY_FLASH_WRITE_ROW_PROGRAM_BOOKMARK (0x00000004UL)
/* Number of the CM0P ticks for function delay corrective time at final stage */
#define CY_FLASH_FINAL_STAGE_DELAY_TICKS (1000UL)
#define CY_FLASH_FINAL_STAGE_DELAY (130UL + CY_FLASH_DELAY_CORRECTIVE(CY_FLASH_FINAL_STAGE_DELAY_TICKS))
/*******************************************************************************
* Function Name: Cy_Flash_ResumeIrqHandler
****************************************************************************//**
*
* This is the interrupt service routine to make additional processing of the
* flash operations resume phase.
*
*******************************************************************************/
CY_SECTION_RAMFUNC_BEGIN
#if !defined (__ICCARM__)
CY_NOINLINE
#endif
void Cy_Flash_ResumeIrqHandler(void)
{
IPC_STRUCT_Type * locIpcBase = Cy_IPC_Drv_GetIpcBaseAddress(CY_IPC_CHAN_CYPIPE_EP0);
uint32_t bookmark;
#if ((CY_CPU_CORTEX_M4) && (defined (CY_DEVICE_SECURE)))
bookmark = CY_PRA_REG32_GET(CY_PRA_INDX_FLASHC_FM_CTL_BOOKMARK) & 0xffffUL;
#else
bookmark = FLASHC_FM_CTL_BOOKMARK & 0xffffUL;
#endif /* ((CY_CPU_CORTEX_M4) && (defined (CY_DEVICE_SECURE))) */
uint32_t intr = Cy_SysLib_EnterCriticalSection();
uint32_t cm0s = CPUSS_CM0_STATUS;
bool sflashSingleCore = (0U == SFLASH_SINGLE_CORE);
if ((bookmark == CY_FLASH_PROGRAM_ROW_BOOKMARK) || (bookmark == CY_FLASH_ERASE_ROW_BOOKMARK) ||
(bookmark == CY_FLASH_WRITE_ROW_ERASE_BOOKMARK) || (bookmark == CY_FLASH_WRITE_ROW_PROGRAM_BOOKMARK))
{
if ((cm0s == (CPUSS_CM0_STATUS_SLEEPING_Msk | CPUSS_CM0_STATUS_SLEEPDEEP_Msk)) && sflashSingleCore)
{
REG_IPC_STRUCT_NOTIFY(locIpcBase) = _VAL2FLD(IPC_STRUCT_NOTIFY_INTR_NOTIFY, (1UL << CY_IPC_INTR_CYPIPE_EP0));
while (CPUSS_CM0_STATUS == (CPUSS_CM0_STATUS_SLEEPING_Msk | CPUSS_CM0_STATUS_SLEEPDEEP_Msk))
{
/* Wait until the core is active */
}
}
Cy_Flash_RAMDelay(CY_FLASH_FINAL_STAGE_DELAY);
}
Cy_SysLib_ExitCriticalSection(intr);
}
CY_SECTION_RAMFUNC_END
#endif /* (CY_CPU_CORTEX_M4) */
#endif /* !defined (CY_FLASH_RWW_DRV_SUPPORT_DISABLED) */
/*******************************************************************************
* Function Name: Cy_Flash_EraseRow
****************************************************************************//**
*
* This function erases a single row of flash. Reports success or
* a reason for failure. Does not return until the Write operation is
* complete. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in
* the case when another process is writing to flash or erasing the row.
* User firmware should not enter the Hibernate or Deep Sleep mode until flash Erase
* is complete. The Flash operation is allowed in Sleep mode.
* During the Flash operation, the device should not be reset, including the
* XRES pin, a software reset, and watchdog reset sources. Also, low-voltage
* detect circuits should be configured to generate an interrupt instead of a
* reset. Otherwise, portions of flash may undergo unexpected changes.
*
*******************************************************************************/
cy_en_flashdrv_status_t Cy_Flash_EraseRow(uint32_t rowAddr)
{
cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS;
/* Prepares arguments to be passed to SROM API */
if (Cy_Flash_BoundsCheck(rowAddr) != false)
{
SystemCoreClockUpdate();
flashContext.opcode = CY_FLASH_OPCODE_ERASE_ROW | CY_FLASH_BLOCKING_MODE;
flashContext.arg1 = rowAddr;
flashContext.arg2 = 0UL;
flashContext.arg3 = 0UL;
if (cy_device->flashEraseDelay != 0U)
{
result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_START_ERASE_DELAY);
}
else
{
result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_NO_DELAY);
}
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_StartEraseRow
****************************************************************************//**
*
* Starts erasing a single row of flash. Returns immediately
* and reports a successful start or reason for failure.
* Reports a CY_FLASH_DRV_IPC_BUSY error in the case when IPC structure is locked
* by another process. User firmware should not enter the Hibernate or Deep Sleep mode until
* flash Erase is complete. The Flash operation is allowed in Sleep mode.
* During the flash operation, the device should not be reset, including the
* XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage
* detect circuits should be configured to generate an interrupt instead of a reset.
* Otherwise, portions of flash may undergo unexpected changes.
* To avoid situation of reading data from cache memory - before
* reading data from previously programmed/erased flash rows, the user must
* clear the flash cache with the Cy_SysLib_ClearFlashCacheAndBuffer()
* function.
*
*******************************************************************************/
cy_en_flashdrv_status_t Cy_Flash_StartEraseRow(uint32_t rowAddr)
{
cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS;
if (Cy_Flash_BoundsCheck(rowAddr) != false)
{
SystemCoreClockUpdate();
/* Prepares arguments to be passed to SROM API */
flashContext.opcode = CY_FLASH_OPCODE_ERASE_ROW;
if (SFLASH_SINGLE_CORE != 0U)
{
flashContext.opcode |= CY_FLASH_BLOCKING_MODE;
}
flashContext.arg1 = rowAddr;
flashContext.arg2 = 0UL;
flashContext.arg3 = 0UL;
if (cy_device->flashEraseDelay != 0U)
{
result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_START_ERASE_DELAY);
}
else
{
result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_NO_DELAY);
}
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_EraseSector
****************************************************************************//**
*
* This function erases a sector of flash. Reports success or
* a reason for failure. Does not return until the Erase operation is
* complete. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in
* the case when another process is writing to flash or erasing the row.
* User firmware should not enter the Hibernate or Deep Sleep mode until flash Erase
* is complete. The Flash operation is allowed in Sleep mode.
* During the Flash operation, the device should not be reset, including the
* XRES pin, a software reset, and watchdog reset sources. Also, low-voltage
* detect circuits should be configured to generate an interrupt instead of a
* reset. Otherwise, portions of flash may undergo unexpected changes.
*
*******************************************************************************/
cy_en_flashdrv_status_t Cy_Flash_EraseSector(uint32_t sectorAddr)
{
cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS;
/* Prepares arguments to be passed to SROM API */
if (Cy_Flash_BoundsCheck(sectorAddr) != false)
{
SystemCoreClockUpdate();
flashContext.opcode = CY_FLASH_OPCODE_ERASE_SECTOR | CY_FLASH_BLOCKING_MODE;
flashContext.arg1 = sectorAddr;
flashContext.arg2 = 0UL;
flashContext.arg3 = 0UL;
if (cy_device->flashEraseDelay != 0U)
{
result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_START_ERASE_DELAY);
}
else
{
result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_NO_DELAY);
}
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_StartEraseSector
****************************************************************************//**
*
* Starts erasing a sector of flash. Returns immediately
* and reports a successful start or reason for failure.
* Reports a CY_FLASH_DRV_IPC_BUSY error in the case when IPC structure is locked
* by another process. User firmware should not enter the Hibernate or Deep Sleep mode until
* flash Erase is complete. The Flash operation is allowed in Sleep mode.
* During the flash operation, the device should not be reset, including the
* XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage
* detect circuits should be configured to generate an interrupt instead of a reset.
* Otherwise, portions of flash may undergo unexpected changes.
* Before reading data from previously programmed/erased flash rows, the
* user must clear the flash cache with the Cy_SysLib_ClearFlashCacheAndBuffer()
* function.
*
*
*******************************************************************************/
cy_en_flashdrv_status_t Cy_Flash_StartEraseSector(uint32_t sectorAddr)
{
cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS;
if (Cy_Flash_BoundsCheck(sectorAddr) != false)
{
SystemCoreClockUpdate();
/* Prepares arguments to be passed to SROM API */
flashContext.opcode = CY_FLASH_OPCODE_ERASE_SECTOR;
if (SFLASH_SINGLE_CORE != 0U)
{
flashContext.opcode |= CY_FLASH_BLOCKING_MODE;
}
flashContext.arg1 = sectorAddr;
flashContext.arg2 = 0UL;
flashContext.arg3 = 0UL;
if (cy_device->flashEraseDelay != 0U)
{
result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_START_ERASE_DELAY);
}
else
{
result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_NO_DELAY);
}
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_EraseSubsector
****************************************************************************//**
*
* This function erases an 8-row subsector of flash. Reports success or
* a reason for failure. Does not return until the Write operation is
* complete. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in
* the case when another process is writing to flash or erasing the row.
* User firmware should not enter the Hibernate or Deep-Sleep mode until flash Erase
* is complete. The Flash operation is allowed in Sleep mode.
* During the Flash operation, the device should not be reset, including the
* XRES pin, a software reset, and watchdog reset sources. Also, low-voltage
* detect circuits should be configured to generate an interrupt instead of a
* reset. Otherwise, portions of flash may undergo unexpected changes.
*******************************************************************************/
cy_en_flashdrv_status_t Cy_Flash_EraseSubsector(uint32_t subSectorAddr)
{
cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS;
/* Prepares arguments to be passed to SROM API */
if (Cy_Flash_BoundsCheck(subSectorAddr) != false)
{
SystemCoreClockUpdate();
flashContext.opcode = CY_FLASH_OPCODE_ERASE_SUB_SECTOR | CY_FLASH_BLOCKING_MODE;
flashContext.arg1 = subSectorAddr;
flashContext.arg2 = 0UL;
flashContext.arg3 = 0UL;
if (cy_device->flashEraseDelay != 0U)
{
result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_START_ERASE_DELAY);
}
else
{
result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_NO_DELAY);
}
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_StartEraseSubsector
****************************************************************************//**
*
* Starts erasing an 8-row subsector of flash. Returns immediately
* and reports a successful start or reason for failure.
* Reports a CY_FLASH_DRV_IPC_BUSY error in the case when IPC structure is locked
* by another process. User firmware should not enter the Hibernate or Deep-Sleep mode until
* flash Erase is complete. The Flash operation is allowed in Sleep mode.
* During the flash operation, the device should not be reset, including the
* XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage
* detect circuits should be configured to generate an interrupt instead of a reset.
* Otherwise, portions of flash may undergo unexpected changes.
* Before reading data from previously programmed/erased flash rows, the
* user must clear the flash cache with the Cy_SysLib_ClearFlashCacheAndBuffer()
* function.
*******************************************************************************/
cy_en_flashdrv_status_t Cy_Flash_StartEraseSubsector(uint32_t subSectorAddr)
{
cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS;
if (Cy_Flash_BoundsCheck(subSectorAddr) != false)
{
SystemCoreClockUpdate();
/* Prepares arguments to be passed to SROM API */
flashContext.opcode = CY_FLASH_OPCODE_ERASE_SUB_SECTOR;
if (SFLASH_SINGLE_CORE != 0U)
{
flashContext.opcode |= CY_FLASH_BLOCKING_MODE;
}
flashContext.arg1 = subSectorAddr;
flashContext.arg2 = 0UL;
flashContext.arg3 = 0UL;
if (cy_device->flashEraseDelay != 0U)
{
result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_START_ERASE_DELAY);
}
else
{
result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_NO_DELAY);
}
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_ProgramRow
****************************************************************************//**
*
* This function writes an array of data to a single row of flash. Reports
* success or a reason for failure. Does not return until the Program operation
* is complete.
* Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case
* when another process is writing to flash. User firmware should not enter the
* Hibernate or Deep-sleep mode until flash Write is complete. The Flash operation
* is allowed in Sleep mode. During the Flash operation, the device should not be
* reset, including the XRES pin, a software reset, and watchdog reset sources.
* Also, low-voltage detect circuits should be configured to generate an interrupt
* instead of a reset. Otherwise, portions of flash may undergo unexpected
* changes.\n
* Before calling this function, the target flash region must be erased by
* the StartErase/EraseRow function.\n
* Data to be programmed must be located in the SRAM memory region.
* Before reading data from previously programmed/erased flash rows, the
* user must clear the flash cache with the Cy_SysLib_ClearFlashCacheAndBuffer()
* function.
*
*******************************************************************************/
cy_en_flashdrv_status_t Cy_Flash_ProgramRow(uint32_t rowAddr, const uint32_t* data)
{
cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS;
/* Checks whether the input parameters are valid */
if ((Cy_Flash_BoundsCheck(rowAddr) != false) && (NULL != data))
{
SystemCoreClockUpdate();
/* Prepares arguments to be passed to SROM API */
flashContext.opcode = CY_FLASH_OPCODE_PROGRAM_ROW | CY_FLASH_BLOCKING_MODE;
flashContext.arg1 = CY_FLASH_DATA_LOC_SRAM;
flashContext.arg2 = rowAddr;
flashContext.arg3 = (uint32_t)data;
if (cy_device->flashProgramDelay != 0U)
{
result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_START_PROGRAM_DELAY);
}
else
{
result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_NO_DELAY);
}
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_WriteRow
****************************************************************************//**
*
* This function writes an array of data to a single row of flash. This is done
* in three steps - pre-program, erase and then program flash row with the input
* data. Reports success or a reason for failure. Does not return until the Write
* operation is complete.
* Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case
* when another process is writing to flash. User firmware should not enter the
* Hibernate or Deep-sleep mode until flash Write is complete. The Flash operation
* is allowed in Sleep mode. During the Flash operation, the
* device should not be reset, including the XRES pin, a software
* reset, and watchdog reset sources. Also, low-voltage detect
* circuits should be configured to generate an interrupt
* instead of a reset. Otherwise, portions of flash may undergo
* unexpected changes.
*
*******************************************************************************/
cy_en_flashdrv_status_t Cy_Flash_WriteRow(uint32_t rowAddr, const uint32_t* data)
{
cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS;
/* Checks whether the input parameters are valid */
if ((Cy_Flash_BoundsCheck(rowAddr) != false) && (NULL != data))
{
SystemCoreClockUpdate();
/* Prepares arguments to be passed to SROM API */
flashContext.opcode = CY_FLASH_OPCODE_WRITE_ROW | CY_FLASH_BLOCKING_MODE;
flashContext.arg1 = 0UL;
flashContext.arg2 = rowAddr;
flashContext.arg3 = (uint32_t)data;
if (cy_device->flashWriteDelay != 0U)
{
result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_START_WRITE_DELAY);
}
else
{
result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_NO_DELAY);
}
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_StartWrite
****************************************************************************//**
*
* Performs pre-program, erase and then starts programming the flash row with
* the input data. Returns immediately and reports a successful start
* or reason for failure. Reports a CY_FLASH_DRV_IPC_BUSY error
* in the case when another process is writing to flash. User
* firmware should not enter the Hibernate or Deep-Sleep mode until
* flash Write is complete. The Flash operation is allowed in Sleep mode.
* During the flash operation, the device should not be reset, including the
* XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage
* detect circuits should be configured to generate an interrupt instead of a reset.
* Otherwise, portions of flash may undergo unexpected changes.
* Before reading data from previously programmed/erased flash rows, the
* user must clear the flash cache with the Cy_SysLib_ClearFlashCacheAndBuffer()
* function.
*
*******************************************************************************/
cy_en_flashdrv_status_t Cy_Flash_StartWrite(uint32_t rowAddr, const uint32_t* data)
{
cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS;
/* Checks whether the input parameters are valid */
if ((Cy_Flash_BoundsCheck(rowAddr) != false) && (NULL != data))
{
result = Cy_Flash_StartEraseRow(rowAddr);
if (CY_FLASH_DRV_OPERATION_STARTED == result)
{
/* Polls whether the IPC is released and the Flash operation is performed */
do
{
result = Cy_Flash_OperationStatus();
}
while (result == CY_FLASH_DRV_OPCODE_BUSY);
if (CY_FLASH_DRV_SUCCESS == result)
{
result = Cy_Flash_StartProgram(rowAddr, data);
}
}
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_IsOperationComplete
****************************************************************************//**
*
* Reports a successful operation result, reason of failure or busy status
* ( CY_FLASH_DRV_OPCODE_BUSY ).
*******************************************************************************/
cy_en_flashdrv_status_t Cy_Flash_IsOperationComplete(void)
{
return (Cy_Flash_OperationStatus());
}
/*******************************************************************************
* Function Name: Cy_Flash_StartProgram
****************************************************************************//**
*
* Starts writing an array of data to a single row of flash. Returns immediately
* and reports a successful start or reason for failure.
* Reports a CY_FLASH_DRV_IPC_BUSY error if another process is writing
* to flash. The user firmware should not enter Hibernate or Deep-Sleep mode until flash
* Program is complete. The Flash operation is allowed in Sleep mode.
* During the Flash operation, the device should not be reset, including the
* XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage
* detect circuits should be configured to generate an interrupt instead of a reset.
* Otherwise, portions of flash may undergo unexpected changes.\n
* Before calling this function, the target flash region must be erased by
* the StartEraseRow/EraseRow function.\n
* Data to be programmed must be located in the SRAM memory region.
* Before reading data from previously programmed/erased flash rows, the
* user must clear the flash cache with the Cy_SysLib_ClearFlashCacheAndBuffer()
* function.
*******************************************************************************/
cy_en_flashdrv_status_t Cy_Flash_StartProgram(uint32_t rowAddr, const uint32_t* data)
{
cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS;
if ((Cy_Flash_BoundsCheck(rowAddr) != false) && (NULL != data))
{
SystemCoreClockUpdate();
/* Prepares arguments to be passed to SROM API */
flashContext.opcode = CY_FLASH_OPCODE_PROGRAM_ROW;
if (SFLASH_SINGLE_CORE != 0U)
{
flashContext.opcode |= CY_FLASH_BLOCKING_MODE;
}
flashContext.arg1 = CY_FLASH_DATA_LOC_SRAM;
flashContext.arg2 = rowAddr;
flashContext.arg3 = (uint32_t)data;
if (cy_device->flashProgramDelay != 0U)
{
result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_START_PROGRAM_DELAY);
}
else
{
result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_NO_DELAY);
}
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_RowChecksum
****************************************************************************//**
*
* Returns a checksum value of the specified flash row.
*
*******************************************************************************/
cy_en_flashdrv_status_t Cy_Flash_RowChecksum (uint32_t rowAddr, uint32_t* checksumPtr)
{
cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS;
uint32_t resTmp;
uint32_t rowID;
/* Checks whether the input parameters are valid */
if ((Cy_Flash_BoundsCheck(rowAddr)) && (NULL != checksumPtr))
{
rowID = Cy_Flash_GetRowNum(rowAddr);
/* Prepares arguments to be passed to SROM API */
flashContext.opcode = CY_FLASH_OPCODE_CHECKSUM |
(((rowID >> CY_FLASH_REGION_ID_SHIFT) & CY_FLASH_REGION_ID_MASK) << CY_FLASH_OPCODE_CHECKSUM_REGION_SHIFT) |
((rowID & CY_FLASH_ROW_ID_MASK) << CY_FLASH_OPCODE_CHECKSUM_ROW_SHIFT);
/* Tries to acquire the IPC structure and pass the arguments to SROM API */
if (Cy_IPC_Drv_SendMsgPtr(Cy_IPC_Drv_GetIpcBaseAddress(CY_IPC_CHAN_SYSCALL), CY_FLASH_IPC_NOTIFY_STRUCT0,
(void*)&flashContext) == CY_IPC_DRV_SUCCESS)
{
/* Polls whether IPC is released and the Flash operation is performed */
while (Cy_IPC_Drv_IsLockAcquired(Cy_IPC_Drv_GetIpcBaseAddress(CY_IPC_CHAN_SYSCALL)) != false)
{
/* Wait till IPC is released */
}
resTmp = flashContext.opcode >> CY_FLASH_ERROR_SHIFT;
if (resTmp == CY_FLASH_ERROR_NO_ERROR)
{
result = CY_FLASH_DRV_SUCCESS;
if (CY_IPC_V1)
{
*checksumPtr = flashContext.opcode & CY_FLASH_RESULT_MASK;
}
else
{
*checksumPtr = REG_IPC_STRUCT_DATA1(Cy_IPC_Drv_GetIpcBaseAddress(CY_IPC_CHAN_SYSCALL));
}
}
else
{
result = Cy_Flash_ProcessOpcode(flashContext.opcode);
}
}
else
{
/* The IPC structure is already locked by another process */
result = CY_FLASH_DRV_IPC_BUSY;
}
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_CalculateHash
****************************************************************************//**
*
* Returns a hash value of the specified region of flash.
*******************************************************************************/
cy_en_flashdrv_status_t Cy_Flash_CalculateHash (const uint32_t* data, uint32_t numberOfBytes, uint32_t* hashPtr)
{
cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS;
volatile uint32_t resTmp;
/* Checks whether the input parameters are valid */
if ((data != NULL) && (0UL != numberOfBytes))
{
/* Prepares arguments to be passed to SROM API */
flashContext.opcode = CY_FLASH_OPCODE_HASH;
flashContext.arg1 = (uint32_t)data;
flashContext.arg2 = numberOfBytes;
/* Tries to acquire the IPC structure and pass the arguments to SROM API */
if (Cy_IPC_Drv_SendMsgPtr(Cy_IPC_Drv_GetIpcBaseAddress(CY_IPC_CHAN_SYSCALL), CY_FLASH_IPC_NOTIFY_STRUCT0,
(void*)&flashContext) == CY_IPC_DRV_SUCCESS)
{
/* Polls whether IPC is released and the Flash operation is performed */
while (Cy_IPC_Drv_IsLockAcquired(Cy_IPC_Drv_GetIpcBaseAddress(CY_IPC_CHAN_SYSCALL)) != false)
{
/* Wait till IPC is released */
}
resTmp = flashContext.opcode;
if ((resTmp >> CY_FLASH_ERROR_SHIFT) == CY_FLASH_ERROR_NO_ERROR)
{
result = CY_FLASH_DRV_SUCCESS;
*hashPtr = flashContext.opcode & CY_FLASH_RESULT_MASK;
}
else
{
result = Cy_Flash_ProcessOpcode(flashContext.opcode);
}
}
else
{
/* The IPC structure is already locked by another process */
result = CY_FLASH_DRV_IPC_BUSY;
}
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_GetRowNum
****************************************************************************//**
*
* Returns flash region ID and row number of the Flash address.
*******************************************************************************/
static uint32_t Cy_Flash_GetRowNum(uint32_t flashAddr)
{
uint32_t result;
#if (CY_EM_EEPROM_SIZE>0)
if ((flashAddr >= CY_EM_EEPROM_BASE) && (flashAddr < (CY_EM_EEPROM_BASE + CY_EM_EEPROM_SIZE)))
{
result = (CY_FLASH_REGION_ID_EM_EEPROM << CY_FLASH_REGION_ID_SHIFT) |
((flashAddr - CY_EM_EEPROM_BASE) / CY_FLASH_SIZEOF_ROW);
}
else
#endif
if ((flashAddr >= SFLASH_BASE) && (flashAddr < (SFLASH_BASE + SFLASH_SECTION_SIZE)))
{
result = (CY_FLASH_REGION_ID_SFLASH << CY_FLASH_REGION_ID_SHIFT) |
((flashAddr - SFLASH_BASE) / CY_FLASH_SIZEOF_ROW);
}
else
{
result = (CY_FLASH_REGION_ID_MAIN << CY_FLASH_REGION_ID_SHIFT) |
((flashAddr - CY_FLASH_BASE) / CY_FLASH_SIZEOF_ROW);
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_BoundsCheck
****************************************************************************//**
*
* The function checks the following conditions:
* - if Flash address is equal to start address of the row
*******************************************************************************/
static bool Cy_Flash_BoundsCheck(uint32_t flashAddr)
{
return ((flashAddr % CY_FLASH_SIZEOF_ROW) == 0UL);
}
/*******************************************************************************
* Function Name: Cy_Flash_ProcessOpcode
****************************************************************************//**
*
* Converts System Call returns to the Flash driver return defines.
*******************************************************************************/
static cy_en_flashdrv_status_t Cy_Flash_ProcessOpcode(uint32_t opcode)
{
cy_en_flashdrv_status_t result;
switch (opcode)
{
case 0UL:
{
result = CY_FLASH_DRV_SUCCESS;
break;
}
case CY_FLASH_ROMCODE_SUCCESS:
{
result = CY_FLASH_DRV_SUCCESS;
break;
}
case CY_FLASH_ROMCODE_INVALID_PROTECTION:
{
result = CY_FLASH_DRV_INV_PROT;
break;
}
case CY_FLASH_ROMCODE_INVALID_FM_PL:
{
result = CY_FLASH_DRV_INVALID_FM_PL;
break;
}
case CY_FLASH_ROMCODE_INVALID_FLASH_ADDR:
{
result = CY_FLASH_DRV_INVALID_FLASH_ADDR;
break;
}
case CY_FLASH_ROMCODE_ROW_PROTECTED:
{
result = CY_FLASH_DRV_ROW_PROTECTED;
break;
}
case CY_FLASH_ROMCODE_IN_PROGRESS_NO_ERROR:
{
result = CY_FLASH_DRV_PROGRESS_NO_ERROR;
break;
}
case (uint32_t)CY_FLASH_DRV_INVALID_INPUT_PARAMETERS:
{
result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS;
break;
}
case CY_FLASH_IS_OPERATION_STARTED :
{
result = CY_FLASH_DRV_OPERATION_STARTED;
break;
}
case CY_FLASH_IS_BUSY :
{
result = CY_FLASH_DRV_OPCODE_BUSY;
break;
}
case CY_FLASH_IS_IPC_BUSY :
{
result = CY_FLASH_DRV_IPC_BUSY;
break;
}
case CY_FLASH_IS_INVALID_INPUT_PARAMETERS :
{
result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS;
break;
}
default:
{
result = CY_FLASH_DRV_ERR_UNC;
break;
}
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_OperationStatus
****************************************************************************//**
*
* Checks the status of the Flash Operation, and returns it.
*******************************************************************************/
static cy_en_flashdrv_status_t Cy_Flash_OperationStatus(void)
{
cy_en_flashdrv_status_t result = CY_FLASH_DRV_OPCODE_BUSY;
/* Checks if the IPC structure is not locked */
if (Cy_IPC_Drv_IsLockAcquired(Cy_IPC_Drv_GetIpcBaseAddress(CY_IPC_CHAN_SYSCALL)) == false)
{
/* The result of SROM API calling is returned to the driver context */
result = Cy_Flash_ProcessOpcode(flashContext.opcode);
/* Clear pre-fetch cache after flash operation */
#if CY_CPU_CORTEX_M4 && defined (CY_DEVICE_SECURE)
CY_PRA_REG32_SET(CY_PRA_INDX_FLASHC_FLASH_CMD, FLASHC_FLASH_CMD_INV_Msk);
while (CY_PRA_REG32_GET(CY_PRA_INDX_FLASHC_FLASH_CMD) != 0U)
{
}
#else
FLASHC_FLASH_CMD = FLASHC_FLASH_CMD_INV_Msk;
while (FLASHC_FLASH_CMD != 0U)
{
}
#endif /* CY_CPU_CORTEX_M4 && defined (CY_DEVICE_SECURE) */
}
return (result);
}
/*******************************************************************************
* Function Name: Cy_Flash_GetExternalStatus
****************************************************************************//**
*
* This function handles the case where a module such as security image captures
* a system call from this driver and reports its own status or error code,
* for example protection violation. In that case, a function from this
* driver returns an unknown error (see cy_en_flashdrv_status_t). After receipt
* of an unknown error, the user may call this function to get the status
* of the capturing module.
*
* The user is responsible for parsing the content of the returned value
* and casting it to the appropriate enumeration.
*******************************************************************************/
uint32_t Cy_Flash_GetExternalStatus(void)
{
return (flashContext.opcode);
}
CY_MISRA_BLOCK_END('MISRA C-2012 Rule 11.3');
#endif /* CY_IP_M4CPUSS */
/* [] END OF FILE */
|
9aaae2ac48620164239d70651d70484dc36dce5f
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/nuvoton/libraries/nu_packages/BMX055/libraries/BMM050_driver/bmm050_support.c
|
53d701df8db74b4d39adeb99c2244a0048ce49f2
|
[
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 19,412
|
c
|
bmm050_support.c
|
/*
****************************************************************************
* Copyright (C) 2015 - 2016 Bosch Sensortec GmbH
*
* bmm050_support.c
* Date: 2016/03/17
* Revision: 1.0.6 $
*
* Usage: Sensor Driver support file for BMM050 and BMM150 sensor
*
****************************************************************************
* License:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the copyright holder nor the names of the
* 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 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
*
* The information provided is believed to be accurate and reliable.
* The copyright holder assumes no responsibility
* for the consequences of use
* of such information nor for any infringement of patents or
* other rights of third parties which may result from its use.
* No license is granted by implication or otherwise under any patent or
* patent rights of the copyright holder.
**************************************************************************/
/*---------------------------------------------------------------------------*/
/* Includes*/
/*---------------------------------------------------------------------------*/
#include "bmm050.h"
/*----------------------------------------------------------------------------*/
/* The following functions are used for reading and writing of
* sensor data using I2C or SPI communication
*----------------------------------------------------------------------------*/
#ifdef BMM050_API
/* \Brief: The function is used as I2C bus read
* \Return : Status of the I2C read
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register,
* will data is going to be read
* \param reg_data : This data read from the sensor,
* which is hold in an array
* \param cnt : The no of byte of data to be read
*/
s8 BMM050_I2C_bus_read(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt);
/* \Brief: The function is used as I2C bus write
* \Return : Status of the I2C write
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register,
* will data is going to be written
* \param reg_data : It is a value hold in the array,
* will be used for write the value into the register
* \param cnt : The no of byte of data to be write
*/
s8 BMM050_I2C_bus_write(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt);
/* \Brief: The function is used as SPI bus write
* \Return : Status of the SPI write
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register,
* will data is going to be written
* \param reg_data : It is a value hold in the array,
* will be used for write the value into the register
* \param cnt : The no of byte of data to be write
*/
s8 BMM050_SPI_bus_write(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt);
/* \Brief: The function is used as SPI bus read
* \Return : Status of the SPI read
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register,
* will data is going to be read
* \param reg_data : This data read from the sensor,
* which is hold in an array
* \param cnt : The no of byte of data to be read
*/
s8 BMM050_SPI_bus_read(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt);
/*
* \Brief: SPI/I2C init routine
*/
s8 I2C_routine(void);
s8 SPI_routine(void);
#endif
/********************End of I2C/SPI function declarations*********************/
/* Brief : The delay routine
* \param : delay in ms
*/
void BMM050_delay_msek(u32 msek);
/* This function is an example for reading sensor data
* \param: None
* \return: communication result
*/
s32 bmm050_data_readout_template(void);
/*----------------------------------------------------------------------------*
* struct bmm050_t parameters can be accessed by using bmm050
* bmm050_t having the following parameters
* Bus write function pointer: BMM050_WR_FUNC_PTR
* Bus read function pointer: BMM050_RD_FUNC_PTR
* Burst read function pointer: BMM050_BRD_FUNC_PTR
* Delay function pointer: delay_msec
* I2C address: dev_addr
* Chip id of the sensor: chip_id
*---------------------------------------------------------------------------*/
struct bmm050_t bmm050;
/*---------------------------------------------------------------------------*/
/* This function is an example for reading sensor data
* \param: None
* \return: communication result
*/
s32 bmm050_data_readout_template(void)
{
/* Structure used for read the mag xyz data*/
struct bmm050_mag_data_s16_t data;
/* Structure used for read the mag xyz data with 32 bit output*/
struct bmm050_mag_s32_data_t data_s32;
/* Structure used for read the mag xyz data with float output*/
struct bmm050_mag_data_float_t data_float;
/* Variable used to get the data rate*/
u8 v_data_rate_u8 = BMM050_INIT_VALUE;
/* Variable used to set the data rate*/
u8 v_data_rate_value_u8 = BMM050_INIT_VALUE;
/* result of communication results*/
s32 com_rslt = ERROR;
/*---------------------------------------------------------------------------*
*********************** START INITIALIZATION ************************
*--------------------------------------------------------------------------*/
/* Based on the user need configure I2C or SPI interface.
* It is sample code to explain how to use the bmm050 API*/
#ifdef BMM050_API
I2C_routine();
/*SPI_routine(); */
#endif
/*--------------------------------------------------------------------------*
* This function used to assign the value/reference of
* the following parameters
* I2C address
* Bus Write
* Bus read
* company_id
*-------------------------------------------------------------------------*/
com_rslt = bmm050_init(&bmm050);
/* For initialization it is required to set the mode of
* the sensor as "NORMAL"
* but before set the mode needs to configure the power control bit
* in the register 0x4B bit BMM050_INIT_VALUE should be enabled
* This bit is enabled by calling bmm050_init function
* For the Normal data acquisition/read/write is possible in this mode
* by using the below API able to set the power mode as NORMAL*/
/* Set the power mode as NORMAL*/
com_rslt += bmm050_set_functional_state(BMM050_NORMAL_MODE);
/*--------------------------------------------------------------------------*
************************* END INITIALIZATION *************************
*---------------------------------------------------------------------------*/
/*------------------------------------------------------------------------*
************************* START GET and SET FUNCTIONS DATA ****************
*---------------------------------------------------------------------------*/
/* This API used to Write the data rate of the sensor, input
value have to be given
data rate value set from the register 0x4C bit 3 to 5*/
v_data_rate_value_u8 = BMM050_DATA_RATE_30HZ;/* set data rate of 30Hz*/
com_rslt += bmm050_set_data_rate(v_data_rate_value_u8);
/* This API used to read back the written value of data rate*/
com_rslt += bmm050_get_data_rate(&v_data_rate_u8);
/*-----------------------------------------------------------------*
************************* END GET and SET FUNCTIONS ****************
*-------------------------------------------------------------------*/
/*------------------------------------------------------------------*
************************* START READ SENSOR DATA(X,Y and Z axis) ********
*------------------------------------------------------------------*/
/* accessing the bmm050_mdata parameter by using data*/
/* Reads the mag x y z data*/
com_rslt += bmm050_read_mag_data_XYZ(&data);
/* accessing the bmm050_mdata_float parameter by using data_float*/
/* Reads mag xyz data output as 32bit value*/
com_rslt += bmm050_read_mag_data_XYZ_float(&data_float);
/* accessing the bmm050_mdata_s32 parameter by using data_s32*/
/* Reads mag xyz data output as float value*/
com_rslt += bmm050_read_mag_data_XYZ_s32(&data_s32);
/*--------------------------------------------------------------------*
************************* END READ SENSOR DATA(X,Y and Z axis) ************
*-------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------*
************************* START DE-INITIALIZATION ***********************
*-------------------------------------------------------------------------*/
/* For de-initialization it is required to set the mode of
* the sensor as "SUSPEND"
* the SUSPEND mode set from the register 0x4B bit BMM050_INIT_VALUE
* should be disabled
* by using the below API able to set the power mode as SUSPEND*/
/* Set the power mode as SUSPEND*/
com_rslt += bmm050_set_functional_state(BMM050_SUSPEND_MODE);
/*---------------------------------------------------------------------*
************************* END DE-INITIALIZATION **********************
*---------------------------------------------------------------------*/
return com_rslt;
}
#ifdef BMM050_API
/*--------------------------------------------------------------------------*/
/* The following function is used to map the I2C bus read, write, delay and
* device address with global structure bmm050
*-------------------------------------------------------------------------*/
s8 I2C_routine(void)
{
/*--------------------------------------------------------------------------*/
/* By using bmm050 the following structure parameter can be accessed
* Bus write function pointer: BMM050_WR_FUNC_PTR
* Bus read function pointer: BMM050_RD_FUNC_PTR
* Delay function pointer: delay_msec
* I2C address: dev_addr
*--------------------------------------------------------------------------*/
bmm050.bus_write = BMM050_I2C_bus_write;
bmm050.bus_read = BMM050_I2C_bus_read;
bmm050.delay_msec = BMM050_delay_msek;
bmm050.dev_addr = BMM050_I2C_ADDRESS;
return BMM050_INIT_VALUE;
}
/*---------------------------------------------------------------------------*/
/* The following function is used to map the SPI bus read, write and delay
* with global structure bmm050
*--------------------------------------------------------------------------*/
s8 SPI_routine(void)
{
/*--------------------------------------------------------------------------*
* By using bmm050 the following structure parameter can be accessed
* Bus write function pointer: BMM050_WR_FUNC_PTR
* Bus read function pointer: BMM050_RD_FUNC_PTR
* Delay function pointer: delay_msec
*--------------------------------------------------------------------------*/
bmm050.bus_write = BMM050_SPI_bus_write;
bmm050.bus_read = BMM050_SPI_bus_read;
bmm050.delay_msec = BMM050_delay_msek;
return BMM050_INIT_VALUE;
}
/************** SPI/I2C buffer length ******/
#define I2C_BUFFER_LEN 8
#define SPI_BUFFER_LEN 5
#define MASK_DATA1 0xFF
#define MASK_DATA2 0x80
#define MASK_DATA3 0x7F
#define C_BMM050_ONE_U8X (1)
#define C_BMM050_TWO_U8X (2)
/*-------------------------------------------------------------------*
*
* This is a sample code for read and write the data by using I2C/SPI
* Use either I2C or SPI based on your need
* The device address defined in the bmm050.h file
*
*-----------------------------------------------------------------------*/
/* \Brief: The function is used as I2C bus write
* \Return : Status of the I2C write
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register,
* will data is going to be written
* \param reg_data : It is a value hold in the array,
* will be used for write the value into the register
* \param cnt : The no of byte of data to be write
*/
s8 BMM050_I2C_bus_write(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt)
{
s32 iError = BMM050_INIT_VALUE;
u8 array[I2C_BUFFER_LEN];
u8 stringpos = BMM050_INIT_VALUE;
array[BMM050_INIT_VALUE] = reg_addr;
for (stringpos = BMM050_INIT_VALUE; stringpos < cnt; stringpos++)
array[stringpos + C_BMM050_ONE_U8X] = *(reg_data + stringpos);
/*
* Please take the below function as your reference for
* write the data using I2C communication
* "IERROR = I2C_WRITE_STRING(DEV_ADDR, ARRAY, CNT+C_BMM050_ONE_U8X)"
* add your I2C write function here
* iError is an return value of I2C read function
* Please select your valid return value
* In the driver SUCCESS defined as BMM050_INIT_VALUE
* and FAILURE defined as -C_BMM050_ONE_U8X
* Note :
* This is a full duplex operation,
* The first read data is discarded, for that extra write operation
* have to be initiated. For that cnt+C_BMM050_ONE_U8X operation done
* in the I2C write string function
* For more information please refer data sheet SPI communication:
*/
return (s8)iError;
}
/* \Brief: The function is used as I2C bus read
* \Return : Status of the I2C read
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register,
* will data is going to be read
* \param reg_data : This data read from the sensor,
* which is hold in an array
* \param cnt : The no of byte of data to be read
*/
s8 BMM050_I2C_bus_read(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt)
{
s32 iError = BMM050_INIT_VALUE;
u8 array[I2C_BUFFER_LEN] = {BMM050_INIT_VALUE};
u8 stringpos = BMM050_INIT_VALUE;
array[BMM050_INIT_VALUE] = reg_addr;
/* Please take the below function as your reference
* for read the data using I2C communication
* add your I2C rad function here.
* "IERROR = I2C_WRITE_READ_STRING(
* DEV_ADDR, ARRAY, ARRAY, C_BMM050_ONE_U8X, CNT)"
* iError is an return value of SPI write function
* Please select your valid return value
* In the driver SUCCESS defined as BMM050_INIT_VALUE
* and FAILURE defined as -C_BMM050_ONE_U8X
*/
for (stringpos = BMM050_INIT_VALUE; stringpos < cnt; stringpos++)
*(reg_data + stringpos) = array[stringpos];
return (s8)iError;
}
/* \Brief: The function is used as SPI bus read
* \Return : Status of the SPI read
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register,
* will data is going to be read
* \param reg_data : This data read from the sensor,
* which is hold in an array
* \param cnt : The no of byte of data to be read
*/
s8 BMM050_SPI_bus_read(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt)
{
s32 iError = BMM050_INIT_VALUE;
u8 array[SPI_BUFFER_LEN] = {MASK_DATA1};
u8 stringpos;
/* For the SPI mode only 7 bits of register addresses are used.
The MSB of register address is declared the bit what functionality it is
read/write (read as C_BMM050_ONE_U8X/write as BMM050_INIT_VALUE)*/
/*read routine is initiated register address is mask with 0x80*/
array[BMM050_INIT_VALUE] = reg_addr | MASK_DATA2;
/*
* Please take the below function as your reference for
* read the data using SPI communication
* " IERROR = SPI_READ_WRITE_STRING(ARRAY, ARRAY, CNT+C_BMM050_ONE_U8X)"
* add your SPI read function here
* iError is an return value of SPI read function
* Please select your valid return value
* In the driver SUCCESS defined as BMM050_INIT_VALUE
* and FAILURE defined as -1
* Note :
* This is a full duplex operation,
* The first read data is discarded, for that extra write operation
* have to be initiated. For that cnt+C_BMM050_ONE_U8X operation done
* in the SPI read
* and write string function
* For more information please refer data sheet SPI communication:
*/
for (stringpos = BMM050_INIT_VALUE; stringpos < cnt; stringpos++)
*(reg_data + stringpos) = array[stringpos + C_BMM050_ONE_U8X];
return (s8)iError;
}
/* \Brief: The function is used as SPI bus write
* \Return : Status of the SPI write
* \param dev_addr : The device address of the sensor
* \param reg_addr : Address of the first register,
* will data is going to be written
* \param reg_data : It is a value hold in the array,
* will be used for write the value into the register
* \param cnt : The no of byte of data to be write
*/
s8 BMM050_SPI_bus_write(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt)
{
s32 iError = BMM050_INIT_VALUE;
u8 array[SPI_BUFFER_LEN * C_BMM050_TWO_U8X];
u8 stringpos = BMM050_INIT_VALUE;
for (stringpos = BMM050_INIT_VALUE; stringpos < cnt; stringpos++)
{
/* the operation of (reg_addr++)&0x7F done: because it ensure
the BMM050_INIT_VALUE and C_BMM050_ONE_U8X of the given value
It is done only for 8bit operation*/
array[stringpos * C_BMM050_TWO_U8X] = (reg_addr++) & MASK_DATA3;
array[stringpos * C_BMM050_TWO_U8X + C_BMM050_ONE_U8X] =
*(reg_data + stringpos);
}
/* Please take the below function as your reference
* for write the data using SPI communication
* add your SPI write function here.
* "IERROR = SPI_WRITE_STRING(ARRAY, CNT*C_BMM050_TWO_U8X)"
* iError is an return value of SPI write function
* Please select your valid return value
* In the driver SUCCESS defined as BMM050_INIT_VALUE
* and FAILURE defined as -1
*/
return (s8)iError;
}
/* Brief : The delay routine
* \param : delay in ms
*/
void BMM050_delay_msek(u32 msek)
{
/*Here you can write your own delay routine*/
}
#endif
|
dfc9948cdb96babc4c7b74b82369ec3a7d63f095
|
55540f3e86f1d5d86ef6b5d295a63518e274efe3
|
/customer_app/system/ota/demo_ota/demo_ota/bl_http_ota.h
|
ffa51b5d2fe9c73c7e8f5df3ee40ac7e52182d7b
|
[
"Apache-2.0"
] |
permissive
|
bouffalolab/bl_iot_sdk
|
bc5eaf036b70f8c65dd389439062b169f8d09daa
|
b90664de0bd4c1897a9f1f5d9e360a9631d38b34
|
refs/heads/master
| 2023-08-31T03:38:03.369853
| 2023-08-16T08:50:33
| 2023-08-18T09:13:27
| 307,347,250
| 244
| 101
|
Apache-2.0
| 2023-08-28T06:29:02
| 2020-10-26T11:16:30
|
C
|
UTF-8
|
C
| false
| false
| 188
|
h
|
bl_http_ota.h
|
#ifndef _BL_HTTP_OTA_H_
#define _BL_HTTP_OTA_H_
#ifdef __cplusplus
extern "C" {
#endif
int bl_http_ota_cli_init(void);
#ifdef __cplusplus
}
#endif
#endif /* _COMMAND_H_ */
|
f5475592322f2c9dadd8f927db0a5600ca86fd90
|
e62d77c7a56a04e73b1bb8f8759afa0e37d1cb41
|
/ArtemisPS3-GUI/include/menu_about.h
|
aa1e731d800de6969a7e038844df43293e8a7356
|
[
"MIT"
] |
permissive
|
bucanero/ArtemisPS3
|
29ef96ecaf5cefafd8778ebe7bafc310ea7c3f1b
|
50dac6e00550931e8148218822faf8ff11a0877f
|
refs/heads/master
| 2023-01-10T18:12:22.778543
| 2022-12-20T21:52:36
| 2022-12-20T21:52:36
| 224,701,674
| 137
| 44
|
MIT
| 2022-05-16T20:04:32
| 2019-11-28T17:32:59
|
C
|
UTF-8
|
C
| false
| false
| 58
|
h
|
menu_about.h
|
void Draw_AboutMenu_Ani(void);
void Draw_AboutMenu(void);
|
a1b0de5d73a2d7d993675243a90c9a059ae33129
|
47a6819a8301a265077cb5c08d4787c831753ee1
|
/libtorch-ffi/csrc/hasktorch_dump.c
|
f83a033e07b06b273ca368413801a9a85f252139
|
[
"BSD-3-Clause"
] |
permissive
|
hasktorch/hasktorch
|
2caf48850085d9b0214a8351d4a4d2b0cf3b4341
|
7b63d730964a44a6bcdd853cd5b140a24e210298
|
refs/heads/master
| 2023-08-30T21:24:07.242455
| 2023-06-03T00:11:08
| 2023-06-03T00:11:08
| 102,987,059
| 1,028
| 130
|
NOASSERTION
| 2023-08-24T02:12:56
| 2017-09-09T21:50:59
|
Haskell
|
UTF-8
|
C
| false
| false
| 1,247
|
c
|
hasktorch_dump.c
|
#include "Rts.h"
#include "hasktorch_dump.h"
void
showCFinalizers(int flag, StgCFinalizerList *list)
{
StgCFinalizerList *head;
for (head = list;
(StgClosure *)head != &stg_NO_FINALIZER_closure;
head = (StgCFinalizerList *)head->link)
{
showObject(flag, head->ptr, head->fptr);
}
}
void
showAllCFinalizers(int flag, StgWeak *list)
{
StgWeak *w;
for (w = list; w; w = w->link) {
// We need to filter out DEAD_WEAK objects, because it's not guaranteed
// that the list will not have them when shutting down.
// They only get filtered out during GC for the generation they
// belong to.
// If there's no major GC between the time that the finalizer for the
// object from the oldest generation is manually called and shutdown
// we end up running the same finalizer twice. See #7170.
const StgInfoTable *winfo = w->header.info;
if (winfo != &stg_DEAD_WEAK_info) {
showCFinalizers(flag,(StgCFinalizerList *)w->cfinalizers);
}
}
}
void
showWeakPtrList(int flag){
ACQUIRE_LOCK(sm_mutex);
shiftObjectMap();
for (uint32_t g = 0; g < RtsFlags.GcFlags.generations; g++) {
showAllCFinalizers(flag,generations[g].weak_ptr_list);
}
RELEASE_LOCK(sm_mutex);
}
|
c4a7d384e506e43e213be08b88b598534f53f32a
|
376e1818d427b5e4d32fa6dd6c7b71e9fd88afdb
|
/graphics/libv4l/patches/patch-lib_libv4lconvert_processing_libv4lprocessing.h
|
bd8414e4fee74effa2c9c400f4f39bb4d2cf7330
|
[] |
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
| 471
|
h
|
patch-lib_libv4lconvert_processing_libv4lprocessing.h
|
$NetBSD: patch-lib_libv4lconvert_processing_libv4lprocessing.h,v 1.1 2020/09/02 09:54:33 ryoon Exp $
--- lib/libv4lconvert/processing/libv4lprocessing.h.orig 2017-01-22 17:33:34.000000000 +0000
+++ lib/libv4lconvert/processing/libv4lprocessing.h
@@ -22,7 +22,7 @@
#define __LIBV4LPROCESSING_H
#include "../libv4lsyscall-priv.h"
-#if defined(__OpenBSD__)
+#if defined(__OpenBSD__) || defined(__NetBSD__)
#include <sys/videoio.h>
#else
#include <linux/videodev2.h>
|
58142d40b34fa7881af249168e24785f4d4d4c2d
|
3932538f0862a14f859836a56d56e08b859a2beb
|
/Code/Launcher/HeadlessServer/NullValidator.h
|
caac9068379b7f7f70248e6fcf19e4cd81816d07
|
[] |
no_license
|
ccomrade/c1-launcher
|
438c2c365ea5d28f112e5b1b6a269cc6f8459818
|
c65df7692b78cff19745a44b4d72d2f6e2ae96fc
|
refs/heads/master
| 2023-07-06T14:51:04.936361
| 2023-06-25T11:25:31
| 2023-06-25T11:25:31
| 196,698,008
| 179
| 26
| null | 2023-01-12T19:36:11
| 2019-07-13T08:30:46
|
C++
|
UTF-8
|
C
| false
| false
| 152
|
h
|
NullValidator.h
|
#pragma once
#include "CryCommon/CrySystem/IValidator.h"
struct NullValidator : public IValidator
{
void Report(SValidatorRecord&) override
{
}
};
|
ecb8a762cf2f69701f6dbec38948cfca83325c8b
|
abb28a62de39d806d5a63f5b94305069ee5950ca
|
/src/gpusim/util_type_internal.h
|
8363aa43a1b7e4ebb96a2598629d7034a65314eb
|
[
"MIT"
] |
permissive
|
qulacs/qulacs
|
0d79074b83b8cc0faa3c31135178b08771be9987
|
413bcd3d02c01e2ad85a711abad252daadd5b832
|
refs/heads/main
| 2023-08-16T21:25:57.217422
| 2023-07-31T01:53:48
| 2023-07-31T01:53:48
| 151,675,481
| 349
| 121
|
MIT
| 2023-09-14T01:53:34
| 2018-10-05T05:39:51
|
C++
|
UTF-8
|
C
| false
| false
| 155
|
h
|
util_type_internal.h
|
#ifndef _UTIL_TYPE_INTERNAL_H_
#define _UTIL_TYPE_INTERNAL_H_
#include <cuComplex.h>
using GTYPE = cuDoubleComplex;
#endif // #ifndef _UTIL_COMMON_CU_H_
|
31e97dd46321bb9e3cd4f42bf60f6b34f5bcf51f
|
b970e053302588f44ee1c6b7187c4769934c857f
|
/ajax/libs/openlayers/5.0.3/rotationconstraint.js
|
3e71185938d628efb609e9bc85a1148e7679e88d
|
[
"MIT"
] |
permissive
|
cdnjs/cdnjs
|
2fe0f21477c08618fe609da844f5d133224c3eda
|
6843ffa5339e4595b3a6893ae3e9ede1117cc5f9
|
refs/heads/master
| 2023-07-23T14:52:44.587645
| 2023-07-23T07:12:24
| 2023-07-23T07:12:24
| 1,409,811
| 8,894
| 5,633
|
MIT
| 2023-06-27T12:32:50
| 2011-02-25T05:53:47
| null |
UTF-8
|
C
| false
| false
| 1,893
|
js
|
rotationconstraint.js
|
/**
* @module ol/rotationconstraint
*/
import {toRadians} from './math.js';
/**
* @typedef {function((number|undefined), number): (number|undefined)} Type
*/
/**
* @param {number|undefined} rotation Rotation.
* @param {number} delta Delta.
* @return {number|undefined} Rotation.
*/
export function disable(rotation, delta) {
if (rotation !== undefined) {
return 0;
} else {
return undefined;
}
}
/**
* @param {number|undefined} rotation Rotation.
* @param {number} delta Delta.
* @return {number|undefined} Rotation.
*/
export function none(rotation, delta) {
if (rotation !== undefined) {
return rotation + delta;
} else {
return undefined;
}
}
/**
* @param {number} n N.
* @return {module:ol/rotationconstraint~Type} Rotation constraint.
*/
export function createSnapToN(n) {
const theta = 2 * Math.PI / n;
return (
/**
* @param {number|undefined} rotation Rotation.
* @param {number} delta Delta.
* @return {number|undefined} Rotation.
*/
function(rotation, delta) {
if (rotation !== undefined) {
rotation = Math.floor((rotation + delta) / theta + 0.5) * theta;
return rotation;
} else {
return undefined;
}
});
}
/**
* @param {number=} opt_tolerance Tolerance.
* @return {module:ol/rotationconstraint~Type} Rotation constraint.
*/
export function createSnapToZero(opt_tolerance) {
const tolerance = opt_tolerance || toRadians(5);
return (
/**
* @param {number|undefined} rotation Rotation.
* @param {number} delta Delta.
* @return {number|undefined} Rotation.
*/
function(rotation, delta) {
if (rotation !== undefined) {
if (Math.abs(rotation + delta) <= tolerance) {
return 0;
} else {
return rotation + delta;
}
} else {
return undefined;
}
});
}
|
c6552bd18e35763ad23f8eab489fb49cc564cc33
|
4261bbe3b96690f0f92acac781c99eaf2fd5919c
|
/ext/opencensus_trace.c
|
7852233ab1838c2830dba5c769afa69ac6aa1c7b
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
census-instrumentation/opencensus-php
|
d5d9e53eba3798150906de3f336dc714a8abb4a8
|
af616ac76c55f7813a6f5eb9285a1a8b4496320d
|
refs/heads/master
| 2023-08-16T20:13:39.102061
| 2023-05-02T19:13:29
| 2023-05-02T19:13:29
| 99,052,232
| 199
| 85
|
Apache-2.0
| 2023-06-12T10:53:18
| 2017-08-01T23:41:16
|
PHP
|
UTF-8
|
C
| false
| false
| 21,396
|
c
|
opencensus_trace.c
|
/*
* Copyright 2017 OpenCensus Authors
*
* 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 "php_opencensus.h"
#include "opencensus_trace.h"
#include "Zend/zend_builtin_functions.h"
#include "Zend/zend_exceptions.h"
#include "standard/php_math.h"
#include "standard/php_rand.h"
/**
* True globals for storing the original zend_execute_ex and
* zend_execute_internal function pointers
*/
static void (*opencensus_original_zend_execute_ex) (zend_execute_data *execute_data);
static void (*opencensus_original_zend_execute_internal) (zend_execute_data *execute_data, zval *return_value);
void opencensus_trace_ginit()
{
/**
* Save original zend execute functions and use our own to instrument
* function calls
*/
opencensus_original_zend_execute_ex = zend_execute_ex;
zend_execute_ex = opencensus_trace_execute_ex;
opencensus_original_zend_execute_internal = zend_execute_internal;
zend_execute_internal = opencensus_trace_execute_internal;
}
void opencensus_trace_gshutdown()
{
/* Put the original zend execute function back */
zend_execute_ex = opencensus_original_zend_execute_ex;
zend_execute_internal = opencensus_original_zend_execute_internal;
}
void opencensus_trace_rinit()
{
/* initialize storage for user traced functions - per request basis */
ALLOC_HASHTABLE(OPENCENSUS_G(user_traced_functions));
zend_hash_init(OPENCENSUS_G(user_traced_functions), 16, NULL, ZVAL_PTR_DTOR, 0);
/* initialize storage for recorded spans - per request basis */
ALLOC_HASHTABLE(OPENCENSUS_G(spans));
zend_hash_init(OPENCENSUS_G(spans), 16, NULL, span_dtor, 0);
OPENCENSUS_G(current_span) = NULL;
OPENCENSUS_G(trace_id) = NULL;
OPENCENSUS_G(trace_parent_span_id) = NULL;
}
void opencensus_trace_rshutdown()
{
/* cleanup user_traced_functions zvals that we copied when registing */
zend_hash_destroy(OPENCENSUS_G(user_traced_functions));
FREE_HASHTABLE(OPENCENSUS_G(user_traced_functions));
/* cleanup recorded spans */
opencensus_trace_clear(0);
}
/**
* Fetch the spanId zend_string value from the provided array.
* Note that the returned zend_string must be released by the caller.
*/
static zend_string *span_id_from_options(HashTable *options)
{
zval *val;
zend_string *str = NULL;
if (options == NULL) {
return NULL;
}
val = zend_hash_str_find(options, "spanId", strlen("spanId"));
if (val == NULL) {
return NULL;
}
switch (Z_TYPE_P(val)) {
case IS_STRING:
str = zval_get_string(val);
break;
case IS_LONG:
#if PHP_MAJOR_VERSION < 8
str = _php_math_longtobase(val, 16);
#else
str = _php_math_longtobase(Z_LVAL_P(val), 16);
#endif
break;
}
if (str == NULL) {
php_error_docref(NULL, E_WARNING, "Provided spanId should be a hex string");
return NULL;
}
return str;
}
/*Fetch the span struct for the spanId from the provided array. */
static opencensus_trace_span_t *span_from_options(zval *options)
{
zend_string *span_id = NULL;
opencensus_trace_span_t *span = NULL;
if (options == NULL) {
return NULL;
}
span_id = span_id_from_options(Z_ARR_P(options));
if (span_id != NULL) {
span = (opencensus_trace_span_t *)zend_hash_find_ptr(OPENCENSUS_G(spans), span_id);
zend_string_release(span_id);
}
return span;
}
/**
* Add a attribute to the current trace span
*
* @param string $key
* @param string $value
* @return bool
*/
PHP_FUNCTION(opencensus_trace_add_attribute)
{
zend_string *k, *v;
opencensus_trace_span_t *span;
zval *options = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|a", &k, &v, &options) == FAILURE) {
RETURN_FALSE;
}
span = span_from_options(options);
if (span == NULL) {
span = OPENCENSUS_G(current_span);
}
if (span == NULL) {
RETURN_FALSE;
}
if (opencensus_trace_span_add_attribute(span, k, v) == SUCCESS) {
RETURN_TRUE;
}
RETURN_FALSE;
}
/**
* Add an annotation to the current trace span
*
* @param string $description
* @param array $options
* @return bool
*/
PHP_FUNCTION(opencensus_trace_add_annotation)
{
zend_string *description;
opencensus_trace_span_t *span;
zval *options = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|a", &description, &options) == FAILURE) {
RETURN_FALSE;
}
span = span_from_options(options);
if (span == NULL) {
span = OPENCENSUS_G(current_span);
}
if (span == NULL) {
RETURN_FALSE;
}
if (opencensus_trace_span_add_annotation(span, description, options) == SUCCESS) {
RETURN_TRUE;
}
RETURN_FALSE;
}
/**
* Add a link to the current trace span
*
* @param string $traceId
* @param string $spanId
* @param array $options
* @return bool
*/
PHP_FUNCTION(opencensus_trace_add_link)
{
zend_string *trace_id, *span_id;
opencensus_trace_span_t *span;
zval *options = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|a", &trace_id, &span_id, &options) == FAILURE) {
RETURN_FALSE;
}
span = span_from_options(options);
if (span == NULL) {
span = OPENCENSUS_G(current_span);
}
if (span == NULL) {
RETURN_FALSE;
}
if (opencensus_trace_span_add_link(span, trace_id, span_id, options) == SUCCESS) {
RETURN_TRUE;
}
RETURN_FALSE;
}
/**
* Add a message event to the current trace span
*
* @param string $type
* @param string $id
* @param array $options
* @return bool
*/
PHP_FUNCTION(opencensus_trace_add_message_event)
{
zend_string *type, *id;
opencensus_trace_span_t *span;
zval *options = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|a", &type, &id, &options) == FAILURE) {
RETURN_FALSE;
}
span = span_from_options(options);
if (span == NULL) {
span = OPENCENSUS_G(current_span);
}
if (span == NULL) {
RETURN_FALSE;
}
if (opencensus_trace_span_add_message_event(span, type, id, options) == SUCCESS) {
RETURN_TRUE;
}
RETURN_FALSE;
}
static void opencensus_copy_args(zend_execute_data *execute_data, zval **args, int *ret_num_args)
{
int i, num_args = ZEND_CALL_NUM_ARGS(execute_data), has_scope = 0;
zval *arguments = emalloc((num_args + 1) * sizeof(zval));
*args = arguments;
if (getThis() != NULL) {
has_scope = 1;
ZVAL_COPY(&arguments[0], getThis());
}
for (i = 0; i < num_args; i++) {
ZVAL_COPY(&arguments[i + has_scope], ZEND_CALL_VAR_NUM(execute_data, i));
}
*ret_num_args = num_args + has_scope;
}
static void opencensus_free_args(zval *args, int num_args)
{
int i;
for (i = 0; i < num_args; i++) {
zval_dtor(&args[i]);
}
efree(args);
}
/**
* Call the provided callback with the provided parameters to the traced
* function. The callback must return an array or an E_WARNING is raised.
*/
static int opencensus_trace_call_user_function_callback(zval *args, int num_args, zend_execute_data *execute_data, opencensus_trace_span_t *span, zval *callback, zval *callback_result)
{
if (call_user_function(EG(function_table), NULL, callback, callback_result, num_args, args) != SUCCESS) {
return FAILURE;
}
if (EG(exception) != NULL) {
php_error_docref(NULL, E_WARNING, "Exception in trace callback");
zend_clear_exception();
return FAILURE;
}
if (Z_TYPE_P(callback_result) != IS_ARRAY) {
/* only raise the warning if the closure succeeded */
php_error_docref(NULL, E_WARNING, "Trace callback should return array");
return FAILURE;
}
return SUCCESS;
}
/**
* Force the random span id to be positive. php_mt_rand() generates 32 bits
* of randomness. On 32-bit systems, we must cast to an unsigned int before
* bitshifting to force a positive number. We're ok to lose on bit of
* randomness because previous versions of mt_rand only generated 31 bits.
*/
static zend_string *generate_span_id()
{
#if PHP_VERSION_ID < 80000
zval zv;
ZVAL_LONG(&zv, ((uint32_t) php_mt_rand()) >> 1);
return _php_math_longtobase(&zv, 16);
#else
zend_long random_int = ((uint32_t) php_mt_rand()) >> 1;
return _php_math_longtobase(random_int, 16);
#endif
}
/**
* Start a new trace span. Inherit the parent span id from the current trace
* context
*/
static opencensus_trace_span_t *opencensus_trace_begin(zend_string *name, zend_execute_data *execute_data, zend_string *span_id)
{
opencensus_trace_span_t *span = opencensus_trace_span_alloc();
zend_fetch_debug_backtrace(&span->stackTrace, 1, DEBUG_BACKTRACE_IGNORE_ARGS, 0);
span->start = opencensus_now();
span->name = zend_string_copy(name);
if (span_id != NULL) {
span->span_id = zend_string_copy(span_id);
} else {
span->span_id = generate_span_id();
}
if (OPENCENSUS_G(current_span)) {
span->parent = OPENCENSUS_G(current_span);
}
OPENCENSUS_G(current_span) = span;
/* add the span to the list of spans */
zend_hash_add_ptr(OPENCENSUS_G(spans), span->span_id, span);
return span;
}
/**
* Finish the current trace span. Set the new current trace span to this span's
* parent if there is one.
*/
static int opencensus_trace_finish()
{
opencensus_trace_span_t *span = OPENCENSUS_G(current_span);
if (!span) {
return FAILURE;
}
/* set current time for now */
span->stop = opencensus_now();
OPENCENSUS_G(current_span) = span->parent;
return SUCCESS;
}
/**
* Given a class name and a function name, return a new string that represents
* the function name. Note that this zend_string should be released when
* finished.
*/
static zend_string *opencensus_trace_generate_class_name(zend_string *class_name, zend_string *function_name)
{
int len = class_name->len + function_name->len + 2;
zend_string *result = zend_string_alloc(len, 0);
strcpy(ZSTR_VAL(result), class_name->val);
strcat(ZSTR_VAL(result), "::");
strcat(ZSTR_VAL(result), function_name->val);
return result;
}
/* Prepend the name of the scope class to the function name */
static zend_string *opencensus_trace_add_scope_name(zend_string *function_name, zend_class_entry *scope)
{
zend_string *result;
if (!function_name) {
return NULL;
}
if (scope) {
result = opencensus_trace_generate_class_name(scope->name, function_name);
} else {
result = zend_string_copy(function_name);
}
return result;
}
/**
* Start a new trace span
*
* @param string $spanName
* @param array $spanOptions
* @return bool
*/
PHP_FUNCTION(opencensus_trace_begin)
{
zend_string *function_name, *span_id;
zval *span_options = NULL, default_span_options;
opencensus_trace_span_t *span;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|a", &function_name, &span_options) == FAILURE) {
RETURN_FALSE;
}
if (span_options == NULL) {
array_init(&default_span_options);
span = opencensus_trace_begin(function_name, execute_data, NULL);
opencensus_trace_span_apply_span_options(span, &default_span_options);
zval_dtor(&default_span_options);
} else {
span_id = span_id_from_options(Z_ARR_P(span_options));
span = opencensus_trace_begin(function_name, execute_data, span_id);
if (span_id != NULL) {
zend_string_release(span_id);
}
opencensus_trace_span_apply_span_options(span, span_options);
}
RETURN_TRUE;
}
/**
* Finish the current trace span
*
* @return bool
*/
PHP_FUNCTION(opencensus_trace_finish)
{
if (opencensus_trace_finish() == SUCCESS) {
RETURN_TRUE;
}
RETURN_FALSE;
}
void span_dtor(zval *zv)
{
opencensus_trace_span_t *span = Z_PTR_P(zv);
opencensus_trace_span_free(span);
ZVAL_PTR_DTOR(zv);
}
/**
* Reset the list of spans and free any allocated memory used.
* If reset is set, reallocate request globals so we can start capturing spans.
*/
void opencensus_trace_clear(int reset)
{
/* free the hashtable */
zend_hash_destroy(OPENCENSUS_G(spans));
FREE_HASHTABLE(OPENCENSUS_G(spans));
/* reallocate and setup the hashtable for captured spans */
if (reset) {
ALLOC_HASHTABLE(OPENCENSUS_G(spans));
zend_hash_init(OPENCENSUS_G(spans), 16, NULL, span_dtor, 0);
}
OPENCENSUS_G(current_span) = NULL;
if (OPENCENSUS_G(trace_id)) {
zend_string_release(OPENCENSUS_G(trace_id));
OPENCENSUS_G(trace_id) = NULL;
}
if (OPENCENSUS_G(trace_parent_span_id)) {
zend_string_release(OPENCENSUS_G(trace_parent_span_id));
OPENCENSUS_G(trace_parent_span_id) = NULL;
}
}
/**
* Reset the list of spans
*
* @return bool
*/
PHP_FUNCTION(opencensus_trace_clear)
{
opencensus_trace_clear(1);
RETURN_TRUE;
}
/**
* Set the initial trace context
*
* @param string $traceId
* @param string $parentSpanId
*/
PHP_FUNCTION(opencensus_trace_set_context)
{
zend_string *trace_id = NULL, *parent_span_id = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|S", &trace_id, &parent_span_id) == FAILURE) {
RETURN_FALSE;
}
OPENCENSUS_G(trace_id) = zend_string_copy(trace_id);
if (parent_span_id) {
OPENCENSUS_G(trace_parent_span_id) = zend_string_copy(parent_span_id);
}
RETURN_TRUE;
}
/**
* Return the current trace context
*
* @return OpenCensus\Trace\SpanContext
*/
PHP_FUNCTION(opencensus_trace_context)
{
opencensus_trace_span_t *span = OPENCENSUS_G(current_span);
object_init_ex(return_value, opencensus_trace_context_ce);
if (span) {
zend_update_property_str(opencensus_trace_context_ce, OPENCENSUS_OBJ_P(return_value), "spanId", sizeof("spanId") - 1, span->span_id);
} else if (OPENCENSUS_G(trace_parent_span_id)) {
zend_update_property_str(opencensus_trace_context_ce, OPENCENSUS_OBJ_P(return_value), "spanId", sizeof("spanId") - 1, OPENCENSUS_G(trace_parent_span_id));
}
if (OPENCENSUS_G(trace_id)) {
zend_update_property_str(opencensus_trace_context_ce, OPENCENSUS_OBJ_P(return_value), "traceId", sizeof("traceId") - 1, OPENCENSUS_G(trace_id));
}
}
/**
* This method replaces the internal zend_execute_ex method used to dispatch
* calls to user space code. The original zend_execute_ex method is moved to
* opencensus_original_zend_execute_ex
*/
void opencensus_trace_execute_ex (zend_execute_data *execute_data) {
zend_string *function_name = opencensus_trace_add_scope_name(
EG(current_execute_data)->func->common.function_name,
EG(current_execute_data)->func->common.scope
);
zval *trace_handler;
opencensus_trace_span_t *span;
zend_string *callback_name = NULL;
/* Some functions have no names - just execute them */
if (function_name == NULL) {
opencensus_original_zend_execute_ex(execute_data);
return;
}
trace_handler = zend_hash_find(OPENCENSUS_G(user_traced_functions), function_name);
/* Function is not registered for execution - continue normal execution */
if (trace_handler == NULL) {
opencensus_original_zend_execute_ex(execute_data);
zend_string_release(function_name);
return;
}
span = opencensus_trace_begin(function_name, execute_data, NULL);
zend_string_release(function_name);
if (zend_is_callable(trace_handler, 0, &callback_name)) {
/* Registered handler is callable - execute the callback */
zval callback_result, *args;
int num_args;
opencensus_copy_args(execute_data, &args, &num_args);
opencensus_original_zend_execute_ex(execute_data);
if (opencensus_trace_call_user_function_callback(args, num_args, execute_data, span, trace_handler, &callback_result) == SUCCESS) {
opencensus_trace_span_apply_span_options(span, &callback_result);
}
opencensus_free_args(args, num_args);
zval_dtor(&callback_result);
} else {
/* Registered handler is span options array */
opencensus_original_zend_execute_ex(execute_data);
if (Z_TYPE_P(trace_handler) == IS_ARRAY) {
opencensus_trace_span_apply_span_options(span, trace_handler);
}
}
zend_string_release(callback_name);
opencensus_trace_finish();
}
/**
* This method resumes the internal function execution.
*/
static void resume_execute_internal(INTERNAL_FUNCTION_PARAMETERS)
{
if (opencensus_original_zend_execute_internal) {
opencensus_original_zend_execute_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
} else {
execute_data->func->internal_function.handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
}
/**
* This method replaces the internal zend_execute_internal method used to
* dispatch calls to internal code. The original zend_execute_internal method
* is moved to opencensus_original_zend_execute_internal
*/
void opencensus_trace_execute_internal(INTERNAL_FUNCTION_PARAMETERS)
{
zend_string *function_name = opencensus_trace_add_scope_name(
execute_data->func->internal_function.function_name,
execute_data->func->internal_function.scope
);
zval *trace_handler;
opencensus_trace_span_t *span;
zend_string *callback_name = NULL;
/* Some functions have no names - just execute them */
if (function_name == NULL) {
resume_execute_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
return;
}
trace_handler = zend_hash_find(OPENCENSUS_G(user_traced_functions), function_name);
/* Function is not registered for execution - continue normal execution */
if (trace_handler == NULL) {
resume_execute_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
zend_string_release(function_name);
return;
}
span = opencensus_trace_begin(function_name, execute_data, NULL);
zend_string_release(function_name);
if (zend_is_callable(trace_handler, 0, &callback_name)) {
/* Registered handler is callable - execute the callback */
zval callback_result, *args;
int num_args;
opencensus_copy_args(execute_data, &args, &num_args);
resume_execute_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
if (opencensus_trace_call_user_function_callback(args, num_args, execute_data, span, trace_handler, &callback_result) == SUCCESS) {
opencensus_trace_span_apply_span_options(span, &callback_result);
}
opencensus_free_args(args, num_args);
zval_dtor(&callback_result);
} else {
/* Registered handler is span options array */
resume_execute_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU);
if (Z_TYPE_P(trace_handler) == IS_ARRAY) {
opencensus_trace_span_apply_span_options(span, trace_handler);
}
}
zend_string_release(callback_name);
opencensus_trace_finish();
}
/**
* Register the provided function for tracing.
*
* @param string $functionName
* @param array|callable $handler
* @return bool
*/
PHP_FUNCTION(opencensus_trace_function)
{
zend_string *function_name;
zval *handler = NULL;
zval h;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|z", &function_name, &handler) == FAILURE) {
RETURN_FALSE;
}
if (handler == NULL) {
ZVAL_LONG(&h, 1);
handler = &h;
} else {
ZVAL_COPY(&h, handler);
}
zend_hash_update(OPENCENSUS_G(user_traced_functions), function_name, &h);
RETURN_TRUE;
}
/**
* Register the provided function for tracing.
*
* @param string $className
* @param string $methodName
* @param array|callable $handler
* @return bool
*/
PHP_FUNCTION(opencensus_trace_method)
{
zend_string *class_name, *function_name, *key;
zval *handler = NULL;
zval h;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|z", &class_name, &function_name, &handler) == FAILURE) {
RETURN_FALSE;
}
if (handler == NULL) {
ZVAL_LONG(&h, 1);
handler = &h;
} else {
ZVAL_COPY(&h, handler);
}
key = opencensus_trace_generate_class_name(class_name, function_name);
zend_hash_update(OPENCENSUS_G(user_traced_functions), key, &h);
zend_string_release(key);
RETURN_FALSE;
}
/**
* Return the collected list of trace spans that have been collected for this
* request
*
* @return OpenCensus\Trace\Span[]
*/
PHP_FUNCTION(opencensus_trace_list)
{
opencensus_trace_span_t *trace_span;
array_init(return_value);
ZEND_HASH_FOREACH_PTR(OPENCENSUS_G(spans), trace_span) {
zval span;
opencensus_trace_span_to_zval(trace_span, &span);
add_next_index_zval(return_value, &span);
} ZEND_HASH_FOREACH_END();
}
|
5f4b2656a6c18dcabd090a737c5efc1e2d129bb6
|
aa3befea459382dc5c01c925653d54f435b3fb0f
|
/wireless/ieee802154/mac802154_get_mhrlen.c
|
f03ac55244c5c282bed61b2a79ed14ecc5271247
|
[
"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
| 4,176
|
c
|
mac802154_get_mhrlen.c
|
/****************************************************************************
* wireless/ieee802154/mac802154_get_mhrlen.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 <stdlib.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
#include <string.h>
#include "mac802154.h"
#include "mac802154_internal.h"
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
/****************************************************************************
* Private Data
****************************************************************************/
/* Map between ieee802154_addrmode_e enum and actual address length */
static const uint8_t mac802154_addr_length[4] =
{
0, 0, 2, 8
};
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: mac802154_get_mhrlen
*
* Description:
* Calculate the MAC header length given the frame meta-data.
*
****************************************************************************/
int mac802154_get_mhrlen(MACHANDLE mac,
FAR const struct ieee802154_frame_meta_s *meta)
{
FAR struct ieee802154_privmac_s *priv =
(FAR struct ieee802154_privmac_s *)mac;
int ret = 3; /* Always frame control (2 bytes) and seq. num (1 byte) */
/* Check to make sure both the dest address and the source address are not
* set to NONE
*/
if (meta->destaddr.mode == IEEE802154_ADDRMODE_NONE &&
meta->srcmode == IEEE802154_ADDRMODE_NONE)
{
return -EINVAL;
}
/* The source address can only be set to NONE
* if the device is the PAN coord
*/
if (meta->srcmode == IEEE802154_ADDRMODE_NONE &&
priv->devmode != IEEE802154_DEVMODE_PANCOORD)
{
return -EINVAL;
}
/* Add the destination address length */
ret += mac802154_addr_length[meta->destaddr.mode];
/* Add the source address length */
ret += mac802154_addr_length[meta->srcmode];
/* If both destination and source addressing information is present, the
* MAC sublayer shall compare the destination and source PAN identifiers.
* [1] pg. 41.
*/
if (meta->srcmode != IEEE802154_ADDRMODE_NONE &&
meta->destaddr.mode != IEEE802154_ADDRMODE_NONE)
{
/* If the PAN identifiers are identical, the PAN ID Compression field
* shall be set to one, and the source PAN identifier shall be omitted
* from the transmitted frame. [1] pg. 41.
*/
if (IEEE802154_PANIDCMP(meta->destaddr.panid, priv->addr.panid))
{
ret += 2; /* 2 bytes for destination PAN ID */
return ret;
}
}
/* If we are here, PAN ID compression is off, so include the dest and
* source PAN ID if the respective address is included
*/
if (meta->srcmode != IEEE802154_ADDRMODE_NONE)
{
ret += 2; /* 2 bytes for source PAN ID */
}
if (meta->destaddr.mode != IEEE802154_ADDRMODE_NONE)
{
ret += 2; /* 2 bytes for destination PAN ID */
}
return ret;
}
|
15bad7578b7ff3003238561832676babcf0903b0
|
58fe7cb3949dd1930e709696659a0296500b64a6
|
/tls/extensions/s2n_server_cookie.c
|
2be81eb5c28a62e1e9ea8ff8b3c4e4b24d258d87
|
[
"Apache-2.0",
"MIT"
] |
permissive
|
aws/s2n-tls
|
3344638a6a69c6f20665cf6847e1bc4b85f2e558
|
62dc7a6d4876e5eee0dea3690d528a4c7080a1d5
|
refs/heads/main
| 2023-08-31T23:26:33.780048
| 2023-08-31T05:17:33
| 2023-08-31T05:17:33
| 21,287,076
| 513
| 213
|
Apache-2.0
| 2023-09-13T23:52:29
| 2014-06-27T19:37:59
|
C
|
UTF-8
|
C
| false
| false
| 3,246
|
c
|
s2n_server_cookie.c
|
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 "tls/extensions/s2n_cookie.h"
#include "tls/s2n_tls.h"
#include "utils/s2n_random.h"
/*
*= https://tools.ietf.org/rfc/rfc8446#section-4.2.2
*# Cookies serve two primary purposes:
*#
*# - Allowing the server to force the client to demonstrate
*# reachability at their apparent network address (thus providing a
*# measure of DoS protection). This is primarily useful for
*# non-connection-oriented transports (see [RFC6347] for an example
*# of this).
*#
*# - Allowing the server to offload state to the client, thus allowing
*# it to send a HelloRetryRequest without storing any state. The
*# server can do this by storing the hash of the ClientHello in the
*# HelloRetryRequest cookie (protected with some suitable integrity
*# protection algorithm).
*#
*# When sending a HelloRetryRequest, the server MAY provide a "cookie"
*# extension to the client (this is an exception to the usual rule that
*# the only extensions that may be sent are those that appear in the
*# ClientHello).
*
* So our server does not send cookies in production,
* because it doesn't support DTLS and isn't stateless.
*
* However, we will sometimes send cookies for testing.
*/
static bool s2n_server_cookie_should_send(struct s2n_connection *conn)
{
return conn && conn->cookie.size > 0 && s2n_in_unit_test();
}
/*
*= https://tools.ietf.org/rfc/rfc8446#section-4.2.2
*# When sending the new ClientHello, the client MUST copy
*# the contents of the extension received in the HelloRetryRequest into
*# a "cookie" extension in the new ClientHello.
*
* Store the server's cookie for later use in the new ClientHello.
*/
static int s2n_server_cookie_recv(struct s2n_connection *conn, struct s2n_stuffer *extension)
{
POSIX_ENSURE_REF(conn);
/* This extension should only appear on the hello retry request extension list,
* but verify the retry anyway.
*/
POSIX_ENSURE(s2n_is_hello_retry_handshake(conn), S2N_ERR_UNSUPPORTED_EXTENSION);
uint16_t size = 0;
POSIX_GUARD(s2n_stuffer_read_uint16(extension, &size));
POSIX_ENSURE(s2n_stuffer_data_available(extension) >= size, S2N_ERR_BAD_MESSAGE);
POSIX_GUARD(s2n_realloc(&conn->cookie, size));
POSIX_GUARD(s2n_stuffer_read(extension, &conn->cookie));
return S2N_SUCCESS;
}
const s2n_extension_type s2n_server_cookie_extension = {
.iana_value = TLS_EXTENSION_COOKIE,
.minimum_version = S2N_TLS13,
.is_response = false,
.send = s2n_cookie_send,
.recv = s2n_server_cookie_recv,
.should_send = s2n_server_cookie_should_send,
.if_missing = s2n_extension_noop_if_missing,
};
|
15fc6cd152ae0f67c2447fff0fe1c8608a0b6b96
|
f4ea6db9183b38e0cb1af1d317b0a02db24455d1
|
/test/t-language/ti-private-struct2.c
|
532d4157065f64fb1c118c74b12f3f9ef37ae841
|
[
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] |
permissive
|
ldmud/ldmud
|
1446ff7101f5a47ee1dfa4cfb97d5a326f2edcce
|
f1cfc9a8d911412d854055058889bb32432da2db
|
refs/heads/master
| 2023-05-25T00:36:28.318383
| 2023-02-14T21:07:35
| 2023-02-18T10:20:44
| 1,085,012
| 124
| 71
|
NOASSERTION
| 2023-09-01T16:54:48
| 2010-11-16T12:13:17
|
C
|
UTF-8
|
C
| false
| false
| 94
|
c
|
ti-private-struct2.c
|
default private structs;
struct s
{
int member2;
};
public int|struct s sv2 = (<s> 42);
|
b2677d2f3ac3125a4a8fd26e802ba78911c64599
|
e8c76797b194bce6702adf9721a96c2b440efd5c
|
/test/time-sem.c
|
60e59826773bdfb8c32bb13c5c42ec4d0a099dc5
|
[
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain",
"Apache-2.0",
"LicenseRef-scancode-zeusbench",
"BSD-3-Clause",
"RSA-MD",
"LicenseRef-scancode-rsa-1990",
"Beerware",
"LicenseRef-scancode-other-permissive",
"Spencer-94",
"metamail",
"LicenseRef-scancode-rsa-md4",
"HPND-sell-variant"
] |
permissive
|
apache/httpd
|
86bfac3d6e2e9b48f5bfca5be7ec616fa9b14e9a
|
b9e029c8036fd036281ac266010db91aed6079b2
|
refs/heads/trunk
| 2023-09-04T07:18:59.681233
| 2023-08-30T12:56:11
| 2023-08-30T12:56:11
| 205,423
| 3,159
| 1,329
|
Apache-2.0
| 2023-09-11T13:50:41
| 2009-05-20T02:02:59
|
C
|
UTF-8
|
C
| false
| false
| 14,816
|
c
|
time-sem.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.
*/
/*
time-sem.c has the basics of the semaphores we use in http_main.c. It's
intended for timing differences between various methods on an
architecture. In practice we've found many things affect which semaphore
to be used:
- NFS filesystems absolutely suck for fcntl() and flock()
- uslock absolutely sucks on single-processor IRIX boxes, but
absolutely rocks on multi-processor boxes. The converse
is true for fcntl. sysvsem seems a moderate balance.
- Under Solaris you can't have too many processes use SEM_UNDO, there
might be a tuneable somewhere that increases the limit from 29.
We're not sure what the tunable is, so there's a define
NO_SEM_UNDO which can be used to simulate us trapping/blocking
signals to be able to properly release the semaphore on a clean
child death. You'll also need to define NEED_UNION_SEMUN
under solaris.
You'll need to define USE_SHMGET_SCOREBOARD if anonymous shared mmap()
doesn't work on your system (i.e. linux).
argv[1] is the #children, argv[2] is the #iterations per child
You should run each over many different #children inputs, and choose
#iter such that the program runs for at least a second or so... or even
longer depending on your patience.
compile with:
gcc -o time-FCNTL -Wall -O time-sem.c -DUSE_FCNTL_SERIALIZED_ACCEPT
gcc -o time-FLOCK -Wall -O time-sem.c -DUSE_FLOCK_SERIALIZED_ACCEPT
gcc -o time-SYSVSEM -Wall -O time-sem.c -DUSE_SYSVSEM_SERIALIZED_ACCEPT
gcc -o time-SYSVSEM2 -Wall -O time-sem.c -DUSE_SYSVSEM_SERIALIZED_ACCEPT -DNO_SEM_UNDO
gcc -o time-PTHREAD -Wall -O time-sem.c -DUSE_PTHREAD_SERIALIZED_ACCEPT -lpthread
gcc -o time-USLOCK -Wall -O time-sem.c -DUSE_USLOCK_SERIALIZED_ACCEPT
not all versions work on all systems.
*/
#include <errno.h>
#include <sys/time.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <sys/mman.h>
#include <signal.h>
#if defined(USE_FCNTL_SERIALIZED_ACCEPT)
static struct flock lock_it;
static struct flock unlock_it;
static int fcntl_fd=-1;
#define accept_mutex_child_init()
#define accept_mutex_cleanup()
/*
* Initialize mutex lock.
* Must be safe to call this on a restart.
*/
void
accept_mutex_init(void)
{
lock_it.l_whence = SEEK_SET; /* from current point */
lock_it.l_start = 0; /* -"- */
lock_it.l_len = 0; /* until end of file */
lock_it.l_type = F_WRLCK; /* set exclusive/write lock */
lock_it.l_pid = 0; /* pid not actually interesting */
unlock_it.l_whence = SEEK_SET; /* from current point */
unlock_it.l_start = 0; /* -"- */
unlock_it.l_len = 0; /* until end of file */
unlock_it.l_type = F_UNLCK; /* set exclusive/write lock */
unlock_it.l_pid = 0; /* pid not actually interesting */
printf("opening test-lock-thing in current directory\n");
fcntl_fd = open("test-lock-thing", O_CREAT | O_WRONLY | O_EXCL, 0644);
if (fcntl_fd == -1)
{
perror ("open");
fprintf (stderr, "Cannot open lock file: %s\n", "test-lock-thing");
exit (1);
}
unlink("test-lock-thing");
}
void accept_mutex_on(void)
{
int ret;
while ((ret = fcntl(fcntl_fd, F_SETLKW, &lock_it)) < 0 && errno == EINTR)
continue;
if (ret < 0) {
perror ("fcntl lock_it");
exit(1);
}
}
void accept_mutex_off(void)
{
if (fcntl (fcntl_fd, F_SETLKW, &unlock_it) < 0)
{
perror ("fcntl unlock_it");
exit(1);
}
}
#elif defined(USE_FLOCK_SERIALIZED_ACCEPT)
#include <sys/file.h>
static int flock_fd=-1;
#define FNAME "test-lock-thing"
/*
* Initialize mutex lock.
* Must be safe to call this on a restart.
*/
void accept_mutex_init(void)
{
printf("opening " FNAME " in current directory\n");
flock_fd = open(FNAME, O_CREAT | O_WRONLY | O_EXCL, 0644);
if (flock_fd == -1)
{
perror ("open");
fprintf (stderr, "Cannot open lock file: %s\n", "test-lock-thing");
exit (1);
}
}
void accept_mutex_child_init(void)
{
flock_fd = open(FNAME, O_WRONLY, 0600);
if (flock_fd == -1) {
perror("open");
exit(1);
}
}
void accept_mutex_cleanup(void)
{
unlink(FNAME);
}
void accept_mutex_on(void)
{
int ret;
while ((ret = flock(flock_fd, LOCK_EX)) < 0 && errno == EINTR)
continue;
if (ret < 0) {
perror ("flock(LOCK_EX)");
exit(1);
}
}
void accept_mutex_off(void)
{
if (flock (flock_fd, LOCK_UN) < 0)
{
perror ("flock(LOCK_UN)");
exit(1);
}
}
#elif defined (USE_SYSVSEM_SERIALIZED_ACCEPT)
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
static int sem_id = -1;
#ifdef NO_SEM_UNDO
static sigset_t accept_block_mask;
static sigset_t accept_previous_mask;
#endif
#define accept_mutex_child_init()
#define accept_mutex_cleanup()
void accept_mutex_init(void)
{
#ifdef NEED_UNION_SEMUN
/* believe it or not, you need to define this under solaris */
union semun {
int val;
struct semid_ds *buf;
ushort *array;
};
#endif
union semun ick;
sem_id = semget(999, 1, IPC_CREAT | 0666);
if (sem_id < 0) {
perror ("semget");
exit (1);
}
ick.val = 1;
if (semctl(sem_id, 0, SETVAL, ick) < 0) {
perror ("semctl");
exit(1);
}
#ifdef NO_SEM_UNDO
sigfillset(&accept_block_mask);
sigdelset(&accept_block_mask, SIGHUP);
sigdelset(&accept_block_mask, SIGTERM);
sigdelset(&accept_block_mask, SIGUSR1);
#endif
}
void accept_mutex_on()
{
struct sembuf op;
#ifdef NO_SEM_UNDO
if (sigprocmask(SIG_BLOCK, &accept_block_mask, &accept_previous_mask)) {
perror("sigprocmask(SIG_BLOCK)");
exit (1);
}
op.sem_flg = 0;
#else
op.sem_flg = SEM_UNDO;
#endif
op.sem_num = 0;
op.sem_op = -1;
if (semop(sem_id, &op, 1) < 0) {
perror ("accept_mutex_on");
exit (1);
}
}
void accept_mutex_off()
{
struct sembuf op;
op.sem_num = 0;
op.sem_op = 1;
#ifdef NO_SEM_UNDO
op.sem_flg = 0;
#else
op.sem_flg = SEM_UNDO;
#endif
if (semop(sem_id, &op, 1) < 0) {
perror ("accept_mutex_off");
exit (1);
}
#ifdef NO_SEM_UNDO
if (sigprocmask(SIG_SETMASK, &accept_previous_mask, NULL)) {
perror("sigprocmask(SIG_SETMASK)");
exit (1);
}
#endif
}
#elif defined (USE_PTHREAD_SERIALIZED_ACCEPT)
/* note: pthread mutexes aren't released on child death, hence the
* signal goop ... in a real implementation we'd do special things
* during hup, term, usr1.
*/
#include <pthread.h>
static pthread_mutex_t *mutex;
static sigset_t accept_block_mask;
static sigset_t accept_previous_mask;
#define accept_mutex_child_init()
#define accept_mutex_cleanup()
void accept_mutex_init(void)
{
pthread_mutexattr_t mattr;
int fd;
fd = open ("/dev/zero", O_RDWR);
if (fd == -1) {
perror ("open(/dev/zero)");
exit (1);
}
mutex = (pthread_mutex_t *)mmap ((caddr_t)0, sizeof (*mutex),
PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (mutex == (void *)(caddr_t)-1) {
perror ("mmap");
exit (1);
}
close (fd);
if (pthread_mutexattr_init(&mattr)) {
perror ("pthread_mutexattr_init");
exit (1);
}
if (pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED)) {
perror ("pthread_mutexattr_setpshared");
exit (1);
}
if (pthread_mutex_init(mutex, &mattr)) {
perror ("pthread_mutex_init");
exit (1);
}
sigfillset(&accept_block_mask);
sigdelset(&accept_block_mask, SIGHUP);
sigdelset(&accept_block_mask, SIGTERM);
sigdelset(&accept_block_mask, SIGUSR1);
}
void accept_mutex_on()
{
if (sigprocmask(SIG_BLOCK, &accept_block_mask, &accept_previous_mask)) {
perror("sigprocmask(SIG_BLOCK)");
exit (1);
}
if (pthread_mutex_lock (mutex)) {
perror ("pthread_mutex_lock");
exit (1);
}
}
void accept_mutex_off()
{
if (pthread_mutex_unlock (mutex)) {
perror ("pthread_mutex_unlock");
exit (1);
}
if (sigprocmask(SIG_SETMASK, &accept_previous_mask, NULL)) {
perror("sigprocmask(SIG_SETMASK)");
exit (1);
}
}
#elif defined (USE_USLOCK_SERIALIZED_ACCEPT)
#include <ulocks.h>
static usptr_t *us = NULL;
static ulock_t uslock = NULL;
#define accept_mutex_child_init()
#define accept_mutex_cleanup()
void accept_mutex_init(void)
{
ptrdiff_t old;
/* default is 8 */
#define CONF_INITUSERS_MAX 15
if ((old = usconfig(CONF_INITUSERS, CONF_INITUSERS_MAX)) == -1) {
perror("usconfig");
exit(-1);
}
if ((old = usconfig(CONF_LOCKTYPE, US_NODEBUG)) == -1) {
perror("usconfig");
exit(-1);
}
if ((old = usconfig(CONF_ARENATYPE, US_SHAREDONLY)) == -1) {
perror("usconfig");
exit(-1);
}
if ((us = usinit("/dev/zero")) == NULL) {
perror("usinit");
exit(-1);
}
if ((uslock = usnewlock(us)) == NULL) {
perror("usnewlock");
exit(-1);
}
}
void accept_mutex_on()
{
switch(ussetlock(uslock)) {
case 1:
/* got lock */
break;
case 0:
fprintf(stderr, "didn't get lock\n");
exit(-1);
case -1:
perror("ussetlock");
exit(-1);
}
}
void accept_mutex_off()
{
if (usunsetlock(uslock) == -1) {
perror("usunsetlock");
exit(-1);
}
}
#endif
#ifndef USE_SHMGET_SCOREBOARD
static void *get_shared_mem(apr_size_t size)
{
void *result;
/* allocate shared memory for the shared_counter */
result = (unsigned long *)mmap ((caddr_t)0, size,
PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
if (result == (void *)(caddr_t)-1) {
perror ("mmap");
exit (1);
}
return result;
}
#else
#include <sys/types.h>
#include <sys/ipc.h>
#ifdef HAVE_SYS_MUTEX_H
#include <sys/mutex.h>
#endif
#include <sys/shm.h>
static void *get_shared_mem(apr_size_t size)
{
key_t shmkey = IPC_PRIVATE;
int shmid = -1;
void *result;
#ifdef MOVEBREAK
char *obrk;
#endif
if ((shmid = shmget(shmkey, size, IPC_CREAT | SHM_R | SHM_W)) == -1) {
perror("shmget");
exit(1);
}
#ifdef MOVEBREAK
/*
* Some SysV systems place the shared segment WAY too close
* to the dynamic memory break point (sbrk(0)). This severely
* limits the use of malloc/sbrk in the program since sbrk will
* refuse to move past that point.
*
* To get around this, we move the break point "way up there",
* attach the segment and then move break back down. Ugly
*/
if ((obrk = sbrk(MOVEBREAK)) == (char *) -1) {
perror("sbrk");
}
#endif
#define BADSHMAT ((void *)(-1))
if ((result = shmat(shmid, 0, 0)) == BADSHMAT) {
perror("shmat");
}
/*
* We must avoid leaving segments in the kernel's
* (small) tables.
*/
if (shmctl(shmid, IPC_RMID, NULL) != 0) {
perror("shmctl(IPC_RMID)");
}
if (result == BADSHMAT) /* now bailout */
exit(1);
#ifdef MOVEBREAK
if (obrk == (char *) -1)
return; /* nothing else to do */
if (sbrk(-(MOVEBREAK)) == (char *) -1) {
perror("sbrk 2");
}
#endif
return result;
}
#endif
#ifdef _POSIX_PRIORITY_SCHEDULING
/* don't ask */
#define _P __P
#include <sched.h>
#define YIELD sched_yield()
#else
#define YIELD do { struct timeval zero; zero.tv_sec = zero.tv_usec = 0; select(0,0,0,0,&zero); } while(0)
#endif
void main (int argc, char **argv)
{
int num_iter;
int num_child;
int i;
struct timeval first;
struct timeval last;
long ms;
int pid;
unsigned long *shared_counter;
if (argc != 3) {
fprintf (stderr, "Usage: time-sem num-child num iter\n");
exit (1);
}
num_child = atoi (argv[1]);
num_iter = atoi (argv[2]);
/* allocate shared memory for the shared_counter */
shared_counter = get_shared_mem(sizeof(*shared_counter));
/* initialize counter to 0 */
*shared_counter = 0;
accept_mutex_init ();
/* parent grabs mutex until done spawning children */
accept_mutex_on ();
for (i = 0; i < num_child; ++i) {
pid = fork();
if (pid == 0) {
/* child, do our thing */
accept_mutex_child_init();
for (i = 0; i < num_iter; ++i) {
unsigned long tmp;
accept_mutex_on ();
tmp = *shared_counter;
YIELD;
*shared_counter = tmp + 1;
accept_mutex_off ();
}
exit (0);
} else if (pid == -1) {
perror ("fork");
accept_mutex_off ();
exit (1);
}
}
/* a quick test to see that nothing is screwed up */
if (*shared_counter != 0) {
puts ("WTF! shared_counter != 0 before the children have been started!");
accept_mutex_off ();
exit (1);
}
gettimeofday (&first, NULL);
/* launch children into action */
accept_mutex_off ();
for (i = 0; i < num_child; ++i) {
if (wait(NULL) == -1) {
perror ("wait");
}
}
gettimeofday (&last, NULL);
if (*shared_counter != num_child * num_iter) {
printf ("WTF! shared_counter != num_child * num_iter!\n"
"shared_counter = %lu\nnum_child = %d\nnum_iter=%d\n",
*shared_counter,
num_child, num_iter);
}
last.tv_sec -= first.tv_sec;
ms = last.tv_usec - first.tv_usec;
if (ms < 0) {
--last.tv_sec;
ms += 1000000;
}
last.tv_usec = ms;
printf ("%8lu.%06lu\n", last.tv_sec, last.tv_usec);
accept_mutex_cleanup();
exit(0);
}
|
d8faed4531abcab4ae75feeed21301d45b63b0fc
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
|
3bbbf74894872b140a1aef210315c4da10a4da48
|
[
"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,527
|
c
|
socrates_fpga_pic.c
|
/*
* Copyright (C) 2008 Ilya Yanok, Emcraft Systems
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/irq.h>
#include <linux/of_platform.h>
#include <linux/io.h>
/*
* The FPGA supports 9 interrupt sources, which can be routed to 3
* interrupt request lines of the MPIC. The line to be used can be
* specified through the third cell of FDT property "interrupts".
*/
#define SOCRATES_FPGA_NUM_IRQS 9
#define FPGA_PIC_IRQCFG (0x0)
#define FPGA_PIC_IRQMASK(n) (0x4 + 0x4 * (n))
#define SOCRATES_FPGA_IRQ_MASK ((1 << SOCRATES_FPGA_NUM_IRQS) - 1)
struct socrates_fpga_irq_info {
unsigned int irq_line;
int type;
};
/*
* Interrupt routing and type table
*
* IRQ_TYPE_NONE means the interrupt type is configurable,
* otherwise it's fixed to the specified value.
*/
static struct socrates_fpga_irq_info fpga_irqs[SOCRATES_FPGA_NUM_IRQS] = {
[0] = {0, IRQ_TYPE_NONE},
[1] = {0, IRQ_TYPE_LEVEL_HIGH},
[2] = {0, IRQ_TYPE_LEVEL_LOW},
[3] = {0, IRQ_TYPE_NONE},
[4] = {0, IRQ_TYPE_NONE},
[5] = {0, IRQ_TYPE_NONE},
[6] = {0, IRQ_TYPE_NONE},
[7] = {0, IRQ_TYPE_NONE},
[8] = {0, IRQ_TYPE_LEVEL_HIGH},
};
static DEFINE_RAW_SPINLOCK(socrates_fpga_pic_lock);
static void __iomem *socrates_fpga_pic_iobase;
static struct irq_domain *socrates_fpga_pic_irq_host;
static unsigned int socrates_fpga_irqs[3];
static inline uint32_t socrates_fpga_pic_read(int reg)
{
return in_be32(socrates_fpga_pic_iobase + reg);
}
static inline void socrates_fpga_pic_write(int reg, uint32_t val)
{
out_be32(socrates_fpga_pic_iobase + reg, val);
}
static inline unsigned int socrates_fpga_pic_get_irq(unsigned int irq)
{
uint32_t cause;
unsigned long flags;
int i;
/* Check irq line routed to the MPIC */
for (i = 0; i < 3; i++) {
if (irq == socrates_fpga_irqs[i])
break;
}
if (i == 3)
return NO_IRQ;
raw_spin_lock_irqsave(&socrates_fpga_pic_lock, flags);
cause = socrates_fpga_pic_read(FPGA_PIC_IRQMASK(i));
raw_spin_unlock_irqrestore(&socrates_fpga_pic_lock, flags);
for (i = SOCRATES_FPGA_NUM_IRQS - 1; i >= 0; i--) {
if (cause >> (i + 16))
break;
}
return irq_linear_revmap(socrates_fpga_pic_irq_host,
(irq_hw_number_t)i);
}
void socrates_fpga_pic_cascade(unsigned int irq, struct irq_desc *desc)
{
struct irq_chip *chip = irq_desc_get_chip(desc);
unsigned int cascade_irq;
/*
* See if we actually have an interrupt, call generic handling code if
* we do.
*/
cascade_irq = socrates_fpga_pic_get_irq(irq);
if (cascade_irq != NO_IRQ)
generic_handle_irq(cascade_irq);
chip->irq_eoi(&desc->irq_data);
}
static void socrates_fpga_pic_ack(struct irq_data *d)
{
unsigned long flags;
unsigned int irq_line, hwirq = irqd_to_hwirq(d);
uint32_t mask;
irq_line = fpga_irqs[hwirq].irq_line;
raw_spin_lock_irqsave(&socrates_fpga_pic_lock, flags);
mask = socrates_fpga_pic_read(FPGA_PIC_IRQMASK(irq_line))
& SOCRATES_FPGA_IRQ_MASK;
mask |= (1 << (hwirq + 16));
socrates_fpga_pic_write(FPGA_PIC_IRQMASK(irq_line), mask);
raw_spin_unlock_irqrestore(&socrates_fpga_pic_lock, flags);
}
static void socrates_fpga_pic_mask(struct irq_data *d)
{
unsigned long flags;
unsigned int hwirq = irqd_to_hwirq(d);
int irq_line;
u32 mask;
irq_line = fpga_irqs[hwirq].irq_line;
raw_spin_lock_irqsave(&socrates_fpga_pic_lock, flags);
mask = socrates_fpga_pic_read(FPGA_PIC_IRQMASK(irq_line))
& SOCRATES_FPGA_IRQ_MASK;
mask &= ~(1 << hwirq);
socrates_fpga_pic_write(FPGA_PIC_IRQMASK(irq_line), mask);
raw_spin_unlock_irqrestore(&socrates_fpga_pic_lock, flags);
}
static void socrates_fpga_pic_mask_ack(struct irq_data *d)
{
unsigned long flags;
unsigned int hwirq = irqd_to_hwirq(d);
int irq_line;
u32 mask;
irq_line = fpga_irqs[hwirq].irq_line;
raw_spin_lock_irqsave(&socrates_fpga_pic_lock, flags);
mask = socrates_fpga_pic_read(FPGA_PIC_IRQMASK(irq_line))
& SOCRATES_FPGA_IRQ_MASK;
mask &= ~(1 << hwirq);
mask |= (1 << (hwirq + 16));
socrates_fpga_pic_write(FPGA_PIC_IRQMASK(irq_line), mask);
raw_spin_unlock_irqrestore(&socrates_fpga_pic_lock, flags);
}
static void socrates_fpga_pic_unmask(struct irq_data *d)
{
unsigned long flags;
unsigned int hwirq = irqd_to_hwirq(d);
int irq_line;
u32 mask;
irq_line = fpga_irqs[hwirq].irq_line;
raw_spin_lock_irqsave(&socrates_fpga_pic_lock, flags);
mask = socrates_fpga_pic_read(FPGA_PIC_IRQMASK(irq_line))
& SOCRATES_FPGA_IRQ_MASK;
mask |= (1 << hwirq);
socrates_fpga_pic_write(FPGA_PIC_IRQMASK(irq_line), mask);
raw_spin_unlock_irqrestore(&socrates_fpga_pic_lock, flags);
}
static void socrates_fpga_pic_eoi(struct irq_data *d)
{
unsigned long flags;
unsigned int hwirq = irqd_to_hwirq(d);
int irq_line;
u32 mask;
irq_line = fpga_irqs[hwirq].irq_line;
raw_spin_lock_irqsave(&socrates_fpga_pic_lock, flags);
mask = socrates_fpga_pic_read(FPGA_PIC_IRQMASK(irq_line))
& SOCRATES_FPGA_IRQ_MASK;
mask |= (1 << (hwirq + 16));
socrates_fpga_pic_write(FPGA_PIC_IRQMASK(irq_line), mask);
raw_spin_unlock_irqrestore(&socrates_fpga_pic_lock, flags);
}
static int socrates_fpga_pic_set_type(struct irq_data *d,
unsigned int flow_type)
{
unsigned long flags;
unsigned int hwirq = irqd_to_hwirq(d);
int polarity;
u32 mask;
if (fpga_irqs[hwirq].type != IRQ_TYPE_NONE)
return -EINVAL;
switch (flow_type & IRQ_TYPE_SENSE_MASK) {
case IRQ_TYPE_LEVEL_HIGH:
polarity = 1;
break;
case IRQ_TYPE_LEVEL_LOW:
polarity = 0;
break;
default:
return -EINVAL;
}
raw_spin_lock_irqsave(&socrates_fpga_pic_lock, flags);
mask = socrates_fpga_pic_read(FPGA_PIC_IRQCFG);
if (polarity)
mask |= (1 << hwirq);
else
mask &= ~(1 << hwirq);
socrates_fpga_pic_write(FPGA_PIC_IRQCFG, mask);
raw_spin_unlock_irqrestore(&socrates_fpga_pic_lock, flags);
return 0;
}
static struct irq_chip socrates_fpga_pic_chip = {
.name = "FPGA-PIC",
.irq_ack = socrates_fpga_pic_ack,
.irq_mask = socrates_fpga_pic_mask,
.irq_mask_ack = socrates_fpga_pic_mask_ack,
.irq_unmask = socrates_fpga_pic_unmask,
.irq_eoi = socrates_fpga_pic_eoi,
.irq_set_type = socrates_fpga_pic_set_type,
};
static int socrates_fpga_pic_host_map(struct irq_domain *h, unsigned int virq,
irq_hw_number_t hwirq)
{
/* All interrupts are LEVEL sensitive */
irq_set_status_flags(virq, IRQ_LEVEL);
irq_set_chip_and_handler(virq, &socrates_fpga_pic_chip,
handle_fasteoi_irq);
return 0;
}
static int socrates_fpga_pic_host_xlate(struct irq_domain *h,
struct device_node *ct, const u32 *intspec, unsigned int intsize,
irq_hw_number_t *out_hwirq, unsigned int *out_flags)
{
struct socrates_fpga_irq_info *fpga_irq = &fpga_irqs[intspec[0]];
*out_hwirq = intspec[0];
if (fpga_irq->type == IRQ_TYPE_NONE) {
/* type is configurable */
if (intspec[1] != IRQ_TYPE_LEVEL_LOW &&
intspec[1] != IRQ_TYPE_LEVEL_HIGH) {
pr_warning("FPGA PIC: invalid irq type, "
"setting default active low\n");
*out_flags = IRQ_TYPE_LEVEL_LOW;
} else {
*out_flags = intspec[1];
}
} else {
/* type is fixed */
*out_flags = fpga_irq->type;
}
/* Use specified interrupt routing */
if (intspec[2] <= 2)
fpga_irq->irq_line = intspec[2];
else
pr_warning("FPGA PIC: invalid irq routing\n");
return 0;
}
static const struct irq_domain_ops socrates_fpga_pic_host_ops = {
.map = socrates_fpga_pic_host_map,
.xlate = socrates_fpga_pic_host_xlate,
};
void socrates_fpga_pic_init(struct device_node *pic)
{
unsigned long flags;
int i;
/* Setup an irq_domain structure */
socrates_fpga_pic_irq_host = irq_domain_add_linear(pic,
SOCRATES_FPGA_NUM_IRQS, &socrates_fpga_pic_host_ops, NULL);
if (socrates_fpga_pic_irq_host == NULL) {
pr_err("FPGA PIC: Unable to allocate host\n");
return;
}
for (i = 0; i < 3; i++) {
socrates_fpga_irqs[i] = irq_of_parse_and_map(pic, i);
if (socrates_fpga_irqs[i] == NO_IRQ) {
pr_warning("FPGA PIC: can't get irq%d.\n", i);
continue;
}
irq_set_chained_handler(socrates_fpga_irqs[i],
socrates_fpga_pic_cascade);
}
socrates_fpga_pic_iobase = of_iomap(pic, 0);
raw_spin_lock_irqsave(&socrates_fpga_pic_lock, flags);
socrates_fpga_pic_write(FPGA_PIC_IRQMASK(0),
SOCRATES_FPGA_IRQ_MASK << 16);
socrates_fpga_pic_write(FPGA_PIC_IRQMASK(1),
SOCRATES_FPGA_IRQ_MASK << 16);
socrates_fpga_pic_write(FPGA_PIC_IRQMASK(2),
SOCRATES_FPGA_IRQ_MASK << 16);
raw_spin_unlock_irqrestore(&socrates_fpga_pic_lock, flags);
pr_info("FPGA PIC: Setting up Socrates FPGA PIC\n");
}
|
505c564b89298d8a939a4b0ac247d7c0983e7730
|
03666e5f961946fc1a0ac67781ac1425562ef0d7
|
/src/gui/QvisKeyframeDelegate.C
|
74c1c66f33f8a774026dc987ee46d5e7bb302b33
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
visit-dav/visit
|
e9f81b4d4b9b9930a0db9d5282cd1bcabf465e2e
|
601ae46e0bef2e18425b482a755d03490ade0493
|
refs/heads/develop
| 2023-09-06T08:19:38.397058
| 2023-09-05T21:29:32
| 2023-09-05T21:29:32
| 165,565,988
| 335
| 120
|
BSD-3-Clause
| 2023-09-14T00:53:37
| 2019-01-13T23:27:26
|
C
|
UTF-8
|
C
| false
| false
| 9,735
|
c
|
QvisKeyframeDelegate.C
|
// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers. See the top-level LICENSE file for dates and other
// details. No copyright assignment is required to contribute to VisIt.
#include <QvisKeyframeDelegate.h>
#include <QPainter>
#include <QvisKeyframeWidget.h>
#include <QvisKeyframePlotRangeWidget.h>
#include <QvisKeyframeDrawer.h>
#include <KeyframeDataModel.h>
#include <KeyframeData.h>
// ****************************************************************************
// Method: QvisKeyframeDelegate::QvisKeyframeDelegate
//
// Purpose:
// Constructor.
//
// Arguments:
// parent : The object's parent.
//
// Programmer: Brad Whitlock
// Creation: Mon Nov 10 15:14:20 PST 2008
//
// Modifications:
//
// ****************************************************************************
QvisKeyframeDelegate::QvisKeyframeDelegate(QObject *parent) : QAbstractItemDelegate(parent)
{
drawer = new QvisKeyframeDrawer(this);
}
// ****************************************************************************
// Method: QvisKeyframeDelegate::~QvisKeyframeDelegate
//
// Purpose:
// Destructor.
//
// Programmer: Brad Whitlock
// Creation: Mon Nov 10 15:14:39 PST 2008
//
// Modifications:
//
// ****************************************************************************
QvisKeyframeDelegate::~QvisKeyframeDelegate()
{
}
// ****************************************************************************
// Method: QvisKeyframeDelegate::paint
//
// Purpose:
// This method paints the delegate. We get a little data from the model
// using the model index and use that to call drawing methods on our
// QvisKeyframeDrawer object that lets us share drawing code between the
// delegate and the widgets.
//
// Arguments:
// p : The painter to use.
// option : The style options to use.
// index : The model index of the data that we're drawing.
//
// Returns:
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Mon Nov 10 15:15:56 PST 2008
//
// Modifications:
//
// ****************************************************************************
void
QvisKeyframeDelegate::paint(QPainter *p, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
if (index.data().canConvert<PlotRangeData>())
{
PlotRangeData s = index.data().value<PlotRangeData>();
drawer->setCurrentIndex(s.currentIndex);
drawer->setNumFrames(s.numFrames);
drawer->drawPlotRange(p, option.rect, s.start, s.end);
}
else if(index.data().canConvert<KeyframePoints>())
{
KeyframePoints s = index.data().value<KeyframePoints>();
// Make a list of the valid points.
QList<int> pts;
for(QMap<int,int>::const_iterator it = s.idToIndex.begin();
it != s.idToIndex.end(); ++it)
if(it.value() != -1)
pts.append(it.value());
drawer->setCurrentIndex(s.currentIndex);
drawer->setNumFrames(s.numFrames);
if(delegateType(index) == KeyframeDataModel::CurrentFrameDelegate)
drawer->drawTimeHandle(p, option.rect, s.currentIndex);
else
{
bool diamond = delegateType(index) == KeyframeDataModel::PlotAttsDelegate;
drawer->drawPoints(p, option.rect, pts, diamond);
}
}
else
{
int currentIndex = index.data(KeyframeDataModel::CurrentIndexRole).toInt();
int numFrames = index.data(KeyframeDataModel::NumFramesRole).toInt();
drawer->setCurrentIndex(currentIndex);
drawer->setNumFrames(numFrames);
drawer->drawBackground(p, option.rect);
}
}
// ****************************************************************************
// Method: QvisKeyframeDelegate::sizeHint
//
// Purpose:
// Returns a size hint.
//
// Programmer: Brad Whitlock
// Creation: Mon Nov 10 15:17:56 PST 2008
//
// Modifications:
//
// ****************************************************************************
QSize
QvisKeyframeDelegate::sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
return QSize(200,20);
}
// ****************************************************************************
// Method: QvisKeyframeDelegate::createEditor
//
// Purpose:
// Creates an editor widget for the specified model index.
//
// Arguments:
// parent : The widget parent.
// option : The options to use.
// index : The model index containing the data that needs an editor.
//
// Returns: A new widget or 0.
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Mon Nov 10 15:18:16 PST 2008
//
// Modifications:
//
// ****************************************************************************
QWidget *
QvisKeyframeDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QWidget *w = 0;
if (index.data().canConvert<PlotRangeData>())
{
QvisKeyframePlotRangeWidget *edit = new QvisKeyframePlotRangeWidget(parent);
edit->setDrawer(drawer);
connect(edit, SIGNAL(commit(QWidget *)),
this, SIGNAL(commitData(QWidget *)));
w = edit;
}
else if(index.data().canConvert<KeyframePoints>())
{
QvisKeyframeWidget *edit = new QvisKeyframeWidget(parent);
edit->setDrawer(drawer);
if(delegateType(index) == KeyframeDataModel::PlotAttsDelegate)
edit->setPointStyle(QvisKeyframeWidget::Point_Diamond);
else if(delegateType(index) == KeyframeDataModel::CurrentFrameDelegate)
edit->setPointStyle(QvisKeyframeWidget::Point_Time);
connect(edit, SIGNAL(commit(QWidget *)),
this, SIGNAL(commitData(QWidget *)));
w = edit;
}
return w;
}
// ****************************************************************************
// Method: QvisKeyframeDelegate::updateEditorGeometry
//
// Purpose:
// This method resizes the editor widget to the size of the delegate.
//
// Arguments:
// editor : The editor widget.
// option : The options to use (includes rect)
// index : The model index.
//
// Programmer: Brad Whitlock
// Creation: Mon Nov 10 15:19:19 PST 2008
//
// Modifications:
//
// ****************************************************************************
void
QvisKeyframeDelegate::updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option, const QModelIndex &index) const
{
editor->setGeometry(option.rect);
}
// ****************************************************************************
// Method: QvisKeyframeDelegate::setEditorData
//
// Purpose:
// This method data from the data model into the editor widget.
//
// Arguments:
// editor : The editor widget.
// index : The model index that will provide the data.
//
// Programmer: Brad Whitlock
// Creation: Mon Nov 10 15:20:11 PST 2008
//
// Modifications:
//
// ****************************************************************************
void
QvisKeyframeDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
if (index.data().canConvert<PlotRangeData>())
{
PlotRangeData s = index.data().value<PlotRangeData>();
QvisKeyframePlotRangeWidget *edit = (QvisKeyframePlotRangeWidget *)editor;
drawer->setCurrentIndex(s.currentIndex);
drawer->setNumFrames(s.numFrames);
edit->setData(s.start, s.end);
}
else if(index.data().canConvert<KeyframePoints>())
{
KeyframePoints s = index.data().value<KeyframePoints>();
QvisKeyframeWidget *edit = (QvisKeyframeWidget *)editor;
drawer->setCurrentIndex(s.currentIndex);
drawer->setNumFrames(s.numFrames);
edit->setData(s.idToIndex);
}
}
// ****************************************************************************
// Method: QvisKeyframeDelegate::setModelData
//
// Purpose:
// This method puts widget data back into the data model.
//
// Arguments:
// editor : The editor widget.
// model : The model that will accept the data.
// index : The model index that will accept the new data from the widget.
//
// Programmer: Brad Whitlock
// Creation: Mon Nov 10 15:21:33 PST 2008
//
// Modifications:
//
// ****************************************************************************
void
QvisKeyframeDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
if (index.data().canConvert<PlotRangeData>())
{
PlotRangeData s(index.data().value<PlotRangeData>());
QvisKeyframePlotRangeWidget *edit = (QvisKeyframePlotRangeWidget *)editor;
edit->getData(s.start, s.end);
model->setData(index, QVariant::fromValue(s));
}
else if (index.data().canConvert<KeyframePoints>())
{
KeyframePoints s(index.data().value<KeyframePoints>());
QvisKeyframeWidget *edit = (QvisKeyframeWidget *)editor;
edit->getData(s.idToIndex);
model->setData(index, QVariant::fromValue(s));
}
}
// ****************************************************************************
// Method: QvisKeyframeDelegate::delegateType
//
// Purpose:
// Returns the delegate type for the specified model index.
//
// Arguments:
// index : The model index.
//
// Returns: The delegate type for the specified model index.
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Mon Nov 10 15:22:41 PST 2008
//
// Modifications:
//
// ****************************************************************************
int
QvisKeyframeDelegate::delegateType(const QModelIndex &index) const
{
return index.data(KeyframeDataModel::DelegateTypeRole).toInt();
}
|
35aabe49d5ef1d20a5d1d49951745d8fadf2e86f
|
90b45421155e34002fd133c7939d1f3bbb1173ff
|
/src/libs6/s6lockd_openandlock.c
|
ca51934d15f67561b6ae80b9cf8a35eb3df745f0
|
[
"ISC"
] |
permissive
|
skarnet/s6
|
6ac71ec910f7d8a40bcd1e668eae3eaf6fab98df
|
1cbe4b09e027e31d258c24feee0be46958888b93
|
refs/heads/master
| 2023-08-18T08:02:16.943355
| 2023-08-10T15:42:00
| 2023-08-10T15:42:00
| 31,460,641
| 724
| 48
|
ISC
| 2020-06-26T11:56:36
| 2015-02-28T11:26:29
|
C
|
UTF-8
|
C
| false
| false
| 798
|
c
|
s6lockd_openandlock.c
|
/* ISC license. */
#include <errno.h>
#include <skalibs/strerr.h>
#include <skalibs/djbunix.h>
#include "s6lockd.h"
int s6lockd_openandlock (char const *file, int ex, int nb)
{
int fd, r ;
if (ex)
{
fd = open_create(file) ;
if (fd < 0) strerr_diefu3sys(111, "open ", file, " for writing") ;
}
else
{
fd = open_read(file) ;
if (fd < 0)
{
if (errno != ENOENT) strerr_diefu3sys(111, "open ", file, " for reading") ;
fd = open_create(file) ;
if (fd < 0) strerr_diefu2sys(111, "create ", file) ;
fd_close(fd) ;
fd = open_read(file) ;
if (fd < 0) strerr_diefu3sys(111, "open ", file, " for reading") ;
}
}
r = fd_lock(fd, ex, nb) ;
if (!r) errno = EBUSY ;
if (r < 1) strerr_diefu2sys(1, "lock ", file) ;
return fd ;
}
|
1d81cb9bc5ccb0e123a93c93f9e06a80f64c074c
|
f25847541dd3dd87d42d78eba81a351b72a4d0af
|
/h264/include/h264-sps.h
|
9e87fca78479ca52429c2b23fff4fdaf7c6b016e
|
[
"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
| 2,212
|
h
|
h264-sps.h
|
#ifndef _h264_sps_h_
#define _h264_sps_h_
#include "h264-vui.h"
#include <inttypes.h>
#include <stdint.h>
#include <stddef.h>
struct h264_sps_t
{
uint8_t profile_idc;
uint8_t constraint_set_flag;
uint8_t level_idc;
uint8_t seq_parameter_set_id; // [0, 31]
uint8_t chroma_format_idc; // 0-4:0:0, 1-4:2:0, 2-4:2:2, 3-4:4:4, defalut: 1, see more: Table 6-1 p42
struct { // profile_idc=[100, 110, 122, 244, 44, 83, 86, 118, 128, 138, 139, 134]
uint8_t separate_colour_plane_flag; // bool
uint8_t bit_depth_luma_minus8; // [0, 6]
uint8_t bit_depth_chroma_minus8; // [0, 6]
uint8_t qpprime_y_zero_transform_bypass_flag; // bool
uint8_t seq_scaling_matrix_present_flag; // bool
//if( seq_scaling_matrix_present_flag ) {
uint8_t seq_scaling_list_present_flag[12]; // bool
uint8_t UseDefaultScalingMatrix4x4Flag[6]; // bool
uint8_t UseDefaultScalingMatrix8x8Flag[6]; // bool
int32_t ScalingList4x4[6][16];
int32_t ScalingList8x8[6][64];
//}
} chroma;
uint8_t log2_max_frame_num_minus4; // [0, 12]
uint8_t pic_order_cnt_type; // [0, 2]
uint8_t log2_max_pic_order_cnt_lsb_minus4; // [0, 12]
uint8_t delta_pic_order_always_zero_flag; // bool
int32_t offset_for_non_ref_pic;
int32_t offset_for_top_to_bottom_field;
uint8_t num_ref_frames_in_pic_order_cnt_cycle; // [0, 255]
int32_t offset_for_ref_frame[64];
uint32_t max_num_ref_frames; // [0, MaxDpbFrames]
uint8_t gaps_in_frame_num_value_allowed_flag; // bool
uint32_t pic_width_in_mbs_minus1;
uint32_t pic_height_in_map_units_minus1;
uint8_t frame_mbs_only_flag; // bool
uint8_t mb_adaptive_frame_field_flag; // bool
uint8_t direct_8x8_inference_flag; // bool
uint8_t frame_cropping_flag; // bool
struct {
int32_t frame_crop_left_offset;
int32_t frame_crop_right_offset;
int32_t frame_crop_top_offset;
int32_t frame_crop_bottom_offset;
} frame_cropping;
uint8_t vui_parameters_present_flag; // bool
struct h264_vui_t vui;
};
int h264_sps_parse(const void* data, uint32_t bytes, struct h264_sps_t* sps);
int h264_codec_rect(const struct h264_sps_t* sps, int* x, int *y, int *w, int *h);
int h264_display_rect(const struct h264_sps_t* sps, int* x, int *y, int *w, int *h);
#endif /* !_h264_sps_h_ */
|
533e055354845f441c4cec9240af95841cb0587a
|
fbdc48c28e54fb33ae4842ef95ff63893902c99a
|
/src/omv/common/usbdbg.c
|
cabc0ecf9e32c4b9dce0fbbac1d87465fe9b2604
|
[
"MIT"
] |
permissive
|
openmv/openmv
|
44d4b79fc8693950a2e330e5e0fd95b5c36e230f
|
8a90e070a88b7fc14c87a00351b9c4a213278419
|
refs/heads/master
| 2023-08-30T20:59:57.227603
| 2023-08-23T16:50:55
| 2023-08-23T16:50:55
| 14,360,940
| 2,150
| 1,226
|
MIT
| 2023-09-14T07:18:15
| 2013-11-13T10:23:44
|
C
|
UTF-8
|
C
| false
| false
| 13,328
|
c
|
usbdbg.c
|
/*
* This file is part of the OpenMV project.
*
* Copyright (c) 2013-2021 Ibrahim Abdelkader <iabdalkader@openmv.io>
* Copyright (c) 2013-2021 Kwabena W. Agyeman <kwagyeman@openmv.io>
*
* This work is licensed under the MIT license, see the file LICENSE for details.
*
* USB debugger.
*/
#include <string.h>
#include <stdio.h>
#include "py/nlr.h"
#include "py/gc.h"
#include "py/mphal.h"
#include "py/obj.h"
#include "py/objstr.h"
#include "py/runtime.h"
#include "pendsv.h"
#include "imlib.h"
#if MICROPY_PY_SENSOR
#include "omv_i2c.h"
#include "sensor.h"
#endif
#include "framebuffer.h"
#include "ff.h"
#include "usbdbg.h"
#include "omv_boardconfig.h"
#include "py_image.h"
static int xfer_bytes;
static int xfer_length;
static enum usbdbg_cmd cmd;
static volatile bool script_ready;
static volatile bool script_running;
static volatile bool irq_enabled;
static vstr_t script_buf;
static mp_obj_exception_t ide_exception;
static const MP_DEFINE_STR_OBJ(ide_exception_msg, "IDE interrupt");
static const mp_rom_obj_tuple_t ide_exception_args_obj = {
{&mp_type_tuple}, 1, {MP_ROM_PTR(&ide_exception_msg)}
};
// These functions must be implemented in MicroPython CDC driver.
extern uint32_t usb_cdc_buf_len();
extern uint32_t usb_cdc_get_buf(uint8_t *buf, uint32_t len);
void __attribute__((weak)) usb_cdc_reset_buffers() {
}
void usbdbg_init() {
cmd = USBDBG_NONE;
script_ready = false;
script_running = false;
irq_enabled = false;
vstr_init(&script_buf, 32);
// Initialize the IDE exception object.
ide_exception.base.type = &mp_type_Exception;
ide_exception.traceback_alloc = 0;
ide_exception.traceback_len = 0;
ide_exception.traceback_data = NULL;
ide_exception.args = (mp_obj_tuple_t *) &ide_exception_args_obj;
}
void usbdbg_wait_for_command(uint32_t timeout) {
for (mp_uint_t ticks = mp_hal_ticks_ms();
irq_enabled && ((mp_hal_ticks_ms() - ticks) < timeout) && (cmd != USBDBG_NONE); ) {
;
}
}
bool usbdbg_script_ready() {
return script_ready;
}
vstr_t *usbdbg_get_script() {
return &script_buf;
}
bool usbdbg_is_busy() {
return cmd != USBDBG_NONE;
}
void usbdbg_set_script_running(bool running) {
script_running = running;
}
inline void usbdbg_set_irq_enabled(bool enabled) {
if (enabled) {
NVIC_EnableIRQ(OMV_USB_IRQN);
} else {
NVIC_DisableIRQ(OMV_USB_IRQN);
}
__DSB(); __ISB();
irq_enabled = enabled;
}
static void usbdbg_interrupt_vm(bool ready) {
// Set script ready flag
script_ready = ready;
// Set script running flag
script_running = ready;
// Disable IDE IRQ (re-enabled by pyexec or main).
usbdbg_set_irq_enabled(false);
// Clear interrupt traceback
mp_obj_exception_clear_traceback(&ide_exception);
// Remove the BASEPRI masking (if any)
__set_BASEPRI(0);
// Interrupt running REPL
// Note: setting pendsv explicitly here because the VM is probably
// waiting in REPL and the soft interrupt flag will not be checked.
pendsv_nlr_jump(&ide_exception);
}
bool usbdbg_get_irq_enabled() {
return irq_enabled;
}
void usbdbg_data_in(void *buffer, int length) {
switch (cmd) {
case USBDBG_FW_VERSION: {
uint32_t *ver_buf = buffer;
ver_buf[0] = FIRMWARE_VERSION_MAJOR;
ver_buf[1] = FIRMWARE_VERSION_MINOR;
ver_buf[2] = FIRMWARE_VERSION_PATCH;
cmd = USBDBG_NONE;
break;
}
case USBDBG_TX_BUF_LEN: {
uint32_t tx_buf_len = usb_cdc_buf_len();
memcpy(buffer, &tx_buf_len, sizeof(tx_buf_len));
cmd = USBDBG_NONE;
break;
}
case USBDBG_SENSOR_ID: {
int sensor_id = 0xFF;
#if MICROPY_PY_SENSOR
if (sensor_is_detected() == true) {
sensor_id = sensor_get_id();
}
#endif
memcpy(buffer, &sensor_id, 4);
cmd = USBDBG_NONE;
break;
}
case USBDBG_TX_BUF: {
xfer_bytes += usb_cdc_get_buf(buffer, length);
if (xfer_bytes == xfer_length) {
cmd = USBDBG_NONE;
}
break;
}
case USBDBG_FRAME_SIZE:
// Return 0 if FB is locked or not ready.
((uint32_t *) buffer)[0] = 0;
// Try to lock FB. If header size == 0 frame is not ready
if (mutex_try_lock_alternate(&JPEG_FB()->lock, MUTEX_TID_IDE)) {
// If header size == 0 frame is not ready
if (JPEG_FB()->size == 0) {
// unlock FB
mutex_unlock(&JPEG_FB()->lock, MUTEX_TID_IDE);
} else {
// Return header w, h and size/bpp
((uint32_t *) buffer)[0] = JPEG_FB()->w;
((uint32_t *) buffer)[1] = JPEG_FB()->h;
((uint32_t *) buffer)[2] = JPEG_FB()->size;
}
}
cmd = USBDBG_NONE;
break;
case USBDBG_FRAME_DUMP:
if (xfer_bytes < xfer_length) {
memcpy(buffer, JPEG_FB()->pixels + xfer_bytes, length);
xfer_bytes += length;
if (xfer_bytes == xfer_length) {
cmd = USBDBG_NONE;
JPEG_FB()->w = 0; JPEG_FB()->h = 0; JPEG_FB()->size = 0;
mutex_unlock(&JPEG_FB()->lock, MUTEX_TID_IDE);
}
}
break;
case USBDBG_ARCH_STR: {
unsigned int uid[3] = {
#if (OMV_UNIQUE_ID_SIZE == 2)
0U,
#else
*((unsigned int *) (OMV_UNIQUE_ID_ADDR + OMV_UNIQUE_ID_OFFSET * 2)),
#endif
*((unsigned int *) (OMV_UNIQUE_ID_ADDR + OMV_UNIQUE_ID_OFFSET * 1)),
*((unsigned int *) (OMV_UNIQUE_ID_ADDR + OMV_UNIQUE_ID_OFFSET * 0)),
};
snprintf((char *) buffer, 64, "%s [%s:%08X%08X%08X]",
OMV_ARCH_STR, OMV_BOARD_TYPE, uid[0], uid[1], uid[2]);
cmd = USBDBG_NONE;
break;
}
case USBDBG_SCRIPT_RUNNING: {
uint32_t *buf = buffer;
buf[0] = (uint32_t) script_running;
cmd = USBDBG_NONE;
break;
}
default: /* error */
break;
}
}
void usbdbg_data_out(void *buffer, int length) {
switch (cmd) {
case USBDBG_FB_ENABLE: {
uint32_t enable = *((int32_t *) buffer);
JPEG_FB()->enabled = enable;
if (enable == 0) {
// When disabling framebuffer, the IDE might still be holding FB lock.
// If the IDE is not the current lock owner, this operation is ignored.
mutex_unlock(&JPEG_FB()->lock, MUTEX_TID_IDE);
}
cmd = USBDBG_NONE;
break;
}
case USBDBG_SCRIPT_EXEC:
// check if GC is locked before allocating memory for vstr. If GC was locked
// at least once before the script is fully uploaded xfer_bytes will be less
// than the total length (xfer_length) and the script will Not be executed.
if (!script_running) {
nlr_buf_t nlr;
if (!gc_is_locked() && nlr_push(&nlr) == 0) {
vstr_add_strn(&script_buf, buffer, length);
nlr_pop();
}
xfer_bytes += length;
if (xfer_bytes == xfer_length) {
cmd = USBDBG_NONE;
// Schedule the IDE exception to interrupt the VM.
usbdbg_interrupt_vm(true);
}
}
break;
case USBDBG_TEMPLATE_SAVE: {
#if defined(IMLIB_ENABLE_IMAGE_FILE_IO)
image_t image;
framebuffer_init_image(&image);
// null terminate the path
length = (length == 64) ? 63:length;
((char *) buffer)[length] = 0;
rectangle_t *roi = (rectangle_t *) buffer;
char *path = (char *) buffer + sizeof(rectangle_t);
imlib_save_image(&image, path, roi, 50);
// raise a flash IRQ to flush image
//NVIC->STIR = FLASH_IRQn;
#endif //IMLIB_ENABLE_IMAGE_FILE_IO
break;
}
case USBDBG_DESCRIPTOR_SAVE: {
#if defined(IMLIB_ENABLE_IMAGE_FILE_IO) \
&& defined(IMLIB_ENABLE_KEYPOINTS)
image_t image;
framebuffer_init_image(&image);
// null terminate the path
length = (length == 64) ? 63:length;
((char *) buffer)[length] = 0;
rectangle_t *roi = (rectangle_t *) buffer;
char *path = (char *) buffer + sizeof(rectangle_t);
py_image_descriptor_from_roi(&image, path, roi);
#endif //IMLIB_ENABLE_IMAGE_FILE_IO && IMLIB_ENABLE_KEYPOINTS
cmd = USBDBG_NONE;
break;
}
case USBDBG_ATTR_WRITE: {
#if MICROPY_PY_SENSOR
/* write sensor attribute */
int32_t attr = *((int32_t *) buffer);
int32_t val = *((int32_t *) buffer + 1);
switch (attr) {
case ATTR_CONTRAST:
sensor_set_contrast(val);
break;
case ATTR_BRIGHTNESS:
sensor_set_brightness(val);
break;
case ATTR_SATURATION:
sensor_set_saturation(val);
break;
case ATTR_GAINCEILING:
sensor_set_gainceiling(val);
break;
default:
break;
}
#endif
cmd = USBDBG_NONE;
break;
}
case USBDBG_SET_TIME: {
// TODO implement
#if 0
uint32_t *timebuf = (uint32_t *) buffer;
timebuf[0]; // Year
timebuf[1]; // Month
timebuf[2]; // Day
timebuf[3]; // Day of the week
timebuf[4]; // Hour
timebuf[5]; // Minute
timebuf[6]; // Second
timebuf[7]; // Milliseconds
#endif
cmd = USBDBG_NONE;
break;
}
case USBDBG_TX_INPUT: {
// TODO implement
#if 0
uint32_t key = *((uint32_t *) buffer);
#endif
cmd = USBDBG_NONE;
break;
}
default: /* error */
break;
}
}
void usbdbg_control(void *buffer, uint8_t request, uint32_t length) {
cmd = (enum usbdbg_cmd) request;
switch (cmd) {
case USBDBG_FW_VERSION:
xfer_bytes = 0;
xfer_length = length;
break;
case USBDBG_FRAME_SIZE:
xfer_bytes = 0;
xfer_length = length;
break;
case USBDBG_FRAME_DUMP:
xfer_bytes = 0;
xfer_length = length;
break;
case USBDBG_ARCH_STR:
xfer_bytes = 0;
xfer_length = length;
break;
case USBDBG_SCRIPT_EXEC:
xfer_bytes = 0;
xfer_length = length;
vstr_reset(&script_buf);
break;
case USBDBG_SCRIPT_STOP:
if (script_running) {
// Reset CDC buffers.
usb_cdc_reset_buffers();
// Schedule the IDE exception to interrupt the VM.
usbdbg_interrupt_vm(false);
}
cmd = USBDBG_NONE;
break;
case USBDBG_SCRIPT_SAVE:
// TODO: save running script
cmd = USBDBG_NONE;
break;
case USBDBG_SCRIPT_RUNNING:
xfer_bytes = 0;
xfer_length = length;
break;
case USBDBG_TEMPLATE_SAVE:
case USBDBG_DESCRIPTOR_SAVE:
/* save template */
xfer_bytes = 0;
xfer_length = length;
break;
case USBDBG_ATTR_WRITE:
xfer_bytes = 0;
xfer_length = length;
break;
case USBDBG_SYS_RESET:
NVIC_SystemReset();
break;
case USBDBG_SYS_RESET_TO_BL: {
#if defined(MICROPY_BOARD_ENTER_BOOTLOADER)
MICROPY_BOARD_ENTER_BOOTLOADER(0, 0);
#else
NVIC_SystemReset();
#endif
break;
}
case USBDBG_FB_ENABLE: {
xfer_bytes = 0;
xfer_length = length;
break;
}
case USBDBG_TX_BUF:
case USBDBG_TX_BUF_LEN:
xfer_bytes = 0;
xfer_length = length;
break;
case USBDBG_SENSOR_ID:
xfer_bytes = 0;
xfer_length = length;
break;
case USBDBG_SET_TIME:
xfer_bytes = 0;
xfer_length = length;
break;
case USBDBG_TX_INPUT:
xfer_bytes = 0;
xfer_length = length;
break;
default: /* error */
cmd = USBDBG_NONE;
break;
}
}
|
ec2dd7805dc8007bb713eac1acaca6c1b3fd14c6
|
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
|
/lib/libc/include/any-linux-any/linux/pktcdvd.h
|
f83ce90f9a2e0e74769d30ec7a6194a50347c063
|
[
"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
| 2,686
|
h
|
pktcdvd.h
|
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright (C) 2000 Jens Axboe <axboe@suse.de>
* Copyright (C) 2001-2004 Peter Osterlund <petero2@telia.com>
*
* May be copied or modified under the terms of the GNU General Public
* License. See linux/COPYING for more information.
*
* Packet writing layer for ATAPI and SCSI CD-R, CD-RW, DVD-R, and
* DVD-RW devices.
*
*/
#ifndef __PKTCDVD_H
#define __PKTCDVD_H
#include <linux/types.h>
/*
* 1 for normal debug messages, 2 is very verbose. 0 to turn it off.
*/
#define PACKET_DEBUG 1
#define MAX_WRITERS 8
#define PKT_RB_POOL_SIZE 512
/*
* How long we should hold a non-full packet before starting data gathering.
*/
#define PACKET_WAIT_TIME (HZ * 5 / 1000)
/*
* use drive write caching -- we need deferred error handling to be
* able to successfully recover with this option (drive will return good
* status as soon as the cdb is validated).
*/
#if defined(CONFIG_CDROM_PKTCDVD_WCACHE)
#define USE_WCACHING 1
#else
#define USE_WCACHING 0
#endif
/*
* No user-servicable parts beyond this point ->
*/
/*
* device types
*/
#define PACKET_CDR 1
#define PACKET_CDRW 2
#define PACKET_DVDR 3
#define PACKET_DVDRW 4
/*
* flags
*/
#define PACKET_WRITABLE 1 /* pd is writable */
#define PACKET_NWA_VALID 2 /* next writable address valid */
#define PACKET_LRA_VALID 3 /* last recorded address valid */
#define PACKET_MERGE_SEGS 4 /* perform segment merging to keep */
/* underlying cdrom device happy */
/*
* Disc status -- from READ_DISC_INFO
*/
#define PACKET_DISC_EMPTY 0
#define PACKET_DISC_INCOMPLETE 1
#define PACKET_DISC_COMPLETE 2
#define PACKET_DISC_OTHER 3
/*
* write type, and corresponding data block type
*/
#define PACKET_MODE1 1
#define PACKET_MODE2 2
#define PACKET_BLOCK_MODE1 8
#define PACKET_BLOCK_MODE2 10
/*
* Last session/border status
*/
#define PACKET_SESSION_EMPTY 0
#define PACKET_SESSION_INCOMPLETE 1
#define PACKET_SESSION_RESERVED 2
#define PACKET_SESSION_COMPLETE 3
#define PACKET_MCN "4a656e734178626f65323030300000"
#undef PACKET_USE_LS
#define PKT_CTRL_CMD_SETUP 0
#define PKT_CTRL_CMD_TEARDOWN 1
#define PKT_CTRL_CMD_STATUS 2
struct pkt_ctrl_command {
__u32 command; /* in: Setup, teardown, status */
__u32 dev_index; /* in/out: Device index */
__u32 dev; /* in/out: Device nr for cdrw device */
__u32 pkt_dev; /* in/out: Device nr for packet device */
__u32 num_devices; /* out: Largest device index + 1 */
__u32 padding; /* Not used */
};
/*
* packet ioctls
*/
#define PACKET_IOCTL_MAGIC ('X')
#define PACKET_CTRL_CMD _IOWR(PACKET_IOCTL_MAGIC, 1, struct pkt_ctrl_command)
#endif /* __PKTCDVD_H */
|
00690ba9e5cc5608db828e3629d02309b4eb6c01
|
baa9fffc817a2a993d4ecc774d3f277783308c20
|
/src/ucp/core/ucp_types.h
|
cb13672cf905b94e726797cc3d111f9288667208
|
[
"BSD-3-Clause"
] |
permissive
|
openucx/ucx
|
9a0f2205295afbdf3cff14b5d24af781b123f5ea
|
73a48700badb7cbace64d94b82f408e2a26fca32
|
refs/heads/master
| 2023-09-01T16:51:26.913950
| 2023-09-01T13:02:25
| 2023-09-01T13:02:25
| 25,379,390
| 966
| 420
|
NOASSERTION
| 2023-09-14T12:29:35
| 2014-10-17T22:17:24
|
C
|
UTF-8
|
C
| false
| false
| 8,868
|
h
|
ucp_types.h
|
/**
* Copyright (c) NVIDIA CORPORATION & AFFILIATES, 2001-2017. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
#ifndef UCP_TYPES_H_
#define UCP_TYPES_H_
#include <ucp/api/ucp.h>
#include <ucs/type/float8.h>
#include <uct/api/uct.h>
#include <ucs/datastruct/bitmap.h>
#include <ucs/sys/preprocessor.h>
#include <ucs/sys/math.h>
#include <stdint.h>
/* Typedef by number of bits */
#define UCP_UINT_TYPE(_bits) typedef UCS_PP_TOKENPASTE3(uint, _bits, _t)
#define UCP_WORKER_ADDRESS_NAME_MAX 32 /* Worker address name for debugging */
#define UCP_MIN_BCOPY 64 /* Minimal size for bcopy */
#define UCP_FEATURE_AMO (UCP_FEATURE_AMO32|UCP_FEATURE_AMO64)
/* Resources */
#define UCP_MAX_RESOURCES 128
#define UCP_NULL_RESOURCE ((ucp_rsc_index_t)-1)
typedef uint8_t ucp_rsc_index_t;
/* MDs */
#define UCP_MD_INDEX_BITS 64 /* How many bits are in MD index */
typedef ucp_rsc_index_t ucp_md_index_t;
#define UCP_MAX_MDS ((UCP_MD_INDEX_BITS < UCP_MAX_RESOURCES) ? \
UCP_MD_INDEX_BITS : UCP_MAX_RESOURCES)
UCP_UINT_TYPE(UCP_MD_INDEX_BITS) ucp_md_map_t;
/* Lanes */
#define UCP_MAX_LANES 16
#define UCP_MAX_FAST_PATH_LANES 5
#define UCP_MAX_SLOW_PATH_LANES (UCP_MAX_LANES - UCP_MAX_FAST_PATH_LANES)
#define UCP_NULL_LANE ((ucp_lane_index_t)-1)
typedef uint8_t ucp_lane_index_t;
UCP_UINT_TYPE(UCP_MAX_LANES) ucp_lane_map_t;
/* System devices */
#define UCP_MAX_SYS_DEVICES 64
UCP_UINT_TYPE(UCP_MAX_SYS_DEVICES) ucp_sys_dev_map_t;
/* Worker configuration index for endpoint and rkey */
typedef uint8_t ucp_worker_cfg_index_t;
#define UCP_WORKER_MAX_EP_CONFIG UINT8_MAX
#define UCP_WORKER_MAX_RKEY_CONFIG 128
#define UCP_WORKER_CFG_INDEX_NULL UINT8_MAX
/* Forward declarations */
typedef struct ucp_request ucp_request_t;
typedef struct ucp_recv_desc ucp_recv_desc_t;
typedef struct ucp_address_iface_attr ucp_address_iface_attr_t;
typedef struct ucp_address_entry ucp_address_entry_t;
typedef struct ucp_unpacked_address ucp_unpacked_address_t;
typedef struct ucp_wireup_ep ucp_wireup_ep_t;
typedef struct ucp_request_send_proto ucp_request_send_proto_t;
typedef struct ucp_worker_iface ucp_worker_iface_t;
typedef struct ucp_worker_cm ucp_worker_cm_t;
typedef struct ucp_rma_proto ucp_rma_proto_t;
typedef struct ucp_amo_proto ucp_amo_proto_t;
typedef struct ucp_ep_config ucp_ep_config_t;
typedef struct ucp_ep_config_key ucp_ep_config_key_t;
typedef struct ucp_rkey_config_key ucp_rkey_config_key_t;
typedef struct ucp_proto ucp_proto_t;
typedef struct ucp_mem_desc ucp_mem_desc_t;
/**
* UCP TL bitmap
*
* Bitmap type for representing which TL resources are in use.
*/
typedef ucs_bitmap_t(UCP_MAX_RESOURCES) ucp_tl_bitmap_t;
/**
* Max possible value of TL bitmap (all bits are 1)
*/
extern const ucp_tl_bitmap_t ucp_tl_bitmap_max;
/**
* Min possible value of TL bitmap (all bits are 0)
*/
extern const ucp_tl_bitmap_t ucp_tl_bitmap_min;
#define UCT_TL_BITMAP_FMT "0x%lx 0x%lx"
#define UCT_TL_BITMAP_ARG(_bitmap) (_bitmap)->bits[0], (_bitmap)->bits[1]
/**
* Perform bitwise AND on a TL bitmap and a negation of a bitmap and return the result
*
* @param _bitmap1 First operand
* @param _bitmap2 Second operand
*
* @return A new bitmap, which is the logical AND NOT of the operands
*/
#define UCP_TL_BITMAP_AND_NOT(_bitmap1, _bitmap2) \
UCS_BITMAP_AND(_bitmap1, UCS_BITMAP_NOT(_bitmap2, UCP_MAX_RESOURCES), \
UCP_MAX_RESOURCES)
/* Pack bandwidth as bytes/second, range: 512 MB/s to 4 TB/s */
UCS_FP8_DECLARE_TYPE(BANDWIDTH, 512 * UCS_MBYTE, 4 * UCS_TBYTE)
/* Pack latency as nanoseconds, range: 16 nsec to 131 usec */
UCS_FP8_DECLARE_TYPE(LATENCY, UCS_BIT(4), UCS_BIT(17))
/* Pack overhead as nanoseconds, range: 1 nsec to 4 usec */
UCS_FP8_DECLARE_TYPE(OVERHEAD, UCS_BIT(0), UCS_BIT(12))
/**
* Operation for which protocol is selected
*/
typedef enum {
UCP_OP_ID_TAG_SEND,
UCP_OP_ID_TAG_SEND_SYNC,
UCP_OP_ID_AM_SEND,
UCP_OP_ID_AM_SEND_REPLY,
UCP_OP_ID_STREAM_SEND,
UCP_OP_ID_PUT,
UCP_OP_ID_GET,
UCP_OP_ID_AMO_POST,
UCP_OP_ID_AMO_FETCH,
UCP_OP_ID_AMO_CSWAP,
UCP_OP_ID_API_LAST,
/* Internal rendezvous operations */
UCP_OP_ID_RNDV_FIRST = UCP_OP_ID_API_LAST,
UCP_OP_ID_RNDV_SEND = UCP_OP_ID_RNDV_FIRST,
UCP_OP_ID_RNDV_RECV,
UCP_OP_ID_RNDV_RECV_DROP,
UCP_OP_ID_RNDV_LAST,
UCP_OP_ID_LAST = UCP_OP_ID_RNDV_LAST
} ucp_operation_id_t;
/**
* Active message codes
*/
typedef enum {
UCP_AM_ID_FIRST = 1, /* First valid AM ID */
UCP_AM_ID_WIREUP = UCP_AM_ID_FIRST, /* Connection establishment */
UCP_AM_ID_EAGER_ONLY = 2, /* Single packet eager TAG */
UCP_AM_ID_EAGER_FIRST = 3, /* First eager fragment */
UCP_AM_ID_EAGER_MIDDLE = 4, /* Middle eager fragment */
UCP_AM_ID_EAGER_SYNC_ONLY = 6, /* Single packet eager-sync */
UCP_AM_ID_EAGER_SYNC_FIRST = 7, /* First eager-sync fragment */
UCP_AM_ID_EAGER_SYNC_ACK = 8, /* Eager-sync acknowledge */
UCP_AM_ID_RNDV_RTS = 9, /* Ready-to-Send to init rendezvous */
UCP_AM_ID_RNDV_ATS = 10, /* Ack-to-Send after finishing a get operation */
UCP_AM_ID_RNDV_RTR = 11, /* Ready-to-Receive rendezvous for a receiver
with a generic datatype */
UCP_AM_ID_RNDV_DATA = 12, /* Rndv data fragments when using software
rndv (bcopy) */
UCP_AM_ID_OFFLOAD_SYNC_ACK = 14, /* Eager sync ack for tag offload proto */
UCP_AM_ID_STREAM_DATA = 15, /* Eager STREAM packet */
UCP_AM_ID_RNDV_ATP = 16, /* Ack-to-put complete after finishing a put_zcopy */
UCP_AM_ID_PUT = 17, /* Remote memory write */
UCP_AM_ID_GET_REQ = 18, /* Remote memory read request */
UCP_AM_ID_GET_REP = 19, /* Remote memory read reply */
UCP_AM_ID_ATOMIC_REQ = 20, /* Remote memory atomic request */
UCP_AM_ID_ATOMIC_REP = 21, /* Remote memory atomic reply */
UCP_AM_ID_CMPL = 22, /* Remote memory operation completion */
UCP_AM_ID_AM_SINGLE = 23, /* Single fragment user defined AM */
UCP_AM_ID_AM_FIRST = 24, /* First fragment of user defined AM */
UCP_AM_ID_AM_MIDDLE = 25, /* Middle or last fragment of user
defined AM */
UCP_AM_ID_AM_SINGLE_REPLY = 26, /* Single fragment user defined AM
carrying remote ep for reply */
UCP_AM_ID_LAST
} ucp_am_id_t;
/**
* Atomic operations mode.
*/
typedef enum {
UCP_ATOMIC_MODE_CPU, /* Use CPU-based atomics */
UCP_ATOMIC_MODE_DEVICE, /* Use device-based atomics */
UCP_ATOMIC_MODE_GUESS, /* If all transports support CPU AMOs only (no DEVICE),
* the CPU is selected, otherwise DEVICE is selected */
UCP_ATOMIC_MODE_LAST
} ucp_atomic_mode_t;
/**
* Fence mode.
*/
typedef enum {
UCP_FENCE_MODE_WEAK, /* Use weak fence mode */
UCP_FENCE_MODE_STRONG, /* Use strong fence mode */
UCP_FENCE_MODE_AUTO, /* Automatically detect fence mode */
UCP_FENCE_MODE_LAST
} ucp_fence_mode_t;
/**
* Communication scheme in RNDV protocol.
*/
typedef enum {
UCP_RNDV_MODE_AUTO, /* Runtime automatically chooses optimal scheme to use */
UCP_RNDV_MODE_GET_ZCOPY, /* Use get_zcopy scheme in RNDV protocol */
UCP_RNDV_MODE_PUT_ZCOPY, /* Use put_zcopy scheme in RNDV protocol */
UCP_RNDV_MODE_GET_PIPELINE, /* Use pipelined get_zcopy scheme in RNDV protocol */
UCP_RNDV_MODE_PUT_PIPELINE, /* Use pipelined put_zcopy scheme in RNDV protocol */
UCP_RNDV_MODE_AM, /* Use active-messages based RNDV protocol */
UCP_RNDV_MODE_RKEY_PTR, /* Use rkey_ptr in RNDV protocol */
UCP_RNDV_MODE_LAST
} ucp_rndv_mode_t;
/* Versions enumeration used for various UCP objects (e.g. ucp worker address,
* sockaddr data structure, etc).
*/
typedef enum {
UCP_OBJECT_VERSION_V1,
UCP_OBJECT_VERSION_V2,
UCP_OBJECT_VERSION_LAST
} ucp_object_version_t;
/**
* Active message tracer.
*/
typedef void (*ucp_am_tracer_t)(ucp_worker_h worker, uct_am_trace_type_t type,
uint8_t id, const void *data, size_t length,
char *buffer, size_t max);
/**
* Internal callback for UCP requests
*/
typedef void (*ucp_request_callback_t)(ucp_request_t *req);
#endif
|
f2c0fb023f9157b809e6611cc4388d3a17ec87b6
|
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
|
/sys/arch/powerpc/booke/dev/pq3ehci.c
|
b8d5056d30b5a80fcb1d6ebcb1dd9753c64d62df
|
[] |
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
| 5,945
|
c
|
pq3ehci.c
|
/* $NetBSD: pq3ehci.c,v 1.12 2021/08/07 16:19:02 thorpej Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* 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: pq3ehci.c,v 1.12 2021/08/07 16:19:02 thorpej Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/bus.h>
#include <powerpc/booke/cpuvar.h>
#include <powerpc/booke/e500var.h>
#include <powerpc/booke/e500reg.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdivar.h>
#include <dev/usb/usb_mem.h>
#include <dev/usb/ehcireg.h>
#include <dev/usb/ehcivar.h>
/*
* This is relative to the start of the unreserved registers in USB controller
* block and not the full USB block which would be 0x1a8.
*/
#define PQ3_USBMODE 0xa8 /* USB mode */
#define USBMODE_CM __BITS(0,1) /* Controller Mode */
#define USBMODE_CM_IDLE __SHIFTIN(0,USBMODE_CM) /* Idle (both) */
#define USBMODE_CM_DEVICE __SHIFTIN(2,USBMODE_CM) /* Device Controller */
#define USBMODE_CM_HOST __SHIFTIN(3,USBMODE_CM) /* Host Controller */
#ifdef EHCI_DEBUG
#define DPRINTF(x) if (ehcidebug) printf x
extern int ehcidebug;
#else
#define DPRINTF(x)
#endif
static int pq3ehci_match(device_t, cfdata_t, void *);
static void pq3ehci_attach(device_t, device_t, void *);
struct pq3ehci_softc {
ehci_softc_t sc;
void *sc_ih; /* interrupt vectoring */
};
static void pq3ehci_init(struct ehci_softc *);
CFATTACH_DECL_NEW(pq3ehci, sizeof(struct pq3ehci_softc),
pq3ehci_match, pq3ehci_attach, NULL, NULL);
static int
pq3ehci_match(device_t parent, cfdata_t cf, void *aux)
{
if (!e500_cpunode_submatch(parent, cf, cf->cf_name, aux))
return 0;
return 1;
}
static void
pq3ehci_attach(device_t parent, device_t self, void *aux)
{
struct cpunode_softc * const psc = device_private(parent);
struct pq3ehci_softc * const sc = device_private(self);
struct cpunode_attach_args * const cna = aux;
struct cpunode_locators * const cnl = &cna->cna_locs;
int error;
psc->sc_children |= cna->cna_childmask;
sc->sc.iot = cna->cna_le_memt; /* EHCI registers are little endian */
sc->sc.sc_dev = self;
sc->sc.sc_bus.ub_dmatag = cna->cna_dmat;
sc->sc.sc_bus.ub_hcpriv = sc;
sc->sc.sc_bus.ub_revision = USBREV_2_0;
sc->sc.sc_ncomp = 0;
sc->sc.sc_flags |= EHCIF_ETTF;
sc->sc.sc_vendor_init = pq3ehci_init;
aprint_naive(": USB controller\n");
aprint_normal(": USB controller\n");
error = bus_space_map(sc->sc.iot, cnl->cnl_addr, cnl->cnl_size, 0,
&sc->sc.ioh);
if (error) {
aprint_error_dev(self,
"can't map registers for %s#%u: %d\n",
cnl->cnl_name, cnl->cnl_instance, error);
return;
}
sc->sc.sc_size = cnl->cnl_size;
/*
* We need to tell the USB interface to snoop all off RAM starting
* at 0. Since it can do it by powers of 2, get the highest RAM
* address and roughly round it to the next power of 2 and find
* the number of leading zero bits.
*/
cpu_write_4(cnl->cnl_addr + USB_SNOOP1,
SNOOP_2GB - __builtin_clz(curcpu()->ci_softc->cpu_highmem * 2 - 1));
cpu_write_4(cnl->cnl_addr + USB_CONTROL, USB_EN);
sc->sc_ih = intr_establish(cnl->cnl_intrs[0], IPL_USB, IST_ONCHIP,
ehci_intr, sc);
if (sc->sc_ih == NULL) {
aprint_error_dev(self, "failed to establish interrupt %d\n",
cnl->cnl_intrs[0]);
goto fail;
}
aprint_normal_dev(self, "interrupting on irq %d\n",
cnl->cnl_intrs[0]);
/* offs is needed for EOWRITEx */
sc->sc.sc_offs = EREAD1(&sc->sc, EHCI_CAPLENGTH);
/* Disable interrupts, so we don't get any spurious ones. */
DPRINTF(("%s: offs=%d\n", device_xname(self), sc->sc.sc_offs));
EOWRITE4(&sc->sc, EHCI_USBINTR, 0);
error = ehci_init(&sc->sc);
if (error) {
aprint_error_dev(self, "init failed, error=%d\n", error);
goto fail;
}
/* Attach usb device. */
sc->sc.sc_child = config_found(self, &sc->sc.sc_bus, usbctlprint,
CFARGS_NONE);
return;
fail:
if (sc->sc_ih) {
intr_disestablish(sc->sc_ih);
sc->sc_ih = NULL;
}
if (sc->sc.sc_size) {
bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
sc->sc.sc_size = 0;
}
return;
}
static void
pq3ehci_init(struct ehci_softc *hsc)
{
uint32_t old = bus_space_read_4(hsc->iot, hsc->ioh, PQ3_USBMODE);
uint32_t reg = old;
reg &= ~USBMODE_CM;
reg |= USBMODE_CM_HOST;
if (reg != old)
bus_space_write_4(hsc->iot, hsc->ioh, PQ3_USBMODE, reg);
}
|
76beeead1f22c022695dba4bd2d4e595f9634542
|
2b6a4eddac65e3712d0d06f3a0262dae6253263e
|
/Source/src/WixSharp.Samples/Wix_bin/SDK/inc/jsonutil.h
|
b05e997043b838e3f6e39f80c0b101466216519b
|
[
"MIT"
] |
permissive
|
oleg-shilo/wixsharp
|
6005721bb7607b7060b99d6e4f5569b3404ca63d
|
7601893a5e9e14408ce9ef63415290d5c56254a6
|
refs/heads/master
| 2023-08-24T07:45:11.137770
| 2023-07-22T10:50:56
| 2023-07-22T10:50:56
| 49,761,249
| 976
| 245
|
MIT
| 2023-07-22T10:50:57
| 2016-01-16T05:51:01
|
C#
|
UTF-8
|
C
| false
| false
| 2,115
|
h
|
jsonutil.h
|
#pragma once
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
#ifdef __cplusplus
extern "C" {
#endif
typedef enum JSON_TOKEN
{
JSON_TOKEN_NONE,
JSON_TOKEN_ARRAY_START,
JSON_TOKEN_ARRAY_VALUE,
JSON_TOKEN_ARRAY_END,
JSON_TOKEN_OBJECT_START,
JSON_TOKEN_OBJECT_KEY,
JSON_TOKEN_OBJECT_VALUE,
JSON_TOKEN_OBJECT_END,
JSON_TOKEN_VALUE,
} JSON_TOKEN;
typedef struct _JSON_VALUE
{
} JSON_VALUE;
typedef struct _JSON_READER
{
CRITICAL_SECTION cs;
LPWSTR sczJson;
LPWSTR pwz;
JSON_TOKEN token;
} JSON_READER;
typedef struct _JSON_WRITER
{
CRITICAL_SECTION cs;
LPWSTR sczJson;
JSON_TOKEN* rgTokenStack;
DWORD cTokens;
DWORD cMaxTokens;
} JSON_WRITER;
DAPI_(HRESULT) JsonInitializeReader(
__in_z LPCWSTR wzJson,
__in JSON_READER* pReader
);
DAPI_(void) JsonUninitializeReader(
__in JSON_READER* pReader
);
DAPI_(HRESULT) JsonReadNext(
__in JSON_READER* pReader,
__out JSON_TOKEN* pToken,
__out JSON_VALUE* pValue
);
DAPI_(HRESULT) JsonReadValue(
__in JSON_READER* pReader,
__in JSON_VALUE* pValue
);
DAPI_(HRESULT) JsonInitializeWriter(
__in JSON_WRITER* pWriter
);
DAPI_(void) JsonUninitializeWriter(
__in JSON_WRITER* pWriter
);
DAPI_(HRESULT) JsonWriteBool(
__in JSON_WRITER* pWriter,
__in BOOL fValue
);
DAPI_(HRESULT) JsonWriteNumber(
__in JSON_WRITER* pWriter,
__in DWORD dwValue
);
DAPI_(HRESULT) JsonWriteString(
__in JSON_WRITER* pWriter,
__in_z LPCWSTR wzValue
);
DAPI_(HRESULT) JsonWriteArrayStart(
__in JSON_WRITER* pWriter
);
DAPI_(HRESULT) JsonWriteArrayEnd(
__in JSON_WRITER* pWriter
);
DAPI_(HRESULT) JsonWriteObjectStart(
__in JSON_WRITER* pWriter
);
DAPI_(HRESULT) JsonWriteObjectKey(
__in JSON_WRITER* pWriter,
__in_z LPCWSTR wzKey
);
DAPI_(HRESULT) JsonWriteObjectEnd(
__in JSON_WRITER* pWriter
);
#ifdef __cplusplus
}
#endif
|
c3c38ed21c2e503a7c197023bcb875247f412226
|
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
|
/lib/libc/wasi/libc-bottom-half/cloudlibc/src/libc/sys/select/select.c
|
ebe5e8c656eb61e8d86c17d4315768646b3636a9
|
[
"MIT",
"LLVM-exception",
"Apache-2.0",
"NCSA",
"BSD-2-Clause"
] |
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
| 763
|
c
|
select.c
|
// Copyright (c) 2015 Nuxi, https://nuxi.nl/
//
// SPDX-License-Identifier: BSD-2-Clause
#include <sys/select.h>
#include <errno.h>
#include <stddef.h>
int select(int nfds, fd_set *restrict readfds, fd_set *restrict writefds,
fd_set *restrict errorfds, struct timeval *restrict timeout) {
if (timeout != NULL) {
// Timeout specified.
if (timeout->tv_usec < 0 || timeout->tv_usec >= 1000000) {
errno = EINVAL;
return -1;
}
struct timespec ts = {.tv_sec = timeout->tv_sec,
.tv_nsec = (long)timeout->tv_usec * 1000};
return pselect(nfds, readfds, writefds, errorfds, &ts, NULL);
} else {
// No timeout specified.
return pselect(nfds, readfds, writefds, errorfds, NULL, NULL);
}
}
|
5283c23066028febf0dd31d947292247b319ff35
|
a5a99f646e371b45974a6fb6ccc06b0a674818f2
|
/OnlineDB/CSCCondDB/test/xTalkMacro.C
|
18fa5b6139efe9face2808984a5e93e732d1ab94
|
[
"Apache-2.0"
] |
permissive
|
cms-sw/cmssw
|
4ecd2c1105d59c66d385551230542c6615b9ab58
|
19c178740257eb48367778593da55dcad08b7a4f
|
refs/heads/master
| 2023-08-23T21:57:42.491143
| 2023-08-22T20:22:40
| 2023-08-22T20:22:40
| 10,969,551
| 1,006
| 3,696
|
Apache-2.0
| 2023-09-14T19:14:28
| 2013-06-26T14:09:07
|
C++
|
UTF-8
|
C
| false
| false
| 53,131
|
c
|
xTalkMacro.C
|
void xTalkMacro(){
//proccess in batch mode. this takes a VERY long time out of batch mode
gROOT->SetBatch();
//contains several functions used in other macros as well
gROOT->ProcessLine(".L GenFuncMacro.C");
//get myFile. this is for batch processecing
//copies the name of any file beginning with "c" from the /tmp/csccalib directory.
char *myFileName; //new file name for directory name
char *myFilePath; //for accessing file by root
void *dirp = gSystem->OpenDirectory("/tmp/csccalib"); //read tmp directory
char *afile; //temp file name
while(afile = gSystem->GetDirEntry(dirp)) { //parse directory
char *bfile[0] = afile[0]; //new temp file name
if (bfile[0]=='c') { //if file begins with c
printf("file: %s\n",afile); //check name
myFileName = afile; //set for out of scope processing
}
myFilePath = Form("/tmp/csccalib/%s", myFileName);
}
//set global parameters
int nDDU = 1;
int nCham = 1; //set default to one chamber, recalculates later
int nLayer = 6; //may as well be hardcoded
//style-ize all canvases
gStyle->SetCanvasColor(0);
gStyle->SetPadColor(0);
gStyle->SetPadBorderMode(0);
gStyle->SetCanvasBorderMode(0);
gStyle->SetFrameBorderMode(0);
gStyle->SetStatH(0.2);
gStyle->SetStatW(0.3);
//see GenFuncMacro.C
directoryCheck();
std::cout << "opening: " << myFileName << std::endl;
TFile *myFile = TFile::Open(myFilePath);
//get number of chambers per DDU, don't save graph. reatains value for NEntires.
TCanvas *ChamberEntryCanvas = new TCanvas("ChamberDummyCanvas", "ChamberDummyCanvas");
TH1F *ChamberEntryGraph = new TH1F ("ChamberGraph", "ChamberGraph",480,0,480);
ChamberEntryCanvas->cd();
Calibration->Draw("cham>>ChamberGraph");
int NEntries = ChamberEntryGraph->GetEntries();
//calculate the number of chambers
nCham = (NEntries/480);
std::cout << "number of chambers is: " << nCham << std::endl;
//make sure it doesn't crash if the file is empty
if (nCham == 0){
std::cout << "no chambers, quitting." << std::endl;
gROOT->ProcessLine(".q");
}
/*
//check that file has the right number of events. if not, don't process it!!!
TCanvas *canv_pulseCheck = new TCanvas("EventCheckCanv","EventCheckCanv",1100,700); ;
TH2F *pulseCheck = (TH2F*)myFile->Get("pulse01");
canv_pulseCheck->cd();
pulseCheck->Draw();
int NPulses = pulseCheck->GetEntries();
//this "9" might have to be changed (at some point) to the varialbe nCham, if the graphs are filled differently
int NEvents = (NPulses/9);
std::cout << "number of events is: " << NEvents << std::endl;
if (NEvents != 320) {
std::cout << "wrong number of events! file " << myFileName << " is not being processed." << std::endl;
gROOT->ProcessLine(".q");
}
*/
//this is one big section of linux directory processing
//if this is edited, be careful! it's easy to mess up.
gSystem->cd("/afs/cern.ch/cms/CSC/html/csccalib/");
//see GenFuncMacro.C
makeDirectory("images");
gSystem->cd("images");
//create subdirectory Crosstalk
makeDirectory("Crosstalk");
//open file generated from analyzer
gSystem->cd("../");
//create folder for this run
gSystem->cd("images/Crosstalk/");
makeDirectory(myFileName);
gSystem->cd(myFileName);
///this is a bit ridiculous, but if this graph is not drawn, chamberID's cannot
///cannot be accessed. The graph does not need to be kept.
TCanvas *Maxdummy = new TCanvas("Maxdummy", "Maxdummy");
Maxdummy->Divide(1,2);
Maxdummy->cd(1);
Calibration->Draw("MaxPed");
Maxdummy->cd(2);
Calibration->Draw("MaxRMS");
gSystem->cd("../../../");
//create pedestal flag graphs
pedRMSFlagGraph(myFileName, myFilePath);
//create all pedestal RMS
gStyle->SetOptStat(0);
pedRMSGraphs(nDDU,nCham,nLayer, myFileName, myFilePath);
//create all pedestal MEAN graphs
pedMeanGraphs(nDDU,nCham,nLayer, myFileName, myFilePath);
gStyle->SetOptStat(1);
//create noise graphs
pedNoiseFlagGraph(myFileName, myFilePath);
//create CrossTalk pulse graphs
gSystem->cd("/afs/cern.ch/user/c/csccalib/scratch0/CMSSW_1_5_1/src/OnlineDB/CSCCondDB/test");
std::cout << "now in : " << gSystem->pwd() << std::endl;
//PeakGraphs(myFileName, myFilePath, nCham);
myFile->Close();
myFilePath = Form("/tmp/csccalib/%s", myFileName);
std::cout << "just before PulseGraphs" << std::endl;
std::cout << " fileName: " << myFileName << std::endl;
std::cout << " filePath: " << myFilePath << std::endl;
PulseGraphs(myFileName, myFilePath);
gROOT->ProcessLine(".q");
}
//proper usage:
// int idArray[9];
// GetChamberIDs(idArray);
// std::cout << "id for chamber 0: " << idArray[0] << std::endl;
void GetChamberIDs(int IDArray[9]){
TCanvas *IDcanv = new TCanvas ("idGraph", "idGraph");
IDcanv->cd();
TH1F *idDummy = new TH1F("idDummy", "idDummy", 480, 111000, 250000);
idDummy->Draw();
for (int chamber=0; chamber<9; ++chamber){
TString idCut = Form ("cham==%d", chamber);
Calibration->Project("idDummy", "id", idCut);
Int_t idNum = idDummy->GetMean();
IDArray[chamber]=idNum;
}
idDummy->Draw();
}
void pedRMSGraphs(int nDDU, int nCham, int nLayer, TString myFileName, TString myFilePath){
gSystem->cd("images/Crosstalk");
gSystem->cd(myFileName);
makeDirectory("pedRMSGraphs");
gSystem->cd("pedRMSGraphs");
makeDirectory("pedRMSStrips");
makeDirectory("pedRMSLayerMean");
//create rms canvas arrays
TObjArray CANV_PEDRMS_STRIP_ARRAY(nCham*nDDU);
TObjArray CANV_PEDRMS_MEAN_ARRAY(nCham*nDDU);
//create rms lines for comparison to standards
//warning levels are guesses based on other work
TLine *horiz_low_pedrms = new TLine(0,0,80,0);
TLine *horiz_high_pedrms = new TLine(0,5,80,5);
TLine *vert_low_pedrms = new TLine(5, 0, 5, 200);
TLine *vert_high_pedrms = new TLine(0, 0, 0, 200);
horiz_low_pedrms->SetLineStyle(3);//dotted
horiz_high_pedrms->SetLineStyle(3);
vert_low_pedrms->SetLineStyle(3);
vert_high_pedrms->SetLineStyle(3);
horiz_low_pedrms->SetLineColor(6);//red
horiz_low_pedrms->SetLineWidth(2);//visible but not overwhelming width
horiz_high_pedrms->SetLineColor(6);
horiz_high_pedrms->SetLineWidth(2);
vert_low_pedrms->SetLineColor(6);
vert_low_pedrms->SetLineWidth(2);
vert_high_pedrms->SetLineColor(6);
vert_high_pedrms->SetLineWidth(2);
//Ideally, cha would take nDDU*nCham as it's argument,and lay would take nDDU*nCham*nLay.
//But ROOT doesn't like having a varialbe there, so it is created at it's largest useful value.
TH1F *cha[480];
TH2F *lay[2880];
//loop over all DDU's
for(int i=0; i<nDDU; ++i){
int idArray[9];
GetChamberIDs(idArray);
//loop over each chamber in a given DDU
for (int j=0; j<nCham; ++j){
gStyle->SetMarkerStyle(20);
gStyle->SetMarkerSize(0.8);
//get the chamber ID number
Int_t chamber_id_int = idArray[j];
//get the max RMS value for the chamber
Float_t chamber_maxRMSval = Calibration->GetLeaf("MaxRMS")->GetValue(j);
Float_t chamber_axisMax = chamber_maxRMSval + (.1)*chamber_maxRMSval;
if (chamber_axisMax < 5.5){
chamber_axisMax = 5.5;
}
//RMS mean Canvases
TString CANV_PEDRMS_MEAN_NAME = Form("ChamberID_%d_RMS", chamber_id_int);
TCanvas* canv_rms1 ;
canv_rms1 = new TCanvas(CANV_PEDRMS_MEAN_NAME,CANV_PEDRMS_MEAN_NAME, 200, 10, 1200, 800);
canv_rms1->SetCanvasSize(1200,800);
//add to this array, for out-of-scope acess
CANV_PEDRMS_MEAN_ARRAY.Add(canv_rms1);
//RMS strip Canvases
TString CANV_PEDRMS_STRIP_NAME = Form("ChamberID_%d_RMS_per_Layer", chamber_id_int);
TCanvas* canv_rms2;
canv_rms2 = new TCanvas(CANV_PEDRMS_STRIP_NAME,CANV_PEDRMS_STRIP_NAME, 200, 10, 1200, 800);
canv_rms2->SetCanvasSize(1200,800);
canv_rms2->Divide(2,3);
CANV_PEDRMS_STRIP_ARRAY.Add(canv_rms2);
//create, fill and draw overall RMS graphs
int chamber_access_int =( (nCham*i)+ j);
//this access one of the (*TH1F's) initialized outside the DDU loop
TString hist_name= Form("cha[%d]", chamber_access_int);
cha[j] = new TH1F(hist_name, "rms mean plot", 100, -0.5, chamber_axisMax);
TCanvas *thisCanv_mean = CANV_PEDRMS_MEAN_ARRAY[chamber_access_int];
thisCanv_mean->cd();
TString xAxisTitle = Form("Mean RMS for Chamber %d",chamber_id_int);
cha[j]->GetXaxis()->SetTitle(xAxisTitle);
const char val[7];
//cuts based on each chamber
sprintf(val, "cham==%d", j);
const char *val_ = val;
Calibration->UseCurrentStyle();
//this draws an empty graph called cha[j] with the chosen options
//into the proper canvas, thisCanv_mean
cha[j]->Draw();
//this pipes histo pedRMS from Tree Calibration into graph cha[j] with cut val_
Calibration->Project(hist_name, "pedRMS", val_);
//retrieve the max, so the scale of the graph and vertical lines can be redrawn appropriately
Double_t yMaxVal = cha[j]->GetMaximum();
Double_t yMaxRan = yMaxVal + (yMaxVal*.1);
//reset the line range
vert_low_pedrms->SetY2(yMaxRan);
vert_high_pedrms->SetY2(yMaxRan);
//reset the axis range
cha[j]->SetAxisRange(0,yMaxRan,"Y");
vert_low_pedrms->Draw();
vert_high_pedrms->Draw();
thisCanv_mean->Update();
gSystem->cd("pedRMSLayerMean");
TString canvName = CANV_PEDRMS_MEAN_ARRAY[chamber_access_int]->GetName();
PrintAsGif(thisCanv_mean, canvName);
gSystem->cd("../");
int NStrips = 0;
int xStripMax = 1;
//dummy graph to retrieve number of strips, to set graph accordingly
TCanvas *StripEntryCanvas = new TCanvas("StripDummyCanvas", "StripDummyCanvas");
TH1F *StripEntryDummy = new TH1F("StripEntryDummy", "StripEntryDummy",10,0,100);
TString chamVar = Form("cham==%d",j);
StripEntryCanvas->cd();
Calibration->Draw("strip>>StripEntryDummy", chamVar);
//number of strips in a given chamber. should be 480 for 5 CFEBs or 384 for 4 CFEBs
NStrips= StripEntryDummy->GetEntries();
if (NStrips==480){
xStripMax=80;
}if (NStrips==384){
xStripMax=64;
}
for (int k=0; k<nLayer; ++k){
int layer_access_int = ( (nCham*nLayer*i) + (nLayer*j) + k );
//RMS: create, fill and draw strip graphs
TString hist_name_= Form("lay[%d]",layer_access_int);
lay[layer_access_int] = new TH2F(hist_name_,"RMS strip plot", xStripMax, 0, xStripMax, 10, -0.5, chamber_axisMax);
// lay[layer_access_int] = new TH2F(hist_name_,"RMS strip plot", xStripMax, 0, xStripMax, 10, 1.5, 3);
TCanvas *thisCanv_rms_strip = CANV_PEDRMS_STRIP_ARRAY[chamber_access_int];
thisCanv_rms_strip -> cd(k+1);
lay[layer_access_int]->SetMarkerStyle(20);
TString new_title2 = Form("Layer_%d", k+1);
lay[layer_access_int]->SetTitle(new_title2);
TString newTitle = Form("strip RMS in chamber %d, per layer",chamber_id_int,k);
//TString newTitle = Form("strip RMS in chamber %d, per layer",j+1,k);
thisCanv_rms_strip->SetTitle(newTitle);
lay[layer_access_int]->GetXaxis()->SetTitle("Strip");
lay[layer_access_int]->GetYaxis()->SetTitle("RMS");
lay[layer_access_int]->GetXaxis()->SetTitleSize(0.070);
lay[layer_access_int]->GetXaxis()->SetTitleOffset(0.5);
lay[layer_access_int]->GetYaxis()->SetTitleSize(0.070);
lay[layer_access_int]->GetXaxis()->SetTitleOffset(0.5);
lay[layer_access_int]->GetXaxis()->SetLabelSize(0.07);
lay[layer_access_int]->GetYaxis()->SetLabelSize(0.07);
horiz_low_pedrms->SetX2(xStripMax);
horiz_high_pedrms->SetX2(xStripMax);
TString graph_name_TH2F = Form("lay[%d]" ,layer_access_int);
const char valu[17];
sprintf(valu, "cham==%d&&layer==%d",j,k);
const char *valu_ = valu;
Calibration->UseCurrentStyle();
lay[layer_access_int]->Draw();
Calibration->Project(hist_name_, "pedRMS:strip", valu_);
horiz_low_pedrms->Draw();
horiz_high_pedrms->Draw();
thisCanv_rms_strip->Update();
}//layer loop
// process at end of looping
gSystem->cd("pedRMSStrips");
TString canvName = CANV_PEDRMS_STRIP_ARRAY[chamber_access_int]->GetName();
PrintAsGif(thisCanv_rms_strip, canvName);
gSystem->cd("../");
}//chamber loop
}//DDU loop
gSystem->cd("../../../../");
directoryCheck();
}//pedRMSGraph()
void pedMeanGraphs(int nDDU, int nCham, int nLayer, TString myFileName, TString myFilePath){
gSystem->cd("images/Crosstalk");
gSystem->cd(myFileName);
makeDirectory("pedMeanGraphs");
gSystem->cd("pedMeanGraphs");
makeDirectory("pedMeanStrips");
makeDirectory("pedMeanLayerMean");
//create mean canvas arrays
TObjArray CANV_PEDMEAN_STRIP_ARRAY(nCham*nDDU);
TObjArray CANV_PEDMEAN_MEAN_ARRAY(nCham*nDDU);
//create mean lines
TLine *horiz_low_pedmean = new TLine(0,400,80,400);
TLine *horiz_high_pedmean = new TLine(0,800,80,800);
TLine *vert_low_pedmean = new TLine(400, 0, 400, 200);
TLine *vert_high_pedmean = new TLine(800, 0, 800, 200);
horiz_low_pedmean->SetLineStyle(3);
horiz_high_pedmean->SetLineStyle(3);
vert_low_pedmean->SetLineStyle(3);
vert_high_pedmean->SetLineStyle(3);
horiz_low_pedmean->SetLineColor(6);
horiz_low_pedmean->SetLineWidth(2);
horiz_high_pedmean->SetLineColor(6);
horiz_high_pedmean->SetLineWidth(2);
vert_low_pedmean->SetLineColor(6);
vert_low_pedmean->SetLineWidth(2);
vert_high_pedmean->SetLineColor(6);
vert_high_pedmean->SetLineWidth(2);
TH1F *chamber[480];
TH2F *layer[2880];
for(int i=0; i<nDDU; ++i){
int idArray[9];
GetChamberIDs(idArray);
for (int j=0; j<nCham; ++j){
gStyle->SetMarkerStyle(20);
gStyle->SetMarkerSize(1.0);
Int_t chamber_id_int = idArray[j];
//get the max RMS value for the chamber
Float_t chamber_maxPedval = Calibration->GetLeaf("MaxPed")->GetValue(j);
Float_t chamber_axisMax = chamber_maxPedval + (.1)*chamber_maxPedval;
if (chamber_axisMax<900.0){
chamber_axisMax = 900.0;
}
//Mean mean Cavases
TString CANV_PEDMEAN_MEAN_NAME = Form("ChamberID_%d_ped_Mean",chamber_id_int);
TCanvas* canv_mean1;
canv_mean1 = new TCanvas(CANV_PEDMEAN_MEAN_NAME,CANV_PEDMEAN_MEAN_NAME, 200, 10, 1200, 800);
CANV_PEDMEAN_MEAN_ARRAY.Add(canv_mean1);
//Mean strip Canvases
TString CANV_PEDMEAN_STRIP_NAME = Form("ChamberID_%d_ped_Mean_per_Layer",chamber_id_int);
TCanvas* canv_mean2;
canv_mean2= new TCanvas(CANV_PEDMEAN_STRIP_NAME,CANV_PEDMEAN_STRIP_NAME, 200, 10, 1200, 800);
canv_mean2->SetCanvasSize(1200,800);
canv_mean2->Divide(2,3);
CANV_PEDMEAN_STRIP_ARRAY.Add(canv_mean2);
//create, fill and draw overall MEAN graphs
int chamber_access_int =( (nCham*i)+ j);
TString hist_name= Form("chamber[%d]",chamber_access_int);
chamber[j] = new TH1F(hist_name, "mean mean plot", 100, 300, chamber_axisMax);
TCanvas *thisCanv_meanMean = CANV_PEDMEAN_MEAN_ARRAY[chamber_access_int];
thisCanv_meanMean->SetCanvasSize(1200,800);
thisCanv_meanMean->cd();
const char value[7];
sprintf(value, "cham==%d", j);
const char *value_ = value;
TString new_title1_mean = Form("Mean_ChamberID_%d_DDU_%d", chamber_id_int, i+1);
chamber[j]->SetTitle(new_title1_mean);
TString new_title1_mean = Form("ChamberID_%d_DDU_%d_Mean", chamber_id_int, i+1);
TString xAxisTitle = Form("Mean Pedestal for Chamber %d",chamber_id_int);
chamber[j]->SetTitle(new_title1_mean);
chamber[j]->GetXaxis()->SetTitle(xAxisTitle);
Calibration->UseCurrentStyle();
chamber[j]->Draw();
Calibration->Project(hist_name, "pedMean", value_);
Double_t yMaxVal = chamber[j]->GetMaximum();
Double_t yMaxRan = yMaxVal + (yMaxVal*.1);
vert_low_pedmean->SetY2(yMaxRan);
vert_high_pedmean->SetY2(yMaxRan);
chamber[j]->SetAxisRange(0,yMaxRan,"Y");
vert_low_pedmean->Draw();
vert_high_pedmean->Draw();
thisCanv_meanMean->Update();
gSystem->cd("pedMeanLayerMean");
TString canvName = CANV_PEDMEAN_MEAN_ARRAY[chamber_access_int]->GetName();
PrintAsGif(thisCanv_meanMean, canvName);
gSystem->cd("../");
int NStrips = 0;
int xStripMax = 1;
//dummy graph to retrieve number of strips, to set graph accordingly
TCanvas *StripEntryCanvas = new TCanvas("StripDummyCanvas", "StripDummyCanvas");
TH1F *StripEntryDummy = new TH1F("StripEntryDummy", "StripEntryDummy",10,0,100);
TString chamVar = Form("cham==%d",j);
StripEntryCanvas->cd();
Calibration->Draw("strip>>StripEntryDummy", chamVar);
//number of strips in a given chamber. should be 480 for 5 CFEBs or 384 for 4 CFEBs
NStrips=StripEntryDummy->GetEntries();
if (NStrips==480){
xStripMax=80;
}if (NStrips==384){
xStripMax=64;
}
for (int k=0; k<nLayer; ++k){
gStyle->SetMarkerStyle(20);
gStyle->SetMarkerSize(1.0);
int layer_access_int = ( (nCham*nLayer*i) + (nLayer*j) + k );
//MEAN: create, fill and draw strip graphs
TString hist_name_mean= Form("layer[%d]",layer_access_int);
layer[layer_access_int] = new TH2F(hist_name_mean,"MEAN strip plot", xStripMax, 0, xStripMax, 100, 300, chamber_axisMax);
TCanvas *thisCanv_mean_strip=CANV_PEDMEAN_STRIP_ARRAY[chamber_access_int];
thisCanv_mean_strip-> cd(k+1);
layer[layer_access_int]->GetXaxis()->SetTitle("Strip");
layer[layer_access_int]->GetXaxis()->SetTitleSize(0.070);
layer[layer_access_int]->GetXaxis()->SetTitleOffset(0.5);
layer[layer_access_int]->GetYaxis()->SetTitle("Pedestal Mean");
layer[layer_access_int]->GetYaxis()->SetTitleSize(0.070);
layer[layer_access_int]->GetYaxis()->SetTitleOffset(0.5);
const char value2[17];
sprintf(value2, "cham==%d&&layer==%d",j,k);
const char *value2_ = value2;
layer[layer_access_int]->SetMarkerStyle(20);
horiz_low_pedmean->SetX2(xStripMax);
horiz_high_pedmean->SetX2(xStripMax);
Calibration->UseCurrentStyle();
layer[layer_access_int]->Draw();
Calibration->Project(hist_name_mean, "pedMean:strip", value2_);
horiz_low_pedmean->Draw("same");
horiz_high_pedmean->Draw("same");
}//layer
gSystem->cd("pedMeanStrips");
TString canvName = CANV_PEDMEAN_STRIP_ARRAY[chamber_access_int]->GetName();
PrintAsGif(thisCanv_mean_strip, canvName);
gSystem->cd("../");
}//chamber
}//DDU
gSystem->cd("../../../../");
directoryCheck();
}//pedMeanGraphs()
void pedRMSFlagGraph(TString myFileName, TString myFilePath){
gStyle->SetOptStat(0);
gSystem->cd("images/Crosstalk");
gSystem->cd(myFileName);
//1D Graph, straight from Calibration Tree
TCanvas *flagRMSCanv = new TCanvas("flagRMSCanv", "flagRMSCanv", 200,10,800,800);
flagRMSCanv->SetCanvasSize(1200,800);
flagRMSGraph_1D = new TH1F("flagRMSGraph_1D", "flagRMSGraph_1D", 5, 0, 5);
flagRMSGraph_1D->GetYaxis()->SetTitle("Number");
flagRMSGraph_1D->GetYaxis()->SetLabelSize(0.035);
flagRMSGraph_1D->GetXaxis()->SetTitle("Flag");
flagRMSGraph_1D->GetXaxis()->SetLabelSize(0.035);
TLegend *LegRMS = new TLegend(0.85,0.8,0.98,0.98);
LegRMS->SetHeader("RMS Flags Definitions");
LegRMS->SetFillColor(0);
LegRMS->SetTextSize(0);
Calibration->UseCurrentStyle();
Calibration->Draw("flagRMS>>flagRMSGraph_1D");
LegRMS->AddEntry("", "1: Good");
LegRMS->AddEntry("", "2: High CFEB Noise");
LegRMS->AddEntry("", "3: Too low Noise");
LegRMS->AddEntry("", "4: Too high Noise");
LegRMS->Draw("same");
flagRMSCanv->Update();
//print as gif
PrintAsGif(flagRMSCanv, "flagRMS");
///////////////////////////////// 2D GRAPHS ////////////////////////////////
//no statistics shown
gStyle->SetOptStat(0);
////////// Strip Flag Graphs///////////////
//canvas
TCanvas *flagRMSStripCanv = new TCanvas("flagRMSStripCanv", "flagRMSStripCanv", 200,10,800,800);
flagRMSStripCanv->SetCanvasSize(1200,800);
//create legend
TLegend *LegRMSStrip = new TLegend(0.85,0.8,0.98,0.98);
LegRMSStrip->SetHeader("RMS Flags Definitions");
LegRMSStrip->SetFillColor(0);
LegRMSStrip->SetTextSize(0);
//final histogram for display
flagRMSGraph_2D_Strip = new TH2F("flagRMSGraph_2D_Strip", "flagRMSGraph_2D_Strip", 80, 0, 80, 6, 0, 6);
///dummy histo to get bin maximum
flagRMSGraph_2D_Strip0 = new TH2F("flagRMSGraph_2D_Strip0", "flagRMSGraph_2D_Strip0", 80, 0, 80, 6, 0, 6);
//one histo for each flag value.
flagRMSGraph_2D_Strip1 = new TH2F("flagRMSGraph_2D_Strip1", "flagRMSGraph_2D_Strip1", 80, 0, 80, 6, 0, 6);
flagRMSGraph_2D_Strip2 = new TH2F("flagRMSGraph_2D_Strip2", "flagRMSGraph_2D_Strip2", 80, 0, 80, 6, 0, 6);
flagRMSGraph_2D_Strip3 = new TH2F("flagRMSGraph_2D_Strip3", "flagRMSGraph_2D_Strip3", 80, 0, 80, 6, 0, 6);
flagRMSGraph_2D_Strip4 = new TH2F("flagRMSGraph_2D_Strip4", "flagRMSGraph_2D_Strip4", 80, 0, 80, 6, 0, 6);
flagRMSGraph_2D_Strip5 = new TH2F("flagRMSGraph_2D_Strip5", "flagRMSGraph_2D_Strip5", 80, 0, 80, 6, 0, 6);
flagRMSGraph_2D_Strip6 = new TH2F("flagRMSGraph_2D_Strip6", "flagRMSGraph_2D_Strip6", 80, 0, 80, 6, 0, 6);
//fill completley, get bin maximum, set it for overall graph
Calibration->Project("flagRMSGraph_2D_Strip0","flagRMS:strip");
Double_t binMaxValStrip = flagRMSGraph_2D_Strip0->GetMaximum();
//normalize each box appropriately, with respect to the most filled box
flagRMSGraph_2D_Strip->SetMaximum(binMaxValStrip);
//fill each "bin"
Calibration->Project("flagRMSGraph_2D_Strip1","flagRMS:strip", "flagRMS==1","box");
Calibration->Project("flagRMSGraph_2D_Strip2","flagRMS:strip", "flagRMS==2","box");
Calibration->Project("flagRMSGraph_2D_Strip3","flagRMS:strip", "flagRMS==3","box");
Calibration->Project("flagRMSGraph_2D_Strip4","flagRMS:strip", "flagRMS==4","box");
Calibration->Project("flagRMSGraph_2D_Strip5","flagRMS:strip", "flagRMS==5","box");
//set appropriate colors
flagRMSGraph_2D_Strip1->SetFillColor(1);//Black for eveything is OK
flagRMSGraph_2D_Strip2->SetFillColor(2);//red for VERY BAD
flagRMSGraph_2D_Strip3->SetFillColor(3);//Green for pretty good
flagRMSGraph_2D_Strip4->SetFillColor(4);//blue for less good
flagRMSStripCanv->cd();
flagRMSGraph_2D_Strip->GetYaxis()->SetTitle("Flag");
flagRMSGraph_2D_Strip->GetXaxis()->SetTitle("Strip, all Chambers");
//draw original histogram, empty
flagRMSGraph_2D_Strip->Draw("box");
//overlay the individual "bin" graphs
flagRMSGraph_2D_Strip1->Draw("samebox");
flagRMSGraph_2D_Strip2->Draw("samebox");
flagRMSGraph_2D_Strip3->Draw("samebox");
flagRMSGraph_2D_Strip4->Draw("samebox");
flagRMSGraph_2D_Strip5->Draw("samebox");
flagRMSGraph_2D_Strip6->Draw("samebox");
//set legend entries appropriately
LegRMSStrip->AddEntry(flagRMSGraph_2D_Strip1, "Good", "f");
LegRMSStrip->AddEntry(flagRMSGraph_2D_Strip2, "High CFEB Noise", "f");
LegRMSStrip->AddEntry(flagRMSGraph_2D_Strip3, "Too low Noise", "f");
LegRMSStrip->AddEntry(flagRMSGraph_2D_Strip4, "Too high Noise", "f");
LegRMSStrip->Draw("same");
//print as gif
PrintAsGif(flagRMSStripCanv, "flagRMSStrip");
///////// CHAMBER flag Graph ///////////////////////
TCanvas *flagRMSChamberCanv = new TCanvas("flagRMSChamberCanv", "flagRMSChamberCanv", 200,10,800,800);
flagRMSChamberCanv->SetCanvasSize(1200,800);
//create legend
TLegend *LegRMSChamber = new TLegend(0.85,0.8,0.98,0.98);
LegRMSChamber->SetHeader("RMS Flags Definitions");
LegRMSChamber->SetFillColor(0);
LegRMSChamber->SetTextSize(0);
//final histogram for display
flagRMSGraph_2D_Chamber = new TH2F("flagRMSGraph_2D_Chamber", "flagRMSGraph_2D_Chamber", 9, 0, 9, 6, 0, 6);
///dummy histo to get bin maximum
flagRMSGraph_2D_Chamber0 = new TH2F("flagRMSGraph_2D_Chamber0", "flagRMSGraph_2D_Chamber0", 9, 0, 9, 6, 0, 6);
//one histo for each flag value.
flagRMSGraph_2D_Chamber1 = new TH2F("flagRMSGraph_2D_Chamber1", "flagRMSGraph_2D_Chamber1", 9, 0, 9, 6, 0, 6);
flagRMSGraph_2D_Chamber2 = new TH2F("flagRMSGraph_2D_Chamber2", "flagRMSGraph_2D_Chamber2", 9, 0, 9, 6, 0, 6);
flagRMSGraph_2D_Chamber3 = new TH2F("flagRMSGraph_2D_Chamber3", "flagRMSGraph_2D_Chamber3", 9, 0, 9, 6, 0, 6);
flagRMSGraph_2D_Chamber4 = new TH2F("flagRMSGraph_2D_Chamber4", "flagRMSGraph_2D_Chamber4", 9, 0, 9, 6, 0, 6);
flagRMSGraph_2D_Chamber5 = new TH2F("flagRMSGraph_2D_Chamber5", "flagRMSGraph_2D_Chamber5", 9, 0, 9, 6, 0, 6);
flagRMSGraph_2D_Chamber6 = new TH2F("flagRMSGraph_2D_Chamber6", "flagRMSGraph_2D_Chamber6", 9, 0, 9, 6, 0, 6);
//fill completley, get bin maximum, set it for overall graph
Calibration->Project("flagRMSGraph_2D_Chamber0","flagRMS:cham");
Double_t binMaxValCham = flagRMSGraph_2D_Chamber0->GetMaximum();
//normalize each box appropriately, with respect to the most filled box
flagRMSGraph_2D_Chamber->SetMaximum(binMaxValCham);
//fill each "bin"
Calibration->Project("flagRMSGraph_2D_Chamber1","flagRMS:cham", "flagRMS==1", "box");
Calibration->Project("flagRMSGraph_2D_Chamber2","flagRMS:cham", "flagRMS==2", "box");
Calibration->Project("flagRMSGraph_2D_Chamber3","flagRMS:cham", "flagRMS==3", "box");
Calibration->Project("flagRMSGraph_2D_Chamber4","flagRMS:cham", "flagRMS==4", "box");
Calibration->Project("flagRMSGraph_2D_Chamber5","flagRMS:cham", "flagRMS==5", "box");
//set appropriate colors
flagRMSGraph_2D_Chamber1->SetFillColor(1);//Black for eveything is OK
flagRMSGraph_2D_Chamber2->SetFillColor(2);//red for VERY BAD
flagRMSGraph_2D_Chamber3->SetFillColor(3);//Green for pretty good
flagRMSGraph_2D_Chamber4->SetFillColor(4);//blue for less good
int idArray[9];
GetChamberIDs(idArray);
for (int chamNum = 0; chamNum<9; ++chamNum){
int chamNumPlus = chamNum + 1; //for bin access
Int_t chamber_id_int = idArray[chamNum]; //set individual id as int
std::stringstream chamber_id_stream; //define variable in intermediate format
chamber_id_stream << chamber_id_int; //convert from int to intermediate "stringstream" format
TString chamber_id_str = chamber_id_stream.str(); //convert from stream into string
if (chamber_id_str.BeginsWith("220")==0 ){ //binary check, i.e. if the string doesn't begin with 220
chamber_id_str=0; //clean out; set to 0.
}else{
chamber_id_str.Remove(8,8); //remove 0 at end
chamber_id_str.Remove(0,3); //remove 220 at beginning
}
flagRMSGraph_2D_Chamber->GetXaxis()->SetBinLabel(chamNumPlus,chamber_id_str); //set bins to have chamber names
}
flagRMSChamberCanv->cd();
flagRMSGraph_2D_Chamber->GetYaxis()->SetTitle("Flag");
flagRMSGraph_2D_Chamber->GetXaxis()->SetTitle("Chamber");
//draw original histogram, empty
flagRMSGraph_2D_Chamber->Draw("box");
//overlay the individual "bin" graphs
flagRMSGraph_2D_Chamber1->Draw("samebox");
flagRMSGraph_2D_Chamber2->Draw("samebox");
flagRMSGraph_2D_Chamber3->Draw("samebox");
flagRMSGraph_2D_Chamber4->Draw("samebox");
flagRMSGraph_2D_Chamber5->Draw("samebox");
flagRMSGraph_2D_Chamber6->Draw("samebox");
//set legend entries appropriately
LegRMSChamber->AddEntry(flagRMSGraph_2D_Chamber1, "Good", "f");
LegRMSChamber->AddEntry(flagRMSGraph_2D_Chamber2, "High CFEB Noise", "f");
LegRMSChamber->AddEntry(flagRMSGraph_2D_Chamber3, "Too low Noise", "f");
LegRMSChamber->AddEntry(flagRMSGraph_2D_Chamber4, "Too high Noise", "f");
LegRMSChamber->Draw("same");
//print as gif
PrintAsGif(flagRMSChamberCanv, "flagRMSChamber");
/////////////////////// Layer Graphs //////////////
TCanvas *flagRMSLayerCanv = new TCanvas("flagRMSLayerCanv", "flagRMSLayerCanv", 200,10,800,800);
flagRMSLayerCanv->SetCanvasSize(1200,800);
//create legend
TLegend *LegRMSLayer = new TLegend(0.85,0.8,0.98,0.98);
LegRMSLayer->SetHeader("RMS Flags Definitions");
LegRMSLayer->SetFillColor(0);
LegRMSLayer->SetTextSize(0);
//final histogram for display
flagRMSGraph_2D_Layer = new TH2F("flagRMSGraph_2D_Layer", "flagRMSGraph_2D_Layer", 6, 0, 6, 6, 0, 6);
///dummy histo to get bin maximum
flagRMSGraph_2D_Layer0 = new TH2F("flagRMSGraph_2D_Layer0", "flagRMSGraph_2D_Layer0", 6, 0, 6, 6, 0, 6);
//one histo for each flag value.
flagRMSGraph_2D_Layer1 = new TH2F("flagRMSGraph_2D_Layer1", "flagRMSGraph_2D_Layer1", 6, 0, 6, 6, 0, 6);
flagRMSGraph_2D_Layer2 = new TH2F("flagRMSGraph_2D_Layer2", "flagRMSGraph_2D_Layer2", 6, 0, 6, 6, 0, 6);
flagRMSGraph_2D_Layer3 = new TH2F("flagRMSGraph_2D_Layer3", "flagRMSGraph_2D_Layer3", 6, 0, 6, 6, 0, 6);
flagRMSGraph_2D_Layer4 = new TH2F("flagRMSGraph_2D_Layer4", "flagRMSGraph_2D_Layer4", 6, 0, 6, 6, 0, 6);
flagRMSGraph_2D_Layer5 = new TH2F("flagRMSGraph_2D_Layer5", "flagRMSGraph_2D_Layer5", 6, 0, 6, 6, 0, 6);
flagRMSGraph_2D_Layer6 = new TH2F("flagRMSGraph_2D_Layer6", "flagRMSGraph_2D_Layer6", 6, 0, 6, 6, 0, 6);
//fill completley, get bin maximum, set it for overall graph
Calibration->Project("flagRMSGraph_2D_Layer0","flagRMS:layer");
Double_t binMaxValLayer = flagRMSGraph_2D_Layer0->GetMaximum();
//normalize each box appropriately, with respect to the most filled box
flagRMSGraph_2D_Layer->SetMaximum(binMaxValLayer);
//fill each "bin"
Calibration->Project("flagRMSGraph_2D_Layer1","flagRMS:layer", "flagRMS==1", "box");
Calibration->Project("flagRMSGraph_2D_Layer2","flagRMS:layer", "flagRMS==2", "box");
Calibration->Project("flagRMSGraph_2D_Layer3","flagRMS:layer", "flagRMS==3", "box");
Calibration->Project("flagRMSGraph_2D_Layer4","flagRMS:layer", "flagRMS==4", "box");
Calibration->Project("flagRMSGraph_2D_Layer5","flagRMS:layer", "flagRMS==5", "box");
//set appropriate colors
flagRMSGraph_2D_Layer1->SetFillColor(1);//Black for eveything is OK
flagRMSGraph_2D_Layer2->SetFillColor(2);//red for VERY BAD
flagRMSGraph_2D_Layer3->SetFillColor(3);//Green for pretty good
flagRMSGraph_2D_Layer4->SetFillColor(4);//blue for less good
flagRMSLayerCanv->cd();
flagRMSGraph_2D_Layer->GetYaxis()->SetTitle("Flag");
flagRMSGraph_2D_Layer->GetXaxis()->SetTitle("Layer, all Chambers");
//draw original histogram, empty
flagRMSGraph_2D_Layer->Draw("box");
//overlay the individual "bin" graphs
flagRMSGraph_2D_Layer1->Draw("samebox");
flagRMSGraph_2D_Layer2->Draw("samebox");
flagRMSGraph_2D_Layer3->Draw("samebox");
flagRMSGraph_2D_Layer4->Draw("samebox");
flagRMSGraph_2D_Layer5->Draw("samebox");
flagRMSGraph_2D_Layer6->Draw("samebox");
//set legend entries appropriately
LegRMSLayer->AddEntry(flagRMSGraph_2D_Layer1, "Good", "f");
LegRMSLayer->AddEntry(flagRMSGraph_2D_Layer2, "High CFEB Noise", "f");
LegRMSLayer->AddEntry(flagRMSGraph_2D_Layer3, "Too low Noise", "f");
LegRMSLayer->AddEntry(flagRMSGraph_2D_Layer4, "Too high Noise", "f");
LegRMSLayer->Draw("same");
//print as gif
PrintAsGif(flagRMSLayerCanv, "flagRMSLayer");
gSystem->cd("../../../");
gStyle->SetOptStat(1);
}
void pedNoiseFlagGraph(TString myFileName, TString myFilePath){
// TFile *myFile = new TFile(myFilePath, "read");
gStyle->SetOptStat(0);
gSystem->cd("images/Crosstalk");
gSystem->cd(myFileName);
//1D Graph, straight from Calibration Tree
TCanvas *flagMeanCanv = new TCanvas("flagMeanCanv", "flagMeanCanv", 200,10,800,800);
flagMeanCanv->SetCanvasSize(1200,800);
flagMeanGraph_1D = new TH1F("flagMeanGraph_1D", "flagMeanGraph_1D", 5, 0, 5);
flagMeanGraph_1D->GetYaxis()->SetTitle("Number");
flagMeanGraph_1D->GetYaxis()->SetLabelSize(0.035);
flagMeanGraph_1D->GetXaxis()->SetTitle("Flag");
flagMeanGraph_1D->GetXaxis()->SetLabelSize(0.035);
TLegend *LegMean = new TLegend(0.85,0.8,0.98,0.98);
LegMean->SetHeader("Mean Flags Definitions");
LegMean->SetFillColor(0);
LegMean->SetTextSize(0);
Calibration->UseCurrentStyle();
Calibration->Draw("flagNoise>>flagMeanGraph_1D");
LegMean->AddEntry(flagMeanGraph_1D, "1: Normal Pedestal", "f");
LegMean->AddEntry(flagMeanGraph_1D, "2: Low Failure", "f");
LegMean->AddEntry(flagMeanGraph_1D, "3: Low Warning", "f");
LegMean->AddEntry(flagMeanGraph_1D, "4: High Warning", "f");
LegMean->AddEntry(flagMeanGraph_1D, "5: High Failure", "f");
LegMean->Draw("same");
flagMeanCanv->Update();
//print as gif
PrintAsGif(flagMeanCanv, "flagMean");
///////////////////////////////// 2D GRAPHS ////////////////////////////////
//no statistics shown
gStyle->SetOptStat(0);
////////// Strip Flag Graphs///////////////
//canvas
TCanvas *flagMeanStripCanv = new TCanvas("flagMeanStripCanv", "flagMeanStripCanv", 200,10,800,800);
flagMeanStripCanv->SetCanvasSize(1200,800);
//create legend
TLegend *LegMeanStrip = new TLegend(0.85,0.8,0.98,0.98);
LegMeanStrip->SetHeader("Mean Flags Definitions");
LegMeanStrip->SetFillColor(0);
LegMeanStrip->SetTextSize(0);
//final histogram for display
flagMeanGraph_2D_Strip = new TH2F("flagMeanGraph_2D_Strip", "flagMeanGraph_2D_Strip", 80, 0, 80, 6, 0, 6);
///dummy histo to get bin maximum
flagMeanGraph_2D_Strip0 = new TH2F("flagMeanGraph_2D_Strip0", "flagMeanGraph_2D_Strip0", 80, 0, 80, 6, 0, 6);
//one histo for each flag value.
flagMeanGraph_2D_Strip1 = new TH2F("flagMeanGraph_2D_Strip1", "flagMeanGraph_2D_Strip1", 80, 0, 80, 6, 0, 6);
flagMeanGraph_2D_Strip2 = new TH2F("flagMeanGraph_2D_Strip2", "flagMeanGraph_2D_Strip2", 80, 0, 80, 6, 0, 6);
flagMeanGraph_2D_Strip3 = new TH2F("flagMeanGraph_2D_Strip3", "flagMeanGraph_2D_Strip3", 80, 0, 80, 6, 0, 6);
flagMeanGraph_2D_Strip4 = new TH2F("flagMeanGraph_2D_Strip4", "flagMeanGraph_2D_Strip4", 80, 0, 80, 6, 0, 6);
flagMeanGraph_2D_Strip5 = new TH2F("flagMeanGraph_2D_Strip5", "flagMeanGraph_2D_Strip5", 80, 0, 80, 6, 0, 6);
flagMeanGraph_2D_Strip6 = new TH2F("flagMeanGraph_2D_Strip6", "flagMeanGraph_2D_Strip6", 80, 0, 80, 6, 0, 6);
//fill completley, get bin maximum, set it for overall graph
Calibration->Project("flagMeanGraph_2D_Strip0","flagNoise:strip");
Double_t binMaxValStrip = flagMeanGraph_2D_Strip0->GetMaximum();
//normalize each box appropriately, with respect to the most filled box
flagMeanGraph_2D_Strip->SetMaximum(binMaxValStrip);
//fill each "bin"
Calibration->Project("flagMeanGraph_2D_Strip1","flagNoise:strip", "flagNoise==1","box");
Calibration->Project("flagMeanGraph_2D_Strip2","flagNoise:strip", "flagNoise==2","box");
Calibration->Project("flagMeanGraph_2D_Strip3","flagNoise:strip", "flagNoise==3","box");
Calibration->Project("flagMeanGraph_2D_Strip4","flagNoise:strip", "flagNoise==4","box");
Calibration->Project("flagMeanGraph_2D_Strip5","flagNoise:strip", "flagNoise==5","box");
//set appropriate colors
flagMeanGraph_2D_Strip1->SetFillColor(1);//Black for eveything is OK
flagMeanGraph_2D_Strip2->SetFillColor(2);//red for VERY BAD
flagMeanGraph_2D_Strip3->SetFillColor(3);//Green for pretty good
flagMeanGraph_2D_Strip4->SetFillColor(4);//blue for less good
flagMeanGraph_2D_Strip5->SetFillColor(5);//red for VERY BAD
flagMeanStripCanv->cd();
flagMeanGraph_2D_Strip->GetYaxis()->SetTitle("Flag");
flagMeanGraph_2D_Strip->GetXaxis()->SetTitle("Strip, all Chambers");
//draw original histogram, empty
flagMeanGraph_2D_Strip->Draw("box");
//overlay the individual "bin" graphs
flagMeanGraph_2D_Strip1->Draw("samebox");
flagMeanGraph_2D_Strip2->Draw("samebox");
flagMeanGraph_2D_Strip3->Draw("samebox");
flagMeanGraph_2D_Strip4->Draw("samebox");
flagMeanGraph_2D_Strip5->Draw("samebox");
flagMeanGraph_2D_Strip6->Draw("samebox");
//set legend entries appropriately
LegMeanStrip->AddEntry(flagMeanGraph_2D_Strip1, "1: Normal Pedestal", "f");
LegMeanStrip->AddEntry(flagMeanGraph_2D_Strip2, "2: Low Failure", "f");
LegMeanStrip->AddEntry(flagMeanGraph_2D_Strip3, "3: Low Warning", "f");
LegMeanStrip->AddEntry(flagMeanGraph_2D_Strip4, "4: High Warning", "f");
LegMeanStrip->AddEntry(flagMeanGraph_2D_Strip5, "5: High Failure", "f");
LegMeanStrip->Draw("same");
//print as gif
PrintAsGif(flagMeanStripCanv, "flagMeanStrip");
///////// CHAMBER flag Graph ///////////////////////
TCanvas *flagMeanChamberCanv = new TCanvas("flagMeanChamberCanv", "flagMeanChamberCanv", 200,10,800,800);
flagMeanChamberCanv->SetCanvasSize(1200,800);
//create legend
TLegend *LegMeanChamber = new TLegend(0.85,0.8,0.98,0.98);
LegMeanChamber->SetHeader("Mean Flags Definitions");
LegMeanChamber->SetFillColor(0);
LegMeanChamber->SetTextSize(0);
//final histogram for display
flagMeanGraph_2D_Chamber = new TH2F("flagMeanGraph_2D_Chamber", "flagMeanGraph_2D_Chamber", 9, 0, 9, 6, 0, 6);
///dummy histo to get bin maximum
flagMeanGraph_2D_Chamber0 = new TH2F("flagMeanGraph_2D_Chamber0", "flagMeanGraph_2D_Chamber0", 9, 0, 9, 6, 0, 6);
//one histo for each flag value.
flagMeanGraph_2D_Chamber1 = new TH2F("flagMeanGraph_2D_Chamber1", "flagMeanGraph_2D_Chamber1", 9, 0, 9, 6, 0, 6);
flagMeanGraph_2D_Chamber2 = new TH2F("flagMeanGraph_2D_Chamber2", "flagMeanGraph_2D_Chamber2", 9, 0, 9, 6, 0, 6);
flagMeanGraph_2D_Chamber3 = new TH2F("flagMeanGraph_2D_Chamber3", "flagMeanGraph_2D_Chamber3", 9, 0, 9, 6, 0, 6);
flagMeanGraph_2D_Chamber4 = new TH2F("flagMeanGraph_2D_Chamber4", "flagMeanGraph_2D_Chamber4", 9, 0, 9, 6, 0, 6);
flagMeanGraph_2D_Chamber5 = new TH2F("flagMeanGraph_2D_Chamber5", "flagMeanGraph_2D_Chamber5", 9, 0, 9, 6, 0, 6);
flagMeanGraph_2D_Chamber6 = new TH2F("flagMeanGraph_2D_Chamber6", "flagMeanGraph_2D_Chamber6", 9, 0, 9, 6, 0, 6);
//fill completley, get bin maximum, set it for overall graph
Calibration->Project("flagMeanGraph_2D_Chamber0","flagNoise:cham");
Double_t binMaxValCham = flagMeanGraph_2D_Chamber0->GetMaximum();
//normalize each box appropriately, with respect to the most filled box
flagMeanGraph_2D_Chamber->SetMaximum(binMaxValCham);
//fill each "bin"
Calibration->Project("flagMeanGraph_2D_Chamber1","flagNoise:cham", "flagNoise==1", "box");
Calibration->Project("flagMeanGraph_2D_Chamber2","flagNoise:cham", "flagNoise==2", "box");
Calibration->Project("flagMeanGraph_2D_Chamber3","flagNoise:cham", "flagNoise==3", "box");
Calibration->Project("flagMeanGraph_2D_Chamber4","flagNoise:cham", "flagNoise==4", "box");
Calibration->Project("flagMeanGraph_2D_Chamber5","flagNoise:cham", "flagNoise==5", "box");
//set appropriate colors
flagMeanGraph_2D_Chamber1->SetFillColor(1);//Black for eveything is OK
flagMeanGraph_2D_Chamber2->SetFillColor(2);//red for VERY BAD
flagMeanGraph_2D_Chamber3->SetFillColor(3);//Green for pretty good
flagMeanGraph_2D_Chamber4->SetFillColor(4);//blue for less good
flagMeanGraph_2D_Chamber5->SetFillColor(5);//blue for less good
int idArray[9];
GetChamberIDs(idArray);
for (int chamNum = 0; chamNum<9; ++chamNum){
int chamNumPlus = chamNum + 1; //for bin access
Int_t chamber_id_int = idArray[chamNum]; //set individual id as int
std::stringstream chamber_id_stream; //define variable in intermediate format
chamber_id_stream << chamber_id_int; //convert from int to intermediate "stringstream" format
TString chamber_id_str = chamber_id_stream.str(); //convert from stream into string
if (chamber_id_str.BeginsWith("220")==0 ){ //binary check, i.e. if the string doesn't begin with 220
chamber_id_str=0; //clean out; set to 0.
}else{
chamber_id_str.Remove(8,8); //remove 0 at end
chamber_id_str.Remove(0,3); //remove 220 at beginning
}
flagMeanGraph_2D_Chamber->GetXaxis()->SetBinLabel(chamNumPlus,chamber_id_str); //set bins to have chamber names
}
flagMeanChamberCanv->cd();
flagMeanGraph_2D_Chamber->GetYaxis()->SetTitle("Flag");
flagMeanGraph_2D_Chamber->GetXaxis()->SetTitle("Chamber");
//draw original histogram, empty
flagMeanGraph_2D_Chamber->Draw("box");
//overlay the individual "bin" graphs
flagMeanGraph_2D_Chamber1->Draw("samebox");
flagMeanGraph_2D_Chamber2->Draw("samebox");
flagMeanGraph_2D_Chamber3->Draw("samebox");
flagMeanGraph_2D_Chamber4->Draw("samebox");
flagMeanGraph_2D_Chamber5->Draw("samebox");
flagMeanGraph_2D_Chamber6->Draw("samebox");
//set legend entries appropriately
LegMeanChamber->AddEntry(flagMeanGraph_2D_Chamber1, "1: Normal Pedestal", "f");
LegMeanChamber->AddEntry(flagMeanGraph_2D_Chamber2, "2: Low Failure", "f");
LegMeanChamber->AddEntry(flagMeanGraph_2D_Chamber3, "3: Low Warning", "f");
LegMeanChamber->AddEntry(flagMeanGraph_2D_Chamber4, "4: High Warning", "f");
LegMeanChamber->AddEntry(flagMeanGraph_2D_Chamber5, "5: High Failure", "f");
LegMeanChamber->Draw("same");
//print as gif
PrintAsGif(flagMeanChamberCanv, "flagMeanChamber");
/////////////////////// Layer Graphs //////////////
TCanvas *flagMeanLayerCanv = new TCanvas("flagMeanLayerCanv", "flagMeanLayerCanv", 200,10,800,800);
flagMeanLayerCanv->SetCanvasSize(1200,800);
//create legend
TLegend *LegMeanLayer = new TLegend(0.85,0.8,0.98,0.98);
LegMeanLayer->SetHeader("Mean Flags Definitions");
LegMeanLayer->SetFillColor(0);
LegMeanLayer->SetTextSize(0);
//final histogram for display
flagMeanGraph_2D_Layer = new TH2F("flagMeanGraph_2D_Layer", "flagMeanGraph_2D_Layer", 6, 0, 6, 6, 0, 6);
///dummy histo to get bin maximum
flagMeanGraph_2D_Layer0 = new TH2F("flagMeanGraph_2D_Layer0", "flagMeanGraph_2D_Layer0", 6, 0, 6, 6, 0, 6);
//one histo for each flag value.
flagMeanGraph_2D_Layer1 = new TH2F("flagMeanGraph_2D_Layer1", "flagMeanGraph_2D_Layer1", 6, 0, 6, 6, 0, 6);
flagMeanGraph_2D_Layer2 = new TH2F("flagMeanGraph_2D_Layer2", "flagMeanGraph_2D_Layer2", 6, 0, 6, 6, 0, 6);
flagMeanGraph_2D_Layer3 = new TH2F("flagMeanGraph_2D_Layer3", "flagMeanGraph_2D_Layer3", 6, 0, 6, 6, 0, 6);
flagMeanGraph_2D_Layer4 = new TH2F("flagMeanGraph_2D_Layer4", "flagMeanGraph_2D_Layer4", 6, 0, 6, 6, 0, 6);
flagMeanGraph_2D_Layer5 = new TH2F("flagMeanGraph_2D_Layer5", "flagMeanGraph_2D_Layer5", 6, 0, 6, 6, 0, 6);
flagMeanGraph_2D_Layer6 = new TH2F("flagMeanGraph_2D_Layer6", "flagMeanGraph_2D_Layer6", 6, 0, 6, 6, 0, 6);
//fill completley, get bin maximum, set it for overall graph
Calibration->Project("flagMeanGraph_2D_Layer0","flagNoise:layer");
Double_t binMaxValLayer = flagMeanGraph_2D_Layer0->GetMaximum();
//normalize each box appropriately, with respect to the most filled box
flagMeanGraph_2D_Layer->SetMaximum(binMaxValLayer);
//fill each "bin"
Calibration->Project("flagMeanGraph_2D_Layer1","flagNoise:layer", "flagNoise==1", "box");
Calibration->Project("flagMeanGraph_2D_Layer2","flagNoise:layer", "flagNoise==2", "box");
Calibration->Project("flagMeanGraph_2D_Layer3","flagNoise:layer", "flagNoise==3", "box");
Calibration->Project("flagMeanGraph_2D_Layer4","flagNoise:layer", "flagNoise==4", "box");
Calibration->Project("flagMeanGraph_2D_Layer5","flagNoise:layer", "flagNoise==5", "box");
//set appropriate colors
flagMeanGraph_2D_Layer1->SetFillColor(1);//Black for eveything is OK
flagMeanGraph_2D_Layer2->SetFillColor(2);//red for VERY BAD
flagMeanGraph_2D_Layer3->SetFillColor(3);//Green for pretty good
flagMeanGraph_2D_Layer4->SetFillColor(4);//blue for less good
flagMeanGraph_2D_Layer5->SetFillColor(5);
flagMeanLayerCanv->cd();
flagMeanGraph_2D_Layer->GetYaxis()->SetTitle("Flag");
flagMeanGraph_2D_Layer->GetXaxis()->SetTitle("Layer, per Chamber");
//draw original histogram, empty
flagMeanGraph_2D_Layer->Draw("box");
//overlay the individual "bin" graphs
flagMeanGraph_2D_Layer1->Draw("samebox");
flagMeanGraph_2D_Layer2->Draw("samebox");
flagMeanGraph_2D_Layer3->Draw("samebox");
flagMeanGraph_2D_Layer4->Draw("samebox");
flagMeanGraph_2D_Layer5->Draw("samebox");
flagMeanGraph_2D_Layer6->Draw("samebox");
//set legend entries appropriately
LegMeanLayer->AddEntry(flagMeanGraph_2D_Layer1, "1: Normal Pedestal", "f");
LegMeanLayer->AddEntry(flagMeanGraph_2D_Layer2, "2: Low Failure", "f");
LegMeanLayer->AddEntry(flagMeanGraph_2D_Layer3, "3: Low Warning", "f");
LegMeanLayer->AddEntry(flagMeanGraph_2D_Layer4, "4: High Warning", "f");
LegMeanLayer->AddEntry(flagMeanGraph_2D_Layer5, "5: High Failure", "f");
LegMeanChamber->Draw("same");
PrintAsGif(flagMeanLayerCanv, "flagMeanLayer");
gSystem->cd("../../../");
gStyle->SetOptStat(1);
}
void PulseGraphs(TString myFileName, TString myFilePath){
TFile *myfile = TFile::Open(myFilePath);
std::cout << "begginng of PulseGraphs, now in : " << gSystem->pwd() << std::endl;
std::cout << "opening file: " << myFilePath << std::endl;
gSystem->cd("/afs/cern.ch/cms/CSC/html/csccalib/");
gSystem->cd("images/Crosstalk");
gSystem->cd(myFileName);
makeDirectory("PulseGraphs");
TCanvas *canv_pulse;
TH2F *gPulse;
TString cname="Pulse_Graph_all_chambers";
TString ctitle="Pulse Graph over all Chambers";
canv_pulse = new TCanvas(cname,ctitle,1100,700);
gPulse = (TH2F*)myfile->Get("pulse");
gPulse->GetXaxis()->SetLabelSize(0.07);
gPulse->GetYaxis()->SetLabelSize(0.07);
gPulse->GetXaxis()->SetTitleSize(0.07);
gPulse->GetXaxis()->SetTitleOffset(0.7);
gPulse->GetXaxis()->SetTitle("Time (ns)");
gPulse->GetYaxis()->SetTitle("ADC Count");
canv_pulse->cd();
gPulse->Draw();
/*
int idArray[9];
GetChamberIDs(idArray);
for (int cham_num=0; cham_num<nCham; ++cham_num){
int NStrips = 0;
int nCFEB = 0;
//dummy graph to retrieve number of strips, to set graph accordingly
TCanvas *StripEntryCanvas = new TCanvas("StripDummyCanvas", "StripDummyCanvas");
TH1F *StripEntryDummy = new TH1F("StripEntryDummy", "StripEntryDummy",10,0,100);
TString chamVar = Form("cham==%d",cham_num);
StripEntryCanvas->cd();
Calibration->Draw("strip>>StripEntryDummy", chamVar);
//number of strips in a given chamber. should be 480 for 5 CFEBs or 384 for 4 CFEBs
NStrips= StripEntryDummy->GetEntries();
TString cname = Form("Chamber_%d_Pulse_Graphs",idArray[cham_num]);
//TString cname = Form("Chamber_%d_Pulse_Graphs",cham_num);
TString ctitle = Form("Pulse for Chamber %d",idArray[cham_num]);
//TString ctitle = Form("Pulse for Chamber %d",cham_num);
canv_pulse = new TCanvas(cname,ctitle,1100,700);
if (NStrips==480){
nCFEB=6;
canv_pulse->Divide(2,3);
}if (NStrips==384){
nCFEB=5;
canv_pulse->Divide(2,2);
}
for (int CFEB_num=1; CFEB_num<nCFEB; ++CFEB_num){
TString graphname= Form("pulse%d%d",cham_num,CFEB_num);
canv_pulse->cd(CFEB_num);
pulse = (TH2F*)myfile->Get(graphname);
pulse->GetXaxis()->SetLabelSize(0.07);
pulse->GetYaxis()->SetLabelSize(0.07);
pulse->GetXaxis()->SetTitleSize(0.07);
pulse->GetXaxis()->SetTitleOffset(0.7);
pulse->GetXaxis()->SetTitle("Time (ns)");
pulse->GetYaxis()->SetTitle("ADC Count");
pulse->Draw();
}//for CFEB
}//for cham
*/
gSystem->cd("PulseGraphs");
TString PulseGraphCanvName = canv_pulse->GetName();
PrintAsGif(canv_pulse,PulseGraphCanvName);
gSystem->cd("/afs/cern.ch/user/c/csccalib/scratch0/CMSSW_1_5_1/src/OnlineDB/CSCCondDB/test");
directoryCheck();
myfile->Close();
}//PulseGraphs()
void PeakGraphs(TString myFileName, TString myFilePath, int nCham){
std::cout << "begginng of PeakGraphs, now in : " << gSystem->pwd() << std::endl;
std::cout << "opening file: " << myFilePath << std::endl;
gSystem->cd("/afs/cern.ch/cms/CSC/html/csccalib/");
gSystem->cd("images/Crosstalk");
gSystem->cd(myFileName);
makeDirectory("PeakADCTimingGraphs");
TLine *vert_min_Time = new TLine(250, 0, 250, 200);
TLine *vert_max_Time = new TLine(360, 0, 360, 200);
TLine *vert_min_ADC = new TLine(700, 0, 700, 200);
TLine *vert_max_ADC = new TLine(1200, 0, 1200, 200);
vert_min_Time->SetLineStyle(3);//dotted
vert_min_Time->SetLineColor(6);//red
vert_min_Time->SetLineWidth(2);//visible but not overwhelming width
vert_max_Time->SetLineStyle(3);//dotted
vert_max_Time->SetLineColor(6);//red
vert_max_Time->SetLineWidth(2);//visible but not overwhelming width
vert_min_ADC->SetLineStyle(3);//dotted
vert_min_ADC->SetLineColor(6);//red
vert_min_ADC->SetLineWidth(2);//visible but not overwhelming width
vert_max_ADC->SetLineStyle(3);//dotted
vert_max_ADC->SetLineColor(6);//red
vert_max_ADC->SetLineWidth(2);//visible but not overwhelming width
//Time and ADC Graphs for everything
TCanvas *PeakCanv = new TCanvas("Peak Timing", "Peak Time and ADC for all Chambers", 200, 10, 1200, 800);
PeakCanv->Divide(2,1);
PeakCanv->SetCanvasSize(1200,800);
PeakCanv->cd(1);
TH1F *PeakADC = new TH1F("PeakADC", "Peak ADC over all Chambers", 100, 600, 1400);
PeakADC->Draw();
PeakADC->GetXaxis()->SetTitle("ADC Count at Peak Time");
PeakADC->GetXaxis()->SetTitleSize(0.070);
PeakADC->GetXaxis()->SetTitleOffset(0.5);
Calibration->Project("PeakADC", "maxADC");
Double_t yMaxValADC = PeakADC->GetMaximum();
Double_t yMaxRanADC = yMaxValADC + (yMaxValADC*.1);
vert_max_ADC->SetY2(yMaxRanADC);
vert_min_ADC->SetY2(yMaxRanADC);
PeakADC->SetAxisRange(0,yMaxRanADC,"Y");
vert_max_ADC->Draw();
vert_min_ADC->Draw();
PeakCanv->cd(2);
TH1F *PeakTime = new TH1F("PeakTime", "Peak Time over all Chambers", 100, 200, 400);
PeakTime->Draw();
PeakTime->GetXaxis()->SetTitle("Peak Time (ns)");
PeakTime->GetXaxis()->SetTitleSize(0.070);
PeakTime->GetXaxis()->SetTitleOffset(0.5);
Calibration->Project("PeakTime", "peakTime");
Double_t yMaxValTime = PeakTime->GetMaximum();
Double_t yMaxRanTime = yMaxValTime + (yMaxValTime*.1);
vert_max_Time->SetY2(yMaxRanTime);
vert_min_Time->SetY2(yMaxRanTime);
PeakTime->SetAxisRange(0,yMaxRanTime,"Y");
vert_max_Time->Draw();
vert_min_Time->Draw();
//take the new line into account
PeakCanv->Update();
PrintAsGif(PeakCanv, "PeakTimingADC");
///Time and ADC Graphs per chamber
TObjArray PeakGraphCanvArray(nCham);
TH1F *PeakADCGraphs[9];
TH1F *PeakTimeGraphs[9];
int idArray[9];
GetChamberIDs(idArray);
for (int cham_num=0; cham_num < nCham; ++cham_num){
gSystem->cd("PeakADCTimingGraphs");
Int_t chamber_id_int = idArray[cham_num];
Float_t MaxPeakTimeVal = Calibration->GetLeaf("MaxPeakTime")->GetValue(cham_num);
Float_t MinPeakTimeVal = Calibration->GetLeaf("MinPeakTime")->GetValue(cham_num);
Float_t MaxPeakADCVal = Calibration->GetLeaf("MaxPeakADC")->GetValue(cham_num);
Float_t MinPeakADCVal = Calibration->GetLeaf("MinPeakADC")->GetValue(cham_num);
Float_t MaxPeakTimeValue = MaxPeakTimeVal + (.1)*MaxPeakTimeVal;
if (MaxPeakTimeValue < 400.0){
MaxPeakTimeValue = 400.0;
}
Float_t MinPeakTimeValue = MinPeakTimeVal + (.1)*MinPeakTimeVal;
if (MinPeakTimeValue > 200.0){
MinPeakTimeValue = 200.0;
}
Float_t MaxPeakADCValue = MaxPeakADCVal + (.1)*MaxPeakADCVal;
if (MaxPeakADCValue < 1300.0){
MaxPeakADCValue = 1300.0;
}
Float_t MinPeakADCValue = MinPeakADCVal + (.1)*MinPeakADCVal;
if (MinPeakADCValue < 600.0){
MinPeakADCValue = 600.0;
}
TString PeakGraphCanvName = Form ("Chamber_%d_Peak_Graphs", chamber_id_int);
TCanvas *canv_peak = new TCanvas(PeakGraphCanvName,PeakGraphCanvName, 200, 10, 1200, 800);
canv_peak->Divide(2,1);
canv_peak->SetCanvasSize(1200,800);
canv_peak->cd(1);
TString hist_name = Form("PeakADCGraph_Chamber_%d", chamber_id_int);
PeakADCGraphs[cham_num] = new TH1F(hist_name, "peakADC Plot", 50, MinPeakADCValue, MaxPeakADCValue);
PeakADCGraphs[cham_num]->Draw();
TString xTitleName = Form("ADC Count at Peak Time for chamber %d", chamber_id_int);
PeakADCGraphs[cham_num]->GetXaxis()->SetTitle(xTitleName);
PeakADCGraphs[cham_num]->GetXaxis()->SetTitleSize(0.050);
PeakADCGraphs[cham_num]->GetXaxis()->SetTitleOffset(0.5);
const char value[7];
sprintf(value, "cham==%d", cham_num);
const char *value_ = value;
Calibration->Project(hist_name, "maxADC", value_);
Double_t yMaxValADC = PeakADCGraphs[cham_num]->GetMaximum();
Double_t yMaxRanADC = yMaxValADC + (yMaxValADC*.1);
vert_max_ADC->SetY2(yMaxRanADC);
vert_min_ADC->SetY2(yMaxRanADC);
PeakADCGraphs[cham_num]->SetAxisRange(0,yMaxRanADC,"Y");
vert_max_ADC->Draw();
vert_min_ADC->Draw();
canv_peak->cd(2);
TString hist_name_ = Form("PeakTimeGraph_Chamber_%d", chamber_id_int);
PeakTimeGraphs[cham_num] = new TH1F(hist_name_, "peakTime Plot", 50, MinPeakTimeValue, MaxPeakTimeValue);
PeakTimeGraphs[cham_num]->Draw();
PeakTimeGraphs[cham_num]->GetXaxis()->SetTitle("Peak Time in nano seconds");
PeakTimeGraphs[cham_num]->GetXaxis()->SetTitleSize(0.070);
PeakTimeGraphs[cham_num]->GetXaxis()->SetTitleOffset(0.5);
const char valu[7];
sprintf(valu, "cham==%d", cham_num);
const char *valu_ = valu;
Calibration->Project(hist_name_, "peakTime", valu_);
Double_t yMaxValTime = PeakTimeGraphs[cham_num]->GetMaximum();
Double_t yMaxRanTime = yMaxValTime + (yMaxValTime*.1);
vert_max_Time->SetY2(yMaxRanTime);
vert_min_Time->SetY2(yMaxRanTime);
PeakTimeGraphs[cham_num]->SetAxisRange(0,yMaxRanTime,"Y");
vert_max_Time->Draw();
vert_min_Time->Draw();
canv_peak->Update();
PeakGraphCanvArray.Add(canv_peak);
PrintAsGif(canv_peak, PeakGraphCanvName);
}//for chamber
gSystem->cd("/afs/cern.ch/user/c/csccalib/scratch0/CMSSW_1_5_1/src/OnlineDB/CSCCondDB/test");
directoryCheck();
}//PeakGraphs
|
31e1c44bfb51c878d14ab8c3c4cc6a891e54b2d3
|
89db60818afeb3dc7c3b7abe9ceae155f074f7f2
|
/src/libString/s_grow.c
|
62cda996c1972cc0208bef0397b80bcb3e1091cf
|
[
"bzip2-1.0.6",
"LPL-1.02",
"MIT"
] |
permissive
|
9fans/plan9port
|
63c3d01928c6f8a8617d3ea6ecc05bac72391132
|
65c090346a38a8c30cb242d345aa71060116340c
|
refs/heads/master
| 2023-08-25T17:14:26.233105
| 2023-08-23T13:21:37
| 2023-08-23T18:47:08
| 26,095,474
| 1,645
| 468
|
NOASSERTION
| 2023-09-05T16:55:41
| 2014-11-02T22:40:13
|
C
|
UTF-8
|
C
| false
| false
| 563
|
c
|
s_grow.c
|
#include <u.h>
#include <libc.h>
#include "libString.h"
/* grow a String's allocation by at least `incr' bytes */
extern String*
s_grow(String *s, int incr)
{
char *cp;
int size;
if(s->fixed)
sysfatal("s_grow of constant string");
s = s_unique(s);
/*
* take a larger increment to avoid mallocing too often
*/
size = s->end-s->base;
if(size/2 < incr)
size += incr;
else
size += size/2;
cp = realloc(s->base, size);
if (cp == 0)
sysfatal("s_grow: %r");
s->ptr = (s->ptr - s->base) + cp;
s->end = cp + size;
s->base = cp;
return s;
}
|
fa0956c8168ad8b6652db8293498bb04e7f4faf4
|
321d11eaee885ceb3a74db0a062f9bbdf282148c
|
/providers/implementations/macs/blake2b_mac.c
|
b445cbd57875ec0918a471c866e8613e1247b0ec
|
[
"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
| 1,220
|
c
|
blake2b_mac.c
|
/*
* Copyright 2018-2021 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
*/
/* Constants */
#define BLAKE2_CTX BLAKE2B_CTX
#define BLAKE2_PARAM BLAKE2B_PARAM
#define BLAKE2_KEYBYTES BLAKE2B_KEYBYTES
#define BLAKE2_OUTBYTES BLAKE2B_OUTBYTES
#define BLAKE2_PERSONALBYTES BLAKE2B_PERSONALBYTES
#define BLAKE2_SALTBYTES BLAKE2B_SALTBYTES
#define BLAKE2_BLOCKBYTES BLAKE2B_BLOCKBYTES
/* Function names */
#define BLAKE2_PARAM_INIT ossl_blake2b_param_init
#define BLAKE2_INIT_KEY ossl_blake2b_init_key
#define BLAKE2_UPDATE ossl_blake2b_update
#define BLAKE2_FINAL ossl_blake2b_final
#define BLAKE2_PARAM_SET_DIGEST_LENGTH ossl_blake2b_param_set_digest_length
#define BLAKE2_PARAM_SET_KEY_LENGTH ossl_blake2b_param_set_key_length
#define BLAKE2_PARAM_SET_PERSONAL ossl_blake2b_param_set_personal
#define BLAKE2_PARAM_SET_SALT ossl_blake2b_param_set_salt
/* OSSL_DISPATCH symbol */
#define BLAKE2_FUNCTIONS ossl_blake2bmac_functions
#include "blake2_mac_impl.c"
|
bab05bd1cd2432b10b920ff4b83d476a326229ac
|
fbe68d84e97262d6d26dd65c704a7b50af2b3943
|
/third_party/virtualbox/src/VBox/Additions/x11/vboxvideo/setmode.c
|
7dc598965c525ca17bfb943b6e59339fc3f0582d
|
[
"MIT",
"GPL-2.0-only",
"LicenseRef-scancode-unknown-license-reference",
"CDDL-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"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
| 5,705
|
c
|
setmode.c
|
/* $Id: setmode.c $ */
/** @file
* Linux Additions X11 graphics driver, mode setting
*/
/*
* Copyright (C) 2006-2017 Oracle Corporation
*
* This file is based on X11 VESA driver (hardly any traces left here):
*
* Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
*
* 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Conectiva Linux shall
* not be used in advertising or otherwise to promote the sale, use or other
* dealings in this Software without prior written authorization from
* Conectiva Linux.
*
* Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
* Michael Thayer <michael.thayer@oracle.com>
*/
#ifdef XORG_7X
/* We include <unistd.h> for Solaris below, and the ANSI C emulation layer
* interferes with that. */
# define _XF86_ANSIC_H
# define XF86_LIBC_H
# include <string.h>
#endif
#include "vboxvideo.h"
#include "xf86.h"
/* VGA hardware functions for setting and restoring text mode */
#include "vgaHW.h"
#ifdef RT_OS_SOLARIS
# include <sys/vuid_event.h>
# include <sys/msio.h>
# include <errno.h>
# include <fcntl.h>
# include <unistd.h>
#endif
/** Clear the virtual framebuffer in VRAM. Optionally also clear up to the
* size of a new framebuffer. Framebuffer sizes larger than available VRAM
* be treated as zero and passed over. */
void vbvxClearVRAM(ScrnInfoPtr pScrn, size_t cbOldSize, size_t cbNewSize)
{
VBOXPtr pVBox = VBOXGetRec(pScrn);
/* Assume 32BPP - this is just a sanity test. */
AssertMsg( cbOldSize / 4 <= VBOX_VIDEO_MAX_VIRTUAL * VBOX_VIDEO_MAX_VIRTUAL
&& cbNewSize / 4 <= VBOX_VIDEO_MAX_VIRTUAL * VBOX_VIDEO_MAX_VIRTUAL,
("cbOldSize=%llu cbNewSize=%llu, max=%u.\n", (unsigned long long)cbOldSize, (unsigned long long)cbNewSize,
VBOX_VIDEO_MAX_VIRTUAL * VBOX_VIDEO_MAX_VIRTUAL));
if (cbOldSize > (size_t)pVBox->cbFBMax)
cbOldSize = pVBox->cbFBMax;
if (cbNewSize > (size_t)pVBox->cbFBMax)
cbNewSize = pVBox->cbFBMax;
memset(pVBox->base, 0, max(cbOldSize, cbNewSize));
}
/** Set a graphics mode. Poke any required values into registers, do an HGSMI
* mode set and tell the host we support advanced graphics functions.
*/
void vbvxSetMode(ScrnInfoPtr pScrn, unsigned cDisplay, unsigned cWidth, unsigned cHeight, int x, int y, Bool fEnabled,
Bool fConnected, struct vbvxFrameBuffer *pFrameBuffer)
{
VBOXPtr pVBox = VBOXGetRec(pScrn);
uint32_t offStart;
uint16_t fFlags;
int rc;
Bool fEnabledAndVisible = fEnabled && x + cWidth <= pFrameBuffer->cWidth && y + cHeight <= pFrameBuffer->cHeight;
/* Recent host code has a flag to blank the screen; older code needs BPP set to zero. */
uint32_t cBPP = fEnabledAndVisible || pVBox->fHostHasScreenBlankingFlag ? pFrameBuffer->cBPP : 0;
TRACE_LOG("cDisplay=%u, cWidth=%u, cHeight=%u, x=%d, y=%d, fEnabled=%d, fConnected=%d, pFrameBuffer: { x0=%d, y0=%d, cWidth=%u, cHeight=%u, cBPP=%u }\n",
cDisplay, cWidth, cHeight, x, y, fEnabled, fConnected, pFrameBuffer->x0, pFrameBuffer->y0, pFrameBuffer->cWidth,
pFrameBuffer->cHeight, pFrameBuffer->cBPP);
AssertMsg(cWidth != 0 && cHeight != 0, ("cWidth = 0 or cHeight = 0\n"));
offStart = (y * pFrameBuffer->cWidth + x) * pFrameBuffer->cBPP / 8;
if (cDisplay == 0 && fEnabled)
VBoxVideoSetModeRegisters(cWidth, cHeight, pFrameBuffer->cWidth, pFrameBuffer->cBPP, 0, x, y);
fFlags = VBVA_SCREEN_F_ACTIVE;
fFlags |= (fConnected ? 0 : VBVA_SCREEN_F_DISABLED);
fFlags |= (!fEnabledAndVisible && pVBox->fHostHasScreenBlankingFlag ? VBVA_SCREEN_F_BLANK : 0);
VBoxHGSMIProcessDisplayInfo(&pVBox->guestCtx, cDisplay, x - pFrameBuffer->x0, y - pFrameBuffer->y0, offStart,
pFrameBuffer->cWidth * pFrameBuffer->cBPP / 8, cWidth, cHeight, cBPP, fFlags);
rc = VBoxHGSMIUpdateInputMapping(&pVBox->guestCtx, 0 - pFrameBuffer->x0, 0 - pFrameBuffer->y0, pFrameBuffer->cWidth,
pFrameBuffer->cHeight);
if (RT_FAILURE(rc))
FatalError("Failed to update the input mapping.\n");
}
/** Tell the virtual mouse device about the new virtual desktop size. */
void vbvxSetSolarisMouseRange(int width, int height)
{
#ifdef RT_OS_SOLARIS
int rc;
int hMouse = open("/dev/mouse", O_RDWR);
if (hMouse >= 0)
{
do {
Ms_screen_resolution Res = { height, width };
rc = ioctl(hMouse, MSIOSRESOLUTION, &Res);
} while ((rc != 0) && (errno == EINTR));
close(hMouse);
}
#else
(void)width; (void)height;
#endif
}
|
25a8bc079a8244cb36892b0f4d3ca9fd35976b06
|
0cc343d927d5db6693006018986715c43acab961
|
/examples/crypto_ccs/symbolic_model/src/data_item.c
|
e1f6f3df81b03b998176090eb3a6b4172ed61765
|
[
"MIT"
] |
permissive
|
verifast/verifast
|
ec0101fc4a69bd33c5f66be4444169c4e060ead8
|
d152da790c7ebf72ce616533a6c83082629adbdb
|
refs/heads/master
| 2023-08-25T00:13:51.464802
| 2023-08-13T10:00:00
| 2023-08-13T10:00:00
| 14,519,163
| 325
| 64
|
NOASSERTION
| 2023-08-10T21:16:08
| 2013-11-19T08:57:02
|
OCaml
|
UTF-8
|
C
| false
| false
| 4,563
|
c
|
data_item.c
|
#include "data_item.h"
#include "item_constraints.h"
bool is_data(struct item *item)
//@ requires [?f]world(?pub, ?key_clsfy) &*& item(item, ?i, pub);
/*@ ensures [f]world(pub, key_clsfy) &*& item(item, i, pub) &*&
result ? i == data_item(_) : true; @*/
{
//@ open [f]world(pub, key_clsfy);
//@ open item(item, i, pub);
//@ open [_]item_constraints(i, ?cs, pub);
return item_tag(item->content, item->size) == 'a';
//@ close item(item, i, pub);
//@ close [f]world(pub, key_clsfy);
}
void check_is_data(struct item *item)
//@ requires [?f]world(?pub, ?key_clsfy) &*& item(item, ?i, pub);
/*@ ensures [f]world(pub, key_clsfy) &*& item(item, i, pub) &*&
i == data_item(_); @*/
{
if (!is_data(item))
abort_crypto_lib("Presented item is not a data item");
}
struct item *create_data_item(char* data, int length)
/*@ requires [?f]world(?pub, ?key_clsfy) &*&
chars(data, length, ?cs_data) &*& length >= MIN_DATA_SIZE; @*/
/*@ ensures [f]world(pub, key_clsfy) &*&
chars(data, length, cs_data) &*&
item(result, data_item(cs_data), pub); @*/
{
//@ open [f]world(pub, key_clsfy);
struct item* item = malloc(sizeof(struct item));
if (item == 0){abort_crypto_lib("malloc of item failed");}
if (length >= INT_MAX - TAG_LENGTH) abort_crypto_lib("Requested data item was to big");
item->size = TAG_LENGTH + length;
item->content = malloc_wrapper(item->size);
//@ assert item->content |-> ?cont &*& item->size |-> ?size;
write_tag(item->content, TAG_DATA);
//@ chars_to_crypto_chars(data, length);
crypto_memcpy(item->content + TAG_LENGTH, data, (unsigned int) length);
//@ cs_to_ccs_crypto_chars(data, cs_data);
//@ cs_to_ccs_crypto_chars(cont + TAG_LENGTH, cs_data);
//@ item d = data_item(cs_data);
//@ assert chars(cont + TAG_LENGTH, length, cs_data);
//@ chars_to_secret_crypto_chars(cont + TAG_LENGTH, length);
//@ public_cs(full_tag(TAG_DATA));
//@ public_cs(cs_data);
//@ cs_to_ccs_full_tag(TAG_DATA);
//@ public_ccs_join(full_ctag(c_to_cc(TAG_DATA)), cs_to_ccs(cs_data));
//@ CLOSE_ITEM_CONSTRAINTS(cont, TAG_DATA, size, d)
//@ close item(item, d, pub);
return item;
//@ close [f]world(pub, key_clsfy);
}
struct item *create_data_item_from_int(int i)
//@ requires [?f]world(?pub, ?key_clsfy);
/*@ ensures [f]world(pub, key_clsfy) &*&
item(result, data_item(chars_of_int(i)), pub); @*/
{
char* temp = (void*) &i;
//@ integer_to_chars(temp);
return create_data_item(temp, (int) sizeof(int));
//@ chars_to_integer(temp);
}
int item_get_data(struct item *item, char** data)
/*@ requires [?f]world(?pub, ?key_clsfy) &*& item(item, ?i, pub) &*&
i == data_item(?cs0) &*& pointer(data, _); @*/
/*@ ensures [f]world(pub, key_clsfy) &*& item(item, i, pub) &*& pointer(data, ?p) &*&
chars(p, result, ?cs1) &*& malloc_block(p, result) &*&
col || cs0 == cs1; @*/
{
//@ open [f]world(pub, key_clsfy);
//@ open item(item, data_item(cs0), pub);
//@ assert item->content |-> ?cont &*& item->size |-> ?size;
//@ assert [_]item_constraints(i, ?ccs, pub);
//@ OPEN_ITEM_CONSTRAINTS(i, ccs, pub)
int data_size = item->size - TAG_LENGTH;
//@ crypto_chars_limits(cont);
//@ crypto_chars_split(cont, TAG_LENGTH);
char* temp = malloc_wrapper(data_size);
//@ public_ccs_split(ccs, TAG_LENGTH);
//@ public_crypto_chars(cont + TAG_LENGTH, data_size);
//@ assert chars(cont + TAG_LENGTH, data_size, ?cs_data);
//@ cs_to_ccs_inj(cs0, cs_data);
//@ chars_to_crypto_chars(cont + TAG_LENGTH, data_size);
crypto_memcpy(temp, (void*) item->content + TAG_LENGTH, (unsigned int) data_size);
//@ cs_to_ccs_crypto_chars(temp, cs_data);
//@ cs_to_ccs_crypto_chars(cont + TAG_LENGTH, cs_data);
//@ chars_to_secret_crypto_chars(cont + TAG_LENGTH, data_size);
//@ crypto_chars_join(cont);
//@ close item(item, data_item(cs0), pub);
*data = temp;
return data_size;
//@ close [f]world(pub, key_clsfy);
}
int item_get_data_as_int(struct item *item)
/*@ requires [?f]world(?pub, ?key_clsfy) &*& item(item, ?i, pub) &*&
i == data_item(?cs0); @*/
/*@ ensures [f]world(pub, key_clsfy) &*& item(item, i, pub) &*&
col ? true : result == int_of_chars(cs0); @*/
{
int result;
char* data;
int size = item_get_data(item, &data);
if (size != (int) sizeof(int)) abort();
//@ chars_to_integer(data);
result = *((int*) ((void*) data));
//@ integer_to_chars(data);
free(data);
return result;
}
|
46630eabbe6ff943a5529c2f81066a8358d9277d
|
bb773aadd819255fe61fd6d8ab002088cdb25593
|
/platform/rp2040/usb/usb.h
|
fde361a32b57e150d0ef9ed6a7c26e8e43e3d3ef
|
[] |
permissive
|
ataradov/free-dap
|
3e86258e7e2504ed1e37ec4be92cd2fb05fc8628
|
e7752beb5e8a69119af67b70b9179cb3c90f3ac5
|
refs/heads/master
| 2023-08-09T01:35:34.204432
| 2022-08-07T20:55:33
| 2022-08-07T20:55:33
| 63,569,985
| 172
| 50
|
BSD-3-Clause
| 2023-07-23T18:30:07
| 2016-07-18T04:23:30
|
C
|
UTF-8
|
C
| false
| false
| 1,109
|
h
|
usb.h
|
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2016-2022, Alex Taradov <alex@taradov.com>. All rights reserved.
#ifndef _USB_H_
#define _USB_H_
/*- Includes ----------------------------------------------------------------*/
#include <stdint.h>
#include <stdbool.h>
#include "usb_descriptors.h"
/*- Prototypes --------------------------------------------------------------*/
void usb_hw_init(void);
void usb_attach(void);
void usb_detach(void);
void usb_configure_endpoint(usb_endpoint_descriptor_t *ep_desc);
bool usb_endpoint_configured(int ep, int dir);
int usb_endpoint_get_status(int ep, int dir);
void usb_endpoint_set_feature(int ep, int dir);
void usb_endpoint_clear_feature(int ep, int dir);
void usb_set_address(int address);
void usb_send(int ep, uint8_t *data, int size);
void usb_recv(int ep, uint8_t *data, int size);
void usb_control_send_zlp(void);
void usb_control_stall(void);
void usb_control_send(uint8_t *data, int size);
void usb_control_recv(void (*callback)(uint8_t *data, int size));
void usb_task(void);
void usb_configuration_callback(int config);
#endif // _USB_H_
|
38093beea35d73ed159b9f126a0f33f13f843755
|
5eff7a36d9a9917dce9111f0c3074375fe6f7656
|
/lib/mesa/src/gallium/frontends/xa/xa_yuv.c
|
ac381b459459ff437cd7c228d62473fe4ac0aac2
|
[
"MIT"
] |
permissive
|
openbsd/xenocara
|
cb392d02ebba06f6ff7d826fd8a89aa3b8401779
|
a012b5de33ea0b977095d77316a521195b26cc6b
|
refs/heads/master
| 2023-08-25T12:16:58.862008
| 2023-08-12T16:16:25
| 2023-08-12T16:16:25
| 66,967,384
| 177
| 66
| null | 2023-07-22T18:12:37
| 2016-08-30T18:36:01
|
C
|
UTF-8
|
C
| false
| false
| 4,925
|
c
|
xa_yuv.c
|
/**********************************************************
* Copyright 2009-2011 VMware, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*********************************************************
* Authors:
* Zack Rusin <zackr-at-vmware-dot-com>
* Thomas Hellstrom <thellstrom-at-vmware-dot-com>
*/
#include "xa_context.h"
#include "xa_priv.h"
#include "util/u_inlines.h"
#include "util/u_sampler.h"
#include "util/u_surface.h"
#include "cso_cache/cso_context.h"
static void
xa_yuv_bind_blend_state(struct xa_context *r)
{
struct pipe_blend_state blend;
memset(&blend, 0, sizeof(struct pipe_blend_state));
blend.rt[0].blend_enable = 0;
blend.rt[0].colormask = PIPE_MASK_RGBA;
/* porter&duff src */
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
cso_set_blend(r->cso, &blend);
}
static void
xa_yuv_bind_shaders(struct xa_context *r)
{
unsigned vs_traits = 0, fs_traits = 0;
struct xa_shader shader;
vs_traits |= VS_YUV;
fs_traits |= FS_YUV;
shader = xa_shaders_get(r->shaders, vs_traits, fs_traits);
cso_set_vertex_shader_handle(r->cso, shader.vs);
cso_set_fragment_shader_handle(r->cso, shader.fs);
}
static void
xa_yuv_bind_samplers(struct xa_context *r, struct xa_surface *yuv[])
{
struct pipe_sampler_state *samplers[3];
struct pipe_sampler_state sampler;
struct pipe_sampler_view view_templ;
unsigned int i;
memset(&sampler, 0, sizeof(struct pipe_sampler_state));
sampler.wrap_s = PIPE_TEX_WRAP_CLAMP;
sampler.wrap_t = PIPE_TEX_WRAP_CLAMP;
sampler.min_img_filter = PIPE_TEX_FILTER_LINEAR;
sampler.mag_img_filter = PIPE_TEX_FILTER_LINEAR;
sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
for (i = 0; i < 3; ++i) {
samplers[i] = &sampler;
u_sampler_view_default_template(&view_templ, yuv[i]->tex,
yuv[i]->tex->format);
r->bound_sampler_views[i] =
r->pipe->create_sampler_view(r->pipe, yuv[i]->tex, &view_templ);
}
r->num_bound_samplers = 3;
cso_set_samplers(r->cso, PIPE_SHADER_FRAGMENT, 3, (const struct pipe_sampler_state **)samplers);
r->pipe->set_sampler_views(r->pipe, PIPE_SHADER_FRAGMENT, 0, 3, 0, false, r->bound_sampler_views);
}
static void
xa_yuv_fs_constants(struct xa_context *r, const float conversion_matrix[])
{
const int param_bytes = 16 * sizeof(float);
renderer_set_constants(r, PIPE_SHADER_FRAGMENT,
conversion_matrix, param_bytes);
}
XA_EXPORT int
xa_yuv_planar_blit(struct xa_context *r,
int src_x,
int src_y,
int src_w,
int src_h,
int dst_x,
int dst_y,
int dst_w,
int dst_h,
struct xa_box *box,
unsigned int num_boxes,
const float conversion_matrix[],
struct xa_surface *dst, struct xa_surface *yuv[])
{
float scale_x;
float scale_y;
int ret;
if (dst_w == 0 || dst_h == 0)
return XA_ERR_NONE;
ret = xa_ctx_srf_create(r, dst);
if (ret != XA_ERR_NONE)
return -XA_ERR_NORES;
renderer_bind_destination(r, r->srf);
xa_yuv_bind_blend_state(r);
xa_yuv_bind_shaders(r);
xa_yuv_bind_samplers(r, yuv);
xa_yuv_fs_constants(r, conversion_matrix);
scale_x = (float)src_w / (float)dst_w;
scale_y = (float)src_h / (float)dst_h;
while (num_boxes--) {
int x = box->x1;
int y = box->y1;
int w = box->x2 - box->x1;
int h = box->y2 - box->y1;
xa_scissor_update(r, x, y, box->x2, box->y2);
renderer_draw_yuv(r,
(float)src_x + scale_x * (x - dst_x),
(float)src_y + scale_y * (y - dst_y),
scale_x * w, scale_y * h, x, y, w, h, yuv);
box++;
}
xa_context_flush(r);
xa_ctx_sampler_views_destroy(r);
xa_ctx_srf_destroy(r);
return XA_ERR_NONE;
}
|
c40c7e68efaf9876d4893097296ec9f4387b49f1
|
a831bb046bdc40567682f01f2dc8e73a3803120e
|
/libs/mpf/src/mpf_engine_factory.c
|
2cea7484e494cb17e14940edce14f5e070f60b8b
|
[
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"LGPL-2.1-or-later"
] |
permissive
|
unispeech/unimrcp
|
5d9567c63d849c0e50bf0ee7b11259a798648d3e
|
9913f23691b3a1b8a7e84be5ba25478031352158
|
refs/heads/master
| 2023-08-05T08:22:40.918060
| 2023-08-01T17:35:29
| 2023-08-01T17:35:29
| 38,894,063
| 363
| 159
|
Apache-2.0
| 2023-05-17T12:50:27
| 2015-07-10T17:49:42
|
C
|
UTF-8
|
C
| false
| false
| 2,549
|
c
|
mpf_engine_factory.c
|
/*
* Copyright 2008-2015 Arsen Chaloyan
*
* 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 <apr_tables.h>
#include "mpf_engine_factory.h"
#include "mpf_termination_factory.h"
/** Factory of media engines */
struct mpf_engine_factory_t {
/** Array of pointers to media engines */
apr_array_header_t *engines_arr;
/** Index of the current engine */
int index;
};
/** Create factory of media engines. */
MPF_DECLARE(mpf_engine_factory_t*) mpf_engine_factory_create(apr_pool_t *pool)
{
mpf_engine_factory_t *mpf_factory = apr_palloc(pool,sizeof(mpf_engine_factory_t));
mpf_factory->engines_arr = apr_array_make(pool,1,sizeof(mpf_engine_t*));
mpf_factory->index = 0;
return mpf_factory;
}
/** Add media engine to factory. */
MPF_DECLARE(apt_bool_t) mpf_engine_factory_engine_add(mpf_engine_factory_t *mpf_factory, mpf_engine_t *media_engine)
{
mpf_engine_t **slot;
if(!media_engine)
return FALSE;
slot = apr_array_push(mpf_factory->engines_arr);
*slot = media_engine;
return TRUE;
}
/** Determine whether factory is empty. */
MPF_DECLARE(apt_bool_t) mpf_engine_factory_is_empty(const mpf_engine_factory_t *mpf_factory)
{
return apr_is_empty_array(mpf_factory->engines_arr);
}
/** Select next available media engine. */
MPF_DECLARE(mpf_engine_t*) mpf_engine_factory_engine_select(mpf_engine_factory_t *mpf_factory)
{
mpf_engine_t *media_engine = APR_ARRAY_IDX(mpf_factory->engines_arr, mpf_factory->index, mpf_engine_t*);
if(++mpf_factory->index == mpf_factory->engines_arr->nelts) {
mpf_factory->index = 0;
}
return media_engine;
}
/** Associate media engines with RTP termination factory. */
MPF_DECLARE(apt_bool_t) mpf_engine_factory_rtp_factory_assign(mpf_engine_factory_t *mpf_factory, mpf_termination_factory_t *rtp_factory)
{
int i;
mpf_engine_t *media_engine;
for(i=0; i<mpf_factory->engines_arr->nelts; i++) {
media_engine = APR_ARRAY_IDX(mpf_factory->engines_arr, i, mpf_engine_t*);
mpf_termination_factory_engine_assign(rtp_factory,media_engine);
}
return TRUE;
}
|
73615636218acf3ba82bf7a874f94011373adf9e
|
1e21bfcd7a1a01e609be8ff4ecf959d3e7b048cb
|
/src/cache.c
|
a7e5d0c74b4b21b9136ee1541c07f50cb0016ae1
|
[
"Apache-2.0"
] |
permissive
|
goatshriek/stumpless
|
f3720221824fad9e4b185d6304d82c1530e5317b
|
111796d0afbb75645058a5afe5313cf1a59ba44d
|
refs/heads/latest
| 2023-08-18T05:08:33.694065
| 2023-08-09T01:08:27
| 2023-08-09T01:08:27
| 20,359,440
| 428
| 394
|
Apache-2.0
| 2023-09-04T02:22:31
| 2014-05-31T16:06:34
|
C
|
UTF-8
|
C
| false
| false
| 4,987
|
c
|
cache.c
|
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2018-2020 Joel E. Anderson
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdint.h>
#include <stddef.h>
#include "private/cache.h"
#include "private/config/wrapper/thread_safety.h"
#include "private/memory.h"
static void
init_page( const struct cache *c, size_t page_index ) {
size_t entries_per_page;
size_t i;
char *current_page;
char *locks;
current_page = c->pages[page_index];
entries_per_page = c->page_size / ( c->entry_size + sizeof( char ) );
for( i = 0; i < entries_per_page; i++ ) {
locks = current_page + ( entries_per_page * c->entry_size );
locks[i] = 0;
if( c->entry_init ) {
c->entry_init( current_page + ( i * c->entry_size ) );
}
}
}
static void
teardown_page( const struct cache *c, size_t page_index ) {
size_t entries_per_page;
size_t i;
char *current_page;
char *locks;
current_page = c->pages[page_index];
entries_per_page = c->page_size / ( c->entry_size + sizeof( char ) );
for( i = 0; i < entries_per_page; i++ ) {
locks = current_page + ( entries_per_page * c->entry_size );
locks[i] = 0;
if( c->entry_teardown ) {
c->entry_teardown( current_page + ( i * c->entry_size ) );
}
}
}
static int
add_page( struct cache *c ) {
int new_page_index;
char **new_pages;
char *new_page;
new_pages = realloc_mem( c->pages, sizeof( char * ) * ( c->page_count + 1 ) );
if( !new_pages ) {
return -1;
}
new_page = alloc_mem( c->page_size );
if( !new_page ) {
return -1;
}
new_page_index = c->page_count;
c->page_count++;
c->pages = new_pages;
c->pages[new_page_index] = new_page;
init_page( c, new_page_index );
return new_page_index;
}
void *
cache_alloc( struct cache *c ) {
size_t i;
size_t j;
size_t entries_per_page;
int new_page;
char *current_page;
char *locks;
entries_per_page = c->page_size / ( c->entry_size + sizeof( char ) );
config_lock_mutex( &c->mutex );
for( i = 0; i < c->page_count; i++ ) {
current_page = c->pages[i];
locks = current_page + ( entries_per_page * c->entry_size );
for( j = 0; j < entries_per_page; j++ ) {
if( locks[j] == 0 ) {
locks[j] = 1;
config_unlock_mutex( &c->mutex );
return current_page + ( j * c->entry_size );
}
}
}
new_page = add_page( c );
if( new_page < 0 ) {
config_unlock_mutex( &c->mutex );
return NULL;
}
current_page = c->pages[new_page];
locks = current_page + ( entries_per_page * c->entry_size );
locks[0] = 1;
config_unlock_mutex( &c->mutex );
return current_page;
}
void
cache_destroy( const struct cache *c ) {
size_t i;
if( !c ) {
return;
}
for( i = 0; i < c->page_count; i++ ) {
teardown_page( c, i );
free_mem( c->pages[i] );
}
config_destroy_mutex( &c->mutex );
free_mem( c->pages );
free_mem( c );
}
void
cache_free( const struct cache *c, const void *entry ) {
size_t entry_index;
size_t i;
size_t entries_per_page;
char *current_page;
char *locks;
uintptr_t entry_int;
uintptr_t current_page_int;
entry_int = ( uintptr_t ) entry;
config_lock_mutex( &c->mutex );
for( i = 0; i < c->page_count; i++ ) {
current_page = c->pages[i];
current_page_int = ( uintptr_t ) current_page;
if( entry_int >= current_page_int
&& entry_int < ( current_page_int + c->page_size ) ) {
entries_per_page = c->page_size / ( c->entry_size + sizeof( char ) );
locks = current_page + ( entries_per_page * c->entry_size );
entry_index = ( ( const char * ) entry - current_page ) / c->entry_size;
locks[entry_index] = 0;
config_unlock_mutex( &c->mutex );
return;
}
}
config_unlock_mutex( &c->mutex );
}
struct cache *
cache_new( size_t size,
void ( *entry_init ) ( void * ),
void ( *entry_teardown ) ( void * ) ) {
struct cache *c;
size_t first_page;
c = alloc_mem( sizeof( *c ) );
if( !c ) {
goto fail;
}
c->pages = alloc_mem( sizeof( char * ) );
if( !c->pages ) {
goto fail_pages;
}
c->entry_init = entry_init;
c->entry_teardown = entry_teardown;
c->entry_size = size;
c->page_size = get_paged_size( size );
c->page_count = 0;
config_init_mutex( &c->mutex );
first_page = add_page( c );
if( first_page != 0 ) {
goto fail_add;
}
return c;
fail_add:
free_mem( c->pages );
fail_pages:
free_mem( c );
fail:
return NULL;
}
|
796a84bd66790f2d251ca6864ef1c88db2964a7f
|
f4056b1d5cb2d222f315c7f790ccf14d01436834
|
/glamor/glamor_largepixmap.c
|
57760f8d336ac59567746bb3e1ae1593393aa018
|
[
"SGI-B-2.0",
"ISC",
"LicenseRef-scancode-mit-old-style",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-x11-adobe",
"LicenseRef-scancode-xfree86-1.0",
"HPND-sell-variant",
"ICU",
"MIT-open-group",
"BSD-3-Clause",
"HPND",
"X11-distribute-modifications-variant",
"MIT",
"LicenseRef-scancode-other-permissive",
"X11"
] |
permissive
|
XQuartz/xorg-server
|
cd677ecd115213f5534cc1b06aff6a8c9a3ea733
|
0ea9b595891f2f31915538192961f3404d9ca699
|
refs/heads/master
| 2023-09-05T12:04:27.866042
| 2023-01-18T18:38:41
| 2023-01-26T17:51:16
| 44,375,619
| 287
| 60
|
NOASSERTION
| 2022-12-14T15:56:16
| 2015-10-16T09:29:57
|
C
|
UTF-8
|
C
| false
| false
| 61,595
|
c
|
glamor_largepixmap.c
|
#include <stdlib.h>
#include <stdint.h> /* For INT16_MAX */
#include "glamor_priv.h"
static void
glamor_get_transform_extent_from_box(struct pixman_box32 *box,
struct pixman_transform *transform);
static inline glamor_pixmap_private *
__glamor_large(glamor_pixmap_private *pixmap_priv) {
assert(glamor_pixmap_priv_is_large(pixmap_priv));
return pixmap_priv;
}
/**
* Clip the boxes regards to each pixmap's block array.
*
* Should translate the region to relative coords to the pixmap,
* start at (0,0).
*/
#if 0
//#define DEBUGF(str, ...) do {} while(0)
#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__)
//#define DEBUGRegionPrint(x) do {} while (0)
#define DEBUGRegionPrint RegionPrint
#endif
static glamor_pixmap_clipped_regions *
__glamor_compute_clipped_regions(int block_w,
int block_h,
int block_stride,
int x, int y,
int w, int h,
RegionPtr region,
int *n_region, int reverse, int upsidedown)
{
glamor_pixmap_clipped_regions *clipped_regions;
BoxPtr extent;
int start_x, start_y, end_x, end_y;
int start_block_x, start_block_y;
int end_block_x, end_block_y;
int loop_start_block_x, loop_start_block_y;
int loop_end_block_x, loop_end_block_y;
int loop_block_stride;
int i, j, delta_i, delta_j;
RegionRec temp_region;
RegionPtr current_region;
int block_idx;
int k = 0;
int temp_block_idx;
extent = RegionExtents(region);
start_x = MAX(x, extent->x1);
start_y = MAX(y, extent->y1);
end_x = MIN(x + w, extent->x2);
end_y = MIN(y + h, extent->y2);
DEBUGF("start compute clipped regions:\n");
DEBUGF("block w %d h %d x %d y %d w %d h %d, block_stride %d \n",
block_w, block_h, x, y, w, h, block_stride);
DEBUGRegionPrint(region);
DEBUGF("start_x %d start_y %d end_x %d end_y %d \n", start_x, start_y,
end_x, end_y);
if (start_x >= end_x || start_y >= end_y) {
*n_region = 0;
return NULL;
}
start_block_x = (start_x - x) / block_w;
start_block_y = (start_y - y) / block_h;
end_block_x = (end_x - x) / block_w;
end_block_y = (end_y - y) / block_h;
clipped_regions = calloc((end_block_x - start_block_x + 1)
* (end_block_y - start_block_y + 1),
sizeof(*clipped_regions));
DEBUGF("startx %d starty %d endx %d endy %d \n",
start_x, start_y, end_x, end_y);
DEBUGF("start_block_x %d end_block_x %d \n", start_block_x, end_block_x);
DEBUGF("start_block_y %d end_block_y %d \n", start_block_y, end_block_y);
if (!reverse) {
loop_start_block_x = start_block_x;
loop_end_block_x = end_block_x + 1;
delta_i = 1;
}
else {
loop_start_block_x = end_block_x;
loop_end_block_x = start_block_x - 1;
delta_i = -1;
}
if (!upsidedown) {
loop_start_block_y = start_block_y;
loop_end_block_y = end_block_y + 1;
delta_j = 1;
}
else {
loop_start_block_y = end_block_y;
loop_end_block_y = start_block_y - 1;
delta_j = -1;
}
loop_block_stride = delta_j * block_stride;
block_idx = (loop_start_block_y - delta_j) * block_stride;
for (j = loop_start_block_y; j != loop_end_block_y; j += delta_j) {
block_idx += loop_block_stride;
temp_block_idx = block_idx + loop_start_block_x;
for (i = loop_start_block_x;
i != loop_end_block_x; i += delta_i, temp_block_idx += delta_i) {
BoxRec temp_box;
temp_box.x1 = x + i * block_w;
temp_box.y1 = y + j * block_h;
temp_box.x2 = MIN(temp_box.x1 + block_w, end_x);
temp_box.y2 = MIN(temp_box.y1 + block_h, end_y);
RegionInitBoxes(&temp_region, &temp_box, 1);
DEBUGF("block idx %d \n", temp_block_idx);
DEBUGRegionPrint(&temp_region);
current_region = RegionCreate(NULL, 4);
RegionIntersect(current_region, &temp_region, region);
DEBUGF("i %d j %d region: \n", i, j);
DEBUGRegionPrint(current_region);
if (RegionNumRects(current_region)) {
clipped_regions[k].region = current_region;
clipped_regions[k].block_idx = temp_block_idx;
k++;
}
else
RegionDestroy(current_region);
RegionUninit(&temp_region);
}
}
*n_region = k;
return clipped_regions;
}
/**
* Do a two round clipping,
* first is to clip the region regard to current pixmap's
* block array. Then for each clipped region, do a inner
* block clipping. This is to make sure the final result
* will be shapped by inner_block_w and inner_block_h, and
* the final region also will not cross the pixmap's block
* boundary.
*
* This is mainly used by transformation support when do
* compositing.
*/
glamor_pixmap_clipped_regions *
glamor_compute_clipped_regions_ext(PixmapPtr pixmap,
RegionPtr region,
int *n_region,
int inner_block_w, int inner_block_h,
int reverse, int upsidedown)
{
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_pixmap_clipped_regions *clipped_regions, *inner_regions,
*result_regions;
int i, j, x, y, k, inner_n_regions;
int width, height;
BoxPtr box_array;
BoxRec small_box;
int block_w, block_h;
DEBUGF("ext called \n");
if (glamor_pixmap_priv_is_small(pixmap_priv)) {
clipped_regions = calloc(1, sizeof(*clipped_regions));
if (clipped_regions == NULL) {
*n_region = 0;
return NULL;
}
clipped_regions[0].region = RegionCreate(NULL, 1);
clipped_regions[0].block_idx = 0;
RegionCopy(clipped_regions[0].region, region);
*n_region = 1;
block_w = pixmap->drawable.width;
block_h = pixmap->drawable.height;
box_array = &small_box;
small_box.x1 = small_box.y1 = 0;
small_box.x2 = block_w;
small_box.y2 = block_h;
}
else {
glamor_pixmap_private *priv = __glamor_large(pixmap_priv);
clipped_regions = __glamor_compute_clipped_regions(priv->block_w,
priv->block_h,
priv->block_wcnt,
0, 0,
pixmap->drawable.width,
pixmap->drawable.height,
region, n_region,
reverse, upsidedown);
if (clipped_regions == NULL) {
*n_region = 0;
return NULL;
}
block_w = priv->block_w;
block_h = priv->block_h;
box_array = priv->box_array;
}
if (inner_block_w >= block_w && inner_block_h >= block_h)
return clipped_regions;
result_regions = calloc(*n_region
* ((block_w + inner_block_w - 1) /
inner_block_w)
* ((block_h + inner_block_h - 1) /
inner_block_h), sizeof(*result_regions));
k = 0;
for (i = 0; i < *n_region; i++) {
x = box_array[clipped_regions[i].block_idx].x1;
y = box_array[clipped_regions[i].block_idx].y1;
width = box_array[clipped_regions[i].block_idx].x2 - x;
height = box_array[clipped_regions[i].block_idx].y2 - y;
inner_regions = __glamor_compute_clipped_regions(inner_block_w,
inner_block_h,
0, x, y,
width,
height,
clipped_regions[i].
region,
&inner_n_regions,
reverse, upsidedown);
for (j = 0; j < inner_n_regions; j++) {
result_regions[k].region = inner_regions[j].region;
result_regions[k].block_idx = clipped_regions[i].block_idx;
k++;
}
free(inner_regions);
}
*n_region = k;
free(clipped_regions);
return result_regions;
}
/*
*
* For the repeat pad mode, we can simply convert the region and
* let the out-of-box region can cover the needed edge of the source/mask
* Then apply a normal clip we can get what we want.
*/
static RegionPtr
_glamor_convert_pad_region(RegionPtr region, int w, int h)
{
RegionPtr pad_region;
int nrect;
BoxPtr box;
int overlap;
nrect = RegionNumRects(region);
box = RegionRects(region);
pad_region = RegionCreate(NULL, 4);
if (pad_region == NULL)
return NULL;
while (nrect--) {
BoxRec pad_box;
RegionRec temp_region;
pad_box = *box;
if (pad_box.x1 < 0 && pad_box.x2 <= 0)
pad_box.x2 = 1;
else if (pad_box.x1 >= w && pad_box.x2 > w)
pad_box.x1 = w - 1;
if (pad_box.y1 < 0 && pad_box.y2 <= 0)
pad_box.y2 = 1;
else if (pad_box.y1 >= h && pad_box.y2 > h)
pad_box.y1 = h - 1;
RegionInitBoxes(&temp_region, &pad_box, 1);
RegionAppend(pad_region, &temp_region);
RegionUninit(&temp_region);
box++;
}
RegionValidate(pad_region, &overlap);
return pad_region;
}
/*
* For one type of large pixmap, its one direction is not exceed the
* size limitation, and in another word, on one direction it has only
* one block.
*
* This case of reflect repeating, we can optimize it and avoid repeat
* clip on that direction. We can just enlarge the repeat box and can
* cover all the dest region on that direction. But latter, we need to
* fixup the clipped result to get a correct coords for the subsequent
* processing. This function is to do the coords correction.
*
* */
static void
_glamor_largepixmap_reflect_fixup(short *xy1, short *xy2, int wh)
{
int odd1, odd2;
int c1, c2;
if (*xy2 - *xy1 > wh) {
*xy1 = 0;
*xy2 = wh;
return;
}
modulus(*xy1, wh, c1);
odd1 = ((*xy1 - c1) / wh) & 0x1;
modulus(*xy2, wh, c2);
odd2 = ((*xy2 - c2) / wh) & 0x1;
if (odd1 && odd2) {
*xy1 = wh - c2;
*xy2 = wh - c1;
}
else if (odd1 && !odd2) {
*xy1 = 0;
*xy2 = MAX(c2, wh - c1);
}
else if (!odd1 && odd2) {
*xy2 = wh;
*xy1 = MIN(c1, wh - c2);
}
else {
*xy1 = c1;
*xy2 = c2;
}
}
/**
* Clip the boxes regards to each pixmap's block array.
*
* Should translate the region to relative coords to the pixmap,
* start at (0,0).
*
* @is_transform: if it is set, it has a transform matrix.
*
*/
static glamor_pixmap_clipped_regions *
_glamor_compute_clipped_regions(PixmapPtr pixmap,
glamor_pixmap_private *pixmap_priv,
RegionPtr region, int *n_region,
int repeat_type, int is_transform,
int reverse, int upsidedown)
{
glamor_pixmap_clipped_regions *clipped_regions;
BoxPtr extent;
int i, j;
RegionPtr current_region;
int pixmap_width, pixmap_height;
int m;
BoxRec repeat_box;
RegionRec repeat_region;
int right_shift = 0;
int down_shift = 0;
int x_center_shift = 0, y_center_shift = 0;
glamor_pixmap_private *priv;
DEBUGRegionPrint(region);
if (glamor_pixmap_priv_is_small(pixmap_priv)) {
clipped_regions = calloc(1, sizeof(*clipped_regions));
clipped_regions[0].region = RegionCreate(NULL, 1);
clipped_regions[0].block_idx = 0;
RegionCopy(clipped_regions[0].region, region);
*n_region = 1;
return clipped_regions;
}
priv = __glamor_large(pixmap_priv);
pixmap_width = pixmap->drawable.width;
pixmap_height = pixmap->drawable.height;
if (repeat_type == 0 || repeat_type == RepeatPad) {
RegionPtr saved_region = NULL;
if (repeat_type == RepeatPad) {
saved_region = region;
region =
_glamor_convert_pad_region(saved_region, pixmap_width,
pixmap_height);
if (region == NULL) {
*n_region = 0;
return NULL;
}
}
clipped_regions = __glamor_compute_clipped_regions(priv->block_w,
priv->block_h,
priv->block_wcnt,
0, 0,
pixmap->drawable.width,
pixmap->drawable.height,
region, n_region,
reverse, upsidedown);
if (saved_region)
RegionDestroy(region);
return clipped_regions;
}
extent = RegionExtents(region);
x_center_shift = extent->x1 / pixmap_width;
if (x_center_shift < 0)
x_center_shift--;
if (abs(x_center_shift) & 1)
x_center_shift++;
y_center_shift = extent->y1 / pixmap_height;
if (y_center_shift < 0)
y_center_shift--;
if (abs(y_center_shift) & 1)
y_center_shift++;
if (extent->x1 < 0)
right_shift = ((-extent->x1 + pixmap_width - 1) / pixmap_width);
if (extent->y1 < 0)
down_shift = ((-extent->y1 + pixmap_height - 1) / pixmap_height);
if (right_shift != 0 || down_shift != 0) {
if (repeat_type == RepeatReflect) {
right_shift = (right_shift + 1) & ~1;
down_shift = (down_shift + 1) & ~1;
}
RegionTranslate(region, right_shift * pixmap_width,
down_shift * pixmap_height);
}
extent = RegionExtents(region);
/* Tile a large pixmap to another large pixmap.
* We can't use the target large pixmap as the
* loop variable, instead we need to loop for all
* the blocks in the tile pixmap.
*
* simulate repeat each single block to cover the
* target's blocks. Two special case:
* a block_wcnt == 1 or block_hcnt ==1, then we
* only need to loop one direction as the other
* direction is fully included in the first block.
*
* For the other cases, just need to start
* from a proper shiftx/shifty, and then increase
* y by tile_height each time to walk trhough the
* target block and then walk trhough the target
* at x direction by increate tile_width each time.
*
* This way, we can consolidate all the sub blocks
* of the target boxes into one tile source's block.
*
* */
m = 0;
clipped_regions = calloc(priv->block_wcnt * priv->block_hcnt,
sizeof(*clipped_regions));
if (clipped_regions == NULL) {
*n_region = 0;
return NULL;
}
if (right_shift != 0 || down_shift != 0) {
DEBUGF("region to be repeated shifted \n");
DEBUGRegionPrint(region);
}
DEBUGF("repeat pixmap width %d height %d \n", pixmap_width, pixmap_height);
DEBUGF("extent x1 %d y1 %d x2 %d y2 %d \n", extent->x1, extent->y1,
extent->x2, extent->y2);
for (j = 0; j < priv->block_hcnt; j++) {
for (i = 0; i < priv->block_wcnt; i++) {
int dx = pixmap_width;
int dy = pixmap_height;
int idx;
int shift_x;
int shift_y;
int saved_y1, saved_y2;
int x_idx = 0, y_idx = 0, saved_y_idx = 0;
RegionRec temp_region;
BoxRec reflect_repeat_box;
BoxPtr valid_repeat_box;
shift_x = (extent->x1 / pixmap_width) * pixmap_width;
shift_y = (extent->y1 / pixmap_height) * pixmap_height;
idx = j * priv->block_wcnt + i;
if (repeat_type == RepeatReflect) {
x_idx = (extent->x1 / pixmap_width);
y_idx = (extent->y1 / pixmap_height);
}
/* Construct a rect to clip the target region. */
repeat_box.x1 = shift_x + priv->box_array[idx].x1;
repeat_box.y1 = shift_y + priv->box_array[idx].y1;
if (priv->block_wcnt == 1) {
repeat_box.x2 = extent->x2;
dx = extent->x2 - repeat_box.x1;
}
else
repeat_box.x2 = shift_x + priv->box_array[idx].x2;
if (priv->block_hcnt == 1) {
repeat_box.y2 = extent->y2;
dy = extent->y2 - repeat_box.y1;
}
else
repeat_box.y2 = shift_y + priv->box_array[idx].y2;
current_region = RegionCreate(NULL, 4);
RegionInit(&temp_region, NULL, 4);
DEBUGF("init repeat box %d %d %d %d \n",
repeat_box.x1, repeat_box.y1, repeat_box.x2, repeat_box.y2);
if (repeat_type == RepeatNormal) {
saved_y1 = repeat_box.y1;
saved_y2 = repeat_box.y2;
for (; repeat_box.x1 < extent->x2;
repeat_box.x1 += dx, repeat_box.x2 += dx) {
repeat_box.y1 = saved_y1;
repeat_box.y2 = saved_y2;
for (repeat_box.y1 = saved_y1, repeat_box.y2 = saved_y2;
repeat_box.y1 < extent->y2;
repeat_box.y1 += dy, repeat_box.y2 += dy) {
RegionInitBoxes(&repeat_region, &repeat_box, 1);
DEBUGF("Start to clip repeat region: \n");
DEBUGRegionPrint(&repeat_region);
RegionIntersect(&temp_region, &repeat_region, region);
DEBUGF("clip result:\n");
DEBUGRegionPrint(&temp_region);
RegionAppend(current_region, &temp_region);
RegionUninit(&repeat_region);
}
}
}
else if (repeat_type == RepeatReflect) {
saved_y1 = repeat_box.y1;
saved_y2 = repeat_box.y2;
saved_y_idx = y_idx;
for (;; repeat_box.x1 += dx, repeat_box.x2 += dx) {
repeat_box.y1 = saved_y1;
repeat_box.y2 = saved_y2;
y_idx = saved_y_idx;
reflect_repeat_box.x1 = (x_idx & 1) ?
((2 * x_idx + 1) * dx - repeat_box.x2) : repeat_box.x1;
reflect_repeat_box.x2 = (x_idx & 1) ?
((2 * x_idx + 1) * dx - repeat_box.x1) : repeat_box.x2;
valid_repeat_box = &reflect_repeat_box;
if (valid_repeat_box->x1 >= extent->x2)
break;
for (repeat_box.y1 = saved_y1, repeat_box.y2 = saved_y2;;
repeat_box.y1 += dy, repeat_box.y2 += dy) {
DEBUGF("x_idx %d y_idx %d dx %d dy %d\n", x_idx, y_idx,
dx, dy);
DEBUGF("repeat box %d %d %d %d \n", repeat_box.x1,
repeat_box.y1, repeat_box.x2, repeat_box.y2);
if (priv->block_hcnt > 1) {
reflect_repeat_box.y1 = (y_idx & 1) ?
((2 * y_idx + 1) * dy -
repeat_box.y2) : repeat_box.y1;
reflect_repeat_box.y2 =
(y_idx & 1) ? ((2 * y_idx + 1) * dy -
repeat_box.y1) : repeat_box.y2;
}
else {
reflect_repeat_box.y1 = repeat_box.y1;
reflect_repeat_box.y2 = repeat_box.y2;
}
DEBUGF("valid_repeat_box x1 %d y1 %d \n",
valid_repeat_box->x1, valid_repeat_box->y1);
if (valid_repeat_box->y1 >= extent->y2)
break;
RegionInitBoxes(&repeat_region, valid_repeat_box, 1);
DEBUGF("start to clip repeat[reflect] region: \n");
DEBUGRegionPrint(&repeat_region);
RegionIntersect(&temp_region, &repeat_region, region);
DEBUGF("result:\n");
DEBUGRegionPrint(&temp_region);
if (is_transform && RegionNumRects(&temp_region)) {
BoxRec temp_box;
BoxPtr temp_extent;
temp_extent = RegionExtents(&temp_region);
if (priv->block_wcnt > 1) {
if (x_idx & 1) {
temp_box.x1 =
((2 * x_idx + 1) * dx -
temp_extent->x2);
temp_box.x2 =
((2 * x_idx + 1) * dx -
temp_extent->x1);
}
else {
temp_box.x1 = temp_extent->x1;
temp_box.x2 = temp_extent->x2;
}
modulus(temp_box.x1, pixmap_width, temp_box.x1);
modulus(temp_box.x2, pixmap_width, temp_box.x2);
if (temp_box.x2 == 0)
temp_box.x2 = pixmap_width;
}
else {
temp_box.x1 = temp_extent->x1;
temp_box.x2 = temp_extent->x2;
_glamor_largepixmap_reflect_fixup(&temp_box.x1,
&temp_box.x2,
pixmap_width);
}
if (priv->block_hcnt > 1) {
if (y_idx & 1) {
temp_box.y1 =
((2 * y_idx + 1) * dy -
temp_extent->y2);
temp_box.y2 =
((2 * y_idx + 1) * dy -
temp_extent->y1);
}
else {
temp_box.y1 = temp_extent->y1;
temp_box.y2 = temp_extent->y2;
}
modulus(temp_box.y1, pixmap_height,
temp_box.y1);
modulus(temp_box.y2, pixmap_height,
temp_box.y2);
if (temp_box.y2 == 0)
temp_box.y2 = pixmap_height;
}
else {
temp_box.y1 = temp_extent->y1;
temp_box.y2 = temp_extent->y2;
_glamor_largepixmap_reflect_fixup(&temp_box.y1,
&temp_box.y2,
pixmap_height);
}
RegionInitBoxes(&temp_region, &temp_box, 1);
RegionTranslate(&temp_region,
x_center_shift * pixmap_width,
y_center_shift * pixmap_height);
DEBUGF("for transform result:\n");
DEBUGRegionPrint(&temp_region);
}
RegionAppend(current_region, &temp_region);
RegionUninit(&repeat_region);
y_idx++;
}
x_idx++;
}
}
DEBUGF("dx %d dy %d \n", dx, dy);
if (RegionNumRects(current_region)) {
if ((right_shift != 0 || down_shift != 0) &&
!(is_transform && repeat_type == RepeatReflect))
RegionTranslate(current_region, -right_shift * pixmap_width,
-down_shift * pixmap_height);
clipped_regions[m].region = current_region;
clipped_regions[m].block_idx = idx;
m++;
}
else
RegionDestroy(current_region);
RegionUninit(&temp_region);
}
}
if (right_shift != 0 || down_shift != 0)
RegionTranslate(region, -right_shift * pixmap_width,
-down_shift * pixmap_height);
*n_region = m;
return clipped_regions;
}
glamor_pixmap_clipped_regions *
glamor_compute_clipped_regions(PixmapPtr pixmap,
RegionPtr region,
int *n_region, int repeat_type,
int reverse, int upsidedown)
{
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
return _glamor_compute_clipped_regions(pixmap, priv, region, n_region, repeat_type,
0, reverse, upsidedown);
}
/* XXX overflow still exist. maybe we need to change to use region32.
* by default. Or just use region32 for repeat cases?
**/
static glamor_pixmap_clipped_regions *
glamor_compute_transform_clipped_regions(PixmapPtr pixmap,
struct pixman_transform *transform,
RegionPtr region, int *n_region,
int dx, int dy, int repeat_type,
int reverse, int upsidedown)
{
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
BoxPtr temp_extent;
struct pixman_box32 temp_box;
struct pixman_box16 short_box;
RegionPtr temp_region;
glamor_pixmap_clipped_regions *ret;
temp_region = RegionCreate(NULL, 4);
temp_extent = RegionExtents(region);
DEBUGF("dest region \n");
DEBUGRegionPrint(region);
/* dx/dy may exceed MAX SHORT. we have to use
* a box32 to represent it.*/
temp_box.x1 = temp_extent->x1 + dx;
temp_box.x2 = temp_extent->x2 + dx;
temp_box.y1 = temp_extent->y1 + dy;
temp_box.y2 = temp_extent->y2 + dy;
DEBUGF("source box %d %d %d %d \n", temp_box.x1, temp_box.y1, temp_box.x2,
temp_box.y2);
if (transform)
glamor_get_transform_extent_from_box(&temp_box, transform);
if (repeat_type == RepeatNone) {
if (temp_box.x1 < 0)
temp_box.x1 = 0;
if (temp_box.y1 < 0)
temp_box.y1 = 0;
temp_box.x2 = MIN(temp_box.x2, pixmap->drawable.width);
temp_box.y2 = MIN(temp_box.y2, pixmap->drawable.height);
}
/* Now copy back the box32 to a box16 box, avoiding overflow. */
short_box.x1 = MIN(temp_box.x1, INT16_MAX);
short_box.y1 = MIN(temp_box.y1, INT16_MAX);
short_box.x2 = MIN(temp_box.x2, INT16_MAX);
short_box.y2 = MIN(temp_box.y2, INT16_MAX);
RegionInitBoxes(temp_region, &short_box, 1);
DEBUGF("copy to temp source region \n");
DEBUGRegionPrint(temp_region);
ret = _glamor_compute_clipped_regions(pixmap,
priv,
temp_region,
n_region,
repeat_type, 1, reverse, upsidedown);
DEBUGF("n_regions = %d \n", *n_region);
RegionDestroy(temp_region);
return ret;
}
/*
* As transform and repeatpad mode.
* We may get a clipped result which in multiple regions.
* It's not easy to do a 2nd round clipping just as we do
* without transform/repeatPad. As it's not easy to reverse
* the 2nd round clipping result with a transform/repeatPad mode,
* or even impossible for some transformation.
*
* So we have to merge the fragmental region into one region
* if the clipped result cross the region boundary.
*/
static void
glamor_merge_clipped_regions(PixmapPtr pixmap,
glamor_pixmap_private *pixmap_priv,
int repeat_type,
glamor_pixmap_clipped_regions *clipped_regions,
int *n_regions, int *need_clean_fbo)
{
BoxRec temp_box, copy_box;
RegionPtr temp_region;
glamor_pixmap_private *temp_priv;
PixmapPtr temp_pixmap;
int overlap;
int i;
int pixmap_width, pixmap_height;
glamor_pixmap_private *priv;
priv = __glamor_large(pixmap_priv);
pixmap_width = pixmap->drawable.width;
pixmap_height =pixmap->drawable.height;
temp_region = RegionCreate(NULL, 4);
for (i = 0; i < *n_regions; i++) {
DEBUGF("Region %d:\n", i);
DEBUGRegionPrint(clipped_regions[i].region);
RegionAppend(temp_region, clipped_regions[i].region);
}
RegionValidate(temp_region, &overlap);
DEBUGF("temp region: \n");
DEBUGRegionPrint(temp_region);
temp_box = *RegionExtents(temp_region);
DEBUGF("need copy region: \n");
DEBUGF("%d %d %d %d \n", temp_box.x1, temp_box.y1, temp_box.x2,
temp_box.y2);
temp_pixmap =
glamor_create_pixmap(pixmap->drawable.pScreen,
temp_box.x2 - temp_box.x1,
temp_box.y2 - temp_box.y1,
pixmap->drawable.depth,
GLAMOR_CREATE_PIXMAP_FIXUP);
if (temp_pixmap == NULL) {
assert(0);
return;
}
temp_priv = glamor_get_pixmap_private(temp_pixmap);
assert(glamor_pixmap_priv_is_small(temp_priv));
priv->box = temp_box;
if (temp_box.x1 >= 0 && temp_box.x2 <= pixmap_width
&& temp_box.y1 >= 0 && temp_box.y2 <= pixmap_height) {
int dx, dy;
copy_box.x1 = 0;
copy_box.y1 = 0;
copy_box.x2 = temp_box.x2 - temp_box.x1;
copy_box.y2 = temp_box.y2 - temp_box.y1;
dx = temp_box.x1;
dy = temp_box.y1;
glamor_copy(&pixmap->drawable,
&temp_pixmap->drawable,
NULL, ©_box, 1, dx, dy, 0, 0, 0, NULL);
// glamor_solid(temp_pixmap, 0, 0, temp_pixmap->drawable.width,
// temp_pixmap->drawable.height, GXcopy, 0xffffffff, 0xff00);
}
else {
for (i = 0; i < *n_regions; i++) {
BoxPtr box;
int nbox;
box = REGION_RECTS(clipped_regions[i].region);
nbox = REGION_NUM_RECTS(clipped_regions[i].region);
while (nbox--) {
int dx, dy, c, d;
DEBUGF("box x1 %d y1 %d x2 %d y2 %d \n",
box->x1, box->y1, box->x2, box->y2);
modulus(box->x1, pixmap_width, c);
dx = c - (box->x1 - temp_box.x1);
copy_box.x1 = box->x1 - temp_box.x1;
copy_box.x2 = box->x2 - temp_box.x1;
modulus(box->y1, pixmap_height, d);
dy = d - (box->y1 - temp_box.y1);
copy_box.y1 = box->y1 - temp_box.y1;
copy_box.y2 = box->y2 - temp_box.y1;
DEBUGF("copying box %d %d %d %d, dx %d dy %d\n",
copy_box.x1, copy_box.y1, copy_box.x2,
copy_box.y2, dx, dy);
glamor_copy(&pixmap->drawable,
&temp_pixmap->drawable,
NULL, ©_box, 1, dx, dy, 0, 0, 0, NULL);
box++;
}
}
//glamor_solid(temp_pixmap, 0, 0, temp_pixmap->drawable.width,
// temp_pixmap->drawable.height, GXcopy, 0xffffffff, 0xff);
}
/* The first region will be released at caller side. */
for (i = 1; i < *n_regions; i++)
RegionDestroy(clipped_regions[i].region);
RegionDestroy(temp_region);
priv->box = temp_box;
priv->fbo = glamor_pixmap_detach_fbo(temp_priv);
DEBUGF("priv box x1 %d y1 %d x2 %d y2 %d \n",
priv->box.x1, priv->box.y1, priv->box.x2, priv->box.y2);
glamor_destroy_pixmap(temp_pixmap);
*need_clean_fbo = 1;
*n_regions = 1;
}
/**
* Given an expected transformed block width and block height,
*
* This function calculate a new block width and height which
* guarantee the transform result will not exceed the given
* block width and height.
*
* For large block width and height (> 2048), we choose a
* smaller new width and height and to reduce the cross region
* boundary and can avoid some overhead.
*
**/
static Bool
glamor_get_transform_block_size(struct pixman_transform *transform,
int block_w, int block_h,
int *transformed_block_w,
int *transformed_block_h)
{
double a, b, c, d, e, f, g, h;
double scale;
int width, height;
a = pixman_fixed_to_double(transform->matrix[0][0]);
b = pixman_fixed_to_double(transform->matrix[0][1]);
c = pixman_fixed_to_double(transform->matrix[1][0]);
d = pixman_fixed_to_double(transform->matrix[1][1]);
scale = pixman_fixed_to_double(transform->matrix[2][2]);
if (block_w > 2048) {
/* For large block size, we shrink it to smaller box,
* thus latter we may get less cross boundary regions and
* thus can avoid some extra copy.
*
**/
width = block_w / 4;
height = block_h / 4;
}
else {
width = block_w - 2;
height = block_h - 2;
}
e = a + b;
f = c + d;
g = a - b;
h = c - d;
e = MIN(block_w, floor(width * scale) / MAX(fabs(e), fabs(g)));
f = MIN(block_h, floor(height * scale) / MAX(fabs(f), fabs(h)));
*transformed_block_w = MIN(e, f) - 1;
*transformed_block_h = *transformed_block_w;
if (*transformed_block_w <= 0 || *transformed_block_h <= 0)
return FALSE;
DEBUGF("original block_w/h %d %d, fixed %d %d \n", block_w, block_h,
*transformed_block_w, *transformed_block_h);
return TRUE;
}
#define VECTOR_FROM_POINT(p, x, y) do {\
p.v[0] = x; \
p.v[1] = y; \
p.v[2] = 1.0; } while (0)
static void
glamor_get_transform_extent_from_box(struct pixman_box32 *box,
struct pixman_transform *transform)
{
struct pixman_f_vector p0, p1, p2, p3;
float min_x, min_y, max_x, max_y;
struct pixman_f_transform ftransform;
VECTOR_FROM_POINT(p0, box->x1, box->y1);
VECTOR_FROM_POINT(p1, box->x2, box->y1);
VECTOR_FROM_POINT(p2, box->x2, box->y2);
VECTOR_FROM_POINT(p3, box->x1, box->y2);
pixman_f_transform_from_pixman_transform(&ftransform, transform);
pixman_f_transform_point(&ftransform, &p0);
pixman_f_transform_point(&ftransform, &p1);
pixman_f_transform_point(&ftransform, &p2);
pixman_f_transform_point(&ftransform, &p3);
min_x = MIN(p0.v[0], p1.v[0]);
min_x = MIN(min_x, p2.v[0]);
min_x = MIN(min_x, p3.v[0]);
min_y = MIN(p0.v[1], p1.v[1]);
min_y = MIN(min_y, p2.v[1]);
min_y = MIN(min_y, p3.v[1]);
max_x = MAX(p0.v[0], p1.v[0]);
max_x = MAX(max_x, p2.v[0]);
max_x = MAX(max_x, p3.v[0]);
max_y = MAX(p0.v[1], p1.v[1]);
max_y = MAX(max_y, p2.v[1]);
max_y = MAX(max_y, p3.v[1]);
box->x1 = floor(min_x) - 1;
box->y1 = floor(min_y) - 1;
box->x2 = ceil(max_x) + 1;
box->y2 = ceil(max_y) + 1;
}
static void
_glamor_process_transformed_clipped_region(PixmapPtr pixmap,
glamor_pixmap_private *priv,
int repeat_type,
glamor_pixmap_clipped_regions *
clipped_regions, int *n_regions,
int *need_clean_fbo)
{
int shift_x, shift_y;
if (*n_regions != 1) {
/* Merge all source regions into one region. */
glamor_merge_clipped_regions(pixmap, priv, repeat_type,
clipped_regions, n_regions,
need_clean_fbo);
}
else {
glamor_set_pixmap_fbo_current(priv, clipped_regions[0].block_idx);
if (repeat_type == RepeatReflect || repeat_type == RepeatNormal) {
/* The required source areas are in one region,
* we need to shift the corresponding box's coords to proper position,
* thus we can calculate the relative coords correctly.*/
BoxPtr temp_box;
int rem;
temp_box = RegionExtents(clipped_regions[0].region);
modulus(temp_box->x1, pixmap->drawable.width, rem);
shift_x = (temp_box->x1 - rem) / pixmap->drawable.width;
modulus(temp_box->y1, pixmap->drawable.height, rem);
shift_y = (temp_box->y1 - rem) / pixmap->drawable.height;
if (shift_x != 0) {
__glamor_large(priv)->box.x1 +=
shift_x * pixmap->drawable.width;
__glamor_large(priv)->box.x2 +=
shift_x * pixmap->drawable.width;
}
if (shift_y != 0) {
__glamor_large(priv)->box.y1 +=
shift_y * pixmap->drawable.height;
__glamor_large(priv)->box.y2 +=
shift_y * pixmap->drawable.height;
}
}
}
}
Bool
glamor_composite_largepixmap_region(CARD8 op,
PicturePtr source,
PicturePtr mask,
PicturePtr dest,
PixmapPtr source_pixmap,
PixmapPtr mask_pixmap,
PixmapPtr dest_pixmap,
RegionPtr region, Bool force_clip,
INT16 x_source,
INT16 y_source,
INT16 x_mask,
INT16 y_mask,
INT16 x_dest, INT16 y_dest,
CARD16 width, CARD16 height)
{
ScreenPtr screen = dest_pixmap->drawable.pScreen;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
glamor_pixmap_private *source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
glamor_pixmap_private *mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap);
glamor_pixmap_private *dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
glamor_pixmap_clipped_regions *clipped_dest_regions;
glamor_pixmap_clipped_regions *clipped_source_regions;
glamor_pixmap_clipped_regions *clipped_mask_regions;
int n_dest_regions;
int n_mask_regions;
int n_source_regions;
int i, j, k;
int need_clean_source_fbo = 0;
int need_clean_mask_fbo = 0;
int is_normal_source_fbo = 0;
int is_normal_mask_fbo = 0;
int fixed_block_width, fixed_block_height;
int dest_block_width, dest_block_height;
int null_source, null_mask;
glamor_pixmap_private *need_free_source_pixmap_priv = NULL;
glamor_pixmap_private *need_free_mask_pixmap_priv = NULL;
int source_repeat_type = 0, mask_repeat_type = 0;
int ok = TRUE;
if (source_pixmap == dest_pixmap) {
glamor_fallback("source and dest pixmaps are the same\n");
return FALSE;
}
if (mask_pixmap == dest_pixmap) {
glamor_fallback("mask and dest pixmaps are the same\n");
return FALSE;
}
if (source->repeat)
source_repeat_type = source->repeatType;
else
source_repeat_type = RepeatNone;
if (mask && mask->repeat)
mask_repeat_type = mask->repeatType;
else
mask_repeat_type = RepeatNone;
if (glamor_pixmap_priv_is_large(dest_pixmap_priv)) {
dest_block_width = __glamor_large(dest_pixmap_priv)->block_w;
dest_block_height = __glamor_large(dest_pixmap_priv)->block_h;
} else {
dest_block_width = dest_pixmap->drawable.width;
dest_block_height = dest_pixmap->drawable.height;
}
fixed_block_width = dest_block_width;
fixed_block_height = dest_block_height;
/* If we got an totally out-of-box region for a source or mask
* region without repeat, we need to set it as null_source and
* give it a solid color (0,0,0,0). */
null_source = 0;
null_mask = 0;
RegionTranslate(region, -dest->pDrawable->x, -dest->pDrawable->y);
/* need to transform the dest region to the correct sourcei/mask region.
* it's a little complex, as one single edge of the
* target region may be transformed to cross a block boundary of the
* source or mask. Then it's impossible to handle it as usual way.
* We may have to split the original dest region to smaller region, and
* make sure each region's transformed region can fit into one texture,
* and then continue this loop again, and each time when a transformed region
* cross the bound, we need to copy it to a single pixmap and do the composition
* with the new pixmap. If the transformed region doesn't cross a source/mask's
* boundary then we don't need to copy.
*
*/
if (source_pixmap_priv
&& source->transform
&& glamor_pixmap_priv_is_large(source_pixmap_priv)) {
int source_transformed_block_width, source_transformed_block_height;
if (!glamor_get_transform_block_size(source->transform,
__glamor_large(source_pixmap_priv)->block_w,
__glamor_large(source_pixmap_priv)->block_h,
&source_transformed_block_width,
&source_transformed_block_height))
{
DEBUGF("source block size less than 1, fallback.\n");
RegionTranslate(region, dest->pDrawable->x, dest->pDrawable->y);
return FALSE;
}
fixed_block_width =
min(fixed_block_width, source_transformed_block_width);
fixed_block_height =
min(fixed_block_height, source_transformed_block_height);
DEBUGF("new source block size %d x %d \n", fixed_block_width,
fixed_block_height);
}
if (mask_pixmap_priv
&& mask->transform && glamor_pixmap_priv_is_large(mask_pixmap_priv)) {
int mask_transformed_block_width, mask_transformed_block_height;
if (!glamor_get_transform_block_size(mask->transform,
__glamor_large(mask_pixmap_priv)->block_w,
__glamor_large(mask_pixmap_priv)->block_h,
&mask_transformed_block_width,
&mask_transformed_block_height)) {
DEBUGF("mask block size less than 1, fallback.\n");
RegionTranslate(region, dest->pDrawable->x, dest->pDrawable->y);
return FALSE;
}
fixed_block_width =
min(fixed_block_width, mask_transformed_block_width);
fixed_block_height =
min(fixed_block_height, mask_transformed_block_height);
DEBUGF("new mask block size %d x %d \n", fixed_block_width,
fixed_block_height);
}
/*compute the correct block width and height whose transformed source/mask
*region can fit into one texture.*/
if (force_clip || fixed_block_width < dest_block_width
|| fixed_block_height < dest_block_height)
clipped_dest_regions =
glamor_compute_clipped_regions_ext(dest_pixmap, region,
&n_dest_regions,
fixed_block_width,
fixed_block_height, 0, 0);
else
clipped_dest_regions = glamor_compute_clipped_regions(dest_pixmap,
region,
&n_dest_regions,
0, 0, 0);
DEBUGF("dest clipped result %d region: \n", n_dest_regions);
if (source_pixmap_priv
&& (source_pixmap_priv == dest_pixmap_priv ||
source_pixmap_priv == mask_pixmap_priv)
&& glamor_pixmap_priv_is_large(source_pixmap_priv)) {
/* XXX self-copy... */
need_free_source_pixmap_priv = source_pixmap_priv;
source_pixmap_priv = malloc(sizeof(*source_pixmap_priv));
*source_pixmap_priv = *need_free_source_pixmap_priv;
need_free_source_pixmap_priv = source_pixmap_priv;
}
assert(mask_pixmap_priv != dest_pixmap_priv);
for (i = 0; i < n_dest_regions; i++) {
DEBUGF("dest region %d idx %d\n", i,
clipped_dest_regions[i].block_idx);
DEBUGRegionPrint(clipped_dest_regions[i].region);
glamor_set_pixmap_fbo_current(dest_pixmap_priv,
clipped_dest_regions[i].block_idx);
if (source_pixmap_priv &&
glamor_pixmap_priv_is_large(source_pixmap_priv)) {
if (!source->transform && source_repeat_type != RepeatPad) {
RegionTranslate(clipped_dest_regions[i].region,
x_source - x_dest, y_source - y_dest);
clipped_source_regions =
glamor_compute_clipped_regions(source_pixmap,
clipped_dest_regions[i].
region, &n_source_regions,
source_repeat_type, 0, 0);
is_normal_source_fbo = 1;
}
else {
clipped_source_regions =
glamor_compute_transform_clipped_regions(source_pixmap,
source->transform,
clipped_dest_regions
[i].region,
&n_source_regions,
x_source - x_dest,
y_source - y_dest,
source_repeat_type,
0, 0);
is_normal_source_fbo = 0;
if (n_source_regions == 0) {
/* Pad the out-of-box region to (0,0,0,0). */
null_source = 1;
n_source_regions = 1;
}
else
_glamor_process_transformed_clipped_region
(source_pixmap, source_pixmap_priv, source_repeat_type,
clipped_source_regions, &n_source_regions,
&need_clean_source_fbo);
}
DEBUGF("source clipped result %d region: \n", n_source_regions);
for (j = 0; j < n_source_regions; j++) {
if (is_normal_source_fbo)
glamor_set_pixmap_fbo_current(source_pixmap_priv,
clipped_source_regions[j].block_idx);
if (mask_pixmap_priv &&
glamor_pixmap_priv_is_large(mask_pixmap_priv)) {
if (is_normal_mask_fbo && is_normal_source_fbo) {
/* both mask and source are normal fbo box without transform or repeatpad.
* The region is clipped against source and then we clip it against mask here.*/
DEBUGF("source region %d idx %d\n", j,
clipped_source_regions[j].block_idx);
DEBUGRegionPrint(clipped_source_regions[j].region);
RegionTranslate(clipped_source_regions[j].region,
-x_source + x_mask, -y_source + y_mask);
clipped_mask_regions =
glamor_compute_clipped_regions(mask_pixmap,
clipped_source_regions
[j].region,
&n_mask_regions,
mask_repeat_type, 0,
0);
is_normal_mask_fbo = 1;
}
else if (is_normal_mask_fbo && !is_normal_source_fbo) {
assert(n_source_regions == 1);
/* The source fbo is not a normal fbo box, it has transform or repeatpad.
* the valid clip region should be the clip dest region rather than the
* clip source region.*/
RegionTranslate(clipped_dest_regions[i].region,
-x_dest + x_mask, -y_dest + y_mask);
clipped_mask_regions =
glamor_compute_clipped_regions(mask_pixmap,
clipped_dest_regions
[i].region,
&n_mask_regions,
mask_repeat_type, 0,
0);
is_normal_mask_fbo = 1;
}
else {
/* This mask region has transform or repeatpad, we need clip it against the previous
* valid region rather than the mask region. */
if (!is_normal_source_fbo)
clipped_mask_regions =
glamor_compute_transform_clipped_regions
(mask_pixmap, mask->transform,
clipped_dest_regions[i].region,
&n_mask_regions, x_mask - x_dest,
y_mask - y_dest, mask_repeat_type, 0, 0);
else
clipped_mask_regions =
glamor_compute_transform_clipped_regions
(mask_pixmap, mask->transform,
clipped_source_regions[j].region,
&n_mask_regions, x_mask - x_source,
y_mask - y_source, mask_repeat_type, 0, 0);
is_normal_mask_fbo = 0;
if (n_mask_regions == 0) {
/* Pad the out-of-box region to (0,0,0,0). */
null_mask = 1;
n_mask_regions = 1;
}
else
_glamor_process_transformed_clipped_region
(mask_pixmap, mask_pixmap_priv, mask_repeat_type,
clipped_mask_regions, &n_mask_regions,
&need_clean_mask_fbo);
}
DEBUGF("mask clipped result %d region: \n", n_mask_regions);
#define COMPOSITE_REGION(region) do { \
if (!glamor_composite_clipped_region(op, \
null_source ? NULL : source, \
null_mask ? NULL : mask, dest, \
null_source ? NULL : source_pixmap, \
null_mask ? NULL : mask_pixmap, \
dest_pixmap, region, \
x_source, y_source, x_mask, y_mask, \
x_dest, y_dest)) { \
assert(0); \
} \
} while(0)
for (k = 0; k < n_mask_regions; k++) {
DEBUGF("mask region %d idx %d\n", k,
clipped_mask_regions[k].block_idx);
DEBUGRegionPrint(clipped_mask_regions[k].region);
if (is_normal_mask_fbo) {
glamor_set_pixmap_fbo_current(mask_pixmap_priv,
clipped_mask_regions[k].
block_idx);
DEBUGF("mask fbo off %d %d \n",
__glamor_large(mask_pixmap_priv)->box.x1,
__glamor_large(mask_pixmap_priv)->box.y1);
DEBUGF("start composite mask hasn't transform.\n");
RegionTranslate(clipped_mask_regions[k].region,
x_dest - x_mask +
dest->pDrawable->x,
y_dest - y_mask +
dest->pDrawable->y);
COMPOSITE_REGION(clipped_mask_regions[k].region);
}
else if (!is_normal_mask_fbo && !is_normal_source_fbo) {
DEBUGF
("start composite both mask and source have transform.\n");
RegionTranslate(clipped_dest_regions[i].region,
dest->pDrawable->x,
dest->pDrawable->y);
COMPOSITE_REGION(clipped_dest_regions[i].region);
}
else {
DEBUGF
("start composite only mask has transform.\n");
RegionTranslate(clipped_source_regions[j].region,
x_dest - x_source +
dest->pDrawable->x,
y_dest - y_source +
dest->pDrawable->y);
COMPOSITE_REGION(clipped_source_regions[j].region);
}
RegionDestroy(clipped_mask_regions[k].region);
}
free(clipped_mask_regions);
if (null_mask)
null_mask = 0;
if (need_clean_mask_fbo) {
assert(is_normal_mask_fbo == 0);
glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->fbo);
mask_pixmap_priv->fbo = NULL;
need_clean_mask_fbo = 0;
}
}
else {
if (is_normal_source_fbo) {
RegionTranslate(clipped_source_regions[j].region,
-x_source + x_dest + dest->pDrawable->x,
-y_source + y_dest +
dest->pDrawable->y);
COMPOSITE_REGION(clipped_source_regions[j].region);
}
else {
/* Source has transform or repeatPad. dest regions is the right
* region to do the composite. */
RegionTranslate(clipped_dest_regions[i].region,
dest->pDrawable->x, dest->pDrawable->y);
COMPOSITE_REGION(clipped_dest_regions[i].region);
}
}
if (clipped_source_regions && clipped_source_regions[j].region)
RegionDestroy(clipped_source_regions[j].region);
}
free(clipped_source_regions);
if (null_source)
null_source = 0;
if (need_clean_source_fbo) {
assert(is_normal_source_fbo == 0);
glamor_destroy_fbo(glamor_priv, source_pixmap_priv->fbo);
source_pixmap_priv->fbo = NULL;
need_clean_source_fbo = 0;
}
}
else {
if (mask_pixmap_priv &&
glamor_pixmap_priv_is_large(mask_pixmap_priv)) {
if (!mask->transform && mask_repeat_type != RepeatPad) {
RegionTranslate(clipped_dest_regions[i].region,
x_mask - x_dest, y_mask - y_dest);
clipped_mask_regions =
glamor_compute_clipped_regions(mask_pixmap,
clipped_dest_regions[i].
region, &n_mask_regions,
mask_repeat_type, 0, 0);
is_normal_mask_fbo = 1;
}
else {
clipped_mask_regions =
glamor_compute_transform_clipped_regions
(mask_pixmap, mask->transform,
clipped_dest_regions[i].region, &n_mask_regions,
x_mask - x_dest, y_mask - y_dest, mask_repeat_type, 0,
0);
is_normal_mask_fbo = 0;
if (n_mask_regions == 0) {
/* Pad the out-of-box region to (0,0,0,0). */
null_mask = 1;
n_mask_regions = 1;
}
else
_glamor_process_transformed_clipped_region
(mask_pixmap, mask_pixmap_priv, mask_repeat_type,
clipped_mask_regions, &n_mask_regions,
&need_clean_mask_fbo);
}
for (k = 0; k < n_mask_regions; k++) {
DEBUGF("mask region %d idx %d\n", k,
clipped_mask_regions[k].block_idx);
DEBUGRegionPrint(clipped_mask_regions[k].region);
if (is_normal_mask_fbo) {
glamor_set_pixmap_fbo_current(mask_pixmap_priv,
clipped_mask_regions[k].
block_idx);
RegionTranslate(clipped_mask_regions[k].region,
x_dest - x_mask + dest->pDrawable->x,
y_dest - y_mask + dest->pDrawable->y);
COMPOSITE_REGION(clipped_mask_regions[k].region);
}
else {
RegionTranslate(clipped_dest_regions[i].region,
dest->pDrawable->x, dest->pDrawable->y);
COMPOSITE_REGION(clipped_dest_regions[i].region);
}
RegionDestroy(clipped_mask_regions[k].region);
}
free(clipped_mask_regions);
if (null_mask)
null_mask = 0;
if (need_clean_mask_fbo) {
glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->fbo);
mask_pixmap_priv->fbo = NULL;
need_clean_mask_fbo = 0;
}
}
else {
RegionTranslate(clipped_dest_regions[i].region,
dest->pDrawable->x, dest->pDrawable->y);
COMPOSITE_REGION(clipped_dest_regions[i].region);
}
}
RegionDestroy(clipped_dest_regions[i].region);
}
free(clipped_dest_regions);
free(need_free_source_pixmap_priv);
free(need_free_mask_pixmap_priv);
ok = TRUE;
return ok;
}
|
35cfdbce90889bc90675b9ccc330b9f94a915f7b
|
ae3e9369882d46a2a009c41a58449c3da9cb3ae1
|
/src/include/lkl/syscall-overrides-fstat.h
|
8569a3343cca1bed2e869cc51817b7be97f99686
|
[
"MIT"
] |
permissive
|
lsds/sgx-lkl
|
efc1f9bc0b9621ff1d301abf0b5bbbcc7c80ef96
|
b6e838e0034de86b48470b6a6bf87d2e262e65c9
|
refs/heads/oe_port
| 2023-06-04T04:44:34.776274
| 2021-04-12T17:33:53
| 2021-04-12T17:33:53
| 113,332,442
| 267
| 109
|
MIT
| 2022-12-29T04:35:40
| 2017-12-06T15:22:02
|
C
|
UTF-8
|
C
| false
| false
| 410
|
h
|
syscall-overrides-fstat.h
|
#ifndef _LKL_SYSCALL_OVERRIDES_FSTAT_H
#define _LKL_SYSCALL_OVERRIDES_FSTAT_H
typedef long (*syscall_fstat_handler)(int, void*);
typedef long (*syscall_newfstatat_handler)(
int, const char*, void*, int);
/**
* Register override functions that maintain compatibility
* between LKL's handling of syscall fstat and newfstatat
* and MUSL's expectation.
*/
void syscall_register_fstat_overrides();
#endif
|
6a470f5c4b4f1a7144666c3fca772224cad1ae6f
|
e1cddfd754d952134e72dfd03522c5ea4fb6008e
|
/src/vppinfra/pcap_funcs.h
|
2c51ab723834f754ff6614cad3e8329407bdf192
|
[
"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
| 1,808
|
h
|
pcap_funcs.h
|
/*
* Copyright (c) 2015 Cisco 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.
*/
#ifndef included_vppinfra_pcap_funcs_h
#define included_vppinfra_pcap_funcs_h
/** Write out data to output file. */
clib_error_t *pcap_close (pcap_main_t * pm);
clib_error_t *pcap_write (pcap_main_t * pm);
/** Read data from file. */
clib_error_t *pcap_read (pcap_main_t * pm);
/** Close the file created by pcap_write function. */
clib_error_t *pcap_close (pcap_main_t * pm);
/**
* @brief Add packet
*
* @param *pm - pcap_main_t
* @param time_now - f64
* @param n_bytes_in_trace - u32
* @param n_bytes_in_packet - u32
*
* @return Packet Data
*
*/
static inline void *
pcap_add_packet (pcap_main_t * pm,
f64 time_now, u32 n_bytes_in_trace, u32 n_bytes_in_packet)
{
pcap_packet_header_t *h;
u8 *d;
vec_add2 (pm->pcap_data, d, sizeof (h[0]) + n_bytes_in_trace);
h = (void *) (d);
h->time_in_sec = time_now;
h->time_in_usec = 1e6 * (time_now - h->time_in_sec);
h->n_packet_bytes_stored_in_file = n_bytes_in_trace;
h->n_bytes_in_packet = n_bytes_in_packet;
pm->n_packets_captured++;
return h->data;
}
#endif /* included_vppinfra_pcap_funcs_h */
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/
|
a555efa3f14411ea281df1323b1efaee421f3f04
|
70ffcb065027032a399f44b9ec91e7b61d73583d
|
/ccan/ccan/intmap/intmap.c
|
341b8a92134981c9fd381149c71c7fd16d0325ef
|
[
"MIT"
] |
permissive
|
ElementsProject/lightning
|
4e260841b2ebad8c772a5ff91ef1ebbc3fe1ad71
|
990096f904e26386527a4eddd8d3262464bacabd
|
refs/heads/master
| 2023-09-01T07:11:34.794039
| 2023-08-31T09:55:14
| 2023-08-31T22:02:14
| 37,350,472
| 2,812
| 961
|
NOASSERTION
| 2023-09-14T19:33:22
| 2015-06-13T00:04:22
|
C
|
UTF-8
|
C
| false
| false
| 7,286
|
c
|
intmap.c
|
/* CC0 license (public domain) - see LICENSE file for details */
/* This code is based on ccan/strmap.c. */
#include <ccan/bitops/bitops.h>
#include <ccan/intmap/intmap.h>
#include <ccan/short_types/short_types.h>
#include <ccan/str/str.h>
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
struct node {
/* These point to strings or nodes. */
struct intmap child[2];
/* Encoding both prefix and critbit: 1 is appended to prefix. */
intmap_index_t prefix_and_critbit;
};
static int critbit(const struct intmap *n)
{
return bitops_ls64(n->u.n->prefix_and_critbit);
}
static intmap_index_t prefix_mask(int critbit)
{
/* Mask does not include critbit itself, but can't shift by critbit+1 */
return -2ULL << critbit;
}
static intmap_index_t prefix_and_critbit(intmap_index_t v, int n)
{
intmap_index_t critbit = ((intmap_index_t)1 << n);
return (v & ~(critbit - 1)) | critbit;
}
void *intmap_get_(const struct intmap *map, intmap_index_t index)
{
/* Not empty map? */
if (!intmap_empty_(map)) {
const struct intmap *n = map;
/* Anything with NULL value is a node. */
while (!n->v) {
/* FIXME: compare cmp prefix, if not equal, ENOENT */
u8 direction = (index >> critbit(n)) & 1;
n = &n->u.n->child[direction];
}
if (index == n->u.i)
return n->v;
}
errno = ENOENT;
return NULL;
}
static bool split_node(struct intmap *n, intmap_index_t nodeindex,
intmap_index_t index, const void *value)
{
struct node *newn;
int new_dir;
/* Find highest bit where they differ. */
unsigned int critbit = bitops_hs64(nodeindex ^ index);
assert(critbit < CHAR_BIT*sizeof(index));
/* Which direction do we go at this bit? */
new_dir = (index >> critbit) & 1;
/* Allocate new node. */
newn = malloc(sizeof(*newn));
if (!newn) {
errno = ENOMEM;
return false;
}
newn->prefix_and_critbit = prefix_and_critbit(index, critbit);
newn->child[new_dir].v = (void *)value;
newn->child[new_dir].u.i = index;
newn->child[!new_dir] = *n;
n->u.n = newn;
n->v = NULL;
return true;
}
bool intmap_add_(struct intmap *map, intmap_index_t index, const void *value)
{
struct intmap *n;
assert(value);
/* Empty map? */
if (intmap_empty_(map)) {
map->u.i = index;
map->v = (void *)value;
return true;
}
n = map;
/* Anything with NULL value is a node. */
while (!n->v) {
int crit = critbit(n);
intmap_index_t mask = prefix_mask(crit);
u8 direction = (index >> crit) & 1;
if ((index & mask) != (n->u.n->prefix_and_critbit & mask))
return split_node(n, n->u.n->prefix_and_critbit & mask,
index, value);
n = &n->u.n->child[direction];
}
if (index == n->u.i) {
errno = EEXIST;
return false;
}
return split_node(n, n->u.i, index, value);
}
void *intmap_del_(struct intmap *map, intmap_index_t index)
{
struct intmap *parent = NULL, *n;
u8 direction;
void *value;
/* Empty map? */
if (intmap_empty_(map)) {
errno = ENOENT;
return NULL;
}
/* Find closest, but keep track of parent. */
n = map;
/* Anything with NULL value is a node. */
while (!n->v) {
/* FIXME: compare cmp prefix, if not equal, ENOENT */
parent = n;
direction = (index >> critbit(n)) & 1;
n = &n->u.n->child[direction];
}
/* Did we find it? */
if (index != n->u.i) {
errno = ENOENT;
return NULL;
}
value = n->v;
if (!parent) {
/* We deleted last node. */
intmap_init_(map);
} else {
struct node *old = parent->u.n;
/* Raise other node to parent. */
*parent = old->child[!direction];
free(old);
}
errno = 0;
return value;
}
void *intmap_first_(const struct intmap *map, intmap_index_t *indexp)
{
const struct intmap *n;
if (intmap_empty_(map)) {
errno = ENOENT;
return NULL;
}
n = map;
/* Anything with NULL value is a node. */
while (!n->v)
n = &n->u.n->child[0];
errno = 0;
*indexp = n->u.i;
return n->v;
}
void *intmap_after_(const struct intmap *map, intmap_index_t *indexp)
{
const struct intmap *n, *prev = NULL;
intmap_index_t index = (*indexp) + 1;
/* Special case of overflow */
if (index == 0)
goto none_left;
/* Special case of empty map */
if (intmap_empty_(map))
goto none_left;
/* Follow down, until prefix differs. */
n = map;
while (!n->v) {
int crit = critbit(n);
u8 direction;
intmap_index_t prefix, idx;
idx = (index >> crit);
direction = idx & 1;
/* Leave critbit in place: we can't shift by 64 anyway */
idx |= 1;
prefix = n->u.n->prefix_and_critbit >> crit;
/* If this entire tree is greater than index, take first */
if (idx < prefix)
return intmap_first_(n, indexp);
/* If this entire tree is less than index, we're past it. */
else if (idx > prefix)
goto try_greater_tree;
/* Remember greater tree for backtracking */
if (!direction)
prev = n;
n = &n->u.n->child[direction];
}
/* Found a successor? */
if (n->u.i >= index) {
errno = 0;
*indexp = n->u.i;
return n->v;
}
try_greater_tree:
/* If we ever took a lesser branch, go back to greater branch */
if (prev)
return intmap_first_(&prev->u.n->child[1], indexp);
none_left:
errno = ENOENT;
return NULL;
}
void *intmap_before_(const struct intmap *map, intmap_index_t *indexp)
{
const struct intmap *n, *prev = NULL;
intmap_index_t index = (*indexp) - 1;
/* Special case of overflow */
if (index == (intmap_index_t)-1ULL)
goto none_left;
/* Special case of empty map */
if (intmap_empty_(map))
goto none_left;
/* Follow down, until prefix differs. */
n = map;
while (!n->v) {
int crit = critbit(n);
u8 direction;
intmap_index_t prefix, idx;
idx = (index >> crit);
direction = idx & 1;
/* Leave critbit in place: we can't shift by 64 anyway */
idx |= 1;
prefix = n->u.n->prefix_and_critbit >> crit;
/* If this entire tree is less than index, take last */
if (idx > prefix)
return intmap_last_(n, indexp);
/* If this entire tree is greater than index, we're past it. */
else if (idx < prefix)
goto try_lesser_tree;
/* Remember lesser tree for backtracking */
if (direction)
prev = n;
n = &n->u.n->child[direction];
}
/* Found a predecessor? */
if (n->u.i <= index) {
errno = 0;
*indexp = n->u.i;
return n->v;
}
try_lesser_tree:
/* If we ever took a lesser branch, go back to lesser branch */
if (prev)
return intmap_last_(&prev->u.n->child[0], indexp);
none_left:
errno = ENOENT;
return NULL;
}
void *intmap_last_(const struct intmap *map, intmap_index_t *indexp)
{
const struct intmap *n;
if (intmap_empty_(map)) {
errno = ENOENT;
return NULL;
}
n = map;
/* Anything with NULL value is a node. */
while (!n->v)
n = &n->u.n->child[1];
errno = 0;
*indexp = n->u.i;
return n->v;
}
static void clear(struct intmap n)
{
if (!n.v) {
clear(n.u.n->child[0]);
clear(n.u.n->child[1]);
free(n.u.n);
}
}
void intmap_clear_(struct intmap *map)
{
if (!intmap_empty_(map))
clear(*map);
intmap_init_(map);
}
bool intmap_iterate_(const struct intmap *n,
bool (*handle)(intmap_index_t, void *, void *),
void *data,
intmap_index_t offset)
{
/* Can only happen at root */
if (intmap_empty_(n))
return true;
if (n->v)
return handle(n->u.i - offset, n->v, data);
return intmap_iterate_(&n->u.n->child[0], handle, data, offset)
&& intmap_iterate_(&n->u.n->child[1], handle, data, offset);
}
|
441ed60d2fa6a9b7915aa228f24628c8e1f86597
|
aa3befea459382dc5c01c925653d54f435b3fb0f
|
/arch/risc-v/src/litex/hardware/litex_emac.h
|
10643c56e21354bdc8642d138c5edf64556fc2a3
|
[
"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
| 5,438
|
h
|
litex_emac.h
|
/****************************************************************************
* arch/risc-v/src/litex/hardware/litex_emac.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_RISCV_SRC_LITEX_HARDWARE_LITEX_EMAC_H
#define __ARCH_RISCV_SRC_LITEX_HARDWARE_LITEX_EMAC_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "hardware/litex_memorymap.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define ETHMAC_RX_SLOTS 2
#define ETHMAC_TX_SLOTS 2
#define ETHMAC_SLOT_SIZE 2048
/* EMAC Register Offsets ****************************************************/
#define LITEX_ETHMAC_SRAM_WRITER_SLOT_OFFSET 0x0000
#define LITEX_ETHMAC_SRAM_WRITER_LENGTH_OFFSET 0x0004
#define LITEX_ETHMAC_SRAM_WRITER_ERRORS_OFFSET 0x0008
#define LITEX_ETHMAC_SRAM_WRITER_EV_STATUS_OFFSET 0x000c
#define LITEX_ETHMAC_SRAM_WRITER_EV_PENDING_OFFSET 0x0010
#define LITEX_ETHMAC_SRAM_WRITER_EV_ENABLE_OFFSET 0x0014
#define LITEX_ETHMAC_SRAM_READER_START_OFFSET 0x0018
#define LITEX_ETHMAC_SRAM_READER_READY_OFFSET 0x001c
#define LITEX_ETHMAC_SRAM_READER_LEVEL_OFFSET 0x0020
#define LITEX_ETHMAC_SRAM_READER_SLOT_OFFSET 0x0024
#define LITEX_ETHMAC_SRAM_READER_LENGTH_OFFSET 0x0028
#define LITEX_ETHMAC_SRAM_READER_EV_STATUS_OFFSET 0x002c
#define LITEX_ETHMAC_SRAM_READER_EV_PENDING_OFFSET 0x0030
#define LITEX_ETHMAC_SRAM_READER_EV_ENABLE_OFFSET 0x0034
#define LITEX_ETHMAC_PREAMBLE_CRC_OFFSET 0x0038
#define LITEX_ETHMAC_RX_DATAPATH_PREAMBLE_ERRORS_OFFSET 0x003c
#define LITEX_ETHMAC_RX_DATAPATH_CRC_ERRORS_OFFSET 0x0040
#define LITEX_ETHPHY_CRG_RESET_OFFSET 0x0000
#define LITEX_ETHPHY_MDIO_W_OFFSET 0x0004
#define LITEX_ETHPHY_MDIO_R_OFFSET 0x0008
/* LITEX_EMAC register addresses ********************************************/
#define LITEX_ETHMAC_SRAM_WRITER_SLOT (LITEX_ETHMAC_BASE + LITEX_ETHMAC_SRAM_WRITER_SLOT_OFFSET)
#define LITEX_ETHMAC_SRAM_WRITER_LENGTH (LITEX_ETHMAC_BASE + LITEX_ETHMAC_SRAM_WRITER_LENGTH_OFFSET)
#define LITEX_ETHMAC_SRAM_WRITER_ERRORS (LITEX_ETHMAC_BASE + LITEX_ETHMAC_SRAM_WRITER_ERRORS_OFFSET)
#define LITEX_ETHMAC_SRAM_WRITER_EV_STATUS (LITEX_ETHMAC_BASE + LITEX_ETHMAC_SRAM_WRITER_EV_STATUS_OFFSET)
#define LITEX_ETHMAC_SRAM_WRITER_EV_PENDING (LITEX_ETHMAC_BASE + LITEX_ETHMAC_SRAM_WRITER_EV_PENDING_OFFSET)
#define LITEX_ETHMAC_SRAM_WRITER_EV_ENABLE (LITEX_ETHMAC_BASE + LITEX_ETHMAC_SRAM_WRITER_EV_ENABLE_OFFSET)
#define LITEX_ETHMAC_SRAM_READER_START (LITEX_ETHMAC_BASE + LITEX_ETHMAC_SRAM_READER_START_OFFSET)
#define LITEX_ETHMAC_SRAM_READER_READY (LITEX_ETHMAC_BASE + LITEX_ETHMAC_SRAM_READER_READY_OFFSET)
#define LITEX_ETHMAC_SRAM_READER_LEVEL (LITEX_ETHMAC_BASE + LITEX_ETHMAC_SRAM_READER_LEVEL_OFFSET)
#define LITEX_ETHMAC_SRAM_READER_SLOT (LITEX_ETHMAC_BASE + LITEX_ETHMAC_SRAM_READER_SLOT_OFFSET)
#define LITEX_ETHMAC_SRAM_READER_LENGTH (LITEX_ETHMAC_BASE + LITEX_ETHMAC_SRAM_READER_LENGTH_OFFSET)
#define LITEX_ETHMAC_SRAM_READER_EV_STATUS (LITEX_ETHMAC_BASE + LITEX_ETHMAC_SRAM_READER_EV_STATUS_OFFSET)
#define LITEX_ETHMAC_SRAM_READER_EV_PENDING (LITEX_ETHMAC_BASE + LITEX_ETHMAC_SRAM_READER_EV_PENDING_OFFSET)
#define LITEX_ETHMAC_SRAM_READER_EV_ENABLE (LITEX_ETHMAC_BASE + LITEX_ETHMAC_SRAM_READER_EV_ENABLE_OFFSET)
#define LITEX_ETHMAC_PREAMBLE_CRC (LITEX_ETHMAC_BASE + LITEX_ETHMAC_PREAMBLE_CRC_OFFSET)
#define LITEX_ETHMAC_RX_DATAPATH_PREAMBLE_ERRORS (LITEX_ETHMAC_BASE + LITEX_ETHMAC_RX_DATAPATH_PREAMBLE_ERRORS_OFFSET)
#define LITEX_ETHMAC_RX_DATAPATH_CRC_ERRORS (LITEX_ETHMAC_BASE + LITEX_ETHMAC_RX_DATAPATH_CRC_ERRORS_OFFSET)
#define LITEX_ETHPHY_CRG_RESET (LITEX_ETHPHY_BASE + LITEX_ETHPHY_CRG_RESET_OFFSET)
#define LITEX_ETHPHY_MDIO_W (LITEX_ETHPHY_BASE + LITEX_ETHPHY_MDIO_W_OFFSET)
#define LITEX_ETHPHY_MDIO_R (LITEX_ETHPHY_BASE + LITEX_ETHPHY_MDIO_R_OFFSET)
#endif /* __ARCH_RISCV_SRC_LITEX_HARDWARE_LITEX_EMAC_H */
|
96bd923a3ef6b9629312662892da4b28938d7ac0
|
2d07a646d50c6cc1547b069ecd27c512623d8574
|
/src/api/l_physics.c
|
84cf8521d422e927b31ad9c49c3a0c01aa713516
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
bjornbytes/lovr
|
da40e59eb9c42debbc6e22356d55194283740323
|
072452a4dafb466e8af9a4bc546b60ae077f8566
|
refs/heads/master
| 2023-08-16T13:42:30.581144
| 2023-07-29T10:37:18
| 2023-07-29T10:37:18
| 62,519,414
| 1,699
| 164
|
MIT
| 2023-09-13T22:21:32
| 2016-07-03T23:36:45
|
C
|
UTF-8
|
C
| false
| false
| 5,976
|
c
|
l_physics.c
|
#include "api.h"
#include "physics/physics.h"
#include "util.h"
StringEntry lovrShapeType[] = {
[SHAPE_SPHERE] = ENTRY("sphere"),
[SHAPE_BOX] = ENTRY("box"),
[SHAPE_CAPSULE] = ENTRY("capsule"),
[SHAPE_CYLINDER] = ENTRY("cylinder"),
[SHAPE_MESH] = ENTRY("mesh"),
[SHAPE_TERRAIN] = ENTRY("terrain"),
{ 0 }
};
StringEntry lovrJointType[] = {
[JOINT_BALL] = ENTRY("ball"),
[JOINT_DISTANCE] = ENTRY("distance"),
[JOINT_HINGE] = ENTRY("hinge"),
[JOINT_SLIDER] = ENTRY("slider"),
{ 0 }
};
static int l_lovrPhysicsNewWorld(lua_State* L) {
float xg = luax_optfloat(L, 1, 0.f);
float yg = luax_optfloat(L, 2, -9.81f);
float zg = luax_optfloat(L, 3, 0.f);
bool allowSleep = lua_gettop(L) < 4 || lua_toboolean(L, 4);
const char* tags[16];
int tagCount;
if (lua_type(L, 5) == LUA_TTABLE) {
tagCount = luax_len(L, 5);
for (int i = 0; i < tagCount; i++) {
lua_rawgeti(L, -1, i + 1);
if (lua_isstring(L, -1)) {
tags[i] = lua_tostring(L, -1);
} else {
return luaL_error(L, "World tags must be a table of strings");
}
lua_pop(L, 1);
}
} else {
tagCount = 0;
}
World* world = lovrWorldCreate(xg, yg, zg, allowSleep, tags, tagCount);
luax_pushtype(L, World, world);
lovrRelease(world, lovrWorldDestroy);
return 1;
}
static int l_lovrPhysicsNewBallJoint(lua_State* L) {
Collider* a = luax_checktype(L, 1, Collider);
Collider* b = luax_checktype(L, 2, Collider);
float anchor[4];
luax_readvec3(L, 3, anchor, NULL);
BallJoint* joint = lovrBallJointCreate(a, b, anchor[0], anchor[1], anchor[2]);
luax_pushtype(L, BallJoint, joint);
lovrRelease(joint, lovrJointDestroy);
return 1;
}
static int l_lovrPhysicsNewBoxShape(lua_State* L) {
BoxShape* box = luax_newboxshape(L, 1);
luax_pushtype(L, BoxShape, box);
lovrRelease(box, lovrShapeDestroy);
return 1;
}
static int l_lovrPhysicsNewCapsuleShape(lua_State* L) {
CapsuleShape* capsule = luax_newcapsuleshape(L, 1);
luax_pushtype(L, CapsuleShape, capsule);
lovrRelease(capsule, lovrShapeDestroy);
return 1;
}
static int l_lovrPhysicsNewCylinderShape(lua_State* L) {
CylinderShape* cylinder = luax_newcylindershape(L, 1);
luax_pushtype(L, CylinderShape, cylinder);
lovrRelease(cylinder, lovrShapeDestroy);
return 1;
}
static int l_lovrPhysicsNewDistanceJoint(lua_State* L) {
Collider* a = luax_checktype(L, 1, Collider);
Collider* b = luax_checktype(L, 2, Collider);
float anchor1[4], anchor2[4];
int index = luax_readvec3(L, 3, anchor1, NULL);
luax_readvec3(L, index, anchor2, NULL);
DistanceJoint* joint = lovrDistanceJointCreate(a, b, anchor1[0], anchor1[1], anchor1[2],
anchor2[0], anchor2[1], anchor2[2]);
luax_pushtype(L, DistanceJoint, joint);
lovrRelease(joint, lovrJointDestroy);
return 1;
}
static int l_lovrPhysicsNewHingeJoint(lua_State* L) {
Collider* a = luax_checktype(L, 1, Collider);
Collider* b = luax_checktype(L, 2, Collider);
float anchor[4], axis[4];
int index = luax_readvec3(L, 3, anchor, NULL);
luax_readvec3(L, index, axis, NULL);
HingeJoint* joint = lovrHingeJointCreate(a, b, anchor[0], anchor[1], anchor[2], axis[0], axis[1], axis[2]);
luax_pushtype(L, HingeJoint, joint);
lovrRelease(joint, lovrJointDestroy);
return 1;
}
static int l_lovrPhysicsNewMeshShape(lua_State* L) {
MeshShape* mesh = luax_newmeshshape(L, 1);
luax_pushtype(L, MeshShape, mesh);
lovrRelease(mesh, lovrShapeDestroy);
return 1;
}
static int l_lovrPhysicsNewSliderJoint(lua_State* L) {
Collider* a = luax_checktype(L, 1, Collider);
Collider* b = luax_checktype(L, 2, Collider);
float axis[4];
luax_readvec3(L, 3, axis, NULL);
SliderJoint* joint = lovrSliderJointCreate(a, b, axis[0], axis[1], axis[2]);
luax_pushtype(L, SliderJoint, joint);
lovrRelease(joint, lovrJointDestroy);
return 1;
}
static int l_lovrPhysicsNewSphereShape(lua_State* L) {
SphereShape* sphere = luax_newsphereshape(L, 1);
luax_pushtype(L, SphereShape, sphere);
lovrRelease(sphere, lovrShapeDestroy);
return 1;
}
static int l_lovrPhysicsNewTerrainShape(lua_State* L) {
TerrainShape* terrain = luax_newterrainshape(L, 1);
luax_pushtype(L, TerrainShape, terrain);
lovrRelease(terrain, lovrShapeDestroy);
return 1;
}
static const luaL_Reg lovrPhysics[] = {
{ "newWorld", l_lovrPhysicsNewWorld },
{ "newBallJoint", l_lovrPhysicsNewBallJoint },
{ "newBoxShape", l_lovrPhysicsNewBoxShape },
{ "newCapsuleShape", l_lovrPhysicsNewCapsuleShape },
{ "newCylinderShape", l_lovrPhysicsNewCylinderShape },
{ "newDistanceJoint", l_lovrPhysicsNewDistanceJoint },
{ "newHingeJoint", l_lovrPhysicsNewHingeJoint },
{ "newMeshShape", l_lovrPhysicsNewMeshShape },
{ "newSliderJoint", l_lovrPhysicsNewSliderJoint },
{ "newSphereShape", l_lovrPhysicsNewSphereShape },
{ "newTerrainShape", l_lovrPhysicsNewTerrainShape },
{ NULL, NULL }
};
extern const luaL_Reg lovrWorld[];
extern const luaL_Reg lovrCollider[];
extern const luaL_Reg lovrBallJoint[];
extern const luaL_Reg lovrDistanceJoint[];
extern const luaL_Reg lovrHingeJoint[];
extern const luaL_Reg lovrSliderJoint[];
extern const luaL_Reg lovrSphereShape[];
extern const luaL_Reg lovrBoxShape[];
extern const luaL_Reg lovrCapsuleShape[];
extern const luaL_Reg lovrCylinderShape[];
extern const luaL_Reg lovrMeshShape[];
extern const luaL_Reg lovrTerrainShape[];
int luaopen_lovr_physics(lua_State* L) {
lua_newtable(L);
luax_register(L, lovrPhysics);
luax_registertype(L, World);
luax_registertype(L, Collider);
luax_registertype(L, BallJoint);
luax_registertype(L, DistanceJoint);
luax_registertype(L, HingeJoint);
luax_registertype(L, SliderJoint);
luax_registertype(L, SphereShape);
luax_registertype(L, BoxShape);
luax_registertype(L, CapsuleShape);
luax_registertype(L, CylinderShape);
luax_registertype(L, MeshShape);
luax_registertype(L, TerrainShape);
if (lovrPhysicsInit()) {
luax_atexit(L, lovrPhysicsDestroy);
}
return 1;
}
|
68abef9c9ac7f1f2a0ea043d8648d15ecc2a5000
|
aa3befea459382dc5c01c925653d54f435b3fb0f
|
/net/can/can_recvmsg.c
|
66639d42eee22fc4720feac7bf84fb506da5003b
|
[
"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
| 16,075
|
c
|
can_recvmsg.c
|
/****************************************************************************
* net/can/can_recvmsg.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>
#ifdef CONFIG_NET_CAN
#include <sys/types.h>
#include <sys/socket.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <debug.h>
#include <assert.h>
#include <arch/irq.h>
#include <nuttx/semaphore.h>
#include <nuttx/net/net.h>
#include <nuttx/net/netdev.h>
#include "netdev/netdev.h"
#include "devif/devif.h"
#include "can/can.h"
#include "socket/socket.h"
#include <netpacket/packet.h>
#ifdef CONFIG_NET_TIMESTAMP
#include <sys/time.h>
#include <utils/utils.h>
#endif
/****************************************************************************
* Private Types
****************************************************************************/
struct can_recvfrom_s
{
FAR struct can_conn_s *pr_conn; /* Connection associated with the socket */
FAR struct devif_callback_s *pr_cb; /* Reference to callback instance */
sem_t pr_sem; /* Semaphore signals recv completion */
size_t pr_buflen; /* Length of receive buffer */
FAR uint8_t *pr_buffer; /* Pointer to receive buffer */
ssize_t pr_recvlen; /* The received length */
size_t pr_msglen; /* Length of msg buffer */
FAR uint8_t *pr_msgbuf; /* Pointer to msg buffer */
int pr_result; /* Success:OK, failure:negated errno */
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: can_add_recvlen
*
* Description:
* Update information about space available for new data and update size
* of data in buffer, This logic accounts for the case where
* recvfrom_udpreadahead() sets state.pr_recvlen == -1 .
*
* Input Parameters:
* pstate recvfrom state structure
* recvlen size of new data appended to buffer
*
* Returned Value:
* None
*
****************************************************************************/
static inline void can_add_recvlen(FAR struct can_recvfrom_s *pstate,
size_t recvlen)
{
if (pstate->pr_recvlen < 0)
{
pstate->pr_recvlen = 0;
}
pstate->pr_recvlen += recvlen;
pstate->pr_buffer += recvlen;
pstate->pr_buflen -= recvlen;
}
/****************************************************************************
* Name: can_recvfrom_newdata
*
* Description:
* Copy the read data from the packet
*
* Input Parameters:
* dev The structure of the network driver that caused the event.
* pstate recvfrom state structure
*
* Returned Value:
* None.
*
* Assumptions:
* The network is locked.
*
****************************************************************************/
static size_t can_recvfrom_newdata(FAR struct net_driver_s *dev,
FAR struct can_recvfrom_s *pstate)
{
unsigned int offset;
size_t recvlen;
#ifdef CONFIG_NET_TIMESTAMP
if (pstate->pr_conn->timestamp &&
pstate->pr_msglen == sizeof(struct timeval))
{
iob_copyout(pstate->pr_msgbuf, dev->d_iob, sizeof(struct timeval),
-CONFIG_NET_LL_GUARDSIZE);
}
#endif
if (dev->d_len > pstate->pr_buflen)
{
recvlen = pstate->pr_buflen;
}
else
{
recvlen = dev->d_len;
}
/* Copy the new packet data into the user buffer */
offset = (dev->d_appdata - dev->d_iob->io_data) - dev->d_iob->io_offset;
recvlen = iob_copyout(pstate->pr_buffer, dev->d_iob, recvlen, offset);
/* Trim the copied buffers */
dev->d_iob = iob_trimhead(dev->d_iob, recvlen + offset);
/* Update the accumulated size of the data read */
can_add_recvlen(pstate, recvlen);
return recvlen;
}
/****************************************************************************
* Name: can_newdata
*
* Description:
* Copy the read data from the packet
*
* Input Parameters:
* dev The structure of the network driver that generated the event
* pstate recvfrom state structure
*
* Returned Value:
* None.
*
* Assumptions:
* The network is locked.
*
****************************************************************************/
static inline void can_newdata(FAR struct net_driver_s *dev,
FAR struct can_recvfrom_s *pstate)
{
/* Take as much data from the packet as we can */
size_t recvlen = can_recvfrom_newdata(dev, pstate);
/* If there is more data left in the packet that we could not buffer, then
* add it to the read-ahead buffers.
*/
if (recvlen < dev->d_len)
{
can_datahandler(dev, pstate->pr_conn);
}
/* Indicate no data in the buffer */
dev->d_len = 0;
}
/****************************************************************************
* Name: can_readahead
*
* Description:
* Copy the read-ahead data from the packet
*
* Input Parameters:
* pstate recvfrom state structure
*
* Returned Value:
* None
*
* Assumptions:
* The network is locked.
*
****************************************************************************/
static inline int can_readahead(struct can_recvfrom_s *pstate)
{
FAR struct can_conn_s *conn = pstate->pr_conn;
FAR struct iob_s *iob;
int recvlen;
/* Check there is any CAN data already buffered in a read-ahead
* buffer.
*/
pstate->pr_recvlen = -1;
if ((iob = iob_peek_queue(&conn->readahead)) != NULL &&
pstate->pr_buflen > 0)
{
DEBUGASSERT(iob->io_pktlen > 0);
#ifdef CONFIG_NET_TIMESTAMP
if (conn->timestamp && pstate->pr_msglen == sizeof(struct timeval))
{
iob_copyout(pstate->pr_msgbuf, iob, sizeof(struct timeval),
-CONFIG_NET_LL_GUARDSIZE);
}
#endif
/* Transfer that buffered data from the I/O buffer chain into
* the user buffer.
*/
recvlen = iob_copyout(pstate->pr_buffer, iob, pstate->pr_buflen, 0);
/* If we took all of the data from the I/O buffer chain is empty, then
* release it. If there is still data available in the I/O buffer
* chain, then just trim the data that we have taken from the
* beginning of the I/O buffer chain.
*/
if (recvlen >= iob->io_pktlen)
{
FAR struct iob_s *tmp;
/* Remove the I/O buffer chain from the head of the read-ahead
* buffer queue.
*/
tmp = iob_remove_queue(&conn->readahead);
DEBUGASSERT(tmp == iob);
UNUSED(tmp);
/* And free the I/O buffer chain */
iob_free_chain(iob);
}
else
{
/* The bytes that we have received from the head of the I/O
* buffer chain (probably changing the head of the I/O
* buffer queue).
*/
iob_trimhead_queue(&conn->readahead, recvlen);
}
/* do not pass frames with DLC > 8 to a legacy socket */
#if defined(CONFIG_NET_CANPROTO_OPTIONS) && defined(CONFIG_NET_CAN_CANFD)
if (!conn->fd_frames)
#endif
{
if (recvlen > sizeof(struct can_frame))
{
return 0;
}
}
return recvlen;
}
return 0;
}
#ifdef CONFIG_NET_CANPROTO_OPTIONS
static int can_recv_filter(struct can_conn_s *conn, canid_t id)
{
uint32_t i;
for (i = 0; i < conn->filter_count; i++)
{
if (conn->filters[i].can_id & CAN_INV_FILTER)
{
if ((id & conn->filters[i].can_mask) !=
((conn->filters[i].can_id & ~CAN_INV_FILTER) &
conn->filters[i].can_mask))
{
return 1;
}
}
else
{
if ((id & conn->filters[i].can_mask) ==
(conn->filters[i].can_id & conn->filters[i].can_mask))
{
return 1;
}
}
}
return 0;
}
#endif
static uint16_t can_recvfrom_eventhandler(FAR struct net_driver_s *dev,
FAR void *pvpriv, uint16_t flags)
{
struct can_recvfrom_s *pstate = pvpriv;
#if defined(CONFIG_NET_CANPROTO_OPTIONS) || defined(CONFIG_NET_TIMESTAMP)
struct can_conn_s *conn = pstate->pr_conn;
#endif
/* 'priv' might be null in some race conditions (?) */
if (pstate)
{
if ((flags & CAN_NEWDATA) != 0)
{
/* If a new packet is available, check receive filters
* when is valid then complete the read action.
*/
#ifdef CONFIG_NET_CANPROTO_OPTIONS
canid_t can_id;
memcpy(&can_id, dev->d_appdata, sizeof(canid_t));
if (can_recv_filter(conn, can_id) == 0)
{
flags &= ~CAN_NEWDATA;
return flags;
}
#endif
/* do not pass frames with DLC > 8 to a legacy socket */
#if defined(CONFIG_NET_CANPROTO_OPTIONS) && defined(CONFIG_NET_CAN_CANFD)
if (!conn->fd_frames)
#endif
{
#ifdef CONFIG_NET_TIMESTAMP
if ((conn->timestamp && (dev->d_len >
sizeof(struct can_frame) + sizeof(struct timeval)))
|| (!conn->timestamp && (dev->d_len >
sizeof(struct can_frame))))
#else
if (dev->d_len > sizeof(struct can_frame))
#endif
{
/* DO WE NEED TO CLEAR FLAGS?? */
flags &= ~CAN_NEWDATA;
return flags;
}
}
/* Copy the packet */
can_newdata(dev, pstate);
/* We are finished. */
/* Don't allow any further call backs. */
pstate->pr_cb->flags = 0;
pstate->pr_cb->priv = NULL;
pstate->pr_cb->event = NULL;
/* indicate that the data has been consumed */
flags &= ~CAN_NEWDATA;
/* Wake up the waiting thread, returning the number of bytes
* actually read.
*/
nxsem_post(&pstate->pr_sem);
}
}
return flags;
}
/****************************************************************************
* Name: can_recvfrom_result
*
* Description:
* Evaluate the result of the recv operations
*
* Input Parameters:
* result The result of the net_sem_wait operation (may indicate EINTR)
* pstate A pointer to the state structure to be initialized
*
* Returned Value:
* The result of the recv operation with errno set appropriately
*
* Assumptions:
*
****************************************************************************/
static ssize_t can_recvfrom_result(int result,
FAR struct can_recvfrom_s *pstate)
{
/* Check for a error/timeout detected by the event handler. Errors are
* signaled by negative errno values for the rcv length
*/
if (pstate->pr_result < 0)
{
/* This might return EAGAIN on a timeout */
return pstate->pr_result;
}
/* If net_sem_wait failed, then we were probably reawakened by a signal.
* In this case, net_sem_wait will have returned negated errno
* appropriately.
*/
if (result < 0)
{
return result;
}
return pstate->pr_recvlen;
}
/****************************************************************************
* Name: can_recvmsg
*
* Description:
* recvmsg() receives messages from a socket, and may be used to receive
* data on a socket whether or not it is connection-oriented.
*
* If from is not NULL, and the underlying protocol provides the source
* address, this source address is filled in. The argument 'msg_namelen'
* initialized to the size of the buffer associated with from, and modified
* on return to indicate the actual size of the address stored there.
*
* Input Parameters:
* psock A pointer to a NuttX-specific, internal socket structure
* msg Buffer to receive the message
* flags Receive flags (ignored)
*
****************************************************************************/
ssize_t can_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg,
int flags)
{
FAR struct can_conn_s *conn;
FAR struct net_driver_s *dev;
struct can_recvfrom_s state;
int ret;
DEBUGASSERT(psock != NULL && psock->s_conn != NULL);
conn = psock->s_conn;
if (psock->s_type != SOCK_RAW)
{
nerr("ERROR: Unsupported socket type: %d\n", psock->s_type);
ret = -ENOSYS;
}
net_lock();
/* Initialize the state structure. */
memset(&state, 0, sizeof(struct can_recvfrom_s));
nxsem_init(&state.pr_sem, 0, 0); /* Doesn't really fail */
state.pr_buflen = msg->msg_iov->iov_len;
state.pr_buffer = msg->msg_iov->iov_base;
#ifdef CONFIG_NET_TIMESTAMP
if (conn->timestamp)
{
state.pr_msgbuf = cmsg_append(msg, SOL_SOCKET, SO_TIMESTAMP,
NULL, sizeof(struct timeval));
if (state.pr_msgbuf != NULL)
{
state.pr_msglen = sizeof(struct timeval);
}
}
#endif
state.pr_conn = conn;
/* Handle any any CAN data already buffered in a read-ahead buffer. NOTE
* that there may be read-ahead data to be retrieved even after the
* socket has been disconnected.
*/
ret = can_readahead(&state);
if (ret > 0)
{
goto errout_with_state;
}
ret = state.pr_recvlen;
/* Handle non-blocking CAN sockets */
if (_SS_ISNONBLOCK(conn->sconn.s_flags) || (flags & MSG_DONTWAIT) != 0)
{
/* Return the number of bytes read from the read-ahead buffer if
* something was received (already in 'ret'); EAGAIN if not.
*/
if (ret < 0)
{
/* Nothing was received */
ret = -EAGAIN;
goto errout_with_state;
}
}
/* Get the device driver that will service this transfer */
dev = conn->dev;
if (dev == NULL)
{
ret = -ENODEV;
goto errout_with_state;
}
/* Set up the callback in the connection */
state.pr_cb = can_callback_alloc(dev, conn);
if (state.pr_cb)
{
state.pr_cb->flags = (CAN_NEWDATA | CAN_POLL);
state.pr_cb->priv = (FAR void *)&state;
state.pr_cb->event = can_recvfrom_eventhandler;
/* Wait for either the receive to complete or for an error/timeout to
* occur. NOTES: (1) net_sem_wait will also terminate if a signal
* is received, (2) the network is locked! It will be un-locked while
* the task sleeps and automatically re-locked when the task restarts.
*/
ret = net_sem_wait(&state.pr_sem);
/* Make sure that no further events are processed */
can_callback_free(dev, conn, state.pr_cb);
ret = can_recvfrom_result(ret, &state);
}
else
{
ret = -EBUSY;
}
errout_with_state:
net_unlock();
nxsem_destroy(&state.pr_sem);
return ret;
}
#endif /* CONFIG_NET_CAN */
|
6a1c420eee97198277aab2961457ae9e503110f3
|
78297bc868d588dd7a16cfea059ef7365ba18622
|
/lib/core/include/irods/msParam.h
|
88d36025aaccab4f361de2ebb22faaba7111b095
|
[
"BSD-3-Clause"
] |
permissive
|
irods/irods
|
ab72a41fdf05a4a905c3e3a97bb7ba3c2a6ae52d
|
f3ccaa842218e477395ebcf553639134433b63ee
|
refs/heads/main
| 2023-09-01T20:12:33.322002
| 2023-08-23T18:22:59
| 2023-08-31T13:41:31
| 14,724,975
| 381
| 167
|
NOASSERTION
| 2023-09-11T18:18:14
| 2013-11-26T18:10:18
|
C++
|
UTF-8
|
C
| false
| false
| 9,700
|
h
|
msParam.h
|
#ifndef IRODS_MS_PARAM_H
#define IRODS_MS_PARAM_H
#include "irods/rods.h"
#include "irods/objInfo.h"
#include "irods/dataObjCopy.h"
#include "irods/structFileExtAndReg.h"
#include "irods/execCmd.h"
#include "irods/rodsPath.h"
/* some commonly used MS (micro service) type */
#define STR_MS_T "STR_PI"
#define INT_MS_T "INT_PI"
#define INT16_MS_T "INT16_PI"
#define CHAR_MS_T "CHAR_PI"
#define BUF_LEN_MS_T "BUF_LEN_PI" /* an integer indication the
* length of BBuf */
#define STREAM_MS_T "INT_PI" /* value from bindStreamToIRods.
* Caller should use rcStreamRead
* and rcStreamClose to read */
#define DOUBLE_MS_T "DOUBLE_PI"
#define FLOAT_MS_T "FLOAT_PI"
#define BOOL_MS_T "BOOL_PI"
#define DataObjInp_MS_T "DataObjInp_PI"
#define DataObjCloseInp_MS_T "DataObjCloseInp_PI"
#define DataObjCopyInp_MS_T "DataObjCopyInp_PI"
#define DataObjReadInp_MS_T "dataObjReadInp_PI"
#define DataObjWriteInp_MS_T "dataObjWriteInp_PI"
#define DataObjLseekInp_MS_T "fileLseekInp_PI"
#define DataObjLseekOut_MS_T "fileLseekOut_PI"
#define KeyValPair_MS_T "KeyValPair_PI"
#define TagStruct_MS_T "TagStruct_PI"
#define CollInp_MS_T "CollInpNew_PI"
#define ExecCmd_MS_T "ExecCmd_PI"
#define ExecCmdOut_MS_T "ExecCmdOut_PI"
#define RodsObjStat_MS_T "RodsObjStat_PI"
#define VaultPathPolicy_MS_T "VaultPathPolicy_PI"
#define StrArray_MS_T "StrArray_PI"
#define IntArray_MS_T "IntArray_PI"
#define GenQueryInp_MS_T "GenQueryInp_PI"
#define GenQueryOut_MS_T "GenQueryOut_PI"
#define StructFileExtAndRegInp_MS_T "StructFileExtAndRegInp_PI"
#define RuleSet_MS_T "RuleSet_PI"
#define RuleStruct_MS_T "RuleStruct_PI"
#define DVMapStruct_MS_T "DVMapStruct_PI"
#define FNMapStruct_MS_T "FNMapStruct_PI"
#define MsrvcStruct_MS_T "MsrvcStruct_PI"
#define NcOpenInp_MS_T "NcOpenInp_PI"
#define NcInqIdInp_MS_T "NcInqIdInp_PI"
#define NcInqWithIdOut_MS_T "NcInqWithIdOut_PI"
#define NcInqInp_MS_T "NcInqInp_PI"
#define NcInqOut_MS_T "NcInqOut_PI"
#define NcCloseInp_MS_T "NcCloseInp_PI"
#define NcGetVarInp_MS_T "NcGetVarInp_PI"
#define NcGetVarOut_MS_T "NcGetVarOut_PI"
#define NcInqOut_MS_T "NcInqOut_PI"
#define NcInqGrpsOut_MS_T "NcInqGrpsOut_PI"
#define Dictionary_MS_T "Dictionary_PI"
#define DictArray_MS_T "DictArray_PI"
#define GenArray_MS_T "GenArray_PI"
#define DataObjInfo_MS_T "DataObjInfo_PI"
/* micro service input/output parameter */
typedef struct MsParam {
char *label;
char *type; /* this is the name of the packing instruction in
* rodsPackTable.h */
void *inOutStruct;
bytesBuf_t *inpOutBuf;
} msParam_t;
typedef struct MsParamArray {
int len;
int oprType;
msParam_t **msParam;
} msParamArray_t;
#define MS_INP_SEP_STR "++++" /* the separator str for msInp */
#define MS_NULL_STR "null" /* no input */
typedef struct ParsedMsKeyValStr {
char *inpStr;
char *endPtr; /* end pointer */
char *curPtr; /* current position */
char *kwPtr;
char *valPtr;
} parsedMsKeyValStr_t;
typedef struct ValidKeyWd {
int flag;
char *keyWd;
} validKeyWd_t;
/* valid keyWd flags for dataObjInp_t */
#define RESC_NAME_FLAG 0x1
#define DEST_RESC_NAME_FLAG 0x2
#define BACKUP_RESC_NAME_FLAG 0x4
#define FORCE_FLAG_FLAG 0x8
#define ALL_FLAG 0x10
#define LOCAL_PATH_FLAG 0x20
#define VERIFY_CHKSUM_FLAG 0x40
#define ADMIN_FLAG 0x80
#define UPDATE_REPL_FLAG 0x100
#define REPL_NUM_FLAG 0x200
#define DATA_TYPE_FLAG 0x400
#define CHKSUM_ALL_FLAG 0x800
#define FORCE_CHKSUM_FLAG 0x1000
#define FILE_PATH_FLAG 0x2000
#define CREATE_MODE_FLAG 0x4000
#define OPEN_FLAGS_FLAG 0x8000
#define COLL_FLAGS_FLAG 0x10000
#define DATA_SIZE_FLAGS 0x20000
#define NUM_THREADS_FLAG 0x40000
#define OPR_TYPE_FLAG 0x80000
#define OBJ_PATH_FLAG 0x100000
#define COLL_NAME_FLAG 0x200000
#define RMTRASH_FLAG 0x400000
#define ADMIN_RMTRASH_FLAG 0x800000
#define DEF_RESC_NAME_FLAG 0x1000000
#define RBUDP_TRANSFER_FLAG 0x2000000
#define RBUDP_SEND_RATE_FLAG 0x4000000
#define RBUDP_PACK_SIZE_FLAG 0x8000000
#define BULK_OPR_FLAG 0x10000000
#define UNREG_FLAG 0x20000000
#ifdef __cplusplus
extern "C" {
#endif
int
resetMsParam( msParam_t *msParam );
int
clearMsParam( msParam_t *msParam, int freeStruct );
int
addMsParam( msParamArray_t *msParamArray, const char *label,
const char *packInstruct, void *inOutStruct, bytesBuf_t *inpOutBuf );
int
addIntParamToArray( msParamArray_t *msParamArray, char *label, int inpInt );
int
addMsParamToArray( msParamArray_t *msParamArray, const char *label,
const char *type, void *inOutStruct, bytesBuf_t *inpOutBuf, int replFlag );
int
replMsParamArray( msParamArray_t *msParamArray,
msParamArray_t *outMsParamArray );
int
replMsParam( msParam_t *msParam, msParam_t *outMsParam );
int
replInOutStruct( void *inStruct, void **outStruct, const char *type );
bytesBuf_t*
replBytesBuf( const bytesBuf_t* in);
int
fillMsParam( msParam_t *msParam, const char *label,
const char *type, void *inOutStruct, bytesBuf_t *inpOutBuf );
msParam_t *
getMsParamByLabel( msParamArray_t *msParamArray, const char *label );
msParam_t *
getMsParamByType( msParamArray_t *msParamArray, const char *type );
int
rmMsParamByLabel( msParamArray_t *msParamArray, const char *label, int freeStruct );
// Trims all MsParam elements from msParamArray that do not have a type or do not have
// a label string which matches a string in outParamDesc.
int trimMsParamArray(msParamArray_t* msParamArray, char* outParamDesc);
int
printMsParam( msParamArray_t *msParamArray );
int
writeMsParam( char *buf, int len, msParam_t *msParam );
int
clearMsParamArray( msParamArray_t *msParamArray, int freeStruct );
void
fillIntInMsParam( msParam_t *msParam, const int myInt );
void
fillFloatInMsParam( msParam_t *msParam, const float myFloat );
void
fillCharInMsParam( msParam_t *msParam, const char myChar );
void
fillDoubleInMsParam( msParam_t *msParam, const rodsLong_t myDouble );
void
fillStrInMsParam( msParam_t *msParam, const char *myStr );
void
fillBufLenInMsParam( msParam_t *msParam, int myInt, bytesBuf_t *bytesBuf );
int
parseMspForDataObjInp( msParam_t *inpParam, dataObjInp_t *dataObjInpCache,
dataObjInp_t **outDataObjInp, int writeToCache );
int
parseMspForCollInp( msParam_t *inpParam, collInp_t *collInpCache,
collInp_t **outCollInp, int writeToCache );
int
parseMspForCondInp( msParam_t *inpParam, keyValPair_t *condInput,
char *condKw );
int
parseMspForCondKw( msParam_t *inpParam, keyValPair_t *condInput );
int
parseMspForPhyPathReg( msParam_t *inpParam, keyValPair_t *condInput );
int
parseMspForPosInt( msParam_t *inpParam );
char *
parseMspForStr( msParam_t *inpParam );
int
parseMspForFloat( msParam_t *inpParam, float *floatout );
int
parseMspForDouble( msParam_t *inpParam, double *doubleout );
int
parseMspForDataObjCopyInp( msParam_t *inpParam,
dataObjCopyInp_t *dataObjCopyInpCache, dataObjCopyInp_t **outDataObjCopyInp );
int
parseMspForExecCmdInp( msParam_t *inpParam,
execCmd_t *execCmdInpCache, execCmd_t **ouExecCmdInp );
void
*getMspInOutStructByLabel( msParamArray_t *msParamArray, const char *label );
int
getStdoutInExecCmdOut( msParam_t *inpExecCmdOut, char **outStr );
int
getStderrInExecCmdOut( msParam_t *inpExecCmdOut, char **outStr );
int
initParsedMsKeyValStr( char *inpStr, parsedMsKeyValStr_t *parsedMsKeyValStr );
int
clearParsedMsKeyValStr( parsedMsKeyValStr_t *parsedMsKeyValStr );
int
getNextKeyValFromMsKeyValStr( parsedMsKeyValStr_t *parsedMsKeyValStr );
int
parseMsKeyValStrForDataObjInp( msParam_t *inpParam, dataObjInp_t *dataObjInp,
char *hintForMissingKw, int validKwFlags, char **outBadKeyWd );
int
chkDataObjInpKw( char *keyWd, int validKwFlags );
int
parseMsKeyValStrForCollInp( msParam_t *inpParam, collInp_t *collInp,
char *hintForMissingKw, int validKwFlags, char **outBadKeyWd );
int
chkCollInpKw( char *keyWd, int validKwFlags );
int
addKeyValToMspStr( msParam_t *keyStr, msParam_t *valStr,
msParam_t *msKeyValStr );
int
chkStructFileExtAndRegInpKw( char *keyWd, int validKwFlags );
int
parseMsKeyValStrForStructFileExtAndRegInp( msParam_t *inpParam,
structFileExtAndRegInp_t *structFileExtAndRegInp,
char *hintForMissingKw, int validKwFlags, char **outBadKeyWd );
int
parseMsParamFromIRFile( msParamArray_t *inpParamArray, char *inBuf );
/// Deallocates memory which contains the type information for a microservice parameter.
///
/// \param[in] _msp The microservice parameter to check.
///
/// \since 4.2.12
void msp_free_type(struct MsParam* _msp);
/// Deallocates memory which contains the value information for a microservice parameter.
///
/// This function requires that the type information be valid, otherwise this function will result in a no-op.
///
/// \param[in] _msp The microservice parameter to check.
///
/// \since 4.2.12
void msp_free_inOutStruct(struct MsParam* _msp);
#ifdef __cplusplus
}
#endif
#endif // IRODS_MS_PARAM_H
|
0f13dfc1c8d266ddb5c565cd3535980688f996fc
|
2b4867ce106d3068b67f2244019247df9cf6f341
|
/tests/runner-tests/io.c
|
074ce4403c1cf922efc5526dea363d8ab9328da2
|
[
"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
| 161
|
c
|
io.c
|
// output: BEGIN:
// hi
// hello
// hi
// END
int puts(const char*);
int *s1 = "hi", *s2 = "hello", *s3 = "hi";
int main() {
puts(s1);
puts(s2);
puts(s3);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.