5514Fermer5516
Kevin KoflerLe 11/03/2008 à 12:31
Zephyr (./5504) :
mais bien sûr, v lire ta source de 2000 lignes smile

C'est si dur que ça de faire un Ctrl+F? roll

Extrait de ld-tigcc:
/* manip.c: Routines to manipulate the internal data

   Copyright (C) 2002-2004 Sebastian Reichelt
   Copyright (C) 2003-2007 Kevin Kofler

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program 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 General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
// Find the item preceding or following the given location. May return NULL. #define DefineFindItemAtPos(Type,Item,LocationSuffix) \ Type *Find##Item##AtPos (const SECTION *Section, OFFSET Location, BOOLEAN Following) \ { \      /* Find the place so that Item->Location is always less than Location */ \      /* and Next##Item->Location is always greater or equal. */ \      Type *Item = NULL, *Next##Item = NULL; \      if (Location > Section->Size >> 1) \      { \           Item = GetLast (Section->Item##s); \           while (Item && (Item->Location LocationSuffix >= Location)) \           { \                Next##Item = Item; \                Item = GetPrev (Item); \           } \      } \      else \      { \           Next##Item = GetFirst (Section->Item##s); \           while (Next##Item && (Next##Item->Location LocationSuffix < Location)) \           { \                Item = Next##Item; \                Next##Item = GetNext (Next##Item); \           } \      } \      /* If we are looking for something that follows, the case is clear. */ \      /* Otherwise, we need to check whether the next item is also OK. */ \      if (Following || (Next##Item && (Next##Item->Location LocationSuffix <= Location))) \           return Next##Item; \      else \           return Item; \ } DefineFindItemAtPos (SYMBOL,   Symbol,  ); DefineFindItemAtPos (RELOC,    Reloc,   ); DefineFindItemAtPos (ROM_CALL, ROMCall, ); DefineFindItemAtPos (RAM_CALL, RAMCall, ); DefineFindItemAtPos (LIB_CALL, LibCall, ); DefineFindItemAtPos (SEGMENT,  Segment, .Start->Location); #undef DefineFindItemAtPos
Licence: GPL version 2 ou GPL version 3.