Renamed print functions

This commit is contained in:
Alex 2023-01-07 20:13:46 +02:00
parent 9a59137064
commit 7fd6532345
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
8 changed files with 45 additions and 45 deletions

View File

@ -30,7 +30,7 @@ namespace Disk
for (unsigned char ItrPort = 0; ItrPort < this->AvailablePorts; ItrPort++) for (unsigned char ItrPort = 0; ItrPort < this->AvailablePorts; ItrPort++)
{ {
Drive *drive = new Drive; Drive *drive = new Drive;
sprintf_(drive->Name, "sd%ld-%d", DriverUID, this->AvailablePorts); sprintf(drive->Name, "sd%ld-%d", DriverUID, this->AvailablePorts);
debug("Drive Name: %s", drive->Name); debug("Drive Name: %s", drive->Name);
// TODO: Implement disk type detection. Very useful in the future. // TODO: Implement disk type detection. Very useful in the future.
drive->MechanicalDisk = true; drive->MechanicalDisk = true;
@ -98,7 +98,7 @@ namespace Disk
drive->Partitions.push_back(partition); drive->Partitions.push_back(partition);
char *PartitionName = new char[64]; char *PartitionName = new char[64];
sprintf_(PartitionName, "sd%ldp%ld", drives.size() - 1, partition->Index); sprintf(PartitionName, "sd%ldp%ld", drives.size() - 1, partition->Index);
/* /*
----> Add to devfs the disk ----> Add to devfs the disk
@ -128,7 +128,7 @@ namespace Disk
drive->Partitions.push_back(partition); drive->Partitions.push_back(partition);
char *PartitionName = new char[64]; char *PartitionName = new char[64];
sprintf_(PartitionName, "sd%ldp%ld", drives.size() - 1, partition->Index); sprintf(PartitionName, "sd%ldp%ld", drives.size() - 1, partition->Index);
/* /*
----> Add to devfs the disk ----> Add to devfs the disk

View File

@ -57,7 +57,7 @@ namespace GraphicalUserInterface
if (!this->Maximized) if (!this->Maximized)
{ {
char buf[256]; char buf[256];
sprintf_(buf, "Left:\eAA11FF%ld\eFFFFFF Top:\eAA11FF%ld\eFFFFFF W:\eAA11FF%ld\eFFFFFF H:\eAA11FF%ld\eFFFFFF", this->Position.Left, this->Position.Top, this->Position.Width, this->Position.Height); sprintf(buf, "Left:\eAA11FF%ld\eFFFFFF Top:\eAA11FF%ld\eFFFFFF W:\eAA11FF%ld\eFFFFFF H:\eAA11FF%ld\eFFFFFF", this->Position.Left, this->Position.Top, this->Position.Width, this->Position.Height);
// Display->DrawString(buf, this->Position.Left + 20, this->Position.Top + 25, 200); // Display->DrawString(buf, this->Position.Left + 20, this->Position.Top + 25, 200);
} }

View File

@ -11,7 +11,7 @@ EXTERNC void fprintf(FILE *stream, const char *Format, ...)
{ {
va_list args; va_list args;
va_start(args, Format); va_start(args, Format);
vprintf_(Format, args); vprintf(Format, args);
va_end(args); va_end(args);
UNUSED(stream); UNUSED(stream);
} }
@ -19,7 +19,7 @@ EXTERNC void fprintf(FILE *stream, const char *Format, ...)
// TODO: Implement proper fputs // TODO: Implement proper fputs
EXTERNC void fputs(const char *s, FILE *stream) EXTERNC void fputs(const char *s, FILE *stream)
{ {
printf_("%s", s); printf("%s", s);
UNUSED(stream); UNUSED(stream);
} }

View File

@ -108,10 +108,10 @@ EXTERNC void KPrint(const char *Format, ...)
{ {
SmartLock(KernelLock); SmartLock(KernelLock);
Time::Clock tm = Time::ReadClock(); Time::Clock tm = Time::ReadClock();
printf_("\eCCCCCC[\e00AEFF%02ld:%02ld:%02ld\eCCCCCC] ", tm.Hour, tm.Minute, tm.Second); printf("\eCCCCCC[\e00AEFF%02ld:%02ld:%02ld\eCCCCCC] ", tm.Hour, tm.Minute, tm.Second);
va_list args; va_list args;
va_start(args, Format); va_start(args, Format);
vprintf_(Format, args); vprintf(Format, args);
va_end(args); va_end(args);
putchar('\n'); putchar('\n');
Display->SetBuffer(0); Display->SetBuffer(0);
@ -124,7 +124,7 @@ EXTERNC __no_instrument_function void Main(BootInfo *Info)
memcpy(bInfo, Info, sizeof(BootInfo)); memcpy(bInfo, Info, sizeof(BootInfo));
debug("BootInfo structure is at %p", bInfo); debug("BootInfo structure is at %p", bInfo);
Display = new Video::Display(bInfo->Framebuffer[0]); Display = new Video::Display(bInfo->Framebuffer[0]);
printf_("\eFFFFFF%s - %s [\e058C19%s\eFFFFFF]\n", KERNEL_NAME, KERNEL_VERSION, GIT_COMMIT_SHORT); printf("\eFFFFFF%s - %s [\e058C19%s\eFFFFFF]\n", KERNEL_NAME, KERNEL_VERSION, GIT_COMMIT_SHORT);
/**************************************************************************************/ /**************************************************************************************/
KPrint("Time: \e8888FF%02d:%02d:%02d %02d/%02d/%02d UTC", KPrint("Time: \e8888FF%02d:%02d:%02d %02d/%02d/%02d UTC",
BootClock.Hour, BootClock.Minute, BootClock.Second, BootClock.Hour, BootClock.Minute, BootClock.Second,

View File

@ -16,13 +16,13 @@ static inline void print_wrapper(char c, void *unused)
UNUSED(unused); UNUSED(unused);
} }
int vprintf(const char *format, va_list list) { return vfctprintf(print_wrapper, NULL, format, list); } int vprintf_dumper(const char *format, va_list list) { return vfctprintf(print_wrapper, NULL, format, list); }
void WriteRaw(const char *format, ...) void WriteRaw(const char *format, ...)
{ {
va_list args; va_list args;
va_start(args, format); va_start(args, format);
vprintf(format, args); vprintf_dumper(format, args);
va_end(args); va_end(args);
} }

View File

@ -54,12 +54,12 @@
#endif // __cplusplus #endif // __cplusplus
#if PRINTF_ALIAS_STANDARD_FUNCTION_NAMES #if PRINTF_ALIAS_STANDARD_FUNCTION_NAMES
#define printf_ printf #define printf printf
#define sprintf_ sprintf #define sprintf sprintf
#define vsprintf_ vsprintf #define vsprintf vsprintf
#define snprintf_ snprintf #define snprintf_ snprintf
#define vsnprintf_ vsnprintf #define vsnprintf vsnprintf
#define vprintf_ vprintf #define vprintf vprintf
#endif #endif
// 'ntoa' conversion buffer size, this must be big enough to hold one converted // 'ntoa' conversion buffer size, this must be big enough to hold one converted
@ -1528,21 +1528,21 @@ static __no_instrument_function int vsnprintf_impl(output_gadget_t *output, cons
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
__no_instrument_function int vprintf_(const char *format, va_list arg) __no_instrument_function int vprintf(const char *format, va_list arg)
{ {
output_gadget_t gadget = extern_putchar_gadget(); output_gadget_t gadget = extern_putchar_gadget();
return vsnprintf_impl(&gadget, format, arg); return vsnprintf_impl(&gadget, format, arg);
} }
__no_instrument_function int vsnprintf_(char *s, size_t n, const char *format, va_list arg) __no_instrument_function int vsnprintf(char *s, size_t n, const char *format, va_list arg)
{ {
output_gadget_t gadget = buffer_gadget(s, n); output_gadget_t gadget = buffer_gadget(s, n);
return vsnprintf_impl(&gadget, format, arg); return vsnprintf_impl(&gadget, format, arg);
} }
__no_instrument_function int vsprintf_(char *s, const char *format, va_list arg) __no_instrument_function int vsprintf(char *s, const char *format, va_list arg)
{ {
return vsnprintf_(s, PRINTF_MAX_POSSIBLE_BUFFER_SIZE, format, arg); return vsnprintf(s, PRINTF_MAX_POSSIBLE_BUFFER_SIZE, format, arg);
} }
__no_instrument_function int vfctprintf(void (*out)(char c, void *extra_arg), void *extra_arg, const char *format, va_list arg) __no_instrument_function int vfctprintf(void (*out)(char c, void *extra_arg), void *extra_arg, const char *format, va_list arg)
@ -1551,20 +1551,20 @@ __no_instrument_function int vfctprintf(void (*out)(char c, void *extra_arg), vo
return vsnprintf_impl(&gadget, format, arg); return vsnprintf_impl(&gadget, format, arg);
} }
__no_instrument_function int printf_(const char *format, ...) __no_instrument_function int printf(const char *format, ...)
{ {
va_list args; va_list args;
va_start(args, format); va_start(args, format);
const int ret = vprintf_(format, args); const int ret = vprintf(format, args);
va_end(args); va_end(args);
return ret; return ret;
} }
__no_instrument_function int sprintf_(char *s, const char *format, ...) __no_instrument_function int sprintf(char *s, const char *format, ...)
{ {
va_list args; va_list args;
va_start(args, format); va_start(args, format);
const int ret = vsprintf_(s, format, args); const int ret = vsprintf(s, format, args);
va_end(args); va_end(args);
return ret; return ret;
} }
@ -1573,7 +1573,7 @@ __no_instrument_function int snprintf_(char *s, size_t n, const char *format, ..
{ {
va_list args; va_list args;
va_start(args, format); va_start(args, format);
const int ret = vsnprintf_(s, n, format, args); const int ret = vsnprintf(s, n, format, args);
va_end(args); va_end(args);
return ret; return ret;
} }

View File

@ -596,16 +596,16 @@ namespace Tasking
foreach (auto var in ListProcess) foreach (auto var in ListProcess)
{ {
int Status = var->Status; int Status = var->Status;
printf_("\e%s-> \eAABBCC%s\eCCCCCC[%d] \e00AAAA%s\n", printf("\e%s-> \eAABBCC%s\eCCCCCC[%d] \e00AAAA%s\n",
Statuses[Status], var->Name, Status, StatusesSign[Status]); Statuses[Status], var->Name, Status, StatusesSign[Status]);
foreach (auto var2 in var->Threads) foreach (auto var2 in var->Threads)
{ {
Status = var2->Status; Status = var2->Status;
printf_(" \e%s-> \eAABBCC%s\eCCCCCC[%d] \e00AAAA%s\n\eAABBCC", printf(" \e%s-> \eAABBCC%s\eCCCCCC[%d] \e00AAAA%s\n\eAABBCC",
Statuses[Status], var2->Name, Status, StatusesSign[Status]); Statuses[Status], var2->Name, Status, StatusesSign[Status]);
} }
} }
printf_("%d - SOURCE: %s", sanity++, SuccessSourceStrings[SuccessSource]); printf("%d - SOURCE: %s", sanity++, SuccessSourceStrings[SuccessSource]);
if (sanity > 1000) if (sanity > 1000)
sanity = 0; sanity = 0;
Display->SetBufferCursor(0, tmpX, tmpY); Display->SetBufferCursor(0, tmpX, tmpY);
@ -1278,7 +1278,7 @@ namespace Tasking
Vector<AuxiliaryVector> auxv; Vector<AuxiliaryVector> auxv;
IdleThread = CreateThread(IdleProcess, reinterpret_cast<uintptr_t>(IdleProcessLoop), nullptr, nullptr, auxv); IdleThread = CreateThread(IdleProcess, reinterpret_cast<uintptr_t>(IdleProcessLoop), nullptr, nullptr, auxv);
char IdleName[16]; char IdleName[16];
sprintf_(IdleName, "Idle Thread %d", i); sprintf(IdleName, "Idle Thread %d", i);
IdleThread->Rename(IdleName); IdleThread->Rename(IdleName);
IdleThread->SetPriority(1); IdleThread->SetPriority(1);
break; break;

View File

@ -60,12 +60,12 @@ extern "C"
#endif #endif
#if PRINTF_ALIAS_STANDARD_FUNCTION_NAMES #if PRINTF_ALIAS_STANDARD_FUNCTION_NAMES
#define printf_ printf #define printf printf
#define sprintf_ sprintf #define sprintf sprintf
#define vsprintf_ vsprintf #define vsprintf vsprintf
#define snprintf_ snprintf #define snprintf_ snprintf
#define vsnprintf_ vsnprintf #define vsnprintf vsnprintf
#define vprintf_ vprintf #define vprintf vprintf
#endif #endif
// If you want to include this implementation file directly rather than // If you want to include this implementation file directly rather than
@ -112,9 +112,9 @@ extern "C"
*/ */
///@{ ///@{
PRINTF_VISIBILITY PRINTF_VISIBILITY
int printf_(const char *format, ...) ATTR_PRINTF(1, 2); int printf(const char *format, ...) ATTR_PRINTF(1, 2);
PRINTF_VISIBILITY PRINTF_VISIBILITY
int vprintf_(const char *format, va_list arg) ATTR_VPRINTF(1); int vprintf(const char *format, va_list arg) ATTR_VPRINTF(1);
///@} ///@}
/** /**
@ -132,9 +132,9 @@ extern "C"
*/ */
///@{ ///@{
PRINTF_VISIBILITY PRINTF_VISIBILITY
int sprintf_(char *s, const char *format, ...) ATTR_PRINTF(2, 3); int sprintf(char *s, const char *format, ...) ATTR_PRINTF(2, 3);
PRINTF_VISIBILITY PRINTF_VISIBILITY
int vsprintf_(char *s, const char *format, va_list arg) ATTR_VPRINTF(2); int vsprintf(char *s, const char *format, va_list arg) ATTR_VPRINTF(2);
///@} ///@}
/** /**
@ -156,13 +156,13 @@ extern "C"
PRINTF_VISIBILITY PRINTF_VISIBILITY
int snprintf_(char *s, size_t count, const char *format, ...) ATTR_PRINTF(3, 4); int snprintf_(char *s, size_t count, const char *format, ...) ATTR_PRINTF(3, 4);
PRINTF_VISIBILITY PRINTF_VISIBILITY
int vsnprintf_(char *s, size_t count, const char *format, va_list arg) ATTR_VPRINTF(3); int vsnprintf(char *s, size_t count, const char *format, va_list arg) ATTR_VPRINTF(3);
///@} ///@}
/** /**
* printf/vprintf with user-specified output function * printf/vprintf with user-specified output function
* *
* An alternative to @ref printf_, in which the output function is specified dynamically * An alternative to @ref printf, in which the output function is specified dynamically
* (rather than @ref putchar_ being used) * (rather than @ref putchar_ being used)
* *
* @param out An output function which takes one character and a type-erased additional parameters * @param out An output function which takes one character and a type-erased additional parameters
@ -179,12 +179,12 @@ extern "C"
int vfctprintf(void (*out)(char c, void *extra_arg), void *extra_arg, const char *format, va_list arg) ATTR_VPRINTF(3); int vfctprintf(void (*out)(char c, void *extra_arg), void *extra_arg, const char *format, va_list arg) ATTR_VPRINTF(3);
#if PRINTF_ALIAS_STANDARD_FUNCTION_NAMES #if PRINTF_ALIAS_STANDARD_FUNCTION_NAMES
#undef printf_ #undef printf
#undef sprintf_ #undef sprintf
#undef vsprintf_ #undef vsprintf
#undef snprintf_ #undef snprintf_
#undef vsnprintf_ #undef vsnprintf
#undef vprintf_ #undef vprintf
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus