useDynLib("ordinal", .registration = TRUE)

importFrom(graphics,
           plot,
           par,
           abline,
           lines,
           points,
           contour)
importFrom(grDevices,
           dev.interactive,
           devAskNewPage)
importFrom(utils,
           "combn", "packageDescription", "as.roman")
importFrom(ucminf,
           ucminf)
importFrom(numDeriv,
           grad, hessian)
importFrom("stats", 
           ".checkMFClasses", ".getXlevels", "AIC",
           "add.scope", "approx", "as.formula", "binomial", "coef",
           "confint", "dcauchy", "dlogis", "dnorm", "drop.scope",
           "drop.terms", "extractAIC", "fitted", "formula", "glm.fit",
           "is.empty.model", "logLik", "model.frame", "model.matrix",
           "model.offset", "model.response", "model.weights",
           "na.pass", "napredict", "naprint", "nlminb", "optim",
           "pcauchy", "pchisq", "pgamma", "plogis", "pnorm",
           "printCoefmat", "profile", "qchisq", "qlogis", "qnorm",
           "runif", "setNames", "spline", "terms", "update.formula",
           "vcov", "nobs", "delete.response", "lm.fit", "resid", "reformulate")

## importFrom(stats,
##            nobs)
import(methods)
## import(stats)

## importFrom(methods,
##            as,
##            checkAtAssignment,
##            loadMethod)
import(Matrix)
importFrom(nlme,
            ranef, # also exported
            VarCorr) # also exported
## importFrom(numDeriv,
##            hessian,
##            grad)
importFrom(MASS,
           ginv,
           addterm,
           dropterm)
## importFrom(stats,
##            coef,
##            confint,
##            nobs,
##            logLik,
##            profile,
##            vcov,
##            extractAIC,
##            anova,
##            fitted## ,
##            ## terms
##            ## update
##            )

# Functions:
export(clm)
export(clm.fit)
export(clmm)
export(clm.control)
export(clmm.control)
export(slice)
export(convergence)
export(drop.coef)
export(nominal_test)
export(scale_test)
export(condVar)
export(ranef)
export(VarCorr)

export(gnorm, glogis, gcauchy,
       pgumbel, dgumbel, ggumbel, qgumbel, rgumbel,
       plgamma, dlgamma, glgamma ## ,
       ## pAO, dAO, gAO,
       )

## Methods:
S3method(clm.fit, default)
S3method(clm.fit, factor)

S3method(print, clm)
S3method(vcov, clm)
S3method(summary, clm)
S3method(print, summary.clm)

S3method(convergence, clm)
S3method(print, convergence.clm)

S3method(slice, clm)
S3method(plot, slice.clm)

S3method(anova, clm)
S3method(print, anova.clm)
S3method(predict, clm)
S3method(coef, clm)
S3method(nobs, clm)
S3method(coef, summary.clm)

S3method(scale_test, clm)
S3method(nominal_test, clm)

S3method(profile, clm)
S3method(confint, clm)
S3method(confint, profile.clm)
S3method(plot, profile.clm)

S3method(logLik, clm)
S3method(extractAIC, clm)
S3method(model.matrix, clm)
S3method(model.frame, clm)
S3method(terms, clm)

S3method(print, clmm)
S3method(vcov, clmm)
S3method(summary, clmm)
S3method(print, summary.clmm)
S3method(logLik, clmm)
S3method(extractAIC, clmm)
S3method(anova, clmm)
S3method(nobs, clmm)
## S3method(profile, clmm)
## S3method(confint, profile.clmm)
## S3method(plot, profile.clmm)
## S3method(update, clmm)
## S3method(fixef, clmm)
S3method(ranef, clmm)
S3method(condVar, clmm)
S3method(VarCorr, clmm)
S3method(model.matrix, clmm)


##################################################################
### clm2 stuff:

## Functions:
export(clm2)
export(clmm2)
export(clm2.control)
export(clmm2.control)


## Methods:
S3method(print, clm2)
S3method(vcov, clm2)
S3method(summary, clm2)
S3method(print, summary.clm2)
S3method(anova, clm2)
S3method(predict, clm2)
S3method(profile, clm2)
S3method(confint, clm2)
S3method(confint, profile.clm2)
S3method(plot, profile.clm2)
S3method(logLik, clm2)
S3method(extractAIC, clm2)
S3method(update, clm2)
S3method(dropterm, clm2)
S3method(addterm, clm2)

S3method(print, clmm2)
S3method(vcov, clmm2)
S3method(summary, clmm2)
S3method(print, summary.clmm2)
S3method(anova, clmm2)
S3method(profile, clmm2)
S3method(confint, profile.clmm2)
S3method(plot, profile.clmm2)
S3method(update, clmm2)
