MEMCPTDT module routines - WIN32

Company Information Software Products TDF Market Reports Download Area take me Home

MEMCPTDT.C - MEMory ComPuTrac DaTa fetch routines

These are a few routines layered on top of the standard datafile access routines to support memory caching of the master file info. The module is slightly mis-named, only Metastock memory caching & lookup is supported (to support Computrac you just need to check a different field).

The other major functions in this module - find_date_record_by_date() and load_last_n_data_records() do support all database types.

Function find_data_record_by_date
Include file MEMCPTDT.H
Prototype int find_data_record_by_date( char *date_str , char *ticker )
Remarks Given a ticker_str and a target_date, this routine will lookup and open the data file and do a binary search for the target date. The routine only looks for exact hits, use find_data_record_by_date_fsearch to forward search through a file for a target date. Returns are FALSE (0) - ticker or record not found, -1 - bounds error ( target_date last_date_in_file ) else the found record number. The input date_str is in MM/DD/YY format.

Function find_data_rec_by_date_fsearch
Include file MEMCPTDT.H
Prototype int find_data_rec_by_date_fsearch( char *date_str , char *ticker )
Remarks This routine will front-end find_data_record_by_date() to support forward searching a data file for a target date. Retrys are controlled by FIND_REC_BY_DATE_RETRY_MAX and internal to the routine, dates are handled in julian (so 01/01/90 follows 12/31/89). The input date_str is in MM/DD/YY format.

Function compare_dates
Include file MEMCPTDT.H
Prototype static int compare_dates( float date1 , float date2 )
Remarks A simple compare function that returns values like strcmp, 0 = match, -1 = date1 date2.

Function load_last_n_data_records
Include file MEMCPTDT.H
Prototype DATA_REC * load_last_n_data_records( char *ticker , int last_cnt )
Remarks Given a ticker_str this routine will lookup and open the file, calloc a chunk of memory for the data records, load the last_cnt number of records from the file and return the fetched data in a DATA_REC array.

Function copy_ticker_str
Include file MEMCPTDT.H
Prototype static void copy_ticker_str( char far *dest , char far *src )
Remarks Copy till the 1st WHITE space char on 2 far strs.

Function ld_cpt_master_file_into_memory
Include file MEMCPTDT.H
Prototype void ld_cpt_master_file_into_memory( void )
Remarks Load a Metastock master file into memory for fast ticker lookup. This routine currently does not support Computrac (all you need to do to add support is change the lookup field).

Function free_cpt_master_file_rec
Include file MEMCPTDT.H
Prototype void free_cpt_master_file_rec( void )
Remarks Return the old memory master file structure to far heap memory.

Function mem_lookup_data_file_num
Include file MEMCPTDT.H
Prototype int mem_lookup_data_file_num( char *requested_ticker )
Remarks This routine will automatically support memory caching of Metastock master files for fast ticker lookup. If called with the GLOBAL var database_type != DATA_METASTOCK or the GLOBAL var no_mem_lookup == TRUE then the lookup will be performed by the standard lookup_data_file_num().

Function find_ticker_with_wildcard_supp
Include file MEMCPTDT.H
Prototype int find_ticker_with_wildcard_supp( int init_flag , char *ticker_str )
Remarks Search the master file memory structure for a user ticker_str by calling match_str_with_wildcard_support() whichs supports embedded "?"s as any one single character (just like MSDOS does). Call this routine with init_flag == TRUE to get the first match, then with init_flag == FALSE to get additional matches. Will return FALSE if no matches else TRUE if found and GLOBAL var cpt_master_found_idx will be set to the correct index in the master memory record of the found record.

Function update_db_module_vars
Include file MEMCPTDT.H
Prototype static void update_db_module_vars( int mem_mst_idx )
Remarks Update the data access module vars with the info from the found memory cached master record.

Table of Contents Function Index

generated on 22 September 1998 - 12:55:11
© 1998 Tierra del Fuego Ltd.