Exemplo n.º 1
0
// Export:
void AboutOpera::generateData( URL& url )
{
	writePreamble( url ); // <html><body> surplus
	// <require> each of these should close exactly the HTML tags it opens:
	writeVersion( url );
	writeUA( url );
	writeRegInfo( url );
	writePaths( url );
	writeSound( url );
	writeCredits( url );
	// </require>
	url.WriteDocumentData(UNI_L("\n\n <address>"));
#ifdef GEIR_MEMORIAL
	OP_STATUS rc;
	OpString span;
	TRAP(rc, g_languageManager->GetStringL(Str::S_DEDICATED_TO, span));
	if (OpStatus::IsSuccess(rc))
	{
		url.WriteDocumentData(UNI_L("<span>"));
		// In memory of Geir Ivars&oslash;y.
		url.WriteDocumentData(span);
		url.WriteDocumentData(UNI_L("</span> "));
	}
#endif
	outASCII(url, "Copyright &copy; 1995-");
	outASCII(url, __DATE__ + 7); // "Mmm dd Year" + 7 == "Year"
	outASCII(url, " Opera Software ASA.\n"
			 "All rights reserved.</address>\n"
			 "</body>\n</html>\n");
	url.WriteDocumentDataFinished();
}
Exemplo n.º 2
0
// echoASCII
//
// Read the a PGM file opened as "inf" and write a text file
// of characters to "outf", ones whose brightness suggest the
// levels of grey specified by the original image.
//
void echoASCII(FILE *inf, FILE *outf) {

  int width, height;
  int max;
  int pixel;
  int r,c;

  // Read the PGM file's header info,
                             // for example: 
       
  eatLine(inf);                // P5 (or P2)
  eatLine(inf);                // # this was produced by some software
  fscanf(inf, "%d", &width);   // 9 5
  fscanf(inf, "%d", &height);
  fscanf(inf, "%d", &max);     // 255

  // for each image row
  for (r=0; r<height; r++) {
    // for each image column
    for (c=0; c<width; c++) {
      
      // read a PGM pixel grey value (from 0 to max)
      fscanf(inf,"%d", &pixel);
                             // 0 10 30 80 120 135 225 245 255 
                             // (4 more rows)

      // output a pixel character to make ASCII art
      outASCII(outf,(float)pixel/(float)max);
    }

    // end the ASCII text line 
    fprintf(outf,"\n");
  }
}
Exemplo n.º 3
0
void echoASCII(float *imgA, int rows, int cols, FILE *outf) {
  int p;
  float pix;
  for(int r=0; r<rows; r++) {
    for(int c=0;c<cols; c++) {
      p = c + r*cols;
      pix = imgA[p];
      outASCII(outf,pix);
    }
    // end of row
    fprintf(outf,"\n");
  }
}
Exemplo n.º 4
0
void AboutOpera::writePreamble( URL& url )
{
	OP_STATUS rc = url.SetAttribute(URL::KMIME_ForceContentType, "text/html;charset=utf-16");
	// FIXME: OOM - rc is discarded
	uni_char bom = 0xfeff; // unicode byte order mark
	url.WriteDocumentData(&bom, 1);

	outASCII(url,
		"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">\n"
		"<html>\n<head>\n <title>");

	OpString tmp;

	TRAP(rc, g_languageManager->GetStringL(Str::SI_IDABOUT_ABOUT, tmp));

	if (!OpStatus::IsSuccess(rc)) tmp.Set("About Opera");
	url.WriteDocumentData(tmp.CStr());
	url.WriteDocumentData(UNI_L("</title>\n"));

	// Don't mess with tmp until we've re-used it as H1's content

	// Style sheet, if any:
	OpString pref;
	OpFile f;
	TRAP(rc, g_pcfiles->GetFileL(PrefsCollectionFiles::StyleAboutFile, f));
	if (OpStatus::IsSuccess(rc)) rc = pref.Set(f.GetFullPath());
	if (OpStatus::IsSuccess(rc))
	{
		url.WriteDocumentData(UNI_L("  <link rel=\"stylesheet\" href=\"file://localhost"));
		if (pref.FindFirstOf('/') != 0) url.WriteDocumentData(UNI_L("/"));
		url.WriteDocumentData(pref.CStr());
		url.WriteDocumentData(UNI_L("\" media=\"screen,projection,tv,handheld,print\">\n"));
	}
	url.WriteDocumentData(UNI_L("</head>\n<body>\n"));
    url.WriteDocumentData(UNI_L("<h1>"));
	url.WriteDocumentData(tmp.CStr());
	url.WriteDocumentData(UNI_L("</h1>\n"));

	// Splash image, "<IMG SRC=\"file://localhost/...\">\n", if any.
	if (OpStatus::IsSuccess(getSplashImageURL( tmp )))
	{
		url.WriteDocumentData(UNI_L(" <img src=\""));
		url.WriteDocumentData(tmp.CStr());
		url.WriteDocumentData(UNI_L("\">\n"));
	}
}
Exemplo n.º 5
0
void AboutOpera::writeCredits( URL& url )
{
// #if the UL below is going to get any content
	OpString tmp;

	TRAPD(rc, g_languageManager->GetStringL(Str::SI_IDABOUT_INCLUDESFROM, tmp));
	if (!OpStatus::IsSuccess(rc)) tmp.Set("Third Parties");
	outHeading(url, tmp);

	/* The following probably all need to be reviewed periodically for
	 * up-to-date and relevant; in particular, more of them should be #if'd on
	 * suitable conditions matching whether or not the relevant credit is
	 * warranted in the present build (c.f. the number<->string one).  See the
	 * developer Wiki's Third_party_code page for authoritative details: *
	 * https://ssl.opera.com:8008/developerwiki/index.php/Third_party_code
	 *
	 * Note, however, that UNI_L() may be a macro and the C preprocessor has
	 * undefined behaviour if any preprocessor directives appear within a macro
	 * argument: so you *should not* try to do #if'ing within a single UNI_L()'s
	 * argument string.  Furthermore, since we want the following to be portable
	 * between platforms with UNI_L either as macro or mediated by unil_convert,
	 * we can't do string concatenation with UNI_L()s; macro form can't cope
	 * with several strings inside one UNI_L - TODO: as used below - while the
	 * unil_convert version breaks if we try to use several adjacent UNI_L()s.
	 */
	outASCII(
		url,
		" <ul>\n"

#ifdef MDE_AGFA_SUPPORT
		"  <li>This product includes software developed by Monotype Imaging Inc.\n"
		"Copyright &copy; 2005 Monotype Imaging Inc.<a\n"
		"href=\"http://www.monotypeimaging.com\">Monotype Imageing</a></li>\n"
#endif // MDE_AGFA_SUPPORT

#if defined(_NATIVE_SSL_SUPPORT_)
		"  <li>This product includes software developed by the OpenSSL Project for\n"
		"      use in the OpenSSL Toolkit. Copyright &copy; 1998-2001\n"
		"      <a href=\"http://www.openssl.org/\">The OpenSSL Project</a>.\n"
		"      All rights reserved.</li>\n"

		"  <li>This product includes cryptographic software written by Eric Young.\n"
		"      Copyright &copy; 1995-1998 <a\n"
		"      href=\"mailto:[email protected]\">Eric Young</a></li>\n"
#endif // _NATIVE_SSL_SUPPORT_

#ifdef OPERA_MINI // third-party regexp code, not currently used in any browser product (?)
		"  <li>This product includes software developed by the University of California,\n"
		"      Berkeley and its contributors</li>\n"
#endif // check with LTH ...

#ifndef USE_JAYPEG
		"  <li>The Independent JPEG Group</li>\n"
#endif // USE_JAYPEG

#ifdef USE_ZLIB
		"  <li>Zlib compression library, developed by Jean-loup Gailly\n"
		"      and Mark Adler</li>\n" // zlib
#endif

#ifdef EXPAT_XML_PARSER
		"  <li>James Clark</li>\n" // xml - expat
#endif // EXPAT_XML_PARSER

	"  <li>Eberhard Mattes</li>\n" // uni_sprintf, uni_sscanf

#  ifndef ECMASCRIPT_NO_SPECIAL_DTOA_STRTOD
		"  <li>Number-to-string and string-to-number conversions are\n"
		"      covered by the following notice:\n"
		"   <blockquote>\n"
		"    <p>The author of this software is David M. Gay.</p>\n"
        "    <p>Copyright (c) 1991, 2000, 2001 by Lucent Technologies.</p>\n"
        "    <p>Permission to use, copy, modify, and distribute this software for any\n"
        "       purpose without fee is hereby granted, provided that this entire notice\n"
        "       is included in all copies of any software which is or includes a copy\n"
        "       or modification of this software and in all copies of the supporting\n"
        "       documentation for such software.</p>\n"
        "    <p>THIS SOFTWARE IS BEING PROVIDED <q>AS IS</q>,\n"
		"       WITHOUT ANY EXPRESS OR IMPLIED\n"
        "       WARRANTY.  IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY\n"
        "       REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY\n"
        "       OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.\n"
		"    </p>\n"
		"   </blockquote>\n"
		"  </li>\n"
#  endif // ecmascript number <-> string conversions

# ifdef EXPAT_XML_PARSER
		"  <li>expat is covered by the following license: \n"
		"   <blockquote>\n"
		"    <p>Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd</p>\n"
		"    <p>Permission is hereby granted, free of charge, to any person obtaining\n"
		"    a copy of this software and associated documentation files (the\n"
		"    <q>Software</q>), to deal in the Software without restriction, including\n"
		"    without limitation the rights to use, copy, modify, merge, publish,\n"
		"    distribute, sublicense, and/or sell copies of the Software, and to\n"
		"    permit persons to whom the Software is furnished to do so, subject to\n"
		"    the following conditions:</p>\n"
		"    <p>THE SOFTWARE IS PROVIDED <q>AS IS</q>, WITHOUT WARRANTY OF ANY KIND,\n"
		"    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n"
		"    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n"
		"    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n"
		"    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n"
		"    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n"
		"    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>\n"
		"   </blockquote>\n"
		"  </li>\n"
# endif

# ifdef SVG_SUPPORT
		"  <li>Bitstream Vera Fonts are covered by the following license:\n"
		"   <blockquote>\n"
		"    <p>Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved.\n"
		"    Bitstream Vera is a trademark of Bitstream, Inc.</p>\n"
		"    <p>Permission is hereby granted, free of charge, to any person obtaining a\n"
		"    copy of the fonts accompanying this license (<q>Fonts</q>) and associated\n"
		"    documentation files (the <q>Font Software</q>), to reproduce and distribute\n"
		"    the Font Software, including without limitation the rights to use, copy,\n"
		"    merge, publish, distribute, and/or sell copies of the Font Software, and\n"
		"    to permit persons to whom the Font Software is furnished to do so, subject\n"
		"    to the following conditions:</p>\n"
		"    <p>The above copyright and trademark notices and this permission notice shall\n"
		"    be included in all copies of one or more of the Font Software typefaces.</p>\n"
		"    <p>The Font Software may be modified, altered, or added to, and in particular\n"
		"    the designs of glyphs or characters in the Fonts may be modified and additional\n"
		"    glyphs or characters may be added to the Fonts, only if the fonts are renamed to\n"
		"    names not containing either the words <q>Bitstream</q> or the word <q>Vera</q>.</p>\n"
		"    <p>This License becomes null and void to the extent applicable to Fonts or\n"
		"    Font Software that has been modified and is distributed under the\n"
		"    <q>Bitstream Vera</q> names.</p>\n"
		"    <p>The Font Software may be sold as part of a larger software package but no copy\n"
		"    of one or more of the Font Software typefaces may be sold by itself.</p>\n"
		"    <p>THE FONT SOFTWARE IS PROVIDED <q>AS IS</q>,\n"
		"    WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n"
		"    INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n"
		"    PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER\n"
		"    RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM,\n"
		"    DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL,\n"
		"    OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n"
		"    ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER\n"
		"    DEALINGS IN THE FONT SOFTWARE.</p>\n"
		"   </blockquote>\n"
		"  </li>\n"
# endif // SVG_SUPPORT
# ifdef SKIN_SUPPORT
		"  <li>Nice Graphics &trade; by P&aring;l Syvertsen, <a\n"
		"      href=\"http://www.flottaltsaa.no/\">Flott Alts&aring;</a></li>\n"
# endif
		"  <li>The Elektrans</li>\n" // what about panic ?
		" </ul>\n <p>");

	TRAP(rc, g_languageManager->GetStringL(Str::SI_IDABOUT_WELOVEYOU, tmp));
	if (OpStatus::IsSuccess(rc)) url.WriteDocumentData(tmp.CStr());
	url.WriteDocumentData(UNI_L("</p>\n"));
// #endif // the UL got some content.
}