int ctokens_callback(const TokenInfo*info) { cbdata*c=info->user_data; lua_State*L=c->L; lua_rawgeti(L, LUA_REGISTRYINDEX, c->func_idx); lua_newtable(L); lua_pushstring(L, "token"); lua_pushlstring(L,info->token,info->len); lua_rawset(L,-3); SetTableStr("kind",kinds[info->type]); SetTableInt("line", info->line); SetTableInt("column", info->col); if (c->data_idx!=LUA_REFNIL) { lua_pushstring(L, "data"); lua_rawgeti(L, LUA_REGISTRYINDEX, c->data_idx); lua_rawset(L,-3); } lua_call(c->L, 1, 1); return lua_toboolean(c->L,-1); }
void LayerListing::CreateListing() { StdTitle("Multiple Layer Specification"); AddBoolText("Layer depth specification", enterLayerDepths, "Depth BGS", "Elevation ASL"); const char* titleStr; UnitReal currThick; if (enterLayerDepths) { titleStr = "Depth"; AddUnitReal("Depth of system bottom", bottomLayerDepth); currThick = bottomLayerDepth; } else { titleStr = "Elevation"; AddUnitReal("Elevation of system bottom", bottomLayerElevation); currThick = bottomLayerElevation; } char unitStr[40]; currThick.MakeUnitString(unitStr, 40); LayerStaticSupport::GeoLayerCleanup(); SubTitle("Geology Layers"); SC_IntArray colWidth(7, 15); SC_BoolArray leftJust(7, false); colWidth[0] = 20; leftJust[0] = true; TableSetup(colWidth, leftJust, 1, 0); SetTableCol("ID", titleStr, "Thickness", "Skin?", "Conductivity", "# nodes"); SetTableCol(1, unitStr); SetTableCol(2, unitStr); AddNextLine(); AddNextLine(); char tempStr[80]; for (int i = 0; i < geologyLayers.Size(); i++) { GeologyLayer& currLayer = geologyLayers[i]; SetTableCol(0, currLayer.intervalID); currLayer.GetUserDepthString(tempStr, 80); SetTableCol(1, tempStr); currLayer.GetUserThickString(tempStr, 80); SetTableCol(2, tempStr); SetTableBool(3, currLayer.layerHasSkin, "Skin", "No Skin"); SetTableBool(4, currLayer.layerIsIsotropic, "Isotropic", "Anisotropic"); SetTableInt(5, currLayer.nintervalNodes); AddNextLine(); } SubTitle("Wellbore Zones"); LayerStaticSupport::WellBoreZoneCleanup(); colWidth.SetSize(7); leftJust.SetSize(7); TableSetup(colWidth, leftJust, 1, 0); SetTableCol("ID", titleStr, "Thickness", "Type", "Delta Volume", "TZ Comp", "# nodes"); SetTableCol(1, unitStr); SetTableCol(2, unitStr); char deltaVolUnitStr[40]; wellboreZoneDeltaVolumeUnits.MakeUnitString(deltaVolUnitStr, 40); SetTableCol(4, unitStr); char tzCompUnitStr[40]; wellboreZoneTZCompUnits.MakeUnitString(tzCompUnitStr, 40); SetTableCol(5, unitStr); AddNextLine(); AddNextLine(); for (int i = 0; i < wellBoreZones.Size(); i++) { WellBoreZone& currZone = wellBoreZones[i]; SetTableCol(0, currZone.intervalID); currZone.GetUserDepthString(tempStr, 80); SetTableCol(1, tempStr); currZone.GetUserThickString(tempStr, 80); SetTableCol(2, tempStr); SetTableBool(3, currZone.zoneIsPacker, "Packer", "Zone"); if (currZone.zoneIsPacker) { SetTableCol(4, "n/a"); SetTableCol(5, "n/a"); } else { currZone.GetUserDeltaVolumeString(tempStr, 80); SetTableCol(4, tempStr); currZone.GetUserTZCompString(tempStr, 80); SetTableCol(5, tempStr); } SetTableInt(6, currZone.nintervalNodes); AddNextLine(); } }