2010-03-28 4 views
-2

J'ai une fonction qui prend une structure personnalisée comme argument. comment puis-je comprendre quel devrait être l'argument? Je sais qu'il est un format de date ... de toutes sortes (bibliothèque C importés à Objective-C ...)Figure hors fonction argument de struct personnalisé?

Struct:

typedef struct 
{ 
    /** The number of day in the hebrew month (1..31). */ 
    int hd_day; 
    /** The number of the hebrew month 1..14 (1 - tishre, 13 - adar 1, 14 - adar 2). */ 
    int hd_mon; 
    /** The number of the hebrew year. */ 
    int hd_year; 
    /** The number of the day in the month. (1..31) */ 
    int gd_day; 
    /** The number of the month 1..12 (1 - jan). */ 
    int gd_mon; 
    /** The number of the year. */ 
    int gd_year; 
    /** The day of the week 1..7 (1 - sunday). */ 
    int hd_dw; 
    /** The length of the year in days. */ 
    int hd_size_of_year; 
    /** The week day of Hebrew new year. */ 
    int hd_new_year_dw; 
    /** The number type of year. */ 
    int hd_year_type; 
    /** The Julian day number */ 
    int hd_jd; 
    /** The number of days passed since 1 tishrey */ 
    int hd_days; 
    /** The number of weeks passed since 1 tishrey */ 
    int hd_weeks; 
} hdate_struct; 

Fonction:

int 
hdate_get_omer_day(hdate_struct const * h) 
{ 
    int omer_day; 
    hdate_struct sixteen_nissan; 

    hdate_set_hdate(&sixteen_nissan, 16, 7, h->hd_year); 
    omer_day = h->hd_jd - sixteen_nissan.hd_jd + 1; 

    if ((omer_day > 49) || (omer_day < 0)) 
     omer_day = 0; 

    return omer_day; 
} 

Essayer d'appeler cette fonction, pas sûr de ce qui se passe dans la date. Il y a aussi des fonctions pour convertir Julian en Hébreu, tout en prenant ou retournant la même structure.

Que dois-je faire pour obtenir la valeur de retour de la fonction?

+0

des exemples? _ – kennytm

+0

"Je ne sais pas ce qui se passe dans la date", voulez-vous dire *h ou sixteen_nissan

+0

@David - Quel argument me manque la fonction? je veux dire '* h' – Moshe

Répondre

1

Il ressemble comme vous voulez entrer une date hébraïque. Donc, vous devez comprendre comment en créer un. Essayez googling pour "hdate_struct" ou "convertir en hdate_struct" ou similaire.

Otoh, code rading la fonction Comptage de l'Omer, rituel juif lors de la fonction hdate_get_omer_day() on dirait qu'il retourne zeor sinon pendant Omer et 1 à 49 si l'un des 49 jours d'Omer (Voir wikipedia "quarante - Neuf jours entre la Pâque et la Fête des Semaines ").

Vous pouvez essayer googler code pour calculer le jour Omer (par exemple « Comment: Faites votre propre Omer Counte » http://www.google.com.sg/url?sa=t&source=web&ct=res&cd=5&ved=0CBcQFjAE&url=http%3A%2F%2Fwww.myjewishlearning.com%2Fblog%2Fholidays%2Fhow-to-make-your-own-omer-counter%2F&rct=j&q=get+omer+Day&ei=awOvS5TvHIjGrAe_3vGmAQ&usg=AFQjCNGJh7Ydy-VkfwlyzTL_ELIkiqP25w)

« Le reste est laissé comme un exercice pour le lecteur ».

+0

Merci, j'ai compris. hdate_struct est intégré à la bibliothèque, mais je n'ai pas pu trouver l'initialiseur de la structure. Je l'ai maintenant. Merci! Et la fonction de compteur Omer semble fonctionner. – Moshe

Questions connexes