JSFiddle - React, Tailwind, and code Playground
HTML
#include <iostream>
using namespace std;
#include <string.h>
#include <ctype.h>
#include "segment.h"
#define NUM_MAX 10
#define LOOP 10
int bit_to_ascii(const char input[], char output[]) {
const char *source = input;
char *dst = output;
int num = 0, num_bits = 0, repeat = 1;
while (*source != '\0') {
switch (*source++) {
case '0':
num += num; num_bits++;
break;
case '1':
num += num + 1; num_bits++;
break;
case 'S':
if (source[0] == 'K' && source[1] == 'P') {
int skip = 8;
while (skip > 0) {
if (*source == '0' || *source == '1')
skip--;
source++;
}
}
break;
case 'R':
if (source[0] == 'P' && source[1] == 'T') {
source += 2;
repeat = 0;
while (isdigit(*source))
repeat = (repeat * 10) + (*source++ - '0');
if (num_bits == 0) {
char last = *(dst - 1);
for (repeat; repeat > 1; repeat--)
*dst++ = last;
}
else
while (num_bits <...
JavaScript
#include <stdio.h>
#include <string.h>
#include "segment.h"
#define LOOP 10
int main( ) {
const char core_data[ ][2000] = {
"0", /* should insert the null byte '\0' only */
"01010111 This sequence contains the letter 'W' " /* 87 = 'W' */
" r5 0 #! 1 1 gP 0 f66-:] 0 [ } 1 v4t^ 0 1 n>?:77" /* 101 = 'e' */
" junk ^*@&#^% 0110 more junk }{r;,<> 1100 2x" /* 108 = 'l' */
" 0 1 1 0 0 011" /* 99 = 'c' */
"0 ^%jh 1 ]{) OVR 1 - 0 _! 9 + 1 118Y z(x pM1 " /* 111 = 'o' */
"This next group of 8 should be SKP skipped! 11111111 " /* skipped */
"*&^! 0 1 1 0 1 1 0 128673kjshd:L< 2938 " /* 109 = 'm' */
" r5 0 #! 1 1 gP 0 f66-:] 0 [ } 1 v4t^ 0 1 n>?:77" /* 101 = 'e' */
"#!/bin/bash 00 1 00 00 0 g^b-ps 6@&^% " /* 32 = ' ' */
"01010100 This sequence contains the letter 'T' " /* 84 = 'T' */
"0 ^%jh 1 ]{) OVR 1 - 0 _! 9 + 1 118Y z(x pM1 " /* 111 = 'o' */
"#!/bin/bash 00 1 00 00 0 g^b-ps 6@&^% " /* 32 = ' ' */
"---repeat--->0 1 0 0 1 1 1 1<------------RPT2--------" /* 79 = 'O' */
"0 1 0 1 0bbavac9872962 000&*************************" /* 80 = 'P' */
"a0b0c1dpe1f0g0h01ijklmnopqrstuvwxyz******************" /* 49 = '1' */
"00fg333 110100>>>>>>>>" /* 52 = '4' */
"00fg333 110100>>>>>>>>" /* 52 = '4' */
" 0000 ",/* 0 = '\0' */
"00011110 This char should not be inserted! " /* 30 cntrl */
" 00011111 This char should not be inserted! " /* 31 cntrl */
" 00100000 " /* 32 = ' ' */
" 00100001 " /* 33 = '!' */
" 00100010 " /* 34 = '"' */
" 00100011 " /* 35 = '#' */
" 00100100 " /* 36 = '$' */
" 00100101 ...