Index: entry.h
===================================================================
--- entry.h	(revision 716)
+++ entry.h	(working copy)
@@ -438,6 +438,7 @@
     bool         m_noLoad;
 };
 
+bool canDisplayProtection(Protection prot);
 
 typedef QList<Entry> EntryList;
 typedef QListIterator<Entry> EntryListIterator;
Index: doxygen.cpp
===================================================================
--- doxygen.cpp	(revision 716)
+++ doxygen.cpp	(working copy)
@@ -4474,7 +4474,7 @@
       if (!root->name.isEmpty() && root->name.find('@')==-1 && // normal name
           (guessSection(root->fileName)==Entry::HEADER_SEC || 
            Config_getBool("EXTRACT_LOCAL_CLASSES")) && // not defined in source file
-          (root->protection!=Private || Config_getBool("EXTRACT_PRIVATE")) && // hidden by protection
+          canDisplayProtection(root->protection) && // hidden by protection
           !Config_getBool("HIDE_UNDOC_CLASSES") // undocumented class are visible
          )
         warn_undoc(
Index: configoptions.cpp
===================================================================
--- configoptions.cpp	(revision 716)
+++ configoptions.cpp	(working copy)
@@ -427,6 +427,14 @@
                  "will be included in the documentation.",
                  FALSE
                 );
+
+  cb = cfg->addBool(
+                 "EXTRACT_PACKAGE",
+                 "If the EXTRACT_PACKAGE tag is set to YES all internal/package members of a class\n"
+                 "will be included in the documentation.",
+                 FALSE
+                );
+
   //----
   cb = cfg->addBool(
                  "EXTRACT_STATIC",
Index: entry.cpp
===================================================================
--- entry.cpp	(revision 716)
+++ entry.cpp	(working copy)
@@ -464,3 +464,20 @@
   m_noLoad=TRUE; 
 }
 
+
+bool canDisplayProtection(Protection prot)
+{
+    static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
+    static bool extractPackage = Config_getBool("EXTRACT_PACKAGE");
+
+	bool retval = true;
+
+	if (prot == Private || prot == Package)
+	{
+		if (extractPrivate) retval = true;
+		else if (extractPackage && prot == Package) retval = true;
+		else retval = false;
+	}
+	return retval;
+}
+
Index: classdef.cpp
===================================================================
--- classdef.cpp	(revision 716)
+++ classdef.cpp	(working copy)
@@ -365,12 +365,13 @@
 
   if (!isReference())
   {
-    static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
 
     /********************************************/
     /* insert member in the declaration section */
     /********************************************/
-    if (md->isRelated() && (extractPrivate || prot!=Private))
+	
+
+    if (md->isRelated() && canDisplayProtection(prot))
     {
       addMemberToList(MemberList::related,md,true);
     }
@@ -513,7 +514,7 @@
     /*******************************************************/
     /* insert member in the detailed documentation section */
     /*******************************************************/
-    if ((md->isRelated() && (extractPrivate || prot!=Private)) || md->isFriend())
+    if (md->isRelated() && (canDisplayProtection(prot) || md->isFriend()))
     {
       addMemberToList(MemberList::relatedMembers,md,false);
     }
@@ -532,23 +533,11 @@
           addMemberToList(MemberList::functionMembers,md,false);
           break;
         case MemberDef::Slot:
-          switch (prot)
-          {
-            case Protected: 
-            case Package: 
-            case Public:    
+			if (canDisplayProtection(prot))
               addMemberToList(MemberList::functionMembers,md,false);
-              break;
-            case Private:   
-              if (extractPrivate)
-              {
-                addMemberToList(MemberList::functionMembers,md,false);
-              }
-              break;
-          }
           break;
         default: // any of the other members
-          if (prot!=Private || extractPrivate)
+          if (canDisplayProtection(prot))
           {
             switch (md->memberType())
             {
@@ -1641,8 +1630,7 @@
     for (cli.toFirst();(innerCd=cli.current());++cli)
     {
       if (innerCd->isLinkableInProject() && innerCd->templateMaster()==0 &&
-          (innerCd->protection()!=Private || Config_getBool("EXTRACT_PRIVATE"))
-         )
+		  canDisplayProtection(innerCd->protection()))
       {
         msg("Generating docs for nested compound %s...\n",innerCd->name().data());
         innerCd->writeDocumentation(ol);
@@ -1745,7 +1733,7 @@
           memberWritten=TRUE;
         }
         else if (!Config_getBool("HIDE_UNDOC_MEMBERS") && 
-                  (md->protection()!=Private || Config_getBool("EXTRACT_PRIVATE") || md->isFriend()) 
+			(canDisplayProtection(md->protection()) || md->isFriend())
                 ) // no documentation, 
                   // generate link to the class instead.
         {
@@ -2022,11 +2010,14 @@
   writePlainMemberDeclaration(ol,MemberList::proSlots,inGroup);
   writePlainMemberDeclaration(ol,MemberList::proStaticMethods,inGroup);
   writePlainMemberDeclaration(ol,MemberList::proStaticAttribs,inGroup);
+  if (Config_getBool("EXTRACT_PACKAGE"))
+  {
   writePlainMemberDeclaration(ol,MemberList::pacTypes,inGroup);
   writePlainMemberDeclaration(ol,MemberList::pacMethods,inGroup);
   writePlainMemberDeclaration(ol,MemberList::pacAttribs,inGroup);
   writePlainMemberDeclaration(ol,MemberList::pacStaticMethods,inGroup);
   writePlainMemberDeclaration(ol,MemberList::pacStaticAttribs,inGroup);
+  }
   if (Config_getBool("EXTRACT_PRIVATE"))
   {
     writePlainMemberDeclaration(ol,MemberList::priTypes,inGroup);
@@ -2043,7 +2034,6 @@
 /*! a link to this class is possible within this project */
 bool ClassDef::isLinkableInProject() const
 { 
-  static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
   static bool extractLocal   = Config_getBool("EXTRACT_LOCAL_CLASSES");
   static bool extractStatic  = Config_getBool("EXTRACT_STATIC");
   static bool hideUndoc      = Config_getBool("HIDE_UNDOC_CLASSES");
@@ -2056,7 +2046,7 @@
     return !name().isEmpty() &&                    /* has a name */
       !isArtificial() && !isHidden() &&            /* not hidden */
       name().find('@')==-1 &&                      /* not anonymous */
-      (m_impl->prot!=Private || extractPrivate) && /* private */
+	  canDisplayProtection(m_impl->prot) &&
       (!m_impl->isLocal      || extractLocal)   && /* local */
       (hasDocumentation()    || !hideUndoc)     && /* documented */ 
       (!m_impl->isStatic     || extractStatic)  && /* static */
@@ -2081,18 +2071,20 @@
 bool ClassDef::isVisibleInHierarchy() 
 { 
   static bool allExternals     = Config_getBool("ALLEXTERNALS");
-  static bool extractPrivate   = Config_getBool("EXTRACT_PRIVATE");
   static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES");
   static bool extractStatic    = Config_getBool("EXTRACT_STATIC");
 
+  const char *nm = name();
+
+  // msg("Visible in hierarchy %s -> %d %d\n", nm, m_impl->prot, canDisplayProtection(m_impl->prot));
+
   return // show all classes or a subclass is visible
       (allExternals || hasNonReferenceSuperClass()) &&
       // and not an annonymous compound
       name().find('@')==-1 &&
       // not an artifically introduced class
       !isArtificial() &&
-      // and not privately inherited
-      (m_impl->prot!=Private || extractPrivate) &&
+	  canDisplayProtection(m_impl->prot) &&
       // documented or shown anyway or documentation is external 
       (hasDocumentation() || 
        !hideUndocClasses || 
Index: scanner.l
===================================================================
--- scanner.l	(revision 716)
+++ scanner.l	(working copy)
@@ -1916,6 +1916,10 @@
 					    {
 					      current->protection = Protected;
 					    }
+					    else if (javaLike && strcmp(yytext,"internal")==0)
+					    {
+					      current->protection = Package;
+					    }
 					    else if (javaLike && strcmp(yytext,"private")==0)
 					    {
 					      current->protection = Private;
@@ -4717,6 +4721,7 @@
 <BasesProt>"virtual"{BN}+               { lineCount(); baseVirt = Virtual; }
 <BasesProt>"public"{BN}+                { lineCount(); baseProt = Public; }
 <BasesProt>"protected"{BN}+             { lineCount(); baseProt = Protected; }
+<BasesProt>"internal"{BN}+             { lineCount(); baseProt = Package; }
 <BasesProt>"private"{BN}+               { lineCount(); baseProt = Private; }
 <BasesProt>{BN}				{ lineCount(); }
 <BasesProt>.				{ unput(*yytext); BEGIN(Bases); }
@@ -5587,7 +5592,7 @@
   inputString = fileBuf;
   inputPosition = 0;
   g_inputFromFile = FALSE;
-
+  
   //anonCount     = 0;  // don't reset per file
   depthIf       = 0;
   protection    = Public;
Index: memberdef.cpp
===================================================================
--- memberdef.cpp	(revision 716)
+++ memberdef.cpp	(working copy)
@@ -848,7 +848,6 @@
 
 bool MemberDef::isLinkableInProject() const
 {
-  static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
   static bool extractStatic  = Config_getBool("EXTRACT_STATIC");
   makeResident();
 
@@ -895,7 +894,7 @@
     //printf("in a file but file not linkable!\n");
     return FALSE; // in file (and not in namespace) but file not linkable
   }
-  if (m_impl->prot==Private && !extractPrivate && m_impl->mtype!=Friend) 
+  if (!canDisplayProtection(m_impl->prot) && m_impl->mtype!=Friend) 
   {
     //printf("private and invisible!\n");
     return FALSE; // hidden due to protection
@@ -1038,7 +1037,6 @@
   static bool briefMemberDesc     = Config_getBool("BRIEF_MEMBER_DESC");
   static bool repeatBrief         = Config_getBool("REPEAT_BRIEF");
   static bool hideFriendCompounds = Config_getBool("HIDE_FRIEND_COMPOUNDS");
-  static bool extractPrivate      = Config_getBool("EXTRACT_PRIVATE");
 
   //printf("Member %s grpId=%d docs=%s file=%s args=%s\n",
   //    name().data(),
@@ -1088,8 +1086,7 @@
   
   // only include members that are non-private unless EXTRACT_PRIVATE is
   // set to YES or the member is part of a group
-  bool visibleIfPrivate = (protection()!=Private || 
-                           extractPrivate ||
+  bool visibleIfPrivate = (canDisplayProtection(protection()) ||
                            m_impl->mtype==Friend
                           );
   
@@ -1350,7 +1347,7 @@
     //printf("Member name=`%s gd=%p md->groupDef=%p inGroup=%d isLinkable()=%d\n",name().data(),gd,getGroupDef(),inGroup,isLinkable());
     if (!(name().isEmpty() || name().at(0)=='@') && // name valid
         (hasDocumentation() || isReference()) && // has docs
-        !(m_impl->prot==Private && !Config_getBool("EXTRACT_PRIVATE") && m_impl->mtype!=Friend) && // hidden due to protection
+        !(canDisplayProtection(m_impl->prot) && m_impl->mtype!=Friend) && // hidden due to protection
         !(isStatic() && m_impl->classDef==0 && !Config_getBool("EXTRACT_STATIC")) // hidden due to static-ness
        )
     {
@@ -1558,7 +1555,6 @@
   static bool briefMemberDesc   = Config_getBool("BRIEF_MEMBER_DESC");
   static bool hideUndocMembers  = Config_getBool("HIDE_UNDOC_MEMBERS");
   static bool extractStatic     = Config_getBool("EXTRACT_STATIC");
-  static bool extractPrivate    = Config_getBool("EXTRACT_PRIVATE");
 
   makeResident();
   // the member has details documentation for any of the following reasons
@@ -1595,7 +1591,7 @@
          
   // only include members that are non-private unless EXTRACT_PRIVATE is
   // set to YES or the member is part of a group
-  bool privateFilter = (protection()!=Private || extractPrivate ||
+  bool privateFilter = (canDisplayProtection(protection()) ||
                            m_impl->mtype==Friend
                           );
 
@@ -2410,8 +2406,7 @@
   if ((!hasUserDocumentation() && !extractAll) &&
       !isFriendClass() && 
       name().find('@')==-1 && d->name().find('@')==-1 &&
-      (m_impl->prot!=Private || Config_getBool("EXTRACT_PRIVATE"))
-     )
+	  canDisplayProtection(m_impl->prot))
   {
     warn_undoc(getDefFileName(),getDefLine(),"Warning: Member %s%s (%s) of %s %s is not documented.",
          name().data(),argsString()?argsString():"",memberTypeName().data(),t,d->name().data());
@@ -2980,10 +2975,7 @@
 bool MemberDef::protectionVisible() const
 {
   makeResident();
-  return m_impl->prot==Public || 
-         (m_impl->prot==Private   && Config_getBool("EXTRACT_PRIVATE"))   ||
-         (m_impl->prot==Protected && Config_getBool("EXTRACT_PROTECTED")) ||
-         (m_impl->prot==Package   && Config_getBool("EXTRACT_PACKAGE"));
+  return canDisplayProtection(m_impl->prot);
 }
 
 #if 0
