kicad/eeschema/savelib.cpp

569 lines
17 KiB
C++
Raw Normal View History

2007-09-01 12:00:30 +00:00
/****************************/
/* EESchema - eesavlib.cpp */
/****************************/
2008-09-19 08:19:15 +00:00
/* Functions to save schematic libraries and library components (::Save() members)
2007-09-01 12:00:30 +00:00
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
#include "libcmp.h"
#include "general.h"
#include "protos.h"
/* Routines locales */
/* Variables locales */
2007-09-01 12:00:30 +00:00
static bool WriteLibEntryDateAndTime( FILE* ExportFile,
EDA_LibComponentStruct* LibEntry );
2007-09-01 12:00:30 +00:00
static int fill_tab[3] = { 'N', 'F', 'f' };
/***********************************************/
2008-09-18 17:10:54 +00:00
bool LibDrawArc::Save( FILE* ExportFile ) const
/***********************************************/
2007-09-01 12:00:30 +00:00
/* format
2007-09-01 12:00:30 +00:00
* A centre_posx centre_posy rayon start_angle end_angle unit convert fill('N', 'F' ou 'f') startx starty endx endy
*/
{
int x1 = t1; if( x1 > 1800 )
x1 -= 3600;
int x2 = t2; if( x2 > 1800 )
x2 -= 3600;
fprintf( ExportFile, "A %d %d %d %d %d %d %d %d %c %d %d %d %d\n",
m_Pos.x, m_Pos.y,
m_Rayon, x1, x2,
m_Unit, m_Convert,
m_Width, fill_tab[m_Fill],
m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x, m_ArcEnd.y );
2008-09-18 17:10:54 +00:00
return true;
}
2007-09-01 12:00:30 +00:00
/***************************************************/
2008-09-18 17:10:54 +00:00
bool LibDrawCircle::Save( FILE* ExportFile ) const
/***************************************************/
2007-09-01 12:00:30 +00:00
{
fprintf( ExportFile, "C %d %d %d %d %d %d %c\n",
m_Pos.x, m_Pos.y,
m_Rayon,
m_Unit, m_Convert,
m_Width, fill_tab[m_Fill] );
2008-09-18 17:10:54 +00:00
return true;
}
2007-09-01 12:00:30 +00:00
/************************************************/
2008-09-18 17:10:54 +00:00
bool LibDrawText::Save( FILE* ExportFile ) const
/************************************************/
{
2007-09-01 12:00:30 +00:00
wxString text = m_Text;
// Spaces are not allowed in text because it is not double quoted: changed to '~'
text.Replace( wxT( " " ), wxT( "~" ) );
2007-09-01 12:00:30 +00:00
fprintf( ExportFile, "T %d %d %d %d %d %d %d %s ",
m_Orient,
2007-09-01 12:00:30 +00:00
m_Pos.x, m_Pos.y,
m_Size.x, m_Attributs,
2007-09-01 12:00:30 +00:00
m_Unit, m_Convert,
CONV_TO_UTF8( text ));
fprintf( ExportFile, " %s %d", m_Italic ? "Italic" : "Normal", m_Width );
fprintf( ExportFile, "\n");
2008-09-18 17:10:54 +00:00
return true;
}
2007-09-01 12:00:30 +00:00
/***************************************************/
2008-09-18 17:10:54 +00:00
bool LibDrawSquare::Save( FILE* ExportFile ) const
/***************************************************/
{
2007-09-01 12:00:30 +00:00
fprintf( ExportFile, "S %d %d %d %d %d %d %d %c\n",
m_Pos.x, m_Pos.y, m_End.x, m_End.y,
m_Unit, m_Convert,
m_Width, fill_tab[m_Fill] );
2008-09-18 17:10:54 +00:00
return true;
}
/************************************************/
2008-09-18 17:10:54 +00:00
bool LibDrawPin::Save( FILE* ExportFile ) const
/************************************************/
{
2007-09-01 12:00:30 +00:00
wxString StringPinNum;
2008-04-16 19:12:40 +00:00
int Etype;
2007-09-01 12:00:30 +00:00
switch( m_PinType )
{
2008-04-16 19:12:40 +00:00
default:
case PIN_INPUT: Etype = 'I'; break;
case PIN_OUTPUT: Etype = 'O'; break;
case PIN_BIDI: Etype = 'B'; break;
case PIN_TRISTATE: Etype = 'T'; break;
case PIN_PASSIVE: Etype = 'P'; break;
case PIN_UNSPECIFIED: Etype = 'U'; break;
case PIN_POWER_IN: Etype = 'W'; break;
case PIN_POWER_OUT: Etype = 'w'; break;
case PIN_OPENCOLLECTOR: Etype = 'C'; break;
case PIN_OPENEMITTER: Etype = 'E'; break;
2007-09-01 12:00:30 +00:00
}
ReturnPinStringNum( StringPinNum );
if( StringPinNum.IsEmpty() )
StringPinNum = wxT( "~" );
if( !m_PinName.IsEmpty() )
fprintf( ExportFile, "X %s", CONV_TO_UTF8( m_PinName ) );
else
fprintf( ExportFile, "X ~" );
fprintf( ExportFile, " %s %d %d %d %c %d %d %d %d %c",
CONV_TO_UTF8( StringPinNum ),
m_Pos.x, m_Pos.y,
(int) m_PinLen, (int) m_Orient,
m_PinNumSize, m_PinNameSize,
m_Unit, m_Convert, Etype );
if( (m_PinShape) || (m_Attributs & PINNOTDRAW) )
fprintf( ExportFile, " " );
if( m_Attributs & PINNOTDRAW )
fprintf( ExportFile, "N" );
if( m_PinShape & INVERT )
fprintf( ExportFile, "I" );
if( m_PinShape & CLOCK )
fprintf( ExportFile, "C" );
if( m_PinShape & LOWLEVEL_IN )
fprintf( ExportFile, "L" );
if( m_PinShape & LOWLEVEL_OUT )
fprintf( ExportFile, "V" );
fprintf( ExportFile, "\n" );
2008-09-18 17:10:54 +00:00
return true;
}
2007-09-01 12:00:30 +00:00
/****************************************************/
2008-09-18 17:10:54 +00:00
bool LibDrawPolyline::Save( FILE* ExportFile ) const
/****************************************************/
{
2009-01-02 13:19:34 +00:00
int ccount = GetCornerCount();
2007-09-01 12:00:30 +00:00
fprintf( ExportFile, "P %d %d %d %d",
2009-01-02 13:19:34 +00:00
ccount,
2007-09-01 12:00:30 +00:00
m_Unit, m_Convert,
m_Width );
2009-01-02 13:19:34 +00:00
for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
2007-09-01 12:00:30 +00:00
{
2009-01-02 13:19:34 +00:00
fprintf( ExportFile, " %d %d", m_PolyPoints[ii].x, m_PolyPoints[ii].y );
2007-09-01 12:00:30 +00:00
}
fprintf( ExportFile, " %c\n", fill_tab[m_Fill] );
2008-09-18 17:10:54 +00:00
return true;
}
/****************************************************/
bool LibDrawSegment::Save( FILE* ExportFile ) const
/****************************************************/
{
fprintf( ExportFile, "L %d %d %d",
m_Unit, m_Convert,
m_Width );
return true;
}
/**********************************************************/
2007-09-01 12:00:30 +00:00
LibEDA_BaseStruct* CopyDrawEntryStruct( wxWindow* frame,
LibEDA_BaseStruct* DrawItem )
/**********************************************************/
2007-09-01 12:00:30 +00:00
/** Function CopyDrawEntryStruct
* Duplicate a DrawLibItem
* the new item is only created, it is not put in the current component linked list
* @param DrawEntry = DrawLibItem * item to duplicate
* @return a pointer to the new item
2008-04-16 19:12:40 +00:00
* A better way to duplicate a DrawLibItem is to have a virtual GenCopy() in LibEDA_BaseStruct class (ToDo).
2007-09-01 12:00:30 +00:00
*/
{
2007-09-01 12:00:30 +00:00
LibEDA_BaseStruct* NewDrawItem = NULL;
wxString msg;
switch( DrawItem->Type() )
{
case COMPONENT_ARC_DRAW_TYPE:
NewDrawItem = ( (LibDrawArc*) DrawItem )->GenCopy();
break;
case COMPONENT_CIRCLE_DRAW_TYPE:
NewDrawItem = ( (LibDrawCircle*) DrawItem )->GenCopy();
break;
case COMPONENT_RECT_DRAW_TYPE:
NewDrawItem = ( (LibDrawSquare*) DrawItem )->GenCopy();
break;
case COMPONENT_PIN_DRAW_TYPE:
NewDrawItem = ( (LibDrawPin*) DrawItem )->GenCopy();
break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
NewDrawItem = ( (LibDrawText*) DrawItem )->GenCopy();
break;
case COMPONENT_POLYLINE_DRAW_TYPE:
NewDrawItem = ( (LibDrawPolyline*) DrawItem )->GenCopy();
break;
default:
msg.Printf( wxT( "CopyDrawLibEntryStruct: unknown Draw Type %d" ),
DrawItem->Type() );
DisplayError( frame, msg );
break;
}
return NewDrawItem;
}
2007-09-01 12:00:30 +00:00
/*************************************************************************************************/
2007-09-01 12:00:30 +00:00
EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame, EDA_LibComponentStruct* OldEntry )
/*************************************************************************************************/
2007-09-01 12:00:30 +00:00
/* Routine de copie d'une partlib
2007-09-01 12:00:30 +00:00
* Parametres d'entree: pointeur sur la structure de depart
* Parametres de sortie: pointeur sur la structure creee
* Do not copy new items ( i.e. with m_Flag & IS_NEW)
*/
{
2007-09-01 12:00:30 +00:00
EDA_LibComponentStruct* NewStruct;
LibEDA_BaseStruct* NewDrawings, * OldDrawings;
LibEDA_BaseStruct* LastItem;
LibDrawField* OldField, * NewField;
if( OldEntry->Type != ROOT )
{
DisplayError( frame, wxT( "CopyLibEntryStruct(): Type != ROOT" ) );
return NULL;
}
NewStruct = new EDA_LibComponentStruct( NULL );
OldEntry->m_Prefix.Copy( &NewStruct->m_Prefix );
OldEntry->m_Name.Copy( &NewStruct->m_Name );
NewStruct->m_UnitCount = OldEntry->m_UnitCount;
NewStruct->m_TextInside = OldEntry->m_TextInside;
NewStruct->m_DrawPinNum = OldEntry->m_DrawPinNum;
NewStruct->m_DrawPinName = OldEntry->m_DrawPinName;
NewStruct->m_Options = OldEntry->m_Options;
NewStruct->m_UnitSelectionLocked = OldEntry->m_UnitSelectionLocked;
/* Copie des sous structures: */
NewStruct->m_AliasList = OldEntry->m_AliasList;
NewStruct->m_Doc = OldEntry->m_Doc;
NewStruct->m_KeyWord = OldEntry->m_KeyWord;
NewStruct->m_DocFile = OldEntry->m_DocFile;
/* Copie des champs */
for( OldField = OldEntry->m_Fields; OldField != NULL; OldField = OldField->Next() )
2007-09-01 12:00:30 +00:00
{
NewField = OldField->GenCopy();
NewStruct->m_Fields.PushBack( NewField );
2007-09-01 12:00:30 +00:00
}
/* Copie des elements type Drawing */
LastItem = NULL;
for( OldDrawings = OldEntry->m_Drawings; OldDrawings != NULL; OldDrawings = OldDrawings->Next() )
{
if( ( OldDrawings->m_Flags & IS_NEW) != 0 )
continue;
2008-04-16 19:12:40 +00:00
2007-09-01 12:00:30 +00:00
NewDrawings = CopyDrawEntryStruct( frame, OldDrawings );
if( NewDrawings )
{
if( LastItem == NULL )
NewStruct->m_Drawings = NewDrawings;
else
LastItem->SetNext( NewDrawings );
2007-09-01 12:00:30 +00:00
LastItem = NewDrawings;
NewDrawings->SetNext( NULL );
2007-09-01 12:00:30 +00:00
}
else // Should nevers occurs, just in case...
{ // CopyDrawEntryStruct() was not able to duplicate the type of OldDrawings
2008-04-16 19:12:40 +00:00
// occurs when an unexpected type is encountered
2007-09-01 12:00:30 +00:00
DisplayError( frame, wxT( "CopyLibEntryStruct(): error: aborted" ) );
break;
}
}
/* Copy the footprint filter list */
for( unsigned ii = 0; ii < OldEntry->m_FootprintList.GetCount(); ii++ )
NewStruct->m_FootprintList.Add( OldEntry->m_FootprintList[ii] );
return NewStruct;
}
2008-09-19 08:19:15 +00:00
/************************************************/
bool EDA_LibComponentStruct::Save( FILE* aFile )
/***********************************************/
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
2007-09-01 12:00:30 +00:00
*/
#define UNUSED 0
{
2007-09-01 12:00:30 +00:00
LibEDA_BaseStruct* DrawEntry;
LibDrawField* Field;
2008-09-19 08:19:15 +00:00
if( Type != ROOT ) // should not happen, but just in case
return false;
2007-09-01 12:00:30 +00:00
2008-09-19 08:19:15 +00:00
/* First line: it s a comment (component name for readers) */
fprintf( aFile, "#\n# %s\n#\n", CONV_TO_UTF8( m_Name.m_Text ) );
2007-09-01 12:00:30 +00:00
2008-09-19 08:19:15 +00:00
/* Save data */
fprintf( aFile, "DEF" );
if( (m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0 )
fprintf( aFile, " %s", CONV_TO_UTF8( m_Name.m_Text ) );
2007-09-01 12:00:30 +00:00
else
2008-09-19 08:19:15 +00:00
fprintf( aFile, " ~%s", CONV_TO_UTF8( m_Name.m_Text ) );
2007-09-01 12:00:30 +00:00
2008-09-19 08:19:15 +00:00
if( !m_Prefix.m_Text.IsEmpty() )
fprintf( aFile, " %s", CONV_TO_UTF8( m_Prefix.m_Text ) );
2007-09-01 12:00:30 +00:00
else
2008-09-19 08:19:15 +00:00
fprintf( aFile, " ~" );
fprintf( aFile, " %d %d %c %c %d %c %c\n",
UNUSED, m_TextInside,
m_DrawPinNum ? 'Y' : 'N',
m_DrawPinName ? 'Y' : 'N',
m_UnitCount, m_UnitSelectionLocked ? 'L' : 'F',
m_Options == ENTRY_POWER ? 'P' : 'N' );
2007-09-01 12:00:30 +00:00
2008-09-19 08:19:15 +00:00
WriteLibEntryDateAndTime( aFile, this );
2007-09-01 12:00:30 +00:00
2008-09-19 08:19:15 +00:00
/* Save fields */
m_Prefix.Save( aFile );
m_Name.Save( aFile );
for( Field = m_Fields; Field != NULL; Field = Field->Next() )
2007-09-01 12:00:30 +00:00
{
if( Field->m_Text.IsEmpty() && Field->m_Name.IsEmpty() )
continue;
2008-09-19 08:19:15 +00:00
Field->Save( aFile );
2007-09-01 12:00:30 +00:00
}
2008-09-19 08:19:15 +00:00
/* Save the alias list: a line starting by "ALIAS" */
if( m_AliasList.GetCount() != 0 )
2007-09-01 12:00:30 +00:00
{
2008-09-19 08:19:15 +00:00
fprintf( aFile, "ALIAS" );
2007-09-01 12:00:30 +00:00
unsigned ii;
2008-09-19 08:19:15 +00:00
for( ii = 0; ii < m_AliasList.GetCount(); ii++ )
fprintf( aFile, " %s", CONV_TO_UTF8( m_AliasList[ii] ) );
2007-09-01 12:00:30 +00:00
2008-09-19 08:19:15 +00:00
fprintf( aFile, "\n" );
2007-09-01 12:00:30 +00:00
}
/* Write the footprint filter list */
2008-09-19 08:19:15 +00:00
if( m_FootprintList.GetCount() != 0 )
2007-09-01 12:00:30 +00:00
{
2008-09-19 08:19:15 +00:00
fprintf( aFile, "$FPLIST\n" );
2007-09-01 12:00:30 +00:00
unsigned ii;
2008-09-19 08:19:15 +00:00
for( ii = 0; ii < m_FootprintList.GetCount(); ii++ )
fprintf( aFile, " %s\n", CONV_TO_UTF8( m_FootprintList[ii] ) );
2007-09-01 12:00:30 +00:00
2008-09-19 08:19:15 +00:00
fprintf( aFile, "$ENDFPLIST\n" );
2007-09-01 12:00:30 +00:00
}
2008-09-19 08:19:15 +00:00
/* Save graphics items (including pins) */
if( m_Drawings )
2007-09-01 12:00:30 +00:00
{
/* we sort the draw items, in order to have an edition more easy,
* when a file editing "by hand" is made */
2008-09-19 08:19:15 +00:00
SortDrawItems();
2007-09-01 12:00:30 +00:00
2008-09-19 08:19:15 +00:00
fprintf( aFile, "DRAW\n" );
DrawEntry = m_Drawings;
2007-09-01 12:00:30 +00:00
while( DrawEntry )
{
2008-09-19 08:19:15 +00:00
DrawEntry->Save( aFile );
2007-09-01 12:00:30 +00:00
DrawEntry = DrawEntry->Next();
}
2008-09-19 08:19:15 +00:00
fprintf( aFile, "ENDDRAW\n" );
2007-09-01 12:00:30 +00:00
}
2008-09-19 08:19:15 +00:00
fprintf( aFile, "ENDDEF\n" );
2007-09-01 12:00:30 +00:00
2008-09-19 08:19:15 +00:00
return true;
}
2007-09-01 12:00:30 +00:00
2008-09-19 08:19:15 +00:00
/***************************************/
bool LibCmpEntry::SaveDoc( FILE* aFile )
/***************************************/
/**
* Function SaveDoc
* writes the doc info out to a FILE in "*.dcm" format.
* Only non empty fields are written.
* If all fielsd are empty, does not write anything
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
2007-09-01 12:00:30 +00:00
*/
{
2008-09-19 08:19:15 +00:00
if( m_Doc.IsEmpty() && m_KeyWord.IsEmpty() && m_DocFile.IsEmpty() )
return true;
2007-09-01 12:00:30 +00:00
/* Generation des lignes utiles */
2008-09-19 08:19:15 +00:00
fprintf( aFile, "#\n$CMP %s\n", CONV_TO_UTF8( m_Name.m_Text ) );
2008-09-19 08:19:15 +00:00
if( ! m_Doc.IsEmpty() )
fprintf( aFile, "D %s\n", CONV_TO_UTF8( m_Doc ) );
2008-09-19 08:19:15 +00:00
if( ! m_KeyWord.IsEmpty() )
fprintf( aFile, "K %s\n", CONV_TO_UTF8( m_KeyWord ) );
2008-09-19 08:19:15 +00:00
if( ! m_DocFile.IsEmpty() )
fprintf( aFile, "F %s\n", CONV_TO_UTF8( m_DocFile ) );
2008-09-19 08:19:15 +00:00
fprintf( aFile, "$ENDCMP\n" );
return true;
}
2007-09-01 12:00:30 +00:00
/*********************************************************************************/
2008-09-18 17:10:54 +00:00
bool LibraryStruct::SaveLibrary( const wxString& FullFileName )
/*********************************************************************************/
2008-09-18 17:10:54 +00:00
/**
* Function SaveLibrary
* writes the data structures for this object out to 2 file
* the library in "*.lib" format.
* the doc file in "*.dcm" format.
* creates a backup file for each file (.bak and .bck)
* @param aFullFileName The full lib filename.
* @return bool - true if success writing else false.
2007-09-01 12:00:30 +00:00
*/
{
2008-09-18 17:10:54 +00:00
FILE* libfile, *docfile;
2007-09-01 12:00:30 +00:00
EDA_LibComponentStruct* LibEntry;
2008-09-18 17:10:54 +00:00
wxString libname, docname, backupname, msg;
2007-09-01 12:00:30 +00:00
2008-09-18 17:10:54 +00:00
libname = FullFileName;
2007-09-01 12:00:30 +00:00
2008-09-18 17:10:54 +00:00
/* the old .lib file is renamed .bak */
if( wxFileExists( libname ) )
2007-09-01 12:00:30 +00:00
{
2008-09-18 17:10:54 +00:00
backupname = libname; ChangeFileNameExt( backupname, wxT( ".bak" ) );
wxRemoveFile( backupname );
if( !wxRenameFile( libname, backupname ) )
2007-09-01 12:00:30 +00:00
{
2008-09-18 17:10:54 +00:00
msg = wxT( "Failed to rename old lib file " ) + backupname;
DisplayError( NULL, msg, 20 );
2007-09-01 12:00:30 +00:00
}
}
2008-09-18 17:10:54 +00:00
docname = FullFileName; ChangeFileNameExt( docname, DOC_EXT );
2007-09-01 12:00:30 +00:00
/* L'ancien fichier doc lib est renomme en .bck */
2008-09-18 17:10:54 +00:00
if( wxFileExists( docname ) )
2007-09-01 12:00:30 +00:00
{
2008-09-18 17:10:54 +00:00
backupname = docname; ChangeFileNameExt( backupname, wxT( ".bck" ) );
wxRemoveFile( backupname );
if( !wxRenameFile( docname, backupname ) )
2007-09-01 12:00:30 +00:00
{
2008-09-18 17:10:54 +00:00
msg = wxT( "Failed to save old doc lib file " ) + backupname;
DisplayError( NULL, msg, 20 );
2007-09-01 12:00:30 +00:00
}
}
2008-09-18 17:10:54 +00:00
libfile = wxFopen( libname, wxT( "wt" ) );
if( libfile == NULL )
{
msg = wxT( "Failed to create Lib File " ) + libname;
DisplayError( NULL, msg, 20 );
return false;
2007-09-01 12:00:30 +00:00
}
2008-09-18 17:10:54 +00:00
docfile = wxFopen( docname, wxT( "wt" ) );
if( docfile == NULL )
2007-09-01 12:00:30 +00:00
{
2008-09-18 17:10:54 +00:00
msg = wxT( "Failed to create DocLib File " ) + docname;
DisplayError( NULL, msg, 20 );
2007-09-01 12:00:30 +00:00
}
2008-09-18 17:10:54 +00:00
m_Modified = 0;
2007-09-01 12:00:30 +00:00
/* Creation de l'entete de la librairie */
2008-09-18 17:10:54 +00:00
m_TimeStamp = GetTimeStamp();
WriteHeader( libfile );
2007-09-01 12:00:30 +00:00
/* Sauvegarde des composant: */
PQCompFunc( (PQCompFuncType) LibraryEntryCompare );
2008-09-18 17:10:54 +00:00
LibEntry = (EDA_LibComponentStruct*) PQFirst( &m_Entries, FALSE );
char Line[256];
fprintf( docfile, "%s Date: %s\n", DOCFILE_IDENT,
DateAndTime( Line ) );
2007-09-01 12:00:30 +00:00
2008-09-18 17:10:54 +00:00
bool success = true;
2007-09-01 12:00:30 +00:00
while( LibEntry )
{
2008-09-19 08:19:15 +00:00
if ( LibEntry->Type == ROOT )
{
if ( ! LibEntry->Save( libfile ) )
success = false;
}
2008-09-18 17:10:54 +00:00
if ( docfile )
2008-09-19 08:19:15 +00:00
{
if ( ! LibEntry->SaveDoc( docfile ) )
2008-09-18 17:10:54 +00:00
success = false;
2008-09-19 08:19:15 +00:00
}
2007-09-01 12:00:30 +00:00
LibEntry = (EDA_LibComponentStruct*)
2008-09-18 17:10:54 +00:00
PQNext( m_Entries, LibEntry, NULL );
2007-09-01 12:00:30 +00:00
}
2008-09-18 17:10:54 +00:00
fprintf( libfile, "#\n#End Library\n" );
if ( docfile )
fprintf( docfile, "#\n#End Doc Library\n" );
fclose( libfile );
fclose( docfile );
return success;
}
/*************************************************************************************/
2007-09-01 12:00:30 +00:00
static bool WriteLibEntryDateAndTime( FILE* ExportFile, EDA_LibComponentStruct* LibEntry )
/*************************************************************************************/
2007-09-01 12:00:30 +00:00
/* lit date et time de modif composant sous le format:
2007-09-01 12:00:30 +00:00
* "Ti yy/mm/jj hh:mm:ss"
*/
{
2007-09-01 12:00:30 +00:00
int year, mon, day, hour, min, sec;
2007-09-01 12:00:30 +00:00
if( LibEntry->m_LastDate == 0 )
return TRUE;
2007-09-01 12:00:30 +00:00
sec = LibEntry->m_LastDate & 63;
min = (LibEntry->m_LastDate >> 6) & 63;
hour = (LibEntry->m_LastDate >> 12) & 31;
day = (LibEntry->m_LastDate >> 17) & 31;
mon = (LibEntry->m_LastDate >> 22) & 15;
year = (LibEntry->m_LastDate >> 26) + 1990;
2007-09-01 12:00:30 +00:00
fprintf( ExportFile, "Ti %d/%d/%d %d:%d:%d\n", year, mon, day, hour, min, sec );
2007-09-01 12:00:30 +00:00
return TRUE;
}