MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fx_putc

Function fx_putc

xs/platforms/esp/xsPlatform.c:130–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130void fx_putc(void *refcon, char c)
131{
132#ifdef mxDebug
133 txMachine* the = refcon;
134
135 if (the->inPrintf) {
136 if (0 == c) {
137 if (kSerialConnection == the->connection) {
138 // write xsbug log trailer
139 txU1 stop, state;
140 const static const char *xsbugTrailer = "&#10;</log></xsbug>\r\n";
141 const char *cp = xsbugTrailer;
142 while (true) {
143 char c = c_read8(cp++);
144 if (!c) break;
145 ESP_putc(c);
146 }
147 mxDebugMutexGive();
148 }
149 the->inPrintf = false;
150 return;
151 }
152 }
153 else {
154 if (0 == c)
155 return;
156
157 the->inPrintf = true;
158 if (kSerialConnection == the->connection) {
159 mxDebugMutexTake();
160
161 // write xsbug log header
162 static const char *xsbugHeader = "<xsbug><log>";
163 const char *cp = xsbugHeader;
164 fx_putpi(the, '.', true);
165 while (true) {
166 char c = c_read8(cp++);
167 if (!c) break;
168 ESP_putc(c);
169 }
170 }
171 }
172#endif
173
174 ESP_putc(c);
175}
176
177void fx_putpi(txMachine *the, char separator, txBoolean trailingcrlf)
178{

Callers

nothing calls this directly

Calls 1

fx_putpiFunction · 0.70

Tested by

no test coverage detected