all printf calls replaced with kprintf
This commit is contained in:
@@ -9,6 +9,7 @@ extern "C" {
|
||||
#include "cptr.h"
|
||||
#include "optime.h"
|
||||
#include "type_system/type_system.h"
|
||||
#include "../kprint/kprintf.h"
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "std.h"
|
||||
#include "errors.h"
|
||||
#include "cptr.h"
|
||||
#include "../kprint/kprintf.h"
|
||||
|
||||
char* errname(ErrorId err){
|
||||
switch(err){
|
||||
@@ -47,7 +48,7 @@ void Maybe_free(Maybe e){
|
||||
}
|
||||
|
||||
void printMaybe(Maybe e){
|
||||
if(e.errmsg) printf("%s\n",e.errmsg);
|
||||
if(e.errmsg) kprintf("%s\n",e.errmsg);
|
||||
else printuni(e.value);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ void printMaybe(Maybe e);
|
||||
|
||||
#define __RETURN_EXCEPTION(ERRMSG) return (Maybe){.errmsg=ERRMSG, .value=UniNull}
|
||||
|
||||
#define __EXIT(ERRMSG) ({ printf("\e[91m%s\e[0m \n", ERRMSG); free(ERRMSG); exit(128); })
|
||||
#define __EXIT(ERRMSG) ({ kprintf("\e[91m%s\e[0m \n", ERRMSG); free(ERRMSG); exit(128); })
|
||||
|
||||
char* __doNothing(char* a);
|
||||
char* __unknownErr( );
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
(codeblock);\
|
||||
clock_gettime(CLOCK_REALTIME, &stop);\
|
||||
double t=(double)(stop.tv_sec-start.tv_sec+(double)(stop.tv_nsec-start.tv_nsec)/1000000000)/repeats;\
|
||||
printf("\e[93moperation \e[94m%s\e[93m lasted \e[94m%lf \e[93mseconds\n",opname,t);\
|
||||
kprintf("\e[93moperation \e[94m%s\e[93m lasted \e[94m%lf \e[93mseconds\n",opname,t);\
|
||||
})
|
||||
#else // standard low precision clock
|
||||
#define optime(opname,repeats,codeblock) ({\
|
||||
@@ -20,6 +20,6 @@
|
||||
(codeblock);\
|
||||
clock_t stop=clock();\
|
||||
double t=(double)(stop-start)/CLOCKS_PER_SEC/repeats;\
|
||||
printf("\e[93moperation \e[94m%s\e[93m lasted \e[94m%lf \e[93mseconds\n",opname,t);\
|
||||
kprintf("\e[93moperation \e[94m%s\e[93m lasted \e[94m%lf \e[93mseconds\n",opname,t);\
|
||||
})
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@ typedef uint64_t uint64;
|
||||
typedef float float32;
|
||||
typedef double float64;
|
||||
|
||||
#define dbg(N) printf("\e[95m%d\n",N)
|
||||
#define dbg(N) kprintf("\e[95m%d\n",N)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "mincore_downlevel.lib") // Support OS older than SDK
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "base_toString.h"
|
||||
#include "../cptr.h"
|
||||
#include "../base.h"
|
||||
#include "../../kprint/kprint_format.h"
|
||||
|
||||
char* __toString_char(void* c, uint32 fmt) {
|
||||
@@ -133,7 +133,7 @@ char* toString_hex(void* _bytes, uint32 size, bool withPrefix, bool uppercase){
|
||||
case kprint_fmtHex:\
|
||||
return toString_hex(_n, BITS/8, kprint_format_withPrefix(f), kprint_format_uppercase(f));\
|
||||
default:\
|
||||
printf("\n%u\n", kprint_format_dataFormat(f));\
|
||||
kprintf("\n%u\n", kprint_format_dataFormat(f));\
|
||||
throw(ERR_FORMAT);\
|
||||
return NULL;\
|
||||
}\
|
||||
@@ -153,7 +153,7 @@ __toString_int_def(64)
|
||||
case kprint_fmtHex:\
|
||||
return toString_hex(_n, BITS/8, kprint_format_withPrefix(f), kprint_format_uppercase(f));\
|
||||
default:\
|
||||
printf("\n%u\n", kprint_format_dataFormat(f));\
|
||||
kprintf("\n%u\n", kprint_format_dataFormat(f));\
|
||||
throw(ERR_FORMAT);\
|
||||
return NULL;\
|
||||
}\
|
||||
@@ -173,7 +173,7 @@ __toString_uint_def(64)
|
||||
case kprint_fmtHex:\
|
||||
return toString_hex(_n, BITS/8, kprint_format_withPrefix(f), kprint_format_uppercase(f));\
|
||||
default:\
|
||||
printf("\n%u\n", kprint_format_dataFormat(f));\
|
||||
kprintf("\n%u\n", kprint_format_dataFormat(f));\
|
||||
throw(ERR_FORMAT);\
|
||||
return NULL;\
|
||||
}\
|
||||
|
||||
@@ -28,8 +28,8 @@ char* __toString_float32(void* n, uint32 fmt);
|
||||
char* __toString_float64(void* n, uint32 fmt);
|
||||
|
||||
// universal functions
|
||||
char* toString_bin(char* bytes, uint32 size, bool withPrefix);
|
||||
char* toString_hex(char* bytes, uint32 size, bool withPrefix, bool uppercase);
|
||||
char* toString_bin(void* bytes, uint32 size, bool withPrefix);
|
||||
char* toString_hex(void* bytes, uint32 size, bool withPrefix, bool uppercase);
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ typedef enum{
|
||||
ktDescriptorsState initState=NotInitialized;
|
||||
|
||||
void ktDescriptors_beginInit(){
|
||||
printf("\e[94mtype descriptors initializing...\n");
|
||||
kprintf("\e[94mtype descriptors initializing...\n");
|
||||
__ktDescriptors=Autoarr_create(ktDescriptor, 256, 256);
|
||||
if(__ktDescriptors==NULL) throw(ERR_NULLPTR);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ void ktDescriptors_endInit(){
|
||||
typeDescriptors=Autoarr_toArray(__ktDescriptors);
|
||||
Autoarr_free(__ktDescriptors,true);
|
||||
if(typeDescriptors==NULL) throw(ERR_NULLPTR);
|
||||
printf("\e[92minitialized %u type descriptors\n", ktId_last);
|
||||
kprintf("\e[92minitialized %u type descriptors\n", ktId_last);
|
||||
}
|
||||
|
||||
void __kt_register(char* name, int16 size, void (*freeMembers)(void*), char* (*toString)(void*, uint32)){
|
||||
@@ -71,7 +71,7 @@ void __kt_register(char* name, int16 size, void (*freeMembers)(void*), char* (*t
|
||||
|
||||
ktDescriptor ktDescriptor_get(ktId id){
|
||||
if(id>ktId_last) {
|
||||
printf("\ntype id: %u\n",id);
|
||||
kprintf("\ntype id: %u\n",id);
|
||||
throw("invalid type id");
|
||||
}
|
||||
return typeDescriptors[id];
|
||||
|
||||
Reference in New Issue
Block a user