2024-05-22 17:33:42 +00:00
|
|
|
#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;
|
|
|
|
}
|
|
|
|
|
2024-05-22 18:51:39 +00:00
|
|
|
// def. model danych
|
2024-05-22 17:33:42 +00:00
|
|
|
|
2024-05-22 18:51:39 +00:00
|
|
|
//pre processor
|
|
|
|
#define LEN (8+2)*10
|
2024-05-22 17:33:42 +00:00
|
|
|
|
2024-05-22 18:51:39 +00:00
|
|
|
struct model {
|
|
|
|
char * str;
|
|
|
|
uint32_t len ;
|
|
|
|
};
|
2024-05-22 17:33:42 +00:00
|
|
|
|
|
|
|
|
2024-05-22 18:51:39 +00:00
|
|
|
//func alg
|
|
|
|
//in: ptr to date
|
|
|
|
//return: count of words
|
|
|
|
int alg (const char * ptr) {
|
2024-05-22 17:33:42 +00:00
|
|
|
|
|
|
|
|
2024-05-22 18:51:39 +00:00
|
|
|
return 1;
|
2024-05-22 17:33:42 +00:00
|
|
|
}
|
2024-05-22 18:51:39 +00:00
|
|
|
|
|
|
|
|
2024-05-22 17:33:42 +00:00
|
|
|
int main() {
|
|
|
|
|
|
|
|
char *str = "If wantered relation no surprise of all";
|
|
|
|
|
2024-05-22 18:51:39 +00:00
|
|
|
struct model * ptr = (struct model *) alloc (LEN);
|
2024-05-22 17:33:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|