Check-in [08fc6dd0e6]

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

Overview
Comment:Base handling for percent sequences in debug notes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:08fc6dd0e649fab6a832e83ed5eb287b4029020b
User & Date: stephanie.gawroriski 2019-06-12 00:21:52
Context
2019-06-12
00:25
Handle BREAKPOINT and print the stopping instruction and such. check-in: 5084d8d811 user: stephanie.gawroriski tags: trunk
00:21
Base handling for percent sequences in debug notes. check-in: 08fc6dd0e6 user: stephanie.gawroriski tags: trunk
2019-06-11
22:20
Remove the other headers, not needed. check-in: 5ccbd9181c user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/klib/supervisor/cc/squirreljme/jvm/Bootstrap.java.

47
48
49
50
51
52
53

54
55
56
57
58
59
		// Initialize the RAM links to setup dirty bits and initialize the
		// last block of memory with anything that remains. This makes it so
		// the RAM is actually useable.
		Allocator.__initRamLinks(__rambase, __ramsize);
		
		// Debug
		todo.DEBUG.note("Hello adorable and cute squirrels!");

		
		Assembly.breakpoint();
		throw new todo.TODO();
	}
}








>






47
48
49
50
51
52
53
54
55
56
57
58
59
60
		// Initialize the RAM links to setup dirty bits and initialize the
		// last block of memory with anything that remains. This makes it so
		// the RAM is actually useable.
		Allocator.__initRamLinks(__rambase, __ramsize);
		
		// Debug
		todo.DEBUG.note("Hello adorable and cute squirrels!");
		todo.DEBUG.note("Basic formatting too: %s!", "Neat!");
		
		Assembly.breakpoint();
		throw new todo.TODO();
	}
}

Added runt/klib/supervisor/java/lang/ArrayStoreException.java.



















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

/**
 * This is thrown when an attempt is made to store into an array of a
 * mismatched type.
 *
 * @since 2019/06/11
 */
public class ArrayStoreException
	extends RuntimeException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/06/11
	 */
	public ArrayStoreException()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/06/11
	 */
	public ArrayStoreException(String __m)
	{
		super(__m);
	}
}

Changes to runt/klib/supervisor/todo/DEBUG.java.

39
40
41
42
43
44
45
46



47

48
49
50
51
52














































53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
	 */
	public static final void note(String __fmt, Object... __args)
	{
		// Get the pipe descriptor for standard error, ignore if it fails
		int fd = Assembly.sysCallV(SystemCallIndex.PD_OF_STDERR);
		if (SystemCallError.getError(SystemCallIndex.PD_OF_STDERR) != 0)
			return;
		



		// Print char by char to the console

		for (int i = 0, n = __fmt.length(); i < n; i++)
		{
			// Read character here
			char c = __fmt.charAt(i);
			














































			// Single byte sequence
			if (c <= 0x7F)
			{
				// Forward
				Assembly.sysCall(SystemCallIndex.PD_WRITE_BYTE,
					fd, c & 0xFF);
			}
			
			// Double byte sequence
			else
			{
				// Forward
				Assembly.sysCall(SystemCallIndex.PD_WRITE_BYTE,
					fd, (c >>> 6) | 0b1100_0000);
				Assembly.sysCall(SystemCallIndex.PD_WRITE_BYTE,
					fd, (c & 0b111111));
			}
		}
		
		// End with newline sequence
		Assembly.sysCall(SystemCallIndex.PD_WRITE_BYTE, fd, '\n');
	}
}









>
>
>

>





>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
<
|
<
<
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121


122


	 */
	public static final void note(String __fmt, Object... __args)
	{
		// Get the pipe descriptor for standard error, ignore if it fails
		int fd = Assembly.sysCallV(SystemCallIndex.PD_OF_STDERR);
		if (SystemCallError.getError(SystemCallIndex.PD_OF_STDERR) != 0)
			return;
		
		// Argument pointer
		int argp = 0;
		
		// Print char by char to the console
		boolean percent = false;
		for (int i = 0, n = __fmt.length(); i < n; i++)
		{
			// Read character here
			char c = __fmt.charAt(i);
			
			// Handle percent
			if (percent)
			{
				// Plain percent
				if (c == '%')
					DEBUG.__pipe(fd, '%');
				
				// Newline
				else if (c == 'n')
					DEBUG.__pipe(fd, '\n');
				
				// Just treat as string
				else if (argp < __args.length)
				{
					// Get string form of it
					Object av = __args[argp++];
					String sv = (av == null ? "null" : av.toString());
					
					// Pipe through all string characters
					for (int j = 0, q = sv.length(); j < q; j++)
						DEBUG.__pipe(fd, sv.charAt(j));
				}
			}
			
			// Flag percent
			else if (c == '%')
				percent = true;
			
			// Plain character
			else
				DEBUG.__pipe(fd, c);
		}
		
		// End with newline sequence
		DEBUG.__pipe(fd, '\n');
	}
	
	/**
	 * Pipes out the given character.
	 *
	 * @param __fd The pipe descriptor.
	 * @param __c The character to pipe.
	 * @since 2019/06/11
	 */
	private static final void __pipe(int __fd, char __c)
	{
		// Single byte sequence
		if (__c <= 0x7F)
		{
			// Forward
			Assembly.sysCall(SystemCallIndex.PD_WRITE_BYTE,
				__fd, __c & 0xFF);
		}
		
		// Double byte sequence
		else
		{
			// Forward
			Assembly.sysCall(SystemCallIndex.PD_WRITE_BYTE,
				__fd, (__c >>> 6) | 0b1100_0000);
			Assembly.sysCall(SystemCallIndex.PD_WRITE_BYTE,
				__fd, (__c & 0b111111));
		}
	}
}