//--------------------------------------------------------------------------- void File_Pdf::Object_Info() { Element_Info1("Info"); //Parsing string Key; Ztring Value; while (Element_Offset<Element_Size) { if (Get_Next(Key, Value)) { for (;;) { Get_Next(Key, Value); if (Key.empty()) break; } continue; } if (Key.empty()) break; } }
//--------------------------------------------------------------------------- void File_Pdf::Object_Root() { Element_Info1("Document Catalog"); //Parsing string Key; Ztring Value; while (Element_Offset<Element_Size) { if (Get_Next(Key, Value)) { for (;;) { Get_Next(Key, Value); if (Key.empty()) break; else if (Key=="Metadata") { int32u ObjectNumber=Value.To_int32u(); Objects[ObjectNumber].Type=Type_Metadata; Objects[ObjectNumber].TopObject=Objects_Current->first; Objects[Objects_Current->first].Bottoms.push_back(ObjectNumber); Param_Info1(__T("Metadata is at offset 0x"+Ztring().From_Number(Objects[ObjectNumber].Offset))); } } continue; } if (Key.empty()) break; } }
//--------------------------------------------------------- void CAir_Flow_Height::Get_Lee(int x, int y, double &Sum_A, double &Sum_B) { double Weight_A = Sum_A = 0.0; double Weight_B = Sum_B = 0.0; if( m_pDEM->is_InGrid(x, y) ) { double z, d, id, w; TSG_Point p; d = id = Get_Cellsize(); p = Get_System()->Get_Grid_to_World(x, y); while( id <= m_maxDistance && Get_Next(p, d, true) ) { if( Get_Z(p, d, z) ) { Weight_A += w = d * pow(id, -m_dLuv); Sum_A += w * z; Weight_B += w = d * pow(id, -m_dLee); Sum_B += w * z; } d *= m_Acceleration; id += d; } if( Weight_A > 0.0 ) { Sum_A /= Weight_A; } if( Weight_B > 0.0 ) { Sum_B /= Weight_B; } } }
//--------------------------------------------------------------------------- void File_Pdf::Object_Metadata() { Element_Info1("Metadata"); //Parsing string Key; Ztring Value; int32u Length=0; while (Element_Offset<Element_Size) { if (Get_Next(Key, Value)) { for (;;) { Get_Next(Key, Value); if (Key.empty()) break; else if (Key=="Length") { Length=Value.To_int32u(); } } continue; } if (Key.empty()) break; else if (Key=="stream") { //Removig end of lines if (Element_Offset<Element_Size && Buffer[Buffer_Offset+(size_t)Element_Offset]=='\r') Element_Offset++; if (Element_Offset<Element_Size && Buffer[Buffer_Offset+(size_t)Element_Offset]=='\n') Element_Offset++; #ifndef MEDIAINFO_TINYXML2_NO File_Xmp MI; Open_Buffer_Init(&MI, Length); Open_Buffer_Continue(&MI, Buffer+Buffer_Offset+(size_t)Element_Offset, Length); Skip_XX(Length, "Stream, Data"); Open_Buffer_Finalize(&MI); Merge(MI, Stream_General, 0, 0); #endif //MEDIAINFO_TINYXML2_NO } } }
int main() { while (true) { scanf("%s", y); N = strlen(y); if (N == 1 && y[0] == '.') break; Get_Next(); printf("%d\n", (N % (N - next[N]) == 0) ? N / (N - next[N]) : 1); } return 0; }
//--------------------------------------------------------------------------- void File_Pdf::trailer() { Element_Begin1("Trailer"); //Parsing int32u Prev=(int32u)-1; string Key; Ztring Value; Skip_String(SizeOfLine(), "Object name"); while (Element_Offset<Element_Size) { if (Get_Next(Key, Value)) { for (;;) { Get_Next(Key, Value); if (Key.empty()) break; else if (Key=="Root") { int32u ObjectNumber=Value.To_int32u(); Objects[ObjectNumber].Type=Type_Root; Objects[ObjectNumber].TopObject=(int32u)-1; Objects[(int32u)-1].Bottoms.push_back(ObjectNumber); Param_Info1(__T("Document Catalog is at offset 0x"+Ztring().From_Number(Objects[ObjectNumber].Offset, 16))); } else if (Key=="Info") { int32u ObjectNumber=Value.To_int32u(); Objects[ObjectNumber].Type=Type_Info; Objects[ObjectNumber].TopObject=(int32u)-1; Objects[(int32u)-1].Bottoms.push_back(ObjectNumber); Param_Info1(__T("Info is at offset 0x"+Ztring().From_Number(Objects[ObjectNumber].Offset, 16))); } else if (Key=="Prev") { Prev=Value.To_int32u(); Param_Info1(__T("Previous Cross-Reference Table is at offset 0x"+Ztring().From_Number(Prev, 16))); } } continue; } if (Key.empty()) break; } Element_End0(); //Previous Cross-Reference Table if (Prev!=(int32u)-1) { GoTo(Prev); return; } objects::iterator Object_Top=Objects.find((int32u)-1); if (Offsets.empty() || Object_Top==Objects.end()) { Finish(); return; } sort(Offsets.begin(), Offsets.end()); //Offsets_Current=Offsets.end(); //No more used for the moment Objects[(int32u)-1].BottomPos=0; Objects_Current=Objects.find(Object_Top->second.Bottoms[0]); GoTo(Objects_Current->second.Offset); State=State_Parsing_object; }