Ejemplo n.º 1
0
/*_____________________________________PRICINGMETHODS__________________________________*/     
int FGetMethod(char **InputFile,int user,Planning *pt_plan,Pricing *Pr,PricingMethod *Met,Option *opt)
{

  (Met->Init)(Met,opt);
  if (user==TOSCREEN)
    {
      Fprintf(TOSCREEN,"%s\n",Met->Name);
      if (pt_plan->NumberOfMethods != 0)
        FixMethod(pt_plan,Met);
      FGetParVar(InputFile,pt_plan,user,Met->Par);
    }
  return ShowMethod(TOSCREENANDFILE,pt_plan,Pr,Met,opt);         

}
Ejemplo n.º 2
0
int GetMethod(int user,Planning *pt_plan,Pricing *Pr,PricingMethod *Met,Option *opt)
{	
  (Met->Init)(Met,opt);
  if (user==TOSCREEN)
    {
      if (ShowMethod(user,pt_plan,Pr,Met,opt))	
        {
          do
            {
              Fprintf(TOSCREEN,"%s\n",Met->Name);
              if (pt_plan->NumberOfMethods != 0)
                FixMethod(pt_plan,Met);
              GetParVar(pt_plan,user,Met->Par);
            }
          while (ShowMethod(user,pt_plan,Pr,Met,opt));
        }
    }
  return ShowMethod(TOSCREENANDFILE,pt_plan,Pr,Met,opt);         
}
Ejemplo n.º 3
0
int ShowMethod(int user,Planning *pt_plan,Pricing *Pr,PricingMethod *Met,Option *opt)
{  	
  char helpfile[MAX_PATH_LEN]="";

  (Met->Init)(Met,opt);
  get_method_helpfile (Pr, Met, helpfile);

  if (user==TOSCREEN)
    FixMethod(pt_plan,Met);

  if (user==TOSCREENANDFILE)
    ShowParVar(pt_plan,user,Met->Par);
  else
    {
      if (ShowParVar(pt_plan,user,Met->Par)==OK)
        return Valid(user,(Met->Check)(user, pt_plan, Met)+ChkParVar(pt_plan,Met->Par),helpfile);  
      else
        return Valid(NO_PAR,ChkParVar(pt_plan,Met->Par),helpfile);  
    }
  return OK;
}
Ejemplo n.º 4
0
int IfaceCheckApp::CompareClasses(const wxClass* iface, const wxClass* api)
{
    const wxMethod *real;
    int count = 0;

    wxASSERT(iface && api);

    // shorten the name of the header so the log file is more readable
    wxString header = wxFileName(iface->GetHeader()).GetFullName();

#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
    for (unsigned int i=0; i<iface->GetMethodCount(); i++)
    {
        const wxMethod& m = iface->GetMethod(i);

        // only compare the methods which are available for the port
        // for which the gcc XML was produced
        if (m.GetAvailability() != wxPORT_UNKNOWN &&
            (m.GetAvailability() & m_gccInterface.GetInterfacePort()) == 0) {

            if (g_verbose)
            {
                wxLogMessage("skipping method '%s' since it's not available for the %s port.",
                           m.GetAsString(), m_gccInterface.GetInterfacePortName());
            }

            continue;       // skip this method
        }

        // search in the methods of the api classes provided
        real = api->RecursiveUpwardFindMethod(m, &m_gccInterface);

        // avoid some false positives:
        if (!real && m.ActsAsDefaultCtor())
        {
            // build an artificial default ctor for this class:
            wxMethod temp(m);
            temp.GetArgumentTypes().Clear();

            // repeat search:
            real = api->RecursiveUpwardFindMethod(temp, &m_gccInterface);
        }

        // no matches?
        if (!real)
        {
            bool proceed = true;
            wxMethodPtrArray overloads =
                api->RecursiveUpwardFindMethodsNamed(m.GetName(), &m_gccInterface);

            // avoid false positives:
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
            for (unsigned int k=0; k<overloads.GetCount(); k++)
                if (overloads[k]->MatchesExceptForAttributes(m) &&
                    m.IsDeprecated() && !overloads[k]->IsDeprecated())
                {
                    // maybe the iface method is marked as deprecated but the
                    // real method is not?
                    wxMethod tmp(*overloads[k]);
                    tmp.SetDeprecated(true);

                    if (tmp == m)
                    {
                        // in this case, we can disregard this warning... the real
                        // method probably is included in WXWIN_COMPAT sections!
                        proceed = false;    // skip this method
                    }
                }

#define HACK_TO_AUTO_CORRECT_ONLY_METHOD_ATTRIBUTES        0
#if HACK_TO_AUTO_CORRECT_ONLY_METHOD_ATTRIBUTES
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
            for (unsigned int k=0; k<overloads.GetCount(); k++)
                if (overloads[k]->MatchesExceptForAttributes(m))
                {
                    // fix default values of results[k]:
                    wxMethod tmp(*overloads[k]);
                    tmp.SetArgumentTypes(m.GetArgumentTypes());

                    // modify interface header
                    if (FixMethod(iface->GetHeader(), &m, &tmp))
                    {
                        wxLogMessage("Adjusted attributes of '%s' method", m.GetAsString());
                    }

                    proceed = false;
                    break;
                }
#endif // HACK_TO_AUTO_CORRECT_ONLY_METHOD_ATTRIBUTES

            if (proceed)
            {
                if (overloads.GetCount()==0)
                {
                    wxLogMessage("%s: real '%s' class and their parents have no method '%s'",
                                header, api->GetName(), m.GetAsString());
                    // we've found no overloads
                }
                else
                {
                    // first, output a warning
                    wxString warning = header;
                    if (overloads.GetCount()>1)
                        warning += wxString::Format(": in the real headers there are %d overloads of '%s' for "
                                                    "'%s' all with different signatures:\n",
                                                    overloads.GetCount(), m.GetName(), api->GetName());
                    else {
                        warning += wxString::Format(": in the real headers there is a method '%s' for '%s'"
                                                    " but has different signature:\n",
                                                    m.GetName(), api->GetName());
                    }

                    // get a list of the prototypes with _all_ possible attributes:
                    warning += "\tdoxy header: " + m.GetAsString(true, true, true, true);
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
                    for (unsigned int j=0; j<overloads.GetCount(); j++)
                        warning += "\n\treal header: " + overloads[j]->GetAsString(true, true, true, true);

                    wxLogWarning("%s", warning);
                    count++;

                    if (overloads.GetCount()>1)
                    {
                        // TODO: decide which of these overloads is the most "similar" to m
                        //       and eventually modify it
                        if (m_modify)
                        {
                            wxLogWarning("\tmanual fix is required");
                        }
                    }
                    else
                    {
                        wxASSERT(overloads.GetCount() == 1);

                        if (m_modify || m.IsCtor())
                        {
                            wxLogWarning("\tfixing it...");

                            // try to modify it!
                            FixMethod(iface->GetHeader(), &m, overloads[0]);
                        }
                    }
                }

                count++;
            }       // if (proceed)
        }
    }

    return count;
}