Skip to content

set of windows (mingw64) build fixes #3090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 0 additions & 61 deletions libs/libvtrutil/src/vtr_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,67 +375,6 @@ char* fgets(char* buf, int max_size, FILE* fp) {
return nullptr;
}

/**
* @brief to get an arbitrary long input line and cut off any
* comment part
*
* the getline function is exaly like the __get_delim function
* in GNU with '\n' delimiter. As a result, to make the function
* behaviour identical for Windows (\r\n) and Linux (\n) compiler
* macros for checking operating systems have been used.
*
* @note user need to take care of the given pointer,
* which will be dynamically allocated by getdelim
*/
char* getline(char*& _lineptr, FILE* _stream) {
int i;
int ch;
size_t _n = 0;
ssize_t nread;

#if defined(__unix__)
nread = getdelim(&_lineptr, &_n, '\n', _stream);
#elif defined(_WIN32)
#define __WIN_NLTK "\r\n"
nread = getdelim(&_lineptr, &_n, __WIN_NLTK, _stream);
#endif

if (nread == -1) {
int errsv = errno;
std::string error_msg;

if (errsv == EINVAL)
error_msg = string_fmt("[%s] Bad arguments (_lineptr is NULL, or _stream is not valid).", strerror(errsv));
else if (errsv == ENOMEM)
error_msg = string_fmt("[%s] Allocation or reallocation of the line buffer failed.", strerror(errsv));
else
/* end of file so it will return null */
return nullptr;

/* getline was unsuccessful, so error */
throw VtrError(string_fmt("Error -- %s\n",
error_msg.c_str()),
__FILE__, __LINE__);
return nullptr;
}

cont = 0; /* line continued? */
file_line_number++; /* global variable */

for (i = 0; i < nread; i++) { /* Keep going until the line finishes */

ch = _lineptr[i];

if (ch == '#') { /* comment */
_lineptr[i] = '\0';
/* skip the rest of the line */
break;
}
}

return (_lineptr);
}

///@brief Returns line number of last opened and read file
int get_file_line_number_of_last_opened_file() {
return file_line_number;
Expand Down
7 changes: 4 additions & 3 deletions vpr/src/draw/draw_basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#ifndef NO_GRAPHICS

#include <cstdio>
#include <numbers>
#include <cmath>
#include <algorithm>
#include <sstream>
Expand Down Expand Up @@ -1236,7 +1237,7 @@ void draw_flyline_timing_edge(ezgl::point2d start, ezgl::point2d end, float incr
std::string incr_delay_str = ss.str();

// Get the angle of line, to rotate the text
float text_angle = (180 / M_PI)
float text_angle = (180 / std::numbers::pi)
* atan((end.y - start.y) / (end.x - start.x));

// Get the screen coordinates for text drawing
Expand All @@ -1251,9 +1252,9 @@ void draw_flyline_timing_edge(ezgl::point2d start, ezgl::point2d end, float incr

// Find an offset so it is sitting on top/below of the line
float x_offset = screen_coords.center().x
- 8 * sin(text_angle * (M_PI / 180));
- 8 * sin(text_angle * (std::numbers::pi / 180));
float y_offset = screen_coords.center().y
- 8 * cos(text_angle * (M_PI / 180));
- 8 * cos(text_angle * (std::numbers::pi / 180));

ezgl::point2d offset_text_bbox(x_offset, y_offset);
g->draw_text(offset_text_bbox, incr_delay_str.c_str(),
Expand Down