allow file extension spec in tmpfile creation, update index.html

This commit is contained in:
stefan schippers 2024-11-13 12:04:56 +01:00
parent 658dd6160b
commit de9c40af65
5 changed files with 17 additions and 7 deletions

View File

@ -137,6 +137,7 @@
<td>3.1.0 release, ability to display simulation graphs and embeded images/logos<br> <td>3.1.0 release, ability to display simulation graphs and embeded images/logos<br>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>20230521<br> <td>20230521<br>
</td> </td>
@ -147,6 +148,15 @@
</td> </td>
</tr> </tr>
<tr>
<td>20241113<br>
</td>
<td>3.4.6<br>
</td>
<td>3.4.6 release.
</td>
</tr>
<tr> <tr>
<td><br> <td><br>

View File

@ -2254,13 +2254,13 @@ void print_hilight_net(int show)
prepare_netlist_structs(1); /* use full prepare_netlist_structs(1) to recognize pin direction */ prepare_netlist_structs(1); /* use full prepare_netlist_structs(1) to recognize pin direction */
/* when creating pins from hilight nets 20171221 */ /* when creating pins from hilight nets 20171221 */
if(!(fd = open_tmpfile("hilight2_", &filename_ptr)) ) { if(!(fd = open_tmpfile("hilight2_", "", &filename_ptr)) ) {
fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr); fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr);
return; return;
} }
my_strdup(_ALLOC_ID_, &filetmp2, filename_ptr); my_strdup(_ALLOC_ID_, &filetmp2, filename_ptr);
fclose(fd); fclose(fd);
if(!(fd = open_tmpfile("hilight1_", &filename_ptr))) { if(!(fd = open_tmpfile("hilight1_", "", &filename_ptr))) {
fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr); fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr);
my_free(_ALLOC_ID_, &filetmp2); my_free(_ALLOC_ID_, &filetmp2);
return; return;

View File

@ -1093,7 +1093,7 @@ void create_ps(char **psfile, int what, int fullzoom, int eps)
} }
if(what & 1) { /* prolog */ if(what & 1) { /* prolog */
numpages = 0; numpages = 0;
if(!(fd = open_tmpfile("psplot_", psfile)) ) { if(!(fd = open_tmpfile("psplot_", ".ps", psfile)) ) {
fprintf(errfp, "ps_draw(): can not create tmpfile %s\n", *psfile); fprintf(errfp, "ps_draw(): can not create tmpfile %s\n", *psfile);
return; return;
} }

View File

@ -943,7 +943,7 @@ int raw_read_from_attr(Raw **rawptr, const char *type, double sweep1, double swe
size_t length; size_t length;
if(i->prop_ptr && (b64_spice_data = get_tok_value(i->prop_ptr, "spice_data", 0))[0]) { if(i->prop_ptr && (b64_spice_data = get_tok_value(i->prop_ptr, "spice_data", 0))[0]) {
length = strlen(b64_spice_data); length = strlen(b64_spice_data);
if( (fd = open_tmpfile("embedded_rawfile_", &tmp_filename)) ) { if( (fd = open_tmpfile("embedded_rawfile_", ".raw", &tmp_filename)) ) {
s = base64_decode(b64_spice_data, length, &decoded_length); s = base64_decode(b64_spice_data, length, &decoded_length);
fwrite(s, decoded_length, 1, fd); fwrite(s, decoded_length, 1, fd);
fclose(fd); fclose(fd);
@ -2301,14 +2301,14 @@ const char *create_tmpdir(char *prefix)
/* after 5 unsuccessfull attemps give up */ /* after 5 unsuccessfull attemps give up */
/* and return NULL */ /* and return NULL */
/* */ /* */
FILE *open_tmpfile(char *prefix, char **filename) FILE *open_tmpfile(char *prefix, char *suffix, char **filename)
{ {
static char str[PATH_MAX]; /* safe even with multiple schematics, if immediately copied */ static char str[PATH_MAX]; /* safe even with multiple schematics, if immediately copied */
int i; int i;
FILE *fd; FILE *fd;
struct stat buf; struct stat buf;
for(i=0; i<5; ++i) { for(i=0; i<5; ++i) {
my_snprintf(str, S(str), "%s%s", tclgetvar("XSCHEM_TMP_DIR"), random_string(prefix)); my_snprintf(str, S(str), "%s%s%s", tclgetvar("XSCHEM_TMP_DIR"), random_string(prefix), suffix);
*filename = str; *filename = str;
if(stat(str, &buf) && (fd = fopen(str, "w")) ) { /* file must not exist */ if(stat(str, &buf) && (fd = fopen(str, "w")) ) { /* file must not exist */
dbg(1, "open_tmpfile(): created file: %s\n", str); dbg(1, "open_tmpfile(): created file: %s\n", str);

View File

@ -1741,7 +1741,7 @@ extern int pending_events(void);
#endif #endif
extern void get_square(double x, double y, int *xx, int *yy); extern void get_square(double x, double y, int *xx, int *yy);
extern const char *create_tmpdir(char *prefix); extern const char *create_tmpdir(char *prefix);
extern FILE *open_tmpfile(char *prefix, char **filename); extern FILE *open_tmpfile(char *prefix, char *suffix, char **filename);
extern void create_ps(char** psfile, int what, int fullzoom, int eps); extern void create_ps(char** psfile, int what, int fullzoom, int eps);
extern void MyXCopyArea(Display* display, Drawable src, Drawable dest, GC gc, int src_x, int src_y, unsigned int width, unsigned int height, int dest_x, int dest_y); extern void MyXCopyArea(Display* display, Drawable src, Drawable dest, GC gc, int src_x, int src_y, unsigned int width, unsigned int height, int dest_x, int dest_y);
#endif /*CADGLOBALS */ #endif /*CADGLOBALS */