Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
0c83348d
Kaydet (Commit)
0c83348d
authored
Nis 22, 2003
tarafından
Andrew MacIntyre
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
minor cleanups and whitespace normalisation
üst
699cbb76
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
81 deletions
+82
-81
dlfcn.c
PC/os2emx/dlfcn.c
+37
-38
dlfcn.h
PC/os2emx/dlfcn.h
+9
-8
dllentry.c
PC/os2emx/dllentry.c
+16
-17
getpathp.c
PC/os2emx/getpathp.c
+20
-18
No files found.
PC/os2emx/dlfcn.c
Dosyayı görüntüle @
0c83348d
...
@@ -29,10 +29,9 @@ PERFORMANCE OF THIS SOFTWARE.
...
@@ -29,10 +29,9 @@ PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
******************************************************************/
/*
/* This library implements dlopen() - Unix-like dynamic linking
This library implements dlopen() - functions for OS/2 using
* emulation functions for OS/2 using DosLoadModule() and company.
DosLoadModule() and company.
*/
*/
#define INCL_DOS
#define INCL_DOS
#define INCL_DOSERRORS
#define INCL_DOSERRORS
...
@@ -46,8 +45,6 @@ PERFORMANCE OF THIS SOFTWARE.
...
@@ -46,8 +45,6 @@ PERFORMANCE OF THIS SOFTWARE.
#include <string.h>
#include <string.h>
#include <malloc.h>
#include <malloc.h>
/*-------------------------------------- Unix-like dynamic linking emulation -*/
typedef
struct
_track_rec
{
typedef
struct
_track_rec
{
char
*
name
;
char
*
name
;
HMODULE
handle
;
HMODULE
handle
;
...
@@ -55,8 +52,8 @@ typedef struct _track_rec {
...
@@ -55,8 +52,8 @@ typedef struct _track_rec {
struct
_track_rec
*
next
;
struct
_track_rec
*
next
;
}
tDLLchain
,
*
DLLchain
;
}
tDLLchain
,
*
DLLchain
;
static
DLLchain
dlload
=
NULL
;
/* A simple chained list of DLL names */
static
DLLchain
dlload
=
NULL
;
/* A simple chained list of DLL names */
static
char
dlerr
[
256
];
/* last error text string */
static
char
dlerr
[
256
];
/* last error text string */
static
void
*
last_id
;
static
void
*
last_id
;
static
DLLchain
find_id
(
void
*
id
)
static
DLLchain
find_id
(
void
*
id
)
...
@@ -65,13 +62,13 @@ static DLLchain find_id(void *id)
...
@@ -65,13 +62,13 @@ static DLLchain find_id(void *id)
for
(
tmp
=
dlload
;
tmp
;
tmp
=
tmp
->
next
)
for
(
tmp
=
dlload
;
tmp
;
tmp
=
tmp
->
next
)
if
(
id
==
tmp
->
id
)
if
(
id
==
tmp
->
id
)
return
(
tmp
)
;
return
tmp
;
return
(
NULL
)
;
return
NULL
;
}
}
/* load a dynamic-link library and return handle */
/* load a dynamic-link library and return handle */
void
*
dlopen
(
char
*
filename
,
int
flags
)
void
*
dlopen
(
char
*
filename
,
int
flags
)
{
{
HMODULE
hm
;
HMODULE
hm
;
DLLchain
tmp
;
DLLchain
tmp
;
...
@@ -85,10 +82,10 @@ void *dlopen (char *filename, int flags)
...
@@ -85,10 +82,10 @@ void *dlopen (char *filename, int flags)
if
(
!
tmp
)
if
(
!
tmp
)
{
{
tmp
=
(
DLLchain
)
malloc
(
sizeof
(
tDLLchain
));
tmp
=
(
DLLchain
)
malloc
(
sizeof
(
tDLLchain
));
if
(
!
tmp
)
if
(
!
tmp
)
goto
nomem
;
goto
nomem
;
tmp
->
name
=
strdup
(
filename
);
tmp
->
name
=
strdup
(
filename
);
tmp
->
next
=
dlload
;
tmp
->
next
=
dlload
;
set_chain
=
1
;
set_chain
=
1
;
}
}
...
@@ -97,14 +94,15 @@ void *dlopen (char *filename, int flags)
...
@@ -97,14 +94,15 @@ void *dlopen (char *filename, int flags)
{
{
case
NO_ERROR
:
case
NO_ERROR
:
tmp
->
handle
=
hm
;
tmp
->
handle
=
hm
;
if
(
set_chain
)
{
if
(
set_chain
)
do
{
{
do
last_id
++
;
last_id
++
;
}
while
((
last_id
==
0
)
||
(
find_id
(
last_id
)));
while
((
last_id
==
0
)
||
(
find_id
(
last_id
)));
tmp
->
id
=
last_id
;
tmp
->
id
=
last_id
;
dlload
=
tmp
;
dlload
=
tmp
;
}
}
return
(
tmp
->
id
)
;
return
tmp
->
id
;
case
ERROR_FILE_NOT_FOUND
:
case
ERROR_FILE_NOT_FOUND
:
case
ERROR_PATH_NOT_FOUND
:
case
ERROR_PATH_NOT_FOUND
:
errtxt
=
"module `%s' not found"
;
errtxt
=
"module `%s' not found"
;
...
@@ -145,34 +143,35 @@ nomem:
...
@@ -145,34 +143,35 @@ nomem:
errtxt
=
"cause `%s', error code = %d"
;
errtxt
=
"cause `%s', error code = %d"
;
break
;
break
;
}
}
snprintf
(
dlerr
,
sizeof
(
dlerr
),
errtxt
,
&
err
,
rc
);
snprintf
(
dlerr
,
sizeof
(
dlerr
),
errtxt
,
&
err
,
rc
);
if
(
tmp
)
{
if
(
tmp
)
{
if
(
tmp
->
name
)
if
(
tmp
->
name
)
free
(
tmp
->
name
);
free
(
tmp
->
name
);
free
(
tmp
);
free
(
tmp
);
}
}
return
(
0
)
;
return
0
;
}
}
/* return a pointer to the `symbol' in DLL */
/* return a pointer to the `symbol' in DLL */
void
*
dlsym
(
void
*
handle
,
char
*
symbol
)
void
*
dlsym
(
void
*
handle
,
char
*
symbol
)
{
{
int
rc
=
0
;
int
rc
=
0
;
PFN
addr
;
PFN
addr
;
char
*
errtxt
;
char
*
errtxt
;
int
symord
=
0
;
int
symord
=
0
;
DLLchain
tmp
=
find_id
(
handle
);
DLLchain
tmp
=
find_id
(
handle
);
if
(
!
tmp
)
if
(
!
tmp
)
goto
inv_handle
;
goto
inv_handle
;
if
(
*
symbol
==
'#'
)
if
(
*
symbol
==
'#'
)
symord
=
atoi
(
symbol
+
1
);
symord
=
atoi
(
symbol
+
1
);
switch
(
rc
=
DosQueryProcAddr
(
tmp
->
handle
,
symord
,
symbol
,
&
addr
))
switch
(
rc
=
DosQueryProcAddr
(
tmp
->
handle
,
symord
,
symbol
,
&
addr
))
{
{
case
NO_ERROR
:
case
NO_ERROR
:
return
(
(
void
*
)
addr
)
;
return
(
void
*
)
addr
;
case
ERROR_INVALID_HANDLE
:
case
ERROR_INVALID_HANDLE
:
inv_handle:
inv_handle:
errtxt
=
"invalid module handle"
;
errtxt
=
"invalid module handle"
;
...
@@ -185,40 +184,40 @@ inv_handle:
...
@@ -185,40 +184,40 @@ inv_handle:
errtxt
=
"symbol `%s', error code = %d"
;
errtxt
=
"symbol `%s', error code = %d"
;
break
;
break
;
}
}
snprintf
(
dlerr
,
sizeof
(
dlerr
),
errtxt
,
symbol
,
rc
);
snprintf
(
dlerr
,
sizeof
(
dlerr
),
errtxt
,
symbol
,
rc
);
return
(
NULL
)
;
return
NULL
;
}
}
/* free dynamicaly-linked library */
/* free dynamicaly-linked library */
int
dlclose
(
void
*
handle
)
int
dlclose
(
void
*
handle
)
{
{
int
rc
;
int
rc
;
DLLchain
tmp
=
find_id
(
handle
);
DLLchain
tmp
=
find_id
(
handle
);
if
(
!
tmp
)
if
(
!
tmp
)
goto
inv_handle
;
goto
inv_handle
;
switch
(
rc
=
DosFreeModule
(
tmp
->
handle
))
switch
(
rc
=
DosFreeModule
(
tmp
->
handle
))
{
{
case
NO_ERROR
:
case
NO_ERROR
:
free
(
tmp
->
name
);
free
(
tmp
->
name
);
dlload
=
tmp
->
next
;
dlload
=
tmp
->
next
;
free
(
tmp
);
free
(
tmp
);
return
(
0
)
;
return
0
;
case
ERROR_INVALID_HANDLE
:
case
ERROR_INVALID_HANDLE
:
inv_handle:
inv_handle:
strcpy
(
dlerr
,
"invalid module handle"
);
strcpy
(
dlerr
,
"invalid module handle"
);
return
(
-
1
)
;
return
-
1
;
case
ERROR_INVALID_ACCESS
:
case
ERROR_INVALID_ACCESS
:
strcpy
(
dlerr
,
"access denied"
);
strcpy
(
dlerr
,
"access denied"
);
return
(
-
1
)
;
return
-
1
;
default:
default:
return
(
-
1
)
;
return
-
1
;
}
}
}
}
/* return a string describing last occured dl error */
/* return a string describing last occured dl error */
char
*
dlerror
()
char
*
dlerror
()
{
{
return
(
dlerr
)
;
return
dlerr
;
}
}
PC/os2emx/dlfcn.h
Dosyayı görüntüle @
0c83348d
...
@@ -29,21 +29,22 @@ PERFORMANCE OF THIS SOFTWARE.
...
@@ -29,21 +29,22 @@ PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
******************************************************************/
/*
/* This library implements dlopen() - Unix-like dynamic linking
This library implements dlopen() - functions for OS/2 using
* emulation functions for OS/2 using DosLoadModule() and company.
DosLoadModule() and company.
*/
*/
#ifndef _DLFCN_H
#ifndef _DLFCN_H
#define _DLFCN_H
#define _DLFCN_H
/*-------------------------------------- Unix-like dynamic linking emulation -*/
/* load a dynamic-link library and return handle */
/* load a dynamic-link library and return handle */
void
*
dlopen
(
char
*
filename
,
int
flags
);
void
*
dlopen
(
char
*
filename
,
int
flags
);
/* return a pointer to the `symbol' in DLL */
/* return a pointer to the `symbol' in DLL */
void
*
dlsym
(
void
*
handle
,
char
*
symbol
);
void
*
dlsym
(
void
*
handle
,
char
*
symbol
);
/* free dynamicaly-linked library */
/* free dynamicaly-linked library */
int
dlclose
(
void
*
handle
);
int
dlclose
(
void
*
handle
);
/* return a string describing last occured dl error */
/* return a string describing last occured dl error */
char
*
dlerror
(
void
);
char
*
dlerror
(
void
);
...
...
PC/os2emx/dllentry.c
Dosyayı görüntüle @
0c83348d
/*
/*
This is the entry point for Python DLL(s).
* This is the entry point for the Python 2.3 core DLL.
It also provides an getenv() function that works from within DLLs.
*/
*/
#define NULL 0
#define NULL 0
/* Make references to imported symbols to pull them from static library */
#define REF(s) extern void s(); void *____ref_##s = &s;
#define REF(s) extern void s (); void *____ref_##s = &s;
REF
(
Py_Main
);
/* Make references to imported symbols to pull them from static library */
REF
(
Py_Main
);
#include <signal.h>
#include <signal.h>
extern
int
_CRT_init
(
void
);
extern
int
_CRT_init
(
void
);
extern
void
_CRT_term
(
void
);
extern
void
_CRT_term
(
void
);
extern
void
__ctordtorInit
(
void
);
extern
void
__ctordtorInit
(
void
);
extern
void
__ctordtorTerm
(
void
);
extern
void
__ctordtorTerm
(
void
);
unsigned
long
_DLL_InitTerm
(
unsigned
long
mod_handle
,
unsigned
long
flag
)
unsigned
long
_DLL_InitTerm
(
unsigned
long
mod_handle
,
unsigned
long
flag
)
{
{
switch
(
flag
)
switch
(
flag
)
{
{
case
0
:
case
0
:
if
(
_CRT_init
())
if
(
_CRT_init
())
return
0
;
return
0
;
__ctordtorInit
();
__ctordtorInit
();
/* Ignore fatal signals */
/* Ignore fatal signals */
signal
(
SIGSEGV
,
SIG_IGN
);
signal
(
SIGSEGV
,
SIG_IGN
);
signal
(
SIGFPE
,
SIG_IGN
);
signal
(
SIGFPE
,
SIG_IGN
);
return
1
;
return
1
;
case
1
:
case
1
:
__ctordtorTerm
();
__ctordtorTerm
();
_CRT_term
();
_CRT_term
();
return
1
;
return
1
;
default:
default:
...
...
PC/os2emx/getpathp.c
Dosyayı görüntüle @
0c83348d
...
@@ -94,9 +94,9 @@ is_sep(char ch) /* determine if "ch" is a separator character */
...
@@ -94,9 +94,9 @@ is_sep(char ch) /* determine if "ch" is a separator character */
#endif
#endif
}
}
/* assumes 'dir' null terminated in bounds.
Never writes
/* assumes 'dir' null terminated in bounds.
beyond existing terminator.
* Never writes
beyond existing terminator.
*/
*/
static
void
static
void
reduce
(
char
*
dir
)
reduce
(
char
*
dir
)
{
{
...
@@ -113,11 +113,12 @@ exists(char *filename)
...
@@ -113,11 +113,12 @@ exists(char *filename)
return
stat
(
filename
,
&
buf
)
==
0
;
return
stat
(
filename
,
&
buf
)
==
0
;
}
}
/* Assumes 'filename' MAXPATHLEN+1 bytes long -
/* Is module (check for .pyc/.pyo too)
may extend 'filename' by one character.
* Assumes 'filename' MAXPATHLEN+1 bytes long -
*/
* may extend 'filename' by one character.
*/
static
int
static
int
ismodule
(
char
*
filename
)
/* Is module -- check for .pyc/.pyo too */
ismodule
(
char
*
filename
)
{
{
if
(
exists
(
filename
))
if
(
exists
(
filename
))
return
1
;
return
1
;
...
@@ -151,9 +152,9 @@ join(char *buffer, char *stuff)
...
@@ -151,9 +152,9 @@ join(char *buffer, char *stuff)
}
}
/* gotlandmark only called by search_for_prefix, which ensures
/* gotlandmark only called by search_for_prefix, which ensures
'prefix' is null terminated in bounds. join() ensures
*
'prefix' is null terminated in bounds. join() ensures
'landmark' can not overflow prefix if too long.
*
'landmark' can not overflow prefix if too long.
*/
*/
static
int
static
int
gotlandmark
(
char
*
landmark
)
gotlandmark
(
char
*
landmark
)
{
{
...
@@ -167,7 +168,8 @@ gotlandmark(char *landmark)
...
@@ -167,7 +168,8 @@ gotlandmark(char *landmark)
}
}
/* assumes argv0_path is MAXPATHLEN+1 bytes long, already \0 term'd.
/* assumes argv0_path is MAXPATHLEN+1 bytes long, already \0 term'd.
assumption provided by only caller, calculate_path() */
* assumption provided by only caller, calculate_path()
*/
static
int
static
int
search_for_prefix
(
char
*
argv0_path
,
char
*
landmark
)
search_for_prefix
(
char
*
argv0_path
,
char
*
landmark
)
{
{
...
@@ -283,13 +285,13 @@ calculate_path(void)
...
@@ -283,13 +285,13 @@ calculate_path(void)
}
}
/* We need to construct a path from the following parts.
/* We need to construct a path from the following parts.
(1) the PYTHONPATH environment variable, if set;
*
(1) the PYTHONPATH environment variable, if set;
(2) the zip archive file path;
*
(2) the zip archive file path;
(3) the PYTHONPATH config macro, with the leading "."
*
(3) the PYTHONPATH config macro, with the leading "."
of each component replaced with pythonhome, if set;
*
of each component replaced with pythonhome, if set;
(4) the directory containing the executable (argv0_path).
*
(4) the directory containing the executable (argv0_path).
The length calculation calculates #3 first.
*
The length calculation calculates #3 first.
*/
*/
/* Calculate size of return buffer */
/* Calculate size of return buffer */
if
(
pythonhome
!=
NULL
)
{
if
(
pythonhome
!=
NULL
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment