Top Tweets for #EndIf
@SyntaxError2505 @zuhaitz_dev ```#if 0 #!/bin/sh gcc file.c -o prog && ./prog exit #endif```
Xojo conditional compilation uses #If, #ElseIf, #Else, and #EndIf to control what gets compiled for a given target. You can branch on built-in constants like DebugBuild, TargetWindows, TargetMacOS, and Target64bit, or on your own constants. It also extends beyond code blocks, since Inspector flags can include or exclude project items, methods, properties, and more.
#Xojo #CompilerDirectives #APIDesign #SoftwareArchitecture

Wow. It would have been a lot less code to just do
#if !defined(NO_SYMLINK_HEAD) && !defined(WITH_BREAKING_CHANGES))
if(!create_ref_symlink(lock, update->new_target))
continue
#endif
than to just silently shunt the create_ref_symlink function and introduce a whole new file just to quash the warning.
The fact that you even had to look multiple places to see that create_ref_symlink was being shunted shows how poorly designed this hack is!
@AnshumanKhanna5 To clarify, I saw someone write a header guard like this:
#ifdef __SOMELIB_H__
#define __SOMELIB_H__
void func(void);
#endif
And was then confused why the compiler was saying `func` didn't exist.
以下のようにC言語に変換されます。
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <math.h>
#include <time.h>
#include <string.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
void runtime_error(const char *msg);
double input_number(void);
double read_line_as_number(void);
void set_read_delimiter(const char *delimiter);
int split_read_line(double *values, int max_values);
void read_line_into_vars(int expected_count, ...);
int read_line_into_array(int array_idx);
void read_binary_byte_into_var(int var_idx);
int read_binary_into_array(int array_idx);
double safe_div(double left, double right);
double safe_sqr(double value);
double rnd_basic(double arg);
double date_part(double selector);
unsigned long long mask_for_bits(int bits);
void basic_spc(double count, const char *text);
void print_binary(unsigned long long value, int width);
void print_array_full(int array_idx);
void write_array_bytes(int array_idx);
void free_arrays(void);
void close_input_file(void);
int checked_array_index(int array_idx, double subscript);
double get_array_value(int array_idx, double subscript);
double *array_element_ptr(int array_idx, double subscript);
void dim_array(int array_idx, double upper_bound);
int is_eof(void);
double vars[26];
double loop_limit[26];
double loop_step[26];
double *arrays[26];
int array_sizes[26];
int array_read_counts[26];
double args_buffer[26];
int args_count = 0;
int stack[256];
int sp = 0;
double var_stack[1024][26];
int var_sp = 0;
double return_reg = 0.0;
int current_line = 0;
FILE *input_fp = NULL;
char read_delimiter[16] = ",";
void runtime_error(const char *msg) {
fprintf(stderr, "Runtime error at BASIC line %d: %s\n", current_line, msg);
exit(1);
}
double input_number(void) {
char buffer[1024];
if (!fgets(buffer, sizeof(buffer), stdin)) {
runtime_error("INPUT failed");
}
return atof(buffer);
}
double read_line_as_number(void) {
char buffer[1024];
if (input_fp == NULL) {
runtime_error("READ input file is not open");
}
if (!fgets(buffer, sizeof(buffer), input_fp)) {
if (feof(input_fp)) {
runtime_error("READ attempted at EOF");
}
runtime_error("READ failed");
}
return atof(buffer);
}
void set_read_delimiter(const char *delimiter) {
size_t len;
if (delimiter == NULL || delimiter[0] == '\0') {
runtime_error("Delimiter must not be empty");
}
len = strlen(delimiter);
if (len >= sizeof(read_delimiter)) {
runtime_error("Delimiter is too long");
}
memcpy(read_delimiter, delimiter, len + 1);
}
int split_read_line(double *values, int max_values) {
char buffer[1024];
char *cursor;
size_t delim_len;
int count;
if (input_fp == NULL) {
runtime_error("READ input file is not open");
}
if (!fgets(buffer, sizeof(buffer), input_fp)) {
if (feof(input_fp)) {
runtime_error("READ attempted at EOF");
}
runtime_error("READ failed");
}
buffer[strcspn(buffer, "\r\n")] = '\0';
if (buffer[0] == '\0') {
return 0;
}
delim_len = strlen(read_delimiter);
cursor = buffer;
count = 0;
while (1) {
char *sep = strstr(cursor, read_delimiter);
char *token = cursor;
char *endptr;
double value;
if (sep != NULL) {
*sep = '\0';
cursor = sep + delim_len;
} else {
cursor = NULL;
}
value = strtod(token, &endptr);
if (endptr == token) {
value = 0.0;
}
if (count < max_values) {
values[count] = value;
}
++count;
if (cursor == NULL) {
break;
}
}
return count;
}
void read_line_into_vars(int expected_count, ...) {
double values[256];
va_list ap;
int count;
int i;
if (expected_count < 0 || expected_count > 256) {
runtime_error("READ variable count out of range");
}
count = split_read_line(values, expected_count);
if (count < expected_count) {
runtime_error("READ line has fewer values than expected");
}
va_start(ap, expected_count);
for (i = 0; i < expected_count; ++i) {
double *dest = va_arg(ap, double *);
*dest = values[i];
}
va_end(ap);
}
int read_line_into_array(int array_idx) {
double values[2048];
int count;
int i;
int limit;
if (arrays[array_idx] == NULL) {
runtime_error("Array used before DIM");
}
count = split_read_line(values, 2048);
limit = array_sizes[array_idx];
if (count > limit) {
count = limit;
}
for (i = 0; i < count; ++i) {
arrays[array_idx][i + 1] = values[i];
}
return count;
}
void read_binary_byte_into_var(int var_idx) {
int byte_value;
if (input_fp == NULL) {
runtime_error("READBIN input file is not open");
}
byte_value = fgetc(input_fp);
if (byte_value == EOF) {
if (ferror(input_fp)) {
runtime_error("READBIN failed");
}
return;
}
vars[var_idx] = (double)((unsigned char)byte_value);
}
int read_binary_into_array(int array_idx) {
int count;
int byte_value;
if (input_fp == NULL) {
runtime_error("READBIN input file is not open");
}
if (arrays[array_idx] == NULL) {
runtime_error("Array used before DIM");
}
count = 0;
while (count < array_sizes[array_idx]) {
byte_value = fgetc(input_fp);
if (byte_value == EOF) {
if (ferror(input_fp)) {
runtime_error("READBIN failed");
}
break;
}
++count;
arrays[array_idx][count] = (double)((unsigned char)byte_value);
}
return count;
}
double safe_div(double left, double right) {
if (right == 0.0) {
runtime_error("Division by zero");
}
return left / right;
}
double safe_sqr(double value) {
if (value < 0.0) {
runtime_error("SQR of negative value");
}
return sqrt(value);
}
double rnd_basic(double arg) {
(void)arg;
return (double)rand() / (double)RAND_MAX;
}
double date_part(double selector) {
time_t now;
struct tm local_tm;
struct tm *tm_ptr;
int part;
part = (int)selector;
now = time(NULL);
tm_ptr = localtime(&now);
if (tm_ptr == NULL) {
runtime_error("DATE failed");
}
local_tm = *tm_ptr;
switch (part) {
case 0: return (double)(local_tm.tm_year + 1900);
case 1: return (double)(local_tm.tm_mon + 1);
case 2: return (double)local_tm.tm_mday;
case 3: return (double)local_tm.tm_wday;
case 4: return (double)local_tm.tm_hour;
case 5: return (double)local_tm.tm_min;
case 6: return (double)local_tm.tm_sec;
case 7:
#ifdef TIME_UTC
{
struct timespec ts;
if (timespec_get(&ts, TIME_UTC) == 0) {
runtime_error("DATE failed");
}
return (double)(https://t.co/pV0PdztKuH_nsec / 1000000L);
}
#else
return 0.0;
#endif
default:
runtime_error("DATE argument out of range");
}
return 0.0;
}
unsigned long long mask_for_bits(int bits) {
if (bits <= 0) {
return 0ULL;
}
if (bits >= (int)(sizeof(unsigned long long) * 8)) {
return ~0ULL;
}
return (1ULL << bits) - 1ULL;
}
void basic_spc(double count, const char *text) {
int n;
int i;
size_t len;
if (text == NULL || text[0] == '\0') {
text = " ";
}
n = (int)count;
if (n <= 0) {
return;
}
len = strlen(text);
for (i = 0; i < n; ++i) {
fwrite(text, 1, len, stdout);
}
}
void print_binary(unsigned long long value, int width) {
int i;
value &= mask_for_bits(width);
for (i = width - 1; i >= 0; --i) {
printf("%c", (value & (1ULL << i)) ? '1' : '0');
}
}
void print_array_full(int array_idx) {
int count;
int i;
if (arrays[array_idx] == NULL) {
runtime_error("Array used before DIM");
}
count = array_read_counts[array_idx];
if (count <= 0) {
count = array_sizes[array_idx];
}
if (count > array_sizes[array_idx]) {
count = array_sizes[array_idx];
}
for (i = 1; i <= count; ++i) {
if (i > 1) {
printf("%s", ", ");
}
printf("%g", arrays[array_idx][i]);
}
}
void write_array_bytes(int array_idx) {
int count;
int i;
if (arrays[array_idx] == NULL) {
runtime_error("Array used before DIM");
}
count = array_read_counts[array_idx];
if (count <= 0) {
count = array_sizes[array_idx];
}
if (count > array_sizes[array_idx]) {
count = array_sizes[array_idx];
}
for (i = 1; i <= count; ++i) {
fputc((unsigned char)((long long)(arrays[array_idx][i])), stdout);
}
}
void close_input_file(void) {
if (input_fp != NULL && input_fp != stdin) {
fclose(input_fp);
}
input_fp = NULL;
}
void free_arrays(void) {
int i;
for (i = 0; i < 26; ++i) {
free(arrays[i]);
arrays[i] = NULL;
array_sizes[i] = 0;
}
}
int checked_array_index(int array_idx, double subscript) {
int index;
if (arrays[array_idx] == NULL) {
runtime_error("Array used before DIM");
}
if (subscript < 0.0 || floor(subscript) != subscript) {
runtime_error("Array index must be a non-negative integer");
}
index = (int)subscript;
if (index > array_sizes[array_idx]) {
runtime_error("Array index out of bounds");
}
return index;
}
double get_array_value(int array_idx, double subscript) {
return arrays[array_idx][checked_array_index(array_idx, subscript)];
}
double *array_element_ptr(int array_idx, double subscript) {
return &arrays[array_idx][checked_array_index(array_idx, subscript)];
}
void dim_array(int array_idx, double upper_bound) {
size_t count;
if (upper_bound < 0.0 || floor(upper_bound) != upper_bound) {
runtime_error("DIM size must be a non-negative integer");
}
count = (size_t)((int)upper_bound + 1);
free(arrays[array_idx]);
arrays[array_idx] = (double *)calloc(count, sizeof(double));
if (arrays[array_idx] == NULL) {
runtime_error("Out of memory during DIM");
}
array_sizes[array_idx] = (int)upper_bound;
}
int is_eof(void) {
int ch;
if (input_fp == NULL) {
return 1;
}
ch = fgetc(input_fp);
if (ch == EOF) {
return 1;
}
if (ungetc(ch, input_fp) == EOF) {
runtime_error("Failed to unread input stream");
}
return 0;
}
int main(int argc, char *argv[]) {
int i;
int line = 10;
srand((unsigned int)time(NULL));
for (i = 0; i < 26; ++i) {
arrays[i] = NULL;
array_sizes[i] = 0;
array_read_counts[i] = 0;
}
if (argc > 1) {
input_fp = fopen(argv[1], "r");
if (input_fp == NULL) {
runtime_error("Could not open input file");
}
} else {
input_fp = stdin;
}
atexit(free_arrays);
atexit(close_input_file);
while (line != 0) {
switch (line) {
case 10:
current_line = 10;
dim_array(3, 16.0);
line = 20;
break;
line = 20;
break;
case 20:
current_line = 20;
vars[0] = 0.0;
line = 30;
break;
line = 30;
break;
case 30:
current_line = 30;
line = 40;
break;
line = 40;
break;
case 40:
current_line = 40;
if (is_eof()) {
line = 0;
break;
} else {
line = 50;
break;
}
case 50:
current_line = 50;
if (arrays[3] != NULL) {
array_read_counts[3] = read_binary_into_array(3);
} else {
read_binary_byte_into_var(3);
array_read_counts[3] = 0;
}
line = 60;
break;
line = 60;
break;
case 60:
current_line = 60;
if ((((double)(array_read_counts[3])) == 0.0)) {
line = 0;
break;
} else {
line = 70;
break;
}
case 70:
current_line = 70;
{
char format_buffer[1024];
snprintf(format_buffer, sizeof(format_buffer), "%08X ", (unsigned int)(vars[0]));
printf("%s", format_buffer);
}
line = 80;
break;
line = 80;
break;
case 80:
current_line = 80;
vars[8] = 1.0;
loop_limit[8] = ((double)(array_read_counts[3]));
loop_step[8] = 1.0;
if (loop_step[8] == 0.0) runtime_error("FOR STEP cannot be zero");
if (((loop_step[8] > 0.0) && (vars[8] <= loop_limit[8])) || ((loop_step[8] < 0.0) && (vars[8] >= loop_limit[8]))) {
line = 90;
} else {
line = 110;
break;
}
break;
line = 90;
break;
case 90:
current_line = 90;
{
char format_buffer[1024];
snprintf(format_buffer, sizeof(format_buffer), "%02X ", (unsigned int)(get_array_value(3, vars[8])));
printf("%s", format_buffer);
}
line = 100;
break;
line = 100;
break;
case 100:
current_line = 100;
vars[8] += loop_step[8];
if (((loop_step[8] > 0.0) && (vars[8] <= loop_limit[8])) || ((loop_step[8] < 0.0) && (vars[8] >= loop_limit[8]))) {
line = 90;
} else {
line = 110;
}
break;
case 110:
current_line = 110;
basic_spc(((16.0 - ((double)(array_read_counts[3]))) * 3.0), " ");
line = 120;
break;
line = 120;
break;
case 120:
current_line = 120;
vars[8] = 1.0;
loop_limit[8] = ((double)(array_read_counts[3]));
loop_step[8] = 1.0;
if (loop_step[8] == 0.0) runtime_error("FOR STEP cannot be zero");
if (((loop_step[8] > 0.0) && (vars[8] <= loop_limit[8])) || ((loop_step[8] < 0.0) && (vars[8] >= loop_limit[8]))) {
line = 130;
} else {
line = 150;
break;
}
break;
line = 130;
break;
case 130:
current_line = 130;
if ((get_array_value(3, vars[8]) < 32.0)) {
printf("%s", ".");
line = 140;
break;
} else {
putchar((unsigned char)(get_array_value(3, vars[8])));
line = 140;
break;
}
case 140:
current_line = 140;
vars[8] += loop_step[8];
if (((loop_step[8] > 0.0) && (vars[8] <= loop_limit[8])) || ((loop_step[8] < 0.0) && (vars[8] >= loop_limit[8]))) {
line = 130;
} else {
line = 150;
}
break;
case 150:
current_line = 150;
printf("\n");
line = 160;
break;
line = 160;
break;
case 160:
current_line = 160;
vars[0] = (vars[0] + 16.0);
line = 170;
break;
line = 170;
break;
case 170:
current_line = 170;
line = 30;
break;
default:
fprintf(stderr, "Line %d not found\n", line);
return 1;
}
}
return 0;
}
@seremptos Common/Consoles_App.cpp
in DebugPrintf (like all of them)
#ifdef _WINDOWS64
printf("%s",buf);
#endif
@engeikana 一行だけ無効化するなら #if ~ #endif や /* */ で囲むよりも
// の単発でやるほうがタイプの手間は少ないですね
(※1 が、C++系から輸入されるまで時差があった)
(※2 /* */ はコメントのネスト問題も発生)
SpriteEngineって名前にしたけど
OpenSpriteKitにすればよかった。
これで動くようにすべきだわ。設計変更しよ。
#if canImport(SpriteKit)
import SpriteKit
#else
import OpenSpriteKit
#endif
#SwiftWasm
Last Seen Hashtags on Sotwe
T20WorldCup
MOMSON (*******)**************************+filter:native_video
Seen from France
SobhitaDhulipala
Seen from India
โชว์หีเมีย
Seen from Thailand
momson ()
Seen from Italy
omegle
Seen from Netherlands
shemale
Seen from Pakistan
osmanbeygay
Seen from Turkey
后入
Seen from United States
技师
Seen from United States
Most Popular Users

Elon Musk 
@elonmusk
241M followers

Barack Obama 
@barackobama
119.2M followers

Cristiano Ronaldo 
@cristiano
111.9M followers

Donald J. Trump 
@realdonaldtrump
111.8M followers

Narendra Modi 
@narendramodi
107M followers

Rihanna 
@rihanna
98M followers

NASA 
@nasa
92.2M followers

Justin Bieber 
@justinbieber
91.2M followers

KATY PERRY 
@katyperry
88.4M followers

Taylor Swift 
@taylorswift13
82.3M followers

Lady Gaga 
@ladygaga
73.8M followers

Virat Kohli 
@imvkohli
71M followers

Kim Kardashian 
@kimkardashian
70.1M followers

YouTube 
@youtube
68.7M followers

Bill Gates 
@billgates
64.3M followers

Neymar Jr 
@neymarjr
63.9M followers

The Ellen Show
@theellenshow
62.4M followers

CNN 
@cnn
61.8M followers

Selena Gomez 
@selenagomez
61.5M followers

X 
@x
60.8M followers

















