Check-in [8c97c048af]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Do not use array form of printing anymore.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wip-springcoat-bringup
Files: files | file ages | folders
SHA1: 8c97c048af93eed5903e1573b3817fab84dfb045
User & Date: stephanie.gawroriski 2020-05-13 23:48:54
Context
2020-05-14
00:08
Some minor work. check-in: e61c626c99 user: stephanie.gawroriski tags: wip-springcoat-bringup
2020-05-13
23:48
Do not use array form of printing anymore. check-in: 8c97c048af user: stephanie.gawroriski tags: wip-springcoat-bringup
23:41
Some base work on creating class infos. check-in: 1009b5d68e user: stephanie.gawroriski tags: wip-springcoat-bringup
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/cldc-compact/src/main/java/cc/squirreljme/runtime/cldc/debug/Debugging.java.

158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176

177
178
179
180
181
182
183
...
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
...
243
244
245
246
247
248
249

250


251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
...
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
...
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
...
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
		"StaticVariableUsedBeforeInitialization"})
	private static void __format(char __cha, char __chb, String __format,
		Object... __args)
	{
		// Print quickly and stop because this may infinite loop
		if (Debugging._noLoop)
		{
			Debugging.__print('X', null);
			return;
		}
		
		// Print otherwise
		try
		{
			// Do not re-enter this loop
			Debugging._noLoop = true;
			
			// Print header marker
			Debugging.__print(__cha, __chb, ':', ' ');

			
			// The specifier to print along with the field index
			boolean specifier = false,
				hasArgIndex = false,
				firstChar = false;
			int argIndex = 0,
				baseArg = 0,
................................................................................
					else if (!hasArgIndex && c == '$')
						hasArgIndex = true;
					
					// Percent or newline
					else if (c == '%' || c == 'n')
					{
						if (c == '%')
							Debugging.__print('%', null);
						else
							Debugging.__printLine();
						
						// Stop
						specifier = false;
					}
					
................................................................................
						// Select argument to print
						int choice = (hasArgIndex ? argIndex : baseArg++);
						Object value = (choice < 0 || choice >= argCount ?
							null : __args[choice]);
						
						// Print its value
						if (value == null)

							Debugging.__print('n', 'u', 'l', 'l');


						
						// Assume a string
						else
						{
							String string = value.toString();
							
							// Print left padding?
							int strLen = string.length(),
								pad = width - strLen;
							while ((pad--) > 0)
								Debugging.__print(' ', null);
							
							// Print actual string
							for (int j = 0; j < strLen; j++)
								Debugging.__print(string.charAt(j), null);
						}
						
						// Stop
						specifier = false;
					}
					
					// No longer will be the first character
................................................................................
					specifier = true;
					firstChar = true;
					argIndex = 0;
				}
				
				// Plain character?
				else
					Debugging.__print(c, null);
			}
			
			// End of line
			Debugging.__printLine();
		}
		
		// Hopefully this does not happen but just in case, we want to catch
................................................................................
	 * @param __c The character to print.
	 * @since 2020/05/07
	 */
	@SuppressWarnings({"ConfusingArgumentToVarargsMethod",
		"SameParameterValue"})
	private static void __print(char __c)
	{
		Debugging.__print(__c, null);
	}
	
	/**
	 * Prints the given characters.
	 *
	 * @param __c The character to print.
	 * @param __x Extra characters to print.
	 * @since 2020/05/07
	 */
	@SuppressWarnings("FeatureEnvy")
	private static void __print(char __c, char... __x)
	{
		// If we do not know the pipe for standard error, get it
		int pipe = Debugging._pipe;
		if (pipe == Integer.MIN_VALUE)
			Debugging._pipe = (pipe = Assembly.sysCallPV(
				SystemCallIndex.PD_OF_STDERR));
				
		// Print first character, snip to ASCII
		Assembly.sysCallPV(SystemCallIndex.PD_WRITE_BYTE, pipe,
			(__c > Debugging._BYTE_LIMIT ? '?' : __c));
		
		// Print other characters in bulk, snip to ASCII
		if (__x != null)
			for (char c : __x)
				Assembly.sysCallPV(SystemCallIndex.PD_WRITE_BYTE, pipe,
					(c > Debugging._BYTE_LIMIT ? '?' : c));
	}
	
	/**
	 * Prints end of line.
	 *
	 * @since 2020/05/07
	 */
................................................................................
			Debugging._line = (line = Assembly.sysCallV(
				SystemCallIndex.CONFIG_GET_VALUE, ConfigRomKey.LINE_ENDING));
		
		// Print it depending on what is desired
		switch (line)
		{
			case LineEndingType.CR:
				Debugging.__print('\r', null);
				break;
				
			case LineEndingType.LF:
				Debugging.__print('\n', null);
				break;
				
			case LineEndingType.CRLF:
			default:
				Debugging.__print('\r', '\n');
				break;
		}
	}
}







|










|
>







 







|







 







>
|
>
>










|



|







 







|







 







|






|



|












|
<
|
|







 







|



|









158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
...
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
...
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
...
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
...
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351

352
353
354
355
356
357
358
359
360
...
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
		"StaticVariableUsedBeforeInitialization"})
	private static void __format(char __cha, char __chb, String __format,
		Object... __args)
	{
		// Print quickly and stop because this may infinite loop
		if (Debugging._noLoop)
		{
			Debugging.__print('X');
			return;
		}
		
		// Print otherwise
		try
		{
			// Do not re-enter this loop
			Debugging._noLoop = true;
			
			// Print header marker
			Debugging.__print(__cha, __chb);
			Debugging.__print(':', ' ');
			
			// The specifier to print along with the field index
			boolean specifier = false,
				hasArgIndex = false,
				firstChar = false;
			int argIndex = 0,
				baseArg = 0,
................................................................................
					else if (!hasArgIndex && c == '$')
						hasArgIndex = true;
					
					// Percent or newline
					else if (c == '%' || c == 'n')
					{
						if (c == '%')
							Debugging.__print('%');
						else
							Debugging.__printLine();
						
						// Stop
						specifier = false;
					}
					
................................................................................
						// Select argument to print
						int choice = (hasArgIndex ? argIndex : baseArg++);
						Object value = (choice < 0 || choice >= argCount ?
							null : __args[choice]);
						
						// Print its value
						if (value == null)
						{
							Debugging.__print('n', 'u');
							Debugging.__print('l', 'l');
						}
						
						// Assume a string
						else
						{
							String string = value.toString();
							
							// Print left padding?
							int strLen = string.length(),
								pad = width - strLen;
							while ((pad--) > 0)
								Debugging.__print(' ');
							
							// Print actual string
							for (int j = 0; j < strLen; j++)
								Debugging.__print(string.charAt(j));
						}
						
						// Stop
						specifier = false;
					}
					
					// No longer will be the first character
................................................................................
					specifier = true;
					firstChar = true;
					argIndex = 0;
				}
				
				// Plain character?
				else
					Debugging.__print(c);
			}
			
			// End of line
			Debugging.__printLine();
		}
		
		// Hopefully this does not happen but just in case, we want to catch
................................................................................
	 * @param __c The character to print.
	 * @since 2020/05/07
	 */
	@SuppressWarnings({"ConfusingArgumentToVarargsMethod",
		"SameParameterValue"})
	private static void __print(char __c)
	{
		Debugging.__print(__c, '\0');
	}
	
	/**
	 * Prints the given characters.
	 *
	 * @param __c The character to print.
	 * @param __d Second character to print.
	 * @since 2020/05/07
	 */
	@SuppressWarnings("FeatureEnvy")
	private static void __print(char __c, char __d)
	{
		// If we do not know the pipe for standard error, get it
		int pipe = Debugging._pipe;
		if (pipe == Integer.MIN_VALUE)
			Debugging._pipe = (pipe = Assembly.sysCallPV(
				SystemCallIndex.PD_OF_STDERR));
				
		// Print first character, snip to ASCII
		Assembly.sysCallPV(SystemCallIndex.PD_WRITE_BYTE, pipe,
			(__c > Debugging._BYTE_LIMIT ? '?' : __c));
		
		// Print other characters in bulk, snip to ASCII
		if (__d != 0)

			Assembly.sysCallPV(SystemCallIndex.PD_WRITE_BYTE, pipe,
				(__d > Debugging._BYTE_LIMIT ? '?' : __d));
	}
	
	/**
	 * Prints end of line.
	 *
	 * @since 2020/05/07
	 */
................................................................................
			Debugging._line = (line = Assembly.sysCallV(
				SystemCallIndex.CONFIG_GET_VALUE, ConfigRomKey.LINE_ENDING));
		
		// Print it depending on what is desired
		switch (line)
		{
			case LineEndingType.CR:
				Debugging.__print('\r', '\0');
				break;
				
			case LineEndingType.LF:
				Debugging.__print('\n', '\0');
				break;
				
			case LineEndingType.CRLF:
			default:
				Debugging.__print('\r', '\n');
				break;
		}
	}
}