Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8ec5bd0

Browse files
committed
Add NeXT port submitted by: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
1 parent1321fe1 commit8ec5bd0

File tree

5 files changed

+162
-0
lines changed

5 files changed

+162
-0
lines changed

‎src/backend/port/next/Makefile.inc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#-------------------------------------------------------------------------
2+
#
3+
# Makefile.inc--
4+
# Makefile for port/next (NeXTStep 3.3 specific stuff)
5+
#
6+
#-------------------------------------------------------------------------
7+
8+
CFLAGS+= -DUSE_POSIX_TIME -DNO_EMPTY_STMTS
9+
10+
SUBSRCS+= load.c externs.c
11+
12+
HEADERS+= machine.h port-protos.h
13+
14+
LDADD+= -lIPC

‎src/backend/port/next/externs.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include<libc.h>
2+
#include<sys/signal.h>
3+
4+
voidputenv(char*name)
5+
{
6+
externchar**environ;
7+
staticintwas_mallocated=0;
8+
intsize;
9+
10+
/* Compute the size of environ array including the final NULL */
11+
for (size=1;environ[size++];)
12+
/* nothing */;
13+
14+
if (!was_mallocated) {
15+
char**tmp=environ;
16+
inti;
17+
18+
was_mallocated=1;
19+
environ=malloc (size*sizeof(char*));
20+
for (i=0;i<size;i++)
21+
environ[i]=tmp[i];
22+
}
23+
24+
environ=realloc (environ, (size+1)*sizeof (char*));
25+
environ[size-1]=strcpy (malloc (strlen (name)+1),name);
26+
environ[size]=NULL;
27+
}
28+
29+
intsigaddset(int*set,intsigno)
30+
{
31+
*set |=sigmask(signo);
32+
return*set;
33+
}
34+
35+
intsigemptyset(int*set)
36+
{
37+
return (*set=0);
38+
}
39+
40+
char*getcwd(char*buf,size_tsize)
41+
{
42+
returngetwd (buf);
43+
}

‎src/backend/port/next/load.c

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#include<mach-o/rld.h>
2+
#include<streams/streams.h>
3+
#include<stdlib.h>
4+
5+
staticchar*lastError=NULL;
6+
7+
staticNXStream*OpenError()
8+
{
9+
returnNXOpenMemory(NULL,0,NX_WRITEONLY);
10+
}
11+
12+
staticvoidCloseError(NXStream*s)
13+
{
14+
if (s)
15+
NXCloseMemory (s,NX_FREEBUFFER);
16+
}
17+
18+
staticvoidTransferError(NXStream*s)
19+
{
20+
char*buffer;
21+
intlen,maxlen;
22+
23+
if (lastError)
24+
free (lastError);
25+
NXGetMemoryBuffer (s,&buffer,&len,&maxlen);
26+
lastError=malloc (len+1);
27+
strcpy (lastError,buffer);
28+
}
29+
30+
void*next_dlopen(char*name)
31+
{
32+
intrld_success;
33+
NXStream*errorStream;
34+
char*result=NULL;
35+
char**p;
36+
37+
errorStream=OpenError();
38+
p=calloc (2,sizeof(void*));
39+
p[0]=name;
40+
rld_success=rld_load(errorStream,NULL,p,NULL);
41+
free (p);
42+
43+
if (!rld_success) {
44+
TransferError (errorStream);
45+
result= (char*)1;
46+
}
47+
CloseError (errorStream);
48+
returnresult;
49+
}
50+
51+
intnext_dlclose(void*handle)
52+
{
53+
return0;
54+
}
55+
56+
void*next_dlsym (void*handle,char*symbol)
57+
{
58+
NXStream*errorStream=OpenError();
59+
charsymbuf[1024];
60+
unsigned longsymref=0;
61+
62+
sprintf(symbuf,"_%s",symbol);
63+
if (!rld_lookup (errorStream,symbuf,&symref))
64+
TransferError(errorStream);
65+
CloseError(errorStream);
66+
return (void*)symref;
67+
}
68+
69+
char*next_dlerror(void)
70+
{
71+
returnlastError;
72+
}
73+

‎src/backend/port/next/machine.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndefMACHINE_H
2+
#defineMACHINE_H
3+
4+
#defineBLCKSZ8192
5+
6+
#endif

‎src/backend/port/next/port-protos.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* port-protos.h--
4+
* port-specific prototypes for NeXT
5+
*
6+
*-------------------------------------------------------------------------
7+
*/
8+
#ifndefPORT_PROTOS_H
9+
#definePORT_PROTOS_H
10+
11+
#include"fmgr.h"/* for func_ptr */
12+
#include"utils/dynamic_loader.h"
13+
14+
void*next_dlopen(char*name);
15+
intnext_dlclose(void*handle);
16+
void*next_dlsym (void*handle,char*symbol);
17+
char*next_dlerror(void);
18+
19+
#definepg_dlopen(f)next_dlopen
20+
#definepg_dlsymnext_dlsym
21+
#definepg_dlclosenext_dlclose
22+
#definepg_dlerrornext_dlerror
23+
24+
/* port.c */
25+
26+
#endif/* PORT_PROTOS_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp