homework/cpp/_rvmain.cpp

64 lines
851 B
C++

#include <stdint.h>
int strlen(char *s) {
char *p = s;
while (*p != '\0')
p++;
return p - s;
}
void strcpy(char *s, char *t)
{
while (*s++ = *t++);
}
#define ALLOCSIZE 10000
static char allocbuf[ALLOCSIZE];
static char *allocp = allocbuf;
char *alloc(int n)
{
if (n % 4 != 0) {
n += 4 - (n % 4);
}
if (allocbuf + ALLOCSIZE - allocp >= n) {
allocp += n;
return allocp - n;
} else
return 0;
}
// def. model danych
//pre processor
#define LEN (8+2)*10
struct model {
char * str;
uint32_t len ;
};
//func alg
//in: ptr to date
//return: count of words
int alg (const char * ptr) {
return 1;
}
int main() {
char *str = "If wantered relation no surprise of all";
struct model * ptr = (struct model *) alloc (LEN);
return 1;
}