1 /*****************************************************************************
2 FILE : $Source: /projects/higgs1/SNNS/CVS/SNNS/xgui/sources/ui_textP.c,v $
3 SHORTNAME : textP.c
4 SNNS VERSION : 4.2
5
6 PURPOSE :
7 NOTES :
8
9 AUTHOR : Tilman Sommer
10 DATE : 1.2.1990
11
12 CHANGED BY :
13 RCS VERSION : $Revision: 2.7 $
14 LAST CHANGE : $Date: 1998/03/03 14:10:46 $
15
16 Copyright (c) 1990-1995 SNNS Group, IPVR, Univ. Stuttgart, FRG
17 Copyright (c) 1996-1998 SNNS Group, WSI, Univ. Tuebingen, FRG
18
19 ******************************************************************************/
20 #include <config.h>
21
22 #include <stdio.h>
23 #include <string.h>
24
25 #include "ui.h"
26 #include "ui_confirmer.h"
27
28 #include "ui_fileP.h"
29 #include "ui_textP.ph"
30
31
32 /*****************************************************************************
33 FUNCTION : ui_tw_errorMessage()
34
35 PURPOSE : prints error messages into a confirmer
36 RETURNS : void
37 NOTES :
38
39 UPDATE : 10.12.1991
40 ******************************************************************************/
41
ui_tw_errorMessage(char * message)42 void ui_tw_errorMessage(char *message)
43
44 {
45 char error[512];
46 char *cptr, *temp;
47 int max_len = 40;
48 int best_len, str_len, i;
49
50 strcpy (error, message);
51 str_len = strlen(error);
52 if (str_len == 0)
53 return;
54 best_len = str_len DIV (((str_len - 1) DIV max_len) + 1);
55 cptr = error;
56 i = 0;
57 while (*cptr != '\0') {
58 cptr++;
59 i++;
60 if (i == best_len) {
61 temp = cptr;
62 while (*temp != ' ')
63 temp--;
64 *temp = '\n';
65 i = (int) (cptr - temp);
66 }
67 }
68 ui_confirmOk (error);
69 if (ui_textFilePtr != NULL) {
70 fprintf(ui_textFilePtr, "%s\n", message);
71 fflush(ui_textFilePtr);
72 }
73 }
74
75
76 /*****************************************************************************
77 FUNCTION : ui_tw_printMessage()
78
79 PURPOSE :
80 RETURNS :
81 NOTES :
82
83 UPDATE : 1.2.1990
84 ******************************************************************************/
85
ui_tw_printMessage(char * message)86 void ui_tw_printMessage(char *message)
87
88 {
89 printf(message);
90 if (ui_textFilePtr != NULL) {
91 fprintf(ui_textFilePtr, message);
92 fflush(ui_textFilePtr);
93 }
94 }
95
96
97
98
99
100
101
102
103
104 /* end of file */
105 /* lines: 103 */
106