version 0.73.0
This commit is contained in:
@@ -0,0 +1,167 @@
|
||||
#
|
||||
# Makefile.in for the Tiny COBOL compiler runtime routines library
|
||||
#
|
||||
|
||||
#
|
||||
# Debug flags are set in htconfig.h
|
||||
# -DPICTURE_TESTING -DDEBUG_RTS
|
||||
#
|
||||
CCX=gcc
|
||||
ASM=as
|
||||
|
||||
INCLUDES=-I/usr/include -I/usr/local/include -I/usr/include/glibc -I/c/tcl/include -I../lib -I.. -I. -I/c/PostgreSQL/include
|
||||
|
||||
CCXFLAGS=${INCLUDES} -Wall
|
||||
|
||||
WRES=windres
|
||||
WRESFLAGS=-O coff
|
||||
|
||||
RANLIB=ranlib
|
||||
AR=ar
|
||||
|
||||
lib_dir=C:/TinyCOBOL
|
||||
|
||||
INSTRC=${lib_dir}
|
||||
RCFILE=htrtconf
|
||||
|
||||
INSTALL=install.exe
|
||||
INSTALL_DATA=${INSTALL}
|
||||
|
||||
MV = mv -f
|
||||
RM = rm -f
|
||||
LNK = ln -sf
|
||||
MKDIR = mkdir -p
|
||||
|
||||
#
|
||||
|
||||
LIBS1=-L/usr/local/lib -L/c/mingw/lib -lpdcurses
|
||||
LIBS2=-L/usr/local/lib /d/tinycobol/tcltk84/tcl84.dll /d/tinycobol/tcltk84/tk84.dll
|
||||
LIBS3=-L/usr/local/lib -L/c/PostgreSQL/lib -lpq
|
||||
|
||||
#
|
||||
# Default install directory is set in htconfig.h
|
||||
#
|
||||
|
||||
lib_version=0.73.0
|
||||
|
||||
lib_name1=tcroutines
|
||||
lib_name2=tctcl
|
||||
lib_name3=tcpgres
|
||||
|
||||
#
|
||||
# Libraries to build
|
||||
#
|
||||
STATIC_LIB1=lib${lib_name1}.a
|
||||
SHARED_LIB1=${lib_name1}.dll
|
||||
SHARED_LIB1A=${lib_name1}.dll.a
|
||||
|
||||
STATIC_LIB2=lib${lib_name2}.a
|
||||
SHARED_LIB2=${lib_name2}.dll
|
||||
SHARED_LIB2A=${lib_name2}.dll.a
|
||||
|
||||
STATIC_LIB3=lib${lib_name3}.a
|
||||
SHARED_LIB3=${lib_name3}.dll
|
||||
SHARED_LIB3A=${lib_name3}.dll.a
|
||||
|
||||
#
|
||||
# Sources list
|
||||
#
|
||||
SRC1 = screen.c dir.c files.c globals.c system.c
|
||||
OBJS1 = $(SRC1:.c=.o)
|
||||
|
||||
SRC2 = tctcl.c
|
||||
OBJS2 = $(SRC2:.c=.o)
|
||||
|
||||
SRC3 = sql_clear_query.c sql_connect_db.c sql_disconnect_db.c sql_exec_query.c \
|
||||
sql_free_memory.c sql_get_tuple.c sql_get_value.c sql_max_field.c sql_max_tuple.c sql_status_message.c
|
||||
OBJS3 = $(SRC3:.c=.o)
|
||||
|
||||
#
|
||||
# Rules for compiling .c .s sources
|
||||
#
|
||||
.SUFFIX: .c .o .lo
|
||||
.c.o:
|
||||
$(CCX) $(CCXFLAGS) -c $<
|
||||
|
||||
%.lo: %.c
|
||||
$(CCX) $(CCXFLAGS1) -c $< -o $@
|
||||
|
||||
#
|
||||
# Notes on building and using the shared htcobol library.
|
||||
# - The linker will try to use the shared libraries by default.
|
||||
# If not available it will try to use the static libraries.
|
||||
# - When linking with a shared htcobol library, all other libraries must be
|
||||
# named, whether they are used in the cobol program or not.
|
||||
# (i.e. -lncurses -ldb)
|
||||
# - To run a cobol program built with a shared htcobol library, and the
|
||||
# htcobol library is not installed in one of the standard locations, use
|
||||
# the $LD_LIBRARY_PATH environmental variable to add this path.
|
||||
# (i.e. export LD_LIBRARY_PATH=this path:$LD_LIBRARY_PATH )
|
||||
# - For testing purposes, it is recommended that only a static htcobol library
|
||||
# be used, since gdb will not work properly with shared libraries.
|
||||
#
|
||||
|
||||
all: static-libs
|
||||
devel: static-libs shared-libs
|
||||
|
||||
static-libs: ${STATIC_LIB1} ${STATIC_LIB2} ${STATIC_LIB3}
|
||||
shared-libs: ${SHARED_LIB1} ${SHARED_LIB2} ${SHARED_LIB3}
|
||||
|
||||
#
|
||||
# Rules for building the static libraries
|
||||
#
|
||||
${STATIC_LIB1}: ${OBJS1}
|
||||
${AR} cr ${STATIC_LIB1} ${OBJS1}
|
||||
${RANLIB} ${STATIC_LIB1}
|
||||
|
||||
${STATIC_LIB2}: ${OBJS2}
|
||||
${AR} cr ${STATIC_LIB2} ${OBJS2}
|
||||
${RANLIB} ${STATIC_LIB2}
|
||||
|
||||
${STATIC_LIB3}: ${OBJS3}
|
||||
${AR} cr ${STATIC_LIB3} ${OBJS3}
|
||||
${RANLIB} ${STATIC_LIB3}
|
||||
|
||||
#
|
||||
# Rules for building the shared libraries
|
||||
#
|
||||
${SHARED_LIB1}: ${OBJS1}
|
||||
${CCX} -shared -Wl,--out-implib,${lib_name1}.dll.a,--output-def,${lib_name1}.def -o ${SHARED_LIB1} $(OBJS1) ${LIBS1}
|
||||
|
||||
${SHARED_LIB2}: ${OBJS2}
|
||||
${CCX} -shared -Wl,--out-implib,${lib_name2}.dll.a,--output-def,${lib_name2}.def -o ${SHARED_LIB2} $(OBJS2) ${LIBS2}
|
||||
|
||||
${SHARED_LIB3}: ${OBJS3}
|
||||
${CCX} -shared -Wl,--out-implib,${lib_name3}.dll.a,--output-def,${lib_name3}.def -o ${SHARED_LIB3} $(OBJS3) ${LIBS3}
|
||||
|
||||
#
|
||||
# Rule for cleaning
|
||||
#
|
||||
clean:
|
||||
@${RM} ${OBJS1} ${OBJS2} ${OBJS3} \
|
||||
${STATIC_LIB1} ${SHARED_LIB1} ${SHARED_LIB1A} \
|
||||
${STATIC_LIB2} ${SHARED_LIB2} ${SHARED_LIB2A} \
|
||||
${STATIC_LIB3} ${SHARED_LIB3} ${SHARED_LIB3A} \
|
||||
core *.bak *.o *.lo
|
||||
|
||||
#
|
||||
# Rule for installing
|
||||
#
|
||||
install: install-dir install-static install-shared
|
||||
|
||||
install-static: ${STATIC_LIB1} ${STATIC_LIB2} ${STATIC_LIB3}
|
||||
# ${INSTALL} ${STATIC_LIB1} ${lib_dir}/${STATIC_LIB1}
|
||||
# ${INSTALL} ${STATIC_LIB2} ${lib_dir}/${STATIC_LIB2}
|
||||
# ${INSTALL} ${STATIC_LIB3} ${lib_dir}/${STATIC_LIB3}
|
||||
|
||||
install-shared: ${SHARED_LIB1} ${SHARED_LIB2} ${SHARED_LIB3}
|
||||
${INSTALL} ${SHARED_LIB1} ${lib_dir}/${SHARED_LIB1}
|
||||
${INSTALL} ${SHARED_LIB2} ${lib_dir}/${SHARED_LIB2}
|
||||
${INSTALL} ${SHARED_LIB3} ${lib_dir}/${SHARED_LIB3}
|
||||
# ${INSTALL} ${SHARED_LIB1A} ${lib_dir}/${SHARED_LIB1A}
|
||||
# ${INSTALL} ${SHARED_LIB2A} ${lib_dir}/${SHARED_LIB2A}
|
||||
# ${INSTALL} ${SHARED_LIB3A} ${lib_dir}/${SHARED_LIB3A}
|
||||
|
||||
install-dir:
|
||||
$(MKDIR) $(INSTRC)
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
#
|
||||
# Makefile.in for the Tiny COBOL compiler runtime routines library
|
||||
#
|
||||
|
||||
#
|
||||
# Debug flags are set in htconfig.h
|
||||
# -DPICTURE_TESTING -DDEBUG_RTS
|
||||
#
|
||||
CCX=gcc
|
||||
ASM=as
|
||||
|
||||
INCLUDES=-I/usr/include -I/usr/local/include -I/usr/include/glibc -I/c/tcl/include -I../lib -I.. -I. -I/c/PostgreSQL/include
|
||||
|
||||
CCXFLAGS=${INCLUDES} -Wall
|
||||
|
||||
WRES=windres
|
||||
WRESFLAGS=-O coff
|
||||
|
||||
RANLIB=ranlib
|
||||
AR=ar
|
||||
|
||||
lib_dir=@install_dir@
|
||||
|
||||
INSTRC=${lib_dir}
|
||||
RCFILE=htrtconf
|
||||
|
||||
INSTALL=install.exe
|
||||
INSTALL_DATA=${INSTALL}
|
||||
|
||||
MV = mv -f
|
||||
RM = rm -f
|
||||
LNK = ln -sf
|
||||
MKDIR = mkdir -p
|
||||
|
||||
#
|
||||
|
||||
LIBS1=-L/usr/local/lib -L/c/mingw/lib -lcurses
|
||||
LIBS2=-L/usr/local/lib /e/tinycobol/tcltk84/tcl84.dll /e/tinycobol/tcltk84/tk84.dll
|
||||
LIBS3=-L/usr/local/lib -L/c/PostgreSQL/lib -lpq
|
||||
|
||||
#
|
||||
# Default install directory is set in htconfig.h
|
||||
#
|
||||
|
||||
lib_version=@tcob_version@
|
||||
|
||||
lib_name1=tcroutines
|
||||
lib_name2=tctcl
|
||||
lib_name3=tcpgres
|
||||
|
||||
#
|
||||
# Libraries to build
|
||||
#
|
||||
STATIC_LIB1=lib${lib_name1}.a
|
||||
SHARED_LIB1=${lib_name1}.dll
|
||||
SHARED_LIB1A=${lib_name1}.dll.a
|
||||
|
||||
STATIC_LIB2=lib${lib_name2}.a
|
||||
SHARED_LIB2=${lib_name2}.dll
|
||||
SHARED_LIB2A=${lib_name2}.dll.a
|
||||
|
||||
STATIC_LIB3=lib${lib_name3}.a
|
||||
SHARED_LIB3=${lib_name3}.dll
|
||||
SHARED_LIB3A=${lib_name3}.dll.a
|
||||
|
||||
#
|
||||
# Sources list
|
||||
#
|
||||
SRC1 = screen.c dir.c files.c globals.c system.c
|
||||
OBJS1 = $(SRC1:.c=.o)
|
||||
|
||||
SRC2 = tctcl.c
|
||||
OBJS2 = $(SRC2:.c=.o)
|
||||
|
||||
SRC3 = sql_clear_query.c sql_connect_db.c sql_disconnect_db.c sql_exec_query.c \
|
||||
sql_free_memory.c sql_get_tuple.c sql_get_value.c sql_max_field.c sql_max_tuple.c sql_status_message.c
|
||||
OBJS3 = $(SRC3:.c=.o)
|
||||
|
||||
#
|
||||
# Rules for compiling .c .s sources
|
||||
#
|
||||
.SUFFIX: .c .o .lo
|
||||
.c.o:
|
||||
$(CCX) $(CCXFLAGS) -c $<
|
||||
|
||||
%.lo: %.c
|
||||
$(CCX) $(CCXFLAGS1) -c $< -o $@
|
||||
|
||||
#
|
||||
# Notes on building and using the shared htcobol library.
|
||||
# - The linker will try to use the shared libraries by default.
|
||||
# If not available it will try to use the static libraries.
|
||||
# - When linking with a shared htcobol library, all other libraries must be
|
||||
# named, whether they are used in the cobol program or not.
|
||||
# (i.e. -lncurses -ldb)
|
||||
# - To run a cobol program built with a shared htcobol library, and the
|
||||
# htcobol library is not installed in one of the standard locations, use
|
||||
# the $LD_LIBRARY_PATH environmental variable to add this path.
|
||||
# (i.e. export LD_LIBRARY_PATH=this path:$LD_LIBRARY_PATH )
|
||||
# - For testing purposes, it is recommended that only a static htcobol library
|
||||
# be used, since gdb will not work properly with shared libraries.
|
||||
#
|
||||
|
||||
all: static-libs
|
||||
devel: static-libs shared-libs
|
||||
|
||||
static-libs: ${STATIC_LIB1} ${STATIC_LIB2} ${STATIC_LIB3}
|
||||
shared-libs: ${SHARED_LIB1} ${SHARED_LIB2} ${SHARED_LIB3}
|
||||
|
||||
#
|
||||
# Rules for building the static libraries
|
||||
#
|
||||
${STATIC_LIB1}: ${OBJS1}
|
||||
${AR} cr ${STATIC_LIB1} ${OBJS1}
|
||||
${RANLIB} ${STATIC_LIB1}
|
||||
|
||||
${STATIC_LIB2}: ${OBJS2}
|
||||
${AR} cr ${STATIC_LIB2} ${OBJS2}
|
||||
${RANLIB} ${STATIC_LIB2}
|
||||
|
||||
${STATIC_LIB3}: ${OBJS3}
|
||||
${AR} cr ${STATIC_LIB3} ${OBJS3}
|
||||
${RANLIB} ${STATIC_LIB3}
|
||||
|
||||
#
|
||||
# Rules for building the shared libraries
|
||||
#
|
||||
${SHARED_LIB1}: ${OBJS1}
|
||||
${CCX} -shared -Wl,--out-implib,${lib_name1}.dll.a,--output-def,${lib_name1}.def -o ${SHARED_LIB1} $(OBJS1) ${LIBS1}
|
||||
|
||||
${SHARED_LIB2}: ${OBJS2}
|
||||
${CCX} -shared -Wl,--out-implib,${lib_name2}.dll.a,--output-def,${lib_name2}.def -o ${SHARED_LIB2} $(OBJS2) ${LIBS2}
|
||||
|
||||
${SHARED_LIB3}: ${OBJS3}
|
||||
${CCX} -shared -Wl,--out-implib,${lib_name3}.dll.a,--output-def,${lib_name3}.def -o ${SHARED_LIB3} $(OBJS3) ${LIBS3}
|
||||
|
||||
#
|
||||
# Rule for cleaning
|
||||
#
|
||||
clean:
|
||||
@${RM} ${OBJS1} ${OBJS2} ${OBJS3} \
|
||||
${STATIC_LIB1} ${SHARED_LIB1} ${SHARED_LIB1A} \
|
||||
${STATIC_LIB2} ${SHARED_LIB2} ${SHARED_LIB2A} \
|
||||
${STATIC_LIB3} ${SHARED_LIB3} ${SHARED_LIB3A} \
|
||||
core *.bak *.o *.lo
|
||||
|
||||
#
|
||||
# Rule for installing
|
||||
#
|
||||
install: install-dir install-static install-shared
|
||||
|
||||
install-static: ${STATIC_LIB1} ${STATIC_LIB2} ${STATIC_LIB3}
|
||||
# ${INSTALL} ${STATIC_LIB1} ${lib_dir}/${STATIC_LIB1}
|
||||
# ${INSTALL} ${STATIC_LIB2} ${lib_dir}/${STATIC_LIB2}
|
||||
# ${INSTALL} ${STATIC_LIB3} ${lib_dir}/${STATIC_LIB3}
|
||||
|
||||
install-shared: ${SHARED_LIB1} ${SHARED_LIB2} ${SHARED_LIB3}
|
||||
${INSTALL} ${SHARED_LIB1} ${lib_dir}/${SHARED_LIB1}
|
||||
${INSTALL} ${SHARED_LIB2} ${lib_dir}/${SHARED_LIB2}
|
||||
${INSTALL} ${SHARED_LIB3} ${lib_dir}/${SHARED_LIB3}
|
||||
# ${INSTALL} ${SHARED_LIB1A} ${lib_dir}/${SHARED_LIB1A}
|
||||
# ${INSTALL} ${SHARED_LIB2A} ${lib_dir}/${SHARED_LIB2A}
|
||||
# ${INSTALL} ${SHARED_LIB3A} ${lib_dir}/${SHARED_LIB3A}
|
||||
|
||||
install-dir:
|
||||
$(MKDIR) $(INSTRC)
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
COB Routines STATUS file
|
||||
------------------------
|
||||
|
||||
At this moment we have the following routines implemented:
|
||||
|
||||
- cbl_change_dir
|
||||
- cbl_check_file_exist
|
||||
- cbl_clear_scr
|
||||
- cbl_close_file
|
||||
- cbl_copy_file
|
||||
- cbl_create_dir
|
||||
- cbl_create_file
|
||||
- cbl_delete_dir
|
||||
- cbl_delete_file
|
||||
- cbl_flush_file
|
||||
- cbl_get_csr_pos
|
||||
- cbl_get_current_dir
|
||||
- cbl_get_kbd_status
|
||||
- cbl_get_os_info
|
||||
- cbl_open_file
|
||||
- cbl_read_file
|
||||
- cbl_read_kbd_char
|
||||
- cbl_read_scr_attrs
|
||||
- cbl_read_scr_chars
|
||||
- cbl_read_scr_chattrs
|
||||
- cbl_rename_file
|
||||
- cbl_set_csr_pos
|
||||
- cbl_toupper
|
||||
- cbl_tolower
|
||||
- cbl_write_file
|
||||
- cbl_write_scr_attrs
|
||||
- cbl_write_scr_chars
|
||||
- cbl_write_scr_chattrs
|
||||
|
||||
At this moment this routines below its not implemented.
|
||||
|
||||
- cbl_abort_run_unit
|
||||
- cbl_alloc_dyn_mem
|
||||
- cbl_alloc_mem
|
||||
- cbl_alloc_thread_mem
|
||||
- cbl_and
|
||||
- cbl_cancel_proc
|
||||
- cbl_close_vfile
|
||||
- cbl_debugbreak
|
||||
- cbl_eq
|
||||
- cbl_error_proc
|
||||
- cbl_event_clear
|
||||
- cbl_event_close
|
||||
- cbl_event_open_intra
|
||||
- cbl_event_post
|
||||
- cbl_event_wait
|
||||
- cbl_exec_run_unit
|
||||
- cbl_filename_convert
|
||||
- cbl_filename_max_length
|
||||
- cbl_free_dyn_mem
|
||||
- cbl_free_mem
|
||||
- cbl_free_record_lock
|
||||
- cbl_free_shmem
|
||||
- cbl_free_thread_mem
|
||||
- cbl_get_exit_info
|
||||
- cbl_get_mouse_mask
|
||||
- cbl_get_mouse_position
|
||||
- cbl_get_mouse_status
|
||||
- cbl_get_program_info
|
||||
- cbl_get_record_lock
|
||||
- cbl_get_scr_line_draw
|
||||
- cbl_get_scr_size
|
||||
- cbl_get_shmem_ptr
|
||||
- cbl_hide_mouse
|
||||
- cbl_imp
|
||||
- cbl_init_mouse
|
||||
- cbl_join_filename
|
||||
- cbl_locate_file
|
||||
- cbl_monitor_browse
|
||||
- cbl_monitor_browse_to_read
|
||||
- cbl_monitor_browse_to_write
|
||||
- cbl_monitor_close
|
||||
- cbl_monitor_open_intra
|
||||
- cbl_monitor_read
|
||||
- cbl_monitor_release
|
||||
- cbl_monitor_unbrowse
|
||||
- cbl_monitor_unread
|
||||
- cbl_monitor_write
|
||||
- cbl_monitor_write_to_browse
|
||||
- cbl_monitor_acquire
|
||||
- cbl_mutex_acquire
|
||||
- cbl_mutex_close
|
||||
- cbl_mutex_open_intra
|
||||
- cbl_mutex_release
|
||||
- cbl_nls_close_msg_file
|
||||
- cbl_nls_compare
|
||||
- cbl_nls_info
|
||||
- cbl_nls_open_msg_file
|
||||
- cbl_nls_read_msg
|
||||
- cbl_not
|
||||
- cbl_open_vfile
|
||||
- cbl_or
|
||||
- cbl_put_shmem_ptr
|
||||
- cbl_read_mouse_event
|
||||
- cbl_read_vfile
|
||||
- cbl_scr_allocate_color
|
||||
- cbl_scr_allocate_vc_color
|
||||
- cbl_scr_create_vc
|
||||
- cbl_scr_destroy_vc
|
||||
- cbl_scr_get_attr_info
|
||||
- cbl_scr_get_attributes
|
||||
- cbl_scr_name_to_rgb
|
||||
- cbl_scr_query_colormap
|
||||
- cbl_scr_restore_attributes
|
||||
- cbl_scr_save_attributes
|
||||
- cbl_scr_set_attributes
|
||||
- cbl_scr_set_pc_attributes
|
||||
- cbl_semaphore_acquire
|
||||
- cbl_semaphore_close
|
||||
- cbl_semaphore_open_intra
|
||||
- cbl_semaphore_release
|
||||
- cbl_set_mouse_mask
|
||||
- cbl_show_mouse
|
||||
- cbl_split_filename
|
||||
- cbl_subsystem
|
||||
- cbl_swap_scr_chattrs
|
||||
- cbl_term_mouse
|
||||
- cbl_test_record_lock
|
||||
- cbl_thread_create
|
||||
- cbl_thread_create_p
|
||||
- cbl_thread_detach
|
||||
- cbl_thread_exit
|
||||
- cbl_thread_iddata_alloc
|
||||
- cbl_thread_iddata_get
|
||||
- cbl_thread_kill
|
||||
- cbl_thread_list_end
|
||||
- cbl_thread_list_next
|
||||
- cbl_thread_list_start
|
||||
- cbl_thread_lock
|
||||
- cbl_thread_prog_lock
|
||||
- cbl_thread_prog_unlock
|
||||
- cbl_thread_resume
|
||||
- cbl_thread_self
|
||||
- cbl_thread_sleep
|
||||
- cbl_thread_suspend
|
||||
- cbl_thread_unlock
|
||||
- cbl_thread_wait
|
||||
- cbl_thread_yield
|
||||
- cbl_tstore_get
|
||||
- cbl_write_scr_chars_attr
|
||||
- cbl_write_scr_n_attr
|
||||
- cbl_write_scr_n_char
|
||||
- cbl_write_scr_n_chattr
|
||||
- cbl_write_scr_tty
|
||||
- cbl_write_vfile
|
||||
- cbl_xor
|
||||
- cbl_yield_run_unit
|
||||
- mf_client_state_allocate
|
||||
- mf_client_state_delete
|
||||
- mf_client_state_expiry
|
||||
- mf_client_state_file
|
||||
- mf_client_state_purge
|
||||
- mf_client_state_restore
|
||||
- mf_client_state_save
|
||||
- pc_find_drives
|
||||
- pc_print_file
|
||||
- pc_printer_close
|
||||
- pc_printer_control
|
||||
- pc_printer_default_font
|
||||
- pc_printer_default_name
|
||||
- pc_printer_default_properties
|
||||
- pc_printer_free_bmp
|
||||
- pc_printer_get_color
|
||||
- pc_printer_get_font
|
||||
- pc_printer_info
|
||||
- pc_printer_load_bmp
|
||||
- pc_printer_open
|
||||
- pc_printer_redirection_proc
|
||||
- pc_printer_set_color
|
||||
- pc_printer_set_default
|
||||
- pc_printer_set_font
|
||||
- pc_printer_write
|
||||
- pc_printer_write_bmp
|
||||
- pc_read_drive
|
||||
- pc_win_char_to_oem
|
||||
- pc_win_init
|
||||
- pc_win_oem_to_char
|
||||
- x"91" function 11.
|
||||
- x"91" function 12.
|
||||
- x"91" function 13.
|
||||
- x"91" function 14.
|
||||
- x"91" function 15.
|
||||
- x"91" function 16.
|
||||
- x"91" function 35.
|
||||
- x"91" function 46.
|
||||
- x"91" function 47.
|
||||
- x"91" function 48.
|
||||
- x"91" function 49.
|
||||
- x"91" function 69.
|
||||
- x"A7" function 6/7.
|
||||
- x"A7" function 16.
|
||||
- x"A7" function 17.
|
||||
- x"A7" function 18.
|
||||
- x"A7" function 20/21.
|
||||
- x"A7" function 25.
|
||||
- x"AF" function 1.
|
||||
- x"AF" function 18.
|
||||
- x"AF" function 22.
|
||||
- x"AF" function 26.
|
||||
- x"B0" function 0.
|
||||
- x"B0" function 2.
|
||||
- x"B0" function 4.
|
||||
- x"E5".
|
||||
- x"F4".
|
||||
- x"F5".
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,677 @@
|
||||
/*
|
||||
* $XConsortium: X.h,v 1.66 88/09/06 15:55:56 jim Exp $
|
||||
*/
|
||||
|
||||
/* Definitions for the X window system likely to be used by applications */
|
||||
|
||||
#ifndef X_H
|
||||
#define X_H
|
||||
|
||||
/***********************************************************
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
|
||||
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the names of Digital or MIT not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
#define X_PROTOCOL 11 /* current protocol version */
|
||||
#define X_PROTOCOL_REVISION 0 /* current minor version */
|
||||
|
||||
#if defined(MAC_OSX_TK)
|
||||
# define Cursor XCursor
|
||||
# define Region XRegion
|
||||
#endif
|
||||
|
||||
/* Resources */
|
||||
|
||||
#ifdef _WIN64
|
||||
typedef __int64 XID;
|
||||
#else
|
||||
typedef unsigned long XID;
|
||||
#endif
|
||||
|
||||
typedef XID Window;
|
||||
typedef XID Drawable;
|
||||
typedef XID Font;
|
||||
typedef XID Pixmap;
|
||||
typedef XID Cursor;
|
||||
typedef XID Colormap;
|
||||
typedef XID GContext;
|
||||
typedef XID KeySym;
|
||||
|
||||
typedef unsigned long Mask;
|
||||
|
||||
typedef unsigned long Atom;
|
||||
|
||||
typedef unsigned long VisualID;
|
||||
|
||||
typedef unsigned long Time;
|
||||
|
||||
typedef unsigned long KeyCode; /* In order to use IME, the Macintosh needs
|
||||
* to pack 3 bytes into the keyCode field in
|
||||
* the XEvent. In the real X.h, a KeyCode is
|
||||
* defined as a short, which wouldn't be big
|
||||
* enough. */
|
||||
|
||||
/*****************************************************************
|
||||
* RESERVED RESOURCE AND CONSTANT DEFINITIONS
|
||||
*****************************************************************/
|
||||
|
||||
#define None 0L /* universal null resource or null atom */
|
||||
|
||||
#define ParentRelative 1L /* background pixmap in CreateWindow
|
||||
and ChangeWindowAttributes */
|
||||
|
||||
#define CopyFromParent 0L /* border pixmap in CreateWindow
|
||||
and ChangeWindowAttributes
|
||||
special VisualID and special window
|
||||
class passed to CreateWindow */
|
||||
|
||||
#define PointerWindow 0L /* destination window in SendEvent */
|
||||
#define InputFocus 1L /* destination window in SendEvent */
|
||||
|
||||
#define PointerRoot 1L /* focus window in SetInputFocus */
|
||||
|
||||
#define AnyPropertyType 0L /* special Atom, passed to GetProperty */
|
||||
|
||||
#define AnyKey 0L /* special Key Code, passed to GrabKey */
|
||||
|
||||
#define AnyButton 0L /* special Button Code, passed to GrabButton */
|
||||
|
||||
#define AllTemporary 0L /* special Resource ID passed to KillClient */
|
||||
|
||||
#define CurrentTime 0L /* special Time */
|
||||
|
||||
#define NoSymbol 0L /* special KeySym */
|
||||
|
||||
/*****************************************************************
|
||||
* EVENT DEFINITIONS
|
||||
*****************************************************************/
|
||||
|
||||
/* Input Event Masks. Used as event-mask window attribute and as arguments
|
||||
to Grab requests. Not to be confused with event names. */
|
||||
|
||||
#define NoEventMask 0L
|
||||
#define KeyPressMask (1L<<0)
|
||||
#define KeyReleaseMask (1L<<1)
|
||||
#define ButtonPressMask (1L<<2)
|
||||
#define ButtonReleaseMask (1L<<3)
|
||||
#define EnterWindowMask (1L<<4)
|
||||
#define LeaveWindowMask (1L<<5)
|
||||
#define PointerMotionMask (1L<<6)
|
||||
#define PointerMotionHintMask (1L<<7)
|
||||
#define Button1MotionMask (1L<<8)
|
||||
#define Button2MotionMask (1L<<9)
|
||||
#define Button3MotionMask (1L<<10)
|
||||
#define Button4MotionMask (1L<<11)
|
||||
#define Button5MotionMask (1L<<12)
|
||||
#define ButtonMotionMask (1L<<13)
|
||||
#define KeymapStateMask (1L<<14)
|
||||
#define ExposureMask (1L<<15)
|
||||
#define VisibilityChangeMask (1L<<16)
|
||||
#define StructureNotifyMask (1L<<17)
|
||||
#define ResizeRedirectMask (1L<<18)
|
||||
#define SubstructureNotifyMask (1L<<19)
|
||||
#define SubstructureRedirectMask (1L<<20)
|
||||
#define FocusChangeMask (1L<<21)
|
||||
#define PropertyChangeMask (1L<<22)
|
||||
#define ColormapChangeMask (1L<<23)
|
||||
#define OwnerGrabButtonMask (1L<<24)
|
||||
|
||||
/* Event names. Used in "type" field in XEvent structures. Not to be
|
||||
confused with event masks above. They start from 2 because 0 and 1
|
||||
are reserved in the protocol for errors and replies. */
|
||||
|
||||
#define KeyPress 2
|
||||
#define KeyRelease 3
|
||||
#define ButtonPress 4
|
||||
#define ButtonRelease 5
|
||||
#define MotionNotify 6
|
||||
#define EnterNotify 7
|
||||
#define LeaveNotify 8
|
||||
#define FocusIn 9
|
||||
#define FocusOut 10
|
||||
#define KeymapNotify 11
|
||||
#define Expose 12
|
||||
#define GraphicsExpose 13
|
||||
#define NoExpose 14
|
||||
#define VisibilityNotify 15
|
||||
#define CreateNotify 16
|
||||
#define DestroyNotify 17
|
||||
#define UnmapNotify 18
|
||||
#define MapNotify 19
|
||||
#define MapRequest 20
|
||||
#define ReparentNotify 21
|
||||
#define ConfigureNotify 22
|
||||
#define ConfigureRequest 23
|
||||
#define GravityNotify 24
|
||||
#define ResizeRequest 25
|
||||
#define CirculateNotify 26
|
||||
#define CirculateRequest 27
|
||||
#define PropertyNotify 28
|
||||
#define SelectionClear 29
|
||||
#define SelectionRequest 30
|
||||
#define SelectionNotify 31
|
||||
#define ColormapNotify 32
|
||||
#define ClientMessage 33
|
||||
#define MappingNotify 34
|
||||
#define LASTEvent 35 /* must be bigger than any event # */
|
||||
|
||||
|
||||
/* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
|
||||
state in various key-, mouse-, and button-related events. */
|
||||
|
||||
#define ShiftMask (1<<0)
|
||||
#define LockMask (1<<1)
|
||||
#define ControlMask (1<<2)
|
||||
#define Mod1Mask (1<<3)
|
||||
#define Mod2Mask (1<<4)
|
||||
#define Mod3Mask (1<<5)
|
||||
#define Mod4Mask (1<<6)
|
||||
#define Mod5Mask (1<<7)
|
||||
|
||||
/* modifier names. Used to build a SetModifierMapping request or
|
||||
to read a GetModifierMapping request. These correspond to the
|
||||
masks defined above. */
|
||||
#define ShiftMapIndex 0
|
||||
#define LockMapIndex 1
|
||||
#define ControlMapIndex 2
|
||||
#define Mod1MapIndex 3
|
||||
#define Mod2MapIndex 4
|
||||
#define Mod3MapIndex 5
|
||||
#define Mod4MapIndex 6
|
||||
#define Mod5MapIndex 7
|
||||
|
||||
|
||||
/* button masks. Used in same manner as Key masks above. Not to be confused
|
||||
with button names below. */
|
||||
|
||||
#define Button1Mask (1<<8)
|
||||
#define Button2Mask (1<<9)
|
||||
#define Button3Mask (1<<10)
|
||||
#define Button4Mask (1<<11)
|
||||
#define Button5Mask (1<<12)
|
||||
|
||||
#define AnyModifier (1<<15) /* used in GrabButton, GrabKey */
|
||||
|
||||
|
||||
/* button names. Used as arguments to GrabButton and as detail in ButtonPress
|
||||
and ButtonRelease events. Not to be confused with button masks above.
|
||||
Note that 0 is already defined above as "AnyButton". */
|
||||
|
||||
#define Button1 1
|
||||
#define Button2 2
|
||||
#define Button3 3
|
||||
#define Button4 4
|
||||
#define Button5 5
|
||||
|
||||
/* Notify modes */
|
||||
|
||||
#define NotifyNormal 0
|
||||
#define NotifyGrab 1
|
||||
#define NotifyUngrab 2
|
||||
#define NotifyWhileGrabbed 3
|
||||
|
||||
#define NotifyHint 1 /* for MotionNotify events */
|
||||
|
||||
/* Notify detail */
|
||||
|
||||
#define NotifyAncestor 0
|
||||
#define NotifyVirtual 1
|
||||
#define NotifyInferior 2
|
||||
#define NotifyNonlinear 3
|
||||
#define NotifyNonlinearVirtual 4
|
||||
#define NotifyPointer 5
|
||||
#define NotifyPointerRoot 6
|
||||
#define NotifyDetailNone 7
|
||||
|
||||
/* Visibility notify */
|
||||
|
||||
#define VisibilityUnobscured 0
|
||||
#define VisibilityPartiallyObscured 1
|
||||
#define VisibilityFullyObscured 2
|
||||
|
||||
/* Circulation request */
|
||||
|
||||
#define PlaceOnTop 0
|
||||
#define PlaceOnBottom 1
|
||||
|
||||
/* protocol families */
|
||||
|
||||
#define FamilyInternet 0
|
||||
#define FamilyDECnet 1
|
||||
#define FamilyChaos 2
|
||||
|
||||
/* Property notification */
|
||||
|
||||
#define PropertyNewValue 0
|
||||
#define PropertyDelete 1
|
||||
|
||||
/* Color Map notification */
|
||||
|
||||
#define ColormapUninstalled 0
|
||||
#define ColormapInstalled 1
|
||||
|
||||
/* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */
|
||||
|
||||
#define GrabModeSync 0
|
||||
#define GrabModeAsync 1
|
||||
|
||||
/* GrabPointer, GrabKeyboard reply status */
|
||||
|
||||
#define GrabSuccess 0
|
||||
#define AlreadyGrabbed 1
|
||||
#define GrabInvalidTime 2
|
||||
#define GrabNotViewable 3
|
||||
#define GrabFrozen 4
|
||||
|
||||
/* AllowEvents modes */
|
||||
|
||||
#define AsyncPointer 0
|
||||
#define SyncPointer 1
|
||||
#define ReplayPointer 2
|
||||
#define AsyncKeyboard 3
|
||||
#define SyncKeyboard 4
|
||||
#define ReplayKeyboard 5
|
||||
#define AsyncBoth 6
|
||||
#define SyncBoth 7
|
||||
|
||||
/* Used in SetInputFocus, GetInputFocus */
|
||||
|
||||
#define RevertToNone (int)None
|
||||
#define RevertToPointerRoot (int)PointerRoot
|
||||
#define RevertToParent 2
|
||||
|
||||
/*****************************************************************
|
||||
* ERROR CODES
|
||||
*****************************************************************/
|
||||
|
||||
#define Success 0 /* everything's okay */
|
||||
#define BadRequest 1 /* bad request code */
|
||||
#define BadValue 2 /* int parameter out of range */
|
||||
#define BadWindow 3 /* parameter not a Window */
|
||||
#define BadPixmap 4 /* parameter not a Pixmap */
|
||||
#define BadAtom 5 /* parameter not an Atom */
|
||||
#define BadCursor 6 /* parameter not a Cursor */
|
||||
#define BadFont 7 /* parameter not a Font */
|
||||
#define BadMatch 8 /* parameter mismatch */
|
||||
#define BadDrawable 9 /* parameter not a Pixmap or Window */
|
||||
#define BadAccess 10 /* depending on context:
|
||||
- key/button already grabbed
|
||||
- attempt to free an illegal
|
||||
cmap entry
|
||||
- attempt to store into a read-only
|
||||
color map entry.
|
||||
- attempt to modify the access control
|
||||
list from other than the local host.
|
||||
*/
|
||||
#define BadAlloc 11 /* insufficient resources */
|
||||
#define BadColor 12 /* no such colormap */
|
||||
#define BadGC 13 /* parameter not a GC */
|
||||
#define BadIDChoice 14 /* choice not in range or already used */
|
||||
#define BadName 15 /* font or color name doesn't exist */
|
||||
#define BadLength 16 /* Request length incorrect */
|
||||
#define BadImplementation 17 /* server is defective */
|
||||
|
||||
#define FirstExtensionError 128
|
||||
#define LastExtensionError 255
|
||||
|
||||
/*****************************************************************
|
||||
* WINDOW DEFINITIONS
|
||||
*****************************************************************/
|
||||
|
||||
/* Window classes used by CreateWindow */
|
||||
/* Note that CopyFromParent is already defined as 0 above */
|
||||
|
||||
#define InputOutput 1
|
||||
#define InputOnly 2
|
||||
|
||||
/* Window attributes for CreateWindow and ChangeWindowAttributes */
|
||||
|
||||
#define CWBackPixmap (1L<<0)
|
||||
#define CWBackPixel (1L<<1)
|
||||
#define CWBorderPixmap (1L<<2)
|
||||
#define CWBorderPixel (1L<<3)
|
||||
#define CWBitGravity (1L<<4)
|
||||
#define CWWinGravity (1L<<5)
|
||||
#define CWBackingStore (1L<<6)
|
||||
#define CWBackingPlanes (1L<<7)
|
||||
#define CWBackingPixel (1L<<8)
|
||||
#define CWOverrideRedirect (1L<<9)
|
||||
#define CWSaveUnder (1L<<10)
|
||||
#define CWEventMask (1L<<11)
|
||||
#define CWDontPropagate (1L<<12)
|
||||
#define CWColormap (1L<<13)
|
||||
#define CWCursor (1L<<14)
|
||||
|
||||
/* ConfigureWindow structure */
|
||||
|
||||
#define CWX (1<<0)
|
||||
#define CWY (1<<1)
|
||||
#define CWWidth (1<<2)
|
||||
#define CWHeight (1<<3)
|
||||
#define CWBorderWidth (1<<4)
|
||||
#define CWSibling (1<<5)
|
||||
#define CWStackMode (1<<6)
|
||||
|
||||
|
||||
/* Bit Gravity */
|
||||
|
||||
#define ForgetGravity 0
|
||||
#define NorthWestGravity 1
|
||||
#define NorthGravity 2
|
||||
#define NorthEastGravity 3
|
||||
#define WestGravity 4
|
||||
#define CenterGravity 5
|
||||
#define EastGravity 6
|
||||
#define SouthWestGravity 7
|
||||
#define SouthGravity 8
|
||||
#define SouthEastGravity 9
|
||||
#define StaticGravity 10
|
||||
|
||||
/* Window gravity + bit gravity above */
|
||||
|
||||
#define UnmapGravity 0
|
||||
|
||||
/* Used in CreateWindow for backing-store hint */
|
||||
|
||||
#define NotUseful 0
|
||||
#define WhenMapped 1
|
||||
#define Always 2
|
||||
|
||||
/* Used in GetWindowAttributes reply */
|
||||
|
||||
#define IsUnmapped 0
|
||||
#define IsUnviewable 1
|
||||
#define IsViewable 2
|
||||
|
||||
/* Used in ChangeSaveSet */
|
||||
|
||||
#define SetModeInsert 0
|
||||
#define SetModeDelete 1
|
||||
|
||||
/* Used in ChangeCloseDownMode */
|
||||
|
||||
#define DestroyAll 0
|
||||
#define RetainPermanent 1
|
||||
#define RetainTemporary 2
|
||||
|
||||
/* Window stacking method (in configureWindow) */
|
||||
|
||||
#define Above 0
|
||||
#define Below 1
|
||||
#define TopIf 2
|
||||
#define BottomIf 3
|
||||
#define Opposite 4
|
||||
|
||||
/* Circulation direction */
|
||||
|
||||
#define RaiseLowest 0
|
||||
#define LowerHighest 1
|
||||
|
||||
/* Property modes */
|
||||
|
||||
#define PropModeReplace 0
|
||||
#define PropModePrepend 1
|
||||
#define PropModeAppend 2
|
||||
|
||||
/*****************************************************************
|
||||
* GRAPHICS DEFINITIONS
|
||||
*****************************************************************/
|
||||
|
||||
/* graphics functions, as in GC.alu */
|
||||
|
||||
#define GXclear 0x0 /* 0 */
|
||||
#define GXand 0x1 /* src AND dst */
|
||||
#define GXandReverse 0x2 /* src AND NOT dst */
|
||||
#define GXcopy 0x3 /* src */
|
||||
#define GXandInverted 0x4 /* NOT src AND dst */
|
||||
#define GXnoop 0x5 /* dst */
|
||||
#define GXxor 0x6 /* src XOR dst */
|
||||
#define GXor 0x7 /* src OR dst */
|
||||
#define GXnor 0x8 /* NOT src AND NOT dst */
|
||||
#define GXequiv 0x9 /* NOT src XOR dst */
|
||||
#define GXinvert 0xa /* NOT dst */
|
||||
#define GXorReverse 0xb /* src OR NOT dst */
|
||||
#define GXcopyInverted 0xc /* NOT src */
|
||||
#define GXorInverted 0xd /* NOT src OR dst */
|
||||
#define GXnand 0xe /* NOT src OR NOT dst */
|
||||
#define GXset 0xf /* 1 */
|
||||
|
||||
/* LineStyle */
|
||||
|
||||
#define LineSolid 0
|
||||
#define LineOnOffDash 1
|
||||
#define LineDoubleDash 2
|
||||
|
||||
/* capStyle */
|
||||
|
||||
#define CapNotLast 0
|
||||
#define CapButt 1
|
||||
#define CapRound 2
|
||||
#define CapProjecting 3
|
||||
|
||||
/* joinStyle */
|
||||
|
||||
#define JoinMiter 0
|
||||
#define JoinRound 1
|
||||
#define JoinBevel 2
|
||||
|
||||
/* fillStyle */
|
||||
|
||||
#define FillSolid 0
|
||||
#define FillTiled 1
|
||||
#define FillStippled 2
|
||||
#define FillOpaqueStippled 3
|
||||
|
||||
/* fillRule */
|
||||
|
||||
#define EvenOddRule 0
|
||||
#define WindingRule 1
|
||||
|
||||
/* subwindow mode */
|
||||
|
||||
#define ClipByChildren 0
|
||||
#define IncludeInferiors 1
|
||||
|
||||
/* SetClipRectangles ordering */
|
||||
|
||||
#define Unsorted 0
|
||||
#define YSorted 1
|
||||
#define YXSorted 2
|
||||
#define YXBanded 3
|
||||
|
||||
/* CoordinateMode for drawing routines */
|
||||
|
||||
#define CoordModeOrigin 0 /* relative to the origin */
|
||||
#define CoordModePrevious 1 /* relative to previous point */
|
||||
|
||||
/* Polygon shapes */
|
||||
|
||||
#define Complex 0 /* paths may intersect */
|
||||
#define Nonconvex 1 /* no paths intersect, but not convex */
|
||||
#define Convex 2 /* wholly convex */
|
||||
|
||||
/* Arc modes for PolyFillArc */
|
||||
|
||||
#define ArcChord 0 /* join endpoints of arc */
|
||||
#define ArcPieSlice 1 /* join endpoints to center of arc */
|
||||
|
||||
/* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into
|
||||
GC.stateChanges */
|
||||
|
||||
#define GCFunction (1L<<0)
|
||||
#define GCPlaneMask (1L<<1)
|
||||
#define GCForeground (1L<<2)
|
||||
#define GCBackground (1L<<3)
|
||||
#define GCLineWidth (1L<<4)
|
||||
#define GCLineStyle (1L<<5)
|
||||
#define GCCapStyle (1L<<6)
|
||||
#define GCJoinStyle (1L<<7)
|
||||
#define GCFillStyle (1L<<8)
|
||||
#define GCFillRule (1L<<9)
|
||||
#define GCTile (1L<<10)
|
||||
#define GCStipple (1L<<11)
|
||||
#define GCTileStipXOrigin (1L<<12)
|
||||
#define GCTileStipYOrigin (1L<<13)
|
||||
#define GCFont (1L<<14)
|
||||
#define GCSubwindowMode (1L<<15)
|
||||
#define GCGraphicsExposures (1L<<16)
|
||||
#define GCClipXOrigin (1L<<17)
|
||||
#define GCClipYOrigin (1L<<18)
|
||||
#define GCClipMask (1L<<19)
|
||||
#define GCDashOffset (1L<<20)
|
||||
#define GCDashList (1L<<21)
|
||||
#define GCArcMode (1L<<22)
|
||||
|
||||
#define GCLastBit 22
|
||||
/*****************************************************************
|
||||
* FONTS
|
||||
*****************************************************************/
|
||||
|
||||
/* used in QueryFont -- draw direction */
|
||||
|
||||
#define FontLeftToRight 0
|
||||
#define FontRightToLeft 1
|
||||
|
||||
#define FontChange 255
|
||||
|
||||
/*****************************************************************
|
||||
* IMAGING
|
||||
*****************************************************************/
|
||||
|
||||
/* ImageFormat -- PutImage, GetImage */
|
||||
|
||||
#define XYBitmap 0 /* depth 1, XYFormat */
|
||||
#define XYPixmap 1 /* depth == drawable depth */
|
||||
#define ZPixmap 2 /* depth == drawable depth */
|
||||
|
||||
/*****************************************************************
|
||||
* COLOR MAP STUFF
|
||||
*****************************************************************/
|
||||
|
||||
/* For CreateColormap */
|
||||
|
||||
#define AllocNone 0 /* create map with no entries */
|
||||
#define AllocAll 1 /* allocate entire map writeable */
|
||||
|
||||
|
||||
/* Flags used in StoreNamedColor, StoreColors */
|
||||
|
||||
#define DoRed (1<<0)
|
||||
#define DoGreen (1<<1)
|
||||
#define DoBlue (1<<2)
|
||||
|
||||
/*****************************************************************
|
||||
* CURSOR STUFF
|
||||
*****************************************************************/
|
||||
|
||||
/* QueryBestSize Class */
|
||||
|
||||
#define CursorShape 0 /* largest size that can be displayed */
|
||||
#define TileShape 1 /* size tiled fastest */
|
||||
#define StippleShape 2 /* size stippled fastest */
|
||||
|
||||
/*****************************************************************
|
||||
* KEYBOARD/POINTER STUFF
|
||||
*****************************************************************/
|
||||
|
||||
#define AutoRepeatModeOff 0
|
||||
#define AutoRepeatModeOn 1
|
||||
#define AutoRepeatModeDefault 2
|
||||
|
||||
#define LedModeOff 0
|
||||
#define LedModeOn 1
|
||||
|
||||
/* masks for ChangeKeyboardControl */
|
||||
|
||||
#define KBKeyClickPercent (1L<<0)
|
||||
#define KBBellPercent (1L<<1)
|
||||
#define KBBellPitch (1L<<2)
|
||||
#define KBBellDuration (1L<<3)
|
||||
#define KBLed (1L<<4)
|
||||
#define KBLedMode (1L<<5)
|
||||
#define KBKey (1L<<6)
|
||||
#define KBAutoRepeatMode (1L<<7)
|
||||
|
||||
#define MappingSuccess 0
|
||||
#define MappingBusy 1
|
||||
#define MappingFailed 2
|
||||
|
||||
#define MappingModifier 0
|
||||
#define MappingKeyboard 1
|
||||
#define MappingPointer 2
|
||||
|
||||
/*****************************************************************
|
||||
* SCREEN SAVER STUFF
|
||||
*****************************************************************/
|
||||
|
||||
#define DontPreferBlanking 0
|
||||
#define PreferBlanking 1
|
||||
#define DefaultBlanking 2
|
||||
|
||||
#define DisableScreenSaver 0
|
||||
#define DisableScreenInterval 0
|
||||
|
||||
#define DontAllowExposures 0
|
||||
#define AllowExposures 1
|
||||
#define DefaultExposures 2
|
||||
|
||||
/* for ForceScreenSaver */
|
||||
|
||||
#define ScreenSaverReset 0
|
||||
#define ScreenSaverActive 1
|
||||
|
||||
/*****************************************************************
|
||||
* HOSTS AND CONNECTIONS
|
||||
*****************************************************************/
|
||||
|
||||
/* for ChangeHosts */
|
||||
|
||||
#define HostInsert 0
|
||||
#define HostDelete 1
|
||||
|
||||
/* for ChangeAccessControl */
|
||||
|
||||
#define EnableAccess 1
|
||||
#define DisableAccess 0
|
||||
|
||||
/* Display classes used in opening the connection
|
||||
* Note that the statically allocated ones are even numbered and the
|
||||
* dynamically changeable ones are odd numbered */
|
||||
|
||||
#define StaticGray 0
|
||||
#define GrayScale 1
|
||||
#define StaticColor 2
|
||||
#define PseudoColor 3
|
||||
#define TrueColor 4
|
||||
#define DirectColor 5
|
||||
|
||||
|
||||
/* Byte order used in imageByteOrder and bitmapBitOrder */
|
||||
|
||||
#define LSBFirst 0
|
||||
#define MSBFirst 1
|
||||
|
||||
#if defined(MAC_OSX_TK)
|
||||
# undef Cursor
|
||||
# undef Region
|
||||
#endif
|
||||
|
||||
#endif /* X_H */
|
||||
@@ -0,0 +1,79 @@
|
||||
#ifndef XATOM_H
|
||||
#define XATOM_H 1
|
||||
|
||||
/* THIS IS A GENERATED FILE
|
||||
*
|
||||
* Do not change! Changing this file implies a protocol change!
|
||||
*/
|
||||
|
||||
#define XA_PRIMARY ((Atom) 1)
|
||||
#define XA_SECONDARY ((Atom) 2)
|
||||
#define XA_ARC ((Atom) 3)
|
||||
#define XA_ATOM ((Atom) 4)
|
||||
#define XA_BITMAP ((Atom) 5)
|
||||
#define XA_CARDINAL ((Atom) 6)
|
||||
#define XA_COLORMAP ((Atom) 7)
|
||||
#define XA_CURSOR ((Atom) 8)
|
||||
#define XA_CUT_BUFFER0 ((Atom) 9)
|
||||
#define XA_CUT_BUFFER1 ((Atom) 10)
|
||||
#define XA_CUT_BUFFER2 ((Atom) 11)
|
||||
#define XA_CUT_BUFFER3 ((Atom) 12)
|
||||
#define XA_CUT_BUFFER4 ((Atom) 13)
|
||||
#define XA_CUT_BUFFER5 ((Atom) 14)
|
||||
#define XA_CUT_BUFFER6 ((Atom) 15)
|
||||
#define XA_CUT_BUFFER7 ((Atom) 16)
|
||||
#define XA_DRAWABLE ((Atom) 17)
|
||||
#define XA_FONT ((Atom) 18)
|
||||
#define XA_INTEGER ((Atom) 19)
|
||||
#define XA_PIXMAP ((Atom) 20)
|
||||
#define XA_POINT ((Atom) 21)
|
||||
#define XA_RECTANGLE ((Atom) 22)
|
||||
#define XA_RESOURCE_MANAGER ((Atom) 23)
|
||||
#define XA_RGB_COLOR_MAP ((Atom) 24)
|
||||
#define XA_RGB_BEST_MAP ((Atom) 25)
|
||||
#define XA_RGB_BLUE_MAP ((Atom) 26)
|
||||
#define XA_RGB_DEFAULT_MAP ((Atom) 27)
|
||||
#define XA_RGB_GRAY_MAP ((Atom) 28)
|
||||
#define XA_RGB_GREEN_MAP ((Atom) 29)
|
||||
#define XA_RGB_RED_MAP ((Atom) 30)
|
||||
#define XA_STRING ((Atom) 31)
|
||||
#define XA_VISUALID ((Atom) 32)
|
||||
#define XA_WINDOW ((Atom) 33)
|
||||
#define XA_WM_COMMAND ((Atom) 34)
|
||||
#define XA_WM_HINTS ((Atom) 35)
|
||||
#define XA_WM_CLIENT_MACHINE ((Atom) 36)
|
||||
#define XA_WM_ICON_NAME ((Atom) 37)
|
||||
#define XA_WM_ICON_SIZE ((Atom) 38)
|
||||
#define XA_WM_NAME ((Atom) 39)
|
||||
#define XA_WM_NORMAL_HINTS ((Atom) 40)
|
||||
#define XA_WM_SIZE_HINTS ((Atom) 41)
|
||||
#define XA_WM_ZOOM_HINTS ((Atom) 42)
|
||||
#define XA_MIN_SPACE ((Atom) 43)
|
||||
#define XA_NORM_SPACE ((Atom) 44)
|
||||
#define XA_MAX_SPACE ((Atom) 45)
|
||||
#define XA_END_SPACE ((Atom) 46)
|
||||
#define XA_SUPERSCRIPT_X ((Atom) 47)
|
||||
#define XA_SUPERSCRIPT_Y ((Atom) 48)
|
||||
#define XA_SUBSCRIPT_X ((Atom) 49)
|
||||
#define XA_SUBSCRIPT_Y ((Atom) 50)
|
||||
#define XA_UNDERLINE_POSITION ((Atom) 51)
|
||||
#define XA_UNDERLINE_THICKNESS ((Atom) 52)
|
||||
#define XA_STRIKEOUT_ASCENT ((Atom) 53)
|
||||
#define XA_STRIKEOUT_DESCENT ((Atom) 54)
|
||||
#define XA_ITALIC_ANGLE ((Atom) 55)
|
||||
#define XA_X_HEIGHT ((Atom) 56)
|
||||
#define XA_QUAD_WIDTH ((Atom) 57)
|
||||
#define XA_WEIGHT ((Atom) 58)
|
||||
#define XA_POINT_SIZE ((Atom) 59)
|
||||
#define XA_RESOLUTION ((Atom) 60)
|
||||
#define XA_COPYRIGHT ((Atom) 61)
|
||||
#define XA_NOTICE ((Atom) 62)
|
||||
#define XA_FONT_NAME ((Atom) 63)
|
||||
#define XA_FAMILY_NAME ((Atom) 64)
|
||||
#define XA_FULL_NAME ((Atom) 65)
|
||||
#define XA_CAP_HEIGHT ((Atom) 66)
|
||||
#define XA_WM_CLASS ((Atom) 67)
|
||||
#define XA_WM_TRANSIENT_FOR ((Atom) 68)
|
||||
|
||||
#define XA_LAST_PREDEFINED ((Atom) 68)
|
||||
#endif /* XATOM_H */
|
||||
@@ -0,0 +1,60 @@
|
||||
/* $XConsortium: Xfuncproto.h,v 1.7 91/05/13 20:49:21 rws Exp $ */
|
||||
/*
|
||||
* Copyright 1989, 1991 by the Massachusetts Institute of Technology
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted, provided
|
||||
* that the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of M.I.T. not be used in advertising
|
||||
* or publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. M.I.T. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Definitions to make function prototypes manageable */
|
||||
|
||||
#ifndef _XFUNCPROTO_H_
|
||||
#define _XFUNCPROTO_H_
|
||||
|
||||
#ifndef NeedFunctionPrototypes
|
||||
#define NeedFunctionPrototypes 1
|
||||
#endif /* NeedFunctionPrototypes */
|
||||
|
||||
#ifndef NeedVarargsPrototypes
|
||||
#define NeedVarargsPrototypes 0
|
||||
#endif /* NeedVarargsPrototypes */
|
||||
|
||||
#if NeedFunctionPrototypes
|
||||
|
||||
#ifndef NeedNestedPrototypes
|
||||
#define NeedNestedPrototypes 1
|
||||
#endif /* NeedNestedPrototypes */
|
||||
|
||||
#ifndef _Xconst
|
||||
#define _Xconst const
|
||||
#endif /* _Xconst */
|
||||
|
||||
#ifndef NeedWidePrototypes
|
||||
#ifdef NARROWPROTO
|
||||
#define NeedWidePrototypes 0
|
||||
#else
|
||||
#define NeedWidePrototypes 1 /* default to make interropt. easier */
|
||||
#endif
|
||||
#endif /* NeedWidePrototypes */
|
||||
|
||||
#endif /* NeedFunctionPrototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define _XFUNCPROTOBEGIN extern "C" {
|
||||
#define _XFUNCPROTOEND }
|
||||
#endif
|
||||
|
||||
#ifndef _XFUNCPROTOBEGIN
|
||||
#define _XFUNCPROTOBEGIN
|
||||
#define _XFUNCPROTOEND
|
||||
#endif /* _XFUNCPROTOBEGIN */
|
||||
|
||||
#endif /* _XFUNCPROTO_H_ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,855 @@
|
||||
/* $XConsortium: Xutil.h,v 11.73 91/07/30 16:21:37 rws Exp $ */
|
||||
|
||||
/***********************************************************
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
|
||||
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the names of Digital or MIT not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifndef _XUTIL_H_
|
||||
#define _XUTIL_H_
|
||||
|
||||
/* You must include <X11/Xlib.h> before including this file */
|
||||
|
||||
#if defined(MAC_OSX_TK)
|
||||
# define Region XRegion
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
|
||||
* value (x, y, width, height) was found in the parsed string.
|
||||
*/
|
||||
#define NoValue 0x0000
|
||||
#define XValue 0x0001
|
||||
#define YValue 0x0002
|
||||
#define WidthValue 0x0004
|
||||
#define HeightValue 0x0008
|
||||
#define AllValues 0x000F
|
||||
#define XNegative 0x0010
|
||||
#define YNegative 0x0020
|
||||
|
||||
/*
|
||||
* new version containing base_width, base_height, and win_gravity fields;
|
||||
* used with WM_NORMAL_HINTS.
|
||||
*/
|
||||
typedef struct {
|
||||
long flags; /* marks which fields in this structure are defined */
|
||||
int x, y; /* obsolete for new window mgrs, but clients */
|
||||
int width, height; /* should set so old wm's don't mess up */
|
||||
int min_width, min_height;
|
||||
int max_width, max_height;
|
||||
int width_inc, height_inc;
|
||||
struct {
|
||||
int x; /* numerator */
|
||||
int y; /* denominator */
|
||||
} min_aspect, max_aspect;
|
||||
int base_width, base_height; /* added by ICCCM version 1 */
|
||||
int win_gravity; /* added by ICCCM version 1 */
|
||||
} XSizeHints;
|
||||
|
||||
/*
|
||||
* The next block of definitions are for window manager properties that
|
||||
* clients and applications use for communication.
|
||||
*/
|
||||
|
||||
/* flags argument in size hints */
|
||||
#define USPosition (1L << 0) /* user specified x, y */
|
||||
#define USSize (1L << 1) /* user specified width, height */
|
||||
|
||||
#define PPosition (1L << 2) /* program specified position */
|
||||
#define PSize (1L << 3) /* program specified size */
|
||||
#define PMinSize (1L << 4) /* program specified minimum size */
|
||||
#define PMaxSize (1L << 5) /* program specified maximum size */
|
||||
#define PResizeInc (1L << 6) /* program specified resize increments */
|
||||
#define PAspect (1L << 7) /* program specified min and max aspect ratios */
|
||||
#define PBaseSize (1L << 8) /* program specified base for incrementing */
|
||||
#define PWinGravity (1L << 9) /* program specified window gravity */
|
||||
|
||||
/* obsolete */
|
||||
#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
long flags; /* marks which fields in this structure are defined */
|
||||
Bool input; /* does this application rely on the window manager to
|
||||
get keyboard input? */
|
||||
int initial_state; /* see below */
|
||||
Pixmap icon_pixmap; /* pixmap to be used as icon */
|
||||
Window icon_window; /* window to be used as icon */
|
||||
int icon_x, icon_y; /* initial position of icon */
|
||||
Pixmap icon_mask; /* icon mask bitmap */
|
||||
XID window_group; /* id of related window group */
|
||||
/* this structure may be extended in the future */
|
||||
} XWMHints;
|
||||
|
||||
/* definition for flags of XWMHints */
|
||||
|
||||
#define InputHint (1L << 0)
|
||||
#define StateHint (1L << 1)
|
||||
#define IconPixmapHint (1L << 2)
|
||||
#define IconWindowHint (1L << 3)
|
||||
#define IconPositionHint (1L << 4)
|
||||
#define IconMaskHint (1L << 5)
|
||||
#define WindowGroupHint (1L << 6)
|
||||
#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
|
||||
IconPositionHint|IconMaskHint|WindowGroupHint)
|
||||
|
||||
/* definitions for initial window state */
|
||||
#define WithdrawnState 0 /* for windows that are not mapped */
|
||||
#define NormalState 1 /* most applications want to start this way */
|
||||
#define IconicState 3 /* application wants to start as an icon */
|
||||
|
||||
/*
|
||||
* Obsolete states no longer defined by ICCCM
|
||||
*/
|
||||
#define DontCareState 0 /* don't know or care */
|
||||
#define ZoomState 2 /* application wants to start zoomed */
|
||||
#define InactiveState 4 /* application believes it is seldom used; */
|
||||
/* some wm's may put it on inactive menu */
|
||||
|
||||
|
||||
/*
|
||||
* new structure for manipulating TEXT properties; used with WM_NAME,
|
||||
* WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char *value; /* same as Property routines */
|
||||
Atom encoding; /* prop type */
|
||||
int format; /* prop data format: 8, 16, or 32 */
|
||||
unsigned long nitems; /* number of data items in value */
|
||||
} XTextProperty;
|
||||
|
||||
#define XNoMemory -1
|
||||
#define XLocaleNotSupported -2
|
||||
#define XConverterNotFound -3
|
||||
|
||||
typedef enum {
|
||||
XStringStyle, /* STRING */
|
||||
XCompoundTextStyle, /* COMPOUND_TEXT */
|
||||
XTextStyle, /* text in owner's encoding (current locale)*/
|
||||
XStdICCTextStyle /* STRING, else COMPOUND_TEXT */
|
||||
} XICCEncodingStyle;
|
||||
|
||||
typedef struct {
|
||||
int min_width, min_height;
|
||||
int max_width, max_height;
|
||||
int width_inc, height_inc;
|
||||
} XIconSize;
|
||||
|
||||
typedef struct {
|
||||
char *res_name;
|
||||
char *res_class;
|
||||
} XClassHint;
|
||||
|
||||
/*
|
||||
* These macros are used to give some sugar to the image routines so that
|
||||
* naive people are more comfortable with them.
|
||||
*/
|
||||
#define XDestroyImage(ximage) \
|
||||
((*((ximage)->f.destroy_image))((ximage)))
|
||||
#define XGetPixel(ximage, x, y) \
|
||||
((*((ximage)->f.get_pixel))((ximage), (x), (y)))
|
||||
#define XPutPixel(ximage, x, y, pixel) \
|
||||
((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
|
||||
#define XSubImage(ximage, x, y, width, height) \
|
||||
((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
|
||||
#define XAddPixel(ximage, value) \
|
||||
((*((ximage)->f.add_pixel))((ximage), (value)))
|
||||
|
||||
/*
|
||||
* Compose sequence status structure, used in calling XLookupString.
|
||||
*/
|
||||
typedef struct _XComposeStatus {
|
||||
XPointer compose_ptr; /* state table pointer */
|
||||
int chars_matched; /* match state */
|
||||
} XComposeStatus;
|
||||
|
||||
/*
|
||||
* Keysym macros, used on Keysyms to test for classes of symbols
|
||||
*/
|
||||
#define IsKeypadKey(keysym) \
|
||||
(((unsigned)(keysym) >= XK_KP_Space) && ((unsigned)(keysym) <= XK_KP_Equal))
|
||||
|
||||
#define IsCursorKey(keysym) \
|
||||
(((unsigned)(keysym) >= XK_Home) && ((unsigned)(keysym) < XK_Select))
|
||||
|
||||
#define IsPFKey(keysym) \
|
||||
(((unsigned)(keysym) >= XK_KP_F1) && ((unsigned)(keysym) <= XK_KP_F4))
|
||||
|
||||
#define IsFunctionKey(keysym) \
|
||||
(((unsigned)(keysym) >= XK_F1) && ((unsigned)(keysym) <= XK_F35))
|
||||
|
||||
#define IsMiscFunctionKey(keysym) \
|
||||
(((unsigned)(keysym) >= XK_Select) && ((unsigned)(keysym) <= XK_Break))
|
||||
|
||||
#define IsModifierKey(keysym) \
|
||||
((((unsigned)(keysym) >= XK_Shift_L) && ((unsigned)(keysym) <= XK_Hyper_R)) \
|
||||
|| ((unsigned)(keysym) == XK_Mode_switch) \
|
||||
|| ((unsigned)(keysym) == XK_Num_Lock))
|
||||
/*
|
||||
* opaque reference to Region data type
|
||||
*/
|
||||
typedef struct _XRegion *Region;
|
||||
|
||||
/* Return values from XRectInRegion() */
|
||||
|
||||
#define RectangleOut 0
|
||||
#define RectangleIn 1
|
||||
#define RectanglePart 2
|
||||
|
||||
|
||||
/*
|
||||
* Information used by the visual utility routines to find desired visual
|
||||
* type from the many visuals a display may support.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Visual *visual;
|
||||
VisualID visualid;
|
||||
int screen;
|
||||
int depth;
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
int c_class; /* C++ */
|
||||
#else
|
||||
int class;
|
||||
#endif
|
||||
unsigned long red_mask;
|
||||
unsigned long green_mask;
|
||||
unsigned long blue_mask;
|
||||
int colormap_size;
|
||||
int bits_per_rgb;
|
||||
} XVisualInfo;
|
||||
|
||||
#define VisualNoMask 0x0
|
||||
#define VisualIDMask 0x1
|
||||
#define VisualScreenMask 0x2
|
||||
#define VisualDepthMask 0x4
|
||||
#define VisualClassMask 0x8
|
||||
#define VisualRedMaskMask 0x10
|
||||
#define VisualGreenMaskMask 0x20
|
||||
#define VisualBlueMaskMask 0x40
|
||||
#define VisualColormapSizeMask 0x80
|
||||
#define VisualBitsPerRGBMask 0x100
|
||||
#define VisualAllMask 0x1FF
|
||||
|
||||
/*
|
||||
* This defines a window manager property that clients may use to
|
||||
* share standard color maps of type RGB_COLOR_MAP:
|
||||
*/
|
||||
typedef struct {
|
||||
Colormap colormap;
|
||||
unsigned long red_max;
|
||||
unsigned long red_mult;
|
||||
unsigned long green_max;
|
||||
unsigned long green_mult;
|
||||
unsigned long blue_max;
|
||||
unsigned long blue_mult;
|
||||
unsigned long base_pixel;
|
||||
VisualID visualid; /* added by ICCCM version 1 */
|
||||
XID killid; /* added by ICCCM version 1 */
|
||||
} XStandardColormap;
|
||||
|
||||
#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */
|
||||
|
||||
|
||||
/*
|
||||
* return codes for XReadBitmapFile and XWriteBitmapFile
|
||||
*/
|
||||
#define BitmapSuccess 0
|
||||
#define BitmapOpenFailed 1
|
||||
#define BitmapFileInvalid 2
|
||||
#define BitmapNoMemory 3
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Context Management
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
|
||||
/* Associative lookup table return codes */
|
||||
|
||||
#define XCSUCCESS 0 /* No error. */
|
||||
#define XCNOMEM 1 /* Out of memory */
|
||||
#define XCNOENT 2 /* No entry in table */
|
||||
|
||||
typedef int XContext;
|
||||
|
||||
#define XUniqueContext() ((XContext) XrmUniqueQuark())
|
||||
#define XStringToContext(string) ((XContext) XrmStringToQuark(string))
|
||||
|
||||
_XFUNCPROTOBEGIN
|
||||
|
||||
/* The following declarations are alphabetized. */
|
||||
|
||||
extern XClassHint *XAllocClassHint (
|
||||
#if NeedFunctionPrototypes
|
||||
void
|
||||
#endif
|
||||
);
|
||||
|
||||
extern XIconSize *XAllocIconSize (
|
||||
#if NeedFunctionPrototypes
|
||||
void
|
||||
#endif
|
||||
);
|
||||
|
||||
extern XSizeHints *XAllocSizeHints (
|
||||
#if NeedFunctionPrototypes
|
||||
void
|
||||
#endif
|
||||
);
|
||||
|
||||
extern XStandardColormap *XAllocStandardColormap (
|
||||
#if NeedFunctionPrototypes
|
||||
void
|
||||
#endif
|
||||
);
|
||||
|
||||
extern XWMHints *XAllocWMHints (
|
||||
#if NeedFunctionPrototypes
|
||||
void
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XClipBox(
|
||||
#if NeedFunctionPrototypes
|
||||
Region /* r */,
|
||||
XRectangle* /* rect_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Region XCreateRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
void
|
||||
#endif
|
||||
);
|
||||
|
||||
extern char *XDefaultString(
|
||||
#if NeedFunctionPrototypes
|
||||
void
|
||||
#endif
|
||||
);
|
||||
|
||||
extern int XDeleteContext(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
XID /* rid */,
|
||||
XContext /* context */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XDestroyRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
Region /* r */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XEmptyRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
Region /* r */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XEqualRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
Region /* r1 */,
|
||||
Region /* r2 */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern int XFindContext(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
XID /* rid */,
|
||||
XContext /* context */,
|
||||
XPointer* /* data_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Status XGetClassHint(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XClassHint* /* class_hints_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Status XGetIconSizes(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XIconSize** /* size_list_return */,
|
||||
int* /* count_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Status XGetNormalHints(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XSizeHints* /* hints_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Status XGetRGBColormaps(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XStandardColormap** /* stdcmap_return */,
|
||||
int* /* count_return */,
|
||||
Atom /* property */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Status XGetSizeHints(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XSizeHints* /* hints_return */,
|
||||
Atom /* property */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Status XGetStandardColormap(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XStandardColormap* /* colormap_return */,
|
||||
Atom /* property */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Status XGetTextProperty(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* window */,
|
||||
XTextProperty* /* text_prop_return */,
|
||||
Atom /* property */
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
extern Status XGetWMClientMachine(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XTextProperty* /* text_prop_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern XWMHints *XGetWMHints(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Status XGetWMIconName(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XTextProperty* /* text_prop_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Status XGetWMName(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XTextProperty* /* text_prop_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Status XGetWMNormalHints(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XSizeHints* /* hints_return */,
|
||||
long* /* supplied_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Status XGetWMSizeHints(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XSizeHints* /* hints_return */,
|
||||
long* /* supplied_return */,
|
||||
Atom /* property */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Status XGetZoomHints(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XSizeHints* /* zhints_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XIntersectRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
Region /* sra */,
|
||||
Region /* srb */,
|
||||
Region /* dr_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern int XLookupString(
|
||||
#if NeedFunctionPrototypes
|
||||
XKeyEvent* /* event_struct */,
|
||||
char* /* buffer_return */,
|
||||
int /* bytes_buffer */,
|
||||
KeySym* /* keysym_return */,
|
||||
XComposeStatus* /* status_in_out */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Status XMatchVisualInfo(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
int /* screen */,
|
||||
int /* depth */,
|
||||
int /* class */,
|
||||
XVisualInfo* /* vinfo_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XOffsetRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
Region /* r */,
|
||||
int /* dx */,
|
||||
int /* dy */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Bool XPointInRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
Region /* r */,
|
||||
int /* x */,
|
||||
int /* y */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Region XPolygonRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
XPoint* /* points */,
|
||||
int /* n */,
|
||||
int /* fill_rule */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern int XRectInRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
Region /* r */,
|
||||
int /* x */,
|
||||
int /* y */,
|
||||
unsigned int /* width */,
|
||||
unsigned int /* height */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern int XSaveContext(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
XID /* rid */,
|
||||
XContext /* context */,
|
||||
_Xconst char* /* data */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetClassHint(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XClassHint* /* class_hints */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetIconSizes(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XIconSize* /* size_list */,
|
||||
int /* count */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetNormalHints(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XSizeHints* /* hints */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetRGBColormaps(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XStandardColormap* /* stdcmaps */,
|
||||
int /* count */,
|
||||
Atom /* property */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetSizeHints(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XSizeHints* /* hints */,
|
||||
Atom /* property */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetStandardProperties(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
_Xconst char* /* window_name */,
|
||||
_Xconst char* /* icon_name */,
|
||||
Pixmap /* icon_pixmap */,
|
||||
char** /* argv */,
|
||||
int /* argc */,
|
||||
XSizeHints* /* hints */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetTextProperty(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XTextProperty* /* text_prop */,
|
||||
Atom /* property */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetWMHints(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XWMHints* /* wm_hints */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetWMIconName(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XTextProperty* /* text_prop */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetWMName(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XTextProperty* /* text_prop */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetWMNormalHints(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XSizeHints* /* hints */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetWMProperties(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XTextProperty* /* window_name */,
|
||||
XTextProperty* /* icon_name */,
|
||||
char** /* argv */,
|
||||
int /* argc */,
|
||||
XSizeHints* /* normal_hints */,
|
||||
XWMHints* /* wm_hints */,
|
||||
XClassHint* /* class_hints */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XmbSetWMProperties(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
_Xconst char* /* window_name */,
|
||||
_Xconst char* /* icon_name */,
|
||||
char** /* argv */,
|
||||
int /* argc */,
|
||||
XSizeHints* /* normal_hints */,
|
||||
XWMHints* /* wm_hints */,
|
||||
XClassHint* /* class_hints */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetWMSizeHints(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XSizeHints* /* hints */,
|
||||
Atom /* property */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
GC /* gc */,
|
||||
Region /* r */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetStandardColormap(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XStandardColormap* /* colormap */,
|
||||
Atom /* property */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSetZoomHints(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
Window /* w */,
|
||||
XSizeHints* /* zhints */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XShrinkRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
Region /* r */,
|
||||
int /* dx */,
|
||||
int /* dy */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XSubtractRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
Region /* sra */,
|
||||
Region /* srb */,
|
||||
Region /* dr_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern int XmbTextListToTextProperty(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
char** /* list */,
|
||||
int /* count */,
|
||||
XICCEncodingStyle /* style */,
|
||||
XTextProperty* /* text_prop_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern int XwcTextListToTextProperty(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
wchar_t** /* list */,
|
||||
int /* count */,
|
||||
XICCEncodingStyle /* style */,
|
||||
XTextProperty* /* text_prop_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XwcFreeStringList(
|
||||
#if NeedFunctionPrototypes
|
||||
wchar_t** /* list */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Status XTextPropertyToStringList(
|
||||
#if NeedFunctionPrototypes
|
||||
XTextProperty* /* text_prop */,
|
||||
char*** /* list_return */,
|
||||
int* /* count_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern int XmbTextPropertyToTextList(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
XTextProperty* /* text_prop */,
|
||||
char*** /* list_return */,
|
||||
int* /* count_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern int XwcTextPropertyToTextList(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
XTextProperty* /* text_prop */,
|
||||
wchar_t*** /* list_return */,
|
||||
int* /* count_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XUnionRectWithRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
XRectangle* /* rectangle */,
|
||||
Region /* src_region */,
|
||||
Region /* dest_region_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XUnionRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
Region /* sra */,
|
||||
Region /* srb */,
|
||||
Region /* dr_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern int XWMGeometry(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* display */,
|
||||
int /* screen_number */,
|
||||
_Xconst char* /* user_geometry */,
|
||||
_Xconst char* /* default_geometry */,
|
||||
unsigned int /* border_width */,
|
||||
XSizeHints* /* hints */,
|
||||
int* /* x_return */,
|
||||
int* /* y_return */,
|
||||
int* /* width_return */,
|
||||
int* /* height_return */,
|
||||
int* /* gravity_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void XXorRegion(
|
||||
#if NeedFunctionPrototypes
|
||||
Region /* sra */,
|
||||
Region /* srb */,
|
||||
Region /* dr_return */
|
||||
#endif
|
||||
);
|
||||
|
||||
_XFUNCPROTOEND
|
||||
|
||||
#if defined(MAC_OSX_TK)
|
||||
# undef Region
|
||||
#endif
|
||||
|
||||
#endif /* _XUTIL_H_ */
|
||||
@@ -0,0 +1,79 @@
|
||||
/* $XConsortium: cursorfont.h,v 1.2 88/09/06 16:44:27 jim Exp $ */
|
||||
#define XC_num_glyphs 154
|
||||
#define XC_X_cursor 0
|
||||
#define XC_arrow 2
|
||||
#define XC_based_arrow_down 4
|
||||
#define XC_based_arrow_up 6
|
||||
#define XC_boat 8
|
||||
#define XC_bogosity 10
|
||||
#define XC_bottom_left_corner 12
|
||||
#define XC_bottom_right_corner 14
|
||||
#define XC_bottom_side 16
|
||||
#define XC_bottom_tee 18
|
||||
#define XC_box_spiral 20
|
||||
#define XC_center_ptr 22
|
||||
#define XC_circle 24
|
||||
#define XC_clock 26
|
||||
#define XC_coffee_mug 28
|
||||
#define XC_cross 30
|
||||
#define XC_cross_reverse 32
|
||||
#define XC_crosshair 34
|
||||
#define XC_diamond_cross 36
|
||||
#define XC_dot 38
|
||||
#define XC_dotbox 40
|
||||
#define XC_double_arrow 42
|
||||
#define XC_draft_large 44
|
||||
#define XC_draft_small 46
|
||||
#define XC_draped_box 48
|
||||
#define XC_exchange 50
|
||||
#define XC_fleur 52
|
||||
#define XC_gobbler 54
|
||||
#define XC_gumby 56
|
||||
#define XC_hand1 58
|
||||
#define XC_hand2 60
|
||||
#define XC_heart 62
|
||||
#define XC_icon 64
|
||||
#define XC_iron_cross 66
|
||||
#define XC_left_ptr 68
|
||||
#define XC_left_side 70
|
||||
#define XC_left_tee 72
|
||||
#define XC_leftbutton 74
|
||||
#define XC_ll_angle 76
|
||||
#define XC_lr_angle 78
|
||||
#define XC_man 80
|
||||
#define XC_middlebutton 82
|
||||
#define XC_mouse 84
|
||||
#define XC_pencil 86
|
||||
#define XC_pirate 88
|
||||
#define XC_plus 90
|
||||
#define XC_question_arrow 92
|
||||
#define XC_right_ptr 94
|
||||
#define XC_right_side 96
|
||||
#define XC_right_tee 98
|
||||
#define XC_rightbutton 100
|
||||
#define XC_rtl_logo 102
|
||||
#define XC_sailboat 104
|
||||
#define XC_sb_down_arrow 106
|
||||
#define XC_sb_h_double_arrow 108
|
||||
#define XC_sb_left_arrow 110
|
||||
#define XC_sb_right_arrow 112
|
||||
#define XC_sb_up_arrow 114
|
||||
#define XC_sb_v_double_arrow 116
|
||||
#define XC_shuttle 118
|
||||
#define XC_sizing 120
|
||||
#define XC_spider 122
|
||||
#define XC_spraycan 124
|
||||
#define XC_star 126
|
||||
#define XC_target 128
|
||||
#define XC_tcross 130
|
||||
#define XC_top_left_arrow 132
|
||||
#define XC_top_left_corner 134
|
||||
#define XC_top_right_corner 136
|
||||
#define XC_top_side 138
|
||||
#define XC_top_tee 140
|
||||
#define XC_trek 142
|
||||
#define XC_ul_angle 144
|
||||
#define XC_umbrella 146
|
||||
#define XC_ur_angle 148
|
||||
#define XC_watch 150
|
||||
#define XC_xterm 152
|
||||
@@ -0,0 +1,35 @@
|
||||
/* $XConsortium: keysym.h,v 1.13 91/03/13 20:09:49 rws Exp $ */
|
||||
|
||||
/***********************************************************
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
|
||||
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the names of Digital or MIT not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
/* default keysyms */
|
||||
#define XK_MISCELLANY
|
||||
#define XK_LATIN1
|
||||
#define XK_LATIN2
|
||||
#define XK_LATIN3
|
||||
#define XK_LATIN4
|
||||
#define XK_GREEK
|
||||
|
||||
#include <X11/keysymdef.h>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (C) 2003 Hudson Reis.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1,
|
||||
* or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING.LIB. If
|
||||
* not, write to the Free Software Foundation, Inc., 59 Temple Place,
|
||||
* Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* Case routines */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "globals.h"
|
||||
|
||||
/*
|
||||
void cbl_tolower(char *in, char *out, unsigned int *ret) {
|
||||
int i=0;
|
||||
*ret=0;
|
||||
if (cbl_align(in) != 0) { *ret=1; }
|
||||
if (*ret == 0) {
|
||||
for (i=0;i<=(strlen(in));i++) {
|
||||
*out++ = tolower(in[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cbl_toupper(char *in, char *out, unsigned int *ret) {
|
||||
int i=0;
|
||||
*ret=0;
|
||||
if (cbl_align(in) != 0) { *ret=1; }
|
||||
if (*ret == 0) {
|
||||
for (i=0;i<=(strlen(in));i++) {
|
||||
*out++ = toupper(in[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Implemented by Walter Garrote ----------------------------------------
|
||||
// garrote@dm.com.br
|
||||
// Brazil
|
||||
// Goîânia-Goiás
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// return the string with all letter to lower
|
||||
void cbl_tolower(char *in, int size) {
|
||||
int i;
|
||||
char *c;
|
||||
c = in;
|
||||
for(i = 0; i < size; i++)
|
||||
*c++ = tolower(*c);
|
||||
return;
|
||||
}
|
||||
|
||||
// return the string with all letter to upper
|
||||
void cbl_toupper(char *in, int size) {
|
||||
int i;
|
||||
char *c;
|
||||
c = in;
|
||||
for(i = 0; i < size; i++)
|
||||
*c++ = toupper(*c);
|
||||
return;
|
||||
}
|
||||
|
||||
// return the string with all first word letter upper, and lower to the others
|
||||
void cbl_ucwords(char *in, int size) {
|
||||
int i;
|
||||
int force = 0;
|
||||
char *c;
|
||||
c = in;
|
||||
for(i = 0; i < size; i++) {
|
||||
if(!force)
|
||||
switch(*c) {
|
||||
case ' ':
|
||||
case '.':
|
||||
case ',':
|
||||
case ';':
|
||||
force = 1;
|
||||
break;
|
||||
default:
|
||||
force = 0;
|
||||
break;
|
||||
}
|
||||
if(isalpha(*c))
|
||||
if(force || i == 0) {
|
||||
*c++ = toupper(*c);
|
||||
force = 0;
|
||||
} else
|
||||
*c++ = tolower(*c);
|
||||
else
|
||||
*c++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// return the string with the first word letter upper and lower to the others
|
||||
void cbl_ucfirst(char *in, int size) {
|
||||
int i;
|
||||
int first = 0;
|
||||
char *c;
|
||||
c = in;
|
||||
for(i = 0; i < size; i++) {
|
||||
if(isalpha(*c))
|
||||
if(first == 0) {
|
||||
*c++ = toupper(*c);
|
||||
first = 1;
|
||||
} else
|
||||
*c++ = tolower(*c);
|
||||
else
|
||||
*c++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// return character for the ascii code
|
||||
void cbl_char(int *a, unsigned char *c) {
|
||||
*c = (char) *a;
|
||||
return;
|
||||
}
|
||||
|
||||
// return ascii code for the character
|
||||
void cbl_ord(unsigned char *c, int *a) {
|
||||
unsigned char ch;
|
||||
ch = *c;
|
||||
*a = (int) *(c);
|
||||
*c = ch;
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
char cobtools[] =
|
||||
"set argc 0\n"
|
||||
"set argv {}\n"
|
||||
"proc split_fields {} {\n"
|
||||
" global cobol_fields data_block\n"
|
||||
" set ix 0\n"
|
||||
" foreach {varname size} $cobol_fields {\n"
|
||||
" global $varname\n"
|
||||
" set $varname [string range $data_block $ix [expr $ix+$size-1]]\n"
|
||||
" incr ix $size\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"proc ::returnCobol {} {\n"
|
||||
" global cobol_fields result ready\n"
|
||||
" set result \"\"\n"
|
||||
" catch {\n"
|
||||
" foreach {varname size} $cobol_fields {\n"
|
||||
" global $varname\n"
|
||||
" append result [format \"%-$size.${size}s\" [set $varname]]\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" set ready 1\n"
|
||||
"}\n"
|
||||
"proc ::do_exit {} {\n"
|
||||
" label .labDoExit\n"
|
||||
" bind .labDoExit <Destroy> returnCobol\n"
|
||||
" destroy .labDoExit\n"
|
||||
"}\n"
|
||||
"proc ::cobol_preprocess {} { }\n"
|
||||
"proc ::cobol_update {} { }\n";
|
||||
|
||||
char compute_block_size[] =
|
||||
"set block_size 0\n"
|
||||
"foreach {varname size} $cobol_fields {\n"
|
||||
" incr block_size $size\n"
|
||||
"}\n";
|
||||
|
||||
char wait_ready[] =
|
||||
"split_fields\n"
|
||||
"set ready 0\n"
|
||||
"cobol_preprocess\n"
|
||||
"if {!$ready} {\n"
|
||||
" tkwait variable ready\n"
|
||||
"}\n";
|
||||
|
||||
char newgui[] =
|
||||
"foreach child [winfo children .] {\n"
|
||||
" destroy $child\n"
|
||||
"}\n";
|
||||
|
||||
@@ -0,0 +1,305 @@
|
||||
/*
|
||||
* Copyright (C) 2003 Wesley Oliveira, Aline Oliveira, Hudson Reis.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1,
|
||||
* or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING.LIB. If
|
||||
* not, write to the Free Software Foundation, Inc., 59 Temple Place,
|
||||
* Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include <windows.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define OK 0
|
||||
#define ERRO 1
|
||||
#define NDATA -1
|
||||
|
||||
#ifdef __MSVCRT__
|
||||
#define cbl_BARRA "\\"
|
||||
#else
|
||||
#define cbl_BARRA "/"
|
||||
#endif
|
||||
|
||||
typedef unsigned int cbl_t;
|
||||
DIR *current_directory;
|
||||
struct dirent *current_file;
|
||||
|
||||
/* Prototypes */
|
||||
cbl_t cbl_open_dir(char *directory);
|
||||
cbl_t cbl_rewind_dir();
|
||||
cbl_t cbl_read_dir(char *file);
|
||||
cbl_t cbl_close_dir();
|
||||
cbl_t cbl_remove_file(char *file);
|
||||
void cbl_sleep(unsigned int *time);
|
||||
|
||||
cbl_t cbl_copy_dir(char *entrada, char *saida);
|
||||
cbl_t cbl_create_dir(char *dados, int mode);
|
||||
cbl_t cbl_delete_dir(char *dados);
|
||||
cbl_t cbl_move_dir(char *origem, char *destino);
|
||||
cbl_t cbl_copy_file(char *entrada, char *saida);
|
||||
cbl_t cbl_delete_file(char *arquivo);
|
||||
|
||||
int cbl_align(char *);
|
||||
|
||||
/* Functions */
|
||||
void cbl_sleep(unsigned int *time) {
|
||||
Sleep(*time);
|
||||
return;
|
||||
}
|
||||
|
||||
cbl_t cbl_open_dir(char *directory) {
|
||||
char name[256];
|
||||
int p;
|
||||
if(current_directory) // close the current directory before
|
||||
closedir(current_directory);
|
||||
p = 0;
|
||||
while(p<256 && *(directory+p) != ' ') {
|
||||
name[p] = *(directory+p);
|
||||
p++;
|
||||
}
|
||||
name[p] = 0;
|
||||
current_directory = opendir(name);
|
||||
if(!current_directory)
|
||||
return ERRO;
|
||||
return OK;
|
||||
}
|
||||
|
||||
cbl_t cbl_rewind_dir() {
|
||||
if(!current_directory)
|
||||
return ERRO;
|
||||
rewinddir(current_directory);
|
||||
return OK;
|
||||
}
|
||||
|
||||
cbl_t cbl_read_dir(char *file) {
|
||||
int i;
|
||||
if(!current_directory)
|
||||
return ERRO;
|
||||
current_file = readdir(current_directory);
|
||||
if(!current_file)
|
||||
return ERRO;
|
||||
i = 0;
|
||||
while(current_file->d_name[i]) {
|
||||
*(file + i) = current_file->d_name[i];
|
||||
i++;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
cbl_t cbl_close_dir() {
|
||||
if(!current_directory) // close the current directory before
|
||||
return ERRO;
|
||||
closedir(current_directory);
|
||||
return OK;
|
||||
}
|
||||
|
||||
cbl_t cbl_remove_file(char *file) {
|
||||
char name[256];
|
||||
int p;
|
||||
p = 0;
|
||||
while(p<256 && *(file+p) != ' ') {
|
||||
name[p] = *(file+p);
|
||||
p++;
|
||||
}
|
||||
name[p] = 0;
|
||||
if(unlink(&name[0])==0)
|
||||
return OK;
|
||||
return ERRO;
|
||||
}
|
||||
|
||||
cbl_t cbl_copy_dir(char *entrada, char *saida)
|
||||
{
|
||||
DIR *dir_a,*dir_b;
|
||||
struct dirent *arquivo;
|
||||
char *bufr, *bufs;
|
||||
//cbl_t d;
|
||||
|
||||
if(*entrada){
|
||||
if(cbl_align(entrada)==ERRO) return(1);
|
||||
if(cbl_align(saida)==ERRO) return(1);
|
||||
} else {
|
||||
return(ERRO);
|
||||
}
|
||||
|
||||
bufr = (char *) malloc(sizeof(char)*(strlen(entrada)+100));
|
||||
if(!bufr) {
|
||||
return(4);
|
||||
}
|
||||
|
||||
bufs = (char *) malloc(sizeof(char)*(strlen(saida) +100));
|
||||
if(!bufs) {
|
||||
return(4);
|
||||
}
|
||||
|
||||
if ( (dir_a = opendir(entrada)) == NULL ) {
|
||||
return(2);
|
||||
}
|
||||
|
||||
if((dir_b = opendir(saida)) != NULL) {
|
||||
closedir(dir_a);
|
||||
closedir(dir_b);
|
||||
return(3);
|
||||
}
|
||||
else {
|
||||
cbl_create_dir(saida,0766);
|
||||
while( (arquivo=readdir(dir_a)) ) {
|
||||
strcpy(bufr,saida);
|
||||
strcpy(bufs,entrada);
|
||||
strcat(bufr,cbl_BARRA);
|
||||
strcat(bufs,cbl_BARRA);
|
||||
if( !strcmp(arquivo->d_name,".") ) {
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if( !strcmp(arquivo->d_name,"..") ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
strcat(bufr,arquivo->d_name);
|
||||
strcat(bufs,arquivo->d_name);
|
||||
cbl_copy_file(bufs,bufr);
|
||||
}
|
||||
}
|
||||
closedir(dir_a);
|
||||
free(bufr);
|
||||
free(bufs);
|
||||
return(OK);
|
||||
}
|
||||
|
||||
cbl_t cbl_create_dir(char *dados, int mode)
|
||||
{
|
||||
DIR *dir;
|
||||
|
||||
if(*dados) {
|
||||
if(cbl_align(dados)==ERRO){ return(1); }
|
||||
}
|
||||
else {
|
||||
return(1);
|
||||
}
|
||||
|
||||
if( (dir = opendir(dados)) != NULL ) {
|
||||
return ERRO;
|
||||
}
|
||||
|
||||
// Nilo, 23rd april 2007
|
||||
// Aparently MINGW doesn't accept two parameters for mkdir....
|
||||
// if(mkdir(dados, mode) == -1){
|
||||
if(mkdir(dados) == -1) {
|
||||
return ERRO;
|
||||
}
|
||||
|
||||
chmod(dados,mode);
|
||||
|
||||
return(OK);
|
||||
}
|
||||
|
||||
cbl_t cbl_delete_dir(char *dados)
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *file;
|
||||
|
||||
if(*dados) {
|
||||
if(cbl_align(dados)==ERRO) {
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return(1);
|
||||
}
|
||||
|
||||
if( (dir = opendir(dados)) == NULL) {
|
||||
return(2);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
if( rmdir(dados) == 0 ) { /* Nao existe nada no diretorio */
|
||||
return(OK);
|
||||
}
|
||||
else { /* Aqui existe arquivos no diretorio
|
||||
* entao sao apagados e ai depois apaga
|
||||
* o diretorio.
|
||||
*/
|
||||
dir = opendir(dados);
|
||||
while( (file = readdir(dir)) ) {
|
||||
chdir(dados);
|
||||
cbl_delete_file(file->d_name);
|
||||
}
|
||||
closedir(dir);
|
||||
chdir("..");
|
||||
if ( rmdir(dados) != 0 ) {
|
||||
return(ERRO);
|
||||
}
|
||||
}
|
||||
|
||||
return(OK);
|
||||
}
|
||||
|
||||
cbl_t cbl_move_dir(char *origem, char *destino)
|
||||
{
|
||||
DIR *dir;
|
||||
//cbl_t d;
|
||||
|
||||
if ( (!*origem) || (!*destino) ) {
|
||||
return(1);
|
||||
}
|
||||
|
||||
if ( cbl_align(origem) == ERRO ) {
|
||||
return(1);
|
||||
}
|
||||
|
||||
if ( cbl_align(destino) == ERRO ) {
|
||||
return(1);
|
||||
}
|
||||
|
||||
if ( (dir = opendir(destino)) != NULL ) {
|
||||
closedir(dir);
|
||||
return(ERRO);
|
||||
}
|
||||
|
||||
if ( cbl_copy_dir(origem,destino) == OK ) {
|
||||
if( cbl_delete_dir(origem) != OK ) {
|
||||
return(ERRO);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return(ERRO);
|
||||
}
|
||||
|
||||
return(OK);
|
||||
}
|
||||
|
||||
cbl_t cbl_change_dir(char *path) {
|
||||
if ( cbl_align(path) != 0 ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( chdir(path) != 0 ) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cbl_get_current_dir(char *path, cbl_t *retorno) {
|
||||
*retorno = 0;
|
||||
|
||||
if ( getcwd(path, 1024) == NULL ) {
|
||||
*retorno = 1;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,408 @@
|
||||
/*
|
||||
* Copyright (C) 2003 Wesley Oliveira, Aline Oliveira, Hudson Reis,
|
||||
* Husni Ali Husni.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1,
|
||||
* or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING.LIB. If
|
||||
* not, write to the Free Software Foundation, Inc., 59 Temple Place,
|
||||
* Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include "globals.h"
|
||||
|
||||
#ifndef MAXLINE
|
||||
#define MAXLINE 1024
|
||||
#define MINLINE 256
|
||||
#endif
|
||||
|
||||
#if defined(SunOS)
|
||||
#include <curses.h>
|
||||
#else
|
||||
# if defined(__CYGWIN__)
|
||||
# include <ncurses/ncurses.h>
|
||||
# else
|
||||
# if defined(__MINGW32__)
|
||||
# include <curses.h> //# include <pdcurses.h>
|
||||
# else
|
||||
# include <curses.h>
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
char cobpri[MAXLINE], cobpro[MAXLINE];
|
||||
|
||||
struct cbl_stream {
|
||||
char path[MAXLINE];
|
||||
FILE *fd;
|
||||
int handle;
|
||||
} cbl_stream[MAXLINE];
|
||||
|
||||
/* Prototypes */
|
||||
|
||||
cbl_t cbl_copy_file(char *entrada, char *saida);
|
||||
cbl_t cbl_rename_file(char *old, char *new);
|
||||
cbl_t cbl_delete_file(char *arquivo);
|
||||
cbl_t cbl_check_file_exist(char *arquivo);
|
||||
cbl_t cbl_move_file(char *origem,char *destino);
|
||||
void cbl_open_file(char *arquivo,char *access_mode,
|
||||
char *deny_mode, int file_handle,
|
||||
cbl_t *retorno);
|
||||
void cbl_create_file(char *arquivo, unsigned char *access_mode,
|
||||
unsigned char *deny_mode, char file_handle[5],
|
||||
cbl_t *retorno);
|
||||
cbl_t cbl_close_file(int file_handle);
|
||||
cbl_t cbl_flush_file(int file_handle);
|
||||
void cbl_read_file(int file_handle, int number_bytes,
|
||||
char *buffer_read, cbl_t *retorno);
|
||||
void cbl_write_file(int file_handle,int number_bytes,char *buffer_writed,cbl_t *retorno);
|
||||
|
||||
/* Functions */
|
||||
|
||||
cbl_t cbl_copy_file(char *entrada, char *saida) {
|
||||
FILE *fd_in, *fd_out;
|
||||
int c,valor;
|
||||
|
||||
if ( cbl_align(entrada) != 0 ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( cbl_align(saida) != 0 ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( (valor=cbl_parm(entrada,saida)) == -2 ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( valor == 1 ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( (fd_in = fopen(cobpri,"rb")) == NULL ) {
|
||||
return 3;
|
||||
}
|
||||
else {
|
||||
if ( (fd_out=fopen(cobpro,"wb")) == NULL ) {
|
||||
fclose(fd_in);
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
while ( (c = fgetc(fd_in)) != EOF ) {
|
||||
fputc(c,fd_out);
|
||||
}
|
||||
|
||||
#ifdef __MSVCRT__
|
||||
chmod(cobpro,0666);
|
||||
#else
|
||||
cbl_get_per(cobpro);
|
||||
#endif
|
||||
|
||||
fclose(fd_in);
|
||||
fclose(fd_out);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
cbl_t cbl_rename_file(char *old, char *new) {
|
||||
int valor;
|
||||
|
||||
if ( cbl_align(old) != 0 ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cbl_align(new) != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
valor = cbl_parm(old,new);
|
||||
|
||||
if(valor == 1) {
|
||||
return valor;
|
||||
}
|
||||
|
||||
if (rename(cobpri,cobpro) == 0) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
cbl_t cbl_delete_file(char *arquivo) {
|
||||
int valor;
|
||||
|
||||
if ( cbl_align(arquivo) != 0 ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( (valor=cbl_parm(arquivo,""))== -2 ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( valor == 1 ) {
|
||||
return valor;
|
||||
}
|
||||
|
||||
chdir(cobpri);
|
||||
|
||||
if (remove(cobpri) != 0) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
cbl_t cbl_check_file_exist(char *arquivo) {
|
||||
int valor;
|
||||
//DIR *dir;
|
||||
|
||||
if (cbl_align(arquivo) != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
valor = cbl_parm(arquivo,"");
|
||||
|
||||
if ( opendir(cobpri) != NULL ) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if ( access(cobpri,F_OK) != 0 ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
cbl_t cbl_move_file(char *origem, char *destino) {
|
||||
int valor;
|
||||
|
||||
if ( cbl_align(origem) != 0 ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( cbl_align(destino) != 0 ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
valor = cbl_parm(origem,destino);
|
||||
|
||||
if ( valor == 1 ) {
|
||||
return valor;
|
||||
}
|
||||
|
||||
if (cbl_copy_file(cobpri,cobpro) == 0) {
|
||||
if (cbl_delete_file(cobpri) != 0) {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 3;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cbl_open_file(char *arquivo, char *access_mode,
|
||||
char *deny_mode,int file_handle,
|
||||
cbl_t *retorno) {
|
||||
register int i;
|
||||
int valor;
|
||||
|
||||
cbl_align(arquivo);
|
||||
cbl_align(access_mode);
|
||||
cbl_align(deny_mode);
|
||||
valor=cbl_parm(arquivo,"");
|
||||
// if(valor == 1) { return valor; } walter
|
||||
if ( valor == 1 ) {
|
||||
*retorno = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !strcmp(access_mode,deny_mode) ) {
|
||||
*retorno = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
for ( i=1 ; i<MAXLINE ; i++ ) {
|
||||
if ( !cbl_stream[i].fd ) {
|
||||
cbl_stream[i].handle=i;
|
||||
if ( (cbl_stream[i].fd = fopen(cobpri,access_mode) ) == NULL ) {
|
||||
*retorno = 1;
|
||||
}
|
||||
strcpy(cbl_stream[i].path,cobpri);
|
||||
*retorno=0;
|
||||
file_handle=cbl_stream[i].handle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cbl_read_file(int file_handle,int number_bytes,char *buffer_read, cbl_t *retorno) {
|
||||
*retorno = 0;
|
||||
|
||||
if ( fread(buffer_read,sizeof(char),number_bytes,cbl_stream[file_handle].fd) == 0 ) {
|
||||
*retorno = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void cbl_write_file(int file_handle, int number_bytes,char *buffer_writed, cbl_t *retorno) {
|
||||
*retorno = 0;
|
||||
|
||||
if( fwrite(buffer_writed,sizeof(char),number_bytes,cbl_stream[file_handle].fd) != number_bytes ) {
|
||||
*retorno = 1;
|
||||
}
|
||||
}
|
||||
|
||||
cbl_t cbl_close_file(int file_handle) {
|
||||
register int i;
|
||||
|
||||
fclose(cbl_stream[file_handle].fd);
|
||||
|
||||
for ( i=0 ; i<MAXLINE ; i++ ) {
|
||||
cbl_stream[file_handle].path[i]=' ';
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
cbl_t cbl_flush_file(int file_handle) {
|
||||
fflush(cbl_stream[file_handle].fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// show file
|
||||
void show(char *arquivo) {
|
||||
FILE *file;
|
||||
char line[1025];
|
||||
unsigned int max_col, max_lines, p, fline, fcol, ncol, pnt;
|
||||
char *text, *c, *narq;
|
||||
int show, ca;
|
||||
|
||||
// copy the filename
|
||||
narq = malloc(sizeof(char) * 256); *narq = 0;
|
||||
c = arquivo;
|
||||
p = 0;
|
||||
|
||||
while ( *(c+p) != ' ') {
|
||||
*(narq+p) = *(c+p);
|
||||
p++;
|
||||
}
|
||||
|
||||
*(narq+p) = 0;
|
||||
|
||||
// How many lines and the gratest line ?
|
||||
file = fopen(narq, "r");
|
||||
|
||||
if ( !file )
|
||||
return;
|
||||
|
||||
max_col = 0;
|
||||
max_lines = 0;
|
||||
fgets(line, 1024, file);
|
||||
while ( !feof(file) ) {
|
||||
if(strlen(line) > max_col)
|
||||
max_col = strlen(line);
|
||||
max_lines++;
|
||||
fgets(line, 1024, file);
|
||||
}
|
||||
fclose(file);
|
||||
|
||||
file = fopen(narq, "r");
|
||||
|
||||
// Alloc memory to put text
|
||||
text = malloc( (sizeof(char) * ( max_col * max_lines )) + 128 );
|
||||
*text = 0;
|
||||
memset(text, ' ', (sizeof(char) * ( max_col * max_lines )) + 128);
|
||||
fgets(line, 1024, file);
|
||||
|
||||
p = 0;
|
||||
while ( !feof(file) ) {
|
||||
memcpy(text + p, line, strlen(line));
|
||||
p += max_col;
|
||||
fgets(line, 1024, file);
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
|
||||
// show the file
|
||||
fline = 0;
|
||||
fcol = 0;
|
||||
ncol = 80;
|
||||
|
||||
if(ncol > max_col)
|
||||
ncol = max_col;
|
||||
|
||||
show = 1;
|
||||
while(show) {
|
||||
p = 0;
|
||||
while( (fline + p) < max_lines && p < 24) {
|
||||
move(p, 0);
|
||||
pnt = ( (fline + p) * max_col ) + fcol;
|
||||
addnstr(text + pnt, ncol);
|
||||
p++;
|
||||
}
|
||||
|
||||
move(0, 0);
|
||||
ca = getch();
|
||||
|
||||
switch(ca) {
|
||||
case 'i':
|
||||
case 'I':
|
||||
fline = 0;
|
||||
fcol = 0;
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
case 'A':
|
||||
if ( fline > 0 )
|
||||
fline--;
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
case 'Z':
|
||||
if ( fline < (max_lines - 24) )
|
||||
fline++;
|
||||
break;
|
||||
|
||||
case ',':
|
||||
if ( fcol > 0 )
|
||||
fcol--;
|
||||
break;
|
||||
|
||||
case '.':
|
||||
if ( fcol < (max_col - 80) )
|
||||
fcol++;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
case 'F':
|
||||
show = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Return to the application
|
||||
free(text);
|
||||
free(narq);
|
||||
|
||||
return;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,305 @@
|
||||
/*
|
||||
* Copyright (C) 2003 Hudson Reis, Wesley Oliveira, Aline Oliveira.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1,
|
||||
* or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING.LIB. If
|
||||
* not, write to the Free Software Foundation, Inc., 59 Temple Place,
|
||||
* Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* COB internal routines */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifndef MAXLINE
|
||||
#define MAXLINE 1024
|
||||
#define MINLINE 256
|
||||
#endif
|
||||
|
||||
#ifdef __MSVCRT__
|
||||
#define BARRA '\\'
|
||||
#define COBARRA "\\"
|
||||
#else
|
||||
#define BARRA '/'
|
||||
#define COBARRA "/"
|
||||
#endif
|
||||
|
||||
|
||||
struct globals{
|
||||
char cobprin[MAXLINE];
|
||||
char cobprou[MAXLINE];
|
||||
char tmpin[MAXLINE];
|
||||
char tmpou[MAXLINE];
|
||||
char *home;
|
||||
char *pwd;
|
||||
char *var;
|
||||
int gper;
|
||||
int uper;
|
||||
int per;
|
||||
};
|
||||
|
||||
struct globals var;
|
||||
|
||||
extern char cobpri[MAXLINE], cobpro[MAXLINE];
|
||||
|
||||
|
||||
int cbl_get_per(char *str)
|
||||
{
|
||||
struct stat fd;
|
||||
int id;
|
||||
|
||||
|
||||
id=0;
|
||||
if((stat(str,&fd))==-1){ return 1; }
|
||||
if(access(str,R_OK)==0) id+=4;
|
||||
if(access(str,W_OK)==0) id+=2;
|
||||
if(access(str,X_OK)==0) id++;
|
||||
if(access(str,X_OK)==0){
|
||||
if(id == 6) id+=1;
|
||||
if(id == 4) id+=1;
|
||||
if(id == 2) id+=1;
|
||||
}
|
||||
|
||||
switch(id){
|
||||
case 7: chmod(str,0751);
|
||||
break;
|
||||
case 6: chmod(str,0644);
|
||||
break;
|
||||
case 5: chmod(str,0551);
|
||||
break;
|
||||
case 4: chmod(str,0444);
|
||||
break;
|
||||
case 3: chmod(str,0311);
|
||||
break;
|
||||
default: chmod(str,0666);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cbl_get(char *str)
|
||||
{
|
||||
if(!strcmp(str,"HOME"))
|
||||
var.home = getenv(str);
|
||||
else if(!strcmp(str,"PWD"))
|
||||
var.pwd = getenv(str);
|
||||
else
|
||||
var.var = getenv(str);
|
||||
}
|
||||
|
||||
void cbl_clear(int valor)
|
||||
{
|
||||
register int i;
|
||||
|
||||
if(valor == 1){
|
||||
for(i=0;i<=MAXLINE;i++){
|
||||
var.cobprin[i]='\0';
|
||||
var.cobprou[i]='\0';
|
||||
}
|
||||
}
|
||||
else if(valor == 2){
|
||||
for(i=0;i<=MAXLINE;i++){
|
||||
var.tmpou[i]='\0';
|
||||
}
|
||||
}
|
||||
else if(valor == 3){
|
||||
for(i=0;i<=MAXLINE;i++){
|
||||
var.cobprou[i]=' ';
|
||||
}
|
||||
var.cobprou[i]='\0';
|
||||
}
|
||||
else if(valor == 4){
|
||||
for(i=0;i<=MAXLINE;i++){
|
||||
var.cobprin[i]=' ';
|
||||
}
|
||||
var.cobprin[i]='\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int cbl_copy(void)
|
||||
{
|
||||
FILE *fd_in, *fd_ou;
|
||||
int c;
|
||||
DIR *dir,*dit;
|
||||
struct dirent *data;
|
||||
|
||||
strcpy(var.tmpin,var.cobprin);
|
||||
strcpy(var.tmpou,var.cobprou);
|
||||
|
||||
if((dir=opendir(var.cobprin))==NULL) { return -1; }
|
||||
else{
|
||||
chdir(var.cobprin);
|
||||
while ( (data=readdir(dir)) ) {
|
||||
if((dit=opendir(data->d_name))!=NULL){
|
||||
closedir(dit);
|
||||
continue;
|
||||
}
|
||||
cbl_clear(1);
|
||||
strcpy(var.cobprou,var.tmpou);
|
||||
strcat(var.cobprou,COBARRA);
|
||||
strcat(var.cobprin,data->d_name);
|
||||
strcat(var.cobprou,data->d_name);
|
||||
|
||||
|
||||
if((fd_in=fopen(var.cobprin,"rb"))==NULL) break;
|
||||
if((fd_ou=fopen(var.cobprou,"wb"))==NULL){
|
||||
fclose(fd_in);
|
||||
break;
|
||||
}
|
||||
else{
|
||||
while((c=getc(fd_in))!=EOF){
|
||||
putc(c,fd_ou);
|
||||
}
|
||||
fclose(fd_in);
|
||||
fclose(fd_ou);
|
||||
cbl_get_per(var.cobprou);
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
return 0; // why this shit returns an int???
|
||||
}
|
||||
|
||||
|
||||
int cbl_test(char *str,char *sts)
|
||||
{
|
||||
int valor=0;
|
||||
char data[MAXLINE];
|
||||
register int i = 0;
|
||||
register int e = 0;
|
||||
DIR *dir;
|
||||
|
||||
if(strstr(str,"~")){
|
||||
cbl_get("HOME");
|
||||
for(i=0,e=0;i<=MAXLINE;i++){
|
||||
if(str[i] == '~') continue;
|
||||
data[e] = str[i];
|
||||
e++;
|
||||
}
|
||||
data[e] = '\0';
|
||||
strcpy(var.tmpin,var.home);
|
||||
strcat(var.tmpin,data);
|
||||
strcpy(var.cobprin,var.tmpin);
|
||||
valor++;
|
||||
}
|
||||
else{
|
||||
cbl_clear(4);
|
||||
strcpy(var.cobprin,str);
|
||||
valor++;
|
||||
}
|
||||
|
||||
|
||||
if(strstr(sts,"~")){
|
||||
cbl_get("HOME");
|
||||
for(i=0,e=0;i<=MAXLINE;i++){
|
||||
if(sts[i] == '~') continue;
|
||||
data[e] = sts[i];
|
||||
e++;
|
||||
}
|
||||
data[e] = '\0';
|
||||
strcpy(var.tmpou,var.home);
|
||||
strcat(var.tmpou,data);
|
||||
strcpy(var.cobprou,var.tmpou);
|
||||
if(var.cobprou[(strlen(var.cobprou))] == BARRA)
|
||||
var.cobprou[(strlen(var.cobprou))] = '\0';
|
||||
valor++;
|
||||
}
|
||||
else {
|
||||
cbl_clear(3);
|
||||
strcpy(var.cobprou,sts);
|
||||
valor++;
|
||||
}
|
||||
|
||||
if(strstr(var.cobprin,"*")){
|
||||
if((dir=opendir(var.cobprou))==NULL) { return valor; }
|
||||
else{
|
||||
var.cobprin[(strlen(var.cobprin)-1)] = '\0';
|
||||
closedir(dir);
|
||||
cbl_copy();
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
if((dir=opendir(var.cobprou))!=NULL){
|
||||
for(i=strlen(var.cobprin);i>0;i--){
|
||||
if(var.cobprin[i] == BARRA){
|
||||
e = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(i=(strlen(var.cobprou));e<=strlen(var.cobprin);i++,e++){
|
||||
var.cobprou[i]=var.cobprin[e];
|
||||
}
|
||||
var.cobprou[i] = '\0';
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
return valor;
|
||||
}
|
||||
|
||||
int cbl_parm(char *str,char *sts)
|
||||
{
|
||||
register int v,i;
|
||||
|
||||
if ( (v=cbl_test(str,sts)) != 0 ) {
|
||||
if ( v == -2 ) {
|
||||
return v;
|
||||
}
|
||||
|
||||
if ( access(var.cobprin,F_OK) != 0 ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( !strcmp(var.cobprin,var.cobprou) ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
for ( i=0 ; i<=MAXLINE ; i++ ) {
|
||||
cobpri[i] = ' ';
|
||||
cobpro[i] = ' ';
|
||||
}
|
||||
|
||||
cobpri[i]='\0';
|
||||
cobpro[i]='\0';
|
||||
strcpy(cobpri,var.cobprin);
|
||||
strcpy(cobpro,var.cobprou);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cbl_align(char *data) {
|
||||
int i=0;
|
||||
if ((strlen(data) == 0)) {
|
||||
return 1;
|
||||
} else {
|
||||
for (i=(strlen(data));i>=0;i--) {
|
||||
if (data[i] != ' ' && data[i] != '\0') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
data[i+1] = '\0';
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2003 Hudson Reis.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1,
|
||||
* or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING.LIB. If
|
||||
* not, write to the Free Software Foundation, Inc., 59 Temple Place,
|
||||
* Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* Global Parameters */
|
||||
|
||||
|
||||
/* Header for COB internal routines */
|
||||
|
||||
typedef unsigned int cbl_t;
|
||||
|
||||
int cbl_parm(char *str,char *sts);
|
||||
int cbl_align(char *data);
|
||||
int cbl_get_per(char *str);
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,798 @@
|
||||
/*
|
||||
* Copyright (C) 2003 Ferran Pegueroles, Hudson Reis.
|
||||
*.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1,
|
||||
* or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING.LIB. If
|
||||
* not, write to the Free Software Foundation, Inc., 59 Temple Place,
|
||||
* Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* Screen routines */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
# include <curses.h>
|
||||
# include "mwindows.h"
|
||||
#else
|
||||
# include <termios.h>
|
||||
# include <ncurses.h>
|
||||
#endif
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
#include <unistd.h> // for read()
|
||||
|
||||
struct screenArea {
|
||||
char initLine;
|
||||
char initColumn;
|
||||
char endLine;
|
||||
char endColumn;
|
||||
} *screenArea;
|
||||
|
||||
struct screenposition {
|
||||
short line;
|
||||
short column;
|
||||
} *screenposition;
|
||||
|
||||
char *windows[99];
|
||||
|
||||
struct windpos {
|
||||
unsigned char id, fu, ls, ce, nl, tl, atr;
|
||||
char dados[4000];
|
||||
} *windpos;
|
||||
|
||||
struct windmenu {
|
||||
unsigned char id, fu, ls, ce, nl, tl, atr, nlm, tlm, rtm;
|
||||
char dados[4000];
|
||||
} *windmenu;
|
||||
|
||||
int lastWindow = -1;
|
||||
|
||||
bool initColor = 0;
|
||||
|
||||
/* Prototypes */
|
||||
|
||||
/* Functions */
|
||||
|
||||
//cbl_t cbl_clear_scr(void) {
|
||||
// clear();
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
//void cbl_get_csr_pos(int *x, int *y, int *retorno) {
|
||||
// getsyx((int)*y,(int)*x);
|
||||
// printf("Y: %d\n", *y);
|
||||
// printf("X: %d\n", *x);
|
||||
// *retorno = 0;
|
||||
//}
|
||||
|
||||
//cbl_t cbl_get_kbd_status(void) {
|
||||
// nodelay(stdscr,TRUE);
|
||||
// timeout(10);
|
||||
// return(getch());
|
||||
//}
|
||||
|
||||
//cbl_t cbl_read_kbd_char(void) {
|
||||
// return (getch());
|
||||
//}
|
||||
|
||||
/*----------------------------------------------------------------------------------------
|
||||
|
||||
Routine: cbl_save_screen
|
||||
|
||||
Purpose: Saves all screen contents on a user program buffer.
|
||||
|
||||
----------------------------------------------------------------------------------------*/
|
||||
void cbl_save_screen( chtype *buffer ) {
|
||||
int l = 0;
|
||||
int c = 0;
|
||||
int i = 0;
|
||||
|
||||
for ( l = 0 ; l < 24 ; l++ )
|
||||
for ( c = 0 ; c < 80 ; c++ )
|
||||
buffer[i++] = mvinch(l,c);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------------------
|
||||
|
||||
Routine: cbl_restore_screen
|
||||
|
||||
Purpose: Restores all screen contents from a user program buffer.
|
||||
|
||||
----------------------------------------------------------------------------------------*/
|
||||
void cbl_restore_screen( chtype *buffer ) {
|
||||
int l = 0;
|
||||
int c = 0;
|
||||
int i = 0;
|
||||
chtype k;
|
||||
|
||||
for ( l = 0 ; l < 24 ; l++ )
|
||||
for ( c = 0 ; c < 80 ; c++ ) {
|
||||
k = buffer[i++];
|
||||
attron( (k & A_ATTRIBUTES) | (k & A_COLOR) );
|
||||
mvaddch(l, c, (k & A_CHARTEXT));
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------------------
|
||||
|
||||
Routine: cbl_save_partial_screen
|
||||
|
||||
Purpose: Saves a screen portion's contents on a user program buffer.
|
||||
|
||||
----------------------------------------------------------------------------------------*/
|
||||
void cbl_save_partial_screen( struct screenArea *screenArea , chtype *buffer ) {
|
||||
int l = 0;
|
||||
int c = 0;
|
||||
int i = 0;
|
||||
|
||||
int initLine = (int)screenArea->initLine;
|
||||
int initCol = (int)screenArea->initColumn;
|
||||
int endLine = (int)screenArea->endLine;
|
||||
int endCol = (int)screenArea->endColumn;
|
||||
|
||||
// mvprintw(23,0,"OnSave: %d %d %d %d",initLine,initCol,endLine,endCol);
|
||||
// getch();
|
||||
// refresh();
|
||||
|
||||
for ( l = initLine-1 ; l < endLine ; l++ )
|
||||
for ( c = initCol-1 ; c < endCol ; c++ )
|
||||
buffer[i++] = mvinch(l,c);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------------------
|
||||
|
||||
Routine: cbl_restore_partial_screen
|
||||
|
||||
Purpose: Restores a screen portion's contents from a user program buffer.
|
||||
|
||||
----------------------------------------------------------------------------------------*/
|
||||
void cbl_restore_partial_screen( struct screenArea *screenArea , chtype *buffer ) {
|
||||
int l = 0;
|
||||
int c = 0;
|
||||
int i = 0;
|
||||
chtype k;
|
||||
|
||||
int initLine = (int)screenArea->initLine;
|
||||
int initCol = (int)screenArea->initColumn;
|
||||
int endLine = (int)screenArea->endLine;
|
||||
int endCol = (int)screenArea->endColumn;
|
||||
|
||||
// mvprintw(23,0,"OnRestore: %d %d %d %d",initLine,initCol,endLine,endCol);
|
||||
// getch();
|
||||
// refresh();
|
||||
|
||||
for ( l = initLine-1 ; l < endLine ; l++ )
|
||||
for ( c = initCol-1 ; c < endCol ; c++ ) {
|
||||
k = buffer[i++];
|
||||
attron( (k & A_ATTRIBUTES) | (k & A_COLOR) );
|
||||
mvaddch(l, c, (k & A_CHARTEXT));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void cbl_read_scr_chars (struct posicaotela *posicao,
|
||||
char *buffer_caracteres,
|
||||
short *buffer_tamanho,
|
||||
int *retorno)
|
||||
{
|
||||
printf("Reading scr chars...\n");
|
||||
int y, x, i, t;
|
||||
*retorno = 0;
|
||||
posicaotela = posicao;
|
||||
x = posicao->coluna;
|
||||
y = posicao->linha;
|
||||
t = *buffer_tamanho - x;
|
||||
memset(buffer_caracteres,' ',t);
|
||||
for (i=(x-1);i<=t;i++) {
|
||||
buffer_caracteres[i] = mvinch(y,i) & A_CHARTEXT;
|
||||
}
|
||||
}
|
||||
|
||||
void cbl_read_scr_attrs (struct posicaotela *posicao,
|
||||
char *buffer_atributos,
|
||||
short *buffer_tamanho,
|
||||
int *retorno)
|
||||
{
|
||||
int y, x, i, t;
|
||||
*retorno = 0;
|
||||
posicaotela = posicao;
|
||||
x = posicao->coluna;
|
||||
y = posicao->linha;
|
||||
t = *buffer_tamanho - x;
|
||||
memset(buffer_atributos,' ',t);
|
||||
for (i=(x-1);i<=t;i++) {
|
||||
buffer_atributos[i] = mvinch(y,i) & A_ATTRIBUTES;
|
||||
}
|
||||
}
|
||||
|
||||
void cbl_read_scr_chattrs (struct posicaotela *posicao,
|
||||
char *buffer_caracteres,
|
||||
char *buffer_atributos,
|
||||
short *buffer_tamanho,
|
||||
int *retorno)
|
||||
{
|
||||
chtype k;
|
||||
int y, x, i, t, c;
|
||||
*retorno = 0;
|
||||
posicaotela = posicao;
|
||||
x = posicao->coluna;
|
||||
y = posicao->linha;
|
||||
memset(buffer_atributos, ' ',*buffer_tamanho * 2);
|
||||
memset(buffer_caracteres,' ',*buffer_tamanho);
|
||||
i = 0, t = 0, c = 0;
|
||||
while(i++ < *buffer_tamanho) {
|
||||
k = mvinch(y, x);
|
||||
buffer_caracteres[c++] = (k & A_CHARTEXT);
|
||||
buffer_atributos[t++] = (k & A_ATTRIBUTES)/65536;
|
||||
//buffer_atributos[t++] = k & A_COLOR;
|
||||
buffer_atributos[t++] = (k & A_COLOR)/256;
|
||||
//printf("color on read:%d\n",(char)((k & A_COLOR)/256));
|
||||
mvprintw(1,1,"col:%d lin:%d char:%c color:%d",x,y,(k & A_CHARTEXT),(k & A_COLOR)/256); refresh(); getch(); refresh();
|
||||
x++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*----------------------------------------------------------------------------------------------
|
||||
|
||||
cbl_set_csr_pos
|
||||
|
||||
Sets the cursor position
|
||||
|
||||
----------------------------------------------------------------------------------------------*/
|
||||
//void cbl_set_csr_pos(int *x, int *y, int *retorno) {
|
||||
// *retorno = 0;
|
||||
// setsyx((int)*y,(int)*x);
|
||||
// move((int)*y,(int)*x);
|
||||
// refresh();
|
||||
//}
|
||||
/*
|
||||
void cbl_write_scr_attrs (struct posicaotela *posicao,
|
||||
char *buffer_atributos,
|
||||
short *buffer_tamanho,
|
||||
int *retorno)
|
||||
{
|
||||
printf("Writing scr attributes...\n");
|
||||
int y, x, i, t;
|
||||
*retorno = 0;
|
||||
posicaotela = posicao;
|
||||
x = posicao->coluna;
|
||||
y = posicao->linha;
|
||||
t = *buffer_tamanho + x;
|
||||
initscr();
|
||||
for (i=(x-1);i<=t;i++) {
|
||||
mvaddch(y, x, *buffer_atributos);
|
||||
x++;
|
||||
*buffer_atributos++;
|
||||
}
|
||||
// refresh();
|
||||
endwin();
|
||||
}
|
||||
|
||||
void cbl_write_scr_chars (struct posicaotela *posicao,
|
||||
char *buffer_caracteres,
|
||||
short *buffer_tamanho,
|
||||
int *retorno)
|
||||
{
|
||||
printf("Writing scr chars...\n");
|
||||
int y, x, i, t;
|
||||
*retorno = 0;
|
||||
posicaotela = posicao;
|
||||
x = posicao->coluna;
|
||||
y = posicao->linha;
|
||||
t = *buffer_tamanho + x;
|
||||
initscr();
|
||||
for (i=(x-1);i<=t;i++) {
|
||||
mvaddch(y, x, *buffer_caracteres);
|
||||
x++;
|
||||
*buffer_caracteres++;
|
||||
}
|
||||
// refresh();
|
||||
endwin();
|
||||
}
|
||||
|
||||
cbl_t cbl_write_scr_chars_attr(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cbl_write_scr_chattrs (struct posicaotela *posicao,
|
||||
char *buffer_caracteres,
|
||||
char *buffer_atributos,
|
||||
short *buffer_tamanho,
|
||||
int *retorno)
|
||||
{
|
||||
chtype k;
|
||||
int y, x, i, k1, c, att, cor;
|
||||
//addstr("to em cbl_write_scr_chattrs"); refresh(); getch(); refresh();
|
||||
*retorno = 0;
|
||||
posicaotela = posicao;
|
||||
x = posicao->coluna;
|
||||
y = posicao->linha;
|
||||
mvprintw(1,1,"col:%d lin:%d",x,y); refresh(); getch(); refresh();
|
||||
i = 0, c = 0;
|
||||
while(i < *buffer_tamanho) {
|
||||
att = ((int) *(buffer_atributos + (c++))) * 65536;
|
||||
cor = ((int) *(buffer_atributos + (c++))) * 256;
|
||||
cor = buffer_atributos[c++];
|
||||
k1 = *(buffer_caracteres + i);
|
||||
k1 += (k1<0?256:0);
|
||||
k = k1 | att | cor;
|
||||
mvaddch(y, x++, k);
|
||||
i++;
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
|
||||
cbl_t cbl_write_scr_n_attr(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
cbl_t cbl_write_scr_n_char(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
cbl_t cbl_write_scr_n_chattr(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
cbl_t cbl_write_scr_tty(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
cbl_t cbl_get_scr_type(void) {
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Implemented by Walter Garrote
|
||||
// garrote@dm.com.br
|
||||
// Brazil
|
||||
// Go��nia-Goi�s
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Obs: As subrotinas que manipulam acesso a video devem ser executadas
|
||||
// depois de ser chamado no programa cobol uma instru��o que fa�a a inicializa��o
|
||||
// da biblioteca ncurses. Se isso n�o ocorrer, teremos problema.
|
||||
|
||||
// inicia par de cores
|
||||
void cbl_windms_inicia_cor() {
|
||||
|
||||
int i;
|
||||
|
||||
if(initColor) // ja passamos por aqui;
|
||||
return;
|
||||
|
||||
if(has_colors()) { // temos suporte a cores
|
||||
start_color();
|
||||
for(i = 0; i < COLOR_PAIRS; i++)
|
||||
init_pair(i, i % COLORS, i / COLORS);
|
||||
}
|
||||
|
||||
initColor++;
|
||||
// na lib do tiny na parte de inicializacao de cores, n�o est� definido os pares
|
||||
// foi criada o par com fg e bg = 0
|
||||
}
|
||||
|
||||
// retorna cor de fundo e de frente usando o codigo de cor
|
||||
void cbl_windms_color_pair(short cor, short *fg, short *bg) {
|
||||
|
||||
if(cor == 0) // cor padrao 7 (frente branca, fundo preto)
|
||||
cor = 7;
|
||||
|
||||
*fg = cor % 8; // cor de frente
|
||||
*bg = cor / 8; // cor de fundo
|
||||
}
|
||||
|
||||
// retorna o codigo de cor usando cor de frente e de fundo
|
||||
short cbl_windms_monta_cor(short fg, short bg) {
|
||||
return ((bg * 8) + fg);
|
||||
}
|
||||
|
||||
// escreve na janela
|
||||
// para se pensar, podemos colocar um byte a mais como sendo o tipo do caracter (highlight, blink etc)
|
||||
void cbl_windms_escreve(struct windpos *lk) {
|
||||
|
||||
int y, x;
|
||||
short fg, bg, atr;
|
||||
char *dados = NULL;
|
||||
|
||||
switch(lk->fu) { // qual a funcao
|
||||
case 1:
|
||||
case 2: dados = windows[lk->id]; // posiciona na memoria alocada pelo subrotina
|
||||
break;
|
||||
case 10: dados = lk->dados; // estamos recebendo a tela via cobol
|
||||
atr = lk->atr;
|
||||
cbl_windms_color_pair(atr, &bg, &fg);
|
||||
attron(COLOR_PAIR(atr));
|
||||
break;
|
||||
}
|
||||
|
||||
move(lk->ls, lk->ce);
|
||||
refresh(); // apenas para garantir, caso haja um display antes
|
||||
for(y = lk->ls; y < (lk->ls + lk->nl); y++) { // escreve as linhas
|
||||
for(x = lk->ce; x < (lk->ce + lk->tl); x++) { // escreve as colunas
|
||||
if(*dados == '~') { // mudanca de atributo
|
||||
dados++; // proxima posicao
|
||||
fg = (int) *(dados++) - 48; // cor de frente
|
||||
bg = (int) *(dados++) - 48; // cor de fundo
|
||||
atr = cbl_windms_monta_cor(fg, bg); // qual o par ?
|
||||
attron(COLOR_PAIR(atr)); // set atributo
|
||||
}
|
||||
mvaddch(y, x, *dados++);
|
||||
}
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
|
||||
// muda moldura da janela
|
||||
void cbl_windms_moldura(struct windpos *lk) {
|
||||
|
||||
int i;
|
||||
short fg, bg, atr;
|
||||
|
||||
atr = lk->atr;
|
||||
cbl_windms_color_pair(lk->atr, &fg, &bg);
|
||||
attron(COLOR_PAIR(atr));
|
||||
|
||||
mvaddch (lk->ls, lk->ce , ACS_ULCORNER); // canto esquerdo superior
|
||||
mvaddch (lk->ls, lk->ce + lk->tl - 1, ACS_URCORNER); // canto direito superior
|
||||
mvaddch (lk->ls + lk->nl - 1, lk->ce , ACS_LLCORNER); // canto esquerdo inferior
|
||||
mvaddch (lk->ls + lk->nl - 1, lk->ce + lk->tl - 1, ACS_LRCORNER); // canto direito inferior
|
||||
for(i = lk->ls + 1; i < lk->ls + lk->nl - 1; i++) {
|
||||
mvaddch(i, lk->ce , ACS_VLINE); // linha esquerda
|
||||
mvaddch(i, lk->ce + lk->tl - 1, ACS_VLINE); // linha direita
|
||||
}
|
||||
for(i = lk->ce + 1; i < lk->ce + lk->tl - 1; i++) {
|
||||
mvaddch(lk->ls, i , ACS_HLINE); // linha superior
|
||||
mvaddch(lk->ls + lk->nl - 1, i , ACS_HLINE); // linha inferior
|
||||
}
|
||||
refresh();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// muda cor da janela
|
||||
void cbl_windms_mudacor(struct windpos *lk) {
|
||||
|
||||
short fg, bg;
|
||||
|
||||
cbl_windms_color_pair(lk->atr, &fg, &bg);
|
||||
attron(COLOR_PAIR(lk->atr));
|
||||
|
||||
}
|
||||
|
||||
// guarda porcao da janela na memoria
|
||||
int cbl_windms_guarda(struct windpos *lk) {
|
||||
|
||||
int y, x, tamanho;
|
||||
short fg, bg, atr, oldatr; // variaveis auxiliares
|
||||
char *dados;
|
||||
|
||||
if(lastWindow == 99) // limite de janelas
|
||||
return -1;
|
||||
|
||||
tamanho = 4;
|
||||
for(y = lk->ls; y < lk->ls + lk->nl + 1; y++) // quantos bytes serao necessarios ?
|
||||
for(x = lk->ce; x < lk->ce + lk->tl + 1; x++) {
|
||||
atr = (mvinch(y, x) & A_ATTRIBUTES) / 256;
|
||||
if(atr != oldatr) {
|
||||
tamanho += 3;
|
||||
oldatr = atr;
|
||||
}
|
||||
tamanho++;
|
||||
}
|
||||
|
||||
|
||||
lastWindow++; // janela a ser utilizada
|
||||
|
||||
windows[lastWindow] = (char *) malloc(sizeof(char) * tamanho); //(lk->nl * lk->tl * 3)); // ponteiro para memoria de video
|
||||
|
||||
dados = windows[lastWindow];
|
||||
|
||||
oldatr = 0;
|
||||
|
||||
for(y = lk->ls; y < lk->ls + lk->nl; y++) { // guarda janela
|
||||
for(x = lk->ce; x < lk->ce + lk->tl; x++) {
|
||||
atr = (mvinch(y, x) & A_ATTRIBUTES) / 256;
|
||||
if(atr != oldatr) {
|
||||
cbl_windms_color_pair(atr, &bg, &fg);
|
||||
*dados++ = '~';
|
||||
*dados++ = (char) ( ( atr % 8 ) + 48 );
|
||||
*dados++ = (char) ( ( atr / 8 ) + 48 );
|
||||
oldatr = atr;
|
||||
}
|
||||
*dados++ = mvinch(y, x) & A_CHARTEXT;
|
||||
}
|
||||
}
|
||||
|
||||
return lastWindow;
|
||||
}
|
||||
|
||||
// remove janela
|
||||
int cbl_windms_remove(struct windpos *lk) {
|
||||
|
||||
while(lastWindow >= lk->id)
|
||||
if(windows[lastWindow]) {
|
||||
if(lk->fu == 2) // restaura janela antes
|
||||
cbl_windms_escreve(lk);
|
||||
free(windows[lastWindow--]);
|
||||
}
|
||||
|
||||
return lastWindow;
|
||||
}
|
||||
|
||||
// auxilio na montagem do menu
|
||||
void cbl_windms_display_menu(struct windpos *lk, char *dados, int linha) {
|
||||
}
|
||||
|
||||
char * cbl_windms_pos(int nlm, int tlm, int l, int c, char *dad) {
|
||||
// int tc, l1, c1;
|
||||
// char *dat;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// menu pop
|
||||
int cbl_windms_menu(struct windpos *lk) {
|
||||
|
||||
//int t, y,
|
||||
|
||||
int tecla = 0, nlm, tlm, rtm;
|
||||
char *dad; //, *dat;
|
||||
struct windpos *lkm;
|
||||
|
||||
lkm = calloc(sizeof(struct windpos),0);
|
||||
|
||||
// parametros
|
||||
lkm->id = lk->id;
|
||||
lkm->ls = lk->ls;
|
||||
lkm->ce = lk->ce;
|
||||
lkm->nl = lk->nl;
|
||||
lkm->tl = lk->tl;
|
||||
dad = lk->dados;
|
||||
nlm = (int) *dad++;
|
||||
tlm = (int) *dad++;
|
||||
rtm = (int) *dad++;
|
||||
//t =
|
||||
//while(t>0) {
|
||||
// lkm->dados[y++]=*dad++;
|
||||
// t--;
|
||||
//}
|
||||
//lkm->dados = *dad;
|
||||
|
||||
lkm->fu = 11;
|
||||
cbl_windms_moldura(lkm); // moldura
|
||||
lkm->fu = 10;
|
||||
cbl_windms_escreve(lkm);
|
||||
cbl_windms_display_menu(lk, dad, rtm);
|
||||
|
||||
noecho();
|
||||
tecla = getch();
|
||||
|
||||
do {
|
||||
// switch(tecla) {
|
||||
// case 27: printf("27\n");
|
||||
// tecla = getch();
|
||||
// switch(tecla) {
|
||||
// case 79: tecla = getch();
|
||||
// break;
|
||||
// case 91: tecla = getch();
|
||||
// switch(tecla) {
|
||||
// case 49:
|
||||
// case 50:
|
||||
// case 51:
|
||||
// case 52:
|
||||
// case 53:
|
||||
// case 54: do {
|
||||
// tecla = getch();
|
||||
// } while(tecla != 126);
|
||||
// break;
|
||||
// }
|
||||
// break;
|
||||
// default: break;
|
||||
// }
|
||||
// break;
|
||||
// default: printf("oia %i,%c\n",tecla,tecla);
|
||||
// break;
|
||||
// }
|
||||
|
||||
move(5, 1); addch(32); refresh();
|
||||
switch(tecla) {
|
||||
case KEY_UP: printf("UP %i\t%c ",tecla,tecla);
|
||||
break;
|
||||
case KEY_DOWN: printf("Down %i\t%c ",tecla,tecla);
|
||||
break;
|
||||
case KEY_LEFT: printf("Left %i\t%c ",tecla,tecla);
|
||||
break;
|
||||
case KEY_RIGHT: printf("Right %i\t%c ",tecla,tecla);
|
||||
break;
|
||||
case KEY_HOME: printf("Home %i\t%c ",tecla,tecla);
|
||||
break;
|
||||
case KEY_END: printf("End %i\t%c ",tecla,tecla);
|
||||
break;
|
||||
case KEY_NPAGE: printf("Npage %i\t%c ",tecla,tecla);
|
||||
break;
|
||||
case KEY_PPAGE: printf("Ppage %i\t%c ",tecla,tecla);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
move(5, 1); addch(32); refresh();
|
||||
tecla = getch();
|
||||
} while(tecla != KEY_EXIT);
|
||||
|
||||
echo();
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
// funcao principal
|
||||
int windms(struct windpos *lk) {
|
||||
|
||||
struct windpos *lkaux;
|
||||
|
||||
// ajusta valores
|
||||
lkaux = (struct windpos *) malloc(sizeof(struct windpos));
|
||||
*lkaux = *lk;
|
||||
lkaux->ls--;
|
||||
lkaux->ce--;
|
||||
|
||||
cbl_windms_inicia_cor();
|
||||
|
||||
if( //(lkaux->ls < 0 || lkaux->ls > 24) || (lkaux->ce < 0 || lkaux->ce > 79) ||
|
||||
(lkaux->nl < 1 || lkaux->nl > 24) ||
|
||||
(lkaux->tl < 1 || lkaux->tl > 79)) // parametros errados
|
||||
return 0;
|
||||
|
||||
switch(lk->fu) {
|
||||
case 0: lk->id = cbl_windms_guarda(lkaux); // guarda janela
|
||||
break;
|
||||
case 2: // restaura janela
|
||||
case 3: lk->id = cbl_windms_remove(lkaux); // elimina janela sem restaurar
|
||||
break;
|
||||
case 1: // restaura janela
|
||||
case 10: cbl_windms_escreve(lkaux); // escreve janela
|
||||
break;
|
||||
case 11: cbl_windms_moldura(lkaux); // moldura a janela
|
||||
break;
|
||||
case 12: cbl_windms_mudacor(lkaux); // muda cor da janela
|
||||
break;
|
||||
case 13: cbl_windms_menu(lkaux); // menu
|
||||
getch();
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
// Function to allocate dinamyc memory
|
||||
// receive: pointer = pointer to memory allocated
|
||||
// size = size of memory to allocate
|
||||
// flags = only for compatibility
|
||||
// return: 0 = ok, memory allocated
|
||||
// 1 = error
|
||||
int cbl_alloc_mem(char **pointer, unsigned int size, unsigned int flagsmem ) {
|
||||
if((*pointer = (char *) malloc(sizeof(char) * size)))
|
||||
// memset(*pointer, 32, size); for compatibility, microfocus doesn�t initialize the memory allocated
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// free the memory previous allocated
|
||||
// receive: pointer
|
||||
// return: none
|
||||
void cbl_free_mem(char **pointer) {
|
||||
free(*pointer);
|
||||
}
|
||||
|
||||
// clear the window with character and attribute
|
||||
// receive: character = that will paint the screen
|
||||
// attribute = pair of attribute
|
||||
// return: none
|
||||
void cbl_clear_scr(short character, short atr) {
|
||||
int normal = A_NORMAL | character;
|
||||
cbl_windms_inicia_cor();
|
||||
if(has_colors())
|
||||
normal |= COLOR_PAIR(atr);
|
||||
bkgdset(normal);
|
||||
erase();
|
||||
return;
|
||||
}
|
||||
|
||||
// return the position of cursor
|
||||
// receive: structure with line and column
|
||||
// return: position of cursor
|
||||
void cbl_get_csr_pos(struct screenposition *scr) {
|
||||
getsyx(scr->line, scr->column);
|
||||
scr->line++; // adjust the line
|
||||
scr->column++; // adjust the column
|
||||
return;
|
||||
}
|
||||
|
||||
// return the state of keyboard
|
||||
// receive: none
|
||||
// return: state of keyboard : 0 none, 1 has key
|
||||
// modified from scr_curses
|
||||
void cbl_get_kbd_status(short *state) {
|
||||
int c;
|
||||
nodelay(stdscr,TRUE);
|
||||
c=getch();
|
||||
nodelay(stdscr,FALSE);
|
||||
if(c > 0) {
|
||||
ungetch(c);
|
||||
*state = 1;
|
||||
} else
|
||||
*state = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// return the size of screen
|
||||
// receive: none
|
||||
// return: depth and width
|
||||
void cbl_get_scr_size(short *depth, short *width) {
|
||||
getmaxyx(stdscr, *depth, *width);
|
||||
return;
|
||||
}
|
||||
|
||||
// return the character in keyboard buffer
|
||||
// receive: none
|
||||
// return: character
|
||||
//void cbl_read_kbd_char2(char *character) {
|
||||
// *character = (char) getch();
|
||||
// return;
|
||||
//}
|
||||
|
||||
void clr_clear_kbd_buffer() {
|
||||
nodelay(stdscr, TRUE);
|
||||
while( getch() != ERR );
|
||||
nodelay(stdscr,FALSE);
|
||||
}
|
||||
|
||||
//static struct termios initial_settings, new_settings;
|
||||
static int peek_character = -1;
|
||||
|
||||
void init_keyboard()
|
||||
{
|
||||
// tcgetattr(0,&initial_settings);
|
||||
// new_settings = initial_settings;
|
||||
// new_settings.c_lflag &= ~ICANON;
|
||||
// new_settings.c_lflag &= ~ECHO;
|
||||
// new_settings.c_lflag &= ~ISIG;
|
||||
// new_settings.c_cc[VMIN] = 1;
|
||||
// new_settings.c_cc[VTIME] = 0;
|
||||
// tcsetattr(0, TCSANOW, &new_settings);
|
||||
}
|
||||
|
||||
void close_keyboard()
|
||||
{
|
||||
// tcsetattr(0, TCSANOW, &initial_settings);
|
||||
}
|
||||
|
||||
int readch()
|
||||
{
|
||||
char ch;
|
||||
|
||||
if(peek_character != -1)
|
||||
{
|
||||
ch = peek_character;
|
||||
peek_character = -1;
|
||||
return ch;
|
||||
}
|
||||
read(0,&ch,1);
|
||||
return ch;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
/* test program for libpq (postgresql) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libpq-fe.h>
|
||||
|
||||
void
|
||||
sql_clear_query( int *qryhandle ) {
|
||||
PQclear((PGresult *)*qryhandle);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,35 @@
|
||||
/* test program for libpq (postgresql) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
#include <libpq-fe.h>
|
||||
|
||||
//void memmove(char *,char *,int);
|
||||
|
||||
void
|
||||
sql_connect_db( char *dbname, int *dbhandle, int *status ) {
|
||||
char *server, *user, *passwd;
|
||||
|
||||
server = (char *) getenv("PGSQL_SERVER");
|
||||
user = (char *) getenv("PGSQL_USER");
|
||||
passwd = (char *) getenv("PGSQL_PASSWD");
|
||||
|
||||
PGconn *conn;
|
||||
char db[81];
|
||||
char *s;
|
||||
/* trim right spaces on the buffer */
|
||||
memmove(db,dbname,80);
|
||||
db[80]=0;
|
||||
s = db+79;
|
||||
while ((s >= db) && (*s == ' ')) s--;
|
||||
if (s >= db)
|
||||
*(s+1)=0;
|
||||
// conn = PQsetdb("","","","",db);
|
||||
conn = PQsetdbLogin(server, "", "", "", db, user, passwd);
|
||||
|
||||
*status = PQstatus(conn);
|
||||
*dbhandle = (int)conn;
|
||||
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
/* test program for libpq (postgresql) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libpq-fe.h>
|
||||
|
||||
void
|
||||
sql_disconnect_db( int *dbhandle ) {
|
||||
PGconn *conn = (PGconn *)*dbhandle;
|
||||
PQfinish(conn);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
/* test program for libpq (postgresql) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libpq-fe.h>
|
||||
|
||||
/* this function assumes a command buffer of 80 characters */
|
||||
void
|
||||
sql_exec_query( int *dbhandle, char *query, int *qryhandle, int *status ) {
|
||||
char /* *r,*/ *s=query;
|
||||
//int nfields, i, j;
|
||||
PGconn *conn = (PGconn *)*dbhandle;
|
||||
PGresult *res;
|
||||
|
||||
/* detect end of query with 2 successive ';' */
|
||||
while ( *s != ';' || *(s+1) != ';' ) s++;
|
||||
*s=0;
|
||||
// linha abaixo causa mensagem do primary key
|
||||
res = PQexec(conn, query);
|
||||
*status = PQresultStatus(res);
|
||||
*qryhandle = (int) res;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
/* test program for libpq (postgresql) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libpq-fe.h>
|
||||
|
||||
void
|
||||
sql_free_memory( int *qryhandle ) {
|
||||
PQclear((PGresult *)*qryhandle);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,66 @@
|
||||
/* test program for libpq (postgresql) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libpq-fe.h>
|
||||
|
||||
void
|
||||
sql_get_tuple( int *qryhandle, int *ntuple, char *tuple ) {
|
||||
char *s;
|
||||
char *p;
|
||||
// danilo (
|
||||
Oid tipo;
|
||||
// danilo )
|
||||
int nfield=0;
|
||||
int maxfield = PQnfields((PGresult *)*qryhandle);
|
||||
while (nfield < maxfield) {
|
||||
s = PQgetvalue((PGresult *)*qryhandle,*ntuple,nfield);
|
||||
tipo = PQftype((PGresult *)*qryhandle, nfield);
|
||||
p = s;
|
||||
// 1700 numerico
|
||||
// 1043 string
|
||||
// 1231 occurs numerico
|
||||
// 1015 occurs string
|
||||
// comeca danilo
|
||||
if (tipo == 1231 || tipo == 1015) {
|
||||
p++;
|
||||
while (*p) {
|
||||
if (*p == ',') {
|
||||
*tuple++ = '#';
|
||||
*tuple++ = '%';
|
||||
} else
|
||||
if (*p == '}')
|
||||
break;
|
||||
else
|
||||
if (*p == '.' && tipo == 1231)
|
||||
*tuple++ = ',';
|
||||
else
|
||||
if (*p != '"')
|
||||
*tuple++ = *p;
|
||||
p++;
|
||||
}
|
||||
} else
|
||||
// termina danilo
|
||||
/* while (*p) {
|
||||
if (*p == '.') {
|
||||
*p= ',';
|
||||
break;
|
||||
}
|
||||
p++;
|
||||
} */
|
||||
if(*s){
|
||||
while (*s) {
|
||||
if (tipo == 1700 && *s == '.') {
|
||||
*tuple++ = ',';
|
||||
s++;
|
||||
} else
|
||||
*tuple++ = *s++;
|
||||
}
|
||||
} else
|
||||
*tuple++ = ' ';
|
||||
*tuple++ = '#';
|
||||
*tuple++ = '%';
|
||||
nfield++;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
/* test program for libpq (postgresql) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libpq-fe.h>
|
||||
|
||||
void
|
||||
sql_get_value( int *qryhandle, int *ntuple, int *nfield, char *value ) {
|
||||
char *s;
|
||||
s = PQgetvalue((PGresult *)*qryhandle,*ntuple,*nfield);
|
||||
while (*s) {
|
||||
if (*s == '\n') continue;
|
||||
*value++ = *s++;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
/* test program for libpq (postgresql) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libpq-fe.h>
|
||||
|
||||
void
|
||||
sql_max_field( int *qryhandle, int *maxfield ) {
|
||||
*maxfield = PQnfields((PGresult *)*qryhandle);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
/* test program for libpq (postgresql) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libpq-fe.h>
|
||||
|
||||
void
|
||||
sql_max_tuple( int *qryhandle, int *maxtuple ) {
|
||||
*maxtuple = PQntuples((PGresult *)*qryhandle);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
/* test program for libpq (postgresql) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libpq-fe.h>
|
||||
|
||||
void
|
||||
sql_status_message( int *dbhandle, char *message ) {
|
||||
PGconn *conn = (PGconn *)*dbhandle;
|
||||
char *s;
|
||||
s = PQerrorMessage(conn);
|
||||
while (*s) {
|
||||
*message++ = *s++;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2003 Hudson Reis, Husni Ali Husni.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1,
|
||||
* or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; see the file COPYING.LIB. If
|
||||
* not, write to the Free Software Foundation, Inc., 59 Temple Place,
|
||||
* Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* System routines */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
//#include <sys/utsname.h>
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
/* Structs */
|
||||
|
||||
#pragma pack(1)
|
||||
struct os_info {
|
||||
char kernel_name[256];
|
||||
char kernel_node[256];
|
||||
char kernel_release[256];
|
||||
char kernel_version[256];
|
||||
char kernel_machine[256];
|
||||
} *os_info;
|
||||
#pragma pack()
|
||||
|
||||
/* Prototypes */
|
||||
|
||||
/* Functions */
|
||||
|
||||
cbl_t cbl_call_system(char *programa) {
|
||||
|
||||
if (cbl_align(programa) != 0) { return 1; }
|
||||
if (system(programa) != 0) {
|
||||
return 2;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
cbl_t cblsys(char *programa) {
|
||||
|
||||
if (cbl_align(programa) != 0) { return 1; }
|
||||
if (system(programa) != 0) {
|
||||
return 2;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void cbl_get_os_info(struct os_info *os) {
|
||||
os_info = os;
|
||||
//uname(os_info);
|
||||
// printf("All: %s\n", os_info);
|
||||
// printf("Kernel name...: %s\n", ki->kernel_name);
|
||||
// printf("Kernel node...: %s\n", ki->kernel_node);
|
||||
// printf("Kernel release: %s\n", ki->kernel_release);
|
||||
// printf("Kernel version: %s\n", ki->kernel_version);
|
||||
// printf("Kernel machine: %s\n", ki->kernel_machine);
|
||||
}
|
||||
|
||||
Binary file not shown.
+2450
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* tclPlatDecls.h --
|
||||
*
|
||||
* Declarations of platform specific Tcl APIs.
|
||||
*
|
||||
* Copyright (c) 1998-1999 by Scriptics Corporation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* RCS: @(#) $Id: tclPlatDecls.h,v 1.27 2007/12/13 15:23:20 dgp Exp $
|
||||
*/
|
||||
|
||||
#ifndef _TCLPLATDECLS
|
||||
#define _TCLPLATDECLS
|
||||
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#ifdef BUILD_tcl
|
||||
# define TCL_STORAGE_CLASS DLLEXPORT
|
||||
#else
|
||||
# ifdef USE_TCL_STUBS
|
||||
# define TCL_STORAGE_CLASS
|
||||
# else
|
||||
# define TCL_STORAGE_CLASS DLLIMPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Pull in the typedef of TCHAR for windows.
|
||||
*/
|
||||
#if defined(__CYGWIN__)
|
||||
typedef char TCHAR;
|
||||
#elif defined(__WIN32__) && !defined(_TCHAR_DEFINED)
|
||||
# include <tchar.h>
|
||||
# ifndef _TCHAR_DEFINED
|
||||
/* Borland seems to forget to set this. */
|
||||
typedef _TCHAR TCHAR;
|
||||
# define _TCHAR_DEFINED
|
||||
# endif
|
||||
# if defined(_MSC_VER) && defined(__STDC__)
|
||||
/* MSVC++ misses this. */
|
||||
typedef _TCHAR TCHAR;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* !BEGIN!: Do not edit below this line. */
|
||||
|
||||
/*
|
||||
* Exported function declarations:
|
||||
*/
|
||||
|
||||
#ifdef __WIN32__ /* WIN */
|
||||
#ifndef Tcl_WinUtfToTChar_TCL_DECLARED
|
||||
#define Tcl_WinUtfToTChar_TCL_DECLARED
|
||||
/* 0 */
|
||||
EXTERN TCHAR * Tcl_WinUtfToTChar (CONST char * str, int len,
|
||||
Tcl_DString * dsPtr);
|
||||
#endif
|
||||
#ifndef Tcl_WinTCharToUtf_TCL_DECLARED
|
||||
#define Tcl_WinTCharToUtf_TCL_DECLARED
|
||||
/* 1 */
|
||||
EXTERN char * Tcl_WinTCharToUtf (CONST TCHAR * str, int len,
|
||||
Tcl_DString * dsPtr);
|
||||
#endif
|
||||
#endif /* WIN */
|
||||
#ifdef MAC_OSX_TCL /* MACOSX */
|
||||
#ifndef Tcl_MacOSXOpenBundleResources_TCL_DECLARED
|
||||
#define Tcl_MacOSXOpenBundleResources_TCL_DECLARED
|
||||
/* 0 */
|
||||
EXTERN int Tcl_MacOSXOpenBundleResources (Tcl_Interp * interp,
|
||||
CONST char * bundleName, int hasResourceFile,
|
||||
int maxPathLen, char * libraryPath);
|
||||
#endif
|
||||
#ifndef Tcl_MacOSXOpenVersionedBundleResources_TCL_DECLARED
|
||||
#define Tcl_MacOSXOpenVersionedBundleResources_TCL_DECLARED
|
||||
/* 1 */
|
||||
EXTERN int Tcl_MacOSXOpenVersionedBundleResources (
|
||||
Tcl_Interp * interp, CONST char * bundleName,
|
||||
CONST char * bundleVersion,
|
||||
int hasResourceFile, int maxPathLen,
|
||||
char * libraryPath);
|
||||
#endif
|
||||
#endif /* MACOSX */
|
||||
|
||||
typedef struct TclPlatStubs {
|
||||
int magic;
|
||||
struct TclPlatStubHooks *hooks;
|
||||
|
||||
#ifdef __WIN32__ /* WIN */
|
||||
TCHAR * (*tcl_WinUtfToTChar) (CONST char * str, int len, Tcl_DString * dsPtr); /* 0 */
|
||||
char * (*tcl_WinTCharToUtf) (CONST TCHAR * str, int len, Tcl_DString * dsPtr); /* 1 */
|
||||
#endif /* WIN */
|
||||
#ifdef MAC_OSX_TCL /* MACOSX */
|
||||
int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp * interp, CONST char * bundleName, int hasResourceFile, int maxPathLen, char * libraryPath); /* 0 */
|
||||
int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp * interp, CONST char * bundleName, CONST char * bundleVersion, int hasResourceFile, int maxPathLen, char * libraryPath); /* 1 */
|
||||
#endif /* MACOSX */
|
||||
} TclPlatStubs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern TclPlatStubs *tclPlatStubsPtr;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
|
||||
|
||||
/*
|
||||
* Inline function declarations:
|
||||
*/
|
||||
|
||||
#ifdef __WIN32__ /* WIN */
|
||||
#ifndef Tcl_WinUtfToTChar
|
||||
#define Tcl_WinUtfToTChar \
|
||||
(tclPlatStubsPtr->tcl_WinUtfToTChar) /* 0 */
|
||||
#endif
|
||||
#ifndef Tcl_WinTCharToUtf
|
||||
#define Tcl_WinTCharToUtf \
|
||||
(tclPlatStubsPtr->tcl_WinTCharToUtf) /* 1 */
|
||||
#endif
|
||||
#endif /* WIN */
|
||||
#ifdef MAC_OSX_TCL /* MACOSX */
|
||||
#ifndef Tcl_MacOSXOpenBundleResources
|
||||
#define Tcl_MacOSXOpenBundleResources \
|
||||
(tclPlatStubsPtr->tcl_MacOSXOpenBundleResources) /* 0 */
|
||||
#endif
|
||||
#ifndef Tcl_MacOSXOpenVersionedBundleResources
|
||||
#define Tcl_MacOSXOpenVersionedBundleResources \
|
||||
(tclPlatStubsPtr->tcl_MacOSXOpenVersionedBundleResources) /* 1 */
|
||||
#endif
|
||||
#endif /* MACOSX */
|
||||
|
||||
#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
|
||||
|
||||
/* !END!: Do not edit above this line. */
|
||||
|
||||
#undef TCL_STORAGE_CLASS
|
||||
#define TCL_STORAGE_CLASS DLLIMPORT
|
||||
|
||||
#endif /* _TCLPLATDECLS */
|
||||
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
EXPORTS
|
||||
sql_clear_query @1
|
||||
sql_connect_db @2
|
||||
sql_disconnect_db @3
|
||||
sql_exec_query @4
|
||||
sql_free_memory @5
|
||||
sql_get_tuple @6
|
||||
sql_get_value @7
|
||||
sql_max_field @8
|
||||
sql_max_tuple @9
|
||||
sql_status_message @10
|
||||
|
||||
IMPORTS
|
||||
|
||||
LIBPQ.dll.PQbackendPID
|
||||
LIBPQ.dll.PQbinaryTuples
|
||||
LIBPQ.dll.PQcancel
|
||||
LIBPQ.dll.PQclear
|
||||
LIBPQ.dll.PQclientEncoding
|
||||
LIBPQ.dll.PQcmdStatus
|
||||
LIBPQ.dll.PQcmdTuples
|
||||
LIBPQ.dll.PQconndefaults
|
||||
LIBPQ.dll.PQconnectPoll
|
||||
LIBPQ.dll.PQconnectStart
|
||||
LIBPQ.dll.PQconnectdb
|
||||
LIBPQ.dll.PQconnectionNeedsPassword
|
||||
LIBPQ.dll.PQconnectionUsedPassword
|
||||
LIBPQ.dll.PQconninfoFree
|
||||
LIBPQ.dll.PQconninfoParse
|
||||
LIBPQ.dll.PQconsumeInput
|
||||
LIBPQ.dll.PQcopyResult
|
||||
LIBPQ.dll.PQdb
|
||||
LIBPQ.dll.PQdescribePortal
|
||||
LIBPQ.dll.PQdescribePrepared
|
||||
LIBPQ.dll.PQdisplayTuples
|
||||
LIBPQ.dll.PQdsplen
|
||||
LIBPQ.dll.PQencryptPassword
|
||||
LIBPQ.dll.PQendcopy
|
||||
LIBPQ.dll.PQenv2encoding
|
||||
LIBPQ.dll.PQerrorMessage
|
||||
LIBPQ.dll.PQescapeBytea
|
||||
LIBPQ.dll.PQescapeByteaConn
|
||||
LIBPQ.dll.PQescapeString
|
||||
LIBPQ.dll.PQescapeStringConn
|
||||
LIBPQ.dll.PQexec
|
||||
LIBPQ.dll.PQexecParams
|
||||
LIBPQ.dll.PQexecPrepared
|
||||
LIBPQ.dll.PQfformat
|
||||
LIBPQ.dll.PQfinish
|
||||
LIBPQ.dll.PQfireResultCreateEvents
|
||||
LIBPQ.dll.PQflush
|
||||
LIBPQ.dll.PQfmod
|
||||
LIBPQ.dll.PQfn
|
||||
LIBPQ.dll.PQfname
|
||||
LIBPQ.dll.PQfnumber
|
||||
LIBPQ.dll.PQfreeCancel
|
||||
LIBPQ.dll.PQfreeNotify
|
||||
LIBPQ.dll.PQfreemem
|
||||
LIBPQ.dll.PQfsize
|
||||
LIBPQ.dll.PQftable
|
||||
LIBPQ.dll.PQftablecol
|
||||
LIBPQ.dll.PQftype
|
||||
LIBPQ.dll.PQgetCancel
|
||||
LIBPQ.dll.PQgetCopyData
|
||||
LIBPQ.dll.PQgetResult
|
||||
LIBPQ.dll.PQgetisnull
|
||||
LIBPQ.dll.PQgetlength
|
||||
LIBPQ.dll.PQgetline
|
||||
LIBPQ.dll.PQgetlineAsync
|
||||
LIBPQ.dll.PQgetssl
|
||||
LIBPQ.dll.PQgetvalue
|
||||
LIBPQ.dll.PQhost
|
||||
LIBPQ.dll.PQinitOpenSSL
|
||||
LIBPQ.dll.PQinitSSL
|
||||
LIBPQ.dll.PQinstanceData
|
||||
LIBPQ.dll.PQisBusy
|
||||
LIBPQ.dll.PQisnonblocking
|
||||
LIBPQ.dll.PQisthreadsafe
|
||||
LIBPQ.dll.PQmakeEmptyPGresult
|
||||
LIBPQ.dll.PQmblen
|
||||
LIBPQ.dll.PQnfields
|
||||
LIBPQ.dll.PQnotifies
|
||||
LIBPQ.dll.PQnparams
|
||||
LIBPQ.dll.PQntuples
|
||||
LIBPQ.dll.PQoidStatus
|
||||
LIBPQ.dll.PQoidValue
|
||||
LIBPQ.dll.PQoptions
|
||||
LIBPQ.dll.PQparameterStatus
|
||||
LIBPQ.dll.PQparamtype
|
||||
LIBPQ.dll.PQpass
|
||||
LIBPQ.dll.PQport
|
||||
LIBPQ.dll.PQprepare
|
||||
LIBPQ.dll.PQprint
|
||||
LIBPQ.dll.PQprintTuples
|
||||
LIBPQ.dll.PQprotocolVersion
|
||||
LIBPQ.dll.PQputCopyData
|
||||
LIBPQ.dll.PQputCopyEnd
|
||||
LIBPQ.dll.PQputline
|
||||
LIBPQ.dll.PQputnbytes
|
||||
LIBPQ.dll.PQregisterEventProc
|
||||
LIBPQ.dll.PQregisterThreadLock
|
||||
LIBPQ.dll.PQrequestCancel
|
||||
LIBPQ.dll.PQresStatus
|
||||
LIBPQ.dll.PQreset
|
||||
LIBPQ.dll.PQresetPoll
|
||||
LIBPQ.dll.PQresetStart
|
||||
LIBPQ.dll.PQresultAlloc
|
||||
LIBPQ.dll.PQresultErrorField
|
||||
LIBPQ.dll.PQresultErrorMessage
|
||||
LIBPQ.dll.PQresultInstanceData
|
||||
LIBPQ.dll.PQresultSetInstanceData
|
||||
LIBPQ.dll.PQresultStatus
|
||||
LIBPQ.dll.PQsendDescribePortal
|
||||
LIBPQ.dll.PQsendDescribePrepared
|
||||
LIBPQ.dll.PQsendPrepare
|
||||
LIBPQ.dll.PQsendQuery
|
||||
LIBPQ.dll.PQsendQueryParams
|
||||
LIBPQ.dll.PQsendQueryPrepared
|
||||
LIBPQ.dll.PQserverVersion
|
||||
LIBPQ.dll.PQsetClientEncoding
|
||||
LIBPQ.dll.PQsetErrorVerbosity
|
||||
LIBPQ.dll.PQsetInstanceData
|
||||
LIBPQ.dll.PQsetNoticeProcessor
|
||||
LIBPQ.dll.PQsetNoticeReceiver
|
||||
LIBPQ.dll.PQsetResultAttrs
|
||||
LIBPQ.dll.PQsetdbLogin
|
||||
LIBPQ.dll.PQsetnonblocking
|
||||
LIBPQ.dll.PQsetvalue
|
||||
LIBPQ.dll.PQsocket
|
||||
LIBPQ.dll.PQstatus
|
||||
LIBPQ.dll.PQtrace
|
||||
LIBPQ.dll.PQtransactionStatus
|
||||
LIBPQ.dll.PQtty
|
||||
LIBPQ.dll.PQunescapeBytea
|
||||
LIBPQ.dll.PQuntrace
|
||||
LIBPQ.dll.PQuser
|
||||
LIBPQ.dll.appendBinaryPQExpBuffer
|
||||
LIBPQ.dll.appendPQExpBuffer
|
||||
LIBPQ.dll.appendPQExpBufferChar
|
||||
LIBPQ.dll.appendPQExpBufferStr
|
||||
LIBPQ.dll.createPQExpBuffer
|
||||
LIBPQ.dll.destroyPQExpBuffer
|
||||
LIBPQ.dll.enlargePQExpBuffer
|
||||
LIBPQ.dll.initPQExpBuffer
|
||||
LIBPQ.dll.lo_close
|
||||
LIBPQ.dll.lo_creat
|
||||
LIBPQ.dll.lo_create
|
||||
LIBPQ.dll.lo_export
|
||||
LIBPQ.dll.lo_import
|
||||
LIBPQ.dll.lo_import_with_oid
|
||||
LIBPQ.dll.lo_lseek
|
||||
LIBPQ.dll.lo_open
|
||||
LIBPQ.dll.lo_read
|
||||
LIBPQ.dll.lo_tell
|
||||
LIBPQ.dll.lo_truncate
|
||||
LIBPQ.dll.lo_unlink
|
||||
LIBPQ.dll.lo_write
|
||||
LIBPQ.dll.pg_char_to_encoding
|
||||
LIBPQ.dll.pg_encoding_to_char
|
||||
LIBPQ.dll.pg_utf_mblen
|
||||
LIBPQ.dll.pg_valid_server_encoding
|
||||
LIBPQ.dll.pg_valid_server_encoding_id
|
||||
LIBPQ.dll.pgresStatus
|
||||
LIBPQ.dll.pqsignal
|
||||
LIBPQ.dll.printfPQExpBuffer
|
||||
LIBPQ.dll.resetPQExpBuffer
|
||||
LIBPQ.dll.termPQExpBuffer
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,74 @@
|
||||
EXPORTS
|
||||
cbl_align @1
|
||||
cbl_alloc_mem @2
|
||||
cbl_call_system @3
|
||||
cbl_change_dir @4
|
||||
cbl_check_file_exist @5
|
||||
cbl_clear @6
|
||||
cbl_clear_scr @7
|
||||
cbl_close_dir @8
|
||||
cbl_close_file @9
|
||||
cbl_copy @10
|
||||
cbl_copy_dir @11
|
||||
cbl_copy_file @12
|
||||
cbl_create_dir @13
|
||||
cbl_delete_dir @14
|
||||
cbl_delete_file @15
|
||||
cbl_flush_file @16
|
||||
cbl_free_mem @17
|
||||
cbl_get @18
|
||||
cbl_get_csr_pos @19
|
||||
cbl_get_current_dir @20
|
||||
cbl_get_kbd_status @21
|
||||
cbl_get_os_info @22
|
||||
cbl_get_per @23
|
||||
cbl_get_scr_size @24
|
||||
cbl_move_dir @25
|
||||
cbl_move_file @26
|
||||
cbl_open_dir @27
|
||||
cbl_open_file @28
|
||||
cbl_parm @29
|
||||
cbl_read_dir @30
|
||||
cbl_read_file @31
|
||||
cbl_remove_file @32
|
||||
cbl_rename_file @33
|
||||
cbl_restore_partial_screen @34
|
||||
cbl_restore_screen @35
|
||||
cbl_rewind_dir @36
|
||||
cbl_save_partial_screen @37
|
||||
cbl_save_screen @38
|
||||
cbl_sleep @39
|
||||
cbl_stream @40 DATA
|
||||
cbl_test @41
|
||||
cbl_windms_color_pair @42
|
||||
cbl_windms_display_menu @43
|
||||
cbl_windms_escreve @44
|
||||
cbl_windms_guarda @45
|
||||
cbl_windms_inicia_cor @46
|
||||
cbl_windms_menu @47
|
||||
cbl_windms_moldura @48
|
||||
cbl_windms_monta_cor @49
|
||||
cbl_windms_mudacor @50
|
||||
cbl_windms_pos @51
|
||||
cbl_windms_remove @52
|
||||
cbl_write_file @53
|
||||
cblsys @54
|
||||
close_keyboard @55
|
||||
clr_clear_kbd_buffer @56
|
||||
cobpri @57 DATA
|
||||
cobpro @58 DATA
|
||||
current_directory @59 DATA
|
||||
current_file @60 DATA
|
||||
initColor @61 DATA
|
||||
init_keyboard @62
|
||||
lastWindow @63 DATA
|
||||
os_info @64 DATA
|
||||
readch @65
|
||||
screenArea @66 DATA
|
||||
screenposition @67 DATA
|
||||
show @68
|
||||
var @69 DATA
|
||||
windmenu @70 DATA
|
||||
windms @71
|
||||
windows @72 DATA
|
||||
windpos @73 DATA
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
Example embedding a tcl interpreter
|
||||
for GUI enabling a Cobol program.
|
||||
|
||||
Recife, Brazil, 2001 -- Rildo Pragana
|
||||
*/
|
||||
|
||||
#include <tcl.h>
|
||||
#include <tk.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
/**** general use tcl procs for processing arguments ****/
|
||||
#include "cobtools.h"
|
||||
|
||||
#ifdef WINDOWS
|
||||
#include <windows.h>
|
||||
#define TCTCL_PATH_DELIM_STR '\\'
|
||||
|
||||
BOOL _export WINAPI DllEntryPoint(HINSTANCE hInstance, DWORD seginfo,
|
||||
LPVOID lpCmdLine)
|
||||
{
|
||||
/* Microsoft ONLY MAKES CRAP!!!!!!!!
|
||||
THIS DUMB FUNCTION EXISTS ONLY TO FULFILL MS-WINDOWS NEEDS.
|
||||
Bill Gates will burn in HELL. */
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
#define TCTCL_PATH_DELIM_STR '/'
|
||||
#endif
|
||||
|
||||
Tcl_Interp *interp;
|
||||
int error_code;
|
||||
Tk_Window mainwin;
|
||||
int script_sourced = 0;
|
||||
|
||||
int tclErr(const char *msg)
|
||||
{
|
||||
char *r;
|
||||
r = (char *) Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
|
||||
fprintf(stderr, "%s:%s\n", msg, r);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int initTcl()
|
||||
{
|
||||
// int argc=0;
|
||||
// char *argv[]= { "tinycobol", ""};
|
||||
Tcl_FindExecutable("");
|
||||
interp = Tcl_CreateInterp();
|
||||
Tcl_AppInit(interp);
|
||||
mainwin = Tk_MainWindow(interp);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
int newGui()
|
||||
{
|
||||
script_sourced = 0;
|
||||
error_code = Tcl_Eval(interp, newgui);
|
||||
if (error_code != TCL_OK)
|
||||
{
|
||||
tclErr("newGui: error in Tcl_Eval");
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
int endTcl()
|
||||
{
|
||||
Tcl_DeleteInterp(interp);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
int tcleval(char *data, char *scriptn)
|
||||
{
|
||||
char *r;
|
||||
char *cobbuf;
|
||||
int size;
|
||||
char script[128], *s, *s1, *d;
|
||||
d = getenv("TCTCL_LIBRARY_PATH");
|
||||
s = script;
|
||||
s1 = scriptn;
|
||||
if (d)
|
||||
{
|
||||
while (*d != 0) *s++ = *d++;
|
||||
|
||||
if (*d != TCTCL_PATH_DELIM_STR) *s++ = TCTCL_PATH_DELIM_STR;
|
||||
}
|
||||
|
||||
while (*s1 != ' ') *s++ = *s1++;
|
||||
*s = 0;
|
||||
if (!script_sourced)
|
||||
{
|
||||
script_sourced++;
|
||||
error_code = Tcl_Eval(interp, cobtools);
|
||||
if (error_code != TCL_OK)
|
||||
{
|
||||
tclErr("tcleval: error evaluating cobtools");
|
||||
}
|
||||
error_code = Tcl_EvalFile(interp, script);
|
||||
if (error_code != TCL_OK)
|
||||
{
|
||||
tclErr("tcleval: error evaluating script");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error_code = Tcl_Eval(interp, "cobol_update");
|
||||
if (error_code != TCL_OK)
|
||||
{
|
||||
tclErr("tcleval: error evaluating cobol_update");
|
||||
}
|
||||
}
|
||||
error_code = Tcl_Eval(interp, compute_block_size);
|
||||
if (error_code != TCL_OK)
|
||||
{
|
||||
tclErr("tcleval: error evaluating compute_block_size");
|
||||
}
|
||||
Tcl_GetInt(interp, Tcl_GetVar(interp, "block_size", TCL_GLOBAL_ONLY), &size);
|
||||
cobbuf = malloc(size + 1);
|
||||
memmove(cobbuf, data, size);
|
||||
cobbuf[size] = 0;
|
||||
/*printf("C script: %s received: %s\n",script,cobbuf);*/
|
||||
Tcl_SetVar(interp, "data_block", cobbuf, TCL_GLOBAL_ONLY);
|
||||
Tcl_Eval(interp, wait_ready);
|
||||
r = (char *) Tcl_GetVar(interp, "result", TCL_GLOBAL_ONLY);
|
||||
if (r != NULL)
|
||||
{
|
||||
memmove(data, r, strlen(r));
|
||||
}
|
||||
free(cobbuf);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
int
|
||||
Tcl_AppInit(Tcl_Interp *interp)
|
||||
{
|
||||
|
||||
if (Tcl_Init(interp) == TCL_ERROR)
|
||||
{
|
||||
return TCL_ERROR;
|
||||
}
|
||||
/* Tcl_Eval(interp,"set dir $tcl_library;source $dir/tclIndex;unset dir");
|
||||
*/
|
||||
if (Tk_Init(interp) == TCL_ERROR)
|
||||
{
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_StaticPackage(interp, "Tk", Tk_Init, 0);
|
||||
/*Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);*/
|
||||
/* Tcl_Eval(interp,"set dir $tk_library;source $dir/tclIndex;unset dir");
|
||||
*/
|
||||
Tcl_SetVar(interp, "tcl_rcFileName", "~/.tctclrc", TCL_GLOBAL_ONLY);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1605
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user