Kind of works

This commit is contained in:
2024-06-18 19:04:23 +05:00
parent 0d102315c8
commit 4c92b22e6d
10 changed files with 132 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
#include <stdlib.h>
#include <stdio.h>
void labashka(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void), size_t max_size ) {
FILE *file = NULL;
file = (void*)((size_t)(pop()) << (16*0) | (size_t)file);
file = (void*)((size_t)(pop()) << (16*1) | (size_t)file);
file = (void*)((size_t)(pop()) << (16*2) | (size_t)file);
file = (void*)((size_t)(pop()) << (16*3) | (size_t)file);
push(fclose(file));
}
+11
View File
@@ -0,0 +1,11 @@
#include <stdlib.h>
#include <stdio.h>
void labashka(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void), size_t max_size ) {
FILE *file = NULL;
file = (void*)((size_t)(pop()) << (16*0) | (size_t)file);
file = (void*)((size_t)(pop()) << (16*1) | (size_t)file);
file = (void*)((size_t)(pop()) << (16*2) | (size_t)file);
file = (void*)((size_t)(pop()) << (16*3) | (size_t)file);
push(feof(file));
}
+11
View File
@@ -0,0 +1,11 @@
#include <stdlib.h>
#include <stdio.h>
void labashka(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void), size_t max_size ) {
FILE *file = NULL;
file = (void*)((size_t)(pop()) << (16*0) | (size_t)file);
file = (void*)((size_t)(pop()) << (16*1) | (size_t)file);
file = (void*)((size_t)(pop()) << (16*2) | (size_t)file);
file = (void*)((size_t)(pop()) << (16*3) | (size_t)file);
push(fgetc(file));
}
+20
View File
@@ -0,0 +1,20 @@
#include <stdlib.h>
#include <stdio.h>
void labashka(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void), size_t max_size ) {
unsigned short modelen = pop();
char *mode = calloc(modelen, sizeof(char));
for (short i = modelen - 1; i != -1; i--)
mode[i] = pop();
unsigned short filenamelen = pop();
char *filename = calloc(filenamelen, sizeof(char));
for (short i = filenamelen - 1; i != -1; i--)
filename[i] = pop();
FILE *file = fopen(filename, mode);
push((short)((0xFFFF000000000000 & (long)file) >> (16*3) ));
push((short)((0x0000FFFF00000000 & (long)file) >> (16*2) ));
push((short)((0x00000000FFFF0000 & (long)file) >> (16*1) ));
push((short)((0x000000000000FFFF & (long)file) >> (16*0) ));
}