Exemplo n.º 1
0
void nsCSSScanner::OutputError()
{
  if (mError.IsEmpty()) return;
 
#ifdef DEBUG
  fprintf(stderr, "CSS Error (%s :%u.%u): %s\n",
                  mFileName.get(), mErrorLineNumber, mErrorColNumber,
                  NS_ConvertUCS2toUTF8(mError).get());
#endif

  // Log it to the Error console

  if (InitGlobals() && gReportErrors) {
    nsresult rv;
    nsCOMPtr<nsIScriptError> errorObject =
      do_CreateInstance(gScriptErrorFactory, &rv);
    if (NS_SUCCEEDED(rv)) {
      rv = errorObject->Init(mError.get(),
                             NS_ConvertASCIItoUCS2(mFileName.get()).get(),
                             EmptyString().get(),
                             mErrorLineNumber,
                             mErrorColNumber,
                             nsIScriptError::warningFlag,
                             "CSS Parser");
      if (NS_SUCCEEDED(rv))
        gConsoleService->LogMessage(errorObject);
    }
  }
  ClearError();
}
Exemplo n.º 2
0
/* EXPORT-> MakeXGraf: Create and open window, initialization */
void MakeXGraf(char *wname, int x, int y, int w, int h, int bw)
     /* WIN32: bw is ignored. */
{
   WNDCLASS WindowClass;
   char sbuf[256], *hgraf = "HGraf";
   HDC dc;
     
   if (winCreated)
      HError(6870, "MakeXGraf: Attempt to recreate the graphics window");
     
   WindowClass.hInstance = GetModuleHandle(NULL);
   WindowClass.lpszClassName = hgraf;
   WindowClass.lpfnWndProc = HGWinFunc;
   WindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
   WindowClass.hIcon = NULL;
   WindowClass.hCursor = LoadCursor(NULL,IDC_ARROW);
   WindowClass.lpszMenuName = NULL;
   WindowClass.cbClsExtra = 0;
   WindowClass.cbWndExtra = 0;
   WindowClass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
     
   RegisterClass(&WindowClass);
     
   strcpy(sbuf, hgraf);  strcat(sbuf, ": ");  strcat(sbuf, wname);
     
   theWindow = 
      CreateWindow(hgraf, sbuf, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                   x,y, w,h, HWND_DESKTOP, NULL,
                   WindowClass.hInstance,       NULL);
     
   /* adjust window size so that the client rectangle is the size requested */
   /* by the caller of MakeXGraf() --- Win32 interprets w and h as the dimensions */
   /* of the overall window. */
   GetClientRect(theWindow,&ClientRect);
   MoveWindow(theWindow,x,y,w+w-ClientRect.right,h+h-ClientRect.bottom,TRUE); 
   GetClientRect(theWindow,&ClientRect);
     
   /* Obtain and initialize device contexts */
   dc = GetDC(theWindow);
   memDC = CreateCompatibleDC(dc);
   SetArcDirection(memDC,AD_COUNTERCLOCKWISE);
   SetArcDirection(dc,AD_COUNTERCLOCKWISE);
   SetPolyFillMode(memDC,WINDING);
   SetPolyFillMode(memDC,WINDING);
   SetTextAlign(memDC,TA_BASELINE | TA_LEFT);
   SetTextAlign(dc,TA_BASELINE | TA_LEFT);
   SetBkMode(memDC,TRANSPARENT);
   SetBkMode(dc,TRANSPARENT);
   theBitmap = CreateCompatibleBitmap(dc,w,h);
   SelectObject(memDC,theBitmap);
   ReleaseDC(theWindow,dc);
   CreateHeap(&btnHeap, "Button heap", MHEAP, sizeof(HButton), 1.0, 100, 100);
     
   InitGlobals();
   InstallColours();
     
   winCreated = TRUE;
   HSetColour(WHITE);
   HFillRectangle(0,0,ClientRect.right,ClientRect.bottom);
}
Exemplo n.º 3
0
/*
  Checks for commandline args, intializes globals, then  begins code download.
*/
int main(int argc, char **argv) {

   nf2.device_name = DEFAULT_IFACE;

   processArgs(argc, argv);

   if (check_iface(&nf2))
   {
	   exit(1);
   }
   if (openDescriptor(&nf2))
   {
      exit(1);
   }

   if (strncmp(log_file_name, "stdout",6)) {

      if ((log_file = fopen(log_file_name, "w")) == NULL) {
	 printf("Error: unable to open logfile %s for writing.\n",
		log_file_name);
	 exit(1);
      }
   }
   else
      log_file = stdout;

   InitGlobals();

   BeginCodeDownload(bin_file_name);

   if (!cpci_reprog)
      ResetDevice();

   /* reset the PHYs */
   NF2_WR32(MDIO_0_CONTROL_REG, 0x8000);
   NF2_WR32(MDIO_1_CONTROL_REG, 0x8000);
   NF2_WR32(MDIO_2_CONTROL_REG, 0x8000);
   NF2_WR32(MDIO_3_CONTROL_REG, 0x8000);

   /* wait until the resets have been completed */
   usleep(100);

   if (intr_enable)
   {
      /* PHY interrupt mask off for link status change */
      NF2_WR32(MDIO_0_INTERRUPT_MASK_REG, 0xfffd);
      NF2_WR32(MDIO_1_INTERRUPT_MASK_REG, 0xfffd);
      NF2_WR32(MDIO_2_INTERRUPT_MASK_REG, 0xfffd);
      NF2_WR32(MDIO_3_INTERRUPT_MASK_REG, 0xfffd);
   }

   VerifyDevInfo();

   fclose(log_file);

   closeDescriptor(&nf2);

   return SUCCESS;
}
Exemplo n.º 4
0
PRInt32
nsMathMLOperators::CountStretchyOperator()
{
  if (!gInitialized) {
    InitGlobals();
  }
  return (gStretchyOperatorArray) ? gStretchyOperatorArray->Length() : 0;
}
Exemplo n.º 5
0
static Err AppStart(UInt16 cmd, void *cmdPBP)
{
    DisplayInitDepth(true);
    
    InitGlobals();
    
    FrmGotoForm(kMainForm);
    return errNone;
}
Exemplo n.º 6
0
LOCAL_C void RunTestsL()
/**
 * Run all the tests
 */
    {
    InitGlobals();
	AutoTestExecute();
    DestroyGlobals();
    }
Exemplo n.º 7
0
ECode CWallpaperManager::constructor(
    /* [in] */ IContext *context,
    /* [in] */ IHandler *handler)
{
    mContext = context;
    AutoPtr<ILooper> looper;
    FAIL_RETURN(context->GetMainLooper((ILooper**)&looper));
    InitGlobals(looper);
    return NOERROR;
}
Exemplo n.º 8
0
int LoadSendRecvMessageModule(void)
{
	if (LoadLibraryA("Msftedit.dll") == NULL) {
		if (IDYES != MessageBox(0, TranslateTS(tszError), TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION))
			return 1;
		return 0;
	}

	InitGlobals();
	RichUtil_Load();
	InitOptions();

	HookEvent(ME_DB_EVENT_ADDED, MessageEventAdded);
	HookEvent(ME_DB_CONTACT_SETTINGCHANGED, MessageSettingChanged);
	HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted);
	HookEvent(ME_SYSTEM_MODULESLOADED, SplitmsgModulesLoaded);
	HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
	HookEvent(ME_PROTO_CONTACTISTYPING, TypingMessage);
	HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownSendRecv);
	HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);

	CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand);
	CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommand_W);
	CreateServiceFunction(MS_MSG_GETWINDOWAPI, GetWindowAPI);
	CreateServiceFunction(MS_MSG_GETWINDOWCLASS, GetWindowClass);
	CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData);
	CreateServiceFunction(MS_MSG_SETSTATUSTEXT, SetStatusText);
	CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);

	hHookWinEvt = CreateHookableEvent(ME_MSG_WINDOWEVENT);
	hHookWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
	hHookWinWrite = CreateHookableEvent(ME_MSG_PRECREATEEVENT);

	SkinAddNewSoundEx("RecvMsgActive", LPGEN("Instant messages"), LPGEN("Incoming (focused window)"));
	SkinAddNewSoundEx("RecvMsgInactive", LPGEN("Instant messages"), LPGEN("Incoming (unfocused window)"));
	SkinAddNewSoundEx("AlertMsg", LPGEN("Instant messages"), LPGEN("Incoming (new session)"));
	SkinAddNewSoundEx("SendMsg", LPGEN("Instant messages"), LPGEN("Outgoing"));
	SkinAddNewSoundEx("SendError", LPGEN("Instant messages"), LPGEN("Message send error"));
	SkinAddNewSoundEx("TNStart", LPGEN("Instant messages"), LPGEN("Contact started typing"));
	SkinAddNewSoundEx("TNStop", LPGEN("Instant messages"), LPGEN("Contact stopped typing"));

	hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
	hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE);
	hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND);
	if (hCurHyperlinkHand == NULL)
		hCurHyperlinkHand = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND));

	InitStatusIcons();
	return 0;
}
Exemplo n.º 9
0
void
nsMathMLOperators::LookupOperators(const nsString&       aOperator,
                                   nsOperatorFlags*      aFlags,
                                   float*                aLeftSpace,
                                   float*                aRightSpace)
{
  if (!gInitialized) {
    InitGlobals();
  }

  aFlags[NS_MATHML_OPERATOR_FORM_INFIX] = 0;
  aLeftSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;
  aRightSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;

  aFlags[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0;
  aLeftSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;
  aRightSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;

  aFlags[NS_MATHML_OPERATOR_FORM_PREFIX] = 0;
  aLeftSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = 0.0f;
  aRightSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = 0.0f;

  if (gOperatorTable) {
    // a lookup with form=0 will put all the variants in gOperatorFound[]
    float dummy;
    nsOperatorFlags flags = 0;
    LookupOperator(aOperator, /*form=*/0, &flags, &dummy, &dummy);
    // if the operator was found, gOperatorFound contains all its variants
    OperatorData* found;
    found = gOperatorFound[NS_MATHML_OPERATOR_FORM_INFIX];
    if (found) {
      aFlags[NS_MATHML_OPERATOR_FORM_INFIX] = found->mFlags;
      aLeftSpace[NS_MATHML_OPERATOR_FORM_INFIX] = found->mLeftSpace;
      aRightSpace[NS_MATHML_OPERATOR_FORM_INFIX] = found->mRightSpace;
    }
    found = gOperatorFound[NS_MATHML_OPERATOR_FORM_POSTFIX];
    if (found) {
      aFlags[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mFlags;
      aLeftSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mLeftSpace;
      aRightSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mRightSpace;
    }
    found = gOperatorFound[NS_MATHML_OPERATOR_FORM_PREFIX];
    if (found) {
      aFlags[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mFlags;
      aLeftSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mLeftSpace;
      aRightSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mRightSpace;
    }
  }
}
Exemplo n.º 10
0
App::App(void)
	:
	BApplication(APP_SIGNATURE),
	fBuildCleanMode(false),
	fBuilder(NULL)
{
	InitFileTypes();
	InitGlobals();
	EnsureTemplates();
	
	gProjectList = new LockableList<Project>(20,true);
	gProjectWindowPoint.Set(5,24);
	
	fOpenPanel = NULL;
}
Exemplo n.º 11
0
int main(int argc, char** argv) {
    WORD KeyVal;
    char ResString[10];
    
    void Ludacris_Speed_GO(void);
    Ludacris_Speed_GO();
    InitGlobals();
    InitLCD();
    
    Timer1_Setup();

    UART1_Config();
    Pin_Setup();
    printf("\nUART Configured\n\n");

    while(1)
    {
        __delay_ms(250);
        PutsXLCD("No Workie!  ");
        if(!Calculate)
        {
          if(TriggerGetKeys)
            {
                KeyVal = GetKeyPressed();
                FindKey(KeyVal);
                if(Key != NULL)
                {
                    ParseInput(Key);
                }
            TriggerGetKeys = 0;
            }
        }
        else
        {
            DoCalculate();
            printf("%f\n", Terms.Result);
            sprintf(ResString, "%f", Terms.Result);
            PutsXLCD(ResString);
            TriggerGetKeys = 0;
            Calculate = 0;
            GotOperand1 = 0;
            GotOperand2 = 0;
            Operation = NO_OP;
        }
    }

    return (EXIT_SUCCESS);
}
Exemplo n.º 12
0
PRInt32
nsMathMLOperators::FindStretchyOperator(PRUnichar aOperator)
{
  if (!gInitialized) {
    InitGlobals();
  }
  if (gStretchyOperatorArray) {
    for (PRUint32 k = 0; k < gStretchyOperatorArray->Length(); k++) {
      OperatorData* data = gStretchyOperatorArray->ElementAt(k);
      if (data && (aOperator == data->mStr[0])) {
        return k;
      }
    }
  }
  return kNotFound;
}
Exemplo n.º 13
0
Arquivo: luaex.cpp Projeto: tetl/LuaEx
bool LuaEx::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
{
	PLUGIN_SAVEVARS();

	InitGlobals(error, maxlen);
	InitHooks();


	for (auto i = ScriptExtensions().begin(); i != ScriptExtensions().end(); ++i)
	{
		(*i)->Init();
	}


	return true;
}
Exemplo n.º 14
0
int LoadSendRecvMessageModule(void)
{
	if (LoadLibraryA("riched20.dll") == NULL) {
		if (IDYES !=
			MessageBoxA(0,
						Translate
						("Miranda could not load the built-in message module, riched20.dll is missing. If you are using Windows 95 or WINE please make sure you have riched20.dll installed. Press 'Yes' to continue loading Miranda."),
						Translate("Information"), MB_YESNO | MB_ICONINFORMATION))
			return 1;
		return 0;
	}
	hDLL = LoadLibraryA("user32");
	pSetLayeredWindowAttributes = (PSLWA) GetProcAddress(hDLL,"SetLayeredWindowAttributes");
	InitGlobals();
	RichUtil_Load();
	OleInitialize(NULL);
	InitREOleCallback();
	InitOptions();
	hEventDbEventAdded = HookEvent(ME_DB_EVENT_ADDED, MessageEventAdded);
	hEventDbSettingChange = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, MessageSettingChanged);
	hEventContactDeleted = HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted);
	HookEvent(ME_SYSTEM_MODULESLOADED, SplitmsgModulesLoaded);
	HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
	HookEvent(ME_PROTO_CONTACTISTYPING, TypingMessage);
	HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownSendRecv);
	CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand);
#if defined(_UNICODE)
	CreateServiceFunction(MS_MSG_SENDMESSAGE "W", SendMessageCommand);
#endif
	CreateServiceFunction(MS_MSG_GETWINDOWAPI, GetWindowAPI);
	CreateServiceFunction(MS_MSG_GETWINDOWCLASS, GetWindowClass);
	CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData);
	CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);
	CreateServiceFunction("SRMsg/TypingMessage", TypingMessageCommand);
	hHookWinEvt=CreateHookableEvent(ME_MSG_WINDOWEVENT);
	SkinAddNewSoundEx("RecvMsgActive", Translate("Messages"), Translate("Incoming (Focused Window)"));
	SkinAddNewSoundEx("RecvMsgInactive", Translate("Messages"), Translate("Incoming (Unfocused Window)"));
	SkinAddNewSoundEx("AlertMsg", Translate("Messages"), Translate("Incoming (New Session)"));
	SkinAddNewSoundEx("SendMsg", Translate("Messages"), Translate("Outgoing"));
	hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
	hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE);
	hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND);
	if (hCurHyperlinkHand == NULL)
		hCurHyperlinkHand = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND));
	hDragCursor = LoadCursor(g_hInst,  MAKEINTRESOURCE(IDC_DRAGCURSOR));
	return 0;
}
Exemplo n.º 15
0
bool
nsMathMLOperators::LookupOperator(const nsString&       aOperator,
                                  const nsOperatorFlags aForm,
                                  nsOperatorFlags*      aFlags,
                                  float*                aLeadingSpace,
                                  float*                aTrailingSpace)
{
  if (!gGlobalsInitialized) {
    InitGlobals();
  }
  if (gOperatorTable) {
    NS_ASSERTION(aFlags && aLeadingSpace && aTrailingSpace, "bad usage");
    NS_ASSERTION(aForm > 0 && aForm < 4, "*** invalid call ***");

    // The MathML REC says:
    // If the operator does not occur in the dictionary with the specified form,
    // the renderer should use one of the forms which is available there, in the
    // order of preference: infix, postfix, prefix.

    OperatorData* found;
    int32_t form = NS_MATHML_OPERATOR_GET_FORM(aForm);
    if (!(found = GetOperatorData(aOperator, form))) {
      if (form == NS_MATHML_OPERATOR_FORM_INFIX ||
          !(found =
            GetOperatorData(aOperator, NS_MATHML_OPERATOR_FORM_INFIX))) {
        if (form == NS_MATHML_OPERATOR_FORM_POSTFIX ||
            !(found =
              GetOperatorData(aOperator, NS_MATHML_OPERATOR_FORM_POSTFIX))) {
          if (form != NS_MATHML_OPERATOR_FORM_PREFIX) {
            found = GetOperatorData(aOperator, NS_MATHML_OPERATOR_FORM_PREFIX);
          }
        }
      }
    }
    if (found) {
      NS_ASSERTION(found->mStr.Equals(aOperator), "bad setup");
      *aLeadingSpace = found->mLeadingSpace;
      *aTrailingSpace = found->mTrailingSpace;
      *aFlags &= ~NS_MATHML_OPERATOR_FORM; // clear the form bits
      *aFlags |= found->mFlags; // just add bits without overwriting
      return true;
    }
  }
  return false;
}
Exemplo n.º 16
0
PRBool
nsMathMLOperators::IsMutableOperator(const nsString& aOperator)
{
  if (!gInitialized) {
    InitGlobals();
  }
  // lookup all the variants of the operator and return true if there
  // is a variant that is stretchy or largeop
  nsOperatorFlags flags[4];
  float lspace[4], rspace[4];
  nsMathMLOperators::LookupOperators(aOperator, flags, lspace, rspace);
  nsOperatorFlags allFlags =
    flags[NS_MATHML_OPERATOR_FORM_INFIX] |
    flags[NS_MATHML_OPERATOR_FORM_POSTFIX] |
    flags[NS_MATHML_OPERATOR_FORM_PREFIX];
  return NS_MATHML_OPERATOR_IS_STRETCHY(allFlags) ||
         NS_MATHML_OPERATOR_IS_LARGEOP(allFlags);
}
Exemplo n.º 17
0
void
nsMathMLOperators::LookupOperators(const nsString&       aOperator,
                                   nsOperatorFlags*      aFlags,
                                   float*                aLeadingSpace,
                                   float*                aTrailingSpace)
{
  if (!gGlobalsInitialized) {
    InitGlobals();
  }

  aFlags[NS_MATHML_OPERATOR_FORM_INFIX] = 0;
  aLeadingSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;
  aTrailingSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;

  aFlags[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0;
  aLeadingSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;
  aTrailingSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;

  aFlags[NS_MATHML_OPERATOR_FORM_PREFIX] = 0;
  aLeadingSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = 0.0f;
  aTrailingSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = 0.0f;

  if (gOperatorTable) {
    OperatorData* found;
    found = GetOperatorData(aOperator, NS_MATHML_OPERATOR_FORM_INFIX);
    if (found) {
      aFlags[NS_MATHML_OPERATOR_FORM_INFIX] = found->mFlags;
      aLeadingSpace[NS_MATHML_OPERATOR_FORM_INFIX] = found->mLeadingSpace;
      aTrailingSpace[NS_MATHML_OPERATOR_FORM_INFIX] = found->mTrailingSpace;
    }
    found = GetOperatorData(aOperator, NS_MATHML_OPERATOR_FORM_POSTFIX);
    if (found) {
      aFlags[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mFlags;
      aLeadingSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mLeadingSpace;
      aTrailingSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mTrailingSpace;
    }
    found = GetOperatorData(aOperator, NS_MATHML_OPERATOR_FORM_PREFIX);
    if (found) {
      aFlags[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mFlags;
      aLeadingSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mLeadingSpace;
      aTrailingSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mTrailingSpace;
    }
  }
}
Exemplo n.º 18
0
/* EXPORT-> MakeXGraf: Connect to the X-server and init globals */
void MakeXGraf(char *wname, int x, int y, int w, int h, int bw)
{
   char sbuf[MAXSTRLEN], *hgraf = "HGraf";
   Window window, parent;
   XSetWindowAttributes setwinattr;
   unsigned long vmask;
   
   if (winCreated)
      HError(6870, "MakeXGraf: Attempt to recreate the graphics window");
   if ((theDisp = XOpenDisplay(NULL)) == NULL)
      HError(6870, "MakeXGraf: cannot connect to X server %s", XDisplayName(NULL));
   InitGlobals();
   InstallFonts();
   InstallColours();
   parent = RootWindow(theDisp, theScreen);
   window = XCreateSimpleWindow(theDisp, parent, x, y, w, h, bw, black, white );
   /* allow for backing up the contents of the window */
   vmask = CWBackingStore;  setwinattr.backing_store = WhenMapped;
   XChangeWindowAttributes(theDisp, window, vmask, &setwinattr);
   /* set the size hints for the window manager */
   hints.flags = PPosition | PSize | PMaxSize | PMinSize;
   hints.y = y;              hints.x = x;
   hints.width  = w;         hints.height = h;
   hints.min_width  = w;     hints.min_height = h;
   hints.max_width  = w;     hints.max_height = h;
   /* compose the name of the window */
   strcpy(sbuf, hgraf);  strcat(sbuf, ": ");  strcat(sbuf, wname);
   XSetStandardProperties(theDisp, window, sbuf, hgraf, None, NULL, 0, &hints);
   /* select events to receive */
   XSelectInput(theDisp, window, ExposureMask | KeyPressMask | ButtonPressMask | 
                ButtonReleaseMask | PointerMotionHintMask | PointerMotionMask);
   XMapWindow(theDisp, theWindow = window);
   InitGCs(); 
   HSetXMode(GCOPY); HSetFontSize(0); HSetLineWidth(0); HSetColour(BLACK);
   /* wait for the first expose event - cannot draw before it has arrived */
   do 
      XNextEvent(theDisp, &report); 
   while (report.type != Expose);
   XSendEvent(theDisp,window,False,ExposureMask,&report);
   /* Create heap for buttons */
   CreateHeap(&btnHeap, "Button heap", MHEAP, sizeof(HButton), 1.0, 100, 100);
   winCreated = TRUE;
}
Exemplo n.º 19
0
Arquivo: main.c Projeto: Neproify/ivmp
void main(void)
{
	InitThisScript();
	InitGlobals();
	InitPlayer();
	InitVisual();
	
	// script population natives affects all pop config
	SPECIFY_SCRIPT_POPULATION_ZONE_NUM_PEDS(100); 
	SPECIFY_SCRIPT_POPULATION_ZONE_NUM_SCENARIO_PEDS(100);
	ACTIVATE_SCRIPT_POPULATION_ZONE();

	WAIT(2000);
	HideLoadingScreen(4000);

	while (TRUE) 
	{
		WAIT(0);
	}
}
Exemplo n.º 20
0
App::App(void)
	:	BApplication(APP_SIGNATURE),
		fBuildCleanMode(false),
		fBuilder(NULL)
{
	InitFileTypes();
	InitGlobals();
	EnsureTemplates();
	
	gProjectList = new LockableList<Project>(20,true);
	gProjectWindowPoint.Set(5,24);

	BMessenger msgr(this);
	BEntry entry(gLastProjectPath.GetFullPath());
	entry_ref ref;
	entry.GetRef(&ref);
	fOpenPanel = new BFilePanel(B_OPEN_PANEL,&msgr,&ref,B_FILE_NODE,true,
								new BMessage(B_REFS_RECEIVED));
	fOpenPanel->Window()->SetTitle("Paladin: Open Project");
}
Exemplo n.º 21
0
void
nsCSSScanner::OutputError()
{
  if (mError.IsEmpty()) return;
 
  // Log it to the Error console

  if (InitGlobals() && gReportErrors) {
    if (!mWindowIDCached) {
      if (mSheet) {
        mWindowID = mSheet->FindOwningWindowID();
      }
      if (mWindowID == 0 && mLoader) {
        nsIDocument* doc = mLoader->GetDocument();
        if (doc) {
          mWindowID = doc->OuterWindowID();
        }
      }
      mWindowIDCached = PR_TRUE;
    }

    nsresult rv;
    nsCOMPtr<nsIScriptError2> errorObject =
      do_CreateInstance(gScriptErrorFactory, &rv);

    if (NS_SUCCEEDED(rv)) {
      rv = errorObject->InitWithWindowID(mError.get(),
                                         NS_ConvertUTF8toUTF16(mFileName).get(),
                                         EmptyString().get(),
                                         mErrorLineNumber,
                                         mErrorColNumber,
                                         nsIScriptError::warningFlag,
                                         "CSS Parser", mWindowID);
      if (NS_SUCCEEDED(rv)) {
        nsCOMPtr<nsIScriptError> logError = do_QueryInterface(errorObject);
        gConsoleService->LogMessage(logError);
      }
    }
  }
  ClearError();
}
Exemplo n.º 22
0
/* static */ eMATHVARIANT
nsMathMLOperators::LookupInvariantChar(const nsAString& aChar)
{
  if (!gInitialized) {
    InitGlobals();
  }
  if (gInvariantCharArray) {
    for (PRInt32 i = gInvariantCharArray->Length()-1; i >= 0; --i) {
      const nsString& list = gInvariantCharArray->ElementAt(i);
      nsString::const_iterator start, end;
      list.BeginReading(start);
      list.EndReading(end);
      // Style-invariant characters are at offset 3*j + 1.
      if (FindInReadable(aChar, start, end) &&
          start.size_backward() % 3 == 1) {
        return eMATHVARIANT(i);
      }
    }
  }
  return eMATHVARIANT_NONE;
}
Exemplo n.º 23
0
/* static */ const nsDependentSubstring
nsMathMLOperators::TransformVariantChar(const PRUnichar& aChar,
                                        eMATHVARIANT aVariant)
{
  if (!gInitialized) {
    InitGlobals();
  }
  if (gInvariantCharArray) {
    nsString list = gInvariantCharArray->ElementAt(aVariant);
    PRInt32 index = list.FindChar(aChar);
    // BMP characters are at offset 3*j
    if (index != kNotFound && index % 3 == 0 && list.Length() - index >= 2 ) {
      // The style-invariant character is the next character
      // (and list should contain padding if the next character is in the BMP).
      ++index;
      PRUint32 len = NS_IS_HIGH_SURROGATE(list.CharAt(index)) ? 2 : 1;
      return nsDependentSubstring(list, index, len);
    }
  }
  return nsDependentSubstring(&aChar, &aChar + 1);  
}
Exemplo n.º 24
0
/*
 * Class:     com_google_gwt_dev_shell_moz_LowLevelMoz
 * Method:    _registerExternalFactoryHandler
 * Signature: ()Z
 */
extern "C" JNIEXPORT jboolean JNICALL
Java_com_google_gwt_dev_shell_moz_LowLevelMoz__1registerExternalFactoryHandler
(JNIEnv* env, jclass llClass)
{
    if (!InitGlobals(env, llClass))
        return JNI_FALSE;

    // tracing isn't setup until after InitGlobals is called
    Tracer tracer("LowLevelMoz._registerExternalFactoryHandler");

    char buf[256];
    sprintf(buf, " jniEnv=%08x, llClass=%08x", (unsigned)env, (unsigned)llClass);
    tracer.log(buf);

    // Register "window.external" as our own class
    if (NS_FAILED(nsComponentManager::RegisterFactory(
                      kGwtExternalCID, "externalFactory", GWT_EXTERNAL_CONTRACTID,
                      new nsRpExternalFactory(), PR_TRUE))) {
        tracer.setFail("RegisterFactory failed");
        return JNI_FALSE;
    }

    nsCOMPtr<nsICategoryManager> categoryManager =
        do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
    if (!categoryManager) {
        tracer.setFail("unable to get category manager");
        return JNI_FALSE;
    }

    nsXPIDLCString previous;
    if (NS_FAILED(categoryManager->AddCategoryEntry(
                      JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY, "external", GWT_EXTERNAL_CONTRACTID,
                      PR_TRUE, PR_TRUE, getter_Copies(previous)))) {
        tracer.setFail("AddCategoryEntry failed");
        return JNI_FALSE;
    }

    return JNI_TRUE;
}
Exemplo n.º 25
0
void WinStartOsThread ()
{
	DWORD dw;

	InitGlobals ();
	gCLEAN_DONE = CreateEvent (NULL,	/* Default security attributes	*/
							   FALSE,	/* Not a manual-reset event 	*/
							   FALSE,	/* Initial state nonsignalled	*/
							   NULL);	/* No name						*/
	Check ((BOOL) gCLEAN_DONE, "\'InitOs\' could not create first event object");

	gOS_DONE = CreateEvent (NULL, FALSE, FALSE, NULL);
	Check ((BOOL) gOS_DONE, "\'InitOs\' could not create second event object");

	ghOSThreadHandle = CreateThread (NULL,				/* Default security attributes		*/
									 0,					/* Default stacksize				*/
								  (LPTHREAD_START_ROUTINE) OsThreadFunction,
									 0,					/* parameter to thread function		*/
									 0,					/* Not initially suspended			*/
									 &dw);				/* store threadId here				*/
	Check ((BOOL) ghOSThreadHandle, "\'InitOs\' could not create second thread");	// PA!!! test fails
	WaitForSingleObject (gOS_DONE, INFINITE);
}	/* WinStartOSThread */
Exemplo n.º 26
0
int main(int argc, char** argv)
{
  arg_t args;
  int i,j;
  uint64_t sum;


  if (argc != 4)
  {
    puts("wrong arguments. usage: parsum <threads> <start> <end>");
    return -1;
  }

  read_args(argv, &args);
  printf("running with %u threads from %llu to %llu max\n",
         args.threads, args.start, args.end);

  pthread_t threads[args.threads];
  int thread_nr[args.threads];

  InitGlobals(args.start,args.end,args.threads);

  for (i=0; i<args.threads; ++i) {
      thread_nr[i] = i;
      pthread_create(&threads[i], NULL, ParSum, (void *) &thread_nr[i]);
   }
 
  for (i=0; i<args.threads; ++i) {
      pthread_join(threads[i], NULL);
      sum = sum + globalSum[i];
   }

   FILE * output = fopen("output.txt", "w");
   fprintf(output,"%llu", sum);

}
Exemplo n.º 27
0
// We don't call this directly from DLL_PROCESS_ATTACH because if we do things
// can break when we're loaded via LoadLibrary
// Instead this is called by LunaDLLInitHook, which is set up by
// SetupLunaDLLInitHook that runs from DLL_PROCESS_ATTACH
void LunaDLLInit()
{
    InitGlobals();
#if PATCHIT
    TrySkipPatch();
#endif // PATCHIT

    // Test OpenGL support
    if (!gStartupSettings.noGL && LunaDLLTestGLFeatures()) {
        g_GLEngine.Enable();
    } else {
        g_GLEngine.Disable();
    }

    // Set processor affinity for the main thread. Switching cores is bad for stable frame rate
    DWORD curProcessor = GetCurrentProcessorNumberXP();
    SetThreadAffinityMask(GetCurrentThread(), 1 << curProcessor);
    SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);

    // Initialize GDI+ so we can make use of it
    ULONG_PTR m_gdiplusToken;   // class member
    Gdiplus::GdiplusStartupInput gdiplusStartupInput;
    Gdiplus::GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL);
}
Exemplo n.º 28
0
//
// Init GL
//
int InitGL(GLvoid)					// All Setup For OpenGL Goes Here
{
    // seed rand generator
    srand((unsigned int)time(NULL));

    // Load the key codes --
    LoadKeyCodes();

    // enable all the goodies
    Super_LoadGlobals();

    Load_ConfigFile();
    Super_FireAnts();

    Create_Col_List();
    Create_Wall_List();


    //
    // loading sound library
    printf("Loading sound library, make sure 'music apps' are closed\n");
    Load_Audio();


    glShadeModel(GL_SMOOTH);					// Enable Smooth Shading
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);				// Black Background
    glClearDepth(1.0f);						// Depth Buffer Setup


    glEnable(GL_NORMALIZE);
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

    glShadeModel(GL_SMOOTH);


    glEnable(GL_DEPTH_TEST);				// Enables Depth Testing
    glDepthFunc(GL_LEQUAL);					// The Type Of Depth Testing To Do
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations


    // have to load the quadrice to be used
    quadric=gluNewQuadric();			// Create A Pointer To The Quadric Object (NEW)
    gluQuadricNormals(quadric, GLU_SMOOTH);		// Create Smooth Normals (NEW)
    gluQuadricTexture(quadric, GL_TRUE);		// Create Texture Coords (NEW)


    GenerateFireAnts();

    CreateWorld();

    LoadCameras();

    // Load the objects
    InitObjects();
    GenerateLights();

    InitGlobals();

    Build_ParticleSet();
    Reset_FontID();

    // Load the title screen text
    Load_Titles();

    // load the text library
    Super_MainText();

    CreateWalls();

    //
    // Load the collsion test for the walll
    //

    // front wall
    InsertColSegment(world_ptr->x_min, world_ptr->y_max,
                     world_ptr->x_max, world_ptr->y_max);

    // right wall
    InsertColSegment(world_ptr->x_max, world_ptr->y_min,
                     world_ptr->x_max, world_ptr->y_max);

    // back wall
    InsertColSegment(world_ptr->x_min, world_ptr->y_min,
                     world_ptr->x_max, world_ptr->y_min);

    // left wall
    InsertColSegment(world_ptr->x_min, world_ptr->y_min,
                     world_ptr->x_min, world_ptr->y_max);

    //
    // for the network save
    // the number of bots incase it is changed
    MAX_SAVED_BOTS = MAX_FIRE_ANTS;


    // end of insertion

    Super_InitNetwork();

    //
    // begin in paused mode
    //
    Super_BeginPaused();

    mSuper_Loaded = LOADED_TRUE;


    return true;			// Initialization Went OK

} // end of the function
NS_IMETHODIMP nsFontMetricsPh::Init ( const nsFont& aFont, nsIAtom* aLangGroup, nsIDeviceContext* aContext )
{
	NS_ASSERTION(!(nsnull == aContext), "attempt to init fontmetrics with null device context");
	
	nsAutoString  firstFace;
	char          *str = nsnull;
	nsresult      result;
	PhRect_t      extent;

	if( !gFontMetricsCache ) {
		nsresult res = InitGlobals( );
		if( NS_FAILED(res) ) return res;
		}
	
	mFont = aFont;
	mLangGroup = aLangGroup;
	
	mDeviceContext = aContext;
	
	result = aContext->FirstExistingFont(aFont, firstFace);

	str = ToNewCString(firstFace);

#ifdef DEBUG_Adrian
printf( "\n\n\t\t\tIn nsFontMetricsPh::Init str=%s\n", str );
#endif

	if( !str || !str[0] )
	{
		if( str ) free (str);
		str = strdup("serif");
	}
	
	const char *cstring;
	aLangGroup->GetUTF8String( &cstring );
	
	char *prop = PR_smprintf( "font.name.%s.%s", str, cstring );
		
	char *font_default = NULL;
	if( prop )
		{
		gPref->CopyCharPref( prop, &font_default );
		PR_smprintf_free( prop );
		}
	else gPref->CopyCharPref( "font.name.serif.x-western", &font_default );

	if( font_default )
		{
		free (str);
		/* font_default was allocated. in CopyCharPref. */
		str = font_default;
		}

	float app2dev;
	app2dev = mDeviceContext->AppUnitsToDevUnits();

	PRInt32 sizePoints;
	if( mFont.systemFont == PR_TRUE )
		sizePoints = NSToIntRound( app2dev * mFont.size * 0.68 );
	else sizePoints = NSToIntRound( app2dev * mFont.size * 0.74 );
	
	char NSFullFontName[MAX_FONT_TAG];

	unsigned int uiFlags = 0L;

	if(aFont.weight > NS_FONT_WEIGHT_NORMAL)
	   uiFlags |= PF_STYLE_BOLD;

	if(aFont.style & (NS_FONT_STYLE_ITALIC|NS_FONT_STYLE_OBLIQUE) )
	   uiFlags |= PF_STYLE_ITALIC;

	if(aFont.style & NS_FONT_STYLE_ANTIALIAS)
		uiFlags |= PF_STYLE_ANTIALIAS;

	if( PfGenerateFontName( (char *)str, uiFlags, sizePoints, (char *)NSFullFontName ) == NULL )
	  {
#ifdef DEBUG_Adrian
printf( "!!!!!!!!!!!! PfGenerateFontName failed\n" );
#endif
		  PfGenerateFontName( "TextFont", uiFlags, sizePoints, (char *)NSFullFontName );
	  }

	/* Once the Photon Font String is built get the attributes */
	FontQueryInfo *node;

	nsCStringKey key((char *)(NSFullFontName));
	node = (FontQueryInfo *) gFontMetricsCache->Get(&key);

#ifdef DEBUG_Adrian
printf( "\t\t\tThe generated font name is NSFullFontName=%s\n", NSFullFontName );
if( node ) printf( "\t\t\t( cached ) The real font is desc=%s\n", node->desc );
#endif

	if( !node )
	  {
		node = (FontQueryInfo *)calloc(sizeof(FontQueryInfo), 1);
		PfQueryFont(NSFullFontName, node);

#ifdef DEBUG_Adrian
printf( "\t\t\t(not cached ) The real font is desc=%s\n", node->desc );
printf( "\tCall PfLoadMetrics for NSFullFontName=%s\n", NSFullFontName );
#endif

		gFontMetricsCache->Put(&key, node);

		PfLoadMetrics( NSFullFontName );
	  }

	float dev2app;
	double height;
	nscoord onePixel;

	dev2app = mDeviceContext->DevUnitsToAppUnits();
	onePixel = NSToCoordRound(1 * dev2app);
	height = node->descender - node->ascender;
	PfExtent( &extent, NULL, NSFullFontName, 0L, 0L, " ", 1, PF_SIMPLE_METRICS, NULL );
	mSpaceWidth = NSToCoordRound((extent.lr.x - extent.ul.x + 1) * dev2app);

	mLeading = NSToCoordRound(0);
	mEmHeight = NSToCoordRound(height * dev2app);
	mEmAscent = NSToCoordRound(node->ascender * dev2app * -1.0);
	mEmDescent = NSToCoordRound(node->descender * dev2app);
	mHeight = mMaxHeight = NSToCoordRound(height * dev2app);
	mAscent = mMaxAscent = NSToCoordRound(node->ascender * dev2app * -1.0);
	mDescent = mMaxDescent = NSToCoordRound(node->descender * dev2app);
	mMaxAdvance = NSToCoordRound(node->width * dev2app);
	mAveCharWidth = mSpaceWidth;

	mXHeight = NSToCoordRound((float)node->ascender * dev2app * 0.56f * -1.0); // 56% of ascent, best guess for non-true type
	mSuperscriptOffset = mXHeight;     // XXX temporary code!
	mSubscriptOffset = mXHeight;     // XXX temporary code!

	mStrikeoutSize = onePixel; // XXX this is a guess
	mStrikeoutOffset = NSToCoordRound(mXHeight / 2.0f); // 50% of xHeight
	mUnderlineSize = onePixel; // XXX this is a guess
	mUnderlineOffset = -NSToCoordRound((float)node->descender * dev2app * 0.30f); // 30% of descent

	if (mFontHandle)
	   free (mFontHandle);
	mFontHandle = strdup(NSFullFontName);

	free (str);
	return NS_OK;
}
Exemplo n.º 30
0
PRBool
nsMathMLOperators::LookupOperator(const nsString&       aOperator,
                                  const nsOperatorFlags aForm,
                                  nsOperatorFlags*      aFlags,
                                  float*                aLeftSpace,
                                  float*                aRightSpace)
{
  if (!gInitialized) {
    InitGlobals();
  }
  if (gOperatorTable) {
    NS_ASSERTION(aFlags && aLeftSpace && aRightSpace, "bad usage");
    NS_ASSERTION(aForm>=0 && aForm<4, "*** invalid call ***");

    OperatorData* found;
    PRInt32 form = NS_MATHML_OPERATOR_GET_FORM(aForm);
    gOperatorFound[NS_MATHML_OPERATOR_FORM_INFIX] = nsnull;
    gOperatorFound[NS_MATHML_OPERATOR_FORM_POSTFIX] = nsnull;
    gOperatorFound[NS_MATHML_OPERATOR_FORM_PREFIX] = nsnull;

    nsAutoString key(aOperator);
    key.AppendInt(form, 10);
    nsStringKey hkey(key);
    gOperatorFound[form] = found = (OperatorData*)gOperatorTable->Get(&hkey);

    // If not found, check if the operator exists perhaps in a different form,
    // in the order of preference: infix, postfix, prefix
    if (!found) {
      if (form != NS_MATHML_OPERATOR_FORM_INFIX) {
        form = NS_MATHML_OPERATOR_FORM_INFIX;
        key.Assign(aOperator);
        key.AppendInt(form, 10);
        nsStringKey hashkey(key);
        gOperatorFound[form] = found = (OperatorData*)gOperatorTable->Get(&hashkey);
      }
      if (!found) {
        if (form != NS_MATHML_OPERATOR_FORM_POSTFIX) {
          form = NS_MATHML_OPERATOR_FORM_POSTFIX;
          key.Assign(aOperator);
          key.AppendInt(form, 10);
          nsStringKey hashkey(key);
          gOperatorFound[form] = found = (OperatorData*)gOperatorTable->Get(&hashkey);
        }
        if (!found) {
          if (form != NS_MATHML_OPERATOR_FORM_PREFIX) {
            form = NS_MATHML_OPERATOR_FORM_PREFIX;
            key.Assign(aOperator);
            key.AppendInt(form, 10);
            nsStringKey hashkey(key);
            gOperatorFound[form] = found = (OperatorData*)gOperatorTable->Get(&hashkey);
          }
        }
      }
    }
    if (found) {
      NS_ASSERTION(found->mStr.Equals(aOperator), "bad setup");
      *aLeftSpace = found->mLeftSpace;
      *aRightSpace = found->mRightSpace;
      *aFlags &= ~NS_MATHML_OPERATOR_FORM; // clear the form bits
      *aFlags |= found->mFlags; // just add bits without overwriting
      return PR_TRUE;
    }
  }
  return PR_FALSE;
}