NAME:

Package: InOut


SYNOPSIS:

use lib::InOut;


DIRECTORY/FILE:

The file InOut.pm is located in the subdirectory './lib'


DESCRIPTION:

This package contains all function that read/write something directly to/from disk or call any external commands.

Many things will disapear from this package and move in a more generally form into the package 'Backend.pm' which has to be created to support different backends.

The things that are done with the DVI and Postscript creating/viewing programs will be defined in the '*.out'-configuration-files and then performed by method of 'Backend.pm'.


STATUS:

Coding: 90% but some functions will not survive long here.

Documentation: up-do-date


FUNCTIONS:


file_open_ascii

InOut::file_open_ascii($ref_docform [, $filename] );

This function reads a document in pure text format (ASCII) and writes it into the textwidget of the given DocForm object.

Parameters:

(+) $ref_docform: Reference of the DocForm object

(+) $filename: Filename of the textfile to opne, if missing, a dialogbox will ask for it


file_open

InOut::file_open($ref_docform [, $file_name] );

This function reads a document and writes it into the textwidget of the given DocForm object.

Parameters:

(+) $ref_docform: Reference of the DocForm object

(+) $filename: The filename&path of the document to open, if not defined, a dialogbox will ask for it


file_save_as

InOut::file_save_as($ref_docform [,$filename]);

This function asks for a filename and then calls the function InOut::file_save for saving the document to disk

Parameters:

(+) $ref_docform: Reference of the DocForm object

(+) $filename: The filename to be saved (OPTIONAL)


file_save

InOut::file_save($ref_docform [, $file_name] );

This function writes the document to disk.

Parameters:

(+) $ref_docform: Reference of the DocForm object

(+) $filename: The filename&path of the document to save, if not defined, a dialogbox will ask for it


create_document_array

@array = InOut::create_document_array($ref_docform, $start_index, $end_index);

This function generates a textarray that has all information about the text-part mentioned by $start_index and $end_index. This textarray contains all of the formating info in the e:doc-file-format.

It is used for preparing an array for the file->save function and for copying some text (incl. formats) into the e:doc-clipboard.

Parameters:

(+) $ref_docform: A reference to the DocForm object

(+) $start_index: The start-index of the document-part to save in the textarray

(+) $end_index: The end-index of the document-part to save in the textarray


insert_array_into_document

InOut::insert_array_into_document($ref_docform, $start_index, $ref_array, $is_full_file_open);

This function inserts formated textfrom the given textarray that contains all information about the text-part into the actual document at the place mentioned by $start_index.

It is used for building up the document in the file->open function and for pasting some text (incl. formats) from the e:doc-clipboard.

Parameters:

(+) $ref_docform: A reference to the DocForm object

(+) $start_index: The start-index of the document-part to save in the textarray

(+) $ref_array: A reference to the array that contains the info

(+) $is_full_file_open: Flag is set to '1' if the whole document is to be opened, what means that also the info about document style and other things should be processed and the existing document should be cleared first. if set to 0 or undef only the text-portion gets inserted into the existingdocument.


build_array_from_file

@filearray = InOut::build_array_from_file($filename)

Reads all lines from a file and builds an array with it. This array is first cleared of unnecessary whitespaces and comments, parsed for <<<INCLUDE_FILE::.....>>> commands, which cause the subroutine to call itself recusively and then the whole array checked for the correct opening and closing of blocks. This parsed and extracted array is returned.

Parameters:

(+) $filename: The filename&path to read into the array


export_to_backend

$ps_filename = InOut::export_to_backend($ref_docform , $edc_filename, $extension );

Exports the e:doc document in the DocForm object into the backends format and writes down the file on disk with the same filename than the e:doc-document but the extension specified in the corresponding *.out file of the backend.

Parameters:

(+) $ref_docform: Reference of the DocForm object

(+) $edc_filename: The filename&path of the e:doc document

(+) $extension : The extension the exported file should have


save_to_XML

$ok_flag = InOut::save_to_XML($ref_docform , $edc_filename );

Saves the document in XML format and returns an flag if the saving was ok.

NOT CODED YET !

Parameters:

(+) $ref_docform: Reference of the DocForm object

(+) $edc_filename: The filename&path of the e:doc document


open_as_XML

$ok_flag = InOut::open_as_XML($ref_docform , $edc_filename );

Open the document in XML format and returns an flag if the opening was ok.

NOT CODED YET !

Parameters:

(+) $ref_docform: Reference of the DocForm object

(+) $edc_filename: The filename&path of the e:doc document


project_open

InOut::project_open($ref_prjform [, $file_name] );

This function reads a project and writes it into the given project form.

Parameters:

(+) $ref_prjform: Reference of the PrjForm object

(+) $filename: The filename&path of the project to open, if not defined, a dialogbox will ask for it


project_save

InOut::project_save($ref_prjform);

This function saves the projectform into its file.

NOTE: The file is created already after 'Project'->'New', so there is no need to ask for a filename.

Parameters:

(+) $ref_prjform: Reference of the PrjForm object


build_filelist_by_extension

@filelist = InOut::build_filelist_by_extension($dir, $ext);

Gets all files with the giveb extension in the directory and returns the filenames as an array.

Parameters:

(+) $dir: The directory path

(+) $ext: The extension (excl. the point, f. ex. 'txt' finds all '*.txt'-files)

Returned value: the filelist


KNOWN BUGS:


STILL MISSING:

(+) A method called 'call_external_program(...)' that represents an call for external programs to be used in macros you can define in 'edoc.cfg'.

(+) The XML stuff is missing. =cut