From fcb1ebc8f7986e5736f05c9398c066ae1fa3d9df Mon Sep 17 00:00:00 2001 From: Florian Mosnier Date: Tue, 10 Oct 2017 12:50:29 +0200 Subject: [PATCH] new system --- Makefile | 4 +- font/modern.bmp | Bin 24698 -> 24698 bytes img/Tableau.png | Bin img/select.jpg | Bin img/tableauMini.bmp | Bin 0 -> 5494 bytes include/periodiq.h | 130 ++++++++++++++++++++- misc/icon.bmp | Bin src/periodiq.c | 269 ++++++++++++++------------------------------ 8 files changed, 213 insertions(+), 190 deletions(-) mode change 100644 => 100755 font/modern.bmp mode change 100644 => 100755 img/Tableau.png mode change 100644 => 100755 img/select.jpg create mode 100755 img/tableauMini.bmp mode change 100644 => 100755 include/periodiq.h mode change 100644 => 100755 misc/icon.bmp mode change 100644 => 100755 src/periodiq.c diff --git a/Makefile b/Makefile index 719da42..1cdb2ef 100755 --- a/Makefile +++ b/Makefile @@ -16,11 +16,11 @@ $(OBJDIR): ## Compile sprites $(OBJDIR)/%.bmp.o: $(IMGDIR)/%.bmp - fxconv $< -o $@ -n $(patsubst %.bmp,img_%,$(notdir $<)) + fxconv $< -o $@ -n $(patsubst %.bmp,%,$(notdir $<)) -image ## Compile fonts $(OBJDIR)/%.bmp.o: $(FONTDIR)/%.bmp - fxconv $< -o $@ -n $(basename $(notdir $<)) --font + fxconv $< -o $@ -n $(basename $(notdir $<)) -font ## Make an object file out of an ASM source file $(OBJDIR)/%.s.o: $(SRCDIR)/%.s diff --git a/font/modern.bmp b/font/modern.bmp old mode 100644 new mode 100755 index 0340f76caa3294d8fa52e91b46611365384cad91..1286f301f05bad4f17e1def00e15eb2592050cba GIT binary patch delta 126 zcmex$fbrJ>#to_h6DM4qoDd*1d4eg=#0Iv>a)Mox=LfS*5)|5eKrn-G@&i|)$p@5$ zCKs5CPIk}}n!Esr6GVXgpk$yn(a8elijxgQN`dM)Cm+y}2I-wVL0Nq=wrEJ6-?)6E6M$ delta 143 zcmex$fbrJ>#to_hlQ;NrPBxI`nf$^1z~qDgp~(|Wc_ucnO_mevn!JIZZE}JL&*X#{ zw#^3wGZ-g3xEV~IAIvtn0Vn~aCy7e~<%K2}1SJEticS_VSDb7hQVLcw!B=SV0c9Qt eTUmWFw5In@f%E7`vSXx;-_P)S>_&;BUmrKT62vGu?0_2<=$%QPNU4pm!^GFhx zEzya44{m2}744*cJrKS2wsFx+NK{otP18`@wzjb5Re@E3zfhnKW8*#vki9Ets?CoB zlmy1%GglO>FbuE@@;0PFazwms0pg+saazlzpx#9_DXq7Nj!F6*6hxqvU2O3bl#n!I zEUzv6d!h~^KNov0H8vxwq2JKR9#iFTi7$HSC&u++{gD;Tdrq2Y-e|oQ_BhLu07&Oz ztmI=SPXzBbT$9Q4k^p6S#}42s$t_KuD67e2dP#t?ym8LONa2>uXmI@aBk5`~7}wmm zSZwb=mL8&sU)$dch0DTUtllLx@h)U(EtLG){@#aoHgtM{HCdg@^sU)5bH^4JvUmM` Hfphi^t^X>_ literal 0 HcmV?d00001 diff --git a/include/periodiq.h b/include/periodiq.h old mode 100644 new mode 100755 index 5c5f9a5..caad0a2 --- a/include/periodiq.h +++ b/include/periodiq.h @@ -2,7 +2,9 @@ #define _PERIODIQ_H - unsigned int key; +static unsigned int key; + +#pragma pack(1) struct Element { @@ -23,6 +25,8 @@ struct Element //octet de flottement //align(4) }; +#pragma pack() + int detailsElement(int); //chang //a int tableauElement(int); //chang int tableauEleMini(int); //chang @@ -31,4 +35,128 @@ void choix_famille(int); void Mini(char* c, int n); void calcul_mole(void); + +struct Element elements[] = +{ + { /*1 */"Hydrogene", "H", 1, 1008, 1, 1, 220, 0, 1, {1} }, + { /*2 */"Helium", "He", 0, 4003, 18, 1, -1, 2, 1, {2} }, + { /*3 */"Lithium", "Li", 1, 6940, 1, 2, 98, 4, 0, {2, 1} }, + { /*4 */"Beryllium", "Be", 2, 9012, 2, 2, 157, 5, 0, {2, 2} }, + { /*5 */"Bore", "B", 3, 10810, 13, 2, 204, 3, 0, {2, 3} }, + { /*6 */"Carbone", "C", 4, 12011, 14, 2, 255, 0, 0, {2, 4} }, + { /*7 */"Azote", "N", 5, 14007, 15, 2, 304, 0, 1, {2, 5} }, + { /*8 */"Oxygene", "O", 2, 15999, 16, 2, 344, 0, 1, {2, 6} }, + { /*9 */"Fluor", "F", 1, 18998, 17, 2, 398, 1, 1, {2, 7} }, + {/*10 */"Neon", "Ne", 0, 20178, 18, 2, -1, 2, 1, {2, 8} }, + {/*11 */"Sodium", "Na", 1, 22990, 1, 3, 93, 4, 0, {2, 8, 1} }, + {/*12 */"Magnesium", "Mg", 2, 24305, 2, 3, 131, 5, 0, {2, 8, 2} }, + {/*13 */"Aluminium", "Al", 3, 26982, 13, 3, 161, 9, 0, {2, 8, 3} }, + {/*14 */"Silicium", "Si", 4, 28085, 14, 3, 190, 3, 0, {2, 8, 4} }, + {/*15 */"Phosphore", "P", 5, 30974, 15, 3, 219, 0, 0, {2, 8, 5} }, + {/*16 */"Soufre", "S", 6, 32060, 16, 3, 258, 0, 0, {2, 8, 6} }, + {/*17 */"Chlore", "Cl", 7, 35450, 17, 3, 316, 1, 1, {2, 8, 7} }, + {/*18 */"Argon", "Ar", 2, 39948, 18, 3, -1, 2, 1, {2, 8, 8} }, + {/*19 */"Potassium", "K", 1, 39098, 1, 4, 82, 4, 0, {2, 8, 8, 1} }, + {/*20 */"Calcium", "Ca", 2, 40078, 2, 4, 100, 5, 0, {2, 8, 8, 2} }, + {/*21 */"Scandium", "Sc", 3, 44956, 3, 4, 136, 8, 0, {2, 8, 9, 2} }, + {/*22 */"Titane", "Ti", 4, 47867, 4, 4, 154, 8, 0, {2, 8, 10, 2} }, + {/*23 */"Vanadium", "Va", 5, 50941, 5, 4, 163, 8, 0, {2, 8, 11, 2} }, + {/*24 */"Chrome", "Cr", 6, 51996, 6, 4, 166, 8, 0, {2, 8, 13, 1} }, + {/*25 */"Manganese", "Mn", 7, 54380, 7, 4, 155, 8, 0, {2, 8, 13, 2} }, + {/*26 */"Fer", "Fe", 6, 55845, 8, 4, 183, 8, 0, {2, 8, 14, 2} }, + {/*27 */"Cobalt", "Co", 5, 58933, 9, 4, 188, 8, 0, {2, 8, 15, 2} }, + {/*28 */"Nickel", "Ni", 4, 58693, 10, 4, 191, 8, 0, {2, 8, 16, 2} }, + {/*29 */"Cuivre", "Cu", 4, 63546,11, 4, 190, 8, 0, {2, 8, 18, 1} }, + {/*30 */"Zinc", "Zn", 2, 65380, 12, 4, 165, 8, 0, {2, 8, 18, 2} }, + {/*31 */"Gallium", "Ga", 3, 69723, 13, 4, 181, 9, 0, {2, 8, 18, 3} }, + {/*32 */"Germanium", "Ge", 4, 72630, 14, 4, 201, 3, 0, {2, 8, 18, 4} }, + {/*33 */"Arsenic", "As", 4, 74921, 15, 4, 218, 3, 0, {2, 8, 18, 5} }, + {/*34 */"Selenium", "Se", 6, 78971, 16, 4, 255, 0, 0, {2, 8, 18, 6} }, + {/*35 */"Brome", "Br", 7, 79904, 17, 4, 296, 1, 2, {2, 8, 18, 7} }, + {/*36 */"Krypton", "Kr", 2, 83798, 18, 4, 300 , 2, 1, {2, 8, 18, 8} }, + {/*37 */"Rubidium", "Rb", 1, 85468, 1, 5, 82, 4, 0, {2, 8, 18, 8, 1} }, + {/*38 */"Strontium", "Sr", 2, 87620, 2, 5, 95, 5, 0, {2, 8, 18, 8, 2} }, + {/*39 */"Yttrium", "Y", 3, 88906, 3, 5, 122, 8, 0, {2, 8, 18, 9, 2} }, + {/*40 */"Zirconium", "Zr", 4, 91224, 4, 5, 133, 8, 0, {2, 8, 18, 10, 2} }, + {/*41 */"Niobium", "Nb", 5, 92906, 5, 5, 160, 8, 0, {2, 8, 18, 12, 1} }, + {/*42 */"Molybdene", "Mo", 6, 95950, 6, 5, 216, 8, 0, {2, 8, 18, 13, 1} }, + {/*43 */"Technetium", "Tc", 7, 98000, 7, 5, 190, 8, 0, {2, 8, 18, 13, 2} }, + {/*44 */"Ruthenium", "Ru", 8, 101070, 8, 5, 220, 8, 0, {2, 8, 18, 15, 1} }, + {/*45 */"Rhodium", "Rh", 6, 102906, 9, 5, 228, 8, 0, {2, 8, 18, 16, 1} }, + {/*46 */"Palladium", "Pd", 4, 106420, 10, 5, 220, 8, 0, {2, 8, 18, 18} }, + {/*47 */"Argent", "Ag", 4, 107869, 11, 5, 193, 8, 0, {2, 8, 18, 18, 1} }, + {/*48 */"Cadmium", "Cd", 2, 112414, 12, 5, 169, 8, 0, {2, 8, 18, 18, 2} }, + {/*49 */"Indium", "In", 2, 114818, 13, 5, 178, 9, 0, {2, 8, 18, 18, 3} }, + {/*50 */"Etain", "Sn", 3, 118710, 14, 5, 196, 9, 0, {2, 8, 18, 18, 4} }, + {/*51 */"Antimoine", "Sb", 5, 121760, 15, 5, 205, 3, 0, {2, 8, 18, 18, 5} }, + {/*52 */"Tellure", "Te", 6, 127600, 16, 5, 210, 3, 0, {2, 8, 18, 18, 6} }, + {/*53 */"Iode", "I", 7, 126904, 17, 5, 266, 1, 0, {2, 8, 18, 18, 7} }, + {/*54 */"Xenon", "Xe", 8, 130293, 18, 5, 260, 2, 1, {2, 8, 18, 18, 8} }, + {/*55 */"Cesium", "Cs", 1, 132905, 1, 6, 79, 4, 0, {2, 8, 18, 18, 8, 1} }, + {/*56 */"Baryum", "Ba", 2, 137327, 2, 6, 89, 5, 0 ,{2, 8, 18, 18, 8, 2} }, + {/*57 */"Lanthane", "La", 3, 138910, 4, 6, 110, 6, 0, {2, 8, 18, 19, 8, 2} }, // lanthanides + {/*58 */"Cerium", "Ce", 4, 140116, 5, 6, 112, 6, 0, {2, 8, 18, 19, 8, 2} }, + {/*59 */"Praseodyme", "Pr", 4, 140907, 6, 6, 113, 6, 0, {2, 8, 18, 21, 8, 2} }, + {/*60 */"Neodyme", "Nd", 3, 144242, 7, 6, 114, 6, 0, {2, 8, 18, 22, 8, 2} }, + {/*61 */"Promethium", "Pm", 3, 145000, 8, 6, -1, 6, 0, {2, 8, 18, 23, 8, 2} }, + {/*62 */"Samarium", "Sm", 2, 150360, 9, 6, 117, 6, 0, {2, 8, 18, 24, 8, 2} }, + {/*63 */"Europium", "Eu", 3, 151964, 10, 6, -1, 6, 0, {2, 8, 18, 25, 8, 2} }, + {/*64 */"Gadolinium", "Gd", 3, 157250, 11, 6, 120, 6, 0, {2, 8, 18, 25, 9, 2} }, + {/*65 */"Terbium", "Tb", 4, 158925, 12, 6, -1, 6, 0,{2, 8, 18, 27, 8, 2} }, + {/*66 */"Dysprosium", "Dy", 3, 162500, 13, 6, 112, 6, 0, {2, 8, 18, 28, 8, 2} }, + {/*67 */"Holmium", "Ho", 3, 164930, 14, 6, 123, 6, 0, {2, 8, 18, 29, 8, 2} }, + {/*68 */"Erbium", "Er", 3, 167259, 15, 6, 124, 6, 0, {2, 8, 18, 30, 8, 2} }, + {/*69 */"Thulium", "Tm", 3, 168934, 16, 6, 125, 6, 0, {2, 8, 18, 31, 8, 2} }, + {/*70 */"Yttrebium", "Yb", 3, 173054, 17,6, -1, 6, 0, {2, 8, 18, 32, 8, 2} }, + {/*71 */"Lutecium", "Lu", 3, 174967, 18, 6, 127, 6, 0, {2, 8, 18, 32, 9, 2} }, //fin des lanthanides + {/*72 */"Hafnium", "Hf", 4, 178490, 4, 6, 130, 8, 0, {2, 8, 18, 32, 10, 2} }, + {/*73 */"Tantale", "Ta", 5, 180948, 5, 6, 150, 8, 0, {2, 8, 18, 32, 11, 2} }, + {/*74 */"Tungstene", "W", 6, 183840, 6, 6, 236, 8, 0, {2, 8, 18, 32, 12, 2} }, + {/*75 */"Rhenium", "Re", 7, 186207, 7, 6, 190, 8, 0, {2, 8, 18, 32, 13, 2} }, + {/*76 */"Osmium", "Os", 8, 190230, 8, 6, 220, 8, 0, {2, 8, 18, 32, 14, 2} }, + {/*77 */"Iridium", "Ir", 8, 192217, 9, 6, 220, 8, 0, {2, 8, 18, 32, 15, 2} }, + {/*78 */"Platine", "Pt", 6, 195084, 10, 6, 228, 8, 0, {2, 8, 18, 32, 1, 1} }, + {/*79 */"Or", "Au", 5, 196967, 11, 6, 254, 8, 0, {2, 8, 18, 32, 18, 1} }, + {/*80 */"Mercure", "Hg", 4, 200590, 12, 6, 200, 8, 2, {2, 8, 18, 32, 18, 2} }, + {/*81 */"Thallium", "Tl", 3, 204380, 13, 6, 162, 9, 0, {2, 8, 18, 32, 18, 3} }, + {/*82 */"Plomb", "Pb", 4, 207200, 14, 6, 233, 9, 0, {2, 8, 18, 32, 18, 4} }, + {/*83 */"Bismuth", "Bi", 5, 208980, 15, 6, 202, 9, 0, {2, 8, 18, 32, 18, 5} }, + {/*84 */"Polonium", "Po", 6, 209000, 16, 6, 200, 3, 0, {2, 8, 18, 32, 18, 6} }, + {/*85 */"Astate", "At", 7, 210000, 17, 6, 220, 1, 0, {2, 8, 18, 32, 18, 7} }, + {/*86 */"Radon", "Rn", 6, 212000, 18, 6, -1, 2, 1, {2, 8, 18, 32, 18, 8} }, + {/*87 */"Francium", "Fr", 1, 223000, 1, 7, 70, 4, 0, {2, 8, 18, 32, 18, 8, 1} }, + {/*88 */"Radium", "Ra", 2, 226000, 2, 7, 90, 5, 0, {2, 8, 18, 32, 18, 8, 2} }, + {/*89 */"Actinium", "Ac", 3, 227000, 4, 7, 110, 7, 0, {2, 8, 18, 32, 18, 9, 2} }, // actinide + {/*90 */"Thorium", "Th", 4, 232038, 5, 7, 130, 7, 0, {2, 8, 18, 32, 18, 10, 2} }, + {/*91 */"Protactinium", "Pa", 5, 231036, 6, 7, 150, 7, 0, {2, 8, 18, 32, 20, 9, 2} }, + {/*92 */"Uranium", "U", 6, 238029, 7, 7, 138, 7, 0, {2, 8, 18, 32, 21, 9, 2} }, + {/*93 */"Neptunium", "Np", 7, 237000, 8, 7, 136, 7, 0, {2, 8, 18, 32, 22, 9, 2} }, + {/*94 */"Plutonium", "Pu", 8, 244000, 9, 7, 128, 7, 0, {2, 8, 18, 32, 24, 8, 2} }, + {/*95 */"Americum", "Am", 6, 243000, 10, 7, 130, 7, 0, {2, 8, 18, 32, 25, 8, 2} }, + {/*96 */"Curium", "Cm", 4, 247000, 11, 7, 130, 7, 0, {2, 8, 18, 32, 25, 9, 2} }, + {/*97 */"Berkelium", "Bk", 4, 247000, 12, 7, 130, 7, 0, {2, 8, 18, 32, 28, 8, 2} }, + {/*98 */"Californium", "Cf", 4, 251000, 13, 7, 130, 7, 0, {2, 8, 18, 32, 28, 8, 2} }, + {/*99 */"Einsteinium", "Es", 3, 252000, 14, 7, 130, 7, 0, {2, 8, 18, 32, 29, 8, 2} }, + {/*100 */"Fermium", "Fm", 3, 257000, 15, 7, 130, 7, 0, {2, 8, 18, 32, 30, 8, 2} }, + {/*101 */"Mendelevium", "Md", 3, 258000, 16, 7, 130, 7, 0, {2, 8, 18, 32, 31, 8, 2} }, + {/*102 */"Nobelium", "No", 3, 259000, 17, 7, 130, 7, 0, {2, 8, 18, 32, 32, 8, 2} }, + {/*103 */"Lawrencium", "Lr", 3, 262000, 18, 7, -1, 7, 0, {2, 8, 18, 32, 32, 8, 3} }, // fin des actinides + {/*104 */"Rutherfordium", "Rf", 4, 267000, 4, 7, -1, 8, 3, {2, 8, 18, 32, 32, 10, 2} }, + {/*105 */"Dubnium", "Db", 5, 268000, 5, 7, -1, 8, 3, {2, 8, 18, 32, 32, 11, 2} }, + {/*106 */"Seaborg", "Sg", 6, 271000, 6, 7, -1, 8, 3, {2, 8, 18, 32, 32, 12, 2} }, + {/*107 */"Bohrium", "Bh", 7, 272000, 7, 7, -1, 8, 3, {2, 8, 18, 32, 32, 13, 2} }, + {/*108 */"Hassium", "Hs", 8, 270000, 8, 7, -1, 8, 3, {2, 8, 18, 32, 32, 14, 2} }, + {/*109 */"Meitnerium", "Mt", -1, 276000, 9, 7, -1, 8, 3, {2, 8, 18, 32, 32, 15, 2} }, + {/*110 */"Darmstadium", "Ds", -1, 281000, 10, 7, -1, 8, 3, {2, 8, 18, 32, 32, 17, 1} }, + {/*111 */"Roengenium", "Rg", -1,280000, 11, 7, -1, 8, 3, {2, 8, 18, 32, 32, 18, 1} }, + {/*112 */"Copernicium", "Cn", -1, 285000, 12, 7, -1, 8, 3, {2, 8, 18, 32, 32, 18, 2} }, + {/*113 */"Ununtrium", "Uut", -1, 284000, 13, 7, -1, 9, 3, {2, 8, 18, 32, 32, 18, 3} }, + {/*114 */"Flerovium", "Fl", -1, 289000, 14, 7, -1, 9, 3, {2, 8, 18, 32, 32, 18, 4} }, + {/*115 */"Ununpentium", "Uup", -1, 288000, 15, 7, -1, 9, 3, {2, 8, 18, 32, 32, 18, 5} }, + {/*116 */"Livermorium", "Lv", -1, 288000, 16, 7, -1, 9, 3, {2, 8, 18, 32, 32, 18, 6} }, + {/*117 */"Ununseptium", "Uus", -1, 294000, 17, 7, -1, 1, 3, {2, 8, 18, 32, 32, 18, 7} }, + {/*118 */"Ununoctium", "Uun", -1, 294000, 18, 7, -1, 2, 3, {2, 8, 18, 32, 32, 18, 8} }, +}; + + #endif diff --git a/misc/icon.bmp b/misc/icon.bmp old mode 100644 new mode 100755 diff --git a/src/periodiq.c b/src/periodiq.c old mode 100644 new mode 100755 index eec0305..c66521a --- a/src/periodiq.c +++ b/src/periodiq.c @@ -43,188 +43,68 @@ int atoi(const char *str) return n*sign; } -//**************************************************************************** -// AddIn_main (Sample program main function) -// -// param : isAppli : 1 = This application is launched by MAIN MENU. -// : 0 = This application is launched by a strip in eACT application. -// -// OptionNum : Strip number (0~3) -// (This parameter is only used when isAppli parameter is 0.) -// -// retval : 1 = No error / 0 = Error -// -//**************************************************************************** - -struct Element elements[] = -{ - { /*1 */"Hydrogene", "H", 1, 1008, 1, 1, 220, 0, 1, {1} }, - { /*2 */"Helium", "He", 0, 4003, 18, 1, -1, 2, 1, {2} }, - { /*3 */"Lithium", "Li", 1, 6940, 1, 2, 98, 4, 0, {2, 1} }, - { /*4 */"Beryllium", "Be", 2, 9012, 2, 2, 157, 5, 0, {2, 2} }, - { /*5 */"Bore", "B", 3, 10810, 13, 2, 204, 3, 0, {2, 3} }, - { /*6 */"Carbone", "C", 4, 12011, 14, 2, 255, 0, 0, {2, 4} }, - { /*7 */"Azote", "N", 5, 14007, 15, 2, 304, 0, 1, {2, 5} }, - { /*8 */"Oxygene", "O", 2, 15999, 16, 2, 344, 0, 1, {2, 6} }, - { /*9 */"Fluor", "F", 1, 18998, 17, 2, 398, 1, 1, {2, 7} }, - {/*10 */"Neon", "Ne", 0, 20178, 18, 2, -1, 2, 1, {2, 8} }, - {/*11 */"Sodium", "Na", 1, 22990, 1, 3, 93, 4, 0, {2, 8, 1} }, - {/*12 */"Magnesium", "Mg", 2, 24305, 2, 3, 131, 5, 0, {2, 8, 2} }, - {/*13 */"Aluminium", "Al", 3, 26982, 13, 3, 161, 9, 0, {2, 8, 3} }, - {/*14 */"Silicium", "Si", 4, 28085, 14, 3, 190, 3, 0, {2, 8, 4} }, - {/*15 */"Phosphore", "P", 5, 30974, 15, 3, 219, 0, 0, {2, 8, 5} }, - {/*16 */"Soufre", "S", 6, 32060, 16, 3, 258, 0, 0, {2, 8, 6} }, - {/*17 */"Chlore", "Cl", 7, 35450, 17, 3, 316, 1, 1, {2, 8, 7} }, - {/*18 */"Argon", "Ar", 2, 39948, 18, 3, -1, 2, 1, {2, 8, 8} }, - {/*19 */"Potassium", "K", 1, 39098, 1, 4, 82, 4, 0, {2, 8, 8, 1} }, - {/*20 */"Calcium", "Ca", 2, 40078, 2, 4, 100, 5, 0, {2, 8, 8, 2} }, - {/*21 */"Scandium", "Sc", 3, 44956, 3, 4, 136, 8, 0, {2, 8, 9, 2} }, - {/*22 */"Titane", "Ti", 4, 47867, 4, 4, 154, 8, 0, {2, 8, 10, 2} }, - {/*23 */"Vanadium", "Va", 5, 50941, 5, 4, 163, 8, 0, {2, 8, 11, 2} }, - {/*24 */"Chrome", "Cr", 6, 51996, 6, 4, 166, 8, 0, {2, 8, 13, 1} }, - {/*25 */"Manganese", "Mn", 7, 54380, 7, 4, 155, 8, 0, {2, 8, 13, 2} }, - {/*26 */"Fer", "Fe", 6, 55845, 8, 4, 183, 8, 0, {2, 8, 14, 2} }, - {/*27 */"Cobalt", "Co", 5, 58933, 9, 4, 188, 8, 0, {2, 8, 15, 2} }, - {/*28 */"Nickel", "Ni", 4, 58693, 10, 4, 191, 8, 0, {2, 8, 16, 2} }, - {/*29 */"Cuivre", "Cu", 4, 63546,11, 4, 190, 8, 0, {2, 8, 18, 1} }, - {/*30 */"Zinc", "Zn", 2, 65380, 12, 4, 165, 8, 0, {2, 8, 18, 2} }, - {/*31 */"Gallium", "Ga", 3, 69723, 13, 4, 181, 9, 0, {2, 8, 18, 3} }, - {/*32 */"Germanium", "Ge", 4, 72630, 14, 4, 201, 3, 0, {2, 8, 18, 4} }, - {/*33 */"Arsenic", "As", 4, 74921, 15, 4, 218, 3, 0, {2, 8, 18, 5} }, - {/*34 */"Selenium", "Se", 6, 78971, 16, 4, 255, 0, 0, {2, 8, 18, 6} }, - {/*35 */"Brome", "Br", 7, 79904, 17, 4, 296, 1, 2, {2, 8, 18, 7} }, - {/*36 */"Krypton", "Kr", 2, 83798, 18, 4, 300 , 2, 1, {2, 8, 18, 8} }, - {/*37 */"Rubidium", "Rb", 1, 85468, 1, 5, 82, 4, 0, {2, 8, 18, 8, 1} }, - {/*38 */"Strontium", "Sr", 2, 87620, 2, 5, 95, 5, 0, {2, 8, 18, 8, 2} }, - {/*39 */"Yttrium", "Y", 3, 88906, 3, 5, 122, 8, 0, {2, 8, 18, 9, 2} }, - {/*40 */"Zirconium", "Zr", 4, 91224, 4, 5, 133, 8, 0, {2, 8, 18, 10, 2} }, - {/*41 */"Niobium", "Nb", 5, 92906, 5, 5, 160, 8, 0, {2, 8, 18, 12, 1} }, - {/*42 */"Molybdene", "Mo", 6, 95950, 6, 5, 216, 8, 0, {2, 8, 18, 13, 1} }, - {/*43 */"Technetium", "Tc", 7, 98000, 7, 5, 190, 8, 0, {2, 8, 18, 13, 2} }, - {/*44 */"Ruthenium", "Ru", 8, 101070, 8, 5, 220, 8, 0, {2, 8, 18, 15, 1} }, - {/*45 */"Rhodium", "Rh", 6, 102906, 9, 5, 228, 8, 0, {2, 8, 18, 16, 1} }, - {/*46 */"Palladium", "Pd", 4, 106420, 10, 5, 8, 0, 220, {2, 8, 18, 18} }, - {/*47 */"Argent", "Ag", 4, 107869, 11, 5, 8, 0, 193, {2, 8, 18, 18, 1} }, - {/*48 */"Cadmium", "Cd", 2, 112414, 12, 5, 8, 0, 169, {2, 8, 18, 18, 2} }, - {/*49 */"Indium", "In", 2, 114818, 13, 5, 9, 0, 178, {2, 8, 18, 18, 3} }, - {/*50 */"Etain", "Sn", 3, 118710, 14, 5, 9, 0, 196, {2, 8, 18, 18, 4} }, - {/*51 */"Antimoine", "Sb", 5, 121760, 15, 5, 205, 3, 0, {2, 8, 18, 18, 5} }, - {/*52 */"Tellure", "Te", 6, 127600, 16, 5, 210, 3, 0, {2, 8, 18, 18, 6} }, - {/*53 */"Iode", "I", 7, 126904, 17, 5, 266, 1, 0, {2, 8, 18, 18, 7} }, - {/*54 */"Xenon", "Xe", 8, 130293, 18, 5, 260, 2, 1, {2, 8, 18, 18, 8} }, - {/*55 */"Cesium", "Cs", 1, 132905, 1, 6, 79, 4, 0, {2, 8, 18, 18, 8, 1} }, - {/*56 */"Baryum", "Ba", 2, 137327, 2, 6, 89, 5, 0 ,{2, 8, 18, 18, 8, 2} }, - {/*57 */"Lanthane", "La", 3, 138910, 4, 6, 110, 6, 0, {2, 8, 18, 19, 8, 2} }, // lanthanides - {/*58 */"Cerium", "Ce", 4, 140116, 5, 6, 112, 6, 0, {2, 8, 18, 19, 8, 2} }, - {/*59 */"Praseodyme", "Pr", 4, 140907, 6, 6, 113, 6, 0, {2, 8, 18, 21, 8, 2} }, - {/*60 */"Neodyme", "Nd", 3, 144242, 7, 6, 114, 6, 0, {2, 8, 18, 22, 8, 2} }, - {/*61 */"Promethium", "Pm", 3, 145000, 8, 6, -1, 6, 0, {2, 8, 18, 23, 8, 2} }, - {/*62 */"Samarium", "Sm", 2, 150360, 9, 6, 117, 6, 0, {2, 8, 18, 24, 8, 2} }, - {/*63 */"Europium", "Eu", 3, 151964, 10, 6, -1, 6, 0, {2, 8, 18, 25, 8, 2} }, - {/*64 */"Gadolinium", "Gd", 3, 157250, 11, 6, 120, 6, 0, {2, 8, 18, 25, 9, 2} }, - {/*65 */"Terbium", "Tb", 4, 158925, 12, 6, -1, 6, 0,{2, 8, 18, 27, 8, 2} }, - {/*66 */"Dysprosium", "Dy", 3, 162500, 13, 6, 112, 6, 0, {2, 8, 18, 28, 8, 2} }, - {/*67 */"Holmium", "Ho", 3, 164930, 14, 6, 123, 6, 0, {2, 8, 18, 29, 8, 2} }, - {/*68 */"Erbium", "Er", 3, 167259, 15, 6, 124, 6, 0, {2, 8, 18, 30, 8, 2} }, - {/*69 */"Thulium", "Tm", 3, 168934, 16, 6, 125, 6, 0, {2, 8, 18, 31, 8, 2} }, - {/*70 */"Yttrebium", "Yb", 3, 173054, 17,6, -1, 6, 0, {2, 8, 18, 32, 8, 2} }, - {/*71 */"Lutecium", "Lu", 3, 174967, 18, 6, 127, 6, 0, {2, 8, 18, 32, 9, 2} }, //fin des lanthanides - {/*72 */"Hafnium", "Hf", 4, 178490, 4, 6, 130, 8, 0, {2, 8, 18, 32, 10, 2} }, - {/*73 */"Tantale", "Ta", 5, 180948, 5, 6, 150, 8, 0, {2, 8, 18, 32, 11, 2} }, - {/*74 */"Tungstene", "W", 6, 183840, 6, 6, 236, 8, 0, {2, 8, 18, 32, 12, 2} }, - {/*75 */"Rhenium", "Re", 7, 186207, 7, 6, 190, 8, 0, {2, 8, 18, 32, 13, 2} }, - {/*76 */"Osmium", "Os", 8, 190230, 8, 6, 220, 8, 0, {2, 8, 18, 32, 14, 2} }, - {/*77 */"Iridium", "Ir", 8, 192217, 9, 6, 220, 8, 0, {2, 8, 18, 32, 15, 2} }, - {/*78 */"Platine", "Pt", 6, 195084, 10, 6, 228, 8, 0, {2, 8, 18, 32, 1, 1} }, - {/*79 */"Or", "Au", 5, 196967, 11, 6, 254, 8, 0, {2, 8, 18, 32, 18, 1} }, - {/*80 */"Mercure", "Hg", 4, 200590, 12, 6, 200, 8, 2, {2, 8, 18, 32, 18, 2} }, - {/*81 */"Thallium", "Tl", 3, 204380, 13, 6, 162, 9, 0, {2, 8, 18, 32, 18, 3} }, - {/*82 */"Plomb", "Pb", 4, 207200, 14, 6, 233, 9, 0, {2, 8, 18, 32, 18, 4} }, - {/*83 */"Bismuth", "Bi", 5, 208980, 15, 6, 202, 9, 0, {2, 8, 18, 32, 18, 5} }, - {/*84 */"Polonium", "Po", 6, 209000, 16, 6, 200, 3, 0, {2, 8, 18, 32, 18, 6} }, - {/*85 */"Astate", "At", 7, 210000, 17, 6, 220, 1, 0, {2, 8, 18, 32, 18, 7} }, - {/*86 */"Radon", "Rn", 6, 212000, 18, 6, -1, 2, 1, {2, 8, 18, 32, 18, 8} }, - {/*87 */"Francium", "Fr", 1, 223000, 1, 7, 70, 4, 0, {2, 8, 18, 32, 18, 8, 1} }, - {/*88 */"Radium", "Ra", 2, 226000, 2, 7, 90, 5, 0, {2, 8, 18, 32, 18, 8, 2} }, - {/*89 */"Actinium", "Ac", 3, 227000, 4, 7, 110, 7, 0, {2, 8, 18, 32, 18, 9, 2} }, // actinide - {/*90 */"Thorium", "Th", 4, 232038, 5, 7, 130, 7, 0, {2, 8, 18, 32, 18, 10, 2} }, - {/*91 */"Protactinium", "Pa", 5, 231036, 6, 7, 150, 7, 0, {2, 8, 18, 32, 20, 9, 2} }, - {/*92 */"Uranium", "U", 6, 238029, 7, 7, 138, 7, 0, {2, 8, 18, 32, 21, 9, 2} }, - {/*93 */"Neptunium", "Np", 7, 237000, 8, 7, 136, 7, 0, {2, 8, 18, 32, 22, 9, 2} }, - {/*94 */"Plutonium", "Pu", 8, 244000, 9, 7, 128, 7, 0, {2, 8, 18, 32, 24, 8, 2} }, - {/*95 */"Americum", "Am", 6, 243000, 10, 7, 130, 7, 0, {2, 8, 18, 32, 25, 8, 2} }, - {/*96 */"Curium", "Cm", 4, 247000, 11, 7, 130, 7, 0, {2, 8, 18, 32, 25, 9, 2} }, - {/*97 */"Berkelium", "Bk", 4, 247000, 12, 7, 130, 7, 0, {2, 8, 18, 32, 28, 8, 2} }, - {/*98 */"Californium", "Cf", 4, 251000, 13, 7, 130, 7, 0, {2, 8, 18, 32, 28, 8, 2} }, - {/*99 */"Einsteinium", "Es", 3, 252000, 14, 7, 130, 7, 0, {2, 8, 18, 32, 29, 8, 2} }, - {/*100 */"Fermium", "Fm", 3, 257000, 15, 7, 130, 7, 0, {2, 8, 18, 32, 30, 8, 2} }, - {/*101 */"Mendelevium", "Md", 3, 258000, 16, 7, 130, 7, 0, {2, 8, 18, 32, 31, 8, 2} }, - {/*102 */"Nobelium", "No", 3, 259000, 17, 7, 130, 7, 0, {2, 8, 18, 32, 32, 8, 2} }, - {/*103 */"Lawrencium", "Lr", 3, 262000, 18, 7, -1, 7, 0, {2, 8, 18, 32, 32, 8, 3} }, // fin des actinides - {/*104 */"Rutherfordium", "Rf", 4, 267000, 4, 7, -1, 8, 3, {2, 8, 18, 32, 32, 10, 2} }, - {/*105 */"Dubnium", "Db", 5, 268000, 5, 7, -1, 8, 3, {2, 8, 18, 32, 32, 11, 2} }, - {/*106 */"Seaborg", "Sg", 6, 271000, 6, 7, -1, 8, 3, {2, 8, 18, 32, 32, 12, 2} }, - {/*107 */"Bohrium", "Bh", 7, 272000, 7, 7, -1, 8, 3, {2, 8, 18, 32, 32, 13, 2} }, - {/*108 */"Hassium", "Hs", 8, 270000, 8, 7, -1, 8, 3, {2, 8, 18, 32, 32, 14, 2} }, - {/*109 */"Meitnerium", "Mt", -1, 276000, 9, 7, -1, 8, 3, {2, 8, 18, 32, 32, 15, 2} }, - {/*110 */"Darmstadium", "Ds", -1, 281000, 10, 7, -1, 8, 3, {2, 8, 18, 32, 32, 17, 1} }, - {/*111 */"Roengenium", "Rg", -1,280000, 11, 7, -1, 8, 3, {2, 8, 18, 32, 32, 18, 1} }, - {/*112 */"Copernicium", "Cn", -1, 285000, 12, 7, -1, 8, 3, {2, 8, 18, 32, 32, 18, 2} }, - {/*113 */"Ununtrium", "Uut", -1, 284000, 13, 7, -1, 9, 3, {2, 8, 18, 32, 32, 18, 3} }, - {/*114 */"Flerovium", "Fl", -1, 289000, 14, 7, -1, 9, 3, {2, 8, 18, 32, 32, 18, 4} }, - {/*115 */"Ununpentium", "Uup", -1, 288000, 15, 7, -1, 9, 3, {2, 8, 18, 32, 32, 18, 5} }, - {/*116 */"Livermorium", "Lv", -1, 288000, 16, 7, -1, 9, 3, {2, 8, 18, 32, 32, 18, 6} }, - {/*117 */"Ununseptium", "Uus", -1, 294000, 17, 7, -1, 1, 3, {2, 8, 18, 32, 32, 18, 7} }, - {/*118 */"Ununoctium", "Uun", -1, 294000, 18, 7, -1, 2, 3, {2, 8, 18, 32, 32, 18, 8} }, +// element family +static const char *family[25] ={ + "non metaux", // 0 + "halogene", // 1 + "gaz rare", // 2 + "metalloide", // 3 + "metal alcalin", // 4 + "metal alcalino terreux", // 5 + "lanthanide", // 6 + "actinide", // 7 + "metal de transition", // 8 + "post transition metal"// 9 }; -char *family[25] ={ -{"non metaux"}, //0 -{"halogene"}, //1 -{"gaz rare"}, //2 -{"metalloide"}, //3 -{"metal alcalin"}, //4 -{"metal alcalino terreux"}, //5 -{"lanthanide"}, //6 -{"actinide"}, //7 -{"metal de transition"}, //8 -{"post transition metal"}//9 +// state element +static const char *etat[9]={ + "solide", // 0 + "gaz", // 1 + "liquide", // 2 + "inconnu", // 3 }; -char *etat[9]={ - {"solide"}, //0 - {"gaz"}, //1 - {"liquide"}, //2 - {"inconnu"}, //3 -}; - -extern Font modern; +extern font_t modern; +extern image_t tableauMini; #define floor(x) ((int)(x)) -static const int counts[] = { 2, 8, 8, 18, 18, 32, 32 }; -static const int firsts[] = { 1, 2, 2, 3, 3, 18, 18 }; /* returns element number (1-118) or 0 if there is nothing at the given cell */ /* x and y can hold any value, even if it's outside the table */ + + int element_at(int x, int y) { - if(x < 0 || x >= 18 || y < 0 || y >= 9) return 0; + static const int counts[] = { 2, 8, 8, 18, 18, 32, 32 }; + static const int firsts[] = { 1, 2, 2, 3, 3, 18, 18 }; + + int result = 0; + + if(x < 0 || x > 17 || y < 0 || y > 8 ) return 0; if(y >= 7) { if(x < 3 || x > 17) return 0; - return ((y == 7) ? (57) : (89)) + (x - 4); + return ( y == 7 ? 57 : 89 ) + x - 3; } - - int result = 0; + else if(y >= 5) + { + if(x >= 3) result += 14; + } if(x >= firsts[y]) { if(x + (counts[y] - firsts[y]) < 18) return 0; else x -= (18 - counts[y]); } - while(--y >= 0) result += counts[y]; + + while(y--) + { + result += counts[y]; + } + return result + x + 1 ; } @@ -232,7 +112,7 @@ int element_at(int x, int y) /* in this case, returns the element's number; otherwise returns 0 */ int move(int *x, int *y, enum { up = 0, right, down, left } dir) { - int dx[] = { 0, 1, 0, -1 }; + int dx[] = { 0, 1, 0, -1 }; int dy[] = { -1, 0, 1, 0 }; int elt = element_at(*x + dx[dir], *y + dy[dir]); @@ -262,10 +142,12 @@ int tableauElement(int chang) short decalx = 0, decaly = 0; - unsigned char x = 1, y = 1; + int test; + char x = 1, y = 1; unsigned char i; -text_configure(&modern, color_black); + + text_configure(&modern, color_black); while(1) { @@ -273,15 +155,19 @@ text_configure(&modern, color_black); for(i = 0; i < 118; i++) { -//dtext(13*(elements[i].groupe-1)+decalx+1, 8*( elements[i].famille == 6 || elements[i].famille == 7 ? elements[i].periode + 3 : elements[i].periode) +decaly-6, elements[i].symbol); +dtext(13*(elements[i].groupe-1)+decalx+1, 8*( elements[i].famille == 6 || elements[i].famille == 7 ? elements[i].periode + 3 : elements[i].periode) +decaly-6, elements[i].symbol); } + // x = elements[chang].groupe; -// y = ( elements[chang].famille == 6 || elements[chang].famille == 7 ? elements[chang].periode + 3 : elements[chang].periode); - dprint(1,1, "(%d,%d) => %d", x,y,element_at(x, y)); +// y = ( elements[chang].famille == 6 || elements[chang].famille == 7 ? elements[chang].periode + 3 : elements[chang].periode); +/* test = element_at(x, y); + /* dprint(1,1, "(%d,%d) => %d et %s", x,y, test, elements[test-1].symbol);*/ + chang = element_at(x, y); + dprint(1,1, "(%d,%d) = %d", x, y, chang); - //drect(13*x,8*y,13*x+12,8*y+8, color_black); + drect(13*x,8*y,13*x+12,8*y+8, color_invert); dupdate(); @@ -295,11 +181,11 @@ text_configure(&modern, color_black); case KEY_DOWN : y++; break; case KEY_LEFT : x--; break; case KEY_RIGHT : x++; break; - // case KEY_F4 : chang=tableauEleMini(chang); break; + //case KEY_F4 : chang=tableauEleMini(chang); break; case KEY_F2 : chang=find(chang); break; // case KEY_F3 : calcul_mole(); break; - case KEY_F6 : case KEY_EXE : chang=detailsElement(3); break; + case KEY_F6 : case KEY_EXE : chang=detailsElement(chang - 1); break; case KEY_EXIT : return 1; } @@ -308,18 +194,17 @@ text_configure(&modern, color_black); int tableauEleMini(int chang) { -/*char buffer[50]; +char buffer[50]; char y; char menu=0; char choix=-1; -while(1) - { dclear(); -// ML_bmp_or(TABLEAU_MINI, 0, 0, 91, 48); - choix_famille(choix); // on met en place le choix sur les familles - + dimage(0, 0, &tableauMini); + dupdate(); + getkey(); + /* chang=(chang>=118 ? 0 : chang<=-1 ? 117 : chang); y=(chang>55 && chang<71 ? 9 : chang>87 && chang<103 ? 10 : elements[chang].periode); @@ -580,26 +465,34 @@ unsigned char* input(unsigned char* ask, unsigned char size, unsigned char* char dtext(1, 20, buffer); dupdate(); + key=getkey(); for(i = 0; i < strlen(char_allowed); i++) { - if(char_allowed[i]==key_char(key) && j < size) + if(char_allowed[i] == key_char(key) && j < size) { buffer[j++] = key_char(key); - buffer[j]=0; + buffer[j] = 0; } } - if(key == KEY_DEL) + switch(key) { - j--; - buffer[j]=0; - } - - if(key == KEY_EXE || key == KEY_EXIT) - { - return buffer; + case KEY_DEL : + { + j--; + buffer[j] = 0; + break; + } + case KEY_EXE : + { + return buffer; + } + case KEY_EXIT : + { + return NULL; + } } } } @@ -613,6 +506,8 @@ char i=0, j=0; unsigned char buffer[50]; +text_configure(&modern, color_black); + dclear(); dtext(10, 1, "Vous cherchez :"); dtext(10, 15, "1. numero de l'element"); @@ -621,7 +516,7 @@ dtext(10, 35, "3. Symbole de l'element"); dtext(10, 45, "4. Nom de l'element"); dupdate(); -while (1) +/*while (1) { key=getkey(); @@ -706,12 +601,12 @@ while (1) } } } - }*/ + } case KEY_EXIT : return chang; } - } + }*/ } void calcul_mole()