  We give a proof of the Gromov compactness theorem using the language of
stable curves (i.e. cusp-curve of Gromov, or stable maps of Kontsevich and
Manin) in general setting: An almost complex structure on a target manifold is
only continuous and can vary; the curves are only assumed to have fixed
``topological type'', in particular they can be non-closed and the complex
structures on them can vary arbitrarily.
  In connection with this, we study in \S 2 moduli spaces of nodal curves with
boundary and define a natural complex structure for such moduli spaces.
  We obtain an apriori estimate for pseudoholomorphic maps of ``long
cylinders'' (see \S 3), which gives a uniform description for degeneration of
complex structure on the curves and for the ``bubbling'' phenomenon. It also
implies the Hausdorff convergence of the curves.
  We also prove in \S 5 the compactness theorem for curves with boundary on
totally real submanifolds. For this ``boundary'' case we give appropriate
generalizations of all ``inner'' constructions and estimates.
