From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.81.7 with SMTP id v7mr43715789obx.28.1388966105630; Sun, 05 Jan 2014 15:55:05 -0800 (PST) X-Received: by 10.49.74.134 with SMTP id t6mr106887qev.14.1388966105604; Sun, 05 Jan 2014 15:55:05 -0800 (PST) Path: border1.nntp.dca3.giganews.com!backlog4.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin1!goblin.stu.neva.ru!fu10no20470859igb.0!news-out.google.com!l9ni4950qay.0!nntp.google.com!p15no63144109qaj.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 5 Jan 2014 15:55:05 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.63.69.205; posting-account=h3IwYwoAAAAeE2lWQnRSCqcQ0dO-KDvQ NNTP-Posting-Host: 173.63.69.205 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <7d03f160-7f52-4870-b4b3-a03d5b351bcb@googlegroups.com> Subject: Q: Localizing type and package references From: b.mcguinness747@gmail.com Injection-Date: Sun, 05 Jan 2014 23:55:05 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Original-Bytes: 3001 Xref: number.nntp.dca.giganews.com comp.lang.ada:184359 Date: 2014-01-05T15:55:05-08:00 List-Id: I want to write an Ada program using the Wide_Character type, but I might want to move to Wide_Wide_Character later on. So I want to localize all references to Wide_Character and the associated standard Ada packages to a single file that I can easily update. If I was working in C++, I would use typedefs to create pseudonyms and put these in a header file that I could #include from various source files. So I have tried to do something similar in Ada. I created the file types.ads: -------------------------------------------------------------------------------- -- Types - Declarations of data types and related packages -------------------------------------------------------------------------------- with Ada.Characters; with Ada.Characters.Wide_Latin_1; with Ada.Strings; with Ada.Strings.Wide_Maps; with Ada.Strings.Wide_Unbounded; with Ada.Wide_Characters; with Ada.Wide_Characters.Handling; with Ada.Wide_Text_IO; with Ada.Wide_Text_IO.Text_Streams; package Types is package Chars renames Ada.Characters.Wide_Latin_1; package Char_Handling renames Ada.Wide_Characters.Handling; package Char_IO renames Ada.Wide_Text_IO; package Char_Maps renames Ada.Strings.Wide_Maps; package Char_Streams renames Ada.Wide_Text_IO.Text_Streams; package Char_Strings renames Ada.Strings.Wide_Unbounded; subtype Char is Wide_Character; subtype Char_String is Ada.Strings.Wide_Unbounded.Unbounded_Wide_String; end Types; and then tried referencing this from the main program file with: with Types; use Types; with Char_Strings; but the compiler (Gnat 4.6) complains that there is no file called char_strings.ads. I am not sure if I have made a simple mistake that can be easily corrected to make this work, or if there is a different approach that I should be trying. Help would be appreciated. Thanks. --- Brian