CompilerSysY/tools/sylib/sylib.h
2023-05-08 22:58:12 +08:00

27 lines
670 B
C

#ifndef __SYLIB_H_
#define __SYLIB_H_
#include<stdio.h>
#include<stdarg.h>
#include<sys/time.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Input & output functions */
int getint(),getch(),getarray(int a[]);
void putint(int a),putch(int a),putarray(int n,int a[]);
// #define putf(fmt, ...) printf(fmt, __VA_ARGS__) // TODO?
/* Timing function implementation */
#define starttime() _sysy_starttime(__LINE__)
#define stoptime() _sysy_stoptime(__LINE__)
#define _SYSY_N 1024
__attribute((constructor)) void before_main();
__attribute((destructor)) void after_main();
void _sysy_starttime(int lineno);
void _sysy_stoptime(int lineno);
#ifdef __cplusplus
}
#endif
#endif