1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-29 04:51:28 +00:00

Reformat all C source files with Clang-format in Google style w/ 100 col width.

This commit is contained in:
Nick Briggs
2017-05-28 18:08:18 -07:00
parent 691645d048
commit 156c3292f8
167 changed files with 40520 additions and 48069 deletions

124
src/lisp2c.c Executable file → Normal file
View File

@@ -1,10 +1,9 @@
/* $Id: lisp2c.c,v 1.3 1999/05/31 23:35:37 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* $Id: lisp2c.c,v 1.3 1999/05/31 23:35:37 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
*/
static char *id = "$Id: lisp2c.c,v 1.3 1999/05/31 23:35:37 sybalsky Exp $ Copyright (C) Venue";
/* File containing the conversion functions between lisp and C */
/* -jarl */
/************************************************************************/
/* */
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
@@ -30,111 +29,82 @@ static char *id = "$Id: lisp2c.c,v 1.3 1999/05/31 23:35:37 sybalsky Exp $ Copyri
#include "medleyfp.h"
#include "arith.h"
int LispStringP(LispPTR object)
{
int LispStringP(LispPTR object) {
int type;
type = ((OneDArray *)Addr68k_from_LADDR(object))->typenumber;
return((type == THIN_CHAR_TYPENUMBER) || (type == FAT_CHAR_TYPENUMBER));
return ((type == THIN_CHAR_TYPENUMBER) || (type == FAT_CHAR_TYPENUMBER));
}
int LispStringLength (LispPTR lispstring)
{
OneDArray *arrayp;
int LispStringLength(LispPTR lispstring) {
OneDArray *arrayp;
arrayp = (OneDArray *)(Addr68k_from_LADDR(lispstring));
return(arrayp->fillpointer);
return (arrayp->fillpointer);
}
void LispStringToCStr (LispPTR lispstring, char *cstring)
{
void LispStringToCStr(LispPTR lispstring, char *cstring) {
OneDArray *arrayp;
char *base;
short *sbase;
int i, Len;
char *base;
short *sbase;
int i, Len;
arrayp = (OneDArray *)(Addr68k_from_LADDR((UNSIGNED)lispstring));
Len = arrayp->fillpointer;
switch(arrayp->typenumber)
{
switch (arrayp->typenumber) {
case THIN_CHAR_TYPENUMBER:
base = ((char *)
(Addr68k_from_LADDR((UNSIGNED)arrayp->base)))
+ ((int)(arrayp->offset));
for(i=0;i<Len;i++)
cstring[i] = base[i];
base = ((char *)(Addr68k_from_LADDR((UNSIGNED)arrayp->base))) + ((int)(arrayp->offset));
for (i = 0; i < Len; i++) cstring[i] = base[i];
cstring[Len] = '\0';
break;
case FAT_CHAR_TYPENUMBER:
sbase = ((short *)
(Addr68k_from_LADDR((UNSIGNED)arrayp->base)))
+ ((int)(arrayp->offset));
sbase = ((short *)(Addr68k_from_LADDR((UNSIGNED)arrayp->base))) + ((int)(arrayp->offset));
base = (char *)sbase;
for(i=0;i<Len*2;i++)
cstring[i] = base[i];
cstring[Len*2] = '\0';
for (i = 0; i < Len * 2; i++) cstring[i] = base[i];
cstring[Len * 2] = '\0';
break;
default: error("Arg not Lisp string.\n");
}
}
int LispIntToCInt(LispPTR lispint) {
switch ((0xFFFF0000 & lispint)) {
case S_POSITIVE: return (lispint & 0xFFFF); break;
case S_NEGATIVE: return (lispint | 0xFFFF0000); break;
default:
error("Arg not Lisp string.\n");
}
}
int LispIntToCInt (LispPTR lispint)
{
switch( (0xFFFF0000 & lispint) ){
case S_POSITIVE:
return(lispint & 0xFFFF);
break;
case S_NEGATIVE:
return(lispint | 0xFFFF0000);
break;
default:
if( GetTypeNumber(lispint) == TYPE_FIXP ) {
return( *((int *)Addr68k_from_LADDR(lispint)));
} else {
char msg[200];
sprintf(msg, "Arg 0x%x isn't a lisp integer.", lispint);
error(msg);
}
break;
if (GetTypeNumber(lispint) == TYPE_FIXP) {
return (*((int *)Addr68k_from_LADDR(lispint)));
} else {
char msg[200];
sprintf(msg, "Arg 0x%x isn't a lisp integer.", lispint);
error(msg);
}
break;
}
}
LispPTR CIntToLispInt(int cint)
{
if (abs(cint) > 0xFFFF) { /* its a fixp! */
LispPTR CIntToLispInt(int cint) {
if (abs(cint) > 0xFFFF) { /* its a fixp! */
register LispPTR *wordp;
wordp = (LispPTR *) createcell68k(TYPE_FIXP);
wordp = (LispPTR *)createcell68k(TYPE_FIXP);
*((int *)wordp) = cint;
return(LADDR_from_68k(wordp));
} else if (cint >= 0) { /* its a positive smallp! */
return(S_POSITIVE | cint);
} else { /* its a negative smallp! */
return(S_NEGATIVE | (0xFFFF & cint));
return (LADDR_from_68k(wordp));
} else if (cint >= 0) { /* its a positive smallp! */
return (S_POSITIVE | cint);
} else { /* its a negative smallp! */
return (S_NEGATIVE | (0xFFFF & cint));
}
}
DLword CIntToSmallp(int cint)
{
if (abs(cint) > 0xFFFF) { /* its a fixp! */
DLword CIntToSmallp(int cint) {
if (abs(cint) > 0xFFFF) { /* its a fixp! */
error("Arg not a Smallp.\n");
} else if (cint >= 0) { /* its a positive smallp! */
return(S_POSITIVE | cint);
} else { /* its a negative smallp! */
return(S_NEGATIVE | (0xFFFF & cint));
} else if (cint >= 0) { /* its a positive smallp! */
return (S_POSITIVE | cint);
} else { /* its a negative smallp! */
return (S_NEGATIVE | (0xFFFF & cint));
}
}