static SP_BOOL
set_singleton(Wam wam, TAGGED val, TAGGED mutable)
{
  TAGGED t1, *h;

  t1 = RefMutable(mutable);
  if (!fd_member(val, DomainSet(t1)))
    return FALSE;
  else if (TagToSTR(t1) >= w->global_uncond) {
				/* can safely smash it */
    TAGGED *arg = TagToArg(t1,0);
      
    h = w->global_top;
    *h++ = MakeList(arg+2);
    *h++ = atom_nil;
    w->global_top = h;
    arg[1] = MakeList(h-2);
    arg[2] = val;
    arg[3] = val;
    arg[4] = TaggedOne;
  } else {
    DECL_UPDATE_MUTABLE;
    h = w->global_top;
    *h++ = MakeList(w->global_top+4);
    *h++ = atom_nil;
    *h++ = fd.functor_dom4;
    *h++ = MakeList(w->global_top);
    *h++ = val;
    *h++ = val;
    *h++ = TaggedOne;
    w->global_top = h;
    FD_UPDATE_MUTABLE(MakeStructure(h-5), mutable);
  }
  return TRUE;
}
Esempio n. 2
0
void PecoApp::MessageReceived(BMessage *msg) {
	switch( msg->what ) {
		case B_SIMPLE_DATA:			RefsReceived (msg); break;
		case MSG_MENU_NEW:			New(); NoRenamer(); break;
		case MSG_SELECT_FILES: 		fFilePanel->Show(); break;
		case MSG_DO_IT: 			MakeList(); DoIt(); break;
		case MSG_RENAMER: 			ChangeRenamer(); break;
		case MSG_RENAME_SETTINGS:	MakeList(); break;
		case MSG_MENU_SCRIPT:		if (!NothingToDo()) fScriptFilePanel->Show(); break;
		case B_SAVE_REQUESTED:		CreateScript(msg); break;
		
	   	default:
	   		BApplication::MessageReceived(msg);
	}
};
Esempio n. 3
0
int main(int argc, char **argv) {
   char tvalue = '\0', *key = calloc(ARGLENGTH, sizeof(char)),
    *parse = calloc(10, sizeof(char)),
    *fileName = calloc(ARGLENGTH, sizeof(char)), **wordList;

   tvalue = ParseArgs(argc, argv);

   key = argv[optind];
   fileName = argv[optind + 1];

   if (optind == argc || argc < 2) {
      fprintf(stderr, "usage: look [-dfa] [-t char] string [file]\n");
      exit(EXIT_FAILURE);
   }
   else if (optind + 1 == argc) {
      fileName = "/usr/share/dict/words";
      argFlags[0] = 1;
      argFlags[1] = 1;
   }
   key = CheckFlags(key, tvalue);

   ParseFile(argv, &parse, fileName);
   wordList = MakeList(parse);
   PrintResults(wordList, key, tvalue);
   return EXIT_SUCCESS;
}
Esempio n. 4
0
File: md2.c Progetto: kneth/MDreac
int main(int argc, char *argv[]) {

    size_t i;
    FILE *statfile;

    ReadParameters(argc, argv);
    Initialize();
    statfile = fopen(outname, "w");
    ReadConfiguration();
    for(i=0; i<nsteps; i++) { /* a number of single time steps */
        ApplyPerBoundaries();
        if ((i % liststeps) == 0) {
            PutInBox();
            MakeList();
        }
        ComputeForces();
        if (microcanon) {
            Leapfrog();
        }
        else {
            NoseHoover();
        }
        if ((i % iosteps) == 0) {
            fprintf(statfile, "%ld %e %e %e %e %e\n", i, Ekin, Epot, P, eta, Ekin+Epot);
        }
    }
    fclose(statfile);
    WriteConfiguration(final_conf);
    return 1;
}
Esempio n. 5
0
struct list* addNode(struct list* Liste) {
/******************************************************************************
 * Tilføjer en node til den angivne
 * Hvis det er den sidste node tilføjes den bare ellers indsættes den.
 *****************************************************************************/
  struct list* nyListe;

  nyListe = MakeList();

  if (Liste == 0) {
    Liste = nyListe;
  }  
  else if (Liste->post == 0) {
    Liste->post = nyListe;
    nyListe->post = 0;
    nyListe->pre  = Liste;
  }
  else {
    nyListe->post = Liste->post;
    nyListe->pre  = Liste;
    Liste->post   = nyListe;
    nyListe->post->pre = nyListe;
  }
  return(Liste);
} /* addNode() */
Esempio n. 6
0
	void DataFileDB::LoadContent()
	{
		dbtype=StringToType(ReadFile("type"));

		if(dbtype==DBSingleFile)
		{
			Data::operator=(toval(ReadFile("value")));
		}
		else if(dbtype==DBStringKeys)
		{
			Data keys=toval(ReadFile("keys"));
			status=vector<DBEntryStatus>(keys.Size());
			MakeList(keys.Size());
			
			for(size_t i=0; i<vec.size(); i++)
			{
				vec[i]=keys[i];
				status[i].ondisk=true;
			}
		}
		else
			throw Error::NotYetImplemented("DataFileDB::LoadContent()");

		Dump("LoadContent()","load old data");
	}
Esempio n. 7
0
void PecoApp::ChangeRenamer() {
	BMenuField	*myField = (BMenuField *)fWindow->FindView("selectMode");
	BMenu		*myMenu = myField->Menu();
	if (fRenameMode != myMenu->IndexOf(myField->Menu()->FindMarked())) {
		BView	*bottomView = fWindow->FindView("bottomView");
		fWindow->Lock();
		if (fRenameMode != -1) 
			bottomView->RemoveChild((BView *)((PecoApp *)be_app)->fRenamers[fRenameMode]);
		else {
			float deltaHeight = be_plain_font->Size()*2 + 40;
			fWindow->FindView("topView")->SetResizingMode(0);
			fWindow->FindView("bottomView")->SetResizingMode(B_FOLLOW_TOP_BOTTOM);	
			fWindow->ResizeBy(0, deltaHeight);
			fWindow->FindView("topView")->SetResizingMode(B_FOLLOW_TOP_BOTTOM);
			fWindow->FindView("bottomView")->SetResizingMode(B_FOLLOW_BOTTOM);	
			float min_h, max_h, min_v, max_v;
			fWindow->GetSizeLimits( &min_h, &max_h, &min_v, &max_v );
			fWindow->SetSizeLimits( min_h, max_h, min_v + deltaHeight, max_v );
		}
		fRenameMode = myMenu->IndexOf(myField->Menu()->FindMarked());
		bottomView->AddChild(((PecoApp *)be_app)->fRenamers[fRenameMode]);
		if (((PecoApp *)be_app)->fRenamers[fRenameMode]->ChildAt(0) != NULL) 
			((PecoApp *)be_app)->fRenamers[fRenameMode]->ChildAt(0)->MakeFocus();
		else
			fWindow->FindView("DoIt")->MakeFocus();
		fWindow->Unlock();
		MakeList();
	}
}
Esempio n. 8
0
int main(int argc, char* argv[])
{
	MakeList();
	std::string filePath;
	//filePath = argv[1];
	/*if(argc > 1)
		std::string filePath(argv[1]);
	else
	{
		cout << "Please type in the file path of a SIC Basic or XE source code" << endl;
		getline(cin, filePath);
	}*/

	cout << ParseLine("first = one1 + two2 - three3 / four4 ;") << "\n";
	cout << ParseLine("second = one1 * ( ( two2 * three3 ) + ( two2 * three3 ) );") << "\n";
	cout << ParseLine("third = ONE + twenty - three3 ;") << "\n";
	cout << ParseLine("third = old * thirty2 / b567 ;") << "\n";
	cout << ParseLine("one1 * i8766e98e + bignum") << "\n";
	cout << ParseLine("third = ONE + twenty - three3 ;") << "\n";
	cout << ParseLine("third = ONE + twenty - three3 ;") << "\n";
	cout << ParseLine("first = = one1 + two2 - three3 / four4 ;") << "\n";
	cout << ParseLine("first = one1 + two2 - three3 / four4") << "\n";
	cout << ParseLine("first = 1 + - two2 - three3 / four4 ;") << "\n";
	cout << ParseLine("first = one1 + two2 ? three3 / four4 ;") << "\n";
	cout << ParseLine("second = 4 + ( one1 * two2 ) * ( three3 + four4 ;") << "\n";
	cout << ParseLine("third = one1 + 24 - three3 ;") << "\n";
	cout << ParseLine("one1 + - delta") << "\n";
	cout << ParseLine("sixty6 / min = fourth ;") << "\n";

	filePath = ".\\SICTEST.asm";
	WriteResults();
	system("PAUSE");
}
Esempio n. 9
0
void * FbMasterInfoBase::Execute(wxEvtHandler * owner, FbThread * thread, const FbFilterObj &filter)
{
	if (thread->IsClosed()) return NULL;

	FbCommonDatabase database;
	database.JoinThread(thread);
	FbGenreFunction func_genre;
	FbAggregateFunction func_aggregate;
	database.CreateFunction(wxT("AGGREGATE"), 1, func_aggregate);
	database.CreateFunction(wxT("GENRE"), 1, func_genre);
	database.AttachConfig();
	if (thread->IsClosed()) return NULL;

	wxString sql;
	switch (GetMode()) {
		case FB2_MODE_LIST: sql = GetListSQL(database); break;
		case FB2_MODE_TREE: sql = GetTreeSQL(database); break;
	}
	sql = FormatSQL(sql, GetWhere(database), filter);

	FbSQLite3Statement stmt = database.PrepareStatement(sql);
	Bind(stmt);
	FbSQLite3ResultSet result = stmt.ExecuteQuery();
	if (!result.IsOk()) return NULL;

	switch (GetMode()) {
		case FB2_MODE_LIST: MakeList(owner, thread, result); break;
		case FB2_MODE_TREE: MakeTree(owner, thread, result); break;
	}
	return NULL;
}
Esempio n. 10
0
/*
 * InitExternEditors()
 *
 * This is an initialization function for outside editors.
 */
void InitExternEditors()
{
    SYS_FILE fn;

    makeSysName(fn, "editors.sys", &cfg.roomArea);
    MakeList(&ExtEditors, fn, NULL);
}
Esempio n. 11
0
	// list -> '[' commaList ']' {
	void list()
	{
		match(Token::Type::BEGIN_LIST);
		push({StackItem::Type::START_LIST, nullptr});
		commaList();
		match(Token::Type::END_LIST);
		MakeList();
	}
Esempio n. 12
0
int main() {
    while (scanf("%d%d%d", &n, &k, &m)) {
        // Exit.
        if (!n && !k && !m) {
            break;
        }
        // INIT.
        MakeList();
        official_1 = head;
        official_2 = tail;
        num_people = n;
        // Solving and outputs.
        while (num_people) {
            // Count off.
            CountOff(official_1, k - 1, false);
            CountOff(official_2, m - 1, true);
            // Send off.
            if (official_1 != official_2) {
                // Outputs.
                printf("%3d%3d", official_1->num, official_2->num);
                if (num_people != 2) {
                    printf(",");
                } else {
                    printf("\n");
                }
                // Delete.
                Delete(official_1, false);
                Delete(official_2, true);
                num_people -= 2;
            } else {
                // Outputs.
                printf("%3d", official_1->num);
                if (num_people != 1) {
                    printf(",");
                } else {
                    printf("\n");
                }
                // Delete.
                official_2 = official_2->pred;
                Delete(official_1, false);
                num_people--;
            }
        }
    }

    return 0;
}
Esempio n. 13
0
    Data& Data::operator=(const Data& z)
    {
	if(this==&z)
	    return *this;

	type=z.type; n=z.n; str=z.str; r=z.r;
		
	if(z.IsDatabase() && z.type==ListType)
	{
	    MakeList(z.vec.size());
	    for(size_t i=0; i<z.vec.size(); i++)
		vec[i]=z[i];
	}
	else
	    vec=z.vec;
		
	return *this;
    }
Esempio n. 14
0
	Data& DataFileDB::operator=(const Data& z)
	{
		Dump("operator=(const Data&)","copy from",z);
		
		DestroyContent();
		
		if(dbtype==DBNone)
			throw Error::IO("DataFileDB::operator=(const Data&)","cannot assign to database type DBNone");

		if(dbtype==DBSingleFile)
		{
			Data::operator=(z);
			MarkAllDirty();
			return *this;
		}
		else if(dbtype==DBStringKeys)
		{
			if(!z.IsList())
				throw LangErr("DataFileDB::operator=(const DataFileDB&)","only dictionaries can be stored into DBStringKeys");

			MakeList(z.Size());
			status=vector<DBEntryStatus>(z.Size());
			
			for(size_t i=0; i<z.Size(); i++)
			{
				if(!z[i].IsList(2))
					throw LangErr("DataFileDB::operator=(const DataFileDB&)","invalid dictionary entry "+tostr(z[i]).String());
				else if(!z[i][0].IsString())
					throw LangErr("DataFileDB::operator=(const DataFileDB&)","only string valued keys allowed: "+tostr(z[i][0]).String());

				vec[i]=z[i];
				Touch(i);
				MarkDirty(i);
			}
			
			return *this;
		}
		else
			throw Error::NotYetImplemented("DataFileDB::operator=(const Data&)");
	}
Esempio n. 15
0
	void DataFileDB::CreateEmpty()
	{
		Dump("CreateEmpty()","initialize");

		if(DatabaseExist())
			throw Error::IO("DataFileDB::CreateEmpty()","database "+dir+" already created");

		if(dbtype==DBNone)
			throw Error::IO("DataFileDB::CreateEmpty()","cannot create database of type DBNone");
		else if(dbtype==DBSingleFile)
		{
#ifdef WIN32
			_mkdir(dir.c_str());
#else
			mkdir(dir.c_str(),0700);
#endif

			WriteFile("type",TypeToString(dbtype));
			WriteFile("value","NULL");
		}
		else if(dbtype==DBStringKeys)
		{
#ifdef WIN32
			_mkdir(dir.c_str());
			_mkdir((dir+"/data").c_str());
#else
			mkdir(dir.c_str(),0700);
			mkdir((dir+"/data").c_str(),0700);
#endif

			WriteFile("type",TypeToString(dbtype));
			WriteFile("keys","(,)");

			status=vector<DBEntryStatus>();
			MakeList();
		}
		else
			throw Error::NotYetImplemented("DataFileDB::CreateEmpty()");
	}
Esempio n. 16
0
DWORD WINAPI CThread::ThreadProc(LPVOID lpParameter)
{
	UpdateInfo(true);

	// Скопируем имена папок в новые переменные что бы не затереть исходные значения
	m_sSrcFolder = m_TaskInfo.sSrcFolder;
	m_sDestFolder = m_TaskInfo.sDestFolder;

	DelSlash(m_sSrcFolder);

	// Отформатируем имя папки назначения (раскроем макросы)
	CString sFormatedGenName = FormatDateTime(m_TaskInfo.sDestGenName.C());

	// Сформируем окончательное имя папки назначения
	m_sDestFolder += sFormatedGenName;
	DelSlash(m_sDestFolder);

	// Начало лога - запишем информацию о выполняемой задаче
	AddLog(TEXT("[i] Начало выполнения задачи, параметры:\r\n"));
	AddLog(TEXT("========================================\r\n"));
	AddLog(TEXT("[i] Задача: %s\r\n"), m_TaskInfo.sName.C());
	AddLog(TEXT("[i] Исходная папка: %s\r\n"), m_TaskInfo.sSrcFolder.C());
	AddLog(TEXT("[i] Папка назначения: %s\r\n"), (m_TaskInfo.sDestFolder + m_TaskInfo.sDestGenName).C());
	AddLog(TEXT("[i] Папка назначения: %s\r\n"), m_sDestFolder.C());
	AddLog(TEXT("[i] Включать файлы: %s\r\n"), m_TaskInfo.sIncludeMask.C());
	AddLog(TEXT("[i] Исключать файлы: %s\r\n"), m_TaskInfo.sExcludeMask.C());
    AddLog(TEXT("========================================\r\n"));

	// Если выполнение задачи не прервали - продолжаем
	if (!IsTerminated())
	{
		// Проверяем что бы папка назначения не была подпапкой исходной папки
		if (IsSubFolder(m_TaskInfo.sSrcFolder, m_sDestFolder))
		{
			AddLog(TEXT("[!] Папка назначения является подпапкой исходной папки\r\n"));
			AddLog(TEXT("[x] Невозможно продолжить выполнение задачи\r\n"));
		}
		// Проверка что папка назначения существует (или успешно создана)
		else if (!CheckDestFolder())
		{
			AddLog(TEXT("[!] Не могу создать папку назначения (%s)\r\n"), m_TaskInfo.sDestFolder.C());
			AddLog(TEXT("[x] Невозможно продолжить выполнение задачи\r\n"));
		}
		else
		{
			if (m_TaskInfo.bDoArchive)
			{
				// Получим временное (и уникальное) имя файла во временной папке
				TCHAR cTempPath[MAX_PATH];
				// получим временную папку
				GetTempPath(MAX_PATH, cTempPath);
				// получим уникальное имя для времнного файла, так же система создаст этот файл
				GetTempFileName(cTempPath, TEXT("smb"), 0, (LPTSTR) m_sFileList.Buf());

				if (!PathFileExists(m_sFileList.C()))
				{
					AddLog(TEXT("[!] Не могу создать файл-список (%s)\r\n"), m_sFileList.C());
					AddLog(TEXT("[!] Задача будет выполнена без архивирования\r\n"));
				}
			}

			// Сделаем предв. сканирование исходной папки
			m_bLevel = 0;
			m_dwPrescanFolders = 1;

			// Если работа с подпапками - предсканируем их
			if (m_TaskInfo.bSubFolders)
			{
				DoPrescan(m_sSrcFolder);

				// Узнаем сколько процентов занимает каждая "предсканированная" папка
				m_fPercentInc = (float) 100 / m_dwPrescanFolders;
			}
			// иначе просто подсчитаем кол-во файлов в исходной папке
			else
			{
				DWORD dwFiles = FilesInFolder(m_sSrcFolder);
				m_fPercentInc = (float) 100 / dwFiles;
			}

			UpdateInfo(true);

			MakeList(m_TaskInfo.sIncludeMask, m_aIncludeList);
			MakeList(m_TaskInfo.sExcludeMask, m_aExcludeList);

			// Создадим объект, в который будем записывать файл-лист для архиватора
			m_pFileList = new CMemTextFile();

			// Запускаем копирование файлов
			m_bLevel = 0;
			m_fPercents = 0;
			DoSubFolders(m_sSrcFolder, m_sDestFolder);

			// Сохраним файл-лист из памяти на диск
			m_pFileList->SaveFile(m_sFileList.C());
			delete m_pFileList;

			// Это последний вызов updateinfo, пускай получатели сообщения знают об этом
			m_TaskProgress.bLastInfo = true;
			UpdateInfo(true);

			// если задача не прервана - выполняем архивацию, если надо
			if (!IsTerminated() && m_TaskInfo.bDoArchive)
			{
				if (!PathFileExists(m_sArchiverEXE.C()))
				{
					AddLog(TEXT("[!] Не найден файл архиватора\r\n"));
					AddLog(TEXT("[x] Отмена запуска архиватора\r\n"));
				}											 
				else if (PathFileExists(m_sFileList.C()))
				{
					CString sArch = FormatC(TEXT("\"%s\" %s"), m_sArchiverEXE.C(), ParseArchiverCmdLine().C());
					AddLog(TEXT("[i] Вызов архиватора: %s\r\n"), sArch.C());

					PROCESS_INFORMATION pi = {0};

					STARTUPINFO si = {0};
					si.cb = sizeof(si);

					TCHAR cmd[MAX_PATH];
					lstrcpy(cmd, sArch.C());

					// Создаём процесс - запускаем архиватор
					if (CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
					{
						// И ждём пока он не завершит работу
						WaitForSingleObject(pi.hProcess, INFINITE);

						DWORD dwExitCode;
						GetExitCodeProcess(pi.hProcess, &dwExitCode);

						CloseHandle(pi.hProcess);
						CloseHandle(pi.hThread);
    
						AddLog(TEXT("[i] Архиватор завершил работу с кодом %d\r\n"), dwExitCode);

						// Если указано - удалим скопированный файлы (их имена занесены в список)
						if (m_TaskInfo.bArchDelFiles)
						{
							for (int i = 0; i < m_lFileList.Size(); i++)
                                DelFiles(m_lFileList[i]);
						}
					}
					else
						AddLog(TEXT("[!] Ошибка при вызове архиватора\r\n"));
				}

				// Удалим файл-список для архиватора
				DeleteFile(m_sFileList.C());
			}

			AddLog(TEXT("========================================\r\n"));
			if (IsTerminated())
				AddLog(TEXT("[i] Выполнение задачи прервано\r\n"));
			else
				AddLog(TEXT("[i] Выполнение задачи завершено\r\n"));
		}
	}

	// пошлём сообщения всем подписавшимся слушателям что работа завершена
	for (int i = 0; i < m_ProgressListenrs.Size(); i++)
		PostMessage(m_ProgressListenrs[i], RegisterWindowMessage(ThreadDoneMessage), 0, 0);

	return 0;
}
Esempio n. 17
0
void CLayerManager::ConnectLayers(char *pcList)
{
	MakeList( pcList ) ; // 리스트 만들기 
	LinkLayer( mp_sListHead ) ; // 링크 연결
}
Esempio n. 18
0
void mainloop()
{
  ///////////////////
  // do data logging
  ///////////////////
  if (millis() >= ulNextMeas_ms)
  {
    ds18b20();
    sendTeperatureTS(temp1, temp2, temp3, temp4);

    ulNextMeas_ms = millis() + ulMeasDelta_ms;

    pfTemp1[ulMeasCount % ulNoMeasValues] = temp1;
    pfTemp2[ulMeasCount % ulNoMeasValues] = temp2;
    pfTemp3[ulMeasCount % ulNoMeasValues] = temp3;
    pfTemp4[ulMeasCount % ulNoMeasValues] = temp4;
    pulTime[ulMeasCount % ulNoMeasValues] = millis() / 1000 + ulSecs2000_timer;

    Serial.print("Logging Temperature1: ");
    Serial.print(pfTemp1[ulMeasCount % ulNoMeasValues]);
    Serial.print(" deg Celsius - Temperature2: ");
    Serial.print(pfTemp2[ulMeasCount % ulNoMeasValues]);
    Serial.print(" deg Celsius - Temperature3: ");
    Serial.print(pfTemp3[ulMeasCount % ulNoMeasValues]);
    Serial.print(" deg Celsius - Temperature4: ");
    Serial.print(pfTemp4[ulMeasCount % ulNoMeasValues]);
    Serial.print(" deg Celsius - Time: ");
    Serial.println(pulTime[ulMeasCount % ulNoMeasValues]);

    ulMeasCount++;
  }

  // Check if a client has connected
  WiFiClient client = server.available();
  if (!client)
  {
    return;
  }

  // Wait until the client sends some data
  Serial.println("new client");
  unsigned long ultimeout = millis() + 250;
  while (!client.available() && (millis() < ultimeout) )
  {
    delay(1);
  }
  if (millis() > ultimeout)
  {
    Serial.println("client connection time-out!");
    return;
  }

  // Read the first line of the request
  String sRequest = client.readStringUntil('\r');
  //Serial.println(sRequest);
  client.flush();

  // stop client, if request is empty
  if (sRequest == "")
  {
    Serial.println("empty request! - stopping client");
    client.stop();
    return;
  }

  // get path; end of path is either space or ?
  // Syntax is e.g. GET /?pin=MOTOR1STOP HTTP/1.1
  String sPath = "", sParam = "", sCmd = "";
  String sGetstart = "GET ";
  int iStart, iEndSpace, iEndQuest;
  iStart = sRequest.indexOf(sGetstart);
  if (iStart >= 0)
  {
    iStart += +sGetstart.length();
    iEndSpace = sRequest.indexOf(" ", iStart);
    iEndQuest = sRequest.indexOf("?", iStart);

    // are there parameters?
    if (iEndSpace > 0)
    {
      if (iEndQuest > 0)
      {
        // there are parameters
        sPath  = sRequest.substring(iStart, iEndQuest);
        sParam = sRequest.substring(iEndQuest, iEndSpace);
      }
      else
      {
        // NO parameters
        sPath  = sRequest.substring(iStart, iEndSpace);
      }
    }
  }

  ///////////////////////////////////////////////////////////////////////////////
  // output parameters to serial, you may connect e.g. an Arduino and react on it
  ///////////////////////////////////////////////////////////////////////////////
  if (sParam.length() > 0)
  {
    int iEqu = sParam.indexOf("=");
    if (iEqu >= 0)
    {
      sCmd = sParam.substring(iEqu + 1, sParam.length());
      Serial.print("Die Eingabe ist: ");
      Serial.println(sCmd);
    }
  }


  ///////////////////////////
  // format the html response
  ///////////////////////////
  // Startseite ////////////////////////////////

  String sResponse, sResponse2, sHeader;

  if (sPath == "/")
  {
    ulReqcount++;
    int iIndex = (ulMeasCount - 1) % ulNoMeasValues;
    sResponse  = F("<html>\n<head>\n<title>WLAN Logger f&uuml;r Pufferspeichertemperatur</title>\n");
    sResponse += F("</head>\n<body>\n<font color=\"#000000\"><body bgcolor=\"#d0d0f0\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\"><h1>WLAN Logger f&uuml;r Pufferspeichertemperatur</h1>SMASE<BR><BR><FONT SIZE=+1>Letzte Messung um ");
    sResponse += F("Seite: Temperaturen -> Zeigt die gemessenen Temperaturen an <br>");
    sResponse += F("<hr>Seite: Grafik -> Zeigt den Temperaturverlauf (Diagramm) der letzten 24 h an <br>");
    sResponse += F("<hr>Seite: Grafik -> Zeigt den Temperaturverlauf (Tabelle) der letzten 24 h an <br>");
    sResponse += F("<hr>Seite: Settings -> Einstellungen <br>");
    sResponse += F(" <div style=\"clear:both;\"></div>");
    sResponse2 = F("<p>Temperaturverlauf - Seiten laden l&auml;nger:<BR>  <a href=\"/anzeige\"><button>Temperaturen</button></a>    <a href=\"/grafik\"><button>Grafik</button></a>     <a href=\"/tabelle\"><button>Tabelle</button></a>     <a href=\"/settings\"><button>Settings</button></a></p>");
    sResponse2 += MakeHTTPFooter().c_str();

    // Send the response to the client
    client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length()).c_str());
    client.print(sResponse);
    client.print(sResponse2);
  }


  if (sPath == "/anzeige")
  {
    ulReqcount++;
    int iIndex = (ulMeasCount - 1) % ulNoMeasValues;
    sResponse  = F("<html>\n<head>\n<title>WLAN Logger f&uuml;r Pufferspeichertemperatur</title>\n<script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>\n");
    sResponse += F("<script type=\"text/javascript\">\ngoogle.charts.load('current', {'packages':['gauge']});\n");
    sResponse += F("  google.charts.setOnLoadCallback(drawGauge); \n");
    sResponse += F("\nvar gaugeOptions = {min: 0, max: 100, greenFrom: 50, greenTo:75, yellowFrom: 75, yellowTo: 90,redFrom: 90, redTo: 100, minorTicks: 10, majorTicks: ['0','10','20','30','40','50','60','70','80','90','100']};\n");
    sResponse += F("   var gauge; \n");
    sResponse += F("  function drawGauge() { \n");
    sResponse += F("       gaugeData = new google.visualization.DataTable();  \n");
    sResponse += F("       gaugeData.addColumn('number', 'oben');  \n");
    sResponse += F("       gaugeData.addColumn('number', 'mitte');  \n");
    sResponse += F("       gaugeData.addColumn('number', 'unten');  \n");
    sResponse += F("       gaugeData.addColumn('number', 'vorlauf');  \n");
    sResponse += F("       gaugeData.addRows(2);  \n");
    sResponse += F("       gaugeData.setCell(0, 0, ");
    sResponse += pfTemp1[iIndex];
    sResponse += F(" ); \n");
    sResponse += F("   gaugeData.setCell(0, 1, ");
    sResponse += pfTemp2[iIndex];
    sResponse += F(" ); \n");
    sResponse += F("   gaugeData.setCell(0, 2, ");
    sResponse += pfTemp3[iIndex];
    sResponse += F(" ); \n");
    sResponse += F("  gaugeData.setCell(0, 3, ");
    sResponse += pfTemp4[iIndex];
    sResponse += F(" ); \n");
    sResponse += F("       gauge = new google.visualization.Gauge(document.getElementById('gauge_div'));  \n");
    sResponse += F("  gauge.draw(gaugeData, gaugeOptions);  \n");
    sResponse += F("  } \n");
    sResponse += F("  </script> \n  </head> \n <body> \n<font color=\"#000000\"><body bgcolor=\"#d0d0f0\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\"><h1>WLAN Logger f&uuml;r Pufferspeichertemperatur</h1>SMASE<BR><BR><FONT SIZE=+1>Letzte Messung um ");
    sResponse += epoch_to_string(pulTime[iIndex]).c_str();
    sResponse += F(" UTC<BR>\n");
    sResponse += F("<fieldset><legend>Pufferspeicher</legend>");
    sResponse += F("    <div id=\"gauge_div\" style=\"width:140px; height: 560px;\"></div> \n");
    sResponse += F("</fieldset>");
    sResponse += F(" <div style=\"clear:both;\"></div>");
    sResponse2 = F("<p>Temperaturverlauf - Seiten laden l&auml;nger:<BR>  <a href=\"/lauf\"><button>Vorlauf</button></a>    <a href=\"/grafik\"><button>Grafik</button></a>     <a href=\"/tabelle\"><button>Tabelle</button></a>     <a href=\"/settings\"><button>Settings</button></a></p>");
    sResponse2 += MakeHTTPFooter().c_str();

    // Send the response to the client
    client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length()).c_str());
    client.print(sResponse);
    client.print(sResponse2);
  }
  // Tabelle ////////////////////////////////
  else if (sPath == "/tabelle")
    ////////////////////////////////////
    // format the html page for /tabelle
    ////////////////////////////////////
  {
    ulReqcount++;
    unsigned long ulSizeList = MakeTable(&client, false); // get size of table first

    sResponse  = F("<html><head><title>WLAN Logger f&uuml;r Pufferspeichertemperatur</title></head><body>");
    sResponse += F("<font color=\"#000000\"><body bgcolor=\"#d0d0f0\">");
    sResponse += F("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">");
    sResponse += F("<h1>WLAN Logger f&uuml;r Pufferspeichertemperatur</h1>");
    sResponse += F("<FONT SIZE=+1>");
    sResponse += F("<a href=\"/\"><button>Startseite</button></a><BR><BR>Letzte Messungen im Abstand von ");
    sResponse += ulMeasDelta_ms;
    sResponse += F("ms<BR>");
    // here the big table will follow later - but let us prepare the end first

    // part 2 of response - after the big table
    sResponse2 = MakeHTTPFooter().c_str();

    // Send the response to the client - delete strings after use to keep mem low
    client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length() + ulSizeList).c_str());
    client.print(sResponse); sResponse = "";
    MakeTable(&client, true);
    client.print(sResponse2);
  }
  // Diagramm ////////////////////////////////
  else if (sPath == "/grafik")
    ///////////////////////////////////
    // format the html page for /grafik
    ///////////////////////////////////
  {
    ulReqcount++;
    unsigned long ulSizeList = MakeList(&client, false); // get size of list first

    sResponse  = F("<html>\n<head>\n<title>WLAN Logger f&uuml;r Pufferspeichertemperatur</title>\n<script type=\"text/javascript\" src=\"https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}\"></script>\n");
    sResponse += F("<script type=\"text/javascript\"> google.setOnLoadCallback(drawChart);\nfunction drawChart() {var data = google.visualization.arrayToDataTable([\n['Zeit / UTC', 'Temperatur1', 'Temperatur2', 'Temperatur3', 'Temperatur4'],\n");
    // here the big list will follow later - but let us prepare the end first

    // part 2 of response - after the big list
    sResponse2  = F("]);\nvar options = {title: 'Verlauf',\n");
    sResponse2 += F("curveType:'function',legend:{ position: 'bottom'}};");
    sResponse2 += F("var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));chart.draw(data, options);}\n</script>\n</head>\n");
    sResponse2 += F("<body>\n<font color=\"#000000\"><body bgcolor=\"#d0d0f0\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\"><h1>WLAN Logger f&uuml;r Pufferspeichertemperatur</h1><a href=\"/\"><button>Startseite</button></a><BR>");
    sResponse2 += F("<BR>\n<div id=\"curve_chart\" style=\"width: 600px; height: 400px\"></div>");
    sResponse2 += MakeHTTPFooter().c_str();

    // Send the response to the client - delete strings after use to keep mem low
    client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length() + ulSizeList).c_str());
    client.print(sResponse); sResponse = "";
    MakeList(&client, true);
    client.print(sResponse2);
  }
  // Einstellungen ////////////////////////////////
  else if (sPath == "/settings")
  {
    EEPROM.begin(512);
    delay(10);
    String apiKey = "";
    for (int i = 81; i < 100; i++)
    {
      //DEBUG_PRINT(i);
      apiKey += char(EEPROM.read(i));
    }
    EEPROM.end();
    Serial.println("Thinkspeak: " + apiKey);

    EEPROM.begin(512);
    delay(10);
    String zeit = "";
    for (int i = 100; i < 105; i++)
    {
      zeit += char(EEPROM.read(i));
    }
    EEPROM.end();
    Serial.print("Das ist die Zeitverschiebung: ");
    Serial.println(zeit);
    String zeittext = "";
    if (zeit != "0000")
    {
      zeittext = "Sommerzeit";
    }
    else
    {
      zeittext = "Winterzeit";
    }

    ulReqcount++;
    unsigned long ulSizeList = MakeTable(&client, false); // get size of table first

    sResponse  = F("<html><head><title>WLAN Logger f&uuml;r Pufferspeichertemperatur</title></head><body>");
    sResponse += F("<font color=\"#000000\"><body bgcolor=\"#d0d0f0\">");
    sResponse += F("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">");
    sResponse += F("<h1>WLAN Logger f&uuml;r Pufferspeichertemperatur</h1>");
    sResponse += F("<FONT SIZE=+1>");
    sResponse += F("<a href=\"/\"><button>Startseite</button></a><BR><BR>Thingspeak API ist momentan: ");
    sResponse += apiKey;
    sResponse += F("<BR><BR>Das ist die Zeitverschiebung: ");
    sResponse += zeittext;
    sResponse += F("<fieldset><legend>EEPROM Setting</legend>");
    sResponse += F("<p><a href=\"/reset\"><button>RESET</button></a>&nbsp;<a href=\"?pin=FUNCTION2ON\"><button>AUSLESEN</button></a></p>");
    sResponse += F("</fieldset>");
    sResponse += F("<fieldset><legend>Allgemein Setting</legend>");
    sResponse += F("<p>Zeitumstellung <a href=\"?pin=SOMMERZEIT\"><button>SOMMERZEIT</button></a>&nbsp;<a href=\"?pin=WINTERZEIT\"><button>WINTERZEIT</button></a></p>");
    sResponse += F("<form name=\"input\" action=\"\" method=\"get\">THINGSPEAK-API: <input type=\"text\" name=\"$\"><input type=\"submit\" value=\"Submit\"></form>");
    sResponse += F("</fieldset>");
    sResponse += F("<fieldset><legend>Temperatur kalibrieren</legend>");
    sResponse += F("<p><a href=\"/temp1\"><button>Speicher oben</button></a>&nbsp;<a href=\"/temp2\"><button>Speicher mitte</button></a>&nbsp;<a href=\"/temp3\"><button>Speicher unten</button></a>&nbsp;<a href=\"/temp4\"><button>Vorlauf</button></a></p>");
    sResponse += F("</fieldset>");

    sResponse2 = MakeHTTPFooter().c_str();

    // Send the response to the client
    client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length()).c_str());
    client.print(sResponse);
    client.print(sResponse2);
    delay(100);

    //////////////////////
    // react on parameters
    //////////////////////
    if (sCmd.length() > 0)
    {
      // write received command to html page
      sResponse += "Kommando:" + sCmd + "<BR>";

      // EEPROM RESET ////////////////////////////////
      if (sCmd.indexOf("FUNCTION1ON") >= 0)
      {
        EEPROM.begin(512);
        // write a 0 to all 512 bytes of the EEPROM
        for (int i = 0; i < 512; i++)
        {
          EEPROM.write(i, 0);

          EEPROM.end();
        }
      }
      // SHOW EEPROM ////////////////////////////////
      else if (sCmd.indexOf("FUNCTION2ON") >= 0)
      {
        EEPROM.begin(512);
        delay(10);
        String string3 = "";
        for (int i = 0; i < 150; i++)
        {
          //DEBUG_PRINT(i);
          string3 += char(EEPROM.read(i));
        }
        EEPROM.end();
        Serial.println(string3);
      }
      // SOMMERZEIT EINSTELLEN ////////////////////////////////
      else if (sCmd.indexOf("SOMMERZEIT") >= 0)
      {
        String sommer = "3600";
        Serial.print("Das wird gespeichert in der seite: ");
        Serial.println(sommer);
        EEPROM.begin(512);
        delay(10);
        int si = 0;
        for (int i = 100; i < 105; i++)
        {
          char c;
          if (si < sommer.length())
          {
            c = sommer[si];
          }
          else
          {
            c = 0;
          }

          EEPROM.write(i, c);
          si++;
        }
        EEPROM.end();
        Serial.println("Wrote " + sommer);
      }
      // WINTERZEIT EINSTELLEN ////////////////////////////////
      else if (sCmd.indexOf("WINTERZEIT") >= 0)
      {
        String winter = "0000";
        Serial.print("Das wird gespeichert in der seite: ");
        Serial.println(winter);
        EEPROM.begin(512);
        delay(10);
        int si = 0;
        for (int i = 100; i < 105; i++)
        {
          char c;
          if (si < winter.length())
          {
            c = winter[si];
          }
          else
          {
            c = 0;
          }
          EEPROM.write(i, c);
          si++;
        }
        EEPROM.end();
        Serial.println("Wrote " + winter);
      }
      // SET THINGSPEAK API ////////////////////////////////
      else
      {
        Serial.print("Das wird gespeichert in der seite: ");
        Serial.println(sCmd);
        EEPROM.begin(512);
        delay(10);
        int si = 0;
        for (int i = 81; i < 100; i++)
        {
          char c;
          if (si < sCmd.length())
          {
            c = sCmd[si];
            //DEBUG_PRINT("Wrote: ");
            //DEBUG_PRINT(c);
          }
          else
          {
            c = 0;
          }
          EEPROM.write(i, c);
          si++;
        }
        EEPROM.end();
        Serial.println("Wrote " + sCmd);
      }
    }
  }

  // Kalibrieren Temperatur 1 ////////////////////////////////
  else if (sPath == "/temp1")
    ////////////////////////////////////
    // format the html page for /tabelle
    ////////////////////////////////////
  {
    EEPROM.begin(512);
    delay(10);
    String temp1k = "";
    for (int i = 110; i < 115; i++)
    {
      temp1k += char(EEPROM.read(i));
    }
    EEPROM.end();
    Serial.print("Das ist die Zeitverschiebung: ");
    Serial.println(temp1k);
    // settings();
    ulReqcount++;
    unsigned long ulSizeList = MakeTable(&client, false); // get size of table first

    sResponse  = F("<html><head><title>WLAN Logger f&uuml;r Pufferspeichertemperatur</title></head><body>");
    sResponse += F("<font color=\"#000000\"><body bgcolor=\"#d0d0f0\">");
    sResponse += F("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">");
    sResponse += F("<h1>WLAN Logger f&uuml;r Pufferspeichertemperatur</h1>");
    sResponse += F("<FONT SIZE=+1>");
    sResponse += F("<a href=\"/\"><button>Startseite</button></a><BR><BR>Speicher oben: ");
    sResponse += temp1k;
    sResponse += F("Grad C<BR>");
    sResponse += F("<form name=\"input\" action=\"\" method=\"get\">Speicher oben: <input type=\"text\" name=\"$\"><input type=\"submit\" value=\"Submit\"></form>");
    sResponse += F("<p>Temperatur kalibrieren: <a href=\"/temp1\"><button>Speicher oben</button></a>&nbsp;<a href=\"/temp2\"><button>Speicher mitte</button></a>&nbsp;<a href=\"/temp3\"><button>Speicher unten</button></a>&nbsp;<a href=\"/temp4\"><button>Vorlauf</button></a>&nbsp;</p>");

    sResponse2 = MakeHTTPFooter().c_str();

    // Send the response to the client
    client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length()).c_str());
    client.print(sResponse);
    client.print(sResponse2);
    delay(100);

    //////////////////////
    // react on parameters
    //////////////////////
    if (sCmd.length() > 0)
    {
      // write received command to html page
      sResponse += "Kommando:" + sCmd + "<BR>";
      // SET THINGSPEAK API ////////////////////////////////

      if (sCmd.toInt() != 0)
      {

        Serial.print("Das wird gespeichert in der seite: ");
        Serial.println(sCmd);
        EEPROM.begin(512);
        delay(10);
        int si = 0;
        for (int i = 110; i < 115; i++)
        {
          char c;
          if (si < sCmd.length())
          {
            c = sCmd[si];
            //DEBUG_PRINT("Wrote: ");
            //DEBUG_PRINT(c);
          }
          else
          {
            c = 0;
          }
          EEPROM.write(i, c);
          si++;
        }
        EEPROM.end();
        Serial.println("Wrote " + sCmd);
      }
      else
      {
        Serial.println("Der Wert " + sCmd + " war keine Zahl!!!");
      }

    }
  }
  // Kalibrieren Temperatur 2 ////////////////////////////////
  else if (sPath == "/temp2")
    ////////////////////////////////////
    // format the html page for /tabelle
    ////////////////////////////////////
  {
    EEPROM.begin(512);
    delay(10);
    String temp2k = "";
    for (int i = 115; i < 120; i++)
    {
      temp2k += char(EEPROM.read(i));
    }
    EEPROM.end();
    Serial.print("Das ist die Zeitverschiebung: ");
    Serial.println(temp2k);
    // settings();
    ulReqcount++;
    unsigned long ulSizeList = MakeTable(&client, false); // get size of table first

    sResponse  = F("<html><head><title>WLAN Logger f&uuml;r Pufferspeichertemperatur</title></head><body>");
    sResponse += F("<font color=\"#000000\"><body bgcolor=\"#d0d0f0\">");
    sResponse += F("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">");
    sResponse += F("<h1>WLAN Logger f&uuml;r Pufferspeichertemperatur</h1>");
    sResponse += F("<FONT SIZE=+1>");
    sResponse += F("<a href=\"/\"><button>Startseite</button></a><BR><BR>Speicher mitte: ");
    sResponse += temp2k;
    sResponse += F("Grad C<BR>");
    sResponse += F("<form name=\"input\" action=\"\" method=\"get\">Speicher mitte: <input type=\"text\" name=\"$\"><input type=\"submit\" value=\"Submit\"></form>");
    sResponse += F("<p>Temperatur kalibrieren: <a href=\"/temp1\"><button>Speicher oben</button></a>&nbsp;<a href=\"/temp2\"><button>Speicher mitte</button></a>&nbsp;<a href=\"/temp3\"><button>Speicher unten</button></a>&nbsp;<a href=\"/temp4\"><button>Vorlauf</button></a>&nbsp;</p>");

    sResponse2 = MakeHTTPFooter().c_str();

    // Send the response to the client
    client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length()).c_str());
    client.print(sResponse);
    client.print(sResponse2);
    delay(100);

    //////////////////////
    // react on parameters
    //////////////////////
    if (sCmd.length() > 0)
    {
      // write received command to html page
      sResponse += "Kommando:" + sCmd + "<BR>";
      // SET THINGSPEAK API ////////////////////////////////


      if (sCmd.toInt() != 0)
      {

        Serial.print("Das wird gespeichert in der seite: ");
        Serial.println(sCmd);
        EEPROM.begin(512);
        delay(10);
        int si = 0;
        for (int i = 115; i < 120; i++)
        {
          char c;
          if (si < sCmd.length())
          {
            c = sCmd[si];
            //DEBUG_PRINT("Wrote: ");
            //DEBUG_PRINT(c);
          }
          else
          {
            c = 0;
          }
          EEPROM.write(i, c);
          si++;
        }
        EEPROM.end();
        Serial.println("Wrote " + sCmd);
      }
      else
      {
        Serial.println("Der Wert " + sCmd + " war keine Zahl!!!");
      }

    }
  }
  // Kalibrieren Temperatur 3 ////////////////////////////////
  else if (sPath == "/temp3")
    ////////////////////////////////////
    // format the html page for /tabelle
    ////////////////////////////////////
  {
    EEPROM.begin(512);
    delay(10);
    String temp3k = "";
    for (int i = 120; i < 125; i++)
    {
      temp3k += char(EEPROM.read(i));
    }
    EEPROM.end();
    Serial.print("Das ist der aktuelle Korrekturwert: ");
    Serial.println(temp3k);
    // settings();
    ulReqcount++;
    unsigned long ulSizeList = MakeTable(&client, false); // get size of table first

    sResponse  = F("<html><head><title>WLAN Logger f&uuml;r Pufferspeichertemperatur</title></head><body>");
    sResponse += F("<font color=\"#000000\"><body bgcolor=\"#d0d0f0\">");
    sResponse += F("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">");
    sResponse += F("<h1>WLAN Logger f&uuml;r Pufferspeichertemperatur</h1>");
    sResponse += F("<FONT SIZE=+1>");
    sResponse += F("<a href=\"/\"><button>Startseite</button></a><BR><BR>Speicher unten ");
    sResponse += temp3k;
    sResponse += F("Grad C<BR>");
    sResponse += F("<form name=\"input\" action=\"\" method=\"get\">Speicher unten: <input type=\"text\" name=\"$\"><input type=\"submit\" value=\"Submit\"></form>");
    sResponse += F("<p>Temperatur kalibrieren: <a href=\"/temp1\"><button>Speicher oben</button></a>&nbsp;<a href=\"/temp2\"><button>Speicher mitte</button></a>&nbsp;<a href=\"/temp3\"><button>Speicher unten</button></a>&nbsp;<a href=\"/temp4\"><button>Vorlauf</button></a>&nbsp;</p>");

    sResponse2 = MakeHTTPFooter().c_str();

    // Send the response to the client
    client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length()).c_str());
    client.print(sResponse);
    client.print(sResponse2);
    delay(100);

    //////////////////////
    // react on parameters
    //////////////////////
    if (sCmd.length() > 0)
    {
      // write received command to html page
      sResponse += "Kommando:" + sCmd + "<BR>";
      // SET THINGSPEAK API ////////////////////////////////
      if (sCmd.toInt() != 0)
      {

        Serial.print("Das wird gespeichert in der seite: ");
        Serial.println(sCmd);
        EEPROM.begin(512);
        delay(10);
        int si = 0;
        for (int i = 120; i < 125; i++)
        {
          char c;
          if (si < sCmd.length())
          {
            c = sCmd[si];
            //DEBUG_PRINT("Wrote: ");
            //DEBUG_PRINT(c);
          }
          else
          {
            c = 0;
          }
          EEPROM.write(i, c);
          si++;
        }
        EEPROM.end();
        Serial.println("Wrote " + sCmd);
      }
      else
      {
        Serial.println("Der Wert " + sCmd + " war keine Zahl!!!");
      }
    }
  }
  // Kalibrieren Temperatur 4 ////////////////////////////////
  else if (sPath == "/temp4")
    ////////////////////////////////////
    // format the html page for /tabelle
    ////////////////////////////////////
  {
    EEPROM.begin(512);
    delay(10);
    String temp4k = "";
    for (int i = 125; i < 130; i++)
    {
      temp4k += char(EEPROM.read(i));
    }
    EEPROM.end();
    Serial.print("Das ist die Zeitverschiebung: ");
    Serial.println(temp4k);
    // settings();
    ulReqcount++;
    unsigned long ulSizeList = MakeTable(&client, false); // get size of table first

    sResponse  = F("<html><head><title>WLAN Logger f&uuml;r Pufferspeichertemperatur</title></head><body>");
    sResponse += F("<font color=\"#000000\"><body bgcolor=\"#d0d0f0\">");
    sResponse += F("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">");
    sResponse += F("<h1>WLAN Logger f&uuml;r Pufferspeichertemperatur</h1>");
    sResponse += F("<FONT SIZE=+1>");
    sResponse += F("<a href=\"/\"><button>Startseite</button></a><BR><BR>Anpassung Vorlauf: ");
    sResponse += temp4k;
    sResponse += F("Grad C<BR>");
    sResponse += F("<form name=\"input\" action=\"\" method=\"get\">Vorlauf: <input type=\"text\" name=\"$\"><input type=\"submit\" value=\"Submit\"></form>");
    sResponse += F("<p>Temperatur kalibrieren: <a href=\"/temp1\"><button>Speicher oben</button></a>&nbsp;<a href=\"/temp2\"><button>Speicher mitte</button></a>&nbsp;<a href=\"/temp3\"><button>Speicher unten</button></a>&nbsp;<a href=\"/temp4\"><button>Vorlauf</button></a>&nbsp;</p>");

    sResponse2 = MakeHTTPFooter().c_str();

    // Send the response to the client
    client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length()).c_str());
    client.print(sResponse);
    client.print(sResponse2);
    delay(100);

    //////////////////////
    // react on parameters
    //////////////////////
    if (sCmd.length() > 0)
    {
      // write received command to html page
      sResponse += "Kommando:" + sCmd + "<BR>";
      // SET THINGSPEAK API ////////////////////////////////


      if (sCmd.toInt() != 0)
      {

        Serial.print("Das wird gespeichert in der seite: ");
        Serial.println(sCmd);
        EEPROM.begin(512);
        delay(10);
        int si = 0;
        for (int i = 125; i < 130; i++)
        {
          char c;
          if (si < sCmd.length())
          {
            c = sCmd[si];
            //DEBUG_PRINT("Wrote: ");
            //DEBUG_PRINT(c);
          }
          else
          {
            c = 0;
          }
          EEPROM.write(i, c);
          si++;
        }
        EEPROM.end();
        Serial.println("Wrote " + sCmd);
      }
      else
      {
        Serial.println("Der Wert " + sCmd + " war keine Zahl!!!");
      }

    }
  }



  // Send the response to the client
  client.print(sHeader);
  client.print(sResponse);

  // and stop the client
  client.stop();
  Serial.println("Client disconnected");

}
Esempio n. 19
0
void PecoApp::DoIt() {

	if (NothingToDo()) return;
	
	FileListItem	*ListItem;
	
	BAlert	*myAlert	= new BAlert(NULL, MESSAGE_REALLY_DOIT, STR_CONTINUE, STR_CANCEL);
	if (myAlert->Go() == 1) return;
		for (int32 i = 0; (ListItem = (FileListItem *)fListView->ItemAt(i)) != NULL; i++ ) {
		if (ListItem->fErrorStatus == 1 ) {
			BAlert	*myAlert	= new BAlert(NULL, MESSAGE_WILL_HAVE_PROBS, STR_CONTINUE, STR_CANCEL);
			if (myAlert->Go() == 1) return;
			break;
		}
	}

	bool 	noerror = true, nomoreerrors=false, canceled=false;

	fWindow->Lock();
	fStatusBar->SetText(STATUS_RENAMING);
	fStatusBar->SetMaxValue(fList->CountItems());

	BButton		*okButton = (BButton *)fWindow->FindView("DoIt");
	okButton->SetEnabled(false);
	
	BTextControl* 	pfadView = (BTextControl *)fWindow->FindView("pfadView");
	BString	Pfad(pfadView->Text());
	fWindow->Unlock();
	
	BString	AlterName, NeuerName;
	BEntry	Datei;
	
	for (int32 i = 0; (ListItem = (FileListItem *)fListView->ItemAt(i)) != NULL; i++ ) {
		fWindow->Lock();
		fStatusBar->Update(1);
		fWindow->Unlock();
		if (canceled) { ListItem->fErrorStatus=0; continue; }
		if (ListItem->fNewName.String() != "" ) {
			AlterName = Pfad; AlterName.Append("/").Append(ListItem->fName);
			NeuerName = Pfad; NeuerName.Append("/").Append(ListItem->fNewName);
			Datei.SetTo(AlterName.String());
			if ( Datei.Rename(NeuerName.String()) != B_OK ) {
				ListItem->fErrorStatus=1;
				fWindow->Lock();
				fListView->InvalidateItem(i);
				fWindow->Unlock();

				if (!nomoreerrors) {
					noerror = false;

					BString		ErrorMessage(MESSAGE_HAVE_PROBLEM);
					ErrorMessage.ReplaceFirst("%1", ListItem->fName.String());
					ErrorMessage.ReplaceFirst("%2", ListItem->fNewName.String());
					
					BAlert	*myAlert	= new BAlert(NULL, ErrorMessage.String(), STR_CANCEL, STR_CONTINUE, STR_CONTINUE_WO_MSG, B_WIDTH_AS_USUAL, B_WARNING_ALERT);

					int32	result = myAlert->Go();
					if (result == 0) { canceled = true; continue; }
					if (result == 2) nomoreerrors = true;
				}
				
			} else {
			
				fWindow->Lock();
				ListItem->SetName(ListItem->fNewName);
				ListItem->SetNewName("");
				fListView->InvalidateItem(i);
				fWindow->Unlock();

			}
		}
	}

//	NoRenamer();

	fWindow->Lock();
	fStatusBar->Reset(STATUS_STATUS);
	fWindow->Unlock();

	if (noerror) MakeList();
	else {
		fStatusBar->SetText(STATUS_DIDIT_BAD);

		BAlert	*myAlert	= new BAlert(NULL, MESSAGE_MARKED_FILES, STR_OK);
		myAlert->Go();
	}
	
}
Esempio n. 20
0
void CLayerManager::ConnectLayers(char *pcList) //각 계층들을 연결 하기 위한 함수를 호출하는 함수
{
   MakeList( pcList ) ;
   LinkLayer( mp_sListHead ) ;
}
Esempio n. 21
0
STATIC RET_T resolve( TARGET *targ, DEPEND *depend )
/***************************************************
 * If there are no dependents, then perform the associated commands, if req'd.
 * If there are dependents: update them all; compare the date of each dep
 * to the targ; if any of the deps had an error previously, abort; if targ
 * is out of date then perform the clist (or attempt to imply).
 */
{
    TLIST       *tlist;
    RET_T       tmp;
    bool        outofdate;
    bool        exec_cmds;
    time_t      max_time;

    max_time = OLDEST_DATE;

    ExpandWildCards( targ, depend );

    if( depend->targs == NULL ) {
        /* make the target if it doesn't exist or it's symbolic */
        /* a "::" target with no dependents must be made */
        exec_cmds = false;
        if( !targ->scolon || !targ->existing ) {
            exec_cmds = true;
        }
        if( targ->attr.symbolic || targ->attr.always ) {
            exec_cmds = true;
        }
        /* if all targets must be made, so should this one */
        if( Glob.all ) {
            exec_cmds = true;
        }
        if( !exec_cmds && USE_AUTO_DEP( targ ) ) {
            if( autoOutOfDate( targ, &max_time ) ) {
                exec_cmds = true;
            }
        }
        if( exec_cmds ) {
            return( perform( targ, depend, NULL, max_time ) );
        }
        return( RET_SUCCESS );
    }

    MakeList( depend->targs );

    getDate( targ );

    /* check if out of date with deps */
    outofdate = false;
    for( tlist = depend->targs; tlist != NULL; tlist = tlist->next ) {
        if( isOutOfDate( targ, tlist->target, &outofdate ) == RET_ERROR ) {
            return( RET_ERROR );
        }
    }
    if( targ->attr.always ) {
        outofdate = true;
    }
    if( !outofdate && USE_AUTO_DEP( targ ) ) {
        if( autoOutOfDate( targ, &max_time ) ) {
            outofdate = true;
        }
    }
    if( outofdate ) {
        /* if we get this far, then none of the deps had a previous error,
         * and at least one of the deps is newer than targ, so we perform
         */
        if( depend->clist != NULL ) {
            return( perform( targ, depend, NULL, max_time ) );
        } else {
            tmp = tryImply( targ, true );
            if( tmp == RET_WARN ) {
                /* couldn't imply - will do DEFAULT cmds */
                return( perform( targ, depend, NULL, max_time ) );
            }
            return( tmp );
        }
    }

    return( RET_SUCCESS );
}
Esempio n. 22
0
void PecoApp::RefsReceived ( BMessage* msg ) {

	entry_ref	ref;
	BPath		aPath;
	BEntry		aEntry;
	off_t		size;
	time_t		timer;
	
	fWindow->Lock();
	BTextControl* 	pfadView 	= (BTextControl *)fWindow->FindView("pfadView");
	fWindow->Unlock();
	
	//Pfad finden
	for ( int i=0; msg->FindRef("refs", i, &ref) == B_OK; i++ ) if ( ref.device > 1 ) break;
	
	if ( ref.device > 1 ) {
		New();

		fWindow->Lock();
		((PecoApp *)be_app)->fStatusBar->SetText(STATUS_IMPORT);
		fWindow->Unlock();
	
		aEntry = BEntry(&ref);
		BPath( &aEntry ).GetParent(&fPfad);
				
		fWindow->Lock();
		pfadView->SetText( fPfad.Path() );
		fWindow->Unlock();
		
		//zählen
		type_code	typeFound;
		long		total = 0;
		msg->GetInfo("refs", &typeFound, &total);
		
		fWindow->Lock();
		fStatusBar->SetMaxValue( total );
		fWindow->Unlock();
		
		BPath	newPath;
		
		bool	didntshow_msgmultidir = true;
		
		for ( int i=0; msg->FindRef("refs", i, &ref) == B_OK; i++ ) {
			
			fWindow->Lock();
			fStatusBar->Update(1);
			fWindow->Unlock();
			
			// Laufwerke ausfiltern
			if ( ref.device == 1 ) continue;
 			
			// Dateien mit falschem Pfad ausfiltern
			aEntry = BEntry(&ref);
			aPath = BPath(&aEntry);
			
			BPath( &aEntry ).GetParent(&newPath);
			
			if ( (strcmp( fPfad.Path(), newPath.Path() ) != 0 ) ) {
				if ( didntshow_msgmultidir ) {
					BAlert*	myAlert = new BAlert(NULL, MESSAGE_MULTIDIR, STR_OK);
					myAlert->Go();
					didntshow_msgmultidir = false;
				}
				continue;
			}
			
			// Werte auslesen
			if (aEntry.IsFile()) aEntry.GetSize(&size); 
			else
				if (aEntry.IsSymLink()) size = -1;
				else
					if (aEntry.IsDirectory()) size = -2;
					else continue;
			
			aEntry.GetModificationTime(&timer);
			
			fList->AddItem(new FileListItem(aPath.Leaf(), size, timer, &ref));
			
		}
		
		fWindow->Lock();
		fListView->AddList(fList);
		float Hoehe = be_plain_font->Size() + 2;
		if (Hoehe < 18) {
			BListItem*	myListItem;
			for (int i=0; (myListItem = fListView->ItemAt(i)); i++) myListItem->SetHeight(18);
			// Zum Updaten:
			fListView->AddItem(myListItem = new BStringItem(""));
			fListView->RemoveItem(myListItem);
		}
		fStatusBar->Reset(STATUS_STATUS);
		fStatusBar->SetMaxValue(fList->CountItems());
		fWindow->Unlock();
		
		MakeList();
	}
	fWindow->Activate();
	UpdateWindowStatus();
}