mirror of
https://github.com/Interlisp/maiko.git
synced 2026-05-05 15:54:21 +00:00
Replace Addr68k related macros with NativeAligned inline functions
This commit is contained in:
10
src/uutils.c
10
src/uutils.c
@@ -27,7 +27,7 @@
|
|||||||
#include <stdlib.h> // for getenv
|
#include <stdlib.h> // for getenv
|
||||||
#include <string.h> // for strcmp, strcpy, strlen, strncpy
|
#include <string.h> // for strcmp, strcpy, strlen, strncpy
|
||||||
#include <unistd.h> // for getuid, gethostid, gethostname, getpgrp
|
#include <unistd.h> // for getuid, gethostid, gethostname, getpgrp
|
||||||
#include "adr68k.h" // for Addr68k_from_LADDR
|
#include "adr68k.h" // for NativeAligned4FromLAddr
|
||||||
#include "keyboard.h" // for KBEVENT, KB_ALLUP, RING, KEYEVENTSIZE, MAXKE...
|
#include "keyboard.h" // for KBEVENT, KB_ALLUP, RING, KEYEVENTSIZE, MAXKE...
|
||||||
#include "lispemul.h" // for LispPTR, DLword, NIL, ATOM_T
|
#include "lispemul.h" // for LispPTR, DLword, NIL, ATOM_T
|
||||||
#include "lspglob.h"
|
#include "lspglob.h"
|
||||||
@@ -52,12 +52,12 @@ static int lisp_string_to_c_string(LispPTR Lisp, char *C, size_t length) {
|
|||||||
|
|
||||||
if (GetTypeNumber(Lisp) != TYPE_ONED_ARRAY) { return (-1); }
|
if (GetTypeNumber(Lisp) != TYPE_ONED_ARRAY) { return (-1); }
|
||||||
|
|
||||||
arrayp = (OneDArray *)(Addr68k_from_LADDR(Lisp));
|
arrayp = (OneDArray *)NativeAligned4FromLAddr(Lisp);
|
||||||
if (arrayp->fillpointer >= length) { return (-1); } /* too long */
|
if (arrayp->fillpointer >= length) { return (-1); } /* too long */
|
||||||
|
|
||||||
switch (arrayp->typenumber) {
|
switch (arrayp->typenumber) {
|
||||||
case THIN_CHAR_TYPENUMBER:
|
case THIN_CHAR_TYPENUMBER:
|
||||||
base = ((char *)(Addr68k_from_LADDR(arrayp->base))) + ((int)(arrayp->offset));
|
base = ((char *)NativeAligned2FromLAddr(arrayp->base)) + ((int)(arrayp->offset));
|
||||||
#ifndef BYTESWAP
|
#ifndef BYTESWAP
|
||||||
strncpy(C, base, arrayp->fillpointer);
|
strncpy(C, base, arrayp->fillpointer);
|
||||||
#else
|
#else
|
||||||
@@ -96,13 +96,13 @@ static int c_string_to_lisp_string(char *C, LispPTR Lisp) {
|
|||||||
length = strlen(C);
|
length = strlen(C);
|
||||||
if (GetTypeNumber(Lisp) != TYPE_ONED_ARRAY) { return (-1); }
|
if (GetTypeNumber(Lisp) != TYPE_ONED_ARRAY) { return (-1); }
|
||||||
|
|
||||||
arrayp = (OneDArray *)(Addr68k_from_LADDR(Lisp));
|
arrayp = (OneDArray *)NativeAligned4FromLAddr(Lisp);
|
||||||
if (arrayp->totalsize < length + 1) { return (-1); }
|
if (arrayp->totalsize < length + 1) { return (-1); }
|
||||||
/* too short for C string */
|
/* too short for C string */
|
||||||
|
|
||||||
switch (arrayp->typenumber) {
|
switch (arrayp->typenumber) {
|
||||||
case THIN_CHAR_TYPENUMBER:
|
case THIN_CHAR_TYPENUMBER:
|
||||||
base = ((char *)(Addr68k_from_LADDR(arrayp->base))) + ((int)(arrayp->offset));
|
base = ((char *)NativeAligned2FromLAddr(arrayp->base)) + ((int)(arrayp->offset));
|
||||||
#ifndef BYTESWAP
|
#ifndef BYTESWAP
|
||||||
strcpy(base, C);
|
strcpy(base, C);
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user