summaryrefslogtreecommitdiff
path: root/libc/stdlib/srand48.c
blob: ef526c1723ec10844f9d77af77f0fddd156d470b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
   This file is part of the GNU C Library.
   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu <mailto:drepper@gnu.ai.mit.edu>>, August 1995.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <http://www.gnu.org/licenses/>.  */

#include <stdlib.h>

void srand48 (long seedval)
{
    srand48_r (seedval, &__libc_drand48_data);
}
it */ #endif /* __WCHAR_ENABLED */ #endif /* __CTYPE_HAS_8_BIT_LOCALES */ #ifdef __WCHAR_ENABLED out_uc(lso, __LOCALE_DATA_WCctype_data, __LOCALE_DATA_WCctype_TBL_LEN, "tblwctype"); out_uc(lso, __LOCALE_DATA_WCuplow_data, __LOCALE_DATA_WCuplow_TBL_LEN, "tblwuplow"); out_i16(lso, __LOCALE_DATA_WCuplow_diff_data, __LOCALE_DATA_WCuplow_diff_TBL_LEN, "tblwuplow_diff"); /* const unsigned char tblwcomb[WCcomb_TBL_LEN]; */ /* width?? */ #endif /* __WCHAR_ENABLED */ out_uc(lso, __lc_ctype_data, __lc_ctype_data_LEN, "lc_ctype_data"); out_uc(lso, __lc_numeric_data, __lc_numeric_data_LEN, "lc_numeric_data"); out_uc(lso, __lc_monetary_data, __lc_monetary_data_LEN, "lc_monetary_data"); out_uc(lso, __lc_time_data, __lc_time_data_LEN, "lc_time_data"); /* TODO -- collate*/ out_uc(lso, __lc_messages_data, __lc_messages_data_LEN, "lc_messages_data"); #ifdef __CTYPE_HAS_8_BIT_LOCALES fprintf(lso, "{ /* codeset_8_bit array */\n"); for (i = 0 ; i < __LOCALE_DATA_NUM_CODESETS ; i++) { fprintf(lso, "{ /* codeset_8_bit[%d] */\n", i); out_uc(lso, codeset_8_bit[i].idx8ctype, __LOCALE_DATA_Cctype_IDX_LEN, "idx8ctype"); out_uc(lso, codeset_8_bit[i].idx8uplow, __LOCALE_DATA_Cuplow_IDX_LEN, "idx8uplow"); out_uc(lso, codeset_8_bit[i].idx8c2wc, __LOCALE_DATA_Cc2wc_IDX_LEN, "idx8c2wc"); out_uc(lso, codeset_8_bit[i].idx8wc2c, __LOCALE_DATA_Cwc2c_II_LEN, "idx8wc2c"); fprintf(lso, "},\n"); } fprintf(lso, "},\n"); #endif /* __CTYPE_HAS_8_BIT_LOCALES */ out_uc(lso, __lc_ctype_rows, __lc_ctype_rows_LEN, "lc_ctype_rows"); out_u16(lso, __lc_ctype_item_offsets, __lc_ctype_item_offsets_LEN, "lc_ctype_item_offsets"); out_u16(lso, __lc_ctype_item_idx, __lc_ctype_item_idx_LEN, "lc_ctype_item_idx"); out_uc(lso, __lc_numeric_rows, __lc_numeric_rows_LEN, "lc_numeric_rows"); out_u16(lso, __lc_numeric_item_offsets, __lc_numeric_item_offsets_LEN, "lc_numeric_item_offsets"); out_u16(lso, __lc_numeric_item_idx, __lc_numeric_item_idx_LEN, "lc_numeric_item_idx"); out_uc(lso, __lc_monetary_rows, __lc_monetary_rows_LEN, "lc_monetary_rows"); out_u16(lso, __lc_monetary_item_offsets, __lc_monetary_item_offsets_LEN, "lc_monetary_item_offsets"); out_u16(lso, __lc_monetary_item_idx, __lc_monetary_item_idx_LEN, "lc_monetary_item_idx"); out_uc(lso, __lc_time_rows, __lc_time_rows_LEN, "lc_time_rows"); out_u16(lso, __lc_time_item_offsets, __lc_time_item_offsets_LEN, "lc_time_item_offsets"); out_u16(lso, __lc_time_item_idx, __lc_time_item_idx_LEN, "lc_time_item_idx"); out_uc(lso, __lc_messages_rows, __lc_messages_rows_LEN, "lc_messages_rows"); out_u16(lso, __lc_messages_item_offsets, __lc_messages_item_offsets_LEN, "lc_messages_item_offsets"); out_u16(lso, __lc_messages_item_idx, __lc_messages_item_idx_LEN, "lc_messages_item_idx"); /* collate should be last*/ assert(sizeof(__locale_collate_tbl)/sizeof(__locale_collate_tbl[0]) == __lc_collate_data_LEN) ; out_u16(lso, __locale_collate_tbl, __lc_collate_data_LEN, "collate_data"); { unsigned char co_buf[__LOCALE_DATA_CATEGORIES] = { __lc_ctype_item_offsets_LEN, __lc_numeric_item_offsets_LEN, __lc_monetary_item_offsets_LEN, __lc_time_item_offsets_LEN, 0, __lc_messages_item_offsets_LEN }; out_uc(lso, co_buf, __LOCALE_DATA_CATEGORIES, "lc_common_item_offsets_LEN"); } out_size_t(lso, common_tbl_offsets, __LOCALE_DATA_CATEGORIES * 4, "lc_common_tbl_offsets"); /* offsets from start of locale_mmap_t */ /* rows, item_offsets, item_idx, data */ #ifdef __LOCALE_DATA_NUM_LOCALES out_uc(lso, __locales, __LOCALE_DATA_NUM_LOCALES * __LOCALE_DATA_WIDTH_LOCALES, "locales"); out_uc(lso, __locale_names5, 5 * __LOCALE_DATA_NUM_LOCALE_NAMES, "locale_names5"); #ifdef __LOCALE_DATA_AT_MODIFIERS_LENGTH out_uc(lso, __locale_at_modifiers, __LOCALE_DATA_AT_MODIFIERS_LENGTH, "locale_at_modifiers"); #else #error __LOCALE_DATA_AT_MODIFIERS_LENGTH not defined! #endif /* __LOCALE_DATA_AT_MODIFIERS_LENGTH */ #endif /* __LOCALE_DATA_NUM_LOCALES */ out_uc(lso, lc_names, __lc_names_LEN, "lc_names"); #ifdef __CTYPE_HAS_8_BIT_LOCALES out_uc(lso, (const unsigned char*) __LOCALE_DATA_CODESET_LIST, sizeof(__LOCALE_DATA_CODESET_LIST), "codeset_list"); #endif /* __CTYPE_HAS_8_BIT_LOCALES */ fprintf(lso, "\n};\n\n" "const __locale_mmap_t *__locale_mmap = &locale_mmap;\n\n" ); if (ferror(lso) || fclose(lso)) { printf("error writing!\n"); return EXIT_FAILURE; } return EXIT_SUCCESS; } /* ---------------------------------------------------------------------- */ /* TODO: * collate data (8-bit weighted single char only) * @ mappings! * codeset list? yes, since we'll want to be able to inspect them... * that means putting some header stuff in magic * fix ctype LEN defines in gen_c8tables */