Revision: 45716
http://sourceforge.net/p/vice-emu/code/45716
Author: gpz
Date: 2025-07-29 15:23:08 +0000 (Tue, 29 Jul 2025)
Log Message:
-----------
in C65/Mega65 mode preserve leading spaces in txt->prg conversion, patch by Dan Sanderson
Modified Paths:
--------------
trunk/vice/src/tools/petcat/petcat.c
Modified: trunk/vice/src/tools/petcat/petcat.c
===================================================================
--- trunk/vice/src/tools/petcat/petcat.c 2025-07-29 13:35:42 UTC (rev 45715)
+++ trunk/vice/src/tools/petcat/petcat.c 2025-07-29 15:23:08 UTC (rev 45716)
@@ -1882,6 +1882,23 @@
#define MAX_INLINE_LEN (256 * 8)
#define MAX_OUTLINE_LEN 256
+static unsigned char* check_leading_space(int version, unsigned char* p)
+{
+ if (version == B_10 || version == B_65) {
+ /* for modes that preserve leading spaces, only delete a single space */
+ if (isspace(*p)) {
+ p++;
+ }
+ } else {
+ /* otherwise, delete all leading spaces */
+ while (isspace((unsigned char)*p)) {
+ p++;
+ }
+ }
+
+ return p;
+}
+
static void p_tokenize(int version, unsigned int addr, int ctrls)
{
static char line[MAX_INLINE_LEN + 1];
@@ -1920,10 +1937,9 @@
quote = 0;
rem_data_mode = 0;
- while (isspace((unsigned char)*p2)) {
- p2++;
- }
+ p2 = check_leading_space(version, p2);
+
while (*p2) {
if (*p2 == 0x22) {
quote ^= *p2;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|