Personal tools
You are here: Home Projects C++ Cfront releases Release 3.0.3 source lib string std_misc.c
Document Actions

std_misc.c

by Michael L Powell last modified 2007-01-26 03:22

Click here to get the file

Size 1.3 kB - File type text/plain

File contents

/*ident	"@(#) @(#)std_misc.c	1.1.1.2" */
/******************************************************************************
*
* C++ Standard Library
*
* Copyright (c) 1996  Lucent Technologies.  All Rights Reserved.
*
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Lucent Technologies.
* The copyright notice above does not evidence any actual or
* intended publication of such source code.
*
******************************************************************************/

#include <iostream.h>
#include "std_string.h"
#ifdef NAMESPACES_LUCENT
namespace std {
#endif

int compare_wchar_t(const wchar_t *s1, const wchar_t *s2, size_t n) {
	int result = 0;
	size_t i = 0;
	while (i < n) {
		if (!eq_wchar_t(*s1, *s2)) {
			if (lt_wchar_t(*s1, *s2)) result = -1;
			else result = 1;
			break;
		}
		i++; s1++; s2++;
	}
	return result;
}

size_t length_wchar_t(const wchar_t *s) {
	size_t result = 0;
	while (!eq_wchar_t(*s++, eos_wchar_t())) result++;
	return (result);
}

istream &char_in_wchar_t(istream &is, wchar_t &a) {
	char first, second;
	is >> first >> second;
	a = (first << 8) | (second & 0377);
	return is; }

ostream &char_out_wchar_t(ostream &os, wchar_t a) {
	char first, second;
	first = (a >> 8) & 0377;
	second = a & 0377;
	return (os << first << second); }
#ifdef NAMESPACES_LUCENT
}
#endif
« April 2014 »
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: