This commit is contained in:
2022-01-19 23:53:51 +03:00
parent 5e75552199
commit cf8aa8bff0
17 changed files with 144 additions and 72 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -31,7 +31,7 @@ std_test: std_build_test
# using cosmopolitan
COSMARGS_PRE=-g -O -static -fno-pie -no-pie -mno-red-zone -nostdlib -nostdinc -D COSMOPOLITAN
COSMARGS_POST=-Wl,--oformat=binary -Wl,--gc-sections -Wl,-z,max-page-size=0x1000 -fuse-ld=bfd -Wl,-T,cosmopolitan/ape.lds \
-include cosmopolitan/cosmopolitan.h cosmopolitan/crt.o ./cosmopolitan/ape-no-modify-self.o cosmopolitan/cosmopolitan.a
-include cosmopolitan/cosmopolitan.h cosmopolitan/crt.o ./cosmopolitan/ape.o cosmopolitan/cosmopolitan.a
build: build_test
+24
View File
@@ -0,0 +1,24 @@
# DtsodC
DtsodV23 parser in C# works too slow, so i wrote V24 parser in C
<br>
## Compiling on Linux
**Required packages:** gcc
Compile with glibc:
```bash
make std_build
````
Compile with <a href="https://github.com/jart/cosmopolitan">cosmopolitan<a> (crossplatform libc implementation):
```bash
make build
```
If you see the `run-detectors: unable to find an interpreter` error, just execute this command:
```bash
sudo sh -c "echo ':APE:M::MZqFpD::/bin/sh:' >/proc/sys/fs/binfmt_misc/register"
```
+14
View File
@@ -0,0 +1,14 @@
#if COSMOPOLITAN
#include "../cosmopolitan/cosmopolitan.h"
#else
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <locale.h>
#include <uchar.h>
#include <wchar.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#endif
+1 -5
View File
@@ -1,6 +1,2 @@
#if COSMOPOLITAN
#include "../cosmopolitan/cosmopolitan.h"
#else
#include "stdio.h"
#endif
+1 -5
View File
@@ -1,6 +1,2 @@
#if COSMOPOLITAN
#include "../cosmopolitan/cosmopolitan.h"
#else
#include "stdio.h"
#endif
+2 -6
View File
@@ -1,10 +1,6 @@
#ifndef STDLIB
#include "../../cosmopolitan/cosmopolitan.h"
#else
#include <stdint.h>
#endif
#include "../!headers.h"
#include "../strict_types.h"
#include "../err_t.h"
#include "../errors.h"
typedef struct Autoarr{
void** values;
+12
View File
@@ -0,0 +1,12 @@
#include "!headers.h"
#include "strict_types.h"
#ifndef __NSLEEP_DEFINED
#define __NSLEEP_DEFINED
void nsleep(uint8 sec, uint8 milisec){
if (sec>0)
sleep(sec);
if (milisec>0)
usleep(milisec*1000);
}
#endif
+53
View File
@@ -0,0 +1,53 @@
#include "!headers.h"
const wchar_t* slimak =
U" ▄▄▄ \n"
"▄▀░▄░▀▄ \n"
"█░█▄▀░█ \n"
"█░▀▄▄▀█▄█▄▀ \n"
"▄▄█▄▄▄▄███▀ \n"
" ▄▄▄ \n"
" █▀▄▄░▀█ \n"
"█░█░▄▀░░█ \n"
"█░▀▄▄▄▀░█▄█▄▄▀ \n"
"▄▄█▄▄▄▄███▀▀ \n"
" ▄▄▄ \n"
" █▀▄▄░▀█ \n"
"█░█░▄▀░░█ \n"
"█░▀▄▄▄▀░█▄█▄▄▀ \n"
"▄▄█▄▄▄▄████▀▀ \n"
" ▄▄▄ \n"
" ▄▀░▄░▀▄ \n"
" █░█▄▀░█ \n"
" █░▀▄▄▀█▄█▄▀ \n"
" ▄▄█▄▄▄▄███▀ \n"
" ▄▄▄ \n"
" █▀▄▄░▀█ \n"
" █░█░▄▀░░█ \n"
" █░▀▄▄▄▀░█▄█▄▄▀ \n"
" ▄▄█▄▄▄▄███▀▀ \n"
" ▄▄▄ \n"
" █▀▄▄░▀█ \n"
" █░█░▄▀░░█ \n"
" █░▀▄▄▄▀░█▄█▄▄▀ \n"
" ▄▄█▄▄▄▄████▀▀ \n"
" ▄▄▄ \n"
" ▄▀░▄░▀▄ \n"
" █░█▄▀░█ \n"
" █░▀▄▄▀█▄█▄▀ \n"
" ▄▄█▄▄▄▄███▀ \n"
" ▄▄▄ \n"
" █▀▄▄░▀█ \n"
" █░█░▄▀░░█ \n"
" █░▀▄▄▄▀░█▄█▄▄▀\n"
" ▄▄█▄▄▄▄███▀▀ \n"
" ▄▄▄ \n"
" █▀▄▄░▀█ \n"
" █░█░▄▀░░█ \n"
" █░▀▄▄▄▀░█▄█▄▄▀\n"
" ▄▄█▄▄▄▄████▀▀ \n"
" ▄▄▄ \n"
" ▄▀░▄░▀▄ \n"
" █░█▄▀░█ \n"
" █░▀▄▄▀█▄█▄▀\n"
" ▄▄█▄▄▄▄███▀ \n";
+2 -6
View File
@@ -1,10 +1,6 @@
#ifndef STDLIB
#include "../cosmopolitan/cosmopolitan.h"
#else
#include "stdint.h"
#endif
#include "!headers.h"
#include "strict_types.h"
#include "err_t.h"
#include "errors.h"
int8 GetTypeSize(strict_type type){
int8 type_size=0;
+2 -6
View File
@@ -1,9 +1,5 @@
#ifndef STDLIB
#include "../cosmopolitan/cosmopolitan.h"
#else
#include "stdint.h"
#endif
#include "err_t.h"
#include "!headers.h"
#include "errors.h"
typedef int8_t int8;
typedef uint8_t uint8;
+25 -36
View File
@@ -1,45 +1,34 @@
#ifndef STDLIB
#include "../cosmopolitan/cosmopolitan.h"
#else
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <locale.h>
#include <uchar.h>
#include <wchar.h>
#include <sys/stat.h>
#include <time.h>
#endif
#include "!headers.h"
#include "strict_types.h"
#include "errors.h"
#include "autosize_array/Autoarr.h"
void nsleep(long miliseconds) {
struct timespec ts = {10, miliseconds * 1000000L};
nanosleep(&ts, NULL);
}
int8 main(){
#include "nsleep.h"
#include "slimak.h"
#define clrscr() printf("\e[1;1H\e[2J")
int main(){
printf("\e[32mdtsod parser in c language!\n");
dsleep(0.5);
//Autoarr* ar=Autoarr_create(100,10,Int8);
//Autoarr_add_int8(&ar,-1);
//printf("ar[0]==%d",Autoarr_get_int8(&ar,0));
//free(ar);
//setlocale(LC_ALL, "en-US.Unicode");
/*struct stat st;
FILE* f1 = fopen("1.gui","r");
FILE* f2 = fopen("2.gui","r");
fstat(fileno(f1), &st);
size_t size = st.st_size;
char page1[size];
fread(page1, 8, size, f1);
char page2[size];
fread(page2, 8, size, f2);
printf("\e[31m\n");
for (int64 i = 0; i<100000; i++){
nsleep(10000L);
if(i%2==0) printf("%s", page1);
else printf("%s", page2);
}*/
printf("\e[32m\n");
//getc(stdin);
setlocale(LC_ALL, "en-US.Unicode");
uint8 n = 0;
clrscr();
for (uint16 i = 0; i<40; i++){
nsleep(0,70);
printf("\e[1;1H%.*ls", 105,slimak+n*105);
if (n>=10) n=0;
else n++;
}
for (uint16 i = 0; i<120; i++){
nsleep(0,20);
printf("\e[1;1H%.*ls", 105,slimak+n*105);
if (n>=10) n=0;
else n++;
}
clrscr();
printf("\e[32m\npress any key to exit...\n");
getc(stdin);
return 0;
}
+2 -7
View File
@@ -1,10 +1,5 @@
#ifndef STDLIB
#include "../cosmopolitan/cosmopolitan.h"
#else
#include <stdio.h>
#include <stdlib.h>
#endif
#include "err_t.h"
#include "!headers.h"
#include "errors.h"
void throwstr(const char* errmesg){
printf("\e[31mthrowed error: %s\e[0m\n",errmesg);