bvl: Made some linebreak statments, and ifdef correction on behalf of the

OS/2 port


git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@748 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
bvl
2000-07-24 08:47:16 +00:00
parent c78576491e
commit 762df120f7
8 changed files with 715 additions and 700 deletions

View File

@@ -1,10 +1,10 @@
CCFLAGS=-O2 -c -I.. -I..\..\include -Zmtd -Zcrtdll -Zbin-files -D__ST_MT_ERRNO_ -I. -DOS2 -DHAVE_TERMIOS_H
CCFLAGS=-O2 -c -I.. -I..\..\include -I..\..\libgpio -Zmtd -Zcrtdll -Zbin-files -D__ST_MT_ERRNO_ -I. -DOS2 -DHAVE_TERMIOS_H
CC=gcc
all: ..\gpdirbrw.dll
..\..\obj\directory.o : directory.c directory.h
$(CC) -o $@ directory.c
$(CC) -o $@ directory.c $(CCFLAGS)
..\gpdirbrw.dll: ..\..\obj\directory.o
$(CC) -g -Wall -Zdll -Zcrtdll -o $@ $** directory.def -lwrap -Le:\emx\lib -lst\check -lgcc -LE:\NETLABS\GNOME\GPHOTO2\LIB -llibgphoto2 -llibgpio -ldl E:\NETLABS\GNOME\GPHOTO2\obj\interface.o -lpthreads -lpthrdrtl -lmt\c

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
CCFLAGS=-O2 -c -I.. -I..\..\include -Zmtd -Zcrtdll -Zbin-files -D__ST_MT_ERRNO_ -I. -DOS2 -DHAVE_TERMIOS_H
CCFLAGS=-O2 -c -I.. -I..\..\libgpio -I..\..\include -Zmtd -Zcrtdll -Zbin-files -D__ST_MT_ERRNO_ -I. -DOS2 -DHAVE_TERMIOS_H
CC=gcc
all: ..\..\gphoto2.exe
@@ -12,6 +12,5 @@ all: ..\..\gphoto2.exe
..\..\obj\test.o: test.c
$(CC) -o $@ $** $(CCFLAGS)
..\..\gphoto2.exe: ..\..\obj\interface.o ..\..\obj\main.o ..\..\obj\test.o ..\..\lib\libgphoto2.a ..\..\lib\libgpio.a
..\..\gphoto2.exe: ..\..\obj\interface.o ..\..\obj\script.o ..\..\obj\main.o ..\..\obj\test.o ..\..\lib\libgphoto2.a ..\..\lib\libgpio.a
$(CC) -O2 $** -o $@ -Zbin-files -Zcrtdll -Zmtd -s -Le:\emx\lib -L..\..\lib -llibgphoto2 -llibgpio -ldl -lpthreads -lpthrdrtl

View File

@@ -1,10 +1,11 @@
/* Header file for gPhoto 0.5-Dev
/* Header file for gPhoto 0.5-Dev
Author: Scott Fritzinger <scottf@unr.edu>
Author: Scott Fritzinger <scottf@unr.edu>
This library is covered by the LGPL.
This library is covered by the LGPL.
*/
#include <gpio.h>
#include <gphoto2-datatypes.h>
#include <gphoto2-core.h>
#include <gphoto2-library.h>

View File

@@ -1,8 +1,6 @@
#ifndef GPHOTO_OS2_INCLUDED
#define GPHOTO_OS2_INCLUDED
#define CAMLIBS getenv("CAMLIBS")
#define RTLD_LAZY 0x001
#define VERSION "2"
#endif

View File

@@ -11,190 +11,190 @@
int is_library(char *library_filename) {
char buf[1024];
void *lh;
char buf[1024];
void *lh;
#if defined(OS2) || defined(WINDOWS)
sprintf(buf, "%s/%s", CAMLIBS, library_filename);
#ifdef (OS2) || (WINDOWS)
sprintf(buf, "%s\\%s", CAMLIBS, library_filename);
#else
sprintf(buf, "%s/%s", CAMLIBS, library_filename);
sprintf(buf, "%s/%s", CAMLIBS, library_filename);
#endif
if ((lh = dlopen(buf, RTLD_LAZY))==NULL) {
if (glob_debug)
perror("core:\tis_library");
return (GP_ERROR);
}
dlclose(lh);
if ((lh = dlopen(buf, RTLD_LAZY))==NULL) {
if (glob_debug)
perror("core:\tis_library");
return (GP_ERROR);
}
return (GP_OK);
dlclose(lh);
return (GP_OK);
}
int load_library (char *camera_name) {
char buf[1024];
void *lh;
int x;
for (x=0; x<glob_camera_count; x++) {
if (strcmp(glob_camera[x].name, camera_name)==0) {
sprintf(buf, "%s/%s", CAMLIBS, glob_camera[x].library);
if ((lh = dlopen(buf, RTLD_LAZY))==NULL) {
if (glob_debug)
perror("core:\tload_library");
return (GP_ERROR);
}
glob_c.id = dlsym(lh, "camera_id");
glob_c.abilities = dlsym(lh, "camera_abilities");
glob_c.init = dlsym(lh, "camera_init");
glob_c.exit = dlsym(lh, "camera_exit");
glob_c.folder_list = dlsym(lh, "camera_folder_list");
glob_c.folder_set = dlsym(lh, "camera_folder_set");
glob_c.file_count = dlsym(lh, "camera_file_count");
glob_c.file_get = dlsym(lh, "camera_file_get");
glob_c.file_get_preview = dlsym(lh, "camera_file_get_preview");
glob_c.file_put = dlsym(lh, "camera_file_put");
glob_c.file_delete = dlsym(lh, "camera_file_delete");
glob_c.file_lock = dlsym(lh, "camera_file_lock");
glob_c.file_unlock = dlsym(lh, "camera_file_unlock");
glob_c.config_get = dlsym(lh, "camera_config_get");
glob_c.config_set = dlsym(lh, "camera_config_set");
glob_c.capture = dlsym(lh, "camera_capture");
glob_c.summary = dlsym(lh, "camera_summary");
glob_c.manual = dlsym(lh, "camera_manual");
glob_c.about = dlsym(lh, "camera_about");
glob_library_handle = lh;
char buf[1024];
void *lh;
int x;
for (x=0; x<glob_camera_count; x++) {
if (strcmp(glob_camera[x].name, camera_name)==0) {
sprintf(buf, "%s/%s", CAMLIBS, glob_camera[x].library);
if ((lh = dlopen(buf, RTLD_LAZY))==NULL) {
if (glob_debug)
perror("core:\tload_library");
return (GP_ERROR);
}
glob_c.id = dlsym(lh, "camera_id");
glob_c.abilities = dlsym(lh, "camera_abilities");
glob_c.init = dlsym(lh, "camera_init");
glob_c.exit = dlsym(lh, "camera_exit");
glob_c.folder_list = dlsym(lh, "camera_folder_list");
glob_c.folder_set = dlsym(lh, "camera_folder_set");
glob_c.file_count = dlsym(lh, "camera_file_count");
glob_c.file_get = dlsym(lh, "camera_file_get");
glob_c.file_get_preview = dlsym(lh, "camera_file_get_preview");
glob_c.file_put = dlsym(lh, "camera_file_put");
glob_c.file_delete = dlsym(lh, "camera_file_delete");
glob_c.file_lock = dlsym(lh, "camera_file_lock");
glob_c.file_unlock = dlsym(lh, "camera_file_unlock");
glob_c.config_get = dlsym(lh, "camera_config_get");
glob_c.config_set = dlsym(lh, "camera_config_set");
glob_c.capture = dlsym(lh, "camera_capture");
glob_c.summary = dlsym(lh, "camera_summary");
glob_c.manual = dlsym(lh, "camera_manual");
glob_c.about = dlsym(lh, "camera_about");
glob_library_handle = lh;
return (GP_OK);
}
}
return (GP_OK);
}
}
return (GP_ERROR);
return (GP_ERROR);
}
int load_camera_list (char *library_filename) {
/* Returns the number of cameras added to the CameraChoice list */
/* 0 implies an error occurred */
/* Returns the number of cameras added to the CameraChoice list */
/* 0 implies an error occurred */
char buf[1024], id[64];
void *lh;
c_abilities load_camera_abilities;
c_id load_camera_id;
int x, count;
char buf[1024], id[64];
void *lh;
c_abilities load_camera_abilities;
c_id load_camera_id;
int x, count;
sprintf(buf, "%s/%s", CAMLIBS, library_filename);
sprintf(buf, "%s/%s", CAMLIBS, library_filename);
/* try to open the library */
if ((lh = dlopen(buf, RTLD_LAZY))==NULL) {
if (glob_debug)
perror("core:\tload_camera_list");
return 0;
}
/* try to open the library */
if ((lh = dlopen(buf, RTLD_LAZY))==NULL) {
if (glob_debug)
perror("core:\tload_camera_list");
return 0;
}
/* check to see if this library has been loaded */
load_camera_id = dlsym(lh, "camera_id");
load_camera_id(id);
/* check to see if this library has been loaded */
load_camera_id = dlsym(lh, "camera_id");
load_camera_id(id);
if (glob_debug)
printf("core:\t library id: %s\n", id);
if (glob_debug)
printf("core:\t library id: %s\n", id);
for (x=0; x<glob_camera_id_count; x++) {
if (strcmp(glob_camera_id[x], id)==0) {
dlclose(lh);
return (GP_ERROR);
}
}
for (x=0; x<glob_camera_id_count; x++) {
if (strcmp(glob_camera_id[x], id)==0) {
dlclose(lh);
return (GP_ERROR);
}
}
strcpy(glob_camera_id[glob_camera_id_count], id);
glob_camera_id_count++;
strcpy(glob_camera_id[glob_camera_id_count], id);
glob_camera_id_count++;
/* load in the camera_abilities function */
gp_abilities_clear(&glob_camera_abilities[glob_camera_count]);
load_camera_abilities = dlsym(lh, "camera_abilities");
if (load_camera_abilities(&glob_camera_abilities[glob_camera_count],
&count) == GP_ERROR) {
dlclose(lh);
return 0;
}
/* load in the camera_abilities function */
gp_abilities_clear(&glob_camera_abilities[glob_camera_count]);
load_camera_abilities = dlsym(lh, "camera_abilities");
if (load_camera_abilities(&glob_camera_abilities[glob_camera_count],
&count) == GP_ERROR) {
dlclose(lh);
return 0;
}
if (glob_debug)
printf("core:\t camera model count: %i\n", count);
if (glob_debug)
printf("core:\t camera model count: %i\n", count);
/* Copy over the camera name */
for (x=glob_camera_count; x<glob_camera_count+count; x++) {
strcpy(glob_camera[x].name, glob_camera_abilities[x].model);
strcpy(glob_camera[x].library, library_filename);
if (glob_debug)
printf("core:\t camera model: %s\n", glob_camera[x].name);
}
/* Copy over the camera name */
for (x=glob_camera_count; x<glob_camera_count+count; x++) {
strcpy(glob_camera[x].name, glob_camera_abilities[x].model);
strcpy(glob_camera[x].library, library_filename);
if (glob_debug)
printf("core:\t camera model: %s\n", glob_camera[x].name);
}
glob_camera_count += count;
dlclose(lh);
glob_camera_count += count;
dlclose(lh);
return (x);
return (x);
}
int load_cameras() {
DIR *d;
CameraChoice t;
CameraAbilities a;
int x, y, z;
CameraChoice t;
CameraAbilities a;
int x, y, z;
struct dirent *de;
glob_camera_id_count = 0;
glob_camera_id_count = 0;
/* Look for available camera libraries */
/* Look for available camera libraries */
d = opendir(CAMLIBS);
if (!d) {
fprintf(stderr, "core: couldn't open %s\n", CAMLIBS);
return GP_ERROR;
}
if (!d) {
fprintf(stderr, "core: couldn't open %s\n", CAMLIBS);
return GP_ERROR;
}
do {
/* Read each entry */
de = readdir(d);
if (de) {
if (glob_debug)
printf("core:\tis %s a library? ", de->d_name);
if (glob_debug)
printf("core:\tis %s a library? ", de->d_name);
/* try to open the library */
if (is_library(de->d_name) == GP_OK) {
if (glob_debug)
printf("yes\n");
if (glob_debug)
printf("yes\n");
load_camera_list(de->d_name);
} else {
if (glob_debug)
printf("no\n");
if (glob_debug)
printf("no\n");
}
}
} while (de);
/* Sort the camera list */
for (x=0; x<glob_camera_count-1; x++) {
for (y=x+1; y<glob_camera_count; y++) {
z = strcmp(glob_camera[x].name, glob_camera[y].name);
if (z > 0) {
memcpy(&t, &glob_camera[x], sizeof(t));
memcpy(&glob_camera[x], &glob_camera[y], sizeof(t));
memcpy(&glob_camera[y], &t, sizeof(t));
/* Sort the camera list */
for (x=0; x<glob_camera_count-1; x++) {
for (y=x+1; y<glob_camera_count; y++) {
z = strcmp(glob_camera[x].name, glob_camera[y].name);
if (z > 0) {
memcpy(&t, &glob_camera[x], sizeof(t));
memcpy(&glob_camera[x], &glob_camera[y], sizeof(t));
memcpy(&glob_camera[y], &t, sizeof(t));
memcpy(&a, &glob_camera_abilities[x], sizeof(a));
memcpy(&glob_camera_abilities[x], &glob_camera_abilities[y],
sizeof(a));
memcpy(&glob_camera_abilities[y], &a, sizeof(a));
}
}
}
return (GP_OK);
memcpy(&a, &glob_camera_abilities[x], sizeof(t));
memcpy(&glob_camera_abilities[x], &glob_camera_abilities[y],
sizeof(t));
memcpy(&glob_camera_abilities[y], &a, sizeof(t));
}
}
}
return (GP_OK);
}
int close_library () {
dlclose(glob_library_handle);
dlclose(glob_library_handle);
return (GP_OK);
return (GP_OK);
}

View File

@@ -1,8 +1,9 @@
CCFLAGS=-O2 -c -I.. -I..\include -Zmtd -Zcrtdll -Zbin-files -D__ST_MT_ERRNO_ -I. -DOS2 -DHAVE_TERMIOS_H
CCFLAGS=-O2 -c -I.. -I..\include -I..\libgpio -Zmtd -Zcrtdll -Zbin-files -D__ST_MT_ERRNO_ -I. -DOS2 -DHAVE_TERMIOS_H
CC=gcc
MKLIB=ar r
all: ..\lib\libgphoto2.a
@echo enter libgphoto2
..\obj\core.o: core.c
$(CC) -o $@ $** $(CCFLAGS)

View File

@@ -11,10 +11,12 @@ all:
@cd libgphoto2
@nmake -nologo -f makefile.os2
@cd ..
@cd frontends\libgphoto2_frontend
@nmake -nologo -f makefile.os2
@cd ..\command-line
@nmake -nologo -f makefile.os2
@cd ..\..
@cd camlibs
@nmake -nologo -f makefile.os2
@cd ..
@cd frontends\command-line
@nmake -nologo -f makefile.os2
@cd ..\..
@echo Done