1 // -*- Mode : c++ -*-
2 //
3 // SUMMARY :
4 // USAGE :
5 // ORG :
6 // AUTHOR : Frederic Hecht
7 // E-MAIL : hecht@ann.jussieu.fr
8 //
9
10 /*
11
12 This file is part of Freefem++
13
14 Freefem++ is free software; you can redistribute it and/or modify
15 it under the terms of the GNU Lesser General Public License as published by
16 the Free Software Foundation; either version 2.1 of the License, or
17 (at your option) any later version.
18
19 Freefem++ is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU Lesser General Public License for more details.
23
24 You should have received a copy of the GNU Lesser General Public License
25 along with Freefem++; if not, write to the Free Software
26 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 */
28
29 #include <iostream>
30 #include <cstdio>
31
32 namespace ffapi {
33
34 // void init) ();
35 // need #include <iostream>
36 // need #include <sstream>
37 // need using namespace std;
38 std::istream * (*cin)();
39 std::ostream *(*cout)();
40 std::ostream *(*cerr)();
41
42 // <<mingw32_stdout>> Cannot name these functions identically to the original file pointers under MingW32 (compile
43 // error). Impacts [[file:InitFunct.hpp::LOADINITIO]]. Changed from stdxxx_ptr() to ffstdxxx() according to the way FF
44 // itself was changed.
45
46 FILE *(*ffstdout)();
47 FILE *(*ffstderr)();
48 FILE *(*ffstdin)();
49
50 /// Initiate graphical pipe output. I need a separate function for this to warn ffcs to check the corresponding ffglut
51 /// magic number
52
53 size_t (*fwriteinit)(const void *ptr, size_t size, size_t nmemb,FILE *stream);
54
55 /// Indicates the begining of a new plot to avoid sending socket control data with each plot item.
56
57 void (*newplot)();
58
59 /// Redefinition of standard system calls
60
61 FILE *(*ff_popen)(const char *command, const char *type);
62 int (*ff_pclose)(FILE *stream);
63 size_t (*ff_fwrite)(const void *ptr, size_t size, size_t nmemb,FILE *stream);
64 int (*ff_fflush)(FILE *stream);
65 int (*ff_ferror)(FILE *stream);
66 int (*ff_feof)(FILE *stream);
67
68 // Windows file mode
69 // -----------------
70
71 /// Changing file mode needs to be disabled when the file is a TCP socket to FFCS. Since the treatment is different in
72 /// FF and in FFLANG executables, they have to be stored in a DLL that changes between these two programs.
73
74 void (*wintextmode)(FILE *f);
75 void (*winbinmode)(FILE *f);
76
77 // Transfer basic MPI control
78 // --------------------------
79
80 void (*mpi_init)(int &argc, char **& argv);
81 void (*mpi_finalize)();
82
83 // Permanent server control
84 // ------------------------
85
86 /// if true, FF is considered to be accessible from remote anonymous connections and some commands (like shell
87 /// commands) are not allowed.
88
89 bool (*protectedservermode)();
90
91 }
92
93 // TODO: remove this block as soon as autoconf is removed from FreeFem++
94 #ifndef CMAKE
95 #include <config.h>
96 #endif
97
98 #include <cstdio>
99 #include <complex>
100 #include <queue>
101 #include <error.hpp>
102 #include "environment.hpp"
103
104 #define FF_GRAPH_PTR_DCL
105 #include "rgraph.hpp"
106
ShowDebugStack()107 void ShowDebugStack(){}
108
109 long verbosity = 1;
110 long searchMethod=0; // = 9999; //pichon //PROBABLY BUG : can't compile without it
111 bool lockOrientation=true;
112 FILE *ThePlotStream=0; // Add for new plot. FH oct 2008
113
114
115 int TheCurrentLine=-1; // unset: by default
116 long mpisize=0,mpirank=0;
117
118 bool showCPU= false;
119 long npichon2d=0, npichon3d=0;
120 long npichon2d1=0, npichon3d1=0;
121
122 // add F. Hecht
123 EnvironmentData ffenvironment;
124 // April 2019
125 using std::ostream;
126 #include <RefCounter.hpp>
127 RefCounter *RefCounter::tnull=0;
128