Program to tell the time in conversational Gaelic

0 views
Skip to first unread message

Craig Cockburn

unread,
May 20, 1993, 5:22:32 AM5/20/93
to
The following C program, which runs on Unix, VMS and other platforms, tells
the time in conversational Scottish Gaelic. Hope you like it! If your
machine can handle real accents, then you can change the slashes after the
vowels into proper accents.

Craig

/* FILE: gael.c
write the time and date in Gaelic
******************************************************************

Written by Craig Cockburn at Edinburgh University , 1984
Modified for VMS V5, 11-Dec-1989
Modified from English to Gaelic, 25-Jan-1991

Authors (CC) current address email address:
Internet: lss...@cs.napier.ac.uk

-- Modified 910307 by George Scott at Solar Energy Research Institute,
Golden, Colorado, USA
to: use 'C' instead of pascal
use UNIX instead of VMS
Authors (GS) current address email address:
geo...@wind55.seri.GOV

The following are left as exercises to the reader!
Have the program write out all the numbers in full!
Convert the program to any other (Celtic) language!

*/

#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <math.h>
#include <time.h>

typedef struct { int date, month, year; } DATERECORD;
typedef struct { int hours, minutes, seconds; } TIMERECORD;

DATERECORD The_Date;
TIMERECORD The_Time;

long now_time;
char *time_ptr;
struct tm *mytm;

/*--------------------------------------------------------------------------*/
convert(dout, tout)
DATERECORD *dout;
TIMERECORD *tout;
{
dout->date = mytm->tm_mday;
dout->month = mytm->tm_mon + 1; /* ctime returns 0-11 for month */
dout->year = mytm->tm_year + 1900;

tout->hours = mytm->tm_hour;
tout->minutes = mytm->tm_min;
tout->seconds = mytm->tm_sec;
}

/*--------------------------------------------------------------------------*/
Say_Minutes(minute)
int minute;

{
switch (minute % 5)
{
case 1 :
case 2 : printf ("beagan an de/idh "); break;
case 3 :
case 4 : printf ("gu bhith "); break;
case 0 : ; break;
}

switch ((minute + 2) / 5)
{
case 0: ; break;

case 1:
case 5:
case 7:
case 11: printf ("co/ig mionaidean "); break;

case 2:
case 10: printf ("deich mionaidean "); break;

case 3:
case 9: printf ("cairteal "); break;
/* you also get 'ceathramh' on the mainland */

case 4:
case 8: printf ("fichead mionaid "); break;

case 6: printf ("leth-uair "); break;

case 12: ; break;
}

switch ((minute + 2) / 5)
{
case 5:
case 7: printf ("fichead "); break; /* or 'air fhichead' */
}
}

/*--------------------------------------------------------------------------*/
Say_Hours(hours, minutes)
int hours, minutes;
{
int hour;

hour = hours % 12;
if ((((minutes + 2) / 5) < 7)
&& (minutes > 2) && (minutes < 58))
printf ("an de/idh ");
else
if ((minutes > 2) && (minutes <58))
printf ("gu ");

switch ( hour )
{
case 0: printf ("da\\ uair dheug"); break;
case 1: printf ("uair"); break;
case 2: printf ("a dha\\ "); break;
case 3: printf ("tri\\"); break;
case 4: printf ("ceithir"); break;
case 5: printf ("co/ig"); break;
case 6: printf ("sia"); break;
case 7: printf ("seachd"); break;
case 8: printf ("ochd"); break;
case 9: printf ("naoi"); break;
case 10: printf ("deich"); break;
case 11: printf ("aon uair deug"); break;
}
if ((minutes > 57 || minutes < 3) && (hour >= 3 && hour <= 10))
printf (" uairean");
printf (".\n");
}

/*--------------------------------------------------------------------------*/
Say_Day(din)
DATERECORD *din;
{
printf ("'Se ");
switch (mytm->tm_wday)
{
case 0: printf ("Di-Do\\mhnaich"); break; /* Sunday */
case 1: printf ("Di-luain"); break;
case 2: printf ("Di-ma\\irt"); break;
case 3: printf ("Di-ciadaoin"); break;
case 4: printf ("Diardaoin"); break;
case 5: printf ("Di-haoine"); break;
case 6: printf ("Di-sathuirn"); break;
}
}

/* Historical note */

/*
It is interesting how Welsh has taken and preserved the Latin names
of the days (Llun, Mawrth, Mercher, Iau, Gwener, Sadwrn, Sul, derived
regularly from Lun-, Mart-, Mercur-, Jov-, Vener-, Saturn-, Sol-).
Gaelic, on the other hand, has its own words for Wednesday, Thursday,
Friday, and Sunday, their etymologies explained by MacBain as:

<Di->, [-day]; the prefix in the names of the days of the week, Ir.,
O.Ir. [dia], [die] (O.Ir.), W. [dydd], Cor. [det] (for [dedh]), Br.[dez],
[dijas] (*dejes-?); Lat. [die~s]; Skr. [dya/u/s], day, sky; Gr. @G[Zeu/s],
@G[Dio/s], Jove. Allied to [dia], god.

<Di -do\\mhnuich>, Sunday, Ir. [Domhnach], E.Ir. [domnach], from Lat.
(dies) [dominica], Lord's day - [dominus], lord;

<Di-luain>, Monday, Ir. [Dia-luain], M.Ir. [luan], W. [Dydd Llun], from
Lat. dies [Lun@ae], "day of the moon";

<Di-ma\irt>, Tuesday, Ir. [Dia-mairt], E.Ir. [ma/irt], W. [Dydd mawrth],
from Lat. dies [Martis], "day of Mars";

<Di-ciaduinn>, <Di-ciadaoin>, Wednesday, Ir. [Dia-ce/adaoine], O.Ir.
[ce/ta/in], [ce/to/in], [de ce/tain] ([de] = [dia] = Lat. [die]),
[dia ceta/i/ne], from [ceud], first, and [aone], fast, q.v., E.Ir. [a/ine]:
"day of the first fast", Friday being the second and chief day;

<Diardaoin>, Thursday, Ir. [Dia-dhardaoin], E.Ir. [dardo/en] =
[etar da/ o/in], "between two fasts" - the day between the two fasts of
Wednesday and Friday;

<Di-haoine>, Friday, Ir. [Dia-aoine], [Dia-haoine], E.Ir. [a/ine],
[dia a/ine], O.Ir. [dia oine di/dine] (day of the last fast): "day of
the fast", from [aoin], fast, q.v.;

<Di-sathuirn>, Saturday, Ir. [Dia-sathuirn], M.Ir. [satharn], [dia sathairn],
from Lat. dies [Saturni], day of Saturn..

The days of the week were originally named (in Egypt) after the seven
planets of the ancients - Sun, Moon, Mars, Mercury, Jove, Venus, Saturn.

From "The Week" by F.H. Colson which was published in London I think in the
early years of this century.

Welsh Gaelic Irish
Dydd-sul Di-domhnaich Much the same
Dydd-llun Di-luain
Dydd-mawrth Di-mairt
Dydd-mercher Di-ciadain
Dydd-iau Diar-daoin
Dydd-gwener Di-h-aoine
Dydd-sadwrn Di-sathirne

He has this to say about the Celtic languages on page 108f. -
"Welsh has a complete set of Roman planetary names. It stands in fact alone
in this respect among European languages. Saturday is Dydd-sadwrn, Sunday
Dydd-sul, Monday Dydd-llun. There has been no tendency to supplant the first
two of these, as in Latin Europe by Domenica and Sabbatum, nor again have Sol
and Luna been replaced by the Celtic equivalents for Sun and Moon." From this
Colson infers that the names came with the Romans but ahead of Christianity.
Regarding the other two languages he says:
"In the other two great branches of Celtic speech, the Gaelic and the Irish,
things took a different course. Monday, Tuesday and Saturday are the days of
Luna, Mars and Saturn, but Sunday is Di-domhnaich, and the three other names
are formed on quite another principle. The name for Wednesday means 'the
first fast', Friday is 'the fast' or 'the great fast', while Thursday is
something which is variously interpreted as 'the eve of the fast' or 'the day
between the fasts' ...". From this he conjectures that the week reached the
Gaels after the arrival of Christianity in the British Isles.
*/


/*--------------------------------------------------------------------------*/
Say_Date(date)
int date;
{
printf (" an %d",date);
switch (date)
{
case 1: printf ("d"); break;

case 2:
case 11:
case 12:
case 21:
case 22:
case 31: printf ("a"); break;

case 3:
case 13:
case 23: printf ("s"); break;

default: printf ("mh"); break;
}
}

/*--------------------------------------------------------------------------*/
Say_Month(month)
int month;

{
printf (" la\\ den ");
switch (month) /* Original meaning */
{
case 1: printf ("Fhaoilteach"); break;
/* The month of the wolf ravaging */
case 2: printf ("Ghearrain"); break;
/* The month of the horse */
case 3: printf ("Mha\\irt"); break;
/* A suitable time to start farmwork */
case 4: printf ("Ghiblein"); break;
case 5: printf ("Che\\itein"); break;
case 6: printf ("O\\g mhi\\os"); break;
/* The month of young */
case 7: printf ("Iuchar"); break;
/* The month of spawn */
case 8: printf ("Lu\\nasdal"); break;
/* From a Celtic sun God */
case 9: printf ("t-Sultuine"); break;
case 10: printf ("Da\\mhair"); break;
/* From 'Damh' , a stag */
case 11: printf ("t-Samhainn"); break;
case 12: printf ("Du\\dlachd"); break;
/* From a word meaning the depths of Winter */
}
}

/*--------------------------------------------------------------------------*/
writeout(din, tin)
DATERECORD *din;
TIMERECORD *tin;

{
if (tin->hours < 13 )
printf ("Madainn mhath, ");
else
printf ("Feasgar math, ");
/* 'Madainn mhath' more or less translates to Good Morning, however it */
/* is often used before lunchtime, or if it is the first time that day */
/* on which you see the person addressed and it isn't too long after 12! */
printf ("tha e ");
if (tin->minutes != 0)
Say_Minutes(tin->minutes);
if (tin->minutes > 32 && tin->hours == 23)
Say_Hours(0,tin->minutes);
else
if (tin->minutes > 32)
Say_Hours(tin->hours+1,tin->minutes);
else
Say_Hours(tin->hours ,tin->minutes);
Say_Day(din);
Say_Date(din->date);
Say_Month(din->month);
printf (" %d.\n", din->year);
}

/*----------------------------------------------------------------------*/
/*------------------------ Start of main program -----------------------*/
/*----------------------------------------------------------------------*/

main(argc, argv)
int argc;
char *argv[];

{
/* time, ctime and localtime are UNIX utilities */
now_time = time (0);
time_ptr = ctime (&now_time);
printf ("Local time: %s", time_ptr);
mytm = localtime (&now_time);

convert(&The_Date,&The_Time);
writeout(&The_Date,&The_Time);
}


Reply all
Reply to author
Forward
0 new messages