[Mit-cadr-cvs] r392 - in branches/ggilley: emulator/usim emulator/usim/CADR emulator/usim/CADR/CADR emulator/usim/CADR/CADR.xcodeproj lisp/patch lisp/site

ggilley at common-lisp.net ggilley at common-lisp.net
Wed Dec 5 16:09:03 UTC 2012


Author: ggilley
Date: Wed Dec  5 08:09:03 2012
New Revision: 392

Log:
add support for mapping /tree

Added:
   branches/ggilley/emulator/usim/CADR/CADR/CADR.entitlements
Modified:
   branches/ggilley/emulator/usim/CADR/AppController.m
   branches/ggilley/emulator/usim/CADR/CADR.xcodeproj/project.pbxproj
   branches/ggilley/emulator/usim/CADR/cadrAppDelegate.m
   branches/ggilley/emulator/usim/Files.c
   branches/ggilley/emulator/usim/Files.h
   branches/ggilley/emulator/usim/main.c
   branches/ggilley/lisp/patch/system.patch-directory
   branches/ggilley/lisp/site/hsttbl.lisp

Modified: branches/ggilley/emulator/usim/CADR/AppController.m
==============================================================================
--- branches/ggilley/emulator/usim/CADR/AppController.m	Tue Dec  4 19:13:28 2012	(r391)
+++ branches/ggilley/emulator/usim/CADR/AppController.m	Wed Dec  5 08:09:03 2012	(r392)
@@ -7,6 +7,7 @@
 //
 
 #import "AppController.h"
+#include "Files.h"
 
 @implementation AppController
 
@@ -44,6 +45,7 @@
 
         sourceFolderURL = [sourceFolder retain];
         [sourceFolderURL startAccessingSecurityScopedResource];
+        settreeroot([[sourceFolderURL path] fileSystemRepresentation]);
     }
 }
 

Modified: branches/ggilley/emulator/usim/CADR/CADR.xcodeproj/project.pbxproj
==============================================================================
--- branches/ggilley/emulator/usim/CADR/CADR.xcodeproj/project.pbxproj	Tue Dec  4 19:13:28 2012	(r391)
+++ branches/ggilley/emulator/usim/CADR/CADR.xcodeproj/project.pbxproj	Wed Dec  5 08:09:03 2012	(r392)
@@ -166,6 +166,7 @@
 		DD3658631665F0A600755138 /* decode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = decode.h; path = ../../decode.h; sourceTree = "<group>"; };
 		DD3658641665F0A600755138 /* keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = keyboard.h; path = ../../keyboard.h; sourceTree = "<group>"; };
 		DD73006D16671C8300706ED9 /* cadr icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "cadr icon.icns"; sourceTree = SOURCE_ROOT; };
+		DDA39C17166EFC2A0079DDDF /* CADR.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = CADR.entitlements; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -232,6 +233,7 @@
 		DD308CD61665E6A000361F6D /* CADR */ = {
 			isa = PBXGroup;
 			children = (
+				DDA39C17166EFC2A0079DDDF /* CADR.entitlements */,
 				DD36580B1665EAC000755138 /* cadrAppDelegate.m */,
 				DD36580C1665EAC000755138 /* CreateDisk.xib */,
 				DD36580D1665EAC000755138 /* diskutil.m */,
@@ -617,6 +619,8 @@
 		DD308CFF1665E6A000361F6D /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CODE_SIGN_ENTITLEMENTS = CADR/CADR.entitlements;
+				CODE_SIGN_IDENTITY = "Mac Developer";
 				COMBINE_HIDPI_IMAGES = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "CADR/CADR-Prefix.pch";
@@ -633,6 +637,8 @@
 		DD308D001665E6A000361F6D /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CODE_SIGN_ENTITLEMENTS = CADR/CADR.entitlements;
+				CODE_SIGN_IDENTITY = "Mac Developer";
 				COMBINE_HIDPI_IMAGES = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "CADR/CADR-Prefix.pch";

Added: branches/ggilley/emulator/usim/CADR/CADR/CADR.entitlements
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/ggilley/emulator/usim/CADR/CADR/CADR.entitlements	Wed Dec  5 08:09:03 2012	(r392)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>com.apple.security.app-sandbox</key>
+	<true/>
+	<key>com.apple.security.files.user-selected.read-write</key>
+	<true/>
+</dict>
+</plist>

Modified: branches/ggilley/emulator/usim/CADR/cadrAppDelegate.m
==============================================================================
--- branches/ggilley/emulator/usim/CADR/cadrAppDelegate.m	Tue Dec  4 19:13:28 2012	(r391)
+++ branches/ggilley/emulator/usim/CADR/cadrAppDelegate.m	Wed Dec  5 08:09:03 2012	(r392)
@@ -22,6 +22,7 @@
 #include "chaos.h"
 //#include "ether.h"
 #include "diskutil.h"
+#include "Files.h"
 
 @implementation cadrAppDelegate
 
@@ -458,6 +459,7 @@
                 
                 sourceFolderURL = [bookmarkFileURL retain];
                 [sourceFolderURL startAccessingSecurityScopedResource];
+                settreeroot([[sourceFolderURL path] fileSystemRepresentation]);
 //            [sourceFolderURL stopAccessingSecurityScopedResource];
             }
         }

Modified: branches/ggilley/emulator/usim/Files.c
==============================================================================
--- branches/ggilley/emulator/usim/Files.c	Tue Dec  4 19:13:28 2012	(r391)
+++ branches/ggilley/emulator/usim/Files.c	Wed Dec  5 08:09:03 2012	(r392)
@@ -669,6 +669,17 @@
 void processmini(chaos_connection *conn);
 
 
+static char *treeroot;
+
+void
+settreeroot(const char *root)
+{
+    treeroot = strdup(root);
+    if (treeroot[strlen(treeroot)] == '/')
+        treeroot[strlen(treeroot)] = '\0';
+    
+    printf("settreeroot: '%s'\n", treeroot);
+}
 
 static void
 dumpbuffer(u_char *buf, ssize_t cnt)
@@ -4113,6 +4124,7 @@
     register char *cp;
     int errcode;
     char *wd, save;
+    int freewd = 0;
     
     if (path == 0) {
         errstring = "Empty pathname";
@@ -4145,7 +4157,20 @@
         while (*path == '/')
             path++;
     } else if (*path == '/')
-        wd = "";
+    {
+        size_t newlength = strlen(treeroot) + strlen(path);
+        
+        if (treeroot == NULL || path[0] != '/' || tolower(path[1]) != 't' || tolower(path[2]) != 'r' ||
+            tolower(path[3]) != 'e' || tolower(path[4]) != 'e' || (path[5] != '/' && path[5] != '\0'))
+            wd = "";
+        else
+        {
+            wd = malloc(newlength);
+            strcpy(wd, treeroot);
+            path += 6;
+            freewd = 1;
+        }
+    }
     else if ((wd = cwd) == NOSTR) {
         errstring = "Relative pathname when no working directory";
         return IPS;
@@ -4157,6 +4182,8 @@
             (void)strcat(cp, "/");
         (void)strcat(cp, path);
         if ((errcode = dcanon(cp, blankok))) {
+            if (freewd)
+                free(wd);
             (void)free(cp);
             return errcode;
         }
@@ -4178,6 +4205,9 @@
     }
     else
         fatal("Parsepath");
+    
+    if (freewd)
+        free(wd);
     return 0;
 }
 
@@ -4194,7 +4224,7 @@
     register int slash;
     
     if (*cp != '/')
-        fatal("dcanon");
+        return 0;
     for (p = cp; *p; ) {		/* for each component */
         sp = p;			/* save slash address */
         while(*++p == '/')	/* flush extra slashes */
@@ -5025,6 +5055,9 @@
         char tbuf[20];
         struct stat sbuf;
         struct tm *ptm;
+        char *dirname;
+        char *realname;
+        int errcode;
                 
         for (;;) {
             
@@ -5039,18 +5072,34 @@
 
                     packet->data[packet->length] = '\0';
                     printf("MINI: op %o %s\n", packet->opcode, packet->data);
-                    if ((fd = open((char *)packet->data, O_RDONLY)) < 0) {
+                    dirname = 0;
+                    realname = 0;
+                    if ((errcode = parsepath((char *)packet->data, &dirname, &realname, 0)) != 0)
+                    {
                         output->opcode = 0203 << 8;
                         printf("MINI: open failed %s\n", strerror(errno));
                         chaos_connection_queue(conn, output);
                         continue;
+                    }
+                    if ((fd = open(realname, O_RDONLY)) < 0) {
+                        output->opcode = 0203 << 8;
+                        printf("MINI: open failed %s\n", strerror(errno));
+                        chaos_connection_queue(conn, output);
+                        if (dirname)
+                            free(dirname);
+                        if (realname)
+                            free(realname);
+                        continue;
                     } else {
+                        if (dirname)
+                            free(dirname);
+                        if (realname)
+                            free(realname);
                         output->opcode = 0202 << 8;
                         fstat(fd, &sbuf);
                         ptm = localtime(&sbuf.st_mtime);
                         strftime(tbuf, sizeof(tbuf), "%D %T", ptm);
-                        length = sprintf((char *)output->data, "%s%c%s",
-                                         packet->data, 0215, tbuf);
+                        length = sprintf((char *)output->data, "%s%c%s", packet->data, 0215, tbuf);
                         output->length = (unsigned short)length;
                         chaos_connection_queue(conn, output);
                         binary = (packet->opcode >> 8) & 1;
@@ -5092,71 +5141,90 @@
 {
     printf("processmini:\n");
     
-        int binary = 0;
-        chaos_packet *packet;
-        chaos_packet *output;
-        int length, fd;
-        char tbuf[20];
-        struct stat sbuf;
-        struct tm *ptm;
-	chaos_connection *conn = (chaos_connection *)vconn;
+    int binary = 0;
+    chaos_packet *packet;
+    chaos_packet *output;
+    ssize_t length;
+    int fd;
+    char tbuf[20];
+    struct stat sbuf;
+    struct tm *ptm;
+    char *dirname;
+    char *realname;
+    int errcode;
+    
+    for (;;) {
+        
+        packet = chaos_connection_dequeue(conn);
+        if (packet == 0)
+            break;
+        
+        switch (packet->opcode >> 8) {
+            case 0200:
+            case 0201:
+                output = chaos_allocate_packet(conn, DWDOP, CHMAXDATA);
                 
-        for (;;) {
-            
-            packet = chaos_connection_dequeue(conn);
-            if (packet == 0)
-                break;
-
-            switch (packet->opcode >> 8) {
-                case 0200:
-                case 0201:
-                    output = chaos_allocate_packet(conn, DWDOP, CHMAXDATA);
-
-                    packet->data[packet->length] = '\0';
-                    printf("MINI: op %o %s\n", packet->opcode, packet->data);
-                    if ((fd = open((char *)packet->data, O_RDONLY)) < 0) {
-                        output->opcode = 0203 << 8;
-                        printf("MINI: open failed %s\n", strerror(errno));
-                        chaos_connection_queue(conn, output);
-                        continue;
-                    } else {
-                        output->opcode = 0202 << 8;
-                        fstat(fd, &sbuf);
-                        ptm = localtime(&sbuf.st_mtime);
-                        strftime(tbuf, sizeof(tbuf), "%D %T", ptm);
-                        length = sprintf((char *)output->data, "%s%c%s",
-                                         packet->data, 0215, tbuf);
-                        output->length = (unsigned short)length;
-                        chaos_connection_queue(conn, output);
-                        binary = (packet->opcode >> 8) & 1;
-                        log(LOG_INFO, "MINI: binary = %d\n", binary);
-                    }
-                    free(packet);
-
-                    do {
-                        char buffer[CHMAXDATA];
-                        
-                        length = read(fd, buffer, CHMAXDATA);
-                        /*log(LOG_INFO, "MINI: read %d\n", length);*/
-                        if (length == 0)
-                            break;
-                        output = chaos_allocate_packet(conn, (binary) ? DWDOP : DATOP, length);
-                        memcpy(output->data, buffer, length);
-                        if (binary == 0)
-                            buffer_to_lispm((unsigned char *)output->data, length);
-                        chaos_connection_queue(conn, output);
-                     } while (length > 0);
+                packet->data[packet->length] = '\0';
+                printf("MINI: op %o %s\n", packet->opcode, packet->data);
+                dirname = 0;
+                realname = 0;
+                if ((errcode = parsepath((char *)packet->data, &dirname, &realname, 0)) != 0)
+                {
+                    output->opcode = 0203 << 8;
+                    printf("MINI: open failed %s\n", strerror(errno));
+                    chaos_connection_queue(conn, output);
+                    continue;
+                }
+                if ((fd = open(realname, O_RDONLY)) < 0) {
+                    output->opcode = 0203 << 8;
+                    printf("MINI: open failed %s\n", strerror(errno));
+                    chaos_connection_queue(conn, output);
+                    if (dirname)
+                        free(dirname);
+                    if (realname)
+                        free(realname);
+                    continue;
+                } else {
+                    if (dirname)
+                        free(dirname);
+                    if (realname)
+                        free(realname);
+                    output->opcode = 0202 << 8;
+                    fstat(fd, &sbuf);
+                    ptm = localtime(&sbuf.st_mtime);
+                    strftime(tbuf, sizeof(tbuf), "%D %T", ptm);
+                    length = sprintf((char *)output->data, "%s%c%s", packet->data, 0215, tbuf);
+                    output->length = (unsigned short)length;
+                    chaos_connection_queue(conn, output);
+                    binary = (packet->opcode >> 8) & 1;
+                    log(LOG_INFO, "MINI: binary = %d\n", binary);
+                }
+                free(packet);
+                
+                do {
+                    char buffer[CHMAXDATA];
                     
-                    printf("MINI: before eof\n");
-                    output = chaos_allocate_packet(conn, EOFOP, 0);
+                    length = read(fd, buffer, CHMAXDATA);
+                    /*log(LOG_INFO, "MINI: read %d\n", length);*/
+                    if (length == 0)
+                        break;
+                    output = chaos_allocate_packet(conn, (binary) ? DWDOP : DATOP, length);
+                    memcpy(output->data, buffer, length);
+                    if (binary == 0)
+                        buffer_to_lispm((unsigned char *)output->data, length);
                     chaos_connection_queue(conn, output);
-                    close(fd);
-                    break;
-                default:
-                    log(LOG_INFO, "MINI: op %o\n", packet->opcode >> 8);
-                    break;
-            }
+                } while (length > 0);
+                
+                printf("MINI: before eof\n");
+                output = chaos_allocate_packet(conn, EOFOP, 0);
+                chaos_connection_queue(conn, output);
+                close(fd);
+                break;
+            default:
+                log(LOG_INFO, "MINI: op %o\n", packet->opcode >> 8);
+                break;
         }
+    }
 }
 
 static pthread_t processmini_thread;

Modified: branches/ggilley/emulator/usim/Files.h
==============================================================================
--- branches/ggilley/emulator/usim/Files.h	Tue Dec  4 19:13:28 2012	(r391)
+++ branches/ggilley/emulator/usim/Files.h	Wed Dec  5 08:09:03 2012	(r392)
@@ -163,3 +163,5 @@
 #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
 #define BSD42
 #endif
+
+void settreeroot(const char *root);

Modified: branches/ggilley/emulator/usim/main.c
==============================================================================
--- branches/ggilley/emulator/usim/main.c	Tue Dec  4 19:13:28 2012	(r391)
+++ branches/ggilley/emulator/usim/main.c	Wed Dec  5 08:09:03 2012	(r392)
@@ -13,6 +13,7 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <signal.h>
+#include <string.h>
 
 #if defined(LINUX) || defined(OSX) || defined(BSD)
 #include <unistd.h>
@@ -30,6 +31,8 @@
 #endif
 #endif /* DISPLAY_SDL */
 
+#include "Files.h"
+
 int show_video_flag;
 int mouse_sync_flag;
 int alt_prom_flag;
@@ -47,6 +50,7 @@
 extern int ether_init(void);
 extern void iob_warm_boot_key(void);
 extern void run(void);
+extern int dcanon(char *cp, int blankok);
 
 struct timeval tv1;
 
@@ -138,6 +142,7 @@
 	fprintf(stderr, "-n		run with no SDL video window\n");
 	fprintf(stderr, "-p <sym-name>	set breakpoint in prom\n");
 	fprintf(stderr, "-q <number>	break after hitting breakpoint n times\n");
+	fprintf(stderr, "-r		map /tree to ../../lisp\n");
 	fprintf(stderr, "-t		turn on microcode tracing\n");
 	fprintf(stderr, "-T<flags>	turn on tracing\n");
 	fprintf(stderr, "   d - disk\n");
@@ -167,8 +172,8 @@
 	show_video_flag = 1;
 	mouse_sync_flag = 1;
 
-	while ((c = getopt(argc, argv, "ab:B:c:dC:i:l:nmp:q:tT:sSw")) != -1) {
-		switch (c) {
+	while ((c = getopt(argc, argv, "ab:B:c:dC:i:l:nmp:q:rtT:sSw")) != -1) {
+		switch (c) { 
 		case 'a':
 			alt_prom_flag = 1;
 			break;
@@ -205,6 +210,21 @@
 		case 'q':
 			breakpoint_set_count(atoi(optarg));
 			break;
+		case 'r':
+			{			
+				char *p = "../../lisp";
+				char *newpath = malloc(strlen(argv[0]) + strlen(p) + 2);
+				char *q = &argv[0][strlen(argv[0])];
+				
+				while (*q != '/') q--;
+				*(q+1) = '\0';
+				strcpy(newpath, argv[0]);
+				strcat(newpath, p);
+				dcanon(newpath, 0);
+				settreeroot(newpath);
+				free(newpath);
+			}
+			break;
 		case 'S':
 			save_state_flag = 1;
 			break;

Modified: branches/ggilley/lisp/patch/system.patch-directory
==============================================================================
--- branches/ggilley/lisp/patch/system.patch-directory	Tue Dec  4 19:13:28 2012	(r391)
+++ branches/ggilley/lisp/patch/system.patch-directory	Wed Dec  5 08:09:03 2012	(r392)
@@ -1,7 +1,6 @@
-;;; Written 12/07/81 09:25:58 by rg,
-;;; while running on Lisp Machine Seven from band 1
-;;; with Experimental System 77.5, Experimental ZMail 37.1, microcode 832.
+;;; Written 12/04/12 22:47:58 by ggilley,
+;;; while running on Unknown from band 3
+;;; with System 78.52, ZMail 38.5, Tape 6.5, LMFS 21.34, Symbolics 8.13, microcode 841.
 
 
-("System" 78.)
-
+("System" 79.) 
\ No newline at end of file

Modified: branches/ggilley/lisp/site/hsttbl.lisp
==============================================================================
--- branches/ggilley/lisp/site/hsttbl.lisp	Tue Dec  4 19:13:28 2012	(r391)
+++ branches/ggilley/lisp/site/hsttbl.lisp	Wed Dec  5 08:09:03 2012	(r392)
@@ -1,6 +1,6 @@
 ;;; -*- Mode: LISP; Package: CHAOS; Base: 8 -*-
 ;;; *** THIS FILE WAS AUTOMATICALLY GENERATED BY A PROGRAM, DO NOT EDIT IT ***
-;;; Host table made from SERVER: /tree/chaos/HOSTS.TEXT by brad at 1/01/70 10:15:21
+;;; Host table made from server: /volumes/big/mit-cadr/branches/ggilley/lisp/chaos/hosts.text by ggilley at 12/04/12 21:56:55
 (SI:DEFINE-HOST "SERVER"
                 ':HOST-NAMES
                 '("SERVER")




More information about the mit-cadr-cvs mailing list