A "Framework" is a set of files with functions and operators already written that allows you by including them in a project; to make use of such tools to accelerate and give the project an excellent functionality.
The TEIMSI Framework is located within the editor's program folder (see "Locating the folder of the compiler"), there is the "tco_sources" folder which has many files with TEIMSI code. Some files are the source code for the object files or "Tco", to know it; those files have the "@tco_filename:" instruction followed by the name of the Tco file. TCO (TEIMSI compiled object) is the format for several files within the folder "tco_inc", the inclusion of Tco files for a project is done through a "include_tco" instruction and the inclusion of standard files ("*.thp", "*.tsi", .Etc) is done through the "includec" instruction. For example:
includec(º_scriptdir_\local_bmp_compresion.thp) // Includes a file "local_bmp_compresion" (standard) which is found in the current ".Tsi" script's folder. include_tco(tco_inc\bitmaps\bmpobject.tco) // Includes the object file "bmpobject.tco" found within the folder "tco_inc\bitmaps" which is also inside the directory of the TEIMSI installation.
The following table shows the available files and if it's about the source code of a TCO file.
Path and filename of the Framework | Is source of a TCO. | Professional edition only | Description |
---|---|---|---|
tco_sources\bitmaps\bmpobject.thp | Yes | No | It allows you to load and save from a .BMP file, and also create a string variable with BMP_OBJ format. |
tco_sources\bitmaps\bmp_objcompress.thp | Yes | No | It has functions that use a simple algorithm which compress and uncompress a BMP_OBJ string. |
tco_sources\bitmaps\bmpdraw.thp | Yes | No | It allows the basic painting tasks (read/write pixel, draw a line or circle) for strings with "BMP_OBJ" format. |
tco_sources\bitmaps\bmpfonts.thp | Yes | No | It allows to draw a letter or text on a BMP_OBJ string. |
tco_sources\bitmaps\extend_paintdump.thp | Yes | Yes | It has a function that allows the painting by "dump a paint pot" in a BMP_OBJ string. |
tco_sources\bitmaps\extract_hstrimage.thp | Yes | No | It has functions that allows to "extract" a copy of part of a BMP_OBJ image to another BMP_OBJ string. |
tco_sources\bitmaps\img_adj_nitidez.thp | Yes | Yes | It enables smooth or anti-smooth (give some artificial sharpness) to a BMP_OBJ string. |
tco_sources\bitmaps\img_escalar_br.thp | Yes | No | It allows to resize an image in a BMP_OBJ string variable. The scaling has the minimum quality. |
tco_sources\bitmaps\img_hd_escalar.thp | Yes | Yes | It allows to resize an image in a BMP_OBJ string variable. High-Quality Scaling. |
tco_sources\bitmaps\ipr_filterblack_br.thp | Yes | No | It has some features for specific tasks on BMP_OBJ strings (convert to black and white, .etc) |
tco_sources\bitmaps\ipr_rotate90.thp | Yes | No | It allows you to rotate a BMP_OBJ image string 90 degrees. |
tco_sources\bitmaps\jpg_to_bmpobj.thp | Yes | Yes | It allows to load a BMP_OBJ image string from a JPG file (using "tco_sources\jpg2bmp.thp", see example inside the file). |
tco_sources\bitmaps\load_pscreen.thp | Yes | No | It allows you to capture the screen into a BMP_OBJ image string. |
tco_sources\bitmaps\paint_hstrimage.thp | Yes | No | It has features that allow drawing a BMP_OBJ image within another (using a color specific pixel for transparency). |
tco_sources\bitmaps\screen_to_jpg.thp | Yes | Yes | It allows to capture a part of the screen and save the image into a Jpg file. |
tco_sources\bitmaps\supercolorln.thp | Yes | No | The "supercolorln" function loads the pixels of an imaginary line drawn on a BMP_OBJ image between two points averaging a unique color and transforming it in order to make its value to one of eight colors. |
tco_sources\bitmaps\util_bmpfonts\fontobjcreate.tsi | No | No | It transforms a file called "baseletras.bmp" with cartoons of characters in other with the data expression for the assembler that can be relocated inside the file "bmpfonts.thp" (see file "tco_sources\bitmaps\bmpfonts.thp"). |
tco_sources\array2string.thp | Yes | No | It lets you convert data from one array to a string and vice versa. |
tco_sources\click_move.thp | Yes | Yes | It has functions to simulate a "click" or mouse movement. |
tco_sources\dir2string.thp | Yes | Yes | It lets get a directory listing and other things. |
tco_sources\encrypt_v1.thp | Yes | No | It has functions of encryption and to get a "CRC" of a file. |
tco_sources\extract_cab_file.thp | Yes | Yes | It allows you to extract a compressed file inside a .Cab |
tco_sources\filesystem.thp | Yes | No | It has functions for the file system. (Choose Folder, move file, .Etc) |
tco_sources\http_post.thp | Yes | No | It has some basic functions to make a visit to an Internet web page sending one variable through the "POST" method. |
tco_sources\jpg2bmp.thp | Yes | Yes | It allows to make use of "jpgdll.dll" which can convert a ".bmp" file to a ".jpg" and vice versa. |
tco_sources\load_pcinfo.thp | Yes | Yes | It has functions that provide some information for the current computer and current session. |
tco_sources\odbc_teimsi.thp | Yes | Yes | It has functions for using OBDC (it's an experimental Tco file). |
tco_sources\report_timelong.thp | Yes | Yes | It lets you to get a date expression from an integer returned by the "timelong" function (TEIMSI predefined). |
tco_sources\round2string.thp | Yes | No | It allows to round a decimal number. |
tco_sources\sort_strarr.thp | Yes | No | It allows to sort an array with strings. |
tco_sources\sqr_matrix.thp | Yes | No | It has functions to find the determinant of an array or solving a N x N equations system. |
tco_sources\string_compresion_v1.thp | Yes | No | It has a simple algorithm to compress and uncompress strings. |
tco_sources\text2clipboard.thp | Yes | No | It allows to read the clipboard and write on it. |
tco_sources\typek.thp | Yes | Yes | It allows to simulate writing text using the keyboard. |
tco_sources\user_function.thp | Yes | No | It allows you to compile and run a mathematical expression at runtime and also link it to custom number variables. |
tco_sources\wave_object.thp | Yes | No | It allows to read and write a .wav file to/from a variable string with "WAV_OBJ" format. |
tco_sources\windowx_apps_info.thp | Yes | Yes | It has functions to get information about window programs running in the current session. |
tco_sources\winkerinterface\winkerinterface.thp | No | No | It lets you create at runtime the main window of the application and its controls, also read and change properties of them. |
For more information about the functions or the file's content, you should read the first page of the very same file in the TEIMSI Framework.
The applications project samples are in the "projects" folder located within the TEIMSI editor folder (see "Locating the folder of the compiler"). In order to compile an example it may be required due to user privileges; to copy the example's folder (or the whole "projects" folder) into the "Teimsi_projects" located in the user "my documents" folder. The examples are described below.
Name of the project and folder | Description |
---|---|
1- Simple_hexstruse | Converts small text strings into a notation whose ASCII codes are expressed in hexadecimal system and vice versa. |
2- Mp3list_randomizer | It load the lines of "m3u" file with paths to music files (mp3, ogg, .etc), and creates a file with the lines (songs) in a random position. |
3- Task_scheduler | It allows to alert daily activities at a fixed time of day. |
4- Files_separator | It allows to create a copy of a folder separating from the original folder, files with a certain extension. |
5- Icomaker | It allows to create an .ICO file from a .BMP file, which is 32 x 32 pixels of size and it must be edited. |
6- Priority_changer | Shows how to work with numbers entered by the user. |
7- Mp3_finder | Allows you to search music files in a folder. |
8- Bmpbrujula | Draw a background image of a compass and shows it. |
9- Prime_number | Determines a list with an arbitrary number of prime numbers starting from the number 2. |
![]() | |
10- Wav440hz | Creates a sound with frequencies of an acoustic guitar. |
11- Functioncalculator | Allows the calculation of any mathematical expression; optionally you can use the X and Z variables with fixed values. |
12- Simplewinxcon | It allows to create the main window of the application using the included file "tco_sources\winkerinterface\winkerinterface.thp". |
13- Usercol_in_win | It's an application with a window created with "tco_sources\winkerinterface\winkerinterface.thp" which show a color using as input an hexadecimal number. |
![]() | |
14- Bintod_sample | Converts any file into a special notation and vice versa. |
15- Iotest | Example of use of the parallel port signals. |
16- Asteroid1 | Small game that uses Opengl where the speed of an object can be changed through the mouse's movement and then change the trajectory of the others objects. |
![]() | |
17- Grafica3d | Simple three dimensions chart maker from an equation with two variables X and Z. |
![]() | |
For more information on what makes a project and how it works, look the content of the ".tsi" file with the name of the project, it's located inside the folder with the same name.
Among the sample projects described above, there are some which have programming in advanced level.
The following is an example of source code (script) of a line numerator program for giant text files.
; //######################################################################################################## /* Unlike small files (about less than 500 kilobytes) text files larger should be treated differently or otherwise an insufficient memory error will be generated in the instruction "var arr_lines=explode(_nl,binary_read(arr_files[t]));", that happens because the "explode" function creates an array whose items are strings, each string uses a internal handler whose quantity is limited in our version of the compiler; also there is a long time consuming to build the array of rows. Therefore for processing big files it's recommended to speed up the task leaning on the assembler. The example below is relatively fast compared to other methods, although the sum of strings in TEIMSI may be much slower than in assembler. Be displayed as rows are fetched from a unique string that contains the contents of the input file. */ main() function main(){ _savelocal: ult_linea dd ?,num_b_nl dd ?, pos_final dd ?, et_tocall dd ?, tmppos_esi dd ? // "_savelocal" declares local variables in the procedure expressed into assembler language. alert_ex("This sample program, will try to load the file \"huge.txt\", numerate it's lines and put the resulting text on the file \"huge2.txt\" !", "Information", _mb_iconinformation); var inputfile="huge.txt"; var outputfile="huge2.txt"; if(-fileexists(inputfile)){ alert_ex("Unable to locate the file " + inputfile, "Information", _mb_iconinformation); return; } var file_content=binary_read(inputfile) // Read the file's content into a single large string. var maxsizeline=2000, line=str_repeatn(" ", maxsizeline), reco_reti=0, strout="" // These variables are used in the processing of the input text, the "line" variable has a buffer space, // is where each row of the file is placed and should not be changed. var counter=1 // The counter indicates the number of initial row, it will increase with each processed row. // The following assembler code located in block "_direct" is responsible for initializing variables that will be used by the internal routine "WALKOVER_TEXT"; that routine will be called in a "cycle" that will load each row of the file contents into the "line" variable. jmp(continuation_temisi) ; //############################### // These lines have a routine that processes each loaded row, the "processing_line" label indicates the start of this routine which is called from assembler. processing_line: var line2= counter+"- "+line counter++ strout=strout+line2+_nl // On this TEIMSI block, one might only write: strout=strout+line+_nl, which would leave the output file "huge2.txt" with the same contents of the input file "huge.txt" but before that we process the line of the row to perform the desired "numbering" task. // // In this case the "line" variable should not be changed because its internal data buffer is used by assembler. The "reco_reti" variable has a zero, but you may indicate reco_reti=1 if I an error occurred (eg syntax error in the row), which will make that the line read cycle were interrupted and displayed the message "Error in the row " (contents of the row). _direct{ mov eax, [reco_reti+reg.vo] RET } ; //############################### continuation_temisi: _direct{ mov [tmppos_esi], 0 ; Load the pointer from memory and the length of the "file_content" string. mov eax, [file_content+reg.vo] NWPOS_eax mov ecx, [file_content+reg.nu] m2ma [et_tocall], (processing_line) mov [reco_reti+reg.vo], 0 call WALKOVER_TEXT } if(reco_reti==1){ alert("Error found on line " +line) sys.quit() } binary_write(outputfile,strout) alert_ex("Written data on the file " + outputfile, "Information", _mb_iconinformation); return; _direct{ WALKOVER_TEXT: ; Below is the "cycle" that puts in the "line" variable every row of the input text file. mov eax, [file_content+reg.vo] ; Determine the pointer on memory with the file's content. NWPOS_eax mov [tmppos_esi], esi mov ecx, [file_content+reg.nu] mov [ult_linea], 0 lea eax, [esi+ecx] mov [pos_final], eax task_c1: mov ecx, [pos_final] ; A row ends with a line feed character chr(10) or with the string chr(13)+chr(10). sub ecx, esi mov edi, esi mov al, 10 or ebx, 1 repnz scasb jz @f mov [ult_linea], 1 ; Activates last row indicator if it's reached the end of the file. @@: jnz @f mov [num_b_nl], 1 dec edi cmp byte [edi-1], 13 jnz @f mov [num_b_nl], 2 dec edi @@: mov ecx, edi sub ecx, esi push esi ecx ebx cmp ecx, [maxsizeline+reg.vo] ; To avoid problems the size of each readen row is limited. jb @f mov ecx, [maxsizeline+reg.vo] @@: mov [line+reg.nu], ecx ; The length of the row was loaded, now it's need to copy it to the "line" variable and process it. mov eax, [line+reg.vo] NWPOS_eaxedi mov eax, ecx and eax, 3 shr ecx, 2 rep movsd mov ecx, eax rep movsb call dword [et_tocall] mov ebx, [file_content+reg.vo] ; now adjusts the [pos_final] variable in case that the position in memory of the file's content has changed. NWPOS_ebx mov edx, esi sub esi, [tmppos_esi] jz @f mov [tmppos_esi], edx add edx, [file_content+reg.nu] mov [pos_final], edx add [ss:esp+8], esi ; esi = (oldesi - oldloccad) + newloccad @@: pop ebx ecx esi mov byte [esi+ecx], bl cmp eax, 1 jz @f add esi, ecx add esi, [num_b_nl] cmp [ult_linea], 0 jz task_c1 @@: RET } } @eof_file ; //########################################################################################################
The following is program script example that determines the physical and virtual memory available.
; //######################################################################################################## /* This program obtains information about physical and virtual memory using the "GlobalMemoryStatus" function from the kernel32 library. More information can be found in the documentation of the Win * operating systems API's in the file "win32.hlp" downloadable from the internet using the links to the available tools of the Links chapter. */ place_idata{ struct _MEMORYSTATUS dwLength dd ? dwMemoryLoad dd ? dwTotalPhys dd ? dwAvailPhys dd ? dwTotalPageFile dd ? dwAvailPageFile dd ? dwTotalVirtual dd ? dwAvailVirtual dd ? ends memory_info _MEMORYSTATUS MACRO copy_2tsi_dbl dest_tsi_dbl, mem_dword push dword 0 push dword mem_dword fild qword [ss:esp] fstp qword [dest_tsi_dbl+reg.vo] add esp, 8 ENDM } @import:GlobalMemoryStatus var d_dwLength=0.0, d_dwMemoryLoad=0.0, d_dwTotalPhys=0.0, d_dwAvailPhys=0.0, d_dwTotalPageFile=0.0, d_dwAvailPageFile=0.0, d_dwTotalVirtual=0.0, d_dwAvailVirtual=0.0 _direct{ mov dword [memory_info+_MEMORYSTATUS.dwLength], sizeof._MEMORYSTATUS invoke GlobalMemoryStatus, (memory_info) copy_2tsi_dbl d_dwLength, [memory_info.dwLength] copy_2tsi_dbl d_dwMemoryLoad, [memory_info.dwMemoryLoad] copy_2tsi_dbl d_dwTotalPhys, [memory_info.dwTotalPhys] copy_2tsi_dbl d_dwAvailPhys, [memory_info.dwAvailPhys] copy_2tsi_dbl d_dwTotalPageFile,[memory_info.dwTotalPageFile] copy_2tsi_dbl d_dwAvailPageFile,[memory_info.dwAvailPageFile] copy_2tsi_dbl d_dwTotalVirtual, [memory_info.dwTotalVirtual] copy_2tsi_dbl d_dwAvailVirtual, [memory_info.dwAvailVirtual] } var report = "Total RAM memory = " + d_dwTotalPhys + _nl + "RAM memory being used = " + (d_dwTotalPhys - d_dwAvailPhys) + _nl + "Total of virtual local memory = " + d_dwTotalVirtual + _nl + "Virtual local memory in use = " + (d_dwTotalVirtual-d_dwAvailVirtual) + _nl alert_ex(report, "Information about the System Memory:", _mb_iconinformation) @eof_file ; //########################################################################################################